Changeset 8c60d59 for doc/theses/thierry_delisle_PhD
- Timestamp:
- Jun 10, 2020, 12:03:12 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5f259f3
- Parents:
- edb2fe0
- Location:
- doc/theses/thierry_delisle_PhD/code
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/code/snzi.hpp
redb2fe0 r8c60d59 29 29 30 30 private: 31 class __attribute__((aligned( 64))) node {31 class __attribute__((aligned(128))) node { 32 32 friend class snzi_t; 33 33 private: -
doc/theses/thierry_delisle_PhD/code/snzm.hpp
redb2fe0 r8c60d59 12 12 std::unique_ptr<snzm_t::node[]> nodes; 13 13 14 #if defined(__BMI2__) 15 const uint64_t indexes = 0x0706050403020100; 16 #endif 17 14 18 snzm_t(unsigned numLists); 15 19 … … 28 32 } 29 33 30 size_t masks( unsigned node ) {34 uint64_t masks( unsigned node ) { 31 35 /* paranoid */ assert( (node & mask) == node ); 32 return nodes[node].mask; 36 #if defined(__BMI2__) 37 return nodes[node].mask_all; 38 #else 39 return nodes[node].mask; 40 #endif 33 41 } 34 42 35 43 private: 36 class __attribute__((aligned( 64))) node {44 class __attribute__((aligned(128))) node { 37 45 friend class snzm_t; 38 46 private: … … 140 148 private: 141 149 volatile val_t value; 142 volatile size_t mask = 0; 150 #if defined(__BMI2__) 151 union __attribute__((packed)) { 152 volatile uint8_t mask[8]; 153 volatile uint64_t mask_all; 154 }; 155 #else 156 volatile size_t mask = 0; 157 #endif 158 143 159 class node * parent = nullptr; 144 160 bool is_leaf = false; … … 151 167 void arrive( int bit ) { 152 168 /* paranoid */ assert( is_leaf ); 153 /* paranoid */ assert( (mask & ( 1 << bit )) == 0 ); 154 155 __atomic_fetch_add( &mask, 1 << bit, __ATOMIC_RELAXED ); 169 156 170 arrive_h(); 171 #if defined(__BMI2__) 172 /* paranoid */ assert( bit < 8 ); 173 mask[bit] = 0xff; 174 #else 175 /* paranoid */ assert( (mask & ( 1 << bit )) == 0 ); 176 __atomic_fetch_add( &mask, 1 << bit, __ATOMIC_RELAXED ); 177 #endif 157 178 158 179 } … … 160 181 void depart( int bit ) { 161 182 /* paranoid */ assert( is_leaf ); 162 /* paranoid */ assert( (mask & ( 1 << bit )) != 0 ); 163 183 184 #if defined(__BMI2__) 185 /* paranoid */ assert( bit < 8 ); 186 mask[bit] = 0x00; 187 #else 188 /* paranoid */ assert( (mask & ( 1 << bit )) != 0 ); 189 __atomic_fetch_sub( &mask, 1 << bit, __ATOMIC_RELAXED ); 190 #endif 164 191 depart_h(); 165 __atomic_fetch_sub( &mask, 1 << bit, __ATOMIC_RELAXED );166 192 } 167 193
Note: See TracChangeset
for help on using the changeset viewer.