Changeset 1982

Show
Ignore:
Timestamp:
03/27/12 20:53:17 (14 months ago)
Author:
ksherdy
Message:

Update main template.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/main_template.cpp

    r1969 r1982  
    2828 
    2929#include "transpose.hpp" 
     30#include "buffer.hpp" 
     31 
    3032#include "../lib/bitblock.hpp" 
    3133#include "../lib/allocator.hpp" 
     
    5557#endif 
    5658 
    57 /////////////////////////////////////////////////////////////////////////// 
    58 // Buffer Management 
    59 /////////////////////////////////////////////////////////////////////////// 
    60 #define PADDING_BLOCKS 1 
    61 #define PADDING_SIZE BLOCK_SIZE * PADDING_BLOCKS 
    62 #define LOOKBACK_BLOCKS 1 
    63 #define LOOKBACK_SIZE BLOCK_SIZE * LOOKBACK_BLOCKS 
    64 #define SEGMENT_BLOCKS 10 
    65 #define SEGMENT_SIZE BLOCK_SIZE * (SEGMENT_BLOCKS)                                          // (bytes) a multiple of BLOCK_SIZE 
    66 #define SEGMENT_ALLOC_SIZE (LOOKBACK_SIZE + SEGMENT_SIZE + PADDING_SIZE) / sizeof(BitBlock) // (bytes) 
    6759 
    6860// Target symbol type must inherit from AoS_symbol 
     
    119111    BitBlock * h1 = &lookback_h1[LOOKBACK_SIZE/BLOCK_SIZE]; 
    120112 
     113    // starts 
     114    BitBlock aligned_starts[SEGMENT_ALLOC_SIZE/8]; 
     115    BitBlock * lookback_starts = (BitBlock *) aligned_starts; 
     116    memset(lookback_starts,0,LOOKBACK_SIZE/BLOCK_SIZE); 
     117    BitBlock * starts = &lookback_starts[LOOKBACK_SIZE/BLOCK_SIZE]; 
     118 
     119    // ends_gte_17 
     120    BitBlock aligned_ends_gte_17[SEGMENT_ALLOC_SIZE/8]; 
     121    BitBlock * lookback_ends_gte_17 = (BitBlock *) aligned_ends_gte_17; 
     122    memset(lookback_ends_gte_17,0,LOOKBACK_SIZE/BLOCK_SIZE); 
     123    BitBlock * ends_gte_17 = &lookback_h1[LOOKBACK_SIZE/BLOCK_SIZE]; 
     124 
     125 
    121126    // BitSteams - Without lookback 
    122127    Basis_bits basis_bits[SEGMENT_BLOCKS]; 
     
    150155//    } 
    151156 
    152       for(int blk=0;blk<SEGMENT_BLOCKS;blk++) { // write contiguous hash bit streams 
     157      for(int blk=0;blk<SEGMENT_BLOCKS;blk++) { // write contiguous bit streams 
    153158        h0[blk] = hash[blk].h0; 
    154159        h1[blk] = hash[blk].h1; 
     160        starts[blk] = groups[blk].starts; 
     161        ends_gte_17[blk] = groups[blk].ends_gte_17; 
    155162      } 
    156163 
    157164      PERF_SEC_START(parser_timer); 
    158       symbol_table.resolve(raw_buffer, groups, h0, h1, SEGMENT_BLOCKS, symbol_ary, SYMBOL_COUNT); 
     165      symbol_table.resolve(raw_buffer, groups, starts, ends_gte_17, h0, h1, SEGMENT_BLOCKS, symbol_ary, SYMBOL_COUNT); 
    159166      PERF_SEC_END(parser_timer, SEGMENT_SIZE); 
    160167 
     
    164171      memmove(lookback_h0,&((uint8_t *)h0)[(SEGMENT_SIZE-LOOKBACK_SIZE)/8],LOOKBACK_SIZE/8); 
    165172      memmove(lookback_h1,&((uint8_t *)h1)[(SEGMENT_SIZE-LOOKBACK_SIZE)/8],LOOKBACK_SIZE/8); 
     173 
     174      memmove(lookback_starts,&((uint8_t *)starts)[(SEGMENT_SIZE-LOOKBACK_SIZE)/8],LOOKBACK_SIZE/8); 
     175      memmove(lookback_ends_gte_17,&((uint8_t *)ends_gte_17)[(SEGMENT_SIZE-LOOKBACK_SIZE)/8],LOOKBACK_SIZE/8); 
    166176 
    167177      //lookback_h0[0] = h0[SEGMENT_BLOCKS-1]; 
     
    203213//    } 
    204214 
    205  
    206215    uint32_t segment_size = blk; 
    207216    for(int blk=0;blk<segment_size;blk++) { // write contiguous hash bit streams 
    208217        h0[blk] = hash[blk].h0; 
    209218        h1[blk] = hash[blk].h1; 
     219        starts[blk] = groups[blk].starts; 
     220        ends_gte_17[blk] = groups[blk].ends_gte_17; 
    210221    } 
    211222 
    212223    //PERF_SEC_START(parser_timer); 
    213     symbol_table.resolve(raw_buffer, groups, h0, h1, blk, symbol_ary, SYMBOL_COUNT); 
     224    symbol_table.resolve(raw_buffer, groups, starts, ends_gte_17, h0, h1, blk, symbol_ary, SYMBOL_COUNT); 
    214225    //PERF_SEC_END(parser_timer, chars_avail+1); 
    215226