diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / src / hydrogen - check - elimination . cc <nl> ppp b / src / hydrogen - check - elimination . cc <nl> <nl> / / found in the LICENSE file . <nl> <nl> # include " hydrogen - check - elimination . h " <nl> + <nl> # include " hydrogen - alias - analysis . h " <nl> # include " hydrogen - flow - engine . h " <nl> <nl> namespace internal { <nl> typedef const UniqueSet < Map > * MapSet ; <nl> <nl> struct HCheckTableEntry { <nl> + enum State { <nl> + / / We have seen a map check ( i . e . an HCheckMaps ) for these maps , so we can <nl> + / / use this information to eliminate further map checks , elements kind <nl> + / / transitions , etc . <nl> + CHECKED , <nl> + / / Same as CHECKED , but we also know that these maps are stable . <nl> + CHECKED_STABLE , <nl> + / / These maps are stable , but not checked ( i . e . we learned this via field <nl> + / / type tracking or from a constant , or they were initially CHECKED_STABLE , <nl> + / / but became UNCHECKED_STABLE because of an instruction that changes maps <nl> + / / or elements kind ) , and we need a stability check for them in order to use <nl> + / / this information for check elimination ( which turns them back to <nl> + / / CHECKED_STABLE ) . <nl> + UNCHECKED_STABLE <nl> + } ; <nl> + <nl> + static const char * State2String ( State state ) { <nl> + switch ( state ) { <nl> + case CHECKED : return " checked " ; <nl> + case CHECKED_STABLE : return " checked stable " ; <nl> + case UNCHECKED_STABLE : return " unchecked stable " ; <nl> + } <nl> + UNREACHABLE ( ) ; <nl> + return NULL ; <nl> + } <nl> + <nl> + static State StateMerge ( State state1 , State state2 ) { <nl> + if ( state1 = = state2 ) return state1 ; <nl> + if ( ( state1 = = CHECKED & & state2 = = CHECKED_STABLE ) | | <nl> + ( state2 = = CHECKED & & state1 = = CHECKED_STABLE ) ) { <nl> + return CHECKED ; <nl> + } <nl> + ASSERT ( ( state1 = = CHECKED_STABLE & & state2 = = UNCHECKED_STABLE ) | | <nl> + ( state2 = = CHECKED_STABLE & & state1 = = UNCHECKED_STABLE ) ) ; <nl> + return UNCHECKED_STABLE ; <nl> + } <nl> + <nl> HValue * object_ ; / / The object being approximated . NULL = > invalid entry . <nl> HInstruction * check_ ; / / The last check instruction . <nl> MapSet maps_ ; / / The set of known maps for the object . <nl> + State state_ ; / / The state of this entry . <nl> } ; <nl> <nl> <nl> class HCheckTable : public ZoneObject { <nl> } <nl> default : { <nl> / / If the instruction changes maps uncontrollably , drop everything . <nl> - if ( instr - > CheckChangesFlag ( kElementsKind ) | | <nl> - instr - > CheckChangesFlag ( kMaps ) | | <nl> - instr - > CheckChangesFlag ( kOsrEntries ) ) { <nl> + if ( instr - > CheckChangesFlag ( kOsrEntries ) ) { <nl> Kill ( ) ; <nl> + break ; <nl> + } <nl> + if ( instr - > CheckChangesFlag ( kElementsKind ) | | <nl> + instr - > CheckChangesFlag ( kMaps ) ) { <nl> + KillUnstableEntries ( ) ; <nl> } <nl> } <nl> / / Improvements possible : <nl> class HCheckTable : public ZoneObject { <nl> HCheckTableEntry * new_entry = & copy - > entries_ [ i ] ; <nl> new_entry - > object_ = old_entry - > object_ ; <nl> new_entry - > maps_ = old_entry - > maps_ ; <nl> + new_entry - > state_ = old_entry - > state_ ; <nl> / / Keep the check if the existing check ' s block dominates the successor . <nl> if ( old_entry - > check_ ! = NULL & & <nl> old_entry - > check_ - > block ( ) - > Dominates ( succ ) ) { <nl> class HCheckTable : public ZoneObject { <nl> HCheckTableEntry * pred_entry = copy - > Find ( phi_operand ) ; <nl> if ( pred_entry ! = NULL ) { <nl> / / Create an entry for a phi in the table . <nl> - copy - > Insert ( phi , NULL , pred_entry - > maps_ ) ; <nl> + copy - > Insert ( phi , NULL , pred_entry - > maps_ , pred_entry - > state_ ) ; <nl> } <nl> } <nl> } <nl> class HCheckTable : public ZoneObject { <nl> HValue * object = cmp - > value ( ) - > ActualValue ( ) ; <nl> HCheckTableEntry * entry = copy - > Find ( object ) ; <nl> if ( is_true_branch ) { <nl> + HCheckTableEntry : : State state = cmp - > map_is_stable ( ) <nl> + ? HCheckTableEntry : : CHECKED_STABLE <nl> + : HCheckTableEntry : : CHECKED ; <nl> / / Learn on the true branch of if ( CompareMap ( x ) ) . <nl> if ( entry = = NULL ) { <nl> - copy - > Insert ( object , cmp , cmp - > map ( ) ) ; <nl> + copy - > Insert ( object , cmp , cmp - > map ( ) , state ) ; <nl> } else { <nl> entry - > maps_ = new ( zone ) UniqueSet < Map > ( cmp - > map ( ) , zone ) ; <nl> entry - > check_ = cmp ; <nl> + entry - > state_ = state ; <nl> } <nl> } else { <nl> / / Learn on the false branch of if ( CompareMap ( x ) ) . <nl> if ( entry ! = NULL ) { <nl> + EnsureChecked ( entry , object , cmp ) ; <nl> UniqueSet < Map > * maps = entry - > maps_ - > Copy ( zone ) ; <nl> maps - > Remove ( cmp - > map ( ) ) ; <nl> entry - > maps_ = maps ; <nl> + ASSERT_NE ( HCheckTableEntry : : UNCHECKED_STABLE , entry - > state_ ) ; <nl> } <nl> } <nl> learned = true ; <nl> class HCheckTable : public ZoneObject { <nl> HCheckTableEntry * re = copy - > Find ( right ) ; <nl> if ( le = = NULL ) { <nl> if ( re ! = NULL ) { <nl> - copy - > Insert ( left , NULL , re - > maps_ ) ; <nl> + copy - > Insert ( left , NULL , re - > maps_ , re - > state_ ) ; <nl> } <nl> } else if ( re = = NULL ) { <nl> - copy - > Insert ( right , NULL , le - > maps_ ) ; <nl> + copy - > Insert ( right , NULL , le - > maps_ , le - > state_ ) ; <nl> } else { <nl> + EnsureChecked ( le , cmp - > left ( ) , cmp ) ; <nl> + EnsureChecked ( re , cmp - > right ( ) , cmp ) ; <nl> le - > maps_ = re - > maps_ = le - > maps_ - > Intersect ( re - > maps_ , zone ) ; <nl> + le - > state_ = re - > state_ = HCheckTableEntry : : StateMerge ( <nl> + le - > state_ , re - > state_ ) ; <nl> + ASSERT_NE ( HCheckTableEntry : : UNCHECKED_STABLE , le - > state_ ) ; <nl> + ASSERT_NE ( HCheckTableEntry : : UNCHECKED_STABLE , re - > state_ ) ; <nl> } <nl> learned = true ; <nl> } <nl> class HCheckTable : public ZoneObject { <nl> that_entry = that - > Find ( this_entry - > object_ ) ; <nl> } <nl> <nl> - if ( that_entry = = NULL ) { <nl> + if ( that_entry = = NULL | | <nl> + ( that_entry - > state_ = = HCheckTableEntry : : CHECKED & & <nl> + this_entry - > state_ = = HCheckTableEntry : : UNCHECKED_STABLE ) | | <nl> + ( this_entry - > state_ = = HCheckTableEntry : : CHECKED & & <nl> + that_entry - > state_ = = HCheckTableEntry : : UNCHECKED_STABLE ) ) { <nl> this_entry - > object_ = NULL ; <nl> compact = true ; <nl> } else { <nl> this_entry - > maps_ = <nl> this_entry - > maps_ - > Union ( that_entry - > maps_ , zone ) ; <nl> + this_entry - > state_ = HCheckTableEntry : : StateMerge ( <nl> + this_entry - > state_ , that_entry - > state_ ) ; <nl> if ( this_entry - > check_ ! = that_entry - > check_ ) { <nl> this_entry - > check_ = NULL ; <nl> } <nl> class HCheckTable : public ZoneObject { <nl> HCheckTableEntry * entry = Find ( object ) ; <nl> if ( entry ! = NULL ) { <nl> / / entry found ; <nl> - MapSet a = entry - > maps_ ; <nl> - const UniqueSet < Map > * i = instr - > maps ( ) ; <nl> - if ( a - > IsSubset ( i ) ) { <nl> + HGraph * graph = instr - > block ( ) - > graph ( ) ; <nl> + if ( entry - > maps_ - > IsSubset ( instr - > maps ( ) ) ) { <nl> / / The first check is more strict ; the second is redundant . <nl> if ( entry - > check_ ! = NULL ) { <nl> + ASSERT_NE ( HCheckTableEntry : : UNCHECKED_STABLE , entry - > state_ ) ; <nl> TRACE ( ( " Replacing redundant CheckMaps # % d at B % d with # % d \ n " , <nl> instr - > id ( ) , instr - > block ( ) - > block_id ( ) , entry - > check_ - > id ( ) ) ) ; <nl> instr - > DeleteAndReplaceWith ( entry - > check_ ) ; <nl> INC_STAT ( redundant_ ) ; <nl> - } else { <nl> + } else if ( entry - > state_ = = HCheckTableEntry : : UNCHECKED_STABLE ) { <nl> + ASSERT_EQ ( NULL , entry - > check_ ) ; <nl> + TRACE ( ( " Marking redundant CheckMaps # % d at B % d as stability check \ n " , <nl> + instr - > id ( ) , instr - > block ( ) - > block_id ( ) ) ) ; <nl> + instr - > set_maps ( entry - > maps_ - > Copy ( graph - > zone ( ) ) ) ; <nl> + instr - > MarkAsStabilityCheck ( ) ; <nl> + entry - > state_ = HCheckTableEntry : : CHECKED_STABLE ; <nl> + } else if ( ! instr - > IsStabilityCheck ( ) ) { <nl> TRACE ( ( " Marking redundant CheckMaps # % d at B % d as dead \ n " , <nl> instr - > id ( ) , instr - > block ( ) - > block_id ( ) ) ) ; <nl> / / Mark check as dead but leave it in the graph as a checkpoint for <nl> class HCheckTable : public ZoneObject { <nl> } <nl> return ; <nl> } <nl> - HGraph * graph = instr - > block ( ) - > graph ( ) ; <nl> - MapSet intersection = i - > Intersect ( a , graph - > zone ( ) ) ; <nl> + MapSet intersection = instr - > maps ( ) - > Intersect ( <nl> + entry - > maps_ , graph - > zone ( ) ) ; <nl> if ( intersection - > size ( ) = = 0 ) { <nl> - / / Intersection is empty ; probably megamorphic , which is likely to <nl> - / / deopt anyway , so just leave things as they are . <nl> + / / Intersection is empty ; probably megamorphic . <nl> INC_STAT ( empty_ ) ; <nl> + entry - > object_ = NULL ; <nl> + Compact ( ) ; <nl> } else { <nl> / / Update set of maps in the entry . <nl> entry - > maps_ = intersection ; <nl> - if ( intersection - > size ( ) ! = i - > size ( ) ) { <nl> + / / Update state of the entry . <nl> + if ( instr - > maps_are_stable ( ) | | <nl> + entry - > state_ = = HCheckTableEntry : : UNCHECKED_STABLE ) { <nl> + entry - > state_ = HCheckTableEntry : : CHECKED_STABLE ; <nl> + } <nl> + if ( intersection - > size ( ) ! = instr - > maps ( ) - > size ( ) ) { <nl> / / Narrow set of maps in the second check maps instruction . <nl> if ( entry - > check_ ! = NULL & & <nl> entry - > check_ - > block ( ) = = instr - > block ( ) & & <nl> class HCheckTable : public ZoneObject { <nl> / / There is a check in the same block so replace it with a more <nl> / / strict check and eliminate the second check entirely . <nl> HCheckMaps * check = HCheckMaps : : cast ( entry - > check_ ) ; <nl> + ASSERT ( ! check - > IsStabilityCheck ( ) ) ; <nl> TRACE ( ( " CheckMaps # % d at B % d narrowed \ n " , check - > id ( ) , <nl> check - > block ( ) - > block_id ( ) ) ) ; <nl> / / Update map set and ensure that the check is alive . <nl> class HCheckTable : public ZoneObject { <nl> TRACE ( ( " CheckMaps # % d at B % d narrowed \ n " , instr - > id ( ) , <nl> instr - > block ( ) - > block_id ( ) ) ) ; <nl> instr - > set_maps ( intersection ) ; <nl> - entry - > check_ = instr ; <nl> + entry - > check_ = instr - > IsStabilityCheck ( ) ? NULL : instr ; <nl> } <nl> <nl> if ( FLAG_trace_check_elimination ) { <nl> class HCheckTable : public ZoneObject { <nl> } <nl> } else { <nl> / / No entry ; insert a new one . <nl> - Insert ( object , instr , instr - > maps ( ) ) ; <nl> + HCheckTableEntry : : State state = instr - > maps_are_stable ( ) <nl> + ? HCheckTableEntry : : CHECKED_STABLE <nl> + : HCheckTableEntry : : CHECKED ; <nl> + HCheckMaps * check = instr - > IsStabilityCheck ( ) ? NULL : instr ; <nl> + Insert ( object , check , instr - > maps ( ) , state ) ; <nl> } <nl> } <nl> <nl> class HCheckTable : public ZoneObject { <nl> MapSet maps = instr - > maps ( ) ; <nl> if ( maps ! = NULL ) { <nl> ASSERT_NE ( 0 , maps - > size ( ) ) ; <nl> - Insert ( instr , NULL , maps ) ; <nl> + Insert ( instr , NULL , maps , HCheckTableEntry : : UNCHECKED_STABLE ) ; <nl> } <nl> return ; <nl> } <nl> <nl> HValue * object = instr - > object ( ) - > ActualValue ( ) ; <nl> - MapSet maps = FindMaps ( object ) ; <nl> - if ( maps = = NULL | | maps - > size ( ) ! = 1 ) return ; / / Not a constant . <nl> + HCheckTableEntry * entry = Find ( object ) ; <nl> + if ( entry = = NULL | | entry - > maps_ - > size ( ) ! = 1 ) return ; / / Not a constant . <nl> <nl> - Unique < Map > map = maps - > at ( 0 ) ; <nl> + EnsureChecked ( entry , object , instr ) ; <nl> + Unique < Map > map = entry - > maps_ - > at ( 0 ) ; <nl> + bool map_is_stable = ( entry - > state_ ! = HCheckTableEntry : : CHECKED ) ; <nl> HConstant * constant = HConstant : : CreateAndInsertBefore ( <nl> - instr - > block ( ) - > graph ( ) - > zone ( ) , map , true , instr ) ; <nl> + instr - > block ( ) - > graph ( ) - > zone ( ) , map , map_is_stable , instr ) ; <nl> instr - > DeleteAndReplaceWith ( constant ) ; <nl> INC_STAT ( loads_ ) ; <nl> } <nl> <nl> void ReduceCheckHeapObject ( HCheckHeapObject * instr ) { <nl> - if ( FindMaps ( instr - > value ( ) - > ActualValue ( ) ) ! = NULL ) { <nl> + HValue * value = instr - > value ( ) - > ActualValue ( ) ; <nl> + if ( Find ( value ) ! = NULL ) { <nl> / / If the object has known maps , it ' s definitely a heap object . <nl> - instr - > DeleteAndReplaceWith ( instr - > value ( ) ) ; <nl> + instr - > DeleteAndReplaceWith ( value ) ; <nl> INC_STAT ( removed_cho_ ) ; <nl> } <nl> } <nl> class HCheckTable : public ZoneObject { <nl> if ( instr - > has_transition ( ) ) { <nl> / / This store transitions the object to a new map . <nl> Kill ( object ) ; <nl> - Insert ( object , NULL , HConstant : : cast ( instr - > transition ( ) ) - > MapValue ( ) ) ; <nl> + HConstant * c_transition = HConstant : : cast ( instr - > transition ( ) ) ; <nl> + HCheckTableEntry : : State state = c_transition - > HasStableMapValue ( ) <nl> + ? HCheckTableEntry : : CHECKED_STABLE <nl> + : HCheckTableEntry : : CHECKED ; <nl> + Insert ( object , NULL , c_transition - > MapValue ( ) , state ) ; <nl> } else if ( instr - > access ( ) . IsMap ( ) ) { <nl> / / This is a store directly to the map field of the object . <nl> Kill ( object ) ; <nl> if ( ! instr - > value ( ) - > IsConstant ( ) ) return ; <nl> - Insert ( object , NULL , HConstant : : cast ( instr - > value ( ) ) - > MapValue ( ) ) ; <nl> + HConstant * c_value = HConstant : : cast ( instr - > value ( ) ) ; <nl> + HCheckTableEntry : : State state = c_value - > HasStableMapValue ( ) <nl> + ? HCheckTableEntry : : CHECKED_STABLE <nl> + : HCheckTableEntry : : CHECKED ; <nl> + Insert ( object , NULL , c_value - > MapValue ( ) , state ) ; <nl> } else { <nl> / / If the instruction changes maps , it should be handled above . <nl> CHECK ( ! instr - > CheckChangesFlag ( kMaps ) ) ; <nl> class HCheckTable : public ZoneObject { <nl> } <nl> <nl> void ReduceCompareMap ( HCompareMap * instr ) { <nl> - MapSet maps = FindMaps ( instr - > value ( ) - > ActualValue ( ) ) ; <nl> - if ( maps = = NULL ) return ; <nl> + HCheckTableEntry * entry = Find ( instr - > value ( ) - > ActualValue ( ) ) ; <nl> + if ( entry = = NULL ) return ; <nl> + <nl> + EnsureChecked ( entry , instr - > value ( ) , instr ) ; <nl> <nl> int succ ; <nl> - if ( maps - > Contains ( instr - > map ( ) ) ) { <nl> - if ( maps - > size ( ) ! = 1 ) { <nl> + if ( entry - > maps_ - > Contains ( instr - > map ( ) ) ) { <nl> + if ( entry - > maps_ - > size ( ) ! = 1 ) { <nl> TRACE ( ( " CompareMap # % d for # % d at B % d can ' t be eliminated : " <nl> " ambiguous set of maps \ n " , instr - > id ( ) , instr - > value ( ) - > id ( ) , <nl> instr - > block ( ) - > block_id ( ) ) ) ; <nl> class HCheckTable : public ZoneObject { <nl> } <nl> <nl> void ReduceCompareObjectEqAndBranch ( HCompareObjectEqAndBranch * instr ) { <nl> - MapSet maps_left = FindMaps ( instr - > left ( ) - > ActualValue ( ) ) ; <nl> - if ( maps_left = = NULL ) return ; <nl> - MapSet maps_right = FindMaps ( instr - > right ( ) - > ActualValue ( ) ) ; <nl> - if ( maps_right = = NULL ) return ; <nl> - MapSet intersection = maps_left - > Intersect ( maps_right , zone ( ) ) ; <nl> + HValue * left = instr - > left ( ) - > ActualValue ( ) ; <nl> + HCheckTableEntry * le = Find ( left ) ; <nl> + if ( le = = NULL ) return ; <nl> + HValue * right = instr - > right ( ) - > ActualValue ( ) ; <nl> + HCheckTableEntry * re = Find ( right ) ; <nl> + if ( re = = NULL ) return ; <nl> + <nl> + EnsureChecked ( le , left , instr ) ; <nl> + EnsureChecked ( re , right , instr ) ; <nl> + <nl> + / / TODO ( bmeurer ) : Add a predicate here instead of computing the intersection <nl> + MapSet intersection = le - > maps_ - > Intersect ( re - > maps_ , zone ( ) ) ; <nl> if ( intersection - > size ( ) > 0 ) return ; <nl> <nl> TRACE ( ( " Marking redundant CompareObjectEqAndBranch # % d at B % d as false \ n " , <nl> class HCheckTable : public ZoneObject { <nl> } <nl> <nl> void ReduceTransitionElementsKind ( HTransitionElementsKind * instr ) { <nl> - HCheckTableEntry * entry = Find ( instr - > object ( ) - > ActualValue ( ) ) ; <nl> + HValue * object = instr - > object ( ) - > ActualValue ( ) ; <nl> + HCheckTableEntry * entry = Find ( object ) ; <nl> / / Can only learn more about an object that already has a known set of maps . <nl> if ( entry = = NULL ) return ; <nl> + EnsureChecked ( entry , object , instr ) ; <nl> if ( entry - > maps_ - > Contains ( instr - > original_map ( ) ) ) { <nl> / / If the object has the original map , it will be transitioned . <nl> UniqueSet < Map > * maps = entry - > maps_ - > Copy ( zone ( ) ) ; <nl> class HCheckTable : public ZoneObject { <nl> entry - > maps_ = maps ; <nl> } else { <nl> / / Object does not have the given map , thus the transition is redundant . <nl> - instr - > DeleteAndReplaceWith ( instr - > object ( ) ) ; <nl> + instr - > DeleteAndReplaceWith ( object ) ; <nl> INC_STAT ( transitions_ ) ; <nl> } <nl> } <nl> <nl> + void EnsureChecked ( HCheckTableEntry * entry , <nl> + HValue * value , <nl> + HInstruction * instr ) { <nl> + if ( entry - > state_ ! = HCheckTableEntry : : UNCHECKED_STABLE ) return ; <nl> + HGraph * graph = instr - > block ( ) - > graph ( ) ; <nl> + HCheckMaps * check = HCheckMaps : : CreateAndInsertBefore ( <nl> + graph - > zone ( ) , value , entry - > maps_ - > Copy ( graph - > zone ( ) ) , true , instr ) ; <nl> + check - > MarkAsStabilityCheck ( ) ; <nl> + entry - > state_ = HCheckTableEntry : : CHECKED_STABLE ; <nl> + entry - > check_ = NULL ; <nl> + } <nl> + <nl> / / Kill everything in the table . <nl> void Kill ( ) { <nl> size_ = 0 ; <nl> cursor_ = 0 ; <nl> } <nl> <nl> + / / Kill all unstable entries in the table . <nl> + void KillUnstableEntries ( ) { <nl> + bool compact = false ; <nl> + for ( int i = 0 ; i < size_ ; + + i ) { <nl> + HCheckTableEntry * entry = & entries_ [ i ] ; <nl> + ASSERT_NOT_NULL ( entry - > object_ ) ; <nl> + if ( entry - > state_ = = HCheckTableEntry : : CHECKED ) { <nl> + entry - > object_ = NULL ; <nl> + compact = true ; <nl> + } else { <nl> + / / All checked stable entries become unchecked stable . <nl> + entry - > state_ = HCheckTableEntry : : UNCHECKED_STABLE ; <nl> + entry - > check_ = NULL ; <nl> + } <nl> + } <nl> + if ( compact ) Compact ( ) ; <nl> + } <nl> + <nl> / / Kill everything in the table that may alias { object } . <nl> void Kill ( HValue * object ) { <nl> bool compact = false ; <nl> class HCheckTable : public ZoneObject { <nl> PrintF ( " check # % d " , entry - > check_ - > id ( ) ) ; <nl> } <nl> MapSet list = entry - > maps_ ; <nl> - PrintF ( " % d maps { " , list - > size ( ) ) ; <nl> + PrintF ( " % d % s maps { " , list - > size ( ) , <nl> + HCheckTableEntry : : State2String ( entry - > state_ ) ) ; <nl> for ( int j = 0 ; j < list - > size ( ) ; j + + ) { <nl> if ( j > 0 ) PrintF ( " , " ) ; <nl> PrintF ( " % " V8PRIxPTR , list - > at ( j ) . Hashcode ( ) ) ; <nl> class HCheckTable : public ZoneObject { <nl> return NULL ; <nl> } <nl> <nl> - MapSet FindMaps ( HValue * object ) { <nl> - HCheckTableEntry * entry = Find ( object ) ; <nl> - return entry = = NULL ? NULL : entry - > maps_ ; <nl> + void Insert ( HValue * object , <nl> + HInstruction * check , <nl> + Unique < Map > map , <nl> + HCheckTableEntry : : State state ) { <nl> + Insert ( object , check , new ( zone ( ) ) UniqueSet < Map > ( map , zone ( ) ) , state ) ; <nl> } <nl> <nl> - void Insert ( HValue * object , HInstruction * check , Unique < Map > map ) { <nl> - Insert ( object , check , new ( zone ( ) ) UniqueSet < Map > ( map , zone ( ) ) ) ; <nl> - } <nl> - <nl> - void Insert ( HValue * object , HInstruction * check , MapSet maps ) { <nl> + void Insert ( HValue * object , <nl> + HInstruction * check , <nl> + MapSet maps , <nl> + HCheckTableEntry : : State state ) { <nl> + ASSERT ( state ! = HCheckTableEntry : : UNCHECKED_STABLE | | check = = NULL ) ; <nl> HCheckTableEntry * entry = & entries_ [ cursor_ + + ] ; <nl> entry - > object_ = object ; <nl> entry - > check_ = check ; <nl> entry - > maps_ = maps ; <nl> + entry - > state_ = state ; <nl> / / If the table becomes full , wrap around and overwrite older entries . <nl> if ( cursor_ = = kMaxTrackedObjects ) cursor_ = 0 ; <nl> if ( size_ < kMaxTrackedObjects ) size_ + + ; <nl> class HCheckTable : public ZoneObject { <nl> HCheckTableEntry entries_ [ kMaxTrackedObjects ] ; <nl> int16_t cursor_ ; / / Must be < = kMaxTrackedObjects <nl> int16_t size_ ; / / Must be < = kMaxTrackedObjects <nl> - / / TODO ( titzer ) : STATIC_ASSERT kMaxTrackedObjects < max ( cursor_ ) <nl> + STATIC_ASSERT ( kMaxTrackedObjects < ( 1 < < 15 ) ) ; <nl> } ; <nl> <nl> <nl> class HCheckTable : public ZoneObject { <nl> / / needed for check elimination . <nl> class HCheckMapsEffects : public ZoneObject { <nl> public : <nl> - explicit HCheckMapsEffects ( Zone * zone ) <nl> - : objects_ ( 0 , zone ) , maps_stored_ ( false ) { } <nl> + explicit HCheckMapsEffects ( Zone * zone ) : objects_ ( 0 , zone ) { } <nl> <nl> / / Effects are _not_ disabled . <nl> inline bool Disabled ( ) const { return false ; } <nl> class HCheckMapsEffects : public ZoneObject { <nl> break ; <nl> } <nl> default : { <nl> - maps_stored_ | = ( instr - > CheckChangesFlag ( kMaps ) | <nl> - instr - > CheckChangesFlag ( kOsrEntries ) | <nl> - instr - > CheckChangesFlag ( kElementsKind ) ) ; <nl> + flags_ . Add ( instr - > ChangesFlags ( ) ) ; <nl> + break ; <nl> } <nl> } <nl> } <nl> <nl> / / Apply these effects to the given check elimination table . <nl> void Apply ( HCheckTable * table ) { <nl> - if ( maps_stored_ ) { <nl> + if ( flags_ . Contains ( kOsrEntries ) ) { <nl> / / Uncontrollable map modifications ; kill everything . <nl> table - > Kill ( ) ; <nl> return ; <nl> } <nl> <nl> + / / Kill all unstable entries . <nl> + if ( flags_ . Contains ( kElementsKind ) | | flags_ . Contains ( kMaps ) ) { <nl> + table - > KillUnstableEntries ( ) ; <nl> + } <nl> + <nl> / / Kill maps for each object contained in these effects . <nl> for ( int i = 0 ; i < objects_ . length ( ) ; + + i ) { <nl> table - > Kill ( objects_ [ i ] - > ActualValue ( ) ) ; <nl> class HCheckMapsEffects : public ZoneObject { <nl> <nl> / / Union these effects with the other effects . <nl> void Union ( HCheckMapsEffects * that , Zone * zone ) { <nl> - maps_stored_ | = that - > maps_stored_ ; <nl> + flags_ . Add ( that - > flags_ ) ; <nl> for ( int i = 0 ; i < that - > objects_ . length ( ) ; + + i ) { <nl> objects_ . Add ( that - > objects_ [ i ] , zone ) ; <nl> } <nl> class HCheckMapsEffects : public ZoneObject { <nl> <nl> private : <nl> ZoneList < HValue * > objects_ ; <nl> - bool maps_stored_ : 1 ; <nl> + GVNFlagSet flags_ ; <nl> } ; <nl> <nl> <nl> mmm a / src / hydrogen - instructions . cc <nl> ppp b / src / hydrogen - instructions . cc <nl> void HAllocate : : CreateFreeSpaceFiller ( int32_t free_space_size ) { <nl> free_space_instr - > InsertBefore ( this ) ; <nl> HConstant * filler_map = HConstant : : CreateAndInsertAfter ( <nl> zone , Unique < Map > : : CreateImmovable ( <nl> - isolate ( ) - > factory ( ) - > free_space_map ( ) ) , free_space_instr ) ; <nl> + isolate ( ) - > factory ( ) - > free_space_map ( ) ) , true , free_space_instr ) ; <nl> HInstruction * store_map = HStoreNamedField : : New ( zone , context ( ) , <nl> free_space_instr , HObjectAccess : : ForMap ( ) , filler_map ) ; <nl> store_map - > SetFlag ( HValue : : kHasNoObservableSideEffects ) ; <nl> mmm a / src / hydrogen - instructions . h <nl> ppp b / src / hydrogen - instructions . h <nl> class HCompareMap V8_FINAL : public HUnaryControlInstruction { <nl> } <nl> <nl> Unique < Map > map ( ) const { return map_ ; } <nl> + bool map_is_stable ( ) const { return map_is_stable_ ; } <nl> <nl> virtual Representation RequiredInputRepresentation ( int index ) V8_OVERRIDE { <nl> return Representation : : Tagged ( ) ; <nl> class HCompareMap V8_FINAL : public HUnaryControlInstruction { <nl> HBasicBlock * true_target = NULL , <nl> HBasicBlock * false_target = NULL ) <nl> : HUnaryControlInstruction ( value , true_target , false_target ) , <nl> - known_successor_index_ ( kNoKnownSuccessorIndex ) , map_ ( Unique < Map > ( map ) ) { <nl> - ASSERT ( ! map . is_null ( ) ) ; <nl> + known_successor_index_ ( kNoKnownSuccessorIndex ) , <nl> + map_is_stable_ ( map - > is_stable ( ) ) , <nl> + map_ ( Unique < Map > : : CreateImmovable ( map ) ) { <nl> set_representation ( Representation : : Tagged ( ) ) ; <nl> } <nl> <nl> - int known_successor_index_ ; <nl> + int known_successor_index_ : 31 ; <nl> + bool map_is_stable_ : 1 ; <nl> Unique < Map > map_ ; <nl> } ; <nl> <nl> class HCheckMaps V8_FINAL : public HTemplateInstruction < 2 > { <nl> <nl> bool IsStabilityCheck ( ) const { return is_stability_check_ ; } <nl> void MarkAsStabilityCheck ( ) { <nl> + maps_are_stable_ = true ; <nl> has_migration_target_ = false ; <nl> is_stability_check_ = true ; <nl> ClearChangesFlag ( kNewSpacePromotion ) ; <nl> class HCheckMaps V8_FINAL : public HTemplateInstruction < 2 > { <nl> Unique < Map > map , <nl> bool map_is_stable , <nl> HInstruction * instr ) { <nl> - return CreateAndInsertAfter ( zone , value , new ( zone ) UniqueSet < Map > ( <nl> - map , zone ) , map_is_stable , instr ) ; <nl> + return instr - > Append ( new ( zone ) HCheckMaps ( <nl> + value , new ( zone ) UniqueSet < Map > ( map , zone ) , map_is_stable ) ) ; <nl> } <nl> <nl> - static HCheckMaps * CreateAndInsertAfter ( Zone * zone , <nl> - HValue * value , <nl> - const UniqueSet < Map > * maps , <nl> - bool maps_are_stable , <nl> - HInstruction * instr ) { <nl> - return instr - > Append ( new ( zone ) HCheckMaps ( value , maps , maps_are_stable ) ) ; <nl> + static HCheckMaps * CreateAndInsertBefore ( Zone * zone , <nl> + HValue * value , <nl> + const UniqueSet < Map > * maps , <nl> + bool maps_are_stable , <nl> + HInstruction * instr ) { <nl> + return instr - > Prepend ( new ( zone ) HCheckMaps ( value , maps , maps_are_stable ) ) ; <nl> } <nl> <nl> DECLARE_CONCRETE_INSTRUCTION ( CheckMaps ) <nl> class HConstant V8_FINAL : public HTemplateInstruction < 0 > { <nl> } <nl> <nl> static HConstant * CreateAndInsertBefore ( Zone * zone , <nl> - Unique < Object > object , <nl> - bool is_not_in_new_space , <nl> + Unique < Map > map , <nl> + bool map_is_stable , <nl> HInstruction * instruction ) { <nl> return instruction - > Prepend ( new ( zone ) HConstant ( <nl> - object , Unique < Map > ( Handle < Map > : : null ( ) ) , false , <nl> - Representation : : Tagged ( ) , HType : : Tagged ( ) , is_not_in_new_space , <nl> - false , false , kUnknownInstanceType ) ) ; <nl> + map , Unique < Map > ( Handle < Map > : : null ( ) ) , map_is_stable , <nl> + Representation : : Tagged ( ) , HType : : Tagged ( ) , true , <nl> + false , false , MAP_TYPE ) ) ; <nl> } <nl> <nl> static HConstant * CreateAndInsertAfter ( Zone * zone , <nl> Unique < Map > map , <nl> + bool map_is_stable , <nl> HInstruction * instruction ) { <nl> return instruction - > Append ( new ( zone ) HConstant ( <nl> - map , Unique < Map > ( Handle < Map > : : null ( ) ) , false , <nl> + map , Unique < Map > ( Handle < Map > : : null ( ) ) , map_is_stable , <nl> Representation : : Tagged ( ) , HType : : Tagged ( ) , true , <nl> false , false , MAP_TYPE ) ) ; <nl> } <nl> mmm a / src / hydrogen . cc <nl> ppp b / src / hydrogen . cc <nl> HInstruction * HOptimizedGraphBuilder : : BuildLoadNamedField ( <nl> <nl> UniqueSet < Map > * maps = new ( zone ( ) ) UniqueSet < Map > ( map_list - > length ( ) , zone ( ) ) ; <nl> for ( int i = 0 ; i < map_list - > length ( ) ; + + i ) { <nl> - Handle < Map > map = map_list - > at ( i ) ; <nl> - maps - > Add ( Unique < Map > : : CreateImmovable ( map ) , zone ( ) ) ; <nl> - / / TODO ( bmeurer ) : Get rid of this shit ! <nl> - if ( map - > CanTransition ( ) ) { <nl> - Map : : AddDependentCompilationInfo ( <nl> - map , DependentCode : : kPrototypeCheckGroup , top_info ( ) ) ; <nl> - } <nl> + maps - > Add ( Unique < Map > : : CreateImmovable ( map_list - > at ( i ) ) , zone ( ) ) ; <nl> } <nl> return New < HLoadNamedField > ( <nl> checked_object , checked_object , access , maps , info - > field_type ( ) ) ; <nl>
|
Use stability to only conditionally flush information from the map check table .
|
v8/v8
|
6e74578968c18793d107309c4d2bd5ec31dbd427
|
2014-05-12T20:05:52Z
|
mmm a / drivers / python / rethinkdb / _import . py <nl> ppp b / drivers / python / rethinkdb / _import . py <nl> <nl> import signal <nl> <nl> import sys , os , datetime , time , json , traceback , csv <nl> - import multiprocessing , multiprocessing . queues , subprocess , re , ctypes <nl> + import multiprocessing , multiprocessing . queues , subprocess , re , ctypes , codecs <nl> from optparse import OptionParser <nl> from . _backup import * <nl> import rethinkdb as r <nl> <nl> + # Used because of API differences in the csv module , taken from <nl> + # http : / / python3porting . com / problems . html <nl> + PY3 = sys . version > ' 3 ' <nl> + <nl> try : <nl> import cPickle as pickle <nl> except ImportError : <nl> def json_reader ( task_queue , filename , db , table , fields , progress_info , exit_eve <nl> if len ( object_buffers ) > 0 : <nl> task_queue . put ( ( db , table , object_buffers ) ) <nl> <nl> + # Wrapper classes for the handling of unicode csv files <nl> + # Taken from https : / / docs . python . org / 2 / library / csv . html <nl> + class Utf8Recoder : <nl> + def __init__ ( self , f ) : <nl> + self . reader = codecs . getreader ( ' utf - 8 ' ) ( f ) <nl> + <nl> + def __iter__ ( self ) : <nl> + return self <nl> + <nl> + def next ( self ) : <nl> + return self . reader . next ( ) . encode ( " utf - 8 " ) <nl> + <nl> + class Utf8CsvReader : <nl> + def __init__ ( self , f , * * kwargs ) : <nl> + f = Utf8Recoder ( f ) <nl> + self . reader = csv . reader ( f , * * kwargs ) <nl> + self . line_num = self . reader . line_num <nl> + <nl> + def next ( self ) : <nl> + row = self . reader . next ( ) <nl> + self . line_num = self . reader . line_num <nl> + return [ unicode ( s , ' utf - 8 ' ) for s in row ] <nl> + <nl> + def __iter__ ( self ) : <nl> + return self <nl> + <nl> + def open_csv_file ( filename ) : <nl> + if PY3 : <nl> + return open ( filename , ' r ' , encoding = ' utf - 8 ' , newline = ' ' ) <nl> + else : <nl> + return open ( filename , ' r ' ) <nl> + <nl> def csv_reader ( task_queue , filename , db , table , options , progress_info , exit_event ) : <nl> object_buffers = [ ] <nl> buffer_sizes = [ ] <nl> def csv_reader ( task_queue , filename , db , table , options , progress_info , exit_eve <nl> # Count the lines so we can report progress <nl> # TODO : this requires us to make two passes on csv files <nl> line_count = 0 <nl> - with open ( filename , " r " ) as file_in : <nl> + with open_csv_file ( filename ) as file_in : <nl> for i , l in enumerate ( file_in ) : <nl> pass <nl> line_count = i + 1 <nl> <nl> progress_info [ 1 ] . value = line_count <nl> <nl> - with open ( filename , " r " ) as file_in : <nl> - reader = csv . reader ( file_in , delimiter = options [ " delimiter " ] ) <nl> + with open_csv_file ( filename ) as file_in : <nl> + if PY3 : <nl> + reader = csv . reader ( file_in , delimiter = options [ " delimiter " ] ) <nl> + else : <nl> + reader = Utf8CsvReader ( file_in , delimiter = options [ " delimiter " ] ) <nl> <nl> if not options [ " no_header " ] : <nl> fields_in = next ( reader ) <nl> mmm a / drivers / python / rethinkdb / ast . py <nl> ppp b / drivers / python / rethinkdb / ast . py <nl> def expr ( val , nesting_depth = 20 ) : <nl> return MakeObj ( obj ) <nl> elif isinstance ( val , collections . Callable ) : <nl> return Func ( val ) <nl> - elif isinstance ( val , datetime . datetime ) or isinstance ( val , datetime . date ) : <nl> + elif isinstance ( val , ( datetime . datetime , datetime . date ) ) : <nl> if not hasattr ( val , ' tzinfo ' ) or not val . tzinfo : <nl> raise RqlDriverError ( " " " Cannot convert % s to ReQL time object <nl> without timezone information . You can add timezone information with <nl> def __init__ ( self , * args , * * optargs ) : <nl> <nl> self . optargs = { } <nl> for k , v in dict_items ( optargs ) : <nl> - if not isinstance ( v , RqlQuery ) and v = = ( ) : <nl> - continue <nl> self . optargs [ k ] = expr ( v ) <nl> <nl> # Send this query to the server to be executed <nl> def default ( self , * args ) : <nl> return Default ( self , * args ) <nl> <nl> def update ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' non_atomic ' , ( ) ) <nl> - kwargs . setdefault ( ' durability ' , ( ) ) <nl> - kwargs . setdefault ( ' return_changes ' , ( ) ) <nl> return Update ( self , * [ func_wrap ( arg ) for arg in args ] , * * kwargs ) <nl> <nl> def replace ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' non_atomic ' , ( ) ) <nl> - kwargs . setdefault ( ' durability ' , ( ) ) <nl> - kwargs . setdefault ( ' return_changes ' , ( ) ) <nl> return Replace ( self , * [ func_wrap ( arg ) for arg in args ] , * * kwargs ) <nl> <nl> def delete ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' durability ' , ( ) ) <nl> - kwargs . setdefault ( ' return_changes ' , ( ) ) <nl> return Delete ( self , * args , * * kwargs ) <nl> <nl> # Rql type inspection <nl> def map ( self , * args ) : <nl> return Map ( self , * [ func_wrap ( arg ) for arg in args ] ) <nl> <nl> def filter ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' default ' , ( ) ) <nl> return Filter ( self , * [ func_wrap ( arg ) for arg in args ] , * * kwargs ) <nl> <nl> def concat_map ( self , * args ) : <nl> return ConcatMap ( self , * [ func_wrap ( arg ) for arg in args ] ) <nl> <nl> def order_by ( self , * args , * * kwargs ) : <nl> - args = [ arg if isinstance ( arg , Asc ) or isinstance ( arg , Desc ) else func_wrap ( arg ) for arg in args ] <nl> + args = [ arg if isinstance ( arg , ( Asc , Desc ) ) else func_wrap ( arg ) for arg in args ] <nl> return OrderBy ( self , * args , * * kwargs ) <nl> <nl> def between ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' left_bound ' , ( ) ) <nl> - kwargs . setdefault ( ' right_bound ' , ( ) ) <nl> - kwargs . setdefault ( ' index ' , ( ) ) <nl> return Between ( self , * args , * * kwargs ) <nl> <nl> def distinct ( self , * args , * * kwargs ) : <nl> def outer_join ( self , * args ) : <nl> return OuterJoin ( self , * args ) <nl> <nl> def eq_join ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' index ' , ( ) ) <nl> return EqJoin ( self , * [ func_wrap ( arg ) for arg in args ] , * * kwargs ) <nl> <nl> def zip ( self , * args ) : <nl> def to_epoch_time ( self , * args ) : <nl> return ToEpochTime ( self , * args ) <nl> <nl> def during ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' left_bound ' , ( ) ) <nl> - kwargs . setdefault ( ' right_bound ' , ( ) ) <nl> return During ( self , * args , * * kwargs ) <nl> <nl> def date ( self , * args ) : <nl> def to_geojson ( self , * args ) : <nl> return ToGeoJson ( self , * args ) <nl> <nl> def distance ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' geo_system ' , ( ) ) <nl> - kwargs . setdefault ( ' unit ' , ( ) ) <nl> return Distance ( self , * args , * * kwargs ) <nl> <nl> def intersects ( self , * args ) : <nl> def fill ( self , * args ) : <nl> # These classes define how nodes are printed by overloading ` compose ` <nl> <nl> def needs_wrap ( arg ) : <nl> - return isinstance ( arg , Datum ) or isinstance ( arg , MakeArray ) or isinstance ( arg , MakeObj ) <nl> + return isinstance ( arg , ( Datum , MakeArray , MakeObj ) ) <nl> <nl> class RqlBoolOperQuery ( RqlQuery ) : <nl> def __init__ ( self , * args , * * optargs ) : <nl> def table_status ( self , * args ) : <nl> return TableStatus ( self , * args ) <nl> <nl> def table_create ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' primary_key ' , ( ) ) <nl> - kwargs . setdefault ( ' datacenter ' , ( ) ) <nl> - kwargs . setdefault ( ' durability ' , ( ) ) <nl> return TableCreate ( self , * args , * * kwargs ) <nl> <nl> def table_drop ( self , * args ) : <nl> return TableDrop ( self , * args ) <nl> <nl> def table ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' use_outdated ' , ( ) ) <nl> return Table ( self , * args , * * kwargs ) <nl> <nl> class FunCall ( RqlQuery ) : <nl> class Table ( RqlQuery ) : <nl> st = ' table ' <nl> <nl> def insert ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' conflict ' , ( ) ) <nl> - kwargs . setdefault ( ' durability ' , ( ) ) <nl> - kwargs . setdefault ( ' return_changes ' , ( ) ) <nl> return Insert ( self , * [ expr ( arg ) for arg in args ] , * * kwargs ) <nl> <nl> def get ( self , * args ) : <nl> def get_all ( self , * args , * * kwargs ) : <nl> return GetAll ( self , * args , * * kwargs ) <nl> <nl> def index_create ( self , * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' multi ' , ( ) ) <nl> - kwargs . setdefault ( ' geo ' , ( ) ) <nl> if len ( args ) > 1 : <nl> args = [ args [ 0 ] ] + [ func_wrap ( arg ) for arg in args [ 1 : ] ] <nl> return IndexCreate ( self , * args , * * kwargs ) <nl> mmm a / drivers / python / rethinkdb / query . py <nl> ppp b / drivers / python / rethinkdb / query . py <nl> def json ( * args ) : <nl> return Json ( * args ) <nl> <nl> def js ( * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' timeout ' , ( ) ) <nl> return JavaScript ( * args , * * kwargs ) <nl> <nl> def args ( * args ) : <nl> def do ( * args ) : <nl> row = ImplicitVar ( ) <nl> <nl> def table ( * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' use_outdated ' , ( ) ) <nl> return Table ( * args , * * kwargs ) <nl> <nl> def db ( * args ) : <nl> def db_list ( * args ) : <nl> return DbList ( * args ) <nl> <nl> def table_create ( * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' primary_key ' , ( ) ) <nl> - kwargs . setdefault ( ' datacenter ' , ( ) ) <nl> - kwargs . setdefault ( ' durability ' , ( ) ) <nl> return TableCreateTL ( * args , * * kwargs ) <nl> <nl> def table_drop ( * args ) : <nl> def time ( * args ) : <nl> return Time ( * args ) <nl> <nl> def iso8601 ( * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' default_timezone ' , ( ) ) <nl> return ISO8601 ( * args , * * kwargs ) <nl> <nl> def epoch_time ( * args ) : <nl> def polygon ( * args ) : <nl> return Polygon ( * args ) <nl> <nl> def distance ( * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' geo_system ' , ( ) ) <nl> - kwargs . setdefault ( ' unit ' , ( ) ) <nl> return Distance ( * args , * * kwargs ) <nl> <nl> def intersects ( * args ) : <nl> return Intersects ( * args ) <nl> <nl> def circle ( * args , * * kwargs ) : <nl> - kwargs . setdefault ( ' geo_system ' , ( ) ) <nl> - kwargs . setdefault ( ' unit ' , ( ) ) <nl> - kwargs . setdefault ( ' fill ' , ( ) ) <nl> return Circle ( * args , * * kwargs ) <nl> mmm a / mk / install . mk <nl> ppp b / mk / install . mk <nl> install - data : <nl> install - web : web - assets <nl> $ P INSTALL $ ( DESTDIR ) $ ( web_res_dir ) <nl> install - m755 - d $ ( DESTDIR ) $ ( web_res_dir ) <nl> - # This might break some ownership or permissions stuff . <nl> - cp - pRP $ ( WEB_ASSETS_BUILD_DIR ) / * $ ( DESTDIR ) $ ( web_res_dir ) / <nl> + cd $ ( WEB_ASSETS_BUILD_DIR ) ; find . - type d - exec install - m755 - d $ ( abspath $ ( DESTDIR ) ) $ ( web_res_dir ) / { } \ ; <nl> + cd $ ( WEB_ASSETS_BUILD_DIR ) ; find . - type f - exec install - m644 { } $ ( abspath $ ( DESTDIR ) ) $ ( web_res_dir ) / { } \ ; <nl> <nl> . PHONY : install - docs <nl> install - docs : <nl> mmm a / mk / packaging . mk <nl> ppp b / mk / packaging . mk <nl> endif <nl> cp - pPR $ ( path ) / . $ ( dir ) $ ( newline ) ) ) <nl> <nl> $ ( DIST_PACKAGE_TGZ ) : dist - dir <nl> + $ P CHMOD $ ( DIST_DIR ) <nl> + find $ ( DIST_DIR ) - type f - exec chmod 644 { } \ ; <nl> + find $ ( DIST_DIR ) - type d - exec chmod 755 { } \ ; <nl> $ P TAR $ @ $ ( DIST_DIR ) <nl> cd $ ( dir $ ( DIST_DIR ) ) & & tar zfc $ ( notdir $ @ ) $ ( notdir $ ( DIST_DIR ) ) <nl> <nl> mmm a / src / btree / concurrent_traversal . cc <nl> ppp b / src / btree / concurrent_traversal . cc <nl> class concurrent_traversal_adapter_t : public depth_first_traversal_callback_t { <nl> return failure_cond_ - > is_pulsed ( ) ? done_traversing_t : : YES : done_traversing_t : : NO ; <nl> } <nl> <nl> + virtual bool is_range_interesting ( const btree_key_t * left_excl_or_null , <nl> + const btree_key_t * right_incl_or_null ) { <nl> + return cb_ - > is_range_interesting ( left_excl_or_null , right_incl_or_null ) ; <nl> + } <nl> + <nl> virtual profile : : trace_t * get_trace ( ) THROWS_NOTHING { <nl> return cb_ - > get_trace ( ) ; <nl> } <nl> void concurrent_traversal_fifo_enforcer_signal_t : : wait_interruptible ( ) <nl> <nl> bool btree_concurrent_traversal ( superblock_t * superblock , const key_range_t & range , <nl> concurrent_traversal_callback_t * cb , <nl> - direction_t direction ) { <nl> + direction_t direction , <nl> + release_superblock_t release_superblock ) { <nl> cond_t failure_cond ; <nl> bool failure_seen ; <nl> { <nl> concurrent_traversal_adapter_t adapter ( cb , & failure_cond ) ; <nl> failure_seen = ! btree_depth_first_traversal ( superblock , <nl> - range , & adapter , direction ) ; <nl> + range , & adapter , direction , <nl> + release_superblock ) ; <nl> } <nl> / / Now that adapter is destroyed , the operations that might have failed have all <nl> / / drained . ( If we fail , we try to report it to btree_depth_first_traversal ( to <nl> mmm a / src / btree / concurrent_traversal . hpp <nl> ppp b / src / btree / concurrent_traversal . hpp <nl> class concurrent_traversal_callback_t { <nl> concurrent_traversal_fifo_enforcer_signal_t waiter ) <nl> THROWS_ONLY ( interrupted_exc_t ) = 0 ; <nl> <nl> + / / Can be overloaded if you don ' t want to query a contiguous range of keys , <nl> + / / but only parts of it . Will be called before traversing into any child node . <nl> + / / Note : returning false here does not guarantee that a given range is never <nl> + / / encountered by handle_pair ( ) . is_range_interesting ( ) is just a pre - filter . <nl> + virtual bool is_range_interesting ( UNUSED const btree_key_t * left_excl_or_null , <nl> + UNUSED const btree_key_t * right_incl_or_null ) { <nl> + return true ; <nl> + } ; <nl> + <nl> virtual profile : : trace_t * get_trace ( ) THROWS_NOTHING { return NULL ; } <nl> <nl> protected : <nl> class concurrent_traversal_callback_t { <nl> <nl> bool btree_concurrent_traversal ( superblock_t * superblock , const key_range_t & range , <nl> concurrent_traversal_callback_t * cb , <nl> - direction_t direction ) ; <nl> + direction_t direction , <nl> + release_superblock_t release_superblock <nl> + = release_superblock_t : : RELEASE ) ; <nl> <nl> <nl> <nl> mmm a / src / btree / depth_first_traversal . cc <nl> ppp b / src / btree / depth_first_traversal . cc <nl> void scoped_key_value_t : : reset ( ) { <nl> bool btree_depth_first_traversal ( counted_t < counted_buf_lock_t > block , <nl> const key_range_t & range , <nl> depth_first_traversal_callback_t * cb , <nl> - direction_t direction ) ; <nl> + direction_t direction , <nl> + const btree_key_t * left_excl_or_null , <nl> + const btree_key_t * right_incl_or_null ) ; <nl> <nl> bool btree_depth_first_traversal ( superblock_t * superblock , <nl> const key_range_t & range , <nl> bool btree_depth_first_traversal ( superblock_t * superblock , <nl> root_block - > read_acq_signal ( ) - > wait ( ) ; <nl> } <nl> return btree_depth_first_traversal ( std : : move ( root_block ) , range , cb , <nl> - direction ) ; <nl> + direction , NULL , NULL ) ; <nl> + } <nl> + } <nl> + <nl> + void get_child_key_range ( const internal_node_t * inode , <nl> + int child_index , <nl> + const btree_key_t * parent_left_excl_or_null , <nl> + const btree_key_t * parent_right_incl_or_null , <nl> + const btree_key_t * * left_excl_or_null_out , <nl> + const btree_key_t * * right_incl_or_null_out ) { <nl> + const btree_internal_pair * pair = internal_node : : get_pair_by_index ( inode , child_index ) ; <nl> + if ( child_index ! = inode - > npairs - 1 ) { <nl> + rassert ( child_index < inode - > npairs - 1 ) ; <nl> + * right_incl_or_null_out = & pair - > key ; <nl> + } else { <nl> + * right_incl_or_null_out = parent_right_incl_or_null ; <nl> + } <nl> + <nl> + if ( child_index > 0 ) { <nl> + const btree_internal_pair * left_neighbor = <nl> + internal_node : : get_pair_by_index ( inode , child_index - 1 ) ; <nl> + * left_excl_or_null_out = & left_neighbor - > key ; <nl> + } else { <nl> + * left_excl_or_null_out = parent_left_excl_or_null ; <nl> } <nl> } <nl> <nl> bool btree_depth_first_traversal ( counted_t < counted_buf_lock_t > block , <nl> const key_range_t & range , <nl> depth_first_traversal_callback_t * cb , <nl> - direction_t direction ) { <nl> + direction_t direction , <nl> + const btree_key_t * left_excl_or_null , <nl> + const btree_key_t * right_incl_or_null ) { <nl> auto read = make_counted < counted_buf_read_t > ( block . get ( ) ) ; <nl> const node_t * node = static_cast < const node_t * > ( read - > get_data_read ( ) ) ; <nl> if ( node : : is_internal ( node ) ) { <nl> bool btree_depth_first_traversal ( counted_t < counted_buf_lock_t > block , <nl> for ( int i = 0 ; i < end_index - start_index ; + + i ) { <nl> int true_index = ( direction = = FORWARD ? start_index + i : ( end_index - 1 ) - i ) ; <nl> const btree_internal_pair * pair = internal_node : : get_pair_by_index ( inode , true_index ) ; <nl> - counted_t < counted_buf_lock_t > lock ; <nl> - { <nl> - profile : : starter_t starter ( " Acquire block for read . " , cb - > get_trace ( ) ) ; <nl> - lock = make_counted < counted_buf_lock_t > ( block . get ( ) , pair - > lnode , <nl> - access_t : : read ) ; <nl> - } <nl> - if ( ! btree_depth_first_traversal ( std : : move ( lock ) , <nl> - range , cb , direction ) ) { <nl> - return false ; <nl> + <nl> + / / Get the child key range <nl> + const btree_key_t * child_left_excl_or_null ; <nl> + const btree_key_t * child_right_incl_or_null ; <nl> + get_child_key_range ( inode , true_index , <nl> + left_excl_or_null , right_incl_or_null , <nl> + & child_left_excl_or_null , & child_right_incl_or_null ) ; <nl> + <nl> + if ( cb - > is_range_interesting ( child_left_excl_or_null , child_right_incl_or_null ) ) { <nl> + counted_t < counted_buf_lock_t > lock ; <nl> + { <nl> + profile : : starter_t starter ( " Acquire block for read . " , cb - > get_trace ( ) ) ; <nl> + lock = make_counted < counted_buf_lock_t > ( block . get ( ) , pair - > lnode , <nl> + access_t : : read ) ; <nl> + } <nl> + if ( ! btree_depth_first_traversal ( std : : move ( lock ) , <nl> + range , cb , direction , <nl> + child_left_excl_or_null , <nl> + child_right_incl_or_null ) ) { <nl> + return false ; <nl> + } <nl> } <nl> } <nl> return true ; <nl> mmm a / src / btree / depth_first_traversal . hpp <nl> ppp b / src / btree / depth_first_traversal . hpp <nl> class depth_first_traversal_callback_t { <nl> / * Return value of ` NO ` indicates to keep going ; ` YES ` indicates to stop <nl> traversing the tree . * / <nl> virtual done_traversing_t handle_pair ( scoped_key_value_t & & keyvalue ) = 0 ; <nl> + / * Can be overloaded if you don ' t want to query a contiguous range of keys , <nl> + but only parts of it . Will be called before traversing into any child node . <nl> + Note : returning false here does not guarantee that a given range is never <nl> + encountered by handle_pair ( ) . is_range_interesting ( ) is just a pre - filter . * / <nl> + virtual bool is_range_interesting ( UNUSED const btree_key_t * left_excl_or_null , <nl> + UNUSED const btree_key_t * right_incl_or_null ) { <nl> + return true ; <nl> + } <nl> virtual profile : : trace_t * get_trace ( ) THROWS_NOTHING { return NULL ; } <nl> protected : <nl> virtual ~ depth_first_traversal_callback_t ( ) { } <nl> mmm a / src / build . mk <nl> ppp b / src / build . mk <nl> unit : $ ( BUILD_DIR ) / $ ( SERVER_UNIT_TEST_NAME ) <nl> <nl> $ ( PROTO_DIR ) / % . pb . h $ ( PROTO_DIR ) / % . pb . cc : $ ( SOURCE_DIR ) / % . proto $ ( PROTOC_BIN_DEP ) | $ ( PROTO_DIR ) / . <nl> $ P PROTOC [ CPP ] $ ^ <nl> + <nl> + # # See issue # 2965 <nl> + + rm - f $ ( PROTO_DIR ) / $ * . pb . h $ ( PROTO_DIR ) / $ * . pb . cc <nl> + <nl> $ ( PROTOC ) $ ( PROTOCFLAGS_CXX ) - - cpp_out $ ( PROTO_DIR ) $ < <nl> - touch $ @ <nl> <nl> rpc / semilattice / joins / macros . hpp : $ ( TOP ) / scripts / generate_join_macros . py <nl> rpc / serialize_macros . hpp : $ ( TOP ) / scripts / generate_serialize_macros . py <nl> mmm a / src / clustering / administration / cluster_config . cc <nl> ppp b / src / clustering / administration / cluster_config . cc <nl> bool convert_auth_key_from_datum ( <nl> ql : : datum_t datum , <nl> auth_key_t * value_out , <nl> std : : string * error_out ) { <nl> - if ( datum - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( datum . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> * value_out = auth_key_t ( ) ; <nl> return true ; <nl> - } else if ( datum - > get_type ( ) = = ql : : datum_t : : R_STR ) { <nl> - if ( ! value_out - > assign_value ( datum - > as_str ( ) . to_std ( ) ) ) { <nl> - if ( datum - > as_str ( ) . size ( ) > static_cast < size_t > ( auth_key_t : : max_length ) ) { <nl> + } else if ( datum . get_type ( ) = = ql : : datum_t : : R_STR ) { <nl> + if ( ! value_out - > assign_value ( datum . as_str ( ) . to_std ( ) ) ) { <nl> + if ( datum . as_str ( ) . size ( ) > static_cast < size_t > ( auth_key_t : : max_length ) ) { <nl> * error_out = strprintf ( " The auth key should be at most % zu bytes long , " <nl> " but your given key is % zu bytes . " , <nl> - static_cast < size_t > ( auth_key_t : : max_length ) , datum - > as_str ( ) . size ( ) ) ; <nl> + static_cast < size_t > ( auth_key_t : : max_length ) , datum . as_str ( ) . size ( ) ) ; <nl> } else { <nl> / * Currently this can ' t happen , because length is the only reason to <nl> invalidate an auth key . This is here for future - proofing . * / <nl> bool convert_auth_key_from_datum ( <nl> " Setting the auth key to { hidden : true } is not allowed . " ; <nl> return false ; <nl> } else { <nl> - * error_out = " Expected a string or null ; got " + datum - > print ( ) ; <nl> + * error_out = " Expected a string or null ; got " + datum . print ( ) ; <nl> return false ; <nl> } <nl> } <nl> mmm a / src / clustering / administration / datum_adapter . cc <nl> ppp b / src / clustering / administration / datum_adapter . cc <nl> bool convert_name_from_datum ( <nl> const std : : string & what , <nl> name_string_t * value_out , <nl> std : : string * error_out ) { <nl> - if ( datum - > get_type ( ) ! = ql : : datum_t : : R_STR ) { <nl> - * error_out = " Expected a " + what + " ; got " + datum - > print ( ) ; <nl> + if ( datum . get_type ( ) ! = ql : : datum_t : : R_STR ) { <nl> + * error_out = " Expected a " + what + " ; got " + datum . print ( ) ; <nl> return false ; <nl> } <nl> - if ( ! value_out - > assign_value ( datum - > as_str ( ) ) ) { <nl> - * error_out = datum - > print ( ) + " is not a valid " + what + " ; " + <nl> + if ( ! value_out - > assign_value ( datum . as_str ( ) ) ) { <nl> + * error_out = datum . print ( ) + " is not a valid " + what + " ; " + <nl> std : : string ( name_string_t : : valid_char_msg ) ; <nl> return false ; <nl> } <nl> bool convert_uuid_from_datum ( <nl> ql : : datum_t datum , <nl> uuid_u * value_out , <nl> std : : string * error_out ) { <nl> - if ( datum - > get_type ( ) ! = ql : : datum_t : : R_STR ) { <nl> - * error_out = " Expected a UUID ; got " + datum - > print ( ) ; <nl> + if ( datum . get_type ( ) ! = ql : : datum_t : : R_STR ) { <nl> + * error_out = " Expected a UUID ; got " + datum . print ( ) ; <nl> return false ; <nl> } <nl> - if ( ! str_to_uuid ( datum - > as_str ( ) . to_std ( ) , value_out ) ) { <nl> - * error_out = " Expected a UUID ; got " + datum - > print ( ) ; <nl> + if ( ! str_to_uuid ( datum . as_str ( ) . to_std ( ) , value_out ) ) { <nl> + * error_out = " Expected a UUID ; got " + datum . print ( ) ; <nl> return false ; <nl> } <nl> return true ; <nl> bool convert_uuid_from_datum ( <nl> bool converter_from_datum_object_t : : init ( <nl> ql : : datum_t _datum , <nl> std : : string * error_out ) { <nl> - if ( _datum - > get_type ( ) ! = ql : : datum_t : : R_OBJECT ) { <nl> - * error_out = " Expected an object ; got " + _datum - > print ( ) ; <nl> + if ( _datum . get_type ( ) ! = ql : : datum_t : : R_OBJECT ) { <nl> + * error_out = " Expected an object ; got " + _datum . print ( ) ; <nl> return false ; <nl> } <nl> datum = _datum ; <nl> bool converter_from_datum_object_t : : get ( <nl> ql : : datum_t * value_out , <nl> std : : string * error_out ) { <nl> extra_keys . erase ( datum_string_t ( key ) ) ; <nl> - * value_out = datum - > get_field ( key , ql : : NOTHROW ) ; <nl> + * value_out = datum . get_field ( key , ql : : NOTHROW ) ; <nl> if ( ! value_out - > has ( ) ) { <nl> * error_out = strprintf ( " Expected a field named ` % s ` . " , key ) ; <nl> return false ; <nl> void converter_from_datum_object_t : : get_optional ( <nl> const char * key , <nl> ql : : datum_t * value_out ) { <nl> extra_keys . erase ( datum_string_t ( key ) ) ; <nl> - * value_out = datum - > get_field ( key , ql : : NOTHROW ) ; <nl> + * value_out = datum . get_field ( key , ql : : NOTHROW ) ; <nl> } <nl> <nl> bool converter_from_datum_object_t : : check_no_extra_keys ( std : : string * error_out ) { <nl> mmm a / src / clustering / administration / datum_adapter . hpp <nl> ppp b / src / clustering / administration / datum_adapter . hpp <nl> bool convert_vector_from_datum ( <nl> ql : : datum_t datum , <nl> std : : vector < T > * vector_out , <nl> std : : string * error_out ) { <nl> - if ( datum - > get_type ( ) ! = ql : : datum_t : : R_ARRAY ) { <nl> - * error_out = " Expected an array , got " + datum - > print ( ) ; <nl> + if ( datum . get_type ( ) ! = ql : : datum_t : : R_ARRAY ) { <nl> + * error_out = " Expected an array , got " + datum . print ( ) ; <nl> return false ; <nl> } <nl> - vector_out - > resize ( datum - > arr_size ( ) ) ; <nl> - for ( size_t i = 0 ; i < datum - > arr_size ( ) ; + + i ) { <nl> - if ( ! conv ( datum - > get ( i ) , & ( * vector_out ) [ i ] , error_out ) ) { <nl> + vector_out - > resize ( datum . arr_size ( ) ) ; <nl> + for ( size_t i = 0 ; i < datum . arr_size ( ) ; + + i ) { <nl> + if ( ! conv ( datum . get ( i ) , & ( * vector_out ) [ i ] , error_out ) ) { <nl> return false ; <nl> } <nl> } <nl> bool convert_set_from_datum ( <nl> ql : : datum_t datum , <nl> std : : set < T > * set_out , <nl> std : : string * error_out ) { <nl> - if ( datum - > get_type ( ) ! = ql : : datum_t : : R_ARRAY ) { <nl> - * error_out = " Expected an array , got " + datum - > print ( ) ; <nl> + if ( datum . get_type ( ) ! = ql : : datum_t : : R_ARRAY ) { <nl> + * error_out = " Expected an array , got " + datum . print ( ) ; <nl> return false ; <nl> } <nl> set_out - > clear ( ) ; <nl> - for ( size_t i = 0 ; i < datum - > arr_size ( ) ; + + i ) { <nl> + for ( size_t i = 0 ; i < datum . arr_size ( ) ; + + i ) { <nl> T value ; <nl> - if ( ! conv ( datum - > get ( i ) , & value , error_out ) ) { <nl> + if ( ! conv ( datum . get ( i ) , & value , error_out ) ) { <nl> return false ; <nl> } <nl> auto res = set_out - > insert ( value ) ; <nl> if ( ! allow_duplicates & & ! res . second ) { <nl> - * error_out = datum - > get ( i ) - > print ( ) + " was specified more than once . " ; <nl> + * error_out = datum . get ( i ) . print ( ) + " was specified more than once . " ; <nl> return false ; <nl> } <nl> } <nl> mmm a / src / clustering / administration / tables / table_config . cc <nl> ppp b / src / clustering / administration / tables / table_config . cc <nl> bool convert_table_config_shard_from_datum ( <nl> if ( ! converter . get ( " replicas " , & replica_names_datum , error_out ) ) { <nl> return false ; <nl> } <nl> - if ( replica_names_datum - > get_type ( ) ! = ql : : datum_t : : R_ARRAY ) { <nl> + if ( replica_names_datum . get_type ( ) ! = ql : : datum_t : : R_ARRAY ) { <nl> * error_out = " In ` replicas ` : Expected an array , got " + <nl> - replica_names_datum - > print ( ) ; <nl> + replica_names_datum . print ( ) ; <nl> return false ; <nl> } <nl> if ( ! convert_set_from_datum < name_string_t > ( <nl> mmm a / src / containers / shared_buffer . hpp <nl> ppp b / src / containers / shared_buffer . hpp <nl> class shared_buf_ref_t { <nl> return reinterpret_cast < const T * > ( buf - > data ( offset ) ) ; <nl> } <nl> <nl> + shared_buf_ref_t make_child ( size_t relative_offset ) const { <nl> + guarantee_in_boundary ( relative_offset ) ; <nl> + return shared_buf_ref_t ( buf , offset + relative_offset ) ; <nl> + } <nl> + <nl> / / Makes sure that the underlying shared buffer has space for at least <nl> / / num_elements elements of type T . <nl> / / This protects against reading into memory that doesn ' t belong to the <nl> mmm a / src / extproc / http_job . cc <nl> ppp b / src / extproc / http_job . cc <nl> std : : string url_encode_fields ( CURL * curl_handle , <nl> <nl> std : : map < std : : string , std : : string > translated_fields ; <nl> <nl> - for ( size_t field_idx = 0 ; field_idx < fields - > obj_size ( ) ; + + field_idx ) { <nl> - auto pair = fields - > get_pair ( field_idx ) ; <nl> + for ( size_t field_idx = 0 ; field_idx < fields . obj_size ( ) ; + + field_idx ) { <nl> + auto pair = fields . get_pair ( field_idx ) ; <nl> std : : string val ; <nl> - if ( pair . second - > get_type ( ) = = ql : : datum_t : : R_NUM ) { <nl> + if ( pair . second . get_type ( ) = = ql : : datum_t : : R_NUM ) { <nl> val = strprintf ( " % " PR_RECONSTRUCTABLE_DOUBLE , <nl> - pair . second - > as_num ( ) ) ; <nl> - } else if ( pair . second - > get_type ( ) = = ql : : datum_t : : R_STR ) { <nl> - val = pair . second - > as_str ( ) . to_std ( ) ; <nl> - } else if ( pair . second - > get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> + pair . second . as_num ( ) ) ; <nl> + } else if ( pair . second . get_type ( ) = = ql : : datum_t : : R_STR ) { <nl> + val = pair . second . as_str ( ) . to_std ( ) ; <nl> + } else if ( pair . second . get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> / / This shouldn ' t happen because we check this in the main process anyway <nl> throw curl_exc_t ( strprintf ( " expected ` params . % s ` to be a NUMBER , STRING , " <nl> " or NULL , but found % s " , <nl> pair . first . to_std ( ) . c_str ( ) , <nl> - pair . second - > get_type_name ( ) . c_str ( ) ) ) ; <nl> + pair . second . get_type_name ( ) . c_str ( ) ) ) ; <nl> } <nl> translated_fields [ pair . first . to_std ( ) ] = val ; <nl> } <nl> mmm a / src / extproc / js_job . cc <nl> ppp b / src / extproc / js_job . cc <nl> ql : : datum_t js_to_datum ( const v8 : : Handle < v8 : : Value > & value , <nl> v8 : : Handle < v8 : : Value > js_from_datum ( const ql : : datum_t & datum , <nl> std : : string * err_out ) { <nl> guarantee ( datum . has ( ) ) ; <nl> - switch ( datum - > get_type ( ) ) { <nl> + switch ( datum . get_type ( ) ) { <nl> case ql : : datum_t : : type_t : : R_BINARY : <nl> / / TODO : In order to support this , we need to link against a static version of <nl> / / V8 , which provides an ArrayBuffer API . <nl> err_out - > assign ( " ` r . binary ` data cannot be used in ` r . js ` . " ) ; <nl> return v8 : : Handle < v8 : : Value > ( ) ; <nl> case ql : : datum_t : : type_t : : R_BOOL : <nl> - if ( datum - > as_bool ( ) ) { <nl> + if ( datum . as_bool ( ) ) { <nl> return v8 : : True ( ) ; <nl> } else { <nl> return v8 : : False ( ) ; <nl> v8 : : Handle < v8 : : Value > js_from_datum ( const ql : : datum_t & datum , <nl> case ql : : datum_t : : type_t : : R_NULL : <nl> return v8 : : Null ( ) ; <nl> case ql : : datum_t : : type_t : : R_NUM : <nl> - return v8 : : Number : : New ( datum - > as_num ( ) ) ; <nl> + return v8 : : Number : : New ( datum . as_num ( ) ) ; <nl> case ql : : datum_t : : type_t : : R_STR : <nl> - return v8 : : String : : New ( datum - > as_str ( ) . to_std ( ) . c_str ( ) ) ; <nl> + return v8 : : String : : New ( datum . as_str ( ) . to_std ( ) . c_str ( ) ) ; <nl> case ql : : datum_t : : type_t : : R_ARRAY : { <nl> v8 : : Handle < v8 : : Array > array = v8 : : Array : : New ( ) ; <nl> <nl> v8 : : Handle < v8 : : Value > js_from_datum ( const ql : : datum_t & datum , <nl> return array ; <nl> } <nl> case ql : : datum_t : : type_t : : R_OBJECT : { <nl> - if ( datum - > is_ptype ( ql : : pseudo : : time_string ) ) { <nl> + if ( datum . is_ptype ( ql : : pseudo : : time_string ) ) { <nl> double epoch_time = ql : : pseudo : : time_to_epoch_time ( datum ) ; <nl> v8 : : Handle < v8 : : Value > date = v8 : : Date : : New ( epoch_time * 1000 ) ; <nl> return date ; <nl> mmm a / src / http / json . hpp <nl> ppp b / src / http / json . hpp <nl> class scoped_cJSON_t { <nl> guarantee ( item ) ; <nl> return cJSON_AddItemToObject ( val , string , item ) ; <nl> } <nl> + void AddItemToObject ( const char * string , size_t string_size , cJSON * item ) { <nl> + guarantee ( string ) ; <nl> + guarantee ( item ) ; <nl> + return cJSON_AddItemToObjectN ( val , string , string_size , item ) ; <nl> + } <nl> <nl> / * Remove / Detatch items from Arrays / Objects . Returns NULL if unsuccessful . * / <nl> cJSON * DetachItemFromArray ( int which ) { <nl> mmm a / src / http / json / cJSON . cc <nl> ppp b / src / http / json / cJSON . cc <nl> void cJSON_AddItemToArray ( cJSON * array , cJSON * item ) { <nl> } <nl> <nl> void cJSON_AddItemToObject ( cJSON * object , const char * string , cJSON * item ) { if ( ! item ) return ; char * tmp = cJSON_strdup ( string ) ; if ( item - > string ) cJSON_free ( item - > string ) ; item - > string = tmp ; cJSON_AddItemToArray ( object , item ) ; } <nl> + void cJSON_AddItemToObjectN ( cJSON * object , const char * string , size_t string_size , cJSON * item ) { if ( ! item ) return ; char * tmp = cJSON_strdup ( string , string_size ) ; if ( item - > string ) cJSON_free ( item - > string ) ; item - > string = tmp ; cJSON_AddItemToArray ( object , item ) ; } <nl> <nl> void cJSON_AddItemReferenceToArray ( cJSON * array , cJSON * item ) { cJSON_AddItemToArray ( array , create_reference ( item ) ) ; } <nl> void cJSON_AddItemReferenceToObject ( cJSON * object , const char * string , cJSON * item ) { cJSON_AddItemToObject ( object , string , create_reference ( item ) ) ; } <nl> mmm a / src / http / json / cJSON . hpp <nl> ppp b / src / http / json / cJSON . hpp <nl> extern cJSON * cJSON_CreateStringArray ( const char * * strings , int count ) ; <nl> / * Append item to the specified array / object . * / <nl> extern void cJSON_AddItemToArray ( cJSON * array , cJSON * item ) ; <nl> extern void cJSON_AddItemToObject ( cJSON * object , const char * string , cJSON * item ) ; <nl> + extern void cJSON_AddItemToObjectN ( cJSON * object , const char * string , size_t string_size , cJSON * item ) ; <nl> / * Append reference to item to the specified array / object . Use this when you want to add an existing cJSON to a new cJSON , but don ' t want to corrupt your existing cJSON . * / <nl> extern void cJSON_AddItemReferenceToArray ( cJSON * array , cJSON * item ) ; <nl> extern void cJSON_AddItemReferenceToObject ( cJSON * object , const char * string , cJSON * item ) ; <nl> mmm a / src / protob / protob . cc <nl> ppp b / src / protob / protob . cc <nl> void query_server_t : : handle ( const http_req_t & req , <nl> / / problems with interruption <nl> ql : : datum_t noreply = static_optarg ( " noreply " , query ) ; <nl> bool response_needed = ! ( noreply . has ( ) & & <nl> - noreply - > get_type ( ) = = ql : : datum_t : : type_t : : R_BOOL & & <nl> - noreply - > as_bool ( ) ) ; <nl> + noreply . get_type ( ) = = ql : : datum_t : : type_t : : R_BOOL & & <nl> + noreply . as_bool ( ) ) ; <nl> <nl> if ( ! response_needed ) { <nl> * result = http_res_t ( HTTP_BAD_REQUEST , " application / text " , <nl> mmm a / src / rdb_protocol / artificial_table / artificial_table . cc <nl> ppp b / src / rdb_protocol / artificial_table / artificial_table . cc <nl> counted_t < ql : : datum_stream_t > artificial_table_t : : read_all ( <nl> std : : sort ( keys . begin ( ) , keys . end ( ) , <nl> [ ] ( const ql : : datum_t & a , <nl> const ql : : datum_t & b ) { <nl> - return a - > compare_lt ( reql_version_t : : LATEST , * b ) ; <nl> + return a . compare_lt ( reql_version_t : : LATEST , b ) ; <nl> } ) ; <nl> break ; <nl> case sorting_t : : DESCENDING : <nl> std : : sort ( keys . begin ( ) , keys . end ( ) , <nl> [ ] ( const ql : : datum_t & a , <nl> const ql : : datum_t & b ) { <nl> - return a - > compare_gt ( reql_version_t : : LATEST , * b ) ; <nl> + return a . compare_gt ( reql_version_t : : LATEST , b ) ; <nl> } ) ; <nl> break ; <nl> default : <nl> ql : : datum_t artificial_table_t : : write_batched_insert ( <nl> throttled_pmap ( inserts . size ( ) , [ & ] ( int i ) { <nl> try { <nl> ql : : datum_t insert_row = inserts [ i ] ; <nl> - ql : : datum_t key = insert_row - > get_field ( <nl> + ql : : datum_t key = insert_row . get_field ( <nl> datum_string_t ( primary_key ) , ql : : NOTHROW ) ; <nl> guarantee ( key . has ( ) , " write_batched_insert ( ) shouldn ' t ever be called with " <nl> " documents that lack a primary key . " ) ; <nl> bool artificial_table_t : : checked_read_row ( <nl> } <nl> # ifndef NDEBUG <nl> if ( row_out - > has ( ) ) { <nl> - ql : : datum_t pval2 = ( * row_out ) - > get_field ( <nl> + ql : : datum_t pval2 = ( * row_out ) . get_field ( <nl> datum_string_t ( get_pkey ( ) ) , ql : : NOTHROW ) ; <nl> rassert ( pval2 . has ( ) ) ; <nl> rassert ( pval2 = = pval ) ; <nl> void artificial_table_t : : do_single_update ( <nl> if ( ! checked_read_row ( pval , interruptor , & old_row , & error ) ) { <nl> ql : : datum_object_builder_t builder ; <nl> builder . add_error ( error . c_str ( ) ) ; <nl> - * stats_inout = ( * stats_inout ) - > merge ( <nl> + * stats_inout = ( * stats_inout ) . merge ( <nl> std : : move ( builder ) . to_datum ( ) , ql : : stats_merge , env - > limits ( ) , <nl> conditions_inout ) ; <nl> return ; <nl> void artificial_table_t : : do_single_update ( <nl> ql : : datum_t new_row = function ( old_row ) ; <nl> bool was_changed ; <nl> resp = make_row_replacement_stats ( <nl> - datum_string_t ( primary_key ) , store_key_t ( pval - > print_primary ( ) ) , <nl> + datum_string_t ( primary_key ) , store_key_t ( pval . print_primary ( ) ) , <nl> old_row , new_row , return_changes , & was_changed ) ; <nl> if ( was_changed ) { <nl> - if ( new_row - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( new_row . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> new_row . reset ( ) ; <nl> } <nl> if ( ! backend - > write_row ( pval , new_row , interruptor , & error ) ) { <nl> void artificial_table_t : : do_single_update ( <nl> resp = make_row_replacement_error_stats ( <nl> old_row , return_changes , e . what ( ) ) ; <nl> } <nl> - * stats_inout = ( * stats_inout ) - > merge ( <nl> + * stats_inout = ( * stats_inout ) . merge ( <nl> resp , ql : : stats_merge , env - > limits ( ) , conditions_inout ) ; <nl> } <nl> <nl> mmm a / src / rdb_protocol / artificial_table / in_memory . hpp <nl> ppp b / src / rdb_protocol / artificial_table / in_memory . hpp <nl> class in_memory_artificial_table_backend_t : <nl> on_thread_t thread_switcher ( home_thread ( ) ) ; <nl> keys_out - > clear ( ) ; <nl> for ( auto it = data . begin ( ) ; it ! = data . end ( ) ; + + it ) { <nl> - ql : : datum_t key = it - > second - > get_field ( " id " , ql : : NOTHROW ) ; <nl> + ql : : datum_t key = it - > second . get_field ( " id " , ql : : NOTHROW ) ; <nl> guarantee ( key . has ( ) ) ; <nl> keys_out - > push_back ( key ) ; <nl> } <nl> class in_memory_artificial_table_backend_t : <nl> UNUSED std : : string * error_out ) { <nl> random_delay ( interruptor ) ; <nl> on_thread_t thread_switcher ( home_thread ( ) ) ; <nl> - auto it = data . find ( primary_key - > print_primary ( ) ) ; <nl> + auto it = data . find ( primary_key . print_primary ( ) ) ; <nl> if ( it ! = data . end ( ) ) { <nl> * row_out = it - > second ; <nl> } else { <nl> class in_memory_artificial_table_backend_t : <nl> random_delay ( interruptor ) ; <nl> on_thread_t thread_switcher ( home_thread ( ) ) ; <nl> if ( new_value . has ( ) ) { <nl> - data [ primary_key - > print_primary ( ) ] = new_value ; <nl> + data [ primary_key . print_primary ( ) ] = new_value ; <nl> } else { <nl> - data . erase ( primary_key - > print_primary ( ) ) ; <nl> + data . erase ( primary_key . print_primary ( ) ) ; <nl> } <nl> return true ; <nl> } <nl> mmm a / src / rdb_protocol / batching . cc <nl> ppp b / src / rdb_protocol / batching . cc <nl> batchspec_t batchspec_t : : user ( batch_type_t batch_type , <nl> datum_t max_els_d , min_els_d , max_size_d , max_dur_d ; <nl> datum_t first_scaledown_d ; <nl> if ( conf . has ( ) ) { <nl> - min_els_d = conf - > get_field ( " min_els " , NOTHROW ) ; <nl> - max_els_d = conf - > get_field ( " max_els " , NOTHROW ) ; <nl> - max_size_d = conf - > get_field ( " max_size " , NOTHROW ) ; <nl> - first_scaledown_d = conf - > get_field ( " first_scaledown " , NOTHROW ) ; <nl> - max_dur_d = conf - > get_field ( " max_dur " , NOTHROW ) ; <nl> + min_els_d = conf . get_field ( " min_els " , NOTHROW ) ; <nl> + max_els_d = conf . get_field ( " max_els " , NOTHROW ) ; <nl> + max_size_d = conf . get_field ( " max_size " , NOTHROW ) ; <nl> + first_scaledown_d = conf . get_field ( " first_scaledown " , NOTHROW ) ; <nl> + max_dur_d = conf . get_field ( " max_dur " , NOTHROW ) ; <nl> } <nl> int64_t max_els = max_els_d . has ( ) <nl> - ? max_els_d - > as_int ( ) <nl> + ? max_els_d . as_int ( ) <nl> : std : : numeric_limits < decltype ( batchspec_t ( ) . max_els ) > : : max ( ) ; <nl> int64_t min_els = min_els_d . has ( ) <nl> - ? min_els_d - > as_int ( ) <nl> + ? min_els_d . as_int ( ) <nl> : std : : min < int64_t > ( max_els , DEFAULT_MIN_ELS ) ; <nl> - int64_t max_size = max_size_d . has ( ) ? max_size_d - > as_int ( ) : DEFAULT_MAX_SIZE ; <nl> + int64_t max_size = max_size_d . has ( ) ? max_size_d . as_int ( ) : DEFAULT_MAX_SIZE ; <nl> int64_t first_sd = first_scaledown_d . has ( ) <nl> - ? first_scaledown_d - > as_int ( ) <nl> + ? first_scaledown_d . as_int ( ) <nl> : DEFAULT_FIRST_SCALEDOWN ; <nl> - int64_t max_dur = max_dur_d . has ( ) ? max_dur_d - > as_int ( ) : DEFAULT_MAX_DURATION ; <nl> + int64_t max_dur = max_dur_d . has ( ) ? max_dur_d . as_int ( ) : DEFAULT_MAX_DURATION ; <nl> / / Protect the user in case they ' re a dork . Normally we would do rfail and <nl> / / trigger exceptions , but due to NOTHROWs above this may not be safe . <nl> min_els = std : : min < int64_t > ( min_els , max_els ) ; <nl> mmm a / src / rdb_protocol / btree . cc <nl> ppp b / src / rdb_protocol / btree . cc <nl> batched_replace_response_t rdb_replace_and_return_superblock ( <nl> / / Otherwise pass the entry with this key to the function . <nl> old_val = get_data ( kv_location . value_as < rdb_value_t > ( ) , <nl> buf_parent_t ( & kv_location . buf ) ) ; <nl> - guarantee ( old_val - > get_field ( primary_key , ql : : NOTHROW ) . has ( ) ) ; <nl> + guarantee ( old_val . get_field ( primary_key , ql : : NOTHROW ) . has ( ) ) ; <nl> } <nl> guarantee ( old_val . has ( ) ) ; <nl> <nl> batched_replace_response_t rdb_replace_and_return_superblock ( <nl> } <nl> <nl> / * Now that the change has passed validation , write it to disk * / <nl> - if ( new_val - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( new_val . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> kv_location_delete ( & kv_location , * info . key , info . btree - > timestamp , <nl> deletion_context , mod_info_out ) ; <nl> } else { <nl> - r_sanity_check ( new_val - > get_field ( primary_key , ql : : NOTHROW ) . has ( ) ) ; <nl> + r_sanity_check ( new_val . get_field ( primary_key , ql : : NOTHROW ) . has ( ) ) ; <nl> ql : : serialization_result_t res = <nl> kv_location_set ( & kv_location , * info . key , new_val , <nl> info . btree - > timestamp , deletion_context , <nl> mod_info_out ) ; <nl> switch ( res ) { <nl> case ql : : serialization_result_t : : ARRAY_TOO_BIG : <nl> - rfail_typed_target ( new_val , " Array too large for disk writes " <nl> + rfail_typed_target ( & new_val , " Array too large for disk writes " <nl> " ( limit 100 , 000 elements ) " ) ; <nl> unreachable ( ) ; <nl> case ql : : serialization_result_t : : SUCCESS : <nl> batched_replace_response_t rdb_replace_and_return_superblock ( <nl> } <nl> <nl> / * Report the changes for sindex and change - feed purposes * / <nl> - if ( old_val - > get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> + if ( old_val . get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> guarantee ( ! mod_info_out - > deleted . second . empty ( ) ) ; <nl> mod_info_out - > deleted . first = old_val ; <nl> } else { <nl> guarantee ( mod_info_out - > deleted . second . empty ( ) ) ; <nl> } <nl> - if ( new_val - > get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> + if ( new_val . get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> guarantee ( ! mod_info_out - > added . second . empty ( ) ) ; <nl> mod_info_out - > added . first = new_val ; <nl> } else { <nl> void do_a_replace_from_batched_replace ( <nl> ql : : datum_t res = rdb_replace_and_return_superblock ( <nl> info , & one_replace , & deletion_context , superblock_promise , & mod_report . info , <nl> trace ) ; <nl> - * stats_out = ( * stats_out ) - > merge ( res , ql : : stats_merge , limits , conditions ) ; <nl> + * stats_out = ( * stats_out ) . merge ( res , ql : : stats_merge , limits , conditions ) ; <nl> <nl> / / KSI : What is this for ? are we waiting to get in line to call on_mod_report ? <nl> / / I guess so . <nl> void rdb_set ( const store_key_t & key , <nl> mod_info ) ; <nl> switch ( res ) { <nl> case ql : : serialization_result_t : : ARRAY_TOO_BIG : <nl> - rfail_typed_target ( data , " Array too large for disk writes " <nl> + rfail_typed_target ( & data , " Array too large for disk writes " <nl> " ( limit 100 , 000 elements ) " ) ; <nl> unreachable ( ) ; <nl> case ql : : serialization_result_t : : SUCCESS : <nl> THROWS_ONLY ( interrupted_exc_t ) { <nl> ql : : env_t sindex_env ( job . env - > interruptor , sindex - > func_reql_version ) ; <nl> sindex_val = sindex - > func - > call ( & sindex_env , val ) - > as_datum ( ) ; <nl> if ( sindex - > multi = = sindex_multi_bool_t : : MULTI <nl> - & & sindex_val - > get_type ( ) = = ql : : datum_t : : R_ARRAY ) { <nl> + & & sindex_val . get_type ( ) = = ql : : datum_t : : R_ARRAY ) { <nl> boost : : optional < uint64_t > tag = * ql : : datum_t : : extract_tag ( key ) ; <nl> guarantee ( tag ) ; <nl> - sindex_val = sindex_val - > get ( * tag , ql : : NOTHROW ) ; <nl> - guarantee ( sindex_val ) ; <nl> + sindex_val = sindex_val . get ( * tag , ql : : NOTHROW ) ; <nl> + guarantee ( sindex_val . has ( ) ) ; <nl> } <nl> if ( ! sindex - > range . contains ( sindex - > func_reql_version , sindex_val ) ) { <nl> return done_traversing_t : : NO ; <nl> void rdb_rget_secondary_slice ( <nl> void rdb_get_intersecting_slice ( <nl> btree_slice_t * slice , <nl> const ql : : datum_t & query_geometry , <nl> + const region_t & sindex_region , <nl> superblock_t * superblock , <nl> ql : : env_t * ql_env , <nl> + const ql : : batchspec_t & batchspec , <nl> + const std : : vector < ql : : transform_variant_t > & transforms , <nl> + const boost : : optional < ql : : terminal_variant_t > & terminal , <nl> const key_range_t & pk_range , <nl> const sindex_disk_info_t & sindex_info , <nl> - intersecting_geo_read_response_t * response ) { <nl> + rget_read_response_t * response ) { <nl> guarantee ( query_geometry . has ( ) ) ; <nl> <nl> guarantee ( sindex_info . geo = = sindex_geo_bool_t : : GEO ) ; <nl> void rdb_get_intersecting_slice ( <nl> sindex_info . mapping_version_info . latest_compatible_reql_version ; <nl> collect_all_geo_intersecting_cb_t callback ( <nl> slice , <nl> + geo_job_data_t ( ql_env , batchspec , transforms , terminal ) , <nl> geo_sindex_data_t ( pk_range , sindex_info . mapping , sindex_func_reql_version , <nl> sindex_info . multi ) , <nl> - ql_env , <nl> - query_geometry ) ; <nl> - btree_parallel_traversal ( <nl> - superblock , & callback , <nl> - ql_env - > interruptor , <nl> + query_geometry , <nl> + sindex_region . inner , <nl> + response ) ; <nl> + btree_concurrent_traversal ( <nl> + superblock , sindex_region . inner , & callback , <nl> + direction_t : : FORWARD , <nl> release_superblock_t : : RELEASE ) ; <nl> - callback . finish ( response ) ; <nl> + callback . finish ( ) ; <nl> } <nl> <nl> void rdb_get_nearest_slice ( <nl> void rdb_get_nearest_slice ( <nl> sindex_func_reql_version , sindex_info . multi ) , <nl> ql_env , <nl> & state ) ; <nl> - btree_parallel_traversal ( <nl> - superblock , & callback , <nl> - ql_env - > interruptor , <nl> + btree_concurrent_traversal ( <nl> + superblock , key_range_t : : universe ( ) , & callback , <nl> + direction_t : : FORWARD , <nl> release_superblock_t : : KEEP ) ; <nl> callback . finish ( & partial_response ) ; <nl> } catch ( const geo_exception_t & e ) { <nl> std : : vector < std : : string > expand_geo_key ( <nl> / / Ignore non - geometry objects in geo indexes . <nl> / / TODO ( daniel ) : This needs to be changed once compound geo index <nl> / / support gets added . <nl> - if ( ! key - > is_ptype ( ql : : pseudo : : geometry_string ) ) { <nl> + if ( ! key . is_ptype ( ql : : pseudo : : geometry_string ) ) { <nl> return std : : vector < std : : string > ( ) ; <nl> } <nl> <nl> void compute_keys ( const store_key_t & primary_key , ql : : datum_t doc , <nl> index_info . mapping . compile_wire_func ( ) - > call ( & sindex_env , doc ) - > as_datum ( ) ; <nl> <nl> if ( index_info . multi = = sindex_multi_bool_t : : MULTI <nl> - & & index - > get_type ( ) = = ql : : datum_t : : R_ARRAY ) { <nl> - for ( uint64_t i = 0 ; i < index - > arr_size ( ) ; + + i ) { <nl> - const ql : : datum_t & skey = index - > get ( i , ql : : THROW ) ; <nl> + & & index . get_type ( ) = = ql : : datum_t : : R_ARRAY ) { <nl> + for ( uint64_t i = 0 ; i < index . arr_size ( ) ; + + i ) { <nl> + const ql : : datum_t & skey = index . get ( i , ql : : THROW ) ; <nl> if ( index_info . geo = = sindex_geo_bool_t : : GEO ) { <nl> std : : vector < std : : string > geo_keys = expand_geo_key ( reql_version , <nl> skey , <nl> void compute_keys ( const store_key_t & primary_key , ql : : datum_t doc , <nl> keys_out - > push_back ( store_key_t ( * it ) ) ; <nl> } <nl> } else { <nl> - keys_out - > push_back ( store_key_t ( skey - > print_secondary ( reql_version , <nl> - primary_key , <nl> - i ) ) ) ; <nl> + keys_out - > push_back ( store_key_t ( skey . print_secondary ( reql_version , <nl> + primary_key , <nl> + i ) ) ) ; <nl> } <nl> } <nl> } else { <nl> void compute_keys ( const store_key_t & primary_key , ql : : datum_t doc , <nl> keys_out - > push_back ( store_key_t ( * it ) ) ; <nl> } <nl> } else { <nl> - keys_out - > push_back ( store_key_t ( index - > print_secondary ( reql_version , <nl> - primary_key , <nl> - boost : : none ) ) ) ; <nl> + keys_out - > push_back ( store_key_t ( index . print_secondary ( reql_version , <nl> + primary_key , <nl> + boost : : none ) ) ) ; <nl> } <nl> } <nl> } <nl> void rdb_update_single_sindex ( <nl> <nl> superblock_t * super_block = sindex - > super_block . get ( ) ; <nl> <nl> - if ( modification - > info . deleted . first ) { <nl> + if ( modification - > info . deleted . first . has ( ) ) { <nl> guarantee ( ! modification - > info . deleted . second . empty ( ) ) ; <nl> try { <nl> ql : : datum_t deleted = modification - > info . deleted . first ; <nl> void rdb_update_single_sindex ( <nl> / / This is so we don ' t race against any sindex erase about who is faster <nl> / / ( we with inserting new entries , or the erase with removing them ) . <nl> const bool sindex_is_being_deleted = sindex - > sindex . being_deleted ; <nl> - if ( ! sindex_is_being_deleted & & modification - > info . added . first ) { <nl> + if ( ! sindex_is_being_deleted & & modification - > info . added . first . has ( ) ) { <nl> try { <nl> ql : : datum_t added = modification - > info . added . first ; <nl> <nl> void rdb_update_sindexes ( const store_t : : sindex_access_vector_t & sindexes , <nl> <nl> / * All of the sindex have been updated now it ' s time to actually clear the <nl> * deleted blob if it exists . * / <nl> - if ( modification - > info . deleted . first ) { <nl> + if ( modification - > info . deleted . first . has ( ) ) { <nl> deletion_context - > post_deleter ( ) - > delete_value ( buf_parent_t ( txn ) , <nl> modification - > info . deleted . second . data ( ) ) ; <nl> } <nl> mmm a / src / rdb_protocol / btree . hpp <nl> ppp b / src / rdb_protocol / btree . hpp <nl> void rdb_rget_secondary_slice ( <nl> void rdb_get_intersecting_slice ( <nl> btree_slice_t * slice , <nl> const ql : : datum_t & query_geometry , <nl> + const region_t & sindex_region , <nl> superblock_t * superblock , <nl> ql : : env_t * ql_env , <nl> + const ql : : batchspec_t & batchspec , <nl> + const std : : vector < ql : : transform_variant_t > & transforms , <nl> + const boost : : optional < ql : : terminal_variant_t > & terminal , <nl> const key_range_t & pk_range , <nl> const sindex_disk_info_t & sindex_info , <nl> - intersecting_geo_read_response_t * response ) ; <nl> + rget_read_response_t * response ) ; <nl> <nl> void rdb_get_nearest_slice ( <nl> btree_slice_t * slice , <nl> mmm a / src / rdb_protocol / changefeed . cc <nl> ppp b / src / rdb_protocol / changefeed . cc <nl> class point_sub_t : public subscription_t { <nl> nif - > read ( <nl> read_t ( <nl> changefeed_point_stamp_t ( <nl> - * addr , store_key_t ( key - > print_primary ( ) ) ) , <nl> + * addr , store_key_t ( key . print_primary ( ) ) ) , <nl> profile_bool_t : : DONT_PROFILE ) , <nl> & read_resp , <nl> order_token_t : : ignore , <nl> class msg_visitor_t : public boost : : static_visitor < void > { <nl> d , default_limits ) ) ; <nl> auto val = change . new_val . has ( ) ? change . new_val : change . old_val ; <nl> r_sanity_check ( val . has ( ) ) ; <nl> - auto pkey_val = val - > get_field ( datum_string_t ( feed - > pkey ) , NOTHROW ) ; <nl> + auto pkey_val = val . get_field ( datum_string_t ( feed - > pkey ) , NOTHROW ) ; <nl> r_sanity_check ( pkey_val . has ( ) ) ; <nl> feed - > on_point_sub ( <nl> pkey_val , <nl> mmm a / src / rdb_protocol / datum . cc <nl> ppp b / src / rdb_protocol / datum . cc <nl> <nl> # include " rdb_protocol / pseudo_geometry . hpp " <nl> # include " rdb_protocol / pseudo_literal . hpp " <nl> # include " rdb_protocol / pseudo_time . hpp " <nl> + # include " rdb_protocol / serialize_datum . hpp " <nl> # include " rdb_protocol / shards . hpp " <nl> # include " stl_utils . hpp " <nl> <nl> datum_t : : data_wrapper_t & datum_t : : data_wrapper_t : : operator = ( <nl> } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( ) : <nl> - type ( UNINITIALIZED ) { } <nl> + internal_type ( internal_type_t : : UNINITIALIZED ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( datum_t : : construct_null_t ) : <nl> - type ( R_NULL ) { } <nl> + internal_type ( internal_type_t : : R_NULL ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( datum_t : : construct_boolean_t , bool _bool ) : <nl> - type ( R_BOOL ) , r_bool ( _bool ) { } <nl> + r_bool ( _bool ) , internal_type ( internal_type_t : : R_BOOL ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( datum_t : : construct_binary_t , <nl> datum_string_t _data ) : <nl> - type ( R_BINARY ) , r_str ( std : : move ( _data ) ) { } <nl> + r_str ( std : : move ( _data ) ) , internal_type ( internal_type_t : : R_BINARY ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( double num ) : <nl> - type ( R_NUM ) , r_num ( num ) { } <nl> + r_num ( num ) , internal_type ( internal_type_t : : R_NUM ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( datum_string_t str ) : <nl> - type ( R_STR ) , r_str ( std : : move ( str ) ) { } <nl> + r_str ( std : : move ( str ) ) , internal_type ( internal_type_t : : R_STR ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( const char * cstr ) : <nl> - type ( R_STR ) , r_str ( cstr ) { } <nl> + r_str ( cstr ) , internal_type ( internal_type_t : : R_STR ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( std : : vector < datum_t > & & array ) : <nl> - type ( R_ARRAY ) , <nl> - r_array ( new countable_wrapper_t < std : : vector < datum_t > > ( std : : move ( array ) ) ) { } <nl> + r_array ( new countable_wrapper_t < std : : vector < datum_t > > ( std : : move ( array ) ) ) , <nl> + internal_type ( internal_type_t : : R_ARRAY ) { } <nl> <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( <nl> std : : vector < std : : pair < datum_string_t , datum_t > > & & object ) : <nl> - type ( R_OBJECT ) , <nl> r_object ( new countable_wrapper_t < std : : vector < std : : pair < datum_string_t , datum_t > > > ( <nl> - std : : move ( object ) ) ) { <nl> + std : : move ( object ) ) ) , <nl> + internal_type ( internal_type_t : : R_OBJECT ) { <nl> <nl> # ifndef NDEBUG <nl> auto key_cmp = [ ] ( const std : : pair < datum_string_t , datum_t > & p1 , <nl> datum_t : : data_wrapper_t : : data_wrapper_t ( <nl> # endif <nl> } <nl> <nl> + datum_t : : data_wrapper_t : : data_wrapper_t ( type_t type , shared_buf_ref_t < char > & & _buf_ref ) { <nl> + switch ( type ) { <nl> + case R_BINARY : { <nl> + internal_type = internal_type_t : : R_BINARY ; <nl> + new ( & r_str ) datum_string_t ( std : : move ( _buf_ref ) ) ; <nl> + } break ; <nl> + case R_ARRAY : { <nl> + internal_type = internal_type_t : : BUF_R_ARRAY ; <nl> + new ( & buf_ref ) shared_buf_ref_t < char > ( std : : move ( _buf_ref ) ) ; <nl> + } break ; <nl> + case R_OBJECT : { <nl> + internal_type = internal_type_t : : BUF_R_OBJECT ; <nl> + new ( & buf_ref ) shared_buf_ref_t < char > ( std : : move ( _buf_ref ) ) ; <nl> + } break ; <nl> + case R_STR : { <nl> + internal_type = internal_type_t : : R_STR ; <nl> + new ( & r_str ) datum_string_t ( std : : move ( _buf_ref ) ) ; <nl> + } break ; <nl> + case UNINITIALIZED : / / fallthru <nl> + case R_BOOL : / / fallthru <nl> + case R_NULL : / / fallthru <nl> + case R_NUM : / / fallthru <nl> + default : <nl> + unreachable ( ) ; <nl> + } <nl> + } <nl> + <nl> datum_t : : data_wrapper_t : : ~ data_wrapper_t ( ) { <nl> destruct ( ) ; <nl> } <nl> <nl> + datum_t : : type_t datum_t : : data_wrapper_t : : get_type ( ) const { <nl> + switch ( internal_type ) { <nl> + case internal_type_t : : UNINITIALIZED : <nl> + return type_t : : UNINITIALIZED ; <nl> + case internal_type_t : : R_ARRAY : <nl> + return type_t : : R_ARRAY ; <nl> + case internal_type_t : : R_BINARY : <nl> + return type_t : : R_BINARY ; <nl> + case internal_type_t : : R_BOOL : <nl> + return type_t : : R_BOOL ; <nl> + case internal_type_t : : R_NULL : <nl> + return type_t : : R_NULL ; <nl> + case internal_type_t : : R_NUM : <nl> + return type_t : : R_NUM ; <nl> + case internal_type_t : : R_OBJECT : <nl> + return type_t : : R_OBJECT ; <nl> + case internal_type_t : : R_STR : <nl> + return type_t : : R_STR ; <nl> + case internal_type_t : : BUF_R_ARRAY : <nl> + return type_t : : R_ARRAY ; <nl> + case internal_type_t : : BUF_R_OBJECT : <nl> + return type_t : : R_OBJECT ; <nl> + default : <nl> + unreachable ( ) ; <nl> + } <nl> + } <nl> + datum_t : : internal_type_t datum_t : : data_wrapper_t : : get_internal_type ( ) const { <nl> + return internal_type ; <nl> + } <nl> + <nl> void datum_t : : data_wrapper_t : : destruct ( ) { <nl> - switch ( type ) { <nl> - case UNINITIALIZED : / / fallthru <nl> - case R_NULL : / / fallthru <nl> - case R_BOOL : / / fallthru <nl> - case R_NUM : break ; <nl> - case R_BINARY : / / fallthru <nl> - case R_STR : { <nl> + switch ( internal_type ) { <nl> + case internal_type_t : : UNINITIALIZED : / / fallthru <nl> + case internal_type_t : : R_NULL : / / fallthru <nl> + case internal_type_t : : R_BOOL : / / fallthru <nl> + case internal_type_t : : R_NUM : break ; <nl> + case internal_type_t : : R_BINARY : / / fallthru <nl> + case internal_type_t : : R_STR : { <nl> r_str . ~ datum_string_t ( ) ; <nl> } break ; <nl> - case R_ARRAY : { <nl> + case internal_type_t : : R_ARRAY : { <nl> r_array . ~ counted_t < countable_wrapper_t < std : : vector < datum_t > > > ( ) ; <nl> } break ; <nl> - case R_OBJECT : { <nl> + case internal_type_t : : R_OBJECT : { <nl> r_object . ~ counted_t < countable_wrapper_t < std : : vector < std : : pair < datum_string_t , datum_t > > > > ( ) ; <nl> } break ; <nl> + case internal_type_t : : BUF_R_ARRAY : / / fallthru <nl> + case internal_type_t : : BUF_R_OBJECT : { <nl> + buf_ref . ~ shared_buf_ref_t < char > ( ) ; <nl> + } break ; <nl> default : unreachable ( ) ; <nl> } <nl> } <nl> <nl> void datum_t : : data_wrapper_t : : assign_copy ( const datum_t : : data_wrapper_t & copyee ) { <nl> - type = copyee . type ; <nl> - switch ( type ) { <nl> - case UNINITIALIZED : / / fallthru <nl> - case R_NULL : break ; <nl> - case R_BOOL : { <nl> + internal_type = copyee . internal_type ; <nl> + switch ( internal_type ) { <nl> + case internal_type_t : : UNINITIALIZED : / / fallthru <nl> + case internal_type_t : : R_NULL : break ; <nl> + case internal_type_t : : R_BOOL : { <nl> r_bool = copyee . r_bool ; <nl> } break ; <nl> - case R_NUM : { <nl> + case internal_type_t : : R_NUM : { <nl> r_num = copyee . r_num ; <nl> } break ; <nl> - case R_BINARY : / / fallthru <nl> - case R_STR : { <nl> + case internal_type_t : : R_BINARY : / / fallthru <nl> + case internal_type_t : : R_STR : { <nl> new ( & r_str ) datum_string_t ( copyee . r_str ) ; <nl> } break ; <nl> - case R_ARRAY : { <nl> + case internal_type_t : : R_ARRAY : { <nl> new ( & r_array ) counted_t < countable_wrapper_t < std : : vector < datum_t > > > ( copyee . r_array ) ; <nl> } break ; <nl> - case R_OBJECT : { <nl> + case internal_type_t : : R_OBJECT : { <nl> new ( & r_object ) counted_t < countable_wrapper_t < std : : vector < std : : pair < datum_string_t , datum_t > > > > ( <nl> copyee . r_object ) ; <nl> } break ; <nl> + case internal_type_t : : BUF_R_ARRAY : / / fallthru <nl> + case internal_type_t : : BUF_R_OBJECT : { <nl> + new ( & buf_ref ) shared_buf_ref_t < char > ( copyee . buf_ref ) ; <nl> + } break ; <nl> default : unreachable ( ) ; <nl> } <nl> } <nl> <nl> void datum_t : : data_wrapper_t : : assign_move ( datum_t : : data_wrapper_t & & movee ) noexcept { <nl> - type = movee . type ; <nl> - switch ( type ) { <nl> - case UNINITIALIZED : / / fallthru <nl> - case R_NULL : break ; <nl> - case R_BOOL : { <nl> + internal_type = movee . internal_type ; <nl> + switch ( internal_type ) { <nl> + case internal_type_t : : UNINITIALIZED : / / fallthru <nl> + case internal_type_t : : R_NULL : break ; <nl> + case internal_type_t : : R_BOOL : { <nl> r_bool = movee . r_bool ; <nl> } break ; <nl> - case R_NUM : { <nl> + case internal_type_t : : R_NUM : { <nl> r_num = movee . r_num ; <nl> } break ; <nl> - case R_BINARY : / / fallthru <nl> - case R_STR : { <nl> + case internal_type_t : : R_BINARY : / / fallthru <nl> + case internal_type_t : : R_STR : { <nl> new ( & r_str ) datum_string_t ( std : : move ( movee . r_str ) ) ; <nl> } break ; <nl> - case R_ARRAY : { <nl> + case internal_type_t : : R_ARRAY : { <nl> new ( & r_array ) counted_t < countable_wrapper_t < std : : vector < datum_t > > > ( <nl> std : : move ( movee . r_array ) ) ; <nl> } break ; <nl> - case R_OBJECT : { <nl> + case internal_type_t : : R_OBJECT : { <nl> new ( & r_object ) counted_t < countable_wrapper_t < std : : vector < std : : pair < datum_string_t , datum_t > > > > ( <nl> std : : move ( movee . r_object ) ) ; <nl> } break ; <nl> + case internal_type_t : : BUF_R_ARRAY : / / fallthru <nl> + case internal_type_t : : BUF_R_OBJECT : { <nl> + new ( & buf_ref ) shared_buf_ref_t < char > ( std : : move ( movee . buf_ref ) ) ; <nl> + } break ; <nl> default : unreachable ( ) ; <nl> } <nl> } <nl> <nl> datum_t : : datum_t ( ) : data ( ) { } <nl> <nl> + datum_t : : datum_t ( type_t type , shared_buf_ref_t < char > & & buf_ref ) <nl> + : data ( type , std : : move ( buf_ref ) ) { } <nl> + <nl> datum_t : : datum_t ( datum_t : : construct_null_t dummy ) : data ( dummy ) { } <nl> <nl> datum_t : : datum_t ( construct_boolean_t dummy , bool _bool ) : data ( dummy , _bool ) { } <nl> std : : vector < std : : pair < datum_string_t , datum_t > > datum_t : : to_sorted_vec ( <nl> return sorted_vec ; <nl> } <nl> <nl> - const std : : vector < std : : pair < datum_string_t , datum_t > > & datum_t : : get_obj_vec ( ) const { <nl> - check_type ( R_OBJECT ) ; <nl> - return * data . r_object ; <nl> - } <nl> - <nl> - const std : : vector < datum_t > & datum_t : : get_arr_vec ( ) const { <nl> - check_type ( R_ARRAY ) ; <nl> - return * data . r_array ; <nl> - } <nl> - <nl> datum_t to_datum_for_client_serialization ( grouped_data_t & & gd , <nl> reql_version_t reql_version , <nl> const configured_limits_t & limits ) { <nl> datum_t : : ~ datum_t ( ) { <nl> } <nl> <nl> bool datum_t : : has ( ) const { <nl> - return data . type ! = UNINITIALIZED ; <nl> + return data . get_type ( ) ! = UNINITIALIZED ; <nl> } <nl> <nl> void datum_t : : reset ( ) { <nl> void datum_t : : check_str_validity ( const datum_string_t & str ) { <nl> : : ql : : check_str_validity ( str . data ( ) , str . size ( ) ) ; <nl> } <nl> <nl> - datum_t : : type_t datum_t : : get_type ( ) const { return data . type ; } <nl> + const shared_buf_ref_t < char > * datum_t : : get_buf_ref ( ) const { <nl> + if ( data . get_internal_type ( ) = = internal_type_t : : BUF_R_ARRAY <nl> + | | data . get_internal_type ( ) = = internal_type_t : : BUF_R_OBJECT ) { <nl> + return & data . buf_ref ; <nl> + } else { <nl> + return NULL ; <nl> + } <nl> + } <nl> + <nl> + datum_t : : type_t datum_t : : get_type ( ) const { return data . get_type ( ) ; } <nl> <nl> bool datum_t : : is_ptype ( ) const { <nl> return get_type ( ) = = R_BINARY | | <nl> void datum_t : : array_to_str_key ( std : : string * str_out ) const { <nl> r_sanity_check ( get_type ( ) = = R_ARRAY ) ; <nl> str_out - > append ( " A " ) ; <nl> <nl> - for ( size_t i = 0 ; i < arr_size ( ) & & str_out - > size ( ) < MAX_KEY_SIZE ; + + i ) { <nl> + const size_t sz = arr_size ( ) ; <nl> + for ( size_t i = 0 ; i < sz & & str_out - > size ( ) < MAX_KEY_SIZE ; + + i ) { <nl> datum_t item = get ( i , NOTHROW ) ; <nl> r_sanity_check ( item . has ( ) ) ; <nl> <nl> - switch ( item - > get_type ( ) ) { <nl> - case R_NUM : item - > num_to_str_key ( str_out ) ; break ; <nl> - case R_STR : item - > str_to_str_key ( str_out ) ; break ; <nl> - case R_BINARY : item - > binary_to_str_key ( str_out ) ; break ; <nl> - case R_BOOL : item - > bool_to_str_key ( str_out ) ; break ; <nl> - case R_ARRAY : item - > array_to_str_key ( str_out ) ; break ; <nl> + switch ( item . get_type ( ) ) { <nl> + case R_NUM : item . num_to_str_key ( str_out ) ; break ; <nl> + case R_STR : item . str_to_str_key ( str_out ) ; break ; <nl> + case R_BINARY : item . binary_to_str_key ( str_out ) ; break ; <nl> + case R_BOOL : item . bool_to_str_key ( str_out ) ; break ; <nl> + case R_ARRAY : item . array_to_str_key ( str_out ) ; break ; <nl> case R_OBJECT : <nl> - if ( item - > is_ptype ( ) ) { <nl> - item - > pt_to_str_key ( str_out ) ; <nl> + if ( item . is_ptype ( ) ) { <nl> + item . pt_to_str_key ( str_out ) ; <nl> break ; <nl> } <nl> / / fallthru <nl> case R_NULL : <nl> - item - > type_error ( <nl> + item . type_error ( <nl> strprintf ( " Array keys can only contain numbers , strings , bools , " <nl> " pseudotypes , or arrays ( got % s of type % s ) . " , <nl> - item - > print ( ) . c_str ( ) , item - > get_type_name ( ) . c_str ( ) ) ) ; <nl> + item . print ( ) . c_str ( ) , item . get_type_name ( ) . c_str ( ) ) ) ; <nl> break ; <nl> case UNINITIALIZED : / / fallthru <nl> default : <nl> void datum_t : : maybe_sanitize_ptype ( const std : : set < std : : string > & allowed_pts ) { <nl> return ; <nl> } <nl> if ( s = = pseudo : : binary_string ) { <nl> + / / Sanitization cannot be performed when loading from a shared buffer . <nl> + r_sanity_check ( data . get_internal_type ( ) = = internal_type_t : : R_OBJECT ) ; <nl> / / Clear the pseudotype data and convert it to binary data <nl> data = data_wrapper_t ( construct_binary_t ( ) , <nl> pseudo : : decode_base64_ptype ( * data . r_object ) ) ; <nl> datum_t datum_t : : drop_literals ( bool * encountered_literal_out ) const { <nl> datum_t val = get_field ( pseudo : : value_key , NOTHROW ) ; <nl> if ( val . has ( ) ) { <nl> bool encountered_literal ; <nl> - val = val - > drop_literals ( & encountered_literal ) ; <nl> + val = val . drop_literals ( & encountered_literal ) ; <nl> / / Nested literals should have been caught on the higher QL levels . <nl> r_sanity_check ( ! encountered_literal ) ; <nl> } <nl> datum_t datum_t : : drop_literals ( bool * encountered_literal_out ) const { <nl> if ( get_type ( ) = = R_OBJECT ) { <nl> datum_object_builder_t builder ; <nl> <nl> - for ( size_t i = 0 ; i < obj_size ( ) ; + + i ) { <nl> + const size_t sz = obj_size ( ) ; <nl> + for ( size_t i = 0 ; i < sz ; + + i ) { <nl> auto pair = unchecked_get_pair ( i ) ; <nl> bool encountered_literal ; <nl> datum_t val = pair . second . drop_literals ( & encountered_literal ) ; <nl> datum_t datum_t : : drop_literals ( bool * encountered_literal_out ) const { <nl> } else if ( get_type ( ) = = R_ARRAY ) { <nl> datum_array_builder_t builder ( limits ) ; <nl> <nl> - for ( size_t i = 0 ; i < arr_size ( ) ; + + i ) { <nl> + const size_t sz = arr_size ( ) ; <nl> + for ( size_t i = 0 ; i < sz ; + + i ) { <nl> bool encountered_literal ; <nl> datum_t val = get ( i ) . drop_literals ( & encountered_literal ) ; <nl> <nl> void datum_t : : rcheck_valid_replace ( datum_t old_val , <nl> pkey . to_std ( ) . c_str ( ) , print ( ) . c_str ( ) ) ) ; <nl> if ( old_val . has ( ) ) { <nl> datum_t old_pk = orig_key ; <nl> - if ( old_val - > get_type ( ) ! = R_NULL ) { <nl> - old_pk = old_val - > get_field ( pkey , NOTHROW ) ; <nl> + if ( old_val . get_type ( ) ! = R_NULL ) { <nl> + old_pk = old_val . get_field ( pkey , NOTHROW ) ; <nl> r_sanity_check ( old_pk . has ( ) ) ; <nl> } <nl> if ( old_pk . has ( ) ) { <nl> - rcheck ( * old_pk = = * pk , base_exc_t : : GENERIC , <nl> + rcheck ( old_pk = = pk , base_exc_t : : GENERIC , <nl> strprintf ( " Primary key ` % s ` cannot be changed ( ` % s ` - > ` % s ` ) . " , <nl> - pkey . to_std ( ) . c_str ( ) , old_val - > print ( ) . c_str ( ) , <nl> + pkey . to_std ( ) . c_str ( ) , old_val . print ( ) . c_str ( ) , <nl> print ( ) . c_str ( ) ) ) ; <nl> } <nl> } else { <nl> const datum_string_t & datum_t : : as_str ( ) const { <nl> <nl> size_t datum_t : : arr_size ( ) const { <nl> check_type ( R_ARRAY ) ; <nl> - return data . r_array - > size ( ) ; <nl> + if ( data . get_internal_type ( ) = = internal_type_t : : BUF_R_ARRAY ) { <nl> + return datum_get_array_size ( data . buf_ref ) ; <nl> + } else { <nl> + r_sanity_check ( data . get_internal_type ( ) = = internal_type_t : : R_ARRAY ) ; <nl> + return data . r_array - > size ( ) ; <nl> + } <nl> } <nl> <nl> datum_t datum_t : : get ( size_t index , throw_bool_t throw_bool ) const { <nl> - / / Calling ` size ( ) ` here also makes sure this this is actually an R_ARRAY . <nl> + / / Calling ` arr_size ( ) ` here also makes sure this this is actually an R_ARRAY . <nl> const size_t array_size = arr_size ( ) ; <nl> if ( index < array_size ) { <nl> return unchecked_get ( index ) ; <nl> datum_t datum_t : : get ( size_t index , throw_bool_t throw_bool ) const { <nl> } <nl> <nl> datum_t datum_t : : unchecked_get ( size_t index ) const { <nl> - return ( * data . r_array ) [ index ] ; <nl> + if ( data . get_internal_type ( ) = = internal_type_t : : BUF_R_ARRAY ) { <nl> + const size_t offset = datum_get_element_offset ( data . buf_ref , index ) ; <nl> + return datum_deserialize_from_buf ( data . buf_ref , offset ) ; <nl> + } else { <nl> + r_sanity_check ( data . get_internal_type ( ) = = internal_type_t : : R_ARRAY ) ; <nl> + return ( * data . r_array ) [ index ] ; <nl> + } <nl> } <nl> <nl> size_t datum_t : : obj_size ( ) const { <nl> check_type ( R_OBJECT ) ; <nl> - return data . r_object - > size ( ) ; <nl> + if ( data . get_internal_type ( ) = = internal_type_t : : BUF_R_OBJECT ) { <nl> + return datum_get_array_size ( data . buf_ref ) ; <nl> + } else { <nl> + r_sanity_check ( data . get_internal_type ( ) = = internal_type_t : : R_OBJECT ) ; <nl> + return data . r_object - > size ( ) ; <nl> + } <nl> } <nl> <nl> std : : pair < datum_string_t , datum_t > datum_t : : get_pair ( size_t index ) const { <nl> - check_type ( R_OBJECT ) ; <nl> + / / Calling ` obj_size ( ) ` here also makes sure this this is actually an R_OBJECT . <nl> guarantee ( index < obj_size ( ) ) ; <nl> return unchecked_get_pair ( index ) ; <nl> } <nl> <nl> std : : pair < datum_string_t , datum_t > datum_t : : unchecked_get_pair ( size_t index ) const { <nl> - return ( * data . r_object ) [ index ] ; <nl> + if ( data . get_internal_type ( ) = = internal_type_t : : BUF_R_OBJECT ) { <nl> + const size_t offset = datum_get_element_offset ( data . buf_ref , index ) ; <nl> + return datum_deserialize_pair_from_buf ( data . buf_ref , offset ) ; <nl> + } else { <nl> + r_sanity_check ( data . get_internal_type ( ) = = internal_type_t : : R_OBJECT ) ; <nl> + return ( * data . r_object ) [ index ] ; <nl> + } <nl> } <nl> <nl> datum_t datum_t : : get_field ( const datum_string_t & key , throw_bool_t throw_bool ) const { <nl> cJSON * datum_t : : as_json_raw ( ) const { <nl> case R_STR : return cJSON_CreateStringN ( as_str ( ) . data ( ) , as_str ( ) . size ( ) ) ; <nl> case R_ARRAY : { <nl> scoped_cJSON_t arr ( cJSON_CreateArray ( ) ) ; <nl> - for ( size_t i = 0 ; i < arr_size ( ) ; + + i ) { <nl> - arr . AddItemToArray ( unchecked_get ( i ) - > as_json_raw ( ) ) ; <nl> + const size_t sz = arr_size ( ) ; <nl> + for ( size_t i = 0 ; i < sz ; + + i ) { <nl> + arr . AddItemToArray ( unchecked_get ( i ) . as_json_raw ( ) ) ; <nl> } <nl> return arr . release ( ) ; <nl> } break ; <nl> case R_OBJECT : { <nl> scoped_cJSON_t obj ( cJSON_CreateObject ( ) ) ; <nl> - for ( auto it = data . r_object - > begin ( ) ; it ! = data . r_object - > end ( ) ; + + it ) { <nl> - obj . AddItemToObject ( it - > first . to_std ( ) . c_str ( ) , it - > second - > as_json_raw ( ) ) ; <nl> + const size_t sz = obj_size ( ) ; <nl> + for ( size_t i = 0 ; i < sz ; + + i ) { <nl> + auto pair = get_pair ( i ) ; <nl> + obj . AddItemToObject ( pair . first . data ( ) , pair . first . size ( ) , <nl> + pair . second . as_json_raw ( ) ) ; <nl> } <nl> return obj . release ( ) ; <nl> } break ; <nl> datum_t : : as_datum_stream ( const protob_t < const Backtrace > & backtrace ) const { <nl> void datum_t : : replace_field ( const datum_string_t & key , datum_t val ) { <nl> check_type ( R_OBJECT ) ; <nl> r_sanity_check ( val . has ( ) ) ; <nl> + / / This function must only be used during sanitization , which is only performed <nl> + / / when not loading from a shared buffer . <nl> + r_sanity_check ( data . get_internal_type ( ) = = internal_type_t : : R_OBJECT ) ; <nl> <nl> auto key_cmp = [ ] ( const std : : pair < datum_string_t , datum_t > & p1 , <nl> const datum_string_t & k2 ) - > bool { <nl> datum_t datum_t : : merge ( const datum_t & rhs ) const { <nl> } <nl> <nl> datum_object_builder_t d ( * this ) ; <nl> - for ( size_t i = 0 ; i < rhs . obj_size ( ) ; + + i ) { <nl> + const size_t rhs_sz = rhs . obj_size ( ) ; <nl> + for ( size_t i = 0 ; i < rhs_sz ; + + i ) { <nl> auto pair = rhs . unchecked_get_pair ( i ) ; <nl> datum_t sub_lhs = d . try_get ( pair . first ) ; <nl> bool is_literal = pair . second . is_ptype ( pseudo : : literal_string ) ; <nl> datum_t datum_t : : merge ( const datum_t & rhs ) const { <nl> / / Since nested literal keywords are forbidden , this should be a no - op <nl> / / if ` is_literal = = true ` . <nl> bool encountered_literal ; <nl> - val = val - > drop_literals ( & encountered_literal ) ; <nl> + val = val . drop_literals ( & encountered_literal ) ; <nl> r_sanity_check ( ! encountered_literal | | ! is_literal ) ; <nl> } <nl> if ( val . has ( ) ) { <nl> datum_t datum_t : : merge ( const datum_t & rhs , <nl> const configured_limits_t & limits , <nl> std : : set < std : : string > * conditions_out ) const { <nl> datum_object_builder_t d ( * this ) ; <nl> - for ( size_t i = 0 ; i < rhs . obj_size ( ) ; + + i ) { <nl> + const size_t rhs_sz = rhs . obj_size ( ) ; <nl> + for ( size_t i = 0 ; i < rhs_sz ; + + i ) { <nl> auto pair = rhs . unchecked_get_pair ( i ) ; <nl> datum_t left = get_field ( pair . first , NOTHROW ) ; <nl> if ( left . has ( ) ) { <nl> int datum_t : : v1_13_cmp ( const datum_t & rhs ) const { <nl> case R_STR : return as_str ( ) . compare ( rhs . as_str ( ) ) ; <nl> case R_ARRAY : { <nl> size_t i ; <nl> - for ( i = 0 ; i < arr_size ( ) ; + + i ) { <nl> - if ( i > = rhs . arr_size ( ) ) return 1 ; <nl> + const size_t sz = arr_size ( ) ; <nl> + const size_t rhs_sz = rhs . arr_size ( ) ; <nl> + for ( i = 0 ; i < sz ; + + i ) { <nl> + if ( i > = rhs_sz ) return 1 ; <nl> int cmpval = unchecked_get ( i ) . v1_13_cmp ( rhs . unchecked_get ( i ) ) ; <nl> if ( cmpval ! = 0 ) return cmpval ; <nl> } <nl> - guarantee ( i < = rhs . arr_size ( ) ) ; <nl> - return i = = rhs . arr_size ( ) ? 0 : - 1 ; <nl> + guarantee ( i < = rhs_sz ) ; <nl> + return i = = rhs_sz ? 0 : - 1 ; <nl> } unreachable ( ) ; <nl> case R_OBJECT : { <nl> if ( is_ptype ( ) & & ! pseudo_compares_as_obj ( ) ) { <nl> int datum_t : : v1_13_cmp ( const datum_t & rhs ) const { <nl> } else { <nl> size_t i = 0 ; <nl> size_t i2 = 0 ; <nl> - while ( i < obj_size ( ) & & i2 < rhs . obj_size ( ) ) { <nl> + const size_t sz = obj_size ( ) ; <nl> + const size_t rhs_sz = rhs . obj_size ( ) ; <nl> + while ( i < sz & & i2 < rhs_sz ) { <nl> auto pair = unchecked_get_pair ( i ) ; <nl> auto pair2 = rhs . unchecked_get_pair ( i2 ) ; <nl> int key_cmpval = pair . first . compare ( pair2 . first ) ; <nl> int datum_t : : v1_13_cmp ( const datum_t & rhs ) const { <nl> + + i ; <nl> + + i2 ; <nl> } <nl> - if ( i ! = obj_size ( ) ) return 1 ; <nl> - if ( i2 ! = rhs . obj_size ( ) ) return - 1 ; <nl> + if ( i ! = sz ) return 1 ; <nl> + if ( i2 ! = rhs_sz ) return - 1 ; <nl> return 0 ; <nl> } <nl> } unreachable ( ) ; <nl> int datum_t : : modern_cmp ( const datum_t & rhs ) const { <nl> case R_STR : return as_str ( ) . compare ( rhs . as_str ( ) ) ; <nl> case R_ARRAY : { <nl> size_t i ; <nl> - for ( i = 0 ; i < arr_size ( ) ; + + i ) { <nl> - if ( i > = rhs . arr_size ( ) ) return 1 ; <nl> + const size_t sz = arr_size ( ) ; <nl> + const size_t rhs_sz = rhs . arr_size ( ) ; <nl> + for ( i = 0 ; i < sz ; + + i ) { <nl> + if ( i > = rhs_sz ) return 1 ; <nl> int cmpval = unchecked_get ( i ) . modern_cmp ( rhs . unchecked_get ( i ) ) ; <nl> if ( cmpval ! = 0 ) return cmpval ; <nl> } <nl> - guarantee ( i < = rhs . arr_size ( ) ) ; <nl> - return i = = rhs . arr_size ( ) ? 0 : - 1 ; <nl> + guarantee ( i < = rhs_sz ) ; <nl> + return i = = rhs_sz ? 0 : - 1 ; <nl> } unreachable ( ) ; <nl> case R_OBJECT : { <nl> size_t i = 0 ; <nl> size_t i2 = 0 ; <nl> - while ( i < obj_size ( ) & & i2 < rhs . obj_size ( ) ) { <nl> + const size_t sz = obj_size ( ) ; <nl> + const size_t rhs_sz = rhs . obj_size ( ) ; <nl> + while ( i < sz & & i2 < rhs_sz ) { <nl> auto pair = unchecked_get_pair ( i ) ; <nl> auto pair2 = rhs . unchecked_get_pair ( i2 ) ; <nl> int key_cmpval = pair . first . compare ( pair2 . first ) ; <nl> int datum_t : : modern_cmp ( const datum_t & rhs ) const { <nl> + + i ; <nl> + + i2 ; <nl> } <nl> - if ( i ! = obj_size ( ) ) return 1 ; <nl> - if ( i2 ! = rhs . obj_size ( ) ) return - 1 ; <nl> + if ( i ! = sz ) return 1 ; <nl> + if ( i2 ! = rhs_sz ) return - 1 ; <nl> return 0 ; <nl> } unreachable ( ) ; <nl> case R_BINARY : / / This should be handled by the ptype code above <nl> void datum_t : : write_to_protobuf ( Datum * d , use_json_t use_json ) const { <nl> } break ; <nl> case R_ARRAY : { <nl> d - > set_type ( Datum : : R_ARRAY ) ; <nl> - for ( size_t i = 0 ; i < data . r_array - > size ( ) ; + + i ) { <nl> - ( * data . r_array ) [ i ] - > write_to_protobuf ( d - > add_r_array ( ) , use_json ) ; <nl> + const size_t sz = arr_size ( ) ; <nl> + for ( size_t i = 0 ; i < sz ; + + i ) { <nl> + get ( i ) . write_to_protobuf ( d - > add_r_array ( ) , use_json ) ; <nl> } <nl> } break ; <nl> case R_OBJECT : { <nl> d - > set_type ( Datum : : R_OBJECT ) ; <nl> - / / We use rbegin and rend so that things print the way we expect . <nl> - for ( auto it = data . r_object - > rbegin ( ) ; it ! = data . r_object - > rend ( ) ; + + it ) { <nl> + / / We use the opposite order so that things print the way we expect . <nl> + for ( size_t i = obj_size ( ) ; i > 0 ; - - i ) { <nl> Datum_AssocPair * ap = d - > add_r_object ( ) ; <nl> - ap - > set_key ( it - > first . to_std ( ) ) ; <nl> - it - > second - > write_to_protobuf ( ap - > mutable_val ( ) , use_json ) ; <nl> + auto pair = get_pair ( i - 1 ) ; <nl> + ap - > set_key ( pair . first . data ( ) , pair . first . size ( ) ) ; <nl> + pair . second . write_to_protobuf ( ap - > mutable_val ( ) , use_json ) ; <nl> } <nl> } break ; <nl> case UNINITIALIZED : / / fallthru <nl> datum_t stats_merge ( UNUSED const datum_string_t & key , <nl> datum_t r , <nl> const configured_limits_t & limits , <nl> std : : set < std : : string > * conditions ) { <nl> - if ( l - > get_type ( ) = = datum_t : : R_NUM & & r - > get_type ( ) = = datum_t : : R_NUM ) { <nl> - return datum_t ( l - > as_num ( ) + r - > as_num ( ) ) ; <nl> - } else if ( l - > get_type ( ) = = datum_t : : R_ARRAY & & r - > get_type ( ) = = datum_t : : R_ARRAY ) { <nl> - if ( l - > arr_size ( ) + r - > arr_size ( ) > limits . array_size_limit ( ) ) { <nl> + if ( l . get_type ( ) = = datum_t : : R_NUM & & r . get_type ( ) = = datum_t : : R_NUM ) { <nl> + return datum_t ( l . as_num ( ) + r . as_num ( ) ) ; <nl> + } else if ( l . get_type ( ) = = datum_t : : R_ARRAY & & r . get_type ( ) = = datum_t : : R_ARRAY ) { <nl> + const size_t l_sz = l . arr_size ( ) ; <nl> + const size_t r_sz = r . arr_size ( ) ; <nl> + if ( l_sz + r_sz > limits . array_size_limit ( ) ) { <nl> conditions - > insert ( strprintf ( " Too many changes , array truncated to % ld . " , limits . array_size_limit ( ) ) ) ; <nl> datum_array_builder_t arr ( limits ) ; <nl> size_t so_far = 0 ; <nl> - for ( size_t i = 0 ; i < l - > arr_size ( ) & & so_far < limits . array_size_limit ( ) ; + + i , + + so_far ) { <nl> - arr . add ( l - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < l_sz & & so_far < limits . array_size_limit ( ) ; + + i , + + so_far ) { <nl> + arr . add ( l . get ( i ) ) ; <nl> } <nl> - for ( size_t i = 0 ; i < r - > arr_size ( ) & & so_far < limits . array_size_limit ( ) ; + + i , + + so_far ) { <nl> - arr . add ( r - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < r_sz & & so_far < limits . array_size_limit ( ) ; + + i , + + so_far ) { <nl> + arr . add ( r . get ( i ) ) ; <nl> } <nl> return std : : move ( arr ) . to_datum ( ) ; <nl> } else { <nl> datum_array_builder_t arr ( limits ) ; <nl> - for ( size_t i = 0 ; i < l - > arr_size ( ) ; + + i ) { <nl> - arr . add ( l - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < l_sz ; + + i ) { <nl> + arr . add ( l . get ( i ) ) ; <nl> } <nl> - for ( size_t i = 0 ; i < r - > arr_size ( ) ; + + i ) { <nl> - arr . add ( r - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < r_sz ; + + i ) { <nl> + arr . add ( r . get ( i ) ) ; <nl> } <nl> return std : : move ( arr ) . to_datum ( ) ; <nl> } <nl> datum_t stats_merge ( UNUSED const datum_string_t & key , <nl> <nl> / / Merging a string is left - preferential , which is just a no - op . <nl> rcheck_datum ( <nl> - l - > get_type ( ) = = datum_t : : R_STR & & r - > get_type ( ) = = datum_t : : R_STR , <nl> + l . get_type ( ) = = datum_t : : R_STR & & r . get_type ( ) = = datum_t : : R_STR , <nl> base_exc_t : : GENERIC , <nl> strprintf ( " Cannot merge statistics ` % s ` ( type % s ) and ` % s ` ( type % s ) . " , <nl> - l - > trunc_print ( ) . c_str ( ) , l - > get_type_name ( ) . c_str ( ) , <nl> - r - > trunc_print ( ) . c_str ( ) , r - > get_type_name ( ) . c_str ( ) ) ) ; <nl> + l . trunc_print ( ) . c_str ( ) , l . get_type_name ( ) . c_str ( ) , <nl> + r . trunc_print ( ) . c_str ( ) , r . get_type_name ( ) . c_str ( ) ) ) ; <nl> return l ; <nl> } <nl> <nl> datum_object_builder_t : : datum_object_builder_t ( const datum_t & copy_from ) { <nl> - for ( size_t i = 0 ; i < copy_from . obj_size ( ) ; + + i ) { <nl> + const size_t copy_from_sz = copy_from . obj_size ( ) ; <nl> + for ( size_t i = 0 ; i < copy_from_sz ; + + i ) { <nl> map . insert ( copy_from . get_pair ( i ) ) ; <nl> } <nl> } <nl> void datum_object_builder_t : : add_warning ( const char * msg , const configured_limit <nl> datum_t * warnings_entry = & map [ warnings_field ] ; <nl> if ( warnings_entry - > has ( ) ) { <nl> / / assume here that the warnings array will " always " be small . <nl> - for ( size_t i = 0 ; i < warnings_entry - > arr_size ( ) ; + + i ) { <nl> + const size_t warnings_entry_sz = warnings_entry - > arr_size ( ) ; <nl> + for ( size_t i = 0 ; i < warnings_entry_sz ; + + i ) { <nl> if ( warnings_entry - > get ( i ) . as_str ( ) = = msg ) return ; <nl> } <nl> - rcheck_datum ( warnings_entry - > arr_size ( ) + 1 < = limits . array_size_limit ( ) , <nl> + rcheck_datum ( warnings_entry_sz + 1 < = limits . array_size_limit ( ) , <nl> base_exc_t : : GENERIC , <nl> strprintf ( " Warnings would exceed array size limit % zu ; increase it to see warnings " , limits . array_size_limit ( ) ) ) ; <nl> datum_array_builder_t out ( * warnings_entry , limits ) ; <nl> void datum_object_builder_t : : add_warnings ( const std : : set < std : : string > & msgs , con <nl> for ( auto const & msg : msgs ) { <nl> bool seen = false ; <nl> / / assume here that the warnings array will " always " be small . <nl> - for ( size_t i = 0 ; i < warnings_entry - > arr_size ( ) ; + + i ) { <nl> + const size_t warnings_entry_sz = warnings_entry - > arr_size ( ) ; <nl> + for ( size_t i = 0 ; i < warnings_entry_sz ; + + i ) { <nl> if ( warnings_entry - > get ( i ) . as_str ( ) = = msg . c_str ( ) ) { <nl> seen = true ; <nl> break ; <nl> void datum_object_builder_t : : add_error ( const char * msg ) { <nl> / / Insert or update the " errors " entry . <nl> { <nl> datum_t * errors_entry = & map [ errors_field ] ; <nl> - double ecount = ( errors_entry - > has ( ) ? ( * errors_entry ) - > as_num ( ) : 0 ) + 1 ; <nl> + double ecount = ( errors_entry - > has ( ) ? ( * errors_entry ) . as_num ( ) : 0 ) + 1 ; <nl> * errors_entry = datum_t ( ecount ) ; <nl> } <nl> <nl> datum_t datum_object_builder_t : : to_datum ( <nl> datum_array_builder_t : : datum_array_builder_t ( const datum_t & copy_from , <nl> const configured_limits_t & _limits ) <nl> : limits ( _limits ) { <nl> - vector . reserve ( copy_from . arr_size ( ) ) ; <nl> - for ( size_t i = 0 ; i < copy_from . arr_size ( ) ; + + i ) { <nl> + const size_t copy_from_sz = copy_from . arr_size ( ) ; <nl> + vector . reserve ( copy_from_sz ) ; <nl> + for ( size_t i = 0 ; i < copy_from_sz ; + + i ) { <nl> vector . push_back ( copy_from . get ( i ) ) ; <nl> } <nl> rcheck_array_size_datum ( vector , limits , base_exc_t : : GENERIC ) ; <nl> void datum_array_builder_t : : splice ( reql_version_t reql_version , size_t index , <nl> / / First copy the values into a vector so vector . insert ( ) can know the number <nl> / / of elements being inserted . <nl> std : : vector < datum_t > arr ; <nl> - arr . reserve ( values . arr_size ( ) ) ; <nl> - for ( size_t i = 0 ; i < values . arr_size ( ) ; + + i ) { <nl> + const size_t values_sz = values . arr_size ( ) ; <nl> + arr . reserve ( values_sz ) ; <nl> + for ( size_t i = 0 ; i < values_sz ; + + i ) { <nl> arr . push_back ( values . get ( i ) ) ; <nl> } <nl> vector . insert ( vector . begin ( ) + index , <nl> mmm a / src / rdb_protocol / datum . hpp <nl> ppp b / src / rdb_protocol / datum . hpp <nl> class grouped_data_t ; <nl> / / A ` datum_t ` is basically a JSON value , with some special handling for <nl> / / ReQL pseudo - types . <nl> class datum_t { <nl> + private : <nl> + / / Placed here so it ' s kept in sync with type_t . All enum values from <nl> + / / type_t must appear in here . <nl> + enum class internal_type_t { <nl> + UNINITIALIZED , <nl> + R_ARRAY , <nl> + R_BINARY , <nl> + R_BOOL , <nl> + R_NULL , <nl> + R_NUM , <nl> + R_OBJECT , <nl> + R_STR , <nl> + BUF_R_ARRAY , <nl> + BUF_R_OBJECT <nl> + } ; <nl> public : <nl> / / This ordering is important , because we use it to sort objects of <nl> / / disparate type . It should be alphabetical . <nl> class datum_t { <nl> / / counted_t < const datum_t > <nl> datum_t ( ) ; <nl> <nl> + / / Construct a datum_t from a shared buffer . <nl> + / / type can be one of R_BINARY , R_STR , R_OBJECT or R_ARRAY . _buf_ref must point <nl> + / / to the data buffer * without * the serialized type tag , but * with * the <nl> + / / prefixed serialized size . <nl> + datum_t ( type_t type , shared_buf_ref_t < char > & & buf_ref ) ; <nl> + <nl> / / Strongly prefer datum_t : : null ( ) . <nl> enum class construct_null_t { } ; <nl> explicit datum_t ( construct_null_t ) ; <nl> class datum_t { <nl> <nl> ~ datum_t ( ) ; <nl> <nl> - / / Interface to mimic counted_t , to ease transition from counted_t < const datum_t > <nl> - / / TODO : Phase these out . <nl> + / / has ( ) checks whether a datum is uninitialized . reset ( ) makes any datum <nl> + / / uninitialized . <nl> bool has ( ) const ; <nl> void reset ( ) ; <nl> - datum_t * operator - > ( ) { return this ; } <nl> - const datum_t * operator - > ( ) const { return this ; } <nl> - datum_t & operator * ( ) { return * this ; } <nl> - const datum_t & operator * ( ) const { return * this ; } <nl> - operator bool ( ) const { return has ( ) ; } <nl> <nl> void write_to_protobuf ( Datum * out , use_json_t use_json ) const ; <nl> <nl> class datum_t { <nl> <nl> static void check_str_validity ( const datum_string_t & str ) ; <nl> <nl> + / / Used by serialization code . Returns a pointer to the buf_ref , if <nl> + / / the datum is currently backed by one , or NULL otherwise . <nl> + const shared_buf_ref_t < char > * get_buf_ref ( ) const ; <nl> + <nl> private : <nl> friend void pseudo : : sanitize_time ( datum_t * time ) ; <nl> / / Must only be used during pseudo type sanitization . <nl> / / The key must already exist . <nl> void replace_field ( const datum_string_t & key , datum_t val ) ; <nl> <nl> - friend size_t datum_serialized_size ( const datum_t & ) ; <nl> - friend serialization_result_t datum_serialize ( write_message_t * , const datum_t & ) ; <nl> - const std : : vector < std : : pair < datum_string_t , datum_t > > & get_obj_vec ( ) const ; <nl> - const std : : vector < datum_t > & get_arr_vec ( ) const ; <nl> - <nl> static std : : vector < std : : pair < datum_string_t , datum_t > > to_sorted_vec ( <nl> std : : map < datum_string_t , datum_t > & & map ) ; <nl> <nl> class datum_t { <nl> explicit data_wrapper_t ( std : : vector < datum_t > & & array ) ; <nl> explicit data_wrapper_t ( <nl> std : : vector < std : : pair < datum_string_t , datum_t > > & & object ) ; <nl> + data_wrapper_t ( type_t type , shared_buf_ref_t < char > & & _buf_ref ) ; <nl> <nl> ~ data_wrapper_t ( ) ; <nl> <nl> - type_t type ; <nl> + type_t get_type ( ) const ; <nl> + internal_type_t get_internal_type ( ) const ; <nl> + <nl> union { <nl> bool r_bool ; <nl> double r_num ; <nl> class datum_t { <nl> counted_t < countable_wrapper_t < std : : vector < datum_t > > > r_array ; <nl> counted_t < countable_wrapper_t < std : : vector < / / NOLINT ( whitespace / operators ) <nl> std : : pair < datum_string_t , datum_t > > > > r_object ; <nl> + shared_buf_ref_t < char > buf_ref ; <nl> } ; <nl> private : <nl> void assign_copy ( const data_wrapper_t & copyee ) ; <nl> void assign_move ( data_wrapper_t & & movee ) noexcept ; <nl> void destruct ( ) ; <nl> + <nl> + internal_type_t internal_type ; <nl> } data ; <nl> <nl> public : <nl> mmm a / src / rdb_protocol / datum_stream . cc <nl> ppp b / src / rdb_protocol / datum_stream . cc <nl> T groups_to_batch ( std : : map < datum_t , T , optional_datum_less_t > * g ) { <nl> <nl> <nl> / / RANGE / READGEN STUFF <nl> - reader_t : : reader_t ( <nl> + rget_response_reader_t : : rget_response_reader_t ( <nl> const real_table_t & _table , <nl> bool _use_outdated , <nl> scoped_ptr_t < readgen_t > & & _readgen ) <nl> reader_t : : reader_t ( <nl> active_range ( readgen - > original_keyrange ( ) ) , <nl> items_index ( 0 ) { } <nl> <nl> - void reader_t : : add_transformation ( transform_variant_t & & tv ) { <nl> + void rget_response_reader_t : : add_transformation ( transform_variant_t & & tv ) { <nl> r_sanity_check ( ! started ) ; <nl> transforms . push_back ( std : : move ( tv ) ) ; <nl> } <nl> <nl> - void reader_t : : accumulate ( env_t * env , eager_acc_t * acc , const terminal_variant_t & tv ) { <nl> + void rget_response_reader_t : : accumulate ( env_t * env , eager_acc_t * acc , <nl> + const terminal_variant_t & tv ) { <nl> r_sanity_check ( ! started ) ; <nl> started = shards_exhausted = true ; <nl> batchspec_t batchspec = batchspec_t : : user ( batch_type_t : : TERMINAL , env ) ; <nl> void reader_t : : accumulate ( env_t * env , eager_acc_t * acc , const terminal_variant_t <nl> acc - > add_res ( env , & res ) ; <nl> } <nl> <nl> - void reader_t : : accumulate_all ( env_t * env , eager_acc_t * acc ) { <nl> - r_sanity_check ( ! started ) ; <nl> + std : : vector < datum_t > rget_response_reader_t : : next_batch ( env_t * env , <nl> + const batchspec_t & batchspec ) { <nl> started = true ; <nl> - batchspec_t batchspec = batchspec_t : : all ( ) ; <nl> - read_t read = readgen - > next_read ( active_range , transforms , batchspec ) ; <nl> - rget_read_response_t resp = do_read ( env , std : : move ( read ) ) ; <nl> + if ( ! load_items ( env , batchspec ) ) { <nl> + return std : : vector < datum_t > ( ) ; <nl> + } <nl> + r_sanity_check ( items_index < items . size ( ) ) ; <nl> <nl> - auto rr = boost : : get < rget_read_t > ( & read . read ) ; <nl> - auto final_key = ! reversed ( rr - > sorting ) ? store_key_t : : max ( ) : store_key_t : : min ( ) ; <nl> - r_sanity_check ( resp . last_key = = final_key ) ; <nl> - r_sanity_check ( ! resp . truncated ) ; <nl> - shards_exhausted = true ; <nl> + std : : vector < datum_t > res ; <nl> + switch ( batchspec . get_batch_type ( ) ) { <nl> + case batch_type_t : : NORMAL : / / fallthru <nl> + case batch_type_t : : NORMAL_FIRST : / / fallthru <nl> + case batch_type_t : : TERMINAL : { <nl> + res . reserve ( items . size ( ) - items_index ) ; <nl> + for ( ; items_index < items . size ( ) ; + + items_index ) { <nl> + res . push_back ( std : : move ( items [ items_index ] . data ) ) ; <nl> + } <nl> + } break ; <nl> + case batch_type_t : : SINDEX_CONSTANT : { <nl> + ql : : datum_t sindex = std : : move ( items [ items_index ] . sindex_key ) ; <nl> + store_key_t key = std : : move ( items [ items_index ] . key ) ; <nl> + res . push_back ( std : : move ( items [ items_index ] . data ) ) ; <nl> + items_index + = 1 ; <nl> <nl> - acc - > add_res ( env , & resp . result ) ; <nl> + bool maybe_more_with_sindex = true ; <nl> + while ( maybe_more_with_sindex ) { <nl> + for ( ; items_index < items . size ( ) ; + + items_index ) { <nl> + if ( sindex . has ( ) ) { <nl> + r_sanity_check ( items [ items_index ] . sindex_key . has ( ) ) ; <nl> + if ( items [ items_index ] . sindex_key ! = sindex ) { <nl> + break ; / / batch is done <nl> + } <nl> + } else { <nl> + r_sanity_check ( ! items [ items_index ] . sindex_key . has ( ) ) ; <nl> + if ( items [ items_index ] . key ! = key ) { <nl> + break ; <nl> + } <nl> + } <nl> + res . push_back ( std : : move ( items [ items_index ] . data ) ) ; <nl> + <nl> + rcheck_datum ( <nl> + res . size ( ) < = env - > limits ( ) . array_size_limit ( ) , base_exc_t : : GENERIC , <nl> + strprintf ( " Too many rows ( > % zu ) with the same value " <nl> + " for index ` % s ` : \ n % s " , <nl> + env - > limits ( ) . array_size_limit ( ) , <nl> + readgen - > sindex_name ( ) . c_str ( ) , <nl> + / / This is safe because you can ' t have duplicate <nl> + / / primary keys , so they will never exceed the <nl> + / / array limit . <nl> + sindex . trunc_print ( ) . c_str ( ) ) ) ; <nl> + } <nl> + if ( items_index > = items . size ( ) ) { <nl> + / / If we consumed the whole batch without finding a new sindex , <nl> + / / we might have more rows with the same sindex in the next <nl> + / / batch , which we promptly load . <nl> + maybe_more_with_sindex = load_items ( env , batchspec ) ; <nl> + } else { <nl> + maybe_more_with_sindex = false ; <nl> + } <nl> + } <nl> + } break ; <nl> + default : unreachable ( ) ; <nl> + } <nl> + <nl> + if ( items_index > = items . size ( ) ) { / / free memory immediately <nl> + items_index = 0 ; <nl> + std : : vector < rget_item_t > tmp ; <nl> + tmp . swap ( items ) ; <nl> + } <nl> + <nl> + shards_exhausted = ( res . size ( ) = = 0 ) ? true : shards_exhausted ; <nl> + return res ; <nl> } <nl> <nl> - rget_read_response_t reader_t : : do_read ( env_t * env , const read_t & read ) { <nl> + bool rget_response_reader_t : : is_finished ( ) const { <nl> + return shards_exhausted & & items_index > = items . size ( ) ; <nl> + } <nl> + <nl> + rget_read_response_t rget_response_reader_t : : do_read ( env_t * env , const read_t & read ) { <nl> read_response_t res ; <nl> table . read_with_profile ( env , read , & res , use_outdated ) ; <nl> auto rget_res = boost : : get < rget_read_response_t > ( & res . response ) ; <nl> rget_read_response_t reader_t : : do_read ( env_t * env , const read_t & read ) { <nl> return std : : move ( * rget_res ) ; <nl> } <nl> <nl> - std : : vector < rget_item_t > reader_t : : do_range_read ( <nl> + rget_reader_t : : rget_reader_t ( <nl> + const real_table_t & _table , <nl> + bool _use_outdated , <nl> + scoped_ptr_t < readgen_t > & & _readgen ) <nl> + : rget_response_reader_t ( _table , _use_outdated , std : : move ( _readgen ) ) { } <nl> + <nl> + void rget_reader_t : : accumulate_all ( env_t * env , eager_acc_t * acc ) { <nl> + r_sanity_check ( ! started ) ; <nl> + started = true ; <nl> + batchspec_t batchspec = batchspec_t : : all ( ) ; <nl> + read_t read = readgen - > next_read ( active_range , transforms , batchspec ) ; <nl> + rget_read_response_t resp = do_read ( env , std : : move ( read ) ) ; <nl> + <nl> + auto rr = boost : : get < rget_read_t > ( & read . read ) ; <nl> + auto final_key = ! reversed ( rr - > sorting ) ? store_key_t : : max ( ) : store_key_t : : min ( ) ; <nl> + r_sanity_check ( resp . last_key = = final_key ) ; <nl> + r_sanity_check ( ! resp . truncated ) ; <nl> + shards_exhausted = true ; <nl> + <nl> + acc - > add_res ( env , & resp . result ) ; <nl> + } <nl> + <nl> + std : : vector < rget_item_t > rget_reader_t : : do_range_read ( <nl> env_t * env , const read_t & read ) { <nl> rget_read_response_t res = do_read ( env , read ) ; <nl> <nl> - / / It ' s called ` do_range_read ` . If we have more than one type of range <nl> - / / read ( which we might ; rget_read_t should arguably be two types ) , this <nl> - / / will have to be a visitor . <nl> auto rr = boost : : get < rget_read_t > ( & read . read ) ; <nl> r_sanity_check ( rr ) ; <nl> const key_range_t & rng = rr - > sindex ? rr - > sindex - > region . inner : rr - > region . inner ; <nl> std : : vector < rget_item_t > reader_t : : do_range_read ( <nl> return groups_to_batch ( gs - > get_underlying_map ( grouped : : order_doesnt_matter_t ( ) ) ) ; <nl> } <nl> <nl> - bool reader_t : : load_items ( env_t * env , const batchspec_t & batchspec ) { <nl> + bool rget_reader_t : : load_items ( env_t * env , const batchspec_t & batchspec ) { <nl> started = true ; <nl> if ( items_index > = items . size ( ) & & ! shards_exhausted ) { / / read some more <nl> items_index = 0 ; <nl> bool reader_t : : load_items ( env_t * env , const batchspec_t & batchspec ) { <nl> " Truncated key : \ n % s " , <nl> env - > limits ( ) . array_size_limit ( ) , <nl> readgen - > sindex_name ( ) . c_str ( ) , <nl> - items [ items . size ( ) - 1 ] . sindex_key - > trunc_print ( ) . c_str ( ) , <nl> + items [ items . size ( ) - 1 ] . sindex_key . trunc_print ( ) . c_str ( ) , <nl> key_to_debug_str ( items [ items . size ( ) - 1 ] . key ) . c_str ( ) ) ) ; <nl> <nl> items . reserve ( items . size ( ) + new_items . size ( ) ) ; <nl> bool reader_t : : load_items ( env_t * env , const batchspec_t & batchspec ) { <nl> return items_index < items . size ( ) ; <nl> } <nl> <nl> - std : : vector < datum_t > <nl> - reader_t : : next_batch ( env_t * env , const batchspec_t & batchspec ) { <nl> + intersecting_reader_t : : intersecting_reader_t ( <nl> + const real_table_t & _table , <nl> + bool _use_outdated , <nl> + scoped_ptr_t < readgen_t > & & _readgen ) <nl> + : rget_response_reader_t ( _table , _use_outdated , std : : move ( _readgen ) ) { } <nl> + <nl> + void intersecting_reader_t : : accumulate_all ( env_t * env , eager_acc_t * acc ) { <nl> + r_sanity_check ( ! started ) ; <nl> started = true ; <nl> - if ( ! load_items ( env , batchspec ) ) { <nl> - return std : : vector < datum_t > ( ) ; <nl> - } <nl> - r_sanity_check ( items_index < items . size ( ) ) ; <nl> + batchspec_t batchspec = batchspec_t : : all ( ) ; <nl> + read_t read = readgen - > next_read ( active_range , transforms , batchspec ) ; <nl> + rget_read_response_t resp = do_read ( env , std : : move ( read ) ) ; <nl> <nl> - std : : vector < datum_t > res ; <nl> - switch ( batchspec . get_batch_type ( ) ) { <nl> - case batch_type_t : : NORMAL : / / fallthru <nl> - case batch_type_t : : NORMAL_FIRST : / / fallthru <nl> - case batch_type_t : : TERMINAL : { <nl> - res . reserve ( items . size ( ) - items_index ) ; <nl> - for ( ; items_index < items . size ( ) ; + + items_index ) { <nl> - res . push_back ( std : : move ( items [ items_index ] . data ) ) ; <nl> - } <nl> - } break ; <nl> - case batch_type_t : : SINDEX_CONSTANT : { <nl> - ql : : datum_t sindex = std : : move ( items [ items_index ] . sindex_key ) ; <nl> - store_key_t key = std : : move ( items [ items_index ] . key ) ; <nl> - res . push_back ( std : : move ( items [ items_index ] . data ) ) ; <nl> - items_index + = 1 ; <nl> + auto final_key = store_key_t : : max ( ) ; <nl> + r_sanity_check ( resp . last_key = = final_key ) ; <nl> + r_sanity_check ( ! resp . truncated ) ; <nl> + shards_exhausted = true ; <nl> <nl> - bool maybe_more_with_sindex = true ; <nl> - while ( maybe_more_with_sindex ) { <nl> - for ( ; items_index < items . size ( ) ; + + items_index ) { <nl> - if ( sindex . has ( ) ) { <nl> - r_sanity_check ( items [ items_index ] . sindex_key . has ( ) ) ; <nl> - if ( * items [ items_index ] . sindex_key ! = * sindex ) { <nl> - break ; / / batch is done <nl> - } <nl> - } else { <nl> - r_sanity_check ( ! items [ items_index ] . sindex_key . has ( ) ) ; <nl> - if ( items [ items_index ] . key ! = key ) { <nl> - break ; <nl> + acc - > add_res ( env , & resp . result ) ; <nl> + } <nl> + <nl> + bool intersecting_reader_t : : load_items ( env_t * env , const batchspec_t & batchspec ) { <nl> + started = true ; <nl> + while ( items_index > = items . size ( ) & & ! shards_exhausted ) { / / read some more <nl> + std : : vector < rget_item_t > unfiltered_items = do_intersecting_read ( <nl> + env , readgen - > next_read ( active_range , transforms , batchspec ) ) ; <nl> + if ( unfiltered_items . empty ( ) ) { <nl> + shards_exhausted = true ; <nl> + } else { <nl> + items_index = 0 ; <nl> + items . clear ( ) ; <nl> + items . reserve ( unfiltered_items . size ( ) ) ; <nl> + for ( size_t i = 0 ; i < unfiltered_items . size ( ) ; + + i ) { <nl> + r_sanity_check ( unfiltered_items [ i ] . key . size ( ) > 0 ) ; <nl> + store_key_t pkey ( ql : : datum_t : : extract_primary ( unfiltered_items [ i ] . key ) ) ; <nl> + if ( processed_pkeys . count ( pkey ) = = 0 ) { <nl> + if ( processed_pkeys . size ( ) > = env - > limits ( ) . array_size_limit ( ) ) { <nl> + throw ql : : exc_t ( ql : : base_exc_t : : GENERIC , <nl> + " Array size limit exceeded during geospatial index " <nl> + " traversal . " , NULL ) ; <nl> } <nl> + processed_pkeys . insert ( pkey ) ; <nl> + items . push_back ( std : : move ( unfiltered_items [ i ] ) ) ; <nl> } <nl> - res . push_back ( std : : move ( items [ items_index ] . data ) ) ; <nl> - <nl> - rcheck_datum ( <nl> - res . size ( ) < = env - > limits ( ) . array_size_limit ( ) , base_exc_t : : GENERIC , <nl> - strprintf ( " Too many rows ( > % zu ) with the same value " <nl> - " for index ` % s ` : \ n % s " , <nl> - env - > limits ( ) . array_size_limit ( ) , <nl> - readgen - > sindex_name ( ) . c_str ( ) , <nl> - / / This is safe because you can ' t have duplicate <nl> - / / primary keys , so they will never exceed the <nl> - / / array limit . <nl> - sindex - > trunc_print ( ) . c_str ( ) ) ) ; <nl> - } <nl> - if ( items_index > = items . size ( ) ) { <nl> - / / If we consumed the whole batch without finding a new sindex , <nl> - / / we might have more rows with the same sindex in the next <nl> - / / batch , which we promptly load . <nl> - maybe_more_with_sindex = load_items ( env , batchspec ) ; <nl> - } else { <nl> - maybe_more_with_sindex = false ; <nl> } <nl> } <nl> - } break ; <nl> - default : unreachable ( ) ; <nl> } <nl> + return items_index < items . size ( ) ; <nl> + } <nl> <nl> - if ( items_index > = items . size ( ) ) { / / free memory immediately <nl> - items_index = 0 ; <nl> - std : : vector < rget_item_t > tmp ; <nl> - tmp . swap ( items ) ; <nl> + std : : vector < rget_item_t > intersecting_reader_t : : do_intersecting_read ( <nl> + env_t * env , const read_t & read ) { <nl> + rget_read_response_t res = do_read ( env , read ) ; <nl> + <nl> + auto gr = boost : : get < intersecting_geo_read_t > ( & read . read ) ; <nl> + r_sanity_check ( gr ) ; <nl> + const key_range_t & rng = gr - > sindex . region . inner ; <nl> + <nl> + / / We need to do some adjustments to the last considered key so that we <nl> + / / update the range correctly in the case where we ' re reading a subportion <nl> + / / of the total range . <nl> + store_key_t * key = & res . last_key ; <nl> + if ( * key = = store_key_t : : max ( ) ) { <nl> + if ( ! rng . right . unbounded ) { <nl> + * key = rng . right . key ; <nl> + bool b = key - > decrement ( ) ; <nl> + r_sanity_check ( b ) ; <nl> + } <nl> } <nl> <nl> - shards_exhausted = ( res . size ( ) = = 0 ) ? true : shards_exhausted ; <nl> - return res ; <nl> - } <nl> + shards_exhausted = readgen - > update_range ( & active_range , res . last_key ) ; <nl> + grouped_t < stream_t > * gs = boost : : get < grouped_t < stream_t > > ( & res . result ) ; <nl> <nl> - bool reader_t : : is_finished ( ) const { <nl> - return shards_exhausted & & items_index > = items . size ( ) ; <nl> + / / groups_to_batch asserts that underlying_map has 0 or 1 elements , so it is <nl> + / / correct to declare that the order doesn ' t matter . <nl> + return groups_to_batch ( gs - > get_underlying_map ( grouped : : order_doesnt_matter_t ( ) ) ) ; <nl> } <nl> <nl> readgen_t : : readgen_t ( <nl> const std : : map < std : : string , wire_func_t > & _global_optargs , <nl> std : : string _table_name , <nl> - const datum_range_t & _original_datum_range , <nl> profile_bool_t _profile , <nl> sorting_t _sorting ) <nl> : global_optargs ( _global_optargs ) , <nl> table_name ( std : : move ( _table_name ) ) , <nl> - original_datum_range ( _original_datum_range ) , <nl> profile ( _profile ) , <nl> sorting ( _sorting ) { } <nl> <nl> bool readgen_t : : update_range ( key_range_t * active_range , <nl> return active_range - > is_empty ( ) ; <nl> } <nl> <nl> - read_t readgen_t : : next_read ( <nl> + rget_readgen_t : : rget_readgen_t ( <nl> + const std : : map < std : : string , wire_func_t > & _global_optargs , <nl> + std : : string _table_name , <nl> + const datum_range_t & _original_datum_range , <nl> + profile_bool_t _profile , <nl> + sorting_t _sorting ) <nl> + : readgen_t ( _global_optargs , std : : move ( _table_name ) , _profile , _sorting ) , <nl> + original_datum_range ( _original_datum_range ) { } <nl> + <nl> + read_t rget_readgen_t : : next_read ( <nl> const key_range_t & active_range , <nl> const std : : vector < transform_variant_t > & transforms , <nl> const batchspec_t & batchspec ) const { <nl> read_t readgen_t : : next_read ( <nl> } <nl> <nl> / / TODO : this is how we did it before , but it sucks . <nl> - read_t readgen_t : : terminal_read ( <nl> + read_t rget_readgen_t : : terminal_read ( <nl> const std : : vector < transform_variant_t > & transforms , <nl> const terminal_variant_t & _terminal , <nl> const batchspec_t & batchspec ) const { <nl> primary_readgen_t : : primary_readgen_t ( <nl> datum_range_t range , <nl> profile_bool_t profile , <nl> sorting_t sorting ) <nl> - : readgen_t ( global_optargs , std : : move ( table_name ) , range , profile , sorting ) { } <nl> + : rget_readgen_t ( global_optargs , std : : move ( table_name ) , range , profile , sorting ) { } <nl> <nl> scoped_ptr_t < readgen_t > primary_readgen_t : : make ( <nl> env_t * env , <nl> sindex_readgen_t : : sindex_readgen_t ( <nl> datum_range_t range , <nl> profile_bool_t profile , <nl> sorting_t sorting ) <nl> - : readgen_t ( global_optargs , std : : move ( table_name ) , range , profile , sorting ) , <nl> + : rget_readgen_t ( global_optargs , std : : move ( table_name ) , range , profile , sorting ) , <nl> sindex ( _sindex ) { } <nl> <nl> scoped_ptr_t < readgen_t > sindex_readgen_t : : make ( <nl> class sindex_compare_t { <nl> / / v1 . 13 itself . For that , we use the last_key value in the <nl> / / rget_read_response_t . <nl> return reversed ( sorting ) <nl> - ? l . sindex_key - > compare_gt ( reql_version_t : : LATEST , * r . sindex_key ) <nl> - : l . sindex_key - > compare_lt ( reql_version_t : : LATEST , * r . sindex_key ) ; <nl> + ? l . sindex_key . compare_gt ( reql_version_t : : LATEST , r . sindex_key ) <nl> + : l . sindex_key . compare_lt ( reql_version_t : : LATEST , r . sindex_key ) ; <nl> } <nl> private : <nl> sorting_t sorting ; <nl> std : : string sindex_readgen_t : : sindex_name ( ) const { <nl> return sindex ; <nl> } <nl> <nl> + intersecting_readgen_t : : intersecting_readgen_t ( <nl> + const std : : map < std : : string , wire_func_t > & global_optargs , <nl> + std : : string table_name , <nl> + const std : : string & _sindex , <nl> + const datum_t & _query_geometry , <nl> + profile_bool_t profile ) <nl> + : readgen_t ( global_optargs , std : : move ( table_name ) , profile , sorting_t : : UNORDERED ) , <nl> + sindex ( _sindex ) , <nl> + query_geometry ( _query_geometry ) { } <nl> + <nl> + scoped_ptr_t < readgen_t > intersecting_readgen_t : : make ( <nl> + env_t * env , <nl> + std : : string table_name , <nl> + const std : : string & sindex , <nl> + const datum_t & query_geometry ) { <nl> + return scoped_ptr_t < readgen_t > ( <nl> + new intersecting_readgen_t ( <nl> + env - > get_all_optargs ( ) , <nl> + std : : move ( table_name ) , <nl> + sindex , <nl> + query_geometry , <nl> + env - > profile ( ) ) ) ; <nl> + } <nl> + <nl> + read_t intersecting_readgen_t : : next_read ( <nl> + const key_range_t & active_range , <nl> + const std : : vector < transform_variant_t > & transforms , <nl> + const batchspec_t & batchspec ) const { <nl> + return read_t ( next_read_impl ( active_range , transforms , batchspec ) , profile ) ; <nl> + } <nl> + <nl> + read_t intersecting_readgen_t : : terminal_read ( <nl> + const std : : vector < transform_variant_t > & transforms , <nl> + const terminal_variant_t & _terminal , <nl> + const batchspec_t & batchspec ) const { <nl> + intersecting_geo_read_t read = <nl> + next_read_impl ( original_keyrange ( ) , transforms , batchspec ) ; <nl> + read . terminal = _terminal ; <nl> + return read_t ( read , profile ) ; <nl> + } <nl> + <nl> + intersecting_geo_read_t intersecting_readgen_t : : next_read_impl ( <nl> + const key_range_t & active_range , <nl> + const std : : vector < transform_variant_t > & transforms , <nl> + const batchspec_t & batchspec ) const { <nl> + return intersecting_geo_read_t ( <nl> + region_t : : universe ( ) , <nl> + global_optargs , <nl> + table_name , <nl> + batchspec , <nl> + transforms , <nl> + boost : : optional < terminal_variant_t > ( ) , <nl> + sindex_rangespec_t ( sindex , region_t ( active_range ) , datum_range_t : : universe ( ) ) , <nl> + query_geometry ) ; <nl> + } <nl> + <nl> + boost : : optional < read_t > intersecting_readgen_t : : sindex_sort_read ( <nl> + UNUSED const key_range_t & active_range , <nl> + UNUSED const std : : vector < rget_item_t > & items , <nl> + UNUSED const std : : vector < transform_variant_t > & transforms , <nl> + UNUSED const batchspec_t & batchspec ) const { <nl> + / / Intersection queries don ' t support sorting <nl> + return boost : : optional < read_t > ( ) ; <nl> + } <nl> + <nl> + void intersecting_readgen_t : : sindex_sort ( UNUSED std : : vector < rget_item_t > * vec ) const { <nl> + / / No sorting required for intersection queries , since they don ' t <nl> + / / support any specific ordering . <nl> + } <nl> + <nl> + key_range_t intersecting_readgen_t : : original_keyrange ( ) const { <nl> + / / This is always universe for intersection reads . <nl> + / / The real query is in the query geometry . <nl> + return datum_range_t : : universe ( ) . to_sindex_keyrange ( ) ; <nl> + } <nl> + <nl> + std : : string intersecting_readgen_t : : sindex_name ( ) const { <nl> + return sindex ; <nl> + } <nl> + <nl> counted_t < val_t > datum_stream_t : : run_terminal ( <nl> env_t * env , const terminal_variant_t & tv ) { <nl> scoped_ptr_t < eager_acc_t > acc ( make_eager_terminal ( tv ) ) ; <nl> datum_t eager_datum_stream_t : : as_array ( env_t * env ) { <nl> batchspec_t batchspec = batchspec_t : : user ( batch_type_t : : TERMINAL , env ) ; <nl> { <nl> profile : : sampler_t sampler ( " Evaluating stream eagerly . " , env - > trace ) ; <nl> - while ( datum_t d = next ( env , batchspec ) ) { <nl> + datum_t d ; <nl> + while ( d = next ( env , batchspec ) , d . has ( ) ) { <nl> arr . add ( d ) ; <nl> sampler . new_sample ( ) ; <nl> } <nl> datum_t eager_datum_stream_t : : as_array ( env_t * env ) { <nl> <nl> / / LAZY_DATUM_STREAM_T <nl> lazy_datum_stream_t : : lazy_datum_stream_t ( <nl> - const real_table_t & _table , <nl> - bool use_outdated , <nl> - scoped_ptr_t < readgen_t > & & readgen , <nl> + scoped_ptr_t < reader_t > & & _reader , <nl> const protob_t < const Backtrace > & bt_src ) <nl> : datum_stream_t ( bt_src ) , <nl> current_batch_offset ( 0 ) , <nl> - reader ( _table , use_outdated , std : : move ( readgen ) ) { } <nl> + reader ( std : : move ( _reader ) ) { } <nl> <nl> void lazy_datum_stream_t : : add_transformation ( transform_variant_t & & tv , <nl> const protob_t < const Backtrace > & bt ) { <nl> - reader . add_transformation ( std : : move ( tv ) ) ; <nl> + reader - > add_transformation ( std : : move ( tv ) ) ; <nl> update_bt ( bt ) ; <nl> } <nl> <nl> void lazy_datum_stream_t : : accumulate ( <nl> env_t * env , eager_acc_t * acc , const terminal_variant_t & tv ) { <nl> - reader . accumulate ( env , acc , tv ) ; <nl> + reader - > accumulate ( env , acc , tv ) ; <nl> } <nl> <nl> void lazy_datum_stream_t : : accumulate_all ( env_t * env , eager_acc_t * acc ) { <nl> - reader . accumulate_all ( env , acc ) ; <nl> + reader - > accumulate_all ( env , acc ) ; <nl> } <nl> <nl> std : : vector < datum_t > <nl> lazy_datum_stream_t : : next_batch_impl ( env_t * env , const batchspec_t & batchspec ) { <nl> / / Should never mix ` next ` with ` next_batch ` . <nl> r_sanity_check ( current_batch_offset = = 0 & & current_batch . size ( ) = = 0 ) ; <nl> - return reader . next_batch ( env , batchspec ) ; <nl> + return reader - > next_batch ( env , batchspec ) ; <nl> } <nl> <nl> bool lazy_datum_stream_t : : is_exhausted ( ) const { <nl> - return reader . is_finished ( ) & & batch_cache_exhausted ( ) ; <nl> + return reader - > is_finished ( ) & & batch_cache_exhausted ( ) ; <nl> } <nl> bool lazy_datum_stream_t : : is_cfeed ( ) const { <nl> return false ; <nl> datum_t array_datum_stream_t : : next ( env_t * env , const batchspec_t & bs ) { <nl> return ops_to_do ( ) ? datum_stream_t : : next ( env , bs ) : next_arr_el ( ) ; <nl> } <nl> datum_t array_datum_stream_t : : next_arr_el ( ) { <nl> - return index < arr - > arr_size ( ) ? arr - > get ( index + + ) : datum_t ( ) ; <nl> + return index < arr . arr_size ( ) ? arr . get ( index + + ) : datum_t ( ) ; <nl> } <nl> <nl> bool array_datum_stream_t : : is_exhausted ( ) const { <nl> - return index > = arr - > arr_size ( ) ; <nl> + return index > = arr . arr_size ( ) ; <nl> } <nl> bool array_datum_stream_t : : is_cfeed ( ) const { <nl> return false ; <nl> array_datum_stream_t : : next_raw_batch ( env_t * env , const batchspec_t & batchspec ) { <nl> batcher_t batcher = batchspec . to_batcher ( ) ; <nl> <nl> profile : : sampler_t sampler ( " Fetching array elements . " , env - > trace ) ; <nl> - while ( const datum_t d = next_arr_el ( ) ) { <nl> + datum_t d ; <nl> + while ( d = next_arr_el ( ) , d . has ( ) ) { <nl> batcher . note_el ( d ) ; <nl> v . push_back ( std : : move ( d ) ) ; <nl> if ( batcher . should_send_batch ( ) ) { <nl> ordered_distinct_datum_stream_t : : next_raw_batch ( env_t * env , const batchspec_t & b <nl> std : : vector < datum_t > v = source - > next_batch ( env , bs ) ; <nl> if ( v . size ( ) = = 0 ) break ; <nl> for ( auto & & el : v ) { <nl> - if ( ! last_val . has ( ) | | * last_val ! = * el ) { <nl> + if ( ! last_val . has ( ) | | last_val ! = el ) { <nl> last_val = el ; <nl> ret . push_back ( std : : move ( el ) ) ; <nl> } <nl> datum_t union_datum_stream_t : : as_array ( env_t * env ) { <nl> batchspec_t batchspec = batchspec_t : : user ( batch_type_t : : TERMINAL , env ) ; <nl> { <nl> profile : : sampler_t sampler ( " Evaluating stream eagerly . " , env - > trace ) ; <nl> - while ( const datum_t d = next ( env , batchspec ) ) { <nl> + datum_t d ; <nl> + while ( d = next ( env , batchspec ) , d . has ( ) ) { <nl> arr . add ( d ) ; <nl> sampler . new_sample ( ) ; <nl> } <nl> mmm a / src / rdb_protocol / datum_stream . hpp <nl> ppp b / src / rdb_protocol / datum_stream . hpp <nl> <nl> # include " errors . hpp " <nl> # include < boost / optional . hpp > <nl> <nl> + # include " containers / scoped . hpp " <nl> # include " rdb_protocol / context . hpp " <nl> # include " rdb_protocol / protocol . hpp " <nl> # include " rdb_protocol / real_table . hpp " <nl> class readgen_t { <nl> explicit readgen_t ( <nl> const std : : map < std : : string , wire_func_t > & global_optargs , <nl> std : : string table_name , <nl> - const datum_range_t & original_datum_range , <nl> profile_bool_t profile , <nl> sorting_t sorting ) ; <nl> virtual ~ readgen_t ( ) { } <nl> - read_t terminal_read ( <nl> + <nl> + virtual read_t terminal_read ( <nl> const std : : vector < transform_variant_t > & transform , <nl> const terminal_variant_t & _terminal , <nl> - const batchspec_t & batchspec ) const ; <nl> + const batchspec_t & batchspec ) const = 0 ; <nl> / / This has to be on ` readgen_t ` because we sort differently depending on <nl> / / the kinds of reads we ' re doing . <nl> virtual void sindex_sort ( std : : vector < rget_item_t > * vec ) const = 0 ; <nl> class readgen_t { <nl> virtual read_t next_read ( <nl> const key_range_t & active_range , <nl> const std : : vector < transform_variant_t > & transform , <nl> - const batchspec_t & batchspec ) const ; <nl> + const batchspec_t & batchspec ) const = 0 ; <nl> / / This generates a read that will read as many rows as we need to be able <nl> / / to do an sindex sort , or nothing if no such read is necessary . Such a <nl> / / read should only be necessary when we ' re ordering by a secondary index <nl> class readgen_t { <nl> protected : <nl> const std : : map < std : : string , wire_func_t > global_optargs ; <nl> const std : : string table_name ; <nl> - const datum_range_t original_datum_range ; <nl> const profile_bool_t profile ; <nl> const sorting_t sorting ; <nl> + } ; <nl> + <nl> + class rget_readgen_t : public readgen_t { <nl> + public : <nl> + explicit rget_readgen_t ( <nl> + const std : : map < std : : string , wire_func_t > & global_optargs , <nl> + std : : string table_name , <nl> + const datum_range_t & original_datum_range , <nl> + profile_bool_t profile , <nl> + sorting_t sorting ) ; <nl> + <nl> + virtual read_t terminal_read ( <nl> + const std : : vector < transform_variant_t > & transform , <nl> + const terminal_variant_t & _terminal , <nl> + const batchspec_t & batchspec ) const ; <nl> + <nl> + virtual read_t next_read ( <nl> + const key_range_t & active_range , <nl> + const std : : vector < transform_variant_t > & transform , <nl> + const batchspec_t & batchspec ) const ; <nl> <nl> private : <nl> virtual rget_read_t next_read_impl ( <nl> const key_range_t & active_range , <nl> const std : : vector < transform_variant_t > & transform , <nl> const batchspec_t & batchspec ) const = 0 ; <nl> + <nl> + protected : <nl> + const datum_range_t original_datum_range ; <nl> } ; <nl> <nl> - class primary_readgen_t : public readgen_t { <nl> + class primary_readgen_t : public rget_readgen_t { <nl> public : <nl> static scoped_ptr_t < readgen_t > make ( <nl> env_t * env , <nl> std : : string table_name , <nl> datum_range_t range = datum_range_t : : universe ( ) , <nl> sorting_t sorting = sorting_t : : UNORDERED ) ; <nl> + <nl> + virtual boost : : optional < read_t > sindex_sort_read ( <nl> + const key_range_t & active_range , <nl> + const std : : vector < rget_item_t > & items , <nl> + const std : : vector < transform_variant_t > & transform , <nl> + const batchspec_t & batchspec ) const ; <nl> + virtual void sindex_sort ( std : : vector < rget_item_t > * vec ) const ; <nl> + virtual key_range_t original_keyrange ( ) const ; <nl> + virtual std : : string sindex_name ( ) const ; / / Used for error checking . <nl> private : <nl> primary_readgen_t ( const std : : map < std : : string , wire_func_t > & global_optargs , <nl> std : : string table_name , <nl> class primary_readgen_t : public readgen_t { <nl> const key_range_t & active_range , <nl> const std : : vector < transform_variant_t > & transform , <nl> const batchspec_t & batchspec ) const ; <nl> - virtual boost : : optional < read_t > sindex_sort_read ( <nl> - const key_range_t & active_range , <nl> - const std : : vector < rget_item_t > & items , <nl> - const std : : vector < transform_variant_t > & transform , <nl> - const batchspec_t & batchspec ) const ; <nl> - virtual void sindex_sort ( std : : vector < rget_item_t > * vec ) const ; <nl> - virtual key_range_t original_keyrange ( ) const ; <nl> - virtual std : : string sindex_name ( ) const ; / / Used for error checking . <nl> } ; <nl> <nl> - class sindex_readgen_t : public readgen_t { <nl> + class sindex_readgen_t : public rget_readgen_t { <nl> public : <nl> static scoped_ptr_t < readgen_t > make ( <nl> env_t * env , <nl> class sindex_readgen_t : public readgen_t { <nl> const std : : string & sindex , <nl> datum_range_t range = datum_range_t : : universe ( ) , <nl> sorting_t sorting = sorting_t : : UNORDERED ) ; <nl> + <nl> + virtual boost : : optional < read_t > sindex_sort_read ( <nl> + const key_range_t & active_range , <nl> + const std : : vector < rget_item_t > & items , <nl> + const std : : vector < transform_variant_t > & transform , <nl> + const batchspec_t & batchspec ) const ; <nl> + virtual void sindex_sort ( std : : vector < rget_item_t > * vec ) const ; <nl> + virtual key_range_t original_keyrange ( ) const ; <nl> + virtual std : : string sindex_name ( ) const ; / / Used for error checking . <nl> private : <nl> sindex_readgen_t ( <nl> const std : : map < std : : string , wire_func_t > & global_optargs , <nl> class sindex_readgen_t : public readgen_t { <nl> const key_range_t & active_range , <nl> const std : : vector < transform_variant_t > & transform , <nl> const batchspec_t & batchspec ) const ; <nl> + <nl> + const std : : string sindex ; <nl> + } ; <nl> + <nl> + / / For geospatial intersection queries <nl> + class intersecting_readgen_t : public readgen_t { <nl> + public : <nl> + static scoped_ptr_t < readgen_t > make ( <nl> + env_t * env , <nl> + std : : string table_name , <nl> + const std : : string & sindex , <nl> + const datum_t & query_geometry ) ; <nl> + <nl> + virtual read_t terminal_read ( <nl> + const std : : vector < transform_variant_t > & transform , <nl> + const terminal_variant_t & _terminal , <nl> + const batchspec_t & batchspec ) const ; <nl> + <nl> + virtual read_t next_read ( <nl> + const key_range_t & active_range , <nl> + const std : : vector < transform_variant_t > & transform , <nl> + const batchspec_t & batchspec ) const ; <nl> + <nl> virtual boost : : optional < read_t > sindex_sort_read ( <nl> const key_range_t & active_range , <nl> const std : : vector < rget_item_t > & items , <nl> class sindex_readgen_t : public readgen_t { <nl> virtual void sindex_sort ( std : : vector < rget_item_t > * vec ) const ; <nl> virtual key_range_t original_keyrange ( ) const ; <nl> virtual std : : string sindex_name ( ) const ; / / Used for error checking . <nl> + private : <nl> + intersecting_readgen_t ( <nl> + const std : : map < std : : string , wire_func_t > & global_optargs , <nl> + std : : string table_name , <nl> + const std : : string & sindex , <nl> + const datum_t & query_geometry , <nl> + profile_bool_t profile ) ; <nl> + <nl> + / / Analogue to rget_readgen_t : : next_read_impl ( ) , but generates an intersecting <nl> + / / geo read . <nl> + intersecting_geo_read_t next_read_impl ( <nl> + const key_range_t & active_range , <nl> + const std : : vector < transform_variant_t > & transforms , <nl> + const batchspec_t & batchspec ) const ; <nl> <nl> const std : : string sindex ; <nl> + const datum_t query_geometry ; <nl> } ; <nl> <nl> class reader_t { <nl> public : <nl> - explicit reader_t ( <nl> + virtual ~ reader_t ( ) { } <nl> + virtual void add_transformation ( transform_variant_t & & tv ) = 0 ; <nl> + virtual void accumulate ( env_t * env , eager_acc_t * acc , <nl> + const terminal_variant_t & tv ) = 0 ; <nl> + virtual void accumulate_all ( env_t * env , eager_acc_t * acc ) = 0 ; <nl> + virtual std : : vector < datum_t > next_batch ( env_t * env , <nl> + const batchspec_t & batchspec ) = 0 ; <nl> + virtual bool is_finished ( ) const = 0 ; <nl> + } ; <nl> + <nl> + / / For reads that generate read_response_t results <nl> + class rget_response_reader_t : public reader_t { <nl> + public : <nl> + rget_response_reader_t ( <nl> const real_table_t & _table , <nl> bool use_outdated , <nl> scoped_ptr_t < readgen_t > & & readgen ) ; <nl> - void add_transformation ( transform_variant_t & & tv ) ; <nl> - void accumulate ( env_t * env , eager_acc_t * acc , const terminal_variant_t & tv ) ; <nl> - void accumulate_all ( env_t * env , eager_acc_t * acc ) ; <nl> - std : : vector < datum_t > <nl> - next_batch ( env_t * env , const batchspec_t & batchspec ) ; <nl> - bool is_finished ( ) const ; <nl> - private : <nl> + virtual void add_transformation ( transform_variant_t & & tv ) ; <nl> + virtual void accumulate ( env_t * env , eager_acc_t * acc , const terminal_variant_t & tv ) ; <nl> + / / Overwrite this in an implementation <nl> + virtual void accumulate_all ( env_t * env , eager_acc_t * acc ) = 0 ; <nl> + virtual std : : vector < datum_t > next_batch ( env_t * env , const batchspec_t & batchspec ) ; <nl> + virtual bool is_finished ( ) const ; <nl> + <nl> + protected : <nl> / / Returns ` true ` if there ' s data in ` items ` . <nl> - bool load_items ( env_t * env , const batchspec_t & batchspec ) ; <nl> + / / Overwrite this in an implementation <nl> + virtual bool load_items ( env_t * env , const batchspec_t & batchspec ) = 0 ; <nl> rget_read_response_t do_read ( env_t * env , const read_t & read ) ; <nl> - std : : vector < rget_item_t > do_range_read ( <nl> - env_t * env , const read_t & read ) ; <nl> <nl> real_table_t table ; <nl> const bool use_outdated ; <nl> class reader_t { <nl> size_t items_index ; <nl> } ; <nl> <nl> + class rget_reader_t : public rget_response_reader_t { <nl> + public : <nl> + rget_reader_t ( <nl> + const real_table_t & _table , <nl> + bool use_outdated , <nl> + scoped_ptr_t < readgen_t > & & readgen ) ; <nl> + virtual void accumulate_all ( env_t * env , eager_acc_t * acc ) ; <nl> + <nl> + protected : <nl> + / / Loads new items into the ` items ` field of rget_response_reader_t . <nl> + / / Returns ` true ` if there ' s data in ` items ` . <nl> + virtual bool load_items ( env_t * env , const batchspec_t & batchspec ) ; <nl> + <nl> + private : <nl> + std : : vector < rget_item_t > do_range_read ( env_t * env , const read_t & read ) ; <nl> + } ; <nl> + <nl> + / / intersecting_reader_t performs filtering for duplicate documents in the stream , <nl> + / / assuming it is read in batches ( otherwise that ' s not necessary , because the <nl> + / / shards will already provide distinct results ) . <nl> + class intersecting_reader_t : public rget_response_reader_t { <nl> + public : <nl> + intersecting_reader_t ( <nl> + const real_table_t & _table , <nl> + bool use_outdated , <nl> + scoped_ptr_t < readgen_t > & & readgen ) ; <nl> + virtual void accumulate_all ( env_t * env , eager_acc_t * acc ) ; <nl> + <nl> + protected : <nl> + / / Loads new items into the ` items ` field of rget_response_reader_t . <nl> + / / Returns ` true ` if there ' s data in ` items ` . <nl> + virtual bool load_items ( env_t * env , const batchspec_t & batchspec ) ; <nl> + <nl> + private : <nl> + std : : vector < rget_item_t > do_intersecting_read ( env_t * env , const read_t & read ) ; <nl> + <nl> + / / To detect duplicates <nl> + std : : set < store_key_t > processed_pkeys ; <nl> + } ; <nl> + <nl> class lazy_datum_stream_t : public datum_stream_t { <nl> public : <nl> lazy_datum_stream_t ( <nl> - const real_table_t & _table , <nl> - bool _use_outdated , <nl> - scoped_ptr_t < readgen_t > & & _readgen , <nl> + scoped_ptr_t < reader_t > & & _reader , <nl> const protob_t < const Backtrace > & bt_src ) ; <nl> <nl> virtual bool is_array ( ) { return false ; } <nl> class lazy_datum_stream_t : public datum_stream_t { <nl> size_t current_batch_offset ; <nl> std : : vector < datum_t > current_batch ; <nl> <nl> - reader_t reader ; <nl> + scoped_ptr_t < reader_t > reader ; <nl> } ; <nl> <nl> } / / namespace ql <nl> mmm a / src / rdb_protocol / env . cc <nl> ppp b / src / rdb_protocol / env . cc <nl> env_t : : env_t ( signal_t * _interruptor , reql_version_t reql_version ) <nl> profile_bool_t profile_bool_optarg ( const protob_t < Query > & query ) { <nl> rassert ( query . has ( ) ) ; <nl> datum_t profile_arg = static_optarg ( " profile " , query ) ; <nl> - if ( profile_arg . has ( ) & & profile_arg - > get_type ( ) = = datum_t : : type_t : : R_BOOL & & <nl> - profile_arg - > as_bool ( ) ) { <nl> + if ( profile_arg . has ( ) & & profile_arg . get_type ( ) = = datum_t : : type_t : : R_BOOL & & <nl> + profile_arg . as_bool ( ) ) { <nl> return profile_bool_t : : PROFILE ; <nl> } else { <nl> return profile_bool_t : : DONT_PROFILE ; <nl> mmm a / src / rdb_protocol / func . cc <nl> ppp b / src / rdb_protocol / func . cc <nl> bool func_term_t : : is_deterministic ( ) const { <nl> * the object which we check to make sure matches the predicate . * / <nl> bool filter_match ( datum_t predicate , datum_t value , <nl> const rcheckable_t * parent ) { <nl> - if ( predicate - > is_ptype ( pseudo : : literal_string ) ) { <nl> - return * predicate - > get_field ( pseudo : : value_key ) = = * value ; <nl> + if ( predicate . is_ptype ( pseudo : : literal_string ) ) { <nl> + return predicate . get_field ( pseudo : : value_key ) = = value ; <nl> } else { <nl> for ( size_t i = 0 ; i < predicate . obj_size ( ) ; + + i ) { <nl> auto pair = predicate . get_pair ( i ) ; <nl> r_sanity_check ( pair . second . has ( ) ) ; <nl> - datum_t elt = value - > get_field ( pair . first , NOTHROW ) ; <nl> + datum_t elt = value . get_field ( pair . first , NOTHROW ) ; <nl> if ( ! elt . has ( ) ) { <nl> rfail_target ( parent , base_exc_t : : NON_EXISTENCE , <nl> " No attribute ` % s ` in object . " , pair . first . to_std ( ) . c_str ( ) ) ; <nl> } else if ( pair . second . get_type ( ) = = datum_t : : R_OBJECT & & <nl> - elt - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + elt . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> if ( ! filter_match ( pair . second , elt , parent ) ) { return false ; } <nl> } else if ( elt ! = pair . second ) { <nl> return false ; <nl> bool filter_match ( datum_t predicate , datum_t value , <nl> <nl> bool reql_func_t : : filter_helper ( env_t * env , datum_t arg ) const { <nl> datum_t d = call ( env , make_vector ( arg ) , NO_FLAGS ) - > as_datum ( ) ; <nl> - if ( d - > get_type ( ) = = datum_t : : R_OBJECT & & <nl> + if ( d . get_type ( ) = = datum_t : : R_OBJECT & & <nl> ( body - > get_src ( ) - > type ( ) = = Term : : MAKE_OBJ | | <nl> body - > get_src ( ) - > type ( ) = = Term : : DATUM ) ) { <nl> return filter_match ( d , arg , this ) ; <nl> } else { <nl> - return d - > as_bool ( ) ; <nl> + return d . as_bool ( ) ; <nl> } <nl> } <nl> <nl> std : : string js_func_t : : print_source ( ) const { <nl> <nl> bool js_func_t : : filter_helper ( env_t * env , datum_t arg ) const { <nl> datum_t d = call ( env , make_vector ( arg ) , NO_FLAGS ) - > as_datum ( ) ; <nl> - return d - > as_bool ( ) ; <nl> + return d . as_bool ( ) ; <nl> } <nl> <nl> bool func_t : : filter_call ( env_t * env , datum_t arg , counted_t < const func_t > default_filter_val ) const { <nl> counted_t < const func_t > new_eq_comparison_func ( datum_t obj , <nl> <nl> counted_t < const func_t > new_page_func ( datum_t method , <nl> const protob_t < const Backtrace > & bt_src ) { <nl> - if ( method - > get_type ( ) ! = datum_t : : R_NULL ) { <nl> - std : : string name = method - > as_str ( ) . to_std ( ) ; <nl> + if ( method . get_type ( ) ! = datum_t : : R_NULL ) { <nl> + std : : string name = method . as_str ( ) . to_std ( ) ; <nl> if ( name = = " link - next " ) { <nl> pb : : dummy_var_t info = pb : : dummy_var_t : : FUNC_PAGE ; <nl> protob_t < Term > twrap = <nl> mmm a / src / rdb_protocol / geo / geojson . cc <nl> ppp b / src / rdb_protocol / geo / geojson . cc <nl> lat_lon_point_t position_to_lat_lon_point ( const datum_t & position ) { <nl> <nl> / / GeoJSON positions are in order longitude , latitude , altitude <nl> double longitude , latitude ; <nl> - longitude = position . get ( 0 ) - > as_num ( ) ; <nl> - latitude = position . get ( 1 ) - > as_num ( ) ; <nl> + longitude = position . get ( 0 ) . as_num ( ) ; <nl> + latitude = position . get ( 1 ) . as_num ( ) ; <nl> <nl> return lat_lon_point_t ( latitude , longitude ) ; <nl> } <nl> <nl> lat_lon_point_t extract_lat_lon_point ( const datum_t & geojson ) { <nl> - if ( geojson - > get_field ( " type " ) - > as_str ( ) ! = " Point " ) { <nl> + if ( geojson . get_field ( " type " ) . as_str ( ) ! = " Point " ) { <nl> throw geo_exception_t ( <nl> strprintf ( " Expected geometry of type ` Point ` but found ` % s ` . " , <nl> - geojson - > get_field ( " type " ) - > as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> + geojson . get_field ( " type " ) . as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> } <nl> <nl> - const datum_t & coordinates = geojson - > get_field ( " coordinates " ) ; <nl> + const datum_t & coordinates = geojson . get_field ( " coordinates " ) ; <nl> <nl> return position_to_lat_lon_point ( coordinates ) ; <nl> } <nl> <nl> lat_lon_line_t extract_lat_lon_line ( const ql : : datum_t & geojson ) { <nl> - if ( geojson - > get_field ( " type " ) - > as_str ( ) ! = " LineString " ) { <nl> + if ( geojson . get_field ( " type " ) . as_str ( ) ! = " LineString " ) { <nl> throw geo_exception_t ( <nl> strprintf ( " Expected geometry of type ` LineString ` but found ` % s ` . " , <nl> - geojson - > get_field ( " type " ) - > as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> + geojson . get_field ( " type " ) . as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> } <nl> <nl> - const datum_t & coordinates = geojson - > get_field ( " coordinates " ) ; <nl> + const datum_t & coordinates = geojson . get_field ( " coordinates " ) ; <nl> lat_lon_line_t result ; <nl> result . reserve ( coordinates . arr_size ( ) ) ; <nl> for ( size_t i = 0 ; i < coordinates . arr_size ( ) ; + + i ) { <nl> lat_lon_line_t extract_lat_lon_line ( const ql : : datum_t & geojson ) { <nl> } <nl> <nl> lat_lon_line_t extract_lat_lon_shell ( const ql : : datum_t & geojson ) { <nl> - if ( geojson - > get_field ( " type " ) - > as_str ( ) ! = " Polygon " ) { <nl> + if ( geojson . get_field ( " type " ) . as_str ( ) ! = " Polygon " ) { <nl> throw geo_exception_t ( <nl> strprintf ( " Expected geometry of type ` Polygon ` but found ` % s ` . " , <nl> - geojson - > get_field ( " type " ) - > as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> + geojson . get_field ( " type " ) . as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> } <nl> <nl> - const datum_t & coordinates = geojson - > get_field ( " coordinates " ) ; <nl> + const datum_t & coordinates = geojson . get_field ( " coordinates " ) ; <nl> if ( coordinates . arr_size ( ) < 1 ) { <nl> throw geo_exception_t ( " The polygon is empty . It must have at least " <nl> " an outer shell . " ) ; <nl> scoped_ptr_t < S2Polygon > coordinates_to_s2polygon ( const datum_t & coords ) { <nl> <nl> void ensure_no_crs ( const ql : : datum_t & geojson ) { <nl> const ql : : datum_t & crs_field = <nl> - geojson - > get_field ( " crs " , ql : : throw_bool_t : : NOTHROW ) ; <nl> + geojson . get_field ( " crs " , ql : : throw_bool_t : : NOTHROW ) ; <nl> if ( crs_field . has ( ) ) { <nl> - if ( crs_field - > get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> + if ( crs_field . get_type ( ) ! = ql : : datum_t : : R_NULL ) { <nl> throw geo_exception_t ( " Non - default coordinate reference systems " <nl> " are not supported in GeoJSON objects . " <nl> " Make sure the ` crs ` field of the geometry is " <nl> void ensure_no_crs ( const ql : : datum_t & geojson ) { <nl> } <nl> <nl> scoped_ptr_t < S2Point > to_s2point ( const ql : : datum_t & geojson ) { <nl> - const datum_string_t & type = geojson - > get_field ( " type " ) - > as_str ( ) ; <nl> - datum_t coordinates = geojson - > get_field ( " coordinates " ) ; <nl> + const datum_string_t & type = geojson . get_field ( " type " ) . as_str ( ) ; <nl> + datum_t coordinates = geojson . get_field ( " coordinates " ) ; <nl> if ( type ! = " Point " ) { <nl> - throw geo_exception_t ( " Encountered wrong type in to_s2point . " ) ; <nl> + throw geo_exception_t ( <nl> + strprintf ( " Expected geometry of type ` Point ` but found ` % s ` . " , <nl> + type . to_std ( ) . c_str ( ) ) ) ; <nl> } <nl> return coordinates_to_s2point ( coordinates ) ; <nl> } <nl> <nl> scoped_ptr_t < S2Polyline > to_s2polyline ( const ql : : datum_t & geojson ) { <nl> - const datum_string_t & type = geojson - > get_field ( " type " ) - > as_str ( ) ; <nl> - datum_t coordinates = geojson - > get_field ( " coordinates " ) ; <nl> + const datum_string_t & type = geojson . get_field ( " type " ) . as_str ( ) ; <nl> + datum_t coordinates = geojson . get_field ( " coordinates " ) ; <nl> if ( type ! = " LineString " ) { <nl> - throw geo_exception_t ( " Encountered wrong type in to_s2polyline . " ) ; <nl> + throw geo_exception_t ( <nl> + strprintf ( " Expected geometry of type ` LineString ` but found ` % s ` . " , <nl> + type . to_std ( ) . c_str ( ) ) ) ; <nl> } <nl> return coordinates_to_s2polyline ( coordinates ) ; <nl> } <nl> <nl> scoped_ptr_t < S2Polygon > to_s2polygon ( const ql : : datum_t & geojson ) { <nl> - const datum_string_t & type = geojson - > get_field ( " type " ) - > as_str ( ) ; <nl> - datum_t coordinates = geojson - > get_field ( " coordinates " ) ; <nl> + const datum_string_t & type = geojson . get_field ( " type " ) . as_str ( ) ; <nl> + datum_t coordinates = geojson . get_field ( " coordinates " ) ; <nl> if ( type ! = " Polygon " ) { <nl> - throw geo_exception_t ( " Encountered wrong type in to_s2polygon . " ) ; <nl> + throw geo_exception_t ( <nl> + strprintf ( " Expected geometry of type ` Polygon ` but found ` % s ` . " , <nl> + type . to_std ( ) . c_str ( ) ) ) ; <nl> } <nl> return coordinates_to_s2polygon ( coordinates ) ; <nl> } <nl> mmm a / src / rdb_protocol / geo / geojson . hpp <nl> ppp b / src / rdb_protocol / geo / geojson . hpp <nl> template < class return_t > <nl> return_t visit_geojson ( <nl> s2_geo_visitor_t < return_t > * visitor , <nl> const ql : : datum_t & geojson ) { <nl> - const datum_string_t & type = geojson - > get_field ( " type " ) - > as_str ( ) ; <nl> - ql : : datum_t coordinates = geojson - > get_field ( " coordinates " ) ; <nl> + const datum_string_t & type = geojson . get_field ( " type " ) . as_str ( ) ; <nl> + ql : : datum_t coordinates = geojson . get_field ( " coordinates " ) ; <nl> <nl> if ( type = = " Point " ) { <nl> scoped_ptr_t < geo : : S2Point > pt = coordinates_to_s2point ( coordinates ) ; <nl> mmm a / src / rdb_protocol / geo / indexing . cc <nl> ppp b / src / rdb_protocol / geo / indexing . cc <nl> std : : vector < std : : string > compute_index_grid_keys ( <nl> const ql : : datum_t & key , int goal_cells ) { <nl> rassert ( key . has ( ) ) ; <nl> <nl> - if ( ! key - > is_ptype ( ql : : pseudo : : geometry_string ) ) { <nl> - throw geo_exception_t ( " Expected geometry but found " + key - > get_type_name ( ) + " . " ) ; <nl> + if ( ! key . is_ptype ( ql : : pseudo : : geometry_string ) ) { <nl> + throw geo_exception_t ( " Expected geometry but found " + key . get_type_name ( ) + " . " ) ; <nl> } <nl> if ( goal_cells < = 0 ) { <nl> throw geo_exception_t ( " goal_cells must be positive ( and should be > = 4 ) . " ) ; <nl> std : : vector < std : : string > compute_index_grid_keys ( <nl> return result ; <nl> } <nl> <nl> - geo_index_traversal_helper_t : : geo_index_traversal_helper_t ( ) <nl> - : abort_ ( false ) , is_initialized_ ( false ) { } <nl> + geo_index_traversal_helper_t : : geo_index_traversal_helper_t ( const signal_t * interruptor ) <nl> + : is_initialized_ ( false ) , interruptor_ ( interruptor ) { } <nl> <nl> geo_index_traversal_helper_t : : geo_index_traversal_helper_t ( <nl> - const std : : vector < std : : string > & query_grid_keys ) <nl> - : abort_ ( false ) , is_initialized_ ( false ) { <nl> + const std : : vector < std : : string > & query_grid_keys , <nl> + const signal_t * interruptor ) <nl> + : is_initialized_ ( false ) , interruptor_ ( interruptor ) { <nl> init_query ( query_grid_keys ) ; <nl> } <nl> <nl> void geo_index_traversal_helper_t : : init_query ( <nl> is_initialized_ = true ; <nl> } <nl> <nl> - void geo_index_traversal_helper_t : : process_a_leaf ( buf_lock_t * leaf_node_buf , <nl> - const btree_key_t * left_exclusive_or_null , <nl> - const btree_key_t * right_inclusive_or_null , <nl> - signal_t * interruptor , <nl> - int * population_change_out ) THROWS_ONLY ( interrupted_exc_t ) { <nl> + done_traversing_t geo_index_traversal_helper_t : : handle_pair ( <nl> + scoped_key_value_t & & keyvalue , <nl> + concurrent_traversal_fifo_enforcer_signal_t waiter ) <nl> + THROWS_ONLY ( interrupted_exc_t ) { <nl> guarantee ( is_initialized_ ) ; <nl> <nl> - * population_change_out = 0 ; <nl> - <nl> - if ( interruptor - > is_pulsed ( ) ) { <nl> + if ( interruptor_ - > is_pulsed ( ) ) { <nl> throw interrupted_exc_t ( ) ; <nl> } <nl> <nl> - if ( ! any_query_cell_intersects ( left_exclusive_or_null , right_inclusive_or_null ) ) { <nl> - return ; <nl> - } <nl> - <nl> - buf_read_t read ( leaf_node_buf ) ; <nl> - const leaf_node_t * node = static_cast < const leaf_node_t * > ( read . get_data_read ( ) ) ; <nl> - <nl> - for ( auto it = leaf : : begin ( * node ) ; it ! = leaf : : end ( * node ) ; + + it ) { <nl> - const btree_key_t * key = ( * it ) . first ; <nl> - if ( abort_ | | ! key ) { <nl> - break ; <nl> - } <nl> - <nl> - const S2CellId key_cell = btree_key_to_s2cellid ( key ) ; <nl> - if ( any_query_cell_intersects ( key_cell . range_min ( ) , key_cell . range_max ( ) ) ) { <nl> - on_candidate ( key , ( * it ) . second , buf_parent_t ( leaf_node_buf ) , interruptor ) ; <nl> - } <nl> + const S2CellId key_cell = btree_key_to_s2cellid ( keyvalue . key ( ) ) ; <nl> + if ( any_query_cell_intersects ( key_cell . range_min ( ) , key_cell . range_max ( ) ) ) { <nl> + return on_candidate ( std : : move ( keyvalue ) , waiter ) ; <nl> + } else { <nl> + return done_traversing_t : : NO ; <nl> } <nl> } <nl> <nl> - void geo_index_traversal_helper_t : : filter_interesting_children ( <nl> - UNUSED buf_parent_t parent , <nl> - ranged_block_ids_t * ids_source , <nl> - interesting_children_callback_t * cb ) { <nl> + bool geo_index_traversal_helper_t : : is_range_interesting ( <nl> + const btree_key_t * left_excl_or_null , <nl> + const btree_key_t * right_incl_or_null ) { <nl> guarantee ( is_initialized_ ) ; <nl> - <nl> - for ( int i = 0 , e = ids_source - > num_block_ids ( ) ; i < e & & ! abort_ ; + + i ) { <nl> - block_id_t block_id ; <nl> - const btree_key_t * left , * right ; <nl> - ids_source - > get_block_id_and_bounding_interval ( i , & block_id , & left , & right ) ; <nl> - <nl> - if ( any_query_cell_intersects ( left , right ) ) { <nl> - cb - > receive_interesting_child ( i ) ; <nl> - } <nl> - } <nl> - <nl> - cb - > no_more_interesting_children ( ) ; <nl> - } <nl> - <nl> - void geo_index_traversal_helper_t : : abort_traversal ( ) { <nl> - abort_ = true ; <nl> + / / We ignore the fact that the left key is exclusive and not inclusive . <nl> + / / In rare cases this costs us a little bit of efficiency because we consider <nl> + / / one extra key , but it saves us some complexity . <nl> + return any_query_cell_intersects ( left_excl_or_null , right_incl_or_null ) ; <nl> } <nl> <nl> bool geo_index_traversal_helper_t : : any_query_cell_intersects ( <nl> - const btree_key_t * left_excl , const btree_key_t * right_incl ) { <nl> - / / We ignore the fact that left_excl is exclusive and not inclusive . <nl> - / / In rare cases this costs us a little bit of efficiency , but saves us <nl> - / / some complexity . <nl> + const btree_key_t * left_incl_or_null , const btree_key_t * right_incl_or_null ) { <nl> S2CellId left_cell = <nl> - left_excl = = NULL <nl> + left_incl_or_null = = NULL <nl> ? S2CellId : : FromFacePosLevel ( 0 , 0 , 0 ) / / The smallest valid cell id <nl> - : btree_key_to_s2cellid ( left_excl ) ; <nl> + : btree_key_to_s2cellid ( left_incl_or_null ) ; <nl> S2CellId right_cell = <nl> - right_incl = = NULL <nl> + right_incl_or_null = = NULL <nl> ? S2CellId : : FromFacePosLevel ( 5 , 0 , 0 ) / / The largest valid cell id <nl> - : btree_key_to_s2cellid ( right_incl ) ; <nl> + : btree_key_to_s2cellid ( right_incl_or_null ) ; <nl> <nl> / / Determine a S2CellId range that is a superset of what ' s intersecting <nl> / / with anything stored in [ left_cell , right_cell ] . <nl> mmm a / src / rdb_protocol / geo / indexing . hpp <nl> ppp b / src / rdb_protocol / geo / indexing . hpp <nl> <nl> # include < string > <nl> # include < vector > <nl> <nl> - # include " btree / parallel_traversal . hpp " <nl> + # include " btree / concurrent_traversal . hpp " <nl> # include " containers / counted . hpp " <nl> # include " rdb_protocol / geo / s2 / s2cellid . h " <nl> <nl> std : : vector < std : : string > compute_index_grid_keys ( <nl> int goal_cells ) ; <nl> <nl> / / TODO ( daniel ) : Support compound indexes somehow . <nl> - class geo_index_traversal_helper_t : public btree_traversal_helper_t { <nl> + class geo_index_traversal_helper_t : public concurrent_traversal_callback_t { <nl> public : <nl> - geo_index_traversal_helper_t ( ) ; <nl> - explicit geo_index_traversal_helper_t ( const std : : vector < std : : string > & query_grid_keys ) ; <nl> + explicit geo_index_traversal_helper_t ( const signal_t * interruptor ) ; <nl> + explicit geo_index_traversal_helper_t ( <nl> + const std : : vector < std : : string > & query_grid_keys , <nl> + const signal_t * interruptor ) ; <nl> <nl> void init_query ( const std : : vector < std : : string > & query_grid_keys ) ; <nl> <nl> / * Called for every pair that could potentially intersect with query_grid_keys . <nl> - Note that this might be called multiple times for the same value . * / <nl> - virtual void on_candidate ( <nl> - const btree_key_t * key , <nl> - const void * value , <nl> - buf_parent_t parent , <nl> - signal_t * interruptor ) <nl> + Note that this might be called multiple times for the same value . <nl> + Correct ordering of the call is not guaranteed . Implementations are expected <nl> + to call waiter . wait_interruptible ( ) before performing ordering - sensitive <nl> + operations . * / <nl> + virtual done_traversing_t on_candidate ( <nl> + scoped_key_value_t & & keyvalue , <nl> + concurrent_traversal_fifo_enforcer_signal_t waiter ) <nl> THROWS_ONLY ( interrupted_exc_t ) = 0 ; <nl> <nl> - / * btree_traversal_helper_t interface * / <nl> - void process_a_leaf ( <nl> - buf_lock_t * leaf_node_buf , <nl> - const btree_key_t * left_exclusive_or_null , <nl> - const btree_key_t * right_inclusive_or_null , <nl> - signal_t * interruptor , <nl> - int * population_change_out ) <nl> + / * concurrent_traversal_callback_t interface * / <nl> + done_traversing_t handle_pair ( <nl> + scoped_key_value_t & & keyvalue , <nl> + concurrent_traversal_fifo_enforcer_signal_t waiter ) <nl> THROWS_ONLY ( interrupted_exc_t ) ; <nl> - void postprocess_internal_node ( UNUSED buf_lock_t * internal_node_buf ) { } <nl> - void filter_interesting_children ( <nl> - buf_parent_t parent , <nl> - ranged_block_ids_t * ids_source , <nl> - interesting_children_callback_t * cb ) ; <nl> - access_t btree_superblock_mode ( ) { return access_t : : read ; } <nl> - access_t btree_node_mode ( ) { return access_t : : read ; } <nl> - <nl> - protected : <nl> - / / Once called , no further calls to on_candidate ( ) will be made and <nl> - / / the traversal will be aborted as quickly as possible . <nl> - void abort_traversal ( ) ; <nl> + bool is_range_interesting ( <nl> + const btree_key_t * left_excl_or_null , <nl> + const btree_key_t * right_incl_or_null ) ; <nl> <nl> private : <nl> - static bool cell_intersects_with_range ( <nl> - const geo : : S2CellId c , <nl> - const geo : : S2CellId left_min , <nl> - const geo : : S2CellId right_max ) ; <nl> - bool any_query_cell_intersects ( const btree_key_t * left_excl , <nl> - const btree_key_t * right_incl ) ; <nl> + static bool cell_intersects_with_range ( const geo : : S2CellId c , <nl> + const geo : : S2CellId left_min , <nl> + const geo : : S2CellId right_max ) ; <nl> + bool any_query_cell_intersects ( const btree_key_t * left_incl_or_null , <nl> + const btree_key_t * right_incl_or_null ) ; <nl> bool any_query_cell_intersects ( const geo : : S2CellId left_min , <nl> const geo : : S2CellId right_max ) ; <nl> <nl> std : : vector < geo : : S2CellId > query_cells_ ; <nl> - bool abort_ ; <nl> bool is_initialized_ ; <nl> + const signal_t * interruptor_ ; <nl> } ; <nl> <nl> # endif / / RDB_PROTOCOL_GEO_INDEXING_HPP_ <nl> mmm a / src / rdb_protocol / geo_traversal . cc <nl> ppp b / src / rdb_protocol / geo_traversal . cc <nl> <nl> # include " errors . hpp " <nl> # include < boost / variant / get . hpp > <nl> <nl> + # include " rdb_protocol / batching . hpp " <nl> + # include " rdb_protocol / configured_limits . hpp " <nl> + # include " rdb_protocol / datum . hpp " <nl> + # include " rdb_protocol / env . hpp " <nl> + # include " rdb_protocol / func . hpp " <nl> # include " rdb_protocol / geo / distances . hpp " <nl> # include " rdb_protocol / geo / exceptions . hpp " <nl> # include " rdb_protocol / geo / geojson . hpp " <nl> <nl> # include " rdb_protocol / geo / primitives . hpp " <nl> # include " rdb_protocol / geo / s2 / s2 . h " <nl> # include " rdb_protocol / geo / s2 / s2latlng . h " <nl> - # include " rdb_protocol / batching . hpp " <nl> - # include " rdb_protocol / configured_limits . hpp " <nl> - # include " rdb_protocol / datum . hpp " <nl> - # include " rdb_protocol / env . hpp " <nl> - # include " rdb_protocol / func . hpp " <nl> # include " rdb_protocol / lazy_json . hpp " <nl> # include " rdb_protocol / profile . hpp " <nl> <nl> const double NEAREST_GOAL_BATCH_SIZE = 100 . 0 ; <nl> const unsigned int NEAREST_NUM_VERTICES = 8 ; <nl> <nl> <nl> + geo_job_data_t : : geo_job_data_t ( ql : : env_t * _env , const ql : : batchspec_t & batchspec , <nl> + const std : : vector < ql : : transform_variant_t > & _transforms , <nl> + const boost : : optional < ql : : terminal_variant_t > & _terminal ) <nl> + : env ( _env ) , <nl> + batcher ( batchspec . to_batcher ( ) ) , <nl> + accumulator ( _terminal <nl> + ? ql : : make_terminal ( * _terminal ) <nl> + : ql : : make_append ( sorting_t : : UNORDERED , & batcher ) ) { <nl> + for ( size_t i = 0 ; i < _transforms . size ( ) ; + + i ) { <nl> + transformers . push_back ( ql : : make_op ( _transforms [ i ] ) ) ; <nl> + } <nl> + guarantee ( transformers . size ( ) = = _transforms . size ( ) ) ; <nl> + } <nl> + <nl> / * mmmmmmmmm - - geo_intersecting_cb_t mmmmmmmmm - - * / <nl> geo_intersecting_cb_t : : geo_intersecting_cb_t ( <nl> btree_slice_t * _slice , <nl> geo_sindex_data_t & & _sindex , <nl> ql : : env_t * _env , <nl> std : : set < store_key_t > * _distinct_emitted_in_out ) <nl> - : geo_index_traversal_helper_t ( ) , <nl> + : geo_index_traversal_helper_t ( _env - > interruptor ) , <nl> slice ( _slice ) , <nl> sindex ( std : : move ( _sindex ) ) , <nl> env ( _env ) , <nl> void geo_intersecting_cb_t : : init_query ( const ql : : datum_t & _query_geometry ) { <nl> compute_index_grid_keys ( _query_geometry , QUERYING_GOAL_GRID_CELLS ) ) ; <nl> } <nl> <nl> - void geo_intersecting_cb_t : : on_candidate ( <nl> - const btree_key_t * key , <nl> - const void * value , <nl> - buf_parent_t parent , <nl> - UNUSED signal_t * interruptor ) <nl> + done_traversing_t geo_intersecting_cb_t : : on_candidate ( <nl> + scoped_key_value_t & & keyvalue , <nl> + concurrent_traversal_fifo_enforcer_signal_t waiter ) <nl> THROWS_ONLY ( interrupted_exc_t ) { <nl> guarantee ( query_geometry . has ( ) ) ; <nl> sampler - > new_sample ( ) ; <nl> <nl> - store_key_t store_key ( key ) ; <nl> + store_key_t store_key ( keyvalue . key ( ) ) ; <nl> store_key_t primary_key ( ql : : datum_t : : extract_primary ( store_key ) ) ; <nl> / / Check if the primary key is in the range of the current slice <nl> if ( ! sindex . pkey_range . contains_key ( primary_key ) ) { <nl> - return ; <nl> + return done_traversing_t : : NO ; <nl> } <nl> <nl> / / Check if this document has already been processed ( lower bound ) . <nl> if ( already_processed . count ( primary_key ) > 0 ) { <nl> - return ; <nl> + return done_traversing_t : : NO ; <nl> } <nl> / / Check if this document has already been emitted . <nl> if ( distinct_emitted - > count ( primary_key ) > 0 ) { <nl> - return ; <nl> + return done_traversing_t : : NO ; <nl> } <nl> <nl> - lazy_json_t row ( static_cast < const rdb_value_t * > ( value ) , parent ) ; <nl> + lazy_json_t row ( static_cast < const rdb_value_t * > ( keyvalue . value ( ) ) , <nl> + keyvalue . expose_buf ( ) ) ; <nl> ql : : datum_t val = row . get ( ) ; <nl> slice - > stats . pm_keys_read . record ( ) ; <nl> slice - > stats . pm_total_keys_read + = 1 ; <nl> + guarantee ( ! row . references_parent ( ) ) ; <nl> + keyvalue . reset ( ) ; <nl> + <nl> + / / Everything happens in key order after this . <nl> + waiter . wait_interruptible ( ) ; <nl> <nl> - / / row . get ( ) might have blocked , and another coroutine could have found the <nl> - / / object in the meantime . Re - check distinct_emitted and then disallow <nl> - / / blocking for the rest of this function . <nl> + / / row . get ( ) or waiter . wait_interruptible ( ) might have blocked , and another <nl> + / / coroutine could have found the document in the meantime . Re - check distinct_emitted , <nl> + / / so we don ' t emit the same document twice . <nl> if ( distinct_emitted - > count ( primary_key ) > 0 ) { <nl> - return ; <nl> + return done_traversing_t : : NO ; <nl> } <nl> - ASSERT_NO_CORO_WAITING ; <nl> <nl> try { <nl> / / Post - filter the geometry based on an actual intersection test <nl> void geo_intersecting_cb_t : : on_candidate ( <nl> ql : : datum_t sindex_val = <nl> sindex . func - > call ( & sindex_env , val ) - > as_datum ( ) ; <nl> if ( sindex . multi = = sindex_multi_bool_t : : MULTI <nl> - & & sindex_val - > get_type ( ) = = ql : : datum_t : : R_ARRAY ) { <nl> + & & sindex_val . get_type ( ) = = ql : : datum_t : : R_ARRAY ) { <nl> boost : : optional < uint64_t > tag = * ql : : datum_t : : extract_tag ( store_key ) ; <nl> guarantee ( tag ) ; <nl> - sindex_val = sindex_val - > get ( * tag , ql : : NOTHROW ) ; <nl> + sindex_val = sindex_val . get ( * tag , ql : : NOTHROW ) ; <nl> guarantee ( sindex_val . has ( ) ) ; <nl> } <nl> / / TODO ( daniel ) : This is a little inefficient because we re - parse <nl> / / the query_geometry for each test . <nl> if ( geo_does_intersect ( query_geometry , sindex_val ) <nl> & & post_filter ( sindex_val , val ) ) { <nl> - if ( distinct_emitted - > size ( ) > env - > limits ( ) . array_size_limit ( ) ) { <nl> + if ( distinct_emitted - > size ( ) > = env - > limits ( ) . array_size_limit ( ) ) { <nl> emit_error ( ql : : exc_t ( ql : : base_exc_t : : GENERIC , <nl> - " Result size limit exceeded ( array size ) . " , NULL ) ) ; <nl> - abort_traversal ( ) ; <nl> - return ; <nl> + " Array size limit exceeded during geospatial index traversal . " , <nl> + NULL ) ) ; <nl> + return done_traversing_t : : YES ; <nl> } <nl> distinct_emitted - > insert ( primary_key ) ; <nl> - emit_result ( sindex_val , val ) ; <nl> + return emit_result ( std : : move ( sindex_val ) , std : : move ( store_key ) , std : : move ( val ) ) ; <nl> } else { <nl> / / Mark the document as processed so we don ' t have to load it again . <nl> / / This is relevant only for polygons and lines , since those can be <nl> / / encountered multiple times in the index . <nl> if ( already_processed . size ( ) < MAX_PROCESSED_SET_SIZE <nl> - & & sindex_val - > get_field ( " type " ) - > as_str ( ) ! = " Point " ) { <nl> + & & sindex_val . get_field ( " type " ) . as_str ( ) ! = " Point " ) { <nl> already_processed . insert ( primary_key ) ; <nl> } <nl> + return done_traversing_t : : NO ; <nl> } <nl> } catch ( const ql : : exc_t & e ) { <nl> emit_error ( e ) ; <nl> - abort_traversal ( ) ; <nl> - return ; <nl> + return done_traversing_t : : YES ; <nl> } catch ( const geo_exception_t & e ) { <nl> emit_error ( ql : : exc_t ( ql : : base_exc_t : : GENERIC , e . what ( ) , NULL ) ) ; <nl> - abort_traversal ( ) ; <nl> - return ; <nl> + return done_traversing_t : : YES ; <nl> } catch ( const ql : : base_exc_t & e ) { <nl> emit_error ( ql : : exc_t ( e , NULL ) ) ; <nl> - abort_traversal ( ) ; <nl> - return ; <nl> + return done_traversing_t : : YES ; <nl> } <nl> } <nl> <nl> void geo_intersecting_cb_t : : on_candidate ( <nl> / * mmmmmmmmm - - collect_all_geo_intersecting_cb_t mmmmmmmmm - - * / <nl> collect_all_geo_intersecting_cb_t : : collect_all_geo_intersecting_cb_t ( <nl> btree_slice_t * _slice , <nl> + geo_job_data_t & & _job , <nl> geo_sindex_data_t & & _sindex , <nl> - ql : : env_t * _env , <nl> - const ql : : datum_t & _query_geometry ) : <nl> - geo_intersecting_cb_t ( _slice , std : : move ( _sindex ) , _env , & distinct_emitted ) , <nl> - result_acc ( _env - > limits ( ) ) { <nl> + const ql : : datum_t & _query_geometry , <nl> + const key_range_t & _sindex_range , <nl> + rget_read_response_t * _resp_out ) <nl> + : geo_intersecting_cb_t ( _slice , std : : move ( _sindex ) , _job . env , & distinct_emitted ) , <nl> + job ( std : : move ( _job ) ) , response ( _resp_out ) { <nl> + guarantee ( response ! = NULL ) ; <nl> + response - > last_key = _sindex_range . left ; <nl> init_query ( _query_geometry ) ; <nl> - / / TODO ( daniel ) : Consider making the traversal resumable , so we can <nl> - / / do it lazily . <nl> - / / Even if we cannot do that , it would be good if we could push down <nl> - / / transformations and terminals into the traversal so their work can <nl> - / / be distributed . <nl> } <nl> <nl> - void collect_all_geo_intersecting_cb_t : : finish ( <nl> - intersecting_geo_read_response_t * resp_out ) { <nl> - guarantee ( resp_out ! = NULL ) ; <nl> - if ( error ) { <nl> - resp_out - > results_or_error = error . get ( ) ; <nl> - } else { <nl> - resp_out - > results_or_error = std : : move ( result_acc ) . to_datum ( ) ; <nl> + void collect_all_geo_intersecting_cb_t : : finish ( ) THROWS_ONLY ( interrupted_exc_t ) { <nl> + job . accumulator - > finish ( & response - > result ) ; <nl> + if ( job . accumulator - > should_send_batch ( ) ) { <nl> + response - > truncated = true ; <nl> } <nl> } <nl> <nl> bool collect_all_geo_intersecting_cb_t : : post_filter ( <nl> return true ; <nl> } <nl> <nl> - void collect_all_geo_intersecting_cb_t : : emit_result ( <nl> - UNUSED const ql : : datum_t & sindex_val , <nl> - const ql : : datum_t & val ) <nl> + done_traversing_t collect_all_geo_intersecting_cb_t : : emit_result ( <nl> + ql : : datum_t & & sindex_val , <nl> + store_key_t & & key , <nl> + ql : : datum_t & & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) { <nl> - result_acc . add ( val ) ; <nl> + / / Update the last considered key . <nl> + rassert ( response - > last_key < = key ) ; <nl> + response - > last_key = key ; <nl> + <nl> + ql : : groups_t data ( optional_datum_less_t ( job . env - > reql_version ( ) ) ) ; <nl> + data = { { ql : : datum_t ( ) , ql : : datums_t { std : : move ( val ) } } } ; <nl> + <nl> + for ( auto it = job . transformers . begin ( ) ; it ! = job . transformers . end ( ) ; + + it ) { <nl> + ( * * it ) ( job . env , & data , sindex_val ) ; <nl> + } <nl> + return ( * job . accumulator ) ( job . env , <nl> + & data , <nl> + std : : move ( key ) , <nl> + std : : move ( sindex_val ) ) ; / / NULL if no sindex <nl> } <nl> <nl> void collect_all_geo_intersecting_cb_t : : emit_error ( <nl> const ql : : exc_t & _error ) <nl> THROWS_ONLY ( interrupted_exc_t ) { <nl> - error = _error ; <nl> + response - > result = _error ; <nl> } <nl> <nl> <nl> bool nearest_traversal_cb_t : : post_filter ( <nl> return dist < = state - > current_inradius ; <nl> } <nl> <nl> - void nearest_traversal_cb_t : : emit_result ( <nl> - const ql : : datum_t & sindex_val , <nl> - const ql : : datum_t & val ) <nl> + done_traversing_t nearest_traversal_cb_t : : emit_result ( <nl> + ql : : datum_t & & sindex_val , <nl> + UNUSED store_key_t & & key , <nl> + ql : : datum_t & & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) { <nl> / / TODO ( daniel ) : Could we avoid re - computing the distance ? We have already <nl> / / done it in post_filter ( ) . <nl> const S2Point s2center = <nl> S2LatLng : : FromDegrees ( state - > center . first , state - > center . second ) . ToPoint ( ) ; <nl> const double dist = geodesic_distance ( s2center , sindex_val , state - > reference_ellipsoid ) ; <nl> - result_acc . push_back ( std : : make_pair ( dist , val ) ) ; <nl> + result_acc . push_back ( std : : make_pair ( dist , std : : move ( val ) ) ) ; <nl> + <nl> + return done_traversing_t : : NO ; <nl> } <nl> <nl> void nearest_traversal_cb_t : : emit_error ( <nl> mmm a / src / rdb_protocol / geo_traversal . hpp <nl> ppp b / src / rdb_protocol / geo_traversal . hpp <nl> <nl> # include " errors . hpp " <nl> # include < boost / optional . hpp > <nl> <nl> + # include " btree / concurrent_traversal . hpp " <nl> # include " btree / keys . hpp " <nl> # include " btree / slice . hpp " <nl> # include " btree / types . hpp " <nl> # include " containers / counted . hpp " <nl> + # include " containers / scoped . hpp " <nl> + # include " rdb_protocol / batching . hpp " <nl> # include " rdb_protocol / geo / ellipsoid . hpp " <nl> # include " rdb_protocol / geo / exceptions . hpp " <nl> # include " rdb_protocol / geo / indexing . hpp " <nl> # include " rdb_protocol / geo / lat_lon_types . hpp " <nl> # include " rdb_protocol / protocol . hpp " <nl> + # include " rdb_protocol / shards . hpp " <nl> <nl> namespace ql { <nl> class datum_t ; <nl> class disabler_t ; <nl> class sampler_t ; <nl> } <nl> <nl> + class geo_job_data_t { <nl> + public : <nl> + geo_job_data_t ( ql : : env_t * _env , const ql : : batchspec_t & batchspec , <nl> + const std : : vector < ql : : transform_variant_t > & _transforms , <nl> + const boost : : optional < ql : : terminal_variant_t > & _terminal ) ; <nl> + geo_job_data_t ( geo_job_data_t & & jd ) <nl> + : env ( jd . env ) , <nl> + batcher ( std : : move ( jd . batcher ) ) , <nl> + transformers ( std : : move ( jd . transformers ) ) , <nl> + accumulator ( jd . accumulator . release ( ) ) { <nl> + } <nl> + private : <nl> + friend class collect_all_geo_intersecting_cb_t ; <nl> + ql : : env_t * const env ; <nl> + ql : : batcher_t batcher ; <nl> + std : : vector < scoped_ptr_t < ql : : op_t > > transformers ; <nl> + scoped_ptr_t < ql : : accumulator_t > accumulator ; <nl> + } ; <nl> <nl> class geo_sindex_data_t { <nl> public : <nl> class geo_intersecting_cb_t : public geo_index_traversal_helper_t { <nl> <nl> void init_query ( const ql : : datum_t & _query_geometry ) ; <nl> <nl> - void on_candidate ( <nl> - const btree_key_t * key , <nl> - const void * value , <nl> - buf_parent_t parent , <nl> - signal_t * interruptor ) <nl> + done_traversing_t on_candidate ( <nl> + scoped_key_value_t & & keyvalue , <nl> + concurrent_traversal_fifo_enforcer_signal_t waiter ) <nl> THROWS_ONLY ( interrupted_exc_t ) ; <nl> <nl> protected : <nl> class geo_intersecting_cb_t : public geo_index_traversal_helper_t { <nl> const ql : : datum_t & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) = 0 ; <nl> <nl> - virtual void emit_result ( <nl> - const ql : : datum_t & sindex_val , <nl> - const ql : : datum_t & val ) <nl> + virtual done_traversing_t emit_result ( <nl> + ql : : datum_t & & sindex_val , <nl> + store_key_t & & key , <nl> + ql : : datum_t & & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) = 0 ; <nl> <nl> virtual void emit_error ( <nl> class geo_intersecting_cb_t : public geo_index_traversal_helper_t { <nl> scoped_ptr_t < profile : : sampler_t > sampler ; <nl> } ; <nl> <nl> - / / Simply accumulates all intersecting results in an array without any <nl> - / / post - filtering . <nl> + / / Simply accumulates all intersecting results in an rget_read_response_t batch <nl> + / / without any post - filtering . <nl> class collect_all_geo_intersecting_cb_t : public geo_intersecting_cb_t { <nl> public : <nl> collect_all_geo_intersecting_cb_t ( <nl> btree_slice_t * _slice , <nl> + geo_job_data_t & & _job , <nl> geo_sindex_data_t & & _sindex , <nl> - ql : : env_t * _env , <nl> - const ql : : datum_t & _query_geometry ) ; <nl> + const ql : : datum_t & _query_geometry , <nl> + const key_range_t & _sindex_range , <nl> + rget_read_response_t * _resp_out ) ; <nl> <nl> - void finish ( intersecting_geo_read_response_t * resp_out ) ; <nl> + void finish ( ) THROWS_ONLY ( interrupted_exc_t ) ; <nl> <nl> protected : <nl> bool post_filter ( <nl> class collect_all_geo_intersecting_cb_t : public geo_intersecting_cb_t { <nl> const ql : : datum_t & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) ; <nl> <nl> - void emit_result ( <nl> - const ql : : datum_t & sindex_val , <nl> - const ql : : datum_t & val ) <nl> + done_traversing_t emit_result ( <nl> + ql : : datum_t & & sindex_val , <nl> + store_key_t & & key , <nl> + ql : : datum_t & & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) ; <nl> <nl> void emit_error ( <nl> class collect_all_geo_intersecting_cb_t : public geo_intersecting_cb_t { <nl> THROWS_ONLY ( interrupted_exc_t ) ; <nl> <nl> private : <nl> - / / Accumulates the data until finish ( ) is called . <nl> - ql : : datum_array_builder_t result_acc ; <nl> - boost : : optional < ql : : exc_t > error ; <nl> + geo_job_data_t job ; <nl> + rget_read_response_t * response ; <nl> <nl> std : : set < store_key_t > distinct_emitted ; <nl> } ; <nl> class nearest_traversal_cb_t : public geo_intersecting_cb_t { <nl> const ql : : datum_t & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) ; <nl> <nl> - void emit_result ( <nl> - const ql : : datum_t & sindex_val , <nl> - const ql : : datum_t & val ) <nl> + done_traversing_t emit_result ( <nl> + ql : : datum_t & & sindex_val , <nl> + store_key_t & & key , <nl> + ql : : datum_t & & val ) <nl> THROWS_ONLY ( interrupted_exc_t , ql : : base_exc_t , geo_exception_t ) ; <nl> <nl> void emit_error ( <nl> mmm a / src / rdb_protocol / op . cc <nl> ppp b / src / rdb_protocol / op . cc <nl> argvec_t arg_terms_t : : start_eval ( scope_env_t * env , eval_flags_t flags ) const { <nl> if ( ( * it ) - > get_src ( ) - > type ( ) = = Term : : ARGS ) { <nl> counted_t < val_t > v = ( * it ) - > eval ( env , new_flags ) ; <nl> datum_t d = v - > as_datum ( ) ; <nl> - for ( size_t i = 0 ; i < d - > arr_size ( ) ; + + i ) { <nl> - args . push_back ( make_counted < faux_term_t > ( src , d - > get ( i ) ) ) ; <nl> + for ( size_t i = 0 ; i < d . arr_size ( ) ; + + i ) { <nl> + args . push_back ( make_counted < faux_term_t > ( src , d . get ( i ) ) ) ; <nl> } <nl> } else { <nl> args . push_back ( * it ) ; <nl> mmm a / src / rdb_protocol / pathspec . cc <nl> ppp b / src / rdb_protocol / pathspec . cc <nl> pathspec_t : : pathspec_t ( const std : : map < datum_string_t , pathspec_t > & _map , <nl> pathspec_t : : pathspec_t ( datum_t datum , const term_t * _creator ) <nl> : creator ( _creator ) <nl> { <nl> - if ( datum - > get_type ( ) = = datum_t : : R_STR ) { <nl> + if ( datum . get_type ( ) = = datum_t : : R_STR ) { <nl> type = STR ; <nl> - str = new datum_string_t ( datum - > as_str ( ) ) ; <nl> - } else if ( datum - > get_type ( ) = = datum_t : : R_ARRAY ) { <nl> + str = new datum_string_t ( datum . as_str ( ) ) ; <nl> + } else if ( datum . get_type ( ) = = datum_t : : R_ARRAY ) { <nl> type = VEC ; <nl> vec = new std : : vector < pathspec_t > ; <nl> - for ( size_t i = 0 ; i < datum - > arr_size ( ) ; + + i ) { <nl> - vec - > push_back ( pathspec_t ( datum - > get ( i ) , creator ) ) ; <nl> + for ( size_t i = 0 ; i < datum . arr_size ( ) ; + + i ) { <nl> + vec - > push_back ( pathspec_t ( datum . get ( i ) , creator ) ) ; <nl> } <nl> - } else if ( datum - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + } else if ( datum . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> scoped_ptr_t < std : : vector < pathspec_t > > local_vec ( new std : : vector < pathspec_t > ) ; <nl> scoped_ptr_t < std : : map < datum_string_t , pathspec_t > > <nl> local_map ( new std : : map < datum_string_t , pathspec_t > ) ; <nl> pathspec_t : : pathspec_t ( datum_t datum , const term_t * _creator ) <nl> } <nl> } else { <nl> rfail_target ( creator , base_exc_t : : GENERIC , " Invalid path argument ` % s ` . " , <nl> - datum - > print ( ) . c_str ( ) ) ; <nl> + datum . print ( ) . c_str ( ) ) ; <nl> } <nl> <nl> if ( type = = VEC & & vec - > size ( ) = = 1 ) { <nl> void pathspec_t : : init_from ( const pathspec_t & other ) { <nl> datum_t project ( datum_t datum , <nl> const pathspec_t & pathspec , recurse_flag_t recurse , <nl> const configured_limits_t & limits ) { <nl> - if ( datum - > get_type ( ) = = datum_t : : R_ARRAY & & recurse = = RECURSE ) { <nl> + if ( datum . get_type ( ) = = datum_t : : R_ARRAY & & recurse = = RECURSE ) { <nl> datum_array_builder_t res ( limits ) ; <nl> res . reserve ( datum . arr_size ( ) ) ; <nl> for ( size_t i = 0 ; i < datum . arr_size ( ) ; + + i ) { <nl> datum_t project ( datum_t datum , <nl> datum_object_builder_t res ; <nl> if ( pathspec . as_str ( ) ! = NULL ) { <nl> datum_string_t str ( * pathspec . as_str ( ) ) ; <nl> - if ( datum_t val = datum - > get_field ( str , NOTHROW ) ) { <nl> + const datum_t val = datum . get_field ( str , NOTHROW ) ; <nl> + if ( val . has ( ) ) { <nl> res . overwrite ( std : : move ( str ) , val ) ; <nl> } <nl> } else if ( const std : : vector < pathspec_t > * vec = pathspec . as_vec ( ) ) { <nl> datum_t project ( datum_t datum , <nl> } <nl> } else if ( const std : : map < datum_string_t , pathspec_t > * map = pathspec . as_map ( ) ) { <nl> for ( auto it = map - > begin ( ) ; it ! = map - > end ( ) ; + + it ) { <nl> - if ( datum_t val = datum - > get_field ( it - > first , NOTHROW ) ) { <nl> + const datum_t val = datum . get_field ( it - > first , NOTHROW ) ; <nl> + if ( val . has ( ) ) { <nl> try { <nl> datum_t sub_result = <nl> project ( val , it - > second , RECURSE , limits ) ; <nl> void unproject_helper ( datum_object_builder_t * datum , <nl> } <nl> } else if ( const std : : map < datum_string_t , pathspec_t > * map = pathspec . as_map ( ) ) { <nl> for ( auto it = map - > begin ( ) ; it ! = map - > end ( ) ; + + it ) { <nl> - if ( datum_t val = datum - > try_get ( it - > first ) ) { <nl> + const datum_t val = datum - > try_get ( it - > first ) ; <nl> + if ( val . has ( ) ) { <nl> try { <nl> datum_t sub_result = <nl> unproject ( val , it - > second , RECURSE , limits ) ; <nl> void unproject_helper ( datum_object_builder_t * datum , <nl> datum_t unproject ( datum_t datum , <nl> const pathspec_t & pathspec , recurse_flag_t recurse , <nl> const configured_limits_t & limits ) { <nl> - if ( datum - > get_type ( ) = = datum_t : : R_ARRAY & & recurse = = RECURSE ) { <nl> + if ( datum . get_type ( ) = = datum_t : : R_ARRAY & & recurse = = RECURSE ) { <nl> datum_array_builder_t res ( limits ) ; <nl> res . reserve ( datum . arr_size ( ) ) ; <nl> for ( size_t i = 0 ; i < datum . arr_size ( ) ; + + i ) { <nl> bool contains ( datum_t datum , <nl> try { <nl> bool res = true ; <nl> if ( const datum_string_t * str = pathspec . as_str ( ) ) { <nl> - if ( ! ( res & = ( datum - > get_field ( * str , NOTHROW ) . has ( ) & & <nl> - datum - > get_field ( * str ) - > get_type ( ) ! = datum_t : : R_NULL ) ) ) { <nl> + if ( ! ( res & = ( datum . get_field ( * str , NOTHROW ) . has ( ) & & <nl> + datum . get_field ( * str ) . get_type ( ) ! = datum_t : : R_NULL ) ) ) { <nl> return res ; <nl> } <nl> } else if ( const std : : vector < pathspec_t > * vec = pathspec . as_vec ( ) ) { <nl> bool contains ( datum_t datum , <nl> } <nl> } else if ( const std : : map < datum_string_t , pathspec_t > * map = pathspec . as_map ( ) ) { <nl> for ( auto it = map - > begin ( ) ; it ! = map - > end ( ) ; + + it ) { <nl> - if ( datum_t val = datum - > get_field ( it - > first , NOTHROW ) ) { <nl> + const datum_t val = datum . get_field ( it - > first , NOTHROW ) ; <nl> + if ( val . has ( ) ) { <nl> if ( ! ( res & = contains ( val , it - > second ) ) ) { <nl> return res ; <nl> } <nl> mmm a / src / rdb_protocol / protocol . cc <nl> ppp b / src / rdb_protocol / protocol . cc <nl> bool datum_range_t : : is_universe ( ) const { <nl> bool datum_range_t : : contains ( reql_version_t reql_version , <nl> ql : : datum_t val ) const { <nl> return ( ! left_bound . has ( ) <nl> - | | left_bound - > compare_lt ( reql_version , * val ) <nl> - | | ( * left_bound = = * val & & left_bound_type = = key_range_t : : closed ) ) <nl> + | | left_bound . compare_lt ( reql_version , val ) <nl> + | | ( left_bound = = val & & left_bound_type = = key_range_t : : closed ) ) <nl> & & ( ! right_bound . has ( ) <nl> - | | right_bound - > compare_gt ( reql_version , * val ) <nl> - | | ( * right_bound = = * val & & right_bound_type = = key_range_t : : closed ) ) ; <nl> + | | right_bound . compare_gt ( reql_version , val ) <nl> + | | ( right_bound = = val & & right_bound_type = = key_range_t : : closed ) ) ; <nl> } <nl> <nl> key_range_t datum_range_t : : to_primary_keyrange ( ) const { <nl> return key_range_t ( <nl> left_bound_type , <nl> left_bound . has ( ) <nl> - ? store_key_t ( left_bound - > print_primary ( ) ) <nl> + ? store_key_t ( left_bound . print_primary ( ) ) <nl> : store_key_t : : min ( ) , <nl> right_bound_type , <nl> right_bound . has ( ) <nl> - ? store_key_t ( right_bound - > print_primary ( ) ) <nl> + ? store_key_t ( right_bound . print_primary ( ) ) <nl> : store_key_t : : max ( ) ) ; <nl> } <nl> <nl> key_range_t datum_range_t : : to_sindex_keyrange ( ) const { <nl> return rdb_protocol : : sindex_key_range ( <nl> left_bound . has ( ) <nl> - ? store_key_t ( left_bound - > truncated_secondary ( ) ) <nl> + ? store_key_t ( left_bound . truncated_secondary ( ) ) <nl> : store_key_t : : min ( ) , <nl> right_bound . has ( ) <nl> - ? store_key_t ( right_bound - > truncated_secondary ( ) ) <nl> + ? store_key_t ( right_bound . truncated_secondary ( ) ) <nl> : store_key_t : : max ( ) ) ; <nl> } <nl> <nl> class rdb_r_unshard_visitor_t : public boost : : static_visitor < void > { <nl> void operator ( ) ( const changefeed_point_stamp_t & ) ; <nl> <nl> private : <nl> + / / Shared by rget_read_t and intersecting_geo_read_t operators <nl> + template < class query_response_t , class query_t > <nl> + void unshard_range_batch ( const query_t & q , sorting_t sorting ) ; <nl> + <nl> const profile_bool_t profile ; <nl> read_response_t * const responses ; / / Cannibalized for efficiency . <nl> const size_t count ; <nl> void rdb_r_unshard_visitor_t : : operator ( ) ( const point_read_t & ) { <nl> * response_out = responses [ 0 ] ; <nl> } <nl> <nl> - void rdb_r_unshard_visitor_t : : operator ( ) ( const intersecting_geo_read_t & ) { <nl> - ql : : datum_array_builder_t combined_results ( ql : : configured_limits_t : : unlimited ) ; <nl> - for ( size_t i = 0 ; i < count ; + + i ) { <nl> - auto res = boost : : get < intersecting_geo_read_response_t > ( & responses [ i ] . response ) ; <nl> - guarantee ( res ! = NULL ) ; <nl> - ql : : exc_t * error = boost : : get < ql : : exc_t > ( & res - > results_or_error ) ; <nl> - if ( error ! = NULL ) { <nl> - response_out - > response = intersecting_geo_read_response_t ( * error ) ; <nl> - return ; <nl> - } <nl> - auto results = boost : : get < ql : : datum_t > ( & res - > results_or_error ) ; <nl> - guarantee ( results ! = NULL ) ; <nl> - for ( size_t j = 0 ; j < results - > arr_size ( ) ; + + j ) { <nl> - combined_results . add ( results - > get ( j ) ) ; <nl> - } <nl> - } <nl> - response_out - > response = intersecting_geo_read_response_t ( <nl> - std : : move ( combined_results ) . to_datum ( ) ) ; <nl> + void rdb_r_unshard_visitor_t : : operator ( ) ( const intersecting_geo_read_t & query ) { <nl> + unshard_range_batch < rget_read_response_t > ( query , sorting_t : : UNORDERED ) ; <nl> } <nl> <nl> void rdb_r_unshard_visitor_t : : operator ( ) ( const nearest_geo_read_t & query ) { <nl> void rdb_r_unshard_visitor_t : : operator ( ) ( const nearest_geo_read_t & query ) { <nl> } <nl> <nl> void rdb_r_unshard_visitor_t : : operator ( ) ( const rget_read_t & rg ) { <nl> - if ( rg . transforms . size ( ) ! = 0 | | rg . terminal ) { <nl> + unshard_range_batch < rget_read_response_t > ( rg , rg . sorting ) ; <nl> + } <nl> + <nl> + template < class query_response_t , class query_t > <nl> + void rdb_r_unshard_visitor_t : : unshard_range_batch ( const query_t & q , sorting_t sorting ) { <nl> + if ( q . transforms . size ( ) ! = 0 | | q . terminal ) { <nl> / / This asserts that the optargs have been initialized . ( There is always a <nl> / / ' db ' optarg . ) We have the same assertion in rdb_read_visitor_t . <nl> - rassert ( rg . optargs . size ( ) ! = 0 ) ; <nl> + rassert ( q . optargs . size ( ) ! = 0 ) ; <nl> } <nl> scoped_ptr_t < profile : : trace_t > trace = ql : : maybe_make_profile_trace ( profile ) ; <nl> - ql : : env_t env ( ctx , interruptor , rg . optargs , trace . get_or_null ( ) ) ; <nl> + ql : : env_t env ( ctx , interruptor , q . optargs , trace . get_or_null ( ) ) ; <nl> <nl> / / Initialize response . <nl> - response_out - > response = rget_read_response_t ( ) ; <nl> - rget_read_response_t * out <nl> - = boost : : get < rget_read_response_t > ( & response_out - > response ) ; <nl> + response_out - > response = query_response_t ( ) ; <nl> + query_response_t * out = boost : : get < query_response_t > ( & response_out - > response ) ; <nl> out - > truncated = false ; <nl> - out - > key_range = read_t ( rg , profile_bool_t : : DONT_PROFILE ) . get_region ( ) . inner ; <nl> <nl> / / Fill in ` truncated ` and ` last_key ` , get responses , abort if there ' s an error . <nl> std : : vector < ql : : result_t * > results ( count ) ; <nl> store_key_t * best = NULL ; <nl> - key_le_t key_le ( rg . sorting ) ; <nl> + key_le_t key_le ( sorting ) ; <nl> for ( size_t i = 0 ; i < count ; + + i ) { <nl> - auto resp = boost : : get < rget_read_response_t > ( & responses [ i ] . response ) ; <nl> + auto resp = boost : : get < query_response_t > ( & responses [ i ] . response ) ; <nl> guarantee ( resp ) ; <nl> if ( resp - > truncated ) { <nl> out - > truncated = true ; <nl> void rdb_r_unshard_visitor_t : : operator ( ) ( const rget_read_t & rg ) { <nl> } <nl> results [ i ] = & resp - > result ; <nl> } <nl> - out - > last_key = ( best ! = NULL ) ? std : : move ( * best ) : key_max ( rg . sorting ) ; <nl> + out - > last_key = ( best ! = NULL ) ? std : : move ( * best ) : key_max ( sorting ) ; <nl> <nl> / / Unshard and finish up . <nl> - scoped_ptr_t < ql : : accumulator_t > acc ( rg . terminal <nl> - ? ql : : make_terminal ( * rg . terminal ) <nl> - : ql : : make_append ( rg . sorting , NULL ) ) ; <nl> + scoped_ptr_t < ql : : accumulator_t > acc ( q . terminal <nl> + ? ql : : make_terminal ( * q . terminal ) <nl> + : ql : : make_append ( sorting , NULL ) ) ; <nl> acc - > unshard ( & env , out - > last_key , results ) ; <nl> acc - > finish ( & out - > result ) ; <nl> } <nl> struct rdb_w_get_region_visitor : public boost : : static_visitor < region_t > { <nl> std : : vector < store_key_t > keys ; <nl> keys . reserve ( bi . inserts . size ( ) ) ; <nl> for ( auto it = bi . inserts . begin ( ) ; it ! = bi . inserts . end ( ) ; + + it ) { <nl> - keys . emplace_back ( ( * it ) - > get_field ( datum_string_t ( bi . pkey ) ) - > print_primary ( ) ) ; <nl> + keys . emplace_back ( ( * it ) . get_field ( datum_string_t ( bi . pkey ) ) . print_primary ( ) ) ; <nl> } <nl> return region_from_keys ( keys ) ; <nl> } <nl> struct rdb_w_shard_visitor_t : public boost : : static_visitor < bool > { <nl> bool operator ( ) ( const batched_insert_t & bi ) const { <nl> std : : vector < ql : : datum_t > shard_inserts ; <nl> for ( auto it = bi . inserts . begin ( ) ; it ! = bi . inserts . end ( ) ; + + it ) { <nl> - store_key_t key ( ( * it ) - > get_field ( datum_string_t ( bi . pkey ) ) - > print_primary ( ) ) ; <nl> + store_key_t key ( ( * it ) . get_field ( datum_string_t ( bi . pkey ) ) . print_primary ( ) ) ; <nl> if ( region_contains_key ( * region , key ) ) { <nl> shard_inserts . push_back ( * it ) ; <nl> } <nl> struct rdb_w_unshard_visitor_t : public boost : : static_visitor < void > { <nl> const ql : : datum_t * stats_i = <nl> boost : : get < ql : : datum_t > ( & responses [ i ] . response ) ; <nl> guarantee ( stats_i ! = NULL ) ; <nl> - stats = stats - > merge ( * stats_i , ql : : stats_merge , * limits , & conditions ) ; <nl> + stats = stats . merge ( * stats_i , ql : : stats_merge , * limits , & conditions ) ; <nl> } <nl> ql : : datum_object_builder_t result ( stats ) ; <nl> result . add_warnings ( conditions , * limits ) ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( rdb_protocol : : single_sindex_status_t ) ; <nl> <nl> RDB_IMPL_SERIALIZABLE_1 ( point_read_response_t , data ) ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( point_read_response_t ) ; <nl> - RDB_IMPL_SERIALIZABLE_4 ( rget_read_response_t , result , key_range , truncated , last_key ) ; <nl> + RDB_IMPL_SERIALIZABLE_3 ( rget_read_response_t , result , truncated , last_key ) ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( rget_read_response_t ) ; <nl> - RDB_IMPL_SERIALIZABLE_1 ( intersecting_geo_read_response_t , results_or_error ) ; <nl> - INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( intersecting_geo_read_response_t ) ; <nl> RDB_IMPL_SERIALIZABLE_1 ( nearest_geo_read_response_t , results_or_error ) ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( nearest_geo_read_response_t ) ; <nl> RDB_IMPL_SERIALIZABLE_2 ( distribution_read_response_t , region , key_counts ) ; <nl> RDB_IMPL_SERIALIZABLE_8 ( <nl> rget_read_t , <nl> region , optargs , table_name , batchspec , transforms , terminal , sindex , sorting ) ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( rget_read_t ) ; <nl> - RDB_MAKE_SERIALIZABLE_5 ( <nl> - intersecting_geo_read_t , optargs , query_geometry , region , table_name , sindex_id ) ; <nl> + RDB_MAKE_SERIALIZABLE_8 ( <nl> + intersecting_geo_read_t , region , optargs , table_name , batchspec , transforms , <nl> + terminal , sindex , query_geometry ) ; <nl> INSTANTIATE_SERIALIZABLE_FOR_CLUSTER ( intersecting_geo_read_t ) ; <nl> RDB_IMPL_SERIALIZABLE_8 ( <nl> nearest_geo_read_t , optargs , center , max_dist , max_results , geo_system , <nl> mmm a / src / rdb_protocol / protocol . hpp <nl> ppp b / src / rdb_protocol / protocol . hpp <nl> class env_t ; <nl> class primary_readgen_t ; <nl> class readgen_t ; <nl> class sindex_readgen_t ; <nl> + class intersecting_readgen_t ; <nl> } / / namespace ql <nl> <nl> class datum_range_t { <nl> class datum_range_t { <nl> friend class ql : : readgen_t ; <nl> friend class ql : : primary_readgen_t ; <nl> friend class ql : : sindex_readgen_t ; <nl> + friend class ql : : intersecting_readgen_t ; <nl> friend struct unittest : : make_sindex_read_t ; <nl> <nl> key_range_t to_primary_keyrange ( ) const ; <nl> struct point_read_response_t { <nl> RDB_DECLARE_SERIALIZABLE ( point_read_response_t ) ; <nl> <nl> struct rget_read_response_t { <nl> - key_range_t key_range ; <nl> ql : : result_t result ; <nl> bool truncated ; <nl> store_key_t last_key ; <nl> struct rget_read_response_t { <nl> <nl> RDB_DECLARE_SERIALIZABLE ( rget_read_response_t ) ; <nl> <nl> - struct intersecting_geo_read_response_t { <nl> - boost : : variant < ql : : datum_t , ql : : exc_t > results_or_error ; <nl> - <nl> - intersecting_geo_read_response_t ( ) { } <nl> - intersecting_geo_read_response_t ( <nl> - const ql : : datum_t & _results ) <nl> - : results_or_error ( _results ) { } <nl> - intersecting_geo_read_response_t ( <nl> - const ql : : exc_t & _error ) <nl> - : results_or_error ( _error ) { } <nl> - } ; <nl> - <nl> - RDB_DECLARE_SERIALIZABLE ( intersecting_geo_read_response_t ) ; <nl> - <nl> struct nearest_geo_read_response_t { <nl> typedef std : : pair < double , ql : : datum_t > dist_pair_t ; <nl> typedef std : : vector < dist_pair_t > result_t ; <nl> RDB_SERIALIZE_OUTSIDE ( changefeed_point_stamp_response_t ) ; <nl> struct read_response_t { <nl> typedef boost : : variant < point_read_response_t , <nl> rget_read_response_t , <nl> - intersecting_geo_read_response_t , <nl> nearest_geo_read_response_t , <nl> changefeed_subscribe_response_t , <nl> changefeed_stamp_response_t , <nl> RDB_DECLARE_SERIALIZABLE ( rget_read_t ) ; <nl> <nl> class intersecting_geo_read_t { <nl> public : <nl> - intersecting_geo_read_t ( ) { } <nl> + intersecting_geo_read_t ( ) : batchspec ( ql : : batchspec_t : : empty ( ) ) { } <nl> <nl> intersecting_geo_read_t ( <nl> - const ql : : datum_t & _query_geometry , <nl> - const std : : string & _table_name , const std : : string & _sindex_id , <nl> - const std : : map < std : : string , ql : : wire_func_t > & _optargs ) <nl> - : optargs ( _optargs ) , <nl> - query_geometry ( _query_geometry ) , <nl> - region ( region_t : : universe ( ) ) , <nl> + const region_t & _region , <nl> + const std : : map < std : : string , ql : : wire_func_t > & _optargs , <nl> + const std : : string & _table_name , <nl> + const ql : : batchspec_t & _batchspec , <nl> + const std : : vector < ql : : transform_variant_t > & _transforms , <nl> + boost : : optional < ql : : terminal_variant_t > & & _terminal , <nl> + sindex_rangespec_t & & _sindex , <nl> + const ql : : datum_t & _query_geometry ) <nl> + : region ( _region ) , <nl> + optargs ( _optargs ) , <nl> table_name ( _table_name ) , <nl> - sindex_id ( _sindex_id ) { } <nl> + batchspec ( _batchspec ) , <nl> + transforms ( _transforms ) , <nl> + terminal ( std : : move ( _terminal ) ) , <nl> + sindex ( std : : move ( _sindex ) ) , <nl> + query_geometry ( _query_geometry ) { } <nl> <nl> + region_t region ; / / Primary key range . We need this because of sharding . <nl> std : : map < std : : string , ql : : wire_func_t > optargs ; <nl> + std : : string table_name ; <nl> + ql : : batchspec_t batchspec ; / / used to size batches <nl> <nl> - ql : : datum_t query_geometry ; / / Tested for intersection <nl> + / / We use these two for lazy maps , reductions , etc . <nl> + std : : vector < ql : : transform_variant_t > transforms ; <nl> + boost : : optional < ql : : terminal_variant_t > terminal ; <nl> <nl> - region_t region ; / / We need this even for sindex reads due to sharding . <nl> - std : : string table_name ; <nl> + sindex_rangespec_t sindex ; <nl> <nl> - std : : string sindex_id ; <nl> + ql : : datum_t query_geometry ; / / Tested for intersection <nl> } ; <nl> RDB_DECLARE_SERIALIZABLE ( intersecting_geo_read_t ) ; <nl> <nl> class nearest_geo_read_t { <nl> nearest_geo_read_t ( ) { } <nl> <nl> nearest_geo_read_t ( <nl> + const region_t & _region , <nl> lat_lon_point_t _center , double _max_dist , uint64_t _max_results , <nl> const ellipsoid_spec_t & _geo_system , const std : : string & _table_name , <nl> const std : : string & _sindex_id , <nl> const std : : map < std : : string , ql : : wire_func_t > & _optargs ) <nl> : optargs ( _optargs ) , center ( _center ) , max_dist ( _max_dist ) , <nl> max_results ( _max_results ) , geo_system ( _geo_system ) , <nl> - region ( region_t : : universe ( ) ) , table_name ( _table_name ) , <nl> + region ( _region ) , table_name ( _table_name ) , <nl> sindex_id ( _sindex_id ) { } <nl> <nl> std : : map < std : : string , ql : : wire_func_t > optargs ; <nl> mmm a / src / rdb_protocol / pseudo_binary . cc <nl> ppp b / src / rdb_protocol / pseudo_binary . cc <nl> datum_string_t decode_base64_ptype ( <nl> datum_string_t res ; <nl> for ( auto it = ptype . begin ( ) ; it ! = ptype . end ( ) ; + + it ) { <nl> if ( it - > first = = datum_t : : reql_type_string ) { <nl> - r_sanity_check ( it - > second - > as_str ( ) = = binary_string ) ; <nl> + r_sanity_check ( it - > second . as_str ( ) = = binary_string ) ; <nl> } else if ( it - > first = = data_key ) { <nl> has_data = true ; <nl> - res = decode_base64 ( it - > second - > as_str ( ) ) ; <nl> + res = decode_base64 ( it - > second . as_str ( ) ) ; <nl> } else { <nl> rfail_datum ( base_exc_t : : GENERIC , <nl> " Invalid binary pseudotype : illegal ` % s ` key . " , <nl> mmm a / src / rdb_protocol / pseudo_geometry . cc <nl> ppp b / src / rdb_protocol / pseudo_geometry . cc <nl> const char * const geometry_string = " GEOMETRY " ; <nl> datum_t geo_sub ( datum_t lhs , <nl> datum_t rhs , <nl> const configured_limits_t & limits ) { <nl> - rcheck_target ( & lhs , base_exc_t : : GENERIC , lhs - > is_ptype ( geometry_string ) , <nl> + rcheck_target ( & lhs , base_exc_t : : GENERIC , lhs . is_ptype ( geometry_string ) , <nl> " Value must be of geometry type . " ) ; <nl> - rcheck_target ( & rhs , base_exc_t : : GENERIC , rhs - > is_ptype ( geometry_string ) , <nl> + rcheck_target ( & rhs , base_exc_t : : GENERIC , rhs . is_ptype ( geometry_string ) , <nl> " Value must be of geometry type . " ) ; <nl> <nl> rcheck_target ( & rhs , base_exc_t : : GENERIC , <nl> - rhs - > get_field ( " coordinates " ) - > arr_size ( ) < = 1 , <nl> + rhs . get_field ( " coordinates " ) . arr_size ( ) < = 1 , <nl> " The second argument to ` sub ` must be a Polygon with only an outer " <nl> " shell . This one has holes . " ) ; <nl> <nl> / / Construct a polygon from lhs with rhs cut out <nl> rcheck_target ( & lhs , base_exc_t : : GENERIC , <nl> - lhs - > get_field ( " type " ) - > as_str ( ) = = " Polygon " , <nl> + lhs . get_field ( " type " ) . as_str ( ) = = " Polygon " , <nl> strprintf ( " The first argument to ` sub ` must be a Polygon . Found ` % s ` . " , <nl> - lhs - > get_field ( " type " ) - > as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> + lhs . get_field ( " type " ) . as_str ( ) . to_std ( ) . c_str ( ) ) ) ; <nl> rcheck_target ( & lhs , base_exc_t : : GENERIC , <nl> - lhs - > get_field ( " coordinates " ) - > arr_size ( ) > = 1 , <nl> + lhs . get_field ( " coordinates " ) . arr_size ( ) > = 1 , <nl> " The first argument to ` sub ` is an empty polygon . It must at least " <nl> " have an outer shell . " ) ; <nl> <nl> mmm a / src / rdb_protocol / pseudo_time . cc <nl> ppp b / src / rdb_protocol / pseudo_time . cc <nl> void add_seconds_to_ptime ( ptime_t * t , double raw_sec ) { <nl> } <nl> <nl> time_t time_to_boost ( datum_t d ) { <nl> - double raw_sec = d - > get_field ( epoch_time_key ) - > as_num ( ) ; <nl> + double raw_sec = d . get_field ( epoch_time_key ) . as_num ( ) ; <nl> ptime_t t ( date_t ( 1970 , 1 , 1 ) ) ; <nl> add_seconds_to_ptime ( & t , raw_sec ) ; <nl> <nl> - if ( datum_t tz = d - > get_field ( timezone_key , NOTHROW ) ) { <nl> + const datum_t tz = d . get_field ( timezone_key , NOTHROW ) ; <nl> + if ( tz . has ( ) ) { <nl> boost : : local_time : : time_zone_ptr zone ( <nl> - new boost : : local_time : : posix_time_zone ( sanitize : : tz ( tz - > as_str ( ) . to_std ( ) ) ) ) ; <nl> + new boost : : local_time : : posix_time_zone ( sanitize : : tz ( tz . as_str ( ) . to_std ( ) ) ) ) ; <nl> return time_t ( t , zone ) ; <nl> } else { <nl> return time_t ( t , utc ) ; <nl> std : : string time_to_iso8601 ( datum_t d ) { <nl> year ) ) ; <nl> std : : ostringstream ss ; <nl> ss . exceptions ( std : : ios_base : : failbit ) ; <nl> - if ( datum_t tz = d - > get_field ( timezone_key , NOTHROW ) ) { <nl> + const datum_t tz = d . get_field ( timezone_key , NOTHROW ) ; <nl> + if ( tz . has ( ) ) { <nl> ss . imbue ( tz_format ) ; <nl> } else { <nl> ss . imbue ( no_tz_format ) ; <nl> std : : string time_to_iso8601 ( datum_t d ) { <nl> } <nl> <nl> double time_to_epoch_time ( datum_t d ) { <nl> - return d - > get_field ( epoch_time_key ) - > as_num ( ) ; <nl> + return d . get_field ( epoch_time_key ) . as_num ( ) ; <nl> } <nl> <nl> datum_t time_now ( ) { <nl> int time_cmp ( reql_version_t reql_version , const datum_t & x , const datum_t & y ) { <nl> / / We know that these are both nums , so the reql_version doesn ' t actually affect <nl> / / anything ( between v1_13 and v1_14_is_latest ) . But it ' s safer not to have to <nl> / / prove that , so we take it and pass it anyway . <nl> - return x . get_field ( epoch_time_key ) - > cmp ( reql_version , * y . get_field ( epoch_time_key ) ) ; <nl> + return x . get_field ( epoch_time_key ) . cmp ( reql_version , y . get_field ( epoch_time_key ) ) ; <nl> } <nl> <nl> double sanitize_epoch_sec ( double d ) { <nl> void sanitize_time ( datum_t * time ) { <nl> } <nl> <nl> datum_t time_tz ( datum_t time ) { <nl> - r_sanity_check ( time - > is_ptype ( time_string ) ) ; <nl> - if ( datum_t tz = time - > get_field ( timezone_key , NOTHROW ) ) { <nl> + r_sanity_check ( time . is_ptype ( time_string ) ) ; <nl> + const datum_t tz = time . get_field ( timezone_key , NOTHROW ) ; <nl> + if ( tz . has ( ) ) { <nl> return tz ; <nl> } else { <nl> return datum_t : : null ( ) ; <nl> datum_t time_tz ( datum_t time ) { <nl> } <nl> <nl> datum_t time_in_tz ( datum_t t , datum_t tz ) { <nl> - r_sanity_check ( t - > is_ptype ( time_string ) ) ; <nl> + r_sanity_check ( t . is_ptype ( time_string ) ) ; <nl> datum_object_builder_t t2 ( t ) ; <nl> - std : : string raw_new_tzs = tz - > as_str ( ) . to_std ( ) ; <nl> + std : : string raw_new_tzs = tz . as_str ( ) . to_std ( ) ; <nl> std : : string new_tzs = sanitize : : tz ( raw_new_tzs ) ; <nl> if ( raw_new_tzs = = new_tzs ) { <nl> t2 . overwrite ( timezone_key , tz ) ; <nl> datum_t make_time ( <nl> <nl> datum_t time_add ( datum_t x , datum_t y ) { <nl> datum_t time , duration ; <nl> - if ( x - > is_ptype ( time_string ) ) { <nl> + if ( x . is_ptype ( time_string ) ) { <nl> time = x ; <nl> duration = y ; <nl> } else { <nl> - r_sanity_check ( y - > is_ptype ( time_string ) ) ; <nl> + r_sanity_check ( y . is_ptype ( time_string ) ) ; <nl> time = y ; <nl> duration = x ; <nl> } <nl> datum_t time_add ( datum_t x , datum_t y ) { <nl> datum_object_builder_t res ( time ) ; <nl> res . overwrite ( <nl> epoch_time_key , <nl> - datum_t ( time - > get_field ( epoch_time_key ) - > as_num ( ) + <nl> - duration - > as_num ( ) ) ) ; <nl> + datum_t ( time . get_field ( epoch_time_key ) . as_num ( ) + <nl> + duration . as_num ( ) ) ) ; <nl> <nl> return std : : move ( res ) . to_datum ( ) ; <nl> } <nl> <nl> datum_t time_sub ( datum_t time , datum_t time_or_duration ) { <nl> - r_sanity_check ( time - > is_ptype ( time_string ) ) ; <nl> + r_sanity_check ( time . is_ptype ( time_string ) ) ; <nl> <nl> - if ( time_or_duration - > is_ptype ( time_string ) ) { <nl> + if ( time_or_duration . is_ptype ( time_string ) ) { <nl> return datum_t ( sanitize_epoch_sec ( <nl> - time - > get_field ( epoch_time_key ) - > as_num ( ) <nl> - - time_or_duration - > get_field ( epoch_time_key ) - > as_num ( ) ) ) ; <nl> + time . get_field ( epoch_time_key ) . as_num ( ) <nl> + - time_or_duration . get_field ( epoch_time_key ) . as_num ( ) ) ) ; <nl> } else { <nl> datum_object_builder_t res ( time ) ; <nl> res . overwrite ( <nl> epoch_time_key , <nl> - datum_t ( time - > get_field ( epoch_time_key ) - > as_num ( ) - <nl> - time_or_duration - > as_num ( ) ) ) ; <nl> + datum_t ( time . get_field ( epoch_time_key ) . as_num ( ) - <nl> + time_or_duration . as_num ( ) ) ) ; <nl> return std : : move ( res ) . to_datum ( ) ; <nl> } <nl> } <nl> double time_portion ( datum_t time , time_component_t c ) { <nl> case HOURS : return ptime . time_of_day ( ) . hours ( ) ; <nl> case MINUTES : return ptime . time_of_day ( ) . minutes ( ) ; <nl> case SECONDS : { <nl> - double frac = modf ( time - > get_field ( epoch_time_key ) - > as_num ( ) , & frac ) ; <nl> + double frac = modf ( time . get_field ( epoch_time_key ) . as_num ( ) , & frac ) ; <nl> frac = round ( frac * 1000 ) / 1000 ; <nl> return ptime . time_of_day ( ) . seconds ( ) + frac ; <nl> } break ; <nl> void time_to_str_key ( const datum_t & d , std : : string * str_out ) { <nl> / / We need to prepend " P " and append a character less than [ a - zA - Z ] so that <nl> / / different pseudotypes sort correctly . <nl> str_out - > append ( std : : string ( " P " ) + time_string + " : " ) ; <nl> - d . get_field ( epoch_time_key ) - > num_to_str_key ( str_out ) ; <nl> + d . get_field ( epoch_time_key ) . num_to_str_key ( str_out ) ; <nl> } <nl> <nl> } / / namespace pseudo <nl> mmm a / src / rdb_protocol / ql2 . proto <nl> ppp b / src / rdb_protocol / ql2 . proto <nl> message Term { <nl> GEOJSON = 157 ; / / OBJECT - > PSEUDOTYPE ( GEOMETRY ) <nl> TO_GEOJSON = 158 ; / / PSEUDOTYPE ( GEOMETRY ) - > OBJECT <nl> POINT = 159 ; / / NUMBER , NUMBER - > PSEUDOTYPE ( GEOMETRY ) <nl> - LINE = 160 ; / / ARRAY - > PSEUDOTYPE ( GEOMETRY ) <nl> - POLYGON = 161 ; / / ARRAY - > PSEUDOTYPE ( GEOMETRY ) <nl> + LINE = 160 ; / / ( ARRAY | PSEUDOTYPE ( GEOMETRY ) ) . . . - > PSEUDOTYPE ( GEOMETRY ) <nl> + POLYGON = 161 ; / / ( ARRAY | PSEUDOTYPE ( GEOMETRY ) ) . . . - > PSEUDOTYPE ( GEOMETRY ) <nl> DISTANCE = 162 ; / / PSEUDOTYPE ( GEOMETRY ) , PSEUDOTYPE ( GEOMETRY ) { geo_system : STRING , unit : STRING } - > NUMBER <nl> INTERSECTS = 163 ; / / PSEUDOTYPE ( GEOMETRY ) , PSEUDOTYPE ( GEOMETRY ) - > BOOL <nl> INCLUDES = 164 ; / / PSEUDOTYPE ( GEOMETRY ) , PSEUDOTYPE ( GEOMETRY ) - > BOOL <nl> CIRCLE = 165 ; / / PSEUDOTYPE ( GEOMETRY ) , NUMBER { num_vertices : NUMBER , geo_system : STRING , unit : STRING , fill : BOOL } - > PSEUDOTYPE ( GEOMETRY ) <nl> - GET_INTERSECTING = 166 ; / / TABLE , PSEUDOTYPE ( GEOMETRY ) { index : ! STRING } - > ARRAY <nl> + GET_INTERSECTING = 166 ; / / TABLE , PSEUDOTYPE ( GEOMETRY ) { index : ! STRING } - > StreamSelection <nl> FILL = 167 ; / / PSEUDOTYPE ( GEOMETRY ) - > PSEUDOTYPE ( GEOMETRY ) <nl> GET_NEAREST = 168 ; / / TABLE , PSEUDOTYPE ( GEOMETRY ) { index : ! STRING , max_results : NUM , max_dist : NUM , geo_system : STRING , unit : STRING } - > ARRAY <nl> } <nl> mmm a / src / rdb_protocol / query_server . cc <nl> ppp b / src / rdb_protocol / query_server . cc <nl> bool rdb_query_server_t : : run_query ( const ql : : protob_t < Query > & query , <nl> <nl> ql : : datum_t noreply = static_optarg ( " noreply " , query ) ; <nl> bool response_needed = ! ( noreply . has ( ) & & <nl> - noreply - > get_type ( ) = = ql : : datum_t : : type_t : : R_BOOL & & <nl> - noreply - > as_bool ( ) ) ; <nl> + noreply . get_type ( ) = = ql : : datum_t : : type_t : : R_BOOL & & <nl> + noreply . as_bool ( ) ) ; <nl> try { <nl> scoped_ops_running_stat_t stat ( & rdb_ctx - > ql_ops_running ) ; <nl> guarantee ( rdb_ctx - > cluster_interface ) ; <nl> mmm a / src / rdb_protocol / rdb_protocol_json . hpp <nl> ppp b / src / rdb_protocol / rdb_protocol_json . hpp <nl> class optional_datum_less_t { <nl> bool operator ( ) ( const ql : : datum_t & a , <nl> const ql : : datum_t & b ) const { <nl> if ( a . has ( ) ) { <nl> - return b . has ( ) & & a - > compare_lt ( reql_version_ , * b ) ; <nl> + return b . has ( ) & & a . compare_lt ( reql_version_ , b ) ; <nl> } else { <nl> return b . has ( ) ; <nl> } <nl> mmm a / src / rdb_protocol / real_table . cc <nl> ppp b / src / rdb_protocol / real_table . cc <nl> const std : : string & real_table_t : : get_pkey ( ) { <nl> <nl> ql : : datum_t real_table_t : : read_row ( ql : : env_t * env , <nl> ql : : datum_t pval , bool use_outdated ) { <nl> - read_t read ( point_read_t ( store_key_t ( pval - > print_primary ( ) ) ) , env - > profile ( ) ) ; <nl> + read_t read ( point_read_t ( store_key_t ( pval . print_primary ( ) ) ) , env - > profile ( ) ) ; <nl> read_response_t res ; <nl> read_with_profile ( env , read , & res , use_outdated ) ; <nl> point_read_response_t * p_res = boost : : get < point_read_response_t > ( & res . response ) ; <nl> counted_t < ql : : datum_stream_t > real_table_t : : read_all ( <nl> bool use_outdated ) { <nl> if ( sindex = = get_pkey ( ) ) { <nl> return make_counted < ql : : lazy_datum_stream_t > ( <nl> - * this , <nl> - use_outdated , <nl> - ql : : primary_readgen_t : : make ( env , table_name , range , sorting ) , <nl> + make_scoped < ql : : rget_reader_t > ( <nl> + * this , <nl> + use_outdated , <nl> + ql : : primary_readgen_t : : make ( env , table_name , range , sorting ) ) , <nl> bt ) ; <nl> } else { <nl> return make_counted < ql : : lazy_datum_stream_t > ( <nl> - * this , <nl> - use_outdated , <nl> - ql : : sindex_readgen_t : : make ( <nl> - env , table_name , sindex , range , sorting ) , <nl> + make_scoped < ql : : rget_reader_t > ( <nl> + * this , <nl> + use_outdated , <nl> + ql : : sindex_readgen_t : : make ( <nl> + env , table_name , sindex , range , sorting ) ) , <nl> bt ) ; <nl> } <nl> } <nl> counted_t < ql : : datum_stream_t > real_table_t : : read_intersecting ( <nl> bool use_outdated , <nl> const ql : : datum_t & query_geometry ) { <nl> <nl> - intersecting_geo_read_t geo_read ( <nl> - query_geometry , table_name , sindex , env - > get_all_optargs ( ) ) ; <nl> - read_t read ( geo_read , env - > profile ( ) ) ; <nl> - read_response_t res ; <nl> - try { <nl> - if ( use_outdated ) { <nl> - namespace_access . get ( ) - > read_outdated ( read , & res , env - > interruptor ) ; <nl> - } else { <nl> - namespace_access . get ( ) - > read ( <nl> - read , & res , order_token_t : : ignore , env - > interruptor ) ; <nl> - } <nl> - } catch ( const cannot_perform_query_exc_t & ex ) { <nl> - rfail_datum ( ql : : base_exc_t : : GENERIC , " Cannot perform read : % s " , ex . what ( ) ) ; <nl> - } <nl> - <nl> - intersecting_geo_read_response_t * g_res = <nl> - boost : : get < intersecting_geo_read_response_t > ( & res . response ) ; <nl> - r_sanity_check ( g_res ) ; <nl> - <nl> - ql : : exc_t * error = boost : : get < ql : : exc_t > ( & g_res - > results_or_error ) ; <nl> - if ( error ! = NULL ) { <nl> - throw * error ; <nl> - } <nl> - <nl> - auto * result = boost : : get < ql : : datum_t > ( & g_res - > results_or_error ) ; <nl> - guarantee ( result ! = NULL ) ; <nl> - return make_counted < ql : : array_datum_stream_t > ( * result , bt ) ; <nl> + return make_counted < ql : : lazy_datum_stream_t > ( <nl> + make_scoped < ql : : intersecting_reader_t > ( <nl> + * this , <nl> + use_outdated , <nl> + ql : : intersecting_readgen_t : : make ( <nl> + env , table_name , sindex , query_geometry ) ) , <nl> + bt ) ; <nl> } <nl> <nl> counted_t < ql : : datum_stream_t > real_table_t : : read_nearest ( <nl> counted_t < ql : : datum_stream_t > real_table_t : : read_nearest ( <nl> const ql : : configured_limits_t & limits ) { <nl> <nl> nearest_geo_read_t geo_read ( <nl> + region_t : : universe ( ) , <nl> center , max_dist , max_results , geo_system , table_name , sindex , <nl> env - > get_all_optargs ( ) ) ; <nl> read_t read ( geo_read , env - > profile ( ) ) ; <nl> ql : : datum_t real_table_t : : write_batched_replace ( ql : : env_t * env , <nl> std : : vector < store_key_t > store_keys ; <nl> store_keys . reserve ( keys . size ( ) ) ; <nl> for ( auto it = keys . begin ( ) ; it ! = keys . end ( ) ; it + + ) { <nl> - store_keys . push_back ( store_key_t ( ( * it ) - > print_primary ( ) ) ) ; <nl> + store_keys . push_back ( store_key_t ( ( * it ) . print_primary ( ) ) ) ; <nl> } <nl> batched_replace_t write ( std : : move ( store_keys ) , pkey , func , <nl> env - > get_all_optargs ( ) , return_changes ) ; <nl> mmm a / src / rdb_protocol / serialize_datum . cc <nl> ppp b / src / rdb_protocol / serialize_datum . cc <nl> <nl> # include " rdb_protocol / serialize_datum . hpp " <nl> <nl> # include < cmath > <nl> + # include < limits > <nl> # include < string > <nl> # include < vector > <nl> <nl> + # include " containers / archive / buffer_stream . hpp " <nl> # include " containers / archive / stl_types . hpp " <nl> # include " containers / archive / versioned . hpp " <nl> # include " containers / counted . hpp " <nl> enum class datum_serialized_type_t { <nl> INT_NEGATIVE = 7 , <nl> INT_POSITIVE = 8 , <nl> R_BINARY = 9 , <nl> + BUF_R_ARRAY = 10 , <nl> + BUF_R_OBJECT = 11 <nl> + } ; <nl> + <nl> + / / Objects and arrays use different word sizes for storing offsets , <nl> + / / depending on the total serialized size of the datum . These are the options . <nl> + enum class datum_offset_size_t { <nl> + U8BIT , <nl> + U16BIT , <nl> + U32BIT , <nl> + U64BIT <nl> + } ; <nl> + <nl> + / / For efficiency reasons , we pre - compute the serialized sizes of the elements <nl> + / / of arrays and objects during serialization . This avoids recomputing them , <nl> + / / which in the worst - case could lead to quadratic serialization costs . <nl> + / / This is the data structure in which we store the sizes . <nl> + struct size_tree_node_t { <nl> + size_t size ; <nl> + std : : vector < size_tree_node_t > child_sizes ; <nl> } ; <nl> <nl> ARCHIVE_PRIM_MAKE_RANGED_SERIALIZABLE ( datum_serialized_type_t , int8_t , <nl> datum_serialized_type_t : : R_ARRAY , <nl> - datum_serialized_type_t : : R_BINARY ) ; <nl> + datum_serialized_type_t : : BUF_R_OBJECT ) ; <nl> <nl> serialization_result_t datum_serialize ( write_message_t * wm , <nl> datum_serialized_type_t type ) { <nl> MUST_USE archive_result_t datum_deserialize ( read_stream_t * s , <nl> return deserialize < cluster_version_t : : LATEST_OVERALL > ( s , type ) ; <nl> } <nl> <nl> - / / This looks like it duplicates code of other deserialization functions . It does . <nl> - / / Keeping this separate means that we don ' t have to worry about whether datum <nl> - / / serialization has changed from cluster version to cluster version . <nl> + / * Forward declarations * / <nl> + size_t datum_serialized_size ( const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + std : : vector < size_tree_node_t > * child_sizes_out ) ; <nl> + serialization_result_t datum_serialize ( <nl> + write_message_t * wm , <nl> + const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + const size_tree_node_t & precomputed_size ) ; <nl> + <nl> + / / Some of the following looks like it duplicates code of other deserialization <nl> + / / functions . It does . Keeping this separate means that we don ' t have to worry <nl> + / / about whether datum serialization has changed from cluster version to cluster <nl> + / / version . <nl> + <nl> + / * Helper functions shared by datum_array_ * and datum_object_ * * / <nl> + <nl> + / / Keep in sync with offset_table_serialized_size <nl> + void serialize_offset_table ( write_message_t * wm , <nl> + datum_t : : type_t datum_type , <nl> + const std : : vector < size_tree_node_t > & elem_sizes , <nl> + datum_offset_size_t offset_size ) { <nl> + rassert ( datum_type = = datum_t : : R_OBJECT | | datum_t : : R_ARRAY ) ; <nl> + const size_t num_elements = <nl> + datum_type = = datum_t : : R_OBJECT <nl> + ? elem_sizes . size ( ) / 2 <nl> + : elem_sizes . size ( ) ; <nl> + <nl> + <nl> + / / num_elements <nl> + serialize_varint_uint64 ( wm , num_elements ) ; <nl> + <nl> + / / the offset table <nl> + size_t next_offset = 0 ; <nl> + for ( size_t i = 1 ; i < num_elements ; + + i ) { <nl> + if ( datum_type = = datum_t : : R_OBJECT ) { <nl> + next_offset + = elem_sizes [ ( i - 1 ) * 2 ] . size ; / / The key <nl> + next_offset + = elem_sizes [ ( i - 1 ) * 2 + 1 ] . size ; / / The value <nl> + } else { <nl> + next_offset + = elem_sizes [ i - 1 ] . size ; <nl> + } <nl> + switch ( offset_size ) { <nl> + case datum_offset_size_t : : U8BIT : <nl> + guarantee ( next_offset < = std : : numeric_limits < uint8_t > : : max ( ) ) ; <nl> + serialize_universal ( wm , static_cast < uint8_t > ( next_offset ) ) ; <nl> + break ; <nl> + case datum_offset_size_t : : U16BIT : <nl> + guarantee ( next_offset < = std : : numeric_limits < uint16_t > : : max ( ) ) ; <nl> + serialize_universal ( wm , static_cast < uint16_t > ( next_offset ) ) ; <nl> + break ; <nl> + case datum_offset_size_t : : U32BIT : <nl> + guarantee ( next_offset < = std : : numeric_limits < uint32_t > : : max ( ) ) ; <nl> + serialize_universal ( wm , static_cast < uint32_t > ( next_offset ) ) ; <nl> + break ; <nl> + case datum_offset_size_t : : U64BIT : <nl> + guarantee ( next_offset < = std : : numeric_limits < uint64_t > : : max ( ) ) ; <nl> + serialize_universal ( wm , static_cast < uint64_t > ( next_offset ) ) ; <nl> + break ; <nl> + default : <nl> + unreachable ( ) ; <nl> + } <nl> + } <nl> + } <nl> <nl> - / / Keep in sync with datum_serialize . <nl> - size_t datum_serialized_size ( const std : : vector < datum_t > & v ) { <nl> - size_t ret = varint_uint64_serialized_size ( v . size ( ) ) ; <nl> - for ( auto it = v . begin ( ) , e = v . end ( ) ; it ! = e ; + + it ) { <nl> - ret + = datum_serialized_size ( * it ) ; <nl> + / / Keep in sync with offset_table_serialized_size <nl> + datum_offset_size_t get_offset_size_from_inner_size ( uint64_t inner_size ) { <nl> + if ( inner_size < = std : : numeric_limits < uint8_t > : : max ( ) ) { <nl> + return datum_offset_size_t : : U8BIT ; <nl> + } else if ( inner_size < = std : : numeric_limits < uint16_t > : : max ( ) ) { <nl> + return datum_offset_size_t : : U16BIT ; <nl> + } else if ( inner_size < = std : : numeric_limits < uint32_t > : : max ( ) ) { <nl> + return datum_offset_size_t : : U32BIT ; <nl> + } else if ( inner_size < = std : : numeric_limits < uint64_t > : : max ( ) ) { <nl> + return datum_offset_size_t : : U64BIT ; <nl> } <nl> - return ret ; <nl> + unreachable ( ) ; <nl> } <nl> <nl> + size_t read_inner_serialized_size_from_buf ( const shared_buf_ref_t < char > & buf ) { <nl> + buffer_read_stream_t s ( buf . get ( ) , buf . get_safety_boundary ( ) ) ; <nl> + uint64_t sz = 0 ; <nl> + guarantee_deserialization ( deserialize_varint_uint64 ( & s , & sz ) , " datum buffer size " ) ; <nl> + guarantee ( sz < = std : : numeric_limits < size_t > : : max ( ) ) ; <nl> + return static_cast < size_t > ( sz ) ; <nl> + } <nl> <nl> - / / Keep in sync with datum_serialized_size . <nl> - serialization_result_t datum_serialize ( write_message_t * wm , <nl> - const std : : vector < datum_t > & v ) { <nl> + / / Keep in sync with serialize_offset_table <nl> + size_t offset_table_serialized_size ( size_t num_elements , <nl> + size_t remaining_inner_size , <nl> + datum_offset_size_t * offset_size_out ) { <nl> + rassert ( offset_size_out ! = NULL ) ; <nl> + <nl> + / / The size of num_elements <nl> + size_t num_elements_sz = varint_uint64_serialized_size ( num_elements ) ; <nl> + <nl> + / / The size of the offset table <nl> + if ( num_elements > 1 ) { <nl> + / / We pick the bit width of the offset table based on the total inner <nl> + / / serialized size of the object , that is num_elements_sz + <nl> + / / remaining_inner_size + offsets_sz . <nl> + / / The advantage of that is that we can later determine the offset size <nl> + / / just from looking at the inner size ( which we serialize explicitly ) . <nl> + <nl> + size_t offsets_sz ; <nl> + / / Try 8 bit offsets first <nl> + * offset_size_out = datum_offset_size_t : : U8BIT ; <nl> + offsets_sz = ( num_elements - 1 ) * serialize_universal_size_t < uint8_t > : : value ; <nl> + / / Do we have to raise to 16 bit ? <nl> + if ( remaining_inner_size + num_elements_sz + offsets_sz > <nl> + std : : numeric_limits < uint8_t > : : max ( ) ) { <nl> + * offset_size_out = datum_offset_size_t : : U16BIT ; <nl> + offsets_sz = ( num_elements - 1 ) * serialize_universal_size_t < uint16_t > : : value ; <nl> + } <nl> + / / Do we have to raise to 32 bit ? <nl> + if ( remaining_inner_size + num_elements_sz + offsets_sz > <nl> + std : : numeric_limits < uint16_t > : : max ( ) ) { <nl> + * offset_size_out = datum_offset_size_t : : U32BIT ; <nl> + offsets_sz = ( num_elements - 1 ) * serialize_universal_size_t < uint32_t > : : value ; <nl> + } <nl> + / / Do we have to raise to 64 bit ? <nl> + if ( remaining_inner_size + num_elements_sz + offsets_sz > <nl> + std : : numeric_limits < uint32_t > : : max ( ) ) { <nl> + * offset_size_out = datum_offset_size_t : : U64BIT ; <nl> + offsets_sz = ( num_elements - 1 ) * serialize_universal_size_t < uint64_t > : : value ; <nl> + } <nl> + return num_elements_sz + offsets_sz ; <nl> + } else { <nl> + * offset_size_out = datum_offset_size_t : : U8BIT ; <nl> + return num_elements_sz ; <nl> + } <nl> + } <nl> + <nl> + / / Keep in sync with datum_object_serialize <nl> + / / Keep in sync with datum_array_serialize <nl> + size_t datum_array_inner_serialized_size ( <nl> + const datum_t & datum , <nl> + const std : : vector < size_tree_node_t > & child_sizes , <nl> + datum_offset_size_t * offset_size_out ) { <nl> + <nl> + / / The size of all ( keys / ) values <nl> + size_t elem_sz = 0 ; <nl> + for ( size_t i = 0 ; i < child_sizes . size ( ) ; + + i ) { <nl> + elem_sz + = child_sizes [ i ] . size ; <nl> + } <nl> + <nl> + / / Plus the offset table size <nl> + const size_t num_elements = <nl> + datum . get_type ( ) = = datum_t : : R_OBJECT <nl> + ? datum . obj_size ( ) <nl> + : datum . arr_size ( ) ; <nl> + return elem_sz + offset_table_serialized_size ( num_elements , <nl> + elem_sz , <nl> + offset_size_out ) ; <nl> + } <nl> + <nl> + <nl> + / / Keep in sync with datum_array_serialize . <nl> + size_t datum_array_serialized_size ( const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + std : : vector < size_tree_node_t > * element_sizes_out ) { <nl> + size_t sz = 0 ; <nl> + <nl> + / / Can we use an existing serialization ? <nl> + const shared_buf_ref_t < char > * existing_buf_ref = datum . get_buf_ref ( ) ; <nl> + if ( existing_buf_ref ! = NULL <nl> + & & check_errors = = check_datum_serialization_errors_t : : NO ) { <nl> + <nl> + / / We don ' t initialize element_sizes_out , but that ' s ok . We don ' t need it <nl> + / / if there already is a serialization . <nl> + sz + = read_inner_serialized_size_from_buf ( * existing_buf_ref ) ; <nl> + } else { <nl> + std : : vector < size_tree_node_t > elem_sizes ; <nl> + elem_sizes . reserve ( datum . arr_size ( ) ) ; <nl> + for ( size_t i = 0 ; i < datum . arr_size ( ) ; + + i ) { <nl> + auto elem = datum . get ( i ) ; <nl> + size_tree_node_t elem_size ; <nl> + elem_size . size = datum_serialized_size ( elem , check_errors , <nl> + & elem_size . child_sizes ) ; <nl> + elem_sizes . push_back ( std : : move ( elem_size ) ) ; <nl> + } <nl> + datum_offset_size_t offset_size ; <nl> + sz + = datum_array_inner_serialized_size ( datum , elem_sizes , & offset_size ) ; <nl> + <nl> + if ( element_sizes_out ! = NULL ) { <nl> + * element_sizes_out = std : : move ( elem_sizes ) ; <nl> + } <nl> + } <nl> + <nl> + / / The inner serialized size <nl> + sz + = varint_uint64_serialized_size ( sz ) ; <nl> + <nl> + return sz ; <nl> + } <nl> + <nl> + <nl> + / / Keep in sync with datum_array_serialized_size . <nl> + / / Keep in sync with datum_get_element_offset . <nl> + / / Keep in sync with datum_get_array_size . <nl> + serialization_result_t datum_array_serialize ( <nl> + write_message_t * wm , <nl> + const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + const size_tree_node_t & precomputed_sizes ) { <nl> + <nl> + / / Can we use an existing serialization ? <nl> + const shared_buf_ref_t < char > * existing_buf_ref = datum . get_buf_ref ( ) ; <nl> + if ( existing_buf_ref ! = NULL <nl> + & & check_errors = = check_datum_serialization_errors_t : : NO ) { <nl> + <nl> + / / Subtract 1 for the type byte , which we don ' t have to rewrite <nl> + wm - > append ( existing_buf_ref - > get ( ) , precomputed_sizes . size - 1 ) ; <nl> + return serialization_result_t : : SUCCESS ; <nl> + } <nl> + <nl> + / / The inner serialized size <nl> + datum_offset_size_t offset_size ; <nl> + serialize_varint_uint64 ( wm , <nl> + datum_array_inner_serialized_size ( datum , precomputed_sizes . child_sizes , <nl> + & offset_size ) ) ; <nl> + <nl> + serialize_offset_table ( wm , datum . get_type ( ) , precomputed_sizes . child_sizes , <nl> + offset_size ) ; <nl> + <nl> + / / The elements <nl> serialization_result_t res = serialization_result_t : : SUCCESS ; <nl> - serialize_varint_uint64 ( wm , v . size ( ) ) ; <nl> - for ( auto it = v . begin ( ) , e = v . end ( ) ; it ! = e ; + + it ) { <nl> - res = res | datum_serialize ( wm , * it ) ; <nl> + rassert ( precomputed_sizes . child_sizes . size ( ) = = datum . arr_size ( ) ) ; <nl> + for ( size_t i = 0 ; i < datum . arr_size ( ) ; + + i ) { <nl> + auto elem = datum . get ( i ) ; <nl> + const size_tree_node_t & child_size = precomputed_sizes . child_sizes [ i ] ; <nl> + res = res | datum_serialize ( wm , elem , check_errors , child_size ) ; <nl> } <nl> + <nl> return res ; <nl> } <nl> <nl> + / / For legacy R_ARRAY datums . BUF_R_ARRAY datums are not deserialized through this . <nl> MUST_USE archive_result_t <nl> datum_deserialize ( read_stream_t * s , std : : vector < datum_t > * v ) { <nl> v - > clear ( ) ; <nl> datum_deserialize ( read_stream_t * s , std : : vector < datum_t > * v ) { <nl> return archive_result_t : : SUCCESS ; <nl> } <nl> <nl> + / / Keep in sync with datum_object_serialize . <nl> + size_t datum_object_serialized_size ( const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + std : : vector < size_tree_node_t > * child_sizes_out ) { <nl> + size_t sz = 0 ; <nl> + <nl> + / / Can we use an existing serialization ? <nl> + const shared_buf_ref_t < char > * existing_buf_ref = datum . get_buf_ref ( ) ; <nl> + if ( existing_buf_ref ! = NULL <nl> + & & check_errors = = check_datum_serialization_errors_t : : NO ) { <nl> <nl> - size_t datum_serialized_size ( <nl> - const std : : vector < std : : pair < datum_string_t , datum_t > > & m ) { <nl> - size_t ret = varint_uint64_serialized_size ( m . size ( ) ) ; <nl> - for ( auto it = m . begin ( ) , e = m . end ( ) ; it ! = e ; + + it ) { <nl> - ret + = datum_serialized_size ( it - > first ) ; <nl> - ret + = datum_serialized_size ( it - > second ) ; <nl> + / / We don ' t initialize element_sizes_out , but that ' s ok . We don ' t need it <nl> + / / if there already is a serialization . <nl> + sz + = read_inner_serialized_size_from_buf ( * existing_buf_ref ) ; <nl> + } else { <nl> + std : : vector < size_tree_node_t > child_sizes ; <nl> + child_sizes . reserve ( datum . obj_size ( ) * 2 ) ; <nl> + for ( size_t i = 0 ; i < datum . obj_size ( ) ; + + i ) { <nl> + auto pair = datum . get_pair ( i ) ; <nl> + size_tree_node_t key_size ; <nl> + key_size . size = datum_serialized_size ( pair . first ) ; <nl> + size_tree_node_t val_size ; <nl> + val_size . size = datum_serialized_size ( pair . second , check_errors , <nl> + & val_size . child_sizes ) ; <nl> + child_sizes . push_back ( std : : move ( key_size ) ) ; <nl> + child_sizes . push_back ( std : : move ( val_size ) ) ; <nl> + } <nl> + datum_offset_size_t offset_size ; <nl> + sz + = datum_array_inner_serialized_size ( datum , child_sizes , & offset_size ) ; <nl> + <nl> + if ( child_sizes_out ! = NULL ) { <nl> + * child_sizes_out = std : : move ( child_sizes ) ; <nl> + } <nl> } <nl> - return ret ; <nl> + <nl> + / / The inner serialized size <nl> + sz + = varint_uint64_serialized_size ( sz ) ; <nl> + <nl> + return sz ; <nl> } <nl> <nl> - serialization_result_t <nl> - datum_serialize ( write_message_t * wm , <nl> - const std : : vector < std : : pair < datum_string_t , datum_t > > & m ) { <nl> + / / Keep in sync with datum_object_serialized_size . <nl> + / / Keep in sync with datum_get_element_offset . <nl> + / / Keep in sync with datum_get_array_size . <nl> + / / Keep in sync with datum_deserialize_pair_from_buf . <nl> + serialization_result_t datum_object_serialize ( <nl> + write_message_t * wm , <nl> + const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + const size_tree_node_t & precomputed_sizes ) { <nl> + <nl> + / / Can we use an existing serialization ? <nl> + const shared_buf_ref_t < char > * existing_buf_ref = datum . get_buf_ref ( ) ; <nl> + if ( existing_buf_ref ! = NULL <nl> + & & check_errors = = check_datum_serialization_errors_t : : NO ) { <nl> + <nl> + / / Subtract 1 for the type byte , which we don ' t have to rewrite <nl> + wm - > append ( existing_buf_ref - > get ( ) , precomputed_sizes . size - 1 ) ; <nl> + return serialization_result_t : : SUCCESS ; <nl> + } <nl> + <nl> + / / The inner serialized size <nl> + datum_offset_size_t offset_size ; <nl> + serialize_varint_uint64 ( wm , <nl> + datum_array_inner_serialized_size ( datum , precomputed_sizes . child_sizes , <nl> + & offset_size ) ) ; <nl> + <nl> + serialize_offset_table ( wm , datum . get_type ( ) , precomputed_sizes . child_sizes , <nl> + offset_size ) ; <nl> + <nl> + / / The pairs <nl> serialization_result_t res = serialization_result_t : : SUCCESS ; <nl> - serialize_varint_uint64 ( wm , m . size ( ) ) ; <nl> - for ( auto it = m . begin ( ) , e = m . end ( ) ; it ! = e ; + + it ) { <nl> - res = res | datum_serialize ( wm , it - > first ) ; <nl> - res = res | datum_serialize ( wm , it - > second ) ; <nl> + rassert ( precomputed_sizes . child_sizes . size ( ) = = datum . obj_size ( ) * 2 ) ; <nl> + for ( size_t i = 0 ; i < datum . obj_size ( ) ; + + i ) { <nl> + auto pair = datum . get_pair ( i ) ; <nl> + const size_tree_node_t & val_size = precomputed_sizes . child_sizes [ i * 2 + 1 ] ; <nl> + res = res | datum_serialize ( wm , pair . first ) ; <nl> + res = res | datum_serialize ( wm , pair . second , check_errors , val_size ) ; <nl> } <nl> + <nl> return res ; <nl> } <nl> <nl> + / / For legacy R_OBJECT datums . BUF_R_OBJECT datums are not deserialized through this . <nl> MUST_USE archive_result_t datum_deserialize ( <nl> read_stream_t * s , <nl> std : : vector < std : : pair < datum_string_t , datum_t > > * m ) { <nl> MUST_USE archive_result_t datum_deserialize ( <nl> } <nl> <nl> <nl> + size_t datum_serialized_size ( const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors ) { <nl> + return datum_serialized_size ( datum , check_errors , NULL ) ; <nl> + } <nl> <nl> - <nl> - size_t datum_serialized_size ( const datum_t & datum ) { <nl> + size_t datum_serialized_size ( const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + std : : vector < size_tree_node_t > * child_sizes_out ) { <nl> + rassert ( child_sizes_out = = NULL | | child_sizes_out - > empty ( ) ) ; <nl> r_sanity_check ( datum . has ( ) ) ; <nl> + / / Update datum_object_serialize ( ) and datum_array_serialize ( ) if the size of <nl> + / / the type prefix should ever change . <nl> size_t sz = 1 ; / / 1 byte for the type <nl> switch ( datum . get_type ( ) ) { <nl> case datum_t : : R_ARRAY : { <nl> - sz + = datum_serialized_size ( datum . get_arr_vec ( ) ) ; <nl> + sz + = datum_array_serialized_size ( datum , check_errors , child_sizes_out ) ; <nl> } break ; <nl> case datum_t : : R_BINARY : { <nl> sz + = datum_serialized_size ( datum . as_binary ( ) ) ; <nl> size_t datum_serialized_size ( const datum_t & datum ) { <nl> } <nl> } break ; <nl> case datum_t : : R_OBJECT : { <nl> - sz + = datum_serialized_size ( datum . get_obj_vec ( ) ) ; <nl> + sz + = datum_object_serialized_size ( datum , check_errors , child_sizes_out ) ; <nl> } break ; <nl> case datum_t : : R_STR : { <nl> sz + = datum_serialized_size ( datum . as_str ( ) ) ; <nl> size_t datum_serialized_size ( const datum_t & datum ) { <nl> } <nl> return sz ; <nl> } <nl> - serialization_result_t datum_serialize ( write_message_t * wm , <nl> - const datum_t & datum ) { <nl> + <nl> + serialization_result_t datum_serialize ( <nl> + write_message_t * wm , <nl> + const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors , <nl> + const size_tree_node_t & precomputed_size ) { <nl> + # ifndef NDEBUG <nl> + const size_t pre_serialization_size = wm - > size ( ) ; <nl> + # endif <nl> serialization_result_t res = serialization_result_t : : SUCCESS ; <nl> + <nl> r_sanity_check ( datum . has ( ) ) ; <nl> - switch ( datum - > get_type ( ) ) { <nl> + switch ( datum . get_type ( ) ) { <nl> case datum_t : : R_ARRAY : { <nl> - res = res | datum_serialize ( wm , datum_serialized_type_t : : R_ARRAY ) ; <nl> - const std : : vector < datum_t > & value = datum - > get_arr_vec ( ) ; <nl> - if ( value . size ( ) > 100000 ) <nl> + res = res | datum_serialize ( wm , datum_serialized_type_t : : BUF_R_ARRAY ) ; <nl> + if ( datum . arr_size ( ) > 100000 ) <nl> res = res | serialization_result_t : : ARRAY_TOO_BIG ; <nl> - res = res | datum_serialize ( wm , value ) ; <nl> + res = res | datum_array_serialize ( wm , datum , check_errors , precomputed_size ) ; <nl> } break ; <nl> case datum_t : : R_BINARY : { <nl> datum_serialize ( wm , datum_serialized_type_t : : R_BINARY ) ; <nl> - const datum_string_t & value = datum - > as_binary ( ) ; <nl> + const datum_string_t & value = datum . as_binary ( ) ; <nl> datum_serialize ( wm , value ) ; <nl> } break ; <nl> case datum_t : : R_BOOL : { <nl> res = res | datum_serialize ( wm , datum_serialized_type_t : : R_BOOL ) ; <nl> - bool value = datum - > as_bool ( ) ; <nl> + bool value = datum . as_bool ( ) ; <nl> serialize_universal ( wm , value ) ; <nl> } break ; <nl> case datum_t : : R_NULL : { <nl> res = res | datum_serialize ( wm , datum_serialized_type_t : : R_NULL ) ; <nl> } break ; <nl> case datum_t : : R_NUM : { <nl> - double value = datum - > as_num ( ) ; <nl> + double value = datum . as_num ( ) ; <nl> int64_t i ; <nl> if ( number_as_integer ( value , & i ) ) { <nl> / / We serialize the signed - zero double , - 0 . 0 , with INT_NEGATIVE . <nl> serialization_result_t datum_serialize ( write_message_t * wm , <nl> } <nl> } break ; <nl> case datum_t : : R_OBJECT : { <nl> - res = res | datum_serialize ( wm , datum_serialized_type_t : : R_OBJECT ) ; <nl> - res = res | datum_serialize ( wm , datum - > get_obj_vec ( ) ) ; <nl> + res = res | datum_serialize ( wm , datum_serialized_type_t : : BUF_R_OBJECT ) ; <nl> + res = res | datum_object_serialize ( wm , datum , check_errors , precomputed_size ) ; <nl> } break ; <nl> case datum_t : : R_STR : { <nl> res = res | datum_serialize ( wm , datum_serialized_type_t : : R_STR ) ; <nl> - const datum_string_t & value = datum - > as_str ( ) ; <nl> + const datum_string_t & value = datum . as_str ( ) ; <nl> res = res | datum_serialize ( wm , value ) ; <nl> } break ; <nl> case datum_t : : UNINITIALIZED : / / fallthru <nl> default : <nl> unreachable ( ) ; <nl> } <nl> + <nl> + rassert ( wm - > size ( ) = = pre_serialization_size + precomputed_size . size ) ; <nl> return res ; <nl> } <nl> + <nl> + serialization_result_t datum_serialize ( <nl> + write_message_t * wm , <nl> + const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors ) { <nl> + / / Precompute serialized sizes <nl> + size_tree_node_t size ; <nl> + size . size = datum_serialized_size ( datum , check_errors , & size . child_sizes ) ; <nl> + <nl> + return datum_serialize ( wm , datum , check_errors , size ) ; <nl> + } <nl> + <nl> archive_result_t datum_deserialize ( read_stream_t * s , datum_t * datum ) { <nl> / / Datums on disk should always be read no matter how stupid big <nl> / / they are ; there ' s no way to fix the problem otherwise . <nl> archive_result_t datum_deserialize ( read_stream_t * s , datum_t * datum ) { <nl> return archive_result_t : : RANGE_ERROR ; <nl> } <nl> } break ; <nl> + case datum_serialized_type_t : : BUF_R_ARRAY : / / fallthru <nl> + case datum_serialized_type_t : : BUF_R_OBJECT : <nl> + { <nl> + / / First read the serialized size of the buffer <nl> + uint64_t ser_size ; <nl> + res = deserialize_varint_uint64 ( s , & ser_size ) ; <nl> + if ( bad ( res ) ) { <nl> + return res ; <nl> + } <nl> + const size_t ser_size_sz = varint_uint64_serialized_size ( ser_size ) ; <nl> + if ( ser_size > std : : numeric_limits < size_t > : : max ( ) - ser_size_sz <nl> + | | ser_size > static_cast < uint64_t > ( std : : numeric_limits < int64_t > : : max ( ) ) <nl> + - ser_size_sz ) { <nl> + return archive_result_t : : RANGE_ERROR ; <nl> + } <nl> + <nl> + / / Then read the data into a shared_buf_t <nl> + counted_t < shared_buf_t > buf = shared_buf_t : : create ( static_cast < size_t > ( ser_size ) + ser_size_sz ) ; <nl> + serialize_varint_uint64_into_buf ( ser_size , reinterpret_cast < uint8_t * > ( buf - > data ( ) ) ) ; <nl> + int64_t num_read = force_read ( s , buf - > data ( ) + ser_size_sz , ser_size ) ; <nl> + if ( num_read = = - 1 ) { <nl> + return archive_result_t : : SOCK_ERROR ; <nl> + } <nl> + if ( static_cast < uint64_t > ( num_read ) < ser_size ) { <nl> + return archive_result_t : : SOCK_EOF ; <nl> + } <nl> + <nl> + / / . . . from which we create the datum_t <nl> + datum_t : : type_t dtype = type = = datum_serialized_type_t : : BUF_R_ARRAY <nl> + ? datum_t : : R_ARRAY <nl> + : datum_t : : R_OBJECT ; <nl> + try { <nl> + * datum = datum_t ( dtype , shared_buf_ref_t < char > ( std : : move ( buf ) , 0 ) ) ; <nl> + } catch ( const base_exc_t & ) { <nl> + return archive_result_t : : RANGE_ERROR ; <nl> + } <nl> + } break ; <nl> default : <nl> return archive_result_t : : RANGE_ERROR ; <nl> } <nl> archive_result_t datum_deserialize ( read_stream_t * s , datum_t * datum ) { <nl> return archive_result_t : : SUCCESS ; <nl> } <nl> <nl> + datum_t datum_deserialize_from_buf ( const shared_buf_ref_t < char > & buf , size_t at_offset ) { <nl> + / / Peek into the buffer to find out the type of the datum in there . <nl> + / / If it ' s a string , buf_object or buf_array , we just create a datum from a <nl> + / / child buf_ref and are done . <nl> + / / Otherwise we create a buffer_read_stream_t and deserialize the datum from <nl> + / / there . <nl> + buf . guarantee_in_boundary ( at_offset ) ; <nl> + buffer_read_stream_t read_stream ( buf . get ( ) + at_offset , <nl> + buf . get_safety_boundary ( ) - at_offset ) ; <nl> + datum_serialized_type_t type = datum_serialized_type_t : : R_NULL ; <nl> + guarantee_deserialization ( datum_deserialize ( & read_stream , & type ) , " datum type from buf " ) ; <nl> + <nl> + switch ( type ) { <nl> + case datum_serialized_type_t : : R_STR : { <nl> + const size_t data_offset = at_offset + static_cast < size_t > ( read_stream . tell ( ) ) ; <nl> + return datum_t ( datum_string_t ( buf . make_child ( data_offset ) ) ) ; <nl> + } <nl> + case datum_serialized_type_t : : BUF_R_ARRAY : { <nl> + const size_t data_offset = at_offset + static_cast < size_t > ( read_stream . tell ( ) ) ; <nl> + return datum_t ( datum_t : : R_ARRAY , buf . make_child ( data_offset ) ) ; <nl> + } <nl> + case datum_serialized_type_t : : BUF_R_OBJECT : { <nl> + const size_t data_offset = at_offset + static_cast < size_t > ( read_stream . tell ( ) ) ; <nl> + return datum_t ( datum_t : : R_OBJECT , buf . make_child ( data_offset ) ) ; <nl> + } <nl> + case datum_serialized_type_t : : R_BINARY : { <nl> + const size_t data_offset = at_offset + static_cast < size_t > ( read_stream . tell ( ) ) ; <nl> + return datum_t ( datum_t : : construct_binary_t ( ) , <nl> + datum_string_t ( buf . make_child ( data_offset ) ) ) ; <nl> + } <nl> + case datum_serialized_type_t : : R_ARRAY : / / fallthru <nl> + case datum_serialized_type_t : : R_BOOL : / / fallthru <nl> + case datum_serialized_type_t : : R_NULL : / / fallthru <nl> + case datum_serialized_type_t : : DOUBLE : / / fallthru <nl> + case datum_serialized_type_t : : R_OBJECT : / / fallthru <nl> + case datum_serialized_type_t : : INT_NEGATIVE : / / fallthru <nl> + case datum_serialized_type_t : : INT_POSITIVE : { <nl> + buffer_read_stream_t data_read_stream ( buf . get ( ) + at_offset , <nl> + buf . get_safety_boundary ( ) - at_offset ) ; <nl> + datum_t res ; <nl> + guarantee_deserialization ( datum_deserialize ( & data_read_stream , & res ) , <nl> + " datum from buf " ) ; <nl> + return res ; <nl> + } <nl> + default : <nl> + unreachable ( ) ; <nl> + } <nl> + } <nl> + <nl> + std : : pair < datum_string_t , datum_t > datum_deserialize_pair_from_buf ( <nl> + const shared_buf_ref_t < char > & buf , size_t at_offset ) { <nl> + datum_string_t key ( buf . make_child ( at_offset ) ) ; <nl> + / / Relies on the fact that the datum_string_t serialization format hasn ' t <nl> + / / changed , specifically that we would still get the same size if we re - serialized <nl> + / / the datum_string_t now . <nl> + const size_t key_ser_size = datum_serialized_size ( key ) ; <nl> + <nl> + datum_t value ( datum_deserialize_from_buf ( buf , at_offset + key_ser_size ) ) ; <nl> + <nl> + return std : : make_pair ( std : : move ( key ) , std : : move ( value ) ) ; <nl> + } <nl> + <nl> + / * The format of ` array ` is : <nl> + varint ser_size <nl> + varint num_elements <nl> + . . . * / <nl> + size_t datum_get_array_size ( const shared_buf_ref_t < char > & array ) { <nl> + buffer_read_stream_t sz_read_stream ( array . get ( ) , array . get_safety_boundary ( ) ) ; <nl> + uint64_t ser_size ; <nl> + guarantee_deserialization ( deserialize_varint_uint64 ( & sz_read_stream , & ser_size ) , <nl> + " datum decode array " ) ; <nl> + uint64_t num_elements = 0 ; <nl> + guarantee_deserialization ( deserialize_varint_uint64 ( & sz_read_stream , & num_elements ) , <nl> + " datum decode array " ) ; <nl> + guarantee ( num_elements < = std : : numeric_limits < size_t > : : max ( ) ) ; <nl> + return static_cast < size_t > ( num_elements ) ; <nl> + } <nl> + <nl> + / * The format of ` array ` is : <nl> + varint ser_size <nl> + varint num_elements <nl> + uint * _t offsets [ num_elements - 1 ] / / counted from ` data ` , first element omitted <nl> + T data [ num_elements ] * / <nl> + size_t datum_get_element_offset ( const shared_buf_ref_t < char > & array , size_t index ) { <nl> + buffer_read_stream_t sz_read_stream ( array . get ( ) , array . get_safety_boundary ( ) ) ; <nl> + uint64_t ser_size = 0 ; <nl> + guarantee_deserialization ( deserialize_varint_uint64 ( & sz_read_stream , & ser_size ) , <nl> + " datum decode array " ) ; <nl> + const datum_offset_size_t offset_size = get_offset_size_from_inner_size ( ser_size ) ; <nl> + size_t serialized_offset_size ; <nl> + switch ( offset_size ) { <nl> + case datum_offset_size_t : : U8BIT : <nl> + serialized_offset_size = serialize_universal_size_t < uint8_t > : : value ; break ; <nl> + case datum_offset_size_t : : U16BIT : <nl> + serialized_offset_size = serialize_universal_size_t < uint16_t > : : value ; break ; <nl> + case datum_offset_size_t : : U32BIT : <nl> + serialized_offset_size = serialize_universal_size_t < uint32_t > : : value ; break ; <nl> + case datum_offset_size_t : : U64BIT : <nl> + serialized_offset_size = serialize_universal_size_t < uint64_t > : : value ; break ; <nl> + default : <nl> + unreachable ( ) ; <nl> + } <nl> + <nl> + uint64_t num_elements = 0 ; <nl> + guarantee_deserialization ( deserialize_varint_uint64 ( & sz_read_stream , & num_elements ) , <nl> + " datum decode array " ) ; <nl> + guarantee ( num_elements < = std : : numeric_limits < size_t > : : max ( ) ) ; <nl> + const size_t sz = static_cast < size_t > ( num_elements ) ; <nl> + <nl> + guarantee ( index < sz ) ; <nl> + <nl> + rassert ( sz > 0 ) ; <nl> + const size_t data_offset = <nl> + static_cast < size_t > ( sz_read_stream . tell ( ) ) <nl> + + ( num_elements - 1 ) * serialized_offset_size ; <nl> + <nl> + if ( index = = 0 ) { <nl> + return data_offset ; <nl> + } else { <nl> + const size_t element_offset_offset = <nl> + static_cast < size_t > ( sz_read_stream . tell ( ) ) <nl> + + ( index - 1 ) * serialized_offset_size ; <nl> + <nl> + array . guarantee_in_boundary ( element_offset_offset ) ; <nl> + buffer_read_stream_t read_stream ( <nl> + array . get ( ) + element_offset_offset , <nl> + array . get_safety_boundary ( ) - element_offset_offset ) ; <nl> + <nl> + uint64_t element_offset ; <nl> + switch ( offset_size ) { <nl> + case datum_offset_size_t : : U8BIT : { <nl> + uint8_t off ; <nl> + guarantee_deserialization ( deserialize_universal ( & read_stream , & off ) , <nl> + " datum decode array offset " ) ; <nl> + element_offset = off ; <nl> + } break ; <nl> + case datum_offset_size_t : : U16BIT : { <nl> + uint16_t off ; <nl> + guarantee_deserialization ( deserialize_universal ( & read_stream , & off ) , <nl> + " datum decode array offset " ) ; <nl> + element_offset = off ; <nl> + } break ; <nl> + case datum_offset_size_t : : U32BIT : { <nl> + uint32_t off ; <nl> + guarantee_deserialization ( deserialize_universal ( & read_stream , & off ) , <nl> + " datum decode array offset " ) ; <nl> + element_offset = off ; <nl> + } break ; <nl> + case datum_offset_size_t : : U64BIT : { <nl> + uint64_t off ; <nl> + guarantee_deserialization ( deserialize_universal ( & read_stream , & off ) , <nl> + " datum decode array offset " ) ; <nl> + element_offset = off ; <nl> + } break ; <nl> + } <nl> + guarantee ( element_offset < = std : : numeric_limits < size_t > : : max ( ) , <nl> + " Datum too large for this architecture . " ) ; <nl> + <nl> + return data_offset + static_cast < size_t > ( element_offset ) ; <nl> + } <nl> + } <nl> <nl> size_t datum_serialized_size ( const datum_string_t & s ) { <nl> const size_t s_size = s . size ( ) ; <nl> mmm a / src / rdb_protocol / serialize_datum . hpp <nl> ppp b / src / rdb_protocol / serialize_datum . hpp <nl> <nl> # ifndef RDB_PROTOCOL_SERIALIZE_DATUM_HPP_ <nl> # define RDB_PROTOCOL_SERIALIZE_DATUM_HPP_ <nl> <nl> + # include < utility > <nl> + <nl> # include " containers / archive / archive . hpp " <nl> # include " containers / archive / buffer_group_stream . hpp " <nl> # include " containers / counted . hpp " <nl> + # include " containers / shared_buffer . hpp " <nl> # include " rdb_protocol / datum_string . hpp " <nl> <nl> namespace ql { <nl> inline const serialization_result_t & operator | ( const serialization_result_t & f <nl> return second ; <nl> } <nl> <nl> + / / Error checking during serialization comes at an additional cost , because <nl> + / / arrays and objects need to be recursed into to check whether their members adhere <nl> + / / to the size limit . <nl> + / / That ' s why we have a flag to turn it on only when necessary : <nl> + enum class check_datum_serialization_errors_t { YES , NO } ; <nl> + <nl> / / More stable versions of datum serialization , kept separate from the versioned <nl> / / serialization functions . Don ' t change these in a backwards - uncompatible way ! See <nl> / / the FAQ at the end of this file . <nl> - size_t datum_serialized_size ( const datum_t & datum ) ; <nl> - serialization_result_t datum_serialize ( write_message_t * wm , const datum_t & datum ) ; <nl> + size_t datum_serialized_size ( const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors ) ; <nl> + serialization_result_t datum_serialize ( write_message_t * wm , const datum_t & datum , <nl> + check_datum_serialization_errors_t check_errors ) ; <nl> archive_result_t datum_deserialize ( read_stream_t * s , datum_t * datum ) ; <nl> <nl> + datum_t datum_deserialize_from_buf ( const shared_buf_ref_t < char > & buf , size_t at_offset ) ; <nl> + std : : pair < datum_string_t , datum_t > datum_deserialize_pair_from_buf ( <nl> + const shared_buf_ref_t < char > & buf , size_t at_offset ) ; <nl> + <nl> + / / Finds the offset of the given array element in the buffer <nl> + size_t datum_get_element_offset ( const shared_buf_ref_t < char > & array , size_t index ) ; <nl> + / / Reads the number of elements in the array stored in the buffer <nl> + size_t datum_get_array_size ( const shared_buf_ref_t < char > & array ) ; <nl> + <nl> size_t datum_serialized_size ( const datum_string_t & s ) ; <nl> serialization_result_t datum_serialize ( write_message_t * wm , const datum_string_t & s ) ; <nl> <nl> MUST_USE archive_result_t datum_deserialize ( read_stream_t * s , datum_string_t * ou <nl> / / The versioned serialization functions . <nl> template < cluster_version_t W > <nl> size_t serialized_size ( const datum_t & datum ) { <nl> - return datum_serialized_size ( datum ) ; <nl> + return datum_serialized_size ( datum , check_datum_serialization_errors_t : : NO ) ; <nl> } <nl> template < cluster_version_t W > <nl> void serialize ( write_message_t * wm , const datum_t & datum ) { <nl> / / ignore the datum_serialize result for in memory writes <nl> - datum_serialize ( wm , datum ) ; <nl> + datum_serialize ( wm , datum , check_datum_serialization_errors_t : : NO ) ; <nl> } <nl> template < cluster_version_t W > <nl> archive_result_t deserialize ( read_stream_t * s , datum_t * datum ) { <nl> mmm a / src / rdb_protocol / serialize_datum_onto_blob . hpp <nl> ppp b / src / rdb_protocol / serialize_datum_onto_blob . hpp <nl> datum_serialize_onto_blob ( buf_parent_t parent , blob_t * blob , <nl> / / bunch of virtual function calls that way . But we do _deserialize_ off an <nl> / / abstract stream type already , so what ' s the big deal ? ) <nl> write_message_t wm ; <nl> - ql : : serialization_result_t res = datum_serialize ( & wm , value ) ; <nl> + / / Check for errors to enforce the static array size limit when writing <nl> + / / to disk <nl> + ql : : serialization_result_t res = <nl> + datum_serialize ( & wm , value , <nl> + ql : : check_datum_serialization_errors_t : : YES ) ; <nl> if ( bad ( res ) ) return res ; <nl> write_onto_blob ( parent , blob , wm ) ; <nl> return res ; <nl> mmm a / src / rdb_protocol / shards . cc <nl> ppp b / src / rdb_protocol / shards . cc <nl> void dprint ( const char * s , const T & ) { <nl> template < > <nl> void dprint ( const char * s , const datum_t & t ) { <nl> if ( t . has ( ) ) { <nl> - debugf ( " % s - > % s \ n " , s , t - > print ( ) . c_str ( ) ) ; <nl> + debugf ( " % s - > % s \ n " , s , t . print ( ) . c_str ( ) ) ; <nl> } else { <nl> debugf ( " % s - > NULL \ n " , s ) ; <nl> } <nl> class sum_terminal_t : public skip_terminal_t < double > { <nl> const datum_t & el , <nl> double * out , <nl> const acc_func_t & f ) { <nl> - * out + = f ( env , el ) - > as_num ( ) ; <nl> + * out + = f ( env , el ) . as_num ( ) ; <nl> } <nl> virtual datum_t unpack ( double * d ) { <nl> return datum_t ( * d ) ; <nl> class avg_terminal_t : public skip_terminal_t < std : : pair < double , uint64_t > > { <nl> const datum_t & el , <nl> std : : pair < double , uint64_t > * out , <nl> const acc_func_t & f ) { <nl> - out - > first + = f ( env , el ) - > as_num ( ) ; <nl> + out - > first + = f ( env , el ) . as_num ( ) ; <nl> out - > second + = 1 ; <nl> } <nl> virtual datum_t unpack ( <nl> bool datum_lt ( reql_version_t reql_version , <nl> const datum_t & val1 , <nl> const datum_t & val2 ) { <nl> r_sanity_check ( val1 . has ( ) & & val2 . has ( ) ) ; <nl> - return val1 - > compare_lt ( reql_version , * val2 ) ; <nl> + return val1 . compare_lt ( reql_version , val2 ) ; <nl> } <nl> <nl> bool datum_gt ( reql_version_t reql_version , <nl> const datum_t & val1 , <nl> const datum_t & val2 ) { <nl> r_sanity_check ( val1 . has ( ) & & val2 . has ( ) ) ; <nl> - return val1 - > compare_gt ( reql_version , * val2 ) ; <nl> + return val1 . compare_gt ( reql_version , val2 ) ; <nl> } <nl> <nl> class optimizing_terminal_t : public skip_terminal_t < optimizer_t > { <nl> class group_trans_t : public op_t { <nl> } else { <nl> std : : vector < std : : vector < datum_t > > perms ( arr . size ( ) ) ; <nl> for ( size_t i = 0 ; i < arr . size ( ) ; + + i ) { <nl> - if ( arr [ i ] - > get_type ( ) ! = datum_t : : R_ARRAY ) { <nl> + if ( arr [ i ] . get_type ( ) ! = datum_t : : R_ARRAY ) { <nl> perms [ i ] . push_back ( arr [ i ] ) ; <nl> } else { <nl> perms [ i ] . reserve ( arr [ i ] . arr_size ( ) ) ; <nl> class distinct_trans_t : public ungrouped_op_t { <nl> r_sanity_check ( sindex_val . has ( ) ) ; <nl> * it = sindex_val ; <nl> } <nl> - if ( ! last_val . has ( ) | | * * it ! = * last_val ) { <nl> + if ( ! last_val . has ( ) | | * it ! = last_val ) { <nl> std : : swap ( * loc , * it ) ; <nl> last_val = * loc ; <nl> + + loc ; <nl> class zip_trans_t : public ungrouped_op_t { <nl> virtual void lst_transform ( env_t * , datums_t * lst , <nl> const datum_t & ) { <nl> for ( auto it = lst - > begin ( ) ; it ! = lst - > end ( ) ; + + it ) { <nl> - auto left = ( * it ) - > get_field ( " left " , NOTHROW ) ; <nl> - auto right = ( * it ) - > get_field ( " right " , NOTHROW ) ; <nl> + auto left = ( * it ) . get_field ( " left " , NOTHROW ) ; <nl> + auto right = ( * it ) . get_field ( " right " , NOTHROW ) ; <nl> rcheck_datum ( left . has ( ) , base_exc_t : : GENERIC , <nl> " ZIP can only be called on the result of a join . " ) ; <nl> - * it = right . has ( ) ? left - > merge ( right ) : left ; <nl> + * it = right . has ( ) ? left . merge ( right ) : left ; <nl> } <nl> } <nl> } ; <nl> mmm a / src / rdb_protocol / shards . hpp <nl> ppp b / src / rdb_protocol / shards . hpp <nl> class grouped_pair_compare_t { <nl> const std : : pair < datum_t , T > & b ) const { <nl> / / We know the keys are different , this is only used in <nl> / / iterate_ordered_by_version . <nl> - return a . first - > compare_lt ( reql_version , * b . first ) ; <nl> + return a . first . compare_lt ( reql_version , b . first ) ; <nl> } <nl> <nl> private : <nl> mmm a / src / rdb_protocol / store . cc <nl> ppp b / src / rdb_protocol / store . cc <nl> struct rdb_read_visitor_t : public boost : : static_visitor < void > { <nl> void operator ( ) ( const intersecting_geo_read_t & geo_read ) { <nl> ql : : env_t ql_env ( ctx , interruptor , geo_read . optargs , trace ) ; <nl> <nl> - response - > response = intersecting_geo_read_response_t ( ) ; <nl> - intersecting_geo_read_response_t * res = <nl> - boost : : get < intersecting_geo_read_response_t > ( & response - > response ) ; <nl> + response - > response = rget_read_response_t ( ) ; <nl> + rget_read_response_t * res = boost : : get < rget_read_response_t > ( & response - > response ) ; <nl> <nl> sindex_disk_info_t sindex_info ; <nl> uuid_u sindex_uuid ; <nl> scoped_ptr_t < real_superblock_t > sindex_sb ; <nl> try { <nl> sindex_sb = <nl> - acquire_sindex_for_read ( geo_read . table_name , geo_read . sindex_id , <nl> + acquire_sindex_for_read ( geo_read . table_name , geo_read . sindex . id , <nl> & sindex_info , & sindex_uuid ) ; <nl> } catch ( const ql : : exc_t & e ) { <nl> - res - > results_or_error = e ; <nl> + res - > result = e ; <nl> return ; <nl> } <nl> <nl> if ( sindex_info . geo ! = sindex_geo_bool_t : : GEO ) { <nl> - res - > results_or_error = ql : : exc_t ( <nl> + res - > result = ql : : exc_t ( <nl> ql : : base_exc_t : : GENERIC , <nl> strprintf ( <nl> " Index ` % s ` is not a geospatial index . get_intersecting can only " <nl> " be used with a geospatial index . " , <nl> - geo_read . sindex_id . c_str ( ) ) , <nl> + geo_read . sindex . id . c_str ( ) ) , <nl> NULL ) ; <nl> return ; <nl> } <nl> struct rdb_read_visitor_t : public boost : : static_visitor < void > { <nl> rdb_get_intersecting_slice ( <nl> store - > get_sindex_slice ( sindex_uuid ) , <nl> geo_read . query_geometry , <nl> - sindex_sb . get ( ) , & ql_env , <nl> - geo_read . region . inner , sindex_info , res ) ; <nl> + geo_read . sindex . region , <nl> + sindex_sb . get ( ) , <nl> + & ql_env , <nl> + geo_read . batchspec , <nl> + geo_read . transforms , <nl> + geo_read . terminal , <nl> + geo_read . region . inner , <nl> + sindex_info , <nl> + res ) ; <nl> } <nl> <nl> void operator ( ) ( const nearest_geo_read_t & geo_read ) { <nl> struct rdb_write_visitor_t : public boost : : static_visitor < void > { <nl> std : : vector < store_key_t > keys ; <nl> keys . reserve ( bi . inserts . size ( ) ) ; <nl> for ( auto it = bi . inserts . begin ( ) ; it ! = bi . inserts . end ( ) ; + + it ) { <nl> - keys . emplace_back ( ( * it ) - > get_field ( datum_string_t ( bi . pkey ) ) - > print_primary ( ) ) ; <nl> + keys . emplace_back ( ( * it ) . get_field ( datum_string_t ( bi . pkey ) ) . print_primary ( ) ) ; <nl> } <nl> response - > response = <nl> rdb_batched_replace ( <nl> mmm a / src / rdb_protocol / stream_cache . cc <nl> ppp b / src / rdb_protocol / stream_cache . cc <nl> bool stream_cache_t : : serve ( int64_t key , Response * res , signal_t * interruptor ) { <nl> batchspec_t : : user ( batch_type , & env ) ) ; <nl> entry - > has_sent_batch = true ; <nl> for ( auto d = ds . begin ( ) ; d ! = ds . end ( ) ; + + d ) { <nl> - ( * d ) - > write_to_protobuf ( res - > add_response ( ) , entry - > use_json ) ; <nl> + d - > write_to_protobuf ( res - > add_response ( ) , entry - > use_json ) ; <nl> } <nl> if ( trace . has ( ) ) { <nl> - trace - > as_datum ( ) - > write_to_protobuf ( <nl> + trace - > as_datum ( ) . write_to_protobuf ( <nl> res - > mutable_profile ( ) , entry - > use_json ) ; <nl> } <nl> } catch ( const std : : exception & e ) { <nl> mmm a / src / rdb_protocol / table_common . cc <nl> ppp b / src / rdb_protocol / table_common . cc <nl> ql : : datum_t make_row_replacement_stats ( <nl> bool * was_changed_out ) { <nl> guarantee ( old_row . has ( ) ) ; <nl> bool started_empty ; <nl> - if ( old_row - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( old_row . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> started_empty = true ; <nl> - } else if ( old_row - > get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> + } else if ( old_row . get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> started_empty = false ; <nl> # ifndef NDEBUG <nl> - ql : : datum_t old_row_pval = old_row - > get_field ( primary_key_name ) ; <nl> + ql : : datum_t old_row_pval = old_row . get_field ( primary_key_name ) ; <nl> rassert ( old_row_pval . has ( ) ) ; <nl> - rassert ( store_key_t ( old_row_pval - > print_primary ( ) ) = = primary_key_value ) ; <nl> + rassert ( store_key_t ( old_row_pval . print_primary ( ) ) = = primary_key_value ) ; <nl> # endif <nl> } else { <nl> crash ( " old_row is invalid " ) ; <nl> ql : : datum_t make_row_replacement_stats ( <nl> <nl> guarantee ( new_row . has ( ) ) ; <nl> bool ended_empty ; <nl> - if ( new_row - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( new_row . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> ended_empty = true ; <nl> - } else if ( new_row - > get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> + } else if ( new_row . get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> ended_empty = false ; <nl> - new_row - > rcheck_valid_replace ( <nl> + new_row . rcheck_valid_replace ( <nl> old_row , ql : : datum_t ( ) , primary_key_name ) ; <nl> ql : : datum_t new_primary_key_value = <nl> - new_row - > get_field ( primary_key_name , ql : : NOTHROW ) ; <nl> - rcheck_target ( new_row , ql : : base_exc_t : : GENERIC , <nl> + new_row . get_field ( primary_key_name , ql : : NOTHROW ) ; <nl> + rcheck_target ( & new_row , ql : : base_exc_t : : GENERIC , <nl> primary_key_value . compare ( <nl> - store_key_t ( new_primary_key_value - > print_primary ( ) ) ) = = 0 , <nl> + store_key_t ( new_primary_key_value . print_primary ( ) ) ) = = 0 , <nl> ( started_empty <nl> ? strprintf ( " Primary key ` % s ` cannot be changed ( null - > % s ) " , <nl> - primary_key_name . to_std ( ) . c_str ( ) , new_row - > print ( ) . c_str ( ) ) <nl> + primary_key_name . to_std ( ) . c_str ( ) , new_row . print ( ) . c_str ( ) ) <nl> : strprintf ( " Primary key ` % s ` cannot be changed ( % s - > % s ) " , <nl> primary_key_name . to_std ( ) . c_str ( ) , <nl> - old_row - > print ( ) . c_str ( ) , new_row - > print ( ) . c_str ( ) ) ) ) ; <nl> + old_row . print ( ) . c_str ( ) , new_row . print ( ) . c_str ( ) ) ) ) ; <nl> } else { <nl> rfail_typed_target ( <nl> - new_row , " Inserted value must be an OBJECT ( got % s ) : \ n % s " , <nl> - new_row - > get_type_name ( ) . c_str ( ) , new_row - > print ( ) . c_str ( ) ) ; <nl> + & new_row , " Inserted value must be an OBJECT ( got % s ) : \ n % s " , <nl> + new_row . get_type_name ( ) . c_str ( ) , new_row . print ( ) . c_str ( ) ) ; <nl> } <nl> <nl> - * was_changed_out = * old_row ! = * new_row ; <nl> + * was_changed_out = ( old_row ! = new_row ) ; <nl> <nl> ql : : datum_object_builder_t resp ; <nl> if ( return_changes = = return_changes_t : : YES ) { <nl> ql : : datum_t resolve_insert_conflict ( <nl> ql : : datum_t old_row , <nl> ql : : datum_t insert_row , <nl> conflict_behavior_t conflict_behavior ) { <nl> - if ( old_row - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( old_row . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> return insert_row ; <nl> } else if ( conflict_behavior = = conflict_behavior_t : : REPLACE ) { <nl> return insert_row ; <nl> } else if ( conflict_behavior = = conflict_behavior_t : : UPDATE ) { <nl> - return old_row - > merge ( insert_row ) ; <nl> + return old_row . merge ( insert_row ) ; <nl> } else { <nl> - rfail_target ( old_row , ql : : base_exc_t : : GENERIC , <nl> + rfail_target ( & old_row , ql : : base_exc_t : : GENERIC , <nl> " Duplicate primary key ` % s ` : \ n % s \ n % s " , <nl> - primary_key . c_str ( ) , old_row - > print ( ) . c_str ( ) , <nl> - insert_row - > print ( ) . c_str ( ) ) ; <nl> + primary_key . c_str ( ) , old_row . print ( ) . c_str ( ) , <nl> + insert_row . print ( ) . c_str ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / src / rdb_protocol / term . cc <nl> ppp b / src / rdb_protocol / term . cc <nl> void run ( protob_t < Query > q , <nl> if ( val - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> res - > set_type ( Response : : SUCCESS_ATOM ) ; <nl> datum_t d = val - > as_datum ( ) ; <nl> - d - > write_to_protobuf ( res - > add_response ( ) , use_json ) ; <nl> + d . write_to_protobuf ( res - > add_response ( ) , use_json ) ; <nl> if ( trace . has ( ) ) { <nl> - trace - > as_datum ( ) - > write_to_protobuf ( <nl> + trace - > as_datum ( ) . write_to_protobuf ( <nl> res - > mutable_profile ( ) , use_json ) ; <nl> } <nl> } else if ( counted_t < grouped_data_t > gd <nl> void run ( protob_t < Query > q , <nl> datum_t d = to_datum_for_client_serialization ( std : : move ( * gd ) , <nl> env . reql_version ( ) , <nl> env . limits ( ) ) ; <nl> - d - > write_to_protobuf ( res - > add_response ( ) , use_json ) ; <nl> + d . write_to_protobuf ( res - > add_response ( ) , use_json ) ; <nl> if ( env . trace ! = nullptr ) { <nl> - env . trace - > as_datum ( ) - > write_to_protobuf ( <nl> + env . trace - > as_datum ( ) . write_to_protobuf ( <nl> res - > mutable_profile ( ) , use_json ) ; <nl> } <nl> } else if ( val - > get_type ( ) . is_convertible ( val_t : : type_t : : SEQUENCE ) ) { <nl> counted_t < datum_stream_t > seq = val - > as_seq ( & env ) ; <nl> - if ( datum_t arr = seq - > as_array ( & env ) ) { <nl> + const datum_t arr = seq - > as_array ( & env ) ; <nl> + if ( arr . has ( ) ) { <nl> res - > set_type ( Response : : SUCCESS_ATOM ) ; <nl> - arr - > write_to_protobuf ( res - > add_response ( ) , use_json ) ; <nl> + arr . write_to_protobuf ( res - > add_response ( ) , use_json ) ; <nl> if ( trace . has ( ) ) { <nl> - trace - > as_datum ( ) - > write_to_protobuf ( <nl> + trace - > as_datum ( ) . write_to_protobuf ( <nl> res - > mutable_profile ( ) , use_json ) ; <nl> } <nl> } else { <nl> mmm a / src / rdb_protocol / terms / arith . cc <nl> ppp b / src / rdb_protocol / terms / arith . cc <nl> class arith_term_t : public op_term_t { <nl> <nl> private : <nl> datum_t add ( datum_t lhs , <nl> - datum_t rhs , <nl> - const configured_limits_t & limits ) const { <nl> - if ( lhs - > is_ptype ( pseudo : : time_string ) | | <nl> - rhs - > is_ptype ( pseudo : : time_string ) ) { <nl> + datum_t rhs , <nl> + const configured_limits_t & limits ) const { <nl> + if ( lhs . is_ptype ( pseudo : : time_string ) | | <nl> + rhs . is_ptype ( pseudo : : time_string ) ) { <nl> return pseudo : : time_add ( lhs , rhs ) ; <nl> - } else if ( lhs - > get_type ( ) = = datum_t : : R_NUM ) { <nl> - rhs - > check_type ( datum_t : : R_NUM ) ; <nl> - return datum_t ( lhs - > as_num ( ) + rhs - > as_num ( ) ) ; <nl> - } else if ( lhs - > get_type ( ) = = datum_t : : R_STR ) { <nl> - rhs - > check_type ( datum_t : : R_STR ) ; <nl> - return datum_t ( concat ( lhs - > as_str ( ) , rhs - > as_str ( ) ) ) ; <nl> - } else if ( lhs - > get_type ( ) = = datum_t : : R_ARRAY ) { <nl> - rhs - > check_type ( datum_t : : R_ARRAY ) ; <nl> + } else if ( lhs . get_type ( ) = = datum_t : : R_NUM ) { <nl> + rhs . check_type ( datum_t : : R_NUM ) ; <nl> + return datum_t ( lhs . as_num ( ) + rhs . as_num ( ) ) ; <nl> + } else if ( lhs . get_type ( ) = = datum_t : : R_STR ) { <nl> + rhs . check_type ( datum_t : : R_STR ) ; <nl> + return datum_t ( concat ( lhs . as_str ( ) , rhs . as_str ( ) ) ) ; <nl> + } else if ( lhs . get_type ( ) = = datum_t : : R_ARRAY ) { <nl> + rhs . check_type ( datum_t : : R_ARRAY ) ; <nl> datum_array_builder_t out ( limits ) ; <nl> - for ( size_t i = 0 ; i < lhs - > arr_size ( ) ; + + i ) { <nl> - out . add ( lhs - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < lhs . arr_size ( ) ; + + i ) { <nl> + out . add ( lhs . get ( i ) ) ; <nl> } <nl> - for ( size_t i = 0 ; i < rhs - > arr_size ( ) ; + + i ) { <nl> - out . add ( rhs - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < rhs . arr_size ( ) ; + + i ) { <nl> + out . add ( rhs . get ( i ) ) ; <nl> } <nl> return std : : move ( out ) . to_datum ( ) ; <nl> } else { <nl> / / If we get here lhs is neither number nor string <nl> / / so we ' ll just error saying we expect a number <nl> - lhs - > check_type ( datum_t : : R_NUM ) ; <nl> + lhs . check_type ( datum_t : : R_NUM ) ; <nl> } <nl> unreachable ( ) ; <nl> } <nl> class arith_term_t : public op_term_t { <nl> datum_t sub ( datum_t lhs , <nl> datum_t rhs , <nl> const configured_limits_t & limits ) const { <nl> - if ( lhs - > is_ptype ( pseudo : : time_string ) ) { <nl> + if ( lhs . is_ptype ( pseudo : : time_string ) ) { <nl> return pseudo : : time_sub ( lhs , rhs ) ; <nl> - } else if ( lhs - > is_ptype ( pseudo : : geometry_string ) ) { <nl> + } else if ( lhs . is_ptype ( pseudo : : geometry_string ) ) { <nl> try { <nl> return pseudo : : geo_sub ( lhs , rhs , limits ) ; <nl> } catch ( const geo_exception_t & e ) { <nl> rfail ( base_exc_t : : GENERIC , " % s " , e . what ( ) ) ; <nl> } <nl> } else { <nl> - lhs - > check_type ( datum_t : : R_NUM ) ; <nl> - rhs - > check_type ( datum_t : : R_NUM ) ; <nl> - return datum_t ( lhs - > as_num ( ) - rhs - > as_num ( ) ) ; <nl> + lhs . check_type ( datum_t : : R_NUM ) ; <nl> + rhs . check_type ( datum_t : : R_NUM ) ; <nl> + return datum_t ( lhs . as_num ( ) - rhs . as_num ( ) ) ; <nl> } <nl> } <nl> datum_t mul ( datum_t lhs , <nl> datum_t rhs , <nl> const configured_limits_t & limits ) const { <nl> - if ( lhs - > get_type ( ) = = datum_t : : R_ARRAY | | <nl> - rhs - > get_type ( ) = = datum_t : : R_ARRAY ) { <nl> + if ( lhs . get_type ( ) = = datum_t : : R_ARRAY | | <nl> + rhs . get_type ( ) = = datum_t : : R_ARRAY ) { <nl> datum_t array = <nl> - ( lhs - > get_type ( ) = = datum_t : : R_ARRAY ? lhs : rhs ) ; <nl> + ( lhs . get_type ( ) = = datum_t : : R_ARRAY ? lhs : rhs ) ; <nl> datum_t num = <nl> - ( lhs - > get_type ( ) = = datum_t : : R_ARRAY ? rhs : lhs ) ; <nl> + ( lhs . get_type ( ) = = datum_t : : R_ARRAY ? rhs : lhs ) ; <nl> <nl> datum_array_builder_t out ( limits ) ; <nl> - const int64_t num_copies = num - > as_int ( ) ; <nl> + const int64_t num_copies = num . as_int ( ) ; <nl> rcheck ( num_copies > = 0 , base_exc_t : : GENERIC , <nl> " Cannot multiply an ARRAY by a negative number . " ) ; <nl> <nl> for ( int64_t j = 0 ; j < num_copies ; + + j ) { <nl> - for ( size_t i = 0 ; i < array - > arr_size ( ) ; + + i ) { <nl> - out . add ( array - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < array . arr_size ( ) ; + + i ) { <nl> + out . add ( array . get ( i ) ) ; <nl> } <nl> } <nl> return std : : move ( out ) . to_datum ( ) ; <nl> } else { <nl> - lhs - > check_type ( datum_t : : R_NUM ) ; <nl> - rhs - > check_type ( datum_t : : R_NUM ) ; <nl> - return datum_t ( lhs - > as_num ( ) * rhs - > as_num ( ) ) ; <nl> + lhs . check_type ( datum_t : : R_NUM ) ; <nl> + rhs . check_type ( datum_t : : R_NUM ) ; <nl> + return datum_t ( lhs . as_num ( ) * rhs . as_num ( ) ) ; <nl> } <nl> } <nl> datum_t div ( datum_t lhs , <nl> datum_t rhs , <nl> UNUSED const configured_limits_t & limits ) const { <nl> - lhs - > check_type ( datum_t : : R_NUM ) ; <nl> - rhs - > check_type ( datum_t : : R_NUM ) ; <nl> - rcheck ( rhs - > as_num ( ) ! = 0 , base_exc_t : : GENERIC , " Cannot divide by zero . " ) ; <nl> + lhs . check_type ( datum_t : : R_NUM ) ; <nl> + rhs . check_type ( datum_t : : R_NUM ) ; <nl> + rcheck ( rhs . as_num ( ) ! = 0 , base_exc_t : : GENERIC , " Cannot divide by zero . " ) ; <nl> / / throws on non - finite values <nl> - return datum_t ( lhs - > as_num ( ) / rhs - > as_num ( ) ) ; <nl> + return datum_t ( lhs . as_num ( ) / rhs . as_num ( ) ) ; <nl> } <nl> <nl> const char * namestr ; <nl> mmm a / src / rdb_protocol / terms / arr . cc <nl> ppp b / src / rdb_protocol / terms / arr . cc <nl> class pend_term_t : public op_term_t { <nl> datum_t arr = args - > arg ( env , 0 ) - > as_datum ( ) ; <nl> datum_t new_el = args - > arg ( env , 1 ) - > as_datum ( ) ; <nl> datum_array_builder_t out ( env - > env - > limits ( ) ) ; <nl> - out . reserve ( arr - > arr_size ( ) + 1 ) ; <nl> + out . reserve ( arr . arr_size ( ) + 1 ) ; <nl> if ( which_pend = = PRE ) { <nl> / / TODO : this is horrendously inefficient . <nl> out . add ( new_el ) ; <nl> - for ( size_t i = 0 ; i < arr - > arr_size ( ) ; + + i ) { <nl> - out . add ( arr - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr . arr_size ( ) ; + + i ) { <nl> + out . add ( arr . get ( i ) ) ; <nl> } <nl> } else { <nl> / / TODO : this is horrendously inefficient . <nl> - for ( size_t i = 0 ; i < arr - > arr_size ( ) ; + + i ) { <nl> - out . add ( arr - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr . arr_size ( ) ; + + i ) { <nl> + out . add ( arr . get ( i ) ) ; <nl> } <nl> out . add ( new_el ) ; <nl> } <nl> uint64_t canonicalize ( const term_t * t , int64_t index , size_t size , bool * oob_out <nl> / / needed because nth_term_impl may need to recurse over its contents to deal with <nl> / / e . g . grouped data . <nl> counted_t < val_t > nth_term_direct_impl ( const term_t * term , scope_env_t * env , <nl> - counted_t < val_t > aggregate , counted_t < val_t > index ) { <nl> + counted_t < val_t > aggregate , counted_t < val_t > index ) { <nl> int32_t n = index - > as_int < int32_t > ( ) ; <nl> if ( aggregate - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> datum_t arr = aggregate - > as_datum ( ) ; <nl> class slice_term_t : public bounded_op_term_t { <nl> bool left_open , int64_t fake_l , <nl> bool right_open , int64_t fake_r ) const { <nl> uint64_t real_l , real_r ; <nl> - if ( canon_helper ( arr - > arr_size ( ) , left_open , fake_l , true , & real_l ) ) { <nl> + if ( canon_helper ( arr . arr_size ( ) , left_open , fake_l , true , & real_l ) ) { <nl> real_l = 0 ; <nl> } <nl> - if ( canon_helper ( arr - > arr_size ( ) , right_open , fake_r , false , & real_r ) ) { <nl> + if ( canon_helper ( arr . arr_size ( ) , right_open , fake_r , false , & real_r ) ) { <nl> return new_val ( datum_t : : empty_array ( ) ) ; <nl> } <nl> <nl> datum_array_builder_t out ( limits ) ; <nl> for ( uint64_t i = real_l ; i < real_r ; + + i ) { <nl> - if ( i > = arr - > arr_size ( ) ) { <nl> + if ( i > = arr . arr_size ( ) ) { <nl> break ; <nl> } <nl> - out . add ( arr - > get ( i ) ) ; <nl> + out . add ( arr . get ( i ) ) ; <nl> } <nl> return new_val ( std : : move ( out ) . to_datum ( ) ) ; <nl> } <nl> class slice_term_t : public bounded_op_term_t { <nl> counted_t < val_t > slice_binary ( datum_t binary , <nl> bool left_open , int64_t fake_l , <nl> bool right_open , int64_t fake_r ) const { <nl> - const datum_string_t & data = binary - > as_binary ( ) ; <nl> + const datum_string_t & data = binary . as_binary ( ) ; <nl> uint64_t real_l , real_r ; <nl> if ( canon_helper ( data . size ( ) , left_open , fake_l , true , & real_l ) ) { <nl> real_l = 0 ; <nl> class slice_term_t : public bounded_op_term_t { <nl> <nl> if ( v - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> datum_t d = v - > as_datum ( ) ; <nl> - if ( d - > get_type ( ) = = datum_t : : R_ARRAY ) { <nl> + if ( d . get_type ( ) = = datum_t : : R_ARRAY ) { <nl> return slice_array ( d , env - > env - > limits ( ) , left_open , fake_l , <nl> right_open , fake_r ) ; <nl> - } else if ( d - > get_type ( ) = = datum_t : : R_BINARY ) { <nl> + } else if ( d . get_type ( ) = = datum_t : : R_BINARY ) { <nl> return slice_binary ( d , left_open , fake_l , right_open , fake_r ) ; <nl> } else { <nl> rfail_target ( v , base_exc_t : : GENERIC , <nl> " Expected ARRAY or BINARY , but found % s . " , <nl> - d - > get_type_name ( ) . c_str ( ) ) ; <nl> + d . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> } else if ( v - > get_type ( ) . is_convertible ( val_t : : type_t : : SEQUENCE ) ) { <nl> counted_t < table_t > t ; <nl> class set_insert_term_t : public op_term_t { <nl> std : : set < datum_t , optional_datum_less_t > <nl> el_set ( optional_datum_less_t ( env - > env - > reql_version ( ) ) ) ; <nl> datum_array_builder_t out ( env - > env - > limits ( ) ) ; <nl> - for ( size_t i = 0 ; i < arr - > arr_size ( ) ; + + i ) { <nl> - if ( el_set . insert ( arr - > get ( i ) ) . second ) { <nl> - out . add ( arr - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr . arr_size ( ) ; + + i ) { <nl> + if ( el_set . insert ( arr . get ( i ) ) . second ) { <nl> + out . add ( arr . get ( i ) ) ; <nl> } <nl> } <nl> if ( ! std_contains ( el_set , new_el ) ) { <nl> class set_union_term_t : public op_term_t { <nl> std : : set < datum_t , optional_datum_less_t > el_set ( <nl> optional_datum_less_t ( env - > env - > reql_version ( ) ) ) ; <nl> datum_array_builder_t out ( env - > env - > limits ( ) ) ; <nl> - for ( size_t i = 0 ; i < arr1 - > arr_size ( ) ; + + i ) { <nl> - if ( el_set . insert ( arr1 - > get ( i ) ) . second ) { <nl> - out . add ( arr1 - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr1 . arr_size ( ) ; + + i ) { <nl> + if ( el_set . insert ( arr1 . get ( i ) ) . second ) { <nl> + out . add ( arr1 . get ( i ) ) ; <nl> } <nl> } <nl> - for ( size_t i = 0 ; i < arr2 - > arr_size ( ) ; + + i ) { <nl> - if ( el_set . insert ( arr2 - > get ( i ) ) . second ) { <nl> - out . add ( arr2 - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr2 . arr_size ( ) ; + + i ) { <nl> + if ( el_set . insert ( arr2 . get ( i ) ) . second ) { <nl> + out . add ( arr2 . get ( i ) ) ; <nl> } <nl> } <nl> <nl> class set_intersection_term_t : public op_term_t { <nl> std : : set < datum_t , optional_datum_less_t > <nl> el_set ( optional_datum_less_t ( env - > env - > reql_version ( ) ) ) ; <nl> datum_array_builder_t out ( env - > env - > limits ( ) ) ; <nl> - for ( size_t i = 0 ; i < arr1 - > arr_size ( ) ; + + i ) { <nl> - el_set . insert ( arr1 - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr1 . arr_size ( ) ; + + i ) { <nl> + el_set . insert ( arr1 . get ( i ) ) ; <nl> } <nl> - for ( size_t i = 0 ; i < arr2 - > arr_size ( ) ; + + i ) { <nl> - if ( std_contains ( el_set , arr2 - > get ( i ) ) ) { <nl> - out . add ( arr2 - > get ( i ) ) ; <nl> - el_set . erase ( arr2 - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr2 . arr_size ( ) ; + + i ) { <nl> + if ( std_contains ( el_set , arr2 . get ( i ) ) ) { <nl> + out . add ( arr2 . get ( i ) ) ; <nl> + el_set . erase ( arr2 . get ( i ) ) ; <nl> } <nl> } <nl> <nl> class set_difference_term_t : public op_term_t { <nl> std : : set < datum_t , optional_datum_less_t > <nl> el_set ( optional_datum_less_t ( env - > env - > reql_version ( ) ) ) ; <nl> datum_array_builder_t out ( env - > env - > limits ( ) ) ; <nl> - for ( size_t i = 0 ; i < arr2 - > arr_size ( ) ; + + i ) { <nl> - el_set . insert ( arr2 - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr2 . arr_size ( ) ; + + i ) { <nl> + el_set . insert ( arr2 . get ( i ) ) ; <nl> } <nl> - for ( size_t i = 0 ; i < arr1 - > arr_size ( ) ; + + i ) { <nl> - if ( ! std_contains ( el_set , arr1 - > get ( i ) ) ) { <nl> - out . add ( arr1 - > get ( i ) ) ; <nl> - el_set . insert ( arr1 - > get ( i ) ) ; <nl> + for ( size_t i = 0 ; i < arr1 . arr_size ( ) ; + + i ) { <nl> + if ( ! std_contains ( el_set , arr1 . get ( i ) ) ) { <nl> + out . add ( arr1 . get ( i ) ) ; <nl> + el_set . insert ( arr1 . get ( i ) ) ; <nl> } <nl> } <nl> <nl> class at_term_t : public op_term_t { <nl> datum_array_builder_t arr ( args - > arg ( env , 0 ) - > as_datum ( ) , env - > env - > limits ( ) ) ; <nl> size_t index ; <nl> if ( index_method_ = = ELEMENTS ) { <nl> - index = canonicalize ( this , args - > arg ( env , 1 ) - > as_datum ( ) - > as_int ( ) , arr . size ( ) ) ; <nl> + index = canonicalize ( this , args - > arg ( env , 1 ) - > as_datum ( ) . as_int ( ) , arr . size ( ) ) ; <nl> } else if ( index_method_ = = SPACES ) { <nl> - index = canonicalize ( this , args - > arg ( env , 1 ) - > as_datum ( ) - > as_int ( ) , arr . size ( ) + 1 ) ; <nl> + index = canonicalize ( this , args - > arg ( env , 1 ) - > as_datum ( ) . as_int ( ) , arr . size ( ) + 1 ) ; <nl> } else { <nl> unreachable ( ) ; <nl> } <nl> class delete_at_term_t : public at_term_t { <nl> array - > erase ( index ) ; <nl> } else { <nl> int end_index = <nl> - canonicalize ( this , args - > arg ( env , 2 ) - > as_datum ( ) - > as_int ( ) , array - > size ( ) ) ; <nl> + canonicalize ( this , args - > arg ( env , 2 ) - > as_datum ( ) . as_int ( ) , array - > size ( ) ) ; <nl> array - > erase_range ( env - > env - > reql_version ( ) , index , end_index ) ; <nl> } <nl> } <nl> class contains_term_t : public op_term_t { <nl> { <nl> profile : : sampler_t sampler ( " Evaluating elements in contains . " , <nl> env - > env - > trace ) ; <nl> - while ( datum_t el = seq - > next ( env - > env , batchspec ) ) { <nl> + datum_t el ; <nl> + while ( el = seq - > next ( env - > env , batchspec ) , el . has ( ) ) { <nl> for ( auto it = required_els . begin ( ) ; it ! = required_els . end ( ) ; + + it ) { <nl> - if ( * * it = = * el ) { <nl> + if ( * it = = el ) { <nl> std : : swap ( * it , required_els . back ( ) ) ; <nl> required_els . pop_back ( ) ; <nl> break ; / / Bag semantics for contains . <nl> class args_term_t : public op_term_t { <nl> eval_flags_t eval_flags ) const { <nl> counted_t < val_t > v0 = args - > arg ( env , 0 , eval_flags ) ; <nl> / / If v0 is not an array , force a type error . <nl> - v0 - > as_datum ( ) - > check_type ( datum_t : : R_ARRAY ) ; <nl> + v0 - > as_datum ( ) . check_type ( datum_t : : R_ARRAY ) ; <nl> return v0 ; <nl> } <nl> private : <nl> mmm a / src / rdb_protocol / terms / datum_terms . cc <nl> ppp b / src / rdb_protocol / terms / datum_terms . cc <nl> class binary_term_t : public op_term_t { <nl> counted_t < val_t > arg = args - > arg ( env , 0 ) ; <nl> datum_t datum_arg = arg - > as_datum ( ) ; <nl> <nl> - if ( datum_arg - > get_type ( ) = = datum_t : : type_t : : R_BINARY ) { <nl> + if ( datum_arg . get_type ( ) = = datum_t : : type_t : : R_BINARY ) { <nl> return arg ; <nl> } <nl> <nl> - const datum_string_t & datum_str = datum_arg - > as_str ( ) ; <nl> + const datum_string_t & datum_str = datum_arg . as_str ( ) ; <nl> return new_val ( datum_t : : binary ( datum_string_t ( datum_str ) ) ) ; <nl> } <nl> virtual const char * name ( ) const { return " binary " ; } <nl> mmm a / src / rdb_protocol / terms / db_table . cc <nl> ppp b / src / rdb_protocol / terms / db_table . cc <nl> std : : map < name_string_t , size_t > get_replica_counts ( counted_t < val_t > arg ) { <nl> r_sanity_check ( arg . has ( ) ) ; <nl> std : : map < name_string_t , size_t > replica_counts ; <nl> datum_t datum = arg - > as_datum ( ) ; <nl> - if ( datum - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + if ( datum . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> for ( size_t i = 0 ; i < datum . obj_size ( ) ; + + i ) { <nl> std : : pair < datum_string_t , datum_t > pair = datum . get_pair ( i ) ; <nl> name_string_t name ; <nl> std : : map < name_string_t , size_t > get_replica_counts ( counted_t < val_t > arg ) { <nl> strprintf ( " Integer too large : % " PRIi64 , replicas ) ) ; <nl> replica_counts . insert ( std : : make_pair ( name , replicas2 ) ) ; <nl> } <nl> - } else if ( datum - > get_type ( ) = = datum_t : : R_NUM ) { <nl> + } else if ( datum . get_type ( ) = = datum_t : : R_NUM ) { <nl> size_t replicas = arg - > as_int < size_t > ( ) ; <nl> replica_counts . insert ( std : : make_pair ( <nl> name_string_t : : guarantee_valid ( " default " ) , replicas ) ) ; <nl> } else { <nl> rfail_target ( arg . get ( ) , base_exc_t : : GENERIC , <nl> " Expected type OBJECT or NUMBER but found % s : \ n % s " , <nl> - datum - > get_type_name ( ) . c_str ( ) , datum - > print ( ) . c_str ( ) ) ; <nl> + datum . get_type_name ( ) . c_str ( ) , datum . print ( ) . c_str ( ) ) ; <nl> } <nl> return replica_counts ; <nl> } <nl> class get_all_term_t : public op_term_t { <nl> for ( size_t i = 1 ; i < args - > num_args ( ) ; + + i ) { <nl> datum_t key = args - > arg ( env , i ) - > as_datum ( ) ; <nl> datum_t row = table - > get_row ( env - > env , key ) ; <nl> - if ( row - > get_type ( ) ! = datum_t : : R_NULL ) { <nl> + if ( row . get_type ( ) ! = datum_t : : R_NULL ) { <nl> arr . add ( row ) ; <nl> } <nl> } <nl> mmm a / src / rdb_protocol / terms / error . cc <nl> ppp b / src / rdb_protocol / terms / error . cc <nl> class default_term_t : public op_term_t { <nl> v = args - > arg ( env , 0 ) ; <nl> if ( v - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> func_arg = v - > as_datum ( ) ; <nl> - if ( func_arg - > get_type ( ) ! = datum_t : : R_NULL ) { <nl> + if ( func_arg . get_type ( ) ! = datum_t : : R_NULL ) { <nl> return v ; <nl> } <nl> } else { <nl> class default_term_t : public op_term_t { <nl> } <nl> } <nl> r_sanity_check ( func_arg . has ( ) ) ; <nl> - r_sanity_check ( func_arg - > get_type ( ) = = datum_t : : R_NULL <nl> - | | func_arg - > get_type ( ) = = datum_t : : R_STR ) ; <nl> + r_sanity_check ( func_arg . get_type ( ) = = datum_t : : R_NULL <nl> + | | func_arg . get_type ( ) = = datum_t : : R_STR ) ; <nl> try { <nl> counted_t < val_t > def = args - > arg ( env , 1 ) ; <nl> if ( def - > get_type ( ) . is_convertible ( val_t : : type_t : : FUNC ) ) { <nl> class default_term_t : public op_term_t { <nl> if ( err . has ( ) ) { <nl> throw * err ; <nl> } else { <nl> - r_sanity_check ( func_arg - > get_type ( ) = = datum_t : : R_NULL ) ; <nl> + r_sanity_check ( func_arg . get_type ( ) = = datum_t : : R_NULL ) ; <nl> return v ; <nl> } <nl> } else { <nl> mmm a / src / rdb_protocol / terms / geo . cc <nl> ppp b / src / rdb_protocol / terms / geo . cc <nl> <nl> # include " rdb_protocol / op . hpp " <nl> # include " rdb_protocol / pseudo_geometry . hpp " <nl> # include " rdb_protocol / term . hpp " <nl> + # include " rdb_protocol / terms / obj_or_seq . hpp " <nl> # include " rdb_protocol / terms / terms . hpp " <nl> <nl> using geo : : S2Point ; <nl> class geo_term_t : public op_term_t { <nl> } <nl> } ; <nl> <nl> + class geo_obj_or_seq_op_term_t : public obj_or_seq_op_term_t { <nl> + public : <nl> + geo_obj_or_seq_op_term_t ( compile_env_t * env , protob_t < const Term > term , <nl> + poly_type_t _poly_type , argspec_t argspec ) <nl> + : obj_or_seq_op_term_t ( env , term , _poly_type , argspec ) { } <nl> + private : <nl> + virtual counted_t < val_t > obj_eval_geo ( <nl> + scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const = 0 ; <nl> + counted_t < val_t > obj_eval ( <nl> + scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const { <nl> + try { <nl> + return obj_eval_geo ( env , args , v0 ) ; <nl> + } catch ( const geo_exception_t & e ) { <nl> + rfail ( base_exc_t : : GENERIC , " % s " , e . what ( ) ) ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> class geojson_term_t : public geo_term_t { <nl> public : <nl> geojson_term_t ( compile_env_t * env , const protob_t < const Term > & term ) <nl> class point_term_t : public geo_term_t { <nl> / / Accepts either a geometry object of type Point , or an array with two coordinates . <nl> / / We often want to support both . <nl> lat_lon_point_t parse_point_argument ( const datum_t & point_datum ) { <nl> - if ( point_datum - > is_ptype ( pseudo : : geometry_string ) ) { <nl> + if ( point_datum . is_ptype ( pseudo : : geometry_string ) ) { <nl> / / The argument is a point ( should be at least , if not this will throw ) <nl> return extract_lat_lon_point ( point_datum ) ; <nl> } else { <nl> / / The argument must be a coordinate pair <nl> - rcheck_target ( & point_datum , base_exc_t : : GENERIC , point_datum - > arr_size ( ) = = 2 , <nl> + rcheck_target ( & point_datum , base_exc_t : : GENERIC , point_datum . arr_size ( ) = = 2 , <nl> strprintf ( " Expected point coordinate pair . " <nl> " Got % zu element array instead of a 2 element one . " , <nl> - point_datum - > arr_size ( ) ) ) ; <nl> - double lat = point_datum - > get ( 0 ) - > as_num ( ) ; <nl> - double lon = point_datum - > get ( 1 ) - > as_num ( ) ; <nl> + point_datum . arr_size ( ) ) ) ; <nl> + double lat = point_datum . get ( 0 ) . as_num ( ) ; <nl> + double lon = point_datum . get ( 1 ) . as_num ( ) ; <nl> return lat_lon_point_t ( lat , lon ) ; <nl> } <nl> } <nl> class polygon_term_t : public geo_term_t { <nl> virtual const char * name ( ) const { return " polygon " ; } <nl> } ; <nl> <nl> - class intersects_term_t : public geo_term_t { <nl> + class intersects_term_t : public geo_obj_or_seq_op_term_t { <nl> public : <nl> intersects_term_t ( compile_env_t * env , const protob_t < const Term > & term ) <nl> - : geo_term_t ( env , term , argspec_t ( 2 ) ) { } <nl> + : geo_obj_or_seq_op_term_t ( env , term , poly_type_t : : FILTER , argspec_t ( 2 ) ) { } <nl> private : <nl> - counted_t < val_t > eval_geo ( scope_env_t * env , args_t * args , eval_flags_t ) const { <nl> - counted_t < val_t > g1 = args - > arg ( env , 0 ) ; <nl> - counted_t < val_t > g2 = args - > arg ( env , 1 ) ; <nl> + counted_t < val_t > obj_eval_geo ( <nl> + scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const { <nl> + counted_t < val_t > other = args - > arg ( env , 1 ) ; <nl> <nl> - bool result = geo_does_intersect ( g1 - > as_ptype ( pseudo : : geometry_string ) , <nl> - g2 - > as_ptype ( pseudo : : geometry_string ) ) ; <nl> + bool result = geo_does_intersect ( v0 - > as_ptype ( pseudo : : geometry_string ) , <nl> + other - > as_ptype ( pseudo : : geometry_string ) ) ; <nl> <nl> - return new_val ( <nl> - datum_t ( datum_t : : construct_boolean_t ( ) , result ) ) ; <nl> + return new_val_bool ( result ) ; <nl> } <nl> virtual const char * name ( ) const { return " intersects " ; } <nl> } ; <nl> <nl> - class includes_term_t : public geo_term_t { <nl> + class includes_term_t : public geo_obj_or_seq_op_term_t { <nl> public : <nl> includes_term_t ( compile_env_t * env , const protob_t < const Term > & term ) <nl> - : geo_term_t ( env , term , argspec_t ( 2 ) ) { } <nl> + : geo_obj_or_seq_op_term_t ( env , term , poly_type_t : : FILTER , argspec_t ( 2 ) ) { } <nl> private : <nl> - counted_t < val_t > eval_geo ( scope_env_t * env , args_t * args , eval_flags_t ) const { <nl> - counted_t < val_t > polygon = args - > arg ( env , 0 ) ; <nl> + counted_t < val_t > obj_eval_geo ( <nl> + scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const { <nl> counted_t < val_t > g = args - > arg ( env , 1 ) ; <nl> <nl> scoped_ptr_t < S2Polygon > s2polygon = <nl> - to_s2polygon ( polygon - > as_ptype ( pseudo : : geometry_string ) ) ; <nl> + to_s2polygon ( v0 - > as_ptype ( pseudo : : geometry_string ) ) ; <nl> bool result = geo_does_include ( * s2polygon , g - > as_ptype ( pseudo : : geometry_string ) ) ; <nl> <nl> - return new_val ( <nl> - datum_t ( datum_t : : construct_boolean_t ( ) , result ) ) ; <nl> + return new_val_bool ( result ) ; <nl> } <nl> virtual const char * name ( ) const { return " includes " ; } <nl> } ; <nl> class includes_term_t : public geo_term_t { <nl> ellipsoid_spec_t pick_reference_ellipsoid ( scope_env_t * env , args_t * args ) { <nl> counted_t < val_t > geo_system_arg = args - > optarg ( env , " geo_system " ) ; <nl> if ( geo_system_arg . has ( ) ) { <nl> - if ( geo_system_arg - > as_datum ( ) - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + if ( geo_system_arg - > as_datum ( ) . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> / / We expect a reference ellipsoid with parameters ' a ' and ' f ' . <nl> / / ( equator radius and the flattening ) <nl> - double a = geo_system_arg - > as_datum ( ) - > get_field ( " a " ) - > as_num ( ) ; <nl> - double f = geo_system_arg - > as_datum ( ) - > get_field ( " f " ) - > as_num ( ) ; <nl> + double a = geo_system_arg - > as_datum ( ) . get_field ( " a " ) . as_num ( ) ; <nl> + double f = geo_system_arg - > as_datum ( ) . get_field ( " f " ) . as_num ( ) ; <nl> rcheck_target ( geo_system_arg . get ( ) , base_exc_t : : GENERIC , <nl> a > 0 . 0 , " The equator radius ` a ` must be positive . " ) ; <nl> rcheck_target ( geo_system_arg . get ( ) , base_exc_t : : GENERIC , <nl> class distance_term_t : public geo_term_t { <nl> scoped_ptr_t < S2Point > p ; <nl> datum_t g ; <nl> const std : : string g1_type = <nl> - g1_arg - > as_ptype ( pseudo : : geometry_string ) - > get_field ( " type " ) - > as_str ( ) . to_std ( ) ; <nl> + g1_arg - > as_ptype ( pseudo : : geometry_string ) . get_field ( " type " ) . as_str ( ) . to_std ( ) ; <nl> if ( g1_type = = " Point " ) { <nl> p = to_s2point ( g1_arg - > as_ptype ( pseudo : : geometry_string ) ) ; <nl> g = g2_arg - > as_ptype ( pseudo : : geometry_string ) ; <nl> mmm a / src / rdb_protocol / terms / http . cc <nl> ppp b / src / rdb_protocol / terms / http . cc <nl> class http_term_t : public op_term_t { <nl> <nl> void check_url_params ( const datum_t & params , <nl> pb_rcheckable_t * val ) { <nl> - if ( params - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + if ( params . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> for ( size_t i = 0 ; i < params . obj_size ( ) ; + + i ) { <nl> auto pair = params . get_pair ( i ) ; <nl> if ( pair . second . get_type ( ) ! = datum_t : : R_NUM & & <nl> void check_url_params ( const datum_t & params , <nl> } else { <nl> rfail_target ( val , base_exc_t : : GENERIC , <nl> " Expected ` params ` to be an OBJECT , but found % s : \ n % s " , <nl> - params - > get_type_name ( ) . c_str ( ) , <nl> - params - > print ( ) . c_str ( ) ) ; <nl> + params . get_type_name ( ) . c_str ( ) , <nl> + params . print ( ) . c_str ( ) ) ; <nl> } <nl> } <nl> <nl> void check_error_result ( const http_result_t & res , <nl> opts . url . c_str ( ) , <nl> res . error . c_str ( ) ) ; <nl> if ( res . header . has ( ) ) { <nl> - error_string . append ( " \ nheader : \ n " + res . header - > print ( ) ) ; <nl> + error_string . append ( " \ nheader : \ n " + res . header . print ( ) ) ; <nl> } <nl> <nl> if ( res . body . has ( ) ) { <nl> - error_string . append ( " \ nbody : \ n " + res . body - > print ( ) ) ; <nl> + error_string . append ( " \ nbody : \ n " + res . body . print ( ) ) ; <nl> } <nl> <nl> / / Any error coming back from the extproc may be due to the fragility of <nl> http_datum_stream_t : : next_page ( env_t * env ) { <nl> / / the end of the stream <nl> more = apply_depaginate ( env , res ) ; <nl> <nl> - if ( res . body - > get_type ( ) = = datum_t : : R_ARRAY ) { <nl> + if ( res . body . get_type ( ) = = datum_t : : R_ARRAY ) { <nl> std : : vector < datum_t > res_arr ; <nl> res_arr . reserve ( res . body . arr_size ( ) ) ; <nl> for ( size_t i = 0 ; i < res . body . arr_size ( ) ; + + i ) { <nl> bool http_datum_stream_t : : apply_depaginate ( env_t * env , const http_result_t & res ) <nl> http_method_to_str ( opts . method ) . c_str ( ) , <nl> opts . url . c_str ( ) , <nl> ex . what ( ) , <nl> - args [ 0 ] - > print ( ) . c_str ( ) ) , <nl> + args [ 0 ] . print ( ) . c_str ( ) ) , <nl> ex . backtrace ( ) ) ; <nl> } <nl> } <nl> <nl> bool http_datum_stream_t : : apply_depage_url ( datum_t new_url ) { <nl> / / NULL url indicates no further depagination <nl> - if ( new_url - > get_type ( ) = = datum_t : : R_NULL ) { <nl> + if ( new_url . get_type ( ) = = datum_t : : R_NULL ) { <nl> return false ; <nl> - } else if ( new_url - > get_type ( ) ! = datum_t : : R_STR ) { <nl> + } else if ( new_url . get_type ( ) ! = datum_t : : R_STR ) { <nl> rfail ( base_exc_t : : GENERIC , <nl> " Expected ` url ` in OBJECT returned by ` page ` to be a " <nl> " STRING or NULL , but found % s . " , <nl> - new_url - > get_type_name ( ) . c_str ( ) ) ; <nl> + new_url . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> - opts . url . assign ( new_url - > as_str ( ) . to_std ( ) ) ; <nl> + opts . url . assign ( new_url . as_str ( ) . to_std ( ) ) ; <nl> return true ; <nl> } <nl> <nl> void http_datum_stream_t : : apply_depage_params ( datum_t new_params ) { <nl> / / Verify new params and merge with the old ones , new taking precedence <nl> check_url_params ( new_params , this ) ; <nl> - opts . url_params - > merge ( new_params ) ; <nl> + opts . url_params . merge ( new_params ) ; <nl> } <nl> <nl> bool http_datum_stream_t : : handle_depage_result ( datum_t depage ) { <nl> - if ( depage - > get_type ( ) = = datum_t : : R_NULL | | <nl> - depage - > get_type ( ) = = datum_t : : R_STR ) { <nl> + if ( depage . get_type ( ) = = datum_t : : R_NULL | | <nl> + depage . get_type ( ) = = datum_t : : R_STR ) { <nl> return apply_depage_url ( depage ) ; <nl> - } else if ( depage - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> - datum_t new_url = depage - > get_field ( " url " , NOTHROW ) ; <nl> - datum_t new_params = depage - > get_field ( " params " , NOTHROW ) ; <nl> + } else if ( depage . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + datum_t new_url = depage . get_field ( " url " , NOTHROW ) ; <nl> + datum_t new_params = depage . get_field ( " params " , NOTHROW ) ; <nl> if ( ! new_url . has ( ) & & ! new_params . has ( ) ) { <nl> rfail ( base_exc_t : : GENERIC , <nl> " OBJECT returned by ` page ` must contain " <nl> bool http_datum_stream_t : : handle_depage_result ( datum_t depage ) { <nl> } else { <nl> rfail ( base_exc_t : : GENERIC , <nl> " Expected ` page ` to return an OBJECT , but found % s . " , <nl> - depage - > get_type_name ( ) . c_str ( ) ) ; <nl> + depage . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> <nl> return true ; <nl> void http_term_t : : get_header ( scope_env_t * env , <nl> counted_t < val_t > header = args - > optarg ( env , " header " ) ; <nl> if ( header . has ( ) ) { <nl> datum_t datum_header = header - > as_datum ( ) ; <nl> - if ( datum_header - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + if ( datum_header . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> for ( size_t i = 0 ; i < datum_header . obj_size ( ) ; + + i ) { <nl> auto pair = datum_header . get_pair ( i ) ; <nl> std : : string str ; <nl> - if ( pair . second - > get_type ( ) = = datum_t : : R_STR ) { <nl> + if ( pair . second . get_type ( ) = = datum_t : : R_STR ) { <nl> str = strprintf ( " % s : % s " , pair . first . to_std ( ) . c_str ( ) , <nl> pair . second . as_str ( ) . to_std ( ) . c_str ( ) ) ; <nl> } else if ( pair . second . get_type ( ) ! = datum_t : : R_NULL ) { <nl> void http_term_t : : get_header ( scope_env_t * env , <nl> verify_header_string ( str , header . get ( ) ) ; <nl> header_out - > push_back ( str ) ; <nl> } <nl> - } else if ( datum_header - > get_type ( ) = = datum_t : : R_ARRAY ) { <nl> - for ( size_t i = 0 ; i < datum_header - > arr_size ( ) ; + + i ) { <nl> - datum_t line = datum_header - > get ( i ) ; <nl> - if ( line - > get_type ( ) ! = datum_t : : R_STR ) { <nl> + } else if ( datum_header . get_type ( ) = = datum_t : : R_ARRAY ) { <nl> + for ( size_t i = 0 ; i < datum_header . arr_size ( ) ; + + i ) { <nl> + datum_t line = datum_header . get ( i ) ; <nl> + if ( line . get_type ( ) ! = datum_t : : R_STR ) { <nl> rfail_target ( header . get ( ) , base_exc_t : : GENERIC , <nl> " Expected ` header [ % zu ] ` to be a STRING , but found % s . " , <nl> - i , line - > get_type_name ( ) . c_str ( ) ) ; <nl> + i , line . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> - std : : string str = line - > as_str ( ) . to_std ( ) ; <nl> + std : : string str = line . as_str ( ) . to_std ( ) ; <nl> verify_header_string ( str , header . get ( ) ) ; <nl> header_out - > push_back ( str ) ; <nl> } <nl> } else { <nl> rfail_target ( header . get ( ) , base_exc_t : : GENERIC , <nl> " Expected ` header ` to be an ARRAY or OBJECT , but found % s . " , <nl> - datum_header - > get_type_name ( ) . c_str ( ) ) ; <nl> + datum_header . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> } <nl> } <nl> void http_term_t : : get_method ( scope_env_t * env , <nl> std : : string http_term_t : : get_auth_item ( const datum_t & datum , <nl> const std : : string & name , <nl> const pb_rcheckable_t * auth ) { <nl> - datum_t item = datum - > get_field ( datum_string_t ( name ) , NOTHROW ) ; <nl> + datum_t item = datum . get_field ( datum_string_t ( name ) , NOTHROW ) ; <nl> if ( ! item . has ( ) ) { <nl> rfail_target ( auth , base_exc_t : : GENERIC , <nl> " ` auth . % s ` not found in the auth object . " , name . c_str ( ) ) ; <nl> - } else if ( item - > get_type ( ) ! = datum_t : : R_STR ) { <nl> + } else if ( item . get_type ( ) ! = datum_t : : R_STR ) { <nl> rfail_target ( auth , base_exc_t : : GENERIC , <nl> " Expected ` auth . % s ` to be a STRING , but found % s . " , <nl> - name . c_str ( ) , item - > get_type_name ( ) . c_str ( ) ) ; <nl> + name . c_str ( ) , item . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> - return item - > as_str ( ) . to_std ( ) ; <nl> + return item . as_str ( ) . to_std ( ) ; <nl> } <nl> <nl> / / The ` auth ` optarg takes an object consisting of the following fields : <nl> void http_term_t : : get_auth ( scope_env_t * env , <nl> counted_t < val_t > auth = args - > optarg ( env , " auth " ) ; <nl> if ( auth . has ( ) ) { <nl> datum_t datum_auth = auth - > as_datum ( ) ; <nl> - if ( datum_auth - > get_type ( ) ! = datum_t : : R_OBJECT ) { <nl> + if ( datum_auth . get_type ( ) ! = datum_t : : R_OBJECT ) { <nl> rfail_target ( auth . get ( ) , base_exc_t : : GENERIC , <nl> " Expected ` auth ` to be an OBJECT , but found % s . " , <nl> - datum_auth - > get_type_name ( ) . c_str ( ) ) ; <nl> + datum_auth . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> <nl> / / Default to ' basic ' if no type is specified <nl> std : : string type ; <nl> { <nl> - datum_t type_datum = datum_auth - > get_field ( " type " , NOTHROW ) ; <nl> + datum_t type_datum = datum_auth . get_field ( " type " , NOTHROW ) ; <nl> <nl> if ( type_datum . has ( ) ) { <nl> - if ( type_datum - > get_type ( ) ! = datum_t : : R_STR ) { <nl> + if ( type_datum . get_type ( ) ! = datum_t : : R_STR ) { <nl> rfail_target ( auth . get ( ) , base_exc_t : : GENERIC , <nl> " Expected ` auth . type ` to be a STRING , but found % s . " , <nl> - datum_auth - > get_type_name ( ) . c_str ( ) ) ; <nl> + datum_auth . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> - type . assign ( type_datum - > as_str ( ) . to_std ( ) ) ; <nl> + type . assign ( type_datum . as_str ( ) . to_std ( ) ) ; <nl> } else { <nl> type . assign ( " basic " ) ; <nl> } <nl> std : : string http_term_t : : print_http_param ( const datum_t & datum , <nl> const char * val_name , <nl> const char * key_name , <nl> const pb_rcheckable_t * val ) { <nl> - if ( datum - > get_type ( ) = = datum_t : : R_NUM ) { <nl> + if ( datum . get_type ( ) = = datum_t : : R_NUM ) { <nl> return strprintf ( " % " PR_RECONSTRUCTABLE_DOUBLE , <nl> - datum - > as_num ( ) ) ; <nl> - } else if ( datum - > get_type ( ) = = datum_t : : R_STR ) { <nl> - return datum - > as_str ( ) . to_std ( ) ; <nl> - } else if ( datum - > get_type ( ) = = datum_t : : R_NULL ) { <nl> + datum . as_num ( ) ) ; <nl> + } else if ( datum . get_type ( ) = = datum_t : : R_STR ) { <nl> + return datum . as_str ( ) . to_std ( ) ; <nl> + } else if ( datum . get_type ( ) = = datum_t : : R_NULL ) { <nl> return std : : string ( ) ; <nl> } <nl> <nl> rfail_target ( val , base_exc_t : : GENERIC , <nl> " Expected ` % s . % s ` to be a NUMBER , STRING or NULL , but found % s . " , <nl> - val_name , key_name , datum - > get_type_name ( ) . c_str ( ) ) ; <nl> + val_name , key_name , datum . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> <nl> / / The ` data ` optarg is used to pass in the data to be passed in the body of the <nl> void http_term_t : : get_data ( <nl> if ( method = = http_method_t : : PUT | | <nl> method = = http_method_t : : PATCH | | <nl> method = = http_method_t : : DELETE ) { <nl> - if ( datum_data - > get_type ( ) = = datum_t : : R_STR ) { <nl> - data_out - > assign ( datum_data - > as_str ( ) . to_std ( ) ) ; <nl> + if ( datum_data . get_type ( ) = = datum_t : : R_STR ) { <nl> + data_out - > assign ( datum_data . as_str ( ) . to_std ( ) ) ; <nl> } else { <nl> / / Set the Content - Type to application / json - this may be overwritten <nl> / / later by the ' header ' optarg <nl> header_out - > push_back ( " Content - Type : application / json " ) ; <nl> - data_out - > assign ( datum_data - > print ( ) ) ; <nl> + data_out - > assign ( datum_data . print ( ) ) ; <nl> } <nl> } else if ( method = = http_method_t : : POST ) { <nl> - if ( datum_data - > get_type ( ) = = datum_t : : R_STR ) { <nl> + if ( datum_data . get_type ( ) = = datum_t : : R_STR ) { <nl> / / Use the put data for this , as we assume the user does any <nl> / / encoding they need when they pass a string <nl> - data_out - > assign ( datum_data - > as_str ( ) . to_std ( ) ) ; <nl> - } else if ( datum_data - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + data_out - > assign ( datum_data . as_str ( ) . to_std ( ) ) ; <nl> + } else if ( datum_data . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> for ( size_t i = 0 ; i < datum_data . obj_size ( ) ; + + i ) { <nl> auto pair = datum_data . get_pair ( i ) ; <nl> std : : string val_str = print_http_param ( pair . second , <nl> void http_term_t : : get_data ( <nl> } else { <nl> rfail_target ( data . get ( ) , base_exc_t : : GENERIC , <nl> " Expected ` data ` to be a STRING or OBJECT , but found % s . " , <nl> - datum_data - > get_type_name ( ) . c_str ( ) ) ; <nl> + datum_data . get_type_name ( ) . c_str ( ) ) ; <nl> } <nl> } else { <nl> rfail_target ( this , base_exc_t : : GENERIC , <nl> mmm a / src / rdb_protocol / terms / js . cc <nl> ppp b / src / rdb_protocol / terms / js . cc <nl> class javascript_term_t : public op_term_t { <nl> } <nl> } <nl> <nl> - std : : string source = args - > arg ( env , 0 ) - > as_datum ( ) - > as_str ( ) . to_std ( ) ; <nl> + std : : string source = args - > arg ( env , 0 ) - > as_datum ( ) . as_str ( ) . to_std ( ) ; <nl> <nl> / / JS runner configuration is limited to setting an execution timeout . <nl> js_runner_t : : req_config_t config ; <nl> mmm a / src / rdb_protocol / terms / obj . cc <nl> ppp b / src / rdb_protocol / terms / obj . cc <nl> class object_term_t : public op_term_t { <nl> strprintf ( " Duplicate key ` % s ` in object . " <nl> " ( got ` % s ` and ` % s ` as values ) " , <nl> key . to_std ( ) . c_str ( ) , <nl> - obj . at ( key ) - > trunc_print ( ) . c_str ( ) , <nl> - keyval - > trunc_print ( ) . c_str ( ) ) ) ; <nl> + obj . at ( key ) . trunc_print ( ) . c_str ( ) , <nl> + keyval . trunc_print ( ) . c_str ( ) ) ) ; <nl> } <nl> return new_val ( std : : move ( obj ) . to_datum ( ) ) ; <nl> } <nl> mmm a / src / rdb_protocol / terms / obj_or_seq . cc <nl> ppp b / src / rdb_protocol / terms / obj_or_seq . cc <nl> <nl> # include " rdb_protocol / pb_utils . hpp " <nl> # include " rdb_protocol / pseudo_literal . hpp " <nl> # include " rdb_protocol / minidriver . hpp " <nl> + # include " rdb_protocol / terms / obj_or_seq . hpp " <nl> <nl> namespace ql { <nl> <nl> - enum poly_type_t { <nl> - MAP = 0 , <nl> - FILTER = 1 , <nl> - SKIP_MAP = 2 <nl> - } ; <nl> - <nl> - class obj_or_seq_op_impl_t { <nl> - public : <nl> - obj_or_seq_op_impl_t ( const term_t * self , poly_type_t _poly_type , protob_t < const Term > term ) <nl> - : poly_type ( _poly_type ) , func ( make_counted_term ( ) ) { <nl> - auto varnum = pb : : dummy_var_t : : OBJORSEQ_VARNUM ; <nl> + obj_or_seq_op_impl_t : : obj_or_seq_op_impl_t ( <nl> + const term_t * self , poly_type_t _poly_type , protob_t < const Term > term ) <nl> + : poly_type ( _poly_type ) , func ( make_counted_term ( ) ) { <nl> + auto varnum = pb : : dummy_var_t : : OBJORSEQ_VARNUM ; <nl> + <nl> + / / body is a new reql expression similar to term except that the first argument <nl> + / / is replaced by a new variable . <nl> + / / For example , foo . pluck ( ' a ' ) becomes varnum . pluck ( ' a ' ) <nl> + r : : reql_t body = r : : var ( varnum ) . call ( term - > type ( ) ) ; <nl> + body . copy_args_from_term ( * term , 1 ) ; <nl> + body . add_arg ( r : : optarg ( " _NO_RECURSE_ " , r : : boolean ( true ) ) ) ; <nl> + <nl> + switch ( poly_type ) { <nl> + case MAP : / / fallthru <nl> + case FILTER : { <nl> + func - > Swap ( & r : : fun ( varnum , std : : move ( body ) ) . get ( ) ) ; <nl> + } break ; <nl> + case SKIP_MAP : { <nl> + func - > Swap ( & r : : fun ( varnum , <nl> + r : : array ( std : : move ( body ) ) . default_ ( r : : array ( ) ) ) . get ( ) ) ; <nl> + } break ; <nl> + default : unreachable ( ) ; <nl> + } <nl> <nl> - / / body is a new reql expression similar to term except that the first argument <nl> - / / is replaced by a new variable . <nl> - / / For example , foo . pluck ( ' a ' ) becomes varnum . pluck ( ' a ' ) <nl> - r : : reql_t body = r : : var ( varnum ) . call ( term - > type ( ) ) ; <nl> - body . copy_args_from_term ( * term , 1 ) ; <nl> - body . add_arg ( r : : optarg ( " _NO_RECURSE_ " , r : : boolean ( true ) ) ) ; <nl> + self - > prop_bt ( func . get ( ) ) ; <nl> + } <nl> <nl> - switch ( poly_type ) { <nl> - case MAP : / / fallthru <nl> - case FILTER : { <nl> - func - > Swap ( & r : : fun ( varnum , std : : move ( body ) ) . get ( ) ) ; <nl> - } break ; <nl> - case SKIP_MAP : { <nl> - func - > Swap ( & r : : fun ( varnum , <nl> - r : : array ( std : : move ( body ) ) . default_ ( r : : array ( ) ) ) . get ( ) ) ; <nl> - } break ; <nl> - default : unreachable ( ) ; <nl> - } <nl> + counted_t < val_t > obj_or_seq_op_impl_t : : eval_impl_dereferenced ( <nl> + const term_t * target , scope_env_t * env , args_t * args , counted_t < val_t > v0 , <nl> + std : : function < counted_t < val_t > ( ) > helper ) const { <nl> + datum_t d ; <nl> <nl> - self - > prop_bt ( func . get ( ) ) ; <nl> + if ( v0 - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> + d = v0 - > as_datum ( ) ; <nl> } <nl> <nl> - counted_t < val_t > eval_impl_dereferenced <nl> - ( const term_t * target , scope_env_t * env , args_t * args , counted_t < val_t > v0 , <nl> - std : : function < counted_t < val_t > ( ) > helper ) const { <nl> - datum_t d ; <nl> - <nl> - if ( v0 - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> - d = v0 - > as_datum ( ) ; <nl> + if ( d . has ( ) & & d . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + return helper ( ) ; <nl> + } else if ( ( d . has ( ) & & d . get_type ( ) = = datum_t : : R_ARRAY ) | | <nl> + ( ! d . has ( ) <nl> + & & v0 - > get_type ( ) . is_convertible ( val_t : : type_t : : SEQUENCE ) ) ) { <nl> + / / The above if statement is complicated because it produces better <nl> + / / error messages on e . g . strings . <nl> + if ( counted_t < val_t > no_recurse = args - > optarg ( env , " _NO_RECURSE_ " ) ) { <nl> + rcheck_target ( target , base_exc_t : : GENERIC , no_recurse - > as_bool ( ) = = false , <nl> + strprintf ( " Cannot perform % s on a sequence of sequences . " , <nl> + target - > name ( ) ) ) ; <nl> } <nl> <nl> - if ( d . has ( ) & & d - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> - return helper ( ) ; <nl> - } else if ( ( d . has ( ) & & d - > get_type ( ) = = datum_t : : R_ARRAY ) | | <nl> - ( ! d . has ( ) <nl> - & & v0 - > get_type ( ) . is_convertible ( val_t : : type_t : : SEQUENCE ) ) ) { <nl> - / / The above if statement is complicated because it produces better <nl> - / / error messages on e . g . strings . <nl> - if ( counted_t < val_t > no_recurse = args - > optarg ( env , " _NO_RECURSE_ " ) ) { <nl> - rcheck_target ( target , base_exc_t : : GENERIC , no_recurse - > as_bool ( ) = = false , <nl> - strprintf ( " Cannot perform % s on a sequence of sequences . " , <nl> - target - > name ( ) ) ) ; <nl> - } <nl> - <nl> - compile_env_t compile_env ( env - > scope . compute_visibility ( ) ) ; <nl> - counted_t < func_term_t > func_term <nl> - = make_counted < func_term_t > ( & compile_env , func ) ; <nl> - counted_t < const func_t > f = func_term - > eval_to_func ( env - > scope ) ; <nl> - <nl> - counted_t < datum_stream_t > stream = v0 - > as_seq ( env - > env ) ; <nl> - switch ( poly_type ) { <nl> - case MAP : <nl> - stream - > add_transformation ( map_wire_func_t ( f ) , target - > backtrace ( ) ) ; <nl> - break ; <nl> - case FILTER : <nl> - stream - > add_transformation ( filter_wire_func_t ( f , boost : : none ) , <nl> - target - > backtrace ( ) ) ; <nl> - break ; <nl> - case SKIP_MAP : <nl> - stream - > add_transformation ( concatmap_wire_func_t ( f ) , <nl> - target - > backtrace ( ) ) ; <nl> - break ; <nl> - default : unreachable ( ) ; <nl> - } <nl> + compile_env_t compile_env ( env - > scope . compute_visibility ( ) ) ; <nl> + counted_t < func_term_t > func_term <nl> + = make_counted < func_term_t > ( & compile_env , func ) ; <nl> + counted_t < const func_t > f = func_term - > eval_to_func ( env - > scope ) ; <nl> <nl> - return target - > new_val ( env - > env , stream ) ; <nl> + counted_t < datum_stream_t > stream = v0 - > as_seq ( env - > env ) ; <nl> + switch ( poly_type ) { <nl> + case MAP : <nl> + stream - > add_transformation ( map_wire_func_t ( f ) , target - > backtrace ( ) ) ; <nl> + break ; <nl> + case FILTER : <nl> + stream - > add_transformation ( filter_wire_func_t ( f , boost : : none ) , <nl> + target - > backtrace ( ) ) ; <nl> + break ; <nl> + case SKIP_MAP : <nl> + stream - > add_transformation ( concatmap_wire_func_t ( f ) , <nl> + target - > backtrace ( ) ) ; <nl> + break ; <nl> + default : unreachable ( ) ; <nl> } <nl> <nl> - rfail_typed_target ( <nl> - v0 , " Cannot perform % s on a non - object non - sequence ` % s ` . " , <nl> - target - > name ( ) , v0 - > trunc_print ( ) . c_str ( ) ) ; <nl> - } <nl> - <nl> - private : <nl> - poly_type_t poly_type ; <nl> - protob_t < Term > func ; <nl> - <nl> - DISABLE_COPYING ( obj_or_seq_op_impl_t ) ; <nl> - } ; <nl> - <nl> - / / This term is used for functions that are polymorphic on objects and <nl> - / / sequences , like ` pluck ` . It will handle the polymorphism ; terms inheriting <nl> - / / from it just need to implement evaluation on objects ( ` obj_eval ` ) . <nl> - class obj_or_seq_op_term_t : public grouped_seq_op_term_t { <nl> - public : <nl> - obj_or_seq_op_term_t ( compile_env_t * env , protob_t < const Term > term , <nl> - poly_type_t _poly_type , argspec_t argspec ) <nl> - : grouped_seq_op_term_t ( env , term , argspec , optargspec_t ( { " _NO_RECURSE_ " } ) ) , <nl> - impl ( this , _poly_type , term ) { <nl> + return target - > new_val ( env - > env , stream ) ; <nl> } <nl> <nl> - private : <nl> - virtual counted_t < val_t > obj_eval ( scope_env_t * env , <nl> - args_t * args , <nl> - counted_t < val_t > v0 ) const = 0 ; <nl> + rfail_typed_target ( <nl> + v0 , " Cannot perform % s on a non - object non - sequence ` % s ` . " , <nl> + target - > name ( ) , v0 - > trunc_print ( ) . c_str ( ) ) ; <nl> + } <nl> <nl> - virtual counted_t < val_t > eval_impl ( scope_env_t * env , args_t * args , eval_flags_t ) const { <nl> - counted_t < val_t > v0 = args - > arg ( env , 0 ) ; <nl> - return impl . eval_impl_dereferenced ( this , env , args , v0 , <nl> - [ & ] { return this - > obj_eval ( env , args , v0 ) ; } ) ; <nl> - } <nl> + obj_or_seq_op_term_t : : obj_or_seq_op_term_t ( compile_env_t * env , protob_t < const Term > term , <nl> + poly_type_t _poly_type , argspec_t argspec ) <nl> + : grouped_seq_op_term_t ( env , term , argspec , optargspec_t ( { " _NO_RECURSE_ " } ) ) , <nl> + impl ( this , _poly_type , term ) { <nl> + } <nl> <nl> - obj_or_seq_op_impl_t impl ; <nl> - } ; <nl> + counted_t < val_t > obj_or_seq_op_term_t : : eval_impl ( scope_env_t * env , args_t * args , <nl> + eval_flags_t ) const { <nl> + counted_t < val_t > v0 = args - > arg ( env , 0 ) ; <nl> + return impl . eval_impl_dereferenced ( this , env , args , v0 , <nl> + [ & ] { return this - > obj_eval ( env , args , v0 ) ; } ) ; <nl> + } <nl> <nl> class pluck_term_t : public obj_or_seq_op_term_t { <nl> public : <nl> class pluck_term_t : public obj_or_seq_op_term_t { <nl> private : <nl> virtual counted_t < val_t > obj_eval ( scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const { <nl> datum_t obj = v0 - > as_datum ( ) ; <nl> - r_sanity_check ( obj - > get_type ( ) = = datum_t : : R_OBJECT ) ; <nl> + r_sanity_check ( obj . get_type ( ) = = datum_t : : R_OBJECT ) ; <nl> <nl> const size_t n = args - > num_args ( ) ; <nl> std : : vector < datum_t > paths ; <nl> class without_term_t : public obj_or_seq_op_term_t { <nl> private : <nl> virtual counted_t < val_t > obj_eval ( scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const { <nl> datum_t obj = v0 - > as_datum ( ) ; <nl> - r_sanity_check ( obj - > get_type ( ) = = datum_t : : R_OBJECT ) ; <nl> + r_sanity_check ( obj . get_type ( ) = = datum_t : : R_OBJECT ) ; <nl> <nl> std : : vector < datum_t > paths ; <nl> const size_t n = args - > num_args ( ) ; <nl> class merge_term_t : public obj_or_seq_op_term_t { <nl> / / We branch here because compiling functions is expensive , and <nl> / / ` obj_eval ` may be called many many times . <nl> if ( v - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> - d = d - > merge ( v - > as_datum ( ) ) ; <nl> + d = d . merge ( v - > as_datum ( ) ) ; <nl> } else { <nl> auto f = v - > as_func ( CONSTANT_SHORTCUT ) ; <nl> - d = d - > merge ( f - > call ( env - > env , d , LITERAL_OK ) - > as_datum ( ) ) ; <nl> + d = d . merge ( f - > call ( env - > env , d , LITERAL_OK ) - > as_datum ( ) ) ; <nl> } <nl> } <nl> return new_val ( d ) ; <nl> class has_fields_term_t : public obj_or_seq_op_term_t { <nl> private : <nl> virtual counted_t < val_t > obj_eval ( scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const { <nl> datum_t obj = v0 - > as_datum ( ) ; <nl> - r_sanity_check ( obj - > get_type ( ) = = datum_t : : R_OBJECT ) ; <nl> + r_sanity_check ( obj . get_type ( ) = = datum_t : : R_OBJECT ) ; <nl> <nl> std : : vector < datum_t > paths ; <nl> const size_t n = args - > num_args ( ) ; <nl> class get_field_term_t : public obj_or_seq_op_term_t { <nl> : obj_or_seq_op_term_t ( env , term , SKIP_MAP , argspec_t ( 2 ) ) { } <nl> private : <nl> virtual counted_t < val_t > obj_eval ( scope_env_t * env , args_t * args , counted_t < val_t > v0 ) const { <nl> - return new_val ( v0 - > as_datum ( ) - > get_field ( args - > arg ( env , 1 ) - > as_str ( ) ) ) ; <nl> + return new_val ( v0 - > as_datum ( ) . get_field ( args - > arg ( env , 1 ) - > as_str ( ) ) ) ; <nl> } <nl> virtual const char * name ( ) const { return " get_field " ; } <nl> } ; <nl> class bracket_term_t : public grouped_seq_op_term_t { <nl> datum_t d = v1 - > as_datum ( ) ; <nl> r_sanity_check ( d . has ( ) ) ; <nl> <nl> - switch ( d - > get_type ( ) ) { <nl> + switch ( d . get_type ( ) ) { <nl> case datum_t : : R_NUM : <nl> return nth_term_impl ( this , env , v0 , v1 ) ; <nl> case datum_t : : R_STR : <nl> class bracket_term_t : public grouped_seq_op_term_t { <nl> case datum_t : : R_OBJECT : <nl> case datum_t : : UNINITIALIZED : <nl> default : <nl> - d - > type_error ( strprintf ( " Expected NUMBER or STRING as second argument to ` % s ` but found % s . " , <nl> - name ( ) , d - > get_type_name ( ) . c_str ( ) ) ) ; <nl> + d . type_error ( strprintf ( " Expected NUMBER or STRING as second argument to ` % s ` but found % s . " , <nl> + name ( ) , d . get_type_name ( ) . c_str ( ) ) ) ; <nl> unreachable ( ) ; <nl> } <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . 61a163b1a26 <nl> mmm / dev / null <nl> ppp b / src / rdb_protocol / terms / obj_or_seq . hpp <nl> <nl> + / / Copyright 2010 - 2014 RethinkDB , all rights reserved . <nl> + # ifndef RDB_PROTOCOL_TERMS_OBJ_OR_SEQ_HPP_ <nl> + # define RDB_PROTOCOL_TERMS_OBJ_OR_SEQ_HPP_ <nl> + <nl> + # include < functional > <nl> + <nl> + # include " containers / counted . hpp " <nl> + # include " rdb_protocol / counted_term . hpp " <nl> + # include " rdb_protocol / op . hpp " <nl> + # include " rdb_protocol / pb_utils . hpp " <nl> + # include " rdb_protocol / minidriver . hpp " <nl> + # include " utils . hpp " <nl> + <nl> + namespace ql { <nl> + <nl> + enum poly_type_t { <nl> + MAP = 0 , <nl> + FILTER = 1 , <nl> + SKIP_MAP = 2 <nl> + } ; <nl> + <nl> + class obj_or_seq_op_impl_t { <nl> + public : <nl> + obj_or_seq_op_impl_t ( const term_t * self , poly_type_t _poly_type , <nl> + protob_t < const Term > term ) ; <nl> + <nl> + counted_t < val_t > eval_impl_dereferenced ( const term_t * target , scope_env_t * env , <nl> + args_t * args , counted_t < val_t > v0 , <nl> + std : : function < counted_t < val_t > ( ) > helper ) const ; <nl> + <nl> + private : <nl> + poly_type_t poly_type ; <nl> + protob_t < Term > func ; <nl> + <nl> + DISABLE_COPYING ( obj_or_seq_op_impl_t ) ; <nl> + } ; <nl> + <nl> + / / This term is used for functions that are polymorphic on objects and <nl> + / / sequences , like ` pluck ` . It will handle the polymorphism ; terms inheriting <nl> + / / from it just need to implement evaluation on objects ( ` obj_eval ` ) . <nl> + class obj_or_seq_op_term_t : public grouped_seq_op_term_t { <nl> + public : <nl> + obj_or_seq_op_term_t ( compile_env_t * env , protob_t < const Term > term , <nl> + poly_type_t _poly_type , argspec_t argspec ) ; <nl> + <nl> + private : <nl> + virtual counted_t < val_t > obj_eval ( scope_env_t * env , <nl> + args_t * args , <nl> + counted_t < val_t > v0 ) const = 0 ; <nl> + <nl> + virtual counted_t < val_t > eval_impl ( scope_env_t * env , args_t * args , eval_flags_t ) const ; <nl> + <nl> + obj_or_seq_op_impl_t impl ; <nl> + } ; <nl> + <nl> + } / / namespace ql <nl> + <nl> + # endif / / RDB_PROTOCOL_TERMS_OBJ_OR_SEQ_HPP_ <nl> mmm a / src / rdb_protocol / terms / pred . cc <nl> ppp b / src / rdb_protocol / terms / pred . cc <nl> class predicate_term_t : public op_term_t { <nl> datum_t lhs = args - > arg ( env , 0 ) - > as_datum ( ) ; <nl> for ( size_t i = 1 ; i < args - > num_args ( ) ; + + i ) { <nl> datum_t rhs = args - > arg ( env , i ) - > as_datum ( ) ; <nl> - if ( ! ( pred ) ( env - > env - > reql_version ( ) , * lhs , * rhs ) ) { <nl> + if ( ! ( pred ) ( env - > env - > reql_version ( ) , lhs , rhs ) ) { <nl> return new_val_bool ( static_cast < bool > ( false ^ invert ) ) ; <nl> } <nl> lhs = rhs ; <nl> mmm a / src / rdb_protocol / terms / random . cc <nl> ppp b / src / rdb_protocol / terms / random . cc <nl> class sample_term_t : public op_term_t { <nl> batchspec_t batchspec = batchspec_t : : user ( batch_type_t : : TERMINAL , env - > env ) ; <nl> { <nl> profile : : sampler_t sampler ( " Sampling elements . " , env - > env - > trace ) ; <nl> - while ( datum_t row = seq - > next ( env - > env , batchspec ) ) { <nl> + datum_t row ; <nl> + while ( row = seq - > next ( env - > env , batchspec ) , row . has ( ) ) { <nl> element_number + + ; <nl> if ( result . size ( ) < num ) { <nl> result . push_back ( row ) ; <nl> mmm a / src / rdb_protocol / terms / seq . cc <nl> ppp b / src / rdb_protocol / terms / seq . cc <nl> class count_term_t : public grouped_seq_op_term_t { <nl> if ( args - > num_args ( ) = = 1 ) { <nl> if ( v0 - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> datum_t d = v0 - > as_datum ( ) ; <nl> - if ( d - > get_type ( ) = = datum_t : : R_BINARY ) { <nl> + if ( d . get_type ( ) = = datum_t : : R_BINARY ) { <nl> return new_val ( datum_t ( <nl> - safe_to_double ( d - > as_binary ( ) . size ( ) ) ) ) ; <nl> + safe_to_double ( d . as_binary ( ) . size ( ) ) ) ) ; <nl> } <nl> } <nl> return v0 - > as_seq ( env - > env ) <nl> class between_term_t : public bounded_op_term_t { <nl> counted_t < table_t > tbl = args - > arg ( env , 0 ) - > as_table ( ) ; <nl> bool left_open = is_left_open ( env , args ) ; <nl> datum_t lb = args - > arg ( env , 1 ) - > as_datum ( ) ; <nl> - if ( lb - > get_type ( ) = = datum_t : : R_NULL ) { <nl> + if ( lb . get_type ( ) = = datum_t : : R_NULL ) { <nl> lb . reset ( ) ; <nl> } <nl> bool right_open = is_right_open ( env , args ) ; <nl> datum_t rb = args - > arg ( env , 2 ) - > as_datum ( ) ; <nl> - if ( rb - > get_type ( ) = = datum_t : : R_NULL ) { <nl> + if ( rb . get_type ( ) = = datum_t : : R_NULL ) { <nl> rb . reset ( ) ; <nl> } <nl> <nl> if ( lb . has ( ) & & rb . has ( ) ) { <nl> / / This reql_version will always be LATEST , because this function is not <nl> / / deterministic , but whatever . <nl> - if ( lb - > compare_gt ( env - > env - > reql_version ( ) , * rb ) | | <nl> - ( ( left_open | | right_open ) & & * lb = = * rb ) ) { <nl> + if ( lb . compare_gt ( env - > env - > reql_version ( ) , rb ) | | <nl> + ( ( left_open | | right_open ) & & lb = = rb ) ) { <nl> counted_t < datum_stream_t > ds <nl> = make_counted < array_datum_stream_t > ( datum_t : : empty_array ( ) , <nl> backtrace ( ) ) ; <nl> mmm a / src / rdb_protocol / terms / sindex . cc <nl> ppp b / src / rdb_protocol / terms / sindex . cc <nl> class sindex_create_term_t : public op_term_t { <nl> virtual counted_t < val_t > eval_impl ( scope_env_t * env , args_t * args , eval_flags_t ) const { <nl> counted_t < table_t > table = args - > arg ( env , 0 ) - > as_table ( ) ; <nl> datum_t name_datum = args - > arg ( env , 1 ) - > as_datum ( ) ; <nl> - std : : string name = name_datum - > as_str ( ) . to_std ( ) ; <nl> + std : : string name = name_datum . as_str ( ) . to_std ( ) ; <nl> rcheck ( name ! = table - > get_pkey ( ) , <nl> base_exc_t : : GENERIC , <nl> strprintf ( " Index name conflict : ` % s ` is the name of the primary key . " , <nl> class sindex_create_term_t : public op_term_t { <nl> counted_t < val_t > v = args - > arg ( env , 2 ) ; <nl> if ( v - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> datum_t d = v - > as_datum ( ) ; <nl> - if ( d - > get_type ( ) = = datum_t : : R_BINARY ) { <nl> - const char * data = d - > as_binary ( ) . data ( ) ; <nl> - size_t sz = d - > as_binary ( ) . size ( ) ; <nl> + if ( d . get_type ( ) = = datum_t : : R_BINARY ) { <nl> + const char * data = d . as_binary ( ) . data ( ) ; <nl> + size_t sz = d . as_binary ( ) . size ( ) ; <nl> size_t prefix_sz = strlen ( sindex_blob_prefix ) ; <nl> bool bad_prefix = ( sz < prefix_sz ) ; <nl> for ( size_t i = 0 ; ! bad_prefix & & i < prefix_sz ; + + i ) { <nl> class sindex_drop_term_t : public op_term_t { <nl> <nl> virtual counted_t < val_t > eval_impl ( scope_env_t * env , args_t * args , eval_flags_t ) const { <nl> counted_t < table_t > table = args - > arg ( env , 0 ) - > as_table ( ) ; <nl> - std : : string name = args - > arg ( env , 1 ) - > as_datum ( ) - > as_str ( ) . to_std ( ) ; <nl> + std : : string name = args - > arg ( env , 1 ) - > as_datum ( ) . as_str ( ) . to_std ( ) ; <nl> bool success = table - > sindex_drop ( env - > env , name ) ; <nl> if ( success ) { <nl> datum_object_builder_t res ; <nl> int64_t initial_poll_ms = 50 ; <nl> int64_t max_poll_ms = 10000 ; <nl> <nl> bool all_ready ( datum_t statuses ) { <nl> - for ( size_t i = 0 ; i < statuses - > arr_size ( ) ; + + i ) { <nl> - if ( ! statuses - > get ( i ) - > get_field ( " ready " , NOTHROW ) - > as_bool ( ) ) { <nl> + for ( size_t i = 0 ; i < statuses . arr_size ( ) ; + + i ) { <nl> + if ( ! statuses . get ( i ) . get_field ( " ready " , NOTHROW ) . as_bool ( ) ) { <nl> return false ; <nl> } <nl> } <nl> mmm a / src / rdb_protocol / terms / sort . cc <nl> ppp b / src / rdb_protocol / terms / sort . cc <nl> class orderby_term_t : public op_term_t { <nl> return false ! = ( it - > first = = DESC ) ; <nl> } <nl> / / TODO ( 2014 - 08 ) : use datum_t : : cmp instead to be faster <nl> - if ( * lval = = * rval ) { <nl> + if ( lval = = rval ) { <nl> continue ; <nl> } <nl> - return lval - > compare_lt ( env - > reql_version ( ) , * rval ) ! = <nl> + return lval . compare_lt ( env - > reql_version ( ) , rval ) ! = <nl> ( it - > first = = DESC ) ; <nl> } <nl> <nl> class distinct_term_t : public op_term_t { <nl> { <nl> profile : : sampler_t sampler ( " Evaluating elements in distinct . " , <nl> env - > env - > trace ) ; <nl> - while ( datum_t d = s - > next ( env - > env , batchspec ) ) { <nl> + datum_t d ; <nl> + while ( d = s - > next ( env - > env , batchspec ) , d . has ( ) ) { <nl> results . insert ( std : : move ( d ) ) ; <nl> rcheck_array_size ( results , env - > env - > limits ( ) , base_exc_t : : GENERIC ) ; <nl> sampler . new_sample ( ) ; <nl> mmm a / src / rdb_protocol / terms / string . cc <nl> ppp b / src / rdb_protocol / terms / string . cc <nl> class split_term_t : public op_term_t { <nl> boost : : optional < std : : string > delim ; <nl> if ( args - > num_args ( ) > 1 ) { <nl> datum_t d = args - > arg ( env , 1 ) - > as_datum ( ) ; <nl> - if ( d - > get_type ( ) ! = datum_t : : R_NULL ) { <nl> - delim = d - > as_str ( ) . to_std ( ) ; <nl> + if ( d . get_type ( ) ! = datum_t : : R_NULL ) { <nl> + delim = d . as_str ( ) . to_std ( ) ; <nl> } <nl> } <nl> <nl> mmm a / src / rdb_protocol / terms / time . cc <nl> ppp b / src / rdb_protocol / terms / time . cc <nl> class during_term_t : public bounded_op_term_t { <nl> datum_t t = args - > arg ( env , 0 ) - > as_ptype ( pseudo : : time_string ) ; <nl> datum_t lb = args - > arg ( env , 1 ) - > as_ptype ( pseudo : : time_string ) ; <nl> datum_t rb = args - > arg ( env , 2 ) - > as_ptype ( pseudo : : time_string ) ; <nl> - int lcmp = pseudo : : time_cmp ( env - > env - > reql_version ( ) , * lb , * t ) ; <nl> - int rcmp = pseudo : : time_cmp ( env - > env - > reql_version ( ) , * t , * rb ) ; <nl> + int lcmp = pseudo : : time_cmp ( env - > env - > reql_version ( ) , lb , t ) ; <nl> + int rcmp = pseudo : : time_cmp ( env - > env - > reql_version ( ) , t , rb ) ; <nl> return new_val_bool ( ! ( lcmp > 0 | | ( lcmp = = 0 & & is_left_open ( env , args ) ) <nl> | | rcmp > 0 | | ( rcmp = = 0 & & is_right_open ( env , args ) ) ) ) ; <nl> } <nl> class time_term_t : public op_term_t { <nl> } <nl> static std : : string parse_tz ( counted_t < val_t > v ) { <nl> datum_t d = v - > as_datum ( ) ; <nl> - return d - > as_str ( ) . to_std ( ) ; <nl> + return d . as_str ( ) . to_std ( ) ; <nl> } <nl> virtual const char * name ( ) const { return " time " ; } <nl> } ; <nl> mmm a / src / rdb_protocol / terms / type_manip . cc <nl> ppp b / src / rdb_protocol / terms / type_manip . cc <nl> class coerce_term_t : public op_term_t { <nl> int start_subtype = 0 ; <nl> if ( opaque_start_type . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> start_supertype = val_t : : type_t : : DATUM ; <nl> - start_subtype = val - > as_datum ( ) - > get_type ( ) ; <nl> + start_subtype = val - > as_datum ( ) . get_type ( ) ; <nl> } <nl> int start_type = merge_types ( start_supertype , start_subtype ) ; <nl> <nl> class coerce_term_t : public op_term_t { <nl> / / DATUM - > DATUM <nl> if ( supertype ( end_type ) = = val_t : : type_t : : DATUM ) { <nl> if ( start_type = = R_BINARY_TYPE & & end_type = = R_STR_TYPE ) { <nl> - return new_val ( datum_t ( d - > as_binary ( ) ) ) ; <nl> + return new_val ( datum_t ( d . as_binary ( ) ) ) ; <nl> } <nl> if ( start_type = = R_STR_TYPE & & end_type = = R_BINARY_TYPE ) { <nl> - return new_val ( datum_t : : binary ( d - > as_str ( ) ) ) ; <nl> + return new_val ( datum_t : : binary ( d . as_str ( ) ) ) ; <nl> } <nl> <nl> / / DATUM - > STR <nl> if ( end_type = = R_STR_TYPE ) { <nl> - return new_val ( datum_t ( datum_string_t ( d - > print ( ) ) ) ) ; <nl> + return new_val ( datum_t ( datum_string_t ( d . print ( ) ) ) ) ; <nl> } <nl> <nl> / / OBJECT - > ARRAY <nl> class coerce_term_t : public op_term_t { <nl> <nl> / / STR - > NUM <nl> if ( start_type = = R_STR_TYPE & & end_type = = R_NUM_TYPE ) { <nl> - const datum_string_t & s = d - > as_str ( ) ; <nl> + const datum_string_t & s = d . as_str ( ) ; <nl> double dbl ; <nl> char end ; / / Used to ensure that there ' s no trailing garbage . <nl> if ( sscanf ( s . to_std ( ) . c_str ( ) , " % lf % c " , & dbl , & end ) = = 1 ) { <nl> class coerce_term_t : public op_term_t { <nl> = batchspec_t : : user ( batch_type_t : : TERMINAL , env - > env ) ; <nl> { <nl> profile : : sampler_t sampler ( " Coercing to object . " , env - > env - > trace ) ; <nl> - while ( auto pair = ds - > next ( env - > env , batchspec ) ) { <nl> - const datum_string_t & key = pair - > get ( 0 ) - > as_str ( ) ; <nl> - datum_t keyval = pair - > get ( 1 ) ; <nl> + datum_t pair ; <nl> + while ( pair = ds - > next ( env - > env , batchspec ) , pair . has ( ) ) { <nl> + const datum_string_t & key = pair . get ( 0 ) . as_str ( ) ; <nl> + datum_t keyval = pair . get ( 1 ) ; <nl> bool b = obj . add ( key , keyval ) ; <nl> rcheck ( ! b , base_exc_t : : GENERIC , <nl> strprintf ( " Duplicate key ` % s ` in coerced object . " <nl> " ( got ` % s ` and ` % s ` as values ) " , <nl> key . to_std ( ) . c_str ( ) , <nl> - obj . at ( key ) - > trunc_print ( ) . c_str ( ) , <nl> - keyval - > trunc_print ( ) . c_str ( ) ) ) ; <nl> + obj . at ( key ) . trunc_print ( ) . c_str ( ) , <nl> + keyval . trunc_print ( ) . c_str ( ) ) ) ; <nl> sampler . new_sample ( ) ; <nl> } <nl> } <nl> class ungroup_term_t : public op_term_t { <nl> int val_type ( counted_t < val_t > v ) { <nl> int t = v - > get_type ( ) . raw_type * MAX_TYPE ; <nl> if ( t = = DATUM_TYPE ) { <nl> - t + = v - > as_datum ( ) - > get_type ( ) ; <nl> + t + = v - > as_datum ( ) . get_type ( ) ; <nl> } else if ( t = = SELECTION_TYPE ) { <nl> if ( v - > sequence ( ) - > is_array ( ) ) { <nl> t + = datum_t : : R_ARRAY ; <nl> class typeof_term_t : public op_term_t { <nl> counted_t < val_t > v = args - > arg ( env , 0 ) ; <nl> if ( v - > get_type ( ) . raw_type = = val_t : : type_t : : DATUM ) { <nl> datum_t d = v - > as_datum ( ) ; <nl> - return new_val ( datum_t ( datum_string_t ( d - > get_type_name ( ) ) ) ) ; <nl> + return new_val ( datum_t ( datum_string_t ( d . get_type_name ( ) ) ) ) ; <nl> } else if ( v - > get_type ( ) . raw_type = = val_t : : type_t : : SEQUENCE <nl> & & v - > as_seq ( env - > env ) - > is_grouped ( ) ) { <nl> return new_val ( datum_t ( " GROUPED_STREAM " ) ) ; <nl> class info_term_t : public op_term_t { <nl> case R_BINARY_TYPE : / / fallthru <nl> b | = info . add ( " count " , <nl> datum_t ( <nl> - safe_to_double ( v - > as_datum ( ) - > as_binary ( ) . size ( ) ) ) ) ; <nl> + safe_to_double ( v - > as_datum ( ) . as_binary ( ) . size ( ) ) ) ) ; <nl> <nl> case R_NULL_TYPE : / / fallthru <nl> case R_BOOL_TYPE : / / fallthru <nl> class info_term_t : public op_term_t { <nl> case R_OBJECT_TYPE : / / fallthru <nl> case DATUM_TYPE : { <nl> b | = info . add ( " value " , <nl> - datum_t ( datum_string_t ( v - > as_datum ( ) - > print ( ) ) ) ) ; <nl> + datum_t ( datum_string_t ( v - > as_datum ( ) . print ( ) ) ) ) ; <nl> } break ; <nl> <nl> default : r_sanity_check ( false ) ; <nl> mmm a / src / rdb_protocol / terms / writes . cc <nl> ppp b / src / rdb_protocol / terms / writes . cc <nl> class insert_term_t : public op_term_t { <nl> std : : vector < std : : string > * generated_keys_out , <nl> size_t * keys_skipped_out , <nl> datum_t * datum_out ) { <nl> - if ( ! ( * datum_out ) - > get_field ( datum_string_t ( tbl - > get_pkey ( ) ) , NOTHROW ) . has ( ) ) { <nl> + if ( ! ( * datum_out ) . get_field ( datum_string_t ( tbl - > get_pkey ( ) ) , NOTHROW ) . has ( ) ) { <nl> std : : string key = uuid_to_str ( generate_uuid ( ) ) ; <nl> datum_t keyd ( ( datum_string_t ( key ) ) ) ; <nl> { <nl> class insert_term_t : public op_term_t { <nl> bool conflict = d . add ( datum_string_t ( tbl - > get_pkey ( ) ) , keyd ) ; <nl> r_sanity_check ( ! conflict ) ; <nl> std : : set < std : : string > conditions ; <nl> - * datum_out = ( * datum_out ) - > merge ( std : : move ( d ) . to_datum ( ) , pure_merge , <nl> + * datum_out = ( * datum_out ) . merge ( std : : move ( d ) . to_datum ( ) , pure_merge , <nl> limits , & conditions ) ; <nl> / / we happen to know that pure_merge cannot ever generate warning <nl> / / conditions , because it shouldn ' t ever be run . <nl> class insert_term_t : public op_term_t { <nl> if ( v1 - > get_type ( ) . is_convertible ( val_t : : type_t : : DATUM ) ) { <nl> std : : vector < datum_t > datums ; <nl> datums . push_back ( v1 - > as_datum ( ) ) ; <nl> - if ( datums [ 0 ] - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + if ( datums [ 0 ] . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> try { <nl> maybe_generate_key ( t , env - > env - > limits ( ) , & generated_keys , <nl> & keys_skipped , & datums [ 0 ] ) ; <nl> class insert_term_t : public op_term_t { <nl> datum_t replace_stats = t - > batched_insert ( <nl> env - > env , std : : move ( datums ) , conflict_behavior , <nl> durability_requirement , return_changes ) ; <nl> - stats = stats - > merge ( replace_stats , stats_merge , env - > env - > limits ( ) , & conditions ) ; <nl> + stats = stats . merge ( replace_stats , stats_merge , env - > env - > limits ( ) , & conditions ) ; <nl> done = true ; <nl> } <nl> } <nl> class insert_term_t : public op_term_t { <nl> <nl> datum_t replace_stats = t - > batched_insert ( <nl> env - > env , std : : move ( datums ) , conflict_behavior , durability_requirement , return_changes ) ; <nl> - stats = stats - > merge ( replace_stats , stats_merge , env - > env - > limits ( ) , & conditions ) ; <nl> + stats = stats . merge ( replace_stats , stats_merge , env - > env - > limits ( ) , & conditions ) ; <nl> } <nl> } <nl> <nl> class insert_term_t : public op_term_t { <nl> UNUSED bool b = d . add ( " generated_keys " , <nl> datum_t ( std : : move ( genkeys ) , <nl> env - > env - > limits ( ) ) ) ; <nl> - stats = stats - > merge ( std : : move ( d ) . to_datum ( ) , pure_merge , <nl> + stats = stats . merge ( std : : move ( d ) . to_datum ( ) , pure_merge , <nl> env - > env - > limits ( ) , & conditions ) ; <nl> } <nl> <nl> class replace_term_t : public op_term_t { <nl> datum_t orig_key = v0 - > get_orig_key ( ) ; <nl> if ( ! orig_key . has ( ) ) { <nl> orig_key = <nl> - orig_val - > get_field ( datum_string_t ( tblrow . first - > get_pkey ( ) ) , NOTHROW ) ; <nl> + orig_val . get_field ( datum_string_t ( tblrow . first - > get_pkey ( ) ) , NOTHROW ) ; <nl> r_sanity_check ( orig_key . has ( ) ) ; <nl> } <nl> <nl> class replace_term_t : public op_term_t { <nl> datum_t replace_stats = tblrow . first - > batched_replace ( <nl> env - > env , vals , keys , f , <nl> nondet_ok , durability_requirement , return_changes ) ; <nl> - stats = stats - > merge ( replace_stats , stats_merge , env - > env - > limits ( ) , <nl> + stats = stats . merge ( replace_stats , stats_merge , env - > env - > limits ( ) , <nl> & conditions ) ; <nl> } else { <nl> std : : pair < counted_t < table_t > , counted_t < datum_stream_t > > tblrows <nl> class replace_term_t : public op_term_t { <nl> std : : vector < datum_t > keys ; <nl> keys . reserve ( vals . size ( ) ) ; <nl> for ( auto it = vals . begin ( ) ; it ! = vals . end ( ) ; + + it ) { <nl> - keys . push_back ( ( * it ) - > get_field ( datum_string_t ( tbl - > get_pkey ( ) ) ) ) ; <nl> + keys . push_back ( ( * it ) . get_field ( datum_string_t ( tbl - > get_pkey ( ) ) ) ) ; <nl> } <nl> datum_t replace_stats = tbl - > batched_replace ( <nl> env - > env , vals , keys , <nl> f , nondet_ok , durability_requirement , return_changes ) ; <nl> - stats = stats - > merge ( replace_stats , stats_merge , env - > env - > limits ( ) , & conditions ) ; <nl> + stats = stats . merge ( replace_stats , stats_merge , env - > env - > limits ( ) , & conditions ) ; <nl> } <nl> } <nl> <nl> class foreach_term_t : public op_term_t { <nl> profile : : sampler_t sampler ( " Evaluating elements in for each . " , <nl> env - > env - > trace ) ; <nl> counted_t < const func_t > f = args - > arg ( env , 1 ) - > as_func ( CONSTANT_SHORTCUT ) ; <nl> - while ( datum_t row = ds - > next ( env - > env , batchspec ) ) { <nl> + datum_t row ; <nl> + while ( row = ds - > next ( env - > env , batchspec ) , row . has ( ) ) { <nl> counted_t < val_t > v = f - > call ( env - > env , row ) ; <nl> try { <nl> datum_t d = v - > as_datum ( ) ; <nl> - if ( d - > get_type ( ) = = datum_t : : R_OBJECT ) { <nl> - stats = stats - > merge ( d , stats_merge , env - > env - > limits ( ) , <nl> + if ( d . get_type ( ) = = datum_t : : R_OBJECT ) { <nl> + stats = stats . merge ( d , stats_merge , env - > env - > limits ( ) , <nl> & conditions ) ; <nl> } else { <nl> - for ( size_t i = 0 ; i < d - > arr_size ( ) ; + + i ) { <nl> - stats = stats - > merge ( d - > get ( i ) , stats_merge , env - > env - > limits ( ) , <nl> - & conditions ) ; <nl> + for ( size_t i = 0 ; i < d . arr_size ( ) ; + + i ) { <nl> + stats = stats . merge ( d . get ( i ) , stats_merge , env - > env - > limits ( ) , <nl> + & conditions ) ; <nl> } <nl> } <nl> } catch ( const exc_t & e ) { <nl> mmm a / src / rdb_protocol / val . cc <nl> ppp b / src / rdb_protocol / val . cc <nl> datum_t table_t : : batched_replace ( <nl> datum_t new_val ; <nl> try { <nl> new_val = replacement_generator - > call ( env , vals [ i ] ) - > as_datum ( ) ; <nl> - new_val - > rcheck_valid_replace ( vals [ i ] , keys [ i ] , <nl> - datum_string_t ( get_pkey ( ) ) ) ; <nl> + new_val . rcheck_valid_replace ( vals [ i ] , keys [ i ] , <nl> + datum_string_t ( get_pkey ( ) ) ) ; <nl> r_sanity_check ( new_val . has ( ) ) ; <nl> replacement_values . push_back ( new_val ) ; <nl> } catch ( const base_exc_t & e ) { <nl> datum_t table_t : : batched_replace ( <nl> durability_requirement , return_changes ) ; <nl> std : : set < std : : string > conditions ; <nl> datum_t merged <nl> - = std : : move ( stats ) . to_datum ( ) - > merge ( insert_stats , stats_merge , <nl> + = std : : move ( stats ) . to_datum ( ) . merge ( insert_stats , stats_merge , <nl> env - > limits ( ) , & conditions ) ; <nl> datum_object_builder_t result ( merged ) ; <nl> result . add_warnings ( conditions , env - > limits ( ) ) ; <nl> datum_t table_t : : batched_insert ( <nl> for ( auto it = insert_datums . begin ( ) ; it ! = insert_datums . end ( ) ; + + it ) { <nl> try { <nl> datum_string_t pkey_w ( get_pkey ( ) ) ; <nl> - ( * it ) - > rcheck_valid_replace ( datum_t ( ) , <nl> - datum_t ( ) , <nl> - pkey_w ) ; <nl> - const ql : : datum_t & keyval = ( * it ) - > get_field ( pkey_w ) ; <nl> - keyval - > print_primary ( ) ; / / does error checking <nl> + it - > rcheck_valid_replace ( datum_t ( ) , <nl> + datum_t ( ) , <nl> + pkey_w ) ; <nl> + const ql : : datum_t & keyval = ( * it ) . get_field ( pkey_w ) ; <nl> + keyval . print_primary ( ) ; / / does error checking <nl> valid_inserts . push_back ( std : : move ( * it ) ) ; <nl> } catch ( const base_exc_t & e ) { <nl> stats . add_error ( e . what ( ) ) ; <nl> datum_t table_t : : batched_insert ( <nl> durability_requirement ) ; <nl> std : : set < std : : string > conditions ; <nl> datum_t merged <nl> - = std : : move ( stats ) . to_datum ( ) - > merge ( insert_stats , stats_merge , <nl> + = std : : move ( stats ) . to_datum ( ) . merge ( insert_stats , stats_merge , <nl> env - > limits ( ) , & conditions ) ; <nl> datum_object_builder_t result ( merged ) ; <nl> result . add_warnings ( conditions , env - > limits ( ) ) ; <nl> counted_t < datum_stream_t > val_t : : as_seq ( env_t * env ) { <nl> } else if ( type . raw_type = = type_t : : TABLE ) { <nl> return table - > as_datum_stream ( env , backtrace ( ) ) ; <nl> } else if ( type . raw_type = = type_t : : DATUM ) { <nl> - return datum ( ) - > as_datum_stream ( backtrace ( ) ) ; <nl> + return datum ( ) . as_datum_stream ( backtrace ( ) ) ; <nl> } <nl> rcheck_literal_type ( type_t : : SEQUENCE ) ; <nl> unreachable ( ) ; <nl> datum_t val_t : : as_ptype ( const std : : string s ) { <nl> try { <nl> datum_t d = as_datum ( ) ; <nl> r_sanity_check ( d . has ( ) ) ; <nl> - d - > rcheck_is_ptype ( s ) ; <nl> + d . rcheck_is_ptype ( s ) ; <nl> return d ; <nl> } catch ( const datum_exc_t & e ) { <nl> rfail ( e . get_type ( ) , " % s " , e . what ( ) ) ; <nl> bool val_t : : as_bool ( ) { <nl> try { <nl> datum_t d = as_datum ( ) ; <nl> r_sanity_check ( d . has ( ) ) ; <nl> - return d - > as_bool ( ) ; <nl> + return d . as_bool ( ) ; <nl> } catch ( const datum_exc_t & e ) { <nl> rfail ( e . get_type ( ) , " % s " , e . what ( ) ) ; <nl> } <nl> double val_t : : as_num ( ) { <nl> try { <nl> datum_t d = as_datum ( ) ; <nl> r_sanity_check ( d . has ( ) ) ; <nl> - return d - > as_num ( ) ; <nl> + return d . as_num ( ) ; <nl> } catch ( const datum_exc_t & e ) { <nl> rfail ( e . get_type ( ) , " % s " , e . what ( ) ) ; <nl> } <nl> int64_t val_t : : as_int ( ) { <nl> try { <nl> datum_t d = as_datum ( ) ; <nl> r_sanity_check ( d . has ( ) ) ; <nl> - return d - > as_int ( ) ; <nl> + return d . as_int ( ) ; <nl> } catch ( const datum_exc_t & e ) { <nl> rfail ( e . get_type ( ) , " % s " , e . what ( ) ) ; <nl> } <nl> datum_string_t val_t : : as_str ( ) { <nl> try { <nl> datum_t d = as_datum ( ) ; <nl> r_sanity_check ( d . has ( ) ) ; <nl> - return d - > as_str ( ) ; <nl> + return d . as_str ( ) ; <nl> } catch ( const datum_exc_t & e ) { <nl> rfail ( e . get_type ( ) , " % s " , e . what ( ) ) ; <nl> } <nl> void val_t : : rcheck_literal_type ( type_t : : raw_type_t expected_raw_type ) const { <nl> <nl> std : : string val_t : : print ( ) const { <nl> if ( get_type ( ) . is_convertible ( type_t : : DATUM ) ) { <nl> - return as_datum ( ) - > print ( ) ; <nl> + return as_datum ( ) . print ( ) ; <nl> } else if ( get_type ( ) . is_convertible ( type_t : : DB ) ) { <nl> return strprintf ( " db ( \ " % s \ " ) " , as_db ( ) - > name . c_str ( ) ) ; <nl> } else if ( get_type ( ) . is_convertible ( type_t : : TABLE ) ) { <nl> std : : string val_t : : print ( ) const { <nl> <nl> std : : string val_t : : trunc_print ( ) const { <nl> if ( get_type ( ) . is_convertible ( type_t : : DATUM ) ) { <nl> - return as_datum ( ) - > trunc_print ( ) ; <nl> + return as_datum ( ) . trunc_print ( ) ; <nl> } else { <nl> std : : string s = print ( ) ; <nl> if ( s . size ( ) > datum_t : : trunc_len ) { <nl> mmm a / src / rdb_protocol / var_types . cc <nl> ppp b / src / rdb_protocol / var_types . cc <nl> std : : string var_scope_t : : print ( ) const { <nl> } else if ( implicit_depth = = 1 ) { <nl> ret + = " implicit : " ; <nl> if ( maybe_implicit . has ( ) ) { <nl> - ret + = maybe_implicit - > print ( ) ; <nl> + ret + = maybe_implicit . print ( ) ; <nl> } else { <nl> ret + = " ( not stored ) " ; <nl> } <nl> std : : string var_scope_t : : print ( ) const { <nl> for ( auto it = vars . begin ( ) ; it ! = vars . end ( ) ; + + it ) { <nl> ret + = " , " ; <nl> ret + = strprintf ( " % " PRIi64 " : " , it - > first . value ) ; <nl> - ret + = it - > second - > print ( ) ; <nl> + ret + = it - > second . print ( ) ; <nl> } <nl> ret + = " ] " ; <nl> return ret ; <nl> mmm a / src / serializer / log / data_block_manager . cc <nl> ppp b / src / serializer / log / data_block_manager . cc <nl> void data_block_manager_t : : run_gc ( gc_state_t * gc_state ) { <nl> <nl> if ( state = = state_shutting_down ) { <nl> active_gcs . remove ( gc_state ) ; <nl> + delete gc_state ; <nl> if ( active_gcs . empty ( ) ) { <nl> actually_shutdown ( ) ; <nl> } <nl> void data_block_manager_t : : run_gc ( gc_state_t * gc_state ) { <nl> } <nl> <nl> active_gcs . remove ( gc_state ) ; <nl> + delete gc_state ; <nl> } <nl> <nl> void data_block_manager_t : : gc_one_extent ( gc_state_t * gc_state ) { <nl> mmm a / src / unittest / btree_sindex . cc <nl> ppp b / src / unittest / btree_sindex . cc <nl> TPTEST ( BTreeSindex , BtreeStoreAPI ) { <nl> rdb_get ( key , store . get_sindex_slice ( sindex_uuid ) , <nl> sindex_super_block . get ( ) , & response , NULL ) ; <nl> <nl> - ASSERT_EQ ( ql : : datum_t ( 1 . 0 ) , * response . data ) ; <nl> + ASSERT_EQ ( ql : : datum_t ( 1 . 0 ) , response . data ) ; <nl> } <nl> } <nl> <nl> mmm a / src / unittest / datum_test . cc <nl> ppp b / src / unittest / datum_test . cc <nl> <nl> <nl> # include " containers / archive / string_stream . hpp " <nl> # include " rdb_protocol / datum . hpp " <nl> + # include " rdb_protocol / datum_string . hpp " <nl> # include " rdb_protocol / env . hpp " <nl> # include " unittest / gtest . hpp " <nl> <nl> <nl> namespace unittest { <nl> <nl> void test_datum_serialization ( const ql : : datum_t datum ) { <nl> - string_stream_t write_stream ; <nl> - write_message_t wm ; <nl> - serialize < cluster_version_t : : LATEST_OVERALL > ( & wm , datum ) ; <nl> - int write_res = send_write_message ( & write_stream , & wm ) ; <nl> - ASSERT_EQ ( 0 , write_res ) ; <nl> - <nl> - string_read_stream_t read_stream ( std : : move ( write_stream . str ( ) ) , 0 ) ; <nl> ql : : datum_t deserialized_datum ; <nl> - archive_result_t res <nl> - = deserialize < cluster_version_t : : LATEST_OVERALL > ( & read_stream , & deserialized_datum ) ; <nl> - ASSERT_EQ ( archive_result_t : : SUCCESS , res ) ; <nl> - ASSERT_EQ ( * datum , * deserialized_datum ) ; <nl> + { <nl> + string_stream_t write_stream ; <nl> + write_message_t wm ; <nl> + serialize < cluster_version_t : : LATEST_OVERALL > ( & wm , datum ) ; <nl> + int write_res = send_write_message ( & write_stream , & wm ) ; <nl> + ASSERT_EQ ( 0 , write_res ) ; <nl> + <nl> + string_read_stream_t read_stream ( std : : move ( write_stream . str ( ) ) , 0 ) ; <nl> + archive_result_t res <nl> + = deserialize < cluster_version_t : : LATEST_OVERALL > ( & read_stream , <nl> + & deserialized_datum ) ; <nl> + ASSERT_EQ ( archive_result_t : : SUCCESS , res ) ; <nl> + ASSERT_EQ ( datum , deserialized_datum ) ; <nl> + } <nl> + <nl> + / / Re - serialize the just deserialized datum a second time . This might use <nl> + / / a different serialization routine , in case the deserialized datum is in <nl> + / / a shared buffer representation . <nl> + { <nl> + string_stream_t write_stream ; <nl> + write_message_t wm ; <nl> + serialize < cluster_version_t : : LATEST_OVERALL > ( & wm , deserialized_datum ) ; <nl> + int write_res = send_write_message ( & write_stream , & wm ) ; <nl> + ASSERT_EQ ( 0 , write_res ) ; <nl> + <nl> + string_read_stream_t read_stream ( std : : move ( write_stream . str ( ) ) , 0 ) ; <nl> + ql : : datum_t redeserialized_datum ; <nl> + archive_result_t res <nl> + = deserialize < cluster_version_t : : LATEST_OVERALL > ( & read_stream , <nl> + & redeserialized_datum ) ; <nl> + ASSERT_EQ ( archive_result_t : : SUCCESS , res ) ; <nl> + ASSERT_EQ ( deserialized_datum , redeserialized_datum ) ; <nl> + } <nl> } <nl> <nl> <nl> TEST ( DatumTest , NumericSerialization ) { <nl> test_datum_serialization ( ql : : datum_t ( std : : move ( vec ) , limits ) ) ; <nl> } <nl> <nl> + / / Tests our ability to read old arrays and objects that were not serialized <nl> + / / in the new buffer - backable format yet . <nl> + TEST ( DatumTest , LegacyDeserialization ) { <nl> + / / An array of two nulls <nl> + std : : vector < char > legacy_array = { 0x01 , 0x02 , 0x03 , 0x03 } ; <nl> + ql : : datum_t reference_array ( <nl> + std : : vector < ql : : datum_t > <nl> + { ql : : datum_t : : null ( ) , <nl> + ql : : datum_t : : null ( ) } , <nl> + ql : : configured_limits_t : : unlimited ) ; <nl> + / / An object { a : null , b : null } <nl> + std : : vector < char > legacy_object = <nl> + { 0x05 , 0x02 , 0x01 , ' a ' , 0x03 , 0x01 , ' b ' , 0x03 } ; <nl> + ql : : datum_t reference_object ( std : : map < datum_string_t , ql : : datum_t > <nl> + { std : : make_pair ( datum_string_t ( " a " ) , ql : : datum_t : : null ( ) ) , <nl> + std : : make_pair ( datum_string_t ( " b " ) , ql : : datum_t : : null ( ) ) } ) ; <nl> + { <nl> + ql : : datum_t deserialized_array ; <nl> + vector_read_stream_t s ( std : : move ( legacy_array ) ) ; <nl> + archive_result_t res = datum_deserialize ( & s , & deserialized_array ) ; <nl> + ASSERT_EQ ( archive_result_t : : SUCCESS , res ) ; <nl> + ASSERT_EQ ( deserialized_array , reference_array ) ; <nl> + } <nl> + { <nl> + ql : : datum_t deserialized_object ; <nl> + vector_read_stream_t s ( std : : move ( legacy_object ) ) ; <nl> + archive_result_t res = datum_deserialize ( & s , & deserialized_object ) ; <nl> + ASSERT_EQ ( archive_result_t : : SUCCESS , res ) ; <nl> + ASSERT_EQ ( deserialized_object , reference_object ) ; <nl> + } <nl> + } <nl> <nl> + TEST ( DatumTest , ObjectSerialization ) { <nl> + { <nl> + ql : : datum_t test_object ( ( std : : map < datum_string_t , ql : : datum_t > ( ) ) ) ; <nl> + test_datum_serialization ( test_object ) ; <nl> + } <nl> + { <nl> + ql : : datum_t test_object ( std : : map < datum_string_t , ql : : datum_t > <nl> + { std : : make_pair ( datum_string_t ( " a " ) , ql : : datum_t : : null ( ) ) , <nl> + std : : make_pair ( datum_string_t ( " b " ) , ql : : datum_t : : null ( ) ) } ) ; <nl> + test_datum_serialization ( test_object ) ; <nl> + } <nl> + { <nl> + ql : : datum_t test_object ( std : : map < datum_string_t , ql : : datum_t > <nl> + { std : : make_pair ( datum_string_t ( " a " ) , ql : : datum_t : : null ( ) ) , <nl> + std : : make_pair ( datum_string_t ( " b " ) , ql : : datum_t : : null ( ) ) , <nl> + std : : make_pair ( datum_string_t ( " nested " ) , ql : : datum_t ( <nl> + std : : map < datum_string_t , ql : : datum_t > <nl> + { std : : make_pair ( datum_string_t ( " a " ) , ql : : datum_t : : null ( ) ) , <nl> + std : : make_pair ( datum_string_t ( " b " ) , ql : : datum_t : : null ( ) ) } ) ) } ) ; <nl> + test_datum_serialization ( test_object ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( DatumTest , ArraySerialization ) { <nl> + { <nl> + ql : : datum_t test_array ( <nl> + std : : vector < ql : : datum_t > ( ) , ql : : configured_limits_t : : unlimited ) ; <nl> + test_datum_serialization ( test_array ) ; <nl> + } <nl> + { <nl> + ql : : datum_t test_array ( <nl> + std : : vector < ql : : datum_t > <nl> + { ql : : datum_t : : null ( ) , <nl> + ql : : datum_t : : null ( ) } , <nl> + ql : : configured_limits_t : : unlimited ) ; <nl> + test_datum_serialization ( test_array ) ; <nl> + } <nl> + { <nl> + ql : : datum_t test_array ( <nl> + std : : vector < ql : : datum_t > <nl> + { ql : : datum_t : : null ( ) , <nl> + ql : : datum_t : : null ( ) , <nl> + ql : : datum_t ( std : : vector < ql : : datum_t > <nl> + { ql : : datum_t : : null ( ) , <nl> + ql : : datum_t : : null ( ) } , <nl> + ql : : configured_limits_t : : unlimited ) } , <nl> + ql : : configured_limits_t : : unlimited ) ; <nl> + test_datum_serialization ( test_array ) ; <nl> + } <nl> + } <nl> + <nl> + / / Tests serialization with different offset sizes , up to 32 bit <nl> + / / ( 64 bit not tested here , because that would use too much memory for a unit test ) <nl> + TEST ( DatumTest , OffsetScaling ) { <nl> + { <nl> + / / 8 bit <nl> + ql : : datum_t test_string ( datum_string_t ( std : : string ( 1 , ' A ' ) ) ) ; <nl> + ql : : datum_t test_array ( <nl> + std : : vector < ql : : datum_t > { test_string , test_string } , <nl> + ql : : configured_limits_t : : unlimited ) ; <nl> + test_datum_serialization ( test_array ) ; <nl> + } <nl> + { <nl> + / / Test values around the point where we switch to 16 bit offsets . <nl> + for ( size_t sz = 200 ; sz < 300 ; + + sz ) { <nl> + ql : : datum_t test_string ( datum_string_t ( std : : string ( sz / 2 , ' A ' ) ) ) ; <nl> + ql : : datum_t test_array ( <nl> + std : : vector < ql : : datum_t > { test_string , test_string } , <nl> + ql : : configured_limits_t : : unlimited ) ; <nl> + test_datum_serialization ( test_array ) ; <nl> + } <nl> + } <nl> + { <nl> + / / Test values around the point where we switch to 32 bit offsets . <nl> + for ( size_t sz = 65500 ; sz < 65540 ; + + sz ) { <nl> + ql : : datum_t test_string ( datum_string_t ( std : : string ( sz / 2 , ' A ' ) ) ) ; <nl> + ql : : datum_t test_array ( <nl> + std : : vector < ql : : datum_t > { test_string , test_string } , <nl> + ql : : configured_limits_t : : unlimited ) ; <nl> + test_datum_serialization ( test_array ) ; <nl> + } <nl> + } <nl> + } <nl> <nl> } / / namespace unittest <nl> mmm a / src / unittest / geo_indexes . cc <nl> ppp b / src / unittest / geo_indexes . cc <nl> <nl> # include " concurrency / fifo_checker . hpp " <nl> # include " containers / counted . hpp " <nl> # include " debug . hpp " <nl> + # include " rdb_protocol / configured_limits . hpp " <nl> + # include " rdb_protocol / datum . hpp " <nl> + # include " rdb_protocol / error . hpp " <nl> # include " rdb_protocol / geo / distances . hpp " <nl> # include " rdb_protocol / geo / ellipsoid . hpp " <nl> # include " rdb_protocol / geo / exceptions . hpp " <nl> <nl> # include " rdb_protocol / geo / lat_lon_types . hpp " <nl> # include " rdb_protocol / geo / intersection . hpp " <nl> # include " rdb_protocol / geo / primitives . hpp " <nl> - # include " rdb_protocol / configured_limits . hpp " <nl> - # include " rdb_protocol / datum . hpp " <nl> - # include " rdb_protocol / error . hpp " <nl> # include " rdb_protocol / minidriver . hpp " <nl> # include " rdb_protocol / protocol . hpp " <nl> + # include " rdb_protocol / shards . hpp " <nl> # include " stl_utils . hpp " <nl> # include " unittest / rdb_protocol . hpp " <nl> # include " unittest / unittest_utils . hpp " <nl> std : : vector < nearest_geo_read_response_t : : dist_pair_t > perform_get_nearest ( <nl> <nl> std : : string table_name = " test_table " ; / / This is just used to print error messages <nl> std : : string idx_name = " geo " ; <nl> - read_t read ( nearest_geo_read_t ( center , max_distance , max_results , <nl> - WGS84_ELLIPSOID , table_name , idx_name , <nl> + read_t read ( nearest_geo_read_t ( region_t : : universe ( ) , center , max_distance , <nl> + max_results , WGS84_ELLIPSOID , table_name , idx_name , <nl> std : : map < std : : string , ql : : wire_func_t > ( ) ) , <nl> profile_bool_t : : PROFILE ) ; <nl> read_response_t response ; <nl> std : : vector < datum_t > perform_get_intersecting ( <nl> <nl> std : : string table_name = " test_table " ; / / This is just used to print error messages <nl> std : : string idx_name = " geo " ; <nl> - read_t read ( intersecting_geo_read_t ( query_geometry , table_name , idx_name , <nl> - std : : map < std : : string , ql : : wire_func_t > ( ) ) , <nl> + read_t read ( intersecting_geo_read_t ( region_t : : universe ( ) , <nl> + std : : map < std : : string , ql : : wire_func_t > ( ) , <nl> + table_name , ql : : batchspec_t : : all ( ) , <nl> + std : : vector < ql : : transform_variant_t > ( ) , <nl> + boost : : optional < ql : : terminal_variant_t > ( ) , <nl> + sindex_rangespec_t ( idx_name , region_t : : universe ( ) , <nl> + datum_range_t : : universe ( ) ) , <nl> + query_geometry ) , <nl> profile_bool_t : : PROFILE ) ; <nl> read_response_t response ; <nl> <nl> std : : vector < datum_t > perform_get_intersecting ( <nl> osource - > check_in ( " unittest : : perform_get_intersecting ( geo_indexes . cc " ) , <nl> & interruptor ) ; <nl> <nl> - intersecting_geo_read_response_t * geo_response = <nl> - boost : : get < intersecting_geo_read_response_t > ( & response . response ) ; <nl> + rget_read_response_t * geo_response = <nl> + boost : : get < rget_read_response_t > ( & response . response ) ; <nl> if ( geo_response = = NULL ) { <nl> ADD_FAILURE ( ) < < " got wrong type of result back " ; <nl> return std : : vector < datum_t > ( ) ; <nl> } <nl> - if ( boost : : get < ql : : exc_t > ( & geo_response - > results_or_error ) ! = NULL ) { <nl> - ADD_FAILURE ( ) < < boost : : get < ql : : exc_t > ( & geo_response - > results_or_error ) - > what ( ) ; <nl> + if ( boost : : get < ql : : exc_t > ( & geo_response - > result ) ! = NULL ) { <nl> + ADD_FAILURE ( ) < < boost : : get < ql : : exc_t > ( & geo_response - > result ) - > what ( ) ; <nl> return std : : vector < datum_t > ( ) ; <nl> } <nl> <nl> - ql : : datum_t result = boost : : get < ql : : datum_t > ( geo_response - > results_or_error ) ; <nl> + auto result = boost : : get < ql : : grouped_t < ql : : stream_t > > ( & geo_response - > result ) ; <nl> + if ( result = = NULL ) { <nl> + ADD_FAILURE ( ) < < " got wrong type of result back " ; <nl> + return std : : vector < datum_t > ( ) ; <nl> + } <nl> + const ql : : stream_t & result_stream = ( * result ) [ datum_t : : null ( ) ] ; <nl> std : : vector < datum_t > result_datum ; <nl> - result_datum . reserve ( result . arr_size ( ) ) ; <nl> - for ( size_t i = 0 ; i < result . arr_size ( ) ; + + i ) { <nl> - result_datum . push_back ( result . get ( i ) ) ; <nl> + result_datum . reserve ( result_stream . size ( ) ) ; <nl> + for ( size_t i = 0 ; i < result_stream . size ( ) ; + + i ) { <nl> + result_datum . push_back ( result_stream [ i ] . data ) ; <nl> } <nl> return result_datum ; <nl> } <nl> void test_get_intersecting ( const datum_t & query_geometry , <nl> / / 3 . Compare both results <nl> ASSERT_EQ ( intersecting_res . size ( ) , reference_res . size ( ) ) ; <nl> for ( size_t i = 0 ; i < intersecting_res . size ( ) & & i < reference_res . size ( ) ; + + i ) { <nl> - ASSERT_EQ ( * intersecting_res [ i ] , * reference_res [ i ] ) ; <nl> + ASSERT_EQ ( intersecting_res [ i ] , reference_res [ i ] ) ; <nl> } <nl> } <nl> <nl> mmm a / src / unittest / jsproc . cc <nl> ppp b / src / unittest / jsproc . cc <nl> SPAWNER_TEST ( JSProc , LiteralNumber ) { <nl> ql : : datum_t result ; <nl> run_datum_test ( " 9467923 " , & result ) ; <nl> ASSERT_TRUE ( result . has ( ) ) ; <nl> - ASSERT_TRUE ( result - > get_type ( ) = = ql : : datum_t : : R_NUM ) ; <nl> - ASSERT_EQ ( result - > as_int ( ) , 9467923 ) ; <nl> + ASSERT_TRUE ( result . get_type ( ) = = ql : : datum_t : : R_NUM ) ; <nl> + ASSERT_EQ ( result . as_int ( ) , 9467923 ) ; <nl> } <nl> <nl> SPAWNER_TEST ( JSProc , LiteralString ) { <nl> ql : : datum_t result ; <nl> run_datum_test ( " \ " string data \ " " , & result ) ; <nl> ASSERT_TRUE ( result . has ( ) ) ; <nl> - ASSERT_TRUE ( result - > get_type ( ) = = ql : : datum_t : : R_STR ) ; <nl> - ASSERT_EQ ( result - > as_str ( ) , " string data " ) ; <nl> + ASSERT_TRUE ( result . get_type ( ) = = ql : : datum_t : : R_STR ) ; <nl> + ASSERT_EQ ( result . as_str ( ) , " string data " ) ; <nl> } <nl> <nl> SPAWNER_TEST ( JSProc , EvalAndCall ) { <nl> SPAWNER_TEST ( JSProc , EvalAndCall ) { <nl> ASSERT_TRUE ( js_runner . connected ( ) ) ; <nl> <nl> / / Check results <nl> - ql : : datum_t * res_datum = <nl> - boost : : get < ql : : datum_t > ( & result ) ; <nl> + ql : : datum_t * res_datum = boost : : get < ql : : datum_t > ( & result ) ; <nl> ASSERT_TRUE ( res_datum ! = NULL ) ; <nl> ASSERT_TRUE ( res_datum - > has ( ) ) ; <nl> - ASSERT_TRUE ( ( * res_datum ) - > get_type ( ) = = ql : : datum_t : : R_NUM ) ; <nl> - ASSERT_EQ ( ( * res_datum ) - > as_int ( ) , 10337 ) ; <nl> + ASSERT_TRUE ( res_datum - > get_type ( ) = = ql : : datum_t : : R_NUM ) ; <nl> + ASSERT_EQ ( res_datum - > as_int ( ) , 10337 ) ; <nl> } <nl> <nl> SPAWNER_TEST ( JSProc , BrokenFunction ) { <nl> mmm a / src / unittest / mock_store . cc <nl> ppp b / src / unittest / mock_store . cc <nl> std : : string mock_parse_read_response ( const read_response_t & rr ) { <nl> = boost : : get < point_read_response_t > ( & rr . response ) ; <nl> guarantee ( prr ! = NULL ) ; <nl> guarantee ( prr - > data . has ( ) ) ; <nl> - if ( prr - > data - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( prr - > data . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> / / Behave like the old dummy_protocol_t . <nl> return " " ; <nl> } <nl> - return prr - > data - > get_field ( " value " ) - > as_str ( ) . to_std ( ) ; <nl> + return prr - > data . get_field ( " value " ) . as_str ( ) . to_std ( ) ; <nl> } <nl> <nl> std : : string mock_lookup ( store_view_t * store , std : : string key ) { <nl> std : : string mock_store_t : : values ( std : : string key ) { <nl> / / Behave like the old dummy_protocol_t . <nl> return " " ; <nl> } <nl> - return it - > second . second - > get_field ( " value " ) - > as_str ( ) . to_std ( ) ; <nl> + return it - > second . second . get_field ( " value " ) . as_str ( ) . to_std ( ) ; <nl> } <nl> <nl> repli_timestamp_t mock_store_t : : timestamps ( std : : string key ) { <nl> mmm a / src / unittest / rdb_backfill . cc <nl> ppp b / src / unittest / rdb_backfill . cc <nl> void run_backfill_test ( size_t value_padding_length , <nl> broadcaster - > get ( ) - > read ( read , & response , & exiter , order_source - > check_in ( " unittest : : ( rdb ) run_partial_backfill_test " ) . with_read_mode ( ) , & non_interruptor ) ; <nl> point_read_response_t get_result = boost : : get < point_read_response_t > ( response . response ) ; <nl> EXPECT_TRUE ( get_result . data . has ( ) ) ; <nl> - EXPECT_EQ ( * generate_document ( value_padding_length , <nl> + EXPECT_EQ ( generate_document ( value_padding_length , <nl> it - > second ) , <nl> - * get_result . data ) ; <nl> + get_result . data ) ; <nl> } <nl> } <nl> <nl> void run_sindex_backfill_test ( std : : pair < io_backender_t * , simple_mailbox_cluster <nl> / / Order doesn ' t matter because groups - > size ( ) is 1 . <nl> auto result_stream = & groups - > begin ( ql : : grouped : : order_doesnt_matter_t ( ) ) - > second ; <nl> ASSERT_EQ ( 1u , result_stream - > size ( ) ) ; <nl> - EXPECT_EQ ( * generate_document ( 0 , it - > second ) , * result_stream - > at ( 0 ) . data ) ; <nl> + EXPECT_EQ ( generate_document ( 0 , it - > second ) , result_stream - > at ( 0 ) . data ) ; <nl> } <nl> } <nl> <nl> mmm a / src / unittest / rdb_btree . cc <nl> ppp b / src / unittest / rdb_btree . cc <nl> void insert_rows ( int start , int finish , store_t * store ) { <nl> std : : string data = strprintf ( " { \ " id \ " : % d , \ " sid \ " : % d } " , i , i * i ) ; <nl> point_write_response_t response ; <nl> <nl> - store_key_t pk ( ql : : datum_t ( static_cast < double > ( i ) ) - > print_primary ( ) ) ; <nl> + store_key_t pk ( ql : : datum_t ( static_cast < double > ( i ) ) . print_primary ( ) ) ; <nl> rdb_modification_report_t mod_report ( pk ) ; <nl> rdb_live_deletion_context_t deletion_context ; <nl> rdb_set ( pk , <nl> void _check_keys_are_present ( store_t * store , <nl> rdb_rget_slice ( <nl> store - > get_sindex_slice ( sindex_uuid ) , <nl> rdb_protocol : : sindex_key_range ( <nl> - store_key_t ( ql : : datum_t ( ii ) - > print_primary ( ) ) , <nl> - store_key_t ( ql : : datum_t ( ii ) - > print_primary ( ) ) ) , <nl> + store_key_t ( ql : : datum_t ( ii ) . print_primary ( ) ) , <nl> + store_key_t ( ql : : datum_t ( ii ) . print_primary ( ) ) ) , <nl> sindex_sb . get ( ) , <nl> & dummy_env , / / env_t <nl> ql : : batchspec_t : : user ( ql : : batch_type_t : : NORMAL , <nl> void _check_keys_are_present ( store_t * store , <nl> <nl> std : : string expected_data = strprintf ( " { \ " id \ " : % d , \ " sid \ " : % d } " , i , i * i ) ; <nl> scoped_cJSON_t expected_value ( cJSON_Parse ( expected_data . c_str ( ) ) ) ; <nl> - ASSERT_EQ ( * ql : : to_datum ( expected_value . get ( ) , limits ) , * stream - > front ( ) . data ) ; <nl> + ASSERT_EQ ( ql : : to_datum ( expected_value . get ( ) , limits ) , stream - > front ( ) . data ) ; <nl> } <nl> } <nl> <nl> void _check_keys_are_NOT_present ( store_t * store , <nl> rdb_rget_slice ( <nl> store - > get_sindex_slice ( sindex_uuid ) , <nl> rdb_protocol : : sindex_key_range ( <nl> - store_key_t ( ql : : datum_t ( ii ) - > print_primary ( ) ) , <nl> - store_key_t ( ql : : datum_t ( ii ) - > print_primary ( ) ) ) , <nl> + store_key_t ( ql : : datum_t ( ii ) . print_primary ( ) ) , <nl> + store_key_t ( ql : : datum_t ( ii ) . print_primary ( ) ) ) , <nl> sindex_sb . get ( ) , <nl> & dummy_env , / / env_t <nl> ql : : batchspec_t : : user ( ql : : batch_type_t : : NORMAL , <nl> mmm a / src / unittest / rdb_env . cc <nl> ppp b / src / unittest / rdb_env . cc <nl> void mock_namespace_interface_t : : write_visitor_t : : operator ( ) ( <nl> data - > erase ( * it ) ; <nl> <nl> bool err ; <nl> - if ( new_val - > get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> - data - > insert ( std : : make_pair ( * it , new scoped_cJSON_t ( new_val - > as_json ( ) ) ) ) ; <nl> - if ( old_val - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( new_val . get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> + data - > insert ( std : : make_pair ( * it , new scoped_cJSON_t ( new_val . as_json ( ) ) ) ) ; <nl> + if ( old_val . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> err = resp . add ( " inserted " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } else { <nl> - if ( * old_val = = * new_val ) { <nl> + if ( old_val = = new_val ) { <nl> err = resp . add ( " unchanged " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } else { <nl> err = resp . add ( " replaced " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } <nl> } <nl> - } else if ( new_val - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> - if ( old_val - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + } else if ( new_val . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( old_val . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> err = resp . add ( " skipped " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } else { <nl> err = resp . add ( " deleted " , ql : : datum_t ( 1 . 0 ) ) ; <nl> void mock_namespace_interface_t : : write_visitor_t : : operator ( ) ( <nl> " value being inserted is neither an object nor an empty value " ) ; <nl> } <nl> guarantee ( ! err ) ; <nl> - stats = stats - > merge ( std : : move ( resp ) . to_datum ( ) , ql : : stats_merge , <nl> + stats = stats . merge ( std : : move ( resp ) . to_datum ( ) , ql : : stats_merge , <nl> limits , & conditions ) ; <nl> } <nl> ql : : datum_object_builder_t result ( std : : move ( stats ) ) ; <nl> void mock_namespace_interface_t : : write_visitor_t : : operator ( ) ( <nl> ql : : datum_t stats = ql : : datum_t : : empty_object ( ) ; <nl> std : : set < std : : string > conditions ; <nl> for ( auto it = bi . inserts . begin ( ) ; it ! = bi . inserts . end ( ) ; + + it ) { <nl> - store_key_t key ( ( * it ) - > get_field ( datum_string_t ( bi . pkey ) ) - > print_primary ( ) ) ; <nl> + store_key_t key ( ( * it ) . get_field ( datum_string_t ( bi . pkey ) ) . print_primary ( ) ) ; <nl> ql : : datum_object_builder_t resp ; <nl> ql : : datum_t old_val ; <nl> if ( data - > find ( key ) ! = data - > end ( ) ) { <nl> void mock_namespace_interface_t : : write_visitor_t : : operator ( ) ( <nl> data - > erase ( key ) ; <nl> <nl> bool err ; <nl> - if ( new_val - > get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> - data - > insert ( std : : make_pair ( key , new scoped_cJSON_t ( new_val - > as_json ( ) ) ) ) ; <nl> - if ( old_val - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( new_val . get_type ( ) = = ql : : datum_t : : R_OBJECT ) { <nl> + data - > insert ( std : : make_pair ( key , new scoped_cJSON_t ( new_val . as_json ( ) ) ) ) ; <nl> + if ( old_val . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> err = resp . add ( " inserted " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } else { <nl> - if ( * old_val = = * new_val ) { <nl> + if ( old_val = = new_val ) { <nl> err = resp . add ( " unchanged " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } else { <nl> err = resp . add ( " replaced " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } <nl> } <nl> - } else if ( new_val - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> - if ( old_val - > get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + } else if ( new_val . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> + if ( old_val . get_type ( ) = = ql : : datum_t : : R_NULL ) { <nl> err = resp . add ( " skipped " , ql : : datum_t ( 1 . 0 ) ) ; <nl> } else { <nl> err = resp . add ( " deleted " , ql : : datum_t ( 1 . 0 ) ) ; <nl> void mock_namespace_interface_t : : write_visitor_t : : operator ( ) ( <nl> " value being inserted is neither an object nor an empty value " ) ; <nl> } <nl> guarantee ( ! err ) ; <nl> - stats = stats - > merge ( std : : move ( resp ) . to_datum ( ) , ql : : stats_merge , limits , & conditions ) ; <nl> + stats = stats . merge ( std : : move ( resp ) . to_datum ( ) , ql : : stats_merge , limits , & conditions ) ; <nl> } <nl> ql : : datum_object_builder_t result ( stats ) ; <nl> result . add_warnings ( conditions , limits ) ; <nl> mmm a / src / unittest / rdb_protocol . cc <nl> ppp b / src / unittest / rdb_protocol . cc <nl> void run_get_set_test ( namespace_interface_t * nsi , order_source_t * osource ) { <nl> if ( point_read_response_t * maybe_point_read_response = boost : : get < point_read_response_t > ( & response . response ) ) { <nl> ASSERT_TRUE ( maybe_point_read_response - > data . has ( ) ) ; <nl> ASSERT_EQ ( ql : : datum_t ( ql : : datum_t : : construct_null_t ( ) ) , <nl> - * maybe_point_read_response - > data ) ; <nl> + maybe_point_read_response - > data ) ; <nl> } else { <nl> ADD_FAILURE ( ) < < " got wrong result back " ; <nl> } <nl> void run_create_drop_sindex_test ( namespace_interface_t * nsi , order_source_t * oso <nl> ql : : configured_limits_t limits ; <nl> ql : : datum_t d <nl> = ql : : to_datum ( cJSON_slow_GetObjectItem ( data - > get ( ) , " id " ) , limits ) ; <nl> - store_key_t pk = store_key_t ( d - > print_primary ( ) ) ; <nl> + store_key_t pk = store_key_t ( d . print_primary ( ) ) ; <nl> ql : : datum_t sindex_key_literal = ql : : datum_t ( 1 . 0 ) ; <nl> <nl> ASSERT_TRUE ( data - > get ( ) ) ; <nl> void run_create_drop_sindex_test ( namespace_interface_t * nsi , order_source_t * oso <nl> auto stream = & streams - > begin ( ql : : grouped : : order_doesnt_matter_t ( ) ) - > second ; <nl> ASSERT_TRUE ( stream ! = NULL ) ; <nl> ASSERT_EQ ( 1u , stream - > size ( ) ) ; <nl> - ASSERT_EQ ( * ql : : to_datum ( data - > get ( ) , limits ) , * stream - > at ( 0 ) . data ) ; <nl> + ASSERT_EQ ( ql : : to_datum ( data - > get ( ) , limits ) , stream - > at ( 0 ) . data ) ; <nl> } else { <nl> ADD_FAILURE ( ) < < " got wrong type of result back " ; <nl> } <nl> void populate_sindex ( namespace_interface_t * nsi , <nl> ql : : configured_limits_t limits ; <nl> ql : : datum_t d <nl> = ql : : to_datum ( cJSON_slow_GetObjectItem ( data - > get ( ) , " id " ) , limits ) ; <nl> - store_key_t pk = store_key_t ( d - > print_primary ( ) ) ; <nl> + store_key_t pk = store_key_t ( d . print_primary ( ) ) ; <nl> <nl> / * Insert a piece of data ( it will be indexed using the secondary <nl> * index ) . * / <nl> void run_sindex_oversized_keys_test ( namespace_interface_t * nsi , order_source_t * <nl> try { <nl> pk = store_key_t ( ql : : to_datum ( <nl> cJSON_slow_GetObjectItem ( data - > get ( ) , " id " ) , <nl> - limits ) - > print_primary ( ) ) ; <nl> + limits ) . print_primary ( ) ) ; <nl> } catch ( const ql : : base_exc_t & ex ) { <nl> ASSERT_TRUE ( id . length ( ) > = rdb_protocol : : MAX_PRIMARY_KEY_SIZE ) ; <nl> continue ; <nl> void run_sindex_missing_attr_test ( namespace_interface_t * nsi , order_source_t * os <nl> new scoped_cJSON_t ( cJSON_Parse ( " { \ " id \ " : 0 } " ) ) ) ; <nl> store_key_t pk = store_key_t ( ql : : to_datum ( <nl> cJSON_slow_GetObjectItem ( data - > get ( ) , " id " ) , <nl> - limits ) - > print_primary ( ) ) ; <nl> + limits ) . print_primary ( ) ) ; <nl> ASSERT_TRUE ( data - > get ( ) ) ; <nl> { <nl> / * Insert a piece of data ( it will be indexed using the secondary <nl> mmm a / test / full_test / interface . test <nl> ppp b / test / full_test / interface . test <nl> for interface_test_name in [ <nl> ' cluster_config ' , ' detect_dead ' , ' log ' , ' progress ' , ' dead_machine_issues ' , <nl> ' unsatisfiable_goals_issue ' , ' name_conflict_issue ' , ' net_corruption ' , <nl> ' resources ' , ' large_branch_history ' , ' metadata_persistence ' , ' stat ' , <nl> - ' server_config ' , ' table_config ' , ' table_reconfigure ' ] : <nl> + ' server_config ' , ' specific_table ' , ' table_config ' , ' table_reconfigure ' ] : <nl> generate_test ( " $ RETHINKDB / test / interface / % s . py " % interface_test_name , name = interface_test_name ) <nl> <nl> new file mode 100755 <nl> index 00000000000 . . ffd4a272096 <nl> mmm / dev / null <nl> ppp b / test / interface / specific_table . py <nl> <nl> + # ! / usr / bin / env python <nl> + # Copyright 2010 - 2014 RethinkDB , all rights reserved . <nl> + import os , subprocess , sys , time <nl> + sys . path . append ( os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , os . path . pardir , ' common ' ) ) ) <nl> + import driver , scenario_common , utils <nl> + from vcoptparse import * <nl> + r = utils . import_python_driver ( ) <nl> + <nl> + op = OptParser ( ) <nl> + scenario_common . prepare_option_parser_mode_flags ( op ) <nl> + opts = op . parse ( sys . argv ) <nl> + <nl> + # This tests a specific feature of the ReQL tests : namely , the possibility of running <nl> + # them against a specific table . Since it ' s a meta - test it ' s not terribly important . The <nl> + # reason why this test exists is that in the reql_admin branch this feature is used to <nl> + # test the artificial table logic . So this test is sort of acting as a placeholder , to <nl> + # make sure the feature works properly until reql_admin is merged into next . <nl> + # - TM 2014 - 08 - 29 <nl> + <nl> + with driver . Metacluster ( ) as metacluster : <nl> + cluster = driver . Cluster ( metacluster ) <nl> + executable_path , command_prefix , serve_options = scenario_common . parse_mode_flags ( opts ) <nl> + print " Spinning up a process . . . " <nl> + files = driver . Files ( metacluster , db_path = " db " , log_path = " create - output " , <nl> + executable_path = executable_path , command_prefix = command_prefix ) <nl> + proc = driver . Process ( cluster , files , log_path = " serve - output " , <nl> + executable_path = executable_path , command_prefix = command_prefix , extra_options = serve_options ) <nl> + proc . wait_until_started_up ( ) <nl> + cluster . check ( ) <nl> + <nl> + print " Creating a table . . . " <nl> + conn = r . connect ( " localhost " , proc . driver_port ) <nl> + res = r . db_create ( " test_db " ) . run ( conn ) <nl> + assert res = = { " created " : 1 } <nl> + res = r . db ( " test_db " ) . table_create ( " test_table " ) . run ( conn ) <nl> + assert res = = { " created " : 1 } <nl> + conn . close ( ) <nl> + <nl> + command_line = [ <nl> + os . path . abspath ( os . path . join ( <nl> + os . path . dirname ( __file__ ) , os . path . pardir , ' rql_test ' , ' test - runner ' ) ) , <nl> + ' - - cluster - port ' , str ( proc . cluster_port ) , <nl> + ' - - driver - port ' , str ( proc . driver_port ) , <nl> + ' - - table ' , ' test_db . test_table ' ] <nl> + command_line . extend ( ' polyglot / ' + name for name in [ <nl> + ' arraylimits ' , ' changefeeds / basic ' , ' control ' , ' geo / indexing ' , ' joins ' , ' match ' , <nl> + ' mutation / atomic_get_set ' , ' mutation / delete ' , ' mutation / insert ' , <nl> + ' mutation / replace ' , ' mutation / update ' , ' polymorphism ' ] ) <nl> + command_line . extend ( ' polyglot / regression / % d ' % issue_number for issue_number in [ <nl> + 309 , 453 , 522 , 545 , 568 , 578 , 579 , 678 , 1001 , 1155 , 1179 , 1468 , 1789 , 2399 , 2697 , <nl> + 2709 , 2767 , 2774 , 2838 , 2930 ] ) <nl> + print " Command line : " , " " . join ( command_line ) <nl> + print " Running the QL test . . . " <nl> + with open ( " test - runner - log . txt " , " w " ) as f : <nl> + subprocess . check_call ( command_line , stdout = f , stderr = f ) <nl> + print " QL test finished . " <nl> + <nl> + cluster . check_and_stop ( ) <nl> + print " Done . " <nl> mmm a / test / rql_test / connections / connection . py <nl> ppp b / test / rql_test / connections / connection . py <nl> def runTest ( self ) : <nl> self . assertEqual ( str ( r . db ( ' db1 ' ) . table ( ' tbl1 ' ) . map ( lambda x : x ) ) , <nl> " r . db ( ' db1 ' ) . table ( ' tbl1 ' ) . map ( lambda var_1 : var_1 ) " ) <nl> <nl> + # Another non - connection connection test . It ' s to test that get_intersecting ( ) <nl> + # batching works properly . <nl> + class TestGetIntersectingBatching ( TestWithConnection ) : <nl> + def runTest ( self ) : <nl> + import random # importing here to avoid issue # 2343 <nl> + <nl> + c = r . connect ( port = self . port ) <nl> + <nl> + r . db ( ' test ' ) . table_create ( ' t1 ' ) . run ( c ) <nl> + t1 = r . db ( ' test ' ) . table ( ' t1 ' ) <nl> + <nl> + t1 . index_create ( ' geo ' , geo = True ) . run ( c ) <nl> + t1 . index_wait ( ' geo ' ) . run ( c ) <nl> + <nl> + batch_size = 3 <nl> + point_count = 500 <nl> + poly_count = 500 <nl> + get_tries = 10 <nl> + <nl> + # Insert a couple of random points , so we get a well distributed range of <nl> + # secondary keys . Also insert a couple of large - ish polygons , so we can <nl> + # test filtering of duplicates on the server . <nl> + rseed = random . getrandbits ( 64 ) <nl> + random . seed ( rseed ) <nl> + print ( " Random seed : " + str ( rseed ) ) <nl> + points = [ ] <nl> + for i in range ( 0 , point_count ) : <nl> + points . append ( { ' geo ' : r . point ( random . uniform ( - 90 . 0 , 90 . 0 ) , random . uniform ( - 180 . 0 , 180 . 0 ) ) } ) <nl> + polygons = [ ] <nl> + for i in range ( 0 , poly_count ) : <nl> + # A fairly big circle , so it will cover a large range in the secondary index <nl> + polygons . append ( { ' geo ' : r . circle ( [ random . uniform ( - 90 . 0 , 90 . 0 ) , random . uniform ( - 180 . 0 , 180 . 0 ) ] , 1000000 ) } ) <nl> + t1 . insert ( points ) . run ( c ) <nl> + t1 . insert ( polygons ) . run ( c ) <nl> + <nl> + # Check that the results are actually lazy at least some of the time <nl> + # While the test is randomized , chances are extremely high to get a lazy result at least once . <nl> + seen_lazy = False <nl> + <nl> + for i in range ( 0 , get_tries ) : <nl> + query_circle = r . circle ( [ random . uniform ( - 90 . 0 , 90 . 0 ) , random . uniform ( - 180 . 0 , 180 . 0 ) ] , 8000000 ) ; <nl> + reference = t1 . filter ( r . row [ ' geo ' ] . intersects ( query_circle ) ) . coerce_to ( " ARRAY " ) . run ( c ) <nl> + cursor = t1 . get_intersecting ( query_circle , index = ' geo ' ) . run ( c , batch_conf = { ' max_els ' : batch_size } ) <nl> + if not cursor . end_flag : <nl> + seen_lazy = True <nl> + <nl> + itr = iter ( cursor ) <nl> + while len ( reference ) > 0 : <nl> + row = next ( itr ) <nl> + self . assertEqual ( reference . count ( row ) , 1 ) <nl> + reference . remove ( row ) <nl> + self . assertRaises ( StopIteration , lambda : next ( itr ) ) <nl> + self . assertTrue ( cursor . end_flag ) <nl> + <nl> + self . assertTrue ( seen_lazy ) <nl> + <nl> + r . db ( ' test ' ) . table_drop ( ' t1 ' ) . run ( c ) <nl> + <nl> class TestBatching ( TestWithConnection ) : <nl> def runTest ( self ) : <nl> c = r . connect ( port = self . port ) <nl> def runTest ( self ) : <nl> self . assertEqual ( next ( itr ) [ ' id ' ] , ids . pop ( ) ) <nl> self . assertRaises ( StopIteration , lambda : next ( itr ) ) <nl> self . assertTrue ( cursor . end_flag ) <nl> + r . db ( ' test ' ) . table_drop ( ' t1 ' ) . run ( c ) <nl> <nl> class TestGroupWithTimeKey ( TestWithConnection ) : <nl> def runTest ( self ) : <nl> def runTest ( self ) : <nl> suite . addTest ( loader . loadTestsFromTestCase ( TestShutdown ) ) <nl> suite . addTest ( TestPrinting ( ) ) <nl> suite . addTest ( TestBatching ( ) ) <nl> + suite . addTest ( TestGetIntersectingBatching ( ) ) <nl> suite . addTest ( TestGroupWithTimeKey ( ) ) <nl> <nl> res = unittest . TextTestRunner ( verbosity = 2 ) . run ( suite ) <nl> mmm a / test / rql_test / drivers / driver . js <nl> ppp b / test / rql_test / drivers / driver . js <nl> console . log ( ' Using RethinkDB client from : ' + rethinkdbLocation ) <nl> <nl> var JSPORT = process . argv [ 2 ] <nl> var CPPPORT = process . argv [ 3 ] <nl> + var DB_AND_TABLE_NAME = process . argv [ 4 ] <nl> <nl> var TRACE_ENABLED = false ; <nl> <nl> function TRACE ( ) { <nl> } <nl> } <nl> <nl> + / / ` doExit ` will later get set to something that performs cleanup <nl> + var doExit = process . exit <nl> + process . on ( ' SIGINT ' , function ( ) { <nl> + doExit ( 128 + 2 ) ; <nl> + } ) <nl> + process . on ( ' unexpectedException ' , function ( err ) { <nl> + console . log ( " Unexpected exception : " + String ( err ) ) <nl> + console . log ( " Stack is : " + String ( err . stack ) ) <nl> + doExit ( 1 ) ; <nl> + } ) <nl> + <nl> / / Connect first to cpp server <nl> r . connect ( { port : CPPPORT } , function ( cpp_conn_err , cpp_conn ) { <nl> <nl> r . connect ( { port : CPPPORT } , function ( cpp_conn_err , cpp_conn ) { <nl> if ( testPair ) { <nl> if ( testPair instanceof Function ) { <nl> TRACE ( " = = = = runTest = = function " ) ; <nl> - testPair ( ) ; <nl> - runTest ( ) ; <nl> + testPair ( runTest , cpp_conn ) ; <nl> return ; <nl> } else { <nl> var src = testPair [ 0 ] <nl> r . connect ( { port : CPPPORT } , function ( cpp_conn_err , cpp_conn ) { <nl> } <nl> } else { <nl> / / We ' ve hit the end of our test list <nl> - / / closing the connection will allow the <nl> - / / event loop to quit naturally <nl> - cpp_conn . close ( ) ; <nl> - <nl> if ( failure_count ! = 0 ) { <nl> console . log ( " Failed " + failure_count + " tests " ) ; <nl> - process . exit ( 1 ) ; <nl> + doExit ( 1 ) ; <nl> } else { <nl> console . log ( " Passed all tests " ) <nl> + doExit ( 0 ) ; <nl> } <nl> } <nl> } catch ( err ) { <nl> r . connect ( { port : CPPPORT } , function ( cpp_conn_err , cpp_conn ) { <nl> function unexpectedException ( ) { <nl> console . log ( " Oops , this shouldn ' t have happened : " ) ; <nl> console . log . apply ( console , arguments ) ; <nl> - process . exit ( 1 ) ; <nl> + doExit ( 1 ) <nl> } <nl> <nl> / / Invoked by generated code to add test and expected result <nl> function test ( testSrc , resSrc , name , runopts , testopts ) { <nl> tests . push ( [ testSrc , resSrc , name , runopts , testopts ] ) <nl> } <nl> <nl> + / / Generated code must call either ` setup_table ( ) ` or ` check_no_table_specified ( ) ` <nl> + function setup_table ( table_variable_name , table_name ) { <nl> + tests . push ( function ( next , cpp_conn ) { <nl> + try { <nl> + doExit = function ( exit_code ) { <nl> + console . log ( " cleaning up table . . . " ) ; <nl> + / / Unregister handler to prevent recursive insanity if something fails <nl> + / / while cleaning up <nl> + doExit = process . exit <nl> + if ( DB_AND_TABLE_NAME = = = " no_table_specified " ) { <nl> + try { <nl> + r . db ( " test " ) . tableDrop ( table_name ) . run ( cpp_conn , { } , function ( err , res ) { <nl> + if ( err ) { <nl> + unexpectedException ( " teardown_table " , err ) ; <nl> + } <nl> + if ( res . dropped ! = 1 ) { <nl> + unexpectedException ( " teardown_table " , " table not dropped " , res ) ; <nl> + } <nl> + process . exit ( exit_code ) ; <nl> + } ) ; <nl> + } catch ( err ) { <nl> + console . log ( " stack : " + String ( err . stack ) ) ; <nl> + unexpectedException ( " teardown_table " ) ; <nl> + } <nl> + } else { <nl> + var parts = DB_AND_TABLE_NAME . split ( " . " ) ; <nl> + try { <nl> + r . db ( parts [ 0 ] ) . table ( parts [ 1 ] ) . delete ( ) . run ( cpp_conn , { } , function ( err , res ) { <nl> + if ( err ) { <nl> + unexpectedException ( " teardown_table " , err ) ; <nl> + } <nl> + if ( res . errors ! = = 0 ) { <nl> + unexpectedException ( " teardown_table " , " error when deleting " , res ) ; <nl> + } <nl> + try { <nl> + r . db ( parts [ 0 ] ) . table ( parts [ 1 ] ) . indexList ( ) . forEach ( <nl> + r . db ( parts [ 0 ] ) . table ( parts [ 1 ] ) . indexDrop ( r . row ) ) <nl> + . run ( cpp_conn , { } , function ( err , res ) { <nl> + if ( err ) { <nl> + unexpectedException ( " teardown_table " , err ) ; <nl> + } <nl> + if ( res . errors ! = = undefined & & res . errors ! = = 0 ) { <nl> + unexpectedException ( " teardown_table " , " error dropping indexes " , res ) ; <nl> + } <nl> + process . exit ( exit_code ) ; <nl> + } ) ; <nl> + } catch ( err ) { <nl> + console . log ( " stack : " + String ( err . stack ) ) ; <nl> + unexpectedException ( " teardown_table " ) ; <nl> + } <nl> + } ) ; <nl> + } catch ( err ) { <nl> + console . log ( " stack : " + String ( err . stack ) ) ; <nl> + unexpectedException ( " teardown_table " ) ; <nl> + } <nl> + } <nl> + } <nl> + if ( DB_AND_TABLE_NAME = = = " no_table_specified " ) { <nl> + r . db ( " test " ) . tableCreate ( table_name ) . run ( cpp_conn , { } , function ( err , res ) { <nl> + if ( err ) { <nl> + unexpectedException ( " setup_table " , err ) ; <nl> + } <nl> + if ( res . created ! = 1 ) { <nl> + unexpectedException ( " setup_table " , " table not created " , res ) ; <nl> + } <nl> + defines [ table_variable_name ] = r . db ( " test " ) . table ( table_name ) ; <nl> + next ( ) ; <nl> + } ) ; <nl> + } else { <nl> + var parts = DB_AND_TABLE_NAME . split ( " . " ) ; <nl> + defines [ table_variable_name ] = r . db ( parts [ 0 ] ) . table ( parts [ 1 ] ) ; <nl> + next ( ) ; <nl> + } <nl> + } catch ( err ) { <nl> + console . log ( " stack : " + String ( err . stack ) ) ; <nl> + unexpectedException ( " setup_table " ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + <nl> + function check_no_table_specified ( ) { <nl> + if ( DB_AND_TABLE_NAME ! = = " no_table_specified " ) { <nl> + unexpectedException ( " This test isn ' t meant to be run against a specific table " ) <nl> + } <nl> + } <nl> + <nl> / / Invoked by generated code to define variables to used within <nl> / / subsequent tests <nl> function define ( expr ) { <nl> - tests . push ( function ( ) { <nl> + tests . push ( function ( next , cpp_conn ) { <nl> with ( defines ) { <nl> eval ( " defines . " + expr ) ; <nl> } <nl> + next ( ) ; <nl> } ) ; <nl> } <nl> <nl> function bag ( list ) { <nl> <nl> / / Invoked by generated code to demonstrate expected error output <nl> function err ( err_name , err_msg , err_frames ) { <nl> + return err_predicate ( <nl> + err_name , function ( msg ) { return ( ! err_msg | | ( err_msg = = = msg ) ) ; } , <nl> + err_frames , err_name + " ( \ " " + err_msg + " \ " ) " ) ; <nl> + } <nl> + <nl> + function err_regex ( err_name , err_pat , err_frames ) { <nl> + return err_predicate ( <nl> + err_name , function ( msg ) { return ( ! err_pat | | new RegExp ( err_pat ) . test ( msg ) ) ; } , <nl> + err_frames , err_name + " ( \ " " + err_pat + " \ " ) " ) ; <nl> + } <nl> + <nl> + function err_predicate ( err_name , err_pred , err_frames , desc ) { <nl> var err_frames = null ; / / TODO : test for frames <nl> var fun = function ( other ) { <nl> if ( ! ( other instanceof Error ) ) return false ; <nl> function err ( err_name , err_msg , err_frames ) { <nl> other . msg = other . msg . replace ( / : \ n ( [ \ r \ n ] | . ) * / m , " . " ) ; <nl> other . msg = other . msg . replace ( / \ nFailed assertion ( [ \ r \ n ] | . ) * / m , " " ) ; <nl> <nl> - if ( err_msg & & ! ( other . msg = = = err_msg ) ) return false ; <nl> + if ( ! err_pred ( other . msg ) ) return false ; <nl> if ( err_frames & & ! ( eq_test ( other . frames , err_frames ) ) ) return false ; <nl> return true ; <nl> } <nl> fun . isErr = true ; <nl> fun . toString = function ( ) { <nl> - return err_name + " ( \ " " + err_msg + " \ " ) " ; <nl> + return desc ; <nl> } ; <nl> return fun ; <nl> } <nl> mmm a / test / rql_test / drivers / driver . py <nl> ppp b / test / rql_test / drivers / driver . py <nl> <nl> from __future__ import print_function <nl> <nl> - import collections , os , re , sys <nl> + import atexit , collections , os , re , sys <nl> from datetime import datetime , tzinfo , timedelta <nl> <nl> try : <nl> def dst ( self , dt ) : <nl> <nl> # JSPORT = int ( sys . argv [ 1 ] ) <nl> CPPPORT = int ( sys . argv [ 2 ] ) <nl> - CLUSTER_PORT = int ( sys . argv [ 3 ] ) <nl> - BUILD = sys . argv [ 4 ] <nl> + DB_AND_TABLE_NAME = sys . argv [ 3 ] <nl> + CLUSTER_PORT = int ( sys . argv [ 4 ] ) <nl> + BUILD = sys . argv [ 5 ] <nl> <nl> # - - utilities - - <nl> <nl> def run ( self , src , expected , name , runopts , testopts ) : <nl> <nl> driver = PyTestDriver ( ) <nl> <nl> - # Emitted test code will consist of calls to this function <nl> + # Emitted test code will consist of calls to these functions <nl> + <nl> def test ( query , expected , name , runopts = None , testopts = None ) : <nl> if runopts is None : <nl> runopts = { } <nl> def test ( query , expected , name , runopts = None , testopts = None ) : <nl> expected = None <nl> driver . run ( query , expected , name , runopts , testopts ) <nl> <nl> - # Emitted test code can call this function to define variables <nl> + # Generated code must call either ` setup_table ( ) ` or ` check_no_table_specified ( ) ` <nl> + def setup_table ( table_variable_name , table_name ) : <nl> + def _teardown_table ( ) : <nl> + if DB_AND_TABLE_NAME = = " no_table_specified " : <nl> + res = r . db ( " test " ) . table_drop ( table_name ) . run ( driver . cpp_conn ) <nl> + assert res = = { " dropped " : 1 } <nl> + else : <nl> + db , table = DB_AND_TABLE_NAME . split ( " . " ) <nl> + res = r . db ( db ) . table ( table ) . delete ( ) . run ( driver . cpp_conn ) <nl> + assert res [ " errors " ] = = 0 <nl> + res = r . db ( db ) . table ( table ) . index_list ( ) . for_each ( <nl> + r . db ( db ) . table ( table ) . index_drop ( r . row ) ) . run ( driver . cpp_conn ) <nl> + assert " errors " not in res or res [ " errors " ] = = 0 <nl> + atexit . register ( _teardown_table ) <nl> + if DB_AND_TABLE_NAME = = " no_table_specified " : <nl> + res = r . db ( " test " ) . table_create ( table_name ) . run ( driver . cpp_conn ) <nl> + assert res = = { " created " : 1 } <nl> + globals ( ) [ table_variable_name ] = r . db ( " test " ) . table ( table_name ) <nl> + else : <nl> + db , table = DB_AND_TABLE_NAME . split ( " . " ) <nl> + globals ( ) [ table_variable_name ] = r . db ( db ) . table ( table ) <nl> + <nl> + def check_no_table_specified ( ) : <nl> + if DB_AND_TABLE_NAME ! = " no_table_specified " : <nl> + raise ValueError ( " This test isn ' t meant to be run against a specific table " ) <nl> + <nl> def define ( expr ) : <nl> driver . define ( expr ) <nl> <nl> - # Emitted test code can call this function to set bag equality on a list <nl> def bag ( lst ) : <nl> return Bag ( lst ) <nl> <nl> - # Emitted test code can call this function to indicate expected error output <nl> def err ( err_type , err_msg = None , frames = None ) : <nl> return Err ( err_type , err_msg , frames ) <nl> <nl> mmm a / test / rql_test / drivers / driver . rb <nl> ppp b / test / rql_test / drivers / driver . rb <nl> <nl> <nl> JSPORT = ARGV [ 0 ] <nl> CPPPORT = ARGV [ 1 ] <nl> + DB_AND_TABLE_NAME = ARGV [ 2 ] <nl> <nl> # - - import the called - for rethinkdb module <nl> if ENV [ ' RUBY_DRIVER_DIR ' ] <nl> def test src , expected , name , opthash = nil , testopts = nil <nl> <nl> end <nl> <nl> + # Generated code must call either ` setup_table ` or ` check_no_table_specified ` <nl> + def setup_table table_variable_name , table_name <nl> + at_exit do <nl> + if DB_AND_TABLE_NAME = = " no_table_specified " <nl> + res = r . db ( " test " ) . table_drop ( table_name ) . run ( $ cpp_conn ) <nl> + if res [ " dropped " ] ! = 1 <nl> + abort " Could not drop table : # { res } " <nl> + end <nl> + else <nl> + parts = DB_AND_TABLE_NAME . split ( ' . ' ) <nl> + res = r . db ( parts . first ) . table ( parts . last ) . delete ( ) . run ( $ cpp_conn ) <nl> + if res [ " errors " ] ! = 0 <nl> + abort " Could not clear table : # { res } " <nl> + end <nl> + res = r . db ( parts . first ) . table ( parts . last ) . index_list ( ) . for_each { | row | <nl> + r . db ( parts . first ) . table ( parts . last ) . index_drop ( row ) } . run ( $ cpp_conn ) <nl> + if res . has_key ? ( " errors " ) and res [ " errors " ] ! = 0 <nl> + abort " Could not drop indexes : # { res } " <nl> + end <nl> + end <nl> + end <nl> + if DB_AND_TABLE_NAME = = " no_table_specified " <nl> + res = r . db ( " test " ) . table_create ( table_name ) . run ( $ cpp_conn ) <nl> + if res [ " created " ] ! = 1 <nl> + abort " Could not create table : # { res } " <nl> + end <nl> + $ defines . eval ( " # { table_variable_name } = r . db ( ' test ' ) . table ( ' # { table_name } ' ) " ) <nl> + else <nl> + parts = DB_AND_TABLE_NAME . split ( ' . ' ) <nl> + $ defines . eval ( " # { table_variable_name } = r . db ( \ " # { parts . first } \ " ) . table ( \ " # { parts . last } \ " ) " ) <nl> + end <nl> + end <nl> + <nl> + def check_no_table_specified <nl> + if DB_AND_TABLE_NAME ! = " no_table_specified " <nl> + abort " This test isn ' t meant to be run against a specific table " <nl> + end <nl> + end <nl> + <nl> at_exit do <nl> puts " Ruby : # { $ success_count } of # { $ test_count } tests passed . # { $ test_count - $ success_count } tests failed . " <nl> end <nl> mmm a / test / rql_test / src / arity . yaml <nl> ppp b / test / rql_test / src / arity . yaml <nl> tests : <nl> py3 . 0 : err_regex ( ' TypeError ' , " . * takes exactly 1 positional argument \ ( 0 given \ ) " , [ ] ) <nl> py3 . 1 : err_regex ( ' TypeError ' , " . * takes exactly 1 positional argument \ ( 0 given \ ) " , [ ] ) <nl> py3 . 2 : err_regex ( ' TypeError ' , " . * takes exactly 1 argument \ ( 0 given \ ) " , [ ] ) <nl> - py3 : err_regex ( ' TypeError ' , " . * takes 1 positional argument but 0 were given " , [ ] ) <nl> + py3 : err_regex ( ' TypeError ' , " . * missing 1 required positional argument . * " , [ ] ) <nl> <nl> # TODO : Math and logic <nl> # TODO : Upper bound on optional arguments <nl> mmm a / test / rql_test / src / arraylimits . yaml <nl> ppp b / test / rql_test / src / arraylimits . yaml <nl> <nl> desc : Tests array limit variations <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> # test simplistic array limits <nl> tests : <nl> array_limit : ' 100001 ' <nl> ot : 100001 <nl> <nl> - # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> # attempt to insert enormous array <nl> - cd : tbl . insert ( { ' id ' : 0 , ' array ' : huge_l . append ( 1 ) } ) <nl> runopts : <nl> tests : <nl> array_limit : ' 4 ' <nl> ot : ( { ' array ' : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] , ' id ' : 1 } ) <nl> <nl> - # Clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / changefeeds / basic . yaml <nl> ppp b / test / rql_test / src / changefeeds / basic . yaml <nl> <nl> desc : Test basic changefeed operations <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - # Set up table <nl> - - cd : r . db ( ' test ' ) . table_create ( ' changefeeds_basic_ $ langcode ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - - def : tbl = r . db ( ' test ' ) . table ( ' changefeeds_basic_ $ langcode ' ) <nl> - <nl> # Fill in some data <nl> - cd : tbl . insert ( [ { ' id ' : 1 } , { ' id ' : 2 } , { ' id ' : 3 } , { ' id ' : 4 } , { ' id ' : 5 } , { ' id ' : 6 } ] ) <nl> rb : tbl . insert ( [ { ' id ' = > 1 } , { ' id ' = > 2 } , { ' id ' = > 3 } , { ' id ' = > 4 } , { ' id ' = > 5 } , { ' id ' = > 6 } ] ) <nl> mmm a / test / rql_test / src / control . yaml <nl> ppp b / test / rql_test / src / control . yaml <nl> <nl> desc : Tests RQL control flow structures <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - # Setup <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> + # Setup a second table <nl> - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> def : tbl2 = r . db ( ' test ' ) . table ( ' test2 ' ) <nl> tests : <nl> <nl> - cd : r . branch ( r . db ( ' test ' ) , 1 , 2 ) <nl> ot : err ( " RqlRuntimeError " , " Expected type DATUM but found DATABASE . " , [ ] ) <nl> - - cd : r . branch ( r . db ( ' test ' ) . table ( ' test1 ' ) , 1 , 2 ) <nl> + - cd : r . branch ( tbl , 1 , 2 ) <nl> ot : err ( " RqlRuntimeError " , " Expected type DATUM but found TABLE . " , [ ] ) <nl> - cd : r . branch ( r . error ( " a " ) , 1 , 2 ) <nl> ot : err ( " RqlRuntimeError " , " a " , [ ] ) <nl> tests : <nl> ot : ( { ' created ' : 1 } ) <nl> <nl> # Cleanup <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> - <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test2 ' ) <nl> ot : ( { ' dropped ' : 1 } ) <nl> <nl> mmm a / test / rql_test / src / geo / indexing . yaml <nl> ppp b / test / rql_test / src / geo / indexing . yaml <nl> <nl> desc : Test ReQL interface to geo indexes <nl> + table_variable_name : tbl <nl> tests : <nl> - - cd : r . db ( ' test ' ) . table_create ( ' geoindex ' ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' geoindex ' ) <nl> - <nl> - def : rows = [ { ' id ' : 0 , ' g ' : r . point ( 10 , 10 ) , ' m ' : [ r . point ( 0 , 0 ) , r . point ( 0 , 1 ) , r . point ( 0 , 2 ) ] } , <nl> { ' id ' : 1 , ' g ' : r . polygon ( [ 0 , 0 ] , [ 0 , 1 ] , [ 1 , 1 ] , [ 1 , 0 ] ) } , <nl> { ' id ' : 2 , ' g ' : r . line ( [ - 1 , 0 . 000002 ] , [ 1 , - 0 . 000001 ] ) } ] <nl> tests : <nl> - js : tbl . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' missing ' } ) . count ( ) <nl> py : tbl . get_intersecting ( r . point ( 0 , 0 ) , index = ' missing ' ) . count ( ) <nl> rb : tbl . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' missing ' ) . count ( ) <nl> - ot : err ( ' RqlRuntimeError ' , ' Index ` missing ` was not found on table ` test . geoindex ` . ' , [ 0 ] ) <nl> + ot : err_regex ( ' RqlRuntimeError ' , ' Index ` missing ` was not found on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] ' , [ 0 ] ) <nl> - cd : tbl . get_intersecting ( r . point ( 0 , 0 ) ) . count ( ) <nl> ot : err ( ' RqlRuntimeError ' , ' get_intersecting requires an index argument . ' , [ 0 ] ) <nl> - js : tbl . get_all ( 0 , { ' index ' : ' g ' } ) . count ( ) <nl> tests : <nl> py : tbl . get_intersecting ( r . line ( [ 0 , 0 ] , [ 10 , 10 ] ) , index = ' g ' ) . count ( ) <nl> rb : tbl . get_intersecting ( r . line ( [ 0 , 0 ] , [ 10 , 10 ] ) , : index = > ' g ' ) . count ( ) <nl> ot : 3 <nl> + - js : tbl . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . type_of ( ) <nl> + py : tbl . get_intersecting ( r . point ( 0 , 0 ) , index = ' g ' ) . type_of ( ) <nl> + rb : tbl . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' g ' ) . type_of ( ) <nl> + ot : ( " SELECTION < STREAM > " ) <nl> + - js : tbl . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . filter ( true ) . type_of ( ) <nl> + py : tbl . get_intersecting ( r . point ( 0 , 0 ) , index = ' g ' ) . filter ( true ) . type_of ( ) <nl> + rb : tbl . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' g ' ) . filter ( true ) . type_of ( ) <nl> + ot : ( " SELECTION < STREAM > " ) <nl> + - js : tbl . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . map ( r . row ) . type_of ( ) <nl> + py : tbl . get_intersecting ( r . point ( 0 , 0 ) , index = ' g ' ) . map ( r . row ) . type_of ( ) <nl> + rb : tbl . get_intersecting ( r . point ( 0 , 0 ) , : index = > ' g ' ) . map { | x | x } . type_of ( ) <nl> + ot : ( " STREAM " ) <nl> <nl> - js : tbl . get_intersecting ( r . point ( 0 , 0 ) , { ' index ' : ' m ' } ) . count ( ) <nl> py : tbl . get_intersecting ( r . point ( 0 , 0 ) , index = ' m ' ) . count ( ) <nl> tests : <nl> - js : tbl . get_nearest ( r . point ( 0 , 0 ) , { ' index ' : ' missing ' } ) <nl> py : tbl . get_nearest ( r . point ( 0 , 0 ) , index = ' missing ' ) <nl> rb : tbl . get_nearest ( r . point ( 0 , 0 ) , : index = > ' missing ' ) <nl> - ot : err ( ' RqlRuntimeError ' , ' Index ` missing ` was not found on table ` test . geoindex ` . ' , [ 0 ] ) <nl> + ot : err_regex ( ' RqlRuntimeError ' , ' Index ` missing ` was not found on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] ' , [ 0 ] ) <nl> - cd : tbl . get_nearest ( r . point ( 0 , 0 ) ) <nl> ot : err ( ' RqlRuntimeError ' , ' get_nearest requires an index argument . ' , [ 0 ] ) <nl> - js : tbl . between ( 0 , 1 ) . get_nearest ( r . point ( 0 , 0 ) , { ' index ' : ' g ' } ) . count ( ) <nl> tests : <nl> rb : tbl . get_nearest ( r . point ( 0 , 0 ) , : index = > ' g ' , : max_dist = > 1 , : geo_system = > ' unit_sphere ' ) . pluck ( ' dist ' , { ' doc ' : ' id ' } ) <nl> ot : ( [ { ' dist ' : 0 , ' doc ' : { ' id ' : 1 } } , { ' dist ' : 8 . 726646259990191e - 09 , ' doc ' : { ' id ' : 2 } } , { ' dist ' : 0 . 24619691677893205 , ' doc ' : { ' id ' : 0 } } ] ) <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' geoindex ' ) <nl> mmm a / test / rql_test / src / geo / intersection_inclusion . yaml <nl> ppp b / test / rql_test / src / geo / intersection_inclusion . yaml <nl> tests : <nl> ot : false <nl> - cd : r . line ( [ 1 , 1 ] , [ 1 , 2 ] ) . intersects ( r . line ( [ 1 , 2 ] , [ 1 , 3 ] ) ) <nl> ot : true <nl> + # intersects on an array / stream <nl> + - cd : r . expr ( [ r . point ( 0 , 1 ) , r . point ( 0 , 3 ) , r . point ( 0 , 2 ) ] ) . intersects ( r . line ( [ 0 , 0 ] , [ 0 , 2 ] ) ) . count ( ) <nl> + ot : 2 <nl> <nl> # Includes <nl> - cd : r . polygon ( [ 1 , 1 ] , [ 1 , 2 ] , [ 2 , 2 ] , [ 2 , 1 ] ) . includes ( r . point ( 1 . 5 , 1 . 5 ) ) <nl> tests : <nl> ot : false <nl> - cd : r . polygon ( [ 1 , 1 ] , [ 1 , 2 ] , [ 2 , 2 ] , [ 2 , 1 ] ) . includes ( r . polygon ( [ 2 , 2 ] , [ 2 , 3 ] , [ 3 , 3 ] , [ 3 , 2 ] ) ) <nl> ot : false <nl> + # includes on an array / stream <nl> + - cd : r . expr ( [ r . polygon ( [ 0 , 0 ] , [ 1 , 1 ] , [ 0 , 1 ] ) , r . polygon ( [ 1 , 0 ] , [ 2 , 1 ] , [ 1 , 1 ] ) ] ) . includes ( r . point ( 0 , 0 ) ) . count ( ) <nl> + ot : 1 <nl> + # Wrong geometry type arguments ( the first one must be a polygon ) <nl> + - cd : r . point ( 0 , 0 ) . includes ( r . point ( 0 , 0 ) ) <nl> + ot : err ( ' RqlRuntimeError ' , ' Expected geometry of type ` Polygon ` but found ` Point ` . ' ) <nl> + - cd : r . line ( [ 0 , 0 ] , [ 1 , 0 ] ) . includes ( r . point ( 0 , 0 ) ) <nl> + ot : err ( ' RqlRuntimeError ' , ' Expected geometry of type ` Polygon ` but found ` LineString ` . ' ) <nl> mmm a / test / rql_test / src / joins . yaml <nl> ppp b / test / rql_test / src / joins . yaml <nl> <nl> desc : Tests that manipulation data in tables <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> + # Set up some more tables <nl> <nl> - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> tests : <nl> ot : [ { ' id ' : 10 , ' msg ' : ' Message One ' , ' receiver ' : ' Receiver One ' , ' receiver_id ' : 1 , ' sender ' : ' Sender One ' , ' sender_id ' : 1 } , { ' id ' : 20 , ' msg ' : ' Message Two ' , ' receiver ' : ' Receiver One ' , ' receiver_id ' : 1 , ' sender ' : ' Sender One ' , ' sender_id ' : 1 } , { ' id ' : 30 , ' msg ' : ' Message Three ' , ' receiver ' : ' Receiver One ' , ' receiver_id ' : 1 , ' sender ' : ' Sender One ' , ' sender_id ' : 1 } ] <nl> <nl> # Clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test2 ' ) <nl> ot : ( { ' dropped ' : 1 } ) <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test3 ' ) <nl> mmm a / test / rql_test / src / match . yaml <nl> ppp b / test / rql_test / src / match . yaml <nl> <nl> desc : Tests for match <nl> + table_variable_name : tbl <nl> tests : <nl> - cd : r . expr ( " abcdefg " ) . match ( " a ( b . e ) | b ( c . e ) " ) <nl> ot : ( { ' str ' : ' bcde ' , ' groups ' : [ null , { ' start ' : 2 , ' str ' : ' cde ' , ' end ' : 5 } ] , ' start ' : 1 , ' end ' : 5 } ) <nl> tests : <nl> - cd : r . expr ( " abcdefg " ) . match ( " ( ? i ) a ( b . e ) | B ( c . e ) " ) <nl> ot : ( { ' str ' : ' bcde ' , ' groups ' : [ null , { ' start ' : 2 , ' str ' : ' cde ' , ' end ' : 5 } ] , ' start ' : 1 , ' end ' : 5 } ) <nl> <nl> - - cd : r . table_create ( ' test_match ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - cd : r . expr ( [ " aba " , " aca " , " ada " , " aea " ] ) . filter { | row | row . match ( " a ( . ) a " ) [ : groups ] [ 0 ] [ : str ] . match ( " [ cd ] " ) } <nl> py : r . expr ( [ " aba " , " aca " , " ada " , " aea " ] ) . filter ( lambda row : row . match ( " a ( . ) a " ) [ ' groups ' ] [ 0 ] [ ' str ' ] . match ( " [ cd ] " ) ) <nl> js : r . expr ( [ " aba " , " aca " , " ada " , " aea " ] ) . filter ( function ( row ) { return row . match ( " a ( . ) a " ) ( ' groups ' ) . nth ( 0 ) ( ' str ' ) . match ( " [ cd ] " ) } ) <nl> ot : ( [ " aca " , " ada " ] ) <nl> <nl> - - def : tbl = r . table ( ' test_match ' ) <nl> - <nl> - cd : tbl . insert ( [ { ' id ' : 0 , ' a ' : ' abc ' } , { ' id ' : 1 , ' a ' : ' ab ' } , { ' id ' : 2 , ' a ' : ' bc ' } ] ) <nl> ot : ( { ' deleted ' : 0 . 0 , ' replaced ' : 0 . 0 , ' unchanged ' : 0 . 0 , ' errors ' : 0 . 0 , ' skipped ' : 0 . 0 , ' inserted ' : 3 } ) <nl> <nl> tests : <nl> ot : | <nl> err ( " RqlRuntimeError " , " Error in regexp ` ab \ \ 9 ` ( portion ` \ \ 9 ` ) : invalid escape sequence : \ \ 9 " , [ ] ) <nl> <nl> - - cd : r . table_drop ( ' test_match ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> \ No newline at end of file <nl> mmm a / test / rql_test / src / mutation / atomic_get_set . yaml <nl> ppp b / test / rql_test / src / mutation / atomic_get_set . yaml <nl> <nl> desc : Tests replacement of selections <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - # Set up some data <nl> - - cd : r . table_create ( ' asg ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> # old version of argument <nl> - - cd : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , : return_vals = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , return_vals = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , { ' return_vals ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . insert ( { ' id ' : 0 } , : return_vals = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . insert ( { ' id ' : 0 } , return_vals = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . insert ( { ' id ' : 0 } , { ' return_vals ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : err ( " RqlRuntimeError " , " return_vals renamed to return_changes " , [ 0 ] ) <nl> <nl> - - cd : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . insert ( { ' id ' : 0 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . insert ( { ' id ' : 0 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . insert ( { ' id ' : 0 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : ( { ' changes ' : [ { ' old_val ' : null , ' new_val ' : { ' id ' : 0 } } ] } ) <nl> - - cd : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . insert ( { ' id ' : 0 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . insert ( { ' id ' : 0 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . insert ( { ' id ' : 0 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . insert ( { ' id ' : 0 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> # We still return the old value if there ' s an error . <nl> ot : ( { ' first_error ' : " Duplicate primary key ` id ` : \ n { \ n \ t \ " id \ " : \ t0 \ n } \ n { \ n \ t \ " id \ " : \ t0 \ n } " , ' changes ' : [ { ' old_val ' : { ' id ' : 0 } , ' new_val ' : { ' id ' : 0 } } ] } ) <nl> - - cd : r . table ( ' asg ' ) . insert ( [ { ' id ' : 1 } ] , : return_changes = > true ) <nl> - py : r . table ( ' asg ' ) . insert ( [ { ' id ' : 1 } ] , return_changes = True ) <nl> - js : r . table ( ' asg ' ) . insert ( [ { ' id ' : 1 } ] , { ' return__changes ' : true } ) <nl> + - cd : tbl . insert ( [ { ' id ' : 1 } ] , : return_changes = > true ) <nl> + py : tbl . insert ( [ { ' id ' : 1 } ] , return_changes = True ) <nl> + js : tbl . insert ( [ { ' id ' : 1 } ] , { ' return__changes ' : true } ) <nl> ot : ( { ' changes ' : [ { ' new_val ' : { ' id ' : 1 } , ' old_val ' : null } ] , ' errors ' : 0 , ' deleted ' : 0 , ' unchanged ' : 0 , ' skipped ' : 0 , ' replaced ' : 0 , ' inserted ' : 1 } ) <nl> - - cd : r . table ( ' asg ' ) . insert ( [ { ' id ' : 0 } ] , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . insert ( [ { ' id ' : 0 } ] , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . insert ( [ { ' id ' : 0 } ] , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . insert ( [ { ' id ' : 0 } ] , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . insert ( [ { ' id ' : 0 } ] , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . insert ( [ { ' id ' : 0 } ] , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : ( { ' first_error ' : " Duplicate primary key ` id ` : \ n { \ n \ t \ " id \ " : \ t0 \ n } \ n { \ n \ t \ " id \ " : \ t0 \ n } " , ' changes ' : [ { ' new_val ' : { ' id ' : 0 } , ' old_val ' : { ' id ' : 0 } } ] } ) <nl> <nl> - - cd : r . table ( ' asg ' ) . get ( 0 ) . update ( { ' x ' : 1 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . get ( 0 ) . update ( { ' x ' : 1 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . get ( 0 ) . update ( { ' x ' : 1 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . get ( 0 ) . update ( { ' x ' : 1 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . get ( 0 ) . update ( { ' x ' : 1 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . get ( 0 ) . update ( { ' x ' : 1 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : ( { ' changes ' : [ { ' old_val ' : { ' id ' : 0 } , ' new_val ' : { ' id ' : 0 , ' x ' : 1 } } ] } ) <nl> # We still return the old value if there ' s an error . <nl> - - cd : r . table ( ' asg ' ) . get ( 0 ) . update ( { ' x ' : r . error ( " a " ) } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . get ( 0 ) . update ( { ' x ' : r . error ( " a " ) } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . get ( 0 ) . update ( { ' x ' : r . error ( " a " ) } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . get ( 0 ) . update ( { ' x ' : r . error ( " a " ) } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . get ( 0 ) . update ( { ' x ' : r . error ( " a " ) } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . get ( 0 ) . update ( { ' x ' : r . error ( " a " ) } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : ( { ' first_error ' : ' a ' , ' changes ' : [ { ' old_val ' : { ' id ' : 0 , ' x ' : 1 } , ' new_val ' : { ' id ' : 0 , ' x ' : 1 } } ] } ) <nl> - - rb : r . table ( ' asg ' ) . update ( { ' x ' : 3 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> - py : r . table ( ' asg ' ) . update ( { ' x ' : 3 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) . do ( lambda d : d . merge ( { ' changes ' : d [ ' changes ' ] . order_by ( lambda a : a [ ' old_val ' ] [ ' id ' ] ) } ) ) <nl> - js : r . table ( ' asg ' ) . update ( { ' x ' : 3 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) . do ( function ( p ) { return p . merge ( { ' changes ' : p ( ' changes ' ) . orderBy ( function ( a ) { return a ( ' old__val ' ) ( ' id ' ) } ) } ) } ) <nl> + - rb : tbl . update ( { ' x ' : 3 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> + py : tbl . update ( { ' x ' : 3 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) . do ( lambda d : d . merge ( { ' changes ' : d [ ' changes ' ] . order_by ( lambda a : a [ ' old_val ' ] [ ' id ' ] ) } ) ) <nl> + js : tbl . update ( { ' x ' : 3 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) . do ( function ( p ) { return p . merge ( { ' changes ' : p ( ' changes ' ) . orderBy ( function ( a ) { return a ( ' old__val ' ) ( ' id ' ) } ) } ) } ) <nl> ot : ( { ' changes ' : [ { ' old_val ' : { ' id ' : 0 , ' x ' : 1 } , ' new_val ' : { ' id ' : 0 , ' x ' : 3 } } , { ' old_val ' : { ' id ' : 1 } , ' new_val ' : { ' id ' : 1 , ' x ' : 3 } } ] } ) <nl> <nl> - - cd : r . table ( ' asg ' ) . get ( 0 ) . replace ( { ' id ' : 0 , ' x ' : 2 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . get ( 0 ) . replace ( { ' id ' : 0 , ' x ' : 2 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . get ( 0 ) . replace ( { ' id ' : 0 , ' x ' : 2 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . get ( 0 ) . replace ( { ' id ' : 0 , ' x ' : 2 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . get ( 0 ) . replace ( { ' id ' : 0 , ' x ' : 2 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . get ( 0 ) . replace ( { ' id ' : 0 , ' x ' : 2 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : ( { ' changes ' : [ { ' old_val ' : { ' id ' : 0 , ' x ' : 3 } , ' new_val ' : { ' id ' : 0 , ' x ' : 2 } } ] } ) <nl> # We still return the old value if there ' s an error . <nl> - - cd : r . table ( ' asg ' ) . get ( 0 ) . replace ( : return_changes = > true ) { { ' x ' : r . error ( ' a ' ) } } . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . get ( 0 ) . replace ( lambda y : { ' x ' : r . error ( ' a ' ) } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . get ( 0 ) . replace ( function ( y ) { return { ' x ' : r . error ( ' a ' ) } } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . get ( 0 ) . replace ( : return_changes = > true ) { { ' x ' : r . error ( ' a ' ) } } . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . get ( 0 ) . replace ( lambda y : { ' x ' : r . error ( ' a ' ) } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . get ( 0 ) . replace ( function ( y ) { return { ' x ' : r . error ( ' a ' ) } } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : ( { ' first_error ' : ' a ' , ' changes ' : [ { ' old_val ' : { ' id ' : 0 , ' x ' : 2 } , ' new_val ' : { ' id ' : 0 , ' x ' : 2 } } ] } ) <nl> - - rb : r . table ( ' asg ' ) . replace ( : return_changes = > true ) { | d | d . without ( ' x ' ) } . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> - py : r . table ( ' asg ' ) . replace ( lambda y : y . without ( ' x ' ) , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) . do ( lambda d : d . merge ( { ' changes ' : d [ ' changes ' ] . order_by ( lambda a : a [ ' old_val ' ] [ ' id ' ] ) } ) ) <nl> - js : r . table ( ' asg ' ) . replace ( function ( p ) { return p . without ( ' x ' ) } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) . do ( function ( p ) { return p . merge ( { ' changes ' : p ( ' changes ' ) . orderBy ( function ( a ) { return a ( ' old__val ' ) ( ' id ' ) } ) } ) } ) <nl> + - rb : tbl . replace ( : return_changes = > true ) { | d | d . without ( ' x ' ) } . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> + py : tbl . replace ( lambda y : y . without ( ' x ' ) , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) . do ( lambda d : d . merge ( { ' changes ' : d [ ' changes ' ] . order_by ( lambda a : a [ ' old_val ' ] [ ' id ' ] ) } ) ) <nl> + js : tbl . replace ( function ( p ) { return p . without ( ' x ' ) } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) . do ( function ( p ) { return p . merge ( { ' changes ' : p ( ' changes ' ) . orderBy ( function ( a ) { return a ( ' old__val ' ) ( ' id ' ) } ) } ) } ) <nl> ot : ( { ' changes ' : [ { ' new_val ' : { ' id ' : 0 } , ' old_val ' : { ' id ' : 0 , ' x ' : 2 } } , { ' new_val ' : { ' id ' : 1 } , ' old_val ' : { ' id ' : 1 , ' x ' : 3 } } ] } ) <nl> - - rb : r . table ( ' asg ' ) . replace ( { ' x ' : 1 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> - py : r . table ( ' asg ' ) . replace ( { ' x ' : 1 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) . do ( lambda d : d . merge ( { ' changes ' : d [ ' changes ' ] . order_by ( lambda a : a [ ' old_val ' ] [ ' id ' ] ) } ) ) <nl> - js : r . table ( ' asg ' ) . replace ( { ' x ' : 1 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) . do ( function ( p ) { return p . merge ( { ' changes ' : p ( ' changes ' ) . orderBy ( function ( a ) { return a ( ' old__val ' ) ( ' id ' ) } ) } ) } ) <nl> + - rb : tbl . replace ( { ' x ' : 1 } , : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> + py : tbl . replace ( { ' x ' : 1 } , return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) . do ( lambda d : d . merge ( { ' changes ' : d [ ' changes ' ] . order_by ( lambda a : a [ ' old_val ' ] [ ' id ' ] ) } ) ) <nl> + js : tbl . replace ( { ' x ' : 1 } , { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) . do ( function ( p ) { return p . merge ( { ' changes ' : p ( ' changes ' ) . orderBy ( function ( a ) { return a ( ' old__val ' ) ( ' id ' ) } ) } ) } ) <nl> ot : ( { ' first_error ' : " Inserted object must have primary key ` id ` : \ n { \ n \ t \ " x \ " : \ t1 \ n } " , ' changes ' : [ { ' new_val ' : { ' x ' : 1 } , ' old_val ' : { ' id ' : 0 } } , { ' new_val ' : { ' x ' : 1 } , ' old_val ' : { ' id ' : 1 } } ] } ) <nl> <nl> - - rb : r . table ( ' asg ' ) . foreach { | row | [ r . table ( ' asg ' ) . get ( 0 ) . update ( nil , : return_changes = > true ) , r . table ( ' asg ' ) . get ( 0 ) . update ( nil , : return_changes = > true ) ] } . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> + - rb : tbl . foreach { | row | [ tbl . get ( 0 ) . update ( nil , : return_changes = > true ) , tbl . get ( 0 ) . update ( nil , : return_changes = > true ) ] } . pluck ( ' changes ' , ' first_error ' ) . do { | d | d . merge ( { : changes = > d [ ' changes ' ] . order_by { | a | a [ ' old_val ' ] [ ' id ' ] } } ) } <nl> ot : ( { ' changes ' : [ { ' new_val ' : { ' id ' : 0 } , ' old_val ' : { ' id ' : 0 } } , { ' new_val ' : { ' id ' : 0 } , ' old_val ' : { ' id ' : 0 } } , { ' new_val ' : { ' id ' : 0 } , ' old_val ' : { ' id ' : 0 } } , { ' new_val ' : { ' id ' : 0 } , ' old_val ' : { ' id ' : 0 } } ] } ) <nl> <nl> - - cd : r . table ( ' asg ' ) . get ( 0 ) . delete ( : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> - py : r . table ( ' asg ' ) . get ( 0 ) . delete ( return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> - js : r . table ( ' asg ' ) . get ( 0 ) . delete ( { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> + - cd : tbl . get ( 0 ) . delete ( : return_changes = > true ) . pluck ( ' changes ' , ' first_error ' ) <nl> + py : tbl . get ( 0 ) . delete ( return_changes = True ) . pluck ( ' changes ' , ' first_error ' ) <nl> + js : tbl . get ( 0 ) . delete ( { ' return__changes ' : true } ) . pluck ( ' changes ' , ' first__error ' ) <nl> ot : ( { ' changes ' : [ { ' old_val ' : { ' id ' : 0 } , ' new_val ' : null } ] } ) <nl> - - cd : r . table ( ' asg ' ) . delete ( : return_changes = > true ) <nl> - py : r . table ( ' asg ' ) . delete ( return_changes = True ) <nl> - js : r . table ( ' asg ' ) . delete ( { ' return__changes ' : true } ) <nl> + - cd : tbl . delete ( : return_changes = > true ) <nl> + py : tbl . delete ( return_changes = True ) <nl> + js : tbl . delete ( { ' return__changes ' : true } ) <nl> ot : ( { ' deleted ' : 1 , ' errors ' : 0 , ' inserted ' : 0 , ' replaced ' : 0 , ' skipped ' : 0 , ' unchanged ' : 0 , ' changes ' : [ { ' new_val ' : null , ' old_val ' : { ' id ' : 1 } } ] } ) <nl> <nl> - - cd : r . table_drop ( ' asg ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / mutation / delete . yaml <nl> ppp b / test / rql_test / src / mutation / delete . yaml <nl> <nl> desc : Tests deletes of selections <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl2 = r . db ( ' test ' ) . table ( ' test2 ' ) <nl> <nl> - py : tbl . insert ( [ { ' id ' : i } for i in xrange ( 100 ) ] ) <nl> js : | <nl> tests : <nl> py : tbl . delete ( durability = ' hard ' ) <nl> ot : ( { ' deleted ' : 50 , ' replaced ' : 0 . 0 , ' unchanged ' : 0 . 0 , ' errors ' : 0 . 0 , ' skipped ' : 0 . 0 , ' inserted ' : 0 . 0 } ) <nl> <nl> - # clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : " ( { ' dropped ' : 1 } ) " <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test2 ' ) <nl> - ot : " ( { ' dropped ' : 1 } ) " <nl> - <nl> # test deletion on a non - deletable object <nl> - cd : r . expr ( [ 1 , 2 ] ) . delete ( ) <nl> ot : err ( ' RqlRuntimeError ' , ' Expected type SELECTION but found DATUM . ' , [ 0 ] ) <nl> mmm a / test / rql_test / src / mutation / insert . yaml <nl> ppp b / test / rql_test / src / mutation / insert . yaml <nl> <nl> desc : Tests insertion into tables <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - # Set up our test tables <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> + # Set up our secondary test table <nl> - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> <nl> tests : <nl> ot : ( { ' deleted ' : 0 . 0 , ' replaced ' : 0 . 0 , ' unchanged ' : 0 . 0 , ' errors ' : 0 . 0 , ' skipped ' : 0 . 0 , ' inserted ' : 7 } ) <nl> <nl> # clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : " ( { ' dropped ' : 1 } ) " <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test2 ' ) <nl> ot : " ( { ' dropped ' : 1 } ) " <nl> mmm a / test / rql_test / src / mutation / replace . yaml <nl> ppp b / test / rql_test / src / mutation / replace . yaml <nl> <nl> desc : Tests replacement of selections <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl2 = r . db ( ' test ' ) . table ( ' test2 ' ) <nl> - cd : [ ] <nl> <nl> - py : tbl . insert ( [ { ' id ' : i } for i in xrange ( 100 ) ] ) <nl> js : | <nl> tests : <nl> rb : tbl . replace { | row | nil } <nl> ot : ( { ' deleted ' : 99 , ' replaced ' : 0 . 0 , ' unchanged ' : 0 . 0 , ' errors ' : 0 . 0 , ' skipped ' : 0 . 0 , ' inserted ' : 0 . 0 } ) <nl> <nl> - - cd : r . table ( ' test1 ' ) . get ( ' sdfjk ' ) . replace ( { ' id ' : ' sdfjk ' } ) [ ' inserted ' ] <nl> - js : r . table ( ' test1 ' ) . get ( ' sdfjk ' ) . replace ( { ' id ' : ' sdfjk ' } ) ( ' inserted ' ) <nl> + - cd : tbl . get ( ' sdfjk ' ) . replace ( { ' id ' : ' sdfjk ' } ) [ ' inserted ' ] <nl> + js : tbl . get ( ' sdfjk ' ) . replace ( { ' id ' : ' sdfjk ' } ) ( ' inserted ' ) <nl> ot : 1 <nl> - - cd : r . table ( ' test1 ' ) . get ( ' sdfjki ' ) . replace ( { ' id ' : ' sdfjk ' } ) [ ' errors ' ] <nl> - js : r . table ( ' test1 ' ) . get ( ' sdfjki ' ) . replace ( { ' id ' : ' sdfjk ' } ) ( ' errors ' ) <nl> + - cd : tbl . get ( ' sdfjki ' ) . replace ( { ' id ' : ' sdfjk ' } ) [ ' errors ' ] <nl> + js : tbl . get ( ' sdfjki ' ) . replace ( { ' id ' : ' sdfjk ' } ) ( ' errors ' ) <nl> ot : 1 <nl> <nl> - # clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : " ( { ' dropped ' : 1 } ) " <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test2 ' ) <nl> - ot : " ( { ' dropped ' : 1 } ) " <nl> mmm a / test / rql_test / src / mutation / update . yaml <nl> ppp b / test / rql_test / src / mutation / update . yaml <nl> <nl> desc : Tests updates of selections <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> <nl> tests : <nl> ot : ( { ' id ' : 0 , ' foo ' : 1 } ) <nl> <nl> # clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test2 ' ) <nl> ot : ( { ' dropped ' : 1 } ) <nl> <nl> mmm a / test / rql_test / src / polymorphism . yaml <nl> ppp b / test / rql_test / src / polymorphism . yaml <nl> <nl> desc : Tests that manipulation data in tables <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> - def : obj = r . expr ( { ' id ' : 0 , ' a ' : 0 } ) <nl> <nl> - py : tbl . insert ( [ { ' id ' : i , ' a ' : i } for i in xrange ( 3 ) ] ) <nl> tests : <nl> - obj . pluck ( ' a ' ) <nl> ot : ( { ' a ' : 0 } ) <nl> <nl> - # Cleanup <nl> - - cd : r . db ( ' test ' ) . table_list ( ) . for_each ( r . db ( ' test ' ) . table_drop ( r . row ) ) <nl> - rb : r . db ( ' test ' ) . table_list ( ) . for_each { | row | r . db ( ' test ' ) . table_drop ( row ) } <nl> - ot : ( { ' dropped ' : 1 } ) <nl> - <nl> mmm a / test / rql_test / src / regression / 1001 . yaml <nl> ppp b / test / rql_test / src / regression / 1001 . yaml <nl> <nl> desc : 1001 ( null + between + sindexes ) <nl> + table_variable_name : tbl <nl> tests : <nl> - - rb : r . table_create ( ' 1001 ' ) <nl> - def : tbl = r . table ( ' 1001 ' ) <nl> - <nl> - rb : tbl . insert ( { : a = > nil } ) <nl> - rb : tbl . index_create ( ' a ' ) <nl> - rb : tbl . index_create ( ' b ' ) <nl> tests : <nl> - rb : tbl . between ( nil , nil , : index = > : b ) . count <nl> ot : 0 <nl> <nl> - - rb : r . table_drop ( ' 1001 ' ) <nl> mmm a / test / rql_test / src / regression / 1155 . yaml <nl> ppp b / test / rql_test / src / regression / 1155 . yaml <nl> <nl> desc : 1155 - - Empty batched_replaces_t constructed <nl> + table_variable_name : tbl <nl> tests : <nl> - - rb : r . db ( ' test ' ) . table_create ( ' 1155 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - - rb : r . db ( ' test ' ) . table ( ' 1155 ' ) . insert ( [ { : id = > ' 2 ' } , { : id = > ' 4 ' } ] ) [ ' inserted ' ] <nl> + - rb : tbl . insert ( [ { : id = > ' 2 ' } , { : id = > ' 4 ' } ] ) [ ' inserted ' ] <nl> ot : 2 <nl> - - rb : r . db ( ' test ' ) . table_drop ( ' 1155 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 1179 . yaml <nl> ppp b / test / rql_test / src / regression / 1179 . yaml <nl> <nl> desc : 1179 - - BRACKET term <nl> + table_variable_name : tbl <nl> tests : <nl> - - js : r . table_create ( ' 1179 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - js : r . expr ( [ 1 ] ) ( r . expr ( 0 ) ) <nl> py : r . expr ( [ 1 ] ) [ r . expr ( 0 ) ] <nl> rb : r . expr ( [ 1 ] ) [ r . expr ( 0 ) ] <nl> tests : <nl> ot : 1 <nl> - js : r . expr ( [ 1 ] ) ( 0 ) <nl> ot : 1 <nl> - - js : r . table ( ' 1179 ' ) . insert ( [ { ' id ' : 42 } , { ' id ' : 4 } , { ' id ' : 89 } , { ' id ' : 6 } , { ' id ' : 43 } ] ) . pluck ( ' inserted ' , ' first_error ' ) <nl> + - js : tbl . insert ( [ { ' id ' : 42 } , { ' id ' : 4 } , { ' id ' : 89 } , { ' id ' : 6 } , { ' id ' : 43 } ] ) . pluck ( ' inserted ' , ' first_error ' ) <nl> ot : ( { ' inserted ' : 5 } ) <nl> <nl> # test [ ] grouped data semantics <nl> - - js : r . table ( ' 1179 ' ) . group ( ' id ' ) ( 0 ) <nl> + - js : tbl . group ( ' id ' ) ( 0 ) <nl> ot : ( [ { " group " : 4 , " reduction " : { " id " : 4 } } , { " group " : 6 , " reduction " : { " id " : 6 } } , { " group " : 42 , " reduction " : { " id " : 42 } } , { " group " : 43 , " reduction " : { " id " : 43 } } , { " group " : 89 , " reduction " : { " id " : 89 } } ] ) <nl> - - js : r . table ( ' 1179 ' ) . coerce_to ( ' array ' ) . group ( ' id ' ) ( 0 ) <nl> + - js : tbl . coerce_to ( ' array ' ) . group ( ' id ' ) ( 0 ) <nl> ot : ( [ { " group " : 4 , " reduction " : { " id " : 4 } } , { " group " : 6 , " reduction " : { " id " : 6 } } , { " group " : 42 , " reduction " : { " id " : 42 } } , { " group " : 43 , " reduction " : { " id " : 43 } } , { " group " : 89 , " reduction " : { " id " : 89 } } ] ) <nl> <nl> # test nth grouped data semantics <nl> - - js : r . table ( ' 1179 ' ) . group ( ' id ' ) . nth ( 0 ) <nl> + - js : tbl . group ( ' id ' ) . nth ( 0 ) <nl> ot : ( [ { " group " : 4 , " reduction " : { " id " : 4 } } , { " group " : 6 , " reduction " : { " id " : 6 } } , { " group " : 42 , " reduction " : { " id " : 42 } } , { " group " : 43 , " reduction " : { " id " : 43 } } , { " group " : 89 , " reduction " : { " id " : 89 } } ] ) <nl> - - js : r . table ( ' 1179 ' ) . coerce_to ( ' array ' ) . group ( ' id ' ) . nth ( 0 ) <nl> + - js : tbl . coerce_to ( ' array ' ) . group ( ' id ' ) . nth ( 0 ) <nl> ot : ( [ { " group " : 4 , " reduction " : { " id " : 4 } } , { " group " : 6 , " reduction " : { " id " : 6 } } , { " group " : 42 , " reduction " : { " id " : 42 } } , { " group " : 43 , " reduction " : { " id " : 43 } } , { " group " : 89 , " reduction " : { " id " : 89 } } ] ) <nl> <nl> - - js : r . table_drop ( ' 1179 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 1468 . yaml <nl> ppp b / test / rql_test / src / regression / 1468 . yaml <nl> <nl> desc : 1468 - - Empty batched_replaces_t constructed <nl> + table_variable_name : tbl <nl> tests : <nl> - - rb : r . table_create ( ' 1468 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - - rb : r . table ( ' 1468 ' ) . insert ( [ { } , { } , { } ] ) [ ' inserted ' ] <nl> + - rb : tbl . insert ( [ { } , { } , { } ] ) [ ' inserted ' ] <nl> ot : ( 3 ) <nl> - - rb : r . table ( ' 1468 ' ) . replace ( non_atomic : ' true ' ) { | row | r . js ( " { } " ) } <nl> + - rb : tbl . replace ( non_atomic : ' true ' ) { | row | r . js ( " { } " ) } <nl> ot : ( { " unchanged " = > 0 , " skipped " = > 0 , " replaced " = > 0 , " inserted " = > 0 , " first_error " = > " Cannot convert javascript ` undefined ` to ql : : datum_t . " , " errors " = > 3 , " deleted " = > 0 } ) <nl> - - rb : r . table_drop ( ' 1468 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 1789 . yaml <nl> ppp b / test / rql_test / src / regression / 1789 . yaml <nl> <nl> desc : 1789 - - deleting a secondary index on a table that contains non - inline stored documents corrupts db <nl> + table_variable_name : tbl <nl> tests : <nl> - - rb : r . db ( ' test ' ) . table_create ( ' 1789 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - rb : r . db ( ' test ' ) . table ( ' 1789 ' ) . insert ( { : foo = > ' a ' , : data = > " AAAAAAAAAAAAAAAAAA <nl> + - rb : tbl . insert ( { : foo = > ' a ' , : data = > " AAAAAAAAAAAAAAAAAA <nl> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA <nl> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA <nl> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA <nl> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " } ) . pluck ( ' inserted ' ) <nl> ot : ( { ' inserted ' : 1 } ) <nl> <nl> - - rb : r . db ( ' test ' ) . table ( ' 1789 ' ) . index_create ( ' foo ' ) <nl> + - rb : tbl . index_create ( ' foo ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> <nl> - - rb : r . db ( ' test ' ) . table ( ' 1789 ' ) . index_wait ( ' foo ' ) . pluck ( ' index ' , ' ready ' ) <nl> + - rb : tbl . index_wait ( ' foo ' ) . pluck ( ' index ' , ' ready ' ) <nl> ot : ( [ { ' index ' : ' foo ' , ' ready ' : true } ] ) <nl> <nl> - - rb : r . db ( ' test ' ) . table ( ' 1789 ' ) . index_drop ( ' foo ' ) <nl> + - rb : tbl . index_drop ( ' foo ' ) <nl> ot : ( { ' dropped ' : 1 } ) <nl> <nl> - - rb : r . db ( ' test ' ) . table ( ' 1789 ' ) . coerce_to ( ' ARRAY ' ) . count ( ) <nl> + - rb : tbl . coerce_to ( ' ARRAY ' ) . count ( ) <nl> ot : ( 1 ) <nl> <nl> - # clean up <nl> - - rb : r . db ( ' test ' ) . table_drop ( ' 1789 ' ) <nl> mmm a / test / rql_test / src / regression / 2399 . yaml <nl> ppp b / test / rql_test / src / regression / 2399 . yaml <nl> <nl> desc : 2399 literal terms not removed under certain circumstances <nl> + table_variable_name : t <nl> tests : <nl> - <nl> - - rb : r . db ( ' test ' ) . table_create ( ' t2399 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - def : t = r . db ( ' test ' ) . table ( ' t2399 ' ) <nl> - <nl> - rb : t . insert ( { } ) <nl> - rb : t . update ( { : a = > { : b = > r . literal ( { } ) } } ) <nl> - rb : t . without ( ' id ' ) . coerce_to ( " ARRAY " ) <nl> tests : <nl> ot : ( [ { : a = > { : b = > { : a = > ' A ' , : b = > ' B ' , : c = > ' C ' , : cc = > ' CC ' , : d = > ' D ' } } } ] ) <nl> - rb : t . delete ( ) <nl> <nl> - - rb : r . db ( ' test ' ) . table_drop ( ' t2399 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 2697 . yaml <nl> ppp b / test / rql_test / src / regression / 2697 . yaml <nl> <nl> desc : 2697 - - Array insert and splice operations don ' t check array size limit . <nl> + table_variable_name : tbl <nl> tests : <nl> - - cd : r . table_create ( ' 2697 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> # make enormous > 100 , 000 element array <nl> - def : ten_l = r . expr ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ) <nl> - - js : r . table ( ' 2697 ' ) . insert ( { ' id ' : 1 , ' a ' : r . expr ( ten_l ) . concatMap ( function ( l ) { return ten_l } ) . concatMap ( function ( l ) { return ten_l } ) . concatMap ( function ( l ) { return ten_l } ) . concatMap ( function ( l ) { return ten_l } ) } ) . pluck ( ' first_error ' , ' inserted ' ) <nl> - py : r . table ( ' 2697 ' ) . insert ( { ' id ' : 1 , ' a ' : r . expr ( ten_l ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) } ) . pluck ( ' first_error ' , ' inserted ' ) <nl> - rb : r . table ( ' 2697 ' ) . insert ( { ' id ' : 1 , ' a ' : r . expr ( ten_l ) . concat_map { | l | ten_l } . concat_map { | l | ten_l } . concat_map { | l | ten_l } . concat_map { | l | ten_l } } ) . pluck ( ' first_error ' , ' inserted ' ) <nl> + - js : tbl . insert ( { ' id ' : 1 , ' a ' : r . expr ( ten_l ) . concatMap ( function ( l ) { return ten_l } ) . concatMap ( function ( l ) { return ten_l } ) . concatMap ( function ( l ) { return ten_l } ) . concatMap ( function ( l ) { return ten_l } ) } ) . pluck ( ' first_error ' , ' inserted ' ) <nl> + py : tbl . insert ( { ' id ' : 1 , ' a ' : r . expr ( ten_l ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) } ) . pluck ( ' first_error ' , ' inserted ' ) <nl> + rb : tbl . insert ( { ' id ' : 1 , ' a ' : r . expr ( ten_l ) . concat_map { | l | ten_l } . concat_map { | l | ten_l } . concat_map { | l | ten_l } . concat_map { | l | ten_l } } ) . pluck ( ' first_error ' , ' inserted ' ) <nl> ot : ( { ' inserted ' : 1 } ) <nl> - - cd : r . table ( ' 2697 ' ) . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row [ ' a ' ] . splice_at ( 0 , [ 2 ] ) } ) . pluck ( ' first_error ' ) <nl> - js : r . table ( ' 2697 ' ) . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row ( ' a ' ) . spliceAt ( 0 , [ 2 ] ) } ) . pluck ( ' first__error ' ) <nl> - rb : r . table ( ' 2697 ' ) . get ( 1 ) . replace { | old | { : id = > 1 , : a = > old [ ' a ' ] . splice_at ( 0 , [ 2 ] ) } } . pluck ( ' first_error ' ) <nl> + - cd : tbl . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row [ ' a ' ] . splice_at ( 0 , [ 2 ] ) } ) . pluck ( ' first_error ' ) <nl> + js : tbl . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row ( ' a ' ) . spliceAt ( 0 , [ 2 ] ) } ) . pluck ( ' first__error ' ) <nl> + rb : tbl . get ( 1 ) . replace { | old | { : id = > 1 , : a = > old [ ' a ' ] . splice_at ( 0 , [ 2 ] ) } } . pluck ( ' first_error ' ) <nl> ot : ( { ' first_error ' : ' Array over size limit ` 100000 ` . ' } ) <nl> - - cd : r . table ( ' 2697 ' ) . get ( 1 ) [ ' a ' ] . count ( ) <nl> - js : r . table ( ' 2697 ' ) . get ( 1 ) ( ' a ' ) . count ( ) <nl> + - cd : tbl . get ( 1 ) [ ' a ' ] . count ( ) <nl> + js : tbl . get ( 1 ) ( ' a ' ) . count ( ) <nl> ot : 100000 <nl> - - cd : r . table ( ' 2697 ' ) . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row [ ' a ' ] . insert_at ( 0 , [ 2 ] ) } ) . pluck ( ' first_error ' ) <nl> - js : r . table ( ' 2697 ' ) . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row ( ' a ' ) . insertAt ( 0 , [ 2 ] ) } ) . pluck ( ' first__error ' ) <nl> - rb : r . table ( ' 2697 ' ) . get ( 1 ) . replace { | old | { : id = > 1 , : a = > old [ ' a ' ] . insert_at ( 0 , [ 2 ] ) } } . pluck ( ' first_error ' ) <nl> + - cd : tbl . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row [ ' a ' ] . insert_at ( 0 , [ 2 ] ) } ) . pluck ( ' first_error ' ) <nl> + js : tbl . get ( 1 ) . replace ( { ' id ' : 1 , ' a ' : r . row ( ' a ' ) . insertAt ( 0 , [ 2 ] ) } ) . pluck ( ' first__error ' ) <nl> + rb : tbl . get ( 1 ) . replace { | old | { : id = > 1 , : a = > old [ ' a ' ] . insert_at ( 0 , [ 2 ] ) } } . pluck ( ' first_error ' ) <nl> ot : ( { ' first_error ' : ' Array over size limit ` 100000 ` . ' } ) <nl> - - cd : r . table ( ' 2697 ' ) . get ( 1 ) [ ' a ' ] . count ( ) <nl> - js : r . table ( ' 2697 ' ) . get ( 1 ) ( ' a ' ) . count ( ) <nl> + - cd : tbl . get ( 1 ) [ ' a ' ] . count ( ) <nl> + js : tbl . get ( 1 ) ( ' a ' ) . count ( ) <nl> ot : 100000 <nl> - js : r . expr ( [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ) . concatMap ( function ( l ) { return [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] } ) . concatMap ( function ( l ) { return [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] } ) . concatMap ( function ( l ) { return [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] } ) . concatMap ( function ( l ) { return [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] } ) . spliceAt ( 0 , [ 1 ] ) . count ( ) <nl> py : r . expr ( ten_l ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . splice_at ( 0 , [ 1 ] ) . count ( ) <nl> tests : <nl> py : r . expr ( ten_l ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . concat_map ( lambda l : list ( range ( 1 , 11 ) ) ) . insert_at ( 0 , [ 1 ] ) . count ( ) <nl> rb : r . expr ( ten_l ) . concat_map { | l | ten_l } . concat_map { | l | ten_l } . concat_map { | l | ten_l } . concat_map { | l | ten_l } . insert_at ( 0 , [ 1 ] ) . count ( ) <nl> ot : err ( " RqlRuntimeError " , " Array over size limit ` 100000 ` . " , [ ] ) <nl> - - cd : r . table_drop ( ' 2697 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 2709 . yaml <nl> ppp b / test / rql_test / src / regression / 2709 . yaml <nl> <nl> desc : 2709 - - Guarantee failed with [ max_els > = min_els ] <nl> + table_variable_name : tbl <nl> tests : <nl> - - py : r . table_create ( ' 2709 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl = r . table ( ' 2709 ' ) <nl> - <nl> - py : tbl . insert ( [ { ' result ' : i } for i in range ( 1 , 1000 ) ] ) . pluck ( ' first_error ' , ' inserted ' ) <nl> runopts : <nl> batch_conf : " { ' min_els ' : 10 , ' max_els ' : 13 } " <nl> tests : <nl> batch_conf : " { ' min_els ' : 13 , ' max_els ' : 10 } " <nl> ot : ( 999 ) <nl> <nl> - - py : r . table_drop ( ' 2709 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 2767 . yaml <nl> ppp b / test / rql_test / src / regression / 2767 . yaml <nl> <nl> desc : 2767 - - Evaulate secondary index function with pristine env . <nl> + table_variable_name : tbl <nl> tests : <nl> - - py : r . table_create ( ' 2767 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - - py : r . table ( ' 2767 ' ) . index_create ( ' foo ' , lambda x : x [ ' a ' ] . slice ( 1 , 3 ) ) <nl> + - py : tbl . index_create ( ' foo ' , lambda x : x [ ' a ' ] . slice ( 1 , 3 ) ) <nl> runopts : <nl> right_bound : ' " closed " ' <nl> ot : ( { ' created ' : 1 } ) <nl> - - py : r . table ( ' 2767 ' ) . insert ( { ' id ' : 1 , ' a ' : [ 1 , 2 , 3 , 4 , 5 ] } ) <nl> + - py : tbl . insert ( { ' id ' : 1 , ' a ' : [ 1 , 2 , 3 , 4 , 5 ] } ) <nl> runopts : <nl> right_bound : ' " closed " ' <nl> ot : ( { ' deleted ' : 0 , ' replaced ' : 0 , ' unchanged ' : 0 , ' errors ' : 0 , ' skipped ' : 0 , ' inserted ' : 1 } ) <nl> - - py : r . table ( ' 2767 ' ) . coerce_to ( ' array ' ) <nl> + - py : tbl . coerce_to ( ' array ' ) <nl> ot : ( [ { ' id ' : 1 , ' a ' : [ 1 , 2 , 3 , 4 , 5 ] } ] ) <nl> - - py : r . table ( ' 2767 ' ) . get_all ( [ 2 , 3 ] , index = ' foo ' ) . coerce_to ( ' array ' ) <nl> + - py : tbl . get_all ( [ 2 , 3 ] , index = ' foo ' ) . coerce_to ( ' array ' ) <nl> ot : ( [ { ' id ' : 1 , ' a ' : [ 1 , 2 , 3 , 4 , 5 ] } ] ) <nl> - - py : r . table ( ' 2767 ' ) . get_all ( [ 2 , 3 ] , index = ' foo ' ) . coerce_to ( ' array ' ) <nl> + - py : tbl . get_all ( [ 2 , 3 ] , index = ' foo ' ) . coerce_to ( ' array ' ) <nl> runopts : <nl> right_bound : ' " closed " ' <nl> ot : ( [ { ' id ' : 1 , ' a ' : [ 1 , 2 , 3 , 4 , 5 ] } ] ) <nl> - - py : r . table_drop ( ' 2767 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 2774 . yaml <nl> ppp b / test / rql_test / src / regression / 2774 . yaml <nl> <nl> desc : Tests key sorting of all usable types in secondary indexes <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> <nl> # Test key sorting <nl> - - cd : r . db ( ' test ' ) . table_create ( ' regression_2774 ' ) <nl> - def : tbl = r . table ( ' regression_2774 ' ) <nl> - <nl> - def : <nl> py : binary_a = r . binary ( b ' ' ) <nl> rb : binary_a = r . binary ( ' ' ) <nl> tests : <nl> py : tbl . order_by ( index = ' idx ' ) . map ( r . row [ ' id ' ] ) . coerce_to ( ' array ' ) <nl> ot : [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 ] <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' regression_2774 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 2838 . yaml <nl> ppp b / test / rql_test / src / regression / 2838 . yaml <nl> <nl> desc : Test that return_changes fails gracefully . <nl> + table_variable_name : tbl <nl> tests : <nl> - - py : r . table_create ( ' 2838 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - py : r . table ( ' 2838 ' ) . insert ( [ { ' result ' : i } for i in range ( 1 , 100 ) ] ) . pluck ( ' first_error ' , ' inserted ' ) <nl> + - py : tbl . insert ( [ { ' result ' : i } for i in range ( 1 , 100 ) ] ) . pluck ( ' first_error ' , ' inserted ' ) <nl> ot : ( { ' inserted ' : 99 } ) <nl> <nl> - - py : r . table ( ' 2838 ' ) . update ( { ' foo ' : ' bar ' } , return_changes = True ) [ ' changes ' ] . count ( ) <nl> + - py : tbl . update ( { ' foo ' : ' bar ' } , return_changes = True ) [ ' changes ' ] . count ( ) <nl> runopts : <nl> array_limit : ' 40 ' <nl> ot : ( 40 ) <nl> <nl> - - py : r . table ( ' 2838 ' ) . update ( { ' foo ' : ' quux ' } , return_changes = True ) [ ' warnings ' ] <nl> + - py : tbl . update ( { ' foo ' : ' quux ' } , return_changes = True ) [ ' warnings ' ] <nl> runopts : <nl> array_limit : ' 40 ' <nl> ot : ( [ ' Too many changes , array truncated to 40 . ' ] ) <nl> <nl> - - py : r . table_drop ( ' 2838 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 2930 . yaml <nl> ppp b / test / rql_test / src / regression / 2930 . yaml <nl> <nl> desc : Avoid misleading array limit error message <nl> + table_variable_name : tbl <nl> tests : <nl> - - py : r . table_create ( ' 2930 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - - py : r . table ( ' 2930 ' ) . insert ( [ { ' id ' : i , ' mod ' : i % 5 , ' foo ' : 5 } for i in range ( 1 , 1000 ) ] ) . pluck ( ' first_error ' , ' inserted ' ) <nl> + - py : tbl . insert ( [ { ' id ' : i , ' mod ' : i % 5 , ' foo ' : 5 } for i in range ( 1 , 1000 ) ] ) . pluck ( ' first_error ' , ' inserted ' ) <nl> ot : ( { ' inserted ' : 999 } ) <nl> - - py : r . table ( ' 2930 ' ) . coerce_to ( ' array ' ) <nl> + - py : tbl . coerce_to ( ' array ' ) <nl> runopts : <nl> array_limit : 500 <nl> ot : err ( " RqlRuntimeError " , " Array over size limit ` 500 ` . " , [ 0 ] ) <nl> - - py : r . table ( ' 2930 ' ) . group ( ' mod ' ) . coerce_to ( ' array ' ) <nl> + - py : tbl . group ( ' mod ' ) . coerce_to ( ' array ' ) <nl> runopts : <nl> array_limit : 500 <nl> ot : err ( " RqlRuntimeError " , " Grouped data over size limit ` 500 ` . Try putting a reduction ( like ` . reduce ` or ` . count ` ) on the end . " , [ 0 ] ) <nl> - - py : r . table ( ' 2930 ' ) . group ( ' foo ' ) . coerce_to ( ' array ' ) <nl> + - py : tbl . group ( ' foo ' ) . coerce_to ( ' array ' ) <nl> runopts : <nl> array_limit : 500 <nl> ot : err ( " RqlRuntimeError " , " Grouped data over size limit ` 500 ` . Try putting a reduction ( like ` . reduce ` or ` . count ` ) on the end . " , [ 0 ] ) <nl> - - py : r . table_drop ( ' 2930 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 309 . yaml <nl> ppp b / test / rql_test / src / regression / 309 . yaml <nl> <nl> desc : Regression tests for issue # 309 , using ' union ' on an array and a stream doesn ' t seem to work <nl> + table_variable_name : t <nl> tests : <nl> <nl> # Set up a stream <nl> - - cd : r . db ( ' test ' ) . table_create ( ' t309 ' ) <nl> - def : t = r . db ( ' test ' ) . table ( ' t309 ' ) <nl> <nl> - cd : t . insert ( [ { ' id ' : 0 } , { ' id ' : 1 } ] ) <nl> <nl> tests : <nl> - cd : r . expr ( [ 2 , 3 , 4 ] ) . union ( t ) <nl> ot : bag ( [ { ' id ' : 0 } , { ' id ' : 1 } , 2 , 3 , 4 ] ) <nl> <nl> - # clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' t309 ' ) <nl> mmm a / test / rql_test / src / regression / 453 . yaml <nl> ppp b / test / rql_test / src / regression / 453 . yaml <nl> <nl> desc : Sanity Check Fails , with r . table ( ) expression inside a map ( # 453 ) <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' foo ' ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' foo ' ) <nl> - <nl> - cd : tbl . insert ( [ { ' a ' : 1 } , { ' a ' : 2 } ] ) <nl> rb : tbl . insert ( [ { : a = > 1 } , { : a = > 2 } ] ) <nl> <nl> - - js : r . table ( ' foo ' ) . map ( function ( x ) { return r . table ( ' foo ' ) ; } ) <nl> - py : " r . table ( ' foo ' ) . map ( lambda x : r . table ( ' foo ' ) ) " <nl> - rb : r . table ( ' foo ' ) . map { | x | r . table ' foo ' } <nl> + - js : tbl . map ( function ( x ) { return tbl ; } ) <nl> + py : " tbl . map ( lambda x : tbl ) " <nl> + rb : tbl . map { | x | tbl } <nl> ot : err ( " RqlRuntimeError " , ' Expected type DATUM but found TABLE . ' , [ 0 ] ) <nl> <nl> - - js : r . table ( ' foo ' ) . map ( function ( x ) { return r . table ( ' foo ' ) . coerceTo ( ' array ' ) ; } ) . count ( ) <nl> - py : " r . table ( ' foo ' ) . map ( lambda x : r . table ( ' foo ' ) . coerce_to ( ' array ' ) ) . count ( ) " <nl> - rb : r . table ( ' foo ' ) . map { | x | r . table ( ' foo ' ) . coerce_to ( ' array ' ) } . count <nl> + - js : tbl . map ( function ( x ) { return tbl . coerceTo ( ' array ' ) ; } ) . count ( ) <nl> + py : " tbl . map ( lambda x : tbl . coerce_to ( ' array ' ) ) . count ( ) " <nl> + rb : tbl . map { | x | tbl . coerce_to ( ' array ' ) } . count <nl> ot : 2 <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' foo ' ) <nl> \ No newline at end of file <nl> mmm a / test / rql_test / src / regression / 522 . yaml <nl> ppp b / test / rql_test / src / regression / 522 . yaml <nl> <nl> desc : Skip after orderby causes use - after - free ( # 522 ) <nl> + table_variable_name : tbl <nl> tests : <nl> - <nl> - - cd : r . db ( ' test ' ) . table_create ( ' 522 ' ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' 522 ' ) <nl> - <nl> - cd : tbl . insert ( [ { ' id ' : 0 } , { ' id ' : 1 } , { ' id ' : 2 } ] ) <nl> <nl> - js : tbl . orderBy ( ' id ' ) . skip ( 1 ) <nl> tests : <nl> rb : tbl . order_by ( ' id ' ) . skip ( 1 ) <nl> ot : [ { ' id ' : 1 } , { ' id ' : 2 } ] <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' 522 ' ) <nl> mmm a / test / rql_test / src / regression / 545 . yaml <nl> ppp b / test / rql_test / src / regression / 545 . yaml <nl> <nl> desc : r . js inside reduce crashes server ( # 545 ) <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' 545 ' ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' 545 ' ) <nl> - <nl> - cd : tbl . insert ( [ { ' id ' : 0 } , { ' id ' : 1 } , { ' id ' : 2 } ] ) <nl> <nl> - js : tbl . reduce ( r . js ( " ( function ( x , y ) { return 1 ; } ) " ) ) <nl> tests : <nl> py : tbl . reduce ( r . js ( " ( function ( x , y ) { return { id : x [ \ " id \ " ] + y [ \ " id \ " ] } ; } ) " ) ) <nl> rb : tbl . reduce ( r . js ( " ( function ( x , y ) { return { id : x [ \ " id \ " ] + y [ \ " id \ " ] } ; } ) " ) ) <nl> ot : ( { ' id ' : 3 } ) <nl> - <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' 545 ' ) <nl> mmm a / test / rql_test / src / regression / 568 . yaml <nl> ppp b / test / rql_test / src / regression / 568 . yaml <nl> <nl> desc : concatmap that doesn ' t return stream crashes server ( # 568 ) <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' 568 ' ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' 568 ' ) <nl> - <nl> - cd : tbl . insert ( { ' name ' : ' Jim Brown ' } ) <nl> <nl> - js : tbl . concatMap ( function ( rec ) { return rec ( " name " ) } ) <nl> tests : <nl> rb : tbl . concat_map { | rec | rec [ : name ] } <nl> ot : err ( " RqlRuntimeError " , " Cannot convert STRING to SEQUENCE " , [ ] ) <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' 568 ' ) <nl> mmm a / test / rql_test / src / regression / 578 . yaml <nl> ppp b / test / rql_test / src / regression / 578 . yaml <nl> <nl> - desc : reject non - deterministic secondary indexes ( # 578 ) <nl> + desc : Catch obvious sindex creation / dropping errors ( # 578 ) <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' 578 ' ) <nl> - def : tbl = r . table ( ' 578 ' ) <nl> - <nl> - js : tbl . index_create ( " 578 " , function ( rec ) { return 1 } ) <nl> py : tbl . index_create ( " 578 " , lambda rec : 1 ) <nl> rb : tbl . index_create ( " 578 " ) { | rec | 1 } <nl> tests : <nl> - js : tbl . index_create ( " 578 " , function ( rec ) { return 1 } ) <nl> py : tbl . index_create ( " 578 " , lambda rec : 1 ) <nl> rb : tbl . index_create ( " 578 " ) { | rec | 1 } <nl> - ot : ' err ( " RqlRuntimeError " , " Index ` 578 ` already exists on table ` test . 578 ` . " , [ ] ) ' <nl> + ot : ' err_regex ( " RqlRuntimeError " , " Index ` 578 ` already exists on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] " , [ ] ) ' <nl> <nl> - js : tbl . index_drop ( " 578 " ) <nl> py : tbl . index_drop ( " 578 " ) <nl> tests : <nl> - js : tbl . index_drop ( " 578 " ) <nl> py : tbl . index_drop ( " 578 " ) <nl> rb : tbl . index_drop ( " 578 " ) <nl> - ot : ' err ( " RqlRuntimeError " , " Index ` 578 ` does not exist on table ` test . 578 ` . " , [ ] ) ' <nl> + ot : ' err_regex ( " RqlRuntimeError " , " Index ` 578 ` does not exist on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] " , [ ] ) ' <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' 578 ' ) <nl> mmm a / test / rql_test / src / regression / 579 . yaml <nl> ppp b / test / rql_test / src / regression / 579 . yaml <nl> <nl> desc : reject non - deterministic secondary indexes ( # 579 ) <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' 579 ' ) <nl> - def : tbl = r . table ( ' 579 ' ) <nl> - <nl> - cd : tbl . insert ( { ' name ' : ' Jim Brown ' } ) <nl> <nl> - js : tbl . index_create ( " 579 " , function ( rec ) { return r . js ( " 1 " ) } ) <nl> tests : <nl> rb : tbl . index_create ( " 579 " ) { | rec | tbl . get ( 0 ) } <nl> ot : err ( " RqlRuntimeError " , " Could not prove function deterministic . Index functions must be deterministic . " , [ ] ) <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' 579 ' ) <nl> mmm a / test / rql_test / src / regression / 678 . yaml <nl> ppp b / test / rql_test / src / regression / 678 . yaml <nl> <nl> desc : fix type of ` limit ` and ` zip ` on streams ( # 678 ) <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' 678 ' ) <nl> - def : tbl = r . table ( ' 678 ' ) <nl> - <nl> - rb : tbl . map { | x | x } . limit ( 1 ) . typeof <nl> ot : ( " STREAM " ) <nl> <nl> - rb : r ( [ 1 ] ) . map { | x | x } . limit ( 1 ) . typeof <nl> ot : ( " ARRAY " ) <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' 678 ' ) <nl> mmm a / test / rql_test / src / regression / 715 . yaml <nl> ppp b / test / rql_test / src / regression / 715 . yaml <nl> <nl> desc : 715 - - noreply writes <nl> + table_variable_name : tbl <nl> tests : <nl> - - cd : r . table_create ( ' 715 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - <nl> - - def : tbl = r . table ( ' 715 ' ) <nl> <nl> - cd : tbl . insert ( { } ) [ ' inserted ' ] <nl> js : tbl . insert ( { } ) ( ' inserted ' ) <nl> tests : <nl> - cd : tbl . count ( ) <nl> ot : 3 <nl> <nl> - - cd : r . table_drop ( ' 715 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / regression / 718 . yaml <nl> ppp b / test / rql_test / src / regression / 718 . yaml <nl> <nl> desc : 718 - - another lazy crashing bug - - changed as of # 1328 to allow referencing external variables <nl> + table_variable_name : tbl <nl> tests : <nl> - - rb : r . db ( ' test ' ) . table_create ( ' 718 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> <nl> - - rb : r ( 4 ) . do { | x | r . table ( ' 718 ' ) . index_create ( ' 718 ' ) { | row | row [ : id ] % x } } <nl> + - rb : r ( 4 ) . do { | x | tbl . index_create ( ' 718 ' ) { | row | row [ : id ] % x } } <nl> ot : ( { ' created ' : 1 } ) <nl> <nl> - - rb : r . db ( ' test ' ) . table_drop ( ' 718 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> \ No newline at end of file <nl> mmm a / test / rql_test / src / regression / 763 . yaml <nl> ppp b / test / rql_test / src / regression / 763 . yaml <nl> <nl> desc : issue 763 check arg count for indexCreate in JS driver <nl> + table_variable_name : tbl <nl> tests : <nl> - - js : r . tableCreate ( ' foo ' ) <nl> - def : tbl = r . table ( ' foo ' ) <nl> - <nl> - js : tbl . indexCreate ( ) <nl> ot : err ( " RqlDriverError " , " Expected between 1 and 3 arguments but found 0 . " ) <nl> <nl> tests : <nl> - js : r . add ( 1 ) <nl> ot : 1 <nl> <nl> - - js : r . tableDrop ( ' foo ' ) <nl> mmm a / test / rql_test / src / regression / 831 . yaml <nl> ppp b / test / rql_test / src / regression / 831 . yaml <nl> <nl> desc : 831 - - Empty batched_replaces_t constructed <nl> + table_variable_name : tbl <nl> tests : <nl> - - py : r . db ( ' test ' ) . table_create ( ' 831 ' ) <nl> - - py : r . db ( ' test ' ) . table ( ' 831 ' ) . insert ( [ True , True ] ) <nl> + - py : tbl . insert ( [ True , True ] ) <nl> ot : ( { ' first_error ' : ' Expected type OBJECT but found BOOL . ' , ' skipped ' : 0 , ' deleted ' : 0 , ' unchanged ' : 0 , ' errors ' : 2 , ' replaced ' : 0 , ' inserted ' : 0 } ) <nl> - - py : r . db ( ' test ' ) . table_drop ( ' 831 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> mmm a / test / rql_test / src / selection . yaml <nl> ppp b / test / rql_test / src / selection . yaml <nl> <nl> desc : Tests that manipulation data in tables <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> + # Set up some more tables <nl> - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> def : tbl2 = r . db ( ' test ' ) . table ( ' test2 ' ) <nl> tests : <nl> ot : err ( " RqlRuntimeError " , ' Table name ` % ` invalid ( Use A - Za - z0 - 9_ only ) . ' , [ 0 ] ) <nl> <nl> # Access a table from default db <nl> - - cd : r . table ( ' test1 ' ) . count ( ) <nl> + - cd : tbl . count ( ) <nl> ot : 100 <nl> <nl> # Access a table using the ` use_outdated ` flag <nl> - py : <nl> - - r . table ( ' test1 ' , use_outdated = True ) . count ( ) <nl> - - r . db ( ' test ' ) . table ( ' test1 ' , use_outdated = True ) . count ( ) <nl> + - r . table ( ' test2 ' , use_outdated = True ) . count ( ) <nl> + - r . db ( ' test ' ) . table ( ' test2 ' , use_outdated = True ) . count ( ) <nl> js : <nl> - - r . table ( ' test1 ' , { useOutdated : true } ) . count ( ) <nl> - - r . db ( ' test ' ) . table ( ' test1 ' , { useOutdated : true } ) . count ( ) <nl> + - r . table ( ' test2 ' , { useOutdated : true } ) . count ( ) <nl> + - r . db ( ' test ' ) . table ( ' test2 ' , { useOutdated : true } ) . count ( ) <nl> rb : <nl> - - r . table ( ' test1 ' , { : use_outdated = > true } ) . count ( ) <nl> - - r . db ( ' test ' ) . table ( ' test1 ' , { : use_outdated = > true } ) . count ( ) <nl> + - r . table ( ' test2 ' , { : use_outdated = > true } ) . count ( ) <nl> + - r . db ( ' test ' ) . table ( ' test2 ' , { : use_outdated = > true } ) . count ( ) <nl> ot : 100 <nl> <nl> - cd : tbl . get ( 20 ) . count ( ) <nl> tests : <nl> ot : err ( ' RqlRuntimeError ' , ' Expected type DATUM but found TABLE . ' , [ 0 ] ) <nl> <nl> # Clean up <nl> - - cd : r . db ( ' test ' ) . table_list ( ) . for_each ( r . db ( ' test ' ) . table_drop ( r . row ) ) <nl> - rb : r . db ( ' test ' ) . table_list ( ) . for_each { | row | r . db ( ' test ' ) . table_drop ( row ) } <nl> - ot : ( { ' dropped ' : 4 } ) <nl> + - cd : r . expr ( [ ' test2 ' , ' test3 ' , ' testpkey ' ] ) . for_each ( r . db ( ' test ' ) . table_drop ( r . row ) ) <nl> + rb : r . expr ( [ ' test2 ' , ' test3 ' , ' testpkey ' ] ) . for_each { | row | r . db ( ' test ' ) . table_drop ( row ) } <nl> + ot : ( { ' dropped ' : 3 } ) <nl> <nl> mmm a / test / rql_test / src / sindex / api . yaml <nl> ppp b / test / rql_test / src / sindex / api . yaml <nl> <nl> desc : sindex api ( # 602 ) <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' sindexapi ' ) <nl> - def : tbl = r . table ( ' sindexapi ' ) <nl> - <nl> - def : rows = [ { ' id ' : 0 , ' a ' : 0 , ' b ' : 0 , ' c ' : 0 , ' m ' : [ 1 , 2 , 3 ] } , <nl> { ' id ' : 1 , ' a ' : 0 , ' b ' : 0 , ' c ' : 0 , ' m ' : [ 4 , 5 , 6 ] } , <nl> { ' id ' : 2 , ' a ' : 0 , ' b ' : 0 , ' c ' : 1 , ' m ' : 7 } , <nl> tests : <nl> ot : ( { ' created ' : 1 } ) <nl> <nl> - cd : tbl . index_rename ( ' rename - foo ' , ' rename - bar ' ) <nl> - ot : err ( ' RqlRuntimeError ' , ' Index ` rename - bar ` already exists on table ` test . sindexapi ` . ' , [ ] ) <nl> + ot : err_regex ( ' RqlRuntimeError ' , ' Index ` rename - bar ` already exists on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] ' , [ ] ) <nl> <nl> - cd : tbl . index_rename ( ' rename - fake ' , ' rename - stuff ' ) <nl> - ot : err ( ' RqlRuntimeError ' , ' Index ` rename - fake ` does not exist on table ` test . sindexapi ` . ' , [ ] ) <nl> + ot : err_regex ( ' RqlRuntimeError ' , ' Index ` rename - fake ` does not exist on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] ' , [ ] ) <nl> <nl> - cd : tbl . index_rename ( ' id ' , ' rename - stuff ' ) <nl> ot : err ( ' RqlRuntimeError ' , ' Index name conflict : ' + ' ` id ` is the name of the primary key . ' , [ ] ) <nl> tests : <nl> - rb : tbl . index_create ( ' ai ' ) { | row | row [ : a ] } <nl> py : tbl . index_create ( ' ai ' , r . row [ ' a ' ] ) <nl> js : tbl . indexCreate ( ' ai ' , r . row ( ' a ' ) ) <nl> - ot : err ( " RqlRuntimeError " , " Index ` ai ` already exists on table ` test . sindexapi ` . " , [ ] ) <nl> + ot : err_regex ( " RqlRuntimeError " , " Index ` ai ` already exists on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] " , [ ] ) <nl> - rb : tbl . index_create ( ' bi ' ) { | row | row [ : b ] } <nl> py : tbl . index_create ( ' bi ' , r . row [ ' b ' ] ) <nl> js : tbl . indexCreate ( ' bi ' , r . row ( ' b ' ) ) <nl> tests : <nl> - rb : tbl . get_all ( 0 , : index = > : fake ) <nl> py : tbl . get_all ( 0 , index = ' fake ' ) <nl> js : tbl . getAll ( 0 , { index : ' fake ' } ) <nl> - ot : err ( " RqlRuntimeError " , " Index ` fake ` was not found on table ` test . sindexapi ` . " , [ ] ) <nl> + ot : err_regex ( " RqlRuntimeError " , " Index ` fake ` was not found on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] " , [ ] ) <nl> <nl> - rb : tbl . get_all ( 0 , : index = > false ) <nl> py : tbl . get_all ( 0 , index = False ) <nl> tests : <nl> - rb : tbl . eq_join ( : id , tbl , : index = > : fake ) <nl> py : tbl . eq_join ( ' id ' , tbl , index = ' fake ' ) <nl> js : tbl . eqJoin ( ' id ' , tbl , { index : ' fake ' } ) <nl> - ot : err ( " RqlRuntimeError " , " Index ` fake ` was not found on table ` test . sindexapi ` . " , [ ] ) <nl> + ot : err_regex ( " RqlRuntimeError " , " Index ` fake ` was not found on table ` [ a - zA - Z0 - 9_ ] + . [ a - zA - Z0 - 9_ ] + ` [ . ] " , [ ] ) <nl> - rb : tbl . eq_join ( : id , tbl , : index = > false ) <nl> py : tbl . eq_join ( ' id ' , tbl , index = False ) <nl> js : tbl . eqJoin ( ' id ' , tbl , { index : false } ) <nl> tests : <nl> js : tbl . orderBy ( { ' index ' : ' mi ' } ) . map ( function ( x ) { return x ( ' id ' ) ; } ) <nl> ot : ( [ 0 , 0 , 0 , 1 , 1 , 1 , 2 , 3 , 3 , 3 , 4 , 4 , 4 ] ) <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' sindexapi ' ) <nl> mmm a / test / rql_test / src / sindex / status . yaml <nl> ppp b / test / rql_test / src / sindex / status . yaml <nl> <nl> desc : sindex status <nl> + table_variable_name : tbl2 <nl> tests : <nl> <nl> # Index status tests . These are separate because they require much bigger <nl> # tables and it would just be a pain to keep them together . <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' sindex_status ' ) <nl> - def : tbl2 = r . table ( ' sindex_status ' ) <nl> - <nl> - def : rows = [ { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , <nl> { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , <nl> { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , { } , <nl> tests : <nl> - cd : tbl2 . index_wait ( " quux " ) . nth ( 0 ) . get_field ( ' function ' ) . type_of ( ) <nl> ot : ( " PTYPE < BINARY > " ) <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' sindex_status ' ) <nl> mmm a / test / rql_test / src / sindex / truncation . yaml <nl> ppp b / test / rql_test / src / sindex / truncation . yaml <nl> <nl> desc : sindex truncation tests <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - rb : r . table_create ( ' sindex_truncation ' ) <nl> - ot : ( { ' created ' = > 1 } ) <nl> - <nl> - - def : tbl = r . table ( ' sindex_truncation ' ) <nl> - <nl> - rb : tbl . index_create ( ' a ' ) <nl> ot : ( { ' created ' = > 1 } ) <nl> - rb : tbl . index_create ( ' idi ' ) { | row | row [ ' id ' ] } <nl> mmm a / test / rql_test / src / times / api . yaml <nl> ppp b / test / rql_test / src / times / api . yaml <nl> <nl> - desc : sindex api ( # 602 ) <nl> + desc : date / time api ( # 977 ) <nl> tests : <nl> <nl> # Type shims - - see shim . yaml <nl> mmm a / test / rql_test / src / times / index . yaml <nl> ppp b / test / rql_test / src / times / index . yaml <nl> <nl> - desc : sindex api ( # 602 ) <nl> + desc : secondary indexes on times <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> - - cd : r . db ( ' test ' ) . table_create ( ' times_api ' ) <nl> - def : tbl = r . table ( ' times_api ' ) <nl> - <nl> - def : <nl> rb : ts = { " timezone " = > " - 07 : 00 " , " epoch_time " = > 1375445162 . 0872 , " $ reql_type $ " = > " TIME " } <nl> py : ts = { " timezone " : " - 07 : 00 " , " epoch_time " : 1375445162 . 0872 , " $ reql_type $ " : " TIME " } <nl> tests : <nl> js : tbl . get ( oldtime ) ( ' id ' ) . typeOf ( ) <nl> ot : ( " PTYPE < TIME > " ) <nl> <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' times_api ' ) <nl> mmm a / test / rql_test / src / transformation . yaml <nl> ppp b / test / rql_test / src / transformation . yaml <nl> <nl> desc : Tests that manipulation data in tables <nl> + table_variable_name : tbl <nl> tests : <nl> <nl> # Set up some data <nl> - - cd : r . db ( ' test ' ) . table_create ( ' test1 ' ) <nl> - ot : ( { ' created ' : 1 } ) <nl> - def : tbl = r . db ( ' test ' ) . table ( ' test1 ' ) <nl> - <nl> - cd : r . db ( ' test ' ) . table_create ( ' test2 ' ) <nl> ot : ( { ' created ' : 1 } ) <nl> def : tbl2 = r . db ( ' test ' ) . table ( ' test2 ' ) <nl> tests : <nl> ot : ( { ' id ' : 0 } ) <nl> <nl> # Clean up <nl> - - cd : r . db ( ' test ' ) . table_drop ( ' test1 ' ) <nl> - ot : ( { ' dropped ' : 1 } ) <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test2 ' ) <nl> ot : ( { ' dropped ' : 1 } ) <nl> - cd : r . db ( ' test ' ) . table_drop ( ' test3 ' ) <nl> mmm a / test / rql_test / test - runner <nl> ppp b / test / rql_test / test - runner <nl> <nl> <nl> from __future__ import print_function <nl> <nl> - import atexit , collections , distutils . version , distutils . spawn , optparse , os , re , shutil , signal , stat , string , subprocess , sys , tempfile , time <nl> + import atexit , collections , distutils . version , distutils . spawn , optparse , os , re , shutil , signal , stat , string , subprocess , sys , tempfile , time , traceback <nl> <nl> try : <nl> import yaml <nl> class TestGroup ( object ) : <nl> variableRegex = re . compile ( ' ^ \ s * ( ? P < quoteString > [ \ ' \ " ] * ) \ s * ( ? P < variableName > [ a - zA - Z ] [ \ w \ [ \ ] \ { \ } \ ' \ " ] * ) \ s * = \ s * ( ? P < expression > [ ^ = ] . + ) $ ' ) <nl> <nl> @ classmethod <nl> - def buildYamlTest ( cls , testName , sourceFile , language , outputPath , shards = 0 ) : <nl> + def buildYamlTest ( cls , testName , sourceFile , language , outputPath , shards = 0 , <nl> + useSpecificTable = False ) : <nl> <nl> # - - input validation <nl> <nl> class TestGroup ( object ) : <nl> <nl> outputFile . write ( ' % s = = = = = = = = = = End of common test functions = = = = = = = = = = \ n \ n ' % language . comment ( ) ) <nl> <nl> + # - set up table if necessary <nl> + <nl> + if " table_variable_name " in parsed_data : <nl> + table_name = testName . replace ( " . " , " _ " ) . replace ( " / " , " _ " ) <nl> + table_name + = " _ " <nl> + table_name + = language . display_name . replace ( " " , " _ " ) . replace ( " . " , " _ " ) <nl> + outputFile . write ( " setup_table ( % s , % s ) \ n \ n " % ( <nl> + language . langrepr ( parsed_data [ " table_variable_name " ] ) , <nl> + language . langrepr ( table_name ) ) ) <nl> + else : <nl> + outputFile . write ( " check_no_table_specified ( ) \ n \ n " ) <nl> + <nl> # - add the body of the tests <nl> <nl> for testNumber , test in enumerate ( parsed_data [ ' tests ' ] , start = 0 ) : <nl> def main ( ) : <nl> <nl> parser . add_option ( ' - c ' , ' - - cluster - port ' , dest = ' cluster_port ' , default = None , type = ' int ' , help = ' cluster port of an already - running rethinkdb instance ' ) <nl> parser . add_option ( ' - d ' , ' - - driver - port ' , dest = ' driver_port ' , default = None , type = ' int ' , help = ' driver port of an already - running rethinkdb instance ' ) <nl> + parser . add_option ( ' - t ' , ' - - table ' , dest = ' table ' , default = " no_table_specified " , type = ' string ' , help = ' name of pre - existing table to run queries against . ' ) <nl> <nl> parser . add_option ( ' - v ' , ' - - verbse ' , dest = ' verbose ' , default = False , action = ' store_true ' , help = ' show in - progress messages from tests ' ) <nl> <nl> def main ( ) : <nl> <nl> if options . shards ! = 1 : <nl> parser . error ( ' The - c / - - cluster - port and - d / - - driver - port options can not be used with - s / - - shards ' ) <nl> + else : <nl> + if options . table ! = " no_table_specified " : <nl> + parser . error ( ' If you specify - t / - - table , you must also specify - c / - - cluster - port and - d / - - driver - port ' ) <nl> + <nl> + if options . table ! = " no_table_specified " : <nl> + if options . table . count ( " . " ) ! = 1 : <nl> + parser . error ( ' Parameter to - t / - - table should be of the form db . table ' ) <nl> <nl> # - add filters <nl> <nl> def main ( ) : <nl> TestGroup . buildYamlTest ( test . name , test . path , test . language , executablePath , shards = options . shards - 1 ) <nl> except Exception as e : <nl> failedTests . append ( " % s ( % s ) " % ( test . name , test . language . display_name ) ) <nl> - sys . stderr . write ( " Setup Failure : unable to create test executable for Yaml test % s : \ n % s \ n " % ( test . name , str ( e ) ) ) <nl> + sys . stderr . write ( " Setup Failure : unable to create test executable for Yaml test % s : \ n " % test . name ) <nl> + traceback . print_exc ( ) <nl> continue <nl> <nl> # - start the server <nl> def main ( ) : <nl> <nl> # - - <nl> <nl> - additionalArguments = [ ' UNUSED ' , str ( servers . driver_port ( ) ) , str ( servers . cluster_port ( ) ) , servers . executable ( ) ] <nl> + additionalArguments = [ ' UNUSED ' , str ( servers . driver_port ( ) ) , options . table , str ( servers . cluster_port ( ) ) , servers . executable ( ) ] <nl> <nl> if test . type = = ' test ' : <nl> additionalArguments = [ utils . latest_build_dir ( ) ] <nl>
|
Merge remote - tracking branch ' origin / reql_admin ' into michel_2879_reql_admin
|
rethinkdb/rethinkdb
|
675041979baddb39714923a6b3272fa3b94d944c
|
2014-09-05T04:23:44Z
|
mmm a / admin / . gitignore <nl> ppp b / admin / . gitignore <nl> static / gen <nl> simulation - data . db <nl> * . DS_Store <nl> * . swp <nl> + node_modules <nl> mmm a / admin / Makefile <nl> ppp b / admin / Makefile <nl> <nl> - OVERRIDE_GOALS + = default - goal = web - assets clean = clean - webobj <nl> + OVERRIDE_GOALS + = default - goal = web - assets watch = web - assets - watch <nl> <nl> TOP : = . . <nl> include $ ( TOP ) / Makefile <nl> new file mode 100644 <nl> index 00000000000 . . 3b01e143650 <nl> mmm / dev / null <nl> ppp b / admin / build . mk <nl> <nl> + # # # # Web UI sources <nl> + <nl> + ifeq ( 1 , $ ( USE_PRECOMPILED_WEB_ASSETS ) ) <nl> + <nl> + ALL_WEB_ASSETS : = $ ( WEB_ASSETS_BUILD_DIR ) <nl> + <nl> + $ ( WEB_ASSETS_BUILD_DIR ) : $ ( PRECOMPILED_DIR ) / web | $ ( BUILD_DIR ) / . <nl> + $ P CP <nl> + rm - rf $ @ <nl> + cp - pRP $ < $ @ <nl> + <nl> + else # Don ' t use precompiled assets <nl> + <nl> + GULP : = $ ( TOP ) / admin / node_modules / . bin / gulp <nl> + <nl> + WEB_ASSETS_SRC_FILES : = $ ( shell find $ ( TOP ) / admin - path $ ( TOP ) / admin / node_modules - prune - o - print ) <nl> + <nl> + ALL_WEB_ASSETS : = $ ( BUILD_ROOT_DIR ) / web - assets <nl> + <nl> + $ ( BUILD_ROOT_DIR ) / web - assets : $ ( WEB_ASSETS_SRC_FILES ) $ ( JS_BUILD_DIR ) / rethinkdb . js <nl> + $ P GULP <nl> + $ ( GULP ) build - - cwd $ ( TOP ) / admin $ ( if $ ( filter $ ( VERBOSE ) , 0 ) , - - silent ) <nl> + touch $ @ <nl> + <nl> + . PHONY : web - assets - watch <nl> + web - assets - watch : <nl> + $ ( GULP ) - - cwd $ ( TOP ) / admin <nl> + <nl> + endif # USE_PRECOMPILED_WEB_ASSETS = 1 <nl> + <nl> + . PHONY : web - assets <nl> + web - assets : $ ( ALL_WEB_ASSETS ) <nl> mmm a / mk / main . mk <nl> ppp b / mk / main . mk <nl> include $ ( TOP ) / mk / install . mk <nl> include $ ( TOP ) / drivers / build . mk <nl> <nl> # Build the web assets <nl> - include $ ( TOP ) / mk / webui . mk <nl> + include $ ( TOP ) / admin / build . mk <nl> <nl> # Building the rethinkdb executable <nl> include $ ( TOP ) / src / build . mk <nl> deleted file mode 100644 <nl> index 6072732ffaf . . 00000000000 <nl> mmm a / mk / webui . mk <nl> ppp / dev / null <nl> <nl> - # # # # Web UI sources <nl> - <nl> - . PHONY : $ ( TOP ) / admin / all <nl> - $ ( TOP ) / admin / all : web - assets <nl> - <nl> - . PRECIOUS : $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - <nl> - ifeq ( 1 , $ ( USE_PRECOMPILED_WEB_ASSETS ) ) <nl> - <nl> - ALL_WEB_ASSETS : = $ ( WEB_ASSETS_BUILD_DIR ) <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) : $ ( PRECOMPILED_DIR ) / web | $ ( BUILD_DIR ) / . <nl> - $ P CP <nl> - rm - rf $ @ <nl> - cp - pRP $ < $ @ <nl> - <nl> - else # Don ' t use precompiled assets <nl> - <nl> - WEB_SOURCE_DIR : = $ ( TOP ) / admin <nl> - WEB_ASSETS_OBJ_DIR : = $ ( BUILD_DIR ) / webobj <nl> - WEB_ASSETS_RELATIVE : = cluster - min . js cluster . css index . html js fonts images favicon . ico js / rethinkdb . js js / template . js <nl> - ALL_WEB_ASSETS : = $ ( foreach a , $ ( WEB_ASSETS_RELATIVE ) , $ ( WEB_ASSETS_BUILD_DIR ) / $ ( a ) ) <nl> - <nl> - COFFEE_SOURCE_DIR : = $ ( WEB_SOURCE_DIR ) / static / coffee <nl> - # since we don ' t use requirejs or anything , we list out the dependencies here explicitly in order <nl> - # rather than populating COFFEE_SOURCES with ` find ` or the like <nl> - COFFEE_SOURCES : = $ ( patsubst % , $ ( COFFEE_SOURCE_DIR ) / % , \ <nl> - util . coffee \ <nl> - body . coffee \ <nl> - ui_components / modals . coffee ui_components / progressbar . coffee \ <nl> - tables / index . coffee tables / shard_distribution . coffee tables / shard_assignments . coffee tables / table . coffee \ <nl> - servers / index . coffee servers / server . coffee \ <nl> - dashboard . coffee \ <nl> - dataexplorer . coffee \ <nl> - topbar . coffee \ <nl> - resolve_issues . coffee \ <nl> - log_view . coffee \ <nl> - vis . coffee \ <nl> - modals . coffee \ <nl> - models . coffee \ <nl> - navbar . coffee \ <nl> - router . coffee \ <nl> - app . coffee ) <nl> - COFFEE_COMPILED_JS : = $ ( patsubst $ ( COFFEE_SOURCE_DIR ) / % . coffee , $ ( WEB_ASSETS_OBJ_DIR ) / % . js , $ ( COFFEE_SOURCES ) ) <nl> - JS_VERSION_FILE : = $ ( WEB_ASSETS_OBJ_DIR ) / version . js <nl> - LESS_SOURCES : = $ ( shell find $ ( WEB_SOURCE_DIR ) / static / less - name ' * . less ' ) <nl> - LESS_MAIN : = $ ( WEB_SOURCE_DIR ) / static / less / styles . less <nl> - CLUSTER_HTML : = $ ( WEB_SOURCE_DIR ) / templates / cluster . html <nl> - JS_EXTERNAL_DIR : = $ ( WEB_SOURCE_DIR ) / static / js <nl> - FONTS_EXTERNAL_DIR : = $ ( WEB_SOURCE_DIR ) / static / fonts <nl> - IMAGES_EXTERNAL_DIR : = $ ( WEB_SOURCE_DIR ) / static / images <nl> - FAVICON : = $ ( WEB_SOURCE_DIR ) / favicon . ico <nl> - <nl> - <nl> - HANDLEBARS_SOURCE_DIR : = $ ( WEB_SOURCE_DIR ) / static / handlebars <nl> - HANDLEBARS_OBJ_DIR : = $ ( WEB_ASSETS_OBJ_DIR ) / handlebars <nl> - HANDLEBARS_SOURCES : = $ ( shell find $ ( HANDLEBARS_SOURCE_DIR ) - name \ * . handlebars ) <nl> - HANDLEBARS_FUNCTIONS : = $ ( patsubst $ ( HANDLEBARS_SOURCE_DIR ) / % . handlebars , $ ( HANDLEBARS_OBJ_DIR ) / % . js , $ ( HANDLEBARS_SOURCES ) ) <nl> - # handlebars optimizes the templates a bit if it knows these helpers are available . Not adding new helpers to this <nl> - # variable isn ' t catastrophic , just a tiny bit slower on re - renders <nl> - HANDLEBARS_KNOWN_HELPERS : = if unless each capitalize pluralize - noun humanize_uuid comma_separated links_to_machines \ <nl> - comma_separated_simple pluralize_verb pluralize_verb_to_have <nl> - <nl> - . PHONY : web - assets <nl> - web - assets : $ ( ALL_WEB_ASSETS ) <nl> - <nl> - . PHONY : clean - webobj <nl> - clean - webobj : <nl> - rm - rf $ ( WEB_ASSETS_OBJ_DIR ) <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / js / rethinkdb . js : $ ( JS_BUILD_DIR ) / rethinkdb . js | $ ( WEB_ASSETS_BUILD_DIR ) / js / . <nl> - $ P CP <nl> - cp - pRP $ < $ @ <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / js / template . js : $ ( HANDLEBARS_FUNCTIONS ) <nl> - $ P CONCAT $ @ <nl> - cat $ ^ > $ @ <nl> - <nl> - $ ( HANDLEBARS_OBJ_DIR ) / % . js : $ ( HANDLEBARS_SOURCE_DIR ) / % . handlebars | $ ( WEB_ASSETS_OBJ_DIR ) / . $ ( HANDLEBARS_BIN_DEP ) <nl> - $ P HANDLEBARS $ ( @ F ) <nl> - mkdir - p $ ( @ D ) <nl> - $ ( HANDLEBARS ) - m $ ( addprefix - k , $ ( HANDLEBARS_KNOWN_HELPERS ) ) $ ^ > $ @ <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / cluster - min . js : $ ( JS_VERSION_FILE ) $ ( COFFEE_COMPILED_JS ) | $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - $ P CONCAT $ @ <nl> - cat $ + > $ @ <nl> - <nl> - $ ( JS_VERSION_FILE ) : | $ ( WEB_ASSETS_OBJ_DIR ) / . <nl> - echo " window . VERSION = ' $ ( RETHINKDB_VERSION ) ' ; " > $ @ <nl> - <nl> - $ ( WEB_ASSETS_OBJ_DIR ) / % . js : $ ( COFFEE_SOURCE_DIR ) / % . coffee $ ( COFFEE_BIN_DEP ) | $ ( WEB_ASSETS_OBJ_DIR ) / . <nl> - $ P COFFEE $ @ <nl> - mkdir - p $ ( @ D ) <nl> - $ ( COFFEE ) - - bare - - print - - stdio < $ < > $ @ <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / cluster . css : $ ( LESS_MAIN ) $ ( LESS_SOURCES ) $ ( LESSC_BIN_DEP ) | $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - $ P LESSC $ @ <nl> - $ ( LESSC ) $ ( LESS_MAIN ) > $ @ <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / index . html : $ ( CLUSTER_HTML ) | $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - $ P SED <nl> - sed " s / { RETHINKDB_VERSION } / $ ( RETHINKDB_VERSION ) / " $ ( CLUSTER_HTML ) > $ @ <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / js : | $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - $ P CP $ ( JS_EXTERNAL_DIR ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - cp - RP $ ( JS_EXTERNAL_DIR ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / fonts : | $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - $ P CP $ ( FONTS_EXTERNAL_DIR ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - cp - RP $ ( FONTS_EXTERNAL_DIR ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / images : | $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - $ P CP $ ( IMAGES_EXTERNAL_DIR ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - cp - RP $ ( IMAGES_EXTERNAL_DIR ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - <nl> - $ ( WEB_ASSETS_BUILD_DIR ) / favicon . ico : $ ( FAVICON ) | $ ( WEB_ASSETS_BUILD_DIR ) / . <nl> - $ P CP $ ( FAVICON ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - cp - P $ ( FAVICON ) $ ( WEB_ASSETS_BUILD_DIR ) <nl> - <nl> - endif # USE_PRECOMPILED_WEB_ASSETS = 1 <nl> mmm a / scripts / compile - web - assets . py <nl> ppp b / scripts / compile - web - assets . py <nl> def write_assets ( asset_root , assets ) : <nl> <nl> if position ! = 0 : <nl> print ( ' " ' , end = ' ' ) <nl> + <nl> + if not data : <nl> + print ( ' " " ' , end = ' ' ) <nl> + <nl> print ( ' , ' ) <nl> print ( ' ' + str ( len ( data ) ) + ' } } , ' ) <nl> <nl>
|
Integrate gulp with make
|
rethinkdb/rethinkdb
|
39580912801405ca832e58d459258fd3f41041e1
|
2015-03-12T01:13:53Z
|
mmm a / folly / concurrency / UnboundedQueue . h <nl> ppp b / folly / concurrency / UnboundedQueue . h <nl> class UnboundedQueue { <nl> static_assert ( LgSegmentSize < 32 , " LgSegmentSize must be < 32 " ) ; <nl> static_assert ( LgAlign < 16 , " LgAlign must be < 16 " ) ; <nl> <nl> - FOLLY_ALIGNED ( Align ) <nl> - Atom < Segment * > head_ ; <nl> + alignas ( Align ) Atom < Segment * > head_ ; <nl> Atom < Ticket > consumerTicket_ ; <nl> - FOLLY_ALIGNED ( Align ) <nl> - Atom < Segment * > tail_ ; <nl> + alignas ( Align ) Atom < Segment * > tail_ ; <nl> Atom < Ticket > producerTicket_ ; <nl> <nl> public : <nl>
|
UnboundedQueue : Use alignas instead of FOLLY_ALIGNED
|
facebook/folly
|
d5b67c256c7423d74f4794d7fe421ed239807be4
|
2017-12-14T03:14:00Z
|
mmm a / lib / Parse / ParsePattern . cpp <nl> ppp b / lib / Parse / ParsePattern . cpp <nl> mapParsedParameters ( Parser & parser , <nl> auto & ctx = parser . Context ; <nl> <nl> / / Local function to create a pattern for a single parameter . <nl> - auto createParam = [ & ] ( SourceLoc & letVarInOutLoc , <nl> - Parser : : ParsedParameter : : SpecifierKindTy & specifierKind , <nl> - Identifier argName , SourceLoc argNameLoc , <nl> - Identifier paramName , SourceLoc paramNameLoc , <nl> - TypeRepr * type , <nl> - const DeclAttributes & Attrs ) - > ParamDecl * { <nl> + auto createParam = [ & ] ( Parser : : ParsedParameter & paramInfo , <nl> + Identifier argName , SourceLoc argNameLoc , <nl> + Identifier paramName , SourceLoc paramNameLoc ) <nl> + - > ParamDecl * { <nl> + auto specifierKind = paramInfo . SpecifierKind ; <nl> bool isLet = specifierKind = = Parser : : ParsedParameter : : Let ; <nl> auto param = new ( ctx ) ParamDecl ( isLet , argNameLoc , argName , <nl> paramNameLoc , paramName , Type ( ) , <nl> parser . CurDeclContext ) ; <nl> - param - > getAttrs ( ) = Attrs ; <nl> + param - > getAttrs ( ) = paramInfo . Attrs ; <nl> <nl> if ( argNameLoc . isInvalid ( ) & & paramNameLoc . isInvalid ( ) ) <nl> param - > setImplicit ( ) ; <nl> <nl> - / / If a type was provided , create the typed pattern . <nl> - if ( type ) { <nl> + / / If a type was provided , create the type for the parameter . <nl> + if ( auto type = paramInfo . Type ) { <nl> / / If ' inout ' was specified , turn the type into an in - out type . <nl> if ( specifierKind = = Parser : : ParsedParameter : : InOut ) <nl> - type = new ( ctx ) InOutTypeRepr ( type , letVarInOutLoc ) ; <nl> + type = new ( ctx ) InOutTypeRepr ( type , paramInfo . LetVarInOutLoc ) ; <nl> <nl> param - > getTypeLoc ( ) = TypeLoc ( type ) ; <nl> } else if ( specifierKind = = Parser : : ParsedParameter : : InOut ) { <nl> - parser . diagnose ( letVarInOutLoc , diag : : inout_must_have_type ) ; <nl> - letVarInOutLoc = SourceLoc ( ) ; <nl> + parser . diagnose ( paramInfo . LetVarInOutLoc , diag : : inout_must_have_type ) ; <nl> + paramInfo . LetVarInOutLoc = SourceLoc ( ) ; <nl> specifierKind = Parser : : ParsedParameter : : Let ; <nl> } <nl> return param ; <nl> mapParsedParameters ( Parser & parser , <nl> paramName = param . SecondName ; <nl> <nl> / / Both names were provided , so pass them in directly . <nl> - result = createParam ( param . LetVarInOutLoc , param . SpecifierKind , <nl> - argName , param . FirstNameLoc , <nl> - paramName , param . SecondNameLoc , <nl> - param . Type , param . Attrs ) ; <nl> + result = createParam ( param , argName , param . FirstNameLoc , <nl> + paramName , param . SecondNameLoc ) ; <nl> <nl> / / If the first name is empty and this parameter would not have been <nl> / / an API name by default , complain . <nl> mapParsedParameters ( Parser & parser , <nl> argName = param . FirstName ; <nl> paramName = param . FirstName ; <nl> <nl> - result = createParam ( param . LetVarInOutLoc , param . SpecifierKind , <nl> - argName , SourceLoc ( ) , <nl> - param . FirstName , param . FirstNameLoc , <nl> - param . Type , param . Attrs ) ; <nl> + result = createParam ( param , argName , SourceLoc ( ) , <nl> + param . FirstName , param . FirstNameLoc ) ; <nl> } <nl> <nl> / / If this parameter had an ellipsis , check whether it ' s the last parameter . <nl>
|
Simplify mapParsedParameters / createParam by passing the ParsedParameter
|
apple/swift
|
73ec7006ee0b97c0f88e8e2affbaeab7a91c8f8e
|
2016-01-18T17:03:58Z
|
mmm a / docs - translations / ko - KR / api / native - image . md <nl> ppp b / docs - translations / ko - KR / api / native - image . md <nl> Returns ` Object ` : <nl> <nl> Returns ` Boolean ` - 이미지가 템플릿 이미지인지 여부 . <nl> <nl> + # # # # ` image . crop ( rect ) ` <nl> + <nl> + * ` rect ` Object - 잘라내기 위한 이미지 영역 <nl> + * ` x ` Integer <nl> + * ` y ` Integer <nl> + * ` width ` Integer <nl> + * ` height ` Integer <nl> + <nl> + Returns ` NativeImage ` - 잘라낸 이미지 . <nl> + <nl> + # # # # ` image . resize ( options ) ` <nl> + <nl> + * ` options ` Object <nl> + * ` width ` Integer ( optional ) <nl> + * ` height ` Integer ( optional ) <nl> + * ` quality ` String ( optional ) - 크기 변경된 이미지의 원하는 품질 . <nl> + 가능한 값은 ` good ` , ` better ` , ` best ` 이며 , 기본값은 ` best ` 입니다 . <nl> + 이 값은 원하는 품질 / 속도 균형을 표현합니다 . 이것은 기본이되는 플랫폼의 성능 <nl> + ( CPU , GPU ) 에 의존하는 알고리즘에 특정 방법으로 변환됩니다 . 주어진 <nl> + 플랫폼에서 세가지 방법이 모두 같은 알고리즘에 매핑될 수 있습니다 . <nl> + <nl> + Returns ` NativeImage ` - 크기 변경된 이미지 . <nl> + <nl> + ` height ` 또는 ` width ` 하나만 명시한다면 크기가 변경된 이미지에서도 종횡비가 <nl> + 유지될 것 입니다 . <nl> + <nl> + # # # # ` image . getAspectRatio ( ) ` <nl> + <nl> + Returns ` Float ` - 이미지의 종횡비 . <nl> + <nl> [ buffer ] : https : / / nodejs . org / api / buffer . html # buffer_class_buffer <nl> mmm a / docs - translations / ko - KR / api / web - contents . md <nl> ppp b / docs - translations / ko - KR / api / web - contents . md <nl> Returns : <nl> 기본값으로 ` BrowserWindow ` 는 ` url ` 을 기반으로 생성됩니다 . <nl> <nl> ` event . preventDefault ( ) ` 를 호출하면 새로운 창이 생성되는 것을 방지할 수 <nl> - 있습니다 . 이러한 경우에 , the ` event . newGuest ` may be set with a reference to a ` BrowserWindow ` instance to make it used by the Electron ' s runtime . <nl> + 있습니다 . 이 경우 , ` event . newGuest ` 는 Electron 의 런타임에 의해 사용할 수 있게 <nl> + ` BrowserWindow ` 인스턴스에 대한 참조를 설정할 수 있습니다 . <nl> <nl> # # # # Event : ' will - navigate ' <nl> <nl>
|
Update ko docs
|
electron/electron
|
116dbc058190138171065d1544457a09ad1c0c2f
|
2016-10-06T14:53:57Z
|
mmm a / extensions / physics - nodes / CCPhysicsSprite . cpp <nl> ppp b / extensions / physics - nodes / CCPhysicsSprite . cpp <nl> <nl> <nl> # include " CCPhysicsSprite . h " <nl> <nl> + # if CC_USE_PHYSICS <nl> + <nl> # if ( CC_ENABLE_CHIPMUNK_INTEGRATION & & CC_ENABLE_BOX2D_INTEGRATION ) <nl> # error " Either Chipmunk or Box2d should be enabled , but not both at the same time " <nl> # endif <nl> void PhysicsSprite : : draw ( Renderer * renderer , const Mat4 & transform , uint32_t fla <nl> } <nl> <nl> NS_CC_EXT_END <nl> + <nl> + # endif / / CC_USE_PHYSICS <nl> mmm a / extensions / physics - nodes / CCPhysicsSprite . h <nl> ppp b / extensions / physics - nodes / CCPhysicsSprite . h <nl> <nl> # ifndef __PHYSICSNODES_CCPHYSICSSPRITE_H__ <nl> # define __PHYSICSNODES_CCPHYSICSSPRITE_H__ <nl> <nl> + # include " base / ccConfig . h " <nl> + # if CC_USE_PHYSICS <nl> + <nl> # include " 2d / CCSprite . h " <nl> # include " extensions / ExtensionMacros . h " <nl> # include " extensions / ExtensionExport . h " <nl> class CC_EX_DLL PhysicsSprite : public Sprite <nl> <nl> NS_CC_EXT_END <nl> <nl> + # endif / / CC_USE_PHYSICS <nl> + <nl> # endif / / __PHYSICSNODES_CCPHYSICSSPRITE_H__ <nl>
|
Fixed compile error when I turned off physics definitions .
|
cocos2d/cocos2d-x
|
c527d7476bc1045f29a3ea5ba19805cb3715ff47
|
2014-09-18T16:35:01Z
|
mmm a / plugins / net_plugin / net_plugin . cpp <nl> ppp b / plugins / net_plugin / net_plugin . cpp <nl> namespace eosio { <nl> <nl> size_t cache_txn ( const transaction_id_type , const signed_transaction & txn ) ; <nl> <nl> + bool is_valid ( const handshake_message & msg ) ; <nl> + <nl> void handle_message ( connection_ptr c , const handshake_message & msg ) ; <nl> void handle_message ( connection_ptr c , const go_away_message & msg ) ; <nl> / * * \ name Peer Timestamps <nl> namespace eosio { <nl> <nl> class connection : public std : : enable_shared_from_this < connection > { <nl> public : <nl> - connection ( string endpoint , <nl> - size_t send_buf_size = def_send_buffer_size ) ; <nl> + explicit connection ( string endpoint ) ; <nl> <nl> - connection ( socket_ptr s , <nl> - size_t send_buf_size = def_send_buffer_size ) ; <nl> + explicit connection ( socket_ptr s ) ; <nl> ~ connection ( ) ; <nl> void initialize ( ) ; <nl> <nl> namespace eosio { <nl> socket_ptr socket ; <nl> <nl> message_buffer < 1024 * 1024 > pending_message_buffer ; <nl> - vector < char > send_buffer ; <nl> vector < char > blk_buffer ; <nl> <nl> deque < transaction_id_type > txn_queue ; <nl> namespace eosio { <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> <nl> - connection : : connection ( string endpoint , <nl> - size_t send_buf_size ) <nl> + connection : : connection ( string endpoint ) <nl> : block_state ( ) , <nl> trx_state ( ) , <nl> sync_receiving ( ) , <nl> sync_requested ( ) , <nl> socket ( std : : make_shared < tcp : : socket > ( std : : ref ( app ( ) . get_io_service ( ) ) ) ) , <nl> - send_buffer ( send_buf_size ) , <nl> node_id ( ) , <nl> last_handshake_recv ( ) , <nl> last_handshake_sent ( ) , <nl> namespace eosio { <nl> initialize ( ) ; <nl> } <nl> <nl> - connection : : connection ( socket_ptr s , <nl> - size_t send_buf_size ) <nl> + connection : : connection ( socket_ptr s ) <nl> : block_state ( ) , <nl> trx_state ( ) , <nl> sync_receiving ( ) , <nl> sync_requested ( ) , <nl> socket ( s ) , <nl> - send_buffer ( send_buf_size ) , <nl> node_id ( ) , <nl> last_handshake_recv ( ) , <nl> last_handshake_sent ( ) , <nl> namespace eosio { <nl> <nl> size_t buffer_size = header_size + payload_size ; <nl> <nl> - fc : : datastream < char * > ds ( send_buffer . data ( ) , buffer_size ) ; <nl> + auto send_buffer = std : : make_shared < vector < char > > ( buffer_size ) ; <nl> + fc : : datastream < char * > ds ( send_buffer - > data ( ) , buffer_size ) ; <nl> ds . write ( header , header_size ) ; <nl> fc : : raw : : pack ( ds , m ) ; <nl> <nl> write_depth + + ; <nl> - queue_write ( std : : make_shared < vector < char > > ( send_buffer . begin ( ) , send_buffer . begin ( ) + buffer_size ) , <nl> + queue_write ( send_buffer , <nl> [ this ] ( boost : : system : : error_code ec , std : : size_t ) { <nl> write_depth - - ; <nl> if ( out_queue . size ( ) ) { <nl> namespace eosio { <nl> } <nl> } <nl> <nl> + bool net_plugin_impl : : is_valid ( const handshake_message & msg ) { <nl> + / / Do some basic validation of an incoming handshake_message , so things <nl> + / / that really aren ' t handshake messages can be quickly discarded without <nl> + / / affecting state . <nl> + bool valid = true ; <nl> + if ( msg . last_irreversible_block_num > msg . head_num ) { <nl> + wlog ( " Handshake message validation : last irreversible block ( $ { i } ) is greater than head block ( $ { h } ) " , <nl> + ( " i " , msg . last_irreversible_block_num ) ( " h " , msg . head_num ) ) ; <nl> + valid = false ; <nl> + } <nl> + if ( msg . p2p_address . empty ( ) ) { <nl> + wlog ( " Handshake message validation : p2p_address is null string " ) ; <nl> + valid = false ; <nl> + } <nl> + if ( msg . os . empty ( ) ) { <nl> + wlog ( " Handshake message validation : os field is null string " ) ; <nl> + valid = false ; <nl> + } <nl> + if ( ( msg . sig ! = chain : : signature_type ( ) | | msg . token ! = sha256 ( ) ) & & ( msg . token ! = fc : : sha256 : : hash ( msg . time ) ) ) { <nl> + wlog ( " Handshake message validation : token field invalid " ) ; <nl> + valid = false ; <nl> + } <nl> + return valid ; <nl> + } <nl> + <nl> void net_plugin_impl : : handle_message ( connection_ptr c , const handshake_message & msg ) { <nl> ilog ( " got a handshake_message from $ { p } $ { h } " , ( " p " , c - > peer_addr ) ( " h " , msg . p2p_address ) ) ; <nl> + if ( ! is_valid ( msg ) ) { <nl> + elog ( " Invalid handshake message received from $ { p } $ { h } " , ( " p " , c - > peer_addr ) ( " h " , msg . p2p_address ) ) ; <nl> + c - > enqueue ( go_away_message ( fatal_other ) ) ; <nl> + return ; <nl> + } <nl> chain_controller & cc = chain_plug - > chain ( ) ; <nl> uint32_t lib_num = cc . last_irreversible_block_num ( ) ; <nl> uint32_t peer_lib = msg . last_irreversible_block_num ; <nl>
|
Merge pull request from EOSIO / DAWN - 529 - master - Invalid - Handshake - Message
|
EOSIO/eos
|
6c6d10758b2efcf940c18bb26d18a6fd24ad588e
|
2018-02-01T12:29:32Z
|
mmm a / src / core / hw / gpu . cpp <nl> ppp b / src / core / hw / gpu . cpp <nl> MICROPROFILE_DEFINE ( GPU_DisplayTransfer , " GPU " , " DisplayTransfer " , MP_RGB ( 100 , 1 <nl> MICROPROFILE_DEFINE ( GPU_CmdlistProcessing , " GPU " , " Cmdlist Processing " , MP_RGB ( 100 , 255 , 100 ) ) ; <nl> <nl> static void MemoryFill ( const Regs : : MemoryFillConfig & config ) { <nl> - u8 * start = Memory : : GetPhysicalPointer ( config . GetStartAddress ( ) ) ; <nl> - u8 * end = Memory : : GetPhysicalPointer ( config . GetEndAddress ( ) ) ; <nl> + const PAddr start_addr = config . GetStartAddress ( ) ; <nl> + const PAddr end_addr = config . GetEndAddress ( ) ; <nl> + <nl> + / / TODO : do hwtest with these cases <nl> + if ( ! Memory : : IsValidPhysicalAddress ( start_addr ) ) { <nl> + LOG_CRITICAL ( HW_GPU , " invalid start address 0x % 08X " , start_addr ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( ! Memory : : IsValidPhysicalAddress ( end_addr ) ) { <nl> + LOG_CRITICAL ( HW_GPU , " invalid end address 0x % 08X " , end_addr ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( end_addr < = start_addr ) { <nl> + LOG_CRITICAL ( HW_GPU , " invalid memory range from 0x % 08X to 0x % 08X " , start_addr , end_addr ) ; <nl> + return ; <nl> + } <nl> + <nl> + u8 * start = Memory : : GetPhysicalPointer ( start_addr ) ; <nl> + u8 * end = Memory : : GetPhysicalPointer ( end_addr ) ; <nl> <nl> / / TODO : Consider always accelerating and returning vector of <nl> / / regions that the accelerated fill did not cover to <nl> static void MemoryFill ( const Regs : : MemoryFillConfig & config ) { <nl> } <nl> <nl> static void DisplayTransfer ( const Regs : : DisplayTransferConfig & config ) { <nl> + const PAddr src_addr = config . GetPhysicalInputAddress ( ) ; <nl> + const PAddr dst_addr = config . GetPhysicalOutputAddress ( ) ; <nl> + <nl> + / / TODO : do hwtest with these cases <nl> + if ( ! Memory : : IsValidPhysicalAddress ( src_addr ) ) { <nl> + LOG_CRITICAL ( HW_GPU , " invalid input address 0x % 08X " , src_addr ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( ! Memory : : IsValidPhysicalAddress ( dst_addr ) ) { <nl> + LOG_CRITICAL ( HW_GPU , " invalid output address 0x % 08X " , dst_addr ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( config . input_width = = 0 ) { <nl> + LOG_CRITICAL ( HW_GPU , " zero input width " ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( config . input_height = = 0 ) { <nl> + LOG_CRITICAL ( HW_GPU , " zero input height " ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( config . output_width = = 0 ) { <nl> + LOG_CRITICAL ( HW_GPU , " zero output width " ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( config . output_height = = 0 ) { <nl> + LOG_CRITICAL ( HW_GPU , " zero output height " ) ; <nl> + return ; <nl> + } <nl> + <nl> if ( VideoCore : : g_renderer - > Rasterizer ( ) - > AccelerateDisplayTransfer ( config ) ) <nl> return ; <nl> <nl> - u8 * src_pointer = Memory : : GetPhysicalPointer ( config . GetPhysicalInputAddress ( ) ) ; <nl> - u8 * dst_pointer = Memory : : GetPhysicalPointer ( config . GetPhysicalOutputAddress ( ) ) ; <nl> + u8 * src_pointer = Memory : : GetPhysicalPointer ( src_addr ) ; <nl> + u8 * dst_pointer = Memory : : GetPhysicalPointer ( dst_addr ) ; <nl> <nl> if ( config . scaling > config . ScaleXY ) { <nl> LOG_CRITICAL ( HW_GPU , " Unimplemented display transfer scaling mode % u " , <nl> static void DisplayTransfer ( const Regs : : DisplayTransferConfig & config ) { <nl> } <nl> <nl> static void TextureCopy ( const Regs : : DisplayTransferConfig & config ) { <nl> + const PAddr src_addr = config . GetPhysicalInputAddress ( ) ; <nl> + const PAddr dst_addr = config . GetPhysicalOutputAddress ( ) ; <nl> + <nl> + / / TODO : do hwtest with these cases <nl> + if ( ! Memory : : IsValidPhysicalAddress ( src_addr ) ) { <nl> + LOG_CRITICAL ( HW_GPU , " invalid input address 0x % 08X " , src_addr ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( ! Memory : : IsValidPhysicalAddress ( dst_addr ) ) { <nl> + LOG_CRITICAL ( HW_GPU , " invalid output address 0x % 08X " , dst_addr ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( config . texture_copy . input_width = = 0 ) { <nl> + LOG_CRITICAL ( HW_GPU , " zero input width " ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( config . texture_copy . output_width = = 0 ) { <nl> + LOG_CRITICAL ( HW_GPU , " zero output width " ) ; <nl> + return ; <nl> + } <nl> + <nl> + if ( config . texture_copy . size = = 0 ) { <nl> + LOG_CRITICAL ( HW_GPU , " zero size " ) ; <nl> + return ; <nl> + } <nl> + <nl> if ( VideoCore : : g_renderer - > Rasterizer ( ) - > AccelerateTextureCopy ( config ) ) <nl> return ; <nl> <nl> - u8 * src_pointer = Memory : : GetPhysicalPointer ( config . GetPhysicalInputAddress ( ) ) ; <nl> - u8 * dst_pointer = Memory : : GetPhysicalPointer ( config . GetPhysicalOutputAddress ( ) ) ; <nl> + u8 * src_pointer = Memory : : GetPhysicalPointer ( src_addr ) ; <nl> + u8 * dst_pointer = Memory : : GetPhysicalPointer ( dst_addr ) ; <nl> <nl> u32 input_width = config . texture_copy . input_width * 16 ; <nl> u32 input_gap = config . texture_copy . input_gap * 16 ; <nl>
|
gpu : add validity check for TextureCopy , DisplayTransfer and FillMemory
|
yuzu-emu/yuzu
|
48470e57fc52f7883d825675e4410fb4fe735643
|
2016-09-29T02:01:34Z
|
mmm a / utils / prepare - environment / install - gcc . sh <nl> ppp b / utils / prepare - environment / install - gcc . sh <nl> sudo ln - sf / usr / local / bin / g + + / usr / local / bin / g + + - $ { VERSION_SHORT } <nl> sudo ln - sf / usr / local / bin / gcc / usr / local / bin / cc <nl> sudo ln - sf / usr / local / bin / g + + / usr / local / bin / c + + <nl> <nl> - echo " / usr / local / lib64 " | sudo tee / etc / ld . so . conf . d / local - lib64 . conf <nl> + echo " / usr / local / lib64 " | sudo tee / etc / ld . so . conf . d / 10_local - lib64 . conf <nl> + sudo ldconfig <nl> <nl> hash gcc g + + <nl> gcc - - version <nl>
|
Updated instruction [ # CLICKHOUSE - 2 ] .
|
ClickHouse/ClickHouse
|
35aec21756513573bfcc8b07de810fe5047ae35f
|
2017-11-14T19:46:11Z
|
mmm a / c10 / core / ScalarType . h <nl> ppp b / c10 / core / ScalarType . h <nl> static inline ScalarType promoteTypes ( ScalarType a , ScalarType b ) { <nl> / * i2 * / { i2 , i2 , i2 , i4 , i8 , f2 , f4 , f8 , ud , c4 , c8 , i2 , ud , ud , ud , bf } , <nl> / * i4 * / { i4 , i4 , i4 , i4 , i8 , f2 , f4 , f8 , ud , c4 , c8 , i4 , ud , ud , ud , bf } , <nl> / * i8 * / { i8 , i8 , i8 , i8 , i8 , f2 , f4 , f8 , ud , c4 , c8 , i8 , ud , ud , ud , bf } , <nl> - / * f2 * / { f2 , f2 , f2 , f2 , f2 , f2 , f4 , f8 , ud , c4 , c8 , f2 , ud , ud , ud , ud } , <nl> + / * f2 * / { f2 , f2 , f2 , f2 , f2 , f2 , f4 , f8 , ud , c4 , c8 , f2 , ud , ud , ud , f4 } , <nl> / * f4 * / { f4 , f4 , f4 , f4 , f4 , f4 , f4 , f8 , ud , c4 , c8 , f4 , ud , ud , ud , f4 } , <nl> / * f8 * / { f8 , f8 , f8 , f8 , f8 , f8 , f8 , f8 , ud , c8 , c8 , f8 , ud , ud , ud , f8 } , <nl> / * c2 * / { ud , ud , ud , ud , ud , ud , ud , ud , c2 , c4 , c8 , ud , ud , ud , ud , ud } , <nl> - / * c4 * / { c4 , c4 , c4 , c4 , c4 , c4 , c4 , c8 , c4 , c4 , c8 , c4 , ud , ud , ud , ud } , <nl> - / * c8 * / { c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , ud , ud , ud , ud } , <nl> + / * c4 * / { c4 , c4 , c4 , c4 , c4 , c4 , c4 , c8 , c4 , c4 , c8 , c4 , ud , ud , ud , c4 } , <nl> + / * c8 * / { c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , c8 , ud , ud , ud , c8 } , <nl> / * b1 * / { u1 , i1 , i2 , i4 , i8 , f2 , f4 , f8 , ud , c4 , c8 , b1 , ud , ud , ud , bf } , <nl> / * q1 * / { ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud } , <nl> / * q2 * / { ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud } , <nl> / * q3 * / { ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud , ud } , <nl> - / * bf * / { bf , bf , bf , bf , bf , ud , f4 , f8 , ud , ud , ud , bf , ud , ud , ud , bf } , <nl> + / * bf * / { bf , bf , bf , bf , bf , f4 , f4 , f8 , ud , c4 , c8 , bf , ud , ud , ud , bf } , <nl> } ; <nl> return _promoteTypesLookup [ static_cast < int > ( a ) ] [ static_cast < int > ( b ) ] ; <nl> } <nl> mmm a / test / test_torch . py <nl> ppp b / test / test_torch . py <nl> def _test_logical ( self , device , op , a_ , b_ , expected_res_ ) : <nl> for other_dtype in torch . testing . get_all_dtypes ( ) : <nl> b = torch . tensor ( b_ , dtype = other_dtype , device = device ) <nl> <nl> - # TODO Remove this skipping after bfloat16 can be handled nicely with other dtypes . <nl> - # Skip only if either dtype or other_dtype is bfloat16 , and promotion is unsupported . <nl> - if ( dtype = = torch . bfloat16 ) ! = ( other_dtype = = torch . bfloat16 ) : <nl> - non_bfloat16_dtype = dtype if dtype ! = torch . bfloat16 else other_dtype <nl> - if non_bfloat16_dtype . is_complex or non_bfloat16_dtype = = torch . float16 : <nl> - with self . assertRaises ( RuntimeError ) : <nl> - getattr ( a , op ) ( b ) <nl> - continue <nl> - <nl> # Skip bfloat16 on CUDA . Remove this after bfloat16 is supported on CUDA . <nl> # After type promotion of bfloat16 is supported , some bfloat16 logical operation will go through on <nl> # CUDA as long as the two tensors are promoted to a supported type . <nl> mmm a / test / test_type_promotion . py <nl> ppp b / test / test_type_promotion . py <nl> def test_bfloat16 ( self , device ) : <nl> bf = torch . tensor ( 5 . 5 , dtype = torch . bfloat16 , device = device ) <nl> for scalar in ( 2 . 2 , 5 , 100000 ) : # bf + 100000 is inf <nl> self . assertEqual ( ( bf + scalar ) . dtype , torch . bfloat16 ) <nl> - self . assertEqual ( ( scalar + bf ) . dtype , torch . bfloat16 ) <nl> self . assertEqual ( scalar + bf , bf + scalar ) <nl> - with self . assertRaises ( RuntimeError ) : <nl> - bf + complex ( 1 . 0 , 0 . 0 ) <nl> - with self . assertRaises ( RuntimeError ) : <nl> - complex ( 1 . 0 , 0 . 0 ) + bf <nl> + <nl> + for scalar in ( complex ( 1 , 1 ) , complex ( - 2 , 0 ) , complex ( 0 , - 3 ) ) : <nl> + self . assertEqual ( ( bf + scalar ) . dtype , torch . cfloat ) <nl> + self . assertEqual ( bf + scalar , scalar + bf ) <nl> <nl> # with tensor <nl> for dtype in torch . testing . get_all_dtypes ( ) : <nl> t = torch . tensor ( 1 , dtype = dtype , device = device ) <nl> - if dtype . is_complex or dtype = = torch . float16 : <nl> - with self . assertRaises ( RuntimeError ) : <nl> - bf + t <nl> - with self . assertRaises ( RuntimeError ) : <nl> - t + bf <nl> - with self . assertRaises ( RuntimeError ) : <nl> - torch . promote_types ( dtype , torch . bfloat16 ) <nl> - with self . assertRaises ( RuntimeError ) : <nl> - torch . promote_types ( torch . bfloat16 , dtype ) <nl> + self . assertEqual ( bf + t , t + bf ) <nl> + if dtype in ( torch . float16 , torch . float32 , torch . float64 , torch . cfloat , torch . cdouble ) : <nl> + # Handles bfloat16 x float16 - > float32 promotion <nl> + expected_dtype = dtype if dtype ! = torch . half else torch . float32 <nl> + elif dtype in ( torch . bool , torch . uint8 , <nl> + torch . int8 , torch . int16 , torch . int32 , torch . int64 , torch . bfloat16 ) : <nl> + expected_dtype = torch . bfloat16 <nl> else : <nl> - self . assertEqual ( bf + t , t + bf ) <nl> - if dtype in ( torch . float32 , torch . float64 ) : <nl> - self . assertEqual ( torch . promote_types ( dtype , torch . bfloat16 ) , dtype ) <nl> - self . assertEqual ( torch . promote_types ( torch . bfloat16 , dtype ) , dtype ) <nl> - self . assertEqual ( ( bf + t ) . dtype , dtype ) <nl> - self . assertEqual ( ( t + bf ) . dtype , dtype ) <nl> - elif dtype in ( torch . bool , <nl> - torch . uint8 , torch . int8 , torch . int16 , torch . int32 , torch . int64 , torch . bfloat16 ) : <nl> - self . assertEqual ( torch . promote_types ( dtype , torch . bfloat16 ) , torch . bfloat16 ) <nl> - self . assertEqual ( torch . promote_types ( torch . bfloat16 , dtype ) , torch . bfloat16 ) <nl> - self . assertEqual ( ( bf + t ) . dtype , torch . bfloat16 ) <nl> - self . assertEqual ( ( t + bf ) . dtype , torch . bfloat16 ) <nl> - else : <nl> - raise AssertionError ( f ' Missing dtype { dtype } not tested . ' ) <nl> + raise AssertionError ( f ' Missing dtype { dtype } not tested . ' ) <nl> + <nl> + self . assertEqual ( torch . promote_types ( dtype , torch . bfloat16 ) , expected_dtype ) <nl> + self . assertEqual ( torch . promote_types ( torch . bfloat16 , dtype ) , expected_dtype ) <nl> + self . assertEqual ( ( bf + t ) . dtype , expected_dtype ) <nl> <nl> @ float_double_default_dtype <nl> def test_alternate_result ( self , device ) : <nl>
|
Enables bfloat16 x [ float16 , complex64 , complex128 ] type promotion ( )
|
pytorch/pytorch
|
3aec1185e0643b2249984577e5f8a822b2adccde
|
2020-08-21T17:48:04Z
|
mmm a / src / mongo / db / concurrency / d_concurrency_test . cpp <nl> ppp b / src / mongo / db / concurrency / d_concurrency_test . cpp <nl> class DConcurrencyTestFixture : public unittest : : Test { <nl> <nl> <nl> TEST_F ( DConcurrencyTestFixture , WriteConflictRetryInstantiatesOK ) { <nl> - writeConflictRetry ( nullptr , " " , " " , [ ] { } ) ; <nl> + auto opCtx = makeOpCtx ( ) ; <nl> + opCtx - > setLockState ( stdx : : make_unique < MMAPV1LockerImpl > ( ) ) ; <nl> + writeConflictRetry ( opCtx . get ( ) , " " , " " , [ ] { } ) ; <nl> + } <nl> + <nl> + TEST_F ( DConcurrencyTestFixture , WriteConflictRetryRetriesFunctionOnWriteConflictException ) { <nl> + auto opCtx = makeOpCtx ( ) ; <nl> + opCtx - > setLockState ( stdx : : make_unique < MMAPV1LockerImpl > ( ) ) ; <nl> + auto & & opDebug = CurOp : : get ( opCtx . get ( ) ) - > debug ( ) ; <nl> + ASSERT_EQUALS ( 0LL , opDebug . writeConflicts ) ; <nl> + ASSERT_EQUALS ( 100 , writeConflictRetry ( opCtx . get ( ) , " " , " " , [ & opDebug ] { <nl> + if ( opDebug . writeConflicts = = 0LL ) { <nl> + throw WriteConflictException ( ) ; <nl> + } <nl> + return 100 ; <nl> + } ) ) ; <nl> + ASSERT_EQUALS ( 1LL , opDebug . writeConflicts ) ; <nl> + } <nl> + <nl> + TEST_F ( DConcurrencyTestFixture , WriteConflictRetryPropagatesNonWriteConflictException ) { <nl> + auto opCtx = makeOpCtx ( ) ; <nl> + opCtx - > setLockState ( stdx : : make_unique < MMAPV1LockerImpl > ( ) ) ; <nl> + ASSERT_THROWS_CODE ( writeConflictRetry ( opCtx . get ( ) , <nl> + " " , <nl> + " " , <nl> + [ ] { <nl> + uassert ( ErrorCodes : : OperationFailed , " " , false ) ; <nl> + MONGO_UNREACHABLE ; <nl> + } ) , <nl> + AssertionException , <nl> + ErrorCodes : : OperationFailed ) ; <nl> + } <nl> + <nl> + TEST_F ( DConcurrencyTestFixture , <nl> + WriteConflictRetryPropagatesWriteConflictExceptionIfAlreadyInAWriteUnitOfWork ) { <nl> + auto opCtx = makeOpCtx ( ) ; <nl> + opCtx - > setLockState ( stdx : : make_unique < MMAPV1LockerImpl > ( ) ) ; <nl> + Lock : : GlobalWrite globalWrite ( opCtx . get ( ) ) ; <nl> + WriteUnitOfWork wuow ( opCtx . get ( ) ) ; <nl> + ASSERT_THROWS ( writeConflictRetry ( opCtx . get ( ) , " " , " " , [ ] { throw WriteConflictException ( ) ; } ) , <nl> + WriteConflictException ) ; <nl> } <nl> <nl> TEST_F ( DConcurrencyTestFixture , ResourceMutex ) { <nl> mmm a / src / mongo / db / concurrency / write_conflict_exception . h <nl> ppp b / src / mongo / db / concurrency / write_conflict_exception . h <nl> class WriteConflictException : public DBException { <nl> * other than WriteConflictException . For each time f throws a WriteConflictException , logs the <nl> * error , waits a spell , cleans up , and then tries f again . Imposes no upper limit on the number <nl> * of times to re - try f , so any required timeout behavior must be enforced within f . <nl> + * <nl> + * If we are already in a WriteUnitOfWork , we assume that we are being called within a <nl> + * WriteConflictException retry loop up the call stack . Hence , this retry loop is reduced to an <nl> + * invocation of the argument function f without any exception handling and retry logic . <nl> * / <nl> template < typename F > <nl> auto writeConflictRetry ( OperationContext * opCtx , StringData opStr , StringData ns , F & & f ) { <nl> + invariant ( opCtx ) ; <nl> + invariant ( opCtx - > lockState ( ) ) ; <nl> + invariant ( opCtx - > recoveryUnit ( ) ) ; <nl> + <nl> + if ( opCtx - > lockState ( ) - > inAWriteUnitOfWork ( ) ) { <nl> + return f ( ) ; <nl> + } <nl> + <nl> int attempts = 0 ; <nl> while ( true ) { <nl> try { <nl>
|
SERVER - 30530 WCE retry loop runs argument function without retry logic if in a WUOW
|
mongodb/mongo
|
0e2b48d8dd77f972449b89869cdbfabdbc074845
|
2017-09-19T19:07:58Z
|
similarity index 70 % <nl> rename from dbms / include / DB / DataStreams / PushingToViewsOutputStream . h <nl> rename to dbms / include / DB / DataStreams / PushingToViewsBlockOutputStream . h <nl> mmm a / dbms / include / DB / DataStreams / PushingToViewsOutputStream . h <nl> ppp b / dbms / include / DB / DataStreams / PushingToViewsBlockOutputStream . h <nl> namespace DB <nl> / * * Записывает данные в указанную таблицу , при этом рекурсивно вызываясь от всех зависимых вьюшек . <nl> * Если вьюшка не материализованная , то в нее данные не записываются , лишь перенаправляются дальше . <nl> * / <nl> - class PushingToViewsOutputStream : public IBlockOutputStream <nl> + class PushingToViewsBlockOutputStream : public IBlockOutputStream <nl> { <nl> public : <nl> - PushingToViewsOutputStream ( String database_ , String table_ , const Context & context_ , ASTPtr query_ptr_ ) <nl> + PushingToViewsBlockOutputStream ( String database_ , String table_ , const Context & context_ , ASTPtr query_ptr_ ) <nl> : database ( database_ ) , table ( table_ ) , context ( context_ ) , query_ptr ( query_ptr_ ) <nl> { <nl> + if ( database . empty ( ) ) <nl> + database = context . getCurrentDatabase ( ) ; <nl> storage = context . getTable ( database , table ) ; <nl> - std : : vector < DatabaseAndTableName > dependencies = context . getDependencies ( DatabaseAndTableName ( database , table ) ) ; <nl> - for ( int i = 0 ; i < ( int ) dependencies . size ( ) ; i + + ) <nl> + Dependencies dependencies = context . getDependencies ( DatabaseAndTableName ( database , table ) ) ; <nl> + for ( size_t i = 0 ; i < dependencies . size ( ) ; + + i ) <nl> { <nl> - children . push_back ( new PushingToViewsOutputStream ( dependencies [ i ] . first , dependencies [ i ] . second , context , ASTPtr ( ) ) ) ; <nl> + children . push_back ( new PushingToViewsBlockOutputStream ( dependencies [ i ] . first , dependencies [ i ] . second , context , ASTPtr ( ) ) ) ; <nl> queries . push_back ( dynamic_cast < StorageView & > ( * context . getTable ( dependencies [ i ] . first , dependencies [ i ] . second ) ) . getInnerQuery ( ) ) ; <nl> } <nl> <nl> - std : : cerr < < storage - > getName ( ) < < std : : endl ; <nl> if ( storage - > getName ( ) ! = " View " ) <nl> output = storage - > write ( query_ptr ) ; <nl> } <nl> <nl> - String getName ( ) const { return " PushingToViewsOutputStream " ; } <nl> + String getName ( ) const { return " PushingToViewsBlockOutputStream " ; } <nl> <nl> void write ( const Block & block ) <nl> { <nl> - for ( int i = 0 ; i < ( int ) children . size ( ) ; i + + ) <nl> + for ( size_t i = 0 ; i < children . size ( ) ; + + i ) <nl> { <nl> BlockInputStreamPtr from = new OneBlockInputStream ( block ) ; <nl> InterpreterSelectQuery select ( queries [ i ] , context , QueryProcessingStage : : Complete , 0 , from ) ; <nl> mmm a / dbms / include / DB / Interpreters / Context . h <nl> ppp b / dbms / include / DB / Interpreters / Context . h <nl> typedef std : : pair < String , String > DatabaseAndTableName ; <nl> <nl> / / / таблица - > множество таблиц - вьюшек , которые селектят из нее <nl> typedef std : : map < DatabaseAndTableName , std : : set < DatabaseAndTableName > > ViewDependencies ; <nl> + typedef std : : vector < DatabaseAndTableName > Dependencies ; <nl> <nl> <nl> / * * Набор известных объектов , которые могут быть использованы в запросе . <nl> class Context <nl> void setQuota ( const String & name , const String & quota_key , const String & user_name , const Poco : : Net : : IPAddress & address ) ; <nl> QuotaForIntervals & getQuota ( ) ; <nl> <nl> - void addDependency ( DatabaseAndTableName from , DatabaseAndTableName where ) ; <nl> - void removeDependency ( DatabaseAndTableName from , DatabaseAndTableName where ) ; <nl> - std : : vector < DatabaseAndTableName > getDependencies ( DatabaseAndTableName from ) const ; <nl> + void addDependency ( const DatabaseAndTableName & from , const DatabaseAndTableName & where ) ; <nl> + void removeDependency ( const DatabaseAndTableName & from , const DatabaseAndTableName & where ) ; <nl> + Dependencies getDependencies ( const DatabaseAndTableName & from ) const ; <nl> <nl> / / / Проверка существования таблицы / БД . database может быть пустой - в этом случае используется текущая БД . <nl> bool isTableExist ( const String & database_name , const String & table_name ) const ; <nl> mmm a / dbms / include / DB / Interpreters / InterpreterSelectQuery . h <nl> ppp b / dbms / include / DB / Interpreters / InterpreterSelectQuery . h <nl> namespace DB <nl> class InterpreterSelectQuery <nl> { <nl> public : <nl> - InterpreterSelectQuery ( ASTPtr query_ptr_ , const Context & context_ , QueryProcessingStage : : Enum to_stage_ = QueryProcessingStage : : Complete , size_t subquery_depth_ = 0 , BlockInputStreamPtr input = 0 ) ; <nl> + InterpreterSelectQuery ( ASTPtr query_ptr_ , const Context & context_ , QueryProcessingStage : : Enum to_stage_ = QueryProcessingStage : : Complete , size_t subquery_depth_ = 0 , BlockInputStreamPtr input = NULL ) ; <nl> <nl> InterpreterSelectQuery ( ASTPtr query_ptr_ , const Context & context_ , const Names & required_column_names , <nl> - QueryProcessingStage : : Enum to_stage_ = QueryProcessingStage : : Complete , size_t subquery_depth_ = 0 , BlockInputStreamPtr input = 0 ) ; <nl> + QueryProcessingStage : : Enum to_stage_ = QueryProcessingStage : : Complete , size_t subquery_depth_ = 0 , BlockInputStreamPtr input = NULL ) ; <nl> <nl> / / / Выполнить запрос , получить поток блоков для чтения <nl> BlockInputStreamPtr execute ( ) ; <nl> class InterpreterSelectQuery <nl> private : <nl> typedef Poco : : SharedPtr < ExpressionAnalyzer > ExpressionAnalyzerPtr ; <nl> <nl> - / * * Из какой таблицы читать . JOIN - ы не поддерживаются . <nl> - * / <nl> void init ( BlockInputStreamPtr input ) ; <nl> <nl> + / * * Из какой таблицы читать . JOIN - ы не поддерживаются . <nl> + * / <nl> void getDatabaseAndTableNames ( String & database_name , String & table_name ) ; <nl> <nl> StoragePtr getTable ( ) ; <nl> mmm a / dbms / include / DB / Parsers / ASTCreateQuery . h <nl> ppp b / dbms / include / DB / Parsers / ASTCreateQuery . h <nl> class ASTCreateQuery : public IAST <nl> String as_table ; <nl> ASTPtr select ; <nl> <nl> - ASTCreateQuery ( ) { } <nl> - ASTCreateQuery ( StringRange range_ ) : IAST ( range_ ) , attach ( false ) , if_not_exists ( false ) { } <nl> + ASTCreateQuery ( ) : attach ( false ) , if_not_exists ( false ) , is_view ( false ) , is_materialized_view ( false ) { } <nl> + ASTCreateQuery ( StringRange range_ ) : IAST ( range_ ) , attach ( false ) , if_not_exists ( false ) , is_view ( false ) , is_materialized_view ( false ) { } <nl> <nl> / * * Получить текст , который идентифицирует этот элемент . * / <nl> String getID ( ) const { return ( attach ? " AttachQuery_ " : " CreateQuery_ " ) + database + " _ " + table ; } ; <nl> class ASTCreateQuery : public IAST <nl> if ( columns ) { res - > columns = columns - > clone ( ) ; res - > children . push_back ( res - > columns ) ; } <nl> if ( storage ) { res - > storage = storage - > clone ( ) ; res - > children . push_back ( res - > storage ) ; } <nl> if ( select ) { res - > select = select - > clone ( ) ; res - > children . push_back ( res - > select ) ; } <nl> + if ( inner_storage ) { res - > inner_storage = inner_storage - > clone ( ) ; res - > children . push_back ( res - > inner_storage ) ; } <nl> <nl> return res ; <nl> } <nl> mmm a / dbms / include / DB / Parsers / ASTSelectQuery . h <nl> ppp b / dbms / include / DB / Parsers / ASTSelectQuery . h <nl> class ASTSelectQuery : public ASTQueryWithOutput <nl> / * * Получить текст , который идентифицирует этот элемент . * / <nl> String getID ( ) const { return " SelectQuery " ; } ; <nl> <nl> - void rewriteExpressionList ( const Names & column_names ) <nl> + <nl> + / / / Переписывает select_expression_list , чтобы вернуть только необходимые столбцы в правильном порядке . <nl> + void rewriteSelectExpressionList ( const Names & column_names ) <nl> { <nl> ASTPtr result = new ASTExpressionList ; <nl> ASTs asts = select_expression_list - > children ; <nl> + <nl> for ( size_t i = 0 ; i < column_names . size ( ) ; + + i ) <nl> { <nl> bool done = 0 ; <nl> class ASTSelectQuery : public ASTQueryWithOutput <nl> } <nl> } <nl> if ( ! done ) <nl> - throw Exception ( " Logical error while rewriting expressioin list for select query " <nl> + throw Exception ( " Error while rewriting expressioin list for select query . " <nl> " Could not find alias : " + column_names [ i ] , <nl> DB : : ErrorCodes : : UNKNOWN_IDENTIFIER ) ; <nl> <nl> mmm a / dbms / include / DB / Storages / StorageMaterializedView . h <nl> ppp b / dbms / include / DB / Storages / StorageMaterializedView . h <nl> class StorageMaterializedView : public StorageView { <nl> Context & context_ , ASTPtr & query_ , NamesAndTypesListPtr columns_ , bool attach_ ) ; <nl> <nl> std : : string getName ( ) const { return " MaterializedView " ; } <nl> - std : : string getInnerTableName ( ) const { return table_name + " _inner " ; } <nl> + std : : string getInnerTableName ( ) const { return " . inner . " + table_name ; } <nl> <nl> BlockOutputStreamPtr write ( ASTPtr query ) ; <nl> void dropImpl ( ) ; <nl> class StorageMaterializedView : public StorageView { <nl> <nl> private : <nl> StoragePtr data ; <nl> - String inner_storage_name ; <nl> <nl> StorageMaterializedView ( const String & table_name_ , const String & database_name_ , <nl> Context & context_ , ASTPtr & query_ , NamesAndTypesListPtr columns_ , bool attach_ ) ; <nl> mmm a / dbms / include / DB / Storages / StorageView . h <nl> ppp b / dbms / include / DB / Storages / StorageView . h <nl> class StorageView : public IStorage { <nl> <nl> virtual std : : string getName ( ) const { return " View " ; } <nl> virtual std : : string getTableName ( ) const { return table_name ; } <nl> - virtual const NamesAndTypesList & getColumnsList ( ) const { return * columns ; } <nl> - virtual DB : : ASTPtr getInnerQuery ( ) { return inner_query . clone ( ) ; } ; <nl> + const NamesAndTypesList & getColumnsList ( ) const { return * columns ; } <nl> + DB : : ASTPtr getInnerQuery ( ) const { return inner_query . clone ( ) ; } ; <nl> <nl> virtual BlockInputStreams read ( <nl> const Names & column_names , <nl> mmm a / dbms / src / Interpreters / Context . cpp <nl> ppp b / dbms / src / Interpreters / Context . cpp <nl> QuotaForIntervals & Context : : getQuota ( ) <nl> return * quota ; <nl> } <nl> <nl> - void Context : : addDependency ( DatabaseAndTableName from , DatabaseAndTableName where ) <nl> + void Context : : addDependency ( const DatabaseAndTableName & from , const DatabaseAndTableName & where ) <nl> { <nl> Poco : : ScopedLock < Poco : : Mutex > lock ( shared - > mutex ) ; <nl> shared - > view_dependencies [ from ] . insert ( where ) ; <nl> } <nl> <nl> - void Context : : removeDependency ( DatabaseAndTableName from , DatabaseAndTableName where ) <nl> + void Context : : removeDependency ( const DatabaseAndTableName & from , const DatabaseAndTableName & where ) <nl> { <nl> Poco : : ScopedLock < Poco : : Mutex > lock ( shared - > mutex ) ; <nl> shared - > view_dependencies [ from ] . erase ( where ) ; <nl> } <nl> <nl> - std : : vector < DatabaseAndTableName > Context : : getDependencies ( DatabaseAndTableName from ) const <nl> + Dependencies Context : : getDependencies ( const DatabaseAndTableName & from ) const <nl> { <nl> Poco : : ScopedLock < Poco : : Mutex > lock ( shared - > mutex ) ; <nl> ViewDependencies : : const_iterator iter = shared - > view_dependencies . find ( from ) ; <nl> if ( iter = = shared - > view_dependencies . end ( ) ) <nl> - return std : : vector < DatabaseAndTableName > ( ) ; <nl> + return Dependencies ( ) ; <nl> const std : : set < DatabaseAndTableName > & buf = iter - > second ; <nl> - std : : vector < DatabaseAndTableName > res ( buf . begin ( ) , buf . end ( ) ) ; <nl> + Dependencies res ( buf . begin ( ) , buf . end ( ) ) ; <nl> return res ; <nl> } <nl> <nl> mmm a / dbms / src / Interpreters / InterpreterCreateQuery . cpp <nl> ppp b / dbms / src / Interpreters / InterpreterCreateQuery . cpp <nl> <nl> # include < DB / Interpreters / InterpreterCreateQuery . h > <nl> <nl> <nl> - <nl> - <nl> namespace DB <nl> { <nl> <nl> StoragePtr InterpreterCreateQuery : : execute ( bool assume_metadata_exists ) <nl> StoragePtr res ; <nl> SharedPtr < InterpreterSelectQuery > interpreter_select ; <nl> String storage_name ; <nl> + NamesAndTypesListPtr columns = new NamesAndTypesList ; <nl> <nl> { <nl> Poco : : ScopedLock < Poco : : Mutex > lock ( context . getMutex ( ) ) ; <nl> StoragePtr InterpreterCreateQuery : : execute ( bool assume_metadata_exists ) <nl> if ( create . select & & ! create . attach ) <nl> interpreter_select = new InterpreterSelectQuery ( create . select , context ) ; <nl> <nl> - NamesAndTypesListPtr columns = new NamesAndTypesList ; <nl> - <nl> / / / Получаем список столбцов <nl> if ( create . columns ) <nl> { <nl> StoragePtr InterpreterCreateQuery : : execute ( bool assume_metadata_exists ) <nl> ASTPtr name_and_type_pair_ptr = new ASTNameTypePair ; <nl> ASTNameTypePair & name_and_type_pair = dynamic_cast < ASTNameTypePair & > ( * name_and_type_pair_ptr ) ; <nl> name_and_type_pair . name = it - > first ; <nl> - String type_name = it - > second - > getName ( ) . data ( ) ; <nl> + String * type_name = new String ( it - > second - > getName ( ) ) ; / / . data ( ) ; <nl> <nl> ParserIdentifierWithOptionalParameters storage_p ; <nl> String expected ; <nl> - const char * pos = type_name . data ( ) ; <nl> - const char * end = pos + type_name . size ( ) ; <nl> - <nl> + const char * pos = type_name - > data ( ) ; <nl> + const char * end = pos + type_name - > size ( ) ; <nl> + <nl> if ( ! storage_p . parse ( pos , end , name_and_type_pair . type , expected ) ) <nl> throw Exception ( " Cannot parse data type . " , ErrorCodes : : SYNTAX_ERROR ) ; <nl> <nl> + name_and_type_pair . type - > query_string = type_name ; <nl> columns_list . children . push_back ( name_and_type_pair_ptr ) ; <nl> } <nl> <nl> StoragePtr InterpreterCreateQuery : : execute ( bool assume_metadata_exists ) <nl> } <nl> <nl> / / / Выбор нужного движка таблицы <nl> - <nl> if ( create . storage ) <nl> storage_name = dynamic_cast < ASTFunction & > ( * create . storage ) . name ; <nl> else if ( ! create . as_table . empty ( ) ) <nl> StoragePtr InterpreterCreateQuery : : execute ( bool assume_metadata_exists ) <nl> storage_name , data_path , table_name , database_name , context . getGlobalContext ( ) , query_ptr , columns , create . attach ) ; <nl> <nl> / / / Проверка наличия метаданных таблицы на диске и создание метаданных <nl> - <nl> if ( ! assume_metadata_exists ) <nl> { <nl> if ( Poco : : File ( metadata_path ) . exists ( ) ) <nl> StoragePtr InterpreterCreateQuery : : execute ( bool assume_metadata_exists ) <nl> } <nl> <nl> / / / Если запрос CREATE SELECT , то вставим в таблицу данные <nl> - if ( create . select & & storage_name ! = " View " & & ! create . attach ) <nl> + if ( create . select & & storage_name ! = " View " & & storage_name ! = " MaterializedView " ) <nl> { <nl> BlockInputStreamPtr from = new MaterializingBlockInputStream ( interpreter_select - > execute ( ) ) ; <nl> copyData ( * from , * res - > write ( query_ptr ) ) ; <nl> mmm a / dbms / src / Interpreters / InterpreterInsertQuery . cpp <nl> ppp b / dbms / src / Interpreters / InterpreterInsertQuery . cpp <nl> <nl> <nl> # include < DB / DataStreams / AddingDefaultBlockOutputStream . h > <nl> # include < DB / DataStreams / MaterializingBlockInputStream . h > <nl> - # include < DB / DataStreams / PushingToViewsOutputStream . h > <nl> + # include < DB / DataStreams / PushingToViewsBlockOutputStream . h > <nl> # include < DB / DataStreams / copyData . h > <nl> <nl> # include < DB / Parsers / ASTInsertQuery . h > <nl> void InterpreterInsertQuery : : execute ( ReadBuffer * remaining_data_istr ) <nl> <nl> BlockInputStreamPtr in ; <nl> NamesAndTypesListPtr required_columns = new NamesAndTypesList ( table - > getSampleBlock ( ) . getColumnsList ( ) ) ; <nl> - BlockOutputStreamPtr out = new AddingDefaultBlockOutputStream ( new PushingToViewsOutputStream ( query . database , query . table , context , query_ptr ) , required_columns ) ; <nl> + / / / Надо убедиться , что запрос идет в таблицу , которая поддерживает вставку . <nl> + table - > write ( query_ptr ) ; <nl> + / / / Создаем кортеж из нескольких стримов , в которые будем писать данные . <nl> + BlockOutputStreamPtr out = new AddingDefaultBlockOutputStream ( new PushingToViewsBlockOutputStream ( query . database , query . table , context , query_ptr ) , required_columns ) ; <nl> <nl> / / / Какой тип запроса : INSERT VALUES | INSERT FORMAT | INSERT SELECT ? <nl> if ( ! query . select ) <nl> void InterpreterInsertQuery : : execute ( ReadBuffer * remaining_data_istr ) <nl> if ( format . empty ( ) ) <nl> format = " Values " ; <nl> <nl> - <nl> / / / Данные могут содержаться в распарсенной ( query . data ) и ещё не распарсенной ( remaining_data_istr ) части запроса . <nl> <nl> / / / Если данных нет . <nl> BlockOutputStreamPtr InterpreterInsertQuery : : execute ( ) <nl> StoragePtr table = getTable ( ) ; <nl> <nl> NamesAndTypesListPtr required_columns = new NamesAndTypesList ( table - > getSampleBlock ( ) . getColumnsList ( ) ) ; <nl> - / / BlockOutputStreamPtr out = new AddingDefaultBlockOutputStream ( table - > write ( query_ptr ) , required_columns ) ; <nl> - BlockOutputStreamPtr out = new AddingDefaultBlockOutputStream ( new PushingToViewsOutputStream ( query . database , query . table , context , query_ptr ) , required_columns ) ; <nl> + <nl> + / / / Надо убедиться , что запрос идет в таблицу , которая поддерживает вставку . <nl> + table - > write ( query_ptr ) ; <nl> + / / / Создаем кортеж из нескольких стримов , в которые будем писать данные . <nl> + BlockOutputStreamPtr out = new AddingDefaultBlockOutputStream ( new PushingToViewsBlockOutputStream ( query . database , query . table , context , query_ptr ) , required_columns ) ; <nl> <nl> / / / Какой тип запроса : INSERT или INSERT SELECT ? <nl> if ( ! query . select ) <nl> mmm a / dbms / src / Interpreters / InterpreterSelectQuery . cpp <nl> ppp b / dbms / src / Interpreters / InterpreterSelectQuery . cpp <nl> InterpreterSelectQuery : : InterpreterSelectQuery ( ASTPtr query_ptr_ , const Context <nl> log ( & Logger : : get ( " InterpreterSelectQuery " ) ) <nl> { <nl> init ( input_ ) ; <nl> - query . rewriteExpressionList ( required_column_names_ ) ; <nl> + query . rewriteSelectExpressionList ( required_column_names_ ) ; <nl> } <nl> <nl> void InterpreterSelectQuery : : getDatabaseAndTableNames ( String & database_name , String & table_name ) <nl> mmm a / dbms / src / Parsers / ParserCreateQuery . cpp <nl> ppp b / dbms / src / Parsers / ParserCreateQuery . cpp <nl> bool ParserCreateQuery : : parseImpl ( Pos & pos , Pos end , ASTPtr & node , String & ex <nl> query - > children . push_back ( storage ) ; <nl> if ( select ) <nl> query - > children . push_back ( select ) ; <nl> + if ( inner_storage ) <nl> + query - > children . push_back ( inner_storage ) ; <nl> <nl> return true ; <nl> } <nl> mmm a / dbms / src / Storages / StorageMaterializedView . cpp <nl> ppp b / dbms / src / Storages / StorageMaterializedView . cpp <nl> <nl> # include < DB / Parsers / ASTIdentifier . h > <nl> # include < DB / Parsers / ASTCreateQuery . h > <nl> + # include < DB / Parsers / ASTDropQuery . h > <nl> # include < DB / Parsers / ASTSelectQuery . h > <nl> # include < DB / Parsers / ParserCreateQuery . h > <nl> <nl> <nl> # include < DB / Storages / StorageFactory . h > <nl> <nl> # include < DB / Interpreters / InterpreterCreateQuery . h > <nl> + # include < DB / Interpreters / InterpreterDropQuery . h > <nl> <nl> namespace DB <nl> { <nl> <nl> StoragePtr StorageMaterializedView : : create ( const String & table_name_ , const String & database_name_ , <nl> - Context & context_ , ASTPtr & query_ , NamesAndTypesListPtr columns_ , bool attach_ ) <nl> + Context & context_ , ASTPtr & query_ , NamesAndTypesListPtr columns_ , bool attach_ ) <nl> { <nl> return ( new StorageMaterializedView ( table_name_ , database_name_ , context_ , query_ , columns_ , attach_ ) ) - > thisPtr ( ) ; <nl> } <nl> <nl> StorageMaterializedView : : StorageMaterializedView ( const String & table_name_ , const String & database_name_ , <nl> - Context & context_ , ASTPtr & query_ , NamesAndTypesListPtr columns_ , bool attach_ ) : <nl> + Context & context_ , ASTPtr & query_ , NamesAndTypesListPtr columns_ , bool attach_ ) : <nl> StorageView ( table_name_ , database_name_ , context_ , query_ , columns_ ) <nl> { <nl> ASTCreateQuery & create = dynamic_cast < ASTCreateQuery & > ( * query_ ) ; <nl> <nl> - / / / Если не указан в запросе тип хранилища попробовать извлечь его из запроса Select <nl> - if ( ! create . inner_storage ) <nl> - inner_storage_name = context . getTable ( select_database_name , select_table_name ) - > getName ( ) ; <nl> - else <nl> - inner_storage_name = dynamic_cast < ASTFunction & > ( * ( create . inner_storage ) ) . name ; <nl> - <nl> - / / / Составим запрос для создания внутреннего хранилища . <nl> - ASTPtr ast_create_query ; <nl> + / / / Если запрос ATTACH , то к этому моменту внутренняя таблица уже должна быть подключена . <nl> if ( attach_ ) <nl> { <nl> - ast_create_query = context . getCreateQuery ( database_name_ , getInnerTableName ( ) ) ; <nl> + if ( ! context . isTableExist ( database_name , getInnerTableName ( ) ) ) <nl> + throw Exception ( " Inner table is not attached yet . " <nl> + " Materialized view : " + database_name + " . " + table_name + " . " <nl> + " Inner table : " + database_name + " . " + getInnerTableName ( ) + " . " , <nl> + DB : : ErrorCodes : : LOGICAL_ERROR ) ; <nl> + data = context . getTable ( database_name , getInnerTableName ( ) ) ; <nl> } <nl> else <nl> { <nl> - String formatted_columns = formatColumnsForCreateQuery ( * columns ) ; <nl> - String create_query = " CREATE TABLE " + database_name_ + " . " + getInnerTableName ( ) + " " + formatted_columns + " ENGINE = " + inner_storage_name ; <nl> - / / / Распарсим запрос . <nl> - const char * begin = create_query . data ( ) ; <nl> - const char * end = begin + create_query . size ( ) ; <nl> - const char * pos = begin ; <nl> - ParserCreateQuery parser ; <nl> - String expected ; <nl> - bool parse_res = parser . parse ( pos , end , ast_create_query , expected ) ; <nl> - / / / Распарсенный запрос должен заканчиваться на конец входных данных . <nl> - if ( ! parse_res | | pos ! = end ) <nl> - throw Exception ( " Syntax error while parsing create query made by StorageMaterializedView . " <nl> - " The query is \ " " + create_query + " \ " . " <nl> - + " Failed at position " + toString ( pos - begin ) + " : " <nl> - + std : : string ( pos , std : : min ( SHOW_CHARS_ON_SYNTAX_ERROR , end - pos ) ) <nl> - + " , expected " + ( parse_res ? " end of query " : expected ) + " . " , <nl> - DB : : ErrorCodes : : LOGICAL_ERROR ) ; <nl> - } <nl> + / / / Составим запрос для создания внутреннего хранилища . <nl> + ASTCreateQuery * manual_create_query = new ASTCreateQuery ( ) ; <nl> + manual_create_query - > database = database_name ; <nl> + manual_create_query - > table = getInnerTableName ( ) ; <nl> + manual_create_query - > columns = create . columns ; <nl> + ASTPtr ast_create_query = manual_create_query ; <nl> + <nl> + / / / Если не указан в запросе тип хранилища попробовать извлечь его из запроса Select . <nl> + if ( ! create . inner_storage ) <nl> + { <nl> + / / / TODO так же попытаться извлечь params для создания хранилища <nl> + ASTFunction * func = new ASTFunction ( ) ; <nl> + func - > name = context . getTable ( select_database_name , select_table_name ) - > getName ( ) ; <nl> + manual_create_query - > storage = func ; <nl> + } <nl> + else <nl> + manual_create_query - > storage = create . inner_storage ; <nl> <nl> - / / / Выполним запрос . <nl> - InterpreterCreateQuery create_interpreter ( ast_create_query , context_ ) ; <nl> - data = create_interpreter . execute ( ) ; <nl> + / / / Выполним запрос . <nl> + InterpreterCreateQuery create_interpreter ( ast_create_query , context ) ; <nl> + data = create_interpreter . execute ( ) ; <nl> + } <nl> } <nl> <nl> BlockInputStreams StorageMaterializedView : : read ( <nl> BlockOutputStreamPtr StorageMaterializedView : : write ( ASTPtr query ) <nl> } <nl> <nl> void StorageMaterializedView : : dropImpl ( ) { <nl> - context . removeDependency ( DatabaseAndTableName ( select_database_name , select_table_name ) , DatabaseAndTableName ( database_name , table_name ) ) ; <nl> - data - > dropImpl ( ) ; <nl> + context . getGlobalContext ( ) . removeDependency ( DatabaseAndTableName ( select_database_name , select_table_name ) , DatabaseAndTableName ( database_name , table_name ) ) ; <nl> + <nl> + / / / Состваляем и выполняем запрос drop для внутреннего хранилища . <nl> + ASTDropQuery * drop_query = new ASTDropQuery ; <nl> + drop_query - > database = database_name ; <nl> + drop_query - > table = getInnerTableName ( ) ; <nl> + ASTPtr ast_drop_query = drop_query ; <nl> + InterpreterDropQuery drop_interpreter ( ast_drop_query , context ) ; <nl> + drop_interpreter . execute ( ) ; <nl> } <nl> <nl> bool StorageMaterializedView : : optimize ( ) { <nl> mmm a / dbms / src / Storages / StorageView . cpp <nl> ppp b / dbms / src / Storages / StorageView . cpp <nl> StorageView : : StorageView ( const String & table_name_ , const String & database_nam <nl> table_name ( table_name_ ) , database_name ( database_name_ ) , context ( context_ ) , columns ( columns_ ) <nl> { <nl> ASTCreateQuery & create = dynamic_cast < ASTCreateQuery & > ( * query_ ) ; <nl> - inner_query = dynamic_cast < ASTSelectQuery & > ( * ( create . select ) ) ; <nl> + ASTSelectQuery & select = dynamic_cast < ASTSelectQuery & > ( * create . select ) ; <nl> + <nl> + / / / Если во внутреннем запросе не указана база данных , получить ее из контекста и записать в запрос . <nl> + if ( ! select . database ) <nl> + { <nl> + ASTIdentifier * id = new ASTIdentifier ( ) ; <nl> + id - > name = context . getCurrentDatabase ( ) ; <nl> + id - > kind = ASTIdentifier : : Database ; <nl> + select . database = id ; <nl> + select . children . push_back ( select . database ) ; <nl> + } <nl> + <nl> + inner_query = select ; <nl> <nl> if ( inner_query . database ) <nl> - select_database_name = dynamic_cast < ASTIdentifier & > ( * inner_query . database ) . name ; <nl> + select_database_name = dynamic_cast < const ASTIdentifier & > ( * inner_query . database ) . name ; <nl> else <nl> - select_database_name = context . getCurrentDatabase ( ) ; <nl> + throw Exception ( " Logical error while creating StorageView . " <nl> + " Could not retrieve database name from select query . " , <nl> + DB : : ErrorCodes : : LOGICAL_ERROR ) ; <nl> <nl> if ( inner_query . table ) <nl> - select_table_name = dynamic_cast < ASTIdentifier & > ( * inner_query . table ) . name ; <nl> + select_table_name = dynamic_cast < const ASTIdentifier & > ( * inner_query . table ) . name ; <nl> else <nl> throw Exception ( " Logical error while creating StorageView . " <nl> " Could not retrieve table name from select query . " , <nl> DB : : ErrorCodes : : LOGICAL_ERROR ) ; <nl> <nl> - context . addDependency ( DatabaseAndTableName ( select_database_name , select_table_name ) , DatabaseAndTableName ( database_name , table_name ) ) ; <nl> + context . getGlobalContext ( ) . addDependency ( DatabaseAndTableName ( select_database_name , select_table_name ) , DatabaseAndTableName ( database_name , table_name ) ) ; <nl> } <nl> <nl> BlockInputStreams StorageView : : read ( <nl> BlockInputStreams StorageView : : read ( <nl> <nl> <nl> void StorageView : : dropImpl ( ) { <nl> - context . removeDependency ( DatabaseAndTableName ( select_database_name , select_table_name ) , DatabaseAndTableName ( database_name , table_name ) ) ; <nl> + context . getGlobalContext ( ) . removeDependency ( DatabaseAndTableName ( select_database_name , select_table_name ) , DatabaseAndTableName ( database_name , table_name ) ) ; <nl> } <nl> <nl> <nl>
|
dbms : View and Materialized View fixes , logic updates , implementation [ # METR - 9076 ]
|
ClickHouse/ClickHouse
|
13bd27c498a9074242478640187d551c54cc883b
|
2013-11-13T14:39:48Z
|
mmm a / arangod / Makefile . files <nl> ppp b / arangod / Makefile . files <nl> arangod_libarangod_a_SOURCES = \ <nl> arangod / VocBase / replication - master . cpp \ <nl> arangod / VocBase / server . cpp \ <nl> arangod / VocBase / transaction . cpp \ <nl> + arangod / VocBase / traversal . cpp \ <nl> arangod / VocBase / voc - shaper . cpp \ <nl> arangod / VocBase / vocbase . cpp \ <nl> arangod / VocBase / vocbase - defaults . cpp \ <nl> mmm a / arangod / V8Server / v8 - vocbase . cpp <nl> ppp b / arangod / V8Server / v8 - vocbase . cpp <nl> <nl> # include " Wal / LogfileManager . h " <nl> <nl> # include " VocBase / auth . h " <nl> + # include " VocBase / traversal . h " <nl> # include " v8 . h " <nl> # include " V8 / JSLoader . h " <nl> <nl> static void JS_QueryIsKilledAql ( const v8 : : FunctionCallbackInfo < v8 : : Value > & args <nl> TRI_V8_RETURN_FALSE ( ) ; <nl> } <nl> <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief Executes a shortest Path Traversal <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + static void JS_QueryShortestPath ( const v8 : : FunctionCallbackInfo < v8 : : Value > & args ) { <nl> + TRI_RunDijkstraSearch ( args ) ; <nl> + } <nl> + <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief sleeps and checks for query abortion in between <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void TRI_InitV8VocBridge ( v8 : : Isolate * isolate , <nl> TRI_AddGlobalFunctionVocbase ( isolate , context , TRI_V8_ASCII_STRING ( " AQL_QUERY_SLEEP " ) , JS_QuerySleepAql , true ) ; <nl> TRI_AddGlobalFunctionVocbase ( isolate , context , TRI_V8_ASCII_STRING ( " AQL_QUERY_IS_KILLED " ) , JS_QueryIsKilledAql , true ) ; <nl> <nl> + TRI_AddGlobalFunctionVocbase ( isolate , context , TRI_V8_ASCII_STRING ( " AQL_SHORTEST_PATH " ) , JS_QueryShortestPath , true ) ; <nl> + <nl> + <nl> + <nl> TRI_InitV8replication ( isolate , context , server , vocbase , loader , threadNumber , v8g ) ; <nl> <nl> TRI_AddGlobalFunctionVocbase ( isolate , context , TRI_V8_ASCII_STRING ( " COMPARE_STRING " ) , JS_compare_string ) ; <nl> new file mode 100644 <nl> index 00000000000 . . de3a8ece739 <nl> mmm / dev / null <nl> ppp b / arangod / VocBase / traversal . cpp <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief vocbase traversals <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2014 - 2015 ArangoDB GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2014 triAGENS GmbH , Cologne , Germany <nl> + / / / <nl> + / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / / you may not use this file except in compliance with the License . <nl> + / / / You may obtain a copy of the License at <nl> + / / / <nl> + / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + / / / <nl> + / / / Unless required by applicable law or agreed to in writing , software <nl> + / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> + / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + / / / See the License for the specific language governing permissions and <nl> + / / / limitations under the License . <nl> + / / / <nl> + / / / Copyright holder is ArangoDB GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Michael Hackstein <nl> + / / / @ author Copyright 2014 - 2015 , ArangoDB GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2012 - 2013 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + # include " traversal . h " <nl> + <nl> + # include " v8 . h " <nl> + # include " V8 / v8 - conv . h " <nl> + # include " V8 / v8 - utils . h " <nl> + # include " V8Server / v8 - vocbaseprivate . h " <nl> + # include " V8Server / v8 - wrapshapedjson . h " <nl> + # include " V8Server / v8 - vocindex . h " <nl> + # include " V8Server / v8 - collection . h " <nl> + # include " Utils / transactions . h " <nl> + # include " Utils / V8ResolverGuard . h " <nl> + <nl> + using namespace std ; <nl> + using namespace triagens : : arango ; <nl> + <nl> + struct LocalCollectionGuard { <nl> + LocalCollectionGuard ( TRI_vocbase_col_t * collection ) <nl> + : _collection ( collection ) { <nl> + } <nl> + <nl> + ~ LocalCollectionGuard ( ) { <nl> + if ( _collection ! = nullptr & & ! _collection - > _isLocal ) { <nl> + FreeCoordinatorCollection ( _collection ) ; <nl> + } <nl> + } <nl> + <nl> + TRI_vocbase_col_t * _collection ; <nl> + } ; <nl> + <nl> + void TRI_RunDijkstraSearch ( const v8 : : FunctionCallbackInfo < v8 : : Value > & args ) { <nl> + v8 : : Isolate * isolate = args . GetIsolate ( ) ; <nl> + v8 : : HandleScope scope ( isolate ) ; <nl> + <nl> + if ( args . Length ( ) < 4 | | args . Length ( ) > 5 ) { <nl> + TRI_V8_THROW_EXCEPTION_USAGE ( " AQL_SHORTEST_PATH ( < vertexcollection > , < edgecollection > , < start > , < end > , < options > ) " ) ; <nl> + } <nl> + <nl> + std : : unique_ptr < char [ ] > key ; <nl> + TRI_vocbase_t * vocbase ; <nl> + TRI_vocbase_col_t const * col = nullptr ; <nl> + <nl> + vocbase = GetContextVocBase ( isolate ) ; <nl> + <nl> + vector < string > readCollections ; <nl> + vector < string > writeCollections ; <nl> + TRI_voc_cid_t vertexCollectionCId ; <nl> + TRI_voc_cid_t edgeCollectionCId ; <nl> + <nl> + double lockTimeout = ( double ) ( TRI_TRANSACTION_DEFAULT_LOCK_TIMEOUT / 1000000ULL ) ; <nl> + bool embed = false ; <nl> + bool waitForSync = false ; <nl> + <nl> + / / get the vertex collection <nl> + if ( ! args [ 0 ] - > IsString ( ) ) { <nl> + TRI_V8_THROW_TYPE_ERROR ( " expecting string for < vertexcollection > " ) ; <nl> + } <nl> + string const vertexCollectionName = TRI_ObjectToString ( args [ 0 ] ) ; <nl> + <nl> + / / get the edge collection <nl> + if ( ! args [ 1 ] - > IsString ( ) ) { <nl> + TRI_V8_THROW_TYPE_ERROR ( " expecting string for < edgecollection > " ) ; <nl> + } <nl> + string const edgeCollectionName = TRI_ObjectToString ( args [ 1 ] ) ; <nl> + <nl> + vocbase = GetContextVocBase ( isolate ) ; <nl> + <nl> + if ( vocbase = = nullptr ) { <nl> + TRI_V8_THROW_EXCEPTION ( TRI_ERROR_ARANGO_DATABASE_NOT_FOUND ) ; <nl> + } <nl> + V8ResolverGuard resolver ( vocbase ) ; <nl> + <nl> + readCollections . push_back ( vertexCollectionName ) ; <nl> + readCollections . push_back ( edgeCollectionName ) ; <nl> + <nl> + if ( ! ExtractDocumentHandle ( isolate , val , collectionName , key , rid ) ) { <nl> + return TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD ; <nl> + } <nl> + <nl> + if ( key . get ( ) = = nullptr ) { <nl> + TRI_V8_THROW_EXCEPTION ( TRI_ERROR_ARANGO_DOCUMENT_HANDLE_BAD ) ; <nl> + } <nl> + <nl> + TRI_ASSERT ( col ! = nullptr ) ; <nl> + TRI_ASSERT ( key . get ( ) ! = nullptr ) ; <nl> + <nl> + / / IHHF isCoordinator <nl> + <nl> + / / Start Transaction to collect all parts of the path <nl> + ExplicitTransaction trx ( <nl> + vocbase , <nl> + readCollections , <nl> + writeCollections , <nl> + lockTimeout , <nl> + waitForSync , <nl> + embed <nl> + ) ; <nl> + <nl> + int res = trx . begin ( ) ; <nl> + <nl> + if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> + TRI_V8_THROW_EXCEPTION ( res ) ; <nl> + } <nl> + <nl> + col = resolver . getResolver ( ) - > getCollectionStruct ( vertexCollectionName ) ; <nl> + if ( col = = nullptr ) { <nl> + / / collection not found <nl> + TRI_V8_THROW_EXCEPTION ( TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND ) ; <nl> + } <nl> + vertexCollectionCId = col - > _cid ; <nl> + if ( trx . orderBarrier ( trx . trxCollection ( col - > _cid ) ) = = nullptr ) { <nl> + TRI_V8_THROW_EXCEPTION_MEMORY ( ) ; <nl> + } <nl> + <nl> + col = resolver . getResolver ( ) - > getCollectionStruct ( edgeCollectionName ) ; <nl> + if ( col = = nullptr ) { <nl> + / / collection not found <nl> + TRI_V8_THROW_EXCEPTION ( TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND ) ; <nl> + } <nl> + edgeCollectionCId = col - > _cid ; <nl> + if ( trx . orderBarrier ( trx . trxCollection ( col - > _cid ) ) = = nullptr ) { <nl> + TRI_V8_THROW_EXCEPTION_MEMORY ( ) ; <nl> + } <nl> + <nl> + v8 : : Handle < v8 : : Value > result ; <nl> + v8 : : Handle < v8 : : Array > documents ; <nl> + <nl> + / / This is how to get the data out of the collections ! <nl> + / / Vertices <nl> + TRI_doc_mptr_copy_t document ; <nl> + res = trx . readSingle ( trx . trxCollection ( vertexCollectionCId ) , & document , key . get ( ) ) ; <nl> + <nl> + / / Edges TRI_EDGE_OUT is hardcoded <nl> + TRI_document_collection_t * ecol = trx . trxCollection ( edgeCollectionCId ) - > _collection - > _collection ; <nl> + std : : vector < TRI_doc_mptr_copy_t > & & edges = TRI_LookupEdgesDocumentCollection ( ecol , TRI_EDGE_OUT , edgeCollectionCId , key . get ( ) ) ; <nl> + <nl> + / / Add Dijkstra here <nl> + <nl> + / / Now build up the result use Subtransactions for each used collection <nl> + if ( res = = TRI_ERROR_NO_ERROR ) { <nl> + / / Collect all vertices <nl> + SingleCollectionReadOnlyTransaction subtrx ( new V8TransactionContext ( true ) , vocbase , vertexCollectionCId ) ; <nl> + <nl> + res = subtrx . begin ( ) ; <nl> + <nl> + if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> + TRI_V8_THROW_EXCEPTION ( res ) ; <nl> + } <nl> + <nl> + result = TRI_WrapShapedJson ( isolate , subtrx , vertexCollectionCId , document . getDataPtr ( ) ) ; <nl> + <nl> + if ( document . getDataPtr ( ) = = nullptr ) { <nl> + res = TRI_ERROR_ARANGO_DOCUMENT_NOT_FOUND ; <nl> + TRI_V8_THROW_EXCEPTION ( res ) ; <nl> + } <nl> + <nl> + res = subtrx . finish ( res ) ; <nl> + <nl> + / / Collect all edges <nl> + SingleCollectionReadOnlyTransaction subtrx2 ( new V8TransactionContext ( true ) , vocbase , edgeCollectionCId ) ; <nl> + <nl> + res = subtrx2 . begin ( ) ; <nl> + <nl> + if ( res ! = TRI_ERROR_NO_ERROR ) { <nl> + TRI_V8_THROW_EXCEPTION ( res ) ; <nl> + } <nl> + <nl> + bool error = false ; <nl> + <nl> + uint32_t const n = static_cast < uint32_t > ( edges . size ( ) ) ; <nl> + documents = v8 : : Array : : New ( isolate , static_cast < int > ( n ) ) ; <nl> + for ( size_t j = 0 ; j < n ; + + j ) { <nl> + v8 : : Handle < v8 : : Value > doc = TRI_WrapShapedJson ( isolate , subtrx2 , edgeCollectionCId , edges [ j ] . getDataPtr ( ) ) ; <nl> + <nl> + if ( doc . IsEmpty ( ) ) { <nl> + error = true ; <nl> + break ; <nl> + } <nl> + else { <nl> + documents - > Set ( static_cast < uint32_t > ( j ) , doc ) ; <nl> + } <nl> + } <nl> + if ( error ) { <nl> + TRI_V8_THROW_EXCEPTION_MEMORY ( ) ; <nl> + } <nl> + <nl> + res = subtrx2 . finish ( res ) ; <nl> + } <nl> + res = trx . finish ( res ) ; <nl> + <nl> + / / Not yet correct . Needs to build an object first . <nl> + TRI_V8_RETURN ( result ) ; <nl> + / / TRI_V8_RETURN ( documents ) ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . d2d0c36f676 <nl> mmm / dev / null <nl> ppp b / arangod / VocBase / traversal . h <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief vocbase traversals <nl> + / / / <nl> + / / / @ file <nl> + / / / <nl> + / / / DISCLAIMER <nl> + / / / <nl> + / / / Copyright 2014 - 2015 ArangoDB GmbH , Cologne , Germany <nl> + / / / Copyright 2004 - 2014 triAGENS GmbH , Cologne , Germany <nl> + / / / <nl> + / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + / / / you may not use this file except in compliance with the License . <nl> + / / / You may obtain a copy of the License at <nl> + / / / <nl> + / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + / / / <nl> + / / / Unless required by applicable law or agreed to in writing , software <nl> + / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> + / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + / / / See the License for the specific language governing permissions and <nl> + / / / limitations under the License . <nl> + / / / <nl> + / / / Copyright holder is ArangoDB GmbH , Cologne , Germany <nl> + / / / <nl> + / / / @ author Michael Hackstein <nl> + / / / @ author Copyright 2014 - 2015 , ArangoDB GmbH , Cologne , Germany <nl> + / / / @ author Copyright 2012 - 2013 , triAGENS GmbH , Cologne , Germany <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + # ifndef ARANGODB_VOC_BASE_TRAVERSAL_H <nl> + # define ARANGODB_VOC_BASE_TRAVERSAL_H 1 <nl> + <nl> + # include " Basics / Common . h " <nl> + # include " V8 / v8 - globals . h " <nl> + # include " VocBase / document - collection . h " <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - public functions <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + void TRI_RunDijkstraSearch ( const v8 : : FunctionCallbackInfo < v8 : : Value > & args ) ; <nl> + <nl> + # endif <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - END - OF - FILE <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + / / Local Variables : <nl> + / / mode : outline - minor <nl> + / / outline - regexp : " / / / @ brief \ \ | / / / { @ inheritDoc } \ \ | / / / @ page \ \ | / / - - SECTION - - \ \ | / / / @ \ \ } " <nl> + / / End : <nl>
|
First commit . Started implementing dijkstra in C + + . Got all the transaction stuff up and running now . Time to write down the algorithm .
|
arangodb/arangodb
|
01d587bc65696e4051e4c3b127582b0c854d38a4
|
2015-04-20T07:47:42Z
|
mmm a / language / German / strings . xml <nl> ppp b / language / German / strings . xml <nl> <nl> < string id = " 167 " > < / string > <nl> < string id = " 168 " > < / string > <nl> < string id = " 169 " > Auflösung < / string > <nl> - < string id = " 170 " > Bildwiederholungsrate anpassen < / string > <nl> + < string id = " 170 " > Bildwiederholfrequenz anpassen < / string > <nl> < string id = " 171 " > < / string > <nl> <nl> < string id = " 172 " > Veröffentlichung < / string > <nl> <nl> < string id = " 209 " > Nächste < / string > <nl> < string id = " 210 " > Vorherige < / string > <nl> < string id = " 213 " > Benutzeroberfläche kalibrieren . . . < / string > <nl> - < string id = " 214 " > Video kalibrieren . . . < / string > <nl> + < string id = " 214 " > Bildschirm kalibrieren . . . < / string > <nl> < string id = " 215 " > Weichzeichnen < / string > <nl> < string id = " 216 " > Vergrößerung < / string > <nl> < string id = " 217 " > Bild - Verhältnis < / string > <nl> <nl> < string id = " 262 " > Skript - Ausgabe < / string > <nl> < string id = " 263 " > Erlaube Kontrolle von XBMC über HTTP < / string > <nl> < string id = " 264 " > Aufnehmen < / string > <nl> - < string id = " 265 " > Aufnahme - Stopen < / string > <nl> + < string id = " 265 " > Aufnahme beenden < / string > <nl> < string id = " 266 " > Nach : Titel - Nr . < / string > <nl> < string id = " 267 " > Nach : Zeit < / string > <nl> < string id = " 268 " > Nach : Titel < / string > <nl> <nl> < string id = " 272 " > Bildbereich oben links ausrichten < / string > <nl> < string id = " 273 " > Bildbereich unten rechts ausrichten < / string > <nl> < string id = " 274 " > Position der Untertitel < / string > <nl> - < string id = " 275 " > Bildverhältniss einstellen < / string > <nl> + < string id = " 275 " > Bildverhältnis einstellen < / string > <nl> < string id = " 276 " > Bewege den Pfeil um den Bildbereich einzustellen < / string > <nl> < string id = " 277 " > Bewege den Balken um die Position der Untertitel einzustellen < / string > <nl> < string id = " 278 " > Ändere das Rechteck so , daß es ein perfektes Quadrat ergibt < / string > <nl> <nl> < string id = " 572 " > Studio < / string > <nl> < string id = " 573 " > Pfad < / string > <nl> < string id = " 574 " > Land < / string > <nl> - < string id = " 575 " > In Bearbeitung < / string > <nl> + < string id = " 575 " > In Gange < / string > <nl> <nl> < string id = " 580 " > Sortierrichtung < / string > <nl> < string id = " 581 " > Sortiermethode < / string > <nl> <nl> < string id = " 13050 " > Der Akku ist fast leer < / string > <nl> <nl> < string id = " 13100 " > Flicker - Filter < / string > <nl> - < string id = " 13101 " > Wähle Treiber ( benötigt Neustart ) < / string > <nl> + < string id = " 13101 " > Wie Treiber ( benötigt Neustart ) < / string > <nl> < string id = " 13105 " > Vertical Blank Synchronisation < / string > <nl> < string id = " 13106 " > Deaktiviert < / string > <nl> < string id = " 13107 " > Aktiviert während der Videowiedergabe < / string > <nl> <nl> <nl> < string id = " 13140 " > Aktive Verbindungen festgestellt ! < / string > <nl> < string id = " 13141 " > Wird fortgefahren , kann XBMC möglicherweise nicht mehr < / string > <nl> - < string id = " 13142 " > gesteuert werden . Fernsteuerung wirklich stoppen ? < / string > <nl> + < string id = " 13142 " > gesteuert werden . Fernsteuerung wirklich beenden ? < / string > <nl> <nl> < string id = " 13144 " > Wechsle Apple - Remote - Modus ? < / string > <nl> < string id = " 13145 " > Wird aktuell Apple Remote zur Steuerung von XBMC < / string > <nl> <nl> < string id = " 13509 " > Sehr Hoch ( langsam ! ) < / string > <nl> < string id = " 13510 " > Synchronisiere Wiedergabe zur Anzeige < / string > <nl> <nl> + < string id = " 13550 " > Pause während der Wiederholfrequenz Änderung < / string > <nl> + < string id = " 13551 " > Aus < / string > <nl> + < string id = " 13552 " > % . 1f Sekunden < / string > <nl> + < string id = " 13553 " > % . 1f Sekunden < / string > <nl> + <nl> < string id = " 13600 " > Apple - Remote < / string > <nl> <nl> < string id = " 13602 " > XBMC Start mit Fernbedienung erlauben < / string > <nl> <nl> < string id = " 14053 " > GUI - Filter < / string > <nl> <nl> < string id = " 14055 " > Durchsuchen im Hintergrund < / string > <nl> - < string id = " 14056 " > Scan stopen < / string > <nl> + < string id = " 14056 " > Scan beenden < / string > <nl> < string id = " 14057 " > Nicht möglich während des Durchsuchens < / string > <nl> < string id = " 14058 " > Filmkörnungseffekt < / string > <nl> < string id = " 14059 " > Netzwerkquellen nach Thumbnails durchsuchen < / string > <nl> <nl> < string id = " 21330 " > Versteckte Ordner und Dateien anzeigen < / string > <nl> < string id = " 21331 " > TuxBox Client < / string > <nl> < string id = " 21332 " > WARNUNG : Ziel - TuxBox - Laufwerk ist im Aufnahme - Modus ! < / string > <nl> - < string id = " 21333 " > Der Stream wird gestoppt ! < / string > <nl> + < string id = " 21333 " > Der Stream wird beendet ! < / string > <nl> < string id = " 21334 " > Umschalten auf Kanal : % s fehlgeschlagen ! < / string > <nl> < string id = " 21335 " > Den Stream jetzt starten ? < / string > <nl> < string id = " 21336 " > Verbinden zu : % s < / string > <nl> <nl> < string id = " 23050 " > Videotext aktivieren < / string > <nl> < string id = " 23051 " > Teil % i < / string > <nl> < string id = " 23052 " > Zwischenspeichern - % i Bytes < / string > <nl> - < string id = " 23053 " > Wird gestoppt < / string > <nl> + < string id = " 23053 " > Wird beendet < / string > <nl> < string id = " 23054 " > Läuft < / string > <nl> <nl> < string id = " 23100 " > Externer Player ist aktiv < / string > <nl>
|
updated : german translation
|
xbmc/xbmc
|
8bb416ee93fac219ef937bb87c70b60a541ea570
|
2010-09-27T15:39:52Z
|
mmm a / src / Storages / StorageMergeTree . cpp <nl> ppp b / src / Storages / StorageMergeTree . cpp <nl> void StorageMergeTree : : alter ( <nl> <nl> StorageInMemoryMetadata metadata = getInMemoryMetadata ( ) ; <nl> auto maybe_mutation_commands = commands . getMutationCommands ( metadata , context . getSettingsRef ( ) . materialize_ttl_after_modify ) ; <nl> + String mutation_file_name ; <nl> + Int64 mutation_version = - 1 ; <nl> commands . apply ( metadata ) ; <nl> <nl> / / / This alter can be performed at metadata level only <nl> void StorageMergeTree : : alter ( <nl> } <nl> else <nl> { <nl> - lockStructureExclusively ( table_lock_holder , context . getCurrentQueryId ( ) , context . getSettingsRef ( ) . lock_acquire_timeout ) ; <nl> - <nl> - changeSettings ( metadata . settings_ast , table_lock_holder ) ; <nl> - / / / Reinitialize primary key because primary key column types might have changed . <nl> - setProperties ( metadata ) ; <nl> + { <nl> + / / / TODO ( relax this lock and remove this action lock ) <nl> + auto merges_block = getActionLock ( ActionLocks : : PartsMerge ) ; <nl> + lockStructureExclusively ( table_lock_holder , context . getCurrentQueryId ( ) , context . getSettingsRef ( ) . lock_acquire_timeout ) ; <nl> <nl> - setTTLExpressions ( metadata . columns , metadata . ttl_for_table_ast ) ; <nl> + changeSettings ( metadata . settings_ast , table_lock_holder ) ; <nl> + / / / Reinitialize primary key because primary key column types might have changed . <nl> + setProperties ( metadata ) ; <nl> <nl> - DatabaseCatalog : : instance ( ) . getDatabase ( table_id . database_name ) - > alterTable ( context , table_id , metadata ) ; <nl> + setTTLExpressions ( metadata . columns , metadata . ttl_for_table_ast ) ; <nl> <nl> - String mutation_file_name ; <nl> - Int64 mutation_version = - 1 ; <nl> - if ( ! maybe_mutation_commands . empty ( ) ) <nl> - mutation_version = startMutation ( maybe_mutation_commands , mutation_file_name ) ; <nl> + DatabaseCatalog : : instance ( ) . getDatabase ( table_id . database_name ) - > alterTable ( context , table_id , metadata ) ; <nl> <nl> - / / / We release all locks except alter_intention_lock which allows <nl> - / / / to execute alter queries sequentially <nl> - table_lock_holder . releaseAllExceptAlterIntention ( ) ; <nl> + if ( ! maybe_mutation_commands . empty ( ) ) <nl> + mutation_version = startMutation ( maybe_mutation_commands , mutation_file_name ) ; <nl> + / / / We release all locks except alter_intention_lock which allows <nl> + / / / to execute alter queries sequentially <nl> + table_lock_holder . releaseAllExceptAlterIntention ( ) ; <nl> + } <nl> <nl> / / / Always execute required mutations synchronously , because alters <nl> / / / should be executed in sequential order . <nl> mmm a / src / Storages / StorageReplicatedMergeTree . cpp <nl> ppp b / src / Storages / StorageReplicatedMergeTree . cpp <nl> bool StorageReplicatedMergeTree : : executeMetadataAlter ( const StorageReplicatedMer <nl> zookeeper - > multi ( requests ) ; <nl> <nl> { <nl> - / / / TODO ( relax this lock ) <nl> + / / / TODO ( relax this lock and remove this action lock ) <nl> + auto merges_block = getActionLock ( ActionLocks : : PartsMerge ) ; <nl> auto table_lock = lockExclusively ( RWLockImpl : : NO_QUERY , getSettings ( ) - > lock_acquire_timeout_for_background_operations ) ; <nl> <nl> LOG_INFO ( log , " Metadata changed in ZooKeeper . Applying changes locally . " ) ; <nl>
|
Merge pull request from ClickHouse / stop_merges_before_alter
|
ClickHouse/ClickHouse
|
a101b17df72ba23f9772f64d56cb616f9902ea27
|
2020-06-02T06:34:05Z
|
mmm a / ports / kf5archive / portfile . cmake <nl> ppp b / ports / kf5archive / portfile . cmake <nl> <nl> - include ( vcpkg_common_functions ) <nl> - <nl> vcpkg_from_github ( <nl> OUT_SOURCE_PATH SOURCE_PATH <nl> REPO KDE / karchive <nl> mmm a / ports / kf5holidays / portfile . cmake <nl> ppp b / ports / kf5holidays / portfile . cmake <nl> <nl> - include ( vcpkg_common_functions ) <nl> - <nl> vcpkg_from_github ( <nl> OUT_SOURCE_PATH SOURCE_PATH <nl> REPO KDE / kholidays <nl> mmm a / ports / kf5plotting / portfile . cmake <nl> ppp b / ports / kf5plotting / portfile . cmake <nl> <nl> - include ( vcpkg_common_functions ) <nl> - <nl> vcpkg_from_github ( <nl> OUT_SOURCE_PATH SOURCE_PATH <nl> REPO KDE / kplotting <nl> mmm a / ports / kf5syntaxhighlighting / portfile . cmake <nl> ppp b / ports / kf5syntaxhighlighting / portfile . cmake <nl> <nl> - include ( vcpkg_common_functions ) <nl> - <nl> vcpkg_from_github ( <nl> OUT_SOURCE_PATH SOURCE_PATH <nl> REPO KDE / syntax - highlighting <nl>
|
Remove deprecated include from KF5 ports .
|
microsoft/vcpkg
|
207c65042405614776173f9095d75ab6e48a76aa
|
2019-12-21T20:47:40Z
|
new file mode 100644 <nl> index 0000000000000 . . 72de619a582ef <nl> mmm / dev / null <nl> ppp b / g3doc / LangRef . md <nl> <nl> + # MLIR Specification <nl> + <nl> + MLIR is a compiler intermediate representation with similarities to traditional <nl> + three - address SSA representations ( like <nl> + [ LLVM IR ] ( http : / / llvm . org / docs / LangRef . html ) or <nl> + [ SIL ] ( https : / / github . com / apple / swift / blob / master / docs / SIL . rst ) ) , but which <nl> + introduces notions from polyhedral loop optimization as first - class concepts . <nl> + This hybrid design is optimized to represent , analyze , and transform high level <nl> + dataflow graphs as well as target - specific code generated for high performance <nl> + data parallel systems . Beyond its representational capabilities , its single <nl> + continuous design provides a framework to lower from dataflow graphs to <nl> + high - performance target - specific code . <nl> + <nl> + MLIR stands for one of " Multi - Level IR " or " Multi - dimensional Loop IR " or <nl> + " Machine Learning IR " - the MLIR team prefers the first interpretation . This <nl> + document defines and describes the key concepts in MLIR , and is intended to be a <nl> + dry reference document - <nl> + [ rationale documentation ] ( https : / / docs . google . com / document / d / 1KoVYgp - m - dgAyKwqRne2c72j0FoxpsdNgfa9DTfWGgw / edit ? usp = sharing ) , <nl> + [ system overview documentation ] ( https : / / docs . google . com / document / d / 1yRqja94Da6NtKmPxSYtTx6xbUtughLANyeD7dZ7mOBM / edit # ) <nl> + and other content is hosted elsewhere . <nl> + <nl> + MLIR is designed to be used in three different forms : a human - readable textual <nl> + form suitable for debugging , an in - memory form suitable for programmatic <nl> + transformations and analysis , and a compact serialized form suitable for storage <nl> + and transport . The different forms all describe the same semantic content . This <nl> + document describes the human - readable textual form . <nl> + <nl> + [ TOC ] <nl> + <nl> + # # High - Level Structure { # high - level - structure } <nl> + <nl> + The top - level unit of code in MLIR is a [ Module ] ( # module ) . A module contains a <nl> + list of [ Functions ] ( # functions ) , and there are two types of function <nl> + definitions , a " [ CFG Function ] ( # cfg - functions ) " and an <nl> + " [ ML Function ] ( # ml - functions ) " . Both kinds of functions are represented as a <nl> + composition of [ operations ] ( # operations ) , but represent control flow in <nl> + different ways : A CFG Function control flow using a CFG of <nl> + [ BasicBlocks ] ( # basic - blocks ) , which contain instructions and end with <nl> + [ control flow terminator statements ] ( # terminator - instructions ) ( like branches ) . <nl> + ML Functions represents control flow with a nest of affine loops and if <nl> + conditions , and are said to contain statements . Both types of functions can call <nl> + back and forth between each other arbitrarily . <nl> + <nl> + MLIR is an <nl> + [ SSA - based ] ( https : / / en . wikipedia . org / wiki / Static_single_assignment_form ) IR , <nl> + which means that values are defined before use and have scope defined by their <nl> + dominance relations . Operations may produce zero or more results , and each is a <nl> + distinct SSA value with its own type defined by the [ type system ] ( # type - system ) . <nl> + <nl> + MLIR incorporates polyhedral compiler concepts , including ` MLFunctions ` with <nl> + affine loops and if conditions . It also includes affine maps integrated into the <nl> + type system - they are key to the representation of data and <nl> + [ MemRefs ] ( # memref - type ) , which are the representation for tensors in addressable <nl> + memory . MLIR also supports a first - class Tensor type allowing it to concisely <nl> + represent operations on N - dimensional arrays . <nl> + <nl> + Finally , MLIR supports operations for allocating buffers , producing views to <nl> + transform them , represent target - independent arithmetic , target - specific <nl> + instructions , and even supports arbitrary user - defined high - level tensor <nl> + operations . <nl> + <nl> + Here ' s an example of an MLIR module : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Compute A * B using mlfunc implementation of multiply kernel and print the <nl> + / / result using a TensorFlow op . The dimensions of A and B are partially <nl> + / / known . The shapes are assumed to match . <nl> + cfgfunc @ mul ( tensor < 100x ? xf32 > , tensor < ? x50xf32 > ) - > ( tensor < 100x50xf32 > ) { <nl> + / / Basic block bb0 . % A and % B come from function arguments . <nl> + bb0 ( % A : tensor < 100x ? xf32 > , % B : tensor < ? x50xf32 > ) : <nl> + / / Compute the inner dimension of % A using the dim operation . <nl> + % n = dim % A , 1 : tensor < 100x ? xf32 > <nl> + <nl> + / / Allocate addressable " buffers " and copy tensors % A and % B into them . <nl> + % A_m = alloc memref < 100x ? xf32 > ( % n ) <nl> + tensor_store % A to % A_m : memref < 100x ? xf32 > <nl> + <nl> + % B_m = alloc memref < ? x50xf32 > ( % n ) <nl> + tensor_store % B to % B_m : memref < ? x50xf32 > <nl> + <nl> + / / Call ML function @ multiply passing memrefs as arguments , <nl> + / / and getting returned the result of the multiplication . <nl> + % C_m = call @ multiply ( % A_m , % B_m ) <nl> + : ( memref < 100x ? xf32 > , memref < ? x50xf32 > ) - > ( memref < 100x50xf32 > ) <nl> + <nl> + dealloc % A_m : memref < 100x ? xf32 > <nl> + dealloc % B_m : memref < ? x50xf32 > <nl> + <nl> + / / Load the buffer data into a higher level " tensor " value . <nl> + % C = tensor_load % C_m : memref < 100x50xf32 > <nl> + dealloc % C_m : memref < 100x50xf32 > <nl> + <nl> + / / Call TensorFlow built - in function to print the result tensor . <nl> + " tf . Print " ( % C ) { message : " mul result " } <nl> + : ( tensor < 100x50xf32 ) - > ( tensor < 100x50xf32 > ) <nl> + <nl> + return % C : tensor < 100x50xf32 > <nl> + } <nl> + <nl> + / / ML function that multiplies two memrefs and returns the result . <nl> + mlfunc @ multiply ( % A : memref < 100x ? xf32 > , % B : memref < ? x50xf32 > ) <nl> + - > ( memref < 100x50xf32 > ) { <nl> + / / Compute the inner dimension of % A . <nl> + % n = dim % A , 1 : memref < 100x ? xf32 > <nl> + <nl> + / / Allocate memory for the multiplication result . <nl> + % C = alloc memref < 100x50xf32 > ( ) <nl> + <nl> + / / Multiplication loop nest . <nl> + for % i = 0 to 100 { <nl> + for % j = 0 to 50 { <nl> + store 0 to % C [ % i , % j ] : memref < 100x50xf32 > <nl> + for % k = 0 to % n { <nl> + % a_v = load % A [ % i , % k ] : memref < 100x ? xf32 > <nl> + % b_v = load % B [ % k , % j ] : memref < ? x50xf32 > <nl> + % prod = " mulf " ( % a_v , % b_v ) : ( f32 , f32 ) - > f32 <nl> + % c_v = load % C [ % i , % j ] : memref < 100x50xf32 > <nl> + % sum = " addf " ( % c_v , % prod ) : ( f32 , f32 ) - > f32 <nl> + store % sum to % C [ % i , % j ] : memref < 100x50xf32 > <nl> + } <nl> + } <nl> + } <nl> + return % C : memref < 100x50xf32 > <nl> + } <nl> + ` ` ` <nl> + <nl> + # # Notation { # notation } <nl> + <nl> + MLIR has a simple and unambiguous grammar , allowing it to reliably round - trip <nl> + through a textual form . This is important for development of the compiler - e . g . <nl> + understanding the state of code as it is being transformed and for writing test <nl> + cases . <nl> + <nl> + This document describes the grammar using <nl> + [ Extended Backus - Naur Form ( EBNF ) ] ( https : / / en . wikipedia . org / wiki / Extended_Backus % E2 % 80 % 93Naur_form ) . <nl> + <nl> + This is the EBNF grammar used in this document , presented in yellow boxes . <nl> + <nl> + ` ` ` { . ebnf } <nl> + alternation : : = expr0 | expr1 | expr2 / / Either expr0 or expr1 or expr2 . <nl> + sequence : : = expr0 expr1 expr2 / / Sequence of expr0 expr1 expr2 . <nl> + repetition0 : : = expr * / / 0 or more occurrences . <nl> + repetition1 : : = expr + / / 1 or more occurrences . <nl> + optionality : : = expr ? / / 0 or 1 occurrence . <nl> + grouping : : = ( expr ) / / Everything inside parens is grouped together . <nl> + literal : : = ` abcd ` / / Matches the literal ` abcd ` . <nl> + ` ` ` <nl> + <nl> + Code examples are presented in blue boxes . <nl> + <nl> + ` ` ` { . mlir } <nl> + / / This is an example use of the grammar above : <nl> + / / This matches things like : ba , bana , boma , banana , banoma , bomana . . . <nl> + example : : = ` b ` ( ` an ` | ` om ` ) * ` a ` <nl> + ` ` ` <nl> + <nl> + # # # Common syntax { # common - syntax } <nl> + <nl> + The following core grammar productions are used in this document : <nl> + <nl> + ` ` ` { . ebnf } <nl> + / / TODO : Clarify the split between lexing ( tokens ) and parsing ( grammar ) . <nl> + digit : : = [ 0 - 9 ] <nl> + hex_digit : : = [ 0 - 9a - fA - F ] <nl> + letter : : = [ a - zA - Z ] <nl> + id - punct : : = [ $ . _ - ] <nl> + <nl> + integer - literal : : = digit + | ` 0x ` hex_digit + <nl> + float - literal : : = TODO <nl> + string - literal : : = ` " ` [ ^ " \ n \ f \ v \ r ] * ` " ` TODO define escaping rules <nl> + ` ` ` <nl> + <nl> + Not listed here , but MLIR does support comments . They use standard BCPL syntax , <nl> + starting with a ` / / ` and going until the end of the line . <nl> + <nl> + # # # Identifiers and keywords { # identifiers - and - keywords } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + / / Identifiers <nl> + bare - id : : = letter ( letter | digit | [ _ ] ) * <nl> + bare - id - list : : = bare - id ( ` , ` bare - id ) * <nl> + suffix - id : : = digit + | ( ( letter | id - punct ) ( letter | id - punct | digit ) * ) <nl> + <nl> + function - id : : = ` @ ` bare - id <nl> + ssa - id : : = ` % ` suffix - id <nl> + ssa - id - list : : = ssa - id ( ` , ` ssa - id ) * <nl> + <nl> + / / Uses of an SSA value , e . g . in an operand list to an instruction . <nl> + ssa - use : : = ssa - id <nl> + ssa - use - list : : = ssa - use ( ` , ` ssa - use ) * <nl> + ` ` ` <nl> + <nl> + Identifiers name entities such as SSA values , types and functions , and are <nl> + chosen by the writer of MLIR code . Identifiers may be descriptive ( e . g . <nl> + ` % batch_size ` , ` @ matmul ` ) , or may be non - descriptive when they are <nl> + auto - generated ( e . g . ` % 23 ` , ` @ func42 ` ) . Identifier names for SSA values may be <nl> + used in an MLIR text file but are not persisted as part of the IR - the printer <nl> + will give them anonymous names like ` % 42 ` . <nl> + <nl> + MLIR guarantees identifiers never collide with keywords by prefixing identifiers <nl> + with a sigil ( e . g . ` % ` , ` # ` , ` @ ` ) . In certain unambiguous contexts ( e . g . affine <nl> + expressions ) , identifiers are not prefixed , for brevity . New keywords may be <nl> + added to future versions of MLIR without danger of collision with existing <nl> + identifiers . <nl> + <nl> + The scope of SSA values is defined based on the standard definition of <nl> + [ dominance ] ( https : / / en . wikipedia . org / wiki / Dominator_ \ ( graph_theory \ ) ) . Argument <nl> + identifiers in mapping functions are in scope for the mapping body . Function <nl> + identifiers and mapping identifiers are visible across the entire module . <nl> + <nl> + # # Polyhedral Structures { # polyhedral - structures } <nl> + <nl> + MLIR uses techniques from polyhedral compilation to make dependence analysis and <nl> + loop transformations efficient and reliable . This section introduces some of the <nl> + core concepts that are used throughout the document . <nl> + <nl> + # # # Dimensions and Symbols { # dimensions - and - symbols } <nl> + <nl> + Dimensions and symbols are the two kinds of identifiers that can appear in the <nl> + polyhedral structures , and are always of ' [ index ] ( # other - types ) ' type . <nl> + Dimensions are declared in parentheses and symbols are declared in square <nl> + brackets . <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / A 2d to 3d affine mapping . <nl> + / / d0 / d1 are dimensions , s0 is a symbol <nl> + # affine_map2to3 = ( d0 , d1 ) [ s0 ] - > ( d0 , d1 + s0 , d1 - s0 ) size ( 10 , 20 , 30 ) <nl> + ` ` ` <nl> + <nl> + Dimensional identifiers correspond to the dimensions of the underlying structure <nl> + being represented ( a map , set , or more concretely a loop nest or a tensor ) ; for <nl> + example , a three - dimensional loop nest has three dimensional identifiers . Symbol <nl> + identifiers represent an unknown quantity that can be treated as constant for a <nl> + region of interest . <nl> + <nl> + Dimensions and symbols are bound to SSA values by various operations in MLIR and <nl> + use the same parenthesized vs square bracket list to distinguish the two . <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + / / Uses of SSA values that are passed to dimensional identifiers . <nl> + dim - use - list : : = ` ( ` ssa - use - list ? ` ) ` <nl> + <nl> + / / Uses of SSA values that are used to bind symbols . <nl> + symbol - use - list : : = ` [ ` ssa - use - list ? ` ] ` <nl> + <nl> + / / Most things that bind SSA values bind dimensions and symbols . <nl> + dim - and - symbol - use - list : : = dim - use - list symbol - use - list ? <nl> + ` ` ` <nl> + <nl> + SSA values bound to dimensions and symbols must always have ' index ' type . <nl> + <nl> + In a [ CFG Function ] ( # cfg - functions ) , any SSA value can be bound to dimensional <nl> + and symbol identifiers . <nl> + <nl> + In an [ ML Function ] ( # ml - functions ) , a symbolic identifier can be bound to an SSA <nl> + value that is either an argument to the function , a value defined at the top <nl> + level of that function ( outside of all loops and if statements ) , the result of a <nl> + [ ` constant ` operation ] ( # ' constant ' - operation ) , or the result of an <nl> + [ ` affine_apply ` ] ( # ' affine_apply ' - operation ) operation that recursively takes as <nl> + arguments any symbolic identifiers . Dimensions may be bound not only to anything <nl> + that a symbol is bound to , but also to induction variables of enclosing <nl> + [ for statements ] ( # ' for ' - statement ) , and the results of an <nl> + [ ` affine_apply ` operation ] ( # ' affine_apply ' - operation ) ( which recursively may use <nl> + other dimensions and symbols ) . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + # affine_map2to3 = ( d0 , d1 ) [ s0 ] - > ( d0 , d1 + s0 , d1 - s0 ) size ( 10 , 20 , 30 ) <nl> + / / Binds % N to the s0 symbol in affine_map2to3 . <nl> + % x = alloc ( ) [ % N ] : memref < 40x50xf32 , # affine_map2to3 > <nl> + ` ` ` <nl> + <nl> + # # # Affine Expressions { # affine - expressions } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + affine - expr : : = ` ( ` affine - expr ` ) ` <nl> + | affine - expr ` + ` affine - expr <nl> + | affine - expr ` - ` affine - expr <nl> + | ` - ` ? integer - literal ` * ` affine - expr <nl> + | affine - expr ` ceildiv ` integer - literal <nl> + | affine - expr ` floordiv ` integer - literal <nl> + | affine - expr ` mod ` integer - literal <nl> + | ` - ` affine - expr <nl> + | bare - id <nl> + | ` - ` ? integer - literal <nl> + <nl> + multi - dim - affine - expr : : = ` ( ` affine - expr ( ` , ` affine - expr ) * ` ) ` <nl> + ` ` ` <nl> + <nl> + ` ceildiv ` is the ceiling function which maps the result of the division of its <nl> + first argument by its second argument to the smallest integer greater than or <nl> + equal to that result . ` floordiv ` is a function which maps the result of the <nl> + division of its first argument by its second argument to the largest integer <nl> + less than or equal to that result . ` mod ` is the modulo operation : since its <nl> + second argument is always positive , its results are always positive in our <nl> + usage . The ` integer - literal ` operand for ceildiv , floordiv , and mod is always <nl> + expected to be positive . ` bare - id ` is an identifier which must have type <nl> + [ index ] ( # other - types ) . The precedence of operations in an affine expression are <nl> + ordered from highest to lowest in the order : ( 1 ) parenthesization , ( 2 ) negation , <nl> + ( 3 ) modulo , multiplication , floordiv , and ceildiv , and ( 4 ) addition and <nl> + subtraction . All of these operators associate from left to right . <nl> + <nl> + A _multi - dimensional affine expression_ is a comma separated list of <nl> + one - dimensional affine expressions , with the entire list enclosed in <nl> + parentheses . <nl> + <nl> + * * Context : * * An affine function , informally , is a linear function plus a <nl> + constant . More formally , a function f defined on a vector $ $ \ vec { v } \ in <nl> + \ mathbb { Z } ^ n $ $ is a multidimensional affine function of $ $ \ vec { v } $ $ if <nl> + $ $ f ( \ vec { v } ) $ $ can be expressed in the form $ $ M \ vec { v } + \ vec { c } $ $ where $ $ M $ $ <nl> + is a constant matrix from $ $ \ mathbb { Z } ^ { m \ times n } $ $ and $ $ \ vec { c } $ $ is a <nl> + constant vector from $ $ \ mathbb { Z } $ $ . $ $ m $ $ is the dimensionality of such an <nl> + affine function . MLIR further extends the definition of an affine function to <nl> + allow ' floordiv ' , ' ceildiv ' , and ' mod ' with respect to positive integer <nl> + constants . Such extensions to affine functions have often been referred to as <nl> + quasi - affine functions by the polyhedral compiler community . MLIR uses the term <nl> + ' affine map ' to refer to these multi - dimensional quasi - affine functions . As <nl> + examples , $ $ ( i + j + 1 , j ) $ $ , $ $ ( i \ mod 2 , j + i ) $ $ , $ $ ( j , i / 4 , i \ mod 4 ) $ $ , $ $ ( 2i + 1 , <nl> + j ) $ $ are two - dimensional affine functions of $ $ ( i , j ) $ $ , but $ $ ( i \ cdot j , <nl> + i ^ 2 ) $ $ , $ $ ( i \ mod j , i / j ) $ $ are not affine functions of $ $ ( i , j ) $ $ . <nl> + <nl> + # # # Affine Maps { # affine - maps } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + affine - map - inline <nl> + : : = dim - and - symbol - id - lists ` - > ` multi - dim - affine - expr <nl> + ( ` size ` ` ( ` dim - size ( ` , ` dim - size ) * ` ) ` ) ? <nl> + <nl> + dim - size : : = affine - expr <nl> + | ` min ` ` ( ` affine - expr ( ` , ` affine - expr ) + ` ) ` <nl> + ` ` ` <nl> + <nl> + The identifiers in the dimensions and symbols lists must be unique . These are <nl> + the only identifiers that may appear in ' multi - dim - affine - expr ' . In addition , <nl> + only symbolic identifiers and constants can appear in ' dim - size ' . Affine maps <nl> + with one or more symbols in its specification are known as " symbolic affine <nl> + maps " , and those with no symbols as " non - symbolic affine maps " . An affine map <nl> + has an optional " size " tuple which provides the size for each corresponding <nl> + dimension . Affine maps with a size in their specification are known as " bounded <nl> + affine maps " , and those without a size are " unbounded affine maps " . <nl> + <nl> + * * Context : * * Affine maps are mathematical functions that transform a list of <nl> + dimension indices and symbols into a list of results , with affine expressions <nl> + combining the indices and symbols . Affine maps distinguish between <nl> + [ indices and symbols ] ( # dimensions - and - symbols ) because indices are inputs to the <nl> + affine map when the latter is called through an <nl> + [ affine_apply ] ( # ' affine_apply ' - operation ) operation , whereas symbols are bound <nl> + when an affine mapping is established ( e . g . when a memref is formed , <nl> + establishing a memory [ layout map ] ( # layout - map ) ) . <nl> + <nl> + Affine maps are used for various core structures in MLIR . The restrictions we <nl> + impose on their form allows powerful analysis and transformation , while keeping <nl> + the representation closed with respect to several operations of interest . <nl> + <nl> + # # # # Named affine mappings { # named - affine - mappings } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + affine - map - id : : = ` # ` suffix - id <nl> + <nl> + / / Definitions of affine maps are at the top of the file . <nl> + affine - map - def : : = affine - map - id ` = ` affine - map - inline <nl> + module - header - def : : = affine - map - def <nl> + <nl> + / / Uses of affine maps may use the inline form or the named form . <nl> + affine - map : : = affine - map - id | affine - map - inline <nl> + ` ` ` <nl> + <nl> + Affine mappings may be defined inline at the point of use , or may be hoisted to <nl> + the top of the file and given a name with an affine map definition , and used by <nl> + name . <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Affine map out - of - line definition and usage example . <nl> + # affine_map42 = <nl> + ( d0 , d1 ) [ s0 ] - > ( d0 , d0 + d1 + floordiv ( s0 , 2 ) ) size ( 10 , s0 ) <nl> + <nl> + / / Use an affine mapping definition in an alloc instruction , binding the <nl> + / / SSA value % N to the symbol s0 . <nl> + % a = alloc memref < 4x4xf32 , # affine_map42 > ( ) [ % N ] <nl> + <nl> + / / Same thing with an inline affine mapping definition . <nl> + % b = alloc memref < 4x4xf32 , ( d0 , d1 ) [ s0 ] - > ( d0 , d0 + d1 + floordiv ( s0 , 2 ) ) <nl> + size ( 10 , s0 ) > ( ) [ % N ] <nl> + ` ` ` <nl> + <nl> + # # # Semi - affine maps { # semi - affine - maps } <nl> + <nl> + Semi - affine maps are extensions of affine maps to allow multiplication , <nl> + ` floordiv ` , ` ceildiv ` , and ` mod ` with respect to symbolic identifiers . <nl> + Semi - affine maps are thus a strict superset of affine maps . <nl> + <nl> + Syntax of semi - affine expressions : <nl> + <nl> + ` ` ` { . ebnf } <nl> + semi - affine - expr : : = ` ( ` semi - affine - expr ` ) ` <nl> + | semi - affine - expr ` + ` semi - affine - expr <nl> + | semi - affine - expr ` - ` semi - affine - expr <nl> + | symbol - or - const ` * ` semi - affine - expr <nl> + | ` ceildiv ` ` ( ` semi - affine - expr ` , ` symbol - or - const ` ) ` <nl> + | ` floordiv ` ` ( ` semi - affine - expr ` , ` symbol - or - const ` ) ` <nl> + | semi - affine - expr ` mod ` symbol - or - const <nl> + | bare - id <nl> + | ` - ` ? integer - literal <nl> + <nl> + symbol - or - const : : = ` - ` ? integer - literal | symbol - id <nl> + <nl> + multi - dim - semi - affine - expr : : = ` ( ` semi - affine - expr ( ` , ` semi - affine - expr ) * ` ) ` <nl> + ` ` ` <nl> + <nl> + The precedence and associativity of operations in the syntax above is the same <nl> + as that for [ affine expressions ] ( # affine - expressions ) . <nl> + <nl> + Syntax of semi - affine maps : <nl> + <nl> + ` ` ` { . ebnf } <nl> + semi - affine - map - inline <nl> + : : = dim - and - symbol - id - lists ` - > ` multi - dim - semi - affine - expr <nl> + ( ` size ` ` ( ` dim - size ( ` , ` dim - size ) * ` ) ` ) ? <nl> + ` ` ` <nl> + <nl> + Semi - affine maps may be defined inline at the point of use , or may be hoisted to <nl> + the top of the file and given a name with a semi - affine map definition , and used <nl> + by name . <nl> + <nl> + ` ` ` { . ebnf } <nl> + semi - affine - map - id : : = ` # ` suffix - id <nl> + <nl> + / / Definitions of semi - affine maps are at the top of file . <nl> + semi - affine - map - def : : = semi - affine - map - id ` = ` semi - affine - map - inline <nl> + module - header - def : : = semi - affine - map - def <nl> + <nl> + / / Uses of semi - affine maps may use the inline form or the named form . <nl> + semi - affine - map : : = semi - affine - map - id | semi - affine - map - inline <nl> + ` ` ` <nl> + <nl> + # # # Integer Sets { # integer - sets } <nl> + <nl> + An integer set is a conjunction of affine constraints on a list of identifiers . <nl> + The identifiers associated with the integer set are separated out into two <nl> + classes : the set ' s dimension identifiers , and the set ' s symbolic identifiers . <nl> + The set is viewed as being parametric on its symbolic identifiers . In the <nl> + syntax , the list of set ' s dimension identifiers are enclosed in parentheses <nl> + while its symbols are enclosed in square brackets . <nl> + <nl> + Syntax of affine constraints : <nl> + <nl> + ` ` ` { . ebnf } <nl> + affine - constraint : : = affine - expr ` > = ` ` 0 ` <nl> + | affine - expr ` = = ` ` 0 ` <nl> + affine - constraint - conjunction : : = / * empty * / <nl> + | affine - constraint ( ` , ` affine - constraint ) * <nl> + ` ` ` <nl> + <nl> + Integer sets may be defined inline at the point of use , or may be hoisted to the <nl> + top of the file and given a name with an integer set definition , and used by <nl> + name . <nl> + <nl> + ` ` ` { . ebnf } <nl> + integer - set - id : : = ` # ` suffix - id <nl> + <nl> + integer - set - inline <nl> + : : = dim - and - symbol - id - lists ` : ` affine - constraint - conjunction <nl> + <nl> + / / Declarations of integer sets are at the top of the file . <nl> + integer - set - decl : : = integer - set - id ` = ` integer - set - inline <nl> + <nl> + / / Uses of integer sets may use the inline form or the named form . <nl> + integer - set : : = integer - set - id | integer - set - inline <nl> + ` ` ` <nl> + <nl> + The dimensionality of an integer set is the number of identifiers appearing in <nl> + dimension list of the set . The affine - constraint non - terminals appearing in the <nl> + syntax above are only allowed to contain identifiers from dims and symbols . A <nl> + set with no constraints is a set that is unbounded along all of the set ' s <nl> + dimensions . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / A example two - dimensional integer set with two symbols . <nl> + # set42 = ( d0 , d1 ) [ s0 , s1 ] <nl> + : d0 > = 0 , - d0 + s0 - 1 > = 0 , d1 > = 0 , - d1 + s1 - 1 > = 0 <nl> + <nl> + / / Inside an ML Function <nl> + if # set42 ( % i , % j ) [ % M , % N ] { <nl> + . . . <nl> + } <nl> + ` ` ` <nl> + <nl> + ` d0 ` and ` d1 ` correspond to dimensional identifiers of the set , while ` s0 ` and <nl> + ` s1 ` are symbol identifiers . <nl> + <nl> + # # Type System { # type - system } <nl> + <nl> + Each SSA value in MLIR has a type defined by the type system below . There are a <nl> + number of primitive types ( like integers ) and also aggregate types for tensors <nl> + and memory buffers . MLIR does not include complex numbers , tuples , structures , <nl> + arrays , or dictionaries . <nl> + <nl> + ` ` ` { . ebnf } <nl> + type : : = integer - type <nl> + | float - type <nl> + | other - type <nl> + | vector - type <nl> + | tensor - type <nl> + | memref - type <nl> + | function - type <nl> + <nl> + / / MLIR doesn ' t have a tuple type but functions can return multiple values . <nl> + type - list : : = type - list - parens | type <nl> + type - list - no - parens : : = type ( ` , ` type ) * <nl> + type - list - parens : : = ` ( ` ` ) ` <nl> + | ` ( ` type - list - no - parens ` ) ` <nl> + <nl> + / / This is a common way to refer to an SSA value with a specified type . <nl> + ssa - use - and - type : : = ssa - use ` : ` type <nl> + <nl> + / / Non - empty list of names and types . <nl> + ssa - use - and - type - list : : = ssa - use - and - type ( ` , ` ssa - use - and - type ) * <nl> + ` ` ` <nl> + <nl> + # # # Integer Type { # integer - type } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + / / Sized integers like i1 , i4 , i8 , i16 , i32 . <nl> + integer - type : : = ` i [ 1 - 9 ] [ 0 - 9 ] * ` <nl> + ` ` ` <nl> + <nl> + MLIR supports arbitrary precision integer types . Integer types are signless , but <nl> + have a designated width . <nl> + <nl> + * * Rationale : * * low precision integers ( like ` i2 ` , ` i4 ` etc ) are useful for <nl> + cutting edge inference work , and arbitrary precision integers are useful for <nl> + hardware synthesis ( where a 13 bit multiplier is a lot cheaper / smaller than a 16 <nl> + bit one ) . <nl> + <nl> + TODO : Need to decide on a representation for quantized integers <nl> + [ [ initial thoughts ] ( https : / / docs . google . com / document / d / 1KoVYgp - m - dgAyKwqRne2c72j0FoxpsdNgfa9DTfWGgw / edit # heading = h . jcrj8wy2uni3 ) ] . <nl> + <nl> + # # # Floating Point Types { # floating - point - types } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + / / Floating point . <nl> + float - type : : = ` f16 ` | ` bf16 ` | ` f32 ` | ` f64 ` <nl> + ` ` ` <nl> + <nl> + MLIR supports float types of certain widths that are widely used as indicated <nl> + above . <nl> + <nl> + # # # Other Types { # other - types } <nl> + <nl> + In addition to the primary integer and floating point types , and derived types , <nl> + MLIR supports some special purpose types : <nl> + <nl> + ` ` ` { . ebnf } <nl> + / / Target word - sized integer . <nl> + other - type : : = ` index ` <nl> + <nl> + / / TensorFlow specific types ( TODO : the rest ref data types ) <nl> + other - type : : = ` tf_control ` | ` tf_resource ` | ` tf_variant ` | ` tf_string ` <nl> + ` tf_complex64 ` | ` tf_complex128 ` | ` tf_f32ref ` <nl> + ` ` ` <nl> + <nl> + The ` index ` type is a signless integer whose size is equal to the natural <nl> + machine word of the target <nl> + [ [ rationale ] ( https : / / docs . google . com / document / d / 1KoVYgp - m - dgAyKwqRne2c72j0FoxpsdNgfa9DTfWGgw / edit # heading = h . arwn3cptpl7q ) ] , <nl> + and is used by the affine constructs in MLIR . <nl> + <nl> + ` tf_control ` is used in TensorFlow graphs to represent <nl> + [ control dependence edges ] ( https : / / docs . google . com / document / d / 1Iey7MfrAlBWd0nrHNdnVKvIKRoo8XHsWG5g5pi1iDV4 / edit ? ts = 5b5a0a9f # heading = h . 1dv5wuya469j ) . <nl> + <nl> + # # # Function Type { # function - type } <nl> + <nl> + ` ` ` { . ebnf } <nl> + function - type : : = type - list - parens ` - > ` type - list <nl> + ` ` ` <nl> + <nl> + MLIR supports first - class functions : the <nl> + [ ` constant ` operation ] ( # ' constant ' - operation ) produces the address of a function <nl> + as an SSA value . This SSA value may be passed to and returned from functions , <nl> + merged across control flow boundaries with <nl> + [ basic block arguments ] ( # basic - blocks ) , and called with the <nl> + [ ` call_indirect ` instruction ] ( # ' call_indirect ' - operation ) . <nl> + <nl> + Function types are also used to indicate the arguments and results of <nl> + [ operations ] ( # operations ) . <nl> + <nl> + # # # Vector Type { # vector - type } <nl> + <nl> + ` ` ` { . ebnf } <nl> + vector - type : : = ` vector ` ` < ` const - dimension - list vector - element - type ` > ` <nl> + vector - element - type : : = float - type | integer - type <nl> + <nl> + const - dimension - list : : = ( integer - literal ` x ` ) + <nl> + ` ` ` <nl> + <nl> + The vector type represents a SIMD style vector , used by target - specific <nl> + instruction sets like AVX . While the most common use is for 1D vectors ( e . g . <nl> + vector < 16 x f32 > ) we also support multidimensional registers on targets that <nl> + support them ( like TPUs ) . <nl> + <nl> + # # # Tensor Type { # tensor - type } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + tensor - type : : = ` tensor ` ` < ` dimension - list vector - element - type ` > ` <nl> + tensor - memref - element - type : : = vector - element - type | vector - type <nl> + <nl> + / / memref requires a known rank , but tensor does not . <nl> + dimension - list : : = dimension - list - ranked | ` * ` ` x ` <nl> + dimension - list - ranked : : = ( dimension ` x ` ) * <nl> + dimension : : = ` ? ` | integer - literal <nl> + ` ` ` <nl> + <nl> + SSA values of tensor type represents aggregate N - dimensional data values , and <nl> + have a known element type . It may have an unknown rank ( indicated by ` * ` ) or may <nl> + have a fixed rank with a list of dimensions . Each dimension may be a static <nl> + constant or be dynamically determined ( indicated by ` ? ` ) . <nl> + <nl> + The runtime representation of the MLIR tensor type is intentionally abstracted - <nl> + you cannot control layout or get a pointer to the data . For low level buffer <nl> + access , MLIR has a [ ` memref ` type ] ( # memref - type ) . This abstracted runtime <nl> + representation holds both the tensor data values as well as information about <nl> + the ( potentially dynamic ) shape of the tensor . The <nl> + [ ` dim ` operation ] ( # ' dim ' - operation ) returns the size of a dimension from a value <nl> + of tensor type . <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Tensor with unknown rank . <nl> + tensor < * x f32 > <nl> + <nl> + / / Known rank but unknown dimensions . <nl> + tensor < ? x ? x ? x ? x f32 > <nl> + <nl> + / / Partially known dimensions . <nl> + tensor < ? x ? x 13 x ? x f32 > <nl> + <nl> + / / Full static shape . <nl> + tensor < 17 x 4 x 13 x 4 x f32 > <nl> + ` ` ` <nl> + <nl> + # # # Memref Type { # memref - type } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + memref - type : : = ` memref ` ` < ` dimension - list - ranked tensor - memref - element - type <nl> + ( ` , ` semi - affine - map - composition ) ? ( ` , ` memory - space ) ? ` > ` <nl> + <nl> + semi - affine - map - composition : : = ( semi - affine - map ` , ` ) * semi - affine - map <nl> + memory - space : : = integer - literal / * | TODO : address - space - id * / <nl> + ` ` ` <nl> + <nl> + A ` memref ` type is a reference to a region of memory ( similar to a buffer <nl> + pointer , but more powerful ) . The buffer pointed to by a memref can be allocated , <nl> + aliased and deallocated . A memref can be used to read and write data from / to the <nl> + memory region which it references . Memref types use the same shape specifier as <nl> + tensor types , but do not allow unknown rank . <nl> + <nl> + The memory space of a memref is specified by a target - specific integer index . If <nl> + no memory space is specified , then the default memory space ( 0 ) is used . The <nl> + default space is target specific but always at index 0 . <nl> + <nl> + TODO : MLIR will eventually have target - dialects which allow symbolic use of <nl> + memory hierarchy names ( e . g . HBM , VMEM , . . . ) but we have not spec ' d the details <nl> + of that mechanism yet . Until then , this document pretends that it is valid to <nl> + refer to these memories by ` bare_id ` . <nl> + <nl> + The notionally dynamic value of a memref value includes the address of the <nl> + buffer allocated , as well as the symbols referred to by the shape , layout map , <nl> + and index maps . <nl> + <nl> + Examples of memref static type <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Identity index / layout map <nl> + # imapA = ( d0 , d1 ) - > ( d0 , d1 ) size ( 16 , 32 ) <nl> + <nl> + / / Column major layout . <nl> + # imapB = ( d0 , d1 , d2 ) [ s0 ] - > ( d2 , d1 , d0 ) size ( s0 , 4 , 16 ) <nl> + <nl> + / / The dimension list " 16x32 " defines the following 2D index space : <nl> + / / <nl> + / / { ( i , j ) : 0 < = i < 16 , 0 < = j < 32 } <nl> + / / <nl> + memref < 16x32xf32 , # imapA , hbm > <nl> + / / The dimension list " 16x4x ? " defines the following 3D index space : <nl> + / / <nl> + / / { ( i , j , k ) : 0 < = i < 16 , 0 < = j < 4 , 0 < = k < N } <nl> + / / <nl> + / / where N is a symbol which represents the runtime value of the size of <nl> + / / the third dimension . <nl> + memref < 16x4x ? xf32 , # imapB , hbm > <nl> + ` ` ` <nl> + <nl> + Symbol capture example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Affine map with symbol ' s0 ' used as offset for first dimension . <nl> + # imapA = ( d0 , d1 ) [ s0 ] - > ( d0 + s0 , d1 ) <nl> + / / Allocate memref and bind the following symbols : <nl> + / / ' % n ' is bound to the dynamic second dimension of the memref type . <nl> + / / ' % o ' is bound to the symbol ' s0 ' in the affine map of the memref type . <nl> + % n = . . . <nl> + % o = . . . <nl> + % A = < strong > alloc < / strong > ( % n ) [ % o ] : < 16x ? xf32 , # imapA > <nl> + ` ` ` <nl> + <nl> + # # # # Index Space { # index - space } <nl> + <nl> + A memref dimension list defines an index space within which the memref can be <nl> + indexed to access data . <nl> + <nl> + # # # # Index { # index } <nl> + <nl> + Data is accessed through a memref type using a multidimensional index into the <nl> + multidimensional index space defined by the memref ' s dimension list . <nl> + <nl> + Examples <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Allocates a memref with 2D index space : <nl> + / / { ( i , j ) : 0 < = i < 16 , 0 < = j < 32 } <nl> + % A = alloc ( ) : memref < 16x32xf32 , # imapA , hbm > <nl> + <nl> + / / Loads data from memref ' % A ' using a 2D index : ( % i , % j ) <nl> + % v = load % A [ % i , % j ] : memref < 16x32xf32 , # imapA , hbm > <nl> + ` ` ` <nl> + <nl> + # # # # Index Map { # index - map } <nl> + <nl> + An index map is a one - to - one [ semi - affine map ] ( # semi - affine - maps ) that <nl> + transforms a multidimensional index from one index space to another . For <nl> + example , the following figure shows an index map which maps a 2 - dimensional <nl> + index from a 2x2 index space to a 3x3 index space , using symbols ` S0 ` and ` S1 ` <nl> + as offsets . <nl> + <nl> + ! [ Index Map Example ] ( includes / img / index - map . svg ) <nl> + <nl> + The number of domain dimensions and range dimensions of an index map can be <nl> + different , but must match the number of dimensions of the input and output index <nl> + spaces on which the map operates . The index space is always non - negative and <nl> + integral . In addition , an index map must specify the size of each of its range <nl> + dimensions onto which it maps . Index map symbols must be listed in order with <nl> + symbols for dynamic dimension sizes first , followed by other required symbols . <nl> + <nl> + Index map examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Index map from [ MS , NS ] slice index space to larger [ M , N ] <nl> + / / matrix index space at slice offset symbols OI , OJ : <nl> + / / Maps from [ MS , NS ] - > [ M , N ] <nl> + # imap_slice = ( i , j ) [ M , N , OI , OJ ] - > ( i + OI , j + OJ ) size ( M , N ) <nl> + <nl> + / / Index map from 4 - dimensional tiled index space to <nl> + / / 2 - dimensional index space . <nl> + / / Maps from [ M / 128 , N / 128 , 128 , 128 ] - > [ M , N ] <nl> + # imap_tiled = ( d0 , d1 , d2 , d3 ) [ M , N ] - > ( 128 * d0 + d2 , 128 * d1 + d3 ) <nl> + size ( M , N ) <nl> + ` ` ` <nl> + <nl> + # # # # Layout Map { # layout - map } <nl> + <nl> + A layout map is a [ semi - affine map ] ( # semi - affine - maps ) which encodes logical to <nl> + physical index space mapping , by mapping input dimensions to their ordering from <nl> + most - major ( slowest varying ) to most - minor ( fastest varying ) . Therefore , an <nl> + identity layout map corresponds to a row - major layout . <nl> + <nl> + Layout map examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / MxN matrix stored in row major layout in memory : <nl> + # layout_map_row_major = ( i , j ) [ M , N ] - > ( i , j ) size ( M , N ) <nl> + <nl> + / / MxN matrix stored in column major layout in memory : <nl> + # layout_map_col_major = ( i , j ) , [ M , N ] - > ( j , i ) size ( M , N ) <nl> + ` ` ` <nl> + <nl> + # # # # Affine Map Composition { # affine - map - composition } <nl> + <nl> + A memref specifies a semi - affine map composition as part of its type . A <nl> + semi - affine map composition is a composition of semi - affine maps beginning with <nl> + zero or more index maps , and ending with a layout map . The composition must be <nl> + conformant : the number of dimensions of the range of one map , must match the <nl> + number of dimensions of the domain of the next map in the composition . <nl> + <nl> + The semi - affine map composition specified in the memref type , maps from accesses <nl> + used to index the memref in load / store instructions to other index spaces ( i . e . <nl> + logical to physical index mapping ) . Each of the <nl> + [ semi - affine maps ] ( # semi - affine - maps ) and thus its composition is required to be <nl> + one - to - one . <nl> + <nl> + The semi - affine map composition can be used in dependence analysis , memory <nl> + access pattern analysis , and for performance optimizations like vectorization , <nl> + copy elision and in - place updates . If an affine map composition is not specified <nl> + for the memref , the identity affine map is assumed . <nl> + <nl> + # # Attributes { # attributes } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + attribute - dict : : = ` { ` ` } ` <nl> + | ` { ` attribute - entry ( ` , ` attribute - entry ) * ` } ` <nl> + attribute - entry : : = bare - id ` : ` attribute - value <nl> + ` ` ` <nl> + <nl> + Attributes are the mechanism for specifying constant data in MLIR in places <nl> + where a variable is never allowed - e . g . the index of a <nl> + [ ` dim ` operation ] ( # ' dim ' - operation ) , or the stride of a convolution . <nl> + <nl> + Attributes have a name , and their values are represented by the following forms : <nl> + <nl> + ` ` ` { . ebnf } <nl> + attribute - value : : = bool - literal <nl> + | integer - literal <nl> + | float - literal <nl> + | string - literal <nl> + | affine - map <nl> + | type <nl> + | ` [ ` ( attribute - value ( ` , ` attribute - value ) * ) ? ` ] ` <nl> + | function - id ` : ` function - type <nl> + ` ` ` <nl> + <nl> + It is possible to attach attributes to operations , and the set of expected <nl> + attributes , their structure , and the definition of that meaning is contextually <nl> + dependent on the operation they are attached to . <nl> + <nl> + TODO : we should allow attaching attributes to functions . <nl> + <nl> + # # Module { # module } <nl> + <nl> + ` ` ` { . ebnf } <nl> + module : : = module - header - def * function * <nl> + ` ` ` <nl> + <nl> + An MLIR module may optionally have a list of header definitions ( e . g . affine <nl> + mappings ) at the top of the file , but is principally made up of a list of <nl> + functions . <nl> + <nl> + TODO : We should allow specifying a " dialect " in the module header . This will <nl> + prepopulate a symbol table with known named types and mappings ( e . g . for TPU ) <nl> + and will define the set of operations that are allowed ( allowing the verifier to <nl> + detect common errors ) . <nl> + <nl> + # # Functions { # functions } <nl> + <nl> + MLIR has three kinds of functions : external functions ( functions with bodies <nl> + that are defined outside of this module ) , [ CFGFunctions ] ( # cfg - functions ) and <nl> + [ MLFunctions ] ( # ml - functions ) , each of which are described below . <nl> + <nl> + ` ` ` { . ebnf } <nl> + function : : = ext - func | cfg - func | ml - func <nl> + ` ` ` <nl> + <nl> + The different kinds of function affect the structure and sort of code that can <nl> + be represented inside of the function , but callers are unaffected by the choice <nl> + of representation , and all functions have the same caller side capabilities . <nl> + <nl> + # # # External Functions { # external - functions } <nl> + <nl> + External functions are a declaration that a function exists , without a <nl> + definition of its body . It is used when referring to things defined outside of <nl> + the current module . <nl> + <nl> + ` ` ` { . ebnf } <nl> + argument - list : : = type ( ` , ` type ) * | / * empty * / <nl> + function - signature : : = function - id ` ( ` argument - list ` ) ` ( ` - > ` type - list ) ? <nl> + ext - func : : = ` extfunc ` function - signature ( ` attributes ` attribute - dict ) ? <nl> + ` ` ` <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + extfunc @ abort ( ) <nl> + extfunc @ scribble ( i32 , i64 , memref < ? x 128 x f32 , # layout_map0 > ) - > f64 <nl> + ` ` ` <nl> + <nl> + TODO : This will eventually be expanded include mod - ref sets <nl> + ( read / write / may_read / may_write ) and attributes . <nl> + <nl> + # # # CFG Functions { # cfg - functions } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + cfg - func : : = ` cfgfunc ` function - signature <nl> + ( ` attributes ` attribute - dict ) ? ` { ` basic - block + ` } ` <nl> + ` ` ` <nl> + <nl> + A simple CFG function that returns its argument twice looks like this : <nl> + <nl> + ` ` ` { . mlir } <nl> + cfgfunc @ count ( i64 ) - > ( i64 , i64 ) <nl> + attributes { fruit : " banana " } { <nl> + bb0 ( % x : i64 ) : <nl> + return % x , % x : i64 , i64 <nl> + } <nl> + ` ` ` <nl> + <nl> + * * Context : * * CFG functions are capable of representing arbitrary computation at <nl> + either a high - or low - level : for example , they can represent an entire <nl> + TensorFlow dataflow graph , where the instructions are TensorFlow " ops " producing <nl> + values of Tensor type . It can also represent scalar math , and can be used as a <nl> + way to lower [ ML Functions ] ( # ml - functions ) before late code generation . <nl> + <nl> + # # # # Basic Blocks { # basic - blocks } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + basic - block : : = bb - label operation * terminator - stmt <nl> + bb - label : : = bb - id bb - arg - list ? ` : ` <nl> + bb - id : : = bare - id <nl> + ssa - id - and - type : : = ssa - id ` : ` type <nl> + <nl> + / / Non - empty list of names and types . <nl> + ssa - id - and - type - list : : = ssa - id - and - type ( ` , ` ssa - id - and - type ) * <nl> + <nl> + bb - arg - list : : = ` ( ` ssa - id - and - type - list ? ` ) ` <nl> + ` ` ` <nl> + <nl> + A [ basic block ] ( https : / / en . wikipedia . org / wiki / Basic_block ) is a sequential list <nl> + of operation instructions without control flow ( calls are not considered control <nl> + flow for this purpose ) that are executed from top to bottom . The last <nl> + instruction in a basic block is a <nl> + [ terminator instruction ] ( # terminator - instructions ) , which ends the block . <nl> + <nl> + Basic blocks in MLIR take a list of arguments , which represent SSA PHI nodes in <nl> + a functional notation . The arguments are defined by the block , and values are <nl> + provided for these basic block arguments by branches that go to the block . <nl> + <nl> + Here is a simple example function showing branches , returns , and basic block <nl> + arguments : <nl> + <nl> + ` ` ` { . mlir } <nl> + cfgfunc @ simple ( i64 , i1 ) - > i64 { <nl> + bb0 ( % a : i64 , % cond : i1 ) : / / Code dominated by bb0 may refer to % a <nl> + br_cond % cond , bb1 , bb2 <nl> + <nl> + bb1 : <nl> + br bb3 ( % a : i64 ) / / Branch passes % a as the argument <nl> + <nl> + bb2 : <nl> + % b = " add " ( % a , % a ) : ( i64 , i64 ) - > i64 <nl> + br bb3 ( % b : i64 ) / / Branch passes % b as the argument <nl> + <nl> + / / bb3 receives an argument , named % c , from predecessors <nl> + bb3 ( % c : i64 ) : <nl> + return % c : i64 <nl> + } <nl> + ` ` ` <nl> + <nl> + * * Context : * * The " basic block argument " representation eliminates a number of <nl> + special cases from the IR compared to traditional " PHI nodes are instructions " <nl> + SSA IRs ( like LLVM ) . For example , the <nl> + [ parallel copy semantics ] ( http : / / citeseerx . ist . psu . edu / viewdoc / download ? doi = 10 . 1 . 1 . 524 . 5461 & rep = rep1 & type = pdf ) <nl> + of SSA is immediately apparent , and function arguments are no longer a special <nl> + case : they become arguments to the entry block <nl> + [ [ more rationale ] ( https : / / docs . google . com / document / d / 1KoVYgp - m - dgAyKwqRne2c72j0FoxpsdNgfa9DTfWGgw / edit # heading = h . g4uupswp6cjn ) ] . <nl> + <nl> + Control flow within a CFG function is implemented with unconditional branches , <nl> + conditional branches , and a return statement . <nl> + <nl> + TODO : We can add <nl> + [ switches ] ( http : / / llvm . org / docs / LangRef . html # switch - instruction ) , <nl> + [ indirect gotos ] ( http : / / llvm . org / docs / LangRef . html # indirectbr - instruction ) , etc <nl> + if / when there is demand . <nl> + <nl> + # # # # Terminator instructions { # terminator - instructions } <nl> + <nl> + # # # # # ' br ' terminator instruction { # ' br ' - terminator - instruction } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + terminator - stmt : : = ` br ` bb - id branch - use - list ? <nl> + branch - use - list : : = ` ( ` ssa - use - list ` ) ` ` : ` type - list - no - parens <nl> + ` ` ` <nl> + <nl> + The ` br ` terminator statement represents an unconditional jump to a target basic <nl> + block . The count and types of operands to the branch must align with the <nl> + arguments in the target basic block . <nl> + <nl> + The MLIR branch instruction is not allowed to target the entry block for a <nl> + function . <nl> + <nl> + # # # # # ' cond_br ' terminator instruction { # ' cond_br ' - terminator - instruction } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + terminator - stmt : : = <nl> + ` cond_br ` ssa - use ` , ` bb - id branch - use - list ? ` , ` bb - id branch - use - list ? <nl> + ` ` ` <nl> + <nl> + The ` cond_br ` terminator statement represents a conditional branch on a boolean <nl> + ( 1 - bit integer ) value . If the bit is set , then the first destination is jumped <nl> + to ; if it is false , the second destination is chosen . The count and types of <nl> + operands must align with the arguments in the corresponding target blocks . <nl> + <nl> + The MLIR conditional branch instruction is not allowed to target the entry block <nl> + for a function . The two destinations of the conditional branch instruction are <nl> + allowed to be the same . <nl> + <nl> + The following example illustrates a CFG function with a conditional branch <nl> + instruction that targets the same basic block : <nl> + <nl> + ` ` ` { . mlir } <nl> + cfgfunc @ select ( % a : i32 , % b : i32 , % flag : i1 ) - > i32 { <nl> + bb0 : <nl> + / / Both targets are the same , operands differ <nl> + cond_br % flag : i1 , bb1 ( % a : i32 ) , bb1 ( % b : i32 ) <nl> + <nl> + bb1 ( % x : i32 ) : <nl> + return % x : i32 <nl> + } <nl> + ` ` ` <nl> + <nl> + # # # # # ' return ' terminator instruction { # ' return ' - terminator - instruction } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + terminator - stmt : : = ` return ` ( ssa - use - list ` : ` type - list - no - parens ) ? <nl> + ` ` ` <nl> + <nl> + The ` return ` terminator statement represents the completion of a cfg function , <nl> + and produces the result values . The count and types of the operands must match <nl> + the result types of the enclosing function . It is legal for multiple blocks in a <nl> + single function to return . <nl> + <nl> + # # # ML Functions { # ml - functions } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + ml - func : : = ` mlfunc ` ml - func - signature <nl> + ( ` attributes ` attribute - dict ) ? ` { ` stmt * return - stmt ` } ` <nl> + <nl> + ml - argument : : = ssa - id ` : ` type <nl> + ml - argument - list : : = ml - argument ( ` , ` ml - argument ) * | / * empty * / <nl> + ml - func - signature : : = function - id ` ( ` ml - argument - list ` ) ` ( ` - > ` type - list ) ? <nl> + <nl> + stmt : : = operation | for - stmt | if - stmt <nl> + ` ` ` <nl> + <nl> + The body of an ML Function is made up of nested affine for loops , conditionals , <nl> + and [ operation ] ( # operations ) statements , and ends with a return statement . Each <nl> + of the control flow statements is made up a list of instructions and other <nl> + control flow statements . <nl> + <nl> + While ML Functions are restricted to affine loops and conditionals , they may <nl> + freely call ( and be called ) by CFG Functions which do not have these <nl> + restrictions . As such , the expressivity of MLIR is not restricted in general ; <nl> + one can choose to apply MLFunctions when it is beneficial . <nl> + <nl> + # # # # ' return ' statement { # ' return ' - statement } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + return - stmt : : = ` return ` ssa - use - and - type - list ? <nl> + ` ` ` <nl> + <nl> + The arity and operand types of the return statement must match the result of the <nl> + enclosing function . <nl> + <nl> + # # # # ' for ' statement { # ' for ' - statement } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + for - stmt : : = ` for ` ssa - id ` = ` lower - bound ` to ` upper - bound <nl> + ( ` step ` integer - literal ) ? ` { ` stmt * ` } ` <nl> + <nl> + lower - bound : : = ` max ` ? affine - map dim - and - symbol - use - list | shorthand - bound <nl> + upper - bound : : = ` min ` ? affine - map dim - and - symbol - use - list | shorthand - bound <nl> + shorthand - bound : : = ssa - id | ` - ` ? integer - literal <nl> + ` ` ` <nl> + <nl> + The ` for ` statement in an ML Function represents an affine loop nest , defining <nl> + an SSA value for its induction variable . This SSA value always has type <nl> + [ ` index ` ] ( # other - types ) , which is the size of the machine word . <nl> + <nl> + The ` for ` statement executes its body a number of times iterating from a lower <nl> + bound to an upper bound by a stride . The stride , represented by ` step ` , is a <nl> + positive constant integer which defaults to " 1 " if not present . The lower and <nl> + upper bounds specify a half - open range : the range includes the lower bound but <nl> + does not include the upper bound . <nl> + <nl> + The lower and upper bounds of a ` for ` statement are represented as an <nl> + application of an affine mapping to a list of SSA values passed to the map . The <nl> + [ same restrictions ] ( # dimensions - and - symbols ) hold for these SSA values as for <nl> + all bindings of SSA values to dimensions and symbols . <nl> + <nl> + The affine mappings for the bounds may return multiple results , in which case <nl> + the ` max ` / ` min ` keywords are required ( for the lower / upper bound respectively ) , <nl> + and the bound is the maximum / minimum of the returned values . There is no <nl> + semantic ambiguity , but MLIR syntax requires the use of these keywords to make <nl> + things more obvious to human readers . <nl> + <nl> + Many upper and lower bounds are simple , so MLIR accepts two shorthand syntaxes : <nl> + the form that accepts a single ' ssa - id ' ( e . g . ` % N ` ) is shorthand for applying <nl> + that SSA value to a function that maps a single symbol to itself , e . g . , <nl> + ` ( ) [ s ] - > ( s ) ( ) [ % N ] ` . The integer literal form ( e . g . ` - 42 ` ) is shorthand for a <nl> + nullary mapping function that returns the constant value ( e . g . ` ( ) - > ( - 42 ) ( ) ` ) . <nl> + <nl> + Example showing reverse iteration of the inner loop : <nl> + <nl> + ` ` ` { . mlir } <nl> + # map57 = ( d0 , d1 ) [ s0 ] - > ( d0 , s0 - d1 ) <nl> + <nl> + mlfunc @ simple_example ( % A : memref < ? x ? xf32 > , % B : memref < ? x ? xf32 > ) { <nl> + % N = dim % A , 0 : memref < ? x ? xf32 > <nl> + for % i = 0 to % N step 1 { <nl> + for % j = 0 to % N { / / implicitly steps by 1 <nl> + % 0 = affine_apply # map57 ( % i , % j ) [ % N ] <nl> + % tmp = call @ F1 ( % A , % 0 # 0 , % 0 # 1 ) : ( memref < ? x ? xf32 > , index , index ) - > ( f32 ) <nl> + call @ F2 ( % tmp , % B , % 0 # 0 , % 0 # 1 ) : ( f32 , memref < ? x ? xf32 > , index , index ) - > ( ) <nl> + } <nl> + } <nl> + return <nl> + } <nl> + ` ` ` <nl> + <nl> + # # # # ' if ' statement { # ' if ' - statement } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + if - stmt - head : : = ` if ` if - stmt - cond ` { ` stmt * ` } ` <nl> + | if - stmt - head ` else ` ` if ` if - stmt - cond ` { ` stmt * ` } ` <nl> + if - stmt - cond : : = integer - set dim - and - symbol - use - list <nl> + <nl> + if - stmt : : = if - stmt - head <nl> + | if - stmt - head ` else ` ` { ` stmt * ` } ` <nl> + ` ` ` <nl> + <nl> + The ` if ` statement in an ML Function restricts execution to a subset of the loop <nl> + iteration space defined by an integer set ( a conjunction of affine constraints ) . <nl> + A single ` if ` may have a number of optional ` else if ` clauses , and may end with <nl> + an optional ` else ` clause . <nl> + <nl> + The condition of the ` if ` is represented by an [ integer set ] ( # integer - sets ) ( a <nl> + conjunction of affine constraints ) , and the SSA values bound to the dimensions <nl> + and symbols in the integer set . The [ same restrictions ] ( # dimensions - and - symbols ) <nl> + hold for these SSA values as for all bindings of SSA values to dimensions and <nl> + symbols . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + # set = ( d0 , d1 ) [ s0 ] : ( d0 - 10 > = 0 , s0 - d0 - 9 > = 0 , <nl> + d1 - 10 > = 0 , s0 - d1 - 9 > = 0 ) <nl> + mlfunc @ reduced_domain_example ( % A , % X , % N ) : ( memref < 10xi32 > , i32 , i32 ) { <nl> + for % i = 0 to % N { <nl> + for % j = 0 to % N { <nl> + % 0 = affine_apply # map42 ( % i , % j ) <nl> + % tmp = call @ S1 ( % X , % 0 # 0 , % 0 # 1 ) <nl> + if # set ( % i , % j ) [ % N ] { <nl> + % 1 = affine_apply # map43 ( % i , % j ) <nl> + call @ S2 ( % tmp , % A , % 1 # 0 , % 1 # 1 ) <nl> + } <nl> + } <nl> + } <nl> + return <nl> + } <nl> + ` ` ` <nl> + <nl> + # # Operations { # operations } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ( ssa - id ` = ` ) ? string - literal ` ( ` ssa - use - list ? ` ) ` <nl> + attribute - dict ? ` : ` function - type <nl> + ` ` ` <nl> + <nl> + While CFG and ML Functions have two different ways of representing control flow <nl> + within their body , MLIR represents the computation within them with a uniform <nl> + concept called _operations_ . Operations in MLIR are fully extensible ( there is <nl> + no fixed list of operations ) , and have application - specific semantics . For <nl> + example , MLIR supports [ target - independent operations ] ( # memory - operations ) , <nl> + [ high - level TensorFlow ops ] ( # tensorflow - operations ) , and <nl> + [ target - specific machine instructions ] ( # target - specific - operations ) . <nl> + <nl> + The internal representation of an operation is simple : an operation is <nl> + identified by a unique string ( e . g . ` dim ` , ` tf . Conv2d ` , ` x86 . repmovsb ` , <nl> + ` ppc . eieio ` , etc ) , can return zero or more results , take zero or more SSA <nl> + operands , and may have zero or more attributes . When parsed or printed in the <nl> + raw form , these are all printed literally , and a function type is used to <nl> + indicate the types of the results and operands . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Invoke a TensorFlow function called tf . scramble with two inputs <nl> + / / and an attribute " fruit " . <nl> + % 2 = " tf . scramble " ( % 42 , % 12 ) { fruit : " banana " } : ( f32 , i32 ) - > f32 <nl> + <nl> + / / Invoke the TPU specific add instruction that takes two vector register <nl> + / / as input and produces a vector register . <nl> + % 7 = " tpu . add " ( % 42 , % 12 ) <nl> + : ( vector < 8x128xf32 > , vector < 8x128xf32 > ) - > vector < 8x128xf32 > <nl> + ` ` ` <nl> + <nl> + In addition to the basic syntax above , applications may register tables of known <nl> + operations . This allows those applications to support custom syntax for parsing <nl> + and printing operations . In the operation sets listed below , we show both forms . <nl> + <nl> + * * Context : * * TensorFlow has an open " op " ecosystem , and we directly apply these <nl> + ideas to the design of MLIR , but generalize it much further . To make it easy to <nl> + reason about IR dumps and manipulate operations in C + + , the MLIR compiler <nl> + infrastructure uses C + + templates to make working with them convenient and safe . <nl> + The details of this are not described in this document . <nl> + <nl> + # # Standard Operations { # standard - operations } <nl> + <nl> + TODO : shape , which returns a 1D tensor , and can take an unknown rank tensor as <nl> + input . <nl> + <nl> + TODO : rank , which returns an index . <nl> + <nl> + # # # Core Operations { # core - operations } <nl> + <nl> + # # # # ' affine_apply ' operation { # ' affine_apply ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` affine_apply ` affine - map dim - and - symbol - use - list <nl> + ` ` ` <nl> + <nl> + The ` affine_apply ` instruction applies an [ affine mapping ] ( # affine - expressions ) <nl> + to a list of SSA values , yielding another list of SSA values . The number of <nl> + dimension and symbol arguments to affine_apply must be equal to the respective <nl> + number of dimensional and symbolic inputs to the affine mapping , and the number <nl> + of results is the dimensionality of the range of the affine mapping . The input <nl> + SSA values must all have ' index ' type , and the results are all of ' index ' type . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + # map10 = ( d0 , d1 ) - > ( floordiv ( d0 , 8 ) , floordiv ( d1 , 128 ) , <nl> + d0 mod 8 , d1 mod 128 ) <nl> + . . . <nl> + % 1 = affine_apply # map10 ( % s , % t ) <nl> + <nl> + / / Inline example . <nl> + % 2 = affine_apply ( i ) [ s0 ] - > ( i + s0 ) ( % 42 ) [ % n ] <nl> + ` ` ` <nl> + <nl> + # # # # ' call ' operation { # ' call ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = <nl> + ssa - id ` = ` ` call ` function - id ` ( ` ssa - use - list ? ` ) ` ` : ` function - type <nl> + ` ` ` <nl> + <nl> + The ` call ` operation represents a direct call to a function . The operands and <nl> + result types of the call must match the specified function type . The callee is <nl> + encoded as a function attribute named " callee " . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Calling the CFG function my_add . <nl> + % 31 = call @ my_add ( % 0 , % 1 ) : ( tensor < 16xf32 > , tensor < 16xf32 > ) - > tensor < 16xf32 > <nl> + ` ` ` <nl> + <nl> + # # # # ' call_indirect ' operation { # ' call_indirect ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` call_indirect ` ssa - use <nl> + ` ( ` ssa - use - list ? ` ) ` ` : ` function - type <nl> + ` ` ` <nl> + <nl> + The ` call_indirect ` operation represents an indirect call to a value of function <nl> + type . Functions are first class types in MLIR , and may be passed as arguments <nl> + and merged together with basic block arguments . The operands and result types of <nl> + the call must match the specified function type . <nl> + <nl> + Function values can be created with the <nl> + [ ` constant ` operation ] ( # ' constant ' - operation ) . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + % 31 = call_indirect % 15 ( % 0 , % 1 ) <nl> + : ( tensor < 16xf32 > , tensor < 16xf32 > ) - > tensor < 16xf32 > <nl> + ` ` ` <nl> + <nl> + # # # # ' dim ' operation { # ' dim ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` dim ` ssa - id ` , ` integer - literal ` : ` type <nl> + ` ` ` <nl> + <nl> + The ` dim ` operation takes a memref or tensor operand and a dimension index , and <nl> + returns an [ ' index ' ] ( # other - types ) that is the size of that dimension . <nl> + <nl> + The ` dim ` operation is represented with a single integer attribute named <nl> + ` index ` , and the type specifies the type of the memref or tensor operand . <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Always returns 4 , can be constant folded : <nl> + % x = dim % A , 0 : tensor < 4 x ? x f32 > <nl> + <nl> + / / Returns the dynamic dimension of % A . <nl> + % y = dim % A , 1 : tensor < 4 x ? x f32 > <nl> + <nl> + / / Equivalent longhand form : <nl> + % x = " dim " ( % A ) { index : 0 } : ( tensor < 4 x ? x f32 > ) - > index <nl> + % y = " dim " ( % A ) { index : 1 } : ( tensor < 4 x ? x f32 > ) - > index <nl> + ` ` ` <nl> + <nl> + # # # # ' reshape ' operation { # ' reshape ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa_id ` = ` ` reshape ` ssa - use ` : ` memref - type <nl> + dim - and - symbol - use - list ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + Reshapes the input to the requested shape . The reshape instruction creates a new <nl> + memref , but changes how the total dimension size is factored into individual <nl> + dimensions sizes as long as the products of the dimension sizes of both shapes <nl> + are the same . For example , a ` 16x16xf32 ` memref can be reshaped into a <nl> + ` 16x8x2xf32 ` one , but not to a ` 16x4xf32 ` one . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Allocate base memref with dynamic 16x ? xf32 . <nl> + # lmapD = ( i , j ) [ S0 ] - > ( i , j ) size ( 16 , S0 ) <nl> + % D = alloc < 16x ? xf32 , # lmapD , hbm > ( % N ) [ % N ] <nl> + <nl> + / / Create memref which reshapes from 16x ? xf32 to 16x4x ? xf32 . <nl> + # imapDR = ( i , j , k ) [ S0 ] - > ( i , j * S0 + k ) size ( 16 , 4 * S0 ) <nl> + % N4 = affine_apply ( S - > floordiv ( S , 4 ) ) ( % N ) <nl> + % DR = reshape % D : memref < 16x ? xf32 , # lmapD , hbm > ( % N4 ) [ % N4 ] to <nl> + ( memref < 16x ? xf32 , # lmapD , hbm > - > memref < 16x4x ? xf32 , # imapDR , hbm > ) <nl> + <nl> + ` ` ` <nl> + <nl> + # # # # ' view ' operation { # ' view ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = <nl> + ` view ` memref - type dim - use - list symbol - use - list ? ssa - id ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + Creates a view of a base memref with a potentially different index space . A view <nl> + is only defined when its index map maps to a range that is contained in the base <nl> + memref ' s index space . The element type and memory space of a view matches those <nl> + of the operand memref . <nl> + <nl> + The view instruction defines a new memref which aliases the buffer of its <nl> + operand memref , but in a new index system , specified by the index map in its <nl> + type ( and any captured symbols ) . See the figure below for an example . <nl> + <nl> + ! [ 2x2 view of 3x3 base MemRef ] ( includes / img / view - operation . svg " Illustration of a 2x2 view of a 3x3 base memref " ) <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + # map_b = ( i , j ) [ s0 , s1 ] - > ( i + s0 , j ) size ( 16 , s1 ) <nl> + <nl> + / / % B is a view of % A with a window of size 4 with offset % 0 along the <nl> + / / first dimension . The SSA value % 0 is bound to the offset symbol of <nl> + / / its index map ( # map_b ) <nl> + % n1 = dim % A , 1 : memref < 16x ? xf32 , # map_a , hbm > <nl> + % B = view memref < 16x ? xf32 , # map_a , hbm > - > memref < 4x ? xf32 , # map_b , hbm > <nl> + ( % n1 ) [ % 0 , % n1 ] % A : memref < 16x ? xf32 , # map_a , hbm > <nl> + <nl> + / / A view memref that is a dynamic sized slice along an already dynamic <nl> + / / sized base memref with the slice size being half the base memref ' s <nl> + / / dynamic size and with an offset of % 0 <nl> + # map_c = ( i , j ) [ s0 , s1 ] - > ( i + s0 , j ) size ( 4 , s1 ) <nl> + % s1 = " divi " ( % n1 , 2 ) : ( i32 , i32 ) - > i32 <nl> + % C = view memref < 16x ? xf32 , # map_a , hbm > - > memref < 4x ? xf32 , # map_c , hbm > <nl> + ( % s1 ) [ % 0 , % n1 ] % A : memref < 16x ? xf32 , # map_a , hbm > <nl> + ` ` ` <nl> + <nl> + # # # Memory Operations { # memory - operations } <nl> + <nl> + # # # # ' alloc ' operation { # ' alloc ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` alloc ` dim - and - symbol - use - list ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + Allocates a new memref of specified type . Values required for dynamic dimension <nl> + sizes are passed as arguments in parentheses ( in the same order in which they <nl> + appear in the shape signature of the memref ) while the symbols required by the <nl> + layout map are passed in the square brackets in lexicographical order . If no <nl> + layout maps are specified in the memref , then an identity mapping is used . <nl> + <nl> + The buffer referenced by a memref type is created by the ` alloc ` instruction , <nl> + and destroyed by the ` dealloc ` instruction . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Allocating memref for a fully static shape . <nl> + % A = alloc ( ) : memref < 1024x64xf32 , # layout_map0 , hbm > <nl> + <nl> + / / % M , % N , % x , % y are SSA values of integer type . M and N are bound to the <nl> + / / two unknown dimensions of the type and x / y are bound to symbols in <nl> + / / # layout_map1 . <nl> + % B = alloc ( % M , % N ) [ % x , % y ] : memref < ? x ? xf32 , # layout_map1 , vmem > <nl> + ` ` ` <nl> + <nl> + # # # # ' alloc_static ' operation { # ' alloc_static ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = <nl> + ssa - id ` = ` ` alloc_static ` ` ( ` integer - literal ` ) ` : memref - type <nl> + ` ` ` <nl> + <nl> + Allocates a new memref of specified type with a fixed base pointer location in <nl> + memory . ' alloc_static ' does not support types that have dynamic shapes or that <nl> + require dynamic symbols in their layout function ( use the <nl> + [ ` alloc ' ` instruction ] ( # ' alloc ' - operation ) in those cases ) . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + % A = alloc_static ( 0x1232a00 ) : memref < 1024 x 64 x f32 , # layout_map0 , hbm > <nl> + ` ` ` <nl> + <nl> + The ` alloc_static ` instruction is used to represent code after buffer allocation <nl> + has been performed . <nl> + <nl> + # # # # ' dealloc ' operation { # ' dealloc ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ` dealloc ` ssa - use ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + Delineates the end of the lifetime of the memory corresponding to a memref <nl> + allocation . It is paired with an [ ` alloc ` ] ( # ' alloc ' - operation ) or <nl> + [ ` alloc_static ` ] ( # ' alloc_static ' - operation ) instruction . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + dealloc % A : memref < 128 x f32 , # layout , hbm > <nl> + ` ` ` <nl> + <nl> + # # # # ' dma_start ' operation <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ` dma_start ` ssa - use ` [ ` ssa - use - list ` ] ` , <nl> + ssa - use ` [ ` ssa - use - list ` ] ` , ssa - use , <nl> + ssa - use ` [ ` ssa - use - list ` ] ` <nl> + ` : ` memref - type , memref - type , memref - type <nl> + ` ` ` <nl> + <nl> + Starts a non - blocking DMA operation that transfers data from a source memref to <nl> + a destination memref . The operands include the source and destination memref ' s <nl> + each followed by its indices , size of the data transfer in terms of the number <nl> + of elements ( of the elemental type of the memref ) , and a tag memref with its <nl> + indices . The tag location is used by a dma_wait operation to check for <nl> + completion . The indices of the source memref , destination memref , and the tag <nl> + memref have the same restrictions as any load / store instruction in an MLFunction <nl> + ( whenever DMA operations appear in ML Functions ) . This allows powerful static <nl> + analysis and transformations in the presence of such DMAs including <nl> + rescheduling , pipelining / overlap with computation , and checking for matching <nl> + start / end operations . The source and destination memref need not be of the same <nl> + dimensionality , but need to have the same elemental type . <nl> + <nl> + For example , a ` dma_start ` operation that transfers 32 vector elements from a <nl> + memref ` % src ` at location ` [ % i , % j ] ` to memref ` % dst ` at ` [ % k , % l ] ` would be <nl> + specified as shown below . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + % size = constant 32 : index <nl> + % tag = alloc ( ) : memref < 1 x i32 , ( d0 ) - > ( d0 ) , 4 > <nl> + % idx = constant 0 : index <nl> + dma_start % src [ % i , % j ] , % dst [ % k , % l ] , % size , % tag [ % idx ] : <nl> + memref < 40 x 8 x vector < 16xf32 > , ( d0 ) - > ( d0 ) , 0 > , <nl> + memref < 2 x 4 x vector < 16xf32 > , ( d0 ) - > ( d0 ) , 2 > , <nl> + memref < 1 x i32 > , ( d0 ) - > ( d0 ) , 4 > <nl> + ` ` ` <nl> + <nl> + # # # # ' dma_wait ' operation <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` <nl> + operation : : = ` dma_wait ` ssa - use ` [ ` ssa - use - list ` ] ` , ssa - use ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + Blocks until the completion of a DMA operation associated with the tag element <nl> + specified with a tag memref and its indices . The operands include the tag memref <nl> + followed by its indices and the number of elements associated with the DMA being <nl> + waited on . The indices of the tag memref have the same restrictions as <nl> + load / store indices when appearing in MLFunctions . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + dma_wait % tag [ % index ] , % num_elements : memref < 1 x i32 , ( d0 ) - > ( d0 ) , 4 > <nl> + ` ` ` <nl> + <nl> + # # # # ' extract_element ' operation { # ' extract_element ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` <nl> + operation : : = ssa - id ` = ` ` extract_element ` ssa - use ` [ ` ssa - use - list ` ] ` ` : ` type <nl> + ` ` ` <nl> + <nl> + The ` extract_element ` op reads a tensor or vector and returns one element from <nl> + it specified by an index list . The output of the ' extract_element ' is a new <nl> + value with the same type as the elements of the tensor or vector . The arity of <nl> + indices matches the rank of the accessed value ( i . e . , if a tensor is of rank 3 , <nl> + then 3 indices are required for the extract . The indices should all be of <nl> + ` affine_int ` type . <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + % 3 = extract_element % v [ % 1 , % 2 ] : vector < 4x4xi32 > <nl> + % 4 = extract_element % t [ % 1 , % 2 ] : tensor < 4x4xi32 > <nl> + % 5 = extract_element % ut [ % 1 , % 2 ] : tensor < * xi32 > <nl> + ` ` ` <nl> + <nl> + # # # # ' load ' operation { # ' load ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` load ` ssa - use ` [ ` ssa - use - list ` ] ` ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + The ` load ` op reads an element from a memref specified by an index list . The <nl> + output of load is a new value with the same type as the elements of the memref . <nl> + The arity of indices is the rank of the memref ( i . e . , if the memref loaded from <nl> + is of rank 3 , then 3 indices are required for the load following the memref <nl> + identifier ) . <nl> + <nl> + In an MLFunction , the indices of a load are restricted to SSA values bound to <nl> + surrounding loop induction variables , [ symbols ] ( # dimensions - and - symbols ) , <nl> + results of a [ ` constant ` operation ] ( # ' constant ' - operation ) , or the results of an <nl> + ` affine_apply ` operation that can in turn take as arguments all of the <nl> + aforementioned SSA values or the recursively results of such an ` affine_apply ` <nl> + operation . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + # remap1 = ( d0 , d1 ) - > ( 4 * d0 , d1 + 1 ) <nl> + # remap2 = ( d0 ) - > ( 2 * d0 + 1 ) <nl> + . . . <nl> + % 1 = affine_apply # remap1 ( % i , % j ) <nl> + % 12 = load % A [ % 1 # 0 , % 1 # 1 ] : memref < 4x ? xi32 , # layout , hbm > <nl> + <nl> + / / Example of an indirect load ( treated as non - affine ) <nl> + % 2 = affine_apply # remap2 ( % 12 ) <nl> + % 13 = load % A [ % 2 , % 1 # 1 ] : memref < 4x ? xi32 , # layout , hbm > <nl> + ` ` ` <nl> + <nl> + * * Context : * * The ` load ` and ` store ` instructions are specifically crafted to <nl> + fully resolve a reference to an element of a memref , and ( in an ML function ) the <nl> + compiler can follow use - def chains ( e . g . through <nl> + [ ` affine_apply ` ] ( # ' affine_apply ' - operation ) operations ) to precisely analyze <nl> + references at compile - time using polyhedral techniques . This is possible because <nl> + of the [ restrictions on dimensions and symbols ] ( # dimensions - and - symbols ) in ML <nl> + functions . <nl> + <nl> + # # # # ' store ' operation { # ' store ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ` store ` ssa - use ` , ` ssa - use <nl> + ` [ ` ssa - use - list ` ] ` ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + Store value to memref location given by indices . The value stored should have <nl> + the same type as the elemental type of the memref . The number of arguments <nl> + provided within brackets need to match the rank of the memref . <nl> + <nl> + In an MLFunction , the indices of a store are restricted to SSA values bound to <nl> + surrounding loop induction variables , [ symbols ] ( # dimensions - and - symbols ) , <nl> + results of a [ ` constant ` operation ] ( # ' constant ' - operation ) , or the results of an <nl> + [ ` affine_apply ` ] ( # ' affine_apply ' - operation ) operation that can in turn take as <nl> + arguments all of the aforementioned SSA values or the recursively results of <nl> + such an ` affine_apply ` operation . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + store % 100 , % A [ % 1 , 1023 ] : memref < 4x ? xf32 , # layout , hbm > <nl> + ` ` ` <nl> + <nl> + * * Context : * * The ` load ` and ` store ` instructions are specifically crafted to <nl> + fully resolve a reference to a scalar member of a memref , and ( in an ML <nl> + function ) the compiler can follow use - def chains ( e . g . through <nl> + [ ` affine_apply ` ] ( # ' affine_apply ' - operation ) operations ) to precisely analyze <nl> + references at compile - time using polyhedral techniques . This is possible because <nl> + of the [ restrictions on dimensions and symbols ] ( # dimensions - and - symbols ) in ML <nl> + functions . <nl> + <nl> + # # # # ' tensor_load ' operation { # ' tensor_load ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` tensor_load ` ssa - use - and - type <nl> + ` ` ` <nl> + <nl> + Create a tensor from a memref , making an independent copy of the element data . <nl> + The result value is a tensor whose shape and element type match the memref <nl> + operand . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Produces a value of tensor < 4x ? xf32 > type . <nl> + % 12 = tensor_load % 10 : memref < 4x ? xf32 , # layout , hbm > <nl> + ` ` ` <nl> + <nl> + # # # # ' tensor_store ' operation { # ' tensor_store ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ` tensor_store ` ssa - use ` , ` ssa - use ` : ` memref - type <nl> + ` ` ` <nl> + <nl> + Stores the contents of a tensor into a memref . The first operand is a value of <nl> + tensor type , the second operand is a value of memref type . The shapes and <nl> + element types of these must match , and are specified by the memref type . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + % 9 = dim % 8 , 1 : tensor < 4x ? xf32 > <nl> + % 10 = alloc ( % 9 ) : memref < 4x ? xf32 , # layout , hbm > <nl> + tensor_store % 8 , % 10 : memref < 4x ? xf32 , # layout , hbm > <nl> + ` ` ` <nl> + <nl> + # # # Arithmetic Operations { # arithmetic - operations } <nl> + <nl> + Basic arithmetic in MLIR is specified by standard operations described in this <nl> + section . <nl> + <nl> + TODO : " sub " etc . Let ' s not get excited about filling this out yet , we can define <nl> + these on demand . We should be highly informed by and learn from the operations <nl> + supported by HLO and LLVM . <nl> + <nl> + # # # # ' addi ' operation { # ' addi ' - operation } <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Scalar addition . <nl> + % a = addi % b , % c : i64 <nl> + <nl> + / / SIMD vector element - wise addition , e . g . for Intel SSE . <nl> + % f = addi % g , % h : vector < 4xi32 > <nl> + <nl> + / / Tensor element - wise addition , analogous to HLO ' s add operation . <nl> + % x = addi % y , % z : tensor < 4x ? xi8 > <nl> + ` ` ` <nl> + <nl> + The ` addi ` operation takes two operands and returns one result , each of these is <nl> + required to be the same type . This type may be an integer scalar type , a vector <nl> + whose element type is integer , or a tensor of integers . It has no standard <nl> + attributes . <nl> + <nl> + # # # # ' addf ' operation { # ' addf ' - operation } <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Scalar addition . <nl> + % a = addf % b , % c : f64 <nl> + <nl> + / / SIMD vector addition , e . g . for Intel SSE . <nl> + % f = addf % g , % h : vector < 4xf32 > <nl> + <nl> + / / Tensor addition , analogous to HLO ' s add operation . <nl> + % x = addf % y , % z : tensor < 4x ? xbf16 > <nl> + ` ` ` <nl> + <nl> + The ` addf ` operation takes two operands and returns one result , each of these is <nl> + required to be the same type . This type may be a floating point scalar type , a <nl> + vector whose element type is a floating point type , or a floating point tensor . <nl> + <nl> + It has no standard attributes . <nl> + <nl> + TODO : In the distant future , this will accept <nl> + optional attributes for fast math , contraction , rounding mode , and other <nl> + controls . <nl> + <nl> + # # # # ' cmpi - slt ' operation { # ' cmpi - slt ' - operation } <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Scalar compare . <nl> + % x = " cmpi - slt " ( % lhs , % rhs ) : ( i32 , i32 ) - > i1 <nl> + <nl> + / / Vector compare . <nl> + % x = " cmpi - slt " ( % lhs , % rhs ) <nl> + : ( vector < 4xi32 > , vector < 4xi32 > ) - > vector < 4xi1 > <nl> + ` ` ` <nl> + <nl> + The ` cmpi - slt ` operation takes two integer operands and returns an i1 if the <nl> + first operand is less than the second operand when interpreted as signed <nl> + integers . " cmpi - slt " also allows tensor and vector operands of integer types , in <nl> + which case it returns a matching shape tensor or vector of ' i1 ' values . <nl> + <nl> + TODO : This is just an example of a comparison . We will probably end up having a <nl> + cmpi / cmpf split , and have each of them take a condition as an attribute <nl> + [ [ rationale ] ( https : / / docs . google . com / document / d / 1KoVYgp - m - dgAyKwqRne2c72j0FoxpsdNgfa9DTfWGgw / edit # heading = h . z6f280u1zx10 ) ] . <nl> + <nl> + # # # # ' constant ' operation { # ' constant ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` constant ` attribute - value ` : ` type <nl> + ` ` ` <nl> + <nl> + The ` constant ` operation produces an SSA value equal to some constant specified <nl> + by an attribute . This is the way that MLIR uses to form simple integer and <nl> + floating point constants , as well as more exotic things like references to <nl> + functions and ( TODO ! ) tensor / vector constants . <nl> + <nl> + The ` constant ` operation is represented with a single attribute named " value " . <nl> + The type specifies the result type of the operation . <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Integer constant <nl> + % 1 = constant 42 : i32 <nl> + <nl> + / / Reference to function @ myfn . <nl> + % 3 = constant @ myfn : ( tensor < 16xf32 > , f32 ) - > tensor < 16xf32 > <nl> + <nl> + / / Equivalent longhand forms <nl> + % 1 = " constant " ( ) { value : 42 } : i32 <nl> + % 3 = " constant " ( ) { value : @ myfn } <nl> + : ( ) - > ( tensor < 16xf32 > , f32 ) - > tensor < 16xf32 > <nl> + <nl> + ` ` ` <nl> + <nl> + MLIR does not allow direct references to functions in SSA operands because we <nl> + anticipate the desire to multithread the compiler , and disallowing SSA values to <nl> + directly reference a function simplifies this <nl> + [ [ rationale ] ( https : / / docs . google . com / document / d / 1KoVYgp - m - dgAyKwqRne2c72j0FoxpsdNgfa9DTfWGgw / edit # bookmark = id . wyogmdcfyqpi ) ] . <nl> + <nl> + # # # # ' memref_cast ' operation <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . ebnf } <nl> + operation : : = ssa - id ` = ` ` memref_cast ` ssa - use ` : ` type ` to ` type <nl> + ` ` ` <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Convert to a type with more known dimensions . <nl> + % 3 = memref_cast % 2 : memref < 4x ? xf32 > to memref < ? x ? xf32 > <nl> + <nl> + / / Discard static dimension information . <nl> + % 4 = memref_cast % 3 : memref < ? x ? xf32 > to tensor < 4x ? xf32 > <nl> + ` ` ` <nl> + <nl> + Convert a memref from one type to an equivalent type without changing any data <nl> + elements . The source and destination types must both be memref types with the <nl> + same element type , same mappings , same address space , and same rank , yet the <nl> + source and destination types may not be the same . The operation is invalid if <nl> + converting to a mismatching constant dimension . <nl> + <nl> + # # # # ' mulf ' operation { # ' mulf ' - operation } <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Scalar multiplication . <nl> + % a = mulf % b , % c : f64 <nl> + <nl> + / / SIMD pointwise vector multiplication , e . g . for Intel SSE . <nl> + % f = mulf % g , % h : vector < 4xf32 > <nl> + <nl> + / / Tensor pointwise multiplication , analogous to HLO ' s pointwise multiply operation . <nl> + % x = mulf % y , % z : tensor < 4x ? xbf16 > <nl> + ` ` ` <nl> + <nl> + The ` mulf ` operation takes two operands and returns one result , each of these is <nl> + required to be the same type . This type may be a floating point scalar type , a <nl> + vector whose element type is a floating point type , or a floating point tensor . <nl> + <nl> + It has no standard attributes . <nl> + <nl> + TODO : In the distant future , this will accept <nl> + optional attributes for fast math , contraction , rounding mode , and other <nl> + controls . <nl> + <nl> + # # # # ' shape_cast ' operation { # ' shape_cast ' - operation } <nl> + <nl> + Syntax : <nl> + <nl> + ` ` ` { . mlir } <nl> + operation : : = ssa - id ` = ` ` shape_cast ` ssa - use ` : ` type ` to ` type <nl> + ` ` ` <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / Convert from unknown rank to rank 2 with unknown dimension sizes . <nl> + % 2 = " shape_cast " ( % 1 ) : ( tensor < * xf32 > ) - > tensor < ? x ? xf32 > <nl> + % 2 = shape_cast % 1 : tensor < * xf32 > to tensor < ? x ? xf32 > <nl> + <nl> + / / Convert to a type with more known dimensions . <nl> + % 3 = " shape_cast " ( % 2 ) : ( tensor < ? x ? xf32 > ) - > tensor < 4x ? xf32 > <nl> + <nl> + / / Discard static dimension and rank information . <nl> + % 4 = " shape_cast " ( % 3 ) : ( tensor < 4x ? xf32 > ) - > tensor < ? x ? xf32 > <nl> + % 5 = " shape_cast " ( % 4 ) : ( tensor < ? x ? xf32 > ) - > tensor < * xf32 > <nl> + ` ` ` <nl> + <nl> + Convert a tensor from one type to an equivalent type without changing any data <nl> + elements . The source and destination types must both be tensor types with the <nl> + same element type , and the source and destination types may not be the same . <nl> + They must either have the same rank , or one may be an unknown rank . The <nl> + operation is invalid if converting to a mismatching constant dimension . <nl> + <nl> + # # TensorFlow operations { # tensorflow - operations } <nl> + <nl> + MLIR operations can represent arbitrary TensorFlow operations with a reversible <nl> + mapping . Switch and merge nodes are represented with the MLIR control flow <nl> + graph . TensorFlow dataflow operations are mapped over to MLIR operations whose <nl> + name gets a " tf . " prefix . <nl> + <nl> + The normal dtypes supported by TensorFlow are mapped onto a Tensor type with an <nl> + unknown rank . The resource and variant dtypes are mapped onto our resource and <nl> + variant type specifically ( TODO : Specify this ) . Attributes get mapped over <nl> + directly , with type attributes represented as strings . <nl> + <nl> + Examples : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / TensorFlow Add operation . <nl> + % a = " tf . Add " ( % b , % c ) <nl> + : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> + <nl> + / / TensorFlow Add operation with partially inferred shapes . <nl> + % d = " tf . Add " ( % e , % f ) <nl> + : ( tensor < ? x42x ? xf32 > , tensor < ? x42x ? xf32 > ) - > tensor < ? x42x ? xf32 > <nl> + <nl> + / / TensorFlow Conv2d operation . <nl> + % y = " tf . Conv2d " ( % input , % filter ) <nl> + { strides : [ 1 , 1 , 2 , 1 ] , padding : " SAME " , dilations : [ 2 , 1 , 1 , 1 ] } <nl> + : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> + ` ` ` <nl> + <nl> + # # Target specific operations { # target - specific - operations } <nl> + <nl> + We expect to expose many target - specific ( such as TPU - specific ) operations <nl> + directly through to MLIR . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / TPU vector add instruction <nl> + % f = " tpu . vaddf32 " ( % a , % b ) <nl> + : ( vector < 8x128xf32 > , vector < 8x128xf32 > ) - > vector < 8x128xf32 > <nl> + ` ` ` <nl> + <nl> + In addition to the LLO backend , some targets go through LLVM . LLVM has a rich <nl> + set of intrinsics for certain target - independent operations ( e . g . addition with <nl> + overflow check ) as well as providing access to target - specific operations for <nl> + the targets it supports ( e . g . vector permutation instructions ) . LLVM intrinsics <nl> + start with an " llvm . " name . <nl> + <nl> + Example : <nl> + <nl> + ` ` ` { . mlir } <nl> + / / LLVM : % x = call { i16 , i1 } @ llvm . sadd . with . overflow . i16 ( i16 % a , i16 % b ) <nl> + % x = " llvm . sadd . with . overflow . i16 " ( % a , % b ) : ( i16 , i16 ) - > ( i16 , i1 ) <nl> + ` ` ` <nl> + <nl> + These operations only work when targeting LLVM as a backend ( e . g . for CPUs and <nl> + GPUs ) , and are required to align with the LLVM definition of these intrinsics . <nl> new file mode 100644 <nl> index 0000000000000 . . 6004c2da362d1 <nl> mmm / dev / null <nl> ppp b / g3doc / includes / img / index - map . svg <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " standalone = " no " ? > <nl> + < svg <nl> + xmlns : dc = " http : / / purl . org / dc / elements / 1 . 1 / " <nl> + xmlns : cc = " http : / / creativecommons . org / ns # " <nl> + xmlns : rdf = " http : / / www . w3 . org / 1999 / 02 / 22 - rdf - syntax - ns # " <nl> + xmlns : svg = " http : / / www . w3 . org / 2000 / svg " <nl> + xmlns = " http : / / www . w3 . org / 2000 / svg " <nl> + xmlns : sodipodi = " http : / / sodipodi . sourceforge . net / DTD / sodipodi - 0 . dtd " <nl> + xmlns : inkscape = " http : / / www . inkscape . org / namespaces / inkscape " <nl> + version = " 1 . 1 " <nl> + viewBox = " 0 0 573 . 56073 250 . 77821 " <nl> + stroke - miterlimit = " 10 " <nl> + id = " svg133 " <nl> + sodipodi : docname = " index - map . svg " <nl> + width = " 573 . 56073 " <nl> + height = " 250 . 77821 " <nl> + style = " fill : none ; stroke : none ; stroke - linecap : square ; stroke - miterlimit : 10 " <nl> + inkscape : version = " 0 . 92 . 2pre0 ( 973e216 , 2017 - 07 - 25 ) " > <nl> + < metadata <nl> + id = " metadata139 " > <nl> + < rdf : RDF > <nl> + < cc : Work <nl> + rdf : about = " " > <nl> + < dc : format > image / svg + xml < / dc : format > <nl> + < dc : type <nl> + rdf : resource = " http : / / purl . org / dc / dcmitype / StillImage " / > <nl> + < dc : title > < / dc : title > <nl> + < / cc : Work > <nl> + < / rdf : RDF > <nl> + < / metadata > <nl> + < defs <nl> + id = " defs137 " / > <nl> + < sodipodi : namedview <nl> + pagecolor = " # ffffff " <nl> + bordercolor = " # 666666 " <nl> + borderopacity = " 1 " <nl> + objecttolerance = " 10 " <nl> + gridtolerance = " 10 " <nl> + guidetolerance = " 10 " <nl> + inkscape : pageopacity = " 0 " <nl> + inkscape : pageshadow = " 2 " <nl> + inkscape : window - width = " 2145 " <nl> + inkscape : window - height = " 1372 " <nl> + id = " namedview135 " <nl> + showgrid = " false " <nl> + fit - margin - top = " 0 " <nl> + fit - margin - left = " 0 " <nl> + fit - margin - right = " 0 " <nl> + fit - margin - bottom = " 0 " <nl> + inkscape : zoom = " 0 . 45 " <nl> + inkscape : cx = " 685 . 47816 " <nl> + inkscape : cy = " 101 . 31222 " <nl> + inkscape : window - x = " 413 " <nl> + inkscape : window - y = " 149 " <nl> + inkscape : window - maximized = " 0 " <nl> + inkscape : current - layer = " svg133 " / > <nl> + < clipPath <nl> + id = " p . 0 " > <nl> + < path <nl> + d = " M 0 , 0 H 1280 V 960 H 0 Z " <nl> + id = " path2 " <nl> + inkscape : connector - curvature = " 0 " <nl> + style = " clip - rule : nonzero " / > <nl> + < / clipPath > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path5 " <nl> + d = " M - 12 . 118111 , - 9 . 267716 H 1267 . 8819 V 950 . 73228 H - 12 . 118111 Z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path7 " <nl> + d = " M 94 . 598429 , 41 . 62992 H 118 . 063 V 68 . 338584 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path9 " <nl> + d = " M 94 . 598429 , 41 . 62992 H 118 . 063 V 68 . 338584 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path11 " <nl> + d = " m 111 . 1453 , 60 . 716754 q - 0 . 92188 , 0 . 765625 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 984375 0 , - 0 . 71875 0 . 32812 , - 1 . 296875 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 359375 1 . 1875 , - 0 . 546875 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 234375 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 421875 0 , - 1 - 0 . 46875 , - 1 . 421875 - 0 . 625 , - 0 . 546875 - 1 . 875 , - 0 . 546875 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 421875 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 015625 0 . 71875 , - 1 . 640625 0 . 5 , - 0 . 640625 1 . 45312 , - 0 . 984375 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 296875 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 734375 0 . 375 , 0 . 4375 0 . 51563 , 1 . 109375 0 . 0781 , 0 . 421875 0 . 0781 , 1 . 515625 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 890625 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 515625 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 671875 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 140625 - 1 . 4375 , 0 . 328125 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 421875 1 . 09375 , - 1 . 140625 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 640625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path13 " <nl> + d = " m 118 . 06299 , 41 . 62992 h 23 . 46457 v 26 . 708664 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path15 " <nl> + d = " m 118 . 06299 , 41 . 62992 h 23 . 46457 v 26 . 708664 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path17 " <nl> + d = " m 129 . 79737 , 61 . 904254 h - 1 . 51563 V 48 . 544879 h 1 . 64063 v 4 . 765625 q 1 . 04687 , - 1 . 296875 2 . 65625 , - 1 . 296875 0 . 89062 , 0 1 . 6875 , 0 . 359375 0 . 79687 , 0 . 359375 1 . 3125 , 1 . 015625 0 . 51562 , 0 . 640625 0 . 79687 , 1 . 5625 0 . 29688 , 0 . 921875 0 . 29688 , 1 . 96875 0 , 2 . 484375 - 1 . 23438 , 3 . 84375 - 1 . 21875 , 1 . 359375 - 2 . 95312 , 1 . 359375 - 1 . 70313 , 0 - 2 . 6875 , - 1 . 4375 z m - 0 . 0156 , - 4 . 90625 q 0 , 1 . 734375 0 . 48438 , 2 . 515625 0 . 76562 , 1 . 265625 2 . 09375 , 1 . 265625 1 . 07812 , 0 1 . 85937 , - 0 . 9375 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 78125 0 , - 1 . 890625 - 0 . 75 , - 2 . 796875 - 0 . 75 , - 0 . 90625 - 1 . 82812 , - 0 . 90625 - 1 . 0625 , 0 - 1 . 85938 , 0 . 9375 - 0 . 78125 , 0 . 9375 - 0 . 78125 , 2 . 703125 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path19 " <nl> + d = " m 141 . 52757 , 41 . 62992 h 23 . 46455 v 26 . 708664 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path21 " <nl> + d = " m 141 . 52757 , 41 . 62992 h 23 . 46455 v 26 . 708664 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path23 " <nl> + d = " m 158 . 07444 , 58 . 357374 1 . 60937 , 0 . 21875 q - 0 . 26562 , 1 . 65625 - 1 . 35937 , 2 . 609375 - 1 . 07813 , 0 . 9375 - 2 . 67188 , 0 . 9375 - 1 . 98437 , 0 - 3 . 1875 , - 1 . 296875 - 1 . 20312 , - 1 . 296875 - 1 . 20312 , - 3 . 71875 0 , - 1 . 578125 0 . 51562 , - 2 . 75 0 . 51563 , - 1 . 171875 1 . 57813 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57812 , 0 2 . 57812 , 0 . 796875 1 , 0 . 796875 1 . 28125 , 2 . 265625 l - 1 . 59375 , 0 . 234375 q - 0 . 23437 , - 0 . 96875 - 0 . 8125 , - 1 . 453125 - 0 . 57812 , - 0 . 5 - 1 . 39062 , - 0 . 5 - 1 . 23438 , 0 - 2 . 01563 , 0 . 890625 - 0 . 78125 , 0 . 890625 - 0 . 78125 , 2 . 8125 0 , 1 . 953125 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95313 , 0 . 875 0 . 96875 , 0 1 . 60937 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82813 , - 1 . 828125 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path25 " <nl> + d = " M 94 . 598429 , 68 . 338584 H 118 . 063 v 26 . 70866 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path27 " <nl> + d = " M 94 . 598429 , 68 . 338584 H 118 . 063 v 26 . 70866 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path29 " <nl> + d = " m 111 . 09843 , 88 . 612914 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 640625 - 0 . 96875 , - 0 . 640625 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 140625 - 0 . 53125 , - 2 . 625 0 , - 1 . 453125 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 359375 1 . 10937 , 0 . 953125 v - 4 . 796875 h 1 . 64063 v 13 . 359375 z m - 5 . 17188 , - 4 . 828125 q 0 , 1 . 859375 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 921875 1 . 84375 , 0 . 921875 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 890625 0 . 75 , - 2 . 6875 0 , - 1 . 984375 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 890625 - 0 . 73438 , 0 . 890625 - 0 . 73438 , 2 . 8125 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path31 " <nl> + d = " m 118 . 06299 , 68 . 338584 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path33 " <nl> + d = " m 118 . 06299 , 68 . 338584 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path35 " <nl> + d = " m 134 . 92237 , 85 . 503539 1 . 6875 , 0 . 203125 q - 0 . 40625 , 1 . 484375 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 296875 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 671875 0 , - 2 . 453125 1 . 25 , - 3 . 796875 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 328125 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 703125 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 453125 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 484375 1 . 01563 , - 1 . 515625 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 828125 - 0 . 78125 , - 0 . 953125 - 2 . 03125 , - 0 . 953125 - 1 . 125 , 0 - 1 . 90625 , 0 . 765625 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 015625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path37 " <nl> + d = " m 141 . 52757 , 68 . 338584 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path39 " <nl> + d = " m 141 . 52757 , 68 . 338584 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path41 " <nl> + d = " m 152 . 29319 , 88 . 612914 v - 8 . 40625 h - 1 . 45313 v - 1 . 265625 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 453125 0 . 23438 , - 0 . 640625 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 390625 1 . 67187 , - 0 . 390625 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 09375 - 0 . 95312 , - 0 . 09375 - 0 . 75 , 0 - 1 . 0625 , 0 . 328125 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 890625 h 1 . 89062 v 1 . 265625 h - 1 . 89062 v 8 . 40625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path43 " <nl> + d = " M 94 . 598429 , 95 . 047244 H 118 . 063 V 121 . 7559 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path45 " <nl> + d = " M 94 . 598429 , 95 . 047244 H 118 . 063 V 121 . 7559 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path47 " <nl> + d = " m 104 . 5203 , 116 . 11844 1 . 59375 , 0 . 23438 q 0 . 10937 , 0 . 75 0 . 5625 , 1 . 07812 0 . 60937 , 0 . 45313 1 . 67187 , 0 . 45313 1 . 14063 , 0 1 . 75 , - 0 . 45313 0 . 625 , - 0 . 45312 0 . 84375 , - 1 . 26562 0 . 125 , - 0 . 5 0 . 10938 , - 2 . 10938 - 1 . 0625 , 1 . 26563 - 2 . 67188 , 1 . 26563 - 2 , 0 - 3 . 09375 , - 1 . 4375 - 1 . 09375 , - 1 . 4375 - 1 . 09375 , - 3 . 45313 0 , - 1 . 39062 0 . 5 , - 2 . 5625 0 . 51563 , - 1 . 17187 1 . 45313 , - 1 . 79687 0 . 95312 , - 0 . 64063 2 . 25 , - 0 . 64063 1 . 70312 , 0 2 . 8125 , 1 . 375 v - 1 . 15625 h 1 . 51562 v 8 . 35938 q 0 , 2 . 26562 - 0 . 46875 , 3 . 20312 - 0 . 45312 , 0 . 9375 - 1 . 45312 , 1 . 48438 - 0 . 98438 , 0 . 54688 - 2 . 45313 , 0 . 54688 - 1 . 71875 , 0 - 2 . 79687 , - 0 . 78126 - 1 . 0625 , - 0 . 76563 - 1 . 03125 , - 2 . 34375 z m 1 . 35937 , - 5 . 8125 q 0 , 1 . 90625 0 . 75 , 2 . 78125 0 . 76563 , 0 . 875 1 . 90625 , 0 . 875 1 . 125 , 0 1 . 89063 , - 0 . 85937 0 . 76562 , - 0 . 875 0 . 76562 , - 2 . 73438 0 , - 1 . 78125 - 0 . 79687 , - 2 . 67187 - 0 . 78125 , - 0 . 90625 - 1 . 89063 , - 0 . 90625 - 1 . 09375 , 0 - 1 . 85937 , 0 . 89062 - 0 . 76563 , 0 . 875 - 0 . 76563 , 2 . 625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path49 " <nl> + d = " m 118 . 06299 , 95 . 047244 h 23 . 46457 V 121 . 7559 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path51 " <nl> + d = " m 118 . 06299 , 95 . 047244 h 23 . 46457 V 121 . 7559 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path53 " <nl> + d = " M 128 . 29737 , 115 . 32157 V 101 . 9622 h 1 . 64062 v 4 . 79687 q 1 . 14063 , - 1 . 32812 2 . 89063 , - 1 . 32812 1 . 07812 , 0 1 . 85937 , 0 . 42187 0 . 79688 , 0 . 42188 1 . 14063 , 1 . 17188 0 . 34375 , 0 . 75 0 . 34375 , 2 . 17187 v 6 . 125 h - 1 . 64063 v - 6 . 125 q 0 , - 1 . 23437 - 0 . 53125 , - 1 . 79687 - 0 . 53125 , - 0 . 5625 - 1 . 51562 , - 0 . 5625 - 0 . 71875 , 0 - 1 . 35938 , 0 . 39062 - 0 . 64062 , 0 . 375 - 0 . 92187 , 1 . 01563 - 0 . 26563 , 0 . 64062 - 0 . 26563 , 1 . 78125 v 5 . 29687 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path55 " <nl> + d = " m 141 . 52757 , 95 . 047244 h 23 . 46455 V 121 . 7559 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path57 " <nl> + d = " m 141 . 52757 , 95 . 047244 h 23 . 46455 V 121 . 7559 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path59 " <nl> + d = " m 152 . 42181 , 103 . 85282 v - 1 . 89062 h 1 . 64062 v 1 . 89062 z m 0 , 11 . 46875 v - 9 . 67187 h 1 . 64062 v 9 . 67187 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path61 " <nl> + d = " m 118 . 06299 , 196 . 8609 h 23 . 46457 v 26 . 70865 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path63 " <nl> + d = " m 118 . 06299 , 196 . 8609 h 23 . 46457 v 26 . 70865 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path65 " <nl> + d = " m 134 . 92237 , 214 . 02584 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48438 1 . 01563 , - 1 . 51563 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01562 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path67 " <nl> + d = " m 141 . 52757 , 196 . 8609 h 23 . 46455 v 26 . 70865 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path69 " <nl> + d = " m 141 . 52757 , 196 . 8609 h 23 . 46455 v 26 . 70865 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path71 " <nl> + d = " m 152 . 15257 , 217 . 13522 v - 8 . 40625 h - 1 . 45313 v - 1 . 26563 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 45312 0 . 23438 , - 0 . 64063 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67187 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95312 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89062 v 1 . 26563 h - 1 . 89062 v 8 . 40625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path73 " <nl> + d = " m 118 . 06299 , 223 . 56955 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path75 " <nl> + d = " m 118 . 06299 , 223 . 56955 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path77 " <nl> + d = " M 128 . 29737 , 243 . 84388 V 230 . 4845 h 1 . 64062 v 4 . 79688 q 1 . 14063 , - 1 . 32813 2 . 89063 , - 1 . 32813 1 . 07812 , 0 1 . 85937 , 0 . 42188 0 . 79688 , 0 . 42187 1 . 14063 , 1 . 17187 0 . 34375 , 0 . 75 0 . 34375 , 2 . 17188 v 6 . 125 h - 1 . 64063 v - 6 . 125 q 0 , - 1 . 23438 - 0 . 53125 , - 1 . 79688 - 0 . 53125 , - 0 . 5625 - 1 . 51562 , - 0 . 5625 - 0 . 71875 , 0 - 1 . 35938 , 0 . 39063 - 0 . 64062 , 0 . 375 - 0 . 92187 , 1 . 01562 - 0 . 26563 , 0 . 64063 - 0 . 26563 , 1 . 78125 v 5 . 29688 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path79 " <nl> + d = " m 141 . 52757 , 223 . 56955 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path81 " <nl> + d = " m 141 . 52757 , 223 . 56955 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path83 " <nl> + d = " m 151 . 76194 , 232 . 37513 v - 1 . 89063 h 1 . 64062 v 1 . 89063 z m 0 , 11 . 46875 V 234 . 172 h 1 . 64062 v 9 . 67188 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path85 " <nl> + d = " m 163 . 38583 , 132 . 35694 h 464 . 50394 v 64 . 50395 H 163 . 38583 Z " / > <nl> + < path <nl> + style = " fill : # 434343 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path87 " <nl> + d = " m 174 . 1202 , 159 . 27694 v - 13 . 35938 h 1 . 76563 v 13 . 35938 z m 4 . 6833 , 0 v - 9 . 67188 h 1 . 46875 v 1 . 375 q 1 . 0625 , - 1 . 59375 3 . 07813 , - 1 . 59375 0 . 875 , 0 1 . 60937 , 0 . 3125 0 . 73438 , 0 . 3125 1 . 09375 , 0 . 82813 0 . 375 , 0 . 5 0 . 51563 , 1 . 20312 0 . 0937 , 0 . 45313 0 . 0937 , 1 . 59375 v 5 . 95313 h - 1 . 64063 v - 5 . 89063 q 0 , - 1 - 0 . 20312 , - 1 . 48437 - 0 . 1875 , - 0 . 5 - 0 . 67188 , - 0 . 79688 - 0 . 48437 , - 0 . 29687 - 1 . 14062 , - 0 . 29687 - 1 . 04688 , 0 - 1 . 8125 , 0 . 67187 - 0 . 75 , 0 . 65625 - 0 . 75 , 2 . 51563 v 5 . 28125 z m 16 . 64135 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64063 - 0 . 96875 , - 0 . 64062 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14062 - 0 . 53125 , - 2 . 625 0 , - 1 . 45312 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35938 z m - 5 . 17188 , - 4 . 82813 q 0 , 1 . 85938 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92188 1 . 84375 , 0 . 92188 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89063 0 . 75 , - 2 . 6875 0 , - 1 . 98438 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89062 - 0 . 73438 , 0 . 89063 - 0 . 73438 , 2 . 8125 z m 15 . 90697 , 1 . 71875 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48438 1 . 01563 , - 1 . 51563 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 8 . 0476 , 5 . 76563 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 64063 h 2 . 04688 l 1 . 48437 , 2 . 26563 q 0 . 42188 , 0 . 64062 0 . 67188 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 15 . 76142 , 0 v - 13 . 35938 h 2 . 65625 l 3 . 15625 , 9 . 45313 q 0 . 4375 , 1 . 32812 0 . 64063 , 1 . 98437 0 . 23437 , - 0 . 73437 0 . 70312 , - 2 . 14062 l 3 . 20313 , - 9 . 29688 h 2 . 375 v 13 . 35938 h - 1 . 70313 v - 11 . 17188 l - 3 . 875 , 11 . 17188 h - 1 . 59375 l - 3 . 85937 , - 11 . 375 v 11 . 375 z m 21 . 69707 , - 1 . 1875 q - 0 . 92187 , 0 . 76562 - 1 . 76562 , 1 . 09375 - 0 . 82814 , 0 . 3125 - 1 . 79689 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98438 0 , - 0 . 71875 0 . 32812 , - 1 . 29687 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35938 1 . 1875 , - 0 . 54688 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98439 , - 0 . 23437 2 . 92189 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42187 0 , - 1 - 0 . 46875 , - 1 . 42188 - 0 . 625 , - 0 . 54687 - 1 . 87501 , - 0 . 54687 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42187 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01562 0 . 71875 , - 1 . 64062 0 . 5 , - 0 . 64063 1 . 45312 , - 0 . 98438 0 . 95313 , - 0 . 34375 2 . 18752 , - 0 . 34375 1 . 25 , 0 2 . 01562 , 0 . 29688 0 . 78125 , 0 . 28125 1 . 14063 , 0 . 73437 0 . 375 , 0 . 4375 0 . 51562 , 1 . 10938 0 . 0781 , 0 . 42187 0 . 0781 , 1 . 51562 v 2 . 1875 q 0 , 2 . 28125 0 . 10937 , 2 . 89063 0 . 10938 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70312 q - 0 . 26563 , - 0 . 51563 - 0 . 32813 , - 1 . 1875 z m - 0 . 14062 , - 3 . 67188 q - 0 . 89063 , 0 . 375 - 2 . 67189 , 0 . 625 - 1 . 01563 , 0 . 14063 - 1 . 4375 , 0 . 32813 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 93752 , 0 1 . 67189 , - 0 . 40625 0 . 75 , - 0 . 42188 1 . 09375 , - 1 . 14063 0 . 26563 , - 0 . 5625 0 . 26563 , - 1 . 64062 z m 4 . 20382 , 8 . 5625 v - 13 . 375 h 1 . 48438 v 1 . 25 q 0 . 53125 , - 0 . 73437 1 . 1875 , - 1 . 09375 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 64063 0 . 95313 , 0 . 625 1 . 4375 , 1 . 79687 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 54688 0 , 1 . 48437 - 0 . 53125 , 2 . 67187 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 82813 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70312 z m 1 . 48438 , - 8 . 48437 q 0 , 1 . 85937 0 . 75 , 2 . 76562 0 . 76562 , 0 . 89063 1 . 82812 , 0 . 89063 1 . 09375 , 0 1 . 875 , - 0 . 92188 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 76562 - 0 . 75 , - 0 . 92188 - 1 . 8125 , - 0 . 92188 - 1 . 04688 , 0 - 1 . 85938 , 0 . 98438 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 9 . 34448 , - 3 . 03125 v - 1 . 85938 h 1 . 85937 v 1 . 85938 z m 0 , 7 . 8125 v - 1 . 875 h 1 . 85937 v 1 . 875 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path89 " <nl> + d = " m 173 . 32333 , 181 . 51132 0 . 79687 , - 3 . 89063 h - 1 . 54687 v - 1 . 35937 h 1 . 8125 l 0 . 67187 , - 3 . 29688 h - 2 . 48437 v - 1 . 35937 h 2 . 76562 l 0 . 79688 , - 3 . 90625 h 1 . 35937 l - 0 . 79687 , 3 . 90625 h 2 . 875 l 0 . 79687 , - 3 . 90625 h 1 . 375 l - 0 . 79687 , 3 . 90625 h 1 . 57812 v 1 . 35937 h - 1 . 84375 l - 0 . 6875 , 3 . 29688 h 2 . 53125 v 1 . 35937 h - 2 . 8125 l - 0 . 78125 , 3 . 89063 h - 1 . 375 l 0 . 78125 , - 3 . 89063 h - 2 . 85937 l - 0 . 78125 , 3 . 89063 z m 2 . 4375 , - 5 . 25 h 2 . 85937 l 0 . 6875 , - 3 . 29688 h - 2 . 875 z m 8 . 23509 , - 6 . 45313 v - 1 . 89062 h 1 . 64063 v 1 . 89062 z m 0 , 11 . 46875 v - 9 . 67187 h 1 . 64063 v 9 . 67187 z m 4 . 14482 , 0 v - 9 . 67187 h 1 . 46875 v 1 . 35937 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14062 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45312 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23438 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79687 0 . 78125 , 0 . 79688 0 . 78125 , 2 . 45313 v 6 . 64062 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70312 - 0 . 42188 , - 0 . 26563 - 0 . 98438 , - 0 . 26563 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67188 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 21 . 85331 , - 1 . 1875 q - 0 . 92188 , 0 . 76563 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98437 0 , - 0 . 71875 0 . 32812 , - 1 . 29688 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35937 1 . 1875 , - 0 . 54687 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23438 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42188 0 , - 1 - 0 . 46875 , - 1 . 42187 - 0 . 625 , - 0 . 54688 - 1 . 875 , - 0 . 54688 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42188 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01563 0 . 71875 , - 1 . 64063 0 . 5 , - 0 . 64062 1 . 45312 , - 0 . 98437 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29687 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73438 0 . 375 , 0 . 4375 0 . 51563 , 1 . 10937 0 . 0781 , 0 . 42188 0 . 0781 , 1 . 51563 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89062 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51562 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67187 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14062 - 1 . 4375 , 0 . 32812 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42187 1 . 09375 , - 1 . 14062 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64063 z m 4 . 20384 , 8 . 5625 v - 13 . 375 h 1 . 48438 v 1 . 25 q 0 . 53125 , - 0 . 73438 1 . 1875 , - 1 . 09375 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 64062 0 . 95313 , 0 . 625 1 . 4375 , 1 . 79688 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 54687 0 , 1 . 48438 - 0 . 53125 , 2 . 67188 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 82812 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70313 z m 1 . 48438 , - 8 . 48438 q 0 , 1 . 85938 0 . 75 , 2 . 76563 0 . 76562 , 0 . 89062 1 . 82812 , 0 . 89062 1 . 09375 , 0 1 . 875 , - 0 . 92187 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 76563 - 0 . 75 , - 0 . 92187 - 1 . 8125 , - 0 . 92187 - 1 . 04688 , 0 - 1 . 85938 , 0 . 98437 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 9 . 01634 , 4 . 78125 v - 13 . 35937 h 5 . 01562 q 1 . 53125 , 0 2 . 45313 , 0 . 40625 0 . 92187 , 0 . 40625 1 . 4375 , 1 . 25 0 . 53125 , 0 . 84375 0 . 53125 , 1 . 76562 0 , 0 . 85938 - 0 . 46875 , 1 . 625 - 0 . 45313 , 0 . 75 - 1 . 39063 , 1 . 20313 1 . 20313 , 0 . 35937 1 . 85938 , 1 . 21875 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 01562 0 , 0 . 9375 - 0 . 40625 , 1 . 75 - 0 . 39063 , 0 . 79688 - 0 . 98438 , 1 . 23438 - 0 . 57812 , 0 . 4375 - 1 . 45312 , 0 . 67187 - 0 . 875 , 0 . 21875 - 2 . 15625 , 0 . 21875 z m 1 . 78125 , - 7 . 75 h 2 . 875 q 1 . 1875 , 0 1 . 6875 , - 0 . 14062 0 . 67187 , - 0 . 20313 1 . 01562 , - 0 . 67188 0 . 34375 , - 0 . 46875 0 . 34375 , - 1 . 17187 0 , - 0 . 65625 - 0 . 32812 , - 1 . 15625 - 0 . 3125 , - 0 . 51563 - 0 . 90625 , - 0 . 70313 - 0 . 59375 , - 0 . 1875 - 2 . 03125 , - 0 . 1875 h - 2 . 65625 z m 0 , 6 . 17188 h 3 . 3125 q 0 . 85937 , 0 1 . 20312 , - 0 . 0625 0 . 60938 , - 0 . 10938 1 . 01563 , - 0 . 35938 0 . 42187 , - 0 . 26562 0 . 6875 , - 0 . 75 0 . 26562 , - 0 . 48437 0 . 26562 , - 1 . 125 0 , - 0 . 75 - 0 . 39062 , - 1 . 29687 - 0 . 375 , - 0 . 54688 - 1 . 0625 , - 0 . 76563 - 0 . 67188 , - 0 . 23437 - 1 . 95313 , - 0 . 23437 h - 3 . 07812 z m 18 . 69357 , 0 v 1 . 57812 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76563 , - 1 . 04688 0 . 76563 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70313 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70312 - 0 . 70312 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17187 , - 1 . 89063 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32813 , 1 . 57812 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 0 . 95386 , 1 . 57812 5 . 125 , - 13 . 35937 h 1 . 90625 l 5 . 46875 , 13 . 35937 h - 2 . 01563 l - 1 . 54687 , - 4 . 04687 h - 5 . 59375 l - 1 . 46875 , 4 . 04687 z m 3 . 85937 , - 5 . 48437 h 4 . 53125 l - 1 . 40625 , - 3 . 70313 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76562 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54687 z m 18 . 15812 , 9 . 40625 q - 1 . 35938 , - 1 . 70313 - 2 . 29688 , - 4 - 0 . 9375 , - 2 . 29688 - 0 . 9375 , - 4 . 76563 0 , - 2 . 15625 0 . 70313 , - 4 . 14062 0 . 82812 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17187 q - 1 . 09375 , 1 . 89062 - 1 . 45312 , 2 . 70312 - 0 . 54688 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 39063 , 1 . 70313 - 0 . 39063 , 3 . 42188 0 , 4 . 375 2 . 71875 , 8 . 75 z m 9 . 3533 , - 3 . 92188 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35937 1 . 10937 , 0 . 95312 v - 4 . 79687 h 1 . 64063 v 13 . 35937 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 8 . 82886 , - 1 . 76563 q 0 , - 2 . 35937 0 . 48438 , - 3 . 79687 0 . 48437 , - 1 . 45313 1 . 4375 , - 2 . 23438 0 . 96875 , - 0 . 78125 2 . 42187 , - 0 . 78125 1 . 07813 , 0 1 . 89063 , 0 . 4375 0 . 8125 , 0 . 42188 1 . 32812 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82813 , 1 . 98438 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14062 0 , 2 . 35938 - 0 . 48438 , 3 . 8125 - 0 . 48437 , 1 . 4375 - 1 . 45312 , 2 . 23438 - 0 . 95313 , 0 . 78125 - 2 . 42188 , 0 . 78125 - 1 . 92187 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67188 , 0 q 0 , 3 . 29688 0 . 76562 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14063 , 0 1 . 90625 , - 1 . 09375 0 . 76563 , - 1 . 09375 0 . 76563 , - 4 . 375 0 , - 3 . 29687 - 0 . 76563 , - 4 . 375 - 0 . 76562 , - 1 . 07812 - 1 . 92187 , - 1 . 07812 - 1 . 125 , 0 - 1 . 79688 , 0 . 95312 - 0 . 85937 , 1 . 21875 - 0 . 85937 , 4 . 5 z m 9 . 57882 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 16 . 21036 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70312 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48437 , - 2 . 625 0 . 48438 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17188 , - 0 . 625 0 . 875 , 0 1 . 54687 , 0 . 375 0 . 6875 , 0 . 35937 1 . 10938 , 0 . 95312 v - 4 . 79687 h 1 . 64062 v 13 . 35937 z m - 5 . 17187 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07812 , 0 1 . 82812 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76562 , - 2 . 90625 - 0 . 76563 , - 0 . 9375 - 1 . 89063 , - 0 . 9375 - 1 . 07812 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73437 , 0 . 89062 - 0 . 73437 , 2 . 8125 z m 15 . 00073 , 4 . 82812 h - 1 . 64063 v - 10 . 45312 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14062 - 0 . 95312 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64062 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92187 1 . 45313 , - 1 . 78125 h 1 . 0625 z m 5 . 73507 , 3 . 92188 h - 1 . 1875 q 2 . 73438 , - 4 . 375 2 . 73438 , - 8 . 75 0 , - 1 . 71875 - 0 . 39063 , - 3 . 39063 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 35937 , - 0 . 82812 - 1 . 46875 , - 2 . 73437 h 1 . 1875 q 1 . 70313 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 98437 0 . 6875 , 4 . 14062 0 , 2 . 46875 - 0 . 9375 , 4 . 76563 - 0 . 9375 , 2 . 29687 - 2 . 28125 , 4 z m 5 . 16581 , - 0 . 21875 v - 17 . 0625 h 3 . 60937 v 1 . 35937 h - 1 . 96875 v 14 . 34375 h 1 . 96875 v 1 . 35938 z m 4 . 76144 , - 8 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54688 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92187 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35938 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54688 , - 0 . 20313 - 2 . 39063 , - 0 . 64063 - 1 . 82812 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67188 0 , - 1 0 . 57813 , - 1 . 875 0 . 57812 , - 0 . 89062 1 . 67187 , - 1 . 34375 1 . 10938 , - 0 . 45312 2 . 45313 , - 0 . 45312 1 . 48437 , 0 2 . 60937 , 0 . 48437 1 . 14063 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60938 , 0 . 92188 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14062 , - 1 . 26562 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60937 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73437 , 0 . 59375 - 0 . 73437 , 1 . 42188 0 , 0 . 71875 0 . 53125 , 1 . 17187 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48438 2 . 95312 , 0 . 84375 1 . 17188 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60937 , 2 . 01562 - 0 . 60938 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14063 , 0 . 51563 - 2 . 57813 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04687 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92188 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 38107 , - 2 . 29688 q 0 , - 2 . 35937 0 . 48438 , - 3 . 79687 0 . 48437 , - 1 . 45313 1 . 4375 , - 2 . 23438 0 . 96875 , - 0 . 78125 2 . 42187 , - 0 . 78125 1 . 07813 , 0 1 . 89063 , 0 . 4375 0 . 8125 , 0 . 42188 1 . 32812 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82813 , 1 . 98438 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14062 0 , 2 . 35938 - 0 . 48438 , 3 . 8125 - 0 . 48437 , 1 . 4375 - 1 . 45312 , 2 . 23438 - 0 . 95313 , 0 . 78125 - 2 . 42188 , 0 . 78125 - 1 . 92187 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67188 , 0 q 0 , 3 . 29688 0 . 76562 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14063 , 0 1 . 90625 , - 1 . 09375 0 . 76563 , - 1 . 09375 0 . 76563 , - 4 . 375 0 , - 3 . 29687 - 0 . 76563 , - 4 . 375 - 0 . 76562 , - 1 . 07812 - 1 . 92187 , - 1 . 07812 - 1 . 125 , 0 - 1 . 79688 , 0 . 95312 - 0 . 85937 , 1 . 21875 - 0 . 85937 , 4 . 5 z m 9 . 57883 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35938 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45313 , - 0 . 70313 q 0 . 51563 , - 0 . 21875 0 . 76563 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 9 . 5541 , - 4 . 29687 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54688 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92187 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35938 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54688 , - 0 . 20313 - 2 . 39063 , - 0 . 64063 - 1 . 82812 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67188 0 , - 1 0 . 57813 , - 1 . 875 0 . 57812 , - 0 . 89062 1 . 67187 , - 1 . 34375 1 . 10938 , - 0 . 45312 2 . 45313 , - 0 . 45312 1 . 48437 , 0 2 . 60937 , 0 . 48437 1 . 14063 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60938 , 0 . 92188 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14062 , - 1 . 26562 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60937 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73437 , 0 . 59375 - 0 . 73437 , 1 . 42188 0 , 0 . 71875 0 . 53125 , 1 . 17187 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48438 2 . 95312 , 0 . 84375 1 . 17188 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60937 , 2 . 01562 - 0 . 60938 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14063 , 0 . 51563 - 2 . 57813 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04687 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92188 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 18 . 55295 , 4 . 29687 h - 1 . 64062 v - 10 . 45312 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14062 - 0 . 95313 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64062 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92187 1 . 45312 , - 1 . 78125 h 1 . 0625 z m 7 . 39136 , 3 . 70313 h - 3 . 60938 v - 1 . 35938 h 1 . 96875 v - 14 . 34375 h - 1 . 96875 v - 1 . 35937 h 3 . 60938 z m 6 . 99161 , - 7 . 71875 v - 1 . 64063 h 5 . 03125 v 1 . 64063 z m 15 . 4783 , - 1 . 82813 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01562 , - 2 . 90625 - 7 . 01562 , - 2 . 875 v - 1 . 64062 l 8 . 84375 , 3 . 73437 z m 10 . 57825 , 9 . 76563 q - 1 . 35938 , - 1 . 70313 - 2 . 29688 , - 4 - 0 . 9375 , - 2 . 29688 - 0 . 9375 , - 4 . 76563 0 , - 2 . 15625 0 . 70313 , - 4 . 14062 0 . 82812 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17187 q - 1 . 09375 , 1 . 89062 - 1 . 45312 , 2 . 70312 - 0 . 54688 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 39063 , 1 . 70313 - 0 . 39063 , 3 . 42188 0 , 4 . 375 2 . 71875 , 8 . 75 z m 9 . 3533 , - 3 . 92188 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35937 1 . 10937 , 0 . 95312 v - 4 . 79687 h 1 . 64063 v 13 . 35937 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 8 . 82886 , - 1 . 76563 q 0 , - 2 . 35937 0 . 48437 , - 3 . 79687 0 . 48438 , - 1 . 45313 1 . 4375 , - 2 . 23438 0 . 96875 , - 0 . 78125 2 . 42188 , - 0 . 78125 1 . 07812 , 0 1 . 89062 , 0 . 4375 0 . 8125 , 0 . 42188 1 . 32813 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82812 , 1 . 98438 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14062 0 , 2 . 35938 - 0 . 48437 , 3 . 8125 - 0 . 48438 , 1 . 4375 - 1 . 45313 , 2 . 23438 - 0 . 95312 , 0 . 78125 - 2 . 42187 , 0 . 78125 - 1 . 92188 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67187 , 0 q 0 , 3 . 29688 0 . 76563 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14062 , 0 1 . 90625 , - 1 . 09375 0 . 76562 , - 1 . 09375 0 . 76562 , - 4 . 375 0 , - 3 . 29687 - 0 . 76562 , - 4 . 375 - 0 . 76563 , - 1 . 07812 - 1 . 92188 , - 1 . 07812 - 1 . 125 , 0 - 1 . 79687 , 0 . 95312 - 0 . 85938 , 1 . 21875 - 0 . 85938 , 4 . 5 z m 17 . 77778 , 4 . 4375 v - 3 . 67187 h - 3 . 64063 v - 1 . 51563 h 3 . 64063 v - 3 . 64062 h 1 . 54687 v 3 . 64062 h 3 . 64063 v 1 . 51563 h - 3 . 64063 v 3 . 67187 z m 12 . 25012 , - 2 . 14062 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54687 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92188 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54687 , - 0 . 20313 - 2 . 39062 , - 0 . 64063 - 1 . 82813 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67188 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 89062 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 45312 2 . 45312 , - 0 . 45312 1 . 48438 , 0 2 . 60938 , 0 . 48437 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 92188 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 26562 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 42188 0 , 0 . 71875 0 . 53125 , 1 . 17187 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48438 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 01562 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 51563 - 2 . 57812 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 38107 , - 2 . 29688 q 0 , - 2 . 35937 0 . 48438 , - 3 . 79687 0 . 48437 , - 1 . 45313 1 . 4375 , - 2 . 23438 0 . 96875 , - 0 . 78125 2 . 42187 , - 0 . 78125 1 . 07813 , 0 1 . 89063 , 0 . 4375 0 . 8125 , 0 . 42188 1 . 32812 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82813 , 1 . 98438 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14062 0 , 2 . 35938 - 0 . 48438 , 3 . 8125 - 0 . 48437 , 1 . 4375 - 1 . 45312 , 2 . 23438 - 0 . 95313 , 0 . 78125 - 2 . 42188 , 0 . 78125 - 1 . 92187 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67188 , 0 q 0 , 3 . 29688 0 . 76562 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14063 , 0 1 . 90625 , - 1 . 09375 0 . 76563 , - 1 . 09375 0 . 76563 , - 4 . 375 0 , - 3 . 29687 - 0 . 76563 , - 4 . 375 - 0 . 76562 , - 1 . 07812 - 1 . 92187 , - 1 . 07812 - 1 . 125 , 0 - 1 . 79688 , 0 . 95312 - 0 . 85937 , 1 . 21875 - 0 . 85937 , 4 . 5 z m 9 . 57882 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 16 . 21036 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70312 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48437 , - 2 . 625 0 . 48438 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17188 , - 0 . 625 0 . 875 , 0 1 . 54687 , 0 . 375 0 . 6875 , 0 . 35937 1 . 10938 , 0 . 95312 v - 4 . 79687 h 1 . 64062 v 13 . 35937 z m - 5 . 17187 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07812 , 0 1 . 82812 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76562 , - 2 . 90625 - 0 . 76563 , - 0 . 9375 - 1 . 89063 , - 0 . 9375 - 1 . 07812 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73437 , 0 . 89062 - 0 . 73437 , 2 . 8125 z m 15 . 00073 , 4 . 82812 h - 1 . 64063 v - 10 . 45312 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14062 - 0 . 95312 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64062 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92187 1 . 45313 , - 1 . 78125 h 1 . 0625 z m 13 . 27777 , - 2 . 15625 v - 3 . 67187 h - 3 . 64063 v - 1 . 51563 h 3 . 64063 v - 3 . 64062 h 1 . 54687 v 3 . 64062 h 3 . 64063 v 1 . 51563 h - 3 . 64063 v 3 . 67187 z m 12 . 25012 , - 2 . 14062 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54688 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92187 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35938 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54688 , - 0 . 20313 - 2 . 39063 , - 0 . 64063 - 1 . 82812 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67188 0 , - 1 0 . 57813 , - 1 . 875 0 . 57812 , - 0 . 89062 1 . 67187 , - 1 . 34375 1 . 10938 , - 0 . 45312 2 . 45313 , - 0 . 45312 1 . 48437 , 0 2 . 60937 , 0 . 48437 1 . 14063 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60938 , 0 . 92188 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14062 , - 1 . 26562 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60937 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73437 , 0 . 59375 - 0 . 73437 , 1 . 42188 0 , 0 . 71875 0 . 53125 , 1 . 17187 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48438 2 . 95312 , 0 . 84375 1 . 17188 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60937 , 2 . 01562 - 0 . 60938 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14063 , 0 . 51563 - 2 . 57813 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04687 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92188 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 18 . 55292 , 4 . 29687 h - 1 . 64063 v - 10 . 45312 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14062 - 0 . 95312 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64062 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92187 1 . 45313 , - 1 . 78125 h 1 . 0625 z m 5 . 7351 , 3 . 92188 h - 1 . 1875 q 2 . 73438 , - 4 . 375 2 . 73438 , - 8 . 75 0 , - 1 . 71875 - 0 . 39063 , - 3 . 39063 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 35937 , - 0 . 82812 - 1 . 46875 , - 2 . 73437 h 1 . 1875 q 1 . 70313 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 98437 0 . 6875 , 4 . 14062 0 , 2 . 46875 - 0 . 9375 , 4 . 76563 - 0 . 9375 , 2 . 29687 - 2 . 28125 , 4 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path91 " <nl> + d = " M 73 . 383199 , 62 . 081364 H 85 . 761152 V 78 . 364827 H 73 . 383199 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path93 " <nl> + d = " m 77 . 995529 , 75 . 816074 v - 1 . 890625 h 1 . 640625 v 1 . 890625 z m 0 , 11 . 46875 v - 9 . 671875 h 1 . 640625 v 9 . 671875 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path95 " <nl> + d = " M 128 . 95013 , 0 H 156 . 4147 V 33 . 007874 H 128 . 95013 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path97 " <nl> + d = " m 139 . 16888 , 15 . 466874 v - 1 . 90625 h 1 . 64062 v 1 . 90625 z m - 2 . 07813 , 15 . 203123 0 . 3125 , - 1 . 390625 q 0 . 5 , 0 . 125 0 . 78125 , 0 . 125 0 . 5 , 0 0 . 73438 , - 0 . 328125 0 . 25 , - 0 . 328125 0 . 25 , - 1 . 671875 V 17 . 248124 h 1 . 64062 v 10 . 203123 q 0 , 1 . 78125 - 0 . 46875 , 2 . 484375 - 0 . 59375 , 0 . 90625 - 1 . 96875 , 0 . 90625 - 0 . 65625 , 0 - 1 . 28125 , - 0 . 171875 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path99 " <nl> + d = " M 0 , 25 . 010498 H 128 . 18896 V 46 . 490814 H 0 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path101 " <nl> + d = " M 13 . 359375 , 55 . 852374 Q 12 , 54 . 149249 11 . 0625 , 51 . 852374 10 . 125 , 49 . 555499 10 . 125 , 47 . 086749 q 0 , - 2 . 15625 0 . 703125 , - 4 . 140625 0 . 828125 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 171875 q - 1 . 09375 , 1 . 890625 - 1 . 453125 , 2 . 703125 - 0 . 546875 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 390625 , 1 . 703125 - 0 . 390625 , 3 . 421875 0 , 4 . 375 2 . 71875 , 8 . 75 z m 2 . 697052 , - 8 . 21875 1 . 65625 , - 0 . 140625 q 0 . 125 , 1 0 . 546875 , 1 . 640625 0 . 4375 , 0 . 640625 1 . 34375 , 1 . 046875 0 . 921875 , 0 . 390625 2 . 0625 , 0 . 390625 1 , 0 1 . 78125 , - 0 . 296875 0 . 78125 , - 0 . 296875 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 359375 , - 0 . 46875 - 1 . 1875 , - 0 . 796875 - 0 . 546875 , - 0 . 203125 - 2 . 390625 , - 0 . 640625 - 1 . 828125 , - 0 . 453125 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 234375 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 671875 0 , - 1 0 . 578125 , - 1 . 875 0 . 578125 , - 0 . 890625 1 . 671875 , - 1 . 34375 1 . 109375 , - 0 . 453125 2 . 453125 , - 0 . 453125 1 . 484375 , 0 2 . 609375 , 0 . 484375 1 . 140625 , 0 . 46875 1 . 75 , 1 . 40625 0 . 609375 , 0 . 921875 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 140625 , - 1 . 265625 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 609375 , 0 - 2 . 34375 , 0 . 59375 - 0 . 734375 , 0 . 59375 - 0 . 734375 , 1 . 421875 0 , 0 . 71875 0 . 53125 , 1 . 171875 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 484375 2 . 953125 , 0 . 84375 1 . 171875 , 0 . 53125 1 . 71875 , 1 . 359375 0 . 5625 , 0 . 828125 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 609375 , 2 . 015625 - 0 . 609375 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 140625 , 0 . 515625 - 2 . 578125 , 0 . 515625 - 1 . 8125 , 0 - 3 . 046875 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 921875 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z M 28 . 4375 , 45 . 336749 q 0 , - 2 . 359375 0 . 484375 , - 3 . 796875 0 . 484375 , - 1 . 453125 1 . 4375 , - 2 . 234375 0 . 96875 , - 0 . 78125 2 . 421875 , - 0 . 78125 1 . 078125 , 0 1 . 890625 , 0 . 4375 0 . 8125 , 0 . 421875 1 . 328125 , 1 . 25 0 . 53125 , 0 . 8125 0 . 828125 , 1 . 984375 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 140625 0 , 2 . 359375 - 0 . 484375 , 3 . 8125 - 0 . 484375 , 1 . 4375 - 1 . 453125 , 2 . 234375 - 0 . 953125 , 0 . 78125 - 2 . 421875 , 0 . 78125 - 1 . 921875 , 0 - 3 . 03125 , - 1 . 390625 - 1 . 3125 , - 1 . 671875 - 1 . 3125 , - 5 . 4375 z m 1 . 671875 , 0 q 0 , 3 . 296875 0 . 765625 , 4 . 390625 0 . 78125 , 1 . 078125 1 . 90625 , 1 . 078125 1 . 140625 , 0 1 . 90625 , - 1 . 09375 0 . 765625 , - 1 . 09375 0 . 765625 , - 4 . 375 0 , - 3 . 296875 - 0 . 765625 , - 4 . 375 - 0 . 765625 , - 1 . 078125 - 1 . 921875 , - 1 . 078125 - 1 . 125 , 0 - 1 . 796875 , 0 . 953125 - 0 . 859375 , 1 . 21875 - 0 . 859375 , 4 . 5 z m 9 . 578842 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 359375 , 0 . 640625 - 1 . 15625 , 0 . 984375 l - 0 . 453125 , - 0 . 703125 q 0 . 515625 , - 0 . 21875 0 . 765625 , - 0 . 671875 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 265625 z m 9 . 554108 , - 4 . 296875 1 . 65625 , - 0 . 140625 q 0 . 125 , 1 0 . 546875 , 1 . 640625 0 . 4375 , 0 . 640625 1 . 34375 , 1 . 046875 0 . 921875 , 0 . 390625 2 . 0625 , 0 . 390625 1 , 0 1 . 78125 , - 0 . 296875 0 . 78125 , - 0 . 296875 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 359375 , - 0 . 46875 - 1 . 1875 , - 0 . 796875 - 0 . 546875 , - 0 . 203125 - 2 . 390625 , - 0 . 640625 - 1 . 828125 , - 0 . 453125 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 234375 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 671875 0 , - 1 0 . 578125 , - 1 . 875 0 . 578125 , - 0 . 890625 1 . 671875 , - 1 . 34375 1 . 109375 , - 0 . 453125 2 . 453125 , - 0 . 453125 1 . 484375 , 0 2 . 609375 , 0 . 484375 1 . 140625 , 0 . 46875 1 . 75 , 1 . 40625 0 . 609375 , 0 . 921875 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 140625 , - 1 . 265625 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 609375 , 0 - 2 . 34375 , 0 . 59375 - 0 . 734375 , 0 . 59375 - 0 . 734375 , 1 . 421875 0 , 0 . 71875 0 . 53125 , 1 . 171875 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 484375 2 . 953125 , 0 . 84375 1 . 171875 , 0 . 53125 1 . 71875 , 1 . 359375 0 . 5625 , 0 . 828125 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 609375 , 2 . 015625 - 0 . 609375 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 140625 , 0 . 515625 - 2 . 578125 , 0 . 515625 - 1 . 8125 , 0 - 3 . 046875 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 921875 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 18 . 552948 , 4 . 296875 H 66 . 154648 V 41 . 477374 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 140625 - 0 . 953125 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 640625 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 921875 1 . 453125 , - 1 . 78125 h 1 . 0625 z m 5 . 735092 , 3 . 921875 h - 1 . 1875 q 2 . 734375 , - 4 . 375 2 . 734375 , - 8 . 75 0 , - 1 . 71875 - 0 . 390625 , - 3 . 390625 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 359375 , - 0 . 828125 - 1 . 46875 , - 2 . 734375 h 1 . 1875 q 1 . 703125 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 984375 0 . 6875 , 4 . 140625 0 , 2 . 46875 - 0 . 9375 , 4 . 765625 - 0 . 9375 , 2 . 296875 - 2 . 28125 , 4 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path103 " <nl> + d = " M 54 . 629919 , 54 . 490814 118 . 06299 , 68 . 349083 " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path105 " <nl> + d = " M 54 . 629919 , 54 . 490814 112 . 20125 , 67 . 068466 " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path107 " <nl> + d = " m 111 . 84871 , 68 . 682134 4 . 78606 , - 0 . 645081 - 4 . 08098 , - 2 . 58226 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path109 " <nl> + d = " M 153 . 25985 , 196 . 8609 V 121 . 74278 " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path111 " <nl> + d = " M 153 . 25985 , 196 . 8609 V 127 . 74278 " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path113 " <nl> + d = " m 154 . 91157 , 127 . 74278 - 1 . 65172 , - 4 . 5381 - 1 . 65173 , 4 . 5381 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path115 " <nl> + d = " m 82 . 181099 , 203 . 58267 h 63 . 433071 v 31 . 2756 H 82 . 181099 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path117 " <nl> + d = " m 98 . 681099 , 230 . 50267 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70312 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64063 - 0 . 96875 , - 0 . 64062 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14062 - 0 . 53125 , - 2 . 625 0 , - 1 . 45312 0 . 48437 , - 2 . 625 0 . 48438 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17188 , - 0 . 625 0 . 875 , 0 1 . 54687 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10938 , 0 . 95313 v - 4 . 79688 h 1 . 640621 v 13 . 35938 z m - 5 . 17187 , - 4 . 82813 q 0 , 1 . 85938 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92188 1 . 84375 , 0 . 92188 1 . 07812 , 0 1 . 82812 , - 0 . 875 0 . 75 , - 0 . 89063 0 . 75 , - 2 . 6875 0 , - 1 . 98438 - 0 . 76562 , - 2 . 90625 - 0 . 76563 , - 0 . 9375 - 1 . 89063 , - 0 . 9375 - 1 . 07812 , 0 - 1 . 8125 , 0 . 89062 - 0 . 73437 , 0 . 89063 - 0 . 73437 , 2 . 8125 z m 8 . 828841 , - 1 . 76562 q 0 , - 2 . 35938 0 . 48437 , - 3 . 79688 0 . 48438 , - 1 . 45312 1 . 4375 , - 2 . 23437 0 . 96875 , - 0 . 78125 2 . 42188 , - 0 . 78125 1 . 07812 , 0 1 . 89062 , 0 . 4375 0 . 8125 , 0 . 42187 1 . 32813 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82812 , 1 . 98437 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14063 0 , 2 . 35937 - 0 . 48437 , 3 . 8125 - 0 . 48438 , 1 . 4375 - 1 . 45313 , 2 . 23437 - 0 . 95312 , 0 . 78125 - 2 . 42187 , 0 . 78125 - 1 . 92188 , 0 - 3 . 03125 , - 1 . 39062 - 1 . 3125 , - 1 . 67188 - 1 . 3125 , - 5 . 4375 z m 1 . 67187 , 0 q 0 , 3 . 29687 0 . 76563 , 4 . 39062 0 . 78125 , 1 . 07813 1 . 90625 , 1 . 07813 1 . 14062 , 0 1 . 90625 , - 1 . 09375 0 . 76562 , - 1 . 09375 0 . 76562 , - 4 . 375 0 , - 3 . 29688 - 0 . 76562 , - 4 . 375 - 0 . 76563 , - 1 . 07813 - 1 . 92188 , - 1 . 07813 - 1 . 125 , 0 - 1 . 79687 , 0 . 95313 - 0 . 85938 , 1 . 21875 - 0 . 85938 , 4 . 5 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path119 " <nl> + d = " m 115 . 32809 , 160 . 28871 h 71 . 55905 v 31 . 27559 h - 71 . 55905 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path121 " <nl> + d = " m 131 . 82809 , 187 . 20871 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64063 - 0 . 96875 , - 0 . 64062 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14062 - 0 . 53125 , - 2 . 625 0 , - 1 . 45312 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35938 z m - 5 . 17188 , - 4 . 82813 q 0 , 1 . 85938 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92188 1 . 84375 , 0 . 92188 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89063 0 . 75 , - 2 . 6875 0 , - 1 . 98438 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89062 - 0 . 73438 , 0 . 89063 - 0 . 73438 , 2 . 8125 z m 15 . 00072 , 4 . 82813 h - 1 . 64062 v - 10 . 45313 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14063 - 0 . 95313 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64063 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92188 1 . 45312 , - 1 . 78125 h 1 . 0625 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path123 " <nl> + d = " m 171 . 88189 , 57 . 732284 h 440 v 26 . 708664 h - 440 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path125 " <nl> + d = " M 182 . 61627 , 84 . 652284 V 71 . 292909 h 1 . 76562 v 13 . 359375 z m 4 . 6833 , 0 v - 9 . 671875 h 1 . 46875 v 1 . 375 q 1 . 0625 , - 1 . 59375 3 . 07813 , - 1 . 59375 0 . 875 , 0 1 . 60937 , 0 . 3125 0 . 73438 , 0 . 3125 1 . 09375 , 0 . 828125 0 . 375 , 0 . 5 0 . 51563 , 1 . 203125 0 . 0937 , 0 . 453125 0 . 0937 , 1 . 59375 v 5 . 953125 h - 1 . 64063 v - 5 . 890625 q 0 , - 1 - 0 . 20312 , - 1 . 484375 - 0 . 1875 , - 0 . 5 - 0 . 67188 , - 0 . 796875 - 0 . 48437 , - 0 . 296875 - 1 . 14062 , - 0 . 296875 - 1 . 04688 , 0 - 1 . 8125 , 0 . 671875 - 0 . 75 , 0 . 65625 - 0 . 75 , 2 . 515625 v 5 . 28125 z m 16 . 64135 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 640625 - 0 . 96875 , - 0 . 640625 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 140625 - 0 . 53125 , - 2 . 625 0 , - 1 . 453125 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 359375 1 . 10937 , 0 . 953125 v - 4 . 796875 h 1 . 64063 v 13 . 359375 z m - 5 . 17188 , - 4 . 828125 q 0 , 1 . 859375 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 921875 1 . 84375 , 0 . 921875 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 890625 0 . 75 , - 2 . 6875 0 , - 1 . 984375 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 890625 - 0 . 73438 , 0 . 890625 - 0 . 73438 , 2 . 8125 z m 15 . 90697 , 1 . 71875 1 . 6875 , 0 . 203125 q - 0 . 40625 , 1 . 484375 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 296875 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 671875 0 , - 2 . 453125 1 . 25 , - 3 . 796875 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 328125 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 703125 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 453125 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 484375 1 . 01563 , - 1 . 515625 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 828125 - 0 . 78125 , - 0 . 953125 - 2 . 03125 , - 0 . 953125 - 1 . 125 , 0 - 1 . 90625 , 0 . 765625 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 015625 z m 8 . 04759 , 5 . 765625 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 640625 h 2 . 04687 l 1 . 48438 , 2 . 265625 q 0 . 42187 , 0 . 640625 0 . 67187 , 1 . 078125 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 546875 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 15 . 21456 , - 4 . 296875 1 . 65625 , - 0 . 140625 q 0 . 125 , 1 0 . 54687 , 1 . 640625 0 . 4375 , 0 . 640625 1 . 34375 , 1 . 046875 0 . 92188 , 0 . 390625 2 . 0625 , 0 . 390625 1 , 0 1 . 78125 , - 0 . 296875 0 . 78125 , - 0 . 296875 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 796875 - 0 . 54687 , - 0 . 203125 - 2 . 39062 , - 0 . 640625 - 1 . 82813 , - 0 . 453125 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 234375 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 671875 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 890625 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 453125 2 . 45312 , - 0 . 453125 1 . 48438 , 0 2 . 60938 , 0 . 484375 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 921875 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 265625 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 421875 0 , 0 . 71875 0 . 53125 , 1 . 171875 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 484375 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 359375 0 . 5625 , 0 . 828125 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 015625 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 515625 - 2 . 57812 , 0 . 515625 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 83418 , 8 v - 13 . 375 h 1 . 48438 v 1 . 25 q 0 . 53125 , - 0 . 734375 1 . 1875 , - 1 . 09375 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 640625 0 . 95313 , 0 . 625 1 . 4375 , 1 . 796875 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 546875 0 , 1 . 484375 - 0 . 53125 , 2 . 671875 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 828125 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 703125 z m 1 . 48438 , - 8 . 484375 q 0 , 1 . 859375 0 . 75 , 2 . 765625 0 . 76562 , 0 . 890625 1 . 82812 , 0 . 890625 1 . 09375 , 0 1 . 875 , - 0 . 921875 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 765625 - 0 . 75 , - 0 . 921875 - 1 . 8125 , - 0 . 921875 - 1 . 04688 , 0 - 1 . 85938 , 0 . 984375 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 15 . 20385 , 3 . 59375 q - 0 . 92187 , 0 . 765625 - 1 . 76562 , 1 . 09375 - 0 . 82813 , 0 . 3125 - 1 . 79688 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45312 , - 0 . 78125 - 0 . 85938 , - 0 . 78125 - 0 . 85938 , - 1 . 984375 0 , - 0 . 71875 0 . 32813 , - 1 . 296875 0 . 32812 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 359375 1 . 1875 , - 0 . 546875 0 . 46875 , - 0 . 125 1 . 45312 , - 0 . 25 1 . 98438 , - 0 . 234375 2 . 92188 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 421875 0 , - 1 - 0 . 46875 , - 1 . 421875 - 0 . 625 , - 0 . 546875 - 1 . 875 , - 0 . 546875 - 1 . 15625 , 0 - 1 . 70312 , 0 . 40625 - 0 . 54688 , 0 . 40625 - 0 . 8125 , 1 . 421875 l - 1 . 60938 , - 0 . 21875 q 0 . 21875 , - 1 . 015625 0 . 71875 , - 1 . 640625 0 . 5 , - 0 . 640625 1 . 45313 , - 0 . 984375 0 . 95312 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01562 , 0 . 296875 0 . 78125 , 0 . 28125 1 . 14063 , 0 . 734375 0 . 375 , 0 . 4375 0 . 51562 , 1 . 109375 0 . 0781 , 0 . 421875 0 . 0781 , 1 . 515625 v 2 . 1875 q 0 , 2 . 28125 0 . 10937 , 2 . 890625 0 . 10938 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70312 q - 0 . 26563 , - 0 . 515625 - 0 . 32813 , - 1 . 1875 z m - 0 . 14062 , - 3 . 671875 q - 0 . 89063 , 0 . 375 - 2 . 67188 , 0 . 625 - 1 . 01562 , 0 . 140625 - 1 . 4375 , 0 . 328125 - 0 . 42187 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45313 , 0 . 4375 0 . 9375 , 0 1 . 67187 , - 0 . 40625 0 . 75 , - 0 . 421875 1 . 09375 , - 1 . 140625 0 . 26563 , - 0 . 5625 0 . 26563 , - 1 . 640625 z m 10 . 51636 , 1 . 3125 1 . 60937 , 0 . 21875 q - 0 . 26562 , 1 . 65625 - 1 . 35937 , 2 . 609375 - 1 . 07813 , 0 . 9375 - 2 . 67188 , 0 . 9375 - 1 . 98437 , 0 - 3 . 1875 , - 1 . 296875 - 1 . 20312 , - 1 . 296875 - 1 . 20312 , - 3 . 71875 0 , - 1 . 578125 0 . 51562 , - 2 . 75 0 . 51563 , - 1 . 171875 1 . 57813 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57812 , 0 2 . 57812 , 0 . 796875 1 , 0 . 796875 1 . 28125 , 2 . 265625 l - 1 . 59375 , 0 . 234375 q - 0 . 23437 , - 0 . 96875 - 0 . 8125 , - 1 . 453125 - 0 . 57812 , - 0 . 5 - 1 . 39062 , - 0 . 5 - 1 . 23438 , 0 - 2 . 01563 , 0 . 890625 - 0 . 78125 , 0 . 890625 - 0 . 78125 , 2 . 8125 0 , 1 . 953125 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95313 , 0 . 875 0 . 96875 , 0 1 . 60937 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82813 , - 1 . 828125 z m 9 . 64062 , 0 . 4375 1 . 6875 , 0 . 203125 q - 0 . 40625 , 1 . 484375 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 296875 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 671875 0 , - 2 . 453125 1 . 25 , - 3 . 796875 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 328125 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 703125 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 453125 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 484375 1 . 01562 , - 1 . 515625 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 828125 - 0 . 78125 , - 0 . 953125 - 2 . 03125 , - 0 . 953125 - 1 . 125 , 0 - 1 . 90625 , 0 . 765625 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 015625 z m 14 . 10589 , - 0 . 07813 v - 1 . 531245 l 8 . 84375 , - 3 . 734375 v 1 . 640625 l - 7 . 01562 , 2 . 875 7 . 01562 , 2 . 90625 v 1 . 625 z m 10 . 66059 , 2 . 3125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 015625 0 . 6875 , 0 . 609375 1 . 65625 , 0 . 609375 1 . 15625 , 0 1 . 95312 , - 0 . 796875 0 . 79688 , - 0 . 796875 0 . 79688 , - 1 . 984375 0 , - 1 . 125 - 0 . 73438 , - 1 . 859375 - 0 . 73437 , - 0 . 734375 - 1 . 875 , - 0 . 734375 - 0 . 46875 , 0 - 1 . 15625 , 0 . 171875 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 01563 0 . 26563 , 0 . 01563 1 . 04687 , 0 1 . 875 , - 0 . 546875 0 . 84375 , - 0 . 546875 0 . 84375 , - 1 . 671875 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 609375 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 796875 l - 1 . 64063 , - 0 . 296875 q 0 . 29688 , - 1 . 640625 1 . 35938 , - 2 . 546875 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 859375 - 0 . 46875 , 1 . 578125 - 0 . 46875 , 0 . 703125 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 140625 0 . 65625 , 0 . 859375 0 . 65625 , 2 . 15625 0 , 1 . 734375 - 1 . 28125 , 2 . 953125 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 046875 - 1 . 15625 , - 1 . 046875 - 1 . 32812 , - 2 . 71875 z m 9 . 73507 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 640625 h 2 . 04687 l 1 . 48438 , 2 . 265625 q 0 . 42187 , 0 . 640625 0 . 67187 , 1 . 078125 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 546875 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 9 . 96875 , - 3 . 53125 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 015625 0 . 6875 , 0 . 609375 1 . 65625 , 0 . 609375 1 . 15625 , 0 1 . 95313 , - 0 . 796875 0 . 79687 , - 0 . 796875 0 . 79687 , - 1 . 984375 0 , - 1 . 125 - 0 . 73437 , - 1 . 859375 - 0 . 73438 , - 0 . 734375 - 1 . 875 , - 0 . 734375 - 0 . 46875 , 0 - 1 . 15625 , 0 . 171875 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 01563 0 . 26562 , 0 . 01563 1 . 04688 , 0 1 . 875 , - 0 . 546875 0 . 84375 , - 0 . 546875 0 . 84375 , - 1 . 671875 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 609375 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 796875 l - 1 . 64062 , - 0 . 296875 q 0 . 29687 , - 1 . 640625 1 . 35937 , - 2 . 546875 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 859375 - 0 . 46875 , 1 . 578125 - 0 . 46875 , 0 . 703125 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 140625 0 . 65625 , 0 . 859375 0 . 65625 , 2 . 15625 0 , 1 . 734375 - 1 . 28125 , 2 . 953125 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 046875 - 1 . 15625 , - 1 . 046875 - 1 . 32813 , - 2 . 71875 z m 9 . 73508 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 640625 h 2 . 04688 l 1 . 48437 , 2 . 265625 q 0 . 42188 , 0 . 640625 0 . 67188 , 1 . 078125 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 546875 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45313 v - 1 . 265625 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 453125 0 . 23438 , - 0 . 640625 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 390625 1 . 67187 , - 0 . 390625 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 09375 - 0 . 95312 , - 0 . 09375 - 0 . 75 , 0 - 1 . 0625 , 0 . 328125 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 890625 h 1 . 89062 v 1 . 265625 h - 1 . 89062 v 8 . 406255 z m 4 . 33957 , - 3 . 53125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 015625 0 . 6875 , 0 . 609375 1 . 65625 , 0 . 609375 1 . 15625 , 0 1 . 95312 , - 0 . 796875 0 . 79688 , - 0 . 796875 0 . 79688 , - 1 . 984375 0 , - 1 . 125 - 0 . 73438 , - 1 . 859375 - 0 . 73437 , - 0 . 734375 - 1 . 875 , - 0 . 734375 - 0 . 46875 , 0 - 1 . 15625 , 0 . 171875 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 01563 0 . 26563 , 0 . 01563 1 . 04687 , 0 1 . 875 , - 0 . 546875 0 . 84375 , - 0 . 546875 0 . 84375 , - 1 . 671875 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 609375 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 796875 L 346 . 225 , 74 . 699159 q 0 . 29688 , - 1 . 640625 1 . 35938 , - 2 . 546875 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 859375 - 0 . 46875 , 1 . 578125 - 0 . 46875 , 0 . 703125 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 140625 0 . 65625 , 0 . 859375 0 . 65625 , 2 . 15625 0 , 1 . 734375 - 1 . 28125 , 2 . 953125 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 046875 - 1 . 15625 , - 1 . 046875 - 1 . 32812 , - 2 . 71875 z m 18 . 98508 , 1 . 953125 v 1 . 57813 h - 8 . 82813 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 140625 0 . 34375 , - 0 . 90625 1 . 07813 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 015625 2 . 17187 , - 1 . 78125 2 . 9375 , - 2 . 828125 0 . 76562 , - 1 . 046875 0 . 76562 , - 1 . 96875 0 , - 0 . 984375 - 0 . 70312 , - 1 . 640625 - 0 . 6875 , - 0 . 671875 - 1 . 8125 , - 0 . 671875 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70313 , 0 . 703125 - 0 . 70313 , 1 . 953125 l - 1 . 6875 , - 0 . 171875 q 0 . 17188 , - 1 . 890625 1 . 29688 , - 2 . 875 1 . 14062 , - 0 . 984375 3 . 03125 , - 0 . 984375 1 . 92187 , 0 3 . 04687 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 640625 0 , 0 . 796875 - 0 . 32812 , 1 . 578125 - 0 . 32813 , 0 . 78125 - 1 . 09375 , 1 . 640625 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 234375 - 1 . 89063 , 1 . 6875 - 0 . 42187 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 10 . 84448 , - 4 . 265625 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01562 , - 2 . 90625 - 7 . 01562 , - 2 . 875 v - 1 . 64062 l 8 . 84375 , 3 . 734375 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path127 " <nl> + d = " m 167 . 14961 , 208 . 14961 h 309 . 7323 v 42 . 14172 h - 309 . 7323 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path129 " <nl> + d = " m 177 . 88398 , 235 . 06961 v - 13 . 35938 h 1 . 76562 v 13 . 35938 z m 4 . 6833 , 0 v - 9 . 67188 h 1 . 46875 v 1 . 375 q 1 . 0625 , - 1 . 59375 3 . 07813 , - 1 . 59375 0 . 875 , 0 1 . 60937 , 0 . 3125 0 . 73438 , 0 . 3125 1 . 09375 , 0 . 82813 0 . 375 , 0 . 5 0 . 51563 , 1 . 20312 0 . 0937 , 0 . 45313 0 . 0937 , 1 . 59375 v 5 . 95313 h - 1 . 64063 v - 5 . 89063 q 0 , - 1 - 0 . 20312 , - 1 . 48437 - 0 . 1875 , - 0 . 5 - 0 . 67188 , - 0 . 79688 - 0 . 48437 , - 0 . 29687 - 1 . 14062 , - 0 . 29687 - 1 . 04688 , 0 - 1 . 8125 , 0 . 67187 - 0 . 75 , 0 . 65625 - 0 . 75 , 2 . 51563 v 5 . 28125 z m 16 . 64135 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64063 - 0 . 96875 , - 0 . 64062 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14062 - 0 . 53125 , - 2 . 625 0 , - 1 . 45312 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35938 z m - 5 . 17188 , - 4 . 82813 q 0 , 1 . 85938 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92188 1 . 84375 , 0 . 92188 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89063 0 . 75 , - 2 . 6875 0 , - 1 . 98438 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89062 - 0 . 73438 , 0 . 89063 - 0 . 73438 , 2 . 8125 z m 15 . 90697 , 1 . 71875 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48438 1 . 01563 , - 1 . 51563 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 8 . 0476 , 5 . 76563 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 64063 h 2 . 04688 l 1 . 48437 , 2 . 26563 q 0 . 42188 , 0 . 64062 0 . 67188 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 15 . 21455 , - 4 . 29688 1 . 65625 , - 0 . 14062 q 0 . 125 , 1 0 . 54687 , 1 . 64062 0 . 4375 , 0 . 64063 1 . 34375 , 1 . 04688 0 . 92188 , 0 . 39062 2 . 0625 , 0 . 39062 1 , 0 1 . 78125 , - 0 . 29687 0 . 78125 , - 0 . 29688 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 79688 - 0 . 54687 , - 0 . 20312 - 2 . 39062 , - 0 . 64062 - 1 . 82813 , - 0 . 45313 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23438 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67187 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 89063 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 45313 2 . 45312 , - 0 . 45313 1 . 48438 , 0 2 . 60938 , 0 . 48438 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 92187 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 26563 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 42187 0 , 0 . 71875 0 . 53125 , 1 . 17188 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48437 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 35937 0 . 5625 , 0 . 82813 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 01563 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 51562 - 2 . 57812 , 0 . 51562 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 8342 , 8 v - 13 . 375 h 1 . 48437 v 1 . 25 q 0 . 53125 , - 0 . 73437 1 . 1875 , - 1 . 09375 0 . 67188 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23438 , 0 2 . 17188 , 0 . 64063 0 . 95312 , 0 . 625 1 . 4375 , 1 . 79687 0 . 48437 , 1 . 15625 0 . 48437 , 2 . 54688 0 , 1 . 48437 - 0 . 53125 , 2 . 67187 - 0 . 53125 , 1 . 1875 - 1 . 54687 , 1 . 82813 - 1 . 01563 , 0 . 625 - 2 . 14063 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70312 z m 1 . 48437 , - 8 . 48437 q 0 , 1 . 85937 0 . 75 , 2 . 76562 0 . 76563 , 0 . 89063 1 . 82813 , 0 . 89063 1 . 09375 , 0 1 . 875 , - 0 . 92188 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76563 , - 2 . 76562 - 0 . 75 , - 0 . 92188 - 1 . 8125 , - 0 . 92188 - 1 . 04687 , 0 - 1 . 85937 , 0 . 98438 - 0 . 79688 , 0 . 96875 - 0 . 79688 , 2 . 84375 z m 15 . 20386 , 3 . 59375 q - 0 . 92188 , 0 . 76562 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98438 0 , - 0 . 71875 0 . 32812 , - 1 . 29687 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35938 1 . 1875 , - 0 . 54688 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23437 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42187 0 , - 1 - 0 . 46875 , - 1 . 42188 - 0 . 625 , - 0 . 54687 - 1 . 875 , - 0 . 54687 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42187 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01562 0 . 71875 , - 1 . 64062 0 . 5 , - 0 . 64063 1 . 45312 , - 0 . 98438 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29688 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73437 0 . 375 , 0 . 4375 0 . 51563 , 1 . 10938 0 . 0781 , 0 . 42187 0 . 0781 , 1 . 51562 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89063 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51563 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67188 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14063 - 1 . 4375 , 0 . 32813 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42188 1 . 09375 , - 1 . 14063 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64062 z m 10 . 51633 , 1 . 3125 1 . 60938 , 0 . 21875 q - 0 . 26563 , 1 . 65625 - 1 . 35938 , 2 . 60938 - 1 . 07812 , 0 . 9375 - 2 . 67187 , 0 . 9375 - 1 . 98438 , 0 - 3 . 1875 , - 1 . 29688 - 1 . 20313 , - 1 . 29687 - 1 . 20313 , - 3 . 71875 0 , - 1 . 57812 0 . 51563 , - 2 . 75 0 . 51562 , - 1 . 17187 1 . 57812 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57813 , 0 2 . 57813 , 0 . 79688 1 , 0 . 79687 1 . 28125 , 2 . 26562 l - 1 . 59375 , 0 . 23438 q - 0 . 23438 , - 0 . 96875 - 0 . 8125 , - 1 . 45313 - 0 . 57813 , - 0 . 5 - 1 . 39063 , - 0 . 5 - 1 . 23437 , 0 - 2 . 01562 , 0 . 89063 - 0 . 78125 , 0 . 89062 - 0 . 78125 , 2 . 8125 0 , 1 . 95312 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95312 , 0 . 875 0 . 96875 , 0 1 . 60938 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82812 , - 1 . 82813 z m 9 . 64063 , 0 . 4375 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48438 1 . 01563 , - 1 . 51563 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 14 . 1059 , - 0 . 0781 v - 1 . 53125 l 8 . 84375 , - 3 . 73438 v 1 . 64063 l - 7 . 01563 , 2 . 875 7 . 01563 , 2 . 90625 v 1 . 625 z m 19 . 26995 , 4 . 26562 v 1 . 57813 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14063 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01562 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82813 0 . 76563 , - 1 . 04687 0 . 76563 , - 1 . 96875 0 , - 0 . 98437 - 0 . 70313 , - 1 . 64062 - 0 . 6875 , - 0 . 67188 - 1 . 8125 , - 0 . 67188 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70313 - 0 . 70312 , 1 . 95313 l - 1 . 6875 , - 0 . 17188 q 0 . 17187 , - 1 . 89062 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98437 3 . 03125 , - 0 . 98437 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64062 0 , 0 . 79688 - 0 . 32813 , 1 . 57813 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64062 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23438 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 1 . 12574 , 1 . 57813 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 64063 h 2 . 04688 l 1 . 48437 , 2 . 26563 q 0 . 42188 , 0 . 64062 0 . 67188 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 18 . 57812 , - 1 . 57813 v 1 . 57813 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14063 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01562 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82813 0 . 76563 , - 1 . 04687 0 . 76563 , - 1 . 96875 0 , - 0 . 98437 - 0 . 70313 , - 1 . 64062 - 0 . 6875 , - 0 . 67188 - 1 . 8125 , - 0 . 67188 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70313 - 0 . 70312 , 1 . 95313 l - 1 . 6875 , - 0 . 17188 q 0 . 17187 , - 1 . 89062 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98437 3 . 03125 , - 0 . 98437 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64062 0 , 0 . 79688 - 0 . 32813 , 1 . 57813 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64062 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23438 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 1 . 1257 , 1 . 57813 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64063 h 2 . 04687 l 1 . 48438 , 2 . 26563 q 0 . 42187 , 0 . 64062 0 . 67187 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45312 v - 1 . 26563 h 1 . 45312 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17188 , - 1 . 45312 0 . 23437 , - 0 . 64063 0 . 82812 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67188 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95313 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89063 v 1 . 26563 h - 1 . 89063 v 8 . 40625 z m 4 . 33957 , - 3 . 53125 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95313 , - 0 . 79688 0 . 79687 , - 0 . 79687 0 . 79687 , - 1 . 98437 0 , - 1 . 125 - 0 . 73437 , - 1 . 85938 - 0 . 73438 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26562 , 0 . 0156 1 . 04688 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64062 , - 0 . 29688 q 0 . 29687 , - 1 . 64062 1 . 35937 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32813 , - 2 . 71875 z m 18 . 98508 , 1 . 95312 v 1 . 57813 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14063 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01562 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82813 0 . 76563 , - 1 . 04687 0 . 76563 , - 1 . 96875 0 , - 0 . 98437 - 0 . 70313 , - 1 . 64062 - 0 . 6875 , - 0 . 67188 - 1 . 8125 , - 0 . 67188 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70313 - 0 . 70312 , 1 . 95313 l - 1 . 6875 , - 0 . 17188 q 0 . 17187 , - 1 . 89062 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98437 3 . 03125 , - 0 . 98437 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64062 0 , 0 . 79688 - 0 . 32813 , 1 . 57813 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64062 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23438 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 10 . 84448 , - 4 . 26562 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01563 , - 2 . 90625 - 7 . 01563 , - 2 . 875 v - 1 . 64063 l 8 . 84375 , 3 . 73438 z " / > <nl> + < / svg > <nl> new file mode 100644 <nl> index 0000000000000 . . f4d622ee263ce <nl> mmm / dev / null <nl> ppp b / g3doc / includes / img / view - operation . svg <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " standalone = " no " ? > <nl> + < svg <nl> + xmlns : dc = " http : / / purl . org / dc / elements / 1 . 1 / " <nl> + xmlns : cc = " http : / / creativecommons . org / ns # " <nl> + xmlns : rdf = " http : / / www . w3 . org / 1999 / 02 / 22 - rdf - syntax - ns # " <nl> + xmlns : svg = " http : / / www . w3 . org / 2000 / svg " <nl> + xmlns = " http : / / www . w3 . org / 2000 / svg " <nl> + xmlns : sodipodi = " http : / / sodipodi . sourceforge . net / DTD / sodipodi - 0 . dtd " <nl> + xmlns : inkscape = " http : / / www . inkscape . org / namespaces / inkscape " <nl> + version = " 1 . 1 " <nl> + viewBox = " 0 0 781 . 88983 360 . 73489 " <nl> + stroke - miterlimit = " 10 " <nl> + id = " svg213 " <nl> + sodipodi : docname = " view - operation . svg " <nl> + width = " 781 . 88983 " <nl> + height = " 360 . 73489 " <nl> + style = " fill : none ; stroke : none ; stroke - linecap : square ; stroke - miterlimit : 10 " <nl> + inkscape : version = " 0 . 92 . 2pre0 ( 973e216 , 2017 - 07 - 25 ) " > <nl> + < metadata <nl> + id = " metadata219 " > <nl> + < rdf : RDF > <nl> + < cc : Work <nl> + rdf : about = " " > <nl> + < dc : format > image / svg + xml < / dc : format > <nl> + < dc : type <nl> + rdf : resource = " http : / / purl . org / dc / dcmitype / StillImage " / > <nl> + < dc : title > < / dc : title > <nl> + < / cc : Work > <nl> + < / rdf : RDF > <nl> + < / metadata > <nl> + < defs <nl> + id = " defs217 " / > <nl> + < sodipodi : namedview <nl> + pagecolor = " # ffffff " <nl> + bordercolor = " # 666666 " <nl> + borderopacity = " 1 " <nl> + objecttolerance = " 10 " <nl> + gridtolerance = " 10 " <nl> + guidetolerance = " 10 " <nl> + inkscape : pageopacity = " 0 " <nl> + inkscape : pageshadow = " 2 " <nl> + inkscape : window - width = " 2312 " <nl> + inkscape : window - height = " 1165 " <nl> + id = " namedview215 " <nl> + showgrid = " false " <nl> + fit - margin - top = " 0 " <nl> + fit - margin - left = " 0 " <nl> + fit - margin - right = " 0 " <nl> + fit - margin - bottom = " 0 " <nl> + inkscape : zoom = " 0 . 9 " <nl> + inkscape : cx = " 514 . 61205 " <nl> + inkscape : cy = " 336 . 45539 " <nl> + inkscape : window - x = " 0 " <nl> + inkscape : window - y = " 0 " <nl> + inkscape : window - maximized = " 0 " <nl> + inkscape : current - layer = " svg213 " / > <nl> + < clipPath <nl> + id = " p . 0 " > <nl> + < path <nl> + d = " M 0 , 0 H 1280 V 960 H 0 Z " <nl> + id = " path2 " <nl> + inkscape : connector - curvature = " 0 " <nl> + style = " clip - rule : nonzero " / > <nl> + < / clipPath > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path5 " <nl> + d = " M - 12 . 118111 , - 20 . 430447 H 1267 . 8819 V 939 . 56955 H - 12 . 118111 Z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path7 " <nl> + d = " M 94 . 598429 , 118 . 46719 H 118 . 063 v 26 . 70865 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path9 " <nl> + d = " M 94 . 598429 , 118 . 46719 H 118 . 063 v 26 . 70865 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path11 " <nl> + d = " m 111 . 1453 , 137 . 55402 q - 0 . 92188 , 0 . 76562 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98438 0 , - 0 . 71875 0 . 32812 , - 1 . 29687 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35938 1 . 1875 , - 0 . 54688 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23437 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42187 0 , - 1 - 0 . 46875 , - 1 . 42188 - 0 . 625 , - 0 . 54687 - 1 . 875 , - 0 . 54687 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42187 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01562 0 . 71875 , - 1 . 64062 0 . 5 , - 0 . 64063 1 . 45312 , - 0 . 98438 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29688 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73437 0 . 375 , 0 . 4375 0 . 51563 , 1 . 10938 0 . 0781 , 0 . 42187 0 . 0781 , 1 . 51562 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89063 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51563 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67188 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14063 - 1 . 4375 , 0 . 32813 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42188 1 . 09375 , - 1 . 14063 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64062 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path13 " <nl> + d = " m 118 . 06299 , 118 . 46719 h 23 . 46457 v 26 . 70865 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path15 " <nl> + d = " m 118 . 06299 , 118 . 46719 h 23 . 46457 v 26 . 70865 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path17 " <nl> + d = " m 129 . 79737 , 138 . 74152 h - 1 . 51563 v - 13 . 35938 h 1 . 64063 v 4 . 76563 q 1 . 04687 , - 1 . 29688 2 . 65625 , - 1 . 29688 0 . 89062 , 0 1 . 6875 , 0 . 35938 0 . 79687 , 0 . 35937 1 . 3125 , 1 . 01562 0 . 51562 , 0 . 64063 0 . 79687 , 1 . 5625 0 . 29688 , 0 . 92188 0 . 29688 , 1 . 96875 0 , 2 . 48438 - 1 . 23438 , 3 . 84375 - 1 . 21875 , 1 . 35938 - 2 . 95312 , 1 . 35938 - 1 . 70313 , 0 - 2 . 6875 , - 1 . 4375 z m - 0 . 0156 , - 4 . 90625 q 0 , 1 . 73437 0 . 48438 , 2 . 51562 0 . 76562 , 1 . 26563 2 . 09375 , 1 . 26563 1 . 07812 , 0 1 . 85937 , - 0 . 9375 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 78125 0 , - 1 . 89063 - 0 . 75 , - 2 . 79688 - 0 . 75 , - 0 . 90625 - 1 . 82812 , - 0 . 90625 - 1 . 0625 , 0 - 1 . 85938 , 0 . 9375 - 0 . 78125 , 0 . 9375 - 0 . 78125 , 2 . 70313 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path19 " <nl> + d = " m 141 . 52757 , 118 . 46719 h 23 . 46455 v 26 . 70865 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path21 " <nl> + d = " m 141 . 52757 , 118 . 46719 h 23 . 46455 v 26 . 70865 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path23 " <nl> + d = " m 158 . 07444 , 135 . 19464 1 . 60937 , 0 . 21875 q - 0 . 26562 , 1 . 65625 - 1 . 35937 , 2 . 60937 - 1 . 07813 , 0 . 9375 - 2 . 67188 , 0 . 9375 - 1 . 98437 , 0 - 3 . 1875 , - 1 . 29687 - 1 . 20312 , - 1 . 29688 - 1 . 20312 , - 3 . 71875 0 , - 1 . 57813 0 . 51562 , - 2 . 75 0 . 51563 , - 1 . 17188 1 . 57813 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57812 , 0 2 . 57812 , 0 . 79687 1 , 0 . 79688 1 . 28125 , 2 . 26563 l - 1 . 59375 , 0 . 23437 q - 0 . 23437 , - 0 . 96875 - 0 . 8125 , - 1 . 45312 - 0 . 57812 , - 0 . 5 - 1 . 39062 , - 0 . 5 - 1 . 23438 , 0 - 2 . 01563 , 0 . 89062 - 0 . 78125 , 0 . 89063 - 0 . 78125 , 2 . 8125 0 , 1 . 95313 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95313 , 0 . 875 0 . 96875 , 0 1 . 60937 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82813 , - 1 . 82812 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path25 " <nl> + d = " M 94 . 598429 , 145 . 17585 H 118 . 063 v 26 . 70866 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path27 " <nl> + d = " M 94 . 598429 , 145 . 17585 H 118 . 063 v 26 . 70866 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path29 " <nl> + d = " m 111 . 09843 , 165 . 45018 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64063 - 0 . 96875 , - 0 . 64062 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14062 - 0 . 53125 , - 2 . 625 0 , - 1 . 45312 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35938 z m - 5 . 17188 , - 4 . 82813 q 0 , 1 . 85938 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92188 1 . 84375 , 0 . 92188 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89063 0 . 75 , - 2 . 6875 0 , - 1 . 98438 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89062 - 0 . 73438 , 0 . 89063 - 0 . 73438 , 2 . 8125 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path31 " <nl> + d = " m 118 . 06299 , 145 . 17585 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path33 " <nl> + d = " m 118 . 06299 , 145 . 17585 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path35 " <nl> + d = " m 134 . 92237 , 162 . 34081 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79687 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32812 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70313 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48437 1 . 01563 , - 1 . 51562 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95312 - 2 . 03125 , - 0 . 95312 - 1 . 125 , 0 - 1 . 90625 , 0 . 76562 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01563 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path37 " <nl> + d = " m 141 . 52757 , 145 . 17585 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path39 " <nl> + d = " m 141 . 52757 , 145 . 17585 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path41 " <nl> + d = " m 152 . 29319 , 165 . 45018 v - 8 . 40625 h - 1 . 45313 v - 1 . 26563 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 45312 0 . 23438 , - 0 . 64063 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67187 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95312 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89062 v 1 . 26563 h - 1 . 89062 v 8 . 40625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path43 " <nl> + d = " M 94 . 598429 , 171 . 88451 H 118 . 063 v 26 . 70866 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path45 " <nl> + d = " M 94 . 598429 , 171 . 88451 H 118 . 063 v 26 . 70866 H 94 . 598429 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path47 " <nl> + d = " m 104 . 5203 , 192 . 95572 1 . 59375 , 0 . 23437 q 0 . 10937 , 0 . 75 0 . 5625 , 1 . 07813 0 . 60937 , 0 . 45312 1 . 67187 , 0 . 45312 1 . 14063 , 0 1 . 75 , - 0 . 45312 0 . 625 , - 0 . 45313 0 . 84375 , - 1 . 26563 0 . 125 , - 0 . 5 0 . 10938 , - 2 . 10937 - 1 . 0625 , 1 . 26562 - 2 . 67188 , 1 . 26562 - 2 , 0 - 3 . 09375 , - 1 . 4375 - 1 . 09375 , - 1 . 4375 - 1 . 09375 , - 3 . 45312 0 , - 1 . 39063 0 . 5 , - 2 . 5625 0 . 51563 , - 1 . 17188 1 . 45313 , - 1 . 79688 0 . 95312 , - 0 . 64062 2 . 25 , - 0 . 64062 1 . 70312 , 0 2 . 8125 , 1 . 375 v - 1 . 15625 h 1 . 51562 v 8 . 35937 q 0 , 2 . 26563 - 0 . 46875 , 3 . 20313 - 0 . 45312 , 0 . 9375 - 1 . 45312 , 1 . 48437 - 0 . 98438 , 0 . 54688 - 2 . 45313 , 0 . 54688 - 1 . 71875 , 0 - 2 . 79687 , - 0 . 78125 - 1 . 0625 , - 0 . 76563 - 1 . 03125 , - 2 . 34375 z m 1 . 35937 , - 5 . 8125 q 0 , 1 . 90625 0 . 75 , 2 . 78125 0 . 76563 , 0 . 875 1 . 90625 , 0 . 875 1 . 125 , 0 1 . 89063 , - 0 . 85938 0 . 76562 , - 0 . 875 0 . 76562 , - 2 . 73437 0 , - 1 . 78125 - 0 . 79687 , - 2 . 67188 - 0 . 78125 , - 0 . 90625 - 1 . 89063 , - 0 . 90625 - 1 . 09375 , 0 - 1 . 85937 , 0 . 89063 - 0 . 76563 , 0 . 875 - 0 . 76563 , 2 . 625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path49 " <nl> + d = " m 118 . 06299 , 171 . 88451 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path51 " <nl> + d = " m 118 . 06299 , 171 . 88451 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path53 " <nl> + d = " m 128 . 29737 , 192 . 15885 v - 13 . 35938 h 1 . 64062 v 4 . 79688 q 1 . 14063 , - 1 . 32813 2 . 89063 , - 1 . 32813 1 . 07812 , 0 1 . 85937 , 0 . 42188 0 . 79688 , 0 . 42187 1 . 14063 , 1 . 17187 0 . 34375 , 0 . 75 0 . 34375 , 2 . 17188 v 6 . 125 h - 1 . 64063 v - 6 . 125 q 0 , - 1 . 23438 - 0 . 53125 , - 1 . 79688 - 0 . 53125 , - 0 . 5625 - 1 . 51562 , - 0 . 5625 - 0 . 71875 , 0 - 1 . 35938 , 0 . 39063 - 0 . 64062 , 0 . 375 - 0 . 92187 , 1 . 01562 - 0 . 26563 , 0 . 64063 - 0 . 26563 , 1 . 78125 v 5 . 29688 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path55 " <nl> + d = " m 141 . 52757 , 171 . 88451 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path57 " <nl> + d = " m 141 . 52757 , 171 . 88451 h 23 . 46455 v 26 . 70866 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path59 " <nl> + d = " m 152 . 42181 , 180 . 69009 v - 1 . 89063 h 1 . 64062 v 1 . 89063 z m 0 , 11 . 46875 v - 9 . 67188 h 1 . 64062 v 9 . 67188 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path61 " <nl> + d = " m 22 . 598423 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path63 " <nl> + d = " m 22 . 598423 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path65 " <nl> + d = " m 39 . 145299 , 27 . 086826 q - 0 . 921875 , 0 . 765625 - 1 . 765625 , 1 . 09375 - 0 . 828125 , 0 . 3125 - 1 . 796875 , 0 . 3125 - 1 . 59375 , 0 - 2 . 453125 , - 0 . 78125 - 0 . 859375 , - 0 . 78125 - 0 . 859375 , - 1 . 984375 0 , - 0 . 71875 0 . 328125 , - 1 . 296875 0 . 328125 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 359375 1 . 1875 , - 0 . 546875 0 . 46875 , - 0 . 125 1 . 453125 , - 0 . 25 1 . 984375 , - 0 . 234375 2 . 921875 , - 0 . 5625 0 . 01563 , - 0 . 34375 0 . 01563 , - 0 . 421875 0 , - 1 - 0 . 46875 , - 1 . 421875 - 0 . 625 , - 0 . 546875 - 1 . 875 , - 0 . 546875 - 1 . 15625 , 0 - 1 . 703125 , 0 . 40625 - 0 . 546875 , 0 . 40625 - 0 . 8125 , 1 . 421875 l - 1 . 609375 , - 0 . 21875 q 0 . 21875 , - 1 . 015625 0 . 71875 , - 1 . 640625 0 . 5 , - 0 . 640625 1 . 453125 , - 0 . 984375 0 . 953125 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 015625 , 0 . 296875 0 . 78125 , 0 . 28125 1 . 140625 , 0 . 734375 0 . 375 , 0 . 4375 0 . 515625 , 1 . 109375 0 . 07813 , 0 . 421875 0 . 07813 , 1 . 515625 v 2 . 1875 q 0 , 2 . 28125 0 . 109375 , 2 . 890625 0 . 109375 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 703125 q - 0 . 265625 , - 0 . 515625 - 0 . 328125 , - 1 . 1875 z m - 0 . 140625 , - 3 . 671875 q - 0 . 890625 , 0 . 375 - 2 . 671875 , 0 . 625 - 1 . 015625 , 0 . 140625 - 1 . 4375 , 0 . 328125 - 0 . 421875 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 453125 , 0 . 4375 0 . 9375 , 0 1 . 671875 , - 0 . 40625 0 . 75 , - 0 . 421875 1 . 09375 , - 1 . 140625 0 . 265625 , - 0 . 5625 0 . 265625 , - 1 . 640625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path67 " <nl> + d = " M 46 . 062992 , 8 H 69 . 527557 V 34 . 70866 H 46 . 062992 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path69 " <nl> + d = " M 46 . 062992 , 8 H 69 . 527557 V 34 . 70866 H 46 . 062992 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path71 " <nl> + d = " M 57 . 797363 , 28 . 274326 H 56 . 281738 V 14 . 914951 h 1 . 640625 v 4 . 765625 q 1 . 046875 , - 1 . 296875 2 . 65625 , - 1 . 296875 0 . 890625 , 0 1 . 6875 , 0 . 359375 0 . 796875 , 0 . 359375 1 . 3125 , 1 . 015625 0 . 515625 , 0 . 640625 0 . 796875 , 1 . 5625 0 . 296875 , 0 . 921875 0 . 296875 , 1 . 96875 0 , 2 . 484375 - 1 . 234375 , 3 . 84375 - 1 . 21875 , 1 . 359375 - 2 . 953125 , 1 . 359375 - 1 . 703125 , 0 - 2 . 6875 , - 1 . 4375 z m - 0 . 01563 , - 4 . 90625 q 0 , 1 . 734375 0 . 484375 , 2 . 515625 0 . 765625 , 1 . 265625 2 . 09375 , 1 . 265625 1 . 078125 , 0 1 . 859375 , - 0 . 9375 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 78125 0 , - 1 . 890625 - 0 . 75 , - 2 . 796875 - 0 . 75 , - 0 . 90625 - 1 . 828125 , - 0 . 90625 - 1 . 0625 , 0 - 1 . 859375 , 0 . 9375 - 0 . 78125 , 0 . 9375 - 0 . 78125 , 2 . 703125 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path73 " <nl> + d = " m 69 . 527559 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path75 " <nl> + d = " m 69 . 527559 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path77 " <nl> + d = " m 86 . 074429 , 24 . 727451 1 . 609375 , 0 . 21875 q - 0 . 265625 , 1 . 65625 - 1 . 359375 , 2 . 609375 - 1 . 078125 , 0 . 9375 - 2 . 671875 , 0 . 9375 - 1 . 984375 , 0 - 3 . 1875 , - 1 . 296875 - 1 . 203125 , - 1 . 296875 - 1 . 203125 , - 3 . 71875 0 , - 1 . 578125 0 . 515625 , - 2 . 75 0 . 515625 , - 1 . 171875 1 . 578125 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 578125 , 0 2 . 578125 , 0 . 796875 1 , 0 . 796875 1 . 28125 , 2 . 265625 l - 1 . 59375 , 0 . 234375 q - 0 . 234375 , - 0 . 96875 - 0 . 8125 , - 1 . 453125 - 0 . 578125 , - 0 . 5 - 1 . 390625 , - 0 . 5 - 1 . 234375 , 0 - 2 . 015625 , 0 . 890625 - 0 . 78125 , 0 . 890625 - 0 . 78125 , 2 . 8125 0 , 1 . 953125 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 953125 , 0 . 875 0 . 96875 , 0 1 . 609375 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 828125 , - 1 . 828125 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path79 " <nl> + d = " M 92 . 992129 , 8 H 116 . 45669 V 34 . 70866 H 92 . 992129 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path81 " <nl> + d = " M 92 . 992129 , 8 H 116 . 45669 V 34 . 70866 H 92 . 992129 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path83 " <nl> + d = " m 109 . 49213 , 28 . 274326 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70312 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 640625 - 0 . 96875 , - 0 . 640625 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 140625 - 0 . 53125 , - 2 . 625 0 , - 1 . 453125 0 . 48437 , - 2 . 625 0 . 48438 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17188 , - 0 . 625 0 . 875 , 0 1 . 54687 , 0 . 375 0 . 6875 , 0 . 359375 1 . 10938 , 0 . 953125 v - 4 . 796875 h 1 . 64062 v 13 . 359375 z m - 5 . 17187 , - 4 . 828125 q 0 , 1 . 859375 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 921875 1 . 84375 , 0 . 921875 1 . 07812 , 0 1 . 82812 , - 0 . 875 0 . 75 , - 0 . 890625 0 . 75 , - 2 . 6875 0 , - 1 . 984375 - 0 . 76562 , - 2 . 90625 - 0 . 76563 , - 0 . 9375 - 1 . 89063 , - 0 . 9375 - 1 . 07812 , 0 - 1 . 8125 , 0 . 890625 - 0 . 73437 , 0 . 890625 - 0 . 73437 , 2 . 8125 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path85 " <nl> + d = " m 116 . 45669 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path87 " <nl> + d = " m 116 . 45669 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path89 " <nl> + d = " m 133 . 31606 , 25 . 164951 1 . 6875 , 0 . 203125 q - 0 . 40625 , 1 . 484375 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 296875 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 671875 0 , - 2 . 453125 1 . 25 , - 3 . 796875 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 328125 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 703125 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 453125 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 484375 1 . 01563 , - 1 . 515625 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 828125 - 0 . 78125 , - 0 . 953125 - 2 . 03125 , - 0 . 953125 - 1 . 125 , 0 - 1 . 90625 , 0 . 765625 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 015625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path91 " <nl> + d = " m 139 . 92126 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path93 " <nl> + d = " m 139 . 92126 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path95 " <nl> + d = " m 150 . 54626 , 28 . 274326 v - 8 . 40625 h - 1 . 45313 v - 1 . 265625 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 453125 0 . 23438 , - 0 . 640625 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 390625 1 . 67187 , - 0 . 390625 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 09375 - 0 . 95312 , - 0 . 09375 - 0 . 75 , 0 - 1 . 0625 , 0 . 328125 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 890625 h 1 . 89062 v 1 . 265625 h - 1 . 89062 v 8 . 40625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path97 " <nl> + d = " M 163 . 38583 , 8 H 186 . 8504 V 34 . 70866 H 163 . 38583 Z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path99 " <nl> + d = " M 163 . 38583 , 8 H 186 . 8504 V 34 . 70866 H 163 . 38583 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path101 " <nl> + d = " m 173 . 3077 , 29 . 071201 1 . 59375 , 0 . 234375 q 0 . 10938 , 0 . 75 0 . 5625 , 1 . 078125 0 . 60938 , 0 . 453125 1 . 67188 , 0 . 453125 1 . 14062 , 0 1 . 75 , - 0 . 453125 0 . 625 , - 0 . 453125 0 . 84375 , - 1 . 265625 0 . 125 , - 0 . 5 0 . 10937 , - 2 . 109375 - 1 . 0625 , 1 . 265625 - 2 . 67187 , 1 . 265625 - 2 , 0 - 3 . 09375 , - 1 . 4375 - 1 . 09375 , - 1 . 4375 - 1 . 09375 , - 3 . 453125 0 , - 1 . 390625 0 . 5 , - 2 . 5625 0 . 51562 , - 1 . 171875 1 . 45312 , - 1 . 796875 0 . 95313 , - 0 . 640625 2 . 25 , - 0 . 640625 1 . 70313 , 0 2 . 8125 , 1 . 375 v - 1 . 15625 h 1 . 51563 v 8 . 359375 q 0 , 2 . 265625 - 0 . 46875 , 3 . 203125 - 0 . 45313 , 0 . 9375 - 1 . 45313 , 1 . 484375 - 0 . 98437 , 0 . 546875 - 2 . 45312 , 0 . 546875 - 1 . 71875 , 0 - 2 . 79688 , - 0 . 78125 - 1 . 0625 , - 0 . 765625 - 1 . 03125 , - 2 . 34375 z m 1 . 35938 , - 5 . 8125 q 0 , 1 . 90625 0 . 75 , 2 . 78125 0 . 76562 , 0 . 875 1 . 90625 , 0 . 875 1 . 125 , 0 1 . 89062 , - 0 . 859375 0 . 76563 , - 0 . 875 0 . 76563 , - 2 . 734375 0 , - 1 . 78125 - 0 . 79688 , - 2 . 671875 - 0 . 78125 , - 0 . 90625 - 1 . 89062 , - 0 . 90625 - 1 . 09375 , 0 - 1 . 85938 , 0 . 890625 - 0 . 76562 , 0 . 875 - 0 . 76562 , 2 . 625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path103 " <nl> + d = " m 186 . 85039 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path105 " <nl> + d = " m 186 . 85039 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path107 " <nl> + d = " M 197 . 08477 , 28 . 274326 V 14 . 914951 h 1 . 64062 v 4 . 796875 q 1 . 14063 , - 1 . 328125 2 . 89063 , - 1 . 328125 1 . 07812 , 0 1 . 85937 , 0 . 421875 0 . 79688 , 0 . 421875 1 . 14063 , 1 . 171875 0 . 34375 , 0 . 75 0 . 34375 , 2 . 171875 v 6 . 125 h - 1 . 64063 v - 6 . 125 q 0 , - 1 . 234375 - 0 . 53125 , - 1 . 796875 - 0 . 53125 , - 0 . 5625 - 1 . 51562 , - 0 . 5625 - 0 . 71875 , 0 - 1 . 35938 , 0 . 390625 - 0 . 64062 , 0 . 375 - 0 . 92187 , 1 . 015625 - 0 . 26563 , 0 . 640625 - 0 . 26563 , 1 . 78125 v 5 . 296875 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path109 " <nl> + d = " m 210 . 31496 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path111 " <nl> + d = " m 210 . 31496 , 8 h 23 . 46457 v 26 . 70866 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path113 " <nl> + d = " m 220 . 54934 , 16 . 805576 v - 1 . 890625 h 1 . 64062 v 1 . 890625 z m 0 , 11 . 46875 v - 9 . 671875 h 1 . 64062 v 9 . 671875 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path115 " <nl> + d = " m 118 . 06299 , 273 . 69815 h 23 . 46457 v 26 . 70868 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path117 " <nl> + d = " m 118 . 06299 , 273 . 69815 h 23 . 46457 v 26 . 70868 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path119 " <nl> + d = " m 134 . 92237 , 290 . 8631 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79687 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32812 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70313 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48437 1 . 01563 , - 1 . 51562 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95312 - 2 . 03125 , - 0 . 95312 - 1 . 125 , 0 - 1 . 90625 , 0 . 76562 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01563 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path121 " <nl> + d = " m 141 . 52757 , 273 . 69815 h 23 . 46455 v 26 . 70868 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path123 " <nl> + d = " m 141 . 52757 , 273 . 69815 h 23 . 46455 v 26 . 70868 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path125 " <nl> + d = " m 152 . 15257 , 293 . 97247 v - 8 . 40625 h - 1 . 45313 v - 1 . 26563 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 45312 0 . 23438 , - 0 . 64063 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67187 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95312 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89062 v 1 . 26563 h - 1 . 89062 v 8 . 40625 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path127 " <nl> + d = " m 118 . 06299 , 300 . 40683 h 23 . 46457 v 26 . 70865 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path129 " <nl> + d = " m 118 . 06299 , 300 . 40683 h 23 . 46457 v 26 . 70865 h - 23 . 46457 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path131 " <nl> + d = " m 128 . 29737 , 320 . 68115 v - 13 . 35938 h 1 . 64062 v 4 . 79688 q 1 . 14063 , - 1 . 32813 2 . 89063 , - 1 . 32813 1 . 07812 , 0 1 . 85937 , 0 . 42188 0 . 79688 , 0 . 42187 1 . 14063 , 1 . 17187 0 . 34375 , 0 . 75 0 . 34375 , 2 . 17188 v 6 . 125 h - 1 . 64063 v - 6 . 125 q 0 , - 1 . 23438 - 0 . 53125 , - 1 . 79688 - 0 . 53125 , - 0 . 5625 - 1 . 51562 , - 0 . 5625 - 0 . 71875 , 0 - 1 . 35938 , 0 . 39063 - 0 . 64062 , 0 . 375 - 0 . 92187 , 1 . 01562 - 0 . 26563 , 0 . 64063 - 0 . 26563 , 1 . 78125 v 5 . 29688 z " / > <nl> + < path <nl> + style = " fill : # cfe2f3 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path133 " <nl> + d = " m 141 . 52757 , 300 . 40683 h 23 . 46455 v 26 . 70865 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path135 " <nl> + d = " m 141 . 52757 , 300 . 40683 h 23 . 46455 v 26 . 70865 h - 23 . 46455 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path137 " <nl> + d = " m 151 . 76194 , 309 . 2124 v - 1 . 89063 h 1 . 64062 v 1 . 89063 z m 0 , 11 . 46875 v - 9 . 67188 h 1 . 64062 v 9 . 67188 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path139 " <nl> + d = " M 156 . 42782 , 47 . 356953 H 652 . 86877 V 68 . 837269 H 156 . 42782 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path141 " <nl> + d = " m 166 . 36532 , 74 . 511323 0 . 79687 , - 3 . 890625 h - 1 . 54687 v - 1 . 359375 h 1 . 8125 l 0 . 67187 , - 3 . 296875 h - 2 . 48437 v - 1 . 359375 h 2 . 76562 l 0 . 79688 , - 3 . 90625 h 1 . 35937 l - 0 . 79687 , 3 . 90625 h 2 . 875 l 0 . 79687 , - 3 . 90625 h 1 . 375 l - 0 . 79687 , 3 . 90625 h 1 . 57812 v 1 . 359375 h - 1 . 84375 l - 0 . 6875 , 3 . 296875 h 2 . 53125 v 1 . 359375 h - 2 . 8125 l - 0 . 78125 , 3 . 890625 h - 1 . 375 l 0 . 78125 , - 3 . 890625 h - 2 . 85937 l - 0 . 78125 , 3 . 890625 z m 2 . 4375 , - 5 . 25 h 2 . 85937 l 0 . 6875 , - 3 . 296875 h - 2 . 875 z m 8 . 18822 , 5 . 015625 V 60 . 917573 h 1 . 64062 v 13 . 359375 z m 4 . 19169 , 0 v - 9 . 671875 h 1 . 46875 v 1 . 359375 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 140625 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 453125 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 234375 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 796875 0 . 78125 , 0 . 796875 0 . 78125 , 2 . 453125 v 6 . 640625 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 984375 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 703125 - 0 . 42188 , - 0 . 265625 - 0 . 98438 , - 0 . 265625 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 671875 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 640625 - 0 . 40625 , - 0 . 546875 - 1 . 3125 , - 0 . 546875 - 0 . 6875 , 0 - 1 . 28125 , 0 . 359375 - 0 . 59375 , 0 . 359375 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 703125 - 0 . 25 , 2 . 03125 v 5 . 015625 z m 21 . 85331 , - 1 . 1875 q - 0 . 92188 , 0 . 765625 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 984375 0 , - 0 . 71875 0 . 32812 , - 1 . 296875 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 359375 1 . 1875 , - 0 . 546875 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 234375 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 421875 0 , - 1 - 0 . 46875 , - 1 . 421875 - 0 . 625 , - 0 . 546875 - 1 . 875 , - 0 . 546875 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 421875 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 015625 0 . 71875 , - 1 . 640625 0 . 5 , - 0 . 640625 1 . 45312 , - 0 . 984375 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 296875 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 734375 0 . 375 , 0 . 4375 0 . 51563 , 1 . 109375 0 . 0781 , 0 . 421875 0 . 0781 , 1 . 515625 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 890625 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 515625 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 671875 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 140625 - 1 . 4375 , 0 . 328125 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 421875 1 . 09375 , - 1 . 140625 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 640625 z m 4 . 20384 , 8 . 5625 v - 13 . 375 h 1 . 48438 v 1 . 25 q 0 . 53125 , - 0 . 734375 1 . 1875 , - 1 . 09375 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 640625 0 . 95313 , 0 . 625 1 . 4375 , 1 . 796875 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 546875 0 , 1 . 484375 - 0 . 53125 , 2 . 671875 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 828125 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 703125 z m 1 . 48438 , - 8 . 484375 q 0 , 1 . 859375 0 . 75 , 2 . 765625 0 . 76562 , 0 . 890625 1 . 82812 , 0 . 890625 1 . 09375 , 0 1 . 875 , - 0 . 921875 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 765625 - 0 . 75 , - 0 . 921875 - 1 . 8125 , - 0 . 921875 - 1 . 04688 , 0 - 1 . 85938 , 0 . 984375 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 7 . 62571 , 4 . 78125 5 . 125 , - 13 . 359375 h 1 . 90625 l 5 . 46875 , 13 . 359375 h - 2 . 01562 l - 1 . 54688 , - 4 . 046875 h - 5 . 59375 l - 1 . 46875 , 4 . 046875 z m 3 . 85938 , - 5 . 484375 h 4 . 53125 l - 1 . 40625 , - 3 . 703125 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 765625 - 0 . 26563 , 1 . 28125 - 0 . 71875 , 2 . 546875 z m 23 . 65813 , - 2 . 375 h - 8 . 82813 v - 1 . 515625 h 8 . 82813 z m 0 , 4 . 0625 h - 8 . 82813 v - 1 . 53125 h 8 . 82813 z m 10 . 57826 , 7 . 71875 q - 1 . 35938 , - 1 . 703125 - 2 . 29688 , - 4 - 0 . 9375 , - 2 . 296875 - 0 . 9375 , - 4 . 765625 0 , - 2 . 15625 0 . 70313 , - 4 . 140625 0 . 82812 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17187 q - 1 . 09375 , 1 . 890625 - 1 . 45312 , 2 . 703125 - 0 . 54688 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 39063 , 1 . 703125 - 0 . 39063 , 3 . 421875 0 , 4 . 375 2 . 71875 , 8 . 75 z m 3 . 08768 , - 15 . 390625 v - 1 . 890625 h 1 . 64062 v 1 . 890625 z m 0 , 11 . 46875 v - 9 . 671875 h 1 . 64062 v 9 . 671875 z m 4 . 56671 , 0 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35938 , 0 . 640625 - 1 . 15625 , 0 . 984375 l - 0 . 45313 , - 0 . 703125 q 0 . 51563 , - 0 . 21875 0 . 76563 , - 0 . 671875 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 265625 z m 9 . 9291 , - 11 . 453125 v - 1 . 90625 h 1 . 64063 v 1 . 90625 z m - 2 . 07812 , 15 . 203125 0 . 3125 , - 1 . 390625 q 0 . 5 , 0 . 125 0 . 78125 , 0 . 125 0 . 5 , 0 0 . 73437 , - 0 . 328125 0 . 25 , - 0 . 328125 0 . 25 , - 1 . 671875 v - 10 . 15625 h 1 . 64063 v 10 . 203125 q 0 , 1 . 78125 - 0 . 46875 , 2 . 484375 - 0 . 59375 , 0 . 90625 - 1 . 96875 , 0 . 90625 - 0 . 65625 , 0 - 1 . 28125 , - 0 . 171875 z m 7 . 31668 , 0 . 171875 h - 1 . 1875 q 2 . 73438 , - 4 . 375 2 . 73438 , - 8 . 75 0 , - 1 . 71875 - 0 . 39063 , - 3 . 390625 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 35937 , - 0 . 828125 - 1 . 46875 , - 2 . 734375 h 1 . 1875 q 1 . 70313 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 984375 0 . 6875 , 4 . 140625 0 , 2 . 46875 - 0 . 9375 , 4 . 765625 - 0 . 9375 , 2 . 296875 - 2 . 28125 , 4 z m 9 . 67725 , - 7 . 9375 v - 1 . 640625 h 5 . 03125 v 1 . 640625 z m 15 . 4783 , - 1 . 828125 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01562 , - 2 . 90625 - 7 . 01562 , - 2 . 875 v - 1 . 640625 l 8 . 84375 , 3 . 734375 z m 10 . 57825 , 9 . 765625 q - 1 . 35938 , - 1 . 703125 - 2 . 29688 , - 4 - 0 . 9375 , - 2 . 296875 - 0 . 9375 , - 4 . 765625 0 , - 2 . 15625 0 . 70313 , - 4 . 140625 0 . 82812 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17187 q - 1 . 09375 , 1 . 890625 - 1 . 45312 , 2 . 703125 - 0 . 54688 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 39063 , 1 . 703125 - 0 . 39063 , 3 . 421875 0 , 4 . 375 2 . 71875 , 8 . 75 z m 3 . 08767 , - 15 . 390625 v - 1 . 890625 h 1 . 64063 v 1 . 890625 z m 0 , 11 . 46875 v - 9 . 671875 h 1 . 64063 v 9 . 671875 z m 4 . 56671 , 0 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 640625 - 1 . 15625 , 0 . 984375 l - 0 . 45312 , - 0 . 703125 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 671875 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 265625 z m 9 . 92911 , - 11 . 453125 v - 1 . 90625 h 1 . 64063 v 1 . 90625 z m - 2 . 07812 , 15 . 203125 0 . 3125 , - 1 . 390625 q 0 . 5 , 0 . 125 0 . 78125 , 0 . 125 0 . 5 , 0 0 . 73437 , - 0 . 328125 0 . 25 , - 0 . 328125 0 . 25 , - 1 . 671875 v - 10 . 15625 h 1 . 64063 v 10 . 203125 q 0 , 1 . 78125 - 0 . 46875 , 2 . 484375 - 0 . 59375 , 0 . 90625 - 1 . 96875 , 0 . 90625 - 0 . 65625 , 0 - 1 . 28125 , - 0 . 171875 z m 7 . 31668 , 0 . 171875 h - 1 . 1875 q 2 . 73437 , - 4 . 375 2 . 73437 , - 8 . 75 0 , - 1 . 71875 - 0 . 39062 , - 3 . 390625 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 35938 , - 0 . 828125 - 1 . 46875 , - 2 . 734375 h 1 . 1875 q 1 . 70312 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 984375 0 . 6875 , 4 . 140625 0 , 2 . 46875 - 0 . 9375 , 4 . 765625 - 0 . 9375 , 2 . 296875 - 2 . 28125 , 4 z m 9 . 66162 , - 6 . 8125 1 . 625 , - 0 . 25 q 0 . 125 , 0 . 96875 0 . 75 , 1 . 5 0 . 625 , 0 . 515625 1 . 75 , 0 . 515625 1 . 125 , 0 1 . 67187 , - 0 . 453125 0 . 54688 , - 0 . 46875 0 . 54688 , - 1 . 09375 0 , - 0 . 546875 - 0 . 48438 , - 0 . 875 - 0 . 32812 , - 0 . 21875 - 1 . 67187 , - 0 . 546875 - 1 . 8125 , - 0 . 46875 - 2 . 51563 , - 0 . 796875 - 0 . 6875 , - 0 . 328125 - 1 . 04687 , - 0 . 90625 - 0 . 35938 , - 0 . 59375 - 0 . 35938 , - 1 . 3125 0 , - 0 . 640625 0 . 29688 , - 1 . 1875 0 . 29687 , - 0 . 5625 0 . 8125 , - 0 . 921875 0 . 375 , - 0 . 28125 1 . 03125 , - 0 . 46875 0 . 67187 , - 0 . 203125 1 . 42187 , - 0 . 203125 1 . 14063 , 0 2 , 0 . 328125 0 . 85938 , 0 . 328125 1 . 26563 , 0 . 890625 0 . 42187 , 0 . 5625 0 . 57812 , 1 . 5 l - 1 . 60937 , 0 . 21875 q - 0 . 10938 , - 0 . 75 - 0 . 64063 , - 1 . 171875 - 0 . 51562 , - 0 . 421875 - 1 . 46875 , - 0 . 421875 - 1 . 14062 , 0 - 1 . 625 , 0 . 375 - 0 . 46875 , 0 . 375 - 0 . 46875 , 0 . 875 0 , 0 . 3125 0 . 1875 , 0 . 578125 0 . 20313 , 0 . 265625 0 . 64063 , 0 . 4375 0 . 23437 , 0 . 09375 1 . 4375 , 0 . 421875 1 . 75 , 0 . 453125 2 . 4375 , 0 . 75 0 . 6875 , 0 . 296875 1 . 07812 , 0 . 859375 0 . 39063 , 0 . 5625 0 . 39063 , 1 . 40625 0 , 0 . 828125 - 0 . 48438 , 1 . 546875 - 0 . 46875 , 0 . 71875 - 1 . 375 , 1 . 125 - 0 . 90625 , 0 . 390625 - 2 . 04687 , 0 . 390625 - 1 . 875 , 0 - 2 . 875 , - 0 . 78125 - 0 . 98438 , - 0 . 78125 - 1 . 25 , - 2 . 328125 z m 9 . 98437 , - 8 . 578125 v - 1 . 890625 h 1 . 64063 v 1 . 890625 z m 0 , 11 . 46875 v - 9 . 671875 h 1 . 64063 v 9 . 671875 z m 3 . 26981 , 0 v - 1 . 328125 l 6 . 15625 , - 7 . 078125 q - 1 . 04688 , 0 . 0625 - 1 . 84375 , 0 . 0625 h - 3 . 9375 v - 1 . 328125 h 7 . 90625 v 1 . 078125 l - 5 . 25 , 6 . 140625 - 1 , 1 . 125 q 1 . 09375 , - 0 . 07813 2 . 0625 , - 0 . 07813 h 4 . 46875 v 1 . 40625 z m 16 . 82812 , - 3 . 109375 1 . 6875 , 0 . 203125 q - 0 . 40625 , 1 . 484375 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 296875 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 671875 0 , - 2 . 453125 1 . 25 , - 3 . 796875 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 328125 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 703125 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 453125 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 484375 1 . 01562 , - 1 . 515625 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 828125 - 0 . 78125 , - 0 . 953125 - 2 . 03125 , - 0 . 953125 - 1 . 125 , 0 - 1 . 90625 , 0 . 765625 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 015625 z m 17 . 44965 , 9 . 6875 q - 1 . 35938 , - 1 . 703125 - 2 . 29688 , - 4 - 0 . 9375 , - 2 . 296875 - 0 . 9375 , - 4 . 765625 0 , - 2 . 15625 0 . 70313 , - 4 . 140625 0 . 82812 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17187 q - 1 . 09375 , 1 . 890625 - 1 . 45312 , 2 . 703125 - 0 . 54688 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 39063 , 1 . 703125 - 0 . 39063 , 3 . 421875 0 , 4 . 375 2 . 71875 , 8 . 75 z m 2 . 63455 , - 7 . 453125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 015625 0 . 6875 , 0 . 609375 1 . 65625 , 0 . 609375 1 . 15625 , 0 1 . 95312 , - 0 . 796875 0 . 79688 , - 0 . 796875 0 . 79688 , - 1 . 984375 0 , - 1 . 125 - 0 . 73438 , - 1 . 859375 - 0 . 73437 , - 0 . 734375 - 1 . 875 , - 0 . 734375 - 0 . 46875 , 0 - 1 . 15625 , 0 . 171875 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 01563 0 . 26563 , 0 . 01563 1 . 04687 , 0 1 . 875 , - 0 . 546875 0 . 84375 , - 0 . 546875 0 . 84375 , - 1 . 671875 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 609375 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 796875 l - 1 . 64063 , - 0 . 296875 q 0 . 29688 , - 1 . 640625 1 . 35938 , - 2 . 546875 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 859375 - 0 . 46875 , 1 . 578125 - 0 . 46875 , 0 . 703125 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 140625 0 . 65625 , 0 . 859375 0 . 65625 , 2 . 15625 0 , 1 . 734375 - 1 . 28125 , 2 . 953125 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 046875 - 1 . 15625 , - 1 . 046875 - 1 . 32812 , - 2 . 71875 z m 11 . 25073 , 3 . 53125 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35938 , 0 . 640625 - 1 . 15625 , 0 . 984375 l - 0 . 45313 , - 0 . 703125 q 0 . 51563 , - 0 . 21875 0 . 76563 , - 0 . 671875 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 265625 z m 9 . 49161 , - 3 . 53125 1 . 64059 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 015625 0 . 6875 , 0 . 609375 1 . 65625 , 0 . 609375 1 . 15625 , 0 1 . 95312 , - 0 . 796875 0 . 79688 , - 0 . 796875 0 . 79688 , - 1 . 984375 0 , - 1 . 125 - 0 . 73438 , - 1 . 859375 - 0 . 73437 , - 0 . 734375 - 1 . 875 , - 0 . 734375 - 0 . 46875 , 0 - 1 . 15625 , 0 . 171875 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 01563 0 . 26563 , 0 . 01563 1 . 04687 , 0 1 . 875 , - 0 . 546875 0 . 84375 , - 0 . 546875 0 . 84375 , - 1 . 671875 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 609375 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 796875 l - 1 . 6406 , - 0 . 296875 q 0 . 29688 , - 1 . 640625 1 . 35938 , - 2 . 546875 1 . 06247 , - 0 . 90625 2 . 65622 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 859375 - 0 . 46875 , 1 . 578125 - 0 . 46875 , 0 . 703125 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 140625 0 . 65625 , 0 . 859375 0 . 65625 , 2 . 15625 0 , 1 . 734375 - 1 . 28125 , 2 . 953125 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92185 , - 1 . 046875 - 1 . 15625 , - 1 . 046875 - 1 . 32812 , - 2 . 71875 z m 11 . 90695 , 7 . 453125 h - 1 . 1875 q 2 . 73437 , - 4 . 375 2 . 73437 , - 8 . 75 0 , - 1 . 71875 - 0 . 39062 , - 3 . 390625 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 35938 , - 0 . 828125 - 1 . 46875 , - 2 . 734375 h 1 . 1875 q 1 . 70312 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 984375 0 . 6875 , 4 . 140625 0 , 2 . 46875 - 0 . 9375 , 4 . 765625 - 0 . 9375 , 2 . 296875 - 2 . 28125 , 4 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path143 " <nl> + d = " m 163 . 38583 , 217 . 19421 h 582 . 48816 v 44 . 34647 H 163 . 38583 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path145 " <nl> + d = " m 173 . 32333 , 244 . 3486 0 . 79687 , - 3 . 89063 h - 1 . 54687 v - 1 . 35937 h 1 . 8125 l 0 . 67187 , - 3 . 29688 h - 2 . 48437 v - 1 . 35939 h 2 . 76562 l 0 . 79688 , - 3 . 90625 h 1 . 35937 l - 0 . 79687 , 3 . 90625 h 2 . 875 l 0 . 79687 , - 3 . 90625 h 1 . 375 l - 0 . 79687 , 3 . 90625 h 1 . 57812 v 1 . 35939 h - 1 . 84375 l - 0 . 6875 , 3 . 29688 h 2 . 53125 v 1 . 35937 h - 2 . 8125 l - 0 . 78125 , 3 . 89063 h - 1 . 375 l 0 . 78125 , - 3 . 89063 h - 2 . 85937 l - 0 . 78125 , 3 . 89063 z m 2 . 4375 , - 5 . 25 h 2 . 85937 l 0 . 6875 , - 3 . 29688 h - 2 . 875 z m 8 . 23509 , - 6 . 45314 v - 1 . 89063 h 1 . 64063 v 1 . 89063 z m 0 , 11 . 46876 v - 9 . 67189 h 1 . 64063 v 9 . 67189 z m 4 . 14482 , 0 v - 9 . 67189 h 1 . 46875 v 1 . 35939 q 0 . 45313 , - 0 . 71876 1 . 20313 , - 1 . 14064 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23439 1 . 15625 , - 1 . 68752 2 . 98438 , - 1 . 68752 1 . 45312 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79689 0 . 78125 , 2 . 45314 v 6 . 64062 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70312 - 0 . 42188 , - 0 . 26563 - 0 . 98438 , - 0 . 26563 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67188 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 21 . 85331 , - 1 . 1875 q - 0 . 92188 , 0 . 76563 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98437 0 , - 0 . 71875 0 . 32812 , - 1 . 29688 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35937 1 . 1875 , - 0 . 54687 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23438 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42188 0 , - 1 - 0 . 46875 , - 1 . 42187 - 0 . 625 , - 0 . 54688 - 1 . 875 , - 0 . 54688 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42188 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01563 0 . 71875 , - 1 . 64064 0 . 5 , - 0 . 64063 1 . 45312 , - 0 . 98438 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29688 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73437 0 . 375 , 0 . 43752 0 . 51563 , 1 . 10939 0 . 0781 , 0 . 42188 0 . 0781 , 1 . 51563 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89062 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51562 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67187 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14062 - 1 . 4375 , 0 . 32812 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42187 1 . 09375 , - 1 . 14062 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64063 z m 4 . 20384 , 8 . 5625 v - 13 . 37502 h 1 . 48438 v 1 . 25002 q 0 . 53125 , - 0 . 73439 1 . 1875 , - 1 . 09377 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 64063 0 . 95313 , 0 . 625 1 . 4375 , 1 . 79689 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 54687 0 , 1 . 48438 - 0 . 53125 , 2 . 67188 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 82812 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70313 z m 1 . 48438 , - 8 . 48438 q 0 , 1 . 85938 0 . 75 , 2 . 76563 0 . 76562 , 0 . 89062 1 . 82812 , 0 . 89062 1 . 09375 , 0 1 . 875 , - 0 . 92187 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 76563 - 0 . 75 , - 0 . 92189 - 1 . 8125 , - 0 . 92189 - 1 . 04688 , 0 - 1 . 85938 , 0 . 98439 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 9 . 01634 , 4 . 78125 v - 13 . 35939 h 5 . 01562 q 1 . 53125 , 0 2 . 45313 , 0 . 40625 0 . 92187 , 0 . 40625 1 . 4375 , 1 . 25 0 . 53125 , 0 . 84375 0 . 53125 , 1 . 76563 0 , 0 . 85937 - 0 . 46875 , 1 . 62501 - 0 . 45313 , 0 . 75 - 1 . 39063 , 1 . 20313 1 . 20313 , 0 . 35937 1 . 85938 , 1 . 21875 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 01562 0 , 0 . 9375 - 0 . 40625 , 1 . 75 - 0 . 39063 , 0 . 79688 - 0 . 98438 , 1 . 23438 - 0 . 57812 , 0 . 4375 - 1 . 45312 , 0 . 67187 - 0 . 875 , 0 . 21875 - 2 . 15625 , 0 . 21875 z m 1 . 78125 , - 7 . 75 h 2 . 875 q 1 . 1875 , 0 1 . 6875 , - 0 . 14062 0 . 67187 , - 0 . 20313 1 . 01562 , - 0 . 67189 0 . 34375 , - 0 . 46875 0 . 34375 , - 1 . 17188 0 , - 0 . 65625 - 0 . 32812 , - 1 . 15625 - 0 . 3125 , - 0 . 51562 - 0 . 90625 , - 0 . 70312 - 0 . 59375 , - 0 . 1875 - 2 . 03125 , - 0 . 1875 h - 2 . 65625 z m 0 , 6 . 17188 h 3 . 3125 q 0 . 85937 , 0 1 . 20312 , - 0 . 0625 0 . 60938 , - 0 . 10938 1 . 01563 , - 0 . 35938 0 . 42187 , - 0 . 26562 0 . 6875 , - 0 . 75 0 . 26562 , - 0 . 48437 0 . 26562 , - 1 . 125 0 , - 0 . 75 - 0 . 39062 , - 1 . 29687 - 0 . 375 , - 0 . 54688 - 1 . 0625 , - 0 . 76563 - 0 . 67188 , - 0 . 23437 - 1 . 95313 , - 0 . 23437 h - 3 . 07812 z m 18 . 69357 , 0 v 1 . 57812 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76563 , - 1 . 04689 0 . 76563 , - 1 . 96877 0 , - 0 . 98437 - 0 . 70313 , - 1 . 64062 - 0 . 6875 , - 0 . 67188 - 1 . 8125 , - 0 . 67188 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70313 - 0 . 70312 , 1 . 95313 l - 1 . 6875 , - 0 . 17188 q 0 . 17187 , - 1 . 89062 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98437 3 . 03125 , - 0 . 98437 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64062 0 , 0 . 79688 - 0 . 32813 , 1 . 57814 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 0 . 95386 , 1 . 57812 5 . 125 , - 13 . 35939 h 1 . 90625 l 5 . 46875 , 13 . 35939 h - 2 . 01563 l - 1 . 54687 , - 4 . 04687 h - 5 . 59375 l - 1 . 46875 , 4 . 04687 z m 3 . 85937 , - 5 . 48437 h 4 . 53125 l - 1 . 40625 , - 3 . 70314 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76563 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54688 z m 23 . 65812 , - 2 . 375 h - 8 . 82813 v - 1 . 51564 h 8 . 82813 z m 0 , 4 . 0625 h - 8 . 82813 v - 1 . 53125 h 8 . 82813 z m 10 . 57827 , 7 . 71875 q - 1 . 35937 , - 1 . 70313 - 2 . 29687 , - 4 - 0 . 9375 , - 2 . 29688 - 0 . 9375 , - 4 . 76563 0 , - 2 . 15625 0 . 70312 , - 4 . 14064 0 . 82813 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17188 q - 1 . 09375 , 1 . 89063 - 1 . 45313 , 2 . 70313 - 0 . 54687 , 1 . 25 - 0 . 875 , 2 . 62501 - 0 . 39062 , 1 . 70313 - 0 . 39062 , 3 . 42188 0 , 4 . 375 2 . 71875 , 8 . 75 z m 9 . 35331 , - 3 . 92188 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 18752 1 . 4375 , - 1 . 81252 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35939 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 8 . 82883 , - 1 . 76563 q 0 , - 2 . 35939 0 . 48437 , - 3 . 79689 0 . 48438 , - 1 . 45312 1 . 4375 , - 2 . 23437 0 . 96875 , - 0 . 78125 2 . 42188 , - 0 . 78125 1 . 07812 , 0 1 . 89062 , 0 . 4375 0 . 8125 , 0 . 42187 1 . 32813 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82812 , 1 . 98437 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14064 0 , 2 . 35938 - 0 . 48437 , 3 . 8125 - 0 . 48438 , 1 . 4375 - 1 . 45313 , 2 . 23438 - 0 . 95312 , 0 . 78125 - 2 . 42187 , 0 . 78125 - 1 . 92188 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67187 , 0 q 0 , 3 . 29688 0 . 76563 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14062 , 0 1 . 90625 , - 1 . 09375 0 . 76562 , - 1 . 09375 0 . 76562 , - 4 . 375 0 , - 3 . 29689 - 0 . 76562 , - 4 . 37501 - 0 . 76563 , - 1 . 07813 - 1 . 92188 , - 1 . 07813 - 1 . 125 , 0 - 1 . 79687 , 0 . 95313 - 0 . 85938 , 1 . 21875 - 0 . 85938 , 4 . 50001 z m 9 . 57886 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 16 . 21036 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 18752 1 . 4375 , - 1 . 81252 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35939 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 15 . 00071 , 4 . 82812 h - 1 . 64063 v - 10 . 45314 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14063 - 0 . 95312 , 0 . 5625 - 1 . 71875 , 0 . 84376 v - 1 . 59376 q 1 . 375 , - 0 . 64063 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92188 1 . 45313 , - 1 . 78125 h 1 . 0625 z m 5 . 7351 , 3 . 92188 h - 1 . 1875 q 2 . 73438 , - 4 . 375 2 . 73438 , - 8 . 75 0 , - 1 . 71875 - 0 . 39063 , - 3 . 39063 - 0 . 3125 , - 1 . 37501 - 0 . 875 , - 2 . 62501 - 0 . 35937 , - 0 . 82813 - 1 . 46875 , - 2 . 73438 h 1 . 1875 q 1 . 70313 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 98439 0 . 6875 , 4 . 14064 0 , 2 . 46875 - 0 . 9375 , 4 . 76563 - 0 . 9375 , 2 . 29687 - 2 . 28125 , 4 z m 5 . 1658 , - 0 . 21875 v - 17 . 06252 h 3 . 60938 v 1 . 35938 h - 1 . 96875 v 14 . 34376 h 1 . 96875 v 1 . 35938 z m 4 . 76142 , - 8 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54687 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92188 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54687 , - 0 . 20313 - 2 . 39062 , - 0 . 64063 - 1 . 82813 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75002 - 0 . 46875 , - 1 . 67189 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 89063 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 45313 2 . 45312 , - 0 . 45313 1 . 48438 , 0 2 . 60938 , 0 . 48438 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 92187 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 26563 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 42187 0 , 0 . 71875 0 . 53125 , 1 . 17188 0 . 5 , 0 . 46876 2 . 65625 , 0 . 96876 2 . 15625 , 0 . 48438 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 01562 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 51563 - 2 . 57812 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 38107 , - 2 . 29688 q 0 , - 2 . 35939 0 . 48438 , - 3 . 79689 0 . 48437 , - 1 . 45312 1 . 4375 , - 2 . 23437 0 . 96875 , - 0 . 78125 2 . 42187 , - 0 . 78125 1 . 07813 , 0 1 . 89063 , 0 . 4375 0 . 8125 , 0 . 42187 1 . 32812 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82813 , 1 . 98437 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14064 0 , 2 . 35938 - 0 . 48438 , 3 . 8125 - 0 . 48437 , 1 . 4375 - 1 . 45312 , 2 . 23438 - 0 . 95313 , 0 . 78125 - 2 . 42188 , 0 . 78125 - 1 . 92187 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67188 , 0 q 0 , 3 . 29688 0 . 76562 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14063 , 0 1 . 90625 , - 1 . 09375 0 . 76563 , - 1 . 09375 0 . 76563 , - 4 . 375 0 , - 3 . 29689 - 0 . 76563 , - 4 . 37501 - 0 . 76562 , - 1 . 07813 - 1 . 92187 , - 1 . 07813 - 1 . 125 , 0 - 1 . 79688 , 0 . 95313 - 0 . 85937 , 1 . 21875 - 0 . 85937 , 4 . 50001 z m 9 . 57885 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 9 . 55411 , - 4 . 29687 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54688 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92187 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35938 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54688 , - 0 . 20313 - 2 . 39063 , - 0 . 64063 - 1 . 82812 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75002 - 0 . 46875 , - 1 . 67189 0 , - 1 0 . 57813 , - 1 . 875 0 . 57812 , - 0 . 89063 1 . 67187 , - 1 . 34375 1 . 10938 , - 0 . 45313 2 . 45313 , - 0 . 45313 1 . 48437 , 0 2 . 60937 , 0 . 48438 1 . 14063 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60938 , 0 . 92187 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14062 , - 1 . 26563 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60937 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73437 , 0 . 59375 - 0 . 73437 , 1 . 42187 0 , 0 . 71875 0 . 53125 , 1 . 17188 0 . 5 , 0 . 46876 2 . 65625 , 0 . 96876 2 . 15625 , 0 . 48438 2 . 95312 , 0 . 84375 1 . 17188 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60937 , 2 . 01562 - 0 . 60938 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14063 , 0 . 51563 - 2 . 57813 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04687 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92188 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 18 . 55295 , 4 . 29687 h - 1 . 64063 v - 10 . 45314 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14063 - 0 . 95312 , 0 . 5625 - 1 . 71875 , 0 . 84376 v - 1 . 59376 q 1 . 375 , - 0 . 64063 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92188 1 . 45313 , - 1 . 78125 h 1 . 0625 z m 7 . 39133 , 3 . 70313 h - 3 . 60938 v - 1 . 35938 h 1 . 96875 v - 14 . 34376 h - 1 . 96875 v - 1 . 35938 h 3 . 60938 z m 6 . 9916 , - 7 . 71875 v - 1 . 64063 h 5 . 03125 v 1 . 64063 z m 15 . 47831 , - 1 . 82813 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01562 , - 2 . 90625 - 7 . 01562 , - 2 . 87501 v - 1 . 64063 l 8 . 84375 , 3 . 73439 z m 10 . 57827 , 9 . 76563 q - 1 . 35937 , - 1 . 70313 - 2 . 29687 , - 4 - 0 . 9375 , - 2 . 29688 - 0 . 9375 , - 4 . 76563 0 , - 2 . 15625 0 . 70312 , - 4 . 14064 0 . 82813 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17188 q - 1 . 09375 , 1 . 89063 - 1 . 45313 , 2 . 70313 - 0 . 54687 , 1 . 25 - 0 . 875 , 2 . 62501 - 0 . 39062 , 1 . 70313 - 0 . 39062 , 3 . 42188 0 , 4 . 375 2 . 71875 , 8 . 75 z m 9 . 35331 , - 3 . 92188 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 18752 1 . 4375 , - 1 . 81252 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35939 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 8 . 82883 , - 1 . 76563 q 0 , - 2 . 35939 0 . 48437 , - 3 . 79689 0 . 48438 , - 1 . 45312 1 . 4375 , - 2 . 23437 0 . 96875 , - 0 . 78125 2 . 42188 , - 0 . 78125 1 . 07812 , 0 1 . 89062 , 0 . 4375 0 . 8125 , 0 . 42187 1 . 32813 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82812 , 1 . 98437 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14064 0 , 2 . 35938 - 0 . 48437 , 3 . 8125 - 0 . 48438 , 1 . 4375 - 1 . 45313 , 2 . 23438 - 0 . 95312 , 0 . 78125 - 2 . 42187 , 0 . 78125 - 1 . 92188 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67187 , 0 q 0 , 3 . 29688 0 . 76563 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14062 , 0 1 . 90625 , - 1 . 09375 0 . 76562 , - 1 . 09375 0 . 76562 , - 4 . 375 0 , - 3 . 29689 - 0 . 76562 , - 4 . 37501 - 0 . 76563 , - 1 . 07813 - 1 . 92188 , - 1 . 07813 - 1 . 125 , 0 - 1 . 79687 , 0 . 95313 - 0 . 85938 , 1 . 21875 - 0 . 85938 , 4 . 50001 z m 17 . 77777 , 4 . 4375 v - 3 . 67187 h - 3 . 64062 v - 1 . 51563 h 3 . 64062 v - 3 . 64064 h 1 . 54688 v 3 . 64064 h 3 . 64062 v 1 . 51563 h - 3 . 64062 v 3 . 67187 z m 12 . 25013 , - 2 . 14062 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54687 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92188 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54687 , - 0 . 20313 - 2 . 39062 , - 0 . 64063 - 1 . 82813 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75002 - 0 . 46875 , - 1 . 67189 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 89063 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 45313 2 . 45312 , - 0 . 45313 1 . 48438 , 0 2 . 60938 , 0 . 48438 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 92187 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 26563 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 42187 0 , 0 . 71875 0 . 53125 , 1 . 17188 0 . 5 , 0 . 46876 2 . 65625 , 0 . 96876 2 . 15625 , 0 . 48438 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 01562 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 51563 - 2 . 57812 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 38107 , - 2 . 29688 q 0 , - 2 . 35939 0 . 48437 , - 3 . 79689 0 . 48438 , - 1 . 45312 1 . 4375 , - 2 . 23437 0 . 96875 , - 0 . 78125 2 . 42188 , - 0 . 78125 1 . 07812 , 0 1 . 89062 , 0 . 4375 0 . 8125 , 0 . 42187 1 . 32813 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82812 , 1 . 98437 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14064 0 , 2 . 35938 - 0 . 48437 , 3 . 8125 - 0 . 48438 , 1 . 4375 - 1 . 45313 , 2 . 23438 - 0 . 95312 , 0 . 78125 - 2 . 42187 , 0 . 78125 - 1 . 92188 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 67187 , 0 q 0 , 3 . 29688 0 . 76563 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 14062 , 0 1 . 90625 , - 1 . 09375 0 . 76562 , - 1 . 09375 0 . 76562 , - 4 . 375 0 , - 3 . 29689 - 0 . 76562 , - 4 . 37501 - 0 . 76563 , - 1 . 07813 - 1 . 92188 , - 1 . 07813 - 1 . 125 , 0 - 1 . 79687 , 0 . 95313 - 0 . 85938 , 1 . 21875 - 0 . 85938 , 4 . 50001 z m 9 . 57886 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 16 . 21033 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 18752 1 . 4375 , - 1 . 81252 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35939 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 15 . 00074 , 4 . 82812 h - 1 . 64063 v - 10 . 45314 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14063 - 0 . 95312 , 0 . 5625 - 1 . 71875 , 0 . 84376 v - 1 . 59376 q 1 . 375 , - 0 . 64063 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92188 1 . 45313 , - 1 . 78125 h 1 . 0625 z m 13 . 27777 , - 2 . 15625 v - 3 . 67187 h - 3 . 64063 v - 1 . 51563 h 3 . 64063 v - 3 . 64064 h 1 . 54687 v 3 . 64064 h 3 . 64063 v 1 . 51563 h - 3 . 64063 v 3 . 67187 z m 12 . 25012 , - 2 . 14062 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54687 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92188 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54687 , - 0 . 20313 - 2 . 39062 , - 0 . 64063 - 1 . 82813 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75002 - 0 . 46875 , - 1 . 67189 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 89063 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 45313 2 . 45312 , - 0 . 45313 1 . 48438 , 0 2 . 60938 , 0 . 48438 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 92187 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 26563 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 42187 0 , 0 . 71875 0 . 53125 , 1 . 17188 0 . 5 , 0 . 46876 2 . 65625 , 0 . 96876 2 . 15625 , 0 . 48438 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 01562 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 51563 - 2 . 57812 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 18 . 55292 , 4 . 29687 h - 1 . 64063 v - 10 . 45314 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14063 - 0 . 95312 , 0 . 5625 - 1 . 71875 , 0 . 84376 v - 1 . 59376 q 1 . 375 , - 0 . 64063 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92188 1 . 45313 , - 1 . 78125 h 1 . 0625 z m 5 . 7351 , 3 . 92188 h - 1 . 1875 q 2 . 73438 , - 4 . 375 2 . 73438 , - 8 . 75 0 , - 1 . 71875 - 0 . 39063 , - 3 . 39063 - 0 . 3125 , - 1 . 37501 - 0 . 875 , - 2 . 62501 - 0 . 35937 , - 0 . 82813 - 1 . 46875 , - 2 . 73438 h 1 . 1875 q 1 . 70313 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 98439 0 . 6875 , 4 . 14064 0 , 2 . 46875 - 0 . 9375 , 4 . 76563 - 0 . 9375 , 2 . 29687 - 2 . 28125 , 4 z m 9 . 66162 , - 6 . 8125 1 . 625 , - 0 . 25 q 0 . 125 , 0 . 96875 0 . 75 , 1 . 5 0 . 625 , 0 . 51562 1 . 75 , 0 . 51562 1 . 125 , 0 1 . 67188 , - 0 . 45312 0 . 54687 , - 0 . 46875 0 . 54687 , - 1 . 09375 0 , - 0 . 54688 - 0 . 48437 , - 0 . 875 - 0 . 32813 , - 0 . 21875 - 1 . 67188 , - 0 . 54688 - 1 . 8125 , - 0 . 46875 - 2 . 51562 , - 0 . 79687 - 0 . 6875 , - 0 . 32813 - 1 . 04688 , - 0 . 90625 - 0 . 35937 , - 0 . 59375 - 0 . 35937 , - 1 . 3125 0 , - 0 . 64063 0 . 29687 , - 1 . 1875 0 . 29688 , - 0 . 56252 0 . 8125 , - 0 . 92189 0 . 375 , - 0 . 28125 1 . 03125 , - 0 . 46875 0 . 67188 , - 0 . 20313 1 . 42188 , - 0 . 20313 1 . 14062 , 0 2 , 0 . 32813 0 . 85937 , 0 . 32812 1 . 26562 , 0 . 89062 0 . 42188 , 0 . 56252 0 . 57813 , 1 . 50002 l - 1 . 60938 , 0 . 21875 q - 0 . 10937 , - 0 . 75 - 0 . 64062 , - 1 . 17188 - 0 . 51563 , - 0 . 42189 - 1 . 46875 , - 0 . 42189 - 1 . 14063 , 0 - 1 . 625 , 0 . 37502 - 0 . 46875 , 0 . 375 - 0 . 46875 , 0 . 875 0 , 0 . 3125 0 . 1875 , 0 . 57812 0 . 20312 , 0 . 26563 0 . 64062 , 0 . 4375 0 . 23438 , 0 . 0937 1 . 4375 , 0 . 42188 1 . 75 , 0 . 45312 2 . 4375 , 0 . 75 0 . 6875 , 0 . 29687 1 . 07813 , 0 . 85937 0 . 39062 , 0 . 5625 0 . 39062 , 1 . 40625 0 , 0 . 82813 - 0 . 48437 , 1 . 54688 - 0 . 46875 , 0 . 71875 - 1 . 375 , 1 . 125 - 0 . 90625 , 0 . 39062 - 2 . 04688 , 0 . 39062 - 1 . 875 , 0 - 2 . 875 , - 0 . 78125 - 0 . 98437 , - 0 . 78125 - 1 . 25 , - 2 . 32812 z m 9 . 98438 , - 8 . 57814 v - 1 . 89063 h 1 . 64062 v 1 . 89063 z m 0 , 11 . 46876 v - 9 . 67189 h 1 . 64062 v 9 . 67189 z m 3 . 26983 , 0 v - 1 . 32812 l 6 . 15625 , - 7 . 07813 q - 1 . 04687 , 0 . 0625 - 1 . 84375 , 0 . 0625 h - 3 . 9375 v - 1 . 32814 h 7 . 90625 v 1 . 07813 l - 5 . 25 , 6 . 14064 - 1 , 1 . 125 q 1 . 09375 , - 0 . 0781 2 . 0625 , - 0 . 0781 h 4 . 46875 v 1 . 40625 z m 16 . 82813 , - 3 . 10937 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79689 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 31251 1 . 23437 , 3 . 70314 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48437 1 . 01563 , - 1 . 51562 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95314 - 2 . 03125 , - 0 . 95314 - 1 . 125 , 0 - 1 . 90625 , 0 . 76564 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01563 z m 17 . 44965 , 9 . 6875 q - 1 . 35937 , - 1 . 70313 - 2 . 29687 , - 4 - 0 . 9375 , - 2 . 29688 - 0 . 9375 , - 4 . 76563 0 , - 2 . 15625 0 . 70312 , - 4 . 14064 0 . 82813 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17188 q - 1 . 09375 , 1 . 89063 - 1 . 45313 , 2 . 70313 - 0 . 54687 , 1 . 25 - 0 . 875 , 2 . 62501 - 0 . 39062 , 1 . 70313 - 0 . 39062 , 3 . 42188 0 , 4 . 375 2 . 71875 , 8 . 75 z m 2 . 63452 , - 7 . 45313 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 01563 0 . 6875 , 0 . 60937 1 . 65625 , 0 . 60937 1 . 15625 , 0 1 . 95313 , - 0 . 79687 0 . 79687 , - 0 . 79688 0 . 79687 , - 1 . 98438 0 , - 1 . 125 - 0 . 73437 , - 1 . 85937 - 0 . 73438 , - 0 . 73438 - 1 . 875 , - 0 . 73438 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17188 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26562 , 0 . 0156 1 . 04688 , 0 1 . 875 , - 0 . 54687 0 . 84375 , - 0 . 54689 0 . 84375 , - 1 . 67189 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64062 , - 0 . 29688 q 0 . 29687 , - 1 . 64062 1 . 35937 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57814 - 0 . 46875 , 0 . 70312 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14062 0 . 65625 , 0 . 85938 0 . 65625 , 2 . 15625 0 , 1 . 73438 - 1 . 28125 , 2 . 95313 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 04688 - 1 . 15625 , - 1 . 04687 - 1 . 32813 , - 2 . 71875 z m 11 . 25073 , 3 . 53125 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 9 . 49158 , - 3 . 53125 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 01563 0 . 6875 , 0 . 60937 1 . 65625 , 0 . 60937 1 . 15625 , 0 1 . 95313 , - 0 . 79687 0 . 79687 , - 0 . 79688 0 . 79687 , - 1 . 98438 0 , - 1 . 125 - 0 . 73437 , - 1 . 85937 - 0 . 73438 , - 0 . 73438 - 1 . 875 , - 0 . 73438 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17188 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26562 , 0 . 0156 1 . 04688 , 0 1 . 875 , - 0 . 54687 0 . 84375 , - 0 . 54689 0 . 84375 , - 1 . 67189 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64062 , - 0 . 29688 q 0 . 29687 , - 1 . 64062 1 . 35937 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57814 - 0 . 46875 , 0 . 70312 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14062 0 . 65625 , 0 . 85938 0 . 65625 , 2 . 15625 0 , 1 . 73438 - 1 . 28125 , 2 . 95313 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 04688 - 1 . 15625 , - 1 . 04687 - 1 . 32813 , - 2 . 71875 z m 11 . 90698 , 7 . 45313 h - 1 . 1875 q 2 . 73438 , - 4 . 375 2 . 73438 , - 8 . 75 0 , - 1 . 71875 - 0 . 39063 , - 3 . 39063 - 0 . 3125 , - 1 . 37501 - 0 . 875 , - 2 . 62501 - 0 . 35937 , - 0 . 82813 - 1 . 46875 , - 2 . 73438 h 1 . 1875 q 1 . 70313 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 98439 0 . 6875 , 4 . 14064 0 , 2 . 46875 - 0 . 9375 , 4 . 76563 - 0 . 9375 , 2 . 29687 - 2 . 28125 , 4 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path147 " <nl> + d = " m 73 . 383199 , 138 . 91863 h 12 . 377953 v 16 . 28348 H 73 . 383199 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path149 " <nl> + d = " m 77 . 995529 , 152 . 65335 v - 1 . 89063 h 1 . 640625 v 1 . 89063 z m 0 , 11 . 46875 v - 9 . 67188 h 1 . 640625 v 9 . 67188 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path151 " <nl> + d = " M 128 . 95013 , 76 . 837268 H 156 . 4147 V 109 . 84514 H 128 . 95013 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path153 " <nl> + d = " m 139 . 16888 , 92 . 304143 v - 1 . 90625 h 1 . 64062 v 1 . 90625 z m - 2 . 07813 , 15 . 203117 0 . 3125 , - 1 . 39062 q 0 . 5 , 0 . 125 0 . 78125 , 0 . 125 0 . 5 , 0 0 . 73438 , - 0 . 32813 0 . 25 , - 0 . 32812 0 . 25 , - 1 . 67187 V 94 . 085393 h 1 . 64062 v 10 . 203117 q 0 , 1 . 78125 - 0 . 46875 , 2 . 48438 - 0 . 59375 , 0 . 90625 - 1 . 96875 , 0 . 90625 - 0 . 65625 , 0 - 1 . 28125 , - 0 . 17188 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path155 " <nl> + d = " m 0 , 101 . 84776 h 128 . 18896 v 21 . 48032 H 0 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path157 " <nl> + d = " m 13 . 359375 , 132 . 68964 q - 1 . 359375 , - 1 . 70313 - 2 . 296875 , - 4 - 0 . 9375 , - 2 . 29688 - 0 . 9375 , - 4 . 76563 0 , - 2 . 15625 0 . 703125 , - 4 . 14062 0 . 828125 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 171875 q - 1 . 09375 , 1 . 89062 - 1 . 453125 , 2 . 70312 - 0 . 546875 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 390625 , 1 . 70313 - 0 . 390625 , 3 . 42188 0 , 4 . 375 2 . 71875 , 8 . 75 z m 2 . 697052 , - 8 . 21875 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 546875 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 921875 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 359375 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 546875 , - 0 . 20313 - 2 . 390625 , - 0 . 64063 - 1 . 828125 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67188 0 , - 1 0 . 578125 , - 1 . 875 0 . 578125 , - 0 . 89062 1 . 671875 , - 1 . 34375 1 . 109375 , - 0 . 45312 2 . 453125 , - 0 . 45312 1 . 484375 , 0 2 . 609375 , 0 . 48437 1 . 140625 , 0 . 46875 1 . 75 , 1 . 40625 0 . 609375 , 0 . 92188 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 140625 , - 1 . 26562 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 609375 , 0 - 2 . 34375 , 0 . 59375 - 0 . 734375 , 0 . 59375 - 0 . 734375 , 1 . 42188 0 , 0 . 71875 0 . 53125 , 1 . 17187 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48438 2 . 953125 , 0 . 84375 1 . 171875 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 609375 , 2 . 01562 - 0 . 609375 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 140625 , 0 . 51563 - 2 . 578125 , 0 . 51563 - 1 . 8125 , 0 - 3 . 046875 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 921875 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z M 28 . 4375 , 122 . 17401 q 0 , - 2 . 35937 0 . 484375 , - 3 . 79687 0 . 484375 , - 1 . 45313 1 . 4375 , - 2 . 23438 0 . 96875 , - 0 . 78125 2 . 421875 , - 0 . 78125 1 . 078125 , 0 1 . 890625 , 0 . 4375 0 . 8125 , 0 . 42188 1 . 328125 , 1 . 25 0 . 53125 , 0 . 8125 0 . 828125 , 1 . 98438 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14062 0 , 2 . 35938 - 0 . 484375 , 3 . 8125 - 0 . 484375 , 1 . 4375 - 1 . 453125 , 2 . 23438 - 0 . 953125 , 0 . 78125 - 2 . 421875 , 0 . 78125 - 1 . 921875 , 0 - 3 . 03125 , - 1 . 39063 - 1 . 3125 , - 1 . 67187 - 1 . 3125 , - 5 . 4375 z m 1 . 671875 , 0 q 0 , 3 . 29688 0 . 765625 , 4 . 39063 0 . 78125 , 1 . 07812 1 . 90625 , 1 . 07812 1 . 140625 , 0 1 . 90625 , - 1 . 09375 0 . 765625 , - 1 . 09375 0 . 765625 , - 4 . 375 0 , - 3 . 29687 - 0 . 765625 , - 4 . 375 - 0 . 765625 , - 1 . 07812 - 1 . 921875 , - 1 . 07812 - 1 . 125 , 0 - 1 . 796875 , 0 . 95312 - 0 . 859375 , 1 . 21875 - 0 . 859375 , 4 . 5 z m 9 . 578842 , 6 . 59375 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 359375 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 453125 , - 0 . 70313 q 0 . 515625 , - 0 . 21875 0 . 765625 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 9 . 554108 , - 4 . 29687 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 546875 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 921875 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 359375 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 546875 , - 0 . 20313 - 2 . 390625 , - 0 . 64063 - 1 . 828125 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67188 0 , - 1 0 . 578125 , - 1 . 875 0 . 578125 , - 0 . 89062 1 . 671875 , - 1 . 34375 1 . 109375 , - 0 . 45312 2 . 453125 , - 0 . 45312 1 . 484375 , 0 2 . 609375 , 0 . 48437 1 . 140625 , 0 . 46875 1 . 75 , 1 . 40625 0 . 609375 , 0 . 92188 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 140625 , - 1 . 26562 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 609375 , 0 - 2 . 34375 , 0 . 59375 - 0 . 734375 , 0 . 59375 - 0 . 734375 , 1 . 42188 0 , 0 . 71875 0 . 53125 , 1 . 17187 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48438 2 . 953125 , 0 . 84375 1 . 171875 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 609375 , 2 . 01562 - 0 . 609375 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 140625 , 0 . 51563 - 2 . 578125 , 0 . 51563 - 1 . 8125 , 0 - 3 . 046875 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 921875 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 18 . 552948 , 4 . 29687 h - 1 . 640625 v - 10 . 45312 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14062 - 0 . 953125 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64062 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92187 1 . 453125 , - 1 . 78125 h 1 . 0625 z m 5 . 735092 , 3 . 92188 h - 1 . 1875 q 2 . 734375 , - 4 . 375 2 . 734375 , - 8 . 75 0 , - 1 . 71875 - 0 . 390625 , - 3 . 39063 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 359375 , - 0 . 82812 - 1 . 46875 , - 2 . 73437 h 1 . 1875 q 1 . 703125 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 98437 0 . 6875 , 4 . 14062 0 , 2 . 46875 - 0 . 9375 , 4 . 76563 - 0 . 9375 , 2 . 29687 - 2 . 28125 , 4 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path159 " <nl> + d = " m 54 . 629919 , 131 . 32808 63 . 433071 , 13 . 85826 " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path161 " <nl> + d = " m 54 . 629919 , 131 . 32808 57 . 571331 , 12 . 57765 " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path163 " <nl> + d = " m 111 . 84871 , 145 . 51939 4 . 78606 , - 0 . 64507 - 4 . 08098 , - 2 . 58227 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path165 " <nl> + d = " M 129 . 79528 , 118 . 46719 128 . 18897 , 34 . 719153 " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path167 " <nl> + d = " M 129 . 79528 , 118 . 46719 128 . 30402 , 40 . 718047 " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path169 " <nl> + d = " m 129 . 95547 , 40 . 686383 - 1 . 73846 , - 4 . 505589 - 1 . 5644 , 4 . 568936 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path171 " <nl> + d = " m 153 . 25985 , 273 . 69815 v - 75 . 1181 " / > <nl> + < path <nl> + style = " fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt ; stroke - linejoin : round " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path173 " <nl> + d = " m 153 . 25985 , 273 . 69815 v - 69 . 1181 " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : evenodd ; stroke : # 000000 ; stroke - width : 1 ; stroke - linecap : butt " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path175 " <nl> + d = " m 154 . 91157 , 204 . 58005 - 1 . 65172 , - 4 . 5381 - 1 . 65173 , 4 . 5381 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path177 " <nl> + d = " m 82 . 181099 , 280 . 41995 h 63 . 433071 v 31 . 27557 H 82 . 181099 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path179 " <nl> + d = " m 98 . 681099 , 307 . 33995 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70312 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64063 - 0 . 96875 , - 0 . 64062 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14062 - 0 . 53125 , - 2 . 625 0 , - 1 . 45312 0 . 48437 , - 2 . 625 0 . 48438 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17188 , - 0 . 625 0 . 875 , 0 1 . 54687 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10938 , 0 . 95313 v - 4 . 79688 h 1 . 640621 v 13 . 35938 z m - 5 . 17187 , - 4 . 82813 q 0 , 1 . 85938 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92188 1 . 84375 , 0 . 92188 1 . 07812 , 0 1 . 82812 , - 0 . 875 0 . 75 , - 0 . 89063 0 . 75 , - 2 . 6875 0 , - 1 . 98438 - 0 . 76562 , - 2 . 90625 - 0 . 76563 , - 0 . 9375 - 1 . 89063 , - 0 . 9375 - 1 . 07812 , 0 - 1 . 8125 , 0 . 89062 - 0 . 73437 , 0 . 89063 - 0 . 73437 , 2 . 8125 z m 8 . 828841 , - 1 . 76562 q 0 , - 2 . 35938 0 . 48437 , - 3 . 79688 0 . 48438 , - 1 . 45312 1 . 4375 , - 2 . 23437 0 . 96875 , - 0 . 78125 2 . 42188 , - 0 . 78125 1 . 07812 , 0 1 . 89062 , 0 . 4375 0 . 8125 , 0 . 42187 1 . 32813 , 1 . 25 0 . 53125 , 0 . 8125 0 . 82812 , 1 . 98437 0 . 3125 , 1 . 15625 0 . 3125 , 3 . 14063 0 , 2 . 35937 - 0 . 48437 , 3 . 8125 - 0 . 48438 , 1 . 4375 - 1 . 45313 , 2 . 23437 - 0 . 95312 , 0 . 78125 - 2 . 42187 , 0 . 78125 - 1 . 92188 , 0 - 3 . 03125 , - 1 . 39062 - 1 . 3125 , - 1 . 67188 - 1 . 3125 , - 5 . 4375 z m 1 . 67187 , 0 q 0 , 3 . 29687 0 . 76563 , 4 . 39062 0 . 78125 , 1 . 07813 1 . 90625 , 1 . 07813 1 . 14062 , 0 1 . 90625 , - 1 . 09375 0 . 76562 , - 1 . 09375 0 . 76562 , - 4 . 375 0 , - 3 . 29688 - 0 . 76562 , - 4 . 375 - 0 . 76563 , - 1 . 07813 - 1 . 92188 , - 1 . 07813 - 1 . 125 , 0 - 1 . 79687 , 0 . 95313 - 0 . 85938 , 1 . 21875 - 0 . 85938 , 4 . 5 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path181 " <nl> + d = " m 115 . 32809 , 237 . 12598 h 71 . 55905 v 31 . 2756 h - 71 . 55905 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path183 " <nl> + d = " m 131 . 82809 , 264 . 04599 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35937 1 . 10937 , 0 . 95312 v - 4 . 79687 h 1 . 64063 v 13 . 35937 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 15 . 00072 , 4 . 82812 h - 1 . 64062 v - 10 . 45312 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14062 - 0 . 95313 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64062 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92187 1 . 45312 , - 1 . 78125 h 1 . 0625 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path185 " <nl> + d = " m 171 . 88189 , 134 . 56955 h 440 v 26 . 70866 h - 440 z " / > <nl> + < path <nl> + style = " fill : # 434343 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path187 " <nl> + d = " m 182 . 61627 , 161 . 48955 v - 13 . 35938 h 1 . 76562 v 13 . 35938 z m 4 . 6833 , 0 v - 9 . 67188 h 1 . 46875 v 1 . 375 q 1 . 0625 , - 1 . 59375 3 . 07813 , - 1 . 59375 0 . 875 , 0 1 . 60937 , 0 . 3125 0 . 73438 , 0 . 3125 1 . 09375 , 0 . 82813 0 . 375 , 0 . 5 0 . 51563 , 1 . 20312 0 . 0937 , 0 . 45313 0 . 0937 , 1 . 59375 v 5 . 95313 h - 1 . 64063 v - 5 . 89063 q 0 , - 1 - 0 . 20312 , - 1 . 48437 - 0 . 1875 , - 0 . 5 - 0 . 67188 , - 0 . 79688 - 0 . 48437 , - 0 . 29687 - 1 . 14062 , - 0 . 29687 - 1 . 04688 , 0 - 1 . 8125 , 0 . 67187 - 0 . 75 , 0 . 65625 - 0 . 75 , 2 . 51563 v 5 . 28125 z m 16 . 64135 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64063 - 0 . 96875 , - 0 . 64062 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14062 - 0 . 53125 , - 2 . 625 0 , - 1 . 45312 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35938 1 . 10937 , 0 . 95313 v - 4 . 79688 h 1 . 64063 v 13 . 35938 z m - 5 . 17188 , - 4 . 82813 q 0 , 1 . 85938 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92188 1 . 84375 , 0 . 92188 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89063 0 . 75 , - 2 . 6875 0 , - 1 . 98438 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89062 - 0 . 73438 , 0 . 89063 - 0 . 73438 , 2 . 8125 z m 15 . 90697 , 1 . 71875 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48438 1 . 01563 , - 1 . 51563 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 8 . 04759 , 5 . 76563 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64063 h 2 . 04687 l 1 . 48438 , 2 . 26563 q 0 . 42187 , 0 . 64062 0 . 67187 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 15 . 21456 , - 4 . 29688 1 . 65625 , - 0 . 14062 q 0 . 125 , 1 0 . 54687 , 1 . 64062 0 . 4375 , 0 . 64063 1 . 34375 , 1 . 04688 0 . 92188 , 0 . 39062 2 . 0625 , 0 . 39062 1 , 0 1 . 78125 , - 0 . 29687 0 . 78125 , - 0 . 29688 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 79688 - 0 . 54687 , - 0 . 20312 - 2 . 39062 , - 0 . 64062 - 1 . 82813 , - 0 . 45313 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23438 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67187 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 89063 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 45313 2 . 45312 , - 0 . 45313 1 . 48438 , 0 2 . 60938 , 0 . 48438 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 92187 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 26563 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 42187 0 , 0 . 71875 0 . 53125 , 1 . 17188 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48437 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 35937 0 . 5625 , 0 . 82813 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 01563 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 51562 - 2 . 57812 , 0 . 51562 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 83418 , 8 v - 13 . 375 h 1 . 48438 v 1 . 25 q 0 . 53125 , - 0 . 73437 1 . 1875 , - 1 . 09375 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 64063 0 . 95313 , 0 . 625 1 . 4375 , 1 . 79687 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 54688 0 , 1 . 48437 - 0 . 53125 , 2 . 67187 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 82813 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70312 z m 1 . 48438 , - 8 . 48437 q 0 , 1 . 85937 0 . 75 , 2 . 76562 0 . 76562 , 0 . 89063 1 . 82812 , 0 . 89063 1 . 09375 , 0 1 . 875 , - 0 . 92188 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 76562 - 0 . 75 , - 0 . 92188 - 1 . 8125 , - 0 . 92188 - 1 . 04688 , 0 - 1 . 85938 , 0 . 98438 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 15 . 20385 , 3 . 59375 q - 0 . 92187 , 0 . 76562 - 1 . 76562 , 1 . 09375 - 0 . 82813 , 0 . 3125 - 1 . 79688 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45312 , - 0 . 78125 - 0 . 85938 , - 0 . 78125 - 0 . 85938 , - 1 . 98438 0 , - 0 . 71875 0 . 32813 , - 1 . 29687 0 . 32812 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35938 1 . 1875 , - 0 . 54688 0 . 46875 , - 0 . 125 1 . 45312 , - 0 . 25 1 . 98438 , - 0 . 23437 2 . 92188 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42187 0 , - 1 - 0 . 46875 , - 1 . 42188 - 0 . 625 , - 0 . 54687 - 1 . 875 , - 0 . 54687 - 1 . 15625 , 0 - 1 . 70312 , 0 . 40625 - 0 . 54688 , 0 . 40625 - 0 . 8125 , 1 . 42187 l - 1 . 60938 , - 0 . 21875 q 0 . 21875 , - 1 . 01562 0 . 71875 , - 1 . 64062 0 . 5 , - 0 . 64063 1 . 45313 , - 0 . 98438 0 . 95312 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01562 , 0 . 29688 0 . 78125 , 0 . 28125 1 . 14063 , 0 . 73437 0 . 375 , 0 . 4375 0 . 51562 , 1 . 10938 0 . 0781 , 0 . 42187 0 . 0781 , 1 . 51562 v 2 . 1875 q 0 , 2 . 28125 0 . 10937 , 2 . 89063 0 . 10938 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70312 q - 0 . 26563 , - 0 . 51563 - 0 . 32813 , - 1 . 1875 z m - 0 . 14062 , - 3 . 67188 q - 0 . 89063 , 0 . 375 - 2 . 67188 , 0 . 625 - 1 . 01562 , 0 . 14063 - 1 . 4375 , 0 . 32813 - 0 . 42187 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45313 , 0 . 4375 0 . 9375 , 0 1 . 67187 , - 0 . 40625 0 . 75 , - 0 . 42188 1 . 09375 , - 1 . 14063 0 . 26563 , - 0 . 5625 0 . 26563 , - 1 . 64062 z m 10 . 51636 , 1 . 3125 1 . 60937 , 0 . 21875 q - 0 . 26562 , 1 . 65625 - 1 . 35937 , 2 . 60938 - 1 . 07813 , 0 . 9375 - 2 . 67188 , 0 . 9375 - 1 . 98437 , 0 - 3 . 1875 , - 1 . 29688 - 1 . 20312 , - 1 . 29687 - 1 . 20312 , - 3 . 71875 0 , - 1 . 57812 0 . 51562 , - 2 . 75 0 . 51563 , - 1 . 17187 1 . 57813 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57812 , 0 2 . 57812 , 0 . 79688 1 , 0 . 79687 1 . 28125 , 2 . 26562 l - 1 . 59375 , 0 . 23438 q - 0 . 23437 , - 0 . 96875 - 0 . 8125 , - 1 . 45313 - 0 . 57812 , - 0 . 5 - 1 . 39062 , - 0 . 5 - 1 . 23438 , 0 - 2 . 01563 , 0 . 89063 - 0 . 78125 , 0 . 89062 - 0 . 78125 , 2 . 8125 0 , 1 . 95312 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95313 , 0 . 875 0 . 96875 , 0 1 . 60937 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82813 , - 1 . 82813 z m 9 . 64062 , 0 . 4375 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48438 1 . 01562 , - 1 . 51563 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 14 . 10589 , - 0 . 0781 v - 1 . 53127 l 8 . 84375 , - 3 . 73438 v 1 . 64063 l - 7 . 01562 , 2 . 875 7 . 01562 , 2 . 90625 v 1 . 625 z m 10 . 66059 , 2 . 3125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95312 , - 0 . 79688 0 . 79688 , - 0 . 79687 0 . 79688 , - 1 . 98437 0 , - 1 . 125 - 0 . 73438 , - 1 . 85938 - 0 . 73437 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26563 , 0 . 0156 1 . 04687 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64063 , - 0 . 29688 q 0 . 29688 , - 1 . 64062 1 . 35938 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32812 , - 2 . 71875 z m 9 . 73507 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64063 h 2 . 04687 l 1 . 48438 , 2 . 26563 q 0 . 42187 , 0 . 64062 0 . 67187 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 9 . 96875 , - 3 . 53125 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95313 , - 0 . 79688 0 . 79687 , - 0 . 79687 0 . 79687 , - 1 . 98437 0 , - 1 . 125 - 0 . 73437 , - 1 . 85938 - 0 . 73438 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26562 , 0 . 0156 1 . 04688 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64062 , - 0 . 29688 q 0 . 29687 , - 1 . 64062 1 . 35937 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32813 , - 2 . 71875 z m 9 . 73508 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 64063 h 2 . 04688 l 1 . 48437 , 2 . 26563 q 0 . 42188 , 0 . 64062 0 . 67188 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45313 v - 1 . 26563 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 45312 0 . 23438 , - 0 . 64063 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67187 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95312 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89062 v 1 . 26563 h - 1 . 89062 v 8 . 40618 z m 4 . 33957 , - 3 . 53125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95312 , - 0 . 79688 0 . 79688 , - 0 . 79687 0 . 79688 , - 1 . 98437 0 , - 1 . 125 - 0 . 73438 , - 1 . 85938 - 0 . 73437 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26563 , 0 . 0156 1 . 04687 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64063 , - 0 . 29688 q 0 . 29688 , - 1 . 64062 1 . 35938 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32812 , - 2 . 71875 z m 18 . 98508 , 1 . 95312 v 1 . 57811 h - 8 . 82813 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14063 0 . 34375 , - 0 . 90625 1 . 07813 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01562 2 . 17187 , - 1 . 78125 2 . 9375 , - 2 . 82813 0 . 76562 , - 1 . 04687 0 . 76562 , - 1 . 96875 0 , - 0 . 98437 - 0 . 70312 , - 1 . 64062 - 0 . 6875 , - 0 . 67188 - 1 . 8125 , - 0 . 67188 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70313 , 0 . 70313 - 0 . 70313 , 1 . 95313 l - 1 . 6875 , - 0 . 17188 q 0 . 17188 , - 1 . 89062 1 . 29688 , - 2 . 875 1 . 14062 , - 0 . 98437 3 . 03125 , - 0 . 98437 1 . 92187 , 0 3 . 04687 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64062 0 , 0 . 79688 - 0 . 32812 , 1 . 57813 - 0 . 32813 , 0 . 78125 - 1 . 09375 , 1 . 64062 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23438 - 1 . 89063 , 1 . 6875 - 0 . 42187 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 10 . 84448 , - 4 . 26562 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01562 , - 2 . 90625 - 7 . 01562 , - 2 . 875 v - 1 . 64063 l 8 . 84375 , 3 . 73438 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path189 " <nl> + d = " m 181 . 96001 , 173 . 34892 q 0 , - 1 . 4375 0 . 71875 , - 2 . 4375 0 . 71875 , - 1 2 . 09375 , - 1 1 . 25 , 0 2 . 07813 , 0 . 90625 0 . 82812 , 0 . 89062 0 . 82812 , 2 . 625 0 , 1 . 6875 - 0 . 84375 , 2 . 60937 - 0 . 82812 , 0 . 92188 - 2 . 04687 , 0 . 92188 - 1 . 20313 , 0 - 2 . 01563 , - 0 . 90625 - 0 . 8125 , - 0 . 90625 - 0 . 8125 , - 2 . 71875 z m 2 . 85938 , - 2 . 3125 q - 0 . 60938 , 0 - 1 . 01563 , 0 . 53125 - 0 . 40625 , 0 . 53125 - 0 . 40625 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51562 1 . 01563 , 0 . 51562 0 . 625 , 0 1 . 01562 , - 0 . 51562 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29688 - 0 . 40625 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01562 , - 0 . 53125 z m 0 , 12 . 9375 7 . 3125 , - 14 . 0625 h 1 . 32812 l - 7 . 28125 , 14 . 0625 z m 5 . 78125 , - 3 . 625 q 0 , - 1 . 4375 0 . 71875 , - 2 . 42188 0 . 71875 , - 1 2 . 09375 , - 1 1 . 26562 , 0 2 . 07812 , 0 . 90625 0 . 82813 , 0 . 89063 0 . 82813 , 2 . 625 0 , 1 . 6875 - 0 . 82813 , 2 . 60938 - 0 . 82812 , 0 . 90625 - 2 . 0625 , 0 . 90625 - 1 . 21875 , 0 - 2 . 03125 , - 0 . 90625 - 0 . 79687 , - 0 . 90625 - 0 . 79687 , - 2 . 71875 z m 2 . 85937 , - 2 . 29688 q - 0 . 625 , 0 - 1 . 03125 , 0 . 53125 - 0 . 39062 , 0 . 53125 - 0 . 39062 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51563 1 . 01562 , 0 . 51563 0 . 625 , 0 1 . 03125 , - 0 . 51563 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29687 - 0 . 42187 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01563 , - 0 . 53125 z m 3 . 97902 , 5 . 4375 5 . 125 , - 13 . 35937 h 1 . 90625 l 5 . 46875 , 13 . 35937 h - 2 . 01563 l - 1 . 54687 , - 4 . 04687 h - 5 . 59375 l - 1 . 46875 , 4 . 04687 z m 3 . 85937 , - 5 . 48437 h 4 . 53125 l - 1 . 40625 , - 3 . 70313 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76562 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54687 z m 23 . 65813 , - 2 . 375 h - 8 . 82812 v - 1 . 51563 h 8 . 82812 z m 0 , 4 . 0625 h - 8 . 82812 v - 1 . 53125 h 8 . 82812 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path191 " <nl> + d = " m 234 . 42542 , 176 . 7708 - 2 . 32813 , - 0 . 42188 q 0 . 40625 , - 1 . 40625 1 . 35938 , - 2 . 07812 0 . 95312 , - 0 . 67188 2 . 84375 , - 0 . 67188 1 . 70312 , 0 2 . 54687 , 0 . 40625 0 . 84375 , 0 . 40625 1 . 17188 , 1 . 03125 0 . 34375 , 0 . 625 0 . 34375 , 2 . 28125 l - 0 . 0156 , 3 q 0 , 1 . 26563 0 . 10938 , 1 . 875 0 . 125 , 0 . 60938 0 . 46875 , 1 . 29688 h - 2 . 53125 q - 0 . 10938 , - 0 . 25 - 0 . 25 , - 0 . 75 - 0 . 0625 , - 0 . 23438 - 0 . 0937 , - 0 . 3125 - 0 . 65625 , 0 . 64062 - 1 . 40625 , 0 . 96875 - 0 . 73438 , 0 . 3125 - 1 . 59375 , 0 . 3125 - 1 . 48438 , 0 - 2 . 34375 , - 0 . 8125 - 0 . 85938 , - 0 . 8125 - 0 . 85938 , - 2 . 04688 0 , - 0 . 82812 0 . 39063 , - 1 . 46875 0 . 39062 , - 0 . 64062 1 . 09375 , - 0 . 96875 0 . 70312 , - 0 . 34375 2 . 03125 , - 0 . 60937 1 . 79687 , - 0 . 32813 2 . 48437 , - 0 . 625 v - 0 . 25 q 0 , - 0 . 75 - 0 . 35937 , - 1 . 0625 - 0 . 35938 , - 0 . 3125 - 1 . 375 , - 0 . 3125 - 0 . 6875 , 0 - 1 . 07813 , 0 . 28125 - 0 . 375 , 0 . 26562 - 0 . 60937 , 0 . 9375 z m 3 . 42187 , 2 . 07812 q - 0 . 48437 , 0 . 15625 - 1 . 5625 , 0 . 39063 - 1 . 0625 , 0 . 21875 - 1 . 39062 , 0 . 4375 - 0 . 5 , 0 . 35937 - 0 . 5 , 0 . 90625 0 , 0 . 53125 0 . 40625 , 0 . 9375 0 . 40625 , 0 . 39062 1 . 01562 , 0 . 39062 0 . 70313 , 0 1 . 32813 , - 0 . 46875 0 . 46875 , - 0 . 34375 0 . 60937 , - 0 . 84375 0 . 0937 , - 0 . 32812 0 . 0937 , - 1 . 25 z m 5 . 0476 , 4 . 64063 v - 13 . 35938 h 2 . 5625 v 13 . 35938 z m 5 . 18329 , 0 v - 13 . 35938 h 2 . 5625 v 13 . 35938 z m 4 . 58956 , - 4 . 96875 q 0 , - 1 . 28125 0 . 625 , - 2 . 46875 0 . 625 , - 1 . 20313 1 . 78125 , - 1 . 82813 1 . 15625 , - 0 . 625 2 . 57813 , - 0 . 625 2 . 1875 , 0 3 . 59375 , 1 . 42188 1 . 40625 , 1 . 42187 1 . 40625 , 3 . 60937 0 , 2 . 1875 - 1 . 42188 , 3 . 64063 - 1 . 42187 , 1 . 4375 - 3 . 5625 , 1 . 4375 - 1 . 32812 , 0 - 2 . 54687 , - 0 . 59375 - 1 . 20313 , - 0 . 60938 - 1 . 82813 , - 1 . 76563 - 0 . 625 , - 1 . 17187 - 0 . 625 , - 2 . 82812 z m 2 . 625 , 0 . 125 q 0 , 1 . 45312 0 . 67188 , 2 . 21875 0 . 6875 , 0 . 75 1 . 6875 , 0 . 75 1 , 0 1 . 67187 , - 0 . 75 0 . 6875 , - 0 . 76563 0 . 6875 , - 2 . 23438 0 , - 1 . 42187 - 0 . 6875 , - 2 . 1875 - 0 . 67187 , - 0 . 76562 - 1 . 67187 , - 0 . 76562 - 1 , 0 - 1 . 6875 , 0 . 76562 - 0 . 67188 , 0 . 76563 - 0 . 67188 , 2 . 20313 z m 17 . 80222 , - 1 . 96875 - 2 . 53125 , 0 . 45312 q - 0 . 125 , - 0 . 75 - 0 . 57812 , - 1 . 125 - 0 . 45313 , - 0 . 39062 - 1 . 17188 , - 0 . 39062 - 0 . 95312 , 0 - 1 . 53125 , 0 . 65625 - 0 . 5625 , 0 . 65625 - 0 . 5625 , 2 . 20312 0 , 1 . 73438 0 . 57813 , 2 . 4375 0 . 57812 , 0 . 70313 1 . 54687 , 0 . 70313 0 . 73438 , 0 1 . 20313 , - 0 . 40625 0 . 46875 , - 0 . 42188 0 . 65625 , - 1 . 42188 l 2 . 51562 , 0 . 42188 q - 0 . 39062 , 1 . 73437 - 1 . 51562 , 2 . 625 - 1 . 10938 , 0 . 875 - 2 . 96875 , 0 . 875 - 2 . 125 , 0 - 3 . 39063 , - 1 . 32813 - 1 . 25 , - 1 . 34375 - 1 . 25 , - 3 . 71875 0 , - 2 . 39062 1 . 26563 , - 3 . 71875 1 . 26562 , - 1 . 34375 3 . 42187 , - 1 . 34375 1 . 76563 , 0 2 . 79688 , 0 . 76563 1 . 04687 , 0 . 75 1 . 51562 , 2 . 3125 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path193 " <nl> + d = " m 280 . 10711 , 183 . 48955 v - 9 . 67188 h 1 . 46875 v 1 . 35938 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14063 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70313 - 0 . 42187 , - 0 . 26562 - 0 . 98437 , - 0 . 26562 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67187 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 22 . 16583 , - 3 . 10938 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48438 1 . 01562 , - 1 . 51563 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 9 . 14132 , 5 . 76563 v - 9 . 67188 h 1 . 46875 v 1 . 35938 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14063 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70313 - 0 . 42188 , - 0 . 26562 - 0 . 98438 , - 0 . 26562 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67187 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 15 . 52518 , 0 v - 9 . 67188 h 1 . 46875 v 1 . 46875 q 0 . 5625 , - 1 . 03125 1 . 03125 , - 1 . 35937 0 . 48438 , - 0 . 32813 1 . 0625 , - 0 . 32813 0 . 82813 , 0 1 . 6875 , 0 . 53125 l - 0 . 5625 , 1 . 51563 q - 0 . 60937 , - 0 . 35938 - 1 . 20312 , - 0 . 35938 - 0 . 54688 , 0 - 0 . 96875 , 0 . 32813 - 0 . 42188 , 0 . 32812 - 0 . 60938 , 0 . 89062 - 0 . 28125 , 0 . 875 - 0 . 28125 , 1 . 92188 v 5 . 0625 z m 12 . 8533 , - 3 . 10938 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48438 1 . 01562 , - 1 . 51563 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 9 . 53195 , 5 . 76563 v - 8 . 40625 h - 1 . 45312 v - 1 . 26563 h 1 . 45312 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17188 , - 1 . 45312 0 . 23437 , - 0 . 64063 0 . 82812 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67188 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95313 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89063 v 1 . 26563 h - 1 . 89063 v 8 . 4062 z m 4 . 57394 , - 5 . 84375 v - 1 . 53125 l 8 . 84375 , - 3 . 73438 v 1 . 64063 l - 7 . 01562 , 2 . 875 7 . 01562 , 2 . 90625 v 1 . 625 z m 10 . 66059 , 2 . 3125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95312 , - 0 . 79688 0 . 79688 , - 0 . 79687 0 . 79688 , - 1 . 98437 0 , - 1 . 125 - 0 . 73438 , - 1 . 85938 - 0 . 73437 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26563 , 0 . 0156 1 . 04687 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64063 , - 0 . 29688 q 0 . 29688 , - 1 . 64062 1 . 35938 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32812 , - 2 . 71875 z m 9 . 73508 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 64063 h 2 . 04688 l 1 . 48437 , 2 . 26563 q 0 . 42188 , 0 . 64062 0 . 67188 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 9 . 96875 , - 3 . 53125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95312 , - 0 . 79688 0 . 79688 , - 0 . 79687 0 . 79688 , - 1 . 98437 0 , - 1 . 125 - 0 . 73438 , - 1 . 85938 - 0 . 73437 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26563 , 0 . 0156 1 . 04687 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64063 , - 0 . 29688 q 0 . 29688 , - 1 . 64062 1 . 35938 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32812 , - 2 . 71875 z m 9 . 7351 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64063 h 2 . 04687 l 1 . 48438 , 2 . 26563 q 0 . 42187 , 0 . 64062 0 . 67187 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45312 v - 1 . 26563 h 1 . 45312 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17188 , - 1 . 45312 0 . 23437 , - 0 . 64063 0 . 82812 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67188 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95313 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89063 v 1 . 26563 h - 1 . 89063 v 8 . 4062 z m 4 . 33954 , - 3 . 53125 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95313 , - 0 . 79688 0 . 79687 , - 0 . 79687 0 . 79687 , - 1 . 98437 0 , - 1 . 125 - 0 . 73437 , - 1 . 85938 - 0 . 73438 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26562 , 0 . 0156 1 . 04688 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64062 , - 0 . 29688 q 0 . 29687 , - 1 . 64062 1 . 35937 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32813 , - 2 . 71875 z m 18 . 98511 , 1 . 95312 v 1 . 57813 h - 8 . 82813 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14063 0 . 34375 , - 0 . 90625 1 . 07813 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01562 2 . 17187 , - 1 . 78125 2 . 9375 , - 2 . 82813 0 . 76562 , - 1 . 04687 0 . 76562 , - 1 . 96875 0 , - 0 . 98437 - 0 . 70312 , - 1 . 64062 - 0 . 6875 , - 0 . 67188 - 1 . 8125 , - 0 . 67188 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70313 , 0 . 70313 - 0 . 70313 , 1 . 95313 l - 1 . 6875 , - 0 . 17188 q 0 . 17188 , - 1 . 89062 1 . 29688 , - 2 . 875 1 . 14062 , - 0 . 98437 3 . 03125 , - 0 . 98437 1 . 92187 , 0 3 . 04687 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64062 0 , 0 . 79688 - 0 . 32812 , 1 . 57813 - 0 . 32813 , 0 . 78125 - 1 . 09375 , 1 . 64062 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23438 - 1 . 89063 , 1 . 6875 - 0 . 42187 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 2 . 64136 , 1 . 57813 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35938 , 0 . 64062 - 1 . 15625 , 0 . 98437 l - 0 . 45313 , - 0 . 70312 q 0 . 51563 , - 0 . 21875 0 . 76563 , - 0 . 67188 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26562 z m 9 . 64782 , 0 . 23437 0 . 79688 , - 3 . 89062 h - 1 . 54688 v - 1 . 35938 h 1 . 8125 l 0 . 67188 , - 3 . 29687 h - 2 . 48438 v - 1 . 35938 h 2 . 76563 l 0 . 79687 , - 3 . 90625 h 1 . 35938 l - 0 . 79688 , 3 . 90625 h 2 . 875 l 0 . 79688 , - 3 . 90625 h 1 . 375 l - 0 . 79688 , 3 . 90625 h 1 . 57813 v 1 . 35938 h - 1 . 84375 l - 0 . 6875 , 3 . 29687 h 2 . 53125 v 1 . 35938 h - 2 . 8125 l - 0 . 78125 , 3 . 89062 h - 1 . 375 l 0 . 78125 , - 3 . 89062 h - 2 . 85938 l - 0 . 78125 , 3 . 89062 z m 2 . 4375 , - 5 . 25 h 2 . 85938 l 0 . 6875 , - 3 . 29687 h - 2 . 875 z m 8 . 18823 , 5 . 01563 v - 13 . 35938 h 1 . 64063 v 13 . 35938 z m 4 . 19172 , 0 v - 9 . 67188 h 1 . 46875 v 1 . 35938 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14063 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70313 - 0 . 42187 , - 0 . 26562 - 0 . 98437 , - 0 . 26562 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67187 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 21 . 85327 , - 1 . 1875 q - 0 . 92188 , 0 . 76562 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98438 0 , - 0 . 71875 0 . 32812 , - 1 . 29687 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35938 1 . 1875 , - 0 . 54688 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23437 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42187 0 , - 1 - 0 . 46875 , - 1 . 42188 - 0 . 625 , - 0 . 54687 - 1 . 875 , - 0 . 54687 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42187 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01562 0 . 71875 , - 1 . 64062 0 . 5 , - 0 . 64063 1 . 45312 , - 0 . 98438 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29688 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73437 0 . 375 , 0 . 4375 0 . 51563 , 1 . 10938 0 . 0781 , 0 . 42187 0 . 0781 , 1 . 51562 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89063 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51563 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67188 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14063 - 1 . 4375 , 0 . 32813 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42188 1 . 09375 , - 1 . 14063 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64062 z m 4 . 20386 , 8 . 5625 v - 13 . 375 h 1 . 48437 v 1 . 25 q 0 . 53125 , - 0 . 73437 1 . 1875 , - 1 . 09375 0 . 67188 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23438 , 0 2 . 17188 , 0 . 64063 0 . 95312 , 0 . 625 1 . 4375 , 1 . 79687 0 . 48437 , 1 . 15625 0 . 48437 , 2 . 54688 0 , 1 . 48437 - 0 . 53125 , 2 . 67187 - 0 . 53125 , 1 . 1875 - 1 . 54687 , 1 . 82813 - 1 . 01563 , 0 . 625 - 2 . 14063 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70312 z m 1 . 48437 , - 8 . 48437 q 0 , 1 . 85937 0 . 75 , 2 . 76562 0 . 76563 , 0 . 89063 1 . 82813 , 0 . 89063 1 . 09375 , 0 1 . 875 , - 0 . 92188 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76563 , - 2 . 76562 - 0 . 75 , - 0 . 92188 - 1 . 8125 , - 0 . 92188 - 1 . 04687 , 0 - 1 . 85937 , 0 . 98438 - 0 . 79688 , 0 . 96875 - 0 . 79688 , 2 . 84375 z m 7 . 62574 , 4 . 78125 5 . 125 , - 13 . 35938 h 1 . 90625 l 5 . 46875 , 13 . 35938 h - 2 . 01563 l - 1 . 54687 , - 4 . 04688 h - 5 . 59375 l - 1 . 46875 , 4 . 04688 z m 3 . 85937 , - 5 . 48438 h 4 . 53125 l - 1 . 40625 , - 3 . 70312 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76563 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54688 z m 10 . 27167 , 5 . 48438 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35938 , 0 . 64062 - 1 . 15625 , 0 . 98437 l - 0 . 45313 , - 0 . 70312 q 0 . 51563 , - 0 . 21875 0 . 76563 , - 0 . 67188 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26562 z m 12 . 63226 , 0 - 3 . 6875 , - 9 . 67188 h 1 . 73438 l 2 . 07812 , 5 . 79688 q 0 . 32813 , 0 . 9375 0 . 625 , 1 . 9375 0 . 20313 , - 0 . 76563 0 . 60938 , - 1 . 82813 l 2 . 14062 , - 5 . 90625 h 1 . 6875 l - 3 . 65625 , 9 . 67188 z m 6 . 64063 , 0 v - 9 . 67188 h 1 . 46875 v 1 . 35938 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14063 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70313 - 0 . 42187 , - 0 . 26562 - 0 . 98437 , - 0 . 26562 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67187 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 22 . 16577 , - 3 . 10938 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48438 1 . 01563 , - 1 . 51563 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 9 . 14136 , 5 . 76563 v - 9 . 67188 h 1 . 46875 v 1 . 35938 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14063 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70313 - 0 . 42188 , - 0 . 26562 - 0 . 98438 , - 0 . 26562 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67187 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 24 . 16583 , - 5 . 84375 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01563 , - 2 . 90625 - 7 . 01563 , - 2 . 875 v - 1 . 64063 l 8 . 84375 , 3 . 73438 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path195 " <nl> + d = " m 167 . 14961 , 276 . 98688 h 614 . 7402 v 83 . 74802 h - 614 . 7402 z " / > <nl> + < path <nl> + style = " fill : # 434343 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path197 " <nl> + d = " m 177 . 88398 , 303 . 90685 v - 13 . 35937 h 1 . 76562 v 13 . 35937 z m 4 . 6833 , 0 v - 9 . 67187 h 1 . 46875 v 1 . 375 q 1 . 0625 , - 1 . 59375 3 . 07813 , - 1 . 59375 0 . 875 , 0 1 . 60937 , 0 . 3125 0 . 73438 , 0 . 3125 1 . 09375 , 0 . 82812 0 . 375 , 0 . 5 0 . 51563 , 1 . 20313 0 . 0937 , 0 . 45312 0 . 0937 , 1 . 59375 v 5 . 95312 h - 1 . 64063 v - 5 . 89062 q 0 , - 1 - 0 . 20312 , - 1 . 48438 - 0 . 1875 , - 0 . 5 - 0 . 67188 , - 0 . 79687 - 0 . 48437 , - 0 . 29688 - 1 . 14062 , - 0 . 29688 - 1 . 04688 , 0 - 1 . 8125 , 0 . 67188 - 0 . 75 , 0 . 65625 - 0 . 75 , 2 . 51562 v 5 . 28125 z m 16 . 64135 , 0 v - 1 . 21875 q - 0 . 90625 , 1 . 4375 - 2 . 70313 , 1 . 4375 - 1 . 15625 , 0 - 2 . 125 , - 0 . 64062 - 0 . 96875 , - 0 . 64063 - 1 . 5 , - 1 . 78125 - 0 . 53125 , - 1 . 14063 - 0 . 53125 , - 2 . 625 0 , - 1 . 45313 0 . 48438 , - 2 . 625 0 . 48437 , - 1 . 1875 1 . 4375 , - 1 . 8125 0 . 96875 , - 0 . 625 2 . 17187 , - 0 . 625 0 . 875 , 0 1 . 54688 , 0 . 375 0 . 6875 , 0 . 35937 1 . 10937 , 0 . 95312 v - 4 . 79687 h 1 . 64063 v 13 . 35937 z m - 5 . 17188 , - 4 . 82812 q 0 , 1 . 85937 0 . 78125 , 2 . 78125 0 . 78125 , 0 . 92187 1 . 84375 , 0 . 92187 1 . 07813 , 0 1 . 82813 , - 0 . 875 0 . 75 , - 0 . 89062 0 . 75 , - 2 . 6875 0 , - 1 . 98437 - 0 . 76563 , - 2 . 90625 - 0 . 76562 , - 0 . 9375 - 1 . 89062 , - 0 . 9375 - 1 . 07813 , 0 - 1 . 8125 , 0 . 89063 - 0 . 73438 , 0 . 89062 - 0 . 73438 , 2 . 8125 z m 15 . 90697 , 1 . 71875 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79687 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32812 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70313 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48437 1 . 01563 , - 1 . 51562 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95312 - 2 . 03125 , - 0 . 95312 - 1 . 125 , 0 - 1 . 90625 , 0 . 76562 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01563 z m 8 . 0476 , 5 . 76562 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 64062 h 2 . 04688 l 1 . 48437 , 2 . 26562 q 0 . 42188 , 0 . 64063 0 . 67188 , 1 . 07813 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 54687 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 15 . 21455 , - 4 . 29687 1 . 65625 , - 0 . 14063 q 0 . 125 , 1 0 . 54687 , 1 . 64063 0 . 4375 , 0 . 64062 1 . 34375 , 1 . 04687 0 . 92188 , 0 . 39063 2 . 0625 , 0 . 39063 1 , 0 1 . 78125 , - 0 . 29688 0 . 78125 , - 0 . 29687 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35937 , - 0 . 46875 - 1 . 1875 , - 0 . 79687 - 0 . 54687 , - 0 . 20313 - 2 . 39062 , - 0 . 64063 - 1 . 82813 , - 0 . 45312 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 23437 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 67188 0 , - 1 0 . 57812 , - 1 . 875 0 . 57813 , - 0 . 89062 1 . 67188 , - 1 . 34375 1 . 10937 , - 0 . 45312 2 . 45312 , - 0 . 45312 1 . 48438 , 0 2 . 60938 , 0 . 48437 1 . 14062 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60937 , 0 . 92188 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14063 , - 1 . 26562 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60938 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73438 , 0 . 59375 - 0 . 73438 , 1 . 42188 0 , 0 . 71875 0 . 53125 , 1 . 17187 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 48438 2 . 95313 , 0 . 84375 1 . 17187 , 0 . 53125 1 . 71875 , 1 . 35938 0 . 5625 , 0 . 82812 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60938 , 2 . 01562 - 0 . 60937 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14062 , 0 . 51563 - 2 . 57812 , 0 . 51563 - 1 . 8125 , 0 - 3 . 04688 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92187 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 8342 , 8 v - 13 . 375 h 1 . 48437 v 1 . 25 q 0 . 53125 , - 0 . 73438 1 . 1875 , - 1 . 09375 0 . 67188 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23438 , 0 2 . 17188 , 0 . 64062 0 . 95312 , 0 . 625 1 . 4375 , 1 . 79688 0 . 48437 , 1 . 15625 0 . 48437 , 2 . 54687 0 , 1 . 48438 - 0 . 53125 , 2 . 67188 - 0 . 53125 , 1 . 1875 - 1 . 54687 , 1 . 82812 - 1 . 01563 , 0 . 625 - 2 . 14063 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70313 z m 1 . 48437 , - 8 . 48438 q 0 , 1 . 85938 0 . 75 , 2 . 76563 0 . 76563 , 0 . 89062 1 . 82813 , 0 . 89062 1 . 09375 , 0 1 . 875 , - 0 . 92187 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76563 , - 2 . 76563 - 0 . 75 , - 0 . 92187 - 1 . 8125 , - 0 . 92187 - 1 . 04687 , 0 - 1 . 85937 , 0 . 98437 - 0 . 79688 , 0 . 96875 - 0 . 79688 , 2 . 84375 z m 15 . 20386 , 3 . 59375 q - 0 . 92188 , 0 . 76563 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98437 0 , - 0 . 71875 0 . 32812 , - 1 . 29688 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35937 1 . 1875 , - 0 . 54687 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23438 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42188 0 , - 1 - 0 . 46875 , - 1 . 42187 - 0 . 625 , - 0 . 54688 - 1 . 875 , - 0 . 54688 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42188 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01563 0 . 71875 , - 1 . 64063 0 . 5 , - 0 . 64062 1 . 45312 , - 0 . 98437 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29687 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73438 0 . 375 , 0 . 4375 0 . 51563 , 1 . 10937 0 . 0781 , 0 . 42188 0 . 0781 , 1 . 51563 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89062 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51562 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67187 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14062 - 1 . 4375 , 0 . 32812 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42187 1 . 09375 , - 1 . 14062 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64063 z m 10 . 51633 , 1 . 3125 1 . 60938 , 0 . 21875 q - 0 . 26563 , 1 . 65625 - 1 . 35938 , 2 . 60937 - 1 . 07812 , 0 . 9375 - 2 . 67187 , 0 . 9375 - 1 . 98438 , 0 - 3 . 1875 , - 1 . 29687 - 1 . 20313 , - 1 . 29688 - 1 . 20313 , - 3 . 71875 0 , - 1 . 57813 0 . 51563 , - 2 . 75 0 . 51562 , - 1 . 17188 1 . 57812 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57813 , 0 2 . 57813 , 0 . 79687 1 , 0 . 79688 1 . 28125 , 2 . 26563 l - 1 . 59375 , 0 . 23437 q - 0 . 23438 , - 0 . 96875 - 0 . 8125 , - 1 . 45312 - 0 . 57813 , - 0 . 5 - 1 . 39063 , - 0 . 5 - 1 . 23437 , 0 - 2 . 01562 , 0 . 89062 - 0 . 78125 , 0 . 89063 - 0 . 78125 , 2 . 8125 0 , 1 . 95313 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95312 , 0 . 875 0 . 96875 , 0 1 . 60938 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82812 , - 1 . 82812 z m 9 . 64063 , 0 . 4375 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79687 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32812 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70313 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48437 1 . 01563 , - 1 . 51562 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95312 - 2 . 03125 , - 0 . 95312 - 1 . 125 , 0 - 1 . 90625 , 0 . 76562 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01563 z m 14 . 1059 , - 0 . 0781 v - 1 . 53125 l 8 . 84375 , - 3 . 73437 v 1 . 64062 l - 7 . 01563 , 2 . 875 7 . 01563 , 2 . 90625 v 1 . 625 z m 19 . 26995 , 4 . 26563 v 1 . 57812 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76563 , - 1 . 04688 0 . 76563 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70313 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70312 - 0 . 70312 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17187 , - 1 . 89063 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32813 , 1 . 57812 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 1 . 12574 , 1 . 57812 3 . 53125 , - 5 . 03125 - 3 . 26563 , - 4 . 64062 h 2 . 04688 l 1 . 48437 , 2 . 26562 q 0 . 42188 , 0 . 64063 0 . 67188 , 1 . 07813 0 . 40625 , - 0 . 59375 0 . 73437 , - 1 . 0625 l 1 . 64063 , - 2 . 28125 h 1 . 95312 l - 3 . 34375 , 4 . 54687 3 . 59375 , 5 . 125 h - 2 . 01562 l - 1 . 98438 , - 3 - 0 . 51562 , - 0 . 8125 - 2 . 54688 , 3 . 8125 z m 18 . 57812 , - 1 . 57812 v 1 . 57812 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76563 , - 1 . 04688 0 . 76563 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70313 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70312 - 0 . 70312 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17187 , - 1 . 89063 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32813 , 1 . 57812 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 1 . 1257 , 1 . 57812 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64062 h 2 . 04687 l 1 . 48438 , 2 . 26562 q 0 . 42187 , 0 . 64063 0 . 67187 , 1 . 07813 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54687 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45312 v - 1 . 26562 h 1 . 45312 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17188 , - 1 . 45313 0 . 23437 , - 0 . 64062 0 . 82812 , - 1 . 03125 0 . 59375 , - 0 . 39062 1 . 67188 , - 0 . 39062 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95313 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32812 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89063 h 1 . 89063 v 1 . 26562 h - 1 . 89063 v 8 . 40625 z m 4 . 33957 , - 3 . 53125 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 01563 0 . 6875 , 0 . 60937 1 . 65625 , 0 . 60937 1 . 15625 , 0 1 . 95313 , - 0 . 79687 0 . 79687 , - 0 . 79688 0 . 79687 , - 1 . 98438 0 , - 1 . 125 - 0 . 73437 , - 1 . 85937 - 0 . 73438 , - 0 . 73438 - 1 . 875 , - 0 . 73438 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17188 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26562 , 0 . 0156 1 . 04688 , 0 1 . 875 , - 0 . 54687 0 . 84375 , - 0 . 54688 0 . 84375 , - 1 . 67188 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 60938 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 79687 l - 1 . 64062 , - 0 . 29687 q 0 . 29687 , - 1 . 64063 1 . 35937 , - 2 . 54688 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85938 - 0 . 46875 , 1 . 57813 - 0 . 46875 , 0 . 70312 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14062 0 . 65625 , 0 . 85938 0 . 65625 , 2 . 15625 0 , 1 . 73438 - 1 . 28125 , 2 . 95313 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 04688 - 1 . 15625 , - 1 . 04687 - 1 . 32813 , - 2 . 71875 z m 18 . 98508 , 1 . 95313 v 1 . 57812 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76563 , - 1 . 04688 0 . 76563 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70313 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70312 - 0 . 70312 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17187 , - 1 . 89063 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32813 , 1 . 57812 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 10 . 84448 , - 4 . 26563 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01563 , - 2 . 90625 - 7 . 01563 , - 2 . 875 v - 1 . 64062 l 8 . 84375 , 3 . 73437 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path199 " <nl> + d = " m 177 . 22773 , 315 . 76625 q 0 , - 1 . 4375 0 . 71875 , - 2 . 4375 0 . 71875 , - 1 2 . 09375 , - 1 1 . 25 , 0 2 . 07812 , 0 . 90625 0 . 82813 , 0 . 89063 0 . 82813 , 2 . 625 0 , 1 . 6875 - 0 . 84375 , 2 . 60938 - 0 . 82813 , 0 . 92187 - 2 . 04688 , 0 . 92187 - 1 . 20312 , 0 - 2 . 01562 , - 0 . 90625 - 0 . 8125 , - 0 . 90625 - 0 . 8125 , - 2 . 71875 z m 2 . 85937 , - 2 . 3125 q - 0 . 60937 , 0 - 1 . 01562 , 0 . 53125 - 0 . 40625 , 0 . 53125 - 0 . 40625 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51563 1 . 01562 , 0 . 51563 0 . 625 , 0 1 . 01563 , - 0 . 51563 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29687 - 0 . 40625 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01563 , - 0 . 53125 z m 0 , 12 . 9375 7 . 3125 , - 14 . 0625 h 1 . 32813 l - 7 . 28125 , 14 . 0625 z m 5 . 78125 , - 3 . 625 q 0 , - 1 . 4375 0 . 71875 , - 2 . 42187 0 . 71875 , - 1 2 . 09375 , - 1 1 . 26563 , 0 2 . 07813 , 0 . 90625 0 . 82812 , 0 . 89062 0 . 82812 , 2 . 625 0 , 1 . 6875 - 0 . 82812 , 2 . 60937 - 0 . 82813 , 0 . 90625 - 2 . 0625 , 0 . 90625 - 1 . 21875 , 0 - 2 . 03125 , - 0 . 90625 - 0 . 79688 , - 0 . 90625 - 0 . 79688 , - 2 . 71875 z m 2 . 85938 , - 2 . 29687 q - 0 . 625 , 0 - 1 . 03125 , 0 . 53125 - 0 . 39063 , 0 . 53125 - 0 . 39063 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51562 1 . 01563 , 0 . 51562 0 . 625 , 0 1 . 03125 , - 0 . 51562 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29688 - 0 . 42188 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01562 , - 0 . 53125 z m 5 . 36964 , 5 . 4375 V 312 . 5475 h 5 . 01563 q 1 . 53125 , 0 2 . 45312 , 0 . 40625 0 . 92188 , 0 . 40625 1 . 4375 , 1 . 25 0 . 53125 , 0 . 84375 0 . 53125 , 1 . 76563 0 , 0 . 85937 - 0 . 46875 , 1 . 625 - 0 . 45312 , 0 . 75 - 1 . 39062 , 1 . 20312 1 . 20312 , 0 . 35938 1 . 85937 , 1 . 21875 0 . 65625 , 0 . 85938 0 . 65625 , 2 . 01563 0 , 0 . 9375 - 0 . 40625 , 1 . 75 - 0 . 39062 , 0 . 79687 - 0 . 98437 , 1 . 23437 - 0 . 57813 , 0 . 4375 - 1 . 45313 , 0 . 67188 - 0 . 875 , 0 . 21875 - 2 . 15625 , 0 . 21875 z m 1 . 78125 , - 7 . 75 h 2 . 875 q 1 . 1875 , 0 1 . 6875 , - 0 . 14063 0 . 67188 , - 0 . 20312 1 . 01563 , - 0 . 67187 0 . 34375 , - 0 . 46875 0 . 34375 , - 1 . 17188 0 , - 0 . 65625 - 0 . 32813 , - 1 . 15625 - 0 . 3125 , - 0 . 51562 - 0 . 90625 , - 0 . 70312 - 0 . 59375 , - 0 . 1875 - 2 . 03125 , - 0 . 1875 h - 2 . 65625 z m 0 , 6 . 17187 h 3 . 3125 q 0 . 85938 , 0 1 . 20313 , - 0 . 0625 0 . 60937 , - 0 . 10937 1 . 01562 , - 0 . 35937 0 . 42188 , - 0 . 26563 0 . 6875 , - 0 . 75 0 . 26563 , - 0 . 48438 0 . 26563 , - 1 . 125 0 , - 0 . 75 - 0 . 39063 , - 1 . 29688 - 0 . 375 , - 0 . 54687 - 1 . 0625 , - 0 . 76562 - 0 . 67187 , - 0 . 23438 - 1 . 95312 , - 0 . 23438 h - 3 . 07813 z m 24 . 34563 , - 6 . 28125 h - 8 . 82812 v - 1 . 51562 h 8 . 82812 z m 0 , 4 . 0625 h - 8 . 82812 v - 1 . 53125 h 8 . 82812 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path201 " <nl> + d = " m 230 . 44314 , 325 . 90685 - 3 . 90625 , - 9 . 67187 h 2 . 6875 l 1 . 82812 , 4 . 9375 0 . 53125 , 1 . 64062 q 0 . 20313 , - 0 . 625 0 . 26563 , - 0 . 82812 0 . 125 , - 0 . 40625 0 . 26562 , - 0 . 8125 l 1 . 84375 , - 4 . 9375 h 2 . 625 l - 3 . 84375 , 9 . 67187 z m 7 . 71947 , - 10 . 98437 v - 2 . 375 h 2 . 5625 v 2 . 375 z m 0 , 10 . 98437 v - 9 . 67187 h 2 . 5625 v 9 . 67187 z m 10 . 77705 , - 3 . 07812 2 . 54688 , 0 . 42187 q - 0 . 48438 , 1 . 40625 - 1 . 54688 , 2 . 14063 - 1 . 0625 , 0 . 73437 - 2 . 65625 , 0 . 73437 - 2 . 51562 , 0 - 3 . 73437 , - 1 . 65625 - 0 . 95313 , - 1 . 3125 - 0 . 95313 , - 3 . 32812 0 , - 2 . 40625 1 . 25 , - 3 . 76563 1 . 26563 , - 1 . 35937 3 . 1875 , - 1 . 35937 2 . 15625 , 0 3 . 40625 , 1 . 42187 1 . 25 , 1 . 42188 1 . 1875 , 4 . 375 h - 6 . 40625 q 0 . 0312 , 1 . 14063 0 . 60938 , 1 . 78125 0 . 59375 , 0 . 625 1 . 48437 , 0 . 625 0 . 59375 , 0 1 , - 0 . 32812 0 . 42188 , - 0 . 32813 0 . 625 , - 1 . 0625 z m 0 . 15625 , - 2 . 59375 q - 0 . 0312 , - 1 . 10938 - 0 . 57812 , - 1 . 6875 - 0 . 54688 , - 0 . 57813 - 1 . 32813 , - 0 . 57813 - 0 . 84375 , 0 - 1 . 39062 , 0 . 60938 - 0 . 54688 , 0 . 60937 - 0 . 53125 , 1 . 65625 z m 6 . 42261 , 5 . 67187 - 3 . 0625 , - 9 . 67187 h 2 . 48437 l 1 . 8125 , 6 . 34375 1 . 67188 , - 6 . 34375 h 2 . 46875 l 1 . 60937 , 6 . 34375 1 . 85938 , - 6 . 34375 h 2 . 51562 l - 3 . 10937 , 9 . 67187 h - 2 . 45313 l - 1 . 67187 , - 6 . 21875 - 1 . 64063 , 6 . 21875 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path203 " <nl> + d = " m 273 . 30699 , 325 . 90685 v - 9 . 67187 h 1 . 46875 v 1 . 35937 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14062 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45312 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23438 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79687 0 . 78125 , 0 . 79688 0 . 78125 , 2 . 45313 v 6 . 64062 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70312 - 0 . 42187 , - 0 . 26563 - 0 . 98437 , - 0 . 26563 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67188 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 22 . 1658 , - 3 . 10937 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79687 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32812 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70313 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48437 1 . 01562 , - 1 . 51562 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95312 - 2 . 03125 , - 0 . 95312 - 1 . 125 , 0 - 1 . 90625 , 0 . 76562 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01563 z m 9 . 14132 , 5 . 76562 v - 9 . 67187 h 1 . 46875 v 1 . 35937 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14062 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45312 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23438 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79687 0 . 78125 , 0 . 79688 0 . 78125 , 2 . 45313 v 6 . 64062 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70312 - 0 . 42188 , - 0 . 26563 - 0 . 98438 , - 0 . 26563 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67188 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 15 . 52518 , 0 v - 9 . 67187 h 1 . 46875 v 1 . 46875 q 0 . 5625 , - 1 . 03125 1 . 03125 , - 1 . 35938 0 . 48438 , - 0 . 32812 1 . 0625 , - 0 . 32812 0 . 82813 , 0 1 . 6875 , 0 . 53125 l - 0 . 5625 , 1 . 51562 q - 0 . 60937 , - 0 . 35937 - 1 . 20312 , - 0 . 35937 - 0 . 54688 , 0 - 0 . 96875 , 0 . 32812 - 0 . 42188 , 0 . 32813 - 0 . 60938 , 0 . 89063 - 0 . 28125 , 0 . 875 - 0 . 28125 , 1 . 92187 v 5 . 0625 z m 12 . 8533 , - 3 . 10937 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79687 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32812 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70313 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48437 1 . 01562 , - 1 . 51562 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95312 - 2 . 03125 , - 0 . 95312 - 1 . 125 , 0 - 1 . 90625 , 0 . 76562 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01563 z m 9 . 53198 , 5 . 76562 v - 8 . 40625 h - 1 . 45313 v - 1 . 26562 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 45313 0 . 23438 , - 0 . 64062 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 39062 1 . 67187 , - 0 . 39062 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95312 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32812 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89063 h 1 . 89062 v 1 . 26562 h - 1 . 89062 v 8 . 40625 z m 4 . 57391 , - 5 . 84375 v - 1 . 53125 l 8 . 84375 , - 3 . 73437 v 1 . 64062 l - 7 . 01562 , 2 . 875 7 . 01562 , 2 . 90625 v 1 . 625 z m 19 . 26996 , 4 . 26563 v 1 . 57812 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76563 , - 1 . 04688 0 . 76563 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70313 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70312 - 0 . 70312 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17187 , - 1 . 89063 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32813 , 1 . 57812 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 1 . 12573 , 1 . 57812 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64062 h 2 . 04687 l 1 . 48438 , 2 . 26562 q 0 . 42187 , 0 . 64063 0 . 67187 , 1 . 07813 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54687 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 18 . 57813 , - 1 . 57812 v 1 . 57812 h - 8 . 82813 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07813 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17187 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76562 , - 1 . 04688 0 . 76562 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70312 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70313 , 0 . 70312 - 0 . 70313 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17188 , - 1 . 89063 1 . 29688 , - 2 . 875 1 . 14062 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92187 , 0 3 . 04687 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32812 , 1 . 57812 - 0 . 32813 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89063 , 1 . 6875 - 0 . 42187 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 1 . 1257 , 1 . 57812 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64062 h 2 . 04687 l 1 . 48438 , 2 . 26562 q 0 . 42187 , 0 . 64063 0 . 67187 , 1 . 07813 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54687 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45312 v - 1 . 26562 h 1 . 45312 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17188 , - 1 . 45313 0 . 23437 , - 0 . 64062 0 . 82812 , - 1 . 03125 0 . 59375 , - 0 . 39062 1 . 67188 , - 0 . 39062 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95313 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32812 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89063 h 1 . 89063 v 1 . 26562 h - 1 . 89063 v 8 . 40625 z m 4 . 33957 , - 3 . 53125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 01563 0 . 6875 , 0 . 60937 1 . 65625 , 0 . 60937 1 . 15625 , 0 1 . 95312 , - 0 . 79687 0 . 79688 , - 0 . 79688 0 . 79688 , - 1 . 98438 0 , - 1 . 125 - 0 . 73438 , - 1 . 85937 - 0 . 73437 , - 0 . 73438 - 1 . 875 , - 0 . 73438 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17188 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26563 , 0 . 0156 1 . 04687 , 0 1 . 875 , - 0 . 54687 0 . 84375 , - 0 . 54688 0 . 84375 , - 1 . 67188 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 60938 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 79687 l - 1 . 64063 , - 0 . 29687 q 0 . 29688 , - 1 . 64063 1 . 35938 , - 2 . 54688 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85938 - 0 . 46875 , 1 . 57813 - 0 . 46875 , 0 . 70312 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14062 0 . 65625 , 0 . 85938 0 . 65625 , 2 . 15625 0 , 1 . 73438 - 1 . 28125 , 2 . 95313 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 04688 - 1 . 15625 , - 1 . 04687 - 1 . 32812 , - 2 . 71875 z m 18 . 98508 , 1 . 95313 v 1 . 57812 h - 8 . 82813 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07813 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17187 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76562 , - 1 . 04688 0 . 76562 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70312 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70313 , 0 . 70312 - 0 . 70313 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17188 , - 1 . 89063 1 . 29688 , - 2 . 875 1 . 14062 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92187 , 0 3 . 04687 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32812 , 1 . 57812 - 0 . 32813 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89063 , 1 . 6875 - 0 . 42187 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 2 . 64135 , 1 . 57812 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 9 . 64786 , 0 . 23438 0 . 79688 , - 3 . 89063 h - 1 . 54688 v - 1 . 35937 h 1 . 8125 l 0 . 67188 , - 3 . 29688 h - 2 . 48438 v - 1 . 35937 h 2 . 76563 l 0 . 79687 , - 3 . 90625 h 1 . 35938 l - 0 . 79688 , 3 . 90625 h 2 . 875 l 0 . 79688 , - 3 . 90625 h 1 . 375 l - 0 . 79688 , 3 . 90625 h 1 . 57813 v 1 . 35937 h - 1 . 84375 l - 0 . 6875 , 3 . 29688 h 2 . 53125 v 1 . 35937 h - 2 . 8125 l - 0 . 78125 , 3 . 89063 h - 1 . 375 l 0 . 78125 , - 3 . 89063 h - 2 . 85938 l - 0 . 78125 , 3 . 89063 z m 2 . 4375 , - 5 . 25 H 428 . 14 l 0 . 6875 , - 3 . 29688 h - 2 . 875 z m 8 . 1882 , 5 . 01562 v - 13 . 35937 h 1 . 64063 v 13 . 35937 z m 4 . 19172 , 0 v - 9 . 67187 h 1 . 46875 v 1 . 35937 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14062 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45312 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23438 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79687 0 . 78125 , 0 . 79688 0 . 78125 , 2 . 45313 v 6 . 64062 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70312 - 0 . 42187 , - 0 . 26563 - 0 . 98437 , - 0 . 26563 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67188 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 21 . 8533 , - 1 . 1875 q - 0 . 92188 , 0 . 76563 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98437 0 , - 0 . 71875 0 . 32812 , - 1 . 29688 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35937 1 . 1875 , - 0 . 54687 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23438 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42188 0 , - 1 - 0 . 46875 , - 1 . 42187 - 0 . 625 , - 0 . 54688 - 1 . 875 , - 0 . 54688 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42188 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01563 0 . 71875 , - 1 . 64063 0 . 5 , - 0 . 64062 1 . 45312 , - 0 . 98437 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29687 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73438 0 . 375 , 0 . 4375 0 . 51563 , 1 . 10937 0 . 0781 , 0 . 42188 0 . 0781 , 1 . 51563 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89062 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51562 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67187 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14062 - 1 . 4375 , 0 . 32812 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42187 1 . 09375 , - 1 . 14062 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64063 z m 4 . 20383 , 8 . 5625 v - 13 . 375 h 1 . 48437 v 1 . 25 q 0 . 53125 , - 0 . 73438 1 . 1875 , - 1 . 09375 0 . 67188 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23438 , 0 2 . 17188 , 0 . 64062 0 . 95312 , 0 . 625 1 . 4375 , 1 . 79688 0 . 48437 , 1 . 15625 0 . 48437 , 2 . 54687 0 , 1 . 48438 - 0 . 53125 , 2 . 67188 - 0 . 53125 , 1 . 1875 - 1 . 54687 , 1 . 82812 - 1 . 01563 , 0 . 625 - 2 . 14063 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70313 z m 1 . 48437 , - 8 . 48438 q 0 , 1 . 85938 0 . 75 , 2 . 76563 0 . 76563 , 0 . 89062 1 . 82813 , 0 . 89062 1 . 09375 , 0 1 . 875 , - 0 . 92187 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76563 , - 2 . 76563 - 0 . 75 , - 0 . 92187 - 1 . 8125 , - 0 . 92187 - 1 . 04687 , 0 - 1 . 85937 , 0 . 98437 - 0 . 79688 , 0 . 96875 - 0 . 79688 , 2 . 84375 z m 7 . 62574 , 4 . 78125 5 . 125 , - 13 . 35937 h 1 . 90625 l 5 . 46875 , 13 . 35937 h - 2 . 01563 l - 1 . 54687 , - 4 . 04687 h - 5 . 59375 l - 1 . 46875 , 4 . 04687 z m 3 . 85937 , - 5 . 48437 h 4 . 53125 l - 1 . 40625 , - 3 . 70313 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76562 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54687 z m 10 . 2717 , 5 . 48437 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 9 . 64786 , 0 . 23438 0 . 79687 , - 3 . 89063 h - 1 . 54687 v - 1 . 35937 h 1 . 8125 l 0 . 67187 , - 3 . 29688 h - 2 . 48437 v - 1 . 35937 h 2 . 76562 l 0 . 79688 , - 3 . 90625 h 1 . 35934 l - 0 . 79684 , 3 . 90625 h 2 . 87497 l 0 . 79687 , - 3 . 90625 h 1 . 375 l - 0 . 79687 , 3 . 90625 h 1 . 57812 v 1 . 35937 h - 1 . 84375 l - 0 . 6875 , 3 . 29688 h 2 . 53125 v 1 . 35937 h - 2 . 8125 l - 0 . 78125 , 3 . 89063 h - 1 . 375 l 0 . 78125 , - 3 . 89063 h - 2 . 85934 l - 0 . 78125 , 3 . 89063 z m 2 . 4375 , - 5 . 25 h 2 . 85934 l 0 . 6875 , - 3 . 29688 h - 2 . 87497 z m 8 . 23508 , - 6 . 45313 v - 1 . 89062 h 1 . 64062 v 1 . 89062 z m 0 , 11 . 46875 v - 9 . 67187 h 1 . 64062 v 9 . 67187 z m 4 . 14483 , 0 v - 9 . 67187 h 1 . 46875 v 1 . 35937 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14062 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45312 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23438 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79687 0 . 78125 , 0 . 79688 0 . 78125 , 2 . 45313 v 6 . 64062 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70312 - 0 . 42188 , - 0 . 26563 - 0 . 98438 , - 0 . 26563 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67188 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 21 . 85327 , - 1 . 1875 q - 0 . 92187 , 0 . 76563 - 1 . 76562 , 1 . 09375 - 0 . 82813 , 0 . 3125 - 1 . 79688 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45312 , - 0 . 78125 - 0 . 85938 , - 0 . 78125 - 0 . 85938 , - 1 . 98437 0 , - 0 . 71875 0 . 32813 , - 1 . 29688 0 . 32812 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35937 1 . 1875 , - 0 . 54687 0 . 46875 , - 0 . 125 1 . 45312 , - 0 . 25 1 . 98438 , - 0 . 23438 2 . 92188 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42188 0 , - 1 - 0 . 46875 , - 1 . 42187 - 0 . 625 , - 0 . 54688 - 1 . 875 , - 0 . 54688 - 1 . 15625 , 0 - 1 . 70312 , 0 . 40625 - 0 . 54688 , 0 . 40625 - 0 . 8125 , 1 . 42188 l - 1 . 60938 , - 0 . 21875 q 0 . 21875 , - 1 . 01563 0 . 71875 , - 1 . 64063 0 . 5 , - 0 . 64062 1 . 45313 , - 0 . 98437 0 . 95312 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01562 , 0 . 29687 0 . 78125 , 0 . 28125 1 . 14063 , 0 . 73438 0 . 375 , 0 . 4375 0 . 51562 , 1 . 10937 0 . 0781 , 0 . 42188 0 . 0781 , 1 . 51563 v 2 . 1875 q 0 , 2 . 28125 0 . 10937 , 2 . 89062 0 . 10938 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70307 q - 0 . 26563 , - 0 . 51562 - 0 . 32813 , - 1 . 1875 z m - 0 . 14062 , - 3 . 67187 q - 0 . 89063 , 0 . 375 - 2 . 67188 , 0 . 625 - 1 . 01562 , 0 . 14062 - 1 . 4375 , 0 . 32812 - 0 . 42187 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45313 , 0 . 4375 0 . 9375 , 0 1 . 67187 , - 0 . 40625 0 . 75 , - 0 . 42187 1 . 09375 , - 1 . 14062 0 . 26563 , - 0 . 5625 0 . 26563 , - 1 . 64063 z m 4 . 20385 , 8 . 5625 v - 13 . 375 h 1 . 48438 v 1 . 25 q 0 . 53125 , - 0 . 73438 1 . 1875 , - 1 . 09375 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 64062 0 . 95313 , 0 . 625 1 . 4375 , 1 . 79688 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 54687 0 , 1 . 48438 - 0 . 53125 , 2 . 67188 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 82812 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 70313 z m 1 . 48438 , - 8 . 48438 q 0 , 1 . 85938 0 . 75 , 2 . 76563 0 . 76562 , 0 . 89062 1 . 82812 , 0 . 89062 1 . 09375 , 0 1 . 875 , - 0 . 92187 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 76563 - 0 . 75 , - 0 . 92187 - 1 . 8125 , - 0 . 92187 - 1 . 04688 , 0 - 1 . 85938 , 0 . 98437 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 9 . 01636 , 4 . 78125 v - 13 . 35937 h 5 . 01562 q 1 . 53125 , 0 2 . 45313 , 0 . 40625 0 . 92187 , 0 . 40625 1 . 4375 , 1 . 25 0 . 53125 , 0 . 84375 0 . 53125 , 1 . 76562 0 , 0 . 85938 - 0 . 46875 , 1 . 625 - 0 . 45313 , 0 . 75 - 1 . 39063 , 1 . 20313 1 . 20313 , 0 . 35937 1 . 85938 , 1 . 21875 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 01562 0 , 0 . 9375 - 0 . 40625 , 1 . 75 - 0 . 39063 , 0 . 79688 - 0 . 98438 , 1 . 23438 - 0 . 57812 , 0 . 4375 - 1 . 45312 , 0 . 67187 - 0 . 875 , 0 . 21875 - 2 . 15625 , 0 . 21875 z m 1 . 78125 , - 7 . 75 h 2 . 875 q 1 . 1875 , 0 1 . 6875 , - 0 . 14062 0 . 67187 , - 0 . 20313 1 . 01562 , - 0 . 67188 0 . 34375 , - 0 . 46875 0 . 34375 , - 1 . 17187 0 , - 0 . 65625 - 0 . 32812 , - 1 . 15625 - 0 . 3125 , - 0 . 51563 - 0 . 90625 , - 0 . 70313 - 0 . 59375 , - 0 . 1875 - 2 . 03125 , - 0 . 1875 h - 2 . 65625 z m 0 , 6 . 17188 h 3 . 3125 q 0 . 85937 , 0 1 . 20312 , - 0 . 0625 0 . 60938 , - 0 . 10938 1 . 01563 , - 0 . 35938 0 . 42187 , - 0 . 26562 0 . 6875 , - 0 . 75 0 . 26562 , - 0 . 48437 0 . 26562 , - 1 . 125 0 , - 0 . 75 - 0 . 39062 , - 1 . 29687 - 0 . 375 , - 0 . 54688 - 1 . 0625 , - 0 . 76563 - 0 . 67188 , - 0 . 23437 - 1 . 95313 , - 0 . 23437 h - 3 . 07812 z m 18 . 6936 , 0 v 1 . 57812 h - 8 . 82812 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14062 0 . 34375 , - 0 . 90625 1 . 07812 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01563 2 . 17188 , - 1 . 78125 2 . 9375 , - 2 . 82812 0 . 76563 , - 1 . 04688 0 . 76563 , - 1 . 96875 0 , - 0 . 98438 - 0 . 70313 , - 1 . 64063 - 0 . 6875 , - 0 . 67187 - 1 . 8125 , - 0 . 67187 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70312 , 0 . 70312 - 0 . 70312 , 1 . 95312 l - 1 . 6875 , - 0 . 17187 q 0 . 17187 , - 1 . 89063 1 . 29687 , - 2 . 875 1 . 14063 , - 0 . 98438 3 . 03125 , - 0 . 98438 1 . 92188 , 0 3 . 04688 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64063 0 , 0 . 79687 - 0 . 32813 , 1 . 57812 - 0 . 32812 , 0 . 78125 - 1 . 09375 , 1 . 64063 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23437 - 1 . 89062 , 1 . 6875 - 0 . 42188 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 0 . 9538 , 1 . 57812 5 . 125 , - 13 . 35937 h 1 . 90625 l 5 . 46875 , 13 . 35937 h - 2 . 01563 l - 1 . 54687 , - 4 . 04687 h - 5 . 59375 l - 1 . 46875 , 4 . 04687 z m 3 . 85937 , - 5 . 48437 H 577 . 52 l - 1 . 40625 , - 3 . 70313 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76562 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54687 z m 10 . 27173 , 5 . 48437 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45312 , - 0 . 70313 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 12 . 6322 , 0 - 3 . 6875 , - 9 . 67187 h 1 . 73438 l 2 . 07812 , 5 . 79687 q 0 . 32813 , 0 . 9375 0 . 625 , 1 . 9375 0 . 20313 , - 0 . 76562 0 . 60938 , - 1 . 82812 l 2 . 14062 , - 5 . 90625 h 1 . 6875 l - 3 . 65625 , 9 . 67187 z m 6 . 64063 , 0 v - 9 . 67187 h 1 . 46875 v 1 . 35937 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14062 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45312 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23438 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79687 0 . 78125 , 0 . 79688 0 . 78125 , 2 . 45313 v 6 . 64062 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70312 - 0 . 42187 , - 0 . 26563 - 0 . 98437 , - 0 . 26563 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67188 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 22 . 16583 , - 3 . 10937 1 . 6875 , 0 . 20312 q - 0 . 40625 , 1 . 48438 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29687 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67188 0 , - 2 . 45312 1 . 25 , - 3 . 79687 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32812 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70313 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45312 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48437 1 . 01562 , - 1 . 51562 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82813 - 0 . 78125 , - 0 . 95312 - 2 . 03125 , - 0 . 95312 - 1 . 125 , 0 - 1 . 90625 , 0 . 76562 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01563 z m 9 . 14129 , 5 . 76562 v - 9 . 67187 h 1 . 46875 v 1 . 35937 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14062 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45312 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23438 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79687 0 . 78125 , 0 . 79688 0 . 78125 , 2 . 45313 v 6 . 64062 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98437 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70312 - 0 . 42188 , - 0 . 26563 - 0 . 98438 , - 0 . 26563 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67188 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64062 - 0 . 40625 , - 0 . 54688 - 1 . 3125 , - 0 . 54688 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35938 - 0 . 59375 , 0 . 35937 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70312 - 0 . 25 , 2 . 03125 v 5 . 01562 z m 24 . 16583 , - 5 . 84375 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01563 , - 2 . 90625 - 7 . 01563 , - 2 . 875 v - 1 . 64062 l 8 . 84375 , 3 . 73437 z m 10 . 57825 , 9 . 76563 q - 1 . 35937 , - 1 . 70313 - 2 . 29687 , - 4 - 0 . 9375 , - 2 . 29688 - 0 . 9375 , - 4 . 76563 0 , - 2 . 15625 0 . 70312 , - 4 . 14062 0 . 82813 , - 2 . 3125 2 . 53125 , - 4 . 59375 h 1 . 17188 q - 1 . 09375 , 1 . 89062 - 1 . 45313 , 2 . 70312 - 0 . 54687 , 1 . 25 - 0 . 875 , 2 . 625 - 0 . 39062 , 1 . 70313 - 0 . 39062 , 3 . 42188 0 , 4 . 375 2 . 71875 , 8 . 75 z m 4 . 16583 , 0 h - 1 . 1875 q 2 . 73438 , - 4 . 375 2 . 73438 , - 8 . 75 0 , - 1 . 71875 - 0 . 39063 , - 3 . 39063 - 0 . 3125 , - 1 . 375 - 0 . 875 , - 2 . 625 - 0 . 35937 , - 0 . 82812 - 1 . 46875 , - 2 . 73437 h 1 . 1875 q 1 . 70313 , 2 . 28125 2 . 53125 , 4 . 59375 0 . 6875 , 1 . 98437 0 . 6875 , 4 . 14062 0 , 2 . 46875 - 0 . 9375 , 4 . 76563 - 0 . 9375 , 2 . 29687 - 2 . 28125 , 4 z m 10 . 34906 , - 0 . 21875 v - 17 . 0625 h 3 . 60938 v 1 . 35937 h - 1 . 96875 v 14 . 34375 h 1 . 96875 v 1 . 35938 z m 4 . 99579 , - 13 . 84375 q 0 , - 1 . 4375 0 . 71875 , - 2 . 4375 0 . 71875 , - 1 2 . 09375 , - 1 1 . 25 , 0 2 . 07813 , 0 . 90625 0 . 82812 , 0 . 89062 0 . 82812 , 2 . 625 0 , 1 . 6875 - 0 . 84375 , 2 . 60937 - 0 . 82812 , 0 . 92188 - 2 . 04687 , 0 . 92188 - 1 . 20313 , 0 - 2 . 01563 , - 0 . 90625 - 0 . 8125 , - 0 . 90625 - 0 . 8125 , - 2 . 71875 z m 2 . 85938 , - 2 . 3125 q - 0 . 60938 , 0 - 1 . 01563 , 0 . 53125 - 0 . 40625 , 0 . 53125 - 0 . 40625 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51562 1 . 01563 , 0 . 51562 0 . 625 , 0 1 . 01562 , - 0 . 51562 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29688 - 0 . 40625 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01562 , - 0 . 53125 z m 0 , 12 . 9375 7 . 3125 , - 14 . 0625 h 1 . 32812 l - 7 . 28125 , 14 . 0625 z m 5 . 78125 , - 3 . 625 q 0 , - 1 . 4375 0 . 71875 , - 2 . 42188 0 . 71875 , - 1 2 . 09375 , - 1 1 . 26562 , 0 2 . 07812 , 0 . 90625 0 . 82813 , 0 . 89063 0 . 82813 , 2 . 625 0 , 1 . 6875 - 0 . 82813 , 2 . 60938 - 0 . 82812 , 0 . 90625 - 2 . 0625 , 0 . 90625 - 1 . 21875 , 0 - 2 . 03125 , - 0 . 90625 - 0 . 79687 , - 0 . 90625 - 0 . 79687 , - 2 . 71875 z m 2 . 85937 , - 2 . 29688 q - 0 . 625 , 0 - 1 . 03125 , 0 . 53125 - 0 . 39062 , 0 . 53125 - 0 . 39062 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51563 1 . 01562 , 0 . 51563 0 . 625 , 0 1 . 03125 , - 0 . 51563 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29687 - 0 . 42187 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01563 , - 0 . 53125 z m 10 . 96338 , 5 . 4375 h - 1 . 64062 v - 10 . 45312 q - 0 . 59375 , 0 . 5625 - 1 . 5625 , 1 . 14062 - 0 . 95313 , 0 . 5625 - 1 . 71875 , 0 . 84375 v - 1 . 59375 q 1 . 375 , - 0 . 64062 2 . 40625 , - 1 . 5625 1 . 03125 , - 0 . 92187 1 . 45312 , - 1 . 78125 h 1 . 0625 z m 5 . 07886 , 0 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35938 , 0 . 64063 - 1 . 15625 , 0 . 98438 l - 0 . 45313 , - 0 . 70313 q 0 . 51563 , - 0 . 21875 0 . 76563 , - 0 . 67187 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26563 z m 9 . 78845 , - 10 . 14062 q 0 , - 1 . 4375 0 . 71875 , - 2 . 4375 0 . 71875 , - 1 2 . 09375 , - 1 1 . 25 , 0 2 . 07813 , 0 . 90625 0 . 82812 , 0 . 89062 0 . 82812 , 2 . 625 0 , 1 . 6875 - 0 . 84375 , 2 . 60937 - 0 . 82812 , 0 . 92188 - 2 . 04687 , 0 . 92188 - 1 . 20313 , 0 - 2 . 01563 , - 0 . 90625 - 0 . 8125 , - 0 . 90625 - 0 . 8125 , - 2 . 71875 z m 2 . 85938 , - 2 . 3125 q - 0 . 60938 , 0 - 1 . 01563 , 0 . 53125 - 0 . 40625 , 0 . 53125 - 0 . 40625 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51562 1 . 01563 , 0 . 51562 0 . 625 , 0 1 . 01562 , - 0 . 51562 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29688 - 0 . 40625 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01562 , - 0 . 53125 z m 0 , 12 . 9375 7 . 3125 , - 14 . 0625 h 1 . 32812 l - 7 . 28125 , 14 . 0625 z m 5 . 78125 , - 3 . 625 q 0 , - 1 . 4375 0 . 71875 , - 2 . 42188 0 . 71875 , - 1 2 . 09375 , - 1 1 . 26562 , 0 2 . 07812 , 0 . 90625 0 . 82813 , 0 . 89063 0 . 82813 , 2 . 625 0 , 1 . 6875 - 0 . 82813 , 2 . 60938 - 0 . 82812 , 0 . 90625 - 2 . 0625 , 0 . 90625 - 1 . 21875 , 0 - 2 . 03125 , - 0 . 90625 - 0 . 79687 , - 0 . 90625 - 0 . 79687 , - 2 . 71875 z m 2 . 85937 , - 2 . 29688 q - 0 . 625 , 0 - 1 . 03125 , 0 . 53125 - 0 . 39062 , 0 . 53125 - 0 . 39062 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51563 1 . 01562 , 0 . 51563 0 . 625 , 0 1 . 03125 , - 0 . 51563 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29687 - 0 . 42187 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01563 , - 0 . 53125 z m 4 . 90088 , - 6 . 17187 v - 1 . 57813 h 8 . 64063 v 1 . 28125 q - 1 . 28125 , 1 . 35938 - 2 . 53125 , 3 . 60938 - 1 . 25 , 2 . 25 - 1 . 9375 , 4 . 625 - 0 . 48438 , 1 . 67187 - 0 . 625 , 3 . 67187 h - 1 . 6875 q 0 . 0312 , - 1 . 57812 0 . 625 , - 3 . 8125 0 . 59375 , - 2 . 23437 1 . 6875 , - 4 . 29687 1 . 10937 , - 2 . 07813 2 . 35937 , - 3 . 5 z m 13 . 45386 , 15 . 3125 h - 3 . 60938 v - 1 . 35938 h 1 . 96875 v - 14 . 34375 h - 1 . 96875 v - 1 . 35937 H 749 . 89 Z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path205 " <nl> + d = " m 203 . 14425 , 337 . 76625 q 0 , - 1 . 4375 0 . 71875 , - 2 . 4375 0 . 71875 , - 1 2 . 09375 , - 1 1 . 25 , 0 2 . 07812 , 0 . 90625 0 . 82813 , 0 . 89063 0 . 82813 , 2 . 625 0 , 1 . 6875 - 0 . 84375 , 2 . 60938 - 0 . 82813 , 0 . 92187 - 2 . 04688 , 0 . 92187 - 1 . 20312 , 0 - 2 . 01562 , - 0 . 90625 - 0 . 8125 , - 0 . 90625 - 0 . 8125 , - 2 . 71875 z m 2 . 85937 , - 2 . 3125 q - 0 . 60937 , 0 - 1 . 01562 , 0 . 53125 - 0 . 40625 , 0 . 53125 - 0 . 40625 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51563 1 . 01562 , 0 . 51563 0 . 625 , 0 1 . 01563 , - 0 . 51563 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29687 - 0 . 40625 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01563 , - 0 . 53125 z m 0 , 12 . 9375 7 . 3125 , - 14 . 0625 h 1 . 32813 l - 7 . 28125 , 14 . 0625 z m 5 . 78125 , - 3 . 625 q 0 , - 1 . 4375 0 . 71875 , - 2 . 42187 0 . 71875 , - 1 2 . 09375 , - 1 1 . 26563 , 0 2 . 07813 , 0 . 90625 0 . 82812 , 0 . 89062 0 . 82812 , 2 . 625 0 , 1 . 6875 - 0 . 82812 , 2 . 60937 - 0 . 82813 , 0 . 90625 - 2 . 0625 , 0 . 90625 - 1 . 21875 , 0 - 2 . 03125 , - 0 . 90625 - 0 . 79688 , - 0 . 90625 - 0 . 79688 , - 2 . 71875 z m 2 . 85938 , - 2 . 29687 q - 0 . 625 , 0 - 1 . 03125 , 0 . 53125 - 0 . 39063 , 0 . 53125 - 0 . 39063 , 1 . 9375 0 , 1 . 28125 0 . 40625 , 1 . 8125 0 . 40625 , 0 . 51562 1 . 01563 , 0 . 51562 0 . 625 , 0 1 . 03125 , - 0 . 51562 0 . 40625 , - 0 . 53125 0 . 40625 , - 1 . 9375 0 , - 1 . 29688 - 0 . 42188 , - 1 . 8125 - 0 . 40625 , - 0 . 53125 - 1 . 01562 , - 0 . 53125 z m 3 . 97902 , 5 . 4375 5 . 125 , - 13 . 35938 h 1 . 90625 l 5 . 46875 , 13 . 35938 h - 2 . 01563 L 227 . 56077 , 343 . 86 h - 5 . 59375 l - 1 . 46875 , 4 . 04688 z m 3 . 85937 , - 5 . 48438 h 4 . 53125 l - 1 . 40625 , - 3 . 70312 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76563 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54688 z m 15 . 48626 , - 2 . 32812 V 338 . 235 h 1 . 85937 v 1 . 85938 z m 0 , 7 . 8125 v - 1 . 875 h 1 . 85937 v 1 . 875 z m 9 . 91348 , 0 V 338 . 235 h 1 . 46875 v 1 . 35938 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14063 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70313 - 0 . 42187 , - 0 . 26562 - 0 . 98437 , - 0 . 26562 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67187 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 22 . 1658 , - 3 . 10938 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48438 1 . 01562 , - 1 . 51563 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 9 . 14135 , 5 . 76563 V 338 . 235 h 1 . 46875 v 1 . 35938 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14063 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70313 - 0 . 42188 , - 0 . 26562 - 0 . 98438 , - 0 . 26562 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67187 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 15 . 52518 , 0 V 338 . 235 h 1 . 46875 v 1 . 46875 q 0 . 5625 , - 1 . 03125 1 . 03125 , - 1 . 35937 0 . 48438 , - 0 . 32813 1 . 0625 , - 0 . 32813 0 . 82813 , 0 1 . 6875 , 0 . 53125 l - 0 . 5625 , 1 . 51563 q - 0 . 60937 , - 0 . 35938 - 1 . 20312 , - 0 . 35938 - 0 . 54688 , 0 - 0 . 96875 , 0 . 32813 - 0 . 42188 , 0 . 32812 - 0 . 60938 , 0 . 89062 - 0 . 28125 , 0 . 875 - 0 . 28125 , 1 . 92188 v 5 . 0625 z m 12 . 8533 , - 3 . 10938 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 48438 1 . 01562 , - 1 . 51563 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 9 . 53195 , 5 . 76563 v - 8 . 40625 h - 1 . 45313 V 338 . 235 h 1 . 45313 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17187 , - 1 . 45312 0 . 23438 , - 0 . 64063 0 . 82813 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67187 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95312 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89062 v 1 . 26563 h - 1 . 89062 v 8 . 40625 z m 4 . 57394 , - 5 . 84375 v - 1 . 53125 l 8 . 84375 , - 3 . 73438 v 1 . 64063 l - 7 . 01562 , 2 . 875 7 . 01562 , 2 . 90625 v 1 . 625 z m 10 . 66059 , 2 . 3125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95312 , - 0 . 79688 0 . 79688 , - 0 . 79687 0 . 79688 , - 1 . 98437 0 , - 1 . 125 - 0 . 73438 , - 1 . 85938 - 0 . 73437 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26563 , 0 . 0156 1 . 04687 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64063 , - 0 . 29688 q 0 . 29688 , - 1 . 64062 1 . 35938 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32812 , - 2 . 71875 z m 9 . 73507 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64063 h 2 . 04687 l 1 . 48438 , 2 . 26563 q 0 . 42187 , 0 . 64062 0 . 67187 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 9 . 96875 , - 3 . 53125 1 . 64063 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95312 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95313 , - 0 . 79688 0 . 79687 , - 0 . 79687 0 . 79687 , - 1 . 98437 0 , - 1 . 125 - 0 . 73437 , - 1 . 85938 - 0 . 73438 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26562 , 0 . 0156 1 . 04688 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60937 , - 1 . 5 - 0 . 60938 , - 0 . 59375 - 1 . 57813 , - 0 . 59375 - 0 . 95312 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64062 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64062 , - 0 . 29688 q 0 . 29687 , - 1 . 64062 1 . 35937 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92188 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26562 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76562 , 0 - 2 . 92187 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32813 , - 2 . 71875 z m 9 . 73511 , 3 . 53125 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 64063 h 2 . 04687 l 1 . 48438 , 2 . 26563 q 0 . 42187 , 0 . 64062 0 . 67187 , 1 . 07812 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 54688 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45312 V 338 . 235 h 1 . 45312 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17188 , - 1 . 45312 0 . 23437 , - 0 . 64063 0 . 82812 , - 1 . 03125 0 . 59375 , - 0 . 39063 1 . 67188 , - 0 . 39063 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 0937 - 0 . 95313 , - 0 . 0937 - 0 . 75 , 0 - 1 . 0625 , 0 . 32813 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 89062 h 1 . 89063 v 1 . 26563 h - 1 . 89063 v 8 . 40625 z m 4 . 33954 , - 3 . 53125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 01562 0 . 6875 , 0 . 60938 1 . 65625 , 0 . 60938 1 . 15625 , 0 1 . 95312 , - 0 . 79688 0 . 79688 , - 0 . 79687 0 . 79688 , - 1 . 98437 0 , - 1 . 125 - 0 . 73438 , - 1 . 85938 - 0 . 73437 , - 0 . 73437 - 1 . 875 , - 0 . 73437 - 0 . 46875 , 0 - 1 . 15625 , 0 . 17187 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 0156 0 . 26563 , 0 . 0156 1 . 04687 , 0 1 . 875 , - 0 . 54688 0 . 84375 , - 0 . 54687 0 . 84375 , - 1 . 67187 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 60937 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 79688 l - 1 . 64063 , - 0 . 29688 q 0 . 29688 , - 1 . 64062 1 . 35938 , - 2 . 54687 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 85937 - 0 . 46875 , 1 . 57812 - 0 . 46875 , 0 . 70313 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 14063 0 . 65625 , 0 . 85937 0 . 65625 , 2 . 15625 0 , 1 . 73437 - 1 . 28125 , 2 . 95312 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 04687 - 1 . 15625 , - 1 . 04688 - 1 . 32812 , - 2 . 71875 z m 18 . 98511 , 1 . 95312 v 1 . 57813 h - 8 . 82813 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 14063 0 . 34375 , - 0 . 90625 1 . 07813 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 01562 2 . 17187 , - 1 . 78125 2 . 9375 , - 2 . 82813 0 . 76562 , - 1 . 04687 0 . 76562 , - 1 . 96875 0 , - 0 . 98437 - 0 . 70312 , - 1 . 64062 - 0 . 6875 , - 0 . 67188 - 1 . 8125 , - 0 . 67188 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70313 , 0 . 70313 - 0 . 70313 , 1 . 95313 L 376 . 6137 , 338 . 36 q 0 . 17188 , - 1 . 89062 1 . 29688 , - 2 . 875 1 . 14062 , - 0 . 98437 3 . 03125 , - 0 . 98437 1 . 92187 , 0 3 . 04687 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 64062 0 , 0 . 79688 - 0 . 32812 , 1 . 57813 - 0 . 32813 , 0 . 78125 - 1 . 09375 , 1 . 64062 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 23438 - 1 . 89063 , 1 . 6875 - 0 . 42187 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 2 . 64132 , 1 . 57813 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35937 , 0 . 64062 - 1 . 15625 , 0 . 98437 l - 0 . 45312 , - 0 . 70312 q 0 . 51562 , - 0 . 21875 0 . 76562 , - 0 . 67188 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26562 z m 9 . 64786 , 0 . 23437 0 . 79688 , - 3 . 89062 h - 1 . 54688 v - 1 . 35938 h 1 . 8125 l 0 . 67188 , - 3 . 29687 h - 2 . 48438 V 338 . 235 h 2 . 76563 l 0 . 79687 , - 3 . 90625 h 1 . 35938 l - 0 . 79688 , 3 . 90625 h 2 . 875 l 0 . 79688 , - 3 . 90625 h 1 . 375 l - 0 . 79688 , 3 . 90625 h 1 . 57813 v 1 . 35938 h - 1 . 84375 l - 0 . 6875 , 3 . 29687 h 2 . 53125 v 1 . 35938 h - 2 . 8125 l - 0 . 78125 , 3 . 89062 h - 1 . 375 l 0 . 78125 , - 3 . 89062 h - 2 . 85938 l - 0 . 78125 , 3 . 89062 z m 2 . 4375 , - 5 . 25 h 2 . 85938 l 0 . 6875 , - 3 . 29687 h - 2 . 875 z m 8 . 18823 , 5 . 01563 V 334 . 5475 h 1 . 64063 v 13 . 35938 z m 4 . 19168 , 0 V 338 . 235 h 1 . 46875 v 1 . 35938 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14063 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70313 - 0 . 42188 , - 0 . 26562 - 0 . 98438 , - 0 . 26562 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67187 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 21 . 85334 , - 1 . 1875 q - 0 . 92188 , 0 . 76562 - 1 . 76563 , 1 . 09375 - 0 . 82812 , 0 . 3125 - 1 . 79687 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45313 , - 0 . 78125 - 0 . 85937 , - 0 . 78125 - 0 . 85937 , - 1 . 98438 0 , - 0 . 71875 0 . 32812 , - 1 . 29687 0 . 32813 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 35938 1 . 1875 , - 0 . 54688 0 . 46875 , - 0 . 125 1 . 45313 , - 0 . 25 1 . 98437 , - 0 . 23437 2 . 92187 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 42187 0 , - 1 - 0 . 46875 , - 1 . 42188 - 0 . 625 , - 0 . 54687 - 1 . 875 , - 0 . 54687 - 1 . 15625 , 0 - 1 . 70313 , 0 . 40625 - 0 . 54687 , 0 . 40625 - 0 . 8125 , 1 . 42187 l - 1 . 60937 , - 0 . 21875 q 0 . 21875 , - 1 . 01562 0 . 71875 , - 1 . 64062 0 . 5 , - 0 . 64063 1 . 45312 , - 0 . 98438 0 . 95313 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01563 , 0 . 29688 0 . 78125 , 0 . 28125 1 . 14062 , 0 . 73437 0 . 375 , 0 . 4375 0 . 51563 , 1 . 10938 0 . 0781 , 0 . 42187 0 . 0781 , 1 . 51562 v 2 . 1875 q 0 , 2 . 28125 0 . 10938 , 2 . 89063 0 . 10937 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70313 q - 0 . 26562 , - 0 . 51563 - 0 . 32812 , - 1 . 1875 z m - 0 . 14063 , - 3 . 67188 q - 0 . 89062 , 0 . 375 - 2 . 67187 , 0 . 625 - 1 . 01563 , 0 . 14063 - 1 . 4375 , 0 . 32813 - 0 . 42188 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45312 , 0 . 4375 0 . 9375 , 0 1 . 67188 , - 0 . 40625 0 . 75 , - 0 . 42188 1 . 09375 , - 1 . 14063 0 . 26562 , - 0 . 5625 0 . 26562 , - 1 . 64062 z m 4 . 20383 , 8 . 5625 v - 13 . 375 h 1 . 48437 v 1 . 25 q 0 . 53125 , - 0 . 73437 1 . 1875 , - 1 . 09375 0 . 67188 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23438 , 0 2 . 17188 , 0 . 64063 0 . 95312 , 0 . 625 1 . 4375 , 1 . 79687 0 . 48437 , 1 . 15625 0 . 48437 , 2 . 54688 0 , 1 . 48437 - 0 . 53125 , 2 . 67187 - 0 . 53125 , 1 . 1875 - 1 . 54687 , 1 . 82813 - 1 . 01563 , 0 . 625 - 2 . 14063 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 V 351 . 61 Z m 1 . 48437 , - 8 . 48437 q 0 , 1 . 85937 0 . 75 , 2 . 76562 0 . 76563 , 0 . 89063 1 . 82813 , 0 . 89063 1 . 09375 , 0 1 . 875 , - 0 . 92188 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76563 , - 2 . 76562 - 0 . 75 , - 0 . 92188 - 1 . 8125 , - 0 . 92188 - 1 . 04687 , 0 - 1 . 85937 , 0 . 98438 - 0 . 79688 , 0 . 96875 - 0 . 79688 , 2 . 84375 z m 7 . 62571 , 4 . 78125 5 . 125 , - 13 . 35938 h 1 . 90625 l 5 . 46875 , 13 . 35938 h - 2 . 01563 L 456 . 20004 , 343 . 86 h - 5 . 59375 l - 1 . 46875 , 4 . 04688 z m 3 . 85937 , - 5 . 48438 h 4 . 53125 l - 1 . 40625 , - 3 . 70312 q - 0 . 625 , - 1 . 6875 - 0 . 9375 , - 2 . 76563 - 0 . 26562 , 1 . 28125 - 0 . 71875 , 2 . 54688 z m 10 . 2717 , 5 . 48438 v - 1 . 875 h 1 . 875 v 1 . 875 q 0 , 1 . 03125 - 0 . 375 , 1 . 65625 - 0 . 35938 , 0 . 64062 - 1 . 15625 , 0 . 98437 l - 0 . 45313 , - 0 . 70312 q 0 . 51563 , - 0 . 21875 0 . 76563 , - 0 . 67188 0 . 25 , - 0 . 4375 0 . 28125 , - 1 . 26562 z m 12 . 63223 , 0 - 3 . 6875 , - 9 . 67188 h 1 . 73438 l 2 . 07812 , 5 . 79688 q 0 . 32813 , 0 . 9375 0 . 625 , 1 . 9375 0 . 20313 , - 0 . 76563 0 . 60938 , - 1 . 82813 l 2 . 14062 , - 5 . 90625 h 1 . 6875 l - 3 . 65625 , 9 . 67188 z m 6 . 64063 , 0 V 338 . 235 h 1 . 46875 v 1 . 35938 q 0 . 45312 , - 0 . 71875 1 . 20312 , - 1 . 14063 0 . 76563 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07813 , 0 1 . 76563 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98437 , - 1 . 6875 1 . 45313 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64062 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57813 , - 0 . 70313 - 0 . 42187 , - 0 . 26562 - 0 . 98437 , - 0 . 26562 - 1 . 01563 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67188 , 0 . 67187 - 0 . 67188 , 2 . 15625 v 5 . 625 h - 1 . 64062 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85938 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 22 . 1658 , - 3 . 10938 1 . 6875 , 0 . 20313 q - 0 . 40625 , 1 . 48437 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 29688 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 67187 0 , - 2 . 45313 1 . 25 , - 3 . 79688 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 32813 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 70312 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 45313 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 48438 1 . 01563 , - 1 . 51563 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 82812 - 0 . 78125 , - 0 . 95313 - 2 . 03125 , - 0 . 95313 - 1 . 125 , 0 - 1 . 90625 , 0 . 76563 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 01562 z m 9 . 1413 , 5 . 76563 V 338 . 235 h 1 . 46875 v 1 . 35938 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 14063 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 45313 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 23437 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 79688 0 . 78125 , 0 . 79687 0 . 78125 , 2 . 45312 v 6 . 64063 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 98438 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 70313 - 0 . 42188 , - 0 . 26562 - 0 . 98438 , - 0 . 26562 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 67187 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 64063 - 0 . 40625 , - 0 . 54687 - 1 . 3125 , - 0 . 54687 - 0 . 6875 , 0 - 1 . 28125 , 0 . 35937 - 0 . 59375 , 0 . 35938 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 70313 - 0 . 25 , 2 . 03125 v 5 . 01563 z m 24 . 16583 , - 5 . 84375 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01563 , - 2 . 90625 - 7 . 01563 , - 2 . 875 v - 1 . 64063 l 8 . 84375 , 3 . 73438 z " / > <nl> + < path <nl> + style = " fill : # 000000 ; fill - opacity : 0 ; fill - rule : evenodd " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path207 " <nl> + d = " M 245 . 88976 , 0 H 586 . 86614 V 16 . 283463 H 245 . 88976 Z " / > <nl> + < path <nl> + style = " fill : # 434343 ; fill - rule : nonzero " <nl> + inkscape : connector - curvature = " 0 " <nl> + id = " path209 " <nl> + d = " M 256 . 32726 , 25 . 20346 V 11 . 844085 h 5 . 04688 q 1 . 32812 , 0 2 . 03125 , 0 . 125 0 . 96875 , 0 . 171875 1 . 64062 , 0 . 640625 0 . 67188 , 0 . 453125 1 . 07813 , 1 . 28125 0 . 40625 , 0 . 828125 0 . 40625 , 1 . 828125 0 , 1 . 703125 - 1 . 09375 , 2 . 890625 - 1 . 07813 , 1 . 171875 - 3 . 92188 , 1 . 171875 h - 3 . 42187 v 5 . 421875 z m 1 . 76563 , - 7 h 3 . 45312 q 1 . 71875 , 0 2 . 4375 , - 0 . 640625 0 . 71875 , - 0 . 640625 0 . 71875 , - 1 . 796875 0 , - 0 . 84375 - 0 . 42187 , - 1 . 4375 - 0 . 42188 , - 0 . 59375 - 1 . 125 , - 0 . 78125 - 0 . 4375 , - 0 . 125 - 1 . 64063 , - 0 . 125 h - 3 . 42187 z m 10 . 47482 , 7 V 11 . 844085 h 1 . 64062 v 4 . 796875 q 1 . 14063 , - 1 . 328125 2 . 89063 , - 1 . 328125 1 . 07812 , 0 1 . 85937 , 0 . 421875 0 . 79688 , 0 . 421875 1 . 14063 , 1 . 171875 0 . 34375 , 0 . 75 0 . 34375 , 2 . 171875 v 6 . 125 h - 1 . 64063 v - 6 . 125 q 0 , - 1 . 234375 - 0 . 53125 , - 1 . 796875 - 0 . 53125 , - 0 . 5625 - 1 . 51562 , - 0 . 5625 - 0 . 71875 , 0 - 1 . 35938 , 0 . 390625 - 0 . 64062 , 0 . 375 - 0 . 92187 , 1 . 015625 - 0 . 26563 , 0 . 640625 - 0 . 26563 , 1 . 78125 v 5 . 296875 z m 10 . 2976 , 3 . 71875 - 0 . 1875 , - 1 . 53125 q 0 . 54688 , 0 . 140625 0 . 9375 , 0 . 140625 0 . 54688 , 0 0 . 875 , - 0 . 1875 0 . 32813 , - 0 . 171875 0 . 54688 , - 0 . 5 0 . 15625 , - 0 . 25 0 . 5 , - 1 . 21875 0 . 0469 , - 0 . 140625 0 . 14062 , - 0 . 40625 l - 3 . 67187 , - 9 . 6875 h 1 . 76562 l 2 . 01563 , 5 . 59375 q 0 . 39062 , 1 . 078125 0 . 70312 , 2 . 25 0 . 28125 , - 1 . 125 0 . 67188 , - 2 . 203125 l 2 . 07812 , - 5 . 640625 h 1 . 64063 l - 3 . 6875 , 9 . 828125 q - 0 . 59375 , 1 . 609375 - 0 . 92188 , 2 . 203125 - 0 . 4375 , 0 . 8125 - 1 , 1 . 1875 - 0 . 5625 , 0 . 375 - 1 . 34375 , 0 . 375 - 0 . 48437 , 0 - 1 . 0625 , - 0 . 203125 z m 8 . 75 , - 6 . 609375 1 . 625 , - 0 . 25 q 0 . 125 , 0 . 96875 0 . 75 , 1 . 5 0 . 625 , 0 . 515625 1 . 75 , 0 . 515625 1 . 125 , 0 1 . 67188 , - 0 . 453125 0 . 54687 , - 0 . 46875 0 . 54687 , - 1 . 09375 0 , - 0 . 546875 - 0 . 48437 , - 0 . 875 - 0 . 32813 , - 0 . 21875 - 1 . 67188 , - 0 . 546875 - 1 . 8125 , - 0 . 46875 - 2 . 51562 , - 0 . 796875 - 0 . 6875 , - 0 . 328125 - 1 . 04688 , - 0 . 90625 - 0 . 35937 , - 0 . 59375 - 0 . 35937 , - 1 . 3125 0 , - 0 . 640625 0 . 29687 , - 1 . 1875 0 . 29688 , - 0 . 5625 0 . 8125 , - 0 . 921875 0 . 375 , - 0 . 28125 1 . 03125 , - 0 . 46875 0 . 67188 , - 0 . 203125 1 . 42188 , - 0 . 203125 1 . 14062 , 0 2 , 0 . 328125 0 . 85937 , 0 . 328125 1 . 26562 , 0 . 890625 0 . 42188 , 0 . 5625 0 . 57813 , 1 . 5 l - 1 . 60938 , 0 . 21875 q - 0 . 10937 , - 0 . 75 - 0 . 64062 , - 1 . 171875 - 0 . 51563 , - 0 . 421875 - 1 . 46875 , - 0 . 421875 - 1 . 14063 , 0 - 1 . 625 , 0 . 375 - 0 . 46875 , 0 . 375 - 0 . 46875 , 0 . 875 0 , 0 . 3125 0 . 1875 , 0 . 578125 0 . 20312 , 0 . 265625 0 . 64062 , 0 . 4375 0 . 23438 , 0 . 09375 1 . 4375 , 0 . 421875 1 . 75 , 0 . 453125 2 . 4375 , 0 . 75 0 . 6875 , 0 . 296875 1 . 07813 , 0 . 859375 0 . 39062 , 0 . 5625 0 . 39062 , 1 . 40625 0 , 0 . 828125 - 0 . 48437 , 1 . 546875 - 0 . 46875 , 0 . 71875 - 1 . 375 , 1 . 125 - 0 . 90625 , 0 . 390625 - 2 . 04688 , 0 . 390625 - 1 . 875 , 0 - 2 . 875 , - 0 . 78125 - 0 . 98437 , - 0 . 78125 - 1 . 25 , - 2 . 328125 z m 9 . 98438 , - 8 . 578125 v - 1 . 890625 h 1 . 64062 v 1 . 890625 z m 0 , 11 . 46875 v - 9 . 671875 h 1 . 64062 v 9 . 671875 z m 10 . 45731 , - 3 . 546875 1 . 60937 , 0 . 21875 q - 0 . 26562 , 1 . 65625 - 1 . 35937 , 2 . 609375 - 1 . 07813 , 0 . 9375 - 2 . 67188 , 0 . 9375 - 1 . 98437 , 0 - 3 . 1875 , - 1 . 296875 - 1 . 20312 , - 1 . 296875 - 1 . 20312 , - 3 . 71875 0 , - 1 . 578125 0 . 51562 , - 2 . 75 0 . 51563 , - 1 . 171875 1 . 57813 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57812 , 0 2 . 57812 , 0 . 796875 1 , 0 . 796875 1 . 28125 , 2 . 265625 l - 1 . 59375 , 0 . 234375 q - 0 . 23437 , - 0 . 96875 - 0 . 8125 , - 1 . 453125 - 0 . 57812 , - 0 . 5 - 1 . 39062 , - 0 . 5 - 1 . 23438 , 0 - 2 . 01563 , 0 . 890625 - 0 . 78125 , 0 . 890625 - 0 . 78125 , 2 . 8125 0 , 1 . 953125 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95313 , 0 . 875 0 . 96875 , 0 1 . 60937 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82813 , - 1 . 828125 z m 9 . 32812 , 2 . 359375 q - 0 . 92187 , 0 . 765625 - 1 . 76562 , 1 . 09375 - 0 . 82813 , 0 . 3125 - 1 . 79688 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45312 , - 0 . 78125 - 0 . 85938 , - 0 . 78125 - 0 . 85938 , - 1 . 984375 0 , - 0 . 71875 0 . 32813 , - 1 . 296875 0 . 32812 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 359375 1 . 1875 , - 0 . 546875 0 . 46875 , - 0 . 125 1 . 45312 , - 0 . 25 1 . 98438 , - 0 . 234375 2 . 92188 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 421875 0 , - 1 - 0 . 46875 , - 1 . 421875 - 0 . 625 , - 0 . 546875 - 1 . 875 , - 0 . 546875 - 1 . 15625 , 0 - 1 . 70312 , 0 . 40625 - 0 . 54688 , 0 . 40625 - 0 . 8125 , 1 . 421875 l - 1 . 60938 , - 0 . 21875 q 0 . 21875 , - 1 . 015625 0 . 71875 , - 1 . 640625 0 . 5 , - 0 . 640625 1 . 45313 , - 0 . 984375 0 . 95312 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01562 , 0 . 296875 0 . 78125 , 0 . 28125 1 . 14063 , 0 . 734375 0 . 375 , 0 . 4375 0 . 51562 , 1 . 109375 0 . 0781 , 0 . 421875 0 . 0781 , 1 . 515625 v 2 . 1875 q 0 , 2 . 28125 0 . 10937 , 2 . 890625 0 . 10938 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70312 q - 0 . 26563 , - 0 . 515625 - 0 . 32813 , - 1 . 1875 z m - 0 . 14062 , - 3 . 671875 q - 0 . 89063 , 0 . 375 - 2 . 67188 , 0 . 625 - 1 . 01562 , 0 . 140625 - 1 . 4375 , 0 . 328125 - 0 . 42187 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45313 , 0 . 4375 0 . 9375 , 0 1 . 67187 , - 0 . 40625 0 . 75 , - 0 . 421875 1 . 09375 , - 1 . 140625 0 . 26563 , - 0 . 5625 0 . 26563 , - 1 . 640625 z m 4 . 15698 , 4 . 859375 V 11 . 844085 h 1 . 64062 V 25 . 20346 Z m 9 . 53125 , 0 V 11 . 844085 h 2 . 65625 l 3 . 15625 , 9 . 453125 q 0 . 4375 , 1 . 328125 0 . 64062 , 1 . 984375 0 . 23438 , - 0 . 734375 0 . 70313 , - 2 . 140625 l 3 . 20312 , - 9 . 296875 h 2 . 375 V 25 . 20346 h - 1 . 70312 V 14 . 031585 l - 3 . 875 , 11 . 171875 h - 1 . 59375 l - 3 . 85938 , - 11 . 375 v 11 . 375 z m 22 . 00955 , - 3 . 109375 1 . 6875 , 0 . 203125 q - 0 . 40625 , 1 . 484375 - 1 . 48437 , 2 . 3125 - 1 . 07813 , 0 . 8125 - 2 . 76563 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 296875 - 1 . 23437 , - 1 . 3125 - 1 . 23437 , - 3 . 671875 0 , - 2 . 453125 1 . 25 , - 3 . 796875 1 . 26562 , - 1 . 34375 3 . 26562 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 328125 1 . 23438 , 1 . 3125 1 . 23438 , 3 . 703125 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 453125 0 . 8125 , 0 . 84375 2 . 01562 , 0 . 84375 0 . 90625 , 0 1 . 54688 , - 0 . 46875 0 . 64062 , - 0 . 484375 1 . 01562 , - 1 . 515625 z m - 5 . 39062 , - 2 . 65625 h 5 . 40625 q - 0 . 10938 , - 1 . 21875 - 0 . 625 , - 1 . 828125 - 0 . 78125 , - 0 . 953125 - 2 . 03125 , - 0 . 953125 - 1 . 125 , 0 - 1 . 90625 , 0 . 765625 - 0 . 76563 , 0 . 75 - 0 . 84375 , 2 . 015625 z m 9 . 14132 , 5 . 765625 v - 9 . 671875 h 1 . 46875 v 1 . 359375 q 0 . 45313 , - 0 . 71875 1 . 20313 , - 1 . 140625 0 . 76562 , - 0 . 4375 1 . 71875 , - 0 . 4375 1 . 07812 , 0 1 . 76562 , 0 . 453125 0 . 6875 , 0 . 4375 0 . 96875 , 1 . 234375 1 . 15625 , - 1 . 6875 2 . 98438 , - 1 . 6875 1 . 45312 , 0 2 . 21875 , 0 . 796875 0 . 78125 , 0 . 796875 0 . 78125 , 2 . 453125 v 6 . 640625 h - 1 . 64063 v - 6 . 09375 q 0 , - 0 . 984375 - 0 . 15625 , - 1 . 40625 - 0 . 15625 , - 0 . 4375 - 0 . 57812 , - 0 . 703125 - 0 . 42188 , - 0 . 265625 - 0 . 98438 , - 0 . 265625 - 1 . 01562 , 0 - 1 . 6875 , 0 . 6875 - 0 . 67187 , 0 . 671875 - 0 . 67187 , 2 . 15625 v 5 . 625 h - 1 . 64063 v - 6 . 28125 q 0 , - 1 . 09375 - 0 . 40625 , - 1 . 640625 - 0 . 40625 , - 0 . 546875 - 1 . 3125 , - 0 . 546875 - 0 . 6875 , 0 - 1 . 28125 , 0 . 359375 - 0 . 59375 , 0 . 359375 - 0 . 85937 , 1 . 0625 - 0 . 25 , 0 . 703125 - 0 . 25 , 2 . 03125 v 5 . 015625 z m 14 . 93143 , - 4 . 84375 q 0 , - 2 . 6875 1 . 48437 , - 3 . 96875 1 . 25 , - 1 . 078125 3 . 04688 , - 1 . 078125 2 , 0 3 . 26562 , 1 . 3125 1 . 26563 , 1 . 296875 1 . 26563 , 3 . 609375 0 , 1 . 859375 - 0 . 5625 , 2 . 9375 - 0 . 5625 , 1 . 0625 - 1 . 64063 , 1 . 65625 - 1 . 0625 , 0 . 59375 - 2 . 32812 , 0 . 59375 - 2 . 03125 , 0 - 3 . 28125 , - 1 . 296875 - 1 . 25 , - 1 . 3125 - 1 . 25 , - 3 . 765625 z m 1 . 6875 , 0 q 0 , 1 . 859375 0 . 79687 , 2 . 796875 0 . 8125 , 0 . 921875 2 . 04688 , 0 . 921875 1 . 21875 , 0 2 . 03125 , - 0 . 921875 0 . 8125 , - 0 . 9375 0 . 8125 , - 2 . 84375 0 , - 1 . 796875 - 0 . 8125 , - 2 . 71875 - 0 . 8125 , - 0 . 921875 - 2 . 03125 , - 0 . 921875 - 1 . 23438 , 0 - 2 . 04688 , 0 . 921875 - 0 . 79687 , 0 . 90625 - 0 . 79687 , 2 . 765625 z m 9 . 28198 , 4 . 84375 v - 9 . 671875 h 1 . 46875 v 1 . 46875 q 0 . 5625 , - 1 . 03125 1 . 03125 , - 1 . 359375 0 . 48438 , - 0 . 328125 1 . 0625 , - 0 . 328125 0 . 82813 , 0 1 . 6875 , 0 . 53125 l - 0 . 5625 , 1 . 515625 q - 0 . 60937 , - 0 . 359375 - 1 . 20312 , - 0 . 359375 - 0 . 54688 , 0 - 0 . 96875 , 0 . 328125 - 0 . 42188 , 0 . 328125 - 0 . 60938 , 0 . 890625 - 0 . 28125 , 0 . 875 - 0 . 28125 , 1 . 921875 v 5 . 0625 z m 6 . 15018 , 3 . 71875 - 0 . 1875 , - 1 . 53125 q 0 . 54687 , 0 . 140625 0 . 9375 , 0 . 140625 0 . 54687 , 0 0 . 875 , - 0 . 1875 0 . 32812 , - 0 . 171875 0 . 54687 , - 0 . 5 0 . 15625 , - 0 . 25 0 . 5 , - 1 . 21875 0 . 0469 , - 0 . 140625 0 . 14063 , - 0 . 40625 l - 3 . 67188 , - 9 . 6875 h 1 . 76563 l 2 . 01562 , 5 . 59375 q 0 . 39063 , 1 . 078125 0 . 70313 , 2 . 25 0 . 28125 , - 1 . 125 0 . 67187 , - 2 . 203125 l 2 . 07813 , - 5 . 640625 h 1 . 64062 l - 3 . 6875 , 9 . 828125 q - 0 . 59375 , 1 . 609375 - 0 . 92187 , 2 . 203125 - 0 . 4375 , 0 . 8125 - 1 , 1 . 1875 - 0 . 5625 , 0 . 375 - 1 . 34375 , 0 . 375 - 0 . 48438 , 0 - 1 . 0625 , - 0 . 203125 z m 14 . 19891 , - 8 . 015625 1 . 65625 , - 0 . 140625 q 0 . 125 , 1 0 . 54688 , 1 . 640625 0 . 4375 , 0 . 640625 1 . 34375 , 1 . 046875 0 . 92187 , 0 . 390625 2 . 0625 , 0 . 390625 1 , 0 1 . 78125 , - 0 . 296875 0 . 78125 , - 0 . 296875 1 . 15625 , - 0 . 8125 0 . 375 , - 0 . 53125 0 . 375 , - 1 . 15625 0 , - 0 . 625 - 0 . 375 , - 1 . 09375 - 0 . 35938 , - 0 . 46875 - 1 . 1875 , - 0 . 796875 - 0 . 54688 , - 0 . 203125 - 2 . 39063 , - 0 . 640625 - 1 . 82812 , - 0 . 453125 - 2 . 5625 , - 0 . 84375 - 0 . 96875 , - 0 . 5 - 1 . 4375 , - 1 . 234375 - 0 . 46875 , - 0 . 75 - 0 . 46875 , - 1 . 671875 0 , - 1 0 . 57813 , - 1 . 875 0 . 57812 , - 0 . 890625 1 . 67187 , - 1 . 34375 1 . 10938 , - 0 . 453125 2 . 45313 , - 0 . 453125 1 . 48437 , 0 2 . 60937 , 0 . 484375 1 . 14063 , 0 . 46875 1 . 75 , 1 . 40625 0 . 60938 , 0 . 921875 0 . 65625 , 2 . 09375 l - 1 . 6875 , 0 . 125 q - 0 . 14062 , - 1 . 265625 - 0 . 9375 , - 1 . 90625 - 0 . 78125 , - 0 . 65625 - 2 . 3125 , - 0 . 65625 - 1 . 60937 , 0 - 2 . 34375 , 0 . 59375 - 0 . 73437 , 0 . 59375 - 0 . 73437 , 1 . 421875 0 , 0 . 71875 0 . 53125 , 1 . 171875 0 . 5 , 0 . 46875 2 . 65625 , 0 . 96875 2 . 15625 , 0 . 484375 2 . 95312 , 0 . 84375 1 . 17188 , 0 . 53125 1 . 71875 , 1 . 359375 0 . 5625 , 0 . 828125 0 . 5625 , 1 . 90625 0 , 1 . 0625 - 0 . 60937 , 2 . 015625 - 0 . 60938 , 0 . 9375 - 1 . 75 , 1 . 46875 - 1 . 14063 , 0 . 515625 - 2 . 57813 , 0 . 515625 - 1 . 8125 , 0 - 3 . 04687 , - 0 . 53125 - 1 . 21875 , - 0 . 53125 - 1 . 92188 , - 1 . 59375 - 0 . 6875 , - 1 . 0625 - 0 . 71875 , - 2 . 40625 z m 12 . 8342 , 8 v - 13 . 375 h 1 . 48438 v 1 . 25 q 0 . 53125 , - 0 . 734375 1 . 1875 , - 1 . 09375 0 . 67187 , - 0 . 375 1 . 625 , - 0 . 375 1 . 23437 , 0 2 . 17187 , 0 . 640625 0 . 95313 , 0 . 625 1 . 4375 , 1 . 796875 0 . 48438 , 1 . 15625 0 . 48438 , 2 . 546875 0 , 1 . 484375 - 0 . 53125 , 2 . 671875 - 0 . 53125 , 1 . 1875 - 1 . 54688 , 1 . 828125 - 1 . 01562 , 0 . 625 - 2 . 14062 , 0 . 625 - 0 . 8125 , 0 - 1 . 46875 , - 0 . 34375 - 0 . 65625 , - 0 . 34375 - 1 . 0625 , - 0 . 875 v 4 . 703125 z m 1 . 48438 , - 8 . 484375 q 0 , 1 . 859375 0 . 75 , 2 . 765625 0 . 76562 , 0 . 890625 1 . 82812 , 0 . 890625 1 . 09375 , 0 1 . 875 , - 0 . 921875 0 . 78125 , - 0 . 9375 0 . 78125 , - 2 . 875 0 , - 1 . 84375 - 0 . 76562 , - 2 . 765625 - 0 . 75 , - 0 . 921875 - 1 . 8125 , - 0 . 921875 - 1 . 04688 , 0 - 1 . 85938 , 0 . 984375 - 0 . 79687 , 0 . 96875 - 0 . 79687 , 2 . 84375 z m 15 . 20385 , 3 . 59375 q - 0 . 92187 , 0 . 765625 - 1 . 76562 , 1 . 09375 - 0 . 82813 , 0 . 3125 - 1 . 79688 , 0 . 3125 - 1 . 59375 , 0 - 2 . 45312 , - 0 . 78125 - 0 . 85938 , - 0 . 78125 - 0 . 85938 , - 1 . 984375 0 , - 0 . 71875 0 . 32813 , - 1 . 296875 0 . 32812 , - 0 . 59375 0 . 84375 , - 0 . 9375 0 . 53125 , - 0 . 359375 1 . 1875 , - 0 . 546875 0 . 46875 , - 0 . 125 1 . 45312 , - 0 . 25 1 . 98438 , - 0 . 234375 2 . 92188 , - 0 . 5625 0 . 0156 , - 0 . 34375 0 . 0156 , - 0 . 421875 0 , - 1 - 0 . 46875 , - 1 . 421875 - 0 . 625 , - 0 . 546875 - 1 . 875 , - 0 . 546875 - 1 . 15625 , 0 - 1 . 70312 , 0 . 40625 - 0 . 54688 , 0 . 40625 - 0 . 8125 , 1 . 421875 l - 1 . 60938 , - 0 . 21875 q 0 . 21875 , - 1 . 015625 0 . 71875 , - 1 . 640625 0 . 5 , - 0 . 640625 1 . 45313 , - 0 . 984375 0 . 95312 , - 0 . 34375 2 . 1875 , - 0 . 34375 1 . 25 , 0 2 . 01562 , 0 . 296875 0 . 78125 , 0 . 28125 1 . 14063 , 0 . 734375 0 . 375 , 0 . 4375 0 . 51562 , 1 . 109375 0 . 0781 , 0 . 421875 0 . 0781 , 1 . 515625 v 2 . 1875 q 0 , 2 . 28125 0 . 10937 , 2 . 890625 0 . 10938 , 0 . 59375 0 . 40625 , 1 . 15625 h - 1 . 70312 q - 0 . 26563 , - 0 . 515625 - 0 . 32813 , - 1 . 1875 z m - 0 . 14062 , - 3 . 671875 q - 0 . 89063 , 0 . 375 - 2 . 67188 , 0 . 625 - 1 . 01562 , 0 . 140625 - 1 . 4375 , 0 . 328125 - 0 . 42187 , 0 . 1875 - 0 . 65625 , 0 . 53125 - 0 . 21875 , 0 . 34375 - 0 . 21875 , 0 . 78125 0 , 0 . 65625 0 . 5 , 1 . 09375 0 . 5 , 0 . 4375 1 . 45313 , 0 . 4375 0 . 9375 , 0 1 . 67187 , - 0 . 40625 0 . 75 , - 0 . 421875 1 . 09375 , - 1 . 140625 0 . 26563 , - 0 . 5625 0 . 26563 , - 1 . 640625 z m 10 . 51632 , 1 . 3125 1 . 60938 , 0 . 21875 q - 0 . 26563 , 1 . 65625 - 1 . 35938 , 2 . 609375 - 1 . 07812 , 0 . 9375 - 2 . 67187 , 0 . 9375 - 1 . 98438 , 0 - 3 . 1875 , - 1 . 296875 - 1 . 20313 , - 1 . 296875 - 1 . 20313 , - 3 . 71875 0 , - 1 . 578125 0 . 51563 , - 2 . 75 0 . 51562 , - 1 . 171875 1 . 57812 , - 1 . 75 1 . 0625 , - 0 . 59375 2 . 3125 , - 0 . 59375 1 . 57813 , 0 2 . 57813 , 0 . 796875 1 , 0 . 796875 1 . 28125 , 2 . 265625 l - 1 . 59375 , 0 . 234375 q - 0 . 23438 , - 0 . 96875 - 0 . 8125 , - 1 . 453125 - 0 . 57813 , - 0 . 5 - 1 . 39063 , - 0 . 5 - 1 . 23437 , 0 - 2 . 01562 , 0 . 890625 - 0 . 78125 , 0 . 890625 - 0 . 78125 , 2 . 8125 0 , 1 . 953125 0 . 75 , 2 . 84375 0 . 75 , 0 . 875 1 . 95312 , 0 . 875 0 . 96875 , 0 1 . 60938 , - 0 . 59375 0 . 65625 , - 0 . 59375 0 . 82812 , - 1 . 828125 z m 9 . 64063 , 0 . 4375 1 . 6875 , 0 . 203125 q - 0 . 40625 , 1 . 484375 - 1 . 48438 , 2 . 3125 - 1 . 07812 , 0 . 8125 - 2 . 76562 , 0 . 8125 - 2 . 125 , 0 - 3 . 375 , - 1 . 296875 - 1 . 23438 , - 1 . 3125 - 1 . 23438 , - 3 . 671875 0 , - 2 . 453125 1 . 25 , - 3 . 796875 1 . 26563 , - 1 . 34375 3 . 26563 , - 1 . 34375 1 . 9375 , 0 3 . 15625 , 1 . 328125 1 . 23437 , 1 . 3125 1 . 23437 , 3 . 703125 0 , 0 . 15625 0 , 0 . 4375 h - 7 . 21875 q 0 . 0937 , 1 . 59375 0 . 90625 , 2 . 453125 0 . 8125 , 0 . 84375 2 . 01563 , 0 . 84375 0 . 90625 , 0 1 . 54687 , - 0 . 46875 0 . 64063 , - 0 . 484375 1 . 01563 , - 1 . 515625 z m - 5 . 39063 , - 2 . 65625 h 5 . 40625 q - 0 . 10937 , - 1 . 21875 - 0 . 625 , - 1 . 828125 - 0 . 78125 , - 0 . 953125 - 2 . 03125 , - 0 . 953125 - 1 . 125 , 0 - 1 . 90625 , 0 . 765625 - 0 . 76562 , 0 . 75 - 0 . 84375 , 2 . 015625 z m 14 . 1059 , - 0 . 07813 v - 1 . 53125 l 8 . 84375 , - 3 . 734375 v 1 . 640625 l - 7 . 01562 , 2 . 875 7 . 01562 , 2 . 90625 v 1 . 625 z m 10 . 89496 , 2 . 75 1 . 57812 , - 0 . 140625 q 0 . 20313 , 1 . 109375 0 . 76563 , 1 . 609375 0 . 5625 , 0 . 5 1 . 45312 , 0 . 5 0 . 75 , 0 1 . 3125 , - 0 . 34375 0 . 57813 , - 0 . 34375 0 . 9375 , - 0 . 921875 0 . 375 , - 0 . 578125 0 . 60938 , - 1 . 5625 0 . 25 , - 0 . 984375 0 . 25 , - 2 0 , - 0 . 109375 0 , - 0 . 328125 - 0 . 5 , 0 . 78125 - 1 . 35938 , 1 . 265625 - 0 . 84375 , 0 . 484375 - 1 . 82812 , 0 . 484375 - 1 . 67188 , 0 - 2 . 8125 , - 1 . 203125 - 1 . 14063 , - 1 . 203125 - 1 . 14063 , - 3 . 171875 0 , - 2 . 03125 1 . 1875 , - 3 . 265625 1 . 20313 , - 1 . 234375 3 , - 1 . 234375 1 . 3125 , 0 2 . 39063 , 0 . 703125 1 . 07812 , 0 . 703125 1 . 64062 , 2 0 . 5625 , 1 . 296875 0 . 5625 , 3 . 75 0 , 2 . 5625 - 0 . 5625 , 4 . 078125 - 0 . 5625 , 1 . 515625 - 1 . 65625 , 2 . 3125 - 1 . 09375 , 0 . 796875 - 2 . 57812 , 0 . 796875 - 1 . 5625 , 0 - 2 . 5625 , - 0 . 875 - 0 . 98438 , - 0 . 875 - 1 . 1875 , - 2 . 453125 z m 6 . 71875 , - 5 . 890625 q 0 , - 1 . 40625 - 0 . 75 , - 2 . 234375 - 0 . 75 , - 0 . 828125 - 1 . 8125 , - 0 . 828125 - 1 . 09375 , 0 - 1 . 90625 , 0 . 890625 - 0 . 8125 , 0 . 890625 - 0 . 8125 , 2 . 3125 0 , 1 . 28125 0 . 76562 , 2 . 078125 0 . 78125 , 0 . 796875 1 . 90625 , 0 . 796875 1 . 14063 , 0 1 . 875 , - 0 . 796875 0 . 73438 , - 0 . 796875 0 . 73438 , - 2 . 21875 z m 2 . 78198 , 8 . 984375 3 . 53125 , - 5 . 03125 - 3 . 26562 , - 4 . 640625 h 2 . 04687 l 1 . 48438 , 2 . 265625 q 0 . 42187 , 0 . 640625 0 . 67187 , 1 . 078125 0 . 40625 , - 0 . 59375 0 . 73438 , - 1 . 0625 l 1 . 64062 , - 2 . 28125 h 1 . 95313 l - 3 . 34375 , 4 . 546875 3 . 59375 , 5 . 125 h - 2 . 01563 l - 1 . 98437 , - 3 - 0 . 51563 , - 0 . 8125 - 2 . 54687 , 3 . 8125 z m 10 . 8125 , 0 v - 8 . 40625 h - 1 . 45312 V 15 . 53158 h 1 . 45312 v - 1 . 03125 q 0 , - 0 . 96875 0 . 17188 , - 1 . 453125 0 . 23437 , - 0 . 640625 0 . 82812 , - 1 . 03125 0 . 59375 , - 0 . 390625 1 . 67188 , - 0 . 390625 0 . 6875 , 0 1 . 53125 , 0 . 15625 l - 0 . 25 , 1 . 4375 q - 0 . 5 , - 0 . 09375 - 0 . 95313 , - 0 . 09375 - 0 . 75 , 0 - 1 . 0625 , 0 . 328125 - 0 . 3125 , 0 . 3125 - 0 . 3125 , 1 . 1875 v 0 . 890625 h 1 . 89063 v 1 . 265625 h - 1 . 89063 v 8 . 40625 z m 4 . 33954 , - 3 . 53125 1 . 64062 , - 0 . 21875 q 0 . 28125 , 1 . 40625 0 . 95313 , 2 . 015625 0 . 6875 , 0 . 609375 1 . 65625 , 0 . 609375 1 . 15625 , 0 1 . 95312 , - 0 . 796875 0 . 79688 , - 0 . 796875 0 . 79688 , - 1 . 984375 0 , - 1 . 125 - 0 . 73438 , - 1 . 859375 - 0 . 73437 , - 0 . 734375 - 1 . 875 , - 0 . 734375 - 0 . 46875 , 0 - 1 . 15625 , 0 . 171875 l 0 . 1875 , - 1 . 4375 q 0 . 15625 , 0 . 01563 0 . 26563 , 0 . 01563 1 . 04687 , 0 1 . 875 , - 0 . 546875 0 . 84375 , - 0 . 546875 0 . 84375 , - 1 . 671875 0 , - 0 . 90625 - 0 . 60938 , - 1 . 5 - 0 . 60937 , - 0 . 59375 - 1 . 57812 , - 0 . 59375 - 0 . 95313 , 0 - 1 . 59375 , 0 . 609375 - 0 . 64063 , 0 . 59375 - 0 . 8125 , 1 . 796875 l - 1 . 64063 , - 0 . 296875 q 0 . 29688 , - 1 . 640625 1 . 35938 , - 2 . 546875 1 . 0625 , - 0 . 90625 2 . 65625 , - 0 . 90625 1 . 09375 , 0 2 , 0 . 46875 0 . 92187 , 0 . 46875 1 . 40625 , 1 . 28125 0 . 5 , 0 . 8125 0 . 5 , 1 . 71875 0 , 0 . 859375 - 0 . 46875 , 1 . 578125 - 0 . 46875 , 0 . 703125 - 1 . 375 , 1 . 125 1 . 1875 , 0 . 28125 1 . 84375 , 1 . 140625 0 . 65625 , 0 . 859375 0 . 65625 , 2 . 15625 0 , 1 . 734375 - 1 . 28125 , 2 . 953125 - 1 . 26563 , 1 . 21875 - 3 . 21875 , 1 . 21875 - 1 . 76563 , 0 - 2 . 92188 , - 1 . 046875 - 1 . 15625 , - 1 . 046875 - 1 . 32812 , - 2 . 71875 z m 18 . 98511 , 1 . 953125 v 1 . 578125 h - 8 . 82813 q - 0 . 0156 , - 0 . 59375 0 . 1875 , - 1 . 140625 0 . 34375 , - 0 . 90625 1 . 07813 , - 1 . 78125 0 . 75 , - 0 . 875 2 . 15625 , - 2 . 015625 2 . 17187 , - 1 . 78125 2 . 9375 , - 2 . 828125 0 . 76562 , - 1 . 046875 0 . 76562 , - 1 . 96875 0 , - 0 . 984375 - 0 . 70312 , - 1 . 640625 - 0 . 6875 , - 0 . 671875 - 1 . 8125 , - 0 . 671875 - 1 . 1875 , 0 - 1 . 90625 , 0 . 71875 - 0 . 70313 , 0 . 703125 - 0 . 70313 , 1 . 953125 l - 1 . 6875 , - 0 . 171875 q 0 . 17188 , - 1 . 890625 1 . 29688 , - 2 . 875 1 . 14062 , - 0 . 984375 3 . 03125 , - 0 . 984375 1 . 92187 , 0 3 . 04687 , 1 . 0625 1 . 125 , 1 . 0625 1 . 125 , 2 . 640625 0 , 0 . 796875 - 0 . 32812 , 1 . 578125 - 0 . 32813 , 0 . 78125 - 1 . 09375 , 1 . 640625 - 0 . 75 , 0 . 84375 - 2 . 53125 , 2 . 34375 - 1 . 46875 , 1 . 234375 - 1 . 89063 , 1 . 6875 - 0 . 42187 , 0 . 4375 - 0 . 6875 , 0 . 875 z m 10 . 84448 , - 4 . 265625 - 8 . 84375 , 3 . 78125 v - 1 . 625 l 7 . 01562 , - 2 . 90625 - 7 . 01562 , - 2 . 875 V 14 . 09408 l 8 . 84375 , 3 . 734375 z " / > <nl> + < / svg > <nl> new file mode 100644 <nl> index 0000000000000 . . 94d7b623381b3 <nl> mmm / dev / null <nl> ppp b / g3doc / includes / style . css <nl> <nl> + . mlir { <nl> + background - color : # eef ; <nl> + } <nl> + <nl> + . ebnf { <nl> + background - color : # ffe ; <nl> + } <nl>
|
Add MLIR specification .
|
tensorflow/tensorflow
|
6cd116f32942a276da91fd1b9bbe0a5560c06757
|
2019-03-29T20:37:13Z
|
mmm a / drivers / ruby / union_test . rb <nl> ppp b / drivers / ruby / union_test . rb <nl> <nl> <nl> $ streams = [ <nl> $ t , <nl> - $ t . between ( 10 , 100 , index : ' id ' ) , <nl> - r ( [ $ t . get ( 0 ) ] ) , <nl> - r ( [ 1 , 2 , 3 , 4 ] ) <nl> + $ t . between ( 0 , 100 , index : ' id ' ) , <nl> + # r ( [ $ t . get ( 0 ) ] ) , <nl> + # r ( [ 1 , 2 , 3 , 4 ] ) <nl> ] <nl> <nl> $ infstreams = [ <nl> def nested_union ( streams ) <nl> $ t . delete . run <nl> $ t . insert ( ( 0 . . . 100 ) . map { | i | { id : i } } ) . run <nl> <nl> - $ eager_pop = $ streams * 2 + $ empty_streams * 2 + $ streams <nl> + $ eager_pop = $ streams <nl> $ eager_union_1 = flat_union ( $ eager_pop ) <nl> $ eager_union_2 = nested_union ( $ eager_pop ) <nl> <nl> def mangle stream <nl> stream . to_a . sort { | x , y | cmp ( x , y ) } <nl> end <nl> <nl> - timeout ( 60 ) { <nl> - $ eager_canon = [ ] <nl> - $ eager_pop . each { | pop | <nl> - $ eager_canon + = pop . run . to_a <nl> + ( 0 . . . 100 ) . each { <nl> + timeout ( 60 ) { <nl> + $ eager_canon = [ ] <nl> + $ eager_pop . each { | pop | <nl> + $ eager_canon + = pop . run . to_a <nl> + } <nl> + $ eager_canon = mangle ( $ eager_canon ) <nl> + $ eager_res1 = mangle ( $ eager_union_1 . run ) <nl> + assert { $ eager_res1 = = $ eager_canon } <nl> + # $ eager_res2 = mangle ( $ eager_union_2 . run ) <nl> + # assert { $ eager_res2 = = $ eager_canon } <nl> } <nl> - $ eager_canon = mangle ( $ eager_canon ) <nl> - $ eager_res1 = mangle ( $ eager_union_1 . run ) <nl> - assert { $ eager_res1 = = $ eager_canon } <nl> - $ eager_res2 = mangle ( $ eager_union_2 . run ) <nl> - assert { $ eager_res2 = = $ eager_canon } <nl> } <nl> mmm a / src / rdb_protocol / datum_stream . cc <nl> ppp b / src / rdb_protocol / datum_stream . cc <nl> datum_t union_datum_stream_t : : as_array ( env_t * env ) { <nl> } <nl> <nl> bool union_datum_stream_t : : is_exhausted ( ) const { <nl> - for ( auto it = streams . begin ( ) ; it ! = streams . end ( ) ; + + it ) { <nl> - if ( ! ( * it ) - > is_exhausted ( ) ) { <nl> - return false ; <nl> - } <nl> - } <nl> - return batch_cache_exhausted ( ) ; <nl> + return batch_cache_exhausted ( ) <nl> + & & active = = 0 <nl> + & & queue . size ( ) = = 0 ; <nl> } <nl> feed_type_t union_datum_stream_t : : cfeed_type ( ) const { <nl> return union_type ; <nl> void union_datum_stream_t : : coro_cb ( size_t i ) THROWS_NOTHING { <nl> signal_t * interruptor = lock . get_drain_signal ( ) ; <nl> bool is_first = true ; <nl> try { <nl> - for ( ; ; ) { <nl> + while ( ! stream - > is_exhausted ( ) ) { <nl> cond_t notify ; <nl> notify_conds [ i ] = & notify ; <nl> wait_interruptible ( & notify , interruptor ) ; <nl> void union_datum_stream_t : : coro_cb ( size_t i ) THROWS_NOTHING { <nl> = stream - > next_batch ( coro_info - > env . get ( ) , bs ) ; <nl> if ( batch . size ( ) = = 0 ) { <nl> if ( stream - > cfeed_type ( ) = = feed_type_t : : not_feed ) { <nl> + r_sanity_check ( stream - > is_exhausted ( ) ) ; <nl> break ; <nl> } else { <nl> r_sanity_check ( <nl> union_datum_stream_t : : next_batch_impl ( env_t * env , const batchspec_t & batchspec ) <nl> / / The client is already doing prefetching , so we don ' t want to do <nl> / / * double * prefetching by prefetching on the server as well . <nl> while ( queue . size ( ) = = 0 ) { <nl> - if ( active = = 0 ) return std : : vector < datum_t > ( ) ; <nl> if ( exc ) std : : rethrow_exception ( exc ) ; <nl> + if ( active = = 0 ) { <nl> + return std : : vector < datum_t > ( ) ; <nl> + } <nl> { <nl> ASSERT_NO_CORO_WAITING ; <nl> if ( ! coro_info . has ( ) ) { <nl> union_datum_stream_t : : next_batch_impl ( env_t * env , const batchspec_t & batchspec ) <nl> } <nl> } <nl> r_sanity_check ( outstanding_notifications = = 0 ) ; <nl> - all_notified = make_scoped < cond_t > ( ) ; <nl> data_available = make_scoped < cond_t > ( ) ; <nl> for ( size_t i = 0 ; i < notify_conds . size ( ) ; + + i ) { <nl> if ( notify_conds [ i ] ! = NULL ) { <nl> union_datum_stream_t : : next_batch_impl ( env_t * env , const batchspec_t & batchspec ) <nl> notify_conds [ i ] = NULL ; <nl> } <nl> } <nl> + if ( outstanding_notifications ! = 0 ) { <nl> + all_notified = make_scoped < cond_t > ( ) ; <nl> + } else { <nl> + all_notified . reset ( ) ; <nl> + } <nl> + } <nl> + if ( all_notified . has ( ) ) { <nl> + wait_interruptible ( all_notified . get ( ) , & interruptor ) ; <nl> } <nl> - wait_interruptible ( all_notified . get ( ) , & interruptor ) ; <nl> r_sanity_check ( outstanding_notifications = = 0 ) ; <nl> wait_interruptible ( data_available . get ( ) , & interruptor ) ; <nl> } <nl>
|
Fixed exausted stream logic .
|
rethinkdb/rethinkdb
|
5f44fdb3826d591f6c5c59a199b65a6e685223be
|
2015-02-16T22:03:35Z
|
mmm a / hphp / runtime / ext_zend_compat / ezc_test / ext_ezc_test . php <nl> ppp b / hphp / runtime / ext_zend_compat / ezc_test / ext_ezc_test . php <nl> function ezc_hash_get ( mixed $ table , string $ key ) : mixed ; <nl> < < __Native ( " ZendCompat " ) > > <nl> function ezc_hash_append ( mixed $ table , string $ value ) : mixed ; <nl> <nl> + / * Set an element of an array by modifying the data pointer returned by <nl> + * zend_hash_find ( ) <nl> + * / <nl> + < < __Native ( " ZendCompat " ) > > <nl> + function ezc_array_val_set ( array $ a , mixed $ key , mixed $ value ) : mixed ; <nl> + <nl> < < __NativeData ( " ZendCompat " ) > > class EzcTestCloneable { } <nl> < < __NativeData ( " ZendCompat " ) > > class EzcTestUncloneable1 { } <nl> < < __NativeData ( " ZendCompat " ) > > class EzcTestUncloneable2 { } <nl> mmm a / hphp / runtime / ext_zend_compat / ezc_test / ezc_test . cpp <nl> ppp b / hphp / runtime / ext_zend_compat / ezc_test / ezc_test . cpp <nl> static void ezc_hash_element_dtor ( void * data ) / * { { { * / <nl> } <nl> / * } } } * / <nl> <nl> + / * { { { proto void ezc_array_val_set ( array a , mixed key , mixed value ) <nl> + * Set an element of an array passed by value , by modifying the data pointer <nl> + * returned by zend_hash_find ( ) . This should theoretically have no effect <nl> + * on the caller . <nl> + * / <nl> + PHP_FUNCTION ( ezc_array_val_set ) <nl> + { <nl> + zval * array , * key , * value ; <nl> + zval * * data ; <nl> + int found ; <nl> + <nl> + if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , <nl> + " azz " , & array , & key , & value ) = = FAILURE ) <nl> + { <nl> + return ; <nl> + } <nl> + <nl> + if ( Z_TYPE_P ( key ) = = IS_LONG ) { <nl> + found = zend_hash_index_find ( <nl> + Z_ARRVAL_P ( array ) , Z_LVAL_P ( key ) , ( void * * ) & data ) ; <nl> + } else if ( Z_TYPE_P ( key ) = = IS_STRING ) { <nl> + found = zend_hash_find ( <nl> + Z_ARRVAL_P ( array ) , Z_STRVAL_P ( key ) , Z_STRLEN_P ( key ) + 1 , ( void * * ) & data ) ; <nl> + } else { <nl> + php_error_docref ( NULL TSRMLS_CC , E_WARNING , " array key must be either integer or string " ) ; <nl> + return ; <nl> + } <nl> + if ( found = = FAILURE ) { <nl> + php_error_docref ( NULL TSRMLS_CC , E_WARNING , " array key must exist " ) ; <nl> + return ; <nl> + } <nl> + zval_ptr_dtor ( data ) ; <nl> + Z_ADDREF_P ( value ) ; <nl> + * data = value ; <nl> + } <nl> + / * } } } * / <nl> + <nl> / * { { { EzcTestCloneable_create_object * / <nl> static zend_object_value EzcTestCloneable_create_object ( zend_class_entry * ce TSRMLS_DC ) <nl> { <nl> ZEND_BEGIN_ARG_INFO ( arginfo_ezc_hash_append , 0 ) <nl> ZEND_ARG_INFO ( 0 , value ) <nl> ZEND_END_ARG_INFO ( ) <nl> <nl> + ZEND_BEGIN_ARG_INFO ( arginfo_ezc_array_val_set , 0 ) <nl> + ZEND_ARG_INFO ( 0 , a ) <nl> + ZEND_ARG_INFO ( 0 , key ) <nl> + ZEND_ARG_INFO ( 0 , value ) <nl> + ZEND_END_ARG_INFO ( ) <nl> / * } } } * / <nl> <nl> / * { { { ezc_test_functions [ ] <nl> const zend_function_entry ezc_test_functions [ ] = { <nl> PHP_FE ( ezc_hash_set , arginfo_ezc_hash_set ) <nl> PHP_FE ( ezc_hash_get , arginfo_ezc_hash_get ) <nl> PHP_FE ( ezc_hash_append , arginfo_ezc_hash_append ) <nl> + PHP_FE ( ezc_array_val_set , arginfo_ezc_array_val_set ) <nl> PHP_FE_END <nl> } ; <nl> / * } } } * / <nl> mmm a / hphp / runtime / ext_zend_compat / hhvm / zend - wrap - func . cpp <nl> ppp b / hphp / runtime / ext_zend_compat / hhvm / zend - wrap - func . cpp <nl> void zBoxAndProxy ( TypedValue * arg ) { <nl> tvBox ( arg ) ; <nl> } <nl> auto inner = arg - > m_data . pref - > tv ( ) ; <nl> - if ( inner - > m_type = = KindOfArray ) { <nl> - inner - > m_data . parr = ProxyArray : : Make ( inner - > m_data . parr ) ; <nl> + if ( inner - > m_type = = KindOfArray & & ! inner - > m_data . parr - > isProxyArray ( ) ) { <nl> + ArrayData * inner_arr = inner - > m_data . parr ; <nl> + if ( inner_arr - > isStatic ( ) | | inner_arr - > hasMultipleRefs ( ) ) { <nl> + ArrayData * tmp = inner_arr - > copy ( ) ; <nl> + inner_arr - > decRefAndRelease ( ) ; <nl> + inner_arr = tmp ; <nl> + inner_arr - > incRefCount ( ) ; <nl> + } <nl> + inner - > m_data . parr = ProxyArray : : Make ( inner_arr ) ; <nl> } <nl> } <nl> <nl> mmm a / hphp / runtime / ext_zend_compat / php - src / Zend / zend_operators . h <nl> ppp b / hphp / runtime / ext_zend_compat / php - src / Zend / zend_operators . h <nl> inline const TypedValue & zval_follow_ref ( const zval & z ) { <nl> * / <nl> class ZArrVal { <nl> private : <nl> - HPHP : : TypedValue * m_tv ; <nl> + TypedValue * m_tv ; <nl> public : <nl> - explicit ZArrVal ( HPHP : : TypedValue * tv ) : m_tv ( tv ) { } <nl> + explicit ZArrVal ( TypedValue * tv ) : m_tv ( tv ) { } <nl> void cowCheck ( ) { <nl> - if ( m_tv - > m_data . parr - > hasMultipleRefs ( ) ) { <nl> - HPHP : : ArrayData * a = m_tv - > m_data . parr - > copy ( ) ; <nl> - a - > incRefCount ( ) ; <nl> + ArrayData * ad = m_tv - > m_data . parr ; <nl> + if ( ad - > isStatic ( ) | | ad - > hasMultipleRefs ( ) ) { <nl> + ad = ad - > copy ( ) ; <nl> + ad - > incRefCount ( ) ; <nl> + / / copy ( ) causes an array to be unproxied , so we normally need <nl> + / / to reproxy it <nl> + if ( ! ad - > isProxyArray ( ) ) { <nl> + ad = ProxyArray : : Make ( ad ) ; <nl> + ad - > incRefCount ( ) ; <nl> + } <nl> m_tv - > m_data . parr - > decRefCount ( ) ; <nl> - m_tv - > m_data . parr = a ; <nl> + m_tv - > m_data . parr = ad ; <nl> } <nl> } <nl> / * implicit * / operator HashTable * ( ) { <nl> class ZArrVal { <nl> return getHashTable ( ) ; <nl> } <nl> HashTable * operator & ( ) { <nl> - throw HPHP : : NotImplementedException ( <nl> + throw NotImplementedException ( <nl> " Taking the address of the result of Z_ARRVAL is not " <nl> " supported at present " ) ; <nl> } <nl> mmm a / hphp / runtime / ext_zend_compat / php - src / Zend / zend_variables . cpp <nl> ppp b / hphp / runtime / ext_zend_compat / php - src / Zend / zend_variables . cpp <nl> ZEND_API void _zval_copy_ctor_func ( zval * zvalue ZEND_FILE_LINE_DC ) { <nl> zvalue - > tv ( ) - > m_data . pstr - > incRefCount ( ) ; <nl> zvalue - > tv ( ) - > m_type = HPHP : : KindOfString ; / / not KindOfStaticString anymore <nl> } else if ( zvalue - > tv ( ) - > m_type = = HPHP : : KindOfArray ) { <nl> - zvalue - > tv ( ) - > m_data . parr = zvalue - > tv ( ) - > m_data . parr - > copy ( ) ; <nl> - zvalue - > tv ( ) - > m_data . parr - > incRefCount ( ) ; <nl> + HPHP : : ArrayData * ad = zvalue - > tv ( ) - > m_data . parr - > copy ( ) ; <nl> + ad - > incRefCount ( ) ; <nl> + if ( ! ad - > isProxyArray ( ) ) { <nl> + ad = HPHP : : ProxyArray : : Make ( ad ) ; <nl> + ad - > incRefCount ( ) ; <nl> + } <nl> + zvalue - > tv ( ) - > m_data . parr = ad ; <nl> } else if ( IS_REFCOUNTED_TYPE ( zvalue - > tv ( ) - > m_type ) ) { <nl> zvalue - > tv ( ) - > m_data . pstr - > incRefCount ( ) ; <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . a22e14304c5 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / ext_ezc_test / ezc - array - val - set . php <nl> <nl> + < ? php <nl> + <nl> + function getArray ( ) { <nl> + return array ( 1 , 2 , 3 ) ; <nl> + } <nl> + <nl> + $ a = getArray ( ) ; <nl> + ezc_array_val_set ( $ a , 0 , 2 ) ; <nl> + print implode ( " , " , getArray ( ) ) . " \ n " ; <nl> new file mode 100644 <nl> index 00000000000 . . 2739d724db3 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / ext_ezc_test / ezc - array - val - set . php . expectf <nl> @ @ - 0 , 0 + 1 @ @ <nl> + 1 , 2 , 3 <nl>
|
EZC : fix proxying in zBoxAndProxy ( )
|
facebook/hhvm
|
70bac160578d82843cb3edb7e43517ae18c7635a
|
2014-06-11T20:02:27Z
|
mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> class V8_EXPORT V8 { <nl> * / <nl> static void RemoveMemoryAllocationCallback ( MemoryAllocationCallback callback ) ; <nl> <nl> - / * * <nl> - * Experimental : Runs the Microtask Work Queue until empty <nl> - * <nl> - * Deprecated : Use methods on Isolate instead . <nl> - * / <nl> - static void RunMicrotasks ( Isolate * isolate ) ; <nl> - <nl> - / * * <nl> - * Experimental : Enqueues the callback to the Microtask Work Queue <nl> - * <nl> - * Deprecated : Use methods on Isolate instead . <nl> - * / <nl> - static void EnqueueMicrotask ( Isolate * isolate , Handle < Function > microtask ) ; <nl> - <nl> - / * * <nl> - * Experimental : Controls whether the Microtask Work Queue is automatically <nl> - * run when the script call depth decrements to zero . <nl> - * <nl> - * Deprecated : Use methods on Isolate instead . <nl> - * / <nl> - static void SetAutorunMicrotasks ( Isolate * source , bool autorun ) ; <nl> - <nl> / * * <nl> * Initializes from snapshot if possible . Otherwise , attempts to <nl> * initialize from scratch . This function is called implicitly if <nl> mmm a / src / api . cc <nl> ppp b / src / api . cc <nl> void V8 : : RemoveMemoryAllocationCallback ( MemoryAllocationCallback callback ) { <nl> } <nl> <nl> <nl> - void V8 : : RunMicrotasks ( Isolate * isolate ) { <nl> - isolate - > RunMicrotasks ( ) ; <nl> - } <nl> - <nl> - <nl> - void V8 : : EnqueueMicrotask ( Isolate * isolate , Handle < Function > microtask ) { <nl> - isolate - > EnqueueMicrotask ( microtask ) ; <nl> - } <nl> - <nl> - <nl> - void V8 : : SetAutorunMicrotasks ( Isolate * isolate , bool autorun ) { <nl> - isolate - > SetAutorunMicrotasks ( autorun ) ; <nl> - } <nl> - <nl> - <nl> void V8 : : TerminateExecution ( Isolate * isolate ) { <nl> i : : Isolate * i_isolate = reinterpret_cast < i : : Isolate * > ( isolate ) ; <nl> i_isolate - > stack_guard ( ) - > RequestTerminateExecution ( ) ; <nl>
|
Drop unused static microtask API
|
v8/v8
|
cf8327994db39d1f9ac864cc7a21770a0bf4f948
|
2014-05-12T07:41:06Z
|
mmm a / tensorflow / compiler / tf2xla / kernels / gather_op . cc <nl> ppp b / tensorflow / compiler / tf2xla / kernels / gather_op . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / tf2xla / kernels / gather_op . h " <nl> # include " tensorflow / compiler / tf2xla / kernels / gather_op_helpers . h " <nl> # include " tensorflow / compiler / tf2xla / shape_util . h " <nl> + # include " tensorflow / compiler / tf2xla / type_util . h " <nl> # include " tensorflow / compiler / tf2xla / xla_context . h " <nl> # include " tensorflow / compiler / tf2xla / xla_helpers . h " <nl> # include " tensorflow / compiler / tf2xla / xla_op_kernel . h " <nl> # include " tensorflow / compiler / tf2xla / xla_op_registry . h " <nl> # include " tensorflow / core / framework / kernel_def_builder . h " <nl> + # include " tensorflow / core / framework / op_kernel . h " <nl> <nl> namespace tensorflow { <nl> <nl> xla : : ComputationDataHandle XlaComputeGatherDynamicSlice ( <nl> - const xla : : ComputationDataHandle & input , const TensorShape & input_shape , <nl> - const xla : : ComputationDataHandle & indices , const TensorShape & indices_shape , <nl> - DataType dtype , xla : : ComputationBuilder * builder ) { <nl> + XlaOpKernelContext * context , const xla : : ComputationDataHandle & input , <nl> + const TensorShape & input_shape , const xla : : ComputationDataHandle & indices , <nl> + const TensorShape & indices_shape , DataType dtype , <nl> + xla : : ComputationBuilder * builder ) { <nl> + / / Although the indices Tensor is flattened into rank 1 during the lookup , <nl> + / / and each scalar entry is used as an index into the first dimension of the <nl> + / / input , the output is returned with shape indices . shape + input . shape [ 1 : ] <nl> const int num_indices = indices_shape . num_elements ( ) ; <nl> + TensorShape input_shape_1 ( input_shape ) ; <nl> + input_shape_1 . RemoveDim ( 0 ) ; <nl> + <nl> + / / Each slice of the input tensor is [ 1 , < input shape_1 > ] <nl> + TensorShape slice_shape ( input_shape ) ; <nl> + slice_shape . set_dim ( 0 , 1 ) ; <nl> + <nl> + / / TODO ( b / 37575001 ) The tensor in which we construct the output during <nl> + / / the loop must have rank > = 3 as a workaround for lowering issues . <nl> + int64 extra_dims = 0 ; <nl> + if ( input_shape . dims ( ) < 3 ) extra_dims = 3 - input_shape . dims ( ) ; <nl> + <nl> + TensorShape loop_out_shape ; <nl> + for ( int64 k = 0 ; k < extra_dims ; + + k ) loop_out_shape . AddDim ( 1 ) ; <nl> + loop_out_shape . AddDim ( num_indices ) ; <nl> + loop_out_shape . AppendShape ( input_shape_1 ) ; <nl> + <nl> + / / Slices are reshaped into the rank > = 3 shape of the loop carried output . <nl> + TensorShape loop_out_slice_shape ; <nl> + for ( int64 k = 0 ; k < extra_dims ; + + k ) loop_out_slice_shape . AddDim ( 1 ) ; <nl> + loop_out_slice_shape . AddDim ( 1 ) ; <nl> + loop_out_slice_shape . AppendShape ( input_shape_1 ) ; <nl> + <nl> + / / Finally , the loop - carried rank > = 3 output is reshaped to the op ' s <nl> + / / specified result shape . <nl> + TensorShape out_shape ( indices_shape ) ; <nl> + out_shape . AppendShape ( input_shape_1 ) ; <nl> + <nl> + / / Degenerate case : empty indices . <nl> + if ( num_indices = = 0 ) { <nl> + return builder - > Broadcast ( XlaHelpers : : Zero ( builder , dtype ) , <nl> + out_shape . dim_sizes ( ) ) ; <nl> + } <nl> <nl> - / / Flatten the indices into 1 - D . <nl> + / / Specify the shape of the loop - carried Tensor tuple . <nl> + xla : : PrimitiveType ptype ; <nl> + TF_CHECK_OK ( DataTypeToPrimitiveType ( dtype , & ptype ) ) ; <nl> + std : : vector < xla : : Shape > tuple_shapes ( <nl> + { / / The iteration counter i is a scalar , incremented each iteration . <nl> + xla : : ShapeUtil : : MakeShape ( xla : : S32 , { } ) , <nl> + / / The input array has shape input_shape . Loop invariant . <nl> + xla : : ShapeUtil : : MakeShape ( ptype , input_shape . dim_sizes ( ) ) , <nl> + / / The gather indices are reshaped to rank 1 . Loop invariant . <nl> + xla : : ShapeUtil : : MakeShape ( xla : : S32 , { num_indices } ) , <nl> + / / The output array is rank > = 3 , and is updated on each loop iteration . <nl> + xla : : ShapeUtil : : MakeShape ( ptype , loop_out_shape . dim_sizes ( ) ) } ) ; <nl> + xla : : Shape tuple_shape = xla : : ShapeUtil : : MakeTupleShape ( tuple_shapes ) ; <nl> + <nl> + / / Construct the initial values of the loop - carried Tensors . <nl> + auto init_i = builder - > ConstantR0 < int32 > ( 0 ) ; <nl> + auto init_out = <nl> + builder - > Broadcast ( builder - > ConstantLiteral ( xla : : Literal : : Zero ( ptype ) ) , <nl> + loop_out_shape . dim_sizes ( ) ) ; <nl> + / / Flatten the indices into 1 - D for ease of iteration . <nl> auto indices_1d = builder - > Reshape ( indices , { num_indices } ) ; <nl> - <nl> - / / Compute the slice for each of these indices separately . <nl> - std : : vector < xla : : ComputationDataHandle > slices ( num_indices ) ; <nl> - for ( int i = 0 ; i < num_indices ; + + i ) { <nl> - auto index = builder - > Slice ( indices_1d , { i } , { i + 1 } , { 1 } ) ; <nl> - <nl> + auto init = builder - > Tuple ( { init_i , input , indices_1d , init_out } ) ; <nl> + <nl> + / / Construct the while loop condition ( i < num_indices ) <nl> + xla : : ComputationBuilder condb ( context - > builder ( ) - > client ( ) , <nl> + " GatherWhileCond " ) ; <nl> + condb . Lt ( condb . GetTupleElement ( <nl> + condb . Parameter ( 0 , tuple_shape , " GatherWhileTuple " ) , 0 ) , <nl> + condb . ConstantR0 < int32 > ( num_indices ) ) ; <nl> + auto cond_status = condb . Build ( ) ; <nl> + auto cond = cond_status . ConsumeValueOrDie ( ) ; <nl> + <nl> + / / Construct the while loop body ' s function . The implementation of gather is : <nl> + / / for i in range ( num_indices ) : <nl> + / / index = dynamic - slice ( indices , i ) <nl> + / / xi = dynamic - slice ( input , index ) <nl> + / / output = dynamic - update - slice ( output , xi , i ) <nl> + xla : : ComputationBuilder bodyb ( context - > builder ( ) - > client ( ) , <nl> + " GatherWhileBody " ) ; <nl> + { <nl> + / / The four loop carried values . <nl> + auto loop_tuple = bodyb . Parameter ( 0 , tuple_shape , " GatherWhileTuple " ) ; <nl> + auto i = bodyb . GetTupleElement ( loop_tuple , 0 ) ; <nl> + auto input = bodyb . GetTupleElement ( loop_tuple , 1 ) ; <nl> + auto indices = bodyb . GetTupleElement ( loop_tuple , 2 ) ; <nl> + auto output = bodyb . GetTupleElement ( loop_tuple , 3 ) ; <nl> + <nl> + / / Slice from the input array . <nl> + auto index = bodyb . DynamicSlice ( indices , bodyb . Reshape ( i , { 1 } ) , { 1 } ) ; <nl> auto start_indices = <nl> - XlaHelpers : : PadWithZeros ( builder , index , input_shape . dims ( ) - 1 ) ; <nl> - <nl> - auto slice_shape = input_shape . dim_sizes ( ) ; <nl> - slice_shape [ 0 ] = 1 ; <nl> - <nl> - slices [ i ] = builder - > DynamicSlice ( input , start_indices , slice_shape ) ; <nl> - } <nl> - <nl> - xla : : ComputationDataHandle gather ; <nl> - if ( slices . empty ( ) ) { <nl> - auto shape = input_shape . dim_sizes ( ) ; <nl> - shape [ 0 ] = 0 ; <nl> - gather = builder - > Broadcast ( XlaHelpers : : Zero ( builder , dtype ) , shape ) ; <nl> - } else { <nl> - gather = builder - > ConcatInDim ( slices , 0 ) ; <nl> + XlaHelpers : : PadWithZeros ( & bodyb , index , input_shape . dims ( ) - 1 ) ; <nl> + auto slice_i = bodyb . Reshape ( <nl> + bodyb . DynamicSlice ( input , start_indices , slice_shape . dim_sizes ( ) ) , <nl> + loop_out_slice_shape . dim_sizes ( ) ) ; <nl> + <nl> + / / Construct the index into the R3 + output Tensor 0 , . . . , < index > , 0 , . . . <nl> + std : : vector < xla : : ComputationDataHandle > out_index_vals ( <nl> + loop_out_shape . dims ( ) , bodyb . ConstantR1 < int32 > ( { 0 } ) ) ; <nl> + out_index_vals [ extra_dims ] = bodyb . Reshape ( i , { 1 } ) ; <nl> + auto out_index = bodyb . ConcatInDim ( out_index_vals , 0 ) ; <nl> + <nl> + / / Update the output Tensor <nl> + auto updated_output = bodyb . DynamicUpdateSlice ( output , slice_i , out_index ) ; <nl> + <nl> + bodyb . Tuple ( { bodyb . Add ( i , bodyb . ConstantR0 < int32 > ( 1 ) ) , input , indices , <nl> + updated_output } ) ; <nl> } <nl> + auto body_status = bodyb . Build ( ) ; <nl> + auto body = body_status . ConsumeValueOrDie ( ) ; <nl> <nl> - / / Compute the shape of the result tensor , which is : <nl> - / / indices . shape + resource . shape [ 1 : ] <nl> - TensorShape gather_shape = indices_shape ; <nl> - gather_shape . AppendShape ( input_shape ) ; <nl> - gather_shape . RemoveDim ( indices_shape . dims ( ) ) ; <nl> - <nl> - / / Reshape the concatenated slices into the shape expected of the result <nl> - / / tensor . <nl> - return builder - > Reshape ( gather , gather_shape . dim_sizes ( ) ) ; <nl> + / / Construct the While loop , extract and reshape the output . <nl> + auto gather_while = builder - > While ( cond , body , init ) ; <nl> + auto gather_output = builder - > GetTupleElement ( gather_while , 3 ) ; <nl> + return builder - > Reshape ( gather_output , out_shape . dim_sizes ( ) ) ; <nl> } <nl> <nl> namespace { <nl> <nl> class GatherOpCustomCall : public XlaOpKernel { <nl> public : <nl> - explicit GatherOpCustomCall ( OpKernelConstruction * ctx ) : XlaOpKernel ( ctx ) { } <nl> + explicit GatherOpCustomCall ( OpKernelConstruction * context ) <nl> + : XlaOpKernel ( context ) { } <nl> <nl> - void Compile ( XlaOpKernelContext * ctx ) override { <nl> - const TensorShape params_shape = ctx - > InputShape ( 0 ) ; <nl> + void Compile ( XlaOpKernelContext * context ) override { <nl> + const TensorShape params_shape = context - > InputShape ( 0 ) ; <nl> const auto params_dims = params_shape . dims ( ) ; <nl> - const TensorShape indices_shape = ctx - > InputShape ( 1 ) ; <nl> + const TensorShape indices_shape = context - > InputShape ( 1 ) ; <nl> OP_REQUIRES ( <nl> - ctx , TensorShapeUtils : : IsVectorOrHigher ( params_shape ) , <nl> + context , TensorShapeUtils : : IsVectorOrHigher ( params_shape ) , <nl> errors : : InvalidArgument ( " params must be at least 1 dimensional " ) ) ; <nl> <nl> DataType index_type = input_type ( 1 ) ; <nl> - OP_REQUIRES ( ctx , index_type = = DT_INT32 | | index_type = = DT_INT64 , <nl> + OP_REQUIRES ( context , index_type = = DT_INT32 | | index_type = = DT_INT64 , <nl> errors : : InvalidArgument ( " index must be int32 or int64 " ) ) ; <nl> <nl> / / GatherV2 added an axis argument . We support both Gather and GatherV2 in <nl> / / this kernel by defaulting axis to 0 if there are 2 inputs . <nl> int64 axis = 0 ; <nl> - if ( ctx - > num_inputs ( ) = = 3 ) { <nl> - const TensorShape axis_shape = ctx - > InputShape ( 2 ) ; <nl> - OP_REQUIRES ( ctx , TensorShapeUtils : : IsScalar ( axis_shape ) , <nl> + if ( context - > num_inputs ( ) = = 3 ) { <nl> + const TensorShape axis_shape = context - > InputShape ( 2 ) ; <nl> + OP_REQUIRES ( context , TensorShapeUtils : : IsScalar ( axis_shape ) , <nl> errors : : InvalidArgument ( " axis must be scalar " ) ) ; <nl> DataType axis_type = input_type ( 2 ) ; <nl> - OP_REQUIRES ( ctx , axis_type = = DT_INT32 | | axis_type = = DT_INT64 , <nl> + OP_REQUIRES ( context , axis_type = = DT_INT32 | | axis_type = = DT_INT64 , <nl> errors : : InvalidArgument ( " axis must be int32 or int64 " ) ) ; <nl> <nl> xla : : Literal literal ; <nl> - OP_REQUIRES_OK ( ctx , ctx - > ConstantInput ( 2 , & literal ) ) ; <nl> + OP_REQUIRES_OK ( context , context - > ConstantInput ( 2 , & literal ) ) ; <nl> int64 axis_input = axis_type = = DT_INT32 ? literal . Get < int32 > ( { } ) <nl> : literal . Get < int64 > ( { } ) ; <nl> axis = axis_input < 0 ? axis_input + params_dims : axis_input ; <nl> - OP_REQUIRES ( ctx , 0 < = axis & & axis < params_dims , <nl> + OP_REQUIRES ( context , 0 < = axis & & axis < params_dims , <nl> errors : : InvalidArgument ( " Expected axis in the range [ " , <nl> - params_dims , " , " , params_dims , <nl> " ) , but got " , axis_input ) ) ; <nl> class GatherOpCustomCall : public XlaOpKernel { <nl> const int64 limit = index_type = = DT_INT32 <nl> ? std : : numeric_limits < int32 > : : max ( ) <nl> : std : : numeric_limits < int64 > : : max ( ) ; <nl> - OP_REQUIRES ( ctx , params_shape . dim_size ( axis ) < = limit , <nl> + OP_REQUIRES ( context , params_shape . dim_size ( axis ) < = limit , <nl> errors : : InvalidArgument ( <nl> " params . shape [ " , axis , " ] too large for " , <nl> DataTypeString ( index_type ) , <nl> class GatherOpCustomCall : public XlaOpKernel { <nl> inner_size * = params_shape . dim_size ( i ) ; <nl> } <nl> <nl> - XlaContext & tc = XlaContext : : Get ( ctx ) ; <nl> + XlaContext & tc = XlaContext : : Get ( context ) ; <nl> OP_REQUIRES ( <nl> - ctx , tc . allow_cpu_custom_calls ( ) , <nl> + context , tc . allow_cpu_custom_calls ( ) , <nl> errors : : InvalidArgument ( " Gather op requires CustomCall on CPU " ) ) ; <nl> <nl> - xla : : ComputationBuilder & b = * ctx - > builder ( ) ; <nl> + xla : : ComputationBuilder & b = * context - > builder ( ) ; <nl> <nl> / / Call gather_xla_float_kernel ( from gather_op_kernel_float . cc ) . <nl> / / XLA passes < out > to the function , so it is not included here . <nl> class GatherOpCustomCall : public XlaOpKernel { <nl> * xla : : Literal : : CreateR0 < int64 > ( params_shape . dim_size ( axis ) ) ) ) ; <nl> args . push_back ( <nl> b . ConstantLiteral ( * xla : : Literal : : CreateR0 < int64 > ( inner_size ) ) ) ; <nl> - args . push_back ( ctx - > Input ( 0 ) ) ; <nl> - args . push_back ( ctx - > Input ( 1 ) ) ; <nl> + args . push_back ( context - > Input ( 0 ) ) ; <nl> + args . push_back ( context - > Input ( 1 ) ) ; <nl> <nl> xla : : Shape xla_out_shape ; <nl> OP_REQUIRES_OK ( <nl> - ctx , TensorShapeToXLAShape ( DT_FLOAT , result_shape , & xla_out_shape ) ) ; <nl> + context , TensorShapeToXLAShape ( DT_FLOAT , result_shape , & xla_out_shape ) ) ; <nl> <nl> / / Call the custom code with args : <nl> xla : : ComputationDataHandle output ; <nl> class GatherOpCustomCall : public XlaOpKernel { <nl> output = b . CustomCall ( " gather_float_int64_xla_impl " , args , xla_out_shape ) ; <nl> } <nl> <nl> - ctx - > SetOutput ( 0 , output ) ; <nl> + context - > SetOutput ( 0 , output ) ; <nl> } <nl> <nl> private : <nl> void GatherOpDynamicSlice : : Compile ( XlaOpKernelContext * context ) { <nl> auto indices = context - > Input ( 1 ) ; <nl> auto indices_shape = context - > InputShape ( 1 ) ; <nl> xla : : ComputationDataHandle gather = XlaComputeGatherDynamicSlice ( <nl> - input , input_shape , indices , indices_shape , DT_FLOAT , builder ) ; <nl> + context , input , input_shape , indices , indices_shape , DT_FLOAT , builder ) ; <nl> context - > SetOutput ( 0 , gather ) ; <nl> } <nl> <nl> mmm a / tensorflow / compiler / tf2xla / kernels / gather_op_helpers . h <nl> ppp b / tensorflow / compiler / tf2xla / kernels / gather_op_helpers . h <nl> namespace tensorflow { <nl> / / Adds to builder an XLA computation that performs a gather on input ( of <nl> / / shape input_shape ) keyed on indices ( of shape indices_shape ) . <nl> xla : : ComputationDataHandle XlaComputeGatherDynamicSlice ( <nl> - const xla : : ComputationDataHandle & input , const TensorShape & input_shape , <nl> - const xla : : ComputationDataHandle & indices , const TensorShape & indices_shape , <nl> - DataType dtype , xla : : ComputationBuilder * builder ) ; <nl> + XlaOpKernelContext * ctx , const xla : : ComputationDataHandle & input , <nl> + const TensorShape & input_shape , const xla : : ComputationDataHandle & indices , <nl> + const TensorShape & indices_shape , DataType dtype , <nl> + xla : : ComputationBuilder * builder ) ; <nl> <nl> } / / namespace tensorflow <nl> <nl> new file mode 100644 <nl> index 0000000000000 . . a5ab7de17adb7 <nl> mmm / dev / null <nl> ppp b / tensorflow / compiler / tf2xla / kernels / scatter_op_helpers . h <nl> <nl> + / * Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + / / Helper methods for XLA Scatter Ops . <nl> + # ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_SCATTER_OP_HELPERS_H_ <nl> + # define TENSORFLOW_COMPILER_TF2XLA_KERNELS_SCATTER_OP_HELPERS_H_ <nl> + <nl> + # include " tensorflow / compiler / tf2xla / xla_op_kernel . h " <nl> + # include " tensorflow / compiler / xla / client / client_library . h " <nl> + # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> + # include " tensorflow / core / framework / op_kernel . h " <nl> + # include " tensorflow / core / util / bcast . h " <nl> + <nl> + namespace tensorflow { <nl> + <nl> + / / Adds to builder an XLA computation that performs a scatter - add of input ( of <nl> + / / shape input_shape ) keyed on indices ( of shape indices_shape ) . The shape <nl> + / / of the Tensor returned by this is num_segments input_shape [ indices . dims ( ) : ] <nl> + / / <nl> + static xla : : ComputationDataHandle XlaComputeScatterAddDynamicSlice ( <nl> + XlaOpKernelContext * ctx , const xla : : ComputationDataHandle & input , <nl> + const TensorShape & input_shape , const xla : : ComputationDataHandle & indices , <nl> + const TensorShape & indices_shape , int64 num_segments , DataType dtype , <nl> + xla : : ComputationBuilder * builder ) ; <nl> + <nl> + } / / namespace tensorflow <nl> + <nl> + # endif / / TENSORFLOW_COMPILER_TF2XLA_KERNELS_SCATTER_OP_HELPERS_H_ <nl> mmm a / tensorflow / compiler / tf2xla / kernels / segment_reduction_ops . cc <nl> ppp b / tensorflow / compiler / tf2xla / kernels / segment_reduction_ops . cc <nl> limitations under the License . <nl> # include < sstream > <nl> # include " tensorflow / compiler / tf2xla / kernels / cwise_ops . h " <nl> # include " tensorflow / compiler / tf2xla / shape_util . h " <nl> + # include " tensorflow / compiler / tf2xla / type_util . h " <nl> # include " tensorflow / compiler / tf2xla / xla_helpers . h " <nl> # include " tensorflow / compiler / tf2xla / xla_op_registry . h " <nl> # include " tensorflow / compiler / xla / client / computation_builder . h " <nl> limitations under the License . <nl> # include " tensorflow / core / framework / types . h " <nl> <nl> namespace tensorflow { <nl> + <nl> + xla : : ComputationDataHandle XlaComputeScatterAddDynamicSlice ( <nl> + XlaOpKernelContext * ctx , const xla : : ComputationDataHandle & input , <nl> + const TensorShape & input_shape , const xla : : ComputationDataHandle & indices , <nl> + const TensorShape & indices_shape , int64 num_segments , DataType dtype , <nl> + xla : : ComputationBuilder * builder ) { <nl> + / / Flatten data for dynamic indexing via indices_1d . <nl> + TensorShape input_shape_i ( input_shape ) ; <nl> + for ( int64 d = 0 ; d < indices_shape . dims ( ) ; + + d ) { <nl> + input_shape_i . RemoveDim ( 0 ) ; <nl> + } <nl> + TensorShape flat_shape ( { indices_shape . num_elements ( ) } ) ; <nl> + flat_shape . AppendShape ( input_shape_i ) ; <nl> + <nl> + / / output is same as flattened input shape with dim_size ( 0 ) = num_segments . <nl> + TensorShape out_shape ( flat_shape ) ; <nl> + out_shape . set_dim ( 0 , num_segments ) ; <nl> + <nl> + / / TODO ( b / 37575001 ) The tensor in which we construct the output during <nl> + / / the loop must have rank > = 3 as a workaround for lowering issues . <nl> + int64 extra_dims = 0 ; <nl> + if ( out_shape . dims ( ) < 3 ) { <nl> + extra_dims = 3 - out_shape . dims ( ) ; <nl> + } <nl> + TensorShape loop_out_shape ; <nl> + for ( int64 k = 0 ; k < extra_dims ; + + k ) { <nl> + loop_out_shape . AddDim ( 1 ) ; <nl> + } <nl> + loop_out_shape . AppendShape ( out_shape ) ; <nl> + <nl> + / / Slices from the input data are same shape as the input data , except dim 0 . <nl> + TensorShape slice_shape ( flat_shape ) ; <nl> + slice_shape . set_dim ( 0 , 1 ) ; <nl> + / / slices are reshaped into the rank > = 3 shape of the loop - carried output <nl> + TensorShape loop_out_slice_shape ( loop_out_shape ) ; <nl> + loop_out_slice_shape . set_dim ( extra_dims , 1 ) ; <nl> + <nl> + / / Construct the initial values of the loop - carried variables <nl> + / / Flatten the indices into 1 - D for ease of iteration . <nl> + auto indices_1d = builder - > Reshape ( indices , { indices_shape . num_elements ( ) } ) ; <nl> + / / Flatten the data for ease of indexing via values in indices_1d . <nl> + auto data_flat = builder - > Reshape ( input , flat_shape . dim_sizes ( ) ) ; <nl> + <nl> + auto init_i = builder - > ConstantR0 < int32 > ( 0 ) ; <nl> + auto init_out = builder - > Broadcast ( XlaHelpers : : Zero ( builder , dtype ) , <nl> + loop_out_shape . dim_sizes ( ) ) ; <nl> + <nl> + xla : : PrimitiveType ptype ; <nl> + TF_CHECK_OK ( DataTypeToPrimitiveType ( dtype , & ptype ) ) ; <nl> + <nl> + std : : vector < xla : : Shape > tuple_shapes ( <nl> + { / / The loop iteration counter is a scalar , incremented each iteration . <nl> + xla : : ShapeUtil : : MakeShape ( xla : : S32 , { } ) , <nl> + / / The flattened input data is loop invariant . <nl> + xla : : ShapeUtil : : MakeShape ( ptype , flat_shape . dim_sizes ( ) ) , <nl> + / / The scatter indices tensor is loop invariant . <nl> + xla : : ShapeUtil : : MakeShape ( xla : : S32 , { indices_shape . num_elements ( ) } ) , <nl> + / / The output data array is updated each loop iteration . <nl> + xla : : ShapeUtil : : MakeShape ( ptype , loop_out_shape . dim_sizes ( ) ) } ) ; <nl> + xla : : Shape tuple_shape = xla : : ShapeUtil : : MakeTupleShape ( tuple_shapes ) ; <nl> + <nl> + auto init = builder - > Tuple ( { init_i , data_flat , indices_1d , init_out } ) ; <nl> + <nl> + / / Construct the while loop condition ( i < num_indices ) <nl> + xla : : ComputationBuilder condb ( ctx - > builder ( ) - > client ( ) , <nl> + " ScatterAddWhileCond " ) ; <nl> + condb . Lt ( condb . GetTupleElement ( <nl> + condb . Parameter ( 0 , tuple_shape , " ScatterAddWhileTuple " ) , 0 ) , <nl> + condb . ConstantR0 < int32 > ( indices_shape . num_elements ( ) ) ) ; <nl> + auto cond_status = condb . Build ( ) ; <nl> + / / TF_CHECK_OK ( cond_status ) ; <nl> + auto cond = cond_status . ConsumeValueOrDie ( ) ; <nl> + <nl> + / / Construct the while loop body ' s function . The implementation of scatter is : <nl> + / / for i in range ( num_indices ) : <nl> + / / index = dynamic - slice ( indices , i ) <nl> + / / xi = dynamic - slice ( input , i ) <nl> + / / output = dynamic - update - slice ( output , xi , index ) <nl> + xla : : ComputationBuilder bodyb ( ctx - > builder ( ) - > client ( ) , <nl> + " ScatterAddWhileBody " ) ; <nl> + { <nl> + auto input_tuple = bodyb . Parameter ( 0 , tuple_shape , " ScatterAddWhileTuple " ) ; <nl> + auto i = bodyb . GetTupleElement ( input_tuple , 0 ) ; <nl> + auto data = bodyb . GetTupleElement ( input_tuple , 1 ) ; <nl> + auto idcs = bodyb . GetTupleElement ( input_tuple , 2 ) ; <nl> + auto output = bodyb . GetTupleElement ( input_tuple , 3 ) ; <nl> + <nl> + / / Index into the data array at i . <nl> + auto zero = bodyb . ConstantR1 < int32 > ( { 0 } ) ; <nl> + std : : vector < xla : : ComputationDataHandle > index_vals ( flat_shape . dims ( ) , zero ) ; <nl> + index_vals [ 0 ] = bodyb . Reshape ( i , { 1 } ) ; <nl> + auto index = bodyb . ConcatInDim ( index_vals , 0 ) ; <nl> + <nl> + auto data_slice = <nl> + bodyb . Reshape ( bodyb . DynamicSlice ( data , index , slice_shape . dim_sizes ( ) ) , <nl> + loop_out_slice_shape . dim_sizes ( ) ) ; <nl> + <nl> + / / Index into the output array . <nl> + / / Construct the index into the R3 + output array 0 , . . . , < index > , 0 , . . . <nl> + std : : vector < xla : : ComputationDataHandle > out_index_vals ( <nl> + loop_out_shape . dims ( ) , zero ) ; <nl> + out_index_vals [ extra_dims ] = <nl> + bodyb . DynamicSlice ( idcs , bodyb . Reshape ( i , { 1 } ) , { 1 } ) ; <nl> + auto out_index = bodyb . ConcatInDim ( out_index_vals , 0 ) ; <nl> + <nl> + / / Slice the output array , update value , and update the output slice . <nl> + auto updated_output = bodyb . DynamicUpdateSlice ( <nl> + output , <nl> + bodyb . Add ( data_slice , <nl> + bodyb . DynamicSlice ( output , out_index , <nl> + loop_out_slice_shape . dim_sizes ( ) ) ) , <nl> + out_index ) ; <nl> + <nl> + auto ip1 = bodyb . Add ( i , bodyb . ConstantR0 < int32 > ( 1 ) ) ; <nl> + bodyb . Tuple ( { ip1 , data , indices_1d , updated_output } ) ; <nl> + } <nl> + auto body_status = bodyb . Build ( ) ; <nl> + / / TF_CHECK_OK ( body_status ) ; <nl> + auto body = body_status . ConsumeValueOrDie ( ) ; <nl> + <nl> + auto gather_while = builder - > While ( cond , body , init ) ; <nl> + auto updated_output = builder - > GetTupleElement ( gather_while , 3 ) ; <nl> + return builder - > Reshape ( updated_output , out_shape . dim_sizes ( ) ) ; <nl> + } <nl> + <nl> namespace { <nl> <nl> class UnsortedSegmentSum : public XlaOpKernel { <nl> class UnsortedSegmentSum : public XlaOpKernel { <nl> / / The returned output tensor has the same type as data , and the same shape <nl> / / as data with the first indices . rank dimensions are replaced <nl> / / by a single dimension with size num_segments . <nl> - <nl> - xla : : ComputationBuilder * builder = ctx - > builder ( ) ; <nl> - <nl> auto data = ctx - > Input ( 0 ) ; <nl> auto data_shape = ctx - > InputShape ( 0 ) ; <nl> <nl> auto indices = ctx - > Input ( 1 ) ; <nl> auto indices_shape = ctx - > InputShape ( 1 ) ; <nl> <nl> + int64 num_segments ; <nl> + OP_REQUIRES_OK ( ctx , ctx - > ConstantInputAsIntScalar ( 2 , & num_segments ) ) ; <nl> + <nl> OP_REQUIRES ( ctx , data_shape . dims ( ) > = indices_shape . dims ( ) , <nl> errors : : InvalidArgument ( <nl> " UnsortedSegmentSum requires that indices ' rank be " <nl> class UnsortedSegmentSum : public XlaOpKernel { <nl> d , " differs " , data_shape . dim_size ( d ) , " vs . " , <nl> indices_shape . dim_size ( d ) ) ) ; <nl> } <nl> - <nl> - int64 num_segments ; <nl> - OP_REQUIRES_OK ( ctx , ctx - > ConstantInputAsIntScalar ( 2 , & num_segments ) ) ; <nl> - <nl> - / / Flatten the indices into 1 - D . <nl> - auto indices_1d = builder - > Reshape ( indices , { indices_shape . num_elements ( ) } ) ; <nl> - <nl> - / / flatten data for dynamic indexing . <nl> - int64 out_tensor_dims = data_shape . dims ( ) - indices_shape . dims ( ) ; <nl> - std : : vector < int64 > flat_shape ( 1 + out_tensor_dims ) ; <nl> - flat_shape [ 0 ] = indices_shape . num_elements ( ) ; <nl> - for ( int64 k = 0 ; k < out_tensor_dims ; + + k ) { <nl> - flat_shape [ 1 + k ] = data_shape . dim_size ( indices_shape . dims ( ) + k ) ; <nl> - } <nl> - auto data_flat = builder - > Reshape ( data , flat_shape ) ; <nl> - <nl> - / / output shape ; same as data_shape , but dimension 0 is num_segments . <nl> - std : : vector < int64 > out_shape ( flat_shape ) ; <nl> - out_shape [ 0 ] = num_segments ; <nl> - <nl> - / / Pad the output array dims to rank > = 3 to work around lowering issues . <nl> - / / TODO ( b / 37575001 ) This is awkward , and could be improved . <nl> - int64 extra_dims = 0 ; <nl> - if ( out_shape . size ( ) < 3 ) { <nl> - extra_dims = 3u - out_shape . size ( ) ; <nl> - } <nl> - std : : vector < int64 > rshape ( extra_dims + out_shape . size ( ) , 1 ) ; <nl> - for ( unsigned k = 0 ; k < out_shape . size ( ) ; + + k ) { <nl> - rshape [ extra_dims + k ] = out_shape [ k ] ; <nl> - } <nl> - auto output = builder - > Broadcast ( XlaHelpers : : Zero ( builder , dtype_ ) , rshape ) ; <nl> - <nl> - auto zero = builder - > ConstantR1 < int32 > ( { 0 } ) ; <nl> - <nl> - for ( int64 i = 0 ; i < indices_shape . num_elements ( ) ; + + i ) { <nl> - / / output [ indices [ i ] ] + = data [ i ] <nl> - <nl> - std : : vector < int64 > data_start_indices ( flat_shape . size ( ) ) ; <nl> - data_start_indices [ 0 ] = i ; <nl> - for ( unsigned d = 1 ; d < flat_shape . size ( ) ; + + d ) { <nl> - data_start_indices [ d ] = 0 ; <nl> - } <nl> - std : : vector < int64 > data_limit_indices ( flat_shape ) ; <nl> - data_limit_indices [ 0 ] = i + 1 ; <nl> - std : : vector < int64 > stride ( flat_shape . size ( ) , 1 ) ; <nl> - <nl> - auto data_slice = builder - > Slice ( data_flat , data_start_indices , <nl> - data_limit_indices , stride ) ; <nl> - <nl> - / / Reshape the sliced data into the R3 + shape to match output array . <nl> - std : : vector < int64 > rdata_shape ( extra_dims + flat_shape . size ( ) ) ; <nl> - for ( int64 k = 0 ; k < = extra_dims ; + + k ) { <nl> - rdata_shape [ k ] = 1 ; <nl> - } <nl> - for ( unsigned k = 1 ; k < data_limit_indices . size ( ) ; + + k ) { <nl> - rdata_shape [ extra_dims + k ] = data_limit_indices [ k ] ; <nl> - } <nl> - auto rdata_slice = builder - > Reshape ( data_slice , rdata_shape ) ; <nl> - <nl> - auto index = builder - > Slice ( indices_1d , { i } , { i + 1 } , { 1 } ) ; <nl> - <nl> - / / Construct the index into the R3 + output array 0 , . . . , < index > , 0 , . . . <nl> - std : : vector < xla : : ComputationDataHandle > out_start_index_parts ( <nl> - extra_dims + flat_shape . size ( ) , zero ) ; <nl> - out_start_index_parts [ extra_dims ] = builder - > Reshape ( index , { 1 } ) ; <nl> - auto out_start_indices = builder - > ConcatInDim ( out_start_index_parts , 0 ) ; <nl> - <nl> - std : : vector < int64 > slice_size ( rshape ) ; <nl> - slice_size [ extra_dims ] = 1 ; <nl> - <nl> - auto out_slice = <nl> - builder - > DynamicSlice ( output , out_start_indices , slice_size ) ; <nl> - auto sumval = builder - > Add ( out_slice , rdata_slice ) ; <nl> - output = builder - > DynamicUpdateSlice ( output , sumval , out_start_indices ) ; <nl> - } <nl> - auto reshaped_output = builder - > Reshape ( output , out_shape ) ; <nl> - ctx - > SetOutput ( 0 , reshaped_output ) ; <nl> + auto result = XlaComputeScatterAddDynamicSlice ( <nl> + ctx , data , data_shape , indices , indices_shape , num_segments , dtype_ , <nl> + ctx - > builder ( ) ) ; <nl> + ctx - > SetOutput ( 0 , result ) ; <nl> } <nl> <nl> private : <nl> mmm a / tensorflow / compiler / tf2xla / kernels / tensor_array_ops . cc <nl> ppp b / tensorflow / compiler / tf2xla / kernels / tensor_array_ops . cc <nl> class TensorArrayGatherOp : public XlaOpKernel { <nl> xla : : ComputationDataHandle ta = resource - > value ; <nl> <nl> xla : : ComputationDataHandle gather = XlaComputeGatherDynamicSlice ( <nl> - ta , ta_shape , indices , indices_shape , dtype_ , b ) ; <nl> + ctx , ta , ta_shape , indices , indices_shape , dtype_ , b ) ; <nl> ctx - > SetOutput ( 0 , gather ) ; <nl> } <nl> <nl> mmm a / tensorflow / compiler / tf2xla / kernels / variable_ops . cc <nl> ppp b / tensorflow / compiler / tf2xla / kernels / variable_ops . cc <nl> class ResourceGatherOp : public XlaOpKernel { <nl> <nl> auto indices = ctx - > Input ( 1 ) ; <nl> auto indices_shape = ctx - > InputShape ( 1 ) ; <nl> - xla : : ComputationDataHandle gather = <nl> - XlaComputeGatherDynamicSlice ( resource_handle , resource_shape , indices , <nl> - indices_shape , resource_dtype , builder ) ; <nl> - <nl> + xla : : ComputationDataHandle gather = XlaComputeGatherDynamicSlice ( <nl> + ctx , resource_handle , resource_shape , indices , indices_shape , <nl> + resource_dtype , builder ) ; <nl> ctx - > SetOutput ( 0 , gather ) ; <nl> } <nl> } ; <nl>
|
Use XLA While loop in Gather / Scatter tf2xla bridge ops , to prevent excessively large HLO output for models with large numbers of embedding lookups .
|
tensorflow/tensorflow
|
018530bbb673ef630d9235db436a59f66b876d91
|
2017-08-16T23:23:24Z
|
mmm a / stdlib / public / core / Character . swift <nl> ppp b / stdlib / public / core / Character . swift <nl> extension Character { <nl> } <nl> <nl> extension Character { <nl> - @ usableFromInline <nl> - typealias UTF8View = String . UTF8View <nl> + / / / A view of a character ' s contents as a collection of UTF - 8 code units . See <nl> + / / / String . UTF8View for more information <nl> + public typealias UTF8View = String . UTF8View <nl> <nl> + / / / A UTF - 8 encoding of ` self ` . <nl> @ inlinable <nl> - internal var utf8 : UTF8View { <nl> - return _str . utf8 <nl> - } <nl> - @ usableFromInline <nl> - typealias UTF16View = String . UTF16View <nl> + public var utf8 : UTF8View { return _str . utf8 } <nl> + <nl> + / / / A view of a character ' s contents as a collection of UTF - 16 code units . See <nl> + / / / String . UTF16View for more information <nl> + public typealias UTF16View = String . UTF16View <nl> <nl> + / / / A UTF - 16 encoding of ` self ` . <nl> @ inlinable <nl> - internal var utf16 : UTF16View { <nl> - return _str . utf16 <nl> - } <nl> + public var utf16 : UTF16View { return _str . utf16 } <nl> + <nl> public typealias UnicodeScalarView = String . UnicodeScalarView <nl> + <nl> @ inlinable <nl> - public var unicodeScalars : UnicodeScalarView { <nl> - return _str . unicodeScalars <nl> - } <nl> + public var unicodeScalars : UnicodeScalarView { return _str . unicodeScalars } <nl> } <nl> <nl> extension Character : <nl> mmm a / test / stdlib / Character . swift <nl> ppp b / test / stdlib / Character . swift <nl> CharacterTests . test ( " String . append ( _ : Character ) " ) { <nl> } <nl> } <nl> <nl> + CharacterTests . test ( " utf6 / 16 / unicodescalar views " ) { <nl> + for c in testCharacters { <nl> + expectEqualSequence ( String ( c ) . unicodeScalars , c . unicodeScalars ) <nl> + expectEqualSequence ( String ( c ) . utf8 , c . utf8 ) <nl> + expectEqualSequence ( String ( c ) . utf16 , c . utf16 ) <nl> + <nl> + expectEqualSequence ( <nl> + String ( c ) . unicodeScalars . reversed ( ) , c . unicodeScalars . reversed ( ) ) <nl> + expectEqualSequence ( String ( c ) . utf8 . reversed ( ) , c . utf8 . reversed ( ) ) <nl> + expectEqualSequence ( String ( c ) . utf16 . reversed ( ) , c . utf16 . reversed ( ) ) <nl> + } <nl> + } <nl> + <nl> var UnicodeScalarTests = TestSuite ( " UnicodeScalar " ) <nl> <nl> UnicodeScalarTests . test ( " UInt8 ( ascii : UnicodeScalar ) " ) { <nl>
|
[ String ] Add Character . UTF16View and Character . UTF8View
|
apple/swift
|
aa519362f36081d1cafe4e94219f8e487c010b94
|
2019-03-29T22:43:00Z
|
mmm a / tensorflow / compiler / aot / codegen . cc <nl> ppp b / tensorflow / compiler / aot / codegen . cc <nl> Status AddRewritesForShape ( int i , const xla : : Shape & shape , <nl> TF_RETURN_IF_ERROR ( XLATypeToCpp ( shape . element_type ( ) , & type ) ) ; <nl> std : : vector < string > dim_vars ; <nl> string dim_sizes , indices ; <nl> + int count = 1 ; <nl> if ( shape . rank ( ) = = 0 | | <nl> ( shape . dimensions_size ( ) = = 1 & & shape . dimensions ( 0 ) = = 1 ) ) { <nl> dim_sizes = " [ 1 ] " ; <nl> Status AddRewritesForShape ( int i , const xla : : Shape & shape , <nl> dim_vars . push_back ( absl : : StrCat ( " size_t dim " , dim ) ) ; <nl> dim_sizes + = absl : : StrCat ( " [ " , shape . dimensions ( dim ) , " ] " ) ; <nl> indices + = absl : : StrCat ( " [ dim " , dim , " ] " ) ; <nl> + count * = shape . dimensions ( dim ) ; <nl> } <nl> } <nl> rewrites - > push_back ( { " { { I } } " , absl : : StrCat ( i ) } ) ; <nl> Status AddRewritesForShape ( int i , const xla : : Shape & shape , <nl> rewrites - > push_back ( { " { { DIM_VARS } } " , absl : : StrJoin ( dim_vars , " , " ) } ) ; <nl> rewrites - > push_back ( { " { { DIM_SIZES } } " , dim_sizes } ) ; <nl> rewrites - > push_back ( { " { { INDICES } } " , indices } ) ; <nl> + rewrites - > push_back ( { " { { COUNT } } " , absl : : StrCat ( count ) } ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> Status GenArgMethods ( const tf2xla : : Config & config , <nl> return ( * static_cast < const { { TYPE } } ( * ) { { DIM_SIZES } } > ( <nl> arg_data ( { { I } } ) ) ) { { INDICES } } ; <nl> } <nl> + int arg { { NAME } } _size ( ) const { <nl> + return { { COUNT } } * sizeof ( { { TYPE } } ) ; <nl> + } <nl> + int arg { { NAME } } _count ( ) const { <nl> + return { { COUNT } } ; <nl> + } <nl> ) " ; <nl> * methods + = RewriteWithName ( absl : : StrCat ( i ) , code , rewrites ) ; <nl> if ( ! config . feed ( i ) . name ( ) . empty ( ) ) { <nl> Status GenResultMethods ( const tf2xla : : Config & config , <nl> return ( * static_cast < const { { TYPE } } ( * ) { { DIM_SIZES } } > ( <nl> result_data ( { { I } } ) ) ) { { INDICES } } ; <nl> } <nl> + int result { { NAME } } _size ( ) const { <nl> + return { { COUNT } } * sizeof ( { { TYPE } } ) ; <nl> + } <nl> + int result { { NAME } } _count ( ) const { <nl> + return { { COUNT } } ; <nl> + } <nl> ) " ; <nl> * methods + = RewriteWithName ( absl : : StrCat ( i ) , code , rewrites ) ; <nl> if ( ! config . fetch ( i ) . name ( ) . empty ( ) ) { <nl> Status GenVariableMethods ( const tf2xla : : Config & config , <nl> return ( * static_cast < const { { TYPE } } ( * ) { { DIM_SIZES } } > ( <nl> arg_data ( { { I } } ) ) ) { { INDICES } } ; <nl> } <nl> + int var_ { { NAME } } _size ( ) const { <nl> + return { { COUNT } } * sizeof ( { { TYPE } } ) ; <nl> + } <nl> + int var_ { { NAME } } _count ( ) const { <nl> + return { { COUNT } } ; <nl> + } <nl> ) " ; <nl> const tf2xla : : Variable & var = config . variable ( i - config . feed_size ( ) ) ; <nl> rewrites . emplace_back ( " { { MAYBE_CONST } } " , var . readonly ( ) ? " const " : " " ) ; <nl> mmm a / tensorflow / compiler / aot / codegen_test_h . golden <nl> ppp b / tensorflow / compiler / aot / codegen_test_h . golden <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const float ( * ) [ 1 ] [ 2 ] > ( <nl> arg_data ( 0 ) ) ) [ dim0 ] [ dim1 ] ; <nl> } <nl> + int arg0_size ( ) const { <nl> + return 2 * sizeof ( float ) ; <nl> + } <nl> + int arg0_count ( ) const { <nl> + return 2 ; <nl> + } <nl> <nl> void set_arg_myfeed_data ( const void * data ) { <nl> set_arg_data ( 0 , data ) ; <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const float ( * ) [ 1 ] [ 2 ] > ( <nl> arg_data ( 0 ) ) ) [ dim0 ] [ dim1 ] ; <nl> } <nl> + int arg_myfeed_size ( ) const { <nl> + return 2 * sizeof ( float ) ; <nl> + } <nl> + int arg_myfeed_count ( ) const { <nl> + return 2 ; <nl> + } <nl> <nl> void set_arg1_data ( const void * data ) { <nl> set_arg_data ( 1 , data ) ; <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const tensorflow : : int64 ( * ) [ 3 ] [ 4 ] > ( <nl> arg_data ( 1 ) ) ) [ dim0 ] [ dim1 ] ; <nl> } <nl> + int arg1_size ( ) const { <nl> + return 12 * sizeof ( tensorflow : : int64 ) ; <nl> + } <nl> + int arg1_count ( ) const { <nl> + return 12 ; <nl> + } <nl> <nl> / / Result methods for managing output buffers . Buffers are in row - major order . <nl> / / Must only be called after a successful Run call . There is a set of methods <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const tensorflow : : uint32 ( * ) [ 5 ] [ 6 ] > ( <nl> result_data ( 0 ) ) ) [ dim0 ] [ dim1 ] ; <nl> } <nl> + int result0_size ( ) const { <nl> + return 30 * sizeof ( tensorflow : : uint32 ) ; <nl> + } <nl> + int result0_count ( ) const { <nl> + return 30 ; <nl> + } <nl> <nl> tensorflow : : uint32 * result_myfetch_data ( ) { <nl> return static_cast < tensorflow : : uint32 * > ( result_data ( 0 ) ) ; <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const tensorflow : : uint32 ( * ) [ 5 ] [ 6 ] > ( <nl> result_data ( 0 ) ) ) [ dim0 ] [ dim1 ] ; <nl> } <nl> + int result_myfetch_size ( ) const { <nl> + return 30 * sizeof ( tensorflow : : uint32 ) ; <nl> + } <nl> + int result_myfetch_count ( ) const { <nl> + return 30 ; <nl> + } <nl> <nl> / / Methods for managing variable buffers . Buffers are in row - major order . <nl> / / <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const float ( * ) [ 1 ] > ( <nl> arg_data ( 2 ) ) ) [ 0 ] ; <nl> } <nl> + int var_myvar_readonly_size ( ) const { <nl> + return 1 * sizeof ( float ) ; <nl> + } <nl> + int var_myvar_readonly_count ( ) const { <nl> + return 1 ; <nl> + } <nl> <nl> void set_var_myvar_data ( float * data ) { <nl> set_arg_data ( 3 , data ) ; <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const float ( * ) [ 1 ] > ( <nl> arg_data ( 3 ) ) ) [ 0 ] ; <nl> } <nl> + int var_myvar_size ( ) const { <nl> + return 1 * sizeof ( float ) ; <nl> + } <nl> + int var_myvar_count ( ) const { <nl> + return 1 ; <nl> + } <nl> <nl> void set_var_myvar2_data ( tensorflow : : int32 * data ) { <nl> set_arg_data ( 4 , data ) ; <nl> class MyClass final : public tensorflow : : XlaCompiledCpuFunction { <nl> return ( * static_cast < const tensorflow : : int32 ( * ) [ 5 ] > ( <nl> arg_data ( 4 ) ) ) [ dim0 ] ; <nl> } <nl> + int var_myvar2_size ( ) const { <nl> + return 5 * sizeof ( tensorflow : : int32 ) ; <nl> + } <nl> + int var_myvar2_count ( ) const { <nl> + return 5 ; <nl> + } <nl> <nl> private : <nl> / / Number of buffers for the compiled computation . <nl>
|
Add named size and count methods for arg , result and var methods to AOT models .
|
tensorflow/tensorflow
|
96f4a930dbdd1b5b3c73d262851bb0b867ea0117
|
2020-05-07T16:27:54Z
|
mmm a / torch / csrc / distributed / Module . cpp <nl> ppp b / torch / csrc / distributed / Module . cpp <nl> static std : : unordered_map < PyObject * , THDGroup > obj2group ; <nl> PyObject * THDPModule_initProcessGroup ( PyObject * _unused , PyObject * args ) <nl> { <nl> HANDLE_TH_ERRORS <nl> - if ( PyTuple_GET_SIZE ( args ) ! = 4 | | ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 0 ) ) | | <nl> + if ( PyTuple_GET_SIZE ( args ) ! = 5 | | ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 0 ) ) | | <nl> ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 1 ) ) | | <nl> ! THPUtils_checkLong ( PyTuple_GET_ITEM ( args , 2 ) ) | | <nl> - ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 3 ) ) ) { <nl> - THPUtils_invalidArguments ( args , NULL , " init_process_group " , 1 , " ( string backend , string init_method , int world_size , string world_size ) " ) ; <nl> + ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 3 ) ) | | <nl> + ! THPUtils_checkLong ( PyTuple_GET_ITEM ( args , 4 ) ) ) { <nl> + THPUtils_invalidArguments ( args , NULL , " init_process_group " , 1 , " ( string backend , string init_method , int world_size , string group_name , int rank ) " ) ; <nl> return NULL ; <nl> } <nl> <nl> PyObject * THDPModule_initProcessGroup ( PyObject * _unused , PyObject * args ) <nl> std : : string init_method = THPUtils_unpackString ( PyTuple_GET_ITEM ( args , 1 ) ) ; <nl> int world_size = THPUtils_unpackLong ( PyTuple_GET_ITEM ( args , 2 ) ) ; <nl> std : : string group_name = THPUtils_unpackString ( PyTuple_GET_ITEM ( args , 3 ) ) ; <nl> + int rank = THPUtils_unpackLong ( PyTuple_GET_ITEM ( args , 4 ) ) ; <nl> <nl> THDChannelType channel_type = name2channel_type . at ( backend_name ) ; <nl> - THDProcessGroupInit ( channel_type , init_method , world_size , group_name ) ; <nl> + THDProcessGroupInit ( channel_type , init_method , world_size , group_name , rank ) ; <nl> Py_RETURN_NONE ; <nl> END_HANDLE_TH_ERRORS <nl> } <nl> PyObject * THDPModule_initProcessGroup ( PyObject * _unused , PyObject * args ) <nl> PyObject * THDPModule_initMasterWorker ( PyObject * _unused , PyObject * args ) <nl> { <nl> HANDLE_TH_ERRORS <nl> - if ( PyTuple_GET_SIZE ( args ) ! = 4 | | ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 0 ) ) | | <nl> + if ( PyTuple_GET_SIZE ( args ) ! = 5 | | ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 0 ) ) | | <nl> ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 1 ) ) | | <nl> ! THPUtils_checkLong ( PyTuple_GET_ITEM ( args , 2 ) ) | | <nl> - ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 3 ) ) ) { <nl> - THPUtils_invalidArguments ( args , NULL , " init_master_worker " , 1 , " ( string backend , string init_method , int world_size , string world_size ) " ) ; <nl> + ! THPUtils_checkString ( PyTuple_GET_ITEM ( args , 3 ) ) | | <nl> + ! THPUtils_checkLong ( PyTuple_GET_ITEM ( args , 4 ) ) ) { <nl> + THPUtils_invalidArguments ( args , NULL , " init_master_worker " , 1 , " ( string backend , string init_method , int world_size , string group_name , int rank ) " ) ; <nl> return NULL ; <nl> } <nl> <nl> PyObject * THDPModule_initMasterWorker ( PyObject * _unused , PyObject * args ) <nl> std : : string init_method = THPUtils_unpackString ( PyTuple_GET_ITEM ( args , 1 ) ) ; <nl> int world_size = THPUtils_unpackLong ( PyTuple_GET_ITEM ( args , 2 ) ) ; <nl> std : : string group_name = THPUtils_unpackString ( PyTuple_GET_ITEM ( args , 3 ) ) ; <nl> + int rank = THPUtils_unpackLong ( PyTuple_GET_ITEM ( args , 4 ) ) ; <nl> <nl> THDChannelType channel_type = name2channel_type . at ( backend_name ) ; <nl> - THDMasterWorkerInit ( channel_type , init_method , world_size , group_name ) ; <nl> + THDMasterWorkerInit ( channel_type , init_method , world_size , group_name , rank ) ; <nl> Py_RETURN_NONE ; <nl> END_HANDLE_TH_ERRORS <nl> } <nl> mmm a / torch / distributed / __init__ . py <nl> ppp b / torch / distributed / __init__ . py <nl> def extend_scope ( module ) : <nl> _scope . update ( { k : getattr ( module , k ) for k in dir ( module ) if not k . startswith ( ' _ ' ) } ) <nl> <nl> <nl> - def init_process_group ( backend , init_method = ' env : / / ' , world_size = - 1 , group_name = ' ' ) : <nl> + def init_process_group ( backend , init_method = ' env : / / ' , world_size = - 1 , <nl> + group_name = ' ' , rank = - 1 ) : <nl> global _initialized <nl> if _initialized : <nl> raise RuntimeError ( " trying to initialize torch . distributed twice ! " ) <nl> - torch . _C . _dist_init_process_group ( backend , init_method , world_size , group_name ) <nl> + torch . _C . _dist_init_process_group ( backend , init_method , world_size , <nl> + group_name , rank ) <nl> _initialized = True <nl> import torch . distributed . collectives as collectives <nl> extend_scope ( collectives ) <nl> assert torch . _C . _dist_init_extension ( False , reduce_op , group ) <nl> <nl> <nl> - def init_master_worker ( backend , init_method = ' env : / / ' , world_size = - 1 , group_name = ' ' ) : <nl> + def init_master_worker ( backend , init_method = ' env : / / ' , world_size = - 1 , <nl> + group_name = ' ' , rank = - 1 ) : <nl> global _initialized <nl> if _initialized : <nl> raise RuntimeError ( " trying to initialize torch . distributed twice ! " ) <nl> - torch . _C . _dist_init_master_worker ( backend , init_method , world_size , group_name ) <nl> + torch . _C . _dist_init_master_worker ( backend , init_method , world_size , <nl> + group_name , rank ) <nl> _initialized = True <nl> import torch . distributed . collectives as collectives <nl> import torch . distributed . remote_types as remote_types <nl> mmm a / torch / lib / THD / base / DataChannel . cpp <nl> ppp b / torch / lib / THD / base / DataChannel . cpp <nl> <nl> <nl> namespace thd { <nl> <nl> - # define GET_CONFIG getInitConfig ( init_method , world_size , group_name ) <nl> + # define GET_CONFIG getInitConfig ( init_method , world_size , group_name , rank ) <nl> DataChannel * DataChannel : : newChannel ( THDChannelType type , std : : string init_method , <nl> - int world_size , std : : string group_name ) { <nl> + int world_size , std : : string group_name , <nl> + int rank ) { <nl> switch ( type ) { <nl> case THDChannelTCP : <nl> return new DataChannelTCP ( GET_CONFIG ) ; <nl> mmm a / torch / lib / THD / base / DataChannel . hpp <nl> ppp b / torch / lib / THD / base / DataChannel . hpp <nl> struct DataChannel { <nl> virtual THDGroup newGroup ( const std : : vector < rank_type > & ranks ) = 0 ; <nl> <nl> static DataChannel * newChannel ( THDChannelType type , std : : string init_method , <nl> - int world_size , std : : string group_name ) ; <nl> + int world_size , std : : string group_name , int rank ) ; <nl> } ; <nl> <nl> } / / namespace thd <nl> mmm a / torch / lib / THD / base / init_methods / InitMethod . cpp <nl> ppp b / torch / lib / THD / base / init_methods / InitMethod . cpp <nl> <nl> namespace thd { <nl> namespace init { <nl> <nl> - InitMethod : : Config initTCP ( std : : string argument , rank_type world_size , std : : string group_name ) ; <nl> - InitMethod : : Config initFile ( std : : string argument , rank_type world_size , std : : string group_name ) ; <nl> + InitMethod : : Config initTCP ( std : : string argument , rank_type world_size , <nl> + std : : string group_name , int rank ) ; <nl> + InitMethod : : Config initFile ( std : : string argument , rank_type world_size , <nl> + std : : string group_name , int rank ) ; <nl> InitMethod : : Config initEnv ( int world_size ) ; <nl> <nl> } <nl> <nl> InitMethod : : Config getInitConfig ( std : : string argument , int world_size , <nl> - std : : string group_name ) { <nl> + std : : string group_name , int rank ) { <nl> if ( argument . find ( " env : / / " ) = = 0 ) { <nl> return init : : initEnv ( world_size ) ; <nl> } else { <nl> InitMethod : : Config getInitConfig ( std : : string argument , int world_size , <nl> <nl> if ( argument . find ( " tcp : / / " ) = = 0 ) { <nl> argument . erase ( 0 , 6 ) ; / / chop " tcp : / / " <nl> - return init : : initTCP ( argument , r_world_size , group_name ) ; <nl> + return init : : initTCP ( argument , r_world_size , group_name , rank ) ; <nl> } else if ( argument . find ( " file : / / " ) = = 0 ) { <nl> argument . erase ( 0 , 7 ) ; / / chop " file : / / " <nl> - return init : : initFile ( argument , r_world_size , group_name ) ; <nl> + return init : : initFile ( argument , r_world_size , group_name , rank ) ; <nl> } <nl> } <nl> <nl> mmm a / torch / lib / THD / base / init_methods / InitMethod . hpp <nl> ppp b / torch / lib / THD / base / init_methods / InitMethod . hpp <nl> struct InitMethod { <nl> } ; <nl> <nl> InitMethod : : Config getInitConfig ( std : : string argument , int world_size = - 1 , <nl> - std : : string group_name = " " ) ; <nl> + std : : string group_name = " " , int rank = - 1 ) ; <nl> <nl> } / / namespace thd <nl> mmm a / torch / lib / THD / base / init_methods / InitMethodFile . cpp <nl> ppp b / torch / lib / THD / base / init_methods / InitMethodFile . cpp <nl> void unlockFile ( int fd ) { <nl> <nl> <nl> <nl> - InitMethod : : Config initFile ( std : : string file_path , rank_type world_size , std : : string group_name ) { <nl> + InitMethod : : Config initFile ( std : : string file_path , rank_type world_size , <nl> + std : : string group_name , int assigned_rank ) { <nl> InitMethod : : Config config ; <nl> int fd ; <nl> std : : fstream file ; <nl> InitMethod : : Config initFile ( std : : string file_path , rank_type world_size , std : : st <nl> <nl> / / This helps prevent a race when while we were waiting for the lock , <nl> / / the file has been removed from the fs <nl> - SYSCHECK ( fstat ( fd , & fd_stat ) ) ; <nl> + SYSCHECK ( : : fstat ( fd , & fd_stat ) ) ; <nl> int err = stat ( file_path . c_str ( ) , & path_stat ) ; <nl> if ( err = = 0 & & <nl> fd_stat . st_dev = = path_stat . st_dev & & <nl> InitMethod : : Config initFile ( std : : string file_path , rank_type world_size , std : : st <nl> } <nl> / / NOTE : the loop exits with a locked fd <nl> <nl> - config . rank = std : : count ( content . begin ( ) , content . end ( ) , ' \ n ' ) ; <nl> - if ( config . rank = = 0 ) { <nl> - int listen_socket ; <nl> - port_type port ; <nl> - std : : tie ( listen_socket , port ) = listen ( ) ; <nl> - <nl> - / / pack message for other workers ( we are first so we are master ) <nl> - file < < group_name < < ' ' < < port < < ' ' ; <nl> - for ( auto addr_str : getInterfaceAddresses ( ) ) { <nl> - file < < addr_str < < ' ' ; <nl> - } <nl> - file < < std : : endl ; <nl> + / / Remember our order number . <nl> + std : : size_t order = std : : count ( content . begin ( ) , content . end ( ) , ' \ n ' ) ; <nl> + <nl> + int listen_socket ; <nl> + port_type port ; <nl> + std : : tie ( listen_socket , port ) = listen ( ) ; <nl> + <nl> + auto ifa_addresses = getInterfaceAddresses ( ) ; <nl> + file < < group_name < < ' ' < < assigned_rank < < ' ' < < port <nl> + < < ' ' < < ifa_addresses . size ( ) ; <nl> + for ( auto addr_str : ifa_addresses ) { <nl> + file < < ' ' < < addr_str ; <nl> + } <nl> + file < < std : : endl ; <nl> <nl> - file . close ( ) ; <nl> + std : : size_t lines = 0 ; / / we have just added new line <nl> + while ( lines < world_size ) { / / wait until all processes will write their info <nl> unlockFile ( fd ) ; <nl> + std : : this_thread : : sleep_for ( std : : chrono : : milliseconds ( 200 ) ) ; <nl> + lockFile ( fd ) ; <nl> + <nl> + file . sync ( ) ; <nl> + file . seekp ( 0 , std : : ios_base : : beg ) ; <nl> + content = { std : : istreambuf_iterator < char > ( file ) , <nl> + std : : istreambuf_iterator < char > ( ) } ; <nl> + lines = std : : count ( content . begin ( ) , content . end ( ) , ' \ n ' ) ; <nl> + file . seekp ( 0 , std : : ios_base : : beg ) ; <nl> + } <nl> + / / NOTE : the loop exits with a locked fd <nl> + <nl> + port_type master_port ; <nl> + std : : vector < std : : string > master_addresses ; <nl> + std : : vector < int > ranks ( world_size ) ; <nl> + for ( std : : size_t i = 0 ; i < world_size ; + + i ) { <nl> + std : : string file_group_name , tmp_address ; <nl> + std : : size_t addresses_count ; <nl> + int rank ; <nl> + port_type tmp_port ; <nl> + <nl> + file > > file_group_name > > rank > > tmp_port > > addresses_count ; <nl> + if ( file_group_name ! = group_name ) { <nl> + throw std : : logic_error ( " file_group_name ! = group_name " ) ; <nl> + } <nl> + <nl> + std : : vector < std : : string > tmp_addresses ( addresses_count ) ; <nl> + for ( std : : size_t j = 0 ; j < addresses_count ; + + j ) { <nl> + file > > tmp_address ; <nl> + tmp_addresses . emplace ( tmp_addresses . begin ( ) + j , tmp_address ) ; <nl> + } <nl> + <nl> + ranks [ i ] = rank ; <nl> + / / Whether there is already assigned rank 0 , or we have to get addresses and port <nl> + / / from first process which has unassigned rank ( it will be rank 0 ) . <nl> + if ( rank = = 0 | | ( rank < 0 & & master_addresses . size ( ) = = 0 ) ) { <nl> + master_port = tmp_port ; <nl> + master_addresses = tmp_addresses ; <nl> + } <nl> + } <nl> + <nl> + if ( assigned_rank > = 0 ) { <nl> + config . rank = assigned_rank ; <nl> + } else { <nl> + / / Calculate how many unassigned there was before us ( including us ) . <nl> + std : : size_t unassigned = 1 + std : : count_if ( ranks . begin ( ) , ranks . begin ( ) + order , <nl> + [ ] ( int rank ) { return rank < 0 ; } ) ; <nl> + <nl> + / / Calculate actual rank by finding ` unassigned ` number of empty ranks . <nl> + for ( std : : size_t rank = 0 ; rank < world_size & & unassigned > 0 ; + + rank ) { <nl> + if ( std : : find ( ranks . begin ( ) , ranks . end ( ) , rank ) = = ranks . end ( ) ) { <nl> + unassigned - - ; <nl> + } <nl> + <nl> + if ( unassigned = = 0 ) config . rank = rank ; <nl> + } <nl> + } <nl> + <nl> + file < < std : : endl ; / / reserve our rank <nl> <nl> + / / Member which is last to use the file has to remove it . <nl> + if ( lines = = 2 * world_size - 1 ) { <nl> + : : remove ( file_path . c_str ( ) ) ; <nl> + } <nl> + <nl> + file . close ( ) ; <nl> + unlockFile ( fd ) ; <nl> + <nl> + if ( config . rank = = 0 ) { <nl> config . public_address = discoverWorkers ( listen_socket , world_size ) ; <nl> config . master = { <nl> . world_size = world_size , <nl> . listen_socket = listen_socket , <nl> - . listen_port = port , <nl> + . listen_port = master_port , <nl> } ; <nl> } else { <nl> - file < < std : : endl ; / / reserve our rank <nl> - file . seekp ( 0 , std : : ios_base : : beg ) ; <nl> - <nl> - std : : string file_group_name ; <nl> - port_type port ; <nl> - file > > file_group_name > > port ; <nl> - std : : vector < std : : string > addresses = <nl> - { std : : istream_iterator < std : : string > ( file ) , <nl> - std : : istream_iterator < std : : string > ( ) } ; <nl> - <nl> - / / Last member to join removes the file <nl> - if ( file_group_name ! = group_name ) throw std : : logic_error ( " file_group_name ! = group_name " ) ; <nl> - if ( config . rank = = world_size - 1 ) { <nl> - : : remove ( file_path . c_str ( ) ) ; <nl> - } <nl> - <nl> - file . close ( ) ; <nl> - unlockFile ( fd ) ; <nl> + : : close ( listen_socket ) ; <nl> <nl> std : : string master_address ; <nl> - std : : tie ( master_address , config . public_address ) = discoverMaster ( addresses , port ) ; <nl> + std : : tie ( master_address , config . public_address ) = discoverMaster ( master_addresses , master_port ) ; <nl> config . worker = { <nl> . address = master_address , <nl> - . port = port , <nl> + . port = master_port , <nl> } ; <nl> } <nl> <nl> mmm a / torch / lib / THD / base / init_methods / InitMethodTCP . cpp <nl> ppp b / torch / lib / THD / base / init_methods / InitMethodTCP . cpp <nl> struct MulticastMessage { <nl> std : : string group_name ; <nl> std : : vector < std : : string > addresses ; <nl> port_type port ; <nl> + int rank ; <nl> <nl> - MulticastMessage ( std : : string group_name , port_type port ) <nl> + MulticastMessage ( std : : string group_name , port_type port , int rank ) <nl> : uid ( getRandomString ( ) ) <nl> , group_name ( group_name ) <nl> , addresses ( getInterfaceAddresses ( ) ) <nl> - , port ( port ) { } <nl> + , port ( port ) <nl> + , rank ( rank ) { } <nl> <nl> MulticastMessage ( std : : string msg ) { <nl> std : : istringstream ss { msg } ; <nl> - ss > > uid > > group_name > > port ; <nl> + ss > > uid > > group_name > > port > > rank ; <nl> addresses = { std : : istream_iterator < std : : string > ( ss ) , <nl> std : : istream_iterator < std : : string > ( ) } ; <nl> } <nl> <nl> std : : string pack ( ) { <nl> std : : ostringstream ss ; <nl> - ss < < uid < < ' ' < < group_name < < ' ' < < port < < ' ' ; <nl> + ss < < uid < < ' ' < < group_name < < ' ' < < port < < ' ' < < rank ; <nl> for ( const auto & address : addresses ) { <nl> - ss < < address < < ' ' ; <nl> + ss < < ' ' < < address ; <nl> } <nl> return ss . str ( ) ; <nl> } <nl> bool isMulticastAddress ( struct sockaddr * address ) { <nl> } <nl> } <nl> <nl> - int bindMulticastSocket ( struct sockaddr * address , struct sockaddr_storage * sock_addr , int timeout_sec = 1 , int ttl = 1 ) { <nl> + int bindMulticastSocket ( struct sockaddr * address , struct sockaddr_storage * sock_addr , <nl> + int timeout_sec = 1 , int ttl = 1 ) { <nl> struct timeval timeout = { . tv_sec = timeout_sec , . tv_usec = 0 } ; <nl> <nl> int socket , optval ; <nl> InitMethod : : Config initTCPMaster ( struct sockaddr * addr ) { <nl> throw std : : runtime_error ( " non - multicast tcp initialization not supported " ) ; <nl> } <nl> <nl> - InitMethod : : Config initTCPMulticast ( std : : string group_name , rank_type world_size , struct sockaddr * addr ) { <nl> + InitMethod : : Config initTCPMulticast ( std : : string group_name , rank_type world_size , <nl> + int assigned_rank , struct sockaddr * addr ) { <nl> InitMethod : : Config config ; <nl> struct sockaddr_storage sock_addr ; <nl> int socket = bindMulticastSocket ( addr , & sock_addr ) ; <nl> InitMethod : : Config initTCPMulticast ( std : : string group_name , rank_type world_size <nl> int listen_socket ; <nl> port_type listen_port ; <nl> std : : tie ( listen_socket , listen_port ) = listen ( ) ; <nl> - MulticastMessage msg { group_name , listen_port } ; <nl> + MulticastMessage msg { group_name , listen_port , assigned_rank } ; <nl> <nl> std : : string packed_msg = msg . pack ( ) ; <nl> std : : set < std : : string > processes ; <nl> InitMethod : : Config initTCPMulticast ( std : : string group_name , rank_type world_size <nl> std : : this_thread : : sleep_for ( std : : chrono : : milliseconds ( 50 ) ) ; <nl> broadcast ( ) ; <nl> <nl> - auto master_msg = MulticastMessage ( * processes . begin ( ) ) ; <nl> - std : : size_t rank = 0 ; <nl> - for ( auto it = processes . begin ( ) ; it ! = processes . end ( ) ; + + it , + + rank ) { <nl> - auto packed_recv_msg = * it ; <nl> - auto recv_msg = MulticastMessage ( packed_recv_msg ) ; <nl> + std : : vector < std : : string > tmp_processes ( processes . begin ( ) , processes . end ( ) ) ; <nl> + std : : vector < std : : string > arranged_processes ( processes . size ( ) ) ; <nl> <nl> - if ( packed_msg = = packed_recv_msg ) { <nl> + / / Put already assigned ranks on their place <nl> + for ( std : : size_t i = 0 ; i < processes . size ( ) ; + + i ) { <nl> + auto recv_msg = MulticastMessage ( tmp_processes [ i ] ) ; <nl> + if ( recv_msg . rank > = 0 ) { <nl> + arranged_processes [ recv_msg . rank ] = tmp_processes [ i ] ; <nl> + } <nl> + } <nl> + <nl> + / / Put rest ( not assigned ) in sort order <nl> + std : : size_t last_pos = 0 ; <nl> + for ( std : : size_t i = 0 ; i < processes . size ( ) ; + + i ) { <nl> + if ( arranged_processes [ i ] . empty ( ) ) { / / not assigned place <nl> + for ( std : : size_t j = last_pos ; j < processes . size ( ) ; + + j ) { <nl> + auto recv_msg = MulticastMessage ( tmp_processes [ j ] ) ; <nl> + if ( recv_msg . rank < 0 ) { <nl> + last_pos = j ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + arranged_processes [ i ] = tmp_processes [ last_pos ] ; <nl> + last_pos + + ; <nl> + } <nl> + } <nl> + <nl> + auto master_msg = MulticastMessage ( arranged_processes [ 0 ] ) ; <nl> + for ( std : : size_t rank = 0 ; rank < arranged_processes . size ( ) ; + + rank ) { <nl> + if ( packed_msg = = arranged_processes [ rank ] ) { <nl> config . rank = rank ; <nl> if ( config . rank = = 0 ) { <nl> config . master = { <nl> InitMethod : : Config initTCPMulticast ( std : : string group_name , rank_type world_size <nl> <nl> } / / anonymous namespace <nl> <nl> - InitMethod : : Config initTCP ( std : : string argument , rank_type world_size , std : : string group_name ) { <nl> + InitMethod : : Config initTCP ( std : : string argument , rank_type world_size , <nl> + std : : string group_name , int rank ) { <nl> / / Parse arguments <nl> std : : string address , str_port ; <nl> std : : tie ( address , str_port ) = splitAddress ( argument ) ; <nl> InitMethod : : Config initTCP ( std : : string argument , rank_type world_size , std : : stri <nl> if ( head - > ai_family ! = AF_INET & & head - > ai_family ! = AF_INET6 ) continue ; <nl> try { <nl> if ( isMulticastAddress ( head - > ai_addr ) ) { <nl> - return initTCPMulticast ( group_name , world_size , head - > ai_addr ) ; <nl> + return initTCPMulticast ( group_name , world_size , rank , head - > ai_addr ) ; <nl> } else { <nl> return initTCPMaster ( head - > ai_addr ) ; <nl> } <nl> mmm a / torch / lib / THD / master_worker / master / Master . cpp <nl> ppp b / torch / lib / THD / master_worker / master / Master . cpp <nl> std : : unique_ptr < MasterCommandChannel > masterCommandChannel ; <nl> using namespace thd ; <nl> using namespace thd : : master ; <nl> <nl> - void THDMasterWorkerInit ( THDChannelType channel_type , std : : string init_method , <nl> - int world_size , std : : string group_name ) { <nl> + void THDMasterWorkerInit ( THDChannelType channel_type , std : : string init_method = " env : / / " , <nl> + int world_size = - 1 , std : : string group_name = " " , <nl> + int rank = - 1 ) { <nl> HANDLE_EXCEPTIONS <nl> - THDProcessGroupInit ( channel_type , init_method , world_size , group_name ) ; <nl> + THDProcessGroupInit ( channel_type , init_method , world_size , group_name , rank ) ; <nl> <nl> if ( dataChannel - > getRank ( ) > 0 ) { <nl> / * <nl> void THDMasterWorkerInit ( THDChannelType channel_type , std : : string init_method , <nl> * for commands from master . Returning from ` THDWorkerMain ` indicates <nl> * a failure so it will ` return false ` . <nl> * / <nl> - THDWorkerMain ( init_method , world_size , group_name ) ; <nl> + THDWorkerMain ( init_method , world_size , group_name , dataChannel - > getRank ( ) ) ; <nl> THError ( " unexpected exit from worker main loop " ) ; <nl> } <nl> <nl> THDState : : s_workers = std : : vector < WorkerState > ( dataChannel - > getNumProcesses ( ) ) ; <nl> <nl> - InitMethod : : Config config = getInitConfig ( init_method , world_size , group_name ) ; <nl> + InitMethod : : Config config = getInitConfig ( init_method , world_size , group_name , <nl> + dataChannel - > getRank ( ) ) ; <nl> masterCommandChannel . reset ( new MasterCommandChannel ( config ) ) ; <nl> masterCommandChannel - > init ( ) ; <nl> <nl> mmm a / torch / lib / THD / master_worker / master / Master . h <nl> ppp b / torch / lib / THD / master_worker / master / Master . h <nl> <nl> # include " . . / . . / THD . h " <nl> # include < string > <nl> <nl> - THD_API void THDMasterWorkerInit ( THDChannelType channel_type , std : : string init_method = " env : / / " , <nl> - int world_size = - 1 , std : : string group_name = " " ) ; <nl> + THD_API void THDMasterWorkerInit ( THDChannelType channel_type , std : : string init_method , <nl> + int world_size , std : : string group_name , int rank ) ; <nl> mmm a / torch / lib / THD / master_worker / worker / Worker . cpp <nl> ppp b / torch / lib / THD / master_worker / worker / Worker . cpp <nl> std : : unordered_map < object_id_type , std : : unique_ptr < thpp : : Generator > > workerGener <nl> using namespace thd : : rpc ; <nl> using namespace thd : : worker ; <nl> <nl> - void THDWorkerMain ( std : : string init_method , int world_size , std : : string group_name ) { <nl> - thd : : InitMethod : : Config config = thd : : getInitConfig ( init_method , world_size , group_name ) ; <nl> + void THDWorkerMain ( std : : string init_method , int world_size , <nl> + std : : string group_name , int rank ) { <nl> + thd : : InitMethod : : Config config = thd : : getInitConfig ( init_method , world_size , <nl> + group_name , rank ) ; <nl> std : : unique_ptr < RPCMessage > command ; <nl> workerCommandChannel . reset ( new thd : : WorkerCommandChannel ( config ) ) ; <nl> if ( ! workerCommandChannel - > init ( ) ) { <nl> mmm a / torch / lib / THD / master_worker / worker / Worker . h <nl> ppp b / torch / lib / THD / master_worker / worker / Worker . h <nl> <nl> # include < string > <nl> <nl> THD_API void THDWorkerMain ( std : : string init_method , int world_size , <nl> - std : : string group_name ) ; <nl> + std : : string group_name , int rank ) ; <nl> mmm a / torch / lib / THD / process_group / General . cpp <nl> ppp b / torch / lib / THD / process_group / General . cpp <nl> std : : unique_ptr < DataChannel > dataChannel ; <nl> <nl> using namespace thd ; <nl> <nl> - void THDProcessGroupInit ( THDChannelType channel_type , std : : string init_method , <nl> - int world_size , std : : string group_name ) { <nl> + void THDProcessGroupInit ( THDChannelType channel_type , std : : string init_method = " env : / / " , <nl> + int world_size = - 1 , std : : string group_name = " " , int rank = - 1 ) { <nl> HANDLE_EXCEPTIONS <nl> dataChannel = std : : unique_ptr < DataChannel > ( <nl> thd : : DataChannel : : newChannel ( channel_type , init_method , world_size , <nl> - group_name ) ) ; <nl> + group_name , rank ) ) ; <nl> dataChannel - > init ( ) ; <nl> END_HANDLE_EXCEPTIONS <nl> } <nl> mmm a / torch / lib / THD / process_group / General . h <nl> ppp b / torch / lib / THD / process_group / General . h <nl> <nl> # include " . . / THD . h " <nl> # include < string > <nl> <nl> - THD_API void THDProcessGroupInit ( THDChannelType channel_type , std : : string init_method = " env : / / " , <nl> - int world_size = - 1 , std : : string group_name = " " ) ; <nl> + THD_API void THDProcessGroupInit ( THDChannelType channel_type , std : : string init_method , <nl> + int world_size , std : : string group_name , int rank ) ; <nl> <nl>
|
Add rank parameter ; Fix MW mode initalization
|
pytorch/pytorch
|
c41555fb0a4cc53b52bd19b60663d34699914cb3
|
2017-06-02T21:42:11Z
|
mmm a / spec - main / api - autoupdater - darwin - spec . ts <nl> ppp b / spec - main / api - autoupdater - darwin - spec . ts <nl> describeFn ( ' autoUpdater behavior ' , function ( ) { <nl> beforeEach ( function ( ) { <nl> const result = cp . spawnSync ( path . resolve ( __dirname , ' . . / script / codesign / get - trusted - identity . sh ' ) ) <nl> if ( result . status ! = = 0 | | result . stdout . toString ( ) . trim ( ) . length = = = 0 ) { <nl> - if ( isCI ) { <nl> + / / Per https : / / circleci . com / docs / 2 . 0 / env - vars : <nl> + / / CIRCLE_PR_NUMBER is only present on forked PRs <nl> + if ( isCI & & ! process . env . CIRCLE_PR_NUMBER ) { <nl> throw new Error ( ' No valid signing identity available to run autoUpdater specs ' ) <nl> } <nl> this . skip ( ) <nl>
|
spec : don ' t run codesigning spec on forks ( )
|
electron/electron
|
62e6957f68d2b6a3c61cad7b3d894c7b8c25b917
|
2019-07-24T17:55:16Z
|
mmm a / dbms / src / AggregateFunctions / AggregateFunctionGroupArray . h <nl> ppp b / dbms / src / AggregateFunctions / AggregateFunctionGroupArray . h <nl> struct GroupArrayListNodeBase <nl> / / / Clones existing node ( does not modify next field ) <nl> Node * clone ( Arena * arena ) <nl> { <nl> - return reinterpret_cast < Node * > ( const_cast < char * > ( arena - > insert ( reinterpret_cast < char * > ( this ) , sizeof ( Node ) + size ) ) ) ; <nl> + return reinterpret_cast < Node * > ( const_cast < char * > ( arena - > alignedInsert ( reinterpret_cast < char * > ( this ) , sizeof ( Node ) + size , alignof ( Node ) ) ) ) ; <nl> } <nl> <nl> / / / Write node to buffer <nl>
|
Respect alignment in groupArray function [ # CLICKHOUSE - 2 ]
|
ClickHouse/ClickHouse
|
6acd58ee60de3d7362ac4bfd1f974aa317aa4cc9
|
2018-09-02T19:53:35Z
|
mmm a / java / Makefile <nl> ppp b / java / Makefile <nl> NATIVE_JAVA_CLASSES = org . rocksdb . AbstractComparator \ <nl> org . rocksdb . test . WriteBatchInternal \ <nl> org . rocksdb . test . WriteBatchTest \ <nl> org . rocksdb . WriteOptions \ <nl> + org . rocksdb . WriteBatchWithIndex \ <nl> + org . rocksdb . WBWIRocksIterator <nl> <nl> ROCKSDB_MAJOR = $ ( shell egrep " ROCKSDB_MAJOR . [ 0 - 9 ] " . . / include / rocksdb / version . h | cut - d ' ' - f 3 ) <nl> ROCKSDB_MINOR = $ ( shell egrep " ROCKSDB_MINOR . [ 0 - 9 ] " . . / include / rocksdb / version . h | cut - d ' ' - f 3 ) <nl> new file mode 100644 <nl> index 0000000000 . . aafe3aca61 <nl> mmm / dev / null <nl> ppp b / java / org / rocksdb / WBWIRocksIterator . java <nl> <nl> + / / Copyright ( c ) 2014 , Facebook , Inc . All rights reserved . <nl> + / / This source code is licensed under the BSD - style license found in the <nl> + / / LICENSE file in the root directory of this source tree . An additional grant <nl> + / / of patent rights can be found in the PATENTS file in the same directory . <nl> + <nl> + package org . rocksdb ; <nl> + <nl> + public class WBWIRocksIterator extends RocksObject implements RocksIteratorInterface { <nl> + <nl> + / / TODO ( AR ) abstract common code from WBWIRocksIterator and RocksIterator into AbstractRocksIterator <nl> + <nl> + final WriteBatchWithIndex wbwi_ ; <nl> + <nl> + protected WBWIRocksIterator ( WriteBatchWithIndex wbwi , long nativeHandle ) { <nl> + super ( ) ; <nl> + nativeHandle_ = nativeHandle ; <nl> + / / rocksDB must point to a valid RocksDB instance . <nl> + assert ( wbwi ! = null ) ; <nl> + / / WBWIRocksIterator must hold a reference to the related WriteBatchWithIndex instance <nl> + / / to guarantee that while a GC cycle starts WBWIRocksIterator instances <nl> + / / are freed prior to WriteBatchWithIndex instances . <nl> + wbwi_ = wbwi ; <nl> + } <nl> + <nl> + @ Override <nl> + public boolean isValid ( ) { <nl> + return false ; <nl> + } <nl> + <nl> + @ Override <nl> + public void seekToFirst ( ) { <nl> + <nl> + } <nl> + <nl> + @ Override <nl> + public void seekToLast ( ) { <nl> + <nl> + } <nl> + <nl> + @ Override <nl> + public void seek ( byte [ ] target ) { <nl> + <nl> + } <nl> + <nl> + @ Override <nl> + public void next ( ) { <nl> + <nl> + } <nl> + <nl> + @ Override <nl> + public void prev ( ) { <nl> + <nl> + } <nl> + <nl> + / * * <nl> + * Get the current entry <nl> + * / <nl> + public WriteEntry entry ( ) { <nl> + throw new UnsupportedOperationException ( " NOT YET IMPLEMENTED " ) ; / / TODO ( AR ) implement <nl> + } <nl> + <nl> + @ Override <nl> + public void status ( ) throws RocksDBException { <nl> + <nl> + } <nl> + <nl> + / * * <nl> + * < p > Deletes underlying C + + iterator pointer . < / p > <nl> + * < p / > <nl> + * < p > Note : the underlying handle can only be safely deleted if the WriteBatchWithIndex <nl> + * instance related to a certain WBWIRocksIterator is still valid and initialized . <nl> + * Therefore { @ code disposeInternal ( ) } checks if the WriteBatchWithIndex is initialized <nl> + * before freeing the native handle . < / p > <nl> + * / <nl> + @ Override <nl> + protected void disposeInternal ( ) { <nl> + synchronized ( wbwi_ ) { <nl> + assert ( isInitialized ( ) ) ; <nl> + if ( wbwi_ . isInitialized ( ) ) { <nl> + disposeInternal ( nativeHandle_ ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + private native void disposeInternal ( long handle ) ; <nl> + <nl> + / * * <nl> + * Enumeration of the Write operation <nl> + * that created the record in the Write Batch <nl> + * / <nl> + public enum WriteType { <nl> + PutRecord , <nl> + MergeRecord , <nl> + DeleteRecord , <nl> + LogDataRecord <nl> + } <nl> + <nl> + / * * <nl> + * Represents the entry returned by a <nl> + * WBWIRocksIterator <nl> + * / <nl> + public static class WriteEntry { <nl> + final WriteType type ; <nl> + final Slice key ; <nl> + final Slice value ; <nl> + <nl> + public WriteEntry ( final WriteType type , final Slice key , final Slice value ) { <nl> + this . type = type ; <nl> + this . key = key ; <nl> + this . value = value ; <nl> + } <nl> + <nl> + public WriteType getType ( ) { <nl> + return type ; <nl> + } <nl> + <nl> + public Slice getKey ( ) { <nl> + return key ; <nl> + } <nl> + <nl> + public Slice getValue ( ) { <nl> + return value ; <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . bb42dc3d77 <nl> mmm / dev / null <nl> ppp b / java / org / rocksdb / WriteBatchWithIndex . java <nl> <nl> + / / Copyright ( c ) 2014 , Facebook , Inc . All rights reserved . <nl> + / / This source code is licensed under the BSD - style license found in the <nl> + / / LICENSE file in the root directory of this source tree . An additional grant <nl> + / / of patent rights can be found in the PATENTS file in the same directory . <nl> + <nl> + package org . rocksdb ; <nl> + <nl> + / * * <nl> + * Similar to { @ link org . rocksdb . WriteBatch } but with a binary searchable <nl> + * index built for all the keys inserted . <nl> + * <nl> + * Calling put , merge , remove or putLogData calls the same function <nl> + * as with { @ link org . rocksdb . WriteBatch } whilst also building an index . <nl> + * <nl> + * A user can call { @ link org . rocksdb . WriteBatchWithIndex # newIterator ( ) } to create an iterator <nl> + * over the write batch or <nl> + * { @ link org . rocksdb . WriteBatchWithIndex # newIteratorWithBase ( org . rocksdb . RocksIterator ) } to <nl> + * get an iterator for the database with Read - Your - Own - Writes like capability <nl> + * / <nl> + public class WriteBatchWithIndex extends AbstractWriteBatch { <nl> + <nl> + / / TODO ( AR ) need to cover directly passing WriteBatchWithIndex to { @ see org . rocksdb . RocksDB # write ( WriteBatch ) <nl> + / / this simplifies the Java API beyond the C + + API as you don ' t need to call <nl> + / / GetWriteBatch on the WriteBatchWithIndex <nl> + <nl> + / * * <nl> + * Creates a WriteBatchWithIndex where no bytes <nl> + * are reserved up - front , bytewise comparison is <nl> + * used for fallback key comparisons , <nl> + * and duplicate keys operations are retained <nl> + * / <nl> + public WriteBatchWithIndex ( ) { <nl> + super ( ) ; <nl> + newWriteBatchWithIndex ( ) ; <nl> + } <nl> + <nl> + <nl> + / * * <nl> + * Creates a WriteBatchWithIndex where no bytes <nl> + * are reserved up - front , bytewise comparison is <nl> + * used for fallback key comparisons , and duplicate key <nl> + * assignment is determined by the constructor argument <nl> + * <nl> + * @ param overwriteKey if true , overwrite the key in the index when <nl> + * inserting a duplicate key , in this way an iterator will never <nl> + * show two entries with the same key . <nl> + * / <nl> + public WriteBatchWithIndex ( boolean overwriteKey ) { <nl> + super ( ) ; <nl> + newWriteBatchWithIndex ( overwriteKey ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Creates a WriteBatchWithIndex <nl> + * <nl> + * @ param fallbackIndexComparator We fallback to this comparator <nl> + * to compare keys within a column family if we cannot determine <nl> + * the column family and so look up it ' s comparator . <nl> + * @ param reservedBytes reserved bytes in underlying WriteBatch <nl> + * @ param overwriteKey if true , overwrite the key in the index when <nl> + * inserting a duplicate key , in this way an iterator will never <nl> + * show two entries with the same key . <nl> + * / <nl> + public WriteBatchWithIndex ( AbstractComparator fallbackIndexComparator , int reservedBytes , <nl> + boolean overwriteKey ) { <nl> + super ( ) ; <nl> + newWriteBatchWithIndex ( fallbackIndexComparator . nativeHandle_ , reservedBytes , overwriteKey ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Create an iterator of a column family . User can call <nl> + * { @ link org . rocksdb . RocksIteratorInterface # seek ( byte [ ] ) } to <nl> + * search to the next entry of or after a key . Keys will be iterated in the <nl> + * order given by index_comparator . For multiple updates on the same key , <nl> + * each update will be returned as a separate entry , in the order of update <nl> + * time . <nl> + * <nl> + * @ param columnFamilyHandle The column family to iterate over <nl> + * @ return An iterator for the Write Batch contents , restricted to the column family <nl> + * / <nl> + public WBWIRocksIterator newIterator ( ColumnFamilyHandle columnFamilyHandle ) { <nl> + return new WBWIRocksIterator ( this , iterator1 ( columnFamilyHandle . nativeHandle_ ) ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Create an iterator of the default column family . User can call <nl> + * { @ link org . rocksdb . RocksIteratorInterface # seek ( byte [ ] ) } to <nl> + * search to the next entry of or after a key . Keys will be iterated in the <nl> + * order given by index_comparator . For multiple updates on the same key , <nl> + * each update will be returned as a separate entry , in the order of update <nl> + * time . <nl> + * <nl> + * @ return An iterator for the Write Batch contents <nl> + * / <nl> + public WBWIRocksIterator newIterator ( ) { <nl> + return new WBWIRocksIterator ( this , iterator0 ( ) ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Provides Read - Your - Own - Writes like functionality by <nl> + * creating a new Iterator that will use { @ link org . rocksdb . WBWIRocksIterator } <nl> + * as a delta and baseIterator as a base <nl> + * <nl> + * @ param columnFamilyHandle The column family to iterate over <nl> + * @ param baseIterator The base iterator , e . g . { @ link org . rocksdb . RocksDB # newIterator ( ) } <nl> + * @ return An iterator which shows a view comprised of both the database point - in - time <nl> + * from baseIterator and modifications made in this write batch . <nl> + * / <nl> + public RocksIterator newIteratorWithBase ( ColumnFamilyHandle columnFamilyHandle , <nl> + RocksIterator baseIterator ) { <nl> + RocksIterator iterator = new RocksIterator ( <nl> + baseIterator . rocksDB_ , <nl> + iteratorWithBase ( columnFamilyHandle . nativeHandle_ , baseIterator . nativeHandle_ ) ) ; <nl> + <nl> + / / when the iterator is deleted it will also delete the baseIterator <nl> + baseIterator . disOwnNativeHandle ( ) ; <nl> + return iterator ; <nl> + } <nl> + <nl> + / * * <nl> + * Provides Read - Your - Own - Writes like functionality by <nl> + * creating a new Iterator that will use { @ link org . rocksdb . WBWIRocksIterator } <nl> + * as a delta and baseIterator as a base . Operates on the default column family . <nl> + * <nl> + * @ param baseIterator The base iterator , e . g . { @ link org . rocksdb . RocksDB # newIterator ( ) } <nl> + * @ return An iterator which shows a view comprised of both the database point - in - time <nl> + * from baseIterator and modifications made in this write batch . <nl> + * / <nl> + public RocksIterator newIteratorWithBase ( RocksIterator baseIterator ) { <nl> + return newIteratorWithBase ( baseIterator . rocksDB_ . getDefaultColumnFamily ( ) , baseIterator ) ; <nl> + } <nl> + <nl> + @ Override final native void disposeInternal ( long handle ) ; <nl> + @ Override final native int count0 ( ) ; <nl> + @ Override final native void put ( byte [ ] key , int keyLen , byte [ ] value , int valueLen ) ; <nl> + @ Override final native void put ( byte [ ] key , int keyLen , byte [ ] value , int valueLen , <nl> + long cfHandle ) ; <nl> + @ Override final native void merge ( byte [ ] key , int keyLen , byte [ ] value , int valueLen ) ; <nl> + @ Override final native void merge ( byte [ ] key , int keyLen , byte [ ] value , int valueLen , <nl> + long cfHandle ) ; <nl> + @ Override final native void remove ( byte [ ] key , int keyLen ) ; <nl> + @ Override final native void remove ( byte [ ] key , int keyLen , long cfHandle ) ; <nl> + @ Override final native void putLogData ( byte [ ] blob , int blobLen ) ; <nl> + @ Override final native void clear0 ( ) ; <nl> + <nl> + private native void newWriteBatchWithIndex ( ) ; <nl> + private native void newWriteBatchWithIndex ( boolean overwriteKey ) ; <nl> + private native void newWriteBatchWithIndex ( long fallbackIndexComparatorHandle , int reservedBytes , <nl> + boolean overwriteKey ) ; <nl> + private native long iterator0 ( ) ; <nl> + private native long iterator1 ( long cfHandle ) ; <nl> + private native long iteratorWithBase ( long baseIteratorHandle , long cfHandle ) ; <nl> + } <nl> mmm a / java / rocksjni / portal . h <nl> ppp b / java / rocksjni / portal . h <nl> <nl> # include " rocksdb / filter_policy . h " <nl> # include " rocksdb / status . h " <nl> # include " rocksdb / utilities / backupable_db . h " <nl> + # include " rocksdb / utilities / write_batch_with_index . h " <nl> # include " rocksjni / comparatorjnicallback . h " <nl> # include " rocksjni / writebatchhandlerjnicallback . h " <nl> <nl> class WriteBatchHandlerJni { <nl> } <nl> } ; <nl> <nl> + class WriteBatchWithIndexJni { <nl> + public : <nl> + static jclass getJClass ( JNIEnv * env ) { <nl> + jclass jclazz = env - > FindClass ( " org / rocksdb / WriteBatchWithIndex " ) ; <nl> + assert ( jclazz ! = nullptr ) ; <nl> + return jclazz ; <nl> + } <nl> + <nl> + static jfieldID getHandleFieldID ( JNIEnv * env ) { <nl> + static jfieldID fid = env - > GetFieldID ( <nl> + getJClass ( env ) , " nativeHandle_ " , " J " ) ; <nl> + assert ( fid ! = nullptr ) ; <nl> + return fid ; <nl> + } <nl> + <nl> + / / Get the pointer to rocksdb : : WriteBatchWithIndex of the specified <nl> + / / org . rocksdb . WriteBatchWithIndex . <nl> + static rocksdb : : WriteBatchWithIndex * getHandle ( JNIEnv * env , jobject jwbwi ) { <nl> + return reinterpret_cast < rocksdb : : WriteBatchWithIndex * > ( <nl> + env - > GetLongField ( jwbwi , getHandleFieldID ( env ) ) ) ; <nl> + } <nl> + <nl> + / / Pass the rocksdb : : WriteBatchWithIndex pointer to the java side . <nl> + static void setHandle ( JNIEnv * env , jobject jwbwi , <nl> + rocksdb : : WriteBatchWithIndex * wbwi ) { <nl> + env - > SetLongField ( <nl> + jwbwi , getHandleFieldID ( env ) , <nl> + reinterpret_cast < jlong > ( wbwi ) ) ; <nl> + } <nl> + } ; <nl> + <nl> class HistogramDataJni { <nl> public : <nl> static jmethodID getConstructorMethodId ( JNIEnv * env , jclass jclazz ) { <nl> new file mode 100644 <nl> index 0000000000 . . 3d04b4ddd0 <nl> mmm / dev / null <nl> ppp b / java / rocksjni / write_batch_with_index . cc <nl> <nl> + / / Copyright ( c ) 2014 , Facebook , Inc . All rights reserved . <nl> + / / This source code is licensed under the BSD - style license found in the <nl> + / / LICENSE file in the root directory of this source tree . An additional grant <nl> + / / of patent rights can be found in the PATENTS file in the same directory . <nl> + / / <nl> + / / This file implements the " bridge " between Java and C + + and enables <nl> + / / calling c + + rocksdb : : WriteBatchWithIndex methods from Java side . <nl> + <nl> + # include " include / org_rocksdb_WriteBatchWithIndex . h " <nl> + # include " rocksjni / portal . h " <nl> + # include " rocksdb / comparator . h " <nl> + # include " rocksdb / utilities / write_batch_with_index . h " <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : newWriteBatchWithIndex <nl> + * Signature : ( ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__ ( <nl> + JNIEnv * env , jobject jobj ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = new rocksdb : : WriteBatchWithIndex ( ) ; <nl> + rocksdb : : WriteBatchWithIndexJni : : setHandle ( env , jobj , wbwi ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : newWriteBatchWithIndex <nl> + * Signature : ( Z ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__Z ( <nl> + JNIEnv * env , jobject jobj , jboolean joverwrite_key ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + new rocksdb : : WriteBatchWithIndex ( rocksdb : : BytewiseComparator ( ) , 0 , <nl> + static_cast < bool > ( joverwrite_key ) ) ; <nl> + rocksdb : : WriteBatchWithIndexJni : : setHandle ( env , jobj , wbwi ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : newWriteBatchWithIndex <nl> + * Signature : ( JIZ ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_newWriteBatchWithIndex__JIZ ( <nl> + JNIEnv * env , jobject jobj , jlong jfallback_index_comparator_handle , <nl> + jint jreserved_bytes , jboolean joverwrite_key ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + new rocksdb : : WriteBatchWithIndex ( <nl> + reinterpret_cast < rocksdb : : Comparator * > ( jfallback_index_comparator_handle ) , <nl> + static_cast < size_t > ( jreserved_bytes ) , static_cast < bool > ( joverwrite_key ) ) ; <nl> + rocksdb : : WriteBatchWithIndexJni : : setHandle ( env , jobj , wbwi ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : count <nl> + * Signature : ( ) I <nl> + * / <nl> + jint Java_org_rocksdb_WriteBatchWithIndex_count0 ( <nl> + JNIEnv * env , jobject jobj ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + assert ( wbwi ! = nullptr ) ; <nl> + <nl> + return static_cast < jint > ( wbwi - > GetWriteBatch ( ) - > Count ( ) ) ; <nl> + } <nl> + <nl> + / / TODO ( AR ) make generic with WriteBatch equivalent <nl> + / * <nl> + * Helper for WriteBatchWithIndex put operations <nl> + * / <nl> + void write_batch_with_index_put_helper ( <nl> + JNIEnv * env , jobject jobj , <nl> + jbyteArray jkey , jint jkey_len , <nl> + jbyteArray jentry_value , jint jentry_value_len , <nl> + rocksdb : : ColumnFamilyHandle * cf_handle ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + assert ( wbwi ! = nullptr ) ; <nl> + <nl> + jbyte * key = env - > GetByteArrayElements ( jkey , nullptr ) ; <nl> + jbyte * value = env - > GetByteArrayElements ( jentry_value , nullptr ) ; <nl> + rocksdb : : Slice key_slice ( reinterpret_cast < char * > ( key ) , jkey_len ) ; <nl> + rocksdb : : Slice value_slice ( reinterpret_cast < char * > ( value ) , <nl> + jentry_value_len ) ; <nl> + if ( cf_handle ! = nullptr ) { <nl> + wbwi - > Put ( cf_handle , key_slice , value_slice ) ; <nl> + } else { <nl> + / / backwards compatibility <nl> + wbwi - > Put ( key_slice , value_slice ) ; <nl> + } <nl> + env - > ReleaseByteArrayElements ( jkey , key , JNI_ABORT ) ; <nl> + env - > ReleaseByteArrayElements ( jentry_value , value , JNI_ABORT ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : put <nl> + * Signature : ( [ BI [ BI ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_put___3BI_3BI ( <nl> + JNIEnv * env , jobject jobj , jbyteArray jkey , jint jkey_len , <nl> + jbyteArray jentry_value , jint jentry_value_len ) { <nl> + write_batch_with_index_put_helper ( env , jobj , jkey , jkey_len , jentry_value , <nl> + jentry_value_len , nullptr ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : put <nl> + * Signature : ( [ BI [ BIJ ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_put___3BI_3BIJ ( <nl> + JNIEnv * env , jobject jobj , jbyteArray jkey , jint jkey_len , <nl> + jbyteArray jentry_value , jint jentry_value_len , jlong jcf_handle ) { <nl> + auto * cf_handle = reinterpret_cast < rocksdb : : ColumnFamilyHandle * > ( jcf_handle ) ; <nl> + write_batch_with_index_put_helper ( env , jobj , jkey , jkey_len , jentry_value , <nl> + jentry_value_len , cf_handle ) ; <nl> + } <nl> + <nl> + / / TODO ( AR ) make generic with WriteBatch equivalent <nl> + / * <nl> + * Helper for WriteBatchWithIndex merge operations <nl> + * / <nl> + void write_batch_with_index_merge_helper ( <nl> + JNIEnv * env , jobject jobj , <nl> + jbyteArray jkey , jint jkey_len , <nl> + jbyteArray jentry_value , jint jentry_value_len , <nl> + rocksdb : : ColumnFamilyHandle * cf_handle ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + assert ( wbwi ! = nullptr ) ; <nl> + <nl> + jbyte * key = env - > GetByteArrayElements ( jkey , nullptr ) ; <nl> + jbyte * value = env - > GetByteArrayElements ( jentry_value , nullptr ) ; <nl> + rocksdb : : Slice key_slice ( reinterpret_cast < char * > ( key ) , jkey_len ) ; <nl> + rocksdb : : Slice value_slice ( reinterpret_cast < char * > ( value ) , <nl> + jentry_value_len ) ; <nl> + if ( cf_handle ! = nullptr ) { <nl> + wbwi - > Merge ( cf_handle , key_slice , value_slice ) ; <nl> + } else { <nl> + / / backwards compatibility <nl> + wbwi - > Merge ( key_slice , value_slice ) ; <nl> + } <nl> + env - > ReleaseByteArrayElements ( jkey , key , JNI_ABORT ) ; <nl> + env - > ReleaseByteArrayElements ( jentry_value , value , JNI_ABORT ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : merge <nl> + * Signature : ( [ BI [ BI ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_merge___3BI_3BI ( <nl> + JNIEnv * env , jobject jobj , jbyteArray jkey , jint jkey_len , <nl> + jbyteArray jentry_value , jint jentry_value_len ) { <nl> + write_batch_with_index_merge_helper ( env , jobj , jkey , jkey_len , <nl> + jentry_value , jentry_value_len , nullptr ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : merge <nl> + * Signature : ( [ BI [ BIJ ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_merge___3BI_3BIJ ( <nl> + JNIEnv * env , jobject jobj , jbyteArray jkey , jint jkey_len , <nl> + jbyteArray jentry_value , jint jentry_value_len , jlong jcf_handle ) { <nl> + auto * cf_handle = reinterpret_cast < rocksdb : : ColumnFamilyHandle * > ( jcf_handle ) ; <nl> + write_batch_with_index_merge_helper ( env , jobj , jkey , jkey_len , <nl> + jentry_value , jentry_value_len , cf_handle ) ; <nl> + } <nl> + <nl> + / / TODO ( AR ) make generic with WriteBatch equivalent <nl> + / * <nl> + * Helper for write batch remove operations <nl> + * / <nl> + void write_batch_with_index_remove_helper ( <nl> + JNIEnv * env , jobject jobj , <nl> + jbyteArray jkey , jint jkey_len , <nl> + rocksdb : : ColumnFamilyHandle * cf_handle ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + assert ( wbwi ! = nullptr ) ; <nl> + <nl> + jbyte * key = env - > GetByteArrayElements ( jkey , nullptr ) ; <nl> + rocksdb : : Slice key_slice ( reinterpret_cast < char * > ( key ) , jkey_len ) ; <nl> + if ( cf_handle ! = nullptr ) { <nl> + wbwi - > Delete ( cf_handle , key_slice ) ; <nl> + } else { <nl> + wbwi - > Delete ( key_slice ) ; <nl> + } <nl> + env - > ReleaseByteArrayElements ( jkey , key , JNI_ABORT ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : remove <nl> + * Signature : ( [ BI ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_remove___3BI ( <nl> + JNIEnv * env , jobject jobj , jbyteArray jkey , jint jkey_len ) { <nl> + write_batch_with_index_remove_helper ( env , jobj , jkey , jkey_len , nullptr ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : remove <nl> + * Signature : ( [ BIJ ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_remove___3BIJ ( <nl> + JNIEnv * env , jobject jobj , <nl> + jbyteArray jkey , jint jkey_len , jlong jcf_handle ) { <nl> + auto * cf_handle = reinterpret_cast < rocksdb : : ColumnFamilyHandle * > ( jcf_handle ) ; <nl> + write_batch_with_index_remove_helper ( env , jobj , jkey , jkey_len , cf_handle ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : putLogData <nl> + * Signature : ( [ BI ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_putLogData ( <nl> + JNIEnv * env , jobject jobj , jbyteArray jblob , jint jblob_len ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + assert ( wbwi ! = nullptr ) ; <nl> + <nl> + jbyte * blob = env - > GetByteArrayElements ( jblob , nullptr ) ; <nl> + rocksdb : : Slice blob_slice ( reinterpret_cast < char * > ( blob ) , jblob_len ) ; <nl> + wbwi - > PutLogData ( blob_slice ) ; <nl> + env - > ReleaseByteArrayElements ( jblob , blob , JNI_ABORT ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : clear <nl> + * Signature : ( ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_clear0 ( <nl> + JNIEnv * env , jobject jobj ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + assert ( wbwi ! = nullptr ) ; <nl> + <nl> + wbwi - > GetWriteBatch ( ) - > Clear ( ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : iterator0 <nl> + * Signature : ( ) J <nl> + * / <nl> + jlong Java_org_rocksdb_WriteBatchWithIndex_iterator0 ( <nl> + JNIEnv * env , jobject jobj ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + rocksdb : : WBWIIterator * wbwi_iterator = wbwi - > NewIterator ( ) ; <nl> + return reinterpret_cast < jlong > ( wbwi_iterator ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : iterator1 <nl> + * Signature : ( J ) J <nl> + * / <nl> + jlong Java_org_rocksdb_WriteBatchWithIndex_iterator1 ( <nl> + JNIEnv * env , jobject jobj , jlong jcf_handle ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + auto * cf_handle = reinterpret_cast < rocksdb : : ColumnFamilyHandle * > ( jcf_handle ) ; <nl> + rocksdb : : WBWIIterator * wbwi_iterator = wbwi - > NewIterator ( cf_handle ) ; <nl> + return reinterpret_cast < jlong > ( wbwi_iterator ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : iteratorWithBase <nl> + * Signature : ( JJ ) J <nl> + * / <nl> + jlong Java_org_rocksdb_WriteBatchWithIndex_iteratorWithBase ( <nl> + JNIEnv * env , jobject jobj , jlong jcf_handle , jlong jbi_handle ) { <nl> + rocksdb : : WriteBatchWithIndex * wbwi = <nl> + rocksdb : : WriteBatchWithIndexJni : : getHandle ( env , jobj ) ; <nl> + auto * cf_handle = reinterpret_cast < rocksdb : : ColumnFamilyHandle * > ( jcf_handle ) ; <nl> + auto * base_iterator = reinterpret_cast < rocksdb : : Iterator * > ( jbi_handle ) ; <nl> + auto * iterator = wbwi - > NewIteratorWithBase ( cf_handle , base_iterator ) ; <nl> + return reinterpret_cast < jlong > ( iterator ) ; <nl> + } <nl> + <nl> + / * <nl> + * Class : org_rocksdb_WriteBatchWithIndex <nl> + * Method : disposeInternal <nl> + * Signature : ( J ) V <nl> + * / <nl> + void Java_org_rocksdb_WriteBatchWithIndex_disposeInternal ( <nl> + JNIEnv * env , jobject jobj , jlong handle ) { <nl> + auto * wbwi = reinterpret_cast < rocksdb : : WriteBatchWithIndex * > ( handle ) ; <nl> + delete wbwi ; <nl> + } <nl>
|
Implement WriteBatchWithIndex in the Java API
|
facebook/rocksdb
|
ef5b34dee0fe7276b893a536a68d15e089f79657
|
2015-01-14T21:16:05Z
|
mmm a / src / core / lib / iomgr / tcp_server_posix . c <nl> ppp b / src / core / lib / iomgr / tcp_server_posix . c <nl> struct grpc_tcp_server { <nl> size_t pollset_count ; <nl> <nl> / * next pollset to assign a channel to * / <nl> - size_t next_pollset_to_assign ; <nl> + gpr_atm next_pollset_to_assign ; <nl> } ; <nl> <nl> static gpr_once check_init = GPR_ONCE_INIT ; <nl> grpc_error * grpc_tcp_server_create ( grpc_closure * shutdown_complete , <nl> s - > head = NULL ; <nl> s - > tail = NULL ; <nl> s - > nports = 0 ; <nl> - s - > next_pollset_to_assign = 0 ; <nl> + gpr_atm_no_barrier_store ( & s - > next_pollset_to_assign , 0 ) ; <nl> * server = s ; <nl> return GRPC_ERROR_NONE ; <nl> } <nl> static void on_read ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * err ) { <nl> } <nl> <nl> read_notifier_pollset = <nl> - sp - > server - > pollsets [ ( sp - > server - > next_pollset_to_assign + + ) % <nl> + sp - > server - > pollsets [ ( size_t ) gpr_atm_no_barrier_fetch_add ( <nl> + & sp - > server - > next_pollset_to_assign , 1 ) % <nl> sp - > server - > pollset_count ] ; <nl> <nl> / * loop until accept4 returns EAGAIN , and then re - arm notification * / <nl>
|
Merge github . com : grpc / grpc into delayed - write
|
grpc/grpc
|
ba61f4ac84721d674b825c062df521ee11cf035c
|
2016-07-07T05:49:22Z
|
mmm a / src / compiler / wasm - compiler . cc <nl> ppp b / src / compiler / wasm - compiler . cc <nl> Node * WasmGraphBuilder : : BoundsCheckMem ( uint8_t access_size , Node * index , <nl> / / - checking that { index < effective_size } . <nl> <nl> Node * mem_size = instance_cache_ - > mem_size ; <nl> - if ( end_offset > = env_ - > min_memory_size ) { <nl> + if ( end_offset > env_ - > min_memory_size ) { <nl> / / The end offset is larger than the smallest memory . <nl> / / Dynamically check the end offset against the dynamic memory size . <nl> Node * cond = gasm_ - > UintLessThan ( end_offset_node , mem_size ) ; <nl> TrapIfFalse ( wasm : : kTrapMemOutOfBounds , cond , position ) ; <nl> } else { <nl> - / / The end offset is smaller than the smallest memory , so only one check is <nl> + / / The end offset is < = the smallest memory , so only one check is <nl> / / required . Check to see if the index is also a constant . <nl> UintPtrMatcher match ( index ) ; <nl> if ( match . HasResolvedValue ( ) ) { <nl> Node * WasmGraphBuilder : : BoundsCheckMem ( uint8_t access_size , Node * index , <nl> } <nl> } <nl> <nl> - / / This produces a positive number , since { end_offset < min_size < = mem_size } . <nl> + / / This produces a positive number since { end_offset < = min_size < = mem_size } . <nl> Node * effective_size = gasm_ - > IntSub ( mem_size , end_offset_node ) ; <nl> <nl> / / Introduce the actual bounds check . <nl> mmm a / src / wasm / baseline / liftoff - compiler . cc <nl> ppp b / src / wasm / baseline / liftoff - compiler . cc <nl> class LiftoffCompiler { <nl> <nl> __ LoadConstant ( end_offset_reg , WasmValue : : ForUintPtr ( end_offset ) ) ; <nl> <nl> - if ( end_offset > = env_ - > min_memory_size ) { <nl> + if ( end_offset > env_ - > min_memory_size ) { <nl> __ emit_cond_jump ( kUnsignedGreaterEqual , trap_label , <nl> LiftoffAssembler : : kWasmIntPtr , end_offset_reg . gp ( ) , <nl> mem_size ) ; <nl> } <nl> <nl> - / / Just reuse the end_offset register for computing the effective size . <nl> + / / Just reuse the end_offset register for computing the effective size <nl> + / / ( which is > = 0 because of the check above ) . <nl> LiftoffRegister effective_size_reg = end_offset_reg ; <nl> __ emit_ptrsize_sub ( effective_size_reg . gp ( ) , mem_size , end_offset_reg . gp ( ) ) ; <nl> <nl>
|
[ wasm ] Optimize bounds checking bounds
|
v8/v8
|
63b78f2b0152eb48ef342f097ac1a64ff97ccf24
|
2020-12-17T09:38:53Z
|
mmm a / tools / gce / create_linux_performance_worker . sh <nl> ppp b / tools / gce / create_linux_performance_worker . sh <nl> gcloud compute instances create $ INSTANCE_NAME \ <nl> - - project = " $ CLOUD_PROJECT " \ <nl> - - zone " $ ZONE " \ <nl> - - machine - type $ MACHINE_TYPE \ <nl> - - - image ubuntu - 15 - 10 \ <nl> + - - image - project ubuntu - os - cloud \ <nl> + - - image - family ubuntu - 1604 - lts \ <nl> - - boot - disk - size 300 \ <nl> - - scopes https : / / www . googleapis . com / auth / bigquery <nl> <nl> mmm a / tools / gce / linux_performance_worker_init . sh <nl> ppp b / tools / gce / linux_performance_worker_init . sh <nl> sudo apt - get install - y libgflags - dev libgtest - dev libc + + - dev clang <nl> # Python dependencies <nl> sudo pip install tabulate <nl> sudo pip install google - api - python - client <nl> + sudo pip install virtualenv <nl> + <nl> + # TODO ( jtattermusch ) : For some reason , building gRPC Python depends on python3 . 4 <nl> + # being installed , but python3 . 4 is not available on Ubuntu 16 . 04 . <nl> + # Temporarily fixing this by adding a PPA with python3 . 4 , but we should <nl> + # really remove this hack once possible . <nl> + sudo add - apt - repository - y ppa : fkrull / deadsnakes <nl> + sudo apt - get update <nl> + sudo apt - get install - y python3 . 4 python3 . 4 - dev <nl> + python3 . 4 - m pip install virtualenv <nl> <nl> curl - O https : / / bootstrap . pypa . io / get - pip . py <nl> sudo pypy get - pip . py <nl> nvm install 4 & & npm config set cache / tmp / npm - cache <nl> nvm install 5 & & npm config set cache / tmp / npm - cache <nl> nvm alias default 4 <nl> <nl> - # C # dependencies ( http : / / www . mono - project . com / docs / getting - started / install / linux / # debian - ubuntu - and - derivatives ) <nl> - <nl> + # C # mono dependencies ( http : / / www . mono - project . com / docs / getting - started / install / linux / # debian - ubuntu - and - derivatives ) <nl> sudo apt - key adv - - keyserver hkp : / / keyserver . ubuntu . com : 80 - - recv - keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF <nl> echo " deb http : / / download . mono - project . com / repo / debian wheezy main " | sudo tee / etc / apt / sources . list . d / mono - xamarin . list <nl> sudo apt - get update <nl> sudo apt - get install - y mono - devel nuget <nl> <nl> - # The version of nuget that is installed using apt - get is too old to download <nl> - # the System . Interactive . Async . 3 . 0 . 0 C # dependency . Update to the latest version <nl> - # in order to be able download it . <nl> - sudo nuget update - self <nl> + # C # . NET Core dependencies ( https : / / www . microsoft . com / net / core # ubuntu ) <nl> + sudo sh - c ' echo " deb [ arch = amd64 ] https : / / apt - mo . trafficmanager . net / repos / dotnet - release / xenial main " > / etc / apt / sources . list . d / dotnetdev . list ' <nl> + sudo apt - key adv - - keyserver apt - mo . trafficmanager . net - - recv - keys 417A0893 <nl> + sudo apt - get update <nl> + sudo apt - get install - y dotnet - dev - 1 . 0 . 0 - preview2 - 003131 <nl> <nl> # Ruby dependencies <nl> gpg - - keyserver hkp : / / keys . gnupg . net - - recv - keys 409B6B1796C275462A1703113804BB82D39DC0E3 <nl> mmm a / tools / run_tests / performance / build_performance . sh <nl> ppp b / tools / run_tests / performance / build_performance . sh <nl> do <nl> " go " ) <nl> tools / run_tests / performance / build_performance_go . sh <nl> ; ; <nl> + " csharp " ) <nl> + tools / run_tests / run_tests . py - l $ language - c $ CONFIG - - build_only - j 8 - - compiler coreclr <nl> + ; ; <nl> * ) <nl> tools / run_tests / run_tests . py - l $ language - c $ CONFIG - - build_only - j 8 <nl> ; ; <nl> mmm a / tools / run_tests / performance / kill_workers . sh <nl> ppp b / tools / run_tests / performance / kill_workers . sh <nl> killall - 9 qps_worker | | true <nl> <nl> # C # <nl> ps - C mono - o pid = , cmd = | grep QpsWorker | awk ' { print $ 1 } ' | xargs kill - 9 | | true <nl> + ps - C dotnet - o pid = , cmd = | grep QpsWorker | awk ' { print $ 1 } ' | xargs kill - 9 | | true <nl> <nl> # Ruby <nl> ps - C ruby - o pid = , cmd = | grep ' qps / worker . rb ' | awk ' { print $ 1 } ' | xargs kill - 9 | | true <nl> mmm a / tools / run_tests / performance / run_worker_csharp . sh <nl> ppp b / tools / run_tests / performance / run_worker_csharp . sh <nl> set - ex <nl> cd $ ( dirname $ 0 ) / . . / . . / . . <nl> <nl> # needed to correctly locate testca <nl> - cd src / csharp / Grpc . IntegrationTesting . QpsWorker / bin / Release <nl> + cd src / csharp / Grpc . IntegrationTesting . QpsWorker / bin / Release / netcoreapp1 . 0 <nl> <nl> - mono Grpc . IntegrationTesting . QpsWorker . exe $ @ <nl> + dotnet exec Grpc . IntegrationTesting . QpsWorker . dll $ @ <nl>
|
Merge pull request from jtattermusch / coreclr_benchmarks
|
grpc/grpc
|
bb4c5f3d3fd5217c680bbdf3c429b73d7662bbab
|
2016-10-17T21:41:50Z
|
mmm a / lib / SILPasses / LoadStoreOpts . cpp <nl> ppp b / lib / SILPasses / LoadStoreOpts . cpp <nl> <nl> # include " swift / SILAnalysis / PostOrderAnalysis . h " <nl> # include " swift / SILAnalysis / DominanceAnalysis . h " <nl> # include " swift / SILAnalysis / ValueTracking . h " <nl> + # include " swift / SILPasses / Utils / SILSSAUpdater . h " <nl> # include " swift / SILPasses / Utils / Local . h " <nl> # include " swift / SILPasses / Utils / CFG . h " <nl> # include " swift / SILPasses / Transforms . h " <nl> static SILValue tryToForwardAddressValueToLoad ( SILValue Address , <nl> namespace { <nl> <nl> class LSBBForwarder ; <nl> - <nl> - using StoreList = SmallVector < StoreInst * , 8 > ; <nl> - <nl> - / / / The predecessor order in StoreList . We have one StoreInst for each <nl> - / / / predecessor in StoreList . <nl> - using PredOrderInStoreList = SmallVector < SILBasicBlock * , 8 > ; <nl> + class LSStore ; <nl> <nl> / / / Map an address to a list of StoreInst , one for each predecessor . <nl> - using CoveredStoreMap = llvm : : DenseMap < SILValue , StoreList > ; <nl> + using CoveredStoreMap = llvm : : DenseMap < SILValue , LSStore > ; <nl> <nl> / / / This class stores global state that we use when processing and also drives <nl> / / / the computation . We put its interface at the top for use in other parts of <nl> class LSValue { <nl> <nl> bool operator = = ( const LSValue & Other ) const ; <nl> <nl> + void addValue ( SILInstruction * I ) { <nl> + Insts . push_back ( I ) ; <nl> + } <nl> + <nl> / / / Return the SILValue necessary for forwarding the given LSValue . <nl> / / / <nl> / / / * NOTE * This will create a PHI node if we have not created one yet if we <nl> class LSBBForwarder { <nl> BB = NewBB ; <nl> } <nl> <nl> - bool optimize ( LSContext & Ctx , CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) ; <nl> + bool optimize ( LSContext & Ctx , CoveredStoreMap & StoreMap ) ; <nl> <nl> SILBasicBlock * getBB ( ) const { return BB ; } <nl> <nl> class LSBBForwarder { <nl> void mergePredecessorStates ( llvm : : DenseMap < SILBasicBlock * , <nl> unsigned > & BBToBBIDMap , <nl> std : : vector < LSBBForwarder > & BBIDToForwarderMap , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) ; <nl> + CoveredStoreMap & StoreMap ) ; <nl> <nl> / / / Clear all state in the BB optimizer . <nl> void clear ( ) { <nl> class LSBBForwarder { <nl> / / / Try to find a previously known value that we can forward to LI . This <nl> / / / includes from stores and loads . <nl> bool tryToForwardLoad ( LSContext & Ctx , LoadInst * LI , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) ; <nl> + CoveredStoreMap & StoreMap ) ; <nl> <nl> private : <nl> <nl> class LSBBForwarder { <nl> void updateStoreMap ( llvm : : DenseMap < SILBasicBlock * , <nl> unsigned > & BBToBBIDMap , <nl> std : : vector < LSBBForwarder > & BBIDToForwarderMap , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) ; <nl> + CoveredStoreMap & StoreMap ) ; <nl> <nl> bool tryToSubstitutePartialAliasLoad ( SILValue PrevAddr , SILValue PrevValue , <nl> LoadInst * LI ) ; <nl> <nl> bool tryToForwardStoresToLoad ( LSContext & Ctx , LoadInst * LI , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) ; <nl> + CoveredStoreMap & StoreMap ) ; <nl> <nl> bool tryToForwardLoadsToLoad ( LSContext & Ctx , LoadInst * LI , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) ; <nl> + CoveredStoreMap & StoreMap ) ; <nl> } ; <nl> <nl> # ifndef NDEBUG <nl> invalidateAliasingLoads ( LSContext & Ctx , SILInstruction * Inst , <nl> } <nl> } <nl> <nl> - static bool writeAliasesStoreInList ( AliasAnalysis * AA , <nl> - SILInstruction * Writer , <nl> - ArrayRef < StoreInst * > Stores ) { <nl> - for ( auto * S : Stores ) <nl> - if ( LSValue ( S ) . aliasingWrite ( AA , Writer ) ) <nl> - return true ; <nl> - <nl> - return false ; <nl> - } <nl> - <nl> void <nl> LSBBForwarder : : <nl> invalidateWriteToStores ( LSContext & Ctx , SILInstruction * Inst , <nl> invalidateWriteToStores ( LSContext & Ctx , SILInstruction * Inst , <nl> InvalidatedStoreList . push_back ( P . first ) ; <nl> <nl> for ( auto & P : StoreMap ) <nl> - if ( writeAliasesStoreInList ( AA , Inst , P . second ) ) <nl> + if ( P . second . aliasingWrite ( AA , Inst ) ) <nl> InvalidatedStoreList . push_back ( P . first ) ; <nl> <nl> for ( SILValue SIOp : InvalidatedStoreList ) { <nl> bool LSBBForwarder : : tryToSubstitutePartialAliasLoad ( SILValue PrevLIAddr , <nl> } <nl> <nl> / / / Add a BBArgument in Dest to combine sources of Stores . <nl> - static SILValue fixPhiPredBlocks ( SmallVectorImpl < StoreInst * > & Stores , <nl> - SmallVectorImpl < SILBasicBlock * > & PredOrder , <nl> + static SILValue fixPhiPredBlocks ( ArrayRef < SILInstruction * > Stores , <nl> SILBasicBlock * Dest ) { <nl> - SILModule & M = Dest - > getModule ( ) ; <nl> + assert ( ! Stores . empty ( ) & & " Can not fix phi pred for multiple blocks " ) ; <nl> assert ( Stores . size ( ) = = <nl> ( unsigned ) std : : distance ( Dest - > pred_begin ( ) , Dest - > pred_end ( ) ) & & <nl> " Multiple store forwarding size mismatch " ) ; <nl> - auto PhiValue = new ( M ) SILArgument ( Dest , Stores [ 0 ] - > getSrc ( ) . getType ( ) ) ; <nl> - unsigned Id = 0 ; <nl> - for ( auto Pred : PredOrder ) { <nl> - TermInst * TI = Pred - > getTerminator ( ) ; <nl> - / / This can change the order of predecessors in getPreds . <nl> - addArgumentToBranch ( Stores [ Id + + ] - > getSrc ( ) , Dest , TI ) ; <nl> - TI - > eraseFromParent ( ) ; <nl> - } <nl> - return PhiValue ; <nl> + SILSSAUpdater Updater ; <nl> + <nl> + / / We know that we only have one store per block already so we can use the <nl> + / / SSA updater . <nl> + Updater . Initialize ( cast < StoreInst > ( Stores [ 0 ] ) - > getSrc ( ) . getType ( ) ) ; <nl> + for ( auto * I : Stores ) <nl> + Updater . AddAvailableValue ( I - > getParent ( ) , cast < StoreInst > ( I ) - > getSrc ( ) ) ; <nl> + return Updater . GetValueInMiddleOfBlock ( Dest ) ; <nl> } <nl> <nl> bool LSBBForwarder : : tryToForwardStoresToLoad ( LSContext & Ctx , LoadInst * LI , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) { <nl> + CoveredStoreMap & StoreMap ) { <nl> / / If we are loading a value that we just stored , forward the stored value . <nl> for ( auto & P : Stores ) { <nl> SILValue Addr = P . first ; <nl> bool LSBBForwarder : : tryToForwardStoresToLoad ( LSContext & Ctx , LoadInst * LI , <nl> continue ; <nl> <nl> DEBUG ( llvm : : dbgs ( ) < < " Checking from : " ) ; <nl> - for ( auto * SI : I - > second ) { <nl> + for ( auto * SI : I - > second . getInsts ( ) ) { <nl> DEBUG ( llvm : : dbgs ( ) < < " " < < * SI ) ; <nl> ( void ) SI ; <nl> } <nl> <nl> / / Create a BBargument to merge in multiple stores . <nl> - SILValue PhiValue = fixPhiPredBlocks ( I - > second , PredOrder , BB ) ; <nl> + SILValue PhiValue = fixPhiPredBlocks ( I - > second . getInsts ( ) , BB ) ; <nl> SILValue Result = FA . forward ( I - > first , PhiValue , LI ) ; <nl> assert ( Result & & " Forwarding from multiple stores failed ! " ) ; <nl> <nl> bool LSBBForwarder : : tryToForwardStoresToLoad ( LSContext & Ctx , LoadInst * LI , <nl> } <nl> <nl> bool LSBBForwarder : : tryToForwardLoadsToLoad ( LSContext & Ctx , LoadInst * LI , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) { <nl> + CoveredStoreMap & StoreMap ) { <nl> / / Search the previous loads and replace the current load or one of the <nl> / / current loads uses with one of the previous loads . <nl> for ( auto & P : Loads ) { <nl> bool LSBBForwarder : : tryToForwardLoadsToLoad ( LSContext & Ctx , LoadInst * LI , <nl> } <nl> <nl> bool LSBBForwarder : : tryToForwardLoad ( LSContext & Ctx , LoadInst * LI , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) { <nl> + CoveredStoreMap & StoreMap ) { <nl> <nl> - if ( tryToForwardLoadsToLoad ( Ctx , LI , StoreMap , PredOrder ) ) <nl> + if ( tryToForwardLoadsToLoad ( Ctx , LI , StoreMap ) ) <nl> return true ; <nl> <nl> - if ( tryToForwardStoresToLoad ( Ctx , LI , StoreMap , PredOrder ) ) <nl> + if ( tryToForwardStoresToLoad ( Ctx , LI , StoreMap ) ) <nl> return true ; <nl> <nl> startTrackingLoad ( LI ) ; <nl> bool LSBBForwarder : : tryToForwardLoad ( LSContext & Ctx , LoadInst * LI , <nl> / / / \ brief Promote stored values to loads , remove dead stores and merge <nl> / / / duplicated loads . <nl> bool LSBBForwarder : : optimize ( LSContext & Ctx , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) { <nl> + CoveredStoreMap & StoreMap ) { <nl> auto II = BB - > begin ( ) , E = BB - > end ( ) ; <nl> bool Changed = false ; <nl> while ( II ! = E ) { <nl> bool LSBBForwarder : : optimize ( LSContext & Ctx , <nl> / / This is a LoadInst . Let ' s see if we can find a previous loaded , stored <nl> / / value to use instead of this load . <nl> if ( LoadInst * LI = dyn_cast < LoadInst > ( Inst ) ) { <nl> - Changed | = tryToForwardLoad ( Ctx , LI , StoreMap , PredOrder ) ; <nl> + Changed | = tryToForwardLoad ( Ctx , LI , StoreMap ) ; <nl> continue ; <nl> } <nl> <nl> void LSBBForwarder : : <nl> updateStoreMap ( llvm : : DenseMap < SILBasicBlock * , <nl> unsigned > & BBToBBIDMap , <nl> std : : vector < LSBBForwarder > & BBIDToForwarderMap , <nl> - CoveredStoreMap & StoreMap , PredOrderInStoreList & PredOrder ) { <nl> + CoveredStoreMap & StoreMap ) { <nl> if ( std : : distance ( BB - > pred_begin ( ) , BB - > pred_end ( ) ) < = 1 ) <nl> return ; <nl> <nl> bool FirstPred = true ; <nl> + <nl> for ( auto Pred : BB - > getPreds ( ) ) { <nl> / / Bail out if one of the predecessors has a terminator that we currently <nl> / / do not handle . <nl> updateStoreMap ( llvm : : DenseMap < SILBasicBlock * , <nl> return ; <nl> } <nl> <nl> - PredOrder . push_back ( Pred ) ; <nl> auto I = BBToBBIDMap . find ( Pred ) ; <nl> if ( I = = BBToBBIDMap . end ( ) ) { <nl> StoreMap . clear ( ) ; <nl> updateStoreMap ( llvm : : DenseMap < SILBasicBlock * , <nl> / / Update StoreMap with stores from the first predecessor . <nl> for ( auto I = StoredMapOfThisPred . begin ( ) , E = StoredMapOfThisPred . end ( ) ; <nl> I ! = E ; I + + ) { <nl> - StoreMap [ I - > first ] . push_back ( I - > second ) ; <nl> + StoreMap . insert ( { I - > first , LSStore ( I - > second ) } ) ; <nl> DEBUG ( llvm : : dbgs ( ) < < " Updating StoreMap bb " < < <nl> Pred - > getDebugID ( ) < < " : " < < I - > first < < " " < < <nl> * I - > second ) ; <nl> updateStoreMap ( llvm : : DenseMap < SILBasicBlock * , <nl> for ( auto I = StoreMap . begin ( ) , E = StoreMap . end ( ) ; I ! = E ; ) { <nl> SILValue Current = I - > first ; <nl> if ( ! StoredMapOfThisPred . count ( Current ) | | <nl> - I - > second [ 0 ] - > getSrc ( ) . getType ( ) ! = <nl> + cast < StoreInst > ( I - > second . getInsts ( ) [ 0 ] ) - > getSrc ( ) . getType ( ) ! = <nl> StoredMapOfThisPred [ Current ] - > getSrc ( ) . getType ( ) ) { <nl> DEBUG ( llvm : : dbgs ( ) < < " Removing from StoreMap : " < < Current ) ; <nl> I + + ; / / Move to the next before erasing the current . <nl> StoreMap . erase ( Current ) ; <nl> } <nl> else { <nl> - I - > second . push_back ( StoredMapOfThisPred [ Current ] ) ; <nl> + I - > second . addValue ( StoredMapOfThisPred [ Current ] ) ; <nl> DEBUG ( llvm : : dbgs ( ) < < " Updating StoreMap bb " < < <nl> Pred - > getDebugID ( ) < < " : " < < Current < < <nl> " " < < * StoredMapOfThisPred [ Current ] ) ; <nl> LSBBForwarder : : <nl> mergePredecessorStates ( llvm : : DenseMap < SILBasicBlock * , <nl> unsigned > & BBToBBIDMap , <nl> std : : vector < LSBBForwarder > & BBIDToForwarderMap , <nl> - CoveredStoreMap & StoreMap , <nl> - PredOrderInStoreList & PredOrder ) { <nl> + CoveredStoreMap & StoreMap ) { <nl> / / Clear the state if the basic block has no predecessor . <nl> if ( BB - > getPreds ( ) . empty ( ) ) { <nl> clear ( ) ; <nl> mergePredecessorStates ( llvm : : DenseMap < SILBasicBlock * , <nl> / / <nl> / / Once we have a fully optimistic iterative dataflow that uses LSValues <nl> / / this should be removed . <nl> - updateStoreMap ( BBToBBIDMap , BBIDToForwarderMap , StoreMap , PredOrder ) ; <nl> + updateStoreMap ( BBToBBIDMap , BBIDToForwarderMap , StoreMap ) ; <nl> <nl> bool HasAtLeastOnePred = false ; <nl> / / If we have a self cycle , we keep the old state and merge in states <nl> LSContext : : runIteration ( ) { <nl> DEBUG ( llvm : : dbgs ( ) < < " Visiting bb " < < BB - > getDebugID ( ) < < " \ n " ) ; <nl> <nl> CoveredStoreMap StoreMap ; <nl> - PredOrderInStoreList PredOrder ; <nl> <nl> / / Merge the predecessors . After merging , LSBBForwarder now contains <nl> / / lists of stores | loads that reach the beginning of the basic block <nl> / / along all paths . <nl> Forwarder . mergePredecessorStates ( BBToBBIDMap , BBIDToForwarderMap , <nl> - StoreMap , PredOrder ) ; <nl> + StoreMap ) ; <nl> <nl> / / Remove dead stores , merge duplicate loads , and forward stores to <nl> / / loads . We also update lists of stores | loads to reflect the end <nl> / / of the basic block . <nl> - Changed | = Forwarder . optimize ( * this , StoreMap , PredOrder ) ; <nl> + Changed | = Forwarder . optimize ( * this , StoreMap ) ; <nl> } <nl> <nl> return Changed ; <nl>
|
[ ls - opts ] Use LSStore / SSAUpdater in StoreMap instead of the StoreList / PredecessorOrderList .
|
apple/swift
|
7b5430ba1b2245debb03ae75a9d22c52496dd9bf
|
2015-06-19T18:46:06Z
|
mmm a / cmake / OpenCVFindLibsPerf . cmake <nl> ppp b / cmake / OpenCVFindLibsPerf . cmake <nl> if ( WITH_EIGEN ) <nl> find_path ( EIGEN_INCLUDE_PATH " Eigen / Core " <nl> PATHS / usr / local / opt / usr ENV ProgramFiles ENV ProgramW6432 <nl> PATH_SUFFIXES include / eigen3 include / eigen2 Eigen / include / eigen3 Eigen / include / eigen2 <nl> - DOC " The path to Eigen3 / Eigen2 headers " ) <nl> + DOC " The path to Eigen3 / Eigen2 headers " <nl> + CMAKE_FIND_ROOT_PATH_BOTH ) <nl> <nl> if ( EIGEN_INCLUDE_PATH ) <nl> ocv_include_directories ( $ { EIGEN_INCLUDE_PATH } ) <nl>
|
Improve Eigen search
|
opencv/opencv
|
200a81746e6567f5adc570455880a957e49930df
|
2012-09-10T14:15:29Z
|
mmm a / client / dbclient . cpp <nl> ppp b / client / dbclient . cpp <nl> namespace mongo { <nl> out ( ) < < ok < < " retval : " < < res < < endl ; <nl> } <nl> <nl> + void testPaired ( ) ; <nl> int test2 ( ) { <nl> - testDbEval ( ) ; <nl> + testPaired ( ) ; <nl> return 0 ; <nl> } <nl> <nl> / * mmm dbclientconnection mmm * / <nl> <nl> + bool DBClientConnection : : auth ( const char * dbname , const char * username , const char * password_text , string & errmsg , bool digestPassword ) { <nl> + if ( ! autoReconnect ) <nl> + return DBClientBase : : auth ( dbname , username , password_text , errmsg , digestPassword ) ; <nl> + <nl> + string password = password_text ; <nl> + if ( digestPassword ) <nl> + password = createPasswordDigest ( password_text ) ; <nl> + <nl> + if ( ! DBClientBase : : auth ( dbname , username , password . c_str ( ) , errmsg , false ) ) <nl> + return false ; <nl> + <nl> + pair < string , string > p = pair < string , string > ( username , password ) ; <nl> + authCache [ dbname ] = p ; <nl> + return true ; <nl> + } <nl> + <nl> BSONObj DBClientBase : : findOne ( const char * ns , BSONObj query , BSONObj * fieldsToReturn , int queryOptions ) { <nl> auto_ptr < DBClientCursor > c = <nl> this - > query ( ns , query , 1 , 0 , fieldsToReturn , queryOptions ) ; <nl> namespace mongo { <nl> string errmsg ; <nl> string tmp = serverAddress ; <nl> failed = false ; <nl> - if ( ! connect ( tmp . c_str ( ) , errmsg ) ) <nl> + if ( ! connect ( tmp . c_str ( ) , errmsg ) ) { <nl> log ( ) < < " reconnect " < < serverAddress < < " failed " < < errmsg < < endl ; <nl> - else <nl> - log ( ) < < " reconnect " < < serverAddress < < " ok " < < endl ; <nl> + return ; <nl> + } <nl> + <nl> + log ( ) < < " reconnect " < < serverAddress < < " ok " < < endl ; <nl> + / / cout < < " TEMP : authcache size : " < < authCache . size ( ) < < endl ; <nl> + for ( map < string , pair < string , string > > : : iterator i = authCache . begin ( ) ; i ! = authCache . end ( ) ; i + + ) { <nl> + const char * dbname = i - > first . c_str ( ) ; <nl> + const char * username = i - > second . first . c_str ( ) ; <nl> + const char * password = i - > second . second . c_str ( ) ; <nl> + if ( ! DBClientBase : : auth ( dbname , username , password , errmsg , false ) ) <nl> + log ( ) < < " reconnect : auth failed db : " < < dbname < < " user : " < < username < < ' \ n ' ; <nl> + } <nl> } <nl> <nl> auto_ptr < DBClientCursor > DBClientBase : : query ( const char * ns , BSONObj query , int nToReturn , <nl> namespace mongo { <nl> } <nl> <nl> DBClientPaired : : DBClientPaired ( ) : <nl> - left ( true ) , right ( true ) <nl> + left ( true , this ) , right ( true , this ) <nl> { <nl> master = NotSetL ; <nl> } <nl> namespace mongo { <nl> return checkMaster ( ) . findOne ( a , b , c , d ) ; <nl> } <nl> <nl> - <nl> + void testPaired ( ) { <nl> + / / DBClientPaired p ; <nl> + / / log ( ) < < " connect returns " < < p . connect ( " localhost : 27017 " , " localhost : 27018 " ) < < endl ; <nl> + <nl> + DBClientConnection p ( true ) ; <nl> + string errmsg ; <nl> + log ( ) < < " connect " < < p . connect ( " localhost " , errmsg ) < < endl ; <nl> + log ( ) < < " auth " < < p . auth ( " dwight " , " u " , " p " , errmsg ) < < endl ; <nl> + <nl> + while ( 1 ) { <nl> + sleepsecs ( 3 ) ; <nl> + try { <nl> + log ( ) < < " findone returns " < < p . findOne ( " dwight . foo " , emptyObj ) . toString ( ) < < endl ; <nl> + sleepsecs ( 3 ) ; <nl> + BSONObj info ; <nl> + bool im ; <nl> + log ( ) < < " ismaster returns " < < p . isMaster ( im , & info ) < < " info : " < < info . toString ( ) < < endl ; <nl> + } <nl> + catch ( . . . ) { <nl> + cout < < " caught exception " < < endl ; <nl> + } <nl> + } <nl> + } <nl> <nl> } / / namespace mongo <nl> mmm a / client / dbclient . h <nl> ppp b / client / dbclient . h <nl> namespace mongo { <nl> bool runCommand ( const char * dbname , BSONObj cmd , BSONObj & info ) ; <nl> <nl> / * * Authorize access to a particular database . <nl> + Authentication is separate for each database on the server - - you may authenticate for any <nl> + number of databases on a single connection . <nl> + The " admin " database is special and once authenticated provides access to all databases on the <nl> + server . <nl> @ param digestPassword if password is plain text , set this to true . otherwise assumed to be pre - digested <nl> @ return true if successful <nl> * / <nl> - bool auth ( const char * dbname , const char * username , const char * pwd , string & errmsg , bool digestPassword = true ) ; <nl> + virtual bool auth ( const char * dbname , const char * username , const char * pwd , string & errmsg , bool digestPassword = true ) ; <nl> <nl> string createPasswordDigest ( const char * clearTextPassword ) ; <nl> <nl> namespace mongo { <nl> ns : namespace to query , format is < dbname > . < collectname > [ . < collectname > ] * <nl> query : query to perform on the collection . this is a BSONObj ( binary JSON ) <nl> You may format as <nl> - { query : { . . . } , order : { . . . } } <nl> + { query : { . . . } , order : { . . . } } <nl> to specify a sort order . <nl> nToReturn : n to return . 0 = unlimited <nl> nToSkip : start with the nth item <nl> namespace mongo { <nl> time_t lastReconnectTry ; <nl> string serverAddress ; / / remember for reconnects <nl> void checkConnection ( ) ; <nl> + map < string , pair < string , string > > authCache ; <nl> public : <nl> <nl> / * * <nl> namespace mongo { <nl> DBClientConnection ( bool _autoReconnect = false , DBClientPaired * cp = 0 ) : <nl> clientPaired ( cp ) , failed ( false ) , autoReconnect ( _autoReconnect ) , lastReconnectTry ( 0 ) { } <nl> <nl> - <nl> / * * <nl> If autoReconnect is true , you can try to use the DBClientConnection even when <nl> false was returned - - it will try to connect again . <nl> namespace mongo { <nl> * / <nl> virtual bool connect ( const char * serverHostname , string & errmsg ) ; <nl> <nl> - / * * Authenticate with the server . <nl> - Authentication is separate for each database on the server - - you may authenticate for any <nl> - number of databases on a single connection . <nl> - The " admin " database is special and once authenticated provides access to all databases on the <nl> - server . <nl> - @ return true if successful <nl> - * / <nl> - bool authenticate ( const char * dbname , const char * user , const char * password ) ; <nl> - bool authenticateWithDigest ( const char * dbname , const char * user , const char * passwordDigest ) ; <nl> - <nl> - / * * Perform a query <nl> - @ param query A query object . { } matches all objects . <nl> - @ param nToReturn limit on the number of results to return <nl> - @ param nToSkip skip this many objects matched before returning objects <nl> - @ param fieldsToReturn Template of which fields of the matched objects should be returned . By <nl> - default all fields of the object are returned . On large objects , for better performance , request <nl> - only those fields that you need . If you plan to subsequentally call update ( ) , you will need <nl> - all fields . <nl> - @ return cursor <nl> - * / <nl> + / * overridden here to implement authCache for retries * / <nl> + virtual bool auth ( const char * dbname , const char * username , const char * pwd , string & errmsg , bool digestPassword = true ) ; <nl> + <nl> virtual auto_ptr < DBClientCursor > query ( const char * ns , BSONObj query , int nToReturn = 0 , int nToSkip = 0 , <nl> BSONObj * fieldsToReturn = 0 , int queryOptions = 0 ) { <nl> checkConnection ( ) ; <nl> namespace mongo { <nl> <nl> / * Use this class to connect to a replica pair of servers . The class will manage <nl> checking for which server in a replica pair is master , and do failover automatically . <nl> + <nl> + On a failover situation , expect at least one operation to return an error ( throw <nl> + an exception ) before the failover is complete . Operations are not retried . <nl> * / <nl> class DBClientPaired : public DBClientWithCommands { <nl> DBClientConnection left , right ; <nl>
|
c + + driver : cache authentications so that autoReconnect on a DBClientConnection will work
|
mongodb/mongo
|
84138952eb6aa800854c6143edf2921584f2b842
|
2009-01-24T22:36:39Z
|
mmm a / src / php / ext / grpc / channel_credentials . c <nl> ppp b / src / php / ext / grpc / channel_credentials . c <nl> PHP_METHOD ( ChannelCredentials , createSsl ) { <nl> } <nl> <nl> php_grpc_int hashkey_len = root_certs_length + cert_chain_length ; <nl> - char * hashkey = emalloc ( hashkey_len ) ; <nl> + char * hashkey = emalloc ( hashkey_len + 1 ) ; <nl> if ( root_certs_length > 0 ) { <nl> strcpy ( hashkey , pem_root_certs ) ; <nl> } <nl>
|
Merge pull request from ZhouyihaiDing / channel_hashkey_size
|
grpc/grpc
|
d29d709b35969d9a022905056c90d2d1bcec9b8f
|
2018-01-24T18:58:47Z
|
mmm a / Telegram / SourceFiles / platform / linux / specific_linux . cpp <nl> ppp b / Telegram / SourceFiles / platform / linux / specific_linux . cpp <nl> For license and copyright information please follow this link : <nl> # include < pwd . h > <nl> <nl> # include < iostream > <nl> + # include < QProcess > <nl> + # include < QVersionNumber > <nl> <nl> # include < qpa / qplatformnativeinterface . h > <nl> <nl> bool RunShellCommand ( const QByteArray & command ) { <nl> <nl> void FallbackFontConfig ( ) { <nl> # ifndef TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION <nl> - const auto path = cWorkingDir ( ) + " tdata / fc - version - check . txt " ; <nl> - const auto escaped = EscapeShell ( QFile : : encodeName ( path ) ) ; <nl> const auto custom = cWorkingDir ( ) + " tdata / fc - custom - 1 . conf " ; <nl> const auto finish = gsl : : finally ( [ & ] { <nl> if ( QFile ( custom ) . exists ( ) ) { <nl> void FallbackFontConfig ( ) { <nl> } <nl> } ) ; <nl> <nl> - const auto command = " fc - list - - version > " + escaped + " 2 > " + escaped ; <nl> - if ( ! RunShellCommand ( command ) ) { <nl> - LOG ( ( " App Error : Could not run ' % 1 ' " ) . arg ( QString : : fromLatin1 ( command ) ) ) ; <nl> - return ; <nl> - } else if ( ! QFile : : exists ( path ) ) { <nl> - LOG ( ( " App Error : Could not find fc - list - - version output from : " ) + path ) ; <nl> - return ; <nl> - } <nl> - QFile output ( path ) ; <nl> - if ( ! output . open ( QIODevice : : ReadOnly ) ) { <nl> - LOG ( ( " App Error : Could not open fc - list - - version output from : " ) + path ) ; <nl> + QProcess process ; <nl> + process . setProcessChannelMode ( QProcess : : MergedChannels ) ; <nl> + process . start ( " fc - list " , QStringList ( ) < < " - - version " ) ; <nl> + process . waitForFinished ( ) ; <nl> + if ( process . exitCode ( ) > 0 ) { <nl> + LOG ( ( " App Error : Could not start fc - list . Process exited with code : % 1 . " ) . arg ( process . exitCode ( ) ) ) ; <nl> return ; <nl> } <nl> - const auto result = QString : : fromLatin1 ( output . readAll ( ) ) ; <nl> - LOG ( ( " Fontconfig version string : " ) + result ) ; <nl> - const auto regex = QRegularExpression ( <nl> - " version \ \ s + ( \ \ d + ) \ \ . ( \ \ d + ) " , <nl> - QRegularExpression : : CaseInsensitiveOption ) ; <nl> - const auto match = regex . match ( result ) ; <nl> - if ( ! match . hasMatch ( ) ) { <nl> - LOG ( ( " App Error : Could not read fc - list - - version output from : " ) + path ) ; <nl> + <nl> + QString result ( process . readAllStandardOutput ( ) ) ; <nl> + DEBUG_LOG ( ( " Fontconfig version string : " ) + result ) ; <nl> + <nl> + QVersionNumber version = QVersionNumber : : fromString ( result . split ( " version " ) . last ( ) ) ; <nl> + if ( version . isNull ( ) ) { <nl> + LOG ( ( " App Error : Could not get version from fc - list output . " ) ) ; <nl> return ; <nl> } <nl> - const auto major = match . capturedRef ( 1 ) . toInt ( ) ; <nl> - const auto minor = match . capturedRef ( 2 ) . toInt ( ) ; <nl> - LOG ( ( " Fontconfig version : % 1 . % 2 " ) . arg ( major ) . arg ( minor ) ) ; <nl> - if ( major < = 2 & & ( major ! = 2 | | minor < = 12 ) ) { <nl> + <nl> + LOG ( ( " Fontconfig version : % 1 . " ) . arg ( version . toString ( ) ) ) ; <nl> + if ( version < QVersionNumber : : fromString ( " 2 . 13 " ) ) { <nl> if ( qgetenv ( " TDESKTOP_FORCE_CUSTOM_FONTCONFIG " ) . isEmpty ( ) ) { <nl> return ; <nl> } <nl> } <nl> + <nl> QFile ( " : / fc / fc - custom . conf " ) . copy ( custom ) ; <nl> # endif / / TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION <nl> } <nl>
|
Refactored FallbackFontConfig ( ) to use native Qt methods .
|
telegramdesktop/tdesktop
|
31e3a426a69b3e503818b9d8337386191990e8ad
|
2018-11-16T16:09:33Z
|
mmm a / include / grpcpp / impl / codegen / server_callback . h <nl> ppp b / include / grpcpp / impl / codegen / server_callback . h <nl> namespace grpc { <nl> / / Declare base class of all reactors as internal <nl> namespace internal { <nl> <nl> + / / Forward declarations <nl> + template < class Request , class Response > <nl> + class CallbackClientStreamingHandler ; <nl> + template < class Request , class Response > <nl> + class CallbackServerStreamingHandler ; <nl> + template < class Request , class Response > <nl> + class CallbackBidiHandler ; <nl> + <nl> class ServerReactor { <nl> public : <nl> virtual ~ ServerReactor ( ) = default ; <nl> virtual void OnDone ( ) = 0 ; <nl> virtual void OnCancel ( ) = 0 ; <nl> + <nl> + private : <nl> + friend class : : grpc : : ServerContext ; <nl> + template < class Request , class Response > <nl> + friend class CallbackClientStreamingHandler ; <nl> + template < class Request , class Response > <nl> + friend class CallbackServerStreamingHandler ; <nl> + template < class Request , class Response > <nl> + friend class CallbackBidiHandler ; <nl> + <nl> + / / The ServerReactor is responsible for tracking when it is safe to call <nl> + / / OnCancel . This function should not be called until after OnStarted is done <nl> + / / and the RPC has completed with a cancellation . This is tracked by counting <nl> + / / how many of these conditions have been met and calling OnCancel when none <nl> + / / remain unmet . <nl> + <nl> + void MaybeCallOnCancel ( ) { <nl> + if ( on_cancel_conditions_remaining_ . fetch_sub ( <nl> + 1 , std : : memory_order_acq_rel ) = = 1 ) { <nl> + OnCancel ( ) ; <nl> + } <nl> + } <nl> + <nl> + std : : atomic_int on_cancel_conditions_remaining_ { 2 } ; <nl> } ; <nl> <nl> } / / namespace internal <nl> class CallbackClientStreamingHandler : public MethodHandler { <nl> <nl> reader - > BindReactor ( reactor ) ; <nl> reactor - > OnStarted ( param . server_context , reader - > response ( ) ) ; <nl> + / / The earliest that OnCancel can be called is after OnStarted is done . <nl> + reactor - > MaybeCallOnCancel ( ) ; <nl> reader - > MaybeDone ( ) ; <nl> } <nl> <nl> class CallbackServerStreamingHandler : public MethodHandler { <nl> std : : move ( param . call_requester ) , reactor ) ; <nl> writer - > BindReactor ( reactor ) ; <nl> reactor - > OnStarted ( param . server_context , writer - > request ( ) ) ; <nl> + / / The earliest that OnCancel can be called is after OnStarted is done . <nl> + reactor - > MaybeCallOnCancel ( ) ; <nl> writer - > MaybeDone ( ) ; <nl> } <nl> <nl> class CallbackBidiHandler : public MethodHandler { <nl> <nl> stream - > BindReactor ( reactor ) ; <nl> reactor - > OnStarted ( param . server_context ) ; <nl> + / / The earliest that OnCancel can be called is after OnStarted is done . <nl> + reactor - > MaybeCallOnCancel ( ) ; <nl> stream - > MaybeDone ( ) ; <nl> } <nl> <nl> mmm a / src / cpp / server / server_context . cc <nl> ppp b / src / cpp / server / server_context . cc <nl> bool ServerContext : : CompletionOp : : FinalizeResult ( void * * tag , bool * status ) { <nl> bool call_cancel = ( cancelled_ ! = 0 ) ; <nl> <nl> / / If it ' s a unary cancel callback , call it under the lock so that it doesn ' t <nl> - / / race with ClearCancelCallback <nl> + / / race with ClearCancelCallback . Although we don ' t normally call callbacks <nl> + / / under a lock , this is a special case since the user needs a guarantee that <nl> + / / the callback won ' t issue or run after ClearCancelCallback has returned . <nl> + / / This requirement imposes certain restrictions on the callback , documented <nl> + / / in the API comments of SetCancelCallback . <nl> if ( cancel_callback_ ) { <nl> cancel_callback_ ( ) ; <nl> } <nl> <nl> - / / Release the lock since we are going to be calling a callback and <nl> - / / interceptors now <nl> + / / Release the lock since we may call a callback and interceptors now . <nl> lock . Unlock ( ) ; <nl> <nl> if ( call_cancel & & reactor_ ! = nullptr ) { <nl> - reactor_ - > OnCancel ( ) ; <nl> + reactor_ - > MaybeCallOnCancel ( ) ; <nl> } <nl> / * Add interception point and run through interceptors * / <nl> interceptor_methods_ . AddInterceptionHookPoint ( <nl> mmm a / test / cpp / end2end / end2end_test . cc <nl> ppp b / test / cpp / end2end / end2end_test . cc <nl> TEST_P ( End2endTest , DelayedRpcLateCanceledUsingCancelCallback ) { <nl> EchoResponse response ; <nl> request . set_message ( " Hello " ) ; <nl> request . mutable_param ( ) - > set_skip_cancelled_check ( true ) ; <nl> - / / Let server sleep for 80 ms first to give the cancellation a chance . <nl> - / / This is split into 40 ms to start the cancel and 40 ms extra time for <nl> + / / Let server sleep for 200 ms first to give the cancellation a chance . <nl> + / / This is split into 100 ms to start the cancel and 100 ms extra time for <nl> / / it to make it to the server , to make it highly probable that the server <nl> / / RPC would have already started by the time the cancellation is sent <nl> / / and the server - side gets enough time to react to it . <nl> - request . mutable_param ( ) - > set_server_sleep_us ( 80 * 1000 ) ; <nl> + request . mutable_param ( ) - > set_server_sleep_us ( 200000 ) ; <nl> <nl> std : : thread echo_thread { [ this , & context , & request , & response ] { <nl> Status s = stub_ - > Echo ( & context , request , & response ) ; <nl> EXPECT_EQ ( StatusCode : : CANCELLED , s . error_code ( ) ) ; <nl> } } ; <nl> - std : : this_thread : : sleep_for ( std : : chrono : : microseconds ( 40000 ) ) ; <nl> + std : : this_thread : : sleep_for ( std : : chrono : : microseconds ( 100000 ) ) ; <nl> context . TryCancel ( ) ; <nl> echo_thread . join ( ) ; <nl> } <nl> mmm a / test / cpp / end2end / test_service_impl . cc <nl> ppp b / test / cpp / end2end / test_service_impl . cc <nl> CallbackTestServiceImpl : : RequestStream ( ) { <nl> public : <nl> Reactor ( ) { } <nl> void OnStarted ( ServerContext * context , EchoResponse * response ) override { <nl> - ctx_ = context ; <nl> - response_ = response ; <nl> + / / Assign ctx_ and response_ as late as possible to increase likelihood of <nl> + / / catching any races <nl> + <nl> / / If ' server_try_cancel ' is set in the metadata , the RPC is cancelled by <nl> / / the server by calling ServerContext : : TryCancel ( ) depending on the <nl> / / value : <nl> CallbackTestServiceImpl : : RequestStream ( ) { <nl> server_try_cancel_ = GetIntValueFromMetadata ( <nl> kServerTryCancelRequest , context - > client_metadata ( ) , DO_NOT_CANCEL ) ; <nl> <nl> - response_ - > set_message ( " " ) ; <nl> + response - > set_message ( " " ) ; <nl> <nl> if ( server_try_cancel_ = = CANCEL_BEFORE_PROCESSING ) { <nl> - ServerTryCancelNonblocking ( ctx_ ) ; <nl> - return ; <nl> - } <nl> - <nl> - if ( server_try_cancel_ = = CANCEL_DURING_PROCESSING ) { <nl> - ctx_ - > TryCancel ( ) ; <nl> - / / Don ' t wait for it here <nl> + ServerTryCancelNonblocking ( context ) ; <nl> + ctx_ = context ; <nl> + } else { <nl> + if ( server_try_cancel_ = = CANCEL_DURING_PROCESSING ) { <nl> + context - > TryCancel ( ) ; <nl> + / / Don ' t wait for it here <nl> + } <nl> + ctx_ = context ; <nl> + response_ = response ; <nl> + StartRead ( & request_ ) ; <nl> } <nl> <nl> - StartRead ( & request_ ) ; <nl> + on_started_done_ = true ; <nl> } <nl> void OnDone ( ) override { delete this ; } <nl> void OnCancel ( ) override { <nl> + EXPECT_TRUE ( on_started_done_ ) ; <nl> EXPECT_TRUE ( ctx_ - > IsCancelled ( ) ) ; <nl> FinishOnce ( Status : : CANCELLED ) ; <nl> } <nl> CallbackTestServiceImpl : : RequestStream ( ) { <nl> int server_try_cancel_ ; <nl> std : : mutex finish_mu_ ; <nl> bool finished_ { false } ; <nl> + bool on_started_done_ { false } ; <nl> } ; <nl> <nl> return new Reactor ; <nl> CallbackTestServiceImpl : : ResponseStream ( ) { <nl> Reactor ( ) { } <nl> void OnStarted ( ServerContext * context , <nl> const EchoRequest * request ) override { <nl> - ctx_ = context ; <nl> - request_ = request ; <nl> + / / Assign ctx_ and request_ as late as possible to increase likelihood of <nl> + / / catching any races <nl> + <nl> / / If ' server_try_cancel ' is set in the metadata , the RPC is cancelled by <nl> / / the server by calling ServerContext : : TryCancel ( ) depending on the <nl> / / value : <nl> CallbackTestServiceImpl : : ResponseStream ( ) { <nl> kServerResponseStreamsToSend , context - > client_metadata ( ) , <nl> kServerDefaultResponseStreamsToSend ) ; <nl> if ( server_try_cancel_ = = CANCEL_BEFORE_PROCESSING ) { <nl> - ServerTryCancelNonblocking ( ctx_ ) ; <nl> - return ; <nl> - } <nl> - <nl> - if ( server_try_cancel_ = = CANCEL_DURING_PROCESSING ) { <nl> - ctx_ - > TryCancel ( ) ; <nl> - } <nl> - if ( num_msgs_sent_ < server_responses_to_send_ ) { <nl> - NextWrite ( ) ; <nl> + ServerTryCancelNonblocking ( context ) ; <nl> + ctx_ = context ; <nl> + } else { <nl> + if ( server_try_cancel_ = = CANCEL_DURING_PROCESSING ) { <nl> + context - > TryCancel ( ) ; <nl> + } <nl> + ctx_ = context ; <nl> + request_ = request ; <nl> + if ( num_msgs_sent_ < server_responses_to_send_ ) { <nl> + NextWrite ( ) ; <nl> + } <nl> } <nl> + on_started_done_ = true ; <nl> } <nl> void OnDone ( ) override { delete this ; } <nl> void OnCancel ( ) override { <nl> + EXPECT_TRUE ( on_started_done_ ) ; <nl> EXPECT_TRUE ( ctx_ - > IsCancelled ( ) ) ; <nl> FinishOnce ( Status : : CANCELLED ) ; <nl> } <nl> CallbackTestServiceImpl : : ResponseStream ( ) { <nl> int server_responses_to_send_ ; <nl> std : : mutex finish_mu_ ; <nl> bool finished_ { false } ; <nl> + bool on_started_done_ { false } ; <nl> } ; <nl> return new Reactor ; <nl> } <nl> CallbackTestServiceImpl : : BidiStream ( ) { <nl> public : <nl> Reactor ( ) { } <nl> void OnStarted ( ServerContext * context ) override { <nl> - ctx_ = context ; <nl> + / / Assign ctx_ as late as possible to increase likelihood of catching any <nl> + / / races <nl> + <nl> / / If ' server_try_cancel ' is set in the metadata , the RPC is cancelled by <nl> / / the server by calling ServerContext : : TryCancel ( ) depending on the <nl> / / value : <nl> CallbackTestServiceImpl : : BidiStream ( ) { <nl> server_write_last_ = GetIntValueFromMetadata ( <nl> kServerFinishAfterNReads , context - > client_metadata ( ) , 0 ) ; <nl> if ( server_try_cancel_ = = CANCEL_BEFORE_PROCESSING ) { <nl> - ServerTryCancelNonblocking ( ctx_ ) ; <nl> - return ; <nl> - } <nl> - <nl> - if ( server_try_cancel_ = = CANCEL_DURING_PROCESSING ) { <nl> - ctx_ - > TryCancel ( ) ; <nl> + ServerTryCancelNonblocking ( context ) ; <nl> + ctx_ = context ; <nl> + } else { <nl> + if ( server_try_cancel_ = = CANCEL_DURING_PROCESSING ) { <nl> + context - > TryCancel ( ) ; <nl> + } <nl> + ctx_ = context ; <nl> + StartRead ( & request_ ) ; <nl> } <nl> - <nl> - StartRead ( & request_ ) ; <nl> + on_started_done_ = true ; <nl> } <nl> void OnDone ( ) override { delete this ; } <nl> void OnCancel ( ) override { <nl> + EXPECT_TRUE ( on_started_done_ ) ; <nl> EXPECT_TRUE ( ctx_ - > IsCancelled ( ) ) ; <nl> FinishOnce ( Status : : CANCELLED ) ; <nl> } <nl> CallbackTestServiceImpl : : BidiStream ( ) { <nl> int server_write_last_ ; <nl> std : : mutex finish_mu_ ; <nl> bool finished_ { false } ; <nl> + bool on_started_done_ { false } ; <nl> } ; <nl> <nl> return new Reactor ; <nl>
|
Merge pull request from vjpai / cancel_order
|
grpc/grpc
|
ea59977fbc3812774cfb3efeb4fa82db1c389ec8
|
2019-04-10T23:15:43Z
|
mmm a / tensorflow / compiler / tf2tensorrt / convert / utils . cc <nl> ppp b / tensorflow / compiler / tf2tensorrt / convert / utils . cc <nl> string GetLoadedTensorRTVersion ( ) { <nl> return absl : : StrCat ( major , " . " , minor , " . " , patch ) ; <nl> } <nl> <nl> + bool AreShapesCompatible ( const std : : vector < TensorShape > & actual_shapes , <nl> + const std : : vector < TensorShape > & cached_shapes ) { <nl> + auto match_shape = [ ] ( const TensorShape & actual_shape , <nl> + const TensorShape & cached_shape ) { <nl> + / / Match the rank . <nl> + if ( actual_shape . dims ( ) ! = cached_shape . dims ( ) ) return false ; <nl> + / / Match the batch size . <nl> + if ( actual_shape . dim_size ( 0 ) > cached_shape . dim_size ( 0 ) ) return false ; <nl> + / / Match remaining dimensions . <nl> + for ( int i = 1 ; i < actual_shape . dims ( ) ; + + i ) { <nl> + if ( actual_shape . dim_size ( i ) ! = cached_shape . dim_size ( i ) ) return false ; <nl> + } <nl> + return true ; <nl> + } ; <nl> + for ( int i = 0 ; i < actual_shapes . size ( ) ; + + i ) { <nl> + if ( ! match_shape ( actual_shapes [ i ] , cached_shapes [ i ] ) ) { <nl> + return false ; <nl> + } <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> int GetNumberOfEngineInputs ( <nl> const nvinfer1 : : ICudaEngine * engine ) { <nl> int n_bindings = engine - > getNbBindings ( ) ; <nl> mmm a / tensorflow / compiler / tf2tensorrt / convert / utils . h <nl> ppp b / tensorflow / compiler / tf2tensorrt / convert / utils . h <nl> string GetLinkedTensorRTVersion ( ) ; <nl> / / TensorRT library version information { Maj , Min , Patch } . <nl> string GetLoadedTensorRTVersion ( ) ; <nl> <nl> + / / Return true if an engine built for cached_shapes can also run actual_shapes . <nl> + bool AreShapesCompatible ( const std : : vector < TensorShape > & actual_shapes , <nl> + const std : : vector < TensorShape > & cached_shapes ) ; <nl> + <nl> / / Returns the number of inputs for the engine , which also correspends to the <nl> / / number of input tensors for the network . This can differ from the number of <nl> / / input bindings , because each profile has a set of bindings . <nl> mmm a / tensorflow / compiler / tf2tensorrt / kernels / trt_engine_op . cc <nl> ppp b / tensorflow / compiler / tf2tensorrt / kernels / trt_engine_op . cc <nl> class TRTEngineOp : public AsyncOpKernel { <nl> Status GetEngineCacheResource ( OpKernelContext * ctx , <nl> TRTEngineCacheResource * * cache_res ) ; <nl> <nl> - / / Get engine for the input shape <nl> - StatusOr < EngineContext * > GetEngine ( <nl> - const std : : vector < TensorShape > & input_shapes , OpKernelContext * ctx , <nl> - TRTEngineCacheResource * cache_res ) ; <nl> + / / Return a pair of 1 ) An EngineContext object that is compatible with the <nl> + / / input and 2 ) The index of the IExecutionContext compatible with the input . <nl> + StatusOr < std : : pair < EngineContext * , int > > GetEngine ( <nl> + const std : : vector < TensorShape > & input_concrete_shapes , <nl> + OpKernelContext * ctx , TRTEngineCacheResource * cache_res ) ; <nl> <nl> / / Verify that the input shapes are consistent and can be handled by this op . <nl> Status VerifyInputShapes ( const std : : vector < TensorShape > & shapes ) ; <nl> <nl> - / / Return engine batch in cached_engine_batch_sizes_ which is closest to input <nl> - / / batch . <nl> - Status GetEngineInputShapes ( <nl> - const CacheType & cache , <nl> - const std : : vector < TensorShape > & actual_input_shapes , <nl> - std : : vector < TensorShape > * engine_input_shapes ) ; <nl> - <nl> std : : vector < string > input_nodes_ ; <nl> std : : vector < string > output_nodes_ ; <nl> <nl> class TRTEngineOp : public AsyncOpKernel { <nl> / / Whether to calibrate INT8 engine . <nl> bool calibration_mode_ ; <nl> <nl> - / / Whether to use implicit batch dimension for TensorRT <nl> + / / Whether to use implicit batch dimension for TensorRT . <nl> bool use_implicit_batch_ ; <nl> <nl> - / / Maximum number of cached engines <nl> + / / Maximum number of cached engines . <nl> int max_cached_engines_ ; <nl> <nl> int64 workspace_size_ ; <nl> Status TRTEngineOp : : VerifyInputShapes ( <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - bool AreShapesCompatible ( const std : : vector < TensorShape > & actual_shapes , <nl> - const std : : vector < TensorShape > & cached_shapes ) { <nl> - auto match_shape = [ ] ( const TensorShape & actual_shape , <nl> - const TensorShape & cached_shape ) { <nl> - / / Match the rank . <nl> - if ( actual_shape . dims ( ) ! = cached_shape . dims ( ) ) return false ; <nl> - / / Match the batch size . <nl> - if ( actual_shape . dim_size ( 0 ) > cached_shape . dim_size ( 0 ) ) return false ; <nl> - / / Match remaining dimensions . <nl> - for ( int i = 1 ; i < actual_shape . dims ( ) ; + + i ) { <nl> - if ( actual_shape . dim_size ( i ) ! = cached_shape . dim_size ( i ) ) return false ; <nl> - } <nl> - return true ; <nl> - } ; <nl> - for ( int i = 0 ; i < actual_shapes . size ( ) ; + + i ) { <nl> - if ( ! match_shape ( actual_shapes [ i ] , cached_shapes [ i ] ) ) { <nl> - return false ; <nl> - } <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - / / This routine finds the engines with input shapes compatible with the <nl> - / / actual_input_shapes , and returns the input shapes of one of such engine that <nl> - / / has the smallest batch size . <nl> - Status TRTEngineOp : : GetEngineInputShapes ( <nl> - const CacheType & cache , const std : : vector < TensorShape > & actual_input_shapes , <nl> - std : : vector < TensorShape > * engine_input_shapes ) { <nl> - / / VerifyInputShapes ( ) already ensured that all input shapes have same <nl> - / / batch size , and are not scalars , if we are in implicit batch mode . <nl> - / / <nl> - / / In explicit batch mode we plan to have single engine in the cache , and we <nl> - / / return its shape if it is compatible . <nl> - * engine_input_shapes = actual_input_shapes ; <nl> - int64 min_matched_batch_size = kint64max ; <nl> - for ( const auto & pair : cache ) { <nl> - const std : : vector < TensorShape > & cached_input_shapes = pair . first ; <nl> - / / This should not happen , but just for safety . <nl> - if ( actual_input_shapes . size ( ) ! = cached_input_shapes . size ( ) ) { <nl> - return errors : : InvalidArgument ( <nl> - " Input shape list size mismatch for " , name ( ) , <nl> - " , cached size : " , cached_input_shapes . size ( ) , <nl> - " vs . actual size : " , actual_input_shapes . size ( ) ) ; <nl> - } <nl> - if ( AreShapesCompatible ( actual_input_shapes , cached_input_shapes ) ) { <nl> - const int cached_batch_size = cached_input_shapes [ 0 ] . dim_size ( 0 ) ; <nl> - if ( min_matched_batch_size > cached_batch_size ) { <nl> - min_matched_batch_size = cached_batch_size ; <nl> - * engine_input_shapes = cached_input_shapes ; <nl> - } <nl> - } <nl> - } <nl> - return Status : : OK ( ) ; <nl> - } <nl> - <nl> void TRTEngineOp : : ComputeAsync ( OpKernelContext * ctx , <nl> AsyncOpKernel : : DoneCallback done ) { <nl> auto helper = new AsyncHelper ( done ) ; <nl> void TRTEngineOp : : ComputeAsync ( OpKernelContext * ctx , <nl> cache_res - > profiles_ . InitProfiles ( ) ; <nl> } <nl> } <nl> - StatusOr < EngineContext * > status = <nl> + StatusOr < std : : pair < EngineContext * , int > > status = <nl> GetEngine ( input_concrete_shapes , ctx , cache_res ) ; <nl> OP_REQUIRES_OK_ASYNC ( ctx , status . status ( ) , * helper ) ; <nl> <nl> - EngineContext * engine_context = status . ValueOrDie ( ) ; <nl> - / / Context idx equals with the profile idx because for each profile we create <nl> - / / one context . Currently we do not have profile_generation mode , therefore we <nl> - / / have just a single profile . <nl> - int trt_context_idx = 0 ; <nl> + EngineContext * engine_context = status . ValueOrDie ( ) . first ; <nl> + int trt_context_idx = status . ValueOrDie ( ) . second ; <nl> if ( ! engine_context - > cuda_engine ) { <nl> VLOG ( 1 ) < < " Engine retrieval for input shapes : " <nl> < < TensorShapeUtils : : ShapeListString ( input_concrete_shapes ) <nl> bool TRTEngineOp : : ExecuteTrtEngine ( OpKernelContext * ctx , <nl> } <nl> <nl> const bool kRetry = true ; <nl> - if ( trt_context_idx > = 1 ) { <nl> + if ( trt_context_idx > = engine_context - > execution_context . size ( ) ) { <nl> LOG ( ERROR ) < < " Requested engine context with index " < < trt_context_idx <nl> - < < " , but only 1 context is present . " ; <nl> + < < " , but only " < < engine_context - > execution_context . size ( ) <nl> + < < " contexts are present . " ; <nl> return kRetry ; <nl> } <nl> - auto & execution_context = engine_context - > execution_context ; <nl> + auto & execution_context = engine_context - > execution_context [ trt_context_idx ] ; <nl> const int num_binding = cuda_engine - > getNbBindings ( ) ; <nl> std : : vector < void * > buffers ( num_binding ) ; <nl> <nl> Status TRTEngineOp : : GetEngineCacheResource ( OpKernelContext * ctx , <nl> } } ) ; <nl> } <nl> <nl> - StatusOr < EngineContext * > TRTEngineOp : : GetEngine ( <nl> + StatusOr < std : : pair < EngineContext * , int > > TRTEngineOp : : GetEngine ( <nl> const std : : vector < TensorShape > & input_concrete_shapes , OpKernelContext * ctx , <nl> TRTEngineCacheResource * cache_res ) { <nl> static EngineContext empty_context ; <nl> StatusOr < EngineContext * > TRTEngineOp : : GetEngine ( <nl> auto & cache = cache_res - > cache_ ; <nl> auto allocator = cache_res - > allocator_ . get ( ) ; <nl> if ( allocator = = nullptr ) { <nl> - return & empty_context ; <nl> + return std : : pair < EngineContext * , int > ( & empty_context , 0 ) ; <nl> } <nl> <nl> / / Handle the static engine case . For static engines , the cache will have a <nl> StatusOr < EngineContext * > TRTEngineOp : : GetEngine ( <nl> / / implicit batch is disabled . <nl> if ( ! use_implicit_batch_ | | <nl> AreShapesCompatible ( input_concrete_shapes , cache . begin ( ) - > first ) ) { <nl> - return cache . begin ( ) - > second . get ( ) ; <nl> + return std : : pair < EngineContext * , int > ( cache . begin ( ) - > second . get ( ) , 0 ) ; <nl> } <nl> - return & empty_context ; <nl> + return std : : pair < EngineContext * , int > ( & empty_context , 0 ) ; <nl> } <nl> <nl> TrtUniquePtrType < IRuntime > infer ( nvinfer1 : : createInferRuntime ( logger ) ) ; <nl> StatusOr < EngineContext * > TRTEngineOp : : GetEngine ( <nl> infer - > deserializeCudaEngine ( serialized_segment_ . c_str ( ) , <nl> serialized_segment_ . size ( ) , nullptr ) ) ; <nl> if ( ! static_engine ) { <nl> - return & empty_context ; <nl> + return std : : pair < EngineContext * , int > ( & empty_context , 0 ) ; <nl> } <nl> auto raw_static_engine = static_engine . get ( ) ; <nl> const auto max_batch_size = raw_static_engine - > getMaxBatchSize ( ) ; <nl> StatusOr < EngineContext * > TRTEngineOp : : GetEngine ( <nl> / / Swap with temporary empty string to deallocate the CPU memory . <nl> serialized_segment_ . swap ( tmp ) ; <nl> if ( use_implicit_batch_ & & ( max_batch_size < batch_size ) ) { <nl> - return & empty_context ; <nl> + return std : : pair < EngineContext * , int > ( & empty_context , 0 ) ; <nl> } <nl> - return cache . at ( engine_input_shapes ) . get ( ) ; <nl> + return std : : pair < EngineContext * , int > ( cache . at ( engine_input_shapes ) . get ( ) , <nl> + 0 ) ; <nl> } / / static_engine_ <nl> <nl> - / / Handle the dynamic engine case . See if there is a compatible engine cached . <nl> - std : : vector < TensorShape > engine_input_shapes ; <nl> - TF_RETURN_IF_ERROR ( <nl> - GetEngineInputShapes ( cache , input_concrete_shapes , & engine_input_shapes ) ) ; <nl> + int profile_id = - 1 ; <nl> + if ( ! use_implicit_batch_ ) { <nl> + profile_id = cache_res - > profiles_ . GetProfileNumber ( input_concrete_shapes ) ; <nl> + / / Since all profiles are already created at this point , <nl> + / / finding no compatible profiles results in falling back <nl> + / / to native TF . <nl> + if ( profile_id = = - 1 ) { <nl> + return std : : pair < EngineContext * , int > ( & empty_context , 0 ) ; <nl> + } <nl> + } <nl> + <nl> + EngineContext * engine_contexts ; <nl> + if ( use_implicit_batch_ ) { <nl> + engine_contexts = cache_res - > GetEngineContext ( input_concrete_shapes ) ; <nl> + } else { <nl> + engine_contexts = cache_res - > GetEngineContext ( profile_id ) ; <nl> + } <nl> <nl> - / / If matched , use that engine . Otherwise , we will look in cache for that <nl> - / / exact shape and possibly create a new engine if it is not in cache . <nl> - if ( ! cache . count ( engine_input_shapes ) ) { <nl> + / / If cache does not have a compatible engine <nl> + / / then create a new engine . <nl> + if ( engine_contexts = = nullptr ) { <nl> TrtUniquePtrType < nvinfer1 : : ICudaEngine > engine ; <nl> bool convert_successfully = false ; <nl> LOG ( INFO ) < < " Building a new TensorRT engine for " < < name ( ) <nl> StatusOr < EngineContext * > TRTEngineOp : : GetEngine ( <nl> / / Store an empty engine in the cache for these input shapes so we don ' t <nl> / / try to build the same failing engine again . <nl> cache . emplace ( input_concrete_shapes , absl : : make_unique < EngineContext > ( ) ) ; <nl> - return & empty_context ; <nl> + return std : : pair < EngineContext * , int > ( & empty_context , 0 ) ; <nl> } <nl> std : : vector < TrtUniquePtrType < nvinfer1 : : IExecutionContext > > exec_context ; <nl> cache_res - > profiles_ . CreateExecutionContexts ( engine . get ( ) , exec_context ) ; <nl> cache . emplace ( input_concrete_shapes , <nl> absl : : make_unique < EngineContext > ( std : : move ( engine ) , <nl> - std : : move ( exec_context [ 0 ] ) ) ) ; <nl> + std : : move ( exec_context ) ) ) ; <nl> VLOG ( 1 ) < < " Added new engine to cache of " < < name ( ) <nl> < < " . Cache size : " < < cache . size ( ) ; <nl> + engine_contexts = cache . at ( input_concrete_shapes ) . get ( ) ; <nl> } <nl> - return cache . at ( engine_input_shapes ) . get ( ) ; <nl> + return std : : pair < EngineContext * , int > ( engine_contexts , <nl> + use_implicit_batch_ ? 0 : profile_id ) ; <nl> } <nl> <nl> / / TODO ( hinsu ) : Move this allocation to CalibrationContext constructor , if <nl> mmm a / tensorflow / compiler / tf2tensorrt / kernels / trt_engine_resource_ops . cc <nl> ppp b / tensorflow / compiler / tf2tensorrt / kernels / trt_engine_resource_ops . cc <nl> class InitializeTRTResource : public OpKernel { <nl> resource - > cache_ . emplace ( <nl> engine_input_shapes , <nl> absl : : make_unique < EngineContext > ( <nl> - std : : move ( engine ) , std : : move ( ctx_vec [ 0 ] ) ) ) ; <nl> + std : : move ( engine ) , std : : move ( ctx_vec ) ) ) ; <nl> + + num_loaded_engine ; <nl> } while ( 1 ) ; <nl> VLOG ( 1 ) < < " Loaded " < < num_loaded_engine < < " TRT engines for op " <nl> mmm a / tensorflow / compiler / tf2tensorrt / utils / trt_lru_cache . cc <nl> ppp b / tensorflow / compiler / tf2tensorrt / utils / trt_lru_cache . cc <nl> string TRTEngineCacheResource : : DebugString ( ) const { <nl> mutex_lock lock ( item . second - > mu ) ; <nl> oss < < TensorShapeUtils : : ShapeListString ( item . first ) < < " : " < < hex <nl> < < " ICudaEngine : " < < item . second - > cuda_engine . get ( ) < < " , " <nl> - < < " IExecutionContext : " < < item . second - > execution_context . get ( ) < < dec <nl> - < < endl ; <nl> + < < " IExecutionContext : " ; <nl> + for ( auto & ctx : item . second - > execution_context ) { <nl> + oss < < ctx . get ( ) < < " , " ; <nl> + } <nl> + oss < < dec < < endl ; <nl> } <nl> return oss . str ( ) ; <nl> } <nl> <nl> + EngineContext * TRTEngineCacheResource : : GetEngineContext ( <nl> + const std : : vector < TensorShape > & input_shapes ) { <nl> + EngineContext * engine_context = nullptr ; <nl> + int64 min_matched_batch_size = kint64max ; <nl> + for ( const auto & pair : cache_ ) { <nl> + const std : : vector < TensorShape > & cached_input_shapes = pair . first ; <nl> + / / This should not happen , but just for safety . <nl> + if ( input_shapes . size ( ) ! = cached_input_shapes . size ( ) ) { <nl> + LOG ( ERROR ) < < " Input shape list size mismatch " <nl> + < < " , cached size : " < < cached_input_shapes . size ( ) <nl> + < < " vs . input size : " < < input_shapes . size ( ) ; <nl> + } <nl> + if ( AreShapesCompatible ( input_shapes , cached_input_shapes ) ) { <nl> + const int cached_batch_size = cached_input_shapes [ 0 ] . dim_size ( 0 ) ; <nl> + if ( min_matched_batch_size > cached_batch_size ) { <nl> + min_matched_batch_size = cached_batch_size ; <nl> + engine_context = pair . second . get ( ) ; <nl> + } <nl> + } <nl> + } <nl> + return engine_context ; <nl> + } <nl> + <nl> + EngineContext * TRTEngineCacheResource : : GetEngineContext ( const int profile_id ) { <nl> + if ( profile_id > = profiles_ . GetNumProfiles ( ) ) { <nl> + LOG ( ERROR ) < < " Out of range : profile_id " < < profile_id <nl> + < < " is larger than number of profiles " <nl> + < < profiles_ . GetNumProfiles ( ) ; <nl> + return nullptr ; <nl> + } <nl> + if ( cache_ . size ( ) > 1 ) { <nl> + LOG ( ERROR ) < < " Cache is expected to have at most " <nl> + < < " 1 engine in explicit batch mode where profiles are used . " ; <nl> + return nullptr ; <nl> + } <nl> + if ( cache_ . size ( ) = = 0 ) { <nl> + return nullptr ; <nl> + } <nl> + return cache_ . begin ( ) - > second . get ( ) ; <nl> + } <nl> + <nl> } / / namespace tensorrt <nl> } / / namespace tensorflow <nl> <nl> mmm a / tensorflow / compiler / tf2tensorrt / utils / trt_lru_cache . h <nl> ppp b / tensorflow / compiler / tf2tensorrt / utils / trt_lru_cache . h <nl> limitations under the License . <nl> # include < unordered_map > <nl> <nl> # include " tensorflow / compiler / tf2tensorrt / convert / utils . h " <nl> - # include " tensorflow / compiler / tf2tensorrt / utils / trt_shape_optimization_profiles . h " <nl> # include " tensorflow / compiler / tf2tensorrt / utils / trt_allocator . h " <nl> # include " tensorflow / compiler / tf2tensorrt / utils / trt_int8_calibrator . h " <nl> # include " tensorflow / compiler / tf2tensorrt / utils / trt_logger . h " <nl> + # include " tensorflow / compiler / tf2tensorrt / utils / trt_shape_optimization_profiles . h " <nl> # include " tensorflow / core / framework / resource_mgr . h " <nl> # include " tensorflow / core / lib / core / errors . h " <nl> <nl> struct EngineContext { <nl> EngineContext ( <nl> TrtUniquePtrType < nvinfer1 : : ICudaEngine > & & input_cuda_engine , <nl> TrtUniquePtrType < nvinfer1 : : IExecutionContext > & & input_execution_context ) <nl> + : cuda_engine ( std : : move ( input_cuda_engine ) ) { <nl> + execution_context . push_back ( std : : move ( input_execution_context ) ) ; <nl> + } <nl> + EngineContext ( TrtUniquePtrType < nvinfer1 : : ICudaEngine > & & input_cuda_engine , <nl> + std : : vector < TrtUniquePtrType < nvinfer1 : : IExecutionContext > > & & <nl> + input_execution_context ) <nl> : cuda_engine ( std : : move ( input_cuda_engine ) ) , <nl> execution_context ( std : : move ( input_execution_context ) ) { } <nl> <nl> mutex mu ; <nl> TrtUniquePtrType < nvinfer1 : : ICudaEngine > cuda_engine ; <nl> - TrtUniquePtrType < nvinfer1 : : IExecutionContext > execution_context <nl> + <nl> + / / In explicit batch mode , we maintain a vector of contexts for each engine , <nl> + / / where each context is created for a different profile . <nl> + std : : vector < TrtUniquePtrType < nvinfer1 : : IExecutionContext > > execution_context <nl> GUARDED_BY ( mu ) ; <nl> } ; <nl> <nl> class TRTEngineCacheResource : public ResourceBase { <nl> <nl> string DebugString ( ) const override ; <nl> <nl> + / / Returns the EngineContext that is compatible with input_shapes . <nl> + / / Returns nullptr if no compatible EngineContexts is found in cache . <nl> + EngineContext * GetEngineContext ( const std : : vector < TensorShape > & input_shapes ) ; <nl> + <nl> + / / Returns the EngineContext that is compatible with profile_id . <nl> + / / This function should be only called in explicit batch mode where <nl> + / / cache size is expected to be at most one . <nl> + / / Returns nullptr if no compatible EngineContexts is found in cache . <nl> + EngineContext * GetEngineContext ( const int profile_id ) ; <nl> + <nl> / / Keep device allocator for TRT . <nl> std : : unique_ptr < TRTBaseAllocator > allocator_ ; <nl> <nl> class TRTEngineCacheResource : public ResourceBase { <nl> / / attach it to each item of the cache . <nl> std : : unique_ptr < CalibrationContext > calib_ctx_ ; <nl> <nl> - / / This object maintains all the optimization profiles during profile generation <nl> - / / and engine build . We currently don ' t use this object during runtime , instead <nl> - / / we deserialize the profiles out of the cached engines . <nl> + / / This object maintains all the optimization profiles during profile <nl> + / / generation and engine build . We currently don ' t use this object during <nl> + / / runtime , instead we deserialize the profiles out of the cached engines . <nl> TrtShapeOptimizationProfile profiles_ ; <nl> } ; <nl> <nl>
|
Implement multiple TRT engine contexts and lookup methods for them
|
tensorflow/tensorflow
|
d8d6ddd802bdf20d6f38589147b265b7d08257cb
|
2020-02-11T14:16:32Z
|
mmm a / src / rpc / mining . cpp <nl> ppp b / src / rpc / mining . cpp <nl> <nl> # include < univalue . h > <nl> # include < util / fees . h > <nl> # include < util / strencodings . h > <nl> + # include < util / string . h > <nl> # include < util / system . h > <nl> # include < validation . h > <nl> # include < validationinterface . h > <nl> static UniValue getblocktemplate ( const JSONRPCRequest & request ) <nl> result . pushKV ( " transactions " , transactions ) ; <nl> result . pushKV ( " coinbaseaux " , aux ) ; <nl> result . pushKV ( " coinbasevalue " , ( int64_t ) pblock - > vtx [ 0 ] - > vout [ 0 ] . nValue ) ; <nl> - result . pushKV ( " longpollid " , : : ChainActive ( ) . Tip ( ) - > GetBlockHash ( ) . GetHex ( ) + i64tostr ( nTransactionsUpdatedLast ) ) ; <nl> + result . pushKV ( " longpollid " , : : ChainActive ( ) . Tip ( ) - > GetBlockHash ( ) . GetHex ( ) + ToString ( nTransactionsUpdatedLast ) ) ; <nl> result . pushKV ( " target " , hashTarget . GetHex ( ) ) ; <nl> result . pushKV ( " mintime " , ( int64_t ) pindexPrev - > GetMedianTimePast ( ) + 1 ) ; <nl> result . pushKV ( " mutable " , aMutable ) ; <nl> mmm a / src / test / fuzz / integer . cpp <nl> ppp b / src / test / fuzz / integer . cpp <nl> <nl> # include < uint256 . h > <nl> # include < util / moneystr . h > <nl> # include < util / strencodings . h > <nl> + # include < util / string . h > <nl> # include < util / system . h > <nl> # include < util / time . h > <nl> # include < version . h > <nl> void test_one_input ( const std : : vector < uint8_t > & buffer ) <nl> / / ( void ) GetVirtualTransactionSize ( i64 , i64 , u32 ) ; / / function defined only for a subset of int64_t / uint32_t inputs <nl> ( void ) HexDigit ( ch ) ; <nl> ( void ) MoneyRange ( i64 ) ; <nl> - ( void ) i64tostr ( i64 ) ; <nl> + ( void ) ToString ( i64 ) ; <nl> ( void ) IsDigit ( ch ) ; <nl> ( void ) IsSpace ( ch ) ; <nl> ( void ) IsSwitchChar ( ch ) ; <nl> mmm a / src / test / fuzz / locale . cpp <nl> ppp b / src / test / fuzz / locale . cpp <nl> <nl> # include < test / fuzz / fuzz . h > <nl> # include < tinyformat . h > <nl> # include < util / strencodings . h > <nl> + # include < util / string . h > <nl> <nl> # include < cassert > <nl> # include < clocale > <nl> void test_one_input ( const std : : vector < uint8_t > & buffer ) <nl> const int atoi_without_locale = atoi ( random_string ) ; <nl> const int64_t atoi64c_without_locale = atoi64 ( random_string . c_str ( ) ) ; <nl> const int64_t random_int64 = fuzzed_data_provider . ConsumeIntegral < int64_t > ( ) ; <nl> - const std : : string i64tostr_without_locale = i64tostr ( random_int64 ) ; <nl> + const std : : string tostring_without_locale = ToString ( random_int64 ) ; <nl> const int32_t random_int32 = fuzzed_data_provider . ConsumeIntegral < int32_t > ( ) ; <nl> const std : : string strprintf_int_without_locale = strprintf ( " % d " , random_int64 ) ; <nl> const double random_double = fuzzed_data_provider . ConsumeFloatingPoint < double > ( ) ; <nl> void test_one_input ( const std : : vector < uint8_t > & buffer ) <nl> assert ( atoi64c_without_locale = = atoi64c_with_locale ) ; <nl> const int atoi_with_locale = atoi ( random_string ) ; <nl> assert ( atoi_without_locale = = atoi_with_locale ) ; <nl> - const std : : string i64tostr_with_locale = i64tostr ( random_int64 ) ; <nl> - assert ( i64tostr_without_locale = = i64tostr_with_locale ) ; <nl> + const std : : string tostring_with_locale = ToString ( random_int64 ) ; <nl> + assert ( tostring_without_locale = = tostring_with_locale ) ; <nl> const std : : string strprintf_int_with_locale = strprintf ( " % d " , random_int64 ) ; <nl> assert ( strprintf_int_without_locale = = strprintf_int_with_locale ) ; <nl> const std : : string strprintf_double_with_locale = strprintf ( " % f " , random_double ) ; <nl> mmm a / src / util / strencodings . cpp <nl> ppp b / src / util / strencodings . cpp <nl> std : : string FormatParagraph ( const std : : string & in , size_t width , size_t indent ) <nl> return out . str ( ) ; <nl> } <nl> <nl> - std : : string i64tostr ( int64_t n ) <nl> - { <nl> - return strprintf ( " % d " , n ) ; <nl> - } <nl> - <nl> int64_t atoi64 ( const char * psz ) <nl> { <nl> # ifdef _MSC_VER <nl> mmm a / src / util / strencodings . h <nl> ppp b / src / util / strencodings . h <nl> std : : string EncodeBase32 ( const unsigned char * pch , size_t len ) ; <nl> std : : string EncodeBase32 ( const std : : string & str ) ; <nl> <nl> void SplitHostPort ( std : : string in , int & portOut , std : : string & hostOut ) ; <nl> - std : : string i64tostr ( int64_t n ) ; <nl> int64_t atoi64 ( const char * psz ) ; <nl> int64_t atoi64 ( const std : : string & str ) ; <nl> int atoi ( const std : : string & str ) ; <nl> mmm a / src / wallet / wallet . h <nl> ppp b / src / wallet / wallet . h <nl> <nl> # include < ui_interface . h > <nl> # include < util / message . h > <nl> # include < util / strencodings . h > <nl> + # include < util / string . h > <nl> # include < util / system . h > <nl> # include < validationinterface . h > <nl> # include < wallet / coinselection . h > <nl> static inline void WriteOrderPos ( const int64_t & nOrderPos , mapValue_t & mapValue ) <nl> { <nl> if ( nOrderPos = = - 1 ) <nl> return ; <nl> - mapValue [ " n " ] = i64tostr ( nOrderPos ) ; <nl> + mapValue [ " n " ] = ToString ( nOrderPos ) ; <nl> } <nl> <nl> struct COutputEntry <nl>
|
util : Replace i64tostr with ToString
|
bitcoin/bitcoin
|
faaf1cb5b9a4c22b21757f7578833f908b79b867
|
2020-03-27T14:14:08Z
|
mmm a / hphp / compiler / compiler . cpp <nl> ppp b / hphp / compiler / compiler . cpp <nl> int hhbcTarget ( const CompilerOptions & po , AnalysisResultPtr ar , <nl> AsyncFileCacheSaver & fcThread ) ; <nl> int runTargetCheck ( const CompilerOptions & po , AnalysisResultPtr ar , <nl> AsyncFileCacheSaver & fcThread ) ; <nl> - int buildTarget ( const CompilerOptions & po ) ; <nl> int runTarget ( const CompilerOptions & po ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> int hhbcTarget ( const CompilerOptions & po , AnalysisResultPtr ar , <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - int buildTarget ( const CompilerOptions & po ) { <nl> - const char * HPHP_HOME = getenv ( " HPHP_HOME " ) ; <nl> - if ( ! HPHP_HOME | | ! * HPHP_HOME ) { <nl> - throw Exception ( " Environment variable HPHP_HOME is not set . " ) ; <nl> - } <nl> - string cmd = string ( HPHP_HOME ) + " / hphp / legacy / run . sh " ; <nl> - string flags ; <nl> - if ( getenv ( " RELEASE " ) ) flags + = " RELEASE = 1 " ; <nl> - if ( getenv ( " SHOW_LINK " ) ) flags + = " SHOW_LINK = 1 " ; <nl> - if ( getenv ( " SHOW_COMPILE " ) ) flags + = " SHOW_COMPILE = 1 " ; <nl> - if ( po . format = = " lib " ) flags + = " HPHP_BUILD_LIBRARY = 1 " ; <nl> - const char * argv [ ] = { " " , po . outputDir . c_str ( ) , <nl> - po . program . c_str ( ) , flags . c_str ( ) , nullptr } ; <nl> - <nl> - if ( getenv ( " SHOW_COMPILE " ) ) { <nl> - Logger : : Info ( " Compile command : % s % s % s " , po . outputDir . c_str ( ) , <nl> - po . program . c_str ( ) , flags . c_str ( ) ) ; <nl> - } <nl> - Timer timer ( Timer : : WallTime , " compiling and linking CPP files " ) ; <nl> - string out , err ; <nl> - bool ret = Process : : Exec ( cmd . c_str ( ) , argv , nullptr , out , & err ) ; <nl> - if ( getenv ( " SHOW_COMPILE " ) ) { <nl> - Logger : : Info ( " % s " , out . c_str ( ) ) ; <nl> - } else { <nl> - Logger : : Verbose ( " % s " , out . c_str ( ) ) ; <nl> - } <nl> - if ( ! err . empty ( ) ) { <nl> - Logger : : Error ( " % s " , err . c_str ( ) ) ; <nl> - } <nl> - if ( ! ret ) { <nl> - return 1 ; <nl> - } <nl> - <nl> - return 0 ; <nl> - } <nl> - <nl> int runTargetCheck ( const CompilerOptions & po , AnalysisResultPtr ar , <nl> AsyncFileCacheSaver & fcThread ) { <nl> / / generate code <nl>
|
Remove unused buildTarget function in compiler . cpp
|
facebook/hhvm
|
d44f93f14ecaa2e8f038a520dc8f69d59abc05a9
|
2013-03-21T23:13:06Z
|
mmm a / test / ClangModules / ctypes_ir . swift <nl> ppp b / test / ClangModules / ctypes_ir . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift % clang - importer - sdk - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - emit - ir - o - % s | FileCheck % s <nl> + / / RUN : % swift % clang - importer - sdk - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - emit - ir - o - - primary - file % s | FileCheck % s <nl> <nl> import ctypes <nl> <nl> mmm a / test / ClangModules / objc_ir . swift <nl> ppp b / test / ClangModules / objc_ir . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift % clang - importer - sdk - module - cache - path % t / clang - module - cache - I % S / Inputs / custom - modules - target x86_64 - apple - macosx10 . 9 - emit - ir - o - % s | FileCheck % s <nl> + / / RUN : % swift % clang - importer - sdk - module - cache - path % t / clang - module - cache - I % S / Inputs / custom - modules - target x86_64 - apple - macosx10 . 9 - emit - ir - o - - primary - file % s | FileCheck % s <nl> <nl> / / CHECK : [ [ B : % CSo1B ] ] = type <nl> <nl> mmm a / test / DebugInfo / accessors . swift <nl> ppp b / test / DebugInfo / accessors . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> <nl> / / Verify that we generate appropriate names for accessors . <nl> / / CHECK : DW_TAG_subprogram { { . * } } x . get <nl> mmm a / test / DebugInfo / anonymous . swift <nl> ppp b / test / DebugInfo / anonymous . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> / / Don ' t crash when emitting debug info for anonymous variables . <nl> / / CHECK : variable { { . * } } [ _ ] <nl> protocol F_ { <nl> mmm a / test / DebugInfo / archetype . swift <nl> ppp b / test / DebugInfo / archetype . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> <nl> protocol IntegerArithmeticType { <nl> class func uncheckedSubtract ( lhs : Self , rhs : Self ) - > ( Self , Bool ) <nl> mmm a / test / DebugInfo / argument . swift <nl> ppp b / test / DebugInfo / argument . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> <nl> / / CHECK - DAG : [ DW_TAG_arg_variable ] [ arg ] [ line [ [ @ LINE + 1 ] ] ] <nl> func a ( arg : Int ) <nl> mmm a / test / DebugInfo / generic_args . swift <nl> ppp b / test / DebugInfo / generic_args . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - verify - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - verify - g - o - | FileCheck % s <nl> protocol AProtocol { <nl> func f ( ) - > String ; <nl> } <nl> mmm a / test / DebugInfo / generic_enum_closure . swift <nl> ppp b / test / DebugInfo / generic_enum_closure . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> struct __CurrentErrno { } <nl> struct CErrorOr < T > <nl> { <nl> mmm a / test / DebugInfo / let . swift <nl> ppp b / test / DebugInfo / let . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> class DeepThought { <nl> func query ( ) - > Int { return 42 } <nl> } <nl> mmm a / test / DebugInfo / letclause . swift <nl> ppp b / test / DebugInfo / letclause . swift <nl> <nl> - / / RUN : % swift % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> / / Test debug info for storageless variables . <nl> struct Symbol { } <nl> func peek ( ) - > Symbol ? { return Symbol ( ) } <nl> mmm a / test / DebugInfo / line - directive . swift <nl> ppp b / test / DebugInfo / line - directive . swift <nl> func f ( ) { <nl> println ( " jump directly to def " ) <nl> } <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - S - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - S - g - o - | FileCheck % s <nl> / / CHECK : . file [ [ MAIN : . * ] ] " { { . * } } line - directive . swift " <nl> / / CHECK : . loc [ [ MAIN ] ] 1 <nl> / / CHECK : . file [ [ ABC : . * ] ] " { { . * } } abc . swift " <nl> mmm a / test / DebugInfo / nested_functions . swift <nl> ppp b / test / DebugInfo / nested_functions . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> func outer ( a : Int ) - > Int { <nl> / / Inner functions have a linkage name of " closure [ 0 - 9 ] + " , but <nl> / / their DW_AT_name is preserved . <nl> mmm a / test / DebugInfo / patternmatching . swift <nl> ppp b / test / DebugInfo / patternmatching . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> - / / RUN : % swift - emit - sil - emit - verbose - sil % s - o - | FileCheck % s - - check - prefix = SIL - CHECK <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - emit - sil - emit - verbose - sil - primary - file % s - o - | FileCheck % s - - check - prefix = SIL - CHECK <nl> func classifyPoint2 ( p : ( Double , Double ) ) { <nl> func return_same ( var input : Double ) - > Double <nl> { <nl> mmm a / test / DebugInfo / pcomp . swift <nl> ppp b / test / DebugInfo / pcomp . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> <nl> protocol A { <nl> func x ( ) <nl> mmm a / test / DebugInfo / prologue . swift <nl> ppp b / test / DebugInfo / prologue . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - S - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - S - g - o - | FileCheck % s <nl> func bar < T , U > ( x : T , y : U ) { println ( " bar " ) } <nl> / / CHECK : . loc 2 [ [ @ LINE - 1 ] ] 3 { { . } } prologue_end <nl> / / Make sure there is no allocation happening between the end of <nl> mmm a / test / DebugInfo / self . swift <nl> ppp b / test / DebugInfo / self . swift <nl> <nl> - / / RUN : % swift % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> struct stuffStruct { <nl> var a : Int = 6 <nl> var b : String = " Nothing " <nl> mmm a / test / DebugInfo / structs . swift <nl> ppp b / test / DebugInfo / structs . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> <nl> / / This is more of a crash test than anything else . <nl> <nl> mmm a / test / DebugInfo / trap . swift <nl> ppp b / test / DebugInfo / trap . swift <nl> <nl> - / / RUN : % swift - parse - stdlib - target x86_64 - apple - macosx10 . 9 % s - emit - ir - g - o - | FileCheck % s <nl> + / / RUN : % swift - parse - stdlib - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - g - o - | FileCheck % s <nl> <nl> import Swift <nl> func f ( x : Int ) - > Int { <nl> mmm a / test / Frontend / InternalChecks . swift <nl> ppp b / test / Frontend / InternalChecks . swift <nl> <nl> - / / RUN : % swift - O - parse - stdlib - D INTERNAL_CHECKS_ENABLED % s - emit - sil | FileCheck % s - - check - prefix = CHECKS <nl> - / / RUN : % swift - O - parse - stdlib % s - emit - sil | FileCheck % s - - check - prefix = NOCHECKS <nl> + / / RUN : % swift - O - parse - stdlib - D INTERNAL_CHECKS_ENABLED - primary - file % s - emit - sil | FileCheck % s - - check - prefix = CHECKS <nl> + / / RUN : % swift - O - parse - stdlib - primary - file % s - emit - sil | FileCheck % s - - check - prefix = NOCHECKS <nl> <nl> import Swift <nl> <nl> mmm a / test / Frontend / OptimizationOptions . swift <nl> ppp b / test / Frontend / OptimizationOptions . swift <nl> <nl> - / / RUN : % swift - Onone - emit - sil % s 2 > & 1 | FileCheck % s - - check - prefix = DEBUG <nl> - / / RUN : % swift - O - emit - sil % s 2 > & 1 | FileCheck % s - - check - prefix = RELEASE <nl> - / / RUN : % swift - Ounchecked - emit - sil % s 2 > & 1 | FileCheck % s - - check - prefix = UNCHECKED <nl> + / / RUN : % swift - Onone - emit - sil - primary - file % s 2 > & 1 | FileCheck % s - - check - prefix = DEBUG <nl> + / / RUN : % swift - O - emit - sil - primary - file % s 2 > & 1 | FileCheck % s - - check - prefix = RELEASE <nl> + / / RUN : % swift - Ounchecked - emit - sil - primary - file % s 2 > & 1 | FileCheck % s - - check - prefix = UNCHECKED <nl> <nl> / / REQUIRES : optimized_stdlib <nl> <nl> mmm a / test / IRGen / associated_types . swift <nl> ppp b / test / IRGen / associated_types . swift <nl> <nl> - / / RUN : % swift - emit - ir - target x86_64 - apple - macosx10 . 9 % s | FileCheck % s <nl> + / / RUN : % swift - emit - ir - target x86_64 - apple - macosx10 . 9 - primary - file % s | FileCheck % s <nl> protocol Runcer { <nl> typealias Runcee <nl> } <nl> mmm a / test / IRGen / builtins . swift <nl> ppp b / test / IRGen / builtins . swift <nl> <nl> - / / RUN : % swift - parse - stdlib - target x86_64 - apple - macosx10 . 9 % s - emit - ir - o - | FileCheck % s <nl> + / / RUN : % swift - parse - stdlib - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - o - | FileCheck % s <nl> <nl> import Swift <nl> <nl> mmm a / test / IRGen / clang_inline . swift <nl> ppp b / test / IRGen / clang_inline . swift <nl> <nl> / / RUN : rm - rf % t & & mkdir - p % t <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / RUN : mkdir - p % t / Empty . framework / Modules / Empty . swiftmodule <nl> / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - emit - module - path % t / Empty . framework / Modules / Empty . swiftmodule / x86_64 . swiftmodule % S / . . / Inputs / empty . swift - module - name Empty <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache2 - sdk % S / Inputs % s - F % t - DIMPORT_EMPTY - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache2 - sdk % S / Inputs - primary - file % s - F % t - DIMPORT_EMPTY - emit - ir | FileCheck % s <nl> <nl> # if IMPORT_EMPTY <nl> import Empty <nl> mmm a / test / IRGen / clang_inline_reverse . swift <nl> ppp b / test / IRGen / clang_inline_reverse . swift <nl> <nl> / / Same test as clang_inline . swift , but with the order swapped . <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs % s - emit - ir - module - name clang_inline | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - primary - file % s - emit - ir - module - name clang_inline | FileCheck % s <nl> import gizmo <nl> <nl> / / CHECK : define hidden i64 @ _TFC12clang_inline16CallStaticInline10ReturnZerofS0_FT_Si ( % C12clang_inline16CallStaticInline * ) { <nl> mmm a / test / IRGen / class_bounded_generics . swift <nl> ppp b / test / IRGen / class_bounded_generics . swift <nl> <nl> - / / RUN : % swift - emit - ir - target x86_64 - apple - macosx10 . 9 % s | FileCheck % s <nl> + / / RUN : % swift - emit - ir - target x86_64 - apple - macosx10 . 9 - primary - file % s | FileCheck % s <nl> <nl> protocol ClassBound : class { <nl> func classBoundMethod ( ) <nl> mmm a / test / IRGen / closure . swift <nl> ppp b / test / IRGen / closure . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / - - partial_apply context metadata <nl> <nl> mmm a / test / IRGen / existential_metatypes . swift <nl> ppp b / test / IRGen / existential_metatypes . swift <nl> <nl> - / / RUN : % swift - emit - ir - target x86_64 - apple - macosx10 . 9 - o - % s | FileCheck % s <nl> + / / RUN : % swift - emit - ir - target x86_64 - apple - macosx10 . 9 - o - - primary - file % s | FileCheck % s <nl> <nl> / / Currently , this can ' t be a SIL file because we don ' t parse <nl> / / conformances correctly . <nl> mmm a / test / IRGen / expressions . swift <nl> ppp b / test / IRGen / expressions . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - parse - stdlib - disable - access - control - enable - character - literals | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - parse - stdlib - disable - access - control - enable - character - literals | FileCheck % s <nl> <nl> import Swift <nl> <nl> mmm a / test / IRGen / function_metadata . swift <nl> ppp b / test / IRGen / function_metadata . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - emit - ir % s | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - emit - ir - primary - file % s | FileCheck % s <nl> <nl> func arch < F > ( f : F ) { } <nl> <nl> mmm a / test / IRGen / generic_casts . swift <nl> ppp b / test / IRGen / generic_casts . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> import Foundation <nl> import gizmo <nl> mmm a / test / IRGen / generic_class_anyobject . swift <nl> ppp b / test / IRGen / generic_class_anyobject . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> func foo < T : AnyObject > ( x : T ) - > T { return x } <nl> <nl> mmm a / test / IRGen / generic_metatypes . swift <nl> ppp b / test / IRGen / generic_metatypes . swift <nl> <nl> - / / RUN : % swift - emit - ir - parse - stdlib - target x86_64 - apple - macosx10 . 9 % s | FileCheck % s <nl> + / / RUN : % swift - emit - ir - parse - stdlib - target x86_64 - apple - macosx10 . 9 - primary - file % s | FileCheck % s <nl> <nl> / / CHECK : define hidden % swift . type * [ [ GENERIC_TYPEOF : @ _TF17generic_metatypes13genericTypeof . * ] ] ( % swift . opaque * noalias , % swift . type * [ [ TYPE : % . * ] ] ) <nl> func genericTypeof < T > ( x : T ) - > T . Type { <nl> mmm a / test / IRGen / generic_same_type . swift <nl> ppp b / test / IRGen / generic_same_type . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir - Onone | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir - Onone | FileCheck % s <nl> <nl> / / FIXME : Should be a SIL test , but we can ' t parse same - type constraints <nl> / / < rdar : / / problem / 16238241 > <nl> mmm a / test / IRGen / generic_ternary . swift <nl> ppp b / test / IRGen / generic_ternary . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / < rdar : / / problem / 13793646 > <nl> struct OptionalStreamAdaptor < T : GeneratorType > { <nl> mmm a / test / IRGen / generic_tuples . swift <nl> ppp b / test / IRGen / generic_tuples . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - emit - ir % s | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - emit - ir - primary - file % s | FileCheck % s <nl> <nl> / / Make sure that optimization passes don ' t choke on storage types for generic tuples <nl> / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - emit - ir - O % s <nl> mmm a / test / IRGen / globals . swift <nl> ppp b / test / IRGen / globals . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> var g0 : Int = 1 <nl> var g1 : ( Void , Int , Void ) <nl> mmm a / test / IRGen / indirect_return . swift <nl> ppp b / test / IRGen / indirect_return . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / CHECK : define hidden void @ _TF15indirect_return11generic_get <nl> func generic_get < T > ( p : UnsafeMutablePointer < T > ) - > T { <nl> mmm a / test / IRGen / infinite_archetype . swift <nl> ppp b / test / IRGen / infinite_archetype . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> protocol Fooable { <nl> typealias Foo <nl> mmm a / test / IRGen / lazy_globals . swift <nl> ppp b / test / IRGen / lazy_globals . swift <nl> <nl> - / / RUN : % swift - parse - as - library - emit - ir - target x86_64 - apple - macosx10 . 9 % s | FileCheck % s <nl> + / / RUN : % swift - parse - as - library - emit - ir - target x86_64 - apple - macosx10 . 9 - primary - file % s | FileCheck % s <nl> <nl> / / CHECK : @ globalinit_token0 = internal global i64 0 , align 8 <nl> / / CHECK : @ _Tv12lazy_globals1xSi = global % Si zeroinitializer , align 8 <nl> mmm a / test / IRGen / objc . swift <nl> ppp b / test / IRGen / objc . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> import Foundation <nl> import gizmo <nl> mmm a / test / IRGen / objc_class_export . swift <nl> ppp b / test / IRGen / objc_class_export . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / CHECK : [ [ HOOZIT : % C17objc_class_export6Hoozit ] ] = type < { [ [ REF : % swift . refcounted ] ] } > <nl> / / CHECK : [ [ REF ] ] = type <nl> mmm a / test / IRGen / objc_ns_enum . swift <nl> ppp b / test / IRGen / objc_ns_enum . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> import Foundation <nl> import gizmo <nl> mmm a / test / IRGen / objc_nsstring_bridge . swift <nl> ppp b / test / IRGen / objc_nsstring_bridge . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - emit - ir - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s | FileCheck % s <nl> + / / RUN : % swift - emit - ir - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s | FileCheck % s <nl> <nl> import Foundation <nl> <nl> mmm a / test / IRGen / objc_pointers . swift <nl> ppp b / test / IRGen / objc_pointers . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> import Foundation <nl> <nl> mmm a / test / IRGen / objc_properties_imported . swift <nl> ppp b / test / IRGen / objc_properties_imported . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift % clang - importer - sdk - enable - source - import - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - emit - ir - o - % s | FileCheck % s <nl> + / / RUN : % swift % clang - importer - sdk - enable - source - import - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - emit - ir - o - - primary - file % s | FileCheck % s <nl> <nl> import Properties <nl> <nl> mmm a / test / IRGen / objc_protocols . swift <nl> ppp b / test / IRGen / objc_protocols . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> import gizmo <nl> import objc_protocols_Bas <nl> mmm a / test / IRGen / objc_structs . swift <nl> ppp b / test / IRGen / objc_structs . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> import Foundation <nl> import gizmo <nl> <nl> mmm a / test / IRGen / objc_subclass . swift <nl> ppp b / test / IRGen / objc_subclass . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - module - cache - path % t / clang - module - cache - sdk % S / Inputs - I = % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / CHECK : [ [ SGIZMO : C13objc_subclass10SwiftGizmo ] ] = type <nl> / / CHECK : [ [ TYPE : % swift . type ] ] = type <nl> mmm a / test / IRGen / objc_subscripts . swift <nl> ppp b / test / IRGen / objc_subscripts . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / CHECK : @ _INSTANCE_METHODS__TtC15objc_subscripts10SomeObject = <nl> / / CHECK : private constant { i32 , i32 , [ 5 x { i8 * , i8 * , i8 * } ] } <nl> mmm a / test / IRGen / protocol_metadata . swift <nl> ppp b / test / IRGen / protocol_metadata . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> protocol A { func a ( ) } <nl> protocol B { func b ( ) } <nl> mmm a / test / IRGen / sil_generic_witness_methods . swift <nl> ppp b / test / IRGen / sil_generic_witness_methods . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / FIXME : These should be SIL tests , but we can ' t parse generic types in SIL <nl> / / yet . <nl> mmm a / test / IRGen / sil_witness_tables . swift <nl> ppp b / test / IRGen / sil_witness_tables . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - I % S - enable - source - import % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - I % S - enable - source - import - primary - file % s - emit - ir | FileCheck % s <nl> <nl> import sil_witness_tables_external_conformance <nl> <nl> mmm a / test / IRGen / sil_witness_tables_external_witnesstable . swift <nl> ppp b / test / IRGen / sil_witness_tables_external_witnesstable . swift <nl> <nl> / / RUN : rm - rf % t <nl> / / RUN : mkdir % t <nl> / / RUN : % swift - emit - module % S / Inputs / sil_witness_tables_external_input . swift - o % t / Swift . swiftmodule - parse - stdlib - parse - as - library - module - name Swift - sil - serialize - all - module - link - name swiftCore <nl> - / / RUN : % swift - I = % t % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - I = % t - primary - file % s - emit - ir | FileCheck % s <nl> <nl> import Swift <nl> <nl> mmm a / test / IRGen / subclass . swift <nl> ppp b / test / IRGen / subclass . swift <nl> <nl> - / / RUN : % swift - target x86_64 - apple - macosx10 . 9 % s - emit - ir | FileCheck % s <nl> + / / RUN : % swift - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - ir | FileCheck % s <nl> <nl> / / CHECK : [ [ TYPE : % swift . type ] ] = type <nl> / / CHECK : [ [ OBJC_CLASS : % objc_class ] ] = type { <nl> mmm a / test / IRGen / weak_import . swift <nl> ppp b / test / IRGen / weak_import . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I % S / Inputs - enable - source - import % s - emit - ir | FileCheck - check - prefix = CHECK - 10_9 % s <nl> - / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 10 - sdk % S / Inputs - I % S / Inputs - enable - source - import % s - emit - ir | FileCheck - check - prefix = CHECK - 10_10 % s <nl> + / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck - check - prefix = CHECK - 10_9 % s <nl> + / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 10 - sdk % S / Inputs - I % S / Inputs - enable - source - import - primary - file % s - emit - ir | FileCheck - check - prefix = CHECK - 10_10 % s <nl> <nl> / / FIXME : This test in written in Swift because the SIL parser fails <nl> / / when referencing weak_variable . <nl> mmm a / test / SIL / Serialization / Inputs / shared_function_serialization_input . swift <nl> ppp b / test / SIL / Serialization / Inputs / shared_function_serialization_input . swift <nl> <nl> <nl> - public struct X { } <nl> + public struct X { <nl> + public init ( ) { } <nl> + } <nl> <nl> public func the_thing < T > ( # t : T ) { } <nl> <nl> mmm a / test / SIL / unimplemented_initializer . swift <nl> ppp b / test / SIL / unimplemented_initializer . swift <nl> <nl> / / RUN : rm - rf % t / clang - module - cache <nl> - / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / . . / SILGen / Inputs - I % S / . . / SILGen / Inputs - enable - source - import % s - emit - sil - emit - verbose - sil | FileCheck % s - check - prefix = CHECK - DEBUG <nl> - / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / . . / SILGen / Inputs - I % S / . . / SILGen / Inputs - enable - source - import % s - emit - sil - emit - verbose - sil - O | FileCheck % s - check - prefix = CHECK - RELEASE <nl> + / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / . . / SILGen / Inputs - I % S / . . / SILGen / Inputs - enable - source - import - primary - file % s - emit - sil - emit - verbose - sil | FileCheck % s - check - prefix = CHECK - DEBUG <nl> + / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / . . / SILGen / Inputs - I % S / . . / SILGen / Inputs - enable - source - import - primary - file % s - emit - sil - emit - verbose - sil - O | FileCheck % s - check - prefix = CHECK - RELEASE <nl> <nl> import gizmo <nl> <nl> mmm a / test / SILGen / collection_cast_crash . swift <nl> ppp b / test / SILGen / collection_cast_crash . swift <nl> <nl> - / / RUN : % swift - O - target x86_64 - apple - macosx10 . 9 % s - emit - sil - o - | FileCheck % s <nl> + / / RUN : % swift - O - target x86_64 - apple - macosx10 . 9 - primary - file % s - emit - sil - o - | FileCheck % s <nl> <nl> / / check if the compiler does not crash if a function is specialized <nl> / / which contains a collection cast <nl> mmm a / test / SILGen / conditionally_unreachable . swift <nl> ppp b / test / SILGen / conditionally_unreachable . swift <nl> <nl> - / / RUN : % swift - emit - silgen - parse - stdlib % s | FileCheck % s - check - prefix = RAW <nl> - / / RUN : % swift - emit - sil - assert - config Debug - parse - stdlib % s | FileCheck - check - prefix = DEBUG % s <nl> - / / RUN : % swift - emit - sil - O - assert - config Debug - parse - stdlib % s | FileCheck - check - prefix = DEBUG % s <nl> - / / RUN : % swift - emit - sil - assert - config Release - parse - stdlib % s | FileCheck - check - prefix = RELEASE % s <nl> - / / RUN : % swift - emit - sil - O - assert - config Release - parse - stdlib % s | FileCheck - check - prefix = RELEASE % s <nl> + / / RUN : % swift - emit - silgen - parse - stdlib - primary - file % s | FileCheck % s - check - prefix = RAW <nl> + / / RUN : % swift - emit - sil - assert - config Debug - parse - stdlib - primary - file % s | FileCheck - check - prefix = DEBUG % s <nl> + / / RUN : % swift - emit - sil - O - assert - config Debug - parse - stdlib - primary - file % s | FileCheck - check - prefix = DEBUG % s <nl> + / / RUN : % swift - emit - sil - assert - config Release - parse - stdlib - primary - file % s | FileCheck - check - prefix = RELEASE % s <nl> + / / RUN : % swift - emit - sil - O - assert - config Release - parse - stdlib - primary - file % s | FileCheck - check - prefix = RELEASE % s <nl> <nl> import Swift <nl> <nl> mmm a / test / SILGen / objc_nonnull_lie_hack . swift <nl> ppp b / test / SILGen / objc_nonnull_lie_hack . swift <nl> <nl> / / RUN : rm - rf % t / APINotes <nl> / / RUN : mkdir - p % t / APINotes <nl> / / RUN : % clang_apinotes - yaml - to - binary % S / Inputs / gizmo . apinotes - o % t / APINotes / gizmo . apinotesc <nl> - / / RUN : % swift - emit - silgen - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I % S / Inputs - I % t / APINotes - enable - source - import % s | FileCheck - check - prefix = SILGEN % s <nl> - / / RUN : % swift - emit - sil - O - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I % S / Inputs - I % t / APINotes - enable - source - import % s | FileCheck - check - prefix = OPT % s <nl> + / / RUN : % swift - emit - silgen - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I % S / Inputs - I % t / APINotes - enable - source - import - primary - file % s | FileCheck - check - prefix = SILGEN % s <nl> + / / RUN : % swift - emit - sil - O - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - I % S / Inputs - I % t / APINotes - enable - source - import - primary - file % s | FileCheck - check - prefix = OPT % s <nl> <nl> import Foundation <nl> import gizmo <nl> mmm a / test / SILPasses / array_mutable . swift <nl> ppp b / test / SILPasses / array_mutable . swift <nl> <nl> - / / RUN : % swift - O - emit - sil % s | FileCheck % s <nl> + / / RUN : % swift - O - emit - sil - primary - file % s | FileCheck % s <nl> / / <nl> / / Test Array " make_mutable " hoisting . It ' s hard for FileCheck to <nl> / / recognize the hoisting because we don ' t know which block is the <nl> mmm a / test / SILPasses / devirt_access . swift <nl> ppp b / test / SILPasses / devirt_access . swift <nl> <nl> / / RUN : rm - rf % t & & mkdir - p % t <nl> / / RUN : % swift - emit - module - Onone - o % t % S / Inputs / devirt_access_other_module . swift <nl> <nl> - / / RUN : % swift - O % s % S / Inputs / devirt_access_helper . swift - I % t - emit - sil - enable - private - discriminators - sil - inline - threshold 1000 - sil - verify - all | FileCheck - check - prefix = WHOLE - MODULE % s <nl> + / / RUN : % swift - O - primary - file % s % S / Inputs / devirt_access_helper . swift - I % t - emit - sil - enable - private - discriminators - sil - inline - threshold 1000 - sil - verify - all | FileCheck - check - prefix = WHOLE - MODULE % s <nl> / / RUN : % swift - O - primary - file % s % S / Inputs / devirt_access_helper . swift - I % t - emit - sil - enable - private - discriminators - sil - inline - threshold 1000 - sil - verify - all | FileCheck - check - prefix = PRIMARY - FILE % s <nl> <nl> import devirt_access_other_module <nl> mmm a / test / SILPasses / devirt_archetype_method . swift <nl> ppp b / test / SILPasses / devirt_archetype_method . swift <nl> <nl> - / / RUN : % swift - O - emit - sil % s | FileCheck % s <nl> + / / RUN : % swift - O - emit - sil - primary - file % s | FileCheck % s <nl> / / We can ' t deserialize apply_inst with subst lists . When radar : / / 14443304 <nl> / / is fixed then we should convert this test to a SIL test . <nl> <nl> mmm a / test / SILPasses / devirt_contravariant_args . swift <nl> ppp b / test / SILPasses / devirt_contravariant_args . swift <nl> <nl> - / / RUN : % swift - O % s - emit - sil - sil - inline - threshold 1000 - sil - verify - all | FileCheck % s <nl> + / / RUN : % swift - O - primary - file % s - emit - sil - sil - inline - threshold 1000 - sil - verify - all | FileCheck % s <nl> <nl> / / Make sure that we can dig all the way through the class hierarchy and <nl> / / protocol conformances . <nl> mmm a / test / SILPasses / devirt_covariant_return . swift <nl> ppp b / test / SILPasses / devirt_covariant_return . swift <nl> <nl> - / / RUN : % swift - O % s - emit - sil - sil - inline - threshold 1000 - sil - verify - all | FileCheck % s <nl> + / / RUN : % swift - O - primary - file % s - emit - sil - sil - inline - threshold 1000 - sil - verify - all | FileCheck % s <nl> <nl> / / Make sure that we can dig all the way through the class hierarchy and <nl> / / protocol conformances with covariant return types correctly . The verifier <nl> mmm a / test / SILPasses / diagnostic_constant_propagation . swift <nl> ppp b / test / SILPasses / diagnostic_constant_propagation . swift <nl> <nl> - / / RUN : % swift - emit - sil % s - o / dev / null - verify <nl> + / / RUN : % swift - emit - sil - primary - file % s - o / dev / null - verify <nl> / / These are tests for diagnostics produced by constant propagation pass . <nl> <nl> func testArithmeticOverflow ( ) { <nl> mmm a / test / SILPasses / inline_addressor . swift <nl> ppp b / test / SILPasses / inline_addressor . swift <nl> <nl> - / / RUN : % swift % s - parse - as - library - emit - sil - O | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - parse - as - library - emit - sil - O | FileCheck % s <nl> <nl> var inputval = 27 <nl> <nl> mmm a / test / SILPasses / mandatory_inlining . swift <nl> ppp b / test / SILPasses / mandatory_inlining . swift <nl> <nl> - / / RUN : % swift % s - emit - sil - o - - verify | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - emit - sil - o - - verify | FileCheck % s <nl> <nl> / / These tests are deliberately shallow , because I do not want to depend on the <nl> / / specifics of SIL generation , which might change for reasons unrelated to this <nl> mmm a / test / SILPasses / sil_locations . swift <nl> ppp b / test / SILPasses / sil_locations . swift <nl> <nl> - / / RUN : % swift % s - emit - sil - emit - verbose - sil | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - emit - sil - emit - verbose - sil | FileCheck % s <nl> <nl> func searchForMe ( x : Float ) - > Float { <nl> return x <nl> mmm a / test / SILPasses / spec_archetype_method . swift <nl> ppp b / test / SILPasses / spec_archetype_method . swift <nl> <nl> - / / RUN : % swift - O - disable - arc - opts - sil - inline - threshold 0 - emit - sil % s | FileCheck % s <nl> + / / RUN : % swift - O - disable - arc - opts - sil - inline - threshold 0 - emit - sil - primary - file % s | FileCheck % s <nl> / / We can ' t deserialize apply_inst with subst lists . When radar : / / 14443304 <nl> / / is fixed then we should convert this test to a SIL test . <nl> <nl> mmm a / test / SILPasses / specialize_apply_conf . swift <nl> ppp b / test / SILPasses / specialize_apply_conf . swift <nl> <nl> - / / RUN : % swift - O - sil - inline - threshold 1 - emit - sil % s | FileCheck % s <nl> + / / RUN : % swift - O - sil - inline - threshold 1 - emit - sil - primary - file % s | FileCheck % s <nl> <nl> / / We can ' t deserialize apply_inst with subst lists . When radar : / / 14443304 <nl> / / is fixed then we should convert this test to a SIL test . <nl> mmm a / test / SILPasses / specialize_chain . swift <nl> ppp b / test / SILPasses / specialize_chain . swift <nl> <nl> - / / RUN : % swift - O - sil - inline - threshold 0 - emit - sil % s | FileCheck % s <nl> + / / RUN : % swift - O - sil - inline - threshold 0 - emit - sil - primary - file % s | FileCheck % s <nl> <nl> / / We can ' t deserialize apply_inst with subst lists . When radar : / / 14443304 <nl> / / is fixed then we should convert this test to a SIL test . <nl> mmm a / test / SILPasses / specialize_dont_touch_transparent . swift <nl> ppp b / test / SILPasses / specialize_dont_touch_transparent . swift <nl> <nl> - / / RUN : % swift - O - emit - sil % s | FileCheck % s <nl> + / / RUN : % swift - O - emit - sil - primary - file % s | FileCheck % s <nl> <nl> / / CHECK - LABEL : sil hidden [ transparent ] @ _TF33specialize_dont_touch_transparent22transparentDoSomethingFT_VSs4Int8 : $ @ thin ( ) - > Int8 { <nl> / / CHECK : bb0 : <nl> mmm a / test / SILPasses / specialize_ext . swift <nl> ppp b / test / SILPasses / specialize_ext . swift <nl> <nl> - / / RUN : % swift - sil - inline - threshold 0 - O - emit - sil % s | FileCheck % s <nl> + / / RUN : % swift - sil - inline - threshold 0 - O - emit - sil - primary - file % s | FileCheck % s <nl> <nl> struct XXX < T > { <nl> init ( t : T ) { m_t = t } <nl> mmm a / test / SILPasses / sroa_unreferenced_members . swift <nl> ppp b / test / SILPasses / sroa_unreferenced_members . swift <nl> <nl> / / RUN : rm - rf % t <nl> - / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - O - emit - sil - I % S / Inputs - enable - source - import % s - enable - union - import | FileCheck % s <nl> + / / RUN : % swift - module - cache - path % t / clang - module - cache - target x86_64 - apple - macosx10 . 9 - sdk % S / Inputs - O - emit - sil - I % S / Inputs - enable - source - import - primary - file % s - enable - union - import | FileCheck % s <nl> <nl> import gizmo <nl> <nl> mmm a / test / SILPasses / unused_containers . swift <nl> ppp b / test / SILPasses / unused_containers . swift <nl> <nl> - / / RUN : % swift % s - O - emit - sil | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - O - emit - sil | FileCheck % s <nl> <nl> / / CHECK - LABEL : @ _TF17unused_containers16empty_array_testFT_T_ <nl> / / CHECK : bb0 : <nl> mmm a / test / sil - extract / load - serialized - sil . swift <nl> ppp b / test / sil - extract / load - serialized - sil . swift <nl> <nl> - / / RUN : % swift % s - module - name Swift - g - sil - serialize - all - module - link - name swiftCore - O - parse - as - library - parse - stdlib - emit - module - emit - module - path - - o / dev / null | sil - extract - module - name = " Swift " - func = " _TFVSs1X4testfS_FT_T_ " | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - module - name Swift - g - sil - serialize - all - module - link - name swiftCore - O - parse - as - library - parse - stdlib - emit - module - emit - module - path - - o / dev / null | sil - extract - module - name = " Swift " - func = " _TFVSs1X4testfS_FT_T_ " | FileCheck % s <nl> <nl> / / CHECK : import Builtin <nl> / / CHECK : import Swift <nl> mmm a / test / sil - opt / sil - opt . swift <nl> ppp b / test / sil - opt / sil - opt . swift <nl> <nl> - / / RUN : % swift % s - module - name Swift - g - sil - serialize - all - module - link - name swiftCore - O - parse - as - library - parse - stdlib - emit - module - emit - module - path - - o / dev / null | % sil - opt - verify - module - name = " Swift " | FileCheck % s <nl> + / / RUN : % swift - primary - file % s - module - name Swift - g - sil - serialize - all - module - link - name swiftCore - O - parse - as - library - parse - stdlib - emit - module - emit - module - path - - o / dev / null | % sil - opt - verify - module - name = " Swift " | FileCheck % s <nl> <nl> / / CHECK : import Builtin <nl> / / CHECK : import Swift <nl>
|
Add - primary - file options to prevent whole - module - optimizations .
|
apple/swift
|
e59c4b6eb71ce02a8052558f9761eb2b490bf447
|
2014-10-10T09:51:48Z
|
mmm a / folly / build / generate_varint_tables . py <nl> ppp b / folly / build / generate_varint_tables . py <nl> def generate ( f ) : <nl> f . write ( " " " <nl> # include < folly / Portability . h > <nl> <nl> - # if FOLLY_X64 | | defined ( __i386__ ) <nl> + # if ( FOLLY_X64 | | defined ( __i386__ ) ) & & ( FOLLY_SSE > = 2 ) <nl> # include < stdint . h > <nl> # include < x86intrin . h > <nl> <nl> def generate ( f ) : <nl> <nl> } / / namespace detail <nl> } / / namespace folly <nl> - # endif / * FOLLY_X64 | | defined ( __i386__ ) * / <nl> + # endif / * ( FOLLY_X64 | | defined ( __i386__ ) ) & & ( FOLLY_SSE > = 2 ) * / <nl> " " " ) <nl> <nl> def main ( ) : <nl>
|
Limit declaration of GroupVarint tables to SSE > = 2
|
facebook/folly
|
2b8cb090b60715343d356d6c3e6d1273c7b096f3
|
2015-09-16T19:20:18Z
|
mmm a / Makefile <nl> ppp b / Makefile <nl> TESTS = \ <nl> memenv_test \ <nl> skiplist_test \ <nl> table_test \ <nl> + block_test \ <nl> version_edit_test \ <nl> version_set_test \ <nl> reduce_levels_test \ <nl> log_test : db / log_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> table_test : table / table_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CXX ) table / table_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) - o $ @ $ ( LDFLAGS ) <nl> <nl> + block_test : table / block_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> + $ ( CXX ) table / block_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) - o $ @ $ ( LDFLAGS ) <nl> + <nl> skiplist_test : db / skiplist_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CXX ) db / skiplist_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) - o $ @ $ ( LDFLAGS ) <nl> <nl> new file mode 100644 <nl> index 0000000000 . . 92154ac0e1 <nl> mmm / dev / null <nl> ppp b / table / block_test . cc <nl> <nl> + / / Copyright ( c ) 2012 Facebook . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . See the AUTHORS file for names of contributors . <nl> + <nl> + # include " leveldb / table . h " <nl> + <nl> + # include < string > <nl> + # include " db / dbformat . h " <nl> + # include " db / memtable . h " <nl> + # include " db / write_batch_internal . h " <nl> + # include " leveldb / db . h " <nl> + # include " leveldb / env . h " <nl> + # include " leveldb / iterator . h " <nl> + # include " leveldb / table_builder . h " <nl> + # include " table / block . h " <nl> + # include " table / block_builder . h " <nl> + # include " table / format . h " <nl> + # include " util / random . h " <nl> + # include " util / testharness . h " <nl> + # include " util / testutil . h " <nl> + <nl> + namespace leveldb { <nl> + <nl> + static std : : string RandomString ( Random * rnd , int len ) { <nl> + std : : string r ; <nl> + test : : RandomString ( rnd , len , & r ) ; <nl> + return r ; <nl> + } <nl> + <nl> + class BlockTest { } ; <nl> + <nl> + / / block test <nl> + TEST ( BlockTest , SimpleTest ) { <nl> + Random rnd ( 301 ) ; <nl> + Options options = Options ( ) ; <nl> + std : : vector < std : : string > keys ; <nl> + std : : vector < std : : string > values ; <nl> + BlockBuilder builder ( & options ) ; <nl> + int num_records = 100000 ; <nl> + char buf [ 10 ] ; <nl> + char * p = & buf [ 0 ] ; <nl> + <nl> + / / add a bunch of records to a block <nl> + for ( int i = 0 ; i < num_records ; i + + ) { <nl> + / / generate random kvs <nl> + sprintf ( p , " % 6d " , i ) ; <nl> + std : : string k ( p ) ; <nl> + std : : string v = RandomString ( & rnd , 100 ) ; / / 100 byte values <nl> + <nl> + / / write kvs to the block <nl> + Slice key ( k ) ; <nl> + Slice value ( v ) ; <nl> + builder . Add ( key , value ) ; <nl> + <nl> + / / remember kvs in a lookaside array <nl> + keys . push_back ( k ) ; <nl> + values . push_back ( v ) ; <nl> + } <nl> + <nl> + / / read serialized contents of the block <nl> + Slice rawblock = builder . Finish ( ) ; <nl> + <nl> + / / create block reader <nl> + BlockContents contents ; <nl> + contents . data = rawblock ; <nl> + contents . cachable = false ; <nl> + contents . heap_allocated = false ; <nl> + Block reader ( contents ) ; <nl> + <nl> + / / read contents of block sequentially <nl> + int count = 0 ; <nl> + Iterator * iter = reader . NewIterator ( options . comparator ) ; <nl> + for ( iter - > SeekToFirst ( ) ; iter - > Valid ( ) ; count + + , iter - > Next ( ) ) { <nl> + <nl> + / / read kv from block <nl> + Slice k = iter - > key ( ) ; <nl> + Slice v = iter - > value ( ) ; <nl> + <nl> + / / compare with lookaside array <nl> + ASSERT_EQ ( k . ToString ( ) . compare ( keys [ count ] ) , 0 ) ; <nl> + ASSERT_EQ ( v . ToString ( ) . compare ( values [ count ] ) , 0 ) ; <nl> + } <nl> + delete iter ; <nl> + <nl> + / / read block contents randomly <nl> + iter = reader . NewIterator ( options . comparator ) ; <nl> + for ( int i = 0 ; i < num_records ; i + + ) { <nl> + <nl> + / / find a random key in the lookaside array <nl> + int index = rnd . Uniform ( num_records ) ; <nl> + Slice k ( keys [ index ] ) ; <nl> + <nl> + / / search in block for this key <nl> + iter - > Seek ( k ) ; <nl> + ASSERT_TRUE ( iter - > Valid ( ) ) ; <nl> + Slice v = iter - > value ( ) ; <nl> + ASSERT_EQ ( v . ToString ( ) . compare ( values [ index ] ) , 0 ) ; <nl> + } <nl> + delete iter ; <nl> + } <nl> + <nl> + } / / namespace leveldb <nl> + <nl> + int main ( int argc , char * * argv ) { <nl> + return leveldb : : test : : RunAllTests ( ) ; <nl> + } <nl>
|
Unit test to test block format .
|
facebook/rocksdb
|
551f01fb23ba7266be96afeb473167f3fe234de7
|
2012-12-20T22:55:07Z
|
mmm a / tensorflow / core / distributed_runtime / base_rendezvous_mgr . cc <nl> ppp b / tensorflow / core / distributed_runtime / base_rendezvous_mgr . cc <nl> Status BaseRemoteRendezvous : : Initialize ( WorkerSession * session ) { <nl> CHECK_NE ( session , nullptr ) < < " session must not be null ! " ; <nl> std : : vector < DeferredCall > deferred_calls ; <nl> { <nl> - mutex_lock l ( mu_ ) ; <nl> + mutex_lock l ( init_mu_ ) ; <nl> if ( session_ ! = nullptr ) { <nl> if ( session_ - > worker_name ( ) = = session - > worker_name ( ) ) { <nl> VLOG ( 1 ) < < " Skipping rendezvous re - initialization . " ; <nl> Status BaseRemoteRendezvous : : Initialize ( WorkerSession * session ) { <nl> } <nl> <nl> WorkerSession * BaseRemoteRendezvous : : session ( ) { <nl> - tf_shared_lock l ( mu_ ) ; <nl> + tf_shared_lock l ( init_mu_ ) ; <nl> return session_ ; <nl> } <nl> <nl> bool BaseRemoteRendezvous : : is_initialized ( ) { <nl> - tf_shared_lock l ( mu_ ) ; <nl> + tf_shared_lock l ( init_mu_ ) ; <nl> return is_initialized_locked ( ) ; <nl> } <nl> <nl> Status BaseRemoteRendezvous : : Send ( const Rendezvous : : ParsedKey & parsed , <nl> const Rendezvous : : Args & args , <nl> const Tensor & val , const bool is_dead ) { <nl> VLOG ( 1 ) < < " BaseRemoteRendezvous Send " < < this < < " " < < parsed . FullKey ( ) ; <nl> + WorkerSession * sess = nullptr ; <nl> { <nl> - tf_shared_lock l ( mu_ ) ; <nl> + tf_shared_lock l ( init_mu_ ) ; <nl> if ( ! status_ . ok ( ) ) return status_ ; <nl> DCHECK ( is_initialized_locked ( ) ) ; <nl> - if ( ! IsLocalDevice ( session_ - > worker_name ( ) , parsed . src_device ) ) { <nl> - return errors : : InvalidArgument ( <nl> - " Invalid rendezvous key ( src ) : " , parsed . FullKey ( ) , " @ " , <nl> - session_ - > worker_name ( ) ) ; <nl> - } <nl> + sess = session_ ; <nl> + } <nl> + <nl> + if ( ! IsLocalDevice ( sess - > worker_name ( ) , parsed . src_device ) ) { <nl> + return errors : : InvalidArgument ( <nl> + " Invalid rendezvous key ( src ) : " , parsed . FullKey ( ) , " @ " , <nl> + sess - > worker_name ( ) ) ; <nl> } <nl> + <nl> / / Buffers " val " and " device_context " in local_ . <nl> return local_ - > Send ( parsed , args , val , is_dead ) ; <nl> } <nl> Status BaseRemoteRendezvous : : ValidateDevices ( const ParsedKey & parsed , <nl> / / ( e . g . calling session ( ) ) <nl> WorkerSession * sess = nullptr ; <nl> { <nl> - tf_shared_lock l ( mu_ ) ; <nl> + tf_shared_lock l ( init_mu_ ) ; <nl> if ( ! status_ . ok ( ) ) return status_ ; <nl> if ( ! is_initialized_locked ( ) ) { <nl> return errors : : Internal ( " ValidateDevices called before initialization . " ) ; <nl> void BaseRemoteRendezvous : : RecvAsync ( const ParsedKey & parsed , <nl> DoneCallback done ) { <nl> VLOG ( 1 ) < < " RemoteRendezvous Recv " < < this < < " " < < parsed . FullKey ( ) ; <nl> Status s = ValidateDevices ( parsed , false / * ! is_src * / ) ; <nl> - if ( s . ok ( ) & & ! is_initialized ( ) ) { <nl> - s . Update ( errors : : Internal ( <nl> - " RecvAsync called when uninitialized ( key : " , parsed . FullKey ( ) , " ) . " ) ) ; <nl> - } <nl> if ( ! s . ok ( ) ) { <nl> done ( s , Args ( ) , recv_args , Tensor ( ) , false ) ; <nl> return ; <nl> } <nl> <nl> + / / ValidateDevices ( ) returns an error status if the rendezvous is not <nl> + / / initialized . <nl> + DCHECK ( is_initialized ( ) ) < < " RecvAsync called when uninitialized ( key : " <nl> + < < parsed . FullKey ( ) < < " ) . " ; <nl> + <nl> MEMDEBUG_CACHE_OP ( " RecvAsync " ) ; <nl> MEMDEBUG_CACHE_STEPID ( 0 ) ; <nl> / / Are src and dst in the same worker ? <nl> void BaseRemoteRendezvous : : RecvAsync ( const ParsedKey & parsed , <nl> void BaseRemoteRendezvous : : RecvLocalAsync ( const ParsedKey & parsed , <nl> DoneCallback done ) { <nl> { <nl> - mutex_lock l ( mu_ ) ; <nl> + mutex_lock l ( init_mu_ ) ; <nl> if ( ! is_initialized_locked ( ) ) { <nl> / / RecvLocalAsync can be called ( due to an incoming RecvTensor RPC from a <nl> / / remote worker ) before the RunStep ( or PartialRunStep ) RPC from the <nl> void BaseRemoteRendezvous : : StartAbort ( const Status & s ) { <nl> local_ - > StartAbort ( derived_status ) ; <nl> { <nl> / / Aborts all active RecvTensor calls . <nl> - mutex_lock l ( mu_ ) ; <nl> + mutex_lock l ( init_mu_ ) ; <nl> + mutex_lock l2 ( active_mu_ ) ; <nl> if ( status_ . ok ( ) ) { <nl> status_ = derived_status ; <nl> for ( auto & entry : active_ ) { <nl> void BaseRemoteRendezvous : : StartAbort ( const Status & s ) { <nl> void BaseRemoteRendezvous : : RegisterCall ( BaseRecvTensorCall * call , <nl> const Rendezvous : : Args & args ) { <nl> CancellationManager * cm = args . cancellation_manager ; <nl> + Status captured_status ; <nl> { <nl> - mutex_lock l ( mu_ ) ; <nl> + tf_shared_lock l ( init_mu_ ) ; <nl> if ( ! status_ . ok ( ) ) { <nl> - call - > StartAbort ( status_ ) ; <nl> - return ; <nl> + captured_status = status_ ; <nl> } <nl> - bool already_cancelled = false ; <nl> - InactiveCallback callback = [ ] { } ; <nl> - if ( cm ! = nullptr ) { <nl> - auto token = cm - > get_cancellation_token ( ) ; <nl> - already_cancelled = ! cm - > RegisterCallback ( token , [ this , call ] { <nl> - { <nl> - mutex_lock l ( mu_ ) ; <nl> - if ( active_ . find ( call ) = = active_ . end ( ) ) return ; <nl> - call - > StartAbort ( <nl> - errors : : Cancelled ( " RecvFromRemoteAsync is cancelled . " ) ) ; <nl> - } <nl> - } ) ; <nl> - callback = [ cm , token ] { cm - > TryDeregisterCallback ( token ) ; } ; <nl> - } <nl> - if ( already_cancelled ) { <nl> + } <nl> + if ( ! captured_status . ok ( ) ) { <nl> + call - > StartAbort ( captured_status ) ; <nl> + return ; <nl> + } <nl> + <nl> + bool already_cancelled = false ; <nl> + InactiveCallback callback = [ ] { } ; <nl> + if ( cm ! = nullptr ) { <nl> + auto token = cm - > get_cancellation_token ( ) ; <nl> + already_cancelled = ! cm - > RegisterCallback ( token , [ this , call ] { <nl> + { <nl> + tf_shared_lock l ( active_mu_ ) ; <nl> + if ( active_ . find ( call ) = = active_ . end ( ) ) return ; <nl> + } <nl> call - > StartAbort ( errors : : Cancelled ( " RecvFromRemoteAsync is cancelled . " ) ) ; <nl> - } else { <nl> - CHECK ( active_ . emplace ( call , callback ) . second ) ; <nl> - } <nl> + } ) ; <nl> + callback = [ cm , token ] { cm - > TryDeregisterCallback ( token ) ; } ; <nl> + } <nl> + <nl> + if ( already_cancelled ) { <nl> + call - > StartAbort ( errors : : Cancelled ( " RecvFromRemoteAsync is cancelled . " ) ) ; <nl> + } else { <nl> + mutex_lock l ( active_mu_ ) ; <nl> + CHECK ( active_ . emplace ( call , callback ) . second ) ; <nl> } <nl> } <nl> <nl> void BaseRemoteRendezvous : : DeregisterCall ( BaseRecvTensorCall * call ) { <nl> - mutex_lock l ( mu_ ) ; <nl> + mutex_lock l ( active_mu_ ) ; <nl> auto it = active_ . find ( call ) ; <nl> if ( it ! = active_ . end ( ) ) { <nl> + / / Deregister the cancellation callback , if one was registered . <nl> it - > second ( ) ; <nl> active_ . erase ( it ) ; <nl> } <nl> mmm a / tensorflow / core / distributed_runtime / base_rendezvous_mgr . h <nl> ppp b / tensorflow / core / distributed_runtime / base_rendezvous_mgr . h <nl> class BaseRemoteRendezvous : public RemoteRendezvous { <nl> private : <nl> Rendezvous * local_ ; / / Owns a Ref on this object . <nl> <nl> - mutable mutex mu_ ; <nl> + / / Guards mutable state that is read - mostly after this rendezvous is <nl> + / / initialized . <nl> + mutable mutex init_mu_ ; <nl> <nl> / / Status given by StartAbort ( ) if any . <nl> - Status status_ GUARDED_BY ( mu_ ) ; <nl> - WorkerSession * session_ GUARDED_BY ( mu_ ) ; / / Not owned . <nl> + Status status_ GUARDED_BY ( init_mu_ ) ; <nl> + <nl> + WorkerSession * session_ GUARDED_BY ( init_mu_ ) ; / / Not owned . <nl> <nl> / / Data structures to handle calls when partially initialized . <nl> struct DeferredCall { <nl> class BaseRemoteRendezvous : public RemoteRendezvous { <nl> <nl> DeferredCall ( const ParsedKey & parsed , DoneCallback done ) ; <nl> } ; <nl> - std : : vector < DeferredCall > deferred_calls_ GUARDED_BY ( mu_ ) ; <nl> + std : : vector < DeferredCall > deferred_calls_ GUARDED_BY ( init_mu_ ) ; <nl> <nl> typedef std : : function < void ( ) > InactiveCallback ; <nl> <nl> / / Active outstanding RecvTensor calls . <nl> + mutex active_mu_ ; <nl> std : : unordered_map < BaseRecvTensorCall * , InactiveCallback > active_ <nl> - GUARDED_BY ( mu_ ) ; <nl> + GUARDED_BY ( active_mu_ ) ; <nl> <nl> - bool is_initialized_locked ( ) SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> + bool is_initialized_locked ( ) SHARED_LOCKS_REQUIRED ( init_mu_ ) { <nl> return session_ ! = nullptr ; <nl> } <nl> <nl>
|
Reduce lock contention in BaseRemoteRendezvous .
|
tensorflow/tensorflow
|
9a0653a8e96a43f57c6d0cd82af9b075ed2cdac2
|
2019-10-23T15:32:13Z
|
mmm a / src / core / file_sys / patch_manager . cpp <nl> ppp b / src / core / file_sys / patch_manager . cpp <nl> std : : optional < std : : vector < Core : : Memory : : CheatEntry > > ReadCheatFileFromFolder ( <nl> } <nl> <nl> Core : : Memory : : TextCheatParser parser ; <nl> - return parser . Parse ( <nl> - system , std : : string_view ( reinterpret_cast < const char * const > ( data . data ( ) ) , data . size ( ) ) ) ; <nl> + return parser . Parse ( system , <nl> + std : : string_view ( reinterpret_cast < const char * > ( data . data ( ) ) , data . size ( ) ) ) ; <nl> } <nl> <nl> } / / Anonymous namespace <nl>
|
Merge pull request from lioncash / qualifier
|
yuzu-emu/yuzu
|
741cbbdc0e27d1b9f0ac8e38458a125620d665cf
|
2020-08-04T04:09:48Z
|
new file mode 100644 <nl> index 000000000000 . . 18c9c1c9edf1 <nl> mmm / dev / null <nl> ppp b / jstests / sharding / moveshard1 . js <nl> <nl> + / / moveshard1 . js <nl> + <nl> + s = new ShardingTest ( " moveshard1 " , 2 ) ; <nl> + <nl> + l = s . _connections [ 0 ] ; <nl> + r = s . _connections [ 1 ] ; <nl> + <nl> + ldb = l . getDB ( " foo " ) ; <nl> + rdb = r . getDB ( " foo " ) ; <nl> + <nl> + ldb . things . save ( { a : 1 } ) <nl> + ldb . things . save ( { a : 2 } ) <nl> + ldb . things . save ( { a : 3 } ) <nl> + <nl> + assert . eq ( ldb . things . count ( ) , 3 ) ; <nl> + assert . eq ( rdb . things . count ( ) , 0 ) ; <nl> + <nl> + startResult = l . getDB ( " admin " ) . runCommand ( { " moveshard . start " : " foo . things " , <nl> + " to " : s . _serverNames [ 1 ] , <nl> + " from " : s . _serverNames [ 0 ] , <nl> + filter : { a : { $ gt : 2 } } <nl> + } ) ; <nl> + print ( " moveshard . start : " + tojson ( startResult ) ) ; <nl> + assert ( startResult . ok = = 1 , " start failed ! " ) ; <nl> + <nl> + finishResult = l . getDB ( " admin " ) . runCommand ( { " moveshard . finish " : " foo . things " , <nl> + finishToken : startResult . finishToken , <nl> + to : s . _serverNames [ 1 ] , <nl> + newVersion : 1 } ) ; <nl> + print ( " moveshard . finish : " + tojson ( finishResult ) ) ; <nl> + assert ( finishResult . ok = = 1 , " finishResult failed ! " ) ; <nl> + <nl> + assert . eq ( rdb . things . count ( ) , 1 , " right has wrong size after move " ) ; <nl> + assert . eq ( ldb . things . count ( ) , 2 , " left has wrong size after move " ) ; <nl> + <nl> + <nl> + s . stop ( ) ; <nl> + <nl> + <nl> mmm a / s / d_logic . cpp <nl> ppp b / s / d_logic . cpp <nl> <nl> # include " . . / db / jsobj . h " <nl> # include " . . / db / dbmessage . h " <nl> <nl> + # include " . . / client / connpool . h " <nl> + <nl> using namespace std ; <nl> <nl> namespace mongo { <nl> namespace mongo { <nl> boost : : thread_specific_ptr < NSVersions > clientShardVersions ; <nl> string shardConfigServer ; <nl> <nl> + unsigned long long getVersion ( BSONElement e , string & errmsg ) { <nl> + if ( e . eoo ( ) ) { <nl> + errmsg = " no version " ; <nl> + return 0 ; <nl> + } <nl> + <nl> + if ( e . isNumber ( ) ) <nl> + return ( unsigned long long ) e . number ( ) ; <nl> + <nl> + if ( e . type ( ) = = Date | | e . type ( ) = = Timestamp ) <nl> + return e . date ( ) ; <nl> + <nl> + <nl> + errmsg = " version is not a numberic type " ; <nl> + return 0 ; <nl> + } <nl> <nl> class MongodShardCommand : public Command { <nl> public : <nl> namespace mongo { <nl> } <nl> } <nl> <nl> - unsigned long long version ; <nl> - { <nl> - BSONElement e = cmdObj [ " version " ] ; <nl> - if ( e . eoo ( ) ) { <nl> - errmsg = " no version " ; <nl> - return false ; <nl> - } <nl> - else if ( e . isNumber ( ) ) <nl> - version = ( unsigned long long ) e . number ( ) ; <nl> - else if ( e . type ( ) = = Date | | e . type ( ) = = Timestamp ) <nl> - version = e . date ( ) ; <nl> - else { <nl> - errmsg = " version is not a numberic type " ; <nl> - return false ; <nl> - } <nl> - <nl> - } <nl> + unsigned long long version = getVersion ( cmdObj [ " version " ] , errmsg ) ; <nl> + if ( ! version ) <nl> + return false ; <nl> <nl> NSVersions * versions = clientShardVersions . get ( ) ; <nl> <nl> namespace mongo { <nl> } <nl> <nl> } getShardVersion ; <nl> - <nl> + <nl> class MoveShardStartCommand : public MongodShardCommand { <nl> public : <nl> MoveShardStartCommand ( ) : MongodShardCommand ( " moveshard . start " ) { } <nl> virtual void help ( stringstream & help ) const { <nl> help < < " should not be calling this directly " < < endl ; <nl> } <nl> - <nl> + <nl> bool run ( const char * cmdns , BSONObj & cmdObj , string & errmsg , BSONObjBuilder & result , bool ) { <nl> - / / i assume i ' m already locked <nl> / / so i have to start clone , tell caller its ok to make change <nl> + / / at this point the caller locks me , and updates config db <nl> / / then finish calls finish , and then deletes data when cursors are done <nl> - return false ; <nl> + <nl> + string ns = cmdObj [ " moveshard . start " ] . valuestrsafe ( ) ; <nl> + string to = cmdObj [ " to " ] . valuestrsafe ( ) ; <nl> + string from = cmdObj [ " from " ] . valuestrsafe ( ) ; / / my public address , a tad redundant , but safe <nl> + BSONObj filter = cmdObj . getObjectField ( " filter " ) ; <nl> + <nl> + if ( ns . size ( ) = = 0 ) { <nl> + errmsg = " need to specify namespace in command " ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( to . size ( ) = = 0 ) { <nl> + errmsg = " need to specify server to move shard to " ; <nl> + return false ; <nl> + } <nl> + if ( from . size ( ) = = 0 ) { <nl> + errmsg = " need to specify server to move shard from ( redundat i know ) " ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( filter . isEmpty ( ) ) { <nl> + errmsg = " need to specify a filter " ; <nl> + return false ; <nl> + } <nl> + <nl> + log ( ) < < " got moveshard . start : " < < cmdObj < < endl ; <nl> + <nl> + <nl> + BSONObj res ; <nl> + bool ok ; <nl> + <nl> + { <nl> + dbtemprelease unlock ; <nl> + <nl> + ScopedDbConnection conn ( to ) ; <nl> + ok = conn - > runCommand ( " admin " , <nl> + BSON ( " startCloneCollection " < < ns < < <nl> + " from " < < from < < <nl> + " query " < < filter <nl> + ) , <nl> + res ) ; <nl> + conn . done ( ) ; <nl> + } <nl> + <nl> + log ( ) < < " moveshard . start res : " < < res < < endl ; <nl> + <nl> + if ( ok ) { <nl> + result . append ( res [ " finishToken " ] ) ; <nl> + } <nl> + <nl> + return ok ; <nl> } <nl> <nl> } moveShardStartCmd ; <nl> namespace mongo { <nl> virtual void help ( stringstream & help ) const { <nl> help < < " should not be calling this directly " < < endl ; <nl> } <nl> - <nl> + <nl> bool run ( const char * cmdns , BSONObj & cmdObj , string & errmsg , BSONObjBuilder & result , bool ) { <nl> / / see MoveShardStartCommand : : run <nl> - return false ; <nl> + <nl> + string ns = cmdObj [ " moveshard . finish " ] . valuestrsafe ( ) ; <nl> + if ( ns . size ( ) = = 0 ) { <nl> + errmsg = " need ns as cmd value " ; <nl> + return false ; <nl> + } <nl> + <nl> + string to = cmdObj [ " to " ] . valuestrsafe ( ) ; <nl> + if ( to . size ( ) = = 0 ) { <nl> + errmsg = " need to specify server to move shard to " ; <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + unsigned long long newVersion = getVersion ( cmdObj [ " newVersion " ] , errmsg ) ; <nl> + if ( newVersion = = 0 ) { <nl> + errmsg = " have to specify new version number " ; <nl> + return false ; <nl> + } <nl> + <nl> + BSONObj finishToken = cmdObj . getObjectField ( " finishToken " ) ; <nl> + if ( finishToken . isEmpty ( ) ) { <nl> + errmsg = " need finishToken " ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( ns ! = finishToken [ " collection " ] . valuestrsafe ( ) ) { <nl> + errmsg = " namespaced don ' t match " ; <nl> + return false ; <nl> + } <nl> + <nl> + / / now we ' re locked <nl> + myVersions [ ns ] = newVersion ; <nl> + <nl> + BSONObj res ; <nl> + bool ok ; <nl> + <nl> + { <nl> + dbtemprelease unlock ; <nl> + <nl> + ScopedDbConnection conn ( to ) ; <nl> + ok = conn - > runCommand ( " admin " , <nl> + BSON ( " finishCloneCollection " < < finishToken ) , <nl> + res ) ; <nl> + conn . done ( ) ; <nl> + } <nl> + <nl> + if ( ! ok ) { <nl> + / / uh oh <nl> + errmsg = " finishCloneCollection failed ! " ; <nl> + result < < " finishError " < < res ; <nl> + return false ; <nl> + } <nl> + <nl> + / / wait until cursors are clean <nl> + cerr < < " WARNING : deleting data before ensuring no more cursors TODO " < < endl ; <nl> + <nl> + dbtemprelease unlock ; <nl> + <nl> + DBDirectClient client ; <nl> + BSONObj removeFilter = finishToken . getObjectField ( " query " ) ; <nl> + client . remove ( ns , removeFilter ) ; <nl> + <nl> + return true ; <nl> } <nl> <nl> } moveShardFinishCmd ; <nl>
|
implemented moveshard . ( start | finish ) in mongod
|
mongodb/mongo
|
6b49e60fe5d272df63eafa44cc99886bf10d82af
|
2009-04-06T19:57:17Z
|
mmm a / dlib / control / mpc . h <nl> ppp b / dlib / control / mpc . h <nl> namespace dlib <nl> mpc ( <nl> ) <nl> { <nl> + A = 0 ; <nl> + B = 0 ; <nl> + C = 0 ; <nl> + Q = 0 ; <nl> + R = 0 ; <nl> + lower = 0 ; <nl> + upper = 0 ; <nl> + <nl> max_iterations = 0 ; <nl> eps = 0 . 01 ; <nl> for ( unsigned long i = 0 ; i < horizon ; + + i ) <nl> namespace dlib <nl> const matrix < double , I , 1 > & upper_ <nl> ) : A ( A_ ) , B ( B_ ) , C ( C_ ) , Q ( Q_ ) , R ( R_ ) , lower ( lower_ ) , upper ( upper_ ) <nl> { <nl> + / / make sure requires clause is not broken <nl> + DLIB_ASSERT ( A . nr ( ) > 0 & & B . nc ( ) > 0 , <nl> + " \ t mpc : : mpc ( ) " <nl> + < < " \ n \ t invalid inputs were given to this function " <nl> + < < " \ n \ t A . nr ( ) : " < < A . nr ( ) <nl> + < < " \ n \ t B . nc ( ) : " < < B . nc ( ) <nl> + ) ; <nl> + <nl> + DLIB_ASSERT ( A . nr ( ) = = A . nc ( ) & & <nl> + A . nr ( ) = = B . nr ( ) & & <nl> + A . nr ( ) = = C . nr ( ) & & <nl> + A . nr ( ) = = Q . nr ( ) , <nl> + " \ t mpc : : mpc ( ) " <nl> + < < " \ n \ t invalid inputs were given to this function " <nl> + < < " \ n \ t A . nr ( ) : " < < A . nr ( ) <nl> + < < " \ n \ t A . nc ( ) : " < < A . nc ( ) <nl> + < < " \ n \ t B . nr ( ) : " < < B . nr ( ) <nl> + < < " \ n \ t C . nr ( ) : " < < C . nr ( ) <nl> + < < " \ n \ t Q . nr ( ) : " < < Q . nr ( ) <nl> + ) ; <nl> + DLIB_ASSERT ( <nl> + B . nc ( ) = = R . nr ( ) & & <nl> + B . nc ( ) = = lower . nr ( ) & & <nl> + B . nc ( ) = = upper . nr ( ) , <nl> + " \ t mpc : : mpc ( ) " <nl> + < < " \ n \ t invalid inputs were given to this function " <nl> + < < " \ n \ t B . nr ( ) : " < < B . nr ( ) <nl> + < < " \ n \ t B . nc ( ) : " < < B . nc ( ) <nl> + < < " \ n \ t lower . nr ( ) : " < < lower . nr ( ) <nl> + < < " \ n \ t upper . nr ( ) : " < < upper . nr ( ) <nl> + ) ; <nl> + DLIB_ASSERT ( min ( Q ) > = 0 & & <nl> + min ( R ) > 0 & & <nl> + min ( upper - lower ) > = 0 , <nl> + " \ t mpc : : mpc ( ) " <nl> + < < " \ n \ t invalid inputs were given to this function " <nl> + < < " \ n \ t min ( Q ) : " < < min ( Q ) <nl> + < < " \ n \ t min ( R ) : " < < min ( R ) <nl> + < < " \ n \ t min ( upper - lower ) : " < < min ( upper - lower ) <nl> + ) ; <nl> + <nl> + <nl> max_iterations = 10000 ; <nl> eps = 0 . 01 ; <nl> for ( unsigned long i = 0 ; i < horizon ; + + i ) <nl> namespace dlib <nl> const unsigned long time <nl> ) <nl> { <nl> + DLIB_ASSERT ( time < horizon , <nl> + " \ t void mpc : : set_target ( eps_ ) " <nl> + < < " \ n \ t invalid inputs were given to this function " <nl> + < < " \ n \ t time : " < < time <nl> + < < " \ n \ t horizon : " < < horizon <nl> + ) ; <nl> + <nl> target [ time ] = val ; <nl> } <nl> <nl> namespace dlib <nl> const unsigned long time <nl> ) const <nl> { <nl> + / / make sure requires clause is not broken <nl> + DLIB_ASSERT ( time < horizon , <nl> + " \ t matrix mpc : : get_target ( eps_ ) " <nl> + < < " \ n \ t invalid inputs were given to this function " <nl> + < < " \ n \ t time : " < < time <nl> + < < " \ n \ t horizon : " < < horizon <nl> + ) ; <nl> + <nl> return target [ time ] ; <nl> } <nl> <nl> namespace dlib <nl> { <nl> / / make sure requires clause is not broken <nl> DLIB_ASSERT ( eps_ > 0 , <nl> - " \ tvoid mpc : : set_epsilon ( eps_ ) " <nl> + " \ t void mpc : : set_epsilon ( eps_ ) " <nl> < < " \ n \ t invalid inputs were given to this function " <nl> < < " \ n \ t eps_ : " < < eps_ <nl> ) ; <nl> namespace dlib <nl> const matrix < double , S , 1 > & current_state <nl> ) <nl> { <nl> + / / make sure requires clause is not broken <nl> + DLIB_ASSERT ( min ( R ) > 0 & & A . nr ( ) = = current_state . size ( ) , <nl> + " \ t matrix mpc : : operator ( current_state ) " <nl> + < < " \ n \ t invalid inputs were given to this function " <nl> + < < " \ n \ t min ( R ) : " < < min ( R ) <nl> + < < " \ n \ t A . nr ( ) : " < < A . nr ( ) <nl> + < < " \ n \ t current_state . size ( ) : " < < current_state . size ( ) <nl> + ) ; <nl> + <nl> / / Shift the inputs over by one time step so we can use them to warm start the <nl> / / optimizer . <nl> for ( unsigned long i = 1 ; i < horizon ; + + i ) <nl> namespace dlib <nl> const matrix < double , S , 1 > & initial_state <nl> ) <nl> { <nl> - DLIB_CASSERT ( min ( Q ) > = 0 , " " ) ; <nl> - DLIB_CASSERT ( min ( R ) > 0 , " " ) ; <nl> - <nl> - <nl> - <nl> / / make it so MM = = trans ( K ) * Q * ( M - target ) <nl> M [ 0 ] = A * initial_state + C ; <nl> for ( unsigned long i = 1 ; i < horizon ; + + i ) <nl> mmm a / dlib / control / mpc_abstract . h <nl> ppp b / dlib / control / mpc_abstract . h <nl> namespace dlib <nl> I_ > = 0 <nl> <nl> WHAT THIS OBJECT REPRESENTS <nl> - Based largely on <nl> - A Fast Gradient method for embedded linear predictive control <nl> - by Markus Kogel and Rolf Findeisen <nl> - <nl> + This object implements a linear model predictive controller . To explain <nl> + what that means , suppose you have some process you want to control and the <nl> + process dynamics are described by the linear equation : <nl> + x_ { i + 1 } = A * x_i + B * u_i + C <nl> + That is , the next state the system goes into is a linear function of its <nl> + current state ( x_i ) and the current control ( u_i ) plus some constant bias <nl> + or disturbance . <nl> + <nl> + A model predictive controller can find the control ( u ) you should apply to <nl> + drive the state ( x ) to some reference value , or alternatively to make the <nl> + state track some reference time - varying sequence . It does this by <nl> + simulating the process for horizon_ time steps and selecting the control <nl> + that leads to the best performance over the next horizon_ steps . <nl> + <nl> + To be precise , each time you ask this object for a control , it solves the <nl> + following quadratic program : <nl> <nl> - min sum_i ( 0 . 5 * trans ( x_i ) * Q * x_i + 0 . 5 * trans ( u_i ) * R * u_i ) <nl> - x_i , u_i <nl> + min sum_i trans ( x_i - target_i ) * Q * ( x_i - target_i ) + trans ( u_i ) * R * u_i <nl> + x_i , u_i <nl> <nl> - such that : x_0 = = current_state <nl> - x_ { i + 1 } = = A * x_i + B * u_i + C <nl> - 0 < = i < horizon <nl> + such that : x_0 = = current_state <nl> + x_ { i + 1 } = = A * x_i + B * u_i + C <nl> + lower < = u_i < = upper <nl> + 0 < = i < horizon_ <nl> + <nl> + and reports u_0 as the control you should take given that you are currently <nl> + in current_state . Q and R are user supplied matrices that define how we <nl> + penalize variations away from the target state as well as how much we want <nl> + to avoid generating large control signals . <nl> + <nl> + Finally , the algorithm we use to solve this quadratic program is based <nl> + largely on the method described in : <nl> + A Fast Gradient method for embedded linear predictive control ( 2011 ) <nl> + by Markus Kogel and Rolf Findeisen <nl> ! * / <nl> <nl> public : <nl> namespace dlib <nl> / * ! <nl> ensures <nl> - # get_max_iterations ( ) = = 0 <nl> - - The values of the A , B , C , Q , R , lower , and upper parameter matrices are <nl> - undefined . To use this object you must initialize it via the constructor <nl> + - The A , B , C , Q , R , lower , and upper parameter matrices are filled with zeros . <nl> + Therefore , to use this object you must initialize it via the constructor <nl> that supplies these parameters . <nl> ! * / <nl> <nl> namespace dlib <nl> - B . nc ( ) = = R . nr ( ) = = lower . nr ( ) = = upper . nr ( ) <nl> - min ( Q ) > = 0 <nl> - min ( R ) > 0 <nl> - - min ( upper - lower ) > 0 <nl> + - min ( upper - lower ) > = 0 <nl> ensures <nl> - # get_A ( ) = = A <nl> - # get_B ( ) = = B <nl> namespace dlib <nl> - for all valid i : <nl> - get_target ( i ) = = a vector of all zeros <nl> - get_target ( i ) . size ( ) = = A . nr ( ) <nl> + - # get_max_iterations ( ) = = 10000 <nl> + - # get_epsilon ( ) = = 0 . 01 <nl> ! * / <nl> <nl> const matrix < double , S , S > & get_A ( <nl> ) const ; <nl> + / * ! <nl> + ensures <nl> + - returns the A matrix from the quadratic program defined above . <nl> + ! * / <nl> <nl> const matrix < double , S , I > & get_B ( <nl> ) const ; <nl> + / * ! <nl> + ensures <nl> + - returns the B matrix from the quadratic program defined above . <nl> + ! * / <nl> <nl> const matrix < double , S , 1 > & get_C ( <nl> ) const ; <nl> + / * ! <nl> + ensures <nl> + - returns the C matrix from the quadratic program defined above . <nl> + ! * / <nl> <nl> const matrix < double , S , 1 > & get_Q ( <nl> ) const ; <nl> + / * ! <nl> + ensures <nl> + - returns the diagonal of the Q matrix from the quadratic program defined <nl> + above . <nl> + ! * / <nl> <nl> const matrix < double , I , 1 > & get_R ( <nl> ) const ; <nl> + / * ! <nl> + ensures <nl> + - returns the diagonal of the R matrix from the quadratic program defined <nl> + above . <nl> + ! * / <nl> <nl> const matrix < double , I , 1 > & get_lower_constraints ( <nl> ) const ; <nl> + / * ! <nl> + ensures <nl> + - returns the lower matrix from the quadratic program defined above . All <nl> + controls generated by this object will have values no less than this <nl> + lower bound . That is , any control u will satisfy min ( u - lower ) > = 0 . <nl> + ! * / <nl> <nl> const matrix < double , I , 1 > & get_upper_constraints ( <nl> ) const ; <nl> + / * ! <nl> + ensures <nl> + - returns the upper matrix from the quadratic program defined above . All <nl> + controls generated by this object will have values no larger than this <nl> + upper bound . That is , any control u will satisfy min ( upper - u ) > = 0 . <nl> + ! * / <nl> <nl> const matrix < double , S , 1 > & get_target ( <nl> const unsigned long time <nl> namespace dlib <nl> / * ! <nl> requires <nl> - time < horizon <nl> + ensures <nl> + - This object will try to find the control sequence that results in the <nl> + process obtaining get_target ( time ) state at the indicated time . Note <nl> + that the next time instant after " right now " is time 0 . <nl> ! * / <nl> <nl> void set_target ( <nl> namespace dlib <nl> matrix < double , I , 1 > operator ( ) ( <nl> const matrix < double , S , 1 > & current_state <nl> ) ; <nl> + / * ! <nl> + requires <nl> + - min ( R ) > 0 <nl> + - A . nr ( ) = = current_state . size ( ) <nl> + ensures <nl> + - Solves the model predictive control problem defined by the arguments to <nl> + this objects constructor , assuming that the starting state is given by <nl> + current_state . Then we return the control that should be taken in the <nl> + current state that best optimizes the quadratic objective function <nl> + defined above . <nl> + - We also shift over the target states so that you only need to update the <nl> + last one ( if you are using non - zero target states ) via a call to <nl> + set_last_target ( ) ) . In particular , for all valid t , it will be the case <nl> + that : <nl> + - # get_target ( t ) = = get_target ( t + 1 ) <nl> + - # get_target ( horizon - 1 ) = = get_target ( horizon - 1 ) <nl> + ! * / <nl> <nl> } ; <nl> <nl>
|
Cleaned up this code , filled out spec , added asserts .
|
davisking/dlib
|
b975cdf6390553c627520fa79b55a585dee484ff
|
2015-05-29T22:00:42Z
|
mmm a / etc / evergreen . yml <nl> ppp b / etc / evergreen . yml <nl> buildvariants : <nl> push_bucket : downloads . 10gen . com <nl> push_name : linux <nl> push_arch : arm64 - enterprise - ubuntu1604 <nl> - compile_flags : - - ssl MONGO_DISTMOD = ubuntu1604 - j $ ( grep - c ^ processor / proc / cpuinfo ) CCFLAGS = " - march = armv8 - a - mtune = generic " - - release CC = / opt / mongodbtoolchain / v2 / bin / gcc CXX = / opt / mongodbtoolchain / v2 / bin / g + + OBJCOPY = / opt / mongodbtoolchain / v2 / bin / objcopy <nl> + compile_flags : - - ssl MONGO_DISTMOD = ubuntu1604 - j $ ( grep - c ^ processor / proc / cpuinfo ) CCFLAGS = " - march = armv8 - a + crc - mtune = generic " - - release CC = / opt / mongodbtoolchain / v2 / bin / gcc CXX = / opt / mongodbtoolchain / v2 / bin / g + + OBJCOPY = / opt / mongodbtoolchain / v2 / bin / objcopy <nl> num_jobs_available : $ ( grep - c ^ processor / proc / cpuinfo ) <nl> test_flags : - - excludeWithAnyTags = requires_mmapv1 <nl> has_packages : true <nl> buildvariants : <nl> push_bucket : downloads . mongodb . org <nl> push_name : linux <nl> push_arch : arm64 - ubuntu1604 <nl> - compile_flags : - - ssl MONGO_DISTMOD = ubuntu1604 - j $ ( grep - c ^ processor / proc / cpuinfo ) - - release CCFLAGS = " - march = armv8 - a - mtune = generic " CC = / opt / mongodbtoolchain / v2 / bin / gcc CXX = / opt / mongodbtoolchain / v2 / bin / g + + OBJCOPY = / opt / mongodbtoolchain / v2 / bin / objcopy <nl> + compile_flags : - - ssl MONGO_DISTMOD = ubuntu1604 - j $ ( grep - c ^ processor / proc / cpuinfo ) - - release CCFLAGS = " - march = armv8 - a + crc - mtune = generic " CC = / opt / mongodbtoolchain / v2 / bin / gcc CXX = / opt / mongodbtoolchain / v2 / bin / g + + OBJCOPY = / opt / mongodbtoolchain / v2 / bin / objcopy <nl> num_jobs_available : $ ( grep - c ^ processor / proc / cpuinfo ) <nl> test_flags : - - excludeWithAnyTags = requires_mmapv1 <nl> has_packages : true <nl>
|
SERVER - 26039 ARMv8 builds need to enable support for the optional CRC feature
|
mongodb/mongo
|
cc262f3db83bda877ab20d793dfa79bdcec9de8c
|
2016-09-09T22:29:59Z
|
mmm a / src / script . cpp <nl> ppp b / src / script . cpp <nl> bool VerifyScript ( const CScript & scriptSig , const CScript & scriptPubKey , const C <nl> if ( ! scriptSig . IsPushOnly ( ) ) / / scriptSig must be literals - only <nl> return false ; / / or validation fails <nl> <nl> + / / stackCopy cannot be empty here , because if it was the <nl> + / / P2SH HASH < > EQUAL scriptPubKey would be evaluated with <nl> + / / an empty stack and the EvalScript above would return false . <nl> + assert ( ! stackCopy . empty ( ) ) ; <nl> + <nl> const valtype & pubKeySerialized = stackCopy . back ( ) ; <nl> CScript pubKey2 ( pubKeySerialized . begin ( ) , pubKeySerialized . end ( ) ) ; <nl> popstack ( stackCopy ) ; <nl>
|
Add assert and comment for subtle pay - to - script - hash logic
|
bitcoin/bitcoin
|
a91efb2d8d2791f324705e24909af51640ca73e4
|
2012-11-21T18:58:10Z
|
mmm a / jstests / replsets / tags . js <nl> ppp b / jstests / replsets / tags . js <nl> <nl> - function myprint ( x ) { <nl> - print ( " tags output : " + x ) ; <nl> - } <nl> - <nl> - var num = 5 ; <nl> - var host = getHostName ( ) ; <nl> - var name = " tags " ; <nl> - <nl> - var replTest = new ReplSetTest ( { name : name , nodes : num } ) ; <nl> - var nodes = replTest . startSet ( ) ; <nl> - var port = replTest . ports ; <nl> - replTest . initiate ( { _id : name , members : <nl> - [ <nl> - { _id : 0 , host : host + " : " + port [ 0 ] , tags : { " server " : " 0 " , " dc " : " ny " , " ny " : " 1 " , " rack " : " ny . rk1 " } } , <nl> - { _id : 1 , host : host + " : " + port [ 1 ] , tags : { " server " : " 1 " , " dc " : " ny " , " ny " : " 2 " , " rack " : " ny . rk1 " } } , <nl> - { _id : 2 , host : host + " : " + port [ 2 ] , tags : { " server " : " 2 " , " dc " : " ny " , " ny " : " 3 " , " rack " : " ny . rk2 " , " 2 " : " this " } } , <nl> - { _id : 3 , host : host + " : " + port [ 3 ] , tags : { " server " : " 3 " , " dc " : " sf " , " sf " : " 1 " , " rack " : " sf . rk1 " } } , <nl> - { _id : 4 , host : host + " : " + port [ 4 ] , tags : { " server " : " 4 " , " dc " : " sf " , " sf " : " 2 " , " rack " : " sf . rk2 " } } , <nl> + ( function ( ) { <nl> + ' use strict ' ; <nl> + <nl> + var num = 5 ; <nl> + var host = getHostName ( ) ; <nl> + var name = ' tags ' ; <nl> + <nl> + var replTest = new ReplSetTest ( { name : name , nodes : num } ) ; <nl> + var nodes = replTest . nodeList ( ) ; <nl> + replTest . startSet ( ) ; <nl> + var port = replTest . ports ; <nl> + replTest . initiate ( { <nl> + _id : name , <nl> + members : [ <nl> + { <nl> + _id : 0 , <nl> + host : nodes [ 0 ] , <nl> + tags : { <nl> + server : ' 0 ' , <nl> + dc : ' ny ' , <nl> + ny : ' 1 ' , <nl> + rack : ' ny . rk1 ' , <nl> + } , <nl> + } , <nl> + { <nl> + _id : 1 , <nl> + host : nodes [ 1 ] , <nl> + priority : 2 , <nl> + tags : { <nl> + server : ' 1 ' , <nl> + dc : ' ny ' , <nl> + ny : ' 2 ' , <nl> + rack : ' ny . rk1 ' , <nl> + } , <nl> + } , <nl> + { <nl> + _id : 2 , <nl> + host : nodes [ 2 ] , <nl> + priority : 3 , <nl> + tags : { <nl> + server : ' 2 ' , <nl> + dc : ' ny ' , <nl> + ny : ' 3 ' , <nl> + rack : ' ny . rk2 ' , <nl> + 2 : ' this ' , <nl> + } , <nl> + } , <nl> + { <nl> + _id : 3 , <nl> + host : nodes [ 3 ] , <nl> + tags : { <nl> + server : ' 3 ' , <nl> + dc : ' sf ' , <nl> + sf : ' 1 ' , <nl> + rack : ' sf . rk1 ' , <nl> + } , <nl> + } , <nl> + { <nl> + _id : 4 , <nl> + host : nodes [ 4 ] , <nl> + tags : { <nl> + server : ' 4 ' , <nl> + dc : ' sf ' , <nl> + sf : ' 2 ' , <nl> + rack : ' sf . rk2 ' , <nl> + } , <nl> + } , <nl> ] , <nl> settings : { <nl> getLastErrorModes : { <nl> - " 2 dc and 3 server " : { " dc " : 2 , " server " : 3 } , <nl> - " 1 and 2 " : { " server " : 1 } <nl> - } <nl> - } } ) ; <nl> - <nl> - var master = replTest . getMaster ( ) ; <nl> - / / make everyone catch up before reconfig <nl> - replTest . awaitReplication ( ) ; <nl> - <nl> - var config = master . getDB ( " local " ) . system . replset . findOne ( ) ; <nl> - <nl> - printjson ( config ) ; <nl> - var modes = config . settings . getLastErrorModes ; <nl> - assert . eq ( typeof modes , " object " ) ; <nl> - assert . eq ( modes [ " 2 dc and 3 server " ] . dc , 2 ) ; <nl> - assert . eq ( modes [ " 2 dc and 3 server " ] . server , 3 ) ; <nl> - assert . eq ( modes [ " 1 and 2 " ] [ " server " ] , 1 ) ; <nl> - <nl> - config . version + + ; <nl> - config . members [ 1 ] . priority = 1 . 5 ; <nl> - config . members [ 2 ] . priority = 2 ; <nl> - modes [ " 3 or 4 " ] = { " sf " : 1 } ; <nl> - modes [ " 3 and 4 " ] = { " sf " : 2 } ; <nl> - modes [ " 1 and 2 " ] [ " 2 " ] = 1 ; <nl> - modes [ " 2 " ] = { " 2 " : 1 } <nl> - <nl> - try { <nl> - master . getDB ( " admin " ) . runCommand ( { replSetReconfig : config } ) ; <nl> - } <nl> - catch ( e ) { <nl> - myprint ( e ) ; <nl> - } <nl> - <nl> - assert . soon ( function ( ) { <nl> - try { <nl> - return nodes [ 2 ] . getDB ( " admin " ) . isMaster ( ) . ismaster ; <nl> - } catch ( x ) { <nl> - return false ; <nl> - } <nl> - } , ' wait for 2 to be primary ' , 60000 ) ; <nl> - <nl> - myprint ( " primary is now 2 " ) ; <nl> - master = replTest . getMaster ( ) ; <nl> - config = master . getDB ( " local " ) . system . replset . findOne ( ) ; <nl> - printjson ( config ) ; <nl> - <nl> - modes = config . settings . getLastErrorModes ; <nl> - assert . eq ( typeof modes , " object " ) ; <nl> - assert . eq ( modes [ " 2 dc and 3 server " ] . dc , 2 ) ; <nl> - assert . eq ( modes [ " 2 dc and 3 server " ] . server , 3 ) ; <nl> - assert . eq ( modes [ " 1 and 2 " ] [ " server " ] , 1 ) ; <nl> - assert . eq ( modes [ " 3 or 4 " ] [ " sf " ] , 1 ) ; <nl> - assert . eq ( modes [ " 3 and 4 " ] [ " sf " ] , 2 ) ; <nl> - <nl> - / / create collection to guard against timeouts due to file allocation <nl> - assert . commandWorked ( master . getDB ( " foo " ) . createCollection ( " bar " ) ) ; <nl> - replTest . awaitReplication ( ) ; <nl> - <nl> - myprint ( " bridging " ) ; <nl> - replTest . bridge ( ) ; <nl> - myprint ( " bridge 1 " ) ; <nl> - replTest . partition ( 0 , 3 ) ; <nl> - myprint ( " bridge 2 " ) ; <nl> - replTest . partition ( 0 , 4 ) ; <nl> - myprint ( " bridge 3 " ) ; <nl> - replTest . partition ( 1 , 3 ) ; <nl> - myprint ( " bridge 4 " ) ; <nl> - replTest . partition ( 1 , 4 ) ; <nl> - myprint ( " bridge 5 " ) ; <nl> - replTest . partition ( 2 , 3 ) ; <nl> - myprint ( " bridge 6 " ) ; <nl> - replTest . partition ( 2 , 4 ) ; <nl> - myprint ( " bridge 7 " ) ; <nl> - replTest . partition ( 3 , 4 ) ; <nl> - myprint ( " done bridging " ) ; <nl> - <nl> - myprint ( " paritions : [ 0 - 1 - 2 - 0 ] [ 3 ] [ 4 ] " ) <nl> - myprint ( " test1 " ) ; <nl> - myprint ( " 2 should be primary " ) ; <nl> - master = replTest . getMaster ( ) ; <nl> - <nl> - printjson ( master . getDB ( " admin " ) . runCommand ( { replSetGetStatus : 1 } ) ) ; <nl> - <nl> - var timeout = 30 * 1000 ; <nl> - <nl> - var options = { writeConcern : { w : " 3 or 4 " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - var result = master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ; <nl> - assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> - assert ( result . getWriteConcernError ( ) . errInfo . wtimeout ) ; <nl> - <nl> - replTest . unPartition ( 1 , 4 ) ; <nl> - <nl> - myprint ( " partitions : [ 1 - 4 ] [ 0 - 1 - 2 - 0 ] [ 3 ] " ) ; <nl> - myprint ( " test2 " ) ; <nl> - options = { writeConcern : { w : " 3 or 4 " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - <nl> - myprint ( " partitions : [ 1 - 4 ] [ 0 - 1 - 2 - 0 ] [ 3 ] " ) ; <nl> - myprint ( " test3 " ) ; <nl> - options = { writeConcern : { w : " 3 and 4 " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - result = assert . writeError ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> - assert ( result . getWriteConcernError ( ) . errInfo . wtimeout , tojson ( result . getWriteConcernError ( ) ) ) ; <nl> - <nl> - replTest . unPartition ( 3 , 4 ) ; <nl> - <nl> - myprint ( " partitions : [ 0 - 4 - 3 ] [ 0 - 1 - 2 - 0 ] " ) ; <nl> - myprint ( " 31004 should sync from 31001 ( 31026 ) " ) ; <nl> - myprint ( " 31003 should sync from 31004 ( 31024 ) " ) ; <nl> - myprint ( " test4 " ) ; <nl> - options = { writeConcern : { w : " 3 and 4 " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - <nl> - myprint ( " non - existent w " ) ; <nl> - options = { writeConcern : { w : " blahblah " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - result = assert . writeError ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> - assert . eq ( 79 , result . getWriteConcernError ( ) . code , tojson ( result . getWriteConcernError ( ) ) ) ; <nl> - <nl> - myprint ( " test mode 2 " ) ; <nl> - options = { writeConcern : { w : " 2 " , wtimeout : 0 } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - <nl> - myprint ( " test two on the primary " ) ; <nl> - options = { writeConcern : { w : " 1 and 2 " , wtimeout : 0 } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - <nl> - myprint ( " test5 " ) ; <nl> - options = { writeConcern : { w : " 2 dc and 3 server " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - <nl> - replTest . unPartition ( 1 , 3 ) ; <nl> - <nl> - replTest . partition ( 2 , 0 ) ; <nl> - replTest . partition ( 2 , 1 ) ; <nl> - replTest . stop ( 2 ) ; <nl> - <nl> - / / Node 1 with slightly higher priority will take over . <nl> - replTest . waitForState ( nodes [ 1 ] , replTest . PRIMARY , 60 * 1000 ) ; <nl> - <nl> - myprint ( " 1 must become primary here because otherwise the other members will take too long " + <nl> - " timing out their old sync threads " ) ; <nl> - master = replTest . getMaster ( ) ; <nl> - <nl> - myprint ( " test6 " ) ; <nl> - options = { writeConcern : { w : " 3 and 4 " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - <nl> - myprint ( " test mode 2 " ) ; <nl> - options = { writeConcern : { w : " 2 " , wtimeout : timeout } } ; <nl> - assert . writeOK ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } ) ) ; <nl> - result = assert . writeError ( master . getDB ( " foo " ) . bar . insert ( { x : 1 } , options ) ) ; <nl> - assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> - assert ( result . getWriteConcernError ( ) . errInfo . wtimeout ) ; <nl> - <nl> - replTest . stopSet ( ) ; <nl> - myprint ( " \ n \ ntags . js SUCCESS \ n \ n " ) ; <nl> + ' 2 dc and 3 server ' : { <nl> + dc : 2 , <nl> + server : 3 , <nl> + } , <nl> + ' 1 and 2 ' : { <nl> + 2 : 1 , <nl> + server : 1 , <nl> + } , <nl> + ' 2 ' : { <nl> + 2 : 1 , <nl> + } , <nl> + ' 3 and 4 ' : { <nl> + sf : 2 , <nl> + } , <nl> + ' 3 or 4 ' : { <nl> + sf : 1 , <nl> + } , <nl> + } , <nl> + } , <nl> + } ) ; <nl> + <nl> + replTest . awaitReplication ( ) ; <nl> + <nl> + / / Create collection to guard against timeouts due to file allocation . <nl> + assert . commandWorked ( replTest . getPrimary ( ) . getDB ( ' foo ' ) . createCollection ( ' bar ' ) ) ; <nl> + replTest . awaitReplication ( ) ; <nl> + <nl> + var ensurePrimary = function ( nodeId , expectedWritableNodes ) { <nl> + jsTestLog ( ' Node ' + nodeId + ' ( ' + replTest . nodes [ nodeId ] . host + ' ) should be primary . ' ) ; <nl> + replTest . waitForState ( replTest . nodes [ nodeId ] , replTest . PRIMARY , 60 * 1000 ) ; <nl> + primary = replTest . getPrimary ( ) ; <nl> + var writeConcern = { writeConcern : { w : expectedWritableNodes , wtimeout : 30 * 1000 } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( { x : 100 } , writeConcern ) ) ; <nl> + return primary ; <nl> + } ; <nl> + <nl> + / / 2 should eventually stage a priority takeover from the primary . <nl> + var primary = ensurePrimary ( 2 , 3 ) ; <nl> + <nl> + jsTestLog ( ' primary is now 2 ' ) ; <nl> + var config = assert . commandWorked ( primary . adminCommand ( { replSetGetConfig : 1 } ) ) . config ; <nl> + jsTestLog ( ' test configuration = ' + tojson ( config ) ) ; <nl> + <nl> + jsTestLog ( ' bridging started ' ) ; <nl> + replTest . bridge ( ) ; <nl> + jsTestLog ( ' bridge 1 of 7 ' ) ; <nl> + replTest . partition ( 0 , 3 ) ; <nl> + jsTestLog ( ' bridge 2 of 7 ' ) ; <nl> + replTest . partition ( 0 , 4 ) ; <nl> + jsTestLog ( ' bridge 3 of 7 ' ) ; <nl> + replTest . partition ( 1 , 3 ) ; <nl> + jsTestLog ( ' bridge 4 of 7 ' ) ; <nl> + replTest . partition ( 1 , 4 ) ; <nl> + jsTestLog ( ' bridge 5 of 7 ' ) ; <nl> + replTest . partition ( 2 , 3 ) ; <nl> + jsTestLog ( ' bridge 6 of 7 ' ) ; <nl> + replTest . partition ( 2 , 4 ) ; <nl> + jsTestLog ( ' bridge 7 of 7 ' ) ; <nl> + replTest . partition ( 3 , 4 ) ; <nl> + jsTestLog ( ' bridging finished ' ) ; <nl> + <nl> + jsTestLog ( ' partitions : nodes with each set of brackets [ N1 , N2 , N3 ] form a complete network . ' ) ; <nl> + jsTestLog ( ' partitions : [ 0 - 1 - 2 ] [ 3 ] [ 4 ] ( only nodes 0 and 1 can replicate from primary node 2 ' ) ; <nl> + <nl> + var doc = { x : 1 } ; <nl> + <nl> + / / This timeout should be shorter in duration than the server parameter maxSyncSourceLagSecs . <nl> + / / Some writes are expected to block for this ' timeout ' duration before failing . <nl> + / / Depending on the order of heartbeats ( containing last committed op time ) received <nl> + / / by a node , it might hang up on its sync source . This may cause some of the write concern <nl> + / / tests to fail . <nl> + var timeout = 20 * 1000 ; <nl> + <nl> + jsTestLog ( ' test1 ' ) ; <nl> + primary = ensurePrimary ( 2 , 3 ) ; <nl> + <nl> + jsTestLog ( ' Non - existent write concern should be rejected . ' ) ; <nl> + options = { writeConcern : { w : ' blahblah ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + var result = assert . writeError ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> + assert . eq ( ErrorCodes . UnknownReplWriteConcern , result . getWriteConcernError ( ) . code , <nl> + tojson ( result . getWriteConcernError ( ) ) ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 3 or 4 " should fail - 3 and 4 are not connected to the primary . ' ) ; <nl> + var options = { writeConcern : { w : ' 3 or 4 ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + result = primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ; <nl> + assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> + assert ( result . getWriteConcernError ( ) . errInfo . wtimeout ) ; <nl> + <nl> + replTest . unPartition ( 1 , 4 ) ; <nl> + jsTestLog ( ' partitions : [ 0 - 1 - 2 ] [ 1 - 4 ] [ 3 ] ' + <nl> + ' ( all nodes besides node 3 can replicate from primary node 2 ) ' ) ; <nl> + primary = ensurePrimary ( 2 , 4 ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 3 or 4 " should work - 4 is now connected to the primary ' + <nl> + primary . host + ' via node 1 ' + replTest . nodes [ 1 ] . host ) ; <nl> + options = { writeConcern : { w : ' 3 or 4 ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 3 and 4 " should fail - 3 is not connected to the primary . ' ) ; <nl> + options = { writeConcern : { w : ' 3 and 4 ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + result = assert . writeError ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> + assert ( result . getWriteConcernError ( ) . errInfo . wtimeout , tojson ( result . getWriteConcernError ( ) ) ) ; <nl> + <nl> + replTest . unPartition ( 3 , 4 ) ; <nl> + jsTestLog ( ' partitions : [ 0 - 1 - 2 ] [ 1 - 4 ] [ 3 - 4 ] ' + <nl> + ' ( all secondaries can replicate from primary node 2 ) ' ) ; <nl> + primary = ensurePrimary ( 2 , 5 ) ; <nl> + <nl> + jsTestLog ( ' 31004 should sync from 31001 ( 31026 ) ' ) ; <nl> + jsTestLog ( ' 31003 should sync from 31004 ( 31024 ) ' ) ; <nl> + jsTestLog ( ' Write concern " 3 and 4 " should work - ' + <nl> + ' nodes 3 and 4 are connected to primary via node 1 . ' ) ; <nl> + options = { writeConcern : { w : ' 3 and 4 ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 2 " - writes to primary only . ' ) ; <nl> + options = { writeConcern : { w : ' 2 ' , wtimeout : 0 } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 1 and 2 " ' ) ; <nl> + options = { writeConcern : { w : ' 1 and 2 ' , wtimeout : 0 } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 2 dc and 3 server " ' ) ; <nl> + primary = ensurePrimary ( 2 , 5 ) ; <nl> + options = { writeConcern : { w : ' 2 dc and 3 server ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + <nl> + jsTestLog ( ' Bringing down current primary node 2 ' + primary . host + <nl> + ' to allow next higher priority node 1 ' + replTest . nodes [ 1 ] . host + <nl> + ' to become primary . ' ) ; <nl> + <nl> + / / Is this necessary since 3 will be connected to the new primary via node 4 ? <nl> + replTest . unPartition ( 1 , 3 ) ; <nl> + <nl> + replTest . partition ( 2 , 0 ) ; <nl> + replTest . partition ( 2 , 1 ) ; <nl> + <nl> + / / Is this necessary when we partition node 2 off from the rest of the nodes ? <nl> + replTest . stop ( 2 ) ; <nl> + jsTestLog ( ' partitions : [ 0 - 1 ] [ 2 ] [ 1 - 3 - 4 ] ' + <nl> + ' ( all secondaries except down node 2 can replicate from new primary node 1 ) ' ) ; <nl> + <nl> + / / Node 1 with slightly higher priority will take over . <nl> + jsTestLog ( ' 1 must become primary here because otherwise the other members will take too ' + <nl> + ' long timing out their old sync threads ' ) ; <nl> + primary = ensurePrimary ( 1 , 4 ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 3 and 4 " should still work with new primary node 1 ' + primary . host ) ; <nl> + options = { writeConcern : { w : ' 3 and 4 ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + <nl> + jsTestLog ( ' Write concern " 2 " should fail because node 2 ' + replTest . nodes [ 2 ] . host + <nl> + ' is down . ' ) ; <nl> + options = { writeConcern : { w : ' 2 ' , wtimeout : timeout } } ; <nl> + assert . writeOK ( primary . getDB ( ' foo ' ) . bar . insert ( doc ) ) ; <nl> + result = assert . writeError ( primary . getDB ( ' foo ' ) . bar . insert ( doc , options ) ) ; <nl> + assert . neq ( null , result . getWriteConcernError ( ) ) ; <nl> + assert ( result . getWriteConcernError ( ) . errInfo . wtimeout ) ; <nl> + <nl> + replTest . stopSet ( ) ; <nl> + jsTestLog ( ' tags . js SUCCESS ' ) ; <nl> + } ( ) ) ; <nl>
|
SERVER - 20151 updated tags . js to use a timeout for the failing write operations that is shorter than the default maxSyncSourceLagSecs
|
mongodb/mongo
|
35e0068ac2e41efd18cb6380aedd1f01b376103f
|
2015-10-07T14:27:43Z
|
mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> void CollectSlots ( MemoryChunk * chunk , Address start , Address end , <nl> } <nl> return KEEP_SLOT ; <nl> } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> if ( direction = = OLD_TO_NEW ) { <nl> + CHECK ( chunk - > SweepingDone ( ) ) ; <nl> RememberedSetSweeping : : Iterate ( <nl> chunk , <nl> [ start , end , untyped ] ( MaybeObjectSlot slot ) { <nl> void CollectSlots ( MemoryChunk * chunk , Address start , Address end , <nl> } <nl> return KEEP_SLOT ; <nl> } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> } <nl> RememberedSet < direction > : : IterateTyped ( <nl> chunk , [ = ] ( SlotType type , Address slot ) { <nl> mmm a / src / heap / mark - compact . cc <nl> ppp b / src / heap / mark - compact . cc <nl> void MarkCompactCollector : : FlushBytecodeFromSFI ( <nl> DCHECK_NULL ( chunk - > sweeping_slot_set ( ) ) ; <nl> RememberedSet < OLD_TO_NEW > : : RemoveRange ( <nl> chunk , compiled_data_start , compiled_data_start + compiled_data_size , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> RememberedSet < OLD_TO_OLD > : : RemoveRange ( <nl> chunk , compiled_data_start , compiled_data_start + compiled_data_size , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> <nl> / / Swap the map , using set_map_after_allocation to avoid verify heap checks <nl> / / which are not necessary since we are doing this during the GC atomic pause . <nl> void MarkCompactCollector : : RightTrimDescriptorArray ( DescriptorArray array , <nl> MemoryChunk * chunk = MemoryChunk : : FromHeapObject ( array ) ; <nl> DCHECK_NULL ( chunk - > sweeping_slot_set ( ) ) ; <nl> RememberedSet < OLD_TO_NEW > : : RemoveRange ( chunk , start , end , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> RememberedSet < OLD_TO_OLD > : : RemoveRange ( chunk , start , end , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> heap ( ) - > CreateFillerObjectAt ( start , static_cast < int > ( end - start ) , <nl> ClearRecordedSlots : : kNo ) ; <nl> array . set_number_of_all_descriptors ( new_nof_all_descriptors ) ; <nl> class RememberedSetUpdatingItem : public UpdatingItem { <nl> if ( ! filter . IsValid ( slot . address ( ) ) ) return REMOVE_SLOT ; <nl> return CheckAndUpdateOldToNewSlot ( slot ) ; <nl> } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> } <nl> <nl> if ( chunk_ - > sweeping_slot_set < AccessMode : : NON_ATOMIC > ( ) ) { <nl> class RememberedSetUpdatingItem : public UpdatingItem { <nl> if ( ! filter . IsValid ( slot . address ( ) ) ) return REMOVE_SLOT ; <nl> return CheckAndUpdateOldToNewSlot ( slot ) ; <nl> } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> } <nl> <nl> if ( chunk_ - > invalidated_slots < OLD_TO_NEW > ( ) ! = nullptr ) { <nl> class RememberedSetUpdatingItem : public UpdatingItem { <nl> if ( ! filter . IsValid ( slot . address ( ) ) ) return REMOVE_SLOT ; <nl> return UpdateSlot < AccessMode : : NON_ATOMIC > ( slot ) ; <nl> } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> chunk_ - > ReleaseSlotSet < OLD_TO_OLD > ( ) ; <nl> } <nl> if ( ( updating_mode_ = = RememberedSetUpdatingMode : : ALL ) & & <nl> void MarkCompactCollector : : PostProcessEvacuationCandidates ( ) { <nl> / / Remove outdated slots . <nl> RememberedSetSweeping : : RemoveRange ( page , page - > address ( ) , <nl> failed_object . address ( ) , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> RememberedSet < OLD_TO_NEW > : : RemoveRange ( page , page - > address ( ) , <nl> failed_object . address ( ) , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> RememberedSet < OLD_TO_NEW > : : RemoveRangeTyped ( page , page - > address ( ) , <nl> failed_object . address ( ) ) ; <nl> / / Recompute live bytes . <nl> void MinorMarkCompactCollector : : CollectGarbage ( ) { <nl> <nl> RememberedSet < OLD_TO_NEW > : : IterateMemoryChunks ( <nl> heap ( ) , [ ] ( MemoryChunk * chunk ) { <nl> - if ( chunk - > SweepingDone ( ) ) { <nl> - RememberedSet < OLD_TO_NEW > : : FreeEmptyBuckets ( chunk ) ; <nl> - } else { <nl> - RememberedSet < OLD_TO_NEW > : : PreFreeEmptyBuckets ( chunk ) ; <nl> - } <nl> + RememberedSet < OLD_TO_NEW > : : FreeEmptyBuckets ( chunk ) ; <nl> } ) ; <nl> <nl> heap ( ) - > account_external_memory_concurrently_freed ( ) ; <nl> class PageMarkingItem : public MarkingItem { <nl> if ( ! filter . IsValid ( slot . address ( ) ) ) return REMOVE_SLOT ; <nl> return CheckAndMarkObject ( task , slot ) ; <nl> } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> filter = InvalidatedSlotsFilter : : OldToNew ( chunk_ ) ; <nl> RememberedSetSweeping : : Iterate ( <nl> chunk_ , <nl> class PageMarkingItem : public MarkingItem { <nl> if ( ! filter . IsValid ( slot . address ( ) ) ) return REMOVE_SLOT ; <nl> return CheckAndMarkObject ( task , slot ) ; <nl> } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> } <nl> <nl> void MarkTypedPointers ( YoungGenerationMarkingTask * task ) { <nl> mmm a / src / heap / remembered - set . h <nl> ppp b / src / heap / remembered - set . h <nl> class RememberedSet : public AllStatic { <nl> RememberedSetOperations : : Iterate ( slots , chunk , callback , mode ) ; <nl> } <nl> <nl> - static int NumberOfPreFreedEmptyBuckets ( MemoryChunk * chunk ) { <nl> - DCHECK ( type = = OLD_TO_NEW ) ; <nl> - int result = 0 ; <nl> - SlotSet * slots = chunk - > slot_set < type > ( ) ; <nl> - if ( slots ! = nullptr ) { <nl> - size_t pages = ( chunk - > size ( ) + Page : : kPageSize - 1 ) / Page : : kPageSize ; <nl> - for ( size_t page = 0 ; page < pages ; page + + ) { <nl> - result + = slots [ page ] . NumberOfPreFreedEmptyBuckets ( ) ; <nl> - } <nl> - } <nl> - return result ; <nl> - } <nl> - <nl> - static void PreFreeEmptyBuckets ( MemoryChunk * chunk ) { <nl> - DCHECK ( type = = OLD_TO_NEW ) ; <nl> - SlotSet * slots = chunk - > slot_set < type > ( ) ; <nl> - if ( slots ! = nullptr ) { <nl> - size_t pages = ( chunk - > size ( ) + Page : : kPageSize - 1 ) / Page : : kPageSize ; <nl> - for ( size_t page = 0 ; page < pages ; page + + ) { <nl> - slots [ page ] . PreFreeEmptyBuckets ( ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> static void FreeEmptyBuckets ( MemoryChunk * chunk ) { <nl> DCHECK ( type = = OLD_TO_NEW ) ; <nl> SlotSet * slots = chunk - > slot_set < type > ( ) ; <nl> class RememberedSet : public AllStatic { <nl> size_t pages = ( chunk - > size ( ) + Page : : kPageSize - 1 ) / Page : : kPageSize ; <nl> for ( size_t page = 0 ; page < pages ; page + + ) { <nl> slots [ page ] . FreeEmptyBuckets ( ) ; <nl> - slots [ page ] . FreeToBeFreedBuckets ( ) ; <nl> } <nl> } <nl> } <nl> mmm a / src / heap / scavenger . cc <nl> ppp b / src / heap / scavenger . cc <nl> void ScavengerCollector : : CollectGarbage ( ) { <nl> heap_ - > new_lo_space ( ) - > FreeDeadObjects ( [ ] ( HeapObject ) { return true ; } ) ; <nl> <nl> RememberedSet < OLD_TO_NEW > : : IterateMemoryChunks ( heap_ , [ ] ( MemoryChunk * chunk ) { <nl> - if ( chunk - > SweepingDone ( ) ) { <nl> - RememberedSet < OLD_TO_NEW > : : FreeEmptyBuckets ( chunk ) ; <nl> - } else { <nl> - RememberedSet < OLD_TO_NEW > : : PreFreeEmptyBuckets ( chunk ) ; <nl> - } <nl> + RememberedSet < OLD_TO_NEW > : : FreeEmptyBuckets ( chunk ) ; <nl> } ) ; <nl> <nl> / / Update how much has survived scavenge . <nl> mmm a / src / heap / slot - set . h <nl> ppp b / src / heap / slot - set . h <nl> class SlotSet : public Malloced { <nl> public : <nl> enum EmptyBucketMode { <nl> FREE_EMPTY_BUCKETS , / / An empty bucket will be deallocated immediately . <nl> - PREFREE_EMPTY_BUCKETS , / / An empty bucket will be unlinked from the slot <nl> - / / set , but deallocated on demand by a sweeper <nl> - / / thread . <nl> KEEP_EMPTY_BUCKETS / / An empty bucket will be kept . <nl> } ; <nl> <nl> class SlotSet : public Malloced { <nl> for ( int i = 0 ; i < kBuckets ; i + + ) { <nl> ReleaseBucket ( i ) ; <nl> } <nl> - FreeToBeFreedBuckets ( ) ; <nl> } <nl> <nl> / / The slot offset specifies a slot at address page_start_ + slot_offset . <nl> class SlotSet : public Malloced { <nl> DCHECK ( current_bucket = = end_bucket | | <nl> ( current_bucket < end_bucket & & current_cell = = 0 ) ) ; <nl> while ( current_bucket < end_bucket ) { <nl> - if ( mode = = PREFREE_EMPTY_BUCKETS ) { <nl> - PreFreeEmptyBucket ( current_bucket ) ; <nl> - } else if ( mode = = FREE_EMPTY_BUCKETS ) { <nl> + if ( mode = = FREE_EMPTY_BUCKETS ) { <nl> ReleaseBucket ( current_bucket ) ; <nl> } else { <nl> DCHECK ( mode = = KEEP_EMPTY_BUCKETS ) ; <nl> class SlotSet : public Malloced { <nl> current_bucket + + ; <nl> } <nl> / / All buckets between start_bucket and end_bucket are cleared . <nl> + DCHECK ( current_bucket = = end_bucket ) ; <nl> + if ( current_bucket = = kBuckets ) return ; <nl> bucket = LoadBucket ( & buckets_ [ current_bucket ] ) ; <nl> - DCHECK ( current_bucket = = end_bucket & & current_cell < = end_cell ) ; <nl> - if ( current_bucket = = kBuckets | | bucket = = nullptr ) { <nl> - return ; <nl> - } <nl> + DCHECK ( current_cell < = end_cell ) ; <nl> + if ( bucket = = nullptr ) return ; <nl> while ( current_cell < end_cell ) { <nl> StoreCell ( & bucket [ current_cell ] , 0 ) ; <nl> current_cell + + ; <nl> class SlotSet : public Malloced { <nl> } <nl> } <nl> } <nl> - if ( mode = = PREFREE_EMPTY_BUCKETS & & in_bucket_count = = 0 ) { <nl> - PreFreeEmptyBucket ( bucket_index ) ; <nl> - } <nl> new_count + = in_bucket_count ; <nl> } <nl> } <nl> return new_count ; <nl> } <nl> <nl> - int NumberOfPreFreedEmptyBuckets ( ) { <nl> - base : : MutexGuard guard ( & to_be_freed_buckets_mutex_ ) ; <nl> - return static_cast < int > ( to_be_freed_buckets_ . size ( ) ) ; <nl> - } <nl> - <nl> - void PreFreeEmptyBuckets ( ) { <nl> - for ( int bucket_index = 0 ; bucket_index < kBuckets ; bucket_index + + ) { <nl> - Bucket bucket = LoadBucket ( & buckets_ [ bucket_index ] ) ; <nl> - if ( bucket ! = nullptr ) { <nl> - if ( IsEmptyBucket ( bucket ) ) { <nl> - PreFreeEmptyBucket ( bucket_index ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> void FreeEmptyBuckets ( ) { <nl> for ( int bucket_index = 0 ; bucket_index < kBuckets ; bucket_index + + ) { <nl> Bucket bucket = LoadBucket ( & buckets_ [ bucket_index ] ) ; <nl> class SlotSet : public Malloced { <nl> } <nl> } <nl> <nl> - void FreeToBeFreedBuckets ( ) { <nl> - base : : MutexGuard guard ( & to_be_freed_buckets_mutex_ ) ; <nl> - while ( ! to_be_freed_buckets_ . empty ( ) ) { <nl> - Bucket top = to_be_freed_buckets_ . top ( ) ; <nl> - to_be_freed_buckets_ . pop ( ) ; <nl> - DeleteArray < uint32_t > ( top ) ; <nl> - } <nl> - DCHECK_EQ ( 0u , to_be_freed_buckets_ . size ( ) ) ; <nl> - } <nl> - <nl> private : <nl> using Bucket = uint32_t * ; <nl> static const int kMaxSlots = ( 1 < < kPageSizeBits ) / kTaggedSize ; <nl> class SlotSet : public Malloced { <nl> } <nl> } <nl> <nl> - void PreFreeEmptyBucket ( int bucket_index ) { <nl> - Bucket bucket = LoadBucket ( & buckets_ [ bucket_index ] ) ; <nl> - if ( bucket ! = nullptr ) { <nl> - base : : MutexGuard guard ( & to_be_freed_buckets_mutex_ ) ; <nl> - to_be_freed_buckets_ . push ( bucket ) ; <nl> - StoreBucket ( & buckets_ [ bucket_index ] , nullptr ) ; <nl> - } <nl> - } <nl> - <nl> void ReleaseBucket ( int bucket_index ) { <nl> Bucket bucket = LoadBucket ( & buckets_ [ bucket_index ] ) ; <nl> StoreBucket ( & buckets_ [ bucket_index ] , nullptr ) ; <nl> class SlotSet : public Malloced { <nl> } <nl> <nl> Bucket buckets_ [ kBuckets ] ; <nl> - base : : Mutex to_be_freed_buckets_mutex_ ; <nl> - std : : stack < uint32_t * > to_be_freed_buckets_ ; <nl> } ; <nl> <nl> enum SlotType { <nl> mmm a / src / heap / sweeper . cc <nl> ppp b / src / heap / sweeper . cc <nl> int Sweeper : : ParallelSweepPage ( <nl> if ( typed_slot_set ) { <nl> typed_slot_set - > FreeToBeFreedChunks ( ) ; <nl> } <nl> - SlotSet * slot_set = page - > slot_set < OLD_TO_NEW > ( ) ; <nl> - if ( slot_set ) { <nl> - slot_set - > FreeToBeFreedBuckets ( ) ; <nl> - } <nl> } <nl> <nl> { <nl> mmm a / test / cctest / heap / test - heap . cc <nl> ppp b / test / cctest / heap / test - heap . cc <nl> TEST ( RememberedSetRemoveRange ) { <nl> RememberedSet < OLD_TO_NEW > : : Insert < AccessMode : : ATOMIC > ( chunk , x . first ) ; <nl> } <nl> <nl> - RememberedSet < OLD_TO_NEW > : : Iterate ( chunk , <nl> - [ & slots ] ( MaybeObjectSlot slot ) { <nl> - CHECK ( slots [ slot . address ( ) ] ) ; <nl> - return KEEP_SLOT ; <nl> - } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + RememberedSet < OLD_TO_NEW > : : Iterate ( <nl> + chunk , <nl> + [ & slots ] ( MaybeObjectSlot slot ) { <nl> + CHECK ( slots [ slot . address ( ) ] ) ; <nl> + return KEEP_SLOT ; <nl> + } , <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> <nl> RememberedSet < OLD_TO_NEW > : : RemoveRange ( chunk , start , start + kTaggedSize , <nl> SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> slots [ start ] = false ; <nl> - RememberedSet < OLD_TO_NEW > : : Iterate ( chunk , <nl> - [ & slots ] ( MaybeObjectSlot slot ) { <nl> - CHECK ( slots [ slot . address ( ) ] ) ; <nl> - return KEEP_SLOT ; <nl> - } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + RememberedSet < OLD_TO_NEW > : : Iterate ( <nl> + chunk , <nl> + [ & slots ] ( MaybeObjectSlot slot ) { <nl> + CHECK ( slots [ slot . address ( ) ] ) ; <nl> + return KEEP_SLOT ; <nl> + } , <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> <nl> RememberedSet < OLD_TO_NEW > : : RemoveRange ( chunk , start + kTaggedSize , <nl> start + Page : : kPageSize , <nl> SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> slots [ start + kTaggedSize ] = false ; <nl> slots [ start + Page : : kPageSize - kTaggedSize ] = false ; <nl> - RememberedSet < OLD_TO_NEW > : : Iterate ( chunk , <nl> - [ & slots ] ( MaybeObjectSlot slot ) { <nl> - CHECK ( slots [ slot . address ( ) ] ) ; <nl> - return KEEP_SLOT ; <nl> - } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + RememberedSet < OLD_TO_NEW > : : Iterate ( <nl> + chunk , <nl> + [ & slots ] ( MaybeObjectSlot slot ) { <nl> + CHECK ( slots [ slot . address ( ) ] ) ; <nl> + return KEEP_SLOT ; <nl> + } , <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> <nl> RememberedSet < OLD_TO_NEW > : : RemoveRange ( chunk , start , <nl> start + Page : : kPageSize + kTaggedSize , <nl> SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> slots [ start + Page : : kPageSize ] = false ; <nl> - RememberedSet < OLD_TO_NEW > : : Iterate ( chunk , <nl> - [ & slots ] ( MaybeObjectSlot slot ) { <nl> - CHECK ( slots [ slot . address ( ) ] ) ; <nl> - return KEEP_SLOT ; <nl> - } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + RememberedSet < OLD_TO_NEW > : : Iterate ( <nl> + chunk , <nl> + [ & slots ] ( MaybeObjectSlot slot ) { <nl> + CHECK ( slots [ slot . address ( ) ] ) ; <nl> + return KEEP_SLOT ; <nl> + } , <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> <nl> RememberedSet < OLD_TO_NEW > : : RemoveRange ( chunk , chunk - > area_end ( ) - kTaggedSize , <nl> chunk - > area_end ( ) , <nl> SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> slots [ chunk - > area_end ( ) - kTaggedSize ] = false ; <nl> - RememberedSet < OLD_TO_NEW > : : Iterate ( chunk , <nl> - [ & slots ] ( MaybeObjectSlot slot ) { <nl> - CHECK ( slots [ slot . address ( ) ] ) ; <nl> - return KEEP_SLOT ; <nl> - } , <nl> - SlotSet : : PREFREE_EMPTY_BUCKETS ) ; <nl> + RememberedSet < OLD_TO_NEW > : : Iterate ( <nl> + chunk , <nl> + [ & slots ] ( MaybeObjectSlot slot ) { <nl> + CHECK ( slots [ slot . address ( ) ] ) ; <nl> + return KEEP_SLOT ; <nl> + } , <nl> + SlotSet : : FREE_EMPTY_BUCKETS ) ; <nl> } <nl> <nl> HEAP_TEST ( Regress670675 ) { <nl> HEAP_TEST ( Regress5831 ) { <nl> CHECK ( chunk - > NeverEvacuate ( ) ) ; <nl> } <nl> <nl> - TEST ( Regress6800 ) { <nl> - CcTest : : InitializeVM ( ) ; <nl> - Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> - HandleScope handle_scope ( isolate ) ; <nl> - <nl> - const int kRootLength = 1000 ; <nl> - Handle < FixedArray > root = <nl> - isolate - > factory ( ) - > NewFixedArray ( kRootLength , AllocationType : : kOld ) ; <nl> - { <nl> - HandleScope inner_scope ( isolate ) ; <nl> - Handle < FixedArray > new_space_array = isolate - > factory ( ) - > NewFixedArray ( 1 ) ; <nl> - for ( int i = 0 ; i < kRootLength ; i + + ) { <nl> - root - > set ( i , * new_space_array ) ; <nl> - } <nl> - for ( int i = 0 ; i < kRootLength ; i + + ) { <nl> - root - > set ( i , ReadOnlyRoots ( CcTest : : heap ( ) ) . undefined_value ( ) ) ; <nl> - } <nl> - } <nl> - CcTest : : CollectGarbage ( NEW_SPACE ) ; <nl> - CHECK_EQ ( 0 , RememberedSet < OLD_TO_NEW > : : NumberOfPreFreedEmptyBuckets ( <nl> - MemoryChunk : : FromHeapObject ( * root ) ) ) ; <nl> - } <nl> - <nl> - TEST ( Regress6800LargeObject ) { <nl> - CcTest : : InitializeVM ( ) ; <nl> - Isolate * isolate = CcTest : : i_isolate ( ) ; <nl> - HandleScope handle_scope ( isolate ) ; <nl> - <nl> - const int kRootLength = i : : kMaxRegularHeapObjectSize / kTaggedSize ; <nl> - Handle < FixedArray > root = <nl> - isolate - > factory ( ) - > NewFixedArray ( kRootLength , AllocationType : : kOld ) ; <nl> - CcTest : : heap ( ) - > lo_space ( ) - > Contains ( * root ) ; <nl> - { <nl> - HandleScope inner_scope ( isolate ) ; <nl> - Handle < FixedArray > new_space_array = isolate - > factory ( ) - > NewFixedArray ( 1 ) ; <nl> - for ( int i = 0 ; i < kRootLength ; i + + ) { <nl> - root - > set ( i , * new_space_array ) ; <nl> - } <nl> - for ( int i = 0 ; i < kRootLength ; i + + ) { <nl> - root - > set ( i , ReadOnlyRoots ( CcTest : : heap ( ) ) . undefined_value ( ) ) ; <nl> - } <nl> - } <nl> - CcTest : : CollectGarbage ( OLD_SPACE ) ; <nl> - CHECK_EQ ( 0 , RememberedSet < OLD_TO_NEW > : : NumberOfPreFreedEmptyBuckets ( <nl> - MemoryChunk : : FromHeapObject ( * root ) ) ) ; <nl> - } <nl> - <nl> HEAP_TEST ( RegressMissingWriteBarrierInAllocate ) { <nl> if ( ! FLAG_incremental_marking ) return ; <nl> ManualGCScope manual_gc_scope ; <nl>
|
[ heap ] Remove pre - freeing of SlotSet buckets
|
v8/v8
|
3aeadaac2277ffdd4761c2cbefb6e5d80fa09984
|
2019-10-04T15:14:45Z
|
mmm a / xbmc / VideoInfoTag . cpp <nl> ppp b / xbmc / VideoInfoTag . cpp <nl> <nl> # include " VideoInfoTag . h " <nl> # include " XMLUtils . h " <nl> # include " LocalizeStrings . h " <nl> + # include " GUISettings . h " <nl> # include " AdvancedSettings . h " <nl> # include " utils / log . h " <nl> # include " utils / CharsetConverter . h " <nl> void CVideoInfoTag : : ParseMyMovies ( const TiXmlElement * movie ) <nl> <nl> bool CVideoInfoTag : : HasStreamDetails ( ) const <nl> { <nl> - return m_streamDetails . HasItems ( ) ; <nl> + / / return false in case no duration was extracted yet <nl> + if ( g_guiSettings . GetBool ( " myvideos . extractflags " ) & & <nl> + m_streamDetails . GetVideoDuration ( ) < = 0 ) <nl> + return false ; <nl> + else <nl> + return m_streamDetails . HasItems ( ) ; <nl> } <nl> <nl> bool CVideoInfoTag : : IsEmpty ( ) const <nl> mmm a / xbmc / utils / GUIInfoManager . cpp <nl> ppp b / xbmc / utils / GUIInfoManager . cpp <nl> CStdString CGUIInfoManager : : GetItemLabel ( const CFileItem * item , int info ) const <nl> { <nl> if ( item - > GetVideoInfoTag ( ) - > m_streamDetails . GetVideoDuration ( ) > 0 ) <nl> duration . Format ( " % i " , item - > GetVideoInfoTag ( ) - > m_streamDetails . GetVideoDuration ( ) ) ; <nl> - else <nl> + else if ( ! item - > GetVideoInfoTag ( ) - > m_strRuntime . IsEmpty ( ) ) <nl> duration = item - > GetVideoInfoTag ( ) - > m_strRuntime ; <nl> } <nl> <nl> mmm a / xbmc / utils / LabelFormatter . cpp <nl> ppp b / xbmc / utils / LabelFormatter . cpp <nl> CStdString CLabelFormatter : : GetMaskContent ( const CMaskString & mask , const CFileI <nl> { <nl> if ( movie - > m_streamDetails . GetVideoDuration ( ) > 0 ) <nl> nDuration = movie - > m_streamDetails . GetVideoDuration ( ) ; <nl> - else <nl> + else if ( ! movie - > m_strRuntime . IsEmpty ( ) ) <nl> nDuration = StringUtils : : TimeStringToSeconds ( movie - > m_strRuntime ) ; <nl> } <nl> if ( nDuration > 0 ) <nl>
|
fixed : do not use empty strings as duration basis and make sure we extract duration if it ' s missing
|
xbmc/xbmc
|
664e940475a6fce07811f86da4db3db7905eb0eb
|
2010-06-05T10:43:15Z
|
mmm a / Marlin / Marlin . pde <nl> ppp b / Marlin / Marlin . pde <nl> FORCE_INLINE void process_commands ( ) <nl> # ifdef QUICK_HOME <nl> if ( code_seen ( axis_codes [ 0 ] ) & & code_seen ( axis_codes [ 1 ] ) ) / / first diagonal move <nl> { <nl> - current_position [ X_AXIS ] = 0 ; current_position [ Y_AXIS ] = 0 ; <nl> + current_position [ X_AXIS ] = 0 ; current_position [ Y_AXIS ] = 0 ; <nl> plan_set_position ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] ) ; <nl> - destination [ X_AXIS ] = 1 . 5 * X_MAX_LENGTH * X_HOME_DIR ; <nl> - destination [ Y_AXIS ] = 1 . 5 * Y_MAX_LENGTH * Y_HOME_DIR ; <nl> - feedrate = homing_feedrate [ X_AXIS ] ; <nl> + destination [ X_AXIS ] = 1 . 5 * X_MAX_LENGTH * X_HOME_DIR ; destination [ Y_AXIS ] = 1 . 5 * Y_MAX_LENGTH * Y_HOME_DIR ; <nl> + feedrate = homing_feedrate [ X_AXIS ] ; <nl> if ( homing_feedrate [ Y_AXIS ] < feedrate ) <nl> feedrate = homing_feedrate [ Y_AXIS ] ; <nl> - prepare_move ( ) ; <nl> - current_position [ X_AXIS ] = 0 ; current_position [ Y_AXIS ] = 0 ; <nl> + prepare_move ( ) ; <nl> + <nl> + current_position [ X_AXIS ] = ( X_HOME_DIR = = - 1 ) ? 0 : X_MAX_LENGTH ; <nl> + current_position [ Y_AXIS ] = ( Y_HOME_DIR = = - 1 ) ? 0 : Y_MAX_LENGTH ; <nl> + plan_set_position ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] ) ; <nl> + destination [ X_AXIS ] = current_position [ X_AXIS ] ; <nl> + destination [ Y_AXIS ] = current_position [ Y_AXIS ] ; <nl> + feedrate = 0 . 0 ; <nl> + st_synchronize ( ) ; <nl> + plan_set_position ( 0 , 0 , current_position [ Z_AXIS ] , current_position [ E_AXIS ] ) ; <nl> + current_position [ X_AXIS ] = 0 ; current_position [ Y_AXIS ] = 0 ; <nl> + endstops_hit_on_purpose ( ) ; <nl> } <nl> # endif <nl> <nl> if ( ( home_all_axis ) | | ( code_seen ( axis_codes [ X_AXIS ] ) ) ) <nl> { <nl> HOMEAXIS ( X ) ; <nl> - current_position [ 0 ] = code_value ( ) + add_homeing [ 0 ] ; <nl> } <nl> <nl> if ( ( home_all_axis ) | | ( code_seen ( axis_codes [ Y_AXIS ] ) ) ) { <nl> HOMEAXIS ( Y ) ; <nl> - current_position [ 1 ] = code_value ( ) + add_homeing [ 1 ] ; <nl> } <nl> <nl> if ( ( home_all_axis ) | | ( code_seen ( axis_codes [ Z_AXIS ] ) ) ) { <nl> HOMEAXIS ( Z ) ; <nl> - current_position [ 2 ] = code_value ( ) + add_homeing [ 2 ] ; <nl> - } <nl> + } <nl> + <nl> + if ( code_seen ( axis_codes [ X_AXIS ] ) ) <nl> + { <nl> + current_position [ 0 ] = code_value ( ) + add_homeing [ 0 ] ; <nl> + } <nl> + <nl> + if ( code_seen ( axis_codes [ Y_AXIS ] ) ) { <nl> + current_position [ 1 ] = code_value ( ) + add_homeing [ 1 ] ; <nl> + } <nl> + <nl> + if ( code_seen ( axis_codes [ Z_AXIS ] ) ) { <nl> + current_position [ 2 ] = code_value ( ) + add_homeing [ 2 ] ; <nl> + } <nl> # ifdef ENDSTOPS_ONLY_FOR_HOMING <nl> enable_endstops ( false ) ; <nl> # endif <nl>
|
repaired homing position setting .
|
MarlinFirmware/Marlin
|
460b788d78c81a63cf49e910a65bcc306ce94c55
|
2011-12-07T19:54:34Z
|
mmm a / lib / Parse / ParseDecl . cpp <nl> ppp b / lib / Parse / ParseDecl . cpp <nl> ParserResult < UnionElementDecl > Parser : : parseDeclUnionElement ( unsigned Flags ) { <nl> <nl> Identifier Name ; <nl> SourceLoc NameLoc ; <nl> - / / For recovery , see if the user typed something resembling a switch " case " <nl> - / / label . <nl> - if ( ! Tok . is ( tok : : identifier ) ) { <nl> - ParserResult < Pattern > pattern = parseMatchingPattern ( ) ; <nl> - if ( pattern . isNull ( ) ) <nl> + <nl> + const bool NameIsNotIdentifier = Tok . isNot ( tok : : identifier ) ; <nl> + if ( parseIdentifierDeclName ( * this , Name , NameLoc , tok : : l_paren , <nl> + tok : : kw_case , tok : : colon , <nl> + diag : : invalid_diagnostic ) . isError ( ) ) { <nl> + / / For recovery , see if the user typed something resembling a switch " case " <nl> + / / label . <nl> + parseMatchingPattern ( ) ; <nl> + } <nl> + if ( NameIsNotIdentifier ) { <nl> + if ( consumeIf ( tok : : colon ) ) { <nl> + diagnose ( CaseLoc , diag : : case_outside_of_switch , " case " ) ; <nl> return nullptr ; <nl> - diagnose ( CaseLoc , diag : : case_outside_of_switch , " case " ) ; <nl> - skipUntil ( tok : : colon ) ; <nl> - consumeIf ( tok : : colon ) ; <nl> - return nullptr ; <nl> + } <nl> + diagnose ( CaseLoc , diag : : expected_identifier_in_decl , " union case " ) ; <nl> } <nl> <nl> - if ( parseIdentifier ( Name , NameLoc , <nl> - diag : : expected_identifier_in_decl , " union case " ) ) <nl> - return nullptr ; <nl> - <nl> / / See if there ' s a following argument type . <nl> ParserResult < TypeRepr > ArgType ; <nl> if ( Tok . isFollowingLParen ( ) ) { <nl>
|
Parser : fix recovery for ' case ' with a keyword as a union element name
|
apple/swift
|
27f2279a9b7eb1a8df3a81075208bda95e3a711f
|
2013-09-03T19:27:29Z
|
mmm a / src / core / lib / gpr / spinlock . h <nl> ppp b / src / core / lib / gpr / spinlock . h <nl> <nl> <nl> # include < grpc / support / atm . h > <nl> <nl> - / * Simple spinlock . No backoff strategy , gpr_spinlock_lock is almost always <nl> - a concurrency code smell . * / <nl> + / / Simple spinlock . No backoff strategy , gpr_spinlock_lock is almost always <nl> + / / a concurrency code smell . Code must _never_ block while holding a spinlock <nl> + / / as this could lead to a deadlock under a cooperative multithreading model . <nl> struct gpr_spinlock { <nl> gpr_atm atm ; <nl> } ; <nl>
|
Merge pull request from grpc / vjpai - patch - 3
|
grpc/grpc
|
5ab59b2bf7df73bd59c46c5d5d10dbc31d4d7ca9
|
2020-12-03T07:32:57Z
|
mmm a / src / core / ext / transport / chttp2 / transport / chttp2_transport . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / chttp2_transport . c <nl> static void perform_transport_op ( grpc_exec_ctx * exec_ctx , grpc_transport * gt , <nl> * INPUT PROCESSING - GENERAL <nl> * / <nl> <nl> + static void run_closure_and_null ( grpc_exec_ctx * exec_ctx , grpc_closure * * closure , grpc_error * error ) { <nl> + grpc_closure * c = * closure ; <nl> + * closure = NULL ; <nl> + grpc_closure_run ( exec_ctx , c , error ) ; <nl> + } <nl> + <nl> void grpc_chttp2_maybe_complete_recv_initial_metadata ( grpc_exec_ctx * exec_ctx , <nl> grpc_chttp2_transport * t , <nl> grpc_chttp2_stream * s ) { <nl> void grpc_chttp2_maybe_complete_recv_initial_metadata ( grpc_exec_ctx * exec_ctx , <nl> } <nl> grpc_chttp2_incoming_metadata_buffer_publish ( & s - > metadata_buffer [ 0 ] , <nl> s - > recv_initial_metadata ) ; <nl> - grpc_closure_run ( exec_ctx , s - > recv_initial_metadata_ready , GRPC_ERROR_NONE ) ; <nl> - s - > recv_initial_metadata_ready = NULL ; <nl> + run_closure_and_null ( exec_ctx , & s - > recv_initial_metadata_ready , GRPC_ERROR_NONE ) ; <nl> } <nl> } <nl> <nl> void grpc_chttp2_maybe_complete_recv_message ( grpc_exec_ctx * exec_ctx , <nl> * s - > recv_message = <nl> grpc_chttp2_incoming_frame_queue_pop ( & s - > incoming_frames ) ; <nl> GPR_ASSERT ( * s - > recv_message ! = NULL ) ; <nl> - grpc_closure_run ( exec_ctx , s - > recv_message_ready , GRPC_ERROR_NONE ) ; <nl> - s - > recv_message_ready = NULL ; <nl> + run_closure_and_null ( exec_ctx , & s - > recv_message_ready , GRPC_ERROR_NONE ) ; <nl> } else if ( s - > published_metadata [ 1 ] ) { <nl> * s - > recv_message = NULL ; <nl> - grpc_closure_run ( exec_ctx , s - > recv_message_ready , GRPC_ERROR_NONE ) ; <nl> - s - > recv_message_ready = NULL ; <nl> + run_closure_and_null ( exec_ctx , & s - > recv_message_ready , GRPC_ERROR_NONE ) ; <nl> } <nl> } <nl> } <nl> mmm a / src / core / lib / surface / call . c <nl> ppp b / src / core / lib / surface / call . c <nl> static void post_batch_completion ( grpc_exec_ctx * exec_ctx , <nl> grpc_call * call = bctl - > call ; <nl> if ( bctl - > is_notify_tag_closure ) { <nl> / * unrefs bctl - > error * / <nl> - grpc_exec_ctx_sched ( exec_ctx , bctl - > notify_tag , bctl - > error , NULL ) ; <nl> + grpc_closure_run ( exec_ctx , bctl - > notify_tag , bctl - > error ) ; <nl> gpr_mu_lock ( & call - > mu ) ; <nl> bctl - > call - > used_batches = <nl> ( uint8_t ) ( bctl - > call - > used_batches & <nl> static void validate_filtered_metadata ( grpc_exec_ctx * exec_ctx , <nl> } <nl> } <nl> <nl> + static void add_batch_error ( batch_control * bctl , grpc_error * error ) { <nl> + if ( error = = GRPC_ERROR_NONE ) return ; <nl> + if ( bctl - > error = = GRPC_ERROR_NONE ) { <nl> + bctl - > error = GRPC_ERROR_CREATE ( " Call batch operation failed " ) ; <nl> + } <nl> + bctl - > error = grpc_error_add_child ( bctl - > error , error ) ; <nl> + } <nl> + <nl> static void receiving_initial_metadata_ready ( grpc_exec_ctx * exec_ctx , <nl> void * bctlp , grpc_error * error ) { <nl> batch_control * bctl = bctlp ; <nl> static void receiving_initial_metadata_ready ( grpc_exec_ctx * exec_ctx , <nl> <nl> gpr_mu_lock ( & call - > mu ) ; <nl> <nl> - if ( error ! = GRPC_ERROR_NONE ) { <nl> - bctl - > error = GRPC_ERROR_REF ( error ) ; <nl> - } else { <nl> + add_batch_error ( bctl , GRPC_ERROR_REF ( error ) ) ; <nl> + if ( error = = GRPC_ERROR_NONE ) { <nl> grpc_metadata_batch * md = <nl> & call - > metadata_batch [ 1 / * is_receiving * / ] [ 0 / * is_trailing * / ] ; <nl> grpc_metadata_batch_filter ( md , recv_initial_filter , call ) ; <nl> static void finish_batch ( grpc_exec_ctx * exec_ctx , void * bctlp , <nl> GRPC_ERROR_UNREF ( error ) ; <nl> error = GRPC_ERROR_NONE ; <nl> } <nl> - GRPC_ERROR_UNREF ( bctl - > error ) ; <nl> - bctl - > error = GRPC_ERROR_REF ( error ) ; <nl> + add_batch_error ( bctl , GRPC_ERROR_REF ( error ) ) ; <nl> gpr_mu_unlock ( & call - > mu ) ; <nl> if ( gpr_unref ( & bctl - > steps_to_complete ) ) { <nl> post_batch_completion ( exec_ctx , bctl ) ; <nl>
|
Fix some tests
|
grpc/grpc
|
452422e09ffd40dda56d672bd4a23cb8efdb4b31
|
2016-09-01T22:54:56Z
|
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2010 - 10 - 09 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> + <nl> + Added tests to HttpRequestTest about trailing slash of cookie <nl> + path . <nl> + * test / HttpRequestTest . cc <nl> + <nl> 2010 - 10 - 09 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> <nl> Don ' t append slash in CookieStorage : : criteriaFind ( ) . Append file <nl> mmm a / test / HttpRequestTest . cc <nl> ppp b / test / HttpRequestTest . cc <nl> void HttpRequestTest : : testCreateRequest_with_cookie ( ) <nl> ( new PiecedSegment ( 1024 * 1024 , p ) ) ; <nl> SharedHandle < FileEntry > fileEntry ( new FileEntry ( " file " , 1024 * 1024 * 10 , 0 ) ) ; <nl> <nl> - Cookie cookie1 ( createCookie ( " name1 " , " value1 " , " localhost " , true , <nl> - " / archives " , false ) ) ; <nl> - Cookie cookie2 ( createCookie ( " name2 " , " value2 " , " localhost " , true , <nl> - " / archives / download " , false ) ) ; <nl> - Cookie cookie3 ( createCookie ( " name3 " , " value3 " , " aria2 . org " , false , <nl> - " / archives / download " , false ) ) ; <nl> - Cookie cookie4 ( createCookie ( " name4 " , " value4 " , " aria2 . org " , false , <nl> - " / archives / " , true ) ) ; <nl> - <nl> - time_t now = time ( 0 ) ; <nl> + Cookie cookies [ ] = { <nl> + createCookie ( " name1 " , " value1 " , " localhost " , true , " / archives " , false ) , <nl> + createCookie ( " name2 " , " value2 " , " localhost " , true , <nl> + " / archives / download " , false ) , <nl> + createCookie ( " name3 " , " value3 " , " aria2 . org " , false , <nl> + " / archives / download " , false ) , <nl> + createCookie ( " name4 " , " value4 " , " aria2 . org " , false , " / archives / " , true ) , <nl> + createCookie ( " name5 " , " value5 " , " example . org " , false , " / " , false ) <nl> + } ; <nl> SharedHandle < CookieStorage > st ( new CookieStorage ( ) ) ; <nl> - CPPUNIT_ASSERT ( st - > store ( cookie1 , now ) ) ; <nl> - CPPUNIT_ASSERT ( st - > store ( cookie2 , now ) ) ; <nl> - CPPUNIT_ASSERT ( st - > store ( cookie3 , now ) ) ; <nl> - CPPUNIT_ASSERT ( st - > store ( cookie4 , now ) ) ; <nl> + for ( size_t i = 0 ; i < A2_ARRAY_LEN ( cookies ) ; + + i ) { <nl> + CPPUNIT_ASSERT ( st - > store ( cookies [ i ] , 0 ) ) ; <nl> + } <nl> <nl> HttpRequest httpRequest ; <nl> <nl> void HttpRequestTest : : testCreateRequest_with_cookie ( ) <nl> " \ r \ n " ; <nl> <nl> CPPUNIT_ASSERT_EQUAL ( expectedText , httpRequest . createRequest ( ) ) ; <nl> - <nl> + <nl> + / / The path of cookie4 ends with ' / ' <nl> + request - > setUri ( " https : / / www . aria2 . org / archives / aria2 - 1 . 0 . 0 . tar . bz2 " ) ; <nl> + <nl> + expectedText = " GET / archives / aria2 - 1 . 0 . 0 . tar . bz2 HTTP / 1 . 1 \ r \ n " <nl> + " User - Agent : aria2 \ r \ n " <nl> + " Accept : * / * \ r \ n " <nl> + " Host : www . aria2 . org \ r \ n " <nl> + " Pragma : no - cache \ r \ n " <nl> + " Cache - Control : no - cache \ r \ n " <nl> + " Connection : close \ r \ n " <nl> + " Cookie : name4 = value4 ; \ r \ n " <nl> + " \ r \ n " ; <nl> + <nl> + CPPUNIT_ASSERT_EQUAL ( expectedText , httpRequest . createRequest ( ) ) ; <nl> + <nl> + request - > setUri ( " http : / / example . org / aria2 - 1 . 0 . 0 . tar . bz2 " ) ; <nl> + <nl> + expectedText = " GET / aria2 - 1 . 0 . 0 . tar . bz2 HTTP / 1 . 1 \ r \ n " <nl> + " User - Agent : aria2 \ r \ n " <nl> + " Accept : * / * \ r \ n " <nl> + " Host : example . org \ r \ n " <nl> + " Pragma : no - cache \ r \ n " <nl> + " Cache - Control : no - cache \ r \ n " <nl> + " Connection : close \ r \ n " <nl> + " Cookie : name5 = value5 ; \ r \ n " <nl> + " \ r \ n " ; <nl> + <nl> + CPPUNIT_ASSERT_EQUAL ( expectedText , httpRequest . createRequest ( ) ) ; <nl> } <nl> <nl> void HttpRequestTest : : testCreateRequest_query ( ) <nl>
|
2010 - 10 - 09 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net >
|
aria2/aria2
|
f816434d06c6bc66b2421d29c8d2ffecd04868ba
|
2010-10-09T14:52:41Z
|
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> include ( " $ { SWIFT_API_NOTES_PATH } / CMakeLists . txt " ) <nl> if ( NOT DEFINED SWIFT_API_NOTES_INPUTS ) <nl> message ( FATAL_ERROR " API notes are not available in $ { SWIFT_API_NOTES_PATH } " ) <nl> endif ( ) <nl> - # <nl> - # file ( GLOB SWIFT_API_NOTES_INPUT_FILES " $ { SWIFT_API_NOTES_PATH } / * . apinotes " ) <nl> - # foreach ( file $ { SWIFT_API_NOTES_INPUT_FILES } ) <nl> - # get_filename_component ( name " $ { file } " NAME_WE ) <nl> - # list ( APPEND SWIFT_API_NOTES_INPUTS $ { name } ) <nl> - # endforeach ( ) <nl> <nl> # Add all of the subdirectories , where we actually do work . <nl> if ( SWIFT_BUILD_TOOLS ) <nl>
|
[ CMake ] Remove commented - out code . NFC .
|
apple/swift
|
9ed382f4a22fb890414bf6a2c38761fef5223319
|
2016-05-31T22:33:26Z
|
mmm a / tensorflow / core / ops / array_ops . cc <nl> ppp b / tensorflow / core / ops / array_ops . cc <nl> Computes the inverse permutation of a tensor . <nl> <nl> This operation computes the inverse of an index permutation . It takes a 1 - D <nl> integer tensor ` x ` , which represents the indices of a zero - based array , and <nl> - swaps each value with its index position . In other words , for an ouput tensor <nl> + swaps each value with its index position . In other words , for an output tensor <nl> ` y ` and an input tensor ` x ` , this operation computes the following : <nl> <nl> ` y [ x [ i ] ] = i for i in [ 0 , 1 , . . . , len ( x ) - 1 ] ` <nl> mmm a / tensorflow / core / ops / candidate_sampling_ops . cc <nl> ppp b / tensorflow / core / ops / candidate_sampling_ops . cc <nl> true_expected_count : A batch_size * num_true matrix , representing <nl> the number of times each candidate is expected to occur in a batch <nl> of sampled candidates . If unique = true , then this is a probability . <nl> sampled_expected_count : A vector of length num_sampled , for each sampled <nl> - candidate represting the number of times the candidate is expected <nl> + candidate representing the number of times the candidate is expected <nl> to occur in a batch of sampled candidates . If unique = true , then this is a <nl> probability . <nl> num_true : Number of true labels per context . <nl> true_expected_count : A batch_size * num_true matrix , representing <nl> the number of times each candidate is expected to occur in a batch <nl> of sampled candidates . If unique = true , then this is a probability . <nl> sampled_expected_count : A vector of length num_sampled , for each sampled <nl> - candidate represting the number of times the candidate is expected <nl> + candidate representing the number of times the candidate is expected <nl> to occur in a batch of sampled candidates . If unique = true , then this is a <nl> probability . <nl> num_true : Number of true labels per context . <nl> true_expected_count : A batch_size * num_true matrix , representing <nl> the number of times each candidate is expected to occur in a batch <nl> of sampled candidates . If unique = true , then this is a probability . <nl> sampled_expected_count : A vector of length num_sampled , for each sampled <nl> - candidate represting the number of times the candidate is expected <nl> + candidate representing the number of times the candidate is expected <nl> to occur in a batch of sampled candidates . If unique = true , then this is a <nl> probability . <nl> num_true : Number of true labels per context . <nl> true_expected_count : A batch_size * num_true matrix , representing <nl> the number of times each candidate is expected to occur in a batch <nl> of sampled candidates . If unique = true , then this is a probability . <nl> sampled_expected_count : A vector of length num_sampled , for each sampled <nl> - candidate represting the number of times the candidate is expected <nl> + candidate representing the number of times the candidate is expected <nl> to occur in a batch of sampled candidates . If unique = true , then this is a <nl> probability . <nl> num_true : Number of true labels per context . <nl> true_expected_count : A batch_size * num_true matrix , representing <nl> the number of times each candidate is expected to occur in a batch <nl> of sampled candidates . If unique = true , then this is a probability . <nl> sampled_expected_count : A vector of length num_sampled , for each sampled <nl> - candidate represting the number of times the candidate is expected <nl> + candidate representing the number of times the candidate is expected <nl> to occur in a batch of sampled candidates . If unique = true , then this is a <nl> probability . <nl> num_true : Number of true labels per context . <nl> true_expected_count : A batch_size * num_true matrix , representing <nl> the number of times each candidate is expected to occur in a batch <nl> of sampled candidates . If unique = true , then this is a probability . <nl> sampled_expected_count : A vector of length num_sampled , for each sampled <nl> - candidate represting the number of times the candidate is expected <nl> + candidate representing the number of times the candidate is expected <nl> to occur in a batch of sampled candidates . If unique = true , then this is a <nl> probability . <nl> num_true : Number of true labels per context . <nl> mmm a / tensorflow / core / ops / control_flow_ops . cc <nl> ppp b / tensorflow / core / ops / control_flow_ops . cc <nl> REGISTER_OP ( " Switch " ) <nl> . Doc ( R " doc ( <nl> Forwards ` data ` to the output port determined by ` pred ` . <nl> <nl> - If ` pred ` is true , the ` data ` input is forwared to ` output_true ` . Otherwise , <nl> + If ` pred ` is true , the ` data ` input is forwarded to ` output_true ` . Otherwise , <nl> the data goes to ` output_false ` . <nl> <nl> See also ` RefSwitch ` and ` Merge ` . <nl> REGISTER_OP ( " RefSwitch " ) <nl> . Doc ( R " doc ( <nl> Forwards the ref tensor ` data ` to the output port determined by ` pred ` . <nl> <nl> - If ` pred ` is true , the ` data ` input is forwared to ` output_true ` . Otherwise , <nl> + If ` pred ` is true , the ` data ` input is forwarded to ` output_true ` . Otherwise , <nl> the data goes to ` output_false ` . <nl> <nl> See also ` Switch ` and ` Merge ` . <nl> mmm a / tensorflow / core / ops / image_ops . cc <nl> ppp b / tensorflow / core / ops / image_ops . cc <nl> channel and then adjusts each component of each pixel to <nl> <nl> images : Images to adjust . At least 3 - D . <nl> contrast_factor : A float multiplier for adjusting contrast . <nl> - output : The constrast - adjusted image or images . <nl> + output : The contrast - adjusted image or images . <nl> ) Doc " ) ; <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / tensorflow / core / ops / math_ops . cc <nl> ppp b / tensorflow / core / ops / math_ops . cc <nl> Computes exponential of x element - wise . \ \ ( y = e ^ x \ \ ) . <nl> REGISTER_OP ( " Log " ) <nl> . UNARY ( ) <nl> . Doc ( R " doc ( <nl> - Computes natural logrithm of x element - wise . <nl> + Computes natural logarithm of x element - wise . <nl> I . e . , \ \ ( y = \ log_e x \ \ ) . <nl> ) doc " ) ; <nl> <nl> mmm a / tensorflow / core / ops / ops . pbtxt <nl> ppp b / tensorflow / core / ops / ops . pbtxt <nl> op { <nl> } <nl> output_arg { <nl> name : " output " <nl> - description : " The constrast - adjusted image or images . " <nl> + description : " The contrast - adjusted image or images . " <nl> type : DT_FLOAT <nl> } <nl> summary : " Adjust the contrast of one or more images . " <nl> op { <nl> } <nl> output_arg { <nl> name : " sampled_expected_count " <nl> - description : " A vector of length num_sampled , for each sampled \ ncandidate represting the number of times the candidate is expected \ nto occur in a batch of sampled candidates . If unique = true , then this is a \ nprobability . " <nl> + description : " A vector of length num_sampled , for each sampled \ ncandidate representing the number of times the candidate is expected \ nto occur in a batch of sampled candidates . If unique = true , then this is a \ nprobability . " <nl> type : DT_FLOAT <nl> } <nl> attr { <nl> mmm a / tensorflow / python / ops / image_ops . py <nl> ppp b / tensorflow / python / ops / image_ops . py <nl> def random_brightness ( image , max_delta , seed = None ) : <nl> def random_contrast ( image , lower , upper , seed = None ) : <nl> " " " Adjust the contrast of an image by a random factor . <nl> <nl> - Equivalent to ` adjust_constrast ( ) ` but uses a ` contrast_factor ` randomly <nl> + Equivalent to ` adjust_contrast ( ) ` but uses a ` contrast_factor ` randomly <nl> picked in the interval ` [ lower , upper ] ` . <nl> <nl> Args : <nl> def convert_image_dtype ( image , dtype , saturate = False , name = None ) : <nl> <nl> Images that are represented using floating point values are expected to have <nl> values in the range [ 0 , 1 ) . Image data stored in integer data types are <nl> - expected to have values in the range ` [ 0 , MAX ] ` , wbere ` MAX ` is the largest <nl> + expected to have values in the range ` [ 0 , MAX ] ` , where ` MAX ` is the largest <nl> positive representable number for the data type . <nl> <nl> This op converts between data types , scaling the values appropriately before <nl> def random_saturation ( image , lower , upper , seed = None ) : <nl> <nl> <nl> def adjust_saturation ( image , saturation_factor , name = None ) : <nl> - " " " Adjust staturation of an RGB image . <nl> + " " " Adjust saturation of an RGB image . <nl> <nl> This is a convenience method that converts an RGB image to float <nl> representation , converts it to HSV , add an offset to the saturation channel , <nl>
|
Fix documentation typos in ops .
|
tensorflow/tensorflow
|
8f8530bf56e0abb6ce63e8c0fb99de76a0bc759b
|
2016-01-07T00:09:58Z
|
mmm a / include / swift / AST / ASTVisitor . h <nl> ppp b / include / swift / AST / ASTVisitor . h <nl> class ASTVisitor { <nl> DISPATCH ( Semi ) ; <nl> DISPATCH ( Assign ) ; <nl> DISPATCH ( Brace ) ; <nl> + DISPATCH ( Return ) ; <nl> DISPATCH ( If ) ; <nl> # undef DISPATCH <nl> } <nl> mmm a / include / swift / AST / Stmt . h <nl> ppp b / include / swift / AST / Stmt . h <nl> enum class StmtKind { <nl> Semi , <nl> Assign , <nl> Brace , <nl> + Return , <nl> If <nl> } ; <nl> <nl> class BraceStmt : public Stmt { <nl> static bool classof ( const Stmt * S ) { return S - > Kind = = StmtKind : : Brace ; } <nl> } ; <nl> <nl> + / / / ReturnStmt - A return statement . Return statements with no specified <nl> + / / / subexpression are expanded into a return of the empty tuple in the parser . <nl> + / / / return 42 <nl> + class ReturnStmt : public Stmt { <nl> + public : <nl> + SMLoc ReturnLoc ; <nl> + Expr * Result ; <nl> + <nl> + ReturnStmt ( SMLoc ReturnLoc , Expr * Result ) <nl> + : Stmt ( StmtKind : : Return ) , ReturnLoc ( ReturnLoc ) , Result ( Result ) { } <nl> + <nl> + / / Implement isa / cast / dyncast / etc . <nl> + static bool classof ( const ReturnStmt * ) { return true ; } <nl> + static bool classof ( const Stmt * S ) { return S - > Kind = = StmtKind : : Return ; } <nl> + } ; <nl> <nl> / / / IfStmt - if / then / else statement . If no ' else ' is specified , then the <nl> / / / ElseLoc location is not specified and the Else statement is null . The <nl> mmm a / include / swift / Parse / Parser . h <nl> ppp b / include / swift / Parse / Parser . h <nl> class Parser { <nl> <nl> / / Statement Parsing <nl> BraceStmt * parseStmtBrace ( ) ; <nl> + Stmt * parseStmtReturn ( ) ; <nl> Stmt * parseStmtIf ( ) ; <nl> <nl> } ; <nl> mmm a / lib / AST / Expr . cpp <nl> ppp b / lib / AST / Expr . cpp <nl> namespace { <nl> return BS ; <nl> } <nl> <nl> + Stmt * visitReturnStmt ( ReturnStmt * RS ) { <nl> + if ( Expr * E = doIt ( RS - > Result ) ) <nl> + RS - > Result = E ; <nl> + else <nl> + return 0 ; <nl> + return RS ; <nl> + } <nl> + <nl> Stmt * visitIfStmt ( IfStmt * IS ) { <nl> if ( Expr * E2 = doIt ( IS - > Cond ) ) <nl> IS - > Cond = E2 ; <nl> mmm a / lib / AST / Stmt . cpp <nl> ppp b / lib / AST / Stmt . cpp <nl> SMLoc Stmt : : getLocStart ( ) const { <nl> return cast < AssignStmt > ( this ) - > Dest - > getLocStart ( ) ; <nl> case StmtKind : : Brace : <nl> return cast < BraceStmt > ( this ) - > LBLoc ; <nl> + case StmtKind : : Return : <nl> + return cast < ReturnStmt > ( this ) - > ReturnLoc ; <nl> case StmtKind : : If : <nl> return cast < IfStmt > ( this ) - > IfLoc ; <nl> } <nl> class PrintStmt : public StmtVisitor < PrintStmt > { <nl> OS < < ' ) ' ; <nl> } <nl> <nl> + void visitReturnStmt ( ReturnStmt * S ) { <nl> + OS . indent ( Indent ) < < " ( return_stmt \ n " ; <nl> + printRec ( S - > Result ) ; <nl> + OS < < ' ) ' ; <nl> + } <nl> + <nl> void visitIfStmt ( IfStmt * S ) { <nl> OS . indent ( Indent ) < < " ( if_stmt \ n " ; <nl> printRec ( S - > Cond ) ; <nl> mmm a / lib / Parse / Parser . cpp <nl> ppp b / lib / Parse / Parser . cpp <nl> bool Parser : : parseExprFunc ( NullablePtr < Expr > & Result ) { <nl> / / / ' ; ' <nl> / / / expr ' = ' expr <nl> / / / stmt - brace <nl> + / / / stmt - return <nl> / / / stmt - if <nl> bool Parser : : parseBraceItemList ( SmallVectorImpl < ExprStmtOrDecl > & Entries , <nl> bool IsTopLevel ) { <nl> bool Parser : : parseBraceItemList ( SmallVectorImpl < ExprStmtOrDecl > & Entries , <nl> Entries . push_back ( new ( S . Context ) SemiStmt ( Tok . getLoc ( ) ) ) ; <nl> consumeToken ( tok : : semi ) ; <nl> break ; <nl> - <nl> case tok : : l_brace : <nl> Entries . push_back ( parseStmtBrace ( ) ) ; <nl> break ; <nl> - <nl> + case tok : : kw_return : <nl> + Entries . push_back ( parseStmtReturn ( ) ) ; <nl> + break ; <nl> case tok : : kw_if : <nl> Entries . push_back ( parseStmtIf ( ) ) ; <nl> break ; <nl> - <nl> case tok : : kw_import : <nl> Entries . push_back ( parseDeclImport ( ) ) ; <nl> <nl> BraceStmt * Parser : : parseStmtBrace ( ) { <nl> return new ( S . Context ) BraceStmt ( LBLoc , NewElements , Entries . size ( ) , RBLoc ) ; <nl> } <nl> <nl> + / / / parseStmtReturn <nl> + / / / <nl> + / / / stmt - return : <nl> + / / / return expr ? <nl> + / / / <nl> + Stmt * Parser : : parseStmtReturn ( ) { <nl> + SMLoc ReturnLoc = consumeToken ( tok : : kw_return ) ; <nl> + <nl> + / / Handle the ambiguity between consuming the expression and allowing the <nl> + / / enclosing stmt - brace to get it by eagerly eating it . <nl> + Expr * Result ; <nl> + if ( isStartOfExpr ( Tok , peekToken ( ) ) ) { <nl> + NullablePtr < Expr > ResultTmp ; <nl> + if ( parseExpr ( ResultTmp , " expected expresssion in ' return ' statement " ) | | <nl> + ResultTmp . isNull ( ) ) <nl> + return 0 ; <nl> + Result = ResultTmp . get ( ) ; <nl> + } else { <nl> + / / Result value defaults to ( ) . <nl> + Result = new ( S . Context ) TupleExpr ( SMLoc ( ) , 0 , 0 , 0 , SMLoc ( ) , false , false ) ; <nl> + } <nl> + <nl> + return new ( S . Context ) ReturnStmt ( ReturnLoc , Result ) ; <nl> + } <nl> + <nl> <nl> / / / <nl> / / / stmt - if : <nl> mmm a / lib / Sema / TypeChecking . cpp <nl> ppp b / lib / Sema / TypeChecking . cpp <nl> namespace { <nl> assert ( 0 & & " BraceStmts should be processed in the prepass " ) ; <nl> return 0 ; <nl> } <nl> + <nl> + Stmt * visitReturnStmt ( ReturnStmt * RS ) { <nl> + / / FIXME : Convert the subexpr to the return type . . <nl> + return RS ; <nl> + } <nl> <nl> Stmt * visitIfStmt ( IfStmt * IS ) { <nl> / / The if condition must have __builtin_int1 type . This is after the <nl>
|
implement AST and parser support for ' return ' . We ' re still not doing a conversion
|
apple/swift
|
433d6de807db78ac49b3d90ef4364504a04c155a
|
2011-08-03T23:19:24Z
|
mmm a / xbmc / powermanagement / win10 / WinIdleTimer . cpp <nl> ppp b / xbmc / powermanagement / win10 / WinIdleTimer . cpp <nl> <nl> # include " powermanagement / WinIdleTimer . h " <nl> # include " Application . h " <nl> <nl> + using namespace Windows : : ApplicationModel : : Core ; <nl> + using namespace Windows : : Foundation ; <nl> + using namespace Windows : : System : : Display ; <nl> + using namespace Windows : : System : : Threading ; <nl> + using namespace Windows : : UI : : Core ; <nl> + <nl> void CWinIdleTimer : : StartZero ( ) <nl> { <nl> if ( ! g_application . IsDPMSActive ( ) ) <nl> { <nl> - try <nl> - { <nl> - auto displayRequest = ref new Windows : : System : : Display : : DisplayRequest ( ) ; <nl> - / / this couple of calls activate and deactivate a display - required <nl> - / / request in other words they reset display idle timer <nl> - displayRequest - > RequestActive ( ) ; <nl> - displayRequest - > RequestRelease ( ) ; <nl> - } <nl> - catch ( Platform : : Exception ^ ex ) <nl> + auto workItem = ref new DispatchedHandler ( [ ] ( ) <nl> { <nl> - } <nl> + try <nl> + { <nl> + auto displayRequest = ref new DisplayRequest ( ) ; <nl> + / / this couple of calls activate and deactivate a display - required <nl> + / / request in other words they reset display idle timer <nl> + displayRequest - > RequestActive ( ) ; <nl> + displayRequest - > RequestRelease ( ) ; <nl> + } <nl> + catch ( Platform : : Exception ^ ex ) { } <nl> + } ) ; <nl> + CoreWindow ^ window = CoreApplication : : MainView - > CoreWindow ; <nl> + window - > Dispatcher - > RunAsync ( CoreDispatcherPriority : : High , workItem ) ; <nl> } <nl> CStopWatch : : StartZero ( ) ; <nl> } <nl>
|
[ win10 ] fixed : request display activity on UI thread .
|
xbmc/xbmc
|
cc490ffd93a4f0df4fb2deb8a120f9ca6fab0cee
|
2018-01-03T19:32:37Z
|
mmm a / modules / prediction / scenario / feature_extractor / BUILD <nl> ppp b / modules / prediction / scenario / feature_extractor / BUILD <nl> cc_library ( <nl> " / / modules / common : log " , <nl> " / / modules / common : macro " , <nl> " / / modules / prediction / proto : scenario_feature_proto " , <nl> + " / / modules / prediction / container : container_manager " , <nl> ] , <nl> ) <nl> <nl> mmm a / modules / prediction / scenario / feature_extractor / feature_extractor . cc <nl> ppp b / modules / prediction / scenario / feature_extractor / feature_extractor . cc <nl> FeatureExtractor : : FeatureExtractor ( ) { <nl> FeatureExtractor : : ~ FeatureExtractor ( ) { <nl> } <nl> <nl> + ScenarioFeature FeatureExtractor : : ExtractFeatures ( ) { <nl> + ScenarioFeature features ; <nl> + return features ; <nl> + } <nl> + <nl> } / / namespace prediction <nl> } / / namespace apollo <nl> mmm a / modules / prediction / scenario / feature_extractor / feature_extractor . h <nl> ppp b / modules / prediction / scenario / feature_extractor / feature_extractor . h <nl> <nl> <nl> # include " modules / prediction / proto / scenario_feature . pb . h " <nl> <nl> + # include " modules / prediction / container / container_manager . h " <nl> + <nl> namespace apollo { <nl> namespace prediction { <nl> <nl> class FeatureExtractor { <nl> <nl> virtual ~ FeatureExtractor ( ) ; <nl> <nl> - void UpdateVehicleState ( ) ; <nl> - <nl> - void UpdateMap ( ) ; <nl> - <nl> - void UpdateObstacleInfo ( ) ; <nl> + ScenarioFeature ExtractFeatures ( ) ; <nl> } ; <nl> <nl> } / / namespace prediction <nl>
|
prediction : added placeholder for feature extractor
|
ApolloAuto/apollo
|
e90ebae1cab876e3bb43a8a213e7f728de7683c6
|
2018-09-06T18:08:51Z
|
mmm a / tests / src / core_configuration / json / errors . jsonc <nl> ppp b / tests / src / core_configuration / json / errors . jsonc <nl> <nl> " errors / profile_complex_modifications_errors . jsonc " , <nl> " errors / profile_device_errors . jsonc " , <nl> " errors / profile_errors . jsonc " , <nl> + " errors / profile_parameters_errors . jsonc " , <nl> " errors / profile_simple_modifications_errors . jsonc " <nl> ] <nl> mmm a / tests / src / core_configuration / json / errors / profile_errors . jsonc <nl> ppp b / tests / src / core_configuration / json / errors / profile_errors . jsonc <nl> <nl> " error " : " ` selected ` must be boolean , but is ` null ` " <nl> } , <nl> <nl> + / / parameters <nl> + <nl> + { <nl> + " class " : " profile " , <nl> + " input " : { <nl> + " parameters " : null <nl> + } , <nl> + " error " : " ` parameters ` error : json must be object , but is ` null ` " <nl> + } , <nl> + <nl> / / simple_modifications <nl> <nl> { <nl> new file mode 100644 <nl> index 000000000 . . b7fc75ce2 <nl> mmm / dev / null <nl> ppp b / tests / src / core_configuration / json / errors / profile_parameters_errors . jsonc <nl> <nl> + [ <nl> + { <nl> + " class " : " parameters " , <nl> + " input " : null , <nl> + " error " : " json must be object , but is ` null ` " <nl> + } , <nl> + <nl> + / / delay_milliseconds_before_open_device <nl> + <nl> + { <nl> + " class " : " parameters " , <nl> + " input " : { <nl> + " delay_milliseconds_before_open_device " : null <nl> + } , <nl> + " error " : " ` delay_milliseconds_before_open_device ` must be number , but is ` null ` " <nl> + } <nl> + ] <nl> mmm a / tests / src / core_configuration / json / example . json <nl> ppp b / tests / src / core_configuration / json / example . json <nl> <nl> " profiles " : [ <nl> { <nl> " name " : " Default profile " , <nl> + " parameters " : { <nl> + " delay_milliseconds_before_open_device " : 1000 , <nl> + " dummy " : true <nl> + } , <nl> " selected " : true , <nl> " simple_modifications " : [ <nl> { <nl> mmm a / tests / src / core_configuration / json / to_json_example . json <nl> ppp b / tests / src / core_configuration / json / to_json_example . json <nl> <nl> ] , <nl> " name " : " Default profile " , <nl> " parameters " : { <nl> - " delay_milliseconds_before_open_device " : 3000 <nl> + " delay_milliseconds_before_open_device " : 1000 , <nl> + " dummy " : true <nl> } , <nl> " selected " : true , <nl> " simple_modifications " : [ <nl> mmm a / tests / src / core_configuration / src / errors_test . cpp <nl> ppp b / tests / src / core_configuration / src / errors_test . cpp <nl> void handle_json ( const nlohmann : : json & json ) { <nl> krbn : : core_configuration : : details : : complex_modifications ( json . at ( " input " ) ) ; <nl> } else if ( c = = " devices " ) { <nl> krbn : : core_configuration : : details : : device ( json . at ( " input " ) ) ; <nl> + } else if ( c = = " parameters " ) { <nl> + json . at ( " input " ) . get < krbn : : core_configuration : : details : : parameters > ( ) ; <nl> } else if ( c = = " profile " ) { <nl> krbn : : core_configuration : : details : : profile ( json . at ( " input " ) ) ; <nl> } else if ( c = = " simple_modifications " ) { <nl>
|
update tests
|
pqrs-org/Karabiner-Elements
|
b704cccf61ad95ce4af8e053871b4b634c0970a2
|
2019-06-02T12:22:12Z
|
mmm a / stdlib / public / core / Collection . swift <nl> ppp b / stdlib / public / core / Collection . swift <nl> public protocol Collection : Sequence where SubSequence : Collection { <nl> / / / } else { <nl> / / / print ( " Hi ho , \ ( horseName ) ! " ) <nl> / / / } <nl> - / / / / / Prints " Hi ho , Silver ! " ) <nl> + / / / / / Prints " Hi ho , Silver ! " <nl> / / / <nl> / / / - Complexity : O ( 1 ) <nl> var isEmpty : Bool { get } <nl>
|
Merge remote - tracking branch ' origin / master ' into master - next
|
apple/swift
|
0dac0fc78ad8e4fbea1df3dc6899d3d2f99f2483
|
2018-03-14T12:29:12Z
|
mmm a / Telegram / SourceFiles / window / window_peer_menu . cpp <nl> ppp b / Telegram / SourceFiles / window / window_peer_menu . cpp <nl> bool Filler : : showToggleArchived ( ) { <nl> const auto history = _peer - > owner ( ) . historyLoaded ( _peer ) ; <nl> if ( history & & history - > useProxyPromotion ( ) ) { <nl> return false ; <nl> - } else if ( ! _peer - > isNotificationsUser ( ) ) { <nl> + } else if ( ! _peer - > isNotificationsUser ( ) & & ! _peer - > isSelf ( ) ) { <nl> return true ; <nl> } <nl> return history & & ( history - > folder ( ) ! = nullptr ) ; <nl>
|
Don ' t suggest to archive Saved Messages .
|
telegramdesktop/tdesktop
|
edf4180d11fca32c971dff47fd63c6ab814ce8a2
|
2019-05-01T12:11:47Z
|
mmm a / tensorflow / python / BUILD <nl> ppp b / tensorflow / python / BUILD <nl> py_library ( <nl> " : errors " , <nl> " : framework_for_generated_wrappers " , <nl> " : gpu_util " , <nl> + " : memory_checker " , <nl> " : platform " , <nl> " : platform_test " , <nl> " : pywrap_tf_session " , <nl> py_library ( <nl> ] , <nl> ) <nl> <nl> + py_library ( <nl> + name = " memory_checker " , <nl> + srcs = [ <nl> + " framework / memory_checker . py " , <nl> + " framework / python_memory_checker . py " , <nl> + ] , <nl> + srcs_version = " PY2AND3 " , <nl> + deps = [ " : _python_memory_checker_helper " ] , <nl> + ) <nl> + <nl> + tf_python_pybind_extension ( <nl> + name = " _python_memory_checker_helper " , <nl> + srcs = [ " framework / python_memory_checker_helper . cc " ] , <nl> + module_name = " _python_memory_checker_helper " , <nl> + deps = [ <nl> + " @ pybind11 " , <nl> + ] , <nl> + ) <nl> + <nl> tf_py_test ( <nl> name = " framework_constant_op_test " , <nl> size = " small " , <nl> tf_py_test ( <nl> ] , <nl> ) <nl> <nl> + tf_py_test ( <nl> + name = " framework_memory_checker_test " , <nl> + size = " medium " , <nl> + srcs = [ " framework / memory_checker_test . py " ] , <nl> + main = " framework / memory_checker_test . py " , <nl> + python_version = " PY3 " , <nl> + shard_count = 8 , <nl> + tags = [ <nl> + " no_oss_py2 " , <nl> + " no_windows " , <nl> + ] , <nl> + deps = [ <nl> + " : framework_test_lib " , <nl> + ] , <nl> + ) <nl> + <nl> tf_py_test ( <nl> name = " framework_dtypes_test " , <nl> size = " small " , <nl> new file mode 100644 <nl> index 0000000000000 . . ff99182966af9 <nl> mmm / dev / null <nl> ppp b / tensorflow / python / framework / memory_checker . py <nl> <nl> + # Copyright 2020 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + " " " Memory leak detection utility . " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + from tensorflow . python . framework . python_memory_checker import _PythonMemoryChecker <nl> + from tensorflow . python . profiler . traceme import TraceMe <nl> + from tensorflow . python . profiler . traceme import traceme_wrapper <nl> + from tensorflow . python . util import tf_inspect <nl> + <nl> + try : <nl> + from tensorflow . python . platform . cpp_memory_checker import _CppMemoryChecker # pylint : disable = g - import - not - at - top <nl> + except ImportError : <nl> + _CppMemoryChecker = None <nl> + <nl> + <nl> + def _get_test_name_best_effort ( ) : <nl> + " " " If available , return the current test name . Otherwise , ` None ` . " " " <nl> + for stack in tf_inspect . stack ( ) : <nl> + function_name = stack [ 3 ] <nl> + if function_name . startswith ( ' test ' ) : <nl> + try : <nl> + class_name = stack [ 0 ] . f_locals [ ' self ' ] . __class__ . __name__ <nl> + return class_name + ' . ' + function_name <nl> + except : # pylint : disable = bare - except <nl> + pass <nl> + <nl> + return None <nl> + <nl> + <nl> + # TODO ( kkb ) : Also create decorator versions for convenience . <nl> + class MemoryChecker ( object ) : <nl> + " " " Memory leak detection class . <nl> + <nl> + This is a utility class to detect Python and C + + memory leaks . It ' s intended <nl> + for both testing and debugging . Basic usage : <nl> + <nl> + > > > # MemoryChecker ( ) context manager tracks memory status inside its scope . <nl> + > > > with MemoryChecker ( ) as memory_checker : <nl> + > > > tensors = [ ] <nl> + > > > for _ in range ( 10 ) : <nl> + > > > # Simulating ` tf . constant ( 1 ) ` object leak every iteration . <nl> + > > > tensors . append ( tf . constant ( 1 ) ) <nl> + > > > <nl> + > > > # Take a memory snapshot for later analysis . <nl> + > > > memory_checker . record_snapshot ( ) <nl> + > > > <nl> + > > > # ` report ( ) ` generates a html graph file showing allocations over <nl> + > > > # snapshots per every stack trace . <nl> + > > > memory_checker . report ( ) <nl> + > > > <nl> + > > > # This assertion will detect ` tf . constant ( 1 ) ` object leak . <nl> + > > > memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + ` record_snapshot ( ) ` must be called once every iteration at the same location . <nl> + This is because the detection algorithm relies on the assumption that if there <nl> + is a leak , it ' s happening similarly on every snapshot . <nl> + " " " <nl> + <nl> + @ traceme_wrapper <nl> + def __enter__ ( self ) : <nl> + self . _trace_me = TraceMe ( ' with MemoryChecker ( ) : ' ) <nl> + self . _trace_me . __enter__ ( ) <nl> + self . _python_memory_checker = _PythonMemoryChecker ( ) <nl> + if _CppMemoryChecker : <nl> + self . _cpp_memory_checker = _CppMemoryChecker ( _get_test_name_best_effort ( ) ) <nl> + return self <nl> + <nl> + @ traceme_wrapper <nl> + def __exit__ ( self , exc_type , exc_value , traceback ) : <nl> + if _CppMemoryChecker : <nl> + self . _cpp_memory_checker . stop ( ) <nl> + self . _trace_me . __exit__ ( exc_type , exc_value , traceback ) <nl> + <nl> + @ traceme_wrapper <nl> + def record_snapshot ( self ) : <nl> + " " " Take a memory snapshot for later analysis . <nl> + <nl> + ` record_snapshot ( ) ` must be called once every iteration at the same <nl> + location . This is because the detection algorithm relies on the assumption <nl> + that if there is a leak , it ' s happening similarly on every snapshot . <nl> + <nl> + The recommended number of ` record_snapshot ( ) ` call depends on the testing <nl> + code complexity and the allcoation pattern . <nl> + " " " <nl> + self . _python_memory_checker . record_snapshot ( ) <nl> + if _CppMemoryChecker : <nl> + self . _cpp_memory_checker . record_snapshot ( ) <nl> + <nl> + @ traceme_wrapper <nl> + def report ( self ) : <nl> + " " " Generates a html graph file showing allocations over snapshots . <nl> + <nl> + It create a temporary directory and put all the output files there . <nl> + If this is running under Google internal testing infra , it will use the <nl> + directory provided the infra instead . <nl> + " " " <nl> + self . _python_memory_checker . report ( ) <nl> + if _CppMemoryChecker : <nl> + self . _cpp_memory_checker . report ( ) <nl> + <nl> + @ traceme_wrapper <nl> + def assert_no_leak_if_all_possibly_except_one ( self ) : <nl> + " " " Raises an exception if a leak is detected . <nl> + <nl> + This algorithm classifies a series of allocations as a leak if it ' s the same <nl> + type ( Python ) orit happens at the same stack trace ( C + + ) at every snapshot , <nl> + but possibly except one snapshot . <nl> + " " " <nl> + <nl> + self . _python_memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + if _CppMemoryChecker : <nl> + self . _cpp_memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + @ traceme_wrapper <nl> + def assert_no_new_python_objects ( self , threshold = None ) : <nl> + " " " Raises an exception if there are new Python objects created . <nl> + <nl> + It computes the number of new Python objects per type using the first and <nl> + the last snapshots . <nl> + <nl> + Args : <nl> + threshold : A dictionary of [ Type name string ] , [ count ] pair . It won ' t <nl> + raise an exception if the new Python objects are under this threshold . <nl> + " " " <nl> + self . _python_memory_checker . assert_no_new_objects ( threshold = threshold ) <nl> new file mode 100644 <nl> index 0000000000000 . . bd77b3ba36ef7 <nl> mmm / dev / null <nl> ppp b / tensorflow / python / framework / memory_checker_test . py <nl> <nl> + # Copyright 2020 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + from tensorflow . python import keras <nl> + from tensorflow . python . framework import constant_op <nl> + from tensorflow . python . framework import ops <nl> + from tensorflow . python . framework . memory_checker import MemoryChecker <nl> + from tensorflow . python . ops import array_ops <nl> + from tensorflow . python . platform import test <nl> + <nl> + <nl> + class MemoryCheckerTest ( test . TestCase ) : <nl> + <nl> + def testNoLeakEmpty ( self ) : <nl> + with MemoryChecker ( ) as memory_checker : <nl> + memory_checker . record_snapshot ( ) <nl> + memory_checker . record_snapshot ( ) <nl> + memory_checker . record_snapshot ( ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + memory_checker . report ( ) <nl> + memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + def testNoLeak1 ( self ) : <nl> + with MemoryChecker ( ) as memory_checker : <nl> + memory_checker . record_snapshot ( ) <nl> + x = constant_op . constant ( 1 ) # pylint : disable = unused - variable <nl> + memory_checker . record_snapshot ( ) <nl> + memory_checker . record_snapshot ( ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + memory_checker . report ( ) <nl> + memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + def testNoLeak2 ( self ) : <nl> + with MemoryChecker ( ) as memory_checker : <nl> + tensors = [ ] <nl> + for i in range ( 10 ) : <nl> + if i not in ( 5 , 7 ) : <nl> + tensors . append ( constant_op . constant ( 1 ) ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + memory_checker . report ( ) <nl> + memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + def testLeak1 ( self ) : <nl> + with MemoryChecker ( ) as memory_checker : <nl> + memory_checker . record_snapshot ( ) <nl> + x = constant_op . constant ( 1 ) # pylint : disable = unused - variable <nl> + memory_checker . record_snapshot ( ) <nl> + y = constant_op . constant ( 1 ) # pylint : disable = unused - variable <nl> + memory_checker . record_snapshot ( ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + memory_checker . report ( ) <nl> + with self . assertRaises ( AssertionError ) : <nl> + memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + def testLeak2 ( self ) : <nl> + with MemoryChecker ( ) as memory_checker : <nl> + tensors = [ ] <nl> + for _ in range ( 10 ) : <nl> + tensors . append ( constant_op . constant ( 1 ) ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + memory_checker . report ( ) <nl> + with self . assertRaises ( AssertionError ) : <nl> + memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + def testNoNewPythonObjectsEmpty ( self ) : <nl> + with MemoryChecker ( ) as memory_checker : <nl> + memory_checker . record_snapshot ( ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + # TODO ( kkb ) : ` { ' builtins . weakref ' : 1 } ` is unexpected , locate and fix it . <nl> + memory_checker . assert_no_new_python_objects ( <nl> + threshold = { ' builtins . weakref ' : 1 } ) <nl> + <nl> + def testNewPythonObjects ( self ) : <nl> + with MemoryChecker ( ) as memory_checker : <nl> + memory_checker . record_snapshot ( ) <nl> + x = constant_op . constant ( 1 ) # pylint : disable = unused - variable <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + with self . assertRaisesRegexp ( AssertionError , ' New Python objects ' ) : <nl> + memory_checker . assert_no_new_python_objects ( ) <nl> + <nl> + def testNewPythonObjectBelowThreshold ( self ) : <nl> + <nl> + class Foo ( object ) : <nl> + pass <nl> + <nl> + with MemoryChecker ( ) as memory_checker : <nl> + memory_checker . record_snapshot ( ) <nl> + foo = Foo ( ) # pylint : disable = unused - variable <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + # TODO ( kkb ) : ` { ' builtins . weakref ' : 1 } ` is unexpected , locate and fix it . <nl> + memory_checker . assert_no_new_python_objects ( threshold = { <nl> + ' __main__ . Foo ' : 1 , <nl> + ' builtins . weakref ' : 1 <nl> + } ) <nl> + memory_checker . assert_no_new_python_objects ( threshold = { <nl> + ' __main__ . Foo ' : 2 , <nl> + ' builtins . weakref ' : 1 <nl> + } ) <nl> + <nl> + def testKerasBasic ( self ) : <nl> + # TODO ( kkb ) : Fix the the slowness on Forge . <nl> + self . skipTest ( ' This test is too slow on Forge so disabled for now . ' ) <nl> + <nl> + x = array_ops . zeros ( [ 1 , 1 ] ) <nl> + y = constant_op . constant ( [ [ 3 ] ] ) <nl> + model = keras . models . Sequential ( ) <nl> + model . add ( keras . layers . Dense ( 1 , input_dim = 1 ) ) <nl> + model . compile ( loss = ' mean_squared_error ' ) <nl> + <nl> + with MemoryChecker ( ) as memory_checker : <nl> + for _ in range ( 10 ) : <nl> + model . fit ( x , y ) <nl> + model . evaluate ( x , y ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + memory_checker . report ( ) <nl> + memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + def testKerasAdvanced ( self ) : <nl> + # TODO ( kkb ) : Fix the the slowness on Forge . <nl> + self . skipTest ( ' This test is too slow on Forge so disabled for now . ' ) <nl> + <nl> + # A real world example taken from the following . <nl> + # https : / / github . com / tensorflow / tensorflow / issues / 32500 <nl> + # b / 142150794 <nl> + <nl> + with MemoryChecker ( ) as memory_checker : <nl> + rows = 6 <nl> + columns = 7 <nl> + model = keras . Sequential ( [ <nl> + keras . layers . Flatten ( input_shape = [ rows * columns , 3 ] ) , <nl> + keras . layers . Dense ( 7 , input_shape = [ rows * columns * 3 ] ) , <nl> + ] ) <nl> + <nl> + model . compile ( <nl> + optimizer = keras . optimizer_v2 . gradient_descent . SGD ( lr = 0 . 01 ) , <nl> + loss = ' mean_squared_error ' , <nl> + metrics = [ ' accuracy ' ] ) <nl> + states = [ [ 1 ] * rows * columns for _ in range ( 20 ) ] <nl> + f = array_ops . one_hot ( states , dtype = ' float32 ' , depth = 3 ) <nl> + <nl> + for _ in range ( 20 ) : <nl> + model . predict ( f , steps = 10 ) <nl> + memory_checker . record_snapshot ( ) <nl> + <nl> + memory_checker . report ( ) <nl> + memory_checker . assert_no_leak_if_all_possibly_except_one ( ) <nl> + <nl> + <nl> + if __name__ = = ' __main__ ' : <nl> + ops . enable_eager_execution ( ) <nl> + test . main ( ) <nl> new file mode 100644 <nl> index 0000000000000 . . 2a0a626382ded <nl> mmm / dev / null <nl> ppp b / tensorflow / python / framework / python_memory_checker . py <nl> <nl> + # Copyright 2020 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + " " " Python memory leak detection utility . <nl> + <nl> + Please don ' t use this class directly . Instead , use ` MemoryChecker ` wrapper . <nl> + " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + import collections <nl> + import copy <nl> + import gc <nl> + <nl> + from tensorflow . python import _python_memory_checker_helper <nl> + from tensorflow . python . platform import tf_logging as logging <nl> + from tensorflow . python . profiler . traceme import traceme_wrapper <nl> + <nl> + <nl> + def _get_typename ( obj ) : <nl> + " " " Return human readable pretty type name string . " " " <nl> + objtype = type ( obj ) <nl> + name = objtype . __name__ <nl> + module = getattr ( objtype , ' __module__ ' , None ) <nl> + if module : <nl> + return ' { } . { } ' . format ( module , name ) <nl> + else : <nl> + return name <nl> + <nl> + <nl> + def _create_python_object_snapshot ( ) : <nl> + gc . collect ( ) <nl> + all_objects = gc . get_objects ( ) <nl> + result = collections . defaultdict ( set ) <nl> + for obj in all_objects : <nl> + result [ _get_typename ( obj ) ] . add ( id ( obj ) ) <nl> + return result <nl> + <nl> + <nl> + def _snapshot_diff ( old_snapshot , new_snapshot , exclude_ids ) : <nl> + result = collections . Counter ( ) <nl> + for new_name , new_ids in new_snapshot . items ( ) : <nl> + old_ids = old_snapshot [ new_name ] <nl> + result [ new_name ] = len ( new_ids - exclude_ids ) - len ( old_ids - exclude_ids ) <nl> + <nl> + # This removes zero or negative value entries . <nl> + result + = collections . Counter ( ) <nl> + return result <nl> + <nl> + <nl> + class _PythonMemoryChecker ( object ) : <nl> + " " " Python memory leak detection class . " " " <nl> + <nl> + def __init__ ( self ) : <nl> + self . _snapshots = [ ] <nl> + <nl> + @ traceme_wrapper <nl> + def record_snapshot ( self ) : <nl> + # Function called using ` mark_stack_trace_and_call ` will have <nl> + # " _python_memory_checker_helper " string in the C + + stack trace . This will <nl> + # be used to filter out C + + memory allocations caused by this function , <nl> + # because we are not interested in detecting memory growth caused by memory <nl> + # checker itself . <nl> + _python_memory_checker_helper . mark_stack_trace_and_call ( <nl> + lambda : self . _snapshots . append ( _create_python_object_snapshot ( ) ) ) <nl> + <nl> + @ traceme_wrapper <nl> + def report ( self ) : <nl> + # TODO ( kkb ) : Implement . <nl> + pass <nl> + <nl> + @ traceme_wrapper <nl> + def assert_no_leak_if_all_possibly_except_one ( self ) : <nl> + " " " Raises an exception if a leak is detected . <nl> + <nl> + This algorithm classifies a series of allocations as a leak if it ' s the same <nl> + type at every snapshot , but possibly except one snapshot . <nl> + " " " <nl> + <nl> + snapshot_diffs = [ ] <nl> + for i in range ( 0 , len ( self . _snapshots ) - 1 ) : <nl> + snapshot_diffs . append ( self . _snapshot_diff ( i , i + 1 ) ) <nl> + <nl> + allocation_counter = collections . Counter ( ) <nl> + for diff in snapshot_diffs : <nl> + for name , count in diff . items ( ) : <nl> + if count > 0 : <nl> + allocation_counter [ name ] + = 1 <nl> + <nl> + leaking_object_names = { <nl> + name for name , count in allocation_counter . items ( ) <nl> + if count > = len ( snapshot_diffs ) - 1 <nl> + } <nl> + <nl> + if leaking_object_names : <nl> + object_list_to_print = ' \ n ' . join ( <nl> + [ ' - ' + name for name in leaking_object_names ] ) <nl> + raise AssertionError ( <nl> + ' These Python objects were allocated every snapshot ' <nl> + ' possibly except one . \ n \ n { } ' . format ( object_list_to_print ) ) <nl> + <nl> + @ traceme_wrapper <nl> + def assert_no_new_objects ( self , threshold = None ) : <nl> + " " " Assert no new Python objects . " " " <nl> + <nl> + if not threshold : <nl> + threshold = { } <nl> + <nl> + count_diff = self . _snapshot_diff ( 0 , - 1 ) <nl> + original_count_diff = copy . deepcopy ( count_diff ) <nl> + count_diff . subtract ( collections . Counter ( threshold ) ) <nl> + <nl> + if max ( count_diff . values ( ) or [ 0 ] ) > 0 : <nl> + raise AssertionError ( ' New Python objects exceeded the threshold . \ n ' <nl> + ' Python object threshold : \ n ' <nl> + ' { } \ n \ n ' <nl> + ' New Python objects : \ n { } ' . format ( <nl> + threshold , original_count_diff . most_common ( ) ) ) <nl> + elif min ( count_diff . values ( ) , default = 0 ) < 0 : <nl> + logging . warning ( ' New Python objects were less than the threshold . \ n ' <nl> + ' Python object threshold : \ n ' <nl> + ' { } \ n \ n ' <nl> + ' New Python objects : \ n ' <nl> + ' { } ' . format ( threshold , original_count_diff . most_common ( ) ) ) <nl> + <nl> + @ traceme_wrapper <nl> + def _snapshot_diff ( self , old_index , new_index ) : <nl> + return _snapshot_diff ( self . _snapshots [ old_index ] , <nl> + self . _snapshots [ new_index ] , <nl> + self . _get_internal_object_ids ( ) ) <nl> + <nl> + @ traceme_wrapper <nl> + def _get_internal_object_ids ( self ) : <nl> + ids = set ( ) <nl> + for snapshot in self . _snapshots : <nl> + ids . add ( id ( snapshot ) ) <nl> + for v in snapshot . values ( ) : <nl> + ids . add ( id ( v ) ) <nl> + return ids <nl> new file mode 100644 <nl> index 0000000000000 . . cd27b6dc8ec50 <nl> mmm / dev / null <nl> ppp b / tensorflow / python / framework / python_memory_checker_helper . cc <nl> <nl> + / * Copyright 2020 The TensorFlow Authors . All Rights Reserved . <nl> + <nl> + Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; ; <nl> + you may not use this file except in compliance with the License . <nl> + You may obtain a copy of the License at <nl> + <nl> + http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + <nl> + Unless required by applicable law or agreed to in writing , software <nl> + distributed under the License is distributed on an " AS IS " BASIS , <nl> + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + See the License for the specific language governing permissions and <nl> + limitations under the License . <nl> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> + <nl> + # include " include / pybind11 / pybind11 . h " <nl> + <nl> + namespace py = pybind11 ; <nl> + <nl> + PYBIND11_MODULE ( _python_memory_checker_helper , m ) { <nl> + m . def ( " mark_stack_trace_and_call " , [ ] ( py : : function func ) { func ( ) ; } ) ; <nl> + } ; <nl> mmm a / tensorflow / python / profiler / traceme . py <nl> ppp b / tensorflow / python / profiler / traceme . py <nl> def __exit__ ( self , exc_type , exc_val , exc_tb ) : <nl> <nl> <nl> def traceme_wrapper ( func ) : <nl> - name = func . __qualname__ <nl> + name = getattr ( func , ' __qualname__ ' , None ) <nl> + if not name : <nl> + name = func . __name__ <nl> + <nl> def wrapper ( * args , * * kwargs ) : <nl> with TraceMe ( name ) : <nl> return func ( * args , * * kwargs ) <nl>
|
Introduce a memory leak detection utility .
|
tensorflow/tensorflow
|
52281ba252094fc201d2dbcb49c9c1fa9d17ad03
|
2020-02-13T00:10:29Z
|
mmm a / src / common / color . h <nl> ppp b / src / common / color . h <nl> constexpr u8 Convert8To6 ( u8 value ) { <nl> / * * <nl> * Decode a color stored in RGBA8 format <nl> * @ param bytes Pointer to encoded source color <nl> - * @ return Result color decoded as Math : : Vec4 < u8 > <nl> + * @ return Result color decoded as Common : : Vec4 < u8 > <nl> * / <nl> - inline Math : : Vec4 < u8 > DecodeRGBA8 ( const u8 * bytes ) { <nl> + inline Common : : Vec4 < u8 > DecodeRGBA8 ( const u8 * bytes ) { <nl> return { bytes [ 3 ] , bytes [ 2 ] , bytes [ 1 ] , bytes [ 0 ] } ; <nl> } <nl> <nl> / * * <nl> * Decode a color stored in RGB8 format <nl> * @ param bytes Pointer to encoded source color <nl> - * @ return Result color decoded as Math : : Vec4 < u8 > <nl> + * @ return Result color decoded as Common : : Vec4 < u8 > <nl> * / <nl> - inline Math : : Vec4 < u8 > DecodeRGB8 ( const u8 * bytes ) { <nl> + inline Common : : Vec4 < u8 > DecodeRGB8 ( const u8 * bytes ) { <nl> return { bytes [ 2 ] , bytes [ 1 ] , bytes [ 0 ] , 255 } ; <nl> } <nl> <nl> / * * <nl> * Decode a color stored in RG8 ( aka HILO8 ) format <nl> * @ param bytes Pointer to encoded source color <nl> - * @ return Result color decoded as Math : : Vec4 < u8 > <nl> + * @ return Result color decoded as Common : : Vec4 < u8 > <nl> * / <nl> - inline Math : : Vec4 < u8 > DecodeRG8 ( const u8 * bytes ) { <nl> + inline Common : : Vec4 < u8 > DecodeRG8 ( const u8 * bytes ) { <nl> return { bytes [ 1 ] , bytes [ 0 ] , 0 , 255 } ; <nl> } <nl> <nl> / * * <nl> * Decode a color stored in RGB565 format <nl> * @ param bytes Pointer to encoded source color <nl> - * @ return Result color decoded as Math : : Vec4 < u8 > <nl> + * @ return Result color decoded as Common : : Vec4 < u8 > <nl> * / <nl> - inline Math : : Vec4 < u8 > DecodeRGB565 ( const u8 * bytes ) { <nl> + inline Common : : Vec4 < u8 > DecodeRGB565 ( const u8 * bytes ) { <nl> u16_le pixel ; <nl> std : : memcpy ( & pixel , bytes , sizeof ( pixel ) ) ; <nl> return { Convert5To8 ( ( pixel > > 11 ) & 0x1F ) , Convert6To8 ( ( pixel > > 5 ) & 0x3F ) , <nl> inline Math : : Vec4 < u8 > DecodeRGB565 ( const u8 * bytes ) { <nl> / * * <nl> * Decode a color stored in RGB5A1 format <nl> * @ param bytes Pointer to encoded source color <nl> - * @ return Result color decoded as Math : : Vec4 < u8 > <nl> + * @ return Result color decoded as Common : : Vec4 < u8 > <nl> * / <nl> - inline Math : : Vec4 < u8 > DecodeRGB5A1 ( const u8 * bytes ) { <nl> + inline Common : : Vec4 < u8 > DecodeRGB5A1 ( const u8 * bytes ) { <nl> u16_le pixel ; <nl> std : : memcpy ( & pixel , bytes , sizeof ( pixel ) ) ; <nl> return { Convert5To8 ( ( pixel > > 11 ) & 0x1F ) , Convert5To8 ( ( pixel > > 6 ) & 0x1F ) , <nl> inline Math : : Vec4 < u8 > DecodeRGB5A1 ( const u8 * bytes ) { <nl> / * * <nl> * Decode a color stored in RGBA4 format <nl> * @ param bytes Pointer to encoded source color <nl> - * @ return Result color decoded as Math : : Vec4 < u8 > <nl> + * @ return Result color decoded as Common : : Vec4 < u8 > <nl> * / <nl> - inline Math : : Vec4 < u8 > DecodeRGBA4 ( const u8 * bytes ) { <nl> + inline Common : : Vec4 < u8 > DecodeRGBA4 ( const u8 * bytes ) { <nl> u16_le pixel ; <nl> std : : memcpy ( & pixel , bytes , sizeof ( pixel ) ) ; <nl> return { Convert4To8 ( ( pixel > > 12 ) & 0xF ) , Convert4To8 ( ( pixel > > 8 ) & 0xF ) , <nl> inline u32 DecodeD24 ( const u8 * bytes ) { <nl> / * * <nl> * Decode a depth value and a stencil value stored in D24S8 format <nl> * @ param bytes Pointer to encoded source values <nl> - * @ return Resulting values stored as a Math : : Vec2 <nl> + * @ return Resulting values stored as a Common : : Vec2 <nl> * / <nl> - inline Math : : Vec2 < u32 > DecodeD24S8 ( const u8 * bytes ) { <nl> + inline Common : : Vec2 < u32 > DecodeD24S8 ( const u8 * bytes ) { <nl> return { static_cast < u32 > ( ( bytes [ 2 ] < < 16 ) | ( bytes [ 1 ] < < 8 ) | bytes [ 0 ] ) , bytes [ 3 ] } ; <nl> } <nl> <nl> inline Math : : Vec2 < u32 > DecodeD24S8 ( const u8 * bytes ) { <nl> * @ param color Source color to encode <nl> * @ param bytes Destination pointer to store encoded color <nl> * / <nl> - inline void EncodeRGBA8 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> + inline void EncodeRGBA8 ( const Common : : Vec4 < u8 > & color , u8 * bytes ) { <nl> bytes [ 3 ] = color . r ( ) ; <nl> bytes [ 2 ] = color . g ( ) ; <nl> bytes [ 1 ] = color . b ( ) ; <nl> inline void EncodeRGBA8 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> * @ param color Source color to encode <nl> * @ param bytes Destination pointer to store encoded color <nl> * / <nl> - inline void EncodeRGB8 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> + inline void EncodeRGB8 ( const Common : : Vec4 < u8 > & color , u8 * bytes ) { <nl> bytes [ 2 ] = color . r ( ) ; <nl> bytes [ 1 ] = color . g ( ) ; <nl> bytes [ 0 ] = color . b ( ) ; <nl> inline void EncodeRGB8 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> * @ param color Source color to encode <nl> * @ param bytes Destination pointer to store encoded color <nl> * / <nl> - inline void EncodeRG8 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> + inline void EncodeRG8 ( const Common : : Vec4 < u8 > & color , u8 * bytes ) { <nl> bytes [ 1 ] = color . r ( ) ; <nl> bytes [ 0 ] = color . g ( ) ; <nl> } <nl> inline void EncodeRG8 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> * @ param color Source color to encode <nl> * @ param bytes Destination pointer to store encoded color <nl> * / <nl> - inline void EncodeRGB565 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> + inline void EncodeRGB565 ( const Common : : Vec4 < u8 > & color , u8 * bytes ) { <nl> const u16_le data = <nl> ( Convert8To5 ( color . r ( ) ) < < 11 ) | ( Convert8To6 ( color . g ( ) ) < < 5 ) | Convert8To5 ( color . b ( ) ) ; <nl> <nl> inline void EncodeRGB565 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> * @ param color Source color to encode <nl> * @ param bytes Destination pointer to store encoded color <nl> * / <nl> - inline void EncodeRGB5A1 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> + inline void EncodeRGB5A1 ( const Common : : Vec4 < u8 > & color , u8 * bytes ) { <nl> const u16_le data = ( Convert8To5 ( color . r ( ) ) < < 11 ) | ( Convert8To5 ( color . g ( ) ) < < 6 ) | <nl> ( Convert8To5 ( color . b ( ) ) < < 1 ) | Convert8To1 ( color . a ( ) ) ; <nl> <nl> inline void EncodeRGB5A1 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> * @ param color Source color to encode <nl> * @ param bytes Destination pointer to store encoded color <nl> * / <nl> - inline void EncodeRGBA4 ( const Math : : Vec4 < u8 > & color , u8 * bytes ) { <nl> + inline void EncodeRGBA4 ( const Common : : Vec4 < u8 > & color , u8 * bytes ) { <nl> const u16 data = ( Convert8To4 ( color . r ( ) ) < < 12 ) | ( Convert8To4 ( color . g ( ) ) < < 8 ) | <nl> ( Convert8To4 ( color . b ( ) ) < < 4 ) | Convert8To4 ( color . a ( ) ) ; <nl> <nl> mmm a / src / common / quaternion . h <nl> ppp b / src / common / quaternion . h <nl> namespace Common { <nl> template < typename T > <nl> class Quaternion { <nl> public : <nl> - Math : : Vec3 < T > xyz ; <nl> + Vec3 < T > xyz ; <nl> T w { } ; <nl> <nl> Quaternion < decltype ( - T { } ) > Inverse ( ) const { <nl> class Quaternion { <nl> } ; <nl> <nl> template < typename T > <nl> - auto QuaternionRotate ( const Quaternion < T > & q , const Math : : Vec3 < T > & v ) { <nl> + auto QuaternionRotate ( const Quaternion < T > & q , const Vec3 < T > & v ) { <nl> return v + 2 * Cross ( q . xyz , Cross ( q . xyz , v ) + v * q . w ) ; <nl> } <nl> <nl> - inline Quaternion < float > MakeQuaternion ( const Math : : Vec3 < float > & axis , float angle ) { <nl> + inline Quaternion < float > MakeQuaternion ( const Vec3 < float > & axis , float angle ) { <nl> return { axis * std : : sin ( angle / 2 ) , std : : cos ( angle / 2 ) } ; <nl> } <nl> <nl> mmm a / src / common / vector_math . h <nl> ppp b / src / common / vector_math . h <nl> <nl> # include < cmath > <nl> # include < type_traits > <nl> <nl> - namespace Math { <nl> + namespace Common { <nl> <nl> template < typename T > <nl> class Vec2 ; <nl> constexpr Vec4 < T > MakeVec ( const T & x , const Vec3 < T > & yzw ) { <nl> return MakeVec ( x , yzw [ 0 ] , yzw [ 1 ] , yzw [ 2 ] ) ; <nl> } <nl> <nl> - } / / namespace Math <nl> + } / / namespace Common <nl> mmm a / src / core / frontend / input . h <nl> ppp b / src / core / frontend / input . h <nl> using AnalogDevice = InputDevice < std : : tuple < float , float > > ; <nl> * Orientation is determined by right - hand rule . <nl> * Units : deg / sec <nl> * / <nl> - using MotionDevice = InputDevice < std : : tuple < Math : : Vec3 < float > , Math : : Vec3 < float > > > ; <nl> + using MotionDevice = InputDevice < std : : tuple < Common : : Vec3 < float > , Common : : Vec3 < float > > > ; <nl> <nl> / * * <nl> * A touch device is an input device that returns a tuple of two floats and a bool . The floats are <nl> mmm a / src / input_common / motion_emu . cpp <nl> ppp b / src / input_common / motion_emu . cpp <nl> class MotionEmuDevice { <nl> } <nl> <nl> void BeginTilt ( int x , int y ) { <nl> - mouse_origin = Math : : MakeVec ( x , y ) ; <nl> + mouse_origin = Common : : MakeVec ( x , y ) ; <nl> is_tilting = true ; <nl> } <nl> <nl> void Tilt ( int x , int y ) { <nl> - auto mouse_move = Math : : MakeVec ( x , y ) - mouse_origin ; <nl> + auto mouse_move = Common : : MakeVec ( x , y ) - mouse_origin ; <nl> if ( is_tilting ) { <nl> std : : lock_guard < std : : mutex > guard ( tilt_mutex ) ; <nl> if ( mouse_move . x = = 0 & & mouse_move . y = = 0 ) { <nl> class MotionEmuDevice { <nl> is_tilting = false ; <nl> } <nl> <nl> - std : : tuple < Math : : Vec3 < float > , Math : : Vec3 < float > > GetStatus ( ) { <nl> + std : : tuple < Common : : Vec3 < float > , Common : : Vec3 < float > > GetStatus ( ) { <nl> std : : lock_guard < std : : mutex > guard ( status_mutex ) ; <nl> return status ; <nl> } <nl> class MotionEmuDevice { <nl> const std : : chrono : : steady_clock : : duration update_duration ; <nl> const float sensitivity ; <nl> <nl> - Math : : Vec2 < int > mouse_origin ; <nl> + Common : : Vec2 < int > mouse_origin ; <nl> <nl> std : : mutex tilt_mutex ; <nl> - Math : : Vec2 < float > tilt_direction ; <nl> + Common : : Vec2 < float > tilt_direction ; <nl> float tilt_angle = 0 ; <nl> <nl> bool is_tilting = false ; <nl> <nl> Common : : Event shutdown_event ; <nl> <nl> - std : : tuple < Math : : Vec3 < float > , Math : : Vec3 < float > > status ; <nl> + std : : tuple < Common : : Vec3 < float > , Common : : Vec3 < float > > status ; <nl> std : : mutex status_mutex ; <nl> <nl> / / Note : always keep the thread declaration at the end so that other objects are initialized <nl> class MotionEmuDevice { <nl> <nl> void MotionEmuThread ( ) { <nl> auto update_time = std : : chrono : : steady_clock : : now ( ) ; <nl> - Common : : Quaternion < float > q = Common : : MakeQuaternion ( Math : : Vec3 < float > ( ) , 0 ) ; <nl> + Common : : Quaternion < float > q = Common : : MakeQuaternion ( Common : : Vec3 < float > ( ) , 0 ) ; <nl> Common : : Quaternion < float > old_q ; <nl> <nl> while ( ! shutdown_event . WaitUntil ( update_time ) ) { <nl> class MotionEmuDevice { <nl> std : : lock_guard < std : : mutex > guard ( tilt_mutex ) ; <nl> <nl> / / Find the quaternion describing current 3DS tilting <nl> - q = Common : : MakeQuaternion ( Math : : MakeVec ( - tilt_direction . y , 0 . 0f , tilt_direction . x ) , <nl> - tilt_angle ) ; <nl> + q = Common : : MakeQuaternion ( <nl> + Common : : MakeVec ( - tilt_direction . y , 0 . 0f , tilt_direction . x ) , tilt_angle ) ; <nl> } <nl> <nl> auto inv_q = q . Inverse ( ) ; <nl> <nl> / / Set the gravity vector in world space <nl> - auto gravity = Math : : MakeVec ( 0 . 0f , - 1 . 0f , 0 . 0f ) ; <nl> + auto gravity = Common : : MakeVec ( 0 . 0f , - 1 . 0f , 0 . 0f ) ; <nl> <nl> / / Find the angular rate vector in world space <nl> auto angular_rate = ( ( q - old_q ) * inv_q ) . xyz * 2 ; <nl> class MotionEmuDeviceWrapper : public Input : : MotionDevice { <nl> device = std : : make_shared < MotionEmuDevice > ( update_millisecond , sensitivity ) ; <nl> } <nl> <nl> - std : : tuple < Math : : Vec3 < float > , Math : : Vec3 < float > > GetStatus ( ) const override { <nl> + std : : tuple < Common : : Vec3 < float > , Common : : Vec3 < float > > GetStatus ( ) const override { <nl> return device - > GetStatus ( ) ; <nl> } <nl> <nl> mmm a / src / yuzu / debugger / graphics / graphics_surface . cpp <nl> ppp b / src / yuzu / debugger / graphics / graphics_surface . cpp <nl> void GraphicsSurfaceWidget : : OnUpdate ( ) { <nl> <nl> for ( unsigned int y = 0 ; y < surface_height ; + + y ) { <nl> for ( unsigned int x = 0 ; x < surface_width ; + + x ) { <nl> - Math : : Vec4 < u8 > color ; <nl> + Common : : Vec4 < u8 > color ; <nl> color [ 0 ] = texture_data [ x + y * surface_width + 0 ] ; <nl> color [ 1 ] = texture_data [ x + y * surface_width + 1 ] ; <nl> color [ 2 ] = texture_data [ x + y * surface_width + 2 ] ; <nl>
|
common / vector_math : Move Vec [ x ] types into the Common namespace
|
yuzu-emu/yuzu
|
1b855efd5eb21ef802d15f6a531878754904ad4d
|
2019-02-27T03:38:36Z
|
mmm a / THLapack . h <nl> ppp b / THLapack . h <nl> <nl> # include " THGeneral . h " <nl> <nl> # define THLapack_ ( NAME ) TH_CONCAT_4 ( TH , Real , Lapack_ , NAME ) <nl> + # define THLapackCheck ( fmt , func , info , . . . ) \ <nl> + if ( info < 0 ) { \ <nl> + THError ( " Lapack Error in % s : Illegal Argument % d " , func , - info ) ; \ <nl> + } else if ( info > 0 ) { \ <nl> + THError ( fmt , func , info , # # __VA_ARGS__ ) ; \ <nl> + } \ <nl> + <nl> + <nl> <nl> # include " generic / THLapack . h " <nl> # include " THGenerateAllTypes . h " <nl> mmm a / generic / THTensorLapack . c <nl> ppp b / generic / THTensorLapack . c <nl> <nl> / * <nl> Check if self is transpose of a contiguous matrix <nl> * / <nl> - static int THTensor_ ( isTransposed ) ( THTensor * self ) <nl> + static int THTensor_ ( isTransposedContiguous ) ( THTensor * self ) <nl> { <nl> return self - > stride [ 0 ] = = 1 & & self - > stride [ 1 ] = = self - > size [ 0 ] ; <nl> } <nl> static void THTensor_ ( checkTransposed ) ( THTensor * self ) <nl> return ; <nl> } <nl> / * <nl> + newContiguous followed by transpose <nl> Similar to ( newContiguous ) , but checks if the transpose of the matrix <nl> - is contiguous and also limited to 2D matrices <nl> + is contiguous and also limited to 2D matrices . <nl> * / <nl> static THTensor * THTensor_ ( newTransposedContiguous ) ( THTensor * self ) <nl> { <nl> THTensor * tensor ; <nl> - if ( THTensor_ ( isTransposed ) ( self ) ) <nl> + if ( THTensor_ ( isTransposedContiguous ) ( self ) ) <nl> { <nl> THTensor_ ( retain ) ( self ) ; <nl> tensor = self ; <nl> static THTensor * THTensor_ ( newTransposedContiguous ) ( THTensor * self ) <nl> } <nl> <nl> / * <nl> - Puts a row - major version of m ( suitable as an input for Lapack ) with the specified number of rows into the <nl> - storage of r_ . If r_ is already row - major and has the correct number of rows , then r_ becomes a tensor <nl> - pointing at the storage of m , and the function returns 0 . Otherwise , r_ is resized and filled with a <nl> - row - major copy of m ; the function then returns 1 . <nl> + Given the result tensor and src tensor , decide if the lapack call should use the <nl> + provided result tensor or should allocate a new space to put the result in . <nl> + <nl> + The returned tensor have to be freed by the calling function . <nl> + <nl> + nrows is required , because some lapack calls , require output space smaller than <nl> + input space , like underdetermined gels . <nl> * / <nl> - static int THTensor_ ( lapackCloneNrows ) ( THTensor * r_ , THTensor * m , int forced , int nrows ) <nl> + static THTensor * THTensor_ ( checkLapackClone ) ( THTensor * result , THTensor * src , int nrows ) <nl> { <nl> - int clone ; <nl> + / * check if user wants to reuse src and if it is correct shape / size * / <nl> + if ( src = = result & & THTensor_ ( isTransposedContiguous ) ( src ) & & src - > size [ 1 ] = = nrows ) <nl> + THTensor_ ( retain ) ( result ) ; <nl> + else if ( src = = result | | result = = NULL ) / * in this case , user wants reuse of src , but its structure is not OK * / <nl> + result = THTensor_ ( new ) ( ) ; <nl> + else <nl> + THTensor_ ( retain ) ( result ) ; <nl> + return result ; <nl> + } <nl> <nl> - if ( ! forced & & THTensor_ ( isTransposed ) ( m ) & & m - > size [ 1 ] = = nrows ) <nl> - { <nl> - clone = 0 ; <nl> - THTensor_ ( set ) ( r_ , m ) ; <nl> - } <nl> + / * <nl> + Same as cloneColumnMajor , but accepts nrows argument , because some lapack calls require <nl> + the resulting tensor to be larger than src . <nl> + * / <nl> + static THTensor * THTensor_ ( cloneColumnMajorNrows ) ( THTensor * self , THTensor * src , int nrows ) <nl> + { <nl> + THTensor * result ; <nl> + THTensor * view ; <nl> + <nl> + if ( src = = NULL ) <nl> + src = self ; <nl> + result = THTensor_ ( checkLapackClone ) ( self , src , nrows ) ; <nl> + if ( src = = result ) <nl> + return result ; <nl> + <nl> + THTensor_ ( resize2d ) ( result , src - > size [ 1 ] , nrows ) ; <nl> + THTensor_ ( checkTransposed ) ( result ) ; <nl> + <nl> + if ( src - > size [ 0 ] = = nrows ) <nl> + THTensor_ ( copy ) ( result , src ) ; <nl> else <nl> { <nl> - clone = 1 ; <nl> - THTensor_ ( resize2d ) ( r_ , m - > size [ 1 ] , nrows ) ; <nl> - THTensor_ ( checkTransposed ) ( r_ ) ; <nl> - / * we need to copy * / <nl> - if ( m - > size [ 0 ] = = nrows ) { <nl> - THTensor_ ( copy ) ( r_ , m ) ; <nl> - } else { <nl> - THTensor * r_view = THTensor_ ( newNarrow ) ( r_ , 0 , 0 , m - > size [ 0 ] ) ; <nl> - THTensor_ ( copy ) ( r_view , m ) ; <nl> - THTensor_ ( free ) ( r_view ) ; <nl> - } <nl> + view = THTensor_ ( newNarrow ) ( result , 0 , 0 , src - > size [ 0 ] ) ; <nl> + THTensor_ ( copy ) ( view , src ) ; <nl> + THTensor_ ( free ) ( view ) ; <nl> } <nl> - return clone ; <nl> + return result ; <nl> } <nl> <nl> - static int THTensor_ ( lapackClone ) ( THTensor * r_ , THTensor * m , int forced ) <nl> + / * <nl> + Create a clone of src in self column major order for use with Lapack . <nl> + If src = = self , a new tensor is allocated , in any case , the return tensor should be <nl> + freed by calling function . <nl> + * / <nl> + static THTensor * THTensor_ ( cloneColumnMajor ) ( THTensor * self , THTensor * src ) <nl> { <nl> - return THTensor_ ( lapackCloneNrows ) ( r_ , m , forced , m - > size [ 0 ] ) ; <nl> + return THTensor_ ( cloneColumnMajorNrows ) ( self , src , src - > size [ 0 ] ) ; <nl> } <nl> <nl> void THTensor_ ( gesv ) ( THTensor * rb_ , THTensor * ra_ , THTensor * b , THTensor * a ) <nl> { <nl> + if ( a = = NULL ) a = ra_ ; <nl> + if ( b = = NULL ) b = rb_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( b - > nDimension = = 2 , 1 , " B should be 2 dimensional " ) ; <nl> + THArgCheck ( a - > size [ 0 ] = = a - > size [ 1 ] , 2 , " A should be square " ) ; <nl> + THArgCheck ( a - > size [ 0 ] = = b - > size [ 0 ] , 2 , " A , b size incompatible " ) ; <nl> + <nl> int n , nrhs , lda , ldb , info ; <nl> THIntTensor * ipiv ; <nl> THTensor * ra__ ; / / working version of A matrix to be passed into lapack GELS <nl> THTensor * rb__ ; / / working version of B matrix to be passed into lapack GELS <nl> <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int cloneb ; / / set to 1 if rb__ should be copied into rb_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> - int destroyb ; / / set to 1 if rb__ needs to be destroyed at return <nl> - <nl> - <nl> - if ( a = = NULL | | ra_ = = a ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else / * we want to definitely clone and use ra_ as computational space * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> - if ( b = = NULL | | rb_ = = b ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( rb_ - > nDimension = = 2 , 2 , " B should be 2 dimensional " ) ; <nl> - rb__ = THTensor_ ( new ) ( ) ; <nl> - cloneb = THTensor_ ( lapackClone ) ( rb__ , rb_ , 0 ) ; <nl> - destroyb = 1 ; <nl> - } <nl> - else / * we want to definitely clone and use rb_ as computational space * / <nl> - { <nl> - THArgCheck ( b - > nDimension = = 2 , 2 , " B should be 2 dimensional " ) ; <nl> - cloneb = THTensor_ ( lapackClone ) ( rb_ , b , 1 ) ; <nl> - rb__ = rb_ ; <nl> - destroyb = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - THArgCheck ( rb__ - > nDimension = = 2 , 2 , " b should be 2 dimensional " ) ; <nl> - THArgCheck ( ra__ - > size [ 0 ] = = ra__ - > size [ 1 ] , 1 , " A should be square " ) ; <nl> - THArgCheck ( rb__ - > size [ 0 ] = = ra__ - > size [ 0 ] , 2 , " A , b size incompatible " ) ; <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> + rb__ = THTensor_ ( cloneColumnMajor ) ( rb_ , b ) ; <nl> <nl> n = ( int ) ra__ - > size [ 0 ] ; <nl> nrhs = ( int ) rb__ - > size [ 1 ] ; <nl> void THTensor_ ( gesv ) ( THTensor * rb_ , THTensor * ra_ , THTensor * b , THTensor * a ) <nl> THTensor_ ( data ) ( ra__ ) , lda , THIntTensor_data ( ipiv ) , <nl> THTensor_ ( data ) ( rb__ ) , ldb , & info ) ; <nl> <nl> - / * clean up * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> - if ( destroyb ) <nl> - { <nl> - if ( cloneb ) <nl> - { <nl> - THTensor_ ( copy ) ( rb_ , rb__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( rb__ ) ; <nl> - } <nl> - <nl> - if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack gesv : Argument % d : illegal value " , - info ) ; <nl> - } <nl> - else if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack gesv : U ( % d , % d ) is zero , singular U . " , info , info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error in % s : U ( % d , % d ) is zero , singular U . " , " gesv " , info , info ) ; <nl> <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> + THTensor_ ( freeCopyTo ) ( rb__ , rb_ ) ; <nl> THIntTensor_free ( ipiv ) ; <nl> } <nl> <nl> void THTensor_ ( trtrs ) ( THTensor * rb_ , THTensor * ra_ , THTensor * b , THTensor * a , <nl> const char * uplo , const char * trans , const char * diag ) <nl> { <nl> + if ( a = = NULL ) a = ra_ ; <nl> + if ( b = = NULL ) b = rb_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( b - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( a - > size [ 0 ] = = a - > size [ 1 ] , 2 , " A should be square " ) ; <nl> + THArgCheck ( b - > size [ 0 ] = = a - > size [ 0 ] , 2 , " A , b size incompatible " ) ; <nl> + <nl> int n , nrhs , lda , ldb , info ; <nl> THTensor * ra__ ; / / working version of A matrix to be passed into lapack TRTRS <nl> THTensor * rb__ ; / / working version of B matrix to be passed into lapack TRTRS <nl> <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int cloneb ; / / set to 1 if rb__ should be copied into rb_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> - int destroyb ; / / set to 1 if rb__ needs to be destroyed at return <nl> - <nl> - <nl> - if ( a = = NULL | | ra_ = = a ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else / * we want to clone and use ra_ as computational space * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> - if ( b = = NULL | | rb_ = = b ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( rb_ - > nDimension = = 2 , 2 , " B should be 2 dimensional " ) ; <nl> - rb__ = THTensor_ ( new ) ( ) ; <nl> - cloneb = THTensor_ ( lapackClone ) ( rb__ , rb_ , 0 ) ; <nl> - destroyb = 1 ; <nl> - } <nl> - else / * we want to clone and use rb_ as computational space * / <nl> - { <nl> - THArgCheck ( b - > nDimension = = 2 , 2 , " B should be 2 dimensional " ) ; <nl> - cloneb = THTensor_ ( lapackClone ) ( rb_ , b , 1 ) ; <nl> - rb__ = rb_ ; <nl> - destroyb = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - THArgCheck ( rb__ - > nDimension = = 2 , 2 , " b should be 2 dimensional " ) ; <nl> - THArgCheck ( ra__ - > size [ 0 ] = = ra__ - > size [ 1 ] , 1 , " A should be square " ) ; <nl> - THArgCheck ( rb__ - > size [ 0 ] = = ra__ - > size [ 0 ] , 2 , " A , b size incompatible " ) ; <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> + rb__ = THTensor_ ( cloneColumnMajor ) ( rb_ , b ) ; <nl> <nl> n = ( int ) ra__ - > size [ 0 ] ; <nl> nrhs = ( int ) rb__ - > size [ 1 ] ; <nl> void THTensor_ ( trtrs ) ( THTensor * rb_ , THTensor * ra_ , THTensor * b , THTensor * a , <nl> THTensor_ ( data ) ( ra__ ) , lda , <nl> THTensor_ ( data ) ( rb__ ) , ldb , & info ) ; <nl> <nl> - / * clean up * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> - if ( destroyb ) <nl> - { <nl> - if ( cloneb ) <nl> - { <nl> - THTensor_ ( copy ) ( rb_ , rb__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( rb__ ) ; <nl> - } <nl> <nl> - if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack trtrs : Argument % d : illegal value " , - info ) ; <nl> - } <nl> - else if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack trtrs : A ( % d , % d ) is zero , singular A . " , info , info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error in % s : A ( % d , % d ) is zero , singular A " , " trtrs " , info , info ) ; <nl> + <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> + THTensor_ ( freeCopyTo ) ( rb__ , rb_ ) ; <nl> } <nl> <nl> void THTensor_ ( gels ) ( THTensor * rb_ , THTensor * ra_ , THTensor * b , THTensor * a ) <nl> { <nl> / / Note that a = NULL is interpreted as a = ra_ , and b = NULL as b = rb_ . <nl> + if ( a = = NULL ) a = ra_ ; <nl> + if ( b = = NULL ) b = rb_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( b - > nDimension = = 2 , 1 , " B should be 2 dimensional " ) ; <nl> + THArgCheck ( a - > size [ 0 ] = = b - > size [ 0 ] , 2 , " size incompatible A , b " ) ; <nl> + <nl> int m , n , nrhs , lda , ldb , info , lwork ; <nl> THTensor * work = NULL ; <nl> real wkopt = 0 ; <nl> <nl> - THTensor * ra__ ; / / working version of A matrix to be passed into lapack GELS <nl> - THTensor * rb__ ; / / working version of B matrix to be passed into lapack GELS <nl> - <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int cloneb ; / / set to 1 if rb__ should be copied into rb_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> - int destroyb ; / / set to 1 if rb__ needs to be destroyed at return <nl> - <nl> + THTensor * ra__ = NULL ; / / working version of A matrix to be passed into lapack GELS <nl> + THTensor * rb__ = NULL ; / / working version of B matrix to be passed into lapack GELS <nl> <nl> - if ( a = = NULL | | ra_ = = a ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else / * we want to definitely clone and use ra_ as computational space * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> <nl> m = ra__ - > size [ 0 ] ; <nl> n = ra__ - > size [ 1 ] ; <nl> lda = m ; <nl> ldb = ( m > n ) ? m : n ; <nl> <nl> - if ( b = = NULL | | rb_ = = b ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( rb_ - > nDimension = = 2 , 2 , " B should be 2 dimensional " ) ; <nl> - THArgCheck ( ra_ - > size [ 0 ] = = rb_ - > size [ 0 ] , 2 , " size incompatible A , b " ) ; <nl> - rb__ = THTensor_ ( new ) ( ) ; <nl> - cloneb = THTensor_ ( lapackCloneNrows ) ( rb__ , rb_ , 0 , ldb ) ; <nl> - destroyb = 1 ; <nl> - } <nl> - else / * we want to definitely clone and use rb_ as computational space * / <nl> - { <nl> - THArgCheck ( ra_ - > size [ 0 ] = = b - > size [ 0 ] , 2 , " size incompatible A , b " ) ; <nl> - THArgCheck ( b - > nDimension = = 2 , 2 , " B should be 2 dimensional " ) ; <nl> - cloneb = THTensor_ ( lapackCloneNrows ) ( rb_ , b , 1 , ldb ) ; <nl> - rb__ = rb_ ; <nl> - destroyb = 0 ; <nl> - } <nl> + rb__ = THTensor_ ( cloneColumnMajorNrows ) ( rb_ , b , ldb ) ; <nl> <nl> nrhs = rb__ - > size [ 1 ] ; <nl> info = 0 ; <nl> <nl> + <nl> / * get optimal workspace size * / <nl> THLapack_ ( gels ) ( ' N ' , m , n , nrhs , THTensor_ ( data ) ( ra__ ) , lda , <nl> THTensor_ ( data ) ( rb__ ) , ldb , <nl> void THTensor_ ( gels ) ( THTensor * rb_ , THTensor * ra_ , THTensor * b , THTensor * a ) <nl> THTensor_ ( data ) ( rb__ ) , ldb , <nl> THTensor_ ( data ) ( work ) , lwork , & info ) ; <nl> <nl> - / * printf ( " lwork = % d , % g \ n " , lwork , THTensor_ ( data ) ( work ) [ 0 ] ) ; * / <nl> - if ( info ! = 0 ) <nl> - { <nl> - THError ( " Lapack gels : Argument % d : illegal value " , - info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error in % s : The % d - th diagonal element of the triangular factor of A is zero " , " gels " , info ) ; <nl> <nl> / * rb__ is currently ldb by nrhs ; resize it to n by nrhs * / <nl> rb__ - > size [ 0 ] = n ; <nl> + if ( rb__ ! = rb_ ) <nl> + THTensor_ ( resize2d ) ( rb_ , n , nrhs ) ; <nl> <nl> - / * clean up * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> - if ( destroyb ) <nl> - { <nl> - if ( cloneb ) <nl> - { <nl> - THTensor_ ( resize2d ) ( rb_ , n , nrhs ) ; <nl> - THTensor_ ( copy ) ( rb_ , rb__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( rb__ ) ; <nl> - } <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> + THTensor_ ( freeCopyTo ) ( rb__ , rb_ ) ; <nl> THTensor_ ( free ) ( work ) ; <nl> } <nl> <nl> void THTensor_ ( geev ) ( THTensor * re_ , THTensor * rv_ , THTensor * a_ , const char * job <nl> THTensor * re__ = NULL ; <nl> THTensor * rv__ = NULL ; <nl> <nl> - THArgCheck ( a_ - > nDimension = = 2 , 3 , " A should be 2 dimensional " ) ; <nl> - THArgCheck ( a_ - > size [ 0 ] = = a_ - > size [ 1 ] , 3 , " A should be square " ) ; <nl> + THArgCheck ( a_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( a_ - > size [ 0 ] = = a_ - > size [ 1 ] , 1 , " A should be square " ) ; <nl> <nl> - / * we want to definitely clone * / <nl> - a = THTensor_ ( new ) ( ) ; <nl> - THTensor_ ( lapackClone ) ( a , a_ , 1 ) ; <nl> + / * we want to definitely clone a_ for geev * / <nl> + a = THTensor_ ( cloneColumnMajor ) ( NULL , a_ ) ; <nl> <nl> n = a - > size [ 0 ] ; <nl> lda = n ; <nl> <nl> - wi = THTensor_ ( new ) ( ) ; <nl> - wr = THTensor_ ( new ) ( ) ; <nl> - THTensor_ ( resize2d ) ( re_ , n , 2 ) ; <nl> - THTensor_ ( resize1d ) ( wi , n ) ; <nl> - THTensor_ ( resize1d ) ( wr , n ) ; <nl> + wi = THTensor_ ( newWithSize1d ) ( n ) ; <nl> + wr = THTensor_ ( newWithSize1d ) ( n ) ; <nl> <nl> rv_data = NULL ; <nl> ldvr = 1 ; <nl> void THTensor_ ( geev ) ( THTensor * re_ , THTensor * rv_ , THTensor * a_ , const char * job <nl> rv_data = THTensor_ ( data ) ( rv__ ) ; <nl> ldvr = n ; <nl> } <nl> + THTensor_ ( resize2d ) ( re_ , n , 2 ) ; <nl> re__ = THTensor_ ( newContiguous ) ( re_ ) ; <nl> <nl> / * get optimal workspace size * / <nl> void THTensor_ ( geev ) ( THTensor * re_ , THTensor * rv_ , THTensor * a_ , const char * job <nl> THLapack_ ( geev ) ( ' N ' , jobvr [ 0 ] , n , THTensor_ ( data ) ( a ) , lda , THTensor_ ( data ) ( wr ) , THTensor_ ( data ) ( wi ) , <nl> NULL , 1 , rv_data , ldvr , THTensor_ ( data ) ( work ) , lwork , & info ) ; <nl> <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack geev : Failed to converge . % d off - diagonal elements of an didn ' t converge to zero " , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack geev : Argument % d : illegal value " , - info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error in % s : % d off - diagonal elements of an didn ' t converge to zero " , " geev " , info ) ; <nl> <nl> { <nl> real * re_data = THTensor_ ( data ) ( re__ ) ; <nl> void THTensor_ ( geev ) ( THTensor * re_ , THTensor * rv_ , THTensor * a_ , const char * job <nl> re_data [ 2 * i + 1 ] = wi_data [ i ] ; <nl> } <nl> } <nl> + <nl> if ( * jobvr = = ' V ' ) <nl> + { <nl> THTensor_ ( checkTransposed ) ( rv_ ) ; <nl> - <nl> - if ( * jobvr = = ' V ' & & rv__ ! = rv_ ) <nl> - THTensor_ ( copy ) ( rv_ , rv__ ) ; <nl> - if ( re__ ! = re_ ) <nl> - THTensor_ ( copy ) ( re_ , re__ ) ; <nl> - <nl> + THTensor_ ( freeCopyTo ) ( rv__ , rv_ ) ; <nl> + } <nl> + THTensor_ ( freeCopyTo ) ( re__ , re_ ) ; <nl> THTensor_ ( free ) ( a ) ; <nl> THTensor_ ( free ) ( wi ) ; <nl> THTensor_ ( free ) ( wr ) ; <nl> THTensor_ ( free ) ( work ) ; <nl> - THTensor_ ( free ) ( re__ ) ; <nl> - THTensor_ ( free ) ( rv__ ) ; <nl> } <nl> <nl> void THTensor_ ( syev ) ( THTensor * re_ , THTensor * rv_ , THTensor * a , const char * jobz , const char * uplo ) <nl> { <nl> + if ( a = = NULL ) a = rv_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + <nl> int n , lda , lwork , info ; <nl> THTensor * work ; <nl> real wkopt ; <nl> void THTensor_ ( syev ) ( THTensor * re_ , THTensor * rv_ , THTensor * a , const char * jobz <nl> THTensor * rv__ = NULL ; <nl> THTensor * re__ = NULL ; <nl> <nl> - int clonev ; / / set to 1 if rv__ should be copied into rv_ at return <nl> - int destroyv ; / / set to 1 if rv__ needs to be destroyed at return <nl> - <nl> - if ( a = = NULL ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( rv_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - rv__ = THTensor_ ( new ) ( ) ; <nl> - clonev = THTensor_ ( lapackClone ) ( rv__ , rv_ , 0 ) ; <nl> - destroyv = 1 ; <nl> - } <nl> - else / * we want to definitely clone and use ra_ and rb_ as computational space * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonev = THTensor_ ( lapackClone ) ( rv_ , a , 1 ) ; <nl> - rv__ = rv_ ; <nl> - destroyv = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( rv__ - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> + rv__ = THTensor_ ( cloneColumnMajor ) ( rv_ , a ) ; <nl> <nl> n = rv__ - > size [ 0 ] ; <nl> lda = n ; <nl> void THTensor_ ( syev ) ( THTensor * re_ , THTensor * rv_ , THTensor * a , const char * jobz <nl> THLapack_ ( syev ) ( jobz [ 0 ] , uplo [ 0 ] , n , THTensor_ ( data ) ( rv__ ) , lda , <nl> THTensor_ ( data ) ( re_ ) , THTensor_ ( data ) ( work ) , lwork , & info ) ; <nl> <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack syev : Failed to converge . % d off - diagonal elements of an didn ' t converge to zero " , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack syev : Argument % d : illegal value " , - info ) ; <nl> - } <nl> - / * clean up * / <nl> - if ( destroyv ) <nl> - { <nl> - if ( clonev ) <nl> - { <nl> - THTensor_ ( copy ) ( rv_ , rv__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( rv__ ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error % s : % d off - diagonal elements didn ' t converge to zero " , " syev " , info ) ; <nl> <nl> - if ( re__ ! = re_ ) <nl> - THTensor_ ( copy ) ( re_ , re__ ) ; <nl> - THTensor_ ( free ) ( re__ ) ; <nl> + THTensor_ ( freeCopyTo ) ( rv__ , rv_ ) ; <nl> + THTensor_ ( freeCopyTo ) ( re__ , re_ ) ; <nl> THTensor_ ( free ) ( work ) ; <nl> } <nl> <nl> void THTensor_ ( gesvd ) ( THTensor * ru_ , THTensor * rs_ , THTensor * rv_ , THTensor * a , <nl> <nl> void THTensor_ ( gesvd2 ) ( THTensor * ru_ , THTensor * rs_ , THTensor * rv_ , THTensor * ra_ , THTensor * a , const char * jobu ) <nl> { <nl> + if ( a = = NULL ) a = ra_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + <nl> int k , m , n , lda , ldu , ldvt , lwork , info ; <nl> THTensor * work ; <nl> real wkopt ; <nl> void THTensor_ ( gesvd2 ) ( THTensor * ru_ , THTensor * rs_ , THTensor * rv_ , THTensor * ra <nl> THTensor * rs__ = NULL ; <nl> THTensor * rv__ = NULL ; <nl> <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> - <nl> - if ( a = = NULL ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else / * we want to definitely clone * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> <nl> m = ra__ - > size [ 0 ] ; <nl> n = ra__ - > size [ 1 ] ; <nl> void THTensor_ ( gesvd2 ) ( THTensor * ru_ , THTensor * rs_ , THTensor * rv_ , THTensor * ra <nl> THTensor_ ( resize1d ) ( rs_ , k ) ; <nl> THTensor_ ( resize2d ) ( rv_ , ldvt , n ) ; <nl> if ( * jobu = = ' A ' ) <nl> - { <nl> THTensor_ ( resize2d ) ( ru_ , m , ldu ) ; <nl> - } <nl> else <nl> - { <nl> THTensor_ ( resize2d ) ( ru_ , k , ldu ) ; <nl> - } <nl> + <nl> THTensor_ ( checkTransposed ) ( ru_ ) ; <nl> <nl> / * guard against someone passing a correct size , but wrong stride * / <nl> void THTensor_ ( gesvd2 ) ( THTensor * ru_ , THTensor * rs_ , THTensor * rv_ , THTensor * ra <nl> ldu , <nl> THTensor_ ( data ) ( rv__ ) , ldvt , <nl> THTensor_ ( data ) ( work ) , lwork , & info ) ; <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack gesvd : % d superdiagonals failed to converge . " , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack gesvd : Argument % d : illegal value " , - info ) ; <nl> - } <nl> <nl> - / * put the results back * / <nl> - if ( ru__ ! = ru_ ) <nl> - THTensor_ ( copy ) ( ru_ , ru__ ) ; <nl> - if ( rs__ ! = rs_ ) <nl> - THTensor_ ( copy ) ( rs_ , rs__ ) ; <nl> - if ( rv__ ! = rv_ ) <nl> - THTensor_ ( copy ) ( rv_ , rv__ ) ; <nl> + THLapackCheck ( " Lapack Error % s : % d superdiagonals failed to converge . " , " gesvd " , info ) ; <nl> <nl> - / * clean up * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> + THTensor_ ( freeCopyTo ) ( ru__ , ru_ ) ; <nl> + THTensor_ ( freeCopyTo ) ( rs__ , rs_ ) ; <nl> + THTensor_ ( freeCopyTo ) ( rv__ , rv_ ) ; <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> THTensor_ ( free ) ( work ) ; <nl> - THTensor_ ( free ) ( ru__ ) ; <nl> - THTensor_ ( free ) ( rs__ ) ; <nl> - THTensor_ ( free ) ( rv__ ) ; <nl> } <nl> <nl> void THTensor_ ( getri ) ( THTensor * ra_ , THTensor * a ) <nl> { <nl> + if ( a = = NULL ) a = ra_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( a - > size [ 0 ] = = a - > size [ 1 ] , 1 , " A should be square " ) ; <nl> + <nl> int m , n , lda , info , lwork ; <nl> real wkopt ; <nl> THIntTensor * ipiv ; <nl> THTensor * work ; <nl> - THTensor * ra__ ; <nl> + THTensor * ra__ = NULL ; <nl> <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> <nl> - if ( a = = NULL ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else / * we want to definitely clone * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> m = ra__ - > size [ 0 ] ; <nl> n = ra__ - > size [ 1 ] ; <nl> - THArgCheck ( m = = n , 2 , " A should be square " ) ; <nl> lda = m ; <nl> ipiv = THIntTensor_newWithSize1d ( ( long ) m ) ; <nl> <nl> / * Run LU * / <nl> THLapack_ ( getrf ) ( n , n , THTensor_ ( data ) ( ra__ ) , lda , THIntTensor_data ( ipiv ) , & info ) ; <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack getrf : U ( % d , % d ) is 0 , U is singular " , info , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack getrf : Argument % d : illegal value " , - info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error % s : U ( % d , % d ) is 0 , U is singular " , " getrf " , info , info ) ; <nl> <nl> / * Run inverse * / <nl> THLapack_ ( getri ) ( n , THTensor_ ( data ) ( ra__ ) , lda , THIntTensor_data ( ipiv ) , & wkopt , - 1 , & info ) ; <nl> lwork = ( int ) wkopt ; <nl> work = THTensor_ ( newWithSize1d ) ( lwork ) ; <nl> THLapack_ ( getri ) ( n , THTensor_ ( data ) ( ra__ ) , lda , THIntTensor_data ( ipiv ) , THTensor_ ( data ) ( work ) , lwork , & info ) ; <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack getri : U ( % d , % d ) is 0 , U is singular " , info , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack getri : Argument % d : illegal value " , - info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error % s : U ( % d , % d ) is 0 , U is singular " , " getri " , info , info ) ; <nl> <nl> - / * clean up * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> THTensor_ ( free ) ( work ) ; <nl> THIntTensor_free ( ipiv ) ; <nl> } <nl> <nl> void THTensor_ ( potrf ) ( THTensor * ra_ , THTensor * a ) <nl> { <nl> + if ( a = = NULL ) a = ra_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( a - > size [ 0 ] = = a - > size [ 1 ] , 1 , " A should be square " ) ; <nl> + <nl> int n , lda , info ; <nl> char uplo = ' U ' ; <nl> - THTensor * ra__ ; <nl> + THTensor * ra__ = NULL ; <nl> <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> <nl> - if ( a = = NULL ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else / * we want to definitely clone * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> - THArgCheck ( ra__ - > size [ 0 ] = = ra__ - > size [ 1 ] , 2 , " A should be square " ) ; <nl> n = ra__ - > size [ 0 ] ; <nl> lda = n ; <nl> <nl> / * Run Factorization * / <nl> THLapack_ ( potrf ) ( uplo , n , THTensor_ ( data ) ( ra__ ) , lda , & info ) ; <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack potrf : A ( % d , % d ) is 0 , A cannot be factorized " , info , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack potrf : Argument % d : illegal value " , - info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error % s : A ( % d , % d ) is 0 , A cannot be factorized " , " potrf " , info , info ) ; <nl> <nl> / * Build full upper - triangular matrix * / <nl> { <nl> void THTensor_ ( potrf ) ( THTensor * ra_ , THTensor * a ) <nl> } <nl> } <nl> <nl> - / * clean up * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> } <nl> <nl> void THTensor_ ( potri ) ( THTensor * ra_ , THTensor * a ) <nl> { <nl> + if ( a = = NULL ) a = ra_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> + THArgCheck ( a - > size [ 0 ] = = a - > size [ 1 ] , 1 , " A should be square " ) ; <nl> + <nl> int n , lda , info ; <nl> char uplo = ' U ' ; <nl> - THTensor * ra__ ; <nl> + THTensor * ra__ = NULL ; <nl> <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> <nl> - if ( a = = NULL ) / * possibly destroy the inputs * / <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else / * we want to definitely clone * / <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> - <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> - THArgCheck ( ra__ - > size [ 0 ] = = ra__ - > size [ 1 ] , 2 , " A should be square " ) ; <nl> n = ra__ - > size [ 0 ] ; <nl> lda = n ; <nl> <nl> / * Run Factorization * / <nl> THLapack_ ( potrf ) ( uplo , n , THTensor_ ( data ) ( ra__ ) , lda , & info ) ; <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack potrf : A ( % d , % d ) is 0 , A cannot be factorized " , info , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack potrf : Argument % d : illegal value " , - info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error % s : A ( % d , % d ) is 0 , A cannot be factorized " , " potrf " , info , info ) ; <nl> <nl> / * Run inverse * / <nl> THLapack_ ( potri ) ( uplo , n , THTensor_ ( data ) ( ra__ ) , lda , & info ) ; <nl> - if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack potri : A ( % d , % d ) is 0 , A cannot be factorized " , info , info ) ; <nl> - } <nl> - else if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack potri : Argument % d : illegal value " , - info ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error % s : A ( % d , % d ) is 0 , A cannot be factorized " , " potri " , info , info ) ; <nl> <nl> / * Build full matrix * / <nl> { <nl> void THTensor_ ( potri ) ( THTensor * ra_ , THTensor * a ) <nl> } <nl> } <nl> <nl> - / * clean up * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> } <nl> <nl> / * <nl> void THTensor_ ( qr ) ( THTensor * rq_ , THTensor * rr_ , THTensor * a ) <nl> * / <nl> void THTensor_ ( geqrf ) ( THTensor * ra_ , THTensor * rtau_ , THTensor * a ) <nl> { <nl> - / * Prepare the input for LAPACK , making a copy if necessary . * / <nl> - THTensor * ra__ ; <nl> + if ( a = = NULL ) ra_ = a ; <nl> + THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> + THTensor * ra__ = NULL ; <nl> <nl> - if ( a = = NULL ) <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> + / * Prepare the input for LAPACK , making a copy if necessary . * / <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> <nl> - / * Check input sizes , and ensure we have space to store the results . * / <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> int m = ra__ - > size [ 0 ] ; <nl> int n = ra__ - > size [ 1 ] ; <nl> int k = ( m < n ? m : n ) ; <nl> void THTensor_ ( geqrf ) ( THTensor * ra_ , THTensor * rtau_ , THTensor * a ) <nl> THTensor_ ( data ) ( rtau_ ) , <nl> THTensor_ ( data ) ( work ) , lwork , & info ) ; <nl> <nl> - / * Clean up . * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( work ) ; <nl> + THLapackCheck ( " Lapack Error % s : unknown Lapack error . info = % i " , " geqrf " , info ) ; <nl> <nl> - / * Raise a Lua error , if a problem was signalled by LAPACK . * / <nl> - if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack geqrf : Argument % d : illegal value . " , - info ) ; <nl> - } <nl> - else if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack geqrf : unknown Lapack error . info = % i " , info ) ; <nl> - } <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> + THTensor_ ( free ) ( work ) ; <nl> } <nl> <nl> / * <nl> void THTensor_ ( geqrf ) ( THTensor * ra_ , THTensor * rtau_ , THTensor * a ) <nl> * / <nl> void THTensor_ ( orgqr ) ( THTensor * ra_ , THTensor * a , THTensor * tau ) <nl> { <nl> - / * Prepare the input for LAPACK , making a copy if necessary . * / <nl> - THTensor * ra__ ; <nl> - <nl> - int clonea ; / / set to 1 if ra__ should be copied into ra_ at return <nl> - int destroya ; / / set to 1 if ra__ needs to be destroyed at return <nl> + if ( a = = NULL ) a = ra_ ; <nl> + THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> <nl> - if ( a = = NULL ) <nl> - { <nl> - THArgCheck ( ra_ - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - ra__ = THTensor_ ( new ) ( ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra__ , ra_ , 0 ) ; <nl> - destroya = 1 ; <nl> - } <nl> - else <nl> - { <nl> - THArgCheck ( a - > nDimension = = 2 , 1 , " A should be 2 dimensional " ) ; <nl> - clonea = THTensor_ ( lapackClone ) ( ra_ , a , 1 ) ; <nl> - ra__ = ra_ ; <nl> - destroya = 0 ; <nl> - } <nl> + THTensor * ra__ = NULL ; <nl> + ra__ = THTensor_ ( cloneColumnMajor ) ( ra_ , a ) ; <nl> <nl> - / * Check input sizes . * / <nl> - THArgCheck ( ra__ - > nDimension = = 2 , 2 , " A should be 2 dimensional " ) ; <nl> int m = ra__ - > size [ 0 ] ; <nl> int n = ra__ - > size [ 1 ] ; <nl> int k = tau - > size [ 0 ] ; <nl> void THTensor_ ( orgqr ) ( THTensor * ra_ , THTensor * a , THTensor * tau ) <nl> THTensor_ ( data ) ( tau ) , <nl> THTensor_ ( data ) ( work ) , lwork , & info ) ; <nl> <nl> - / * Clean up . * / <nl> - if ( destroya ) <nl> - { <nl> - if ( clonea ) <nl> - { <nl> - THTensor_ ( copy ) ( ra_ , ra__ ) ; <nl> - } <nl> - THTensor_ ( free ) ( ra__ ) ; <nl> - } <nl> + THLapackCheck ( " Lapack Error % s : unknown Lapack error . info = % i " , " orgqr " , info ) ; <nl> + THTensor_ ( freeCopyTo ) ( ra__ , ra_ ) ; <nl> THTensor_ ( free ) ( work ) ; <nl> - <nl> - / * Raise a Lua error , if a problem was signalled by LAPACK . * / <nl> - if ( info < 0 ) <nl> - { <nl> - THError ( " Lapack orgqr : Argument % d : illegal value . " , - info ) ; <nl> - } <nl> - else if ( info > 0 ) <nl> - { <nl> - THError ( " Lapack orgqr : unknown Lapack error . info = % i " , info ) ; <nl> - } <nl> } <nl> <nl> # endif <nl>
|
Merge pull request from torch / lapack
|
pytorch/pytorch
|
3d6f2e3b68fea678954225df5c14fb71e7f30ab3
|
2015-08-22T01:56:15Z
|
mmm a / third_party / mlir / lib / Conversion / VectorToLLVM / ConvertVectorToLLVM . cpp <nl> ppp b / third_party / mlir / lib / Conversion / VectorToLLVM / ConvertVectorToLLVM . cpp <nl> static LLVM : : LLVMType getPtrToElementType ( T containerType , <nl> . getPointerTo ( ) ; <nl> } <nl> <nl> + / / Helper to reduce vector type by one rank at front . <nl> + static VectorType reducedVectorTypeFront ( VectorType tp ) { <nl> + assert ( ( tp . getRank ( ) > 1 ) & & " unlowerable vector type " ) ; <nl> + return VectorType : : get ( tp . getShape ( ) . drop_front ( ) , tp . getElementType ( ) ) ; <nl> + } <nl> + <nl> + / / Helper to reduce vector type by * all * but one rank at back . <nl> + static VectorType reducedVectorTypeBack ( VectorType tp ) { <nl> + assert ( ( tp . getRank ( ) > 1 ) & & " unlowerable vector type " ) ; <nl> + return VectorType : : get ( tp . getShape ( ) . take_back ( ) , tp . getElementType ( ) ) ; <nl> + } <nl> + <nl> class VectorBroadcastOpConversion : public LLVMOpLowering { <nl> public : <nl> explicit VectorBroadcastOpConversion ( MLIRContext * context , <nl> class VectorBroadcastOpConversion : public LLVMOpLowering { <nl> return rewriter . create < LLVM : : ShuffleVectorOp > ( <nl> loc , expand , undef , rewriter . getI32ArrayAttr ( zeroValues ) ) ; <nl> } <nl> - Value * expand = expandRanks ( value , loc , srcVectorType , <nl> - reducedVectorType ( dstVectorType ) , rewriter ) ; <nl> + Value * expand = <nl> + expandRanks ( value , loc , srcVectorType , <nl> + reducedVectorTypeFront ( dstVectorType ) , rewriter ) ; <nl> Value * result = rewriter . create < LLVM : : UndefOp > ( loc , llvmType ) ; <nl> for ( int64_t d = 0 ; d < dim ; + + d ) { <nl> result = insertOne ( result , expand , loc , llvmType , rank , d , rewriter ) ; <nl> class VectorBroadcastOpConversion : public LLVMOpLowering { <nl> result = insertOne ( result , one , loc , llvmType , rank , d , rewriter ) ; <nl> } <nl> } else { <nl> - VectorType redSrcType = reducedVectorType ( srcVectorType ) ; <nl> - VectorType redDstType = reducedVectorType ( dstVectorType ) ; <nl> + VectorType redSrcType = reducedVectorTypeFront ( srcVectorType ) ; <nl> + VectorType redDstType = reducedVectorTypeFront ( dstVectorType ) ; <nl> Type redLlvmType = lowering . convertType ( redSrcType ) ; <nl> for ( int64_t d = 0 ; d < dim ; + + d ) { <nl> int64_t pos = atStretch ? 0 : d ; <nl> class VectorBroadcastOpConversion : public LLVMOpLowering { <nl> return rewriter . create < LLVM : : ExtractValueOp > ( loc , llvmType , value , <nl> rewriter . getI64ArrayAttr ( pos ) ) ; <nl> } <nl> - <nl> - / / Helper to reduce vector type by one rank . <nl> - static VectorType reducedVectorType ( VectorType tp ) { <nl> - assert ( ( tp . getRank ( ) > 1 ) & & " unlowerable vector type " ) ; <nl> - return VectorType : : get ( tp . getShape ( ) . drop_front ( ) , tp . getElementType ( ) ) ; <nl> - } <nl> } ; <nl> <nl> - class VectorExtractElementOpConversion : public LLVMOpLowering { <nl> + class VectorExtractOpConversion : public LLVMOpLowering { <nl> public : <nl> - explicit VectorExtractElementOpConversion ( MLIRContext * context , <nl> - LLVMTypeConverter & typeConverter ) <nl> + explicit VectorExtractOpConversion ( MLIRContext * context , <nl> + LLVMTypeConverter & typeConverter ) <nl> : LLVMOpLowering ( vector : : ExtractOp : : getOperationName ( ) , context , <nl> typeConverter ) { } <nl> <nl> class VectorExtractElementOpConversion : public LLVMOpLowering { <nl> auto loc = op - > getLoc ( ) ; <nl> auto adaptor = vector : : ExtractOpOperandAdaptor ( operands ) ; <nl> auto extractOp = cast < vector : : ExtractOp > ( op ) ; <nl> - auto vectorType = extractOp . vector ( ) - > getType ( ) . cast < VectorType > ( ) ; <nl> + auto vectorType = extractOp . getVectorType ( ) ; <nl> auto resultType = extractOp . getResult ( ) - > getType ( ) ; <nl> auto llvmResultType = lowering . convertType ( resultType ) ; <nl> - <nl> auto positionArrayAttr = extractOp . position ( ) ; <nl> + <nl> + / / Bail if result type cannot be lowered . <nl> + if ( ! llvmResultType ) <nl> + return matchFailure ( ) ; <nl> + <nl> / / One - shot extraction of vector from array ( only requires extractvalue ) . <nl> if ( resultType . isa < VectorType > ( ) ) { <nl> Value * extracted = rewriter . create < LLVM : : ExtractValueOp > ( <nl> class VectorExtractElementOpConversion : public LLVMOpLowering { <nl> return matchSuccess ( ) ; <nl> } <nl> <nl> - / / Potential extraction of 1 - D vector from struct . <nl> + / / Potential extraction of 1 - D vector from array . <nl> auto * context = op - > getContext ( ) ; <nl> Value * extracted = adaptor . vector ( ) ; <nl> auto positionAttrs = positionArrayAttr . getValue ( ) ; <nl> - auto i32Type = rewriter . getIntegerType ( 32 ) ; <nl> if ( positionAttrs . size ( ) > 1 ) { <nl> - auto nDVectorType = vectorType ; <nl> - auto oneDVectorType = VectorType : : get ( nDVectorType . getShape ( ) . take_back ( ) , <nl> - nDVectorType . getElementType ( ) ) ; <nl> + auto oneDVectorType = reducedVectorTypeBack ( vectorType ) ; <nl> auto nMinusOnePositionAttrs = <nl> ArrayAttr : : get ( positionAttrs . drop_back ( ) , context ) ; <nl> extracted = rewriter . create < LLVM : : ExtractValueOp > ( <nl> class VectorExtractElementOpConversion : public LLVMOpLowering { <nl> <nl> / / Remaining extraction of element from 1 - D LLVM vector <nl> auto position = positionAttrs . back ( ) . cast < IntegerAttr > ( ) ; <nl> - auto constant = rewriter . create < LLVM : : ConstantOp > ( <nl> - loc , lowering . convertType ( i32Type ) , position ) ; <nl> + auto i32Type = LLVM : : LLVMType : : getInt32Ty ( lowering . getDialect ( ) ) ; <nl> + auto constant = rewriter . create < LLVM : : ConstantOp > ( loc , i32Type , position ) ; <nl> extracted = <nl> rewriter . create < LLVM : : ExtractElementOp > ( loc , extracted , constant ) ; <nl> rewriter . replaceOp ( op , extracted ) ; <nl> class VectorExtractElementOpConversion : public LLVMOpLowering { <nl> } <nl> } ; <nl> <nl> + class VectorInsertOpConversion : public LLVMOpLowering { <nl> + public : <nl> + explicit VectorInsertOpConversion ( MLIRContext * context , <nl> + LLVMTypeConverter & typeConverter ) <nl> + : LLVMOpLowering ( vector : : InsertOp : : getOperationName ( ) , context , <nl> + typeConverter ) { } <nl> + <nl> + PatternMatchResult <nl> + matchAndRewrite ( Operation * op , ArrayRef < Value * > operands , <nl> + ConversionPatternRewriter & rewriter ) const override { <nl> + auto loc = op - > getLoc ( ) ; <nl> + auto adaptor = vector : : InsertOpOperandAdaptor ( operands ) ; <nl> + auto insertOp = cast < vector : : InsertOp > ( op ) ; <nl> + auto sourceType = insertOp . getSourceType ( ) ; <nl> + auto destVectorType = insertOp . getDestVectorType ( ) ; <nl> + auto llvmResultType = lowering . convertType ( destVectorType ) ; <nl> + auto positionArrayAttr = insertOp . position ( ) ; <nl> + <nl> + / / Bail if result type cannot be lowered . <nl> + if ( ! llvmResultType ) <nl> + return matchFailure ( ) ; <nl> + <nl> + / / One - shot insertion of a vector into an array ( only requires insertvalue ) . <nl> + if ( sourceType . isa < VectorType > ( ) ) { <nl> + Value * inserted = rewriter . create < LLVM : : InsertValueOp > ( <nl> + loc , llvmResultType , adaptor . dest ( ) , adaptor . source ( ) , <nl> + positionArrayAttr ) ; <nl> + rewriter . replaceOp ( op , inserted ) ; <nl> + return matchSuccess ( ) ; <nl> + } <nl> + <nl> + / / Potential extraction of 1 - D vector from array . <nl> + auto * context = op - > getContext ( ) ; <nl> + Value * extracted = adaptor . dest ( ) ; <nl> + auto positionAttrs = positionArrayAttr . getValue ( ) ; <nl> + auto position = positionAttrs . back ( ) . cast < IntegerAttr > ( ) ; <nl> + auto oneDVectorType = destVectorType ; <nl> + if ( positionAttrs . size ( ) > 1 ) { <nl> + oneDVectorType = reducedVectorTypeBack ( destVectorType ) ; <nl> + auto nMinusOnePositionAttrs = <nl> + ArrayAttr : : get ( positionAttrs . drop_back ( ) , context ) ; <nl> + extracted = rewriter . create < LLVM : : ExtractValueOp > ( <nl> + loc , lowering . convertType ( oneDVectorType ) , extracted , <nl> + nMinusOnePositionAttrs ) ; <nl> + } <nl> + <nl> + / / Insertion of an element into a 1 - D LLVM vector . <nl> + auto i32Type = LLVM : : LLVMType : : getInt32Ty ( lowering . getDialect ( ) ) ; <nl> + auto constant = rewriter . create < LLVM : : ConstantOp > ( loc , i32Type , position ) ; <nl> + Value * inserted = rewriter . create < LLVM : : InsertElementOp > ( <nl> + loc , lowering . convertType ( oneDVectorType ) , extracted , adaptor . source ( ) , <nl> + constant ) ; <nl> + <nl> + / / Potential insertion of resulting 1 - D vector into array . <nl> + if ( positionAttrs . size ( ) > 1 ) { <nl> + auto nMinusOnePositionAttrs = <nl> + ArrayAttr : : get ( positionAttrs . drop_back ( ) , context ) ; <nl> + inserted = rewriter . create < LLVM : : InsertValueOp > ( loc , llvmResultType , <nl> + adaptor . dest ( ) , inserted , <nl> + nMinusOnePositionAttrs ) ; <nl> + } <nl> + <nl> + rewriter . replaceOp ( op , inserted ) ; <nl> + return matchSuccess ( ) ; <nl> + } <nl> + } ; <nl> + <nl> class VectorOuterProductOpConversion : public LLVMOpLowering { <nl> public : <nl> explicit VectorOuterProductOpConversion ( MLIRContext * context , <nl> class VectorTypeCastOpConversion : public LLVMOpLowering { <nl> / / / Populate the given list with patterns that convert from Vector to LLVM . <nl> void mlir : : populateVectorToLLVMConversionPatterns ( <nl> LLVMTypeConverter & converter , OwningRewritePatternList & patterns ) { <nl> - patterns . insert < VectorBroadcastOpConversion , VectorExtractElementOpConversion , <nl> - VectorOuterProductOpConversion , VectorTypeCastOpConversion > ( <nl> + patterns . insert < VectorBroadcastOpConversion , VectorExtractOpConversion , <nl> + VectorInsertOpConversion , VectorOuterProductOpConversion , <nl> + VectorTypeCastOpConversion > ( <nl> converter . getDialect ( ) - > getContext ( ) , converter ) ; <nl> } <nl> <nl>
|
[ VectorOps ] Add lowering of vector . insert to LLVM IR
|
tensorflow/tensorflow
|
36f078efd1ad0690e79f7469c19f35cdf536532a
|
2019-12-11T01:16:03Z
|
mmm a / src / mongo / dbtests / storage_timestamp_tests . cpp <nl> ppp b / src / mongo / dbtests / storage_timestamp_tests . cpp <nl> class TimestampMultiIndexBuilds : public StorageTimestampTest { <nl> < < " a_1 " ) ) [ " ts " ] <nl> . timestamp ( ) ; <nl> <nl> - const Timestamp indexAComplete = queryOplog ( BSON ( " op " <nl> - < < " c " <nl> - < < " o . createIndexes " < < nss . coll ( ) <nl> - < < " o . name " <nl> - < < " a_1 " ) ) [ " ts " ] <nl> - . timestamp ( ) ; <nl> - <nl> - const auto indexBComplete = <nl> - Timestamp ( indexAComplete . getSecs ( ) , indexAComplete . getInc ( ) + 1 ) ; <nl> + / / Two phase index builds do not emit an createIndexes oplog entry for each index . <nl> + Timestamp indexAComplete ; <nl> + if ( ! IndexBuildsCoordinator : : get ( _opCtx ) - > supportsTwoPhaseIndexBuild ( ) ) { <nl> + indexAComplete = queryOplog ( BSON ( " op " <nl> + < < " c " <nl> + < < " o . createIndexes " < < nss . coll ( ) < < " o . name " <nl> + < < " a_1 " ) ) [ " ts " ] <nl> + . timestamp ( ) ; <nl> + } <nl> + <nl> + auto commitIndexBuildTs = queryOplog ( BSON ( " op " <nl> + < < " c " <nl> + < < " o . commitIndexBuild " < < nss . coll ( ) <nl> + < < " o . indexes . 0 . name " <nl> + < < " a_1 " ) ) [ " ts " ] <nl> + . timestamp ( ) ; <nl> + const auto indexBComplete = commitIndexBuildTs ; <nl> <nl> AutoGetCollection autoColl ( _opCtx , nss , LockMode : : MODE_S ) ; <nl> <nl> class TimestampMultiIndexBuilds : public StorageTimestampTest { <nl> . ready ) ; <nl> <nl> / / Assert the ` a_1 ` index becomes ready at the next oplog entry time . <nl> - ASSERT_TRUE ( <nl> - getIndexMetaData ( getMetaDataAtTime ( durableCatalog , nss , indexAComplete ) , " a_1 " ) . ready ) ; <nl> - ASSERT_FALSE ( <nl> - getIndexMetaData ( getMetaDataAtTime ( durableCatalog , nss , indexAComplete ) , " b_1 " ) . ready ) ; <nl> + if ( ! indexAComplete . isNull ( ) ) { <nl> + ASSERT_TRUE ( <nl> + getIndexMetaData ( getMetaDataAtTime ( durableCatalog , nss , indexAComplete ) , " a_1 " ) <nl> + . ready ) ; <nl> + ASSERT_FALSE ( <nl> + getIndexMetaData ( getMetaDataAtTime ( durableCatalog , nss , indexAComplete ) , " b_1 " ) <nl> + . ready ) ; <nl> + } <nl> <nl> / / Assert the ` b_1 ` index becomes ready at the last oplog entry time . <nl> ASSERT_TRUE ( <nl> class CreateCollectionWithSystemIndex : public StorageTimestampTest { <nl> return ; <nl> } <nl> <nl> - / / The index build emits three oplog entries . <nl> - const Timestamp indexStartTs = futureLt . addTicks ( 1 ) . asTimestamp ( ) ; <nl> - const Timestamp indexCreateTs = futureLt . addTicks ( 2 ) . asTimestamp ( ) ; <nl> - const Timestamp indexCompleteTs = futureLt . addTicks ( 3 ) . asTimestamp ( ) ; <nl> - <nl> NamespaceString nss ( " admin . system . users " ) ; <nl> <nl> { ASSERT_FALSE ( AutoGetCollectionForReadCommand ( _opCtx , nss ) . getCollection ( ) ) ; } <nl> class CreateCollectionWithSystemIndex : public StorageTimestampTest { <nl> / / the collection to appear at ' futureTs ' and not before . <nl> ASSERT_EQ ( op . getTimestamp ( ) , futureTs ) < < op . toBSON ( ) ; <nl> <nl> + / / The index build emits three oplog entries . <nl> + auto indexStartTs = repl : : OplogEntry ( queryOplog ( BSON ( " op " <nl> + < < " c " <nl> + < < " ns " < < nss . getCommandNS ( ) . ns ( ) <nl> + < < " o . startIndexBuild " < < nss . coll ( ) <nl> + < < " o . indexes . 0 . name " <nl> + < < " user_1_db_1 " ) ) ) <nl> + . getTimestamp ( ) ; <nl> + Timestamp indexCreateTs ; <nl> + if ( ! IndexBuildsCoordinator : : get ( _opCtx ) - > supportsTwoPhaseIndexBuild ( ) ) { <nl> + indexCreateTs = <nl> + repl : : OplogEntry ( queryOplog ( BSON ( " op " <nl> + < < " c " <nl> + < < " ns " < < nss . getCommandNS ( ) . ns ( ) <nl> + < < " o . createIndexes " < < nss . coll ( ) < < " o . name " <nl> + < < " user_1_db_1 " ) ) ) <nl> + . getTimestamp ( ) ; <nl> + } <nl> + auto indexCompleteTs = repl : : OplogEntry ( queryOplog ( BSON ( " op " <nl> + < < " c " <nl> + < < " ns " < < nss . getCommandNS ( ) . ns ( ) <nl> + < < " o . commitIndexBuild " <nl> + < < nss . coll ( ) < < " o . indexes . 0 . name " <nl> + < < " user_1_db_1 " ) ) ) <nl> + . getTimestamp ( ) ; <nl> + <nl> assertNamespaceInIdents ( nss , pastTs , false ) ; <nl> assertNamespaceInIdents ( nss , presentTs , false ) ; <nl> assertNamespaceInIdents ( nss , futureTs , true ) ; <nl> assertNamespaceInIdents ( nss , indexStartTs , true ) ; <nl> - assertNamespaceInIdents ( nss , indexCreateTs , true ) ; <nl> + if ( ! indexCreateTs . isNull ( ) ) { <nl> + assertNamespaceInIdents ( nss , indexCreateTs , true ) ; <nl> + } <nl> assertNamespaceInIdents ( nss , indexCompleteTs , true ) ; <nl> assertNamespaceInIdents ( nss , nullTs , true ) ; <nl> <nl> - result = queryOplog ( BSON ( " op " <nl> - < < " c " <nl> - < < " ns " < < nss . getCommandNS ( ) . ns ( ) < < " o . createIndexes " <nl> - < < nss . coll ( ) ) ) ; <nl> - repl : : OplogEntry indexOp ( result ) ; <nl> - ASSERT_EQ ( indexOp . getObject ( ) [ " name " ] . str ( ) , " user_1_db_1 " ) ; <nl> - ASSERT_GT ( indexOp . getTimestamp ( ) , futureTs ) < < op . toBSON ( ) ; <nl> + ASSERT_GT ( indexCompleteTs , futureTs ) ; <nl> AutoGetCollection autoColl ( _opCtx , nss , LockMode : : MODE_IS ) ; <nl> auto storageEngine = _opCtx - > getServiceContext ( ) - > getStorageEngine ( ) ; <nl> auto durableCatalog = storageEngine - > getCatalog ( ) ; <nl> class CreateCollectionWithSystemIndex : public StorageTimestampTest { <nl> / / This is the timestamp of the startIndexBuild oplog entry , which is timestamped before the <nl> / / index is created as part of the createIndexes oplog entry . <nl> assertIdentsMissingAtTimestamp ( durableCatalog , " " , indexIdent , indexStartTs ) ; <nl> - assertIdentsExistAtTimestamp ( durableCatalog , " " , indexIdent , indexCreateTs ) ; <nl> + if ( ! indexCreateTs . isNull ( ) ) { <nl> + assertIdentsExistAtTimestamp ( durableCatalog , " " , indexIdent , indexCreateTs ) ; <nl> + } <nl> assertIdentsExistAtTimestamp ( durableCatalog , " " , indexIdent , indexCompleteTs ) ; <nl> assertIdentsExistAtTimestamp ( durableCatalog , " " , indexIdent , nullTs ) ; <nl> } <nl>
|
SERVER - 44329 update StorageTimestampTests to work with two phase index builds
|
mongodb/mongo
|
e5f98b1d7302efce0c32a11cdb7cd0163c4dc30c
|
2019-11-01T21:07:40Z
|
mmm a / tensorflow / python / keras / distribute / BUILD <nl> ppp b / tensorflow / python / keras / distribute / BUILD <nl> distribute_py_test ( <nl> " no_windows_gpu " , <nl> " noasan " , # TODO ( b / 170902997 ) <nl> " noguitar " , # TODO ( b / 172354344 ) <nl> - " notap " , # TODO ( b / 170902997 ) <nl> " notsan " , <nl> ] , <nl> tpu_tags = [ <nl>
|
Enable distribute_strategy_test on TAP
|
tensorflow/tensorflow
|
2bce2d95bdd27763fc9104b1307b12f34ff8fa62
|
2020-12-05T00:36:52Z
|
mmm a / cocos / 3d / CCBillBoard . cpp <nl> ppp b / cocos / 3d / CCBillBoard . cpp <nl> bool BillBoard : : calculateBillbaordTransform ( ) <nl> Quaternion rotationQuaternion ; <nl> this - > getNodeToWorldTransform ( ) . getRotation ( & rotationQuaternion ) ; <nl> <nl> - <nl> Mat4 rotationMatrix ; <nl> rotationMatrix . setIdentity ( ) ; <nl> - / / / FIXME : maybe should keep rotation along z axis <nl> - / / if ( rotationQuaternion . z > 0 ) <nl> - / / { <nl> - / / / / rotate z only , keep it <nl> - / / / / fetch the rotation angle of z <nl> - / / float rotationZ = atan2 ( 2 * ( rotationQuaternion . w * rotationQuaternion . z + rotationQuaternion . x * rotationQuaternion . y ) , <nl> - / / ( 1 - 2 * ( rotationQuaternion . y * rotationQuaternion . y + rotationQuaternion . z * rotationQuaternion . z ) ) ) ; <nl> - / / rotationMatrix . rotateZ ( rotationZ ) ; <nl> - / / } <nl> - <nl> + <nl> Vec3 upAxis = Vec3 ( rotationMatrix . m [ 4 ] , rotationMatrix . m [ 5 ] , rotationMatrix . m [ 6 ] ) ; <nl> Vec3 x , y ; <nl> camWorldMat . transformVector ( upAxis , & y ) ; <nl> mmm a / cocos / renderer / CCRenderer . cpp <nl> ppp b / cocos / renderer / CCRenderer . cpp <nl> void Renderer : : visitRenderQueue ( RenderQueue & queue ) <nl> { <nl> / / Clear depth to achieve layered rendering <nl> glDepthMask ( true ) ; <nl> - glClear ( GL_DEPTH_BUFFER_BIT ) ; <nl> glEnable ( GL_DEPTH_TEST ) ; <nl> <nl> for ( auto it = opaqueQueue . cbegin ( ) ; it ! = opaqueQueue . cend ( ) ; + + it ) <nl> void Renderer : : visitRenderQueue ( RenderQueue & queue ) <nl> processRenderCommand ( * it ) ; <nl> } <nl> flush ( ) ; <nl> - <nl> - glDepthMask ( true ) ; <nl> - glClear ( GL_DEPTH_BUFFER_BIT ) ; <nl> - glDepthMask ( false ) ; <nl> } <nl> <nl> / / <nl>
|
Don ' t clear depth between queues
|
cocos2d/cocos2d-x
|
c0ff8d1177a8ef858356825a125fde4f107b9e2c
|
2015-01-28T23:28:14Z
|
mmm a / xbmc / windowing / gbm / DRMUtils . cpp <nl> ppp b / xbmc / windowing / gbm / DRMUtils . cpp <nl> drm_fb * CDRMUtils : : DrmFbGetFromBo ( struct gbm_bo * bo ) <nl> auto ret = drmModeAddFB2 ( m_drm - > fd , <nl> width , <nl> height , <nl> - DRM_FORMAT_ARGB8888 , <nl> + m_drm - > primary_plane - > format , <nl> handles , <nl> strides , <nl> offsets , <nl> bool CDRMUtils : : GetPlanes ( ) <nl> drmModePlaneResPtr plane_resources ; <nl> uint32_t primary_plane_id = - 1 ; <nl> uint32_t overlay_plane_id = - 1 ; <nl> + uint32_t fourcc = 0 ; <nl> <nl> plane_resources = drmModeGetPlaneResources ( m_drm - > fd ) ; <nl> if ( ! plane_resources ) <nl> bool CDRMUtils : : GetPlanes ( ) <nl> m_drm - > primary_plane - > props_info [ i ] = drmModeGetProperty ( m_drm - > fd , m_drm - > primary_plane - > props - > props [ i ] ) ; <nl> } <nl> <nl> + for ( uint32_t i = 0 ; i < m_drm - > primary_plane - > plane - > count_formats ; i + + ) <nl> + { <nl> + / * we want an alpha layer so break if we find one * / <nl> + if ( m_drm - > primary_plane - > plane - > formats [ i ] = = DRM_FORMAT_XRGB8888 ) <nl> + { <nl> + fourcc = DRM_FORMAT_XRGB8888 ; <nl> + m_drm - > primary_plane - > format = fourcc ; <nl> + } <nl> + else if ( m_drm - > primary_plane - > plane - > formats [ i ] = = DRM_FORMAT_ARGB8888 ) <nl> + { <nl> + fourcc = DRM_FORMAT_ARGB8888 ; <nl> + m_drm - > primary_plane - > format = fourcc ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + if ( fourcc = = 0 ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " CDRMUtils : : % s - could not find a suitable primary plane format " , __FUNCTION__ ) ; <nl> + return false ; <nl> + } <nl> + <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - primary plane format : % c % c % c % c " , __FUNCTION__ , fourcc , fourcc > > 8 , fourcc > > 16 , fourcc > > 24 ) ; <nl> + <nl> / / overlay plane <nl> m_drm - > overlay_plane - > plane = drmModeGetPlane ( m_drm - > fd , overlay_plane_id ) ; <nl> if ( ! m_drm - > overlay_plane - > plane ) <nl> bool CDRMUtils : : GetPlanes ( ) <nl> m_drm - > overlay_plane - > props_info [ i ] = drmModeGetProperty ( m_drm - > fd , m_drm - > overlay_plane - > props - > props [ i ] ) ; <nl> } <nl> <nl> + fourcc = 0 ; <nl> + <nl> + for ( uint32_t i = 0 ; i < m_drm - > overlay_plane - > plane - > count_formats ; i + + ) <nl> + { <nl> + / * we want an alpha layer so break if we find one * / <nl> + if ( m_drm - > overlay_plane - > plane - > formats [ i ] = = DRM_FORMAT_XRGB8888 ) <nl> + { <nl> + fourcc = DRM_FORMAT_XRGB8888 ; <nl> + m_drm - > overlay_plane - > format = fourcc ; <nl> + } <nl> + else if ( m_drm - > overlay_plane - > plane - > formats [ i ] = = DRM_FORMAT_ARGB8888 ) <nl> + { <nl> + fourcc = DRM_FORMAT_ARGB8888 ; <nl> + m_drm - > overlay_plane - > format = fourcc ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + if ( fourcc = = 0 ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " CDRMUtils : : % s - could not find a suitable overlay plane format " , __FUNCTION__ ) ; <nl> + return false ; <nl> + } <nl> + <nl> + CLog : : Log ( LOGDEBUG , " CDRMUtils : : % s - overlay plane format : % c % c % c % c " , __FUNCTION__ , fourcc , fourcc > > 8 , fourcc > > 16 , fourcc > > 24 ) ; <nl> + <nl> return true ; <nl> } <nl> <nl> mmm a / xbmc / windowing / gbm / DRMUtils . h <nl> ppp b / xbmc / windowing / gbm / DRMUtils . h <nl> struct plane <nl> drmModePlane * plane ; <nl> drmModeObjectProperties * props ; <nl> drmModePropertyRes * * props_info ; <nl> + uint32_t format ; <nl> } ; <nl> <nl> struct connector <nl>
|
windowing / gbm : check supported plane formats
|
xbmc/xbmc
|
294865c78f7ee26e5ed9b4f88f3a95abc1526f29
|
2017-12-04T19:38:56Z
|
mmm a / src / qtlibtorrent / torrentspeedmonitor . cpp <nl> ppp b / src / qtlibtorrent / torrentspeedmonitor . cpp <nl> Sample < qreal > SpeedSample : : average ( ) const <nl> if ( m_speedSamples . empty ( ) ) <nl> return Sample < qreal > ( ) ; <nl> <nl> - return Sample < qreal > ( m_sum ) * ( 1 . / m_speedSamples . size ( ) ) ; <nl> + return Sample < qreal > ( m_sum ) * ( qreal ( 1 . ) / m_speedSamples . size ( ) ) ; <nl> } <nl> <nl> void TorrentSpeedMonitor : : removeSamples ( const QTorrentHandle & h ) { <nl>
|
Fix compilation on ARM . Closes .
|
qbittorrent/qBittorrent
|
da9396ca947875b6a312b92cda240d82d1051361
|
2014-12-02T12:32:47Z
|
mmm a / torch / utils / hipify / hipify_python . py <nl> ppp b / torch / utils / hipify / hipify_python . py <nl> def match_extensions ( filename ) : <nl> # This is a very rough heuristic ; really , we want to avoid scanning <nl> # any file which is not checked into source control , but this script <nl> # needs to work even if you ' re in a Git or Hg checkout , so easier to <nl> - # just blacklist the biggest time sinks that won ' t matter in the <nl> + # just block the biggest time sinks that won ' t matter in the <nl> # end . <nl> for ( abs_dirpath , dirs , filenames ) in os . walk ( root_path , topdown = True ) : <nl> rel_dirpath = os . path . relpath ( abs_dirpath , root_path ) <nl>
|
replace black list with block ( )
|
pytorch/pytorch
|
5aa2b572ffe80e7191ac97c4e2b0cc2f3d3e9c15
|
2020-07-28T17:23:51Z
|
mmm a / lib / PrintAsObjC / PrintAsObjC . cpp <nl> ppp b / lib / PrintAsObjC / PrintAsObjC . cpp <nl> class ObjCPrinter : private DeclVisitor < ObjCPrinter > , <nl> os < < " @ end \ n " ; <nl> } <nl> <nl> + bool isEmptyExtensionDecl ( ExtensionDecl * ED ) { <nl> + auto members = ED - > getMembers ( ) ; <nl> + auto hasMembers = std : : any_of ( members . begin ( ) , members . end ( ) , <nl> + [ this ] ( const Decl * D ) - > bool { <nl> + if ( auto VD = dyn_cast < ValueDecl > ( D ) ) <nl> + if ( shouldInclude ( VD ) ) <nl> + return true ; <nl> + return false ; <nl> + } ) ; <nl> + <nl> + auto protocols = ED - > getLocalProtocols ( ConformanceLookupKind : : OnlyExplicit ) ; <nl> + auto hasProtocols = std : : any_of ( protocols . begin ( ) , protocols . end ( ) , <nl> + [ this ] ( const ProtocolDecl * PD ) - > bool { <nl> + return shouldInclude ( PD ) ; <nl> + } ) ; <nl> + <nl> + return ( ! hasMembers & & ! hasProtocols ) ; <nl> + } <nl> + <nl> void visitExtensionDecl ( ExtensionDecl * ED ) { <nl> + if ( isEmptyExtensionDecl ( ED ) ) <nl> + return ; <nl> + <nl> auto baseClass = ED - > getExtendedType ( ) - > getClassOrBoundGenericClass ( ) ; <nl> <nl> os < < " @ interface " < < getNameForObjC ( baseClass ) ; <nl> mmm a / test / PrintAsObjC / extensions . swift <nl> ppp b / test / PrintAsObjC / extensions . swift <nl> import objc_generics <nl> / / CHECK - NEXT : @ end <nl> @ objc class A1 { } <nl> <nl> - / / CHECK - LABEL : @ interface A1 ( SWIFT_EXTENSION ( extensions ) ) <nl> - / / CHECK - NEXT : @ end <nl> + / / NEGATIVE - NOT : @ interface A1 ( SWIFT_EXTENSION ( extensions ) ) <nl> extension A1 { } <nl> <nl> / / CHECK - LABEL : @ interface A2 { { $ } } <nl> / / CHECK - NEXT : init <nl> / / CHECK - NEXT : @ end <nl> / / CHECK - LABEL : @ interface A2 ( SWIFT_EXTENSION ( extensions ) ) <nl> + / / CHECK - DAG : @ property ( nonatomic , readonly ) NSInteger some ; <nl> / / CHECK - NEXT : @ end <nl> - extension A2 { } <nl> + extension A2 { <nl> + var some : Int { return 1 } <nl> + } <nl> @ objc class A2 { } <nl> <nl> / / CHECK - LABEL : @ interface A3 { { $ } } <nl> extension A4 { <nl> @ objc class Inner { } <nl> } <nl> <nl> + / / CHECK - LABEL : @ interface A5 { { $ } } <nl> + / / CHECK - NEXT : init <nl> + / / CHECK - NEXT : @ end <nl> + @ objc class A5 { } <nl> + <nl> + / / NEGATIVE - NOT : @ interface A5 ( SWIFT_EXTENSION ( extensions ) ) <nl> + extension A5 { <nl> + var notObjC : NotObjC { return NotObjC ( ) } <nl> + } <nl> + <nl> / / CHECK - LABEL : @ interface CustomName { { $ } } <nl> / / CHECK - NEXT : init <nl> / / CHECK - NEXT : @ end <nl> extension GenericClass { <nl> class NotObjC { } <nl> extension NotObjC { } <nl> <nl> - / / CHECK - LABEL : @ interface NSObject ( SWIFT_EXTENSION ( extensions ) ) <nl> - / / CHECK - NEXT : @ end <nl> / / NEGATIVE - NOT : @ interface NSObject { { $ } } <nl> / / NEGATIVE - NOT : @ class NSObject <nl> - extension NSObject { } <nl> + / / CHECK - LABEL : @ interface NSObject ( SWIFT_EXTENSION ( extensions ) ) <nl> + / / CHECK - DAG : @ property ( nonatomic , readonly ) NSInteger some ; <nl> + / / CHECK - NEXT : @ end <nl> + extension NSObject { <nl> + var some : Int { return 1 } <nl> + } <nl> <nl> / / NEGATIVE - NOT : @ class NSString ; <nl> / / CHECK : @ class NSColor ; <nl> mmm a / test / PrintAsObjC / protocols . swift <nl> ppp b / test / PrintAsObjC / protocols . swift <nl> class MyObject : NSObject , NSCoding { <nl> / / NEGATIVE - NOT : NotObjC <nl> protocol NotObjC : class { } <nl> <nl> - <nl> - / / CHECK - LABEL : @ interface NSString ( SWIFT_EXTENSION ( protocols ) ) { { $ } } <nl> + / / NEGATIVE - NOT : @ interface NSString ( SWIFT_EXTENSION ( protocols ) ) { { $ } } <nl> extension NSString : NotObjC { } <nl> <nl> / / CHECK - LABEL : @ protocol ZZZ { { $ } } <nl>
|
Merge pull request from calebd / fix - sr - 2772
|
apple/swift
|
872581f9fb5d5728635ae33a4afaf3c453213f2b
|
2017-03-07T17:43:45Z
|
mmm a / AUTHORS <nl> ppp b / AUTHORS <nl> a license to everyone to use it as detailed in LICENSE . ) <nl> * Pin Zhang < zhangpin04 @ gmail . com > <nl> * Nick Bray < ncbray @ chromium . org > ( copyright owned by Google , Inc . ) <nl> * Aidan Hobson Sayers < aidanhs @ cantab . net > <nl> + * Charlie Birks < admin @ daftgames . net > <nl> <nl>
|
Add myself to AUTHORS
|
emscripten-core/emscripten
|
2fdbea2134c829a63a3492b278eaadd663decffe
|
2013-08-24T09:20:15Z
|
mmm a / docs / en / interfaces / http . md <nl> ppp b / docs / en / interfaces / http . md <nl> echo ' DROP TABLE t ' | curl ' http : / / localhost : 8123 / ' - - data - binary @ - <nl> <nl> For successful requests that don ' t return a data table , an empty response body is returned . <nl> <nl> - You can use the internal ClickHouse compression format when transmitting data . The compressed data has a non - standard format , and you will need to use the special ` clickhouse - compressor ` program to work with it ( it is installed with the ` clickhouse - client ` package ) . To increase the efficiency of the data insertion , you may disable the server - side checksum verification with the [ http_native_compression_disable_checksumming_on_decompress ] ( . . / operations / settings / settings . md # settings - http_native_compression_disable_checksumming_on_decompress ) setting . <nl> + You can use the internal ClickHouse compression format when transmitting data . The compressed data has a non - standard format , and you will need to use the special ` clickhouse - compressor ` program to work with it ( it is installed with the ` clickhouse - client ` package ) . To increase the efficiency of data insertion , you can disable server - side checksum verification by using the [ http_native_compression_disable_checksumming_on_decompress ] ( . . / operations / settings / settings . md # settings - http_native_compression_disable_checksumming_on_decompress ) setting . <nl> <nl> - If you specified ` compress = 1 ` in the URL , the server compresses the data it sends you . <nl> - If you specified ` decompress = 1 ` in the URL , the server decompresses the same data that you pass in the ` POST ` method . <nl> + If you specified ` compress = 1 ` in the URL , the server compresses the data it sends you . <nl> + If you specified ` decompress = 1 ` in the URL , the server decompresses the same data that you pass in the ` POST ` method . <nl> <nl> - It is also possible to use the standard ` gzip ` - based [ HTTP compression ] ( https : / / en . wikipedia . org / wiki / HTTP_compression ) . To send a ` POST ` request compressed using ` gzip ` , append the request header ` Content - Encoding : gzip ` . <nl> + It is also possible to use standard ` gzip ` - based [ HTTP compression ] ( https : / / en . wikipedia . org / wiki / HTTP_compression ) . To send a ` POST ` request compressed using ` gzip ` , append the request header ` Content - Encoding : gzip ` . <nl> In order for ClickHouse to compress the response using ` gzip ` , you must append ` Accept - Encoding : gzip ` to the request headers , and enable the ClickHouse [ enable_http_compression ] ( . . / operations / settings / settings . md # settings - enable_http_compression ) setting . You can configure the compression level of the data with the [ http_zlib_compression_level ] ( # settings - http_zlib_compression_level ) setting . <nl> <nl> You can use this to reduce network traffic when transmitting a large amount of data , or for creating dumps that are immediately compressed . <nl> echo " SELECT 1 " | gzip - c | curl - sS - - data - binary @ - - H ' Content - Encoding : gzip <nl> ` ` ` <nl> <nl> ! ! ! note " Note " <nl> - Some HTTP clients can decompress data ( ` gzip ` and ` deflate ` ) from the server by default and you may get the decompressed data even if you use the compression settings correctly . <nl> + Some HTTP clients might decompress data from the server by default ( with ` gzip ` and ` deflate ` ) and you might get decompressed data even if you use the compression settings correctly . <nl> <nl> You can use the ' database ' URL parameter to specify the default database . <nl> <nl> echo ' SELECT 1 ' | curl ' http : / / user : password @ localhost : 8123 / ' - d @ - <nl> echo ' SELECT 1 ' | curl ' http : / / localhost : 8123 / ? user = user & password = password ' - d @ - <nl> ` ` ` <nl> <nl> - If the user name is not indicated , the username ' default ' is used . If the password is not indicated , an empty password is used . <nl> + If the user name is not specified , the ` default ` name is used . If the password is not specified , the empty password is used . <nl> You can also use the URL parameters to specify any settings for processing a single query , or entire profiles of settings . Example : http : / / localhost : 8123 / ? profile = web & max_rows_to_read = 1000000000 & query = SELECT + 1 <nl> <nl> - For more information , see the section " Settings " . <nl> + For more information , see the [ Settings ] [ . . / operations / settings / index . md ] section . <nl> <nl> ` ` ` bash <nl> $ echo ' SELECT number FROM system . numbers LIMIT 10 ' | curl ' http : / / localhost : 8123 / ? ' - - data - binary @ - <nl> mmm a / docs / en / operations / settings / settings . md <nl> ppp b / docs / en / operations / settings / settings . md <nl> Restrictions : <nl> - If the subquery concerns a distributed table containing more than one shard , <nl> - Not used for a table - valued [ remote ] ( . . / . . / query_language / table_functions / remote . md ) function . <nl> <nl> - The possible values are : <nl> + Possible values : <nl> <nl> - ` deny ` — Default value . Prohibits using these types of subqueries ( returns the " Double - distributed in / JOIN subqueries is denied " exception ) . <nl> - ` local ` — Replaces the database and table in the subquery with local ones for the destination server ( shard ) , leaving the normal ` IN ` / ` JOIN . ` <nl> Predicate pushdown may significantly reduce network traffic for distributed quer <nl> <nl> Possible values : <nl> <nl> - - 0 — Functionality is turned off . <nl> - - 1 — Functionality is turned on . <nl> + - 0 — Disabled . <nl> + - 1 — Enabled . <nl> <nl> Default value : 0 . <nl> <nl> If ` force_primary_key = 1 ` , ClickHouse checks to see if the query has a primary ke <nl> <nl> # # fsync_metadata <nl> <nl> - Enable or disable fsync when writing . sql files . Enabled by default . <nl> + Enables or disables [ fsync ] ( http : / / pubs . opengroup . org / onlinepubs / 9699919799 / functions / fsync . html ) when writing ` . sql ` files . Enabled by default . <nl> <nl> It makes sense to disable it if the server has millions of tiny table chunks that are constantly being created and destroyed . <nl> <nl> # # enable_http_compression { # settings - enable_http_compression } <nl> <nl> - Enables / disables compression of the data in the response to an HTTP request . <nl> + Enables or disables data compression in the response to an HTTP request . <nl> <nl> For more information , read the [ HTTP interface description ] ( . . / . . / interfaces / http . md ) . <nl> <nl> Possible values : <nl> <nl> - - 0 — The functionality is disabled . <nl> - - 1 — The functionality is enabled . <nl> + - 0 — Disabled . <nl> + - 1 — Enabled . <nl> <nl> Default value : 0 . <nl> <nl> # # http_zlib_compression_level { # settings - http_zlib_compression_level } <nl> <nl> - Sets the level of the compression of the data in the response to an HTTP request if [ enable_http_compression = 1 ] ( # settings - enable_http_compression ) . <nl> + Sets the level of data compression in the response to an HTTP request if [ enable_http_compression = 1 ] ( # settings - enable_http_compression ) . <nl> <nl> - Possible values : numbers from 1 to 9 . <nl> + Possible values : Numbers from 1 to 9 . <nl> <nl> Default value : 3 . <nl> <nl> <nl> # # http_native_compression_disable_checksumming_on_decompress { # settings - http_native_compression_disable_checksumming_on_decompress } <nl> <nl> - Enables / disables the verification of the checksum when uncompressing the HTTP POST data from the client . Used only for ClickHouse native format of compression ( neither ` gzip ` nor ` deflate ` ) . <nl> + Enables or disables checksum verification when decompressing the HTTP POST data from the client . Used only for ClickHouse native compression format ( not used with ` gzip ` or ` deflate ` ) . <nl> <nl> For more information , read the [ HTTP interface description ] ( . . / . . / interfaces / http . md ) . <nl> <nl> Possible values : <nl> <nl> - - 0 — The functionality is disabled . <nl> - - 1 — The functionality is enabled . <nl> + - 0 — Disabled . <nl> + - 1 — Enabled . <nl> <nl> Default value : 0 . <nl> <nl> If ` input_format_allow_errors_ratio ` is exceeded , ClickHouse throws an exception <nl> <nl> # # input_format_values_interpret_expressions { # settings - input_format_values_interpret_expressions } <nl> <nl> - Turns on the full SQL parser if the fast stream parser can ' t parse the data . This setting is used only for the [ Values ] ( . . / . . / interfaces / formats . md # data - format - values ) format during data insertion . For more information about syntax parsing , see the [ Syntax ] ( . . / . . / query_language / syntax . md ) section . <nl> + Enables or disables the full SQL parser if the fast stream parser can ' t parse the data . This setting is used only for the [ Values ] ( . . / . . / interfaces / formats . md # data - format - values ) format at the data insertion . For more information about syntax parsing , see the [ Syntax ] ( . . / . . / query_language / syntax . md ) section . <nl> <nl> Possible values : <nl> <nl> - - 0 — Functionality is turned off . <nl> + - 0 — Disabled . <nl> <nl> In this case , you must provide formatted data . See the [ Formats ] ( . . / . . / interfaces / formats . md ) section . <nl> <nl> - - 1 — Functionality is turned on . <nl> + - 1 — Enabled . <nl> <nl> In this case , you can use an SQL expression as a value , but data insertion is much slower this way . If you insert only formatted data , then ClickHouse behaves as if the setting value is 0 . <nl> <nl> For all other operations , ClickHouse doesn ' t apply the setting . <nl> <nl> * * Possible values * * <nl> <nl> - - 0 — Functionality is disabled . <nl> - - 1 — Functionality is enabled . <nl> + - 0 — Disabled . <nl> + - 1 — Enabled . <nl> <nl> * * Default value : * * 0 . <nl> <nl> Default value : 60 seconds . <nl> <nl> # # select_sequential_consistency { # settings - select_sequential_consistency } <nl> <nl> - Enables / disables sequential consistency for ` SELECT ` queries : <nl> + Enables or disables sequential consistency for ` SELECT ` queries : <nl> + <nl> + Possible values : <nl> <nl> - 0 — Disabled . <nl> - 1 — Enabled . <nl> + <nl> Default value : 0 . <nl> <nl> + * * Usage * * <nl> + <nl> When sequential consistency is enabled , ClickHouse allows the client to execute the ` SELECT ` query only for those replicas that contain data from all previous ` INSERT ` queries executed with ` insert_quorum ` . If the client refers to a partial replica , ClickHouse will generate an exception . The SELECT query will not include data that has not yet been written to the quorum of replicas . <nl> <nl> - See also the following parameters : <nl> + * * See Also * * <nl> <nl> - [ insert_quorum ] ( # settings - insert_quorum ) <nl> - [ insert_quorum_timeout ] ( # settings - insert_quorum_timeout ) <nl> mmm a / docs / ru / interfaces / http . md <nl> ppp b / docs / ru / interfaces / http . md <nl> Date : Fri , 16 Nov 2012 19 : 21 : 50 GMT <nl> ` ` ` <nl> <nl> Как видно , curl немного неудобен тем , что надо URL - эскейпить пробелы . <nl> - wget сам всё эскейпит , но его не рекомендуется использовать , так как он плохо работает по HTTP 1 . 1 при использовании keep - alive и Transfer - Encoding : chunked . <nl> + Хотя wget сам всё эскейпит , но его не рекомендуется использовать , так как он плохо работает по HTTP 1 . 1 при использовании keep - alive и Transfer - Encoding : chunked . <nl> <nl> ` ` ` bash <nl> $ echo ' SELECT 1 ' | curl ' http : / / localhost : 8123 / ' - - data - binary @ - <nl> echo ' DROP TABLE t ' | curl ' http : / / localhost : 8123 / ' - - data - binary @ - <nl> <nl> Для запросов , которые не возвращают таблицу с данными , в случае успеха , выдаётся пустое тело ответа . <nl> <nl> - Вы можете использовать внутренний формат сжатия Clickhouse при передаче данных . Формат сжатых данных нестандартный , и вам придётся использовать для работы с ним специальную программу clickhouse - compressor ( устанавливается вместе с пакетом clickhouse - client ) . <nl> + Вы можете использовать внутренний формат сжатия Clickhouse при передаче данных . Формат сжатых данных нестандартный , и вам придётся использовать для работы с ним специальную программу ` clickhouse - compressor ` ( устанавливается вместе с пакетом ` clickhouse - client ` ) . Для повышения эффективности вставки данных можно отключить проверку контрольной суммы на стороне сервера с помощью настройки [ http_native_compression_disable_checksumming_on_decompress ] ( . . / operations / settings / settings . md # settings - http_native_compression_disable_checksumming_on_decompress ) . <nl> <nl> - Если вы указали в URL compress = 1 , то сервер будет сжимать отправляемые вам данные . <nl> - Если вы указали в URL decompress = 1 , то сервер будет разжимать те данные , которые вы передаёте ему POST - ом . <nl> + Если вы указали ` compress = 1 ` в URL , то сервер сжимает данные , которые он отправляет . <nl> + Если вы указали ` decompress = 1 ` в URL , сервер распаковывает те данные , которые вы передаёте методом ` POST ` . <nl> <nl> - Также имеется возможность использования стандартного сжатия HTTP , на основе gzip . Чтобы отправить POST - запрос , сжатый с помощью gzip , добавьте к запросу заголовок ` Content - Encoding : gzip ` . <nl> - Чтобы ClickHouse сжимал ответ на запрос с помощью gzip , необходимо добавить ` Accept - Encoding : gzip ` к заголовкам запроса , и включить настройку ClickHouse ` enable_http_compression ` . <nl> + Также можно использовать стандартное [ HTTP сжатие ] ( https : / / en . wikipedia . org / wiki / HTTP_compression ) с помощью ` gzip ` . Чтобы отправить запрос ` POST ` , сжатый с помощью ` gzip ` , добавьте к запросу заголовок ` Content - Encoding : gzip ` . <nl> + Чтобы ClickHouse сжимал ответ на запрос с помощью ` gzip ` , необходимо добавить ` Accept - Encoding : gzip ` к заголовкам запроса , и включить настройку ClickHouse [ enable_http_compression ] ( . . / operations / settings / settings . md # settings - enable_http_compression ) . Вы можете настроить уровень сжатия данных с помощью настройки [ http_zlib_compression_level ] ( # settings - http_zlib_compression_level ) . <nl> <nl> Это может быть использовано для уменьшения трафика по сети при передаче большого количества данных , а также для создания сразу сжатых дампов . <nl> <nl> + Примеры отправки данных со сжатием : <nl> + <nl> + ` ` ` bash <nl> + # Отправка данных на сервер : <nl> + curl - vsS " http : / / localhost : 8123 / ? enable_http_compression = 1 " - d ' SELECT number FROM system . numbers LIMIT 10 ' - H ' Accept - Encoding : gzip ' <nl> + <nl> + # Отправка данных клиенту : <nl> + echo " SELECT 1 " | gzip - c | curl - sS - - data - binary @ - - H ' Content - Encoding : gzip ' ' http : / / localhost : 8123 / ' <nl> + ` ` ` <nl> + <nl> + ! ! ! note " Примечание " <nl> + Некоторые HTTP - клиенты могут по умолчанию распаковывать данные ( ` gzip ` и ` deflate ` ) с сервера в фоновом режиме и вы можете получить распакованные данные , даже если правильно используете настройки сжатия . <nl> + <nl> В параметре URL database может быть указана БД по умолчанию . <nl> <nl> ` ` ` bash <nl> echo ' SELECT 1 ' | curl ' http : / / user : password @ localhost : 8123 / ' - d @ - <nl> echo ' SELECT 1 ' | curl ' http : / / localhost : 8123 / ? user = user & password = password ' - d @ - <nl> ` ` ` <nl> <nl> - Если имя пользователя не указано , то используется имя пользователя default . Если пароль не указан , то используется пустой пароль . <nl> + Если имя пользователя не указано , то используется ` default ` . Если пароль не указан , то используется пустой пароль . <nl> Также в параметрах URL вы можете указать любые настройки , которые будут использованы для обработки одного запроса , или целые профили настроек . Пример : <nl> http : / / localhost : 8123 / ? profile = web & max_rows_to_read = 1000000000 & query = SELECT + 1 <nl> <nl> - Подробнее см . раздел " Настройки " . <nl> + Подробнее смотрите в разделе [ Настройки ] ( . . / operations / settings / index . md ) . <nl> <nl> ` ` ` bash <nl> $ echo ' SELECT number FROM system . numbers LIMIT 10 ' | curl ' http : / / localhost : 8123 / ? ' - - data - binary @ - <nl> $ echo ' SELECT number FROM system . numbers LIMIT 10 ' | curl ' http : / / localhost : 812 <nl> <nl> Об остальных параметрах смотри раздел " SET " . <nl> <nl> - В HTTP - протоколе можно использовать ClickHouse - сессии , для этого необходимо добавить к запросу GET - пaраметр ` session_id ` . В качестве идентификатора сессии можно использовать произвольную строку . По умолчанию через 60 секунд бездействия сессия будет прервана . Можно изменить этот таймаут , изменяя настройку ` default_session_timeout ` в конфигурации сервера , или добавив к запросу GET параметр ` session_timeout ` . Статус сессии можно проверить с помощью параметра ` session_check = 1 ` . В рамках одной сессии одновременно может испольняться только один запрос . <nl> + Аналогично можно использовать ClickHouse - сессии в HTTP - протоколе . Для этого необходимо добавить к запросу GET параметр ` session_id ` . В качестве идентификатора сессии можно использовать произвольную строку . По умолчанию через 60 секунд бездействия сессия будет прервана . Можно изменить этот таймаут , изменяя настройку ` default_session_timeout ` в конфигурации сервера , или добавив к запросу GET параметр ` session_timeout ` . Статус сессии можно проверить с помощью параметра ` session_check = 1 ` . В рамках одной сессии одновременно может исполняться только один запрос . <nl> <nl> - Имеется возможность получать информацию о прогрессе выполнения запроса в залоголвках X - ClickHouse - Progress , для этого нужно включить настройку send_progress_in_http_headers . <nl> + Имеется возможность получать информацию о прогрессе выполнения запроса в залоголвках X - ClickHouse - Progress . Для этого нужно включить настройку send_progress_in_http_headers . <nl> <nl> Запущенные запросы не останавливаются автоматически при разрыве HTTP соединения . Парсинг и форматирование данных производится на стороне сервера и использование сети может быть неэффективным . <nl> Может быть передан необязательный параметр query_id - идентификатор запроса , произвольная строка . Подробнее смотрите раздел " Настройки , replace_running_query " . <nl> mmm a / docs / ru / operations / settings / settings . md <nl> ppp b / docs / ru / operations / settings / settings . md <nl> ClickHouse применяет настройку в тех случаях , ко <nl> <nl> Возможные значения : <nl> <nl> - - 0 — функциональность выключена . <nl> - - 1 — функциональность включена . <nl> + - 0 — выключена . <nl> + - 1 — включена . <nl> <nl> Значение по умолчанию : 0 . <nl> <nl> ClickHouse применяет настройку в тех случаях , ко <nl> <nl> # # fsync_metadata <nl> <nl> - Включить или отключить fsync при записи . sql файлов . По умолчанию включено . <nl> + Включает или отключает [ fsync ] ( http : / / pubs . opengroup . org / onlinepubs / 9699919799 / functions / fsync . html ) при записи ` . sql ` файлов . По умолчанию включено . <nl> <nl> Имеет смысл выключать , если на сервере миллионы мелких таблиц - чанков , которые постоянно создаются и уничтожаются . <nl> <nl> + # # enable_http_compression { # settings - enable_http_compression } <nl> + <nl> + Включает или отключает сжатие данных в ответе на HTTP - запрос . <nl> + <nl> + Для получения дополнительной информации , читайте [ Описание интерфейса HTTP ] ( . . / . . / interfaces / http . md ) . <nl> + <nl> + Возможные значения : <nl> + <nl> + - 0 — выключена . <nl> + - 1 — включена . <nl> + <nl> + Значение по умолчанию : 0 . <nl> + <nl> + # # http_zlib_compression_level { # settings - http_zlib_compression_level } <nl> + <nl> + Задает уровень сжатия данных в ответе на HTTP - запрос , если [ enable_http_compression = 1 ] ( # settings - enable_http_compression ) . <nl> + <nl> + Возможные значения : числа от 1 до 9 . <nl> + <nl> + Значение по умолчанию : 3 . <nl> + <nl> + # # http_native_compression_disable_checksumming_on_decompress { # settings - http_native_compression_disable_checksumming_on_decompress } <nl> + <nl> + Включает или отключает проверку контрольной суммы при распаковке данных HTTP POST от клиента . Используется только для собственного ( ` Navite ` ) формата сжатия ClickHouse ( ни ` gzip ` , ни ` deflate ` ) . <nl> + <nl> + Для получения дополнительной информации , читайте [ Описание интерфейса HTTP ] ( . . / . . / interfaces / http . md ) . <nl> + <nl> + Возможные значения : <nl> + <nl> + - 0 — выключена . <nl> + - 1 — включена . <nl> + <nl> + Значение по умолчанию : 0 . <nl> + <nl> # # input_format_allow_errors_num <nl> <nl> Устанавливает максимальное количество допустимых ошибок при чтении из текстовых форматов ( CSV , TSV и т . п . ) . <nl> ClickHouse применяет настройку в тех случаях , ко <nl> <nl> # # input_format_values_interpret_expressions { # settings - input_format_values_interpret_expressions } <nl> <nl> - Включает парсер SQL , если потоковый парсер не может проанализировать данные . Этот параметр используется только для формата [ Values ] ( . . / . . / interfaces / formats . md # data - format - values ) при вводе данных . Дополнительные сведения о парсерах читайте в разделе [ Синтаксис ] ( . . / . . / query_language / syntax . md ) . <nl> + Включает или отключает парсер SQL , если потоковый парсер не может проанализировать данные . Этот параметр используется только для формата [ Values ] ( . . / . . / interfaces / formats . md # data - format - values ) при вводе данных . Дополнительные сведения о парсерах читайте в разделе [ Синтаксис ] ( . . / . . / query_language / syntax . md ) . <nl> <nl> Возможные значения : <nl> <nl> - - 0 — функциональность выключена . <nl> + - 0 — выключена . <nl> <nl> В этом случае необходимо вставлять форматированные данные . Смотрите раздел [ Форматы ] ( . . / . . / interfaces / formats . md ) . <nl> <nl> - - 1 — функциональность включена . <nl> + - 1 — включена . <nl> <nl> В этом случае вы можете использовать выражение SQL в качестве значения , но вставка данных намного медленнее . Если вы вставляете только форматированные данные , ClickHouse ведет себя так , как будто значение параметра равно 0 . <nl> <nl> Ok . <nl> <nl> * * Возможные значения * * <nl> <nl> - - 0 — функциональность выключена . <nl> - - 1 — функциональность включена . <nl> + - 0 — выключена . <nl> + - 1 — включена . <nl> <nl> * * Значение по умолчанию * * : 0 . <nl> <nl> ClickHouse использует этот параметр при чтении д <nl> <nl> # # select_sequential_consistency { # settings - select_sequential_consistency } <nl> <nl> - Включение / выключение последовательной консистентности для запросов ` SELECT ` : <nl> + Включает или выключает последовательную консистентность для запросов ` SELECT ` . <nl> + <nl> + Возможные значения : <nl> <nl> - 0 — выключена . <nl> - 1 — включена . <nl> + <nl> Значение по умолчанию : 0 . <nl> <nl> + * * Использование * * <nl> + <nl> Когда последовательная консистентность включена , то ClickHouse позволит клиенту выполнить запрос ` SELECT ` только к тем репликам , которые содержат данные всех предыдущих запросов ` INSERT ` , выполненных с ` insert_quorum ` . Если клиент обратится к неполной реплике , то ClickHouse сгенерирует исключение . В запросе SELECT не будут участвовать данные , которые ещё не были записаны на кворум реплик . <nl> <nl> - См . также параметры : <nl> + * * Смотрите также * * <nl> <nl> - [ insert_quorum ] ( # settings - insert_quorum ) <nl> - [ insert_quorum_timeout ] ( # settings - insert_quorum_timeout ) <nl>
|
DOCAPI - 4177 : HTTP compression settings . EN review . RU translation . ( )
|
ClickHouse/ClickHouse
|
f12fff6e1212cf7fc937b95cff6065f78b6faca7
|
2019-04-15T11:47:45Z
|
mmm a / ios / sdk / WeexSDK / Sources / Model / WXSDKInstance_performance . m <nl> ppp b / ios / sdk / WeexSDK / Sources / Model / WXSDKInstance_performance . m <nl> - ( void ) onViewLoad : ( WXComponent * ) targetComponent <nl> double modifyTime = CACurrentMediaTime ( ) * 1000 ; <nl> <nl> __weak WXComponent * weakComponent = targetComponent ; <nl> + __weak WXPerformance * weakSelf = self ; <nl> + <nl> dispatch_async ( dispatch_get_main_queue ( ) , ^ { <nl> __strong WXComponent * strongComponent = weakComponent ; <nl> - if ( nil = = strongComponent ) { <nl> + __strong WXPerformance * strongSelf = weakSelf ; <nl> + <nl> + if ( nil = = strongComponent | | nil = = strongSelf ) { <nl> return ; <nl> } <nl> - if ( ! [ self _verifyComponent : strongComponent ] ) { <nl> + <nl> + if ( ! [ strongSelf _verifyComponent : strongComponent ] ) { <nl> return ; <nl> } <nl> - self . interactionAddCountRecord + + ; <nl> - <nl> - [ self _handleRenderTime : strongComponent withModifyTime : modifyTime ] ; <nl> + strongSelf . interactionAddCountRecord + + ; <nl> + [ strongSelf _handleRenderTime : strongComponent withModifyTime : modifyTime ] ; <nl> } ) ; <nl> } <nl> <nl>
|
Merge pull request from wqyfavor / fix - apm
|
apache/incubator-weex
|
4ff42cc4805db482af7b4139fe02b7804a3a34b0
|
2019-05-16T01:59:01Z
|
mmm a / src / Dictionaries / ClickHouseDictionarySource . cpp <nl> ppp b / src / Dictionaries / ClickHouseDictionarySource . cpp <nl> <nl> # include < memory > <nl> # include < Client / ConnectionPool . h > <nl> # include < DataStreams / RemoteBlockInputStream . h > <nl> + # include < DataStreams / ConvertingBlockInputStream . h > <nl> # include < IO / ConnectionTimeouts . h > <nl> # include < Interpreters / executeQuery . h > <nl> # include < Common / isLocalAddress . h > <nl> BlockInputStreamPtr ClickHouseDictionarySource : : loadAll ( ) <nl> { <nl> BlockIO res = executeQuery ( load_all_query , context , true ) ; <nl> / / / FIXME res . in may implicitly use some objects owned be res , but them will be destructed after return <nl> + res . in = std : : make_shared < ConvertingBlockInputStream > ( context , res . in , sample_block , ConvertingBlockInputStream : : MatchColumnsMode : : Position ) ; <nl> return res . in ; <nl> } <nl> return std : : make_shared < RemoteBlockInputStream > ( pool , load_all_query , sample_block , context ) ; <nl> BlockInputStreamPtr ClickHouseDictionarySource : : loadUpdatedAll ( ) <nl> { <nl> std : : string load_update_query = getUpdateFieldAndDate ( ) ; <nl> if ( is_local ) <nl> - return executeQuery ( load_update_query , context , true ) . in ; <nl> + { <nl> + auto res = executeQuery ( load_update_query , context , true ) ; <nl> + res . in = std : : make_shared < ConvertingBlockInputStream > ( context , res . in , sample_block , ConvertingBlockInputStream : : MatchColumnsMode : : Position ) ; <nl> + return res . in ; <nl> + } <nl> return std : : make_shared < RemoteBlockInputStream > ( pool , load_update_query , sample_block , context ) ; <nl> } <nl> <nl> std : : string ClickHouseDictionarySource : : toString ( ) const <nl> BlockInputStreamPtr ClickHouseDictionarySource : : createStreamForSelectiveLoad ( const std : : string & query ) <nl> { <nl> if ( is_local ) <nl> - return executeQuery ( query , context , true ) . in ; <nl> + { <nl> + auto res = executeQuery ( query , context , true ) ; <nl> + res . in = std : : make_shared < ConvertingBlockInputStream > ( <nl> + context , res . in , sample_block , ConvertingBlockInputStream : : MatchColumnsMode : : Position ) ; <nl> + return res . in ; <nl> + } <nl> <nl> return std : : make_shared < RemoteBlockInputStream > ( pool , query , sample_block , context ) ; <nl> } <nl> new file mode 100644 <nl> index 00000000000 . . ac390663059 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01113_local_dictionary_type_conversion . reference <nl> <nl> + First WINDOWS 1 <nl> + Second LINUX 2 <nl> new file mode 100644 <nl> index 00000000000 . . df1f405e286 <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01113_local_dictionary_type_conversion . sql <nl> <nl> + DROP DATABASE IF EXISTS database_for_dict ; <nl> + <nl> + CREATE DATABASE database_for_dict ; <nl> + <nl> + CREATE TABLE database_for_dict . table_for_dict ( <nl> + CompanyID String , <nl> + OSType Enum ( ' UNKNOWN ' = 0 , ' WINDOWS ' = 1 , ' LINUX ' = 2 , ' ANDROID ' = 3 , ' MAC ' = 4 ) , <nl> + SomeID Int32 <nl> + ) <nl> + ENGINE = Memory ( ) ; <nl> + <nl> + INSERT INTO database_for_dict . table_for_dict VALUES ( ' First ' , ' WINDOWS ' , 1 ) , ( ' Second ' , ' LINUX ' , 2 ) ; <nl> + <nl> + CREATE DICTIONARY database_for_dict . dict_with_conversion <nl> + ( <nl> + CompanyID String DEFAULT ' ' , <nl> + OSType String DEFAULT ' ' , <nl> + SomeID Int32 DEFAULT 0 <nl> + ) <nl> + PRIMARY KEY CompanyID <nl> + SOURCE ( CLICKHOUSE ( HOST ' localhost ' PORT 9000 USER ' default ' TABLE ' table_for_dict ' DB ' database_for_dict ' ) ) <nl> + LIFETIME ( MIN 1 MAX 20 ) <nl> + LAYOUT ( COMPLEX_KEY_HASHED ( ) ) ; <nl> + <nl> + SELECT * FROM database_for_dict . dict_with_conversion ORDER BY CompanyID ; <nl> + <nl> + DROP DATABASE IF EXISTS database_for_dict ; <nl>
|
Merge pull request from ClickHouse / add_conversion_stream
|
ClickHouse/ClickHouse
|
491f4b2c60e1d0e2d8ba5bb4c5842e0961299486
|
2020-04-07T23:13:17Z
|
mmm a / utils / swift - api - dump . py <nl> ppp b / utils / swift - api - dump . py <nl> <nl> # ( Objective - ) C APIs , any API notes added on top of those APIs , and the <nl> # Clang importer itself . One can execute it to dump the API of a given <nl> # module within a particular SDK , e . g . , UIKit from the iOS SDK as seen in <nl> - # Swift 3 compatibility mode : <nl> + # Swift 4 compatibility mode : <nl> # <nl> - # / path / to / bin / dir / swift - api - dump . py - swift - version 3 - o output - dir \ <nl> + # / path / to / bin / dir / swift - api - dump . py - swift - version 4 - o output - dir \ <nl> # - m UIKit - s iphoneos <nl> # <nl> # The " - m " argument can be omitted , in which case the script will collect <nl> <nl> # <nl> # One can supply multiple SDKs , written as a list . For example , to <nl> # dump the API for all frameworks across macOS , iOS , watchOS , and tvOS , <nl> - # in Swift 4 , use : <nl> + # in Swift 4 . 2 , use : <nl> # <nl> - # / path / to / bin / dir / swift - api - dump . py - swift - version 4 - o output - dir \ <nl> + # / path / to / bin / dir / swift - api - dump . py - swift - version 4 . 2 - o output - dir \ <nl> # - s macosx iphoneos watchos appletvos <nl> # <nl> <nl> def create_parser ( ) : <nl> parser . add_argument ( ' - - enable - infer - import - as - member ' , action = ' store_true ' , <nl> help = ' Infer when a global could be imported as a ' + <nl> ' member . ' ) <nl> - parser . add_argument ( ' - swift - version ' , type = int , metavar = ' N ' , <nl> + parser . add_argument ( ' - swift - version ' , metavar = ' N ' , <nl> help = ' the Swift version to use ' ) <nl> parser . add_argument ( ' - show - overlay ' , action = ' store_true ' , <nl> help = ' Show overlay API in addition to Objective - C ' + <nl> def main ( ) : <nl> if args . enable_infer_import_as_member : <nl> extra_args = extra_args + [ ' - enable - infer - import - as - member ' ] <nl> if args . swift_version : <nl> - extra_args = extra_args + [ ' - swift - version ' , ' % d ' % args . swift_version ] <nl> + extra_args = extra_args + [ ' - swift - version ' , ' % s ' % args . swift_version ] <nl> <nl> # Create a . swift file we can feed into swift - ide - test <nl> subprocess . call ( [ ' touch ' , source_filename ] ) <nl>
|
[ swift - api - dump ] Support arbitrary version strings , e . g . , " 4 . 2 "
|
apple/swift
|
8082d391bdb6c704a0e32f13efd1effc2193d8b2
|
2018-06-26T20:39:42Z
|
mmm a / dbms / src / Processors / Executors / TreeExecutorBlockInputStream . cpp <nl> ppp b / dbms / src / Processors / Executors / TreeExecutorBlockInputStream . cpp <nl> void TreeExecutorBlockInputStream : : initRowsBeforeLimit ( ) <nl> } <nl> } <nl> <nl> - if ( ! rows_before_limit_at_least & & ( ! limit_transforms . empty ( ) & & ! sources . empty ( ) ) ) <nl> + if ( ! rows_before_limit_at_least & & ( ! limit_transforms . empty ( ) | | ! sources . empty ( ) ) ) <nl> { <nl> rows_before_limit_at_least = std : : make_shared < RowsBeforeLimitCounter > ( ) ; <nl> <nl> mmm a / dbms / src / Processors / QueryPipeline . cpp <nl> ppp b / dbms / src / Processors / QueryPipeline . cpp <nl> void QueryPipeline : : initRowsBeforeLimit ( ) <nl> } <nl> } <nl> <nl> - if ( ! rows_before_limit_at_least & & ( ! limits . empty ( ) & & ! sources . empty ( ) ) ) <nl> + if ( ! rows_before_limit_at_least & & ( ! limits . empty ( ) | | ! sources . empty ( ) ) ) <nl> { <nl> rows_before_limit_at_least = std : : make_shared < RowsBeforeLimitCounter > ( ) ; <nl> <nl>
|
Fix build .
|
ClickHouse/ClickHouse
|
b4a93c092d612d3c89a6ab3c34fe3587e65373dd
|
2020-03-19T14:16:49Z
|
mmm a / Marlin / Marlin_main . cpp <nl> ppp b / Marlin / Marlin_main . cpp <nl> inline void gcode_T ( uint8_t tmp_extruder ) { <nl> } <nl> / / No extra case for AUTO_BED_LEVELING_FEATURE in DUAL_X_CARRIAGE . Does that mean they don ' t work together ? <nl> # else / / ! DUAL_X_CARRIAGE <nl> + <nl> + / / <nl> + / / Set current_position to the position of the new nozzle . <nl> + / / Offsets are based on linear distance , so we need to get <nl> + / / the resulting position in coordinate space . <nl> + / / <nl> + / / - With grid or 3 - point leveling , offset XYZ by a tilted vector <nl> + / / - With mesh leveling , update Z for the new position <nl> + / / - Otherwise , just use the raw linear distance <nl> + / / <nl> + / / Software endstops are altered here too . Consider a case where : <nl> + / / E0 at X = 0 . . . E1 at X = 10 <nl> + / / When we switch to E1 now X = 10 , but E1 can ' t move left . <nl> + / / To express this we apply the change in XY to the software endstops . <nl> + / / E1 can move farther right than E0 , so the right limit is extended . <nl> + / / <nl> + / / Note that we don ' t adjust the Z software endstops . Why not ? <nl> + / / Consider a case where Z = 0 ( here ) and switching to E1 makes Z = 1 <nl> + / / because the bed is 1mm lower at the new position . As long as <nl> + / / the first nozzle is out of the way , the carriage should be <nl> + / / allowed to move 1mm lower . This technically " breaks " the <nl> + / / Z software endstop . But this is technically correct ( and <nl> + / / there is no viable alternative ) . <nl> + / / <nl> + float xydiff [ 2 ] = { <nl> + hotend_offset [ X_AXIS ] [ tmp_extruder ] - hotend_offset [ X_AXIS ] [ active_extruder ] , <nl> + hotend_offset [ Y_AXIS ] [ tmp_extruder ] - hotend_offset [ Y_AXIS ] [ active_extruder ] <nl> + } ; <nl> + <nl> # if ENABLED ( AUTO_BED_LEVELING_FEATURE ) <nl> / / Offset extruder , make sure to apply the bed level rotation matrix <nl> vector_3 tmp_offset_vec = vector_3 ( hotend_offset [ X_AXIS ] [ tmp_extruder ] , <nl> inline void gcode_T ( uint8_t tmp_extruder ) { <nl> <nl> # endif / / ! AUTO_BED_LEVELING_FEATURE <nl> <nl> + / / The newly - selected extruder XY is actually at . . . <nl> + current_position [ X_AXIS ] + = xydiff [ X_AXIS ] ; <nl> + current_position [ Y_AXIS ] + = xydiff [ Y_AXIS ] ; <nl> + <nl> + # endif / / no bed leveling <nl> + <nl> + for ( uint8_t i = X_AXIS ; i < = Y_AXIS ; i + + ) { <nl> + position_shift [ i ] + = xydiff [ i ] ; <nl> + update_software_endstops ( ( AxisEnum ) i ) ; <nl> + } <nl> + <nl> / / Set the new active extruder <nl> active_extruder = tmp_extruder ; <nl> <nl>
|
Position adjustment for bed leveling
|
MarlinFirmware/Marlin
|
9c800d1f8c01ba3a2ddbe38ba01f99875ab2234f
|
2016-06-16T03:49:36Z
|
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> os : <nl> <nl> osx_image : xcode8 <nl> <nl> + group : deprecated - 2017Q4 <nl> + <nl> # Use Build Matrix to do lint and build seperately <nl> env : <nl> matrix : <nl>
|
Update . travis . yml ( )
|
dmlc/xgboost
|
4fa917b19faa2409a4ac52e022e893bdd7d2be20
|
2017-12-15T21:09:36Z
|
mmm a / src / arm / code - stubs - arm . cc <nl> ppp b / src / arm / code - stubs - arm . cc <nl> static const AheadOfTimeWriteBarrierStubList kAheadOfTime [ ] = { <nl> <nl> # undef REG <nl> <nl> + <nl> bool RecordWriteStub : : IsPregenerated ( ) { <nl> for ( const AheadOfTimeWriteBarrierStubList * entry = kAheadOfTime ; <nl> ! entry - > object . is ( no_reg ) ; <nl> void RecordWriteStub : : GenerateFixedRegStubsAheadOfTime ( ) { <nl> } <nl> <nl> <nl> + bool CodeStub : : CanUseFPRegisters ( ) { <nl> + return CpuFeatures : : IsSupported ( VFP2 ) ; <nl> + } <nl> + <nl> + <nl> / / Takes the input in 3 registers : address_ value_ and object_ . A pointer to <nl> / / the value has just been written into the object , now this stub makes sure <nl> / / we keep the GC informed . The word in the object where the value has been <nl> mmm a / src / code - stubs . h <nl> ppp b / src / code - stubs . h <nl> class CodeStub BASE_EMBEDDED { <nl> / / Lookup the code in the ( possibly custom ) cache . <nl> bool FindCodeInCache ( Code * * code_out ) ; <nl> <nl> + protected : <nl> + static bool CanUseFPRegisters ( ) ; <nl> + <nl> private : <nl> / / Nonvirtual wrapper around the stub - specific Generate function . Call <nl> / / this function to set up the macro assembler and generate the code . <nl> class KeyedStoreElementStub : public CodeStub { <nl> KeyedAccessGrowMode grow_mode ) <nl> : is_js_array_ ( is_js_array ) , <nl> elements_kind_ ( elements_kind ) , <nl> - grow_mode_ ( grow_mode ) { } <nl> + grow_mode_ ( grow_mode ) , <nl> + fp_registers_ ( CanUseFPRegisters ( ) ) { } <nl> <nl> Major MajorKey ( ) { return KeyedStoreElement ; } <nl> int MinorKey ( ) { <nl> return ElementsKindBits : : encode ( elements_kind_ ) | <nl> IsJSArrayBits : : encode ( is_js_array_ ) | <nl> - GrowModeBits : : encode ( grow_mode_ ) ; <nl> + GrowModeBits : : encode ( grow_mode_ ) | <nl> + FPRegisters : : encode ( fp_registers_ ) ; <nl> } <nl> <nl> void Generate ( MacroAssembler * masm ) ; <nl> class KeyedStoreElementStub : public CodeStub { <nl> class ElementsKindBits : public BitField < ElementsKind , 0 , 8 > { } ; <nl> class GrowModeBits : public BitField < KeyedAccessGrowMode , 8 , 1 > { } ; <nl> class IsJSArrayBits : public BitField < bool , 9 , 1 > { } ; <nl> + class FPRegisters : public BitField < bool , 10 , 1 > { } ; <nl> <nl> bool is_js_array_ ; <nl> ElementsKind elements_kind_ ; <nl> KeyedAccessGrowMode grow_mode_ ; <nl> + bool fp_registers_ ; <nl> <nl> DISALLOW_COPY_AND_ASSIGN ( KeyedStoreElementStub ) ; <nl> } ; <nl> class ElementsTransitionAndStoreStub : public CodeStub { <nl> <nl> class StoreArrayLiteralElementStub : public CodeStub { <nl> public : <nl> - explicit StoreArrayLiteralElementStub ( ) { } <nl> + StoreArrayLiteralElementStub ( ) <nl> + : fp_registers_ ( CanUseFPRegisters ( ) ) { } <nl> <nl> private : <nl> + class FPRegisters : public BitField < bool , 0 , 1 > { } ; <nl> + <nl> Major MajorKey ( ) { return StoreArrayLiteralElement ; } <nl> - int MinorKey ( ) { return 0 ; } <nl> + int MinorKey ( ) { return FPRegisters : : encode ( fp_registers_ ) ; } <nl> <nl> void Generate ( MacroAssembler * masm ) ; <nl> <nl> + bool fp_registers_ ; <nl> + <nl> DISALLOW_COPY_AND_ASSIGN ( StoreArrayLiteralElementStub ) ; <nl> } ; <nl> <nl> mmm a / src / ia32 / code - stubs - ia32 . cc <nl> ppp b / src / ia32 / code - stubs - ia32 . cc <nl> void RecordWriteStub : : GenerateFixedRegStubsAheadOfTime ( ) { <nl> } <nl> <nl> <nl> + bool CodeStub : : CanUseFPRegisters ( ) { <nl> + return CpuFeatures : : IsSupported ( SSE2 ) ; <nl> + } <nl> + <nl> + <nl> / / Takes the input in 3 registers : address_ value_ and object_ . A pointer to <nl> / / the value has just been written into the object , now this stub makes sure <nl> / / we keep the GC informed . The word in the object where the value has been <nl> mmm a / src / ic . h <nl> ppp b / src / ic . h <nl> class KeyedStoreIC : public KeyedIC { <nl> } <nl> <nl> MUST_USE_RESULT MaybeObject * Store ( State state , <nl> - StrictModeFlag strict_mode , <nl> + StrictModeFlag strict_mode , <nl> Handle < Object > object , <nl> Handle < Object > name , <nl> Handle < Object > value , <nl> mmm a / src / mips / code - stubs - mips . cc <nl> ppp b / src / mips / code - stubs - mips . cc <nl> void RecordWriteStub : : GenerateFixedRegStubsAheadOfTime ( ) { <nl> } <nl> <nl> <nl> + bool CodeStub : : CanUseFPRegisters ( ) { <nl> + return CpuFeatures : : IsSupported ( FPU ) ; <nl> + } <nl> + <nl> + <nl> / / Takes the input in 3 registers : address_ value_ and object_ . A pointer to <nl> / / the value has just been written into the object , now this stub makes sure <nl> / / we keep the GC informed . The word in the object where the value has been <nl> mmm a / src / x64 / code - stubs - x64 . cc <nl> ppp b / src / x64 / code - stubs - x64 . cc <nl> void RecordWriteStub : : GenerateFixedRegStubsAheadOfTime ( ) { <nl> } <nl> <nl> <nl> + bool CodeStub : : CanUseFPRegisters ( ) { <nl> + return true ; / / Always have SSE2 on x64 . <nl> + } <nl> + <nl> + <nl> / / Takes the input in 3 registers : address_ value_ and object_ . A pointer to <nl> / / the value has just been written into the object , now this stub makes sure <nl> / / we keep the GC informed . The word in the object where the value has been <nl>
|
Add the VFP - ness to the minor number of the keyed store elements
|
v8/v8
|
fbcc4a408e5d840166d64fe99de6d46b22287469
|
2012-09-27T11:31:26Z
|
mmm a / DEPS <nl> ppp b / DEPS <nl> gclient_gn_args = [ <nl> <nl> vars = { <nl> ' chromium_version ' : <nl> - ' f707f1d6d428f84cf14b64bc2ca74372e25c6ce7 ' , <nl> + ' 8fe78d4711fb243c83a66a7fded00f3408107778 ' , <nl> ' node_version ' : <nl> ' v12 . 14 . 1 ' , <nl> ' nan_version ' : <nl> mmm a / electron_paks . gni <nl> ppp b / electron_paks . gni <nl> template ( " electron_extra_paks " ) { <nl> " $ root_gen_dir / components / components_resources . pak " , <nl> " $ root_gen_dir / content / browser / tracing / tracing_resources . pak " , <nl> " $ root_gen_dir / content / content_resources . pak " , <nl> + " $ root_gen_dir / content / dev_ui_content_resources . pak " , <nl> " $ root_gen_dir / mojo / public / js / mojo_bindings_resources . pak " , <nl> " $ root_gen_dir / net / net_resources . pak " , <nl> " $ root_gen_dir / third_party / blink / public / resources / blink_resources . pak " , <nl> template ( " electron_extra_paks " ) { <nl> ] <nl> deps = [ <nl> " / / components / resources " , <nl> - " / / content : resources " , <nl> + " / / content : content_resources " , <nl> + " / / content : dev_ui_content_resources " , <nl> " / / content / browser / tracing : resources " , <nl> " / / electron : resources " , <nl> " / / mojo / public / js : resources " , <nl> mmm a / patches / chromium / accelerator . patch <nl> ppp b / patches / chromium / accelerator . patch <nl> This patch makes three changes to Accelerator : : GetShortcutText to improve shortc <nl> 3 . Ctrl - Shift - = should show as Ctrl - + <nl> <nl> - + mmm a / ui / base / accelerators / accelerator . cc <nl> ppp b / ui / base / accelerators / accelerator . cc <nl> <nl> index 025a82c14dd379f82e6c8242727346bd21e768f3 . . 8b8b0e77c355acd1ef22fb51b89f65f9 <nl> <nl> namespace ui { <nl> <nl> - base : : string16 Accelerator : : GetShortcutText ( ) const { <nl> + base : : string16 Accelerator : : GetShortcutText ( ) const { <nl> shortcut = KeyCodeToName ( ) ; <nl> # endif <nl> <nl> index 025a82c14dd379f82e6c8242727346bd21e768f3 . . 8b8b0e77c355acd1ef22fb51b89f65f9 <nl> # if defined ( OS_WIN ) <nl> / / Our fallback is to try translate the key code to a regular character <nl> / / unless it is one of digits ( VK_0 to VK_9 ) . Some keyboard <nl> - base : : string16 Accelerator : : GetShortcutText ( ) const { <nl> + base : : string16 Accelerator : : GetShortcutText ( ) const { <nl> / / accent ' for ' 0 ' ) . For display in the menu ( e . g . Ctrl - 0 for the <nl> / / default zoom level ) , we leave VK_ [ 0 - 9 ] alone without translation . <nl> wchar_t key ; <nl> index 025a82c14dd379f82e6c8242727346bd21e768f3 . . 8b8b0e77c355acd1ef22fb51b89f65f9 <nl> } <nl> <nl> # if defined ( OS_MACOSX ) <nl> - base : : string16 Accelerator : : ApplyLongFormModifiers ( <nl> + base : : string16 Accelerator : : ApplyLongFormModifiers ( <nl> / / more information . <nl> if ( IsCtrlDown ( ) ) <nl> shortcut = ApplyModifierToAcceleratorString ( shortcut , IDS_APP_CTRL_KEY ) ; <nl> mmm a / patches / chromium / blink_file_path . patch <nl> ppp b / patches / chromium / blink_file_path . patch <nl> index 888fb19b976194c173286f92b26c4bc9362bcf9c . . 9d243bc70089685f018b14eba0025cfd <nl> / / http : / / dev . w3 . org / 2006 / webapi / FileAPI / # file - attrs <nl> int64_t lastModified ( ) const ; <nl> - + mmm a / third_party / blink / renderer / core / fileapi / file . idl <nl> ppp b / third_party / blink / renderer / core / fileapi / file . idl <nl> <nl> ] interface File : Blob { <nl> - [ CallWith = ExecutionContext ] constructor ( sequence < BlobPart > fileBits , USVString fileName , optional FilePropertyBag options ) ; <nl> + [ CallWith = ExecutionContext ] constructor ( sequence < BlobPart > fileBits , USVString fileName , optional FilePropertyBag options = { } ) ; <nl> readonly attribute DOMString name ; <nl> + readonly attribute DOMString path ; <nl> readonly attribute long long lastModified ; <nl> mmm a / patches / chromium / blink_local_frame . patch <nl> ppp b / patches / chromium / blink_local_frame . patch <nl> when there is code doing that . <nl> This patch reverts the change to fix the crash in Electron . <nl> <nl> - + mmm a / third_party / blink / renderer / core / frame / local_frame . cc <nl> ppp b / third_party / blink / renderer / core / frame / local_frame . cc <nl> - void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> + void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> } <nl> CHECK ( ! view_ | | ! view_ - > IsAttached ( ) ) ; <nl> <nl> index f7536b085bc5c0fd4853ac905bf7b7c0160d60b7 . . 36303725d92c76581ea91d06674408aa <nl> if ( ! Client ( ) ) <nl> return ; <nl> <nl> - void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> + void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> / / Notify ScriptController that the frame is closing , since its cleanup ends <nl> / / up calling back to LocalFrameClient via WindowProxy . <nl> GetScriptController ( ) . ClearForClose ( ) ; <nl> mmm a / patches / chromium / blink_world_context . patch <nl> ppp b / patches / chromium / blink_world_context . patch <nl> This exposes a method for obtaining a reference to an isolated world , which is <nl> otherwise not available in the Blink API . <nl> <nl> - + mmm a / third_party / blink / public / web / web_local_frame . h <nl> ppp b / third_party / blink / public / web / web_local_frame . h <nl> - class WebLocalFrame : public WebFrame { <nl> + class WebLocalFrame : public WebFrame { <nl> / / be calling this API . <nl> virtual v8 : : Local < v8 : : Context > MainWorldScriptContext ( ) const = 0 ; <nl> <nl> index 461e1574cd55860ea62a2c7f509a2fdb4134c898 . . 0f45096b984f64fb0c094cd0996a2afb <nl> / / that the script evaluated to with callback . Script execution can be <nl> / / suspend . <nl> - + mmm a / third_party / blink / renderer / core / frame / web_local_frame_impl . cc <nl> ppp b / third_party / blink / renderer / core / frame / web_local_frame_impl . cc <nl> - v8 : : Local < v8 : : Object > WebLocalFrameImpl : : GlobalProxy ( ) const { <nl> + v8 : : Local < v8 : : Object > WebLocalFrameImpl : : GlobalProxy ( ) const { <nl> return MainWorldScriptContext ( ) - > Global ( ) ; <nl> } <nl> <nl> index 3de275c61ba6d1aa612de9036253906e4eb5638a . . 3912a5797fad331ab8b754abe9474b63 <nl> return BindingSecurity : : ShouldAllowAccessToFrame ( <nl> CurrentDOMWindow ( V8PerIsolateData : : MainThreadIsolate ( ) ) , <nl> - + mmm a / third_party / blink / renderer / core / frame / web_local_frame_impl . h <nl> ppp b / third_party / blink / renderer / core / frame / web_local_frame_impl . h <nl> - class CORE_EXPORT WebLocalFrameImpl final <nl> + class CORE_EXPORT WebLocalFrameImpl final <nl> int argc , <nl> v8 : : Local < v8 : : Value > argv [ ] ) override ; <nl> v8 : : Local < v8 : : Context > MainWorldScriptContext ( ) const override ; <nl> mmm a / patches / chromium / can_create_window . patch <nl> ppp b / patches / chromium / can_create_window . patch <nl> potentially prevent a window from being created . <nl> TODO ( loc ) : this patch is currently broken . <nl> <nl> - + mmm a / content / browser / frame_host / render_frame_host_impl . cc <nl> ppp b / content / browser / frame_host / render_frame_host_impl . cc <nl> - void RenderFrameHostImpl : : CreateNewWindow ( <nl> + void RenderFrameHostImpl : : CreateNewWindow ( <nl> last_committed_origin_ , params - > window_container_type , <nl> params - > target_url , params - > referrer . To < Referrer > ( ) , <nl> params - > frame_name , params - > disposition , * params - > features , <nl> index 563e07a5ac2d9c44c4484d59e3fc025c70b961ea . . 60e36fab0e6999688b88665d9ad3181a <nl> & no_javascript_access ) ; <nl> <nl> - + mmm a / content / common / frame . mojom <nl> ppp b / content / common / frame . mojom <nl> - struct CreateNewWindowParams { <nl> + struct CreateNewWindowParams { <nl> <nl> / / The window features to use for the new window . <nl> blink . mojom . WindowFeatures features ; <nl> index fb4cdca43e59c2dd8156cbe12bec391b128a6dd9 . . 5c3645bebf2009def133fcd845f50e77 <nl> <nl> / / Operation result when the renderer asks the browser to create a new window . <nl> - + mmm a / content / public / browser / content_browser_client . cc <nl> ppp b / content / public / browser / content_browser_client . cc <nl> - bool ContentBrowserClient : : CanCreateWindow ( <nl> + bool ContentBrowserClient : : CanCreateWindow ( <nl> const std : : string & frame_name , <nl> WindowOpenDisposition disposition , <nl> const blink : : mojom : : WindowFeatures & features , <nl> index 0788e0f5e4311d8978768cb0d4d09736c19d2d25 . . 0baf2ab441d48ee32a3ccf40fbc73c2c <nl> bool opener_suppressed , <nl> bool * no_javascript_access ) { <nl> - + mmm a / content / public / browser / content_browser_client . h <nl> ppp b / content / public / browser / content_browser_client . h <nl> - class NetworkService ; <nl> + class NetworkService ; <nl> class TrustedURLLoaderHeaderClient ; <nl> } / / namespace mojom <nl> struct ResourceRequest ; <nl> index 16c89377db5909ace2d12281a5ad4db49076e805 . . 3a32228e8c131468c535f3586b1c54b3 <nl> } / / namespace network <nl> <nl> namespace rappor { <nl> - class CONTENT_EXPORT ContentBrowserClient { <nl> + class CONTENT_EXPORT ContentBrowserClient { <nl> const std : : string & frame_name , <nl> WindowOpenDisposition disposition , <nl> const blink : : mojom : : WindowFeatures & features , <nl> index 16c89377db5909ace2d12281a5ad4db49076e805 . . 3a32228e8c131468c535f3586b1c54b3 <nl> bool opener_suppressed , <nl> bool * no_javascript_access ) ; <nl> - + mmm a / content / renderer / render_view_impl . cc <nl> ppp b / content / renderer / render_view_impl . cc <nl> <nl> index 23ea7af344a1eaca2d0301cee9fe4bedde57b93a . . 37ac96bb7d42fe4caeb3186187521907 <nl> # include " content / renderer / media / audio / audio_device_factory . h " <nl> # include " content / renderer / render_frame_impl . h " <nl> # include " content / renderer / render_frame_proxy . h " <nl> - WebView * RenderViewImpl : : CreateView ( <nl> + WebView * RenderViewImpl : : CreateView ( <nl> } <nl> params - > features = ConvertWebWindowFeaturesToMojoWindowFeatures ( features ) ; <nl> <nl> index 23ea7af344a1eaca2d0301cee9fe4bedde57b93a . . 37ac96bb7d42fe4caeb3186187521907 <nl> / / moved on send . <nl> bool is_background_tab = <nl> - + mmm a / content / shell / browser / web_test / web_test_content_browser_client . cc <nl> ppp b / content / shell / browser / web_test / web_test_content_browser_client . cc <nl> - bool WebTestContentBrowserClient : : CanCreateWindow ( <nl> + bool WebTestContentBrowserClient : : CanCreateWindow ( <nl> const std : : string & frame_name , <nl> WindowOpenDisposition disposition , <nl> const blink : : mojom : : WindowFeatures & features , <nl> mmm a / patches / chromium / dcheck . patch <nl> ppp b / patches / chromium / dcheck . patch <nl> only one or two specific checks fail . Then it ' s better to simply comment out the <nl> failing checks and allow the rest of the target to have them enabled . <nl> <nl> - + mmm a / content / browser / frame_host / navigation_controller_impl . cc <nl> ppp b / content / browser / frame_host / navigation_controller_impl . cc <nl> NavigationType NavigationControllerImpl : : ClassifyNavigation ( <nl> mmm a / patches / chromium / disable_color_correct_rendering . patch <nl> ppp b / patches / chromium / disable_color_correct_rendering . patch <nl> to deal with color spaces . That is being tracked at <nl> https : / / crbug . com / 634542 and https : / / crbug . com / 711107 . <nl> <nl> - + mmm a / cc / trees / layer_tree_host_impl . cc <nl> ppp b / cc / trees / layer_tree_host_impl . cc <nl> const gfx : : ColorSpace & LayerTreeHostImpl : : GetRasterColorSpace ( ) const { <nl> index 20a2cae2de196aede4314e0a94638fdc5be04b75 . . 160092c7e996d0f0232eda91e7a62bb7 <nl> service_manager : : switches : : kGpuSandboxAllowSysVShm , <nl> service_manager : : switches : : kGpuSandboxFailuresFatal , <nl> - + mmm a / content / browser / renderer_host / render_process_host_impl . cc <nl> ppp b / content / browser / renderer_host / render_process_host_impl . cc <nl> <nl> index cd0bc10cda20c0f874d9c315ee16860255287631 . . 0b0529f7000ced635df3442409056f79 <nl> # include " ui / gl / gl_switches . h " <nl> # include " ui / native_theme / native_theme_features . h " <nl> # include " url / origin . h " <nl> - void RenderProcessHostImpl : : PropagateBrowserCommandLineToRenderer ( <nl> + void RenderProcessHostImpl : : PropagateBrowserCommandLineToRenderer ( <nl> / / Propagate the following switches to the renderer command line ( along <nl> / / with any associated values ) if present in the browser command line . <nl> static const char * const kSwitchNames [ ] = { <nl> mmm a / patches / chromium / disable_hidden . patch <nl> ppp b / patches / chromium / disable_hidden . patch <nl> Subject : disable_hidden . patch <nl> Electron uses this to disable background throttling for hidden windows . <nl> <nl> - + mmm a / content / browser / renderer_host / render_widget_host_impl . cc <nl> ppp b / content / browser / renderer_host / render_widget_host_impl . cc <nl> - void RenderWidgetHostImpl : : WasHidden ( ) { <nl> + void RenderWidgetHostImpl : : WasHidden ( ) { <nl> if ( is_hidden_ ) <nl> return ; <nl> <nl> mmm a / patches / chromium / disable_user_gesture_requirement_for_beforeunload_dialogs . patch <nl> ppp b / patches / chromium / disable_user_gesture_requirement_for_beforeunload_dialogs . patch <nl> Subject : disable_user_gesture_requirement_for_beforeunload_dialogs . patch <nl> See https : / / github . com / electron / electron / issues / 10754 <nl> <nl> - + mmm a / third_party / blink / renderer / core / dom / document . cc <nl> ppp b / third_party / blink / renderer / core / dom / document . cc <nl> - bool Document : : DispatchBeforeUnloadEvent ( ChromeClient * chrome_client , <nl> + bool Document : : DispatchBeforeUnloadEvent ( ChromeClient * chrome_client , <nl> " frame that never had a user gesture since its load . " <nl> " https : / / www . chromestatus . com / feature / 5082396709879808 " ; <nl> Intervention : : GenerateReport ( frame_ , " BeforeUnloadNoGesture " , message ) ; <nl> mmm a / patches / chromium / feat_allow_disabling_blink_scheduler_throttling_per_renderview . patch <nl> ppp b / patches / chromium / feat_allow_disabling_blink_scheduler_throttling_per_renderview . patch <nl> index 95679ab2915ad496ca0018aa13874b84eb11d7fd . . c278e0fc072409677beafc7f252ebcf6 <nl> / / <nl> / / Returns the current WebKit preferences . Note : WebPreferences is cached , so <nl> - + mmm a / content / renderer / render_view_impl . cc <nl> ppp b / content / renderer / render_view_impl . cc <nl> - bool RenderViewImpl : : OnMessageReceived ( const IPC : : Message & message ) { <nl> + bool RenderViewImpl : : OnMessageReceived ( const IPC : : Message & message ) { <nl> IPC_BEGIN_MESSAGE_MAP ( RenderViewImpl , message ) <nl> IPC_MESSAGE_HANDLER ( ViewMsg_SetPageScale , OnSetPageScale ) <nl> IPC_MESSAGE_HANDLER ( ViewMsg_SetInitialFocus , OnSetInitialFocus ) <nl> index 37ac96bb7d42fe4caeb31861875219079d986982 . . d4b3d0f71ea6bc6aa9b927f32ee09eb9 <nl> IPC_MESSAGE_HANDLER ( ViewMsg_UpdateTargetURL_ACK , OnUpdateTargetURLAck ) <nl> IPC_MESSAGE_HANDLER ( ViewMsg_UpdateWebPreferences , OnUpdateWebPreferences ) <nl> IPC_MESSAGE_HANDLER ( ViewMsg_ClosePage , OnClosePage ) <nl> - void RenderViewImpl : : OnSetPageScale ( float page_scale_factor ) { <nl> + void RenderViewImpl : : OnSetPageScale ( float page_scale_factor ) { <nl> webview ( ) - > SetPageScaleFactor ( page_scale_factor ) ; <nl> } <nl> <nl> index 37ac96bb7d42fe4caeb31861875219079d986982 . . d4b3d0f71ea6bc6aa9b927f32ee09eb9 <nl> PageVisibilityState visibility_state , <nl> bool initial_setting ) { <nl> - + mmm a / content / renderer / render_view_impl . h <nl> ppp b / content / renderer / render_view_impl . h <nl> - class CONTENT_EXPORT RenderViewImpl : public blink : : WebViewClient , <nl> + class CONTENT_EXPORT RenderViewImpl : public blink : : WebViewClient , <nl> void OnSetInitialFocus ( bool reverse ) ; <nl> void OnSetRendererPrefs ( <nl> const blink : : mojom : : RendererPreferences & renderer_prefs ) ; <nl> mmm a / patches / chromium / fixme_grit_conflicts . patch <nl> ppp b / patches / chromium / fixme_grit_conflicts . patch <nl> Should be removed once grit is fixed . <nl> Tracking bug : https : / / crbug . com / 1040605 <nl> <nl> - + mmm a / tools / gritsettings / resource_ids . spec <nl> ppp b / tools / gritsettings / resource_ids . spec <nl> - <nl> + <nl> " includes " : [ 3840 ] , <nl> } , <nl> <nl> mmm a / patches / chromium / frame_host_manager . patch <nl> ppp b / patches / chromium / frame_host_manager . patch <nl> index 906a1ee4ac58b0744a32153bbaafeac4322a60e4 . . c90f4aead36cbf3767dc5094728963c2 <nl> / / another SiteInstance for the same site . <nl> void RegisterSiteInstance ( SiteInstanceImpl * site_instance ) ; <nl> - + mmm a / content / browser / frame_host / navigation_request . cc <nl> ppp b / content / browser / frame_host / navigation_request . cc <nl> - void NavigationRequest : : BeginNavigation ( ) { <nl> + void NavigationRequest : : BeginNavigation ( ) { <nl> TRACE_EVENT_ASYNC_STEP_INTO0 ( " navigation " , " NavigationRequest " , this , <nl> " ResponseStarted " ) ; <nl> <nl> index a9502e1bb1be5e67bbec201405dd0995770444cb . . 654dfa5b3a1572dd741390a0ad1612b5 <nl> render_frame_host_ = <nl> frame_tree_node_ - > render_manager ( ) - > GetFrameHostForNavigation ( this ) ; <nl> - + mmm a / content / browser / frame_host / render_frame_host_manager . cc <nl> ppp b / content / browser / frame_host / render_frame_host_manager . cc <nl> - bool RenderFrameHostManager : : InitRenderView ( <nl> + bool RenderFrameHostManager : : InitRenderView ( <nl> scoped_refptr < SiteInstance > <nl> RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> NavigationRequest * request ) { <nl> index 5042925bf761245b3ab42e83b009190b390e33ab . . 913245edf9d64bb6bdbee5e96493ad5b <nl> SiteInstance * current_site_instance = render_frame_host_ - > GetSiteInstance ( ) ; <nl> <nl> / / All children of MHTML documents must be MHTML documents . They all live in <nl> - RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> + RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> / / <nl> / / TODO ( clamy ) : We should also consider as a candidate SiteInstance the <nl> / / speculative SiteInstance that was computed on redirects . <nl> index 5042925bf761245b3ab42e83b009190b390e33ab . . 913245edf9d64bb6bdbee5e96493ad5b <nl> <nl> scoped_refptr < SiteInstance > dest_site_instance = GetSiteInstanceForNavigation ( <nl> request - > common_params ( ) . url , request - > GetSourceSiteInstance ( ) , <nl> - RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> + RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> request - > GetRestoreType ( ) ! = RestoreType : : NONE , request - > is_view_source ( ) , <nl> request - > WasServerRedirect ( ) ) ; <nl> <nl> index caa100b3889e17a9afdc8127e0e13bb6b86e8042 . . f08d3a2eb28f0f6fff89b5759eff5369 <nl> size_t GetRelatedActiveContentsCount ( ) override ; <nl> bool RequiresDedicatedProcess ( ) override ; <nl> - + mmm a / content / public / browser / content_browser_client . cc <nl> ppp b / content / public / browser / content_browser_client . cc <nl> <nl> index 0baf2ab441d48ee32a3ccf40fbc73c2c5cbcea2a . . b1646da3383f1799ff47900a00da333d <nl> const MainFunctionParams & parameters ) { <nl> return nullptr ; <nl> - + mmm a / content / public / browser / content_browser_client . h <nl> ppp b / content / public / browser / content_browser_client . h <nl> - class CONTENT_EXPORT ContentBrowserClient { <nl> + class CONTENT_EXPORT ContentBrowserClient { <nl> using IsClipboardPasteAllowedCallback = <nl> base : : OnceCallback < void ( ClipboardPasteAllowed ) > ; <nl> <nl> mmm a / patches / chromium / gritsettings_resource_ids . patch <nl> ppp b / patches / chromium / gritsettings_resource_ids . patch <nl> Subject : gritsettings_resource_ids . patch <nl> Add electron resources file to the list of resource ids generation . <nl> <nl> - + mmm a / tools / gritsettings / resource_ids . spec <nl> ppp b / tools / gritsettings / resource_ids . spec <nl> - <nl> + <nl> " includes " : [ 3860 ] , <nl> } , <nl> <nl> mmm a / patches / chromium / mas - cgdisplayusesforcetogray . patch <nl> ppp b / patches / chromium / mas - cgdisplayusesforcetogray . patch <nl> Subject : mas - cgdisplayusesforcetogray . patch <nl> Removes usage of the CGDisplayUsesForceToGray private API . <nl> <nl> - + mmm a / ui / display / mac / screen_mac . mm <nl> ppp b / ui / display / mac / screen_mac . mm <nl> - Display BuildDisplayForScreen ( NSScreen * screen ) { <nl> - display . set_depth_per_component ( Display : : kHDR10BitsPerComponent ) ; <nl> - } <nl> - } <nl> + Display BuildDisplayForScreen ( NSScreen * screen ) { <nl> + <nl> + display . set_color_depth ( Display : : kDefaultBitsPerPixel ) ; <nl> + display . set_depth_per_component ( Display : : kDefaultBitsPerComponent ) ; <nl> + # ifdef MAS_BUILD <nl> + / / This is equivalent to the CGDisplayUsesForceToGray ( ) API as at 2018 - 08 - 06 , <nl> + / / but avoids usage of the private API . <nl> mmm a / patches / chromium / notification_provenance . patch <nl> ppp b / patches / chromium / notification_provenance . patch <nl> index 5253f6be778cc78571b3df0a33d364a9b1e6ef52 . . dc5307e6500b0bfb5da83e8d8ff8886b <nl> <nl> scoped_refptr < ServiceWorkerContextWrapper > service_worker_context_ ; <nl> - + mmm a / content / browser / notifications / blink_notification_service_impl_unittest . cc <nl> ppp b / content / browser / notifications / blink_notification_service_impl_unittest . cc <nl> class BlinkNotificationServiceImplTest : public : : testing : : Test { <nl> index 4bf25bf1fa69f7d3869369172d375e2e489e62a1 . . f80ef2cecc8b111dc54e109646573a59 <nl> mojo : : PendingReceiver < blink : : mojom : : NotificationService > receiver ) ; <nl> <nl> - + mmm a / content / browser / renderer_host / render_process_host_impl . cc <nl> ppp b / content / browser / renderer_host / render_process_host_impl . cc <nl> - void RenderProcessHostImpl : : CreateNotificationService ( <nl> + void RenderProcessHostImpl : : CreateNotificationService ( <nl> mojo : : PendingReceiver < blink : : mojom : : NotificationService > receiver ) { <nl> DCHECK_CURRENTLY_ON ( BrowserThread : : UI ) ; <nl> storage_partition_impl_ - > GetPlatformNotificationContext ( ) - > CreateService ( <nl> mmm a / patches / chromium / printing . patch <nl> ppp b / patches / chromium / printing . patch <nl> index 9fbea6d0a2dbe55b1d600fbc217dee5aa8ae8cd5 . . de9bd267e408c02fd4da7d903523c0e6 <nl> / / content : : BrowserMessageFilter : <nl> bool OnMessageReceived ( const IPC : : Message & message ) override ; <nl> - + mmm a / components / printing / common / print . mojom <nl> ppp b / components / printing / common / print . mojom <nl> interface PrintRenderer { <nl> index c4707f4680f1522689c77d3e8bbc57cb62787381 . . 2909205539b2fcfc86e610cfdff0ca41 <nl> / / Tells the RenderFrame to switch the CSS to print media type , render every <nl> / / requested page using the print preview document ' s frame / node , and then <nl> - + mmm a / components / printing / renderer / print_render_frame_helper . cc <nl> ppp b / components / printing / renderer / print_render_frame_helper . cc <nl> <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> print_preview_context_ . OnPrintPreview ( ) ; <nl> <nl> base : : UmaHistogramEnumeration ( print_preview_context_ . IsForArc ( ) <nl> - bool PrintRenderFrameHelper : : FinalizePrintReadyDocument ( ) { <nl> + bool PrintRenderFrameHelper : : FinalizePrintReadyDocument ( ) { <nl> print_preview_context_ . set_error ( PREVIEW_ERROR_METAFILE_CAPTURE_FAILED ) ; <nl> return false ; <nl> } <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> } <nl> <nl> preview_params . document_cookie = print_pages_params_ - > params . document_cookie ; <nl> - void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> + void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> <nl> auto self = weak_ptr_factory_ . GetWeakPtr ( ) ; <nl> Print ( duplicate_node . GetDocument ( ) . GetFrame ( ) , duplicate_node , <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> / / Check if | this | is still valid . <nl> if ( ! self ) <nl> return ; <nl> - void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> + void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> <nl> void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> const blink : : WebNode & node , <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> / / If still not finished with earlier print request simply ignore . <nl> if ( prep_frame_view_ ) <nl> return ; <nl> - void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> + void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> FrameReference frame_ref ( frame ) ; <nl> <nl> int expected_page_count = 0 ; <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> DidFinishPrinting ( FAIL_PRINT_INIT ) ; <nl> return ; / / Failed to init print page settings . <nl> } <nl> - void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> + void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> <nl> PrintMsg_PrintPages_Params print_settings ; <nl> auto self = weak_ptr_factory_ . GetWeakPtr ( ) ; <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> / / Check if | this | is still valid . <nl> if ( ! self ) <nl> return ; <nl> - void PrintRenderFrameHelper : : IPCProcessed ( ) { <nl> + void PrintRenderFrameHelper : : IPCProcessed ( ) { <nl> base : : ThreadTaskRunnerHandle : : Get ( ) - > DeleteSoon ( FROM_HERE , this ) ; <nl> } <nl> <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> / / Check if the printer returned any settings , if the settings is empty , we <nl> / / can safely assume there are no printer drivers configured . So we safely <nl> / / terminate . <nl> - bool PrintRenderFrameHelper : : InitPrintSettings ( bool fit_to_paper_size ) { <nl> + bool PrintRenderFrameHelper : : InitPrintSettings ( bool fit_to_paper_size ) { <nl> return result ; <nl> } <nl> <nl> index 1af8977aaa94dc9cb8b6587bff84884d5f0cd20f . . 819c9416a30aac7f10fd788c477a0c8e <nl> Send ( new PrintHostMsg_ShowInvalidPrinterSettingsError ( routing_id ( ) ) ) ; <nl> return false ; <nl> - + mmm a / components / printing / renderer / print_render_frame_helper . h <nl> ppp b / components / printing / renderer / print_render_frame_helper . h <nl> class PrintRenderFrameHelper <nl> index 0778deefa7af69bb747719ab1c05c6de6c201be5 . . 9d1872d79b4bf88a2d8db8b24eebfdc6 <nl> void PrintForSystemDialog ( ) override ; <nl> # if BUILDFLAG ( ENABLE_PRINT_PREVIEW ) <nl> void InitiatePrintPreview ( <nl> - class PrintRenderFrameHelper <nl> + class PrintRenderFrameHelper <nl> / / WARNING : | this | may be gone after this method returns . <nl> void Print ( blink : : WebLocalFrame * frame , <nl> const blink : : WebNode & node , <nl> index 0778deefa7af69bb747719ab1c05c6de6c201be5 . . 9d1872d79b4bf88a2d8db8b24eebfdc6 <nl> <nl> / / Notification when printing is done - signal tear - down / free resources . <nl> void DidFinishPrinting ( PrintingResult result ) ; <nl> - class PrintRenderFrameHelper <nl> + class PrintRenderFrameHelper <nl> <nl> / / Initialize print page settings with default settings . <nl> / / Used only for native printing workflow . <nl> mmm a / patches / chromium / resource_file_conflict . patch <nl> ppp b / patches / chromium / resource_file_conflict . patch <nl> Some alternatives to this patch : <nl> None of these options seems like a substantial maintainability win over this patch to me ( @ nornagon ) . <nl> <nl> - + mmm a / chrome / BUILD . gn <nl> ppp b / chrome / BUILD . gn <nl> if ( is_chrome_branded & & ! is_android ) { <nl> mmm a / patches / chromium / revert_remove_contentrendererclient_shouldfork . patch <nl> ppp b / patches / chromium / revert_remove_contentrendererclient_shouldfork . patch <nl> Subject : Revert " Remove ContentRendererClient : : ShouldFork . " <nl> This reverts commit 6b068eb8ca4a3c7350bdafa22fc0cf0636ef8b74 . <nl> <nl> - + mmm a / chrome / renderer / chrome_content_renderer_client . cc <nl> ppp b / chrome / renderer / chrome_content_renderer_client . cc <nl> - bool ChromeContentRendererClient : : ShouldFork ( WebLocalFrame * frame , <nl> + bool ChromeContentRendererClient : : ShouldFork ( WebLocalFrame * frame , <nl> return true ; <nl> # endif / / BUILDFLAG ( ENABLE_EXTENSIONS ) <nl> <nl> index d37bd7451b4a73fc7b00e5cc1dfcb823c7a142fb . . 0e2800f3e5b0ee1b8e88921cbf3f1825 <nl> } <nl> <nl> - + mmm a / content / renderer / render_view_browsertest . cc <nl> ppp b / content / renderer / render_view_browsertest . cc <nl> - TEST_F ( RenderViewImplTest , BeginNavigationForWebUI ) { <nl> + TEST_F ( RenderViewImplTest , BeginNavigationForWebUI ) { <nl> FrameHostMsg_OpenURL : : ID ) ) ; <nl> } <nl> <nl> mmm a / patches / chromium / support_mixed_sandbox_with_zygote . patch <nl> ppp b / patches / chromium / support_mixed_sandbox_with_zygote . patch <nl> However , the patch would need to be reviewed by the security team , as it <nl> does touch a security - sensitive class . <nl> <nl> - + mmm a / content / browser / renderer_host / render_process_host_impl . cc <nl> ppp b / content / browser / renderer_host / render_process_host_impl . cc <nl> - class RendererSandboxedProcessLauncherDelegate <nl> + class RendererSandboxedProcessLauncherDelegate <nl> { <nl> } <nl> <nl> index a9edced0ef239cbb729e7b064f755536d92f57bc . . cd0bc10cda20c0f874d9c315ee168602 <nl> ~ RendererSandboxedProcessLauncherDelegate ( ) override { } <nl> <nl> # if defined ( OS_WIN ) <nl> - class RendererSandboxedProcessLauncherDelegate <nl> + class RendererSandboxedProcessLauncherDelegate <nl> <nl> # if BUILDFLAG ( USE_ZYGOTE_HANDLE ) <nl> service_manager : : ZygoteHandle GetZygote ( ) override { <nl> index a9edced0ef239cbb729e7b064f755536d92f57bc . . cd0bc10cda20c0f874d9c315ee168602 <nl> const base : : CommandLine & browser_command_line = <nl> * base : : CommandLine : : ForCurrentProcess ( ) ; <nl> base : : CommandLine : : StringType renderer_prefix = <nl> - class RendererSandboxedProcessLauncherDelegate <nl> + class RendererSandboxedProcessLauncherDelegate <nl> return service_manager : : SandboxType : : kRenderer ; <nl> } <nl> <nl> index a9edced0ef239cbb729e7b064f755536d92f57bc . . cd0bc10cda20c0f874d9c315ee168602 <nl> } ; <nl> <nl> const char kSessionStorageHolderKey [ ] = " kSessionStorageHolderKey " ; <nl> - bool RenderProcessHostImpl : : Init ( ) { <nl> + bool RenderProcessHostImpl : : Init ( ) { <nl> cmd_line - > PrependWrapper ( renderer_prefix ) ; <nl> AppendRendererCommandLine ( cmd_line . get ( ) ) ; <nl> <nl> mmm a / patches / chromium / web_contents . patch <nl> ppp b / patches / chromium / web_contents . patch <nl> is needed for OSR . <nl> Originally landed in https : / / github . com / electron / libchromiumcontent / pull / 226 . <nl> <nl> - + mmm a / content / browser / web_contents / web_contents_impl . cc <nl> ppp b / content / browser / web_contents / web_contents_impl . cc <nl> - void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> + void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> std : : string unique_name ; <nl> frame_tree_ . root ( ) - > SetFrameName ( params . main_frame_name , unique_name ) ; <nl> <nl> index 0e16aab4db951a3d0013ef8e1297f385de732488 . . db30825068d18592fed3b7e4fb920cbd <nl> WebContentsViewDelegate * delegate = <nl> GetContentClient ( ) - > browser ( ) - > GetWebContentsViewDelegate ( this ) ; <nl> <nl> - void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> + void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> view_ . reset ( CreateWebContentsView ( this , delegate , <nl> & render_view_host_delegate_view_ ) ) ; <nl> } <nl> mmm a / patches / chromium / worker_context_will_destroy . patch <nl> ppp b / patches / chromium / worker_context_will_destroy . patch <nl> index d76e2c9e2667d630c60c7636f77800e40877e820 . . aea021b9f915c1a7e6cd394255a77d1b <nl> / / An empty URL is returned if the URL is not overriden . <nl> virtual GURL OverrideFlashEmbedWithHTML ( const GURL & url ) ; <nl> - + mmm a / content / renderer / renderer_blink_platform_impl . cc <nl> ppp b / content / renderer / renderer_blink_platform_impl . cc <nl> - void RendererBlinkPlatformImpl : : WillStopWorkerThread ( ) { <nl> + void RendererBlinkPlatformImpl : : WillStopWorkerThread ( ) { <nl> WorkerThreadRegistry : : Instance ( ) - > WillStopCurrentWorkerThread ( ) ; <nl> } <nl> <nl> mmm a / patches / v8 / add_realloc . patch <nl> ppp b / patches / v8 / add_realloc . patch <nl> when we override ReallocateBufferMemory , so we therefore need to implement <nl> Realloc on the v8 side . <nl> <nl> - + mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> class V8_EXPORT ArrayBuffer : public Object { <nl> index 748adc77aaaf26298adce580961bfabb11afa360 . . 0add559b3bdaabb73d6365b780d06aed <nl> * Free the memory block of size | length | , pointed to by | data | . <nl> * That memory is guaranteed to be previously allocated by | Allocate | . <nl> - + mmm a / src / api / api . cc <nl> ppp b / src / api / api . cc <nl> void V8 : : SetSnapshotDataBlob ( StartupData * snapshot_blob ) { <nl> mmm a / patches / v8 / build_gn . patch <nl> ppp b / patches / v8 / build_gn . patch <nl> necessary for native modules to load . <nl> Also , some fixes relating to mksnapshot on ARM . <nl> <nl> - + mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> config ( " internal_config " ) { <nl> index 417a4f655ded5073b1070ce456c6cb71ccc26070 . . 0912f5bbb762e791ed82bbc0a7688583 <nl> defines + = [ " BUILDING_V8_SHARED " ] <nl> } <nl> } <nl> - if ( current_toolchain = = v8_generator_toolchain ) { <nl> + if ( current_toolchain = = v8_generator_toolchain ) { <nl> " src / interpreter / bytecodes . h " , <nl> ] <nl> <nl> index 417a4f655ded5073b1070ce456c6cb71ccc26070 . . 0912f5bbb762e791ed82bbc0a7688583 <nl> <nl> deps = [ <nl> " : v8_libbase " , <nl> - if ( current_toolchain = = v8_snapshot_toolchain ) { <nl> + if ( current_toolchain = = v8_snapshot_toolchain ) { <nl> <nl> configs = [ " : internal_config " ] <nl> <nl> mmm a / patches / v8 / dcheck . patch <nl> ppp b / patches / v8 / dcheck . patch <nl> Subject : dcheck . patch <nl> https : / / github . com / auchenberg / volkswagen <nl> <nl> - + mmm a / src / api / api . cc <nl> ppp b / src / api / api . cc <nl> - void Isolate : : SetPromiseRejectCallback ( PromiseRejectCallback callback ) { <nl> + void Isolate : : SetPromiseRejectCallback ( PromiseRejectCallback callback ) { <nl> } <nl> <nl> void Isolate : : RunMicrotasks ( ) { <nl> index e46e98b9a17f2be8d0dc3ebc8e429ad76baeb569 . . 280ce6c084e082e5a83bf0a698dbf3f1 <nl> isolate - > default_microtask_queue ( ) - > RunMicrotasks ( isolate ) ; <nl> } <nl> - + mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> - void Heap : : TearDown ( ) { <nl> + void Heap : : TearDown ( ) { <nl> void Heap : : AddGCPrologueCallback ( v8 : : Isolate : : GCCallbackWithData callback , <nl> GCType gc_type , void * data ) { <nl> DCHECK_NOT_NULL ( callback ) ; <nl> mmm a / patches / v8 / do_not_export_private_v8_symbols_on_windows . patch <nl> ppp b / patches / v8 / do_not_export_private_v8_symbols_on_windows . patch <nl> This patch can be safely removed if , when it is removed , ` node . lib ` does not <nl> contain any standard C + + library exports ( e . g . ` std : : ostringstream ` ) . <nl> <nl> - + mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> config ( " internal_config " ) { <nl> mmm a / patches / v8 / expose_mksnapshot . patch <nl> ppp b / patches / v8 / expose_mksnapshot . patch <nl> Subject : expose_mksnapshot . patch <nl> Needed in order to target mksnapshot for mksnapshot zip . <nl> <nl> - + mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> - if ( current_toolchain = = v8_generator_toolchain ) { <nl> + if ( current_toolchain = = v8_generator_toolchain ) { <nl> <nl> if ( current_toolchain = = v8_snapshot_toolchain ) { <nl> v8_executable ( " mksnapshot " ) { <nl> mmm a / shell / browser / atom_download_manager_delegate . cc <nl> ppp b / shell / browser / atom_download_manager_delegate . cc <nl> void AtomDownloadManagerDelegate : : OnDownloadPathGenerated ( <nl> } else { <nl> std : : move ( callback ) . Run ( path , <nl> download : : DownloadItem : : TARGET_DISPOSITION_PROMPT , <nl> - download : : DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS , path , <nl> + download : : DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS , <nl> + item - > GetMixedContentStatus ( ) , path , <nl> download : : DOWNLOAD_INTERRUPT_REASON_NONE ) ; <nl> } <nl> } <nl> void AtomDownloadManagerDelegate : : OnDownloadSaveDialogDone ( <nl> : download : : DOWNLOAD_INTERRUPT_REASON_NONE ; <nl> std : : move ( download_callback ) <nl> . Run ( path , download : : DownloadItem : : TARGET_DISPOSITION_PROMPT , <nl> - download : : DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS , path , <nl> - interrupt_reason ) ; <nl> + download : : DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS , <nl> + item - > GetMixedContentStatus ( ) , path , interrupt_reason ) ; <nl> } <nl> <nl> void AtomDownloadManagerDelegate : : Shutdown ( ) { <nl> bool AtomDownloadManagerDelegate : : DetermineDownloadTarget ( <nl> download - > GetForcedFilePath ( ) , <nl> download : : DownloadItem : : TARGET_DISPOSITION_OVERWRITE , <nl> download : : DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS , <nl> + download : : DownloadItem : : MixedContentStatus : : UNKNOWN , <nl> download - > GetForcedFilePath ( ) , <nl> download : : DOWNLOAD_INTERRUPT_REASON_NONE ) ; <nl> return true ; <nl> bool AtomDownloadManagerDelegate : : DetermineDownloadTarget ( <nl> if ( ! save_path . empty ( ) ) { <nl> std : : move ( * callback ) . Run ( <nl> save_path , download : : DownloadItem : : TARGET_DISPOSITION_OVERWRITE , <nl> - download : : DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS , save_path , <nl> + download : : DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS , <nl> + download : : DownloadItem : : MixedContentStatus : : UNKNOWN , save_path , <nl> download : : DOWNLOAD_INTERRUPT_REASON_NONE ) ; <nl> return true ; <nl> } <nl>
|
chore : bump chromium to b243c83a66a7fded00f3408107778 ( master ) ( )
|
electron/electron
|
dc97fe06408c1e00c795c725583b2100130018fa
|
2020-01-21T17:39:37Z
|
mmm a / drivers / gles3 / shaders / blend_shape . glsl <nl> ppp b / drivers / gles3 / shaders / blend_shape . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> / * <nl> from VisualServer : <nl> <nl> ARRAY_INDEX = 8 , <nl> <nl> / * INPUT ATTRIBS * / <nl> <nl> - layout ( location = 0 ) in highp VFORMAT vertex_attrib ; <nl> - layout ( location = 1 ) in vec3 normal_attrib ; <nl> + layout ( location = 0 ) in highp VFORMAT vertex_attrib ; <nl> + layout ( location = 1 ) in vec3 normal_attrib ; <nl> <nl> # ifdef ENABLE_TANGENT <nl> - layout ( location = 2 ) in vec4 tangent_attrib ; <nl> + layout ( location = 2 ) in vec4 tangent_attrib ; <nl> # endif <nl> <nl> # ifdef ENABLE_COLOR <nl> - layout ( location = 3 ) in vec4 color_attrib ; <nl> + layout ( location = 3 ) in vec4 color_attrib ; <nl> # endif <nl> <nl> # ifdef ENABLE_UV <nl> - layout ( location = 4 ) in vec2 uv_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_attrib ; <nl> # endif <nl> <nl> # ifdef ENABLE_UV2 <nl> - layout ( location = 5 ) in vec2 uv2_attrib ; <nl> + layout ( location = 5 ) in vec2 uv2_attrib ; <nl> # endif <nl> <nl> # ifdef ENABLE_SKELETON <nl> - layout ( location = 6 ) in ivec4 bone_attrib ; <nl> - layout ( location = 7 ) in vec4 weight_attrib ; <nl> + layout ( location = 6 ) in ivec4 bone_attrib ; <nl> + layout ( location = 7 ) in vec4 weight_attrib ; <nl> # endif <nl> <nl> / * BLEND ATTRIBS * / <nl> <nl> # ifdef ENABLE_BLEND <nl> <nl> - layout ( location = 8 ) in highp VFORMAT vertex_attrib_blend ; <nl> - layout ( location = 9 ) in vec3 normal_attrib_blend ; <nl> + layout ( location = 8 ) in highp VFORMAT vertex_attrib_blend ; <nl> + layout ( location = 9 ) in vec3 normal_attrib_blend ; <nl> <nl> # ifdef ENABLE_TANGENT <nl> - layout ( location = 10 ) in vec4 tangent_attrib_blend ; <nl> + layout ( location = 10 ) in vec4 tangent_attrib_blend ; <nl> # endif <nl> <nl> # ifdef ENABLE_COLOR <nl> - layout ( location = 11 ) in vec4 color_attrib_blend ; <nl> + layout ( location = 11 ) in vec4 color_attrib_blend ; <nl> # endif <nl> <nl> # ifdef ENABLE_UV <nl> - layout ( location = 12 ) in vec2 uv_attrib_blend ; <nl> + layout ( location = 12 ) in vec2 uv_attrib_blend ; <nl> # endif <nl> <nl> # ifdef ENABLE_UV2 <nl> - layout ( location = 13 ) in vec2 uv2_attrib_blend ; <nl> + layout ( location = 13 ) in vec2 uv2_attrib_blend ; <nl> # endif <nl> <nl> # ifdef ENABLE_SKELETON <nl> - layout ( location = 14 ) in ivec4 bone_attrib_blend ; <nl> - layout ( location = 15 ) in vec4 weight_attrib_blend ; <nl> + layout ( location = 14 ) in ivec4 bone_attrib_blend ; <nl> + layout ( location = 15 ) in vec4 weight_attrib_blend ; <nl> # endif <nl> <nl> # endif <nl> uniform float blend_amount ; <nl> <nl> void main ( ) { <nl> <nl> - <nl> # ifdef ENABLE_BLEND <nl> <nl> vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount ; <nl> void main ( ) { <nl> uv2_out = uv2_attrib_blend + uv2_attrib * blend_amount ; <nl> # endif <nl> <nl> - <nl> # ifdef ENABLE_SKELETON <nl> <nl> bone_out = bone_attrib_blend ; <nl> void main ( ) { <nl> <nl> # else / / ENABLE_BLEND <nl> <nl> - <nl> vertex_out = vertex_attrib * blend_amount ; <nl> <nl> # ifdef ENABLE_NORMAL <nl> void main ( ) { <nl> uv2_out = uv2_attrib * blend_amount ; <nl> # endif <nl> <nl> - <nl> # ifdef ENABLE_SKELETON <nl> <nl> bone_out = bone_attrib ; <nl> void main ( ) { <nl> <nl> [ fragment ] <nl> <nl> - <nl> void main ( ) { <nl> <nl> } <nl> - <nl> mmm a / drivers / gles3 / shaders / canvas . glsl <nl> ppp b / drivers / gles3 / shaders / canvas . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec2 vertex ; <nl> - layout ( location = 3 ) in vec4 color_attrib ; <nl> + layout ( location = 0 ) in highp vec2 vertex ; <nl> + layout ( location = 3 ) in vec4 color_attrib ; <nl> <nl> # ifdef USE_SKELETON <nl> - layout ( location = 6 ) in uvec4 bone_indices ; / / attrib : 6 <nl> - layout ( location = 7 ) in vec4 bone_weights ; / / attrib : 7 <nl> + layout ( location = 6 ) in uvec4 bone_indices ; / / attrib : 6 <nl> + layout ( location = 7 ) in vec4 bone_weights ; / / attrib : 7 <nl> # endif <nl> <nl> # ifdef USE_TEXTURE_RECT <nl> uniform vec4 src_rect ; <nl> <nl> # ifdef USE_INSTANCING <nl> <nl> - layout ( location = 8 ) in highp vec4 instance_xform0 ; <nl> - layout ( location = 9 ) in highp vec4 instance_xform1 ; <nl> - layout ( location = 10 ) in highp vec4 instance_xform2 ; <nl> - layout ( location = 11 ) in lowp vec4 instance_color ; <nl> + layout ( location = 8 ) in highp vec4 instance_xform0 ; <nl> + layout ( location = 9 ) in highp vec4 instance_xform1 ; <nl> + layout ( location = 10 ) in highp vec4 instance_xform2 ; <nl> + layout ( location = 11 ) in lowp vec4 instance_color ; <nl> <nl> # ifdef USE_INSTANCE_CUSTOM <nl> - layout ( location = 12 ) in highp vec4 instance_custom_data ; <nl> + layout ( location = 12 ) in highp vec4 instance_custom_data ; <nl> # endif <nl> <nl> # endif <nl> <nl> - layout ( location = 4 ) in highp vec2 uv_attrib ; <nl> + layout ( location = 4 ) in highp vec2 uv_attrib ; <nl> <nl> - / / skeletn <nl> + / / skeleton <nl> # endif <nl> <nl> uniform highp vec2 color_texpixel_size ; <nl> <nl> - <nl> layout ( std140 ) uniform CanvasItemData { / / ubo : 0 <nl> <nl> highp mat4 projection_matrix ; <nl> layout ( std140 ) uniform CanvasItemData { / / ubo : 0 <nl> uniform highp mat4 modelview_matrix ; <nl> uniform highp mat4 extra_matrix ; <nl> <nl> - <nl> out highp vec2 uv_interp ; <nl> out mediump vec4 color_interp ; <nl> <nl> out mediump vec4 color_interp ; <nl> out highp vec2 pixel_size_interp ; <nl> # endif <nl> <nl> - <nl> # ifdef USE_SKELETON <nl> uniform mediump sampler2D skeleton_texture ; / / texunit : - 1 <nl> uniform highp mat4 skeleton_transform ; <nl> uniform highp mat4 skeleton_transform_inverse ; <nl> <nl> layout ( std140 ) uniform LightData { / / ubo : 1 <nl> <nl> - / / light matrices <nl> + / / light matrices <nl> highp mat4 light_matrix ; <nl> highp mat4 light_local_matrix ; <nl> highp mat4 shadow_matrix ; <nl> layout ( std140 ) uniform LightData { / / ubo : 1 <nl> highp float shadow_distance_mult ; <nl> } ; <nl> <nl> - <nl> out vec4 light_uv_interp ; <nl> out vec2 transformed_light_uv ; <nl> <nl> - <nl> out vec4 local_rot ; <nl> <nl> # ifdef USE_SHADOWS <nl> uniform int h_frames ; <nl> uniform int v_frames ; <nl> # endif <nl> <nl> - <nl> # if defined ( USE_MATERIAL ) <nl> <nl> layout ( std140 ) uniform UniformData { / / ubo : 2 <nl> MATERIAL_UNIFORMS <nl> <nl> # endif <nl> <nl> - <nl> VERTEX_SHADER_GLOBALS <nl> <nl> void main ( ) { <nl> void main ( ) { <nl> vec4 color = color_attrib ; <nl> <nl> # ifdef USE_INSTANCING <nl> - mat4 extra_matrix2 = extra_matrix * transpose ( mat4 ( instance_xform0 , instance_xform1 , instance_xform2 , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ) ; <nl> - color * = instance_color ; <nl> + mat4 extra_matrix2 = extra_matrix * transpose ( mat4 ( instance_xform0 , instance_xform1 , instance_xform2 , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ) ; <nl> + color * = instance_color ; <nl> vec4 instance_custom = instance_custom_data ; <nl> <nl> # else <nl> void main ( ) { <nl> } else { <nl> uv_interp = src_rect . xy + abs ( src_rect . zw ) * vertex ; <nl> } <nl> - highp vec4 outvec = vec4 ( dst_rect . xy + abs ( dst_rect . zw ) * mix ( vertex , vec2 ( 1 . 0 , 1 . 0 ) - vertex , lessThan ( src_rect . zw , vec2 ( 0 . 0 , 0 . 0 ) ) ) , 0 . 0 , 1 . 0 ) ; <nl> + highp vec4 outvec = vec4 ( dst_rect . xy + abs ( dst_rect . zw ) * mix ( vertex , vec2 ( 1 . 0 , 1 . 0 ) - vertex , lessThan ( src_rect . zw , vec2 ( 0 . 0 , 0 . 0 ) ) ) , 0 . 0 , 1 . 0 ) ; <nl> <nl> # else <nl> uv_interp = uv_attrib ; <nl> - highp vec4 outvec = vec4 ( vertex , 0 . 0 , 1 . 0 ) ; <nl> + highp vec4 outvec = vec4 ( vertex , 0 . 0 , 1 . 0 ) ; <nl> # endif <nl> <nl> - <nl> # ifdef USE_PARTICLES <nl> / / scale by texture size <nl> - outvec . xy / = color_texpixel_size ; <nl> + outvec . xy / = color_texpixel_size ; <nl> <nl> / / compute h and v frames and adjust UV interp for animation <nl> int total_frames = h_frames * v_frames ; <nl> - int frame = min ( int ( float ( total_frames ) * instance_custom . z ) , total_frames - 1 ) ; <nl> - float frame_w = 1 . 0 / float ( h_frames ) ; <nl> - float frame_h = 1 . 0 / float ( v_frames ) ; <nl> + int frame = min ( int ( float ( total_frames ) * instance_custom . z ) , total_frames - 1 ) ; <nl> + float frame_w = 1 . 0 / float ( h_frames ) ; <nl> + float frame_h = 1 . 0 / float ( v_frames ) ; <nl> uv_interp . x = uv_interp . x * frame_w + frame_w * float ( frame % h_frames ) ; <nl> uv_interp . y = uv_interp . y * frame_h + frame_h * float ( frame / h_frames ) ; <nl> <nl> # endif <nl> <nl> - <nl> # define extra_matrix extra_matrix2 <nl> <nl> { <nl> VERTEX_SHADER_CODE <nl> <nl> } <nl> <nl> - <nl> # ifdef USE_NINEPATCH <nl> <nl> - pixel_size_interp = abs ( dst_rect . zw ) * vertex ; <nl> + pixel_size_interp = abs ( dst_rect . zw ) * vertex ; <nl> # endif <nl> <nl> # if ! defined ( SKIP_TRANSFORM_USED ) <nl> VERTEX_SHADER_CODE <nl> <nl> # ifdef USE_PIXEL_SNAP <nl> <nl> - outvec . xy = floor ( outvec + 0 . 5 ) . xy ; <nl> + outvec . xy = floor ( outvec + 0 . 5 ) . xy ; <nl> # endif <nl> <nl> - <nl> # ifdef USE_SKELETON <nl> <nl> - if ( bone_weights ! = vec4 ( 0 . 0 ) ) { / / must be a valid bone <nl> + if ( bone_weights ! = vec4 ( 0 . 0 ) ) { / / must be a valid bone <nl> / / skeleton transform <nl> <nl> ivec4 bone_indicesi = ivec4 ( bone_indices ) ; <nl> <nl> - ivec2 tex_ofs = ivec2 ( bone_indicesi . x % 256 , ( bone_indicesi . x / 256 ) * 2 ) ; <nl> + ivec2 tex_ofs = ivec2 ( bone_indicesi . x % 256 , ( bone_indicesi . x / 256 ) * 2 ) ; <nl> <nl> - highp mat2x4 m = mat2x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) <nl> - ) * bone_weights . x ; <nl> + highp mat2x4 m ; <nl> + m = mat2x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) ) <nl> + * bone_weights . x ; <nl> <nl> - tex_ofs = ivec2 ( bone_indicesi . y % 256 , ( bone_indicesi . y / 256 ) * 2 ) ; <nl> + tex_ofs = ivec2 ( bone_indicesi . y % 256 , ( bone_indicesi . y / 256 ) * 2 ) ; <nl> <nl> - m + = mat2x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) <nl> - ) * bone_weights . y ; <nl> + m + = mat2x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) ) <nl> + * bone_weights . y ; <nl> <nl> - tex_ofs = ivec2 ( bone_indicesi . z % 256 , ( bone_indicesi . z / 256 ) * 2 ) ; <nl> + tex_ofs = ivec2 ( bone_indicesi . z % 256 , ( bone_indicesi . z / 256 ) * 2 ) ; <nl> <nl> - m + = mat2x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) <nl> - ) * bone_weights . z ; <nl> + m + = mat2x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) ) <nl> + * bone_weights . z ; <nl> <nl> + tex_ofs = ivec2 ( bone_indicesi . w % 256 , ( bone_indicesi . w / 256 ) * 2 ) ; <nl> <nl> - tex_ofs = ivec2 ( bone_indicesi . w % 256 , ( bone_indicesi . w / 256 ) * 2 ) ; <nl> + m + = mat2x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) ) <nl> + * bone_weights . w ; <nl> <nl> - m + = mat2x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) <nl> - ) * bone_weights . w ; <nl> - <nl> - mat4 bone_matrix = skeleton_transform * transpose ( mat4 ( m [ 0 ] , m [ 1 ] , vec4 ( 0 . 0 , 0 . 0 , 1 . 0 , 0 . 0 ) , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ) * skeleton_transform_inverse ; <nl> + mat4 bone_matrix = skeleton_transform * transpose ( mat4 ( m [ 0 ] , m [ 1 ] , vec4 ( 0 . 0 , 0 . 0 , 1 . 0 , 0 . 0 ) , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ) * skeleton_transform_inverse ; <nl> <nl> outvec = bone_matrix * outvec ; <nl> } <nl> VERTEX_SHADER_CODE <nl> # ifdef USE_LIGHTING <nl> <nl> light_uv_interp . xy = ( light_matrix * outvec ) . xy ; <nl> - light_uv_interp . zw = ( light_local_matrix * outvec ) . xy ; <nl> + light_uv_interp . zw = ( light_local_matrix * outvec ) . xy ; <nl> <nl> mat3 inverse_light_matrix = mat3 ( inverse ( light_matrix ) ) ; <nl> inverse_light_matrix [ 0 ] = normalize ( inverse_light_matrix [ 0 ] ) ; <nl> inverse_light_matrix [ 1 ] = normalize ( inverse_light_matrix [ 1 ] ) ; <nl> inverse_light_matrix [ 2 ] = normalize ( inverse_light_matrix [ 2 ] ) ; <nl> - transformed_light_uv = ( inverse_light_matrix * vec3 ( light_uv_interp . zw , 0 . 0 ) ) . xy ; / / for normal mapping <nl> + transformed_light_uv = ( inverse_light_matrix * vec3 ( light_uv_interp . zw , 0 . 0 ) ) . xy ; / / for normal mapping <nl> <nl> # ifdef USE_SHADOWS <nl> - pos = outvec . xy ; <nl> + pos = outvec . xy ; <nl> # endif <nl> <nl> - <nl> - local_rot . xy = normalize ( ( modelview_matrix * ( extra_matrix * vec4 ( 1 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ) ) . xy ) ; <nl> - local_rot . zw = normalize ( ( modelview_matrix * ( extra_matrix * vec4 ( 0 . 0 , 1 . 0 , 0 . 0 , 0 . 0 ) ) ) . xy ) ; <nl> + local_rot . xy = normalize ( ( modelview_matrix * ( extra_matrix * vec4 ( 1 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ) ) . xy ) ; <nl> + local_rot . zw = normalize ( ( modelview_matrix * ( extra_matrix * vec4 ( 0 . 0 , 1 . 0 , 0 . 0 , 0 . 0 ) ) ) . xy ) ; <nl> # ifdef USE_TEXTURE_RECT <nl> - local_rot . xy * = sign ( src_rect . z ) ; <nl> - local_rot . zw * = sign ( src_rect . w ) ; <nl> + local_rot . xy * = sign ( src_rect . z ) ; <nl> + local_rot . zw * = sign ( src_rect . w ) ; <nl> # endif <nl> <nl> - <nl> - <nl> # endif <nl> - <nl> } <nl> <nl> [ fragment ] <nl> <nl> - <nl> - <nl> uniform mediump sampler2D color_texture ; / / texunit : 0 <nl> uniform highp vec2 color_texpixel_size ; <nl> uniform mediump sampler2D normal_texture ; / / texunit : 1 <nl> <nl> - <nl> in highp vec2 uv_interp ; <nl> in mediump vec4 color_interp ; <nl> <nl> - <nl> # if defined ( SCREEN_TEXTURE_USED ) <nl> <nl> uniform sampler2D screen_texture ; / / texunit : - 3 <nl> layout ( std140 ) uniform CanvasItemData { <nl> highp float time ; <nl> } ; <nl> <nl> - <nl> # ifdef USE_LIGHTING <nl> <nl> layout ( std140 ) uniform LightData { <nl> uniform lowp sampler2D light_texture ; / / texunit : - 1 <nl> in vec4 light_uv_interp ; <nl> in vec2 transformed_light_uv ; <nl> <nl> - <nl> in vec4 local_rot ; <nl> <nl> - <nl> # ifdef USE_SHADOWS <nl> <nl> uniform highp sampler2D shadow_texture ; / / texunit : - 2 <nl> const bool at_light_pass = false ; <nl> <nl> uniform mediump vec4 final_modulate ; <nl> <nl> - <nl> - <nl> - <nl> - layout ( location = 0 ) out mediump vec4 frag_color ; <nl> - <nl> + layout ( location = 0 ) out mediump vec4 frag_color ; <nl> <nl> # if defined ( USE_MATERIAL ) <nl> <nl> MATERIAL_UNIFORMS <nl> FRAGMENT_SHADER_GLOBALS <nl> <nl> void light_compute ( <nl> - inout vec4 light , <nl> - inout vec2 light_vec , <nl> - inout float light_height , <nl> - inout vec4 light_color , <nl> - vec2 light_uv , <nl> - inout vec4 shadow_color , <nl> - vec3 normal , <nl> - vec2 uv , <nl> + inout vec4 light , <nl> + inout vec2 light_vec , <nl> + inout float light_height , <nl> + inout vec4 light_color , <nl> + vec2 light_uv , <nl> + inout vec4 shadow_color , <nl> + vec3 normal , <nl> + vec2 uv , <nl> # if defined ( SCREEN_UV_USED ) <nl> - vec2 screen_uv , <nl> + vec2 screen_uv , <nl> # endif <nl> - vec4 color ) { <nl> + vec4 color ) { <nl> <nl> # if defined ( USE_LIGHT_SHADER_CODE ) <nl> <nl> LIGHT_SHADER_CODE <nl> <nl> # endif <nl> - <nl> } <nl> <nl> # ifdef USE_TEXTURE_RECT <nl> in highp vec2 pixel_size_interp ; <nl> uniform int np_repeat_v ; <nl> uniform int np_repeat_h ; <nl> uniform bool np_draw_center ; <nl> - / / left top right bottom in pixel coordinates <nl> + / / left top right bottom in pixel coordinates <nl> uniform vec4 np_margins ; <nl> <nl> + float map_ninepatch_axis ( float pixel , float draw_size , float tex_pixel_size , float margin_begin , float margin_end , int np_repeat , inout int draw_center ) { <nl> <nl> - <nl> - float map_ninepatch_axis ( float pixel , float draw_size , float tex_pixel_size , float margin_begin , float margin_end , int np_repeat , inout int draw_center ) { <nl> - <nl> - <nl> - float tex_size = 1 . 0 / tex_pixel_size ; <nl> + float tex_size = 1 . 0 / tex_pixel_size ; <nl> <nl> if ( pixel < margin_begin ) { <nl> return pixel * tex_pixel_size ; <nl> - } else if ( pixel > = draw_size - margin_end ) { <nl> - return ( tex_size - ( draw_size - pixel ) ) * tex_pixel_size ; <nl> + } else if ( pixel > = draw_size - margin_end ) { <nl> + return ( tex_size - ( draw_size - pixel ) ) * tex_pixel_size ; <nl> } else { <nl> - if ( ! np_draw_center ) { <nl> + if ( ! np_draw_center ) { <nl> draw_center - - ; <nl> } <nl> <nl> - if ( np_repeat = = 0 ) { / / stretch <nl> + if ( np_repeat = = 0 ) { / / stretch <nl> / / convert to ratio <nl> float ratio = ( pixel - margin_begin ) / ( draw_size - margin_begin - margin_end ) ; <nl> / / scale to source texture <nl> return ( margin_begin + ratio * ( tex_size - margin_begin - margin_end ) ) * tex_pixel_size ; <nl> - } else if ( np_repeat = = 1 ) { / / tile <nl> + } else if ( np_repeat = = 1 ) { / / tile <nl> / / convert to ratio <nl> float ofs = mod ( ( pixel - margin_begin ) , tex_size - margin_begin - margin_end ) ; <nl> / / scale to source texture <nl> return ( margin_begin + ofs ) * tex_pixel_size ; <nl> - } else if ( np_repeat = = 2 ) { / / tile fit <nl> + } else if ( np_repeat = = 2 ) { / / tile fit <nl> / / convert to ratio <nl> float src_area = draw_size - margin_begin - margin_end ; <nl> float dst_area = tex_size - margin_begin - margin_end ; <nl> - float scale = max ( 1 . 0 , floor ( src_area / max ( dst_area , 0 . 0000001 ) + 0 . 5 ) ) ; <nl> + float scale = max ( 1 . 0 , floor ( src_area / max ( dst_area , 0 . 0000001 ) + 0 . 5 ) ) ; <nl> <nl> / / convert to ratio <nl> float ratio = ( pixel - margin_begin ) / src_area ; <nl> - ratio = mod ( ratio * scale , 1 . 0 ) ; <nl> + ratio = mod ( ratio * scale , 1 . 0 ) ; <nl> return ( margin_begin + ratio * dst_area ) * tex_pixel_size ; <nl> } <nl> } <nl> - <nl> } <nl> <nl> # endif <nl> void main ( ) { <nl> <nl> # ifdef USE_NINEPATCH <nl> <nl> - int draw_center = 2 ; <nl> + int draw_center = 2 ; <nl> uv = vec2 ( <nl> - map_ninepatch_axis ( pixel_size_interp . x , abs ( dst_rect . z ) , color_texpixel_size . x , np_margins . x , np_margins . z , np_repeat_h , draw_center ) , <nl> - map_ninepatch_axis ( pixel_size_interp . y , abs ( dst_rect . w ) , color_texpixel_size . y , np_margins . y , np_margins . w , np_repeat_v , draw_center ) <nl> - ) ; <nl> + map_ninepatch_axis ( pixel_size_interp . x , abs ( dst_rect . z ) , color_texpixel_size . x , np_margins . x , np_margins . z , np_repeat_h , draw_center ) , <nl> + map_ninepatch_axis ( pixel_size_interp . y , abs ( dst_rect . w ) , color_texpixel_size . y , np_margins . y , np_margins . w , np_repeat_v , draw_center ) ) ; <nl> <nl> - if ( draw_center = = 0 ) { <nl> - color . a = 0 . 0 ; <nl> + if ( draw_center = = 0 ) { <nl> + color . a = 0 . 0 ; <nl> } <nl> <nl> - uv = uv * src_rect . zw + src_rect . xy ; / / apply region if needed <nl> + uv = uv * src_rect . zw + src_rect . xy ; / / apply region if needed <nl> # endif <nl> <nl> if ( clip_rect_uv ) { <nl> <nl> - uv = clamp ( uv , src_rect . xy , src_rect . xy + abs ( src_rect . zw ) ) ; <nl> + uv = clamp ( uv , src_rect . xy , src_rect . xy + abs ( src_rect . zw ) ) ; <nl> } <nl> <nl> # endif <nl> <nl> # if ! defined ( COLOR_USED ) <nl> - / / default behavior , texture by color <nl> + / / default behavior , texture by color <nl> <nl> # ifdef USE_DISTANCE_FIELD <nl> - const float smoothing = 1 . 0 / 32 . 0 ; <nl> - float distance = textureLod ( color_texture , uv , 0 . 0 ) . a ; <nl> + const float smoothing = 1 . 0 / 32 . 0 ; <nl> + float distance = textureLod ( color_texture , uv , 0 . 0 ) . a ; <nl> color . a = smoothstep ( 0 . 5 - smoothing , 0 . 5 + smoothing , distance ) * color . a ; <nl> # else <nl> - color * = texture ( color_texture , uv ) ; <nl> + color * = texture ( color_texture , uv ) ; <nl> <nl> # endif <nl> <nl> # endif <nl> <nl> - <nl> - <nl> vec3 normal ; <nl> <nl> # if defined ( NORMAL_USED ) <nl> void main ( ) { <nl> # endif <nl> <nl> if ( use_default_normal ) { <nl> - normal . xy = textureLod ( normal_texture , uv , 0 . 0 ) . xy * 2 . 0 - 1 . 0 ; <nl> - normal . z = sqrt ( 1 . 0 - dot ( normal . xy , normal . xy ) ) ; <nl> - normal_used = true ; <nl> + normal . xy = textureLod ( normal_texture , uv , 0 . 0 ) . xy * 2 . 0 - 1 . 0 ; <nl> + normal . z = sqrt ( 1 . 0 - dot ( normal . xy , normal . xy ) ) ; <nl> + normal_used = true ; <nl> } else { <nl> - normal = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; <nl> + normal = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; <nl> } <nl> <nl> - <nl> - <nl> # if defined ( SCREEN_UV_USED ) <nl> - vec2 screen_uv = gl_FragCoord . xy * screen_pixel_size ; <nl> + vec2 screen_uv = gl_FragCoord . xy * screen_pixel_size ; <nl> # endif <nl> <nl> - <nl> - { <nl> - float normal_depth = 1 . 0 ; <nl> + { <nl> + float normal_depth = 1 . 0 ; <nl> <nl> # if defined ( NORMALMAP_USED ) <nl> - vec3 normal_map = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; <nl> + vec3 normal_map = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; <nl> # endif <nl> <nl> FRAGMENT_SHADER_CODE <nl> <nl> # if defined ( NORMALMAP_USED ) <nl> - normal = mix ( vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) , normal_map * vec3 ( 2 . 0 , - 2 . 0 , 1 . 0 ) - vec3 ( 1 . 0 , - 1 . 0 , 0 . 0 ) , normal_depth ) ; <nl> + normal = mix ( vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) , normal_map * vec3 ( 2 . 0 , - 2 . 0 , 1 . 0 ) - vec3 ( 1 . 0 , - 1 . 0 , 0 . 0 ) , normal_depth ) ; <nl> # endif <nl> - <nl> - } <nl> + } <nl> # ifdef DEBUG_ENCODED_32 <nl> - highp float enc32 = dot ( color , highp vec4 ( 1 . 0 / ( 256 . 0 * 256 . 0 * 256 . 0 ) , 1 . 0 / ( 256 . 0 * 256 . 0 ) , 1 . 0 / 256 . 0 , 1 ) ) ; <nl> - color = vec4 ( vec3 ( enc32 ) , 1 . 0 ) ; <nl> + highp float enc32 = dot ( color , highp vec4 ( 1 . 0 / ( 256 . 0 * 256 . 0 * 256 . 0 ) , 1 . 0 / ( 256 . 0 * 256 . 0 ) , 1 . 0 / 256 . 0 , 1 ) ) ; <nl> + color = vec4 ( vec3 ( enc32 ) , 1 . 0 ) ; <nl> # endif <nl> <nl> - <nl> - color * = final_modulate ; <nl> - <nl> - <nl> + color * = final_modulate ; <nl> <nl> # ifdef USE_LIGHTING <nl> <nl> vec2 light_vec = transformed_light_uv ; <nl> <nl> if ( normal_used ) { <nl> - normal . xy = mat2 ( local_rot . xy , local_rot . zw ) * normal . xy ; <nl> + normal . xy = mat2 ( local_rot . xy , local_rot . zw ) * normal . xy ; <nl> } <nl> <nl> - float att = 1 . 0 ; <nl> + float att = 1 . 0 ; <nl> <nl> vec2 light_uv = light_uv_interp . xy ; <nl> - vec4 light = texture ( light_texture , light_uv ) ; <nl> + vec4 light = texture ( light_texture , light_uv ) ; <nl> <nl> - if ( any ( lessThan ( light_uv_interp . xy , vec2 ( 0 . 0 , 0 . 0 ) ) ) | | any ( greaterThanEqual ( light_uv_interp . xy , vec2 ( 1 . 0 , 1 . 0 ) ) ) ) { <nl> - color . a * = light_outside_alpha ; / / invisible <nl> + if ( any ( lessThan ( light_uv_interp . xy , vec2 ( 0 . 0 , 0 . 0 ) ) ) | | any ( greaterThanEqual ( light_uv_interp . xy , vec2 ( 1 . 0 , 1 . 0 ) ) ) ) { <nl> + color . a * = light_outside_alpha ; / / invisible <nl> <nl> } else { <nl> float real_light_height = light_height ; <nl> FRAGMENT_SHADER_CODE <nl> vec4 real_light_shadow_color = light_shadow_color ; <nl> <nl> # if defined ( USE_LIGHT_SHADER_CODE ) <nl> - / / light is written by the light shader <nl> + / / light is written by the light shader <nl> light_compute ( <nl> - light , <nl> - light_vec , <nl> - real_light_height , <nl> - real_light_color , <nl> - light_uv , <nl> - real_light_shadow_color , <nl> - normal , <nl> - uv , <nl> + light , <nl> + light_vec , <nl> + real_light_height , <nl> + real_light_color , <nl> + light_uv , <nl> + real_light_shadow_color , <nl> + normal , <nl> + uv , <nl> # if defined ( SCREEN_UV_USED ) <nl> - screen_uv , <nl> + screen_uv , <nl> # endif <nl> - color ) ; <nl> + color ) ; <nl> # endif <nl> <nl> light * = real_light_color ; <nl> <nl> if ( normal_used ) { <nl> - vec3 light_normal = normalize ( vec3 ( light_vec , - real_light_height ) ) ; <nl> - light * = max ( dot ( - light_normal , normal ) , 0 . 0 ) ; <nl> + vec3 light_normal = normalize ( vec3 ( light_vec , - real_light_height ) ) ; <nl> + light * = max ( dot ( - light_normal , normal ) , 0 . 0 ) ; <nl> } <nl> <nl> - color * = light ; <nl> + color * = light ; <nl> <nl> # ifdef USE_SHADOWS <nl> light_vec = light_uv_interp . zw ; / / for shadows <nl> - float angle_to_light = - atan ( light_vec . x , light_vec . y ) ; <nl> + float angle_to_light = - atan ( light_vec . x , light_vec . y ) ; <nl> float PI = 3 . 14159265358979323846264 ; <nl> / * int i = int ( mod ( floor ( ( angle_to_light + 7 . 0 * PI / 6 . 0 ) / ( 4 . 0 * PI / 6 . 0 ) ) + 1 . 0 , 3 . 0 ) ) ; / / + 1 pq os indices estao em ordem 2 , 0 , 1 nos arrays <nl> float ang * / <nl> <nl> - float su , sz ; <nl> + float su , sz ; <nl> <nl> float abs_angle = abs ( angle_to_light ) ; <nl> vec2 point ; <nl> float sh ; <nl> - if ( abs_angle < 45 . 0 * PI / 180 . 0 ) { <nl> + if ( abs_angle < 45 . 0 * PI / 180 . 0 ) { <nl> point = light_vec ; <nl> - sh = 0 . 0 + ( 1 . 0 / 8 . 0 ) ; <nl> - } else if ( abs_angle > 135 . 0 * PI / 180 . 0 ) { <nl> + sh = 0 . 0 + ( 1 . 0 / 8 . 0 ) ; <nl> + } else if ( abs_angle > 135 . 0 * PI / 180 . 0 ) { <nl> point = - light_vec ; <nl> - sh = 0 . 5 + ( 1 . 0 / 8 . 0 ) ; <nl> - } else if ( angle_to_light > 0 . 0 ) { <nl> + sh = 0 . 5 + ( 1 . 0 / 8 . 0 ) ; <nl> + } else if ( angle_to_light > 0 . 0 ) { <nl> <nl> - point = vec2 ( light_vec . y , - light_vec . x ) ; <nl> - sh = 0 . 25 + ( 1 . 0 / 8 . 0 ) ; <nl> + point = vec2 ( light_vec . y , - light_vec . x ) ; <nl> + sh = 0 . 25 + ( 1 . 0 / 8 . 0 ) ; <nl> } else { <nl> <nl> - point = vec2 ( - light_vec . y , light_vec . x ) ; <nl> - sh = 0 . 75 + ( 1 . 0 / 8 . 0 ) ; <nl> - <nl> + point = vec2 ( - light_vec . y , light_vec . x ) ; <nl> + sh = 0 . 75 + ( 1 . 0 / 8 . 0 ) ; <nl> } <nl> <nl> - <nl> - highp vec4 s = shadow_matrix * vec4 ( point , 0 . 0 , 1 . 0 ) ; <nl> - s . xyz / = s . w ; <nl> - su = s . x * 0 . 5 + 0 . 5 ; <nl> - sz = s . z * 0 . 5 + 0 . 5 ; <nl> + highp vec4 s = shadow_matrix * vec4 ( point , 0 . 0 , 1 . 0 ) ; <nl> + s . xyz / = s . w ; <nl> + su = s . x * 0 . 5 + 0 . 5 ; <nl> + sz = s . z * 0 . 5 + 0 . 5 ; <nl> / / sz = lightlength ( light_vec ) ; <nl> <nl> - highp float shadow_attenuation = 0 . 0 ; <nl> + highp float shadow_attenuation = 0 . 0 ; <nl> <nl> # ifdef USE_RGBA_SHADOWS <nl> <nl> - # define SHADOW_DEPTH ( m_tex , m_uv ) dot ( texture ( ( m_tex ) , ( m_uv ) ) , vec4 ( 1 . 0 / ( 256 . 0 * 256 . 0 * 256 . 0 ) , 1 . 0 / ( 256 . 0 * 256 . 0 ) , 1 . 0 / 256 . 0 , 1 ) ) <nl> + # define SHADOW_DEPTH ( m_tex , m_uv ) dot ( texture ( ( m_tex ) , ( m_uv ) ) , vec4 ( 1 . 0 / ( 256 . 0 * 256 . 0 * 256 . 0 ) , 1 . 0 / ( 256 . 0 * 256 . 0 ) , 1 . 0 / 256 . 0 , 1 ) ) <nl> <nl> # else <nl> <nl> - # define SHADOW_DEPTH ( m_tex , m_uv ) ( texture ( ( m_tex ) , ( m_uv ) ) . r ) <nl> + # define SHADOW_DEPTH ( m_tex , m_uv ) ( texture ( ( m_tex ) , ( m_uv ) ) . r ) <nl> <nl> # endif <nl> <nl> - <nl> - <nl> # ifdef SHADOW_USE_GRADIENT <nl> <nl> - # define SHADOW_TEST ( m_ofs ) { highp float sd = SHADOW_DEPTH ( shadow_texture , vec2 ( m_ofs , sh ) ) ; shadow_attenuation + = 1 . 0 - smoothstep ( sd , sd + shadow_gradient , sz ) ; } <nl> + # define SHADOW_TEST ( m_ofs ) \ <nl> + { \ <nl> + highp float sd = SHADOW_DEPTH ( shadow_texture , vec2 ( m_ofs , sh ) ) ; \ <nl> + shadow_attenuation + = 1 . 0 - smoothstep ( sd , sd + shadow_gradient , sz ) ; \ <nl> + } <nl> <nl> # else <nl> <nl> - # define SHADOW_TEST ( m_ofs ) { highp float sd = SHADOW_DEPTH ( shadow_texture , vec2 ( m_ofs , sh ) ) ; shadow_attenuation + = step ( sz , sd ) ; } <nl> + # define SHADOW_TEST ( m_ofs ) \ <nl> + { \ <nl> + highp float sd = SHADOW_DEPTH ( shadow_texture , vec2 ( m_ofs , sh ) ) ; \ <nl> + shadow_attenuation + = step ( sz , sd ) ; \ <nl> + } <nl> <nl> # endif <nl> <nl> - <nl> # ifdef SHADOW_FILTER_NEAREST <nl> <nl> SHADOW_TEST ( su ) ; <nl> <nl> # endif <nl> <nl> - <nl> # ifdef SHADOW_FILTER_PCF3 <nl> <nl> - SHADOW_TEST ( su + shadowpixel_size ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size ) ; <nl> SHADOW_TEST ( su ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size ) ; <nl> - shadow_attenuation / = 3 . 0 ; <nl> + SHADOW_TEST ( su - shadowpixel_size ) ; <nl> + shadow_attenuation / = 3 . 0 ; <nl> <nl> # endif <nl> <nl> - <nl> # ifdef SHADOW_FILTER_PCF5 <nl> <nl> - SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size ) ; <nl> SHADOW_TEST ( su ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> - shadow_attenuation / = 5 . 0 ; <nl> + SHADOW_TEST ( su - shadowpixel_size ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> + shadow_attenuation / = 5 . 0 ; <nl> <nl> # endif <nl> <nl> - <nl> # ifdef SHADOW_FILTER_PCF7 <nl> <nl> - SHADOW_TEST ( su + shadowpixel_size * 3 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 3 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size ) ; <nl> SHADOW_TEST ( su ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 3 . 0 ) ; <nl> - shadow_attenuation / = 7 . 0 ; <nl> + SHADOW_TEST ( su - shadowpixel_size ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 3 . 0 ) ; <nl> + shadow_attenuation / = 7 . 0 ; <nl> <nl> # endif <nl> <nl> - <nl> # ifdef SHADOW_FILTER_PCF9 <nl> <nl> - SHADOW_TEST ( su + shadowpixel_size * 4 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size * 3 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 4 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 3 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size ) ; <nl> SHADOW_TEST ( su ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 3 . 0 ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 4 . 0 ) ; <nl> - shadow_attenuation / = 9 . 0 ; <nl> + SHADOW_TEST ( su - shadowpixel_size ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 3 . 0 ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 4 . 0 ) ; <nl> + shadow_attenuation / = 9 . 0 ; <nl> <nl> # endif <nl> <nl> # ifdef SHADOW_FILTER_PCF13 <nl> <nl> - SHADOW_TEST ( su + shadowpixel_size * 6 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size * 5 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size * 4 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size * 3 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> - SHADOW_TEST ( su + shadowpixel_size ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 6 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 5 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 4 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 3 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size * 2 . 0 ) ; <nl> + SHADOW_TEST ( su + shadowpixel_size ) ; <nl> SHADOW_TEST ( su ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 3 . 0 ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 4 . 0 ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 5 . 0 ) ; <nl> - SHADOW_TEST ( su - shadowpixel_size * 6 . 0 ) ; <nl> - shadow_attenuation / = 13 . 0 ; <nl> + SHADOW_TEST ( su - shadowpixel_size ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 2 . 0 ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 3 . 0 ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 4 . 0 ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 5 . 0 ) ; <nl> + SHADOW_TEST ( su - shadowpixel_size * 6 . 0 ) ; <nl> + shadow_attenuation / = 13 . 0 ; <nl> <nl> # endif <nl> <nl> - / / color * = shadow_attenuation ; <nl> - color = mix ( real_light_shadow_color , color , shadow_attenuation ) ; <nl> + / / color * = shadow_attenuation ; <nl> + color = mix ( real_light_shadow_color , color , shadow_attenuation ) ; <nl> / / use shadows <nl> # endif <nl> } <nl> <nl> / / use lighting <nl> # endif <nl> - / / color . rgb * = color . a ; <nl> + / / color . rgb * = color . a ; <nl> frag_color = color ; <nl> - <nl> } <nl> mmm a / drivers / gles3 / shaders / canvas_shadow . glsl <nl> ppp b / drivers / gles3 / shaders / canvas_shadow . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - <nl> uniform highp mat4 projection_matrix ; <nl> uniform highp mat4 light_matrix ; <nl> uniform highp mat4 world_matrix ; <nl> uniform highp float distance_norm ; <nl> <nl> - layout ( location = 0 ) in highp vec3 vertex ; <nl> + layout ( location = 0 ) in highp vec3 vertex ; <nl> <nl> out highp vec4 position_interp ; <nl> <nl> void main ( ) { <nl> <nl> - gl_Position = projection_matrix * ( light_matrix * ( world_matrix * vec4 ( vertex , 1 . 0 ) ) ) ; <nl> - position_interp = gl_Position ; <nl> + gl_Position = projection_matrix * ( light_matrix * ( world_matrix * vec4 ( vertex , 1 . 0 ) ) ) ; <nl> + position_interp = gl_Position ; <nl> } <nl> <nl> [ fragment ] <nl> void main ( ) { <nl> in highp vec4 position_interp ; <nl> <nl> # ifdef USE_RGBA_SHADOWS <nl> - <nl> - layout ( location = 0 ) out lowp vec4 distance_buf ; <nl> - <nl> + layout ( location = 0 ) out lowp vec4 distance_buf ; <nl> # else <nl> - <nl> - layout ( location = 0 ) out highp float distance_buf ; <nl> - <nl> + layout ( location = 0 ) out highp float distance_buf ; <nl> # endif <nl> <nl> void main ( ) { <nl> <nl> - highp float depth = ( ( position_interp . z / position_interp . w ) + 1 . 0 ) * 0 . 5 + 0 . 0 ; / / bias ; <nl> + highp float depth = ( ( position_interp . z / position_interp . w ) + 1 . 0 ) * 0 . 5 + 0 . 0 ; / / bias <nl> <nl> # ifdef USE_RGBA_SHADOWS <nl> <nl> highp vec4 comp = fract ( depth * vec4 ( 256 . 0 * 256 . 0 * 256 . 0 , 256 . 0 * 256 . 0 , 256 . 0 , 1 . 0 ) ) ; <nl> comp - = comp . xxyz * vec4 ( 0 , 1 . 0 / 256 . 0 , 1 . 0 / 256 . 0 , 1 . 0 / 256 . 0 ) ; <nl> - distance_buf = comp ; <nl> + distance_buf = comp ; <nl> # else <nl> <nl> - distance_buf = depth ; <nl> - <nl> + distance_buf = depth ; <nl> # endif <nl> } <nl> - <nl> mmm a / drivers / gles3 / shaders / copy . glsl <nl> ppp b / drivers / gles3 / shaders / copy . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> # if defined ( USE_CUBEMAP ) | | defined ( USE_PANORAMA ) <nl> - layout ( location = 4 ) in vec3 cube_in ; <nl> + layout ( location = 4 ) in vec3 cube_in ; <nl> # else <nl> - layout ( location = 4 ) in vec2 uv_in ; <nl> + layout ( location = 4 ) in vec2 uv_in ; <nl> # endif <nl> - layout ( location = 5 ) in vec2 uv2_in ; <nl> + layout ( location = 5 ) in vec2 uv2_in ; <nl> <nl> # if defined ( USE_CUBEMAP ) | | defined ( USE_PANORAMA ) <nl> out vec3 cube_interp ; <nl> void main ( ) { <nl> # else <nl> uv_interp = uv_in ; <nl> # ifdef V_FLIP <nl> - uv_interp . y = 1 . 0 - uv_interp . y ; <nl> + uv_interp . y = 1 . 0 - uv_interp . y ; <nl> # endif <nl> <nl> # endif <nl> void main ( ) { <nl> uv_interp = copy_section . xy + uv_interp * copy_section . zw ; <nl> gl_Position . xy = ( copy_section . xy + ( gl_Position . xy * 0 . 5 + 0 . 5 ) * copy_section . zw ) * 2 . 0 - 1 . 0 ; <nl> # endif <nl> - <nl> } <nl> <nl> [ fragment ] <nl> uniform samplerCube source_cube ; / / texunit : 0 <nl> uniform sampler2D source ; / / texunit : 0 <nl> # endif <nl> <nl> - <nl> # ifdef USE_MULTIPLIER <nl> uniform float multiplier ; <nl> # endif <nl> <nl> # if defined ( USE_PANORAMA ) | | defined ( USE_ASYM_PANO ) <nl> <nl> - vec4 texturePanorama ( vec3 normal , sampler2D pano ) { <nl> + vec4 texturePanorama ( vec3 normal , sampler2D pano ) { <nl> <nl> vec2 st = vec2 ( <nl> - atan ( normal . x , normal . z ) , <nl> - acos ( normal . y ) <nl> - ) ; <nl> - <nl> - if ( st . x < 0 . 0 ) <nl> - st . x + = M_PI * 2 . 0 ; <nl> + atan ( normal . x , normal . z ) , <nl> + acos ( normal . y ) ) ; <nl> <nl> - st / = vec2 ( M_PI * 2 . 0 , M_PI ) ; <nl> + if ( st . x < 0 . 0 ) <nl> + st . x + = M_PI * 2 . 0 ; <nl> <nl> - return textureLod ( pano , st , 0 . 0 ) ; <nl> + st / = vec2 ( M_PI * 2 . 0 , M_PI ) ; <nl> <nl> + return textureLod ( pano , st , 0 . 0 ) ; <nl> } <nl> <nl> # endif <nl> <nl> - <nl> uniform float stuff ; <nl> uniform vec2 pixel_size ; <nl> <nl> in vec2 uv2_interp ; <nl> <nl> - <nl> # ifdef USE_BCS <nl> <nl> uniform vec3 bcs ; <nl> uniform sampler2D color_correction ; / / texunit : 1 <nl> <nl> layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> - <nl> - <nl> - <nl> void main ( ) { <nl> <nl> / / vec4 color = color_interp ; <nl> <nl> # ifdef USE_PANORAMA <nl> <nl> - vec4 color = texturePanorama ( normalize ( cube_interp ) , source ) ; <nl> + vec4 color = texturePanorama ( normalize ( cube_interp ) , source ) ; <nl> <nl> # elif defined ( USE_ASYM_PANO ) <nl> <nl> - / / When an asymmetrical projection matrix is used ( applicable for stereoscopic rendering i . e . VR ) we need to do this calculation per fragment to get a perspective correct result . <nl> + / / When an asymmetrical projection matrix is used ( applicable for stereoscopic rendering i . e . VR ) we need to do this calculation per fragment to get a perspective correct result . <nl> / / Note that we ' re ignoring the x - offset for IPD , with Z sufficiently in the distance it becomes neglectible , as a result we could probably just set cube_normal . z to - 1 . <nl> / / The Matrix [ 2 ] [ 0 ] ( = asym_proj . x ) and Matrix [ 2 ] [ 1 ] ( = asym_proj . z ) values are what provide the right shift in the image . <nl> <nl> void main ( ) { <nl> cube_normal = mat3 ( pano_transform ) * cube_normal ; <nl> cube_normal . z = - cube_normal . z ; <nl> <nl> - vec4 color = texturePanorama ( normalize ( cube_normal . xyz ) , source ) ; <nl> + vec4 color = texturePanorama ( normalize ( cube_normal . xyz ) , source ) ; <nl> <nl> # elif defined ( USE_CUBEMAP ) <nl> - vec4 color = texture ( source_cube , normalize ( cube_interp ) ) ; <nl> + vec4 color = texture ( source_cube , normalize ( cube_interp ) ) ; <nl> <nl> # else <nl> - vec4 color = textureLod ( source , uv_interp , 0 . 0 ) ; <nl> + vec4 color = textureLod ( source , uv_interp , 0 . 0 ) ; <nl> # endif <nl> <nl> - <nl> - <nl> # ifdef LINEAR_TO_SRGB <nl> / / regular Linear - > SRGB conversion <nl> vec3 a = vec3 ( 0 . 055 ) ; <nl> - color . rgb = mix ( ( vec3 ( 1 . 0 ) + a ) * pow ( color . rgb , vec3 ( 1 . 0 / 2 . 4 ) ) - a , 12 . 92 * color . rgb , lessThan ( color . rgb , vec3 ( 0 . 0031308 ) ) ) ; <nl> + color . rgb = mix ( ( vec3 ( 1 . 0 ) + a ) * pow ( color . rgb , vec3 ( 1 . 0 / 2 . 4 ) ) - a , 12 . 92 * color . rgb , lessThan ( color . rgb , vec3 ( 0 . 0031308 ) ) ) ; <nl> # endif <nl> <nl> # ifdef SRGB_TO_LINEAR <nl> <nl> - color . rgb = mix ( pow ( ( color . rgb + vec3 ( 0 . 055 ) ) * ( 1 . 0 / ( 1 . 0 + 0 . 055 ) ) , vec3 ( 2 . 4 ) ) , color . rgb * ( 1 . 0 / 12 . 92 ) , lessThan ( color . rgb , vec3 ( 0 . 04045 ) ) ) ; <nl> + color . rgb = mix ( pow ( ( color . rgb + vec3 ( 0 . 055 ) ) * ( 1 . 0 / ( 1 . 0 + 0 . 055 ) ) , vec3 ( 2 . 4 ) ) , color . rgb * ( 1 . 0 / 12 . 92 ) , lessThan ( color . rgb , vec3 ( 0 . 04045 ) ) ) ; <nl> # endif <nl> <nl> # ifdef DEBUG_GRADIENT <nl> - color . rg = uv_interp ; <nl> - color . b = 0 . 0 ; <nl> + color . rg = uv_interp ; <nl> + color . b = 0 . 0 ; <nl> # endif <nl> <nl> # ifdef DISABLE_ALPHA <nl> - color . a = 1 . 0 ; <nl> + color . a = 1 . 0 ; <nl> # endif <nl> <nl> - <nl> # ifdef GAUSSIAN_HORIZONTAL <nl> - color * = 0 . 38774 ; <nl> - color + = texture ( source , uv_interp + vec2 ( 1 . 0 , 0 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> - color + = texture ( source , uv_interp + vec2 ( 2 . 0 , 0 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> - color + = texture ( source , uv_interp + vec2 ( - 1 . 0 , 0 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> - color + = texture ( source , uv_interp + vec2 ( - 2 . 0 , 0 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> + color * = 0 . 38774 ; <nl> + color + = texture ( source , uv_interp + vec2 ( 1 . 0 , 0 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> + color + = texture ( source , uv_interp + vec2 ( 2 . 0 , 0 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> + color + = texture ( source , uv_interp + vec2 ( - 1 . 0 , 0 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> + color + = texture ( source , uv_interp + vec2 ( - 2 . 0 , 0 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> # endif <nl> <nl> # ifdef GAUSSIAN_VERTICAL <nl> - color * = 0 . 38774 ; <nl> - color + = texture ( source , uv_interp + vec2 ( 0 . 0 , 1 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> - color + = texture ( source , uv_interp + vec2 ( 0 . 0 , 2 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> - color + = texture ( source , uv_interp + vec2 ( 0 . 0 , - 1 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> - color + = texture ( source , uv_interp + vec2 ( 0 . 0 , - 2 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> + color * = 0 . 38774 ; <nl> + color + = texture ( source , uv_interp + vec2 ( 0 . 0 , 1 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> + color + = texture ( source , uv_interp + vec2 ( 0 . 0 , 2 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> + color + = texture ( source , uv_interp + vec2 ( 0 . 0 , - 1 . 0 ) * pixel_size ) * 0 . 24477 ; <nl> + color + = texture ( source , uv_interp + vec2 ( 0 . 0 , - 2 . 0 ) * pixel_size ) * 0 . 06136 ; <nl> # endif <nl> <nl> # ifdef USE_BCS <nl> <nl> - color . rgb = mix ( vec3 ( 0 . 0 ) , color . rgb , bcs . x ) ; <nl> - color . rgb = mix ( vec3 ( 0 . 5 ) , color . rgb , bcs . y ) ; <nl> - color . rgb = mix ( vec3 ( dot ( vec3 ( 1 . 0 ) , color . rgb ) * 0 . 33333 ) , color . rgb , bcs . z ) ; <nl> + color . rgb = mix ( vec3 ( 0 . 0 ) , color . rgb , bcs . x ) ; <nl> + color . rgb = mix ( vec3 ( 0 . 5 ) , color . rgb , bcs . y ) ; <nl> + color . rgb = mix ( vec3 ( dot ( vec3 ( 1 . 0 ) , color . rgb ) * 0 . 33333 ) , color . rgb , bcs . z ) ; <nl> <nl> # endif <nl> <nl> # ifdef USE_COLOR_CORRECTION <nl> <nl> - color . r = texture ( color_correction , vec2 ( color . r , 0 . 0 ) ) . r ; <nl> - color . g = texture ( color_correction , vec2 ( color . g , 0 . 0 ) ) . g ; <nl> - color . b = texture ( color_correction , vec2 ( color . b , 0 . 0 ) ) . b ; <nl> + color . r = texture ( color_correction , vec2 ( color . r , 0 . 0 ) ) . r ; <nl> + color . g = texture ( color_correction , vec2 ( color . g , 0 . 0 ) ) . g ; <nl> + color . b = texture ( color_correction , vec2 ( color . b , 0 . 0 ) ) . b ; <nl> # endif <nl> <nl> # ifdef USE_MULTIPLIER <nl> - color . rgb * = multiplier ; <nl> + color . rgb * = multiplier ; <nl> # endif <nl> frag_color = color ; <nl> } <nl> - <nl> mmm a / drivers / gles3 / shaders / cube_to_dp . glsl <nl> ppp b / drivers / gles3 / shaders / cube_to_dp . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - layout ( location = 4 ) in vec2 uv_in ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_in ; <nl> <nl> out vec2 uv_interp ; <nl> <nl> void main ( ) { <nl> <nl> [ fragment ] <nl> <nl> - <nl> uniform highp samplerCube source_cube ; / / texunit : 0 <nl> in vec2 uv_interp ; <nl> <nl> uniform highp float bias ; <nl> <nl> void main ( ) { <nl> <nl> - highp vec3 normal = vec3 ( uv_interp * 2 . 0 - 1 . 0 , 0 . 0 ) ; <nl> - / * <nl> - if ( z_flip ) { <nl> - normal . z = 0 . 5 - 0 . 5 * ( ( normal . x * normal . x ) + ( normal . y * normal . y ) ) ; <nl> + highp vec3 normal = vec3 ( uv_interp * 2 . 0 - 1 . 0 , 0 . 0 ) ; <nl> + / * <nl> + if ( z_flip ) { <nl> + normal . z = 0 . 5 - 0 . 5 * ( ( normal . x * normal . x ) + ( normal . y * normal . y ) ) ; <nl> } else { <nl> - normal . z = - 0 . 5 + 0 . 5 * ( ( normal . x * normal . x ) + ( normal . y * normal . y ) ) ; <nl> + normal . z = - 0 . 5 + 0 . 5 * ( ( normal . x * normal . x ) + ( normal . y * normal . y ) ) ; <nl> } <nl> - * / <nl> + * / <nl> <nl> - / / normal . z = sqrt ( 1 . 0 - dot ( normal . xy , normal . xy ) ) ; <nl> - / / normal . xy * = 1 . 0 + normal . z ; <nl> + / / normal . z = sqrt ( 1 . 0 - dot ( normal . xy , normal . xy ) ) ; <nl> + / / normal . xy * = 1 . 0 + normal . z ; <nl> <nl> - normal . z = 0 . 5 - 0 . 5 * ( ( normal . x * normal . x ) + ( normal . y * normal . y ) ) ; <nl> + normal . z = 0 . 5 - 0 . 5 * ( ( normal . x * normal . x ) + ( normal . y * normal . y ) ) ; <nl> + normal = normalize ( normal ) ; <nl> + / * <nl> + normal . z = 0 . 5 ; <nl> normal = normalize ( normal ) ; <nl> + * / <nl> <nl> - / * <nl> - normal . z = 0 . 5 ; <nl> - normal = normalize ( normal ) ; <nl> - * / <nl> if ( ! z_flip ) { <nl> - normal . z = - normal . z ; <nl> + normal . z = - normal . z ; <nl> } <nl> <nl> - / / normal = normalize ( vec3 ( uv_interp * 2 . 0 - 1 . 0 , 1 . 0 ) ) ; <nl> - float depth = texture ( source_cube , normal ) . r ; <nl> + / / normal = normalize ( vec3 ( uv_interp * 2 . 0 - 1 . 0 , 1 . 0 ) ) ; <nl> + float depth = texture ( source_cube , normal ) . r ; <nl> <nl> / / absolute values for direction cosines , bigger value equals closer to basis axis <nl> vec3 unorm = abs ( normal ) ; <nl> <nl> - if ( ( unorm . x > = unorm . y ) & & ( unorm . x > = unorm . z ) ) { <nl> - / / x code <nl> - unorm = normal . x > 0 . 0 ? vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) : vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; <nl> - } else if ( ( unorm . y > unorm . x ) & & ( unorm . y > = unorm . z ) ) { <nl> - / / y code <nl> - unorm = normal . y > 0 . 0 ? vec3 ( 0 . 0 , 1 . 0 , 0 . 0 ) : vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; <nl> - } else if ( ( unorm . z > unorm . x ) & & ( unorm . z > unorm . y ) ) { <nl> - / / z code <nl> - unorm = normal . z > 0 . 0 ? vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) : vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; <nl> + if ( ( unorm . x > = unorm . y ) & & ( unorm . x > = unorm . z ) ) { <nl> + / / x code <nl> + unorm = normal . x > 0 . 0 ? vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) : vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + } else if ( ( unorm . y > unorm . x ) & & ( unorm . y > = unorm . z ) ) { <nl> + / / y code <nl> + unorm = normal . y > 0 . 0 ? vec3 ( 0 . 0 , 1 . 0 , 0 . 0 ) : vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; <nl> + } else if ( ( unorm . z > unorm . x ) & & ( unorm . z > unorm . y ) ) { <nl> + / / z code <nl> + unorm = normal . z > 0 . 0 ? vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) : vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; <nl> } else { <nl> - / / oh - no we messed up code <nl> - / / has to be <nl> - unorm = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + / / oh - no we messed up code <nl> + / / has to be <nl> + unorm = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; <nl> } <nl> <nl> - float depth_fix = 1 . 0 / dot ( normal , unorm ) ; <nl> - <nl> + float depth_fix = 1 . 0 / dot ( normal , unorm ) ; <nl> <nl> depth = 2 . 0 * depth - 1 . 0 ; <nl> float linear_depth = 2 . 0 * z_near * z_far / ( z_far + z_near - depth * ( z_far - z_near ) ) ; <nl> - gl_FragDepth = ( linear_depth * depth_fix + bias ) / z_far ; <nl> + gl_FragDepth = ( linear_depth * depth_fix + bias ) / z_far ; <nl> } <nl> - <nl> mmm a / drivers / gles3 / shaders / cubemap_filter . glsl <nl> ppp b / drivers / gles3 / shaders / cubemap_filter . glsl <nl> <nl> [ vertex ] <nl> <nl> + layout ( location = 0 ) in highp vec2 vertex ; <nl> <nl> - layout ( location = 0 ) in highp vec2 vertex ; <nl> - <nl> - layout ( location = 4 ) in highp vec2 uv ; <nl> + layout ( location = 4 ) in highp vec2 uv ; <nl> <nl> out highp vec2 uv_interp ; <nl> <nl> void main ( ) { <nl> <nl> - uv_interp = uv ; <nl> - gl_Position = vec4 ( vertex , 0 , 1 ) ; <nl> + uv_interp = uv ; <nl> + gl_Position = vec4 ( vertex , 0 , 1 ) ; <nl> } <nl> <nl> [ fragment ] <nl> <nl> - <nl> precision highp float ; <nl> precision highp int ; <nl> <nl> uniform int face_id ; <nl> uniform float roughness ; <nl> in highp vec2 uv_interp ; <nl> <nl> - <nl> layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> - <nl> # define M_PI 3 . 14159265359 <nl> <nl> - <nl> - vec3 texelCoordToVec ( vec2 uv , int faceID ) <nl> - { <nl> - mat3 faceUvVectors [ 6 ] ; <nl> - / * <nl> - / / - x <nl> - faceUvVectors [ 1 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / u - > + z <nl> - faceUvVectors [ 1 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 1 ] [ 2 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / - x face <nl> - <nl> - / / + x <nl> - faceUvVectors [ 0 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / u - > - z <nl> - faceUvVectors [ 0 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 0 ] [ 2 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / + x face <nl> - <nl> - / / - y <nl> - faceUvVectors [ 3 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> - faceUvVectors [ 3 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / v - > - z <nl> - faceUvVectors [ 3 ] [ 2 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / - y face <nl> - <nl> - / / + y <nl> - faceUvVectors [ 2 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> - faceUvVectors [ 2 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / v - > + z <nl> - faceUvVectors [ 2 ] [ 2 ] = vec3 ( 0 . 0 , 1 . 0 , 0 . 0 ) ; / / + y face <nl> - <nl> - / / - z <nl> - faceUvVectors [ 5 ] [ 0 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > - x <nl> - faceUvVectors [ 5 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 5 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / - z face <nl> - <nl> - / / + z <nl> - faceUvVectors [ 4 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> - faceUvVectors [ 4 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 4 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / + z face <nl> - * / <nl> - <nl> - / / - x <nl> - faceUvVectors [ 0 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / u - > + z <nl> - faceUvVectors [ 0 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 0 ] [ 2 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / - x face <nl> - <nl> - / / + x <nl> - faceUvVectors [ 1 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / u - > - z <nl> - faceUvVectors [ 1 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 1 ] [ 2 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / + x face <nl> - <nl> - / / - y <nl> - faceUvVectors [ 2 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> - faceUvVectors [ 2 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / v - > - z <nl> - faceUvVectors [ 2 ] [ 2 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / - y face <nl> - <nl> - / / + y <nl> - faceUvVectors [ 3 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> - faceUvVectors [ 3 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / v - > + z <nl> - faceUvVectors [ 3 ] [ 2 ] = vec3 ( 0 . 0 , 1 . 0 , 0 . 0 ) ; / / + y face <nl> - <nl> - / / - z <nl> - faceUvVectors [ 4 ] [ 0 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > - x <nl> - faceUvVectors [ 4 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 4 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / - z face <nl> - <nl> - / / + z <nl> - faceUvVectors [ 5 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> - faceUvVectors [ 5 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> - faceUvVectors [ 5 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / + z face <nl> - <nl> - / / out = u * s_faceUv [ 0 ] + v * s_faceUv [ 1 ] + s_faceUv [ 2 ] . <nl> - vec3 result = ( faceUvVectors [ faceID ] [ 0 ] * uv . x ) + ( faceUvVectors [ faceID ] [ 1 ] * uv . y ) + faceUvVectors [ faceID ] [ 2 ] ; <nl> - return normalize ( result ) ; <nl> + vec3 texelCoordToVec ( vec2 uv , int faceID ) { <nl> + mat3 faceUvVectors [ 6 ] ; <nl> + / * <nl> + / / - x <nl> + faceUvVectors [ 1 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / u - > + z <nl> + faceUvVectors [ 1 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 1 ] [ 2 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / - x face <nl> + <nl> + / / + x <nl> + faceUvVectors [ 0 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / u - > - z <nl> + faceUvVectors [ 0 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 0 ] [ 2 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / + x face <nl> + <nl> + / / - y <nl> + faceUvVectors [ 3 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> + faceUvVectors [ 3 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / v - > - z <nl> + faceUvVectors [ 3 ] [ 2 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / - y face <nl> + <nl> + / / + y <nl> + faceUvVectors [ 2 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> + faceUvVectors [ 2 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / v - > + z <nl> + faceUvVectors [ 2 ] [ 2 ] = vec3 ( 0 . 0 , 1 . 0 , 0 . 0 ) ; / / + y face <nl> + <nl> + / / - z <nl> + faceUvVectors [ 5 ] [ 0 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > - x <nl> + faceUvVectors [ 5 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 5 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / - z face <nl> + <nl> + / / + z <nl> + faceUvVectors [ 4 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> + faceUvVectors [ 4 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 4 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / + z face <nl> + * / <nl> + <nl> + / / - x <nl> + faceUvVectors [ 0 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / u - > + z <nl> + faceUvVectors [ 0 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 0 ] [ 2 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / - x face <nl> + <nl> + / / + x <nl> + faceUvVectors [ 1 ] [ 0 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / u - > - z <nl> + faceUvVectors [ 1 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 1 ] [ 2 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / + x face <nl> + <nl> + / / - y <nl> + faceUvVectors [ 2 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> + faceUvVectors [ 2 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / v - > - z <nl> + faceUvVectors [ 2 ] [ 2 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / - y face <nl> + <nl> + / / + y <nl> + faceUvVectors [ 3 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> + faceUvVectors [ 3 ] [ 1 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / v - > + z <nl> + faceUvVectors [ 3 ] [ 2 ] = vec3 ( 0 . 0 , 1 . 0 , 0 . 0 ) ; / / + y face <nl> + <nl> + / / - z <nl> + faceUvVectors [ 4 ] [ 0 ] = vec3 ( - 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > - x <nl> + faceUvVectors [ 4 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 4 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , - 1 . 0 ) ; / / - z face <nl> + <nl> + / / + z <nl> + faceUvVectors [ 5 ] [ 0 ] = vec3 ( 1 . 0 , 0 . 0 , 0 . 0 ) ; / / u - > + x <nl> + faceUvVectors [ 5 ] [ 1 ] = vec3 ( 0 . 0 , - 1 . 0 , 0 . 0 ) ; / / v - > - y <nl> + faceUvVectors [ 5 ] [ 2 ] = vec3 ( 0 . 0 , 0 . 0 , 1 . 0 ) ; / / + z face <nl> + <nl> + / / out = u * s_faceUv [ 0 ] + v * s_faceUv [ 1 ] + s_faceUv [ 2 ] . <nl> + vec3 result = ( faceUvVectors [ faceID ] [ 0 ] * uv . x ) + ( faceUvVectors [ faceID ] [ 1 ] * uv . y ) + faceUvVectors [ faceID ] [ 2 ] ; <nl> + return normalize ( result ) ; <nl> } <nl> <nl> - vec3 ImportanceSampleGGX ( vec2 Xi , float Roughness , vec3 N ) <nl> - { <nl> + vec3 ImportanceSampleGGX ( vec2 Xi , float Roughness , vec3 N ) { <nl> float a = Roughness * Roughness ; / / DISNEY ' S ROUGHNESS [ see Burley ' 12 siggraph ] <nl> <nl> / / Compute distribution direction <nl> float Phi = 2 . 0 * M_PI * Xi . x ; <nl> - float CosTheta = sqrt ( ( 1 . 0 - Xi . y ) / ( 1 . 0 + ( a * a - 1 . 0 ) * Xi . y ) ) ; <nl> + float CosTheta = sqrt ( ( 1 . 0 - Xi . y ) / ( 1 . 0 + ( a * a - 1 . 0 ) * Xi . y ) ) ; <nl> float SinTheta = sqrt ( 1 . 0 - CosTheta * CosTheta ) ; <nl> <nl> / / Convert to spherical direction <nl> vec3 ImportanceSampleGGX ( vec2 Xi , float Roughness , vec3 N ) <nl> } <nl> <nl> / / http : / / graphicrants . blogspot . com . au / 2013 / 08 / specular - brdf - reference . html <nl> - float GGX ( float NdotV , float a ) <nl> - { <nl> + float GGX ( float NdotV , float a ) { <nl> float k = a / 2 . 0 ; <nl> return NdotV / ( NdotV * ( 1 . 0 - k ) + k ) ; <nl> } <nl> <nl> / / http : / / graphicrants . blogspot . com . au / 2013 / 08 / specular - brdf - reference . html <nl> - float G_Smith ( float a , float nDotV , float nDotL ) <nl> - { <nl> + float G_Smith ( float a , float nDotV , float nDotL ) { <nl> return GGX ( nDotL , a * a ) * GGX ( nDotV , a * a ) ; <nl> } <nl> <nl> float radicalInverse_VdC ( uint bits ) { <nl> - bits = ( bits < < 16u ) | ( bits > > 16u ) ; <nl> - bits = ( ( bits & 0x55555555u ) < < 1u ) | ( ( bits & 0xAAAAAAAAu ) > > 1u ) ; <nl> - bits = ( ( bits & 0x33333333u ) < < 2u ) | ( ( bits & 0xCCCCCCCCu ) > > 2u ) ; <nl> - bits = ( ( bits & 0x0F0F0F0Fu ) < < 4u ) | ( ( bits & 0xF0F0F0F0u ) > > 4u ) ; <nl> - bits = ( ( bits & 0x00FF00FFu ) < < 8u ) | ( ( bits & 0xFF00FF00u ) > > 8u ) ; <nl> - return float ( bits ) * 2 . 3283064365386963e - 10 ; / / / 0x100000000 <nl> + bits = ( bits < < 16u ) | ( bits > > 16u ) ; <nl> + bits = ( ( bits & 0x55555555u ) < < 1u ) | ( ( bits & 0xAAAAAAAAu ) > > 1u ) ; <nl> + bits = ( ( bits & 0x33333333u ) < < 2u ) | ( ( bits & 0xCCCCCCCCu ) > > 2u ) ; <nl> + bits = ( ( bits & 0x0F0F0F0Fu ) < < 4u ) | ( ( bits & 0xF0F0F0F0u ) > > 4u ) ; <nl> + bits = ( ( bits & 0x00FF00FFu ) < < 8u ) | ( ( bits & 0xFF00FF00u ) > > 8u ) ; <nl> + return float ( bits ) * 2 . 3283064365386963e - 10 ; / / / 0x100000000 <nl> } <nl> <nl> vec2 Hammersley ( uint i , uint N ) { <nl> - return vec2 ( float ( i ) / float ( N ) , radicalInverse_VdC ( i ) ) ; <nl> + return vec2 ( float ( i ) / float ( N ) , radicalInverse_VdC ( i ) ) ; <nl> } <nl> <nl> - <nl> - <nl> # ifdef LOW_QUALITY <nl> <nl> # define SAMPLE_COUNT 64u <nl> uniform bool z_flip ; <nl> <nl> # ifdef USE_SOURCE_PANORAMA <nl> <nl> - vec4 texturePanorama ( vec3 normal , sampler2D pano ) { <nl> + vec4 texturePanorama ( vec3 normal , sampler2D pano ) { <nl> <nl> vec2 st = vec2 ( <nl> - atan ( normal . x , normal . z ) , <nl> - acos ( normal . y ) <nl> - ) ; <nl> - <nl> - if ( st . x < 0 . 0 ) <nl> - st . x + = M_PI * 2 . 0 ; <nl> + atan ( normal . x , normal . z ) , <nl> + acos ( normal . y ) ) ; <nl> <nl> - st / = vec2 ( M_PI * 2 . 0 , M_PI ) ; <nl> + if ( st . x < 0 . 0 ) <nl> + st . x + = M_PI * 2 . 0 ; <nl> <nl> - return textureLod ( pano , st , 0 . 0 ) ; <nl> + st / = vec2 ( M_PI * 2 . 0 , M_PI ) ; <nl> <nl> + return textureLod ( pano , st , 0 . 0 ) ; <nl> } <nl> <nl> # endif <nl> <nl> # ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY <nl> <nl> - <nl> vec4 textureDualParaboloidArray ( vec3 normal ) { <nl> <nl> vec3 norm = normalize ( normal ) ; <nl> - norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> - norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> - if ( norm . z < 0 . 0 ) { <nl> - norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> + norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> + norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> + if ( norm . z < 0 . 0 ) { <nl> + norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> } <nl> - return textureLod ( source_dual_paraboloid_array , vec3 ( norm . xy , float ( source_array_index ) ) , 0 . 0 ) ; <nl> - <nl> + return textureLod ( source_dual_paraboloid_array , vec3 ( norm . xy , float ( source_array_index ) ) , 0 . 0 ) ; <nl> } <nl> <nl> # endif <nl> void main ( ) { <nl> <nl> # ifdef USE_DUAL_PARABOLOID <nl> <nl> - vec3 N = vec3 ( uv_interp * 2 . 0 - 1 . 0 , 0 . 0 ) ; <nl> - N . z = 0 . 5 - 0 . 5 * ( ( N . x * N . x ) + ( N . y * N . y ) ) ; <nl> + vec3 N = vec3 ( uv_interp * 2 . 0 - 1 . 0 , 0 . 0 ) ; <nl> + N . z = 0 . 5 - 0 . 5 * ( ( N . x * N . x ) + ( N . y * N . y ) ) ; <nl> N = normalize ( N ) ; <nl> <nl> if ( z_flip ) { <nl> - N . y = - N . y ; / / y is flipped to improve blending between both sides <nl> - N . z = - N . z ; <nl> + N . y = - N . y ; / / y is flipped to improve blending between both sides <nl> + N . z = - N . z ; <nl> } <nl> <nl> - <nl> # else <nl> - vec2 uv = ( uv_interp * 2 . 0 ) - 1 . 0 ; <nl> - vec3 N = texelCoordToVec ( uv , face_id ) ; <nl> + vec2 uv = ( uv_interp * 2 . 0 ) - 1 . 0 ; <nl> + vec3 N = texelCoordToVec ( uv , face_id ) ; <nl> # endif <nl> / / vec4 color = color_interp ; <nl> <nl> void main ( ) { <nl> <nl> # ifdef USE_SOURCE_PANORAMA <nl> <nl> - frag_color = vec4 ( texturePanorama ( N , source_panorama ) . rgb , 1 . 0 ) ; <nl> + frag_color = vec4 ( texturePanorama ( N , source_panorama ) . rgb , 1 . 0 ) ; <nl> # endif <nl> <nl> # ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY <nl> <nl> - frag_color = vec4 ( textureDualParaboloidArray ( N ) . rgb , 1 . 0 ) ; <nl> + frag_color = vec4 ( textureDualParaboloidArray ( N ) . rgb , 1 . 0 ) ; <nl> # endif <nl> <nl> # if ! defined ( USE_SOURCE_DUAL_PARABOLOID_ARRAY ) & & ! defined ( USE_SOURCE_PANORAMA ) <nl> <nl> - N . y = - N . y ; <nl> - frag_color = vec4 ( texture ( N , source_cube ) . rgb , 1 . 0 ) ; <nl> + N . y = - N . y ; <nl> + frag_color = vec4 ( texture ( N , source_cube ) . rgb , 1 . 0 ) ; <nl> # endif <nl> <nl> - <nl> - <nl> - <nl> # else <nl> <nl> vec4 sum = vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> <nl> - for ( uint sampleNum = 0u ; sampleNum < SAMPLE_COUNT ; sampleNum + + ) { <nl> + for ( uint sampleNum = 0u ; sampleNum < SAMPLE_COUNT ; sampleNum + + ) { <nl> vec2 xi = Hammersley ( sampleNum , SAMPLE_COUNT ) ; <nl> <nl> - vec3 H = ImportanceSampleGGX ( xi , roughness , N ) ; <nl> - vec3 V = N ; <nl> - vec3 L = normalize ( 2 . 0 * dot ( V , H ) * H - V ) ; <nl> + vec3 H = ImportanceSampleGGX ( xi , roughness , N ) ; <nl> + vec3 V = N ; <nl> + vec3 L = normalize ( 2 . 0 * dot ( V , H ) * H - V ) ; <nl> <nl> - float ndotl = clamp ( dot ( N , L ) , 0 . 0 , 1 . 0 ) ; <nl> + float ndotl = clamp ( dot ( N , L ) , 0 . 0 , 1 . 0 ) ; <nl> <nl> - if ( ndotl > 0 . 0 ) { <nl> + if ( ndotl > 0 . 0 ) { <nl> # ifdef USE_SOURCE_PANORAMA <nl> - sum . rgb + = texturePanorama ( H , source_panorama ) . rgb * ndotl ; <nl> + sum . rgb + = texturePanorama ( H , source_panorama ) . rgb * ndotl ; <nl> # endif <nl> <nl> # ifdef USE_SOURCE_DUAL_PARABOLOID_ARRAY <nl> <nl> - sum . rgb + = textureDualParaboloidArray ( H ) . rgb * ndotl ; <nl> + sum . rgb + = textureDualParaboloidArray ( H ) . rgb * ndotl ; <nl> # endif <nl> <nl> # if ! defined ( USE_SOURCE_DUAL_PARABOLOID_ARRAY ) & & ! defined ( USE_SOURCE_PANORAMA ) <nl> - H . y = - H . y ; <nl> - sum . rgb + = textureLod ( source_cube , H , 0 . 0 ) . rgb * ndotl ; <nl> + H . y = - H . y ; <nl> + sum . rgb + = textureLod ( source_cube , H , 0 . 0 ) . rgb * ndotl ; <nl> # endif <nl> sum . a + = ndotl ; <nl> } <nl> void main ( ) { <nl> frag_color = vec4 ( sum . rgb , 1 . 0 ) ; <nl> <nl> # endif <nl> - <nl> } <nl> - <nl> mmm a / drivers / gles3 / shaders / effect_blur . glsl <nl> ppp b / drivers / gles3 / shaders / effect_blur . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - layout ( location = 4 ) in vec2 uv_in ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_in ; <nl> <nl> out vec2 uv_interp ; <nl> <nl> uniform sampler2D source_ssao ; / / texunit : 1 <nl> uniform float lod ; <nl> uniform vec2 pixel_size ; <nl> <nl> - <nl> layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> # ifdef SSAO_MERGE <nl> uniform vec4 ssao_color ; <nl> <nl> # endif <nl> <nl> - # if defined ( GLOW_GAUSSIAN_HORIZONTAL ) | | defined ( GLOW_GAUSSIAN_VERTICAL ) <nl> + # if defined ( GLOW_GAUSSIAN_HORIZONTAL ) | | defined ( GLOW_GAUSSIAN_VERTICAL ) <nl> <nl> uniform float glow_strength ; <nl> <nl> # endif <nl> <nl> - # if defined ( DOF_FAR_BLUR ) | | defined ( DOF_NEAR_BLUR ) <nl> + # if defined ( DOF_FAR_BLUR ) | | defined ( DOF_NEAR_BLUR ) <nl> <nl> # ifdef DOF_QUALITY_LOW <nl> - const int dof_kernel_size = 5 ; <nl> - const int dof_kernel_from = 2 ; <nl> - const float dof_kernel [ 5 ] = float [ ] ( 0 . 153388 , 0 . 221461 , 0 . 250301 , 0 . 221461 , 0 . 153388 ) ; <nl> + const int dof_kernel_size = 5 ; <nl> + const int dof_kernel_from = 2 ; <nl> + const float dof_kernel [ 5 ] = float [ ] ( 0 . 153388 , 0 . 221461 , 0 . 250301 , 0 . 221461 , 0 . 153388 ) ; <nl> # endif <nl> <nl> # ifdef DOF_QUALITY_MEDIUM <nl> - const int dof_kernel_size = 11 ; <nl> - const int dof_kernel_from = 5 ; <nl> - const float dof_kernel [ 11 ] = float [ ] ( 0 . 055037 , 0 . 072806 , 0 . 090506 , 0 . 105726 , 0 . 116061 , 0 . 119726 , 0 . 116061 , 0 . 105726 , 0 . 090506 , 0 . 072806 , 0 . 055037 ) ; <nl> + const int dof_kernel_size = 11 ; <nl> + const int dof_kernel_from = 5 ; <nl> + const float dof_kernel [ 11 ] = float [ ] ( 0 . 055037 , 0 . 072806 , 0 . 090506 , 0 . 105726 , 0 . 116061 , 0 . 119726 , 0 . 116061 , 0 . 105726 , 0 . 090506 , 0 . 072806 , 0 . 055037 ) ; <nl> <nl> # endif <nl> <nl> # ifdef DOF_QUALITY_HIGH <nl> - const int dof_kernel_size = 21 ; <nl> - const int dof_kernel_from = 10 ; <nl> - const float dof_kernel [ 21 ] = float [ ] ( 0 . 028174 , 0 . 032676 , 0 . 037311 , 0 . 041944 , 0 . 046421 , 0 . 050582 , 0 . 054261 , 0 . 057307 , 0 . 059587 , 0 . 060998 , 0 . 061476 , 0 . 060998 , 0 . 059587 , 0 . 057307 , 0 . 054261 , 0 . 050582 , 0 . 046421 , 0 . 041944 , 0 . 037311 , 0 . 032676 , 0 . 028174 ) ; <nl> + const int dof_kernel_size = 21 ; <nl> + const int dof_kernel_from = 10 ; <nl> + const float dof_kernel [ 21 ] = float [ ] ( 0 . 028174 , 0 . 032676 , 0 . 037311 , 0 . 041944 , 0 . 046421 , 0 . 050582 , 0 . 054261 , 0 . 057307 , 0 . 059587 , 0 . 060998 , 0 . 061476 , 0 . 060998 , 0 . 059587 , 0 . 057307 , 0 . 054261 , 0 . 050582 , 0 . 046421 , 0 . 041944 , 0 . 037311 , 0 . 032676 , 0 . 028174 ) ; <nl> # endif <nl> <nl> uniform sampler2D dof_source_depth ; / / texunit : 1 <nl> uniform sampler2D source_dof_original ; / / texunit : 2 <nl> <nl> # endif <nl> <nl> - <nl> # ifdef GLOW_FIRST_PASS <nl> <nl> uniform float exposure ; <nl> uniform float camera_z_near ; <nl> <nl> void main ( ) { <nl> <nl> - <nl> - <nl> # ifdef GAUSSIAN_HORIZONTAL <nl> vec2 pix_size = pixel_size ; <nl> - pix_size * = 0 . 5 ; / / reading from larger buffer , so use more samples <nl> - vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 214607 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 189879 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 157305 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 071303 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( - 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 189879 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( - 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 157305 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( - 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 071303 ; <nl> + pix_size * = 0 . 5 ; / / reading from larger buffer , so use more samples <nl> + vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 214607 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 189879 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 157305 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 071303 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( - 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 189879 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( - 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 157305 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( - 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 071303 ; <nl> frag_color = color ; <nl> # endif <nl> <nl> # ifdef GAUSSIAN_VERTICAL <nl> - vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pixel_size , lod ) * 0 . 38774 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 1 . 0 ) * pixel_size , lod ) * 0 . 24477 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 2 . 0 ) * pixel_size , lod ) * 0 . 06136 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 1 . 0 ) * pixel_size , lod ) * 0 . 24477 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 2 . 0 ) * pixel_size , lod ) * 0 . 06136 ; <nl> + vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pixel_size , lod ) * 0 . 38774 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 1 . 0 ) * pixel_size , lod ) * 0 . 24477 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 2 . 0 ) * pixel_size , lod ) * 0 . 06136 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 1 . 0 ) * pixel_size , lod ) * 0 . 24477 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 2 . 0 ) * pixel_size , lod ) * 0 . 06136 ; <nl> frag_color = color ; <nl> # endif <nl> <nl> - / / glow uses larger sigma for a more rounded blur effect <nl> + / / glow uses larger sigma for a more rounded blur effect <nl> <nl> # ifdef GLOW_GAUSSIAN_HORIZONTAL <nl> vec2 pix_size = pixel_size ; <nl> - pix_size * = 0 . 5 ; / / reading from larger buffer , so use more samples <nl> - vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 174938 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 165569 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 140367 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 106595 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( - 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 165569 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( - 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 140367 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( - 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 106595 ; <nl> - color * = glow_strength ; <nl> + pix_size * = 0 . 5 ; / / reading from larger buffer , so use more samples <nl> + vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 174938 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 165569 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 140367 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 106595 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( - 1 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 165569 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( - 2 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 140367 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( - 3 . 0 , 0 . 0 ) * pix_size , lod ) * 0 . 106595 ; <nl> + color * = glow_strength ; <nl> frag_color = color ; <nl> # endif <nl> <nl> # ifdef GLOW_GAUSSIAN_VERTICAL <nl> - vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pixel_size , lod ) * 0 . 288713 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 1 . 0 ) * pixel_size , lod ) * 0 . 233062 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 2 . 0 ) * pixel_size , lod ) * 0 . 122581 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 1 . 0 ) * pixel_size , lod ) * 0 . 233062 ; <nl> - color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 2 . 0 ) * pixel_size , lod ) * 0 . 122581 ; <nl> - color * = glow_strength ; <nl> + vec4 color = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 0 . 0 ) * pixel_size , lod ) * 0 . 288713 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 1 . 0 ) * pixel_size , lod ) * 0 . 233062 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , 2 . 0 ) * pixel_size , lod ) * 0 . 122581 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 1 . 0 ) * pixel_size , lod ) * 0 . 233062 ; <nl> + color + = textureLod ( source_color , uv_interp + vec2 ( 0 . 0 , - 2 . 0 ) * pixel_size , lod ) * 0 . 122581 ; <nl> + color * = glow_strength ; <nl> frag_color = color ; <nl> # endif <nl> <nl> void main ( ) { <nl> <nl> vec4 color_accum = vec4 ( 0 . 0 ) ; <nl> <nl> - float depth = textureLod ( dof_source_depth , uv_interp , 0 . 0 ) . r ; <nl> + float depth = textureLod ( dof_source_depth , uv_interp , 0 . 0 ) . r ; <nl> depth = depth * 2 . 0 - 1 . 0 ; <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - depth = ( ( depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + depth = ( ( depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> depth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - depth * ( camera_z_far - camera_z_near ) ) ; <nl> # endif <nl> <nl> - float amount = smoothstep ( dof_begin , dof_end , depth ) ; <nl> - float k_accum = 0 . 0 ; <nl> + float amount = smoothstep ( dof_begin , dof_end , depth ) ; <nl> + float k_accum = 0 . 0 ; <nl> <nl> - for ( int i = 0 ; i < dof_kernel_size ; i + + ) { <nl> + for ( int i = 0 ; i < dof_kernel_size ; i + + ) { <nl> <nl> - int int_ofs = i - dof_kernel_from ; <nl> + int int_ofs = i - dof_kernel_from ; <nl> vec2 tap_uv = uv_interp + dof_dir * float ( int_ofs ) * amount * dof_radius ; <nl> <nl> float tap_k = dof_kernel [ i ] ; <nl> <nl> - float tap_depth = texture ( dof_source_depth , tap_uv , 0 . 0 ) . r ; <nl> + float tap_depth = texture ( dof_source_depth , tap_uv , 0 . 0 ) . r ; <nl> tap_depth = tap_depth * 2 . 0 - 1 . 0 ; <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - tap_depth = ( ( tap_depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + tap_depth = ( ( tap_depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> tap_depth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - tap_depth * ( camera_z_far - camera_z_near ) ) ; <nl> # endif <nl> - float tap_amount = mix ( smoothstep ( dof_begin , dof_end , tap_depth ) , 1 . 0 , int_ofs = = 0 ) ; <nl> - tap_amount * = tap_amount * tap_amount ; / / prevent undesired glow effect <nl> - <nl> - vec4 tap_color = textureLod ( source_color , tap_uv , 0 . 0 ) * tap_k ; <nl> - <nl> - k_accum + = tap_k * tap_amount ; <nl> - color_accum + = tap_color * tap_amount ; <nl> + float tap_amount = mix ( smoothstep ( dof_begin , dof_end , tap_depth ) , 1 . 0 , int_ofs = = 0 ) ; <nl> + tap_amount * = tap_amount * tap_amount ; / / prevent undesired glow effect <nl> <nl> + vec4 tap_color = textureLod ( source_color , tap_uv , 0 . 0 ) * tap_k ; <nl> <nl> + k_accum + = tap_k * tap_amount ; <nl> + color_accum + = tap_color * tap_amount ; <nl> } <nl> <nl> - if ( k_accum > 0 . 0 ) { <nl> - color_accum / = k_accum ; <nl> + if ( k_accum > 0 . 0 ) { <nl> + color_accum / = k_accum ; <nl> } <nl> <nl> - frag_color = color_accum ; / / / k_accum ; <nl> + frag_color = color_accum ; / / / k_accum ; <nl> <nl> # endif <nl> <nl> void main ( ) { <nl> <nl> vec4 color_accum = vec4 ( 0 . 0 ) ; <nl> <nl> - float max_accum = 0 . 0 ; <nl> + float max_accum = 0 . 0 ; <nl> <nl> - for ( int i = 0 ; i < dof_kernel_size ; i + + ) { <nl> + for ( int i = 0 ; i < dof_kernel_size ; i + + ) { <nl> <nl> - int int_ofs = i - dof_kernel_from ; <nl> + int int_ofs = i - dof_kernel_from ; <nl> vec2 tap_uv = uv_interp + dof_dir * float ( int_ofs ) * dof_radius ; <nl> - float ofs_influence = max ( 0 . 0 , 1 . 0 - float ( abs ( int_ofs ) ) / float ( dof_kernel_from ) ) ; <nl> + float ofs_influence = max ( 0 . 0 , 1 . 0 - float ( abs ( int_ofs ) ) / float ( dof_kernel_from ) ) ; <nl> <nl> float tap_k = dof_kernel [ i ] ; <nl> <nl> - vec4 tap_color = textureLod ( source_color , tap_uv , 0 . 0 ) ; <nl> + vec4 tap_color = textureLod ( source_color , tap_uv , 0 . 0 ) ; <nl> <nl> - float tap_depth = texture ( dof_source_depth , tap_uv , 0 . 0 ) . r ; <nl> + float tap_depth = texture ( dof_source_depth , tap_uv , 0 . 0 ) . r ; <nl> tap_depth = tap_depth * 2 . 0 - 1 . 0 ; <nl> - # ifdef USE_ORTHOGONAL_PROJECTION <nl> - tap_depth = ( ( tap_depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + # ifdef USE_ORTHOGONAL_PROJECTION <nl> + tap_depth = ( ( tap_depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> tap_depth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - tap_depth * ( camera_z_far - camera_z_near ) ) ; <nl> # endif <nl> - float tap_amount = 1 . 0 - smoothstep ( dof_end , dof_begin , tap_depth ) ; <nl> - tap_amount * = tap_amount * tap_amount ; / / prevent undesired glow effect <nl> + float tap_amount = 1 . 0 - smoothstep ( dof_end , dof_begin , tap_depth ) ; <nl> + tap_amount * = tap_amount * tap_amount ; / / prevent undesired glow effect <nl> <nl> # ifdef DOF_NEAR_FIRST_TAP <nl> <nl> - tap_color . a = 1 . 0 - smoothstep ( dof_end , dof_begin , tap_depth ) ; <nl> + tap_color . a = 1 . 0 - smoothstep ( dof_end , dof_begin , tap_depth ) ; <nl> <nl> # endif <nl> <nl> - max_accum = max ( max_accum , tap_amount * ofs_influence ) ; <nl> - <nl> - color_accum + = tap_color * tap_k ; <nl> + max_accum = max ( max_accum , tap_amount * ofs_influence ) ; <nl> <nl> + color_accum + = tap_color * tap_k ; <nl> } <nl> <nl> - color_accum . a = max ( color_accum . a , sqrt ( max_accum ) ) ; <nl> - <nl> + color_accum . a = max ( color_accum . a , sqrt ( max_accum ) ) ; <nl> <nl> # ifdef DOF_NEAR_BLUR_MERGE <nl> <nl> - vec4 original = textureLod ( source_dof_original , uv_interp , 0 . 0 ) ; <nl> - color_accum = mix ( original , color_accum , color_accum . a ) ; <nl> + vec4 original = textureLod ( source_dof_original , uv_interp , 0 . 0 ) ; <nl> + color_accum = mix ( original , color_accum , color_accum . a ) ; <nl> <nl> # endif <nl> <nl> void main ( ) { <nl> <nl> # endif <nl> <nl> - <nl> - <nl> # ifdef GLOW_FIRST_PASS <nl> <nl> # ifdef GLOW_USE_AUTO_EXPOSURE <nl> <nl> - frag_color / = texelFetch ( source_auto_exposure , ivec2 ( 0 , 0 ) , 0 ) . r / auto_exposure_grey ; <nl> + frag_color / = texelFetch ( source_auto_exposure , ivec2 ( 0 , 0 ) , 0 ) . r / auto_exposure_grey ; <nl> # endif <nl> - frag_color * = exposure ; <nl> + frag_color * = exposure ; <nl> <nl> - float luminance = max ( frag_color . r , max ( frag_color . g , frag_color . b ) ) ; <nl> - float feedback = max ( smoothstep ( glow_hdr_threshold , glow_hdr_threshold + glow_hdr_scale , luminance ) , glow_bloom ) ; <nl> + float luminance = max ( frag_color . r , max ( frag_color . g , frag_color . b ) ) ; <nl> + float feedback = max ( smoothstep ( glow_hdr_threshold , glow_hdr_threshold + glow_hdr_scale , luminance ) , glow_bloom ) ; <nl> <nl> frag_color * = feedback ; <nl> <nl> # endif <nl> <nl> - <nl> # ifdef SIMPLE_COPY <nl> - vec4 color = textureLod ( source_color , uv_interp , 0 . 0 ) ; <nl> + vec4 color = textureLod ( source_color , uv_interp , 0 . 0 ) ; <nl> frag_color = color ; <nl> # endif <nl> <nl> # ifdef SSAO_MERGE <nl> <nl> - vec4 color = textureLod ( source_color , uv_interp , 0 . 0 ) ; <nl> - float ssao = textureLod ( source_ssao , uv_interp , 0 . 0 ) . r ; <nl> + vec4 color = textureLod ( source_color , uv_interp , 0 . 0 ) ; <nl> + float ssao = textureLod ( source_ssao , uv_interp , 0 . 0 ) . r ; <nl> <nl> - frag_color = vec4 ( mix ( color . rgb , color . rgb * mix ( ssao_color . rgb , vec3 ( 1 . 0 ) , ssao ) , color . a ) , 1 . 0 ) ; <nl> + frag_color = vec4 ( mix ( color . rgb , color . rgb * mix ( ssao_color . rgb , vec3 ( 1 . 0 ) , ssao ) , color . a ) , 1 . 0 ) ; <nl> <nl> # endif <nl> - <nl> - <nl> } <nl> mmm a / drivers / gles3 / shaders / exposure . glsl <nl> ppp b / drivers / gles3 / shaders / exposure . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> <nl> void main ( ) { <nl> <nl> gl_Position = vertex_attrib ; <nl> - <nl> } <nl> <nl> [ fragment ] <nl> <nl> - <nl> uniform highp sampler2D source_exposure ; / / texunit : 0 <nl> <nl> # ifdef EXPOSURE_BEGIN <nl> uniform highp float max_luminance ; <nl> <nl> layout ( location = 0 ) out highp float exposure ; <nl> <nl> - <nl> - <nl> void main ( ) { <nl> <nl> - <nl> - <nl> # ifdef EXPOSURE_BEGIN <nl> <nl> - <nl> - ivec2 src_pos = ivec2 ( gl_FragCoord . xy ) * source_render_size / target_size ; <nl> + ivec2 src_pos = ivec2 ( gl_FragCoord . xy ) * source_render_size / target_size ; <nl> <nl> # if 1 <nl> / / more precise and expensive , but less jittery <nl> - ivec2 next_pos = ivec2 ( gl_FragCoord . xy + ivec2 ( 1 ) ) * source_render_size / target_size ; <nl> - next_pos = max ( next_pos , src_pos + ivec2 ( 1 ) ) ; / / so it at least reads one pixel <nl> - highp vec3 source_color = vec3 ( 0 . 0 ) ; <nl> - for ( int i = src_pos . x ; i < next_pos . x ; i + + ) { <nl> - for ( int j = src_pos . y ; j < next_pos . y ; j + + ) { <nl> - source_color + = texelFetch ( source_exposure , ivec2 ( i , j ) , 0 ) . rgb ; <nl> + ivec2 next_pos = ivec2 ( gl_FragCoord . xy + ivec2 ( 1 ) ) * source_render_size / target_size ; <nl> + next_pos = max ( next_pos , src_pos + ivec2 ( 1 ) ) ; / / so it at least reads one pixel <nl> + highp vec3 source_color = vec3 ( 0 . 0 ) ; <nl> + for ( int i = src_pos . x ; i < next_pos . x ; i + + ) { <nl> + for ( int j = src_pos . y ; j < next_pos . y ; j + + ) { <nl> + source_color + = texelFetch ( source_exposure , ivec2 ( i , j ) , 0 ) . rgb ; <nl> } <nl> } <nl> <nl> - source_color / = float ( ( next_pos . x - src_pos . x ) * ( next_pos . y - src_pos . y ) ) ; <nl> + source_color / = float ( ( next_pos . x - src_pos . x ) * ( next_pos . y - src_pos . y ) ) ; <nl> # else <nl> - highp vec3 source_color = texelFetch ( source_exposure , src_pos , 0 ) . rgb ; <nl> + highp vec3 source_color = texelFetch ( source_exposure , src_pos , 0 ) . rgb ; <nl> <nl> # endif <nl> <nl> - exposure = max ( source_color . r , max ( source_color . g , source_color . b ) ) ; <nl> + exposure = max ( source_color . r , max ( source_color . g , source_color . b ) ) ; <nl> <nl> # else <nl> <nl> ivec2 coord = ivec2 ( gl_FragCoord . xy ) ; <nl> - exposure = texelFetch ( source_exposure , coord * 3 + ivec2 ( 0 , 0 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 1 , 0 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 2 , 0 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 0 , 1 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 1 , 1 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 2 , 1 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 0 , 2 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 1 , 2 ) , 0 ) . r ; <nl> - exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 2 , 2 ) , 0 ) . r ; <nl> - exposure * = ( 1 . 0 / 9 . 0 ) ; <nl> + exposure = texelFetch ( source_exposure , coord * 3 + ivec2 ( 0 , 0 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 1 , 0 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 2 , 0 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 0 , 1 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 1 , 1 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 2 , 1 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 0 , 2 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 1 , 2 ) , 0 ) . r ; <nl> + exposure + = texelFetch ( source_exposure , coord * 3 + ivec2 ( 2 , 2 ) , 0 ) . r ; <nl> + exposure * = ( 1 . 0 / 9 . 0 ) ; <nl> <nl> # ifdef EXPOSURE_END <nl> <nl> # ifdef EXPOSURE_FORCE_SET <nl> / / will stay as is <nl> # else <nl> - highp float prev_lum = texelFetch ( prev_exposure , ivec2 ( 0 , 0 ) , 0 ) . r ; / / 1 pixel previous exposure <nl> - exposure = clamp ( prev_lum + ( exposure - prev_lum ) * exposure_adjust , min_luminance , max_luminance ) ; <nl> + highp float prev_lum = texelFetch ( prev_exposure , ivec2 ( 0 , 0 ) , 0 ) . r ; / / 1 pixel previous exposure <nl> + exposure = clamp ( prev_lum + ( exposure - prev_lum ) * exposure_adjust , min_luminance , max_luminance ) ; <nl> <nl> # endif / / EXPOSURE_FORCE_SET <nl> <nl> - <nl> # endif / / EXPOSURE_END <nl> <nl> # endif / / EXPOSURE_BEGIN <nl> - <nl> - <nl> } <nl> - <nl> - <nl> mmm a / drivers / gles3 / shaders / particles . glsl <nl> ppp b / drivers / gles3 / shaders / particles . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - <nl> - layout ( location = 0 ) in highp vec4 color ; <nl> - layout ( location = 1 ) in highp vec4 velocity_active ; <nl> - layout ( location = 2 ) in highp vec4 custom ; <nl> - layout ( location = 3 ) in highp vec4 xform_1 ; <nl> - layout ( location = 4 ) in highp vec4 xform_2 ; <nl> - layout ( location = 5 ) in highp vec4 xform_3 ; <nl> - <nl> + layout ( location = 0 ) in highp vec4 color ; <nl> + layout ( location = 1 ) in highp vec4 velocity_active ; <nl> + layout ( location = 2 ) in highp vec4 custom ; <nl> + layout ( location = 3 ) in highp vec4 xform_1 ; <nl> + layout ( location = 4 ) in highp vec4 xform_2 ; <nl> + layout ( location = 5 ) in highp vec4 xform_3 ; <nl> <nl> struct Attractor { <nl> <nl> uniform float lifetime ; <nl> uniform mat4 emission_transform ; <nl> uniform uint random_seed ; <nl> <nl> - <nl> out highp vec4 out_color ; / / tfb : <nl> out highp vec4 out_velocity_active ; / / tfb : <nl> out highp vec4 out_custom ; / / tfb : <nl> out highp vec4 out_xform_1 ; / / tfb : <nl> out highp vec4 out_xform_2 ; / / tfb : <nl> out highp vec4 out_xform_3 ; / / tfb : <nl> <nl> - <nl> # if defined ( USE_MATERIAL ) <nl> <nl> layout ( std140 ) uniform UniformData { / / ubo : 0 <nl> MATERIAL_UNIFORMS <nl> <nl> # endif <nl> <nl> - <nl> VERTEX_SHADER_GLOBALS <nl> <nl> uint hash ( uint x ) { <nl> uint hash ( uint x ) { <nl> return x ; <nl> } <nl> <nl> - <nl> void main ( ) { <nl> <nl> # ifdef PARTICLES_COPY <nl> <nl> - out_color = color ; <nl> - out_velocity_active = velocity_active ; <nl> + out_color = color ; <nl> + out_velocity_active = velocity_active ; <nl> out_custom = custom ; <nl> out_xform_1 = xform_1 ; <nl> out_xform_2 = xform_2 ; <nl> void main ( ) { <nl> <nl> # else <nl> <nl> - bool apply_forces = true ; <nl> - bool apply_velocity = true ; <nl> - float local_delta = delta ; <nl> + bool apply_forces = true ; <nl> + bool apply_velocity = true ; <nl> + float local_delta = delta ; <nl> <nl> float mass = 1 . 0 ; <nl> <nl> - float restart_phase = float ( gl_VertexID ) / float ( total_particles ) ; <nl> + float restart_phase = float ( gl_VertexID ) / float ( total_particles ) ; <nl> <nl> - if ( randomness > 0 . 0 ) { <nl> + if ( randomness > 0 . 0 ) { <nl> uint seed = cycle ; <nl> if ( restart_phase > = system_phase ) { <nl> - seed - = uint ( 1 ) ; <nl> + seed - = uint ( 1 ) ; <nl> } <nl> - seed * = uint ( total_particles ) ; <nl> - seed + = uint ( gl_VertexID ) ; <nl> + seed * = uint ( total_particles ) ; <nl> + seed + = uint ( gl_VertexID ) ; <nl> float random = float ( hash ( seed ) % uint ( 65536 ) ) / 65536 . 0 ; <nl> - restart_phase + = randomness * random * 1 . 0 / float ( total_particles ) ; <nl> + restart_phase + = randomness * random * 1 . 0 / float ( total_particles ) ; <nl> } <nl> <nl> - restart_phase * = ( 1 . 0 - explosiveness ) ; <nl> - bool restart = false ; <nl> + restart_phase * = ( 1 . 0 - explosiveness ) ; <nl> + bool restart = false ; <nl> bool shader_active = velocity_active . a > 0 . 5 ; <nl> <nl> if ( system_phase > prev_system_phase ) { <nl> / / restart_phase > = prev_system_phase is used so particles emit in the first frame they are processed <nl> <nl> - if ( restart_phase > = prev_system_phase & & restart_phase < system_phase ) { <nl> - restart = true ; <nl> + if ( restart_phase > = prev_system_phase & & restart_phase < system_phase ) { <nl> + restart = true ; <nl> # ifdef USE_FRACTIONAL_DELTA <nl> local_delta = ( system_phase - restart_phase ) * lifetime ; <nl> # endif <nl> } <nl> <nl> - } else if ( delta > 0 . 0 ) { <nl> + } else if ( delta > 0 . 0 ) { <nl> if ( restart_phase > = prev_system_phase ) { <nl> - restart = true ; <nl> + restart = true ; <nl> # ifdef USE_FRACTIONAL_DELTA <nl> local_delta = ( 1 . 0 - restart_phase + system_phase ) * lifetime ; <nl> # endif <nl> - } else if ( restart_phase < system_phase ) { <nl> - restart = true ; <nl> + } else if ( restart_phase < system_phase ) { <nl> + restart = true ; <nl> # ifdef USE_FRACTIONAL_DELTA <nl> local_delta = ( system_phase - restart_phase ) * lifetime ; <nl> # endif <nl> void main ( ) { <nl> uint current_cycle = cycle ; <nl> <nl> if ( system_phase < restart_phase ) { <nl> - current_cycle - = uint ( 1 ) ; <nl> + current_cycle - = uint ( 1 ) ; <nl> } <nl> <nl> uint particle_number = current_cycle * uint ( total_particles ) + uint ( gl_VertexID ) ; <nl> int index = int ( gl_VertexID ) ; <nl> <nl> if ( restart ) { <nl> - shader_active = emitting ; <nl> + shader_active = emitting ; <nl> } <nl> <nl> mat4 xform ; <nl> void main ( ) { <nl> # else <nl> if ( clear | | restart ) { <nl> # endif <nl> - out_color = vec4 ( 1 . 0 ) ; <nl> - out_velocity_active = vec4 ( 0 . 0 ) ; <nl> - out_custom = vec4 ( 0 . 0 ) ; <nl> + out_color = vec4 ( 1 . 0 ) ; <nl> + out_velocity_active = vec4 ( 0 . 0 ) ; <nl> + out_custom = vec4 ( 0 . 0 ) ; <nl> if ( ! restart ) <nl> - shader_active = false ; <nl> + shader_active = false ; <nl> <nl> xform = mat4 ( <nl> - vec4 ( 1 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) , <nl> - vec4 ( 0 . 0 , 1 . 0 , 0 . 0 , 0 . 0 ) , <nl> - vec4 ( 0 . 0 , 0 . 0 , 1 . 0 , 0 . 0 ) , <nl> - vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) <nl> - ) ; <nl> + vec4 ( 1 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) , <nl> + vec4 ( 0 . 0 , 1 . 0 , 0 . 0 , 0 . 0 ) , <nl> + vec4 ( 0 . 0 , 0 . 0 , 1 . 0 , 0 . 0 ) , <nl> + vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ; <nl> } else { <nl> - out_color = color ; <nl> - out_velocity_active = velocity_active ; <nl> - out_custom = custom ; <nl> - xform = transpose ( mat4 ( xform_1 , xform_2 , xform_3 , vec4 ( vec3 ( 0 . 0 ) , 1 . 0 ) ) ) ; <nl> + out_color = color ; <nl> + out_velocity_active = velocity_active ; <nl> + out_custom = custom ; <nl> + xform = transpose ( mat4 ( xform_1 , xform_2 , xform_3 , vec4 ( vec3 ( 0 . 0 ) , 1 . 0 ) ) ) ; <nl> } <nl> <nl> if ( shader_active ) { <nl> VERTEX_SHADER_CODE <nl> if ( false ) { <nl> <nl> vec3 force = vec3 ( 0 . 0 ) ; <nl> - for ( int i = 0 ; i < attractor_count ; i + + ) { <nl> + for ( int i = 0 ; i < attractor_count ; i + + ) { <nl> <nl> vec3 rel_vec = xform [ 3 ] . xyz - attractors [ i ] . pos ; <nl> float dist = length ( rel_vec ) ; <nl> if ( attractors [ i ] . radius < dist ) <nl> continue ; <nl> - if ( attractors [ i ] . eat_radius > 0 . 0 & & attractors [ i ] . eat_radius > dist ) { <nl> - out_velocity_active . a = 0 . 0 ; <nl> + if ( attractors [ i ] . eat_radius > 0 . 0 & & attractors [ i ] . eat_radius > dist ) { <nl> + out_velocity_active . a = 0 . 0 ; <nl> } <nl> <nl> rel_vec = normalize ( rel_vec ) ; <nl> <nl> - float attenuation = pow ( dist / attractors [ i ] . radius , attractors [ i ] . attenuation ) ; <nl> + float attenuation = pow ( dist / attractors [ i ] . radius , attractors [ i ] . attenuation ) ; <nl> <nl> - if ( attractors [ i ] . dir = = vec3 ( 0 . 0 ) ) { <nl> + if ( attractors [ i ] . dir = = vec3 ( 0 . 0 ) ) { <nl> / / towards center <nl> - force + = attractors [ i ] . strength * rel_vec * attenuation * mass ; <nl> + force + = attractors [ i ] . strength * rel_vec * attenuation * mass ; <nl> } else { <nl> - force + = attractors [ i ] . strength * attractors [ i ] . dir * attenuation * mass ; <nl> - <nl> + force + = attractors [ i ] . strength * attractors [ i ] . dir * attenuation * mass ; <nl> } <nl> } <nl> <nl> VERTEX_SHADER_CODE <nl> } <nl> # endif <nl> } else { <nl> - xform = mat4 ( 0 . 0 ) ; <nl> + xform = mat4 ( 0 . 0 ) ; <nl> } <nl> <nl> xform = transpose ( xform ) ; <nl> <nl> - out_velocity_active . a = mix ( 0 . 0 , 1 . 0 , shader_active ) ; <nl> + out_velocity_active . a = mix ( 0 . 0 , 1 . 0 , shader_active ) ; <nl> <nl> out_xform_1 = xform [ 0 ] ; <nl> out_xform_2 = xform [ 1 ] ; <nl> out_xform_3 = xform [ 2 ] ; <nl> <nl> # endif / / PARTICLES_COPY <nl> - <nl> } <nl> <nl> [ fragment ] <nl> <nl> - / / any code here is never executed , stuff is filled just so it works <nl> - <nl> + / / any code here is never executed , stuff is filled just so it works <nl> <nl> # if defined ( USE_MATERIAL ) <nl> <nl> mmm a / drivers / gles3 / shaders / resolve . glsl <nl> ppp b / drivers / gles3 / shaders / resolve . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - layout ( location = 4 ) in vec2 uv_in ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_in ; <nl> <nl> out vec2 uv_interp ; <nl> <nl> - <nl> void main ( ) { <nl> <nl> uv_interp = uv_in ; <nl> precision mediump float ; <nl> # endif <nl> <nl> in vec2 uv_interp ; <nl> - uniform sampler2D source_specular ; / / texunit : 0 <nl> - uniform sampler2D source_ssr ; / / texunit : 1 <nl> + uniform sampler2D source_specular ; / / texunit : 0 <nl> + uniform sampler2D source_ssr ; / / texunit : 1 <nl> <nl> uniform vec2 pixel_size ; <nl> <nl> layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> void main ( ) { <nl> <nl> - vec4 specular = texture ( source_specular , uv_interp ) ; <nl> + vec4 specular = texture ( source_specular , uv_interp ) ; <nl> <nl> # ifdef USE_SSR <nl> - <nl> - vec4 ssr = textureLod ( source_ssr , uv_interp , 0 . 0 ) ; <nl> - specular . rgb = mix ( specular . rgb , ssr . rgb * specular . a , ssr . a ) ; <nl> + vec4 ssr = textureLod ( source_ssr , uv_interp , 0 . 0 ) ; <nl> + specular . rgb = mix ( specular . rgb , ssr . rgb * specular . a , ssr . a ) ; <nl> # endif <nl> <nl> - frag_color = vec4 ( specular . rgb , 1 . 0 ) ; <nl> + frag_color = vec4 ( specular . rgb , 1 . 0 ) ; <nl> } <nl> - <nl> mmm a / drivers / gles3 / shaders / scene . glsl <nl> ppp b / drivers / gles3 / shaders / scene . glsl <nl> ARRAY_WEIGHTS = 7 , <nl> ARRAY_INDEX = 8 , <nl> * / <nl> <nl> - / / hack to use uv if no uv present so it works with lightmap <nl> - <nl> + / / hack to use uv if no uv present so it works with lightmap <nl> <nl> / * INPUT ATTRIBS * / <nl> <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - layout ( location = 1 ) in vec3 normal_attrib ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 1 ) in vec3 normal_attrib ; <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> - layout ( location = 2 ) in vec4 tangent_attrib ; <nl> + layout ( location = 2 ) in vec4 tangent_attrib ; <nl> # endif <nl> <nl> # if defined ( ENABLE_COLOR_INTERP ) <nl> - layout ( location = 3 ) in vec4 color_attrib ; <nl> + layout ( location = 3 ) in vec4 color_attrib ; <nl> # endif <nl> <nl> # if defined ( ENABLE_UV_INTERP ) <nl> - layout ( location = 4 ) in vec2 uv_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_attrib ; <nl> # endif <nl> <nl> # if defined ( ENABLE_UV2_INTERP ) | | defined ( USE_LIGHTMAP ) <nl> - layout ( location = 5 ) in vec2 uv2_attrib ; <nl> + layout ( location = 5 ) in vec2 uv2_attrib ; <nl> # endif <nl> <nl> uniform float normal_mult ; <nl> <nl> # ifdef USE_SKELETON <nl> - layout ( location = 6 ) in uvec4 bone_indices ; / / attrib : 6 <nl> - layout ( location = 7 ) in vec4 bone_weights ; / / attrib : 7 <nl> + layout ( location = 6 ) in uvec4 bone_indices ; / / attrib : 6 <nl> + layout ( location = 7 ) in vec4 bone_weights ; / / attrib : 7 <nl> # endif <nl> <nl> # ifdef USE_INSTANCING <nl> <nl> - layout ( location = 8 ) in highp vec4 instance_xform0 ; <nl> - layout ( location = 9 ) in highp vec4 instance_xform1 ; <nl> - layout ( location = 10 ) in highp vec4 instance_xform2 ; <nl> - layout ( location = 11 ) in lowp vec4 instance_color ; <nl> + layout ( location = 8 ) in highp vec4 instance_xform0 ; <nl> + layout ( location = 9 ) in highp vec4 instance_xform1 ; <nl> + layout ( location = 10 ) in highp vec4 instance_xform2 ; <nl> + layout ( location = 11 ) in lowp vec4 instance_color ; <nl> <nl> # if defined ( ENABLE_INSTANCE_CUSTOM ) <nl> - layout ( location = 12 ) in highp vec4 instance_custom_data ; <nl> + layout ( location = 12 ) in highp vec4 instance_custom_data ; <nl> # endif <nl> <nl> # endif <nl> <nl> - layout ( std140 ) uniform SceneData { / / ubo : 0 <nl> + layout ( std140 ) uniform SceneData { / / ubo : 0 <nl> <nl> highp mat4 projection_matrix ; <nl> highp mat4 inv_projection_matrix ; <nl> layout ( std140 ) uniform SceneData { / / ubo : 0 <nl> highp float fog_height_min ; <nl> highp float fog_height_max ; <nl> highp float fog_height_curve ; <nl> - <nl> } ; <nl> <nl> uniform highp mat4 world_transform ; <nl> <nl> - <nl> # ifdef USE_LIGHT_DIRECTIONAL <nl> <nl> layout ( std140 ) uniform DirectionalLightData { / / ubo : 3 <nl> layout ( std140 ) uniform DirectionalLightData { / / ubo : 3 <nl> highp vec4 light_pos_inv_radius ; <nl> mediump vec4 light_direction_attenuation ; <nl> mediump vec4 light_color_energy ; <nl> - mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> + mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> mediump vec4 light_clamp ; <nl> mediump vec4 shadow_color_contact ; <nl> highp mat4 shadow_matrix1 ; <nl> struct LightData { <nl> highp vec4 light_pos_inv_radius ; <nl> mediump vec4 light_direction_attenuation ; <nl> mediump vec4 light_color_energy ; <nl> - mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> + mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> mediump vec4 light_clamp ; <nl> mediump vec4 shadow_color_contact ; <nl> highp mat4 shadow_matrix ; <nl> - <nl> } ; <nl> <nl> - <nl> layout ( std140 ) uniform OmniLightData { / / ubo : 4 <nl> <nl> LightData omni_lights [ MAX_LIGHT_DATA_STRUCTS ] ; <nl> layout ( std140 ) uniform SpotLightData { / / ubo : 5 <nl> <nl> # ifdef USE_FORWARD_LIGHTING <nl> <nl> - <nl> uniform int omni_light_indices [ MAX_FORWARD_LIGHTS ] ; <nl> uniform int omni_light_count ; <nl> <nl> uniform int spot_light_count ; <nl> out vec4 diffuse_light_interp ; <nl> out vec4 specular_light_interp ; <nl> <nl> - void light_compute ( vec3 N , vec3 L , vec3 V , vec3 light_color , float roughness , inout vec3 diffuse , inout vec3 specular ) { <nl> + void light_compute ( vec3 N , vec3 L , vec3 V , vec3 light_color , float roughness , inout vec3 diffuse , inout vec3 specular ) { <nl> <nl> - float dotNL = max ( dot ( N , L ) , 0 . 0 ) ; <nl> + float dotNL = max ( dot ( N , L ) , 0 . 0 ) ; <nl> diffuse + = dotNL * light_color / M_PI ; <nl> <nl> if ( roughness > 0 . 0 ) { <nl> <nl> vec3 H = normalize ( V + L ) ; <nl> - float dotNH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> - float intensity = ( roughness > = 1 . 0 ? 1 . 0 : pow ( dotNH , ( 1 . 0 - roughness ) * 256 . 0 ) ) ; <nl> + float dotNH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> + float intensity = ( roughness > = 1 . 0 ? 1 . 0 : pow ( dotNH , ( 1 . 0 - roughness ) * 256 . 0 ) ) ; <nl> specular + = light_color * intensity ; <nl> - <nl> } <nl> } <nl> <nl> - void light_process_omni ( int idx , vec3 vertex , vec3 eye_vec , vec3 normal , float roughness , inout vec3 diffuse , inout vec3 specular ) { <nl> - <nl> - vec3 light_rel_vec = omni_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> - float light_length = length ( light_rel_vec ) ; <nl> - float normalized_distance = light_length * omni_lights [ idx ] . light_pos_inv_radius . w ; <nl> - vec3 light_attenuation = vec3 ( pow ( max ( 1 . 0 - normalized_distance , 0 . 0 ) , omni_lights [ idx ] . light_direction_attenuation . w ) ) ; <nl> + void light_process_omni ( int idx , vec3 vertex , vec3 eye_vec , vec3 normal , float roughness , inout vec3 diffuse , inout vec3 specular ) { <nl> <nl> - light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , omni_lights [ idx ] . light_color_energy . rgb * light_attenuation , roughness , diffuse , specular ) ; <nl> + vec3 light_rel_vec = omni_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> + float light_length = length ( light_rel_vec ) ; <nl> + float normalized_distance = light_length * omni_lights [ idx ] . light_pos_inv_radius . w ; <nl> + vec3 light_attenuation = vec3 ( pow ( max ( 1 . 0 - normalized_distance , 0 . 0 ) , omni_lights [ idx ] . light_direction_attenuation . w ) ) ; <nl> <nl> + light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , omni_lights [ idx ] . light_color_energy . rgb * light_attenuation , roughness , diffuse , specular ) ; <nl> } <nl> <nl> void light_process_spot ( int idx , vec3 vertex , vec3 eye_vec , vec3 normal , float roughness , inout vec3 diffuse , inout vec3 specular ) { <nl> <nl> - vec3 light_rel_vec = spot_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> - float light_length = length ( light_rel_vec ) ; <nl> - float normalized_distance = light_length * spot_lights [ idx ] . light_pos_inv_radius . w ; <nl> - vec3 light_attenuation = vec3 ( pow ( max ( 1 . 0 - normalized_distance , 0 . 001 ) , spot_lights [ idx ] . light_direction_attenuation . w ) ) ; <nl> + vec3 light_rel_vec = spot_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> + float light_length = length ( light_rel_vec ) ; <nl> + float normalized_distance = light_length * spot_lights [ idx ] . light_pos_inv_radius . w ; <nl> + vec3 light_attenuation = vec3 ( pow ( max ( 1 . 0 - normalized_distance , 0 . 001 ) , spot_lights [ idx ] . light_direction_attenuation . w ) ) ; <nl> vec3 spot_dir = spot_lights [ idx ] . light_direction_attenuation . xyz ; <nl> - float spot_cutoff = spot_lights [ idx ] . light_params . y ; <nl> - float scos = max ( dot ( - normalize ( light_rel_vec ) , spot_dir ) , spot_cutoff ) ; <nl> + float spot_cutoff = spot_lights [ idx ] . light_params . y ; <nl> + float scos = max ( dot ( - normalize ( light_rel_vec ) , spot_dir ) , spot_cutoff ) ; <nl> float spot_rim = ( 1 . 0 - scos ) / ( 1 . 0 - spot_cutoff ) ; <nl> - light_attenuation * = 1 . 0 - pow ( max ( spot_rim , 0 . 001 ) , spot_lights [ idx ] . light_params . x ) ; <nl> - <nl> + light_attenuation * = 1 . 0 - pow ( max ( spot_rim , 0 . 001 ) , spot_lights [ idx ] . light_params . x ) ; <nl> <nl> - light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , spot_lights [ idx ] . light_color_energy . rgb * light_attenuation , roughness , diffuse , specular ) ; <nl> + light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , spot_lights [ idx ] . light_color_energy . rgb * light_attenuation , roughness , diffuse , specular ) ; <nl> } <nl> <nl> - <nl> # endif <nl> <nl> / * Varyings * / <nl> out vec4 color_interp ; <nl> out vec2 uv_interp ; <nl> # endif <nl> <nl> - # if defined ( ENABLE_UV2_INTERP ) | | defined ( USE_LIGHTMAP ) <nl> + # if defined ( ENABLE_UV2_INTERP ) | | defined ( USE_LIGHTMAP ) <nl> out vec2 uv2_interp ; <nl> # endif <nl> <nl> - <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> out vec3 tangent_interp ; <nl> out vec3 binormal_interp ; <nl> # endif <nl> <nl> - <nl> # if defined ( USE_MATERIAL ) <nl> <nl> - layout ( std140 ) uniform UniformData { / / ubo : 1 <nl> + layout ( std140 ) uniform UniformData { / / ubo : 1 <nl> <nl> MATERIAL_UNIFORMS <nl> <nl> out highp float dp_clip ; <nl> # define SKELETON_TEXTURE_WIDTH 256 <nl> <nl> # ifdef USE_SKELETON <nl> - uniform highp sampler2D skeleton_texture ; / / texunit : - 1 <nl> + uniform highp sampler2D skeleton_texture ; / / texunit : - 1 <nl> # endif <nl> <nl> out highp vec4 position_interp ; <nl> void main ( ) { <nl> <nl> mat4 world_matrix = world_transform ; <nl> <nl> - <nl> # ifdef USE_INSTANCING <nl> <nl> { <nl> - highp mat4 m = mat4 ( instance_xform0 , instance_xform1 , instance_xform2 , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ; <nl> + highp mat4 m = mat4 ( instance_xform0 , instance_xform1 , instance_xform2 , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ; <nl> world_matrix = world_matrix * transpose ( m ) ; <nl> } <nl> # endif <nl> <nl> vec3 normal = normal_attrib * normal_mult ; <nl> <nl> - <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> vec3 tangent = tangent_attrib . xyz ; <nl> - tangent * = normal_mult ; <nl> + tangent * = normal_mult ; <nl> float binormalf = tangent_attrib . a ; <nl> # endif <nl> <nl> void main ( ) { <nl> <nl> # endif <nl> <nl> - <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> <nl> - vec3 binormal = normalize ( cross ( normal , tangent ) * binormalf ) ; <nl> + vec3 binormal = normalize ( cross ( normal , tangent ) * binormalf ) ; <nl> # endif <nl> <nl> # if defined ( ENABLE_UV_INTERP ) <nl> void main ( ) { <nl> mat3 normal_matrix = mat3 ( transpose ( inverse ( world_matrix ) ) ) ; <nl> normal = normal_matrix * normal ; <nl> # else <nl> - normal = normalize ( ( world_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> + normal = normalize ( ( world_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> # endif <nl> <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> <nl> - tangent = normalize ( ( world_matrix * vec4 ( tangent , 0 . 0 ) ) . xyz ) ; <nl> - binormal = normalize ( ( world_matrix * vec4 ( binormal , 0 . 0 ) ) . xyz ) ; <nl> + tangent = normalize ( ( world_matrix * vec4 ( tangent , 0 . 0 ) ) . xyz ) ; <nl> + binormal = normalize ( ( world_matrix * vec4 ( binormal , 0 . 0 ) ) . xyz ) ; <nl> # endif <nl> # endif <nl> <nl> void main ( ) { <nl> # define projection_matrix local_projection <nl> # define world_transform world_matrix <nl> <nl> - <nl> # ifdef USE_SKELETON <nl> { <nl> / / skeleton transform <nl> ivec4 bone_indicesi = ivec4 ( bone_indices ) ; / / cast to signed int <nl> <nl> - ivec2 tex_ofs = ivec2 ( bone_indicesi . x % 256 , ( bone_indicesi . x / 256 ) * 3 ) ; <nl> - highp mat3x4 m = mat3x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) <nl> - ) * bone_weights . x ; <nl> - <nl> - tex_ofs = ivec2 ( bone_indicesi . y % 256 , ( bone_indicesi . y / 256 ) * 3 ) ; <nl> + ivec2 tex_ofs = ivec2 ( bone_indicesi . x % 256 , ( bone_indicesi . x / 256 ) * 3 ) ; <nl> + highp mat3x4 m ; <nl> + m = mat3x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) ) <nl> + * bone_weights . x ; <nl> <nl> - m + = mat3x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) <nl> - ) * bone_weights . y ; <nl> + tex_ofs = ivec2 ( bone_indicesi . y % 256 , ( bone_indicesi . y / 256 ) * 3 ) ; <nl> <nl> - tex_ofs = ivec2 ( bone_indicesi . z % 256 , ( bone_indicesi . z / 256 ) * 3 ) ; <nl> + m + = mat3x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) ) <nl> + * bone_weights . y ; <nl> <nl> - m + = mat3x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) <nl> - ) * bone_weights . z ; <nl> + tex_ofs = ivec2 ( bone_indicesi . z % 256 , ( bone_indicesi . z / 256 ) * 3 ) ; <nl> <nl> + m + = mat3x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) ) <nl> + * bone_weights . z ; <nl> <nl> - tex_ofs = ivec2 ( bone_indicesi . w % 256 , ( bone_indicesi . w / 256 ) * 3 ) ; <nl> + tex_ofs = ivec2 ( bone_indicesi . w % 256 , ( bone_indicesi . w / 256 ) * 3 ) ; <nl> <nl> - m + = mat3x4 ( <nl> - texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> - texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) <nl> - ) * bone_weights . w ; <nl> + m + = mat3x4 ( <nl> + texelFetch ( skeleton_texture , tex_ofs , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 1 ) , 0 ) , <nl> + texelFetch ( skeleton_texture , tex_ofs + ivec2 ( 0 , 2 ) , 0 ) ) <nl> + * bone_weights . w ; <nl> <nl> - mat4 bone_matrix = transpose ( mat4 ( m [ 0 ] , m [ 1 ] , m [ 2 ] , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ) ; <nl> + mat4 bone_matrix = transpose ( mat4 ( m [ 0 ] , m [ 1 ] , m [ 2 ] , vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 1 . 0 ) ) ) ; <nl> <nl> world_matrix = bone_matrix * world_matrix ; <nl> } <nl> VERTEX_SHADER_CODE <nl> <nl> } <nl> <nl> - <nl> - <nl> - / / using local coordinates ( default ) <nl> + / / using local coordinates ( default ) <nl> # if ! defined ( SKIP_TRANSFORM_USED ) & & ! defined ( VERTEX_WORLD_COORDS_USED ) <nl> <nl> vertex = modelview * vertex ; <nl> VERTEX_SHADER_CODE <nl> mat3 normal_matrix = mat3 ( transpose ( inverse ( modelview ) ) ) ; <nl> normal = normal_matrix * normal ; <nl> # else <nl> - normal = normalize ( ( modelview * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> + normal = normalize ( ( modelview * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> # endif <nl> <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> <nl> - tangent = normalize ( ( modelview * vec4 ( tangent , 0 . 0 ) ) . xyz ) ; <nl> - binormal = normalize ( ( modelview * vec4 ( binormal , 0 . 0 ) ) . xyz ) ; <nl> + tangent = normalize ( ( modelview * vec4 ( tangent , 0 . 0 ) ) . xyz ) ; <nl> + binormal = normalize ( ( modelview * vec4 ( binormal , 0 . 0 ) ) . xyz ) ; <nl> # endif <nl> # endif <nl> <nl> VERTEX_SHADER_CODE <nl> # if ! defined ( SKIP_TRANSFORM_USED ) & & defined ( VERTEX_WORLD_COORDS_USED ) <nl> <nl> vertex = camera_inverse_matrix * vertex ; <nl> - normal = normalize ( ( camera_inverse_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> + normal = normalize ( ( camera_inverse_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> <nl> - tangent = normalize ( ( camera_inverse_matrix * vec4 ( tangent , 0 . 0 ) ) . xyz ) ; <nl> - binormal = normalize ( ( camera_inverse_matrix * vec4 ( binormal , 0 . 0 ) ) . xyz ) ; <nl> + tangent = normalize ( ( camera_inverse_matrix * vec4 ( tangent , 0 . 0 ) ) . xyz ) ; <nl> + binormal = normalize ( ( camera_inverse_matrix * vec4 ( binormal , 0 . 0 ) ) . xyz ) ; <nl> # endif <nl> # endif <nl> <nl> vertex_interp = vertex . xyz ; <nl> normal_interp = normal ; <nl> <nl> - <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> tangent_interp = tangent ; <nl> binormal_interp = binormal ; <nl> # endif <nl> <nl> - <nl> # ifdef RENDER_DEPTH <nl> <nl> - <nl> # ifdef RENDER_DEPTH_DUAL_PARABOLOID <nl> <nl> - vertex_interp . z * = shadow_dual_paraboloid_render_side ; <nl> - normal_interp . z * = shadow_dual_paraboloid_render_side ; <nl> + vertex_interp . z * = shadow_dual_paraboloid_render_side ; <nl> + normal_interp . z * = shadow_dual_paraboloid_render_side ; <nl> <nl> - dp_clip = vertex_interp . z ; / / this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias <nl> + dp_clip = vertex_interp . z ; / / this attempts to avoid noise caused by objects sent to the other parabolloid side due to bias <nl> <nl> / / for dual paraboloid shadow mapping , this is the fastest but least correct way , as it curves straight edges <nl> <nl> - highp vec3 vtx = vertex_interp + normalize ( vertex_interp ) * z_offset ; <nl> + highp vec3 vtx = vertex_interp + normalize ( vertex_interp ) * z_offset ; <nl> highp float distance = length ( vtx ) ; <nl> vtx = normalize ( vtx ) ; <nl> - vtx . xy / = 1 . 0 - vtx . z ; <nl> - vtx . z = ( distance / shadow_dual_paraboloid_render_zfar ) ; <nl> - vtx . z = vtx . z * 2 . 0 - 1 . 0 ; <nl> + vtx . xy / = 1 . 0 - vtx . z ; <nl> + vtx . z = ( distance / shadow_dual_paraboloid_render_zfar ) ; <nl> + vtx . z = vtx . z * 2 . 0 - 1 . 0 ; <nl> <nl> vertex_interp = vtx ; <nl> <nl> - <nl> # else <nl> <nl> float z_ofs = z_offset ; <nl> - z_ofs + = ( 1 . 0 - abs ( normal_interp . z ) ) * z_slope_scale ; <nl> - vertex_interp . z - = z_ofs ; <nl> + z_ofs + = ( 1 . 0 - abs ( normal_interp . z ) ) * z_slope_scale ; <nl> + vertex_interp . z - = z_ofs ; <nl> <nl> # endif / / RENDER_DEPTH_DUAL_PARABOLOID <nl> <nl> # endif / / RENDER_DEPTH <nl> <nl> - gl_Position = projection_matrix * vec4 ( vertex_interp , 1 . 0 ) ; <nl> + gl_Position = projection_matrix * vec4 ( vertex_interp , 1 . 0 ) ; <nl> <nl> - position_interp = gl_Position ; <nl> + position_interp = gl_Position ; <nl> <nl> # ifdef USE_VERTEX_LIGHTING <nl> <nl> - diffuse_light_interp = vec4 ( 0 . 0 ) ; <nl> - specular_light_interp = vec4 ( 0 . 0 ) ; <nl> + diffuse_light_interp = vec4 ( 0 . 0 ) ; <nl> + specular_light_interp = vec4 ( 0 . 0 ) ; <nl> <nl> # ifdef USE_FORWARD_LIGHTING <nl> <nl> - for ( int i = 0 ; i < omni_light_count ; i + + ) { <nl> - light_process_omni ( omni_light_indices [ i ] , vertex_interp , - normalize ( vertex_interp ) , normal_interp , roughness , diffuse_light_interp . rgb , specular_light_interp . rgb ) ; <nl> + for ( int i = 0 ; i < omni_light_count ; i + + ) { <nl> + light_process_omni ( omni_light_indices [ i ] , vertex_interp , - normalize ( vertex_interp ) , normal_interp , roughness , diffuse_light_interp . rgb , specular_light_interp . rgb ) ; <nl> } <nl> <nl> - for ( int i = 0 ; i < spot_light_count ; i + + ) { <nl> - light_process_spot ( spot_light_indices [ i ] , vertex_interp , - normalize ( vertex_interp ) , normal_interp , roughness , diffuse_light_interp . rgb , specular_light_interp . rgb ) ; <nl> + for ( int i = 0 ; i < spot_light_count ; i + + ) { <nl> + light_process_spot ( spot_light_indices [ i ] , vertex_interp , - normalize ( vertex_interp ) , normal_interp , roughness , diffuse_light_interp . rgb , specular_light_interp . rgb ) ; <nl> } <nl> # endif <nl> <nl> VERTEX_SHADER_CODE <nl> <nl> vec3 directional_diffuse = vec3 ( 0 . 0 ) ; <nl> vec3 directional_specular = vec3 ( 0 . 0 ) ; <nl> - light_compute ( normal_interp , - light_direction_attenuation . xyz , - normalize ( vertex_interp ) , light_color_energy . rgb , roughness , directional_diffuse , directional_specular ) ; <nl> + light_compute ( normal_interp , - light_direction_attenuation . xyz , - normalize ( vertex_interp ) , light_color_energy . rgb , roughness , directional_diffuse , directional_specular ) ; <nl> <nl> - float diff_avg = dot ( diffuse_light_interp . rgb , vec3 ( 0 . 33333 ) ) ; <nl> - float diff_dir_avg = dot ( directional_diffuse , vec3 ( 0 . 33333 ) ) ; <nl> - if ( diff_avg > 0 . 0 ) { <nl> - diffuse_light_interp . a = diff_dir_avg / ( diff_avg + diff_dir_avg ) ; <nl> + float diff_avg = dot ( diffuse_light_interp . rgb , vec3 ( 0 . 33333 ) ) ; <nl> + float diff_dir_avg = dot ( directional_diffuse , vec3 ( 0 . 33333 ) ) ; <nl> + if ( diff_avg > 0 . 0 ) { <nl> + diffuse_light_interp . a = diff_dir_avg / ( diff_avg + diff_dir_avg ) ; <nl> } else { <nl> - diffuse_light_interp . a = 1 . 0 ; <nl> + diffuse_light_interp . a = 1 . 0 ; <nl> } <nl> <nl> - diffuse_light_interp . rgb + = directional_diffuse ; <nl> + diffuse_light_interp . rgb + = directional_diffuse ; <nl> <nl> - float spec_avg = dot ( specular_light_interp . rgb , vec3 ( 0 . 33333 ) ) ; <nl> - float spec_dir_avg = dot ( directional_specular , vec3 ( 0 . 33333 ) ) ; <nl> - if ( spec_avg > 0 . 0 ) { <nl> - specular_light_interp . a = spec_dir_avg / ( spec_avg + spec_dir_avg ) ; <nl> + float spec_avg = dot ( specular_light_interp . rgb , vec3 ( 0 . 33333 ) ) ; <nl> + float spec_dir_avg = dot ( directional_specular , vec3 ( 0 . 33333 ) ) ; <nl> + if ( spec_avg > 0 . 0 ) { <nl> + specular_light_interp . a = spec_dir_avg / ( spec_avg + spec_dir_avg ) ; <nl> } else { <nl> - specular_light_interp . a = 1 . 0 ; <nl> + specular_light_interp . a = 1 . 0 ; <nl> } <nl> <nl> - specular_light_interp . rgb + = directional_specular ; <nl> + specular_light_interp . rgb + = directional_specular ; <nl> <nl> # endif / / USE_LIGHT_DIRECTIONAL <nl> <nl> - <nl> # endif / / USE_VERTEX_LIGHTING <nl> - <nl> } <nl> <nl> - <nl> [ fragment ] <nl> <nl> / * texture unit usage , N is max_texture_unity - N <nl> in vec3 binormal_interp ; <nl> in highp vec3 vertex_interp ; <nl> in vec3 normal_interp ; <nl> <nl> - <nl> / * PBR CHANNELS * / <nl> <nl> # ifdef USE_RADIANCE_MAP <nl> <nl> - <nl> - <nl> - layout ( std140 ) uniform Radiance { / / ubo : 2 <nl> + layout ( std140 ) uniform Radiance { / / ubo : 2 <nl> <nl> mat4 radiance_inverse_xform ; <nl> float radiance_ambient_contribution ; <nl> layout ( std140 ) uniform Radiance { / / ubo : 2 <nl> <nl> # ifdef USE_RADIANCE_MAP_ARRAY <nl> <nl> - uniform sampler2DArray radiance_map ; / / texunit : - 2 <nl> + uniform sampler2DArray radiance_map ; / / texunit : - 2 <nl> <nl> - vec3 textureDualParaboloid ( sampler2DArray p_tex , vec3 p_vec , float p_roughness ) { <nl> + vec3 textureDualParaboloid ( sampler2DArray p_tex , vec3 p_vec , float p_roughness ) { <nl> <nl> vec3 norm = normalize ( p_vec ) ; <nl> - norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> - norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> + norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> + norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> <nl> / / we need to lie the derivatives ( normg ) and assume that DP side is always the same <nl> / / to get proper texture filtering <nl> - vec2 normg = norm . xy ; <nl> - if ( norm . z > 0 . 0 ) { <nl> - norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> + vec2 normg = norm . xy ; <nl> + if ( norm . z > 0 . 0 ) { <nl> + norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> } <nl> <nl> / / thanks to OpenGL spec using floor ( layer + 0 . 5 ) for texture arrays , <nl> vec3 textureDualParaboloid ( sampler2DArray p_tex , vec3 p_vec , float p_roughness ) { <nl> <nl> float index = p_roughness * RADIANCE_MAX_LOD ; <nl> int indexi = int ( index * 256 . 0 ) ; <nl> - vec3 base = textureGrad ( p_tex , vec3 ( norm . xy , float ( indexi / 256 ) ) , dFdx ( normg ) , dFdy ( normg ) ) . xyz ; <nl> - vec3 next = textureGrad ( p_tex , vec3 ( norm . xy , float ( indexi / 256 + 1 ) ) , dFdx ( normg ) , dFdy ( normg ) ) . xyz ; <nl> - return mix ( base , next , float ( indexi % 256 ) / 256 . 0 ) ; <nl> + vec3 base = textureGrad ( p_tex , vec3 ( norm . xy , float ( indexi / 256 ) ) , dFdx ( normg ) , dFdy ( normg ) ) . xyz ; <nl> + vec3 next = textureGrad ( p_tex , vec3 ( norm . xy , float ( indexi / 256 + 1 ) ) , dFdx ( normg ) , dFdy ( normg ) ) . xyz ; <nl> + return mix ( base , next , float ( indexi % 256 ) / 256 . 0 ) ; <nl> } <nl> <nl> # else <nl> <nl> - uniform sampler2D radiance_map ; / / texunit : - 2 <nl> + uniform sampler2D radiance_map ; / / texunit : - 2 <nl> <nl> - vec3 textureDualParaboloid ( sampler2D p_tex , vec3 p_vec , float p_roughness ) { <nl> + vec3 textureDualParaboloid ( sampler2D p_tex , vec3 p_vec , float p_roughness ) { <nl> <nl> vec3 norm = normalize ( p_vec ) ; <nl> - norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> - norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> - if ( norm . z > 0 . 0 ) { <nl> - norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> + norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> + norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> + if ( norm . z > 0 . 0 ) { <nl> + norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> } <nl> return textureLod ( p_tex , norm . xy , p_roughness * RADIANCE_MAX_LOD ) . xyz ; <nl> } <nl> vec3 textureDualParaboloid ( sampler2D p_tex , vec3 p_vec , float p_roughness ) { <nl> <nl> / * Material Uniforms * / <nl> <nl> - <nl> - <nl> # if defined ( USE_MATERIAL ) <nl> <nl> layout ( std140 ) uniform UniformData { <nl> layout ( std140 ) uniform DirectionalLightData { <nl> highp vec4 light_pos_inv_radius ; <nl> mediump vec4 light_direction_attenuation ; <nl> mediump vec4 light_color_energy ; <nl> - mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> + mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> mediump vec4 light_clamp ; <nl> mediump vec4 shadow_color_contact ; <nl> highp mat4 shadow_matrix1 ; <nl> layout ( std140 ) uniform DirectionalLightData { <nl> mediump vec4 shadow_split_offsets ; <nl> } ; <nl> <nl> - <nl> - uniform highp sampler2DShadow directional_shadow ; / / texunit : - 4 <nl> + uniform highp sampler2DShadow directional_shadow ; / / texunit : - 4 <nl> <nl> # endif <nl> <nl> uniform highp sampler2DShadow directional_shadow ; / / texunit : - 4 <nl> in vec4 diffuse_light_interp ; <nl> in vec4 specular_light_interp ; <nl> # endif <nl> - / / omni and spot <nl> + / / omni and spot <nl> <nl> struct LightData { <nl> <nl> highp vec4 light_pos_inv_radius ; <nl> mediump vec4 light_direction_attenuation ; <nl> mediump vec4 light_color_energy ; <nl> - mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> + mediump vec4 light_params ; / / cone attenuation , angle , specular , shadow enabled , <nl> mediump vec4 light_clamp ; <nl> mediump vec4 shadow_color_contact ; <nl> highp mat4 shadow_matrix ; <nl> <nl> } ; <nl> <nl> - <nl> - layout ( std140 ) uniform OmniLightData { / / ubo : 4 <nl> + layout ( std140 ) uniform OmniLightData { / / ubo : 4 <nl> <nl> LightData omni_lights [ MAX_LIGHT_DATA_STRUCTS ] ; <nl> } ; <nl> <nl> - layout ( std140 ) uniform SpotLightData { / / ubo : 5 <nl> + layout ( std140 ) uniform SpotLightData { / / ubo : 5 <nl> <nl> LightData spot_lights [ MAX_LIGHT_DATA_STRUCTS ] ; <nl> } ; <nl> <nl> - <nl> - uniform highp sampler2DShadow shadow_atlas ; / / texunit : - 5 <nl> - <nl> + uniform highp sampler2DShadow shadow_atlas ; / / texunit : - 5 <nl> <nl> struct ReflectionData { <nl> <nl> mediump vec4 box_extents ; <nl> mediump vec4 box_offset ; <nl> mediump vec4 params ; / / intensity , 0 , interior , boxproject <nl> - mediump vec4 ambient ; / / ambient color , energy <nl> + mediump vec4 ambient ; / / ambient color , energy <nl> mediump vec4 atlas_clamp ; <nl> - highp mat4 local_matrix ; / / up to here for spot and omni , rest is for directional <nl> - / / notes : for ambientblend , use distance to edge to blend between already existing global environment <nl> + highp mat4 local_matrix ; / / up to here for spot and omni , rest is for directional <nl> + / / notes : for ambientblend , use distance to edge to blend between already existing global environment <nl> } ; <nl> <nl> layout ( std140 ) uniform ReflectionProbeData { / / ubo : 6 <nl> <nl> ReflectionData reflections [ MAX_REFLECTION_DATA_STRUCTS ] ; <nl> } ; <nl> - uniform mediump sampler2D reflection_atlas ; / / texunit : - 3 <nl> - <nl> + uniform mediump sampler2D reflection_atlas ; / / texunit : - 3 <nl> <nl> # ifdef USE_FORWARD_LIGHTING <nl> <nl> uniform int reflection_count ; <nl> <nl> # endif <nl> <nl> - <nl> # if defined ( SCREEN_TEXTURE_USED ) <nl> <nl> - uniform highp sampler2D screen_texture ; / / texunit : - 7 <nl> + uniform highp sampler2D screen_texture ; / / texunit : - 7 <nl> <nl> # endif <nl> <nl> # ifdef USE_MULTIPLE_RENDER_TARGETS <nl> <nl> - layout ( location = 0 ) out vec4 diffuse_buffer ; <nl> - layout ( location = 1 ) out vec4 specular_buffer ; <nl> - layout ( location = 2 ) out vec4 normal_mr_buffer ; <nl> + layout ( location = 0 ) out vec4 diffuse_buffer ; <nl> + layout ( location = 1 ) out vec4 specular_buffer ; <nl> + layout ( location = 2 ) out vec4 normal_mr_buffer ; <nl> # if defined ( ENABLE_SSS ) <nl> - layout ( location = 3 ) out float sss_buffer ; <nl> + layout ( location = 3 ) out float sss_buffer ; <nl> # endif <nl> <nl> # else <nl> <nl> - layout ( location = 0 ) out vec4 frag_color ; <nl> + layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> # endif <nl> <nl> in highp vec4 position_interp ; <nl> - uniform highp sampler2D depth_buffer ; / / texunit : - 8 <nl> + uniform highp sampler2D depth_buffer ; / / texunit : - 8 <nl> <nl> # ifdef USE_CONTACT_SHADOWS <nl> <nl> float contact_shadow_compute ( vec3 pos , vec3 dir , float max_distance ) { <nl> <nl> - if ( abs ( dir . z ) > 0 . 99 ) <nl> + if ( abs ( dir . z ) > 0 . 99 ) <nl> return 1 . 0 ; <nl> <nl> - vec3 endpoint = pos + dir * max_distance ; <nl> + vec3 endpoint = pos + dir * max_distance ; <nl> vec4 source = position_interp ; <nl> vec4 dest = projection_matrix * vec4 ( endpoint , 1 . 0 ) ; <nl> <nl> float contact_shadow_compute ( vec3 pos , vec3 dir , float max_distance ) { <nl> <nl> vec2 screen_rel = to_screen - from_screen ; <nl> <nl> - if ( length ( screen_rel ) < 0 . 00001 ) <nl> - return 1 . 0 ; / / too small , don ' t do anything <nl> + if ( length ( screen_rel ) < 0 . 00001 ) <nl> + return 1 . 0 ; / / too small , don ' t do anything <nl> <nl> - / * float pixel_size ; / / approximate pixel size <nl> + / * <nl> + float pixel_size ; / / approximate pixel size <nl> <nl> if ( screen_rel . x > screen_rel . y ) { <nl> <nl> - pixel_size = abs ( ( pos . x - endpoint . x ) / ( screen_rel . x / screen_pixel_size . x ) ) ; <nl> + pixel_size = abs ( ( pos . x - endpoint . x ) / ( screen_rel . x / screen_pixel_size . x ) ) ; <nl> } else { <nl> - pixel_size = abs ( ( pos . y - endpoint . y ) / ( screen_rel . y / screen_pixel_size . y ) ) ; <nl> - <nl> - } * / <nl> - vec4 bias = projection_matrix * vec4 ( pos + vec3 ( 0 . 0 , 0 . 0 , max_distance * 0 . 5 ) , 1 . 0 ) ; / / todo un - harcode the 0 . 04 <nl> - <nl> - <nl> - <nl> - vec2 pixel_incr = normalize ( screen_rel ) * screen_pixel_size ; <nl> + pixel_size = abs ( ( pos . y - endpoint . y ) / ( screen_rel . y / screen_pixel_size . y ) ) ; <nl> + } <nl> + * / <nl> + vec4 bias = projection_matrix * vec4 ( pos + vec3 ( 0 . 0 , 0 . 0 , max_distance * 0 . 5 ) , 1 . 0 ) ; <nl> <nl> + vec2 pixel_incr = normalize ( screen_rel ) * screen_pixel_size ; <nl> <nl> float steps = length ( screen_rel ) / length ( pixel_incr ) ; <nl> - steps = min ( 2000 . 0 , steps ) ; / / put a limit to avoid freezing in some strange situation <nl> - / / steps = 10 . 0 ; <nl> + steps = min ( 2000 . 0 , steps ) ; / / put a limit to avoid freezing in some strange situation <nl> + / / steps = 10 . 0 ; <nl> <nl> - vec4 incr = ( dest - source ) / steps ; <nl> - float ratio = 0 . 0 ; <nl> - float ratio_incr = 1 . 0 / steps ; <nl> + vec4 incr = ( dest - source ) / steps ; <nl> + float ratio = 0 . 0 ; <nl> + float ratio_incr = 1 . 0 / steps ; <nl> <nl> - while ( steps > 0 . 0 ) { <nl> - source + = incr * 2 . 0 ; <nl> - bias + = incr * 2 . 0 ; <nl> + while ( steps > 0 . 0 ) { <nl> + source + = incr * 2 . 0 ; <nl> + bias + = incr * 2 . 0 ; <nl> <nl> vec3 uv_depth = ( source . xyz / source . w ) * 0 . 5 + 0 . 5 ; <nl> - float depth = texture ( depth_buffer , uv_depth . xy ) . r ; <nl> + float depth = texture ( depth_buffer , uv_depth . xy ) . r ; <nl> <nl> if ( depth < uv_depth . z ) { <nl> - if ( depth > ( bias . z / bias . w ) * 0 . 5 + 0 . 5 ) { <nl> - return min ( pow ( ratio , 4 . 0 ) , 1 . 0 ) ; <nl> + if ( depth > ( bias . z / bias . w ) * 0 . 5 + 0 . 5 ) { <nl> + return min ( pow ( ratio , 4 . 0 ) , 1 . 0 ) ; <nl> } else { <nl> return 1 . 0 ; <nl> } <nl> } <nl> <nl> - <nl> - ratio + = ratio_incr ; <nl> - steps - = 1 . 0 ; <nl> + ratio + = ratio_incr ; <nl> + steps - = 1 . 0 ; <nl> } <nl> <nl> return 1 . 0 ; <nl> float contact_shadow_compute ( vec3 pos , vec3 dir , float max_distance ) { <nl> <nl> # endif <nl> <nl> - <nl> / / This returns the G_GGX function divided by 2 cos_theta_m , where in practice cos_theta_m is either N . L or N . V . <nl> / / We ' re dividing this factor off because the overall term we ' ll end up looks like <nl> / / ( see , for example , the first unnumbered equation in B . Burley , " Physically Based Shading at Disney " , SIGGRAPH 2012 ) : <nl> float G_GGX_2cos ( float cos_theta_m , float alpha ) { <nl> / / C . Schlick , " An Inexpensive BRDF Model for Physically - based Rendering " , Computer Graphics Forum . 13 ( 3 ) : 233 ( 1994 ) <nl> / / Eq . ( 19 ) , although see Heitz ( 2014 ) the about the problems with his derivation . <nl> / / It nevertheless approximates GGX well with k = alpha / 2 . <nl> - float k = 0 . 5 * alpha ; <nl> + float k = 0 . 5 * alpha ; <nl> return 0 . 5 / ( cos_theta_m * ( 1 . 0 - k ) + k ) ; <nl> <nl> - / / float cos2 = cos_theta_m * cos_theta_m ; <nl> - / / float sin2 = ( 1 . 0 - cos2 ) ; <nl> - / / return 1 . 0 / ( cos_theta_m + sqrt ( cos2 + alpha * alpha * sin2 ) ) ; <nl> + / / float cos2 = cos_theta_m * cos_theta_m ; <nl> + / / float sin2 = ( 1 . 0 - cos2 ) ; <nl> + / / return 1 . 0 / ( cos_theta_m + sqrt ( cos2 + alpha * alpha * sin2 ) ) ; <nl> } <nl> <nl> float D_GGX ( float cos_theta_m , float alpha ) { <nl> - float alpha2 = alpha * alpha ; <nl> - float d = 1 . 0 + ( alpha2 - 1 . 0 ) * cos_theta_m * cos_theta_m ; <nl> - return alpha2 / ( M_PI * d * d ) ; <nl> + float alpha2 = alpha * alpha ; <nl> + float d = 1 . 0 + ( alpha2 - 1 . 0 ) * cos_theta_m * cos_theta_m ; <nl> + return alpha2 / ( M_PI * d * d ) ; <nl> } <nl> <nl> float G_GGX_anisotropic_2cos ( float cos_theta_m , float alpha_x , float alpha_y , float cos_phi , float sin_phi ) { <nl> float cos2 = cos_theta_m * cos_theta_m ; <nl> - float sin2 = ( 1 . 0 - cos2 ) ; <nl> + float sin2 = ( 1 . 0 - cos2 ) ; <nl> float s_x = alpha_x * cos_phi ; <nl> float s_y = alpha_y * sin_phi ; <nl> - return 1 . 0 / max ( cos_theta_m + sqrt ( cos2 + ( s_x * s_x + s_y * s_y ) * sin2 ) , 0 . 001 ) ; <nl> + return 1 . 0 / max ( cos_theta_m + sqrt ( cos2 + ( s_x * s_x + s_y * s_y ) * sin2 ) , 0 . 001 ) ; <nl> } <nl> <nl> float D_GGX_anisotropic ( float cos_theta_m , float alpha_x , float alpha_y , float cos_phi , float sin_phi ) { <nl> float cos2 = cos_theta_m * cos_theta_m ; <nl> - float sin2 = ( 1 . 0 - cos2 ) ; <nl> - float r_x = cos_phi / alpha_x ; <nl> - float r_y = sin_phi / alpha_y ; <nl> - float d = cos2 + sin2 * ( r_x * r_x + r_y * r_y ) ; <nl> + float sin2 = ( 1 . 0 - cos2 ) ; <nl> + float r_x = cos_phi / alpha_x ; <nl> + float r_y = sin_phi / alpha_y ; <nl> + float d = cos2 + sin2 * ( r_x * r_x + r_y * r_y ) ; <nl> return 1 . 0 / max ( M_PI * alpha_x * alpha_y * d * d , 0 . 001 ) ; <nl> } <nl> <nl> - <nl> - float SchlickFresnel ( float u ) <nl> - { <nl> - float m = 1 . 0 - u ; <nl> - float m2 = m * m ; <nl> - return m2 * m2 * m ; / / pow ( m , 5 ) <nl> + float SchlickFresnel ( float u ) { <nl> + float m = 1 . 0 - u ; <nl> + float m2 = m * m ; <nl> + return m2 * m2 * m ; / / pow ( m , 5 ) <nl> } <nl> <nl> - float GTR1 ( float NdotH , float a ) <nl> - { <nl> - if ( a > = 1 . 0 ) return 1 . 0 / M_PI ; <nl> - float a2 = a * a ; <nl> - float t = 1 . 0 + ( a2 - 1 . 0 ) * NdotH * NdotH ; <nl> - return ( a2 - 1 . 0 ) / ( M_PI * log ( a2 ) * t ) ; <nl> + float GTR1 ( float NdotH , float a ) { <nl> + if ( a > = 1 . 0 ) return 1 . 0 / M_PI ; <nl> + float a2 = a * a ; <nl> + float t = 1 . 0 + ( a2 - 1 . 0 ) * NdotH * NdotH ; <nl> + return ( a2 - 1 . 0 ) / ( M_PI * log ( a2 ) * t ) ; <nl> } <nl> <nl> vec3 metallic_to_specular_color ( float metallic , float specular , vec3 albedo ) { <nl> vec3 metallic_to_specular_color ( float metallic , float specular , vec3 albedo ) { <nl> void light_compute ( vec3 N , vec3 L , vec3 V , vec3 B , vec3 T , vec3 light_color , vec3 attenuation , vec3 diffuse_color , vec3 transmission , float specular_blob_intensity , float roughness , float metallic , float rim , float rim_tint , float clearcoat , float clearcoat_gloss , float anisotropy , inout vec3 diffuse_light , inout vec3 specular_light ) { <nl> <nl> # if defined ( USE_LIGHT_SHADER_CODE ) <nl> - / / light is written by the light shader <nl> + / / light is written by the light shader <nl> <nl> vec3 normal = N ; <nl> vec3 albedo = diffuse_color ; <nl> void light_compute ( vec3 N , vec3 L , vec3 V , vec3 B , vec3 T , vec3 light_color , vec <nl> <nl> LIGHT_SHADER_CODE <nl> <nl> - <nl> # else <nl> - float NdotL = dot ( N , L ) ; <nl> + float NdotL = dot ( N , L ) ; <nl> float cNdotL = max ( NdotL , 0 . 0 ) ; / / clamped NdotL <nl> float NdotV = dot ( N , V ) ; <nl> float cNdotV = max ( NdotV , 0 . 0 ) ; <nl> LIGHT_SHADER_CODE <nl> float diffuse_brdf_NL ; / / BRDF times N . L for calculating diffuse radiance <nl> # endif <nl> <nl> - <nl> # if defined ( DIFFUSE_LAMBERT_WRAP ) <nl> - / / energy conserving lambert wrap shader <nl> - diffuse_brdf_NL = max ( 0 . 0 , ( NdotL + roughness ) / ( ( 1 . 0 + roughness ) * ( 1 . 0 + roughness ) ) ) ; <nl> + / / energy conserving lambert wrap shader <nl> + diffuse_brdf_NL = max ( 0 . 0 , ( NdotL + roughness ) / ( ( 1 . 0 + roughness ) * ( 1 . 0 + roughness ) ) ) ; <nl> <nl> # elif defined ( DIFFUSE_OREN_NAYAR ) <nl> <nl> LIGHT_SHADER_CODE <nl> / / see http : / / mimosa - pudica . net / improved - oren - nayar . html <nl> float LdotV = dot ( L , V ) ; <nl> <nl> - <nl> float s = LdotV - NdotL * NdotV ; <nl> float t = mix ( 1 . 0 , max ( NdotL , NdotV ) , step ( 0 . 0 , s ) ) ; <nl> <nl> float sigma2 = roughness * roughness ; / / TODO : this needs checking <nl> - vec3 A = 1 . 0 + sigma2 * ( - 0 . 5 / ( sigma2 + 0 . 33 ) + 0 . 17 * diffuse_color / ( sigma2 + 0 . 13 ) ) ; <nl> + vec3 A = 1 . 0 + sigma2 * ( - 0 . 5 / ( sigma2 + 0 . 33 ) + 0 . 17 * diffuse_color / ( sigma2 + 0 . 13 ) ) ; <nl> float B = 0 . 45 * sigma2 / ( sigma2 + 0 . 09 ) ; <nl> <nl> diffuse_brdf_NL = cNdotL * ( A + vec3 ( B ) * s / t ) * ( 1 . 0 / M_PI ) ; <nl> LIGHT_SHADER_CODE <nl> <nl> # elif defined ( DIFFUSE_TOON ) <nl> <nl> - diffuse_brdf_NL = smoothstep ( - roughness , max ( roughness , 0 . 01 ) , NdotL ) ; <nl> + diffuse_brdf_NL = smoothstep ( - roughness , max ( roughness , 0 . 01 ) , NdotL ) ; <nl> <nl> # elif defined ( DIFFUSE_BURLEY ) <nl> <nl> { <nl> <nl> - <nl> vec3 H = normalize ( V + L ) ; <nl> - float cLdotH = max ( 0 . 0 , dot ( L , H ) ) ; <nl> + float cLdotH = max ( 0 . 0 , dot ( L , H ) ) ; <nl> <nl> float FD90 = 0 . 5 + 2 . 0 * cLdotH * cLdotH * roughness ; <nl> float FdV = 1 . 0 + ( FD90 - 1 . 0 ) * SchlickFresnel ( cNdotV ) ; <nl> float FdL = 1 . 0 + ( FD90 - 1 . 0 ) * SchlickFresnel ( cNdotL ) ; <nl> diffuse_brdf_NL = ( 1 . 0 / M_PI ) * FdV * FdL * cNdotL ; <nl> - / * <nl> + / * <nl> float energyBias = mix ( roughness , 0 . 0 , 0 . 5 ) ; <nl> float energyFactor = mix ( roughness , 1 . 0 , 1 . 0 / 1 . 51 ) ; <nl> float fd90 = energyBias + 2 . 0 * VoH * VoH * roughness ; <nl> LIGHT_SHADER_CODE <nl> float lightScatter = f0 + ( fd90 - f0 ) * pow ( 1 . 0 - cNdotL , 5 . 0 ) ; <nl> float viewScatter = f0 + ( fd90 - f0 ) * pow ( 1 . 0 - cNdotV , 5 . 0 ) ; <nl> <nl> - diffuse_brdf_NL = lightScatter * viewScatter * energyFactor ; * / <nl> + diffuse_brdf_NL = lightScatter * viewScatter * energyFactor ; <nl> + * / <nl> } <nl> # else <nl> - / / lambert <nl> + / / lambert <nl> diffuse_brdf_NL = cNdotL * ( 1 . 0 / M_PI ) ; <nl> # endif <nl> <nl> LIGHT_SHADER_CODE <nl> diffuse_light + = light_color * diffuse_color * ( vec3 ( 1 . 0 / M_PI ) - diffuse_brdf_NL ) * transmission * attenuation ; <nl> # endif <nl> <nl> - <nl> # if defined ( LIGHT_USE_RIM ) <nl> - float rim_light = pow ( max ( 0 . 0 , 1 . 0 - cNdotV ) , max ( 0 . 0 , ( 1 . 0 - roughness ) * 16 . 0 ) ) ; <nl> - diffuse_light + = rim_light * rim * mix ( vec3 ( 1 . 0 ) , diffuse_color , rim_tint ) * light_color ; <nl> + float rim_light = pow ( max ( 0 . 0 , 1 . 0 - cNdotV ) , max ( 0 . 0 , ( 1 . 0 - roughness ) * 16 . 0 ) ) ; <nl> + diffuse_light + = rim_light * rim * mix ( vec3 ( 1 . 0 ) , diffuse_color , rim_tint ) * light_color ; <nl> # endif <nl> } <nl> <nl> - <nl> if ( roughness > 0 . 0 ) { / / FIXME : roughness = = 0 should not disable specular light entirely <nl> <nl> - <nl> / / D <nl> <nl> # if defined ( SPECULAR_BLINN ) <nl> <nl> vec3 H = normalize ( V + L ) ; <nl> - float cNdotH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> - float intensity = pow ( cNdotH , ( 1 . 0 - roughness ) * 256 . 0 ) ; <nl> + float cNdotH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> + float intensity = pow ( cNdotH , ( 1 . 0 - roughness ) * 256 . 0 ) ; <nl> specular_light + = light_color * intensity * specular_blob_intensity * attenuation ; <nl> <nl> # elif defined ( SPECULAR_PHONG ) <nl> <nl> - vec3 R = normalize ( - reflect ( L , N ) ) ; <nl> - float cRdotV = max ( 0 . 0 , dot ( R , V ) ) ; <nl> - float intensity = pow ( cRdotV , ( 1 . 0 - roughness ) * 256 . 0 ) ; <nl> - specular_light + = light_color * intensity * specular_blob_intensity * attenuation ; <nl> + vec3 R = normalize ( - reflect ( L , N ) ) ; <nl> + float cRdotV = max ( 0 . 0 , dot ( R , V ) ) ; <nl> + float intensity = pow ( cRdotV , ( 1 . 0 - roughness ) * 256 . 0 ) ; <nl> + specular_light + = light_color * intensity * specular_blob_intensity * attenuation ; <nl> <nl> # elif defined ( SPECULAR_TOON ) <nl> <nl> - vec3 R = normalize ( - reflect ( L , N ) ) ; <nl> - float RdotV = dot ( R , V ) ; <nl> - float mid = 1 . 0 - roughness ; <nl> - mid * = mid ; <nl> - float intensity = smoothstep ( mid - roughness * 0 . 5 , mid + roughness * 0 . 5 , RdotV ) * mid ; <nl> + vec3 R = normalize ( - reflect ( L , N ) ) ; <nl> + float RdotV = dot ( R , V ) ; <nl> + float mid = 1 . 0 - roughness ; <nl> + mid * = mid ; <nl> + float intensity = smoothstep ( mid - roughness * 0 . 5 , mid + roughness * 0 . 5 , RdotV ) * mid ; <nl> diffuse_light + = light_color * intensity * specular_blob_intensity * attenuation ; / / write to diffuse_light , as in toon shading you generally want no reflection <nl> <nl> # elif defined ( SPECULAR_DISABLED ) <nl> - / / none . . <nl> + / / none . . <nl> <nl> # elif defined ( SPECULAR_SCHLICK_GGX ) <nl> / / shlick + ggx as default <nl> <nl> vec3 H = normalize ( V + L ) ; <nl> <nl> - float cNdotH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> - float cLdotH = max ( dot ( L , H ) , 0 . 0 ) ; <nl> + float cNdotH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> + float cLdotH = max ( dot ( L , H ) , 0 . 0 ) ; <nl> <nl> - # if defined ( LIGHT_USE_ANISOTROPY ) <nl> + # if defined ( LIGHT_USE_ANISOTROPY ) <nl> <nl> - float aspect = sqrt ( 1 . 0 - anisotropy * 0 . 9 ) ; <nl> - float rx = roughness / aspect ; <nl> - float ry = roughness * aspect ; <nl> - float ax = rx * rx ; <nl> - float ay = ry * ry ; <nl> - float XdotH = dot ( T , H ) ; <nl> - float YdotH = dot ( B , H ) ; <nl> + float aspect = sqrt ( 1 . 0 - anisotropy * 0 . 9 ) ; <nl> + float rx = roughness / aspect ; <nl> + float ry = roughness * aspect ; <nl> + float ax = rx * rx ; <nl> + float ay = ry * ry ; <nl> + float XdotH = dot ( T , H ) ; <nl> + float YdotH = dot ( B , H ) ; <nl> float D = D_GGX_anisotropic ( cNdotH , ax , ay , XdotH , YdotH ) ; <nl> float G = G_GGX_anisotropic_2cos ( cNdotL , ax , ay , XdotH , YdotH ) * G_GGX_anisotropic_2cos ( cNdotV , ax , ay , XdotH , YdotH ) ; <nl> <nl> - # else <nl> + # else <nl> float alpha = roughness * roughness ; <nl> float D = D_GGX ( cNdotH , alpha ) ; <nl> float G = G_GGX_2cos ( cNdotL , alpha ) * G_GGX_2cos ( cNdotV , alpha ) ; <nl> - # endif <nl> + # endif <nl> / / F <nl> float F0 = 1 . 0 ; / / FIXME <nl> float cLdotH5 = SchlickFresnel ( cLdotH ) ; <nl> LIGHT_SHADER_CODE <nl> <nl> # if defined ( LIGHT_USE_CLEARCOAT ) <nl> if ( clearcoat_gloss > 0 . 0 ) { <nl> - # if ! defined ( SPECULAR_SCHLICK_GGX ) & & ! defined ( SPECULAR_BLINN ) <nl> + # if ! defined ( SPECULAR_SCHLICK_GGX ) & & ! defined ( SPECULAR_BLINN ) <nl> vec3 H = normalize ( V + L ) ; <nl> - # endif <nl> - # if ! defined ( SPECULAR_SCHLICK_GGX ) <nl> - float cNdotH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> - float cLdotH = max ( dot ( L , H ) , 0 . 0 ) ; <nl> + # endif <nl> + # if ! defined ( SPECULAR_SCHLICK_GGX ) <nl> + float cNdotH = max ( dot ( N , H ) , 0 . 0 ) ; <nl> + float cLdotH = max ( dot ( L , H ) , 0 . 0 ) ; <nl> float cLdotH5 = SchlickFresnel ( cLdotH ) ; <nl> # endif <nl> float Dr = GTR1 ( cNdotH , mix ( . 1 , . 001 , clearcoat_gloss ) ) ; <nl> float Fr = mix ( . 04 , 1 . 0 , cLdotH5 ) ; <nl> float Gr = G_GGX_2cos ( cNdotL , . 25 ) * G_GGX_2cos ( cNdotV , . 25 ) ; <nl> <nl> - <nl> float specular_brdf_NL = 0 . 25 * clearcoat * Gr * Fr * Dr * cNdotL ; <nl> <nl> specular_light + = specular_brdf_NL * light_color * specular_blob_intensity * attenuation ; <nl> LIGHT_SHADER_CODE <nl> # endif <nl> } <nl> <nl> - <nl> # endif / / defined ( USE_LIGHT_SHADER_CODE ) <nl> } <nl> <nl> - <nl> float sample_shadow ( highp sampler2DShadow shadow , vec2 shadow_pixel_size , vec2 pos , float depth , vec4 clamp_rect ) { <nl> <nl> # ifdef SHADOW_MODE_PCF_13 <nl> <nl> - float avg = textureProj ( shadow , vec4 ( pos , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x * 2 . 0 , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x * 2 . 0 , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , shadow_pixel_size . y * 2 . 0 ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , - shadow_pixel_size . y * 2 . 0 ) , depth , 1 . 0 ) ) ; <nl> - return avg * ( 1 . 0 / 13 . 0 ) ; <nl> + float avg = textureProj ( shadow , vec4 ( pos , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x * 2 . 0 , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x * 2 . 0 , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , shadow_pixel_size . y * 2 . 0 ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , - shadow_pixel_size . y * 2 . 0 ) , depth , 1 . 0 ) ) ; <nl> + return avg * ( 1 . 0 / 13 . 0 ) ; <nl> <nl> # elif defined ( SHADOW_MODE_PCF_5 ) <nl> <nl> - float avg = textureProj ( shadow , vec4 ( pos , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> - return avg * ( 1 . 0 / 5 . 0 ) ; <nl> + float avg = textureProj ( shadow , vec4 ( pos , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( - shadow_pixel_size . x , 0 . 0 ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + avg + = textureProj ( shadow , vec4 ( pos + vec2 ( 0 . 0 , - shadow_pixel_size . y ) , depth , 1 . 0 ) ) ; <nl> + return avg * ( 1 . 0 / 5 . 0 ) ; <nl> <nl> # else <nl> <nl> - return textureProj ( shadow , vec4 ( pos , depth , 1 . 0 ) ) ; <nl> + return textureProj ( shadow , vec4 ( pos , depth , 1 . 0 ) ) ; <nl> <nl> # endif <nl> - <nl> } <nl> <nl> # ifdef RENDER_DEPTH_DUAL_PARABOLOID <nl> in highp float dp_clip ; <nl> <nl> # endif <nl> <nl> - <nl> - <nl> # if 0 <nl> - / / need to save texture depth for this <nl> - <nl> + / / need to save texture depth for this <nl> vec3 light_transmittance ( float translucency , vec3 light_vec , vec3 normal , vec3 pos , float distance ) { <nl> <nl> float scale = 8 . 25 * ( 1 . 0 - translucency ) / subsurface_scatter_width ; <nl> float d = scale * distance ; <nl> <nl> - / * * <nl> - * Armed with the thickness , we can now calculate the color by means of the <nl> - * precalculated transmittance profile . <nl> - * ( It can be precomputed into a texture , for maximum performance ) : <nl> - * / <nl> + / * * <nl> + * Armed with the thickness , we can now calculate the color by means of the <nl> + * precalculated transmittance profile . <nl> + * ( It can be precomputed into a texture , for maximum performance ) : <nl> + * / <nl> float dd = - d * d ; <nl> - vec3 profile = vec3 ( 0 . 233 , 0 . 455 , 0 . 649 ) * exp ( dd / 0 . 0064 ) + <nl> - vec3 ( 0 . 1 , 0 . 336 , 0 . 344 ) * exp ( dd / 0 . 0484 ) + <nl> - vec3 ( 0 . 118 , 0 . 198 , 0 . 0 ) * exp ( dd / 0 . 187 ) + <nl> - vec3 ( 0 . 113 , 0 . 007 , 0 . 007 ) * exp ( dd / 0 . 567 ) + <nl> - vec3 ( 0 . 358 , 0 . 004 , 0 . 0 ) * exp ( dd / 1 . 99 ) + <nl> - vec3 ( 0 . 078 , 0 . 0 , 0 . 0 ) * exp ( dd / 7 . 41 ) ; <nl> - <nl> - / * * <nl> - * Using the profile , we finally approximate the transmitted lighting from <nl> - * the back of the object : <nl> - * / <nl> - return profile * clamp ( 0 . 3 + dot ( light_vec , normal ) , 0 . 0 , 1 . 0 ) ; <nl> + vec3 profile = <nl> + vec3 ( 0 . 233 , 0 . 455 , 0 . 649 ) * exp ( dd / 0 . 0064 ) + <nl> + vec3 ( 0 . 1 , 0 . 336 , 0 . 344 ) * exp ( dd / 0 . 0484 ) + <nl> + vec3 ( 0 . 118 , 0 . 198 , 0 . 0 ) * exp ( dd / 0 . 187 ) + <nl> + vec3 ( 0 . 113 , 0 . 007 , 0 . 007 ) * exp ( dd / 0 . 567 ) + <nl> + vec3 ( 0 . 358 , 0 . 004 , 0 . 0 ) * exp ( dd / 1 . 99 ) + <nl> + vec3 ( 0 . 078 , 0 . 0 , 0 . 0 ) * exp ( dd / 7 . 41 ) ; <nl> + <nl> + / * * <nl> + * Using the profile , we finally approximate the transmitted lighting from <nl> + * the back of the object : <nl> + * / <nl> + return profile * clamp ( 0 . 3 + dot ( light_vec , normal ) , 0 . 0 , 1 . 0 ) ; <nl> } <nl> # endif <nl> <nl> - void light_process_omni ( int idx , vec3 vertex , vec3 eye_vec , vec3 normal , vec3 binormal , vec3 tangent , vec3 albedo , vec3 transmission , float roughness , float metallic , float rim , float rim_tint , float clearcoat , float clearcoat_gloss , float anisotropy , float p_blob_intensity , inout vec3 diffuse_light , inout vec3 specular_light ) { <nl> + void light_process_omni ( int idx , vec3 vertex , vec3 eye_vec , vec3 normal , vec3 binormal , vec3 tangent , vec3 albedo , vec3 transmission , float roughness , float metallic , float rim , float rim_tint , float clearcoat , float clearcoat_gloss , float anisotropy , float p_blob_intensity , inout vec3 diffuse_light , inout vec3 specular_light ) { <nl> <nl> - vec3 light_rel_vec = omni_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> - float light_length = length ( light_rel_vec ) ; <nl> - float normalized_distance = light_length * omni_lights [ idx ] . light_pos_inv_radius . w ; <nl> - float omni_attenuation = pow ( max ( 1 . 0 - normalized_distance , 0 . 0 ) , omni_lights [ idx ] . light_direction_attenuation . w ) ; <nl> + vec3 light_rel_vec = omni_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> + float light_length = length ( light_rel_vec ) ; <nl> + float normalized_distance = light_length * omni_lights [ idx ] . light_pos_inv_radius . w ; <nl> + float omni_attenuation = pow ( max ( 1 . 0 - normalized_distance , 0 . 0 ) , omni_lights [ idx ] . light_direction_attenuation . w ) ; <nl> vec3 light_attenuation = vec3 ( omni_attenuation ) ; <nl> <nl> # if ! defined ( SHADOWS_DISABLED ) <nl> - if ( omni_lights [ idx ] . light_params . w > 0 . 5 ) { <nl> - / / there is a shadowmap <nl> + if ( omni_lights [ idx ] . light_params . w > 0 . 5 ) { <nl> + / / there is a shadowmap <nl> <nl> - highp vec3 splane = ( omni_lights [ idx ] . shadow_matrix * vec4 ( vertex , 1 . 0 ) ) . xyz ; <nl> - float shadow_len = length ( splane ) ; <nl> - splane = normalize ( splane ) ; <nl> - vec4 clamp_rect = omni_lights [ idx ] . light_clamp ; <nl> + highp vec3 splane = ( omni_lights [ idx ] . shadow_matrix * vec4 ( vertex , 1 . 0 ) ) . xyz ; <nl> + float shadow_len = length ( splane ) ; <nl> + splane = normalize ( splane ) ; <nl> + vec4 clamp_rect = omni_lights [ idx ] . light_clamp ; <nl> <nl> - if ( splane . z > = 0 . 0 ) { <nl> + if ( splane . z > = 0 . 0 ) { <nl> <nl> - splane . z + = 1 . 0 ; <nl> + splane . z + = 1 . 0 ; <nl> <nl> - clamp_rect . y + = clamp_rect . w ; <nl> + clamp_rect . y + = clamp_rect . w ; <nl> <nl> } else { <nl> <nl> - splane . z = 1 . 0 - splane . z ; <nl> + splane . z = 1 . 0 - splane . z ; <nl> <nl> / * <nl> - if ( clamp_rect . z < clamp_rect . w ) { <nl> - clamp_rect . x + = clamp_rect . z ; <nl> + if ( clamp_rect . z < clamp_rect . w ) { <nl> + clamp_rect . x + = clamp_rect . z ; <nl> } else { <nl> - clamp_rect . y + = clamp_rect . w ; <nl> + clamp_rect . y + = clamp_rect . w ; <nl> } <nl> * / <nl> - <nl> } <nl> <nl> - splane . xy / = splane . z ; <nl> - splane . xy = splane . xy * 0 . 5 + 0 . 5 ; <nl> + splane . xy / = splane . z ; <nl> + splane . xy = splane . xy * 0 . 5 + 0 . 5 ; <nl> splane . z = shadow_len * omni_lights [ idx ] . light_pos_inv_radius . w ; <nl> <nl> - splane . xy = clamp_rect . xy + splane . xy * clamp_rect . zw ; <nl> - float shadow = sample_shadow ( shadow_atlas , shadow_atlas_pixel_size , splane . xy , splane . z , clamp_rect ) ; <nl> + splane . xy = clamp_rect . xy + splane . xy * clamp_rect . zw ; <nl> + float shadow = sample_shadow ( shadow_atlas , shadow_atlas_pixel_size , splane . xy , splane . z , clamp_rect ) ; <nl> <nl> # ifdef USE_CONTACT_SHADOWS <nl> <nl> - if ( shadow > 0 . 01 & & omni_lights [ idx ] . shadow_color_contact . a > 0 . 0 ) { <nl> - <nl> - float contact_shadow = contact_shadow_compute ( vertex , normalize ( light_rel_vec ) , min ( light_length , omni_lights [ idx ] . shadow_color_contact . a ) ) ; <nl> - shadow = min ( shadow , contact_shadow ) ; <nl> + if ( shadow > 0 . 01 & & omni_lights [ idx ] . shadow_color_contact . a > 0 . 0 ) { <nl> <nl> + float contact_shadow = contact_shadow_compute ( vertex , normalize ( light_rel_vec ) , min ( light_length , omni_lights [ idx ] . shadow_color_contact . a ) ) ; <nl> + shadow = min ( shadow , contact_shadow ) ; <nl> } <nl> # endif <nl> - light_attenuation * = mix ( omni_lights [ idx ] . shadow_color_contact . rgb , vec3 ( 1 . 0 ) , shadow ) ; <nl> + light_attenuation * = mix ( omni_lights [ idx ] . shadow_color_contact . rgb , vec3 ( 1 . 0 ) , shadow ) ; <nl> } <nl> # endif / / SHADOWS_DISABLED <nl> - <nl> - light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , binormal , tangent , omni_lights [ idx ] . light_color_energy . rgb , light_attenuation , albedo , transmission , omni_lights [ idx ] . light_params . z * p_blob_intensity , roughness , metallic , rim * omni_attenuation , rim_tint , clearcoat , clearcoat_gloss , anisotropy , diffuse_light , specular_light ) ; <nl> - <nl> + light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , binormal , tangent , omni_lights [ idx ] . light_color_energy . rgb , light_attenuation , albedo , transmission , omni_lights [ idx ] . light_params . z * p_blob_intensity , roughness , metallic , rim * omni_attenuation , rim_tint , clearcoat , clearcoat_gloss , anisotropy , diffuse_light , specular_light ) ; <nl> } <nl> <nl> - void light_process_spot ( int idx , vec3 vertex , vec3 eye_vec , vec3 normal , vec3 binormal , vec3 tangent , vec3 albedo , vec3 transmission , float roughness , float metallic , float rim , float rim_tint , float clearcoat , float clearcoat_gloss , float anisotropy , float p_blob_intensity , inout vec3 diffuse_light , inout vec3 specular_light ) { <nl> + void light_process_spot ( int idx , vec3 vertex , vec3 eye_vec , vec3 normal , vec3 binormal , vec3 tangent , vec3 albedo , vec3 transmission , float roughness , float metallic , float rim , float rim_tint , float clearcoat , float clearcoat_gloss , float anisotropy , float p_blob_intensity , inout vec3 diffuse_light , inout vec3 specular_light ) { <nl> <nl> - vec3 light_rel_vec = spot_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> - float light_length = length ( light_rel_vec ) ; <nl> - float normalized_distance = light_length * spot_lights [ idx ] . light_pos_inv_radius . w ; <nl> - float spot_attenuation = pow ( max ( 1 . 0 - normalized_distance , 0 . 001 ) , spot_lights [ idx ] . light_direction_attenuation . w ) ; <nl> + vec3 light_rel_vec = spot_lights [ idx ] . light_pos_inv_radius . xyz - vertex ; <nl> + float light_length = length ( light_rel_vec ) ; <nl> + float normalized_distance = light_length * spot_lights [ idx ] . light_pos_inv_radius . w ; <nl> + float spot_attenuation = pow ( max ( 1 . 0 - normalized_distance , 0 . 001 ) , spot_lights [ idx ] . light_direction_attenuation . w ) ; <nl> vec3 spot_dir = spot_lights [ idx ] . light_direction_attenuation . xyz ; <nl> - float spot_cutoff = spot_lights [ idx ] . light_params . y ; <nl> - float scos = max ( dot ( - normalize ( light_rel_vec ) , spot_dir ) , spot_cutoff ) ; <nl> - float spot_rim = max ( 0 . 0001 , ( 1 . 0 - scos ) / ( 1 . 0 - spot_cutoff ) ) ; <nl> - spot_attenuation * = 1 . 0 - pow ( spot_rim , spot_lights [ idx ] . light_params . x ) ; <nl> + float spot_cutoff = spot_lights [ idx ] . light_params . y ; <nl> + float scos = max ( dot ( - normalize ( light_rel_vec ) , spot_dir ) , spot_cutoff ) ; <nl> + float spot_rim = max ( 0 . 0001 , ( 1 . 0 - scos ) / ( 1 . 0 - spot_cutoff ) ) ; <nl> + spot_attenuation * = 1 . 0 - pow ( spot_rim , spot_lights [ idx ] . light_params . x ) ; <nl> vec3 light_attenuation = vec3 ( spot_attenuation ) ; <nl> <nl> # if ! defined ( SHADOWS_DISABLED ) <nl> - if ( spot_lights [ idx ] . light_params . w > 0 . 5 ) { <nl> + if ( spot_lights [ idx ] . light_params . w > 0 . 5 ) { <nl> / / there is a shadowmap <nl> - highp vec4 splane = ( spot_lights [ idx ] . shadow_matrix * vec4 ( vertex , 1 . 0 ) ) ; <nl> - splane . xyz / = splane . w ; <nl> + highp vec4 splane = ( spot_lights [ idx ] . shadow_matrix * vec4 ( vertex , 1 . 0 ) ) ; <nl> + splane . xyz / = splane . w ; <nl> <nl> - float shadow = sample_shadow ( shadow_atlas , shadow_atlas_pixel_size , splane . xy , splane . z , spot_lights [ idx ] . light_clamp ) ; <nl> + float shadow = sample_shadow ( shadow_atlas , shadow_atlas_pixel_size , splane . xy , splane . z , spot_lights [ idx ] . light_clamp ) ; <nl> <nl> # ifdef USE_CONTACT_SHADOWS <nl> - if ( shadow > 0 . 01 & & spot_lights [ idx ] . shadow_color_contact . a > 0 . 0 ) { <nl> - <nl> - float contact_shadow = contact_shadow_compute ( vertex , normalize ( light_rel_vec ) , min ( light_length , spot_lights [ idx ] . shadow_color_contact . a ) ) ; <nl> - shadow = min ( shadow , contact_shadow ) ; <nl> + if ( shadow > 0 . 01 & & spot_lights [ idx ] . shadow_color_contact . a > 0 . 0 ) { <nl> <nl> + float contact_shadow = contact_shadow_compute ( vertex , normalize ( light_rel_vec ) , min ( light_length , spot_lights [ idx ] . shadow_color_contact . a ) ) ; <nl> + shadow = min ( shadow , contact_shadow ) ; <nl> } <nl> # endif <nl> - light_attenuation * = mix ( spot_lights [ idx ] . shadow_color_contact . rgb , vec3 ( 1 . 0 ) , shadow ) ; <nl> + light_attenuation * = mix ( spot_lights [ idx ] . shadow_color_contact . rgb , vec3 ( 1 . 0 ) , shadow ) ; <nl> } <nl> # endif / / SHADOWS_DISABLED <nl> <nl> - light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , binormal , tangent , spot_lights [ idx ] . light_color_energy . rgb , light_attenuation , albedo , transmission , spot_lights [ idx ] . light_params . z * p_blob_intensity , roughness , metallic , rim * spot_attenuation , rim_tint , clearcoat , clearcoat_gloss , anisotropy , diffuse_light , specular_light ) ; <nl> - <nl> + light_compute ( normal , normalize ( light_rel_vec ) , eye_vec , binormal , tangent , spot_lights [ idx ] . light_color_energy . rgb , light_attenuation , albedo , transmission , spot_lights [ idx ] . light_params . z * p_blob_intensity , roughness , metallic , rim * spot_attenuation , rim_tint , clearcoat , clearcoat_gloss , anisotropy , diffuse_light , specular_light ) ; <nl> } <nl> <nl> - void reflection_process ( int idx , vec3 vertex , vec3 normal , vec3 binormal , vec3 tangent , float roughness , float anisotropy , vec3 ambient , vec3 skybox , inout highp vec4 reflection_accum , inout highp vec4 ambient_accum ) { <nl> + void reflection_process ( int idx , vec3 vertex , vec3 normal , vec3 binormal , vec3 tangent , float roughness , float anisotropy , vec3 ambient , vec3 skybox , inout highp vec4 reflection_accum , inout highp vec4 ambient_accum ) { <nl> <nl> - vec3 ref_vec = normalize ( reflect ( vertex , normal ) ) ; <nl> - vec3 local_pos = ( reflections [ idx ] . local_matrix * vec4 ( vertex , 1 . 0 ) ) . xyz ; <nl> + vec3 ref_vec = normalize ( reflect ( vertex , normal ) ) ; <nl> + vec3 local_pos = ( reflections [ idx ] . local_matrix * vec4 ( vertex , 1 . 0 ) ) . xyz ; <nl> vec3 box_extents = reflections [ idx ] . box_extents . xyz ; <nl> <nl> - if ( any ( greaterThan ( abs ( local_pos ) , box_extents ) ) ) { / / out of the reflection box <nl> + if ( any ( greaterThan ( abs ( local_pos ) , box_extents ) ) ) { / / out of the reflection box <nl> return ; <nl> } <nl> <nl> vec3 inner_pos = abs ( local_pos / box_extents ) ; <nl> - float blend = max ( inner_pos . x , max ( inner_pos . y , inner_pos . z ) ) ; <nl> + float blend = max ( inner_pos . x , max ( inner_pos . y , inner_pos . z ) ) ; <nl> / / make blend more rounded <nl> - blend = mix ( length ( inner_pos ) , blend , blend ) ; <nl> - blend * = blend ; <nl> - blend = max ( 0 . 0 , 1 . 0 - blend ) ; <nl> + blend = mix ( length ( inner_pos ) , blend , blend ) ; <nl> + blend * = blend ; <nl> + blend = max ( 0 . 0 , 1 . 0 - blend ) ; <nl> <nl> - if ( reflections [ idx ] . params . x > 0 . 0 ) { / / compute reflection <nl> + if ( reflections [ idx ] . params . x > 0 . 0 ) { / / compute reflection <nl> <nl> - vec3 local_ref_vec = ( reflections [ idx ] . local_matrix * vec4 ( ref_vec , 0 . 0 ) ) . xyz ; <nl> + vec3 local_ref_vec = ( reflections [ idx ] . local_matrix * vec4 ( ref_vec , 0 . 0 ) ) . xyz ; <nl> <nl> if ( reflections [ idx ] . params . w > 0 . 5 ) { / / box project <nl> <nl> vec3 nrdir = normalize ( local_ref_vec ) ; <nl> - vec3 rbmax = ( box_extents - local_pos ) / nrdir ; <nl> - vec3 rbmin = ( - box_extents - local_pos ) / nrdir ; <nl> + vec3 rbmax = ( box_extents - local_pos ) / nrdir ; <nl> + vec3 rbmin = ( - box_extents - local_pos ) / nrdir ; <nl> <nl> - <nl> - vec3 rbminmax = mix ( rbmin , rbmax , greaterThan ( nrdir , vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ) ) ; <nl> + vec3 rbminmax = mix ( rbmin , rbmax , greaterThan ( nrdir , vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ) ) ; <nl> <nl> float fa = min ( min ( rbminmax . x , rbminmax . y ) , rbminmax . z ) ; <nl> vec3 posonbox = local_pos + nrdir * fa ; <nl> local_ref_vec = posonbox - reflections [ idx ] . box_offset . xyz ; <nl> } <nl> <nl> - <nl> - vec4 clamp_rect = reflections [ idx ] . atlas_clamp ; <nl> + vec4 clamp_rect = reflections [ idx ] . atlas_clamp ; <nl> vec3 norm = normalize ( local_ref_vec ) ; <nl> - norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> - norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> - if ( norm . z > 0 . 0 ) { <nl> - norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> + norm . xy / = 1 . 0 + abs ( norm . z ) ; <nl> + norm . xy = norm . xy * vec2 ( 0 . 5 , 0 . 25 ) + vec2 ( 0 . 5 , 0 . 25 ) ; <nl> + if ( norm . z > 0 . 0 ) { <nl> + norm . y = 0 . 5 - norm . y + 0 . 5 ; <nl> } <nl> <nl> - vec2 atlas_uv = norm . xy * clamp_rect . zw + clamp_rect . xy ; <nl> - atlas_uv = clamp ( atlas_uv , clamp_rect . xy , clamp_rect . xy + clamp_rect . zw ) ; <nl> + vec2 atlas_uv = norm . xy * clamp_rect . zw + clamp_rect . xy ; <nl> + atlas_uv = clamp ( atlas_uv , clamp_rect . xy , clamp_rect . xy + clamp_rect . zw ) ; <nl> <nl> highp vec4 reflection ; <nl> - reflection . rgb = textureLod ( reflection_atlas , atlas_uv , roughness * 5 . 0 ) . rgb ; <nl> + reflection . rgb = textureLod ( reflection_atlas , atlas_uv , roughness * 5 . 0 ) . rgb ; <nl> <nl> if ( reflections [ idx ] . params . z < 0 . 5 ) { <nl> - reflection . rgb = mix ( skybox , reflection . rgb , blend ) ; <nl> + reflection . rgb = mix ( skybox , reflection . rgb , blend ) ; <nl> } <nl> - reflection . rgb * = reflections [ idx ] . params . x ; <nl> + reflection . rgb * = reflections [ idx ] . params . x ; <nl> reflection . a = blend ; <nl> - reflection . rgb * = reflection . a ; <nl> + reflection . rgb * = reflection . a ; <nl> <nl> - reflection_accum + = reflection ; <nl> + reflection_accum + = reflection ; <nl> } <nl> # ifndef USE_LIGHTMAP <nl> - if ( reflections [ idx ] . ambient . a > 0 . 0 ) { / / compute ambient using skybox <nl> - <nl> + if ( reflections [ idx ] . ambient . a > 0 . 0 ) { / / compute ambient using skybox <nl> <nl> - vec3 local_amb_vec = ( reflections [ idx ] . local_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ; <nl> + vec3 local_amb_vec = ( reflections [ idx ] . local_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ; <nl> <nl> - vec3 splane = normalize ( local_amb_vec ) ; <nl> - vec4 clamp_rect = reflections [ idx ] . atlas_clamp ; <nl> + vec3 splane = normalize ( local_amb_vec ) ; <nl> + vec4 clamp_rect = reflections [ idx ] . atlas_clamp ; <nl> <nl> - splane . z * = - 1 . 0 ; <nl> - if ( splane . z > = 0 . 0 ) { <nl> - splane . z + = 1 . 0 ; <nl> - clamp_rect . y + = clamp_rect . w ; <nl> + splane . z * = - 1 . 0 ; <nl> + if ( splane . z > = 0 . 0 ) { <nl> + splane . z + = 1 . 0 ; <nl> + clamp_rect . y + = clamp_rect . w ; <nl> } else { <nl> - splane . z = 1 . 0 - splane . z ; <nl> - splane . y = - splane . y ; <nl> + splane . z = 1 . 0 - splane . z ; <nl> + splane . y = - splane . y ; <nl> } <nl> <nl> - splane . xy / = splane . z ; <nl> - splane . xy = splane . xy * 0 . 5 + 0 . 5 ; <nl> + splane . xy / = splane . z ; <nl> + splane . xy = splane . xy * 0 . 5 + 0 . 5 ; <nl> <nl> splane . xy = splane . xy * clamp_rect . zw + clamp_rect . xy ; <nl> - splane . xy = clamp ( splane . xy , clamp_rect . xy , clamp_rect . xy + clamp_rect . zw ) ; <nl> + splane . xy = clamp ( splane . xy , clamp_rect . xy , clamp_rect . xy + clamp_rect . zw ) ; <nl> <nl> highp vec4 ambient_out ; <nl> - ambient_out . a = blend ; <nl> - ambient_out . rgb = textureLod ( reflection_atlas , splane . xy , 5 . 0 ) . rgb ; <nl> - ambient_out . rgb = mix ( reflections [ idx ] . ambient . rgb , ambient_out . rgb , reflections [ idx ] . ambient . a ) ; <nl> + ambient_out . a = blend ; <nl> + ambient_out . rgb = textureLod ( reflection_atlas , splane . xy , 5 . 0 ) . rgb ; <nl> + ambient_out . rgb = mix ( reflections [ idx ] . ambient . rgb , ambient_out . rgb , reflections [ idx ] . ambient . a ) ; <nl> if ( reflections [ idx ] . params . z < 0 . 5 ) { <nl> - ambient_out . rgb = mix ( ambient , ambient_out . rgb , blend ) ; <nl> + ambient_out . rgb = mix ( ambient , ambient_out . rgb , blend ) ; <nl> } <nl> <nl> ambient_out . rgb * = ambient_out . a ; <nl> - ambient_accum + = ambient_out ; <nl> + ambient_accum + = ambient_out ; <nl> } else { <nl> <nl> highp vec4 ambient_out ; <nl> - ambient_out . a = blend ; <nl> - ambient_out . rgb = reflections [ idx ] . ambient . rgb ; <nl> + ambient_out . a = blend ; <nl> + ambient_out . rgb = reflections [ idx ] . ambient . rgb ; <nl> if ( reflections [ idx ] . params . z < 0 . 5 ) { <nl> - ambient_out . rgb = mix ( ambient , ambient_out . rgb , blend ) ; <nl> + ambient_out . rgb = mix ( ambient , ambient_out . rgb , blend ) ; <nl> } <nl> ambient_out . rgb * = ambient_out . a ; <nl> - ambient_accum + = ambient_out ; <nl> - <nl> + ambient_accum + = ambient_out ; <nl> } <nl> # endif <nl> } <nl> uniform bool gi_probe_blend_ambient2 ; <nl> <nl> vec3 voxel_cone_trace ( mediump sampler3D probe , vec3 cell_size , vec3 pos , vec3 ambient , bool blend_ambient , vec3 direction , float tan_half_angle , float max_distance , float p_bias ) { <nl> <nl> - float dist = p_bias ; / / 1 . 0 ; / / dot ( direction , mix ( vec3 ( - 1 . 0 ) , vec3 ( 1 . 0 ) , greaterThan ( direction , vec3 ( 0 . 0 ) ) ) ) * 2 . 0 ; <nl> - float alpha = 0 . 0 ; <nl> + float dist = p_bias ; / / 1 . 0 ; / / dot ( direction , mix ( vec3 ( - 1 . 0 ) , vec3 ( 1 . 0 ) , greaterThan ( direction , vec3 ( 0 . 0 ) ) ) ) * 2 . 0 ; <nl> + float alpha = 0 . 0 ; <nl> vec3 color = vec3 ( 0 . 0 ) ; <nl> <nl> - while ( dist < max_distance & & alpha < 0 . 95 ) { <nl> + while ( dist < max_distance & & alpha < 0 . 95 ) { <nl> float diameter = max ( 1 . 0 , 2 . 0 * tan_half_angle * dist ) ; <nl> - vec4 scolor = textureLod ( probe , ( pos + dist * direction ) * cell_size , log2 ( diameter ) ) ; <nl> + vec4 scolor = textureLod ( probe , ( pos + dist * direction ) * cell_size , log2 ( diameter ) ) ; <nl> float a = ( 1 . 0 - alpha ) ; <nl> color + = scolor . rgb * a ; <nl> alpha + = a * scolor . a ; <nl> vec3 voxel_cone_trace ( mediump sampler3D probe , vec3 cell_size , vec3 pos , vec3 am <nl> } <nl> <nl> if ( blend_ambient ) { <nl> - color . rgb = mix ( ambient , color . rgb , min ( 1 . 0 , alpha / 0 . 95 ) ) ; <nl> + color . rgb = mix ( ambient , color . rgb , min ( 1 . 0 , alpha / 0 . 95 ) ) ; <nl> } <nl> <nl> return color ; <nl> } <nl> <nl> - void gi_probe_compute ( mediump sampler3D probe , mat4 probe_xform , vec3 bounds , vec3 cell_size , vec3 pos , vec3 ambient , vec3 environment , bool blend_ambient , float multiplier , mat3 normal_mtx , vec3 ref_vec , float roughness , float p_bias , float p_normal_bias , inout vec4 out_spec , inout vec4 out_diff ) { <nl> - <nl> - <nl> + void gi_probe_compute ( mediump sampler3D probe , mat4 probe_xform , vec3 bounds , vec3 cell_size , vec3 pos , vec3 ambient , vec3 environment , bool blend_ambient , float multiplier , mat3 normal_mtx , vec3 ref_vec , float roughness , float p_bias , float p_normal_bias , inout vec4 out_spec , inout vec4 out_diff ) { <nl> <nl> - vec3 probe_pos = ( probe_xform * vec4 ( pos , 1 . 0 ) ) . xyz ; <nl> - vec3 ref_pos = ( probe_xform * vec4 ( pos + ref_vec , 1 . 0 ) ) . xyz ; <nl> + vec3 probe_pos = ( probe_xform * vec4 ( pos , 1 . 0 ) ) . xyz ; <nl> + vec3 ref_pos = ( probe_xform * vec4 ( pos + ref_vec , 1 . 0 ) ) . xyz ; <nl> ref_vec = normalize ( ref_pos - probe_pos ) ; <nl> <nl> - probe_pos + = ( probe_xform * vec4 ( normal_mtx [ 2 ] , 0 . 0 ) ) . xyz * p_normal_bias ; <nl> + probe_pos + = ( probe_xform * vec4 ( normal_mtx [ 2 ] , 0 . 0 ) ) . xyz * p_normal_bias ; <nl> <nl> - / * out_diff . rgb = voxel_cone_trace ( probe , cell_size , probe_pos , normalize ( ( probe_xform * vec4 ( ref_vec , 0 . 0 ) ) . xyz ) , 0 . 0 , 100 . 0 ) ; <nl> + / * out_diff . rgb = voxel_cone_trace ( probe , cell_size , probe_pos , normalize ( ( probe_xform * vec4 ( ref_vec , 0 . 0 ) ) . xyz ) , 0 . 0 , 100 . 0 ) ; <nl> out_diff . a = 1 . 0 ; <nl> return ; * / <nl> / / out_diff = vec4 ( textureLod ( probe , probe_pos * cell_size , 3 . 0 ) . rgb , 1 . 0 ) ; <nl> / / return ; <nl> <nl> / / this causes corrupted pixels , i have no idea why . . <nl> - if ( any ( bvec2 ( any ( lessThan ( probe_pos , vec3 ( 0 . 0 ) ) ) , any ( greaterThan ( probe_pos , bounds ) ) ) ) ) { <nl> + if ( any ( bvec2 ( any ( lessThan ( probe_pos , vec3 ( 0 . 0 ) ) ) , any ( greaterThan ( probe_pos , bounds ) ) ) ) ) { <nl> return ; <nl> } <nl> <nl> - vec3 blendv = abs ( probe_pos / bounds * 2 . 0 - 1 . 0 ) ; <nl> - float blend = clamp ( 1 . 0 - max ( blendv . x , max ( blendv . y , blendv . z ) ) , 0 . 0 , 1 . 0 ) ; <nl> + vec3 blendv = abs ( probe_pos / bounds * 2 . 0 - 1 . 0 ) ; <nl> + float blend = clamp ( 1 . 0 - max ( blendv . x , max ( blendv . y , blendv . z ) ) , 0 . 0 , 1 . 0 ) ; <nl> / / float blend = 1 . 0 ; <nl> <nl> float max_distance = length ( bounds ) ; <nl> void gi_probe_compute ( mediump sampler3D probe , mat4 probe_xform , vec3 bounds , vec <nl> # ifdef VCT_QUALITY_HIGH <nl> <nl> # define MAX_CONE_DIRS 6 <nl> - vec3 cone_dirs [ MAX_CONE_DIRS ] = vec3 [ ] ( <nl> - vec3 ( 0 , 0 , 1 ) , <nl> - vec3 ( 0 . 866025 , 0 , 0 . 5 ) , <nl> - vec3 ( 0 . 267617 , 0 . 823639 , 0 . 5 ) , <nl> - vec3 ( - 0 . 700629 , 0 . 509037 , 0 . 5 ) , <nl> - vec3 ( - 0 . 700629 , - 0 . 509037 , 0 . 5 ) , <nl> - vec3 ( 0 . 267617 , - 0 . 823639 , 0 . 5 ) <nl> - ) ; <nl> + vec3 cone_dirs [ MAX_CONE_DIRS ] = vec3 [ ] ( <nl> + vec3 ( 0 , 0 , 1 ) , <nl> + vec3 ( 0 . 866025 , 0 , 0 . 5 ) , <nl> + vec3 ( 0 . 267617 , 0 . 823639 , 0 . 5 ) , <nl> + vec3 ( - 0 . 700629 , 0 . 509037 , 0 . 5 ) , <nl> + vec3 ( - 0 . 700629 , - 0 . 509037 , 0 . 5 ) , <nl> + vec3 ( 0 . 267617 , - 0 . 823639 , 0 . 5 ) ) ; <nl> <nl> float cone_weights [ MAX_CONE_DIRS ] = float [ ] ( 0 . 25 , 0 . 15 , 0 . 15 , 0 . 15 , 0 . 15 , 0 . 15 ) ; <nl> float cone_angle_tan = 0 . 577 ; <nl> void gi_probe_compute ( mediump sampler3D probe , mat4 probe_xform , vec3 bounds , vec <nl> <nl> # define MAX_CONE_DIRS 4 <nl> <nl> - vec3 cone_dirs [ MAX_CONE_DIRS ] = vec3 [ ] ( <nl> + vec3 cone_dirs [ MAX_CONE_DIRS ] = vec3 [ ] ( <nl> vec3 ( 0 . 707107 , 0 , 0 . 707107 ) , <nl> vec3 ( 0 , 0 . 707107 , 0 . 707107 ) , <nl> vec3 ( - 0 . 707107 , 0 , 0 . 707107 ) , <nl> - vec3 ( 0 , - 0 . 707107 , 0 . 707107 ) <nl> - ) ; <nl> + vec3 ( 0 , - 0 . 707107 , 0 . 707107 ) ) ; <nl> <nl> float cone_weights [ MAX_CONE_DIRS ] = float [ ] ( 0 . 25 , 0 . 25 , 0 . 25 , 0 . 25 ) ; <nl> float cone_angle_tan = 0 . 98269 ; <nl> - max_distance * = 0 . 5 ; <nl> + max_distance * = 0 . 5 ; <nl> float min_ref_tan = 0 . 2 ; <nl> <nl> # endif <nl> - vec3 light = vec3 ( 0 . 0 ) ; <nl> - for ( int i = 0 ; i < MAX_CONE_DIRS ; i + + ) { <nl> - <nl> - vec3 dir = normalize ( ( probe_xform * vec4 ( pos + normal_mtx * cone_dirs [ i ] , 1 . 0 ) ) . xyz - probe_pos ) ; <nl> - light + = cone_weights [ i ] * voxel_cone_trace ( probe , cell_size , probe_pos , ambient , blend_ambient , dir , cone_angle_tan , max_distance , p_bias ) ; <nl> + vec3 light = vec3 ( 0 . 0 ) ; <nl> + for ( int i = 0 ; i < MAX_CONE_DIRS ; i + + ) { <nl> <nl> + vec3 dir = normalize ( ( probe_xform * vec4 ( pos + normal_mtx * cone_dirs [ i ] , 1 . 0 ) ) . xyz - probe_pos ) ; <nl> + light + = cone_weights [ i ] * voxel_cone_trace ( probe , cell_size , probe_pos , ambient , blend_ambient , dir , cone_angle_tan , max_distance , p_bias ) ; <nl> } <nl> <nl> - light * = multiplier ; <nl> + light * = multiplier ; <nl> <nl> - out_diff + = vec4 ( light * blend , blend ) ; <nl> + out_diff + = vec4 ( light * blend , blend ) ; <nl> <nl> / / irradiance <nl> <nl> - vec3 irr_light = voxel_cone_trace ( probe , cell_size , probe_pos , environment , blend_ambient , ref_vec , max ( min_ref_tan , tan ( roughness * 0 . 5 * M_PI ) ) , max_distance , p_bias ) ; <nl> + vec3 irr_light = voxel_cone_trace ( probe , cell_size , probe_pos , environment , blend_ambient , ref_vec , max ( min_ref_tan , tan ( roughness * 0 . 5 * M_PI ) ) , max_distance , p_bias ) ; <nl> <nl> irr_light * = multiplier ; <nl> / / irr_light = vec3 ( 0 . 0 ) ; <nl> <nl> - out_spec + = vec4 ( irr_light * blend , blend ) ; <nl> - <nl> + out_spec + = vec4 ( irr_light * blend , blend ) ; <nl> } <nl> <nl> - <nl> void gi_probes_compute ( vec3 pos , vec3 normal , float roughness , inout vec3 out_specular , inout vec3 out_ambient ) { <nl> <nl> roughness = roughness * roughness ; <nl> <nl> - vec3 ref_vec = normalize ( reflect ( normalize ( pos ) , normal ) ) ; <nl> + vec3 ref_vec = normalize ( reflect ( normalize ( pos ) , normal ) ) ; <nl> <nl> / / find arbitrary tangent and bitangent , then build a matrix <nl> vec3 v0 = abs ( normal . z ) < 0 . 999 ? vec3 ( 0 , 0 , 1 ) : vec3 ( 0 , 1 , 0 ) ; <nl> vec3 tangent = normalize ( cross ( v0 , normal ) ) ; <nl> vec3 bitangent = normalize ( cross ( tangent , normal ) ) ; <nl> - mat3 normal_mat = mat3 ( tangent , bitangent , normal ) ; <nl> + mat3 normal_mat = mat3 ( tangent , bitangent , normal ) ; <nl> <nl> vec4 diff_accum = vec4 ( 0 . 0 ) ; <nl> vec4 spec_accum = vec4 ( 0 . 0 ) ; <nl> void gi_probes_compute ( vec3 pos , vec3 normal , float roughness , inout vec3 out_sp <nl> <nl> out_specular = vec3 ( 0 . 0 ) ; <nl> <nl> - gi_probe_compute ( gi_probe1 , gi_probe_xform1 , gi_probe_bounds1 , gi_probe_cell_size1 , pos , ambient , environment , gi_probe_blend_ambient1 , gi_probe_multiplier1 , normal_mat , ref_vec , roughness , gi_probe_bias1 , gi_probe_normal_bias1 , spec_accum , diff_accum ) ; <nl> + gi_probe_compute ( gi_probe1 , gi_probe_xform1 , gi_probe_bounds1 , gi_probe_cell_size1 , pos , ambient , environment , gi_probe_blend_ambient1 , gi_probe_multiplier1 , normal_mat , ref_vec , roughness , gi_probe_bias1 , gi_probe_normal_bias1 , spec_accum , diff_accum ) ; <nl> <nl> if ( gi_probe2_enabled ) { <nl> <nl> - gi_probe_compute ( gi_probe2 , gi_probe_xform2 , gi_probe_bounds2 , gi_probe_cell_size2 , pos , ambient , environment , gi_probe_blend_ambient2 , gi_probe_multiplier2 , normal_mat , ref_vec , roughness , gi_probe_bias2 , gi_probe_normal_bias2 , spec_accum , diff_accum ) ; <nl> + gi_probe_compute ( gi_probe2 , gi_probe_xform2 , gi_probe_bounds2 , gi_probe_cell_size2 , pos , ambient , environment , gi_probe_blend_ambient2 , gi_probe_multiplier2 , normal_mat , ref_vec , roughness , gi_probe_bias2 , gi_probe_normal_bias2 , spec_accum , diff_accum ) ; <nl> } <nl> <nl> - if ( diff_accum . a > 0 . 0 ) { <nl> - diff_accum . rgb / = diff_accum . a ; <nl> + if ( diff_accum . a > 0 . 0 ) { <nl> + diff_accum . rgb / = diff_accum . a ; <nl> } <nl> <nl> - if ( spec_accum . a > 0 . 0 ) { <nl> - spec_accum . rgb / = spec_accum . a ; <nl> + if ( spec_accum . a > 0 . 0 ) { <nl> + spec_accum . rgb / = spec_accum . a ; <nl> } <nl> <nl> - out_specular + = spec_accum . rgb ; <nl> - out_ambient + = diff_accum . rgb ; <nl> - <nl> + out_specular + = spec_accum . rgb ; <nl> + out_ambient + = diff_accum . rgb ; <nl> } <nl> <nl> # endif <nl> <nl> - <nl> - <nl> void main ( ) { <nl> <nl> # ifdef RENDER_DEPTH_DUAL_PARABOLOID <nl> <nl> - if ( dp_clip > 0 . 0 ) <nl> + if ( dp_clip > 0 . 0 ) <nl> discard ; <nl> # endif <nl> <nl> void main ( ) { <nl> vec2 anisotropy_flow = vec2 ( 1 . 0 , 0 . 0 ) ; <nl> <nl> # if defined ( ENABLE_AO ) <nl> - float ao = 1 . 0 ; <nl> - float ao_light_affect = 0 . 0 ; <nl> + float ao = 1 . 0 ; <nl> + float ao_light_affect = 0 . 0 ; <nl> # endif <nl> <nl> float alpha = 1 . 0 ; <nl> <nl> # if defined ( DO_SIDE_CHECK ) <nl> - float side = gl_FrontFacing ? 1 . 0 : - 1 . 0 ; <nl> + float side = gl_FrontFacing ? 1 . 0 : - 1 . 0 ; <nl> # else <nl> - float side = 1 . 0 ; <nl> + float side = 1 . 0 ; <nl> # endif <nl> <nl> - <nl> # if defined ( ALPHA_SCISSOR_USED ) <nl> float alpha_scissor = 0 . 5 ; <nl> # endif <nl> <nl> # if defined ( ENABLE_TANGENT_INTERP ) | | defined ( ENABLE_NORMALMAP ) | | defined ( LIGHT_USE_ANISOTROPY ) <nl> - vec3 binormal = normalize ( binormal_interp ) * side ; <nl> - vec3 tangent = normalize ( tangent_interp ) * side ; <nl> + vec3 binormal = normalize ( binormal_interp ) * side ; <nl> + vec3 tangent = normalize ( tangent_interp ) * side ; <nl> # else <nl> vec3 binormal = vec3 ( 0 . 0 ) ; <nl> vec3 tangent = vec3 ( 0 . 0 ) ; <nl> # endif <nl> - vec3 normal = normalize ( normal_interp ) * side ; <nl> + vec3 normal = normalize ( normal_interp ) * side ; <nl> <nl> # if defined ( ENABLE_UV_INTERP ) <nl> vec2 uv = uv_interp ; <nl> # endif <nl> <nl> - # if defined ( ENABLE_UV2_INTERP ) | | defined ( USE_LIGHTMAP ) <nl> + # if defined ( ENABLE_UV2_INTERP ) | | defined ( USE_LIGHTMAP ) <nl> vec2 uv2 = uv2_interp ; <nl> # endif <nl> <nl> void main ( ) { <nl> vec3 normalmap = vec3 ( 0 . 5 ) ; <nl> # endif <nl> <nl> - float normaldepth = 1 . 0 ; <nl> + float normaldepth = 1 . 0 ; <nl> <nl> # if defined ( SCREEN_UV_USED ) <nl> - vec2 screen_uv = gl_FragCoord . xy * screen_pixel_size ; <nl> + vec2 screen_uv = gl_FragCoord . xy * screen_pixel_size ; <nl> # endif <nl> <nl> - # if defined ( ENABLE_SSS ) <nl> - float sss_strength = 0 . 0 ; <nl> + # if defined ( ENABLE_SSS ) <nl> + float sss_strength = 0 . 0 ; <nl> # endif <nl> <nl> { <nl> <nl> - <nl> FRAGMENT_SHADER_CODE <nl> <nl> } <nl> <nl> - <nl> # if defined ( ALPHA_SCISSOR_USED ) <nl> - if ( alpha < alpha_scissor ) { <nl> + if ( alpha < alpha_scissor ) { <nl> discard ; <nl> } <nl> # endif <nl> <nl> # ifdef USE_OPAQUE_PREPASS <nl> <nl> - if ( alpha < opaque_prepass_threshold ) { <nl> + if ( alpha < opaque_prepass_threshold ) { <nl> discard ; <nl> } <nl> <nl> FRAGMENT_SHADER_CODE <nl> <nl> # if defined ( ENABLE_NORMALMAP ) <nl> <nl> - normalmap . xy = normalmap . xy * 2 . 0 - 1 . 0 ; <nl> - normalmap . z = sqrt ( max ( 0 . 0 , 1 . 0 - dot ( normalmap . xy , normalmap . xy ) ) ) ; / / always ignore Z , as it can be RG packed , Z may be pos / neg , etc . <nl> + normalmap . xy = normalmap . xy * 2 . 0 - 1 . 0 ; <nl> + normalmap . z = sqrt ( max ( 0 . 0 , 1 . 0 - dot ( normalmap . xy , normalmap . xy ) ) ) ; / / always ignore Z , as it can be RG packed , Z may be pos / neg , etc . <nl> <nl> - normal = normalize ( mix ( normal_interp , tangent * normalmap . x + binormal * normalmap . y + normal * normalmap . z , normaldepth ) ) * side ; <nl> + normal = normalize ( mix ( normal_interp , tangent * normalmap . x + binormal * normalmap . y + normal * normalmap . z , normaldepth ) ) * side ; <nl> <nl> # endif <nl> <nl> # if defined ( LIGHT_USE_ANISOTROPY ) <nl> <nl> - if ( anisotropy > 0 . 01 ) { <nl> + if ( anisotropy > 0 . 01 ) { <nl> / / rotation matrix <nl> - mat3 rot = mat3 ( tangent , binormal , normal ) ; <nl> + mat3 rot = mat3 ( tangent , binormal , normal ) ; <nl> / / make local to space <nl> - tangent = normalize ( rot * vec3 ( anisotropy_flow . x , anisotropy_flow . y , 0 . 0 ) ) ; <nl> - binormal = normalize ( rot * vec3 ( - anisotropy_flow . y , anisotropy_flow . x , 0 . 0 ) ) ; <nl> + tangent = normalize ( rot * vec3 ( anisotropy_flow . x , anisotropy_flow . y , 0 . 0 ) ) ; <nl> + binormal = normalize ( rot * vec3 ( - anisotropy_flow . y , anisotropy_flow . x , 0 . 0 ) ) ; <nl> } <nl> <nl> # endif <nl> <nl> # ifdef ENABLE_CLIP_ALPHA <nl> - if ( albedo . a < 0 . 99 ) { <nl> + if ( albedo . a < 0 . 99 ) { <nl> / / used for doublepass and shadowmapping <nl> discard ; <nl> } <nl> # endif <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / LIGHTING / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / / / / / / / / / / / / / / / / / / / / / LIGHTING / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> / / apply energy conservation <nl> <nl> FRAGMENT_SHADER_CODE <nl> vec3 diffuse_light = diffuse_light_interp . rgb ; <nl> # else <nl> <nl> - vec3 specular_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> - vec3 diffuse_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + vec3 specular_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + vec3 diffuse_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> <nl> # endif <nl> <nl> vec3 ambient_light ; <nl> - vec3 env_reflection_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> - <nl> - vec3 eye_vec = - normalize ( vertex_interp ) ; <nl> - <nl> + vec3 env_reflection_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> <nl> + vec3 eye_vec = - normalize ( vertex_interp ) ; <nl> <nl> # ifdef USE_RADIANCE_MAP <nl> <nl> # ifdef AMBIENT_LIGHT_DISABLED <nl> - ambient_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + ambient_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> # else <nl> { <nl> <nl> { / / read radiance from dual paraboloid <nl> <nl> - vec3 ref_vec = reflect ( - eye_vec , normal ) ; / / 2 . 0 * ndotv * normal - view ; / / reflect ( v , n ) ; <nl> - ref_vec = normalize ( ( radiance_inverse_xform * vec4 ( ref_vec , 0 . 0 ) ) . xyz ) ; <nl> - vec3 radiance = textureDualParaboloid ( radiance_map , ref_vec , roughness ) * bg_energy ; <nl> + vec3 ref_vec = reflect ( - eye_vec , normal ) ; / / 2 . 0 * ndotv * normal - view ; / / reflect ( v , n ) ; <nl> + ref_vec = normalize ( ( radiance_inverse_xform * vec4 ( ref_vec , 0 . 0 ) ) . xyz ) ; <nl> + vec3 radiance = textureDualParaboloid ( radiance_map , ref_vec , roughness ) * bg_energy ; <nl> env_reflection_light = radiance ; <nl> - <nl> } <nl> / / no longer a cubemap <nl> / / vec3 radiance = textureLod ( radiance_cube , r , lod ) . xyz * ( brdf . x + brdf . y ) ; <nl> - <nl> } <nl> # ifndef USE_LIGHTMAP <nl> { <nl> <nl> - vec3 ambient_dir = normalize ( ( radiance_inverse_xform * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> - vec3 env_ambient = textureDualParaboloid ( radiance_map , ambient_dir , 1 . 0 ) * bg_energy ; <nl> + vec3 ambient_dir = normalize ( ( radiance_inverse_xform * vec4 ( normal , 0 . 0 ) ) . xyz ) ; <nl> + vec3 env_ambient = textureDualParaboloid ( radiance_map , ambient_dir , 1 . 0 ) * bg_energy ; <nl> <nl> - ambient_light = mix ( ambient_light_color . rgb , env_ambient , radiance_ambient_contribution ) ; <nl> + ambient_light = mix ( ambient_light_color . rgb , env_ambient , radiance_ambient_contribution ) ; <nl> / / ambient_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> } <nl> # endif <nl> FRAGMENT_SHADER_CODE <nl> # else <nl> <nl> # ifdef AMBIENT_LIGHT_DISABLED <nl> - ambient_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + ambient_light = vec3 ( 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> # else <nl> - ambient_light = ambient_light_color . rgb ; <nl> + ambient_light = ambient_light_color . rgb ; <nl> # endif / / AMBIENT_LIGHT_DISABLED <nl> <nl> # endif <nl> <nl> - ambient_light * = ambient_energy ; <nl> + ambient_light * = ambient_energy ; <nl> <nl> - float specular_blob_intensity = 1 . 0 ; <nl> + float specular_blob_intensity = 1 . 0 ; <nl> # if defined ( SPECULAR_TOON ) <nl> - specular_blob_intensity * = specular * 2 . 0 ; <nl> + specular_blob_intensity * = specular * 2 . 0 ; <nl> # endif <nl> <nl> # if defined ( USE_LIGHT_DIRECTIONAL ) <nl> <nl> - vec3 light_attenuation = vec3 ( 1 . 0 ) ; <nl> + vec3 light_attenuation = vec3 ( 1 . 0 ) ; <nl> <nl> float depth_z = - vertex . z ; <nl> # ifdef LIGHT_DIRECTIONAL_SHADOW <nl> FRAGMENT_SHADER_CODE <nl> if ( depth_z < shadow_split_offsets . x ) { <nl> # endif / / LIGHT_USE_PSSM4 <nl> <nl> - vec3 pssm_coord ; <nl> - float pssm_fade = 0 . 0 ; <nl> + vec3 pssm_coord ; <nl> + float pssm_fade = 0 . 0 ; <nl> <nl> # ifdef LIGHT_USE_PSSM_BLEND <nl> - float pssm_blend ; <nl> - vec3 pssm_coord2 ; <nl> - bool use_blend = true ; <nl> + float pssm_blend ; <nl> + vec3 pssm_coord2 ; <nl> + bool use_blend = true ; <nl> # endif <nl> <nl> - <nl> # ifdef LIGHT_USE_PSSM4 <nl> <nl> + if ( depth_z < shadow_split_offsets . y ) { <nl> <nl> - if ( depth_z < shadow_split_offsets . y ) { <nl> - <nl> - if ( depth_z < shadow_split_offsets . x ) { <nl> - <nl> - highp vec4 splane = ( shadow_matrix1 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord = splane . xyz / splane . w ; <nl> + if ( depth_z < shadow_split_offsets . x ) { <nl> <nl> + highp vec4 splane = ( shadow_matrix1 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord = splane . xyz / splane . w ; <nl> <nl> # if defined ( LIGHT_USE_PSSM_BLEND ) <nl> <nl> - splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord2 = splane . xyz / splane . w ; <nl> - pssm_blend = smoothstep ( 0 . 0 , shadow_split_offsets . x , depth_z ) ; <nl> + splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord2 = splane . xyz / splane . w ; <nl> + pssm_blend = smoothstep ( 0 . 0 , shadow_split_offsets . x , depth_z ) ; <nl> # endif <nl> <nl> - } else { <nl> + } else { <nl> <nl> - highp vec4 splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord = splane . xyz / splane . w ; <nl> + highp vec4 splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord = splane . xyz / splane . w ; <nl> <nl> # if defined ( LIGHT_USE_PSSM_BLEND ) <nl> - splane = ( shadow_matrix3 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord2 = splane . xyz / splane . w ; <nl> - pssm_blend = smoothstep ( shadow_split_offsets . x , shadow_split_offsets . y , depth_z ) ; <nl> + splane = ( shadow_matrix3 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord2 = splane . xyz / splane . w ; <nl> + pssm_blend = smoothstep ( shadow_split_offsets . x , shadow_split_offsets . y , depth_z ) ; <nl> # endif <nl> + } <nl> + } else { <nl> <nl> - } <nl> - } else { <nl> - <nl> - <nl> - if ( depth_z < shadow_split_offsets . z ) { <nl> + if ( depth_z < shadow_split_offsets . z ) { <nl> <nl> - highp vec4 splane = ( shadow_matrix3 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord = splane . xyz / splane . w ; <nl> + highp vec4 splane = ( shadow_matrix3 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord = splane . xyz / splane . w ; <nl> <nl> # if defined ( LIGHT_USE_PSSM_BLEND ) <nl> - splane = ( shadow_matrix4 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord2 = splane . xyz / splane . w ; <nl> - pssm_blend = smoothstep ( shadow_split_offsets . y , shadow_split_offsets . z , depth_z ) ; <nl> + splane = ( shadow_matrix4 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord2 = splane . xyz / splane . w ; <nl> + pssm_blend = smoothstep ( shadow_split_offsets . y , shadow_split_offsets . z , depth_z ) ; <nl> # endif <nl> <nl> - } else { <nl> + } else { <nl> <nl> - highp vec4 splane = ( shadow_matrix4 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord = splane . xyz / splane . w ; <nl> - pssm_fade = smoothstep ( shadow_split_offsets . z , shadow_split_offsets . w , depth_z ) ; <nl> + highp vec4 splane = ( shadow_matrix4 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord = splane . xyz / splane . w ; <nl> + pssm_fade = smoothstep ( shadow_split_offsets . z , shadow_split_offsets . w , depth_z ) ; <nl> <nl> # if defined ( LIGHT_USE_PSSM_BLEND ) <nl> - use_blend = false ; <nl> + use_blend = false ; <nl> <nl> # endif <nl> - <nl> + } <nl> } <nl> - } <nl> - <nl> - <nl> <nl> # endif / / LIGHT_USE_PSSM4 <nl> <nl> # ifdef LIGHT_USE_PSSM2 <nl> <nl> - if ( depth_z < shadow_split_offsets . x ) { <nl> - <nl> - highp vec4 splane = ( shadow_matrix1 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord = splane . xyz / splane . w ; <nl> + if ( depth_z < shadow_split_offsets . x ) { <nl> <nl> + highp vec4 splane = ( shadow_matrix1 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord = splane . xyz / splane . w ; <nl> <nl> # if defined ( LIGHT_USE_PSSM_BLEND ) <nl> <nl> - splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord2 = splane . xyz / splane . w ; <nl> - pssm_blend = smoothstep ( 0 . 0 , shadow_split_offsets . x , depth_z ) ; <nl> + splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord2 = splane . xyz / splane . w ; <nl> + pssm_blend = smoothstep ( 0 . 0 , shadow_split_offsets . x , depth_z ) ; <nl> # endif <nl> <nl> - } else { <nl> - highp vec4 splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord = splane . xyz / splane . w ; <nl> - pssm_fade = smoothstep ( shadow_split_offsets . x , shadow_split_offsets . y , depth_z ) ; <nl> + } else { <nl> + highp vec4 splane = ( shadow_matrix2 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord = splane . xyz / splane . w ; <nl> + pssm_fade = smoothstep ( shadow_split_offsets . x , shadow_split_offsets . y , depth_z ) ; <nl> # if defined ( LIGHT_USE_PSSM_BLEND ) <nl> - use_blend = false ; <nl> + use_blend = false ; <nl> <nl> # endif <nl> - <nl> - } <nl> + } <nl> <nl> # endif / / LIGHT_USE_PSSM2 <nl> <nl> # if ! defined ( LIGHT_USE_PSSM4 ) & & ! defined ( LIGHT_USE_PSSM2 ) <nl> - { / / regular orthogonal <nl> - highp vec4 splane = ( shadow_matrix1 * vec4 ( vertex , 1 . 0 ) ) ; <nl> - pssm_coord = splane . xyz / splane . w ; <nl> - } <nl> + { / / regular orthogonal <nl> + highp vec4 splane = ( shadow_matrix1 * vec4 ( vertex , 1 . 0 ) ) ; <nl> + pssm_coord = splane . xyz / splane . w ; <nl> + } <nl> # endif <nl> <nl> + / / one one sample <nl> <nl> - / / one one sample <nl> - <nl> - float shadow = sample_shadow ( directional_shadow , directional_shadow_pixel_size , pssm_coord . xy , pssm_coord . z , light_clamp ) ; <nl> + float shadow = sample_shadow ( directional_shadow , directional_shadow_pixel_size , pssm_coord . xy , pssm_coord . z , light_clamp ) ; <nl> <nl> # if defined ( LIGHT_USE_PSSM_BLEND ) <nl> <nl> - if ( use_blend ) { <nl> - shadow = mix ( shadow , sample_shadow ( directional_shadow , directional_shadow_pixel_size , pssm_coord2 . xy , pssm_coord2 . z , light_clamp ) , pssm_blend ) ; <nl> - } <nl> + if ( use_blend ) { <nl> + shadow = mix ( shadow , sample_shadow ( directional_shadow , directional_shadow_pixel_size , pssm_coord2 . xy , pssm_coord2 . z , light_clamp ) , pssm_blend ) ; <nl> + } <nl> # endif <nl> <nl> # ifdef USE_CONTACT_SHADOWS <nl> - if ( shadow > 0 . 01 & & shadow_color_contact . a > 0 . 0 ) { <nl> + if ( shadow > 0 . 01 & & shadow_color_contact . a > 0 . 0 ) { <nl> <nl> - float contact_shadow = contact_shadow_compute ( vertex , - light_direction_attenuation . xyz , shadow_color_contact . a ) ; <nl> - shadow = min ( shadow , contact_shadow ) ; <nl> - <nl> - } <nl> + float contact_shadow = contact_shadow_compute ( vertex , - light_direction_attenuation . xyz , shadow_color_contact . a ) ; <nl> + shadow = min ( shadow , contact_shadow ) ; <nl> + } <nl> # endif <nl> - light_attenuation = mix ( mix ( shadow_color_contact . rgb , vec3 ( 1 . 0 ) , shadow ) , vec3 ( 1 . 0 ) , pssm_fade ) ; <nl> - <nl> - <nl> + light_attenuation = mix ( mix ( shadow_color_contact . rgb , vec3 ( 1 . 0 ) , shadow ) , vec3 ( 1 . 0 ) , pssm_fade ) ; <nl> } <nl> <nl> - <nl> # endif / / ! defined ( SHADOWS_DISABLED ) <nl> # endif / / LIGHT_DIRECTIONAL_SHADOW <nl> <nl> # ifdef USE_VERTEX_LIGHTING <nl> - diffuse_light * = mix ( vec3 ( 1 . 0 ) , light_attenuation , diffuse_light_interp . a ) ; <nl> - specular_light * = mix ( vec3 ( 1 . 0 ) , light_attenuation , specular_light_interp . a ) ; <nl> + diffuse_light * = mix ( vec3 ( 1 . 0 ) , light_attenuation , diffuse_light_interp . a ) ; <nl> + specular_light * = mix ( vec3 ( 1 . 0 ) , light_attenuation , specular_light_interp . a ) ; <nl> <nl> # else <nl> - light_compute ( normal , - light_direction_attenuation . xyz , eye_vec , binormal , tangent , light_color_energy . rgb , light_attenuation , albedo , transmission , light_params . z * specular_blob_intensity , roughness , metallic , rim , rim_tint , clearcoat , clearcoat_gloss , anisotropy , diffuse_light , specular_light ) ; <nl> + light_compute ( normal , - light_direction_attenuation . xyz , eye_vec , binormal , tangent , light_color_energy . rgb , light_attenuation , albedo , transmission , light_params . z * specular_blob_intensity , roughness , metallic , rim , rim_tint , clearcoat , clearcoat_gloss , anisotropy , diffuse_light , specular_light ) ; <nl> # endif <nl> <nl> - <nl> # endif / / # USE_LIGHT_DIRECTIONAL <nl> <nl> # ifdef USE_GI_PROBES <nl> - gi_probes_compute ( vertex , normal , roughness , env_reflection_light , ambient_light ) ; <nl> + gi_probes_compute ( vertex , normal , roughness , env_reflection_light , ambient_light ) ; <nl> <nl> # endif <nl> <nl> # ifdef USE_LIGHTMAP <nl> - ambient_light = texture ( lightmap , uv2 ) . rgb * lightmap_energy ; <nl> + ambient_light = texture ( lightmap , uv2 ) . rgb * lightmap_energy ; <nl> # endif <nl> <nl> # ifdef USE_LIGHTMAP_CAPTURE <nl> { <nl> - vec3 cone_dirs [ 12 ] = vec3 [ ] ( <nl> - vec3 ( 0 , 0 , 1 ) , <nl> - vec3 ( 0 . 866025 , 0 , 0 . 5 ) , <nl> - vec3 ( 0 . 267617 , 0 . 823639 , 0 . 5 ) , <nl> - vec3 ( - 0 . 700629 , 0 . 509037 , 0 . 5 ) , <nl> - vec3 ( - 0 . 700629 , - 0 . 509037 , 0 . 5 ) , <nl> - vec3 ( 0 . 267617 , - 0 . 823639 , 0 . 5 ) , <nl> - vec3 ( 0 , 0 , - 1 ) , <nl> - vec3 ( 0 . 866025 , 0 , - 0 . 5 ) , <nl> - vec3 ( 0 . 267617 , 0 . 823639 , - 0 . 5 ) , <nl> - vec3 ( - 0 . 700629 , 0 . 509037 , - 0 . 5 ) , <nl> - vec3 ( - 0 . 700629 , - 0 . 509037 , - 0 . 5 ) , <nl> - vec3 ( 0 . 267617 , - 0 . 823639 , - 0 . 5 ) <nl> - ) ; <nl> - <nl> - <nl> - vec3 local_normal = normalize ( camera_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ; <nl> + vec3 cone_dirs [ 12 ] = vec3 [ ] ( <nl> + vec3 ( 0 , 0 , 1 ) , <nl> + vec3 ( 0 . 866025 , 0 , 0 . 5 ) , <nl> + vec3 ( 0 . 267617 , 0 . 823639 , 0 . 5 ) , <nl> + vec3 ( - 0 . 700629 , 0 . 509037 , 0 . 5 ) , <nl> + vec3 ( - 0 . 700629 , - 0 . 509037 , 0 . 5 ) , <nl> + vec3 ( 0 . 267617 , - 0 . 823639 , 0 . 5 ) , <nl> + vec3 ( 0 , 0 , - 1 ) , <nl> + vec3 ( 0 . 866025 , 0 , - 0 . 5 ) , <nl> + vec3 ( 0 . 267617 , 0 . 823639 , - 0 . 5 ) , <nl> + vec3 ( - 0 . 700629 , 0 . 509037 , - 0 . 5 ) , <nl> + vec3 ( - 0 . 700629 , - 0 . 509037 , - 0 . 5 ) , <nl> + vec3 ( 0 . 267617 , - 0 . 823639 , - 0 . 5 ) ) ; <nl> + <nl> + vec3 local_normal = normalize ( camera_matrix * vec4 ( normal , 0 . 0 ) ) . xyz ; <nl> vec4 captured = vec4 ( 0 . 0 ) ; <nl> float sum = 0 . 0 ; <nl> - for ( int i = 0 ; i < 12 ; i + + ) { <nl> - float amount = max ( 0 . 0 , dot ( local_normal , cone_dirs [ i ] ) ) ; / / not correct , but creates a nice wrap around effect <nl> - captured + = lightmap_captures [ i ] * amount ; <nl> - sum + = amount ; <nl> + for ( int i = 0 ; i < 12 ; i + + ) { <nl> + float amount = max ( 0 . 0 , dot ( local_normal , cone_dirs [ i ] ) ) ; / / not correct , but creates a nice wrap around effect <nl> + captured + = lightmap_captures [ i ] * amount ; <nl> + sum + = amount ; <nl> } <nl> <nl> - captured / = sum ; <nl> + captured / = sum ; <nl> <nl> if ( lightmap_capture_sky ) { <nl> - ambient_light = mix ( ambient_light , captured . rgb , captured . a ) ; <nl> + ambient_light = mix ( ambient_light , captured . rgb , captured . a ) ; <nl> } else { <nl> ambient_light = captured . rgb ; <nl> } <nl> - <nl> } <nl> # endif <nl> <nl> # ifdef USE_FORWARD_LIGHTING <nl> <nl> - <nl> - highp vec4 reflection_accum = vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> - highp vec4 ambient_accum = vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> - for ( int i = 0 ; i < reflection_count ; i + + ) { <nl> - reflection_process ( reflection_indices [ i ] , vertex , normal , binormal , tangent , roughness , anisotropy , ambient_light , env_reflection_light , reflection_accum , ambient_accum ) ; <nl> + highp vec4 reflection_accum = vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + highp vec4 ambient_accum = vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + for ( int i = 0 ; i < reflection_count ; i + + ) { <nl> + reflection_process ( reflection_indices [ i ] , vertex , normal , binormal , tangent , roughness , anisotropy , ambient_light , env_reflection_light , reflection_accum , ambient_accum ) ; <nl> } <nl> <nl> - if ( reflection_accum . a > 0 . 0 ) { <nl> - specular_light + = reflection_accum . rgb / reflection_accum . a ; <nl> + if ( reflection_accum . a > 0 . 0 ) { <nl> + specular_light + = reflection_accum . rgb / reflection_accum . a ; <nl> } else { <nl> - specular_light + = env_reflection_light ; <nl> + specular_light + = env_reflection_light ; <nl> } <nl> # ifndef USE_LIGHTMAP <nl> - if ( ambient_accum . a > 0 . 0 ) { <nl> - ambient_light = ambient_accum . rgb / ambient_accum . a ; <nl> + if ( ambient_accum . a > 0 . 0 ) { <nl> + ambient_light = ambient_accum . rgb / ambient_accum . a ; <nl> } <nl> # endif <nl> <nl> - <nl> # ifdef USE_VERTEX_LIGHTING <nl> <nl> - diffuse_light * = albedo ; <nl> + diffuse_light * = albedo ; <nl> # else <nl> <nl> - for ( int i = 0 ; i < omni_light_count ; i + + ) { <nl> - light_process_omni ( omni_light_indices [ i ] , vertex , eye_vec , normal , binormal , tangent , albedo , transmission , roughness , metallic , rim , rim_tint , clearcoat , clearcoat_gloss , anisotropy , specular_blob_intensity , diffuse_light , specular_light ) ; <nl> + for ( int i = 0 ; i < omni_light_count ; i + + ) { <nl> + light_process_omni ( omni_light_indices [ i ] , vertex , eye_vec , normal , binormal , tangent , albedo , transmission , roughness , metallic , rim , rim_tint , clearcoat , clearcoat_gloss , anisotropy , specular_blob_intensity , diffuse_light , specular_light ) ; <nl> } <nl> <nl> - for ( int i = 0 ; i < spot_light_count ; i + + ) { <nl> - light_process_spot ( spot_light_indices [ i ] , vertex , eye_vec , normal , binormal , tangent , albedo , transmission , roughness , metallic , rim , rim_tint , clearcoat , clearcoat_gloss , anisotropy , specular_blob_intensity , diffuse_light , specular_light ) ; <nl> + for ( int i = 0 ; i < spot_light_count ; i + + ) { <nl> + light_process_spot ( spot_light_indices [ i ] , vertex , eye_vec , normal , binormal , tangent , albedo , transmission , roughness , metallic , rim , rim_tint , clearcoat , clearcoat_gloss , anisotropy , specular_blob_intensity , diffuse_light , specular_light ) ; <nl> } <nl> <nl> # endif / / USE_VERTEX_LIGHTING <nl> <nl> # endif <nl> <nl> - <nl> - <nl> - <nl> # ifdef RENDER_DEPTH <nl> / / nothing happens , so a tree - ssa optimizer will result in no fragment shader : ) <nl> # else <nl> <nl> - specular_light * = reflection_multiplier ; <nl> - ambient_light * = albedo ; / / ambient must be multiplied by albedo at the end <nl> + specular_light * = reflection_multiplier ; <nl> + ambient_light * = albedo ; / / ambient must be multiplied by albedo at the end <nl> <nl> # if defined ( ENABLE_AO ) <nl> - ambient_light * = ao ; <nl> - ao_light_affect = mix ( 1 . 0 , ao , ao_light_affect ) ; <nl> - specular_light * = ao_light_affect ; <nl> - diffuse_light * = ao_light_affect ; <nl> + ambient_light * = ao ; <nl> + ao_light_affect = mix ( 1 . 0 , ao , ao_light_affect ) ; <nl> + specular_light * = ao_light_affect ; <nl> + diffuse_light * = ao_light_affect ; <nl> # endif <nl> <nl> - <nl> - <nl> / / energy conservation <nl> - diffuse_light * = 1 . 0 - metallic ; / / TODO : avoid all diffuse and ambient light calculations when metallic = = 1 up to this point <nl> - ambient_light * = 1 . 0 - metallic ; <nl> - <nl> + diffuse_light * = 1 . 0 - metallic ; / / TODO : avoid all diffuse and ambient light calculations when metallic = = 1 up to this point <nl> + ambient_light * = 1 . 0 - metallic ; <nl> <nl> { <nl> <nl> FRAGMENT_SHADER_CODE <nl> / / Environment brdf approximation ( Lazarov 2013 ) <nl> / / see https : / / www . unrealengine . com / en - US / blog / physically - based - shading - on - mobile <nl> const vec4 c0 = vec4 ( - 1 . 0 , - 0 . 0275 , - 0 . 572 , 0 . 022 ) ; <nl> - const vec4 c1 = vec4 ( 1 . 0 , 0 . 0425 , 1 . 04 , - 0 . 04 ) ; <nl> + const vec4 c1 = vec4 ( 1 . 0 , 0 . 0425 , 1 . 04 , - 0 . 04 ) ; <nl> vec4 r = roughness * c0 + c1 ; <nl> - float ndotv = clamp ( dot ( normal , eye_vec ) , 0 . 0 , 1 . 0 ) ; <nl> - float a004 = min ( r . x * r . x , exp2 ( - 9 . 28 * ndotv ) ) * r . x + r . y ; <nl> - vec2 AB = vec2 ( - 1 . 04 , 1 . 04 ) * a004 + r . zw ; <nl> + float ndotv = clamp ( dot ( normal , eye_vec ) , 0 . 0 , 1 . 0 ) ; <nl> + float a004 = min ( r . x * r . x , exp2 ( - 9 . 28 * ndotv ) ) * r . x + r . y ; <nl> + vec2 AB = vec2 ( - 1 . 04 , 1 . 04 ) * a004 + r . zw ; <nl> <nl> vec3 specular_color = metallic_to_specular_color ( metallic , specular , albedo ) ; <nl> specular_light * = AB . x * specular_color + AB . y ; <nl> # endif <nl> - <nl> } <nl> <nl> if ( fog_color_enabled . a > 0 . 5 ) { <nl> <nl> - float fog_amount = 0 . 0 ; <nl> - <nl> - <nl> + float fog_amount = 0 . 0 ; <nl> <nl> # ifdef USE_LIGHT_DIRECTIONAL <nl> <nl> - vec3 fog_color = mix ( fog_color_enabled . rgb , fog_sun_color_amount . rgb , fog_sun_color_amount . a * pow ( max ( dot ( normalize ( vertex ) , - light_direction_attenuation . xyz ) , 0 . 0 ) , 8 . 0 ) ) ; <nl> + vec3 fog_color = mix ( fog_color_enabled . rgb , fog_sun_color_amount . rgb , fog_sun_color_amount . a * pow ( max ( dot ( normalize ( vertex ) , - light_direction_attenuation . xyz ) , 0 . 0 ) , 8 . 0 ) ) ; <nl> # else <nl> <nl> vec3 fog_color = fog_color_enabled . rgb ; <nl> FRAGMENT_SHADER_CODE <nl> <nl> if ( fog_depth_enabled ) { <nl> <nl> - float fog_z = smoothstep ( fog_depth_begin , z_far , length ( vertex ) ) ; <nl> + float fog_z = smoothstep ( fog_depth_begin , z_far , length ( vertex ) ) ; <nl> <nl> - fog_amount = pow ( fog_z , fog_depth_curve ) ; <nl> + fog_amount = pow ( fog_z , fog_depth_curve ) ; <nl> if ( fog_transmit_enabled ) { <nl> vec3 total_light = emission + ambient_light + specular_light + diffuse_light ; <nl> - float transmit = pow ( fog_z , fog_transmit_curve ) ; <nl> - fog_color = mix ( max ( total_light , fog_color ) , fog_color , transmit ) ; <nl> + float transmit = pow ( fog_z , fog_transmit_curve ) ; <nl> + fog_color = mix ( max ( total_light , fog_color ) , fog_color , transmit ) ; <nl> } <nl> } <nl> <nl> if ( fog_height_enabled ) { <nl> - float y = ( camera_matrix * vec4 ( vertex , 1 . 0 ) ) . y ; <nl> - fog_amount = max ( fog_amount , pow ( smoothstep ( fog_height_min , fog_height_max , y ) , fog_height_curve ) ) ; <nl> + float y = ( camera_matrix * vec4 ( vertex , 1 . 0 ) ) . y ; <nl> + fog_amount = max ( fog_amount , pow ( smoothstep ( fog_height_min , fog_height_max , y ) , fog_height_curve ) ) ; <nl> } <nl> <nl> float rev_amount = 1 . 0 - fog_amount ; <nl> <nl> - <nl> emission = emission * rev_amount + fog_color * fog_amount ; <nl> - ambient_light * = rev_amount ; <nl> - specular_light * rev_amount ; <nl> - diffuse_light * = rev_amount ; <nl> - <nl> + ambient_light * = rev_amount ; <nl> + specular_light * rev_amount ; <nl> + diffuse_light * = rev_amount ; <nl> } <nl> <nl> # ifdef USE_MULTIPLE_RENDER_TARGETS <nl> <nl> - <nl> # ifdef SHADELESS <nl> - diffuse_buffer = vec4 ( albedo . rgb , 0 . 0 ) ; <nl> - specular_buffer = vec4 ( 0 . 0 ) ; <nl> + diffuse_buffer = vec4 ( albedo . rgb , 0 . 0 ) ; <nl> + specular_buffer = vec4 ( 0 . 0 ) ; <nl> <nl> # else <nl> <nl> - <nl> - <nl> / / approximate ambient scale for SSAO , since we will lack full ambient <nl> - float max_emission = max ( emission . r , max ( emission . g , emission . b ) ) ; <nl> - float max_ambient = max ( ambient_light . r , max ( ambient_light . g , ambient_light . b ) ) ; <nl> - float max_diffuse = max ( diffuse_light . r , max ( diffuse_light . g , diffuse_light . b ) ) ; <nl> - float total_ambient = max_ambient + max_diffuse + max_emission ; <nl> - float ambient_scale = ( total_ambient > 0 . 0 ) ? ( max_ambient + ambient_occlusion_affect_light * max_diffuse ) / total_ambient : 0 . 0 ; <nl> + float max_emission = max ( emission . r , max ( emission . g , emission . b ) ) ; <nl> + float max_ambient = max ( ambient_light . r , max ( ambient_light . g , ambient_light . b ) ) ; <nl> + float max_diffuse = max ( diffuse_light . r , max ( diffuse_light . g , diffuse_light . b ) ) ; <nl> + float total_ambient = max_ambient + max_diffuse + max_emission ; <nl> + float ambient_scale = ( total_ambient > 0 . 0 ) ? ( max_ambient + ambient_occlusion_affect_light * max_diffuse ) / total_ambient : 0 . 0 ; <nl> <nl> # if defined ( ENABLE_AO ) <nl> - ambient_scale = mix ( 0 . 0 , ambient_scale , ambient_occlusion_affect_ao_channel ) ; <nl> + ambient_scale = mix ( 0 . 0 , ambient_scale , ambient_occlusion_affect_ao_channel ) ; <nl> # endif <nl> - diffuse_buffer = vec4 ( emission + diffuse_light + ambient_light , ambient_scale ) ; <nl> - specular_buffer = vec4 ( specular_light , metallic ) ; <nl> + diffuse_buffer = vec4 ( emission + diffuse_light + ambient_light , ambient_scale ) ; <nl> + specular_buffer = vec4 ( specular_light , metallic ) ; <nl> <nl> # endif / / SHADELESS <nl> <nl> - normal_mr_buffer = vec4 ( normalize ( normal ) * 0 . 5 + 0 . 5 , roughness ) ; <nl> + normal_mr_buffer = vec4 ( normalize ( normal ) * 0 . 5 + 0 . 5 , roughness ) ; <nl> <nl> - # if defined ( ENABLE_SSS ) <nl> + # if defined ( ENABLE_SSS ) <nl> sss_buffer = sss_strength ; <nl> # endif <nl> <nl> - <nl> # else / / USE_MULTIPLE_RENDER_TARGETS <nl> <nl> - <nl> # ifdef SHADELESS <nl> - frag_color = vec4 ( albedo , alpha ) ; <nl> + frag_color = vec4 ( albedo , alpha ) ; <nl> # else <nl> - frag_color = vec4 ( emission + ambient_light + diffuse_light + specular_light , alpha ) ; <nl> + frag_color = vec4 ( emission + ambient_light + diffuse_light + specular_light , alpha ) ; <nl> # endif / / SHADELESS <nl> <nl> # endif / / USE_MULTIPLE_RENDER_TARGETS <nl> <nl> - <nl> - <nl> # endif / / RENDER_DEPTH <nl> - <nl> - <nl> } <nl> mmm a / drivers / gles3 / shaders / screen_space_reflection . glsl <nl> ppp b / drivers / gles3 / shaders / screen_space_reflection . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - layout ( location = 4 ) in vec2 uv_in ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_in ; <nl> <nl> out vec2 uv_interp ; <nl> out vec2 pos_interp ; <nl> void main ( ) { <nl> <nl> uv_interp = uv_in ; <nl> gl_Position = vertex_attrib ; <nl> - pos_interp . xy = gl_Position . xy ; <nl> + pos_interp . xy = gl_Position . xy ; <nl> } <nl> <nl> [ fragment ] <nl> <nl> - <nl> in vec2 uv_interp ; <nl> in vec2 pos_interp ; <nl> <nl> uniform float depth_tolerance ; <nl> uniform float distance_fade ; <nl> uniform float curve_fade_in ; <nl> <nl> - <nl> layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> - <nl> - vec2 view_to_screen ( vec3 view_pos , out float w ) { <nl> - vec4 projected = projection * vec4 ( view_pos , 1 . 0 ) ; <nl> - projected . xyz / = projected . w ; <nl> - projected . xy = projected . xy * 0 . 5 + 0 . 5 ; <nl> - w = projected . w ; <nl> - return projected . xy ; <nl> + vec2 view_to_screen ( vec3 view_pos , out float w ) { <nl> + vec4 projected = projection * vec4 ( view_pos , 1 . 0 ) ; <nl> + projected . xyz / = projected . w ; <nl> + projected . xy = projected . xy * 0 . 5 + 0 . 5 ; <nl> + w = projected . w ; <nl> + return projected . xy ; <nl> } <nl> <nl> - <nl> - <nl> # define M_PI 3 . 14159265359 <nl> <nl> void main ( ) { <nl> <nl> - <nl> - / / / / <nl> - <nl> - vec4 diffuse = texture ( source_diffuse , uv_interp ) ; <nl> - vec4 normal_roughness = texture ( source_normal_roughness , uv_interp ) ; <nl> + vec4 diffuse = texture ( source_diffuse , uv_interp ) ; <nl> + vec4 normal_roughness = texture ( source_normal_roughness , uv_interp ) ; <nl> <nl> vec3 normal ; <nl> - <nl> - normal = normal_roughness . xyz * 2 . 0 - 1 . 0 ; <nl> + normal = normal_roughness . xyz * 2 . 0 - 1 . 0 ; <nl> <nl> float roughness = normal_roughness . w ; <nl> <nl> - float depth_tex = texture ( source_depth , uv_interp ) . r ; <nl> + float depth_tex = texture ( source_depth , uv_interp ) . r ; <nl> <nl> - vec4 world_pos = inverse_projection * vec4 ( uv_interp * 2 . 0 - 1 . 0 , depth_tex * 2 . 0 - 1 . 0 , 1 . 0 ) ; <nl> - vec3 vertex = world_pos . xyz / world_pos . w ; <nl> + vec4 world_pos = inverse_projection * vec4 ( uv_interp * 2 . 0 - 1 . 0 , depth_tex * 2 . 0 - 1 . 0 , 1 . 0 ) ; <nl> + vec3 vertex = world_pos . xyz / world_pos . w ; <nl> <nl> vec3 view_dir = normalize ( vertex ) ; <nl> vec3 ray_dir = normalize ( reflect ( view_dir , normal ) ) ; <nl> <nl> - if ( dot ( ray_dir , normal ) < 0 . 001 ) { <nl> - frag_color = vec4 ( 0 . 0 ) ; <nl> + if ( dot ( ray_dir , normal ) < 0 . 001 ) { <nl> + frag_color = vec4 ( 0 . 0 ) ; <nl> return ; <nl> } <nl> / / ray_dir = normalize ( view_dir - normal * dot ( normal , view_dir ) * 2 . 0 ) ; <nl> - <nl> - / / ray_dir = normalize ( vec3 ( 1 , 1 , - 1 ) ) ; <nl> - <nl> + / / ray_dir = normalize ( vec3 ( 1 , 1 , - 1 ) ) ; <nl> <nl> / / / / / / / / / / / / / / / / <nl> <nl> - <nl> - / / make ray length and clip it against the near plane ( don ' t want to trace beyond visible ) <nl> + / / make ray length and clip it against the near plane ( don ' t want to trace beyond visible ) <nl> float ray_len = ( vertex . z + ray_dir . z * camera_z_far ) > - camera_z_near ? ( - camera_z_near - vertex . z ) / ray_dir . z : camera_z_far ; <nl> - vec3 ray_end = vertex + ray_dir * ray_len ; <nl> + vec3 ray_end = vertex + ray_dir * ray_len ; <nl> <nl> float w_begin ; <nl> - vec2 vp_line_begin = view_to_screen ( vertex , w_begin ) ; <nl> + vec2 vp_line_begin = view_to_screen ( vertex , w_begin ) ; <nl> float w_end ; <nl> - vec2 vp_line_end = view_to_screen ( ray_end , w_end ) ; <nl> - vec2 vp_line_dir = vp_line_end - vp_line_begin ; <nl> - <nl> - / / we need to interpolate w along the ray , to generate perspective correct reflections <nl> - <nl> - w_begin = 1 . 0 / w_begin ; <nl> - w_end = 1 . 0 / w_end ; <nl> + vec2 vp_line_end = view_to_screen ( ray_end , w_end ) ; <nl> + vec2 vp_line_dir = vp_line_end - vp_line_begin ; <nl> <nl> + / / we need to interpolate w along the ray , to generate perspective correct reflections <nl> + w_begin = 1 . 0 / w_begin ; <nl> + w_end = 1 . 0 / w_end ; <nl> <nl> - float z_begin = vertex . z * w_begin ; <nl> - float z_end = ray_end . z * w_end ; <nl> + float z_begin = vertex . z * w_begin ; <nl> + float z_end = ray_end . z * w_end ; <nl> <nl> - vec2 line_begin = vp_line_begin / pixel_size ; <nl> - vec2 line_dir = vp_line_dir / pixel_size ; <nl> + vec2 line_begin = vp_line_begin / pixel_size ; <nl> + vec2 line_dir = vp_line_dir / pixel_size ; <nl> float z_dir = z_end - z_begin ; <nl> float w_dir = w_end - w_begin ; <nl> <nl> - <nl> / / clip the line to the viewport edges <nl> <nl> float scale_max_x = min ( 1 . 0 , 0 . 99 * ( 1 . 0 - vp_line_begin . x ) / max ( 1e - 5 , vp_line_dir . x ) ) ; <nl> void main ( ) { <nl> float line_clip = min ( scale_max_x , scale_max_y ) * min ( scale_min_x , scale_min_y ) ; <nl> line_dir * = line_clip ; <nl> z_dir * = line_clip ; <nl> - w_dir * = line_clip ; <nl> + w_dir * = line_clip ; <nl> <nl> - / / clip z and w advance to line advance <nl> - vec2 line_advance = normalize ( line_dir ) ; / / down to pixel <nl> - float step_size = length ( line_advance ) / length ( line_dir ) ; <nl> - float z_advance = z_dir * step_size ; / / adapt z advance to line advance <nl> - float w_advance = w_dir * step_size ; / / adapt w advance to line advance <nl> + / / clip z and w advance to line advance <nl> + vec2 line_advance = normalize ( line_dir ) ; / / down to pixel <nl> + float step_size = length ( line_advance ) / length ( line_dir ) ; <nl> + float z_advance = z_dir * step_size ; / / adapt z advance to line advance <nl> + float w_advance = w_dir * step_size ; / / adapt w advance to line advance <nl> <nl> - / / make line advance faster if direction is closer to pixel edges ( this avoids sampling the same pixel twice ) <nl> - float advance_angle_adj = 1 . 0 / max ( abs ( line_advance . x ) , abs ( line_advance . y ) ) ; <nl> - line_advance * = advance_angle_adj ; / / adapt z advance to line advance <nl> - z_advance * = advance_angle_adj ; <nl> - w_advance * = advance_angle_adj ; <nl> + / / make line advance faster if direction is closer to pixel edges ( this avoids sampling the same pixel twice ) <nl> + float advance_angle_adj = 1 . 0 / max ( abs ( line_advance . x ) , abs ( line_advance . y ) ) ; <nl> + line_advance * = advance_angle_adj ; / / adapt z advance to line advance <nl> + z_advance * = advance_angle_adj ; <nl> + w_advance * = advance_angle_adj ; <nl> <nl> vec2 pos = line_begin ; <nl> float z = z_begin ; <nl> float w = w_begin ; <nl> - float z_from = z / w ; <nl> - float z_to = z_from ; <nl> + float z_from = z / w ; <nl> + float z_to = z_from ; <nl> float depth ; <nl> - vec2 prev_pos = pos ; <nl> + vec2 prev_pos = pos ; <nl> <nl> - bool found = false ; <nl> + bool found = false ; <nl> <nl> - float steps_taken = 0 . 0 ; <nl> + float steps_taken = 0 . 0 ; <nl> <nl> - for ( int i = 0 ; i < num_steps ; i + + ) { <nl> + for ( int i = 0 ; i < num_steps ; i + + ) { <nl> <nl> - pos + = line_advance ; <nl> - z + = z_advance ; <nl> - w + = w_advance ; <nl> + pos + = line_advance ; <nl> + z + = z_advance ; <nl> + w + = w_advance ; <nl> <nl> - / / convert to linear depth <nl> + / / convert to linear depth <nl> <nl> - depth = texture ( source_depth , pos * pixel_size ) . r * 2 . 0 - 1 . 0 ; <nl> + depth = texture ( source_depth , pos * pixel_size ) . r * 2 . 0 - 1 . 0 ; <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - depth = ( ( depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + depth = ( ( depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> depth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - depth * ( camera_z_far - camera_z_near ) ) ; <nl> # endif <nl> - depth = - depth ; <nl> + depth = - depth ; <nl> <nl> z_from = z_to ; <nl> - z_to = z / w ; <nl> + z_to = z / w ; <nl> <nl> - if ( depth > z_to ) { <nl> - / / if depth was surpassed <nl> - if ( depth < = max ( z_to , z_from ) + depth_tolerance ) { <nl> - / / check the depth tolerance <nl> - found = true ; <nl> + if ( depth > z_to ) { <nl> + / / if depth was surpassed <nl> + if ( depth < = max ( z_to , z_from ) + depth_tolerance ) { <nl> + / / check the depth tolerance <nl> + found = true ; <nl> } <nl> break ; <nl> } <nl> <nl> - steps_taken + = 1 . 0 ; <nl> - prev_pos = pos ; <nl> + steps_taken + = 1 . 0 ; <nl> + prev_pos = pos ; <nl> } <nl> <nl> - <nl> - <nl> - <nl> if ( found ) { <nl> <nl> - float margin_blend = 1 . 0 ; <nl> + float margin_blend = 1 . 0 ; <nl> <nl> - <nl> - vec2 margin = vec2 ( ( viewport_size . x + viewport_size . y ) * 0 . 5 * 0 . 05 ) ; / / make a uniform margin <nl> - if ( any ( bvec4 ( lessThan ( pos , - margin ) , greaterThan ( pos , viewport_size + margin ) ) ) ) { <nl> - / / clip outside screen + margin <nl> - frag_color = vec4 ( 0 . 0 ) ; <nl> + vec2 margin = vec2 ( ( viewport_size . x + viewport_size . y ) * 0 . 5 * 0 . 05 ) ; / / make a uniform margin <nl> + if ( any ( bvec4 ( lessThan ( pos , - margin ) , greaterThan ( pos , viewport_size + margin ) ) ) ) { <nl> + / / clip outside screen + margin <nl> + frag_color = vec4 ( 0 . 0 ) ; <nl> return ; <nl> } <nl> <nl> { <nl> / / blend fading out towards external margin <nl> - vec2 margin_grad = mix ( pos - viewport_size , - pos , lessThan ( pos , vec2 ( 0 . 0 ) ) ) ; <nl> - margin_blend = 1 . 0 - smoothstep ( 0 . 0 , margin . x , max ( margin_grad . x , margin_grad . y ) ) ; <nl> - / / margin_blend = 1 . 0 ; <nl> - <nl> + vec2 margin_grad = mix ( pos - viewport_size , - pos , lessThan ( pos , vec2 ( 0 . 0 ) ) ) ; <nl> + margin_blend = 1 . 0 - smoothstep ( 0 . 0 , margin . x , max ( margin_grad . x , margin_grad . y ) ) ; <nl> + / / margin_blend = 1 . 0 ; <nl> } <nl> <nl> vec2 final_pos ; <nl> float grad ; <nl> - grad = steps_taken / float ( num_steps ) ; <nl> - float initial_fade = curve_fade_in = = 0 . 0 ? 1 . 0 : pow ( clamp ( grad , 0 . 0 , 1 . 0 ) , curve_fade_in ) ; <nl> - float fade = pow ( clamp ( 1 . 0 - grad , 0 . 0 , 1 . 0 ) , distance_fade ) * initial_fade ; <nl> - final_pos = pos ; <nl> - <nl> - <nl> - <nl> - <nl> - <nl> - <nl> + grad = steps_taken / float ( num_steps ) ; <nl> + float initial_fade = curve_fade_in = = 0 . 0 ? 1 . 0 : pow ( clamp ( grad , 0 . 0 , 1 . 0 ) , curve_fade_in ) ; <nl> + float fade = pow ( clamp ( 1 . 0 - grad , 0 . 0 , 1 . 0 ) , distance_fade ) * initial_fade ; <nl> + final_pos = pos ; <nl> <nl> # ifdef REFLECT_ROUGHNESS <nl> <nl> - <nl> vec4 final_color ; <nl> - / / if roughness is enabled , do screen space cone tracing <nl> + / / if roughness is enabled , do screen space cone tracing <nl> if ( roughness > 0 . 001 ) { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / use a blurred version ( in consecutive mipmaps ) of the screen to simulate roughness <nl> + / / use a blurred version ( in consecutive mipmaps ) of the screen to simulate roughness <nl> <nl> - float gloss = 1 . 0 - roughness ; <nl> + float gloss = 1 . 0 - roughness ; <nl> float cone_angle = roughness * M_PI * 0 . 5 ; <nl> vec2 cone_dir = final_pos - line_begin ; <nl> float cone_len = length ( cone_dir ) ; <nl> - cone_dir = normalize ( cone_dir ) ; / / will be used normalized from now on <nl> + cone_dir = normalize ( cone_dir ) ; / / will be used normalized from now on <nl> float max_mipmap = filter_mipmap_levels - 1 . 0 ; <nl> - float gloss_mult = gloss ; <nl> + float gloss_mult = gloss ; <nl> <nl> - float rem_alpha = 1 . 0 ; <nl> + float rem_alpha = 1 . 0 ; <nl> final_color = vec4 ( 0 . 0 ) ; <nl> <nl> - for ( int i = 0 ; i < 7 ; i + + ) { <nl> + for ( int i = 0 ; i < 7 ; i + + ) { <nl> <nl> - float op_len = 2 . 0 * tan ( cone_angle ) * cone_len ; / / opposite side of iso triangle <nl> + float op_len = 2 . 0 * tan ( cone_angle ) * cone_len ; / / opposite side of iso triangle <nl> float radius ; <nl> { <nl> - / / fit to sphere inside cone ( sphere ends at end of cone ) , something like this : <nl> + / / fit to sphere inside cone ( sphere ends at end of cone ) , something like this : <nl> / / ___ <nl> / / \ O / <nl> / / V <nl> void main ( ) { <nl> radius = ( a * ( sqrt ( a2 + fh2 ) - a ) ) / ( 4 . 0f * h ) ; <nl> } <nl> <nl> - / / find the place where screen must be sampled <nl> - vec2 sample_pos = ( line_begin + cone_dir * ( cone_len - radius ) ) * pixel_size ; <nl> - / / radius is in pixels , so it ' s natural that log2 ( radius ) maps to the right mipmap for the amount of pixels <nl> - float mipmap = clamp ( log2 ( radius ) , 0 . 0 , max_mipmap ) ; <nl> + / / find the place where screen must be sampled <nl> + vec2 sample_pos = ( line_begin + cone_dir * ( cone_len - radius ) ) * pixel_size ; <nl> + / / radius is in pixels , so it ' s natural that log2 ( radius ) maps to the right mipmap for the amount of pixels <nl> + float mipmap = clamp ( log2 ( radius ) , 0 . 0 , max_mipmap ) ; <nl> + / / mipmap = max ( mipmap - 1 . 0 , 0 . 0 ) ; <nl> <nl> - / / mipmap = max ( mipmap - 1 . 0 , 0 . 0 ) ; <nl> - / / do sampling <nl> + / / do sampling <nl> <nl> vec4 sample_color ; <nl> { <nl> - sample_color = textureLod ( source_diffuse , sample_pos , mipmap ) ; <nl> + sample_color = textureLod ( source_diffuse , sample_pos , mipmap ) ; <nl> } <nl> <nl> - / / multiply by gloss <nl> - sample_color . rgb * = gloss_mult ; <nl> - sample_color . a = gloss_mult ; <nl> + / / multiply by gloss <nl> + sample_color . rgb * = gloss_mult ; <nl> + sample_color . a = gloss_mult ; <nl> <nl> rem_alpha - = sample_color . a ; <nl> - if ( rem_alpha < 0 . 0 ) { <nl> + if ( rem_alpha < 0 . 0 ) { <nl> sample_color . rgb * = ( 1 . 0 - abs ( rem_alpha ) ) ; <nl> } <nl> <nl> - final_color + = sample_color ; <nl> + final_color + = sample_color ; <nl> <nl> - if ( final_color . a > = 0 . 95 ) { <nl> + if ( final_color . a > = 0 . 95 ) { <nl> / / This code of accumulating gloss and aborting on near one <nl> / / makes sense when you think of cone tracing . <nl> / / Think of it as if roughness was 0 , then we could abort on the first <nl> void main ( ) { <nl> break ; <nl> } <nl> <nl> - cone_len - = radius * 2 . 0 ; / / go to next ( smaller ) circle . <nl> - <nl> - gloss_mult * = gloss ; <nl> - <nl> + cone_len - = radius * 2 . 0 ; / / go to next ( smaller ) circle . <nl> <nl> + gloss_mult * = gloss ; <nl> } <nl> } else { <nl> - final_color = textureLod ( source_diffuse , final_pos * pixel_size , 0 . 0 ) ; <nl> + final_color = textureLod ( source_diffuse , final_pos * pixel_size , 0 . 0 ) ; <nl> } <nl> <nl> - frag_color = vec4 ( final_color . rgb , fade * margin_blend ) ; <nl> + frag_color = vec4 ( final_color . rgb , fade * margin_blend ) ; <nl> <nl> # else <nl> - frag_color = vec4 ( textureLod ( source_diffuse , final_pos * pixel_size , 0 . 0 ) . rgb , fade * margin_blend ) ; <nl> + frag_color = vec4 ( textureLod ( source_diffuse , final_pos * pixel_size , 0 . 0 ) . rgb , fade * margin_blend ) ; <nl> # endif <nl> <nl> - <nl> - <nl> } else { <nl> - frag_color = vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> + frag_color = vec4 ( 0 . 0 , 0 . 0 , 0 . 0 , 0 . 0 ) ; <nl> } <nl> - <nl> - <nl> - <nl> } <nl> - <nl> mmm a / drivers / gles3 / shaders / ssao . glsl <nl> ppp b / drivers / gles3 / shaders / ssao . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> <nl> void main ( ) { <nl> <nl> gl_Position = vertex_attrib ; <nl> - gl_Position . z = 1 . 0 ; <nl> + gl_Position . z = 1 . 0 ; <nl> } <nl> <nl> [ fragment ] <nl> void main ( ) { <nl> # define TWO_PI 6 . 283185307179586476925286766559 <nl> <nl> # ifdef SSAO_QUALITY_HIGH <nl> - <nl> # define NUM_SAMPLES ( 80 ) <nl> - <nl> # endif <nl> <nl> # ifdef SSAO_QUALITY_LOW <nl> - <nl> # define NUM_SAMPLES ( 15 ) <nl> - <nl> # endif <nl> <nl> # if ! defined ( SSAO_QUALITY_LOW ) & & ! defined ( SSAO_QUALITY_HIGH ) <nl> - <nl> # define NUM_SAMPLES ( 40 ) <nl> - <nl> # endif <nl> <nl> / / If using depth mip levels , the log of the maximum pixel offset before we need to switch to a lower <nl> void main ( ) { <nl> / / This is the number of turns around the circle that the spiral pattern makes . This should be prime to prevent <nl> / / taps from lining up . This particular choice was tuned for NUM_SAMPLES = = 9 <nl> <nl> - const int ROTATIONS [ ] = int [ ] ( 1 , 1 , 2 , 3 , 2 , 5 , 2 , 3 , 2 , <nl> - 3 , 3 , 5 , 5 , 3 , 4 , 7 , 5 , 5 , 7 , <nl> - 9 , 8 , 5 , 5 , 7 , 7 , 7 , 8 , 5 , 8 , <nl> - 11 , 12 , 7 , 10 , 13 , 8 , 11 , 8 , 7 , 14 , <nl> - 11 , 11 , 13 , 12 , 13 , 19 , 17 , 13 , 11 , 18 , <nl> - 19 , 11 , 11 , 14 , 17 , 21 , 15 , 16 , 17 , 18 , <nl> - 13 , 17 , 11 , 17 , 19 , 18 , 25 , 18 , 19 , 19 , <nl> - 29 , 21 , 19 , 27 , 31 , 29 , 21 , 18 , 17 , 29 , <nl> - 31 , 31 , 23 , 18 , 25 , 26 , 25 , 23 , 19 , 34 , <nl> - 19 , 27 , 21 , 25 , 39 , 29 , 17 , 21 , 27 ) ; <nl> + const int ROTATIONS [ ] = int [ ] ( <nl> + 1 , 1 , 2 , 3 , 2 , 5 , 2 , 3 , 2 , <nl> + 3 , 3 , 5 , 5 , 3 , 4 , 7 , 5 , 5 , 7 , <nl> + 9 , 8 , 5 , 5 , 7 , 7 , 7 , 8 , 5 , 8 , <nl> + 11 , 12 , 7 , 10 , 13 , 8 , 11 , 8 , 7 , 14 , <nl> + 11 , 11 , 13 , 12 , 13 , 19 , 17 , 13 , 11 , 18 , <nl> + 19 , 11 , 11 , 14 , 17 , 21 , 15 , 16 , 17 , 18 , <nl> + 13 , 17 , 11 , 17 , 19 , 18 , 25 , 18 , 19 , 19 , <nl> + 29 , 21 , 19 , 27 , 31 , 29 , 21 , 18 , 17 , 29 , <nl> + 31 , 31 , 23 , 18 , 25 , 26 , 25 , 23 , 19 , 34 , <nl> + 19 , 27 , 21 , 25 , 39 , 29 , 17 , 21 , 27 <nl> + ) ; <nl> <nl> / / # define NUM_SPIRAL_TURNS ( 7 ) <nl> - const int NUM_SPIRAL_TURNS = ROTATIONS [ NUM_SAMPLES - 1 ] ; <nl> + const int NUM_SPIRAL_TURNS = ROTATIONS [ NUM_SAMPLES - 1 ] ; <nl> <nl> uniform sampler2D source_depth ; / / texunit : 0 <nl> uniform highp usampler2D source_depth_mipmaps ; / / texunit : 1 <nl> vec3 reconstructCSPosition ( vec2 S , float z ) { <nl> } <nl> <nl> vec3 getPosition ( ivec2 ssP ) { <nl> - vec3 P ; <nl> - P . z = texelFetch ( source_depth , ssP , 0 ) . r ; <nl> + vec3 P ; <nl> + P . z = texelFetch ( source_depth , ssP , 0 ) . r ; <nl> <nl> - P . z = P . z * 2 . 0 - 1 . 0 ; <nl> + P . z = P . z * 2 . 0 - 1 . 0 ; <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - P . z = ( ( P . z + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + P . z = ( ( P . z + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> - P . z = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - P . z * ( camera_z_far - camera_z_near ) ) ; <nl> + P . z = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - P . z * ( camera_z_far - camera_z_near ) ) ; <nl> # endif <nl> - P . z = - P . z ; <nl> + P . z = - P . z ; <nl> <nl> - / / Offset to pixel center <nl> - P = reconstructCSPosition ( vec2 ( ssP ) + vec2 ( 0 . 5 ) , P . z ) ; <nl> - return P ; <nl> + / / Offset to pixel center <nl> + P = reconstructCSPosition ( vec2 ( ssP ) + vec2 ( 0 . 5 ) , P . z ) ; <nl> + return P ; <nl> } <nl> <nl> / * * Reconstructs screen - space unit normal from screen - space position * / <nl> vec3 reconstructCSFaceNormal ( vec3 C ) { <nl> - return normalize ( cross ( dFdy ( C ) , dFdx ( C ) ) ) ; <nl> + return normalize ( cross ( dFdy ( C ) , dFdx ( C ) ) ) ; <nl> } <nl> <nl> - <nl> - <nl> / * * Returns a unit vector and a screen - space radius for the tap on a unit disk ( the caller should scale by the actual disk radius ) * / <nl> - vec2 tapLocation ( int sampleNumber , float spinAngle , out float ssR ) { <nl> - / / Radius relative to ssR <nl> - float alpha = ( float ( sampleNumber ) + 0 . 5 ) * ( 1 . 0 / float ( NUM_SAMPLES ) ) ; <nl> - float angle = alpha * ( float ( NUM_SPIRAL_TURNS ) * 6 . 28 ) + spinAngle ; <nl> + vec2 tapLocation ( int sampleNumber , float spinAngle , out float ssR ) { <nl> + / / Radius relative to ssR <nl> + float alpha = ( float ( sampleNumber ) + 0 . 5 ) * ( 1 . 0 / float ( NUM_SAMPLES ) ) ; <nl> + float angle = alpha * ( float ( NUM_SPIRAL_TURNS ) * 6 . 28 ) + spinAngle ; <nl> <nl> - ssR = alpha ; <nl> - return vec2 ( cos ( angle ) , sin ( angle ) ) ; <nl> + ssR = alpha ; <nl> + return vec2 ( cos ( angle ) , sin ( angle ) ) ; <nl> } <nl> <nl> - <nl> / * * Read the camera - space position of the point at screen - space pixel ssP + unitOffset * ssR . Assumes length ( unitOffset ) = = 1 * / <nl> vec3 getOffsetPosition ( ivec2 ssC , vec2 unitOffset , float ssR ) { <nl> - / / Derivation : <nl> - / / mipLevel = floor ( log ( ssR / MAX_OFFSET ) ) ; <nl> + / / Derivation : <nl> + / / mipLevel = floor ( log ( ssR / MAX_OFFSET ) ) ; <nl> int mipLevel = clamp ( int ( floor ( log2 ( ssR ) ) ) - LOG_MAX_OFFSET , 0 , MAX_MIP_LEVEL ) ; <nl> <nl> ivec2 ssP = ivec2 ( ssR * unitOffset ) + ssC ; <nl> vec3 getOffsetPosition ( ivec2 ssC , vec2 unitOffset , float ssR ) { <nl> / / Manually clamp to the texture size because texelFetch bypasses the texture unit <nl> ivec2 mipP = clamp ( ssP > > mipLevel , ivec2 ( 0 ) , ( screen_size > > mipLevel ) - ivec2 ( 1 ) ) ; <nl> <nl> - <nl> if ( mipLevel < 1 ) { <nl> / / read from depth buffer <nl> P . z = texelFetch ( source_depth , mipP , 0 ) . r ; <nl> P . z = P . z * 2 . 0 - 1 . 0 ; <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - P . z = ( ( P . z + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + P . z = ( ( P . z + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> P . z = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - P . z * ( camera_z_far - camera_z_near ) ) ; <nl> - <nl> # endif <nl> P . z = - P . z ; <nl> <nl> } else { <nl> / / read from mipmaps <nl> - uint d = texelFetch ( source_depth_mipmaps , mipP , mipLevel - 1 ) . r ; <nl> - P . z = - ( float ( d ) / 65535 . 0 ) * camera_z_far ; <nl> + uint d = texelFetch ( source_depth_mipmaps , mipP , mipLevel - 1 ) . r ; <nl> + P . z = - ( float ( d ) / 65535 . 0 ) * camera_z_far ; <nl> } <nl> <nl> - <nl> / / Offset to pixel center <nl> P = reconstructCSPosition ( vec2 ( ssP ) + vec2 ( 0 . 5 ) , P . z ) ; <nl> <nl> return P ; <nl> } <nl> <nl> - <nl> - <nl> / * * Compute the occlusion due to sample with index \ a i about the pixel at \ a ssC that corresponds <nl> - to camera - space point \ a C with unit normal \ a n_C , using maximum screen - space sampling radius \ a ssDiskRadius <nl> + to camera - space point \ a C with unit normal \ a n_C , using maximum screen - space sampling radius \ a ssDiskRadius <nl> <nl> - Note that units of H ( ) in the HPG12 paper are meters , not <nl> - unitless . The whole falloff / sampling function is therefore <nl> - unitless . In this implementation , we factor out ( 9 / radius ) . <nl> + Note that units of H ( ) in the HPG12 paper are meters , not <nl> + unitless . The whole falloff / sampling function is therefore <nl> + unitless . In this implementation , we factor out ( 9 / radius ) . <nl> <nl> - Four versions of the falloff function are implemented below <nl> + Four versions of the falloff function are implemented below <nl> * / <nl> - float sampleAO ( in ivec2 ssC , in vec3 C , in vec3 n_C , in float ssDiskRadius , in float p_radius , in int tapIndex , in float randomPatternRotationAngle ) { <nl> - / / Offset on the unit disk , spun for this pixel <nl> - float ssR ; <nl> - vec2 unitOffset = tapLocation ( tapIndex , randomPatternRotationAngle , ssR ) ; <nl> - ssR * = ssDiskRadius ; <nl> + float sampleAO ( in ivec2 ssC , in vec3 C , in vec3 n_C , in float ssDiskRadius , in float p_radius , in int tapIndex , in float randomPatternRotationAngle ) { <nl> + / / Offset on the unit disk , spun for this pixel <nl> + float ssR ; <nl> + vec2 unitOffset = tapLocation ( tapIndex , randomPatternRotationAngle , ssR ) ; <nl> + ssR * = ssDiskRadius ; <nl> <nl> - / / The occluding point in camera space <nl> - vec3 Q = getOffsetPosition ( ssC , unitOffset , ssR ) ; <nl> + / / The occluding point in camera space <nl> + vec3 Q = getOffsetPosition ( ssC , unitOffset , ssR ) ; <nl> <nl> - vec3 v = Q - C ; <nl> + vec3 v = Q - C ; <nl> <nl> - float vv = dot ( v , v ) ; <nl> - float vn = dot ( v , n_C ) ; <nl> + float vv = dot ( v , v ) ; <nl> + float vn = dot ( v , n_C ) ; <nl> <nl> - const float epsilon = 0 . 01 ; <nl> - float radius2 = p_radius * p_radius ; <nl> + const float epsilon = 0 . 01 ; <nl> + float radius2 = p_radius * p_radius ; <nl> <nl> - / / A : From the HPG12 paper <nl> - / / Note large epsilon to avoid overdarkening within cracks <nl> - / / return float ( vv < radius2 ) * max ( ( vn - bias ) / ( epsilon + vv ) , 0 . 0 ) * radius2 * 0 . 6 ; <nl> + / / A : From the HPG12 paper <nl> + / / Note large epsilon to avoid overdarkening within cracks <nl> + / / return float ( vv < radius2 ) * max ( ( vn - bias ) / ( epsilon + vv ) , 0 . 0 ) * radius2 * 0 . 6 ; <nl> <nl> - / / B : Smoother transition to zero ( lowers contrast , smoothing out corners ) . [ Recommended ] <nl> - float f = max ( radius2 - vv , 0 . 0 ) ; <nl> - return f * f * f * max ( ( vn - bias ) / ( epsilon + vv ) , 0 . 0 ) ; <nl> + / / B : Smoother transition to zero ( lowers contrast , smoothing out corners ) . [ Recommended ] <nl> + float f = max ( radius2 - vv , 0 . 0 ) ; <nl> + return f * f * f * max ( ( vn - bias ) / ( epsilon + vv ) , 0 . 0 ) ; <nl> <nl> - / / C : Medium contrast ( which looks better at high radii ) , no division . Note that the <nl> - / / contribution still falls off with radius ^ 2 , but we ' ve adjusted the rate in a way that is <nl> - / / more computationally efficient and happens to be aesthetically pleasing . <nl> - / / return 4 . 0 * max ( 1 . 0 - vv * invRadius2 , 0 . 0 ) * max ( vn - bias , 0 . 0 ) ; <nl> + / / C : Medium contrast ( which looks better at high radii ) , no division . Note that the <nl> + / / contribution still falls off with radius ^ 2 , but we ' ve adjusted the rate in a way that is <nl> + / / more computationally efficient and happens to be aesthetically pleasing . <nl> + / / return 4 . 0 * max ( 1 . 0 - vv * invRadius2 , 0 . 0 ) * max ( vn - bias , 0 . 0 ) ; <nl> <nl> - / / D : Low contrast , no division operation <nl> - / / return 2 . 0 * float ( vv < radius * radius ) * max ( vn - bias , 0 . 0 ) ; <nl> + / / D : Low contrast , no division operation <nl> + / / return 2 . 0 * float ( vv < radius * radius ) * max ( vn - bias , 0 . 0 ) ; <nl> } <nl> <nl> - <nl> - <nl> void main ( ) { <nl> - <nl> - <nl> / / Pixel being shaded <nl> ivec2 ssC = ivec2 ( gl_FragCoord . xy ) ; <nl> <nl> / / World space point being shaded <nl> vec3 C = getPosition ( ssC ) ; <nl> <nl> - / * if ( C . z < = - camera_z_far * 0 . 999 ) { <nl> - / / We ' re on the skybox <nl> - visibility = 1 . 0 ; <nl> - return ; <nl> - } * / <nl> + / * <nl> + if ( C . z < = - camera_z_far * 0 . 999 ) { <nl> + / / We ' re on the skybox <nl> + visibility = 1 . 0 ; <nl> + return ; <nl> + } <nl> + * / <nl> <nl> - / / visibility = - C . z / camera_z_far ; <nl> + / / visibility = - C . z / camera_z_far ; <nl> / / return ; <nl> # if 0 <nl> - vec3 n_C = texelFetch ( source_normal , ssC , 0 ) . rgb * 2 . 0 - 1 . 0 ; <nl> + vec3 n_C = texelFetch ( source_normal , ssC , 0 ) . rgb * 2 . 0 - 1 . 0 ; <nl> # else <nl> vec3 n_C = reconstructCSFaceNormal ( C ) ; <nl> n_C = - n_C ; <nl> void main ( ) { <nl> # endif <nl> float sum = 0 . 0 ; <nl> for ( int i = 0 ; i < NUM_SAMPLES ; + + i ) { <nl> - sum + = sampleAO ( ssC , C , n_C , ssDiskRadius , radius , i , randomPatternRotationAngle ) ; <nl> + sum + = sampleAO ( ssC , C , n_C , ssDiskRadius , radius , i , randomPatternRotationAngle ) ; <nl> } <nl> <nl> float A = max ( 0 . 0 , 1 . 0 - sum * intensity_div_r6 * ( 5 . 0 / float ( NUM_SAMPLES ) ) ) ; <nl> void main ( ) { <nl> <nl> sum = 0 . 0 ; <nl> for ( int i = 0 ; i < NUM_SAMPLES ; + + i ) { <nl> - sum + = sampleAO ( ssC , C , n_C , ssDiskRadius , radius2 , i , randomPatternRotationAngle ) ; <nl> + sum + = sampleAO ( ssC , C , n_C , ssDiskRadius , radius2 , i , randomPatternRotationAngle ) ; <nl> } <nl> <nl> - A = min ( A , max ( 0 . 0 , 1 . 0 - sum * intensity_div_r62 * ( 5 . 0 / float ( NUM_SAMPLES ) ) ) ) ; <nl> + A = min ( A , max ( 0 . 0 , 1 . 0 - sum * intensity_div_r62 * ( 5 . 0 / float ( NUM_SAMPLES ) ) ) ) ; <nl> # endif <nl> / / Bilateral box - filter over a quad for free , respecting depth edges <nl> / / ( the difference that this makes is subtle ) <nl> void main ( ) { <nl> } <nl> <nl> visibility = A ; <nl> - <nl> } <nl> - <nl> - <nl> - <nl> mmm a / drivers / gles3 / shaders / ssao_blur . glsl <nl> ppp b / drivers / gles3 / shaders / ssao_blur . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> <nl> void main ( ) { <nl> <nl> gl_Position = vertex_attrib ; <nl> - gl_Position . z = 1 . 0 ; <nl> + gl_Position . z = 1 . 0 ; <nl> } <nl> <nl> [ fragment ] <nl> <nl> - <nl> uniform sampler2D source_ssao ; / / texunit : 0 <nl> uniform sampler2D source_depth ; / / texunit : 1 <nl> uniform sampler2D source_normal ; / / texunit : 3 <nl> <nl> - <nl> layout ( location = 0 ) out float visibility ; <nl> <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Tunable Parameters : <nl> <nl> layout ( location = 0 ) out float visibility ; <nl> uniform float edge_sharpness ; <nl> <nl> / * * Step in 2 - pixel intervals since we already blurred against neighbors in the <nl> - first AO pass . This constant can be increased while R decreases to improve <nl> - performance at the expense of some dithering artifacts . <nl> + first AO pass . This constant can be increased while R decreases to improve <nl> + performance at the expense of some dithering artifacts . <nl> <nl> - Morgan found that a scale of 3 left a 1 - pixel checkerboard grid that was <nl> - unobjectionable after shading was applied but eliminated most temporal incoherence <nl> - from using small numbers of sample taps . <nl> - * / <nl> + Morgan found that a scale of 3 left a 1 - pixel checkerboard grid that was <nl> + unobjectionable after shading was applied but eliminated most temporal incoherence <nl> + from using small numbers of sample taps . <nl> + * / <nl> <nl> uniform int filter_scale ; <nl> <nl> / * * Filter radius in pixels . This will be multiplied by SCALE . * / <nl> - # define R ( 4 ) <nl> + # define R ( 4 ) <nl> <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> uniform int filter_scale ; <nl> <nl> / / Gaussian coefficients <nl> const float gaussian [ R + 1 ] = <nl> - / / float [ ] ( 0 . 356642 , 0 . 239400 , 0 . 072410 , 0 . 009869 ) ; <nl> - / / float [ ] ( 0 . 398943 , 0 . 241971 , 0 . 053991 , 0 . 004432 , 0 . 000134 ) ; / / stddev = 1 . 0 <nl> - float [ ] ( 0 . 153170 , 0 . 144893 , 0 . 122649 , 0 . 092902 , 0 . 062970 ) ; / / stddev = 2 . 0 <nl> - / / float [ ] ( 0 . 111220 , 0 . 107798 , 0 . 098151 , 0 . 083953 , 0 . 067458 , 0 . 050920 , 0 . 036108 ) ; / / stddev = 3 . 0 <nl> + / / float [ ] ( 0 . 356642 , 0 . 239400 , 0 . 072410 , 0 . 009869 ) ; <nl> + / / float [ ] ( 0 . 398943 , 0 . 241971 , 0 . 053991 , 0 . 004432 , 0 . 000134 ) ; / / stddev = 1 . 0 <nl> + float [ ] ( 0 . 153170 , 0 . 144893 , 0 . 122649 , 0 . 092902 , 0 . 062970 ) ; / / stddev = 2 . 0 <nl> + / / float [ ] ( 0 . 111220 , 0 . 107798 , 0 . 098151 , 0 . 083953 , 0 . 067458 , 0 . 050920 , 0 . 036108 ) ; / / stddev = 3 . 0 <nl> <nl> - / * * ( 1 , 0 ) or ( 0 , 1 ) * / <nl> - uniform ivec2 axis ; <nl> + / * * ( 1 , 0 ) or ( 0 , 1 ) * / <nl> + uniform ivec2 axis ; <nl> <nl> uniform float camera_z_far ; <nl> uniform float camera_z_near ; <nl> void main ( ) { <nl> ivec2 ssC = ivec2 ( gl_FragCoord . xy ) ; <nl> <nl> float depth = texelFetch ( source_depth , ssC , 0 ) . r ; <nl> - / / vec3 normal = texelFetch ( source_normal , ssC , 0 ) . rgb * 2 . 0 - 1 . 0 ; <nl> + / / vec3 normal = texelFetch ( source_normal , ssC , 0 ) . rgb * 2 . 0 - 1 . 0 ; <nl> <nl> depth = depth * 2 . 0 - 1 . 0 ; <nl> depth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - depth * ( camera_z_far - camera_z_near ) ) ; <nl> <nl> float depth_divide = 1 . 0 / camera_z_far ; <nl> <nl> - / / depth * = depth_divide ; <nl> + / / depth * = depth_divide ; <nl> <nl> / * <nl> - if ( depth > camera_z_far * 0 . 999 ) { <nl> - discard ; / / skybox <nl> + if ( depth > camera_z_far * 0 . 999 ) { <nl> + discard ; / / skybox <nl> } <nl> * / <nl> <nl> void main ( ) { <nl> if ( r ! = 0 ) { <nl> <nl> ivec2 ppos = ssC + axis * ( r * filter_scale ) ; <nl> - float value = texelFetch ( source_ssao , clamp ( ppos , ivec2 ( 0 ) , clamp_limit ) , 0 ) . r ; <nl> - ivec2 rpos = clamp ( ppos , ivec2 ( 0 ) , clamp_limit ) ; <nl> + float value = texelFetch ( source_ssao , clamp ( ppos , ivec2 ( 0 ) , clamp_limit ) , 0 ) . r ; <nl> + ivec2 rpos = clamp ( ppos , ivec2 ( 0 ) , clamp_limit ) ; <nl> float temp_depth = texelFetch ( source_depth , rpos , 0 ) . r ; <nl> / / vec3 temp_normal = texelFetch ( source_normal , rpos , 0 ) . rgb * 2 . 0 - 1 . 0 ; <nl> <nl> temp_depth = temp_depth * 2 . 0 - 1 . 0 ; <nl> temp_depth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - temp_depth * ( camera_z_far - camera_z_near ) ) ; <nl> - / / temp_depth * = depth_divide ; <nl> + / / temp_depth * = depth_divide ; <nl> <nl> / / spatial domain : offset gaussian tap <nl> float weight = 0 . 3 + gaussian [ abs ( r ) ] ; <nl> - / / weight * = max ( 0 . 0 , dot ( temp_normal , normal ) ) ; <nl> + / / weight * = max ( 0 . 0 , dot ( temp_normal , normal ) ) ; <nl> <nl> / / range domain ( the " bilateral " weight ) . As depth difference increases , decrease weight . <nl> - weight * = max ( 0 . 0 , 1 . 0 <nl> - - edge_sharpness * abs ( temp_depth - depth ) <nl> - ) ; <nl> + weight * = max ( 0 . 0 , 1 . 0 - edge_sharpness * abs ( temp_depth - depth ) ) ; <nl> <nl> sum + = value * weight ; <nl> totalWeight + = weight ; <nl> mmm a / drivers / gles3 / shaders / ssao_minify . glsl <nl> ppp b / drivers / gles3 / shaders / ssao_minify . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> <nl> void main ( ) { <nl> <nl> void main ( ) { <nl> <nl> [ fragment ] <nl> <nl> - <nl> # ifdef MINIFY_START <nl> <nl> # define SDEPTH_TYPE highp sampler2D <nl> layout ( location = 0 ) out mediump uint depth ; <nl> <nl> void main ( ) { <nl> <nl> - <nl> ivec2 ssP = ivec2 ( gl_FragCoord . xy ) ; <nl> <nl> - / / Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling . <nl> - / / On DX9 , the bit - and can be implemented with floating - point modulo <nl> + / / Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling . <nl> + / / On DX9 , the bit - and can be implemented with floating - point modulo <nl> <nl> # ifdef MINIFY_START <nl> float fdepth = texelFetch ( source_depth , clamp ( ssP * 2 + ivec2 ( ssP . y & 1 , ssP . x & 1 ) , ivec2 ( 0 ) , from_size - ivec2 ( 1 ) ) , source_mipmap ) . r ; <nl> fdepth = fdepth * 2 . 0 - 1 . 0 ; <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - fdepth = ( ( fdepth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + fdepth = ( ( fdepth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> fdepth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - fdepth * ( camera_z_far - camera_z_near ) ) ; <nl> # endif <nl> fdepth / = camera_z_far ; <nl> - depth = uint ( clamp ( fdepth * 65535 . 0 , 0 . 0 , 65535 . 0 ) ) ; <nl> + depth = uint ( clamp ( fdepth * 65535 . 0 , 0 . 0 , 65535 . 0 ) ) ; <nl> <nl> # else <nl> depth = texelFetch ( source_depth , clamp ( ssP * 2 + ivec2 ( ssP . y & 1 , ssP . x & 1 ) , ivec2 ( 0 ) , from_size - ivec2 ( 1 ) ) , source_mipmap ) . r ; <nl> # endif <nl> - <nl> - <nl> } <nl> - <nl> - <nl> mmm a / drivers / gles3 / shaders / subsurf_scattering . glsl <nl> ppp b / drivers / gles3 / shaders / subsurf_scattering . glsl <nl> <nl> [ vertex ] <nl> <nl> - <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - layout ( location = 4 ) in vec2 uv_in ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_in ; <nl> <nl> out vec2 uv_interp ; <nl> <nl> - <nl> void main ( ) { <nl> <nl> uv_interp = uv_in ; <nl> void main ( ) { <nl> # define QUALIFIER const <nl> <nl> # ifdef USE_25_SAMPLES <nl> - <nl> - const int kernel_size = 25 ; <nl> + const int kernel_size = 25 ; <nl> QUALIFIER vec2 kernel [ 25 ] = vec2 [ ] ( <nl> - vec2 ( 0 . 530605 , 0 . 0 ) , <nl> - vec2 ( 0 . 000973794 , - 3 . 0 ) , <nl> - vec2 ( 0 . 00333804 , - 2 . 52083 ) , <nl> - vec2 ( 0 . 00500364 , - 2 . 08333 ) , <nl> - vec2 ( 0 . 00700976 , - 1 . 6875 ) , <nl> - vec2 ( 0 . 0094389 , - 1 . 33333 ) , <nl> - vec2 ( 0 . 0128496 , - 1 . 02083 ) , <nl> - vec2 ( 0 . 017924 , - 0 . 75 ) , <nl> - vec2 ( 0 . 0263642 , - 0 . 520833 ) , <nl> - vec2 ( 0 . 0410172 , - 0 . 333333 ) , <nl> - vec2 ( 0 . 0493588 , - 0 . 1875 ) , <nl> - vec2 ( 0 . 0402784 , - 0 . 0833333 ) , <nl> - vec2 ( 0 . 0211412 , - 0 . 0208333 ) , <nl> - vec2 ( 0 . 0211412 , 0 . 0208333 ) , <nl> - vec2 ( 0 . 0402784 , 0 . 0833333 ) , <nl> - vec2 ( 0 . 0493588 , 0 . 1875 ) , <nl> - vec2 ( 0 . 0410172 , 0 . 333333 ) , <nl> - vec2 ( 0 . 0263642 , 0 . 520833 ) , <nl> - vec2 ( 0 . 017924 , 0 . 75 ) , <nl> - vec2 ( 0 . 0128496 , 1 . 02083 ) , <nl> - vec2 ( 0 . 0094389 , 1 . 33333 ) , <nl> - vec2 ( 0 . 00700976 , 1 . 6875 ) , <nl> - vec2 ( 0 . 00500364 , 2 . 08333 ) , <nl> - vec2 ( 0 . 00333804 , 2 . 52083 ) , <nl> - vec2 ( 0 . 000973794 , 3 . 0 ) <nl> + vec2 ( 0 . 530605 , 0 . 0 ) , <nl> + vec2 ( 0 . 000973794 , - 3 . 0 ) , <nl> + vec2 ( 0 . 00333804 , - 2 . 52083 ) , <nl> + vec2 ( 0 . 00500364 , - 2 . 08333 ) , <nl> + vec2 ( 0 . 00700976 , - 1 . 6875 ) , <nl> + vec2 ( 0 . 0094389 , - 1 . 33333 ) , <nl> + vec2 ( 0 . 0128496 , - 1 . 02083 ) , <nl> + vec2 ( 0 . 017924 , - 0 . 75 ) , <nl> + vec2 ( 0 . 0263642 , - 0 . 520833 ) , <nl> + vec2 ( 0 . 0410172 , - 0 . 333333 ) , <nl> + vec2 ( 0 . 0493588 , - 0 . 1875 ) , <nl> + vec2 ( 0 . 0402784 , - 0 . 0833333 ) , <nl> + vec2 ( 0 . 0211412 , - 0 . 0208333 ) , <nl> + vec2 ( 0 . 0211412 , 0 . 0208333 ) , <nl> + vec2 ( 0 . 0402784 , 0 . 0833333 ) , <nl> + vec2 ( 0 . 0493588 , 0 . 1875 ) , <nl> + vec2 ( 0 . 0410172 , 0 . 333333 ) , <nl> + vec2 ( 0 . 0263642 , 0 . 520833 ) , <nl> + vec2 ( 0 . 017924 , 0 . 75 ) , <nl> + vec2 ( 0 . 0128496 , 1 . 02083 ) , <nl> + vec2 ( 0 . 0094389 , 1 . 33333 ) , <nl> + vec2 ( 0 . 00700976 , 1 . 6875 ) , <nl> + vec2 ( 0 . 00500364 , 2 . 08333 ) , <nl> + vec2 ( 0 . 00333804 , 2 . 52083 ) , <nl> + vec2 ( 0 . 000973794 , 3 . 0 ) <nl> ) ; <nl> - <nl> # endif / / USE_25_SAMPLES <nl> <nl> # ifdef USE_17_SAMPLES <nl> - <nl> - const int kernel_size = 17 ; <nl> - <nl> + const int kernel_size = 17 ; <nl> QUALIFIER vec2 kernel [ 17 ] = vec2 [ ] ( <nl> - vec2 ( 0 . 536343 , 0 . 0 ) , <nl> - vec2 ( 0 . 00317394 , - 2 . 0 ) , <nl> - vec2 ( 0 . 0100386 , - 1 . 53125 ) , <nl> - vec2 ( 0 . 0144609 , - 1 . 125 ) , <nl> - vec2 ( 0 . 0216301 , - 0 . 78125 ) , <nl> - vec2 ( 0 . 0347317 , - 0 . 5 ) , <nl> - vec2 ( 0 . 0571056 , - 0 . 28125 ) , <nl> - vec2 ( 0 . 0582416 , - 0 . 125 ) , <nl> - vec2 ( 0 . 0324462 , - 0 . 03125 ) , <nl> - vec2 ( 0 . 0324462 , 0 . 03125 ) , <nl> - vec2 ( 0 . 0582416 , 0 . 125 ) , <nl> - vec2 ( 0 . 0571056 , 0 . 28125 ) , <nl> - vec2 ( 0 . 0347317 , 0 . 5 ) , <nl> - vec2 ( 0 . 0216301 , 0 . 78125 ) , <nl> - vec2 ( 0 . 0144609 , 1 . 125 ) , <nl> - vec2 ( 0 . 0100386 , 1 . 53125 ) , <nl> - vec2 ( 0 . 00317394 , 2 . 0 ) <nl> + vec2 ( 0 . 536343 , 0 . 0 ) , <nl> + vec2 ( 0 . 00317394 , - 2 . 0 ) , <nl> + vec2 ( 0 . 0100386 , - 1 . 53125 ) , <nl> + vec2 ( 0 . 0144609 , - 1 . 125 ) , <nl> + vec2 ( 0 . 0216301 , - 0 . 78125 ) , <nl> + vec2 ( 0 . 0347317 , - 0 . 5 ) , <nl> + vec2 ( 0 . 0571056 , - 0 . 28125 ) , <nl> + vec2 ( 0 . 0582416 , - 0 . 125 ) , <nl> + vec2 ( 0 . 0324462 , - 0 . 03125 ) , <nl> + vec2 ( 0 . 0324462 , 0 . 03125 ) , <nl> + vec2 ( 0 . 0582416 , 0 . 125 ) , <nl> + vec2 ( 0 . 0571056 , 0 . 28125 ) , <nl> + vec2 ( 0 . 0347317 , 0 . 5 ) , <nl> + vec2 ( 0 . 0216301 , 0 . 78125 ) , <nl> + vec2 ( 0 . 0144609 , 1 . 125 ) , <nl> + vec2 ( 0 . 0100386 , 1 . 53125 ) , <nl> + vec2 ( 0 . 00317394 , 2 . 0 ) <nl> ) ; <nl> - <nl> # endif / / USE_17_SAMPLES <nl> <nl> <nl> # ifdef USE_11_SAMPLES <nl> - <nl> - const int kernel_size = 11 ; <nl> - <nl> + const int kernel_size = 11 ; <nl> QUALIFIER vec2 kernel [ 11 ] = vec2 [ ] ( <nl> - vec2 ( 0 . 560479 , 0 . 0 ) , <nl> - vec2 ( 0 . 00471691 , - 2 . 0 ) , <nl> - vec2 ( 0 . 0192831 , - 1 . 28 ) , <nl> - vec2 ( 0 . 03639 , - 0 . 72 ) , <nl> - vec2 ( 0 . 0821904 , - 0 . 32 ) , <nl> - vec2 ( 0 . 0771802 , - 0 . 08 ) , <nl> - vec2 ( 0 . 0771802 , 0 . 08 ) , <nl> - vec2 ( 0 . 0821904 , 0 . 32 ) , <nl> - vec2 ( 0 . 03639 , 0 . 72 ) , <nl> - vec2 ( 0 . 0192831 , 1 . 28 ) , <nl> - vec2 ( 0 . 00471691 , 2 . 0 ) <nl> + vec2 ( 0 . 560479 , 0 . 0 ) , <nl> + vec2 ( 0 . 00471691 , - 2 . 0 ) , <nl> + vec2 ( 0 . 0192831 , - 1 . 28 ) , <nl> + vec2 ( 0 . 03639 , - 0 . 72 ) , <nl> + vec2 ( 0 . 0821904 , - 0 . 32 ) , <nl> + vec2 ( 0 . 0771802 , - 0 . 08 ) , <nl> + vec2 ( 0 . 0771802 , 0 . 08 ) , <nl> + vec2 ( 0 . 0821904 , 0 . 32 ) , <nl> + vec2 ( 0 . 03639 , 0 . 72 ) , <nl> + vec2 ( 0 . 0192831 , 1 . 28 ) , <nl> + vec2 ( 0 . 00471691 , 2 . 0 ) <nl> ) ; <nl> - <nl> # endif / / USE_11_SAMPLES <nl> <nl> - <nl> - <nl> uniform float max_radius ; <nl> uniform float camera_z_far ; <nl> uniform float camera_z_near ; <nl> layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> void main ( ) { <nl> <nl> - float strength = texture ( source_sss , uv_interp ) . r ; <nl> - strength * = strength ; / / stored as sqrt <nl> + float strength = texture ( source_sss , uv_interp ) . r ; <nl> + strength * = strength ; / / stored as sqrt <nl> <nl> / / Fetch color of current pixel : <nl> vec4 base_color = texture ( source_diffuse , uv_interp ) ; <nl> <nl> - <nl> - if ( strength > 0 . 0 ) { <nl> - <nl> + if ( strength > 0 . 0 ) { <nl> <nl> / / Fetch linear depth of current pixel : <nl> float depth = texture ( source_depth , uv_interp ) . r * 2 . 0 - 1 . 0 ; <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - depth = ( ( depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + depth = ( ( depth + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> float scale = unit_size ; / / remember depth is negative by default in OpenGL <nl> # else <nl> depth = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - depth * ( camera_z_far - camera_z_near ) ) ; <nl> float scale = unit_size / depth ; / / remember depth is negative by default in OpenGL <nl> # endif <nl> <nl> - <nl> - <nl> / / Calculate the final step to fetch the surrounding pixels : <nl> vec2 step = max_radius * scale * dir ; <nl> step * = strength ; / / Modulate it using the alpha channel . <nl> void main ( ) { <nl> <nl> # ifdef ENABLE_FOLLOW_SURFACE <nl> / / If the difference in depth is huge , we lerp color back to " colorM " : <nl> - float depth_cmp = texture ( source_depth , offset ) . r * 2 . 0 - 1 . 0 ; <nl> + float depth_cmp = texture ( source_depth , offset ) . r * 2 . 0 - 1 . 0 ; <nl> <nl> # ifdef USE_ORTHOGONAL_PROJECTION <nl> - depth_cmp = ( ( depth_cmp + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> + depth_cmp = ( ( depth_cmp + ( camera_z_far + camera_z_near ) / ( camera_z_far - camera_z_near ) ) * ( camera_z_far - camera_z_near ) ) / 2 . 0 ; <nl> # else <nl> depth_cmp = 2 . 0 * camera_z_near * camera_z_far / ( camera_z_far + camera_z_near - depth_cmp * ( camera_z_far - camera_z_near ) ) ; <nl> # endif <nl> <nl> - float s = clamp ( 300 . 0f * scale * <nl> - max_radius * abs ( depth - depth_cmp ) , 0 . 0 , 1 . 0 ) ; <nl> + float s = clamp ( 300 . 0f * scale * max_radius * abs ( depth - depth_cmp ) , 0 . 0 , 1 . 0 ) ; <nl> color = mix ( color , base_color . rgb , s ) ; <nl> # endif <nl> <nl> / / Accumulate : <nl> - color * = kernel [ i ] . x ; <nl> + color * = kernel [ i ] . x ; <nl> <nl> # ifdef ENABLE_STRENGTH_WEIGHTING <nl> float color_s = texture ( source_sss , offset ) . r ; <nl> - color_weight + = color_s * kernel [ i ] . x ; <nl> - color * = color_s ; <nl> + color_weight + = color_s * kernel [ i ] . x ; <nl> + color * = color_s ; <nl> # endif <nl> color_accum + = color ; <nl> - <nl> } <nl> <nl> # ifdef ENABLE_STRENGTH_WEIGHTING <nl> - color_accum / = color_weight ; <nl> + color_accum / = color_weight ; <nl> # endif <nl> - frag_color = vec4 ( color_accum , base_color . a ) ; / / keep alpha ( used for SSAO ) <nl> + frag_color = vec4 ( color_accum , base_color . a ) ; / / keep alpha ( used for SSAO ) <nl> } else { <nl> frag_color = base_color ; <nl> } <nl> mmm a / drivers / gles3 / shaders / tonemap . glsl <nl> ppp b / drivers / gles3 / shaders / tonemap . glsl <nl> <nl> [ vertex ] <nl> <nl> - layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> - layout ( location = 4 ) in vec2 uv_in ; <nl> + layout ( location = 0 ) in highp vec4 vertex_attrib ; <nl> + layout ( location = 4 ) in vec2 uv_in ; <nl> <nl> out vec2 uv_interp ; <nl> <nl> - void main ( ) <nl> - { <nl> + void main ( ) { <nl> gl_Position = vertex_attrib ; <nl> <nl> uv_interp = uv_in ; <nl> <nl> - # ifdef V_FLIP <nl> - uv_interp . y = 1 . 0f - uv_interp . y ; <nl> - # endif <nl> + # ifdef V_FLIP <nl> + uv_interp . y = 1 . 0f - uv_interp . y ; <nl> + # endif <nl> } <nl> <nl> [ fragment ] <nl> <nl> # if ! defined ( GLES_OVER_GL ) <nl> - precision mediump float ; <nl> + precision mediump float ; <nl> # endif <nl> <nl> in vec2 uv_interp ; <nl> uniform float exposure ; <nl> uniform float white ; <nl> <nl> # ifdef USE_AUTO_EXPOSURE <nl> - uniform highp sampler2D source_auto_exposure ; / / texunit : 1 <nl> - uniform highp float auto_exposure_grey ; <nl> + uniform highp sampler2D source_auto_exposure ; / / texunit : 1 <nl> + uniform highp float auto_exposure_grey ; <nl> # endif <nl> <nl> # if defined ( USE_GLOW_LEVEL1 ) | | defined ( USE_GLOW_LEVEL2 ) | | defined ( USE_GLOW_LEVEL3 ) | | defined ( USE_GLOW_LEVEL4 ) | | defined ( USE_GLOW_LEVEL5 ) | | defined ( USE_GLOW_LEVEL6 ) | | defined ( USE_GLOW_LEVEL7 ) <nl> - # define USING_GLOW / / only use glow when at least one glow level is selected <nl> + # define USING_GLOW / / only use glow when at least one glow level is selected <nl> <nl> - uniform highp sampler2D source_glow ; / / texunit : 2 <nl> - uniform highp float glow_intensity ; <nl> + uniform highp sampler2D source_glow ; / / texunit : 2 <nl> + uniform highp float glow_intensity ; <nl> # endif <nl> <nl> # ifdef USE_BCS <nl> - uniform vec3 bcs ; <nl> + uniform vec3 bcs ; <nl> # endif <nl> <nl> # ifdef USE_COLOR_CORRECTION <nl> - uniform sampler2D color_correction ; / / texunit : 3 <nl> + uniform sampler2D color_correction ; / / texunit : 3 <nl> # endif <nl> <nl> - layout ( location = 0 ) out vec4 frag_color ; <nl> + layout ( location = 0 ) out vec4 frag_color ; <nl> <nl> # ifdef USE_GLOW_FILTER_BICUBIC <nl> - / / w0 , w1 , w2 , and w3 are the four cubic B - spline basis functions <nl> - float w0 ( float a ) <nl> - { <nl> - return ( 1 . 0f / 6 . 0f ) * ( a * ( a * ( - a + 3 . 0f ) - 3 . 0f ) + 1 . 0f ) ; <nl> - } <nl> - <nl> - float w1 ( float a ) <nl> - { <nl> - return ( 1 . 0f / 6 . 0f ) * ( a * a * ( 3 . 0f * a - 6 . 0f ) + 4 . 0f ) ; <nl> - } <nl> - <nl> - float w2 ( float a ) <nl> - { <nl> - return ( 1 . 0f / 6 . 0f ) * ( a * ( a * ( - 3 . 0f * a + 3 . 0f ) + 3 . 0f ) + 1 . 0f ) ; <nl> - } <nl> - <nl> - float w3 ( float a ) <nl> - { <nl> - return ( 1 . 0f / 6 . 0f ) * ( a * a * a ) ; <nl> - } <nl> - <nl> - / / g0 and g1 are the two amplitude functions <nl> - float g0 ( float a ) <nl> - { <nl> - return w0 ( a ) + w1 ( a ) ; <nl> - } <nl> - <nl> - float g1 ( float a ) <nl> - { <nl> - return w2 ( a ) + w3 ( a ) ; <nl> - } <nl> - <nl> - / / h0 and h1 are the two offset functions <nl> - float h0 ( float a ) <nl> - { <nl> - return - 1 . 0f + w1 ( a ) / ( w0 ( a ) + w1 ( a ) ) ; <nl> - } <nl> - <nl> - float h1 ( float a ) <nl> - { <nl> - return 1 . 0f + w3 ( a ) / ( w2 ( a ) + w3 ( a ) ) ; <nl> - } <nl> - <nl> - uniform ivec2 glow_texture_size ; <nl> - <nl> - vec4 texture2D_bicubic ( sampler2D tex , vec2 uv , int p_lod ) <nl> - { <nl> - float lod = float ( p_lod ) ; <nl> - vec2 tex_size = vec2 ( glow_texture_size > > p_lod ) ; <nl> - vec2 pixel_size = vec2 ( 1 . 0f ) / tex_size ; <nl> - <nl> - uv = uv * tex_size + vec2 ( 0 . 5f ) ; <nl> - <nl> - vec2 iuv = floor ( uv ) ; <nl> - vec2 fuv = fract ( uv ) ; <nl> - <nl> - float g0x = g0 ( fuv . x ) ; <nl> - float g1x = g1 ( fuv . x ) ; <nl> - float h0x = h0 ( fuv . x ) ; <nl> - float h1x = h1 ( fuv . x ) ; <nl> - float h0y = h0 ( fuv . y ) ; <nl> - float h1y = h1 ( fuv . y ) ; <nl> - <nl> - vec2 p0 = ( vec2 ( iuv . x + h0x , iuv . y + h0y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> - vec2 p1 = ( vec2 ( iuv . x + h1x , iuv . y + h0y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> - vec2 p2 = ( vec2 ( iuv . x + h0x , iuv . y + h1y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> - vec2 p3 = ( vec2 ( iuv . x + h1x , iuv . y + h1y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> - <nl> - return g0 ( fuv . y ) * ( g0x * textureLod ( tex , p0 , lod ) + <nl> - g1x * textureLod ( tex , p1 , lod ) ) + <nl> - g1 ( fuv . y ) * ( g0x * textureLod ( tex , p2 , lod ) + <nl> - g1x * textureLod ( tex , p3 , lod ) ) ; <nl> - } <nl> - <nl> - # define GLOW_TEXTURE_SAMPLE ( m_tex , m_uv , m_lod ) texture2D_bicubic ( m_tex , m_uv , m_lod ) <nl> + / / w0 , w1 , w2 , and w3 are the four cubic B - spline basis functions <nl> + float w0 ( float a ) { <nl> + return ( 1 . 0f / 6 . 0f ) * ( a * ( a * ( - a + 3 . 0f ) - 3 . 0f ) + 1 . 0f ) ; <nl> + } <nl> + <nl> + float w1 ( float a ) { <nl> + return ( 1 . 0f / 6 . 0f ) * ( a * a * ( 3 . 0f * a - 6 . 0f ) + 4 . 0f ) ; <nl> + } <nl> + <nl> + float w2 ( float a ) { <nl> + return ( 1 . 0f / 6 . 0f ) * ( a * ( a * ( - 3 . 0f * a + 3 . 0f ) + 3 . 0f ) + 1 . 0f ) ; <nl> + } <nl> + <nl> + float w3 ( float a ) { <nl> + return ( 1 . 0f / 6 . 0f ) * ( a * a * a ) ; <nl> + } <nl> + <nl> + / / g0 and g1 are the two amplitude functions <nl> + float g0 ( float a ) { <nl> + return w0 ( a ) + w1 ( a ) ; <nl> + } <nl> + <nl> + float g1 ( float a ) { <nl> + return w2 ( a ) + w3 ( a ) ; <nl> + } <nl> + <nl> + / / h0 and h1 are the two offset functions <nl> + float h0 ( float a ) { <nl> + return - 1 . 0f + w1 ( a ) / ( w0 ( a ) + w1 ( a ) ) ; <nl> + } <nl> + <nl> + float h1 ( float a ) { <nl> + return 1 . 0f + w3 ( a ) / ( w2 ( a ) + w3 ( a ) ) ; <nl> + } <nl> + <nl> + uniform ivec2 glow_texture_size ; <nl> + <nl> + vec4 texture2D_bicubic ( sampler2D tex , vec2 uv , int p_lod ) { <nl> + float lod = float ( p_lod ) ; <nl> + vec2 tex_size = vec2 ( glow_texture_size > > p_lod ) ; <nl> + vec2 pixel_size = vec2 ( 1 . 0f ) / tex_size ; <nl> + <nl> + uv = uv * tex_size + vec2 ( 0 . 5f ) ; <nl> + <nl> + vec2 iuv = floor ( uv ) ; <nl> + vec2 fuv = fract ( uv ) ; <nl> + <nl> + float g0x = g0 ( fuv . x ) ; <nl> + float g1x = g1 ( fuv . x ) ; <nl> + float h0x = h0 ( fuv . x ) ; <nl> + float h1x = h1 ( fuv . x ) ; <nl> + float h0y = h0 ( fuv . y ) ; <nl> + float h1y = h1 ( fuv . y ) ; <nl> + <nl> + vec2 p0 = ( vec2 ( iuv . x + h0x , iuv . y + h0y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> + vec2 p1 = ( vec2 ( iuv . x + h1x , iuv . y + h0y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> + vec2 p2 = ( vec2 ( iuv . x + h0x , iuv . y + h1y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> + vec2 p3 = ( vec2 ( iuv . x + h1x , iuv . y + h1y ) - vec2 ( 0 . 5f ) ) * pixel_size ; <nl> + <nl> + return g0 ( fuv . y ) * ( g0x * textureLod ( tex , p0 , lod ) + <nl> + g1x * textureLod ( tex , p1 , lod ) ) + <nl> + g1 ( fuv . y ) * ( g0x * textureLod ( tex , p2 , lod ) + <nl> + g1x * textureLod ( tex , p3 , lod ) ) ; <nl> + } <nl> + <nl> + # define GLOW_TEXTURE_SAMPLE ( m_tex , m_uv , m_lod ) texture2D_bicubic ( m_tex , m_uv , m_lod ) <nl> # else <nl> - # define GLOW_TEXTURE_SAMPLE ( m_tex , m_uv , m_lod ) textureLod ( m_tex , m_uv , float ( m_lod ) ) <nl> + # define GLOW_TEXTURE_SAMPLE ( m_tex , m_uv , m_lod ) textureLod ( m_tex , m_uv , float ( m_lod ) ) <nl> # endif <nl> <nl> - vec3 tonemap_filmic ( vec3 color , float white ) <nl> - { <nl> + vec3 tonemap_filmic ( vec3 color , float white ) { <nl> const float A = 0 . 15f ; <nl> const float B = 0 . 50f ; <nl> const float C = 0 . 10f ; <nl> vec3 tonemap_filmic ( vec3 color , float white ) <nl> return clamp ( color_tonemapped / white_tonemapped , vec3 ( 0 . 0f ) , vec3 ( 1 . 0f ) ) ; <nl> } <nl> <nl> - vec3 tonemap_aces ( vec3 color , float white ) <nl> - { <nl> + vec3 tonemap_aces ( vec3 color , float white ) { <nl> const float A = 2 . 51f ; <nl> const float B = 0 . 03f ; <nl> const float C = 2 . 43f ; <nl> vec3 tonemap_aces ( vec3 color , float white ) <nl> return clamp ( color_tonemapped / white_tonemapped , vec3 ( 0 . 0f ) , vec3 ( 1 . 0f ) ) ; <nl> } <nl> <nl> - vec3 tonemap_reindhart ( vec3 color , float white ) <nl> - { <nl> + vec3 tonemap_reindhart ( vec3 color , float white ) { <nl> return clamp ( ( color ) / ( 1 . 0f + color ) * ( 1 . 0f + ( color / ( white ) ) ) , vec3 ( 0 . 0f ) , vec3 ( 1 . 0f ) ) ; / / whitepoint is probably not in linear space here ! <nl> } <nl> <nl> - vec3 linear_to_srgb ( vec3 color ) / / convert linear rgb to srgb , assumes clamped input in range [ 0 ; 1 ] <nl> - { <nl> + vec3 linear_to_srgb ( vec3 color ) { / / convert linear rgb to srgb , assumes clamped input in range [ 0 ; 1 ] <nl> const vec3 a = vec3 ( 0 . 055f ) ; <nl> return mix ( ( vec3 ( 1 . 0f ) + a ) * pow ( color . rgb , vec3 ( 1 . 0f / 2 . 4f ) ) - a , 12 . 92f * color . rgb , lessThan ( color . rgb , vec3 ( 0 . 0031308f ) ) ) ; <nl> } <nl> <nl> - vec3 apply_tonemapping ( vec3 color , float white ) / / inputs are LINEAR , always outputs clamped [ 0 ; 1 ] color <nl> - { <nl> - # ifdef USE_REINDHART_TONEMAPPER <nl> - return tonemap_reindhart ( color , white ) ; <nl> - # endif <nl> + vec3 apply_tonemapping ( vec3 color , float white ) { / / inputs are LINEAR , always outputs clamped [ 0 ; 1 ] color <nl> + # ifdef USE_REINDHART_TONEMAPPER <nl> + return tonemap_reindhart ( color , white ) ; <nl> + # endif <nl> <nl> - # ifdef USE_FILMIC_TONEMAPPER <nl> - return tonemap_filmic ( color , white ) ; <nl> - # endif <nl> + # ifdef USE_FILMIC_TONEMAPPER <nl> + return tonemap_filmic ( color , white ) ; <nl> + # endif <nl> <nl> - # ifdef USE_ACES_TONEMAPPER <nl> - return tonemap_aces ( color , white ) ; <nl> - # endif <nl> + # ifdef USE_ACES_TONEMAPPER <nl> + return tonemap_aces ( color , white ) ; <nl> + # endif <nl> <nl> return clamp ( color , vec3 ( 0 . 0f ) , vec3 ( 1 . 0f ) ) ; / / no other seleced - > linear <nl> } <nl> <nl> - vec3 gather_glow ( sampler2D tex , vec2 uv ) / / sample all selected glow levels <nl> - { <nl> + vec3 gather_glow ( sampler2D tex , vec2 uv ) { / / sample all selected glow levels <nl> vec3 glow = vec3 ( 0 . 0f ) ; <nl> <nl> - # ifdef USE_GLOW_LEVEL1 <nl> - glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 1 ) . rgb ; <nl> - # endif <nl> + # ifdef USE_GLOW_LEVEL1 <nl> + glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 1 ) . rgb ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_LEVEL2 <nl> - glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 2 ) . rgb ; <nl> - # endif <nl> + # ifdef USE_GLOW_LEVEL2 <nl> + glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 2 ) . rgb ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_LEVEL3 <nl> - glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 3 ) . rgb ; <nl> - # endif <nl> + # ifdef USE_GLOW_LEVEL3 <nl> + glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 3 ) . rgb ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_LEVEL4 <nl> - glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 4 ) . rgb ; <nl> - # endif <nl> + # ifdef USE_GLOW_LEVEL4 <nl> + glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 4 ) . rgb ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_LEVEL5 <nl> - glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 5 ) . rgb ; <nl> - # endif <nl> + # ifdef USE_GLOW_LEVEL5 <nl> + glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 5 ) . rgb ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_LEVEL6 <nl> - glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 6 ) . rgb ; <nl> - # endif <nl> + # ifdef USE_GLOW_LEVEL6 <nl> + glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 6 ) . rgb ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_LEVEL7 <nl> - glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 7 ) . rgb ; <nl> - # endif <nl> + # ifdef USE_GLOW_LEVEL7 <nl> + glow + = GLOW_TEXTURE_SAMPLE ( tex , uv , 7 ) . rgb ; <nl> + # endif <nl> <nl> return glow ; <nl> } <nl> <nl> - vec3 apply_glow ( vec3 color , vec3 glow ) / / apply glow using the selected blending mode <nl> - { <nl> - # ifdef USE_GLOW_REPLACE <nl> - color = glow ; <nl> - # endif <nl> + vec3 apply_glow ( vec3 color , vec3 glow ) { / / apply glow using the selected blending mode <nl> + # ifdef USE_GLOW_REPLACE <nl> + color = glow ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_SCREEN <nl> - color = max ( ( color + glow ) - ( color * glow ) , vec3 ( 0 . 0 ) ) ; <nl> - # endif <nl> + # ifdef USE_GLOW_SCREEN <nl> + color = max ( ( color + glow ) - ( color * glow ) , vec3 ( 0 . 0 ) ) ; <nl> + # endif <nl> <nl> - # ifdef USE_GLOW_SOFTLIGHT <nl> - glow = glow * vec3 ( 0 . 5f ) + vec3 ( 0 . 5f ) ; <nl> + # ifdef USE_GLOW_SOFTLIGHT <nl> + glow = glow * vec3 ( 0 . 5f ) + vec3 ( 0 . 5f ) ; <nl> <nl> - color . r = ( glow . r < = 0 . 5f ) ? ( color . r - ( 1 . 0f - 2 . 0f * glow . r ) * color . r * ( 1 . 0f - color . r ) ) : ( ( ( glow . r > 0 . 5f ) & & ( color . r < = 0 . 25f ) ) ? ( color . r + ( 2 . 0f * glow . r - 1 . 0f ) * ( 4 . 0f * color . r * ( 4 . 0f * color . r + 1 . 0f ) * ( color . r - 1 . 0f ) + 7 . 0f * color . r ) ) : ( color . r + ( 2 . 0f * glow . r - 1 . 0f ) * ( sqrt ( color . r ) - color . r ) ) ) ; <nl> - color . g = ( glow . g < = 0 . 5f ) ? ( color . g - ( 1 . 0f - 2 . 0f * glow . g ) * color . g * ( 1 . 0f - color . g ) ) : ( ( ( glow . g > 0 . 5f ) & & ( color . g < = 0 . 25f ) ) ? ( color . g + ( 2 . 0f * glow . g - 1 . 0f ) * ( 4 . 0f * color . g * ( 4 . 0f * color . g + 1 . 0f ) * ( color . g - 1 . 0f ) + 7 . 0f * color . g ) ) : ( color . g + ( 2 . 0f * glow . g - 1 . 0f ) * ( sqrt ( color . g ) - color . g ) ) ) ; <nl> - color . b = ( glow . b < = 0 . 5f ) ? ( color . b - ( 1 . 0f - 2 . 0f * glow . b ) * color . b * ( 1 . 0f - color . b ) ) : ( ( ( glow . b > 0 . 5f ) & & ( color . b < = 0 . 25f ) ) ? ( color . b + ( 2 . 0f * glow . b - 1 . 0f ) * ( 4 . 0f * color . b * ( 4 . 0f * color . b + 1 . 0f ) * ( color . b - 1 . 0f ) + 7 . 0f * color . b ) ) : ( color . b + ( 2 . 0f * glow . b - 1 . 0f ) * ( sqrt ( color . b ) - color . b ) ) ) ; <nl> - # endif <nl> + color . r = ( glow . r < = 0 . 5f ) ? ( color . r - ( 1 . 0f - 2 . 0f * glow . r ) * color . r * ( 1 . 0f - color . r ) ) : ( ( ( glow . r > 0 . 5f ) & & ( color . r < = 0 . 25f ) ) ? ( color . r + ( 2 . 0f * glow . r - 1 . 0f ) * ( 4 . 0f * color . r * ( 4 . 0f * color . r + 1 . 0f ) * ( color . r - 1 . 0f ) + 7 . 0f * color . r ) ) : ( color . r + ( 2 . 0f * glow . r - 1 . 0f ) * ( sqrt ( color . r ) - color . r ) ) ) ; <nl> + color . g = ( glow . g < = 0 . 5f ) ? ( color . g - ( 1 . 0f - 2 . 0f * glow . g ) * color . g * ( 1 . 0f - color . g ) ) : ( ( ( glow . g > 0 . 5f ) & & ( color . g < = 0 . 25f ) ) ? ( color . g + ( 2 . 0f * glow . g - 1 . 0f ) * ( 4 . 0f * color . g * ( 4 . 0f * color . g + 1 . 0f ) * ( color . g - 1 . 0f ) + 7 . 0f * color . g ) ) : ( color . g + ( 2 . 0f * glow . g - 1 . 0f ) * ( sqrt ( color . g ) - color . g ) ) ) ; <nl> + color . b = ( glow . b < = 0 . 5f ) ? ( color . b - ( 1 . 0f - 2 . 0f * glow . b ) * color . b * ( 1 . 0f - color . b ) ) : ( ( ( glow . b > 0 . 5f ) & & ( color . b < = 0 . 25f ) ) ? ( color . b + ( 2 . 0f * glow . b - 1 . 0f ) * ( 4 . 0f * color . b * ( 4 . 0f * color . b + 1 . 0f ) * ( color . b - 1 . 0f ) + 7 . 0f * color . b ) ) : ( color . b + ( 2 . 0f * glow . b - 1 . 0f ) * ( sqrt ( color . b ) - color . b ) ) ) ; <nl> + # endif <nl> <nl> - # if ! defined ( USE_GLOW_SCREEN ) & & ! defined ( USE_GLOW_SOFTLIGHT ) & & ! defined ( USE_GLOW_REPLACE ) / / no other selected - > additive <nl> - color + = glow ; <nl> - # endif <nl> + # if ! defined ( USE_GLOW_SCREEN ) & & ! defined ( USE_GLOW_SOFTLIGHT ) & & ! defined ( USE_GLOW_REPLACE ) / / no other selected - > additive <nl> + color + = glow ; <nl> + # endif <nl> <nl> return color ; <nl> } <nl> <nl> - vec3 apply_bcs ( vec3 color , vec3 bcs ) <nl> - { <nl> + vec3 apply_bcs ( vec3 color , vec3 bcs ) { <nl> color = mix ( vec3 ( 0 . 0f ) , color , bcs . x ) ; <nl> color = mix ( vec3 ( 0 . 5f ) , color , bcs . y ) ; <nl> color = mix ( vec3 ( dot ( vec3 ( 1 . 0f ) , color ) * 0 . 33333f ) , color , bcs . z ) ; <nl> vec3 apply_bcs ( vec3 color , vec3 bcs ) <nl> return color ; <nl> } <nl> <nl> - vec3 apply_color_correction ( vec3 color , sampler2D correction_tex ) <nl> - { <nl> + vec3 apply_color_correction ( vec3 color , sampler2D correction_tex ) { <nl> color . r = texture ( correction_tex , vec2 ( color . r , 0 . 0f ) ) . r ; <nl> color . g = texture ( correction_tex , vec2 ( color . g , 0 . 0f ) ) . g ; <nl> color . b = texture ( correction_tex , vec2 ( color . b , 0 . 0f ) ) . b ; <nl> vec3 apply_color_correction ( vec3 color , sampler2D correction_tex ) <nl> return color ; <nl> } <nl> <nl> - void main ( ) <nl> - { <nl> + void main ( ) { <nl> vec3 color = textureLod ( source , uv_interp , 0 . 0f ) . rgb ; <nl> <nl> / / Exposure <nl> <nl> - # ifdef USE_AUTO_EXPOSURE <nl> - color / = texelFetch ( source_auto_exposure , ivec2 ( 0 , 0 ) , 0 ) . r / auto_exposure_grey ; <nl> - # endif <nl> + # ifdef USE_AUTO_EXPOSURE <nl> + color / = texelFetch ( source_auto_exposure , ivec2 ( 0 , 0 ) , 0 ) . r / auto_exposure_grey ; <nl> + # endif <nl> <nl> color * = exposure ; <nl> <nl> void main ( ) <nl> <nl> color = apply_tonemapping ( color , white ) ; <nl> <nl> - # ifdef KEEP_3D_LINEAR <nl> - / / leave color as is ( - > don ' t convert to SRGB ) <nl> - # else <nl> - color = linear_to_srgb ( color ) ; / / regular linear - > SRGB conversion <nl> - # endif <nl> + # ifdef KEEP_3D_LINEAR <nl> + / / leave color as is ( - > don ' t convert to SRGB ) <nl> + # else <nl> + color = linear_to_srgb ( color ) ; / / regular linear - > SRGB conversion <nl> + # endif <nl> <nl> / / Glow <nl> <nl> - # ifdef USING_GLOW <nl> - vec3 glow = gather_glow ( source_glow , uv_interp ) * glow_intensity ; <nl> + # ifdef USING_GLOW <nl> + vec3 glow = gather_glow ( source_glow , uv_interp ) * glow_intensity ; <nl> <nl> - / / high dynamic range - > SRGB <nl> - glow = apply_tonemapping ( glow , white ) ; <nl> - glow = linear_to_srgb ( glow ) ; <nl> + / / high dynamic range - > SRGB <nl> + glow = apply_tonemapping ( glow , white ) ; <nl> + glow = linear_to_srgb ( glow ) ; <nl> <nl> - color = apply_glow ( color , glow ) ; <nl> - # endif <nl> + color = apply_glow ( color , glow ) ; <nl> + # endif <nl> <nl> / / Additional effects <nl> <nl> - # ifdef USE_BCS <nl> - color = apply_bcs ( color , bcs ) ; <nl> - # endif <nl> + # ifdef USE_BCS <nl> + color = apply_bcs ( color , bcs ) ; <nl> + # endif <nl> <nl> - # ifdef USE_COLOR_CORRECTION <nl> - color = apply_color_correction ( color , color_correction ) ; <nl> - # endif <nl> + # ifdef USE_COLOR_CORRECTION <nl> + color = apply_color_correction ( color , color_correction ) ; <nl> + # endif <nl> <nl> frag_color = vec4 ( color , 1 . 0f ) ; <nl> } <nl>
|
Style : Fix code formatting in GLES3 shaders
|
godotengine/godot
|
1b6d75a5996b5e3c7cfdea81953c5955e1645c1a
|
2018-08-24T11:42:18Z
|
mmm a / Makefile . in <nl> ppp b / Makefile . in <nl> CXXFLAGS = @ CXXFLAGS @ <nl> LDFLAGS = @ LDFLAGS @ <nl> INCLUDES = $ ( sort @ INCLUDES @ ) <nl> <nl> - CLEAN_FILES = xbmc . bin xbmc - xrandr <nl> + CLEAN_FILES = xbmc . bin xbmc - xrandr libxbmc . so <nl> <nl> DISTCLEAN_FILES = config . h config . log config . status tools / Linux / xbmc . sh \ <nl> tools / Linux / xbmc - standalone . sh autom4te . cache config . h . in ~ \ <nl> system / libcpluff - @ ARCH @ . so <nl> <nl> - all : Makefile externals xbmc . bin xbmc - xrandr skins <nl> + ifeq ( @ USE_LIBXBMC @ , 1 ) <nl> + FINAL_TARGETS + = libxbmc . so <nl> + else <nl> + FINAL_TARGETS = xbmc . bin skins xbmc - xrandr <nl> + endif <nl> + FINAL_TARGETS + = Makefile externals <nl> + <nl> + all : $ ( FINAL_TARGETS ) <nl> @ echo ' mmmmmmmmmmmmmmmmmmmmm - - ' <nl> @ echo ' XBMC built successfully ' <nl> @ echo ' mmmmmmmmmmmmmmmmmmmmm - - ' <nl> OBJSXBMC : = $ ( filter - out $ ( DYNOBJSXBMC ) , $ ( OBJSXBMC ) ) <nl> <nl> LIBS + = @ PYTHON_LDFLAGS @ <nl> <nl> - xbmc . bin : $ ( OBJSXBMC ) $ ( DYNOBJSXBMC ) $ ( NWAOBJSXBMC ) <nl> + libxbmc . so : $ ( OBJSXBMC ) $ ( DYNOBJSXBMC ) <nl> + ifeq ( $ ( findstring osx , @ ARCH @ ) , osx ) <nl> + $ ( SILENT_LD ) $ ( CXX ) $ ( LDFLAGS ) - bundle - o $ @ - Wl , - all_load , - ObjC $ ( DYNOBJSXBMC ) $ ( OBJSXBMC ) $ ( LIBS ) <nl> + else <nl> + $ ( SILENT_LD ) $ ( CXX ) $ ( CXXFLAGS ) $ ( LDFLAGS ) - shared - o $ @ - Wl , - - whole - archive $ ( DYNOBJSXBMC ) $ ( OBJSXBMC ) - Wl , - - no - whole - archive $ ( LIBS ) <nl> + endif <nl> + <nl> + xbmc . bin : $ ( OBJSXBMC ) $ ( DYNOBJSXBMC ) <nl> <nl> ifeq ( $ ( findstring osx , @ ARCH @ ) , osx ) <nl> $ ( SILENT_LD ) $ ( CXX ) $ ( LDFLAGS ) - o xbmc . bin - Wl , - all_load , - ObjC $ ( DYNOBJSXBMC ) $ ( OBJSXBMC ) $ ( LIBS ) - rdynamic <nl> install - binaries : install - scripts <nl> ifeq ( 1 , @ USE_XRANDR @ ) <nl> @ install xbmc - xrandr $ ( DESTDIR ) $ ( libdir ) / xbmc / xbmc - xrandr <nl> endif <nl> + ifeq ( @ USE_LIBXBMC @ , 1 ) <nl> + @ install libxbmc . so $ ( DESTDIR ) $ ( libdir ) / xbmc / libxbmc . so <nl> + else <nl> @ echo " You can run XBMC with the command ' xbmc ' " <nl> endif <nl> + endif <nl> <nl> install - arch : <nl> @ # Arch dependent files <nl> mmm a / XBMC . xcodeproj / project . pbxproj <nl> ppp b / XBMC . xcodeproj / project . pbxproj <nl> <nl> F5D8D732102BB3B1004A11AB / * OverlayRendererGL . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = F5D8D72F102BB3B1004A11AB / * OverlayRendererGL . cpp * / ; } ; <nl> F5D8D733102BB3B1004A11AB / * OverlayRenderer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = F5D8D731102BB3B1004A11AB / * OverlayRenderer . cpp * / ; } ; <nl> F5D8EF5B103912A4004A11AB / * DVDSubtitleParserVplayer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = F5D8EF59103912A4004A11AB / * DVDSubtitleParserVplayer . cpp * / ; } ; <nl> + F5DA82D915803129003EE43C / * main . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = F5DA82D815803129003EE43C / * main . cpp * / ; } ; <nl> F5DC87E2110A287400EE1B15 / * RingBuffer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = F5DC87E1110A287400EE1B15 / * RingBuffer . cpp * / ; } ; <nl> F5DC8801110A46C700EE1B15 / * ModplugCodec . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = F5DC8800110A46C700EE1B15 / * ModplugCodec . cpp * / ; } ; <nl> F5DC888B110A654000EE1B15 / * libapetag . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = F5DC888A110A654000EE1B15 / * libapetag . a * / ; } ; <nl> <nl> F5D8D731102BB3B1004A11AB / * OverlayRenderer . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = OverlayRenderer . cpp ; sourceTree = " < group > " ; } ; <nl> F5D8EF59103912A4004A11AB / * DVDSubtitleParserVplayer . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = DVDSubtitleParserVplayer . cpp ; sourceTree = " < group > " ; } ; <nl> F5D8EF5A103912A4004A11AB / * DVDSubtitleParserVplayer . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = DVDSubtitleParserVplayer . h ; sourceTree = " < group > " ; } ; <nl> + F5DA82D815803129003EE43C / * main . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = main . cpp ; sourceTree = " < group > " ; } ; <nl> F5DC87E0110A287400EE1B15 / * RingBuffer . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = RingBuffer . h ; sourceTree = " < group > " ; } ; <nl> F5DC87E1110A287400EE1B15 / * RingBuffer . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = RingBuffer . cpp ; sourceTree = " < group > " ; } ; <nl> F5DC87FF110A46C700EE1B15 / * ModplugCodec . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = ModplugCodec . h ; sourceTree = " < group > " ; } ; <nl> <nl> E38E184F0D25F9FA00618676 / * IProgressCallback . h * / , <nl> E38E18580D25F9FA00618676 / * LangInfo . cpp * / , <nl> E38E18590D25F9FA00618676 / * LangInfo . h * / , <nl> + F5DA82D815803129003EE43C / * main . cpp * / , <nl> 880DBE4B0DC223FF00E26B71 / * MediaSource . cpp * / , <nl> 880DBE4C0DC223FF00E26B71 / * MediaSource . h * / , <nl> E38E1DC10D25F9FD00618676 / * NfoFile . cpp * / , <nl> <nl> 7C6EB330155BD1D40080368A / * ImageFile . cpp in Sources * / , <nl> 7C6EB6FA155F32C30080368A / * HTTPImageHandler . cpp in Sources * / , <nl> 18E7CACB1578C26D001D4554 / * CDDARipJob . cpp in Sources * / , <nl> + F5DA82D915803129003EE43C / * main . cpp in Sources * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> mmm a / configure . in <nl> ppp b / configure . in <nl> dashes = " mmmmmmmmmmmmmmmmmmmmmmmm " <nl> final_message = " \ n XBMC Configuration : " <nl> final_message = " \ n $ dashes $ final_message \ n $ dashes " <nl> <nl> + AC_ARG_ENABLE ( [ shared - lib ] , <nl> + [ AS_HELP_STRING ( [ - - enable - shared - lib ] , <nl> + [ build libxbmc . helpful for tests ( default is no ) ] ) ] , <nl> + [ build_shared_lib = $ enableval ] , <nl> + [ build_shared_lib = no ] ) <nl> <nl> AC_ARG_ENABLE ( [ debug ] , <nl> [ AS_HELP_STRING ( [ - - enable - debug ] , <nl> case $ host in <nl> esac <nl> AC_SUBST ( [ ARCH ] ) <nl> <nl> + if test " $ build_shared_lib " = " yes " ; then <nl> + final_message = " $ final_message \ n Shared lib \ tYes " <nl> + AC_SUBST ( USE_LIBXBMC , 1 ) <nl> + fi <nl> + <nl> # platform debug flags <nl> if test " $ use_debug " = " yes " ; then <nl> final_message = " $ final_message \ n Debugging : \ tYes " <nl> mmm a / xbmc / Application . cpp <nl> ppp b / xbmc / Application . cpp <nl> void CApplication : : Preflight ( ) <nl> <nl> bool CApplication : : Create ( ) <nl> { <nl> + Preflight ( ) ; <nl> g_settings . Initialize ( ) ; / / Initialize default AdvancedSettings <nl> <nl> - m_bSystemScreenSaverEnable = g_Windowing . IsSystemScreenSaverEnabled ( ) ; <nl> - g_Windowing . EnableSystemScreenSaver ( false ) ; <nl> - <nl> # ifdef _LINUX <nl> tzset ( ) ; / / Initialize timezone information variables <nl> # endif <nl> bool CApplication : : Create ( ) <nl> return false ; <nl> } <nl> <nl> + / / Init our DllLoaders emu env <nl> + init_emu_environ ( ) ; <nl> + <nl> g_settings . LoadProfiles ( PROFILES_FILE ) ; <nl> <nl> CLog : : Log ( LOGNOTICE , " mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - " ) ; <nl> bool CApplication : : Create ( ) <nl> g_xrandr . LoadCustomModeLinesToAllOutputs ( ) ; <nl> # endif <nl> <nl> - / / Init our DllLoaders emu env <nl> - init_emu_environ ( ) ; <nl> - <nl> - <nl> - # ifdef HAS_SDL <nl> - CLog : : Log ( LOGNOTICE , " Setup SDL " ) ; <nl> - <nl> - / * Clean up on exit , exit on window close and interrupt * / <nl> - atexit ( SDL_Quit ) ; <nl> - <nl> - uint32_t sdlFlags = 0 ; <nl> - <nl> - # if defined ( HAS_SDL_OPENGL ) | | ( HAS_GLES = = 2 ) <nl> - sdlFlags | = SDL_INIT_VIDEO ; <nl> - # endif <nl> - <nl> - # if defined ( HAS_SDL_JOYSTICK ) & & ! defined ( TARGET_WINDOWS ) <nl> - sdlFlags | = SDL_INIT_JOYSTICK ; <nl> - # endif <nl> - <nl> - / / depending on how it ' s compiled , SDL periodically calls XResetScreenSaver when it ' s fullscreen <nl> - / / this might bring the monitor out of standby , so we have to disable it explicitly <nl> - / / by passing 0 for overwrite to setsenv , the user can still override this by setting the environment variable <nl> - # if defined ( _LINUX ) & & ! defined ( TARGET_DARWIN ) <nl> - setenv ( " SDL_VIDEO_ALLOW_SCREENSAVER " , " 1 " , 0 ) ; <nl> - # endif <nl> - <nl> - # endif / / HAS_SDL <nl> - <nl> - # ifdef _LINUX <nl> - / / for nvidia cards - vsync currently ALWAYS enabled . <nl> - / / the reason is that after screen has been setup changing this env var will make no difference . <nl> - setenv ( " __GL_SYNC_TO_VBLANK " , " 1 " , 0 ) ; <nl> - setenv ( " __GL_YIELD " , " USLEEP " , 0 ) ; <nl> - # endif <nl> - <nl> - # ifdef HAS_SDL <nl> - if ( SDL_Init ( sdlFlags ) ! = 0 ) <nl> - { <nl> - CLog : : Log ( LOGFATAL , " XBAppEx : Unable to initialize SDL : % s " , SDL_GetError ( ) ) ; <nl> - return false ; <nl> - } <nl> - # if defined ( TARGET_DARWIN ) <nl> - / / SDL_Init will install a handler for segfaults , restore the default handler . <nl> - signal ( SIGSEGV , SIG_DFL ) ; <nl> - # endif <nl> - # endif <nl> - <nl> / / for python scripts that check the OS <nl> # if defined ( TARGET_DARWIN ) <nl> setenv ( " OS " , " OS X " , true ) ; <nl> bool CApplication : : Create ( ) <nl> SetEnvironmentVariable ( " OS " , " win32 " ) ; <nl> # endif <nl> <nl> - / / Initialize core peripheral port support . Note : If these parameters <nl> - / / are 0 and NULL , respectively , then the default number and types of <nl> - / / controllers will be initialized . <nl> - if ( ! g_Windowing . InitWindowSystem ( ) ) <nl> - { <nl> - CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to init windowing system " ) ; <nl> - return false ; <nl> - } <nl> - <nl> g_powerManager . Initialize ( ) ; <nl> <nl> / / Load the AudioEngine before settings as they need to query the engine <nl> bool CApplication : : Create ( ) <nl> XBMCHelper : : GetInstance ( ) . Configure ( ) ; <nl> # endif <nl> <nl> + CUtil : : InitRandomSeed ( ) ; <nl> + <nl> + # ifdef HAS_SDL_JOYSTICK <nl> + g_Joystick . Initialize ( ) ; <nl> + # endif <nl> + <nl> + g_mediaManager . Initialize ( ) ; <nl> + <nl> + m_lastFrameTime = XbmcThreads : : SystemClockMillis ( ) ; <nl> + m_lastRenderTime = m_lastFrameTime ; <nl> + return true ; <nl> + } <nl> + <nl> + bool CApplication : : CreateGUI ( ) <nl> + { <nl> + # ifdef HAS_SDL <nl> + CLog : : Log ( LOGNOTICE , " Setup SDL " ) ; <nl> + <nl> + / * Clean up on exit , exit on window close and interrupt * / <nl> + atexit ( SDL_Quit ) ; <nl> + <nl> + uint32_t sdlFlags = 0 ; <nl> + <nl> + # if defined ( HAS_SDL_OPENGL ) | | ( HAS_GLES = = 2 ) <nl> + sdlFlags | = SDL_INIT_VIDEO ; <nl> + # endif <nl> + <nl> + # if defined ( HAS_SDL_JOYSTICK ) & & ! defined ( TARGET_WINDOWS ) <nl> + sdlFlags | = SDL_INIT_JOYSTICK ; <nl> + # endif <nl> + <nl> + / / depending on how it ' s compiled , SDL periodically calls XResetScreenSaver when it ' s fullscreen <nl> + / / this might bring the monitor out of standby , so we have to disable it explicitly <nl> + / / by passing 0 for overwrite to setsenv , the user can still override this by setting the environment variable <nl> + # if defined ( _LINUX ) & & ! defined ( TARGET_DARWIN ) <nl> + setenv ( " SDL_VIDEO_ALLOW_SCREENSAVER " , " 1 " , 0 ) ; <nl> + # endif <nl> + <nl> + # endif / / HAS_SDL <nl> + <nl> + # ifdef _LINUX <nl> + / / for nvidia cards - vsync currently ALWAYS enabled . <nl> + / / the reason is that after screen has been setup changing this env var will make no difference . <nl> + setenv ( " __GL_SYNC_TO_VBLANK " , " 1 " , 0 ) ; <nl> + setenv ( " __GL_YIELD " , " USLEEP " , 0 ) ; <nl> + # endif <nl> + <nl> + m_bSystemScreenSaverEnable = g_Windowing . IsSystemScreenSaverEnabled ( ) ; <nl> + g_Windowing . EnableSystemScreenSaver ( false ) ; <nl> + <nl> + # ifdef HAS_SDL <nl> + if ( SDL_Init ( sdlFlags ) ! = 0 ) <nl> + { <nl> + CLog : : Log ( LOGFATAL , " XBAppEx : Unable to initialize SDL : % s " , SDL_GetError ( ) ) ; <nl> + return false ; <nl> + } <nl> + # if defined ( TARGET_DARWIN ) <nl> + / / SDL_Init will install a handler for segfaults , restore the default handler . <nl> + signal ( SIGSEGV , SIG_DFL ) ; <nl> + # endif <nl> + # endif <nl> + <nl> + / / Initialize core peripheral port support . Note : If these parameters <nl> + / / are 0 and NULL , respectively , then the default number and types of <nl> + / / controllers will be initialized . <nl> + if ( ! g_Windowing . InitWindowSystem ( ) ) <nl> + { <nl> + CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to init windowing system " ) ; <nl> + return false ; <nl> + } <nl> + <nl> / / update the window resolution <nl> g_Windowing . SetWindowResolution ( g_guiSettings . GetInt ( " window . width " ) , g_guiSettings . GetInt ( " window . height " ) ) ; <nl> <nl> bool CApplication : : Create ( ) <nl> CLog : : Log ( LOGERROR , " The screen resolution requested is not valid , resetting to a valid mode " ) ; <nl> g_guiSettings . m_LookAndFeelResolution = RES_DESKTOP ; <nl> } <nl> - <nl> - # ifdef TARGET_DARWIN_OSX <nl> - / / force initial window creation to be windowed , if fullscreen , it will switch to it below <nl> - / / fixes the white screen of death if starting fullscreen and switching to windowed . <nl> - bool bFullScreen = false ; <nl> - if ( ! g_Windowing . CreateNewWindow ( " XBMC " , bFullScreen , g_settings . m_ResInfo [ RES_WINDOW ] , OnEvent ) ) <nl> - { <nl> - CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to create window " ) ; <nl> - return false ; <nl> - } <nl> - # else <nl> - bool bFullScreen = g_guiSettings . m_LookAndFeelResolution ! = RES_WINDOW ; <nl> - if ( ! g_Windowing . CreateNewWindow ( " XBMC " , bFullScreen , g_settings . m_ResInfo [ g_guiSettings . m_LookAndFeelResolution ] , OnEvent ) ) <nl> + if ( ! InitWindow ( ) ) <nl> { <nl> - CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to create window " ) ; <nl> return false ; <nl> } <nl> - # endif <nl> - <nl> - if ( ! g_Windowing . InitRenderSystem ( ) ) <nl> - { <nl> - CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to init rendering system " ) ; <nl> - return false ; <nl> - } <nl> - <nl> - / / set GUI res and force the clear of the screen <nl> - g_graphicsContext . SetVideoResolution ( g_guiSettings . m_LookAndFeelResolution ) ; <nl> <nl> if ( g_advancedSettings . m_splashImage ) <nl> { <nl> bool CApplication : : Create ( ) <nl> g_settings . m_ResInfo [ iResolution ] . strMode . c_str ( ) ) ; <nl> g_windowManager . Initialize ( ) ; <nl> <nl> - CUtil : : InitRandomSeed ( ) ; <nl> + return true ; <nl> + } <nl> <nl> - # ifdef HAS_SDL_JOYSTICK <nl> - g_Joystick . Initialize ( ) ; <nl> + bool CApplication : : InitWindow ( ) <nl> + { <nl> + # ifdef TARGET_DARWIN_OSX <nl> + / / force initial window creation to be windowed , if fullscreen , it will switch to it below <nl> + / / fixes the white screen of death if starting fullscreen and switching to windowed . <nl> + bool bFullScreen = false ; <nl> + if ( ! g_Windowing . CreateNewWindow ( " XBMC " , bFullScreen , g_settings . m_ResInfo [ RES_WINDOW ] , OnEvent ) ) <nl> + { <nl> + CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to create window " ) ; <nl> + return false ; <nl> + } <nl> + # else <nl> + bool bFullScreen = g_guiSettings . m_LookAndFeelResolution ! = RES_WINDOW ; <nl> + if ( ! g_Windowing . CreateNewWindow ( " XBMC " , bFullScreen , g_settings . m_ResInfo [ g_guiSettings . m_LookAndFeelResolution ] , OnEvent ) ) <nl> + { <nl> + CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to create window " ) ; <nl> + return false ; <nl> + } <nl> # endif <nl> <nl> - g_mediaManager . Initialize ( ) ; <nl> - <nl> - m_lastFrameTime = XbmcThreads : : SystemClockMillis ( ) ; <nl> - m_lastRenderTime = m_lastFrameTime ; <nl> + if ( ! g_Windowing . InitRenderSystem ( ) ) <nl> + { <nl> + CLog : : Log ( LOGFATAL , " CApplication : : Create : Unable to init rendering system " ) ; <nl> + return false ; <nl> + } <nl> + / / set GUI res and force the clear of the screen <nl> + g_graphicsContext . SetVideoResolution ( g_guiSettings . m_LookAndFeelResolution ) ; <nl> + return true ; <nl> + } <nl> <nl> - return Initialize ( ) ; <nl> + bool CApplication : : DestroyWindow ( ) <nl> + { <nl> + g_Windowing . DestroyRenderSystem ( ) ; <nl> + return g_Windowing . DestroyWindow ( ) ; <nl> } <nl> <nl> bool CApplication : : InitDirectoriesLinux ( ) <nl> bool CApplication : : Initialize ( ) <nl> <nl> / / Init DPMS , before creating the corresponding setting control . <nl> m_dpms = new DPMSSupport ( ) ; <nl> - g_guiSettings . GetSetting ( " powermanagement . displaysoff " ) - > SetVisible ( m_dpms - > IsSupported ( ) ) ; <nl> - <nl> - g_windowManager . Add ( new CGUIWindowHome ) ; / / window id = 0 <nl> - g_windowManager . Add ( new CGUIWindowPrograms ) ; / / window id = 1 <nl> - g_windowManager . Add ( new CGUIWindowPictures ) ; / / window id = 2 <nl> - g_windowManager . Add ( new CGUIWindowFileManager ) ; / / window id = 3 <nl> - g_windowManager . Add ( new CGUIWindowSettings ) ; / / window id = 4 <nl> - g_windowManager . Add ( new CGUIWindowSystemInfo ) ; / / window id = 7 <nl> + if ( g_windowManager . Initialized ( ) ) <nl> + { <nl> + g_guiSettings . GetSetting ( " powermanagement . displaysoff " ) - > SetVisible ( m_dpms - > IsSupported ( ) ) ; <nl> + <nl> + g_windowManager . Add ( new CGUIWindowHome ) ; / / window id = 0 <nl> + g_windowManager . Add ( new CGUIWindowPrograms ) ; / / window id = 1 <nl> + g_windowManager . Add ( new CGUIWindowPictures ) ; / / window id = 2 <nl> + g_windowManager . Add ( new CGUIWindowFileManager ) ; / / window id = 3 <nl> + g_windowManager . Add ( new CGUIWindowSettings ) ; / / window id = 4 <nl> + g_windowManager . Add ( new CGUIWindowSystemInfo ) ; / / window id = 7 <nl> # ifdef HAS_GL <nl> - g_windowManager . Add ( new CGUIWindowTestPatternGL ) ; / / window id = 8 <nl> + g_windowManager . Add ( new CGUIWindowTestPatternGL ) ; / / window id = 8 <nl> # endif <nl> # ifdef HAS_DX <nl> - g_windowManager . Add ( new CGUIWindowTestPatternDX ) ; / / window id = 8 <nl> - # endif <nl> - g_windowManager . Add ( new CGUIDialogTeletext ) ; / / window id = <nl> - g_windowManager . Add ( new CGUIWindowSettingsScreenCalibration ) ; / / window id = 11 <nl> - g_windowManager . Add ( new CGUIWindowSettingsCategory ) ; / / window id = 12 slideshow : window id 2007 <nl> - g_windowManager . Add ( new CGUIWindowVideoNav ) ; / / window id = 36 <nl> - g_windowManager . Add ( new CGUIWindowVideoPlaylist ) ; / / window id = 28 <nl> - g_windowManager . Add ( new CGUIWindowLoginScreen ) ; / / window id = 29 <nl> - g_windowManager . Add ( new CGUIWindowSettingsProfile ) ; / / window id = 34 <nl> - g_windowManager . Add ( new CGUIWindowAddonBrowser ) ; / / window id = 40 <nl> - g_windowManager . Add ( new CGUIWindowScreensaverDim ) ; / / window id = 97 <nl> - g_windowManager . Add ( new CGUIWindowDebugInfo ) ; / / window id = 98 <nl> - g_windowManager . Add ( new CGUIWindowPointer ) ; / / window id = 99 <nl> - g_windowManager . Add ( new CGUIDialogYesNo ) ; / / window id = 100 <nl> - g_windowManager . Add ( new CGUIDialogProgress ) ; / / window id = 101 <nl> - g_windowManager . Add ( new CGUIDialogKeyboard ) ; / / window id = 103 <nl> - g_windowManager . Add ( new CGUIDialogVolumeBar ) ; / / window id = 104 <nl> - g_windowManager . Add ( new CGUIDialogSeekBar ) ; / / window id = 115 <nl> - g_windowManager . Add ( new CGUIDialogSubMenu ) ; / / window id = 105 <nl> - g_windowManager . Add ( new CGUIDialogContextMenu ) ; / / window id = 106 <nl> - g_windowManager . Add ( new CGUIDialogKaiToast ) ; / / window id = 107 <nl> - g_windowManager . Add ( new CGUIDialogNumeric ) ; / / window id = 109 <nl> - g_windowManager . Add ( new CGUIDialogGamepad ) ; / / window id = 110 <nl> - g_windowManager . Add ( new CGUIDialogButtonMenu ) ; / / window id = 111 <nl> - g_windowManager . Add ( new CGUIDialogMusicScan ) ; / / window id = 112 <nl> - g_windowManager . Add ( new CGUIDialogMuteBug ) ; / / window id = 113 <nl> - g_windowManager . Add ( new CGUIDialogPlayerControls ) ; / / window id = 114 <nl> + g_windowManager . Add ( new CGUIWindowTestPatternDX ) ; / / window id = 8 <nl> + # endif <nl> + g_windowManager . Add ( new CGUIDialogTeletext ) ; / / window id = <nl> + g_windowManager . Add ( new CGUIWindowSettingsScreenCalibration ) ; / / window id = 11 <nl> + g_windowManager . Add ( new CGUIWindowSettingsCategory ) ; / / window id = 12 slideshow : window id 2007 <nl> + g_windowManager . Add ( new CGUIWindowVideoNav ) ; / / window id = 36 <nl> + g_windowManager . Add ( new CGUIWindowVideoPlaylist ) ; / / window id = 28 <nl> + g_windowManager . Add ( new CGUIWindowLoginScreen ) ; / / window id = 29 <nl> + g_windowManager . Add ( new CGUIWindowSettingsProfile ) ; / / window id = 34 <nl> + g_windowManager . Add ( new CGUIWindowAddonBrowser ) ; / / window id = 40 <nl> + g_windowManager . Add ( new CGUIWindowScreensaverDim ) ; / / window id = 97 <nl> + g_windowManager . Add ( new CGUIWindowDebugInfo ) ; / / window id = 98 <nl> + g_windowManager . Add ( new CGUIWindowPointer ) ; / / window id = 99 <nl> + g_windowManager . Add ( new CGUIDialogYesNo ) ; / / window id = 100 <nl> + g_windowManager . Add ( new CGUIDialogProgress ) ; / / window id = 101 <nl> + g_windowManager . Add ( new CGUIDialogKeyboard ) ; / / window id = 103 <nl> + g_windowManager . Add ( new CGUIDialogVolumeBar ) ; / / window id = 104 <nl> + g_windowManager . Add ( new CGUIDialogSeekBar ) ; / / window id = 115 <nl> + g_windowManager . Add ( new CGUIDialogSubMenu ) ; / / window id = 105 <nl> + g_windowManager . Add ( new CGUIDialogContextMenu ) ; / / window id = 106 <nl> + g_windowManager . Add ( new CGUIDialogKaiToast ) ; / / window id = 107 <nl> + g_windowManager . Add ( new CGUIDialogNumeric ) ; / / window id = 109 <nl> + g_windowManager . Add ( new CGUIDialogGamepad ) ; / / window id = 110 <nl> + g_windowManager . Add ( new CGUIDialogButtonMenu ) ; / / window id = 111 <nl> + g_windowManager . Add ( new CGUIDialogMusicScan ) ; / / window id = 112 <nl> + g_windowManager . Add ( new CGUIDialogMuteBug ) ; / / window id = 113 <nl> + g_windowManager . Add ( new CGUIDialogPlayerControls ) ; / / window id = 114 <nl> # ifdef HAS_KARAOKE <nl> - g_windowManager . Add ( new CGUIDialogKaraokeSongSelectorSmall ) ; / / window id 143 <nl> - g_windowManager . Add ( new CGUIDialogKaraokeSongSelectorLarge ) ; / / window id 144 <nl> - # endif <nl> - g_windowManager . Add ( new CGUIDialogSlider ) ; / / window id = 145 <nl> - g_windowManager . Add ( new CGUIDialogMusicOSD ) ; / / window id = 120 <nl> - g_windowManager . Add ( new CGUIDialogVisualisationPresetList ) ; / / window id = 122 <nl> - g_windowManager . Add ( new CGUIDialogVideoSettings ) ; / / window id = 123 <nl> - g_windowManager . Add ( new CGUIDialogAudioSubtitleSettings ) ; / / window id = 124 <nl> - g_windowManager . Add ( new CGUIDialogVideoBookmarks ) ; / / window id = 125 <nl> - / / Don ' t add the filebrowser dialog - it ' s created and added when it ' s needed <nl> - g_windowManager . Add ( new CGUIDialogNetworkSetup ) ; / / window id = 128 <nl> - g_windowManager . Add ( new CGUIDialogMediaSource ) ; / / window id = 129 <nl> - g_windowManager . Add ( new CGUIDialogProfileSettings ) ; / / window id = 130 <nl> - g_windowManager . Add ( new CGUIDialogVideoScan ) ; / / window id = 133 <nl> - g_windowManager . Add ( new CGUIDialogFavourites ) ; / / window id = 134 <nl> - g_windowManager . Add ( new CGUIDialogSongInfo ) ; / / window id = 135 <nl> - g_windowManager . Add ( new CGUIDialogSmartPlaylistEditor ) ; / / window id = 136 <nl> - g_windowManager . Add ( new CGUIDialogSmartPlaylistRule ) ; / / window id = 137 <nl> - g_windowManager . Add ( new CGUIDialogBusy ) ; / / window id = 138 <nl> - g_windowManager . Add ( new CGUIDialogPictureInfo ) ; / / window id = 139 <nl> - g_windowManager . Add ( new CGUIDialogAddonInfo ) ; <nl> - g_windowManager . Add ( new CGUIDialogAddonSettings ) ; / / window id = 140 <nl> + g_windowManager . Add ( new CGUIDialogKaraokeSongSelectorSmall ) ; / / window id 143 <nl> + g_windowManager . Add ( new CGUIDialogKaraokeSongSelectorLarge ) ; / / window id 144 <nl> + # endif <nl> + g_windowManager . Add ( new CGUIDialogSlider ) ; / / window id = 145 <nl> + g_windowManager . Add ( new CGUIDialogMusicOSD ) ; / / window id = 120 <nl> + g_windowManager . Add ( new CGUIDialogVisualisationPresetList ) ; / / window id = 122 <nl> + g_windowManager . Add ( new CGUIDialogVideoSettings ) ; / / window id = 123 <nl> + g_windowManager . Add ( new CGUIDialogAudioSubtitleSettings ) ; / / window id = 124 <nl> + g_windowManager . Add ( new CGUIDialogVideoBookmarks ) ; / / window id = 125 <nl> + / / Don ' t add the filebrowser dialog - it ' s created and added when it ' s needed <nl> + g_windowManager . Add ( new CGUIDialogNetworkSetup ) ; / / window id = 128 <nl> + g_windowManager . Add ( new CGUIDialogMediaSource ) ; / / window id = 129 <nl> + g_windowManager . Add ( new CGUIDialogProfileSettings ) ; / / window id = 130 <nl> + g_windowManager . Add ( new CGUIDialogVideoScan ) ; / / window id = 133 <nl> + g_windowManager . Add ( new CGUIDialogFavourites ) ; / / window id = 134 <nl> + g_windowManager . Add ( new CGUIDialogSongInfo ) ; / / window id = 135 <nl> + g_windowManager . Add ( new CGUIDialogSmartPlaylistEditor ) ; / / window id = 136 <nl> + g_windowManager . Add ( new CGUIDialogSmartPlaylistRule ) ; / / window id = 137 <nl> + g_windowManager . Add ( new CGUIDialogBusy ) ; / / window id = 138 <nl> + g_windowManager . Add ( new CGUIDialogPictureInfo ) ; / / window id = 139 <nl> + g_windowManager . Add ( new CGUIDialogAddonInfo ) ; <nl> + g_windowManager . Add ( new CGUIDialogAddonSettings ) ; / / window id = 140 <nl> # ifdef HAS_LINUX_NETWORK <nl> - g_windowManager . Add ( new CGUIDialogAccessPoints ) ; / / window id = 141 <nl> + g_windowManager . Add ( new CGUIDialogAccessPoints ) ; / / window id = 141 <nl> # endif <nl> <nl> - g_windowManager . Add ( new CGUIDialogLockSettings ) ; / / window id = 131 <nl> + g_windowManager . Add ( new CGUIDialogLockSettings ) ; / / window id = 131 <nl> <nl> - g_windowManager . Add ( new CGUIDialogContentSettings ) ; / / window id = 132 <nl> + g_windowManager . Add ( new CGUIDialogContentSettings ) ; / / window id = 132 <nl> <nl> - g_windowManager . Add ( new CGUIDialogPlayEject ) ; <nl> + g_windowManager . Add ( new CGUIDialogPlayEject ) ; <nl> <nl> - g_windowManager . Add ( new CGUIDialogPeripheralManager ) ; <nl> - g_windowManager . Add ( new CGUIDialogPeripheralSettings ) ; <nl> + g_windowManager . Add ( new CGUIDialogPeripheralManager ) ; <nl> + g_windowManager . Add ( new CGUIDialogPeripheralSettings ) ; <nl> <nl> - g_windowManager . Add ( new CGUIWindowMusicPlayList ) ; / / window id = 500 <nl> - g_windowManager . Add ( new CGUIWindowMusicSongs ) ; / / window id = 501 <nl> - g_windowManager . Add ( new CGUIWindowMusicNav ) ; / / window id = 502 <nl> - g_windowManager . Add ( new CGUIWindowMusicPlaylistEditor ) ; / / window id = 503 <nl> + g_windowManager . Add ( new CGUIWindowMusicPlayList ) ; / / window id = 500 <nl> + g_windowManager . Add ( new CGUIWindowMusicSongs ) ; / / window id = 501 <nl> + g_windowManager . Add ( new CGUIWindowMusicNav ) ; / / window id = 502 <nl> + g_windowManager . Add ( new CGUIWindowMusicPlaylistEditor ) ; / / window id = 503 <nl> <nl> - g_windowManager . Add ( new CGUIDialogSelect ) ; / / window id = 2000 <nl> - g_windowManager . Add ( new CGUIDialogMusicInfo ) ; / / window id = 2001 <nl> - g_windowManager . Add ( new CGUIDialogOK ) ; / / window id = 2002 <nl> - g_windowManager . Add ( new CGUIDialogVideoInfo ) ; / / window id = 2003 <nl> - g_windowManager . Add ( new CGUIDialogTextViewer ) ; <nl> - g_windowManager . Add ( new CGUIWindowFullScreen ) ; / / window id = 2005 <nl> - g_windowManager . Add ( new CGUIWindowVisualisation ) ; / / window id = 2006 <nl> - g_windowManager . Add ( new CGUIWindowSlideShow ) ; / / window id = 2007 <nl> - g_windowManager . Add ( new CGUIDialogFileStacking ) ; / / window id = 2008 <nl> + g_windowManager . Add ( new CGUIDialogSelect ) ; / / window id = 2000 <nl> + g_windowManager . Add ( new CGUIDialogMusicInfo ) ; / / window id = 2001 <nl> + g_windowManager . Add ( new CGUIDialogOK ) ; / / window id = 2002 <nl> + g_windowManager . Add ( new CGUIDialogVideoInfo ) ; / / window id = 2003 <nl> + g_windowManager . Add ( new CGUIDialogTextViewer ) ; <nl> + g_windowManager . Add ( new CGUIWindowFullScreen ) ; / / window id = 2005 <nl> + g_windowManager . Add ( new CGUIWindowVisualisation ) ; / / window id = 2006 <nl> + g_windowManager . Add ( new CGUIWindowSlideShow ) ; / / window id = 2007 <nl> + g_windowManager . Add ( new CGUIDialogFileStacking ) ; / / window id = 2008 <nl> # ifdef HAS_KARAOKE <nl> - g_windowManager . Add ( new CGUIWindowKaraokeLyrics ) ; / / window id = 2009 <nl> + g_windowManager . Add ( new CGUIWindowKaraokeLyrics ) ; / / window id = 2009 <nl> # endif <nl> <nl> - g_windowManager . Add ( new CGUIDialogVideoOSD ) ; / / window id = 2901 <nl> - g_windowManager . Add ( new CGUIDialogMusicOverlay ) ; / / window id = 2903 <nl> - g_windowManager . Add ( new CGUIDialogVideoOverlay ) ; / / window id = 2904 <nl> - g_windowManager . Add ( new CGUIWindowScreensaver ) ; / / window id = 2900 Screensaver <nl> - g_windowManager . Add ( new CGUIWindowWeather ) ; / / window id = 2600 WEATHER <nl> - g_windowManager . Add ( new CGUIWindowStartup ) ; / / startup window ( id 2999 ) <nl> + g_windowManager . Add ( new CGUIDialogVideoOSD ) ; / / window id = 2901 <nl> + g_windowManager . Add ( new CGUIDialogMusicOverlay ) ; / / window id = 2903 <nl> + g_windowManager . Add ( new CGUIDialogVideoOverlay ) ; / / window id = 2904 <nl> + g_windowManager . Add ( new CGUIWindowScreensaver ) ; / / window id = 2900 Screensaver <nl> + g_windowManager . Add ( new CGUIWindowWeather ) ; / / window id = 2600 WEATHER <nl> + g_windowManager . Add ( new CGUIWindowStartup ) ; / / startup window ( id 2999 ) <nl> <nl> - / * window id ' s 3000 - 3100 are reserved for python * / <nl> + / * window id ' s 3000 - 3100 are reserved for python * / <nl> <nl> - / / Make sure we have at least the default skin <nl> - if ( ! LoadSkin ( g_guiSettings . GetString ( " lookandfeel . skin " ) ) & & ! LoadSkin ( DEFAULT_SKIN ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " Default skin ' % s ' not found ! Terminating . . " , DEFAULT_SKIN ) ; <nl> - FatalErrorHandler ( true , true , true ) ; <nl> - } <nl> + / / Make sure we have at least the default skin <nl> + if ( ! LoadSkin ( g_guiSettings . GetString ( " lookandfeel . skin " ) ) & & ! LoadSkin ( DEFAULT_SKIN ) ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " Default skin ' % s ' not found ! Terminating . . " , DEFAULT_SKIN ) ; <nl> + FatalErrorHandler ( true , true , true ) ; <nl> + } <nl> <nl> - if ( g_advancedSettings . m_splashImage ) <nl> - SAFE_DELETE ( m_splash ) ; <nl> + if ( g_advancedSettings . m_splashImage ) <nl> + SAFE_DELETE ( m_splash ) ; <nl> <nl> - if ( g_guiSettings . GetBool ( " masterlock . startuplock " ) & & <nl> - g_settings . GetMasterProfile ( ) . getLockMode ( ) ! = LOCK_MODE_EVERYONE & & <nl> - ! g_settings . GetMasterProfile ( ) . getLockCode ( ) . IsEmpty ( ) ) <nl> - { <nl> - g_passwordManager . CheckStartUpLock ( ) ; <nl> - } <nl> + if ( g_guiSettings . GetBool ( " masterlock . startuplock " ) & & <nl> + g_settings . GetMasterProfile ( ) . getLockMode ( ) ! = LOCK_MODE_EVERYONE & & <nl> + ! g_settings . GetMasterProfile ( ) . getLockCode ( ) . IsEmpty ( ) ) <nl> + { <nl> + g_passwordManager . CheckStartUpLock ( ) ; <nl> + } <nl> <nl> - / / check if we should use the login screen <nl> - if ( g_settings . UsingLoginScreen ( ) ) <nl> - g_windowManager . ActivateWindow ( WINDOW_LOGIN_SCREEN ) ; <nl> - else <nl> + / / check if we should use the login screen <nl> + if ( g_settings . UsingLoginScreen ( ) ) <nl> + g_windowManager . ActivateWindow ( WINDOW_LOGIN_SCREEN ) ; <nl> + else <nl> + { <nl> + # ifdef HAS_JSONRPC <nl> + CJSONRPC : : Initialize ( ) ; <nl> + # endif <nl> + ADDON : : CAddonMgr : : Get ( ) . StartServices ( false ) ; <nl> + g_windowManager . ActivateWindow ( g_SkinInfo - > GetFirstWindow ( ) ) ; <nl> + } <nl> + <nl> + } <nl> + else / / No GUI Created <nl> { <nl> # ifdef HAS_JSONRPC <nl> CJSONRPC : : Initialize ( ) ; <nl> # endif <nl> ADDON : : CAddonMgr : : Get ( ) . StartServices ( false ) ; <nl> - g_windowManager . ActivateWindow ( g_SkinInfo - > GetFirstWindow ( ) ) ; <nl> } <nl> <nl> g_sysinfo . Refresh ( ) ; <nl> void CApplication : : UpdateLCD ( ) <nl> # endif <nl> } <nl> <nl> - void CApplication : : FrameMove ( bool processEvents ) <nl> + void CApplication : : FrameMove ( bool processEvents , bool processGUI ) <nl> { <nl> MEASURE_FUNCTION ; <nl> <nl> void CApplication : : FrameMove ( bool processEvents ) <nl> / / never set a frametime less than 2 fps to avoid problems when debuggin and on breaks <nl> if ( frameTime > 0 . 5 ) frameTime = 0 . 5 ; <nl> <nl> - g_graphicsContext . Lock ( ) ; <nl> - / / check if there are notifications to display <nl> - CGUIDialogKaiToast * toast = ( CGUIDialogKaiToast * ) g_windowManager . GetWindow ( WINDOW_DIALOG_KAI_TOAST ) ; <nl> - if ( toast & & toast - > DoWork ( ) ) <nl> + if ( processGUI ) <nl> { <nl> - if ( ! toast - > IsDialogRunning ( ) ) <nl> + g_graphicsContext . Lock ( ) ; <nl> + / / check if there are notifications to display <nl> + CGUIDialogKaiToast * toast = ( CGUIDialogKaiToast * ) g_windowManager . GetWindow ( WINDOW_DIALOG_KAI_TOAST ) ; <nl> + if ( toast & & toast - > DoWork ( ) ) <nl> { <nl> - toast - > Show ( ) ; <nl> + if ( ! toast - > IsDialogRunning ( ) ) <nl> + { <nl> + toast - > Show ( ) ; <nl> + } <nl> } <nl> + g_graphicsContext . Unlock ( ) ; <nl> + CWinEvents : : MessagePump ( ) ; <nl> } <nl> - g_graphicsContext . Unlock ( ) ; <nl> <nl> UpdateLCD ( ) ; <nl> <nl> void CApplication : : FrameMove ( bool processEvents ) <nl> # endif <nl> <nl> / / process input actions <nl> - CWinEvents : : MessagePump ( ) ; <nl> ProcessHTTPApiButtons ( ) ; <nl> ProcessJsonRpcButtons ( ) ; <nl> ProcessRemote ( frameTime ) ; <nl> ProcessGamepad ( frameTime ) ; <nl> ProcessEventServer ( frameTime ) ; <nl> ProcessPeripherals ( frameTime ) ; <nl> - m_pInertialScrollingHandler - > ProcessInertialScroll ( frameTime ) ; <nl> + if ( processGUI ) <nl> + m_pInertialScrollingHandler - > ProcessInertialScroll ( frameTime ) ; <nl> + } <nl> + if ( processGUI ) <nl> + { <nl> + if ( ! m_bStop ) <nl> + g_windowManager . Process ( CTimeUtils : : GetFrameTime ( ) ) ; <nl> + g_windowManager . FrameMove ( ) ; <nl> } <nl> - if ( ! m_bStop ) <nl> - g_windowManager . Process ( CTimeUtils : : GetFrameTime ( ) ) ; <nl> - g_windowManager . FrameMove ( ) ; <nl> } <nl> <nl> bool CApplication : : ProcessGamepad ( float frameTime ) <nl> mmm a / xbmc / Application . h <nl> ppp b / xbmc / Application . h <nl> class CApplication : public CXBApplicationEx , public IPlayerCallback , public IMs <nl> CApplication ( void ) ; <nl> virtual ~ CApplication ( void ) ; <nl> virtual bool Initialize ( ) ; <nl> - virtual void FrameMove ( bool processEvents ) ; <nl> + virtual void FrameMove ( bool processEvents , bool processGUI = true ) ; <nl> virtual void Render ( ) ; <nl> virtual bool RenderNoPresent ( ) ; <nl> virtual void Preflight ( ) ; <nl> virtual bool Create ( ) ; <nl> virtual bool Cleanup ( ) ; <nl> <nl> + bool CreateGUI ( ) ; <nl> + bool InitWindow ( ) ; <nl> + bool DestroyWindow ( ) ; <nl> void StartServices ( ) ; <nl> void StopServices ( ) ; <nl> bool StartWebServer ( ) ; <nl> mmm a / xbmc / Makefile . in <nl> ppp b / xbmc / Makefile . in <nl> SRCS = Application . cpp \ <nl> <nl> LIB = xbmc . a <nl> <nl> + ifneq ( @ USE_LIBXBMC @ , 1 ) <nl> + SRCS + = main . cpp <nl> + endif <nl> + <nl> DISTCLEAN_FILES = DllPaths_generated . h <nl> <nl> include @ abs_top_srcdir @ / Makefile . include <nl> mmm a / xbmc / XBApplicationEx . cpp <nl> ppp b / xbmc / XBApplicationEx . cpp <nl> <nl> # include " system . h " <nl> # include " XBApplicationEx . h " <nl> # include " utils / log . h " <nl> + # include " threads / SystemClock . h " <nl> # ifdef HAS_PERFORMANCE_SAMPLE <nl> # include " utils / PerformanceSample . h " <nl> # else <nl> VOID CXBApplicationEx : : Destroy ( ) <nl> } <nl> <nl> / * Function that runs the application * / <nl> - INT CXBApplicationEx : : Run ( ) <nl> + INT CXBApplicationEx : : Run ( bool renderGUI ) <nl> { <nl> CLog : : Log ( LOGNOTICE , " Running the application . . . " ) ; <nl> <nl> BYTE processExceptionCount = 0 ; <nl> BYTE frameMoveExceptionCount = 0 ; <nl> BYTE renderExceptionCount = 0 ; <nl> + unsigned int lastFrameTime = 0 ; <nl> + unsigned int frameTime = 0 ; <nl> + const unsigned int noRenderFrameTime = 15 ; / / Simulates ~ 66fps <nl> <nl> # ifndef _DEBUG <nl> const BYTE MAX_EXCEPTION_COUNT = 10 ; <nl> INT CXBApplicationEx : : Run ( ) <nl> try <nl> { <nl> # endif <nl> + lastFrameTime = XbmcThreads : : SystemClockMillis ( ) ; <nl> Process ( ) ; <nl> / / reset exception count <nl> processExceptionCount = 0 ; <nl> INT CXBApplicationEx : : Run ( ) <nl> try <nl> { <nl> # endif <nl> - if ( ! m_bStop ) FrameMove ( true ) ; <nl> + if ( ! m_bStop ) FrameMove ( true , renderGUI ) ; <nl> / / reset exception count <nl> frameMoveExceptionCount = 0 ; <nl> <nl> INT CXBApplicationEx : : Run ( ) <nl> try <nl> { <nl> # endif <nl> - if ( ! m_bStop ) Render ( ) ; <nl> + if ( renderGUI & & ! m_bStop ) Render ( ) ; <nl> + else if ( ! renderGUI ) <nl> + { <nl> + frameTime = XbmcThreads : : SystemClockMillis ( ) - lastFrameTime ; <nl> + if ( frameTime < noRenderFrameTime ) <nl> + Sleep ( noRenderFrameTime - frameTime ) ; <nl> + } <nl> + <nl> / / reset exception count <nl> renderExceptionCount = 0 ; <nl> <nl> mmm a / xbmc / XBApplicationEx . h <nl> ppp b / xbmc / XBApplicationEx . h <nl> class CXBApplicationEx : public IWindowManagerCallback <nl> public : <nl> / / Functions to create , run , and clean up the application <nl> virtual bool Create ( ) ; <nl> - INT Run ( ) ; <nl> + INT Run ( bool renderGUI = true ) ; <nl> VOID Destroy ( ) ; <nl> <nl> private : <nl> mmm a / xbmc / guilib / IWindowManagerCallback . h <nl> ppp b / xbmc / guilib / IWindowManagerCallback . h <nl> class IWindowManagerCallback <nl> IWindowManagerCallback ( void ) ; <nl> virtual ~ IWindowManagerCallback ( void ) ; <nl> <nl> - virtual void FrameMove ( bool processEvents ) = 0 ; <nl> + virtual void FrameMove ( bool processEvents , bool processGUI = true ) = 0 ; <nl> virtual void Render ( ) = 0 ; <nl> virtual void Process ( ) = 0 ; <nl> } ; <nl> new file mode 100644 <nl> index 000000000000 . . b9b2d587ff77 <nl> mmm / dev / null <nl> ppp b / xbmc / main . cpp <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2008 Team XBMC <nl> + * http : / / www . xbmc . org <nl> + * <nl> + * This Program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 , or ( at your option ) <nl> + * any later version . <nl> + * <nl> + * This Program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License <nl> + * along with XBMC ; see the file COPYING . If not , write to <nl> + * the Free Software Foundation , 675 Mass Ave , Cambridge , MA 02139 , USA . <nl> + * http : / / www . gnu . org / copyleft / gpl . html <nl> + * <nl> + * / <nl> + <nl> + # include " system . h " <nl> + # include " settings / AppParamParser . h " <nl> + # include " settings / AdvancedSettings . h " <nl> + # include " FileItem . h " <nl> + # include " Application . h " <nl> + # include " PlayListPlayer . h " <nl> + # include " utils / log . h " <nl> + # include " xbmc . h " <nl> + # ifdef _LINUX <nl> + # include < sys / resource . h > <nl> + # include < signal . h > <nl> + # endif <nl> + # if defined ( TARGET_DARWIN_OSX ) <nl> + # include " Util . h " <nl> + / / SDL redefines main as SDL_main <nl> + # ifdef HAS_SDL <nl> + # include < SDL / SDL . h > <nl> + # endif <nl> + # endif <nl> + # ifdef HAS_LIRC <nl> + # include " input / linux / LIRC . h " <nl> + # endif <nl> + # include " XbmcContext . h " <nl> + <nl> + int main ( int argc , char * argv [ ] ) <nl> + { <nl> + / / set up some xbmc specific relationships <nl> + XBMC : : Context context ; <nl> + <nl> + bool renderGUI = true ; <nl> + / / this can ' t be set from CAdvancedSettings : : Initialize ( ) because it will overwrite <nl> + / / the loglevel set with the - - debug flag <nl> + # ifdef _DEBUG <nl> + g_advancedSettings . m_logLevel = LOG_LEVEL_DEBUG ; <nl> + g_advancedSettings . m_logLevelHint = LOG_LEVEL_DEBUG ; <nl> + # else <nl> + g_advancedSettings . m_logLevel = LOG_LEVEL_NORMAL ; <nl> + g_advancedSettings . m_logLevelHint = LOG_LEVEL_NORMAL ; <nl> + # endif <nl> + CLog : : SetLogLevel ( g_advancedSettings . m_logLevel ) ; <nl> + <nl> + # ifdef _LINUX <nl> + # if defined ( DEBUG ) <nl> + struct rlimit rlim ; <nl> + rlim . rlim_cur = rlim . rlim_max = RLIM_INFINITY ; <nl> + if ( setrlimit ( RLIMIT_CORE , & rlim ) = = - 1 ) <nl> + CLog : : Log ( LOGDEBUG , " Failed to set core size limit ( % s ) " , strerror ( errno ) ) ; <nl> + # endif <nl> + / / Prevent child processes from becoming zombies on exit if not waited upon . See also Util : : Command <nl> + struct sigaction sa ; <nl> + memset ( & sa , 0 , sizeof ( sa ) ) ; <nl> + <nl> + sa . sa_flags = SA_NOCLDWAIT ; <nl> + sa . sa_handler = SIG_IGN ; <nl> + sigaction ( SIGCHLD , & sa , NULL ) ; <nl> + # endif <nl> + setlocale ( LC_NUMERIC , " C " ) ; <nl> + g_advancedSettings . Initialize ( ) ; <nl> + <nl> + # ifndef _WIN32 <nl> + CAppParamParser appParamParser ; <nl> + appParamParser . Parse ( ( const char * * ) argv , argc ) ; <nl> + # endif <nl> + return XBMC_Run ( renderGUI ) ; <nl> + } <nl> mmm a / xbmc / settings / AdvancedSettings . cpp <nl> ppp b / xbmc / settings / AdvancedSettings . cpp <nl> using namespace XFILE ; <nl> <nl> CAdvancedSettings : : CAdvancedSettings ( ) <nl> { <nl> + m_initialized = false ; <nl> } <nl> <nl> void CAdvancedSettings : : Initialize ( ) <nl> void CAdvancedSettings : : Initialize ( ) <nl> m_logEnableAirtunes = false ; <nl> m_airTunesPort = 36666 ; <nl> m_airPlayPort = 36667 ; <nl> + m_initialized = true ; <nl> } <nl> <nl> bool CAdvancedSettings : : Load ( ) <nl> mmm a / xbmc / settings / AdvancedSettings . h <nl> ppp b / xbmc / settings / AdvancedSettings . h <nl> class CAdvancedSettings <nl> static CAdvancedSettings * getInstance ( ) ; <nl> <nl> void Initialize ( ) ; <nl> + bool Initialized ( ) { return m_initialized ; } ; <nl> void AddSettingsFile ( const CStdString & filename ) ; <nl> bool Load ( ) ; <nl> void Clear ( ) ; <nl> class CAdvancedSettings <nl> void ParseSettingsFile ( const CStdString & file ) ; <nl> <nl> float GetDisplayLatency ( float refreshrate ) ; <nl> + bool m_initialized ; <nl> } ; <nl> <nl> XBMC_GLOBAL ( CAdvancedSettings , g_advancedSettings ) ; <nl> mmm a / xbmc / win32 / XBMC_PC . cpp <nl> ppp b / xbmc / win32 / XBMC_PC . cpp <nl> INT WINAPI WinMain ( HINSTANCE hInst , HINSTANCE , LPSTR commandLine , INT ) <nl> SetErrorMode ( SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX ) ; <nl> # endif <nl> <nl> - g_application . Run ( ) ; <nl> + if ( ! g_application . CreateGUI ( ) ) <nl> + { <nl> + CStdString errorMsg ; <nl> + errorMsg . Format ( " CApplication : : CreateGUI ( ) failed - Check log file for display errors " ) ; <nl> + MessageBox ( NULL , errorMsg . c_str ( ) , " XBMC : Error " , MB_OK | MB_ICONERROR ) ; <nl> + return 0 ; <nl> + } <nl> + <nl> + if ( ! g_application . Initialize ( ) ) <nl> + { <nl> + CStdString errorMsg ; <nl> + errorMsg . Format ( " CApplication : : Initialize ( ) failed - Check log file and that it is writable " ) ; <nl> + MessageBox ( NULL , errorMsg . c_str ( ) , " XBMC : Error " , MB_OK | MB_ICONERROR ) ; <nl> + return 0 ; <nl> + } <nl> + <nl> + g_application . Run ( true ) ; <nl> <nl> / / put everything in CApplication : : Cleanup ( ) since this point is never reached <nl> <nl> mmm a / xbmc / xbmc . cpp <nl> ppp b / xbmc / xbmc . cpp <nl> <nl> * <nl> * / <nl> <nl> - <nl> - / / XBMC <nl> - / / <nl> - / / libraries : <nl> - / / - CDRipX : doesnt support section loading yet <nl> - / / - xbfilezilla : doesnt support section loading yet <nl> - / / <nl> - <nl> - # include " system . h " <nl> - # include " settings / AppParamParser . h " <nl> - # include " settings / AdvancedSettings . h " <nl> - # include " FileItem . h " <nl> # include " Application . h " <nl> - # include " PlayListPlayer . h " <nl> - # include " utils / log . h " <nl> - # ifdef _LINUX <nl> - # include < sys / resource . h > <nl> - # include < signal . h > <nl> - # endif <nl> - # if defined ( TARGET_DARWIN_OSX ) <nl> - # include " Util . h " <nl> - / / SDL redefines main as SDL_main <nl> - # ifdef HAS_SDL <nl> - # include < SDL / SDL . h > <nl> - # endif <nl> - # endif <nl> - # ifdef HAS_LIRC <nl> - # include " input / linux / LIRC . h " <nl> - # endif <nl> - # include " XbmcContext . h " <nl> - <nl> - int main ( int argc , char * argv [ ] ) <nl> + # include " settings / AdvancedSettings . h " <nl> + extern " C " int XBMC_Run ( bool renderGUI ) <nl> { <nl> - / / set up some xbmc specific relationships <nl> - XBMC : : Context context ; <nl> - <nl> int status = - 1 ; <nl> - / / this can ' t be set from CAdvancedSettings : : Initialize ( ) because it will overwrite <nl> - / / the loglevel set with the - - debug flag <nl> - # ifdef _DEBUG <nl> - g_advancedSettings . m_logLevel = LOG_LEVEL_DEBUG ; <nl> - g_advancedSettings . m_logLevelHint = LOG_LEVEL_DEBUG ; <nl> - # else <nl> - g_advancedSettings . m_logLevel = LOG_LEVEL_NORMAL ; <nl> - g_advancedSettings . m_logLevelHint = LOG_LEVEL_NORMAL ; <nl> - # endif <nl> - CLog : : SetLogLevel ( g_advancedSettings . m_logLevel ) ; <nl> <nl> - # ifdef _LINUX <nl> - # if defined ( DEBUG ) <nl> - struct rlimit rlim ; <nl> - rlim . rlim_cur = rlim . rlim_max = RLIM_INFINITY ; <nl> - if ( setrlimit ( RLIMIT_CORE , & rlim ) = = - 1 ) <nl> - CLog : : Log ( LOGDEBUG , " Failed to set core size limit ( % s ) " , strerror ( errno ) ) ; <nl> - # endif <nl> - / / Prevent child processes from becoming zombies on exit if not waited upon . See also Util : : Command <nl> - struct sigaction sa ; <nl> - memset ( & sa , 0 , sizeof ( sa ) ) ; <nl> + if ( ! g_advancedSettings . Initialized ( ) ) <nl> + g_advancedSettings . Initialize ( ) ; <nl> <nl> - sa . sa_flags = SA_NOCLDWAIT ; <nl> - sa . sa_handler = SIG_IGN ; <nl> - sigaction ( SIGCHLD , & sa , NULL ) ; <nl> - # endif <nl> - setlocale ( LC_NUMERIC , " C " ) ; <nl> - g_advancedSettings . Initialize ( ) ; <nl> - <nl> - # ifndef _WIN32 <nl> - CAppParamParser appParamParser ; <nl> - appParamParser . Parse ( ( const char * * ) argv , argc ) ; <nl> - # endif <nl> - g_application . Preflight ( ) ; <nl> if ( ! g_application . Create ( ) ) <nl> { <nl> fprintf ( stderr , " ERROR : Unable to create application . Exiting \ n " ) ; <nl> return status ; <nl> } <nl> + if ( renderGUI & & ! g_application . CreateGUI ( ) ) <nl> + { <nl> + fprintf ( stderr , " ERROR : Unable to create GUI . Exiting \ n " ) ; <nl> + return status ; <nl> + } <nl> + if ( ! g_application . Initialize ( ) ) <nl> + { <nl> + fprintf ( stderr , " ERROR : Unable to Initialize . Exiting \ n " ) ; <nl> + return status ; <nl> + } <nl> <nl> try <nl> { <nl> - status = g_application . Run ( ) ; <nl> + status = g_application . Run ( renderGUI ) ; <nl> } <nl> catch ( . . . ) <nl> { <nl> new file mode 100644 <nl> index 000000000000 . . 1972d1ba7abe <nl> mmm / dev / null <nl> ppp b / xbmc / xbmc . h <nl> <nl> + / * <nl> + * Copyright ( C ) 2005 - 2012 Team XBMC <nl> + * http : / / www . xbmc . org <nl> + * <nl> + * This program is free software ; you can redistribute it and / or modify <nl> + * it under the terms of the GNU General Public License as published by <nl> + * the Free Software Foundation ; either version 2 of the License , or <nl> + * ( at your option ) any later version . <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU General Public License along <nl> + * with this program ; if not , write to the Free Software Foundation , Inc . , <nl> + * 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA . <nl> + * <nl> + * / <nl> + <nl> + # pragma once <nl> + extern " C " int XBMC_Run ( bool renderGUI ) ; <nl> + <nl>
|
Merge pull request from theuni / shared - lib - rebase
|
xbmc/xbmc
|
66520ff7d5779a1c1e351bd4cb1ba5c6a77d3b83
|
2012-06-07T01:38:56Z
|
mmm a / src / core / utils / misc . cpp <nl> ppp b / src / core / utils / misc . cpp <nl> void Utils : : Misc : : openFolderSelect ( const QString & absolutePath ) <nl> proc . startDetached ( " caja " , QStringList ( ) < < " - - no - desktop " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> else if ( output = = " nemo . desktop " ) <nl> proc . startDetached ( " nemo " , QStringList ( ) < < " - - no - desktop " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> - else if ( output = = " kfmclient_dir . desktop " ) <nl> + else if ( output = = " konqueror . desktop " | | output = = " kfmclient_dir . desktop " ) <nl> proc . startDetached ( " konqueror " , QStringList ( ) < < " - - select " < < Utils : : Fs : : toNativePath ( path ) ) ; <nl> else <nl> openPath ( path . left ( path . lastIndexOf ( " / " ) ) ) ; <nl>
|
Merge pull request from ngosang / filemanagers
|
qbittorrent/qBittorrent
|
f781cc18a61a192ae715e6a51a300b16c8b0f3d3
|
2015-10-05T09:09:57Z
|
mmm a / CHANGELOG . md <nl> ppp b / CHANGELOG . md <nl> CHANGELOG <nl> <nl> Swift 5 . 0 <nl> mmmmmmmmm <nl> + <nl> + * Swift 3 mode has been removed . Supported values for the ` - swift - version ` <nl> + flag are ` 4 ` , ` 4 . 2 ` , and ` 5 ` . <nl> + <nl> + * [ SE - 0228 ] [ ] : <nl> + <nl> + String interpolation has been overhauled to improve its performance , <nl> + clarity , and efficiency . <nl> + <nl> + Note that the old ` _ExpressibleByStringInterpolation ` protocol has been <nl> + removed ; any code making use of this protocol will need to be updated <nl> + for the new design . An ` # if compiler ` block can be used to conditionalize <nl> + code between 4 . 2 and 5 . 0 , for example : <nl> + <nl> + ` ` ` swift <nl> + # if compiler ( < 5 . 0 ) <nl> + extension MyType : _ExpressibleByStringInterpolation { . . . } <nl> + # else <nl> + extension MyType : ExpressibleByStringInterpolation { . . . } <nl> + # endif <nl> + ` ` ` <nl> + <nl> + * [ SE - 0213 ] [ ] : <nl> + <nl> + If ` T ` conforms to one of the ` ExpressibleBy * ` protocols and ` literal ` is a <nl> + literal expression , then ` T ( literal ) ` will construct a literal of type ` T ` <nl> + using the corresponding protocol , rather than calling a constructor member <nl> + of ` T ` with a value of the protocol ' s default literal type . <nl> + <nl> + For example , expressions like ` UInt64 ( 0xffff_ffff_ffff_ffff ) ` are now valid , <nl> + where previously they would overflow the default integer literal type of ` Int ` . <nl> + <nl> + * [ SE - 0230 ] [ ] : <nl> + <nl> + In Swift 5 mode , ` try ? ` with an expression of Optional type will flatten the <nl> + resulting Optional , instead of returning an Optional of an Optional . <nl> + <nl> * [ SR - 5719 ] [ ] : <nl> <nl> - Starting from ` - swift - version 5 ` , implicit ` @ autoclosure ` function type <nl> - forwarding has been disabled , and new a diagnostic has been added suggesting <nl> - to add ` ( ) ` to call the function value in such case . The call itself would be <nl> - wrapped in an implicit closure and passed to the corresponding parameter . <nl> + In Swift 5 mode , ` @ autoclosure ` parameters can no longer be forwarded to <nl> + ` @ autoclosure ` arguments in another function call . Instead , you must explicitly <nl> + call the function value with ` ( ) ` ; the call itself is wrapped inside an <nl> + implicit closure , guaranteeing the same behavior as in Swift 4 mode . <nl> <nl> Example : <nl> <nl> Swift 5 . 0 <nl> } <nl> ` ` ` <nl> <nl> + * [ SR - 8109 ] [ ] : <nl> + <nl> + Single - element labeled tuple expressions , for example ` ( label : 123 ) ` , were <nl> + allowed in some contexts but often resulted in surprising , inconsistent <nl> + behavior that varied across compiler releases . They are now completely <nl> + disallowed . <nl> + <nl> + Note that single - element labeled _types_ , for example ` var x : ( label : Int ) ` , <nl> + have already been prohibited since Swift 3 . <nl> + <nl> + * [ SR - 695 ] [ ] : <nl> + <nl> + In Swift 5 mode , a class method returning ` Self ` can no longer be overridden <nl> + with a method returning a non - final concrete class type . Such code is not <nl> + type safe and will need to be updated . <nl> + <nl> + For example , <nl> + <nl> + ` ` ` swift <nl> + class Base { <nl> + class func factory ( ) - > Self { . . . } <nl> + } <nl> + <nl> + class Derived : Base { <nl> + class override func factory ( ) - > Derived { . . . } <nl> + } <nl> + ` ` ` <nl> + <nl> + * In Swift 5 mode , the type of ` self ` in a convenience initializer of a non - final <nl> + class is now the dynamic ` Self ` type , and not the concrete class type . <nl> + <nl> + * [ SR - 5581 ] [ ] : <nl> + <nl> + Protocols can now constrain their conforming types to those that subclasses a <nl> + given class . Two equivalent forms are supported : <nl> + <nl> + ` ` ` swift <nl> + protocol MyView : UIView { . . . } <nl> + protocol MyView where Self : UIView { . . . } <nl> + ` ` ` <nl> + <nl> + Note that Swift 4 . 2 accepted the second form , but it was not fully implemented <nl> + and could sometimes crash at compile time or run time . <nl> + <nl> + * [ SR - 631 ] [ ] : <nl> + <nl> + Extension binding now supports extensions of nested types which themselves are <nl> + defined inside extensions . Previously this could fail with some declaration orders , <nl> + producing spurious " undeclared type " errors . <nl> + <nl> * [ SR - 7139 ] [ ] : <nl> <nl> Exclusive memory access is now enforced at runtime by default in <nl> Swift 5 . 0 <nl> <nl> * [ SE - 0214 ] [ ] : <nl> <nl> - Renamed the ` DictionaryLiteral ` type to ` KeyValuePairs ` . <nl> + The ` DictionaryLiteral ` type has been renamed to ` KeyValuePairs ` . <nl> A typealias preserves the old name for compatibility . <nl> <nl> * [ SR - 2608 ] [ ] <nl> Swift 5 . 0 <nl> Default arguments are now printed in SourceKit - generated interfaces for Swift <nl> modules , instead of just using a placeholder ` default ` . <nl> <nl> - * Notable bug fix : unowned and unowned ( unsafe ) variables now support optional <nl> - types . <nl> + * ` unowned ` and ` unowned ( unsafe ) ` variables now support Optional types . <nl> + <nl> + * Designated initializers with variadic parameters are now correctly inherited <nl> + in subclasses . <nl> + <nl> + * Extensions of concrete subclasses of generic classes can now contain <nl> + ` @ objc ` members . <nl> + <nl> + * Complex recursive type definitions involving classes and generics that would <nl> + previously cause deadlocks at run time are now fully supported . <nl> <nl> * [ SR - 419 ] [ ] <nl> <nl> Swift 1 . 0 <nl> [ SE - 0225 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0225 - binaryinteger - iseven - isodd - ismultiple . md > <nl> [ SE - 0226 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0226 - package - manager - target - based - dep - resolution . md > <nl> [ SE - 0227 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0227 - identity - keypath . md > <nl> + [ SE - 0228 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0228 - fix - expressiblebystringinterpolation . md > <nl> + [ SE - 0230 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0230 - flatten - optional - try . md > <nl> <nl> [ SR - 106 ] : < https : / / bugs . swift . org / browse / SR - 106 > <nl> [ SR - 419 ] : < https : / / bugs . swift . org / browse / SR - 419 > <nl> + [ SR - 631 ] : < https : / / bugs . swift . org / browse / SR - 631 > <nl> + [ SR - 695 ] : < https : / / bugs . swift . org / browse / SR - 695 > <nl> [ SR - 1009 ] : < https : / / bugs . swift . org / browse / SR - 1009 > <nl> [ SR - 1446 ] : < https : / / bugs . swift . org / browse / SR - 1446 > <nl> [ SR - 1529 ] : < https : / / bugs . swift . org / browse / SR - 1529 > <nl> Swift 1 . 0 <nl> [ SR - 2394 ] : < https : / / bugs . swift . org / browse / SR - 2394 > <nl> [ SR - 2608 ] : < https : / / bugs . swift . org / browse / SR - 2608 > <nl> [ SR - 4248 ] : < https : / / bugs . swift . org / browse / SR - 4248 > <nl> + [ SR - 5581 ] : < https : / / bugs . swift . org / browse / SR - 5581 > <nl> + [ SR - 5719 ] : < https : / / bugs . swift . org / browse / SR - 5719 > <nl> [ SR - 7139 ] : < https : / / bugs . swift . org / browse / SR - 7139 > <nl> [ SR - 7251 ] : < https : / / bugs . swift . org / browse / SR - 7251 > <nl> - [ SR - 5719 ] : < https : / / bugs . swift . org / browse / SR - 5719 > <nl> + [ SR - 8109 ] : < https : / / bugs . swift . org / browse / SR - 8109 > <nl>
|
Merge pull request from slavapestov / update - changelog
|
apple/swift
|
f6eeb3adca4f6ed7e66d4463883540c361e8f2cf
|
2018-12-18T01:44:04Z
|
mmm a / samples / cpp / dis_opticalflow . cpp <nl> ppp b / samples / cpp / dis_opticalflow . cpp <nl> <nl> # include " opencv2 / core / utility . hpp " <nl> # include " opencv2 / highgui . hpp " <nl> # include " opencv2 / imgproc . hpp " <nl> + # include " opencv2 / videoio . hpp " <nl> # include " opencv2 / video . hpp " <nl> <nl> using namespace std ; <nl> using namespace cv ; <nl> <nl> - static void help ( ) <nl> - { <nl> - printf ( " Usage : dis_optflow < video_file > \ n " ) ; <nl> - } <nl> - <nl> int main ( int argc , char * * argv ) <nl> { <nl> - VideoCapture cap ; <nl> + CommandLineParser parser ( argc , argv , " { @ video | vtest . avi | use video as input } " ) ; <nl> + string filename = samples : : findFileOrKeep ( parser . get < string > ( " @ video " ) ) ; <nl> <nl> - if ( argc < 2 ) <nl> - { <nl> - help ( ) ; <nl> - exit ( 1 ) ; <nl> - } <nl> + VideoCapture cap ; <nl> + cap . open ( filename ) ; <nl> <nl> - cap . open ( argv [ 1 ] ) ; <nl> if ( ! cap . isOpened ( ) ) <nl> { <nl> - printf ( " ERROR : Cannot open file % s \ n " , argv [ 1 ] ) ; <nl> + printf ( " ERROR : Cannot open file % s \ n " , filename . c_str ( ) ) ; <nl> + parser . printMessage ( ) ; <nl> return - 1 ; <nl> } <nl> <nl> int main ( int argc , char * * argv ) <nl> Mat hsv_split [ 3 ] , hsv ; <nl> char ret ; <nl> <nl> - namedWindow ( " flow " , 1 ) ; <nl> - namedWindow ( " orig " , 1 ) ; <nl> - <nl> Ptr < DenseOpticalFlow > algorithm = DISOpticalFlow : : create ( DISOpticalFlow : : PRESET_MEDIUM ) ; <nl> <nl> while ( true ) <nl> mmm a / samples / cpp / ela . cpp <nl> ppp b / samples / cpp / ela . cpp <nl> <nl> @ date Jun 24 , 2018 <nl> * / <nl> <nl> - # include < opencv2 / highgui / highgui . hpp > <nl> + # include < opencv2 / highgui . hpp > <nl> # include < iostream > <nl> - # include < vector > <nl> - <nl> - const char * keys = <nl> - " { help h | | Print help message . } " <nl> - " { input i | | Input image to calc ELA algorithm . } " ; <nl> <nl> using namespace cv ; <nl> <nl> static void processImage ( int , void * ) <nl> <nl> int main ( int argc , char * argv [ ] ) <nl> { <nl> + CommandLineParser parser ( argc , argv , " { input i | ela_modified . jpg | Input image to calculate ELA algorithm . } " ) ; <nl> + parser . about ( " \ nJpeg Recompression Example : \ n " ) ; <nl> + parser . printMessage ( ) ; <nl> <nl> - CommandLineParser parser ( argc , argv , keys ) ; <nl> - if ( argc = = 1 | | parser . has ( " help " ) ) <nl> - { <nl> - parser . printMessage ( ) ; <nl> - std : : cout < < " \ nJpeg Recompression Example : \ n \ t " < < argv [ 0 ] < < " - - input = . . / . . / data / ela_modified . jpg \ n " ; <nl> - return 0 ; <nl> - } <nl> + / / Read the new image <nl> + image = imread ( samples : : findFile ( parser . get < String > ( " input " ) ) ) ; <nl> <nl> - if ( parser . has ( " input " ) ) <nl> - { <nl> - / / Read the new image <nl> - image = imread ( parser . get < String > ( " input " ) ) ; <nl> - } <nl> / / Check image <nl> if ( ! image . empty ( ) ) <nl> { <nl> mmm a / samples / python / squares . py <nl> ppp b / samples / python / squares . py <nl> def find_squares ( img ) : <nl> bin = cv . dilate ( bin , None ) <nl> else : <nl> _retval , bin = cv . threshold ( gray , thrs , 255 , cv . THRESH_BINARY ) <nl> - bin , contours , _hierarchy = cv . findContours ( bin , cv . RETR_LIST , cv . CHAIN_APPROX_SIMPLE ) <nl> + contours , _hierarchy = cv . findContours ( bin , cv . RETR_LIST , cv . CHAIN_APPROX_SIMPLE ) <nl> for cnt in contours : <nl> cnt_len = cv . arcLength ( cnt , True ) <nl> cnt = cv . approxPolyDP ( cnt , 0 . 02 * cnt_len , True ) <nl>
|
Merge pull request from sturkmen72 : update_samples_v4
|
opencv/opencv
|
a052567db8be26a09a78b5d51e67e6224e6a6d55
|
2019-09-20T16:41:41Z
|
mmm a / drivers / dummy / SCsub <nl> ppp b / drivers / dummy / SCsub <nl> <nl> <nl> Import ( ' env ' ) <nl> <nl> - env . add_source_files ( env . drivers_sources , " * . cpp " ) <nl> + env . add_source_files ( env . drivers_sources , " * . cpp " ) <nl> new file mode 100644 <nl> index 00000000000 . . c3d8e107673 <nl> mmm / dev / null <nl> ppp b / drivers / dummy / audio_driver_dummy . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * audio_driver_dummy . h * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * This file is part of : * / <nl> + / * GODOT ENGINE * / <nl> + / * https : / / godotengine . org * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * Copyright ( c ) 2007 - 2018 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2018 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * * / <nl> + / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> + / * a copy of this software and associated documentation files ( the * / <nl> + / * " Software " ) , to deal in the Software without restriction , including * / <nl> + / * without limitation the rights to use , copy , modify , merge , publish , * / <nl> + / * distribute , sublicense , and / or sell copies of the Software , and to * / <nl> + / * permit persons to whom the Software is furnished to do so , subject to * / <nl> + / * the following conditions : * / <nl> + / * * / <nl> + / * The above copyright notice and this permission notice shall be * / <nl> + / * included in all copies or substantial portions of the Software . * / <nl> + / * * / <nl> + / * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , * / <nl> + / * EXPRESS OR IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * / <nl> + / * MERCHANTABILITY , FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . * / <nl> + / * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * / <nl> + / * CLAIM , DAMAGES OR OTHER LIABILITY , WHETHER IN AN ACTION OF CONTRACT , * / <nl> + / * TORT OR OTHERWISE , ARISING FROM , OUT OF OR IN CONNECTION WITH THE * / <nl> + / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + # ifndef AUDIO_DRIVER_DUMMY_H <nl> + # define AUDIO_DRIVER_DUMMY_H <nl> + <nl> + # include " core / os / mutex . h " <nl> + # include " core / os / thread . h " <nl> + # include " servers / audio_server . h " <nl> + <nl> + class AudioDriverDummy : public AudioDriver { <nl> + public : <nl> + const char * get_name ( ) const { <nl> + return " Dummy " ; <nl> + } ; <nl> + <nl> + virtual Error init ( ) { return OK ; } <nl> + virtual void start ( ) { } ; <nl> + virtual int get_mix_rate ( ) const { } ; <nl> + virtual SpeakerMode get_speaker_mode ( ) const { } ; <nl> + virtual void lock ( ) { } ; <nl> + virtual void unlock ( ) { } ; <nl> + virtual void finish ( ) { } ; <nl> + <nl> + virtual float get_latency ( ) { } ; <nl> + <nl> + AudioDriverDummy ( ) { } ; <nl> + ~ AudioDriverDummy ( ) { } ; <nl> + } ; <nl> + <nl> + # endif / / AUDIO_DRIVER_DUMMY_H <nl> mmm a / drivers / dummy / rasterizer_dummy . h <nl> ppp b / drivers / dummy / rasterizer_dummy . h <nl> <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * rasterizer . h * / <nl> + / * rasterizer_dummy . h * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * This file is part of : * / <nl> / * GODOT ENGINE * / <nl> / * https : / / godotengine . org * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - / * Copyright ( c ) 2007 - 2017 Juan Linietsky , Ariel Manzur . * / <nl> - / * Copyright ( c ) 2014 - 2017 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> + / * Copyright ( c ) 2007 - 2018 Juan Linietsky , Ariel Manzur . * / <nl> + / * Copyright ( c ) 2014 - 2018 Godot Engine contributors ( cf . AUTHORS . md ) * / <nl> / * * / <nl> / * Permission is hereby granted , free of charge , to any person obtaining * / <nl> / * a copy of this software and associated documentation files ( the * / <nl> <nl> # define RASTERIZER_DUMMY_H <nl> <nl> # include " camera_matrix . h " <nl> + # include " scene / resources / mesh . h " <nl> # include " servers / visual / rasterizer . h " <nl> # include " servers / visual_server . h " <nl> <nl> class RasterizerStorageDummy : public RasterizerStorage { <nl> <nl> RID mesh_create ( ) { return RID ( ) ; } <nl> <nl> + void mesh_add_surface_from_arrays ( RID p_mesh , VS : : PrimitiveType p_primitive , const Array & p_arrays , const Array & p_blend_shapes = Array ( ) , uint32_t p_compress_format = Mesh : : ARRAY_COMPRESS_DEFAULT ) { } <nl> void mesh_add_surface ( RID p_mesh , uint32_t p_format , VS : : PrimitiveType p_primitive , const PoolVector < uint8_t > & p_array , int p_vertex_count , const PoolVector < uint8_t > & p_index_array , int p_index_count , const AABB & p_aabb , const Vector < PoolVector < uint8_t > > & p_blend_shapes = Vector < PoolVector < uint8_t > > ( ) , const Vector < AABB > & p_bone_aabbs = Vector < AABB > ( ) ) { } <nl> <nl> + void mesh_add_surface_from_mesh_data ( RID p_mesh , const Geometry : : MeshData & p_mesh_data ) { } <nl> + void mesh_add_surface_from_planes ( RID p_mesh , const PoolVector < Plane > & p_planes ) { } <nl> + <nl> void mesh_set_blend_shape_count ( RID p_mesh , int p_amount ) { } <nl> int mesh_get_blend_shape_count ( RID p_mesh ) const { return 0 ; } <nl> <nl> class RasterizerStorageDummy : public RasterizerStorage { <nl> void gi_probe_dynamic_data_update ( RID p_gi_probe_data , int p_depth_slice , int p_slice_count , int p_mipmap , const void * p_data ) { } <nl> <nl> / * LIGHTMAP CAPTURE * / <nl> + struct LightmapCaptureOctree { <nl> + <nl> + enum { <nl> + CHILD_EMPTY = 0xFFFFFFFF <nl> + } ; <nl> + <nl> + uint16_t light [ 6 ] [ 3 ] ; / / anisotropic light <nl> + float alpha ; <nl> + uint32_t children [ 8 ] ; <nl> + } ; <nl> <nl> RID lightmap_capture_create ( ) { return RID ( ) ; } <nl> void lightmap_capture_set_bounds ( RID p_capture , const AABB & p_bounds ) { } <nl> class RasterizerStorageDummy : public RasterizerStorage { <nl> int lightmap_capture_get_octree_cell_subdiv ( RID p_capture ) const { return 0 ; } <nl> void lightmap_capture_set_energy ( RID p_capture , float p_energy ) { } <nl> float lightmap_capture_get_energy ( RID p_capture ) const { return 0 . 0 ; } <nl> - const PoolVector < LightmapCaptureOctree > * lightmap_capture_get_octree_ptr ( RID p_capture ) const { } <nl> + const PoolVector < RasterizerStorage : : LightmapCaptureOctree > * lightmap_capture_get_octree_ptr ( RID p_capture ) const { <nl> + PoolVector < RasterizerStorage : : LightmapCaptureOctree > p ; <nl> + return & p ; <nl> + } <nl> <nl> / * PARTICLES * / <nl> <nl> mmm a / platform / server / os_server . cpp <nl> ppp b / platform / server / os_server . cpp <nl> <nl> / * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE . * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> # include " os_server . h " <nl> + # include " drivers / dummy / audio_driver_dummy . h " <nl> # include " drivers / dummy / rasterizer_dummy . h " <nl> # include " print_string . h " <nl> # include " servers / visual / visual_server_raster . h " <nl> const char * OS_Server : : get_video_driver_name ( int p_driver ) const { <nl> } <nl> <nl> int OS_Server : : get_audio_driver_count ( ) const { <nl> - return 0 ; <nl> + return 1 ; <nl> } <nl> <nl> const char * OS_Server : : get_audio_driver_name ( int p_driver ) const { <nl> <nl> - return " " ; <nl> + return " Dummy " ; <nl> } <nl> <nl> void OS_Server : : initialize_core ( ) { <nl>
|
Add dummy audio driver , fix dummy rasterizer
|
godotengine/godot
|
4e1923a931a3d849563bbe5d6fe4a52277daf090
|
2018-02-15T15:34:11Z
|
mmm a / src / core / hle / kernel / svc . cpp <nl> ppp b / src / core / hle / kernel / svc . cpp <nl> static ResultCode GetInfo ( u64 * result , u64 info_id , u64 handle , u64 info_sub_id ) <nl> * result = g_current_process - > allowed_thread_priority_mask ; <nl> break ; <nl> case GetInfoType : : MapRegionBaseAddr : <nl> - * result = vm_manager . GetAddressSpaceBaseAddr ( ) ; <nl> + * result = vm_manager . GetMapRegionBaseAddr ( ) ; <nl> break ; <nl> case GetInfoType : : MapRegionSize : <nl> * result = vm_manager . GetAddressSpaceSize ( ) ; <nl> mmm a / src / core / hle / kernel / vm_manager . cpp <nl> ppp b / src / core / hle / kernel / vm_manager . cpp <nl> u64 VMManager : : GetAddressSpaceSize ( ) { <nl> return MAX_ADDRESS ; <nl> } <nl> <nl> + VAddr VMManager : : GetMapRegionBaseAddr ( ) { <nl> + LOG_WARNING ( Kernel , " ( STUBBED ) called " ) ; <nl> + return Memory : : HEAP_VADDR ; <nl> + } <nl> + <nl> VAddr VMManager : : GetNewMapRegionBaseAddr ( ) { <nl> LOG_WARNING ( Kernel , " ( STUBBED ) called " ) ; <nl> return 0x8000000 ; <nl> mmm a / src / core / hle / kernel / vm_manager . h <nl> ppp b / src / core / hle / kernel / vm_manager . h <nl> class VMManager final { <nl> / / / Gets the total address space address size , used by svcGetInfo <nl> u64 GetAddressSpaceSize ( ) ; <nl> <nl> + / / / Gets the map region base address , used by svcGetInfo <nl> + VAddr GetMapRegionBaseAddr ( ) ; <nl> + <nl> / / / Gets the base address for a new memory region , used by svcGetInfo <nl> VAddr GetNewMapRegionBaseAddr ( ) ; <nl> <nl>
|
svc : Fix svcGetInfo MapRegionBaseAddr .
|
yuzu-emu/yuzu
|
e1ee8f4657235225a6cf1333b4b126ebb7931449
|
2018-01-19T04:44:15Z
|
mmm a / modules / imgproc / src / opencl / pyr_up . cl <nl> ppp b / modules / imgproc / src / opencl / pyr_up . cl <nl> <nl> # define PIXSIZE ( ( int ) sizeof ( T1 ) * 3 ) <nl> # endif <nl> <nl> - # define noconvert <nl> + # define EXTRAPOLATE ( x , maxV ) min ( maxV - 1 , ( int ) abs ( x ) ) <nl> <nl> + # define noconvert <nl> <nl> __kernel void pyrUp ( __global const uchar * src , int src_step , int src_offset , int src_rows , int src_cols , <nl> __global uchar * dst , int dst_step , int dst_offset , int dst_rows , int dst_cols ) <nl> __kernel void pyrUp ( __global const uchar * src , int src_step , int src_offset , in <nl> const int x = get_global_id ( 0 ) ; <nl> const int y = get_global_id ( 1 ) ; <nl> <nl> - const int lsizex = get_local_size ( 0 ) ; <nl> - const int lsizey = get_local_size ( 1 ) ; <nl> - <nl> const int tidx = get_local_id ( 0 ) ; <nl> const int tidy = get_local_id ( 1 ) ; <nl> <nl> - __local FT s_srcPatch [ 10 ] [ 10 ] ; <nl> - __local FT s_dstPatch [ 20 ] [ 16 ] ; <nl> + __local FT s_srcPatch [ LOCAL_SIZE / 2 + 2 ] [ LOCAL_SIZE / 2 + 2 ] ; <nl> + __local FT s_dstPatch [ LOCAL_SIZE / 2 + 2 ] [ LOCAL_SIZE ] ; <nl> <nl> __global uchar * dstData = dst + dst_offset ; <nl> __global const uchar * srcData = src + src_offset ; <nl> <nl> - if ( tidx < 10 & & tidy < 10 ) <nl> + if ( tidx < ( LOCAL_SIZE / 2 + 2 ) & & tidy < LOCAL_SIZE / 2 + 2 ) <nl> { <nl> - int srcx = mad24 ( ( int ) get_group_id ( 0 ) , lsizex > > 1 , tidx ) - 1 ; <nl> - int srcy = mad24 ( ( int ) get_group_id ( 1 ) , lsizey > > 1 , tidy ) - 1 ; <nl> - <nl> - srcx = abs ( srcx ) ; <nl> - srcx = min ( src_cols - 1 , srcx ) ; <nl> - <nl> - srcy = abs ( srcy ) ; <nl> - srcy = min ( src_rows - 1 , srcy ) ; <nl> + int srcx = EXTRAPOLATE ( mad24 ( ( int ) get_group_id ( 0 ) , LOCAL_SIZE / 2 , tidx ) - 1 , src_cols ) ; <nl> + int srcy = EXTRAPOLATE ( mad24 ( ( int ) get_group_id ( 1 ) , LOCAL_SIZE / 2 , tidy ) - 1 , src_rows ) ; <nl> <nl> s_srcPatch [ tidy ] [ tidx ] = convertToFT ( loadpix ( srcData + srcy * src_step + srcx * PIXSIZE ) ) ; <nl> } <nl> __kernel void pyrUp ( __global const uchar * src , int src_step , int src_offset , in <nl> barrier ( CLK_LOCAL_MEM_FENCE ) ; <nl> <nl> FT sum = 0 . f ; <nl> - const FT evenFlag = ( FT ) ( ( tidx & 1 ) = = 0 ) ; <nl> - const FT oddFlag = ( FT ) ( ( tidx & 1 ) ! = 0 ) ; <nl> - const bool eveny = ( ( tidy & 1 ) = = 0 ) ; <nl> <nl> - const FT co1 = 0 . 375f ; <nl> - const FT co2 = 0 . 25f ; <nl> - const FT co3 = 0 . 0625f ; <nl> + const FT co1 = 0 . 75f ; <nl> + const FT co2 = 0 . 5f ; <nl> + const FT co3 = 0 . 125f ; <nl> <nl> - if ( eveny ) <nl> + const FT coef1 = ( tidx & 1 ) = = 0 ? co1 : ( FT ) 0 ; <nl> + const FT coef2 = ( tidx & 1 ) = = 0 ? co3 : co2 ; <nl> + const FT coefy1 = ( tidy & 1 ) = = 0 ? co1 : ( FT ) 0 ; <nl> + const FT coefy2 = ( tidy & 1 ) = = 0 ? co3 : co2 ; <nl> + <nl> + if ( tidy < LOCAL_SIZE / 2 + 2 ) <nl> { <nl> - sum = ( evenFlag * co3 ) * s_srcPatch [ 1 + ( tidy > > 1 ) ] [ 1 + ( ( tidx - 2 ) > > 1 ) ] ; <nl> - sum = sum + ( oddFlag * co2 ) * s_srcPatch [ 1 + ( tidy > > 1 ) ] [ 1 + ( ( tidx - 1 ) > > 1 ) ] ; <nl> - sum = sum + ( evenFlag * co1 ) * s_srcPatch [ 1 + ( tidy > > 1 ) ] [ 1 + ( ( tidx ) > > 1 ) ] ; <nl> - sum = sum + ( oddFlag * co2 ) * s_srcPatch [ 1 + ( tidy > > 1 ) ] [ 1 + ( ( tidx + 1 ) > > 1 ) ] ; <nl> - sum = sum + ( evenFlag * co3 ) * s_srcPatch [ 1 + ( tidy > > 1 ) ] [ 1 + ( ( tidx + 2 ) > > 1 ) ] ; <nl> + sum = coef2 * s_srcPatch [ tidy ] [ 1 + ( ( tidx - 1 ) > > 1 ) ] ; <nl> + sum = mad ( coef1 , s_srcPatch [ tidy ] [ 1 + ( ( tidx ) > > 1 ) ] , sum ) ; <nl> + sum = mad ( coef2 , s_srcPatch [ tidy ] [ 1 + ( ( tidx + 2 ) > > 1 ) ] , sum ) ; <nl> + <nl> + s_dstPatch [ tidy ] [ tidx ] = sum ; <nl> } <nl> <nl> - s_dstPatch [ 2 + tidy ] [ tidx ] = sum ; <nl> + barrier ( CLK_LOCAL_MEM_FENCE ) ; <nl> + <nl> + sum = coefy2 * s_dstPatch [ 1 + ( ( tidy - 1 ) > > 1 ) ] [ tidx ] ; <nl> + sum = mad ( coefy1 , s_dstPatch [ 1 + ( ( tidy ) > > 1 ) ] [ tidx ] , sum ) ; <nl> + sum = mad ( coefy2 , s_dstPatch [ 1 + ( ( tidy + 2 ) > > 1 ) ] [ tidx ] , sum ) ; <nl> + <nl> + if ( ( x < dst_cols ) & & ( y < dst_rows ) ) <nl> + storepix ( convertToT ( sum ) , dstData + y * dst_step + x * PIXSIZE ) ; <nl> + } <nl> + <nl> + <nl> + __kernel void pyrUp_unrolled ( __global const uchar * src , int src_step , int src_offset , int src_rows , int src_cols , <nl> + __global uchar * dst , int dst_step , int dst_offset , int dst_rows , int dst_cols ) <nl> + { <nl> + const int lx = 2 * get_local_id ( 0 ) ; <nl> + const int ly = 2 * get_local_id ( 1 ) ; <nl> + <nl> + __local FT s_srcPatch [ LOCAL_SIZE + 2 ] [ LOCAL_SIZE + 2 ] ; <nl> + __local FT s_dstPatch [ LOCAL_SIZE + 2 ] [ 2 * LOCAL_SIZE ] ; <nl> <nl> - if ( tidy < 2 ) <nl> + __global uchar * dstData = dst + dst_offset ; <nl> + __global const uchar * srcData = src + src_offset ; <nl> + <nl> + if ( lx < ( LOCAL_SIZE + 2 ) & & ly < ( LOCAL_SIZE + 2 ) ) <nl> { <nl> - sum = 0 ; <nl> + int srcx = mad24 ( ( int ) get_group_id ( 0 ) , LOCAL_SIZE , lx ) - 1 ; <nl> + int srcy = mad24 ( ( int ) get_group_id ( 1 ) , LOCAL_SIZE , ly ) - 1 ; <nl> + <nl> + int srcx1 = EXTRAPOLATE ( srcx , src_cols ) ; <nl> + int srcx2 = EXTRAPOLATE ( srcx + 1 , src_cols ) ; <nl> + int srcy1 = EXTRAPOLATE ( srcy , src_rows ) ; <nl> + int srcy2 = EXTRAPOLATE ( srcy + 1 , src_rows ) ; <nl> + s_srcPatch [ ly ] [ lx ] = convertToFT ( loadpix ( srcData + srcy1 * src_step + srcx1 * PIXSIZE ) ) ; <nl> + s_srcPatch [ ly + 1 ] [ lx ] = convertToFT ( loadpix ( srcData + srcy2 * src_step + srcx1 * PIXSIZE ) ) ; <nl> + s_srcPatch [ ly ] [ lx + 1 ] = convertToFT ( loadpix ( srcData + srcy1 * src_step + srcx2 * PIXSIZE ) ) ; <nl> + s_srcPatch [ ly + 1 ] [ lx + 1 ] = convertToFT ( loadpix ( srcData + srcy2 * src_step + srcx2 * PIXSIZE ) ) ; <nl> + } <nl> <nl> - if ( eveny ) <nl> - { <nl> - sum = ( evenFlag * co3 ) * s_srcPatch [ lsizey - 16 ] [ 1 + ( ( tidx - 2 ) > > 1 ) ] ; <nl> - sum = sum + ( oddFlag * co2 ) * s_srcPatch [ lsizey - 16 ] [ 1 + ( ( tidx - 1 ) > > 1 ) ] ; <nl> - sum = sum + ( evenFlag * co1 ) * s_srcPatch [ lsizey - 16 ] [ 1 + ( ( tidx ) > > 1 ) ] ; <nl> - sum = sum + ( oddFlag * co2 ) * s_srcPatch [ lsizey - 16 ] [ 1 + ( ( tidx + 1 ) > > 1 ) ] ; <nl> - sum = sum + ( evenFlag * co3 ) * s_srcPatch [ lsizey - 16 ] [ 1 + ( ( tidx + 2 ) > > 1 ) ] ; <nl> - } <nl> + barrier ( CLK_LOCAL_MEM_FENCE ) ; <nl> <nl> - s_dstPatch [ tidy ] [ tidx ] = sum ; <nl> + FT sum ; <nl> + <nl> + const FT co1 = 0 . 75f ; <nl> + const FT co2 = 0 . 5f ; <nl> + const FT co3 = 0 . 125f ; <nl> + <nl> + / / ( x , y ) <nl> + sum = co3 * s_srcPatch [ 1 + ( ly > > 1 ) ] [ 1 + ( ( lx - 2 ) > > 1 ) ] ; <nl> + sum = sum + co1 * s_srcPatch [ 1 + ( ly > > 1 ) ] [ 1 + ( ( lx ) > > 1 ) ] ; <nl> + sum = sum + co3 * s_srcPatch [ 1 + ( ly > > 1 ) ] [ 1 + ( ( lx + 2 ) > > 1 ) ] ; <nl> + <nl> + s_dstPatch [ 1 + get_local_id ( 1 ) ] [ lx ] = sum ; <nl> + <nl> + / / ( x + 1 , y ) <nl> + sum = co2 * s_srcPatch [ 1 + ( ly > > 1 ) ] [ 1 + ( ( lx + 1 - 1 ) > > 1 ) ] ; <nl> + sum = sum + co2 * s_srcPatch [ 1 + ( ly > > 1 ) ] [ 1 + ( ( lx + 1 + 1 ) > > 1 ) ] ; <nl> + s_dstPatch [ 1 + get_local_id ( 1 ) ] [ lx + 1 ] = sum ; <nl> + <nl> + if ( ly < 1 ) <nl> + { <nl> + / / ( x , y ) <nl> + sum = co3 * s_srcPatch [ 0 ] [ 1 + ( ( lx - 2 ) > > 1 ) ] ; <nl> + sum = sum + co1 * s_srcPatch [ 0 ] [ 1 + ( ( lx ) > > 1 ) ] ; <nl> + sum = sum + co3 * s_srcPatch [ 0 ] [ 1 + ( ( lx + 2 ) > > 1 ) ] ; <nl> + s_dstPatch [ 0 ] [ lx ] = sum ; <nl> + <nl> + / / ( x + 1 , y ) <nl> + sum = co2 * s_srcPatch [ 0 ] [ 1 + ( ( lx + 1 - 1 ) > > 1 ) ] ; <nl> + sum = sum + co2 * s_srcPatch [ 0 ] [ 1 + ( ( lx + 1 + 1 ) > > 1 ) ] ; <nl> + s_dstPatch [ 0 ] [ lx + 1 ] = sum ; <nl> } <nl> <nl> - if ( tidy > 13 ) <nl> + if ( ly > 2 * LOCAL_SIZE - 3 ) <nl> { <nl> - sum = 0 ; <nl> - <nl> - if ( eveny ) <nl> - { <nl> - sum = ( evenFlag * co3 ) * s_srcPatch [ lsizey - 7 ] [ 1 + ( ( tidx - 2 ) > > 1 ) ] ; <nl> - sum = sum + ( oddFlag * co2 ) * s_srcPatch [ lsizey - 7 ] [ 1 + ( ( tidx - 1 ) > > 1 ) ] ; <nl> - sum = sum + ( evenFlag * co1 ) * s_srcPatch [ lsizey - 7 ] [ 1 + ( ( tidx ) > > 1 ) ] ; <nl> - sum = sum + ( oddFlag * co2 ) * s_srcPatch [ lsizey - 7 ] [ 1 + ( ( tidx + 1 ) > > 1 ) ] ; <nl> - sum = sum + ( evenFlag * co3 ) * s_srcPatch [ lsizey - 7 ] [ 1 + ( ( tidx + 2 ) > > 1 ) ] ; <nl> - } <nl> - s_dstPatch [ 4 + tidy ] [ tidx ] = sum ; <nl> + / / ( x , y ) <nl> + sum = co3 * s_srcPatch [ LOCAL_SIZE + 1 ] [ 1 + ( ( lx - 2 ) > > 1 ) ] ; <nl> + sum = sum + co1 * s_srcPatch [ LOCAL_SIZE + 1 ] [ 1 + ( ( lx ) > > 1 ) ] ; <nl> + sum = sum + co3 * s_srcPatch [ LOCAL_SIZE + 1 ] [ 1 + ( ( lx + 2 ) > > 1 ) ] ; <nl> + s_dstPatch [ LOCAL_SIZE + 1 ] [ lx ] = sum ; <nl> + <nl> + / / ( x + 1 , y ) <nl> + sum = co2 * s_srcPatch [ LOCAL_SIZE + 1 ] [ 1 + ( ( lx + 1 - 1 ) > > 1 ) ] ; <nl> + sum = sum + co2 * s_srcPatch [ LOCAL_SIZE + 1 ] [ 1 + ( ( lx + 1 + 1 ) > > 1 ) ] ; <nl> + s_dstPatch [ LOCAL_SIZE + 1 ] [ lx + 1 ] = sum ; <nl> } <nl> <nl> barrier ( CLK_LOCAL_MEM_FENCE ) ; <nl> + int dst_x = 2 * get_global_id ( 0 ) ; <nl> + int dst_y = 2 * get_global_id ( 1 ) ; <nl> <nl> - sum = co3 * s_dstPatch [ 2 + tidy - 2 ] [ tidx ] ; <nl> - sum = sum + co2 * s_dstPatch [ 2 + tidy - 1 ] [ tidx ] ; <nl> - sum = sum + co1 * s_dstPatch [ 2 + tidy ] [ tidx ] ; <nl> - sum = sum + co2 * s_dstPatch [ 2 + tidy + 1 ] [ tidx ] ; <nl> - sum = sum + co3 * s_dstPatch [ 2 + tidy + 2 ] [ tidx ] ; <nl> - <nl> - if ( ( x < dst_cols ) & & ( y < dst_rows ) ) <nl> - storepix ( convertToT ( 4 . 0f * sum ) , dstData + y * dst_step + x * PIXSIZE ) ; <nl> + if ( ( dst_x < dst_cols ) & & ( dst_y < dst_rows ) ) <nl> + { <nl> + / / ( x , y ) <nl> + sum = co3 * s_dstPatch [ 1 + get_local_id ( 1 ) - 1 ] [ lx ] ; <nl> + sum = sum + co1 * s_dstPatch [ 1 + get_local_id ( 1 ) ] [ lx ] ; <nl> + sum = sum + co3 * s_dstPatch [ 1 + get_local_id ( 1 ) + 1 ] [ lx ] ; <nl> + storepix ( convertToT ( sum ) , dstData + dst_y * dst_step + dst_x * PIXSIZE ) ; <nl> + <nl> + / / ( x + 1 , y ) <nl> + sum = co3 * s_dstPatch [ 1 + get_local_id ( 1 ) - 1 ] [ lx + 1 ] ; <nl> + sum = sum + co1 * s_dstPatch [ 1 + get_local_id ( 1 ) ] [ lx + 1 ] ; <nl> + sum = sum + co3 * s_dstPatch [ 1 + get_local_id ( 1 ) + 1 ] [ lx + 1 ] ; <nl> + storepix ( convertToT ( sum ) , dstData + dst_y * dst_step + ( dst_x + 1 ) * PIXSIZE ) ; <nl> + <nl> + / / ( x , y + 1 ) <nl> + sum = co2 * s_dstPatch [ 1 + get_local_id ( 1 ) ] [ lx ] ; <nl> + sum = sum + co2 * s_dstPatch [ 1 + get_local_id ( 1 ) + 1 ] [ lx ] ; <nl> + storepix ( convertToT ( sum ) , dstData + ( dst_y + 1 ) * dst_step + dst_x * PIXSIZE ) ; <nl> + <nl> + / / ( x + 1 , y + 1 ) <nl> + sum = co2 * s_dstPatch [ 1 + get_local_id ( 1 ) ] [ lx + 1 ] ; <nl> + sum = sum + co2 * s_dstPatch [ 1 + get_local_id ( 1 ) + 1 ] [ lx + 1 ] ; <nl> + storepix ( convertToT ( sum ) , dstData + ( dst_y + 1 ) * dst_step + ( dst_x + 1 ) * PIXSIZE ) ; <nl> + } <nl> } <nl> mmm a / modules / imgproc / src / pyramids . cpp <nl> ppp b / modules / imgproc / src / pyramids . cpp <nl> static bool ocl_pyrUp ( InputArray _src , OutputArray _dst , const Size & _dsz , int <nl> UMat dst = _dst . getUMat ( ) ; <nl> <nl> int float_depth = depth = = CV_64F ? CV_64F : CV_32F ; <nl> + const int local_size = 16 ; <nl> char cvt [ 2 ] [ 50 ] ; <nl> String buildOptions = format ( <nl> " - D T = % s - D FT = % s - D convertToT = % s - D convertToFT = % s % s " <nl> - " - D T1 = % s - D cn = % d " , <nl> + " - D T1 = % s - D cn = % d - D LOCAL_SIZE = % d " , <nl> ocl : : typeToStr ( type ) , ocl : : typeToStr ( CV_MAKETYPE ( float_depth , channels ) ) , <nl> ocl : : convertTypeStr ( float_depth , depth , channels , cvt [ 0 ] ) , <nl> ocl : : convertTypeStr ( depth , float_depth , channels , cvt [ 1 ] ) , <nl> doubleSupport ? " - D DOUBLE_SUPPORT " : " " , <nl> - ocl : : typeToStr ( depth ) , channels <nl> + ocl : : typeToStr ( depth ) , channels , local_size <nl> ) ; <nl> - ocl : : Kernel k ( " pyrUp " , ocl : : imgproc : : pyr_up_oclsrc , buildOptions ) ; <nl> + size_t globalThreads [ 2 ] = { dst . cols , dst . rows } ; <nl> + size_t localThreads [ 2 ] = { local_size , local_size } ; <nl> + ocl : : Kernel k ; <nl> + if ( ocl : : Device : : getDefault ( ) . isIntel ( ) & & channels = = 1 ) <nl> + { <nl> + k . create ( " pyrUp_unrolled " , ocl : : imgproc : : pyr_up_oclsrc , buildOptions ) ; <nl> + globalThreads [ 0 ] = dst . cols / 2 ; globalThreads [ 1 ] = dst . rows / 2 ; <nl> + } <nl> + else <nl> + k . create ( " pyrUp " , ocl : : imgproc : : pyr_up_oclsrc , buildOptions ) ; <nl> + <nl> if ( k . empty ( ) ) <nl> return false ; <nl> <nl> k . args ( ocl : : KernelArg : : ReadOnly ( src ) , ocl : : KernelArg : : WriteOnly ( dst ) ) ; <nl> - size_t globalThreads [ 2 ] = { dst . cols , dst . rows } ; <nl> - size_t localThreads [ 2 ] = { 16 , 16 } ; <nl> - <nl> return k . run ( 2 , globalThreads , localThreads , false ) ; <nl> } <nl> <nl>
|
Merge pull request from akarsakov : ocl_pyrUp_unroll
|
opencv/opencv
|
6952b90ed0e0fe5ecfdc2272e9fda8e37506bccd
|
2014-06-20T13:49:14Z
|
mmm a / src / misc_utilities / CMakeLists . txt <nl> ppp b / src / misc_utilities / CMakeLists . txt <nl> TARGET_LINK_LIBRARIES ( openalpr - utils - tagplates <nl> $ { OpenCV_LIBS } <nl> ) <nl> <nl> + ADD_EXECUTABLE ( openalpr - utils - calibrate calibrate . cpp ) <nl> + TARGET_LINK_LIBRARIES ( openalpr - utils - calibrate <nl> + openalpr <nl> + support <nl> + $ { OpenCV_LIBS } <nl> + $ { Tesseract_LIBRARIES } <nl> + ) <nl> + <nl> + <nl> + install ( TARGETS openalpr - utils - calibrate DESTINATION bin ) <nl> + <nl> + <nl> install ( TARGETS openalpr - utils - sortstate DESTINATION bin ) <nl> install ( TARGETS openalpr - utils - classifychars DESTINATION bin ) <nl> install ( TARGETS openalpr - utils - benchmark DESTINATION bin ) <nl> install ( TARGETS openalpr - utils - prepcharsfortraining DESTINATION bin ) <nl> install ( TARGETS openalpr - utils - tagplates DESTINATION bin ) <nl> + install ( TARGETS openalpr - utils - calibrate DESTINATION bin ) <nl> <nl> new file mode 100644 <nl> index 00000000 . . 706cd70f <nl> mmm / dev / null <nl> ppp b / src / misc_utilities / calibrate . cpp <nl> <nl> + / * <nl> + * Copyright ( c ) 2015 New Designs Unlimited , LLC <nl> + * Opensource Automated License Plate Recognition [ http : / / www . openalpr . com ] <nl> + * <nl> + * This file is part of OpenAlpr . <nl> + * <nl> + * OpenAlpr is free software : you can redistribute it and / or modify <nl> + * it under the terms of the GNU Affero General Public License <nl> + * version 3 as published by the Free Software Foundation <nl> + * <nl> + * This program is distributed in the hope that it will be useful , <nl> + * but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + * GNU Affero General Public License for more details . <nl> + * <nl> + * You should have received a copy of the GNU Affero General Public License <nl> + * along with this program . If not , see < http : / / www . gnu . org / licenses / > . <nl> + * / <nl> + <nl> + # include < cstdlib > <nl> + # include < cstdio > <nl> + # include < iostream > <nl> + # include < opencv2 / highgui / highgui . hpp > <nl> + # include < opencv2 / imgproc / imgproc . hpp > <nl> + # include < opencv2 / calib3d / calib3d . hpp > <nl> + <nl> + # include " support / filesystem . h " <nl> + # include " . . / tclap / CmdLine . h " <nl> + # include " prewarp . h " <nl> + <nl> + # include < sstream > <nl> + <nl> + using namespace std ; <nl> + using namespace cv ; <nl> + <nl> + const int INSTRUCTIONS_HEIGHT = 32 ; <nl> + <nl> + <nl> + bool panning ; <nl> + bool left_clicking ; <nl> + Point left_click_start ; <nl> + Point left_click_cur ; <nl> + <nl> + <nl> + Point lastPos ; <nl> + <nl> + float w ; <nl> + float h ; <nl> + float panX = 0 ; <nl> + float panY = 0 ; <nl> + float rotationx = 0 ; <nl> + float rotationy = 0 ; <nl> + float rotationz = 0 ; <nl> + float stretchX = 1 . 0 ; <nl> + float dist = 1 . 0 ; <nl> + <nl> + Mat imgOriginal ; <nl> + Mat curWarpedImage ; <nl> + <nl> + alpr : : Config config ( " us " ) ; <nl> + <nl> + const string WINDOW_NAME = " Adjust OpenALPR Perspective " ; <nl> + <nl> + string get_config ( ) <nl> + { <nl> + stringstream output ; <nl> + output < < " planar , " < < std : : fixed ; <nl> + output < < w < < " , " < < h < < " , " ; <nl> + output < < rotationx < < " , " < < rotationy < < " , " < < rotationz < < " , " ; <nl> + output < < stretchX < < " , " < < dist < < " , " ; <nl> + output < < panX < < " , " < < panY ; <nl> + <nl> + return output . str ( ) ; <nl> + } <nl> + <nl> + void drawImage ( Mat img ) <nl> + { <nl> + <nl> + config . prewarp = get_config ( ) ; <nl> + alpr : : PreWarp prewarp ( & config ) ; <nl> + <nl> + <nl> + if ( ! left_clicking ) <nl> + { <nl> + curWarpedImage = prewarp . warpImage ( img ) ; <nl> + } <nl> + <nl> + <nl> + Mat imgWithInstructions ( curWarpedImage . rows + INSTRUCTIONS_HEIGHT , curWarpedImage . cols , curWarpedImage . type ( ) ) ; <nl> + <nl> + curWarpedImage . copyTo ( imgWithInstructions ( Rect ( 0 , INSTRUCTIONS_HEIGHT , curWarpedImage . cols , curWarpedImage . rows ) ) ) ; <nl> + <nl> + if ( left_clicking ) <nl> + { <nl> + Point start = left_click_start ; <nl> + Point end = left_click_cur ; <nl> + start . y + = INSTRUCTIONS_HEIGHT ; <nl> + end . y + = INSTRUCTIONS_HEIGHT ; <nl> + rectangle ( imgWithInstructions , start , end , Scalar ( 255 , 0 , 255 ) , 2 ) ; <nl> + } <nl> + <nl> + rectangle ( imgWithInstructions , Point ( 0 , 0 ) , Point ( curWarpedImage . cols , INSTRUCTIONS_HEIGHT ) , Scalar ( 255 , 255 , 255 ) , - 1 ) ; <nl> + <nl> + putText ( imgWithInstructions , " Press ' o ' to output config to console . " , <nl> + Point ( 5 , 25 ) , FONT_HERSHEY_DUPLEX , 1 . 0 , Scalar ( 0 , 0 , 0 ) ) ; <nl> + <nl> + <nl> + imshow ( WINDOW_NAME , imgWithInstructions ) ; <nl> + <nl> + } <nl> + <nl> + <nl> + <nl> + <nl> + void mouse_callback ( int event , int x , int y , int flags , void * userdata ) <nl> + { <nl> + y = y - INSTRUCTIONS_HEIGHT ; <nl> + if ( y < 0 ) <nl> + return ; <nl> + <nl> + <nl> + if ( event = = EVENT_RBUTTONDOWN ) <nl> + { <nl> + lastPos . x = x ; <nl> + lastPos . y = y ; <nl> + panning = true ; <nl> + } <nl> + if ( event = = EVENT_RBUTTONUP ) <nl> + { <nl> + panning = false ; <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + if ( event = = EVENT_MOUSEMOVE & & panning ) <nl> + { <nl> + int xdiff = x - lastPos . x ; <nl> + int ydiff = y - lastPos . y ; <nl> + panX - = xdiff ; <nl> + panY - = ydiff ; <nl> + <nl> + lastPos . x = x ; <nl> + lastPos . y = y ; <nl> + <nl> + / / Reduce the computation by only doing it every 3rd pixel <nl> + if ( x % 3 = = 0 & & y % 3 = = 0 ) <nl> + { <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + } <nl> + <nl> + if ( event = = EVENT_LBUTTONDOWN ) <nl> + { <nl> + left_click_start . x = x ; <nl> + left_click_start . y = y ; <nl> + left_clicking = true ; <nl> + } <nl> + if ( event = = EVENT_LBUTTONUP ) <nl> + { <nl> + left_clicking = false ; <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + if ( event = = EVENT_MOUSEMOVE & & left_clicking ) <nl> + { <nl> + left_click_cur . x = x ; <nl> + <nl> + float IDEAL_PLATE_RATIO = config . charWidthMM / config . charHeightMM ; <nl> + float curWidth = left_click_cur . x - left_click_start . x ; <nl> + <nl> + left_click_cur . y = left_click_start . y + ( IDEAL_PLATE_RATIO * curWidth ) ; <nl> + <nl> + / / Reduce the computation by only doing it every 3rd pixel <nl> + if ( x % 2 = = 0 | | y % 2 = = 0 ) <nl> + { <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + } <nl> + <nl> + } <nl> + <nl> + void ZChange ( int pos , void * userdata ) <nl> + { <nl> + <nl> + rotationz = - ( ( float ) pos - 100 ) / 100 . 0 ; <nl> + <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + <nl> + void XChange ( int pos , void * userdata ) <nl> + { <nl> + <nl> + rotationx = - ( ( float ) pos - 100 ) / 20000 . 0 ; <nl> + <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + <nl> + <nl> + void YChange ( int pos , void * userdata ) <nl> + { <nl> + rotationy = ( ( float ) pos - 100 ) / 20000 . 0 ; <nl> + <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + <nl> + <nl> + void DistChange ( int pos , void * userdata ) <nl> + { <nl> + dist = 1 . 0 - ( ( float ) pos - 100 ) / 200 . 0 ; <nl> + <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + <nl> + void StretchChange ( int pos , void * userdata ) <nl> + { <nl> + stretchX = 1 . 0 + ( ( float ) pos - 100 ) / - 200 . 0 ; <nl> + <nl> + drawImage ( imgOriginal ) ; <nl> + } <nl> + <nl> + <nl> + int value ; <nl> + void create_window ( ) <nl> + { <nl> + namedWindow ( WINDOW_NAME , CV_WINDOW_AUTOSIZE | CV_WINDOW_KEEPRATIO | CV_GUI_EXPANDED ) ; <nl> + <nl> + <nl> + value = 100 ; <nl> + panX = 0 ; <nl> + panY = 0 ; <nl> + <nl> + XChange ( 100 , NULL ) ; <nl> + YChange ( 100 , NULL ) ; <nl> + ZChange ( 100 , NULL ) ; <nl> + DistChange ( 100 , NULL ) ; <nl> + <nl> + <nl> + createTrackbar ( " X " , WINDOW_NAME , & value , 200 , XChange ) ; <nl> + createTrackbar ( " Y " , WINDOW_NAME , & value , 200 , YChange ) ; <nl> + createTrackbar ( " Z " , WINDOW_NAME , & value , 200 , ZChange ) ; <nl> + createTrackbar ( " W " , WINDOW_NAME , & value , 200 , StretchChange ) ; <nl> + createTrackbar ( " D " , WINDOW_NAME , & value , 200 , DistChange ) ; <nl> + <nl> + <nl> + setMouseCallback ( WINDOW_NAME , mouse_callback , NULL ) ; <nl> + <nl> + <nl> + } <nl> + <nl> + / * <nl> + * <nl> + * / <nl> + int main ( int argc , char * * argv ) { <nl> + <nl> + <nl> + string filename ; <nl> + string country ; <nl> + string config_path ; <nl> + string translate_config ; <nl> + int max_width ; <nl> + int max_height ; <nl> + <nl> + TCLAP : : CmdLine cmd ( " OpenAlpr Perspective Utility " , ' ' , " 0 . 1 " ) ; <nl> + <nl> + TCLAP : : UnlabeledValueArg < std : : string > fileArg ( " image_file " , " Image containing license plates " , true , " " , " image_file_path " ) ; <nl> + <nl> + TCLAP : : ValueArg < std : : string > countryCodeArg ( " c " , " country " , " Country code to identify ( either us for USA or eu for Europe ) . Default = us " , false , " us " , " country_code " ) ; <nl> + <nl> + TCLAP : : ValueArg < std : : string > configFileArg ( " " , " config " , " Path to the openalpr . conf file " , false , " " , " config_file " ) ; <nl> + <nl> + TCLAP : : ValueArg < std : : string > translateTestArg ( " t " , " test " , " Test an image using the provided translation config " , false , " " , " prewarp config " ) ; <nl> + <nl> + TCLAP : : ValueArg < int > maxWidthArg ( " w " , " maxwidth " , " Max Width used for displaying image in this utility . Default = 1280 " , false , 1280 , " max width " ) ; <nl> + TCLAP : : ValueArg < int > maxHeightArg ( " " , " maxheight " , " Max Height used for displaying image in this utility . Default = 1024 " , false , 1024 , " max height " ) ; <nl> + <nl> + try <nl> + { <nl> + cmd . add ( configFileArg ) ; <nl> + cmd . add ( fileArg ) ; <nl> + cmd . add ( countryCodeArg ) ; <nl> + cmd . add ( translateTestArg ) ; <nl> + cmd . add ( maxWidthArg ) ; <nl> + cmd . add ( maxHeightArg ) ; <nl> + <nl> + <nl> + if ( cmd . parse ( argc , argv ) = = false ) <nl> + { <nl> + / / Error occured while parsing . Exit now . <nl> + return 1 ; <nl> + } <nl> + <nl> + filename = fileArg . getValue ( ) ; <nl> + country = countryCodeArg . getValue ( ) ; <nl> + config_path = configFileArg . getValue ( ) ; <nl> + translate_config = translateTestArg . getValue ( ) ; <nl> + max_width = maxWidthArg . getValue ( ) ; <nl> + max_height = maxHeightArg . getValue ( ) ; <nl> + <nl> + } <nl> + catch ( TCLAP : : ArgException & e ) / / catch any exceptions <nl> + { <nl> + std : : cerr < < " error : " < < e . error ( ) < < " for arg " < < e . argId ( ) < < std : : endl ; <nl> + return 1 ; <nl> + } <nl> + <nl> + if ( ! alpr : : fileExists ( filename . c_str ( ) ) ) <nl> + { <nl> + cerr < < " Could not find image file : " < < filename < < endl ; <nl> + } <nl> + <nl> + config = alpr : : Config ( country ) ; <nl> + <nl> + panning = false ; <nl> + left_clicking = false ; <nl> + <nl> + <nl> + imgOriginal = imread ( filename ) ; <nl> + <nl> + if ( imgOriginal . cols > max_width ) <nl> + { <nl> + float aspect = max_width / ( ( float ) imgOriginal . cols ) ; <nl> + float y = ( ( float ) imgOriginal . rows ) * aspect ; <nl> + <nl> + resize ( imgOriginal , imgOriginal , Size ( ( int ) max_width , ( int ) y ) ) ; <nl> + } <nl> + if ( imgOriginal . rows > max_height ) <nl> + { <nl> + float aspect = max_height / ( ( float ) imgOriginal . rows ) ; <nl> + float x = ( ( float ) imgOriginal . cols ) * aspect ; <nl> + <nl> + resize ( imgOriginal , imgOriginal , Size ( ( int ) x , ( int ) max_height ) ) ; <nl> + } <nl> + <nl> + w = imgOriginal . cols ; <nl> + h = imgOriginal . rows ; <nl> + <nl> + create_window ( ) ; <nl> + <nl> + <nl> + if ( translate_config ! = " " ) <nl> + { <nl> + int first_comma = translate_config . find ( " , " ) ; <nl> + <nl> + <nl> + string name = translate_config . substr ( 0 , first_comma ) ; <nl> + stringstream ss ( translate_config . substr ( first_comma + 1 , translate_config . length ( ) ) ) ; <nl> + <nl> + ss > > w ; <nl> + ss . ignore ( ) ; <nl> + ss > > h ; <nl> + ss . ignore ( ) ; <nl> + ss > > rotationx ; <nl> + ss . ignore ( ) ; / / Ignore comma <nl> + ss > > rotationy ; <nl> + ss . ignore ( ) ; / / Ignore comma <nl> + ss > > rotationz ; <nl> + ss . ignore ( ) ; / / Ignore comma <nl> + ss > > stretchX ; <nl> + ss . ignore ( ) ; / / Ignore comma <nl> + ss > > dist ; <nl> + ss . ignore ( ) ; / / Ignore comma <nl> + ss > > panX ; <nl> + ss . ignore ( ) ; / / Ignore comma <nl> + ss > > panY ; <nl> + <nl> + } <nl> + <nl> + float width_ratio = w / ( ( float ) imgOriginal . cols ) ; <nl> + float height_ratio = h / ( ( float ) imgOriginal . rows ) ; <nl> + w = imgOriginal . cols ; <nl> + h = imgOriginal . rows ; <nl> + rotationx * = width_ratio ; <nl> + rotationy * = width_ratio ; <nl> + panX / = width_ratio ; <nl> + panY / = height_ratio ; <nl> + <nl> + drawImage ( imgOriginal ) ; <nl> + <nl> + <nl> + while ( true ) <nl> + { <nl> + <nl> + char c = waitKey ( 15 ) ; <nl> + <nl> + if ( c = = ' o ' ) <nl> + { <nl> + cout < < " prewarp = " < < get_config ( ) < < endl ; <nl> + <nl> + } <nl> + } <nl> + <nl> + cvDestroyAllWindows ( ) ; <nl> + <nl> + <nl> + return 0 ; <nl> + } <nl> + <nl>
|
Added camera calibration utility
|
openalpr/openalpr
|
e5aa1389e0166ea77a1e06dca411668cf574b861
|
2015-05-15T10:55:28Z
|
mmm a / fdbserver / Knobs . cpp <nl> ppp b / fdbserver / Knobs . cpp <nl> void ServerKnobs : : initialize ( bool randomize , ClientKnobs * clientKnobs , bool isSi <nl> init ( PROXY_COMPUTE_BUCKETS , 20000 ) ; <nl> init ( PROXY_COMPUTE_GROWTH_RATE , 0 . 01 ) ; <nl> init ( TXN_STATE_SEND_AMOUNT , 2 ) ; <nl> - init ( ASK_READ_VERSION_FROM_MASTER , true ) ; <nl> + init ( ASK_READ_VERSION_FROM_MASTER , false ) ; <nl> <nl> / / Master Server <nl> / / masterCommitter ( ) in the master server will allow lower priority tasks ( e . g . DataDistibution ) <nl>
|
Fix errors in joshua related to PR_3307
|
apple/foundationdb
|
e613d85895512d9517e991a5604af8e561b53029
|
2020-07-01T00:22:59Z
|
mmm a / imgui . cpp <nl> ppp b / imgui . cpp <nl> void ImGui : : MemFree ( void * ptr ) <nl> <nl> const char * ImGui : : GetClipboardText ( ) <nl> { <nl> - return GImGui - > IO . GetClipboardTextFn ? GImGui - > IO . GetClipboardTextFn ( GImGui - > IO . ClipboardUserData ) : " " ; <nl> + ImGuiContext & g = * GImGui ; <nl> + return g . IO . GetClipboardTextFn ? g . IO . GetClipboardTextFn ( g . IO . ClipboardUserData ) : " " ; <nl> } <nl> <nl> void ImGui : : SetClipboardText ( const char * text ) <nl> { <nl> - if ( GImGui - > IO . SetClipboardTextFn ) <nl> - GImGui - > IO . SetClipboardTextFn ( GImGui - > IO . ClipboardUserData , text ) ; <nl> + ImGuiContext & g = * GImGui ; <nl> + if ( g . IO . SetClipboardTextFn ) <nl> + g . IO . SetClipboardTextFn ( g . IO . ClipboardUserData , text ) ; <nl> } <nl> <nl> const char * ImGui : : GetVersion ( ) <nl> bool ImGui : : IsMouseHoveringRect ( const ImVec2 & r_min , const ImVec2 & r_max , bool c <nl> int ImGui : : GetKeyIndex ( ImGuiKey imgui_key ) <nl> { <nl> IM_ASSERT ( imgui_key > = 0 & & imgui_key < ImGuiKey_COUNT ) ; <nl> - return GImGui - > IO . KeyMap [ imgui_key ] ; <nl> + ImGuiContext & g = * GImGui ; <nl> + return g . IO . KeyMap [ imgui_key ] ; <nl> } <nl> <nl> / / Note that imgui doesn ' t know the semantic of each entry of io . KeysDown [ ] . Use your own indices / enums according to how your back - end / engine stored them into io . KeysDown [ ] ! <nl> bool ImGui : : IsKeyDown ( int user_key_index ) <nl> { <nl> - if ( user_key_index < 0 ) return false ; <nl> - IM_ASSERT ( user_key_index > = 0 & & user_key_index < IM_ARRAYSIZE ( GImGui - > IO . KeysDown ) ) ; <nl> - return GImGui - > IO . KeysDown [ user_key_index ] ; <nl> + if ( user_key_index < 0 ) <nl> + return false ; <nl> + ImGuiContext & g = * GImGui ; <nl> + IM_ASSERT ( user_key_index > = 0 & & user_key_index < IM_ARRAYSIZE ( g . IO . KeysDown ) ) ; <nl> + return g . IO . KeysDown [ user_key_index ] ; <nl> } <nl> <nl> int ImGui : : CalcTypematicPressedRepeatAmount ( float t , float t_prev , float repeat_delay , float repeat_rate ) <nl> static ImVec2 CalcNextScrollFromScrollTargetAndClamp ( ImGuiWindow * window , bool s <nl> float target_x = window - > ScrollTarget . x ; <nl> if ( snap_on_edges & & cr_x < = 0 . 0f & & target_x < = window - > WindowPadding . x ) <nl> target_x = 0 . 0f ; <nl> - else if ( snap_on_edges & & cr_x > = 1 . 0f & & target_x > = window - > ContentSize . x + window - > WindowPadding . x + GImGui - > Style . ItemSpacing . x ) <nl> + else if ( snap_on_edges & & cr_x > = 1 . 0f & & target_x > = window - > ContentSize . x + window - > WindowPadding . x + g . Style . ItemSpacing . x ) <nl> target_x = window - > ContentSize . x + window - > WindowPadding . x * 2 . 0f ; <nl> scroll . x = target_x - cr_x * window - > InnerRect . GetWidth ( ) ; <nl> } <nl> void ImGui : : PushMultiItemsWidths ( int components , float w_full ) <nl> { <nl> ImGuiContext & g = * GImGui ; <nl> ImGuiWindow * window = g . CurrentWindow ; <nl> - const ImGuiStyle & style = GImGui - > Style ; <nl> + const ImGuiStyle & style = g . Style ; <nl> const float w_item_one = ImMax ( 1 . 0f , ( float ) ( int ) ( ( w_full - ( style . ItemInnerSpacing . x ) * ( components - 1 ) ) / ( float ) components ) ) ; <nl> const float w_item_last = ImMax ( 1 . 0f , ( float ) ( int ) ( w_full - ( w_item_one + style . ItemInnerSpacing . x ) * ( components - 1 ) ) ) ; <nl> window - > DC . ItemWidthStack . push_back ( w_item_last ) ; <nl> void ImGui : : SetScrollY ( ImGuiWindow * window , float new_scroll_y ) <nl> void ImGui : : SetScrollFromPosX ( float local_x , float center_x_ratio ) <nl> { <nl> / / We store a target position so centering can occur on the next frame when we are guaranteed to have a known window size <nl> - ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> + ImGuiContext & g = * GImGui ; <nl> + ImGuiWindow * window = g . CurrentWindow ; <nl> IM_ASSERT ( center_x_ratio > = 0 . 0f & & center_x_ratio < = 1 . 0f ) ; <nl> window - > ScrollTarget . x = ( float ) ( int ) ( local_x + window - > Scroll . x ) ; <nl> window - > ScrollTargetCenterRatio . x = center_x_ratio ; <nl> void ImGui : : SetScrollFromPosX ( float local_x , float center_x_ratio ) <nl> void ImGui : : SetScrollFromPosY ( float local_y , float center_y_ratio ) <nl> { <nl> / / We store a target position so centering can occur on the next frame when we are guaranteed to have a known window size <nl> - ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> + ImGuiContext & g = * GImGui ; <nl> + ImGuiWindow * window = g . CurrentWindow ; <nl> IM_ASSERT ( center_y_ratio > = 0 . 0f & & center_y_ratio < = 1 . 0f ) ; <nl> window - > ScrollTarget . y = ( float ) ( int ) ( local_y + window - > Scroll . y ) ; <nl> window - > ScrollTargetCenterRatio . y = center_y_ratio ; <nl> void ImGui : : SetScrollFromPosY ( float local_y , float center_y_ratio ) <nl> / / center_x_ratio : 0 . 0f left of last item , 0 . 5f horizontal center of last item , 1 . 0f right of last item . <nl> void ImGui : : SetScrollHereX ( float center_x_ratio ) <nl> { <nl> - ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> + ImGuiContext & g = * GImGui ; <nl> + ImGuiWindow * window = g . CurrentWindow ; <nl> float target_x = window - > DC . LastItemRect . Min . x - window - > Pos . x ; / / Left of last item , in window space <nl> float last_item_width = window - > DC . LastItemRect . GetWidth ( ) ; <nl> - target_x + = ( last_item_width * center_x_ratio ) + ( GImGui - > Style . ItemSpacing . x * ( center_x_ratio - 0 . 5f ) * 2 . 0f ) ; / / Precisely aim before , in the middle or after the last item . <nl> + target_x + = ( last_item_width * center_x_ratio ) + ( g . Style . ItemSpacing . x * ( center_x_ratio - 0 . 5f ) * 2 . 0f ) ; / / Precisely aim before , in the middle or after the last item . <nl> SetScrollFromPosX ( target_x , center_x_ratio ) ; <nl> } <nl> <nl> / / center_y_ratio : 0 . 0f top of last item , 0 . 5f vertical center of last item , 1 . 0f bottom of last item . <nl> void ImGui : : SetScrollHereY ( float center_y_ratio ) <nl> { <nl> - ImGuiWindow * window = GetCurrentWindow ( ) ; <nl> + ImGuiContext & g = * GImGui ; <nl> + ImGuiWindow * window = g . CurrentWindow ; <nl> float target_y = window - > DC . CursorPosPrevLine . y - window - > Pos . y ; / / Top of last item , in window space <nl> - target_y + = ( window - > DC . PrevLineSize . y * center_y_ratio ) + ( GImGui - > Style . ItemSpacing . y * ( center_y_ratio - 0 . 5f ) * 2 . 0f ) ; / / Precisely aim above , in the middle or below the last line . <nl> + target_y + = ( window - > DC . PrevLineSize . y * center_y_ratio ) + ( g . Style . ItemSpacing . y * ( center_y_ratio - 0 . 5f ) * 2 . 0f ) ; / / Precisely aim above , in the middle or below the last line . <nl> SetScrollFromPosY ( target_y , center_y_ratio ) ; <nl> } <nl> <nl> static void SetClipboardTextFn_DefaultImpl ( void * , const char * text ) <nl> static void ImeSetInputScreenPosFn_DefaultImpl ( int x , int y ) <nl> { <nl> / / Notify OS Input Method Editor of text input position <nl> - if ( HWND hwnd = ( HWND ) GImGui - > IO . ImeWindowHandle ) <nl> + ImGuiIO & io = ImGui : : GetIO ( ) ; <nl> + if ( HWND hwnd = ( HWND ) io . ImeWindowHandle ) <nl> if ( HIMC himc = : : ImmGetContext ( hwnd ) ) <nl> { <nl> COMPOSITIONFORM cf ; <nl> mmm a / imgui_widgets . cpp <nl> ppp b / imgui_widgets . cpp <nl> namespace ImStb <nl> <nl> static int STB_TEXTEDIT_STRINGLEN ( const STB_TEXTEDIT_STRING * obj ) { return obj - > CurLenW ; } <nl> static ImWchar STB_TEXTEDIT_GETCHAR ( const STB_TEXTEDIT_STRING * obj , int idx ) { return obj - > TextW [ idx ] ; } <nl> - static float STB_TEXTEDIT_GETWIDTH ( STB_TEXTEDIT_STRING * obj , int line_start_idx , int char_idx ) { ImWchar c = obj - > TextW [ line_start_idx + char_idx ] ; if ( c = = ' \ n ' ) return STB_TEXTEDIT_GETWIDTH_NEWLINE ; return GImGui - > Font - > GetCharAdvance ( c ) * ( GImGui - > FontSize / GImGui - > Font - > FontSize ) ; } <nl> + static float STB_TEXTEDIT_GETWIDTH ( STB_TEXTEDIT_STRING * obj , int line_start_idx , int char_idx ) { ImWchar c = obj - > TextW [ line_start_idx + char_idx ] ; if ( c = = ' \ n ' ) return STB_TEXTEDIT_GETWIDTH_NEWLINE ; ImGuiContext & g = * GImGui ; return g . Font - > GetCharAdvance ( c ) * ( g . FontSize / g . Font - > FontSize ) ; } <nl> static int STB_TEXTEDIT_KEYTOTEXT ( int key ) { return key > = 0x10000 ? 0 : key ; } <nl> static ImWchar STB_TEXTEDIT_NEWLINE = ' \ n ' ; <nl> static void STB_TEXTEDIT_LAYOUTROW ( StbTexteditRow * r , STB_TEXTEDIT_STRING * obj , int line_start_idx ) <nl>
|
Internal : Avoid using GImGui multiple times in same function .
|
ocornut/imgui
|
5ef7445d922fd9fb5c59bedf2dada2926a4100e0
|
2019-07-30T23:51:12Z
|
mmm a / js / apps / system / _admin / aardvark / APP / frontend / js / collections / arangoDocument . js <nl> ppp b / js / apps / system / _admin / aardvark / APP / frontend / js / collections / arangoDocument . js <nl> window . arangoDocument = Backbone . Collection . extend ( { <nl> $ . ajax ( { <nl> cache : false , <nl> type : ' DELETE ' , <nl> - async : false , <nl> contentType : " application / json " , <nl> url : " / _api / edge / " + colid + " / " + docid , <nl> success : function ( ) { <nl> window . arangoDocument = Backbone . Collection . extend ( { <nl> $ . ajax ( { <nl> cache : false , <nl> type : ' DELETE ' , <nl> - async : false , <nl> contentType : " application / json " , <nl> url : " / _api / document / " + colid + " / " + docid , <nl> success : function ( ) { <nl> window . arangoDocument = Backbone . Collection . extend ( { <nl> } <nl> } ) ; <nl> } , <nl> - getEdge : function ( colid , docid ) { <nl> - var result = false , self = this ; <nl> + getEdge : function ( colid , docid , callback ) { <nl> + var self = this ; <nl> this . clearDocument ( ) ; <nl> $ . ajax ( { <nl> cache : false , <nl> type : " GET " , <nl> - async : false , <nl> url : " / _api / edge / " + colid + " / " + docid , <nl> contentType : " application / json " , <nl> processData : false , <nl> success : function ( data ) { <nl> self . add ( data ) ; <nl> - result = true ; <nl> + callback ( false , data , ' edge ' ) ; <nl> } , <nl> error : function ( data ) { <nl> - result = false ; <nl> + callback ( true , data ) ; <nl> } <nl> } ) ; <nl> - return result ; <nl> } , <nl> - getDocument : function ( colid , docid ) { <nl> - var result = false , self = this ; <nl> + getDocument : function ( colid , docid , callback ) { <nl> + var self = this ; <nl> this . clearDocument ( ) ; <nl> $ . ajax ( { <nl> cache : false , <nl> type : " GET " , <nl> - async : false , <nl> url : " / _api / document / " + colid + " / " + docid , <nl> contentType : " application / json " , <nl> processData : false , <nl> success : function ( data ) { <nl> self . add ( data ) ; <nl> - result = true ; <nl> + callback ( false , data , ' document ' ) ; <nl> } , <nl> error : function ( data ) { <nl> - result = false ; <nl> + self . add ( true , data ) ; <nl> } <nl> } ) ; <nl> - return result ; <nl> } , <nl> - saveEdge : function ( colid , docid , model ) { <nl> - var result = false ; <nl> + saveEdge : function ( colid , docid , model , callback ) { <nl> $ . ajax ( { <nl> cache : false , <nl> type : " PUT " , <nl> - async : false , <nl> url : " / _api / edge / " + colid + " / " + docid , <nl> data : model , <nl> contentType : " application / json " , <nl> processData : false , <nl> success : function ( data ) { <nl> - result = true ; <nl> + callback ( false , data ) ; <nl> } , <nl> error : function ( data ) { <nl> - result = false ; <nl> + callback ( true , data ) ; <nl> } <nl> } ) ; <nl> - return result ; <nl> } , <nl> - saveDocument : function ( colid , docid , model ) { <nl> - var result = false ; <nl> + saveDocument : function ( colid , docid , model , callback ) { <nl> $ . ajax ( { <nl> cache : false , <nl> type : " PUT " , <nl> - async : false , <nl> url : " / _api / document / " + colid + " / " + docid , <nl> data : model , <nl> contentType : " application / json " , <nl> processData : false , <nl> success : function ( data ) { <nl> - result = true ; <nl> + callback ( false , data ) ; <nl> } , <nl> error : function ( data ) { <nl> - result = false ; <nl> + callback ( true , data ) ; <nl> } <nl> } ) ; <nl> - return result ; <nl> - <nl> } , <nl> <nl> updateLocalDocument : function ( data ) { <nl> mmm a / js / apps / system / _admin / aardvark / APP / frontend / js / views / documentView . js <nl> ppp b / js / apps / system / _admin / aardvark / APP / frontend / js / views / documentView . js <nl> <nl> type = ' edge ' ; <nl> } <nl> <nl> - var result , type2 ; <nl> + var callback = function ( error , data , type ) { <nl> + if ( error ) { <nl> + console . log ( data ) ; <nl> + arangoHelper . arangoError ( " Error " , " Could not fetch data . " ) ; <nl> + } <nl> + else { <nl> + var type2 = type + ' : ' ; <nl> + this . type = type ; <nl> + this . fillInfo ( type2 ) ; <nl> + this . fillEditor ( ) ; <nl> + } <nl> + } . bind ( this ) ; <nl> + <nl> if ( type = = = ' edge ' ) { <nl> - result = this . collection . getEdge ( this . colid , this . docid ) ; <nl> - type2 = " Edge : " ; <nl> + this . collection . getEdge ( this . colid , this . docid , callback ) ; <nl> } <nl> else if ( type = = = ' document ' ) { <nl> - result = this . collection . getDocument ( this . colid , this . docid ) ; <nl> - type2 = " Document : " ; <nl> - } <nl> - if ( result = = = true ) { <nl> - this . type = type ; <nl> - this . fillInfo ( type2 ) ; <nl> - this . fillEditor ( ) ; <nl> - return true ; <nl> + this . collection . getDocument ( this . colid , this . docid , callback ) ; <nl> } <nl> } , <nl> <nl> <nl> <nl> window . modalView . hide ( ) ; <nl> <nl> - var model , result ; <nl> + var model ; <nl> <nl> try { <nl> model = this . editor . get ( ) ; <nl> <nl> model = JSON . stringify ( model ) ; <nl> <nl> if ( this . type = = = ' document ' ) { <nl> - result = this . collection . saveDocument ( this . colid , this . docid , model ) ; <nl> - if ( result = = = false ) { <nl> - arangoHelper . arangoError ( ' Document error : ' , ' Could not save ' ) ; <nl> - return ; <nl> - } <nl> + var callback = function ( error ) { <nl> + if ( error ) { <nl> + arangoHelper . arangoError ( ' Error ' , ' Could not save document . ' ) ; <nl> + } <nl> + else { <nl> + this . successConfirmation ( ) ; <nl> + this . disableSaveButton ( ) ; <nl> + } <nl> + } . bind ( this ) ; <nl> + <nl> + this . collection . saveDocument ( this . colid , this . docid , model , callback ) ; <nl> } <nl> else if ( this . type = = = ' edge ' ) { <nl> - result = this . collection . saveEdge ( this . colid , this . docid , model ) ; <nl> - if ( result = = = false ) { <nl> - arangoHelper . arangoError ( ' Edge error : ' , ' Could not save ' ) ; <nl> - return ; <nl> - } <nl> - } <nl> + var callbackE = function ( error ) { <nl> + if ( error ) { <nl> + arangoHelper . arangoError ( ' Error ' , ' Could not save edge . ' ) ; <nl> + } <nl> + else { <nl> + this . successConfirmation ( ) ; <nl> + this . disableSaveButton ( ) ; <nl> + } <nl> + } . bind ( this ) ; <nl> <nl> - if ( result = = = true ) { <nl> - this . successConfirmation ( ) ; <nl> - this . disableSaveButton ( ) ; <nl> + this . collection . saveEdge ( this . colid , this . docid , model , callbackE ) ; <nl> } <nl> } , <nl> <nl> mmm a / js / apps / system / _admin / aardvark / APP / frontend / js / views / documentsView . js <nl> ppp b / js / apps / system / _admin / aardvark / APP / frontend / js / views / documentsView . js <nl> <nl> var deleted = [ ] , self = this ; <nl> <nl> _ . each ( toDelete , function ( key ) { <nl> - var result = false ; <nl> if ( self . type = = = ' document ' ) { <nl> - result = self . documentStore . deleteDocument ( <nl> - self . collection . collectionID , key <nl> - ) ; <nl> - if ( result ) { <nl> - / / on success <nl> - deleted . push ( true ) ; <nl> - self . collection . setTotalMinusOne ( ) ; <nl> - } <nl> - else { <nl> - deleted . push ( false ) ; <nl> - arangoHelper . arangoError ( ' Document error ' , ' Could not delete document . ' ) ; <nl> - } <nl> + var callback = function ( error ) { <nl> + if ( error ) { <nl> + deleted . push ( false ) ; <nl> + arangoHelper . arangoError ( ' Document error ' , ' Could not delete document . ' ) ; <nl> + } <nl> + else { <nl> + deleted . push ( true ) ; <nl> + self . collection . setTotalMinusOne ( ) ; <nl> + self . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) ; <nl> + $ ( ' # markDocuments ' ) . click ( ) ; <nl> + window . modalView . hide ( ) ; <nl> + } <nl> + } . bind ( self ) ; <nl> + self . documentStore . deleteDocument ( self . collection . collectionID , key , callback ) ; <nl> } <nl> else if ( self . type = = = ' edge ' ) { <nl> - result = self . documentStore . deleteEdge ( self . collection . collectionID , key ) ; <nl> - if ( result = = = true ) { <nl> - / / on success <nl> - self . collection . setTotalMinusOne ( ) ; <nl> - deleted . push ( true ) ; <nl> - } <nl> - else { <nl> - deleted . push ( false ) ; <nl> - arangoHelper . arangoError ( ' Edge error ' , ' Could not delete edge ' ) ; <nl> - } <nl> + <nl> + var callback2 = function ( error ) { <nl> + if ( error ) { <nl> + deleted . push ( false ) ; <nl> + arangoHelper . arangoError ( ' Edge error ' , ' Could not delete edge ' ) ; <nl> + } <nl> + else { <nl> + self . collection . setTotalMinusOne ( ) ; <nl> + deleted . push ( true ) ; <nl> + self . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) ; <nl> + $ ( ' # markDocuments ' ) . click ( ) ; <nl> + window . modalView . hide ( ) ; <nl> + } <nl> + } . bind ( self ) ; <nl> + <nl> + self . documentStore . deleteEdge ( self . collection . collectionID , key , callback2 ) ; <nl> } <nl> } ) ; <nl> - this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) ; <nl> - $ ( ' # markDocuments ' ) . click ( ) ; <nl> - window . modalView . hide ( ) ; <nl> + <nl> } , <nl> <nl> getSelectedDocs : function ( ) { <nl> <nl> } , <nl> <nl> reallyDelete : function ( ) { <nl> - var deleted = false ; <nl> - var result ; <nl> if ( this . type = = = ' document ' ) { <nl> - result = this . documentStore . deleteDocument ( <nl> - this . collection . collectionID , this . docid <nl> - ) ; <nl> - if ( result ) { <nl> - / / on success <nl> - this . collection . setTotalMinusOne ( ) ; <nl> - deleted = true ; <nl> - } <nl> - else { <nl> - arangoHelper . arangoError ( ' Doc error ' ) ; <nl> - } <nl> + <nl> + var callback = function ( error ) { <nl> + if ( error ) { <nl> + arangoHelper . arangoError ( ' Error ' , ' Could not delete document ' ) ; <nl> + } <nl> + else { <nl> + this . collection . setTotalMinusOne ( ) ; <nl> + this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) ; <nl> + $ ( ' # docDeleteModal ' ) . modal ( ' hide ' ) ; <nl> + } <nl> + } . bind ( this ) ; <nl> + <nl> + this . documentStore . deleteDocument ( this . collection . collectionID , this . docid , callback ) ; <nl> } <nl> else if ( this . type = = = ' edge ' ) { <nl> - result = this . documentStore . deleteEdge ( this . collection . collectionID , this . docid ) ; <nl> - if ( result = = = true ) { <nl> - / / on success <nl> - this . collection . setTotalMinusOne ( ) ; <nl> - deleted = true ; <nl> - } <nl> - else { <nl> - arangoHelper . arangoError ( ' Edge error ' ) ; <nl> - } <nl> - } <nl> <nl> - if ( deleted = = = true ) { <nl> - this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) ; <nl> - $ ( ' # docDeleteModal ' ) . modal ( ' hide ' ) ; <nl> + var callback2 = function ( error ) { <nl> + if ( error ) { <nl> + arangoHelper . arangoError ( ' Edge error ' , " Could not delete edge " ) ; <nl> + } <nl> + else { <nl> + this . collection . setTotalMinusOne ( ) ; <nl> + this . collection . getDocuments ( this . getDocsCallback . bind ( this ) ) ; <nl> + $ ( ' # docDeleteModal ' ) . modal ( ' hide ' ) ; <nl> + } <nl> + } . bind ( this ) ; <nl> + <nl> + this . documentStore . deleteEdge ( this . collection . collectionID , this . docid , callback2 ) ; <nl> } <nl> } , <nl> <nl>
|
sync to async calls
|
arangodb/arangodb
|
b182f6e48db19d2e35b247a74e989e8ccbe22c33
|
2016-02-20T00:52:57Z
|
mmm a / hphp / runtime / ext / apc / ext_apc . cpp <nl> ppp b / hphp / runtime / ext / apc / ext_apc . cpp <nl> Variant HHVM_FUNCTION ( apc_store , <nl> int64_t ttl / * = 0 * / ) { <nl> if ( ! apcExtension : : Enable ) return Variant ( false ) ; <nl> <nl> + ARRPROV_USE_RUNTIME_LOCATION ( ) ; <nl> + <nl> if ( key_or_array . isArray ( ) ) { <nl> Array valuesArr = key_or_array . toArray ( ) ; <nl> <nl> Variant HHVM_FUNCTION ( apc_add , <nl> int64_t ttl / * = 0 * / ) { <nl> if ( ! apcExtension : : Enable ) return false ; <nl> <nl> + ARRPROV_USE_RUNTIME_LOCATION ( ) ; <nl> + <nl> if ( key_or_array . isArray ( ) ) { <nl> auto valuesArr = key_or_array . asCArrRef ( ) ; <nl> <nl>
|
override apc_add and apc_store to use runtime provenance location
|
facebook/hhvm
|
6fdf9910fd8bdd57d05cb124091e803c2dc206a6
|
2020-08-26T04:21:07Z
|
mmm a / libraries / chain / controller . cpp <nl> ppp b / libraries / chain / controller . cpp <nl> <nl> # include < eosio / chain / action_objects . hpp > <nl> # include < eosio / chain / generated_transaction_object . hpp > <nl> # include < eosio / chain / transaction_object . hpp > <nl> - # include < eosio / chain / producer_object . hpp > <nl> # include < eosio / chain / permission_link_object . hpp > <nl> <nl> # include < eosio / chain / resource_limits . hpp > <nl> <nl> # include < chainbase / chainbase . hpp > <nl> # include < fc / io / json . hpp > <nl> <nl> + # include < eosio / chain / eosio_contract . hpp > <nl> + <nl> namespace eosio { namespace chain { <nl> <nl> using resource_limits : : resource_limits_manager ; <nl> <nl> + abi_def eos_contract_abi ( const abi_def & eosio_system_abi ) ; <nl> + <nl> struct pending_state { <nl> pending_state ( database : : session & & s ) <nl> : _db_session ( move ( s ) ) { } <nl> struct controller_impl { <nl> controller : : config conf ; <nl> controller & self ; <nl> <nl> + using apply_handler = std : : function < void ( apply_context & ) > ; <nl> + typedef pair < scope_name , action_name > handler_key ; <nl> + map < account_name , map < handler_key , apply_handler > > apply_handlers ; <nl> + <nl> block_id_type head_block_id ( ) const { <nl> return head - > id ; <nl> } <nl> struct controller_impl { <nl> } <nl> <nl> <nl> + void set_apply_handler ( account_name contract , scope_name scope , action_name action , apply_handler v ) { <nl> + apply_handlers [ contract ] [ make_pair ( scope , action ) ] = v ; <nl> + } <nl> + <nl> controller_impl ( const controller : : config & cfg , controller & s ) <nl> : db ( cfg . shared_memory_dir , <nl> cfg . read_only ? database : : read_only : database : : read_write , <nl> struct controller_impl { <nl> self ( s ) <nl> { <nl> head = fork_db . head ( ) ; <nl> + <nl> + <nl> + # define SET_APP_HANDLER ( contract , scope , action , nspace ) \ <nl> + set_apply_handler ( # contract , # scope , # action , & BOOST_PP_CAT ( apply_ , BOOST_PP_CAT ( contract , BOOST_PP_CAT ( _ , action ) ) ) ) <nl> + / * <nl> + SET_APP_HANDLER ( eosio , eosio , newaccount , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , setcode , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , setabi , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , updateauth , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , deleteauth , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , linkauth , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , unlinkauth , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , onerror , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , postrecovery , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , passrecovery , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , vetorecovery , eosio ) ; <nl> + SET_APP_HANDLER ( eosio , eosio , canceldelay , eosio ) ; <nl> + * / <nl> + <nl> + <nl> } <nl> <nl> void init ( ) { <nl> struct controller_impl { <nl> db . add_index < block_summary_multi_index > ( ) ; <nl> db . add_index < transaction_multi_index > ( ) ; <nl> db . add_index < generated_transaction_multi_index > ( ) ; <nl> - db . add_index < producer_multi_index > ( ) ; <nl> db . add_index < scope_sequence_multi_index > ( ) ; <nl> <nl> resource_limits . initialize_database ( ) ; <nl> struct controller_impl { <nl> db . set_revision ( head - > block_num ) ; <nl> fork_db . set ( head ) ; <nl> <nl> - / / Initialize block summary index <nl> - for ( int i = 0 ; i < 0x10000 ; i + + ) <nl> - db . create < block_summary_object > ( [ & ] ( block_summary_object & ) { } ) ; <nl> - <nl> + initialize_database ( ) ; <nl> } <nl> FC_ASSERT ( db . revision ( ) = = head - > block_num , " fork database is inconsistant with shared memory " , <nl> ( " db " , db . revision ( ) ) ( " head " , head - > block_num ) ) ; <nl> } <nl> <nl> + void create_native_account ( account_name name ) { <nl> + db . create < account_object > ( [ this , & name ] ( account_object & a ) { <nl> + a . name = name ; <nl> + a . creation_date = conf . genesis . initial_timestamp ; <nl> + a . privileged = true ; <nl> + <nl> + if ( name = = config : : system_account_name ) { <nl> + a . set_abi ( eos_contract_abi ( abi_def ( ) ) ) ; <nl> + } <nl> + } ) ; <nl> + const auto & owner = db . create < permission_object > ( [ & ] ( permission_object & p ) { <nl> + p . owner = name ; <nl> + p . name = " owner " ; <nl> + p . auth . threshold = 1 ; <nl> + p . auth . keys . push_back ( key_weight { . key = conf . genesis . initial_key , . weight = 1 } ) ; <nl> + } ) ; <nl> + db . create < permission_object > ( [ & ] ( permission_object & p ) { <nl> + p . owner = name ; <nl> + p . parent = owner . id ; <nl> + p . name = " active " ; <nl> + p . auth . threshold = 1 ; <nl> + p . auth . keys . push_back ( key_weight { . key = conf . genesis . initial_key , . weight = 1 } ) ; <nl> + } ) ; <nl> + <nl> + resource_limits . initialize_account ( name ) ; <nl> + } <nl> + <nl> + void initialize_database ( ) { <nl> + / / Initialize block summary index <nl> + for ( int i = 0 ; i < 0x10000 ; i + + ) <nl> + db . create < block_summary_object > ( [ & ] ( block_summary_object & ) { } ) ; <nl> + <nl> + db . create < global_property_object > ( [ ] ( auto ) { } ) ; <nl> + db . create < dynamic_global_property_object > ( [ ] ( auto ) { } ) ; <nl> + db . create < permission_object > ( [ ] ( auto ) { } ) ; / / / reserve perm 0 ( used else where ) <nl> + <nl> + resource_limits . initialize_chain ( ) ; <nl> + <nl> + create_native_account ( config : : system_account_name ) ; <nl> + <nl> + / / Create special accounts <nl> + auto create_special_account = [ & ] ( account_name name , const auto & owner , const auto & active ) { <nl> + db . create < account_object > ( [ & ] ( account_object & a ) { <nl> + a . name = name ; <nl> + a . creation_date = conf . genesis . initial_timestamp ; <nl> + } ) ; <nl> + const auto & owner_permission = db . create < permission_object > ( [ & ] ( permission_object & p ) { <nl> + p . name = config : : owner_name ; <nl> + p . parent = 0 ; <nl> + p . owner = name ; <nl> + p . auth = move ( owner ) ; <nl> + } ) ; <nl> + db . create < permission_object > ( [ & ] ( permission_object & p ) { <nl> + p . name = config : : active_name ; <nl> + p . parent = owner_permission . id ; <nl> + p . owner = owner_permission . owner ; <nl> + p . auth = move ( active ) ; <nl> + } ) ; <nl> + } ; <nl> + <nl> + auto empty_authority = authority ( 0 , { } , { } ) ; <nl> + auto active_producers_authority = authority ( 0 , { } , { } ) ; <nl> + active_producers_authority . accounts . push_back ( { { config : : system_account_name , config : : active_name } , 1 } ) ; <nl> + <nl> + create_special_account ( config : : nobody_account_name , empty_authority , empty_authority ) ; <nl> + create_special_account ( config : : producers_account_name , empty_authority , active_producers_authority ) ; <nl> + } <nl> + <nl> <nl> <nl> / * * <nl> void controller : : push_block ( const signed_block_ptr & b ) { <nl> <nl> auto new_head = my - > fork_db . add ( b ) ; <nl> <nl> - <nl> edump ( ( new_head - > block_num ) ) ; <nl> if ( new_head - > header . previous = = my - > head - > id ) { <nl> try { <nl> time_point controller : : head_block_time ( ) const { <nl> } <nl> <nl> uint64_t controller : : next_global_sequence ( ) { <nl> - return 0 ; <nl> + const auto & p = get_dynamic_global_properties ( ) ; <nl> + my - > db . modify ( p , [ & ] ( auto & dgp ) { <nl> + + + dgp . global_action_sequence ; <nl> + } ) ; <nl> + return p . global_action_sequence ; <nl> } <nl> + <nl> uint64_t controller : : next_recv_sequence ( account_name receiver ) { <nl> return 0 ; <nl> } <nl> void controller : : record_transaction ( const transaction_metadata_ptr & trx ) { <nl> my - > record_transaction ( trx ) ; <nl> } <nl> <nl> + const dynamic_global_property_object & controller : : get_dynamic_global_properties ( ) const { <nl> + return my - > db . get < dynamic_global_property_object > ( ) ; <nl> + } <nl> <nl> / * * <nl> * This method reads the current dpos_irreverible block number , if it is higher <nl> void controller : : log_irreversible_blocks ( ) { <nl> const auto & log_head = my - > blog . head ( ) ; <nl> auto lib = my - > head - > dpos_last_irreversible_blocknum ; <nl> <nl> - idump ( ( lib ) ) ; <nl> - <nl> if ( lib > 1 ) { <nl> while ( log_head & & log_head - > block_num ( ) < lib ) { <nl> auto lhead = log_head - > block_num ( ) ; <nl> - edump ( ( lib ) ( lhead ) ) ; <nl> auto blk_id = my - > get_block_id_for_num ( lhead + 1 ) ; <nl> - wdump ( ( blk_id ) ) ; <nl> auto blk = my - > fork_db . get_block ( blk_id ) ; <nl> FC_ASSERT ( blk , " unable to find block state " , ( " id " , blk_id ) ) ; <nl> my - > blog . append ( * blk - > block ) ; <nl> + my - > fork_db . prune ( blk ) ; <nl> + my - > db . commit ( lhead ) ; <nl> } <nl> } <nl> } <nl> + <nl> + void controller : : pop_block ( ) { <nl> + auto prev = my - > fork_db . get_block ( my - > head - > header . previous ) ; <nl> + FC_ASSERT ( prev , " attempt to pop beyond last irreversible block " ) ; <nl> + my - > db . undo ( ) ; <nl> + my - > head = prev ; <nl> + } <nl> + <nl> + <nl> + abi_def eos_contract_abi ( const abi_def & eosio_system_abi ) <nl> + { <nl> + abi_def eos_abi ( eosio_system_abi ) ; <nl> + eos_abi . types . push_back ( type_def { " account_name " , " name " } ) ; <nl> + eos_abi . types . push_back ( type_def { " table_name " , " name " } ) ; <nl> + eos_abi . types . push_back ( type_def { " share_type " , " int64 " } ) ; <nl> + eos_abi . types . push_back ( type_def { " onerror " , " bytes " } ) ; <nl> + eos_abi . types . push_back ( type_def { " context_free_type " , " bytes " } ) ; <nl> + eos_abi . types . push_back ( type_def { " weight_type " , " uint16 " } ) ; <nl> + eos_abi . types . push_back ( type_def { " fields " , " field [ ] " } ) ; <nl> + eos_abi . types . push_back ( type_def { " time_point_sec " , " time " } ) ; <nl> + <nl> + / / TODO add ricardian contracts <nl> + eos_abi . actions . push_back ( action_def { name ( " setcode " ) , " setcode " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " setabi " ) , " setabi " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " linkauth " ) , " linkauth " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " unlinkauth " ) , " unlinkauth " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " updateauth " ) , " updateauth " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " deleteauth " ) , " deleteauth " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " newaccount " ) , " newaccount " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " postrecovery " ) , " postrecovery " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " passrecovery " ) , " passrecovery " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " vetorecovery " ) , " vetorecovery " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " onerror " ) , " onerror " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " onblock " ) , " onblock " , " " } ) ; <nl> + eos_abi . actions . push_back ( action_def { name ( " canceldelay " ) , " canceldelay " , " " } ) ; <nl> + <nl> + / / TODO add any ricardian_clauses <nl> + / / <nl> + / / ACTION PAYLOADS <nl> + <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " setcode " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " vmtype " , " uint8 " } , <nl> + { " vmversion " , " uint8 " } , <nl> + { " code " , " bytes " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " setabi " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " abi " , " abi_def " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " updateauth " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " permission " , " permission_name " } , <nl> + { " parent " , " permission_name " } , <nl> + { " data " , " authority " } , <nl> + { " delay " , " uint32 " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " linkauth " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " code " , " account_name " } , <nl> + { " type " , " action_name " } , <nl> + { " requirement " , " permission_name " } , <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " unlinkauth " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " code " , " account_name " } , <nl> + { " type " , " action_name " } , <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " deleteauth " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " permission " , " permission_name " } , <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " newaccount " , " " , { <nl> + { " creator " , " account_name " } , <nl> + { " name " , " account_name " } , <nl> + { " owner " , " authority " } , <nl> + { " active " , " authority " } , <nl> + { " recovery " , " authority " } , <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " postrecovery " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " data " , " authority " } , <nl> + { " memo " , " string " } , <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " passrecovery " , " " , { <nl> + { " account " , " account_name " } , <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " vetorecovery " , " " , { <nl> + { " account " , " account_name " } , <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " canceldelay " , " " , { <nl> + { " trx_id " , " transaction_id_type " } , <nl> + } <nl> + } ) ; <nl> + <nl> + / / DATABASE RECORDS <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " pending_recovery " , " " , { <nl> + { " account " , " name " } , <nl> + { " request_id " , " uint128 " } , <nl> + { " update " , " updateauth " } , <nl> + { " memo " , " string " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . tables . emplace_back ( table_def { <nl> + " recovery " , " i64 " , { <nl> + " account " , <nl> + } , { <nl> + " name " <nl> + } , <nl> + " pending_recovery " <nl> + } ) ; <nl> + <nl> + / / abi_def fields <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " field " , " " , { <nl> + { " name " , " field_name " } , <nl> + { " type " , " type_name " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " struct_def " , " " , { <nl> + { " name " , " type_name " } , <nl> + { " base " , " type_name " } , <nl> + { " fields " , " fields " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " permission_level " , " " , { <nl> + { " actor " , " account_name " } , <nl> + { " permission " , " permission_name " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " action " , " " , { <nl> + { " account " , " account_name " } , <nl> + { " name " , " action_name " } , <nl> + { " authorization " , " permission_level [ ] " } , <nl> + { " data " , " bytes " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " permission_level_weight " , " " , { <nl> + { " permission " , " permission_level " } , <nl> + { " weight " , " weight_type " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " transaction_header " , " " , { <nl> + { " expiration " , " time_point_sec " } , <nl> + { " region " , " uint16 " } , <nl> + { " ref_block_num " , " uint16 " } , <nl> + { " ref_block_prefix " , " uint32 " } , <nl> + { " max_net_usage_words " , " varuint32 " } , <nl> + { " max_kcpu_usage " , " varuint32 " } , <nl> + { " delay_sec " , " varuint32 " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " transaction " , " transaction_header " , { <nl> + { " context_free_actions " , " action [ ] " } , <nl> + { " actions " , " action [ ] " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " signed_transaction " , " transaction " , { <nl> + { " signatures " , " signature [ ] " } , <nl> + { " context_free_data " , " bytes [ ] " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " key_weight " , " " , { <nl> + { " key " , " public_key " } , <nl> + { " weight " , " weight_type " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " authority " , " " , { <nl> + { " threshold " , " uint32 " } , <nl> + { " keys " , " key_weight [ ] " } , <nl> + { " accounts " , " permission_level_weight [ ] " } <nl> + } <nl> + } ) ; <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " clause_pair " , " " , { <nl> + { " id " , " string " } , <nl> + { " body " , " string " } <nl> + } <nl> + } ) ; <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " type_def " , " " , { <nl> + { " new_type_name " , " type_name " } , <nl> + { " type " , " type_name " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " action_def " , " " , { <nl> + { " name " , " action_name " } , <nl> + { " type " , " type_name " } , <nl> + { " ricardian_contract " , " string " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " table_def " , " " , { <nl> + { " name " , " table_name " } , <nl> + { " index_type " , " type_name " } , <nl> + { " key_names " , " field_name [ ] " } , <nl> + { " key_types " , " type_name [ ] " } , <nl> + { " type " , " type_name " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " abi_def " , " " , { <nl> + { " types " , " type_def [ ] " } , <nl> + { " structs " , " struct_def [ ] " } , <nl> + { " actions " , " action_def [ ] " } , <nl> + { " tables " , " table_def [ ] " } , <nl> + { " ricardian_clauses " , " clause_pair [ ] " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " block_header " , " " , { <nl> + { " previous " , " checksum256 " } , <nl> + { " timestamp " , " uint32 " } , <nl> + { " transaction_mroot " , " checksum256 " } , <nl> + { " action_mroot " , " checksum256 " } , <nl> + { " block_mroot " , " checksum256 " } , <nl> + { " producer " , " account_name " } , <nl> + { " schedule_version " , " uint32 " } , <nl> + { " new_producers " , " producer_schedule ? " } <nl> + } <nl> + } ) ; <nl> + <nl> + eos_abi . structs . emplace_back ( struct_def { <nl> + " onblock " , " " , { <nl> + { " header " , " block_header " } <nl> + } <nl> + } ) ; <nl> + <nl> + return eos_abi ; <nl> + } <nl> + <nl> <nl> } } / / / eosio : : chain <nl> new file mode 100644 <nl> index 0000000000 . . a6a860f17c <nl> mmm / dev / null <nl> ppp b / libraries / chain / eosio_contract . cpp <nl> <nl> + / * * <nl> + * @ file <nl> + * @ copyright defined in eos / LICENSE . txt <nl> + * / <nl> + # include < eosio / chain / eosio_contract . hpp > <nl> + # include < eosio / chain / contracts / contract_table_objects . hpp > <nl> + # include < eosio / chain / contracts / chain_initializer . hpp > <nl> + <nl> + # include < eosio / chain / chain_controller . hpp > <nl> + # include < eosio / chain / apply_context . hpp > <nl> + # include < eosio / chain / transaction . hpp > <nl> + # include < eosio / chain / exceptions . hpp > <nl> + <nl> + # include < eosio / chain / account_object . hpp > <nl> + # include < eosio / chain / permission_object . hpp > <nl> + # include < eosio / chain / permission_link_object . hpp > <nl> + # include < eosio / chain / generated_transaction_object . hpp > <nl> + # include < eosio / chain / global_property_object . hpp > <nl> + # include < eosio / chain / contracts / types . hpp > <nl> + # include < eosio / chain / producer_object . hpp > <nl> + <nl> + # include < eosio / chain / wasm_interface . hpp > <nl> + # include < eosio / chain / contracts / abi_serializer . hpp > <nl> + <nl> + # include < eosio / chain / resource_limits . hpp > <nl> + <nl> + namespace eosio { namespace chain { namespace contracts { <nl> + <nl> + void validate_authority_precondition ( const apply_context & context , const authority & auth ) { <nl> + for ( const auto & a : auth . accounts ) { <nl> + context . db . get < account_object , by_name > ( a . permission . actor ) ; <nl> + context . db . get < permission_object , by_owner > ( boost : : make_tuple ( a . permission . actor , a . permission . permission ) ) ; <nl> + } <nl> + } <nl> + <nl> + / * * <nl> + * This method is called assuming precondition_system_newaccount succeeds a <nl> + * / <nl> + void apply_eosio_newaccount ( apply_context & context ) { <nl> + auto create = context . act . data_as < newaccount > ( ) ; <nl> + try { <nl> + context . require_authorization ( create . creator ) ; <nl> + context . require_write_lock ( config : : eosio_auth_scope ) ; <nl> + auto & resources = context . mutable_controller . get_mutable_resource_limits_manager ( ) ; <nl> + <nl> + EOS_ASSERT ( validate ( create . owner ) , action_validate_exception , " Invalid owner authority " ) ; <nl> + EOS_ASSERT ( validate ( create . active ) , action_validate_exception , " Invalid active authority " ) ; <nl> + EOS_ASSERT ( validate ( create . recovery ) , action_validate_exception , " Invalid recovery authority " ) ; <nl> + <nl> + auto & db = context . mutable_db ; <nl> + <nl> + auto name_str = name ( create . name ) . to_string ( ) ; <nl> + <nl> + EOS_ASSERT ( ! create . name . empty ( ) , action_validate_exception , " account name cannot be empty " ) ; <nl> + EOS_ASSERT ( name_str . size ( ) < = 12 , action_validate_exception , " account names can only be 12 chars long " ) ; <nl> + <nl> + / / Check if the creator is privileged <nl> + const auto & creator = db . get < account_object , by_name > ( create . creator ) ; <nl> + if ( ! creator . privileged ) { <nl> + EOS_ASSERT ( name_str . find ( " eosio . " ) ! = 0 , action_validate_exception , <nl> + " only privileged accounts can have names that start with ' eosio . ' " ) ; <nl> + } <nl> + <nl> + auto existing_account = db . find < account_object , by_name > ( create . name ) ; <nl> + EOS_ASSERT ( existing_account = = nullptr , action_validate_exception , <nl> + " Cannot create account named $ { name } , as that name is already taken " , <nl> + ( " name " , create . name ) ) ; <nl> + <nl> + for ( const auto & auth : { create . owner , create . active , create . recovery } ) { <nl> + validate_authority_precondition ( context , auth ) ; <nl> + } <nl> + <nl> + const auto & new_account = db . create < account_object > ( [ & create , & context ] ( account_object & a ) { <nl> + a . name = create . name ; <nl> + a . creation_date = context . controller . head_block_time ( ) ; <nl> + } ) ; <nl> + resources . initialize_account ( create . name ) ; <nl> + resources . add_pending_account_ram_usage ( <nl> + create . creator , <nl> + ( int64_t ) config : : overhead_per_account_ram_bytes <nl> + ) ; <nl> + <nl> + auto create_permission = [ owner = create . name , & db , & context , & resources ] ( const permission_name & name , permission_object : : id_type parent , authority & & auth ) { <nl> + const auto & result = db . create < permission_object > ( [ & ] ( permission_object & p ) { <nl> + p . name = name ; <nl> + p . parent = parent ; <nl> + p . owner = owner ; <nl> + p . auth = std : : move ( auth ) ; <nl> + } ) ; <nl> + <nl> + resources . add_pending_account_ram_usage ( <nl> + owner , <nl> + ( int64_t ) ( config : : billable_size_v < permission_object > + result . auth . get_billable_size ( ) ) <nl> + ) ; <nl> + <nl> + return result ; <nl> + } ; <nl> + <nl> + / / If a parent_id of 0 is going to be used to indicate the absence of a parent , then we need to make sure that the chain <nl> + / / initializes permission_index with a dummy object that reserves the id of 0 . <nl> + const auto & owner_permission = create_permission ( config : : owner_name , 0 , std : : move ( create . owner ) ) ; <nl> + create_permission ( config : : active_name , owner_permission . id , std : : move ( create . active ) ) ; <nl> + <nl> + } FC_CAPTURE_AND_RETHROW ( ( create ) ) } <nl> + <nl> + void apply_eosio_setcode ( apply_context & context ) { <nl> + auto & db = context . mutable_db ; <nl> + auto & resources = context . mutable_controller . get_mutable_resource_limits_manager ( ) ; <nl> + auto act = context . act . data_as < setcode > ( ) ; <nl> + context . require_authorization ( act . account ) ; <nl> + context . require_write_lock ( config : : eosio_auth_scope ) ; <nl> + <nl> + FC_ASSERT ( act . vmtype = = 0 ) ; <nl> + FC_ASSERT ( act . vmversion = = 0 ) ; <nl> + <nl> + auto code_id = fc : : sha256 : : hash ( act . code . data ( ) , ( uint32_t ) act . code . size ( ) ) ; <nl> + <nl> + wasm_interface : : validate ( act . code ) ; <nl> + <nl> + const auto & account = db . get < account_object , by_name > ( act . account ) ; <nl> + <nl> + int64_t code_size = ( int64_t ) act . code . size ( ) ; <nl> + int64_t old_size = ( int64_t ) account . code . size ( ) * config : : setcode_ram_bytes_multiplier ; <nl> + int64_t new_size = code_size * config : : setcode_ram_bytes_multiplier ; <nl> + <nl> + <nl> + FC_ASSERT ( account . code_version ! = code_id , " contract is already running this version of code " ) ; <nl> + / / wlog ( " set code : $ { size } " , ( " size " , act . code . size ( ) ) ) ; <nl> + db . modify ( account , [ & ] ( auto & a ) { <nl> + / * * TODO : consider whether a microsecond level local timestamp is sufficient to detect code version changes * / <nl> + # warning TODO : update setcode message to include the hash , then validate it in validate <nl> + a . code_version = code_id ; <nl> + / / Added resize ( 0 ) here to avoid bug in boost vector container <nl> + a . code . resize ( 0 ) ; <nl> + a . code . resize ( code_size ) ; <nl> + a . last_code_update = context . controller . head_block_time ( ) ; <nl> + memcpy ( a . code . data ( ) , act . code . data ( ) , code_size ) ; <nl> + <nl> + } ) ; <nl> + <nl> + if ( new_size ! = old_size ) { <nl> + resources . add_pending_account_ram_usage ( <nl> + act . account , <nl> + new_size - old_size <nl> + ) ; <nl> + } <nl> + } <nl> + <nl> + void apply_eosio_setabi ( apply_context & context ) { <nl> + auto & db = context . mutable_db ; <nl> + auto & resources = context . mutable_controller . get_mutable_resource_limits_manager ( ) ; <nl> + auto act = context . act . data_as < setabi > ( ) ; <nl> + <nl> + context . require_authorization ( act . account ) ; <nl> + <nl> + / / if system account append native abi <nl> + if ( act . account = = eosio : : chain : : config : : system_account_name ) { <nl> + act . abi = chain_initializer : : eos_contract_abi ( act . abi ) ; <nl> + } <nl> + / / / if an ABI is specified make sure it is well formed and doesn ' t <nl> + / / / reference any undefined types <nl> + abi_serializer ( act . abi ) . validate ( ) ; <nl> + / / todo : figure out abi serialization location <nl> + <nl> + const auto & account = db . get < account_object , by_name > ( act . account ) ; <nl> + <nl> + int64_t old_size = ( int64_t ) account . abi . size ( ) ; <nl> + int64_t new_size = ( int64_t ) fc : : raw : : pack_size ( act . abi ) ; <nl> + <nl> + db . modify ( account , [ & ] ( auto & a ) { <nl> + a . set_abi ( act . abi ) ; <nl> + } ) ; <nl> + <nl> + if ( new_size ! = old_size ) { <nl> + resources . add_pending_account_ram_usage ( <nl> + act . account , <nl> + new_size - old_size <nl> + ) ; <nl> + } <nl> + } <nl> + <nl> + void apply_eosio_updateauth ( apply_context & context ) { <nl> + auto & resources = context . mutable_controller . get_mutable_resource_limits_manager ( ) ; <nl> + context . require_write_lock ( config : : eosio_auth_scope ) ; <nl> + <nl> + auto & db = context . mutable_db ; <nl> + <nl> + auto update = context . act . data_as < updateauth > ( ) ; <nl> + EOS_ASSERT ( ! update . permission . empty ( ) , action_validate_exception , " Cannot create authority with empty name " ) ; <nl> + EOS_ASSERT ( update . permission . to_string ( ) . find ( " eosio . " ) ! = 0 , action_validate_exception , <nl> + " Permission names that start with ' eosio . ' are reserved " ) ; <nl> + EOS_ASSERT ( update . permission ! = update . parent , action_validate_exception , " Cannot set an authority as its own parent " ) ; <nl> + db . get < account_object , by_name > ( update . account ) ; <nl> + EOS_ASSERT ( validate ( update . data ) , action_validate_exception , <nl> + " Invalid authority : $ { auth } " , ( " auth " , update . data ) ) ; <nl> + if ( update . permission = = config : : active_name ) <nl> + EOS_ASSERT ( update . parent = = config : : owner_name , action_validate_exception , " Cannot change active authority ' s parent from owner " , ( " update . parent " , update . parent ) ) ; <nl> + if ( update . permission = = config : : owner_name ) <nl> + EOS_ASSERT ( update . parent . empty ( ) , action_validate_exception , " Cannot change owner authority ' s parent " ) ; <nl> + else <nl> + EOS_ASSERT ( ! update . parent . empty ( ) , action_validate_exception , " Only owner permission can have empty parent " ) ; <nl> + <nl> + FC_ASSERT ( context . act . authorization . size ( ) , " updateauth can only have one action authorization " ) ; <nl> + const auto & act_auth = context . act . authorization . front ( ) ; <nl> + / / lazy evaluating loop <nl> + auto permission_is_valid_for_update = [ & ] ( ) { <nl> + if ( act_auth . permission = = config : : owner_name | | act_auth . permission = = update . permission ) { <nl> + return true ; <nl> + } <nl> + const permission_object * current = db . find < permission_object , by_owner > ( boost : : make_tuple ( update . account , update . permission ) ) ; <nl> + / / Permission doesn ' t exist yet , check parent permission <nl> + if ( current = = nullptr ) current = db . find < permission_object , by_owner > ( boost : : make_tuple ( update . account , update . parent ) ) ; <nl> + / / Ensure either the permission or parent ' s permission exists <nl> + EOS_ASSERT ( current ! = nullptr , permission_query_exception , <nl> + " Failed to retrieve permission for : { \ " actor \ " : \ " $ { actor } \ " , \ " permission \ " : \ " $ { permission } \ " } " , <nl> + ( " actor " , update . account ) ( " permission " , update . parent ) ) ; <nl> + <nl> + while ( current - > name ! = config : : owner_name ) { <nl> + if ( current - > name = = act_auth . permission ) { <nl> + return true ; <nl> + } <nl> + current = & db . get < permission_object > ( current - > parent ) ; <nl> + } <nl> + <nl> + return false ; <nl> + } ; <nl> + <nl> + FC_ASSERT ( act_auth . actor = = update . account & & permission_is_valid_for_update ( ) , " updateauth must carry a permission equal to or in the ancestery of permission it updates " ) ; <nl> + <nl> + validate_authority_precondition ( context , update . data ) ; <nl> + <nl> + auto permission = db . find < permission_object , by_owner > ( boost : : make_tuple ( update . account , update . permission ) ) ; <nl> + <nl> + / / If a parent_id of 0 is going to be used to indicate the absence of a parent , then we need to make sure that the chain <nl> + / / initializes permission_index with a dummy object that reserves the id of 0 . <nl> + permission_object : : id_type parent_id = 0 ; <nl> + if ( update . permission ! = config : : owner_name ) { <nl> + auto & parent = db . get < permission_object , by_owner > ( boost : : make_tuple ( update . account , update . parent ) ) ; <nl> + parent_id = parent . id ; <nl> + } <nl> + <nl> + if ( permission ) { <nl> + EOS_ASSERT ( parent_id = = permission - > parent , action_validate_exception , <nl> + " Changing parent authority is not currently supported " ) ; <nl> + <nl> + <nl> + int64_t old_size = ( int64_t ) ( config : : billable_size_v < permission_object > + permission - > auth . get_billable_size ( ) ) ; <nl> + <nl> + / / TODO / QUESTION : If we are updating an existing permission , should we check if the message declared <nl> + / / permission satisfies the permission we want to modify ? <nl> + db . modify ( * permission , [ & update , & parent_id , & context ] ( permission_object & po ) { <nl> + po . auth = update . data ; <nl> + po . parent = parent_id ; <nl> + po . last_updated = context . controller . head_block_time ( ) ; <nl> + po . delay = fc : : seconds ( update . delay ) ; <nl> + } ) ; <nl> + <nl> + int64_t new_size = ( int64_t ) ( config : : billable_size_v < permission_object > + permission - > auth . get_billable_size ( ) ) ; <nl> + <nl> + resources . add_pending_account_ram_usage ( <nl> + permission - > owner , <nl> + new_size - old_size <nl> + ) ; <nl> + } else { <nl> + / / TODO / QUESTION : If we are creating a new permission , should we check if the message declared <nl> + / / permission satisfies the parent permission ? <nl> + const auto & p = db . create < permission_object > ( [ & update , & parent_id , & context ] ( permission_object & po ) { <nl> + po . name = update . permission ; <nl> + po . owner = update . account ; <nl> + po . auth = update . data ; <nl> + po . parent = parent_id ; <nl> + po . last_updated = context . controller . head_block_time ( ) ; <nl> + po . delay = fc : : seconds ( update . delay ) ; <nl> + } ) ; <nl> + <nl> + resources . add_pending_account_ram_usage ( <nl> + p . owner , <nl> + ( int64_t ) ( config : : billable_size_v < permission_object > + p . auth . get_billable_size ( ) ) <nl> + ) ; <nl> + <nl> + } <nl> + } <nl> + <nl> + void apply_eosio_deleteauth ( apply_context & context ) { <nl> + auto & resources = context . mutable_controller . get_mutable_resource_limits_manager ( ) ; <nl> + auto remove = context . act . data_as < deleteauth > ( ) ; <nl> + EOS_ASSERT ( remove . permission ! = config : : active_name , action_validate_exception , " Cannot delete active authority " ) ; <nl> + EOS_ASSERT ( remove . permission ! = config : : owner_name , action_validate_exception , " Cannot delete owner authority " ) ; <nl> + <nl> + auto & db = context . mutable_db ; <nl> + context . require_authorization ( remove . account ) ; <nl> + / / TODO / QUESTION : <nl> + / / Inconsistency between permissions that can be satisfied to create / modify ( via updateauth ) a permission and the <nl> + / / stricter requirements for deleting the permission using deleteauth . <nl> + / / If a permission can be updated , shouldn ' t it also be allowed to delete it without higher permissions required ? <nl> + const auto & permission = db . get < permission_object , by_owner > ( boost : : make_tuple ( remove . account , remove . permission ) ) ; <nl> + <nl> + { / / Check for children <nl> + const auto & index = db . get_index < permission_index , by_parent > ( ) ; <nl> + auto range = index . equal_range ( permission . id ) ; <nl> + EOS_ASSERT ( range . first = = range . second , action_validate_exception , <nl> + " Cannot delete an authority which has children . Delete the children first " ) ; <nl> + } <nl> + <nl> + { / / Check for links to this permission <nl> + const auto & index = db . get_index < permission_link_index , by_permission_name > ( ) ; <nl> + auto range = index . equal_range ( boost : : make_tuple ( remove . account , remove . permission ) ) ; <nl> + EOS_ASSERT ( range . first = = range . second , action_validate_exception , <nl> + " Cannot delete a linked authority . Unlink the authority first " ) ; <nl> + } <nl> + <nl> + resources . add_pending_account_ram_usage ( <nl> + permission . owner , <nl> + - ( int64_t ) ( config : : billable_size_v < permission_object > + permission . auth . get_billable_size ( ) ) <nl> + ) ; <nl> + db . remove ( permission ) ; <nl> + } <nl> + <nl> + void apply_eosio_linkauth ( apply_context & context ) { <nl> + auto & resources = context . mutable_controller . get_mutable_resource_limits_manager ( ) ; <nl> + auto requirement = context . act . data_as < linkauth > ( ) ; <nl> + try { <nl> + EOS_ASSERT ( ! requirement . requirement . empty ( ) , action_validate_exception , " Required permission cannot be empty " ) ; <nl> + <nl> + context . require_authorization ( requirement . account ) ; <nl> + <nl> + auto & db = context . mutable_db ; <nl> + const auto * account = db . find < account_object , by_name > ( requirement . account ) ; <nl> + EOS_ASSERT ( account ! = nullptr , account_query_exception , <nl> + " Failed to retrieve account : $ { account } " , ( " account " , requirement . account ) ) ; / / Redundant ? <nl> + const auto * code = db . find < account_object , by_name > ( requirement . code ) ; <nl> + EOS_ASSERT ( code ! = nullptr , account_query_exception , <nl> + " Failed to retrieve code for account : $ { account } " , ( " account " , requirement . code ) ) ; <nl> + if ( requirement . requirement ! = config : : eosio_any_name ) { <nl> + const auto * permission = db . find < permission_object , by_name > ( requirement . requirement ) ; <nl> + EOS_ASSERT ( permission ! = nullptr , permission_query_exception , <nl> + " Failed to retrieve permission : $ { permission } " , ( " permission " , requirement . requirement ) ) ; <nl> + } <nl> + <nl> + auto link_key = boost : : make_tuple ( requirement . account , requirement . code , requirement . type ) ; <nl> + auto link = db . find < permission_link_object , by_action_name > ( link_key ) ; <nl> + <nl> + if ( link ) { <nl> + EOS_ASSERT ( link - > required_permission ! = requirement . requirement , action_validate_exception , <nl> + " Attempting to update required authority , but new requirement is same as old " ) ; <nl> + db . modify ( * link , [ requirement = requirement . requirement ] ( permission_link_object & link ) { <nl> + link . required_permission = requirement ; <nl> + } ) ; <nl> + } else { <nl> + const auto & l = db . create < permission_link_object > ( [ & requirement ] ( permission_link_object & link ) { <nl> + link . account = requirement . account ; <nl> + link . code = requirement . code ; <nl> + link . message_type = requirement . type ; <nl> + link . required_permission = requirement . requirement ; <nl> + } ) ; <nl> + <nl> + resources . add_pending_account_ram_usage ( <nl> + l . account , <nl> + ( int64_t ) ( config : : billable_size_v < permission_link_object > ) <nl> + ) ; <nl> + } <nl> + } FC_CAPTURE_AND_RETHROW ( ( requirement ) ) <nl> + } <nl> + <nl> + void apply_eosio_unlinkauth ( apply_context & context ) { <nl> + auto & resources = context . mutable_controller . get_mutable_resource_limits_manager ( ) ; <nl> + auto & db = context . mutable_db ; <nl> + auto unlink = context . act . data_as < unlinkauth > ( ) ; <nl> + <nl> + context . require_authorization ( unlink . account ) ; <nl> + <nl> + auto link_key = boost : : make_tuple ( unlink . account , unlink . code , unlink . type ) ; <nl> + auto link = db . find < permission_link_object , by_action_name > ( link_key ) ; <nl> + EOS_ASSERT ( link ! = nullptr , action_validate_exception , " Attempting to unlink authority , but no link found " ) ; <nl> + resources . add_pending_account_ram_usage ( <nl> + link - > account , <nl> + - ( int64_t ) ( config : : billable_size_v < permission_link_object > ) <nl> + ) ; <nl> + <nl> + db . remove ( * link ) ; <nl> + } <nl> + <nl> + <nl> + void apply_eosio_onerror ( apply_context & context ) { <nl> + FC_ASSERT ( context . trx_meta . sender . valid ( ) , " onerror action cannot be called directly " ) ; <nl> + context . require_recipient ( * context . trx_meta . sender ) ; <nl> + } <nl> + <nl> + static const abi_serializer & get_abi_serializer ( ) { <nl> + static optional < abi_serializer > _abi_serializer ; <nl> + if ( ! _abi_serializer ) { <nl> + _abi_serializer . emplace ( chain_initializer : : eos_contract_abi ( abi_def ( ) ) ) ; <nl> + } <nl> + <nl> + return * _abi_serializer ; <nl> + } <nl> + <nl> + static optional < variant > get_pending_recovery ( apply_context & context , account_name account ) { <nl> + const uint64_t id = account ; <nl> + const auto table = N ( recovery ) ; <nl> + const auto iter = context . db_find_i64 ( config : : system_account_name , account , table , id ) ; <nl> + if ( iter ! = - 1 ) { <nl> + const auto buffer_size = context . db_get_i64 ( iter , nullptr , 0 ) ; <nl> + bytes value ( buffer_size ) ; <nl> + <nl> + const auto written_size = context . db_get_i64 ( iter , value . data ( ) , buffer_size ) ; <nl> + assert ( written_size = = buffer_size ) ; <nl> + <nl> + return get_abi_serializer ( ) . binary_to_variant ( " pending_recovery " , value ) ; <nl> + } <nl> + <nl> + return optional < variant_object > ( ) ; <nl> + } <nl> + <nl> + static auto get_account_creation ( const apply_context & context , const account_name & account ) { <nl> + auto const & accnt = context . db . get < account_object , by_name > ( account ) ; <nl> + return ( time_point ) accnt . creation_date ; <nl> + } ; <nl> + <nl> + static auto get_permission_last_used ( const apply_context & context , const account_name & account , const permission_name & permission ) { <nl> + auto const * perm = context . db . find < permission_usage_object , by_account_permission > ( boost : : make_tuple ( account , permission ) ) ; <nl> + if ( perm ) { <nl> + return optional < time_point > ( perm - > last_used ) ; <nl> + } <nl> + <nl> + return optional < time_point > ( ) ; <nl> + } ; <nl> + <nl> + void apply_eosio_postrecovery ( apply_context & context ) { <nl> + context . require_write_lock ( config : : eosio_auth_scope ) ; <nl> + <nl> + FC_ASSERT ( context . act . authorization . size ( ) = = 1 , " Recovery Message must have exactly one authorization " ) ; <nl> + <nl> + auto recover_act = context . act . data_as < postrecovery > ( ) ; <nl> + const auto & auth = context . act . authorization . front ( ) ; <nl> + const auto & account = recover_act . account ; <nl> + context . require_write_lock ( account ) ; <nl> + <nl> + FC_ASSERT ( ! get_pending_recovery ( context , account ) , " Account $ { account } already has a pending recovery request ! " , ( " account " , account ) ) ; <nl> + <nl> + fc : : microseconds delay_lock ; <nl> + auto now = context . controller . head_block_time ( ) ; <nl> + if ( auth . actor = = account & & auth . permission = = N ( active ) ) { <nl> + / / process owner recovery from active <nl> + delay_lock = fc : : days ( 30 ) ; <nl> + } else { <nl> + / / process lost password <nl> + <nl> + auto owner_last_used = get_permission_last_used ( context , account , N ( owner ) ) ; <nl> + auto active_last_used = get_permission_last_used ( context , account , N ( active ) ) ; <nl> + <nl> + if ( ! owner_last_used | | ! active_last_used ) { <nl> + auto account_creation = get_account_creation ( context , account ) ; <nl> + if ( ! owner_last_used ) { <nl> + owner_last_used . emplace ( account_creation ) ; <nl> + } <nl> + <nl> + if ( ! active_last_used ) { <nl> + active_last_used . emplace ( account_creation ) ; <nl> + } <nl> + } <nl> + <nl> + FC_ASSERT ( * owner_last_used < = now - fc : : days ( 30 ) , " Account $ { account } has had owner key activity recently and cannot be recovered yet ! " , ( " account " , account ) ) ; <nl> + FC_ASSERT ( * active_last_used < = now - fc : : days ( 30 ) , " Account $ { account } has had active key activity recently and cannot be recovered yet ! " , ( " account " , account ) ) ; <nl> + <nl> + delay_lock = fc : : days ( 7 ) ; <nl> + } <nl> + <nl> + variant update ; <nl> + fc : : to_variant ( updateauth { <nl> + . account = account , <nl> + . permission = N ( owner ) , <nl> + . parent = 0 , <nl> + . data = recover_act . data <nl> + } , update ) ; <nl> + <nl> + const uint128_t request_id = context . controller . transaction_id_to_sender_id ( context . trx_meta . id ) ; <nl> + auto record_data = mutable_variant_object ( ) <nl> + ( " account " , account ) <nl> + ( " request_id " , request_id ) <nl> + ( " update " , update ) <nl> + ( " memo " , recover_act . memo ) ; <nl> + <nl> + deferred_transaction dtrx ; <nl> + dtrx . sender = config : : system_account_name ; <nl> + dtrx . sender_id = request_id ; <nl> + dtrx . payer = config : : system_account_name ; / / NOTE : we pre - reserve capacity for this during create account <nl> + dtrx . region = 0 ; <nl> + dtrx . execute_after = context . controller . head_block_time ( ) + delay_lock ; <nl> + dtrx . set_reference_block ( context . controller . head_block_id ( ) ) ; <nl> + dtrx . expiration = dtrx . execute_after + fc : : seconds ( 60 ) ; <nl> + dtrx . actions . emplace_back ( vector < permission_level > { { account , config : : active_name } } , <nl> + passrecovery { account } ) ; <nl> + <nl> + context . execute_deferred ( std : : move ( dtrx ) ) ; <nl> + <nl> + auto data = get_abi_serializer ( ) . variant_to_binary ( " pending_recovery " , record_data ) ; <nl> + const uint64_t id = account ; <nl> + const uint64_t table = N ( recovery ) ; <nl> + const auto payer = account ; <nl> + <nl> + const auto iter = context . db_find_i64 ( config : : system_account_name , account , table , id ) ; <nl> + if ( iter = = - 1 ) { <nl> + context . db_store_i64 ( account , table , payer , id , ( const char * ) data . data ( ) , data . size ( ) ) ; <nl> + } else { <nl> + context . db_update_i64 ( iter , payer , ( const char * ) data . data ( ) , data . size ( ) ) ; <nl> + } <nl> + <nl> + context . console_append_formatted ( " Recovery Started for account $ { account } : $ { memo } \ n " , mutable_variant_object ( ) ( " account " , account ) ( " memo " , recover_act . memo ) ) ; <nl> + } <nl> + <nl> + static void remove_pending_recovery ( apply_context & context , const account_name & account ) { <nl> + const auto iter = context . db_find_i64 ( config : : system_account_name , account , N ( recovery ) , account ) ; <nl> + if ( iter ! = - 1 ) { <nl> + context . db_remove_i64 ( iter ) ; <nl> + } <nl> + } <nl> + <nl> + void apply_eosio_passrecovery ( apply_context & context ) { <nl> + auto pass_act = context . act . data_as < passrecovery > ( ) ; <nl> + const auto & account = pass_act . account ; <nl> + <nl> + / / ensure this is only processed if it is a deferred transaction from the system account <nl> + FC_ASSERT ( context . trx_meta . sender & & * context . trx_meta . sender = = config : : system_account_name ) ; <nl> + context . require_authorization ( account ) ; <nl> + <nl> + auto maybe_recovery = get_pending_recovery ( context , account ) ; <nl> + FC_ASSERT ( maybe_recovery , " No pending recovery found for account $ { account } " , ( " account " , account ) ) ; <nl> + auto recovery = * maybe_recovery ; <nl> + <nl> + updateauth update ; <nl> + fc : : from_variant ( recovery [ " update " ] , update ) ; <nl> + <nl> + action act ( vector < permission_level > { { account , config : : owner_name } } , update ) ; <nl> + context . execute_inline ( move ( act ) ) ; <nl> + <nl> + remove_pending_recovery ( context , account ) ; <nl> + context . console_append_formatted ( " Account $ { account } successfully recovered ! \ n " , mutable_variant_object ( ) ( " account " , account ) ) ; <nl> + } <nl> + <nl> + void apply_eosio_vetorecovery ( apply_context & context ) { <nl> + context . require_write_lock ( config : : eosio_auth_scope ) ; <nl> + auto pass_act = context . act . data_as < vetorecovery > ( ) ; <nl> + const auto & account = pass_act . account ; <nl> + context . require_authorization ( account ) ; <nl> + <nl> + auto maybe_recovery = get_pending_recovery ( context , account ) ; <nl> + FC_ASSERT ( maybe_recovery , " No pending recovery found for account $ { account } " , ( " account " , account ) ) ; <nl> + auto recovery = * maybe_recovery ; <nl> + <nl> + context . cancel_deferred ( recovery [ " request_id " ] . as < uint128_t > ( ) ) ; <nl> + <nl> + remove_pending_recovery ( context , account ) ; <nl> + context . console_append_formatted ( " Recovery for account $ { account } vetoed ! \ n " , mutable_variant_object ( ) ( " account " , account ) ) ; <nl> + } <nl> + <nl> + void apply_eosio_canceldelay ( apply_context & context ) { <nl> + auto cancel = context . act . data_as < canceldelay > ( ) ; <nl> + const auto & trx_id = cancel . trx_id ; <nl> + <nl> + const auto & generated_transaction_idx = context . controller . get_database ( ) . get_index < generated_transaction_multi_index > ( ) ; <nl> + const auto & generated_index = generated_transaction_idx . indices ( ) . get < by_trx_id > ( ) ; <nl> + const auto & itr = generated_index . lower_bound ( trx_id ) ; <nl> + FC_ASSERT ( itr ! = generated_index . end ( ) & & itr - > sender = = config : : system_account_name & & itr - > trx_id = = trx_id , <nl> + " cannot cancel trx_id = $ { tid } , there is no deferred transaction with that transaction id " , ( " tid " , trx_id ) ) ; <nl> + <nl> + auto dtrx = fc : : raw : : unpack < deferred_transaction > ( itr - > packed_trx . data ( ) , itr - > packed_trx . size ( ) ) ; <nl> + set < account_name > accounts ; <nl> + for ( const auto & act : dtrx . actions ) { <nl> + for ( const auto & auth : act . authorization ) { <nl> + accounts . insert ( auth . actor ) ; <nl> + } <nl> + } <nl> + <nl> + bool found = false ; <nl> + for ( const auto & auth : context . act . authorization ) { <nl> + if ( auth . permission = = config : : active_name & & accounts . count ( auth . actor ) ) { <nl> + found = true ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + FC_ASSERT ( found , " canceldelay action must be signed with the \ " active \ " permission for one of the actors " <nl> + " provided in the authorizations on the original transaction " ) ; <nl> + <nl> + context . cancel_deferred ( context . controller . transaction_id_to_sender_id ( trx_id ) ) ; <nl> + } <nl> + <nl> + } } } / / namespace eosio : : chain : : contracts <nl> mmm a / libraries / chain / fork_database . cpp <nl> ppp b / libraries / chain / fork_database . cpp <nl> namespace eosio { namespace chain { <nl> fc : : raw : : pack ( out , my - > head - > id ) ; <nl> else <nl> fc : : raw : : pack ( out , block_id_type ( ) ) ; <nl> + idump ( ( states . size ( ) ) ) ; <nl> } <nl> <nl> void fork_database : : set ( block_state_ptr s ) { <nl> namespace eosio { namespace chain { <nl> } else { <nl> / / / remove older than irreversible and mark block as valid <nl> h - > validated = true ; <nl> - / * <nl> - auto & idx = my - > index . get < by_block_num > ( ) ; <nl> - for ( auto itr = idx . begin ( ) ; itr ! = idx . end ( ) ; + + itr ) { <nl> - if ( ( * itr ) - > block_num < h - > dpos_last_irreversible_blocknum ) { <nl> - / / / TODO : if block is part of head chain , then emit irreversible , we don ' t <nl> - / / / currently have an easy way to track which blocks are part of the head chain , <nl> - / / / to implement that we would need to track every time the head changes and update <nl> - / / / all blocks not on the head . <nl> - idx . erase ( itr ) ; <nl> - itr = idx . begin ( ) ; <nl> - } else { <nl> - break ; <nl> - } <nl> - } <nl> - * / <nl> } <nl> } <nl> + void fork_database : : prune ( const block_state_ptr & h ) { <nl> + auto num = h - > block_num ; <nl> + <nl> + auto itr = my - > index . find ( h - > id ) ; <nl> + if ( itr ! = my - > index . end ( ) ) <nl> + my - > index . erase ( itr ) ; <nl> + <nl> + auto & numidx = my - > index . get < by_block_num > ( ) ; <nl> + auto nitr = numidx . find ( num ) ; <nl> + if ( nitr ! = numidx . end ( ) ) { <nl> + remove ( ( * nitr ) - > id ) ; <nl> + } <nl> + } <nl> + <nl> <nl> block_state_ptr fork_database : : get_block ( const block_id_type & id ) const { <nl> auto itr = my - > index . find ( id ) ; <nl> mmm a / libraries / chain / include / eosio / chain / controller . hpp <nl> ppp b / libraries / chain / include / eosio / chain / controller . hpp <nl> namespace eosio { namespace chain { <nl> using chainbase : : database ; <nl> using boost : : signals2 : : signal ; <nl> <nl> + class dynamic_global_property_object ; <nl> + class permission_object ; <nl> + <nl> class controller { <nl> public : <nl> struct config { <nl> namespace eosio { namespace chain { <nl> void sign_block ( std : : function < signature_type ( const digest_type & ) > signer_callback ) ; <nl> void commit_block ( ) ; <nl> void log_irreversible_blocks ( ) ; <nl> + void pop_block ( ) ; <nl> <nl> void push_block ( const signed_block_ptr & b ) ; <nl> <nl> namespace eosio { namespace chain { <nl> uint64_t next_auth_sequence ( account_name actor ) ; <nl> void record_transaction ( const transaction_metadata_ptr & trx ) ; <nl> <nl> + const dynamic_global_property_object & get_dynamic_global_properties ( ) const ; <nl> + const permission_object & get_permission ( const permission_level & level ) const ; <nl> + <nl> + block_id_type head_block_id ( ) const ; <nl> + account_name head_block_producer ( ) const ; <nl> + const block_header & head_block_header ( ) const ; <nl> + <nl> + uint32_t last_irreversible_block_num ( ) const ; <nl> + <nl> / * <nl> signal < void ( ) > pre_apply_block ; <nl> signal < void ( ) > post_apply_block ; <nl> new file mode 100644 <nl> index 0000000000 . . e6d83d54d1 <nl> mmm / dev / null <nl> ppp b / libraries / chain / include / eosio / chain / eosio_contract . hpp <nl> <nl> + / * * <nl> + * @ file <nl> + * @ copyright defined in eos / LICENSE . txt <nl> + * / <nl> + # pragma once <nl> + <nl> + # include < eosio / chain / types . hpp > <nl> + <nl> + namespace eosio { namespace chain { <nl> + <nl> + class apply_context ; <nl> + <nl> + / * * <nl> + * @ defgroup native_action_handlers Native Action Handlers <nl> + * / <nl> + / / / @ { <nl> + void apply_eosio_newaccount ( apply_context & ) ; <nl> + void apply_eosio_updateauth ( apply_context & ) ; <nl> + void apply_eosio_deleteauth ( apply_context & ) ; <nl> + void apply_eosio_linkauth ( apply_context & ) ; <nl> + void apply_eosio_unlinkauth ( apply_context & ) ; <nl> + <nl> + void apply_eosio_postrecovery ( apply_context & ) ; <nl> + void apply_eosio_passrecovery ( apply_context & ) ; <nl> + void apply_eosio_vetorecovery ( apply_context & ) ; <nl> + <nl> + void apply_eosio_setcode ( apply_context & ) ; <nl> + void apply_eosio_setabi ( apply_context & ) ; <nl> + <nl> + void apply_eosio_onerror ( apply_context & ) ; <nl> + <nl> + void apply_eosio_canceldelay ( apply_context & ) ; <nl> + / / / @ } end action handlers <nl> + <nl> + } } / / / namespace eosio : : chain <nl> mmm a / libraries / chain / include / eosio / chain / fork_database . hpp <nl> ppp b / libraries / chain / include / eosio / chain / fork_database . hpp <nl> namespace eosio { namespace chain { <nl> * than the LIB are pruned after emitting irreversible signal . <nl> * / <nl> void set_validity ( const block_state_ptr & h , bool valid ) ; <nl> + void prune ( const block_state_ptr & h ) ; <nl> <nl> / * * <nl> * This signal is emited when a block state becomes irreversible , once irreversible <nl> mmm a / libraries / chain / include / eosio / chain / global_property_object . hpp <nl> ppp b / libraries / chain / include / eosio / chain / global_property_object . hpp <nl> namespace eosio { namespace chain { <nl> * / <nl> class global_property_object : public chainbase : : object < global_property_object_type , global_property_object > <nl> { <nl> - OBJECT_CTOR ( global_property_object , ( active_producers ) ( new_active_producers ) ( pending_active_producers ) ) <nl> + OBJECT_CTOR ( global_property_object ) <nl> <nl> id_type id ; <nl> chain_config configuration ; <nl> - shared_producer_schedule_type active_producers ; <nl> - shared_producer_schedule_type new_active_producers ; <nl> - <nl> - / * * every block that has change in producer schedule gets inserted into this list , this includes <nl> - * all blocks that see a change in producer signing keys or vote order . <nl> - * <nl> - * TODO : consider moving this to a more effeicent datatype <nl> - * / <nl> - shared_vector < blocknum_producer_schedule > pending_active_producers ; <nl> } ; <nl> <nl> <nl> namespace eosio { namespace chain { <nl> * / <nl> class dynamic_global_property_object : public chainbase : : object < dynamic_global_property_object_type , dynamic_global_property_object > <nl> { <nl> - OBJECT_CTOR ( dynamic_global_property_object , ( block_merkle_root ) ) <nl> - <nl> - id_type id ; <nl> - uint32_t head_block_number = 0 ; <nl> - block_id_type head_block_id ; <nl> - time_point time ; <nl> - account_name current_producer ; <nl> - <nl> - / * * <nl> - * The current absolute slot number . Equal to the total <nl> - * number of slots since genesis . Also equal to the total <nl> - * number of missed slots plus head_block_number . <nl> - * / <nl> - uint64_t current_absolute_slot = 0 ; <nl> - <nl> - / * * <nl> - * Bitmap used to compute producer participation . Stores <nl> - * a high bit for each generated block , a low bit for <nl> - * each missed block . Least significant bit is most <nl> - * recent block . <nl> - * <nl> - * NOTE : This bitmap always excludes the head block , <nl> - * which , by definition , exists . The least significant <nl> - * bit corresponds to the block with number <nl> - * head_block_num ( ) - 1 <nl> - * <nl> - * e . g . if the least significant 5 bits were 10011 , it <nl> - * would indicate that the last two blocks prior to the <nl> - * head block were produced , the two before them were <nl> - * missed , and the one before that was produced . <nl> - * / <nl> - / / uint64_t recent_slots_filled ; <nl> - <nl> - uint32_t last_irreversible_block_num = 0 ; <nl> - <nl> - / * * <nl> - * Used to calculate the merkle root over all blocks <nl> - * / <nl> - shared_incremental_merkle block_merkle_root ; <nl> + OBJECT_CTOR ( dynamic_global_property_object ) <nl> + <nl> + id_type id ; <nl> + uint64_t global_action_sequence = 0 ; <nl> } ; <nl> <nl> using global_property_multi_index = chainbase : : shared_multi_index_container < <nl> CHAINBASE_SET_INDEX_TYPE ( eosio : : chain : : dynamic_global_property_object , <nl> eosio : : chain : : dynamic_global_property_multi_index ) <nl> <nl> FC_REFLECT ( eosio : : chain : : dynamic_global_property_object , <nl> - ( head_block_number ) <nl> - ( head_block_id ) <nl> - ( time ) <nl> - ( current_producer ) <nl> - ( current_absolute_slot ) <nl> - / * ( recent_slots_filled ) * / <nl> - ( last_irreversible_block_num ) <nl> + ( global_action_sequence ) <nl> ) <nl> <nl> FC_REFLECT ( eosio : : chain : : global_property_object , <nl> ( configuration ) <nl> - ( active_producers ) <nl> ) <nl> mmm a / libraries / chain / main . cpp <nl> ppp b / libraries / chain / main . cpp <nl> int main ( int argc , char * * argv ) { <nl> try { try { <nl> controller c ( { . shared_memory_size = 8 * 1024 * 1024 , . block_log_dir = " c1dir " , . shared_memory_dir = " c1dir " } ) ; <nl> <nl> - / / controller c2 ( { . shared_memory_size = 8 * 1024 * 1024 , . shared_memory_dir = " c2dir " , . block_log_dir = " c2dir " } ) ; <nl> + controller c2 ( { . shared_memory_size = 8 * 1024 * 1024 , . shared_memory_dir = " c2dir " , . block_log_dir = " c2dir " } ) ; <nl> <nl> for ( uint32_t i = 0 ; i < 4 ; + + i ) { <nl> c . start_block ( ) ; <nl> int main ( int argc , char * * argv ) { <nl> c . log_irreversible_blocks ( ) ; <nl> <nl> ilog ( " \ n START CLONE " ) ; <nl> - / / c2 . push_block ( c . head_block_state ( ) - > block ) ; <nl> - / / c2 . log_irreversible_blocks ( ) ; <nl> - / / idump ( ( c2 . head_block_state ( ) - > header . id ( ) ) ( c2 . head_block_state ( ) - > block_num ) ) ; <nl> + c2 . push_block ( c . head_block_state ( ) - > block ) ; <nl> + c2 . log_irreversible_blocks ( ) ; <nl> + idump ( ( c2 . head_block_state ( ) - > header . id ( ) ) ( c2 . head_block_state ( ) - > block_num ) ) ; <nl> ilog ( " \ n END CLONE \ n " ) ; <nl> } <nl> <nl>
|
progress
|
EOSIO/eos
|
79942e857bbf508d9bfe2da2b3e549f92e683b56
|
2018-04-14T21:37:26Z
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.