Changeset 2141
- Timestamp:
- May 23, 2012, 5:09:56 PM (7 years ago)
- Location:
- trunk/symbol_table
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/symbol_table/main_template.cpp
r2140 r2141 79 79 uint8_t * COPYBACK; 80 80 uint8_t * src_buffer; 81 ALLOC_STATIC_ALIGNED_BYTE_BUFFER(COPYBACK, src_buffer); 81 // ALLOC_STATIC_ALIGNED_BYTE_BUFFER(COPYBACK, src_buffer); 82 ATTRIBUTE_SIMD_ALIGN BitBlock aligned_base[BUFFER_SIZE]; 83 COPYBACK = (uint8_t *)aligned_base; 84 memset(COPYBACK,0,COPYBACK_SIZE); 85 src_buffer = ©BACK[COPYBACK_SIZE]; 82 86 83 87 // hash 0 … … 159 163 gid_type gid; 160 164 161 #ifdef INDEX_AT_FOLLOWS 165 #ifdef INDEX_AT_STARTS 166 ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts)); 167 #else 162 168 ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].follows)); 163 #else164 ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts));165 169 #endif 166 170 … … 222 226 gid_type gid; 223 227 224 #ifdef INDEX_AT_FOLLOWS 228 #ifdef INDEX_AT_STARTS 229 ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts)); 230 #else 225 231 ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].follows)); 226 #else227 ForwardScanner<BitBlock, scanword_t> scanner(&(groups[blk].starts));228 232 #endif 229 233 -
trunk/symbol_table/src/Makefile
r2119 r2141 21 21 ########################################################################### 22 22 id: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp hash_table.hpp ../lib/hash.hpp group_strms.hpp symbol_table.hpp main.cpp marker_strms.hpp symbol_table.hpp transpose.hpp 23 $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG23 $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG 24 24 25 25 div2: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp hash_table.hpp ../lib/hash.hpp group_strms.hpp symbol_table.hpp main.cpp marker_strms.hpp symbol_table.hpp transpose.hpp 26 $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DBUFFER_PROFILING #-DHASH_TABLE_HPP_DEBUG #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG26 $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DBUFFER_PROFILING #-DHASH_TABLE_HPP_DEBUG #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG 27 27 28 28 logbase2: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp hash_table.hpp ../lib/hash.hpp group_strms.hpp symbol_table.hpp main.cpp marker_strms.hpp symbol_table.hpp transpose.hpp 29 $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG29 $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG 30 30 31 31 div2_logbase2: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp hash_table.hpp ../lib/hash.hpp group_strms.hpp symbol_table.hpp main.cpp marker_strms.hpp symbol_table.hpp transpose.hpp 32 $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG32 $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG 33 33 34 34 bit_byte: basis_bits.hpp buffer.hpp byte_pool.hpp hash_strms.hpp hash_table.hpp ../lib/hash.hpp group_strms.hpp symbol_table.hpp main.cpp marker_strms.hpp symbol_table.hpp transpose.hpp 35 $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG35 $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DBUFFER_PROFILING #-DID_SYMBOL_TABLE_TEMPLATE_HPP_DEBUG #-DHASH_TABLE_HPP_DEBUG 36 36 37 37 ########################################################################### … … 39 39 ########################################################################### 40 40 id_diff_test: id 41 $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS41 $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DIDENTITY_TEST 42 42 python $(TEST_SCRIPT) id -d 43 43 diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0 44 44 45 45 div2_diff_test: div2 46 $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS46 $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DIDENTITY_TEST 47 47 python $(TEST_SCRIPT) div2 -d 48 48 diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0 49 49 50 50 logbase2_diff_test: logbase2 51 $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS51 $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DIDENTITY_TEST 52 52 python $(TEST_SCRIPT) logbase2 -d 53 53 diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0 54 54 55 55 div2_logbase2_diff_test: div2_logbase2 56 $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS56 $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DIDENTITY_TEST 57 57 python $(TEST_SCRIPT) div2_logbase2 -d 58 58 diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0 59 59 60 60 bit_byte_diff_test: bit_byte 61 $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DIDENTITY_TEST -DINDEX_AT_FOLLOWS61 $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DIDENTITY_TEST 62 62 python $(TEST_SCRIPT) bit_byte -d 63 63 diff -rq --exclude=".svn" $(TEST_SRC_DIR) $(TEST_DST_DIR) || exit 0 … … 67 67 ########################################################################### 68 68 id_gid_test: 69 $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DGID_TEST 69 $(CC) -o id main.cpp $(AFLAGS) -DID_STRATEGY -DGID_TEST 70 70 python $(TEST_SCRIPT) id -g 71 71 72 72 div2_gid_test: 73 $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DGID_TEST 73 $(CC) -o div2 main.cpp $(AFLAGS) -DDIV2_STRATEGY -DGID_TEST 74 74 python $(TEST_SCRIPT) div2 -g 75 75 76 76 logbase2_gid_test: 77 $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DGID_TEST 77 $(CC) -o logbase2 main.cpp $(AFLAGS) -DLOGBASE2_STRATEGY -DGID_TEST 78 78 python $(TEST_SCRIPT) logbase2 -g 79 79 80 80 div2_logbase2_gid_test: 81 $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DGID_TEST 81 $(CC) -o div2_logbase2 main.cpp $(AFLAGS) -DDIV2_LOGBASE2_STRATEGY -DGID_TEST 82 82 python $(TEST_SCRIPT) div2_logbase2 -g 83 83 84 84 bit_byte_gid_test: 85 $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DGID_TEST 85 $(CC) -o bit_byte main.cpp $(AFLAGS) -DBIT_BYTE_STRATEGY -DGID_TEST 86 86 python $(TEST_SCRIPT) bit_byte -g 87 87 -
trunk/symbol_table/src/buffer.hpp
r2140 r2141 11 11 #define PADDING_BLOCKS 0 12 12 #define PADDING_SIZE (BLOCK_SIZE * PADDING_BLOCKS) 13 #define COPYBACK_BLOCKS 1013 #define COPYBACK_BLOCKS 2 14 14 #define COPYBACK_SIZE (BLOCK_SIZE * COPYBACK_BLOCKS) 15 #define SEGMENT_BLOCKS 100015 #define SEGMENT_BLOCKS 2 16 16 #define SEGMENT_SIZE (BLOCK_SIZE * SEGMENT_BLOCKS) 17 17 #define BUFFER_SIZE (COPYBACK_SIZE + SEGMENT_SIZE + PADDING_SIZE) … … 42 42 43 43 #define COPY_BACK_BYTE_BUFFER(copyback, base) \ 44 do { void * src= copyback;\45 void * dest= (uint8_t *)base + (SEGMENT_SIZE - COPYBACK_SIZE);\44 do { void * dest = copyback;\ 45 void * src = (uint8_t *)base + (SEGMENT_SIZE - COPYBACK_SIZE);\ 46 46 assert_bitblock_align(src);\ 47 47 assert_bitblock_align(dest);\ 48 memmove( src, dest, COPYBACK_SIZE);\48 memmove(dest, src, COPYBACK_SIZE);\ 49 49 } while(0) 50 50 51 51 #define COPY_BACK_BITBLOCK_BUFFER(copyback, base) \ 52 do { void * src= copyback;\53 void * dest= (uint8_t *)base + ((SEGMENT_SIZE - COPYBACK_SIZE)/8);\52 do { void * dest = copyback;\ 53 void * src = (uint8_t *)base + ((SEGMENT_SIZE - COPYBACK_SIZE)/8);\ 54 54 assert_bitblock_align(src);\ 55 55 assert_bitblock_align(dest);\ 56 memmove( src, dest, COPYBACK_SIZE/8);\56 memmove(dest, src, COPYBACK_SIZE/8);\ 57 57 } while(0) 58 58 -
trunk/symbol_table/src/symbol_table.hpp
r2140 r2141 327 327 gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, gid_factory, gid_data); // WARNING: spos must be >= 0 328 328 329 #ifdef INDEX_AT_FOLLOWS 329 #ifdef INDEX_AT_STARTS 330 gids.at[blk_offset + fpos - gid_data.get_bytes_lgth(gid)] = gid; 331 #else 330 332 gids.at[blk_offset + fpos] = gid; 331 #else332 gids.at[blk_offset + fpos - gid_data.get_bytes_lgth(gid)] = gid;333 333 #endif 334 334 … … 399 399 gid = h_table.lookup_or_insert(buffer_base, spos, lgth, h0_base, h1_base, gid_factory, gid_data); 400 400 401 #ifdef INDEX_AT_FOLLOWS 401 #ifdef INDEX_AT_STARTS 402 gids.at[blk_offset + fpos - lgth] = gid; 403 #else // INDEX_AT_FOLLOWS 402 404 gids.at[blk_offset + fpos] = gid; 403 #else404 gids.at[blk_offset + fpos - lgth] = gid;405 405 #endif 406 406 -
trunk/symbol_table/test/run_tests.py
r2114 r2141 114 114 print "All pass." 115 115 else: 116 print "Fail. "116 print "Fail. Potential cauase: Insufficient COPYBACK_BLOCKS (buffer.hpp)." 117 117
Note: See TracChangeset
for help on using the changeset viewer.