diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / modules / mono / mono_gd / gd_mono . cpp <nl> ppp b / modules / mono / mono_gd / gd_mono . cpp <nl> bool GDMono : : _load_core_api_assembly ( ) { <nl> <nl> # ifdef TOOLS_ENABLED <nl> / / For the editor and the editor player we want to load it from a specific path to make sure we can keep it up to date <nl> - String assembly_path = GodotSharpDirs : : get_res_assemblies_dir ( ) . plus_file ( CORE_API_ASSEMBLY_NAME " . dll " ) ; <nl> + <nl> + / / If running the project manager , load it from the prebuilt API directory <nl> + String assembly_dir = ! Main : : is_project_manager ( ) ? <nl> + GodotSharpDirs : : get_res_assemblies_dir ( ) : <nl> + GodotSharpDirs : : get_data_editor_prebuilt_api_dir ( ) . plus_file ( " Debug " ) ; <nl> + <nl> + String assembly_path = assembly_dir . plus_file ( CORE_API_ASSEMBLY_NAME " . dll " ) ; <nl> + <nl> bool success = FileAccess : : exists ( assembly_path ) & & <nl> load_assembly_from ( CORE_API_ASSEMBLY_NAME , assembly_path , & core_api_assembly ) ; <nl> # else <nl> bool GDMono : : _load_editor_api_assembly ( ) { <nl> return true ; <nl> <nl> / / For the editor and the editor player we want to load it from a specific path to make sure we can keep it up to date <nl> - String assembly_path = GodotSharpDirs : : get_res_assemblies_dir ( ) . plus_file ( EDITOR_API_ASSEMBLY_NAME " . dll " ) ; <nl> + <nl> + / / If running the project manager , load it from the prebuilt API directory <nl> + String assembly_dir = ! Main : : is_project_manager ( ) ? <nl> + GodotSharpDirs : : get_res_assemblies_dir ( ) : <nl> + GodotSharpDirs : : get_data_editor_prebuilt_api_dir ( ) . plus_file ( " Debug " ) ; <nl> + <nl> + String assembly_path = assembly_dir . plus_file ( EDITOR_API_ASSEMBLY_NAME " . dll " ) ; <nl> + <nl> bool success = FileAccess : : exists ( assembly_path ) & & <nl> load_assembly_from ( EDITOR_API_ASSEMBLY_NAME , assembly_path , & editor_api_assembly ) ; <nl> <nl> void GDMono : : _load_api_assemblies ( ) { <nl> / / The API assemblies are out of sync . Fine , try one more time , but this time <nl> / / update them from the prebuilt assemblies directory before trying to load them . <nl> <nl> + / / Shouldn ' t happen . The project manager loads the prebuilt API assemblies <nl> + if ( Main : : is_project_manager ( ) ) { <nl> + ERR_EXPLAIN ( " Failed to load one of the prebuilt API assemblies " ) ; <nl> + CRASH_NOW ( ) ; <nl> + } <nl> + <nl> / / 1 . Unload the scripts domain <nl> if ( _unload_scripts_domain ( ) ! = OK ) { <nl> ERR_EXPLAIN ( " Mono : Failed to unload scripts domain " ) ; <nl>
|
Mono : Don ' t try to update project assemblies from project manager
|
godotengine/godot
|
c9befa63d2259738c3802608fc3fb0859c9a0ee7
|
2019-07-25T15:52:45Z
|
mmm a / dbms / tests / queries / 0_stateless / 00634_performance_introspection_and_logging . sh <nl> ppp b / dbms / tests / queries / 0_stateless / 00634_performance_introspection_and_logging . sh <nl> SELECT <nl> - - duration , threads_realtime , threads_time_user_system_io , <nl> threads_realtime > = 0 . 99 * duration , <nl> threads_realtime > = threads_time_user_system_io , <nl> - any ( length ( thread_numbers ) ) > = 1 <nl> + any ( length ( thread_ids ) ) > = 1 <nl> FROM <nl> ( SELECT * FROM system . query_log PREWHERE query = ' $ heavy_cpu_query ' WHERE event_date > = today ( ) - 1 AND type = 2 ORDER BY event_time DESC LIMIT 1 ) <nl> ARRAY JOIN ProfileEvents . Names AS PN , ProfileEvents . Values AS PV " <nl> $ CLICKHOUSE_CLIENT $ settings - - max_threads = 3 - q " $ heavy_cpu_query " <nl> $ CLICKHOUSE_CLIENT $ settings - q " SYSTEM FLUSH LOGS " <nl> query_id = ` $ CLICKHOUSE_CLIENT $ settings - q " SELECT query_id FROM system . query_log WHERE event_date > = today ( ) - 1 AND type = 2 AND query = ' $ heavy_cpu_query ' ORDER BY event_time DESC LIMIT 1 " ` <nl> query_elapsed = ` $ CLICKHOUSE_CLIENT $ settings - q " SELECT query_duration_ms * 1000 FROM system . query_log WHERE event_date > = today ( ) - 1 AND type = 2 AND query_id = ' $ query_id ' ORDER BY event_time DESC LIMIT 1 " ` <nl> - threads = ` $ CLICKHOUSE_CLIENT $ settings - q " SELECT length ( thread_numbers ) FROM system . query_log WHERE event_date > = today ( ) - 1 AND type = 2 AND query_id = ' $ query_id ' ORDER BY event_time DESC LIMIT 1 " ` <nl> + threads = ` $ CLICKHOUSE_CLIENT $ settings - q " SELECT length ( thread_ids ) FROM system . query_log WHERE event_date > = today ( ) - 1 AND type = 2 AND query_id = ' $ query_id ' ORDER BY event_time DESC LIMIT 1 " ` <nl> <nl> $ CLICKHOUSE_CLIENT $ settings - q " <nl> SELECT <nl> - - max ( thread_realtime ) , $ query_elapsed , max ( thread_time_user_system_io ) , <nl> 0 . 9 * $ query_elapsed < = max ( thread_realtime ) AND max ( thread_realtime ) < = 1 . 1 * $ query_elapsed , <nl> 0 . 7 * $ query_elapsed < = max ( thread_time_user_system_io ) AND max ( thread_time_user_system_io ) < = 1 . 3 * $ query_elapsed , <nl> - uniqExact ( thread_number ) = $ threads <nl> + uniqExact ( thread_id ) = $ threads <nl> FROM <nl> ( <nl> SELECT <nl> - thread_number , <nl> + thread_id , <nl> sumIf ( PV , PN = ' RealTimeMicroseconds ' ) AS thread_realtime , <nl> sumIf ( PV , PN IN ( ' UserTimeMicroseconds ' , ' SystemTimeMicroseconds ' , ' OSIOWaitMicroseconds ' , ' OSCPUWaitMicroseconds ' ) ) AS thread_time_user_system_io <nl> FROM <nl> ( SELECT * FROM system . query_thread_log PREWHERE query_id = ' $ query_id ' WHERE event_date > = today ( ) - 1 ) <nl> ARRAY JOIN ProfileEvents . Names AS PN , ProfileEvents . Values AS PV <nl> - GROUP BY thread_number <nl> + GROUP BY thread_id <nl> ) <nl> " <nl> <nl>
|
Updated test
|
ClickHouse/ClickHouse
|
5feb40cb6fbf294eee86c3e94f0df7b0815163cc
|
2020-02-02T19:49:53Z
|
mmm a / db / db_impl / db_impl . cc <nl> ppp b / db / db_impl / db_impl . cc <nl> bool DBImpl : : GetIntPropertyInternal ( ColumnFamilyData * cfd , <nl> } <nl> } else { <nl> SuperVersion * sv = nullptr ; <nl> - if ( ! is_locked ) { <nl> - sv = GetAndRefSuperVersion ( cfd ) ; <nl> - } else { <nl> - sv = cfd - > GetSuperVersion ( ) ; <nl> + if ( is_locked ) { <nl> + mutex_ . Unlock ( ) ; <nl> } <nl> + sv = GetAndRefSuperVersion ( cfd ) ; <nl> <nl> bool ret = cfd - > internal_stats ( ) - > GetIntPropertyOutOfMutex ( <nl> property_info , sv - > current , value ) ; <nl> <nl> - if ( ! is_locked ) { <nl> - ReturnAndCleanupSuperVersion ( cfd , sv ) ; <nl> + ReturnAndCleanupSuperVersion ( cfd , sv ) ; <nl> + if ( is_locked ) { <nl> + mutex_ . Lock ( ) ; <nl> } <nl> <nl> return ret ; <nl> bool DBImpl : : GetAggregatedIntProperty ( const Slice & property , <nl> } <nl> <nl> uint64_t sum = 0 ; <nl> + bool ret = true ; <nl> { <nl> / / Needs mutex to protect the list of column families . <nl> InstrumentedMutexLock l ( & mutex_ ) ; <nl> bool DBImpl : : GetAggregatedIntProperty ( const Slice & property , <nl> if ( ! cfd - > initialized ( ) ) { <nl> continue ; <nl> } <nl> - if ( GetIntPropertyInternal ( cfd , * property_info , true , & value ) ) { <nl> + cfd - > Ref ( ) ; <nl> + ret = GetIntPropertyInternal ( cfd , * property_info , true , & value ) ; <nl> + / / GetIntPropertyInternal may release db mutex and re - acquire it . <nl> + mutex_ . AssertHeld ( ) ; <nl> + cfd - > UnrefAndTryDelete ( ) ; <nl> + if ( ret ) { <nl> sum + = value ; <nl> } else { <nl> - return false ; <nl> + ret = false ; <nl> + break ; <nl> } <nl> } <nl> } <nl> * aggregated_value = sum ; <nl> - return true ; <nl> + return ret ; <nl> } <nl> <nl> SuperVersion * DBImpl : : GetAndRefSuperVersion ( ColumnFamilyData * cfd ) { <nl>
|
Allow mutex to be released in GetAggregatedIntProperty ( )
|
facebook/rocksdb
|
cd72f8974bfe81497f5fb94ea14623246f320d1a
|
2020-09-22T19:37:16Z
|
mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> struct COrphanBlock { <nl> map < uint256 , COrphanBlock * > mapOrphanBlocks ; <nl> multimap < uint256 , COrphanBlock * > mapOrphanBlocksByPrev ; <nl> <nl> - map < uint256 , CTransaction > mapOrphanTransactions ; <nl> + struct COrphanTx { <nl> + CTransaction tx ; <nl> + NodeId fromPeer ; <nl> + } ; <nl> + map < uint256 , COrphanTx > mapOrphanTransactions ; <nl> map < uint256 , set < uint256 > > mapOrphanTransactionsByPrev ; <nl> + void EraseOrphansFor ( NodeId peer ) ; <nl> <nl> / / Constant stuff for coinbase transactions we create : <nl> CScript COINBASE_FLAGS ; <nl> void FinalizeNode ( NodeId nodeid ) { <nl> mapBlocksInFlight . erase ( entry . hash ) ; <nl> BOOST_FOREACH ( const uint256 & hash , state - > vBlocksToDownload ) <nl> mapBlocksToDownload . erase ( hash ) ; <nl> + EraseOrphansFor ( nodeid ) ; <nl> <nl> mapNodeState . erase ( nodeid ) ; <nl> } <nl> CBlockTreeDB * pblocktree = NULL ; <nl> / / mapOrphanTransactions <nl> / / <nl> <nl> - bool AddOrphanTx ( const CTransaction & tx ) <nl> + bool AddOrphanTx ( const CTransaction & tx , NodeId peer ) <nl> { <nl> uint256 hash = tx . GetHash ( ) ; <nl> if ( mapOrphanTransactions . count ( hash ) ) <nl> bool AddOrphanTx ( const CTransaction & tx ) <nl> return false ; <nl> } <nl> <nl> - mapOrphanTransactions [ hash ] = tx ; <nl> + mapOrphanTransactions [ hash ] . tx = tx ; <nl> + mapOrphanTransactions [ hash ] . fromPeer = peer ; <nl> BOOST_FOREACH ( const CTxIn & txin , tx . vin ) <nl> mapOrphanTransactionsByPrev [ txin . prevout . hash ] . insert ( hash ) ; <nl> <nl> - LogPrint ( " mempool " , " stored orphan tx % s ( mapsz % u ) \ n " , hash . ToString ( ) , <nl> - mapOrphanTransactions . size ( ) ) ; <nl> + LogPrint ( " mempool " , " stored orphan tx % s ( mapsz % u prevsz % u ) \ n " , hash . ToString ( ) , <nl> + mapOrphanTransactions . size ( ) , mapOrphanTransactionsByPrev . size ( ) ) ; <nl> return true ; <nl> } <nl> <nl> void static EraseOrphanTx ( uint256 hash ) <nl> { <nl> - map < uint256 , CTransaction > : : iterator it = mapOrphanTransactions . find ( hash ) ; <nl> + map < uint256 , COrphanTx > : : iterator it = mapOrphanTransactions . find ( hash ) ; <nl> if ( it = = mapOrphanTransactions . end ( ) ) <nl> return ; <nl> - BOOST_FOREACH ( const CTxIn & txin , it - > second . vin ) <nl> + BOOST_FOREACH ( const CTxIn & txin , it - > second . tx . vin ) <nl> { <nl> map < uint256 , set < uint256 > > : : iterator itPrev = mapOrphanTransactionsByPrev . find ( txin . prevout . hash ) ; <nl> if ( itPrev = = mapOrphanTransactionsByPrev . end ( ) ) <nl> void static EraseOrphanTx ( uint256 hash ) <nl> mapOrphanTransactions . erase ( it ) ; <nl> } <nl> <nl> + void EraseOrphansFor ( NodeId peer ) <nl> + { <nl> + int nErased = 0 ; <nl> + map < uint256 , COrphanTx > : : iterator iter = mapOrphanTransactions . begin ( ) ; <nl> + while ( iter ! = mapOrphanTransactions . end ( ) ) <nl> + { <nl> + map < uint256 , COrphanTx > : : iterator maybeErase = iter + + ; / / increment to avoid iterator becoming invalid <nl> + if ( maybeErase - > second . fromPeer = = peer ) <nl> + { <nl> + EraseOrphanTx ( maybeErase - > second . tx . GetHash ( ) ) ; <nl> + + + nErased ; <nl> + } <nl> + } <nl> + if ( nErased > 0 ) LogPrint ( " mempool " , " Erased % d orphan tx from peer % d \ n " , nErased , peer ) ; <nl> + } <nl> + <nl> + <nl> unsigned int LimitOrphanTxSize ( unsigned int nMaxOrphans ) <nl> { <nl> unsigned int nEvicted = 0 ; <nl> unsigned int LimitOrphanTxSize ( unsigned int nMaxOrphans ) <nl> { <nl> / / Evict a random orphan : <nl> uint256 randomhash = GetRandHash ( ) ; <nl> - map < uint256 , CTransaction > : : iterator it = mapOrphanTransactions . lower_bound ( randomhash ) ; <nl> + map < uint256 , COrphanTx > : : iterator it = mapOrphanTransactions . lower_bound ( randomhash ) ; <nl> if ( it = = mapOrphanTransactions . end ( ) ) <nl> it = mapOrphanTransactions . begin ( ) ; <nl> EraseOrphanTx ( it - > first ) ; <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv , <nl> mempool . mapTx . size ( ) ) ; <nl> <nl> / / Recursively process any orphan transactions that depended on this one <nl> + set < NodeId > setMisbehaving ; <nl> for ( unsigned int i = 0 ; i < vWorkQueue . size ( ) ; i + + ) <nl> { <nl> map < uint256 , set < uint256 > > : : iterator itByPrev = mapOrphanTransactionsByPrev . find ( vWorkQueue [ i ] ) ; <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv , <nl> + + mi ) <nl> { <nl> const uint256 & orphanHash = * mi ; <nl> - const CTransaction & orphanTx = mapOrphanTransactions [ orphanHash ] ; <nl> + const CTransaction & orphanTx = mapOrphanTransactions [ orphanHash ] . tx ; <nl> + NodeId fromPeer = mapOrphanTransactions [ orphanHash ] . fromPeer ; <nl> bool fMissingInputs2 = false ; <nl> / / Use a dummy CValidationState so someone can ' t setup nodes to counter - DoS based on orphan <nl> / / resolution ( that is , feeding people an invalid transaction based on LegitTxX in order to get <nl> / / anyone relaying LegitTxX banned ) <nl> CValidationState stateDummy ; <nl> <nl> + vEraseQueue . push_back ( orphanHash ) ; <nl> + <nl> + if ( setMisbehaving . count ( fromPeer ) ) <nl> + continue ; <nl> if ( AcceptToMemoryPool ( mempool , stateDummy , orphanTx , true , & fMissingInputs2 ) ) <nl> { <nl> LogPrint ( " mempool " , " accepted orphan tx % s \ n " , orphanHash . ToString ( ) ) ; <nl> RelayTransaction ( orphanTx ) ; <nl> mapAlreadyAskedFor . erase ( CInv ( MSG_TX , orphanHash ) ) ; <nl> vWorkQueue . push_back ( orphanHash ) ; <nl> - vEraseQueue . push_back ( orphanHash ) ; <nl> } <nl> else if ( ! fMissingInputs2 ) <nl> { <nl> - / / invalid or too - little - fee orphan <nl> - vEraseQueue . push_back ( orphanHash ) ; <nl> + int nDos = 0 ; <nl> + if ( stateDummy . IsInvalid ( nDos ) & & nDos > 0 ) <nl> + { <nl> + / / Punish peer that gave us an invalid orphan tx <nl> + Misbehaving ( fromPeer , nDos ) ; <nl> + setMisbehaving . insert ( fromPeer ) ; <nl> + LogPrint ( " mempool " , " invalid orphan tx % s \ n " , orphanHash . ToString ( ) ) ; <nl> + } <nl> + / / too - little - fee orphan <nl> LogPrint ( " mempool " , " removed orphan tx % s \ n " , orphanHash . ToString ( ) ) ; <nl> } <nl> mempool . check ( pcoinsTip ) ; <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv , <nl> } <nl> else if ( fMissingInputs ) <nl> { <nl> - AddOrphanTx ( tx ) ; <nl> + AddOrphanTx ( tx , pfrom - > GetId ( ) ) ; <nl> <nl> / / DoS prevention : do not allow mapOrphanTransactions to grow unbounded <nl> unsigned int nEvicted = LimitOrphanTxSize ( MAX_ORPHAN_TRANSACTIONS ) ; <nl> bool SendMessages ( CNode * pto , bool fSendTrickle ) <nl> if ( pto - > addr . IsLocal ( ) ) <nl> LogPrintf ( " Warning : not banning local peer % s ! \ n " , pto - > addr . ToString ( ) ) ; <nl> else <nl> + { <nl> CNode : : Ban ( pto - > addr ) ; <nl> + } <nl> } <nl> state . fShouldBan = false ; <nl> } <nl> class CMainCleanup <nl> <nl> / / orphan transactions <nl> mapOrphanTransactions . clear ( ) ; <nl> + mapOrphanTransactionsByPrev . clear ( ) ; <nl> } <nl> } instance_of_cmaincleanup ; <nl> mmm a / src / test / DoS_tests . cpp <nl> ppp b / src / test / DoS_tests . cpp <nl> <nl> # include < boost / test / unit_test . hpp > <nl> <nl> / / Tests this internal - to - main . cpp method : <nl> - extern bool AddOrphanTx ( const CTransaction & tx ) ; <nl> + extern bool AddOrphanTx ( const CTransaction & tx , NodeId peer ) ; <nl> + extern void EraseOrphansFor ( NodeId peer ) ; <nl> extern unsigned int LimitOrphanTxSize ( unsigned int nMaxOrphans ) ; <nl> extern std : : map < uint256 , CTransaction > mapOrphanTransactions ; <nl> extern std : : map < uint256 , std : : set < uint256 > > mapOrphanTransactionsByPrev ; <nl> BOOST_AUTO_TEST_CASE ( DoS_mapOrphans ) <nl> tx . vout [ 0 ] . nValue = 1 * CENT ; <nl> tx . vout [ 0 ] . scriptPubKey . SetDestination ( key . GetPubKey ( ) . GetID ( ) ) ; <nl> <nl> - AddOrphanTx ( tx ) ; <nl> + AddOrphanTx ( tx , i ) ; <nl> } <nl> <nl> / / . . . and 50 that depend on other orphans : <nl> BOOST_AUTO_TEST_CASE ( DoS_mapOrphans ) <nl> tx . vout [ 0 ] . scriptPubKey . SetDestination ( key . GetPubKey ( ) . GetID ( ) ) ; <nl> SignSignature ( keystore , txPrev , tx , 0 ) ; <nl> <nl> - AddOrphanTx ( tx ) ; <nl> + AddOrphanTx ( tx , i ) ; <nl> } <nl> <nl> / / This really - big orphan should be ignored : <nl> BOOST_AUTO_TEST_CASE ( DoS_mapOrphans ) <nl> for ( unsigned int j = 1 ; j < tx . vin . size ( ) ; j + + ) <nl> tx . vin [ j ] . scriptSig = tx . vin [ 0 ] . scriptSig ; <nl> <nl> - BOOST_CHECK ( ! AddOrphanTx ( tx ) ) ; <nl> + BOOST_CHECK ( ! AddOrphanTx ( tx , i ) ) ; <nl> + } <nl> + <nl> + / / Test EraseOrphansFor : <nl> + for ( NodeId i = 0 ; i < 3 ; i + + ) <nl> + { <nl> + size_t sizeBefore = mapOrphanTransactions . size ( ) ; <nl> + EraseOrphansFor ( i ) ; <nl> + BOOST_CHECK ( mapOrphanTransactions . size ( ) < sizeBefore ) ; <nl> } <nl> <nl> / / Test LimitOrphanTxSize ( ) function : <nl>
|
Stricter handling of orphan transactions
|
bitcoin/bitcoin
|
c74332c67806ed92e6e18de174671a7c30608780
|
2014-09-10T18:09:40Z
|
mmm a / tensorflow / tools / pip_package / MANIFEST . in <nl> ppp b / tensorflow / tools / pip_package / MANIFEST . in <nl> include LICENSE <nl> include README <nl> recursive - include * * . py <nl> recursive - include * * . pyd <nl> + recursive - include * * . pyi <nl> recursive - include * * . pd <nl> recursive - include * * . so <nl> recursive - include * * . so . [ 0 - 9 ] <nl> mmm a / tensorflow / tools / pip_package / build_pip_package . sh <nl> ppp b / tensorflow / tools / pip_package / build_pip_package . sh <nl> function prepare_src ( ) { <nl> <nl> rm - f $ { TMPDIR } / tensorflow / libtensorflow_framework . so <nl> rm - f $ { TMPDIR } / tensorflow / libtensorflow_framework . so . [ 0 - 9 ] . * <nl> + <nl> + # Create a keras / __init__ . pyi file so that autocomplete for imports <nl> + # such as ` from tensorflow . keras import losses ` works . <nl> + # TODO ( annarev ) : copy over API files from tensorflow / api / _vN to tensorflow / <nl> + # except tensorflow / api / _vN / lite / . <nl> + mkdir $ { TMPDIR } / tensorflow / keras / <nl> + if [ - d " $ { TMPDIR } / tensorflow / _api / v1 / " ] <nl> + then <nl> + echo " from tensorflow . python . keras . api . _v1 . keras import * " > $ { TMPDIR } / tensorflow / keras / __init__ . pyi <nl> + else <nl> + echo " from tensorflow . python . keras . api . _v2 . keras import * " > $ { TMPDIR } / tensorflow / keras / __init__ . pyi <nl> + fi <nl> } <nl> <nl> function build_wheel ( ) { <nl>
|
Add keras / __init__ . pyi stub so that imports of the form ` from tensorflow . keras
|
tensorflow/tensorflow
|
69f6601034942b018081715b31f6dd40111250af
|
2020-02-22T05:19:46Z
|
mmm a / tensorflow / lite / tools / make / Makefile <nl> ppp b / tensorflow / lite / tools / make / Makefile <nl> MINIMAL_SRCS : = \ <nl> # build files . <nl> <nl> PROFILER_SRCS : = \ <nl> + tensorflow / lite / profiling / memory_info . cc \ <nl> tensorflow / lite / profiling / time . cc <nl> + <nl> PROFILE_SUMMARIZER_SRCS : = \ <nl> tensorflow / lite / profiling / profile_summarizer . cc \ <nl> tensorflow / core / util / stats_calculator . cc <nl>
|
Fix TensorFlow Lite Makefile
|
tensorflow/tensorflow
|
63a2accd1870796d1ab82912f2b689717245873e
|
2019-10-25T22:43:23Z
|
mmm a / Marlin / ultralcd . cpp <nl> ppp b / Marlin / ultralcd . cpp <nl> static void lcd_main_menu ( ) { <nl> END_MENU ( ) ; <nl> } <nl> <nl> - # if ENABLED ( SDSUPPORT ) & & ENABLED ( MENU_ADDAUTOSTART ) <nl> - static void lcd_autostart_sd ( ) { <nl> - card . autostart_index = 0 ; <nl> - card . setroot ( ) ; <nl> - card . checkautostart ( true ) ; <nl> - } <nl> - # endif <nl> <nl> / * * <nl> * Set the home offset based on the current_position <nl> void lcd_cooldown ( ) { <nl> lcd_return_to_status ( ) ; <nl> } <nl> <nl> + # if ENABLED ( SDSUPPORT ) & & ENABLED ( MENU_ADDAUTOSTART ) <nl> + <nl> + static void lcd_autostart_sd ( ) { <nl> + card . autostart_index = 0 ; <nl> + card . setroot ( ) ; <nl> + card . checkautostart ( true ) ; <nl> + } <nl> + <nl> + # endif <nl> / * * <nl> * <nl> * " Prepare " submenu <nl>
|
Move lcd_autostart_sd to its logical place
|
MarlinFirmware/Marlin
|
6730408ec10b5dafbdc356c3b4d02f910d85b1d6
|
2016-04-03T23:27:29Z
|
mmm a / doc / productivity . md <nl> ppp b / doc / productivity . md <nl> Table of Contents <nl> * [ Multiple working directories with ` git worktrees ` ] ( # multiple - working - directories - with - git - worktrees ) <nl> * [ Interactive " dummy rebases " for fixups and execs with ` git merge - base ` ] ( # interactive - dummy - rebases - for - fixups - and - execs - with - git - merge - base ) <nl> * [ Writing code ] ( # writing - code ) <nl> - * [ Format C / C + + / Protobuf diffs with ` clang - format - diff . py ` ] ( # format - ccprotobuf - diffs - with - clang - format - diffpy ) <nl> + * [ Format C / C + + diffs with ` clang - format - diff . py ` ] ( # format - cc - diffs - with - clang - format - diffpy ) <nl> * [ Format Python diffs with ` yapf - diff . py ` ] ( # format - python - diffs - with - yapf - diffpy ) <nl> * [ Rebasing / Merging code ] ( # rebasingmerging - code ) <nl> * [ More conflict context with ` merge . conflictstyle diff3 ` ] ( # more - conflict - context - with - mergeconflictstyle - diff3 ) <nl> You can also set up [ upstream refspecs ] ( # reference - prs - easily - with - refspecs ) to <nl> Writing code <nl> mmmmmmmmmmmm <nl> <nl> - # # # Format C / C + + / Protobuf diffs with ` clang - format - diff . py ` <nl> + # # # Format C / C + + diffs with ` clang - format - diff . py ` <nl> <nl> See [ contrib / devtools / README . md ] ( / contrib / devtools / README . md # clang - format - diff . py ) . <nl> <nl> # # # Format Python diffs with ` yapf - diff . py ` <nl> <nl> - Usage is exactly the same as [ ` clang - format - diff . py ` ] ( # format - ccprotobuf - diffs - with - clang - format - diffpy ) . You can get it [ here ] ( https : / / github . com / MarcoFalke / yapf - diff ) . <nl> + Usage is exactly the same as [ ` clang - format - diff . py ` ] ( # format - cc - diffs - with - clang - format - diffpy ) . You can get it [ here ] ( https : / / github . com / MarcoFalke / yapf - diff ) . <nl> <nl> Rebasing / Merging code <nl> mmmmmmmmmmmm - <nl>
|
Merge : doc : Drop protobuf stuff
|
bitcoin/bitcoin
|
492cdc56e087c7f51f3d1e3f807191da7f9d9a07
|
2020-05-23T11:03:40Z
|
new file mode 100644 <nl> index 000000000000 . . 2b6627fe5b5f <nl> mmm / dev / null <nl> ppp b / docs / Cloneable . rst <nl> <nl> + = = = = = = = = = = <nl> + Clonable <nl> + = = = = = = = = = = <nl> + <nl> + * * Abstract : * * to better support the creation of value types , I propose <nl> + a “ magic ” ` Clonable ` protocol and an annotation for describing <nl> + which instance variables should be cloned when a type is copied . <nl> + <nl> + When a type with reference semantics ` ` R ` ` is to be used as a part of <nl> + ( versus merely being referred - to - by ) a type with value semantics ` ` V ` ` , <nl> + a new annotation , ` ` [ clone ] ` ` can be used to indicate that the ` ` R ` ` <nl> + instance variable should be ` ` clone ( ) ` ` \ d when ` ` V ` ` is copied . <nl> + <nl> + A ` ` class ` ` can be ` ` clone ( ) ` ` \ d when it implements the built - in ` ` Cloneable ` ` <nl> + protocol : : <nl> + <nl> + protocol Cloneable { <nl> + func clone ( ) - > This { / * see below * / } <nl> + } <nl> + <nl> + The implementation of ` ` clone ( ) ` ` ( which will be generated by the <nl> + compiler and typically never overridden ) performs a primitive copy of <nl> + all ordinary instance variables , and a ` ` clone ( ) ` ` of all instance <nl> + variables marked ` ` [ clone ] ` ` : : <nl> + <nl> + class FooValue : Cloneable { } <nl> + <nl> + class Bar { } <nl> + <nl> + class Foo : Cloneable { <nl> + var count : Int <nl> + var [ clone ] myValue : FooValue <nl> + var somethingIJustReferTo : Bar <nl> + } <nl> + <nl> + struct Baz { <nl> + var [ clone ] partOfMyValue : Foo <nl> + var anotherPart : Int <nl> + var somethingIJustReferTo : Bar <nl> + } <nl> + <nl> + When a ` ` Baz ` ` is copied by any of the “ big three ” operations ( variable <nl> + initialization , assignment , or function argument passing ) , even as <nl> + part of a larger ` ` struct ` ` , its ` ` [ clone ] ` ` member is ` ` clone ( ) ` ` \ d . <nl> + Because ` ` Foo ` ` itself has a ` ` [ clone ] ` ` member , that is ` ` clone ( ) ` ` \ d <nl> + also . Therfore copying a ` ` Baz ` ` object ` ` clone ( ) ` ` \ s a ` ` Foo ` ` and <nl> + ` ` clone ( ) ` ` \ ing a ` ` Foo ` ` ` ` clone ( ) ` ` \ s a ` ` FooValue ` ` . <nl> + <nl> + All ` ` struct ` ` \ s are ` ` Cloneable ` ` by default , with ` ` clone ( ) ` ` delivering <nl> + ordinary copy semantics . Therefore , : : <nl> + <nl> + var x : Baz <nl> + var y = x . clone ( ) <nl> + <nl> + is equivalent to : : <nl> + <nl> + var x : Baz <nl> + var y = x <nl> + <nl> + This should give us a start on a way to approach the generic <nl> + programming issues to be treated later . <nl> + <nl> + Note that ` ` Cloneable ` ` is the first protocol with a default <nl> + implementation that can ' t currently be written in the standard library <nl> + ( though arguably we ' d like to add the capability to write that <nl> + implementation ) . <nl> + <nl>
|
Add Cloneable proposal
|
apple/swift
|
b7367cfbc8c66035e617325c87285b5adb669fa3
|
2013-03-15T20:33:35Z
|
mmm a / runtime_data / config / br . conf <nl> ppp b / runtime_data / config / br . conf <nl> plate_height_mm = 130 <nl> <nl> multiline = 0 <nl> <nl> - char_height_mm = 63 <nl> - char_width_mm = 54 <nl> - char_whitespace_top_mm = 20 <nl> - char_whitespace_bot_mm = 10 <nl> + char_height_mm = 70 <nl> + char_width_mm = 50 <nl> + char_whitespace_top_mm = 45 <nl> + char_whitespace_bot_mm = 20 <nl> <nl> template_max_width_px = 150 <nl> template_max_height_px = 49 <nl> plateline_sensitivity_horizontal = 55 <nl> <nl> ; Regions smaller than this will be disqualified <nl> min_plate_size_width_px = 65 <nl> - min_plate_size_height_px = 22 <nl> + min_plate_size_height_px = 21 <nl> <nl> ; Results with fewer or more characters will be discarded <nl> postprocess_min_characters = 7 <nl> postprocess_regex_numbers = [ 0 - 9 ] <nl> <nl> ; Whether the plate is always dark letters on light background , light letters on dark background , or both <nl> ; value can be either always , never , or auto <nl> - invert = auto <nl> \ No newline at end of file <nl> + invert = auto <nl> Binary files a / runtime_data / ocr / tessdata / lbr . traineddata and b / runtime_data / ocr / tessdata / lbr . traineddata differ <nl>
|
Updated Brazil conf and training data
|
openalpr/openalpr
|
b7cc88f54c8fae0790be379ee461a7a66d74245b
|
2016-10-10T19:39:17Z
|
new file mode 100644 <nl> index 0000000000 . . 7b503575e0 <nl> mmm / dev / null <nl> ppp b / code / sorting / selection_sort / SelectionSort . py <nl> <nl> + def selectionSort ( unsorted ) : <nl> + sorte = [ ] <nl> + for i in range ( len ( unsorted ) ) : <nl> + selected = unsorted [ 0 ] <nl> + index = 0 <nl> + for j in range ( len ( unsorted ) ) : <nl> + if unsorted [ j ] < selected : <nl> + selected = unsorted [ j ] <nl> + index = j <nl> + sorte . append ( selected ) <nl> + unsorted . pop ( index ) <nl> + return sorte <nl> \ No newline at end of file <nl>
|
Merge pull request from Jaye - Culverhouse / Selection - Sort - Python
|
OpenGenus/cosmos
|
14192bbdf223544c81ace4427e722e04354b9953
|
2017-10-02T02:28:30Z
|
mmm a / version <nl> ppp b / version <nl> @ @ - 1 + 1 @ @ <nl> - 0 . 91 . 11 <nl> + 0 . 91 . 12 <nl>
|
version 0 . 91 . 12
|
pqrs-org/Karabiner-Elements
|
a9d72b81cb2a5267d4e70c0c4c51fb93bfd9cd8e
|
2017-07-29T14:58:29Z
|
mmm a / flow / Platform . cpp <nl> ppp b / flow / Platform . cpp <nl> void setMemoryQuota ( size_t limit ) { <nl> } <nl> if ( ! AssignProcessToJobObject ( job , GetCurrentProcess ( ) ) ) <nl> TraceEvent ( SevWarn , " FailedToSetMemoryLimit " ) . GetLastError ( ) ; <nl> - # elif defined ( __linux__ ) <nl> + # elif defined ( __linux__ ) & & ! defined ( USE_ASAN ) <nl> struct rlimit rlim ; <nl> if ( getrlimit ( RLIMIT_AS , & rlim ) ) { <nl> TraceEvent ( SevError , " GetMemoryLimit " ) . GetLastError ( ) ; <nl>
|
disable rlimit when ASAN is used
|
apple/foundationdb
|
1df3d8f0c71226150a88b265dfcb66364f0a046c
|
2019-05-13T21:15:22Z
|
mmm a / src / compiler / representation - change . h <nl> ppp b / src / compiler / representation - change . h <nl> namespace v8 { <nl> namespace internal { <nl> namespace compiler { <nl> <nl> + class Truncation final { <nl> + public : <nl> + / / Constructors . <nl> + static Truncation None ( ) { return Truncation ( TruncationKind : : kNone ) ; } <nl> + static Truncation Bool ( ) { return Truncation ( TruncationKind : : kBool ) ; } <nl> + static Truncation Word32 ( ) { return Truncation ( TruncationKind : : kWord32 ) ; } <nl> + static Truncation Word64 ( ) { return Truncation ( TruncationKind : : kWord64 ) ; } <nl> + static Truncation Float32 ( ) { return Truncation ( TruncationKind : : kFloat32 ) ; } <nl> + static Truncation Float64 ( ) { return Truncation ( TruncationKind : : kFloat64 ) ; } <nl> + static Truncation Any ( ) { return Truncation ( TruncationKind : : kAny ) ; } <nl> + <nl> + static Truncation Generalize ( Truncation t1 , Truncation t2 ) { <nl> + return Truncation ( Generalize ( t1 . kind ( ) , t2 . kind ( ) ) ) ; <nl> + } <nl> + <nl> + / / Queries . <nl> + bool TruncatesToWord32 ( ) const { <nl> + return LessGeneral ( kind_ , TruncationKind : : kWord32 ) ; <nl> + } <nl> + <nl> + bool TruncatesNaNToZero ( ) { <nl> + return LessGeneral ( kind_ , TruncationKind : : kWord32 ) | | <nl> + LessGeneral ( kind_ , TruncationKind : : kBool ) ; <nl> + } <nl> + <nl> + bool TruncatesUndefinedToZeroOrNaN ( ) { <nl> + return LessGeneral ( kind_ , TruncationKind : : kFloat64 ) | | <nl> + LessGeneral ( kind_ , TruncationKind : : kWord64 ) ; <nl> + } <nl> + <nl> + / / Operators . <nl> + bool operator = = ( Truncation other ) const { return kind ( ) = = other . kind ( ) ; } <nl> + bool operator ! = ( Truncation other ) const { return ! ( * this = = other ) ; } <nl> + <nl> + / / Debug utilities . <nl> + const char * description ( ) { <nl> + switch ( kind ( ) ) { <nl> + case TruncationKind : : kNone : <nl> + return " no - value - use " ; <nl> + case TruncationKind : : kBool : <nl> + return " truncate - to - bool " ; <nl> + case TruncationKind : : kWord32 : <nl> + return " truncate - to - word32 " ; <nl> + case TruncationKind : : kWord64 : <nl> + return " truncate - to - word64 " ; <nl> + case TruncationKind : : kFloat32 : <nl> + return " truncate - to - float32 " ; <nl> + case TruncationKind : : kFloat64 : <nl> + return " truncate - to - float64 " ; <nl> + case TruncationKind : : kAny : <nl> + return " no - truncation " ; <nl> + } <nl> + UNREACHABLE ( ) ; <nl> + return nullptr ; <nl> + } <nl> + <nl> + private : <nl> + enum class TruncationKind : uint8_t { <nl> + kNone , <nl> + kBool , <nl> + kWord32 , <nl> + kWord64 , <nl> + kFloat32 , <nl> + kFloat64 , <nl> + kAny <nl> + } ; <nl> + <nl> + explicit Truncation ( TruncationKind kind ) : kind_ ( kind ) { } <nl> + TruncationKind kind ( ) const { return kind_ ; } <nl> + <nl> + TruncationKind kind_ ; <nl> + <nl> + / / Partial order for truncations : <nl> + / / <nl> + / / kWord64 kAny <nl> + / / ^ ^ <nl> + / / \ | <nl> + / / \ kFloat64 < - - + <nl> + / / \ ^ ^ | <nl> + / / \ / | | <nl> + / / kWord32 kFloat32 kBool <nl> + / / ^ ^ ^ <nl> + / / \ | / <nl> + / / \ | / <nl> + / / \ | / <nl> + / / \ | / <nl> + / / \ | / <nl> + / / kNone <nl> + static TruncationKind Generalize ( TruncationKind rep1 , TruncationKind rep2 ) { <nl> + if ( LessGeneral ( rep1 , rep2 ) ) return rep2 ; <nl> + if ( LessGeneral ( rep2 , rep1 ) ) return rep1 ; <nl> + / / Handle the generalization of float64 - representable values . <nl> + if ( LessGeneral ( rep1 , TruncationKind : : kFloat64 ) & & <nl> + LessGeneral ( rep2 , TruncationKind : : kFloat64 ) ) { <nl> + return TruncationKind : : kFloat64 ; <nl> + } <nl> + / / All other combinations are illegal . <nl> + FATAL ( " Tried to combine incompatible representations " ) ; <nl> + return TruncationKind : : kNone ; <nl> + } <nl> + <nl> + static bool LessGeneral ( TruncationKind rep1 , TruncationKind rep2 ) { <nl> + switch ( rep1 ) { <nl> + case TruncationKind : : kNone : <nl> + return true ; <nl> + case TruncationKind : : kBool : <nl> + return rep2 = = TruncationKind : : kBool | | rep2 = = TruncationKind : : kAny ; <nl> + case TruncationKind : : kWord32 : <nl> + return rep2 = = TruncationKind : : kWord32 | | <nl> + rep2 = = TruncationKind : : kWord64 | | <nl> + rep2 = = TruncationKind : : kFloat64 | | rep2 = = TruncationKind : : kAny ; <nl> + case TruncationKind : : kWord64 : <nl> + return rep2 = = TruncationKind : : kWord64 ; <nl> + case TruncationKind : : kFloat32 : <nl> + return rep2 = = TruncationKind : : kFloat32 | | <nl> + rep2 = = TruncationKind : : kFloat64 | | rep2 = = TruncationKind : : kAny ; <nl> + case TruncationKind : : kFloat64 : <nl> + return rep2 = = TruncationKind : : kFloat64 | | rep2 = = TruncationKind : : kAny ; <nl> + case TruncationKind : : kAny : <nl> + return rep2 = = TruncationKind : : kAny ; <nl> + } <nl> + UNREACHABLE ( ) ; <nl> + return false ; <nl> + } <nl> + } ; <nl> + <nl> + <nl> / / Contains logic related to changing the representation of values for constants <nl> / / and other nodes , as well as lowering Simplified - > Machine operators . <nl> / / Eagerly folds any representation changes for constants . <nl> - class RepresentationChanger { <nl> + class RepresentationChanger final { <nl> public : <nl> RepresentationChanger ( JSGraph * jsgraph , Isolate * isolate ) <nl> : jsgraph_ ( jsgraph ) , <nl> class RepresentationChanger { <nl> return ( type & ( kRepWord8 | kRepWord16 | kRepWord32 ) ) ! = 0 ; <nl> } <nl> <nl> + / / Changes representation from { output_type } to { use_rep } . The { truncation } <nl> + / / parameter is only used for sanity checking - if the changer cannot figure <nl> + / / out signedness for the word32 - > float64 conversion , then we check that the <nl> + / / uses truncate to word32 ( so they do not care about signedness ) . <nl> Node * GetRepresentationFor ( Node * node , MachineTypeUnion output_type , <nl> - MachineTypeUnion use_type ) { <nl> + MachineTypeUnion use_rep , <nl> + Truncation truncation = Truncation : : None ( ) ) { <nl> + DCHECK ( ( use_rep & kRepMask ) = = use_rep ) ; <nl> if ( ! base : : bits : : IsPowerOfTwo32 ( output_type & kRepMask ) ) { <nl> / / There should be only one output representation . <nl> - return TypeError ( node , output_type , use_type ) ; <nl> + return TypeError ( node , output_type , use_rep ) ; <nl> } <nl> - if ( ( use_type & kRepMask ) = = ( output_type & kRepMask ) ) { <nl> + if ( use_rep = = ( output_type & kRepMask ) ) { <nl> / / Representations are the same . That ' s a no - op . <nl> return node ; <nl> } <nl> - if ( IsWord ( use_type ) & & IsWord ( output_type ) ) { <nl> + if ( IsWord ( use_rep ) & & IsWord ( output_type ) ) { <nl> / / Both are words less than or equal to 32 - bits . <nl> / / Since loads of integers from memory implicitly sign or zero extend the <nl> / / value to the full machine word size and stores implicitly truncate , <nl> / / no representation change is necessary . <nl> return node ; <nl> } <nl> - if ( use_type & kRepTagged ) { <nl> + if ( use_rep & kRepTagged ) { <nl> return GetTaggedRepresentationFor ( node , output_type ) ; <nl> - } else if ( use_type & kRepFloat32 ) { <nl> - return GetFloat32RepresentationFor ( node , output_type , use_type ) ; <nl> - } else if ( use_type & kRepFloat64 ) { <nl> - return GetFloat64RepresentationFor ( node , output_type , use_type ) ; <nl> - } else if ( use_type & kRepBit ) { <nl> + } else if ( use_rep & kRepFloat32 ) { <nl> + return GetFloat32RepresentationFor ( node , output_type , truncation ) ; <nl> + } else if ( use_rep & kRepFloat64 ) { <nl> + return GetFloat64RepresentationFor ( node , output_type , truncation ) ; <nl> + } else if ( use_rep & kRepBit ) { <nl> return GetBitRepresentationFor ( node , output_type ) ; <nl> - } else if ( IsWord ( use_type ) ) { <nl> + } else if ( IsWord ( use_rep ) ) { <nl> return GetWord32RepresentationFor ( node , output_type ) ; <nl> - } else if ( use_type & kRepWord64 ) { <nl> + } else if ( use_rep & kRepWord64 ) { <nl> return GetWord64RepresentationFor ( node , output_type ) ; <nl> } else { <nl> return node ; <nl> class RepresentationChanger { <nl> } <nl> <nl> Node * GetFloat32RepresentationFor ( Node * node , MachineTypeUnion output_type , <nl> - MachineTypeUnion truncation ) { <nl> + Truncation truncation ) { <nl> / / Eagerly fold representation changes for constants . <nl> switch ( node - > opcode ( ) ) { <nl> case IrOpcode : : kFloat64Constant : <nl> class RepresentationChanger { <nl> } else { <nl> / / Either the output is int32 or the uses only care about the <nl> / / low 32 bits ( so we can pick int32 safely ) . <nl> - DCHECK ( output_type & kTypeInt32 | | <nl> - ! ( truncation & ~ ( kTypeInt32 | kTypeUint32 | kRepMask ) ) ) ; <nl> + DCHECK ( output_type & kTypeInt32 | | truncation . TruncatesToWord32 ( ) ) ; <nl> op = machine ( ) - > ChangeInt32ToFloat64 ( ) ; <nl> } <nl> / / int32 - > float64 - > float32 <nl> class RepresentationChanger { <nl> } <nl> <nl> Node * GetFloat64RepresentationFor ( Node * node , MachineTypeUnion output_type , <nl> - MachineTypeUnion use_type ) { <nl> + Truncation truncation ) { <nl> / / Eagerly fold representation changes for constants . <nl> switch ( node - > opcode ( ) ) { <nl> case IrOpcode : : kNumberConstant : <nl> class RepresentationChanger { <nl> } else { <nl> / / Either the output is int32 or the uses only care about the <nl> / / low 32 bits ( so we can pick int32 safely ) . <nl> - DCHECK ( output_type & kTypeInt32 | | <nl> - ! ( use_type & ~ ( kTypeInt32 | kTypeUint32 | kRepMask ) ) ) ; <nl> + DCHECK ( output_type & kTypeInt32 | | truncation . TruncatesToWord32 ( ) ) ; <nl> op = machine ( ) - > ChangeInt32ToFloat64 ( ) ; <nl> } <nl> } else if ( output_type & kRepTagged ) { <nl> mmm a / src / compiler / simplified - lowering . cc <nl> ppp b / src / compiler / simplified - lowering . cc <nl> namespace { <nl> / / need the signedness information to produce the correct value . <nl> class UseInfo { <nl> public : <nl> - / / Constructors <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - <nl> - / / Uses truncating to the preferred representation . <nl> + UseInfo ( MachineType preferred , Truncation truncation ) <nl> + : preferred_ ( preferred ) , truncation_ ( truncation ) { <nl> + DCHECK ( preferred = = ( preferred & kRepMask ) ) ; <nl> + } <nl> static UseInfo TruncatingWord32 ( ) { <nl> - return UseInfo ( kTypeInt32 | kTypeUint32 | kRepWord32 ) ; <nl> + return UseInfo ( kRepWord32 , Truncation : : Word32 ( ) ) ; <nl> } <nl> static UseInfo TruncatingWord64 ( ) { <nl> - return UseInfo ( kTypeInt64 | kTypeUint64 | kRepWord64 ) ; <nl> + return UseInfo ( kRepWord64 , Truncation : : Word64 ( ) ) ; <nl> + } <nl> + static UseInfo Bool ( ) { return UseInfo ( kRepBit , Truncation : : Bool ( ) ) ; } <nl> + static UseInfo Float32 ( ) { <nl> + return UseInfo ( kRepFloat32 , Truncation : : Float32 ( ) ) ; <nl> + } <nl> + static UseInfo Float64 ( ) { <nl> + return UseInfo ( kRepFloat64 , Truncation : : Float64 ( ) ) ; <nl> } <nl> - static UseInfo Bool ( ) { return UseInfo ( kMachBool ) ; } <nl> - static UseInfo Float32 ( ) { return UseInfo ( kMachFloat32 ) ; } <nl> - static UseInfo Float64 ( ) { return UseInfo ( kMachFloat64 ) ; } <nl> static UseInfo PointerInt ( ) { <nl> return kPointerSize = = 4 ? TruncatingWord32 ( ) : TruncatingWord64 ( ) ; <nl> } <nl> + static UseInfo AnyTagged ( ) { return UseInfo ( kRepTagged , Truncation : : Any ( ) ) ; } <nl> <nl> - / / Non - truncating uses . <nl> - static UseInfo AnyTagged ( ) { return UseInfo ( kMachAnyTagged ) ; } <nl> - static UseInfo Any ( ) { return UseInfo ( kTypeAny ) ; } <nl> + / / Undetermined representation . <nl> + static UseInfo Any ( ) { return UseInfo ( kMachNone , Truncation : : Any ( ) ) ; } <nl> + static UseInfo None ( ) { return UseInfo ( kMachNone , Truncation : : None ( ) ) ; } <nl> <nl> - / / Ignored - value ' use ' . <nl> - static UseInfo None ( ) { return UseInfo ( kMachNone ) ; } <nl> - <nl> - / / Truncating to a representation that is smaller than the preferred <nl> + / / Truncation to a representation that is smaller than the preferred <nl> / / one . <nl> static UseInfo Float64TruncatingToWord32 ( ) { <nl> - return UseInfo ( kRepFloat64 | kTypeInt32 | kTypeUint32 ) ; <nl> + return UseInfo ( kRepFloat64 , Truncation : : Word32 ( ) ) ; <nl> } <nl> static UseInfo Word64TruncatingToWord32 ( ) { <nl> - return UseInfo ( kRepWord64 | kTypeInt32 | kTypeUint32 ) ; <nl> - } <nl> - static UseInfo AnyTruncatingToBool ( ) { return UseInfo ( kTypeBool ) ; } <nl> - <nl> - UseInfo ( MachineTypeUnion representation , MachineTypeUnion truncation ) <nl> - : type_ ( representation | truncation ) { <nl> - DCHECK ( base : : bits : : CountPopulation32 ( representation & kRepMask ) = = 1 ) ; <nl> - DCHECK ( ( representation & kTypeMask ) = = 0 ) ; <nl> - DCHECK ( ( truncation & kRepMask ) = = 0 ) ; <nl> - / / TODO ( jarin ) Check / normalize truncation ? <nl> + return UseInfo ( kRepWord64 , Truncation : : Word32 ( ) ) ; <nl> } <nl> - <nl> - / / Queries <nl> - / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> - MachineType GetRepresentation ( ) const { <nl> - return static_cast < MachineType > ( type_ & kRepMask ) ; <nl> + static UseInfo AnyTruncatingToBool ( ) { <nl> + return UseInfo ( kMachNone , Truncation : : Bool ( ) ) ; <nl> } <nl> <nl> - / / This should only be used by the Enqueue method . <nl> - MachineTypeUnion machine_type ( ) const { return type_ ; } <nl> + MachineType preferred ( ) const { return preferred_ ; } <nl> + Truncation truncation ( ) const { return truncation_ ; } <nl> <nl> private : <nl> - explicit UseInfo ( MachineTypeUnion type ) : type_ ( type ) { } <nl> - <nl> - MachineTypeUnion type_ ; <nl> + MachineType preferred_ ; <nl> + Truncation truncation_ ; <nl> } ; <nl> <nl> <nl> UseInfo UseInfoFromMachineType ( MachineType type ) { <nl> MachineTypeUnion rep = RepresentationOf ( type ) ; <nl> DCHECK ( ( rep & kTypeMask ) = = 0 ) ; <nl> + <nl> if ( rep & kRepTagged ) return UseInfo : : AnyTagged ( ) ; <nl> if ( rep & kRepFloat64 ) { <nl> DCHECK ( ( rep & kRepWord64 ) = = 0 ) ; <nl> UseInfo UseInfoForBasePointer ( const ElementAccess & access ) { <nl> class RepresentationSelector { <nl> public : <nl> / / Information for each node tracked during the fixpoint . <nl> - struct NodeInfo { <nl> - MachineTypeUnion use : 15 ; / / Union of all usages for the node . <nl> - bool queued : 1 ; / / Bookkeeping for the traversal . <nl> - bool visited : 1 ; / / Bookkeeping for the traversal . <nl> - MachineTypeUnion output : 15 ; / / Output type of the node . <nl> + class NodeInfo { <nl> + public : <nl> + / / Adds new use to the node . Returns true if something has changed <nl> + / / and the node has to be requeued . <nl> + bool AddUse ( UseInfo info ) { <nl> + Truncation old_truncation = truncation_ ; <nl> + truncation_ = Truncation : : Generalize ( truncation_ , info . truncation ( ) ) ; <nl> + return truncation_ ! = old_truncation ; <nl> + } <nl> + <nl> + void set_queued ( bool value ) { queued_ = value ; } <nl> + bool queued ( ) const { return queued_ ; } <nl> + void set_visited ( ) { visited_ = true ; } <nl> + bool visited ( ) const { return visited_ ; } <nl> + Truncation truncation ( ) const { return truncation_ ; } <nl> + void set_output_type ( MachineTypeUnion type ) { output_ = type ; } <nl> + MachineTypeUnion output_type ( ) const { return output_ ; } <nl> + <nl> + private : <nl> + bool queued_ = false ; / / Bookkeeping for the traversal . <nl> + bool visited_ = false ; / / Bookkeeping for the traversal . <nl> + MachineTypeUnion output_ = kMachNone ; / / Output type of the node . <nl> + Truncation truncation_ = Truncation : : None ( ) ; / / Information about uses . <nl> } ; <nl> <nl> RepresentationSelector ( JSGraph * jsgraph , Zone * zone , <nl> class RepresentationSelector { <nl> SourcePositionTable * source_positions ) <nl> : jsgraph_ ( jsgraph ) , <nl> count_ ( jsgraph - > graph ( ) - > NodeCount ( ) ) , <nl> - info_ ( zone - > NewArray < NodeInfo > ( count_ ) ) , <nl> + info_ ( count_ , zone ) , <nl> nodes_ ( zone ) , <nl> replacements_ ( zone ) , <nl> phase_ ( PROPAGATE ) , <nl> changer_ ( changer ) , <nl> queue_ ( zone ) , <nl> source_positions_ ( source_positions ) { <nl> - memset ( info_ , 0 , sizeof ( NodeInfo ) * count_ ) ; <nl> - <nl> safe_int_additive_range_ = <nl> Type : : Range ( - std : : pow ( 2 . 0 , 52 . 0 ) , std : : pow ( 2 . 0 , 52 . 0 ) , zone ) ; <nl> } <nl> class RepresentationSelector { <nl> Node * node = queue_ . front ( ) ; <nl> NodeInfo * info = GetInfo ( node ) ; <nl> queue_ . pop ( ) ; <nl> - info - > queued = false ; <nl> + info - > set_queued ( false ) ; <nl> TRACE ( " visit # % d : % s \ n " , node - > id ( ) , node - > op ( ) - > mnemonic ( ) ) ; <nl> - VisitNode ( node , info - > use , NULL ) ; <nl> + VisitNode ( node , info - > truncation ( ) , NULL ) ; <nl> TRACE ( " = = > output " ) ; <nl> - PrintInfo ( info - > output ) ; <nl> + PrintInfo ( info - > output_type ( ) ) ; <nl> TRACE ( " \ n " ) ; <nl> } <nl> <nl> class RepresentationSelector { <nl> / / Process nodes from the collected { nodes_ } vector . <nl> for ( NodeVector : : iterator i = nodes_ . begin ( ) ; i ! = nodes_ . end ( ) ; + + i ) { <nl> Node * node = * i ; <nl> + NodeInfo * info = GetInfo ( node ) ; <nl> TRACE ( " visit # % d : % s \ n " , node - > id ( ) , node - > op ( ) - > mnemonic ( ) ) ; <nl> / / Reuse { VisitNode ( ) } so the representation rules are in one place . <nl> SourcePositionTable : : Scope scope ( <nl> source_positions_ , source_positions_ - > GetSourcePosition ( node ) ) ; <nl> - VisitNode ( node , GetUseInfo ( node ) , lowering ) ; <nl> + VisitNode ( node , info - > truncation ( ) , lowering ) ; <nl> } <nl> <nl> / / Perform the final replacements . <nl> class RepresentationSelector { <nl> / / Enqueue { node } if the { use } contains new information for that node . <nl> / / Add { node } to { nodes_ } if this is the first time it ' s been visited . <nl> void Enqueue ( Node * node , UseInfo use_info = UseInfo : : None ( ) ) { <nl> - MachineTypeUnion use = use_info . machine_type ( ) ; <nl> - <nl> if ( phase_ ! = PROPAGATE ) return ; <nl> NodeInfo * info = GetInfo ( node ) ; <nl> - if ( ! info - > visited ) { <nl> + if ( ! info - > visited ( ) ) { <nl> / / First visit of this node . <nl> - info - > visited = true ; <nl> - info - > queued = true ; <nl> + info - > set_visited ( ) ; <nl> + info - > set_queued ( true ) ; <nl> nodes_ . push_back ( node ) ; <nl> queue_ . push ( node ) ; <nl> TRACE ( " initial : " ) ; <nl> - info - > use | = use ; <nl> - PrintUseInfo ( node ) ; <nl> + info - > AddUse ( use_info ) ; <nl> + PrintTruncation ( info - > truncation ( ) ) ; <nl> return ; <nl> } <nl> TRACE ( " queue ? : " ) ; <nl> - PrintUseInfo ( node ) ; <nl> - if ( ( info - > use & use ) ! = use ) { <nl> + PrintTruncation ( info - > truncation ( ) ) ; <nl> + if ( info - > AddUse ( use_info ) ) { <nl> / / New usage information for the node is available . <nl> - if ( ! info - > queued ) { <nl> + if ( ! info - > queued ( ) ) { <nl> queue_ . push ( node ) ; <nl> - info - > queued = true ; <nl> + info - > set_queued ( true ) ; <nl> TRACE ( " added : " ) ; <nl> } else { <nl> TRACE ( " inqueue : " ) ; <nl> } <nl> - info - > use | = use ; <nl> - PrintUseInfo ( node ) ; <nl> + PrintTruncation ( info - > truncation ( ) ) ; <nl> } <nl> } <nl> <nl> class RepresentationSelector { <nl> / / instruction . <nl> DCHECK ( ( output & kRepMask ) = = 0 | | <nl> base : : bits : : IsPowerOfTwo32 ( output & kRepMask ) ) ; <nl> - GetInfo ( node ) - > output = output ; <nl> + GetInfo ( node ) - > set_output_type ( output ) ; <nl> } <nl> <nl> bool BothInputsAre ( Node * node , Type * type ) { <nl> class RepresentationSelector { <nl> Enqueue ( input , UseInfo : : TruncatingWord32 ( ) ) ; <nl> } else { <nl> / / In the change phase , insert a change before the use if necessary . <nl> - MachineTypeUnion output = GetInfo ( input ) - > output ; <nl> + MachineTypeUnion output = GetInfo ( input ) - > output_type ( ) ; <nl> if ( ( output & ( kRepBit | kRepWord8 | kRepWord16 | kRepWord32 ) ) = = 0 ) { <nl> / / Output representation doesn ' t match usage . <nl> TRACE ( " truncate - to - int32 : # % d : % s ( @ % d # % d : % s ) " , node - > id ( ) , <nl> class RepresentationSelector { <nl> void ConvertInput ( Node * node , int index , UseInfo use ) { <nl> Node * input = node - > InputAt ( index ) ; <nl> / / In the change phase , insert a change before the use if necessary . <nl> - if ( use . GetRepresentation ( ) = = kMachNone ) <nl> + if ( use . preferred ( ) = = kMachNone ) <nl> return ; / / No input requirement on the use . <nl> - MachineTypeUnion output = GetInfo ( input ) - > output ; <nl> - if ( ( output & kRepMask ) ! = use . GetRepresentation ( ) ) { <nl> + MachineTypeUnion output = GetInfo ( input ) - > output_type ( ) ; <nl> + if ( ( output & kRepMask ) ! = use . preferred ( ) ) { <nl> / / Output representation doesn ' t match usage . <nl> TRACE ( " change : # % d : % s ( @ % d # % d : % s ) " , node - > id ( ) , node - > op ( ) - > mnemonic ( ) , <nl> index , input - > id ( ) , input - > op ( ) - > mnemonic ( ) ) ; <nl> class RepresentationSelector { <nl> TRACE ( " to " ) ; <nl> PrintUseInfo ( use ) ; <nl> TRACE ( " \ n " ) ; <nl> - Node * n = <nl> - changer_ - > GetRepresentationFor ( input , output , use . machine_type ( ) ) ; <nl> + Node * n = changer_ - > GetRepresentationFor ( input , output , use . preferred ( ) , <nl> + use . truncation ( ) ) ; <nl> node - > ReplaceInput ( index , n ) ; <nl> } <nl> } <nl> class RepresentationSelector { <nl> } <nl> <nl> / / Infer representation for phi - like nodes . <nl> - static MachineType GetRepresentationForPhi ( Node * node , MachineTypeUnion use ) { <nl> + static MachineType GetRepresentationForPhi ( Node * node , Truncation use ) { <nl> / / Phis adapt to the output representation their uses demand . <nl> Type * upper = NodeProperties : : GetType ( node ) ; <nl> if ( upper - > Is ( Type : : Signed32 ( ) ) | | upper - > Is ( Type : : Unsigned32 ( ) ) ) { <nl> / / We are within 32 bits range = > pick kRepWord32 . <nl> return kRepWord32 ; <nl> - } else if ( ! CanObserveNonWord32 ( use ) ) { <nl> + } else if ( use . TruncatesToWord32 ( ) ) { <nl> / / We only use 32 bits . <nl> return kRepWord32 ; <nl> } else if ( upper - > Is ( Type : : Boolean ( ) ) ) { <nl> class RepresentationSelector { <nl> } <nl> <nl> / / Helper for handling selects . <nl> - void VisitSelect ( Node * node , MachineTypeUnion use , <nl> + void VisitSelect ( Node * node , Truncation truncation , <nl> SimplifiedLowering * lowering ) { <nl> ProcessInput ( node , 0 , UseInfo : : Bool ( ) ) ; <nl> - MachineType output = GetRepresentationForPhi ( node , use ) ; <nl> + MachineType output = GetRepresentationForPhi ( node , truncation ) ; <nl> <nl> Type * upper = NodeProperties : : GetType ( node ) ; <nl> MachineType output_type = <nl> class RepresentationSelector { <nl> } <nl> } <nl> / / Convert inputs to the output representation of this phi , pass the <nl> - / / use truncation along . <nl> - UseInfo input_use ( output , use & kTypeMask ) ; <nl> + / / truncation truncation along . <nl> + UseInfo input_use ( output , truncation ) ; <nl> ProcessInput ( node , 1 , input_use ) ; <nl> ProcessInput ( node , 2 , input_use ) ; <nl> } <nl> <nl> / / Helper for handling phis . <nl> - void VisitPhi ( Node * node , MachineTypeUnion use , <nl> + void VisitPhi ( Node * node , Truncation truncation , <nl> SimplifiedLowering * lowering ) { <nl> - MachineType output = GetRepresentationForPhi ( node , use ) ; <nl> + MachineType output = GetRepresentationForPhi ( node , truncation ) ; <nl> <nl> Type * upper = NodeProperties : : GetType ( node ) ; <nl> MachineType output_type = <nl> class RepresentationSelector { <nl> } <nl> <nl> / / Convert inputs to the output representation of this phi , pass the <nl> - / / use truncation along . <nl> - UseInfo input_use ( output , use & kTypeMask ) ; <nl> + / / truncation truncation along . <nl> + UseInfo input_use ( output , truncation ) ; <nl> for ( int i = 0 ; i < node - > InputCount ( ) ; i + + ) { <nl> ProcessInput ( node , i , i < values ? input_use : UseInfo : : None ( ) ) ; <nl> } <nl> class RepresentationSelector { <nl> new ( zone - > New ( sizeof ( ZoneVector < MachineType > ) ) ) <nl> ZoneVector < MachineType > ( node - > InputCount ( ) , zone ) ; <nl> for ( int i = 0 ; i < node - > InputCount ( ) ; i + + ) { <nl> - MachineTypeUnion input_type = GetInfo ( node - > InputAt ( i ) ) - > output ; <nl> + MachineTypeUnion input_type = GetInfo ( node - > InputAt ( i ) ) - > output_type ( ) ; <nl> ( * types ) [ i ] = static_cast < MachineType > ( input_type ) ; <nl> } <nl> NodeProperties : : ChangeOp ( node , <nl> class RepresentationSelector { <nl> return changer_ - > Float64OperatorFor ( node - > opcode ( ) ) ; <nl> } <nl> <nl> - bool CanLowerToInt32Binop ( Node * node , MachineTypeUnion use ) { <nl> + bool CanLowerToInt32Binop ( Node * node , Truncation use ) { <nl> return BothInputsAre ( node , Type : : Signed32 ( ) ) & & <nl> - ( ! CanObserveNonWord32 ( use ) | | <nl> + ( use . TruncatesToWord32 ( ) | | <nl> NodeProperties : : GetType ( node ) - > Is ( Type : : Signed32 ( ) ) ) ; <nl> } <nl> <nl> - bool CanLowerToWord32AdditiveBinop ( Node * node , MachineTypeUnion use ) { <nl> + bool CanLowerToWord32AdditiveBinop ( Node * node , Truncation use ) { <nl> return BothInputsAre ( node , safe_int_additive_range_ ) & & <nl> - ! CanObserveNonWord32 ( use ) ; <nl> - } <nl> - <nl> - bool CanLowerToUint32Binop ( Node * node , MachineTypeUnion use ) { <nl> - return BothInputsAre ( node , Type : : Unsigned32 ( ) ) & & <nl> - ( ! CanObserveNonWord32 ( use ) | | <nl> - NodeProperties : : GetType ( node ) - > Is ( Type : : Unsigned32 ( ) ) ) ; <nl> - } <nl> - <nl> - static bool CanObserveNonWord32 ( MachineTypeUnion use ) { <nl> - return ( use & kTypeMask & ~ ( kTypeInt32 | kTypeUint32 ) ) ! = 0 ; <nl> - } <nl> - <nl> - static bool CanObserveNaN ( MachineTypeUnion use ) { <nl> - return ( use & ( kTypeNumber | kTypeAny ) ) ! = 0 ; <nl> + use . TruncatesToWord32 ( ) ; <nl> } <nl> <nl> / / Dispatching routine for visiting the node { node } with the usage { use } . <nl> / / Depending on the operator , propagate new usage info to the inputs . <nl> - void VisitNode ( Node * node , MachineTypeUnion use , <nl> + void VisitNode ( Node * node , Truncation truncation , <nl> SimplifiedLowering * lowering ) { <nl> switch ( node - > opcode ( ) ) { <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> class RepresentationSelector { <nl> Enqueue ( NodeProperties : : GetControlInput ( node , 0 ) ) ; <nl> break ; <nl> case IrOpcode : : kSelect : <nl> - return VisitSelect ( node , use , lowering ) ; <nl> + return VisitSelect ( node , truncation , lowering ) ; <nl> case IrOpcode : : kPhi : <nl> - return VisitPhi ( node , use , lowering ) ; <nl> + return VisitPhi ( node , truncation , lowering ) ; <nl> case IrOpcode : : kCall : <nl> return VisitCall ( node , lowering ) ; <nl> <nl> class RepresentationSelector { <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> case IrOpcode : : kBooleanNot : { <nl> if ( lower ( ) ) { <nl> - MachineTypeUnion input = GetInfo ( node - > InputAt ( 0 ) ) - > output ; <nl> + MachineTypeUnion input = GetInfo ( node - > InputAt ( 0 ) ) - > output_type ( ) ; <nl> if ( input & kRepBit ) { <nl> / / BooleanNot ( x : kRepBit ) = > Word32Equal ( x , # 0 ) <nl> node - > AppendInput ( jsgraph_ - > zone ( ) , jsgraph_ - > Int32Constant ( 0 ) ) ; <nl> class RepresentationSelector { <nl> } <nl> case IrOpcode : : kBooleanToNumber : { <nl> if ( lower ( ) ) { <nl> - MachineTypeUnion input = GetInfo ( node - > InputAt ( 0 ) ) - > output ; <nl> + MachineTypeUnion input = GetInfo ( node - > InputAt ( 0 ) ) - > output_type ( ) ; <nl> if ( input & kRepBit ) { <nl> / / BooleanToNumber ( x : kRepBit ) = > x <nl> DeferReplacement ( node , node - > InputAt ( 0 ) ) ; <nl> class RepresentationSelector { <nl> case IrOpcode : : kNumberSubtract : { <nl> / / Add and subtract reduce to Int32Add / Sub if the inputs <nl> / / are already integers and all uses are truncating . <nl> - if ( CanLowerToWord32AdditiveBinop ( node , use ) ) { <nl> + if ( CanLowerToWord32AdditiveBinop ( node , truncation ) ) { <nl> / / = > signed Int32Add / Sub <nl> VisitInt32Binop ( node ) ; <nl> if ( lower ( ) ) NodeProperties : : ChangeOp ( node , Int32Op ( node ) ) ; <nl> class RepresentationSelector { <nl> case IrOpcode : : kNumberMultiply : { <nl> NumberMatcher right ( node - > InputAt ( 1 ) ) ; <nl> if ( right . IsInRange ( - 1048576 , 1048576 ) ) { / / must fit double mantissa . <nl> - if ( CanLowerToInt32Binop ( node , use ) ) { <nl> + if ( CanLowerToInt32Binop ( node , truncation ) ) { <nl> / / = > signed Int32Mul <nl> VisitInt32Binop ( node ) ; <nl> if ( lower ( ) ) NodeProperties : : ChangeOp ( node , Int32Op ( node ) ) ; <nl> class RepresentationSelector { <nl> break ; <nl> } <nl> case IrOpcode : : kNumberDivide : { <nl> - if ( CanLowerToInt32Binop ( node , use ) ) { <nl> + if ( CanLowerToInt32Binop ( node , truncation ) ) { <nl> / / = > signed Int32Div <nl> VisitInt32Binop ( node ) ; <nl> if ( lower ( ) ) DeferReplacement ( node , lowering - > Int32Div ( node ) ) ; <nl> break ; <nl> } <nl> - if ( BothInputsAre ( node , Type : : Unsigned32 ( ) ) & & ! CanObserveNaN ( use ) ) { <nl> + if ( BothInputsAre ( node , Type : : Unsigned32 ( ) ) & & <nl> + truncation . TruncatesNaNToZero ( ) ) { <nl> / / = > unsigned Uint32Div <nl> VisitUint32Binop ( node ) ; <nl> if ( lower ( ) ) DeferReplacement ( node , lowering - > Uint32Div ( node ) ) ; <nl> class RepresentationSelector { <nl> break ; <nl> } <nl> case IrOpcode : : kNumberModulus : { <nl> - if ( CanLowerToInt32Binop ( node , use ) ) { <nl> + if ( CanLowerToInt32Binop ( node , truncation ) ) { <nl> / / = > signed Int32Mod <nl> VisitInt32Binop ( node ) ; <nl> if ( lower ( ) ) DeferReplacement ( node , lowering - > Int32Mod ( node ) ) ; <nl> break ; <nl> } <nl> - if ( BothInputsAre ( node , Type : : Unsigned32 ( ) ) & & ! CanObserveNaN ( use ) ) { <nl> + if ( BothInputsAre ( node , Type : : Unsigned32 ( ) ) & & <nl> + truncation . TruncatesNaNToZero ( ) ) { <nl> / / = > unsigned Uint32Mod <nl> VisitUint32Binop ( node ) ; <nl> if ( lower ( ) ) DeferReplacement ( node , lowering - > Uint32Mod ( node ) ) ; <nl> class RepresentationSelector { <nl> ProcessInput ( node , 1 , UseInfo : : TruncatingWord32 ( ) ) ; / / offset <nl> ProcessInput ( node , 2 , UseInfo : : TruncatingWord32 ( ) ) ; / / length <nl> ProcessRemainingInputs ( node , 3 ) ; <nl> - / / Tagged overrides everything if we have to do a typed array bounds <nl> - / / check , because we may need to return undefined then . <nl> + <nl> MachineType output_type ; <nl> - if ( use & kRepTagged ) { <nl> - output_type = kMachAnyTagged ; <nl> - } else if ( use & kRepFloat64 ) { <nl> - if ( access . machine_type ( ) & kRepFloat32 ) { <nl> + if ( truncation . TruncatesUndefinedToZeroOrNaN ( ) ) { <nl> + if ( truncation . TruncatesNaNToZero ( ) ) { <nl> + / / If undefined is truncated to a non - NaN number , we can use <nl> + / / the load ' s representation . <nl> output_type = access . machine_type ( ) ; <nl> } else { <nl> - output_type = kMachFloat64 ; <nl> + / / If undefined is truncated to a number , but the use can <nl> + / / observe NaN , we need to output at least the float32 <nl> + / / representation . <nl> + if ( access . machine_type ( ) & kRepFloat32 ) { <nl> + output_type = access . machine_type ( ) ; <nl> + } else { <nl> + output_type = kMachFloat64 ; <nl> + } <nl> } <nl> - } else if ( use & kRepFloat32 ) { <nl> - output_type = kMachFloat32 ; <nl> } else { <nl> - output_type = access . machine_type ( ) ; <nl> + / / If undefined is not truncated away , we need to have the tagged <nl> + / / representation . <nl> + output_type = kMachAnyTagged ; <nl> } <nl> SetOutput ( node , output_type ) ; <nl> if ( lower ( ) ) lowering - > DoLoadBuffer ( node , output_type , changer_ ) ; <nl> class RepresentationSelector { <nl> replacement - > op ( ) - > mnemonic ( ) ) ; <nl> <nl> if ( replacement - > id ( ) < count_ & & <nl> - GetInfo ( replacement ) - > output = = GetInfo ( node ) - > output ) { <nl> + GetInfo ( replacement ) - > output_type ( ) = = GetInfo ( node ) - > output_type ( ) ) { <nl> / / Replace with a previously existing node eagerly only if the type is the <nl> / / same . <nl> node - > ReplaceUses ( replacement ) ; <nl> class RepresentationSelector { <nl> node - > NullAllInputs ( ) ; / / Node is now dead . <nl> } <nl> <nl> - void PrintUseInfo ( Node * node ) { <nl> - TRACE ( " # % d : % - 20s " , node - > id ( ) , node - > op ( ) - > mnemonic ( ) ) ; <nl> - PrintInfo ( GetUseInfo ( node ) ) ; <nl> - TRACE ( " \ n " ) ; <nl> - } <nl> - <nl> void PrintInfo ( MachineTypeUnion info ) { <nl> if ( FLAG_trace_representation ) { <nl> OFStream os ( stdout ) ; <nl> class RepresentationSelector { <nl> } <nl> } <nl> <nl> + void PrintTruncation ( Truncation truncation ) { <nl> + if ( FLAG_trace_representation ) { <nl> + OFStream os ( stdout ) ; <nl> + os < < truncation . description ( ) ; <nl> + } <nl> + } <nl> + <nl> void PrintUseInfo ( UseInfo info ) { <nl> if ( FLAG_trace_representation ) { <nl> OFStream os ( stdout ) ; <nl> - os < < static_cast < MachineType > ( info . machine_type ( ) ) ; <nl> + os < < info . preferred ( ) < < " : " < < info . truncation ( ) . description ( ) ; <nl> } <nl> } <nl> <nl> private : <nl> JSGraph * jsgraph_ ; <nl> size_t const count_ ; / / number of nodes in the graph <nl> - NodeInfo * info_ ; / / node id - > usage information <nl> + ZoneVector < NodeInfo > info_ ; / / node id - > usage information <nl> NodeVector nodes_ ; / / collected nodes <nl> NodeVector replacements_ ; / / replacements to be done after lowering <nl> Phase phase_ ; / / current phase of algorithm <nl> class RepresentationSelector { <nl> DCHECK ( node - > id ( ) < count_ ) ; <nl> return & info_ [ node - > id ( ) ] ; <nl> } <nl> - <nl> - MachineTypeUnion GetUseInfo ( Node * node ) { return GetInfo ( node ) - > use ; } <nl> } ; <nl> <nl> <nl> void SimplifiedLowering : : DoLoadBuffer ( Node * node , MachineType output_type , <nl> Node * if_true = graph ( ) - > NewNode ( common ( ) - > IfTrue ( ) , branch ) ; <nl> Node * etrue = <nl> graph ( ) - > NewNode ( machine ( ) - > Load ( type ) , buffer , index , effect , if_true ) ; <nl> - Node * vtrue = changer - > GetRepresentationFor ( etrue , type , output_type ) ; <nl> + Node * vtrue = changer - > GetRepresentationFor ( <nl> + etrue , type , RepresentationOf ( output_type ) , Truncation : : None ( ) ) ; <nl> <nl> Node * if_false = graph ( ) - > NewNode ( common ( ) - > IfFalse ( ) , branch ) ; <nl> Node * efalse = effect ; <nl> mmm a / test / cctest / compiler / test - representation - change . cc <nl> ppp b / test / cctest / compiler / test - representation - change . cc <nl> TEST ( SingleChanges ) { <nl> TEST ( SignednessInWord32 ) { <nl> RepresentationChangerTester r ; <nl> <nl> - / / TODO ( titzer ) : assume that uses of a word32 without a sign mean kTypeInt32 . <nl> CheckChange ( IrOpcode : : kChangeTaggedToInt32 , kRepTagged | kTypeInt32 , <nl> - kRepWord32 | kTypeInt32 ) ; <nl> + kRepWord32 ) ; <nl> CheckChange ( IrOpcode : : kChangeTaggedToUint32 , kRepTagged | kTypeUint32 , <nl> - kRepWord32 | kTypeUint32 ) ; <nl> + kRepWord32 ) ; <nl> CheckChange ( IrOpcode : : kChangeInt32ToFloat64 , kRepWord32 , kRepFloat64 ) ; <nl> CheckChange ( IrOpcode : : kChangeFloat64ToInt32 , kRepFloat64 | kTypeInt32 , <nl> kRepWord32 ) ; <nl> TEST ( Nops ) { <nl> / / 32 - bit floats . <nl> r . CheckNop ( kRepFloat32 , kRepFloat32 ) ; <nl> r . CheckNop ( kRepFloat32 | kTypeNumber , kRepFloat32 ) ; <nl> - r . CheckNop ( kRepFloat32 , kRepFloat32 | kTypeNumber ) ; <nl> <nl> / / 32 - bit words can be used as smaller word sizes and vice versa , because <nl> / / loads from memory implicitly sign or zero extend the value to the <nl> TEST ( TypeErrors ) { <nl> <nl> / / Wordish cannot be implicitly converted to / from comparison conditions . <nl> r . CheckTypeError ( kRepWord8 , kRepBit ) ; <nl> - r . CheckTypeError ( kRepWord8 , kRepBit | kTypeBool ) ; <nl> r . CheckTypeError ( kRepWord16 , kRepBit ) ; <nl> - r . CheckTypeError ( kRepWord16 , kRepBit | kTypeBool ) ; <nl> r . CheckTypeError ( kRepWord32 , kRepBit ) ; <nl> - r . CheckTypeError ( kRepWord32 , kRepBit | kTypeBool ) ; <nl> r . CheckTypeError ( kRepWord64 , kRepBit ) ; <nl> - r . CheckTypeError ( kRepWord64 , kRepBit | kTypeBool ) ; <nl> <nl> / / Floats cannot be implicitly converted to / from comparison conditions . <nl> r . CheckTypeError ( kRepFloat64 , kRepBit ) ; <nl> - r . CheckTypeError ( kRepFloat64 , kRepBit | kTypeBool ) ; <nl> r . CheckTypeError ( kRepBit , kRepFloat64 ) ; <nl> r . CheckTypeError ( kRepBit | kTypeBool , kRepFloat64 ) ; <nl> <nl> / / Floats cannot be implicitly converted to / from comparison conditions . <nl> r . CheckTypeError ( kRepFloat32 , kRepBit ) ; <nl> - r . CheckTypeError ( kRepFloat32 , kRepBit | kTypeBool ) ; <nl> r . CheckTypeError ( kRepBit , kRepFloat32 ) ; <nl> r . CheckTypeError ( kRepBit | kTypeBool , kRepFloat32 ) ; <nl> <nl> / / Word64 is internal and shouldn ' t be implicitly converted . <nl> - r . CheckTypeError ( kRepWord64 , kRepTagged | kTypeBool ) ; <nl> r . CheckTypeError ( kRepWord64 , kRepTagged ) ; <nl> - r . CheckTypeError ( kRepWord64 , kRepTagged | kTypeBool ) ; <nl> r . CheckTypeError ( kRepTagged , kRepWord64 ) ; <nl> r . CheckTypeError ( kRepTagged | kTypeBool , kRepWord64 ) ; <nl> <nl> / / Word64 / Word32 shouldn ' t be implicitly converted . <nl> r . CheckTypeError ( kRepWord64 , kRepWord32 ) ; <nl> r . CheckTypeError ( kRepWord32 , kRepWord64 ) ; <nl> - r . CheckTypeError ( kRepWord64 , kRepWord32 | kTypeInt32 ) ; <nl> r . CheckTypeError ( kRepWord32 | kTypeInt32 , kRepWord64 ) ; <nl> - r . CheckTypeError ( kRepWord64 , kRepWord32 | kTypeUint32 ) ; <nl> r . CheckTypeError ( kRepWord32 | kTypeUint32 , kRepWord64 ) ; <nl> <nl> for ( size_t i = 0 ; i < arraysize ( all_reps ) ; i + + ) { <nl>
|
[ turbofan ] Replace information about uses by explicit truncation in representation selection .
|
v8/v8
|
9564ffe9c16485e77e9bcaec2aa36be8ed1f16ef
|
2015-11-25T08:01:00Z
|
mmm a / Scripts / txt2ctf . py <nl> ppp b / Scripts / txt2ctf . py <nl> <nl> # ! / usr / bin / env python <nl> <nl> - # This script takes a list of dictionaries and the input file with text and converts the text file to cntk text format <nl> + # This script takes a list of dictionary files and a plain text file and converts this text input file to CNTK text format . <nl> # <nl> - # Input file should be in the following form : <nl> + # The input text file can contain N streams per line ( N TAB - separated " columns " ) and should be accompanied by N dictionary files . <nl> + # The input text file should be in the following form : <nl> # text1 TAB text2 TAB . . . TAB textN <nl> - # where each line represents one sequence across all input streams ( N ) <nl> - # Each text consists of space separated tokens ( samples ) <nl> + # . . . . . <nl> + # where each line represents one sequence across all N input streams . <nl> + # Each text consists of one or more space - separated word tokens ( samples ) . <nl> # <nl> - # Dictionaries are text files that are specified for all streams , so the # dictionaries = # columns in the input file . <nl> - # A dictionary contain a single token per line . The line number becomes the numeric index of the token . <nl> + # Dictionary files are text files that are specified for all streams , so the # dictionaries = # columns in the input file . <nl> + # A dictionary contains a single token per line . The zero - based line number becomes the numeric index of the token in the output CNTK text format file . <nl> <nl> - # The converter takes the input file and create the corresponding cntk format file using the numeric indexes of tokens . <nl> + # Example usage : <nl> + # sed - e ' s / ^ / < s > / ' - e ' s / $ / < \ / s > / ' < en . txt > en . txt1 <nl> + # sed - e ' s / ^ / < s > / ' - e ' s / $ / < \ / s > / ' < fr . txt > fr . txt1 <nl> + # paste en . txt1 fr . txt1 | txt2ctf . py - - map en . dict , fr . dict > en - fr . ctf <nl> + # <nl> <nl> import sys <nl> import argparse <nl> <nl> - class Txt2CftConverter : <nl> - " " " Class that converts tab separated sequences into cntk text format <nl> - Each line in the input file should be of form < text1 TAB . . . TAB textN > , where N is the number of streams <nl> - Each text is a list of space separated tokens ( samples ) <nl> - Each token for a stream should be inside the corresponding dictionary file , a token per line , so the line number of the token becomes <nl> - the numeric index written into the cntk text format output file " " " <nl> - <nl> - def __init__ ( self , dictionaries , inputs , output , comment ) : <nl> - self . dictionaries = dictionaries <nl> - self . inputs = inputs <nl> - self . output = output <nl> - self . comment = comment <nl> - <nl> - def convert ( self ) : <nl> - dictionaries = [ ] <nl> - for dic in self . dictionaries : <nl> - dictionaries . append ( self . _createDictionary ( dic ) ) <nl> - <nl> - if len ( self . inputs ) = = 0 : <nl> - return self . _convertInput ( dictionaries , sys . stdin ) <nl> - for input in self . inputs : <nl> - self . _convertInput ( dictionaries , input ) <nl> - <nl> - def _createDictionary ( self , dictionary ) : <nl> - result = { } <nl> - counter = 0 <nl> - for line in dictionary : <nl> - line = line . rstrip ( ' \ r \ n ' ) . strip ( ' \ t ' ) <nl> - result [ line ] = counter <nl> - counter + = 1 <nl> - return result <nl> - <nl> - def _convertInput ( self , dictionaries , input ) : <nl> + def convert ( dictionaryStreams , inputs , output , annotated ) : <nl> + # create in memory dictionaries <nl> + dictionaries = [ { line . rstrip ( ' \ r \ n ' ) . strip ( ) : index for index , line in enumerate ( dic ) } for dic in dictionaryStreams ] <nl> + <nl> + # convert inputs <nl> + for input in inputs : <nl> sequenceId = 0 <nl> - for line in input : <nl> + for index , line in enumerate ( input ) : <nl> line = line . rstrip ( ' \ r \ n ' ) <nl> - streams = line . split ( " \ t " ) <nl> - if len ( streams ) ! = len ( dictionaries ) : <nl> - raise Exception ( " Number of dictionaries { 0 } does no correspond to the number of streams in the line : { 1 } " . format ( len ( dictionaries ) , line ) ) <nl> - self . _convertStreams ( dictionaries , streams , sequenceId ) <nl> + columns = line . split ( " \ t " ) <nl> + if len ( columns ) ! = len ( dictionaries ) : <nl> + raise Exception ( " Number of dictionaries { 0 } does not correspond to the number of streams in line { 1 } : ' { 2 } ' " . format ( len ( dictionaries ) , index , line ) ) <nl> + _convertSequence ( dictionaries , columns , sequenceId , output , annotated ) <nl> sequenceId + = 1 <nl> <nl> - def _convertStreams ( self , dictionaries , streams , sequenceId ) : <nl> - tokenizedStreams = [ ] <nl> - maxLen = 0 <nl> - for index , stream in enumerate ( streams ) : <nl> - streamTokens = stream . strip ( ' ' ) . split ( ' ' ) <nl> - streamTokens = [ t for t in streamTokens if t ! = " " ] <nl> - tokenizedStreams . append ( streamTokens ) <nl> - if len ( streamTokens ) > maxLen : <nl> - maxLen = len ( streamTokens ) <nl> - <nl> - # writing to the output file <nl> - for sampleIndex in range ( maxLen ) : <nl> - self . output . write ( str ( sequenceId ) ) <nl> - for streamIndex in range ( len ( tokenizedStreams ) ) : <nl> - if len ( tokenizedStreams [ streamIndex ] ) < = sampleIndex : <nl> - self . output . write ( " \ t " ) <nl> - continue <nl> - token = tokenizedStreams [ streamIndex ] [ sampleIndex ] <nl> - value = dictionaries [ streamIndex ] [ token ] <nl> - self . output . write ( " \ t | S " + str ( streamIndex ) + " " + str ( value ) + " : 1 " ) <nl> - if self . comment : <nl> - self . output . write ( " | # " + token ) <nl> - self . output . write ( " \ n " ) <nl> + def _convertSequence ( dictionaries , streams , sequenceId , output , annotated ) : <nl> + tokensPerStream = [ [ t for t in s . strip ( ' ' ) . split ( ' ' ) if t ! = " " ] for s in streams ] <nl> + maxLen = max ( len ( tokens ) for tokens in tokensPerStream ) <nl> + <nl> + # writing to the output file <nl> + for sampleIndex in range ( maxLen ) : <nl> + output . write ( str ( sequenceId ) ) <nl> + for streamIndex in range ( len ( tokensPerStream ) ) : <nl> + if len ( tokensPerStream [ streamIndex ] ) < = sampleIndex : <nl> + output . write ( " \ t " ) <nl> + continue <nl> + token = tokensPerStream [ streamIndex ] [ sampleIndex ] <nl> + value = dictionaries [ streamIndex ] [ token ] <nl> + output . write ( " \ t | S " + str ( streamIndex ) + " " + str ( value ) + " : 1 " ) <nl> + if annotated : <nl> + output . write ( " | # " + token ) <nl> + output . write ( " \ n " ) <nl> <nl> if __name__ = = " __main__ " : <nl> - parser = argparse . ArgumentParser ( description = " Transforms text file given dictionaries into cntk text format . " ) <nl> - parser . add_argument ( ' - - map ' , help = ' List of dictionaries , given in the same order as streams in the input files ' , required = True ) <nl> - parser . add_argument ( ' - - comment ' , help = ' Whether to annotate indexes with tokens . Default is false ' , choices = [ " True " , " False " ] , default = " False " , required = False ) <nl> + parser = argparse . ArgumentParser ( description = " Transforms text file given dictionaries into CNTK text format . " ) <nl> + parser . add_argument ( ' - - map ' , help = ' List of dictionaries , given in the same order as streams in the input files ' , nargs = " + " , required = True ) <nl> + parser . add_argument ( ' - - annotated ' , help = ' Whether to annotate indices with tokens . Default is false ' , choices = [ " True " , " False " ] , default = " False " , required = False ) <nl> parser . add_argument ( ' - - output ' , help = ' Name of the output file , stdout if not given ' , default = " " , required = False ) <nl> - parser . add_argument ( ' - - input ' , help = ' Name of the inputs files , stdin if not given ' , default = " " , required = False ) <nl> + parser . add_argument ( ' - - input ' , help = ' Name of the inputs files , stdin if not given ' , default = " " , nargs = " * " , required = False ) <nl> args = parser . parse_args ( ) <nl> <nl> - # creating dictionaries <nl> - dictionaryFiles = " " . join ( str ( x ) for x in args . map ) . split ( " , " ) <nl> - dictionaries = [ open ( d ) for d in dictionaryFiles ] <nl> - <nl> # creating inputs <nl> inputs = [ sys . stdin ] <nl> - if args . input ! = " " : <nl> - inputFiles = " " . join ( str ( x ) for x in args . input ) . split ( " , " ) <nl> - inputs = [ open ( i ) for i in inputFiles ] <nl> + if len ( args . input ) ! = 0 : <nl> + inputs = [ open ( i ) for i in args . input ] <nl> <nl> - # creating outputs <nl> + # creating output <nl> output = sys . stdout <nl> if args . output ! = " " : <nl> output = open ( args . output , " w " ) <nl> <nl> - converter = Txt2CftConverter ( dictionaries , inputs , output , args . comment = = " True " ) <nl> - converter . convert ( ) <nl> + convert ( [ open ( d ) for d in args . map ] , inputs , output , args . annotated = = " True " ) <nl> <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> def _convertStreams ( self , dictionaries , streams , sequenceId ) : <nl> def test_simpleSanityCheck ( ) : <nl> dictionary1 = StringIO . StringIO ( " hello \ nmy \ nworld \ nof \ nnothing \ n " ) <nl> dictionary2 = StringIO . StringIO ( " let \ nme \ nbe \ nclear \ nabout \ nit \ n " ) <nl> - <nl> input = StringIO . StringIO ( " hello my \ tclear about \ nworld of \ tit let clear \ n " ) <nl> - <nl> output = StringIO . StringIO ( ) <nl> - converter = Txt2CftConverter ( [ dictionary1 , dictionary2 ] , [ input ] , output , False ) <nl> - converter . convert ( ) <nl> + <nl> + convert ( [ dictionary1 , dictionary2 ] , [ input ] , output , False ) <nl> <nl> expectedOutput = StringIO . StringIO ( ) <nl> expectedOutput . write ( " 0 \ t | S0 0 : 1 \ t | S1 3 : 1 \ n " ) <nl>
|
Fixing bugs
|
microsoft/CNTK
|
5cd199d6a2bd0db61c16bf858ee143f137d478fb
|
2016-06-13T08:16:23Z
|
mmm a / Makefile <nl> ppp b / Makefile <nl> TESTS = \ <nl> write_batch_test \ <nl> auto_roll_logger_test \ <nl> filelock_test \ <nl> - merge_test <nl> + merge_test \ <nl> + stringappend_test <nl> <nl> TOOLS = \ <nl> sst_dump \ <nl> cache_test : util / cache_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> coding_test : util / coding_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CXX ) util / coding_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) $ ( EXEC_LDFLAGS ) - o $ @ $ ( LDFLAGS ) <nl> <nl> + stringappend_test : utilities / merge_operators / string_append / stringappend_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> + $ ( CXX ) utilities / merge_operators / string_append / stringappend_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) $ ( EXEC_LDFLAGS ) - o $ @ $ ( LDFLAGS ) <nl> + <nl> histogram_test : util / histogram_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CXX ) util / histogram_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) $ ( EXEC_LDFLAGS ) - o $ @ $ ( LDFLAGS ) <nl> <nl> new file mode 100644 <nl> index 0000000000 . . daeccc094b <nl> Binary files / dev / null and b / utilities / . DS_Store differ <nl> new file mode 100644 <nl> index 0000000000 . . 5008ddfcf5 <nl> Binary files / dev / null and b / utilities / merge_operators / . DS_Store differ <nl> new file mode 100644 <nl> index 0000000000 . . 43e804bdd7 <nl> mmm / dev / null <nl> ppp b / utilities / merge_operators / string_append / stringappend . cc <nl> <nl> + / * * <nl> + * A MergeOperator for rocksdb / leveldb that implements string append . <nl> + * @ author Deon Nicholas ( dnicholas @ fb . com ) <nl> + * Copyright 2013 Facebook <nl> + * / <nl> + <nl> + # include " stringappend . h " <nl> + <nl> + # include < memory > <nl> + # include < assert . h > <nl> + # include " leveldb / slice . h " <nl> + # include " leveldb / merge_operator . h " <nl> + # include " utilities / merge_operators . h " <nl> + # include < iostream > <nl> + <nl> + namespace leveldb { <nl> + <nl> + <nl> + / / Constructor : also specify the delimiter character . <nl> + StringAppendOperator : : StringAppendOperator ( char delim_char ) <nl> + : delim_ ( delim_char ) { <nl> + } <nl> + <nl> + / / Implementation for the merge operation ( concatenates two strings ) <nl> + void StringAppendOperator : : Merge ( const Slice & key , <nl> + const Slice * existing_value , <nl> + const Slice & value , <nl> + std : : string * new_value , <nl> + Logger * logger ) const { <nl> + <nl> + / / Clear the * new_value for writing . <nl> + assert ( new_value ) ; <nl> + new_value - > clear ( ) ; <nl> + <nl> + if ( ! existing_value ) { <nl> + / / No existing_value . Set * new_value = value <nl> + new_value - > assign ( value . data ( ) , value . size ( ) ) ; <nl> + } else { <nl> + / / Generic append ( existing_value ! = null ) . <nl> + / / Reserve * new_value to correct size , and apply concatenation . <nl> + new_value - > reserve ( existing_value - > size ( ) + 1 + value . size ( ) ) ; <nl> + new_value - > assign ( existing_value - > data ( ) , existing_value - > size ( ) ) ; <nl> + new_value - > append ( 1 , delim_ ) ; <nl> + new_value - > append ( value . data ( ) , value . size ( ) ) ; <nl> + } <nl> + <nl> + return ; <nl> + } <nl> + <nl> + const char * StringAppendOperator : : Name ( ) const { <nl> + return " StringAppendOperator " ; <nl> + } <nl> + <nl> + } / / namespace leveldb <nl> + <nl> + <nl> + <nl> new file mode 100644 <nl> index 0000000000 . . 1cf11d0080 <nl> mmm / dev / null <nl> ppp b / utilities / merge_operators / string_append / stringappend . h <nl> <nl> + / * * <nl> + * A MergeOperator for rocksdb / leveldb that implements string append . <nl> + * @ author Deon Nicholas ( dnicholas @ fb . com ) <nl> + * Copyright 2013 Facebook <nl> + * / <nl> + <nl> + # include " leveldb / merge_operator . h " <nl> + # include " leveldb / slice . h " <nl> + <nl> + namespace leveldb { <nl> + <nl> + class StringAppendOperator : public MergeOperator { <nl> + public : <nl> + <nl> + StringAppendOperator ( char delim_char ) ; / / / Constructor : specify delimiter <nl> + <nl> + virtual void Merge ( const Slice & key , <nl> + const Slice * existing_value , <nl> + const Slice & value , <nl> + std : : string * new_value , <nl> + Logger * logger ) const override ; <nl> + <nl> + virtual const char * Name ( ) const override ; <nl> + <nl> + private : <nl> + char delim_ ; / / The delimiter is inserted between elements <nl> + <nl> + } ; <nl> + <nl> + } / / namespace leveldb <nl> + <nl> new file mode 100644 <nl> index 0000000000 . . 38119c451d <nl> mmm / dev / null <nl> ppp b / utilities / merge_operators / string_append / stringappend_test . cc <nl> <nl> + / * * <nl> + * An persistent map : key - > ( list of strings ) , using rocksdb merge . <nl> + * This file is a test - harness / use - case for the StringAppendOperator . <nl> + * <nl> + * @ author Deon Nicholas ( dnicholas @ fb . com ) <nl> + * Copyright 2013 Facebook , Inc . <nl> + * / <nl> + <nl> + # include < iostream > <nl> + # include < map > <nl> + <nl> + # include " leveldb / db . h " <nl> + # include " leveldb / merge_operator . h " <nl> + # include " utilities / merge_operators . h " <nl> + # include " utilities / merge_operators / string_append / stringappend . h " <nl> + # include " util / testharness . h " <nl> + # include " util / random . h " <nl> + <nl> + using namespace leveldb ; <nl> + <nl> + namespace leveldb { <nl> + <nl> + const std : : string kDbName = " / tmp / mergetestdb " ; / / Path to the database on file system <nl> + <nl> + / / OpenDb opens a ( possibly new ) rocksdb database with a StringAppendOperator <nl> + std : : shared_ptr < DB > OpenDb ( StringAppendOperator * append_op ) { <nl> + DB * db ; <nl> + Options options ; <nl> + options . create_if_missing = true ; <nl> + options . merge_operator = append_op ; <nl> + Status s = DB : : Open ( options , kDbName , & db ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + std : : cerr < < s . ToString ( ) < < std : : endl ; <nl> + assert ( false ) ; <nl> + } <nl> + return std : : shared_ptr < DB > ( db ) ; <nl> + } <nl> + <nl> + / / / StringLists represents a set of string - lists , each with a key - index . <nl> + / / / Supports Append ( list , string ) and Get ( list ) <nl> + class StringLists { <nl> + public : <nl> + <nl> + / / Constructor : specifies the rocksdb db <nl> + StringLists ( std : : shared_ptr < DB > db ) <nl> + : db_ ( db ) , <nl> + merge_option_ ( ) , <nl> + get_option_ ( ) { <nl> + assert ( db ) ; <nl> + } <nl> + <nl> + / / Append string val onto the list defined by key ; return true on success <nl> + bool Append ( const std : : string & key , const std : : string & val ) { <nl> + Slice valSlice ( val . data ( ) , val . size ( ) ) ; <nl> + auto s = db_ - > Merge ( merge_option_ , key , valSlice ) ; <nl> + <nl> + if ( s . ok ( ) ) { <nl> + return true ; <nl> + } else { <nl> + std : : cerr < < " ERROR " < < s . ToString ( ) < < std : : endl ; <nl> + return false ; <nl> + } <nl> + } <nl> + <nl> + / / Returns the list of strings associated with key ( or " " if does not exist ) <nl> + bool Get ( const std : : string & key , std : : string * const result ) { <nl> + assert ( result ! = NULL ) ; / / we should have a place to store the result <nl> + <nl> + auto s = db_ - > Get ( get_option_ , key , result ) ; <nl> + <nl> + if ( s . ok ( ) ) { <nl> + return true ; <nl> + } <nl> + <nl> + / / Either key does not exist , or there is some error . <nl> + * result = " " ; / / Always return empty string ( just for convenvtion ) <nl> + <nl> + / / NotFound is okay ; just return empty ( similar to std : : map ) <nl> + / / But network or db errors , etc , should fail the test ( or at least yell ) <nl> + if ( s . ToString ( ) ! = " NotFound : " ) { <nl> + std : : cerr < < " ERROR " < < s . ToString ( ) < < std : : endl ; <nl> + } <nl> + <nl> + / / Always return false if s . ok ( ) was not true <nl> + return false ; <nl> + } <nl> + <nl> + private : <nl> + std : : shared_ptr < DB > db_ ; <nl> + WriteOptions merge_option_ ; <nl> + ReadOptions get_option_ ; <nl> + <nl> + } ; <nl> + <nl> + / / THE TEST CASES BEGIN HERE <nl> + <nl> + class StringAppendOperatorTest { } ; <nl> + <nl> + TEST ( StringAppendOperatorTest , SimpleTest ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' , ' ) ; <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + slists . Append ( " k1 " , " v1 " ) ; <nl> + slists . Append ( " k1 " , " v2 " ) ; <nl> + slists . Append ( " k1 " , " v3 " ) ; <nl> + <nl> + std : : string res ; <nl> + bool status = slists . Get ( " k1 " , & res ) ; <nl> + <nl> + assert ( status ) ; <nl> + ASSERT_EQ ( res , " v1 , v2 , v3 " ) ; <nl> + } <nl> + <nl> + TEST ( StringAppendOperatorTest , SimpleDelimiterTest ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' | ' ) ; <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + slists . Append ( " k1 " , " v1 " ) ; <nl> + slists . Append ( " k1 " , " v2 " ) ; <nl> + slists . Append ( " k1 " , " v3 " ) ; <nl> + <nl> + std : : string res ; <nl> + slists . Get ( " k1 " , & res ) ; <nl> + ASSERT_EQ ( res , " v1 | v2 | v3 " ) ; <nl> + } <nl> + <nl> + TEST ( StringAppendOperatorTest , OneValueNoDelimiterTest ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' ! ' ) ; <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + slists . Append ( " random_key " , " single_val " ) ; <nl> + <nl> + std : : string res ; <nl> + slists . Get ( " random_key " , & res ) ; <nl> + ASSERT_EQ ( res , " single_val " ) ; <nl> + } <nl> + <nl> + TEST ( StringAppendOperatorTest , VariousKeys ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' \ n ' ) ; <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + slists . Append ( " c " , " asdasd " ) ; <nl> + slists . Append ( " a " , " x " ) ; <nl> + slists . Append ( " b " , " y " ) ; <nl> + slists . Append ( " a " , " t " ) ; <nl> + slists . Append ( " a " , " r " ) ; <nl> + slists . Append ( " b " , " 2 " ) ; <nl> + slists . Append ( " c " , " asdasd " ) ; <nl> + <nl> + std : : string a , b , c ; <nl> + bool sa , sb , sc ; <nl> + sa = slists . Get ( " a " , & a ) ; <nl> + sb = slists . Get ( " b " , & b ) ; <nl> + sc = slists . Get ( " c " , & c ) ; <nl> + <nl> + assert ( sa & & sb & & sc ) ; / / All three keys should have been found <nl> + <nl> + ASSERT_EQ ( a , " x \ nt \ nr " ) ; <nl> + ASSERT_EQ ( b , " y \ n2 " ) ; <nl> + ASSERT_EQ ( c , " asdasd \ nasdasd " ) ; <nl> + } <nl> + <nl> + / / Generate semi random keys / words from a small distribution . <nl> + TEST ( StringAppendOperatorTest , RandomMixGetAppend ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' ' ) ; <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + / / Generate a list of random keys and values <nl> + const int kWordCount = 15 ; <nl> + std : : string words [ ] = { " sdasd " , " triejf " , " fnjsdfn " , " dfjisdfsf " , " 342839 " , <nl> + " dsuha " , " mabuais " , " sadajsid " , " jf9834hf " , " 2d9j89 " , <nl> + " dj9823jd " , " a " , " dk02ed2dh " , " $ ( jd4h984 $ ( * " , " mabz " } ; <nl> + const int kKeyCount = 6 ; <nl> + std : : string keys [ ] = { " dhaiusdhu " , " denidw " , " daisda " , " keykey " , " muki " , <nl> + " shzassdianmd " } ; <nl> + <nl> + / / Will store a local copy of all data in order to verify correctness <nl> + std : : map < std : : string , std : : string > parallel_copy ; <nl> + <nl> + / / Generate a bunch of random queries ( Append and Get ) ! <nl> + enum query_t { APPEND_OP , GET_OP , NUM_OPS } ; <nl> + Random randomGen ( 1337 ) ; / / deterministic seed ; always get same results ! <nl> + <nl> + const int kNumQueries = 30 ; <nl> + for ( int q = 0 ; q < kNumQueries ; + + q ) { <nl> + / / Generate a random query ( Append or Get ) and random parameters <nl> + query_t query = ( query_t ) randomGen . Uniform ( ( int ) NUM_OPS ) ; <nl> + std : : string key = keys [ randomGen . Uniform ( ( int ) kKeyCount ) ] ; <nl> + std : : string word = words [ randomGen . Uniform ( ( int ) kWordCount ) ] ; <nl> + <nl> + / / Debug message . <nl> + / / std : : cout < < ( int ) query < < " " < < key < < " " < < word < < std : : endl ; <nl> + <nl> + / / Apply the query and any checks . <nl> + if ( query = = APPEND_OP ) { <nl> + <nl> + / / Apply the rocksdb test - harness Append defined above <nl> + slists . Append ( key , word ) ; / / apply the rocksdb append <nl> + <nl> + / / Apply the similar " Append " to the parallel copy <nl> + if ( parallel_copy [ key ] . size ( ) > 0 ) { <nl> + parallel_copy [ key ] + = " " + word ; <nl> + } else { <nl> + parallel_copy [ key ] = word ; <nl> + } <nl> + <nl> + } else if ( query = = GET_OP ) { <nl> + / / Assumes that a non - existent key just returns < empty > <nl> + std : : string res ; <nl> + slists . Get ( key , & res ) ; <nl> + ASSERT_EQ ( res , parallel_copy [ key ] ) ; <nl> + } <nl> + <nl> + } <nl> + <nl> + } <nl> + <nl> + TEST ( StringAppendOperatorTest , BIGRandomMixGetAppend ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' ' ) ; <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + / / Generate a list of random keys and values <nl> + const int kWordCount = 15 ; <nl> + std : : string words [ ] = { " sdasd " , " triejf " , " fnjsdfn " , " dfjisdfsf " , " 342839 " , <nl> + " dsuha " , " mabuais " , " sadajsid " , " jf9834hf " , " 2d9j89 " , <nl> + " dj9823jd " , " a " , " dk02ed2dh " , " $ ( jd4h984 $ ( * " , " mabz " } ; <nl> + const int kKeyCount = 6 ; <nl> + std : : string keys [ ] = { " dhaiusdhu " , " denidw " , " daisda " , " keykey " , " muki " , <nl> + " shzassdianmd " } ; <nl> + <nl> + / / Will store a local copy of all data in order to verify correctness <nl> + std : : map < std : : string , std : : string > parallel_copy ; <nl> + <nl> + / / Generate a bunch of random queries ( Append and Get ) ! <nl> + enum query_t { APPEND_OP , GET_OP , NUM_OPS } ; <nl> + Random randomGen ( 9138204 ) ; / / deterministic seed ; always get same results ! <nl> + <nl> + const int kNumQueries = 1000 ; <nl> + for ( int q = 0 ; q < kNumQueries ; + + q ) { <nl> + / / Generate a random query ( Append or Get ) and random parameters <nl> + query_t query = ( query_t ) randomGen . Uniform ( ( int ) NUM_OPS ) ; <nl> + std : : string key = keys [ randomGen . Uniform ( ( int ) kKeyCount ) ] ; <nl> + std : : string word = words [ randomGen . Uniform ( ( int ) kWordCount ) ] ; <nl> + <nl> + / / Debug message . <nl> + / / std : : cout < < ( int ) query < < " " < < key < < " " < < word < < std : : endl ; <nl> + <nl> + / / Apply the query and any checks . <nl> + if ( query = = APPEND_OP ) { <nl> + <nl> + / / Apply the rocksdb test - harness Append defined above <nl> + slists . Append ( key , word ) ; / / apply the rocksdb append <nl> + <nl> + / / Apply the similar " Append " to the parallel copy <nl> + if ( parallel_copy [ key ] . size ( ) > 0 ) { <nl> + parallel_copy [ key ] + = " " + word ; <nl> + } else { <nl> + parallel_copy [ key ] = word ; <nl> + } <nl> + <nl> + } else if ( query = = GET_OP ) { <nl> + / / Assumes that a non - existent key just returns < empty > <nl> + std : : string res ; <nl> + slists . Get ( key , & res ) ; <nl> + ASSERT_EQ ( res , parallel_copy [ key ] ) ; <nl> + } <nl> + <nl> + } <nl> + <nl> + } <nl> + <nl> + <nl> + TEST ( StringAppendOperatorTest , PersistentVariousKeys ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' \ n ' ) ; <nl> + <nl> + / / Perform the following operations in limited scope <nl> + { <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + slists . Append ( " c " , " asdasd " ) ; <nl> + slists . Append ( " a " , " x " ) ; <nl> + slists . Append ( " b " , " y " ) ; <nl> + slists . Append ( " a " , " t " ) ; <nl> + slists . Append ( " a " , " r " ) ; <nl> + slists . Append ( " b " , " 2 " ) ; <nl> + slists . Append ( " c " , " asdasd " ) ; <nl> + <nl> + std : : string a , b , c ; <nl> + slists . Get ( " a " , & a ) ; <nl> + slists . Get ( " b " , & b ) ; <nl> + slists . Get ( " c " , & c ) ; <nl> + <nl> + ASSERT_EQ ( a , " x \ nt \ nr " ) ; <nl> + ASSERT_EQ ( b , " y \ n2 " ) ; <nl> + ASSERT_EQ ( c , " asdasd \ nasdasd " ) ; <nl> + } <nl> + <nl> + / / Reopen the database ( the previous changes should persist / be remembered ) <nl> + { <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + slists . Append ( " c " , " bbnagnagsx " ) ; <nl> + slists . Append ( " a " , " sa " ) ; <nl> + slists . Append ( " b " , " df " ) ; <nl> + slists . Append ( " a " , " gh " ) ; <nl> + slists . Append ( " a " , " jk " ) ; <nl> + slists . Append ( " b " , " l ; " ) ; <nl> + slists . Append ( " c " , " rogosh " ) ; <nl> + <nl> + std : : string a , b , c ; <nl> + slists . Get ( " a " , & a ) ; <nl> + slists . Get ( " b " , & b ) ; <nl> + slists . Get ( " c " , & c ) ; <nl> + <nl> + ASSERT_EQ ( a , " x \ nt \ nr \ nsa \ ngh \ njk " ) ; <nl> + ASSERT_EQ ( b , " y \ n2 \ ndf \ nl ; " ) ; <nl> + ASSERT_EQ ( c , " asdasd \ nasdasd \ nbbnagnagsx \ nrogosh " ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( StringAppendOperatorTest , PersistentFlushAndCompaction ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' \ n ' ) ; <nl> + <nl> + / / Perform the following operations in limited scope <nl> + { <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + std : : string a , b , c ; <nl> + bool success ; <nl> + <nl> + / / Append , Flush , Get <nl> + slists . Append ( " c " , " asdasd " ) ; <nl> + db - > Flush ( leveldb : : FlushOptions ( ) ) ; <nl> + success = slists . Get ( " c " , & c ) ; <nl> + assert ( success = = true ) ; <nl> + ASSERT_EQ ( c , " asdasd " ) ; <nl> + <nl> + / / Append , Flush , Append , Get <nl> + slists . Append ( " a " , " x " ) ; <nl> + slists . Append ( " b " , " y " ) ; <nl> + db - > Flush ( leveldb : : FlushOptions ( ) ) ; <nl> + slists . Append ( " a " , " t " ) ; <nl> + slists . Append ( " a " , " r " ) ; <nl> + slists . Append ( " b " , " 2 " ) ; <nl> + <nl> + success = slists . Get ( " a " , & a ) ; <nl> + assert ( success = = true ) ; <nl> + ASSERT_EQ ( a , " x \ nt \ nr " ) ; <nl> + <nl> + success = slists . Get ( " b " , & b ) ; <nl> + assert ( success = = true ) ; <nl> + ASSERT_EQ ( b , " y \ n2 " ) ; <nl> + <nl> + / / Append , Get <nl> + success = slists . Append ( " c " , " asdasd " ) ; <nl> + assert ( success ) ; <nl> + success = slists . Append ( " b " , " monkey " ) ; <nl> + assert ( success ) ; <nl> + <nl> + / / I omit the " assert ( success ) " checks here . <nl> + slists . Get ( " a " , & a ) ; <nl> + slists . Get ( " b " , & b ) ; <nl> + slists . Get ( " c " , & c ) ; <nl> + <nl> + ASSERT_EQ ( a , " x \ nt \ nr " ) ; <nl> + ASSERT_EQ ( b , " y \ n2 \ nmonkey " ) ; <nl> + ASSERT_EQ ( c , " asdasd \ nasdasd " ) ; <nl> + } <nl> + <nl> + / / Reopen the database ( the previous changes should persist / be remembered ) <nl> + { <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + std : : string a , b , c ; <nl> + <nl> + / / Get ( Quick check for persistence of previous database ) <nl> + slists . Get ( " a " , & a ) ; <nl> + ASSERT_EQ ( a , " x \ nt \ nr " ) ; <nl> + <nl> + / / Append , Compact , Get <nl> + slists . Append ( " c " , " bbnagnagsx " ) ; <nl> + slists . Append ( " a " , " sa " ) ; <nl> + slists . Append ( " b " , " df " ) ; <nl> + db - > CompactRange ( nullptr , nullptr ) ; <nl> + slists . Get ( " a " , & a ) ; <nl> + slists . Get ( " b " , & b ) ; <nl> + slists . Get ( " c " , & c ) ; <nl> + ASSERT_EQ ( a , " x \ nt \ nr \ nsa " ) ; <nl> + ASSERT_EQ ( b , " y \ n2 \ nmonkey \ ndf " ) ; <nl> + ASSERT_EQ ( c , " asdasd \ nasdasd \ nbbnagnagsx " ) ; <nl> + <nl> + / / Append , Get <nl> + slists . Append ( " a " , " gh " ) ; <nl> + slists . Append ( " a " , " jk " ) ; <nl> + slists . Append ( " b " , " l ; " ) ; <nl> + slists . Append ( " c " , " rogosh " ) ; <nl> + slists . Get ( " a " , & a ) ; <nl> + slists . Get ( " b " , & b ) ; <nl> + slists . Get ( " c " , & c ) ; <nl> + ASSERT_EQ ( a , " x \ nt \ nr \ nsa \ ngh \ njk " ) ; <nl> + ASSERT_EQ ( b , " y \ n2 \ nmonkey \ ndf \ nl ; " ) ; <nl> + ASSERT_EQ ( c , " asdasd \ nasdasd \ nbbnagnagsx \ nrogosh " ) ; <nl> + <nl> + / / Compact , Get <nl> + db - > CompactRange ( nullptr , nullptr ) ; <nl> + ASSERT_EQ ( a , " x \ nt \ nr \ nsa \ ngh \ njk " ) ; <nl> + ASSERT_EQ ( b , " y \ n2 \ nmonkey \ ndf \ nl ; " ) ; <nl> + ASSERT_EQ ( c , " asdasd \ nasdasd \ nbbnagnagsx \ nrogosh " ) ; <nl> + <nl> + / / Append , Flush , Compact , Get <nl> + slists . Append ( " b " , " afcg " ) ; <nl> + db - > Flush ( leveldb : : FlushOptions ( ) ) ; <nl> + db - > CompactRange ( nullptr , nullptr ) ; <nl> + slists . Get ( " b " , & b ) ; <nl> + ASSERT_EQ ( b , " y \ n2 \ nmonkey \ ndf \ nl ; \ nafcg " ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( StringAppendOperatorTest , SimpleTestNullDelimiter ) { <nl> + DestroyDB ( kDbName , Options ( ) ) ; / / Start this test with a fresh DB <nl> + <nl> + StringAppendOperator append_op ( ' \ 0 ' ) ; <nl> + auto db = OpenDb ( & append_op ) ; <nl> + StringLists slists ( db ) ; <nl> + <nl> + slists . Append ( " k1 " , " v1 " ) ; <nl> + slists . Append ( " k1 " , " v2 " ) ; <nl> + slists . Append ( " k1 " , " v3 " ) ; <nl> + <nl> + std : : string res ; <nl> + bool status = slists . Get ( " k1 " , & res ) ; <nl> + assert ( status ) ; <nl> + <nl> + / / Construct the desired string . Default constructor doesn ' t like ' \ 0 ' chars . <nl> + std : : string checker ( " v1 , v2 , v3 " ) ; / / Verify that the string is right size . <nl> + checker [ 2 ] = ' \ 0 ' ; / / Use null delimiter instead of comma . <nl> + checker [ 5 ] = ' \ 0 ' ; <nl> + assert ( checker . size ( ) = = 8 ) ; / / Verify it is still the correct size <nl> + <nl> + / / Check that the leveldb result string matches the desired string <nl> + assert ( res . size ( ) = = checker . size ( ) ) ; <nl> + ASSERT_EQ ( res , checker ) ; <nl> + } <nl> + <nl> + <nl> + } / / namespace leveldb <nl> + <nl> + int main ( int arc , char * * argv ) { <nl> + leveldb : : test : : RunAllTests ( ) ; <nl> + return 0 ; <nl> + } <nl>
|
Implemented StringAppendOperator and unit tests .
|
facebook/rocksdb
|
accd3debbbe2b628cf3d9d160597fb6c0efdfefb
|
2013-05-13T22:09:42Z
|
mmm a / src / arm / assembler - arm - inl . h <nl> ppp b / src / arm / assembler - arm - inl . h <nl> void RelocInfo : : set_target_object ( Object * target , <nl> WriteBarrierMode write_barrier_mode , <nl> ICacheFlushMode icache_flush_mode ) { <nl> ASSERT ( IsCodeTarget ( rmode_ ) | | rmode_ = = EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! target - > IsConsString ( ) ) ; <nl> Assembler : : set_target_address_at ( pc_ , host_ , <nl> reinterpret_cast < Address > ( target ) , <nl> icache_flush_mode ) ; <nl> mmm a / src / arm64 / assembler - arm64 - inl . h <nl> ppp b / src / arm64 / assembler - arm64 - inl . h <nl> void RelocInfo : : set_target_object ( Object * target , <nl> WriteBarrierMode write_barrier_mode , <nl> ICacheFlushMode icache_flush_mode ) { <nl> ASSERT ( IsCodeTarget ( rmode_ ) | | rmode_ = = EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! target - > IsConsString ( ) ) ; <nl> Assembler : : set_target_address_at ( pc_ , host_ , <nl> reinterpret_cast < Address > ( target ) , <nl> icache_flush_mode ) ; <nl> mmm a / src / factory . cc <nl> ppp b / src / factory . cc <nl> MaybeHandle < String > Factory : : NewConsString ( Handle < String > left , <nl> } <nl> <nl> <nl> - Handle < String > Factory : : NewFlatConcatString ( Handle < String > first , <nl> - Handle < String > second ) { <nl> - int total_length = first - > length ( ) + second - > length ( ) ; <nl> - if ( first - > IsOneByteRepresentation ( ) & & second - > IsOneByteRepresentation ( ) ) { <nl> - return ConcatStringContent < uint8_t > ( <nl> - NewRawOneByteString ( total_length ) . ToHandleChecked ( ) , first , second ) ; <nl> - } else { <nl> - return ConcatStringContent < uc16 > ( <nl> - NewRawTwoByteString ( total_length ) . ToHandleChecked ( ) , first , second ) ; <nl> - } <nl> - } <nl> - <nl> - <nl> Handle < String > Factory : : NewProperSubString ( Handle < String > str , <nl> int begin , <nl> int end ) { <nl> mmm a / src / factory . h <nl> ppp b / src / factory . h <nl> class Factory V8_FINAL { <nl> MUST_USE_RESULT MaybeHandle < String > NewConsString ( Handle < String > left , <nl> Handle < String > right ) ; <nl> <nl> - / / Create a new sequential string containing the concatenation of the inputs . <nl> - Handle < String > NewFlatConcatString ( Handle < String > first , <nl> - Handle < String > second ) ; <nl> - <nl> / / Create a new string object which holds a proper substring of a string . <nl> Handle < String > NewProperSubString ( Handle < String > str , <nl> int begin , <nl> mmm a / src / hydrogen - instructions . cc <nl> ppp b / src / hydrogen - instructions . cc <nl> HInstruction * HStringAdd : : New ( Zone * zone , <nl> Handle < String > right_string = c_right - > StringValue ( ) ; <nl> / / Prevent possible exception by invalid string length . <nl> if ( left_string - > length ( ) + right_string - > length ( ) < String : : kMaxLength ) { <nl> - Handle < String > concat = zone - > isolate ( ) - > factory ( ) - > NewFlatConcatString ( <nl> + MaybeHandle < String > concat = zone - > isolate ( ) - > factory ( ) - > NewConsString ( <nl> c_left - > StringValue ( ) , c_right - > StringValue ( ) ) ; <nl> - ASSERT ( ! concat . is_null ( ) ) ; <nl> - return HConstant : : New ( zone , context , concat ) ; <nl> + return HConstant : : New ( zone , context , concat . ToHandleChecked ( ) ) ; <nl> } <nl> } <nl> } <nl> mmm a / src / ia32 / assembler - ia32 - inl . h <nl> ppp b / src / ia32 / assembler - ia32 - inl . h <nl> void RelocInfo : : set_target_object ( Object * target , <nl> WriteBarrierMode write_barrier_mode , <nl> ICacheFlushMode icache_flush_mode ) { <nl> ASSERT ( IsCodeTarget ( rmode_ ) | | rmode_ = = EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! target - > IsConsString ( ) ) ; <nl> Memory : : Object_at ( pc_ ) = target ; <nl> if ( icache_flush_mode ! = SKIP_ICACHE_FLUSH ) { <nl> CpuFeatures : : FlushICache ( pc_ , sizeof ( Address ) ) ; <nl> mmm a / src / ic . cc <nl> ppp b / src / ic . cc <nl> Handle < Code > LoadIC : : CompileHandler ( LookupResult * lookup , <nl> } <nl> case CONSTANT : { <nl> Handle < Object > constant ( lookup - > GetConstant ( ) , isolate ( ) ) ; <nl> - / / TODO ( 2803 ) : Don ' t compute a stub for cons strings because they cannot <nl> - / / be embedded into code . <nl> - if ( constant - > IsConsString ( ) ) break ; <nl> return compiler . CompileLoadConstant ( type , holder , name , constant ) ; <nl> } <nl> case NORMAL : <nl> mmm a / src / mips / assembler - mips - inl . h <nl> ppp b / src / mips / assembler - mips - inl . h <nl> void RelocInfo : : set_target_object ( Object * target , <nl> WriteBarrierMode write_barrier_mode , <nl> ICacheFlushMode icache_flush_mode ) { <nl> ASSERT ( IsCodeTarget ( rmode_ ) | | rmode_ = = EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! target - > IsConsString ( ) ) ; <nl> Assembler : : set_target_address_at ( pc_ , host_ , <nl> reinterpret_cast < Address > ( target ) , <nl> icache_flush_mode ) ; <nl> mmm a / src / mips64 / assembler - mips64 - inl . h <nl> ppp b / src / mips64 / assembler - mips64 - inl . h <nl> void RelocInfo : : set_target_object ( Object * target , <nl> WriteBarrierMode write_barrier_mode , <nl> ICacheFlushMode icache_flush_mode ) { <nl> ASSERT ( IsCodeTarget ( rmode_ ) | | rmode_ = = EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! target - > IsConsString ( ) ) ; <nl> Assembler : : set_target_address_at ( pc_ , host_ , <nl> reinterpret_cast < Address > ( target ) , <nl> icache_flush_mode ) ; <nl> mmm a / src / objects - visiting - inl . h <nl> ppp b / src / objects - visiting - inl . h <nl> template < typename StaticVisitor > <nl> void StaticMarkingVisitor < StaticVisitor > : : VisitEmbeddedPointer ( <nl> Heap * heap , RelocInfo * rinfo ) { <nl> ASSERT ( rinfo - > rmode ( ) = = RelocInfo : : EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! rinfo - > target_object ( ) - > IsConsString ( ) ) ; <nl> HeapObject * object = HeapObject : : cast ( rinfo - > target_object ( ) ) ; <nl> heap - > mark_compact_collector ( ) - > RecordRelocSlot ( rinfo , object ) ; <nl> / / TODO ( ulan ) : It could be better to record slots only for strongly embedded <nl> mmm a / src / objects . cc <nl> ppp b / src / objects . cc <nl> Handle < HeapType > PropertyCell : : UpdatedType ( Handle < PropertyCell > cell , <nl> Handle < Object > value ) { <nl> Isolate * isolate = cell - > GetIsolate ( ) ; <nl> Handle < HeapType > old_type ( cell - > type ( ) , isolate ) ; <nl> - / / TODO ( 2803 ) : Do not track ConsString as constant because they cannot be <nl> - / / embedded into code . <nl> - Handle < HeapType > new_type = value - > IsConsString ( ) | | value - > IsTheHole ( ) <nl> - ? HeapType : : Any ( isolate ) : HeapType : : Constant ( value , isolate ) ; <nl> + Handle < HeapType > new_type = value - > IsTheHole ( ) <nl> + ? HeapType : : Any ( isolate ) <nl> + : HeapType : : Constant ( value , isolate ) ; <nl> <nl> if ( new_type - > Is ( old_type ) ) { <nl> return old_type ; <nl> mmm a / src / x64 / assembler - x64 - inl . h <nl> ppp b / src / x64 / assembler - x64 - inl . h <nl> void RelocInfo : : set_target_object ( Object * target , <nl> WriteBarrierMode write_barrier_mode , <nl> ICacheFlushMode icache_flush_mode ) { <nl> ASSERT ( IsCodeTarget ( rmode_ ) | | rmode_ = = EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! target - > IsConsString ( ) ) ; <nl> Memory : : Object_at ( pc_ ) = target ; <nl> if ( icache_flush_mode ! = SKIP_ICACHE_FLUSH ) { <nl> CpuFeatures : : FlushICache ( pc_ , sizeof ( Address ) ) ; <nl> mmm a / src / x87 / assembler - x87 - inl . h <nl> ppp b / src / x87 / assembler - x87 - inl . h <nl> void RelocInfo : : set_target_object ( Object * target , <nl> WriteBarrierMode write_barrier_mode , <nl> ICacheFlushMode icache_flush_mode ) { <nl> ASSERT ( IsCodeTarget ( rmode_ ) | | rmode_ = = EMBEDDED_OBJECT ) ; <nl> - ASSERT ( ! target - > IsConsString ( ) ) ; <nl> Memory : : Object_at ( pc_ ) = target ; <nl> if ( icache_flush_mode ! = SKIP_ICACHE_FLUSH ) { <nl> CpuFeatures : : FlushICache ( pc_ , sizeof ( Address ) ) ; <nl>
|
Allow embedding of ConsString objects into code .
|
v8/v8
|
5874bd08c0a1fc992b7a618ef9bfb1931f875998
|
2014-07-15T10:51:12Z
|
mmm a / src / mongo / db / exec / write_stage_common . cpp <nl> ppp b / src / mongo / db / exec / write_stage_common . cpp <nl> bool ensureStillMatches ( const Collection * collection , <nl> / / No longer matches . <nl> return false ; <nl> } <nl> + <nl> + / / Ensure that the BSONObj underlying the WorkingSetMember is owned because the cursor ' s <nl> + / / destructor is allowed to free the memory . <nl> + member - > makeObjOwnedIfNeeded ( ) ; <nl> } <nl> return true ; <nl> } <nl>
|
SERVER - 23925 Make BSONObj underlying WSM outlive cursor on refetch .
|
mongodb/mongo
|
040f355ad944f0ed19f024413ac7a313c1e95bde
|
2016-05-02T17:10:21Z
|
mmm a / tests / release - build . sh <nl> ppp b / tests / release - build . sh <nl> if [ [ ! - f data / state / shared_memory . bin ] ] ; then <nl> echo " $ ls - la \ " $ ( pwd ) / data / state \ " " <nl> ls - la " $ ( pwd ) / data / state " <nl> echo ' Release build test not run . ' <nl> + rm - rf config data <nl> exit 2 <nl> fi <nl> # test state files for debug flag <nl> echo " Debug Byte = 0x $ DEBUG_BYTE " <nl> echo ' First kilobyte of shared_memory . bin : ' <nl> echo ' $ xxd - l 1024 shared_memory . bin ' <nl> xxd - l 1024 data / state / shared_memory . bin <nl> + rm - rf config data <nl> exit 3 <nl> \ No newline at end of file <nl>
|
Clean up after nodeos on test fail
|
EOSIO/eos
|
8db235104dd46f9ba4d5c4dd4ee88d147f9f5f2a
|
2019-09-10T17:08:24Z
|
mmm a / cocos / ui / UIListView . cpp <nl> ppp b / cocos / ui / UIListView . cpp <nl> ListView : : ListView ( ) : <nl> _model ( nullptr ) , <nl> _gravity ( Gravity : : CENTER_VERTICAL ) , <nl> _itemsMargin ( 0 . 0f ) , <nl> - _curSelectedIndex ( 0 ) , <nl> + _curSelectedIndex ( - 1 ) , <nl> _refreshViewDirty ( true ) , <nl> _listViewEventListener ( nullptr ) , <nl> _listViewEventSelector ( nullptr ) , <nl> void ListView : : insertDefaultItem ( ssize_t index ) <nl> { <nl> return ; <nl> } <nl> - Widget * newItem = _model - > clone ( ) ; <nl> - <nl> - _items . insert ( index , newItem ) ; <nl> - ScrollView : : addChild ( newItem ) ; <nl> - <nl> - remedyLayoutParameter ( newItem ) ; <nl> - <nl> - _refreshViewDirty = true ; <nl> + insertCustomItem ( _model - > clone ( ) , index ) ; <nl> } <nl> <nl> <nl> void ListView : : removeChild ( cocos2d : : Node * child , bool cleaup ) <nl> Widget * widget = dynamic_cast < Widget * > ( child ) ; <nl> if ( nullptr ! = widget ) <nl> { <nl> + if ( - 1 ! = _curSelectedIndex ) <nl> + { <nl> + auto removedIndex = getIndex ( widget ) ; <nl> + if ( _curSelectedIndex > removedIndex ) <nl> + { <nl> + _curSelectedIndex - = 1 ; <nl> + } <nl> + else if ( _curSelectedIndex = = removedIndex ) <nl> + { <nl> + _curSelectedIndex = - 1 ; <nl> + } <nl> + } <nl> _items . eraseObject ( widget ) ; <nl> } <nl> <nl> void ListView : : removeAllChildrenWithCleanup ( bool cleanup ) <nl> { <nl> ScrollView : : removeAllChildrenWithCleanup ( cleanup ) ; <nl> _items . clear ( ) ; <nl> + _curSelectedIndex = - 1 ; <nl> } <nl> <nl> void ListView : : insertCustomItem ( Widget * item , ssize_t index ) <nl> { <nl> + if ( - 1 ! = _curSelectedIndex ) <nl> + { <nl> + if ( _curSelectedIndex > = index ) <nl> + { <nl> + _curSelectedIndex + = 1 ; <nl> + } <nl> + } <nl> _items . insert ( index , item ) ; <nl> ScrollView : : addChild ( item ) ; <nl> <nl>
|
Merge pull request from yangws / issue_9382
|
cocos2d/cocos2d-x
|
241dd54424648df79481cc971f274128131ad52e
|
2015-07-21T02:27:39Z
|
mmm a / Marlin / src / lcd / language / language_es . h <nl> ppp b / Marlin / src / lcd / language / language_es . h <nl> <nl> * <nl> * / <nl> <nl> - # define DISPLAY_CHARSET_ISO10646_1 <nl> - <nl> namespace Language_es { <nl> using namespace Language_en ; / / Inherit undefined strings from English <nl> <nl> constexpr uint8_t CHARSIZE = 2 ; <nl> PROGMEM Language_Str LANGUAGE = _UxGT ( " Spanish " ) ; <nl> <nl> - PROGMEM Language_Str WELCOME_MSG = MACHINE_NAME _UxGT ( " lista " ) ; <nl> + PROGMEM Language_Str WELCOME_MSG = MACHINE_NAME _UxGT ( " Lista " ) ; <nl> + PROGMEM Language_Str MSG_MARLIN = _UxGT ( " Marlin " ) ; <nl> PROGMEM Language_Str MSG_YES = _UxGT ( " SI " ) ; <nl> PROGMEM Language_Str MSG_NO = _UxGT ( " NO " ) ; <nl> PROGMEM Language_Str MSG_BACK = _UxGT ( " Atrás " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_PREHEAT_2_SETTINGS = _UxGT ( " Precalentar " ) PREHEAT_2_LABEL _UxGT ( " Ajuste " ) ; <nl> PROGMEM Language_Str MSG_PREHEAT_CUSTOM = _UxGT ( " Precalen . Personali . " ) ; <nl> PROGMEM Language_Str MSG_COOLDOWN = _UxGT ( " Enfriar " ) ; <nl> + PROGMEM Language_Str MSG_CUTTER_FREQUENCY = _UxGT ( " Frecuencia " ) ; <nl> PROGMEM Language_Str MSG_LASER_MENU = _UxGT ( " Control Láser " ) ; <nl> PROGMEM Language_Str MSG_LASER_OFF = _UxGT ( " Láser Apagado " ) ; <nl> PROGMEM Language_Str MSG_LASER_ON = _UxGT ( " Láser Encendido " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_UBL_ACTIVATE_MESH = _UxGT ( " Activar UBL " ) ; <nl> PROGMEM Language_Str MSG_UBL_DEACTIVATE_MESH = _UxGT ( " Desactivar UBL " ) ; <nl> PROGMEM Language_Str MSG_UBL_SET_TEMP_BED = _UxGT ( " Temp . Cama " ) ; <nl> - PROGMEM Language_Str MSG_UBL_BED_TEMP_CUSTOM = _UxGT ( " Bed Temp " ) ; <nl> - PROGMEM Language_Str MSG_UBL_SET_TEMP_HOTEND = _UxGT ( " Hotend Temp " ) ; <nl> - PROGMEM Language_Str MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT ( " Hotend Temp " ) ; <nl> + PROGMEM Language_Str MSG_UBL_BED_TEMP_CUSTOM = _UxGT ( " Temp . Cama " ) ; <nl> + PROGMEM Language_Str MSG_UBL_SET_TEMP_HOTEND = _UxGT ( " Temp . Fusor " ) ; <nl> + PROGMEM Language_Str MSG_UBL_HOTEND_TEMP_CUSTOM = _UxGT ( " Temp . Fusor " ) ; <nl> PROGMEM Language_Str MSG_UBL_MESH_EDIT = _UxGT ( " Editar Mallado " ) ; <nl> PROGMEM Language_Str MSG_UBL_EDIT_CUSTOM_MESH = _UxGT ( " Edit . Mallado perso . " ) ; <nl> PROGMEM Language_Str MSG_UBL_FINE_TUNE_MESH = _UxGT ( " Ajuste fino Mallado " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_UBL_OUTPUT_MAP = _UxGT ( " Salida Mapa mallado " ) ; <nl> PROGMEM Language_Str MSG_UBL_OUTPUT_MAP_HOST = _UxGT ( " Salida para el host " ) ; <nl> PROGMEM Language_Str MSG_UBL_OUTPUT_MAP_CSV = _UxGT ( " Salida para CSV " ) ; <nl> - PROGMEM Language_Str MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT ( " Off Printer Backup " ) ; <nl> + PROGMEM Language_Str MSG_UBL_OUTPUT_MAP_BACKUP = _UxGT ( " Cópia de seg . ext " ) ; <nl> PROGMEM Language_Str MSG_UBL_INFO_UBL = _UxGT ( " Salida Info . UBL " ) ; <nl> PROGMEM Language_Str MSG_UBL_FILLIN_AMOUNT = _UxGT ( " Cantidad de relleno " ) ; <nl> PROGMEM Language_Str MSG_UBL_MANUAL_FILLIN = _UxGT ( " Relleno manual " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_UBL_STORAGE_SLOT = _UxGT ( " Huecos de memoria " ) ; <nl> PROGMEM Language_Str MSG_UBL_LOAD_MESH = _UxGT ( " Cargar Mallado cama " ) ; <nl> PROGMEM Language_Str MSG_UBL_SAVE_MESH = _UxGT ( " Guardar Mallado cama " ) ; <nl> - PROGMEM Language_Str MSG_MESH_LOADED = _UxGT ( " M117 Mallado % i Cargado " ) ; <nl> - PROGMEM Language_Str MSG_MESH_SAVED = _UxGT ( " M117 Mallado % i Guardado " ) ; <nl> + PROGMEM Language_Str MSG_MESH_LOADED = _UxGT ( " M117 Mall . % i Carga . " ) ; <nl> + PROGMEM Language_Str MSG_MESH_SAVED = _UxGT ( " M117 Mall . % i Guard . " ) ; <nl> PROGMEM Language_Str MSG_UBL_NO_STORAGE = _UxGT ( " Sin guardar " ) ; <nl> PROGMEM Language_Str MSG_UBL_SAVE_ERROR = _UxGT ( " Error : Guardar UBL " ) ; <nl> PROGMEM Language_Str MSG_UBL_RESTORE_ERROR = _UxGT ( " Error : Restaurar UBL " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_UBL_Z_OFFSET_STOPPED = _UxGT ( " Desfase de Z Parado " ) ; <nl> PROGMEM Language_Str MSG_UBL_STEP_BY_STEP_MENU = _UxGT ( " UBL Paso a Paso " ) ; <nl> PROGMEM Language_Str MSG_UBL_1_BUILD_COLD_MESH = _UxGT ( " 1 . Crear Mallado Frío " ) ; <nl> - PROGMEM Language_Str MSG_UBL_2_SMART_FILLIN = _UxGT ( " 2 . Relleno inteligente " ) ; <nl> + PROGMEM Language_Str MSG_UBL_2_SMART_FILLIN = _UxGT ( " 2 . Relleno intelig . " ) ; <nl> PROGMEM Language_Str MSG_UBL_3_VALIDATE_MESH_MENU = _UxGT ( " 3 . Validar Mallado " ) ; <nl> PROGMEM Language_Str MSG_UBL_4_FINE_TUNE_ALL = _UxGT ( " 4 . Ajustar Fino Todo " ) ; <nl> PROGMEM Language_Str MSG_UBL_5_VALIDATE_MESH_MENU = _UxGT ( " 5 . Validar Mallado " ) ; <nl> PROGMEM Language_Str MSG_UBL_6_FINE_TUNE_ALL = _UxGT ( " 6 . Ajustar Fino Todo " ) ; <nl> - PROGMEM Language_Str MSG_UBL_7_SAVE_MESH = _UxGT ( " 7 . Guardar Mallado cama " ) ; <nl> + PROGMEM Language_Str MSG_UBL_7_SAVE_MESH = _UxGT ( " 7 . Guardar Mall . cama " ) ; <nl> <nl> PROGMEM Language_Str MSG_LED_CONTROL = _UxGT ( " Control LED " ) ; <nl> PROGMEM Language_Str MSG_LEDS = _UxGT ( " Luzes " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_BED_Z = _UxGT ( " Cama Z " ) ; <nl> PROGMEM Language_Str MSG_NOZZLE = _UxGT ( " Boquilla " ) ; <nl> PROGMEM Language_Str MSG_NOZZLE_N = _UxGT ( " Boquilla ~ " ) ; <nl> + PROGMEM Language_Str MSG_NOZZLE_PARKED = _UxGT ( " Boquilla Aparcada " ) ; <nl> + PROGMEM Language_Str MSG_NOZZLE_STANDBY = _UxGT ( " Boquilla en Espera " ) ; <nl> PROGMEM Language_Str MSG_BED = _UxGT ( " Cama " ) ; <nl> PROGMEM Language_Str MSG_CHAMBER = _UxGT ( " Recinto " ) ; <nl> PROGMEM Language_Str MSG_FAN_SPEED = _UxGT ( " Ventilador " ) ; <nl> PROGMEM Language_Str MSG_FAN_SPEED_N = _UxGT ( " Ventilador ~ " ) ; <nl> - PROGMEM Language_Str MSG_EXTRA_FAN_SPEED = _UxGT ( " Vel . Ext . ventilador " ) ; <nl> - PROGMEM Language_Str MSG_EXTRA_FAN_SPEED_N = _UxGT ( " Vel . Ext . ventilador ~ " ) ; <nl> + PROGMEM Language_Str MSG_STORED_FAN_N = _UxGT ( " Vent . almacenado ~ " ) ; <nl> + PROGMEM Language_Str MSG_EXTRA_FAN_SPEED = _UxGT ( " Vel . Ext . ventil . " ) ; <nl> + PROGMEM Language_Str MSG_EXTRA_FAN_SPEED_N = _UxGT ( " Vel . Ext . ventil . ~ " ) ; <nl> + PROGMEM Language_Str MSG_CONTROLLER_FAN = _UxGT ( " Controlador Vent . " ) ; <nl> + PROGMEM Language_Str MSG_CONTROLLER_FAN_IDLE_SPEED = _UxGT ( " Velocidad en reposo " ) ; <nl> + PROGMEM Language_Str MSG_CONTROLLER_FAN_AUTO_ON = _UxGT ( " Modo Auto " ) ; <nl> + PROGMEM Language_Str MSG_CONTROLLER_FAN_SPEED = _UxGT ( " Velocidad Activa " ) ; <nl> + PROGMEM Language_Str MSG_CONTROLLER_FAN_DURATION = _UxGT ( " Periodo de reposo " ) ; <nl> PROGMEM Language_Str MSG_FLOW = _UxGT ( " Flujo " ) ; <nl> PROGMEM Language_Str MSG_FLOW_N = _UxGT ( " Flujo ~ " ) ; <nl> PROGMEM Language_Str MSG_CONTROL = _UxGT ( " Control " ) ; <nl> PROGMEM Language_Str MSG_MIN = " " LCD_STR_THERMOMETER _UxGT ( " Min " ) ; <nl> PROGMEM Language_Str MSG_MAX = " " LCD_STR_THERMOMETER _UxGT ( " Max " ) ; <nl> - PROGMEM Language_Str MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT ( " Fact " ) ; <nl> + PROGMEM Language_Str MSG_FACTOR = " " LCD_STR_THERMOMETER _UxGT ( " Factor " ) ; <nl> PROGMEM Language_Str MSG_AUTOTEMP = _UxGT ( " Temperatura Auto . " ) ; <nl> PROGMEM Language_Str MSG_LCD_ON = _UxGT ( " Encender " ) ; <nl> PROGMEM Language_Str MSG_LCD_OFF = _UxGT ( " Apagar " ) ; <nl> + PROGMEM Language_Str MSG_PID_AUTOTUNE = _UxGT ( " PID Auto - ajuste " ) ; <nl> + PROGMEM Language_Str MSG_PID_AUTOTUNE_E = _UxGT ( " PID Auto - ajuste * " ) ; <nl> + PROGMEM Language_Str MSG_PID_P = _UxGT ( " PID - P " ) ; <nl> + PROGMEM Language_Str MSG_PID_P_E = _UxGT ( " PID - P * " ) ; <nl> + PROGMEM Language_Str MSG_PID_I = _UxGT ( " PID - I " ) ; <nl> + PROGMEM Language_Str MSG_PID_I_E = _UxGT ( " PID - I * " ) ; <nl> + PROGMEM Language_Str MSG_PID_D = _UxGT ( " PID - D " ) ; <nl> + PROGMEM Language_Str MSG_PID_D_E = _UxGT ( " PID - D * " ) ; <nl> + PROGMEM Language_Str MSG_PID_C = _UxGT ( " PID - C " ) ; <nl> + PROGMEM Language_Str MSG_PID_C_E = _UxGT ( " PID - C * " ) ; <nl> + PROGMEM Language_Str MSG_PID_F = _UxGT ( " PID - F " ) ; <nl> + PROGMEM Language_Str MSG_PID_F_E = _UxGT ( " PID - F * " ) ; <nl> PROGMEM Language_Str MSG_SELECT = _UxGT ( " Seleccionar " ) ; <nl> PROGMEM Language_Str MSG_SELECT_E = _UxGT ( " Seleccionar * " ) ; <nl> PROGMEM Language_Str MSG_ACC = _UxGT ( " Aceleración " ) ; <nl> + PROGMEM Language_Str MSG_JERK = _UxGT ( " Jerk " ) ; <nl> + PROGMEM Language_Str MSG_VA_JERK = _UxGT ( " V " ) LCD_STR_A _UxGT ( " - Jerk " ) ; <nl> + PROGMEM Language_Str MSG_VB_JERK = _UxGT ( " V " ) LCD_STR_B _UxGT ( " - Jerk " ) ; <nl> + PROGMEM Language_Str MSG_VC_JERK = _UxGT ( " V " ) LCD_STR_C _UxGT ( " - Jerk " ) ; <nl> + PROGMEM Language_Str MSG_VE_JERK = _UxGT ( " Ve - Jerk " ) ; <nl> + PROGMEM Language_Str MSG_JUNCTION_DEVIATION = _UxGT ( " Desviación de Unión " ) ; <nl> PROGMEM Language_Str MSG_VELOCITY = _UxGT ( " Velocidad " ) ; <nl> + PROGMEM Language_Str MSG_VMAX_A = _UxGT ( " Vmax " ) LCD_STR_A ; <nl> + PROGMEM Language_Str MSG_VMAX_B = _UxGT ( " Vmax " ) LCD_STR_B ; <nl> + PROGMEM Language_Str MSG_VMAX_C = _UxGT ( " Vmax " ) LCD_STR_C ; <nl> + PROGMEM Language_Str MSG_VMAX_E = _UxGT ( " Vmax " ) LCD_STR_E ; <nl> + PROGMEM Language_Str MSG_VMAX_EN = _UxGT ( " Vmax * " ) ; <nl> + PROGMEM Language_Str MSG_VMIN = _UxGT ( " Vmin " ) ; <nl> PROGMEM Language_Str MSG_VTRAV_MIN = _UxGT ( " Vel . viaje min " ) ; <nl> PROGMEM Language_Str MSG_ACCELERATION = _UxGT ( " Accel " ) ; <nl> PROGMEM Language_Str MSG_AMAX_A = _UxGT ( " Acel . max " ) LCD_STR_A ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_MOTION = _UxGT ( " Movimiento " ) ; <nl> PROGMEM Language_Str MSG_FILAMENT = _UxGT ( " Filamento " ) ; <nl> PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT ( " E en mm³ " ) ; <nl> - PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT ( " Fil . Dia . " ) ; <nl> - PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT ( " Fil . Dia . * " ) ; <nl> + PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT ( " Diámetro Fil . " ) ; <nl> + PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT ( " Diámetro Fil . * " ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_UNLOAD = _UxGT ( " Descarga mm " ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_LOAD = _UxGT ( " Carga mm " ) ; <nl> PROGMEM Language_Str MSG_ADVANCE_K = _UxGT ( " Avance K " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_LOAD_EEPROM = _UxGT ( " Cargar EEPROM " ) ; <nl> PROGMEM Language_Str MSG_RESTORE_DEFAULTS = _UxGT ( " Rest . fábrica " ) ; <nl> PROGMEM Language_Str MSG_INIT_EEPROM = _UxGT ( " Inicializar EEPROM " ) ; <nl> + PROGMEM Language_Str MSG_ERR_EEPROM_CRC = _UxGT ( " Err : EEPROM CRC " ) ; <nl> + PROGMEM Language_Str MSG_ERR_EEPROM_INDEX = _UxGT ( " Err : Índice EEPROM " ) ; <nl> + PROGMEM Language_Str MSG_ERR_EEPROM_VERSION = _UxGT ( " Err : Versión EEPROM " ) ; <nl> PROGMEM Language_Str MSG_MEDIA_UPDATE = _UxGT ( " Actualizar SD / USB " ) ; <nl> PROGMEM Language_Str MSG_RESET_PRINTER = _UxGT ( " Resetear Impresora " ) ; <nl> PROGMEM Language_Str MSG_REFRESH = LCD_STR_REFRESH _UxGT ( " Recargar " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_BUTTON_RESET = _UxGT ( " Reiniciar " ) ; <nl> PROGMEM Language_Str MSG_BUTTON_CANCEL = _UxGT ( " Cancelar " ) ; <nl> PROGMEM Language_Str MSG_BUTTON_DONE = _UxGT ( " Listo " ) ; <nl> + PROGMEM Language_Str MSG_BUTTON_BACK = _UxGT ( " Retroceder " ) ; <nl> + PROGMEM Language_Str MSG_BUTTON_PROCEED = _UxGT ( " Proceder " ) ; <nl> PROGMEM Language_Str MSG_PAUSE_PRINT = _UxGT ( " Pausar impresión " ) ; <nl> PROGMEM Language_Str MSG_RESUME_PRINT = _UxGT ( " Reanudar impresión " ) ; <nl> PROGMEM Language_Str MSG_STOP_PRINT = _UxGT ( " Detener impresión " ) ; <nl> + PROGMEM Language_Str MSG_PRINTING_OBJECT = _UxGT ( " Imprimiendo Objeto " ) ; <nl> + PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT ( " Cancelar Objeto " ) ; <nl> + PROGMEM Language_Str MSG_CANCEL_OBJECT_N = _UxGT ( " Cancelar Objeto = " ) ; <nl> PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT ( " Recuper . por interr . " ) ; <nl> PROGMEM Language_Str MSG_MEDIA_MENU = _UxGT ( " Imprim . desde SD / USB " ) ; <nl> PROGMEM Language_Str MSG_NO_MEDIA = _UxGT ( " SD / USB no presente " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_PRINT_PAUSED = _UxGT ( " Impresión Pausada " ) ; <nl> PROGMEM Language_Str MSG_PRINTING = _UxGT ( " Imprimiendo . . . " ) ; <nl> PROGMEM Language_Str MSG_PRINT_ABORTED = _UxGT ( " Impresión cancelada " ) ; <nl> + PROGMEM Language_Str MSG_PRINT_DONE = _UxGT ( " Impresión Completada " ) ; <nl> PROGMEM Language_Str MSG_NO_MOVE = _UxGT ( " Sin movimiento " ) ; <nl> PROGMEM Language_Str MSG_KILLED = _UxGT ( " MUERTA " ) ; <nl> PROGMEM Language_Str MSG_STOPPED = _UxGT ( " DETENIDA " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_FILAMENT_PURGE_LENGTH = _UxGT ( " Purgar longitud " ) ; <nl> PROGMEM Language_Str MSG_TOOL_CHANGE = _UxGT ( " Cambiar Herramienta " ) ; <nl> PROGMEM Language_Str MSG_TOOL_CHANGE_ZLIFT = _UxGT ( " Aumentar Z " ) ; <nl> - PROGMEM Language_Str MSG_SINGLENOZZLE_PRIME_SPD = _UxGT ( " Prime Speed " ) ; <nl> + PROGMEM Language_Str MSG_SINGLENOZZLE_PRIME_SPD = _UxGT ( " Vel . de Cebado " ) ; <nl> PROGMEM Language_Str MSG_SINGLENOZZLE_RETRACT_SPD = _UxGT ( " Vel . de retracción " ) ; <nl> - PROGMEM Language_Str MSG_NOZZLE_STANDBY = _UxGT ( " Colocar boquilla " ) ; <nl> PROGMEM Language_Str MSG_FILAMENTCHANGE = _UxGT ( " Cambiar filamento " ) ; <nl> PROGMEM Language_Str MSG_FILAMENTCHANGE_E = _UxGT ( " Cambiar filamento * " ) ; <nl> PROGMEM Language_Str MSG_FILAMENTLOAD = _UxGT ( " Cargar filamento " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_MANUAL_DEPLOY_TOUCHMI = _UxGT ( " Subir TouchMI " ) ; <nl> PROGMEM Language_Str MSG_MANUAL_DEPLOY = _UxGT ( " Subir Sonda Z " ) ; <nl> PROGMEM Language_Str MSG_MANUAL_STOW = _UxGT ( " Bajar Sonda Z " ) ; <nl> - PROGMEM Language_Str MSG_HOME_FIRST = _UxGT ( " Origen % s % s % s Primero " ) ; <nl> - PROGMEM Language_Str MSG_ZPROBE_ZOFFSET = _UxGT ( " Desfase Z " ) ; <nl> + PROGMEM Language_Str MSG_HOME_FIRST = _UxGT ( " Origen % s % s % s Prim . " ) ; <nl> + PROGMEM Language_Str MSG_ZPROBE_OFFSETS = _UxGT ( " Desfase Sonda " ) ; <nl> + PROGMEM Language_Str MSG_ZPROBE_XOFFSET = _UxGT ( " Desfase Sonda X " ) ; <nl> + PROGMEM Language_Str MSG_ZPROBE_YOFFSET = _UxGT ( " Desfase Sonda Y " ) ; <nl> + PROGMEM Language_Str MSG_ZPROBE_ZOFFSET = _UxGT ( " Desfase Sonda Z " ) ; <nl> PROGMEM Language_Str MSG_BABYSTEP_X = _UxGT ( " Micropaso X " ) ; <nl> PROGMEM Language_Str MSG_BABYSTEP_Y = _UxGT ( " Micropaso Y " ) ; <nl> PROGMEM Language_Str MSG_BABYSTEP_Z = _UxGT ( " Micropaso Z " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_INFO_EXTRUDERS = _UxGT ( " Extrusores " ) ; <nl> PROGMEM Language_Str MSG_INFO_BAUDRATE = _UxGT ( " Baudios " ) ; <nl> PROGMEM Language_Str MSG_INFO_PROTOCOL = _UxGT ( " Protocolo " ) ; <nl> + PROGMEM Language_Str MSG_INFO_RUNAWAY_OFF = _UxGT ( " Vig . Fuga Térm . : OFF " ) ; <nl> + PROGMEM Language_Str MSG_INFO_RUNAWAY_ON = _UxGT ( " Vig . Fuga Térm . : ON " ) ; <nl> + <nl> PROGMEM Language_Str MSG_CASE_LIGHT = _UxGT ( " Luz cabina " ) ; <nl> PROGMEM Language_Str MSG_CASE_LIGHT_BRIGHTNESS = _UxGT ( " Brillo cabina " ) ; <nl> - <nl> PROGMEM Language_Str MSG_EXPECTED_PRINTER = _UxGT ( " Impresora incorrecta " ) ; <nl> <nl> # if LCD_WIDTH > = 20 <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_INFO_PRINT_LONGEST = _UxGT ( " Más larga " ) ; <nl> PROGMEM Language_Str MSG_INFO_PRINT_FILAMENT = _UxGT ( " Extruido " ) ; <nl> # endif <nl> + <nl> PROGMEM Language_Str MSG_INFO_MIN_TEMP = _UxGT ( " Temp . Mínima " ) ; <nl> PROGMEM Language_Str MSG_INFO_MAX_TEMP = _UxGT ( " Temp . Máxima " ) ; <nl> PROGMEM Language_Str MSG_INFO_PSU = _UxGT ( " Fuente alimentación " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_START_Z = _UxGT ( " Inicio Z : " ) ; <nl> PROGMEM Language_Str MSG_END_Z = _UxGT ( " Fin Z : " ) ; <nl> <nl> - PROGMEM Language_Str MSG_GAMES = _UxGT ( " Games " ) ; <nl> + PROGMEM Language_Str MSG_GAMES = _UxGT ( " Juegos " ) ; <nl> PROGMEM Language_Str MSG_BRICKOUT = _UxGT ( " Brickout " ) ; <nl> PROGMEM Language_Str MSG_INVADERS = _UxGT ( " Invaders " ) ; <nl> PROGMEM Language_Str MSG_SNAKE = _UxGT ( " Sn4k3 " ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_HEAT = _UxGT ( MSG_2_LINE ( " Pulse el botón para " , " calentar la boquilla " ) ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_HEATING = _UxGT ( MSG_2_LINE ( " Calentando boquilla " , " Espere por favor . . . " ) ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_UNLOAD = _UxGT ( MSG_2_LINE ( " Espere para " , " liberar el filamento " ) ) ; <nl> + PROGMEM Language_Str MSG_FILAMENT_CHANGE_LOAD = _UxGT ( MSG_2_LINE ( " Espere para " , " cargar el filamento " ) ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_PURGE = _UxGT ( MSG_2_LINE ( " Espere para " , " purgar el filamento " ) ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT ( MSG_2_LINE ( " Pulse para finalizar " , " la purga de filamen . " ) ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_RESUME = _UxGT ( MSG_2_LINE ( " Esperando impresora " , " para reanudar . . . " ) ) ; <nl> namespace Language_es { <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_CONT_PURGE = _UxGT ( MSG_1_LINE ( " Pulse para finalizar " ) ) ; <nl> PROGMEM Language_Str MSG_FILAMENT_CHANGE_RESUME = _UxGT ( MSG_1_LINE ( " Reanudando . . . " ) ) ; <nl> # endif <nl> - <nl> PROGMEM Language_Str MSG_TMC_DRIVERS = _UxGT ( " Controladores TMC " ) ; <nl> PROGMEM Language_Str MSG_TMC_CURRENT = _UxGT ( " Amperaje Controlador " ) ; <nl> PROGMEM Language_Str MSG_TMC_HYBRID_THRS = _UxGT ( " Límite Hibrido " ) ; <nl> PROGMEM Language_Str MSG_TMC_HOMING_THRS = _UxGT ( " Origen sin sensores " ) ; <nl> PROGMEM Language_Str MSG_TMC_STEPPING_MODE = _UxGT ( " Modo de pasos " ) ; <nl> PROGMEM Language_Str MSG_TMC_STEALTH_ENABLED = _UxGT ( " StealthChop Habilit . " ) ; <nl> - <nl> PROGMEM Language_Str MSG_SERVICE_RESET = _UxGT ( " Reiniciar " ) ; <nl> PROGMEM Language_Str MSG_SERVICE_IN = _UxGT ( " dentro : " ) ; <nl> - <nl> - PROGMEM Language_Str MSG_BACKLASH_CORRECTION = _UxGT ( " Correction " ) ; <nl> + PROGMEM Language_Str MSG_BACKLASH = _UxGT ( " Backlash " ) ; <nl> + PROGMEM Language_Str MSG_BACKLASH_A = LCD_STR_A ; <nl> + PROGMEM Language_Str MSG_BACKLASH_B = LCD_STR_B ; <nl> + PROGMEM Language_Str MSG_BACKLASH_C = LCD_STR_C ; <nl> + PROGMEM Language_Str MSG_BACKLASH_CORRECTION = _UxGT ( " Corrección " ) ; <nl> PROGMEM Language_Str MSG_BACKLASH_SMOOTHING = _UxGT ( " Suavizado " ) ; <nl> + <nl> + PROGMEM Language_Str MSG_LEVEL_X_AXIS = _UxGT ( " Nivel Eje X " ) ; <nl> + PROGMEM Language_Str MSG_AUTO_CALIBRATE = _UxGT ( " Auto Calibrar " ) ; <nl> + PROGMEM Language_Str MSG_HEATER_TIMEOUT = _UxGT ( " T . de esp . Calent . " ) ; <nl> + PROGMEM Language_Str MSG_REHEAT = _UxGT ( " Recalentar " ) ; <nl> + PROGMEM Language_Str MSG_REHEATING = _UxGT ( " Recalentando . . . " ) ; <nl> } <nl>
|
Update Spanish translation ( )
|
MarlinFirmware/Marlin
|
5158106c12faf961eb886cbc6348060ce093c340
|
2020-04-09T18:35:32Z
|
mmm a / tensorflow / python / ops / nn_ops . py <nl> ppp b / tensorflow / python / ops / nn_ops . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> + import numbers <nl> + <nl> import numpy as np <nl> <nl> from tensorflow . python . framework import common_shapes <nl> def dropout ( x , keep_prob , noise_shape = None , seed = None , name = None ) : <nl> " " " <nl> with ops . name_scope ( name , " dropout " , [ x ] ) as name : <nl> x = ops . convert_to_tensor ( x , name = " x " ) <nl> - if isinstance ( keep_prob , float ) and not 0 < keep_prob < = 1 : <nl> + if isinstance ( keep_prob , numbers . Real ) and not 0 < keep_prob < = 1 : <nl> raise ValueError ( " keep_prob must be a scalar tensor or a float in the " <nl> " range ( 0 , 1 ] , got % g " % keep_prob ) <nl> keep_prob = ops . convert_to_tensor ( keep_prob , <nl>
|
Consider that arg keep_prob to dropout might be non - float number ( )
|
tensorflow/tensorflow
|
60154a9f3d7c26cb50d165e4dd8d6e402603a73a
|
2016-08-26T17:33:40Z
|
mmm a / ELECTRON_VERSION <nl> ppp b / ELECTRON_VERSION <nl> @ @ - 1 + 1 @ @ <nl> - 7 . 0 . 0 - nightly . 20190630 <nl> \ No newline at end of file <nl> + 7 . 0 . 0 - nightly . 20190701 <nl> \ No newline at end of file <nl> mmm a / package . json <nl> ppp b / package . json <nl> <nl> { <nl> " name " : " electron " , <nl> - " version " : " 7 . 0 . 0 - nightly . 20190630 " , <nl> + " version " : " 7 . 0 . 0 - nightly . 20190701 " , <nl> " repository " : " https : / / github . com / electron / electron " , <nl> " description " : " Build cross platform desktop apps with JavaScript , HTML , and CSS " , <nl> " devDependencies " : { <nl> mmm a / shell / browser / resources / win / atom . rc <nl> ppp b / shell / browser / resources / win / atom . rc <nl> END <nl> / / <nl> <nl> VS_VERSION_INFO VERSIONINFO <nl> - FILEVERSION 7 , 0 , 0 , 20190630 <nl> - PRODUCTVERSION 7 , 0 , 0 , 20190630 <nl> + FILEVERSION 7 , 0 , 0 , 20190701 <nl> + PRODUCTVERSION 7 , 0 , 0 , 20190701 <nl> FILEFLAGSMASK 0x3fL <nl> # ifdef _DEBUG <nl> FILEFLAGS 0x1L <nl>
|
Bump v7 . 0 . 0 - nightly . 20190701
|
electron/electron
|
3173b66d005150bcb7dfdcf14b8d289d64fb23e4
|
2019-07-01T15:31:22Z
|
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> matrix : <nl> # that ' s why we need to install g + + - 6 to get the lastest version <nl> - os : linux <nl> env : <nl> - - LLVM_VERSION = 3 . 8 . 1 <nl> + - COMPILER = clang + + - 4 . 0 <nl> - SPECIAL = sanitizer <nl> addons : <nl> apt : <nl> - sources : [ ' ubuntu - toolchain - r - test ' ] <nl> - packages : g + + - 6 <nl> - compiler : clang <nl> + sources : [ ' ubuntu - toolchain - r - test ' , ' llvm - toolchain - trusty - 4 . 0 ' ] <nl> + packages : [ ' g + + - 6 ' , ' clang - 4 . 0 ' ] <nl> before_script : <nl> - make clang_sanitize <nl> <nl>
|
: construction_worker : set sanitizer to clang4
|
nlohmann/json
|
df572aca7918dbcce5ad7efb719f773acc37abc6
|
2017-08-16T05:42:57Z
|
mmm a / tools / depends / target / alsa - lib / Makefile <nl> ppp b / tools / depends / target / alsa - lib / Makefile <nl> ifeq ( $ ( OS ) , android ) <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / removeshm - 3 . patch <nl> cd $ ( PLATFORM ) ; patch - p0 < . . / timeval . patch <nl> endif <nl> + cd $ ( PLATFORM ) ; patch - p0 < . . / host - os . patch <nl> cd $ ( PLATFORM ) ; $ ( CONFIGURE ) <nl> <nl> $ ( LIBDYLIB ) : $ ( PLATFORM ) <nl> new file mode 100644 <nl> index 000000000000 . . 93e991aed23b <nl> mmm / dev / null <nl> ppp b / tools / depends / target / alsa - lib / host - os . patch <nl> <nl> + mmm configure . in 2010 - 04 - 16 12 : 11 : 05 . 000000000 + 0100 <nl> ppp + configure . in 2016 - 11 - 01 15 : 15 : 21 . 645908396 + 0000 <nl> + <nl> + <nl> + which $ { program_prefix } gcc > / dev / null 2 > & 1 & & CC = $ { program_prefix } gcc <nl> + which $ { host_cpu } - $ { host_os } - gcc > / dev / null 2 > & 1 \ <nl> + - & & CC = $ { host_cpu } - $ { host - os } - gcc <nl> + + & & CC = $ { host_cpu } - $ { host_os } - gcc <nl> + which $ { host_cpu } - $ { host_vendor } - $ { host_os } - gcc > / dev / null 2 > & 1 \ <nl> + & & CC = $ { host_cpu } - $ { host_vendor } - $ { host_os } - gcc <nl> + <nl>
|
Merge pull request from XECDesign / depends - alsa - lib - configure
|
xbmc/xbmc
|
4e403684eb2e82d0f8872503d2d8148e8184cd33
|
2016-11-02T15:14:46Z
|
mmm a / torch / csrc / autograd / input_buffer . cpp <nl> ppp b / torch / csrc / autograd / input_buffer . cpp <nl> <nl> # include " torch / csrc / autograd / input_buffer . h " <nl> <nl> + # include " torch / csrc / assertions . h " <nl> # include " torch / csrc / autograd / functions / basic_ops . h " <nl> # include " torch / csrc / utils / auto_gpu . h " <nl> <nl> InputBuffer : : InputBuffer ( size_t size ) <nl> { } <nl> <nl> void InputBuffer : : add ( size_t pos , Variable var ) { <nl> + TORCH_ASSERT ( pos > = 0 & & pos < buffer . size ( ) ) ; <nl> if ( ! var . defined ( ) ) { <nl> return ; <nl> } <nl>
|
Add assertion that ' pos ' is in - bounds ( )
|
pytorch/pytorch
|
42de0df411985e070ac44124213cef2d4005c6eb
|
2017-11-03T16:54:55Z
|
mmm a / src / she / event . h <nl> ppp b / src / she / event . h <nl> <nl> / / SHE library <nl> - / / Copyright ( C ) 2012 - 2017 David Capello <nl> + / / Copyright ( C ) 2012 - 2018 David Capello <nl> / / <nl> - / / This source file is ditributed under a BSD - like license , please <nl> - / / read LICENSE . txt for more information . <nl> + / / This file is released under the terms of the MIT license . <nl> + / / Read LICENSE . txt for more information . <nl> <nl> # ifndef SHE_EVENT_H_INCLUDED <nl> # define SHE_EVENT_H_INCLUDED <nl> mmm a / src / she / event_queue . h <nl> ppp b / src / she / event_queue . h <nl> <nl> / / SHE library <nl> - / / Copyright ( C ) 2012 - 2015 David Capello <nl> + / / Copyright ( C ) 2012 - 2018 David Capello <nl> / / <nl> - / / This source file is ditributed under a BSD - like license , please <nl> - / / read LICENSE . txt for more information . <nl> + / / This file is released under the terms of the MIT license . <nl> + / / Read LICENSE . txt for more information . <nl> <nl> # ifndef SHE_EVENT_QUEUE_H_INCLUDED <nl> # define SHE_EVENT_QUEUE_H_INCLUDED <nl>
|
Fix license header in event . h and event_queue . h
|
aseprite/aseprite
|
d82bd89d4f5158df1f14cae16e39ea227db88647
|
2018-02-20T19:04:27Z
|
mmm a / src / bench / verify_script . cpp <nl> ppp b / src / bench / verify_script . cpp <nl> static CMutableTransaction BuildSpendingTransaction ( const CScript & scriptSig , co <nl> txSpend . nLockTime = 0 ; <nl> txSpend . vin . resize ( 1 ) ; <nl> txSpend . vout . resize ( 1 ) ; <nl> - txSpend . wit . vtxinwit . resize ( 1 ) ; <nl> txSpend . vin [ 0 ] . prevout . hash = txCredit . GetHash ( ) ; <nl> txSpend . vin [ 0 ] . prevout . n = 0 ; <nl> txSpend . vin [ 0 ] . scriptSig = scriptSig ; <nl> static void VerifyScriptBench ( benchmark : : State & state ) <nl> CScript witScriptPubkey = CScript ( ) < < OP_DUP < < OP_HASH160 < < ToByteVector ( pubkeyHash ) < < OP_EQUALVERIFY < < OP_CHECKSIG ; <nl> CTransaction txCredit = BuildCreditingTransaction ( scriptPubKey ) ; <nl> CMutableTransaction txSpend = BuildSpendingTransaction ( scriptSig , txCredit ) ; <nl> - CScriptWitness & witness = txSpend . wit . vtxinwit [ 0 ] . scriptWitness ; <nl> + CScriptWitness & witness = txSpend . vin [ 0 ] . scriptWitness ; <nl> witness . stack . emplace_back ( ) ; <nl> key . Sign ( SignatureHash ( witScriptPubkey , txSpend , 0 , SIGHASH_ALL , txCredit . vout [ 0 ] . nValue , SIGVERSION_WITNESS_V0 ) , witness . stack . back ( ) , 0 ) ; <nl> witness . stack . back ( ) . push_back ( static_cast < unsigned char > ( SIGHASH_ALL ) ) ; <nl> static void VerifyScriptBench ( benchmark : : State & state ) <nl> bool success = VerifyScript ( <nl> txSpend . vin [ 0 ] . scriptSig , <nl> txCredit . vout [ 0 ] . scriptPubKey , <nl> - & txSpend . wit . vtxinwit [ 0 ] . scriptWitness , <nl> + & txSpend . vin [ 0 ] . scriptWitness , <nl> flags , <nl> MutableTransactionSignatureChecker ( & txSpend , 0 , txCredit . vout [ 0 ] . nValue ) , <nl> & err ) ; <nl> mmm a / src / bitcoin - tx . cpp <nl> ppp b / src / bitcoin - tx . cpp <nl> static void MutateTxSign ( CMutableTransaction & tx , const std : : string & flagStr ) <nl> sigdata = CombineSignatures ( prevPubKey , MutableTransactionSignatureChecker ( & mergedTx , i , amount ) , sigdata , DataFromTransaction ( txv , i ) ) ; <nl> UpdateTransaction ( mergedTx , i , sigdata ) ; <nl> <nl> - if ( ! VerifyScript ( txin . scriptSig , prevPubKey , mergedTx . wit . vtxinwit . size ( ) > i ? & mergedTx . wit . vtxinwit [ i ] . scriptWitness : NULL , STANDARD_SCRIPT_VERIFY_FLAGS , MutableTransactionSignatureChecker ( & mergedTx , i , amount ) ) ) <nl> + if ( ! VerifyScript ( txin . scriptSig , prevPubKey , & txin . scriptWitness , STANDARD_SCRIPT_VERIFY_FLAGS , MutableTransactionSignatureChecker ( & mergedTx , i , amount ) ) ) <nl> fComplete = false ; <nl> } <nl> <nl> mmm a / src / core_memusage . h <nl> ppp b / src / core_memusage . h <nl> static inline size_t RecursiveDynamicUsage ( const COutPoint & out ) { <nl> } <nl> <nl> static inline size_t RecursiveDynamicUsage ( const CTxIn & in ) { <nl> - return RecursiveDynamicUsage ( in . scriptSig ) + RecursiveDynamicUsage ( in . prevout ) ; <nl> - } <nl> - <nl> - static inline size_t RecursiveDynamicUsage ( const CTxOut & out ) { <nl> - return RecursiveDynamicUsage ( out . scriptPubKey ) ; <nl> - } <nl> - <nl> - static inline size_t RecursiveDynamicUsage ( const CScriptWitness & scriptWit ) { <nl> - size_t mem = memusage : : DynamicUsage ( scriptWit . stack ) ; <nl> - for ( std : : vector < std : : vector < unsigned char > > : : const_iterator it = scriptWit . stack . begin ( ) ; it ! = scriptWit . stack . end ( ) ; it + + ) { <nl> - mem + = memusage : : DynamicUsage ( * it ) ; <nl> + size_t mem = RecursiveDynamicUsage ( in . scriptSig ) + RecursiveDynamicUsage ( in . prevout ) + memusage : : DynamicUsage ( in . scriptWitness . stack ) ; <nl> + for ( std : : vector < std : : vector < unsigned char > > : : const_iterator it = in . scriptWitness . stack . begin ( ) ; it ! = in . scriptWitness . stack . end ( ) ; it + + ) { <nl> + mem + = memusage : : DynamicUsage ( * it ) ; <nl> } <nl> return mem ; <nl> } <nl> <nl> - static inline size_t RecursiveDynamicUsage ( const CTxInWitness & txinwit ) { <nl> - return RecursiveDynamicUsage ( txinwit . scriptWitness ) ; <nl> - } <nl> - <nl> - static inline size_t RecursiveDynamicUsage ( const CTxWitness & txwit ) { <nl> - size_t mem = memusage : : DynamicUsage ( txwit . vtxinwit ) ; <nl> - for ( std : : vector < CTxInWitness > : : const_iterator it = txwit . vtxinwit . begin ( ) ; it ! = txwit . vtxinwit . end ( ) ; it + + ) { <nl> - mem + = RecursiveDynamicUsage ( * it ) ; <nl> - } <nl> - return mem ; <nl> + static inline size_t RecursiveDynamicUsage ( const CTxOut & out ) { <nl> + return RecursiveDynamicUsage ( out . scriptPubKey ) ; <nl> } <nl> <nl> static inline size_t RecursiveDynamicUsage ( const CTransaction & tx ) { <nl> - size_t mem = memusage : : DynamicUsage ( tx . vin ) + memusage : : DynamicUsage ( tx . vout ) + RecursiveDynamicUsage ( tx . wit ) ; <nl> + size_t mem = memusage : : DynamicUsage ( tx . vin ) + memusage : : DynamicUsage ( tx . vout ) ; <nl> for ( std : : vector < CTxIn > : : const_iterator it = tx . vin . begin ( ) ; it ! = tx . vin . end ( ) ; it + + ) { <nl> mem + = RecursiveDynamicUsage ( * it ) ; <nl> } <nl> static inline size_t RecursiveDynamicUsage ( const CTransaction & tx ) { <nl> } <nl> <nl> static inline size_t RecursiveDynamicUsage ( const CMutableTransaction & tx ) { <nl> - size_t mem = memusage : : DynamicUsage ( tx . vin ) + memusage : : DynamicUsage ( tx . vout ) + RecursiveDynamicUsage ( tx . wit ) ; <nl> + size_t mem = memusage : : DynamicUsage ( tx . vin ) + memusage : : DynamicUsage ( tx . vout ) ; <nl> for ( std : : vector < CTxIn > : : const_iterator it = tx . vin . begin ( ) ; it ! = tx . vin . end ( ) ; it + + ) { <nl> mem + = RecursiveDynamicUsage ( * it ) ; <nl> } <nl> mmm a / src / core_write . cpp <nl> ppp b / src / core_write . cpp <nl> void TxToUniv ( const CTransaction & tx , const uint256 & hashBlock , UniValue & entry ) <nl> o . pushKV ( " asm " , ScriptToAsmStr ( txin . scriptSig , true ) ) ; <nl> o . pushKV ( " hex " , HexStr ( txin . scriptSig . begin ( ) , txin . scriptSig . end ( ) ) ) ; <nl> in . pushKV ( " scriptSig " , o ) ; <nl> - if ( ! tx . wit . IsNull ( ) & & i < tx . wit . vtxinwit . size ( ) & & ! tx . wit . vtxinwit [ i ] . IsNull ( ) ) { <nl> + if ( ! tx . vin [ i ] . scriptWitness . IsNull ( ) ) { <nl> UniValue txinwitness ( UniValue : : VARR ) ; <nl> - for ( const auto & item : tx . wit . vtxinwit [ i ] . scriptWitness . stack ) { <nl> + for ( const auto & item : tx . vin [ i ] . scriptWitness . stack ) { <nl> txinwitness . push_back ( HexStr ( item . begin ( ) , item . end ( ) ) ) ; <nl> } <nl> in . pushKV ( " txinwitness " , txinwitness ) ; <nl> mmm a / src / miner . cpp <nl> ppp b / src / miner . cpp <nl> bool BlockAssembler : : TestPackageTransactions ( const CTxMemPool : : setEntries & packa <nl> BOOST_FOREACH ( const CTxMemPool : : txiter it , package ) { <nl> if ( ! IsFinalTx ( it - > GetTx ( ) , nHeight , nLockTimeCutoff ) ) <nl> return false ; <nl> - if ( ! fIncludeWitness & & ! it - > GetTx ( ) . wit . IsNull ( ) ) <nl> + if ( ! fIncludeWitness & & it - > GetTx ( ) . HasWitness ( ) ) <nl> return false ; <nl> if ( fNeedSizeAccounting ) { <nl> uint64_t nTxSize = : : GetSerializeSize ( it - > GetTx ( ) , SER_NETWORK , PROTOCOL_VERSION ) ; <nl> void BlockAssembler : : addPriorityTxs ( ) <nl> } <nl> <nl> / / cannot accept witness transactions into a non - witness block <nl> - if ( ! fIncludeWitness & & ! iter - > GetTx ( ) . wit . IsNull ( ) ) <nl> + if ( ! fIncludeWitness & & iter - > GetTx ( ) . HasWitness ( ) ) <nl> continue ; <nl> <nl> / / If tx is dependent on other mempool txs which haven ' t yet been included <nl> mmm a / src / net_processing . cpp <nl> ppp b / src / net_processing . cpp <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv , <nl> / / Probably non - standard or insufficient fee / priority <nl> LogPrint ( " mempool " , " removed orphan tx % s \ n " , orphanHash . ToString ( ) ) ; <nl> vEraseQueue . push_back ( orphanHash ) ; <nl> - if ( orphanTx . wit . IsNull ( ) & & ! stateDummy . CorruptionPossible ( ) ) { <nl> + if ( ! orphanTx . HasWitness ( ) & & ! stateDummy . CorruptionPossible ( ) ) { <nl> / / Do not use rejection cache for witness transactions or <nl> / / witness - stripped transactions , as they can have been malleated . <nl> / / See https : / / github . com / bitcoin / bitcoin / issues / 8279 for details . <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv , <nl> LogPrint ( " mempool " , " not keeping orphan with rejected parents % s \ n " , tx . GetHash ( ) . ToString ( ) ) ; <nl> } <nl> } else { <nl> - if ( tx . wit . IsNull ( ) & & ! state . CorruptionPossible ( ) ) { <nl> + if ( ! tx . HasWitness ( ) & & ! state . CorruptionPossible ( ) ) { <nl> / / Do not use rejection cache for witness transactions or <nl> / / witness - stripped transactions , as they can have been malleated . <nl> / / See https : / / github . com / bitcoin / bitcoin / issues / 8279 for details . <nl> mmm a / src / policy / policy . cpp <nl> ppp b / src / policy / policy . cpp <nl> bool IsWitnessStandard ( const CTransaction & tx , const CCoinsViewCache & mapInputs ) <nl> { <nl> / / We don ' t care if witness for this input is empty , since it must not be bloated . <nl> / / If the script is invalid without witness , it would be caught sooner or later during validation . <nl> - if ( tx . wit . vtxinwit [ i ] . IsNull ( ) ) <nl> + if ( tx . vin [ i ] . scriptWitness . IsNull ( ) ) <nl> continue ; <nl> <nl> const CTxOut & prev = mapInputs . GetOutputFor ( tx . vin [ i ] ) ; <nl> bool IsWitnessStandard ( const CTransaction & tx , const CCoinsViewCache & mapInputs ) <nl> <nl> / / Check P2WSH standard limits <nl> if ( witnessversion = = 0 & & witnessprogram . size ( ) = = 32 ) { <nl> - if ( tx . wit . vtxinwit [ i ] . scriptWitness . stack . back ( ) . size ( ) > MAX_STANDARD_P2WSH_SCRIPT_SIZE ) <nl> + if ( tx . vin [ i ] . scriptWitness . stack . back ( ) . size ( ) > MAX_STANDARD_P2WSH_SCRIPT_SIZE ) <nl> return false ; <nl> - size_t sizeWitnessStack = tx . wit . vtxinwit [ i ] . scriptWitness . stack . size ( ) - 1 ; <nl> + size_t sizeWitnessStack = tx . vin [ i ] . scriptWitness . stack . size ( ) - 1 ; <nl> if ( sizeWitnessStack > MAX_STANDARD_P2WSH_STACK_ITEMS ) <nl> return false ; <nl> for ( unsigned int j = 0 ; j < sizeWitnessStack ; j + + ) { <nl> - if ( tx . wit . vtxinwit [ i ] . scriptWitness . stack [ j ] . size ( ) > MAX_STANDARD_P2WSH_STACK_ITEM_SIZE ) <nl> + if ( tx . vin [ i ] . scriptWitness . stack [ j ] . size ( ) > MAX_STANDARD_P2WSH_STACK_ITEM_SIZE ) <nl> return false ; <nl> } <nl> } <nl> mmm a / src / primitives / transaction . cpp <nl> ppp b / src / primitives / transaction . cpp <nl> std : : string CTxOut : : ToString ( ) const <nl> } <nl> <nl> CMutableTransaction : : CMutableTransaction ( ) : nVersion ( CTransaction : : CURRENT_VERSION ) , nLockTime ( 0 ) { } <nl> - CMutableTransaction : : CMutableTransaction ( const CTransaction & tx ) : nVersion ( tx . nVersion ) , vin ( tx . vin ) , vout ( tx . vout ) , wit ( tx . wit ) , nLockTime ( tx . nLockTime ) { } <nl> + CMutableTransaction : : CMutableTransaction ( const CTransaction & tx ) : nVersion ( tx . nVersion ) , vin ( tx . vin ) , vout ( tx . vout ) , nLockTime ( tx . nLockTime ) { } <nl> <nl> uint256 CMutableTransaction : : GetHash ( ) const <nl> { <nl> uint256 CTransaction : : GetWitnessHash ( ) const <nl> <nl> / * For backward compatibility , the hash is initialized to 0 . TODO : remove the need for this default constructor entirely . * / <nl> CTransaction : : CTransaction ( ) : nVersion ( CTransaction : : CURRENT_VERSION ) , vin ( ) , vout ( ) , nLockTime ( 0 ) , hash ( ) { } <nl> - CTransaction : : CTransaction ( const CMutableTransaction & tx ) : nVersion ( tx . nVersion ) , vin ( tx . vin ) , vout ( tx . vout ) , wit ( tx . wit ) , nLockTime ( tx . nLockTime ) , hash ( ComputeHash ( ) ) { } <nl> - CTransaction : : CTransaction ( CMutableTransaction & & tx ) : nVersion ( tx . nVersion ) , vin ( std : : move ( tx . vin ) ) , vout ( std : : move ( tx . vout ) ) , wit ( std : : move ( tx . wit ) ) , nLockTime ( tx . nLockTime ) , hash ( ComputeHash ( ) ) { } <nl> + CTransaction : : CTransaction ( const CMutableTransaction & tx ) : nVersion ( tx . nVersion ) , vin ( tx . vin ) , vout ( tx . vout ) , nLockTime ( tx . nLockTime ) , hash ( ComputeHash ( ) ) { } <nl> + CTransaction : : CTransaction ( CMutableTransaction & & tx ) : nVersion ( tx . nVersion ) , vin ( std : : move ( tx . vin ) ) , vout ( std : : move ( tx . vout ) ) , nLockTime ( tx . nLockTime ) , hash ( ComputeHash ( ) ) { } <nl> <nl> CAmount CTransaction : : GetValueOut ( ) const <nl> { <nl> std : : string CTransaction : : ToString ( ) const <nl> nLockTime ) ; <nl> for ( unsigned int i = 0 ; i < vin . size ( ) ; i + + ) <nl> str + = " " + vin [ i ] . ToString ( ) + " \ n " ; <nl> - for ( unsigned int i = 0 ; i < wit . vtxinwit . size ( ) ; i + + ) <nl> - str + = " " + wit . vtxinwit [ i ] . scriptWitness . ToString ( ) + " \ n " ; <nl> + for ( unsigned int i = 0 ; i < vin . size ( ) ; i + + ) <nl> + str + = " " + vin [ i ] . scriptWitness . ToString ( ) + " \ n " ; <nl> for ( unsigned int i = 0 ; i < vout . size ( ) ; i + + ) <nl> str + = " " + vout [ i ] . ToString ( ) + " \ n " ; <nl> return str ; <nl> mmm a / src / primitives / transaction . h <nl> ppp b / src / primitives / transaction . h <nl> class CTxIn <nl> COutPoint prevout ; <nl> CScript scriptSig ; <nl> uint32_t nSequence ; <nl> + CScriptWitness scriptWitness ; / / ! Only serialized through CTransaction <nl> <nl> / * Setting nSequence to this value for every input in a transaction <nl> * disables nLockTime . * / <nl> class CTxOut <nl> std : : string ToString ( ) const ; <nl> } ; <nl> <nl> - class CTxInWitness <nl> - { <nl> - public : <nl> - CScriptWitness scriptWitness ; <nl> - <nl> - ADD_SERIALIZE_METHODS ; <nl> - <nl> - template < typename Stream , typename Operation > <nl> - inline void SerializationOp ( Stream & s , Operation ser_action ) <nl> - { <nl> - READWRITE ( scriptWitness . stack ) ; <nl> - } <nl> - <nl> - bool IsNull ( ) const { return scriptWitness . IsNull ( ) ; } <nl> - <nl> - CTxInWitness ( ) { } <nl> - } ; <nl> - <nl> - class CTxWitness <nl> - { <nl> - public : <nl> - / * * In case vtxinwit is missing , all entries are treated as if they were empty CTxInWitnesses * / <nl> - std : : vector < CTxInWitness > vtxinwit ; <nl> - <nl> - ADD_SERIALIZE_METHODS ; <nl> - <nl> - bool IsEmpty ( ) const { return vtxinwit . empty ( ) ; } <nl> - <nl> - bool IsNull ( ) const <nl> - { <nl> - for ( size_t n = 0 ; n < vtxinwit . size ( ) ; n + + ) { <nl> - if ( ! vtxinwit [ n ] . IsNull ( ) ) { <nl> - return false ; <nl> - } <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - void SetNull ( ) <nl> - { <nl> - vtxinwit . clear ( ) ; <nl> - } <nl> - <nl> - template < typename Stream , typename Operation > <nl> - inline void SerializationOp ( Stream & s , Operation ser_action ) <nl> - { <nl> - for ( size_t n = 0 ; n < vtxinwit . size ( ) ; n + + ) { <nl> - READWRITE ( vtxinwit [ n ] ) ; <nl> - } <nl> - if ( IsNull ( ) ) { <nl> - / * It ' s illegal to encode a witness when all vtxinwit entries are empty . * / <nl> - throw std : : ios_base : : failure ( " Superfluous witness record " ) ; <nl> - } <nl> - } <nl> - } ; <nl> - <nl> struct CMutableTransaction ; <nl> <nl> / * * <nl> inline void UnserializeTransaction ( TxType & tx , Stream & s ) { <nl> unsigned char flags = 0 ; <nl> tx . vin . clear ( ) ; <nl> tx . vout . clear ( ) ; <nl> - tx . wit . SetNull ( ) ; <nl> / * Try to read the vin . In case the dummy is there , this will be read as an empty vector . * / <nl> s > > tx . vin ; <nl> if ( tx . vin . size ( ) = = 0 & & fAllowWitness ) { <nl> inline void UnserializeTransaction ( TxType & tx , Stream & s ) { <nl> if ( ( flags & 1 ) & & fAllowWitness ) { <nl> / * The witness flag is present , and we support witnesses . * / <nl> flags ^ = 1 ; <nl> - tx . wit . vtxinwit . resize ( tx . vin . size ( ) ) ; <nl> - s > > tx . wit ; <nl> + for ( size_t i = 0 ; i < tx . vin . size ( ) ; i + + ) { <nl> + s > > tx . vin [ i ] . scriptWitness . stack ; <nl> + } <nl> } <nl> if ( flags ) { <nl> / * Unknown flag in the serialization * / <nl> inline void SerializeTransaction ( const TxType & tx , Stream & s ) { <nl> s < < tx . nVersion ; <nl> unsigned char flags = 0 ; <nl> / / Consistency check <nl> - assert ( tx . wit . vtxinwit . size ( ) < = tx . vin . size ( ) ) ; <nl> if ( fAllowWitness ) { <nl> / * Check whether witnesses need to be serialized . * / <nl> - if ( ! tx . wit . IsNull ( ) ) { <nl> + if ( tx . HasWitness ( ) ) { <nl> flags | = 1 ; <nl> } <nl> } <nl> inline void SerializeTransaction ( const TxType & tx , Stream & s ) { <nl> s < < tx . vout ; <nl> if ( flags & 1 ) { <nl> for ( size_t i = 0 ; i < tx . vin . size ( ) ; i + + ) { <nl> - if ( i < tx . wit . vtxinwit . size ( ) ) { <nl> - s < < tx . wit . vtxinwit [ i ] ; <nl> - } else { <nl> - s < < CTxInWitness ( ) ; <nl> - } <nl> + s < < tx . vin [ i ] . scriptWitness . stack ; <nl> } <nl> } <nl> s < < tx . nLockTime ; <nl> class CTransaction <nl> const int32_t nVersion ; <nl> const std : : vector < CTxIn > vin ; <nl> const std : : vector < CTxOut > vout ; <nl> - CTxWitness wit ; / / Not const : can change without invalidating the txid cache <nl> const uint32_t nLockTime ; <nl> <nl> private : <nl> class CTransaction <nl> } <nl> <nl> std : : string ToString ( ) const ; <nl> + <nl> + bool HasWitness ( ) const <nl> + { <nl> + for ( size_t i = 0 ; i < vin . size ( ) ; i + + ) { <nl> + if ( ! vin [ i ] . scriptWitness . IsNull ( ) ) { <nl> + return true ; <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> } ; <nl> <nl> / * * A mutable version of CTransaction . * / <nl> struct CMutableTransaction <nl> int32_t nVersion ; <nl> std : : vector < CTxIn > vin ; <nl> std : : vector < CTxOut > vout ; <nl> - CTxWitness wit ; <nl> uint32_t nLockTime ; <nl> <nl> CMutableTransaction ( ) ; <nl> struct CMutableTransaction <nl> * fly , as opposed to GetHash ( ) in CTransaction , which uses a cached result . <nl> * / <nl> uint256 GetHash ( ) const ; <nl> + <nl> + friend bool operator = = ( const CMutableTransaction & a , const CMutableTransaction & b ) <nl> + { <nl> + return a . GetHash ( ) = = b . GetHash ( ) ; <nl> + } <nl> + <nl> + bool HasWitness ( ) const <nl> + { <nl> + for ( size_t i = 0 ; i < vin . size ( ) ; i + + ) { <nl> + if ( ! vin [ i ] . scriptWitness . IsNull ( ) ) { <nl> + return true ; <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> } ; <nl> <nl> typedef std : : shared_ptr < const CTransaction > CTransactionRef ; <nl> mmm a / src / rpc / rawtransaction . cpp <nl> ppp b / src / rpc / rawtransaction . cpp <nl> void TxToJSON ( const CTransaction & tx , const uint256 hashBlock , UniValue & entry ) <nl> o . push_back ( Pair ( " hex " , HexStr ( txin . scriptSig . begin ( ) , txin . scriptSig . end ( ) ) ) ) ; <nl> in . push_back ( Pair ( " scriptSig " , o ) ) ; <nl> } <nl> - if ( ! tx . wit . IsNull ( ) ) { <nl> - if ( ! tx . wit . vtxinwit [ i ] . IsNull ( ) ) { <nl> + if ( tx . HasWitness ( ) ) { <nl> UniValue txinwitness ( UniValue : : VARR ) ; <nl> - for ( unsigned int j = 0 ; j < tx . wit . vtxinwit [ i ] . scriptWitness . stack . size ( ) ; j + + ) { <nl> - std : : vector < unsigned char > item = tx . wit . vtxinwit [ i ] . scriptWitness . stack [ j ] ; <nl> + for ( unsigned int j = 0 ; j < tx . vin [ i ] . scriptWitness . stack . size ( ) ; j + + ) { <nl> + std : : vector < unsigned char > item = tx . vin [ i ] . scriptWitness . stack [ j ] ; <nl> txinwitness . push_back ( HexStr ( item . begin ( ) , item . end ( ) ) ) ; <nl> } <nl> in . push_back ( Pair ( " txinwitness " , txinwitness ) ) ; <nl> - } <nl> - <nl> } <nl> in . push_back ( Pair ( " sequence " , ( int64_t ) txin . nSequence ) ) ; <nl> vin . push_back ( in ) ; <nl> UniValue signrawtransaction ( const JSONRPCRequest & request ) <nl> UpdateTransaction ( mergedTx , i , sigdata ) ; <nl> <nl> ScriptError serror = SCRIPT_ERR_OK ; <nl> - if ( ! VerifyScript ( txin . scriptSig , prevPubKey , mergedTx . wit . vtxinwit . size ( ) > i ? & mergedTx . wit . vtxinwit [ i ] . scriptWitness : NULL , STANDARD_SCRIPT_VERIFY_FLAGS , TransactionSignatureChecker ( & txConst , i , amount ) , & serror ) ) { <nl> + if ( ! VerifyScript ( txin . scriptSig , prevPubKey , & txin . scriptWitness , STANDARD_SCRIPT_VERIFY_FLAGS , TransactionSignatureChecker ( & txConst , i , amount ) , & serror ) ) { <nl> TxInErrorToJSON ( txin , vErrors , ScriptErrorString ( serror ) ) ; <nl> } <nl> } <nl> mmm a / src / script / bitcoinconsensus . cpp <nl> ppp b / src / script / bitcoinconsensus . cpp <nl> static int verify_script ( const unsigned char * scriptPubKey , unsigned int scriptP <nl> <nl> / / Regardless of the verification result , the tx did not error . <nl> set_error ( err , bitcoinconsensus_ERR_OK ) ; <nl> + <nl> PrecomputedTransactionData txdata ( tx ) ; <nl> - return VerifyScript ( tx . vin [ nIn ] . scriptSig , CScript ( scriptPubKey , scriptPubKey + scriptPubKeyLen ) , nIn < tx . wit . vtxinwit . size ( ) ? & tx . wit . vtxinwit [ nIn ] . scriptWitness : NULL , flags , TransactionSignatureChecker ( & tx , nIn , amount , txdata ) , NULL ) ; <nl> + return VerifyScript ( tx . vin [ nIn ] . scriptSig , CScript ( scriptPubKey , scriptPubKey + scriptPubKeyLen ) , & tx . vin [ nIn ] . scriptWitness , flags , TransactionSignatureChecker ( & tx , nIn , amount , txdata ) , NULL ) ; <nl> } catch ( const std : : exception & ) { <nl> return set_error ( err , bitcoinconsensus_ERR_TX_DESERIALIZE ) ; / / Error deserializing <nl> } <nl> mmm a / src / script / script . h <nl> ppp b / src / script / script . h <nl> struct CScriptWitness <nl> <nl> bool IsNull ( ) const { return stack . empty ( ) ; } <nl> <nl> + void SetNull ( ) { stack . clear ( ) ; stack . shrink_to_fit ( ) ; } <nl> + <nl> std : : string ToString ( ) const ; <nl> } ; <nl> <nl> mmm a / src / script / sign . cpp <nl> ppp b / src / script / sign . cpp <nl> SignatureData DataFromTransaction ( const CMutableTransaction & tx , unsigned int nI <nl> SignatureData data ; <nl> assert ( tx . vin . size ( ) > nIn ) ; <nl> data . scriptSig = tx . vin [ nIn ] . scriptSig ; <nl> - if ( tx . wit . vtxinwit . size ( ) > nIn ) { <nl> - data . scriptWitness = tx . wit . vtxinwit [ nIn ] . scriptWitness ; <nl> - } <nl> + data . scriptWitness = tx . vin [ nIn ] . scriptWitness ; <nl> return data ; <nl> } <nl> <nl> void UpdateTransaction ( CMutableTransaction & tx , unsigned int nIn , const Signatur <nl> { <nl> assert ( tx . vin . size ( ) > nIn ) ; <nl> tx . vin [ nIn ] . scriptSig = data . scriptSig ; <nl> - if ( ! data . scriptWitness . IsNull ( ) | | tx . wit . vtxinwit . size ( ) > nIn ) { <nl> - tx . wit . vtxinwit . resize ( tx . vin . size ( ) ) ; <nl> - tx . wit . vtxinwit [ nIn ] . scriptWitness = data . scriptWitness ; <nl> - } <nl> + tx . vin [ nIn ] . scriptWitness = data . scriptWitness ; <nl> } <nl> <nl> bool SignSignature ( const CKeyStore & keystore , const CScript & fromPubKey , CMutableTransaction & txTo , unsigned int nIn , const CAmount & amount , int nHashType ) <nl> mmm a / src / test / script_tests . cpp <nl> ppp b / src / test / script_tests . cpp <nl> CMutableTransaction BuildSpendingTransaction ( const CScript & scriptSig , const CSc <nl> txSpend . nLockTime = 0 ; <nl> txSpend . vin . resize ( 1 ) ; <nl> txSpend . vout . resize ( 1 ) ; <nl> - txSpend . wit . vtxinwit . resize ( 1 ) ; <nl> - txSpend . wit . vtxinwit [ 0 ] . scriptWitness = scriptWitness ; <nl> + txSpend . vin [ 0 ] . scriptWitness = scriptWitness ; <nl> txSpend . vin [ 0 ] . prevout . hash = txCredit . GetHash ( ) ; <nl> txSpend . vin [ 0 ] . prevout . n = 0 ; <nl> txSpend . vin [ 0 ] . scriptSig = scriptSig ; <nl> mmm a / src / test / sigopcount_tests . cpp <nl> ppp b / src / test / sigopcount_tests . cpp <nl> ScriptError VerifyWithFlag ( const CTransaction & output , const CMutableTransaction <nl> { <nl> ScriptError error ; <nl> CTransaction inputi ( input ) ; <nl> - bool ret = VerifyScript ( inputi . vin [ 0 ] . scriptSig , output . vout [ 0 ] . scriptPubKey , inputi . wit . vtxinwit . size ( ) > 0 ? & inputi . wit . vtxinwit [ 0 ] . scriptWitness : NULL , flags , TransactionSignatureChecker ( & inputi , 0 , output . vout [ 0 ] . nValue ) , & error ) ; <nl> + bool ret = VerifyScript ( inputi . vin [ 0 ] . scriptSig , output . vout [ 0 ] . scriptPubKey , & inputi . vin [ 0 ] . scriptWitness , flags , TransactionSignatureChecker ( & inputi , 0 , output . vout [ 0 ] . nValue ) , & error ) ; <nl> BOOST_CHECK ( ( ret = = true ) = = ( error = = SCRIPT_ERR_OK ) ) ; <nl> <nl> return error ; <nl> ScriptError VerifyWithFlag ( const CTransaction & output , const CMutableTransaction <nl> * and witness such that spendingTx spends output zero of creationTx . <nl> * Also inserts creationTx ' s output into the coins view . <nl> * / <nl> - void BuildTxs ( CMutableTransaction & spendingTx , CCoinsViewCache & coins , CMutableTransaction & creationTx , const CScript & scriptPubKey , const CScript & scriptSig , const CTxInWitness & witness ) <nl> + void BuildTxs ( CMutableTransaction & spendingTx , CCoinsViewCache & coins , CMutableTransaction & creationTx , const CScript & scriptPubKey , const CScript & scriptSig , const CScriptWitness & witness ) <nl> { <nl> creationTx . nVersion = 1 ; <nl> creationTx . vin . resize ( 1 ) ; <nl> creationTx . vin [ 0 ] . prevout . SetNull ( ) ; <nl> creationTx . vin [ 0 ] . scriptSig = CScript ( ) ; <nl> - creationTx . wit . vtxinwit . resize ( 1 ) ; <nl> creationTx . vout . resize ( 1 ) ; <nl> creationTx . vout [ 0 ] . nValue = 1 ; <nl> creationTx . vout [ 0 ] . scriptPubKey = scriptPubKey ; <nl> void BuildTxs ( CMutableTransaction & spendingTx , CCoinsViewCache & coins , CMutableT <nl> spendingTx . vin [ 0 ] . prevout . hash = creationTx . GetHash ( ) ; <nl> spendingTx . vin [ 0 ] . prevout . n = 0 ; <nl> spendingTx . vin [ 0 ] . scriptSig = scriptSig ; <nl> - spendingTx . wit . vtxinwit . resize ( 1 ) ; <nl> - spendingTx . wit . vtxinwit [ 0 ] = witness ; <nl> + spendingTx . vin [ 0 ] . scriptWitness = witness ; <nl> spendingTx . vout . resize ( 1 ) ; <nl> spendingTx . vout [ 0 ] . nValue = 1 ; <nl> spendingTx . vout [ 0 ] . scriptPubKey = CScript ( ) ; <nl> BOOST_AUTO_TEST_CASE ( GetTxSigOpCost ) <nl> / / Do not use a valid signature to avoid using wallet operations . <nl> CScript scriptSig = CScript ( ) < < OP_0 < < OP_0 ; <nl> <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , CTxInWitness ( ) ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , CScriptWitness ( ) ) ; <nl> / / Legacy counting only includes signature operations in scriptSigs and scriptPubKeys <nl> / / of a transaction and does not take the actual executed sig operations into account . <nl> / / spendingTx in itself does not contain a signature operation . <nl> BOOST_AUTO_TEST_CASE ( GetTxSigOpCost ) <nl> CScript scriptPubKey = GetScriptForDestination ( CScriptID ( redeemScript ) ) ; <nl> CScript scriptSig = CScript ( ) < < OP_0 < < OP_0 < < ToByteVector ( redeemScript ) ; <nl> <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , CTxInWitness ( ) ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , CScriptWitness ( ) ) ; <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags ) = = 2 * WITNESS_SCALE_FACTOR ) ; <nl> assert ( VerifyWithFlag ( creationTx , spendingTx , flags ) = = SCRIPT_ERR_CHECKMULTISIGVERIFY ) ; <nl> } <nl> BOOST_AUTO_TEST_CASE ( GetTxSigOpCost ) <nl> CScript p2pk = CScript ( ) < < ToByteVector ( pubkey ) < < OP_CHECKSIG ; <nl> CScript scriptPubKey = GetScriptForWitness ( p2pk ) ; <nl> CScript scriptSig = CScript ( ) ; <nl> - CTxInWitness witness ; <nl> CScriptWitness scriptWitness ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> - witness . scriptWitness = scriptWitness ; <nl> <nl> <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , witness ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , scriptWitness ) ; <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags ) = = 1 ) ; <nl> / / No signature operations if we don ' t verify the witness . <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags & ~ SCRIPT_VERIFY_WITNESS ) = = 0 ) ; <nl> BOOST_AUTO_TEST_CASE ( GetTxSigOpCost ) <nl> / / The sig op cost for witness version ! = 0 is zero . <nl> assert ( scriptPubKey [ 0 ] = = 0x00 ) ; <nl> scriptPubKey [ 0 ] = 0x51 ; <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , witness ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , scriptWitness ) ; <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags ) = = 0 ) ; <nl> scriptPubKey [ 0 ] = 0x00 ; <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , witness ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , scriptWitness ) ; <nl> <nl> / / The witness of a coinbase transaction is not taken into account . <nl> spendingTx . vin [ 0 ] . prevout . SetNull ( ) ; <nl> BOOST_AUTO_TEST_CASE ( GetTxSigOpCost ) <nl> CScript scriptSig = GetScriptForWitness ( p2pk ) ; <nl> CScript scriptPubKey = GetScriptForDestination ( CScriptID ( scriptSig ) ) ; <nl> scriptSig = CScript ( ) < < ToByteVector ( scriptSig ) ; <nl> - CTxInWitness witness ; <nl> CScriptWitness scriptWitness ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> - witness . scriptWitness = scriptWitness ; <nl> <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , witness ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , scriptWitness ) ; <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags ) = = 1 ) ; <nl> assert ( VerifyWithFlag ( creationTx , spendingTx , flags ) = = SCRIPT_ERR_EQUALVERIFY ) ; <nl> } <nl> BOOST_AUTO_TEST_CASE ( GetTxSigOpCost ) <nl> CScript witnessScript = CScript ( ) < < 1 < < ToByteVector ( pubkey ) < < ToByteVector ( pubkey ) < < 2 < < OP_CHECKMULTISIGVERIFY ; <nl> CScript scriptPubKey = GetScriptForWitness ( witnessScript ) ; <nl> CScript scriptSig = CScript ( ) ; <nl> - CTxInWitness witness ; <nl> CScriptWitness scriptWitness ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( witnessScript . begin ( ) , witnessScript . end ( ) ) ) ; <nl> - witness . scriptWitness = scriptWitness ; <nl> <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , witness ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , scriptWitness ) ; <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags ) = = 2 ) ; <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags & ~ SCRIPT_VERIFY_WITNESS ) = = 0 ) ; <nl> assert ( VerifyWithFlag ( creationTx , spendingTx , flags ) = = SCRIPT_ERR_CHECKMULTISIGVERIFY ) ; <nl> BOOST_AUTO_TEST_CASE ( GetTxSigOpCost ) <nl> CScript redeemScript = GetScriptForWitness ( witnessScript ) ; <nl> CScript scriptPubKey = GetScriptForDestination ( CScriptID ( redeemScript ) ) ; <nl> CScript scriptSig = CScript ( ) < < ToByteVector ( redeemScript ) ; <nl> - CTxInWitness witness ; <nl> CScriptWitness scriptWitness ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( 0 ) ) ; <nl> scriptWitness . stack . push_back ( vector < unsigned char > ( witnessScript . begin ( ) , witnessScript . end ( ) ) ) ; <nl> - witness . scriptWitness = scriptWitness ; <nl> <nl> - BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , witness ) ; <nl> + BuildTxs ( spendingTx , coins , creationTx , scriptPubKey , scriptSig , scriptWitness ) ; <nl> assert ( GetTransactionSigOpCost ( CTransaction ( spendingTx ) , coins , flags ) = = 2 ) ; <nl> assert ( VerifyWithFlag ( creationTx , spendingTx , flags ) = = SCRIPT_ERR_CHECKMULTISIGVERIFY ) ; <nl> } <nl> mmm a / src / test / transaction_tests . cpp <nl> ppp b / src / test / transaction_tests . cpp <nl> BOOST_AUTO_TEST_CASE ( tx_valid ) <nl> amount = mapprevOutValues [ tx . vin [ i ] . prevout ] ; <nl> } <nl> unsigned int verify_flags = ParseScriptFlags ( test [ 2 ] . get_str ( ) ) ; <nl> - const CScriptWitness * witness = ( i < tx . wit . vtxinwit . size ( ) ) ? & tx . wit . vtxinwit [ i ] . scriptWitness : NULL ; <nl> + const CScriptWitness * witness = & tx . vin [ i ] . scriptWitness ; <nl> BOOST_CHECK_MESSAGE ( VerifyScript ( tx . vin [ i ] . scriptSig , mapprevOutScriptPubKeys [ tx . vin [ i ] . prevout ] , <nl> witness , verify_flags , TransactionSignatureChecker ( & tx , i , amount , txdata ) , & err ) , <nl> strTest ) ; <nl> BOOST_AUTO_TEST_CASE ( tx_invalid ) <nl> if ( mapprevOutValues . count ( tx . vin [ i ] . prevout ) ) { <nl> amount = mapprevOutValues [ tx . vin [ i ] . prevout ] ; <nl> } <nl> - const CScriptWitness * witness = ( i < tx . wit . vtxinwit . size ( ) ) ? & tx . wit . vtxinwit [ i ] . scriptWitness : NULL ; <nl> + const CScriptWitness * witness = & tx . vin [ i ] . scriptWitness ; <nl> fValid = VerifyScript ( tx . vin [ i ] . scriptSig , mapprevOutScriptPubKeys [ tx . vin [ i ] . prevout ] , <nl> witness , verify_flags , TransactionSignatureChecker ( & tx , i , amount , txdata ) , & err ) ; <nl> } <nl> void CreateCreditAndSpend ( const CKeyStore & keystore , const CScript & outscript , C <nl> outputm . vin . resize ( 1 ) ; <nl> outputm . vin [ 0 ] . prevout . SetNull ( ) ; <nl> outputm . vin [ 0 ] . scriptSig = CScript ( ) ; <nl> - outputm . wit . vtxinwit . resize ( 1 ) ; <nl> outputm . vout . resize ( 1 ) ; <nl> outputm . vout [ 0 ] . nValue = 1 ; <nl> outputm . vout [ 0 ] . scriptPubKey = outscript ; <nl> void CreateCreditAndSpend ( const CKeyStore & keystore , const CScript & outscript , C <nl> assert ( output - > vin [ 0 ] = = outputm . vin [ 0 ] ) ; <nl> assert ( output - > vout . size ( ) = = 1 ) ; <nl> assert ( output - > vout [ 0 ] = = outputm . vout [ 0 ] ) ; <nl> - assert ( output - > wit . vtxinwit . size ( ) = = 0 ) ; <nl> <nl> CMutableTransaction inputm ; <nl> inputm . nVersion = 1 ; <nl> inputm . vin . resize ( 1 ) ; <nl> inputm . vin [ 0 ] . prevout . hash = output - > GetHash ( ) ; <nl> inputm . vin [ 0 ] . prevout . n = 0 ; <nl> - inputm . wit . vtxinwit . resize ( 1 ) ; <nl> inputm . vout . resize ( 1 ) ; <nl> inputm . vout [ 0 ] . nValue = 1 ; <nl> inputm . vout [ 0 ] . scriptPubKey = CScript ( ) ; <nl> void CreateCreditAndSpend ( const CKeyStore & keystore , const CScript & outscript , C <nl> assert ( input . vin [ 0 ] = = inputm . vin [ 0 ] ) ; <nl> assert ( input . vout . size ( ) = = 1 ) ; <nl> assert ( input . vout [ 0 ] = = inputm . vout [ 0 ] ) ; <nl> - if ( inputm . wit . IsNull ( ) ) { <nl> - assert ( input . wit . IsNull ( ) ) ; <nl> - } else { <nl> - assert ( ! input . wit . IsNull ( ) ) ; <nl> - assert ( input . wit . vtxinwit . size ( ) = = 1 ) ; <nl> - assert ( input . wit . vtxinwit [ 0 ] . scriptWitness . stack = = inputm . wit . vtxinwit [ 0 ] . scriptWitness . stack ) ; <nl> - } <nl> + assert ( input . vin [ 0 ] . scriptWitness . stack = = inputm . vin [ 0 ] . scriptWitness . stack ) ; <nl> } <nl> <nl> void CheckWithFlag ( const CTransactionRef & output , const CMutableTransaction & input , int flags , bool success ) <nl> { <nl> ScriptError error ; <nl> CTransaction inputi ( input ) ; <nl> - bool ret = VerifyScript ( inputi . vin [ 0 ] . scriptSig , output - > vout [ 0 ] . scriptPubKey , inputi . wit . vtxinwit . size ( ) > 0 ? & inputi . wit . vtxinwit [ 0 ] . scriptWitness : NULL , flags , TransactionSignatureChecker ( & inputi , 0 , output - > vout [ 0 ] . nValue ) , & error ) ; <nl> + bool ret = VerifyScript ( inputi . vin [ 0 ] . scriptSig , output - > vout [ 0 ] . scriptPubKey , & inputi . vin [ 0 ] . scriptWitness , flags , TransactionSignatureChecker ( & inputi , 0 , output - > vout [ 0 ] . nValue ) , & error ) ; <nl> assert ( ret = = success ) ; <nl> } <nl> <nl> mmm a / src / validation . cpp <nl> ppp b / src / validation . cpp <nl> int64_t GetTransactionSigOpCost ( const CTransaction & tx , const CCoinsViewCache & i <nl> for ( unsigned int i = 0 ; i < tx . vin . size ( ) ; i + + ) <nl> { <nl> const CTxOut & prevout = inputs . GetOutputFor ( tx . vin [ i ] ) ; <nl> - nSigOps + = CountWitnessSigOps ( tx . vin [ i ] . scriptSig , prevout . scriptPubKey , i < tx . wit . vtxinwit . size ( ) ? & tx . wit . vtxinwit [ i ] . scriptWitness : NULL , flags ) ; <nl> + nSigOps + = CountWitnessSigOps ( tx . vin [ i ] . scriptSig , prevout . scriptPubKey , & tx . vin [ i ] . scriptWitness , flags ) ; <nl> } <nl> return nSigOps ; <nl> } <nl> bool AcceptToMemoryPoolWorker ( CTxMemPool & pool , CValidationState & state , const C <nl> <nl> / / Reject transactions with witness before segregated witness activates ( override with - prematurewitness ) <nl> bool witnessEnabled = IsWitnessEnabled ( chainActive . Tip ( ) , Params ( ) . GetConsensus ( ) ) ; <nl> - if ( ! GetBoolArg ( " - prematurewitness " , false ) & & ! tx . wit . IsNull ( ) & & ! witnessEnabled ) { <nl> + if ( ! GetBoolArg ( " - prematurewitness " , false ) & & tx . HasWitness ( ) & & ! witnessEnabled ) { <nl> return state . DoS ( 0 , false , REJECT_NONSTANDARD , " no - witness - yet " , true ) ; <nl> } <nl> <nl> bool AcceptToMemoryPoolWorker ( CTxMemPool & pool , CValidationState & state , const C <nl> return state . Invalid ( false , REJECT_NONSTANDARD , " bad - txns - nonstandard - inputs " ) ; <nl> <nl> / / Check for non - standard witness in P2WSH <nl> - if ( ! tx . wit . IsNull ( ) & & fRequireStandard & & ! IsWitnessStandard ( tx , view ) ) <nl> + if ( tx . HasWitness ( ) & & fRequireStandard & & ! IsWitnessStandard ( tx , view ) ) <nl> return state . DoS ( 0 , false , REJECT_NONSTANDARD , " bad - witness - nonstandard " , true ) ; <nl> <nl> int64_t nSigOpsCost = GetTransactionSigOpCost ( tx , view , STANDARD_SCRIPT_VERIFY_FLAGS ) ; <nl> bool AcceptToMemoryPoolWorker ( CTxMemPool & pool , CValidationState & state , const C <nl> / / SCRIPT_VERIFY_CLEANSTACK requires SCRIPT_VERIFY_WITNESS , so we <nl> / / need to turn both off , and compare against just turning off CLEANSTACK <nl> / / to see if the failure is specifically due to witness validation . <nl> - if ( tx . wit . IsNull ( ) & & CheckInputs ( tx , state , view , true , scriptVerifyFlags & ~ ( SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_CLEANSTACK ) , true , txdata ) & & <nl> + if ( ! tx . HasWitness ( ) & & CheckInputs ( tx , state , view , true , scriptVerifyFlags & ~ ( SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_CLEANSTACK ) , true , txdata ) & & <nl> ! CheckInputs ( tx , state , view , true , scriptVerifyFlags & ~ SCRIPT_VERIFY_CLEANSTACK , true , txdata ) ) { <nl> / / Only the witness is missing , so the transaction itself may be fine . <nl> state . SetCorruptionPossible ( ) ; <nl> void UpdateCoins ( const CTransaction & tx , CCoinsViewCache & inputs , int nHeight ) <nl> <nl> bool CScriptCheck : : operator ( ) ( ) { <nl> const CScript & scriptSig = ptxTo - > vin [ nIn ] . scriptSig ; <nl> - const CScriptWitness * witness = ( nIn < ptxTo - > wit . vtxinwit . size ( ) ) ? & ptxTo - > wit . vtxinwit [ nIn ] . scriptWitness : NULL ; <nl> + const CScriptWitness * witness = & ptxTo - > vin [ nIn ] . scriptWitness ; <nl> if ( ! VerifyScript ( scriptSig , scriptPubKey , witness , nFlags , CachingTransactionSignatureChecker ( ptxTo , nIn , amount , cacheStore , * txdata ) , & error ) ) { <nl> return false ; <nl> } <nl> void UpdateUncommittedBlockStructures ( CBlock & block , const CBlockIndex * pindexPr <nl> { <nl> int commitpos = GetWitnessCommitmentIndex ( block ) ; <nl> static const std : : vector < unsigned char > nonce ( 32 , 0x00 ) ; <nl> - if ( commitpos ! = - 1 & & IsWitnessEnabled ( pindexPrev , consensusParams ) & & block . vtx [ 0 ] - > wit . IsEmpty ( ) ) { <nl> + if ( commitpos ! = - 1 & & IsWitnessEnabled ( pindexPrev , consensusParams ) & & ! block . vtx [ 0 ] - > HasWitness ( ) ) { <nl> CMutableTransaction tx ( * block . vtx [ 0 ] ) ; <nl> - tx . wit . vtxinwit . resize ( 1 ) ; <nl> - tx . wit . vtxinwit [ 0 ] . scriptWitness . stack . resize ( 1 ) ; <nl> - tx . wit . vtxinwit [ 0 ] . scriptWitness . stack [ 0 ] = nonce ; <nl> + tx . vin [ 0 ] . scriptWitness . stack . resize ( 1 ) ; <nl> + tx . vin [ 0 ] . scriptWitness . stack [ 0 ] = nonce ; <nl> block . vtx [ 0 ] = MakeTransactionRef ( std : : move ( tx ) ) ; <nl> } <nl> } <nl> bool ContextualCheckBlock ( const CBlock & block , CValidationState & state , const Co <nl> / / The malleation check is ignored ; as the transaction tree itself <nl> / / already does not permit it , it is impossible to trigger in the <nl> / / witness tree . <nl> - if ( block . vtx [ 0 ] - > wit . vtxinwit . size ( ) ! = 1 | | block . vtx [ 0 ] - > wit . vtxinwit [ 0 ] . scriptWitness . stack . size ( ) ! = 1 | | block . vtx [ 0 ] - > wit . vtxinwit [ 0 ] . scriptWitness . stack [ 0 ] . size ( ) ! = 32 ) { <nl> + if ( block . vtx [ 0 ] - > vin [ 0 ] . scriptWitness . stack . size ( ) ! = 1 | | block . vtx [ 0 ] - > vin [ 0 ] . scriptWitness . stack [ 0 ] . size ( ) ! = 32 ) { <nl> return state . DoS ( 100 , false , REJECT_INVALID , " bad - witness - nonce - size " , true , strprintf ( " % s : invalid witness nonce size " , __func__ ) ) ; <nl> } <nl> - CHash256 ( ) . Write ( hashWitness . begin ( ) , 32 ) . Write ( & block . vtx [ 0 ] - > wit . vtxinwit [ 0 ] . scriptWitness . stack [ 0 ] [ 0 ] , 32 ) . Finalize ( hashWitness . begin ( ) ) ; <nl> + CHash256 ( ) . Write ( hashWitness . begin ( ) , 32 ) . Write ( & block . vtx [ 0 ] - > vin [ 0 ] . scriptWitness . stack [ 0 ] [ 0 ] , 32 ) . Finalize ( hashWitness . begin ( ) ) ; <nl> if ( memcmp ( hashWitness . begin ( ) , & block . vtx [ 0 ] - > vout [ commitpos ] . scriptPubKey [ 6 ] , 32 ) ) { <nl> return state . DoS ( 100 , false , REJECT_INVALID , " bad - witness - merkle - match " , true , strprintf ( " % s : witness merkle commitment mismatch " , __func__ ) ) ; <nl> } <nl> bool ContextualCheckBlock ( const CBlock & block , CValidationState & state , const Co <nl> / / No witness data is allowed in blocks that don ' t commit to witness data , as this would otherwise leave room for spam <nl> if ( ! fHaveWitness ) { <nl> for ( size_t i = 0 ; i < block . vtx . size ( ) ; i + + ) { <nl> - if ( ! block . vtx [ i ] - > wit . IsNull ( ) ) { <nl> + if ( block . vtx [ i ] - > HasWitness ( ) ) { <nl> return state . DoS ( 100 , false , REJECT_INVALID , " unexpected - witness " , true , strprintf ( " % s : unexpected witness data found " , __func__ ) ) ; <nl> } <nl> } <nl> mmm a / src / wallet / wallet . cpp <nl> ppp b / src / wallet / wallet . cpp <nl> bool CWallet : : CreateTransaction ( const vector < CRecipient > & vecSend , CWalletTx & wt <nl> nChangePosInOut = nChangePosRequest ; <nl> txNew . vin . clear ( ) ; <nl> txNew . vout . clear ( ) ; <nl> - txNew . wit . SetNull ( ) ; <nl> wtxNew . fFromMe = true ; <nl> bool fFirst = true ; <nl> <nl> bool CWallet : : CreateTransaction ( const vector < CRecipient > & vecSend , CWalletTx & wt <nl> <nl> / / Remove scriptSigs if we used dummy signatures for fee calculation <nl> if ( ! sign ) { <nl> - BOOST_FOREACH ( CTxIn & vin , txNew . vin ) <nl> + BOOST_FOREACH ( CTxIn & vin , txNew . vin ) { <nl> vin . scriptSig = CScript ( ) ; <nl> - txNew . wit . SetNull ( ) ; <nl> + vin . scriptWitness . SetNull ( ) ; <nl> + } <nl> } <nl> <nl> / / Embed the constructed transaction data in wtxNew . <nl>
|
Merge : Inline CTxInWitness inside CTxIn
|
bitcoin/bitcoin
|
e8cfe1ee2d01c493b758a67ad14707dca15792ea
|
2016-12-21T13:04:06Z
|
mmm a / html / admin / css / navigationView . css <nl> ppp b / html / admin / css / navigationView . css <nl> body , input , textarea , . page - title span , . pingback a . url { <nl> } <nl> <nl> . applications - menu { <nl> - display : none ; <nl> + display : block ; <nl> } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . 7e8398565f1 <nl> mmm / dev / null <nl> ppp b / html / admin / css / swaggerView . css <nl> <nl> + . swagger - ui - wrap . container { <nl> + width : auto ; <nl> + } <nl> \ No newline at end of file <nl> mmm a / html / admin / index . html <nl> ppp b / html / admin / index . html <nl> <nl> < link href = " css / documentsView . css " rel = " stylesheet " > <nl> < link href = " css / documentView . css " rel = " stylesheet " > <nl> < link href = " css / documentSourceView . css " rel = " stylesheet " > <nl> + < link href = " css / swaggerView . css " rel = " stylesheet " > <nl> + <nl> < link href = " css / jquery . snippet . css " rel = " stylesheet " > <nl> < link href = " css / jquery . gritter . css " rel = " stylesheet " > <nl> < link href = " css / modal . css " rel = " stylesheet " > <nl> mmm a / html / admin / js / templates / foxxListView . ejs <nl> ppp b / html / admin / js / templates / foxxListView . ejs <nl> <nl> < div id = " transparentHeader " > <nl> < h4 > Applications < / h4 > <nl> < / div > <nl> - < div style = " position : relative ; " > <nl> - < ul class = " thumbnails " id = " foxxList " > <nl> - < / ul > <nl> - < / div > <nl> < / ul > <nl> <nl> + < div class = " form - actions " > <nl> + < ul class = " thumbnails " id = " foxxList " > <nl> + < / ul > <nl> + < / div > <nl> + <nl> mmm a / html / admin / js / templates / swaggerView . ejs <nl> ppp b / html / admin / js / templates / swaggerView . ejs <nl> <nl> < h4 > Swagger < / h4 > <nl> < / div > <nl> < / ul > <nl> + < div class = " form - actions " > <nl> + < div id = " swagger - ui - container " class = " swagger - ui - wrap " > <nl> <nl> - < div id = " swagger - ui - container " class = " swagger - ui - wrap " > <nl> - <nl> + < / div > <nl> < / div > <nl> \ No newline at end of file <nl>
|
Frontend : Fixed another issue with Swagger optic , swagger info - divs are not to large anymore
|
arangodb/arangodb
|
fc59b21be77dcd18f3217931be3ce7dae3c9ea95
|
2013-03-26T18:29:15Z
|
mmm a / src / factory / process . c <nl> ppp b / src / factory / process . c <nl> static int swFactoryProcess_dispatch ( swFactory * factory , swDispatchData * task ) <nl> / / discard the data packet . <nl> if ( target_worker_id < 0 ) <nl> { <nl> - return SW_OK ; <nl> + / * * <nl> + * - 1 : discard packet <nl> + * [ TODO ] - 2 : close connection <nl> + * / <nl> + return SW_ERR ; <nl> } <nl> <nl> if ( swEventData_is_stream ( task - > data . info . type ) ) <nl> mmm a / swoole . c <nl> ppp b / swoole . c <nl> int php_swoole_dispatch_func ( swServer * serv , swConnection * conn , swEventData * da <nl> { <nl> convert_to_long ( retval ) ; <nl> worker_id = ( int ) Z_LVAL_P ( retval ) ; <nl> - if ( worker_id < 0 | | worker_id > = serv - > worker_num ) <nl> + if ( worker_id > = serv - > worker_num ) <nl> { <nl> swoole_php_fatal_error ( E_WARNING , " invalid target worker - id [ % d ] . " , worker_id ) ; <nl> worker_id = - 1 ; <nl> new file mode 100644 <nl> index 0000000000 . . 6a7a3c7bcf <nl> mmm / dev / null <nl> ppp b / tests / swoole_server / dispatch_func_discard . phpt <nl> <nl> + - - TEST - - <nl> + swoole_server : dispatch_func [ discard ] <nl> + - - SKIPIF - - <nl> + < ? php require __DIR__ . ' / . . / include / skipif . inc ' ; ? > <nl> + - - FILE - - <nl> + < ? php <nl> + require __DIR__ . ' / . . / include / bootstrap . php ' ; <nl> + $ pm = new ProcessManager ; <nl> + $ pm - > parentFunc = function ( ) use ( $ pm ) { <nl> + <nl> + go ( function ( ) use ( $ pm ) { <nl> + $ client = new Co \ Client ( SWOOLE_SOCK_TCP ) ; <nl> + assert ( $ client - > connect ( ' 127 . 0 . 0 . 1 ' , $ pm - > getFreePort ( ) , 0 . 2 ) ) ; <nl> + <nl> + $ data = str_repeat ( ' A ' , 65534 ) . " \ r \ n \ r \ n " ; <nl> + assert ( $ client - > send ( $ data ) ) ; <nl> + assert ( false = = = @ $ client - > recv ( ) ) ; <nl> + } ) ; <nl> + <nl> + Swoole \ Event : : wait ( ) ; <nl> + $ pm - > kill ( ) ; <nl> + echo " DONE \ n " ; <nl> + } ; <nl> + $ pm - > childFunc = function ( ) use ( $ pm ) { <nl> + <nl> + function dispatch_packet ( $ server , $ fd , $ type ) <nl> + { <nl> + return - 1 ; <nl> + } <nl> + <nl> + $ server = new Swoole \ Server ( ' 127 . 0 . 0 . 1 ' , $ pm - > getFreePort ( ) , SWOOLE_PROCESS ) ; <nl> + $ server - > set ( [ <nl> + ' log_file ' = > ' / dev / null ' , <nl> + ' open_eof_check ' = > true , <nl> + ' package_eof ' = > " \ r \ n \ r \ n " , <nl> + ' dispatch_func ' = > ' dispatch_packet ' , <nl> + ] ) ; <nl> + $ server - > on ( " WorkerStart " , function ( Swoole \ Server $ serv ) use ( $ pm ) <nl> + { <nl> + $ pm - > wakeup ( ) ; <nl> + } ) ; <nl> + $ server - > on ( ' receive ' , function ( Swoole \ Server $ server , $ fd , $ threadId , $ data ) { <nl> + $ server - > send ( $ fd , $ data ) ; <nl> + } ) ; <nl> + $ server - > start ( ) ; <nl> + } ; <nl> + $ pm - > childFirst ( ) ; <nl> + $ pm - > run ( ) ; <nl> + ? > <nl> + - - EXPECT - - <nl> + DONE <nl>
|
fix dispatch_func discard
|
swoole/swoole-src
|
ca14649ab45a41edda7f2297ab3e7dbb9a2e54f6
|
2019-01-12T13:36:35Z
|
mmm a / LICENSE <nl> ppp b / LICENSE <nl> <nl> + Copyright 2016 - 2019 Yandex LLC <nl> + <nl> Apache License <nl> Version 2 . 0 , January 2004 <nl> http : / / www . apache . org / licenses / <nl>
|
Duplicate copyright
|
ClickHouse/ClickHouse
|
88f817a08bbeb3b2cd1da9184a5a7802c614ac13
|
2019-07-04T12:03:43Z
|
mmm a / tests / swoole_runtime / stream_socket_pair . phpt <nl> ppp b / tests / swoole_runtime / stream_socket_pair . phpt <nl> Co : : create ( function ( ) use ( & $ pipe ) { <nl> while ( $ buffer = fread ( $ pipe [ 1 ] , 1024 ) ) { <nl> printf ( " Read byte : % d , beffer : % s \ n " , strlen ( $ buffer ) , $ buffer ) ; <nl> } <nl> + fclose ( $ pipe [ 1 ] ) ; <nl> } ) ; <nl> <nl> <nl>
|
Merge pull request from huanghantao / master
|
swoole/swoole-src
|
56546f2a322592532279e288a0dc48ad51769388
|
2019-05-06T02:10:28Z
|
mmm a / tensorflow / contrib / boosted_trees / lib / trees / decision_tree . cc <nl> ppp b / tensorflow / contrib / boosted_trees / lib / trees / decision_tree . cc <nl> <nl> # include " tensorflow / contrib / boosted_trees / lib / trees / decision_tree . h " <nl> # include " tensorflow / core / platform / macros . h " <nl> <nl> + # include < algorithm > <nl> + <nl> namespace tensorflow { <nl> namespace boosted_trees { <nl> namespace trees { <nl> mmm a / tensorflow / contrib / cmake / external / grpc . cmake <nl> ppp b / tensorflow / contrib / cmake / external / grpc . cmake <nl> else ( ) <nl> set ( grpc_STATIC_LIBRARIES <nl> $ { CMAKE_CURRENT_BINARY_DIR } / grpc / src / grpc / libgrpc + + _unsecure . a <nl> $ { CMAKE_CURRENT_BINARY_DIR } / grpc / src / grpc / libgrpc_unsecure . a <nl> - $ { CMAKE_CURRENT_BINARY_DIR } / grpc / src / grpc / libgpr . a ) <nl> + $ { CMAKE_CURRENT_BINARY_DIR } / grpc / src / grpc / libgpr . a <nl> + $ { CMAKE_CURRENT_BINARY_DIR } / grpc / src / grpc / third_party / cares / libcares . a ) <nl> endif ( ) <nl> <nl> ExternalProject_Add ( grpc <nl> ExternalProject_Add ( grpc <nl> # on " grpc " from the " grpc + + _unsecure " rule . <nl> PATCH_COMMAND $ { CMAKE_COMMAND } - E copy_if_different $ { CMAKE_CURRENT_SOURCE_DIR } / patches / grpc / CMakeLists . txt $ { GRPC_BUILD } <nl> BUILD_COMMAND $ { CMAKE_COMMAND } - - build . - - config Release - - target grpc + + _unsecure <nl> + COMMAND $ { CMAKE_COMMAND } - - build . - - config Release - - target grpc_cpp_plugin <nl> INSTALL_COMMAND " " <nl> CMAKE_CACHE_ARGS <nl> - DCMAKE_BUILD_TYPE : STRING = Release <nl> mmm a / tensorflow / contrib / cmake / external / sqlite . cmake <nl> ppp b / tensorflow / contrib / cmake / external / sqlite . cmake <nl> set ( sqlite_INSTALL $ { CMAKE_CURRENT_BINARY_DIR } / sqlite / install ) <nl> if ( WIN32 ) <nl> set ( sqlite_STATIC_LIBRARIES $ { sqlite_INSTALL } / lib / sqlite . lib ) <nl> else ( ) <nl> - set ( sqlite_STATIC_LIBRARIES $ { sqlite_INSTALL } / lib / sqlite . a ) <nl> + set ( sqlite_STATIC_LIBRARIES $ { sqlite_INSTALL } / lib / libsqlite . a ) <nl> endif ( ) <nl> <nl> set ( sqlite_HEADERS <nl> else ( ) <nl> PREFIX sqlite <nl> URL $ { sqlite_URL } <nl> URL_HASH $ { sqlite_HASH } <nl> + PATCH_COMMAND $ { CMAKE_COMMAND } - E copy_if_different $ { CMAKE_CURRENT_SOURCE_DIR } / patches / sqlite / CMakeLists . txt $ { sqlite_BUILD } <nl> INSTALL_DIR $ { sqlite_INSTALL } <nl> DOWNLOAD_DIR " $ { DOWNLOAD_LOCATION } " <nl> - BUILD_COMMAND $ ( MAKE ) <nl> - INSTALL_COMMAND $ ( MAKE ) install <nl> - CFLAGS = - fPIC <nl> + CMAKE_CACHE_ARGS <nl> + - DCMAKE_BUILD_TYPE : STRING = Release <nl> + - DCMAKE_VERBOSE_MAKEFILE : BOOL = OFF <nl> + - DCMAKE_POSITION_INDEPENDENT_CODE : BOOL = ON <nl> + - DCMAKE_INSTALL_PREFIX : STRING = $ { sqlite_INSTALL } <nl> ) <nl> <nl> endif ( ) <nl> add_custom_target ( sqlite_copy_headers_to_destination <nl> foreach ( header_file $ { sqlite_HEADERS } ) <nl> add_custom_command ( TARGET sqlite_copy_headers_to_destination PRE_BUILD <nl> COMMAND $ { CMAKE_COMMAND } - E copy_if_different $ { header_file } $ { sqlite_INCLUDE_DIR } ) <nl> - endforeach ( ) <nl> \ No newline at end of file <nl> + endforeach ( ) <nl> mmm a / tensorflow / contrib / cmake / tf_core_framework . cmake <nl> ppp b / tensorflow / contrib / cmake / tf_core_framework . cmake <nl> function ( RELATIVE_PROTOBUF_GENERATE_CPP SRCS HDRS ROOT_DIR ) <nl> set ( $ { HDRS } $ { $ { HDRS } } PARENT_SCOPE ) <nl> endfunction ( ) <nl> <nl> + if ( NOT WIN32 ) <nl> + function ( RELATIVE_PROTOBUF_GENERATE_GRPC_CPP SRCS HDRS ROOT_DIR ) <nl> + if ( NOT ARGN ) <nl> + message ( SEND_ERROR " Error : RELATIVE_PROTOBUF_GENERATE_GRPC_CPP ( ) called without any proto files " ) <nl> + return ( ) <nl> + endif ( ) <nl> + <nl> + set ( $ { SRCS } ) <nl> + set ( $ { HDRS } ) <nl> + foreach ( FIL $ { ARGN } ) <nl> + set ( ABS_FIL $ { ROOT_DIR } / $ { FIL } ) <nl> + get_filename_component ( FIL_WE $ { FIL } NAME_WE ) <nl> + get_filename_component ( FIL_DIR $ { ABS_FIL } PATH ) <nl> + file ( RELATIVE_PATH REL_DIR $ { ROOT_DIR } $ { FIL_DIR } ) <nl> + <nl> + list ( APPEND $ { SRCS } " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . grpc . pb . cc " ) <nl> + list ( APPEND $ { HDRS } " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . grpc . pb . h " ) <nl> + list ( APPEND $ { SRCS } " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . pb . cc " ) <nl> + list ( APPEND $ { HDRS } " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . pb . h " ) <nl> + <nl> + add_custom_command ( <nl> + OUTPUT " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . grpc . pb . cc " <nl> + " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . grpc . pb . h " <nl> + " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . pb . cc " <nl> + " $ { CMAKE_CURRENT_BINARY_DIR } / $ { REL_DIR } / $ { FIL_WE } . pb . h " <nl> + COMMAND $ { PROTOBUF_PROTOC_EXECUTABLE } <nl> + ARGS - - grpc_out $ { CMAKE_CURRENT_BINARY_DIR } - - cpp_out $ { CMAKE_CURRENT_BINARY_DIR } - - plugin protoc - gen - grpc = $ { GRPC_BUILD } / grpc_cpp_plugin - I $ { ROOT_DIR } $ { ABS_FIL } - I $ { PROTOBUF_INCLUDE_DIRS } <nl> + DEPENDS $ { ABS_FIL } protobuf grpc <nl> + COMMENT " Running C + + protocol buffer grpc compiler on $ { FIL } " <nl> + VERBATIM ) <nl> + endforeach ( ) <nl> + <nl> + set_source_files_properties ( $ { $ { SRCS } } $ { $ { HDRS } } PROPERTIES GENERATED TRUE ) <nl> + set ( $ { SRCS } $ { $ { SRCS } } PARENT_SCOPE ) <nl> + set ( $ { HDRS } $ { $ { HDRS } } PARENT_SCOPE ) <nl> + endfunction ( ) <nl> + endif ( ) <nl> + <nl> function ( RELATIVE_PROTOBUF_TEXT_GENERATE_CPP SRCS HDRS ROOT_DIR ) <nl> if ( NOT ARGN ) <nl> message ( SEND_ERROR " Error : RELATIVE_PROTOBUF_TEXT_GENERATE_CPP ( ) called without any proto files " ) <nl> RELATIVE_PROTOBUF_GENERATE_CPP ( PROTO_SRCS PROTO_HDRS <nl> $ { tensorflow_source_dir } $ { tf_protos_cc_srcs } <nl> ) <nl> <nl> + <nl> set ( PROTO_TEXT_EXE " proto_text " ) <nl> set ( tf_proto_text_srcs <nl> " tensorflow / core / example / example . proto " <nl> RELATIVE_PROTOBUF_TEXT_GENERATE_CPP ( PROTO_TEXT_SRCS PROTO_TEXT_HDRS <nl> $ { tensorflow_source_dir } $ { tf_proto_text_srcs } <nl> ) <nl> <nl> - add_library ( tf_protos_cc $ { PROTO_SRCS } $ { PROTO_HDRS } ) <nl> + if ( WIN32 ) <nl> + add_library ( tf_protos_cc $ { PROTO_SRCS } $ { PROTO_HDRS } ) <nl> + else ( ) <nl> + file ( GLOB_RECURSE tf_protos_grpc_cc_srcs RELATIVE $ { tensorflow_source_dir } <nl> + " $ { tensorflow_source_dir } / tensorflow / core / debug / * . proto " <nl> + ) <nl> + RELATIVE_PROTOBUF_GENERATE_GRPC_CPP ( PROTO_GRPC_SRCS PROTO_GRPC_HDRS <nl> + $ { tensorflow_source_dir } $ { tf_protos_grpc_cc_srcs } <nl> + ) <nl> + add_library ( tf_protos_cc $ { PROTO_GRPC_SRCS } $ { PROTO_GRPC_HDRS } $ { PROTO_SRCS } $ { PROTO_HDRS } ) <nl> + endif ( ) <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> # tf_core_lib library <nl> mmm a / tensorflow / core / lib / jpeg / jpeg_mem . cc <nl> ppp b / tensorflow / core / lib / jpeg / jpeg_mem . cc <nl> uint8 * UncompressLow ( const void * srcdata , FewerArgsForCompiler * argball ) { <nl> JDIMENSION target_output_width = cinfo . output_width ; <nl> JDIMENSION target_output_height = cinfo . output_height ; <nl> JDIMENSION skipped_scanlines = 0 ; <nl> - # if ! defined ( WIN32 ) <nl> + # if defined ( LIBJPEG_TURBO_VERSION ) <nl> if ( flags . crop ) { <nl> / / Update target output height and width based on crop window . <nl> target_output_height = flags . crop_height ; <nl> uint8 * UncompressLow ( const void * srcdata , FewerArgsForCompiler * argball ) { <nl> argball - > height_ = target_output_height ; <nl> argball - > stride_ = stride ; <nl> <nl> - # if defined ( WIN32 ) <nl> + # if ! defined ( LIBJPEG_TURBO_VERSION ) <nl> uint8 * dstdata = nullptr ; <nl> if ( flags . crop ) { <nl> dstdata = new JSAMPLE [ stride * target_output_height ] ; <nl> uint8 * UncompressLow ( const void * srcdata , FewerArgsForCompiler * argball ) { <nl> delete [ ] tempdata ; <nl> tempdata = nullptr ; <nl> <nl> - # if ! defined ( WIN32 ) <nl> + # if defined ( LIBJPEG_TURBO_VERSION ) <nl> if ( flags . crop & & cinfo . output_scanline < cinfo . output_height ) { <nl> / / Skip the rest of scanlines , required by jpeg_destroy_decompress . <nl> jpeg_skip_scanlines ( & cinfo , <nl> uint8 * UncompressLow ( const void * srcdata , FewerArgsForCompiler * argball ) { <nl> break ; <nl> } <nl> <nl> - # if defined ( WIN32 ) <nl> + # if ! defined ( LIBJPEG_TURBO_VERSION ) <nl> / / TODO ( tanmingxing ) : delete all these code after migrating to libjpeg_turbo <nl> / / for Windows . <nl> if ( flags . crop ) { <nl>
|
Fix cmake build issue on Linux ( )
|
tensorflow/tensorflow
|
0e222435d28eaf0efb8a30493d98cace3d4f02bf
|
2017-09-19T22:33:10Z
|
mmm a / src / Makefile <nl> ppp b / src / Makefile <nl> ifeq ( $ ( LIBCRYPTO ) , 1 ) <nl> LDFLAGS + = - lcrypto <nl> endif <nl> <nl> + LIB_SEARCH_PATHS ? = <nl> + LDFLAGS + = $ ( foreach TLIB , $ ( LIB_SEARCH_PATHS ) , - L $ ( TLIB ) ) <nl> + <nl> STATIC_LIBRARIES : = <nl> <nl> STATIC_RECOMMENDS : = boost_serialization protobuf boost_program_options <nl>
|
I added some functionality for library path finding .
|
rethinkdb/rethinkdb
|
c718e716e6dfc25adcd2bbba433f4f8588ef7be7
|
2012-11-12T23:46:59Z
|
mmm a / lang / microschedule . cpp <nl> ppp b / lang / microschedule . cpp <nl> void test_adapter3 ( int vec_size ) { <nl> <nl> for ( int i = 0 ; i < n ; i + + ) { <nl> real s = 0 ; <nl> - for ( int j = 0 ; j < vec_size * 2 ; j + + ) { <nl> + for ( int j = 0 ; j < vec_size ; j + + ) { <nl> s + = sqr ( i + j + 1 ) - sqr ( i + j ) ; <nl> } <nl> for ( int j = 0 ; j < vec_size * 2 ; j + + ) { <nl>
|
test adapter3
|
taichi-dev/taichi
|
10f2f467da6cb54f72769bee24fe3ad524deea4e
|
2018-12-23T21:46:47Z
|
mmm a / Source / CNTKv2LibraryDll / API / CNTKLibrary . h <nl> ppp b / Source / CNTKv2LibraryDll / API / CNTKLibrary . h <nl> namespace CNTK <nl> return ( m_staticAxisIdx = = SentinelStaticAxisIndexValueForDynamicAxes ) ; <nl> } <nl> <nl> + / / / <nl> + / / / Indicate whether ' this ' Axis is a batch axis . <nl> + / / / <nl> + bool IsBatchAxis ( ) const <nl> + { <nl> + / / TODO : Do we assume there is only one batch axis in the whole system ? <nl> + return ( this - > IsDynamicAxis ( ) & & ! this - > IsSequenceAxis ( ) ) ; <nl> + } <nl> + <nl> + / / / <nl> + / / / Indicate whether ' this ' Axis is a sequence axis . <nl> + / / / <nl> + bool IsSequenceAxis ( ) const <nl> + { <nl> + return ( this - > IsDynamicAxis ( ) & & this - > m_isOrderedDynamicAxis ) ; <nl> + } <nl> + <nl> / / / <nl> / / / Returns a boolean indicating if ' this ' Axis is ordered ; i . e . if there is an ordering between the dimensions along this axis . <nl> / / / <nl> namespace CNTK <nl> / / / Create an instance of the CNTK built - in Prod reduction operation on specified tensor input operand along the specified axis <nl> / / / <nl> CNTK_API FunctionPtr ReduceProd ( const Variable & operand , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> + / / multiple axes reduction below : <nl> + <nl> + / / / <nl> + / / / Create an instance of the CNTK built - in sum reduction operation on specified tensor input operand along the specified axis <nl> + / / / <nl> + CNTK_API FunctionPtr ReduceSum ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name = L " " ) ; <nl> + <nl> + / / / <nl> + / / / Create an instance of the CNTK built - in LogSum reduction operation on specified tensor input operand along the specified axis <nl> + / / / <nl> + CNTK_API FunctionPtr ReduceLogSum ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name = L " " ) ; <nl> + <nl> + / / / <nl> + / / / Create an instance of the CNTK built - in Mean reduction operation on specified tensor input operand along the specified axis <nl> + / / / <nl> + CNTK_API FunctionPtr ReduceMean ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name = L " " ) ; <nl> + <nl> + / / / <nl> + / / / Create an instance of the CNTK built - in Max reduction operation on specified tensor input operand along the specified axis <nl> + / / / <nl> + CNTK_API FunctionPtr ReduceMax ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name = L " " ) ; <nl> <nl> + / / / <nl> + / / / Create an instance of the CNTK built - in Min reduction operation on specified tensor input operand along the specified axis <nl> + / / / <nl> + CNTK_API FunctionPtr ReduceMin ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name = L " " ) ; <nl> + <nl> + / / / <nl> + / / / Create an instance of the CNTK built - in Prod reduction operation on specified tensor input operand along the specified axis <nl> + / / / <nl> + CNTK_API FunctionPtr ReduceProd ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name = L " " ) ; <nl> / / / <nl> / / / Per dimension mean - variance normalization of the specified input operand . <nl> / / / <nl> namespace CNTK <nl> / / / Create an instance of the CNTK built - in argmin on specified tensor input operand along the specified axis <nl> / / / <nl> CNTK_API FunctionPtr Argmin ( const Variable & operand , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> - <nl> + <nl> / / / <nl> / / / Create an instance of the CNTK built - in operator for converting the specified tensor operand into a sequence <nl> / / / <nl> mmm a / Source / CNTKv2LibraryDll / API / CNTKLibraryInternals . h <nl> ppp b / Source / CNTKv2LibraryDll / API / CNTKLibraryInternals . h <nl> namespace CNTK <nl> CNTK_API FunctionPtr Slice ( const Variable & operand , const std : : vector < Axis > & axis , const std : : vector < int > & beginIndex , const std : : vector < int > & endIndex , const std : : vector < int > & strides , const std : : wstring & name = L " " ) ; <nl> CNTK_API FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const Axis & axis , const std : : wstring & name = L " " ) ; <nl> CNTK_API FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const Axis & axis , bool keepReducedDimensions , const std : : wstring & name = L " " ) ; <nl> + CNTK_API FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const std : : vector < Axis > & axes , const std : : wstring & name = L " " ) ; <nl> + CNTK_API FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const std : : vector < Axis > & axes , bool keepReducedDimensions , const std : : wstring & name = L " " ) ; <nl> CNTK_API FunctionPtr CosineDistanceWithNegativeSamples ( const Variable & leftOperand , const Variable & rightOperand , const Variable & shiftWindow , const Variable & numberOfNegativeSamples , const std : : wstring & name = L " " ) ; <nl> CNTK_API FunctionPtr Convolution ( const Variable & convolutionMap , const Variable & operand , const NDShape & strides , const std : : vector < bool > & sharing , const std : : vector < bool > & autoPadding , <nl> bool transpose , const NDShape & outputShape , size_t maxTempMemSizeInSamples , const std : : wstring & name = L " " ) ; <nl> mmm a / Source / CNTKv2LibraryDll / BackCompat . cpp <nl> ppp b / Source / CNTKv2LibraryDll / BackCompat . cpp <nl> namespace CNTK <nl> else if ( node - > OperationName ( ) = = OperationNameOf ( ReduceElementsNode ) ) <nl> { <nl> auto reduceElementsNode = node - > As < ReduceElementsNode < ElementType > > ( ) ; <nl> - primitiveFunctionConfigParameters [ PrimitiveFunction : : AttributeNameAxis ] = AsAxis ( reduceElementsNode - > ReductionAxis ( ) ) ; <nl> + primitiveFunctionConfigParameters [ PrimitiveFunction : : AttributeNameAxisVec ] = AsDictionaryValueVector ( AsAxis ( reduceElementsNode - > ReductionAxis ( ) ) ) ; <nl> primitiveFunctionConfigParameters [ PrimitiveFunction : : AttributeNameReductionOpName ] = reduceElementsNode - > ReductionOpName ( ) ; <nl> <nl> opType = PrimitiveOpType : : ReduceElements ; <nl> mmm a / Source / CNTKv2LibraryDll / CompositeFunction . cpp <nl> ppp b / Source / CNTKv2LibraryDll / CompositeFunction . cpp <nl> namespace CNTK <nl> bool keepDimensions = true ; <nl> if ( functionConfig . Contains ( PrimitiveFunction : : AttributeNameReductionKeepDimensions ) ) <nl> keepDimensions = functionConfig [ PrimitiveFunction : : AttributeNameReductionKeepDimensions ] . Value < bool > ( ) ; <nl> - <nl> - auto reductionAxis = functionConfig [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) ; <nl> auto reductionOpName = functionConfig [ PrimitiveFunction : : AttributeNameReductionOpName ] . Value < std : : wstring > ( ) ; <nl> + std : : vector < Axis > reductionAxis ; <nl> + if ( functionConfig . Contains ( PrimitiveFunction : : AttributeNameAxisVec ) ) <nl> + { <nl> + reductionAxis = AsVector < Axis > ( functionConfig [ PrimitiveFunction : : AttributeNameAxisVec ] . Value < std : : vector < DictionaryValue > > ( ) ) ; <nl> + } <nl> + else if ( functionConfig . Contains ( PrimitiveFunction : : AttributeNameAxis ) ) <nl> + { <nl> + reductionAxis . push_back ( functionConfig [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) ) ; <nl> + } <nl> + else <nl> + { <nl> + RuntimeError ( " Failed to create computation node ' : Reduce operation % ls with no ' % ls ' or ' % ls ' attributes " , <nl> + PrimitiveOpTypeName ( op ) . c_str ( ) , <nl> + PrimitiveFunction : : AttributeNameAxis . c_str ( ) , <nl> + PrimitiveFunction : : AttributeNameAxisVec . c_str ( ) <nl> + ) ; <nl> + <nl> + } <nl> computationNodePtr = New < ReduceElementsNode < ElementType > > ( network - > GetDeviceId ( ) , internalNodeName , reductionOpName , AsCNTKInternalAxisIdx ( reductionAxis ) , keepDimensions ) ; <nl> break ; <nl> } <nl> mmm a / Source / CNTKv2LibraryDll / Function . cpp <nl> ppp b / Source / CNTKv2LibraryDll / Function . cpp <nl> namespace CNTK <nl> return Internal : : ReduceElements ( operand , PrimitiveFunction : : InternalProdReductionOpName , axis , name ) ; <nl> } <nl> <nl> + / / multiple axes reduction below : <nl> + <nl> + FunctionPtr ReduceSum ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name ) <nl> + { <nl> + return Internal : : ReduceElements ( operand , PrimitiveFunction : : InternalSumReductionOpName , axis , name ) ; <nl> + } <nl> + <nl> + FunctionPtr ReduceLogSum ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name ) <nl> + { <nl> + return Internal : : ReduceElements ( operand , PrimitiveFunction : : InternalLogSumReductionOpName , axis , name ) ; <nl> + } <nl> + <nl> + FunctionPtr ReduceMean ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name ) <nl> + { <nl> + return Internal : : ReduceElements ( operand , PrimitiveFunction : : InternalMeanReductionOpName , axis , name ) ; <nl> + } <nl> + <nl> + FunctionPtr ReduceMax ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name ) <nl> + { <nl> + return Internal : : ReduceElements ( operand , PrimitiveFunction : : InternalMaxReductionOpName , axis , name ) ; <nl> + } <nl> + <nl> + FunctionPtr ReduceMin ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name ) <nl> + { <nl> + return Internal : : ReduceElements ( operand , PrimitiveFunction : : InternalMinReductionOpName , axis , name ) ; <nl> + } <nl> + <nl> + FunctionPtr ReduceProd ( const Variable & operand , const std : : vector < Axis > & axis , const std : : wstring & name ) <nl> + { <nl> + return Internal : : ReduceElements ( operand , PrimitiveFunction : : InternalProdReductionOpName , axis , name ) ; <nl> + } <nl> + <nl> FunctionPtr PerDimMeanVarianceNormalize ( const Variable & operand , const Variable & mean , const Variable & invStdDev , const std : : wstring & name ) <nl> { <nl> auto operandPlaceholder = PlaceholderVariable ( L " operand " ) ; <nl> namespace CNTK <nl> auto broadcastAsPlaceholder = PlaceholderVariable ( L " broadcastAs " ) ; <nl> return AsBlock ( ReconcileDynamicAxes ( operandPlaceholder , broadcastAsPlaceholder ) , { { operandPlaceholder , operand } , { broadcastAsPlaceholder , broadcastAs } } , L " Sequence : : BroadcastAs " , name ) ; <nl> } <nl> - <nl> - FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const std : : wstring & name ) <nl> + <nl> + FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , bool keepReducedDimensions , const std : : wstring & name ) <nl> { <nl> auto operandPlaceholder = PlaceholderVariable ( L " operand " ) ; <nl> auto unpackedSequence = Unpack ( operandPlaceholder , ReductionIdentityValue ( PrimitiveFunction : : InternalSumReductionOpName ) , / * suppressMaskOutput = * / true , name ) ; <nl> - auto reductionResult = Internal : : ReduceElements ( unpackedSequence , reductionOpName , Axis ( - 1 ) , / * keepReducedDimensions = * / false ) ; <nl> + auto reductionResult = Internal : : ReduceElements ( unpackedSequence , reductionOpName , Axis ( - 1 ) , keepReducedDimensions ) ; <nl> <nl> return AsBlock ( std : : move ( reductionResult ) , { { operandPlaceholder , operand } } , L " Sequence : : ReduceElements " , name ) ; <nl> } <nl> <nl> + FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const std : : wstring & name ) <nl> + { <nl> + return ReduceElements ( operand , reductionOpName , / * keepReducedDimensions = * / false , name ) ; <nl> + } <nl> + <nl> FunctionPtr ReduceSum ( const Variable & operand , const std : : wstring & name ) <nl> { <nl> return ReduceElements ( operand , PrimitiveFunction : : InternalSumReductionOpName , name ) ; <nl> namespace CNTK <nl> LogicError ( " ReduceElements : operand % S ; Invalid axis argument provided . To reduce an operand along its ordered dynamic axis use Sequence : : ReduceElements . " , <nl> operand . AsString ( ) . c_str ( ) ) ; <nl> } <nl> - <nl> + <nl> FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const Axis & axis , const std : : wstring & name ) <nl> { <nl> bool keepReducedDimensions = true ; <nl> namespace CNTK <nl> <nl> return ReduceElements ( operand , reductionOpName , axis , keepReducedDimensions , name ) ; <nl> } <nl> + <nl> + FunctionPtr ComposeReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const std : : vector < Axis > & axes , bool keepReducedDimensions , const std : : wstring & name ) <nl> + { <nl> + if ( <nl> + std : : any_of ( axes . begin ( ) , axes . end ( ) , <nl> + [ ] ( const Axis & axis ) { <nl> + return axis . IsStaticAxis ( ) | | <nl> + ( axis = = Axis : : AllStaticAxes ( ) ) | | <nl> + ( axis = = Axis : : AllAxes ( ) ) | | <nl> + ( axis = = Axis : : DefaultBatchAxis ( ) ) ; } ) <nl> + | | ( ( reductionOpName = = PrimitiveFunction : : InternalSumReductionOpName ) <nl> + & & std : : any_of ( axes . begin ( ) , axes . end ( ) , <nl> + [ ] ( const Axis & axis ) { return axis = = Axis : : OperandSequenceAxis ( ) ; } ) ) <nl> + ) <nl> + { <nl> + auto additionalProperties = Dictionary ( ) ; <nl> + additionalProperties [ PrimitiveFunction : : AttributeNameAxisVec ] = AsDictionaryValueVector ( axes ) ; <nl> + additionalProperties [ PrimitiveFunction : : AttributeNameReductionOpName ] = reductionOpName ; <nl> + additionalProperties [ PrimitiveFunction : : AttributeNameReductionKeepDimensions ] = keepReducedDimensions ; <nl> + return UnaryOp ( PrimitiveOpType : : ReduceElements , operand , std : : move ( additionalProperties ) , name ) ; <nl> + } <nl> + <nl> + LogicError ( " ReduceElements : operand % S ; Invalid axis argument provided . To reduce an operand along its ordered dynamic axis use Sequence : : ReduceElements . " , <nl> + operand . AsString ( ) . c_str ( ) ) ; <nl> + } <nl> + <nl> + / / / <nl> + / / / Compose reduction operation along multiple axes . <nl> + / / / Compose reduction along multiple axes to perform reduction over static axes first , then sequence axis and then batch axis . <nl> + / / / <nl> + FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const std : : vector < Axis > & axes , bool keepReducedDimensions , const std : : wstring & name ) <nl> + { <nl> + / / if axes is empty , raise error : <nl> + if ( axes . empty ( ) ) <nl> + LogicError ( " ReduceElements : operand % S ; Empty axes argument provided . " , operand . AsString ( ) . c_str ( ) ) ; <nl> + <nl> + / / if reduce over all axes , we directly compose the reduction node : <nl> + for ( auto & axis : axes ) <nl> + if ( axis = = Axis : : AllAxes ( ) | | axis = = Axis : : AllStaticAxes ( ) ) <nl> + return ComposeReduceElements ( operand , reductionOpName , axes , keepReducedDimensions , name ) ; <nl> + <nl> + std : : vector < Axis > static_axes ; <nl> + std : : vector < Axis > sequence_axes ; <nl> + std : : vector < Axis > batch_axes ; <nl> + bool static_axes_reduced = false ; <nl> + for ( auto & axis : axes ) <nl> + { <nl> + if ( axis . IsBatchAxis ( ) ) <nl> + { <nl> + batch_axes . push_back ( axis ) ; <nl> + } <nl> + else if ( axis . IsSequenceAxis ( ) ) <nl> + { <nl> + sequence_axes . push_back ( axis ) ; <nl> + } <nl> + else if ( axis . IsStaticAxis ( ) | | ( axis = = Axis : : AllStaticAxes ( ) ) ) <nl> + { <nl> + if ( axis = = Axis : : AllStaticAxes ( ) ) <nl> + static_axes_reduced = true ; <nl> + if ( static_axes_reduced & & static_axes . size ( ) > 1 ) <nl> + LogicError ( " ReduceElements : operand % S ; additional static axes are provided when doing reduction over AllStaticAxes . " , operand . AsString ( ) . c_str ( ) ) ; <nl> + static_axes . push_back ( axis ) ; <nl> + } <nl> + } <nl> + auto operand_placeholder = PlaceholderVariable ( L " reduction_operand " ) ; <nl> + <nl> + FunctionPtr res = operand_placeholder ; <nl> + if ( ! static_axes . empty ( ) ) <nl> + { <nl> + res = ComposeReduceElements ( res , reductionOpName , static_axes , keepReducedDimensions , name + L " _static_axes_subop " ) ; <nl> + } <nl> + if ( ! sequence_axes . empty ( ) ) <nl> + { <nl> + res = CNTK : : Sequence : : ReduceElements ( res , reductionOpName , keepReducedDimensions , name + L " _sequence_axes_subop " ) ; <nl> + } <nl> + if ( ! batch_axes . empty ( ) ) <nl> + { <nl> + res = ComposeReduceElements ( res , reductionOpName , batch_axes , keepReducedDimensions , name + L " _batch_axes_subop " ) ; <nl> + } <nl> + return AsBlock ( std : : move ( res ) , { { operand_placeholder , operand } } , L " MultiAxisReduce " , name ) ; <nl> + } <nl> + <nl> + FunctionPtr ReduceElements ( const Variable & operand , const std : : wstring & reductionOpName , const std : : vector < Axis > & axes , const std : : wstring & name ) <nl> + { <nl> + bool keepReducedDimensions = true ; <nl> + if ( std : : any_of ( axes . begin ( ) , axes . end ( ) , <nl> + [ ] ( const Axis & axis ) { return axis = = Axis : : AllStaticAxes ( ) | | axis = = Axis : : AllAxes ( ) ; } ) ) <nl> + keepReducedDimensions = false ; <nl> + <nl> + return ReduceElements ( operand , reductionOpName , axes , keepReducedDimensions , name ) ; <nl> + } <nl> <nl> FunctionPtr Convolution ( const Variable & convolutionMap , <nl> const Variable & operand , <nl> mmm a / Source / CNTKv2LibraryDll / PrimitiveFunction . cpp <nl> ppp b / Source / CNTKv2LibraryDll / PrimitiveFunction . cpp <nl> namespace CNTK <nl> { <nl> auto reduceAxis = [ ] ( Axis reductionAxis , Variable input , std : : vector < Axis > & outputDynamicAxes ) <nl> { <nl> + if ( ! reductionAxis . IsDynamicAxis ( ) ) return ; <nl> reductionAxis = NormalizeAxis ( reductionAxis , input ) ; <nl> for ( auto inputDynamicAxis : input . DynamicAxes ( ) ) <nl> { <nl> namespace CNTK <nl> outputDynamicAxes . push_back ( inputDynamicAxis ) ; <nl> } <nl> } ; <nl> + auto anyOfAxesInReduction = [ & functionConfig ] ( std : : function < bool ( const Axis & ) > axis_predicate ) <nl> + { <nl> + if ( functionConfig . Contains ( PrimitiveFunction : : AttributeNameAxis ) ) <nl> + return axis_predicate ( functionConfig [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) ) ; <nl> + else <nl> + { <nl> + auto & reductionAxes = functionConfig [ PrimitiveFunction : : AttributeNameAxisVec ] . Value < std : : vector < DictionaryValue > > ( ) ; <nl> + return std : : any_of ( reductionAxes . begin ( ) , <nl> + reductionAxes . end ( ) , <nl> + [ & axis_predicate ] ( const CNTK : : DictionaryValue & axis ) { return axis_predicate ( axis . Value < Axis > ( ) ) ; } ) ; <nl> <nl> + } <nl> + return false ; <nl> + } ; <nl> + <nl> / / We currently require that the inputs ' dynamic axes , if any , match <nl> std : : vector < Axis > outputDynamicAxes ; <nl> if ( ( op = = PrimitiveOpType : : SumAll ) | | <nl> - ( op = = PrimitiveOpType : : ReduceElements & & functionConfig [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) = = Axis : : AllAxes ( ) ) | | <nl> + ( op = = PrimitiveOpType : : ReduceElements & & anyOfAxesInReduction ( [ ] ( const Axis & axis ) { return axis = = Axis : : AllAxes ( ) ; } ) ) | | <nl> ( op = = PrimitiveOpType : : SquaredError ) | | <nl> ( op = = PrimitiveOpType : : CrossEntropyWithSoftmax ) | | <nl> ( op = = PrimitiveOpType : : EditDistanceError ) | | <nl> namespace CNTK <nl> { <nl> outputDynamicAxes = std : : vector < Axis > ( { Axis : : DefaultBatchAxis ( ) } ) ; <nl> } <nl> - else if ( ( op = = PrimitiveOpType : : ReduceElements ) & & functionConfig [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) . IsDynamicAxis ( ) & & ( inputs [ 0 ] . DynamicAxes ( ) ! = Axis : : UnknownDynamicAxes ( ) ) ) <nl> + else if ( op = = PrimitiveOpType : : ReduceElements <nl> + & & anyOfAxesInReduction ( [ ] ( const Axis & axis ) { return axis . IsDynamicAxis ( ) ; } ) / / still need this condition to go to the default dynamic axes setting branch ! <nl> + & & ( inputs [ 0 ] . DynamicAxes ( ) ! = Axis : : UnknownDynamicAxes ( ) ) <nl> + ) <nl> { <nl> - reduceAxis ( functionConfig [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) , inputs [ 0 ] , outputDynamicAxes ) ; <nl> + if ( functionConfig . Contains ( PrimitiveFunction : : AttributeNameAxis ) ) <nl> + { <nl> + auto reductionAxis = functionConfig [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) ; <nl> + reduceAxis ( reductionAxis , inputs [ 0 ] , outputDynamicAxes ) ; <nl> + } <nl> + else if ( functionConfig . Contains ( PrimitiveFunction : : AttributeNameAxisVec ) ) <nl> + { <nl> + auto & reductionAxes = functionConfig [ PrimitiveFunction : : AttributeNameAxisVec ] . Value < std : : vector < DictionaryValue > > ( ) ; <nl> + for ( const auto & axis : reductionAxes ) <nl> + { <nl> + auto reductionAxis = axis . Value < Axis > ( ) ; <nl> + reduceAxis ( reductionAxis , inputs [ 0 ] , outputDynamicAxes ) ; <nl> + } <nl> + } <nl> } <nl> else if ( ( op = = PrimitiveOpType : : Times ) & & ( functionConfig [ PrimitiveFunction : : AttributeNameInferInputRankToMap ] . Value < int > ( ) = = TimesReduceSequenceAxisWithoutInferredInputRank ) ) <nl> { <nl> namespace CNTK <nl> bool keepDimensions = true ; <nl> if ( m_attributes . Contains ( PrimitiveFunction : : AttributeNameReductionKeepDimensions ) ) <nl> keepDimensions = m_attributes [ PrimitiveFunction : : AttributeNameReductionKeepDimensions ] . Value < bool > ( ) ; <nl> - <nl> - auto reductionAxis = NormalizeAxis ( m_attributes [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) , m_inputs [ 0 ] ) ; <nl> - if ( reductionAxis = = Axis : : AllStaticAxes ( ) | | reductionAxis = = Axis : : AllAxes ( ) ) <nl> - outputShape = keepDimensions ? NDShape ( m_inputs [ 0 ] . Shape ( ) . Rank ( ) , 1 ) : NDShape ( { } ) ; <nl> - else if ( reductionAxis = = Axis : : DefaultBatchAxis ( ) ) <nl> + / / Note that we need to normalize the axes inside the attributes here / in InferOutputs <nl> + if ( m_attributes . Contains ( PrimitiveFunction : : AttributeNameAxisVec ) ) <nl> { <nl> - auto dynamicAxes = m_inputs [ 0 ] . DynamicAxes ( ) ; <nl> - if ( dynamicAxes ! = Axis : : UnknownDynamicAxes ( ) ) <nl> - { <nl> - if ( std : : find ( dynamicAxes . begin ( ) , dynamicAxes . end ( ) , Axis : : DefaultBatchAxis ( ) ) = = dynamicAxes . end ( ) ) <nl> - LogicError ( " ReduceElements : operand % S ; No batch axis found during reduction along the batch axis . " , m_inputs [ 0 ] . AsString ( ) . c_str ( ) ) ; <nl> - <nl> - if ( dynamicAxes . size ( ) > 1 ) <nl> - LogicError ( " ReduceElements : operand % S ; Reduction along the batch axis on input sequence is currently unsupported . " , m_inputs [ 0 ] . AsString ( ) . c_str ( ) ) ; <nl> + auto & axisDictionary = m_attributes [ PrimitiveFunction : : AttributeNameAxisVec ] . Value < std : : vector < DictionaryValue > > ( ) ; <nl> + for ( auto & value : axisDictionary ) { <nl> + auto reductionAxis = NormalizeAxis ( value . Value < Axis > ( ) , m_inputs [ 0 ] ) ; <nl> } <nl> - <nl> - outputShape = m_inputs [ 0 ] . Shape ( ) ; <nl> } <nl> - else if ( reductionAxis . IsDynamicAxis ( ) ) <nl> - outputShape = m_inputs [ 0 ] . Shape ( ) ; <nl> + else if ( m_attributes . Contains ( PrimitiveFunction : : AttributeNameAxis ) ) <nl> + { <nl> + auto reductionAxis = NormalizeAxis ( m_attributes [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) , m_inputs [ 0 ] ) ; <nl> + } <nl> else <nl> { <nl> - std : : vector < int > reductionAxes = { reductionAxis . StaticAxisIndex ( ) } ; <nl> - outputShape = ReductionOpOutputShape ( m_op , m_inputs [ 0 ] . Shape ( ) , reductionAxes , / * preserveReductionAxes = * / keepDimensions ) ; <nl> + RuntimeError ( " Function ' % ls ' : Reduce operation with no ' % ls ' or ' % ls ' attributes " , <nl> + AsString ( ) . c_str ( ) , <nl> + PrimitiveFunction : : AttributeNameAxis . c_str ( ) , <nl> + PrimitiveFunction : : AttributeNameAxisVec . c_str ( ) <nl> + ) ; <nl> + } <nl> + <nl> + std : : vector < Axis > staticAxesToReduce ; <nl> + std : : vector < Axis > batchAxesToReduce ; <nl> + std : : vector < Axis > dynamicAxesToReduce ; <nl> + bool isAllAxesReduced ; <nl> + <nl> + CollectReduceOutputAxesForOutputShape ( staticAxesToReduce , batchAxesToReduce , dynamicAxesToReduce , isAllAxesReduced ) ; <nl> + if ( isAllAxesReduced ) { <nl> + outputShape = keepDimensions ? NDShape ( m_inputs [ 0 ] . Shape ( ) . Rank ( ) , 1 ) : NDShape ( { } ) ; <nl> + } <nl> + else { <nl> + / / TODO for very far future : Handle reduction on ( multiple ) batches all in once : batchAxesToReduce <nl> + / / TODO for very far future : Handle reduction on ( multiple ) sequences all in once : sequenceAxesToReduce <nl> + if ( ! staticAxesToReduce . empty ( ) ) <nl> + { <nl> + std : : vector < int > reductionAxesInIndcies ( staticAxesToReduce . size ( ) ) ; <nl> + for ( auto i = 0 ; i < staticAxesToReduce . size ( ) ; + + i ) <nl> + { <nl> + reductionAxesInIndcies [ i ] = staticAxesToReduce [ i ] . StaticAxisIndex ( ) ; <nl> + } <nl> + outputShape = ReductionOpOutputShape ( m_op , m_inputs [ 0 ] . Shape ( ) , reductionAxesInIndcies , / * preserveReductionAxes = * / keepDimensions ) ; <nl> + } <nl> + else <nl> + outputShape = m_inputs [ 0 ] . Shape ( ) ; <nl> } <nl> break ; <nl> } <nl> namespace CNTK <nl> } <nl> } <nl> <nl> + / * * <nl> + * Collect output axes for reduce operation . <nl> + * @ param staticAxesToReduce a list of static axes to reduce <nl> + * @ param batchAxesToReduce a list of batch axes to reduce <nl> + * @ param sequenceAxesToReduce a list of sequence axes to reduce <nl> + * @ param isAllAxesReduced a flag which indicates whether all axes need to be reduced <nl> + * / <nl> + void PrimitiveFunction : : CollectReduceOutputAxesForOutputShape ( <nl> + std : : vector < Axis > & staticAxesToReduce , <nl> + std : : vector < Axis > & batchAxesToReduce , <nl> + std : : vector < Axis > & sequenceAxesToReduce , <nl> + bool & isAllAxesReduced ) <nl> + { <nl> + isAllAxesReduced = false ; <nl> + <nl> + auto collect_axis = [ & ] ( const Axis & reductionAxis ) { <nl> + if ( reductionAxis = = Axis : : AllStaticAxes ( ) | | reductionAxis = = Axis : : AllAxes ( ) ) <nl> + isAllAxesReduced = true ; <nl> + else if ( reductionAxis = = Axis : : DefaultBatchAxis ( ) ) <nl> + { <nl> + auto dynamicAxes = m_inputs [ 0 ] . DynamicAxes ( ) ; <nl> + if ( dynamicAxes ! = Axis : : UnknownDynamicAxes ( ) ) <nl> + { <nl> + if ( std : : find ( dynamicAxes . begin ( ) , dynamicAxes . end ( ) , Axis : : DefaultBatchAxis ( ) ) = = dynamicAxes . end ( ) ) <nl> + LogicError ( " ReduceElements : operand % S ; No batch axis found during reduction along the batch axis . " , m_inputs [ 0 ] . AsString ( ) . c_str ( ) ) ; <nl> + <nl> + if ( dynamicAxes . size ( ) > 1 ) <nl> + LogicError ( " ReduceElements : operand % S ; Reduction along the batch axis on input sequence is currently unsupported . " , m_inputs [ 0 ] . AsString ( ) . c_str ( ) ) ; <nl> + } <nl> + batchAxesToReduce . push_back ( reductionAxis ) ; <nl> + } <nl> + else if ( reductionAxis . IsSequenceAxis ( ) ) <nl> + { <nl> + sequenceAxesToReduce . push_back ( reductionAxis ) ; <nl> + } <nl> + else <nl> + { <nl> + staticAxesToReduce . push_back ( reductionAxis ) ; <nl> + } <nl> + } ; <nl> + if ( m_attributes . Contains ( PrimitiveFunction : : AttributeNameAxisVec ) ) <nl> + { <nl> + const auto & axisDictionary = m_attributes [ PrimitiveFunction : : AttributeNameAxisVec ] . Value < std : : vector < DictionaryValue > > ( ) ; <nl> + for ( const auto & value : axisDictionary ) { <nl> + collect_axis ( value . Value < Axis > ( ) ) ; <nl> + } <nl> + <nl> + } <nl> + else if ( m_attributes . Contains ( PrimitiveFunction : : AttributeNameAxis ) ) <nl> + { <nl> + collect_axis ( m_attributes [ PrimitiveFunction : : AttributeNameAxis ] . Value < Axis > ( ) ) ; <nl> + } <nl> + else <nl> + { <nl> + RuntimeError ( " Function ' % ls ' : Reduce operation with no ' % ls ' or ' % ls ' attributes " , <nl> + AsString ( ) . c_str ( ) , <nl> + PrimitiveFunction : : AttributeNameAxis . c_str ( ) , <nl> + PrimitiveFunction : : AttributeNameAxisVec . c_str ( ) <nl> + ) ; <nl> + } <nl> + } <nl> + <nl> vector < DictionaryValue > GetInputUids ( const Function & f ) <nl> { <nl> auto inputs = f . Inputs ( ) ; <nl> mmm a / Source / CNTKv2LibraryDll / PrimitiveFunction . h <nl> ppp b / Source / CNTKv2LibraryDll / PrimitiveFunction . h <nl> namespace CNTK <nl> void SetDropoutRate ( double dropoutRate ) ; <nl> <nl> void SetRandomSeed ( size_t seed ) ; <nl> + private : <nl> + / / aux functions <nl> + void CollectReduceOutputAxesForOutputShape ( std : : vector < Axis > & staticAxesToReduce , <nl> + std : : vector < Axis > & batchAxesToReduce , <nl> + std : : vector < Axis > & dynamicAxesToReduce , <nl> + bool & isAllAxesReduced ) ; <nl> <nl> private : <nl> PrimitiveOpType m_op ; <nl> mmm a / Source / ComputationNetworkLib / ComputationNode . h <nl> ppp b / Source / ComputationNetworkLib / ComputationNode . h <nl> <nl> # define CNTK_MODEL_VERSION_24 24 / / ReduceElements : add keepDimensions <nl> # define CNTK_MODEL_VERSION_25 25 / / transpose : allow specifying a permutation <nl> # define CNTK_MODEL_VERSION_26 26 / / Update ROI pooling format to match Caffe version . <nl> - # define CNTK_MODEL_VERSION_27 27 / / Slice : support stride_multiplier , and to_batch / unpack_bach axis ops <nl> + # define CNTK_MODEL_VERSION_27 27 / / Slice : support stride_multiplier , and to_batch / unpack_bach axis ops ; <nl> + / / Reduction : Add reduction over multiple axes <nl> # define CURRENT_CNTK_MODEL_VERSION CNTK_MODEL_VERSION_27 <nl> <nl> / / helper mode for debugging <nl> mmm a / Source / ComputationNetworkLib / ReshapingNodes . cpp <nl> ppp b / Source / ComputationNetworkLib / ReshapingNodes . cpp <nl> <nl> # include < assert . h > <nl> # include < stack > <nl> # include < unordered_map > <nl> + # include < numeric > <nl> + # include < boost / algorithm / string / join . hpp > <nl> + # include < boost / range / adaptor / transformed . hpp > <nl> <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> <nl> template < class ElemType > <nl> if ( flags & CopyNodeFlags : : copyNodeValue ) <nl> { <nl> auto node = dynamic_pointer_cast < ReduceElementsNode < ElemType > > ( nodeP ) ; <nl> - node - > m_axis = m_axis ; <nl> + node - > m_axes = m_axes ; <nl> node - > m_operation = m_operation ; <nl> node - > m_reductionOp = m_reductionOp ; <nl> node - > m_scale = m_scale ; <nl> template < class ElemType > <nl> / * virtual * / void ReduceElementsNode < ElemType > : : Load ( File & fstream , size_t modelVersion ) / * override * / <nl> { <nl> Base : : Load ( fstream , modelVersion ) ; <nl> - fstream > > m_axis > > m_operation ; <nl> + m_axes . clear ( ) ; <nl> + int num_axes = 1 ; / / emulate old version in which only 1 axis is supported <nl> + if ( modelVersion > = CNTK_MODEL_VERSION_27 ) <nl> + fstream > > num_axes ; <nl> + for ( int i = 0 ; i < num_axes ; + + i ) <nl> + { <nl> + int axis ; <nl> + fstream > > axis ; <nl> + m_axes . push_back ( axis ) ; <nl> + } <nl> + fstream > > m_operation ; <nl> if ( modelVersion > = CNTK_MODEL_VERSION_24 ) <nl> fstream > > m_keepDimensions ; <nl> else <nl> - m_keepDimensions = DefaultKeepDimensionsSetting ( m_axis ) ; <nl> + m_keepDimensions = DefaultKeepDimensionsSetting ( m_axes ) ; <nl> <nl> ValidateOp ( ) ; <nl> } <nl> template < class ElemType > <nl> / * virtual * / void ReduceElementsNode < ElemType > : : Save ( File & fstream ) const / * override * / <nl> { <nl> Base : : Save ( fstream ) ; <nl> - fstream < < m_axis < < m_operation ; / / note : we serialize the string and not the opcode , since opcodes may change <nl> + fstream < < ( ( int ) m_axes . size ( ) ) ; <nl> + for ( int i = 0 ; i < m_axes . size ( ) ; + + i ) <nl> + { <nl> + fstream < < m_axes [ i ] ; <nl> + } <nl> + fstream < < m_operation ; / / note : we serialize the string and not the opcode , since opcodes may change <nl> fstream < < m_keepDimensions ; <nl> } <nl> <nl> template < class ElemType > <nl> { <nl> case ElementWiseOperator : : opArgmin : <nl> case ElementWiseOperator : : opArgmax : <nl> + if ( m_axes . size ( ) > 1 ) <nl> + LogicError ( " % ls : % s node cannot perform argmin or argmax operator over multiple axes . " , Base : : NodeDescription ( ) . c_str ( ) , typeid ( * this ) . name ( ) ) ; <nl> + <nl> result . DoArgReductionOpOf ( input , m_reductionOp ) ; <nl> break ; <nl> default : <nl> template < class ElemType > <nl> { <nl> / / validate the opcode ( in case we got instantiated empty and never updated ) <nl> ValidateOp ( ) ; <nl> + <nl> m_scale = ( ElemType ) 1 ; <nl> if ( ReduceAllAxes ( ) ) <nl> Base : : ValidateUnaryReduce ( isFinalValidationPass , m_keepDimensions ) ; <nl> template < class ElemType > <nl> <nl> let shape = Input ( 0 ) - > GetSampleLayout ( ) ; <nl> auto dims = shape . GetDims ( ) ; <nl> - size_t reducedDim = 0 ; / / ( init to keep compiler happy ) <nl> + size_t reducedDimProd = 1 ; <nl> if ( ReduceAllStaticAxes ( ) ) <nl> { <nl> - reducedDim = shape . GetNumElements ( ) ; <nl> + reducedDimProd = shape . GetNumElements ( ) ; <nl> dims = m_keepDimensions ? SmallVector < size_t > ( shape . GetRank ( ) , 1 ) : ( Environment ( ) . IsV2Library ( ) ? SmallVector < size_t > ( { } ) : SmallVector < size_t > ( { 1 } ) ) ; / / entire sample is reduced to a scalar <nl> } <nl> - else if ( m_axis - 1 > = 0 & & m_axis - 1 < dims . size ( ) ) <nl> + else if ( ! m_axes . empty ( ) <nl> + & & std : : all_of ( m_axes . begin ( ) , <nl> + m_axes . end ( ) , <nl> + [ & dims ] ( int axis ) { return axis - 1 > = 0 & & axis - 1 < dims . size ( ) ; } ) ) <nl> { <nl> - reducedDim = dims [ m_axis - 1 ] ; <nl> - / / one axis is reduced to a scalar <nl> + / / Accumulate the number of elements for reduce_mean <nl> + reducedDimProd = std : : accumulate ( m_axes . begin ( ) , <nl> + m_axes . end ( ) , <nl> + 1 , <nl> + [ & dims ] ( size_t acc , int & axis ) { return acc * dims [ axis - 1 ] ; } ) ; <nl> + <nl> + / / axes reduced to a scalar <nl> if ( m_keepDimensions ) <nl> - dims [ m_axis - 1 ] = 1 ; <nl> + std : : for_each ( m_axes . begin ( ) , <nl> + m_axes . end ( ) , <nl> + [ & dims ] ( int axis ) { dims [ axis - 1 ] = 1 ; } <nl> + ) ; <nl> else <nl> { <nl> - SmallVector < size_t > reducedDims ( dims . size ( ) - 1 ) ; <nl> + SmallVector < size_t > reducedDims ( dims . size ( ) - m_axes . size ( ) ) ; <nl> for ( size_t i = 0 , j = 0 ; i < dims . size ( ) ; + + i ) <nl> { <nl> - if ( i = = ( m_axis - 1 ) ) <nl> + if ( Contains ( m_axes , i + 1 ) ) / / note that axis = ( i + 1 ) mmm starting from 1 instead of 0 <nl> continue ; <nl> - <nl> reducedDims [ j ] = dims [ i ] ; <nl> j + + ; <nl> } <nl> dims = reducedDims ; <nl> } <nl> } <nl> - else if ( isFinalValidationPass ) <nl> - InvalidArgument ( " The shape of % ls [ % s ] has no axis % d " , NodeDescription ( ) . c_str ( ) , string ( shape ) . c_str ( ) , m_axis ) ; <nl> - <nl> + else if ( isFinalValidationPass ) <nl> + { <nl> + InvalidArgument ( " The shape of % ls [ % ls ] can not be reduced along axes [ % ls ] " , <nl> + NodeDescription ( ) . c_str ( ) , <nl> + wstring ( shape ) . c_str ( ) , <nl> + boost : : algorithm : : join ( m_axes | boost : : adaptors : : transformed ( [ ] ( int axis ) { return std : : to_wstring ( axis ) ; } ) , " , " ) . c_str ( ) <nl> + ) ; <nl> + } <nl> / / for " Mean " , we must divide by # elements <nl> if ( isFinalValidationPass & & IsMean ( ) ) <nl> - m_scale = ( ElemType ) ( 1 . 0 / reducedDim ) ; <nl> + m_scale = ( ElemType ) ( 1 . 0 / reducedDimProd ) ; <nl> <nl> SetDims ( TensorShape ( dims ) , Input ( 0 ) - > HasMBLayout ( ) ) ; <nl> } <nl> mmm a / Source / ComputationNetworkLib / ReshapingNodes . h <nl> ppp b / Source / ComputationNetworkLib / ReshapingNodes . h <nl> class ReduceElementsNode : public ComputationNode < ElemType > , public NumInputs < 1 > <nl> <nl> void ValidateOp ( ) ; <nl> <nl> + static inline bool Contains ( const std : : vector < int > & axes , int axis ) { return std : : find ( axes . begin ( ) , axes . end ( ) , axis ) ! = axes . end ( ) ; } <nl> static bool DefaultKeepDimensionsSetting ( int axis ) <nl> { <nl> return ! ( ( axis = = CNTKInternalIdxValueForAllStaticAxes ) | | ( axis = = CNTKInternalIdxValueForAllAxes ) ) ; <nl> } <nl> + static bool DefaultKeepDimensionsSetting ( const std : : vector < int > & axis ) <nl> + { <nl> + return ! ( Contains ( axis , CNTKInternalIdxValueForAllStaticAxes ) | | Contains ( axis , CNTKInternalIdxValueForAllAxes ) ) ; <nl> + } <nl> <nl> public : <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> class ReduceElementsNode : public ComputationNode < ElemType > , public NumInputs < 1 > <nl> <nl> public : <nl> ReduceElementsNode ( DEVICEID_TYPE deviceId , const wstring & name , const std : : wstring & operation , int axis , bool keepDimensions ) : <nl> - Base ( deviceId , name ) , m_operation ( operation ) , m_axis ( axis ) , m_reductionOp ( ( ElementWiseOperator ) - 1 / * invalid * / ) , m_scale ( 0 / * invalid * / ) , m_keepDimensions ( keepDimensions ) <nl> + Base ( deviceId , name ) , m_operation ( operation ) , m_axes ( { axis } ) , m_reductionOp ( ( ElementWiseOperator ) - 1 / * invalid * / ) , m_scale ( 0 / * invalid * / ) , m_keepDimensions ( keepDimensions ) <nl> { <nl> if ( ! m_operation . empty ( ) ) / / verify validity already here out of courtesy ( would otherwise be caught in Validate ( ) ) <nl> ValidateOp ( ) ; <nl> } <nl> <nl> ReduceElementsNode ( DEVICEID_TYPE deviceId , const wstring & name , const std : : wstring & operation = std : : wstring ( ) , int axis = CNTKInternalIdxValueForAllStaticAxes ) : <nl> + ReduceElementsNode ( deviceId , name , operation , { axis } , DefaultKeepDimensionsSetting ( axis ) ) <nl> + { <nl> + } <nl> + <nl> + ReduceElementsNode ( DEVICEID_TYPE deviceId , const wstring & name , const std : : wstring & operation , const std : : vector < int > & axis , bool keepDimensions ) : <nl> + Base ( deviceId , name ) , m_operation ( operation ) , m_axes ( axis ) , m_reductionOp ( ( ElementWiseOperator ) - 1 / * invalid * / ) , m_scale ( 0 / * invalid * / ) , m_keepDimensions ( keepDimensions ) <nl> + { <nl> + if ( ! m_operation . empty ( ) ) / / verify validity already here out of courtesy ( would otherwise be caught in Validate ( ) ) <nl> + ValidateOp ( ) ; <nl> + } <nl> + <nl> + ReduceElementsNode ( DEVICEID_TYPE deviceId , const wstring & name , const std : : wstring & operation , const std : : vector < int > & axis ) : <nl> ReduceElementsNode ( deviceId , name , operation , axis , DefaultKeepDimensionsSetting ( axis ) ) <nl> { <nl> } <nl> <nl> ReduceElementsNode ( const ScriptableObjects : : IConfigRecordPtr configp ) : <nl> - ReduceElementsNode ( configp - > Get ( L " deviceId " ) , L " < placeholder > " , configp - > Get ( L " reductionOp " ) , configp - > Get ( L " axis " ) ) <nl> + ReduceElementsNode ( configp - > Get ( L " deviceId " ) , L " < placeholder > " , configp - > Get ( L " reductionOp " ) , ( int ) configp - > Get ( L " axis " ) ) <nl> { <nl> AttachInputsFromConfig ( configp , this - > GetExpectedNumInputs ( ) ) ; <nl> } <nl> class ReduceElementsNode : public ComputationNode < ElemType > , public NumInputs < 1 > <nl> } <nl> <nl> std : : wstring ReductionOpName ( ) const { return m_operation ; } <nl> - int ReductionAxis ( ) const { return m_axis ; } <nl> + const std : : vector < int > & ReductionAxis ( ) const { return m_axes ; } <nl> <nl> static const int CNTKInternalIdxValueForAllStaticAxes = 0 ; <nl> static const int CNTKInternalIdxValueForAllAxes = - 1 ; <nl> class ReduceElementsNode : public ComputationNode < ElemType > , public NumInputs < 1 > <nl> <nl> private : <nl> bool IsMean ( ) const { return ( m_operation = = L " Mean " ) ; } <nl> - bool ReduceAllStaticAxes ( ) const { return m_axis = = CNTKInternalIdxValueForAllStaticAxes ; } <nl> - bool ReduceAllAxes ( ) const { return m_axis = = CNTKInternalIdxValueForAllAxes ; } <nl> - bool ReduceSequenceAxis ( ) const { return m_axis = = CNTKInternalIdxValueForSequenceAxis ; } <nl> - bool ReduceBatchAxis ( ) const { return m_axis = = CNTKInternalIdxValueForBatchAxis ; } <nl> + bool ReduceAllStaticAxes ( ) const { return Contains ( m_axes , CNTKInternalIdxValueForAllStaticAxes ) ; } <nl> + bool ReduceAllAxes ( ) const { return Contains ( m_axes , CNTKInternalIdxValueForAllAxes ) ; } <nl> + bool ReduceSequenceAxis ( ) const { return Contains ( m_axes , CNTKInternalIdxValueForSequenceAxis ) ; } <nl> + bool ReduceBatchAxis ( ) const { return Contains ( m_axes , CNTKInternalIdxValueForBatchAxis ) ; } <nl> <nl> private : <nl> / / operation attributes <nl> - int m_axis ; <nl> + std : : vector < int > m_axes ; <nl> std : : wstring m_operation ; / / the operation as a string , e . g . " Sum " , see ValidateOp ( ) <nl> bool m_keepDimensions ; <nl> <nl> mmm a / bindings / python / cntk / axis . py <nl> ppp b / bindings / python / cntk / axis . py <nl> def is_static_axis ( self ) : <nl> ' ' ' <nl> return super ( Axis , self ) . is_static_axis ( ) <nl> <nl> + @ property <nl> + def is_sequence_axis ( self ) : <nl> + ' ' ' <nl> + Returns True if the axis is a sequence axis and False otherwise <nl> + <nl> + Returns : <nl> + bool : True if this axis is a sequence axis and False otherwise <nl> + ' ' ' <nl> + return super ( Axis , self ) . is_sequence_axis ( ) <nl> + <nl> + @ property <nl> + def is_batch_axis ( self ) : <nl> + ' ' ' <nl> + Returns True if the axis is a batch axis and False otherwise <nl> + <nl> + Returns : <nl> + bool : True if this axis is a batch axis and False otherwise <nl> + ' ' ' <nl> + return super ( Axis , self ) . is_batch_axis ( ) <nl> + <nl> @ property <nl> def name ( self ) : <nl> ' ' ' <nl> mmm a / bindings / python / cntk / internal / sanitize . py <nl> ppp b / bindings / python / cntk / internal / sanitize . py <nl> def sanitize_axis_list ( axes ) : <nl> retAxes . append ( sanitize_axis ( ax ) ) <nl> return retAxes <nl> <nl> + def sanitize_multi_axis_reduction_list ( axes ) : <nl> + ' ' ' <nl> + Sanitizes a list of axes for multi - axis reduction which can not contain sequence axis . <nl> + <nl> + Args : <nl> + axes ( list of : class : ` ~ cntk . axis . Axis ` or int or None ) : the axes to be used . <nl> + <nl> + * : class : ` ~ cntk . axis . Axis ` : use axis instance directly ( will convert <nl> + row - to col - major in case of static axis ) . <nl> + * int : if positive , use it as static axis . If negative , count from <nl> + last to first axis <nl> + * None : denote all available axes <nl> + ' ' ' <nl> + if not type ( axes ) in ( list , tuple ) : <nl> + axes = [ axes ] <nl> + retAxes = [ ] <nl> + for ax in axes : <nl> + if ( isinstance ( ax , Axis ) ) and ( ax . is_sequence_axis ) : <nl> + raise ValueError ( ' Reduction operation over multiple axes can not contain sequence axis : % s ' % ax ) <nl> + retAxes . append ( sanitize_axis ( ax ) ) <nl> + return retAxes <nl> + <nl> def sanitize_dynamic_axes ( axes ) : <nl> if not type ( axes ) in ( list , tuple ) : <nl> axes = [ axes ] <nl> mmm a / bindings / python / cntk / ops / __init__ . py <nl> ppp b / bindings / python / cntk / ops / __init__ . py <nl> <nl> import numbers <nl> from . import sequence <nl> from . functions import CloneMethod , Function , BlockFunction , load_model , register_native_user_function , native_user_function <nl> - from cntk . internal import sanitize_input , sanitize_shape , sanitize_axis , sanitize_dynamic_axes , sanitize_axis_list , typemap , sanitize_pooling_args , sanitize_convolution_args , sanitize_permutation <nl> + from cntk . internal import sanitize_input , sanitize_shape , sanitize_axis , sanitize_dynamic_axes , sanitize_axis_list , sanitize_multi_axis_reduction_list , typemap , sanitize_pooling_args , sanitize_convolution_args , sanitize_permutation <nl> from cntk . internal . utils import get_data_type <nl> from . . axis import Axis <nl> from . . import cntk_py <nl> def gather ( reference , indices ) : <nl> @ typemap <nl> def reduce_sum ( x , axis = None , name = ' ' ) : <nl> ' ' ' <nl> - Computes the sum of the input tensor ' s elements across one axis . If the axis parameter <nl> + Computes the sum of the input tensor ' s elements across one axis or a list of axes . If the axis parameter <nl> is not specified then the sum will be computed over all static axes , which is <nl> equivalent with specifying ` ` axis = Axis . all_static_axes ( ) ` ` . If <nl> ` ` axis = Axis . all_axes ( ) ` ` is specified , then the output is a scalar which is the sum of all the <nl> def reduce_sum ( x , axis = None , name = ' ' ) : <nl> will happen across the batch axis ( In this case the input must not be a sequence ) . <nl> <nl> Example : <nl> - > > > x = C . sequence . input_variable ( ( 2 , 2 ) ) <nl> - > > > # create a batch of 2 sequences each containing 2 2x2 matrices <nl> - > > > x0 = np . arange ( 16 , dtype = np . float32 ) . reshape ( 2 , 2 , 2 , 2 ) <nl> - > > > # reduce over all static axes <nl> - > > > C . reduce_mean ( x ) . eval ( { x : x0 } ) <nl> - [ array ( [ 1 . 5 , 5 . 5 ] , dtype = float32 ) , <nl> - array ( [ 9 . 5 , 13 . 5 ] , dtype = float32 ) ] <nl> - > > > # reduce over specified axes <nl> - > > > C . reduce_mean ( x , axis = 0 ) . eval ( { x : x0 } ) <nl> - [ array ( [ [ [ 1 . , 2 . ] ] , <nl> - < BLANKLINE > <nl> - [ [ 5 . , 6 . ] ] ] , dtype = float32 ) , <nl> - < BLANKLINE > <nl> - < BLANKLINE > <nl> - array ( [ [ [ 9 . , 10 . ] ] , <nl> - < BLANKLINE > <nl> - [ [ 13 . , 14 . ] ] ] , dtype = float32 ) ] <nl> - > > > C . reduce_mean ( x , axis = 1 ) . eval ( { x : x0 } ) <nl> - [ array ( [ [ [ 0 . 5 ] , <nl> - [ 2 . 5 ] ] , <nl> - < BLANKLINE > <nl> - [ [ 4 . 5 ] , <nl> - [ 6 . 5 ] ] ] , dtype = float32 ) , <nl> - < BLANKLINE > <nl> + > > > # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample <nl> + > > > data = np . array ( [ [ [ 5 , 1 ] , [ 20 , 2 ] ] , [ [ 30 , 1 ] , [ 40 , 2 ] ] , [ [ 55 , 1 ] , [ 60 , 2 ] ] ] , dtype = np . float32 ) <nl> + <nl> + > > > C . reduce_sum ( data , 0 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 90 . , 3 . ] , <nl> + [ 120 . , 6 . ] ] ] , dtype = float32 ) <nl> + > > > np . sum ( data , axis = 0 ) . round ( 4 ) <nl> + array ( [ [ 90 . , 3 . ] , <nl> + [ 120 . , 6 . ] ] , dtype = float32 ) <nl> + > > > C . reduce_sum ( data , 1 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 25 . , 3 . ] ] , <nl> < BLANKLINE > <nl> - array ( [ [ [ 8 . 5 ] , <nl> - [ 10 . 5 ] ] , <nl> + [ [ 70 . , 3 . ] ] , <nl> < BLANKLINE > <nl> - [ [ 12 . 5 ] , <nl> - [ 14 . 5 ] ] ] , dtype = float32 ) ] <nl> - > > > # reduce over all axes <nl> - > > > np . round ( C . reduce_mean ( x , axis = C . Axis . all_axes ( ) ) . eval ( { x : x0 } ) , 5 ) <nl> - 7 . 5 <nl> - > > > # reduce over all axes when the batch has sequences of different length <nl> - > > > x1 = np . arange ( 4 , dtype = np . float32 ) . reshape ( 1 , 2 , 2 ) <nl> - > > > x2 = np . arange ( 12 , dtype = np . float32 ) . reshape ( 3 , 2 , 2 ) <nl> - > > > np . round ( C . reduce_mean ( x , axis = C . Axis . all_axes ( ) ) . eval ( { x : [ x1 , x2 ] } ) , 5 ) <nl> - 4 . 5 <nl> - > > > ( np . sum ( x1 ) + np . sum ( x2 ) ) / ( x1 . size + x2 . size ) <nl> - 4 . 5 <nl> - > > > # reduce over batch axis <nl> - > > > xv = C . input_variable ( ( 2 , 2 ) ) <nl> - > > > xd = np . arange ( 8 , dtype = np . float32 ) . reshape ( 2 , 2 , 2 ) <nl> - > > > C . reduce_sum ( xv , axis = C . Axis . default_batch_axis ( ) ) . eval ( { xv : xd } ) <nl> - array ( [ [ 4 . , 6 . ] , <nl> - [ 8 . , 10 . ] ] , dtype = float32 ) <nl> + [ [ 115 . , 3 . ] ] ] , dtype = float32 ) <nl> + > > > np . sum ( data , axis = 1 ) . round ( 4 ) <nl> + array ( [ [ 25 . , 3 . ] , <nl> + [ 70 . , 3 . ] , <nl> + [ 115 . , 3 . ] ] , dtype = float32 ) <nl> + > > > C . reduce_sum ( data , ( 0 , 2 ) ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 93 . ] , <nl> + [ 126 . ] ] ] , dtype = float32 ) <nl> <nl> Args : <nl> x : input tensor <nl> - axis ( int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> + axis ( int or : class : ` ~ cntk . axis . Axis ` or a : obj : ` list ` or : obj : ` tuple ` of int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> name ( str , optional ) : the name of the Function instance in the network <nl> <nl> Returns : <nl> : class : ` ~ cntk . ops . functions . Function ` <nl> + <nl> + Note that CNTK keeps the shape of the resulting tensors when reducing over multiple static axes . <nl> ' ' ' <nl> from cntk . cntk_py import reduce_sum <nl> x = sanitize_input ( x ) <nl> - axis = sanitize_axis ( axis ) <nl> + axis = sanitize_multi_axis_reduction_list ( axis ) <nl> return reduce_sum ( x , axis , name ) <nl> <nl> <nl> def reduce_sum ( x , axis = None , name = ' ' ) : <nl> def reduce_log_sum_exp ( x , axis = None , name = ' ' ) : <nl> ' ' ' <nl> Computes the log of the sum of the exponentiations of the input tensor ' s <nl> - elements across the specified axis . <nl> - <nl> - Example : <nl> - > > > x = C . input_variable ( shape = ( 3 , 2 ) ) <nl> - > > > val = np . reshape ( np . arange ( 6 . 0 , dtype = np . float32 ) , ( 3 , 2 ) ) <nl> - > > > lse = C . reduce_log_sum_exp ( x ) <nl> - > > > lse . eval ( { x : [ val ] } ) <nl> - array ( [ 5 . 456193 ] , dtype = float32 ) <nl> - > > > np . log ( np . sum ( np . exp ( val ) ) ) <nl> - 5 . 4561934 <nl> + elements across a specified axis or a list of specified axes . <nl> + <nl> + Example : <nl> + > > > # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample <nl> + > > > data = np . array ( [ [ [ 5 , 1 ] , [ 20 , 2 ] ] , [ [ 30 , 1 ] , [ 40 , 2 ] ] , [ [ 55 , 1 ] , [ 60 , 2 ] ] ] , dtype = np . float32 ) <nl> + <nl> + > > > C . reduce_log_sum_exp ( data , axis = 0 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 55 . , 2 . 0986 ] , <nl> + [ 60 . , 3 . 0986 ] ] ] , dtype = float32 ) <nl> + > > > np . log ( np . sum ( np . exp ( data ) , axis = 0 ) ) . round ( 4 ) <nl> + array ( [ [ 55 . , 2 . 0986 ] , <nl> + [ 60 . , 3 . 0986 ] ] , dtype = float32 ) <nl> + > > > C . reduce_log_sum_exp ( data , axis = ( 0 , 2 ) ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 55 . ] , <nl> + [ 60 . ] ] ] , dtype = float32 ) <nl> + > > > np . log ( np . sum ( np . exp ( data ) , axis = ( 0 , 2 ) ) ) . round ( 4 ) <nl> + array ( [ 55 . , 60 . ] , dtype = float32 ) <nl> + <nl> + > > > x = C . input_variable ( shape = ( 2 , 2 ) ) <nl> + > > > lse = C . reduce_log_sum_exp ( x , axis = [ C . axis . Axis . default_batch_axis ( ) , 1 ] ) <nl> + > > > lse . eval ( { x : data } ) . round ( 4 ) <nl> + array ( [ [ 55 . ] , <nl> + [ 60 . ] ] , dtype = float32 ) <nl> + > > > np . log ( np . sum ( np . exp ( data ) , axis = ( 0 , 2 ) ) ) . round ( 4 ) <nl> + array ( [ 55 . , 60 . ] , dtype = float32 ) <nl> <nl> Args : <nl> x : input tensor <nl> - axis ( int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> + axis ( int or : class : ` ~ cntk . axis . Axis ` or a : obj : ` list ` or : obj : ` tuple ` of int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> name ( str ) : the name of the Function instance in the network <nl> <nl> - See also : <nl> - : func : ` ~ cntk . ops . reduce_sum ` for more details and examples . <nl> - <nl> Returns : <nl> : class : ` ~ cntk . ops . functions . Function ` <nl> + <nl> + Note that CNTK keeps the shape of the resulting tensors when reducing over multiple static axes . <nl> ' ' ' <nl> # TODO : rename V2 API function as well from reduce_log_sum ( ) to reduce_log_sum_exp ( ) <nl> from cntk . cntk_py import reduce_log_sum <nl> x = sanitize_input ( x ) <nl> - axis = sanitize_axis ( axis ) <nl> + axis = sanitize_multi_axis_reduction_list ( axis ) <nl> return reduce_log_sum ( x , axis , name ) <nl> <nl> <nl> @ typemap <nl> def reduce_mean ( x , axis = None , name = ' ' ) : <nl> ' ' ' <nl> - Computes the mean of the input tensor ' s elements across the specified axis . <nl> + Computes the mean of the input tensor ' s elements across a specified axis or a list of specified axes . <nl> <nl> Example : <nl> - > > > # create 3x2 matrix in a sequence of length 1 in a batch of one sample <nl> - > > > data = [ [ 5 , 20 ] , [ 30 , 40 ] , [ 55 , 60 ] ] <nl> + > > > # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample <nl> + > > > data = np . array ( [ [ [ 5 , 1 ] , [ 20 , 2 ] ] , [ [ 30 , 1 ] , [ 40 , 2 ] ] , [ [ 55 , 1 ] , [ 60 , 2 ] ] ] , dtype = np . float32 ) <nl> <nl> - > > > C . reduce_mean ( data , 0 ) . eval ( ) <nl> - array ( [ [ 30 . , 40 . ] ] , dtype = float32 ) <nl> + > > > C . reduce_mean ( data , 0 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 30 . , 1 . ] , <nl> + [ 40 . , 2 . ] ] ] , dtype = float32 ) <nl> + > > > np . mean ( data , axis = 0 ) . round ( 4 ) <nl> + array ( [ [ 30 . , 1 . ] , <nl> + [ 40 . , 2 . ] ] , dtype = float32 ) <nl> + > > > C . reduce_mean ( data , 1 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 12 . 5 , 1 . 5 ] ] , <nl> + < BLANKLINE > <nl> + [ [ 35 . , 1 . 5 ] ] , <nl> + < BLANKLINE > <nl> + [ [ 57 . 5 , 1 . 5 ] ] ] , dtype = float32 ) <nl> + > > > np . mean ( data , axis = 1 ) . round ( 4 ) <nl> + array ( [ [ 12 . 5 , 1 . 5 ] , <nl> + [ 35 . , 1 . 5 ] , <nl> + [ 57 . 5 , 1 . 5 ] ] , dtype = float32 ) <nl> + > > > C . reduce_mean ( data , ( 0 , 2 ) ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 15 . 5 ] , <nl> + [ 21 . ] ] ] , dtype = float32 ) <nl> <nl> - > > > C . reduce_mean ( data , 1 ) . eval ( ) <nl> - array ( [ [ 12 . 5 ] , <nl> - [ 35 . ] , <nl> - [ 57 . 5 ] ] , dtype = float32 ) <nl> + > > > x = C . input_variable ( ( 2 , 2 ) ) <nl> + > > > C . reduce_mean ( x * 1 . 0 , ( C . Axis . default_batch_axis ( ) , 1 ) ) . eval ( { x : data } ) . round ( 4 ) <nl> + array ( [ [ 15 . 5 ] , <nl> + [ 21 . ] ] , dtype = float32 ) <nl> <nl> Args : <nl> x : input tensor <nl> - axis ( int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> + axis ( int or : class : ` ~ cntk . axis . Axis ` or a : obj : ` list ` or : obj : ` tuple ` of int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> name ( str , optional ) : the name of the Function instance in the network <nl> <nl> - See also : <nl> - : func : ` ~ cntk . ops . reduce_sum ` for more details and examples . <nl> - <nl> Returns : <nl> : class : ` ~ cntk . ops . functions . Function ` <nl> + <nl> + Note that CNTK keeps the shape of the resulting tensors when reducing over multiple static axes . <nl> ' ' ' <nl> from cntk . cntk_py import reduce_mean <nl> x = sanitize_input ( x ) <nl> - axis = sanitize_axis ( axis ) <nl> + axis = sanitize_multi_axis_reduction_list ( axis ) <nl> return reduce_mean ( x , axis , name ) <nl> <nl> <nl> @ typemap <nl> def reduce_max ( x , axis = None , name = ' ' ) : <nl> ' ' ' <nl> - Computes the max of the input tensor ' s elements across the specified axis . <nl> + Computes the max of the input tensor ' s elements across a specified axis or a list of specified axes . <nl> <nl> Example : <nl> - > > > # create 3x2 matrix in a sequence of length 1 in a batch of one sample <nl> - > > > data = [ [ 10 , 20 ] , [ 30 , 40 ] , [ 50 , 60 ] ] <nl> - <nl> - > > > C . reduce_max ( data , 0 ) . eval ( ) <nl> - array ( [ [ 50 . , 60 . ] ] , dtype = float32 ) <nl> + > > > # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample <nl> + > > > data = np . array ( [ [ [ 5 , 1 ] , [ 20 , 2 ] ] , [ [ 30 , 1 ] , [ 40 , 2 ] ] , [ [ 55 , 1 ] , [ 60 , 2 ] ] ] , dtype = np . float32 ) <nl> <nl> - > > > C . reduce_max ( data , 1 ) . eval ( ) <nl> - array ( [ [ 20 . ] , <nl> - [ 40 . ] , <nl> + > > > C . reduce_max ( data , 0 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 55 . , 1 . ] , <nl> + [ 60 . , 2 . ] ] ] , dtype = float32 ) <nl> + > > > C . reduce_max ( data , 1 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 20 . , 2 . ] ] , <nl> + < BLANKLINE > <nl> + [ [ 40 . , 2 . ] ] , <nl> + < BLANKLINE > <nl> + [ [ 60 . , 2 . ] ] ] , dtype = float32 ) <nl> + > > > C . reduce_max ( data , ( 0 , 2 ) ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 55 . ] , <nl> + [ 60 . ] ] ] , dtype = float32 ) <nl> + <nl> + > > > x = C . input_variable ( ( 2 , 2 ) ) <nl> + > > > C . reduce_max ( x * 1 . 0 , ( C . Axis . default_batch_axis ( ) , 1 ) ) . eval ( { x : data } ) . round ( 4 ) <nl> + array ( [ [ 55 . ] , <nl> [ 60 . ] ] , dtype = float32 ) <nl> <nl> Args : <nl> x : input tensor <nl> - axis ( int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> + axis ( int or : class : ` ~ cntk . axis . Axis ` or a : obj : ` list ` or : obj : ` tuple ` of int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> name ( str ) : the name of the Function instance in the network <nl> <nl> - See also : <nl> - : func : ` ~ cntk . ops . reduce_sum ` for more details and examples . <nl> - <nl> Returns : <nl> : class : ` ~ cntk . ops . functions . Function ` <nl> + <nl> + Note that CNTK keeps the shape of the resulting tensors when reducing over multiple static axes . <nl> ' ' ' <nl> from cntk . cntk_py import reduce_max <nl> x = sanitize_input ( x ) <nl> - axis = sanitize_axis ( axis ) <nl> + axis = sanitize_multi_axis_reduction_list ( axis ) <nl> return reduce_max ( x , axis , name ) <nl> <nl> <nl> @ typemap <nl> def reduce_min ( x , axis = None , name = ' ' ) : <nl> ' ' ' <nl> - Computes the min of the input tensor ' s elements across the specified axis . <nl> + Computes the min of the input tensor ' s elements across a specified axis or a list of specified axes . <nl> <nl> Example : <nl> - > > > # create 3x2 matrix in a sequence of length 1 in a batch of one sample <nl> - > > > data = [ [ 10 , 20 ] , [ 30 , 40 ] , [ 50 , 60 ] ] <nl> + > > > # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample <nl> + > > > data = np . array ( [ [ [ 5 , 1 ] , [ 20 , 2 ] ] , [ [ 30 , 1 ] , [ 40 , 2 ] ] , [ [ 55 , 1 ] , [ 60 , 2 ] ] ] , dtype = np . float32 ) <nl> <nl> - > > > C . reduce_min ( data , 0 ) . eval ( ) <nl> - array ( [ [ 10 . , 20 . ] ] , dtype = float32 ) <nl> + > > > C . reduce_min ( data , 0 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 5 . , 1 . ] , <nl> + [ 20 . , 2 . ] ] ] , dtype = float32 ) <nl> + > > > C . reduce_min ( data , 1 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 5 . , 1 . ] ] , <nl> + < BLANKLINE > <nl> + [ [ 30 . , 1 . ] ] , <nl> + < BLANKLINE > <nl> + [ [ 55 . , 1 . ] ] ] , dtype = float32 ) <nl> + > > > C . reduce_min ( data , ( 0 , 2 ) ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 1 . ] , <nl> + [ 2 . ] ] ] , dtype = float32 ) <nl> <nl> - > > > C . reduce_min ( data , 1 ) . eval ( ) <nl> - array ( [ [ 10 . ] , <nl> - [ 30 . ] , <nl> - [ 50 . ] ] , dtype = float32 ) <nl> + > > > x = C . input_variable ( ( 2 , 2 ) ) <nl> + > > > C . reduce_min ( x * 1 . 0 , ( C . Axis . default_batch_axis ( ) , 1 ) ) . eval ( { x : data } ) . round ( 4 ) <nl> + array ( [ [ 1 . ] , <nl> + [ 2 . ] ] , dtype = float32 ) <nl> <nl> Args : <nl> x : input tensor <nl> - axis ( int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> + axis ( int or : class : ` ~ cntk . axis . Axis ` or a list of integers or a list of : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> name ( str ) : the name of the Function instance in the network <nl> <nl> - See also : <nl> - : func : ` ~ cntk . ops . reduce_sum ` for more details and examples . <nl> - <nl> Returns : <nl> : class : ` ~ cntk . ops . functions . Function ` <nl> + <nl> + Note that CNTK keeps the shape of the resulting tensors when reducing over multiple static axes . <nl> ' ' ' <nl> from cntk . cntk_py import reduce_min <nl> x = sanitize_input ( x ) <nl> - axis = sanitize_axis ( axis ) <nl> + axis = sanitize_axis_list ( axis ) <nl> return reduce_min ( x , axis , name ) <nl> <nl> <nl> def reduce_prod ( x , axis = None , name = ' ' ) : <nl> Computes the min of the input tensor ' s elements across the specified axis . <nl> <nl> Example : <nl> - > > > # create 3x2 matrix in a sequence of length 1 in a batch of one sample <nl> - > > > data = [ [ 1 , 2 ] , [ 3 , 4 ] , [ 5 , 6 ] ] <nl> - <nl> - > > > C . reduce_prod ( data , 0 ) . eval ( ) <nl> - array ( [ [ 15 . , 48 . ] ] , dtype = float32 ) <nl> + > > > # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample <nl> + > > > data = np . array ( [ [ [ 5 , 1 ] , [ 20 , 2 ] ] , [ [ 30 , 1 ] , [ 40 , 2 ] ] , [ [ 55 , 1 ] , [ 60 , 2 ] ] ] , dtype = np . float32 ) <nl> <nl> - > > > C . reduce_prod ( data , 1 ) . eval ( ) <nl> - array ( [ [ 2 . ] , <nl> - [ 12 . ] , <nl> - [ 30 . ] ] , dtype = float32 ) <nl> + > > > C . reduce_prod ( data , 0 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 8250 . , 1 . ] , <nl> + [ 48000 . , 8 . ] ] ] , dtype = float32 ) <nl> + > > > C . reduce_prod ( data , 1 ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 100 . , 2 . ] ] , <nl> + < BLANKLINE > <nl> + [ [ 1200 . , 2 . ] ] , <nl> + < BLANKLINE > <nl> + [ [ 3300 . , 2 . ] ] ] , dtype = float32 ) <nl> + > > > C . reduce_prod ( data , ( 0 , 2 ) ) . eval ( ) . round ( 4 ) <nl> + array ( [ [ [ 8250 . ] , <nl> + [ 384000 . ] ] ] , dtype = float32 ) <nl> + <nl> + > > > x = C . input_variable ( ( 2 , 2 ) ) <nl> + > > > C . reduce_prod ( x * 1 . 0 , ( C . Axis . default_batch_axis ( ) , 1 ) ) . eval ( { x : data } ) . round ( 4 ) <nl> + array ( [ [ 8250 . ] , <nl> + [ 384000 . ] ] , dtype = float32 ) <nl> <nl> Args : <nl> x : input tensor <nl> - axis ( int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> + axis ( int or : class : ` ~ cntk . axis . Axis ` or a : obj : ` list ` or : obj : ` tuple ` of int or : class : ` ~ cntk . axis . Axis ` ) : axis along which the reduction will be performed <nl> name ( str ) : the name of the Function instance in the network <nl> <nl> - See also : <nl> - : func : ` ~ cntk . ops . reduce_sum ` for more details and examples . <nl> - <nl> Returns : <nl> : class : ` ~ cntk . ops . functions . Function ` <nl> + <nl> + Note that CNTK keeps the shape of the resulting tensors when reducing over multiple static axes . <nl> ' ' ' <nl> from cntk . cntk_py import reduce_prod <nl> x = sanitize_input ( x ) <nl> - axis = sanitize_axis ( axis ) <nl> + axis = sanitize_multi_axis_reduction_list ( axis ) <nl> return reduce_prod ( x , axis , name ) <nl> <nl> @ typemap <nl> mmm a / bindings / python / cntk / ops / tests / reduction_test . py <nl> ppp b / bindings / python / cntk / ops / tests / reduction_test . py <nl> <nl> <nl> from __future__ import division <nl> import numpy as np <nl> + import itertools <nl> import pytest <nl> import cntk as C <nl> from . ops_test_utils import unittest_helper , _test_unary_op , AA , precision , PRECISION_TO_TYPE , constant <nl> from cntk . internal import sanitize_dtype_cntk <nl> + from . . import reduce_sum , reduce_max , reduce_min , reduce_mean , reduce_log_sum_exp , reduce_prod <nl> <nl> REDUCE_TEST_OPERANDS = [ <nl> # ( input_data , axis ) <nl> ( [ [ 1 ] ] , 0 ) , <nl> + ( [ [ 1 ] ] , [ 0 ] ) , <nl> + ( [ [ 1 ] ] , [ 0 , 1 ] ) , <nl> ( [ [ 1 , 2 ] , [ 4 , 5 ] ] , 0 ) , <nl> + ( [ [ 1 , 2 ] , [ 4 , 5 ] ] , [ 0 ] ) , <nl> + ( [ [ 1 , 2 ] , [ 4 , 5 ] ] , [ 0 , 1 ] ) , <nl> ( [ [ 1 , 2 ] , [ 4 , 5 ] ] , 1 ) , <nl> ( [ [ 1 , 2 ] , [ 4 , 5 ] ] , - 1 ) , <nl> + ( [ [ 1 , 2 ] , [ 4 , 5 ] ] , [ - 1 ] ) , <nl> ( [ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] ] , - 2 ) , <nl> + ( [ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] ] , [ 0 , - 2 ] ) , <nl> ( [ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] ] , 2 ) , <nl> + ( [ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] ] , [ 1 , 2 ] ) , <nl> ] <nl> <nl> @ pytest . mark . parametrize ( " input_data , axis " , REDUCE_TEST_OPERANDS ) <nl> def test_op_reduce_sum ( input_data , axis , device_id , precision ) : <nl> <nl> data = AA ( input_data , dtype = dt ) <nl> <nl> - expected_forward = [ np . sum ( data , axis = ( axis ) , keepdims = True ) ] <nl> - <nl> + axis = tuple ( axis ) if isinstance ( axis , list ) else ( axis ) <nl> + expected_forward = [ np . sum ( data , axis = axis , keepdims = True ) ] <nl> backward = np . ones_like ( data ) <nl> <nl> expected_backward = { <nl> def test_op_reduce_max ( input_data , axis , device_id , precision ) : <nl> <nl> data = AA ( input_data , dtype = dt ) <nl> <nl> - expected_forward = [ np . amax ( data , axis = ( axis ) , keepdims = True ) ] <nl> + axis = tuple ( axis ) if isinstance ( axis , list ) else ( axis ) <nl> + expected_forward = [ np . amax ( data , axis = axis , keepdims = True ) ] <nl> <nl> forward_array = np . asarray ( expected_forward , dtype = dt ) <nl> max_elements = forward_array . reshape ( forward_array . size ) . tolist ( ) <nl> def test_op_reduce_min ( input_data , axis , device_id , precision ) : <nl> dt = PRECISION_TO_TYPE [ precision ] <nl> <nl> data = AA ( input_data , dtype = dt ) <nl> + axis = tuple ( axis ) if isinstance ( axis , list ) else ( axis ) <nl> <nl> - expected_forward = [ np . amin ( data , axis = ( axis ) , keepdims = True ) ] <nl> + expected_forward = [ np . amin ( data , axis = axis , keepdims = True ) ] <nl> <nl> forward_array = np . asarray ( expected_forward , dtype = dt ) <nl> max_elements = forward_array . reshape ( forward_array . size ) . tolist ( ) <nl> def test_op_reduce_mean ( input_data , axis , device_id , precision ) : <nl> dt = PRECISION_TO_TYPE [ precision ] <nl> <nl> data = AA ( input_data , dtype = dt ) <nl> + axis = tuple ( axis ) if isinstance ( axis , list ) else ( axis ) <nl> + expected_forward = [ np . mean ( data , axis = axis , keepdims = True ) ] <nl> <nl> - expected_forward = [ np . mean ( data , axis = ( axis ) , keepdims = True ) ] <nl> - <nl> - backward = np . ones_like ( data ) / data . shape [ axis ] <nl> + counts = np . prod ( [ data . shape [ a ] for a in axis ] ) if type ( axis ) in [ list , tuple ] else data . shape [ axis ] <nl> + backward = np . ones_like ( data ) / counts <nl> <nl> expected_backward = { <nl> ' arg ' : [ backward ] <nl> def test_op_reduce_log_sum ( input_data , axis , device_id , precision ) : <nl> dt = PRECISION_TO_TYPE [ precision ] <nl> <nl> data = AA ( input_data , dtype = dt ) <nl> + axis = tuple ( axis ) if isinstance ( axis , list ) else ( axis ) <nl> <nl> data_exp = np . exp ( data ) <nl> - sum_exp = np . sum ( data_exp , axis = ( axis ) , keepdims = True ) <nl> + sum_exp = np . sum ( data_exp , axis = axis , keepdims = True ) <nl> expected_forward = [ np . log ( sum_exp ) ] <nl> <nl> backward = data_exp / sum_exp <nl> def test_op_reduce_prod ( input_data , axis , device_id , precision ) : <nl> dt = PRECISION_TO_TYPE [ precision ] <nl> <nl> data = AA ( input_data , dtype = dt ) <nl> + axis = tuple ( axis ) if isinstance ( axis , list ) else ( axis ) <nl> <nl> - p = np . prod ( data , axis = ( axis ) , keepdims = True ) <nl> + p = np . prod ( data , axis = axis , keepdims = True ) <nl> expected_forward = [ p ] <nl> <nl> backward = p / data <nl> def max_bwd ( x , f ) : <nl> ( reduce_log_sum_exp , lambda x : AA ( np . log ( sum ( np . sum ( np . exp ( xi ) ) for xi in x ) ) ) , lambda x , f : [ np . exp ( xi - f ) for xi in x ] ) , <nl> ( reduce_prod , lambda x : AA ( np . prod ( [ np . prod ( xi ) for xi in x ] ) ) , lambda x , f : [ f / xi for xi in x ] ) <nl> ] <nl> - <nl> + <nl> for op , fwd , bwd in ops : <nl> input_op = op ( a , axis = Axis . all_axes ( ) ) <nl> expected_forward = fwd ( value ) <nl> def test_op_reduce_mean_all_constant ( input_data , axis , device_id , precision ) : <nl> ( [ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] ] ) , <nl> ] <nl> <nl> + <nl> + # TODO : The implementation of this functon requires that all values in the data are distinct . <nl> + def min_max_bwd ( x , f , dtype ) : <nl> + forward_array = np . asarray ( f , dtype = dtype ) <nl> + min_max_elements = forward_array . reshape ( forward_array . size ) . tolist ( ) <nl> + # place 1 . 0s where minimum or maximum elements are <nl> + backward = np . zeros_like ( x ) <nl> + for element in min_max_elements : <nl> + backward + = np . asarray ( x = = element ) <nl> + return backward <nl> + <nl> + <nl> @ pytest . mark . parametrize ( " input_data " , REDUCE_BATCH_TEST_OPERANDS ) <nl> def test_op_reduce_over_batch_axis ( input_data , device_id , precision ) : <nl> from . . import reduce_sum , reduce_max , reduce_min , reduce_mean , reduce_log_sum_exp , reduce_prod <nl> def test_op_reduce_over_batch_axis ( input_data , device_id , precision ) : <nl> dtype = sanitize_dtype_cntk ( dt ) , <nl> needs_gradient = True , <nl> name = ' a ' ) <nl> - <nl> - def min_max_bwd ( x , f ) : <nl> - forward_array = np . asarray ( f , dtype = dt ) <nl> - min_max_elements = forward_array . reshape ( forward_array . size ) . tolist ( ) <nl> - <nl> - # place 1 . 0s where minimum or maximum elements are <nl> - backward = np . zeros_like ( x ) <nl> - for element in min_max_elements : <nl> - backward + = np . asarray ( x = = element ) <nl> - <nl> - return backward <nl> - <nl> - ops = [ <nl> + ops = [ <nl> ( reduce_sum , lambda x : np . sum ( x , axis = 0 , keepdims = False ) , lambda x , f : np . ones_like ( x ) ) , <nl> - ( reduce_max , lambda x : np . amax ( x , axis = 0 , keepdims = False ) , lambda x , f : min_max_bwd ( x , f ) ) , <nl> - ( reduce_min , lambda x : np . amin ( x , axis = 0 , keepdims = False ) , lambda x , f : min_max_bwd ( x , f ) ) , <nl> + ( reduce_max , lambda x : np . amax ( x , axis = 0 , keepdims = False ) , lambda x , f : min_max_bwd ( x , f , dt ) ) , <nl> + ( reduce_min , lambda x : np . amin ( x , axis = 0 , keepdims = False ) , lambda x , f : min_max_bwd ( x , f , dt ) ) , <nl> ( reduce_mean , lambda x : np . mean ( x , axis = 0 , keepdims = False ) , lambda x , f : np . ones_like ( x ) / x . shape [ 0 ] ) , <nl> ( reduce_log_sum_exp , lambda x : np . log ( np . sum ( np . exp ( x ) , axis = 0 , keepdims = False ) ) , lambda x , f : np . exp ( x - f ) ) , <nl> ( reduce_prod , lambda x : np . prod ( x , axis = 0 , keepdims = False ) , lambda x , f : f / x ) <nl> def min_max_bwd ( x , f ) : <nl> <nl> @ pytest . mark . parametrize ( " input_data , axis " , REDUCE_TEST_OPERANDS ) <nl> def test_op_reduce_argmax ( input_data , axis , device_id , precision ) : <nl> + if isinstance ( axis , list ) : <nl> + # following numpy , argmax over multiple axis is not supported <nl> + return <nl> dt = PRECISION_TO_TYPE [ precision ] <nl> - <nl> data = AA ( input_data , dtype = dt ) <nl> <nl> # numpy argmax doesn ' t support keepdims <nl> - arg_shape = np . amax ( data , axis = ( axis ) , keepdims = True ) . shape <nl> - expected_forward = [ np . argmax ( data , axis = ( axis ) ) . reshape ( arg_shape ) ] <nl> + arg_shape = np . amax ( data , axis = axis , keepdims = True ) . shape <nl> + expected_forward = [ np . argmax ( data , axis = axis ) . reshape ( arg_shape ) ] <nl> <nl> from . . import argmax <nl> _test_unary_op ( precision , device_id , argmax , input_data , <nl> def test_op_reduce_argmax ( input_data , axis , device_id , precision ) : <nl> <nl> @ pytest . mark . parametrize ( " input_data , axis " , REDUCE_TEST_OPERANDS ) <nl> def test_op_reduce_argmin ( input_data , axis , device_id , precision ) : <nl> - dt = PRECISION_TO_TYPE [ precision ] <nl> + if isinstance ( axis , list ) : <nl> + # following numpy , argmin over multiple axis is not supported <nl> + return ; <nl> <nl> + dt = PRECISION_TO_TYPE [ precision ] <nl> data = AA ( input_data , dtype = dt ) <nl> <nl> # numpy argmin doesn ' t support keepdims <nl> - arg_shape = np . amin ( data , axis = ( axis ) , keepdims = True ) . shape <nl> - expected_forward = [ np . argmin ( data , axis = ( axis ) ) . reshape ( arg_shape ) ] <nl> + arg_shape = np . amin ( data , axis = axis , keepdims = True ) . shape <nl> + expected_forward = [ np . argmin ( data , axis = axis ) . reshape ( arg_shape ) ] <nl> <nl> from . . import argmin <nl> _test_unary_op ( precision , device_id , argmin , input_data , <nl> expected_forward , None , { ' axis ' : axis } ) <nl> + <nl> + # Note that due to the limited capability of np . amax ( there is no <nl> + # way to figure out which multi - dimensional index corresponds to <nl> + # the max or min values . To test the backward gradicent of <nl> + # reduce_max and reduce_min , we have to enforce all the <nl> + # numbers in the data set must be distinct to identify the index of <nl> + # max and min along multi - dimensional axes . <nl> + REDUCE_BATCH_SEQUENCE_STATIC_TEST_DATA = [ <nl> + [ # a data set <nl> + # batch axis : <nl> + [ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , ] , # a sequence <nl> + [ [ [ 9 , 10 ] , [ 11 , 12 ] ] , [ [ 13 , 14 ] , [ 15 , 16 ] ] , ] , # a sequence <nl> + ] , <nl> + [ # a data set <nl> + # batch axis : <nl> + [ [ [ 1 , 2 ] , [ 3 , 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , ] , # a sequence <nl> + [ [ [ 17 , 18 ] , [ 19 , 20 ] ] , [ [ 21 , 22 ] , [ 23 , 24 ] ] , ] , # a sequence <nl> + [ [ [ 9 , 10 ] , [ 11 , 12 ] ] , [ [ 13 , 14 ] , [ 15 , 16 ] ] , ] , # a sequence <nl> + ] , <nl> + ] <nl> + <nl> + REDUCE_BATCH_SEQUENCE_STATIC_TEST_AXES = [ <nl> + [ ] , <nl> + [ 0 ] , <nl> + [ 1 ] , <nl> + [ 0 , 1 ] <nl> + ] <nl> + <nl> + REDUCE_BATCH_SEQUENCE_DYNAMIC_TEST_AXES = [ <nl> + # test reduction over batch axis + static axes ; <nl> + # when static axes = [ ] , test reduction over batch axis <nl> + [ C . Axis . default_batch_axis ( ) ] , <nl> + # test reduction over sequence axis + static axes ; <nl> + # when static axes = [ ] , test reduction over sequence axis <nl> + # TODO : Comment the following out before we can have an agreement on whether we allow sequence axis here for now <nl> + # [ C . Axis . default_dynamic_axis ( ) ] , <nl> + # test reduction over batch axis + sequence axis + static axes ; <nl> + # when static axes = [ ] , test reduction over batch axis + sequence axis <nl> + # [ C . Axis . default_batch_axis ( ) , C . Axis . default_dynamic_axis ( ) ] , <nl> + ] <nl> + <nl> + REDUCE_BATCH_SEQUENCE_STATIC_TEST_OPERANDS = itertools . product ( REDUCE_BATCH_SEQUENCE_STATIC_TEST_DATA , REDUCE_BATCH_SEQUENCE_DYNAMIC_TEST_AXES , REDUCE_BATCH_SEQUENCE_STATIC_TEST_AXES ) <nl> + <nl> + def reduce_batch_sequence_static_ops ( dtype ) : <nl> + return [ <nl> + ( reduce_sum , lambda x , axes : np . sum ( x , axis = axes , keepdims = True ) , lambda x , f , axes : np . ones_like ( x ) ) , <nl> + ( reduce_max , lambda x , axes : np . amax ( x , axis = axes , keepdims = True ) , lambda x , f , axes : min_max_bwd ( x , f , dtype ) ) , <nl> + ( reduce_min , lambda x , axes : np . amin ( x , axis = axes , keepdims = True ) , lambda x , f , axes : min_max_bwd ( x , f , dtype ) ) , <nl> + ( reduce_mean , lambda x , axes : np . mean ( x , axis = axes , keepdims = True ) , <nl> + lambda x , f , axes : np . ones_like ( x ) / np . prod ( [ x . shape [ a ] for a in axes ] ) ) , <nl> + ( reduce_log_sum_exp , lambda x , axes : np . log ( np . sum ( np . exp ( x ) , axis = axes , keepdims = True ) ) , <nl> + lambda x , f , axes : np . exp ( x - f ) ) , <nl> + ( reduce_prod , lambda x , axes : np . prod ( x , axis = axes , keepdims = True ) , lambda x , f , axes : f / x ) <nl> + ] <nl> + <nl> + # aux function to the ops <nl> + def _test_reduce_ops ( input_var , data , op , cntk_axes , numpy_axes , fwd , bwd ) : <nl> + expected_forward = fwd ( data , numpy_axes ) <nl> + expected_backward = bwd ( data , expected_forward , numpy_axes ) <nl> + binding = { input_var : data } <nl> + <nl> + cntk_op = op ( input_var , axis = cntk_axes ) <nl> + actual_backward = cntk_op . grad ( binding ) <nl> + actual_forward = cntk_op . eval ( binding ) <nl> + <nl> + assert np . allclose ( actual_forward , expected_forward ) <nl> + for ab , eb in zip ( actual_backward , expected_backward ) : <nl> + assert np . allclose ( ab , eb ) <nl> + <nl> + <nl> + @ pytest . mark . parametrize ( " input_data , dynamic_axes , static_axes " , REDUCE_BATCH_SEQUENCE_STATIC_TEST_OPERANDS ) <nl> + def test_op_reduce_batch_sequence_static_axes_together ( input_data , dynamic_axes , static_axes , device_id , precision ) : <nl> + from cntk import Axis <nl> + <nl> + dt = PRECISION_TO_TYPE [ precision ] <nl> + data = AA ( input_data , dtype = dt ) <nl> + if dynamic_axes = = [ C . Axis . default_batch_axis ( ) ] : <nl> + # Reduction along the batch axis on input sequence is currently unsupported , so only batch axis input is tested <nl> + v = C . input_variable ( data . shape [ 1 : ] , <nl> + dtype = sanitize_dtype_cntk ( dt ) , <nl> + needs_gradient = True ) <nl> + numpy_axis_offset = 1 <nl> + ignore_max_min = True <nl> + else : <nl> + v = C . sequence . input_variable ( data . shape [ 2 : ] , <nl> + dtype = sanitize_dtype_cntk ( dt ) , <nl> + needs_gradient = True ) <nl> + numpy_axis_offset = 2 <nl> + ignore_max_min = False <nl> + <nl> + <nl> + for op , fwd , bwd in reduce_batch_sequence_static_ops ( dt ) : <nl> + cntk_axes = tuple ( dynamic_axes + static_axes ) <nl> + numpy_axes = tuple ( [ 0 if a = = C . Axis . default_batch_axis ( ) else 1 for a in dynamic_axes ] + [ ax + numpy_axis_offset for ax in static_axes ] ) <nl> + _test_reduce_ops ( v , data , op , cntk_axes , numpy_axes , fwd , bwd ) <nl> mmm a / bindings / python / cntk / ops / tests / sequence_test . py <nl> ppp b / bindings / python / cntk / ops / tests / sequence_test . py <nl> def test_sequence_reduce_over_reduced_scalar ( ) : <nl> op = C . sequence . reduce_sum ( C . reduce_sum ( x ) ) <nl> <nl> grad , result = op . grad ( { x : np . asarray ( [ [ - 1 ] , [ 3 ] , [ 5 ] ] , dtype = np . float32 ) } , outputs = [ op ] ) <nl> - assert np . array_equal ( result , [ 7 ] ) <nl> - assert np . array_equal ( grad [ 0 ] , [ [ 1 ] , [ 1 ] , [ 1 ] ] ) <nl> + assert np . array_equal ( result , [ 7 . 0 ] ) <nl> + assert np . array_equal ( grad [ 0 ] , [ [ 1 . 0 ] , [ 1 . 0 ] , [ 1 . 0 ] ] ) <nl> <nl> def test_op_broadcast_as ( device_id , precision ) : <nl> <nl>
|
Integrate yuqtang / StagingReductionOverMultiAxis into master
|
microsoft/CNTK
|
d512056024c8b23c62f1958c9dd59089fa8f6ea6
|
2017-07-26T06:52:41Z
|
mmm a / atom / renderer / lib / inspector . coffee <nl> ppp b / atom / renderer / lib / inspector . coffee <nl> <nl> window . onload = - > <nl> - inspectorFrame = document . getElementById ( ' inspector - app - iframe ' ) . contentWindow <nl> - <nl> # Use menu API to show context menu . <nl> - inspectorFrame . eval ' InspectorFrontendHost . showContextMenuAtPoint = parent . createMenu ' <nl> + InspectorFrontendHost . showContextMenuAtPoint = createMenu <nl> <nl> # Use dialog API to override file chooser dialog . <nl> - inspectorFrame . eval ' WebInspector . createFileSelectorElement = parent . createFileSelectorElement ' <nl> + WebInspector . createFileSelectorElement = createFileSelectorElement <nl> <nl> convertToMenuTemplate = ( items ) - > <nl> template = [ ] <nl> createFileSelectorElement = ( callback ) - > <nl> fileSelectorElement . style . display = ' none ' <nl> fileSelectorElement . click = showFileChooserDialog . bind this , callback <nl> return fileSelectorElement <nl> - <nl> - # Exposed for iframe . <nl> - window . createMenu = createMenu <nl> - window . createFileSelectorElement = createFileSelectorElement <nl>
|
Devtools no longer uses iframes
|
electron/electron
|
c1d7ad9631d24ec558c50a2fa8f35803fefc61e8
|
2015-09-03T08:50:24Z
|
mmm a / src / builtins / x87 / builtins - x87 . cc <nl> ppp b / src / builtins / x87 / builtins - x87 . cc <nl> void Builtins : : Generate_CompileLazy ( MacroAssembler * masm ) { <nl> __ test_b ( FieldOperand ( entry , SharedFunctionInfo : : kMarkedForTierUpByteOffset ) , <nl> Immediate ( 1 < < SharedFunctionInfo : : kMarkedForTierUpBitWithinByte ) ) ; <nl> __ j ( not_zero , & gotta_call_runtime_no_stack ) ; <nl> - / / Is the full code valid ? <nl> + <nl> + / / If SFI points to anything other than CompileLazy , install that . <nl> __ mov ( entry , FieldOperand ( entry , SharedFunctionInfo : : kCodeOffset ) ) ; <nl> - __ mov ( ebx , FieldOperand ( entry , Code : : kFlagsOffset ) ) ; <nl> - __ and_ ( ebx , Code : : KindField : : kMask ) ; <nl> - __ shr ( ebx , Code : : KindField : : kShift ) ; <nl> - __ cmp ( ebx , Immediate ( Code : : BUILTIN ) ) ; <nl> + __ Move ( ebx , masm - > CodeObject ( ) ) ; <nl> + __ cmp ( entry , ebx ) ; <nl> __ j ( equal , & gotta_call_runtime_no_stack ) ; <nl> - / / Yes , install the full code . <nl> + <nl> + / / Install the SFI ' s code entry . <nl> __ lea ( entry , FieldOperand ( entry , Code : : kHeaderSize ) ) ; <nl> __ mov ( FieldOperand ( closure , JSFunction : : kCodeEntryOffset ) , entry ) ; <nl> __ RecordWriteCodeEntryField ( closure , entry , ebx ) ; <nl>
|
X87 : [ Ignition ] Teach CompileLazy about interpreted functions .
|
v8/v8
|
c4e0b1598148613963925846ef05184245cd8b53
|
2017-01-05T07:07:40Z
|
mmm a / src / mongo / db / exec / collection_scan . cpp <nl> ppp b / src / mongo / db / exec / collection_scan . cpp <nl> PlanStage : : StageState CollectionScan : : returnIfMatches ( WorkingSetMember * member , <nl> + + _specificStats . docsTested ; <nl> <nl> if ( Filter : : passes ( member , _filter ) ) { <nl> + if ( _params . stopApplyingFilterAfterFirstMatch ) { <nl> + _filter = nullptr ; <nl> + } <nl> * out = memberID ; <nl> return PlanStage : : ADVANCED ; <nl> } else { <nl> mmm a / src / mongo / db / exec / collection_scan_common . h <nl> ppp b / src / mongo / db / exec / collection_scan_common . h <nl> struct CollectionScanParams { <nl> BACKWARD = - 1 , <nl> } ; <nl> <nl> - CollectionScanParams ( ) <nl> - : collection ( NULL ) , start ( RecordId ( ) ) , direction ( FORWARD ) , tailable ( false ) , maxScan ( 0 ) { } <nl> - <nl> / / What collection ? <nl> / / not owned <nl> - const Collection * collection ; <nl> + const Collection * collection = nullptr ; <nl> <nl> / / isNull by default . If you specify any value for this , you ' re responsible for the RecordId <nl> / / not being invalidated before the first call to work ( . . . ) . <nl> RecordId start ; <nl> <nl> - Direction direction ; <nl> + Direction direction = FORWARD ; <nl> <nl> / / Do we want the scan to be ' tailable ' ? Only meaningful if the collection is capped . <nl> - bool tailable ; <nl> + bool tailable = false ; <nl> + <nl> + / / Once the first matching document is found , assume that all documents after it must match . <nl> + / / This is useful for oplog queries where we know we will see records ordered by the ts field . <nl> + bool stopApplyingFilterAfterFirstMatch = false ; <nl> <nl> / / If non - zero , how many documents will we look at ? <nl> - size_t maxScan ; <nl> + size_t maxScan = 0 ; <nl> } ; <nl> <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / query / get_executor . cpp <nl> ppp b / src / mongo / db / query / get_executor . cpp <nl> StatusWith < unique_ptr < PlanExecutor > > getOplogStartHack ( OperationContext * txn , <nl> params . direction = CollectionScanParams : : FORWARD ; <nl> params . tailable = cq - > getQueryRequest ( ) . isTailable ( ) ; <nl> <nl> + / / If the query is just tsExpr , we know that every document in the collection after the first <nl> + / / matching one must also match . To avoid wasting time running the match expression on every <nl> + / / document to be returned , we tell the CollectionScan stage to stop applying the filter once it <nl> + / / finds the first match . <nl> + if ( cq - > root ( ) = = tsExpr ) { <nl> + params . stopApplyingFilterAfterFirstMatch = true ; <nl> + } <nl> + <nl> unique_ptr < WorkingSet > ws = make_unique < WorkingSet > ( ) ; <nl> unique_ptr < CollectionScan > cs = make_unique < CollectionScan > ( txn , params , ws . get ( ) , cq - > root ( ) ) ; <nl> / / Takes ownership of ' ws ' , ' cs ' , and ' cq ' . <nl>
|
SERVER - 24242 Stop applying the MatchExpression to OplogReplay queries after first match
|
mongodb/mongo
|
8a53668a313062adb9b4af48f5d76716e2ca58c8
|
2016-06-23T20:57:05Z
|
mmm a / src / core / hle / service / set / set . cpp <nl> ppp b / src / core / hle / service / set / set . cpp <nl> constexpr std : : array < LanguageCode , 17 > available_language_codes = { { <nl> LanguageCode : : ZH_HANT , <nl> } } ; <nl> <nl> + constexpr size_t pre4_0_0_max_entries = 0xF ; <nl> + constexpr size_t post4_0_0_max_entries = 0x40 ; <nl> + <nl> LanguageCode GetLanguageCodeFromIndex ( size_t index ) { <nl> return available_language_codes . at ( index ) ; <nl> } <nl> <nl> - void SET : : GetAvailableLanguageCodes ( Kernel : : HLERequestContext & ctx ) { <nl> - ctx . WriteBuffer ( available_language_codes ) ; <nl> + template < size_t size > <nl> + static std : : array < LanguageCode , size > MakeLanguageCodeSubset ( ) { <nl> + std : : array < LanguageCode , size > arr ; <nl> + std : : copy_n ( available_language_codes . begin ( ) , size , arr . begin ( ) ) ; <nl> + return arr ; <nl> + } <nl> <nl> + static void PushResponseLanguageCode ( Kernel : : HLERequestContext & ctx , size_t max_size ) { <nl> IPC : : ResponseBuilder rb { ctx , 3 } ; <nl> rb . Push ( RESULT_SUCCESS ) ; <nl> - rb . Push ( static_cast < u32 > ( available_language_codes . size ( ) ) ) ; <nl> + if ( available_language_codes . size ( ) > max_size ) <nl> + rb . Push ( static_cast < u32 > ( max_size ) ) ; <nl> + else <nl> + rb . Push ( static_cast < u32 > ( available_language_codes . size ( ) ) ) ; <nl> + } <nl> + <nl> + void SET : : GetAvailableLanguageCodes ( Kernel : : HLERequestContext & ctx ) { <nl> + if ( available_language_codes . size ( ) > pre4_0_0_max_entries ) <nl> + ctx . WriteBuffer ( MakeLanguageCodeSubset < pre4_0_0_max_entries > ( ) ) ; <nl> + else <nl> + ctx . WriteBuffer ( available_language_codes ) ; <nl> + <nl> + PushResponseLanguageCode ( ctx , pre4_0_0_max_entries ) ; <nl> + <nl> + LOG_DEBUG ( Service_SET , " called " ) ; <nl> + } <nl> + <nl> + void SET : : GetAvailableLanguageCodes2 ( Kernel : : HLERequestContext & ctx ) { <nl> + if ( available_language_codes . size ( ) > post4_0_0_max_entries ) <nl> + ctx . WriteBuffer ( MakeLanguageCodeSubset < post4_0_0_max_entries > ( ) ) ; <nl> + else <nl> + ctx . WriteBuffer ( available_language_codes ) ; <nl> + <nl> + PushResponseLanguageCode ( ctx , post4_0_0_max_entries ) ; <nl> <nl> LOG_DEBUG ( Service_SET , " called " ) ; <nl> } <nl> <nl> void SET : : GetAvailableLanguageCodeCount ( Kernel : : HLERequestContext & ctx ) { <nl> - IPC : : ResponseBuilder rb { ctx , 3 } ; <nl> - rb . Push ( RESULT_SUCCESS ) ; <nl> - rb . Push ( static_cast < u32 > ( available_language_codes . size ( ) ) ) ; <nl> + PushResponseLanguageCode ( ctx , pre4_0_0_max_entries ) ; <nl> + <nl> + LOG_DEBUG ( Service_SET , " called " ) ; <nl> + } <nl> + <nl> + void SET : : GetAvailableLanguageCodeCount2 ( Kernel : : HLERequestContext & ctx ) { <nl> + PushResponseLanguageCode ( ctx , post4_0_0_max_entries ) ; <nl> <nl> LOG_DEBUG ( Service_SET , " called " ) ; <nl> } <nl> SET : : SET ( ) : ServiceFramework ( " set " ) { <nl> { 2 , nullptr , " MakeLanguageCode " } , <nl> { 3 , & SET : : GetAvailableLanguageCodeCount , " GetAvailableLanguageCodeCount " } , <nl> { 4 , nullptr , " GetRegionCode " } , <nl> - { 5 , & SET : : GetAvailableLanguageCodes , " GetAvailableLanguageCodes2 " } , <nl> - { 6 , & SET : : GetAvailableLanguageCodeCount , " GetAvailableLanguageCodeCount2 " } , <nl> + { 5 , & SET : : GetAvailableLanguageCodes2 , " GetAvailableLanguageCodes2 " } , <nl> + { 6 , & SET : : GetAvailableLanguageCodeCount2 , " GetAvailableLanguageCodeCount2 " } , <nl> { 7 , nullptr , " GetKeyCodeMap " } , <nl> { 8 , nullptr , " GetQuestFlag " } , <nl> } ; <nl> mmm a / src / core / hle / service / set / set . h <nl> ppp b / src / core / hle / service / set / set . h <nl> class SET final : public ServiceFramework < SET > { <nl> private : <nl> void GetLanguageCode ( Kernel : : HLERequestContext & ctx ) ; <nl> void GetAvailableLanguageCodes ( Kernel : : HLERequestContext & ctx ) ; <nl> + void GetAvailableLanguageCodes2 ( Kernel : : HLERequestContext & ctx ) ; <nl> void GetAvailableLanguageCodeCount ( Kernel : : HLERequestContext & ctx ) ; <nl> + void GetAvailableLanguageCodeCount2 ( Kernel : : HLERequestContext & ctx ) ; <nl> } ; <nl> <nl> } / / namespace Service : : Set <nl>
|
Merge pull request from tech4me / languagecode_fix
|
yuzu-emu/yuzu
|
43a2598e26351a100a7bd52aba6633126cb3d510
|
2018-08-27T19:41:38Z
|
mmm a / validation - test / stdlib / UnicodeTrie . swift . gyb <nl> ppp b / validation - test / stdlib / UnicodeTrie . swift . gyb <nl> func checkGraphemeClusterSegmentation ( <nl> } <nl> expectEqual ( <nl> expectedBoundaries , actualBoundaries , <nl> - " scalars : \ ( asHex ( subject . unicodeScalars . lazy . map { $ 0 . value } . array ) ) " <nl> + " scalars : \ ( asHex ( Array ( subject . unicodeScalars . lazy . map { $ 0 . value } ) ) ) " <nl> ) <nl> <nl> let expectedCharacters : [ Character ] = Array ( subject . characters ) <nl>
|
[ stdlib ] kill off a missed " . array "
|
apple/swift
|
cc2643cf3a2366638cdc93dad7009b292490fdaf
|
2015-08-01T14:27:17Z
|
mmm a / src / mongo / db / instance . cpp <nl> ppp b / src / mongo / db / instance . cpp <nl> <nl> # include " mongo / platform / process_id . h " <nl> # include " mongo / s / d_logic . h " <nl> # include " mongo / s / stale_exception . h " / / for SendStaleConfigException <nl> + # include " mongo / scripting / engine . h " <nl> # include " mongo / util / fail_point_service . h " <nl> # include " mongo / util / file_allocator . h " <nl> # include " mongo / util / gcov . h " <nl> namespace { <nl> return new DBDirectClient ( ) ; <nl> } <nl> <nl> + MONGO_INITIALIZER ( CreateJSDirectClient ) <nl> + ( InitializerContext * context ) { <nl> + <nl> + directDBClient = createDirectClient ( ) ; <nl> + <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> mongo : : mutex exitMutex ( " exit " ) ; <nl> AtomicUInt numExitCalls = 0 ; <nl> <nl> mmm a / src / mongo / scripting / engine . cpp <nl> ppp b / src / mongo / scripting / engine . cpp <nl> <nl> namespace mongo { <nl> long long Scope : : _lastVersion = 1 ; <nl> static const unsigned kMaxJsFileLength = std : : numeric_limits < unsigned > : : max ( ) - 1 ; <nl> + DBClientBase * directDBClient ; <nl> <nl> ScriptEngine : : ScriptEngine ( ) : _scopeInitCallback ( ) { <nl> } <nl> namespace mongo { <nl> _loadedVersion = _lastVersion ; <nl> string coll = _localDBName + " . system . js " ; <nl> <nl> - static DBClientBase * db = createDirectClient ( ) ; <nl> - auto_ptr < DBClientCursor > c = db - > query ( coll , Query ( ) , 0 , 0 , NULL , QueryOption_SlaveOk , 0 ) ; <nl> + auto_ptr < DBClientCursor > c = directDBClient - > query ( coll , Query ( ) , 0 , 0 , NULL , <nl> + QueryOption_SlaveOk , 0 ) ; <nl> massert ( 16669 , " unable to get db client cursor from query " , c . get ( ) ) ; <nl> <nl> set < string > thisTime ; <nl> mmm a / src / mongo / scripting / engine . h <nl> ppp b / src / mongo / scripting / engine . h <nl> namespace mongo { <nl> typedef map < string , ScriptingFunction > FunctionCacheMap ; <nl> <nl> class DBClientWithCommands ; <nl> + class DBClientBase ; <nl> <nl> struct JSFile { <nl> const char * name ; <nl> namespace mongo { <nl> const char * jsSkipWhiteSpace ( const char * raw ) ; <nl> <nl> extern ScriptEngine * globalScriptEngine ; <nl> + extern DBClientBase * directDBClient ; <nl> } <nl>
|
SERVER - 13033 : Static Initalizer race condition with CreateDirectClient and server - side Javascript
|
mongodb/mongo
|
7be64ae7568306dcbf75335a5e80793f4ce1268d
|
2014-03-19T21:22:55Z
|
mmm a / examples / server_http_ex . cpp <nl> ppp b / examples / server_http_ex . cpp <nl> <nl> # include < sstream > <nl> # include < string > <nl> # include " dlib / server . h " <nl> - # include " dlib / ref . h " / / for ref ( ) <nl> <nl> using namespace dlib ; <nl> using namespace std ; <nl> class web_server : public server : : http_1a_c <nl> <nl> } ; <nl> <nl> - void thread ( web_server & the_server ) <nl> - { <nl> - try <nl> - { <nl> - / / Start the server . start ( ) blocks until the server is shutdown <nl> - / / by a call to clear ( ) <nl> - the_server . start ( ) ; <nl> - } <nl> - catch ( socket_error & e ) <nl> - { <nl> - cout < < " Socket error while starting server : " < < e . what ( ) < < endl ; <nl> - } <nl> - catch ( exception & e ) <nl> - { <nl> - cout < < " Error while starting server : " < < e . what ( ) < < endl ; <nl> - } <nl> - } <nl> - <nl> int main ( ) <nl> { <nl> try <nl> int main ( ) <nl> <nl> / / make it listen on port 5000 <nl> our_web_server . set_listening_port ( 5000 ) ; <nl> - <nl> - / / create a thread that will start the server . The ref ( ) here allows us to pass <nl> - / / our_web_server into the threaded function by reference . <nl> - thread_function t ( thread , dlib : : ref ( our_web_server ) ) ; <nl> + / / Tell the server to begin accepting connections . <nl> + our_web_server . start_async ( ) ; <nl> <nl> cout < < " Press enter to end this program " < < endl ; <nl> cin . get ( ) ; <nl> - / / this will cause the server to shut down <nl> - our_web_server . clear ( ) ; <nl> } <nl> catch ( exception & e ) <nl> { <nl> mmm a / examples / sockets_ex . cpp <nl> ppp b / examples / sockets_ex . cpp <nl> <nl> <nl> # include " dlib / sockets . h " <nl> # include " dlib / server . h " <nl> - # include " dlib / ref . h " / / for ref ( ) <nl> # include < iostream > <nl> <nl> using namespace dlib ; <nl> class serv : public server : : kernel_1a_c <nl> } ; <nl> <nl> <nl> - void thread ( serv & our_server ) <nl> - { <nl> - try <nl> - { <nl> - / / Start the server . start ( ) blocks until the server is shutdown <nl> - / / by a call to clear ( ) <nl> - our_server . start ( ) ; <nl> - } <nl> - catch ( socket_error & e ) <nl> - { <nl> - cout < < " Socket error while starting server : " < < e . what ( ) < < endl ; <nl> - } <nl> - catch ( exception & e ) <nl> - { <nl> - cout < < " Error while starting server : " < < e . what ( ) < < endl ; <nl> - } <nl> - } <nl> - <nl> - <nl> int main ( ) <nl> { <nl> try <nl> int main ( ) <nl> / / set up the server object we have made <nl> our_server . set_listening_port ( 1234 ) ; <nl> our_server . set_max_connections ( 1000 ) ; <nl> - <nl> - / / create a thread that will start the server . The ref ( ) here allows us to pass <nl> - / / our_server into the threaded function by reference . <nl> - thread_function t ( thread , dlib : : ref ( our_server ) ) ; <nl> + / / Tell the server to begin accepting connections . <nl> + our_server . start_async ( ) ; <nl> <nl> cout < < " Press enter to end this program " < < endl ; <nl> cin . get ( ) ; <nl> - / / this will cause the server to shut down <nl> - our_server . clear ( ) ; <nl> } <nl> catch ( exception & e ) <nl> { <nl> mmm a / examples / sockstreambuf_ex . cpp <nl> ppp b / examples / sockstreambuf_ex . cpp <nl> <nl> # include " dlib / sockets . h " <nl> # include " dlib / server . h " <nl> # include " dlib / sockstreambuf . h " <nl> - # include " dlib / ref . h " <nl> # include < iostream > <nl> <nl> using namespace dlib ; <nl> class serv : public server : : kernel_1a_c <nl> } ; <nl> <nl> <nl> - void thread ( serv & our_server ) <nl> - { <nl> - try <nl> - { <nl> - / / Start the server . start ( ) blocks until the server is shutdown <nl> - / / by a call to clear ( ) <nl> - our_server . start ( ) ; <nl> - } <nl> - catch ( socket_error & e ) <nl> - { <nl> - cout < < " Socket error while starting server : " < < e . what ( ) < < endl ; <nl> - } <nl> - catch ( exception & e ) <nl> - { <nl> - cout < < " Error while starting server : " < < e . what ( ) < < endl ; <nl> - } <nl> - } <nl> - <nl> - <nl> int main ( ) <nl> { <nl> try <nl> int main ( ) <nl> / / set up the server object we have made <nl> our_server . set_listening_port ( 1234 ) ; <nl> our_server . set_max_connections ( 1000 ) ; <nl> - <nl> - / / create a thread that will start the server . The ref ( ) here allows us to pass <nl> - / / our_server into the threaded function by reference . <nl> - thread_function t ( thread , dlib : : ref ( our_server ) ) ; <nl> + / / Tell the server to begin accepting connections . <nl> + our_server . start_async ( ) ; <nl> <nl> cout < < " Press enter to end this program " < < endl ; <nl> cin . get ( ) ; <nl> - / / this will cause the server to shut down <nl> - our_server . clear ( ) ; <nl> } <nl> catch ( exception & e ) <nl> { <nl>
|
Updated examples to use the simpler start_async ( ) to start the servers .
|
davisking/dlib
|
2c1332b3828c4cc15b9f1186bf1add58762a90e5
|
2012-09-01T01:48:34Z
|
new file mode 100644 <nl> index 000000000 . . 57221e2a5 <nl> mmm / dev / null <nl> ppp b / help / _plugin_menuentryseticon . htm <nl> <nl> + < ! DOCTYPE HTML PUBLIC " - / / W3C / / DTD HTML 4 . 01 Transitional / / EN " > <nl> + < html > <nl> + < head > <nl> + < title > _plugin_menuentryseticon < / title > <nl> + < meta name = " GENERATOR " content = " WinCHM " > <nl> + < meta http - equiv = " Content - Type " content = " text / html ; charset = UTF - 8 " > <nl> + < style > <nl> + html , body { <nl> + / * Default Font * / <nl> + font - family : Courier New ; <nl> + font - size : 11pt ; <nl> + } <nl> + < / style > <nl> + <nl> + < / head > <nl> + <nl> + < body > <nl> + < P > < STRONG > _plugin_menuseticon < / STRONG > < BR > This <nl> + function sets an icon to a menu . < BR > <nl> + < P > < STRONG > void _plugin_menuseticon ( < BR > int < / STRONG > <nl> + pluginHandle , / / plugin handle < BR > < STRONG > int < / STRONG > <nl> + hEntry , / / handle of the menu entry < BR > < STRONG > const ICONDATA * < / STRONG > icon / / icon data < BR > < STRONG > ) ; < / STRONG > < / P > <nl> + < P > < STRONG > Parameters < / STRONG > < / P > <nl> + < P > < U > pluginHandle < / U > : Handle of the calling plugin . < / P > <nl> + < P > < U > hEntry < / U > : Menu handle from a <nl> + previously - added child menu or from the main plugin menu . < / P > <nl> + < P > < U > icon < / U > : Icon data . See <nl> + bridgemain . h for a definition . < / P > <nl> + < P > < STRONG > Return Values < / STRONG > < BR > This function does not return a value . < / P > < / body > <nl> + < / html > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000 . . fcd19d8eb <nl> mmm / dev / null <nl> ppp b / help / _plugin_menuseticon . htm <nl> <nl> + < ! DOCTYPE HTML PUBLIC " - / / W3C / / DTD HTML 4 . 01 Transitional / / EN " > <nl> + < html > <nl> + < head > <nl> + < title > _plugin_menuseticon < / title > <nl> + < meta name = " GENERATOR " content = " WinCHM " > <nl> + < meta http - equiv = " Content - Type " content = " text / html ; charset = UTF - 8 " > <nl> + < style > <nl> + html , body { <nl> + / * Default Font * / <nl> + font - family : Courier New ; <nl> + font - size : 11pt ; <nl> + } <nl> + < / style > <nl> + <nl> + < / head > <nl> + <nl> + < body > <nl> + < P > < STRONG > _plugin_menuseticon < / STRONG > < BR > This function <nl> + sets an icon to a menu . < BR > <nl> + < P > < STRONG > void _plugin_menuseticon <nl> + ( < BR > int < / STRONG > hMenu , / / handle of the menu < BR > < STRONG > const ICONDATA * < / STRONG > <nl> + icon / / icon data < BR > < STRONG > ) ; < / STRONG > <nl> + < / P > <nl> + < P > < STRONG > Parameters < / STRONG > < / P > <nl> + < P > < U > hMenu < / U > : Menu handle from a <nl> + previously - added child menu or from the main plugin menu . < / P > <nl> + < P > < U > icon < / U > : Icon data . See bridgemain . h for a definition . < / P > <nl> + < P > < STRONG > Return Values < / STRONG > < BR > This function does not return a value . < / P > < / body > <nl> + < / html > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000 . . 5db709a1a <nl> mmm / dev / null <nl> ppp b / help / analyse_analyze_anal . htm <nl> <nl> + < ! DOCTYPE HTML PUBLIC " - / / W3C / / DTD HTML 4 . 01 Transitional / / EN " > <nl> + < html > <nl> + < head > <nl> + < title > analyse / analyze / anal < / title > <nl> + < meta name = " GENERATOR " content = " WinCHM " > <nl> + < meta http - equiv = " Content - Type " content = " text / html ; charset = UTF - 8 " > <nl> + < style > <nl> + html , body { <nl> + / * Default Font * / <nl> + font - family : Courier New ; <nl> + font - size : 11pt ; <nl> + } <nl> + < / style > <nl> + <nl> + < / head > <nl> + <nl> + < body > <nl> + < P > < STRONG > analyse [ , analyze , anal ] < / STRONG > < BR > Do function <nl> + analysis . < / P > <nl> + < P > < U > arguments < / U > < BR > This command has no arguments . < / P > <nl> + < P > < U > result < / U > < BR > This command does not set any result <nl> + variables . < / P > < / body > <nl> + < / html > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000 . . 974246fa0 <nl> mmm / dev / null <nl> ppp b / help / log . htm <nl> <nl> + < ! DOCTYPE HTML PUBLIC " - / / W3C / / DTD HTML 4 . 01 Transitional / / EN " > <nl> + < html > <nl> + < head > <nl> + < title > log < / title > <nl> + < meta name = " GENERATOR " content = " WinCHM " > <nl> + < meta http - equiv = " Content - Type " content = " text / html ; charset = UTF - 8 " > <nl> + < style > <nl> + html , body { <nl> + / * Default Font * / <nl> + font - family : Courier New ; <nl> + font - size : 11pt ; <nl> + } <nl> + < / style > <nl> + <nl> + < / head > <nl> + <nl> + < body > <nl> + < P > < STRONG > log < / STRONG > < BR > Put information in the log . < / P > <nl> + < P > < U > arguments < / U > < BR > [ arg1 ] : Format string ( see down for <nl> + more information ) . When not specified , a newline will be logged . < / P > <nl> + < P > [ argN ] : Data for the format string . < / P > <nl> + < P > < U > format string < / U > < BR > A format string like " Info 1 : <nl> + { 0 } , Info 2 : { 1 } \ n Info 3 : { 2 } " . In place of { n } the n - th argument after the <nl> + format string is inserted . You can specify how to format the inserted data by <nl> + prepending a format type : " { s0 } " logs a string . Other types are : " d " ( log as <nl> + signed decimal ) , " u " ( log as unsigned decimal ) , " p " ( log as 0x ? ? ? ? ? ? ? ? ) , " s " <nl> + ( log the string at the address specified ) . < BR > You can print a " { " by escaping it <nl> + like " { { " . Same for " { " . " \ n " inserts a newline . < / P > <nl> + < P > < U > result < / U > < BR > This command does not set any result <nl> + variables . < / P > < / body > <nl> + < / html > <nl> \ No newline at end of file <nl> mmm a / help / modcallfind . htm <nl> ppp b / help / modcallfind . htm <nl> <nl> < / style > <nl> <nl> < / head > <nl> + <nl> <nl> <nl> < body > <nl> <nl> < P class = rvps3 > [ arg2 ] : The size of the data to search <nl> in . < / P > <nl> < P class = rvps3 > <nl> - < U > <nl> - result <nl> - < BR > <nl> - < / U > The $ result variable is set to the number of <nl> + < U > result < / U > < BR > The $ result variable is set to the number of <nl> inter - modular calls found . < / P > < / body > <nl> < / html > <nl> mmm a / help / plugin_menuclear . htm <nl> ppp b / help / plugin_menuclear . htm <nl> <nl> } <nl> < / style > <nl> <nl> - < / head > <nl> + < / head > <nl> <nl> - < body > <nl> - < P > < STRONG > _plugin_menuclear < BR > < / STRONG > This function removes all entries and child menus <nl> - from a menu . It will < STRONG > not < / STRONG > remove the menu itself . < / P > <nl> - < P > <nl> - < STRONG > <nl> - bool & nbsp ; <nl> - < / STRONG > <nl> - < STRONG > <nl> - _plugin_menuclear <nl> <nl> - < / STRONG > <nl> - < STRONG > ( <nl> - < BR > int < / STRONG > hMenu <nl> - < STRONG > < / STRONG > / / menu handle & nbsp ; of the menu to clear & nbsp ; <nl> - <nl> - < BR > <nl> - < STRONG > ) ; < / STRONG > < / P > <nl> - < P > < STRONG > Parameters < / STRONG > < / P > <nl> - < P > < U > hMenu < / U > : Menu handle from a <nl> - previously - added child menu or from the main plugin menu . < / P > <nl> + < body > <nl> + < P > < STRONG > _plugin_menuclear < BR > < / STRONG > This function removes all entries and child menus <nl> + from a menu . It will < STRONG > not < / STRONG > remove the menu itself . < / P > <nl> + < P > <nl> + < STRONG > <nl> + bool & nbsp ; <nl> + < / STRONG > <nl> + < STRONG > <nl> + _plugin_menuclear <nl> + <nl> + < / STRONG > <nl> + < STRONG > ( <nl> + < BR > int < / STRONG > hMenu <nl> + < STRONG > < / STRONG > / / menu handle & nbsp ; of the menu to clear & nbsp ; <nl> + <nl> + < BR > <nl> + < STRONG > ) ; < / STRONG > < / P > <nl> + < P > < STRONG > Parameters < / STRONG > < / P > <nl> + < P > < U > hMenu < / U > : Menu handle from a <nl> + previously - added child menu or from the main plugin menu . < / P > <nl> < P > < STRONG > Return Values < / STRONG > < BR > Returns true on success . < / P > < / body > <nl> < / html > <nl> \ No newline at end of file <nl> Binary files a / help / x64_dbg . wcp and b / help / x64_dbg . wcp differ <nl> new file mode 100644 <nl> index 000000000 . . 8bb0f396b <nl> mmm / dev / null <nl> ppp b / help / yara . htm <nl> <nl> + < ! DOCTYPE HTML PUBLIC " - / / W3C / / DTD HTML 4 . 01 Transitional / / EN " > <nl> + < html > <nl> + < head > <nl> + < title > yara < / title > <nl> + < meta name = " GENERATOR " content = " WinCHM " > <nl> + < meta http - equiv = " Content - Type " content = " text / html ; charset = UTF - 8 " > <nl> + < style > <nl> + html , body { <nl> + / * Default Font * / <nl> + font - family : Courier New ; <nl> + font - size : 11pt ; <nl> + } <nl> + < / style > <nl> + <nl> + < / head > <nl> + <nl> + < body > <nl> + < P > < STRONG > yara < BR > < / STRONG > Apply Yara rules to a memory range . < / P > <nl> + < P > < U > arguments < / U > < BR > & nbsp ; arg1 : Rules file to apply . <nl> + This should be a full path . < / P > <nl> + < P > [ arg2 ] : Start address of the range to apply the rules to . If not specified , <nl> + the disassembly selection will be used . < / P > <nl> + < P > [ arg3 ] : Size of the range to apply the rules to . When not specified , <nl> + the whole page will be used . < / P > <nl> + < P > < U > result < BR > < / U > This command does not set any result <nl> + variables . < / P > < / body > <nl> + < / html > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000 . . b0c7b2cf2 <nl> mmm / dev / null <nl> ppp b / help / yaramod . htm <nl> <nl> + < ! DOCTYPE HTML PUBLIC " - / / W3C / / DTD HTML 4 . 01 Transitional / / EN " > <nl> + < html > <nl> + < head > <nl> + < title > yaramod < / title > <nl> + < meta name = " GENERATOR " content = " WinCHM " > <nl> + < meta http - equiv = " Content - Type " content = " text / html ; charset = UTF - 8 " > <nl> + < style > <nl> + html , body { <nl> + / * Default Font * / <nl> + font - family : Courier New ; <nl> + font - size : 11pt ; <nl> + } <nl> + < / style > <nl> + <nl> + < / head > <nl> + <nl> + < body > <nl> + < P > < STRONG > yaramod < BR > < / STRONG > Apply Yara rules to a module . < / P > <nl> + < P > < U > arguments < / U > < BR > & nbsp ; arg1 : Rules file to apply . This should be a full <nl> + path . < / P > <nl> + < P > & nbsp ; arg2 : Name of the module to apply the rules <nl> + to . < / P > <nl> + < P > < U > result < BR > < / U > This command does not set any result <nl> + variables . < / P > < / body > <nl> + < / html > <nl> \ No newline at end of file <nl> mmm a / x64_dbg_dbg / instruction . cpp <nl> ppp b / x64_dbg_dbg / instruction . cpp <nl> CMDRESULT cbInstrYara ( int argc , char * argv [ ] ) <nl> } <nl> uint addr = 0 ; <nl> if ( argc < 3 | | ! valfromstring ( argv [ 2 ] , & addr ) ) <nl> - addr = GetContextDataEx ( hActiveThread , UE_CIP ) ; <nl> + { <nl> + SELECTIONDATA sel ; <nl> + GuiSelectionGet ( GUI_DISASSEMBLY , & sel ) ; <nl> + addr = sel . start ; <nl> + } <nl> uint size = 0 ; <nl> if ( argc > = 4 ) <nl> if ( ! valfromstring ( argv [ 3 ] , & size ) ) <nl> CMDRESULT cbInstrYara ( int argc , char * argv [ ] ) <nl> if ( ! size ) <nl> addr = MemFindBaseAddr ( addr , & size ) ; <nl> uint base = addr ; <nl> - dprintf ( " % p [ % p ] \ n " , base , size ) ; <nl> Memory < uint8_t * > data ( size ) ; <nl> if ( ! MemRead ( ( void * ) base , data ( ) , size , 0 ) ) <nl> { <nl> mmm a / x64_dbg_dbg / x64_dbg . cpp <nl> ppp b / x64_dbg_dbg / x64_dbg . cpp <nl> static void registercommands ( ) <nl> dbgcmdnew ( " scriptload " , cbScriptLoad , false ) ; <nl> dbgcmdnew ( " msg " , cbScriptMsg , false ) ; <nl> dbgcmdnew ( " msgyn " , cbScriptMsgyn , false ) ; <nl> + dbgcmdnew ( " log " , cbInstrLog , false ) ; / / log command with superawesome hax <nl> <nl> / / data <nl> dbgcmdnew ( " reffind \ 1findref \ 1ref " , cbInstrRefFind , true ) ; / / find references to a value <nl> static void registercommands ( ) <nl> dbgcmdnew ( " modcallfind " , cbInstrModCallFind , true ) ; / / find intermodular calls <nl> dbgcmdnew ( " findasm \ 1asmfind " , cbInstrFindAsm , true ) ; / / find instruction <nl> dbgcmdnew ( " reffindrange \ 1findrefrange \ 1refrange " , cbInstrRefFindRange , true ) ; <nl> + dbgcmdnew ( " yara " , cbInstrYara , true ) ; / / yara test command <nl> + dbgcmdnew ( " yaramod " , cbInstrYaramod , true ) ; / / yara rule on module <nl> + dbgcmdnew ( " analyse \ 1analyze \ 1anal " , cbInstrAnalyse , true ) ; / / secret analysis command <nl> <nl> / / undocumented <nl> dbgcmdnew ( " bench " , cbDebugBenchmark , true ) ; / / benchmark test ( readmem etc ) <nl> static void registercommands ( ) <nl> dbgcmdnew ( " copystr \ 1strcpy " , cbInstrCopystr , true ) ; / / write a string variable to memory <nl> dbgcmdnew ( " looplist " , cbInstrLoopList , true ) ; / / list loops <nl> dbgcmdnew ( " capstone " , cbInstrCapstone , true ) ; / / disassemble using capstone <nl> - dbgcmdnew ( " yara " , cbInstrYara , true ) ; / / yara test command <nl> - dbgcmdnew ( " yaramod " , cbInstrYaramod , true ) ; / / yara rule on module <nl> - dbgcmdnew ( " log " , cbInstrLog , false ) ; / / log command with superawesome hax <nl> - dbgcmdnew ( " analyse \ 1analyze \ 1anal " , cbInstrAnalyse , true ) ; / / secret analysis command <nl> } <nl> <nl> static bool cbCommandProvider ( char * cmd , int maxlen ) <nl>
|
PROJECT : documentation
|
x64dbg/x64dbg
|
d655fb94d7e0cfee4375006443a4876b58dc871e
|
2015-04-26T23:00:42Z
|
mmm a / modules / planning / tasks / deciders / decider_creep . cc <nl> ppp b / modules / planning / tasks / deciders / decider_creep . cc <nl> Status DeciderCreep : : Process ( Frame * frame , <nl> CHECK_NOTNULL ( frame ) ; <nl> CHECK_NOTNULL ( reference_line_info ) ; <nl> <nl> - const double stop_sign_overlap_end_s = <nl> - PlanningContext : : GetScenarioInfo ( ) - > current_stop_sign_overlap . end_s ; <nl> - BuildStopDecision ( stop_sign_overlap_end_s , frame , reference_line_info ) ; <nl> + double stop_sign_overlap_end_s = 0 . 0 ; <nl> + if ( ! PlanningContext : : GetScenarioInfo ( ) <nl> + - > current_stop_sign_overlap . object_id . empty ( ) ) { <nl> + stop_sign_overlap_end_s = PlanningContext : : GetScenarioInfo ( ) <nl> + - > current_stop_sign_overlap . end_s ; <nl> + } else if ( PlanningContext : : GetScenarioInfo ( ) <nl> + - > current_traffic_light_overlaps . size ( ) > 0 ) { <nl> + stop_sign_overlap_end_s = PlanningContext : : GetScenarioInfo ( ) <nl> + - > current_traffic_light_overlaps [ 0 ] . end_s ; <nl> + } <nl> + if ( stop_sign_overlap_end_s > 0 . 0 ) { <nl> + BuildStopDecision ( stop_sign_overlap_end_s , frame , reference_line_info ) ; <nl> + } <nl> <nl> return Status : : OK ( ) ; <nl> } <nl>
|
planning : update decider_creep task
|
ApolloAuto/apollo
|
86825f3c65f1695d189dfcea201bfbe85563e29b
|
2019-03-07T05:59:17Z
|
mmm a / atom . gyp <nl> ppp b / atom . gyp <nl> <nl> ' - - jobs = 16 ' , <nl> ] , <nl> } , <nl> + { <nl> + ' action_name ' : ' Strip Binary ' , <nl> + ' inputs ' : [ <nl> + ' < ( PRODUCT_DIR ) / libchromiumcontent . so ' , <nl> + ' < ( PRODUCT_DIR ) / libffmpegsumo . so ' , <nl> + ' < ( PRODUCT_DIR ) / < ( project_name ) ' , <nl> + ] , <nl> + ' outputs ' : [ <nl> + ' < ( PRODUCT_DIR ) / dummy_file ' , <nl> + ] , <nl> + ' action ' : [ <nl> + ' strip ' , <nl> + ' < @ ( _inputs ) ' <nl> + ] , <nl> + } , <nl> ] , <nl> } ] , # OS = = " linux " <nl> ] , <nl>
|
linux : Add strip binary action .
|
electron/electron
|
b8e75df8f0a22439133e2b7270439e00796c7a9a
|
2014-03-03T04:55:04Z
|
mmm a / src / net . cpp <nl> ppp b / src / net . cpp <nl> void CNode : : copyStats ( CNodeStats & stats , const std : : vector < bool > & m_asmap ) <nl> } <nl> <nl> / / Raw ping time is in microseconds , but show it to user as whole seconds ( Bitcoin users should be well used to small numbers with many decimal places by now : ) <nl> - stats . dPingTime = ( ( ( double ) nPingUsecTime ) / 1e6 ) ; <nl> - stats . dMinPing = ( ( ( double ) nMinPingUsecTime ) / 1e6 ) ; <nl> - stats . dPingWait = ( ( ( double ) nPingUsecWait ) / 1e6 ) ; <nl> + stats . m_ping_usec = nPingUsecTime ; <nl> + stats . m_min_ping_usec = nMinPingUsecTime ; <nl> + stats . m_ping_wait_usec = nPingUsecWait ; <nl> <nl> / / Leave string empty if addrLocal invalid ( not filled in yet ) <nl> CService addrLocalUnlocked = GetAddrLocal ( ) ; <nl> mmm a / src / net . h <nl> ppp b / src / net . h <nl> class CNodeStats <nl> mapMsgCmdSize mapRecvBytesPerMsgCmd ; <nl> NetPermissionFlags m_permissionFlags ; <nl> bool m_legacyWhitelisted ; <nl> - double dPingTime ; <nl> - double dPingWait ; <nl> - double dMinPing ; <nl> + int64_t m_ping_usec ; <nl> + int64_t m_ping_wait_usec ; <nl> + int64_t m_min_ping_usec ; <nl> CAmount minFeeFilter ; <nl> / / Our address , as reported by the peer <nl> std : : string addrLocal ; <nl> mmm a / src / qt / guiutil . cpp <nl> ppp b / src / qt / guiutil . cpp <nl> QString formatServicesStr ( quint64 mask ) <nl> return QObject : : tr ( " None " ) ; <nl> } <nl> <nl> - QString formatPingTime ( double dPingTime ) <nl> + QString formatPingTime ( int64_t ping_usec ) <nl> { <nl> - return ( dPingTime = = std : : numeric_limits < int64_t > : : max ( ) / 1e6 | | dPingTime = = 0 ) ? QObject : : tr ( " N / A " ) : QString ( QObject : : tr ( " % 1 ms " ) ) . arg ( QString : : number ( ( int ) ( dPingTime * 1000 ) , 10 ) ) ; <nl> + return ( ping_usec = = std : : numeric_limits < int64_t > : : max ( ) | | ping_usec = = 0 ) ? QObject : : tr ( " N / A " ) : QString ( QObject : : tr ( " % 1 ms " ) ) . arg ( QString : : number ( ( int ) ( ping_usec / 1000 ) , 10 ) ) ; <nl> } <nl> <nl> QString formatTimeOffset ( int64_t nTimeOffset ) <nl> mmm a / src / qt / guiutil . h <nl> ppp b / src / qt / guiutil . h <nl> namespace GUIUtil <nl> / * Format CNodeStats . nServices bitmask into a user - readable string * / <nl> QString formatServicesStr ( quint64 mask ) ; <nl> <nl> - / * Format a CNodeCombinedStats . dPingTime into a user - readable string or display N / A , if 0 * / <nl> - QString formatPingTime ( double dPingTime ) ; <nl> + / * Format a CNodeStats . m_ping_usec into a user - readable string or display N / A , if 0 * / <nl> + QString formatPingTime ( int64_t ping_usec ) ; <nl> <nl> / * Format a CNodeCombinedStats . nTimeOffset into a user - readable string . * / <nl> QString formatTimeOffset ( int64_t nTimeOffset ) ; <nl> mmm a / src / qt / peertablemodel . cpp <nl> ppp b / src / qt / peertablemodel . cpp <nl> bool NodeLessThan : : operator ( ) ( const CNodeCombinedStats & left , const CNodeCombine <nl> case PeerTableModel : : Subversion : <nl> return pLeft - > cleanSubVer . compare ( pRight - > cleanSubVer ) < 0 ; <nl> case PeerTableModel : : Ping : <nl> - return pLeft - > dMinPing < pRight - > dMinPing ; <nl> + return pLeft - > m_min_ping_usec < pRight - > m_min_ping_usec ; <nl> case PeerTableModel : : Sent : <nl> return pLeft - > nSendBytes < pRight - > nSendBytes ; <nl> case PeerTableModel : : Received : <nl> QVariant PeerTableModel : : data ( const QModelIndex & index , int role ) const <nl> case Subversion : <nl> return QString : : fromStdString ( rec - > nodeStats . cleanSubVer ) ; <nl> case Ping : <nl> - return GUIUtil : : formatPingTime ( rec - > nodeStats . dMinPing ) ; <nl> + return GUIUtil : : formatPingTime ( rec - > nodeStats . m_min_ping_usec ) ; <nl> case Sent : <nl> return GUIUtil : : formatBytes ( rec - > nodeStats . nSendBytes ) ; <nl> case Received : <nl> mmm a / src / qt / rpcconsole . cpp <nl> ppp b / src / qt / rpcconsole . cpp <nl> void RPCConsole : : updateNodeDetail ( const CNodeCombinedStats * stats ) <nl> ui - > peerBytesSent - > setText ( GUIUtil : : formatBytes ( stats - > nodeStats . nSendBytes ) ) ; <nl> ui - > peerBytesRecv - > setText ( GUIUtil : : formatBytes ( stats - > nodeStats . nRecvBytes ) ) ; <nl> ui - > peerConnTime - > setText ( GUIUtil : : formatDurationStr ( GetSystemTimeInSeconds ( ) - stats - > nodeStats . nTimeConnected ) ) ; <nl> - ui - > peerPingTime - > setText ( GUIUtil : : formatPingTime ( stats - > nodeStats . dPingTime ) ) ; <nl> - ui - > peerPingWait - > setText ( GUIUtil : : formatPingTime ( stats - > nodeStats . dPingWait ) ) ; <nl> - ui - > peerMinPing - > setText ( GUIUtil : : formatPingTime ( stats - > nodeStats . dMinPing ) ) ; <nl> + ui - > peerPingTime - > setText ( GUIUtil : : formatPingTime ( stats - > nodeStats . m_ping_usec ) ) ; <nl> + ui - > peerPingWait - > setText ( GUIUtil : : formatPingTime ( stats - > nodeStats . m_ping_wait_usec ) ) ; <nl> + ui - > peerMinPing - > setText ( GUIUtil : : formatPingTime ( stats - > nodeStats . m_min_ping_usec ) ) ; <nl> ui - > timeoffset - > setText ( GUIUtil : : formatTimeOffset ( stats - > nodeStats . nTimeOffset ) ) ; <nl> ui - > peerVersion - > setText ( QString ( " % 1 " ) . arg ( QString : : number ( stats - > nodeStats . nVersion ) ) ) ; <nl> ui - > peerSubversion - > setText ( QString : : fromStdString ( stats - > nodeStats . cleanSubVer ) ) ; <nl> mmm a / src / rpc / net . cpp <nl> ppp b / src / rpc / net . cpp <nl> static UniValue getpeerinfo ( const JSONRPCRequest & request ) <nl> obj . pushKV ( " bytesrecv " , stats . nRecvBytes ) ; <nl> obj . pushKV ( " conntime " , stats . nTimeConnected ) ; <nl> obj . pushKV ( " timeoffset " , stats . nTimeOffset ) ; <nl> - if ( stats . dPingTime > 0 . 0 ) <nl> - obj . pushKV ( " pingtime " , stats . dPingTime ) ; <nl> - if ( stats . dMinPing < static_cast < double > ( std : : numeric_limits < int64_t > : : max ( ) ) / 1e6 ) <nl> - obj . pushKV ( " minping " , stats . dMinPing ) ; <nl> - if ( stats . dPingWait > 0 . 0 ) <nl> - obj . pushKV ( " pingwait " , stats . dPingWait ) ; <nl> + if ( stats . m_ping_usec > 0 ) { <nl> + obj . pushKV ( " pingtime " , ( ( double ) stats . m_ping_usec ) / 1e6 ) ; <nl> + } <nl> + if ( stats . m_min_ping_usec < std : : numeric_limits < int64_t > : : max ( ) ) { <nl> + obj . pushKV ( " minping " , ( ( double ) stats . m_min_ping_usec ) / 1e6 ) ; <nl> + } <nl> + if ( stats . m_ping_wait_usec > 0 ) { <nl> + obj . pushKV ( " pingwait " , ( ( double ) stats . m_ping_wait_usec ) / 1e6 ) ; <nl> + } <nl> obj . pushKV ( " version " , stats . nVersion ) ; <nl> / / Use the sanitized form of subver here , to avoid tricksy remote peers from <nl> / / corrupting or modifying the JSON output by putting special characters in <nl>
|
Merge : refactor : Fix implicit value conversion in formatPingTime
|
bitcoin/bitcoin
|
aaf09469fb2c0976292854be5c6de484667ecf91
|
2020-03-05T18:50:10Z
|
mmm a / tensorflow / contrib / eager / python / datasets . py <nl> ppp b / tensorflow / contrib / eager / python / datasets . py <nl> def remote_fn ( h ) : <nl> def _next_internal ( self ) : <nl> " " " Returns a nested structure of ` tf . Tensor ` s containing the next element . <nl> " " " <nl> - if self . _buffer_resource_handle is not None : <nl> - with ops . device ( self . _device ) : <nl> - ret = prefetching_ops . function_buffering_resource_get_next ( <nl> - function_buffer_resource = self . _buffer_resource_handle , <nl> - output_types = self . _flat_output_types ) <nl> - return sparse . deserialize_sparse_tensors ( <nl> - nest . pack_sequence_as ( self . _output_types , ret ) , self . _output_types , <nl> - self . _output_shapes , self . _output_classes ) <nl> - else : <nl> - return super ( Iterator , self ) . _next_internal ( ) <nl> + # This runs in sync mode as iterators use an error status to communicate <nl> + # that there is no more data to iterate over . <nl> + # TODO ( b / 77291417 ) : Fix <nl> + with context . execution_mode ( context . SYNC ) : <nl> + if self . _buffer_resource_handle is not None : <nl> + with ops . device ( self . _device ) : <nl> + ret = prefetching_ops . function_buffering_resource_get_next ( <nl> + function_buffer_resource = self . _buffer_resource_handle , <nl> + output_types = self . _flat_output_types ) <nl> + return sparse . deserialize_sparse_tensors ( <nl> + nest . pack_sequence_as ( self . _output_types , ret ) , self . _output_types , <nl> + self . _output_shapes , self . _output_classes ) <nl> + else : <nl> + return super ( Iterator , self ) . _next_internal ( ) <nl> <nl> # TODO ( shivaniagrawal ) : Expose checkpointable stateful objects from dataset <nl> # attributes ( potential ) . <nl> mmm a / tensorflow / python / data / kernel_tests / iterator_ops_test . py <nl> ppp b / tensorflow / python / data / kernel_tests / iterator_ops_test . py <nl> <nl> from tensorflow . python . data . ops import dataset_ops <nl> from tensorflow . python . data . ops import iterator_ops <nl> from tensorflow . python . data . ops import readers <nl> + from tensorflow . python . eager import context <nl> from tensorflow . python . framework import constant_op <nl> from tensorflow . python . framework import dtypes <nl> from tensorflow . python . framework import errors <nl> def testRepeatedGetNextWarning ( self ) : <nl> self . assertTrue ( <nl> iterator_ops . GET_NEXT_CALL_WARNING_MESSAGE in str ( warning . message ) ) <nl> <nl> + def testEagerIteratorAsync ( self ) : <nl> + with context . eager_mode ( ) , context . execution_mode ( context . ASYNC ) : <nl> + val = 0 <nl> + dataset = dataset_ops . Dataset . range ( 10 ) <nl> + for foo in dataset : <nl> + self . assertEqual ( val , foo . numpy ( ) ) <nl> + val + = 1 <nl> + <nl> <nl> if __name__ = = " __main__ " : <nl> test . main ( ) <nl> mmm a / tensorflow / python / data / ops / iterator_ops . py <nl> ppp b / tensorflow / python / data / ops / iterator_ops . py <nl> def __next__ ( self ) : # For Python 3 compatibility <nl> def _next_internal ( self ) : <nl> " " " Returns a nested structure of ` tf . Tensor ` s containing the next element . <nl> " " " <nl> - with ops . device ( self . _device ) : <nl> - # TODO ( ashankar ) : Consider removing this ops . device ( ) contextmanager <nl> - # and instead mimic ops placement in graphs : Operations on resource <nl> - # handles execute on the same device as where the resource is placed . <nl> - # NOTE ( mrry ) : Here we use the " _sync " variant of ` iterator_get_next ` <nl> - # because in eager mode this code will run synchronously on the calling <nl> - # thread . Therefore we do not need to make a defensive context switch <nl> - # to a background thread , and can achieve a small constant performance <nl> - # boost by invoking the iterator synchronously . <nl> - ret = gen_dataset_ops . iterator_get_next_sync ( <nl> - self . _resource , <nl> - output_types = self . _flat_output_types , <nl> - output_shapes = self . _flat_output_shapes ) <nl> - <nl> - return sparse . deserialize_sparse_tensors ( <nl> - nest . pack_sequence_as ( self . _output_types , ret ) , self . _output_types , <nl> - self . _output_shapes , self . _output_classes ) <nl> + # This runs in sync mode as iterators use an error status to communicate <nl> + # that there is no more data to iterate over . <nl> + # TODO ( b / 77291417 ) : Fix <nl> + with context . execution_mode ( context . SYNC ) : <nl> + with ops . device ( self . _device ) : <nl> + # TODO ( ashankar ) : Consider removing this ops . device ( ) contextmanager <nl> + # and instead mimic ops placement in graphs : Operations on resource <nl> + # handles execute on the same device as where the resource is placed . <nl> + # NOTE ( mrry ) : Here we use the " _sync " variant of ` iterator_get_next ` <nl> + # because in eager mode this code will run synchronously on the calling <nl> + # thread . Therefore we do not need to make a defensive context switch <nl> + # to a background thread , and can achieve a small constant performance <nl> + # boost by invoking the iterator synchronously . <nl> + ret = gen_dataset_ops . iterator_get_next_sync ( <nl> + self . _resource , <nl> + output_types = self . _flat_output_types , <nl> + output_shapes = self . _flat_output_shapes ) <nl> + <nl> + return sparse . deserialize_sparse_tensors ( <nl> + nest . pack_sequence_as ( self . _output_types , ret ) , self . _output_types , <nl> + self . _output_shapes , self . _output_classes ) <nl> <nl> def next ( self ) : <nl> " " " Returns a nested structure of ` tf . Tensor ` s containing the next element . <nl>
|
Make tfe . Iterator work with async mode .
|
tensorflow/tensorflow
|
32133ec21ff01f829bc2f2ac19a5f78632bc07dc
|
2018-03-30T22:03:25Z
|
mmm a / imgui . cpp <nl> ppp b / imgui . cpp <nl> static void SettingsHandlerWindow_WriteAll ( ImGuiContext & g , ImGuiTextBuffer * buf <nl> if ( window - > Flags & ImGuiWindowFlags_NoSavedSettings ) <nl> continue ; <nl> ImGuiWindowSettings * settings = ImGui : : FindWindowSettings ( window - > ID ) ; <nl> - if ( ! settings ) / / This will only return NULL in the rare instance where the window was first created with ImGuiWindowFlags_NoSavedSettings then had the flag disabled later on . We don ' t bind settings in this case ( bug # 1000 ) . <nl> - continue ; <nl> + if ( ! settings ) <nl> + settings = AddWindowSettings ( window - > Name ) ; <nl> settings - > Pos = window - > Pos ; <nl> settings - > Size = window - > SizeFull ; <nl> settings - > Collapsed = window - > Collapsed ; <nl> static ImGuiWindowSettings * AddWindowSettings ( const char * name ) <nl> ImGuiWindowSettings * settings = & g . SettingsWindows . back ( ) ; <nl> settings - > Name = ImStrdup ( name ) ; <nl> settings - > Id = ImHash ( name , 0 ) ; <nl> - settings - > Pos = ImVec2 ( FLT_MAX , FLT_MAX ) ; <nl> return settings ; <nl> } <nl> <nl> static ImGuiWindow * CreateNewWindow ( const char * name , ImVec2 size , ImGuiWindowFl <nl> window - > PosFloat = ImVec2 ( 60 , 60 ) ; <nl> window - > Pos = ImVec2 ( ( float ) ( int ) window - > PosFloat . x , ( float ) ( int ) window - > PosFloat . y ) ; <nl> <nl> - ImGuiWindowSettings * settings = ImGui : : FindWindowSettings ( window - > ID ) ; <nl> - if ( ! settings ) <nl> - settings = AddWindowSettings ( name ) ; <nl> - else <nl> - SetWindowConditionAllowFlags ( window , ImGuiCond_FirstUseEver , false ) ; <nl> - <nl> - if ( settings - > Pos . x ! = FLT_MAX ) <nl> + if ( ImGuiWindowSettings * settings = ImGui : : FindWindowSettings ( window - > ID ) ) <nl> { <nl> + SetWindowConditionAllowFlags ( window , ImGuiCond_FirstUseEver , false ) ; <nl> window - > PosFloat = settings - > Pos ; <nl> window - > Pos = ImVec2 ( ( float ) ( int ) window - > PosFloat . x , ( float ) ( int ) window - > PosFloat . y ) ; <nl> window - > Collapsed = settings - > Collapsed ; <nl> + if ( ImLengthSqr ( settings - > Size ) > 0 . 00001f ) <nl> + size = settings - > Size ; <nl> } <nl> - <nl> - if ( ImLengthSqr ( settings - > Size ) > 0 . 00001f ) <nl> - size = settings - > Size ; <nl> window - > Size = window - > SizeFull = size ; <nl> } <nl> <nl>
|
Settings : Internals : Simplifying code a bit . Creating Settings structure during first save . Windows where ImGuiWindowFlags_NoSavedSettings was late toggled will save settings correctly . ( )
|
ocornut/imgui
|
2e1013a0c62f949a16082cfc9a2a2750fc38d506
|
2017-11-28T20:04:38Z
|
mmm a / . gitignore <nl> ppp b / . gitignore <nl> Pods / <nl> <nl> # Artifacts directory <nl> artifacts / <nl> + <nl> + # Git generated files for conflicting <nl> + * . orig <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> LIBS = m pthread ws2_32 <nl> LDFLAGS + = - pthread <nl> endif <nl> <nl> + # <nl> + # The steps for cross - compiling are as follows : <nl> + # First , clone and make install of grpc using the native compilers for the host . <nl> + # Also , install protoc ( e . g . , from a package like apt - get ) <nl> + # Then clone a fresh grpc for the actual cross - compiled build <nl> + # Set the environment variable GRPC_CROSS_COMPILE to true <nl> + # Set CC , CXX , LD , LDXX , AR , and STRIP to the cross - compiling binaries <nl> + # Also set PROTOBUF_CONFIG_OPTS to indicate cross - compilation to protobuf ( e . g . , <nl> + # PROTOBUF_CONFIG_OPTS = " - - host = arm - linux - - with - protoc = / usr / local / bin / protoc " ) <nl> + # Set HAS_PKG_CONFIG = false <nl> + # To build tests , go to third_party / gflags and follow its ccmake instructions <nl> + # Make sure that you enable building shared libraries and set your prefix to <nl> + # something useful like / usr / local / cross <nl> + # You will also need to set GRPC_CROSS_LDOPTS and GRPC_CROSS_AROPTS to hold <nl> + # additional required arguments for LD and AR ( examples below ) <nl> + # Then you can do a make from the cross - compiling fresh clone ! <nl> + # <nl> + ifeq ( $ ( GRPC_CROSS_COMPILE ) , true ) <nl> + LDFLAGS + = $ ( GRPC_CROSS_LDOPTS ) # e . g . - L / usr / local / lib - L / usr / local / cross / lib <nl> + AROPTS = $ ( GRPC_CROSS_AROPTS ) # e . g . , rc - - target = elf32 - little <nl> + USE_BUILT_PROTOC = false <nl> + endif <nl> + <nl> GTEST_LIB = - Ithird_party / googletest / include - Ithird_party / googletest third_party / googletest / src / gtest - all . cc <nl> GTEST_LIB + = - lgflags <nl> ifeq ( $ ( V ) , 1 ) <nl> PC_LIBS_GRPCXX = <nl> <nl> CPPFLAGS : = - Ithird_party / googletest / include $ ( CPPFLAGS ) <nl> <nl> + PROTOC_PLUGINS_ALL = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_csharp_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_node_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_objective_c_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_python_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_ruby_plugin <nl> + PROTOC_PLUGINS_DIR = $ ( BINDIR ) / $ ( CONFIG ) <nl> + <nl> ifeq ( $ ( HAS_SYSTEM_PROTOBUF ) , true ) <nl> ifeq ( $ ( HAS_PKG_CONFIG ) , true ) <nl> PROTOBUF_PKG_CONFIG = true <nl> endif <nl> endif <nl> else <nl> PC_LIBS_GRPCXX = - lprotobuf <nl> + PROTOC_PLUGINS = $ ( PROTOC_PLUGINS_ALL ) <nl> endif <nl> else <nl> ifeq ( $ ( HAS_EMBEDDED_PROTOBUF ) , true ) <nl> PROTOBUF_DEP = $ ( LIBDIR ) / $ ( CONFIG ) / protobuf / libprotobuf . a <nl> CPPFLAGS : = - Ithird_party / protobuf / src $ ( CPPFLAGS ) <nl> LDFLAGS : = - L $ ( LIBDIR ) / $ ( CONFIG ) / protobuf $ ( LDFLAGS ) <nl> + ifneq ( $ ( USE_BUILT_PROTOC ) , false ) <nl> PROTOC = $ ( BINDIR ) / $ ( CONFIG ) / protobuf / protoc <nl> + PROTOC_PLUGINS = $ ( PROTOC_PLUGINS_ALL ) <nl> + else <nl> + PROTOC_PLUGINS = <nl> + PROTOC_PLUGINS_DIR = $ ( prefix ) / bin <nl> + endif <nl> else <nl> NO_PROTOBUF = true <nl> endif <nl> endif <nl> <nl> . SECONDARY = % . pb . h % . pb . cc <nl> <nl> - PROTOC_PLUGINS = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_csharp_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_node_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_objective_c_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_python_plugin $ ( BINDIR ) / $ ( CONFIG ) / grpc_ruby_plugin <nl> ifeq ( $ ( DEP_MISSING ) , ) <nl> all : static shared plugins <nl> dep_error : <nl> third_party / protobuf / configure : <nl> <nl> $ ( LIBDIR ) / $ ( CONFIG ) / protobuf / libprotobuf . a : third_party / protobuf / configure <nl> $ ( E ) " [ MAKE ] Building protobuf " <nl> - $ ( Q ) ( cd third_party / protobuf ; CC = " $ ( CC ) " CXX = " $ ( CXX ) " LDFLAGS = " $ ( LDFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_LDFLAGS_EXTRA ) " CPPFLAGS = " $ ( PIC_CPPFLAGS ) $ ( CPPFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_CPPFLAGS_EXTRA ) " . / configure - - disable - shared - - enable - static ) <nl> + $ ( Q ) ( cd third_party / protobuf ; CC = " $ ( CC ) " CXX = " $ ( CXX ) " LDFLAGS = " $ ( LDFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_LDFLAGS_EXTRA ) " CPPFLAGS = " $ ( PIC_CPPFLAGS ) $ ( CPPFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_CPPFLAGS_EXTRA ) " . / configure - - disable - shared - - enable - static $ ( PROTOBUF_CONFIG_OPTS ) ) <nl> $ ( Q ) $ ( MAKE ) - C third_party / protobuf clean <nl> $ ( Q ) $ ( MAKE ) - C third_party / protobuf <nl> $ ( Q ) mkdir - p $ ( LIBDIR ) / $ ( CONFIG ) / protobuf <nl> $ ( GENDIR ) / src / proto / grpc / lb / v1 / load_balancer . pb . cc : src / proto / grpc / lb / v1 / load_ba <nl> $ ( GENDIR ) / src / proto / grpc / lb / v1 / load_balancer . grpc . pb . cc : src / proto / grpc / lb / v1 / load_balancer . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / compiler_test . pb . cc : src / proto / grpc / testing / com <nl> $ ( GENDIR ) / src / proto / grpc / testing / compiler_test . grpc . pb . cc : src / proto / grpc / testing / compiler_test . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / control . pb . cc : src / proto / grpc / testing / control . p <nl> $ ( GENDIR ) / src / proto / grpc / testing / control . grpc . pb . cc : src / proto / grpc / testing / control . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) $ ( GENDIR ) / src / proto / grpc / testing / payloads . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / payloads . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / stats . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / stats . grpc . pb . cc <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . pb . cc : src / proto / grpc / <nl> $ ( GENDIR ) / src / proto / grpc / testing / duplicate / echo_duplicate . grpc . pb . cc : src / proto / grpc / testing / duplicate / echo_duplicate . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / echo . pb . cc : src / proto / grpc / testing / echo . proto $ <nl> $ ( GENDIR ) / src / proto / grpc / testing / echo . grpc . pb . cc : src / proto / grpc / testing / echo . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . pb . cc : src / proto / grpc / testing / ech <nl> $ ( GENDIR ) / src / proto / grpc / testing / echo_messages . grpc . pb . cc : src / proto / grpc / testing / echo_messages . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / empty . pb . cc : src / proto / grpc / testing / empty . proto <nl> $ ( GENDIR ) / src / proto / grpc / testing / empty . grpc . pb . cc : src / proto / grpc / testing / empty . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / messages . pb . cc : src / proto / grpc / testing / messages <nl> $ ( GENDIR ) / src / proto / grpc / testing / messages . grpc . pb . cc : src / proto / grpc / testing / messages . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / metrics . pb . cc : src / proto / grpc / testing / metrics . p <nl> $ ( GENDIR ) / src / proto / grpc / testing / metrics . grpc . pb . cc : src / proto / grpc / testing / metrics . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / payloads . pb . cc : src / proto / grpc / testing / payloads <nl> $ ( GENDIR ) / src / proto / grpc / testing / payloads . grpc . pb . cc : src / proto / grpc / testing / payloads . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / services . pb . cc : src / proto / grpc / testing / services <nl> $ ( GENDIR ) / src / proto / grpc / testing / services . grpc . pb . cc : src / proto / grpc / testing / services . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) $ ( GENDIR ) / src / proto / grpc / testing / messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / messages . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / control . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / control . grpc . pb . cc <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / stats . pb . cc : src / proto / grpc / testing / stats . proto <nl> $ ( GENDIR ) / src / proto / grpc / testing / stats . grpc . pb . cc : src / proto / grpc / testing / stats . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> ifeq ( $ ( NO_PROTOC ) , true ) <nl> $ ( GENDIR ) / src / proto / grpc / testing / test . pb . cc : src / proto / grpc / testing / test . proto $ <nl> $ ( GENDIR ) / src / proto / grpc / testing / test . grpc . pb . cc : src / proto / grpc / testing / test . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) $ ( GENDIR ) / src / proto / grpc / testing / empty . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / empty . grpc . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / messages . pb . cc $ ( GENDIR ) / src / proto / grpc / testing / messages . grpc . pb . cc <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a : $ ( ZLIB_DEP ) $ ( LIBGPR_OBJS ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBGPR_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBGPR_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a : $ ( ZLIB_DEP ) $ ( LIBGPR_TEST_UTIL_OBJS ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBGPR_TEST_UTIL_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBGPR_TEST_UTIL_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBGRPC_OBJS ) $ ( LIB <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBGRPC_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) $ ( OPENSSL_MERGE_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBGRPC_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) $ ( OPENSSL_MERGE_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cronet . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBGRPC_CRONE <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cronet . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cronet . a $ ( LIBGRPC_CRONET_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) $ ( OPENSSL_MERGE_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cronet . a $ ( LIBGRPC_CRONET_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) $ ( OPENSSL_MERGE_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cronet . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBGRPC_TE <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBGRPC_TEST_UTIL_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBGRPC_TEST_UTIL_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a : $ ( ZLIB_DEP ) $ ( LIBGRPC_TEST_UT <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBGRPC_TEST_UTIL_UNSECURE_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a $ ( LIBGRPC_TEST_UTIL_UNSECURE_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util_unsecure . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a : $ ( ZLIB_DEP ) $ ( LIBGRPC_UNSECURE_OBJS ) $ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBGRPC_UNSECURE_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a $ ( LIBGRPC_UNSECURE_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_unsecure . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libreconnect_server . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBRECON <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libreconnect_server . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libreconnect_server . a $ ( LIBRECONNECT_SERVER_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libreconnect_server . a $ ( LIBRECONNECT_SERVER_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libreconnect_server . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libtest_tcp_server . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBTEST_T <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libtest_tcp_server . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libtest_tcp_server . a $ ( LIBTEST_TCP_SERVER_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libtest_tcp_server . a $ ( LIBTEST_TCP_SERVER_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libtest_tcp_server . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOBUF_DEP ) $ ( LI <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBGRPC + + _OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBGRPC + + _OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOBU <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a $ ( LIBGRPC + + _REFLECTION_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a $ ( LIBGRPC + + _REFLECTION_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOB <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBGRPC + + _TEST_CONFIG_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LIBGRPC + + _TEST_CONFIG_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOBUF <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBGRPC + + _TEST_UTIL_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBGRPC + + _TEST_UTIL_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( LIBGRPC <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBGRPC + + _UNSECURE_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a $ ( LIBGRPC + + _UNSECURE_OBJS ) $ ( LIBGPR_OBJS ) $ ( ZLIB_MERGE_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _unsecure . a <nl> endif <nl> endif <nl> LIBGRPC_CLI_LIBS_SRC = \ <nl> test / cpp / util / cli_call . cc \ <nl> test / cpp / util / proto_file_parser . cc \ <nl> + test / cpp / util / proto_reflection_descriptor_database . cc \ <nl> <nl> PUBLIC_HEADERS_CXX + = \ <nl> <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOBUF_DE <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBGRPC_CLI_LIBS_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBGRPC_CLI_LIBS_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_plugin_support . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( LIB <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_plugin_support . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_plugin_support . a $ ( LIBGRPC_PLUGIN_SUPPORT_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_plugin_support . a $ ( LIBGRPC_PLUGIN_SUPPORT_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_plugin_support . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PRO <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBINTEROP_CLIENT_HELPER_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a $ ( LIBINTEROP_CLIENT_HELPER_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_helper . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTO <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBINTEROP_CLIENT_MAIN_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a $ ( LIBINTEROP_CLIENT_MAIN_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_client_main . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PRO <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBINTEROP_SERVER_HELPER_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a $ ( LIBINTEROP_SERVER_HELPER_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_helper . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTO <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBINTEROP_SERVER_MAIN_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a $ ( LIBINTEROP_SERVER_MAIN_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libinterop_server_main . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOBUF_DEP ) $ ( LIBQP <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBQPS_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a $ ( LIBQPS_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libqps . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_csharp_ext . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBGRPC_C <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_csharp_ext . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_csharp_ext . a $ ( LIBGRPC_CSHARP_EXT_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_csharp_ext . a $ ( LIBGRPC_CSHARP_EXT_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_csharp_ext . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_OBJS ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl . a $ ( LIBBORINGSSL_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl . a $ ( LIBBORINGSSL_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( LIB <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a $ ( LIBBORINGSSL_TEST_UTIL_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a $ ( LIBBORINGSSL_TEST_UTIL_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_test_util . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a $ ( LIBBORINGSSL_AES_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a $ ( LIBBORINGSSL_AES_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aes_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a $ ( LIBBORINGSSL_ASN1_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a $ ( LIBBORINGSSL_ASN1_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_asn1_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a $ ( LIBBORINGSSL_BASE64_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a $ ( LIBBORINGSSL_BASE64_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_base64_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a $ ( LIBBORINGSSL_BIO_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a $ ( LIBBORINGSSL_BIO_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bio_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( L <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a $ ( LIBBORINGSSL_BN_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a $ ( LIBBORINGSSL_BN_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bn_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a $ ( LIBBORINGSSL_BYTESTRING_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a $ ( LIBBORINGSSL_BYTESTRING_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_bytestring_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a $ ( LIBBORINGSSL_AEAD_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a $ ( LIBBORINGSSL_AEAD_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_aead_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a $ ( LIBBORINGSSL_CIPHER_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a $ ( LIBBORINGSSL_CIPHER_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cipher_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a $ ( LIBBORINGSSL_CMAC_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a $ ( LIBBORINGSSL_CMAC_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_cmac_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_constant_time_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBOR <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_constant_time_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_constant_time_test_lib . a $ ( LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_constant_time_test_lib . a $ ( LIBBORINGSSL_CONSTANT_TIME_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_constant_time_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a $ ( LIBBORINGSSL_ED25519_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a $ ( LIBBORINGSSL_ED25519_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ed25519_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a $ ( LIBBORINGSSL_X25519_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a $ ( LIBBORINGSSL_X25519_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x25519_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dh_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( L <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dh_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dh_test_lib . a $ ( LIBBORINGSSL_DH_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dh_test_lib . a $ ( LIBBORINGSSL_DH_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dh_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a $ ( LIBBORINGSSL_DIGEST_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a $ ( LIBBORINGSSL_DIGEST_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_digest_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dsa_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_DSA <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dsa_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dsa_test_lib . a $ ( LIBBORINGSSL_DSA_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dsa_test_lib . a $ ( LIBBORINGSSL_DSA_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_dsa_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ec_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( L <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ec_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ec_test_lib . a $ ( LIBBORINGSSL_EC_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ec_test_lib . a $ ( LIBBORINGSSL_EC_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ec_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_example_mul_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_example_mul_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_example_mul_lib . a $ ( LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_example_mul_lib . a $ ( LIBBORINGSSL_EXAMPLE_MUL_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_example_mul_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a $ ( LIBBORINGSSL_ECDSA_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a $ ( LIBBORINGSSL_ECDSA_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ecdsa_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_err_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_err_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_err_test_lib . a $ ( LIBBORINGSSL_ERR_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_err_test_lib . a $ ( LIBBORINGSSL_ERR_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_err_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_D <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a $ ( LIBBORINGSSL_EVP_EXTRA_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a $ ( LIBBORINGSSL_EVP_EXTRA_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_extra_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a $ ( LIBBORINGSSL_EVP_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a $ ( LIBBORINGSSL_EVP_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_evp_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a $ ( LIBBORINGSSL_PBKDF_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a $ ( LIBBORINGSSL_PBKDF_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pbkdf_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hkdf_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_HK <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hkdf_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hkdf_test_lib . a $ ( LIBBORINGSSL_HKDF_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hkdf_test_lib . a $ ( LIBBORINGSSL_HKDF_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hkdf_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a $ ( LIBBORINGSSL_HMAC_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a $ ( LIBBORINGSSL_HMAC_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_hmac_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_lhash_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_L <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_lhash_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_lhash_test_lib . a $ ( LIBBORINGSSL_LHASH_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_lhash_test_lib . a $ ( LIBBORINGSSL_LHASH_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_lhash_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_gcm_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_GCM <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_gcm_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_gcm_test_lib . a $ ( LIBBORINGSSL_GCM_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_gcm_test_lib . a $ ( LIBBORINGSSL_GCM_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_gcm_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a $ ( LIBBORINGSSL_PKCS12_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a $ ( LIBBORINGSSL_PKCS12_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs12_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a $ ( LIBBORINGSSL_PKCS8_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a $ ( LIBBORINGSSL_PKCS8_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs8_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DE <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a $ ( LIBBORINGSSL_POLY1305_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a $ ( LIBBORINGSSL_POLY1305_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_poly1305_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_refcount_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSS <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_refcount_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_refcount_test_lib . a $ ( LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_refcount_test_lib . a $ ( LIBBORINGSSL_REFCOUNT_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_refcount_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_rsa_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_rsa_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_rsa_test_lib . a $ ( LIBBORINGSSL_RSA_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_rsa_test_lib . a $ ( LIBBORINGSSL_RSA_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_rsa_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_thread_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_thread_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_thread_test_lib . a $ ( LIBBORINGSSL_THREAD_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_thread_test_lib . a $ ( LIBBORINGSSL_THREAD_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_thread_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs7_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_P <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs7_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs7_test_lib . a $ ( LIBBORINGSSL_PKCS7_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs7_test_lib . a $ ( LIBBORINGSSL_PKCS7_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pkcs7_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a $ ( LIBBORINGSSL_X509_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a $ ( LIBBORINGSSL_X509_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_x509_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_tab_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_TAB <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_tab_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_tab_test_lib . a $ ( LIBBORINGSSL_TAB_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_tab_test_lib . a $ ( LIBBORINGSSL_TAB_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_tab_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_v3name_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_v3name_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_v3name_test_lib . a $ ( LIBBORINGSSL_V3NAME_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_v3name_test_lib . a $ ( LIBBORINGSSL_V3NAME_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_v3name_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pqueue_test_lib . a : $ ( ZLIB_DEP ) $ ( LIBBORINGSSL_ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pqueue_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pqueue_test_lib . a $ ( LIBBORINGSSL_PQUEUE_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pqueue_test_lib . a $ ( LIBBORINGSSL_PQUEUE_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_pqueue_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ssl_test_lib . a : $ ( ZLIB_DEP ) $ ( PROTOBUF_DEP ) $ ( <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ssl_test_lib . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ssl_test_lib . a $ ( LIBBORINGSSL_SSL_TEST_LIB_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ssl_test_lib . a $ ( LIBBORINGSSL_SSL_TEST_LIB_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libboringssl_ssl_test_lib . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libz . a : $ ( LIBZ_OBJS ) <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libz . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libz . a $ ( LIBZ_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libz . a $ ( LIBZ_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libz . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libbad_client_test . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBBAD_CL <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libbad_client_test . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libbad_client_test . a $ ( LIBBAD_CLIENT_TEST_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbad_client_test . a $ ( LIBBAD_CLIENT_TEST_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libbad_client_test . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libbad_ssl_test_server . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBBA <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libbad_ssl_test_server . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libbad_ssl_test_server . a $ ( LIBBAD_SSL_TEST_SERVER_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbad_ssl_test_server . a $ ( LIBBAD_SSL_TEST_SERVER_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libbad_ssl_test_server . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_tests . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( LIBEND2END_ <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_tests . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_tests . a $ ( LIBEND2END_TESTS_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_tests . a $ ( LIBEND2END_TESTS_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_tests . a <nl> endif <nl> $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_nosec_tests . a : $ ( ZLIB_DEP ) $ ( LIBEND2END_NOSEC_TE <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_nosec_tests . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_nosec_tests . a $ ( LIBEND2END_NOSEC_TESTS_OBJS ) <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_nosec_tests . a $ ( LIBEND2END_NOSEC_TESTS_OBJS ) <nl> ifeq ( $ ( SYSTEM ) , Darwin ) <nl> $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libend2end_nosec_tests . a <nl> endif <nl> $ ( BINDIR ) / $ ( CONFIG ) / grpc_cli : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / grpc_cli : $ ( PROTOBUF_DEP ) $ ( GRPC_CLI_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / grpc_cli : $ ( PROTOBUF_DEP ) $ ( GRPC_CLI_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( GRPC_CLI_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / grpc_cli <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( GRPC_CLI_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / grpc_cli <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / util / grpc_cli . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / util / grpc_cli . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_cli_libs . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _reflection . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_config . a <nl> <nl> deps_grpc_cli : $ ( GRPC_CLI_OBJS : . o = . dep ) <nl> <nl> test / cpp / util / byte_buffer_proto_helper . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / util / cli_call . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / util / create_test_channel . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / util / proto_file_parser . cc : $ ( OPENSSL_DEP ) <nl> + test / cpp / util / proto_reflection_descriptor_database . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / util / string_ref_helper . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / util / subprocess . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / util / test_config . cc : $ ( OPENSSL_DEP ) <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> libs : <nl> headers : <nl> - test / cpp / util / cli_call . h <nl> - test / cpp / util / proto_file_parser . h <nl> + - test / cpp / util / proto_reflection_descriptor_database . h <nl> src : <nl> - test / cpp / util / cli_call . cc <nl> - test / cpp / util / proto_file_parser . cc <nl> + - test / cpp / util / proto_reflection_descriptor_database . cc <nl> deps : <nl> + - grpc + + _reflection <nl> - grpc + + <nl> - grpc_plugin_support <nl> - name : grpc_plugin_support <nl> targets : <nl> - grpc_cli_libs <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> + - grpc + + _reflection <nl> - grpc + + <nl> - grpc <nl> - gpr_test_util <nl> mmm a / composer . json <nl> ppp b / composer . json <nl> <nl> " license " : " BSD - 3 - Clause " , <nl> " require " : { <nl> " php " : " > = 5 . 5 . 0 " , <nl> - " stanley - cheung / protobuf - php " : " dev - master " <nl> + " stanley - cheung / protobuf - php " : " v0 . 6 " <nl> } , <nl> " require - dev " : { <nl> " google / auth " : " v0 . 9 " <nl> mmm a / doc / command_line_tool . md <nl> ppp b / doc / command_line_tool . md <nl> The command line tool can do the following things : <nl> - Send unary rpc . <nl> - Attach metadata and display received metadata . <nl> - Handle common authentication to server . <nl> + - Infer request / response types from server reflection result . <nl> - Find the request / response types from a given proto file . <nl> - Read proto request in text form . <nl> - Read request in wire form ( for protobuf messages , this means serialized binary form ) . <nl> The command line tool can do the following things : <nl> The command line tool should support the following things : <nl> <nl> - List server services and methods through server reflection . <nl> - - Infer request / response types from server reflection result . <nl> - Fine - grained auth control ( such as , use this oauth token to talk to the server ) . <nl> - Send streaming rpc . <nl> <nl> https : / / github . com / grpc / grpc / blob / master / test / cpp / util / grpc_cli . cc <nl> Send a rpc to a helloworld server at ` localhost : 50051 ` : <nl> <nl> ` ` ` <nl> - $ bins / opt / grpc_cli call localhost : 50051 SayHello examples / protos / helloworld . proto \ <nl> - " name : ' world ' " - - enable_ssl = false <nl> + $ bins / opt / grpc_cli call localhost : 50051 SayHello " name : ' world ' " \ <nl> + - - enable_ssl = false <nl> ` ` ` <nl> <nl> On success , the tool will print out <nl> <nl> ` ` ` <nl> Rpc succeeded with OK status <nl> - Response : <nl> + Response : <nl> message : " Hello world " <nl> ` ` ` <nl> <nl> The ` localhost : 50051 ` part indicates the server you are connecting to . ` SayHello ` is ( part of ) the <nl> - gRPC method string . Then there is the path to the proto file containing the service definition , <nl> - if it is not under current directory , you can use ` - - proto_path ` to specify a new search root . <nl> - ` " name : ' world ' " ` is the text format of the request proto message . <nl> - We are not using ssl here by ` - - enable_ssl = false ` . For information on more <nl> - flags , look at the comments of ` grpc_cli . cc ` . <nl> + gRPC method string . Then ` " name : ' world ' " ` is the text format of the request proto message . We are <nl> + not using ssl here by ` - - enable_ssl = false ` . For information on more flags , look at the comments of ` grpc_cli . cc ` . <nl> + <nl> + # # # Use local proto files <nl> + <nl> + If the server does not have the server reflection service , you will need to provide local proto <nl> + files containing the service definition . The tool will try to find request / response types from <nl> + them . <nl> + <nl> + ` ` ` <nl> + $ bins / opt / grpc_cli call localhost : 50051 SayHello " name : ' world ' " \ <nl> + - - protofiles = examples / protos / helloworld . proto - - enable_ssl = false <nl> + ` ` ` <nl> + <nl> + If the proto files is not under current directory , you can use ` - - proto_path ` to specify a new <nl> + search root . <nl> <nl> # # # Send non - proto rpc <nl> <nl> new file mode 100644 <nl> index 00000000000 . . 86183966fb8 <nl> Binary files / dev / null and b / doc / images / load_balancing_design . png differ <nl> mmm a / doc / load - balancing . md <nl> ppp b / doc / load - balancing . md <nl> Load Balancing in gRPC <nl> # Objective <nl> <nl> To design a load balancing API between a gRPC client and a Load Balancer to <nl> - instruct the client how to send load to multiple backend servers . <nl> + instruct the client how to send load to multiple backend servers . <nl> <nl> # Background <nl> <nl> have temporary copies of the RPC request and response . This model also increases <nl> latency to the RPCs . <nl> <nl> The proxy model was deemed inefficient when considering request heavy services <nl> - like storage . <nl> + like storage . <nl> <nl> # # # Balancing - aware Client <nl> <nl> example , the client could contain many load balancing policies ( Round Robin , <nl> Random , etc ) used to select servers from a list . In this model , a list of <nl> servers would be either statically configured in the client , provided by the <nl> name resolution system , an external load balancer , etc . In any case , the client <nl> - is responsible for choosing the preferred server from the list . <nl> + is responsible for choosing the preferred server from the list . <nl> <nl> One of the drawbacks of this approach is writing and maintaining the load <nl> balancing policies in multiple languages and / or versions of the clients . These <nl> unavailability or health issues . The load balancer will make any necessary <nl> complex decisions and inform the client . The load balancer may communicate with <nl> the backend servers to collect load and health information . <nl> <nl> + <nl> + # # Requirements <nl> + <nl> + # # # # Simple API and client <nl> + <nl> + The gRPC client load balancing code must be simple and portable . The client <nl> + should only contain simple algorithms ( ie Round Robin ) for server selection . For <nl> + complex algorithms , the client should rely on a load balancer to provide load <nl> + balancing configuration and the list of servers to which the client should send <nl> + requests . The balancer will update the server list as needed to balance the load <nl> + as well as handle server unavailability or health issues . The load balancer will <nl> + make any necessary complex decisions and inform the client . The load balancer <nl> + may communicate with the backend servers to collect load and health information . <nl> + <nl> + # # # # Security <nl> + <nl> + The load balancer may be separate from the actual server backends and a <nl> + compromise of the load balancer should only lead to a compromise of the <nl> + loadbalancing functionality . In other words , a compromised load balancer should <nl> + not be able to cause a client to trust a ( potentially malicious ) backend server <nl> + any more than in a comparable situation without loadbalancing . <nl> + <nl> # Proposed Architecture <nl> <nl> - The gRPC load balancing approach follows the third approach , by having an <nl> - external load balancer which provides simple clients with a list of servers . <nl> + The gRPC load balancing implements the external load balancing server approach : <nl> + an external load balancer provides simple clients with an up - to - date list of <nl> + servers . <nl> + <nl> + ! [ image ] ( images / load_balancing_design . png ) <nl> + <nl> + 1 . On startup , the gRPC client issues a name resolution request for the service . <nl> + The name will resolve to one or more IP addresses to gRPC servers , a hint on <nl> + whether the IP address ( es ) point to a load balancer or not , and also return a <nl> + client config . <nl> + 2 . The gRPC client connects to a gRPC Server . <nl> + 1 . If the name resolution has hinted that the endpoint is a load balancer , <nl> + the client ' s gRPC LB policy will attempt to open a stream to the load <nl> + balancer service . The server may respond in only one of the following <nl> + ways . <nl> + 1 . ` status : : UNIMPLEMENTED ` . There is no loadbalancing in use . The client <nl> + call will fail . <nl> + 2 . " I am a Load Balancer and here is the server list . " ( Goto Step 4 . ) <nl> + 3 . " Please contact Load Balancer X " ( See Step 3 . ) The client will close <nl> + this connection and cancel the stream . <nl> + 4 . If the server fails to respond , the client will wait for some timeout <nl> + and then re - resolve the name ( process to Step 1 above ) . <nl> + 2 . If the name resolution has not hinted that the endpoint is a load <nl> + balancer , the client connects directly to the service it wants to talk to . <nl> + 3 . The gRPC client ' s gRPC LB policy opens a separate connection to the Load <nl> + Balancer . If this fails , it will go back to step 1 and try another address . <nl> + 1 . During channel initialization to the Load Balancer , the client will <nl> + attempt to open a stream to the Load Balancer service . <nl> + 2 . The Load Balancer will return a server list to the gRPC client . If the <nl> + server list is empty , the call will wait until a non - empty one is <nl> + received . Optional : The Load Balancer will also open channels to the gRPC <nl> + servers if load reporting is needed . <nl> + 4 . The gRPC client will send RPCs to the gRPC servers contained in the server <nl> + list from the Load Balancer . <nl> + 5 . Optional : The gRPC servers may periodically report load to the Load Balancer . <nl> <nl> # # Client <nl> <nl> - When establishing a gRPC stream to the balancer , the client will send an initial <nl> + When establishing a gRPC _stream_ to the balancer , the client will send an initial <nl> request to the load balancer ( via a regular gRPC message ) . The load balancer <nl> will respond with client config ( including , for example , settings for flow <nl> control , RPC deadlines , etc . ) or a redirect to another load balancer . If the <nl> balancer in order to compute the next list of servers . <nl> The gRPC Server is responsible for answering RPC requests and providing <nl> responses to the client . The server will also report load to the load balancer <nl> if a reporting stream was opened for this purpose . <nl> - <nl> - # # # Security <nl> - <nl> - The load balancer may be separate from the actual server backends and a <nl> - compromise of the load balancer should only lead to a compromise of the <nl> - loadbalancing functionality . In other words , a compromised load balancer should <nl> - not be able to cause a client to trust a ( potentially malicious ) backend server <nl> - any more than in a comparable situation without loadbalancing . <nl> mmm a / gRPC - Core . podspec <nl> ppp b / gRPC - Core . podspec <nl> Pod : : Spec . new do | s | <nl> ' ALWAYS_SEARCH_USER_PATHS ' = > ' NO ' , <nl> } <nl> <nl> + s . default_subspecs = ' Interface ' , ' Implementation ' <nl> + <nl> # Like many other C libraries , gRPC - Core has its public headers under ` include / < libname > / ` and its <nl> # sources and private headers in other directories outside ` include / ` . Cocoapods ' linter doesn ' t <nl> # allow any header to be listed outside the ` header_mappings_dir ` ( even though doing so works in <nl> Pod : : Spec . new do | s | <nl> ' src / core / ext / census / mlog . h ' , <nl> ' src / core / ext / census / rpc_metric_id . h ' <nl> end <nl> + <nl> + s . subspec ' Cronet - Interface ' do | ss | <nl> + ss . header_mappings_dir = ' include / grpc ' <nl> + ss . source_files = ' include / grpc / grpc_cronet . h ' <nl> + end <nl> + <nl> + s . subspec ' Cronet - Tests ' do | ss | <nl> + ss . header_mappings_dir = ' . ' <nl> + <nl> + ss . source_files = ' src / core / ext / transport / cronet / client / secure / cronet_channel_create . c ' , <nl> + ' src / core / ext / transport / cronet / transport / cronet_transport . c ' , <nl> + ' test / core / end2end / cq_verifier . { c , h } ' , <nl> + ' test / core / end2end / end2end_tests . { c , h } ' , <nl> + ' test / core / end2end / tests / * . { c , h } ' , <nl> + ' test / core / end2end / data / * . { c , h } ' , <nl> + ' test / core / util / test_config . { c , h } ' , <nl> + ' test / core / util / port . h ' , <nl> + ' test / core / util / port_posix . c ' , <nl> + ' test / core / util / port_server_client . { c , h } ' <nl> + <nl> + ss . dependency ' CronetFramework ' <nl> + end <nl> end <nl> mmm a / grpc . def <nl> ppp b / grpc . def <nl> EXPORTS <nl> gpr_slice_ref <nl> gpr_slice_unref <nl> gpr_slice_new <nl> + gpr_slice_new_with_user_data <nl> gpr_slice_new_with_len <nl> gpr_slice_malloc <nl> gpr_slice_from_copied_string <nl> mmm a / include / grpc + + / impl / codegen / client_context . h <nl> ppp b / include / grpc + + / impl / codegen / client_context . h <nl> <nl> / / / <nl> / / / Context settings are only relevant to the call they are invoked with , that <nl> / / / is to say , they aren ' t sticky . Some of these settings , such as the <nl> - / / / compression options , can be made persistant at channel construction time <nl> + / / / compression options , can be made persistent at channel construction time <nl> / / / ( see \ a grpc : : CreateCustomChannel ) . <nl> / / / <nl> / / / \ warning ClientContext instances should \ em not be reused across rpcs . <nl> mmm a / include / grpc + + / impl / codegen / config_protobuf . h <nl> ppp b / include / grpc + + / impl / codegen / config_protobuf . h <nl> <nl> # endif <nl> <nl> # ifndef GRPC_CUSTOM_MESSAGE <nl> + # ifdef GRPC_USE_PROTO_LITE <nl> + # include < google / protobuf / message_lite . h > <nl> + # define GRPC_CUSTOM_MESSAGE : : google : : protobuf : : MessageLite <nl> + # else <nl> # include < google / protobuf / message . h > <nl> # define GRPC_CUSTOM_MESSAGE : : google : : protobuf : : Message <nl> # endif <nl> + # endif <nl> <nl> # ifndef GRPC_CUSTOM_DESCRIPTOR <nl> # include < google / protobuf / descriptor . h > <nl> # include < google / protobuf / descriptor . pb . h > <nl> # define GRPC_CUSTOM_DESCRIPTOR : : google : : protobuf : : Descriptor <nl> # define GRPC_CUSTOM_DESCRIPTORPOOL : : google : : protobuf : : DescriptorPool <nl> - # define GPRC_CUSTOM_FIELDDESCRIPTOR : : google : : protobuf : : FieldDescriptor <nl> + # define GRPC_CUSTOM_FIELDDESCRIPTOR : : google : : protobuf : : FieldDescriptor <nl> # define GRPC_CUSTOM_FILEDESCRIPTOR : : google : : protobuf : : FileDescriptor <nl> # define GRPC_CUSTOM_FILEDESCRIPTORPROTO : : google : : protobuf : : FileDescriptorProto <nl> # define GRPC_CUSTOM_METHODDESCRIPTOR : : google : : protobuf : : MethodDescriptor <nl> typedef GRPC_CUSTOM_PROTOBUF_INT64 int64 ; <nl> <nl> typedef GRPC_CUSTOM_DESCRIPTOR Descriptor ; <nl> typedef GRPC_CUSTOM_DESCRIPTORPOOL DescriptorPool ; <nl> - typedef GPRC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor ; <nl> + typedef GRPC_CUSTOM_FIELDDESCRIPTOR FieldDescriptor ; <nl> typedef GRPC_CUSTOM_FILEDESCRIPTOR FileDescriptor ; <nl> typedef GRPC_CUSTOM_FILEDESCRIPTORPROTO FileDescriptorProto ; <nl> typedef GRPC_CUSTOM_METHODDESCRIPTOR MethodDescriptor ; <nl> mmm a / include / grpc / impl / codegen / slice . h <nl> ppp b / include / grpc / impl / codegen / slice . h <nl> GPRAPI void gpr_slice_unref ( gpr_slice s ) ; <nl> passed in at destruction . * / <nl> GPRAPI gpr_slice gpr_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) ; <nl> <nl> + / * Equivalent to gpr_slice_new , but with a separate pointer that is <nl> + passed to the destroy function . This function can be useful when <nl> + the data is part of a larger structure that must be destroyed when <nl> + the data is no longer needed . * / <nl> + GPRAPI gpr_slice gpr_slice_new_with_user_data ( void * p , size_t len , <nl> + void ( * destroy ) ( void * ) , <nl> + void * user_data ) ; <nl> + <nl> / * Equivalent to gpr_slice_new , but with a two argument destroy function that <nl> also takes the slice length . * / <nl> GPRAPI gpr_slice gpr_slice_new_with_len ( void * p , size_t len , <nl> mmm a / package . xml <nl> ppp b / package . xml <nl> <nl> < email > grpc - packages @ google . com < / email > <nl> < active > yes < / active > <nl> < / lead > <nl> - < date > 2016 - 07 - 13 < / date > <nl> + < date > 2016 - 07 - 21 < / date > <nl> < time > 16 : 06 : 07 < / time > <nl> < version > <nl> < release > 1 . 1 . 0 < / release > <nl> <nl> < / stability > <nl> < license > BSD < / license > <nl> < notes > <nl> - - GA release <nl> - - Fix shutdown hang problem # 4017 <nl> + - PHP7 Support # 7464 <nl> < / notes > <nl> < contents > <nl> < dir baseinstalldir = " / " name = " / " > <nl> Update to wrap gRPC C Core version 0 . 10 . 0 <nl> < / release > <nl> < release > <nl> < version > <nl> - < release > 1 . 0 . 0 < / release > <nl> - < api > 1 . 0 . 0 < / api > <nl> + < release > 1 . 0 . 0RC1 < / release > <nl> + < api > 1 . 0 . 0RC1 < / api > <nl> < / version > <nl> < stability > <nl> < release > stable < / release > <nl> Update to wrap gRPC C Core version 0 . 10 . 0 <nl> - Fix shutdown hang problem # 4017 <nl> < / notes > <nl> < / release > <nl> + < release > <nl> + < version > <nl> + < release > 1 . 0 . 0RC2 < / release > <nl> + < api > 1 . 0 . 0RC2 < / api > <nl> + < / version > <nl> + < stability > <nl> + < release > stable < / release > <nl> + < api > stable < / api > <nl> + < / stability > <nl> + < date > 2016 - 07 - 21 < / date > <nl> + < license > BSD < / license > <nl> + < notes > <nl> + - PHP7 Support # 7464 <nl> + < / notes > <nl> + < / release > <nl> < / changelog > <nl> < / package > <nl> mmm a / src / core / ext / client_config / channel_connectivity . c <nl> ppp b / src / core / ext / client_config / channel_connectivity . c <nl> grpc_connectivity_state grpc_channel_check_connectivity_state ( <nl> } <nl> gpr_log ( GPR_ERROR , <nl> " grpc_channel_check_connectivity_state called on something that is " <nl> - " not a ( u ) client channel , but ' % s ' " , <nl> + " not a client channel , but ' % s ' " , <nl> client_channel_elem - > filter - > name ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> return GRPC_CHANNEL_SHUTDOWN ; <nl> mmm a / src / core / ext / transport / chttp2 / server / insecure / server_chttp2 . c <nl> ppp b / src / core / ext / transport / chttp2 / server / insecure / server_chttp2 . c <nl> static void start ( grpc_exec_ctx * exec_ctx , grpc_server * server , void * tcpp , <nl> static void destroy ( grpc_exec_ctx * exec_ctx , grpc_server * server , void * tcpp , <nl> grpc_closure * destroy_done ) { <nl> grpc_tcp_server * tcp = tcpp ; <nl> + grpc_tcp_server_shutdown_listeners ( exec_ctx , tcp ) ; <nl> grpc_tcp_server_unref ( exec_ctx , tcp ) ; <nl> grpc_exec_ctx_sched ( exec_ctx , destroy_done , GRPC_ERROR_NONE , NULL ) ; <nl> } <nl> mmm a / src / core / ext / transport / chttp2 / server / secure / server_secure_chttp2 . c <nl> ppp b / src / core / ext / transport / chttp2 / server / secure / server_secure_chttp2 . c <nl> static void destroy ( grpc_exec_ctx * exec_ctx , grpc_server * server , void * statep , <nl> state - > destroy_callback = callback ; <nl> tcp = state - > tcp ; <nl> gpr_mu_unlock ( & state - > mu ) ; <nl> + grpc_tcp_server_shutdown_listeners ( exec_ctx , tcp ) ; <nl> grpc_tcp_server_unref ( exec_ctx , tcp ) ; <nl> } <nl> <nl> mmm a / src / core / lib / iomgr / tcp_server . h <nl> ppp b / src / core / lib / iomgr / tcp_server . h <nl> void grpc_tcp_server_shutdown_starting_add ( grpc_tcp_server * s , <nl> a call ( exec_ctx ! = NULL ) to shutdown_complete . * / <nl> void grpc_tcp_server_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp_server * s ) ; <nl> <nl> + / * Shutdown the fds of listeners . * / <nl> + void grpc_tcp_server_shutdown_listeners ( grpc_exec_ctx * exec_ctx , <nl> + grpc_tcp_server * s ) ; <nl> + <nl> # endif / * GRPC_CORE_LIB_IOMGR_TCP_SERVER_H * / <nl> mmm a / src / core / lib / iomgr / tcp_server_posix . c <nl> ppp b / src / core / lib / iomgr / tcp_server_posix . c <nl> void grpc_tcp_server_unref ( grpc_exec_ctx * exec_ctx , grpc_tcp_server * s ) { <nl> } <nl> } <nl> <nl> + void grpc_tcp_server_shutdown_listeners ( grpc_exec_ctx * exec_ctx , <nl> + grpc_tcp_server * s ) { <nl> + gpr_mu_lock ( & s - > mu ) ; <nl> + / * shutdown all fd ' s * / <nl> + if ( s - > active_ports ) { <nl> + grpc_tcp_listener * sp ; <nl> + for ( sp = s - > head ; sp ; sp = sp - > next ) { <nl> + grpc_fd_shutdown ( exec_ctx , sp - > emfd ) ; <nl> + } <nl> + } <nl> + gpr_mu_unlock ( & s - > mu ) ; <nl> + } <nl> + <nl> # endif <nl> mmm a / src / core / lib / iomgr / tcp_server_windows . c <nl> ppp b / src / core / lib / iomgr / tcp_server_windows . c <nl> void grpc_tcp_server_start ( grpc_exec_ctx * exec_ctx , grpc_tcp_server * s , <nl> gpr_mu_unlock ( & s - > mu ) ; <nl> } <nl> <nl> + void grpc_tcp_server_shutdown_listeners ( grpc_exec_ctx * exec_ctx , <nl> + grpc_tcp_server * s ) { } <nl> + <nl> # endif / * GPR_WINSOCK_SOCKET * / <nl> mmm a / src / core / lib / support / slice . c <nl> ppp b / src / core / lib / support / slice . c <nl> static void new_slice_unref ( void * p ) { <nl> } <nl> } <nl> <nl> - gpr_slice gpr_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) { <nl> + gpr_slice gpr_slice_new_with_user_data ( void * p , size_t len , <nl> + void ( * destroy ) ( void * ) , <nl> + void * user_data ) { <nl> gpr_slice slice ; <nl> new_slice_refcount * rc = gpr_malloc ( sizeof ( new_slice_refcount ) ) ; <nl> gpr_ref_init ( & rc - > refs , 1 ) ; <nl> rc - > rc . ref = new_slice_ref ; <nl> rc - > rc . unref = new_slice_unref ; <nl> rc - > user_destroy = destroy ; <nl> - rc - > user_data = p ; <nl> + rc - > user_data = user_data ; <nl> <nl> slice . refcount = & rc - > rc ; <nl> slice . data . refcounted . bytes = p ; <nl> gpr_slice gpr_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) { <nl> return slice ; <nl> } <nl> <nl> + gpr_slice gpr_slice_new ( void * p , size_t len , void ( * destroy ) ( void * ) ) { <nl> + / * Pass " p " to * destroy when the slice is no longer needed . * / <nl> + return gpr_slice_new_with_user_data ( p , len , destroy , p ) ; <nl> + } <nl> + <nl> / * gpr_slice_new_with_len support structures - we create a refcount object <nl> extended with the user provided data pointer & destroy function * / <nl> typedef struct new_with_len_slice_refcount { <nl> new file mode 100644 <nl> index 00000000000 . . 58abb492cea <nl> mmm / dev / null <nl> ppp b / src / objective - c / tests / CoreCronetEnd2EndTests / CoreCronetEnd2EndTests . m <nl> <nl> + / * <nl> + * <nl> + * Copyright 2015 , Google Inc . <nl> + * All rights reserved . <nl> + * <nl> + * Redistribution and use in source and binary forms , with or without <nl> + * modification , are permitted provided that the following conditions are <nl> + * met : <nl> + * <nl> + * * Redistributions of source code must retain the above copyright <nl> + * notice , this list of conditions and the following disclaimer . <nl> + * * Redistributions in binary form must reproduce the above <nl> + * copyright notice , this list of conditions and the following disclaimer <nl> + * in the documentation and / or other materials provided with the <nl> + * distribution . <nl> + * * Neither the name of Google Inc . nor the names of its <nl> + * contributors may be used to endorse or promote products derived from <nl> + * this software without specific prior written permission . <nl> + * <nl> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS <nl> + * " AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT <nl> + * LIMITED TO , THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR <nl> + * A PARTICULAR PURPOSE ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT <nl> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , <nl> + * SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT <nl> + * LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , <nl> + * DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY <nl> + * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT <nl> + * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE <nl> + * OF THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE . <nl> + * <nl> + * / <nl> + <nl> + / * <nl> + * This test file is derived from fixture h2_ssl . c in core end2end test <nl> + * ( test / core / end2end / fixture / h2_ssl . c ) . The structure of the fixture is <nl> + * preserved as much as possible <nl> + * <nl> + * This fixture creates a server full stack using chttp2 and a client <nl> + * full stack using Cronet . End - to - end tests are run against this <nl> + * configuration <nl> + * <nl> + * / <nl> + <nl> + <nl> + # import < XCTest / XCTest . h > <nl> + # include " test / core / end2end / end2end_tests . h " <nl> + <nl> + # include < stdio . h > <nl> + # include < string . h > <nl> + <nl> + # include < grpc / support / alloc . h > <nl> + # include < grpc / support / host_port . h > <nl> + # include < grpc / support / log . h > <nl> + <nl> + # include " src / core / lib / channel / channel_args . h " <nl> + # include " src / core / lib / security / credentials / credentials . h " <nl> + # include " src / core / lib / support / env . h " <nl> + # include " src / core / lib / support / string . h " <nl> + # include " src / core / lib / support / tmpfile . h " <nl> + # include " test / core / end2end / data / ssl_test_data . h " <nl> + # include " test / core / util / port . h " <nl> + # include " test / core / util / test_config . h " <nl> + <nl> + # include < grpc / grpc_cronet . h > <nl> + # import < Cronet / Cronet . h > <nl> + <nl> + typedef struct fullstack_secure_fixture_data { <nl> + char * localaddr ; <nl> + } fullstack_secure_fixture_data ; <nl> + <nl> + static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack ( <nl> + grpc_channel_args * client_args , grpc_channel_args * server_args ) { <nl> + grpc_end2end_test_fixture f ; <nl> + int port = grpc_pick_unused_port_or_die ( ) ; <nl> + fullstack_secure_fixture_data * ffd = <nl> + gpr_malloc ( sizeof ( fullstack_secure_fixture_data ) ) ; <nl> + memset ( & f , 0 , sizeof ( f ) ) ; <nl> + <nl> + gpr_join_host_port ( & ffd - > localaddr , " localhost " , port ) ; <nl> + <nl> + f . fixture_data = ffd ; <nl> + f . cq = grpc_completion_queue_create ( NULL ) ; <nl> + <nl> + return f ; <nl> + } <nl> + <nl> + static void process_auth_failure ( void * state , grpc_auth_context * ctx , <nl> + const grpc_metadata * md , size_t md_count , <nl> + grpc_process_auth_metadata_done_cb cb , <nl> + void * user_data ) { <nl> + GPR_ASSERT ( state = = NULL ) ; <nl> + cb ( user_data , NULL , 0 , NULL , 0 , GRPC_STATUS_UNAUTHENTICATED , NULL ) ; <nl> + } <nl> + <nl> + static void cronet_init_client_secure_fullstack ( <nl> + grpc_end2end_test_fixture * f , grpc_channel_args * client_args , <nl> + cronet_engine * cronetEngine ) { <nl> + fullstack_secure_fixture_data * ffd = f - > fixture_data ; <nl> + f - > client = <nl> + grpc_cronet_secure_channel_create ( cronetEngine , ffd - > localaddr , client_args , NULL ) ; <nl> + GPR_ASSERT ( f - > client ! = NULL ) ; <nl> + } <nl> + <nl> + static void chttp2_init_server_secure_fullstack ( <nl> + grpc_end2end_test_fixture * f , grpc_channel_args * server_args , <nl> + grpc_server_credentials * server_creds ) { <nl> + fullstack_secure_fixture_data * ffd = f - > fixture_data ; <nl> + if ( f - > server ) { <nl> + grpc_server_destroy ( f - > server ) ; <nl> + } <nl> + f - > server = grpc_server_create ( server_args , NULL ) ; <nl> + grpc_server_register_completion_queue ( f - > server , f - > cq , NULL ) ; <nl> + GPR_ASSERT ( grpc_server_add_secure_http2_port ( f - > server , ffd - > localaddr , <nl> + server_creds ) ) ; <nl> + grpc_server_credentials_release ( server_creds ) ; <nl> + grpc_server_start ( f - > server ) ; <nl> + } <nl> + <nl> + static void chttp2_tear_down_secure_fullstack ( grpc_end2end_test_fixture * f ) { <nl> + fullstack_secure_fixture_data * ffd = f - > fixture_data ; <nl> + gpr_free ( ffd - > localaddr ) ; <nl> + gpr_free ( ffd ) ; <nl> + } <nl> + <nl> + static void cronet_init_client_simple_ssl_secure_fullstack ( <nl> + grpc_end2end_test_fixture * f , grpc_channel_args * client_args ) { <nl> + grpc_arg ssl_name_override = { GRPC_ARG_STRING , <nl> + GRPC_SSL_TARGET_NAME_OVERRIDE_ARG , <nl> + { " foo . test . google . fr " } } ; <nl> + <nl> + grpc_channel_args * new_client_args = <nl> + grpc_channel_args_copy_and_add ( client_args , & ssl_name_override , 1 ) ; <nl> + [ Cronet setHttp2Enabled : YES ] ; <nl> + [ Cronet start ] ; <nl> + cronet_engine * cronetEngine = [ Cronet getGlobalEngine ] ; <nl> + <nl> + cronet_init_client_secure_fullstack ( f , new_client_args , cronetEngine ) ; <nl> + grpc_channel_args_destroy ( new_client_args ) ; <nl> + } <nl> + <nl> + static int fail_server_auth_check ( grpc_channel_args * server_args ) { <nl> + size_t i ; <nl> + if ( server_args = = NULL ) return 0 ; <nl> + for ( i = 0 ; i < server_args - > num_args ; i + + ) { <nl> + if ( strcmp ( server_args - > args [ i ] . key , FAIL_AUTH_CHECK_SERVER_ARG_NAME ) = = <nl> + 0 ) { <nl> + return 1 ; <nl> + } <nl> + } <nl> + return 0 ; <nl> + } <nl> + <nl> + static void chttp2_init_server_simple_ssl_secure_fullstack ( <nl> + grpc_end2end_test_fixture * f , grpc_channel_args * server_args ) { <nl> + grpc_ssl_pem_key_cert_pair pem_cert_key_pair = { test_server1_key , <nl> + test_server1_cert } ; <nl> + grpc_server_credentials * ssl_creds = <nl> + grpc_ssl_server_credentials_create ( NULL , & pem_cert_key_pair , 1 , 0 , NULL ) ; <nl> + if ( fail_server_auth_check ( server_args ) ) { <nl> + grpc_auth_metadata_processor processor = { process_auth_failure , NULL , NULL } ; <nl> + grpc_server_credentials_set_auth_metadata_processor ( ssl_creds , processor ) ; <nl> + } <nl> + chttp2_init_server_secure_fullstack ( f , server_args , ssl_creds ) ; <nl> + } <nl> + <nl> + / * All test configurations * / <nl> + <nl> + static grpc_end2end_test_config configs [ ] = { <nl> + { " chttp2 / simple_ssl_fullstack " , <nl> + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | <nl> + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS , <nl> + chttp2_create_fixture_secure_fullstack , <nl> + cronet_init_client_simple_ssl_secure_fullstack , <nl> + chttp2_init_server_simple_ssl_secure_fullstack , <nl> + chttp2_tear_down_secure_fullstack } , <nl> + } ; <nl> + <nl> + <nl> + <nl> + static char * roots_filename ; <nl> + <nl> + @ interface CoreCronetEnd2EndTests : XCTestCase <nl> + <nl> + @ end <nl> + <nl> + @ implementation CoreCronetEnd2EndTests <nl> + <nl> + <nl> + / / The setUp ( ) function is run before the test cases run and only run once <nl> + + ( void ) setUp { <nl> + [ super setUp ] ; <nl> + <nl> + FILE * roots_file ; <nl> + size_t roots_size = strlen ( test_root_cert ) ; <nl> + <nl> + char * argv [ ] = { " CoreCronetEnd2EndTests " } ; <nl> + grpc_test_init ( 1 , argv ) ; <nl> + grpc_end2end_tests_pre_init ( ) ; <nl> + <nl> + / * Set the SSL roots env var . * / <nl> + roots_file = gpr_tmpfile ( " chttp2_simple_ssl_fullstack_test " , & roots_filename ) ; <nl> + GPR_ASSERT ( roots_filename ! = NULL ) ; <nl> + GPR_ASSERT ( roots_file ! = NULL ) ; <nl> + GPR_ASSERT ( fwrite ( test_root_cert , 1 , roots_size , roots_file ) = = roots_size ) ; <nl> + fclose ( roots_file ) ; <nl> + gpr_setenv ( GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR , roots_filename ) ; <nl> + <nl> + grpc_init ( ) ; <nl> + <nl> + } <nl> + <nl> + / / The tearDown ( ) function is run after all test cases finish running <nl> + + ( void ) tearDown { <nl> + grpc_shutdown ( ) ; <nl> + <nl> + / * Cleanup . * / <nl> + remove ( roots_filename ) ; <nl> + gpr_free ( roots_filename ) ; <nl> + <nl> + [ super tearDown ] ; <nl> + } <nl> + <nl> + - ( void ) testIndividualCase : ( char * ) test_case { <nl> + char * argv [ ] = { " h2_ssl " , test_case } ; <nl> + <nl> + for ( int i = 0 ; i < sizeof ( configs ) / sizeof ( * configs ) ; i + + ) { <nl> + grpc_end2end_tests ( sizeof ( argv ) / sizeof ( argv [ 0 ] ) , argv , configs [ i ] ) ; <nl> + } <nl> + } <nl> + <nl> + / / TODO ( mxyan ) : Use NSStringFromSelector ( _cmd ) to acquire test name from the <nl> + / / test case method name , so that bodies of test cases can stay identical <nl> + - ( void ) testBadHostname { <nl> + [ self testIndividualCase : " bad_hostname " ] ; <nl> + } <nl> + <nl> + - ( void ) testBinaryMetadata { <nl> + [ self testIndividualCase : " binary_metadata " ] ; <nl> + } <nl> + <nl> + - ( void ) testCallCreds { <nl> + [ self testIndividualCase : " call_creds " ] ; <nl> + } <nl> + <nl> + - ( void ) testCancelAfterAccept { <nl> + [ self testIndividualCase : " cancel_after_accept " ] ; <nl> + } <nl> + <nl> + - ( void ) testCancelAfterClientDone { <nl> + [ self testIndividualCase : " cancel_after_client_done " ] ; <nl> + } <nl> + <nl> + - ( void ) testCancelAfterInvoke { <nl> + [ self testIndividualCase : " cancel_after_invoke " ] ; <nl> + } <nl> + <nl> + - ( void ) testCancelBeforeInvoke { <nl> + [ self testIndividualCase : " cancel_before_invoke " ] ; <nl> + } <nl> + <nl> + - ( void ) testCancelInAVacuum { <nl> + [ self testIndividualCase : " cancel_in_a_vacuum " ] ; <nl> + } <nl> + <nl> + - ( void ) testCancelWithStatus { <nl> + [ self testIndividualCase : " cancel_with_status " ] ; <nl> + } <nl> + <nl> + - ( void ) testCompressedPayload { <nl> + [ self testIndividualCase : " compressed_payload " ] ; <nl> + } <nl> + <nl> + - ( void ) testConnectivity { <nl> + [ self testIndividualCase : " connectivity " ] ; <nl> + } <nl> + <nl> + - ( void ) testDefaultHost { <nl> + [ self testIndividualCase : " default_host " ] ; <nl> + } <nl> + <nl> + - ( void ) testDisappearingServer { <nl> + [ self testIndividualCase : " disappearing_server " ] ; <nl> + } <nl> + <nl> + - ( void ) testEmptyBatch { <nl> + [ self testIndividualCase : " empty_batch " ] ; <nl> + } <nl> + <nl> + - ( void ) testFilterCausesClose { <nl> + [ self testIndividualCase : " filter_causes_close " ] ; <nl> + } <nl> + <nl> + - ( void ) testGracefulServerShutdown { <nl> + [ self testIndividualCase : " graceful_server_shutdown " ] ; <nl> + } <nl> + <nl> + - ( void ) testHighInitialSeqno { <nl> + [ self testIndividualCase : " high_initial_seqno " ] ; <nl> + } <nl> + <nl> + - ( void ) testHpackSize { <nl> + [ self testIndividualCase : " hpack_size " ] ; <nl> + } <nl> + <nl> + - ( void ) testIdempotentRequest { <nl> + [ self testIndividualCase : " idempotent_request " ] ; <nl> + } <nl> + <nl> + - ( void ) testInvokeLargeRequest { <nl> + [ self testIndividualCase : " invoke_large_request " ] ; <nl> + } <nl> + <nl> + - ( void ) testLargeMetadata { <nl> + [ self testIndividualCase : " large_metadata " ] ; <nl> + } <nl> + <nl> + - ( void ) testMaxConcurrentStreams { <nl> + [ self testIndividualCase : " max_concurrent_streams " ] ; <nl> + } <nl> + <nl> + - ( void ) testMaxMessageLength { <nl> + [ self testIndividualCase : " max_message_length " ] ; <nl> + } <nl> + <nl> + - ( void ) testNegativeDeadline { <nl> + [ self testIndividualCase : " negative_deadline " ] ; <nl> + } <nl> + <nl> + - ( void ) testNetworkStatusChange { <nl> + [ self testIndividualCase : " network_status_change " ] ; <nl> + } <nl> + <nl> + - ( void ) testNoOp { <nl> + [ self testIndividualCase : " no_op " ] ; <nl> + } <nl> + <nl> + - ( void ) testPayload { <nl> + [ self testIndividualCase : " payload " ] ; <nl> + } <nl> + <nl> + - ( void ) testPing { <nl> + [ self testIndividualCase : " ping " ] ; <nl> + } <nl> + <nl> + - ( void ) testPingPongStreaming { <nl> + [ self testIndividualCase : " ping_pong_streaming " ] ; <nl> + } <nl> + <nl> + - ( void ) testRegisteredCall { <nl> + [ self testIndividualCase : " registered_call " ] ; <nl> + } <nl> + <nl> + - ( void ) testRequestWithFlags { <nl> + [ self testIndividualCase : " request_with_flags " ] ; <nl> + } <nl> + <nl> + - ( void ) testRequestWithPayload { <nl> + [ self testIndividualCase : " request_with_payload " ] ; <nl> + } <nl> + <nl> + - ( void ) testServerFinishesRequest { <nl> + [ self testIndividualCase : " server_finishes_request " ] ; <nl> + } <nl> + <nl> + - ( void ) testShutdownFinishesCalls { <nl> + [ self testIndividualCase : " shutdown_finishes_calls " ] ; <nl> + } <nl> + <nl> + - ( void ) testShutdownFinishesTags { <nl> + [ self testIndividualCase : " shutdown_finishes_tags " ] ; <nl> + } <nl> + <nl> + - ( void ) testSimpleDelayedRequest { <nl> + [ self testIndividualCase : " simple_delayed_request " ] ; <nl> + } <nl> + <nl> + - ( void ) testSimpleMetadata { <nl> + [ self testIndividualCase : " simple_metadata " ] ; <nl> + } <nl> + <nl> + - ( void ) testSimpleRequest { <nl> + [ self testIndividualCase : " simple_request " ] ; <nl> + } <nl> + <nl> + - ( void ) testStreamingErrorResponse { <nl> + [ self testIndividualCase : " streaming_error_response " ] ; <nl> + } <nl> + <nl> + - ( void ) testTrailingMetadata { <nl> + [ self testIndividualCase : " trailing_metadata " ] ; <nl> + } <nl> + <nl> + @ end <nl> new file mode 100644 <nl> index 00000000000 . . fbeeb96ba6c <nl> mmm / dev / null <nl> ppp b / src / objective - c / tests / CoreCronetEnd2EndTests / Info . plist <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < ! DOCTYPE plist PUBLIC " - / / Apple / / DTD PLIST 1 . 0 / / EN " " http : / / www . apple . com / DTDs / PropertyList - 1 . 0 . dtd " > <nl> + < plist version = " 1 . 0 " > <nl> + < dict > <nl> + < key > CFBundleDevelopmentRegion < / key > <nl> + < string > en < / string > <nl> + < key > CFBundleExecutable < / key > <nl> + < string > $ ( EXECUTABLE_NAME ) < / string > <nl> + < key > CFBundleIdentifier < / key > <nl> + < string > gRPC . $ ( PRODUCT_NAME : rfc1034identifier ) < / string > <nl> + < key > CFBundleInfoDictionaryVersion < / key > <nl> + < string > 6 . 0 < / string > <nl> + < key > CFBundleName < / key > <nl> + < string > $ ( PRODUCT_NAME ) < / string > <nl> + < key > CFBundlePackageType < / key > <nl> + < string > BNDL < / string > <nl> + < key > CFBundleShortVersionString < / key > <nl> + < string > 1 . 0 < / string > <nl> + < key > CFBundleSignature < / key > <nl> + < string > ? ? ? ? < / string > <nl> + < key > CFBundleVersion < / key > <nl> + < string > 1 < / string > <nl> + < / dict > <nl> + < / plist > <nl> mmm a / src / objective - c / tests / Podfile <nl> ppp b / src / objective - c / tests / Podfile <nl> GRPC_LOCAL_SRC = ' . . / . . / . . ' <nl> pod ' ! ProtoCompiler - gRPCPlugin ' , : path = > " # { GRPC_LOCAL_SRC } / src / objective - c " <nl> <nl> pod ' BoringSSL ' , : podspec = > " # { GRPC_LOCAL_SRC } / src / objective - c " , : inhibit_warnings = > true <nl> - pod ' CronetFramework ' , : podspec = > " # { GRPC_LOCAL_SRC } / src / objective - c " <nl> <nl> pod ' gRPC ' , : path = > GRPC_LOCAL_SRC <nl> pod ' gRPC - Core ' , : path = > GRPC_LOCAL_SRC <nl> pod ' gRPC - RxLibrary ' , : path = > GRPC_LOCAL_SRC <nl> pod ' gRPC - ProtoRPC ' , : path = > GRPC_LOCAL_SRC <nl> - <nl> pod ' RemoteTest ' , : path = > " RemoteTestClient " <nl> end <nl> end <nl> <nl> + target ' CoreCronetEnd2EndTests ' do <nl> + pod ' BoringSSL ' , : podspec = > " # { GRPC_LOCAL_SRC } / src / objective - c " , : inhibit_warnings = > true <nl> + pod ' CronetFramework ' , : podspec = > " # { GRPC_LOCAL_SRC } / src / objective - c " <nl> + pod ' gRPC - Core ' , : path = > GRPC_LOCAL_SRC <nl> + pod ' gRPC - Core / Cronet - Interface ' , : path = > GRPC_LOCAL_SRC <nl> + pod ' gRPC - Core / Cronet - Tests ' , : path = > GRPC_LOCAL_SRC <nl> + end <nl> + <nl> # gRPC - Core . podspec needs to be modified to be successfully used for local development . A Podfile ' s <nl> # pre_install hook lets us do that . The block passed to it runs after the podspecs are downloaded <nl> # and before they are installed in the user project . <nl> post_install do | installer | <nl> target . build_configurations . each do | config | <nl> config . build_settings [ ' GCC_TREAT_WARNINGS_AS_ERRORS ' ] = ' YES ' <nl> end <nl> - if target . name = = ' gRPC - Core ' <nl> + if target . name = = ' gRPC - Core ' or target . name = = ' gRPC - Core . default - Cronet - Interface - Cronet - Tests ' <nl> target . build_configurations . each do | config | <nl> # TODO ( zyc ) : Remove this setting after the issue is resolved <nl> # GPR_UNREACHABLE_CODE causes " Control may reach end of non - void <nl> mmm a / src / objective - c / tests / Tests . xcodeproj / project . pbxproj <nl> ppp b / src / objective - c / tests / Tests . xcodeproj / project . pbxproj <nl> <nl> 20DFDF829DD993A4A00D5662 / * libPods - RxLibraryUnitTests . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = A58BE6DF1C62D1739EBB2C78 / * libPods - RxLibraryUnitTests . a * / ; } ; <nl> 333E8FC01C8285B7C547D799 / * libPods - InteropTestsLocalCleartext . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = FD346DB2C23F676C4842F3FF / * libPods - InteropTestsLocalCleartext . a * / ; } ; <nl> 3D7C85F6AA68C4A205E3BA16 / * libPods - Tests . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 20DFF2F3C97EF098FE5A3171 / * libPods - Tests . a * / ; } ; <nl> + 5E8A5DA71D3840B4000F8BC4 / * CoreCronetEnd2EndTests . m in Sources * / = { isa = PBXBuildFile ; fileRef = 5E8A5DA61D3840B4000F8BC4 / * CoreCronetEnd2EndTests . m * / ; } ; <nl> + 5E8A5DA91D3840B4000F8BC4 / * libTests . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 635697C71B14FC11007A7283 / * libTests . a * / ; } ; <nl> + 60D2A57ED559F34428C2EEC5 / * libPods - CoreCronetEnd2EndTests . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = FBD98AC417B9882D32B19F28 / * libPods - CoreCronetEnd2EndTests . a * / ; } ; <nl> 6312AE4E1B1BF49B00341DEE / * GRPCClientTests . m in Sources * / = { isa = PBXBuildFile ; fileRef = 6312AE4D1B1BF49B00341DEE / * GRPCClientTests . m * / ; } ; <nl> 63423F4A1B150A5F006CF63C / * libTests . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 635697C71B14FC11007A7283 / * libTests . a * / ; } ; <nl> 635697CD1B14FC11007A7283 / * Tests . m in Sources * / = { isa = PBXBuildFile ; fileRef = 635697CC1B14FC11007A7283 / * Tests . m * / ; } ; <nl> <nl> / * End PBXBuildFile section * / <nl> <nl> / * Begin PBXContainerItemProxy section * / <nl> + 5E8A5DAA1D3840B4000F8BC4 / * PBXContainerItemProxy * / = { <nl> + isa = PBXContainerItemProxy ; <nl> + containerPortal = 635697BF1B14FC11007A7283 / * Project object * / ; <nl> + proxyType = 1 ; <nl> + remoteGlobalIDString = 635697C61B14FC11007A7283 ; <nl> + remoteInfo = Tests ; <nl> + } ; <nl> 63423F4B1B150A5F006CF63C / * PBXContainerItemProxy * / = { <nl> isa = PBXContainerItemProxy ; <nl> containerPortal = 635697BF1B14FC11007A7283 / * Project object * / ; <nl> <nl> 060EF32D7EC0DF67ED617507 / * Pods - Tests . debug . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - Tests . debug . xcconfig " ; path = " Pods / Target Support Files / Pods - Tests / Pods - Tests . debug . xcconfig " ; sourceTree = " < group > " ; } ; <nl> 07D10A965323BEA7FE59A74B / * Pods - RxLibraryUnitTests . debug . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - RxLibraryUnitTests . debug . xcconfig " ; path = " Pods / Target Support Files / Pods - RxLibraryUnitTests / Pods - RxLibraryUnitTests . debug . xcconfig " ; sourceTree = " < group > " ; } ; <nl> 0A4F89D9C90E9C30990218F0 / * Pods . release . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = Pods . release . xcconfig ; path = " Pods / Target Support Files / Pods / Pods . release . xcconfig " ; sourceTree = " < group > " ; } ; <nl> + 0D2284C3DF7E57F0ED504E39 / * Pods - CoreCronetEnd2EndTests . debug . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - CoreCronetEnd2EndTests . debug . xcconfig " ; path = " Pods / Target Support Files / Pods - CoreCronetEnd2EndTests / Pods - CoreCronetEnd2EndTests . debug . xcconfig " ; sourceTree = " < group > " ; } ; <nl> 20DFF2F3C97EF098FE5A3171 / * libPods - Tests . a * / = { isa = PBXFileReference ; explicitFileType = archive . ar ; includeInIndex = 0 ; path = " libPods - Tests . a " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> 35F2B6BF3BAE8F0DC4AFD76E / * libPods . a * / = { isa = PBXFileReference ; explicitFileType = archive . ar ; includeInIndex = 0 ; path = libPods . a ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> 3B0861FC805389C52DB260D4 / * Pods - RxLibraryUnitTests . release . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - RxLibraryUnitTests . release . xcconfig " ; path = " Pods / Target Support Files / Pods - RxLibraryUnitTests / Pods - RxLibraryUnitTests . release . xcconfig " ; sourceTree = " < group > " ; } ; <nl> + 4AD97096D13D7416DC91A72A / * Pods - CoreCronetEnd2EndTests . release . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - CoreCronetEnd2EndTests . release . xcconfig " ; path = " Pods / Target Support Files / Pods - CoreCronetEnd2EndTests / Pods - CoreCronetEnd2EndTests . release . xcconfig " ; sourceTree = " < group > " ; } ; <nl> 51A275E86C141416ED63FF76 / * Pods - InteropTestsLocalCleartext . release . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - InteropTestsLocalCleartext . release . xcconfig " ; path = " Pods / Target Support Files / Pods - InteropTestsLocalCleartext / Pods - InteropTestsLocalCleartext . release . xcconfig " ; sourceTree = " < group > " ; } ; <nl> 553BBBED24E4162D1F769D65 / * Pods - InteropTestsLocalSSL . debug . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - InteropTestsLocalSSL . debug . xcconfig " ; path = " Pods / Target Support Files / Pods - InteropTestsLocalSSL / Pods - InteropTestsLocalSSL . debug . xcconfig " ; sourceTree = " < group > " ; } ; <nl> 5761E98978DDDF136A58CB7E / * Pods - AllTests . release . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - AllTests . release . xcconfig " ; path = " Pods / Target Support Files / Pods - AllTests / Pods - AllTests . release . xcconfig " ; sourceTree = " < group > " ; } ; <nl> + 5E8A5DA41D3840B4000F8BC4 / * CoreCronetEnd2EndTests . xctest * / = { isa = PBXFileReference ; explicitFileType = wrapper . cfbundle ; includeInIndex = 0 ; path = CoreCronetEnd2EndTests . xctest ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> + 5E8A5DA61D3840B4000F8BC4 / * CoreCronetEnd2EndTests . m * / = { isa = PBXFileReference ; lastKnownFileType = sourcecode . c . objc ; path = CoreCronetEnd2EndTests . m ; sourceTree = " < group > " ; } ; <nl> 6312AE4D1B1BF49B00341DEE / * GRPCClientTests . m * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . objc ; path = GRPCClientTests . m ; sourceTree = " < group > " ; } ; <nl> 63423F441B150A5F006CF63C / * AllTests . xctest * / = { isa = PBXFileReference ; explicitFileType = wrapper . cfbundle ; includeInIndex = 0 ; path = AllTests . xctest ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> 63423F501B151B77006CF63C / * RxLibraryUnitTests . m * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . objc ; path = RxLibraryUnitTests . m ; sourceTree = " < group > " ; } ; <nl> <nl> E1486220285AF123EB124008 / * Pods - InteropTestsLocalCleartext . debug . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - InteropTestsLocalCleartext . debug . xcconfig " ; path = " Pods / Target Support Files / Pods - InteropTestsLocalCleartext / Pods - InteropTestsLocalCleartext . debug . xcconfig " ; sourceTree = " < group > " ; } ; <nl> E4275A759BDBDF143B9B438F / * Pods - InteropTestsRemote . release . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - InteropTestsRemote . release . xcconfig " ; path = " Pods / Target Support Files / Pods - InteropTestsRemote / Pods - InteropTestsRemote . release . xcconfig " ; sourceTree = " < group > " ; } ; <nl> E6733B838B28453434B556E2 / * Pods - Tests . release . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = " Pods - Tests . release . xcconfig " ; path = " Pods / Target Support Files / Pods - Tests / Pods - Tests . release . xcconfig " ; sourceTree = " < group > " ; } ; <nl> + FBD98AC417B9882D32B19F28 / * libPods - CoreCronetEnd2EndTests . a * / = { isa = PBXFileReference ; explicitFileType = archive . ar ; includeInIndex = 0 ; path = " libPods - CoreCronetEnd2EndTests . a " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> FD346DB2C23F676C4842F3FF / * libPods - InteropTestsLocalCleartext . a * / = { isa = PBXFileReference ; explicitFileType = archive . ar ; includeInIndex = 0 ; path = " libPods - InteropTestsLocalCleartext . a " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> FF7B5489BCFE40111D768DD0 / * Pods . debug . xcconfig * / = { isa = PBXFileReference ; includeInIndex = 1 ; lastKnownFileType = text . xcconfig ; name = Pods . debug . xcconfig ; path = " Pods / Target Support Files / Pods / Pods . debug . xcconfig " ; sourceTree = " < group > " ; } ; <nl> / * End PBXFileReference section * / <nl> <nl> / * Begin PBXFrameworksBuildPhase section * / <nl> + 5E8A5DA11D3840B4000F8BC4 / * Frameworks * / = { <nl> + isa = PBXFrameworksBuildPhase ; <nl> + buildActionMask = 2147483647 ; <nl> + files = ( <nl> + 5E8A5DA91D3840B4000F8BC4 / * libTests . a in Frameworks * / , <nl> + 60D2A57ED559F34428C2EEC5 / * libPods - CoreCronetEnd2EndTests . a in Frameworks * / , <nl> + ) ; <nl> + runOnlyForDeploymentPostprocessing = 0 ; <nl> + } ; <nl> 63423F411B150A5F006CF63C / * Frameworks * / = { <nl> isa = PBXFrameworksBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> <nl> DBE059B4AC7A51919467EEC0 / * libPods - InteropTestsRemote . a * / , <nl> A58BE6DF1C62D1739EBB2C78 / * libPods - RxLibraryUnitTests . a * / , <nl> 20DFF2F3C97EF098FE5A3171 / * libPods - Tests . a * / , <nl> + FBD98AC417B9882D32B19F28 / * libPods - CoreCronetEnd2EndTests . a * / , <nl> ) ; <nl> name = Frameworks ; <nl> sourceTree = " < group > " ; <nl> <nl> 3B0861FC805389C52DB260D4 / * Pods - RxLibraryUnitTests . release . xcconfig * / , <nl> 060EF32D7EC0DF67ED617507 / * Pods - Tests . debug . xcconfig * / , <nl> E6733B838B28453434B556E2 / * Pods - Tests . release . xcconfig * / , <nl> + 0D2284C3DF7E57F0ED504E39 / * Pods - CoreCronetEnd2EndTests . debug . xcconfig * / , <nl> + 4AD97096D13D7416DC91A72A / * Pods - CoreCronetEnd2EndTests . release . xcconfig * / , <nl> ) ; <nl> name = Pods ; <nl> sourceTree = " < group > " ; <nl> } ; <nl> + 5E8A5DA51D3840B4000F8BC4 / * CoreCronetEnd2EndTests * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 5E8A5DA61D3840B4000F8BC4 / * CoreCronetEnd2EndTests . m * / , <nl> + ) ; <nl> + path = CoreCronetEnd2EndTests ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> 635697BE1B14FC11007A7283 = { <nl> isa = PBXGroup ; <nl> children = ( <nl> 635697C91B14FC11007A7283 / * Tests * / , <nl> 63E240CF1B6C63DC005F3B0E / * TestCertificates . bundle * / , <nl> + 5E8A5DA51D3840B4000F8BC4 / * CoreCronetEnd2EndTests * / , <nl> 635697C81B14FC11007A7283 / * Products * / , <nl> 51E4650F34F854F41FF053B3 / * Pods * / , <nl> 136D535E19727099B941D7B1 / * Frameworks * / , <nl> <nl> 63DC84231BE15267000708E8 / * InteropTestsRemote . xctest * / , <nl> 63DC84341BE15294000708E8 / * InteropTestsLocalSSL . xctest * / , <nl> 63DC84431BE152B5000708E8 / * InteropTestsLocalCleartext . xctest * / , <nl> + 5E8A5DA41D3840B4000F8BC4 / * CoreCronetEnd2EndTests . xctest * / , <nl> ) ; <nl> name = Products ; <nl> sourceTree = " < group > " ; <nl> <nl> / * End PBXGroup section * / <nl> <nl> / * Begin PBXNativeTarget section * / <nl> + 5E8A5DA31D3840B4000F8BC4 / * CoreCronetEnd2EndTests * / = { <nl> + isa = PBXNativeTarget ; <nl> + buildConfigurationList = 5E8A5DAE1D3840B4000F8BC4 / * Build configuration list for PBXNativeTarget " CoreCronetEnd2EndTests " * / ; <nl> + buildPhases = ( <nl> + F58F17E425446B15028B9F74 / * [ CP ] Check Pods Manifest . lock * / , <nl> + 5E8A5DA01D3840B4000F8BC4 / * Sources * / , <nl> + 5E8A5DA11D3840B4000F8BC4 / * Frameworks * / , <nl> + 5E8A5DA21D3840B4000F8BC4 / * Resources * / , <nl> + E63468C760D0724F18861822 / * [ CP ] Embed Pods Frameworks * / , <nl> + 6DFE9E77CAB5760196D79E0F / * [ CP ] Copy Pods Resources * / , <nl> + ) ; <nl> + buildRules = ( <nl> + ) ; <nl> + dependencies = ( <nl> + 5E8A5DAB1D3840B4000F8BC4 / * PBXTargetDependency * / , <nl> + ) ; <nl> + name = CoreCronetEnd2EndTests ; <nl> + productName = CoreCronetEnd2EndTests ; <nl> + productReference = 5E8A5DA41D3840B4000F8BC4 / * CoreCronetEnd2EndTests . xctest * / ; <nl> + productType = " com . apple . product - type . bundle . unit - test " ; <nl> + } ; <nl> 63423F431B150A5F006CF63C / * AllTests * / = { <nl> isa = PBXNativeTarget ; <nl> buildConfigurationList = 63423F4D1B150A5F006CF63C / * Build configuration list for PBXNativeTarget " AllTests " * / ; <nl> <nl> LastUpgradeCheck = 0630 ; <nl> ORGANIZATIONNAME = gRPC ; <nl> TargetAttributes = { <nl> + 5E8A5DA31D3840B4000F8BC4 = { <nl> + CreatedOnToolsVersion = 7 . 3 . 1 ; <nl> + } ; <nl> 63423F431B150A5F006CF63C = { <nl> CreatedOnToolsVersion = 6 . 3 . 1 ; <nl> } ; <nl> <nl> 63DC84221BE15267000708E8 / * InteropTestsRemote * / , <nl> 63DC84331BE15294000708E8 / * InteropTestsLocalSSL * / , <nl> 63DC84421BE152B5000708E8 / * InteropTestsLocalCleartext * / , <nl> + 5E8A5DA31D3840B4000F8BC4 / * CoreCronetEnd2EndTests * / , <nl> ) ; <nl> } ; <nl> / * End PBXProject section * / <nl> <nl> / * Begin PBXResourcesBuildPhase section * / <nl> + 5E8A5DA21D3840B4000F8BC4 / * Resources * / = { <nl> + isa = PBXResourcesBuildPhase ; <nl> + buildActionMask = 2147483647 ; <nl> + files = ( <nl> + ) ; <nl> + runOnlyForDeploymentPostprocessing = 0 ; <nl> + } ; <nl> 63423F421B150A5F006CF63C / * Resources * / = { <nl> isa = PBXResourcesBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> <nl> shellScript = " \ " $ { SRCROOT } / Pods / Target Support Files / Pods - InteropTestsLocalSSL / Pods - InteropTestsLocalSSL - resources . sh \ " \ n " ; <nl> showEnvVarsInLog = 0 ; <nl> } ; <nl> + 6DFE9E77CAB5760196D79E0F / * [ CP ] Copy Pods Resources * / = { <nl> + isa = PBXShellScriptBuildPhase ; <nl> + buildActionMask = 2147483647 ; <nl> + files = ( <nl> + ) ; <nl> + inputPaths = ( <nl> + ) ; <nl> + name = " [ CP ] Copy Pods Resources " ; <nl> + outputPaths = ( <nl> + ) ; <nl> + runOnlyForDeploymentPostprocessing = 0 ; <nl> + shellPath = / bin / sh ; <nl> + shellScript = " \ " $ { SRCROOT } / Pods / Target Support Files / Pods - CoreCronetEnd2EndTests / Pods - CoreCronetEnd2EndTests - resources . sh \ " \ n " ; <nl> + showEnvVarsInLog = 0 ; <nl> + } ; <nl> 7418AC7B3844B29E48D24FC7 / * [ CP ] Check Pods Manifest . lock * / = { <nl> isa = PBXShellScriptBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> <nl> shellScript = " \ " $ { SRCROOT } / Pods / Target Support Files / Pods - RxLibraryUnitTests / Pods - RxLibraryUnitTests - resources . sh \ " \ n " ; <nl> showEnvVarsInLog = 0 ; <nl> } ; <nl> + E63468C760D0724F18861822 / * [ CP ] Embed Pods Frameworks * / = { <nl> + isa = PBXShellScriptBuildPhase ; <nl> + buildActionMask = 2147483647 ; <nl> + files = ( <nl> + ) ; <nl> + inputPaths = ( <nl> + ) ; <nl> + name = " [ CP ] Embed Pods Frameworks " ; <nl> + outputPaths = ( <nl> + ) ; <nl> + runOnlyForDeploymentPostprocessing = 0 ; <nl> + shellPath = / bin / sh ; <nl> + shellScript = " \ " $ { SRCROOT } / Pods / Target Support Files / Pods - CoreCronetEnd2EndTests / Pods - CoreCronetEnd2EndTests - frameworks . sh \ " \ n " ; <nl> + showEnvVarsInLog = 0 ; <nl> + } ; <nl> + F58F17E425446B15028B9F74 / * [ CP ] Check Pods Manifest . lock * / = { <nl> + isa = PBXShellScriptBuildPhase ; <nl> + buildActionMask = 2147483647 ; <nl> + files = ( <nl> + ) ; <nl> + inputPaths = ( <nl> + ) ; <nl> + name = " [ CP ] Check Pods Manifest . lock " ; <nl> + outputPaths = ( <nl> + ) ; <nl> + runOnlyForDeploymentPostprocessing = 0 ; <nl> + shellPath = / bin / sh ; <nl> + shellScript = " diff \ " $ { PODS_ROOT } / . . / Podfile . lock \ " \ " $ { PODS_ROOT } / Manifest . lock \ " > / dev / null \ nif [ [ $ ? ! = 0 ] ] ; then \ n cat < < EOM \ nerror : The sandbox is not in sync with the Podfile . lock . Run ' pod install ' or update your CocoaPods installation . \ nEOM \ n exit 1 \ nfi \ n " ; <nl> + showEnvVarsInLog = 0 ; <nl> + } ; <nl> / * End PBXShellScriptBuildPhase section * / <nl> <nl> / * Begin PBXSourcesBuildPhase section * / <nl> + 5E8A5DA01D3840B4000F8BC4 / * Sources * / = { <nl> + isa = PBXSourcesBuildPhase ; <nl> + buildActionMask = 2147483647 ; <nl> + files = ( <nl> + 5E8A5DA71D3840B4000F8BC4 / * CoreCronetEnd2EndTests . m in Sources * / , <nl> + ) ; <nl> + runOnlyForDeploymentPostprocessing = 0 ; <nl> + } ; <nl> 63423F401B150A5F006CF63C / * Sources * / = { <nl> isa = PBXSourcesBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> <nl> / * End PBXSourcesBuildPhase section * / <nl> <nl> / * Begin PBXTargetDependency section * / <nl> + 5E8A5DAB1D3840B4000F8BC4 / * PBXTargetDependency * / = { <nl> + isa = PBXTargetDependency ; <nl> + target = 635697C61B14FC11007A7283 / * Tests * / ; <nl> + targetProxy = 5E8A5DAA1D3840B4000F8BC4 / * PBXContainerItemProxy * / ; <nl> + } ; <nl> 63423F4C1B150A5F006CF63C / * PBXTargetDependency * / = { <nl> isa = PBXTargetDependency ; <nl> target = 635697C61B14FC11007A7283 / * Tests * / ; <nl> <nl> / * End PBXTargetDependency section * / <nl> <nl> / * Begin XCBuildConfiguration section * / <nl> + 5E8A5DAC1D3840B4000F8BC4 / * Debug * / = { <nl> + isa = XCBuildConfiguration ; <nl> + baseConfigurationReference = 0D2284C3DF7E57F0ED504E39 / * Pods - CoreCronetEnd2EndTests . debug . xcconfig * / ; <nl> + buildSettings = { <nl> + CLANG_ANALYZER_NONNULL = YES ; <nl> + " CODE_SIGN_IDENTITY [ sdk = iphoneos * ] " = " iPhone Developer " ; <nl> + DEBUG_INFORMATION_FORMAT = dwarf ; <nl> + ENABLE_TESTABILITY = YES ; <nl> + INFOPLIST_FILE = CoreCronetEnd2EndTests / Info . plist ; <nl> + IPHONEOS_DEPLOYMENT_TARGET = 9 . 3 ; <nl> + LD_RUNPATH_SEARCH_PATHS = " $ ( inherited ) @ executable_path / Frameworks @ loader_path / Frameworks " ; <nl> + PRODUCT_BUNDLE_IDENTIFIER = io . grpc . CoreCronetEnd2EndTests ; <nl> + PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> + USER_HEADER_SEARCH_PATHS = " $ ( inherited ) \ " $ { PODS_ROOT } / . . / . . / . . / . . \ " " ; <nl> + } ; <nl> + name = Debug ; <nl> + } ; <nl> + 5E8A5DAD1D3840B4000F8BC4 / * Release * / = { <nl> + isa = XCBuildConfiguration ; <nl> + baseConfigurationReference = 4AD97096D13D7416DC91A72A / * Pods - CoreCronetEnd2EndTests . release . xcconfig * / ; <nl> + buildSettings = { <nl> + CLANG_ANALYZER_NONNULL = YES ; <nl> + " CODE_SIGN_IDENTITY [ sdk = iphoneos * ] " = " iPhone Developer " ; <nl> + INFOPLIST_FILE = CoreCronetEnd2EndTests / Info . plist ; <nl> + IPHONEOS_DEPLOYMENT_TARGET = 9 . 3 ; <nl> + LD_RUNPATH_SEARCH_PATHS = " $ ( inherited ) @ executable_path / Frameworks @ loader_path / Frameworks " ; <nl> + PRODUCT_BUNDLE_IDENTIFIER = io . grpc . CoreCronetEnd2EndTests ; <nl> + PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> + USER_HEADER_SEARCH_PATHS = " $ ( inherited ) \ " $ { PODS_ROOT } / . . / . . / . . / . . \ " " ; <nl> + } ; <nl> + name = Release ; <nl> + } ; <nl> 63423F4E1B150A5F006CF63C / * Debug * / = { <nl> isa = XCBuildConfiguration ; <nl> baseConfigurationReference = B94C27C06733CF98CE1B2757 / * Pods - AllTests . debug . xcconfig * / ; <nl> <nl> / * End XCBuildConfiguration section * / <nl> <nl> / * Begin XCConfigurationList section * / <nl> + 5E8A5DAE1D3840B4000F8BC4 / * Build configuration list for PBXNativeTarget " CoreCronetEnd2EndTests " * / = { <nl> + isa = XCConfigurationList ; <nl> + buildConfigurations = ( <nl> + 5E8A5DAC1D3840B4000F8BC4 / * Debug * / , <nl> + 5E8A5DAD1D3840B4000F8BC4 / * Release * / , <nl> + ) ; <nl> + defaultConfigurationIsVisible = 0 ; <nl> + defaultConfigurationName = Release ; <nl> + } ; <nl> 63423F4D1B150A5F006CF63C / * Build configuration list for PBXNativeTarget " AllTests " * / = { <nl> isa = XCConfigurationList ; <nl> buildConfigurations = ( <nl> new file mode 100644 <nl> index 00000000000 . . a1da2e0c97c <nl> mmm / dev / null <nl> ppp b / src / objective - c / tests / Tests . xcodeproj / xcshareddata / xcschemes / CoreCronetEnd2EndTests . xcscheme <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < Scheme <nl> + LastUpgradeVersion = " 0730 " <nl> + version = " 1 . 3 " > <nl> + < BuildAction <nl> + parallelizeBuildables = " YES " <nl> + buildImplicitDependencies = " YES " > <nl> + < BuildActionEntries > <nl> + < BuildActionEntry <nl> + buildForTesting = " YES " <nl> + buildForRunning = " YES " <nl> + buildForProfiling = " NO " <nl> + buildForArchiving = " NO " <nl> + buildForAnalyzing = " YES " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 5E8A5DA31D3840B4000F8BC4 " <nl> + BuildableName = " CoreCronetEnd2EndTests . xctest " <nl> + BlueprintName = " CoreCronetEnd2EndTests " <nl> + ReferencedContainer = " container : Tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / BuildActionEntry > <nl> + < / BuildActionEntries > <nl> + < / BuildAction > <nl> + < TestAction <nl> + buildConfiguration = " Debug " <nl> + selectedDebuggerIdentifier = " Xcode . DebuggerFoundation . Debugger . LLDB " <nl> + selectedLauncherIdentifier = " Xcode . DebuggerFoundation . Launcher . LLDB " <nl> + shouldUseLaunchSchemeArgsEnv = " YES " > <nl> + < Testables > <nl> + < TestableReference <nl> + skipped = " NO " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 5E8A5DA31D3840B4000F8BC4 " <nl> + BuildableName = " CoreCronetEnd2EndTests . xctest " <nl> + BlueprintName = " CoreCronetEnd2EndTests " <nl> + ReferencedContainer = " container : Tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / TestableReference > <nl> + < / Testables > <nl> + < MacroExpansion > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 5E8A5DA31D3840B4000F8BC4 " <nl> + BuildableName = " CoreCronetEnd2EndTests . xctest " <nl> + BlueprintName = " CoreCronetEnd2EndTests " <nl> + ReferencedContainer = " container : Tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / MacroExpansion > <nl> + < AdditionalOptions > <nl> + < / AdditionalOptions > <nl> + < / TestAction > <nl> + < LaunchAction <nl> + buildConfiguration = " Debug " <nl> + selectedDebuggerIdentifier = " Xcode . DebuggerFoundation . Debugger . LLDB " <nl> + selectedLauncherIdentifier = " Xcode . DebuggerFoundation . Launcher . LLDB " <nl> + launchStyle = " 0 " <nl> + useCustomWorkingDirectory = " NO " <nl> + ignoresPersistentStateOnLaunch = " NO " <nl> + debugDocumentVersioning = " YES " <nl> + debugServiceExtension = " internal " <nl> + allowLocationSimulation = " YES " > <nl> + < MacroExpansion > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 5E8A5DA31D3840B4000F8BC4 " <nl> + BuildableName = " CoreCronetEnd2EndTests . xctest " <nl> + BlueprintName = " CoreCronetEnd2EndTests " <nl> + ReferencedContainer = " container : Tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / MacroExpansion > <nl> + < AdditionalOptions > <nl> + < / AdditionalOptions > <nl> + < / LaunchAction > <nl> + < ProfileAction <nl> + buildConfiguration = " Release " <nl> + shouldUseLaunchSchemeArgsEnv = " YES " <nl> + savedToolIdentifier = " " <nl> + useCustomWorkingDirectory = " NO " <nl> + debugDocumentVersioning = " YES " > <nl> + < MacroExpansion > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 5E8A5DA31D3840B4000F8BC4 " <nl> + BuildableName = " CoreCronetEnd2EndTests . xctest " <nl> + BlueprintName = " CoreCronetEnd2EndTests " <nl> + ReferencedContainer = " container : Tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / MacroExpansion > <nl> + < / ProfileAction > <nl> + < AnalyzeAction <nl> + buildConfiguration = " Debug " > <nl> + < / AnalyzeAction > <nl> + < ArchiveAction <nl> + buildConfiguration = " Release " <nl> + revealArchiveInOrganizer = " YES " > <nl> + < / ArchiveAction > <nl> + < / Scheme > <nl> mmm a / src / php / composer . json <nl> ppp b / src / php / composer . json <nl> <nl> " version " : " 1 . 0 . 0 " , <nl> " require " : { <nl> " php " : " > = 5 . 5 . 0 " , <nl> - " stanley - cheung / protobuf - php " : " dev - master " , <nl> + " stanley - cheung / protobuf - php " : " v0 . 6 " , <nl> " google / auth " : " v0 . 9 " <nl> } , <nl> " autoload " : { <nl> mmm a / src / php / ext / grpc / call . c <nl> ppp b / src / php / ext / grpc / call . c <nl> <nl> <nl> zend_class_entry * grpc_ce_call ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Frees and destroys an instance of wrapped_grpc_call * / <nl> void free_wrapped_grpc_call ( void * object TSRMLS_DC ) { <nl> wrapped_grpc_call * call = ( wrapped_grpc_call * ) object ; <nl> if ( call - > owned & & call - > wrapped ! = NULL ) { <nl> grpc_call_destroy ( call - > wrapped ) ; <nl> } <nl> + zend_object_std_dtor ( & call - > std TSRMLS_CC ) ; <nl> efree ( call ) ; <nl> } <nl> <nl> bool create_metadata_array ( zval * array , grpc_metadata_array * metadata ) { <nl> return true ; <nl> } <nl> <nl> + # else <nl> + <nl> + static zend_object_handlers call_ce_handlers ; <nl> + <nl> + / * Frees and destroys an instance of wrapped_grpc_call * / <nl> + static void free_wrapped_grpc_call ( zend_object * object ) { <nl> + wrapped_grpc_call * call = wrapped_grpc_call_from_obj ( object ) ; <nl> + if ( call - > owned & & call - > wrapped ! = NULL ) { <nl> + grpc_call_destroy ( call - > wrapped ) ; <nl> + } <nl> + zend_object_std_dtor ( & call - > std ) ; <nl> + } <nl> + <nl> + / * Initializes an instance of wrapped_grpc_call to be associated with an <nl> + * object of a class specified by class_type * / <nl> + zend_object * create_wrapped_grpc_call ( zend_class_entry * class_type ) { <nl> + wrapped_grpc_call * intern ; <nl> + intern = ecalloc ( 1 , sizeof ( wrapped_grpc_call ) + <nl> + zend_object_properties_size ( class_type ) ) ; <nl> + zend_object_std_init ( & intern - > std , class_type ) ; <nl> + object_properties_init ( & intern - > std , class_type ) ; <nl> + intern - > std . handlers = & call_ce_handlers ; <nl> + return & intern - > std ; <nl> + } <nl> + <nl> + / * Wraps a grpc_call struct in a PHP object . Owned indicates whether the <nl> + struct should be destroyed at the end of the object ' s lifecycle * / <nl> + void grpc_php_wrap_call ( grpc_call * wrapped , bool owned , zval * call_object ) { <nl> + object_init_ex ( call_object , grpc_ce_call ) ; <nl> + wrapped_grpc_call * call = Z_WRAPPED_GRPC_CALL_P ( call_object ) ; <nl> + call - > wrapped = wrapped ; <nl> + call - > owned = owned ; <nl> + } <nl> + <nl> + / * Creates and returns a PHP array object with the data in a <nl> + * grpc_metadata_array . Returns NULL on failure * / <nl> + void grpc_parse_metadata_array ( grpc_metadata_array * metadata_array , <nl> + zval * array ) { <nl> + int count = metadata_array - > count ; <nl> + grpc_metadata * elements = metadata_array - > metadata ; <nl> + int i ; <nl> + zval * data ; <nl> + HashTable * array_hash ; <nl> + zval inner_array ; <nl> + char * str_key ; <nl> + char * str_val ; <nl> + size_t key_len ; <nl> + <nl> + array_init ( array ) ; <nl> + array_hash = HASH_OF ( array ) ; <nl> + grpc_metadata * elem ; <nl> + for ( i = 0 ; i < count ; i + + ) { <nl> + elem = & elements [ i ] ; <nl> + key_len = strlen ( elem - > key ) ; <nl> + str_key = ecalloc ( key_len + 1 , sizeof ( char ) ) ; <nl> + memcpy ( str_key , elem - > key , key_len ) ; <nl> + str_val = ecalloc ( elem - > value_length + 1 , sizeof ( char ) ) ; <nl> + memcpy ( str_val , elem - > value , elem - > value_length ) ; <nl> + if ( ( data = zend_hash_str_find ( array_hash , str_key , key_len ) ) ! = NULL ) { <nl> + if ( Z_TYPE_P ( data ) ! = IS_ARRAY ) { <nl> + zend_throw_exception ( zend_exception_get_default ( ) , <nl> + " Metadata hash somehow contains wrong types . " , <nl> + 1 ) ; <nl> + efree ( str_key ) ; <nl> + efree ( str_val ) ; <nl> + return ; <nl> + } <nl> + add_next_index_stringl ( data , str_val , elem - > value_length ) ; <nl> + } else { <nl> + array_init ( & inner_array ) ; <nl> + add_next_index_stringl ( & inner_array , str_val , elem - > value_length ) ; <nl> + add_assoc_zval ( array , str_key , & inner_array ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / * Populates a grpc_metadata_array with the data in a PHP array object . <nl> + Returns true on success and false on failure * / <nl> + bool create_metadata_array ( zval * array , grpc_metadata_array * metadata ) { <nl> + zval * inner_array ; <nl> + zval * value ; <nl> + HashTable * array_hash ; <nl> + HashTable * inner_array_hash ; <nl> + zend_string * key ; <nl> + if ( Z_TYPE_P ( array ) ! = IS_ARRAY ) { <nl> + return false ; <nl> + } <nl> + grpc_metadata_array_init ( metadata ) ; <nl> + array_hash = HASH_OF ( array ) ; <nl> + <nl> + ZEND_HASH_FOREACH_STR_KEY_VAL ( array_hash , key , inner_array ) { <nl> + if ( key = = NULL ) { <nl> + return false ; <nl> + } <nl> + if ( Z_TYPE_P ( inner_array ) ! = IS_ARRAY ) { <nl> + return false ; <nl> + } <nl> + inner_array_hash = HASH_OF ( inner_array ) ; <nl> + metadata - > capacity + = zend_hash_num_elements ( inner_array_hash ) ; <nl> + } <nl> + ZEND_HASH_FOREACH_END ( ) ; <nl> + <nl> + metadata - > metadata = gpr_malloc ( metadata - > capacity * sizeof ( grpc_metadata ) ) ; <nl> + <nl> + ZEND_HASH_FOREACH_STR_KEY_VAL ( array_hash , key , inner_array ) { <nl> + if ( key = = NULL ) { <nl> + return false ; <nl> + } <nl> + inner_array_hash = HASH_OF ( inner_array ) ; <nl> + <nl> + ZEND_HASH_FOREACH_VAL ( inner_array_hash , value ) { <nl> + if ( Z_TYPE_P ( value ) ! = IS_STRING ) { <nl> + return false ; <nl> + } <nl> + metadata - > metadata [ metadata - > count ] . key = ZSTR_VAL ( key ) ; <nl> + metadata - > metadata [ metadata - > count ] . value = Z_STRVAL_P ( value ) ; <nl> + metadata - > metadata [ metadata - > count ] . value_length = Z_STRLEN_P ( value ) ; <nl> + metadata - > count + = 1 ; <nl> + } ZEND_HASH_FOREACH_END ( ) ; <nl> + } ZEND_HASH_FOREACH_END ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> / * * <nl> * Constructs a new instance of the Call class . <nl> * @ param Channel $ channel The channel to associate the call with . Must not be <nl> bool create_metadata_array ( zval * array , grpc_metadata_array * metadata ) { <nl> * @ param Timeval $ absolute_deadline The deadline for completing the call <nl> * / <nl> PHP_METHOD ( Call , __construct ) { <nl> - wrapped_grpc_call * call = <nl> - ( wrapped_grpc_call * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> zval * channel_obj ; <nl> char * method ; <nl> - int method_len ; <nl> zval * deadline_obj ; <nl> char * host_override = NULL ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + int method_len ; <nl> int host_override_len = 0 ; <nl> + wrapped_grpc_call * call = <nl> + ( wrapped_grpc_call * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + size_t method_len ; <nl> + size_t host_override_len = 0 ; <nl> + wrapped_grpc_call * call = Z_WRAPPED_GRPC_CALL_P ( getThis ( ) ) ; <nl> + # endif <nl> + <nl> / * " OsO | s " = = 1 Object , 1 string , 1 Object , 1 optional string * / <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " OsO | s " , <nl> - & channel_obj , grpc_ce_channel , <nl> - & method , & method_len , <nl> - & deadline_obj , grpc_ce_timeval , <nl> - & host_override , & host_override_len ) <nl> - = = FAILURE ) { <nl> - zend_throw_exception ( <nl> - spl_ce_InvalidArgumentException , <nl> - " Call expects a Channel , a String , a Timeval and an optional String " , <nl> - 1 TSRMLS_CC ) ; <nl> + if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " OsO | s " , & channel_obj , <nl> + grpc_ce_channel , & method , & method_len , <nl> + & deadline_obj , grpc_ce_timeval , & host_override , <nl> + & host_override_len ) = = FAILURE ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Call expects a Channel , a String , a Timeval and " <nl> + " an optional String " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_channel * channel = <nl> ( wrapped_grpc_channel * ) zend_object_store_get_object ( <nl> channel_obj TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_channel * channel = Z_WRAPPED_GRPC_CHANNEL_P ( channel_obj ) ; <nl> + # endif <nl> if ( channel - > wrapped = = NULL ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> " Call cannot be constructed from a closed Channel " , <nl> PHP_METHOD ( Call , __construct ) { <nl> return ; <nl> } <nl> add_property_zval ( getThis ( ) , " channel " , channel_obj ) ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * deadline = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( <nl> deadline_obj TSRMLS_CC ) ; <nl> - call - > wrapped = grpc_channel_create_call ( <nl> - channel - > wrapped , NULL , GRPC_PROPAGATE_DEFAULTS , completion_queue , method , <nl> - host_override , deadline - > wrapped , NULL ) ; <nl> + # else <nl> + wrapped_grpc_timeval * deadline = Z_WRAPPED_GRPC_TIMEVAL_P ( deadline_obj ) ; <nl> + # endif <nl> + call - > wrapped = <nl> + grpc_channel_create_call ( channel - > wrapped , NULL , GRPC_PROPAGATE_DEFAULTS , <nl> + completion_queue , method , host_override , <nl> + deadline - > wrapped , NULL ) ; <nl> call - > owned = true ; <nl> } <nl> <nl> PHP_METHOD ( Call , __construct ) { <nl> * @ return object Object with results of all actions <nl> * / <nl> PHP_METHOD ( Call , startBatch ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_call * call = <nl> ( wrapped_grpc_call * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> - grpc_op ops [ 8 ] ; <nl> - size_t op_num = 0 ; <nl> - zval * array ; <nl> zval * * value ; <nl> zval * * inner_value ; <nl> - HashTable * array_hash ; <nl> HashPosition array_pointer ; <nl> - HashTable * status_hash ; <nl> - HashTable * message_hash ; <nl> zval * * message_value ; <nl> zval * * message_flags ; <nl> char * key ; <nl> uint key_len ; <nl> ulong index ; <nl> + zval * result ; <nl> + zval * recv_status ; <nl> + MAKE_STD_ZVAL ( result ) ; <nl> + object_init ( result ) ; <nl> + # else <nl> + wrapped_grpc_call * call = Z_WRAPPED_GRPC_CALL_P ( getThis ( ) ) ; <nl> + zval * value ; <nl> + zval * inner_value ; <nl> + zval * message_value ; <nl> + zval * message_flags ; <nl> + zend_string * key ; <nl> + zend_ulong index ; <nl> + zval recv_status ; <nl> + object_init ( return_value ) ; <nl> + # endif <nl> + <nl> + grpc_op ops [ 8 ] ; <nl> + size_t op_num = 0 ; <nl> + zval * array ; <nl> + HashTable * array_hash ; <nl> + HashTable * status_hash ; <nl> + HashTable * message_hash ; <nl> + <nl> grpc_metadata_array metadata ; <nl> grpc_metadata_array trailing_metadata ; <nl> grpc_metadata_array recv_metadata ; <nl> PHP_METHOD ( Call , startBatch ) { <nl> grpc_byte_buffer * message ; <nl> int cancelled ; <nl> grpc_call_error error ; <nl> - zval * result ; <nl> char * message_str ; <nl> size_t message_len ; <nl> - zval * recv_status ; <nl> + <nl> + <nl> grpc_metadata_array_init ( & metadata ) ; <nl> grpc_metadata_array_init ( & trailing_metadata ) ; <nl> grpc_metadata_array_init ( & recv_metadata ) ; <nl> grpc_metadata_array_init ( & recv_trailing_metadata ) ; <nl> - MAKE_STD_ZVAL ( result ) ; <nl> - object_init ( result ) ; <nl> memset ( ops , 0 , sizeof ( ops ) ) ; <nl> + <nl> / * " a " = = 1 array * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " a " , & array ) = = <nl> FAILURE ) { <nl> PHP_METHOD ( Call , startBatch ) { <nl> " start_batch expects an array " , 1 TSRMLS_CC ) ; <nl> goto cleanup ; <nl> } <nl> + <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> array_hash = Z_ARRVAL_P ( array ) ; <nl> for ( zend_hash_internal_pointer_reset_ex ( array_hash , & array_pointer ) ; <nl> zend_hash_get_current_data_ex ( array_hash , ( void * * ) & value , <nl> PHP_METHOD ( Call , startBatch ) { <nl> goto cleanup ; <nl> } <nl> switch ( index ) { <nl> - case GRPC_OP_SEND_INITIAL_METADATA : <nl> - if ( ! create_metadata_array ( * value , & metadata ) ) { <nl> + case GRPC_OP_SEND_INITIAL_METADATA : <nl> + if ( ! create_metadata_array ( * value , & metadata ) ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Bad metadata value given " , 1 TSRMLS_CC ) ; <nl> + goto cleanup ; <nl> + } <nl> + ops [ op_num ] . data . send_initial_metadata . count = <nl> + metadata . count ; <nl> + ops [ op_num ] . data . send_initial_metadata . metadata = <nl> + metadata . metadata ; <nl> + break ; <nl> + case GRPC_OP_SEND_MESSAGE : <nl> + if ( Z_TYPE_PP ( value ) ! = IS_ARRAY ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Expected an array for send message " , <nl> + 1 TSRMLS_CC ) ; <nl> + goto cleanup ; <nl> + } <nl> + message_hash = Z_ARRVAL_PP ( value ) ; <nl> + if ( zend_hash_find ( message_hash , " flags " , sizeof ( " flags " ) , <nl> + ( void * * ) & message_flags ) = = SUCCESS ) { <nl> + if ( Z_TYPE_PP ( message_flags ) ! = IS_LONG ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Bad metadata value given " , 1 TSRMLS_CC ) ; <nl> - goto cleanup ; <nl> + " Expected an int for message flags " , <nl> + 1 TSRMLS_CC ) ; <nl> } <nl> - ops [ op_num ] . data . send_initial_metadata . count = <nl> - metadata . count ; <nl> - ops [ op_num ] . data . send_initial_metadata . metadata = <nl> - metadata . metadata ; <nl> - break ; <nl> - case GRPC_OP_SEND_MESSAGE : <nl> - if ( Z_TYPE_PP ( value ) ! = IS_ARRAY ) { <nl> + ops [ op_num ] . flags = Z_LVAL_PP ( message_flags ) & GRPC_WRITE_USED_MASK ; <nl> + } <nl> + if ( zend_hash_find ( message_hash , " message " , sizeof ( " message " ) , <nl> + ( void * * ) & message_value ) ! = SUCCESS | | <nl> + Z_TYPE_PP ( message_value ) ! = IS_STRING ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Expected a string for send message " , <nl> + 1 TSRMLS_CC ) ; <nl> + goto cleanup ; <nl> + } <nl> + ops [ op_num ] . data . send_message = <nl> + string_to_byte_buffer ( Z_STRVAL_PP ( message_value ) , <nl> + Z_STRLEN_PP ( message_value ) ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_CLOSE_FROM_CLIENT : <nl> + break ; <nl> + case GRPC_OP_SEND_STATUS_FROM_SERVER : <nl> + status_hash = Z_ARRVAL_PP ( value ) ; <nl> + if ( zend_hash_find ( status_hash , " metadata " , sizeof ( " metadata " ) , <nl> + ( void * * ) & inner_value ) = = SUCCESS ) { <nl> + if ( ! create_metadata_array ( * inner_value , & trailing_metadata ) ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Expected an array for send message " , <nl> + " Bad trailing metadata value given " , <nl> 1 TSRMLS_CC ) ; <nl> goto cleanup ; <nl> } <nl> - message_hash = Z_ARRVAL_PP ( value ) ; <nl> - if ( zend_hash_find ( message_hash , " flags " , sizeof ( " flags " ) , <nl> - ( void * * ) & message_flags ) = = SUCCESS ) { <nl> - if ( Z_TYPE_PP ( message_flags ) ! = IS_LONG ) { <nl> - zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Expected an int for message flags " , <nl> - 1 TSRMLS_CC ) ; <nl> - } <nl> - ops [ op_num ] . flags = Z_LVAL_PP ( message_flags ) & GRPC_WRITE_USED_MASK ; <nl> + ops [ op_num ] . data . send_status_from_server . trailing_metadata = <nl> + trailing_metadata . metadata ; <nl> + ops [ op_num ] . data . send_status_from_server . trailing_metadata_count = <nl> + trailing_metadata . count ; <nl> + } <nl> + if ( zend_hash_find ( status_hash , " code " , sizeof ( " code " ) , <nl> + ( void * * ) & inner_value ) = = SUCCESS ) { <nl> + if ( Z_TYPE_PP ( inner_value ) ! = IS_LONG ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Status code must be an integer " , <nl> + 1 TSRMLS_CC ) ; <nl> + goto cleanup ; <nl> } <nl> - if ( zend_hash_find ( message_hash , " message " , sizeof ( " message " ) , <nl> - ( void * * ) & message_value ) ! = SUCCESS | | <nl> - Z_TYPE_PP ( message_value ) ! = IS_STRING ) { <nl> + ops [ op_num ] . data . send_status_from_server . status = <nl> + Z_LVAL_PP ( inner_value ) ; <nl> + } else { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Integer status code is required " , <nl> + 1 TSRMLS_CC ) ; <nl> + goto cleanup ; <nl> + } <nl> + if ( zend_hash_find ( status_hash , " details " , sizeof ( " details " ) , <nl> + ( void * * ) & inner_value ) = = SUCCESS ) { <nl> + if ( Z_TYPE_PP ( inner_value ) ! = IS_STRING ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Expected a string for send message " , <nl> + " Status details must be a string " , <nl> 1 TSRMLS_CC ) ; <nl> goto cleanup ; <nl> } <nl> - ops [ op_num ] . data . send_message = <nl> - string_to_byte_buffer ( Z_STRVAL_PP ( message_value ) , <nl> - Z_STRLEN_PP ( message_value ) ) ; <nl> - break ; <nl> - case GRPC_OP_SEND_CLOSE_FROM_CLIENT : <nl> - break ; <nl> - case GRPC_OP_SEND_STATUS_FROM_SERVER : <nl> - status_hash = Z_ARRVAL_PP ( value ) ; <nl> - if ( zend_hash_find ( status_hash , " metadata " , sizeof ( " metadata " ) , <nl> - ( void * * ) & inner_value ) = = SUCCESS ) { <nl> - if ( ! create_metadata_array ( * inner_value , & trailing_metadata ) ) { <nl> - zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Bad trailing metadata value given " , <nl> - 1 TSRMLS_CC ) ; <nl> - goto cleanup ; <nl> - } <nl> - ops [ op_num ] . data . send_status_from_server . trailing_metadata = <nl> - trailing_metadata . metadata ; <nl> - ops [ op_num ] . data . send_status_from_server . trailing_metadata_count = <nl> - trailing_metadata . count ; <nl> + ops [ op_num ] . data . send_status_from_server . status_details = <nl> + Z_STRVAL_PP ( inner_value ) ; <nl> + } else { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " String status details is required " , <nl> + 1 TSRMLS_CC ) ; <nl> + goto cleanup ; <nl> + } <nl> + break ; <nl> + case GRPC_OP_RECV_INITIAL_METADATA : <nl> + ops [ op_num ] . data . recv_initial_metadata = & recv_metadata ; <nl> + break ; <nl> + case GRPC_OP_RECV_MESSAGE : <nl> + ops [ op_num ] . data . recv_message = & message ; <nl> + break ; <nl> + case GRPC_OP_RECV_STATUS_ON_CLIENT : <nl> + ops [ op_num ] . data . recv_status_on_client . trailing_metadata = <nl> + & recv_trailing_metadata ; <nl> + ops [ op_num ] . data . recv_status_on_client . status = & status ; <nl> + ops [ op_num ] . data . recv_status_on_client . status_details = <nl> + & status_details ; <nl> + ops [ op_num ] . data . recv_status_on_client . status_details_capacity = <nl> + & status_details_capacity ; <nl> + break ; <nl> + case GRPC_OP_RECV_CLOSE_ON_SERVER : <nl> + ops [ op_num ] . data . recv_close_on_server . cancelled = & cancelled ; <nl> + break ; <nl> + default : <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Unrecognized key in batch " , 1 TSRMLS_CC ) ; <nl> + goto cleanup ; <nl> + } <nl> + ops [ op_num ] . op = ( grpc_op_type ) index ; <nl> + ops [ op_num ] . flags = 0 ; <nl> + ops [ op_num ] . reserved = NULL ; <nl> + op_num + + ; <nl> + } <nl> + <nl> + # else <nl> + <nl> + array_hash = HASH_OF ( array ) ; <nl> + ZEND_HASH_FOREACH_KEY_VAL ( array_hash , index , key , value ) { <nl> + if ( key ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " batch keys must be integers " , 1 ) ; <nl> + goto cleanup ; <nl> + } <nl> + <nl> + switch ( index ) { <nl> + case GRPC_OP_SEND_INITIAL_METADATA : <nl> + if ( ! create_metadata_array ( value , & metadata ) ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Bad metadata value given " , 1 ) ; <nl> + goto cleanup ; <nl> + } <nl> + ops [ op_num ] . data . send_initial_metadata . count = metadata . count ; <nl> + ops [ op_num ] . data . send_initial_metadata . metadata = metadata . metadata ; <nl> + break ; <nl> + case GRPC_OP_SEND_MESSAGE : <nl> + if ( Z_TYPE_P ( value ) ! = IS_ARRAY ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Expected an array for send message " , 1 ) ; <nl> + goto cleanup ; <nl> + } <nl> + message_hash = HASH_OF ( value ) ; <nl> + if ( ( message_flags = <nl> + zend_hash_str_find ( message_hash , " flags " , <nl> + sizeof ( " flags " ) - 1 ) ) ! = NULL ) { <nl> + if ( Z_TYPE_P ( message_flags ) ! = IS_LONG ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Expected an int for message flags " , 1 ) ; <nl> + } <nl> + ops [ op_num ] . flags = Z_LVAL_P ( message_flags ) & GRPC_WRITE_USED_MASK ; <nl> + } <nl> + if ( ( message_value = zend_hash_str_find ( message_hash , " message " , <nl> + sizeof ( " message " ) - 1 ) ) <nl> + = = NULL | | Z_TYPE_P ( message_value ) ! = IS_STRING ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Expected a string for send message " , 1 ) ; <nl> + goto cleanup ; <nl> + } <nl> + ops [ op_num ] . data . send_message = <nl> + string_to_byte_buffer ( Z_STRVAL_P ( message_value ) , <nl> + Z_STRLEN_P ( message_value ) ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_CLOSE_FROM_CLIENT : <nl> + break ; <nl> + case GRPC_OP_SEND_STATUS_FROM_SERVER : <nl> + status_hash = HASH_OF ( value ) ; <nl> + if ( ( inner_value = zend_hash_str_find ( status_hash , " metadata " , <nl> + sizeof ( " metadata " ) - 1 ) ) <nl> + ! = NULL ) { <nl> + if ( ! create_metadata_array ( inner_value , & trailing_metadata ) ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Bad trailing metadata value given " , 1 ) ; <nl> + goto cleanup ; <nl> } <nl> - if ( zend_hash_find ( status_hash , " code " , sizeof ( " code " ) , <nl> - ( void * * ) & inner_value ) = = SUCCESS ) { <nl> - if ( Z_TYPE_PP ( inner_value ) ! = IS_LONG ) { <nl> - zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Status code must be an integer " , <nl> - 1 TSRMLS_CC ) ; <nl> - goto cleanup ; <nl> - } <nl> - ops [ op_num ] . data . send_status_from_server . status = <nl> - Z_LVAL_PP ( inner_value ) ; <nl> - } else { <nl> + ops [ op_num ] . data . send_status_from_server . trailing_metadata = <nl> + trailing_metadata . metadata ; <nl> + ops [ op_num ] . data . send_status_from_server . trailing_metadata_count = <nl> + trailing_metadata . count ; <nl> + } <nl> + if ( ( inner_value = zend_hash_str_find ( status_hash , " code " , <nl> + sizeof ( " code " ) - 1 ) ) ! = NULL ) { <nl> + if ( Z_TYPE_P ( inner_value ) ! = IS_LONG ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Integer status code is required " , <nl> - 1 TSRMLS_CC ) ; <nl> + " Status code must be an integer " , 1 ) ; <nl> goto cleanup ; <nl> } <nl> - if ( zend_hash_find ( status_hash , " details " , sizeof ( " details " ) , <nl> - ( void * * ) & inner_value ) = = SUCCESS ) { <nl> - if ( Z_TYPE_PP ( inner_value ) ! = IS_STRING ) { <nl> - zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Status details must be a string " , <nl> - 1 TSRMLS_CC ) ; <nl> - goto cleanup ; <nl> - } <nl> - ops [ op_num ] . data . send_status_from_server . status_details = <nl> - Z_STRVAL_PP ( inner_value ) ; <nl> - } else { <nl> + ops [ op_num ] . data . send_status_from_server . status = <nl> + Z_LVAL_P ( inner_value ) ; <nl> + } else { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Integer status code is required " , 1 ) ; <nl> + goto cleanup ; <nl> + } <nl> + if ( ( inner_value = zend_hash_str_find ( status_hash , " details " , <nl> + sizeof ( " details " ) - 1 ) ) ! = NULL ) { <nl> + if ( Z_TYPE_P ( inner_value ) ! = IS_STRING ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " String status details is required " , <nl> - 1 TSRMLS_CC ) ; <nl> + " Status details must be a string " , 1 ) ; <nl> goto cleanup ; <nl> } <nl> - break ; <nl> - case GRPC_OP_RECV_INITIAL_METADATA : <nl> - ops [ op_num ] . data . recv_initial_metadata = & recv_metadata ; <nl> - break ; <nl> - case GRPC_OP_RECV_MESSAGE : <nl> - ops [ op_num ] . data . recv_message = & message ; <nl> - break ; <nl> - case GRPC_OP_RECV_STATUS_ON_CLIENT : <nl> - ops [ op_num ] . data . recv_status_on_client . trailing_metadata = <nl> - & recv_trailing_metadata ; <nl> - ops [ op_num ] . data . recv_status_on_client . status = & status ; <nl> - ops [ op_num ] . data . recv_status_on_client . status_details = <nl> - & status_details ; <nl> - ops [ op_num ] . data . recv_status_on_client . status_details_capacity = <nl> - & status_details_capacity ; <nl> - break ; <nl> - case GRPC_OP_RECV_CLOSE_ON_SERVER : <nl> - ops [ op_num ] . data . recv_close_on_server . cancelled = & cancelled ; <nl> - break ; <nl> - default : <nl> + ops [ op_num ] . data . send_status_from_server . status_details = <nl> + Z_STRVAL_P ( inner_value ) ; <nl> + } else { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " Unrecognized key in batch " , 1 TSRMLS_CC ) ; <nl> + " String status details is required " , 1 ) ; <nl> goto cleanup ; <nl> + } <nl> + break ; <nl> + case GRPC_OP_RECV_INITIAL_METADATA : <nl> + ops [ op_num ] . data . recv_initial_metadata = & recv_metadata ; <nl> + break ; <nl> + case GRPC_OP_RECV_MESSAGE : <nl> + ops [ op_num ] . data . recv_message = & message ; <nl> + break ; <nl> + case GRPC_OP_RECV_STATUS_ON_CLIENT : <nl> + ops [ op_num ] . data . recv_status_on_client . trailing_metadata = <nl> + & recv_trailing_metadata ; <nl> + ops [ op_num ] . data . recv_status_on_client . status = & status ; <nl> + ops [ op_num ] . data . recv_status_on_client . status_details = <nl> + & status_details ; <nl> + ops [ op_num ] . data . recv_status_on_client . status_details_capacity = <nl> + & status_details_capacity ; <nl> + break ; <nl> + case GRPC_OP_RECV_CLOSE_ON_SERVER : <nl> + ops [ op_num ] . data . recv_close_on_server . cancelled = & cancelled ; <nl> + break ; <nl> + default : <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " Unrecognized key in batch " , 1 ) ; <nl> + goto cleanup ; <nl> } <nl> ops [ op_num ] . op = ( grpc_op_type ) index ; <nl> ops [ op_num ] . flags = 0 ; <nl> ops [ op_num ] . reserved = NULL ; <nl> op_num + + ; <nl> } <nl> + ZEND_HASH_FOREACH_END ( ) ; <nl> + <nl> + # endif <nl> + <nl> error = grpc_call_start_batch ( call - > wrapped , ops , op_num , call - > wrapped , <nl> NULL ) ; <nl> if ( error ! = GRPC_CALL_OK ) { <nl> PHP_METHOD ( Call , startBatch ) { <nl> } <nl> grpc_completion_queue_pluck ( completion_queue , call - > wrapped , <nl> gpr_inf_future ( GPR_CLOCK_REALTIME ) , NULL ) ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> for ( int i = 0 ; i < op_num ; i + + ) { <nl> switch ( ops [ i ] . op ) { <nl> - case GRPC_OP_SEND_INITIAL_METADATA : <nl> - add_property_bool ( result , " send_metadata " , true ) ; <nl> - break ; <nl> - case GRPC_OP_SEND_MESSAGE : <nl> - add_property_bool ( result , " send_message " , true ) ; <nl> - break ; <nl> - case GRPC_OP_SEND_CLOSE_FROM_CLIENT : <nl> - add_property_bool ( result , " send_close " , true ) ; <nl> - break ; <nl> - case GRPC_OP_SEND_STATUS_FROM_SERVER : <nl> - add_property_bool ( result , " send_status " , true ) ; <nl> - break ; <nl> - case GRPC_OP_RECV_INITIAL_METADATA : <nl> - array = grpc_parse_metadata_array ( & recv_metadata TSRMLS_CC ) ; <nl> - add_property_zval ( result , " metadata " , array ) ; <nl> - Z_DELREF_P ( array ) ; <nl> - break ; <nl> - case GRPC_OP_RECV_MESSAGE : <nl> - byte_buffer_to_string ( message , & message_str , & message_len ) ; <nl> - if ( message_str = = NULL ) { <nl> - add_property_null ( result , " message " ) ; <nl> - } else { <nl> - add_property_stringl ( result , " message " , message_str , message_len , <nl> - false ) ; <nl> - } <nl> - break ; <nl> - case GRPC_OP_RECV_STATUS_ON_CLIENT : <nl> - MAKE_STD_ZVAL ( recv_status ) ; <nl> - object_init ( recv_status ) ; <nl> - array = grpc_parse_metadata_array ( & recv_trailing_metadata TSRMLS_CC ) ; <nl> - add_property_zval ( recv_status , " metadata " , array ) ; <nl> - Z_DELREF_P ( array ) ; <nl> - add_property_long ( recv_status , " code " , status ) ; <nl> - add_property_string ( recv_status , " details " , status_details , true ) ; <nl> - add_property_zval ( result , " status " , recv_status ) ; <nl> - Z_DELREF_P ( recv_status ) ; <nl> - break ; <nl> - case GRPC_OP_RECV_CLOSE_ON_SERVER : <nl> - add_property_bool ( result , " cancelled " , cancelled ) ; <nl> - break ; <nl> - default : <nl> - break ; <nl> + case GRPC_OP_SEND_INITIAL_METADATA : <nl> + add_property_bool ( result , " send_metadata " , true ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_MESSAGE : <nl> + add_property_bool ( result , " send_message " , true ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_CLOSE_FROM_CLIENT : <nl> + add_property_bool ( result , " send_close " , true ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_STATUS_FROM_SERVER : <nl> + add_property_bool ( result , " send_status " , true ) ; <nl> + break ; <nl> + case GRPC_OP_RECV_INITIAL_METADATA : <nl> + array = grpc_parse_metadata_array ( & recv_metadata TSRMLS_CC ) ; <nl> + add_property_zval ( result , " metadata " , array ) ; <nl> + Z_DELREF_P ( array ) ; <nl> + break ; <nl> + case GRPC_OP_RECV_MESSAGE : <nl> + byte_buffer_to_string ( message , & message_str , & message_len ) ; <nl> + if ( message_str = = NULL ) { <nl> + add_property_null ( result , " message " ) ; <nl> + } else { <nl> + add_property_stringl ( result , " message " , message_str , message_len , <nl> + false ) ; <nl> + } <nl> + break ; <nl> + case GRPC_OP_RECV_STATUS_ON_CLIENT : <nl> + MAKE_STD_ZVAL ( recv_status ) ; <nl> + object_init ( recv_status ) ; <nl> + array = grpc_parse_metadata_array ( & recv_trailing_metadata TSRMLS_CC ) ; <nl> + add_property_zval ( recv_status , " metadata " , array ) ; <nl> + Z_DELREF_P ( array ) ; <nl> + add_property_long ( recv_status , " code " , status ) ; <nl> + add_property_string ( recv_status , " details " , status_details , true ) ; <nl> + add_property_zval ( result , " status " , recv_status ) ; <nl> + Z_DELREF_P ( recv_status ) ; <nl> + break ; <nl> + case GRPC_OP_RECV_CLOSE_ON_SERVER : <nl> + add_property_bool ( result , " cancelled " , cancelled ) ; <nl> + break ; <nl> + default : <nl> + break ; <nl> + } <nl> + } <nl> + # else <nl> + for ( int i = 0 ; i < op_num ; i + + ) { <nl> + switch ( ops [ i ] . op ) { <nl> + case GRPC_OP_SEND_INITIAL_METADATA : <nl> + add_property_bool ( return_value , " send_metadata " , true ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_MESSAGE : <nl> + add_property_bool ( return_value , " send_message " , true ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_CLOSE_FROM_CLIENT : <nl> + add_property_bool ( return_value , " send_close " , true ) ; <nl> + break ; <nl> + case GRPC_OP_SEND_STATUS_FROM_SERVER : <nl> + add_property_bool ( return_value , " send_status " , true ) ; <nl> + break ; <nl> + case GRPC_OP_RECV_INITIAL_METADATA : <nl> + grpc_parse_metadata_array ( & recv_metadata , array ) ; <nl> + add_property_zval ( return_value , " metadata " , array ) ; <nl> + break ; <nl> + case GRPC_OP_RECV_MESSAGE : <nl> + byte_buffer_to_string ( message , & message_str , & message_len ) ; <nl> + if ( message_str = = NULL ) { <nl> + add_property_null ( return_value , " message " ) ; <nl> + } else { <nl> + add_property_stringl ( return_value , " message " , message_str , <nl> + message_len ) ; <nl> + } <nl> + break ; <nl> + case GRPC_OP_RECV_STATUS_ON_CLIENT : <nl> + object_init ( & recv_status ) ; <nl> + grpc_parse_metadata_array ( & recv_trailing_metadata , array ) ; <nl> + add_property_zval ( & recv_status , " metadata " , array ) ; <nl> + add_property_long ( & recv_status , " code " , status ) ; <nl> + add_property_string ( & recv_status , " details " , status_details ) ; <nl> + add_property_zval ( return_value , " status " , & recv_status ) ; <nl> + break ; <nl> + case GRPC_OP_RECV_CLOSE_ON_SERVER : <nl> + add_property_bool ( return_value , " cancelled " , cancelled ) ; <nl> + break ; <nl> + default : <nl> + break ; <nl> } <nl> } <nl> + # endif <nl> + <nl> cleanup : <nl> grpc_metadata_array_destroy ( & metadata ) ; <nl> grpc_metadata_array_destroy ( & trailing_metadata ) ; <nl> PHP_METHOD ( Call , startBatch ) { <nl> grpc_byte_buffer_destroy ( message ) ; <nl> } <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> RETURN_DESTROY_ZVAL ( result ) ; <nl> + # else <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Call , startBatch ) { <nl> * @ return string The URI of the endpoint <nl> * / <nl> PHP_METHOD ( Call , getPeer ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_call * call = <nl> ( wrapped_grpc_call * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> RETURN_STRING ( grpc_call_get_peer ( call - > wrapped ) , 1 ) ; <nl> + # else <nl> + wrapped_grpc_call * call = Z_WRAPPED_GRPC_CALL_P ( getThis ( ) ) ; <nl> + RETURN_STRING ( grpc_call_get_peer ( call - > wrapped ) ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Call , getPeer ) { <nl> * has not already ended with another status . <nl> * / <nl> PHP_METHOD ( Call , cancel ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_call * call = <nl> ( wrapped_grpc_call * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_call * call = Z_WRAPPED_GRPC_CALL_P ( getThis ( ) ) ; <nl> + # endif <nl> grpc_call_cancel ( call - > wrapped , NULL ) ; <nl> } <nl> <nl> PHP_METHOD ( Call , setCredentials ) { <nl> return ; <nl> } <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_call_credentials * creds = <nl> ( wrapped_grpc_call_credentials * ) zend_object_store_get_object ( <nl> creds_obj TSRMLS_CC ) ; <nl> - <nl> wrapped_grpc_call * call = <nl> ( wrapped_grpc_call * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_call_credentials * creds = <nl> + Z_WRAPPED_GRPC_CALL_CREDS_P ( creds_obj ) ; <nl> + wrapped_grpc_call * call = Z_WRAPPED_GRPC_CALL_P ( getThis ( ) ) ; <nl> + # endif <nl> <nl> grpc_call_error error = GRPC_CALL_ERROR ; <nl> error = grpc_call_set_credentials ( call - > wrapped , creds - > wrapped ) ; <nl> PHP_METHOD ( Call , setCredentials ) { <nl> } <nl> <nl> static zend_function_entry call_methods [ ] = { <nl> - PHP_ME ( Call , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> - PHP_ME ( Call , startBatch , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Call , getPeer , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Call , cancel , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Call , setCredentials , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_FE_END } ; <nl> + PHP_ME ( Call , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> + PHP_ME ( Call , startBatch , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Call , getPeer , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Call , cancel , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Call , setCredentials , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_FE_END <nl> + } ; <nl> <nl> void grpc_init_call ( TSRMLS_D ) { <nl> zend_class_entry ce ; <nl> INIT_CLASS_ENTRY ( ce , " Grpc \ \ Call " , call_methods ) ; <nl> ce . create_object = create_wrapped_grpc_call ; <nl> grpc_ce_call = zend_register_internal_class ( & ce TSRMLS_CC ) ; <nl> + # if PHP_MAJOR_VERSION > = 7 <nl> + memcpy ( & call_ce_handlers , zend_get_std_object_handlers ( ) , <nl> + sizeof ( zend_object_handlers ) ) ; <nl> + call_ce_handlers . offset = XtOffsetOf ( wrapped_grpc_call , std ) ; <nl> + call_ce_handlers . free_obj = free_wrapped_grpc_call ; <nl> + # endif <nl> } <nl> mmm a / src / php / ext / grpc / call . h <nl> ppp b / src / php / ext / grpc / call . h <nl> <nl> / * Class entry for the Call PHP class * / <nl> extern zend_class_entry * grpc_ce_call ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Wrapper struct for grpc_call that can be associated with a PHP object * / <nl> typedef struct wrapped_grpc_call { <nl> zend_object std ; <nl> - <nl> bool owned ; <nl> grpc_call * wrapped ; <nl> } wrapped_grpc_call ; <nl> <nl> - / * Initializes the Call PHP class * / <nl> - void grpc_init_call ( TSRMLS_D ) ; <nl> - <nl> / * Creates a Call object that wraps the given grpc_call struct * / <nl> zval * grpc_php_wrap_call ( grpc_call * wrapped , bool owned TSRMLS_DC ) ; <nl> <nl> zval * grpc_php_wrap_call ( grpc_call * wrapped , bool owned TSRMLS_DC ) ; <nl> * call metadata * / <nl> zval * grpc_parse_metadata_array ( grpc_metadata_array * metadata_array TSRMLS_DC ) ; <nl> <nl> + # else <nl> + <nl> + / * Wrapper struct for grpc_call that can be associated with a PHP object * / <nl> + typedef struct wrapped_grpc_call { <nl> + bool owned ; <nl> + grpc_call * wrapped ; <nl> + zend_object std ; <nl> + } wrapped_grpc_call ; <nl> + <nl> + static inline wrapped_grpc_call <nl> + * wrapped_grpc_call_from_obj ( zend_object * obj ) { <nl> + return ( wrapped_grpc_call * ) ( ( char * ) ( obj ) - <nl> + XtOffsetOf ( wrapped_grpc_call , std ) ) ; <nl> + } <nl> + <nl> + # define Z_WRAPPED_GRPC_CALL_P ( zv ) wrapped_grpc_call_from_obj ( Z_OBJ_P ( ( zv ) ) ) <nl> + <nl> + / * Creates a Call object that wraps the given grpc_call struct * / <nl> + void grpc_php_wrap_call ( grpc_call * wrapped , bool owned , zval * call_object ) ; <nl> + <nl> + / * Creates and returns a PHP associative array of metadata from a C array of <nl> + * call metadata * / <nl> + void grpc_parse_metadata_array ( grpc_metadata_array * metadata_array , <nl> + zval * array ) ; <nl> + <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> + <nl> + / * Initializes the Call PHP class * / <nl> + void grpc_init_call ( TSRMLS_D ) ; <nl> + <nl> / * Populates a grpc_metadata_array with the data in a PHP array object . <nl> Returns true on success and false on failure * / <nl> bool create_metadata_array ( zval * array , grpc_metadata_array * metadata ) ; <nl> mmm a / src / php / ext / grpc / call_credentials . c <nl> ppp b / src / php / ext / grpc / call_credentials . c <nl> <nl> <nl> zend_class_entry * grpc_ce_call_credentials ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Frees and destroys an instance of wrapped_grpc_call_credentials * / <nl> void free_wrapped_grpc_call_credentials ( void * object TSRMLS_DC ) { <nl> wrapped_grpc_call_credentials * creds = <nl> void free_wrapped_grpc_call_credentials ( void * object TSRMLS_DC ) { <nl> if ( creds - > wrapped ! = NULL ) { <nl> grpc_call_credentials_release ( creds - > wrapped ) ; <nl> } <nl> + zend_object_std_dtor ( & creds - > std TSRMLS_CC ) ; <nl> efree ( creds ) ; <nl> } <nl> <nl> zval * grpc_php_wrap_call_credentials ( grpc_call_credentials * wrapped TSRMLS_DC ) { <nl> return credentials_object ; <nl> } <nl> <nl> + # else <nl> + <nl> + static zend_object_handlers call_credentials_ce_handlers ; <nl> + <nl> + / * Frees and destroys an instance of wrapped_grpc_call_credentials * / <nl> + static void free_wrapped_grpc_call_credentials ( zend_object * object ) { <nl> + wrapped_grpc_call_credentials * creds = <nl> + wrapped_grpc_call_creds_from_obj ( object ) ; <nl> + if ( creds - > wrapped ! = NULL ) { <nl> + grpc_call_credentials_release ( creds - > wrapped ) ; <nl> + } <nl> + zend_object_std_dtor ( & creds - > std ) ; <nl> + } <nl> + <nl> + / * Initializes an instance of wrapped_grpc_call_credentials to be <nl> + * associated with an object of a class specified by class_type * / <nl> + zend_object * create_wrapped_grpc_call_credentials ( zend_class_entry <nl> + * class_type ) { <nl> + wrapped_grpc_call_credentials * intern ; <nl> + intern = ecalloc ( 1 , sizeof ( wrapped_grpc_call_credentials ) + <nl> + zend_object_properties_size ( class_type ) ) ; <nl> + zend_object_std_init ( & intern - > std , class_type ) ; <nl> + object_properties_init ( & intern - > std , class_type ) ; <nl> + intern - > std . handlers = & call_credentials_ce_handlers ; <nl> + return & intern - > std ; <nl> + } <nl> + <nl> + void grpc_php_wrap_call_credentials ( grpc_call_credentials * wrapped , <nl> + zval * credentials_object ) { <nl> + object_init_ex ( credentials_object , grpc_ce_call_credentials ) ; <nl> + wrapped_grpc_call_credentials * credentials = <nl> + Z_WRAPPED_GRPC_CALL_CREDS_P ( credentials_object ) ; <nl> + credentials - > wrapped = wrapped ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> / * * <nl> * Create composite credentials from two existing credentials . <nl> * @ param CallCredentials cred1 The first credential <nl> PHP_METHOD ( CallCredentials , createComposite ) { <nl> 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_call_credentials * cred1 = <nl> ( wrapped_grpc_call_credentials * ) zend_object_store_get_object ( <nl> cred1_obj TSRMLS_CC ) ; <nl> PHP_METHOD ( CallCredentials , createComposite ) { <nl> NULL ) ; <nl> zval * creds_object = grpc_php_wrap_call_credentials ( creds TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( creds_object ) ; <nl> + # else <nl> + wrapped_grpc_call_credentials * cred1 = <nl> + Z_WRAPPED_GRPC_CALL_CREDS_P ( cred1_obj ) ; <nl> + wrapped_grpc_call_credentials * cred2 = <nl> + Z_WRAPPED_GRPC_CALL_CREDS_P ( cred2_obj ) ; <nl> + grpc_call_credentials * creds = <nl> + grpc_composite_call_credentials_create ( cred1 - > wrapped , <nl> + cred2 - > wrapped , NULL ) ; <nl> + grpc_php_wrap_call_credentials ( creds , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( CallCredentials , createFromPlugin ) { <nl> memset ( fci_cache , 0 , sizeof ( zend_fcall_info_cache ) ) ; <nl> <nl> / * " f " = = 1 function * / <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " f " , fci , <nl> - fci_cache , <nl> - fci - > params , <nl> - fci - > param_count ) = = FAILURE ) { <nl> + if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " f * " , fci , fci_cache , <nl> + fci - > params , fci - > param_count ) = = FAILURE ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " createFromPlugin expects 1 callback " , <nl> - 1 TSRMLS_CC ) ; <nl> + " createFromPlugin expects 1 callback " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> <nl> PHP_METHOD ( CallCredentials , createFromPlugin ) { <nl> plugin . state = ( void * ) state ; <nl> plugin . type = " " ; <nl> <nl> - grpc_call_credentials * creds = grpc_metadata_credentials_create_from_plugin ( <nl> - plugin , NULL ) ; <nl> + grpc_call_credentials * creds = <nl> + grpc_metadata_credentials_create_from_plugin ( plugin , NULL ) ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * creds_object = grpc_php_wrap_call_credentials ( creds TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( creds_object ) ; <nl> + # else <nl> + grpc_php_wrap_call_credentials ( creds , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * Callback function for plugin creds API * / <nl> void plugin_get_metadata ( void * ptr , grpc_auth_metadata_context context , <nl> <nl> / * prepare to call the user callback function with info from the <nl> * grpc_auth_metadata_context * / <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * * params [ 1 ] ; <nl> zval * arg ; <nl> zval * retval ; <nl> void plugin_get_metadata ( void * ptr , grpc_auth_metadata_context context , <nl> state - > fci - > param_count = 1 ; <nl> state - > fci - > params = params ; <nl> state - > fci - > retval_ptr_ptr = & retval ; <nl> + # else <nl> + zval arg ; <nl> + zval retval ; <nl> + object_init ( & arg ) ; <nl> + add_property_string ( & arg , " service_url " , context . service_url ) ; <nl> + add_property_string ( & arg , " method_name " , context . method_name ) ; <nl> + state - > fci - > param_count = 1 ; <nl> + state - > fci - > params = & arg ; <nl> + state - > fci - > retval = & retval ; <nl> + # endif <nl> <nl> / * call the user callback function * / <nl> zend_call_function ( state - > fci , state - > fci_cache TSRMLS_CC ) ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> if ( Z_TYPE_P ( retval ) ! = IS_ARRAY ) { <nl> + # else <nl> + if ( Z_TYPE_P ( & retval ) ! = IS_ARRAY ) { <nl> + # endif <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> " plugin callback must return metadata array " , <nl> 1 TSRMLS_CC ) ; <nl> + return ; <nl> } <nl> <nl> grpc_metadata_array metadata ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> if ( ! create_metadata_array ( retval , & metadata ) ) { <nl> + # else <nl> + if ( ! create_metadata_array ( & retval , & metadata ) ) { <nl> + # endif <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> " invalid metadata " , 1 TSRMLS_CC ) ; <nl> grpc_metadata_array_destroy ( & metadata ) ; <nl> + return ; <nl> } <nl> <nl> / * TODO : handle error * / <nl> static zend_function_entry call_credentials_methods [ ] = { <nl> ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> PHP_ME ( CallCredentials , createFromPlugin , NULL , <nl> ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> - PHP_FE_END } ; <nl> + PHP_FE_END <nl> + } ; <nl> <nl> void grpc_init_call_credentials ( TSRMLS_D ) { <nl> zend_class_entry ce ; <nl> INIT_CLASS_ENTRY ( ce , " Grpc \ \ CallCredentials " , call_credentials_methods ) ; <nl> ce . create_object = create_wrapped_grpc_call_credentials ; <nl> grpc_ce_call_credentials = zend_register_internal_class ( & ce TSRMLS_CC ) ; <nl> + # if PHP_MAJOR_VERSION > = 7 <nl> + memcpy ( & call_credentials_ce_handlers , <nl> + zend_get_std_object_handlers ( ) , <nl> + sizeof ( zend_object_handlers ) ) ; <nl> + call_credentials_ce_handlers . offset = <nl> + XtOffsetOf ( wrapped_grpc_call_credentials , std ) ; <nl> + call_credentials_ce_handlers . free_obj = <nl> + free_wrapped_grpc_call_credentials ; <nl> + # endif <nl> } <nl> mmm a / src / php / ext / grpc / call_credentials . h <nl> ppp b / src / php / ext / grpc / call_credentials . h <nl> <nl> / * Class entry for the CallCredentials PHP class * / <nl> extern zend_class_entry * grpc_ce_call_credentials ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Wrapper struct for grpc_call_credentials that can be associated <nl> * with a PHP object * / <nl> typedef struct wrapped_grpc_call_credentials { <nl> zend_object std ; <nl> + grpc_call_credentials * wrapped ; <nl> + } wrapped_grpc_call_credentials ; <nl> <nl> + # else <nl> + <nl> + / * Wrapper struct for grpc_call_credentials that can be associated <nl> + * with a PHP object * / <nl> + typedef struct wrapped_grpc_call_credentials { <nl> grpc_call_credentials * wrapped ; <nl> + zend_object std ; <nl> } wrapped_grpc_call_credentials ; <nl> <nl> + static inline wrapped_grpc_call_credentials <nl> + * wrapped_grpc_call_creds_from_obj ( zend_object * obj ) { <nl> + return <nl> + ( wrapped_grpc_call_credentials * ) ( ( char * ) ( obj ) - <nl> + XtOffsetOf ( wrapped_grpc_call_credentials , <nl> + std ) ) ; <nl> + } <nl> + <nl> + # define Z_WRAPPED_GRPC_CALL_CREDS_P ( zv ) \ <nl> + wrapped_grpc_call_creds_from_obj ( Z_OBJ_P ( ( zv ) ) ) <nl> + <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> + <nl> / * Struct to hold callback function for plugin creds API * / <nl> typedef struct plugin_state { <nl> zend_fcall_info * fci ; <nl> mmm a / src / php / ext / grpc / channel . c <nl> ppp b / src / php / ext / grpc / channel . c <nl> <nl> <nl> zend_class_entry * grpc_ce_channel ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Frees and destroys an instance of wrapped_grpc_channel * / <nl> void free_wrapped_grpc_channel ( void * object TSRMLS_DC ) { <nl> wrapped_grpc_channel * channel = ( wrapped_grpc_channel * ) object ; <nl> if ( channel - > wrapped ! = NULL ) { <nl> grpc_channel_destroy ( channel - > wrapped ) ; <nl> } <nl> + zend_object_std_dtor ( & channel - > std TSRMLS_CC ) ; <nl> efree ( channel ) ; <nl> } <nl> <nl> zend_object_value create_wrapped_grpc_channel ( zend_class_entry * class_type <nl> return retval ; <nl> } <nl> <nl> - void php_grpc_read_args_array ( zval * args_array , grpc_channel_args * args TSRMLS_DC ) { <nl> + void php_grpc_read_args_array ( zval * args_array , <nl> + grpc_channel_args * args TSRMLS_DC ) { <nl> HashTable * array_hash ; <nl> HashPosition array_pointer ; <nl> int args_index ; <nl> void php_grpc_read_args_array ( zval * args_array , grpc_channel_args * args TSRMLS_D <nl> } <nl> args - > args [ args_index ] . key = key ; <nl> switch ( Z_TYPE_P ( * data ) ) { <nl> - case IS_LONG : <nl> - args - > args [ args_index ] . value . integer = ( int ) Z_LVAL_P ( * data ) ; <nl> - args - > args [ args_index ] . type = GRPC_ARG_INTEGER ; <nl> - break ; <nl> - case IS_STRING : <nl> - args - > args [ args_index ] . value . string = Z_STRVAL_P ( * data ) ; <nl> - args - > args [ args_index ] . type = GRPC_ARG_STRING ; <nl> - break ; <nl> - default : <nl> - zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> - " args values must be int or string " , 1 TSRMLS_CC ) ; <nl> - return ; <nl> + case IS_LONG : <nl> + args - > args [ args_index ] . value . integer = ( int ) Z_LVAL_P ( * data ) ; <nl> + args - > args [ args_index ] . type = GRPC_ARG_INTEGER ; <nl> + break ; <nl> + case IS_STRING : <nl> + args - > args [ args_index ] . value . string = Z_STRVAL_P ( * data ) ; <nl> + args - > args [ args_index ] . type = GRPC_ARG_STRING ; <nl> + break ; <nl> + default : <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " args values must be int or string " , 1 TSRMLS_CC ) ; <nl> + return ; <nl> } <nl> args_index + + ; <nl> } <nl> } <nl> <nl> + # else <nl> + <nl> + static zend_object_handlers channel_ce_handlers ; <nl> + <nl> + / * Frees and destroys an instance of wrapped_grpc_channel * / <nl> + static void free_wrapped_grpc_channel ( zend_object * object ) { <nl> + wrapped_grpc_channel * channel = wrapped_grpc_channel_from_obj ( object ) ; <nl> + if ( channel - > wrapped ! = NULL ) { <nl> + grpc_channel_destroy ( channel - > wrapped ) ; <nl> + } <nl> + zend_object_std_dtor ( & channel - > std ) ; <nl> + } <nl> + <nl> + / * Initializes an instance of wrapped_grpc_channel to be associated with an <nl> + * object of a class specified by class_type * / <nl> + zend_object * create_wrapped_grpc_channel ( zend_class_entry * class_type ) { <nl> + wrapped_grpc_channel * intern ; <nl> + intern = ecalloc ( 1 , sizeof ( wrapped_grpc_channel ) + <nl> + zend_object_properties_size ( class_type ) ) ; <nl> + zend_object_std_init ( & intern - > std , class_type ) ; <nl> + object_properties_init ( & intern - > std , class_type ) ; <nl> + intern - > std . handlers = & channel_ce_handlers ; <nl> + return & intern - > std ; <nl> + } <nl> + <nl> + void php_grpc_read_args_array ( zval * args_array , grpc_channel_args * args ) { <nl> + HashTable * array_hash ; <nl> + int args_index ; <nl> + zval * data ; <nl> + zend_string * key ; <nl> + array_hash = HASH_OF ( args_array ) ; <nl> + if ( ! array_hash ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " array_hash is NULL " , 1 ) ; <nl> + return ; <nl> + } <nl> + args - > num_args = zend_hash_num_elements ( array_hash ) ; <nl> + args - > args = ecalloc ( args - > num_args , sizeof ( grpc_arg ) ) ; <nl> + args_index = 0 ; <nl> + ZEND_HASH_FOREACH_STR_KEY_VAL ( array_hash , key , data ) { <nl> + if ( key = = NULL ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " args keys must be strings " , 1 ) ; <nl> + } <nl> + args - > args [ args_index ] . key = ZSTR_VAL ( key ) ; <nl> + switch ( Z_TYPE_P ( data ) ) { <nl> + case IS_LONG : <nl> + args - > args [ args_index ] . value . integer = ( int ) Z_LVAL_P ( data ) ; <nl> + args - > args [ args_index ] . type = GRPC_ARG_INTEGER ; <nl> + break ; <nl> + case IS_STRING : <nl> + args - > args [ args_index ] . value . string = Z_STRVAL_P ( data ) ; <nl> + args - > args [ args_index ] . type = GRPC_ARG_STRING ; <nl> + break ; <nl> + default : <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " args values must be int or string " , 1 ) ; <nl> + return ; <nl> + } <nl> + args_index + + ; <nl> + } ZEND_HASH_FOREACH_END ( ) ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> / * * <nl> * Construct an instance of the Channel class . If the $ args array contains a <nl> * " credentials " key mapping to a ChannelCredentials object , a secure channel <nl> void php_grpc_read_args_array ( zval * args_array , grpc_channel_args * args TSRMLS_D <nl> * @ param array $ args The arguments to pass to the Channel ( optional ) <nl> * / <nl> PHP_METHOD ( Channel , __construct ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_channel * channel = <nl> ( wrapped_grpc_channel * ) zend_object_store_get_object ( <nl> getThis ( ) TSRMLS_CC ) ; <nl> - char * target ; <nl> + zval * * creds_obj = NULL ; <nl> int target_length ; <nl> + # else <nl> + wrapped_grpc_channel * channel = Z_WRAPPED_GRPC_CHANNEL_P ( getThis ( ) ) ; <nl> + zval * creds_obj = NULL ; <nl> + size_t target_length ; <nl> + # endif <nl> + char * target ; <nl> zval * args_array = NULL ; <nl> grpc_channel_args args ; <nl> HashTable * array_hash ; <nl> - zval * * creds_obj = NULL ; <nl> wrapped_grpc_channel_credentials * creds = NULL ; <nl> + <nl> / * " sa " = = 1 string , 1 array * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sa " , & target , <nl> & target_length , & args_array ) = = FAILURE ) { <nl> PHP_METHOD ( Channel , __construct ) { <nl> " Channel expects a string and an array " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> array_hash = Z_ARRVAL_P ( args_array ) ; <nl> if ( zend_hash_find ( array_hash , " credentials " , sizeof ( " credentials " ) , <nl> ( void * * ) & creds_obj ) = = SUCCESS ) { <nl> PHP_METHOD ( Channel , __construct ) { <nl> zend_hash_del ( array_hash , " credentials " , 12 ) ; <nl> } <nl> } <nl> + # else <nl> + array_hash = HASH_OF ( args_array ) ; <nl> + if ( ( creds_obj = zend_hash_str_find ( array_hash , " credentials " , <nl> + sizeof ( " credentials " ) - 1 ) ) ! = NULL ) { <nl> + if ( Z_TYPE_P ( creds_obj ) = = IS_NULL ) { <nl> + creds = NULL ; <nl> + zend_hash_str_del ( array_hash , " credentials " , sizeof ( " credentials " ) - 1 ) ; <nl> + } else if ( Z_OBJ_P ( creds_obj ) - > ce ! = grpc_ce_channel_credentials ) { <nl> + zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> + " credentials must be a ChannelCredentials object " , <nl> + 1 ) ; <nl> + return ; <nl> + } else { <nl> + creds = Z_WRAPPED_GRPC_CHANNEL_CREDS_P ( creds_obj ) ; <nl> + zend_hash_str_del ( array_hash , " credentials " , sizeof ( " credentials " ) - 1 ) ; <nl> + } <nl> + } <nl> + # endif <nl> php_grpc_read_args_array ( args_array , & args TSRMLS_CC ) ; <nl> if ( creds = = NULL ) { <nl> channel - > wrapped = grpc_insecure_channel_create ( target , & args , NULL ) ; <nl> PHP_METHOD ( Channel , __construct ) { <nl> * @ return string The URI of the endpoint <nl> * / <nl> PHP_METHOD ( Channel , getTarget ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_channel * channel = <nl> - ( wrapped_grpc_channel * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + ( wrapped_grpc_channel * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> RETURN_STRING ( grpc_channel_get_target ( channel - > wrapped ) , 1 ) ; <nl> + # else <nl> + wrapped_grpc_channel * channel = Z_WRAPPED_GRPC_CHANNEL_P ( getThis ( ) ) ; <nl> + RETURN_STRING ( grpc_channel_get_target ( channel - > wrapped ) ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Channel , getTarget ) { <nl> * @ return long The grpc connectivity state <nl> * / <nl> PHP_METHOD ( Channel , getConnectivityState ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_channel * channel = <nl> ( wrapped_grpc_channel * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> - bool try_to_connect ; <nl> + # else <nl> + wrapped_grpc_channel * channel = Z_WRAPPED_GRPC_CHANNEL_P ( getThis ( ) ) ; <nl> + # endif <nl> + bool try_to_connect = false ; <nl> + <nl> / * " | b " = = 1 optional bool * / <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | b " , & try_to_connect ) = = <nl> - FAILURE ) { <nl> + if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | b " , & try_to_connect ) <nl> + = = FAILURE ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> " getConnectivityState expects a bool " , 1 TSRMLS_CC ) ; <nl> return ; <nl> PHP_METHOD ( Channel , getConnectivityState ) { <nl> * before deadline <nl> * / <nl> PHP_METHOD ( Channel , watchConnectivityState ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + long last_state ; <nl> wrapped_grpc_channel * channel = <nl> ( wrapped_grpc_channel * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> - long last_state ; <nl> + # else <nl> + zend_long last_state ; <nl> + wrapped_grpc_channel * channel = Z_WRAPPED_GRPC_CHANNEL_P ( getThis ( ) ) ; <nl> + # endif <nl> zval * deadline_obj ; <nl> + <nl> / * " lO " = = 1 long 1 object * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " lO " , <nl> & last_state , & deadline_obj , grpc_ce_timeval ) = = FAILURE ) { <nl> PHP_METHOD ( Channel , watchConnectivityState ) { <nl> return ; <nl> } <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * deadline = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( <nl> deadline_obj TSRMLS_CC ) ; <nl> - grpc_channel_watch_connectivity_state ( <nl> - channel - > wrapped , ( grpc_connectivity_state ) last_state , <nl> - deadline - > wrapped , completion_queue , NULL ) ; <nl> - grpc_event event = grpc_completion_queue_pluck ( <nl> - completion_queue , NULL , <nl> - gpr_inf_future ( GPR_CLOCK_REALTIME ) , NULL ) ; <nl> + # else <nl> + wrapped_grpc_timeval * deadline = Z_WRAPPED_GRPC_TIMEVAL_P ( deadline_obj ) ; <nl> + # endif <nl> + grpc_channel_watch_connectivity_state ( channel - > wrapped , <nl> + ( grpc_connectivity_state ) last_state , <nl> + deadline - > wrapped , completion_queue , <nl> + NULL ) ; <nl> + grpc_event event = <nl> + grpc_completion_queue_pluck ( completion_queue , NULL , <nl> + gpr_inf_future ( GPR_CLOCK_REALTIME ) , NULL ) ; <nl> RETURN_BOOL ( event . success ) ; <nl> } <nl> <nl> PHP_METHOD ( Channel , watchConnectivityState ) { <nl> * Close the channel <nl> * / <nl> PHP_METHOD ( Channel , close ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_channel * channel = <nl> - ( wrapped_grpc_channel * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + ( wrapped_grpc_channel * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_channel * channel = Z_WRAPPED_GRPC_CHANNEL_P ( getThis ( ) ) ; <nl> + # endif <nl> if ( channel - > wrapped ! = NULL ) { <nl> grpc_channel_destroy ( channel - > wrapped ) ; <nl> channel - > wrapped = NULL ; <nl> PHP_METHOD ( Channel , close ) { <nl> } <nl> <nl> static zend_function_entry channel_methods [ ] = { <nl> - PHP_ME ( Channel , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> - PHP_ME ( Channel , getTarget , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Channel , getConnectivityState , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Channel , watchConnectivityState , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Channel , close , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_FE_END } ; <nl> + PHP_ME ( Channel , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> + PHP_ME ( Channel , getTarget , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Channel , getConnectivityState , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Channel , watchConnectivityState , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Channel , close , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_FE_END <nl> + } ; <nl> <nl> void grpc_init_channel ( TSRMLS_D ) { <nl> zend_class_entry ce ; <nl> INIT_CLASS_ENTRY ( ce , " Grpc \ \ Channel " , channel_methods ) ; <nl> ce . create_object = create_wrapped_grpc_channel ; <nl> grpc_ce_channel = zend_register_internal_class ( & ce TSRMLS_CC ) ; <nl> + # if PHP_MAJOR_VERSION > = 7 <nl> + memcpy ( & channel_ce_handlers , zend_get_std_object_handlers ( ) , <nl> + sizeof ( zend_object_handlers ) ) ; <nl> + channel_ce_handlers . offset = <nl> + XtOffsetOf ( wrapped_grpc_channel , std ) ; <nl> + channel_ce_handlers . free_obj = free_wrapped_grpc_channel ; <nl> + # endif <nl> } <nl> mmm a / src / php / ext / grpc / channel . h <nl> ppp b / src / php / ext / grpc / channel . h <nl> <nl> / * Class entry for the PHP Channel class * / <nl> extern zend_class_entry * grpc_ce_channel ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Wrapper struct for grpc_channel that can be associated with a PHP object * / <nl> typedef struct wrapped_grpc_channel { <nl> zend_object std ; <nl> + grpc_channel * wrapped ; <nl> + } wrapped_grpc_channel ; <nl> <nl> + # else <nl> + <nl> + / * Wrapper struct for grpc_channel that can be associated with a PHP object * / <nl> + typedef struct wrapped_grpc_channel { <nl> grpc_channel * wrapped ; <nl> + zend_object std ; <nl> } wrapped_grpc_channel ; <nl> <nl> + static inline wrapped_grpc_channel <nl> + * wrapped_grpc_channel_from_obj ( zend_object * obj ) { <nl> + return ( wrapped_grpc_channel * ) ( ( char * ) ( obj ) - <nl> + XtOffsetOf ( wrapped_grpc_channel , std ) ) ; <nl> + } <nl> + <nl> + # define Z_WRAPPED_GRPC_CHANNEL_P ( zv ) \ <nl> + wrapped_grpc_channel_from_obj ( Z_OBJ_P ( ( zv ) ) ) <nl> + <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> + <nl> / * Initializes the Channel class * / <nl> void grpc_init_channel ( TSRMLS_D ) ; <nl> <nl> / * Iterates through a PHP array and populates args with the contents * / <nl> - void php_grpc_read_args_array ( zval * args_array , grpc_channel_args * args TSRMLS_DC ) ; <nl> + void php_grpc_read_args_array ( zval * args_array , grpc_channel_args * args <nl> + TSRMLS_DC ) ; <nl> <nl> # endif / * NET_GRPC_PHP_GRPC_CHANNEL_H_ * / <nl> mmm a / src / php / ext / grpc / channel_credentials . c <nl> ppp b / src / php / ext / grpc / channel_credentials . c <nl> <nl> # include < grpc / grpc_security . h > <nl> <nl> zend_class_entry * grpc_ce_channel_credentials ; <nl> - <nl> static char * default_pem_root_certs = NULL ; <nl> <nl> static grpc_ssl_roots_override_result get_ssl_roots_override ( <nl> static grpc_ssl_roots_override_result get_ssl_roots_override ( <nl> return GRPC_SSL_ROOTS_OVERRIDE_OK ; <nl> } <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Frees and destroys an instance of wrapped_grpc_channel_credentials * / <nl> void free_wrapped_grpc_channel_credentials ( void * object TSRMLS_DC ) { <nl> wrapped_grpc_channel_credentials * creds = <nl> void free_wrapped_grpc_channel_credentials ( void * object TSRMLS_DC ) { <nl> if ( creds - > wrapped ! = NULL ) { <nl> grpc_channel_credentials_release ( creds - > wrapped ) ; <nl> } <nl> + zend_object_std_dtor ( & creds - > std TSRMLS_CC ) ; <nl> efree ( creds ) ; <nl> } <nl> <nl> zend_object_value create_wrapped_grpc_channel_credentials ( <nl> return retval ; <nl> } <nl> <nl> - zval * grpc_php_wrap_channel_credentials ( grpc_channel_credentials * wrapped TSRMLS_DC ) { <nl> + zval * grpc_php_wrap_channel_credentials ( grpc_channel_credentials <nl> + * wrapped TSRMLS_DC ) { <nl> zval * credentials_object ; <nl> MAKE_STD_ZVAL ( credentials_object ) ; <nl> object_init_ex ( credentials_object , grpc_ce_channel_credentials ) ; <nl> zval * grpc_php_wrap_channel_credentials ( grpc_channel_credentials * wrapped TSRMLS <nl> return credentials_object ; <nl> } <nl> <nl> + # else <nl> + <nl> + static zend_object_handlers channel_credentials_ce_handlers ; <nl> + <nl> + / * Frees and destroys an instance of wrapped_grpc_channel_credentials * / <nl> + static void free_wrapped_grpc_channel_credentials ( zend_object * object ) { <nl> + wrapped_grpc_channel_credentials * creds = <nl> + wrapped_grpc_channel_creds_from_obj ( object ) ; <nl> + if ( creds - > wrapped ! = NULL ) { <nl> + grpc_channel_credentials_release ( creds - > wrapped ) ; <nl> + } <nl> + zend_object_std_dtor ( & creds - > std ) ; <nl> + } <nl> + <nl> + / * Initializes an instance of wrapped_grpc_channel_credentials to be <nl> + * associated with an object of a class specified by class_type * / <nl> + zend_object * create_wrapped_grpc_channel_credentials ( zend_class_entry <nl> + * class_type ) { <nl> + wrapped_grpc_channel_credentials * intern ; <nl> + intern = ecalloc ( 1 , sizeof ( wrapped_grpc_channel_credentials ) + <nl> + zend_object_properties_size ( class_type ) ) ; <nl> + zend_object_std_init ( & intern - > std , class_type ) ; <nl> + object_properties_init ( & intern - > std , class_type ) ; <nl> + intern - > std . handlers = & channel_credentials_ce_handlers ; <nl> + return & intern - > std ; <nl> + } <nl> + <nl> + void grpc_php_wrap_channel_credentials ( grpc_channel_credentials * wrapped , <nl> + zval * credentials_object ) { <nl> + object_init_ex ( credentials_object , grpc_ce_channel_credentials ) ; <nl> + wrapped_grpc_channel_credentials * credentials = <nl> + Z_WRAPPED_GRPC_CHANNEL_CREDS_P ( credentials_object ) ; <nl> + credentials - > wrapped = wrapped ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> / * * <nl> * Set default roots pem . <nl> * @ param string pem_roots PEM encoding of the server root certificates <nl> zval * grpc_php_wrap_channel_credentials ( grpc_channel_credentials * wrapped TSRMLS <nl> * / <nl> PHP_METHOD ( ChannelCredentials , setDefaultRootsPem ) { <nl> char * pem_roots ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> int pem_roots_length ; <nl> + # else <nl> + size_t pem_roots_length ; <nl> + # endif <nl> + <nl> + / * " s " = = 1 string * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & pem_roots , <nl> & pem_roots_length ) = = FAILURE ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> PHP_METHOD ( ChannelCredentials , setDefaultRootsPem ) { <nl> * / <nl> PHP_METHOD ( ChannelCredentials , createDefault ) { <nl> grpc_channel_credentials * creds = grpc_google_default_credentials_create ( ) ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * creds_object = grpc_php_wrap_channel_credentials ( creds TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( creds_object ) ; <nl> + # else <nl> + grpc_php_wrap_channel_credentials ( creds , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( ChannelCredentials , createSsl ) { <nl> char * pem_root_certs = NULL ; <nl> grpc_ssl_pem_key_cert_pair pem_key_cert_pair ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> int root_certs_length = 0 , private_key_length = 0 , cert_chain_length = 0 ; <nl> + # else <nl> + size_t root_certs_length = 0 , private_key_length = 0 , cert_chain_length = 0 ; <nl> + # endif <nl> <nl> pem_key_cert_pair . private_key = pem_key_cert_pair . cert_chain = NULL ; <nl> <nl> - / * " | s ! s ! s ! = = 3 optional nullable strings * / <nl> + / * " | s ! s ! s ! " = = 3 optional nullable strings * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | s ! s ! s ! " , <nl> & pem_root_certs , & root_certs_length , <nl> & pem_key_cert_pair . private_key , <nl> PHP_METHOD ( ChannelCredentials , createSsl ) { <nl> grpc_channel_credentials * creds = grpc_ssl_credentials_create ( <nl> pem_root_certs , <nl> pem_key_cert_pair . private_key = = NULL ? NULL : & pem_key_cert_pair , NULL ) ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * creds_object = grpc_php_wrap_channel_credentials ( creds TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( creds_object ) ; <nl> + # else <nl> + grpc_php_wrap_channel_credentials ( creds , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( ChannelCredentials , createComposite ) { <nl> zval * cred1_obj ; <nl> zval * cred2_obj ; <nl> <nl> - / * " OO " = = 3 Objects * / <nl> + / * " OO " = = 2 Objects * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " OO " , & cred1_obj , <nl> grpc_ce_channel_credentials , & cred2_obj , <nl> grpc_ce_call_credentials ) = = FAILURE ) { <nl> PHP_METHOD ( ChannelCredentials , createComposite ) { <nl> " createComposite expects 2 Credentials " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_channel_credentials * cred1 = <nl> ( wrapped_grpc_channel_credentials * ) zend_object_store_get_object ( <nl> cred1_obj TSRMLS_CC ) ; <nl> PHP_METHOD ( ChannelCredentials , createComposite ) { <nl> NULL ) ; <nl> zval * creds_object = grpc_php_wrap_channel_credentials ( creds TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( creds_object ) ; <nl> + # else <nl> + wrapped_grpc_channel_credentials * cred1 = <nl> + Z_WRAPPED_GRPC_CHANNEL_CREDS_P ( cred1_obj ) ; <nl> + wrapped_grpc_call_credentials * cred2 = <nl> + Z_WRAPPED_GRPC_CALL_CREDS_P ( cred2_obj ) ; <nl> + grpc_channel_credentials * creds = <nl> + grpc_composite_channel_credentials_create ( cred1 - > wrapped , <nl> + cred2 - > wrapped , NULL ) ; <nl> + grpc_php_wrap_channel_credentials ( creds , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> static zend_function_entry channel_credentials_methods [ ] = { <nl> ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> PHP_ME ( ChannelCredentials , createInsecure , NULL , <nl> ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> - PHP_FE_END } ; <nl> + PHP_FE_END <nl> + } ; <nl> <nl> void grpc_init_channel_credentials ( TSRMLS_D ) { <nl> zend_class_entry ce ; <nl> void grpc_init_channel_credentials ( TSRMLS_D ) { <nl> grpc_set_ssl_roots_override_callback ( get_ssl_roots_override ) ; <nl> ce . create_object = create_wrapped_grpc_channel_credentials ; <nl> grpc_ce_channel_credentials = zend_register_internal_class ( & ce TSRMLS_CC ) ; <nl> + # if PHP_MAJOR_VERSION > = 7 <nl> + memcpy ( & channel_credentials_ce_handlers , <nl> + zend_get_std_object_handlers ( ) , <nl> + sizeof ( zend_object_handlers ) ) ; <nl> + channel_credentials_ce_handlers . offset = <nl> + XtOffsetOf ( wrapped_grpc_channel_credentials , std ) ; <nl> + channel_credentials_ce_handlers . free_obj = <nl> + free_wrapped_grpc_channel_credentials ; <nl> + # endif <nl> } <nl> mmm a / src / php / ext / grpc / channel_credentials . h <nl> ppp b / src / php / ext / grpc / channel_credentials . h <nl> <nl> / * Class entry for the ChannelCredentials PHP class * / <nl> extern zend_class_entry * grpc_ce_channel_credentials ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Wrapper struct for grpc_channel_credentials that can be associated <nl> * with a PHP object * / <nl> typedef struct wrapped_grpc_channel_credentials { <nl> zend_object std ; <nl> + grpc_channel_credentials * wrapped ; <nl> + } wrapped_grpc_channel_credentials ; <nl> <nl> + # else <nl> + <nl> + / * Wrapper struct for grpc_channel_credentials that can be associated <nl> + * with a PHP object * / <nl> + typedef struct wrapped_grpc_channel_credentials { <nl> grpc_channel_credentials * wrapped ; <nl> + zend_object std ; <nl> } wrapped_grpc_channel_credentials ; <nl> <nl> + static inline wrapped_grpc_channel_credentials <nl> + * wrapped_grpc_channel_creds_from_obj ( zend_object * obj ) { <nl> + return <nl> + ( wrapped_grpc_channel_credentials * ) <nl> + ( ( char * ) ( obj ) - <nl> + XtOffsetOf ( wrapped_grpc_channel_credentials , std ) ) ; <nl> + } <nl> + <nl> + # define Z_WRAPPED_GRPC_CHANNEL_CREDS_P ( zv ) \ <nl> + wrapped_grpc_channel_creds_from_obj ( Z_OBJ_P ( ( zv ) ) ) <nl> + <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> + <nl> / * Initializes the ChannelCredentials PHP class * / <nl> void grpc_init_channel_credentials ( TSRMLS_D ) ; <nl> <nl> mmm a / src / php / ext / grpc / php_grpc . c <nl> ppp b / src / php / ext / grpc / php_grpc . c <nl> const zend_function_entry grpc_functions [ ] = { <nl> * / <nl> zend_module_entry grpc_module_entry = { <nl> # if ZEND_MODULE_API_NO > = 20010901 <nl> - STANDARD_MODULE_HEADER , <nl> + STANDARD_MODULE_HEADER , <nl> # endif <nl> - " grpc " , grpc_functions , PHP_MINIT ( grpc ) , <nl> - PHP_MSHUTDOWN ( grpc ) , NULL , NULL , <nl> - PHP_MINFO ( grpc ) , <nl> + " grpc " , <nl> + grpc_functions , <nl> + PHP_MINIT ( grpc ) , <nl> + PHP_MSHUTDOWN ( grpc ) , <nl> + NULL , <nl> + NULL , <nl> + PHP_MINFO ( grpc ) , <nl> # if ZEND_MODULE_API_NO > = 20010901 <nl> - PHP_GRPC_VERSION , <nl> + PHP_GRPC_VERSION , <nl> # endif <nl> - STANDARD_MODULE_PROPERTIES } ; <nl> + STANDARD_MODULE_PROPERTIES } ; <nl> / * } } } * / <nl> <nl> # ifdef COMPILE_DL_GRPC <nl> ZEND_GET_MODULE ( grpc ) <nl> / * { { { PHP_INI <nl> * / <nl> / * Remove comments and fill if you need to have entries in php . ini <nl> - PHP_INI_BEGIN ( ) <nl> - STD_PHP_INI_ENTRY ( " grpc . global_value " , " 42 " , PHP_INI_ALL , OnUpdateLong , <nl> - global_value , zend_grpc_globals , grpc_globals ) <nl> - STD_PHP_INI_ENTRY ( " grpc . global_string " , " foobar " , PHP_INI_ALL , <nl> - OnUpdateString , global_string , zend_grpc_globals , grpc_globals ) <nl> - PHP_INI_END ( ) <nl> + PHP_INI_BEGIN ( ) <nl> + STD_PHP_INI_ENTRY ( " grpc . global_value " , " 42 " , PHP_INI_ALL , OnUpdateLong , <nl> + global_value , zend_grpc_globals , grpc_globals ) <nl> + STD_PHP_INI_ENTRY ( " grpc . global_string " , " foobar " , PHP_INI_ALL , <nl> + OnUpdateString , global_string , zend_grpc_globals , <nl> + grpc_globals ) <nl> + PHP_INI_END ( ) <nl> * / <nl> / * } } } * / <nl> <nl> / * { { { php_grpc_init_globals <nl> * / <nl> / * Uncomment this function if you have INI entries <nl> - static void php_grpc_init_globals ( zend_grpc_globals * grpc_globals ) <nl> - { <nl> - grpc_globals - > global_value = 0 ; <nl> - grpc_globals - > global_string = NULL ; <nl> - } <nl> + static void php_grpc_init_globals ( zend_grpc_globals * grpc_globals ) <nl> + { <nl> + grpc_globals - > global_value = 0 ; <nl> + grpc_globals - > global_string = NULL ; <nl> + } <nl> * / <nl> / * } } } * / <nl> <nl> static void php_grpc_init_globals ( zend_grpc_globals * grpc_globals ) <nl> * / <nl> PHP_MINIT_FUNCTION ( grpc ) { <nl> / * If you have INI entries , uncomment these lines <nl> - REGISTER_INI_ENTRIES ( ) ; <nl> + REGISTER_INI_ENTRIES ( ) ; <nl> * / <nl> / * Register call error constants * / <nl> grpc_init ( ) ; <nl> PHP_MINIT_FUNCTION ( grpc ) { <nl> * / <nl> PHP_MSHUTDOWN_FUNCTION ( grpc ) { <nl> / * uncomment this line if you have INI entries <nl> - UNREGISTER_INI_ENTRIES ( ) ; <nl> + UNREGISTER_INI_ENTRIES ( ) ; <nl> * / <nl> / / WARNING : This function IS being called by PHP when the extension <nl> / / is unloaded but the logs were somehow suppressed . <nl> PHP_MINFO_FUNCTION ( grpc ) { <nl> php_info_print_table_end ( ) ; <nl> <nl> / * Remove comments if you have entries in php . ini <nl> - DISPLAY_INI_ENTRIES ( ) ; <nl> + DISPLAY_INI_ENTRIES ( ) ; <nl> * / <nl> } <nl> / * } } } * / <nl> PHP_MINFO_FUNCTION ( grpc ) { <nl> function definition , where the functions purpose is also documented . Please <nl> follow this convention for the convenience of others editing your code . <nl> * / <nl> - <nl> - / * <nl> - * Local variables : <nl> - * tab - width : 4 <nl> - * c - basic - offset : 4 <nl> - * End : <nl> - * vim600 : noet sw = 4 ts = 4 fdm = marker <nl> - * vim < 600 : noet sw = 4 ts = 4 <nl> - * / <nl> mmm a / src / php / ext / grpc / php_grpc . h <nl> ppp b / src / php / ext / grpc / php_grpc . h <nl> PHP_MSHUTDOWN_FUNCTION ( grpc ) ; <nl> PHP_MINFO_FUNCTION ( grpc ) ; <nl> <nl> / * <nl> - Declare any global variables you may need between the BEGIN <nl> - and END macros here : <nl> + Declare any global variables you may need between the BEGIN <nl> + and END macros here : <nl> <nl> ZEND_BEGIN_MODULE_GLOBALS ( grpc ) <nl> ZEND_END_MODULE_GLOBALS ( grpc ) <nl> mmm a / src / php / ext / grpc / server . c <nl> ppp b / src / php / ext / grpc / server . c <nl> <nl> <nl> zend_class_entry * grpc_ce_server ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Frees and destroys an instance of wrapped_grpc_server * / <nl> void free_wrapped_grpc_server ( void * object TSRMLS_DC ) { <nl> wrapped_grpc_server * server = ( wrapped_grpc_server * ) object ; <nl> void free_wrapped_grpc_server ( void * object TSRMLS_DC ) { <nl> gpr_inf_future ( GPR_CLOCK_REALTIME ) , NULL ) ; <nl> grpc_server_destroy ( server - > wrapped ) ; <nl> } <nl> + zend_object_std_dtor ( & server - > std TSRMLS_CC ) ; <nl> efree ( server ) ; <nl> } <nl> <nl> zend_object_value create_wrapped_grpc_server ( zend_class_entry * class_type <nl> return retval ; <nl> } <nl> <nl> + # else <nl> + <nl> + static zend_object_handlers server_ce_handlers ; <nl> + <nl> + / * Frees and destroys an instance of wrapped_grpc_server * / <nl> + static void free_wrapped_grpc_server ( zend_object * object ) { <nl> + wrapped_grpc_server * server = wrapped_grpc_server_from_obj ( object ) ; <nl> + if ( server - > wrapped ! = NULL ) { <nl> + grpc_server_shutdown_and_notify ( server - > wrapped , completion_queue , NULL ) ; <nl> + grpc_server_cancel_all_calls ( server - > wrapped ) ; <nl> + grpc_completion_queue_pluck ( completion_queue , NULL , <nl> + gpr_inf_future ( GPR_CLOCK_REALTIME ) , NULL ) ; <nl> + grpc_server_destroy ( server - > wrapped ) ; <nl> + } <nl> + zend_object_std_dtor ( & server - > std ) ; <nl> + } <nl> + <nl> + / * Initializes an instance of wrapped_grpc_call to be associated with an object <nl> + * of a class specified by class_type * / <nl> + zend_object * create_wrapped_grpc_server ( zend_class_entry * class_type ) { <nl> + wrapped_grpc_server * intern ; <nl> + intern = ecalloc ( 1 , sizeof ( wrapped_grpc_server ) + <nl> + zend_object_properties_size ( class_type ) ) ; <nl> + zend_object_std_init ( & intern - > std , class_type ) ; <nl> + object_properties_init ( & intern - > std , class_type ) ; <nl> + intern - > std . handlers = & server_ce_handlers ; <nl> + return & intern - > std ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> / * * <nl> * Constructs a new instance of the Server class <nl> * @ param array $ args The arguments to pass to the server ( optional ) <nl> * / <nl> PHP_METHOD ( Server , __construct ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_server * server = <nl> ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_server * server = Z_WRAPPED_GRPC_SERVER_P ( getThis ( ) ) ; <nl> + # endif <nl> zval * args_array = NULL ; <nl> grpc_channel_args args ; <nl> + <nl> / * " | a " = = 1 optional array * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | a " , & args_array ) = = <nl> FAILURE ) { <nl> PHP_METHOD ( Server , __construct ) { <nl> if ( args_array = = NULL ) { <nl> server - > wrapped = grpc_server_create ( NULL , NULL ) ; <nl> } else { <nl> + / / TODO ( thinkerou ) : deal it if key of array is long , crash now on php7 <nl> + / / and update unit test case <nl> php_grpc_read_args_array ( args_array , & args TSRMLS_CC ) ; <nl> server - > wrapped = grpc_server_create ( & args , NULL ) ; <nl> efree ( args . args ) ; <nl> PHP_METHOD ( Server , __construct ) { <nl> * / <nl> PHP_METHOD ( Server , requestCall ) { <nl> grpc_call_error error_code ; <nl> - wrapped_grpc_server * server = <nl> - ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> grpc_call * call ; <nl> grpc_call_details details ; <nl> grpc_metadata_array metadata ; <nl> - zval * result ; <nl> grpc_event event ; <nl> + <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + wrapped_grpc_server * server = <nl> + ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + zval * result ; <nl> MAKE_STD_ZVAL ( result ) ; <nl> object_init ( result ) ; <nl> + # else <nl> + wrapped_grpc_server * server = Z_WRAPPED_GRPC_SERVER_P ( getThis ( ) ) ; <nl> + object_init ( return_value ) ; <nl> + # endif <nl> + <nl> grpc_call_details_init ( & details ) ; <nl> grpc_metadata_array_init ( & metadata ) ; <nl> error_code = <nl> PHP_METHOD ( Server , requestCall ) { <nl> goto cleanup ; <nl> } <nl> event = grpc_completion_queue_pluck ( completion_queue , NULL , <nl> - gpr_inf_future ( GPR_CLOCK_REALTIME ) , NULL ) ; <nl> + gpr_inf_future ( GPR_CLOCK_REALTIME ) , <nl> + NULL ) ; <nl> if ( ! event . success ) { <nl> zend_throw_exception ( spl_ce_LogicException , <nl> " Failed to request a call for some reason " , <nl> 1 TSRMLS_CC ) ; <nl> goto cleanup ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> add_property_zval ( result , " call " , grpc_php_wrap_call ( call , true TSRMLS_CC ) ) ; <nl> add_property_string ( result , " method " , details . method , true ) ; <nl> add_property_string ( result , " host " , details . host , true ) ; <nl> add_property_zval ( result , " absolute_deadline " , <nl> grpc_php_wrap_timeval ( details . deadline TSRMLS_CC ) ) ; <nl> - add_property_zval ( result , " metadata " , grpc_parse_metadata_array ( & metadata TSRMLS_CC ) ) ; <nl> + add_property_zval ( result , " metadata " , grpc_parse_metadata_array ( & metadata <nl> + TSRMLS_CC ) ) ; <nl> + <nl> cleanup : <nl> grpc_call_details_destroy ( & details ) ; <nl> grpc_metadata_array_destroy ( & metadata ) ; <nl> RETURN_DESTROY_ZVAL ( result ) ; <nl> + <nl> + # else <nl> + <nl> + zval zv_call ; <nl> + zval zv_timeval ; <nl> + zval zv_md ; <nl> + grpc_php_wrap_call ( call , true , & zv_call ) ; <nl> + grpc_php_wrap_timeval ( details . deadline , & zv_timeval ) ; <nl> + grpc_parse_metadata_array ( & metadata , & zv_md ) ; <nl> + <nl> + add_property_zval ( return_value , " call " , & zv_call ) ; <nl> + add_property_string ( return_value , " method " , details . method ) ; <nl> + add_property_string ( return_value , " host " , details . host ) ; <nl> + add_property_zval ( return_value , " absolute_deadline " , & zv_timeval ) ; <nl> + add_property_zval ( return_value , " metadata " , & zv_md ) ; <nl> + <nl> + cleanup : <nl> + grpc_call_details_destroy ( & details ) ; <nl> + grpc_metadata_array_destroy ( & metadata ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Server , requestCall ) { <nl> * @ return true on success , false on failure <nl> * / <nl> PHP_METHOD ( Server , addHttp2Port ) { <nl> - wrapped_grpc_server * server = <nl> - ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> const char * addr ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> int addr_len ; <nl> + wrapped_grpc_server * server = <nl> + ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + size_t addr_len ; <nl> + wrapped_grpc_server * server = Z_WRAPPED_GRPC_SERVER_P ( getThis ( ) ) ; <nl> + # endif <nl> + <nl> / * " s " = = 1 string * / <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & addr , & addr_len ) = = <nl> - FAILURE ) { <nl> + if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & addr , & addr_len ) <nl> + = = FAILURE ) { <nl> zend_throw_exception ( spl_ce_InvalidArgumentException , <nl> " add_http2_port expects a string " , 1 TSRMLS_CC ) ; <nl> return ; <nl> PHP_METHOD ( Server , addHttp2Port ) { <nl> } <nl> <nl> PHP_METHOD ( Server , addSecureHttp2Port ) { <nl> - wrapped_grpc_server * server = <nl> - ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> const char * addr ; <nl> - int addr_len ; <nl> zval * creds_obj ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + int addr_len ; <nl> + wrapped_grpc_server * server = <nl> + ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + size_t addr_len ; <nl> + wrapped_grpc_server * server = Z_WRAPPED_GRPC_SERVER_P ( getThis ( ) ) ; <nl> + # endif <nl> + <nl> / * " sO " = = 1 string , 1 object * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sO " , & addr , & addr_len , <nl> & creds_obj , grpc_ce_server_credentials ) = = <nl> PHP_METHOD ( Server , addSecureHttp2Port ) { <nl> " add_http2_port expects a string and a ServerCredentials " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_server_credentials * creds = <nl> ( wrapped_grpc_server_credentials * ) zend_object_store_get_object ( <nl> creds_obj TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_server_credentials * creds = <nl> + Z_WRAPPED_GRPC_SERVER_CREDS_P ( creds_obj ) ; <nl> + # endif <nl> RETURN_LONG ( grpc_server_add_secure_http2_port ( server - > wrapped , addr , <nl> creds - > wrapped ) ) ; <nl> } <nl> PHP_METHOD ( Server , addSecureHttp2Port ) { <nl> * @ return Void <nl> * / <nl> PHP_METHOD ( Server , start ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_server * server = <nl> ( wrapped_grpc_server * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_server * server = Z_WRAPPED_GRPC_SERVER_P ( getThis ( ) ) ; <nl> + # endif <nl> grpc_server_start ( server - > wrapped ) ; <nl> } <nl> <nl> static zend_function_entry server_methods [ ] = { <nl> - PHP_ME ( Server , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> - PHP_ME ( Server , requestCall , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Server , addHttp2Port , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Server , addSecureHttp2Port , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Server , start , NULL , ZEND_ACC_PUBLIC ) PHP_FE_END } ; <nl> + PHP_ME ( Server , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> + PHP_ME ( Server , requestCall , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Server , addHttp2Port , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Server , addSecureHttp2Port , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Server , start , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_FE_END <nl> + } ; <nl> <nl> void grpc_init_server ( TSRMLS_D ) { <nl> zend_class_entry ce ; <nl> INIT_CLASS_ENTRY ( ce , " Grpc \ \ Server " , server_methods ) ; <nl> ce . create_object = create_wrapped_grpc_server ; <nl> grpc_ce_server = zend_register_internal_class ( & ce TSRMLS_CC ) ; <nl> + # if PHP_MAJOR_VERSION > = 7 <nl> + memcpy ( & server_ce_handlers , zend_get_std_object_handlers ( ) , <nl> + sizeof ( zend_object_handlers ) ) ; <nl> + server_ce_handlers . offset = XtOffsetOf ( wrapped_grpc_server , std ) ; <nl> + server_ce_handlers . free_obj = free_wrapped_grpc_server ; <nl> + # endif <nl> } <nl> mmm a / src / php / ext / grpc / server . h <nl> ppp b / src / php / ext / grpc / server . h <nl> <nl> / * Class entry for the Server PHP class * / <nl> extern zend_class_entry * grpc_ce_server ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Wrapper struct for grpc_server that can be associated with a PHP object * / <nl> typedef struct wrapped_grpc_server { <nl> zend_object std ; <nl> + grpc_server * wrapped ; <nl> + } wrapped_grpc_server ; <nl> <nl> + # else <nl> + <nl> + / * Wrapper struct for grpc_server that can be associated with a PHP object * / <nl> + typedef struct wrapped_grpc_server { <nl> grpc_server * wrapped ; <nl> + zend_object std ; <nl> } wrapped_grpc_server ; <nl> <nl> + static inline wrapped_grpc_server <nl> + * wrapped_grpc_server_from_obj ( zend_object * obj ) { <nl> + return ( wrapped_grpc_server * ) ( ( char * ) ( obj ) - <nl> + XtOffsetOf ( wrapped_grpc_server , std ) ) ; <nl> + } <nl> + <nl> + # define Z_WRAPPED_GRPC_SERVER_P ( zv ) \ <nl> + wrapped_grpc_server_from_obj ( Z_OBJ_P ( ( zv ) ) ) <nl> + <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> + <nl> / * Initializes the Server class * / <nl> void grpc_init_server ( TSRMLS_D ) ; <nl> <nl> mmm a / src / php / ext / grpc / server_credentials . c <nl> ppp b / src / php / ext / grpc / server_credentials . c <nl> <nl> <nl> zend_class_entry * grpc_ce_server_credentials ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Frees and destroys an instace of wrapped_grpc_server_credentials * / <nl> void free_wrapped_grpc_server_credentials ( void * object TSRMLS_DC ) { <nl> wrapped_grpc_server_credentials * creds = <nl> void free_wrapped_grpc_server_credentials ( void * object TSRMLS_DC ) { <nl> if ( creds - > wrapped ! = NULL ) { <nl> grpc_server_credentials_release ( creds - > wrapped ) ; <nl> } <nl> + zend_object_std_dtor ( & creds - > std TSRMLS_CC ) ; <nl> efree ( creds ) ; <nl> } <nl> <nl> zend_object_value create_wrapped_grpc_server_credentials ( <nl> return retval ; <nl> } <nl> <nl> - zval * grpc_php_wrap_server_credentials ( grpc_server_credentials * wrapped TSRMLS_DC ) { <nl> + zval * grpc_php_wrap_server_credentials ( grpc_server_credentials <nl> + * wrapped TSRMLS_DC ) { <nl> zval * server_credentials_object ; <nl> MAKE_STD_ZVAL ( server_credentials_object ) ; <nl> object_init_ex ( server_credentials_object , grpc_ce_server_credentials ) ; <nl> zval * grpc_php_wrap_server_credentials ( grpc_server_credentials * wrapped TSRMLS_D <nl> return server_credentials_object ; <nl> } <nl> <nl> + # else <nl> + <nl> + static zend_object_handlers server_credentials_ce_handlers ; <nl> + <nl> + / * Frees and destroys an instace of wrapped_grpc_server_credentials * / <nl> + static void free_wrapped_grpc_server_credentials ( zend_object * object ) { <nl> + wrapped_grpc_server_credentials * creds = <nl> + wrapped_grpc_server_creds_from_obj ( object ) ; <nl> + if ( creds - > wrapped ! = NULL ) { <nl> + grpc_server_credentials_release ( creds - > wrapped ) ; <nl> + } <nl> + zend_object_std_dtor ( & creds - > std ) ; <nl> + } <nl> + <nl> + / * Initializes an instace of wrapped_grpc_server_credentials to be associated <nl> + * with an object of a class specified by class_type * / <nl> + zend_object * create_wrapped_grpc_server_credentials ( zend_class_entry <nl> + * class_type ) { <nl> + wrapped_grpc_server_credentials * intern ; <nl> + intern = ecalloc ( 1 , sizeof ( wrapped_grpc_server_credentials ) + <nl> + zend_object_properties_size ( class_type ) ) ; <nl> + zend_object_std_init ( & intern - > std , class_type ) ; <nl> + object_properties_init ( & intern - > std , class_type ) ; <nl> + intern - > std . handlers = & server_credentials_ce_handlers ; <nl> + return & intern - > std ; <nl> + } <nl> + <nl> + void grpc_php_wrap_server_credentials ( grpc_server_credentials * wrapped , <nl> + zval * server_credentials_object ) { <nl> + object_init_ex ( server_credentials_object , grpc_ce_server_credentials ) ; <nl> + wrapped_grpc_server_credentials * server_credentials = <nl> + Z_WRAPPED_GRPC_SERVER_CREDS_P ( server_credentials_object ) ; <nl> + server_credentials - > wrapped = wrapped ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> / * * <nl> * Create SSL credentials . <nl> * @ param string pem_root_certs PEM encoding of the server root certificates <nl> PHP_METHOD ( ServerCredentials , createSsl ) { <nl> char * pem_root_certs = 0 ; <nl> grpc_ssl_pem_key_cert_pair pem_key_cert_pair ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> int root_certs_length = 0 , private_key_length , cert_chain_length ; <nl> + # else <nl> + size_t root_certs_length = 0 , private_key_length , cert_chain_length ; <nl> + # endif <nl> <nl> / * " s ! ss " = = 1 nullable string , 2 strings * / <nl> / * TODO : support multiple key cert pairs . * / <nl> PHP_METHOD ( ServerCredentials , createSsl ) { <nl> grpc_server_credentials * creds = grpc_ssl_server_credentials_create_ex ( <nl> pem_root_certs , & pem_key_cert_pair , 1 , <nl> GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE , NULL ) ; <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * creds_object = grpc_php_wrap_server_credentials ( creds TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( creds_object ) ; <nl> + # else <nl> + grpc_php_wrap_server_credentials ( creds , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> static zend_function_entry server_credentials_methods [ ] = { <nl> - PHP_ME ( ServerCredentials , createSsl , NULL , <nl> - ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) PHP_FE_END } ; <nl> + PHP_ME ( ServerCredentials , createSsl , NULL , <nl> + ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> + PHP_FE_END <nl> + } ; <nl> <nl> void grpc_init_server_credentials ( TSRMLS_D ) { <nl> zend_class_entry ce ; <nl> INIT_CLASS_ENTRY ( ce , " Grpc \ \ ServerCredentials " , server_credentials_methods ) ; <nl> ce . create_object = create_wrapped_grpc_server_credentials ; <nl> grpc_ce_server_credentials = zend_register_internal_class ( & ce TSRMLS_CC ) ; <nl> + # if PHP_MAJOR_VERSION > = 7 <nl> + memcpy ( & server_credentials_ce_handlers , <nl> + zend_get_std_object_handlers ( ) , <nl> + sizeof ( zend_object_handlers ) ) ; <nl> + server_credentials_ce_handlers . offset = <nl> + XtOffsetOf ( wrapped_grpc_server_credentials , std ) ; <nl> + server_credentials_ce_handlers . free_obj = <nl> + free_wrapped_grpc_server_credentials ; <nl> + # endif <nl> } <nl> mmm a / src / php / ext / grpc / server_credentials . h <nl> ppp b / src / php / ext / grpc / server_credentials . h <nl> <nl> / * Class entry for the Server_Credentials PHP class * / <nl> extern zend_class_entry * grpc_ce_server_credentials ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Wrapper struct for grpc_server_credentials that can be associated with a PHP <nl> * object * / <nl> typedef struct wrapped_grpc_server_credentials { <nl> zend_object std ; <nl> + grpc_server_credentials * wrapped ; <nl> + } wrapped_grpc_server_credentials ; <nl> <nl> + # else <nl> + <nl> + typedef struct wrapped_grpc_server_credentials { <nl> grpc_server_credentials * wrapped ; <nl> + zend_object std ; <nl> } wrapped_grpc_server_credentials ; <nl> <nl> + static inline wrapped_grpc_server_credentials <nl> + * wrapped_grpc_server_creds_from_obj ( zend_object * obj ) { <nl> + return ( wrapped_grpc_server_credentials * ) <nl> + ( ( char * ) ( obj ) - <nl> + XtOffsetOf ( wrapped_grpc_server_credentials , std ) ) ; <nl> + } <nl> + <nl> + # define Z_WRAPPED_GRPC_SERVER_CREDS_P ( zv ) \ <nl> + wrapped_grpc_server_creds_from_obj ( Z_OBJ_P ( ( zv ) ) ) <nl> + <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> + <nl> / * Initializes the Server_Credentials PHP class * / <nl> void grpc_init_server_credentials ( TSRMLS_D ) ; <nl> <nl> mmm a / src / php / ext / grpc / timeval . c <nl> ppp b / src / php / ext / grpc / timeval . c <nl> <nl> <nl> zend_class_entry * grpc_ce_timeval ; <nl> <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> / * Frees and destroys an instance of wrapped_grpc_call * / <nl> - void free_wrapped_grpc_timeval ( void * object TSRMLS_DC ) { efree ( object ) ; } <nl> + void free_wrapped_grpc_timeval ( void * object TSRMLS_DC ) { <nl> + wrapped_grpc_timeval * timeval = ( wrapped_grpc_timeval * ) object ; <nl> + zend_object_std_dtor ( & timeval - > std TSRMLS_CC ) ; <nl> + efree ( timeval ) ; <nl> + } <nl> <nl> / * Initializes an instance of wrapped_grpc_timeval to be associated with an <nl> * object of a class specified by class_type * / <nl> zval * grpc_php_wrap_timeval ( gpr_timespec wrapped TSRMLS_DC ) { <nl> return timeval_object ; <nl> } <nl> <nl> + # else <nl> + <nl> + static zend_object_handlers timeval_ce_handlers ; <nl> + <nl> + / * Frees and destroys an instance of wrapped_grpc_call * / <nl> + static void free_wrapped_grpc_timeval ( zend_object * object ) { <nl> + wrapped_grpc_timeval * timeval = wrapped_grpc_timeval_from_obj ( object ) ; <nl> + zend_object_std_dtor ( & timeval - > std ) ; <nl> + } <nl> + <nl> + / * Initializes an instance of wrapped_grpc_timeval to be associated with an <nl> + * object of a class specified by class_type * / <nl> + zend_object * create_wrapped_grpc_timeval ( zend_class_entry * class_type ) { <nl> + wrapped_grpc_timeval * intern ; <nl> + intern = ecalloc ( 1 , sizeof ( wrapped_grpc_timeval ) + <nl> + zend_object_properties_size ( class_type ) ) ; <nl> + zend_object_std_init ( & intern - > std , class_type ) ; <nl> + object_properties_init ( & intern - > std , class_type ) ; <nl> + intern - > std . handlers = & timeval_ce_handlers ; <nl> + return & intern - > std ; <nl> + } <nl> + <nl> + void grpc_php_wrap_timeval ( gpr_timespec wrapped , zval * timeval_object ) { <nl> + object_init_ex ( timeval_object , grpc_ce_timeval ) ; <nl> + wrapped_grpc_timeval * timeval = Z_WRAPPED_GRPC_TIMEVAL_P ( timeval_object ) ; <nl> + memcpy ( & timeval - > wrapped , & wrapped , sizeof ( gpr_timespec ) ) ; <nl> + } <nl> + <nl> + # endif <nl> + <nl> / * * <nl> * Constructs a new instance of the Timeval class <nl> * @ param long $ usec The number of microseconds in the interval <nl> * / <nl> PHP_METHOD ( Timeval , __construct ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * timeval = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> long microseconds ; <nl> + # else <nl> + wrapped_grpc_timeval * timeval = Z_WRAPPED_GRPC_TIMEVAL_P ( getThis ( ) ) ; <nl> + zend_long microseconds ; <nl> + # endif <nl> + <nl> / * " l " = = 1 long * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " l " , & microseconds ) = = <nl> FAILURE ) { <nl> PHP_METHOD ( Timeval , __construct ) { <nl> * / <nl> PHP_METHOD ( Timeval , add ) { <nl> zval * other_obj ; <nl> + <nl> / * " O " = = 1 Object * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " O " , & other_obj , <nl> grpc_ce_timeval ) = = FAILURE ) { <nl> PHP_METHOD ( Timeval , add ) { <nl> " add expects a Timeval " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * self = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> wrapped_grpc_timeval * other = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( other_obj TSRMLS_CC ) ; <nl> zval * sum = <nl> - grpc_php_wrap_timeval ( gpr_time_add ( self - > wrapped , other - > wrapped ) TSRMLS_CC ) ; <nl> + grpc_php_wrap_timeval ( gpr_time_add ( self - > wrapped , other - > wrapped ) <nl> + TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( sum ) ; <nl> + # else <nl> + wrapped_grpc_timeval * self = Z_WRAPPED_GRPC_TIMEVAL_P ( getThis ( ) ) ; <nl> + wrapped_grpc_timeval * other = Z_WRAPPED_GRPC_TIMEVAL_P ( other_obj ) ; <nl> + <nl> + grpc_php_wrap_timeval ( gpr_time_add ( self - > wrapped , other - > wrapped ) , <nl> + return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Timeval , add ) { <nl> * / <nl> PHP_METHOD ( Timeval , subtract ) { <nl> zval * other_obj ; <nl> + <nl> / * " O " = = 1 Object * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " O " , & other_obj , <nl> grpc_ce_timeval ) = = FAILURE ) { <nl> PHP_METHOD ( Timeval , subtract ) { <nl> " subtract expects a Timeval " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * self = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> wrapped_grpc_timeval * other = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( other_obj TSRMLS_CC ) ; <nl> zval * diff = <nl> - grpc_php_wrap_timeval ( gpr_time_sub ( self - > wrapped , other - > wrapped ) TSRMLS_CC ) ; <nl> + grpc_php_wrap_timeval ( gpr_time_sub ( self - > wrapped , other - > wrapped ) <nl> + TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( diff ) ; <nl> + # else <nl> + wrapped_grpc_timeval * self = Z_WRAPPED_GRPC_TIMEVAL_P ( getThis ( ) ) ; <nl> + wrapped_grpc_timeval * other = Z_WRAPPED_GRPC_TIMEVAL_P ( other_obj ) ; <nl> + grpc_php_wrap_timeval ( gpr_time_sub ( self - > wrapped , other - > wrapped ) , <nl> + return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Timeval , subtract ) { <nl> * @ return long <nl> * / <nl> PHP_METHOD ( Timeval , compare ) { <nl> - zval * a_obj , * b_obj ; <nl> + zval * a_obj ; <nl> + zval * b_obj ; <nl> + <nl> / * " OO " = = 2 Objects * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " OO " , & a_obj , <nl> grpc_ce_timeval , & b_obj , <nl> PHP_METHOD ( Timeval , compare ) { <nl> " compare expects two Timevals " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * a = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( a_obj TSRMLS_CC ) ; <nl> wrapped_grpc_timeval * b = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( b_obj TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_timeval * a = Z_WRAPPED_GRPC_TIMEVAL_P ( a_obj ) ; <nl> + wrapped_grpc_timeval * b = Z_WRAPPED_GRPC_TIMEVAL_P ( b_obj ) ; <nl> + # endif <nl> long result = gpr_time_cmp ( a - > wrapped , b - > wrapped ) ; <nl> RETURN_LONG ( result ) ; <nl> } <nl> PHP_METHOD ( Timeval , compare ) { <nl> * @ return bool True if $ a and $ b are within $ threshold , False otherwise <nl> * / <nl> PHP_METHOD ( Timeval , similar ) { <nl> - zval * a_obj , * b_obj , * thresh_obj ; <nl> + zval * a_obj ; <nl> + zval * b_obj ; <nl> + zval * thresh_obj ; <nl> + <nl> / * " OOO " = = 3 Objects * / <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " OOO " , & a_obj , <nl> grpc_ce_timeval , & b_obj , grpc_ce_timeval , <nl> PHP_METHOD ( Timeval , similar ) { <nl> " compare expects three Timevals " , 1 TSRMLS_CC ) ; <nl> return ; <nl> } <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * a = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( a_obj TSRMLS_CC ) ; <nl> wrapped_grpc_timeval * b = <nl> PHP_METHOD ( Timeval , similar ) { <nl> wrapped_grpc_timeval * thresh = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( <nl> thresh_obj TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_timeval * a = Z_WRAPPED_GRPC_TIMEVAL_P ( a_obj ) ; <nl> + wrapped_grpc_timeval * b = Z_WRAPPED_GRPC_TIMEVAL_P ( b_obj ) ; <nl> + wrapped_grpc_timeval * thresh = Z_WRAPPED_GRPC_TIMEVAL_P ( thresh_obj ) ; <nl> + # endif <nl> int result = gpr_time_similar ( a - > wrapped , b - > wrapped , thresh - > wrapped ) ; <nl> RETURN_BOOL ( result ) ; <nl> } <nl> PHP_METHOD ( Timeval , similar ) { <nl> * @ return Timeval The current time <nl> * / <nl> PHP_METHOD ( Timeval , now ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * now = grpc_php_wrap_timeval ( gpr_now ( GPR_CLOCK_REALTIME ) TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( now ) ; <nl> + # else <nl> + grpc_php_wrap_timeval ( gpr_now ( GPR_CLOCK_REALTIME ) , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Timeval , now ) { <nl> * @ return Timeval Zero length time interval <nl> * / <nl> PHP_METHOD ( Timeval , zero ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * grpc_php_timeval_zero = <nl> grpc_php_wrap_timeval ( gpr_time_0 ( GPR_CLOCK_REALTIME ) TSRMLS_CC ) ; <nl> RETURN_ZVAL ( grpc_php_timeval_zero , <nl> false , / * Copy original before returning ? * / <nl> true / * Destroy original before returning * / ) ; <nl> + # else <nl> + grpc_php_wrap_timeval ( gpr_time_0 ( GPR_CLOCK_REALTIME ) , return_value ) ; <nl> + RETURN_ZVAL ( return_value , <nl> + false , / * Copy original before returning ? * / <nl> + true / * Destroy original before returning * / ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Timeval , zero ) { <nl> * @ return Timeval Infinite future time value <nl> * / <nl> PHP_METHOD ( Timeval , infFuture ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * grpc_php_timeval_inf_future = <nl> grpc_php_wrap_timeval ( gpr_inf_future ( GPR_CLOCK_REALTIME ) TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( grpc_php_timeval_inf_future ) ; <nl> + # else <nl> + grpc_php_wrap_timeval ( gpr_inf_future ( GPR_CLOCK_REALTIME ) , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Timeval , infFuture ) { <nl> * @ return Timeval Infinite past time value <nl> * / <nl> PHP_METHOD ( Timeval , infPast ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * grpc_php_timeval_inf_past = <nl> grpc_php_wrap_timeval ( gpr_inf_past ( GPR_CLOCK_REALTIME ) TSRMLS_CC ) ; <nl> RETURN_DESTROY_ZVAL ( grpc_php_timeval_inf_past ) ; <nl> + # else <nl> + grpc_php_wrap_timeval ( gpr_inf_past ( GPR_CLOCK_REALTIME ) , return_value ) ; <nl> + RETURN_DESTROY_ZVAL ( return_value ) ; <nl> + # endif <nl> } <nl> <nl> / * * <nl> PHP_METHOD ( Timeval , infPast ) { <nl> * @ return void <nl> * / <nl> PHP_METHOD ( Timeval , sleepUntil ) { <nl> + # if PHP_MAJOR_VERSION < 7 <nl> wrapped_grpc_timeval * this = <nl> ( wrapped_grpc_timeval * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; <nl> + # else <nl> + wrapped_grpc_timeval * this = Z_WRAPPED_GRPC_TIMEVAL_P ( getThis ( ) ) ; <nl> + # endif <nl> gpr_sleep_until ( this - > wrapped ) ; <nl> } <nl> <nl> static zend_function_entry timeval_methods [ ] = { <nl> - PHP_ME ( Timeval , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> - PHP_ME ( Timeval , add , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Timeval , compare , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> - PHP_ME ( Timeval , infFuture , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> - PHP_ME ( Timeval , infPast , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> - PHP_ME ( Timeval , now , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> - PHP_ME ( Timeval , similar , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> - PHP_ME ( Timeval , sleepUntil , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Timeval , subtract , NULL , ZEND_ACC_PUBLIC ) <nl> - PHP_ME ( Timeval , zero , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) PHP_FE_END } ; <nl> + PHP_ME ( Timeval , __construct , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_CTOR ) <nl> + PHP_ME ( Timeval , add , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Timeval , compare , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> + PHP_ME ( Timeval , infFuture , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> + PHP_ME ( Timeval , infPast , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> + PHP_ME ( Timeval , now , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> + PHP_ME ( Timeval , similar , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> + PHP_ME ( Timeval , sleepUntil , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Timeval , subtract , NULL , ZEND_ACC_PUBLIC ) <nl> + PHP_ME ( Timeval , zero , NULL , ZEND_ACC_PUBLIC | ZEND_ACC_STATIC ) <nl> + PHP_FE_END <nl> + } ; <nl> <nl> void grpc_init_timeval ( TSRMLS_D ) { <nl> zend_class_entry ce ; <nl> INIT_CLASS_ENTRY ( ce , " Grpc \ \ Timeval " , timeval_methods ) ; <nl> ce . create_object = create_wrapped_grpc_timeval ; <nl> grpc_ce_timeval = zend_register_internal_class ( & ce TSRMLS_CC ) ; <nl> + # if PHP_MAJOR_VERSION > = 7 <nl> + memcpy ( & timeval_ce_handlers , zend_get_std_object_handlers ( ) , <nl> + sizeof ( zend_object_handlers ) ) ; <nl> + timeval_ce_handlers . offset = <nl> + XtOffsetOf ( wrapped_grpc_timeval , std ) ; <nl> + timeval_ce_handlers . free_obj = free_wrapped_grpc_timeval ; <nl> + # endif <nl> } <nl> <nl> void grpc_shutdown_timeval ( TSRMLS_D ) { } <nl> mmm a / src / php / ext / grpc / timeval . h <nl> ppp b / src / php / ext / grpc / timeval . h <nl> <nl> extern zend_class_entry * grpc_ce_timeval ; <nl> <nl> / * Wrapper struct for timeval that can be associated with a PHP object * / <nl> + # if PHP_MAJOR_VERSION < 7 <nl> + <nl> typedef struct wrapped_grpc_timeval { <nl> zend_object std ; <nl> + gpr_timespec wrapped ; <nl> + } wrapped_grpc_timeval ; <nl> <nl> + # else <nl> + <nl> + typedef struct wrapped_grpc_timeval { <nl> gpr_timespec wrapped ; <nl> + zend_object std ; <nl> } wrapped_grpc_timeval ; <nl> <nl> + static inline wrapped_grpc_timeval <nl> + * wrapped_grpc_timeval_from_obj ( zend_object * obj ) { <nl> + return ( wrapped_grpc_timeval * ) ( ( char * ) ( obj ) - <nl> + XtOffsetOf ( wrapped_grpc_timeval , std ) ) ; <nl> + } <nl> + <nl> + # define Z_WRAPPED_GRPC_TIMEVAL_P ( zv ) \ <nl> + wrapped_grpc_timeval_from_obj ( Z_OBJ_P ( ( zv ) ) ) <nl> + <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> + <nl> / * Initialize the Timeval PHP class * / <nl> void grpc_init_timeval ( TSRMLS_D ) ; <nl> <nl> void grpc_init_timeval ( TSRMLS_D ) ; <nl> void grpc_shutdown_timeval ( TSRMLS_D ) ; <nl> <nl> / * Creates a Timeval object that wraps the given timeval struct * / <nl> + # if PHP_MAJOR_VERSION < 7 <nl> zval * grpc_php_wrap_timeval ( gpr_timespec wrapped TSRMLS_DC ) ; <nl> + # else <nl> + void grpc_php_wrap_timeval ( gpr_timespec wrapped , zval * timeval_object ) ; <nl> + # endif / * PHP_MAJOR_VERSION * / <nl> <nl> # endif / * NET_GRPC_PHP_GRPC_TIMEVAL_H_ * / <nl> old mode 100755 <nl> new mode 100644 <nl> index df3fe85d447 . . 2fec1bd9cc4 <nl> mmm a / src / php / lib / Grpc / BaseStub . php <nl> ppp b / src / php / lib / Grpc / BaseStub . php <nl> public function __construct ( $ hostname , $ opts , $ channel = null ) <nl> } <nl> if ( $ channel ) { <nl> if ( ! is_a ( $ channel , ' Channel ' ) ) { <nl> - throw new \ Exception ( " The channel argument is not a " . <nl> - " Channel object " ) ; <nl> + throw new \ Exception ( ' The channel argument is not a ' . <nl> + ' Channel object ' ) ; <nl> } <nl> $ this - > channel = $ channel ; <nl> } else { <nl> mmm a / src / php / lib / Grpc / BidiStreamingCall . php <nl> ppp b / src / php / lib / Grpc / BidiStreamingCall . php <nl> public function getStatus ( ) <nl> ] ) ; <nl> <nl> $ this - > trailing_metadata = $ status_event - > status - > metadata ; <nl> + <nl> return $ status_event - > status ; <nl> } <nl> } <nl> mmm a / src / php / lib / Grpc / ClientStreamingCall . php <nl> ppp b / src / php / lib / Grpc / ClientStreamingCall . php <nl> public function wait ( ) <nl> <nl> $ status = $ event - > status ; <nl> $ this - > trailing_metadata = $ status - > metadata ; <nl> + <nl> return [ $ this - > deserializeResponse ( $ event - > message ) , $ status ] ; <nl> } <nl> } <nl> mmm a / src / php / lib / Grpc / ServerStreamingCall . php <nl> ppp b / src / php / lib / Grpc / ServerStreamingCall . php <nl> public function getStatus ( ) <nl> ] ) ; <nl> <nl> $ this - > trailing_metadata = $ status_event - > status - > metadata ; <nl> + <nl> return $ status_event - > status ; <nl> } <nl> } <nl> mmm a / src / php / lib / Grpc / UnaryCall . php <nl> ppp b / src / php / lib / Grpc / UnaryCall . php <nl> public function wait ( ) <nl> <nl> $ status = $ event - > status ; <nl> $ this - > trailing_metadata = $ status - > metadata ; <nl> + <nl> return [ $ this - > deserializeResponse ( $ event - > message ) , $ status ] ; <nl> } <nl> } <nl> mmm a / src / php / tests / interop / interop_client . php <nl> ppp b / src / php / tests / interop / interop_client . php <nl> function statusCodeAndMessage ( $ stub ) <nl> { <nl> $ echo_status = new grpc \ testing \ EchoStatus ( ) ; <nl> $ echo_status - > setCode ( 2 ) ; <nl> - $ echo_status - > setMessage ( " test status message " ) ; <nl> + $ echo_status - > setMessage ( ' test status message ' ) ; <nl> <nl> $ request = new grpc \ testing \ SimpleRequest ( ) ; <nl> $ request - > setResponseStatus ( $ echo_status ) ; <nl> function statusCodeAndMessage ( $ stub ) <nl> <nl> hardAssert ( $ status - > code = = = 2 , <nl> ' Received unexpected status code ' ) ; <nl> - hardAssert ( $ status - > details = = = " test status message " , <nl> + hardAssert ( $ status - > details = = = ' test status message ' , <nl> ' Received unexpected status details ' ) ; <nl> <nl> $ streaming_call = $ stub - > FullDuplexCall ( ) ; <nl> function statusCodeAndMessage ( $ stub ) <nl> $ status = $ streaming_call - > getStatus ( ) ; <nl> hardAssert ( $ status - > code = = = 2 , <nl> ' Received unexpected status code ' ) ; <nl> - hardAssert ( $ status - > details = = = " test status message " , <nl> + hardAssert ( $ status - > details = = = ' test status message ' , <nl> ' Received unexpected status details ' ) ; <nl> } <nl> <nl> function ( $ metadata , <nl> } <nl> <nl> if ( $ test_case = = ' unimplemented_method ' ) { <nl> - $ stub = new grpc \ testing \ UnimplementedServiceClient ( $ server_address , $ opts ) ; <nl> + $ stub = new grpc \ testing \ UnimplementedServiceClient ( $ server_address , $ opts ) ; <nl> } else { <nl> - $ stub = new grpc \ testing \ TestServiceClient ( $ server_address , $ opts ) ; <nl> + $ stub = new grpc \ testing \ TestServiceClient ( $ server_address , $ opts ) ; <nl> } <nl> <nl> return $ stub ; <nl> mmm a / src / php / tests / unit_tests / CallCredentialsTest . php <nl> ppp b / src / php / tests / unit_tests / CallCredentialsTest . php <nl> public function testCreateComposite ( ) <nl> $ this - > call_credentials , <nl> $ call_credentials2 <nl> ) ; <nl> - $ this - > assertSame ( ' Grpc \ CallCredentials ' , get_class ( $ call_credentials3 ) ) ; <nl> + $ this - > assertSame ( ' Grpc \ CallCredentials ' , <nl> + get_class ( $ call_credentials3 ) ) ; <nl> } <nl> <nl> / * * <nl> old mode 100755 <nl> new mode 100644 <nl> index fa026f09350 . . d736f515460 <nl> mmm a / src / php / tests / unit_tests / CallTest . php <nl> ppp b / src / php / tests / unit_tests / CallTest . php <nl> public function setUp ( ) <nl> Grpc \ Timeval : : infFuture ( ) ) ; <nl> } <nl> <nl> + public function tearDown ( ) <nl> + { <nl> + unset ( $ this - > call ) ; <nl> + unset ( $ this - > channel ) ; <nl> + } <nl> + <nl> + public function testConstructor ( ) <nl> + { <nl> + $ this - > assertSame ( ' Grpc \ Call ' , get_class ( $ this - > call ) ) ; <nl> + $ this - > assertObjectHasAttribute ( ' channel ' , $ this - > call ) ; <nl> + } <nl> + <nl> public function testAddEmptyMetadata ( ) <nl> { <nl> $ batch = [ <nl> public function testAddSingleAndMultiValueMetadata ( ) <nl> { <nl> $ batch = [ <nl> Grpc \ OP_SEND_INITIAL_METADATA = > [ ' key1 ' = > [ ' value1 ' ] , <nl> - ' key2 ' = > [ ' value2 ' , ' value3 ' ] , ] , <nl> + ' key2 ' = > [ ' value2 ' , <nl> + ' value3 ' ] , ] , <nl> ] ; <nl> $ result = $ this - > call - > startBatch ( $ batch ) ; <nl> $ this - > assertTrue ( $ result - > send_metadata ) ; <nl> public function testInvalidMetadataInnerValue ( ) <nl> ] ; <nl> $ result = $ this - > call - > startBatch ( $ batch ) ; <nl> } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidConstuctor ( ) <nl> + { <nl> + $ this - > call = new Grpc \ Call ( ) ; <nl> + $ this - > assertNull ( $ this - > call ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidConstuctor2 ( ) <nl> + { <nl> + $ this - > call = new Grpc \ Call ( ' hi ' , ' hi ' , ' hi ' ) ; <nl> + $ this - > assertNull ( $ this - > call ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidSetCredentials ( ) <nl> + { <nl> + $ this - > call - > setCredentials ( ' hi ' ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidSetCredentials2 ( ) <nl> + { <nl> + $ this - > call - > setCredentials ( [ ] ) ; <nl> + } <nl> } <nl> mmm a / src / php / tests / unit_tests / ChannelCredentialsTest . php <nl> ppp b / src / php / tests / unit_tests / ChannelCredentialsTest . php <nl> public function tearDown ( ) <nl> { <nl> } <nl> <nl> - public function testCreateDefault ( ) <nl> + public function testCreateSslWith3Null ( ) <nl> { <nl> - $ channel_credentials = Grpc \ ChannelCredentials : : createDefault ( ) ; <nl> - $ this - > assertSame ( ' Grpc \ ChannelCredentials ' , get_class ( $ channel_credentials ) ) ; <nl> + $ channel_credentials = Grpc \ ChannelCredentials : : createSsl ( null , null , <nl> + null ) ; <nl> + $ this - > assertNotNull ( $ channel_credentials ) ; <nl> + } <nl> + <nl> + public function testCreateSslWith3NullString ( ) <nl> + { <nl> + $ channel_credentials = Grpc \ ChannelCredentials : : createSsl ( ' ' , ' ' , ' ' ) ; <nl> + $ this - > assertNotNull ( $ channel_credentials ) ; <nl> + } <nl> + <nl> + public function testCreateInsecure ( ) <nl> + { <nl> + $ channel_credentials = Grpc \ ChannelCredentials : : createInsecure ( ) ; <nl> + $ this - > assertNull ( $ channel_credentials ) ; <nl> } <nl> <nl> / * * <nl> public function testInvalidCreateComposite ( ) <nl> $ channel_credentials = Grpc \ ChannelCredentials : : createComposite ( <nl> ' something ' , ' something ' ) ; <nl> } <nl> - <nl> - public function testCreateInsecure ( ) <nl> - { <nl> - $ channel_credentials = Grpc \ ChannelCredentials : : createInsecure ( ) ; <nl> - $ this - > assertNull ( $ channel_credentials ) ; <nl> - } <nl> } <nl> mmm a / src / php / tests / unit_tests / ChannelTest . php <nl> ppp b / src / php / tests / unit_tests / ChannelTest . php <nl> public function setUp ( ) <nl> <nl> public function tearDown ( ) <nl> { <nl> + unset ( $ this - > channel ) ; <nl> } <nl> <nl> public function testInsecureCredentials ( ) <nl> public function testInsecureCredentials ( ) <nl> $ this - > assertSame ( ' Grpc \ Channel ' , get_class ( $ this - > channel ) ) ; <nl> } <nl> <nl> + public function testGetConnectivityState ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ state = $ this - > channel - > getConnectivityState ( ) ; <nl> + $ this - > assertEquals ( 0 , $ state ) ; <nl> + } <nl> + <nl> + public function testGetConnectivityStateWithInt ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ state = $ this - > channel - > getConnectivityState ( 123 ) ; <nl> + $ this - > assertEquals ( 0 , $ state ) ; <nl> + } <nl> + <nl> + public function testGetConnectivityStateWithString ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ state = $ this - > channel - > getConnectivityState ( ' hello ' ) ; <nl> + $ this - > assertEquals ( 0 , $ state ) ; <nl> + } <nl> + <nl> + public function testGetConnectivityStateWithBool ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ state = $ this - > channel - > getConnectivityState ( true ) ; <nl> + $ this - > assertEquals ( 0 , $ state ) ; <nl> + } <nl> + <nl> + public function testGetTarget ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 8888 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ target = $ this - > channel - > getTarget ( ) ; <nl> + $ this - > assertTrue ( is_string ( $ target ) ) ; <nl> + } <nl> + <nl> + public function testWatchConnectivityState ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ time = new Grpc \ Timeval ( 1000 ) ; <nl> + $ state = $ this - > channel - > watchConnectivityState ( 123 , $ time ) ; <nl> + $ this - > assertTrue ( $ state ) ; <nl> + unset ( $ time ) ; <nl> + } <nl> + <nl> + public function testClose ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ this - > assertNotNull ( $ this - > channel ) ; <nl> + $ this - > channel - > close ( ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidConstructorWithNull ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ) ; <nl> + $ this - > assertNull ( $ this - > channel ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidConstructorWith ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost ' , ' invalid ' ) ; <nl> + $ this - > assertNull ( $ this - > channel ) ; <nl> + } <nl> + <nl> / * * <nl> * @ expectedException InvalidArgumentException <nl> * / <nl> public function testInvalidOptionsArray ( ) <nl> ] <nl> ) ; <nl> } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidGetConnectivityStateWithArray ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ this - > channel - > getConnectivityState ( [ ] ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidWatchConnectivityState ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ this - > channel - > watchConnectivityState ( [ ] ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidWatchConnectivityState2 ( ) <nl> + { <nl> + $ this - > channel = new Grpc \ Channel ( ' localhost : 0 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + $ this - > channel - > watchConnectivityState ( 1 , ' hi ' ) ; <nl> + } <nl> } <nl> old mode 100755 <nl> new mode 100644 <nl> index 2b09f9d112a . . 09364580c01 <nl> mmm a / src / php / tests / unit_tests / EndToEndTest . php <nl> ppp b / src / php / tests / unit_tests / EndToEndTest . php <nl> public function testGetTarget ( ) <nl> <nl> public function testGetConnectivityState ( ) <nl> { <nl> - $ this - > assertTrue ( $ this - > channel - > getConnectivityState ( ) = = Grpc \ CHANNEL_IDLE ) ; <nl> + $ this - > assertTrue ( $ this - > channel - > getConnectivityState ( ) = = <nl> + Grpc \ CHANNEL_IDLE ) ; <nl> } <nl> <nl> public function testWatchConnectivityStateFailed ( ) <nl> old mode 100755 <nl> new mode 100644 <nl> mmm a / src / php / tests / unit_tests / ServerTest . php <nl> ppp b / src / php / tests / unit_tests / ServerTest . php <nl> class ServerTest extends PHPUnit_Framework_TestCase <nl> { <nl> public function setUp ( ) <nl> { <nl> + $ this - > server = null ; <nl> } <nl> <nl> public function tearDown ( ) <nl> { <nl> + unset ( $ this - > server ) ; <nl> + } <nl> + <nl> + public function testConstructorWithNull ( ) <nl> + { <nl> + $ this - > server = new Grpc \ Server ( ) ; <nl> + $ this - > assertNotNull ( $ this - > server ) ; <nl> + } <nl> + <nl> + public function testConstructorWithNullArray ( ) <nl> + { <nl> + $ this - > server = new Grpc \ Server ( [ ] ) ; <nl> + $ this - > assertNotNull ( $ this - > server ) ; <nl> + } <nl> + <nl> + public function testConstructorWithArray ( ) <nl> + { <nl> + / / key of array must be string <nl> + $ this - > server = new Grpc \ Server ( [ ' ip ' = > ' 127 . 0 . 0 . 1 ' , <nl> + ' port ' = > ' 8080 ' , ] ) ; <nl> + $ this - > assertNotNull ( $ this - > server ) ; <nl> + } <nl> + <nl> + public function testRequestCall ( ) <nl> + { <nl> + $ this - > server = new Grpc \ Server ( ) ; <nl> + $ port = $ this - > server - > addHttp2Port ( ' 0 . 0 . 0 . 0 : 8888 ' ) ; <nl> + $ this - > server - > start ( ) ; <nl> + $ channel = new Grpc \ Channel ( ' localhost : 8888 ' , <nl> + [ ' credentials ' = > Grpc \ ChannelCredentials : : createInsecure ( ) ] ) ; <nl> + <nl> + $ deadline = Grpc \ Timeval : : infFuture ( ) ; <nl> + $ call = new Grpc \ Call ( $ channel , ' dummy_method ' , $ deadline ) ; <nl> + <nl> + $ event = $ call - > startBatch ( [ Grpc \ OP_SEND_INITIAL_METADATA = > [ ] , <nl> + Grpc \ OP_SEND_CLOSE_FROM_CLIENT = > true , <nl> + ] ) ; <nl> + <nl> + $ c = $ this - > server - > requestCall ( ) ; <nl> + $ this - > assertObjectHasAttribute ( ' call ' , $ c ) ; <nl> + $ this - > assertObjectHasAttribute ( ' method ' , $ c ) ; <nl> + $ this - > assertSame ( ' dummy_method ' , $ c - > method ) ; <nl> + $ this - > assertObjectHasAttribute ( ' host ' , $ c ) ; <nl> + $ this - > assertTrue ( is_string ( $ c - > host ) ) ; <nl> + $ this - > assertObjectHasAttribute ( ' absolute_deadline ' , $ c ) ; <nl> + $ this - > assertObjectHasAttribute ( ' metadata ' , $ c ) ; <nl> + <nl> + unset ( $ call ) ; <nl> + unset ( $ channel ) ; <nl> + } <nl> + <nl> + private function createSslObj ( ) <nl> + { <nl> + $ server_credentials = Grpc \ ServerCredentials : : createSsl ( <nl> + null , <nl> + file_get_contents ( dirname ( __FILE__ ) . ' / . . / data / server1 . key ' ) , <nl> + file_get_contents ( dirname ( __FILE__ ) . ' / . . / data / server1 . pem ' ) ) ; <nl> + <nl> + return $ server_credentials ; <nl> } <nl> <nl> / * * <nl> public function tearDown ( ) <nl> * / <nl> public function testInvalidConstructor ( ) <nl> { <nl> - $ server = new Grpc \ Server ( ' invalid_host ' ) ; <nl> + $ this - > server = new Grpc \ Server ( ' invalid_host ' ) ; <nl> + $ this - > assertNull ( $ this - > server ) ; <nl> } <nl> <nl> / * * <nl> public function testInvalidConstructor ( ) <nl> public function testInvalidAddHttp2Port ( ) <nl> { <nl> $ this - > server = new Grpc \ Server ( [ ] ) ; <nl> - $ this - > port = $ this - > server - > addHttp2Port ( [ ' 0 . 0 . 0 . 0 : 0 ' ] ) ; <nl> + $ port = $ this - > server - > addHttp2Port ( [ ' 0 . 0 . 0 . 0 : 0 ' ] ) ; <nl> } <nl> <nl> / * * <nl> public function testInvalidAddHttp2Port ( ) <nl> public function testInvalidAddSecureHttp2Port ( ) <nl> { <nl> $ this - > server = new Grpc \ Server ( [ ] ) ; <nl> - $ this - > port = $ this - > server - > addSecureHttp2Port ( [ ' 0 . 0 . 0 . 0 : 0 ' ] ) ; <nl> + $ port = $ this - > server - > addSecureHttp2Port ( [ ' 0 . 0 . 0 . 0 : 0 ' ] ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidAddSecureHttp2Port2 ( ) <nl> + { <nl> + $ this - > server = new Grpc \ Server ( ) ; <nl> + $ port = $ this - > server - > addSecureHttp2Port ( ' 0 . 0 . 0 . 0 : 0 ' ) ; <nl> + } <nl> + <nl> + / * * <nl> + * @ expectedException InvalidArgumentException <nl> + * / <nl> + public function testInvalidAddSecureHttp2Port3 ( ) <nl> + { <nl> + $ this - > server = new Grpc \ Server ( ) ; <nl> + $ port = $ this - > server - > addSecureHttp2Port ( ' 0 . 0 . 0 . 0 : 0 ' , ' invalid ' ) ; <nl> } <nl> } <nl> old mode 100755 <nl> new mode 100644 <nl> index a3dbce079f4 . . 2d19f64c799 <nl> mmm a / src / php / tests / unit_tests / TimevalTest . php <nl> ppp b / src / php / tests / unit_tests / TimevalTest . php <nl> <nl> * / <nl> class TimevalTest extends PHPUnit_Framework_TestCase <nl> { <nl> + public function setUp ( ) <nl> + { <nl> + } <nl> + <nl> + public function tearDown ( ) <nl> + { <nl> + unset ( $ this - > time ) ; <nl> + } <nl> + <nl> + public function testConstructorWithInt ( ) <nl> + { <nl> + $ this - > time = new Grpc \ Timeval ( 1234 ) ; <nl> + $ this - > assertNotNull ( $ this - > time ) ; <nl> + $ this - > assertSame ( ' Grpc \ Timeval ' , get_class ( $ this - > time ) ) ; <nl> + } <nl> + <nl> + public function testConstructorWithNegative ( ) <nl> + { <nl> + $ this - > time = new Grpc \ Timeval ( - 123 ) ; <nl> + $ this - > assertNotNull ( $ this - > time ) ; <nl> + $ this - > assertSame ( ' Grpc \ Timeval ' , get_class ( $ this - > time ) ) ; <nl> + } <nl> + <nl> + public function testConstructorWithZero ( ) <nl> + { <nl> + $ this - > time = new Grpc \ Timeval ( 0 ) ; <nl> + $ this - > assertNotNull ( $ this - > time ) ; <nl> + $ this - > assertSame ( ' Grpc \ Timeval ' , get_class ( $ this - > time ) ) ; <nl> + } <nl> + <nl> + public function testConstructorWithOct ( ) <nl> + { <nl> + $ this - > time = new Grpc \ Timeval ( 0123 ) ; <nl> + $ this - > assertNotNull ( $ this - > time ) ; <nl> + $ this - > assertSame ( ' Grpc \ Timeval ' , get_class ( $ this - > time ) ) ; <nl> + } <nl> + <nl> + public function testConstructorWithHex ( ) <nl> + { <nl> + $ this - > time = new Grpc \ Timeval ( 0x1A ) ; <nl> + $ this - > assertNotNull ( $ this - > time ) ; <nl> + $ this - > assertSame ( ' Grpc \ Timeval ' , get_class ( $ this - > time ) ) ; <nl> + } <nl> + <nl> + public function testConstructorWithFloat ( ) <nl> + { <nl> + $ this - > time = new Grpc \ Timeval ( 123 . 456 ) ; <nl> + $ this - > assertNotNull ( $ this - > time ) ; <nl> + $ this - > assertSame ( ' Grpc \ Timeval ' , get_class ( $ this - > time ) ) ; <nl> + } <nl> + <nl> public function testCompareSame ( ) <nl> { <nl> $ zero = Grpc \ Timeval : : zero ( ) ; <nl> public function testNowIsBetweenZeroAndFuture ( ) <nl> public function testNowAndAdd ( ) <nl> { <nl> $ now = Grpc \ Timeval : : now ( ) ; <nl> + $ this - > assertNotNull ( $ now ) ; <nl> $ delta = new Grpc \ Timeval ( 1000 ) ; <nl> $ deadline = $ now - > add ( $ delta ) ; <nl> $ this - > assertGreaterThan ( 0 , Grpc \ Timeval : : compare ( $ deadline , $ now ) ) ; <nl> public function testCompareInvalidParam ( ) <nl> public function testSimilarInvalidParam ( ) <nl> { <nl> $ a = Grpc \ Timeval : : similar ( 1000 , 1100 , 1200 ) ; <nl> + $ this - > assertNull ( $ delta ) ; <nl> } <nl> } <nl> mmm a / src / ruby / ext / grpc / rb_grpc_imports . generated . c <nl> ppp b / src / ruby / ext / grpc / rb_grpc_imports . generated . c <nl> gpr_set_log_function_type gpr_set_log_function_import ; <nl> gpr_slice_ref_type gpr_slice_ref_import ; <nl> gpr_slice_unref_type gpr_slice_unref_import ; <nl> gpr_slice_new_type gpr_slice_new_import ; <nl> + gpr_slice_new_with_user_data_type gpr_slice_new_with_user_data_import ; <nl> gpr_slice_new_with_len_type gpr_slice_new_with_len_import ; <nl> gpr_slice_malloc_type gpr_slice_malloc_import ; <nl> gpr_slice_from_copied_string_type gpr_slice_from_copied_string_import ; <nl> void grpc_rb_load_imports ( HMODULE library ) { <nl> gpr_slice_ref_import = ( gpr_slice_ref_type ) GetProcAddress ( library , " gpr_slice_ref " ) ; <nl> gpr_slice_unref_import = ( gpr_slice_unref_type ) GetProcAddress ( library , " gpr_slice_unref " ) ; <nl> gpr_slice_new_import = ( gpr_slice_new_type ) GetProcAddress ( library , " gpr_slice_new " ) ; <nl> + gpr_slice_new_with_user_data_import = ( gpr_slice_new_with_user_data_type ) GetProcAddress ( library , " gpr_slice_new_with_user_data " ) ; <nl> gpr_slice_new_with_len_import = ( gpr_slice_new_with_len_type ) GetProcAddress ( library , " gpr_slice_new_with_len " ) ; <nl> gpr_slice_malloc_import = ( gpr_slice_malloc_type ) GetProcAddress ( library , " gpr_slice_malloc " ) ; <nl> gpr_slice_from_copied_string_import = ( gpr_slice_from_copied_string_type ) GetProcAddress ( library , " gpr_slice_from_copied_string " ) ; <nl> mmm a / src / ruby / ext / grpc / rb_grpc_imports . generated . h <nl> ppp b / src / ruby / ext / grpc / rb_grpc_imports . generated . h <nl> extern gpr_slice_unref_type gpr_slice_unref_import ; <nl> typedef gpr_slice ( * gpr_slice_new_type ) ( void * p , size_t len , void ( * destroy ) ( void * ) ) ; <nl> extern gpr_slice_new_type gpr_slice_new_import ; <nl> # define gpr_slice_new gpr_slice_new_import <nl> + typedef gpr_slice ( * gpr_slice_new_with_user_data_type ) ( void * p , size_t len , void ( * destroy ) ( void * ) , void * user_data ) ; <nl> + extern gpr_slice_new_with_user_data_type gpr_slice_new_with_user_data_import ; <nl> + # define gpr_slice_new_with_user_data gpr_slice_new_with_user_data_import <nl> typedef gpr_slice ( * gpr_slice_new_with_len_type ) ( void * p , size_t len , void ( * destroy ) ( void * , size_t ) ) ; <nl> extern gpr_slice_new_with_len_type gpr_slice_new_with_len_import ; <nl> # define gpr_slice_new_with_len gpr_slice_new_with_len_import <nl> mmm a / templates / Makefile . template <nl> ppp b / templates / Makefile . template <nl> <nl> LDFLAGS + = - pthread <nl> endif <nl> <nl> + # <nl> + # The steps for cross - compiling are as follows : <nl> + # First , clone and make install of grpc using the native compilers for the host . <nl> + # Also , install protoc ( e . g . , from a package like apt - get ) <nl> + # Then clone a fresh grpc for the actual cross - compiled build <nl> + # Set the environment variable GRPC_CROSS_COMPILE to true <nl> + # Set CC , CXX , LD , LDXX , AR , and STRIP to the cross - compiling binaries <nl> + # Also set PROTOBUF_CONFIG_OPTS to indicate cross - compilation to protobuf ( e . g . , <nl> + # PROTOBUF_CONFIG_OPTS = " - - host = arm - linux - - with - protoc = / usr / local / bin / protoc " ) <nl> + # Set HAS_PKG_CONFIG = false <nl> + # To build tests , go to third_party / gflags and follow its ccmake instructions <nl> + # Make sure that you enable building shared libraries and set your prefix to <nl> + # something useful like / usr / local / cross <nl> + # You will also need to set GRPC_CROSS_LDOPTS and GRPC_CROSS_AROPTS to hold <nl> + # additional required arguments for LD and AR ( examples below ) <nl> + # Then you can do a make from the cross - compiling fresh clone ! <nl> + # <nl> + ifeq ( $ ( GRPC_CROSS_COMPILE ) , true ) <nl> + LDFLAGS + = $ ( GRPC_CROSS_LDOPTS ) # e . g . - L / usr / local / lib - L / usr / local / cross / lib <nl> + AROPTS = $ ( GRPC_CROSS_AROPTS ) # e . g . , rc - - target = elf32 - little <nl> + USE_BUILT_PROTOC = false <nl> + endif <nl> + <nl> GTEST_LIB = - Ithird_party / googletest / include - Ithird_party / googletest third_party / googletest / src / gtest - all . cc <nl> GTEST_LIB + = - lgflags <nl> ifeq ( $ ( V ) , 1 ) <nl> <nl> <nl> CPPFLAGS : = - Ithird_party / googletest / include $ ( CPPFLAGS ) <nl> <nl> + PROTOC_PLUGINS_ALL = \ <nl> + % for tgt in targets : <nl> + % if tgt . build = = ' protoc ' : <nl> + $ ( BINDIR ) / $ ( CONFIG ) / $ { tgt . name } \ <nl> + % endif <nl> + % endfor <nl> + <nl> + PROTOC_PLUGINS_DIR = $ ( BINDIR ) / $ ( CONFIG ) <nl> + <nl> ifeq ( $ ( HAS_SYSTEM_PROTOBUF ) , true ) <nl> ifeq ( $ ( HAS_PKG_CONFIG ) , true ) <nl> PROTOBUF_PKG_CONFIG = true <nl> <nl> endif <nl> else <nl> PC_LIBS_GRPCXX = - lprotobuf <nl> + PROTOC_PLUGINS = $ ( PROTOC_PLUGINS_ALL ) <nl> endif <nl> else <nl> ifeq ( $ ( HAS_EMBEDDED_PROTOBUF ) , true ) <nl> PROTOBUF_DEP = $ ( LIBDIR ) / $ ( CONFIG ) / protobuf / libprotobuf . a <nl> CPPFLAGS : = - Ithird_party / protobuf / src $ ( CPPFLAGS ) <nl> LDFLAGS : = - L $ ( LIBDIR ) / $ ( CONFIG ) / protobuf $ ( LDFLAGS ) <nl> + ifneq ( $ ( USE_BUILT_PROTOC ) , false ) <nl> PROTOC = $ ( BINDIR ) / $ ( CONFIG ) / protobuf / protoc <nl> + PROTOC_PLUGINS = $ ( PROTOC_PLUGINS_ALL ) <nl> + else <nl> + PROTOC_PLUGINS = <nl> + PROTOC_PLUGINS_DIR = $ ( prefix ) / bin <nl> + endif <nl> else <nl> NO_PROTOBUF = true <nl> endif <nl> <nl> <nl> . SECONDARY = % . pb . h % . pb . cc <nl> <nl> - PROTOC_PLUGINS = \ <nl> - % for tgt in targets : <nl> - % if tgt . build = = ' protoc ' : <nl> - $ ( BINDIR ) / $ ( CONFIG ) / $ { tgt . name } \ <nl> - % endif <nl> - % endfor <nl> - <nl> ifeq ( $ ( DEP_MISSING ) , ) <nl> all : static shared plugins \ <nl> % for tgt in targets : <nl> <nl> <nl> $ ( LIBDIR ) / $ ( CONFIG ) / protobuf / libprotobuf . a : third_party / protobuf / configure <nl> $ ( E ) " [ MAKE ] Building protobuf " <nl> - $ ( Q ) ( cd third_party / protobuf ; CC = " $ ( CC ) " CXX = " $ ( CXX ) " LDFLAGS = " $ ( LDFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_LDFLAGS_EXTRA ) " CPPFLAGS = " $ ( PIC_CPPFLAGS ) $ ( CPPFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_CPPFLAGS_EXTRA ) " . / configure - - disable - shared - - enable - static ) <nl> + $ ( Q ) ( cd third_party / protobuf ; CC = " $ ( CC ) " CXX = " $ ( CXX ) " LDFLAGS = " $ ( LDFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_LDFLAGS_EXTRA ) " CPPFLAGS = " $ ( PIC_CPPFLAGS ) $ ( CPPFLAGS_ $ ( CONFIG ) ) - g $ ( PROTOBUF_CPPFLAGS_EXTRA ) " . / configure - - disable - shared - - enable - static $ ( PROTOBUF_CONFIG_OPTS ) ) <nl> $ ( Q ) $ ( MAKE ) - C third_party / protobuf clean <nl> $ ( Q ) $ ( MAKE ) - C third_party / protobuf <nl> $ ( Q ) mkdir - p $ ( LIBDIR ) / $ ( CONFIG ) / protobuf <nl> <nl> $ ( GENDIR ) / $ { p } . grpc . pb . cc : $ { p } . proto $ ( PROTOBUF_DEP ) $ ( PROTOC_PLUGINS ) $ { ' ' . join ( ' $ ( GENDIR ) / % s . pb . cc $ ( GENDIR ) / % s . grpc . pb . cc ' % ( q , q ) for q in proto_deps . get ( p , [ ] ) ) } <nl> $ ( E ) " [ GRPC ] Generating gRPC ' s protobuf service CC file from $ < " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( BINDIR ) / $ ( CONFIG ) / grpc_cpp_plugin $ < <nl> + $ ( Q ) $ ( PROTOC ) - Ithird_party / protobuf / src - I . - - grpc_out = $ ( GENDIR ) - - plugin = protoc - gen - grpc = $ ( PROTOC_PLUGINS_DIR ) / grpc_cpp_plugin $ < <nl> endif <nl> <nl> % endfor <nl> <nl> $ ( E ) " [ AR ] Creating $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / lib $ { lib . name } . a <nl> - $ ( Q ) $ ( AR ) $ ( LIBDIR ) / $ ( CONFIG ) / lib $ { lib . name } . a $ ( LIB $ { lib . name . upper ( ) } _OBJS ) \ <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / lib $ { lib . name } . a $ ( LIB $ { lib . name . upper ( ) } _OBJS ) \ <nl> % if lib . get ( ' baselib ' , False ) : <nl> $ ( LIBGPR_OBJS ) \ <nl> $ ( ZLIB_MERGE_OBJS ) \ <nl> mmm a / templates / composer . json . template <nl> ppp b / templates / composer . json . template <nl> <nl> " license " : " BSD - 3 - Clause " , <nl> " require " : { <nl> " php " : " > = 5 . 5 . 0 " , <nl> - " stanley - cheung / protobuf - php " : " dev - master " <nl> + " stanley - cheung / protobuf - php " : " v0 . 6 " <nl> } , <nl> " require - dev " : { <nl> " google / auth " : " v0 . 9 " <nl> mmm a / templates / gRPC - Core . podspec . template <nl> ppp b / templates / gRPC - Core . podspec . template <nl> <nl> ' ALWAYS_SEARCH_USER_PATHS ' = > ' NO ' , <nl> } <nl> <nl> + s . default_subspecs = ' Interface ' , ' Implementation ' <nl> + <nl> # Like many other C libraries , gRPC - Core has its public headers under ` include / < libname > / ` and its <nl> # sources and private headers in other directories outside ` include / ` . Cocoapods ' linter doesn ' t <nl> # allow any header to be listed outside the ` header_mappings_dir ` ( even though doing so works in <nl> <nl> <nl> ss . private_header_files = $ { ruby_multiline_list ( grpc_private_headers ( libs ) , 30 ) } <nl> end <nl> + <nl> + s . subspec ' Cronet - Interface ' do | ss | <nl> + ss . header_mappings_dir = ' include / grpc ' <nl> + ss . source_files = ' include / grpc / grpc_cronet . h ' <nl> + end <nl> + <nl> + s . subspec ' Cronet - Tests ' do | ss | <nl> + ss . header_mappings_dir = ' . ' <nl> + <nl> + ss . source_files = ' src / core / ext / transport / cronet / client / secure / cronet_channel_create . c ' , <nl> + ' src / core / ext / transport / cronet / transport / cronet_transport . c ' , <nl> + ' test / core / end2end / cq_verifier . { c , h } ' , <nl> + ' test / core / end2end / end2end_tests . { c , h } ' , <nl> + ' test / core / end2end / tests / * . { c , h } ' , <nl> + ' test / core / end2end / data / * . { c , h } ' , <nl> + ' test / core / util / test_config . { c , h } ' , <nl> + ' test / core / util / port . h ' , <nl> + ' test / core / util / port_posix . c ' , <nl> + ' test / core / util / port_server_client . { c , h } ' <nl> + <nl> + ss . dependency ' CronetFramework ' <nl> + end <nl> end <nl> mmm a / templates / package . xml . template <nl> ppp b / templates / package . xml . template <nl> <nl> < email > grpc - packages @ google . com < / email > <nl> < active > yes < / active > <nl> < / lead > <nl> - < date > 2016 - 07 - 13 < / date > <nl> + < date > 2016 - 07 - 21 < / date > <nl> < time > 16 : 06 : 07 < / time > <nl> < version > <nl> < release > $ { settings . php_version . php ( ) } < / release > <nl> <nl> < / stability > <nl> < license > BSD < / license > <nl> < notes > <nl> - - GA release <nl> - - Fix shutdown hang problem # 4017 <nl> + - PHP7 Support # 7464 <nl> < / notes > <nl> < contents > <nl> < dir baseinstalldir = " / " name = " / " > <nl> <nl> < / release > <nl> < release > <nl> < version > <nl> - < release > 1 . 0 . 0 < / release > <nl> - < api > 1 . 0 . 0 < / api > <nl> + < release > 1 . 0 . 0RC1 < / release > <nl> + < api > 1 . 0 . 0RC1 < / api > <nl> < / version > <nl> < stability > <nl> < release > stable < / release > <nl> <nl> - Fix shutdown hang problem # 4017 <nl> < / notes > <nl> < / release > <nl> + < release > <nl> + < version > <nl> + < release > 1 . 0 . 0RC2 < / release > <nl> + < api > 1 . 0 . 0RC2 < / api > <nl> + < / version > <nl> + < stability > <nl> + < release > stable < / release > <nl> + < api > stable < / api > <nl> + < / stability > <nl> + < date > 2016 - 07 - 21 < / date > <nl> + < license > BSD < / license > <nl> + < notes > <nl> + - PHP7 Support # 7464 <nl> + < / notes > <nl> + < / release > <nl> < / changelog > <nl> < / package > <nl> mmm a / test / core / support / slice_test . c <nl> ppp b / test / core / support / slice_test . c <nl> static void test_slice_new_returns_something_sensible ( void ) { <nl> gpr_slice_unref ( slice ) ; <nl> } <nl> <nl> + / * destroy function that sets a mark to indicate it was called . * / <nl> + static void set_mark ( void * p ) { * ( ( int * ) p ) = 1 ; } <nl> + <nl> + static void test_slice_new_with_user_data ( void ) { <nl> + int marker = 0 ; <nl> + uint8_t buf [ 2 ] ; <nl> + gpr_slice slice ; <nl> + <nl> + buf [ 0 ] = 0 ; <nl> + buf [ 1 ] = 1 ; <nl> + slice = gpr_slice_new_with_user_data ( buf , 2 , set_mark , & marker ) ; <nl> + GPR_ASSERT ( marker = = 0 ) ; <nl> + GPR_ASSERT ( GPR_SLICE_LENGTH ( slice ) = = 2 ) ; <nl> + GPR_ASSERT ( GPR_SLICE_START_PTR ( slice ) [ 0 ] = = 0 ) ; <nl> + GPR_ASSERT ( GPR_SLICE_START_PTR ( slice ) [ 1 ] = = 1 ) ; <nl> + <nl> + / * unref should cause destroy function to run . * / <nl> + gpr_slice_unref ( slice ) ; <nl> + GPR_ASSERT ( marker = = 1 ) ; <nl> + } <nl> + <nl> static int do_nothing_with_len_1_calls = 0 ; <nl> <nl> static void do_nothing_with_len_1 ( void * ignored , size_t len ) { <nl> int main ( int argc , char * * argv ) { <nl> grpc_test_init ( argc , argv ) ; <nl> test_slice_malloc_returns_something_sensible ( ) ; <nl> test_slice_new_returns_something_sensible ( ) ; <nl> + test_slice_new_with_user_data ( ) ; <nl> test_slice_new_with_len_returns_something_sensible ( ) ; <nl> for ( length = 0 ; length < 128 ; length + + ) { <nl> test_slice_sub_works ( length ) ; <nl> mmm a / test / cpp / util / grpc_cli . cc <nl> ppp b / test / cpp / util / grpc_cli . cc <nl> <nl> / * <nl> A command line tool to talk to a grpc server . <nl> Example of talking to grpc interop server : <nl> - grpc_cli call localhost : 50051 UnaryCall src / proto / grpc / testing / test . proto \ <nl> - " response_size : 10 " - - enable_ssl = false <nl> + grpc_cli call localhost : 50051 UnaryCall " response_size : 10 " \ <nl> + - - protofiles = src / proto / grpc / testing / test . proto - - enable_ssl = false <nl> <nl> Options : <nl> - 1 . - - proto_path , if your proto file is not under current working directory , <nl> + 1 . - - protofiles , use this flag to provide a proto file if the server does <nl> + does not have the reflection service . <nl> + 2 . - - proto_path , if your proto file is not under current working directory , <nl> use this flag to provide a search root . It should work similar to the <nl> - counterpart in protoc . <nl> - 2 . - - metadata specifies metadata to be sent to the server , such as : <nl> + counterpart in protoc . This option is valid only when protofiles is <nl> + provided . <nl> + 3 . - - metadata specifies metadata to be sent to the server , such as : <nl> - - metadata = " MyHeaderKey1 : Value1 : MyHeaderKey2 : Value2 " <nl> - 3 . - - enable_ssl , whether to use tls . <nl> - 4 . - - use_auth , if set to true , attach a GoogleDefaultCredentials to the call <nl> - 3 . - - input_binary_file , a file containing the serialized request . The file <nl> + 4 . - - enable_ssl , whether to use tls . <nl> + 5 . - - use_auth , if set to true , attach a GoogleDefaultCredentials to the call <nl> + 6 . - - input_binary_file , a file containing the serialized request . The file <nl> can be generated by calling something like : <nl> protoc - - proto_path = src / proto / grpc / testing / \ <nl> - - encode = grpc . testing . SimpleRequest \ <nl> <nl> < input . txt > input . bin <nl> If this is used and no proto file is provided in the argument list , the <nl> method string has to be exact in the form of / package . service / method . <nl> - 4 . - - output_binary_file , a file to write binary format response into , it can <nl> + 7 . - - output_binary_file , a file to write binary format response into , it can <nl> be later decoded using protoc : <nl> protoc - - proto_path = src / proto / grpc / testing / \ <nl> - - decode = grpc . testing . SimpleResponse \ <nl> <nl> < output . bin > output . txt <nl> * / <nl> <nl> + # include < unistd . h > <nl> # include < fstream > <nl> # include < iostream > <nl> # include < sstream > <nl> DEFINE_string ( output_binary_file , " " , <nl> DEFINE_string ( metadata , " " , <nl> " Metadata to send to server , in the form of key1 : val1 : key2 : val2 " ) ; <nl> DEFINE_string ( proto_path , " . " , " Path to look for the proto file . " ) ; <nl> + / / TODO ( zyc ) : support a list of input proto files <nl> + DEFINE_string ( protofiles , " " , " Name of the proto file . " ) ; <nl> <nl> void ParseMetadataFlag ( <nl> std : : multimap < grpc : : string , grpc : : string > * client_metadata ) { <nl> void PrintMetadata ( const T & m , const grpc : : string & message ) { <nl> int main ( int argc , char * * argv ) { <nl> grpc : : testing : : InitTest ( & argc , & argv , true ) ; <nl> <nl> - if ( argc < 4 | | argc = = 5 | | grpc : : string ( argv [ 1 ] ) ! = " call " ) { <nl> + if ( argc < 4 | | grpc : : string ( argv [ 1 ] ) ! = " call " ) { <nl> std : : cout < < " Usage : grpc_cli call server_host : port method_name " <nl> < < " [ proto file ] [ text format request ] [ < options > ] " < < std : : endl ; <nl> + return 1 ; <nl> } <nl> <nl> - grpc : : string file_name ; <nl> grpc : : string request_text ; <nl> grpc : : string server_address ( argv [ 2 ] ) ; <nl> grpc : : string method_name ( argv [ 3 ] ) ; <nl> std : : unique_ptr < grpc : : testing : : ProtoFileParser > parser ; <nl> grpc : : string serialized_request_proto ; <nl> <nl> - if ( argc = = 6 ) { <nl> - file_name = argv [ 4 ] ; <nl> - / / TODO ( yangg ) read from stdin as well ? <nl> - request_text = argv [ 5 ] ; <nl> + if ( argc = = 5 ) { <nl> + request_text = argv [ 4 ] ; <nl> + } <nl> + <nl> + std : : shared_ptr < grpc : : ChannelCredentials > creds ; <nl> + if ( ! FLAGS_enable_ssl ) { <nl> + creds = grpc : : InsecureChannelCredentials ( ) ; <nl> + } else { <nl> + if ( FLAGS_use_auth ) { <nl> + creds = grpc : : GoogleDefaultCredentials ( ) ; <nl> + } else { <nl> + creds = grpc : : SslCredentials ( grpc : : SslCredentialsOptions ( ) ) ; <nl> + } <nl> } <nl> + std : : shared_ptr < grpc : : Channel > channel = <nl> + grpc : : CreateChannel ( server_address , creds ) ; <nl> <nl> if ( request_text . empty ( ) & & FLAGS_input_binary_file . empty ( ) ) { <nl> - std : : cout < < " Missing input . Use text format input or " <nl> - < < " - - input_binary_file for serialized request " < < std : : endl ; <nl> - return 1 ; <nl> - } else if ( ! request_text . empty ( ) ) { <nl> - parser . reset ( new grpc : : testing : : ProtoFileParser ( FLAGS_proto_path , file_name , <nl> - method_name ) ) ; <nl> + if ( isatty ( STDIN_FILENO ) ) { <nl> + std : : cout < < " reading request message from stdin . . . " < < std : : endl ; <nl> + } <nl> + std : : stringstream input_stream ; <nl> + input_stream < < std : : cin . rdbuf ( ) ; <nl> + request_text = input_stream . str ( ) ; <nl> + } <nl> + <nl> + if ( ! request_text . empty ( ) ) { <nl> + if ( ! FLAGS_protofiles . empty ( ) ) { <nl> + parser . reset ( new grpc : : testing : : ProtoFileParser ( <nl> + FLAGS_proto_path , FLAGS_protofiles , method_name ) ) ; <nl> + } else { <nl> + parser . reset ( new grpc : : testing : : ProtoFileParser ( channel , method_name ) ) ; <nl> + } <nl> method_name = parser - > GetFullMethodName ( ) ; <nl> if ( parser - > HasError ( ) ) { <nl> return 1 ; <nl> } <nl> + <nl> + if ( ! FLAGS_input_binary_file . empty ( ) ) { <nl> + std : : cout <nl> + < < " warning : request given in argv , ignoring - - input_binary_file " <nl> + < < std : : endl ; <nl> + } <nl> } <nl> <nl> if ( parser ) { <nl> int main ( int argc , char * * argv ) { <nl> } <nl> std : : cout < < " connecting to " < < server_address < < std : : endl ; <nl> <nl> - std : : shared_ptr < grpc : : ChannelCredentials > creds ; <nl> - if ( ! FLAGS_enable_ssl ) { <nl> - creds = grpc : : InsecureChannelCredentials ( ) ; <nl> - } else { <nl> - if ( FLAGS_use_auth ) { <nl> - creds = grpc : : GoogleDefaultCredentials ( ) ; <nl> - } else { <nl> - creds = grpc : : SslCredentials ( grpc : : SslCredentialsOptions ( ) ) ; <nl> - } <nl> - } <nl> - std : : shared_ptr < grpc : : Channel > channel = <nl> - grpc : : CreateChannel ( server_address , creds ) ; <nl> - <nl> grpc : : string serialized_response_proto ; <nl> std : : multimap < grpc : : string , grpc : : string > client_metadata ; <nl> std : : multimap < grpc : : string_ref , grpc : : string_ref > server_initial_metadata , <nl> int main ( int argc , char * * argv ) { <nl> } <nl> } else { <nl> std : : cout < < " Rpc failed with status code " < < s . error_code ( ) <nl> - < < " error message " < < s . error_message ( ) < < std : : endl ; <nl> + < < " , error message : " < < s . error_message ( ) < < std : : endl ; <nl> } <nl> <nl> return 0 ; <nl> mmm a / test / cpp / util / proto_file_parser . cc <nl> ppp b / test / cpp / util / proto_file_parser . cc <nl> ProtoFileParser : : ProtoFileParser ( const grpc : : string & proto_path , <nl> dynamic_factory_ . reset ( <nl> new google : : protobuf : : DynamicMessageFactory ( importer_ - > pool ( ) ) ) ; <nl> <nl> + std : : vector < const google : : protobuf : : ServiceDescriptor * > service_desc_list ; <nl> + for ( int i = 0 ; i < file_desc - > service_count ( ) ; i + + ) { <nl> + service_desc_list . push_back ( file_desc - > service ( i ) ) ; <nl> + } <nl> + InitProtoFileParser ( method , service_desc_list ) ; <nl> + } <nl> + <nl> + ProtoFileParser : : ProtoFileParser ( std : : shared_ptr < grpc : : Channel > channel , <nl> + const grpc : : string & method ) <nl> + : has_error_ ( false ) , <nl> + desc_db_ ( new grpc : : ProtoReflectionDescriptorDatabase ( channel ) ) , <nl> + desc_pool_ ( new google : : protobuf : : DescriptorPool ( desc_db_ . get ( ) ) ) { <nl> + std : : vector < std : : string > service_list ; <nl> + if ( ! desc_db_ - > GetServices ( & service_list ) ) { <nl> + LogError ( <nl> + " Failed to get services from the server , " <nl> + " it may not have the reflection service . \ n " <nl> + " Please try to use the - - protofiles option to provide a proto file . " ) ; <nl> + } <nl> + if ( has_error_ ) { <nl> + return ; <nl> + } <nl> + dynamic_factory_ . reset ( <nl> + new google : : protobuf : : DynamicMessageFactory ( desc_pool_ . get ( ) ) ) ; <nl> + <nl> + std : : vector < const google : : protobuf : : ServiceDescriptor * > service_desc_list ; <nl> + for ( auto it = service_list . begin ( ) ; it ! = service_list . end ( ) ; it + + ) { <nl> + service_desc_list . push_back ( desc_pool_ - > FindServiceByName ( * it ) ) ; <nl> + } <nl> + InitProtoFileParser ( method , service_desc_list ) ; <nl> + } <nl> + <nl> + ProtoFileParser : : ~ ProtoFileParser ( ) { } <nl> + <nl> + void ProtoFileParser : : InitProtoFileParser ( <nl> + const grpc : : string & method , <nl> + const std : : vector < const google : : protobuf : : ServiceDescriptor * > <nl> + service_desc_list ) { <nl> const google : : protobuf : : MethodDescriptor * method_descriptor = nullptr ; <nl> - for ( int i = 0 ; ! method_descriptor & & i < file_desc - > service_count ( ) ; i + + ) { <nl> - const auto * service_desc = file_desc - > service ( i ) ; <nl> + for ( auto it = service_desc_list . begin ( ) ; it ! = service_desc_list . end ( ) ; <nl> + it + + ) { <nl> + const auto * service_desc = * it ; <nl> for ( int j = 0 ; j < service_desc - > method_count ( ) ; j + + ) { <nl> const auto * method_desc = service_desc - > method ( j ) ; <nl> if ( MethodNameMatch ( method_desc - > full_name ( ) , method ) ) { <nl> ProtoFileParser : : ProtoFileParser ( const grpc : : string & proto_path , <nl> dynamic_factory_ - > GetPrototype ( method_descriptor - > output_type ( ) ) - > New ( ) ) ; <nl> } <nl> <nl> - ProtoFileParser : : ~ ProtoFileParser ( ) { } <nl> - <nl> grpc : : string ProtoFileParser : : GetSerializedProto ( <nl> const grpc : : string & text_format_proto , bool is_request ) { <nl> grpc : : string serialized ; <nl> grpc : : string ProtoFileParser : : GetSerializedProto ( <nl> LogError ( " Failed to parse text format to proto . " ) ; <nl> return " " ; <nl> } <nl> - ok = request_prototype_ - > SerializeToString ( & serialized ) ; <nl> + ok = msg - > SerializeToString ( & serialized ) ; <nl> if ( ! ok ) { <nl> LogError ( " Failed to serialize proto . " ) ; <nl> return " " ; <nl> mmm a / test / cpp / util / proto_file_parser . h <nl> ppp b / test / cpp / util / proto_file_parser . h <nl> <nl> <nl> # include < google / protobuf / compiler / importer . h > <nl> # include < google / protobuf / dynamic_message . h > <nl> + # include < grpc + + / channel . h > <nl> <nl> # include " src / compiler / config . h " <nl> + # include " test / cpp / util / proto_reflection_descriptor_database . h " <nl> <nl> namespace grpc { <nl> namespace testing { <nl> class ProtoFileParser { <nl> / / even just Method . It will log an error if there is ambiguity . <nl> ProtoFileParser ( const grpc : : string & proto_path , const grpc : : string & file_name , <nl> const grpc : : string & method ) ; <nl> + <nl> + ProtoFileParser ( std : : shared_ptr < grpc : : Channel > channel , <nl> + const grpc : : string & method ) ; <nl> ~ ProtoFileParser ( ) ; <nl> <nl> grpc : : string GetFullMethodName ( ) const { return full_method_name_ ; } <nl> class ProtoFileParser { <nl> void LogError ( const grpc : : string & error_msg ) ; <nl> <nl> private : <nl> + void InitProtoFileParser ( <nl> + const grpc : : string & method , <nl> + const std : : vector < const google : : protobuf : : ServiceDescriptor * > services ) ; <nl> + <nl> bool has_error_ ; <nl> grpc : : string request_text_ ; <nl> grpc : : string full_method_name_ ; <nl> google : : protobuf : : compiler : : DiskSourceTree source_tree_ ; <nl> std : : unique_ptr < ErrorPrinter > error_printer_ ; <nl> std : : unique_ptr < google : : protobuf : : compiler : : Importer > importer_ ; <nl> + std : : unique_ptr < grpc : : ProtoReflectionDescriptorDatabase > desc_db_ ; <nl> + std : : unique_ptr < google : : protobuf : : DescriptorPool > desc_pool_ ; <nl> std : : unique_ptr < google : : protobuf : : DynamicMessageFactory > dynamic_factory_ ; <nl> std : : unique_ptr < grpc : : protobuf : : Message > request_prototype_ ; <nl> std : : unique_ptr < grpc : : protobuf : : Message > response_prototype_ ; <nl> mmm a / test / cpp / util / proto_reflection_descriptor_database . cc <nl> ppp b / test / cpp / util / proto_reflection_descriptor_database . cc <nl> ProtoReflectionDescriptorDatabase : : ProtoReflectionDescriptorDatabase ( <nl> std : : shared_ptr < grpc : : Channel > channel ) <nl> : stub_ ( ServerReflection : : NewStub ( channel ) ) { } <nl> <nl> - ProtoReflectionDescriptorDatabase : : ~ ProtoReflectionDescriptorDatabase ( ) { } <nl> + ProtoReflectionDescriptorDatabase : : ~ ProtoReflectionDescriptorDatabase ( ) { <nl> + if ( stream_ ) { <nl> + stream_ - > WritesDone ( ) ; <nl> + Status status = stream_ - > Finish ( ) ; <nl> + if ( ! status . ok ( ) ) { <nl> + gpr_log ( GPR_ERROR , <nl> + " ServerReflectionInfo rpc failed . Error code : % d , details : % s " , <nl> + ( int ) status . error_code ( ) , status . error_message ( ) . c_str ( ) ) ; <nl> + } <nl> + } <nl> + } <nl> <nl> bool ProtoReflectionDescriptorDatabase : : FindFileByName ( <nl> const string & filename , google : : protobuf : : FileDescriptorProto * output ) { <nl> deleted file mode 100644 <nl> index c219fa888a8 . . 00000000000 <nl> mmm a / tools / run_tests / perf_html_report . template <nl> ppp / dev / null <nl> <nl> - < ! DOCTYPE html > <nl> - < html lang = " en " > <nl> - < head > < title > Performance Test Result < / title > < / head > <nl> - < body > <nl> - < h2 > Performance Test Result < / h2 > <nl> - < table style = " width : 50 % " border = " 1 " > <nl> - < % sorted_test_cases = sorted ( resultset . keys ( ) ) % > <nl> - % for test_case in sorted_test_cases : <nl> - < tr > < td bgcolor = " # 00BFFF " style = " width : 30 % " > < b > $ { test_case } < / b > < / td > <nl> - < % result = resultset [ test_case ] % > <nl> - < td > <nl> - % for k , v in result . iteritems ( ) : <nl> - $ { k } : $ { v } < br > <nl> - % endfor <nl> - < / td > <nl> - < / tr > <nl> - % endfor <nl> - < / table > <nl> - <nl> - < / body > <nl> - < / html > <nl> mmm a / tools / run_tests / report_utils . py <nl> ppp b / tools / run_tests / report_utils . py <nl> <nl> from mako import exceptions <nl> except ( ImportError ) : <nl> pass # Mako not installed but it is ok . <nl> - import glob <nl> - import json <nl> import os <nl> import string <nl> import xml . etree . cElementTree as ET <nl> def render_interop_html_report ( <nl> print ( exceptions . text_error_template ( ) . render ( ) ) <nl> raise <nl> <nl> - <nl> - def render_perf_html_report ( report_dir ) : <nl> - " " " Generate a simple HTML report for the perf tests . " " " <nl> - template_file = ' tools / run_tests / perf_html_report . template ' <nl> - try : <nl> - mytemplate = Template ( filename = template_file , format_exceptions = True ) <nl> - except NameError : <nl> - print ( ' Mako template is not installed . Skipping HTML report generation . ' ) <nl> - return <nl> - except IOError as e : <nl> - print ( ' Failed to find the template % s : % s ' % ( template_file , e ) ) <nl> - return <nl> - <nl> - resultset = { } <nl> - for result_file in glob . glob ( os . path . join ( report_dir , ' * . json ' ) ) : <nl> - with open ( result_file , ' r ' ) as f : <nl> - scenario_result = json . loads ( f . read ( ) ) <nl> - test_case = scenario_result [ ' scenario ' ] [ ' name ' ] <nl> - if ' ping_pong ' in test_case : <nl> - latency50 = round ( scenario_result [ ' summary ' ] [ ' latency50 ' ] , 2 ) <nl> - latency99 = round ( scenario_result [ ' summary ' ] [ ' latency99 ' ] , 2 ) <nl> - summary = { ' latency50 ' : latency50 , ' latency99 ' : latency99 } <nl> - else : <nl> - summary = { ' qps ' : round ( scenario_result [ ' summary ' ] [ ' qps ' ] , 2 ) } <nl> - resultset [ test_case ] = summary <nl> - <nl> - args = { ' resultset ' : resultset } <nl> - <nl> - html_file_path = os . path . join ( report_dir , ' index . html ' ) <nl> - try : <nl> - with open ( html_file_path , ' w ' ) as output_file : <nl> - mytemplate . render_context ( Context ( output_file , * * args ) ) <nl> - except : <nl> - print ( exceptions . text_error_template ( ) . render ( ) ) <nl> - raise <nl> mmm a / tools / run_tests / run_performance_tests . py <nl> ppp b / tools / run_tests / run_performance_tests . py <nl> <nl> import os <nl> import pipes <nl> import re <nl> - import report_utils <nl> import subprocess <nl> import sys <nl> import tempfile <nl> <nl> <nl> <nl> _REMOTE_HOST_USERNAME = ' jenkins ' <nl> - _REPORT_DIR = ' perf_reports ' <nl> <nl> <nl> class QpsWorkerJob : <nl> def create_scenario_jobspec ( scenario_json , workers , remote_host = None , <nl> cmd + = ' BQ_RESULT_TABLE = " % s " ' % bq_result_table <nl> cmd + = ' tools / run_tests / performance / run_qps_driver . sh ' <nl> cmd + = ' - - scenarios_json = % s ' % pipes . quote ( json . dumps ( { ' scenarios ' : [ scenario_json ] } ) ) <nl> - if not os . path . isdir ( _REPORT_DIR ) : <nl> - os . makedirs ( _REPORT_DIR ) <nl> - report_path = os . path . join ( _REPORT_DIR , <nl> - ' % s - scenario_result . json ' % scenario_json [ ' name ' ] ) <nl> - cmd + = ' - - scenario_result_file = % s ' % report_path <nl> + cmd + = ' - - scenario_result_file = scenario_result . json ' <nl> if remote_host : <nl> user_at_host = ' % s @ % s ' % ( _REMOTE_HOST_USERNAME , remote_host ) <nl> cmd = ' ssh % s " cd ~ / performance_workspace / grpc / & & " % s ' % ( user_at_host , pipes . quote ( cmd ) ) <nl> def finish_qps_workers ( jobs ) : <nl> jobset . message ( ' START ' , ' Running scenarios . ' , do_newline = True ) <nl> num_failures , _ = jobset . run ( <nl> scenarios , newline_on_success = True , maxjobs = 1 ) <nl> - <nl> - report_utils . render_perf_html_report ( _REPORT_DIR ) <nl> - <nl> if num_failures = = 0 : <nl> jobset . message ( ' SUCCESS ' , <nl> ' All scenarios finished successfully . ' , <nl> mmm a / tools / run_tests / sources_and_headers . json <nl> ppp b / tools / run_tests / sources_and_headers . json <nl> <nl> " gpr_test_util " , <nl> " grpc " , <nl> " grpc + + " , <nl> + " grpc + + _reflection " , <nl> " grpc + + _test_config " , <nl> " grpc + + _test_util " , <nl> " grpc_cli_libs " , <nl> <nl> { <nl> " deps " : [ <nl> " grpc + + " , <nl> + " grpc + + _reflection " , <nl> " grpc_plugin_support " <nl> ] , <nl> " headers " : [ <nl> " test / cpp / util / cli_call . h " , <nl> - " test / cpp / util / proto_file_parser . h " <nl> + " test / cpp / util / proto_file_parser . h " , <nl> + " test / cpp / util / proto_reflection_descriptor_database . h " <nl> ] , <nl> " language " : " c + + " , <nl> " name " : " grpc_cli_libs " , <nl> <nl> " test / cpp / util / cli_call . cc " , <nl> " test / cpp / util / cli_call . h " , <nl> " test / cpp / util / proto_file_parser . cc " , <nl> - " test / cpp / util / proto_file_parser . h " <nl> + " test / cpp / util / proto_file_parser . h " , <nl> + " test / cpp / util / proto_reflection_descriptor_database . cc " , <nl> + " test / cpp / util / proto_reflection_descriptor_database . h " <nl> ] , <nl> " third_party " : false , <nl> " type " : " lib " <nl> mmm a / vsprojects / vcxproj / grpc_cli_libs / grpc_cli_libs . vcxproj <nl> ppp b / vsprojects / vcxproj / grpc_cli_libs / grpc_cli_libs . vcxproj <nl> <nl> < ItemGroup > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ cli_call . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_file_parser . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_reflection_descriptor_database . h " / > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ cli_call . cc " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_file_parser . cc " > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_reflection_descriptor_database . cc " > <nl> + < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _reflection \ grpc + + _reflection . vcxproj " > <nl> + < Project > { 5F575402 - 3F89 - 5D1A - 6910 - 9DB8BF5D2BAB } < / Project > <nl> + < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> < / ProjectReference > <nl> mmm a / vsprojects / vcxproj / grpc_cli_libs / grpc_cli_libs . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / grpc_cli_libs / grpc_cli_libs . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_file_parser . cc " > <nl> < Filter > test \ cpp \ util < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_reflection_descriptor_database . cc " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ cli_call . h " > <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_file_parser . h " > <nl> < Filter > test \ cpp \ util < / Filter > <nl> < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ util \ proto_reflection_descriptor_database . h " > <nl> + < Filter > test \ cpp \ util < / Filter > <nl> + < / ClInclude > <nl> < / ItemGroup > <nl> <nl> < ItemGroup > <nl> mmm a / vsprojects / vcxproj / test / grpc_cli / grpc_cli . vcxproj <nl> ppp b / vsprojects / vcxproj / test / grpc_cli / grpc_cli . vcxproj <nl> <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util \ grpc_test_util . vcxproj " > <nl> < Project > { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } < / Project > <nl> < / ProjectReference > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + _reflection \ grpc + + _reflection . vcxproj " > <nl> + < Project > { 5F575402 - 3F89 - 5D1A - 6910 - 9DB8BF5D2BAB } < / Project > <nl> + < / ProjectReference > <nl> < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> < / ProjectReference > <nl>
|
Merge github . com : grpc / grpc into grand - unified - closures
|
grpc/grpc
|
3e426718f05343d064fe998578acea6eaa7df622
|
2016-07-24T20:00:57Z
|
mmm a / folly / Singleton . cpp <nl> ppp b / folly / Singleton . cpp <nl> void SingletonVault : : reenableInstances ( ) { <nl> void SingletonVault : : scheduleDestroyInstances ( ) { <nl> / / Add a dependency on folly : : ThreadLocal to make sure all its static <nl> / / singletons are initalized first . <nl> - threadlocal_detail : : StaticMeta < void > : : instance ( ) ; <nl> + threadlocal_detail : : StaticMeta < void , void > : : instance ( ) ; <nl> <nl> class SingletonVaultDestructor { <nl> public : <nl> mmm a / folly / ThreadCachedInt . h <nl> ppp b / folly / ThreadCachedInt . h <nl> class ThreadCachedInt : boost : : noncopyable { <nl> / / Reads the current value plus all the cached increments . Requires grabbing <nl> / / a lock , so this is significantly slower than readFast ( ) . <nl> IntT readFull ( ) const { <nl> + / / This could race with thread destruction and so the access lock should be <nl> + / / acquired before reading the current value <nl> + auto accessor = cache_ . accessAllThreads ( ) ; <nl> IntT ret = readFast ( ) ; <nl> - for ( const auto & cache : cache_ . accessAllThreads ( ) ) { <nl> + for ( const auto & cache : accessor ) { <nl> if ( ! cache . reset_ . load ( std : : memory_order_acquire ) ) { <nl> ret + = cache . val_ . load ( std : : memory_order_relaxed ) ; <nl> } <nl> class ThreadCachedInt : boost : : noncopyable { <nl> / / little off , however , but it should be much better than calling readFull ( ) <nl> / / and set ( 0 ) sequentially . <nl> IntT readFullAndReset ( ) { <nl> + / / This could race with thread destruction and so the access lock should be <nl> + / / acquired before reading the current value <nl> + auto accessor = cache_ . accessAllThreads ( ) ; <nl> IntT ret = readFastAndReset ( ) ; <nl> - for ( auto & cache : cache_ . accessAllThreads ( ) ) { <nl> + for ( auto & cache : accessor ) { <nl> if ( ! cache . reset_ . load ( std : : memory_order_acquire ) ) { <nl> ret + = cache . val_ . load ( std : : memory_order_relaxed ) ; <nl> cache . reset_ . store ( true , std : : memory_order_release ) ; <nl> class ThreadCachedInt : boost : : noncopyable { <nl> private : <nl> std : : atomic < IntT > target_ ; <nl> std : : atomic < uint32_t > cacheSize_ ; <nl> - ThreadLocalPtr < IntCache , Tag > cache_ ; / / Must be last for dtor ordering <nl> + ThreadLocalPtr < IntCache , Tag , AccessModeStrict > <nl> + cache_ ; / / Must be last for dtor ordering <nl> <nl> / / This should only ever be modified by one thread <nl> struct IntCache { <nl> mmm a / folly / ThreadLocal . h <nl> ppp b / folly / ThreadLocal . h <nl> <nl> * objects of a parent . accessAllThreads ( ) initializes an accessor which holds <nl> * a global lock * that blocks all creation and destruction of ThreadLocal <nl> * objects with the same Tag * and can be used as an iterable container . <nl> + * accessAllThreads ( ) can race with destruction of thread - local elements . We <nl> + * provide a strict mode which is dangerous because it requires the access lock <nl> + * to be held while destroying thread - local elements which could cause <nl> + * deadlocks . We gate this mode behind the AccessModeStrict template parameter . <nl> * <nl> * Intended use is for frequent write , infrequent read data access patterns such <nl> * as counters . <nl> <nl> <nl> # pragma once <nl> <nl> + # include < boost / iterator / iterator_facade . hpp > <nl> # include < folly / Likely . h > <nl> # include < folly / Portability . h > <nl> # include < folly / ScopeGuard . h > <nl> - # include < boost / iterator / iterator_facade . hpp > <nl> + # include < folly / SharedMutex . h > <nl> # include < type_traits > <nl> # include < utility > <nl> <nl> enum class TLPDestructionMode { <nl> THIS_THREAD , <nl> ALL_THREADS <nl> } ; <nl> + struct AccessModeStrict { } ; <nl> } / / namespace <nl> <nl> # include < folly / detail / ThreadLocalDetail . h > <nl> <nl> namespace folly { <nl> <nl> - template < class T , class Tag > class ThreadLocalPtr ; <nl> + template < class T , class Tag , class AccessMode > <nl> + class ThreadLocalPtr ; <nl> <nl> - template < class T , class Tag = void > <nl> + template < class T , class Tag = void , class AccessMode = void > <nl> class ThreadLocal { <nl> public : <nl> constexpr ThreadLocal ( ) : constructor_ ( [ ] ( ) { <nl> class ThreadLocal { <nl> tlp_ . reset ( newPtr ) ; <nl> } <nl> <nl> - typedef typename ThreadLocalPtr < T , Tag > : : Accessor Accessor ; <nl> + typedef typename ThreadLocalPtr < T , Tag , AccessMode > : : Accessor Accessor ; <nl> Accessor accessAllThreads ( ) const { <nl> return tlp_ . accessAllThreads ( ) ; <nl> } <nl> class ThreadLocal { <nl> return ptr ; <nl> } <nl> <nl> - mutable ThreadLocalPtr < T , Tag > tlp_ ; <nl> + mutable ThreadLocalPtr < T , Tag , AccessMode > tlp_ ; <nl> std : : function < T * ( ) > constructor_ ; <nl> } ; <nl> <nl> class ThreadLocal { <nl> * with __declspec ( thread ) <nl> * / <nl> <nl> - template < class T , class Tag = void > <nl> + template < class T , class Tag = void , class AccessMode = void > <nl> class ThreadLocalPtr { <nl> private : <nl> - typedef threadlocal_detail : : StaticMeta < Tag > StaticMeta ; <nl> + typedef threadlocal_detail : : StaticMeta < Tag , AccessMode > StaticMeta ; <nl> + <nl> public : <nl> constexpr ThreadLocalPtr ( ) : id_ ( ) { } <nl> <nl> class ThreadLocalPtr { <nl> / / Can be used as an iterable container . <nl> / / Use accessAllThreads ( ) to obtain one . <nl> class Accessor { <nl> - friend class ThreadLocalPtr < T , Tag > ; <nl> + friend class ThreadLocalPtr < T , Tag , AccessMode > ; <nl> <nl> threadlocal_detail : : StaticMetaBase & meta_ ; <nl> + SharedMutex * accessAllThreadsLock_ ; <nl> std : : mutex * lock_ ; <nl> uint32_t id_ ; <nl> <nl> class ThreadLocalPtr { <nl> Accessor & operator = ( const Accessor & ) = delete ; <nl> <nl> Accessor ( Accessor & & other ) noexcept <nl> - : meta_ ( other . meta_ ) , <nl> - lock_ ( other . lock_ ) , <nl> - id_ ( other . id_ ) { <nl> + : meta_ ( other . meta_ ) , <nl> + accessAllThreadsLock_ ( other . accessAllThreadsLock_ ) , <nl> + lock_ ( other . lock_ ) , <nl> + id_ ( other . id_ ) { <nl> other . id_ = 0 ; <nl> + other . accessAllThreadsLock_ = nullptr ; <nl> other . lock_ = nullptr ; <nl> } <nl> <nl> class ThreadLocalPtr { <nl> assert ( & meta_ = = & other . meta_ ) ; <nl> assert ( lock_ = = nullptr ) ; <nl> using std : : swap ; <nl> + swap ( accessAllThreadsLock_ , other . accessAllThreadsLock_ ) ; <nl> swap ( lock_ , other . lock_ ) ; <nl> swap ( id_ , other . id_ ) ; <nl> } <nl> <nl> Accessor ( ) <nl> - : meta_ ( threadlocal_detail : : StaticMeta < Tag > : : instance ( ) ) , <nl> - lock_ ( nullptr ) , <nl> - id_ ( 0 ) { <nl> - } <nl> + : meta_ ( threadlocal_detail : : StaticMeta < Tag , AccessMode > : : instance ( ) ) , <nl> + accessAllThreadsLock_ ( nullptr ) , <nl> + lock_ ( nullptr ) , <nl> + id_ ( 0 ) { } <nl> <nl> private : <nl> explicit Accessor ( uint32_t id ) <nl> - : meta_ ( threadlocal_detail : : StaticMeta < Tag > : : instance ( ) ) , <nl> - lock_ ( & meta_ . lock_ ) { <nl> + : meta_ ( threadlocal_detail : : StaticMeta < Tag , AccessMode > : : instance ( ) ) , <nl> + accessAllThreadsLock_ ( & meta_ . accessAllThreadsLock_ ) , <nl> + lock_ ( & meta_ . lock_ ) { <nl> + accessAllThreadsLock_ - > lock ( ) ; <nl> lock_ - > lock ( ) ; <nl> id_ = id ; <nl> } <nl> class ThreadLocalPtr { <nl> void release ( ) { <nl> if ( lock_ ) { <nl> lock_ - > unlock ( ) ; <nl> + DCHECK ( accessAllThreadsLock_ ! = nullptr ) ; <nl> + accessAllThreadsLock_ - > unlock ( ) ; <nl> id_ = 0 ; <nl> lock_ = nullptr ; <nl> + accessAllThreadsLock_ = nullptr ; <nl> } <nl> } <nl> } ; <nl> mmm a / folly / detail / ThreadLocalDetail . cpp <nl> ppp b / folly / detail / ThreadLocalDetail . cpp <nl> <nl> <nl> namespace folly { namespace threadlocal_detail { <nl> <nl> - StaticMetaBase : : StaticMetaBase ( ThreadEntry * ( * threadEntry ) ( ) ) <nl> - : nextId_ ( 1 ) , threadEntry_ ( threadEntry ) { <nl> + StaticMetaBase : : StaticMetaBase ( ThreadEntry * ( * threadEntry ) ( ) , bool strict ) <nl> + : nextId_ ( 1 ) , threadEntry_ ( threadEntry ) , strict_ ( strict ) { <nl> head_ . next = head_ . prev = & head_ ; <nl> int ret = pthread_key_create ( & pthreadKey_ , & onThreadExit ) ; <nl> checkPosixError ( ret , " pthread_key_create failed " ) ; <nl> void StaticMetaBase : : onThreadExit ( void * ptr ) { <nl> } ; <nl> <nl> { <nl> - std : : lock_guard < std : : mutex > g ( meta . lock_ ) ; <nl> - meta . erase ( & ( * threadEntry ) ) ; <nl> - / / No need to hold the lock any longer ; the ThreadEntry is private to this <nl> - / / thread now that it ' s been removed from meta . <nl> - } <nl> - / / NOTE : User - provided deleter / object dtor itself may be using ThreadLocal <nl> - / / with the same Tag , so dispose ( ) calls below may ( re ) create some of the <nl> - / / elements or even increase elementsCapacity , thus multiple cleanup rounds <nl> - / / may be required . <nl> - for ( bool shouldRun = true ; shouldRun ; ) { <nl> - shouldRun = false ; <nl> - FOR_EACH_RANGE ( i , 0 , threadEntry - > elementsCapacity ) { <nl> - if ( threadEntry - > elements [ i ] . dispose ( TLPDestructionMode : : THIS_THREAD ) ) { <nl> - shouldRun = true ; <nl> + SharedMutex : : ReadHolder rlock ; <nl> + if ( meta . strict_ ) { <nl> + rlock = SharedMutex : : ReadHolder ( meta . accessAllThreadsLock_ ) ; <nl> + } <nl> + { <nl> + std : : lock_guard < std : : mutex > g ( meta . lock_ ) ; <nl> + meta . erase ( & ( * threadEntry ) ) ; <nl> + / / No need to hold the lock any longer ; the ThreadEntry is private to this <nl> + / / thread now that it ' s been removed from meta . <nl> + } <nl> + / / NOTE : User - provided deleter / object dtor itself may be using ThreadLocal <nl> + / / with the same Tag , so dispose ( ) calls below may ( re ) create some of the <nl> + / / elements or even increase elementsCapacity , thus multiple cleanup rounds <nl> + / / may be required . <nl> + for ( bool shouldRun = true ; shouldRun ; ) { <nl> + shouldRun = false ; <nl> + FOR_EACH_RANGE ( i , 0 , threadEntry - > elementsCapacity ) { <nl> + if ( threadEntry - > elements [ i ] . dispose ( TLPDestructionMode : : THIS_THREAD ) ) { <nl> + shouldRun = true ; <nl> + } <nl> } <nl> } <nl> } <nl> mmm a / folly / detail / ThreadLocalDetail . h <nl> ppp b / folly / detail / ThreadLocalDetail . h <nl> struct StaticMetaBase { <nl> } <nl> } ; <nl> <nl> - explicit StaticMetaBase ( ThreadEntry * ( * threadEntry ) ( ) ) ; <nl> + StaticMetaBase ( ThreadEntry * ( * threadEntry ) ( ) , bool strict ) ; <nl> <nl> ~ StaticMetaBase ( ) { <nl> LOG ( FATAL ) < < " StaticMeta lives forever ! " ; <nl> struct StaticMetaBase { <nl> uint32_t nextId_ ; <nl> std : : vector < uint32_t > freeIds_ ; <nl> std : : mutex lock_ ; <nl> + SharedMutex accessAllThreadsLock_ ; <nl> pthread_key_t pthreadKey_ ; <nl> ThreadEntry head_ ; <nl> ThreadEntry * ( * threadEntry_ ) ( ) ; <nl> + bool strict_ ; <nl> } ; <nl> <nl> / / Held in a singleton to track our global instances . <nl> struct StaticMetaBase { <nl> / / Creating and destroying ThreadLocalPtr objects , as well as thread exit <nl> / / for threads that use ThreadLocalPtr objects collide on a lock inside <nl> / / StaticMeta ; you can specify multiple Tag types to break that lock . <nl> - template < class Tag > <nl> + template < class Tag , class AccessMode > <nl> struct StaticMeta : StaticMetaBase { <nl> - StaticMeta ( ) : StaticMetaBase ( & StaticMeta : : getThreadEntrySlow ) { <nl> + StaticMeta ( ) <nl> + : StaticMetaBase ( <nl> + & StaticMeta : : getThreadEntrySlow , <nl> + std : : is_same < AccessMode , AccessModeStrict > : : value ) { <nl> registerAtFork ( <nl> / * prepare * / & StaticMeta : : preFork , <nl> / * parent * / & StaticMeta : : onForkParent , <nl> / * child * / & StaticMeta : : onForkChild ) ; <nl> } <nl> <nl> - static StaticMeta < Tag > & instance ( ) { <nl> + static StaticMeta < Tag , AccessMode > & instance ( ) { <nl> / / Leak it on exit , there ' s only one per process and we don ' t have to <nl> / / worry about synchronization with exiting threads . <nl> - static auto instance = detail : : createGlobal < StaticMeta < Tag > , void > ( ) ; <nl> + static auto instance = <nl> + detail : : createGlobal < StaticMeta < Tag , AccessMode > , void > ( ) ; <nl> return * instance ; <nl> } <nl> <nl> mmm a / folly / test / ThreadCachedIntTest . cpp <nl> ppp b / folly / test / ThreadCachedIntTest . cpp <nl> <nl> # include < folly / ThreadCachedInt . h > <nl> <nl> # include < atomic > <nl> + # include < condition_variable > <nl> # include < thread > <nl> <nl> # include < glog / logging . h > <nl> <nl> <nl> using namespace folly ; <nl> <nl> + using std : : unique_ptr ; <nl> + using std : : vector ; <nl> + <nl> + using Counter = ThreadCachedInt < int64_t > ; <nl> + <nl> + class ThreadCachedIntTest : public testing : : Test { <nl> + public : <nl> + uint32_t GetDeadThreadsTotal ( const Counter & counter ) { <nl> + return counter . readFast ( ) ; <nl> + } <nl> + } ; <nl> + <nl> + / / Multithreaded tests . Creates a specified number of threads each of <nl> + / / which iterates a different amount and dies . <nl> + <nl> + namespace { <nl> + / / Set cacheSize to be large so cached data moves to target_ only when <nl> + / / thread dies . <nl> + Counter g_counter_for_mt_slow ( 0 , UINT32_MAX ) ; <nl> + Counter g_counter_for_mt_fast ( 0 , UINT32_MAX ) ; <nl> + <nl> + / / Used to sync between threads . The value of this variable is the <nl> + / / maximum iteration index upto which Runner ( ) is allowed to go . <nl> + uint32_t g_sync_for_mt ( 0 ) ; <nl> + std : : condition_variable cv ; <nl> + std : : mutex cv_m ; <nl> + <nl> + / / Performs the specified number of iterations . Within each <nl> + / / iteration , it increments counter 10 times . At the beginning of <nl> + / / each iteration it checks g_sync_for_mt to see if it can proceed , <nl> + / / otherwise goes into a loop sleeping and rechecking . <nl> + void Runner ( Counter * counter , uint32_t iterations ) { <nl> + for ( uint32_t i = 0 ; i < iterations ; + + i ) { <nl> + std : : unique_lock < std : : mutex > lk ( cv_m ) ; <nl> + cv . wait ( lk , [ i ] { return i < g_sync_for_mt ; } ) ; <nl> + for ( uint32_t j = 0 ; j < 10 ; + + j ) { <nl> + counter - > increment ( 1 ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / Slow test with fewer threads where there are more busy waits and <nl> + / / many calls to readFull ( ) . This attempts to test as many of the <nl> + / / code paths in Counter as possible to ensure that counter values are <nl> + / / properly passed from thread local state , both at calls to <nl> + / / readFull ( ) and at thread death . <nl> + TEST_F ( ThreadCachedIntTest , MultithreadedSlow ) { <nl> + static constexpr uint32_t kNumThreads = 20 ; <nl> + g_sync_for_mt = 0 ; <nl> + vector < unique_ptr < std : : thread > > threads ( kNumThreads ) ; <nl> + / / Creates kNumThreads threads . Each thread performs a different <nl> + / / number of iterations in Runner ( ) - threads [ 0 ] performs 1 <nl> + / / iteration , threads [ 1 ] performs 2 iterations , threads [ 2 ] performs <nl> + / / 3 iterations , and so on . <nl> + for ( uint32_t i = 0 ; i < kNumThreads ; + + i ) { <nl> + threads [ i ] . reset ( new std : : thread ( Runner , & g_counter_for_mt_slow , i + 1 ) ) ; <nl> + } <nl> + / / Variable to grab current counter value . <nl> + int32_t counter_value ; <nl> + / / The expected value of the counter . <nl> + int32_t total = 0 ; <nl> + / / The expected value of GetDeadThreadsTotal ( ) . <nl> + int32_t dead_total = 0 ; <nl> + / / Each iteration of the following thread allows one additional <nl> + / / iteration of the threads . Given that the threads perform <nl> + / / different number of iterations from 1 through kNumThreads , one <nl> + / / thread will complete in each of the iterations of the loop below . <nl> + for ( uint32_t i = 0 ; i < kNumThreads ; + + i ) { <nl> + / / Allow upto iteration i on all threads . <nl> + { <nl> + std : : lock_guard < std : : mutex > lk ( cv_m ) ; <nl> + g_sync_for_mt = i + 1 ; <nl> + } <nl> + cv . notify_all ( ) ; <nl> + total + = ( kNumThreads - i ) * 10 ; <nl> + / / Loop until the counter reaches its expected value . <nl> + do { <nl> + counter_value = g_counter_for_mt_slow . readFull ( ) ; <nl> + } while ( counter_value < total ) ; <nl> + / / All threads have done what they can until iteration i , now make <nl> + / / sure they don ' t go further by checking 10 more times in the <nl> + / / following loop . <nl> + for ( uint32_t j = 0 ; j < 10 ; + + j ) { <nl> + counter_value = g_counter_for_mt_slow . readFull ( ) ; <nl> + EXPECT_EQ ( total , counter_value ) ; <nl> + } <nl> + dead_total + = ( i + 1 ) * 10 ; <nl> + EXPECT_GE ( dead_total , GetDeadThreadsTotal ( g_counter_for_mt_slow ) ) ; <nl> + } <nl> + / / All threads are done . <nl> + for ( uint32_t i = 0 ; i < kNumThreads ; + + i ) { <nl> + threads [ i ] - > join ( ) ; <nl> + } <nl> + counter_value = g_counter_for_mt_slow . readFull ( ) ; <nl> + EXPECT_EQ ( total , counter_value ) ; <nl> + EXPECT_EQ ( total , dead_total ) ; <nl> + EXPECT_EQ ( dead_total , GetDeadThreadsTotal ( g_counter_for_mt_slow ) ) ; <nl> + } <nl> + <nl> + / / Fast test with lots of threads and only one call to readFull ( ) <nl> + / / at the end . <nl> + TEST_F ( ThreadCachedIntTest , MultithreadedFast ) { <nl> + static constexpr uint32_t kNumThreads = 1000 ; <nl> + g_sync_for_mt = 0 ; <nl> + vector < unique_ptr < std : : thread > > threads ( kNumThreads ) ; <nl> + / / Creates kNumThreads threads . Each thread performs a different <nl> + / / number of iterations in Runner ( ) - threads [ 0 ] performs 1 <nl> + / / iteration , threads [ 1 ] performs 2 iterations , threads [ 2 ] performs <nl> + / / 3 iterations , and so on . <nl> + for ( uint32_t i = 0 ; i < kNumThreads ; + + i ) { <nl> + threads [ i ] . reset ( new std : : thread ( Runner , & g_counter_for_mt_fast , i + 1 ) ) ; <nl> + } <nl> + / / Let the threads run to completion . <nl> + { <nl> + std : : lock_guard < std : : mutex > lk ( cv_m ) ; <nl> + g_sync_for_mt = kNumThreads ; <nl> + } <nl> + cv . notify_all ( ) ; <nl> + / / The expected value of the counter . <nl> + uint32_t total = 0 ; <nl> + for ( uint32_t i = 0 ; i < kNumThreads ; + + i ) { <nl> + total + = ( kNumThreads - i ) * 10 ; <nl> + } <nl> + / / Wait for all threads to complete . <nl> + for ( uint32_t i = 0 ; i < kNumThreads ; + + i ) { <nl> + threads [ i ] - > join ( ) ; <nl> + } <nl> + int32_t counter_value = g_counter_for_mt_fast . readFull ( ) ; <nl> + EXPECT_EQ ( total , counter_value ) ; <nl> + EXPECT_EQ ( total , GetDeadThreadsTotal ( g_counter_for_mt_fast ) ) ; <nl> + } <nl> + <nl> TEST ( ThreadCachedInt , SingleThreadedNotCached ) { <nl> ThreadCachedInt < int64_t > val ( 0 , 0 ) ; <nl> EXPECT_EQ ( 0 , val . readFast ( ) ) ; <nl>
|
Fix ThreadCachedInt race condition
|
facebook/folly
|
6039ee419aa6cf043e010297b29348267ab5be0d
|
2016-09-29T15:23:59Z
|
mmm a / lib / IRGen / GenClangType . cpp <nl> ppp b / lib / IRGen / GenClangType . cpp <nl> GenClangType : : visitBoundGenericType ( CanBoundGenericType type ) { <nl> CMutablePointer , <nl> CConstPointer , <nl> Array , <nl> + Unmanaged , <nl> } kind = llvm : : StringSwitch < StructKind > ( swiftStructDecl - > getName ( ) . str ( ) ) <nl> . Case ( " UnsafePointer " , StructKind : : UnsafePointer ) <nl> . Case ( " ObjCMutablePointer " , StructKind : : ObjCMutablePointer ) <nl> . Case ( " CMutablePointer " , StructKind : : CMutablePointer ) <nl> . Case ( " CConstPointer " , StructKind : : CConstPointer ) <nl> . Case ( " Array " , StructKind : : Array ) <nl> + . Case ( " Unmanaged " , StructKind : : Unmanaged ) <nl> . Default ( StructKind : : Invalid ) ; <nl> <nl> auto args = type - > getGenericArgs ( ) ; <nl> GenClangType : : visitBoundGenericType ( CanBoundGenericType type ) { <nl> " Clang module ! " ) ; <nl> <nl> case StructKind : : UnsafePointer : / / Assume UnsafePointer is mutable <nl> + case StructKind : : Unmanaged : <nl> case StructKind : : ObjCMutablePointer : <nl> case StructKind : : CMutablePointer : { <nl> auto clangCanTy = visit ( args . front ( ) - > getCanonicalType ( ) ) ; <nl>
|
Teach the swift - > clang ABI code not to sweat about Unmanaged < T > .
|
apple/swift
|
189e78c34834c082cb7ea32cab400a48693e8531
|
2014-05-02T20:17:16Z
|
mmm a / tensorflow / core / framework / dataset . cc <nl> ppp b / tensorflow / core / framework / dataset . cc <nl> Status DatasetBaseIterator : : GetNext ( IteratorContext * ctx , <nl> profiler : : TraceMe activity ( [ & ] { return BuildTraceMeName ( ) ; } , <nl> profiler : : TraceMeLevel : : kInfo ) ; <nl> DVLOG ( 3 ) < < prefix ( ) < < " GetNext enter " ; <nl> + RecordInput ( ctx ) ; <nl> RecordStart ( ctx , / * stop_output = * / true ) ; <nl> Status s = GetNextInternal ( ctx , out_tensors , end_of_sequence ) ; <nl> if ( s . ok ( ) & & ! * end_of_sequence ) RecordElement ( ctx , out_tensors ) ; <nl> mmm a / tensorflow / core / framework / dataset . h <nl> ppp b / tensorflow / core / framework / dataset . h <nl> class DatasetBaseIterator : public IteratorBase { <nl> } <nl> } <nl> <nl> + / / When modeling is enabled , this method records the fact that this iterator <nl> + / / is called . <nl> + void RecordInput ( IteratorContext * ctx ) { <nl> + if ( collect_resource_usage ( ctx ) ) { <nl> + int64 now_nanos = EnvTime : : NowNanos ( ) ; <nl> + node_ - > record_input ( now_nanos ) ; <nl> + } <nl> + } <nl> + <nl> / / When modeling is enabled , this method records the fact that a thread of <nl> / / this iterator has started work . <nl> void RecordStart ( IteratorContext * ctx , bool stop_output = false ) { <nl> mmm a / tensorflow / core / framework / model . cc <nl> ppp b / tensorflow / core / framework / model . cc <nl> class InterleaveMany : public Node { <nl> ( * input_times ) [ long_name ( ) ] = old_input_time ; <nl> return ; <nl> } <nl> - / / Here ` old_input_time + SelfProcessingTimeLocked ( ) ` is the average input <nl> + / / Here ` old_input_time + SelfProcessingTime ( ) ` is the average input <nl> / / time for the interleave node to call one of the ` ( num_inputs ( ) - 1 ) ` <nl> / / input nodes ( except the first one ) to return an element . Regardless of the <nl> / / ` block_length ` parameter of interleave node , the average input time for <nl> / / any of the ` ( num_inputs ( ) - 1 ) ` input nodes to be called is computed as : <nl> - double new_input_time = ( old_input_time + SelfProcessingTimeLocked ( ) ) * <nl> + double new_input_time = ( old_input_time + SelfProcessingTime ( ) ) * <nl> static_cast < double > ( num_inputs ( ) - 1 ) ; <nl> ( * input_times ) [ long_name ( ) ] = new_input_time ; <nl> } <nl> class InterleaveMany : public Node { <nl> absl : : flat_hash_map < string , double > * output_times , <nl> absl : : flat_hash_map < string , double > * output_time_gradients ) const override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( num_inputs ( ) < = 1 ) { <nl> ( * output_times ) [ long_name ( ) ] = self_processing_time ; <nl> if ( gradients ) { <nl> class InterleaveMany : public Node { <nl> absl : : flat_hash_map < string , double > * processing_times , <nl> absl : : flat_hash_map < string , double > * total_processing_times ) override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( processing_times ) { <nl> ( * processing_times ) [ long_name ( ) ] = self_processing_time ; <nl> } <nl> class AsyncInterleaveMany : public Node { <nl> input_time = gtl : : FindWithDefault ( * input_times , kInputTimeKey , 0 . 0L ) ; <nl> } <nl> } else { <nl> - input_time = <nl> - SelfProcessingTimeLocked ( ) * static_cast < double > ( num_inputs ( ) - 1 ) ; <nl> + input_time = SelfProcessingTime ( ) * static_cast < double > ( num_inputs ( ) - 1 ) ; <nl> } <nl> ( * input_times ) [ long_name ( ) ] = input_time ; <nl> } <nl> class AsyncInterleaveMany : public Node { <nl> absl : : flat_hash_map < string , double > * output_times , <nl> absl : : flat_hash_map < string , double > * output_time_gradients ) const override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( num_inputs ( ) < = 1 ) { <nl> ( * output_times ) [ long_name ( ) ] = self_processing_time ; <nl> if ( gradients ) { <nl> class AsyncInterleaveMany : public Node { <nl> absl : : flat_hash_map < string , double > * processing_times , <nl> absl : : flat_hash_map < string , double > * total_processing_times ) override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( processing_times ) { <nl> ( * processing_times ) [ long_name ( ) ] = self_processing_time ; <nl> } <nl> class KnownRatio : public Node { <nl> ( * input_times ) [ long_name ( ) ] = old_input_time ; <nl> return ; <nl> } <nl> - double new_input_time = <nl> - ( old_input_time + SelfProcessingTimeLocked ( ) ) / ratio_ ; <nl> + double new_input_time = ( old_input_time + SelfProcessingTime ( ) ) / ratio_ ; <nl> ( * input_times ) [ long_name ( ) ] = new_input_time ; <nl> } <nl> <nl> class KnownRatio : public Node { <nl> absl : : flat_hash_map < string , double > * output_times , <nl> absl : : flat_hash_map < string , double > * output_time_gradients ) const override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( ratio_ = = 0 ) { <nl> ( * output_times ) [ long_name ( ) ] = self_processing_time ; <nl> if ( gradients ) { <nl> class KnownRatio : public Node { <nl> absl : : flat_hash_map < string , double > * processing_times , <nl> absl : : flat_hash_map < string , double > * total_processing_times ) override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( processing_times ) { <nl> ( * processing_times ) [ long_name ( ) ] = self_processing_time ; <nl> } <nl> class AsyncKnownRatio : public Node { <nl> if ( parallelism_parameter ) { <nl> parallelism = ( * parallelism_parameter ) - > value ; <nl> } <nl> - input_time = SelfProcessingTimeLocked ( ) / ratio_ / parallelism ; <nl> + input_time = SelfProcessingTime ( ) / ratio_ / parallelism ; <nl> ( * input_times ) [ long_name ( ) ] = input_time ; <nl> } <nl> <nl> class AsyncKnownRatio : public Node { <nl> } else if ( buffer_size_parameter ) { <nl> buffer_size = ( * buffer_size_parameter ) - > value ; <nl> } <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> double result ; <nl> double input_time ; <nl> if ( output_ ) { <nl> class AsyncKnownRatio : public Node { <nl> absl : : flat_hash_map < string , double > * processing_times , <nl> absl : : flat_hash_map < string , double > * total_processing_times ) override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( processing_times ) { <nl> ( * processing_times ) [ long_name ( ) ] = self_processing_time ; <nl> } <nl> class UnknownRatio : public Node { <nl> std : : shared_ptr < Node > input = inputs_ . front ( ) ; <nl> double ratio = static_cast < double > ( input - > num_elements ( ) ) / <nl> static_cast < double > ( num_elements_ ) ; <nl> - double new_input_time = <nl> - ( old_input_time + SelfProcessingTimeLocked ( ) ) / ratio ; <nl> + double new_input_time = ( old_input_time + SelfProcessingTime ( ) ) / ratio ; <nl> ( * input_times ) [ long_name ( ) ] = new_input_time ; <nl> } <nl> <nl> class UnknownRatio : public Node { <nl> absl : : flat_hash_map < string , double > * output_times , <nl> absl : : flat_hash_map < string , double > * output_time_gradients ) const override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( num_elements_ = = 0 | | inputs_ . empty ( ) | | <nl> inputs_ . front ( ) - > num_elements ( ) = = 0 ) { <nl> ( * output_times ) [ long_name ( ) ] = self_processing_time ; <nl> class UnknownRatio : public Node { <nl> absl : : flat_hash_map < string , double > * processing_times , <nl> absl : : flat_hash_map < string , double > * total_processing_times ) override <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) { <nl> - double self_processing_time = SelfProcessingTimeLocked ( ) ; <nl> + double self_processing_time = SelfProcessingTime ( ) ; <nl> if ( processing_times ) { <nl> ( * processing_times ) [ long_name ( ) ] = self_processing_time ; <nl> } <nl> std : : shared_ptr < Node > Node : : Snapshot ( std : : shared_ptr < Node > output ) const { <nl> return result ; <nl> } <nl> <nl> - double Node : : SelfProcessingTime ( ) const { <nl> - tf_shared_lock l ( mu_ ) ; <nl> - return SelfProcessingTimeLocked ( ) ; <nl> - } <nl> - <nl> double Node : : TotalBufferedBytes ( ) const { <nl> absl : : flat_hash_map < string , double > total_bytes ; <nl> tf_shared_lock l ( mu_ ) ; <nl> double Node : : TotalProcessingTimeForInputs ( <nl> return sum ; <nl> } <nl> <nl> - double Node : : SelfProcessingTimeLocked ( ) const { <nl> + double Node : : SelfInputTime ( ) const { <nl> + if ( num_elements_ < = 1 ) { <nl> + return 0 ; <nl> + } <nl> + return static_cast < double > ( input_time_ ) / <nl> + static_cast < double > ( num_elements_ - 1 ) ; <nl> + } <nl> + <nl> + double Node : : SelfProcessingTime ( ) const { <nl> if ( num_elements_ = = 0 ) { <nl> return 0 ; <nl> } <nl> std : : shared_ptr < Node > Node : : SnapshotHelper ( <nl> result_node - > num_elements_ . store ( num_elements_ ) ; <nl> result_node - > record_metrics_ . store ( false ) ; <nl> result_node - > processing_time_ . store ( processing_time_ ) ; <nl> + result_node - > input_time_ . store ( input_time_ ) ; <nl> + result_node - > last_input_time_ . store ( last_input_time_ ) ; <nl> mutex_lock l2 ( result_node - > mu_ ) ; <nl> result_node - > parameters_ = parameters_ ; <nl> } <nl> double Model : : OutputTime ( std : : shared_ptr < Node > node , <nl> absl : : flat_hash_map < string , double > * gradients ) { <nl> / / To store the input time for each node . <nl> absl : : flat_hash_map < string , double > input_times ; <nl> + input_times [ kInputTimeKey ] = node - > SelfInputTime ( ) ; <nl> <nl> / / TODO ( jsimsa ) : Now that we are accounting for buffer size in wait time <nl> / / computation , assuming that the input is infinitely fast will result in <nl> mmm a / tensorflow / core / framework / model . h <nl> ppp b / tensorflow / core / framework / model . h <nl> class Node { <nl> bytes_produced_ ( 0 ) , <nl> num_elements_ ( 0 ) , <nl> processing_time_ ( 0 ) , <nl> + input_time_ ( 0 ) , <nl> + last_input_time_ ( 0 ) , <nl> record_metrics_ ( true ) , <nl> metrics_ ( name_ ) , <nl> output_ ( args . output . get ( ) ) { } <nl> class Node { <nl> num_elements_ + + ; <nl> } <nl> <nl> + / / Records that an element has been requested . <nl> + void record_input ( int64 time_nanos ) TF_LOCKS_EXCLUDED ( mu_ ) { <nl> + if ( last_input_time_ ! = 0 ) { <nl> + DCHECK_LE ( last_input_time_ , time_nanos ) ; <nl> + input_time_ + = time_nanos - last_input_time_ ; <nl> + } <nl> + last_input_time_ = time_nanos ; <nl> + } <nl> + <nl> / / Records that a node thread has started executing . <nl> void record_start ( int64 time_nanos ) TF_LOCKS_EXCLUDED ( mu_ ) { <nl> DCHECK_EQ ( work_start_ , 0 ) ; <nl> class Node { <nl> std : : shared_ptr < Node > Snapshot ( std : : shared_ptr < Node > output ) const <nl> TF_LOCKS_EXCLUDED ( mu_ ) ; <nl> <nl> + / / Returns the per - element input time this node is called . <nl> + double SelfInputTime ( ) const ; <nl> + <nl> / / Returns the per - element processing time spent in this node . <nl> - double SelfProcessingTime ( ) const TF_LOCKS_EXCLUDED ( mu_ ) ; <nl> + double SelfProcessingTime ( ) const ; <nl> <nl> / / Returns the total number of bytes buffered in all nodes in the subtree for <nl> / / which autotuning is enabled . <nl> class Node { <nl> const absl : : flat_hash_map < string , double > & total_processing_times ) <nl> TF_SHARED_LOCKS_REQUIRED ( mu_ ) ; <nl> <nl> - / / Returns the per - element processing time spent in this node . <nl> - double SelfProcessingTimeLocked ( ) const TF_SHARED_LOCKS_REQUIRED ( mu_ ) ; <nl> - <nl> / / Computes the per - element CPU time spent in the subtree rooted in this node <nl> / / and stores it in ` total_processing_times ` . If ` processing_times ` is not <nl> / / ` nullptr ` , collects the per - element CPU time spent in each node of the <nl> class Node { <nl> std : : atomic < int64 > bytes_produced_ ; <nl> std : : atomic < int64 > num_elements_ ; <nl> std : : atomic < int64 > processing_time_ ; <nl> + std : : atomic < int64 > input_time_ ; <nl> + / / Records the time current node is called for future use . <nl> + std : : atomic < int64 > last_input_time_ ; <nl> std : : atomic < bool > record_metrics_ ; <nl> Metrics metrics_ ; <nl> absl : : flat_hash_map < string , std : : shared_ptr < Parameter > > parameters_ <nl> mmm a / tensorflow / core / framework / model_test . cc <nl> ppp b / tensorflow / core / framework / model_test . cc <nl> INSTANTIATE_TEST_SUITE_P ( <nl> : : testing : : Values ( 0 , 20 , 40 , 80 , 100 ) , <nl> : : testing : : Values ( 0 , 1 , 2 , 4 , 10 , 20 , 40 ) ) ) ; <nl> <nl> + class SelfProcessingTimeTest : public : : testing : : TestWithParam < int64 > { } ; <nl> + <nl> + TEST_P ( SelfProcessingTimeTest , Model ) { <nl> + const int64 add_times = GetParam ( ) ; <nl> + std : : shared_ptr < Node > source = model : : MakeSourceNode ( { 0 , " source " , nullptr } ) ; <nl> + for ( int i = 0 ; i < add_times ; i + + ) { <nl> + source - > add_processing_time ( i ) ; <nl> + source - > record_element ( ) ; <nl> + } <nl> + double self_processing_time = <nl> + ( add_times = = 0 ? 0 . 0 : ( static_cast < double > ( add_times ) - 1 . 0 ) / 2 . 0 ) ; <nl> + EXPECT_EQ ( source - > SelfProcessingTime ( ) , self_processing_time ) ; <nl> + } <nl> + <nl> + INSTANTIATE_TEST_SUITE_P ( Test , SelfProcessingTimeTest , <nl> + : : testing : : Values ( 0 , 1 , 2 , 5 , 10 , 20 , 40 ) ) ; <nl> + <nl> + class SelfInputTimeTest : public : : testing : : TestWithParam < int64 > { } ; <nl> + <nl> + TEST_P ( SelfInputTimeTest , Model ) { <nl> + const int64 add_times = GetParam ( ) ; <nl> + std : : shared_ptr < Node > source = model : : MakeSourceNode ( { 0 , " source " , nullptr } ) ; <nl> + for ( int i = 0 ; i < add_times ; i + + ) { <nl> + source - > record_input ( ( 1 + i ) * i / 2 + 1 ) ; <nl> + source - > record_element ( ) ; <nl> + } <nl> + double self_input_time = <nl> + ( add_times < = 1 ? 0 . 0 : static_cast < double > ( add_times ) / 2 . 0 ) ; <nl> + EXPECT_EQ ( source - > SelfInputTime ( ) , self_input_time ) ; <nl> + } <nl> + <nl> + INSTANTIATE_TEST_SUITE_P ( Test , SelfInputTimeTest , <nl> + : : testing : : Values ( 0 , 1 , 2 , 5 , 10 , 20 , 40 ) ) ; <nl> + <nl> } / / namespace <nl> } / / namespace model <nl> } / / namespace data <nl>
|
[ tf . data ] Calculate the average input time for the root node of the data input pipeline .
|
tensorflow/tensorflow
|
57c09eb4d8b9bce1d7f5c0abef97349ca98291a9
|
2020-06-10T19:18:06Z
|
mmm a / tensorflow / core / kernels / population_count_op . cc <nl> ppp b / tensorflow / core / kernels / population_count_op . cc <nl> struct PopulationCount < CPUDevice , T > { <nl> <nl> } / / namespace functor <nl> <nl> - # if GOOGLE_CUDA <nl> + # if GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl> <nl> # define REGISTER_POPULATION_COUNT ( type ) \ <nl> REGISTER_KERNEL_BUILDER ( \ <nl> TF_CALL_int64 ( DECLARE_GPU_SPEC ) ; <nl> <nl> } / / namespace functor <nl> <nl> - # endif / / GOOGLE_CUDA <nl> + # endif / / GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl> <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / kernels / population_count_op_gpu . cu . cc <nl> ppp b / tensorflow / core / kernels / population_count_op_gpu . cu . cc <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - # if GOOGLE_CUDA <nl> + # if GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl> <nl> # define EIGEN_USE_GPU <nl> <nl> namespace functor { <nl> template < typename T > <nl> __global__ void PopulationCountKernel ( const int size , const T * input , <nl> uint8 * output ) { <nl> - CUDA_1D_KERNEL_LOOP ( i , size ) { output [ i ] = __popc ( ldg ( input + i ) ) ; } <nl> + GPU_1D_KERNEL_LOOP ( i , size ) { output [ i ] = __popc ( ldg ( input + i ) ) ; } <nl> } <nl> <nl> template < > <nl> __global__ void PopulationCountKernel ( const int size , const int8 * input , <nl> uint8 * output ) { <nl> / / For some reason , __popc on a negative int8 gets confused . <nl> - CUDA_1D_KERNEL_LOOP ( i , size ) { <nl> + GPU_1D_KERNEL_LOOP ( i , size ) { <nl> output [ i ] = __popc ( ldg ( reinterpret_cast < const uint8 * > ( input + i ) ) ) ; <nl> } <nl> } <nl> template < > <nl> __global__ void PopulationCountKernel ( const int size , const int16 * input , <nl> uint8 * output ) { <nl> / / For some reason , __popc on a negative int16 gets confused . <nl> - CUDA_1D_KERNEL_LOOP ( i , size ) { <nl> + GPU_1D_KERNEL_LOOP ( i , size ) { <nl> output [ i ] = __popc ( ldg ( reinterpret_cast < const uint16 * > ( input + i ) ) ) ; <nl> } <nl> } <nl> __global__ void PopulationCountKernel ( const int size , const int16 * input , <nl> template < > <nl> __global__ void PopulationCountKernel < int64 > ( const int size , const int64 * input , <nl> uint8 * output ) { <nl> - CUDA_1D_KERNEL_LOOP ( i , size ) { output [ i ] = __popcll ( ldg ( input + i ) ) ; } <nl> + GPU_1D_KERNEL_LOOP ( i , size ) { output [ i ] = __popcll ( ldg ( input + i ) ) ; } <nl> } <nl> <nl> # define DEFINE_GPU_SPECS ( T ) \ <nl> __global__ void PopulationCountKernel < int64 > ( const int size , const int64 * input , <nl> TTypes < uint8 > : : Flat output ) { \ <nl> const GPUDevice & d = c - > eigen_device < GPUDevice > ( ) ; \ <nl> int64 total_count = input . size ( ) ; \ <nl> - GpuLaunchConfig config = GetCudaLaunchConfig ( total_count , d ) ; \ <nl> - TF_CHECK_OK ( CudaLaunchKernel ( PopulationCountKernel < T > , config . block_count , \ <nl> + GpuLaunchConfig config = GetGpuLaunchConfig ( total_count , d ) ; \ <nl> + TF_CHECK_OK ( GpuLaunchKernel ( PopulationCountKernel < T > , config . block_count , \ <nl> config . thread_per_block , 0 , d . stream ( ) , \ <nl> total_count , input . data ( ) , output . data ( ) ) ) ; \ <nl> } <nl> TF_CALL_int64 ( DEFINE_GPU_SPECS ) ; <nl> <nl> } / / namespace tensorflow <nl> <nl> - # endif / / GOOGLE_CUDA <nl> + # endif / / GOOGLE_CUDA | | TENSORFLOW_USE_ROCM <nl>
|
Adding ROCM support for the population_count op
|
tensorflow/tensorflow
|
e7f1163401c7c5096c7a5b880aeff05674801e01
|
2019-06-10T15:39:12Z
|
mmm a / . gitignore <nl> ppp b / . gitignore <nl> gtags . files <nl> turbo * . cfg <nl> turbo * . dot <nl> turbo * . json <nl> + v8 . ignition_dispatches_table . json <nl>
|
Add v8 . ignition_dispatches_table . json to . gitignore
|
v8/v8
|
529e2a92ab8f790852f112ebb3f0f4106fec213b
|
2016-05-03T18:12:11Z
|
mmm a / toolsrc / include / triplet . h <nl> ppp b / toolsrc / include / triplet . h <nl> namespace vcpkg <nl> { <nl> static triplet from_canonical_name ( const std : : string & triplet_as_string ) ; <nl> <nl> + enum class BuildType <nl> + { <nl> + DYNAMIC , <nl> + STATIC <nl> + } ; <nl> + <nl> static const triplet X86_WINDOWS ; <nl> static const triplet X64_WINDOWS ; <nl> static const triplet X86_UWP ; <nl> static const triplet X64_UWP ; <nl> static const triplet ARM_UWP ; <nl> <nl> + BuildType build_type ( ) const ; <nl> + <nl> const std : : string & canonical_name ( ) const ; <nl> <nl> std : : string architecture ( ) const ; <nl> mmm a / toolsrc / src / triplet . cpp <nl> ppp b / toolsrc / src / triplet . cpp <nl> namespace vcpkg <nl> auto it = std : : find ( this - > m_canonical_name . cbegin ( ) , this - > m_canonical_name . cend ( ) , ' - ' ) ; <nl> return std : : string ( it + 1 , this - > m_canonical_name . cend ( ) ) ; <nl> } <nl> + <nl> + triplet : : BuildType triplet : : build_type ( ) const <nl> + { <nl> + if ( this - > m_canonical_name . find ( " static " ) ! = std : : string : : npos ) <nl> + { <nl> + return BuildType : : STATIC ; <nl> + } <nl> + <nl> + return BuildType : : DYNAMIC ; <nl> + } <nl> } <nl>
|
Add triplet : : build_type ( )
|
microsoft/vcpkg
|
52b7630c86cda1fce144d3bddfc27d434ed3011e
|
2016-10-06T00:44:02Z
|
mmm a / utils / buildbot - release - notes . txt <nl> ppp b / utils / buildbot - release - notes . txt <nl> <nl> Latest <nl> mmmmmm <nl> <nl> + * When force - casting between arrays of class or @ objc protocol types <nl> + using " a as [ C ] " , type checking is now deferred until the moment <nl> + each element is accessed . Because bridging conversions from NSArray <nl> + are equivalent to force - casts from [ NSArray ] , this makes certain <nl> + Array round - trips through Objective - C code O ( 1 ) instead of O ( N ) . <nl> + <nl> * ' RawOptionSetType ' now implements to ' BitwiseOperationsType ' , so imported <nl> NS_OPTIONS now support the bitwise assignment operators ' | = ' , ' & = ' , <nl> and ' ^ = ' <nl>
|
Release note deferred array cast checks
|
apple/swift
|
97d332086ed61c516a47f9161ef196442ca9ddd4
|
2014-07-29T21:53:54Z
|
mmm a / drivers / unix / syslog_logger . cpp <nl> ppp b / drivers / unix / syslog_logger . cpp <nl> void SyslogLogger : : print_error ( const char * p_function , const char * p_file , int p <nl> SyslogLogger : : ~ SyslogLogger ( ) { <nl> } <nl> <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl> mmm a / misc / dist / ios_xcode / godot_ios / dylibs / empty <nl> ppp b / misc / dist / ios_xcode / godot_ios / dylibs / empty <nl> @ @ - 1 + 1 @ @ <nl> - Dummy file to make dylibs folder exported <nl> \ No newline at end of file <nl> + Dummy file to make dylibs folder exported <nl> mmm a / modules / arkit / SCsub <nl> ppp b / modules / arkit / SCsub <nl> env_arkit = env_modules . Clone ( ) <nl> modules_sources = [ ] <nl> env_arkit . add_source_files ( modules_sources , " * . cpp " ) <nl> env_arkit . add_source_files ( modules_sources , " * . mm " ) <nl> - mod_lib = env_modules . add_library ( ' # bin / libgodot_arkit_module ' + env [ ' LIBSUFFIX ' ] , modules_sources ) <nl> \ No newline at end of file <nl> + mod_lib = env_modules . add_library ( ' # bin / libgodot_arkit_module ' + env [ ' LIBSUFFIX ' ] , modules_sources ) <nl> mmm a / modules / arkit / arkit_session_delegate . mm <nl> ppp b / modules / arkit / arkit_session_delegate . mm <nl> - ( void ) session : ( ARSession * ) session didUpdateAnchors : ( NSArray < ARAnchor * > * ) anc <nl> } <nl> } <nl> <nl> - @ end <nl> \ No newline at end of file <nl> + @ end <nl> mmm a / modules / camera / camera_ios . h <nl> ppp b / modules / camera / camera_ios . h <nl> class CameraIOS : public CameraServer { <nl> void update_feeds ( ) ; <nl> } ; <nl> <nl> - # endif / * CAMERAIOS_H * / <nl> \ No newline at end of file <nl> + # endif / * CAMERAIOS_H * / <nl> mmm a / modules / gdnative / android / android_gdn . cpp <nl> ppp b / modules / gdnative / android / android_gdn . cpp <nl> bool GDAPI godot_android_is_activity_resumed ( ) { <nl> <nl> # ifdef __cplusplus <nl> } <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl> mmm a / modules / gridmap / doc_classes / README . md <nl> ppp b / modules / gridmap / doc_classes / README . md <nl> @ @ - 1 + 1 @ @ <nl> - Doc classes will appear here when generating <nl> \ No newline at end of file <nl> + Doc classes will appear here when generating <nl> mmm a / modules / mono / editor / GodotTools / GodotTools . BuildLogger / Properties / AssemblyInfo . cs <nl> ppp b / modules / mono / editor / GodotTools / GodotTools . BuildLogger / Properties / AssemblyInfo . cs <nl> <nl> - using System . Reflection ; <nl> + using System . Reflection ; <nl> using System . Runtime . InteropServices ; <nl> <nl> / / General Information about an assembly is controlled through the following <nl> mmm a / modules / mono / editor / GodotTools / GodotTools . IdeConnection / Properties / AssemblyInfo . cs <nl> ppp b / modules / mono / editor / GodotTools / GodotTools . IdeConnection / Properties / AssemblyInfo . cs <nl> <nl> - using System . Reflection ; <nl> + using System . Reflection ; <nl> using System . Runtime . InteropServices ; <nl> <nl> / / General Information about an assembly is controlled through the following <nl> mmm a / modules / mono / editor / GodotTools / GodotTools . ProjectEditor / Properties / AssemblyInfo . cs <nl> ppp b / modules / mono / editor / GodotTools / GodotTools . ProjectEditor / Properties / AssemblyInfo . cs <nl> <nl> - using System . Reflection ; <nl> + using System . Reflection ; <nl> using System . Runtime . CompilerServices ; <nl> <nl> / / Information about this assembly is defined by the following attributes . <nl> mmm a / platform / android / java / lib / src / com / google / android / vending / expansion / downloader / Constants . java <nl> ppp b / platform / android / java / lib / src / com / google / android / vending / expansion / downloader / Constants . java <nl> <nl> * / <nl> public static final long ACTIVE_THREAD_WATCHDOG = 5 * 1000 ; <nl> <nl> - } <nl> \ No newline at end of file <nl> + } <nl> mmm a / platform / osx / context_gl_osx . h <nl> ppp b / platform / osx / context_gl_osx . h <nl> class ContextGL_OSX { <nl> } ; <nl> <nl> # endif <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl> mmm a / servers / visual / rasterizer_rd / cubemap_coeffs . h <nl> ppp b / servers / visual / rasterizer_rd / cubemap_coeffs . h <nl> const float low_quality_coeffs [ 7 ] [ 5 ] [ 6 ] [ 4 ] = { { { { 0 . 0002037563 , 0 . 0045063655 , <nl> <nl> const float high_quality_coeffs [ 7 ] [ 5 ] [ 3 ] [ 24 ] [ 4 ] = { { { { { - 4 . 8355339e - 06 , - 4 . 4902569e - 05 , - 9 . 2632249e - 05 , - 0 . 00053773136 } , { 0 . 0040143823 , - 0 . 00060900339 , - 0 . 0095301923 , - 0 . 0053956011 } , { - 0 . 0005923892 , - 3 . 6901978e - 05 , - 5 . 6694857e - 06 , - 0 . 00017018564 } , { 0 . 0012441402 , 0 . 02236187 , 0 . 022751769 , 0 . 0062788948 } , { 0 . 00013810055 , - 2 . 2709815e - 05 , 0 . 0054849671 , - 1 . 6599195e - 05 } , { - 0 . 020320408 , - 0 . 017066319 , - 0 . 017457746 , 0 . 022910628 } , { 0 . 00024171724 , 9 . 7419073e - 05 , - 0 . 00047804272 , - 0 . 00010093683 } , { 7 . 6988167e - 05 , 1 . 8551597e - 05 , - 5 . 7692813e - 05 , - 3 . 332362e - 05 } , { - 0 . 00062766208 , 2 . 713742e - 05 , 0 . 00026511682 , 2 . 3841873e - 05 } , { - 0 . 00043656844 , 0 . 0028645469 , 0 . 0049817085 , 0 . 0080221478 } , { - 3 . 3210444e - 05 , - 8 . 0852386e - 05 , - 2 . 2111492e - 06 , - 8 . 4430827e - 05 } , { 0 . 010967284 , 0 . 018811225 , 0 . 017569463 , - 0 . 0046944996 } , { - 0 . 00018391248 , - 0 . 00010462174 , - 0 . 00017726 , - 0 . 00018490133 } , { 0 . 00012591989 , 0 . 015965386 , 0 . 015964059 , - 0 . 0078018431 } , { - 0 . 006125333 , - 8 . 2224165e - 05 , - 0 . 00020500151 , - 0 . 00025207244 } , { - 0 . 00016320041 , - 0 . 0001279242 , 0 . 00014038799 , 8 . 1359421e - 05 } , { - 0 . 00064341098 , - 0 . 0011265496 , - 0 . 0011634792 , - 0 . 00081607159 } , { 0 . 00089294825 , 0 . 0061923653 , 0 . 0052662392 , - 0 . 00058227469 } , { - 2 . 4001308e - 05 , - 1 . 3534224e - 05 , - 1 . 4720478e - 05 , - 2 . 5120827e - 05 } , { 0 . 00029964918 , - 0 . 0045658543 , - 0 . 0045581938 , 0 . 0017106208 } , { 7 . 5790173e - 05 , - 1 . 8265415e - 05 , 1 . 5918205e - 05 , 5 . 8524021e - 05 } , { 0 . 0011669872 , - 0 . 00017571882 , - 0 . 00017190275 , - 0 . 0023833977 } , { 0 . 0033487264 , - 0 . 0066535821 , - 0 . 0066413786 , - 0 . 0032332601 } , { - 3 . 6468807e - 05 , - 0 . 00068145131 , - 9 . 8190714e - 05 , - 8 . 7169435e - 05 } } , { { - 0 . 0010440653 , - 8 . 9750644e - 05 , 4 . 971182e - 05 , 0 . 0044618878 } , { 0 . 0078333883 , - 0 . 00090884312 , - 0 . 00046920549 , - 0 . 002465051 } , { - 0 . 0058778609 , 0 . 0026554895 , - 0 . 00031880506 , - 0 . 00010649091 } , { - 0 . 0015095448 , 0 . 0094026506 , 0 . 009492703 , 0 . 0024572848 } , { 0 . 0047331786 , 0 . 00070722401 , 0 . 0028798817 , - 0 . 00039779892 } , { - 0 . 0089878107 , - 0 . 0095474878 , - 0 . 0097187652 , 0 . 008765907 } , { - 4 . 0435321e - 05 , - 0 . 00061813281 , - 0 . 0060490143 , 0 . 0016259965 } , { - 0 . 00014720558 , - 1 . 0601876e - 05 , 0 . 00014757138 , 0 . 00016227641 } , { - 0 . 010428289 , - 0 . 00031812813 , - 0 . 0016172213 , - 0 . 00012022134 } , { 0 . 0040517131 , 0 . 0072972763 , 0 . 0060433905 , 0 . 0025041645 } , { 0 . 00014090924 , 0 . 00027612853 , 0 . 00015961665 , 0 . 0002605418 } , { - 0 . 00020653783 , - 0 . 00048482867 , - 0 . 00058472338 , 0 . 00026413759 } , { 0 . 00056712638 , 0 . 00026385353 , 0 . 00035484947 , 0 . 00033212447 } , { - 0 . 00094663094 , 0 . 0029891757 , 0 . 0029887838 , - 0 . 0026583585 } , { - 0 . 0017400246 , 0 . 00042350567 , 0 . 00086128207 , 0 . 00039863587 } , { 0 . 00059604848 , 0 . 00027495434 , - 0 . 00059956434 , - 4 . 4981673e - 05 } , { - 0 . 010211343 , - 0 . 0080580409 , - 0 . 0085333216 , 0 . 0023258717 } , { 0 . 00042832593 , 0 . 0056750222 , 0 . 0048059635 , - 0 . 0092168281 } , { 3 . 0214612e - 05 , 4 . 540924e - 06 , 1 . 7239937e - 05 , 2 . 783598e - 05 } , { 0 . 00029393335 , - 4 . 5128636e - 05 , - 4 . 3089017e - 05 , 0 . 00030682556 } , { - 4 . 7077735e - 05 , - 1 . 3596835e - 05 , - 0 . 0015338149 , - 7 . 4957991e - 05 } , { - 0 . 00097136844 , 0 . 00018564298 , 0 . 00021815754 , 0 . 0015095577 } , { 0 . 00043929849 , - 0 . 0014691094 , - 0 . 0014671742 , - 0 . 00029365954 } , { 8 . 8554045e - 05 , 0 . 0062500772 , 0 . 0001495049 , 0 . 00021007601 } } , { { 0 . 0020307077 , 0 . 0020947445 , 0 . 0017438295 , 0 . 0084822342 } , { - 0 . 0069727503 , - 0 . 0010131005 , 0 . 0055261321 , - 0 . 0020442588 } , { 0 . 00031035611 , 0 . 00010839441 , 3 . 7359209e - 06 , 4 . 3112837e - 05 } , { 9 . 1207794e - 05 , 0 . 0050148169 , 0 . 0051071455 , 0 . 0033679057 } , { - 0 . 00090101737 , - 0 . 00053793176 , - 0 . 0025829621 , 0 . 0003241927 } , { - 0 . 0019244714 , - 0 . 0033690472 , - 0 . 0035193497 , 0 . 0027653636 } , { - 0 . 00065476293 , - 0 . 00017787403 , 0 . 00040383136 , - 0 . 00018123957 } , { - 0 . 00030640434 , - 0 . 00018961553 , - 0 . 00011036218 , - 0 . 00015793049 } , { 0 . 001110592 , - 0 . 00021252645 , 0 . 00015849587 , - 3 . 7758317e - 05 } , { 0 . 00077967828 , - 0 . 0051765235 , - 0 . 0078505592 , - 0 . 010796339 } , { - 1 . 2024951e - 05 , 6 . 48806e - 05 , - 3 . 9409005e - 05 , 7 . 4639306e - 05 } , { - 0 . 00017352424 , - 0 . 00037802595 , - 0 . 00045639468 , 0 . 00016843169 } , { - 4 . 2866244e - 05 , - 4 . 3730932e - 06 , 7 . 3574276e - 05 , 5 . 6076779e - 05 } , { 0 . 00024802387 , 0 . 0018053101 , 0 . 0018042994 , - 0 . 0016700716 } , { 0 . 0082698262 , - 0 . 00014605077 , 0 . 0004377682 , 8 . 1585074e - 05 } , { - 4 . 494343e - 06 , 0 . 00019781519 , - 0 . 00058910268 , - 0 . 00027360572 } , { 0 . 0013016934 , 0 . 0021020456 , 0 . 0022718598 , - 0 . 0059377824 } , { 0 . 002185371 , - 0 . 0080788056 , - 0 . 0071952836 , 0 . 0039688918 } , { 0 . 00013048617 , 0 . 0001738124 , 0 . 00012978924 , 0 . 00013813358 } , { 0 . 00032386518 , 0 . 00023046021 , 0 . 00023064714 , 0 . 00033762343 } , { 0 . 00023643771 , 0 . 00019652953 , 0 . 0013083597 , 0 . 00024739959 } , { - 0 . 0063957036 , - 0 . 0055319023 , - 0 . 0054742301 , - 0 . 0037204932 } , { - 0 . 0005510683 , - 0 . 0007715413 , - 0 . 00077385934 , - 0 . 001009415 } , { 0 . 00017904616 , - 0 . 00096137522 , 0 . 00030252599 , - 2 . 2478138e - 05 } } } , { { { - 0 . 00038948583 , - 0 . 00040817153 , - 0 . 00041280315 , - 0 . 0010985631 } , { 0 . 0025695337 , 0 . 00042904308 , 0 . 0054649973 , - 0 . 0055079106 } , { 0 . 00052050672 , 2 . 2618679e - 05 , 0 . 00024058975 , - 0 . 00012632201 } , { - 0 . 013468886 , 0 . 0079396715 , 0 . 0079402246 , 0 . 026283756 } , { - 7 . 922122e - 05 , - 3 . 4761763e - 06 , - 0 . 0041716347 , 0 . 0001478739 } , { 0 . 023716381 , - 0 . 016415262 , - 0 . 015296927 , - 0 . 021050827 } , { 3 . 7654391e - 05 , 0 . 00012765816 , - 0 . 0001337099 , 0 . 00051483398 } , { 0 . 00015671907 , 0 . 00010686796 , 2 . 1421097e - 05 , - 2 . 2281569e - 05 } , { 3 . 1779413e - 06 , 0 . 00010449913 , - 0 . 00018303614 , 7 . 5382489e - 05 } , { - 0 . 00020526765 , - 0 . 0011333575 , - 0 . 0050720108 , 0 . 0051482782 } , { 4 . 0450357e - 05 , 1 . 0808158e - 05 , - 2 . 3316095e - 05 , 9 . 7767333e - 06 } , { - 0 . 019107229 , 0 . 010907324 , 0 . 0048969594 , 0 . 017851514 } , { 7 . 4048796e - 05 , - 7 . 041835e - 06 , 8 . 0226174e - 05 , 5 . 1714105e - 05 } , { - 0 . 016564627 , 0 . 0023486944 , 0 . 0023601429 , 0 . 016005248 } , { - 0 . 004528284 , 3 . 6291049e - 05 , 2 . 4229636e - 05 , 0 . 0024853948 } , { 5 . 6882054e - 05 , 6 . 8805135e - 05 , 0 . 00013119897 , 0 . 00010339801 } , { 0 . 00021183341 , 0 . 0008203137 , - 7 . 204401e - 05 , 0 . 00062599728 } , { - 0 . 00099314707 , 0 . 0030198762 , - 0 . 0038989955 , 0 . 00055571214 } , { - 7 . 4247984e - 05 , - 8 . 3993373e - 05 , - 5 . 9133252e - 05 , - 7 . 7411989e - 05 } , { 0 . 0054296732 , - 0 . 00057858871 , - 0 . 00058417754 , - 0 . 005072911 } , { - 0 . 00019259782 , - 0 . 00018772532 , - 4 . 2959783e - 05 , - 0 . 0001827295 } , { - 0 . 00029351865 , 0 . 00013736372 , 0 . 00016666048 , 0 . 00020873447 } , { 0 . 0069341659 , 0 . 0027612928 , 0 . 0027538377 , - 0 . 0061770317 } , { 4 . 2584714e - 05 , - 0 . 00037063589 , - 9 . 0693123e - 06 , 0 . 00011845784 } } , { { 0 . 0028834168 , 0 . 0031807308 , 0 . 0031352582 , 0 . 01064051 } , { 0 . 0049297987 , - 4 . 2149356e - 05 , - 0 . 0014926841 , - 0 . 0002300371 } , { 0 . 0020396303 , - 0 . 00066042794 , - 6 . 4359283e - 05 , 0 . 00017835163 } , { - 0 . 0025767816 , 0 . 0025148152 , 0 . 0025224779 , 0 . 0043006543 } , { - 0 . 00042084416 , - 0 . 00013534305 , 0 . 002453623 , - 4 . 0707749e - 05 } , { - 0 . 0001803055 , - 0 . 0010450606 , - 0 . 00084380806 , 0 . 00014843677 } , { - 0 . 0064067107 , 0 . 00011012652 , - 0 . 0022552747 , - 0 . 00080508294 } , { - 0 . 00017778763 , - 4 . 296789e - 05 , 0 . 00015343883 , 0 . 00025036711 } , { 0 . 002825978 , - 0 . 00031945362 , - 0 . 00031987612 , - 0 . 00021117763 } , { 0 . 00032791249 , - 0 . 00049524542 , 0 . 0049368722 , - 0 . 0017186408 } , { - 0 . 0001685943 , - 0 . 00016766033 , - 0 . 0001755097 , - 0 . 00017067307 } , { 0 . 00023939157 , - 0 . 00011793706 , - 6 . 0620575e - 05 , - 0 . 0002706595 } , { - 2 . 9718673e - 05 , 3 . 5950879e - 05 , 1 . 839844e - 05 , - 2 . 8718148e - 05 } , { - 0 . 0017260981 , 0 . 00012145435 , 0 . 0001236679 , 0 . 0018292155 } , { 0 . 0036086706 , 0 . 0001026898 , - 2 . 5518889e - 05 , - 0 . 00019830236 } , { - 0 . 00031546808 , - 0 . 00042107458 , - 0 . 00059963868 , - 0 . 00061472497 } , { - 0 . 0074719522 , 0 . 0015719596 , - 0 . 0033624165 , - 0 . 0092664101 } , { - 0 . 0011285776 , 0 . 0018601435 , 0 . 00052060704 , - 1 . 5554679e - 05 } , { 4 . 9853171e - 05 , 7 . 3650922e - 05 , 3 . 4080107e - 05 , 5 . 4255445e - 05 } , { 0 . 00015102779 , - 2 . 58105e - 05 , - 2 . 5851018e - 05 , - 4 . 5185316e - 05 } , { 0 . 0002057452 , 0 . 00019037765 , 0 . 0040052198 , 0 . 00020046579 } , { 0 . 0027727314 , 0 . 0040749211 , 0 . 0036050794 , 0 . 0034635222 } , { 0 . 00042503689 , 0 . 00056027382 , 0 . 00056052971 , - 8 . 2485044e - 05 } , { - 5 . 6309634e - 05 , 0 . 0019722025 , 6 . 4267434e - 05 , - 0 . 00020376412 } } , { { 0 . 0051607661 , 0 . 0047835358 , 0 . 0047658352 , 0 . 0054281814 } , { - 0 . 0040939561 , 0 . 0012119183 , - 0 . 0023408179 , - 0 . 00055891234 } , { - 0 . 0031939804 , - 0 . 0015954053 , - 0 . 00018570689 , 0 . 00028849431 } , { - 0 . 0075625096 , 0 . 0033878734 , 0 . 0033797415 , 0 . 010242674 } , { - 0 . 002293562 , 0 . 00024245282 , 0 . 0019455622 , 0 . 0039550747 } , { 0 . 0090386754 , - 0 . 0086947671 , - 0 . 0082684939 , - 0 . 0075613346 } , { - 0 . 00085735117 , 3 . 4822634e - 05 , - 0 . 0024653972 , - 0 . 00090964985 } , { - 0 . 00013750587 , - 0 . 00010089501 , 6 . 3555498e - 05 , 0 . 0002758494 } , { 0 . 0060496328 , - 0 . 00032664426 , 0 . 0005979723 , - 0 . 00018819024 } , { 0 . 00072724184 , 0 . 00082242885 , 0 . 0045668772 , - 0 . 0054557456 } , { - 9 . 6167811e - 05 , 7 . 9856612e - 05 , 0 . 00015672473 , 8 . 0901183e - 05 } , { 0 . 00038859448 , - 0 . 00025360755 , - 0 . 00017624981 , - 0 . 00049125519 } , { - 8 . 8277361e - 05 , 2 . 4159527e - 05 , - 0 . 00016014627 , - 2 . 7854246e - 05 } , { - 0 . 0037308647 , 0 . 00041434141 , 0 . 0004167221 , 0 . 0037190244 } , { 0 . 00050696744 , - 4 . 6752715e - 05 , 0 . 00033183668 , - 0 . 0025882828 } , { - 0 . 00015915702 , - 0 . 0002325901 , - 0 . 00036157415 , - 0 . 00016391937 } , { 0 . 00012320153 , 0 . 0026711886 , 0 . 0018414591 , - 0 . 0058215223 } , { - 0 . 0029409983 , - 0 . 00015460743 , 0 . 0031951665 , 0 . 0074654329 } , { 9 . 9084813e - 05 , 9 . 1785865e - 05 , 5 . 9300007e - 05 , 0 . 00010463304 } , { 0 . 00024773341 , - 2 . 5723276e - 05 , - 2 . 5709769e - 05 , - 0 . 00015357475 } , { 0 . 000416633 , 0 . 00028749584 , - 0 . 0038632071 , 0 . 00039869488 } , { 0 . 00018344152 , 3 . 0811778e - 05 , - 0 . 00010240082 , 0 . 00059301197 } , { 0 . 0019217461 , 0 . 00034404024 , 0 . 00034318823 , - 0 . 0015867375 } , { - 0 . 00011928879 , 0 . 001178769 , - 5 . 8655983e - 05 , - 0 . 00028461439 } } } , { { { 0 . 99999992 , 0 . 99999992 , 0 . 99999991 , 0 . 99999925 } , { 0 . 99998864 , 0 . 99999972 , 0 . 99993965 , 0 . 99997027 } , { 0 . 99999969 , 1 , 0 . 99999997 , 0 . 99999998 } , { 0 . 99990852 , 0 . 99971841 , 0 . 99970961 , 0 . 9996348 } , { 0 . 99999999 , 1 , 0 . 99997626 , 0 . 99999999 } , { 0 . 99951219 , 0 . 9997196 , 0 . 99973058 , 0 . 99951587 } , { 0 . 99999997 , 0 . 99999999 , 0 . 99999988 , 0 . 99999986 } , { 0 . 99999998 , 0 . 99999999 , 1 , 1 } , { 0 . 9999998 , 0 . 99999999 , 0 . 99999995 , 1 } , { 0 . 99999988 , 0 . 99999525 , 0 . 99997473 , 0 . 99995457 } , { 1 , 1 , 1 , 1 } , { 0 . 99975729 , 0 . 99976356 , 0 . 99983365 , 0 . 99982963 } , { 0 . 99999998 , 0 . 99999999 , 0 . 99999998 , 0 . 99999998 } , { 0 . 99986279 , 0 . 99986979 , 0 . 99986978 , 0 . 99984147 } , { 0 . 99997099 , 1 , 0 . 99999998 , 0 . 99999688 } , { 0 . 99999999 , 0 . 99999999 , 0 . 99999998 , 0 . 99999999 } , { 0 . 99999977 , 0 . 99999903 , 0 . 99999932 , 0 . 99999947 } , { 0 . 99999911 , 0 . 99997627 , 0 . 99997853 , 0 . 99999968 } , { 1 , 1 , 1 , 1 } , { 0 . 99998521 , 0 . 99998941 , 0 . 99998944 , 0 . 99998567 } , { 0 . 99999998 , 0 . 99999998 , 1 , 0 . 99999998 } , { 0 . 99999928 , 0 . 99999998 , 0 . 99999997 , 0 . 99999714 } , { 0 . 99997035 , 0 . 99997405 , 0 . 99997415 , 0 . 99997569 } , { 1 , 0 . 9999997 , 1 , 0 . 99999999 } } , { { 0 . 00015966941 , 0 . 00014262676 , 0 . 00020165066 , 0 . 00021618914 } , { 2 . 8140907e - 06 , - 0 . 00020325872 , 0 . 00017736728 , 6 . 0386679e - 05 } , { - 0 . 0003187876 , 5 . 8862288e - 05 , 6 . 2281085e - 05 , 1 . 7339908e - 05 } , { - 2 . 6587911e - 05 , - 0 . 00011609007 , - 0 . 00011725093 , - 7 . 6114852e - 05 } , { 0 . 00013665042 , 5 . 2703844e - 06 , - 0 . 00031293536 , 3 . 8693931e - 05 } , { - 9 . 8143069e - 05 , - 0 . 00012816332 , - 0 . 00012926252 , - 0 . 00010623032 } , { 0 . 00032342312 , - 1 . 9200091e - 06 , - 0 . 00010691485 , 6 . 3541059e - 05 } , { - 8 . 0643542e - 06 , 9 . 7622933e - 06 , 2 . 9924822e - 05 , - 1 . 988333e - 05 } , { 0 . 00025318464 , 1 . 2588649e - 05 , 1 . 4665927e - 05 , 9 . 3294806e - 06 } , { 2 . 6875391e - 06 , - 2 . 4928123e - 05 , 2 . 251878e - 05 , 0 . 00011026808 } , { 1 . 767638e - 05 , 1 . 0309044e - 05 , 2 . 4765648e - 05 , 1 . 4397941e - 05 } , { 6 . 9000935e - 06 , 1 . 0637078e - 05 , 1 . 087637e - 05 , 6 . 3065784e - 06 } , { 5 . 532953e - 05 , 1 . 6231463e - 05 , 4 . 9564371e - 05 , 3 . 6623041e - 05 } , { - 1 . 6958729e - 05 , - 3 . 1627491e - 05 , - 3 . 1524511e - 05 , - 2 . 9954116e - 05 } , { 8 . 9045086e - 05 , 2 . 1005026e - 05 , 1 . 3016463e - 05 , 8 . 7863053e - 05 } , { - 2 . 75035e - 05 , - 3 . 0440427e - 05 , - 3 . 5356286e - 05 , 5 . 9609261e - 06 } , { 0 . 0001586274 , 4 . 0711165e - 05 , 3 . 1563135e - 05 , 0 . 0001385483 } , { 8 . 5548316e - 06 , 7 . 4531928e - 05 , - 3 . 7017413e - 05 , 2 . 6874037e - 05 } , { - 1 . 3750655e - 05 , - 8 . 2756032e - 06 , - 2 . 7214983e - 07 , - 1 . 4830115e - 05 } , { - 7 . 0798362e - 07 , - 3 . 3187173e - 07 , - 3 . 3266762e - 07 , - 5 . 7113855e - 07 } , { 4 . 3615512e - 05 , - 4 . 4076433e - 06 , 8 . 9239586e - 06 , 3 . 7278531e - 05 } , { - 7 . 7366773e - 06 , 4 . 610399e - 06 , 4 . 3762687e - 06 , - 5 . 64067e - 06 } , { - 3 . 2666125e - 06 , - 1 . 0773146e - 05 , - 1 . 0861965e - 05 , - 1 . 3327232e - 06 } , { - 9 . 1178305e - 06 , 0 . 00030171207 , - 1 . 5395234e - 05 , - 2 . 0695425e - 07 } } , { { 0 . 00017159464 , 0 . 00014699558 , 0 . 00018752678 , 0 . 0002227926 } , { - 4 . 6524822e - 05 , - 0 . 00010460271 , 0 . 00034735325 , 0 . 00010082238 } , { - 6 . 8269006e - 05 , 1 . 4343751e - 05 , 7 . 7283393e - 06 , 2 . 5347136e - 05 } , { - 6 . 6149546e - 05 , - 7 . 1168993e - 05 , - 7 . 0621016e - 05 , - 0 . 00015246746 } , { 7 . 12022e - 05 , 3 . 8790461e - 05 , - 0 . 00023994449 , 6 . 6792921e - 05 } , { - 0 . 00014735813 , - 0 . 00012658353 , - 0 . 00012162488 , - 0 . 00012106777 } , { 0 . 00015161388 , - 1 . 4439153e - 05 , - 3 . 7629923e - 06 , 8 . 3140788e - 06 } , { 4 . 0175416e - 05 , 2 . 5380268e - 05 , - 2 . 2894421e - 06 , 4 . 6374378e - 06 } , { 0 . 00028906023 , 1 . 7695243e - 05 , 5 . 3790587e - 06 , 1 . 631859e - 05 } , { 1 . 8890685e - 05 , - 1 . 6898275e - 05 , 2 . 1007663e - 05 , 6 . 5179363e - 05 } , { - 3 . 9142595e - 06 , 2 . 5745488e - 05 , 1 . 0803197e - 05 , 2 . 7099749e - 05 } , { 9 . 4245546e - 06 , 1 . 0010075e - 05 , 9 . 058324e - 06 , 9 . 8703427e - 06 } , { - 2 . 3441863e - 06 , 2 . 5490323e - 05 , - 1 . 0097654e - 05 , 4 . 0554798e - 05 } , { - 4 . 1443921e - 05 , - 1 . 996316e - 05 , - 2 . 0000841e - 05 , - 4 . 7495655e - 05 } , { 0 . 00012591695 , 5 . 6179903e - 05 , - 1 . 8415869e - 05 , - 3 . 8697972e - 05 } , { 2 . 6719505e - 05 , 2 . 4195362e - 06 , 2 . 4287424e - 05 , 3 . 4703059e - 05 } , { 7 . 3804931e - 05 , 4 . 9784871e - 05 , 3 . 1159931e - 06 , 0 . 00015857197 } , { - 0 . 00010634331 , - 1 . 6427658e - 05 , - 7 . 4874306e - 05 , - 6 . 2620255e - 05 } , { - 4 . 2561214e - 06 , - 1 . 6123179e - 05 , - 1 . 5507273e - 05 , - 1 . 2909924e - 05 } , { - 1 . 2210463e - 06 , 1 . 1546399e - 06 , 1 . 1413892e - 06 , - 1 . 3465856e - 06 } , { 3 . 4909884e - 05 , - 1 . 2677793e - 05 , 0 . 00011543701 , 2 . 413091e - 05 } , { - 2 . 1953323e - 05 , - 4 . 6244252e - 06 , - 3 . 5624435e - 06 , 4 . 2293671e - 06 } , { - 1 . 1392936e - 05 , - 4 . 3970369e - 06 , - 4 . 4264864e - 06 , - 1 . 208518e - 05 } , { - 4 . 4002617e - 05 , 0 . 00020912348 , - 3 . 9617824e - 05 , - 4 . 1725112e - 05 } } } , { { { - 0 . 32504349 , - 0 . 32502096 , - 0 . 32501094 , - 0 . 32423576 } , { - 0 . 65602876 , - 0 . 65622598 , - 0 . 65567173 , - 0 . 65525128 } , { - 1 . 4666488 , - 1 . 4666488 , - 1 . 4666488 , - 1 . 4666488 } , { 0 . 87168363 , 0 . 87181364 , 0 . 87181792 , 0 . 8718169 } , { - 1 . 264365 , - 1 . 264365 , - 1 . 264365 , - 1 . 264365 } , { 0 . 89917968 , 0 . 89916889 , 0 . 89916525 , 0 . 89927374 } , { - 1 . 2245906 , - 1 . 2245906 , - 1 . 2245906 , - 1 . 2245906 } , { - 0 . 8885678 , - 0 . 88856217 , - 0 . 88856327 , - 0 . 88855044 } , { - 0 . 31799095 , - 0 . 31916566 , - 0 . 31907669 , - 0 . 31918911 } , { - 0 . 08987958 , - 0 . 090342401 , - 0 . 090004674 , - 0 . 090222398 } , { - 0 . 59425693 , - 0 . 59433999 , - 0 . 59429118 , - 0 . 59433553 } , { 1 . 1317575 , 1 . 1317475 , 1 . 1317412 , 1 . 1317494 } , { - 1 . 2193493 , - 1 . 2193493 , - 1 . 2193493 , - 1 . 2193493 } , { 1 . 2506981 , 1 . 250675 , 1 . 250675 , 1 . 2506569 } , { - 1 . 08782 , - 1 . 0877793 , - 1 . 0878022 , - 1 . 0878025 } , { - 0 . 13925598 , - 0 . 13932948 , - 0 . 13919658 , - 0 . 13913403 } , { - 0 . 40394684 , - 0 . 4042314 , - 0 . 40436178 , - 0 . 40402218 } , { - 0 . 47762966 , - 0 . 47745572 , - 0 . 47767784 , - 0 . 47713093 } , { - 0 . 60177181 , - 0 . 60176862 , - 0 . 60177347 , - 0 . 60177079 } , { 2 . 7311956 , 2 . 7311911 , 2 . 7311911 , 2 . 731191 } , { - 1 . 3109856 , - 1 . 3109856 , - 1 . 3109856 , - 1 . 3109856 } , { 0 . 60942644 , 0 . 60941369 , 0 . 6094123 , 0 . 60944198 } , { 0 . 55675448 , 0 . 55672275 , 0 . 55672303 , 0 . 5567542 } , { - 0 . 40637059 , - 0 . 4057945 , - 0 . 40635768 , - 0 . 40636681 } } , { { - 0 . 0016154222 , - 0 . 0015930079 , - 0 . 0015828998 , - 0 . 00087447165 } , { - 0 . 0011262472 , - 0 . 001324462 , - 0 . 00094895016 , - 0 . 00062188189 } , { 0 , 0 , 0 , 0 } , { 9 . 7616744e - 05 , 0 . 00010718899 , 0 . 00010718606 , 0 . 00012665246 } , { 0 , 0 , 0 , 0 } , { 0 . 00013476236 , 6 . 982272e - 05 , 6 . 8208505e - 05 , 0 . 00014604742 } , { 0 , 0 , 0 , 0 } , { - 0 . 0031089951 , - 0 . 0031071196 , - 0 . 0031207245 , - 0 . 0031097054 } , { - 0 . 0027808116 , - 0 . 0035049857 , - 0 . 0034100135 , - 0 . 0035192661 } , { - 0 . 0018291474 , - 0 . 0019603285 , - 0 . 0018919656 , - 0 . 0019656229 } , { - 0 . 0034301741 , - 0 . 0034912573 , - 0 . 0034474395 , - 0 . 0034893985 } , { - 6 . 156701e - 06 , - 9 . 8568527e - 06 , - 1 . 2383692e - 05 , - 9 . 9984205e - 06 } , { 0 , 0 , 0 , 0 } , { 0 . 00011838153 , 0 . 00011008679 , 0 . 00011008878 , 0 . 00010536608 } , { - 0 . 0006246638 , - 0 . 00058479459 , - 0 . 00061327452 , - 0 . 00061085433 } , { - 0 . 0059197749 , - 0 . 0059778169 , - 0 . 0059586015 , - 0 . 0058798299 } , { - 0 . 0013246996 , - 0 . 0016061786 , - 0 . 0016081246 , - 0 . 0014374546 } , { - 0 . 001593227 , - 0 . 0014706843 , - 0 . 0015974008 , - 0 . 001341579 } , { - 0 . 0027930604 , - 0 . 0027920013 , - 0 . 0027939865 , - 0 . 0027928528 } , { - 1 . 8908723e - 06 , - 4 . 266382e - 06 , - 4 . 2210172e - 06 , - 5 . 0155215e - 06 } , { 0 , 0 , 0 , 0 } , { 0 . 00018508026 , 0 . 00019774537 , 0 . 00019744661 , 0 . 00019538593 } , { 2 . 3243747e - 05 , 1 . 7291398e - 05 , 1 . 7309712e - 05 , 2 . 9261396e - 05 } , { - 0 . 0041402471 , - 0 . 0037085946 , - 0 . 0041294876 , - 0 . 0041316136 } } , { { - 0 . 0018899732 , - 0 . 0018719182 , - 0 . 0018661076 , - 0 . 0012234594 } , { - 0 . 0012968123 , - 0 . 0012971446 , - 0 . 00093522854 , - 0 . 00066475268 } , { 0 , 0 , 0 , 0 } , { 9 . 1054464e - 05 , 0 . 00014124217 , 0 . 00014156806 , 0 . 00012014953 } , { 0 , 0 , 0 , 0 } , { 0 . 00017026995 , 0 . 00010528413 , 0 . 00010537941 , 0 . 00015698848 } , { 0 , 0 , 0 , 0 } , { - 0 . 0025812972 , - 0 . 0025835894 , - 0 . 0025789321 , - 0 . 002554949 } , { - 0 . 0035568863 , - 0 . 0042988014 , - 0 . 0042155548 , - 0 . 004312546 } , { - 0 . 0024184575 , - 0 . 0025111277 , - 0 . 0024654994 , - 0 . 0023980076 } , { - 0 . 0036993386 , - 0 . 0037113013 , - 0 . 0036987284 , - 0 . 0037094875 } , { - 5 . 074861e - 06 , - 1 . 1367399e - 05 , - 1 . 4819989e - 05 , - 9 . 2705899e - 06 } , { 0 , 0 , 0 , 0 } , { 0 . 00012570403 , 0 . 00012150272 , 0 . 00012149179 , 0 . 00010579599 } , { - 0 . 00062162762 , - 0 . 00058131015 , - 0 . 00060837583 , - 0 . 00060795256 } , { - 0 . 00775735 , - 0 . 0077198081 , - 0 . 0078365948 , - 0 . 0077749317 } , { - 0 . 0015325554 , - 0 . 0017125784 , - 0 . 001703195 , - 0 . 0015662859 } , { - 0 . 0018130784 , - 0 . 00177106 , - 0 . 001858095 , - 0 . 0015845058 } , { - 0 . 003668417 , - 0 . 0036659688 , - 0 . 0036693421 , - 0 . 0036680526 } , { - 9 . 5804016e - 06 , - 9 . 6276607e - 06 , - 9 . 630607e - 06 , - 1 . 2159056e - 05 } , { 0 , 0 , 0 , 0 } , { 0 . 00017930618 , 0 . 00020084683 , 0 . 00020150104 , 0 . 00020810787 } , { 2 . 3869269e - 05 , 1 . 1024793e - 05 , 1 . 1041937e - 05 , 1 . 6467357e - 05 } , { - 0 . 004690782 , - 0 . 0044656761 , - 0 . 0046782065 , - 0 . 0046921455 } } } , { { { 0 . 23047932 , 0 . 23043226 , 0 . 23041471 , 0 . 22922185 } , { 0 . 14990977 , 0 . 15703656 , 0 . 15110771 , 0 . 15149153 } , { 0 . 30629171 , 0 . 30426701 , 0 . 30400037 , 0 . 30403889 } , { 0 . 03476576 , 0 . 036188528 , 0 . 036216719 , 0 . 037322097 } , { 0 . 31066251 , 0 . 31090363 , 0 . 31041565 , 0 . 31057779 } , { 0 . 04875259 , 0 . 046468595 , 0 . 046486323 , 0 . 046584523 } , { 0 . 31745458 , 0 . 31874472 , 0 . 32086369 , 0 . 31880207 } , { 0 . 64054942 , 0 . 64062862 , 0 . 64051973 , 0 . 64059059 } , { 0 . 27309038 , 0 . 27480819 , 0 . 27477284 , 0 . 27486762 } , { 0 . 196647 , 0 . 19687982 , 0 . 19607604 , 0 . 1957915 } , { 0 . 32867362 , 0 . 32858008 , 0 . 32856702 , 0 . 328555 } , { - 0 . 0026873031 , - 0 . 0042393446 , - 0 . 0057894907 , - 0 . 0041858859 } , { 0 . 40254624 , 0 . 4024247 , 0 . 4025598 , 0 . 40243731 } , { 0 . 019362807 , 0 . 018146218 , 0 . 018146051 , 0 . 019656613 } , { 0 . 29328089 , 0 . 29403937 , 0 . 29435036 , 0 . 29403094 } , { 0 . 57111506 , 0 . 57118505 , 0 . 57099608 , 0 . 57099266 } , { 0 . 16966612 , 0 . 16993739 , 0 . 17069399 , 0 . 16991136 } , { 0 . 14989055 , 0 . 1489484 , 0 . 14995985 , 0 . 15015916 } , { 0 . 33606014 , 0 . 33606294 , 0 . 33606393 , 0 . 33605429 } , { 0 . 015421206 , 0 . 015180692 , 0 . 01518037 , 0 . 015431139 } , { 0 . 33165237 , 0 . 33185282 , 0 . 33162592 , 0 . 33166981 } , { 0 . 078137018 , 0 . 078153855 , 0 . 078165152 , 0 . 078332343 } , { 0 . 002896946 , 0 . 0026038621 , 0 . 0026029604 , 0 . 0022081151 } , { 0 . 41064398 , 0 . 40987685 , 0 . 41065341 , 0 . 41059166 } } , { { - 0 . 0024316111 , - 0 . 0024732789 , - 0 . 0024922144 , - 0 . 0035874346 } , { 0 . 0013306961 , 0 . 004171802 , 0 . 0027660627 , 0 . 0023671465 } , { 0 . 0034411091 , 0 . 0020878413 , 0 . 0020874456 , 0 . 0022028237 } , { - 0 . 0032873976 , - 0 . 0021351911 , - 0 . 0021071363 , - 0 . 0028424534 } , { 0 . 0017995208 , 0 . 0022319618 , 0 . 0039270256 , 0 . 0021249365 } , { - 0 . 0019590835 , - 0 . 0012526895 , - 0 . 0012347747 , - 0 . 0021069943 } , { 0 . 0012319531 , 0 . 002255621 , 0 . 0030193583 , 0 . 0020970822 } , { 0 . 0015144077 , 0 . 0015110104 , 0 . 0014803089 , 0 . 0015340007 } , { - 0 . 0036679996 , - 0 . 0028160114 , - 0 . 0028586497 , - 0 . 0027953731 } , { - 0 . 005445786 , - 0 . 0052624873 , - 0 . 0054843188 , - 0 . 0053271749 } , { 0 . 00067154572 , 0 . 0007530775 , 0 . 00067974516 , 0 . 00074462315 } , { - 0 . 0035626119 , - 0 . 0034186877 , - 0 . 0038720517 , - 0 . 0040088745 } , { 0 . 003455851 , 0 . 0035040061 , 0 . 0034671486 , 0 . 0035069881 } , { - 0 . 0047789747 , - 0 . 0047994804 , - 0 . 0047996451 , - 0 . 0044008337 } , { 0 . 0032403482 , 0 . 0033627856 , 0 . 003429619 , 0 . 0031153117 } , { - 0 . 005027022 , - 0 . 0049812 , - 0 . 0049604573 , - 0 . 0050556194 } , { - 0 . 0020728991 , - 0 . 0014784158 , - 0 . 001216894 , - 0 . 0019213729 } , { - 0 . 00013808007 , - 0 . 00067270623 , - 0 . 00024001574 , - 0 . 00030691077 } , { 0 . 0004367104 , 0 . 00043390709 , 0 . 00043548166 , 0 . 00043425516 } , { - 0 . 00082746467 , - 0 . 00088151411 , - 0 . 00088152334 , - 0 . 0008043643 } , { 0 . 0030277712 , 0 . 003133577 , 0 . 0028529862 , 0 . 0030362271 } , { - 0 . 0058721937 , - 0 . 0059816331 , - 0 . 0059799345 , - 0 . 0058882832 } , { - 0 . 0057032562 , - 0 . 0057401855 , - 0 . 0057416619 , - 0 . 0062417688 } , { - 0 . 0014357888 , - 0 . 0020782049 , - 0 . 0014346823 , - 0 . 0014513767 } } , { { - 0 . 0027051235 , - 0 . 0027087245 , - 0 . 0027052303 , - 0 . 0033594951 } , { 0 . 0028036195 , 0 . 0030416572 , 0 . 0014306948 , 0 . 0017897371 } , { 0 . 0031113166 , 0 . 0026432303 , 0 . 0025937824 , 0 . 0025394463 } , { - 0 . 0036032904 , - 0 . 003447065 , - 0 . 0034344406 , - 0 . 0024163572 } , { 0 . 0023912799 , 0 . 0025281229 , 0 . 0038665087 , 0 . 0024214034 } , { - 0 . 0023543827 , - 0 . 0024294943 , - 0 . 0024539784 , - 0 . 0027742617 } , { 0 . 0020903896 , 0 . 0026617586 , 0 . 003395249 , 0 . 0026261065 } , { 0 . 0019031008 , 0 . 0019405475 , 0 . 0019426085 , 0 . 0019404325 } , { - 0 . 0040413326 , - 0 . 0030964835 , - 0 . 0031020735 , - 0 . 0030826754 } , { - 0 . 0064568993 , - 0 . 0062342438 , - 0 . 0064704698 , - 0 . 0065636744 } , { 0 . 0010788406 , 0 . 0010092051 , 0 . 0010264121 , 0 . 00099891228 } , { - 0 . 0040759201 , - 0 . 0059224283 , - 0 . 0066809927 , - 0 . 0049099348 } , { 0 . 0042962009 , 0 . 0041909175 , 0 . 0043195236 , 0 . 0041900138 } , { - 0 . 0062728983 , - 0 . 0070256154 , - 0 . 007025641 , - 0 . 0061758746 } , { 0 . 0036210401 , 0 . 0039723998 , 0 . 0042232048 , 0 . 0042757707 } , { - 0 . 0058693852 , - 0 . 0058583303 , - 0 . 0058544016 , - 0 . 005887725 } , { - 0 . 0023099876 , - 0 . 0021136245 , - 0 . 0017298078 , - 0 . 0022483337 } , { - 0 . 00017851962 , - 0 . 00014956209 , 8 . 5676316e - 05 , - 0 . 00024971669 } , { 0 . 0003734781 , 0 . 00037078986 , 0 . 00037364181 , 0 . 00037070594 } , { - 0 . 00030648905 , - 0 . 00038230535 , - 0 . 00038223043 , - 0 . 00028623253 } , { 0 . 0032871423 , 0 . 0034163052 , 0 . 0028276655 , 0 . 0032991918 } , { - 0 . 0061331695 , - 0 . 0063319797 , - 0 . 0063340119 , - 0 . 0064390374 } , { - 0 . 0062172888 , - 0 . 0059787106 , - 0 . 0059793294 , - 0 . 0060406701 } , { - 0 . 0018276142 , - 0 . 0022170788 , - 0 . 0018293949 , - 0 . 0018222824 } } } } , { { { { 0 . 13218089 , - 0 . 11654637 , - 0 . 11622196 , - 0 . 044208736 } , { 0 . 0074579257 , 0 . 0038503609 , 0 . 0013201096 , 4 . 0415784e - 05 } , { - 0 . 025474487 , - 0 . 01209255 , - 0 . 016535858 , 0 . 012704547 } , { - 0 . 0016894103 , - 0 . 0081312144 , - 0 . 0033264609 , 0 . 0011923269 } , { - 0 . 068044876 , 0 . 018276873 , - 0 . 074833897 , 0 . 01308348 } , { 0 . 02665691 , 0 . 013515118 , 0 . 026440814 , - 0 . 0077037816 } , { 0 . 0023286096 , - 0 . 0025782652 , 0 . 0021644694 , - 0 . 0042955294 } , { 0 . 051356261 , - 0 . 031058382 , - 0 . 085382962 , - 0 . 033103269 } , { - 0 . 081609229 , 0 . 0035270199 , - 0 . 015722417 , 0 . 048773789 } , { 0 . 0023928418 , - 0 . 001243811 , 0 . 011910492 , - 0 . 011621478 } , { - 0 . 028953904 , - 0 . 029335777 , - 0 . 0057891432 , 0 . 013874136 } , { - 0 . 012473582 , 0 . 001772629 , - 0 . 013983442 , 0 . 014846792 } , { - 0 . 016111661 , 0 . 0018902323 , 0 . 025910586 , 0 . 042848276 } , { 0 . 026200626 , 0 . 024007879 , 0 . 0017667146 , - 0 . 016394032 } , { - 0 . 0067006429 , - 0 . 0017968936 , 0 . 009028659 , 0 . 0044060413 } , { 0 . 019280611 , 0 . 0449581 , - 0 . 042852227 , - 0 . 066012332 } , { - 0 . 014451123 , - 0 . 047772741 , - 0 . 047475406 , 0 . 098434178 } , { - 0 . 0028954635 , 0 . 010521833 , - 0 . 015741597 , - 0 . 00091666191 } , { 0 . 0020291956 , - 0 . 057966746 , - 0 . 04525094 , 0 . 032711614 } , { 0 . 020563445 , - 0 . 0078684621 , - 0 . 015282237 , - 0 . 0019830466 } , { - 0 . 019504171 , 0 . 071338511 , 0 . 0033729474 , - 0 . 0095772339 } , { 0 . 013056103 , 0 . 018719519 , 0 . 0096002937 , - 0 . 028774366 } , { - 0 . 00038728577 , - 0 . 0010662982 , - 0 . 0014333502 , 0 . 00059135695 } , { 0 . 073844752 , - 0 . 05666013 , - 0 . 1007151 , - 0 . 030440738 } } , { { 0 . 00017766639 , - 9 . 2398532e - 05 , - 3 . 9442682e - 05 , - 3 . 9559848e - 05 } , { - 0 . 0043956477 , 0 . 00044042277 , - 0 . 00047491077 , 9 . 4171117e - 05 } , { - 0 . 0042095545 , - 0 . 00910753 , - 0 . 0014295282 , 0 . 0042595844 } , { 0 . 00070989004 , - 0 . 0009623012 , 0 . 00084162653 , - 0 . 00015925965 } , { - 0 . 0017587638 , 0 . 0033199811 , - 0 . 00025544613 , 0 . 00083644978 } , { 0 . 0051797987 , 0 . 0015691893 , - 0 . 002324397 , 0 . 0050776381 } , { 0 . 003911779 , 0 . 00072639703 , 2 . 102924e - 05 , - 0 . 0029529332 } , { 0 . 0050240476 , - 0 . 00041452319 , 3 . 1730448e - 06 , - 0 . 0072697591 } , { - 1 . 5023048e - 05 , 0 . 00032491246 , - 9 . 2151952e - 05 , 0 . 0035851726 } , { 0 . 0030984373 , 0 . 0016428856 , 0 . 0032974124 , - 0 . 0036034289 } , { - 0 . 00044578206 , - 0 . 0035916409 , 0 . 0028146658 , 0 . 0068013321 } , { 0 . 00025716711 , - 0 . 0024772152 , 0 . 0029660992 , - 0 . 0008783244 } , { - 0 . 005543602 , - 0 . 00046453249 , 0 . 006815884 , 0 . 0069207512 } , { - 0 . 0033541738 , - 0 . 0015140333 , - 0 . 004071746 , - 0 . 0020908789 } , { 0 . 0027932918 , - 0 . 0012517158 , - 0 . 0033509184 , - 0 . 001271572 } , { 0 . 0043481525 , - 0 . 00088858735 , - 0 . 0081538059 , 0 . 00027985077 } , { 7 . 4017523e - 05 , - 7 . 0080388e - 05 , - 7 . 1766386e - 05 , 0 . 00020468758 } , { 0 . 00044507396 , 0 . 010179106 , - 0 . 0048087449 , 0 . 0013487105 } , { 0 . 00082148695 , - 0 . 00042640153 , - 0 . 0024255173 , 0 . 0044486011 } , { - 0 . 00026383509 , - 0 . 0031871528 , - 0 . 008203704 , - 0 . 00053957093 } , { - 0 . 0002996462 , 0 . 00070789605 , 7 . 9300612e - 05 , - 0 . 00024002209 } , { 0 . 0013722116 , 0 . 0049176054 , 0 . 0029283062 , - 0 . 000849108 } , { 0 . 00026545039 , 0 . 0011783443 , 0 . 00072103548 , - 0 . 0007355776 } , { 0 . 002192273 , - 0 . 00294318 , 1 . 5452606e - 05 , - 0 . 0020953993 } } , { { 2 . 4074136e - 05 , - 2 . 4931598e - 05 , - 1 . 0893587e - 05 , 1 . 080951e - 05 } , { - 0 . 0061635883 , - 0 . 0042963493 , - 0 . 00177783 , - 0 . 00080292808 } , { 0 . 0047868795 , - 0 . 0050472436 , 0 . 0082439123 , - 0 . 0090979713 } , { 0 . 0017221077 , 0 . 0067285193 , 0 . 0031011872 , - 0 . 0019932567 } , { 0 . 0010926271 , - 0 . 0012170693 , 0 . 00012875612 , 0 . 00016441623 } , { - 0 . 0048786273 , - 0 . 0041225634 , - 0 . 005591426 , 0 . 0043469593 } , { - 0 . 0070664098 , - 0 . 0012625813 , - 0 . 00022220241 , - 0 . 0026120468 } , { - 0 . 0026689917 , 0 . 00030860545 , 1 . 9297947e - 05 , 0 . 001274799 } , { 0 . 0026769559 , 0 . 00016106032 , 0 . 00013829246 , - 0 . 0017239107 } , { - 0 . 0042495789 , 0 . 0010270326 , - 0 . 00078224804 , - 0 . 0019210019 } , { 0 . 0072385804 , 0 . 0086418476 , 0 . 0061428272 , - 0 . 0027142827 } , { 0 . 0019768127 , - 0 . 00057957046 , 0 . 0047464783 , - 0 . 004599565 } , { 0 . 0093618867 , - 0 . 0010476542 , - 0 . 0038681572 , - 0 . 0065219521 } , { - 0 . 0076406673 , - 0 . 0036729355 , - 0 . 0068804827 , 0 . 0077571478 } , { 0 . 0012706397 , - 0 . 00042567505 , - 0 . 002521821 , 6 . 0288127e - 05 } , { - 0 . 002041411 , 0 . 000430125 , 0 . 0073620925 , 0 . 0021579456 } , { 0 . 00012145466 , 4 . 1276616e - 05 , 4 . 2449608e - 05 , 9 . 8351262e - 05 } , { 0 . 0014376278 , - 0 . 007439719 , 0 . 0039006971 , 0 . 00051135138 } , { - 7 . 1665367e - 05 , 0 . 00023856335 , 0 . 00015274881 , - 0 . 0096946274 } , { - 0 . 00076804256 , 0 . 0040182915 , 0 . 012603411 , - 0 . 00059669891 } , { - 0 . 00010641981 , - 0 . 00052355992 , 0 . 00057481361 , 0 . 00016456343 } , { - 0 . 0027623375 , - 0 . 0036761364 , - 0 . 010480297 , 0 . 0066006902 } , { 0 . 00049081404 , 0 . 00077264749 , 0 . 0021355718 , - 0 . 00029188425 } , { 0 . 00028566818 , 0 . 00097678458 , 0 . 00089022281 , - 0 . 00013760767 } } } , { { { - 0 . 0098123577 , 0 . 11017117 , 0 . 11245143 , - 0 . 01173447 } , { 0 . 0036188505 , - 0 . 0025878518 , - 0 . 00043343726 , - 0 . 0038813197 } , { 0 . 013109746 , - 0 . 016775181 , - 0 . 0011093308 , 0 . 00083465721 } , { - 0 . 0042515898 , - 0 . 0028159364 , 0 . 00027829209 , - 0 . 002907578 } , { - 0 . 0081027554 , - 0 . 0019330574 , 0 . 061872524 , - 0 . 037539524 } , { - 0 . 012923735 , 0 . 021011524 , 0 . 002680406 , 0 . 0034369108 } , { 0 . 0027819214 , 0 . 0028657905 , - 0 . 0034177203 , - 0 . 0037322329 } , { - 0 . 0036178174 , 0 . 065792163 , 0 . 13263475 , 0 . 0055427994 } , { 0 . 027832309 , - 0 . 083372016 , - 0 . 058757582 , 0 . 016164879 } , { - 0 . 0082343898 , 0 . 011782416 , 0 . 011496052 , - 0 . 0027847616 } , { 0 . 0012516658 , - 0 . 014686832 , - 0 . 025073035 , - 0 . 020700577 } , { 0 . 0055718234 , - 0 . 011543219 , - 0 . 012867689 , - 0 . 0049474286 } , { 0 . 028869265 , - 0 . 035431559 , 0 . 024976635 , - 0 . 01063055 } , { - 0 . 0010657662 , 0 . 014977146 , 0 . 027109 , 0 . 01612865 } , { - 0 . 0021697493 , 0 . 0044220507 , 0 . 0055654161 , - 0 . 0032373397 } , { - 0 . 018500666 , - 0 . 01979267 , - 0 . 0068480612 , 0 . 03908391 } , { 0 . 063306878 , 0 . 01934691 , 0 . 019254616 , - 0 . 099824471 } , { 7 . 0580666e - 05 , - 0 . 0015082457 , - 0 . 0056893693 , 0 . 00022726294 } , { 0 . 0077067654 , - 0 . 014018834 , - 0 . 021406454 , - 0 . 0076589993 } , { - 0 . 0013072394 , 2 . 6765854e - 05 , 0 . 0028400803 , 0 . 0037431063 } , { - 0 . 025369581 , - 0 . 064039908 , - 0 . 020594137 , - 0 . 086807367 } , { - 0 . 033639351 , 0 . 010434758 , 0 . 00082983507 , 0 . 013145885 } , { 0 . 00029373395 , 7 . 8193614e - 05 , 0 . 00048496415 , 0 . 00062972215 } , { - 0 . 0041597628 , 0 . 024283117 , - 0 . 030148407 , 0 . 011456515 } } , { { - 1 . 3484857e - 05 , - 3 . 7204145e - 05 , - 1 . 5660577e - 05 , - 2 . 4497955e - 05 } , { - 0 . 0068070249 , 0 . 0041035892 , 0 . 0034647689 , 0 . 0035918321 } , { - 0 . 0053613309 , 0 . 0080593503 , 0 . 0028507084 , - 0 . 0023104987 } , { 0 . 0048581064 , 0 . 0039720065 , - 0 . 0019058129 , 0 . 0047295789 } , { - 0 . 00030675956 , - 0 . 0007787587 , - 0 . 00025201217 , 0 . 00020777843 } , { - 0 . 00026433336 , - 0 . 0093672701 , - 0 . 0053201627 , - 0 . 0059632173 } , { - 0 . 0063062815 , 0 . 0011995204 , 0 . 0001870407 , 0 . 0028197877 } , { - 0 . 00053247524 , - 0 . 00066138217 , - 1 . 4959372e - 05 , - 0 . 00036023628 } , { 0 . 00027591427 , 0 . 00011309835 , 2 . 2453632e - 05 , - 0 . 00075736359 } , { 0 . 0015654886 , 0 . 0018114616 , - 0 . 0004503446 , - 8 . 5866048e - 05 } , { 0 . 003501393 , 0 . 0037179893 , 0 . 008328543 , 0 . 013411108 } , { - 0 . 0035136609 , - 0 . 0015054003 , 0 . 0011903964 , 0 . 0022551358 } , { - 0 . 0083723767 , 0 . 0061303554 , - 0 . 008056962 , 0 . 0035035183 } , { - 0 . 0023715655 , - 0 . 0070468331 , - 0 . 010219655 , - 0 . 0057856465 } , { - 0 . 0011406634 , - 0 . 00021204595 , - 0 . 001693195 , 0 . 0011051597 } , { 0 . 0011643412 , 0 . 00037557194 , 0 . 0048567739 , - 0 . 00063996433 } , { - 3 . 1728174e - 05 , - 2 . 9073903e - 06 , - 3 . 0243209e - 06 , 2 . 579239e - 05 } , { 0 . 00053152589 , 0 . 0029635352 , 0 . 0040743289 , - 0 . 00051381046 } , { - 0 . 0017253584 , 0 . 00012081524 , 0 . 00012243664 , - 0 . 00063598215 } , { 0 . 0026711847 , - 0 . 0020733972 , - 0 . 0027860744 , 0 . 0017065643 } , { 5 . 7762902e - 05 , 0 . 00092043577 , - 0 . 0035278882 , 0 . 0007846087 } , { 0 . 0056127705 , - 0 . 0051893669 , - 0 . 0027072408 , - 0 . 0025630045 } , { - 0 . 00059289151 , - 0 . 0004168408 , - 8 . 8118696e - 05 , - 0 . 00073538101 } , { 0 . 0003388606 , - 0 . 00094234652 , 3 . 013109e - 05 , - 0 . 0010532484 } } , { { - 2 . 9013996e - 05 , 6 . 1983083e - 05 , 2 . 8401438e - 05 , - 3 . 4901557e - 05 } , { 0 . 0045230474 , - 0 . 0021369843 , - 0 . 00422706 , - 0 . 0018918027 } , { 0 . 00017586142 , 0 . 005389053 , 0 . 0071352982 , - 0 . 0018278685 } , { - 0 . 0012135723 , - 0 . 0035970727 , 0 . 00078957165 , - 0 . 0017065397 } , { - 0 . 00067051937 , - 1 . 9501585e - 05 , 4 . 1968766e - 05 , - 0 . 0010958091 } , { - 0 . 0015277626 , - 0 . 0039952533 , - 0 . 00049631478 , 0 . 0018042745 } , { 0 . 0039376754 , - 0 . 00097834328 , 6 . 5894634e - 06 , - 0 . 0044189106 } , { - 0 . 00067623039 , 0 . 0004690807 , 1 . 4532105e - 07 , 0 . 0032984829 } , { 0 . 0020787449 , - 0 . 0016586579 , - 0 . 00062367064 , 0 . 0021545362 } , { 0 . 0016427801 , 2 . 6710288e - 05 , 0 . 0016011535 , - 0 . 00077649869 } , { 0 . 0039999622 , - 0 . 0014968097 , - 0 . 0025647576 , 0 . 0022783424 } , { 0 . 001558454 , - 0 . 00083803058 , 0 . 0018955692 , 0 . 0010432376 } , { 0 . 010555722 , - 0 . 010395022 , 0 . 0050354965 , - 0 . 0016177699 } , { 0 . 00011370745 , - 0 . 009328355 , - 0 . 0063009522 , 0 . 0024377458 } , { - 0 . 00024433189 , 0 . 00052920244 , - 0 . 0013213352 , - 0 . 0013503982 } , { - 0 . 0057620093 , 0 . 00095391746 , - 0 . 0034768563 , 0 . 00093990705 } , { 0 . 00012108024 , 4 . 1007202e - 05 , 4 . 2193381e - 05 , - 0 . 00011043617 } , { 0 . 0038593696 , - 0 . 00074282979 , - 0 . 0093457897 , 0 . 00027311164 } , { 0 . 0021514797 , - 7 . 8742315e - 05 , - 0 . 0018813077 , - 0 . 0017625098 } , { 0 . 0038491118 , 0 . 00022570776 , - 0 . 0061331041 , 0 . 00014956617 } , { - 0 . 00014676603 , - 0 . 00025053931 , 0 . 003376287 , - 0 . 00014730695 } , { 0 . 0016439646 , 0 . 0060569792 , 0 . 00063058918 , - 0 . 0034810156 } , { 0 . 00011722835 , 0 . 00032237223 , - 0 . 0012556553 , - 0 . 0006887808 } , { 0 . 00060814722 , 0 . 0003708376 , - 0 . 00056515636 , - 0 . 00016801817 } } } , { { { 0 . 99117704 , 0 . 98705585 , 0 . 98683693 , 0 . 9989534 } , { 0 . 99996564 , 0 . 99998924 , 0 . 99999903 , 0 . 99999247 } , { 0 . 99958951 , 0 . 99978616 , 0 . 99986266 , 0 . 99991895 } , { 0 . 99998953 , 0 . 99996298 , 0 . 99999443 , 0 . 99999506 } , { 0 . 99764936 , 0 . 9998311 , 0 . 99527468 , 0 . 99920949 } , { 0 . 9995611 , 0 . 99968788 , 0 . 99964679 , 0 . 99996442 } , { 0 . 99999342 , 0 . 99999257 , 0 . 99999182 , 0 . 99998381 } , { 0 . 99867384 , 0 . 99734987 , 0 . 98748052 , 0 . 99943657 } , { 0 . 99627571 , 0 . 99651225 , 0 . 99814846 , 0 . 99867903 } , { 0 . 99996323 , 0 . 99992981 , 0 . 99986298 , 0 . 99992859 } , { 0 . 99957996 , 0 . 99946171 , 0 . 99966886 , 0 . 99968945 } , { 0 . 99990668 , 0 . 9999318 , 0 . 99981943 , 0 . 99987754 } , { 0 . 99945334 , 0 . 99937032 , 0 . 99935219 , 0 . 99902503 } , { 0 . 99965614 , 0 . 99959957 , 0 . 99963092 , 0 . 99973552 } , { 0 . 9999752 , 0 . 99998861 , 0 . 99994375 , 0 . 99998505 } , { 0 . 99964293 , 0 . 99879278 , 0 . 99905795 , 0 . 99705307 } , { 0 . 99788947 , 0 . 99867085 , 0 . 99868681 , 0 . 99012413 } , { 0 . 99999581 , 0 . 99994351 , 0 . 99985991 , 0 . 99999955 } , { 0 . 99996824 , 0 . 99822008 , 0 . 99874627 , 0 . 99943549 } , { 0 . 9997877 , 0 . 99996904 , 0 . 99987919 , 0 . 99999103 } , { 0 . 99948785 , 0 . 99539425 , 0 . 99978223 , 0 . 99617908 } , { 0 . 99934875 , 0 . 99977032 , 0 . 99995357 , 0 . 99949949 } , { 0 . 99999988 , 0 . 99999943 , 0 . 99999886 , 0 . 99999963 } , { 0 . 99726107 , 0 . 99809817 , 0 . 99445842 , 0 . 99947091 } } , { { - 2 . 3481737e - 05 , - 6 . 7307406e - 06 , - 2 . 8605869e - 06 , - 2 . 0372001e - 06 } , { 6 . 6885689e - 05 , 4 . 5630281e - 06 , 3 . 5788218e - 05 , 1 . 0842484e - 05 } , { - 4 . 9278613e - 05 , - 2 . 4660601e - 05 , 3 . 1625301e - 06 , 0 . 00019708279 } , { 1 . 2439158e - 05 , 3 . 0347865e - 05 , 8 . 6153947e - 06 , 1 . 0887256e - 05 } , { - 0 . 00012454598 , - 6 . 513709e - 05 , - 3 . 5853483e - 06 , - 3 . 4708286e - 06 } , { - 0 . 00013746339 , 0 . 00013516333 , 8 . 4535039e - 05 , 5 . 693766e - 05 } , { - 2 . 3674091e - 05 , - 3 . 4690053e - 06 , 5 . 3812265e - 07 , - 1 . 7613197e - 05 } , { - 0 . 00025790043 , 3 . 0475251e - 05 , 2 . 1174795e - 06 , - 0 . 00023630753 } , { - 8 . 8624748e - 06 , 7 . 9175589e - 06 , - 2 . 4258477e - 07 , - 0 . 00017288313 } , { 4 . 0061469e - 05 , 0 . 00069846663 , - 0 . 00060299476 , - 0 . 00015396968 } , { 5 . 0667108e - 06 , 2 . 306363e - 05 , 0 . 00028636884 , 3 . 6246633e - 05 } , { 0 . 00032740524 , - 0 . 00037985037 , - 0 . 00014841039 , - 0 . 00012676016 } , { 8 . 7000758e - 05 , 0 . 00018530207 , 1 . 7669124e - 05 , - 0 . 00023199594 } , { 9 . 2332094e - 05 , 0 . 00013487652 , 0 . 00034587506 , - 3 . 8853378e - 05 } , { 6 . 9809868e - 05 , - 0 . 00015411544 , 0 . 0013505166 , 1 . 4531796e - 06 } , { - 6 . 3782301e - 05 , 4 . 8545135e - 05 , - 0 . 00027083794 , 4 . 5129465e - 05 } , { 3 . 0912438e - 06 , - 3 . 2982361e - 06 , - 3 . 3551612e - 06 , - 1 . 7781589e - 05 } , { 9 . 872609e - 06 , - 2 . 9944213e - 05 , - 4 . 5592652e - 05 , 1 . 5950681e - 05 } , { 1 . 4767773e - 05 , - 2 . 2486726e - 05 , - 0 . 00010613341 , - 0 . 00015794394 } , { 2 . 4386215e - 05 , - 1 . 1610334e - 05 , - 4 . 4456294e - 05 , - 5 . 0215596e - 06 } , { - 4 . 2741558e - 06 , 8 . 7714242e - 06 , - 6 . 6343322e - 05 , 6 . 7010735e - 05 } , { 0 . 00016489767 , - 3 . 3636771e - 05 , 5 . 1610504e - 05 , 5 . 2803593e - 06 } , { 1 . 1649256e - 05 , 2 . 1169993e - 05 , 1 . 9755999e - 05 , 1 . 3389438e - 05 } , { - 0 . 00015815197 , - 0 . 00014316145 , 2 . 6536218e - 06 , - 4 . 6846396e - 05 } } , { { - 3 . 5109783e - 06 , - 9 . 8530632e - 06 , - 4 . 5020804e - 06 , 6 . 9233235e - 08 } , { 9 . 9938991e - 06 , - 2 . 0914089e - 06 , 3 . 5717699e - 05 , 3 . 2813664e - 06 } , { 0 . 00012938219 , 1 . 111062e - 05 , 8 . 0858608e - 05 , 0 . 00018147439 } , { 4 . 8657525e - 06 , 8 . 6580257e - 06 , 3 . 6742927e - 06 , 3 . 5828406e - 06 } , { 6 . 9905696e - 05 , 2 . 0985073e - 05 , 6 . 8866215e - 06 , - 4 . 2552499e - 05 } , { 0 . 00012100208 , 9 . 7821801e - 05 , 0 . 00013576456 , 6 . 3686234e - 05 } , { 1 . 954525e - 06 , - 1 . 0727343e - 06 , 5 . 2332444e - 07 , - 5 . 4034988e - 06 } , { 0 . 00013699813 , - 2 . 226833e - 05 , 1 . 4994043e - 06 , 1 . 7110377e - 05 } , { 0 . 0001678261 , - 0 . 00013844113 , - 3 . 4281745e - 05 , 5 . 3854072e - 05 } , { - 1 . 3018868e - 05 , 0 . 00022176303 , 0 . 00016983401 , 0 . 00038109805 } , { 0 . 00019016068 , 0 . 00023448876 , 2 . 643329e - 05 , 4 . 6842203e - 05 } , { - 1 . 2492528e - 05 , - 0 . 00059486605 , 0 . 00012427061 , 8 . 1876965e - 05 } , { 8 . 400564e - 05 , - 0 . 00029859163 , - 4 . 884214e - 05 , 0 . 0002631806 } , { 0 . 00019907281 , 0 . 00014046808 , 0 . 00015482448 , 4 . 0461099e - 05 } , { - 0 . 00024349239 , 0 . 00081298441 , 0 . 00084294728 , 7 . 9617963e - 05 } , { - 6 . 0040835e - 05 , 3 . 2352918e - 07 , 0 . 00024295599 , 0 . 00011067283 } , { - 6 . 0027092e - 06 , 1 . 1975092e - 06 , 1 . 2248893e - 06 , - 2 . 1293392e - 05 } , { 1 . 4478736e - 05 , 6 . 8326918e - 05 , - 7 . 8693614e - 06 , 9 . 2888155e - 06 } , { - 1 . 6982828e - 05 , 1 . 2094341e - 05 , - 3 . 1693808e - 05 , 0 . 00028574477 } , { 3 . 4480942e - 05 , 2 . 6556008e - 05 , 0 . 00016193956 , - 1 . 8966503e - 06 } , { - 5 . 7726961e - 06 , 2 . 1091148e - 05 , 5 . 8963955e - 05 , - 1 . 0834372e - 05 } , { 0 . 0001214393 , 1 . 4174882e - 05 , 0 . 0001371836 , 0 . 00021757165 } , { 1 . 0140226e - 05 , 6 . 1641031e - 06 , 1 . 0590727e - 05 , 1 . 0893212e - 05 } , { - 1 . 7442656e - 05 , 4 . 2353331e - 05 , 7 . 4324714e - 05 , - 1 . 9484775e - 06 } } } , { { { 3 . 7217719 , 3 . 6900797 , 3 . 6899881 , 3 . 6670816 } , { 0 . 067826319 , 0 . 16468028 , 0 . 083129199 , 0 . 1336756 } , { 0 . 66338737 , 0 . 23883566 , 0 . 093361469 , 0 . 10095622 } , { 0 . 27185537 , 0 . 20781392 , 0 . 32216624 , 0 . 29876595 } , { 2 . 0776462 , 2 . 0006156 , 2 . 0243138 , 2 . 080345 } , { 0 . 57695783 , 0 . 18015147 , - 0 . 11440889 , 0 . 14229144 } , { 0 . 63833683 , 0 . 41431062 , 0 . 44752994 , 0 . 47594414 } , { 1 . 7890608 , 1 . 962584 , 1 . 9322155 , 1 . 6588331 } , { 3 . 0538128 , 3 . 108267 , 3 . 1001573 , 2 . 9593433 } , { - 0 . 28383051 , - 0 . 27708376 , - 0 . 042513902 , - 0 . 085181891 } , { 0 . 3873435 , 0 . 41697884 , 0 . 39625427 , 0 . 33250735 } , { - 0 . 33498881 , - 0 . 40206929 , - 0 . 028905862 , - 0 . 48179632 } , { 1 . 1875033 , 1 . 3535177 , 1 . 2526197 , 1 . 3337495 } , { 0 . 42579488 , 0 . 24951727 , 0 . 18976118 , 0 . 20605317 } , { - 0 . 53212666 , - 0 . 3861028 , - 0 . 75685995 , - 0 . 23411882 } , { 1 . 6910165 , 1 . 686815 , 1 . 5906473 , 1 . 6528217 } , { 4 . 0570657 , 4 . 0349492 , 4 . 0350332 , 4 . 0498099 } , { - 0 . 017225465 , - 0 . 032503897 , 0 . 46003211 , 0 . 21602109 } , { 1 . 1196901 , 1 . 00885 , 0 . 91675568 , 0 . 99635794 } , { - 0 . 093891275 , 0 . 0809352 , - 0 . 13783332 , 0 . 27130678 } , { 1 . 9925136 , 1 . 9829394 , 1 . 8820721 , 1 . 9542026 } , { 0 . 84563763 , 0 . 48476746 , 0 . 37907152 , 0 . 70267878 } , { 0 . 37054708 , 0 . 4228574 , 0 . 6329822 , 0 . 26197064 } , { 1 . 9618393 , 1 . 8405969 , 1 . 9440918 , 1 . 901629 } } , { { - 5 . 6047186e - 06 , 6 . 0454847e - 06 , 2 . 8365975e - 06 , 6 . 0894367e - 06 } , { - 0 . 00069876506 , - 0 . 00029642785 , - 0 . 00059516082 , - 0 . 00025400441 } , { - 0 . 00020850504 , - 0 . 00012959593 , - 0 . 00032902532 , - 0 . 00058117893 } , { - 0 . 00037901964 , - 0 . 00038062016 , - 0 . 00023777964 , - 0 . 00033714679 } , { - 5 . 9894351e - 05 , - 9 . 820791e - 05 , - 5 . 9867157e - 06 , - 6 . 258549e - 06 } , { - 0 . 00035424038 , - 8 . 7146215e - 05 , 3 . 0398362e - 05 , - 0 . 00061406521 } , { 0 . 00014971442 , 4 . 5936211e - 05 , - 5 . 6259869e - 06 , 0 . 00013567035 } , { - 0 . 00016180211 , 3 . 1840487e - 06 , 3 . 8979157e - 07 , - 0 . 00017131994 } , { - 1 . 9877193e - 05 , 2 . 5768261e - 05 , 9 . 0577543e - 06 , - 0 . 00013927462 } , { - 0 . 0012323564 , - 0 . 00042892846 , 7 . 2082106e - 05 , 0 . 00010999853 } , { - 0 . 00034618449 , - 0 . 00017058897 , - 0 . 00016535057 , - 0 . 00096982024 } , { - 0 . 00028039653 , - 7 . 155747e - 05 , - 0 . 00075796707 , 0 . 00062756458 } , { 6 . 6596276e - 05 , - 7 . 9730809e - 05 , - 8 . 0686754e - 05 , - 2 . 9532397e - 05 } , { - 0 . 00084106867 , - 0 . 00036762453 , 0 . 00012523548 , - 0 . 00052789663 } , { 7 . 6718268e - 05 , - 0 . 0010042005 , - 0 . 00042802983 , - 0 . 0011951304 } , { - 3 . 6972258e - 05 , 2 . 1447505e - 06 , - 0 . 00035448623 , - 1 . 0620008e - 05 } , { 2 . 8326169e - 05 , 2 . 2049468e - 05 , 2 . 2640575e - 05 , 1 . 7574827e - 05 } , { - 0 . 00014318496 , - 0 . 0004811524 , - 0 . 00049293303 , - 0 . 00067646484 } , { - 2 . 7469144e - 05 , - 5 . 9653763e - 06 , - 1 . 3998899e - 05 , - 0 . 00018475323 } , { - 0 . 00017314302 , - 0 . 00010954727 , - 0 . 00040004932 , 3 . 31106e - 05 } , { - 3 . 6093435e - 06 , - 1 . 6125243e - 05 , - 4 . 9195648e - 05 , 1 . 5586886e - 05 } , { 0 . 0002059631 , - 0 . 0004024722 , - 0 . 00047984678 , - 9 . 8485329e - 05 } , { - 0 . 00094100913 , - 0 . 00073046048 , - 0 . 00052500163 , - 0 . 00068196784 } , { - 2 . 2820197e - 05 , - 5 . 9454557e - 05 , - 6 . 2505468e - 06 , - 2 . 6569804e - 05 } } , { { 2 . 6015883e - 05 , 8 . 5398335e - 06 , 3 . 8473185e - 06 , 9 . 1409625e - 06 } , { - 0 . 00041459247 , - 0 . 0001855224 , - 0 . 00030529542 , - 0 . 00016322166 } , { - 8 . 8427847e - 05 , - 0 . 0002302048 , - 0 . 00038072959 , - 0 . 00076801295 } , { - 0 . 00027717792 , - 0 . 00028594346 , - 0 . 00017910208 , - 0 . 00027291164 } , { 2 . 8409311e - 05 , - 3 . 8005817e - 05 , - 4 . 2266878e - 06 , - 1 . 4520383e - 05 } , { - 0 . 0001088827 , - 0 . 00021924377 , 3 . 9307406e - 05 , - 0 . 00032488556 } , { 0 . 00027997916 , 3 . 5103699e - 05 , - 5 . 7448764e - 06 , 0 . 00010259251 } , { - 4 . 7807894e - 06 , - 2 . 9470863e - 05 , 2 . 6656233e - 07 , - 0 . 00014346393 } , { 0 . 00015527098 , - 6 . 8528726e - 05 , - 1 . 1206714e - 05 , 2 . 3422595e - 05 } , { - 0 . 0012763247 , - 0 . 00051503472 , 0 . 00058055106 , - 0 . 00068688488 } , { - 6 . 1232076e - 06 , - 1 . 7073841e - 05 , - 0 . 00033533389 , - 0 . 00078769935 } , { - 0 . 00044113485 , - 0 . 00027577451 , - 0 . 0012008622 , 0 . 00013071136 } , { 1 . 834948e - 05 , - 0 . 00015615102 , - 0 . 00016449385 , 3 . 6685217e - 05 } , { - 0 . 00063618257 , - 0 . 00032641968 , - 5 . 0281118e - 05 , - 0 . 00041378992 } , { - 0 . 0010181884 , - 0 . 0003871932 , - 0 . 00050061147 , - 0 . 0018967455 } , { - 5 . 7650067e - 05 , - 5 . 1145774e - 06 , - 0 . 00017409773 , 1 . 9512036e - 05 } , { 1 . 5838743e - 05 , 2 . 503655e - 05 , 2 . 5679098e - 05 , 2 . 0053218e - 05 } , { - 0 . 00018055811 , - 0 . 00044345237 , - 7 . 9049557e - 05 , - 0 . 00095669161 } , { - 4 . 98611e - 05 , - 1 . 1320605e - 06 , 3 . 7756645e - 06 , - 8 . 7299215e - 05 } , { - 0 . 00011794063 , - 0 . 00015778552 , - 0 . 00036514881 , 4 . 7288704e - 05 } , { - 5 . 1753817e - 06 , - 1 . 5040527e - 06 , - 2 . 836739e - 05 , - 9 . 4945229e - 06 } , { 0 . 00016873335 , - 0 . 00031983601 , - 0 . 00052281245 , 0 . 00019034815 } , { - 0 . 0011988594 , - 0 . 0010684975 , - 0 . 00057577023 , - 0 . 0009143845 } , { 5 . 0336006e - 05 , - 1 . 356148e - 05 , 1 . 5582694e - 05 , - 2 . 0666272e - 05 } } } , { { { 0 . 012207721 , 0 . 0044164612 , 0 . 0022704542 , 0 . 0042008503 } , { 0 . 29516302 , 0 . 139976 , 0 . 35038027 , 0 . 13748343 } , { 0 . 1462123 , 0 . 12114907 , 0 . 28473665 , 0 . 45762717 } , { 0 . 17976664 , 0 . 19141553 , 0 . 1209483 , 0 . 16393769 } , { 0 . 044254492 , 0 . 11383095 , 0 . 0062726904 , 0 . 023550537 } , { 0 . 14785458 , 0 . 10151341 , 0 . 045717467 , 0 . 42243971 } , { - 0 . 24205201 , - 0 . 033590842 , 0 . 0032064617 , - 0 . 093924041 } , { 0 . 10866955 , 0 . 016299431 , 0 . 00081631108 , 0 . 15856447 } , { 0 . 10108337 , 0 . 057931152 , 0 . 024463589 , 0 . 21514346 } , { 0 . 47967783 , 0 . 75472932 , 0 . 5653649 , 0 . 64752457 } , { 0 . 30082544 , 0 . 15124922 , 0 . 23567284 , 0 . 47161499 } , { 0 . 54286166 , 0 . 61049777 , 0 . 61641378 , 0 . 51181399 } , { 0 . 39328762 , 0 . 25557559 , 0 . 25875912 , 0 . 22436901 } , { 0 . 45699569 , 0 . 16989563 , 0 . 2429263 , 0 . 3924359 } , { 0 . 92996797 , 1 . 1024806 , 0 . 78045387 , 1 . 2298879 } , { 0 . 19029829 , - 0 . 022675055 , 0 . 28113642 , 0 . 034941166 } , { 0 . 013203939 , 0 . 013034069 , 0 . 013414649 , 0 . 011688038 } , { 0 . 076026927 , 0 . 13838472 , 0 . 29961655 , 0 . 31531564 } , { 0 . 089182386 , 0 . 010401684 , 0 . 029374547 , 0 . 22995838 } , { 0 . 052198894 , 0 . 039866726 , 0 . 11570972 , - 0 . 013818992 } , { 0 . 0062380932 , 0 . 01788119 , - 0 . 20765047 , 0 . 013339281 } , { 0 . 12436441 , 0 . 17318651 , 0 . 21554136 , 0 . 18600144 } , { 0 . 38005287 , 0 . 32135548 , 0 . 28632777 , 0 . 29211902 } , { 0 . 03798742 , 0 . 0450845 , 0 . 010912505 , 0 . 039060104 } } , { { 0 . 00077914246 , 0 . 00011130803 , 8 . 1110229e - 05 , - 0 . 00035312557 } , { 0 . 00051711901 , 0 . 00029701387 , 0 . 00040733345 , 0 . 00034149723 } , { 0 . 00063893978 , - 0 . 00013702086 , 0 . 00030866699 , - 0 . 00020070677 } , { 7 . 5899443e - 05 , 9 . 7456273e - 05 , - 4 . 5352178e - 05 , 7 . 6172703e - 06 } , { 0 . 00066250814 , - 0 . 00073033349 , 0 . 00015225542 , - 0 . 0010197351 } , { 0 . 00040931533 , - 0 . 00043022747 , 0 . 00093333285 , 0 . 0002579685 } , { - 0 . 00067488578 , - 0 . 0003706974 , - 0 . 00044487256 , - 0 . 00056555959 } , { 0 . 00075838366 , - 0 . 0021903789 , - 0 . 0026744174 , - 0 . 00047135202 } , { - 0 . 00081050821 , - 0 . 0010297809 , - 0 . 00099480849 , - 0 . 00074914246 } , { 0 . 00063637392 , 5 . 248783e - 05 , 0 . 00044645091 , 0 . 00018028446 } , { 0 . 00067430392 , 0 . 0004762628 , - 0 . 00032736685 , 0 . 00041933609 } , { 6 . 2324555e - 05 , - 1 . 6709531e - 06 , 0 . 00057418116 , - 0 . 0010360999 } , { - 0 . 00038256183 , - 0 . 0010104012 , - 0 . 00045533693 , - 1 . 3888404e - 05 } , { 0 . 00068274628 , 0 . 00068411875 , - 0 . 00091273333 , 0 . 00016211145 } , { - 0 . 00039440715 , 0 . 00027665323 , - 0 . 00035895503 , 0 . 00013423207 } , { - 0 . 00061939017 , 0 . 00012140102 , 0 . 00024178233 , 0 . 00064755788 } , { - 0 . 00052441128 , - 0 . 00050994483 , - 0 . 00051126044 , 0 . 00066320373 } , { 0 . 00085915332 , 0 . 0013567332 , - 0 . 00014328466 , 0 . 00056098523 } , { - 0 . 0012682676 , 0 . 0029139719 , 0 . 0019812291 , - 0 . 00053863027 } , { 0 . 0021895869 , 0 . 00062956835 , 0 . 0018161156 , 0 . 00011699452 } , { - 0 . 0010337306 , 0 . 00016880497 , - 0 . 0014942346 , - 0 . 0034402453 } , { - 0 . 0025336946 , - 0 . 00019468865 , - 0 . 00018045349 , - 5 . 4312149e - 05 } , { 0 . 00021491979 , 4 . 7651714e - 05 , - 0 . 00044921151 , 0 . 00046742044 } , { 0 . 0019408125 , 0 . 00044842687 , 0 . 0026003265 , - 0 . 00090116109 } } , { { - 0 . 0006591255 , 0 . 00022873584 , 0 . 00026313866 , - 0 . 00060151354 } , { 0 . 00027198127 , 0 . 00034252944 , 0 . 00033246896 , 0 . 00035232159 } , { - 0 . 00034460639 , - 5 . 9085725e - 05 , 7 . 836454e - 05 , - 0 . 00018946388 } , { 0 . 00018790551 , 0 . 0001918358 , 9 . 7031467e - 05 , 0 . 00015259869 } , { - 0 . 0023033429 , - 0 . 0012945186 , - 0 . 00080964072 , - 0 . 00030432514 } , { - 0 . 001359781 , 0 . 00055828912 , - 0 . 00041912301 , 0 . 00019263336 } , { - 0 . 00042789448 , - 0 . 00018313775 , - 0 . 00030217124 , - 0 . 00028437496 } , { - 0 . 0018340159 , 0 . 00030654336 , - 0 . 00010781402 , - 0 . 0011985455 } , { - 0 . 002103478 , 0 . 00029492518 , - 0 . 00042283946 , - 0 . 001472689 } , { 0 . 00064558079 , 0 . 00049703204 , - 0 . 00018932594 , - 0 . 00038268301 } , { - 0 . 00097813334 , - 0 . 00057838807 , 0 . 00079268109 , 0 . 00039650774 } , { - 0 . 00017335252 , 0 . 00074363734 , 0 . 0008194423 , - 0 . 00065923207 } , { - 0 . 00075344545 , - 0 . 00026114262 , - 0 . 00054658657 , - 0 . 0013814943 } , { - 0 . 00028279346 , 0 . 00055730283 , 0 . 00048990213 , - 0 . 00022186466 } , { 0 . 00013438509 , - 0 . 0001962818 , - 0 . 00036195953 , 0 . 00042669461 } , { - 0 . 00089003585 , - 0 . 0011600794 , - 0 . 0012554286 , - 0 . 0012892408 } , { - 0 . 00067007058 , - 0 . 0010597247 , - 0 . 0010590421 , 0 . 00044132516 } , { 0 . 0011626727 , 0 . 001261033 , - 0 . 00072912018 , 0 . 00076332442 } , { - 0 . 001204702 , - 0 . 00011230019 , 0 . 00036178615 , - 0 . 0017559004 } , { 0 . 00096282849 , 0 . 001025959 , 0 . 0011696947 , 0 . 00046633555 } , { - 0 . 00082328571 , - 0 . 00075771669 , - 0 . 0011629302 , 0 . 00073458863 } , { - 0 . 0016869269 , - 0 . 00035239862 , - 0 . 0004024204 , - 0 . 0016276971 } , { 0 . 00029053123 , 0 . 00013409355 , - 0 . 00049087974 , 0 . 00061969429 } , { - 0 . 0013198997 , - 0 . 0018615784 , - 0 . 0025724061 , - 0 . 0015563017 } } } } , { { { { - 0 . 072246889 , - 0 . 043157285 , 0 . 043289306 , 0 . 095998047 } , { 0 . 12597079 , 0 . 24289541 , - 0 . 10930005 , - 0 . 24150539 } , { 0 . 031889347 , - 0 . 036238337 , - 0 . 014521983 , - 0 . 018963885 } , { - 0 . 044155351 , - 0 . 0077170425 , - 0 . 043781059 , 0 . 047982339 } , { 0 . 093995001 , - 0 . 0079510758 , - 0 . 04688882 , - 0 . 11125523 } , { 0 . 01700754 , - 0 . 0034361033 , 0 . 055252382 , - 0 . 053119426 } , { - 0 . 0014957087 , - 0 . 00063057103 , 0 . 037930463 , 0 . 017656646 } , { - 0 . 017388477 , - 0 . 084085888 , - 0 . 067726647 , 0 . 061397079 } , { - 0 . 070625168 , - 0 . 061293011 , - 0 . 077366932 , 0 . 11518646 } , { - 0 . 14771316 , - 0 . 12543895 , 0 . 052150789 , 0 . 10530462 } , { - 0 . 03609139 , 0 . 001131616 , - 0 . 039549928 , 0 . 03805765 } , { 0 . 064364205 , 0 . 066758929 , 0 . 045537002 , - 0 . 05510954 } , { 0 . 049051369 , 0 . 098312455 , - 0 . 01079726 , - 0 . 11202623 } , { 0 . 033012208 , - 0 . 0013996988 , - 0 . 0049458824 , - 0 . 028981527 } , { 0 . 008617177 , - 0 . 00017670863 , - 0 . 0052380282 , - 0 . 0023438457 } , { - 0 . 05901498 , - 0 . 050754807 , - 0 . 00011829844 , 0 . 037297411 } , { - 0 . 056264446 , - 0 . 03645315 , - 0 . 066412698 , 0 . 019549244 } , { - 0 . 11401603 , - 0 . 11856524 , 0 . 12275022 , 0 . 11635143 } , { - 0 . 0011999881 , - 0 . 0016334327 , - 0 . 0056868938 , 0 . 013393766 } , { 0 . 054526972 , 0 . 033632235 , 0 . 062591094 , - 0 . 0025531074 } , { 0 . 073041316 , 0 . 073735243 , - 0 . 06935254 , - 0 . 11214186 } , { 0 . 034872822 , - 0 . 015473423 , 0 . 037359975 , - 0 . 026829465 } , { - 0 . 015137592 , - 0 . 0064462553 , 0 . 011771178 , 0 . 0025042048 } , { - 0 . 038708904 , - 0 . 033968131 , - 0 . 044070885 , 0 . 024422773 } } , { { - 0 . 047895007 , - 0 . 016535938 , 0 . 04855533 , 0 . 018341613 } , { 0 . 004310087 , 0 . 01519838 , - 0 . 0033290683 , - 0 . 013597406 } , { 0 . 0015859181 , 0 . 016869623 , - 0 . 019279963 , - 0 . 01426933 } , { - 0 . 0061048976 , 0 . 031131561 , 0 . 018085381 , - 0 . 017927117 } , { 0 . 052590378 , 0 . 0066156852 , - 0 . 0025756141 , - 0 . 037241705 } , { 0 . 0083512619 , 0 . 0046235666 , 0 . 024122126 , - 0 . 013443654 } , { 0 . 0010672274 , 0 . 00053123301 , - 0 . 0016276029 , - 0 . 04221993 } , { - 0 . 0048754166 , - 0 . 021474788 , - 0 . 0039993317 , 0 . 011831691 } , { - 0 . 054685347 , - 0 . 050242732 , - 0 . 007606251 , 0 . 043061893 } , { - 7 . 5644942e - 05 , 0 . 00086632318 , 0 . 0001960729 , 0 . 0013264286 } , { 0 . 0042413724 , - 0 . 0057181522 , 0 . 0065940983 , - 0 . 0078263328 } , { 0 . 0031260881 , - 0 . 0013520907 , 0 . 025073658 , - 0 . 010841673 } , { 0 . 038353769 , 0 . 06620308 , - 0 . 0072105562 , - 0 . 079188681 } , { 0 . 003099559 , - 0 . 0022927921 , 0 . 021982683 , - 0 . 018991144 } , { 0 . 012285675 , 0 . 0091834074 , - 0 . 0041874571 , - 0 . 032253924 } , { - 0 . 014563556 , 0 . 009843969 , - 0 . 010490279 , 0 . 012979866 } , { - 0 . 005492286 , 0 . 064109426 , - 0 . 034795617 , - 0 . 020395732 } , { - 0 . 023364141 , - 0 . 059336321 , 0 . 080710391 , 0 . 038948527 } , { 0 . 0028384819 , 0 . 001822471 , 0 . 0012903958 , 0 . 012781079 } , { - 0 . 004510518 , - 0 . 0020008272 , 0 . 0017752876 , 0 . 0077607089 } , { 0 . 032279653 , 0 . 0041906079 , - 0 . 034682371 , 0 . 0061335907 } , { - 0 . 0082992317 , - 0 . 025250117 , - 0 . 017026845 , - 0 . 028345042 } , { - 0 . 013132125 , - 0 . 026688493 , - 0 . 0014827793 , - 0 . 003236826 } , { 0 . 01650781 , 0 . 002313574 , - 0 . 012897922 , 0 . 026077933 } } , { { 0 . 062668058 , 0 . 0081578851 , 0 . 018952049 , - 0 . 012267283 } , { 0 . 0008567722 , 0 . 0033246009 , - 0 . 0037620102 , - 0 . 0096317368 } , { - 0 . 0083012273 , 0 . 01184624 , - 0 . 01209373 , 0 . 020208536 } , { 0 . 013862003 , 0 . 019166381 , 0 . 013235471 , - 0 . 026788736 } , { - 0 . 021904217 , - 0 . 051018749 , 0 . 0020330268 , 0 . 006626371 } , { - 0 . 015856131 , 0 . 0028024655 , - 0 . 032825412 , - 0 . 018920906 } , { 0 . 0020870233 , 0 . 0011616727 , - 0 . 0032704368 , - 0 . 027327141 } , { 0 . 01934969 , 0 . 002427195 , 0 . 049925128 , - 0 . 0061414889 } , { 0 . 013158375 , 0 . 022248445 , 0 . 040266734 , - 0 . 017583455 } , { 1 . 9024812e - 05 , 0 . 00071602053 , 0 . 0012622199 , 0 . 0018791611 } , { - 0 . 0011857767 , 0 . 0023417924 , 0 . 026237548 , - 0 . 014687892 } , { - 0 . 041419782 , 0 . 024942194 , - 0 . 029143101 , 0 . 036590943 } , { - 0 . 015470651 , - 0 . 035208671 , - 0 . 038530514 , 0 . 037434376 } , { - 0 . 0029356279 , 0 . 0023358079 , 0 . 017641055 , 0 . 0038203652 } , { - 0 . 0030449623 , - 0 . 010187444 , 0 . 0066142145 , 0 . 0037433206 } , { 0 . 0080034603 , 0 . 011463159 , - 0 . 0058129532 , 0 . 011831147 } , { - 0 . 0091743137 , 0 . 045949289 , 0 . 022412137 , - 0 . 0067531419 } , { 0 . 00069946656 , - 0 . 0068974782 , 0 . 0091806954 , 0 . 0022160793 } , { - 0 . 0027530077 , 0 . 00089797627 , 0 . 0066153093 , - 0 . 010355635 } , { - 0 . 019399018 , - 0 . 0085762573 , 0 . 0208003 , - 0 . 027739023 } , { - 0 . 014354809 , - 0 . 011971089 , - 0 . 0031124986 , 0 . 044710091 } , { - 0 . 011411144 , 0 . 0073253411 , - 0 . 0087561348 , - 0 . 014838738 } , { 0 . 018837992 , 0 . 00231775 , - 0 . 013982978 , - 0 . 0020044658 } , { 0 . 0012069362 , 0 . 0012202952 , 0 . 029106153 , 0 . 00062793994 } } } , { { { 0 . 054154158 , - 0 . 11603661 , - 0 . 025631275 , 0 . 054671866 } , { - 0 . 2359715 , 0 . 093194255 , 0 . 21874866 , - 0 . 08378526 } , { 0 . 0089903397 , 0 . 0087113885 , - 0 . 015445726 , 0 . 011142042 } , { - 0 . 0055372249 , - 0 . 0041494086 , - 0 . 033355186 , - 0 . 010136823 } , { - 0 . 015010227 , - 0 . 0077144008 , 0 . 13058394 , - 0 . 016779666 } , { - 0 . 015855009 , 0 . 014090685 , 0 . 026549575 , 0 . 025677527 } , { - 0 . 00065423811 , - 0 . 0011506403 , 0 . 028628751 , 0 . 0086359197 } , { - 0 . 010571292 , 0 . 035861454 , - 0 . 025871285 , - 0 . 024827688 } , { 0 . 00010603924 , 0 . 011433504 , - 0 . 052819957 , - 0 . 020208661 } , { 0 . 12243361 , - 0 . 14574398 , - 0 . 10091072 , 0 . 054524772 } , { - 0 . 014659734 , - 0 . 02291001 , 0 . 010102434 , - 0 . 0099333349 } , { - 0 . 0079939087 , 0 . 023468399 , 0 . 044548395 , 0 . 04568814 } , { - 0 . 048188816 , 0 . 016469102 , 0 . 084818672 , - 0 . 040634065 } , { 0 . 015089138 , 0 . 025396216 , 0 . 017000121 , 0 . 010820807 } , { - 0 . 0098155552 , - 0 . 00080001495 , 0 . 0020122754 , - 0 . 00046896909 } , { - 0 . 0018906417 , - 0 . 03909342 , - 0 . 020339049 , - 0 . 024007559 } , { - 0 . 0012744487 , - 0 . 027829333 , - 0 . 05202457 , - 0 . 024366779 } , { 0 . 10406956 , - 0 . 092281421 , - 0 . 050420166 , 0 . 10716663 } , { - 0 . 0049603976 , - 0 . 0055370076 , - 0 . 0016910106 , 0 . 012172389 } , { - 0 . 0026486448 , 0 . 038673757 , - 0 . 0016176887 , 0 . 052692494 } , { - 0 . 03722357 , 0 . 055455783 , 0 . 067738953 , - 0 . 0087990582 } , { - 0 . 0026491637 , 0 . 017275247 , 0 . 010687117 , 0 . 020312052 } , { - 0 . 0016032469 , 0 . 0090272843 , - 0 . 0079027514 , - 0 . 0050039898 } , { - 0 . 0073653412 , - 0 . 033150577 , 0 . 0082912493 , - 0 . 021457881 } } , { { - 0 . 0059001999 , 0 . 033600833 , 0 . 066374213 , - 0 . 018058548 } , { - 0 . 0037864945 , - 0 . 0064946131 , 0 . 0018627774 , 0 . 0044899139 } , { 0 . 0048961861 , - 0 . 0034770968 , - 0 . 0002311598 , - 0 . 0053935761 } , { 0 . 0090090757 , 0 . 012149811 , 0 . 0029969663 , 0 . 0049403543 } , { - 0 . 042874682 , - 0 . 0083455851 , - 0 . 0064437344 , 0 . 0010579362 } , { 0 . 011866873 , - 0 . 017157526 , - 0 . 014724976 , 0 . 0054373752 } , { - 0 . 0006329516 , - 0 . 00024834697 , 0 . 0015416168 , - 0 . 014246989 } , { 0 . 031530357 , - 0 . 052715858 , - 0 . 0063186617 , - 0 . 0070200141 } , { - 0 . 0082273844 , 0 . 053856605 , 0 . 0096812384 , 0 . 01684635 } , { - 0 . 00017150577 , 0 . 00097354737 , 0 . 0013944706 , 0 . 00085166684 } , { - 0 . 013604545 , 0 . 0089329355 , - 0 . 013809086 , 0 . 0025044469 } , { - 0 . 020284731 , 0 . 0004724419 , - 0 . 045697697 , - 0 . 01844702 } , { 0 . 017874081 , - 0 . 0040537465 , - 0 . 023316716 , - 0 . 026344708 } , { 0 . 0092557469 , - 0 . 014456327 , - 0 . 0092919835 , 0 . 0091758924 } , { 0 . 016058873 , 0 . 0019220807 , 0 . 0031692823 , 0 . 0024577167 } , { - 0 . 021184352 , 0 . 021287579 , - 0 . 0048442696 , 0 . 0095799112 } , { 0 . 035229915 , - 0 . 054291919 , - 0 . 013871324 , 0 . 035585241 } , { 0 . 001275203 , 0 . 011513119 , 0 . 020184769 , - 0 . 0061701639 } , { 0 . 011353237 , 0 . 0052697685 , 0 . 0047637419 , - 0 . 020278005 } , { 0 . 0068266296 , - 0 . 01173749 , 0 . 037482577 , - 0 . 0083236299 } , { 0 . 025699221 , - 0 . 03651135 , - 0 . 032342446 , - 0 . 0059784486 } , { 0 . 0029540635 , - 0 . 0021598269 , 0 . 0028168477 , 0 . 0044577193 } , { 0 . 0038274002 , - 0 . 0050806333 , 0 . 007628551 , 0 . 0027461742 } , { 0 . 0056567464 , 0 . 006846664 , - 0 . 031161558 , - 0 . 0040832656 } } , { { 0 . 025668431 , 0 . 0093723617 , 7 . 4324163e - 05 , - 0 . 023051436 } , { - 0 . 010148124 , 0 . 0018159908 , 0 . 0072269566 , 0 . 00082671261 } , { 0 . 0069741056 , 0 . 023493533 , 0 . 028507618 , - 0 . 026874125 } , { 0 . 0083316277 , - 0 . 024891629 , 0 . 013623217 , 0 . 0038373532 } , { - 0 . 020992516 , 0 . 070912136 , - 0 . 0014634877 , - 0 . 015680371 } , { 0 . 02178962 , - 0 . 003772636 , - 0 . 024578501 , - 0 . 047467019 } , { 0 . 0028586275 , 0 . 0033445767 , 0 . 0049576063 , - 0 . 017365739 } , { 0 . 0075721122 , 0 . 010652219 , - 0 . 024031886 , - 0 . 0001146548 } , { 0 . 016381176 , - 0 . 044765924 , - 0 . 038036229 , - 0 . 014041395 } , { - 0 . 00082564842 , 0 . 00033107944 , 0 . 00073792054 , 0 . 0005712734 } , { 0 . 0080934887 , 0 . 014534447 , - 0 . 0071347609 , 0 . 0085413493 } , { - 0 . 018211778 , 0 . 0064443848 , 0 . 017393403 , 0 . 011490985 } , { - 0 . 071531366 , 0 . 030059694 , 0 . 049103287 , 0 . 0074609412 } , { 0 . 00770209 , - 0 . 017999995 , - 0 . 040048679 , - 0 . 0029073853 } , { 0 . 020442166 , 0 . 0019454488 , - 0 . 019644905 , 0 . 021793285 } , { 0 . 035171271 , 0 . 0080192155 , - 0 . 023151504 , 0 . 014168348 } , { - 0 . 048901887 , - 0 . 0039613606 , 0 . 0021703807 , 0 . 030275152 } , { 0 . 044666116 , - 0 . 029756153 , - 0 . 015570779 , 0 . 034470632 } , { - 0 . 0078700362 , 0 . 0037551741 , 0 . 0003070052 , - 0 . 0031237403 } , { 0 . 015288427 , - 0 . 01284757 , - 0 . 0075319169 , 0 . 026981487 } , { - 0 . 0093872483 , 0 . 013517073 , - 0 . 030221944 , 0 . 058356065 } , { 0 . 0042326205 , - 0 . 016381154 , 0 . 021475001 , 0 . 01008732 } , { 0 . 0034929117 , 0 . 020531314 , - 0 . 0085114063 , 0 . 004821913 } , { 0 . 014314413 , 0 . 01127037 , - 0 . 017197896 , 0 . 0046932185 } } } , { { { 0 . 99591552 , 0 . 99230689 , 0 . 99873374 , 0 . 99387895 } , { 0 . 96356049 , 0 . 96556546 , 0 . 96964041 , 0 . 96677566 } , { 0 . 99945097 , 0 . 99930521 , 0 . 99977525 , 0 . 99975808 } , { 0 . 99900933 , 0 . 99996161 , 0 . 99848418 , 0 . 99879675 } , { 0 . 99545951 , 0 . 99993863 , 0 . 99032786 , 0 . 9936502 } , { 0 . 99972964 , 0 . 99989482 , 0 . 99811938 , 0 . 99825798 } , { 0 . 99999867 , 0 . 99999914 , 0 . 9988702 , 0 . 99980681 } , { 0 . 99979292 , 0 . 99581299 , 0 . 99736843 , 0 . 99780458 } , { 0 . 99750292 , 0 . 99805433 , 0 . 99560254 , 0 . 9931383 } , { 0 . 98142286 , 0 . 98133774 , 0 . 99352772 , 0 . 9929441 } , { 0 . 99924096 , 0 . 99973689 , 0 . 99916652 , 0 . 99922617 } , { 0 . 99789446 , 0 . 9974931 , 0 . 99796885 , 0 . 99743448 } , { 0 . 9976331 , 0 . 99501931 , 0 . 9963379 , 0 . 99287411 } , { 0 . 99934104 , 0 . 99967648 , 0 . 99984325 , 0 . 99952138 } , { 0 . 9999147 , 0 . 99999966 , 0 . 99998426 , 0 . 99999714 } , { 0 . 99825531 , 0 . 99794572 , 0 . 99979313 , 0 . 99901579 } , { 0 . 99841509 , 0 . 99894779 , 0 . 99643504 , 0 . 99951192 } , { 0 . 98801309 , 0 . 98864879 , 0 . 99115599 , 0 . 98740957 } , { 0 . 99998698 , 0 . 99998334 , 0 . 9999824 , 0 . 99983621 } , { 0 . 99850879 , 0 . 99868574 , 0 . 99803794 , 0 . 99860752 } , { 0 . 99663402 , 0 . 99573479 , 0 . 99528974 , 0 . 99365325 } , { 0 . 99938825 , 0 . 99973103 , 0 . 99924472 , 0 . 99943364 } , { 0 . 99988413 , 0 . 99993848 , 0 . 99989949 , 0 . 99998434 } , { 0 . 99922338 , 0 . 99887297 , 0 . 998994 , 0 . 9994714 } } , { { - 0 . 0050599833 , 0 . 003362263 , 0 . 0035202243 , - 0 . 00056864904 } , { - 0 . 0014675187 , - 0 . 0029154981 , - 0 . 00077796172 , - 0 . 0027392627 } , { - 0 . 0010916411 , 0 . 00078232803 , 0 . 0014339533 , - 0 . 0020166729 } , { 0 . 011183745 , 0 . 008298699 , 0 . 011631254 , 0 . 00030693508 } , { - 0 . 0012964861 , - 0 . 00028098882 , 0 . 00098513135 , - 0 . 0052243577 } , { 0 . 0091119501 , 0 . 002780703 , 0 . 011045274 , 0 . 00334383 } , { 4 . 1103001e - 05 , 5 . 5767744e - 05 , 0 . 0030605577 , 0 . 0022152241 } , { 0 . 00085375099 , 0 . 0026952672 , 0 . 0071937971 , 0 . 0056504112 } , { - 0 . 003773118 , 0 . 0047936307 , - 4 . 5743022e - 05 , - 0 . 0038357994 } , { 2 . 3815581e - 05 , 0 . 0002468657 , 0 . 00013492048 , - 0 . 00018410816 } , { 0 . 0070959632 , - 0 . 00205589 , 0 . 0056417297 , 0 . 0030702073 } , { 0 . 010671769 , 0 . 0074346008 , 0 . 0012867659 , 0 . 0075437523 } , { - 0 . 0013037272 , - 0 . 0058374269 , 0 . 0025899757 , - 0 . 0071565118 } , { 0 . 0030041304 , 0 . 0018011397 , 0 . 0093160386 , 0 . 0082062863 } , { 0 . 0053156934 , 0 . 0036543193 , 0 . 0048724246 , 0 . 0035118324 } , { - 0 . 0053866158 , 0 . 0024053442 , 0 . 00052459148 , 0 . 0090970513 } , { 0 . 011239324 , - 0 . 0010327051 , - 0 . 00097551594 , 0 . 0044180668 } , { - 0 . 0024379533 , - 0 . 0088232426 , - 0 . 012355568 , - 0 . 0031875953 } , { 0 . 0026244123 , 0 . 0011858999 , 0 . 0028110843 , - 0 . 001005442 } , { 0 . 0059514328 , 0 . 0018892606 , 0 . 0050231625 , 0 . 0046700575 } , { 0 . 00050741664 , 0 . 0096547476 , - 0 . 00079618251 , 0 . 0024532112 } , { 0 . 0058717468 , - 0 . 0017457656 , 0 . 0080261577 , - 0 . 00048009588 } , { 0 . 0025457914 , 0 . 0016788968 , 0 . 0013982313 , 0 . 00073909928 } , { 0 . 0075035778 , 0 . 011234409 , 0 . 0079271096 , 0 . 006672353 } } , { { 0 . 0095152396 , 0 . 0011785006 , - 0 . 00081996856 , 0 . 0018904938 } , { - 0 . 0025430397 , - 0 . 0010236291 , - 0 . 0020168276 , - 0 . 0021827861 } , { 0 . 0036295778 , 0 . 005406882 , 0 . 0040788276 , - 0 . 0057729163 } , { - 0 . 00029952998 , 0 . 0024548208 , 0 . 0088548836 , 0 . 0019084209 } , { 0 . 0034184324 , - 0 . 0088925589 , 0 . 00023040452 , 0 . 00017437939 } , { 0 . 0037804595 , 0 . 012156355 , 0 . 0041276361 , 0 . 012721488 } , { 7 . 4846461e - 05 , 0 . 00010580108 , 0 . 013483417 , 0 . 0024239851 } , { 0 . 00026411032 , - 0 . 00059353627 , 0 . 0093564271 , 0 . 0061507538 } , { 0 . 0016065383 , - 0 . 0027764641 , 0 . 0013620195 , 0 . 0010062065 } , { 9 . 7127925e - 05 , 0 . 00017275393 , 1 . 0814607e - 05 , - 0 . 00022627793 } , { 0 . 0048710612 , - 0 . 00014794569 , 0 . 0082832436 , - 0 . 00072595412 } , { - 0 . 0027392579 , 0 . 0066783951 , 0 . 00087397132 , 0 . 001567366 } , { - 0 . 003378151 , 0 . 0025916338 , - 0 . 0025553201 , 0 . 0030152022 } , { 0 . 0096818399 , 0 . 0012695523 , 0 . 0072489949 , 0 . 016881099 } , { 0 . 0022796191 , 0 . 0051693266 , 0 . 0023373397 , - 0 . 0041448561 } , { - 0 . 0002074582 , 0 . 0035962454 , - 0 . 0007460719 , 0 . 0025086317 } , { 0 . 0035784996 , 0 . 003162753 , 0 . 0022592918 , 0 . 00024595998 } , { - 0 . 0051294944 , - 0 . 0041428868 , - 0 . 0027597 , - 0 . 0039539398 } , { 0 . 0022410392 , 0 . 00031263884 , 0 . 0016376751 , - 0 . 0022787113 } , { 0 . 0025647038 , 0 . 0074733037 , 0 . 0051722028 , 0 . 0024463612 } , { 0 . 0011787227 , 0 . 0071159753 , 0 . 0017217143 , 0 . 0062717989 } , { 0 . 0046836737 , 0 . 0038976423 , 0 . 00062832002 , 0 . 0027638154 } , { 0 . 0014142926 , 0 . 0024903802 , 0 . 0015757227 , 0 . 0011628587 } , { 0 . 0016928585 , 0 . 0043828548 , 0 . 001653268 , 0 . 011450696 } } } , { { { 2 . 8886078 , 2 . 8900127 , 2 . 7925705 , 2 . 7895874 } , { 4 . 5455217 , 4 . 5284714 , 4 . 7042338 , 4 . 6915273 } , { 0 . 96672505 , 0 . 99303664 , 0 . 98927606 , 1 . 0351588 } , { 1 . 2743756 , 1 . 2525364 , 0 . 99649566 , 0 . 94572778 } , { 2 . 6910679 , 2 . 6922168 , 2 . 8503404 , 2 . 8246076 } , { 1 . 256075 , 1 . 2325025 , 1 . 5911826 , 1 . 6091223 } , { 1 . 3601759 , 1 . 3606869 , 1 . 2793533 , 1 . 240925 } , { 2 . 0291828 , 2 . 0506809 , 1 . 7341658 , 1 . 6555689 } , { 2 . 6663531 , 2 . 6921882 , 3 . 1290975 , 3 . 11849 } , { 5 . 3676887 , 5 . 3663279 , 5 . 3848664 , 5 . 3852162 } , { 1 . 0586431 , 1 . 0865889 , 0 . 8196623 , 0 . 8076665 } , { 1 . 6967251 , 1 . 7305944 , 1 . 5450413 , 1 . 6347879 } , { 3 . 0908857 , 3 . 0706775 , 3 . 2974343 , 3 . 3053965 } , { 1 . 2172073 , 1 . 3839086 , 1 . 5086796 , 1 . 4295506 } , { 0 . 97676668 , 1 . 0856738 , 0 . 98747912 , 1 . 0385491 } , { 1 . 5662275 , 1 . 4603538 , 1 . 784278 , 1 . 6575438 } , { 2 . 1085757 , 2 . 2092885 , 2 . 1410448 , 2 . 1518347 } , { 4 . 0214776 , 4 . 006424 , 3 . 7686967 , 3 . 7771354 } , { 1 . 2089239 , 1 . 2116036 , 1 . 1244311 , 1 . 0901017 } , { 1 . 1827246 , 1 . 1472796 , 1 . 7516784 , 1 . 7833976 } , { 2 . 2113439 , 2 . 197512 , 2 . 2692963 , 2 . 2787751 } , { 0 . 98819531 , 1 . 057833 , 1 . 3587301 , 1 . 3890421 } , { 1 . 208957 , 1 . 2247867 , 1 . 2301205 , 1 . 2325178 } , { 1 . 0499613 , 1 . 1319197 , 1 . 4067885 , 1 . 3209087 } } , { { - 0 . 002860931 , - 0 . 0033581281 , - 0 . 0047612075 , - 0 . 0030481839 } , { - 0 . 0017370907 , - 0 . 0065700936 , - 0 . 0011051926 , - 0 . 0046915938 } , { - 0 . 0006126207 , 0 . 0010791181 , - 0 . 022876686 , - 0 . 015937275 } , { - 0 . 010040922 , - 0 . 016433531 , - 0 . 0044976975 , - 0 . 029838315 } , { 0 . 00056888968 , - 0 . 0093450028 , - 0 . 00041549218 , - 0 . 0069079656 } , { - 0 . 029781683 , - 0 . 019722587 , 0 . 019472312 , 0 . 0016798037 } , { - 0 . 0015128736 , - 0 . 0012250172 , - 0 . 0091568262 , - 0 . 0091368119 } , { 0 . 0010846814 , 0 . 0017189068 , 0 . 012975603 , - 0 . 0051530971 } , { - 0 . 026042808 , - 0 . 0090684857 , - 0 . 0021498742 , - 0 . 0032938309 } , { - 0 . 0012792901 , - 0 . 0010431731 , - 0 . 0021366737 , - 0 . 0025526365 } , { - 0 . 03218779 , - 0 . 013848893 , - 0 . 021872476 , - 0 . 029443623 } , { 0 . 008300061 , 0 . 011951182 , - 0 . 011139414 , 0 . 0098292843 } , { - 0 . 0065854884 , - 0 . 020955083 , - 9 . 3843515e - 05 , - 0 . 0078425688 } , { - 0 . 054726229 , - 0 . 0073673428 , - 0 . 019267231 , - 0 . 03383648 } , { - 0 . 049769726 , 0 . 0065482059 , - 0 . 010189395 , - 0 . 0050480393 } , { 0 . 022565943 , - 0 . 020311569 , 0 . 0091512717 , - 0 . 015600752 } , { - 0 . 014418429 , 0 . 0060070592 , - 0 . 0055296743 , - 0 . 003361885 } , { 8 . 8146509e - 05 , - 0 . 0082609252 , 0 . 0036746024 , 0 . 0040108321 } , { 0 . 0010230427 , 4 . 8153189e - 06 , 0 . 0052893378 , - 0 . 0096303521 } , { 0 . 0032909351 , - 0 . 010982824 , 0 . 003880027 , 0 . 0097699095 } , { - 0 . 006528317 , - 0 . 012608887 , - 0 . 0057088008 , - 0 . 003867806 } , { - 0 . 046599771 , - 0 . 024701737 , - 0 . 001078321 , - 0 . 0041018649 } , { - 0 . 021680777 , - 0 . 021120711 , 0 . 0055144734 , - 0 . 0031337995 } , { - 0 . 030559213 , 0 . 0089872726 , - 0 . 011166202 , - 0 . 0077587071 } } , { { - 0 . 0059548858 , - 0 . 0040070313 , - 0 . 0062572119 , - 0 . 0047711065 } , { - 0 . 0031938803 , - 0 . 005431389 , - 0 . 0026376521 , - 0 . 0046119366 } , { 0 . 0064917253 , 0 . 013030824 , - 0 . 027850471 , - 0 . 011824849 } , { - 0 . 032644485 , - 0 . 025045016 , - 0 . 0034396539 , - 0 . 039827623 } , { - 0 . 007691681 , - 0 . 014095643 , - 0 . 0008171964 , - 0 . 0051336386 } , { - 0 . 035626586 , - 0 . 021424668 , 0 . 00035790929 , 0 . 0099705685 } , { - 0 . 0019006762 , - 0 . 0014887089 , - 0 . 0050782898 , - 0 . 0096835564 } , { - 0 . 00087496879 , 0 . 0052586834 , 0 . 017041675 , - 0 . 00046753956 } , { - 0 . 022489507 , - 0 . 0084834888 , 0 . 0017184219 , - 0 . 0023910992 } , { - 0 . 0010618265 , - 0 . 00085888729 , - 0 . 0020035777 , - 0 . 0024245283 } , { - 0 . 029245834 , - 0 . 038977066 , - 0 . 013385246 , - 0 . 030312138 } , { - 0 . 0028497869 , 0 . 014205986 , - 0 . 0125692 , 0 . 0037959624 } , { - 0 . 0086377959 , - 0 . 019175965 , - 0 . 007684309 , - 0 . 005037677 } , { - 0 . 063945685 , - 0 . 0060751259 , - 0 . 0057457302 , - 0 . 019079575 } , { - 0 . 043745147 , 0 . 013651906 , - 0 . 034067394 , 0 . 0012111497 } , { 0 . 0086647574 , - 0 . 019171418 , 0 . 020745219 , - 0 . 0055629951 } , { - 0 . 024541273 , 0 . 0072112135 , - 0 . 0078821942 , - 0 . 0085072621 } , { - 0 . 0018227939 , - 0 . 0021153099 , 0 . 008577002 , 0 . 0043865151 } , { - 0 . 013984752 , - 0 . 012209334 , 0 . 00023638151 , - 0 . 0085025952 } , { - 0 . 0099800075 , - 0 . 0095390578 , 0 . 0081328135 , 0 . 012673433 } , { - 0 . 0099975551 , - 0 . 0028467616 , - 0 . 010712056 , - 0 . 0045012212 } , { - 0 . 011329139 , - 0 . 0084709831 , - 0 . 0070232966 , 0 . 0015504012 } , { - 0 . 015334801 , - 0 . 0075637633 , - 0 . 01107439 , - 0 . 0094188163 } , { - 0 . 017505269 , - 0 . 00013701888 , - 0 . 033955823 , - 0 . 034192649 } } } , { { { 0 . 16413327 , 0 . 084074422 , 0 . 10646123 , 0 . 18806073 } , { 0 . 039511019 , 0 . 058967072 , 0 . 035166958 , 0 . 052296507 } , { 0 . 26970995 , 0 . 21576211 , 0 . 2954278 , 0 . 29870678 } , { 0 . 40442043 , 0 . 38744132 , 0 . 14502571 , 0 . 24076804 } , { 0 . 22655046 , 0 . 20912486 , 0 . 015295019 , 0 . 16442957 } , { 0 . 69235319 , 0 . 6080183 , 0 . 36756076 , 0 . 23314717 } , { 0 . 085565328 , 0 . 075535626 , 0 . 22162979 , 0 . 33140596 } , { 0 . 16109547 , 0 . 11961895 , 0 . 26619212 , 0 . 25941009 } , { 0 . 27077686 , 0 . 23481238 , 0 . 063446408 , 0 . 11614487 } , { 0 . 026116057 , 0 . 027491327 , 0 . 030421883 , 0 . 039965345 } , { 0 . 33922592 , 0 . 38039792 , 0 . 27167385 , 0 . 31510976 } , { 0 . 32744968 , 0 . 22567102 , 0 . 23116584 , 0 . 18867836 } , { 0 . 29783431 , 0 . 28054079 , 0 . 26752139 , 0 . 23889932 } , { 0 . 61721263 , 0 . 60602797 , 0 . 51283622 , 0 . 47601102 } , { 0 . 51383952 , 0 . 53111455 , 0 . 44519064 , 0 . 42875877 } , { 0 . 3485879 , 0 . 35374178 , 0 . 53292055 , 0 . 53995494 } , { 0 . 4366997 , 0 . 35554257 , 0 . 14878367 , 0 . 22083288 } , { 0 . 12855375 , 0 . 16718264 , 0 . 17583661 , 0 . 11125895 } , { 0 . 35898096 , 0 . 37222307 , 0 . 35439108 , 0 . 35956111 } , { 0 . 16773044 , 0 . 25668894 , 0 . 23246756 , 0 . 1506316 } , { 0 . 36172813 , 0 . 26938211 , 0 . 20069185 , 0 . 1714591 } , { 0 . 3998571 , 0 . 23607244 , 0 . 34121623 , 0 . 29126696 } , { 0 . 31471307 , 0 . 29500525 , 0 . 39451396 , 0 . 40013999 } , { 0 . 29554399 , 0 . 28083636 , 0 . 47190649 , 0 . 47892938 } } , { { 0 . 01419653 , - 0 . 061214452 , - 0 . 032506906 , 0 . 0078227125 } , { - 0 . 015799432 , 0 . 0136148 , - 0 . 0090824684 , 0 . 013638505 } , { 0 . 023848919 , 0 . 022034707 , 0 . 022812846 , 0 . 022790329 } , { - 0 . 0026324255 , - 0 . 0053566952 , 0 . 00027470228 , 0 . 050203583 } , { 0 . 0035659857 , - 0 . 02015272 , - 0 . 039043616 , 0 . 054511651 } , { 0 . 0052075445 , 0 . 0051043119 , - 0 . 011801097 , - 0 . 0074336577 } , { 0 . 020735195 , 0 . 01811747 , 0 . 00808952 , 0 . 01140964 } , { - 0 . 0073139049 , 0 . 011075347 , 0 . 0057685988 , 0 . 010251582 } , { 0 . 024813488 , - 0 . 01629986 , - 0 . 012536791 , - 0 . 01110061 } , { - 0 . 014508648 , - 0 . 021444084 , - 0 . 023836972 , - 0 . 014258253 } , { 0 . 0079687141 , - 0 . 00092011446 , 0 . 060249601 , 0 . 033199468 } , { - 0 . 020822483 , - 0 . 013924875 , - 0 . 005068391 , - 0 . 016928794 } , { - 0 . 030059 , - 0 . 013887475 , - 0 . 045329289 , - 0 . 04449219 } , { 0 . 007264541 , 0 . 0015213919 , - 0 . 0066322618 , - 0 . 0036449174 } , { 0 . 0057175046 , 0 . 0012159867 , - 0 . 00054271896 , 0 . 0020625484 } , { 0 . 0027083179 , - 0 . 0012554897 , - 0 . 0044854592 , - 0 . 0045242423 } , { - 0 . 017906563 , - 0 . 028301884 , - 0 . 010139427 , 0 . 0035851304 } , { - 0 . 020245794 , 0 . 01149232 , 0 . 011320484 , - 0 . 013561794 } , { 0 . 0068048997 , 0 . 011957759 , 0 . 0046962412 , - 0 . 0015476541 } , { - 0 . 0022514613 , 0 . 019996868 , 0 . 0051520398 , - 0 . 023405604 } , { 0 . 0055213198 , 0 . 0070384134 , 0 . 024405643 , - 0 . 02050399 } , { 0 . 039987541 , 0 . 021127504 , - 0 . 012323503 , - 0 . 0041538161 } , { 0 . 0072321478 , 0 . 0053097351 , 0 . 0039966161 , 0 . 013617175 } , { 0 . 030470642 , 0 . 0044694115 , - 0 . 0024591651 , - 0 . 0027274707 } } , { { - 0 . 040500402 , - 0 . 039657034 , - 0 . 017497359 , - 0 . 017857145 } , { - 0 . 0015646885 , - 0 . 020957371 , - 0 . 0057356498 , - 0 . 0060587007 } , { 0 . 0070388709 , - 0 . 013205178 , - 0 . 00033412934 , 0 . 02192306 } , { - 0 . 0042317723 , 0 . 020620857 , - 0 . 012309167 , 0 . 065948811 } , { - 0 . 016686589 , 0 . 013616667 , 0 . 030139062 , - 0 . 019023551 } , { 0 . 015181564 , 0 . 008673659 , - 0 . 0014559576 , - 0 . 025916054 } , { 0 . 031630671 , 0 . 027030197 , - 0 . 026982415 , 0 . 025214731 } , { - 0 . 003845127 , - 0 . 00062884599 , - 0 . 029488655 , - 0 . 0051457939 } , { - 0 . 0032476351 , 0 . 0021153707 , - 0 . 033110808 , - 0 . 033629213 } , { - 0 . 0064637077 , - 0 . 010805748 , - 0 . 014982403 , - 0 . 0084641529 } , { 0 . 0087766042 , 0 . 017780238 , 0 . 026838871 , 0 . 032580257 } , { 0 . 0010700985 , - 0 . 037414784 , - 0 . 0053773565 , 0 . 0040969752 } , { - 0 . 02637392 , - 0 . 050236074 , - 0 . 048422986 , - 0 . 069357813 } , { - 0 . 0089483588 , 0 . 0026259727 , 0 . 0040142797 , - 0 . 010752754 } , { - 0 . 0025658872 , 0 . 0071106029 , 0 . 015467367 , 0 . 0012536589 } , { - 0 . 0037247444 , - 0 . 0036991733 , - 0 . 015429566 , - 0 . 016148852 } , { - 0 . 024788221 , - 0 . 045938054 , - 0 . 028679471 , 0 . 011593494 } , { - 0 . 032699114 , - 0 . 036800967 , - 0 . 033870575 , - 0 . 031842203 } , { 0 . 018156047 , 0 . 02457546 , 0 . 0209432 , 0 . 015057433 } , { 0 . 0043152638 , 0 . 025831372 , - 0 . 019608349 , - 0 . 026614397 } , { - 0 . 0057047815 , - 0 . 013831909 , 0 . 027613211 , - 0 . 043616864 } , { 0 . 014124478 , - 0 . 010786326 , 0 . 010775415 , - 0 . 023241344 } , { 0 . 018337827 , 0 . 0048735321 , 0 . 018371717 , 0 . 022106807 } , { 0 . 013619207 , 0 . 022051384 , 0 . 0082720974 , - 0 . 0030262071 } } } } , { { { { 0 . 083322661 , 0 . 079807165 , 0 . 03660117 , - 0 . 051657142 } , { - 0 . 099216074 , - 0 . 0080141573 , 0 . 10637241 , 0 . 0367403 } , { 0 . 20813681 , - 0 . 0001361621 , - 0 . 20762563 , - 0 . 085913357 } , { - 0 . 22091149 , 0 . 10003156 , - 0 . 16122219 , 0 . 31542901 } , { 0 . 16226908 , 0 . 02665194 , - 0 . 012123307 , - 0 . 16559939 } , { - 0 . 14025496 , 0 . 025804505 , 0 . 076174345 , 0 . 20548591 } , { 0 . 0035713609 , - 0 . 0092551928 , - 0 . 099937652 , 0 . 0038879391 } , { 0 . 12405732 , - 0 . 0053373497 , - 0 . 030865175 , - 0 . 060934551 } , { - 0 . 0060175826 , - 0 . 026583926 , - 0 . 075326797 , - 0 . 0063155886 } , { 0 . 036389362 , 0 . 054175433 , 0 . 06490927 , - 0 . 038784258 } , { 0 . 30604876 , - 0 . 030813476 , 0 . 011402956 , - 0 . 21074796 } , { - 0 . 31769497 , 0 . 046793931 , - 0 . 038212559 , 0 . 21137297 } , { 0 . 12952945 , 0 . 20720126 , 0 . 08525845 , - 0 . 14568109 } , { - 0 . 09735197 , - 0 . 17799099 , - 0 . 12256082 , 0 . 038889119 } , { 0 . 002114572 , 0 . 026037779 , - 0 . 0036772795 , 0 . 13478173 } , { 0 . 094577863 , 0 . 0057382415 , - 0 . 087017736 , - 0 . 059444148 } , { 0 . 054953104 , 0 . 071323301 , 0 . 097417831 , 8 . 3254475e - 05 } , { - 0 . 11005534 , 0 . 027214076 , 0 . 0059378205 , 0 . 02443999 } , { 0 . 27096654 , 0 . 1864966 , 0 . 034810947 , - 0 . 25886676 } , { - 0 . 35626794 , 0 . 037256657 , - 0 . 17795321 , 0 . 52988269 } , { 0 . 14913899 , - 0 . 0086988732 , - 0 . 028760192 , - 0 . 21779266 } , { - 0 . 16010301 , - 0 . 17699785 , 0 . 017269826 , 0 . 17878541 } , { - 0 . 0049504093 , - 0 . 02387924 , - 0 . 04034852 , - 0 . 060461173 } , { 0 . 10405347 , 0 . 0072745723 , - 0 . 10244372 , - 0 . 072981984 } } , { { 0 . 019363393 , 5 . 327311e - 05 , 0 . 0075925373 , 0 . 0019542034 } , { - 0 . 051707557 , 0 . 06554253 , 0 . 0050626046 , - 0 . 0061857803 } , { 0 . 022891698 , 0 . 014872273 , - 0 . 020436928 , 0 . 0069081531 } , { - 0 . 044566611 , 0 . 019854557 , 0 . 023600607 , - 0 . 0055387351 } , { 0 . 02283957 , - 0 . 067086756 , 0 . 088865856 , - 0 . 033915007 } , { 0 . 0020254431 , - 0 . 16422426 , 0 . 032495902 , 0 . 012460808 } , { - 0 . 017316175 , 0 . 023440087 , 0 . 011459595 , 0 . 0043887872 } , { 0 . 027714908 , - 0 . 06907548 , 0 . 013578806 , - 0 . 009848884 } , { 0 . 0044782488 , 0 . 0079432606 , 0 . 010143137 , 0 . 023589488 } , { 0 . 014325082 , 0 . 0075465848 , - 0 . 0079373813 , - 0 . 0056032635 } , { 0 . 025123579 , 0 . 01904807 , - 0 . 0092328848 , - 0 . 019002052 } , { - 0 . 02633985 , - 0 . 019560519 , - 0 . 065544737 , 0 . 0073352606 } , { 0 . 044308433 , - 0 . 0032233834 , 0 . 01324206 , - 0 . 00047128106 } , { - 0 . 076577611 , - 0 . 021853603 , - 0 . 020190543 , 0 . 0026420865 } , { - 0 . 0029799448 , - 0 . 0083566545 , 0 . 14896601 , 0 . 0078617095 } , { 0 . 021033237 , - 0 . 08234711 , - 0 . 020642328 , - 0 . 0089829962 } , { 0 . 043793881 , 0 . 0096494147 , 0 . 035831274 , - 0 . 01294602 } , { - 0 . 014064874 , 0 . 066144489 , 0 . 0143429 , 0 . 015113964 } , { 0 . 043111732 , 0 . 0029232804 , - 0 . 016912145 , 0 . 012142059 } , { 0 . 0014186333 , - 0 . 0078590166 , 0 . 065781153 , - 0 . 038375123 } , { 0 . 02255714 , - 0 . 030191796 , - 0 . 078373164 , - 0 . 0017593196 } , { - 0 . 033878798 , 0 . 016266579 , 0 . 013539653 , 0 . 043519216 } , { 0 . 019046482 , 0 . 0080403173 , - 0 . 0010755939 , 0 . 03305222 } , { 0 . 023206448 , - 0 . 054323067 , - 0 . 035173093 , - 0 . 010873592 } } , { { 0 . 014068291 , - 0 . 026418786 , 0 . 016375695 , 0 . 0048801469 } , { 0 . 024404214 , 0 . 0073572002 , - 0 . 027247654 , 0 . 00093849398 } , { 0 . 012741523 , - 0 . 012913063 , 0 . 0054881373 , - 0 . 021780769 } , { - 0 . 020497215 , 0 . 057437717 , 0 . 0031122704 , 0 . 014713732 } , { 0 . 012765254 , - 0 . 052846334 , 0 . 048042201 , 0 . 0016578534 } , { 0 . 031245254 , - 0 . 0469321 , - 0 . 057199738 , 0 . 012436479 } , { - 0 . 0022837759 , 0 . 0068501747 , 0 . 010541107 , - 0 . 0005227683 } , { - 0 . 0187059 , 0 . 0025631581 , - 0 . 0082184266 , 0 . 0026294483 } , { 0 . 0053899388 , - 0 . 0199458 , 0 . 0023448066 , 0 . 016215236 } , { 0 . 021117204 , 0 . 010868775 , - 0 . 016412681 , - 0 . 016399297 } , { - 0 . 0026199223 , - 0 . 011436548 , 0 . 0031355049 , 0 . 011933919 } , { 0 . 017940023 , 0 . 090292392 , - 0 . 061029038 , 0 . 016388845 } , { 0 . 0074493061 , - 0 . 045849358 , - 0 . 082612855 , 0 . 025851315 } , { 0 . 061276666 , - 0 . 024654813 , 0 . 035447334 , - 0 . 025952766 } , { - 0 . 0068267167 , - 0 . 02207426 , 0 . 003724368 , 0 . 0070458116 } , { 0 . 021714649 , - 0 . 017552721 , - 0 . 037105408 , 0 . 024398534 } , { 0 . 0092901891 , - 0 . 021559075 , 0 . 009034776 , - 0 . 016574279 } , { - 0 . 017218595 , - 0 . 041930302 , 0 . 003369899 , 0 . 017959363 } , { - 0 . 0022510875 , 0 . 028106616 , - 0 . 042936548 , - 0 . 041948028 } , { - 0 . 017145551 , - 0 . 032331654 , 0 . 021486923 , - 0 . 020295391 } , { - 0 . 023196465 , - 0 . 088353584 , 0 . 010086154 , 0 . 018689553 } , { - 0 . 024508386 , - 0 . 00058959302 , - 0 . 02867958 , 0 . 019018994 } , { 0 . 0088748911 , 0 . 012528454 , - 0 . 016636351 , 0 . 0078166115 } , { 0 . 00066772723 , 0 . 001693912 , 0 . 032066885 , 0 . 016951148 } } } , { { { 0 . 015200105 , 0 . 071414961 , - 0 . 020616434 , 0 . 0063982643 } , { - 0 . 084578144 , - 0 . 12318522 , - 0 . 035470756 , 0 . 057833574 } , { 0 . 19487946 , 0 . 44043059 , 0 . 10981527 , - 0 . 31907303 } , { - 0 . 17774238 , - 0 . 30460726 , - 0 . 53133003 , 0 . 31186606 } , { - 0 . 1172677 , 0 . 3183613 , 0 . 10375266 , - 0 . 066515168 } , { 0 . 054176263 , - 0 . 12382077 , - 0 . 033807438 , 0 . 039809238 } , { - 5 . 3634009e - 05 , 0 . 004084452 , 0 . 005103199 , - 0 . 060697866 } , { 0 . 06093199 , 0 . 060355274 , 0 . 049176467 , - 0 . 060579228 } , { 0 . 054611799 , 9 . 0520863e - 05 , - 0 . 048891261 , - 0 . 047609349 } , { - 0 . 036428706 , 0 . 06336736 , 0 . 0020843807 , 0 . 033254378 } , { 0 . 26975732 , 0 . 51328693 , 0 . 29976157 , 0 . 049031141 } , { - 0 . 28383516 , - 0 . 48219276 , - 0 . 27898799 , - 0 . 033028759 } , { - 0 . 078976834 , 0 . 14077934 , 0 . 098587186 , 0 . 051336328 } , { 0 . 076281206 , - 0 . 074223398 , - 0 . 053178835 , - 0 . 099578331 } , { - 0 . 056377095 , - 0 . 00066113896 , - 0 . 11597726 , 0 . 058805777 } , { - 0 . 0027130032 , 0 . 12007881 , 0 . 0081935835 , - 0 . 10415807 } , { - 0 . 019349408 , 0 . 06206561 , - 0 . 0079099126 , 0 . 079363093 } , { - 0 . 059959607 , - 0 . 0591041 , - 0 . 047505451 , - 0 . 0031496967 } , { - 0 . 11419194 , 0 . 20904287 , 0 . 53960104 , 0 . 10467592 } , { - 0 . 21312862 , - 0 . 34770872 , - 0 . 54593093 , 0 . 23230512 } , { - 0 . 073229448 , 0 . 12913 , 0 . 27728133 , - 0 . 050627706 } , { 0 . 082312471 , - 0 . 24529296 , - 0 . 12381516 , 0 . 05577292 } , { 0 . 03015389 , - 0 . 0015805638 , 0 . 024306632 , - 0 . 080697961 } , { 0 . 061367564 , 0 . 056058289 , 0 . 041197211 , - 0 . 015551356 } } , { { - 0 . 029269776 , - 0 . 030251548 , 0 . 01352869 , 0 . 0084860712 } , { 0 . 053983187 , 0 . 047657625 , - 0 . 026379004 , 0 . 022474039 } , { 0 . 011898439 , 0 . 045120742 , - 0 . 024430477 , - 0 . 081318878 } , { - 0 . 0012641508 , - 0 . 018495044 , - 0 . 030127865 , - 0 . 0088483264 } , { 0 . 040728292 , 0 . 010691761 , - 0 . 023566342 , 0 . 028045232 } , { 0 . 014593998 , 0 . 0047006468 , - 0 . 049032498 , - 0 . 011446808 } , { 0 . 00045433705 , - 0 . 0030610749 , - 0 . 010359449 , - 0 . 0026455857 } , { - 0 . 0026794352 , - 0 . 032142744 , 0 . 010153936 , - 0 . 0034586152 } , { 0 . 0097198782 , 0 . 0051005644 , 0 . 03482872 , - 0 . 0043676475 } , { - 0 . 0012381415 , - 0 . 025746274 , - 0 . 0081178021 , 0 . 0041481596 } , { - 0 . 01598781 , 0 . 0048815642 , 0 . 06313106 , - 0 . 0062291669 } , { 0 . 072970618 , - 0 . 041153529 , - 0 . 007457013 , 0 . 059776924 } , { 0 . 0024768493 , 0 . 0093018711 , 0 . 024827984 , 0 . 043842172 } , { - 0 . 012927661 , - 0 . 023256709 , - 0 . 0035951539 , - 0 . 069710027 } , { 0 . 0064149713 , 0 . 0019783425 , 0 . 010135188 , 0 . 019449636 } , { - 0 . 0071551675 , 0 . 015761815 , 0 . 0086309278 , 0 . 038854386 } , { 0 . 020978109 , - 0 . 0056696814 , 0 . 0025526797 , - 0 . 017352926 } , { - 0 . 010711116 , - 0 . 0097050903 , 0 . 0022304504 , - 0 . 0039308489 } , { 0 . 036904234 , 0 . 025927127 , 0 . 028330671 , 0 . 051193417 } , { - 0 . 00076391153 , - 0 . 077528792 , - 0 . 029763477 , 0 . 0033945843 } , { - 0 . 01775202 , 0 . 034507636 , 0 . 065392848 , - 0 . 017840909 } , { - 0 . 019567742 , - 0 . 019880035 , 0 . 055214211 , - 0 . 02206159 } , { 0 . 01110111 , 0 . 0022938832 , - 0 . 011417507 , 0 . 017692635 } , { 0 . 050208493 , - 0 . 028178909 , 0 . 0065276591 , - 0 . 0056267473 } } , { { 0 . 0065622702 , - 0 . 0012303136 , - 0 . 0081183663 , 0 . 00079383048 } , { 0 . 030775912 , 0 . 052260356 , - 0 . 019758331 , - 0 . 020044147 } , { 0 . 019016537 , - 0 . 043070451 , 0 . 035298744 , - 0 . 040592775 } , { 0 . 010468089 , 0 . 00057085185 , 0 . 0081761984 , 0 . 0033382478 } , { 0 . 047189462 , - 0 . 052695409 , 0 . 021849623 , 0 . 033585939 } , { 0 . 0012065616 , - 0 . 050287476 , - 0 . 065085924 , - 0 . 039012886 } , { - 0 . 012294892 , 0 . 006839242 , 0 . 0051165438 , - 2 . 0711078e - 05 } , { - 0 . 03292822 , 0 . 015299577 , 0 . 0029119931 , 0 . 0073040242 } , { - 0 . 0086784873 , 0 . 0085910164 , - 0 . 0059378411 , - 0 . 010259049 } , { - 0 . 014191355 , - 0 . 011172486 , - 0 . 01299927 , 0 . 015386671 } , { 0 . 040453224 , - 0 . 041489173 , 0 . 015047889 , 0 . 064340197 } , { - 0 . 020000046 , 0 . 058477092 , - 0 . 0018150465 , 0 . 048536972 } , { - 0 . 006105982 , 0 . 03437044 , 0 . 0087640339 , 0 . 032868283 } , { - 0 . 027120362 , 0 . 016579996 , - 0 . 01708524 , 0 . 011178424 } , { 0 . 030535528 , 0 . 0058718219 , - 0 . 031240404 , 0 . 024241052 } , { 0 . 003729958 , - 0 . 055735848 , - 0 . 0055392842 , 0 . 03447519 } , { - 0 . 04084502 , - 0 . 01227488 , 0 . 0062970198 , - 0 . 021996031 } , { 0 . 053671675 , - 0 . 067787009 , 0 . 0053426012 , - 0 . 0080796738 } , { - 0 . 021911856 , 0 . 038395527 , - 0 . 07713235 , 0 . 024805484 } , { - 0 . 0034319194 , 0 . 0052741327 , 0 . 026402991 , 0 . 0012916612 } , { - 0 . 033119652 , - 0 . 0046506889 , 0 . 045613946 , - 0 . 050230593 } , { - 0 . 0054612035 , - 0 . 033482221 , 0 . 084267507 , - 0 . 0224334 } , { - 0 . 0063348693 , - 0 . 0074524817 , - 0 . 0029629355 , 0 . 035493958 } , { - 0 . 0073519185 , 0 . 045139911 , 0 . 0022901735 , - 0 . 041385515 } } } , { { { 0 . 99640669 , 0 . 99424882 , 0 . 99911727 , 0 . 99864438 } , { 0 . 99146493 , 0 . 99235134 , 0 . 99369348 , 0 . 99764995 } , { 0 . 95848895 , 0 . 89778665 , 0 . 9720248 , 0 . 943828 } , { 0 . 95896077 , 0 . 9472107 , 0 . 83168251 , 0 . 89623886 } , { 0 . 97975356 , 0 . 94759472 , 0 . 99452924 , 0 . 98394744 } , { 0 . 98863213 , 0 . 99196902 , 0 . 99652121 , 0 . 97785007 } , { 0 . 99999362 , 0 . 99994883 , 0 . 99498061 , 0 . 99814861 } , { 0 . 99040248 , 0 . 99816269 , 0 . 99831309 , 0 . 99630173 } , { 0 . 99848953 , 0 . 99964658 , 0 . 9959596 , 0 . 99884607 } , { 0 . 9986735 , 0 . 99651874 , 0 . 99788899 , 0 . 99869411 } , { 0 . 91299789 , 0 . 85766372 , 0 . 953946 , 0 . 97631002 } , { 0 . 90471405 , 0 . 87481454 , 0 . 959534 , 0 . 97684726 } , { 0 . 9884254 , 0 . 96811612 , 0 . 9914694 , 0 . 98799879 } , { 0 . 99232241 , 0 . 98122887 , 0 . 99103524 , 0 . 99426948 } , { 0 . 99840731 , 0 . 99966074 , 0 . 99324506 , 0 . 98912879 } , { 0 . 99551377 , 0 . 99274778 , 0 . 99617307 , 0 . 9927827 } , { 0 . 99830144 , 0 . 99552039 , 0 . 99521214 , 0 . 99684577 } , { 0 . 99211525 , 0 . 9978808 , 0 . 99885333 , 0 . 99969634 } , { 0 . 95579147 , 0 . 95995838 , 0 . 84120087 , 0 . 96022443 } , { 0 . 90975235 , 0 . 9368621 , 0 . 81871367 , 0 . 8156339 } , { 0 . 98610091 , 0 . 99158952 , 0 . 96035822 , 0 . 97468107 } , { 0 . 98366238 , 0 . 9531543 , 0 . 99215501 , 0 . 98230604 } , { 0 . 99953301 , 0 . 9997136 , 0 . 99888998 , 0 . 99490315 } , { 0 . 99267663 , 0 . 998401 , 0 . 99388534 , 0 . 99721201 } } , { { - 0 . 0021537732 , 0 . 010607958 , - 0 . 0066166595 , - 0 . 0027390442 } , { - 0 . 0069401807 , 0 . 0053215201 , 0 . 0062121114 , 0 . 013403291 } , { - 0 . 0035740125 , - 0 . 021839368 , 0 . 00042431197 , - 0 . 029478899 } , { - 0 . 007886159 , - 0 . 0087705321 , - 0 . 010570968 , 0 . 0040635318 } , { - 0 . 0021772698 , 0 . 00025306776 , - 0 . 0092725896 , - 0 . 0075657706 } , { - 0 . 010438319 , - 0 . 0072866821 , 0 . 009272756 , 0 . 0043932916 } , { - 0 . 00058203184 , 0 . 0081284104 , 0 . 027749999 , 0 . 0035426599 } , { - 0 . 003604276 , - 0 . 012244348 , 0 . 0072177908 , 0 . 0026686264 } , { 0 . 011192179 , 0 . 0069527119 , 0 . 017278396 , - 0 . 0053058312 } , { - 0 . 020276487 , - 0 . 0063228657 , 0 . 013968347 , - 0 . 0021534789 } , { - 0 . 0037534313 , 0 . 00061399133 , - 0 . 02126817 , 0 . 0085256452 } , { 0 . 015620795 , - 0 . 022637876 , 0 . 00069280338 , 0 . 0054369037 } , { 0 . 0095244184 , - 0 . 0026896982 , - 0 . 0057963534 , 0 . 0067237437 } , { - 0 . 0085689961 , - 0 . 004816024 , - 0 . 00088793436 , - 0 . 0034021999 } , { 0 . 015428153 , 0 . 019777562 , - 0 . 011217833 , 0 . 0095744159 } , { - 0 . 003802304 , 0 . 0022643577 , 0 . 0054254827 , 0 . 025560756 } , { - 0 . 0053298651 , 0 . 021621993 , - 0 . 01864184 , 0 . 019120967 } , { 0 . 015380344 , - 0 . 0027384467 , 0 . 0010235928 , 0 . 0062792725 } , { - 0 . 001166873 , - 0 . 0049586656 , - 0 . 014850883 , 0 . 00057841904 } , { 0 . 0032865456 , - 0 . 033386196 , 0 . 0032068954 , 0 . 02854738 } , { 0 . 010308266 , - 0 . 000233004 , - 0 . 020287643 , 0 . 0044441043 } , { - 0 . 0040523345 , 0 . 0050367711 , 0 . 01627907 , - 0 . 010032412 } , { 0 . 0073463987 , 0 . 00073274858 , 0 . 002814661 , 0 . 030221018 } , { 0 . 0057509063 , - 0 . 011441338 , 0 . 01894259 , 0 . 0077856453 } } , { { - 0 . 0053054924 , 0 . 0037677068 , 0 . 0066263851 , 0 . 0011220287 } , { - 0 . 02212139 , 0 . 013769097 , - 0 . 0013834097 , 0 . 014152363 } , { - 0 . 0008493126 , 0 . 021473024 , - 0 . 0039313241 , - 0 . 017764981 } , { - 0 . 00081897848 , - 0 . 0074161164 , 0 . 0038179092 , - 0 . 0035760615 } , { 0 . 014045643 , 0 . 015317904 , 0 . 0045966739 , 0 . 0075917156 } , { 0 . 0035574126 , - 0 . 00017773424 , - 0 . 0010937491 , - 0 . 0017762282 } , { 0 . 0072018344 , 0 . 012586227 , 0 . 0138702 , - 0 . 0085424173 } , { - 0 . 0055783456 , - 0 . 019909385 , 0 . 01190919 , - 0 . 0065821489 } , { 1 . 7402026e - 05 , 0 . 0094513341 , 0 . 015333305 , - 0 . 0072158969 } , { - 0 . 0063049905 , 0 . 0021776758 , 0 . 014376378 , 0 . 0072426401 } , { - 0 . 0078049673 , 0 . 028764242 , - 0 . 0024169449 , 0 . 0077604105 } , { 0 . 00047536469 , 0 . 029806623 , 0 . 0017798261 , 0 . 00087410198 } , { - 0 . 0030498401 , 0 . 0044874501 , 0 . 0020382571 , - 0 . 0011101062 } , { - 0 . 0057084397 , - 0 . 0013428994 , - 0 . 001024136 , 0 . 0066188614 } , { 0 . 039201052 , 0 . 015120258 , - 0 . 0082642793 , 0 . 0051985023 } , { - 0 . 0091203243 , 0 . 020790215 , 0 . 0025270937 , 0 . 020092044 } , { - 0 . 0029830063 , 0 . 006602841 , - 0 . 00833601 , 0 . 044852353 } , { 0 . 025206353 , - 0 . 0038915173 , 0 . 00045914851 , 0 . 0037840538 } , { 0 . 0014814254 , - 0 . 011573911 , 0 . 046232337 , - 0 . 015228958 } , { - 0 . 0071984443 , 0 . 0090004063 , 0 . 022942838 , 0 . 016019787 } , { 0 . 0050929336 , 0 . 0060892107 , - 0 . 0061771339 , 0 . 0047850766 } , { - 0 . 011634853 , 0 . 0010276548 , 0 . 022396644 , - 0 . 0021248711 } , { - 0 . 012943002 , 0 . 0016430074 , 0 . 02034928 , 0 . 024289705 } , { 0 . 0051047037 , 0 . 010052556 , 0 . 0020923265 , - 0 . 019043181 } } } , { { { 2 . 1627647 , 2 . 1788232 , 1 . 9290264 , 1 . 8457806 } , { 2 . 526488 , 2 . 3020441 , 2 . 538915 , 2 . 03484 } , { 3 . 9987521 , 4 . 3952121 , 3 . 906821 , 4 . 1693278 } , { 4 . 0400466 , 4 . 1069844 , 5 . 2512999 , 5 . 4283264 } , { 3 . 0141968 , 3 . 3306035 , 3 . 2224806 , 3 . 2473051 } , { 2 . 9840674 , 3 . 1294685 , 3 . 2964833 , 3 . 2929246 } , { 1 . 8346741 , 1 . 8637353 , 2 . 3037966 , 2 . 0860888 } , { 2 . 691236 , 2 . 6068079 , 1 . 9349032 , 2 . 1632935 } , { 1 . 9231956 , 1 . 7251627 , 2 . 1609654 , 2 . 1155629 } , { 2 . 165771 , 2 . 1908952 , 1 . 777038 , 2 . 0223741 } , { 4 . 5166991 , 4 . 8674508 , 3 . 918546 , 3 . 378087 } , { 4 . 4502295 , 4 . 5429338 , 3 . 9552598 , 3 . 3580272 } , { 3 . 0973598 , 3 . 3953852 , 2 . 2704362 , 2 . 6488177 } , { 3 . 2110537 , 3 . 3104376 , 2 . 515002 , 2 . 3267785 } , { 1 . 8303675 , 1 . 7094345 , 3 . 1787979 , 2 . 5960104 } , { 2 . 4391795 , 2 . 8730077 , 2 . 3730261 , 2 . 1545299 } , { 2 . 2130903 , 2 . 1899209 , 2 . 4997355 , 1 . 9058674 } , { 2 . 6472893 , 2 . 5455636 , 2 . 1164596 , 1 . 8341163 } , { 3 . 9428283 , 4 . 0433678 , 4 . 5430063 , 4 . 2482776 } , { 4 . 1941673 , 4 . 28852 , 4 . 64044 , 4 . 6644567 } , { 3 . 0873642 , 2 . 649364 , 3 . 6026133 , 3 . 2426354 } , { 3 . 2415154 , 3 . 5406745 , 3 . 2976852 , 3 . 3100246 } , { 1 . 8400289 , 1 . 8404692 , 1 . 889289 , 2 . 0125184 } , { 2 . 7063995 , 2 . 7229173 , 2 . 6289878 , 2 . 4313709 } } , { { - 0 . 015335928 , - 0 . 043382119 , - 0 . 0054163805 , - 0 . 028249934 } , { - 0 . 017200109 , 0 . 0027582413 , - 0 . 079612821 , - 0 . 0013966663 } , { - 0 . 027233584 , - 0 . 018783395 , - 0 . 01183278 , - 0 . 020918937 } , { - 0 . 0036358348 , - 0 . 015712206 , - 0 . 0089146421 , - 0 . 0057117233 } , { 0 . 020392865 , 0 . 017743746 , - 0 . 068597326 , - 0 . 030425581 } , { - 0 . 041123673 , - 0 . 020767538 , - 0 . 0087941887 , - 0 . 0065248183 } , { - 0 . 0055478408 , - 0 . 00082196865 , 0 . 0088521402 , - 0 . 045916836 } , { - 0 . 010506485 , 0 . 0078523247 , - 0 . 030002306 , - 0 . 0015085765 } , { 0 . 01894068 , - 0 . 012424968 , - 0 . 034837214 , - 0 . 045009941 } , { - 0 . 045299587 , 0 . 02630478 , - 0 . 017175711 , - 0 . 043601235 } , { - 0 . 046003661 , - 0 . 020588165 , 0 . 034398873 , - 0 . 054653787 } , { - 0 . 0042534368 , 0 . 01325834 , - 0 . 0036369576 , - 0 . 079162988 } , { - 0 . 028728556 , 0 . 0051289128 , 0 . 012104313 , 0 . 010686997 } , { - 0 . 066337767 , 0 . 00059928728 , - 0 . 080303668 , 0 . 011318772 } , { - 0 . 031879871 , 0 . 0011317962 , - 0 . 050259029 , 0 . 0031596552 } , { - 0 . 090121238 , - 0 . 011196084 , - 0 . 072456123 , - 0 . 00079731072 } , { - 0 . 024243475 , 0 . 021401076 , - 0 . 018209385 , - 0 . 0083196072 } , { - 0 . 079888701 , 0 . 0032806631 , - 0 . 12762259 , - 0 . 04652308 } , { 0 . 031806075 , - 0 . 034165157 , - 0 . 015255921 , - 0 . 049164663 } , { - 0 . 0012051123 , 0 . 030788487 , 0 . 022291919 , 0 . 0025694519 } , { 0 . 035836509 , 0 . 0055365388 , 0 . 026704836 , 0 . 0001547235 } , { - 0 . 012129747 , - 0 . 0094322145 , - 0 . 040637935 , - 0 . 12125388 } , { - 0 . 027044986 , 0 . 04531553 , - 0 . 033484589 , - 0 . 0059927923 } , { 0 . 0067188802 , - 0 . 051166351 , - 0 . 048822794 , - 0 . 025926988 } } , { { 0 . 022049053 , 0 . 021265778 , - 0 . 040370641 , - 0 . 036232952 } , { - 0 . 0058098424 , - 0 . 0042264198 , - 0 . 077428509 , - 0 . 04241654 } , { - 0 . 0026825379 , - 0 . 029453318 , - 0 . 016181275 , - 0 . 028320229 } , { - 0 . 012541692 , - 0 . 01345735 , 0 . 00037814888 , - 0 . 0046052489 } , { - 0 . 026527394 , 0 . 020033638 , - 0 . 025683861 , - 0 . 084207169 } , { - 0 . 0010459945 , - 0 . 036745215 , - 0 . 039772051 , 0 . 024810839 } , { 0 . 012134618 , 0 . 0068515798 , - 0 . 035286972 , 0 . 043129595 } , { - 0 . 077093357 , - 0 . 026872688 , 0 . 032800133 , - 0 . 090326706 } , { 0 . 13930909 , 0 . 0081274014 , - 0 . 08349188 , - 0 . 012200005 } , { - 0 . 091693797 , - 0 . 012567011 , - 0 . 069736822 , - 0 . 0061444184 } , { - 0 . 053061301 , 0 . 003642159 , 0 . 0052515175 , - 0 . 036957472 } , { 0 . 0043493933 , - 0 . 013069332 , - 0 . 014708126 , - 0 . 032765039 } , { - 0 . 016116105 , - 0 . 022907609 , - 0 . 043503106 , - 0 . 013266465 } , { - 0 . 072759977 , - 0 . 077354585 , 0 . 0043827591 , - 0 . 013821612 } , { - 0 . 032399073 , - 0 . 045305037 , - 0 . 021840791 , 0 . 073996542 } , { - 0 . 057239255 , - 0 . 056581235 , - 0 . 038880927 , 0 . 044102943 } , { - 0 . 026951489 , - 0 . 088667645 , - 0 . 013659704 , 0 . 033527579 } , { 0 . 034815442 , - 0 . 028634059 , - 0 . 036666529 , 0 . 011546036 } , { 0 . 026688447 , - 0 . 0081892129 , - 0 . 031138092 , - 0 . 041739155 } , { 0 . 0015665701 , - 0 . 012701682 , 0 . 0013533943 , - 0 . 002849785 } , { 0 . 032994636 , 0 . 008802974 , 0 . 019032649 , 0 . 0039042621 } , { - 0 . 044544917 , 0 . 0093201326 , - 0 . 017968915 , 0 . 01936344 } , { - 0 . 034794535 , 0 . 043032983 , - 0 . 051072531 , - 0 . 040148303 } , { - 0 . 0030398597 , - 0 . 027112065 , - 0 . 064007483 , - 0 . 01798277 } } } , { { { 0 . 22040906 , 0 . 24911942 , 0 . 41660708 , 0 . 23632869 } , { 0 . 25894466 , 0 . 1416669 , 0 . 41902981 , 0 . 35717608 } , { 0 . 26918091 , 0 . 14566759 , 0 . 2147652 , 0 . 15769391 } , { 0 . 22500921 , 0 . 12113361 , 0 . 11151768 , 0 . 12348609 } , { 0 . 25699055 , 0 . 056819107 , 0 . 3859882 , 0 . 4585378 } , { 0 . 7304995 , 0 . 20719358 , 0 . 44455636 , 0 . 42226989 } , { 0 . 43602897 , 0 . 51049581 , 0 . 41978824 , 0 . 62521039 } , { 0 . 42004119 , 0 . 52912054 , 0 . 33314238 , 0 . 38257921 } , { 0 . 55092562 , 0 . 43085653 , 0 . 31149977 , 0 . 34391138 } , { 0 . 40391149 , 0 . 48820255 , 0 . 13569806 , 0 . 36060266 } , { 0 . 13647907 , 0 . 12061002 , 0 . 20668806 , 0 . 30221394 } , { 0 . 15583476 , 0 . 13133696 , 0 . 22775202 , 0 . 35653823 } , { 0 . 56336195 , 0 . 25684627 , 0 . 11118383 , 0 . 23109245 } , { 0 . 45430401 , 0 . 42843367 , 0 . 25496534 , 0 . 097473509 } , { 0 . 3420223 , 0 . 39418925 , 0 . 26458947 , 0 . 30588082 } , { 0 . 51345558 , 0 . 3612731 , 0 . 41151773 , 0 . 25269512 } , { 0 . 29195176 , 0 . 42659964 , 0 . 47971993 , 0 . 32714756 } , { 0 . 49222777 , 0 . 28477645 , 0 . 74993827 , 0 . 43781271 } , { 0 . 098434481 , 0 . 31164923 , 0 . 14486345 , 0 . 11466693 } , { 0 . 070833248 , 0 . 20569754 , 0 . 10233576 , 0 . 047352701 } , { 0 . 51050902 , 0 . 15597643 , 0 . 1417112 , 0 . 35581415 } , { 0 . 48261165 , 0 . 14592221 , 0 . 62554576 , 0 . 5209765 } , { 0 . 33562628 , 0 . 39920067 , 0 . 28183433 , 0 . 297464 } , { 0 . 366851 , 0 . 59278666 , 0 . 59095922 , 0 . 48385165 } } , { { 0 . 13792051 , 0 . 072076744 , 0 . 094800532 , 0 . 026318377 } , { 0 . 13607414 , - 0 . 061382542 , 0 . 061800151 , - 0 . 020060553 } , { 0 . 028096406 , 0 . 069282616 , 0 . 010195109 , - 0 . 010461141 } , { 0 . 018651237 , 0 . 02642439 , 0 . 0077552848 , - 0 . 051151646 } , { 0 . 098299803 , - 0 . 0085081153 , - 0 . 011764584 , 0 . 087405711 } , { 0 . 064082346 , - 0 . 04626424 , - 0 . 071480607 , 0 . 064447268 } , { 0 . 022766233 , 0 . 0167542 , - 0 . 021285286 , - 0 . 071637286 } , { - 0 . 0202445 , 0 . 011692601 , 0 . 048325551 , 0 . 0097755172 } , { - 0 . 027775183 , 0 . 016463115 , 0 . 060050391 , - 0 . 034226107 } , { 0 . 019412547 , 0 . 059977501 , - 0 . 0041737169 , 0 . 031539317 } , { 0 . 013192979 , 0 . 036015595 , - 0 . 049943198 , 0 . 014112312 } , { - 0 . 013272349 , 0 . 035821037 , - 0 . 060503687 , 0 . 095316821 } , { 0 . 038338785 , - 0 . 059038809 , - 0 . 044954172 , - 0 . 00051347307 } , { - 0 . 039594082 , 0 . 018205882 , 0 . 13413799 , 0 . 012292954 } , { 0 . 015177594 , - 0 . 0082493854 , 0 . 00029420179 , 0 . 010356248 } , { 0 . 100271 , - 0 . 13623174 , 0 . 1121235 , 0 . 068902399 } , { 0 . 025189636 , 0 . 0014918434 , 0 . 0088847718 , - 0 . 053714493 } , { 0 . 06487698 , - 0 . 097217547 , - 0 . 069537353 , 0 . 032490984 } , { - 0 . 030729608 , 0 . 048956315 , 0 . 016036034 , 0 . 022485239 } , { 0 . 049839618 , 0 . 01148525 , - 0 . 021032427 , - 0 . 019665817 } , { - 0 . 0037762817 , - 0 . 030422275 , - 0 . 062343207 , 0 . 057994884 } , { 0 . 014035184 , - 0 . 021387762 , - 0 . 080846143 , - 0 . 020681511 } , { - 0 . 03594567 , 0 . 026862531 , 0 . 078975557 , - 0 . 034056659 } , { - 0 . 014490672 , 0 . 026128902 , 0 . 045617611 , 0 . 090192953 } } , { { 0 . 011904288 , - 0 . 014624471 , 0 . 042023114 , 0 . 019592867 } , { 0 . 032705848 , 0 . 00038558691 , 0 . 031901745 , 0 . 027208951 } , { - 0 . 044369719 , - 0 . 039761364 , - 0 . 013366816 , - 0 . 019308126 } , { - 0 . 019051023 , - 0 . 00015767269 , - 0 . 082968285 , - 0 . 035266053 } , { - 0 . 004775162 , 0 . 010889271 , 0 . 0089521094 , 0 . 027037104 } , { 0 . 005616143 , - 0 . 00099668486 , 0 . 0068716426 , - 0 . 12649184 } , { 0 . 018531199 , 0 . 023881776 , - 0 . 053798787 , - 0 . 041912909 } , { - 0 . 0036187094 , 0 . 11590788 , 0 . 025140733 , 0 . 022280209 } , { - 0 . 02994342 , - 0 . 026293799 , - 0 . 017204658 , 0 . 044901944 } , { 0 . 079892089 , 0 . 10816526 , 0 . 14667807 , 0 . 027301352 } , { - 0 . 045296738 , - 0 . 066748968 , - 0 . 0099354431 , - 0 . 070369692 } , { - 0 . 08357374 , - 0 . 043311901 , 0 . 013163375 , - 0 . 0881777 } , { - 0 . 065923811 , - 0 . 10382274 , 0 . 090440302 , - 0 . 013617198 } , { - 0 . 092578587 , - 0 . 010178017 , - 0 . 01416593 , 0 . 0432333 } , { 0 . 055172515 , 0 . 10021805 , - 0 . 0062782668 , - 0 . 11791805 } , { - 0 . 039684132 , - 0 . 08934283 , 0 . 020686084 , - 0 . 0013788117 } , { 0 . 064624676 , 0 . 051773746 , 0 . 0045383964 , - 0 . 037696971 } , { - 0 . 066296373 , 0 . 020570689 , - 0 . 017742721 , - 0 . 022651449 } , { - 0 . 0061572447 , - 0 . 094510525 , - 0 . 094775804 , - 0 . 038022514 } , { 0 . 0055683313 , 0 . 039513342 , - 0 . 096815654 , - 0 . 0065483011 } , { - 0 . 03311602 , - 0 . 018395457 , 0 . 0028464434 , - 0 . 088048272 } , { - 0 . 073106109 , - 0 . 055187863 , - 0 . 093209932 , - 0 . 10155137 } , { 0 . 042841842 , - 0 . 005778703 , 0 . 074069607 , - 0 . 025841052 } , { - 0 . 018569637 , 0 . 063144303 , 0 . 02291584 , 0 . 005525742 } } } } , { { { { - 0 . 20809663 , - 0 . 18346453 , - 0 . 072140694 , - 0 . 0078104407 } , { - 0 . 19490097 , 0 . 25712922 , 0 . 37640771 , 0 . 11563399 } , { 0 . 26894915 , - 0 . 33477877 , - 0 . 093739129 , - 0 . 55078405 } , { - 0 . 65794103 , 0 . 09211629 , - 0 . 19166986 , 0 . 5574327 } , { 0 . 45579532 , 0 . 23202083 , 0 . 19626303 , - 0 . 64130523 } , { - 0 . 018763975 , - 0 . 24981569 , - 0 . 32514026 , - 0 . 11121342 } , { 0 . 22376238 , 0 . 09515938 , 0 . 071728264 , - 0 . 02790747 } , { - 0 . 3053338 , 0 . 34023365 , 0 . 099862481 , 0 . 26163964 } , { - 0 . 21722968 , - 0 . 094881958 , - 0 . 086364431 , - 0 . 0081863581 } , { - 0 . 16090709 , 0 . 23527698 , 0 . 28947119 , 0 . 11309742 } , { 0 . 26447184 , - 0 . 33536416 , - 0 . 096418234 , - 0 . 26201294 } , { - 0 . 56343769 , - 0 . 041662822 , - 0 . 24873841 , 0 . 67122901 } , { 0 . 35362642 , 0 . 2577592 , 0 . 2009013 , - 0 . 74233681 } , { - 0 . 047956299 , - 0 . 54973418 , - 0 . 4958485 , - 0 . 12453303 } , { 0 . 06917425 , 0 . 080509853 , 0 . 0090863722 , - 0 . 023518805 } , { - 0 . 27000602 , 0 . 083167162 , 0 . 12715558 , 0 . 12397839 } , { - 0 . 11376964 , - 0 . 079199259 , 0 . 019676685 , - 0 . 0094352472 } , { - 0 . 19185851 , 0 . 22193112 , 0 . 28110877 , - 0 . 06422845 } , { 0 . 084091992 , - 0 . 16151548 , 0 . 091400556 , - 0 . 28257376 } , { - 0 . 53821376 , 0 . 21718328 , - 0 . 2234907 , 0 . 52302804 } , { 0 . 71322306 , 0 . 042728493 , 0 . 13229522 , - 0 . 61892094 } , { 0 . 15270046 , - 0 . 26304886 , - 0 . 33110633 , - 0 . 052728951 } , { 0 . 072398971 , 0 . 25829764 , 0 . 25881687 , - 0 . 020942042 } , { - 0 . 26788161 , 0 . 055822039 , 0 . 33817103 , 0 . 42061402 } } , { { 0 . 088248648 , 0 . 091306255 , 0 . 020476927 , 0 . 0030144802 } , { 0 . 0087376707 , 0 . 043816157 , 0 . 0022807168 , 0 . 016745414 } , { - 0 . 13412414 , 0 . 12686539 , 0 . 060531476 , 0 . 044582027 } , { 0 . 019204757 , - 0 . 0070891897 , 0 . 091194602 , 0 . 065258927 } , { - 0 . 10429513 , - 0 . 027665602 , - 0 . 064350626 , 0 . 0053147478 } , { 0 . 069218141 , - 0 . 035018324 , - 0 . 088257571 , 0 . 019279642 } , { - 0 . 073137338 , 0 . 040764456 , - 0 . 022352804 , 0 . 031743288 } , { 0 . 040325697 , - 0 . 12840825 , - 0 . 009582113 , 0 . 034509657 } , { 0 . 081971224 , - 0 . 0035223125 , - 0 . 051728499 , 0 . 0038899717 } , { 0 . 050968435 , 0 . 022254651 , 0 . 18781134 , - 0 . 032392139 } , { 0 . 024342518 , 0 . 13929014 , - 0 . 019175435 , - 0 . 0011608234 } , { - 0 . 0021942487 , - 0 . 01251222 , 0 . 024263454 , - 0 . 063179344 } , { - 0 . 13071776 , - 0 . 059221747 , - 0 . 034153238 , 0 . 036561209 } , { 0 . 054124093 , 0 . 070495803 , 0 . 081441614 , 0 . 051900357 } , { 0 . 027480327 , 0 . 028940343 , - 0 . 01469313 , 0 . 032388411 } , { - 0 . 039696828 , - 0 . 0069393798 , - 0 . 011361641 , 0 . 035031025 } , { - 0 . 039730763 , 0 . 0085971581 , - 0 . 0077461932 , - 0 . 040735188 } , { 0 . 10893368 , 0 . 00014757217 , 0 . 025489178 , - 0 . 11388774 } , { - 0 . 0013816669 , 0 . 0031148929 , 0 . 10281666 , - 0 . 019860642 } , { - 0 . 065093128 , - 0 . 11495815 , 0 . 041783056 , - 0 . 091373461 } , { - 0 . 044985581 , 0 . 0012713031 , - 0 . 16078032 , 0 . 17303747 } , { - 0 . 038132358 , - 0 . 02995975 , - 0 . 037612782 , 0 . 012575173 } , { 0 . 0042976619 , 0 . 027014275 , 0 . 017518808 , 0 . 030405184 } , { - 0 . 0015298607 , 0 . 029297664 , - 0 . 1034349 , 0 . 023450502 } } , { { 0 . 028785558 , - 0 . 028708377 , - 0 . 010459636 , 2 . 8360915e - 05 } , { 0 . 091634877 , 0 . 021214811 , 0 . 12282079 , 0 . 080617943 } , { - 0 . 29287977 , 0 . 045481846 , 0 . 014712563 , 0 . 057317576 } , { - 0 . 10728772 , 0 . 03268482 , 0 . 015167285 , - 0 . 011256231 } , { 0 . 09337321 , 0 . 037150859 , 0 . 052549202 , - 0 . 042671474 } , { - 0 . 0041288689 , - 0 . 024299997 , - 0 . 11357403 , - 0 . 022045772 } , { - 0 . 041469935 , - 0 . 0071353646 , - 0 . 0086607538 , 0 . 008536762 } , { 0 . 033629272 , - 0 . 0070042955 , - 0 . 037864853 , - 0 . 0055907778 } , { 0 . 016404597 , - 0 . 0055321059 , - 0 . 020989839 , - 0 . 013771265 } , { 0 . 042552435 , 0 . 04428518 , 0 . 0030587466 , 0 . 044894182 } , { - 0 . 027600219 , 0 . 026831779 , 0 . 051120849 , - 0 . 032184808 } , { 0 . 13870554 , 0 . 15273282 , 0 . 049260112 , 0 . 043371121 } , { - 0 . 018453269 , - 0 . 18061413 , 0 . 24805649 , - 0 . 031741165 } , { - 0 . 085137374 , 0 . 025935867 , 0 . 015978067 , 0 . 067726486 } , { 0 . 072393868 , 0 . 0050430488 , 0 . 0016664585 , 0 . 0072097064 } , { 0 . 033840162 , 0 . 082225764 , - 0 . 079387016 , 0 . 033165625 } , { 0 . 033170766 , 0 . 0012231618 , - 0 . 066984982 , 0 . 051671704 } , { 0 . 017894231 , - 0 . 012267532 , 0 . 045536123 , - 0 . 07327109 } , { 0 . 0073109731 , - 0 . 063797898 , - 0 . 13446413 , 0 . 1408986 } , { - 0 . 045702456 , - 0 . 1647051 , - 0 . 14336468 , 0 . 054543693 } , { 0 . 0042448876 , - 0 . 13234456 , 0 . 092181719 , - 0 . 10440841 } , { - 0 . 060020212 , - 0 . 011098469 , - 0 . 030257182 , - 0 . 030922037 } , { - 0 . 018118661 , 0 . 00067983745 , - 0 . 0061776598 , - 0 . 031721273 } , { - 0 . 019885189 , 0 . 094157888 , 0 . 014017961 , - 0 . 051373389 } } } , { { { 0 . 12415319 , - 0 . 13611564 , - 0 . 029441661 , - 0 . 14143497 } , { - 0 . 26074418 , 0 . 011913326 , - 0 . 033328425 , 0 . 43248793 } , { 0 . 19336432 , 0 . 37269586 , 0 . 36803538 , - 0 . 51720719 } , { - 0 . 15185913 , - 0 . 47431781 , - 0 . 6593667 , 0 . 23163184 } , { 0 . 18276216 , 0 . 19248743 , 0 . 65453332 , 0 . 54748087 } , { 0 . 17751443 , - 0 . 0020337696 , 0 . 08506463 , - 0 . 40147769 } , { - 0 . 11370932 , 0 . 11523476 , - 0 . 010573025 , 0 . 082295392 } , { - 0 . 13666335 , - 0 . 32747478 , - 0 . 16897386 , 0 . 15359006 } , { 0 . 11716326 , - 0 . 12259922 , 0 . 0033396256 , - 0 . 13240653 } , { - 0 . 27776876 , - 0 . 10222241 , - 0 . 039920479 , 0 . 35499708 } , { 0 . 090003723 , 0 . 3313923 , 0 . 1871549 , 0 . 003163675 } , { - 0 . 51626118 , - 0 . 76341562 , - 0 . 56326874 , 0 . 20153559 } , { - 0 . 34172723 , 0 . 26975563 , 0 . 67520079 , - 0 . 1252004 } , { 0 . 45758078 , - 0 . 19142179 , 0 . 064180031 , - 0 . 48748431 } , { - 0 . 12800789 , 0 . 1399912 , 0 . 0077954775 , 0 . 14379741 } , { - 0 . 13042104 , - 0 . 45670817 , - 0 . 18831095 , 0 . 0032738639 } , { 0 . 12446807 , - 0 . 11504524 , - 0 . 027331682 , 0 . 03861758 } , { - 0 . 31337986 , - 0 . 11842668 , 0 . 033415325 , 0 . 45344231 } , { 0 . 11463107 , 0 . 077427841 , 0 . 060880794 , - 0 . 069619455 } , { - 0 . 37772106 , - 0 . 59628905 , - 0 . 65426572 , 0 . 065297039 } , { 0 . 29532991 , 0 . 75920243 , 0 . 53294265 , - 0 . 15002562 } , { 0 . 3618333 , 0 . 10488387 , 0 . 36007528 , - 0 . 30963565 } , { - 0 . 13738196 , 0 . 20795596 , 0 . 029274703 , 0 . 18017599 } , { - 0 . 10290023 , - 0 . 48517535 , - 0 . 33278584 , 0 . 56477854 } } , { { - 0 . 0047891472 , 0 . 024629901 , 0 . 015256654 , - 0 . 0084462001 } , { 0 . 056227746 , - 0 . 048057782 , - 0 . 15671312 , 0 . 06418471 } , { - 0 . 070093217 , - 0 . 018057199 , 0 . 062026545 , - 0 . 051053726 } , { - 0 . 0091221476 , 0 . 0020547295 , - 0 . 087729813 , - 0 . 10164738 } , { 0 . 098917091 , - 0 . 066835916 , 0 . 083151519 , 0 . 006342544 } , { 0 . 0013540606 , 0 . 038719082 , 0 . 036333261 , - 0 . 053178668 } , { 0 . 0083787438 , 0 . 0028359378 , 0 . 0089872852 , 0 . 031308249 } , { 0 . 014379686 , - 0 . 079563474 , - 0 . 079160006 , - 0 . 016352226 } , { 0 . 0091376645 , - 0 . 016678006 , - 0 . 044636785 , - 0 . 0011035265 } , { 0 . 0099146109 , 0 . 027589302 , - 0 . 09494437 , 0 . 07451767 } , { 0 . 017453983 , 0 . 080674871 , 0 . 06341808 , 0 . 048820473 } , { 0 . 02794057 , 0 . 058230195 , - 0 . 010793601 , 0 . 091813872 } , { - 0 . 049633232 , - 0 . 1142016 , 0 . 036984283 , 0 . 0034294865 } , { 0 . 047712957 , 0 . 10161366 , 0 . 13774722 , 0 . 039503136 } , { 0 . 014194782 , - 0 . 014555183 , - 0 . 00053182909 , 0 . 0019143477 } , { 0 . 0014900262 , 0 . 0056176356 , - 0 . 034517871 , - 0 . 0010707988 } , { 0 . 013287784 , - 0 . 0073967933 , - 0 . 019271341 , 0 . 016354896 } , { - 0 . 10345626 , 0 . 023536634 , 0 . 027943639 , - 0 . 015686972 } , { - 0 . 025193395 , - 0 . 10224801 , 0 . 078686884 , - 0 . 048574399 } , { 0 . 15797878 , - 0 . 0012322757 , - 0 . 036096649 , - 0 . 23983963 } , { - 0 . 10455507 , - 0 . 056368102 , - 0 . 06570944 , 0 . 29104616 } , { 0 . 05155239 , - 0 . 040940824 , - 0 . 038367594 , 0 . 058174485 } , { 0 . 010471732 , - 0 . 066952904 , - 0 . 047763843 , - 0 . 021124742 } , { - 0 . 033555686 , 0 . 0049111983 , - 0 . 026592789 , 0 . 014438586 } } , { { - 0 . 0048440946 , 0 . 025915095 , - 0 . 018325403 , 0 . 022133613 } , { 0 . 059240081 , - 0 . 031272176 , - 0 . 12967647 , - 0 . 17957913 } , { 0 . 0574837 , 0 . 067005152 , 0 . 024644254 , 0 . 10786296 } , { 0 . 067084865 , 0 . 008513386 , 0 . 04077659 , 0 . 10587924 } , { 0 . 026332643 , 0 . 1072618 , - 0 . 098375042 , - 0 . 001724609 } , { - 0 . 021386362 , - 0 . 0020174921 , 0 . 16800158 , 0 . 081359882 } , { - 0 . 018204146 , - 0 . 026432136 , - 0 . 0068153455 , - 0 . 029997667 } , { - 0 . 043221501 , - 0 . 016869967 , - 0 . 067406967 , - 0 . 024965804 } , { - 0 . 0033879999 , 0 . 031310818 , - 0 . 010853802 , 0 . 00088944004 } , { - 0 . 068991006 , 0 . 087874253 , - 0 . 15737392 , - 0 . 088870044 } , { 0 . 061763806 , - 0 . 00072874343 , - 0 . 009915009 , - 0 . 0178225 } , { - 0 . 07340717 , 0 . 080339271 , - 0 . 0027124572 , - 0 . 13078641 } , { - 0 . 023682834 , 0 . 16512313 , - 0 . 15784472 , 0 . 047978827 } , { 0 . 0063250439 , - 0 . 09953777 , 0 . 094180888 , 0 . 010565041 } , { 0 . 010047311 , - 0 . 042999009 , - 0 . 012483998 , - 0 . 016966759 } , { - 0 . 048612679 , 0 . 051708319 , 0 . 015059148 , 0 . 0036776472 } , { - 0 . 011737015 , - 0 . 0027276603 , 0 . 026535075 , - 0 . 065453876 } , { 0 . 056388137 , 0 . 061461073 , - 0 . 12726984 , - 0 . 025578248 } , { 0 . 0016833003 , 0 . 10878558 , 0 . 13254828 , - 0 . 017098914 } , { - 0 . 031606282 , - 0 . 072245098 , 0 . 12724789 , - 0 . 21852899 } , { - 0 . 062502612 , - 0 . 073402771 , - 0 . 049624729 , 0 . 069066032 } , { - 0 . 075837195 , - 0 . 10297347 , - 0 . 07249237 , - 0 . 11538062 } , { - 0 . 015644005 , 0 . 039474396 , 0 . 074415075 , - 0 . 038881161 } , { - 0 . 040175911 , 0 . 034030267 , 0 . 03947059 , 0 . 014167463 } } } , { { { 0 . 97019677 , 0 . 97355703 , 0 . 99695983 , 0 . 98991674 } , { 0 . 94552952 , 0 . 96630359 , 0 . 92585444 , 0 . 89419404 } , { 0 . 9435447 , 0 . 86545998 , 0 . 92507456 , 0 . 65508294 } , { 0 . 73759908 , 0 . 87552111 , 0 . 72697883 , 0 . 79725496 } , { 0 . 87111918 , 0 . 95347518 , 0 . 73011435 , 0 . 53758004 } , { 0 . 9839393 , 0 . 96829127 , 0 . 94183216 , 0 . 90909143 } , { 0 . 96798791 , 0 . 98876976 , 0 . 99736817 , 0 . 99621717 } , { 0 . 9423876 , 0 . 88147679 , 0 . 98054848 , 0 . 95286662 } , { 0 . 96906348 , 0 . 98791034 , 0 . 99625801 , 0 . 99116169 } , { 0 . 94707625 , 0 . 9665378 , 0 . 9563539 , 0 . 9280011 } , { 0 . 96018435 , 0 . 88187869 , 0 . 97758711 , 0 . 96505917 } , { 0 . 64499021 , 0 . 64456248 , 0 . 78794513 , 0 . 71332673 } , { 0 . 87073007 , 0 . 92778882 , 0 . 70974824 , 0 . 65822558 } , { 0 . 88787388 , 0 . 81311133 , 0 . 86603417 , 0 . 86420517 } , { 0 . 98935782 , 0 . 98687417 , 0 . 99992833 , 0 . 98932764 } , { 0 . 95398485 , 0 . 88572054 , 0 . 97384313 , 0 . 99227952 } , { 0 . 98567955 , 0 . 99019799 , 0 . 99943274 , 0 . 99920952 } , { 0 . 93004482 , 0 . 96784384 , 0 . 95909399 , 0 . 88896838 } , { 0 . 98984254 , 0 . 98382807 , 0 . 99395144 , 0 . 95671584 } , { 0 . 75342733 , 0 . 77283296 , 0 . 72248756 , 0 . 84981055 } , { 0 . 63568318 , 0 . 6494505 , 0 . 83574524 , 0 . 77099234 } , { 0 . 91965169 , 0 . 95906448 , 0 . 87218942 , 0 . 94939213 } , { 0 . 98786871 , 0 . 94341754 , 0 . 96548269 , 0 . 98341143 } , { 0 . 95794101 , 0 . 87263324 , 0 . 8802806 , 0 . 71000638 } } , { { - 0 . 0064390277 , 0 . 051629953 , - 0 . 011423447 , 0 . 032337826 } , { 0 . 055030538 , 0 . 061305324 , - 0 . 016012659 , 0 . 083766345 } , { 0 . 052467122 , 0 . 018425134 , - 0 . 00054737782 , 0 . 048038459 } , { 0 . 076436505 , 0 . 016815709 , - 0 . 024174832 , - 0 . 00829119 } , { 0 . 057903371 , 0 . 068822104 , - 0 . 0064003131 , 0 . 00010695928 } , { 0 . 067104151 , 0 . 067284611 , 0 . 0074295447 , 0 . 024215238 } , { 0 . 073380541 , 0 . 01486405 , 0 . 01523157 , 0 . 012966612 } , { - 0 . 0002536971 , 0 . 010628632 , 0 . 00045031869 , 0 . 041891438 } , { 0 . 055922922 , 0 . 0090823157 , 0 . 011101162 , 0 . 033807592 } , { - 0 . 040264953 , 0 . 022318628 , - 0 . 013682045 , - 0 . 016112502 } , { - 0 . 034286564 , 4 . 7089727e - 05 , - 0 . 013030079 , - 0 . 012231424 } , { 0 . 027756308 , 0 . 084041595 , 0 . 018308393 , 0 . 11564334 } , { 0 . 0026690817 , 0 . 058149333 , - 0 . 013682964 , 0 . 052975934 } , { - 0 . 03852481 , 0 . 063493354 , 0 . 059460027 , 0 . 047740976 } , { 0 . 026410264 , - 0 . 0073902435 , 0 . 022353771 , 0 . 012987341 } , { 0 . 035217135 , - 0 . 0023455309 , - 0 . 0055505614 , 0 . 010102857 } , { 0 . 00075590283 , 0 . 038624793 , - 0 . 0040614962 , 0 . 070039437 } , { - 0 . 02318411 , 0 . 04527054 , 0 . 013119286 , 0 . 025335215 } , { 0 . 021268391 , 0 . 044855911 , 0 . 012622905 , 0 . 04827088 } , { - 0 . 0046678346 , - 0 . 01934799 , 0 . 018393432 , 0 . 09750434 } , { 0 . 12480373 , 0 . 059151139 , 0 . 055196092 , 0 . 26701338 } , { - 0 . 0096669036 , 0 . 065624767 , 0 . 016918517 , 0 . 028425135 } , { 0 . 026488514 , - 0 . 0037618693 , 0 . 0077028717 , 0 . 041713399 } , { 0 . 018628451 , 0 . 033145064 , 0 . 029067918 , - 0 . 000924258 } } , { { - 0 . 043525781 , 0 . 028119778 , - 0 . 011653105 , - 0 . 020930158 } , { - 0 . 028099186 , 0 . 017594088 , - 0 . 099226445 , 0 . 10408808 } , { 0 . 11750066 , - 0 . 0010629746 , 0 . 018381448 , 0 . 096538552 } , { 0 . 0010069446 , 0 . 013799541 , 0 . 1325137 , 0 . 020820734 } , { - 0 . 053571928 , - 0 . 0066793785 , 0 . 14596488 , - 0 . 03272949 } , { 0 . 028507895 , 0 . 015474376 , - 0 . 025411653 , 0 . 037264272 } , { 0 . 033698911 , 0 . 018088387 , 0 . 0038898537 , 0 . 03163178 } , { 0 . 0057766828 , 0 . 015879322 , 0 . 012557033 , 0 . 071771631 } , { - 0 . 0044521866 , 0 . 0083963511 , - 0 . 0020426175 , 0 . 023784146 } , { - 0 . 011508765 , 0 . 0075020051 , 0 . 0018808294 , 0 . 040843424 } , { 0 . 0085150894 , 0 . 0056891711 , 0 . 010134672 , 0 . 046224768 } , { 0 . 040825446 , 0 . 10099754 , 0 . 021853299 , 0 . 024507528 } , { - 0 . 0055958303 , - 0 . 0060958 , 0 . 1115321 , - 0 . 021701014 } , { 0 . 010487817 , - 0 . 010033143 , - 0 . 031203025 , 0 . 054265436 } , { 0 . 0040500672 , 0 . 0053935875 , 0 . 018233022 , 0 . 018797311 } , { 0 . 064057639 , 0 . 014318185 , 0 . 0199119 , 0 . 014366235 } , { 0 . 02411682 , 0 . 045454692 , 0 . 0030084434 , 0 . 019464939 } , { 0 . 012500289 , 0 . 027734846 , 0 . 0025097372 , 0 . 047343669 } , { 0 . 037625829 , - 0 . 00064472688 , 0 . 0557556 , 0 . 04785655 } , { 0 . 0020433437 , 0 . 019929208 , 0 . 087936103 , - 0 . 036738471 } , { 0 . 020811556 , 0 . 0915387 , 0 . 055445303 , - 0 . 065132763 } , { 0 . 03911814 , 0 . 043721622 , 0 . 0074336204 , - 0 . 031370424 } , { 0 . 014072509 , - 0 . 014795458 , 0 . 010517063 , 0 . 022409628 } , { - 0 . 0054107234 , 0 . 055313602 , 0 . 053556404 , 0 . 048574319 } } } , { { { 3 . 4224197 , 3 . 3162336 , 3 . 1136621 , 3 . 3189801 } , { 4 . 0715355 , 3 . 5614196 , 4 . 1797877 , 4 . 0959601 } , { 4 . 3979407 , 4 . 1858272 , 4 . 3116447 , 4 . 5467451 } , { 4 . 4920032 , 4 . 0716439 , 4 . 6107962 , 4 . 5268016 } , { 5 . 6570832 , 4 . 9036495 , 4 . 7373547 , 4 . 7259419 } , { 3 . 3277827 , 3 . 6015237 , 4 . 226646 , 3 . 7939772 } , { 3 . 4893058 , 3 . 3260638 , 3 . 0626103 , 3 . 1798705 } , { 3 . 6423735 , 4 . 1092281 , 3 . 3264203 , 3 . 7325301 } , { 3 . 4756581 , 3 . 2550256 , 3 . 224671 , 3 . 4093307 } , { 3 . 8511362 , 3 . 4821381 , 4 . 3232597 , 3 . 7357164 } , { 3 . 6688024 , 4 . 0797971 , 3 . 4140927 , 3 . 6881261 } , { 4 . 5298469 , 4 . 7472506 , 4 . 4046473 , 4 . 7279944 } , { 4 . 1614448 , 4 . 1242955 , 4 . 6741969 , 5 . 0037875 } , { 4 . 3148703 , 4 . 3815566 , 4 . 1976536 , 3 . 9032858 } , { 3 . 2640506 , 3 . 3214728 , 2 . 9463564 , 3 . 3562068 } , { 3 . 6729325 , 3 . 9218642 , 3 . 4550701 , 3 . 4833871 } , { 3 . 435975 , 3 . 3079446 , 3 . 3432341 , 3 . 3632985 } , { 3 . 8404619 , 3 . 4716915 , 3 . 858149 , 3 . 8677391 } , { 3 . 3181827 , 3 . 8403872 , 4 . 0363918 , 3 . 9604287 } , { 5 . 0916792 , 5 . 2773748 , 4 . 5404255 , 4 . 377031 } , { 4 . 6514614 , 4 . 7569957 , 4 . 1233238 , 4 . 4022582 } , { 3 . 6884833 , 3 . 6283543 , 4 . 1874612 , 4 . 2963913 } , { 3 . 456705 , 3 . 6250566 , 3 . 5292789 , 3 . 1420033 } , { 3 . 5986317 , 4 . 0596074 , 4 . 0696874 , 4 . 5327067 } } , { { - 0 . 12592901 , - 0 . 14780788 , - 0 . 11051274 , - 0 . 18767653 } , { - 0 . 020435093 , 0 . 0055221209 , - 0 . 021183195 , - 0 . 15159792 } , { 0 . 022498629 , - 0 . 025100789 , - 0 . 30939177 , 0 . 016420202 } , { 0 . 21296442 , - 0 . 042976575 , 0 . 082118132 , 0 . 14574735 } , { - 0 . 13608022 , 0 . 16141834 , - 0 . 015091164 , 0 . 044951541 } , { - 0 . 08235774 , - 0 . 10333151 , 0 . 089785432 , - 0 . 036620639 } , { - 0 . 17664465 , - 0 . 015842477 , - 0 . 083075331 , - 0 . 15660828 } , { - 0 . 11292423 , - 0 . 072894494 , - 0 . 068901923 , - 0 . 2283674 } , { - 0 . 19063437 , - 0 . 071954393 , 0 . 091375283 , - 0 . 26993547 } , { 0 . 042798331 , - 0 . 06495575 , 0 . 050221766 , 0 . 024602586 } , { - 0 . 026228614 , 0 . 0049810367 , 0 . 046584088 , - 0 . 13067577 } , { 0 . 072779737 , - 0 . 023369437 , - 0 . 030275791 , 0 . 19591126 } , { - 0 . 018649072 , 0 . 029208952 , 0 . 012033439 , 0 . 00094798196 } , { - 0 . 094599446 , 0 . 0070746366 , - 0 . 0007115864 , - 0 . 040175552 } , { - 0 . 027599009 , - 0 . 068747365 , 0 . 19480498 , - 0 . 19423733 } , { - 0 . 076671551 , 0 . 0075475135 , 0 . 019853903 , - 0 . 012984601 } , { 0 . 064371855 , - 0 . 24044027 , - 0 . 043765356 , 0 . 0016424127 } , { - 0 . 076744435 , 0 . 035881398 , 0 . 12967612 , 0 . 081825243 } , { - 0 . 15224256 , 0 . 032665115 , - 0 . 027927205 , 0 . 076091133 } , { - 0 . 0057973613 , - 0 . 14914213 , - 0 . 047678749 , - 0 . 037214457 } , { 0 . 10060085 , - 0 . 099197666 , - 0 . 22704457 , - 0 . 0020812401 } , { - 0 . 070664558 , - 0 . 13179176 , - 0 . 014217065 , - 0 . 030410253 } , { - 0 . 12286487 , - 0 . 046623366 , - 0 . 10695394 , - 0 . 0081383175 } , { - 0 . 14561788 , 0 . 02765909 , 0 . 10439783 , 0 . 033139041 } } , { { 0 . 0063171031 , - 0 . 0047223477 , - 0 . 056312039 , - 0 . 065065766 } , { - 0 . 0059575982 , - 0 . 062348475 , 0 . 069540315 , - 0 . 090331962 } , { 0 . 10218203 , 0 . 050383376 , - 0 . 0089914697 , - 0 . 037837343 } , { - 0 . 0037657879 , 0 . 18278082 , 0 . 079014627 , - 0 . 052587294 } , { - 0 . 33929282 , 0 . 018522098 , 0 . 0078923893 , 0 . 042545349 } , { 0 . 027294929 , - 0 . 086490439 , - 0 . 0057363347 , - 0 . 035932082 } , { - 0 . 061716003 , - 0 . 14470599 , 0 . 033117786 , - 0 . 08112808 } , { 0 . 16414856 , 0 . 082471596 , - 0 . 058497326 , 0 . 050552718 } , { - 0 . 07627083 , - 0 . 0064181717 , - 0 . 031179581 , - 0 . 075705068 } , { - 0 . 057808009 , - 0 . 00074561624 , - 0 . 23990956 , 0 . 018671772 } , { 0 . 1677602 , 0 . 10757253 , 0 . 028015134 , - 0 . 23923178 } , { 0 . 078827365 , 0 . 068682485 , 0 . 056277532 , - 0 . 069749241 } , { 0 . 079502977 , 0 . 05526585 , 0 . 0089767144 , - 0 . 15319341 } , { - 0 . 038594242 , - 0 . 055488998 , - 0 . 043132461 , 0 . 054313031 } , { 0 . 12890592 , - 0 . 082639555 , 0 . 22520491 , - 0 . 026781096 } , { - 0 . 071292391 , 0 . 064592881 , - 0 . 050368563 , - 0 . 072488866 } , { 0 . 092998671 , 0 . 12152394 , 0 . 033318795 , - 0 . 039691417 } , { - 0 . 0049706273 , - 0 . 0014175115 , - 0 . 11634604 , 0 . 15219284 } , { - 0 . 012414906 , 0 . 035583927 , - 0 . 072463074 , - 0 . 058394705 } , { - 0 . 071558898 , - 0 . 00093653835 , 0 . 013149622 , 0 . 01495775 } , { - 0 . 057103279 , 0 . 013702583 , - 0 . 020242751 , 0 . 04649072 } , { - 0 . 083398977 , - 0 . 20123674 , 0 . 062758815 , - 0 . 043671819 } , { 0 . 084479675 , 0 . 17868517 , - 0 . 021185269 , 0 . 15711776 } , { 0 . 11862504 , 0 . 079985297 , 0 . 063556911 , 0 . 14639069 } } } , { { { 0 . 48018566 , 0 . 17712962 , 0 . 45065949 , 0 . 76214707 } , { 0 . 37788335 , 0 . 385421 , 0 . 24766167 , 0 . 3647243 } , { 0 . 45095873 , 0 . 2634498 , 0 . 37824131 , 0 . 10713483 } , { 0 . 18808611 , 0 . 27852978 , 0 . 23671202 , 0 . 23174978 } , { 0 . 39404781 , - 0 . 7399413 , 0 . 28511918 , 0 . 026007027 } , { 0 . 46587668 , 0 . 46802177 , 0 . 36697974 , 0 . 23706778 } , { 0 . 48925391 , 0 . 42086488 , 0 . 49570155 , 0 . 45137287 } , { 0 . 30655255 , 0 . 35196398 , 0 . 23019387 , 0 . 50586011 } , { 0 . 45798975 , 0 . 34137244 , 0 . 33289763 , 0 . 54218519 } , { 0 . 42271216 , 0 . 38700914 , 0 . 48791862 , 0 . 15025833 } , { 0 . 7282781 , 0 . 37956244 , 0 . 25156645 , 0 . 51632504 } , { 0 . 084933462 , 0 . 15576738 , 0 . 16469359 , 0 . 29684651 } , { 0 . 34570877 , 0 . 34912791 , 0 . 26663435 , 0 . 11188061 } , { 0 . 48552914 , 0 . 19012867 , 0 . 12677402 , 0 . 1234341 } , { 0 . 2190939 , 0 . 41431469 , 0 . 64823269 , 0 . 51846746 } , { 0 . 49289149 , 0 . 29829354 , 0 . 29090992 , 0 . 36465152 } , { 0 . 50568056 , 0 . 64150077 , 0 . 40217634 , 0 . 53523743 } , { 0 . 24945735 , 0 . 47058801 , 0 . 29099852 , 0 . 25452114 } , { 0 . 49039753 , 0 . 26327736 , 0 . 39431507 , 0 . 50632023 } , { 0 . 19678915 , 0 . 031547614 , 0 . 22295107 , 0 . 26300048 } , { 0 . 12409997 , 0 . 11506147 , 0 . 19327618 , 0 . 2174585 } , { 0 . 15319333 , 0 . 39177705 , 0 . 38498586 , 0 . 25972804 } , { 0 . 69027161 , 0 . 37279682 , 0 . 31143504 , 0 . 23440833 } , { 0 . 39682066 , 0 . 3156927 , 0 . 36369313 , 0 . 14308402 } } , { { 0 . 15030994 , 0 . 15410005 , 0 . 0072554408 , - 0 . 22242826 } , { - 0 . 032421729 , 0 . 22531436 , 0 . 22185899 , - 0 . 022703209 } , { 0 . 070341052 , 0 . 30237173 , 0 . 047916387 , 0 . 03629681 } , { - 0 . 024283222 , 0 . 075614195 , 0 . 013940033 , - 0 . 016841468 } , { 0 . 077729482 , 0 . 19455394 , - 0 . 02162282 , - 0 . 018761003 } , { - 0 . 22986895 , 0 . 18914992 , 0 . 14483608 , 0 . 11173921 } , { 0 . 14132894 , - 0 . 0081864768 , - 0 . 11405791 , 0 . 031777789 } , { 0 . 38775389 , 0 . 0085565642 , - 0 . 057167843 , 0 . 09784167 } , { 0 . 079102739 , 0 . 030530894 , 0 . 041954967 , 0 . 02957611 } , { 0 . 076915126 , 0 . 18656729 , 0 . 044218872 , 0 . 22478833 } , { 0 . 017173879 , 0 . 11961351 , - 0 . 085099523 , 0 . 22720323 } , { 0 . 030466202 , 0 . 095221887 , - 0 . 042982583 , - 0 . 069264747 } , { 0 . 041170442 , - 0 . 090598444 , - 0 . 021082598 , - 0 . 028016784 } , { - 0 . 082581617 , - 0 . 023712106 , 0 . 32427665 , 0 . 1010696 } , { 0 . 19197752 , 0 . 10900527 , - 0 . 0053794951 , 0 . 068553764 } , { 0 . 18674269 , 0 . 028895321 , - 0 . 053421028 , 0 . 063918058 } , { 0 . 044090722 , - 0 . 054247791 , 0 . 05585954 , - 0 . 13406746 } , { 0 . 08358642 , - 0 . 032301886 , 0 . 010371619 , 0 . 099505528 } , { 0 . 16467816 , 0 . 044994571 , - 0 . 0045949279 , 0 . 0626774 } , { 0 . 12942209 , 0 . 092097891 , 0 . 019866495 , 0 . 10340014 } , { 0 . 037094903 , 0 . 13829877 , 0 . 15116473 , - 0 . 048632499 } , { 0 . 10749044 , 0 . 14329542 , - 0 . 061272024 , - 0 . 1536028 } , { 0 . 097716907 , 0 . 044246181 , 0 . 056664419 , 0 . 15804873 } , { 0 . 031819999 , 0 . 10132976 , 0 . 079198524 , 0 . 017871462 } } , { { 0 . 056219172 , 0 . 08683492 , - 0 . 061488015 , 0 . 065746152 } , { 0 . 088983664 , 0 . 19773741 , - 0 . 096766599 , 0 . 16352101 } , { - 0 . 0097043787 , - 0 . 040925999 , 0 . 097458334 , 0 . 032319634 } , { - 0 . 024873518 , 0 . 057873123 , - 0 . 0059256291 , - 0 . 057498398 } , { - 0 . 13355098 , 0 . 39190863 , 0 . 017449142 , - 0 . 0076009344 } , { 0 . 10319658 , 0 . 22069551 , - 0 . 098795717 , 0 . 10603434 } , { 0 . 090765308 , 0 . 13803326 , - 0 . 070647945 , 0 . 14557561 } , { - 0 . 068457348 , 0 . 058955208 , - 0 . 050501105 , 0 . 02914144 } , { 0 . 10363866 , 0 . 060231993 , 0 . 027681685 , 0 . 079659088 } , { 0 . 01269983 , 0 . 11977996 , - 0 . 049648315 , 0 . 089882363 } , { - 0 . 072877286 , 0 . 019348792 , 0 . 13977764 , 0 . 055396044 } , { 0 . 028834456 , - 0 . 1084196 , - 0 . 0043985215 , - 0 . 072640844 } , { - 0 . 040232522 , 0 . 051835989 , - 0 . 02198193 , 0 . 016421295 } , { - 0 . 087848469 , - 0 . 04621504 , 0 . 099259188 , - 0 . 0025909067 } , { 0 . 3000131 , 0 . 10526775 , 0 . 016890366 , 0 . 12892588 } , { - 0 . 021028821 , - 0 . 024429075 , 0 . 088067677 , - 0 . 084594075 } , { 0 . 086861805 , - 0 . 045902006 , 0 . 0058222123 , - 0 . 0075466204 } , { 0 . 14411905 , 0 . 036488937 , 0 . 05091815 , 0 . 16385101 } , { 0 . 1576814 , 0 . 043890956 , - 0 . 064244298 , - 0 . 087234754 } , { - 0 . 071100004 , 0 . 16782304 , - 0 . 10860149 , - 0 . 1601076 } , { 0 . 032634641 , - 0 . 0025068263 , - 0 . 093802703 , - 0 . 076176546 } , { 0 . 1121451 , 0 . 15584236 , 0 . 070074778 , 0 . 083736091 } , { 0 . 16981897 , - 0 . 078106227 , 0 . 12480295 , - 0 . 0056807652 } , { - 0 . 20300117 , - 0 . 017467249 , 0 . 035504155 , 0 . 056546123 } } } } , { { { { 0 . 014994926 , 0 . 3118252 , 0 . 12179235 , - 0 . 2013765 } , { - 0 . 2622824 , 0 . 28086607 , 0 . 018805882 , 0 . 72058929 } , { - 0 . 0081002049 , - 0 . 28176506 , - 0 . 592214 , - 0 . 15032918 } , { 0 . 18913426 , - 0 . 24000825 , 0 . 0020279072 , - 0 . 54749128 } , { 0 . 010237954 , 0 . 76905205 , 0 . 80173664 , - 0 . 016024595 } , { - 0 . 53448318 , 0 . 31204229 , - 0 . 16183732 , 0 . 76857439 } , { - 0 . 57639279 , - 0 . 63719194 , - 0 . 71354849 , 0 . 56346054 } , { 0 . 49443258 , 0 . 15067585 , 0 . 31864726 , - 0 . 30570933 } , { - 0 . 20756322 , 0 . 2544828 , - 0 . 005298245 , 0 . 0073796841 } , { - 0 . 61822672 , 0 . 21508574 , 0 . 6362534 , 0 . 30433278 } , { - 0 . 0050327191 , - 0 . 278054 , - 0 . 3460806 , 0 . 29967778 } , { 0 . 33983098 , - 0 . 11715664 , - 0 . 21761592 , - 0 . 068273894 } , { 0 . 5550354 , 0 . 44369709 , 0 . 64019993 , - 0 . 026032291 } , { - 0 . 72587268 , - 0 . 33528197 , - 0 . 33592445 , 0 . 53027141 } , { - 0 . 47623191 , - 0 . 61767624 , - 0 . 61525655 , 0 . 37823554 } , { 0 . 82869964 , 0 . 219401 , - 0 . 018181789 , - 0 . 56937955 } , { - 0 . 051792934 , 0 . 3461701 , 0 . 20915925 , 0 . 078166496 } , { - 0 . 26705611 , 0 . 14439061 , 0 . 0055054648 , 0 . 463243 } , { - 0 . 0019649711 , - 0 . 34119962 , - 0 . 29306531 , - 0 . 040223173 } , { 0 . 29285811 , - 0 . 32824753 , - 0 . 24768208 , - 0 . 29676955 } , { 0 . 87604898 , 0 . 25374435 , 0 . 2341931 , - 0 . 77851996 } , { - 0 . 80404697 , 0 . 011122158 , 0 . 18899178 , 0 . 55592668 } , { - 0 . 78397618 , - 0 . 53690406 , - 0 . 59931185 , 0 . 62348293 } , { 0 . 54613799 , 0 . 080819658 , 0 . 12590931 , - 0 . 60614071 } } , { { - 0 . 12307869 , - 0 . 20242175 , 0 . 21530167 , - 0 . 15608553 } , { 0 . 00052208688 , 0 . 09998365 , - 0 . 067550225 , - 0 . 14009319 } , { 0 . 12621699 , - 0 . 089024022 , 0 . 022656689 , 0 . 18947331 } , { 0 . 34838897 , - 0 . 04936051 , 0 . 25527451 , - 0 . 18942819 } , { 0 . 013210249 , - 0 . 043957685 , - 0 . 19088103 , - 0 . 034189573 } , { - 0 . 0027790938 , - 0 . 026595097 , 0 . 087083287 , - 0 . 12513839 } , { - 0 . 038231564 , 0 . 013328425 , - 0 . 0091503894 , - 0 . 005743873 } , { 0 . 17205702 , - 0 . 14956835 , - 0 . 0088915291 , 0 . 18720588 } , { - 0 . 049670195 , 0 . 39532325 , 0 . 080260299 , 0 . 01811245 } , { 0 . 043555003 , - 0 . 30289197 , - 0 . 50878196 , 0 . 27306166 } , { 0 . 02555972 , - 0 . 0068359476 , 0 . 061097702 , - 0 . 43822038 } , { - 0 . 10926471 , 0 . 1870906 , 0 . 12419548 , 0 . 1245213 } , { - 0 . 012443149 , 0 . 040036941 , 0 . 18601483 , 0 . 02310445 } , { - 0 . 10442982 , 0 . 057455632 , 0 . 13475314 , - 0 . 0019859122 } , { - 0 . 068181593 , - 0 . 0033655904 , 0 . 01922998 , - 0 . 020393828 } , { - 0 . 10660626 , 0 . 0020812455 , 0 . 081209707 , 0 . 077131932 } , { 0 . 088733212 , - 0 . 10430986 , 0 . 45554817 , - 0 . 17113078 } , { 0 . 0046831409 , 0 . 13247549 , - 0 . 1077727 , 0 . 15382275 } , { 0 . 022346595 , 0 . 022924261 , - 0 . 35016323 , 0 . 2437608 } , { 0 . 029795657 , 0 . 23046877 , - 0 . 020493651 , - 0 . 33214749 } , { - 0 . 016101582 , 0 . 042296203 , 0 . 046779444 , 0 . 037412394 } , { - 0 . 02214903 , - 0 . 025218605 , 0 . 14797485 , - 0 . 051723623 } , { 0 . 021321783 , 0 . 010405115 , 0 . 0075476201 , 0 . 0082410917 } , { 0 . 040559796 , 0 . 027927916 , - 0 . 012812736 , - 0 . 0096642379 } } , { { - 0 . 055647079 , 0 . 017595207 , 0 . 34495838 , - 0 . 03055759 } , { - 0 . 058415094 , 0 . 027416036 , 0 . 18568916 , 0 . 13044498 } , { 0 . 01482217 , - 0 . 17300703 , 0 . 027540135 , - 0 . 2744944 } , { 0 . 25558424 , - 0 . 15324455 , - 0 . 29751197 , - 0 . 11422984 } , { - 0 . 068936732 , - 0 . 11425403 , 0 . 094767025 , - 0 . 0020892558 } , { 0 . 040887892 , 0 . 031622148 , - 0 . 095292456 , - 0 . 02460001 } , { - 0 . 0026237665 , 0 . 017734103 , 0 . 01213911 , 0 . 0056586962 } , { - 0 . 052138375 , 0 . 052245567 , 0 . 04608449 , - 0 . 043004468 } , { - 0 . 17693366 , 0 . 0021023738 , 0 . 13167397 , - 0 . 14062006 } , { - 0 . 20900333 , 0 . 0057695127 , 0 . 13057243 , 0 . 046715668 } , { - 0 . 020569928 , - 0 . 08439655 , - 0 . 09683347 , 0 . 038139385 } , { 0 . 18196242 , 0 . 44461908 , - 0 . 11388512 , - 0 . 12413082 } , { 0 . 072801844 , - 0 . 0017236427 , - 0 . 0026756083 , 0 . 049805114 } , { - 0 . 092195952 , - 0 . 0076195172 , - 0 . 22763849 , - 0 . 11320887 } , { 0 . 016234922 , 0 . 007258942 , 0 . 078535592 , - 0 . 084829275 } , { - 0 . 15320003 , 0 . 057490618 , - 0 . 16065455 , - 0 . 17063675 } , { - 0 . 012856124 , 0 . 024818957 , 0 . 097529739 , 0 . 11569844 } , { - 0 . 11141243 , 0 . 26677735 , 0 . 1319403 , - 0 . 15699502 } , { - 0 . 021128161 , - 0 . 12370585 , 0 . 056198856 , - 0 . 1836225 } , { - 0 . 01871806 , 0 . 025525037 , 0 . 063822152 , 0 . 066517944 } , { - 0 . 013759301 , 0 . 11401068 , - 0 . 04701374 , - 0 . 021321516 } , { 0 . 032714649 , - 3 . 161284e - 06 , 0 . 026930697 , 0 . 00019593482 } , { 0 . 10575127 , 0 . 016956425 , 0 . 016873291 , 0 . 0049304377 } , { - 0 . 11938883 , 0 . 31242334 , 0 . 29347156 , - 0 . 19514533 } } } , { { { - 0 . 17374661 , - 0 . 028781395 , - 0 . 25993234 , 0 . 27242277 } , { - 0 . 13675759 , - 0 . 62291002 , - 0 . 80742781 , 0 . 54260546 } , { 0 . 16876581 , - 0 . 052588487 , 0 . 22415557 , - 0 . 59669887 } , { 0 . 1769234 , 0 . 64210979 , 0 . 81157479 , - 0 . 2718564 } , { - 0 . 99873125 , - 0 . 013258174 , 0 . 58939675 , 0 . 99930085 } , { - 0 . 30883355 , - 0 . 71116337 , - 0 . 76218623 , 0 . 096388818 } , { 0 . 65749012 , - 0 . 54533843 , - 0 . 57508599 , - 0 . 70359398 } , { - 0 . 27406769 , 0 . 61006308 , 0 . 1873512 , 0 . 2563151 } , { - 0 . 78453523 , - 0 . 13585943 , - 0 . 048534939 , 0 . 02085237 } , { 0 . 40938527 , - 0 . 76981396 , - 0 . 42506866 , 0 . 22362984 } , { 0 . 29003079 , - 0 . 20624421 , 0 . 1151133 , - 0 . 50558933 } , { 0 . 0070051806 , 0 . 20763719 , 0 . 59485798 , - 0 . 61562639 } , { - 0 . 4371111 , 0 . 48314196 , 0 . 72981069 , 0 . 99889301 } , { 0 . 58257878 , - 0 . 8603979 , - 0 . 94188892 , - 0 . 83140889 } , { 0 . 71858167 , - 0 . 49534538 , - 0 . 63421799 , - 0 . 84488463 } , { 0 . 016158248 , 0 . 65330502 , 0 . 82883727 , - 0 . 127372 } , { - 0 . 50292264 , - 0 . 14848746 , - 0 . 20836533 , 0 . 2471481 } , { - 0 . 15815031 , - 0 . 63472031 , - 0 . 79826416 , 0 . 15325573 } , { - 0 . 010424343 , - 0 . 022843894 , 0 . 099730136 , - 0 . 26040744 } , { 0 . 15069433 , 0 . 31188588 , 0 . 63836617 , - 0 . 25234477 } , { - 0 . 36946506 , 0 . 92093529 , 0 . 96548808 , 0 . 62354203 } , { - 0 . 57070465 , - 0 . 99847512 , - 0 . 47855156 , - 0 . 079970605 } , { 0 . 077467525 , - 0 . 71134336 , - 0 . 67172579 , - 0 . 66364974 } , { - 0 . 27299386 , 0 . 89512951 , 0 . 61598356 , 0 . 49577277 } } , { { 0 . 070458859 , - 0 . 28774455 , 0 . 21287043 , - 0 . 094689772 } , { 0 . 0029548085 , - 0 . 31404605 , - 0 . 039280892 , - 0 . 3652277 } , { - 0 . 033729607 , 0 . 041215792 , 0 . 065844258 , - 0 . 21509418 } , { 0 . 39270582 , 0 . 067526811 , 0 . 15655351 , 0 . 053346856 } , { 0 . 052704394 , - 0 . 087801294 , 0 . 18655104 , 0 . 056114808 } , { - 0 . 074582751 , - 0 . 055177669 , - 0 . 22165519 , 0 . 13272162 } , { - 0 . 027850171 , 0 . 0029849066 , - 0 . 0062314784 , - 0 . 010484316 } , { 0 . 20753796 , - 0 . 0087111988 , - 0 . 13875075 , - 0 . 06137521 } , { 0 . 089744421 , 0 . 07271039 , 0 . 099417029 , - 0 . 22157272 } , { - 0 . 013209094 , 0 . 048633419 , - 0 . 26528065 , - 0 . 15253703 } , { 0 . 052922007 , 0 . 24859103 , 0 . 14406684 , 0 . 13857649 } , { 0 . 00096142813 , 0 . 32643367 , 0 . 17939549 , - 0 . 39761314 } , { 0 . 013505803 , - 0 . 036986517 , - 0 . 12729111 , 0 . 15459921 } , { - 0 . 00049722057 , - 0 . 047063275 , - 0 . 0018666598 , 0 . 1067114 } , { - 0 . 074221027 , - 0 . 00927958 , - 0 . 029535811 , - 0 . 024240068 } , { - 0 . 12387933 , 0 . 06626829 , 0 . 16422781 , 0 . 077740779 } , { 0 . 14560404 , - 0 . 082132455 , 0 . 027268021 , 0 . 18857832 } , { 0 . 10470732 , - 0 . 29519533 , - 0 . 23666419 , 0 . 10917064 } , { 0 . 042550279 , 0 . 02436036 , - 0 . 31865644 , - 0 . 024987356 } , { - 0 . 030434576 , 0 . 082115299 , 0 . 17770796 , 0 . 020944092 } , { - 0 . 17365377 , 0 . 13807361 , 0 . 12476029 , 0 . 072738061 } , { - 0 . 11503962 , - 0 . 04022554 , 0 . 028018434 , - 0 . 070211356 } , { - 0 . 043677907 , 0 . 0053361863 , 0 . 0039019898 , 0 . 0027489647 } , { 0 . 27060899 , - 0 . 0016552279 , 0 . 14166067 , - 0 . 25461265 } } , { { 0 . 014703402 , 0 . 094752279 , - 0 . 32162049 , 0 . 082335322 } , { - 0 . 31539882 , 0 . 44394592 , 0 . 44316202 , - 0 . 031456167 } , { - 0 . 024148679 , 0 . 082370612 , - 0 . 0031744796 , 0 . 098610537 } , { 0 . 46130367 , - 0 . 19989896 , - 0 . 56118891 , 0 . 11979937 } , { 0 . 11784636 , 0 . 079971516 , - 0 . 16977121 , 0 . 014922099 } , { 0 . 018367216 , - 0 . 076519762 , 0 . 13801492 , 0 . 039682415 } , { - 0 . 0027614728 , 0 . 0010389006 , - 0 . 023126227 , 0 . 0027068473 } , { 0 . 22249856 , - 0 . 071302328 , 0 . 23721977 , 0 . 10734273 } , { 0 . 41478408 , - 0 . 36611101 , 0 . 18031261 , - 0 . 11176768 } , { 0 . 15800457 , 0 . 23829725 , - 0 . 0016193556 , 0 . 2112867 } , { - 0 . 14793833 , - 0 . 15378785 , 0 . 0082778301 , 0 . 27105519 } , { - 0 . 064743588 , 0 . 44794816 , - 0 . 12599819 , 0 . 4310022 } , { 0 . 092725214 , 0 . 033947737 , 0 . 19969884 , 0 . 0072363359 } , { - 0 . 074190657 , 0 . 005985921 , 0 . 300818 , - 0 . 090919095 } , { 0 . 024238118 , - 0 . 010955859 , - 0 . 068086841 , - 0 . 021137349 } , { 0 . 12196721 , - 0 . 19977338 , - 0 . 64428422 , - 0 . 30808722 } , { 0 . 46567096 , - 0 . 042072501 , - 0 . 1778338 , 0 . 34294059 } , { - 0 . 32528695 , 0 . 25699981 , 0 . 49346557 , - 0 . 20743316 } , { 0 . 10422458 , 0 . 049488574 , 0 . 49098274 , - 0 . 34871439 } , { 0 . 16431875 , - 0 . 050748897 , - 0 . 18464312 , - 0 . 61695364 } , { - 0 . 1753479 , 0 . 033238479 , - 0 . 046267845 , - 0 . 012339883 } , { - 0 . 16098841 , 0 . 080519992 , - 0 . 11793031 , 0 . 036790025 } , { 0 . 017193144 , - 0 . 0029212372 , - 0 . 0044153187 , - 0 . 0057094316 } , { 0 . 23481771 , - 0 . 1556448 , - 0 . 18775429 , - 0 . 013697353 } } } , { { { 0 . 98467622 , 0 . 94970347 , 0 . 95791534 , 0 . 9408684 } , { 0 . 95525144 , 0 . 73013516 , 0 . 58966657 , 0 . 43166004 } , { 0 . 98562289 , 0 . 95804118 , 0 . 77397471 , 0 . 78825859 } , { 0 . 96588112 , 0 . 72807352 , 0 . 58424502 , 0 . 79142113 } , { - 0 . 049305848 , 0 . 63904864 , 0 . 099145551 , - 0 . 03377918 } , { 0 . 78673348 , 0 . 62998117 , 0 . 62680207 , 0 . 63245759 } , { 0 . 48526085 , 0 . 544603 , 0 . 40015579 , 0 . 43297544 } , { 0 . 82487776 , 0 . 77789448 , 0 . 92917353 , 0 . 91697567 } , { 0 . 58431326 , 0 . 95748667 , 0 . 99880743 , 0 . 99975533 } , { 0 . 67096902 , 0 . 60093643 , 0 . 64381538 , 0 . 92594344 } , { 0 . 95700408 , 0 . 93816272 , 0 . 93111608 , 0 . 80905665 } , { 0 . 94046044 , 0 . 97116483 , 0 . 77381347 , 0 . 78507504 } , { 0 . 7077214 , 0 . 7547892 , 0 . 23983411 , - 0 . 039180128 } , { 0 . 3656649 , 0 . 38379871 , - 0 . 00015338393 , 0 . 16604667 } , { 0 . 50679735 , 0 . 6108265 , 0 . 46821675 , 0 . 37829596 } , { 0 . 55946029 , 0 . 72460731 , 0 . 55919425 , 0 . 81214734 } , { 0 . 86277825 , 0 . 92634645 , 0 . 95542467 , 0 . 96581976 } , { 0 . 95061533 , 0 . 75913205 , 0 . 60228234 , 0 . 87287949 } , { 0 . 99994373 , 0 . 93971324 , 0 . 95087677 , 0 . 96466059 } , { 0 . 9442062 , 0 . 89161694 , 0 . 72879505 , 0 . 92100486 } , { 0 . 30989313 , 0 . 29579046 , 0 . 11395771 , 0 . 071428407 } , { 0 . 16674735 , - 0 . 054071458 , 0 . 85747916 , 0 . 82737551 } , { 0 . 61593841 , 0 . 45356879 , 0 . 43544204 , 0 . 41332561 } , { 0 . 79196443 , 0 . 43841915 , 0 . 77763172 , 0 . 62193473 } } , { { 0 . 028699614 , 0 . 071974788 , - 0 . 028868668 , 0 . 030119772 } , { - 0 . 16988515 , - 0 . 35713152 , 0 . 36877151 , 0 . 37172103 } , { 0 . 024472009 , 0 . 10373643 , 0 . 052160621 , - 0 . 12998364 } , { 0 . 051999909 , - 0 . 1688679 , 0 . 05813266 , - 0 . 11063347 } , { 0 . 026373007 , 0 . 067310776 , 0 . 34433164 , 0 . 0017481699 } , { - 0 . 017659611 , - 0 . 10215276 , - 0 . 23736187 , 0 . 12678732 } , { - 0 . 0019097928 , 0 . 02067204 , - 0 . 030447136 , - 0 . 0093192388 } , { 0 . 10615435 , 0 . 11124023 , 0 . 04473958 , 0 . 14369936 } , { 0 . 14791062 , - 0 . 034502091 , 0 . 041456555 , 0 . 06737059 } , { 0 . 22389399 , 0 . 2668048 , 0 . 25742349 , 0 . 03724758 } , { 0 . 0046009946 , 0 . 066632032 , 0 . 097957775 , 0 . 22969631 } , { 0 . 043253167 , - 0 . 013638494 , 0 . 071328387 , - 0 . 19249903 } , { - 0 . 023561087 , 0 . 011490741 , 0 . 19824644 , - 0 . 04133258 } , { - 0 . 057507532 , - 0 . 039265903 , 0 . 060469313 , 0 . 37300659 } , { 0 . 027051207 , - 0 . 0086784396 , - 0 . 0055877341 , - 0 . 0315352 } , { 0 . 15724931 , 0 . 0099485187 , 0 . 22462997 , 0 . 14112999 } , { 0 . 13909905 , 0 . 026199511 , - 0 . 12430815 , - 0 . 076900423 } , { - 0 . 022327596 , - 0 . 1975812 , 0 . 49862652 , - 0 . 096026553 } , { 0 . 076782007 , 0 . 041598482 , 0 . 0033451155 , 0 . 039947963 } , { 0 . 005353589 , 0 . 070993946 , 0 . 0068174778 , - 0 . 17805261 } , { - 0 . 059912765 , - 0 . 17027417 , - 0 . 060069718 , 0 . 1561139 } , { 0 . 017122435 , 0 . 048532637 , - 0 . 05315926 , 0 . 066962855 } , { 0 . 058014377 , 0 . 021874362 , 0 . 017248667 , - 0 . 0069413843 } , { 0 . 099274028 , 0 . 040622241 , 0 . 040435904 , 0 . 14191123 } } , { { - 0 . 13453832 , 0 . 071519908 , - 0 . 1597656 , - 0 . 030758273 } , { - 0 . 13511715 , 0 . 32373425 , 0 . 35851035 , - 0 . 18685481 } , { 0 . 021440457 , 0 . 034442875 , 0 . 14324368 , 0 . 15754565 } , { - 0 . 061440371 , 0 . 16837735 , 0 . 47887644 , - 0 . 036265812 } , { 0 . 55060811 , 0 . 14095672 , 0 . 13077418 , 0 . 25515565 } , { - 0 . 084599968 , - 0 . 084002143 , 0 . 1542308 , 0 . 044223437 } , { 0 . 0017727822 , 0 . 025149715 , - 0 . 025479364 , - 0 . 0023658361 } , { 0 . 1619123 , 0 . 069159159 , - 0 . 016343512 , 0 . 026108175 } , { 0 . 3296525 , 0 . 029456656 , 0 . 039715069 , 0 . 015958704 } , { - 0 . 093419591 , 0 . 37051381 , - 0 . 063182977 , - 0 . 017764112 } , { 0 . 11962535 , 0 . 062511772 , - 0 . 070445145 , 0 . 27768911 } , { 0 . 07458833 , - 0 . 16218828 , 0 . 064111239 , 0 . 43889373 } , { - 0 . 0326486 , - 0 . 03666828 , - 0 . 17597139 , 0 . 34213144 } , { 0 . 061334301 , - 0 . 0099525239 , 0 . 21497301 , 0 . 0074569296 } , { - 0 . 016749445 , 0 . 00054557189 , 0 . 040331287 , 0 . 066200794 } , { 0 . 20620866 , 0 . 25268529 , 0 . 46594276 , 0 . 059651923 } , { 0 . 15170896 , 0 . 041438057 , 0 . 021708506 , - 0 . 15049245 } , { - 0 . 14317538 , 0 . 13548996 , 0 . 37297491 , 0 . 13718874 } , { 0 . 053339004 , 0 . 015014013 , - 0 . 10418356 , - 0 . 13598877 } , { - 0 . 02227412 , 0 . 045548464 , 0 . 21534467 , - 0 . 23828118 } , { - 0 . 055326885 , 0 . 11851609 , 0 . 28938409 , 0 . 041373996 } , { - 0 . 1219532 , 0 . 57338554 , - 0 . 094571555 , 0 . 025008596 } , { 0 . 070380772 , 0 . 016993506 , 0 . 018073937 , - 0 . 015404818 } , { 0 . 17033841 , 0 . 12449473 , 0 . 10847869 , - 0 . 11141982 } } } , { { { 4 . 409738 , 4 . 5071479 , 5 . 4761817 , 5 . 3214091 } , { 5 . 3741435 , 4 . 6270256 , 5 . 4786338 , 5 . 323679 } , { 4 . 305776 , 4 . 4890731 , 4 . 6894257 , 4 . 6068436 } , { 5 . 4930574 , 4 . 9116386 , 5 . 4097636 , 4 . 9225404 } , { 5 . 1861828 , 5 . 5144226 , 5 . 1307797 , 5 . 0804212 } , { 6 . 1194597 , 6 . 0655136 , 5 . 7369562 , 6 . 1076578 } , { 6 . 9549598 , 6 . 9281578 , 6 . 9549598 , 6 . 9549598 } , { 4 . 5030565 , 4 . 5849566 , 4 . 4830953 , 4 . 4904323 } , { 5 . 3629211 , 5 . 5524848 , 4 . 5719135 , 4 . 9103175 } , { 4 . 8906163 , 5 . 3972226 , 4 . 8806206 , 5 . 1834202 } , { 4 . 5047396 , 4 . 5984947 , 4 . 7039612 , 4 . 3422371 } , { 4 . 5956963 , 5 . 6294962 , 4 . 46025 , 4 . 4827131 } , { 5 . 8454206 , 6 . 000743 , 5 . 4594428 , 4 . 9952614 } , { 6 . 09642 , 6 . 3979283 , 4 . 9784963 , 5 . 6878449 } , { 6 . 9549598 , 6 . 9752898 , 6 . 9549598 , 6 . 9549598 } , { 6 . 2053562 , 4 . 9984547 , 5 . 3887395 , 4 . 6221036 } , { 4 . 5265196 , 4 . 3684629 , 5 . 5819288 , 5 . 4957366 } , { 5 . 2220057 , 4 . 6118907 , 5 . 5046208 , 4 . 9190037 } , { 4 . 3408178 , 4 . 4980303 , 5 . 4937404 , 5 . 6154153 } , { 4 . 4802186 , 4 . 4666194 , 4 . 8546878 , 5 . 1764252 } , { 5 . 7384024 , 5 . 9048089 , 5 . 4636107 , 5 . 0807017 } , { 5 . 1013817 , 5 . 2237041 , 6 . 0338955 , 5 . 8869417 } , { 6 . 9414339 , 6 . 9549598 , 6 . 9549598 , 6 . 9549598 } , { 4 . 3368412 , 4 . 9692663 , 4 . 7090567 , 4 . 9023075 } } , { { 0 . 0093525884 , - 0 . 33796029 , - 0 . 4366682 , - 0 . 18161326 } , { - 0 . 34446047 , 0 . 10854359 , - 0 . 61563912 , - 0 . 16514117 } , { 0 . 055849315 , 0 . 093045585 , 0 . 36722184 , 0 . 085665647 } , { - 0 . 21881508 , - 0 . 036846235 , - 0 . 25226403 , - 0 . 012790033 } , { - 0 . 14697546 , - 0 . 026656628 , 0 . 2559775 , 0 . 026279081 } , { 0 . 073189287 , - 0 . 074472165 , - 0 . 15439557 , 0 . 020907645 } , { 0 , - 0 . 015078298 , 0 , 0 } , { 0 . 027540893 , - 0 . 30876053 , - 0 . 15680794 , - 0 . 18470107 } , { - 0 . 072547269 , - 0 . 019227086 , - 0 . 26735769 , - 0 . 1362069 } , { 0 . 36907279 , - 0 . 28005156 , 0 . 01966203 , - 0 . 10277819 } , { - 0 . 26755862 , 0 . 066747173 , 0 . 60834173 , - 0 . 23356165 } , { - 0 . 12357338 , - 0 . 41742338 , 0 . 081840746 , - 0 . 14596222 } , { - 0 . 068599762 , - 0 . 004402392 , - 0 . 17192993 , - 0 . 15797464 } , { - 0 . 072923207 , - 0 . 02555551 , - 0 . 21075071 , 0 . 047272919 } , { 0 , 0 . 0115085 , 0 , 0 } , { 0 . 32527558 , 0 . 066048741 , - 0 . 28639187 , 0 . 45171914 } , { - 0 . 158086 , - 0 . 049098981 , - 0 . 17226122 , - 0 . 50289857 } , { - 0 . 39456648 , 0 . 031970902 , - 0 . 74883626 , 0 . 20536003 } , { 0 . 22864705 , - 0 . 0095988927 , - 0 . 1155595 , - 0 . 06240073 } , { 0 . 12336497 , - 0 . 34128076 , 0 . 34341316 , 0 . 083678547 } , { - 0 . 032718317 , 0 . 076359349 , - 0 . 30099369 , - 0 . 016865529 } , { - 0 . 23491753 , - 0 . 17228011 , - 0 . 044893186 , - 0 . 057411459 } , { - 0 . 0077848677 , 0 , 0 , 0 } , { - 0 . 18713605 , - 0 . 11612415 , 0 . 30907006 , 0 . 064707406 } } , { { - 0 . 20768494 , - 0 . 15642062 , - 0 . 079474216 , - 0 . 020948121 } , { - 0 . 18767308 , - 0 . 013722599 , 0 . 15827086 , - 0 . 27421942 } , { - 0 . 11484158 , - 0 . 29325715 , 0 . 24426149 , 0 . 34598577 } , { - 0 . 095599056 , 0 . 16784413 , 0 . 23369965 , 0 . 15036114 } , { 0 . 058496274 , - 0 . 064565923 , - 0 . 076598803 , - 0 . 11988702 } , { - 0 . 03406356 , - 0 . 010863931 , - 0 . 036116475 , 0 . 0077051595 } , { 0 , - 0 . 015078298 , 0 , 0 } , { - 0 . 21271534 , 0 . 31678528 , 0 . 084310434 , - 0 . 039787477 } , { 0 . 057420352 , - 0 . 60894321 , - 0 . 14275706 , - 0 . 29178151 } , { - 0 . 21477227 , 0 . 091254596 , - 0 . 053659362 , - 0 . 13299553 } , { - 0 . 24972574 , 0 . 22261101 , - 0 . 59415755 , - 0 . 13299464 } , { - 0 . 406027 , 0 . 15018847 , 0 . 33281927 , 0 . 28006105 } , { - 0 . 033198856 , 0 . 013081228 , 0 . 0098634494 , - 0 . 18858267 } , { - 0 . 16914457 , - 0 . 014917022 , - 0 . 15618156 , 0 . 038961385 } , { 0 , 0 . 0115085 , 0 , 0 } , { 0 . 047340338 , - 0 . 052961301 , 0 . 30193278 , 0 . 38564757 } , { - 0 . 2009302 , - 0 . 15247105 , - 0 . 32333852 , 0 . 22878398 } , { - 0 . 22934017 , 0 . 022888443 , 0 . 30911154 , - 0 . 12420416 } , { 0 . 21191356 , - 0 . 33281926 , - 0 . 13523708 , - 0 . 038546557 } , { 0 . 28507859 , - 0 . 012777666 , 0 . 16285544 , - 0 . 12612215 } , { - 0 . 057034227 , 0 . 01719448 , - 0 . 037892291 , - 0 . 13064036 } , { - 0 . 075888865 , 0 . 041589292 , 0 . 0089100653 , - 0 . 10775402 } , { 0 . 0075560462 , 0 , 0 , 0 } , { - 0 . 18120766 , 0 . 16485298 , 0 . 58949587 , 0 . 072313493 } } } , { { { 0 . 60381773 , 0 . 64633179 , 0 . 92301353 , 0 . 23720177 } , { 1 . 1128727 , 0 . 42172315 , 1 . 6605811 , 0 . 22066721 } , { 0 . 55829912 , 0 . 7107351 , 0 . 47437673 , 0 . 53646626 } , { 0 . 75684406 , 0 . 65607146 , 1 . 5264507 , 0 . 12817954 } , { - 0 . 25070514 , 0 . 30263175 , - 0 . 21070678 , - 0 . 2264813 } , { - 0 . 24745858 , - 0 . 26801252 , 0 . 2750925 , 0 . 055035565 } , { - 0 . 018769156 , - 0 . 066023008 , 0 . 10111114 , 0 . 0089232736 } , { 0 . 41152465 , 0 . 52508091 , 0 . 4161358 , 0 . 39058287 } , { 0 . 90919582 , 1 . 2448772 , 0 . 61547497 , 0 . 51303689 } , { 0 . 2973136 , 1 . 2348603 , 0 . 24154398 , 0 . 76087607 } , { 0 . 23369317 , 0 . 68368068 , 0 . 81024353 , 0 . 35451079 } , { 0 . 69272073 , 0 . 47014545 , 0 . 61401877 , 0 . 43768641 } , { - 0 . 44449894 , - 0 . 10123077 , - 0 . 19173956 , - 0 . 15811184 } , { - 0 . 089717 , - 0 . 068601549 , - 0 . 16704813 , - 0 . 29761406 } , { 0 . 0055968308 , - 0 . 089855929 , - 0 . 087150641 , 0 . 2244144 } , { 0 . 38902787 , 0 . 62620686 , 1 . 3314901 , 0 . 26038797 } , { 0 . 16776511 , 0 . 32722251 , 0 . 71914611 , 0 . 53556119 } , { 0 . 63106992 , 0 . 46256454 , 1 . 785895 , 0 . 17339911 } , { 0 . 72516261 , 0 . 44941094 , 0 . 81174974 , 0 . 61247129 } , { 0 . 56877815 , 0 . 20989179 , 0 . 7607991 , 0 . 017998645 } , { 0 . 016372087 , 0 . 26062407 , - 0 . 32771461 , - 0 . 075930098 } , { - 0 . 11957223 , - 0 . 22579003 , - 0 . 42587945 , - 0 . 0015549589 } , { 0 . 0049992009 , 0 . 053511694 , 0 . 00053268274 , 0 . 022778575 } , { 0 . 19356675 , 0 . 5564623 , 0 . 74981777 , 0 . 28733119 } } , { { 0 . 017029304 , 0 . 22690356 , 0 . 25927682 , - 0 . 048136042 } , { 0 . 52936856 , - 0 . 26082526 , 0 . 12568074 , - 0 . 046727529 } , { 0 . 08949554 , - 0 . 019090555 , 0 . 31477592 , - 0 . 067513409 } , { 0 . 056302335 , - 0 . 011819435 , - 0 . 063621104 , 0 . 27092306 } , { 0 . 053971592 , - 0 . 17913246 , - 0 . 14991651 , - 0 . 044263405 } , { 0 . 29037749 , - 0 . 040498369 , - 0 . 33600753 , 0 . 16250066 } , { - 0 . 067102844 , - 0 . 17843768 , 0 . 033172168 , 0 . 13638573 } , { 0 . 057127881 , - 0 . 044468822 , 0 . 33005778 , 0 . 34775491 } , { - 0 . 14300931 , 0 . 022121077 , - 0 . 045281831 , - 0 . 065216583 } , { 0 . 084931489 , 0 . 06688461 , 0 . 15758114 , - 0 . 091330485 } , { - 0 . 014274888 , 0 . 29139103 , 0 . 089163749 , - 0 . 18005467 } , { - 0 . 2191522 , - 0 . 1333803 , - 0 . 31948964 , - 0 . 28536602 } , { 0 . 20298891 , - 0 . 0031882515 , - 0 . 15749696 , - 0 . 014977715 } , { - 0 . 14016857 , - 0 . 17278064 , 0 . 01369474 , 0 . 10971499 } , { 0 . 018219806 , 0 . 080447764 , 0 . 0056022696 , - 0 . 043028475 } , { - 0 . 076556403 , - 0 . 13038184 , - 0 . 23788273 , 0 . 5849635 } , { 0 . 1038427 , 0 . 18199702 , 0 . 35294355 , - 0 . 0023601311 } , { 0 . 22294845 , - 0 . 37427713 , 0 . 2907529 , 0 . 26234219 } , { 0 . 40809306 , 0 . 12982813 , 0 . 42857338 , 0 . 14064303 } , { 0 . 4265028 , 0 . 18710053 , 0 . 15310514 , 0 . 067551813 } , { - 0 . 18986488 , - 0 . 029676062 , - 0 . 087045959 , - 0 . 14788626 } , { - 0 . 07865478 , 0 . 011558295 , - 0 . 018262356 , 0 . 38992629 } , { 0 . 22297641 , 0 . 072192947 , 0 . 064119712 , 0 . 12862555 } , { - 0 . 069262467 , - 0 . 14990585 , 0 . 31342655 , - 0 . 15002022 } } , { { 0 . 25288162 , - 0 . 096551539 , 0 . 051695506 , 0 . 20925392 } , { 0 . 23093904 , 0 . 096712594 , 0 . 19826434 , 0 . 32530694 } , { 0 . 14114785 , 0 . 071010138 , - 0 . 17642029 , 0 . 092260082 } , { 0 . 39001648 , - 0 . 17666595 , 0 . 088397252 , 0 . 1462816 } , { 0 . 12484597 , 0 . 066920676 , - 0 . 16116194 , 0 . 21758387 } , { 0 . 15625272 , - 0 . 00043631439 , - 0 . 07868976 , - 0 . 19261141 } , { - 0 . 0142415 , 0 . 06356153 , 0 . 026276923 , - 0 . 024546668 } , { 0 . 097089221 , 0 . 085426402 , 0 . 11936115 , 0 . 012042542 } , { 0 . 52509109 , - 0 . 22465399 , - 0 . 11490612 , 0 . 023562122 } , { - 0 . 12418278 , 0 . 11985465 , 0 . 087804943 , 0 . 25283464 } , { 0 . 10716753 , - 0 . 036426901 , 0 . 2469409 , - 0 . 095816257 } , { - 0 . 095364501 , 0 . 14001518 , - 0 . 068636804 , - 0 . 082487255 } , { 0 . 074490355 , 0 . 25323233 , 0 . 17863748 , 0 . 12482145 } , { - 0 . 019616587 , - 0 . 0053326518 , 0 . 047558858 , 0 . 066104462 } , { 0 . 12647102 , 0 . 25712368 , 0 . 12306783 , - 0 . 050252261 } , { - 0 . 13375041 , 0 . 17825067 , 0 . 026649645 , - 0 . 33338076 } , { 0 . 16384463 , - 0 . 022241979 , 0 . 17817325 , 0 . 6808721 } , { 0 . 42075944 , - 0 . 024292721 , - 0 . 11323318 , 0 . 45027063 } , { - 0 . 023953485 , 0 . 25719992 , 0 . 28680108 , 0 . 33600529 } , { 0 . 013445546 , 0 . 22504275 , 0 . 17408162 , 0 . 52860686 } , { - 0 . 098839039 , - 0 . 27017244 , 0 . 10293505 , - 0 . 012472685 } , { 0 . 074267375 , - 0 . 0056418849 , 0 . 17632358 , 0 . 21754089 } , { 0 . 1491061 , 0 . 017927571 , - 0 . 0217757 , - 0 . 0039381966 } , { 0 . 067239102 , - 0 . 74624136 , 0 . 12992555 , - 0 . 058866581 } } } } , { { { { 0 . 1270204 , 0 . 7650174 , 0 . 55252173 , 0 . 05956498 } , { - 0 . 36870832 , 0 . 31227245 , 0 . 52167466 , 0 . 4282174 } , { - 0 . 036761861 , - 0 . 5477415 , - 0 . 76091563 , - 0 . 37583127 } , { 0 . 17129434 , - 0 . 14281209 , - 0 . 40463148 , - 0 . 56367877 } , { 0 . 07429238 , 0 . 45420144 , 0 . 41919765 , 0 . 019225986 } , { - 0 . 44125436 , - 0 . 05567539 , 0 . 080551064 , 0 . 54444995 } , { - 0 . 36600455 , - 0 . 55359309 , - 0 . 3290331 , 0 . 33946169 } , { 0 . 65253747 , 0 . 015186649 , 0 . 0665303 , - 0 . 64649501 } , { 0 . 05392469 , 0 . 54355001 , 0 . 7539307 , - 0 . 41089455 } , { - 0 . 29264863 , 0 . 49684721 , 0 . 39184208 , 0 . 47737193 } , { 0 . 10885354 , - 0 . 80803227 , - 0 . 7443769 , - 0 . 3736688 } , { 0 . 1939378 , - 0 . 079590275 , - 0 . 42241709 , - 0 . 75536039 } , { 0 . 44776697 , 0 . 44884546 , 0 . 427965 , 0 . 3297221 } , { - 0 . 34595785 , 0 . 27723463 , 0 . 12245317 , 0 . 43884357 } , { 0 . 18467758 , - 0 . 55582608 , - 0 . 99421464 , - 0 . 0096027817 } , { 0 . 6672057 , - 0 . 038103784 , - 0 . 048616141 , - 0 . 68508055 } , { - 0 . 016615937 , 0 . 62001729 , 0 . 50530563 , - 0 . 22211425 } , { - 0 . 16823123 , 0 . 31934529 , 0 . 47092187 , 0 . 4884373 } , { 0 . 03194189 , - 0 . 5624624 , - 0 . 44688229 , 0 . 223814 } , { 0 . 17828041 , - 0 . 080017082 , - 0 . 44239439 , - 0 . 46726625 } , { 0 . 19895649 , 0 . 82568772 , 0 . 47859751 , 0 . 064443297 } , { - 0 . 47464217 , 0 . 011895223 , 0 . 01123465 , - 0 . 010697203 } , { - 0 . 17670677 , - 0 . 66931423 , - 0 . 5814681 , - 0 . 01325001 } , { 0 . 65193874 , - 0 . 010713062 , - 0 . 007915928 , - 0 . 65520853 } } , { { - 0 . 01027431 , - 0 . 0019056004 , 0 . 0020213958 , 0 . 0064495753 } , { 0 . 0058416688 , 0 . 0051314639 , 0 . 021497114 , 0 . 005870592 } , { - 0 . 00035518612 , - 0 . 00087553938 , - 0 . 0029318969 , 0 . 0087577986 } , { - 0 . 0048770476 , - 0 . 015949665 , - 0 . 034816051 , - 0 . 006104917 } , { 0 . 0015371362 , - 0 . 0012591621 , 0 . 01241148 , 0 . 00096621463 } , { 0 . 0032416133 , 0 . 021025709 , 0 . 0036344622 , 0 . 0015436078 } , { - 0 . 0093946276 , 0 . 0046564763 , 0 . 028177476 , - 0 . 01022744 } , { 0 . 00014675555 , 0 . 030031482 , - 0 . 0092302407 , - 0 . 001999398 } , { - 0 . 049980321 , 0 . 024752279 , 0 . 016684689 , - 0 . 0045230976 } , { 0 . 0067493834 , 0 . 014071508 , 0 . 0079316435 , 0 . 034593704 } , { 0 . 01971715 , - 0 . 0037227013 , - 0 . 013430278 , - 0 . 024257585 } , { - 0 . 004342319 , 0 . 024001878 , - 0 . 013356442 , - 0 . 022792018 } , { - 0 . 0051709665 , - 0 . 017029547 , 0 . 040567567 , 0 . 0052520812 } , { 0 . 0090399102 , 0 . 0079604733 , 0 . 00018765016 , - 0 . 0092868977 } , { - 0 . 020304032 , 0 . 0056590257 , - 0 . 0045373063 , - 0 . 018653318 } , { - 9 . 9636934e - 05 , 0 . 002001886 , 0 . 0046843544 , 0 . 0055608043 } , { 0 . 0018025744 , - 0 . 0025962216 , 0 . 0068285574 , - 0 . 014851062 } , { 0 . 00041645221 , 0 . 0054738242 , 0 . 0076769026 , - 0 . 013419208 } , { 0 . 0038347099 , - 0 . 0042555066 , - 0 . 0066470075 , 0 . 0039146778 } , { - 0 . 009084153 , 0 . 024461537 , 0 . 0034578066 , - 0 . 0054827001 } , { 0 . 0033463477 , 0 . 0045594748 , 0 . 00037604935 , - 0 . 01571513 } , { - 0 . 012589588 , 0 . 029678359 , - 0 . 019924871 , - 0 . 004708459 } , { - 0 . 0002642682 , - 0 . 0051057336 , - 0 . 0042867302 , - 0 . 00041141781 } , { - 0 . 00086487068 , - 0 . 0025170841 , 0 . 0030062196 , - 0 . 0030385417 } } , { { - 0 . 01027431 , - 0 . 0019056004 , 0 . 0020213958 , 0 . 0064495753 } , { 0 . 0058416688 , 0 . 0051314639 , 0 . 021497114 , 0 . 005870592 } , { - 0 . 00035518612 , - 0 . 00087553938 , - 0 . 0029318969 , 0 . 0087577986 } , { - 0 . 0048770476 , - 0 . 015949665 , - 0 . 034816051 , - 0 . 006104917 } , { 0 . 0015371362 , - 0 . 0012591621 , 0 . 01241148 , 0 . 00096621463 } , { 0 . 0032416133 , 0 . 021025709 , 0 . 0036344622 , 0 . 0015436078 } , { - 0 . 0093946276 , 0 . 0046564763 , 0 . 028177476 , - 0 . 01022744 } , { 0 . 00014675555 , 0 . 030031482 , - 0 . 0092302407 , - 0 . 001999398 } , { - 0 . 049980321 , 0 . 024752279 , 0 . 016684689 , - 0 . 0045230976 } , { 0 . 0067493834 , 0 . 014071508 , 0 . 0079316435 , 0 . 034593704 } , { 0 . 01971715 , - 0 . 0037227013 , - 0 . 013430278 , - 0 . 024257585 } , { - 0 . 004342319 , 0 . 024001878 , - 0 . 013356442 , - 0 . 022792018 } , { - 0 . 0051709665 , - 0 . 017029547 , 0 . 040567567 , 0 . 0052520812 } , { 0 . 0090399102 , 0 . 0079604733 , 0 . 00018765016 , - 0 . 0092868977 } , { - 0 . 020304032 , 0 . 0056590257 , - 0 . 0045373063 , - 0 . 018653318 } , { - 9 . 9636934e - 05 , 0 . 002001886 , 0 . 0046843544 , 0 . 0055608043 } , { 0 . 0018025744 , - 0 . 0025962216 , 0 . 0068285574 , - 0 . 014851062 } , { 0 . 00041645221 , 0 . 0054738242 , 0 . 0076769026 , - 0 . 013419208 } , { 0 . 0038347099 , - 0 . 0042555066 , - 0 . 0066470075 , 0 . 0039146778 } , { - 0 . 009084153 , 0 . 024461537 , 0 . 0034578066 , - 0 . 0054827001 } , { 0 . 0033463477 , 0 . 0045594748 , 0 . 00037604935 , - 0 . 01571513 } , { - 0 . 012589588 , 0 . 029678359 , - 0 . 019924871 , - 0 . 004708459 } , { - 0 . 0002642682 , - 0 . 0051057336 , - 0 . 0042867302 , - 0 . 00041141781 } , { - 0 . 00086487068 , - 0 . 0025170841 , 0 . 0030062196 , - 0 . 0030385417 } } } , { { { - 0 . 68772793 , 0 . 19029367 , - 0 . 17427646 , 0 . 60300616 } , { - 0 . 29980532 , - 0 . 22397537 , - 0 . 4071009 , 0 . 36277983 } , { 0 . 75628069 , - 0 . 13426242 , 0 . 13645381 , - 0 . 74653491 } , { 0 . 14891408 , - 0 . 13497977 , 0 . 36807879 , - 0 . 39814386 } , { - 0 . 20608987 , - 0 . 076497863 , - 0 . 19510375 , 0 . 34604256 } , { - 0 . 02421123 , - 0 . 4588774 , - 0 . 64965351 , 0 . 083039161 } , { 0 . 51918764 , - 0 . 30614677 , - 0 . 25791921 , - 0 . 40837612 } , { 0 . 028860181 , 0 . 63152733 , 0 . 5876224 , - 0 . 033139773 } , { - 0 . 63418144 , 0 . 046874151 , 0 . 24431924 , 0 . 71662556 } , { - 0 . 29088451 , - 0 . 21455586 , - 0 . 73980807 , 0 . 65038559 } , { 0 . 78663226 , 0 . 00020858525 , 0 . 40361403 , - 0 . 75720144 } , { 0 . 1998276 , 0 . 54590973 , 0 . 1773378 , - 0 . 35464319 } , { - 0 . 40236144 , 0 . 31362578 , - 0 . 34406026 , 0 . 38120073 } , { - 0 . 27845549 , - 0 . 46862161 , - 0 . 47141499 , 0 . 095899189 } , { 0 . 6004921 , 0 . 28051621 , - 0 . 011378178 , - 0 . 98141078 } , { 0 . 032724674 , 0 . 66798127 , 0 . 66430425 , - 0 . 05209965 } , { - 0 . 59603974 , - 0 . 083198329 , 0 . 34616224 , 0 . 42082916 } , { - 0 . 14262632 , - 0 . 21418442 , - 0 . 37504914 , 0 . 32676687 } , { 0 . 58204273 , 0 . 0067537174 , - 0 . 35923481 , - 0 . 40792038 } , { 0 . 15607366 , 0 . 17215007 , 0 . 34414936 , - 0 . 33566945 } , { - 0 . 44862333 , 0 . 004919013 , 0 . 0076768115 , 0 . 41897935 } , { - 0 . 022062848 , - 0 . 39695079 , - 0 . 0062786656 , 0 . 042925103 } , { 0 . 65953535 , - 0 . 15521993 , 0 . 011867978 , - 0 . 57721165 } , { 0 . 031305912 , 0 . 65627006 , 0 . 66779002 , - 0 . 029815636 } } , { { 0 . 011457792 , - 0 . 011774949 , - 0 . 012205337 , 0 . 0048139052 } , { - 0 . 024024566 , 0 . 018313023 , - 0 . 023210623 , - 0 . 0046351547 } , { 0 . 0039133571 , 0 . 0046801024 , - 0 . 020590099 , - 0 . 0018568631 } , { - 0 . 015369931 , - 0 . 0092621276 , - 0 . 026149742 , 0 . 0010335971 } , { 0 . 032555144 , - 0 . 01336897 , - 0 . 022733265 , - 0 . 027997469 } , { - 0 . 028161537 , - 0 . 00073877629 , - 0 . 023989631 , 0 . 0055660453 } , { - 0 . 012966193 , 0 . 003944376 , 0 . 025685982 , - 0 . 0017458044 } , { 0 . 00015626641 , - 0 . 009524206 , 0 . 0083025026 , - 0 . 00049753811 } , { - 0 . 02358661 , 0 . 006370149 , 0 . 00087066462 , - 0 . 00054248544 } , { - 0 . 0024571244 , - 0 . 023218369 , - 0 . 010895303 , - 0 . 0095647684 } , { 0 . 0069970393 , - 0 . 00093403301 , - 0 . 0081922371 , - 0 . 00026359768 } , { 0 . 0065921354 , 0 . 028846533 , - 0 . 045676337 , 0 . 006070217 } , { 0 . 0045248423 , - 0 . 0084676847 , 0 . 028756195 , 0 . 020612871 } , { 0 . 0037691244 , - 0 . 0069385161 , - 0 . 00029501448 , - 0 . 0017839033 } , { - 0 . 0048675353 , - 0 . 011930456 , 0 . 0044251285 , - 0 . 00016323616 } , { - 0 . 0012291164 , - 0 . 0019575288 , 0 . 0078250029 , - 0 . 0011151155 } , { 0 . 00503333 , - 0 . 0094538968 , 0 . 0092375183 , 0 . 018207648 } , { 0 . 0080615812 , - 0 . 0073583459 , - 0 . 0166794 , 0 . 016416158 } , { 0 . 002192959 , - 0 . 01153759 , - 0 . 0048668362 , - 0 . 0071123281 } , { - 0 . 010116143 , - 0 . 010224552 , 0 . 010897731 , 0 . 00093792816 } , { 0 . 017199359 , - 0 . 0087516179 , 0 . 0021169251 , - 0 . 020946959 } , { - 0 . 01570063 , 0 . 020087246 , 0 . 014492818 , - 0 . 016014018 } , { 0 . 0023484072 , 0 . 0015070243 , - 0 . 00045616273 , - 0 . 001211882 } , { 0 . 0018090492 , - 0 . 0012261901 , 0 . 0012809284 , 0 . 00096488905 } } , { { 0 . 011457792 , - 0 . 011774949 , - 0 . 012205337 , 0 . 0048139052 } , { - 0 . 024024566 , 0 . 018313023 , - 0 . 023210623 , - 0 . 0046351547 } , { 0 . 0039133571 , 0 . 0046801024 , - 0 . 020590099 , - 0 . 0018568631 } , { - 0 . 015369931 , - 0 . 0092621276 , - 0 . 026149742 , 0 . 0010335971 } , { 0 . 032555144 , - 0 . 01336897 , - 0 . 022733265 , - 0 . 027997469 } , { - 0 . 028161537 , - 0 . 00073877629 , - 0 . 023989631 , 0 . 0055660453 } , { - 0 . 012966193 , 0 . 003944376 , 0 . 025685982 , - 0 . 0017458044 } , { 0 . 00015626641 , - 0 . 009524206 , 0 . 0083025026 , - 0 . 00049753811 } , { - 0 . 02358661 , 0 . 006370149 , 0 . 00087066462 , - 0 . 00054248544 } , { - 0 . 0024571244 , - 0 . 023218369 , - 0 . 010895303 , - 0 . 0095647684 } , { 0 . 0069970393 , - 0 . 00093403301 , - 0 . 0081922371 , - 0 . 00026359768 } , { 0 . 0065921354 , 0 . 028846533 , - 0 . 045676337 , 0 . 006070217 } , { 0 . 0045248423 , - 0 . 0084676847 , 0 . 028756195 , 0 . 020612871 } , { 0 . 0037691244 , - 0 . 0069385161 , - 0 . 00029501448 , - 0 . 0017839033 } , { - 0 . 0048675353 , - 0 . 011930456 , 0 . 0044251285 , - 0 . 00016323616 } , { - 0 . 0012291164 , - 0 . 0019575288 , 0 . 0078250029 , - 0 . 0011151155 } , { 0 . 00503333 , - 0 . 0094538968 , 0 . 0092375183 , 0 . 018207648 } , { 0 . 0080615812 , - 0 . 0073583459 , - 0 . 0166794 , 0 . 016416158 } , { 0 . 002192959 , - 0 . 01153759 , - 0 . 0048668362 , - 0 . 0071123281 } , { - 0 . 010116143 , - 0 . 010224552 , 0 . 010897731 , 0 . 00093792816 } , { 0 . 017199359 , - 0 . 0087516179 , 0 . 0021169251 , - 0 . 020946959 } , { - 0 . 01570063 , 0 . 020087246 , 0 . 014492818 , - 0 . 016014018 } , { 0 . 0023484072 , 0 . 0015070243 , - 0 . 00045616273 , - 0 . 001211882 } , { 0 . 0018090492 , - 0 . 0012261901 , 0 . 0012809284 , 0 . 00096488905 } } } , { { { 0 . 71476997 , 0 . 61525336 , 0 . 81507512 , 0 . 79550964 } , { 0 . 87986984 , 0 . 9232123 , 0 . 74974956 , 0 . 82765975 } , { 0 . 65321366 , 0 . 82580437 , 0 . 63434042 , 0 . 54903231 } , { 0 . 97390084 , 0 . 98050251 , 0 . 83713283 , 0 . 72370416 } , { 0 . 97570877 , 0 . 88760866 , 0 . 88668363 , 0 . 9380218 } , { 0 . 89705541 , 0 . 88675351 , 0 . 75595095 , 0 . 83467284 } , { 0 . 77232433 , 0 . 77447327 , 0 . 9084134 , 0 . 84734569 } , { - 0 . 75720667 , - 0 . 77520488 , - 0 . 80639546 , - 0 . 76219811 } , { 0 . 77130152 , 0 . 83806694 , 0 . 60983327 , 0 . 56357207 } , { 0 . 91090229 , 0 . 84089752 , 0 . 54694041 , 0 . 59085922 } , { 0 . 60775044 , 0 . 58913818 , 0 . 53197627 , 0 . 53574024 } , { 0 . 96044628 , 0 . 83405513 , 0 . 88888419 , 0 . 55105253 } , { 0 . 79850486 , 0 . 83676557 , 0 . 83574428 , 0 . 86369517 } , { 0 . 89597751 , 0 . 83876978 , 0 . 87336884 , 0 . 8934314 } , { 0 . 77801249 , 0 . 78253947 , 0 . 10680725 , 0 . 19167855 } , { - 0 . 74415432 , - 0 . 74320194 , - 0 . 74587957 , - 0 . 72660186 } , { 0 . 802783 , 0 . 78016447 , 0 . 79046691 , 0 . 87952719 } , { 0 . 97537479 , 0 . 92311625 , 0 . 79848027 , 0 . 80910594 } , { 0 . 8125306 , 0 . 82679528 , 0 . 81929639 , 0 . 88516002 } , { 0 . 97152309 , 0 . 98181547 , 0 . 82815966 , 0 . 81791703 } , { 0 . 87129411 , 0 . 56410602 , 0 . 87800085 , 0 . 905706 } , { 0 . 87990229 , 0 . 91776281 , 0 . 99991718 , 0 . 99902102 } , { 0 . 73060786 , 0 . 72658464 , 0 . 81348263 , 0 . 81648708 } , { - 0 . 75762512 , - 0 . 75445002 , - 0 . 74430762 , - 0 . 75485946 } } , { { 0 . 018332644 , 0 . 0084005452 , - 0 . 0018937689 , - 0 . 0035491975 } , { 0 . 0016556654 , 0 . 0049261013 , - 0 . 021796869 , 0 . 0025973591 } , { - 0 . 0019671758 , 0 . 00051947074 , 0 . 0071261223 , 0 . 0056689139 } , { 0 . 00041901024 , - 0 . 0023903288 , - 0 . 0035639711 , - 0 . 0036673013 } , { 0 . 009963464 , 0 . 00099195429 , - 0 . 0042516892 , 0 . 0092605531 } , { 0 . 0034813664 , 0 . 0028575465 , - 0 . 016343415 , - 0 . 0014475905 } , { 0 . 0053571039 , 0 . 0051116063 , 0 . 016171091 , - 0 . 00052744238 } , { 0 . 00013272575 , - 0 . 0095491849 , 0 . 0070156475 , 0 . 0017057538 } , { 0 . 028067438 , - 0 . 0086835729 , - 0 . 0087852674 , 0 . 0035321054 } , { 0 . 0025007808 , - 0 . 0075654884 , - 0 . 012551417 , - 0 . 0068823899 } , { - 0 . 00017607308 , 0 . 002636122 , - 0 . 011272055 , - 0 . 010314896 } , { 0 . 010646599 , 0 . 00042804331 , 0 . 013900837 , - 0 . 01279076 } , { 0 . 0059898286 , 0 . 012331371 , - 0 . 0073125296 , 0 . 016248603 } , { 0 . 031579315 , - 0 . 0057840222 , - 0 . 00018304192 , 0 . 005171422 } , { 0 . 010928513 , 0 . 0092660887 , 0 . 030404621 , 0 . 0053167707 } , { - 0 . 00014899672 , - 0 . 0035246494 , 0 . 0075862845 , - 0 . 005861723 } , { 0 . 0067791918 , 0 . 0021224495 , - 0 . 0071755505 , - 0 . 010370936 } , { 0 . 0015352958 , - 0 . 0025785166 , - 0 . 0092688001 , 0 . 003966373 } , { 0 . 0036915074 , - 0 . 002306452 , - 0 . 005736452 , - 0 . 0033594125 } , { 0 . 0065128512 , 0 . 006188005 , 0 . 00088322638 , - 0 . 0016227066 } , { 0 . 0092720771 , - 0 . 0046684631 , - 7 . 3769604e - 05 , 0 . 013807013 } , { - 0 . 0031421984 , 0 . 010622679 , 0 . 00041591214 , 0 . 0032786075 } , { - 0 . 0021421613 , - 0 . 0041675589 , - 0 . 0029529994 , - 0 . 00085350449 } , { - 0 . 00069204344 , - 0 . 0010785124 , 0 . 00097549628 , 0 . 0025280456 } } , { { 0 . 018332644 , 0 . 0084005452 , - 0 . 0018937689 , - 0 . 0035491975 } , { 0 . 0016556654 , 0 . 0049261013 , - 0 . 021796869 , 0 . 0025973591 } , { - 0 . 0019671758 , 0 . 00051947074 , 0 . 0071261223 , 0 . 0056689139 } , { 0 . 00041901024 , - 0 . 0023903288 , - 0 . 0035639711 , - 0 . 0036673013 } , { 0 . 009963464 , 0 . 00099195429 , - 0 . 0042516892 , 0 . 0092605531 } , { 0 . 0034813664 , 0 . 0028575465 , - 0 . 016343415 , - 0 . 0014475905 } , { 0 . 0053571039 , 0 . 0051116063 , 0 . 016171091 , - 0 . 00052744238 } , { 0 . 00013272575 , - 0 . 0095491849 , 0 . 0070156475 , 0 . 0017057538 } , { 0 . 028067438 , - 0 . 0086835729 , - 0 . 0087852674 , 0 . 0035321054 } , { 0 . 0025007808 , - 0 . 0075654884 , - 0 . 012551417 , - 0 . 0068823899 } , { - 0 . 00017607308 , 0 . 002636122 , - 0 . 011272055 , - 0 . 010314896 } , { 0 . 010646599 , 0 . 00042804331 , 0 . 013900837 , - 0 . 01279076 } , { 0 . 0059898286 , 0 . 012331371 , - 0 . 0073125296 , 0 . 016248603 } , { 0 . 031579315 , - 0 . 0057840222 , - 0 . 00018304192 , 0 . 005171422 } , { 0 . 010928513 , 0 . 0092660887 , 0 . 030404621 , 0 . 0053167707 } , { - 0 . 00014899672 , - 0 . 0035246494 , 0 . 0075862845 , - 0 . 005861723 } , { 0 . 0067791918 , 0 . 0021224495 , - 0 . 0071755505 , - 0 . 010370936 } , { 0 . 0015352958 , - 0 . 0025785166 , - 0 . 0092688001 , 0 . 003966373 } , { 0 . 0036915074 , - 0 . 002306452 , - 0 . 005736452 , - 0 . 0033594125 } , { 0 . 0065128512 , 0 . 006188005 , 0 . 00088322638 , - 0 . 0016227066 } , { 0 . 0092720771 , - 0 . 0046684631 , - 7 . 3769604e - 05 , 0 . 013807013 } , { - 0 . 0031421984 , 0 . 010622679 , 0 . 00041591214 , 0 . 0032786075 } , { - 0 . 0021421613 , - 0 . 0041675589 , - 0 . 0029529994 , - 0 . 00085350449 } , { - 0 . 00069204344 , - 0 . 0010785124 , 0 . 00097549628 , 0 . 0025280456 } } } , { { { 5 . 3792285 , 5 . 1960477 , 5 . 5112916 , 5 . 6615254 } , { 5 . 0489877 , 5 . 2428834 , 5 . 1752035 , 5 . 1109826 } , { 5 . 5205204 , 5 . 7511938 , 5 . 0202917 , 4 . 9168865 } , { 4 . 9522523 , 4 . 8880256 , 5 . 1015936 , 5 . 2858816 } , { 5 . 7256502 , 5 . 7919759 , 5 . 645241 , 5 . 6035708 } , { 6 . 4076931 , 6 . 4822111 , 6 . 2642633 , 6 . 3925959 } , { 6 . 9797014 , 6 . 981436 , 7 . 0028674 , 6 . 9976464 } , { - 0 . 03290957 , - 0 . 03290957 , - 0 . 03290957 , - 0 . 03290957 } , { 5 . 4977854 , 5 . 7684965 , 5 . 3463095 , 4 . 8810492 } , { 4 . 9869047 , 5 . 4896416 , 4 . 9647805 , 4 . 884877 } , { 5 . 3141219 , 5 . 3357788 , 4 . 7695434 , 4 . 8709631 } , { 5 . 2056063 , 5 . 407802 , 5 . 2123857 , 4 . 9428208 } , { 6 . 2188218 , 6 . 17756 , 6 . 2751008 , 6 . 3672109 } , { 6 . 9105856 , 6 . 7986798 , 6 . 5712335 , 6 . 5907061 } , { 6 . 9797014 , 6 . 9797014 , 5 . 6859993 , 5 . 5642483 } , { - 0 . 032764603 , - 0 . 032764603 , - 0 . 032764603 , - 0 . 032764603 } , { 5 . 7724142 , 6 . 0929556 , 5 . 99581 , 5 . 9265164 } , { 4 . 9363192 , 4 . 9823732 , 5 . 1732995 , 5 . 2475265 } , { 5 . 8365191 , 5 . 9972902 , 5 . 9778441 , 5 . 9270668 } , { 4 . 8706768 , 5 . 0194503 , 5 . 155585 , 5 . 2188041 } , { 6 . 1569904 , 6 . 0563989 , 6 . 0989699 , 6 . 2139837 } , { 5 . 8727399 , 5 . 8948086 , 5 . 5734095 , 5 . 5536103 } , { 6 . 9797014 , 6 . 9797014 , 6 . 9797014 , 6 . 9797014 } , { - 0 . 032766769 , - 0 . 032766769 , - 0 . 032766769 , - 0 . 032766769 } } , { { 0 . 0011802354 , - 0 . 006546101 , - 0 . 02103972 , 0 . 0008654047 } , { - 0 . 015460534 , 0 . 017874544 , 0 . 0029121134 , 0 . 023511773 } , { - 0 . 040909245 , 0 . 011927691 , 0 . 011991588 , 0 . 01677931 } , { - 0 . 015633544 , - 0 . 0042321141 , 0 . 026623034 , 0 . 0080414514 } , { 0 . 012614382 , 0 . 0065080145 , 0 . 035716738 , - 0 . 0080665814 } , { - 0 . 0057849744 , - 0 . 017478461 , - 0 . 031219642 , 0 . 00016446523 } , { 0 , 0 . 00032235028 , 0 , 0 } , { 0 , 0 , 0 , 0 } , { - 0 . 068586697 , - 0 . 024228236 , - 0 . 012857221 , - 0 . 039493706 } , { - 0 . 018078201 , - 0 . 015140979 , 0 . 00072119173 , - 0 . 051249859 } , { - 0 . 054228277 , 0 . 0097895101 , 0 . 0019832646 , - 0 . 011715411 } , { - 0 . 042326208 , - 0 . 010160072 , 0 . 037088052 , - 0 . 031848667 } , { 0 . 00067130897 , - 0 . 013966717 , - 0 . 017268559 , - 0 . 0074614576 } , { 0 . 070515961 , 0 . 012848107 , - 0 . 0008396517 , 0 . 0049006506 } , { 0 , 0 , - 0 . 063014256 , - 0 . 0085124986 } , { 0 , 0 , 0 , 0 } , { - 0 . 040302299 , 0 . 0048936307 , 0 . 0064406394 , 0 . 0034044871 } , { - 0 . 010453589 , 0 . 0035820836 , - 0 . 017384391 , - 0 . 038199947 } , { - 0 . 044968611 , - 0 . 0088322127 , 0 . 020303819 , 0 . 0058131005 } , { - 0 . 0056838535 , 0 . 010211409 , - 0 . 010999927 , - 0 . 027621859 } , { 0 . 0064753811 , - 0 . 0059341242 , - 0 . 014902755 , 0 . 0082868118 } , { - 0 . 0013222735 , 0 . 0028492181 , - 0 . 023523273 , - 0 . 02576271 } , { 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 } } , { { 0 . 0011802354 , - 0 . 006546101 , - 0 . 02103972 , 0 . 00086540469 } , { - 0 . 015460534 , 0 . 017874544 , 0 . 0029121134 , 0 . 023511773 } , { - 0 . 040909245 , 0 . 011927691 , 0 . 011991588 , 0 . 01677931 } , { - 0 . 015633544 , - 0 . 0042321141 , 0 . 026623034 , 0 . 0080414514 } , { 0 . 012614382 , 0 . 0065080145 , 0 . 035716738 , - 0 . 0080665814 } , { - 0 . 0057849744 , - 0 . 017478461 , - 0 . 031219642 , 0 . 00016446523 } , { 0 , 0 . 00032235028 , 0 , 0 } , { 0 , 0 , 0 , 0 } , { - 0 . 068586697 , - 0 . 024228236 , - 0 . 012857221 , - 0 . 039493706 } , { - 0 . 018078201 , - 0 . 015140979 , 0 . 00072119173 , - 0 . 051249859 } , { - 0 . 054228277 , 0 . 0097895101 , 0 . 0019832646 , - 0 . 011715411 } , { - 0 . 042326208 , - 0 . 010160072 , 0 . 037088052 , - 0 . 031848667 } , { 0 . 00067130897 , - 0 . 013966717 , - 0 . 017268559 , - 0 . 0074614576 } , { 0 . 070515961 , 0 . 012848107 , - 0 . 0008396517 , 0 . 0049006506 } , { 0 , 0 , - 0 . 063014256 , - 0 . 0085124986 } , { 0 , 0 , 0 , 0 } , { - 0 . 040302299 , 0 . 0048936307 , 0 . 0064406394 , 0 . 0034044871 } , { - 0 . 010453589 , 0 . 0035820836 , - 0 . 017384391 , - 0 . 038199947 } , { - 0 . 044968611 , - 0 . 0088322127 , 0 . 020303819 , 0 . 0058131005 } , { - 0 . 0056838535 , 0 . 010211409 , - 0 . 010999927 , - 0 . 027621859 } , { 0 . 0064753811 , - 0 . 0059341242 , - 0 . 014902755 , 0 . 0082868118 } , { - 0 . 0013222735 , 0 . 0028492181 , - 0 . 023523273 , - 0 . 02576271 } , { 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 } } } , { { { 0 . 72189984 , 0 . 22069996 , 0 . 71952927 , 0 . 77725949 } , { 0 . 4054405 , 0 . 20582059 , 0 . 2747016 , 0 . 37612563 } , { 0 . 58887422 , 0 . 27441131 , 0 . 19468101 , 0 . 21480554 } , { 0 . 46814145 , 0 . 34317 , 0 . 46068212 , 0 . 13962064 } , { - 0 . 18134132 , - 0 . 26668789 , - 0 . 60984999 , - 0 . 67879259 } , { - 0 . 47870351 , - 0 . 34453227 , 0 . 32494779 , 0 . 10292971 } , { 0 . 087252967 , 0 . 066950358 , 0 . 31813819 , 0 . 071094818 } , { - 0 . 0031436256 , 0 . 038245091 , - 0 . 0076651913 , - 0 . 015389479 } , { 1 . 2668531 , 1 . 2894974 , 0 . 40584018 , 0 . 51755806 } , { 1 . 3207257 , 1 . 3403747 , 0 . 54924634 , 0 . 40282713 } , { 0 . 78581828 , 0 . 56379328 , 0 . 27901993 , 0 . 56429306 } , { 0 . 8748226 , 1 . 0271253 , 1 . 0085726 , 0 . 3888545 } , { - 0 . 22577636 , - 0 . 32895071 , - 0 . 2846317 , - 0 . 11679531 } , { 0 . 26477285 , 0 . 3179447 , - 0 . 063393238 , 0 . 024059773 } , { - 0 . 15463395 , - 0 . 22721468 , - 0 . 20680404 , - 0 . 15700788 } , { 0 . 012107106 , - 0 . 0061245949 , - 0 . 024224367 , 0 . 005040693 } , { 0 . 97943693 , 0 . 64840429 , 0 . 45106998 , 0 . 40771935 } , { 0 . 49907853 , 0 . 1562184 , 0 . 34338458 , 0 . 39710628 } , { 0 . 95047709 , 0 . 53336107 , 0 . 38318275 , 0 . 44919148 } , { 0 . 41892697 , 0 . 069965886 , 0 . 45831656 , 0 . 38821529 } , { - 0 . 20216736 , - 0 . 43209441 , - 0 . 57684857 , - 0 . 40189427 } , { - 0 . 63992377 , - 0 . 40683032 , - 0 . 59207903 , - 0 . 57251716 } , { - 0 . 047117438 , - 0 . 1880015 , - 0 . 12265155 , 0 . 00059988607 } , { - 0 . 011836442 , - 0 . 010049497 , - 0 . 0026152072 , 0 . 016137736 } } , { { 0 . 092068993 , 0 . 0045466749 , 0 . 0054574031 , 0 . 02582156 } , { 0 . 022115456 , - 0 . 015664041 , - 0 . 022004653 , 0 . 041431654 } , { 0 . 029951298 , - 0 . 0004408542 , 0 . 0087496069 , 0 . 017850027 } , { 0 . 029086373 , 0 . 022116039 , 0 . 044010315 , 0 . 001644876 } , { 0 . 016256387 , 0 . 0083249367 , 0 . 019570849 , - 0 . 0021276222 } , { 0 . 0079070076 , - 0 . 024696939 , 0 . 044311101 , 0 . 023671132 } , { - 0 . 0081796119 , - 0 . 0024995551 , 0 . 033501743 , - 0 . 031958988 } , { 0 . 0065005403 , - 0 . 076642001 , 0 . 015736477 , 0 . 030966939 } , { 0 . 029110717 , 0 . 039154477 , - 0 . 074376619 , 0 . 025532063 } , { - 0 . 10980761 , 0 . 0038346834 , 0 . 014449171 , - 0 . 030702653 } , { - 0 . 00068350423 , - 0 . 037251569 , - 0 . 008409224 , - 0 . 026322878 } , { 0 . 035406012 , 0 . 064176275 , 0 . 031437854 , - 0 . 0344642 } , { 0 . 037145809 , - 0 . 024909212 , 0 . 041030386 , 0 . 035216105 } , { - 0 . 093276646 , - 0 . 013904083 , - 0 . 019536023 , - 0 . 023834405 } , { 0 . 042751846 , - 0 . 03620164 , 0 . 081115921 , 0 . 018379967 } , { - 0 . 023909625 , 0 . 012833691 , 0 . 048086442 , - 0 . 0097340268 } , { 0 . 039552712 , - 0 . 00026806514 , 0 . 011646753 , 0 . 0065939486 } , { 0 . 058985248 , 0 . 020165701 , 0 . 0076721521 , 0 . 033274221 } , { 0 . 052889871 , 0 . 0042520093 , 0 . 016490396 , 0 . 009287973 } , { 0 . 044305975 , - 0 . 0016263469 , 0 . 041390177 , 0 . 033541355 } , { 0 . 014595133 , - 0 . 004801042 , - 0 . 0049517302 , 0 . 015714264 } , { 0 . 00075086205 , 0 . 0080838736 , - 0 . 037611057 , - 0 . 030488441 } , { 0 . 0019178075 , - 0 . 0082517768 , - 0 . 002525773 , 0 . 0043993022 } , { 0 . 023774971 , 0 . 020335611 , 0 . 0056643868 , - 0 . 032100338 } } , { { 0 . 092068993 , 0 . 0045466749 , 0 . 0054574031 , 0 . 02582156 } , { 0 . 022115456 , - 0 . 015664041 , - 0 . 022004653 , 0 . 041431654 } , { 0 . 029951298 , - 0 . 0004408542 , 0 . 0087496069 , 0 . 017850027 } , { 0 . 029086373 , 0 . 022116039 , 0 . 044010315 , 0 . 001644876 } , { 0 . 016256387 , 0 . 0083249367 , 0 . 019570849 , - 0 . 0021276222 } , { 0 . 0079070076 , - 0 . 024696939 , 0 . 044311101 , 0 . 023671132 } , { - 0 . 0081796119 , - 0 . 0024995551 , 0 . 033501743 , - 0 . 031958988 } , { 0 . 0065005403 , - 0 . 076642001 , 0 . 015736477 , 0 . 030966939 } , { 0 . 029110717 , 0 . 039154477 , - 0 . 074376619 , 0 . 025532063 } , { - 0 . 10980761 , 0 . 0038346834 , 0 . 014449171 , - 0 . 030702653 } , { - 0 . 00068350423 , - 0 . 037251569 , - 0 . 008409224 , - 0 . 026322878 } , { 0 . 035406012 , 0 . 064176275 , 0 . 031437854 , - 0 . 0344642 } , { 0 . 037145809 , - 0 . 024909212 , 0 . 041030386 , 0 . 035216105 } , { - 0 . 093276646 , - 0 . 013904083 , - 0 . 019536023 , - 0 . 023834405 } , { 0 . 042751846 , - 0 . 03620164 , 0 . 081115921 , 0 . 018379967 } , { - 0 . 023909625 , 0 . 012833691 , 0 . 048086442 , - 0 . 0097340268 } , { 0 . 039552712 , - 0 . 00026806514 , 0 . 011646753 , 0 . 0065939486 } , { 0 . 058985248 , 0 . 020165701 , 0 . 0076721521 , 0 . 033274221 } , { 0 . 052889871 , 0 . 0042520093 , 0 . 016490396 , 0 . 009287973 } , { 0 . 044305975 , - 0 . 0016263469 , 0 . 041390177 , 0 . 033541355 } , { 0 . 014595133 , - 0 . 004801042 , - 0 . 0049517303 , 0 . 015714264 } , { 0 . 00075086205 , 0 . 0080838736 , - 0 . 037611057 , - 0 . 030488441 } , { 0 . 0019178075 , - 0 . 0082517768 , - 0 . 002525773 , 0 . 0043993022 } , { 0 . 023774971 , 0 . 020335611 , 0 . 0056643868 , - 0 . 032100338 } } } } } ; <nl> <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl> mmm a / servers / visual / rasterizer_rd / shaders / cubemap_downsampler . glsl <nl> ppp b / servers / visual / rasterizer_rd / shaders / cubemap_downsampler . glsl <nl> void main ( ) { <nl> } <nl> imageStore ( dest_cubemap , ivec3 ( id ) , color ) ; <nl> } <nl> - } <nl> \ No newline at end of file <nl> + } <nl> mmm a / servers / visual / rasterizer_rd / shaders / cubemap_filter . glsl <nl> ppp b / servers / visual / rasterizer_rd / shaders / cubemap_filter . glsl <nl> void main ( ) { <nl> imageStore ( dest_cubemap6 , ivec3 ( id ) , color ) ; <nl> break ; <nl> } <nl> - } <nl> \ No newline at end of file <nl> + } <nl>
|
Merge pull request from aaronfranke / file - formatting
|
godotengine/godot
|
aac31cf0eeafe2beea3d72eef7b6fdcb3a970f27
|
2020-03-22T08:34:17Z
|
mmm a / tensorflow / compiler / xla / service / gpu / backend_configs . proto <nl> ppp b / tensorflow / compiler / xla / service / gpu / backend_configs . proto <nl> message CudnnConvBackendConfig { <nl> double conv_result_scale = 4 ; <nl> <nl> / / Below are the fields related to cuDNN ' s fused convolution . Refer to <nl> - / / CudnnConvParams for their meanings . <nl> + / / GpuConvParams for their meanings . <nl> <nl> / / The requested activation ( e . g . relu ) after the convolution . It is with type <nl> / / stream_executor : : dnn : : ActivationMode . <nl> mmm a / tensorflow / compiler / xla / service / gpu / gpu_conv_runner . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / gpu_conv_runner . cc <nl> class ScratchBufAllocator : public se : : ScratchAllocator { <nl> } ; <nl> <nl> template < typename ElementType , typename OutputType > <nl> - Status RunCudnnConvForward ( CudnnConvParams params , <nl> + Status RunCudnnConvForward ( GpuConvParams params , <nl> se : : ScratchAllocator * scratch_allocator , <nl> se : : Stream * stream , RunConvOptions options , <nl> DeviceMemory < ElementType > input_buf , <nl> Status RunCudnnConvForward ( CudnnConvParams params , <nl> } <nl> <nl> template < typename ElementType , typename BiasType , typename OutputType > <nl> - Status RunCudnnConvForwardActivation ( CudnnConvParams params , <nl> + Status RunCudnnConvForwardActivation ( GpuConvParams params , <nl> se : : ScratchAllocator * scratch_allocator , <nl> se : : Stream * stream , RunConvOptions options , <nl> DeviceMemory < ElementType > input_buf , <nl> Status RunCudnnConvForwardActivation ( CudnnConvParams params , <nl> template < typename ElementType , typename BiasType , typename OutputType , <nl> typename std : : enable_if < <nl> ! std : : is_integral < ElementType > : : value > : : type * = nullptr > <nl> - Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> + Status RunCudnnConvInternalImpl ( GpuConvParams params , <nl> se : : ScratchAllocator * scratch_allocator , <nl> se : : Stream * stream , RunConvOptions options , <nl> DeviceMemory < ElementType > input_buf , <nl> Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> template < typename ElementType , typename BiasType , typename OutputType , <nl> typename std : : enable_if < std : : is_integral < ElementType > : : value > : : type * = <nl> nullptr > <nl> - Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> + Status RunCudnnConvInternalImpl ( GpuConvParams params , <nl> se : : ScratchAllocator * scratch_allocator , <nl> se : : Stream * stream , RunConvOptions options , <nl> DeviceMemory < ElementType > input_buf , <nl> Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> } <nl> <nl> template < typename ElementType , typename BiasType , typename OutputType > <nl> - Status RunCudnnConvImpl ( const CudnnConvParams & params , <nl> + Status RunCudnnConvImpl ( const GpuConvParams & params , <nl> se : : ScratchAllocator * scratch_allocator , <nl> se : : Stream * stream , RunConvOptions options ) { <nl> auto input_buf = se : : DeviceMemory < ElementType > ( params . input_buf ) ; <nl> Status RunCudnnConvImpl ( const CudnnConvParams & params , <nl> <nl> } / / anonymous namespace <nl> <nl> - StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> + StatusOr < GpuConvParams > GetGpuConvParams ( <nl> const HloCustomCallInstruction * conv , <nl> absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> se : : DeviceMemoryBase result_buffer ) { <nl> - CudnnConvParams params ; <nl> + GpuConvParams params ; <nl> <nl> TF_ASSIGN_OR_RETURN ( CudnnConvBackendConfig backend_config , <nl> conv - > backend_config < CudnnConvBackendConfig > ( ) ) ; <nl> StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> filter_shape = & conv - > operand ( 1 ) - > shape ( ) ; <nl> output_shape = & conv - > shape ( ) . tuple_shapes ( 0 ) ; <nl> params . fusion . emplace ( ) ; <nl> - CudnnConvParams : : FusionParams & fusion = * params . fusion ; <nl> + GpuConvParams : : FusionParams & fusion = * params . fusion ; <nl> if ( ! se : : dnn : : ActivationMode_IsValid ( backend_config . activation_mode ( ) ) ) { <nl> return InternalError ( " Bad activation mode : % s " , <nl> backend_config . ShortDebugString ( ) ) ; <nl> Status RunCudnnConv ( const HloCustomCallInstruction * conv , <nl> se : : DeviceMemoryBase result_buffer , <nl> se : : ScratchAllocator * scratch_allocator , se : : Stream * stream , <nl> RunConvOptions options ) { <nl> - TF_ASSIGN_OR_RETURN ( CudnnConvParams params , <nl> - GetCudnnConvParams ( conv , operand_buffers , result_buffer ) ) ; <nl> + TF_ASSIGN_OR_RETURN ( GpuConvParams params , <nl> + GetGpuConvParams ( conv , operand_buffers , result_buffer ) ) ; <nl> <nl> PrimitiveType input_primitive_type = conv - > operand ( 0 ) - > shape ( ) . element_type ( ) ; <nl> switch ( input_primitive_type ) { <nl> mmm a / tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h <nl> struct RunConvOptions { <nl> } ; <nl> <nl> / / Implementation struct exposed for debugging and log analysis . <nl> - struct CudnnConvParams { <nl> + struct GpuConvParams { <nl> / / Here are the fields related to cuDNN ' s fused convolution . The result thus <nl> / / is defined as : <nl> / / activation ( conv_result_scale * conv ( x , w ) + <nl> Status RunCudnnConv ( const HloCustomCallInstruction * conv , <nl> RunConvOptions = { } ) ; <nl> <nl> / / Implementation details exposed for debugging and log analysis . <nl> - StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> + StatusOr < GpuConvParams > GetGpuConvParams ( <nl> const HloCustomCallInstruction * conv , <nl> absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> se : : DeviceMemoryBase result_buffer ) ; <nl>
|
Rename CudnnConvParams to GpuConvParams
|
tensorflow/tensorflow
|
dfe84888cb47798efdb5f551085db5a3eca116d6
|
2019-09-19T15:27:00Z
|
mmm a / tensorflow / core / profiler / protobuf / op_metrics . proto <nl> ppp b / tensorflow / core / profiler / protobuf / op_metrics . proto <nl> message LayoutAnalysis { <nl> } <nl> <nl> / / Metrics for an operation ( accumulated over all occurrences ) . <nl> - / / Next ID : 19 <nl> + / / Next ID : 20 <nl> message OpMetrics { <nl> / / HLO module id . 0 for TF ops . <nl> uint64 hlo_module_id = 13 ; <nl> message OpMetrics { <nl> uint64 flops = 2 ; <nl> / / Total bytes accessed . <nl> uint64 bytes_accessed = 5 ; <nl> + / / Breakdown of memory accessed by operation type and memory space . <nl> + message MemoryAccessed { <nl> + enum OperationType { <nl> + UNKNOWN = 0 ; <nl> + READ = 1 ; <nl> + WRITE = 2 ; <nl> + } <nl> + OperationType operation_type = 1 ; <nl> + / / Device - specific id of memory space . <nl> + uint64 memory_space = 2 ; <nl> + uint64 bytes_accessed = 3 ; <nl> + } <nl> + repeated MemoryAccessed memory_accessed_breakdown = 19 ; <nl> / / Total dma stall time in picoseconds . <nl> uint64 dma_stall_ps = 10 ; <nl> / / The data layout for this op . Only set for convolution ops for now . <nl>
|
Add memory cost breakdown per operation type and memory space to OpMetrics .
|
tensorflow/tensorflow
|
8d7f18b250a6356623509dee7a4d0636b8937784
|
2020-05-21T21:31:22Z
|
mmm a / include / fmt / format . h <nl> ppp b / include / fmt / format . h <nl> FMT_END_NAMESPACE <nl> <nl> # define FMT_STRING_IMPL ( s , . . . ) \ <nl> [ ] { \ <nl> - struct str : fmt : : compile_string { \ <nl> + / * Use a macro - like name to avoid shadowing warnings . * / \ <nl> + struct FMT_STRING : fmt : : compile_string { \ <nl> using char_type = typename std : : remove_cv < std : : remove_pointer < \ <nl> typename std : : decay < decltype ( s ) > : : type > : : type > : : type ; \ <nl> __VA_ARGS__ FMT_CONSTEXPR \ <nl> operator fmt : : basic_string_view < char_type > ( ) const { \ <nl> return { s , sizeof ( s ) / sizeof ( char_type ) - 1 } ; \ <nl> } \ <nl> - } result ; \ <nl> - / * Suppress Qt Creator warning about unused operator . * / \ <nl> - ( void ) static_cast < fmt : : basic_string_view < typename str : : char_type > > ( \ <nl> - result ) ; \ <nl> - return result ; \ <nl> + } ; \ <nl> + return FMT_STRING ( ) ; \ <nl> } ( ) <nl> <nl> / * * <nl>
|
Avoid shadowing warnings in FMT_STRING
|
fmtlib/fmt
|
068d20bc31ff5e1b18e13631535190a0570aa8ff
|
2019-12-14T15:00:08Z
|
new file mode 100644 <nl> index 000000000000 . . c61992953361 <nl> mmm / dev / null <nl> ppp b / tools / depends / target / libsdl / 05 - x11 - xdata32 . patch <nl> <nl> + mmm a / configure . in Wed Apr 17 00 : 56 : 53 2013 - 0700 <nl> ppp + a / configure . in Sun Jun 02 20 : 48 : 53 2013 + 0600 <nl> + <nl> + if test x $ definitely_enable_video_x11_xrandr = xyes ; then <nl> + AC_DEFINE ( SDL_VIDEO_DRIVER_X11_XRANDR ) <nl> + fi <nl> + + AC_MSG_CHECKING ( for const parameter to _XData32 ) <nl> + + have_const_param_xdata32 = no <nl> + + AC_TRY_COMPILE ( [ <nl> + + # include < X11 / Xlibint . h > <nl> + + extern int _XData32 ( Display * dpy , register _Xconst long * data , unsigned len ) ; <nl> + + ] , [ <nl> + + ] , [ <nl> + + have_const_param_xdata32 = yes <nl> + + AC_DEFINE ( SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 ) <nl> + + ] ) <nl> + + AC_MSG_RESULT ( $ have_const_param_xdata32 ) <nl> + fi <nl> + fi <nl> + } <nl> + mmm a / include / SDL_config . h . in Wed Apr 17 00 : 56 : 53 2013 - 0700 <nl> ppp + a / include / SDL_config . h . in Sun Jun 02 20 : 48 : 53 2013 + 0600 <nl> + <nl> + # undef SDL_VIDEO_DRIVER_WINDIB <nl> + # undef SDL_VIDEO_DRIVER_WSCONS <nl> + # undef SDL_VIDEO_DRIVER_X11 <nl> + + # undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 <nl> + # undef SDL_VIDEO_DRIVER_X11_DGAMOUSE <nl> + # undef SDL_VIDEO_DRIVER_X11_DYNAMIC <nl> + # undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT <nl> + mmm a / src / video / x11 / SDL_x11sym . h Wed Apr 17 00 : 56 : 53 2013 - 0700 <nl> ppp + a / src / video / x11 / SDL_x11sym . h Sun Jun 02 20 : 48 : 53 2013 + 0600 <nl> + <nl> + * / <nl> + # ifdef LONG64 <nl> + SDL_X11_MODULE ( IO_32BIT ) <nl> + + # if SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 <nl> + + SDL_X11_SYM ( int , _XData32 , ( Display * dpy , register _Xconst long * data , unsigned len ) , ( dpy , data , len ) , return ) <nl> + + # else <nl> + SDL_X11_SYM ( int , _XData32 , ( Display * dpy , register long * data , unsigned len ) , ( dpy , data , len ) , return ) <nl> + + # endif <nl> + SDL_X11_SYM ( void , _XRead32 , ( Display * dpy , register long * data , long len ) , ( dpy , data , len ) , ) <nl> + # endif <nl>
|
depends : sdl patch for x11
|
xbmc/xbmc
|
fe90ab0999c5639579a83a96dac95a8bb832ea58
|
2014-01-17T16:12:42Z
|
mmm a / tensorflow / core / common_runtime / device . h <nl> ppp b / tensorflow / core / common_runtime / device . h <nl> class Device : public DeviceBase { <nl> op_kernel - > ComputeAsync ( context , done ) ; <nl> } <nl> <nl> + / / Takes ownership of the references in tensors . If necessary , a <nl> + / / device may override this method to keep a reference to the <nl> + / / accessed tensors until the async computation has completed . <nl> + virtual void ConsumeListOfAccessedTensors ( <nl> + DeviceContext * context , const TensorReferenceVector & tensors ) { <nl> + for ( const auto & ref : tensors ) { <nl> + ref . Unref ( ) ; <nl> + } <nl> + } <nl> + <nl> / / Blocks until all operations queued on the device at the time of <nl> / / the call have completed . Returns any error pending on the device <nl> / / at completion . <nl> mmm a / tensorflow / core / common_runtime / executor . cc <nl> ppp b / tensorflow / core / common_runtime / executor . cc <nl> limitations under the License . <nl> # include < memory > <nl> # include < string > <nl> # include < unordered_map > <nl> - # include < unordered_set > <nl> # include < vector > <nl> <nl> # include " tensorflow / core / common_runtime / step_stats_collector . h " <nl> + # include " tensorflow / core / framework / allocation_description . pb . h " <nl> # include " tensorflow / core / framework / allocator . h " <nl> # include " tensorflow / core / framework / cancellation . h " <nl> # include " tensorflow / core / framework / control_flow . h " <nl> limitations under the License . <nl> # include " tensorflow / core / framework / op_kernel . h " <nl> # include " tensorflow / core / framework / op_segment . h " <nl> # include " tensorflow / core / framework / step_stats . pb . h " <nl> + # include " tensorflow / core / framework / tensor_reference . h " <nl> # include " tensorflow / core / framework / types . h " <nl> # include " tensorflow / core / framework / types . pb . h " <nl> # include " tensorflow / core / graph / edgeset . h " <nl> void SetAllEnd ( NodeExecStats * nt ) { <nl> nt - > set_all_end_rel_micros ( NowInUsec ( ) - nt - > all_start_micros ( ) ) ; <nl> } <nl> <nl> - void SetOutput ( NodeExecStats * nt , int slot , AllocationType allocation_type , <nl> - const Tensor * v ) { <nl> + void SetOutput ( NodeExecStats * nt , int slot , const Tensor * v ) { <nl> DCHECK ( v ) ; <nl> NodeOutput * no = nt - > add_output ( ) ; <nl> no - > set_slot ( slot ) ; <nl> - no - > set_allocation_type ( allocation_type ) ; <nl> v - > FillDescription ( no - > mutable_tensor_description ( ) ) ; <nl> } <nl> <nl> void SetMemory ( NodeExecStats * nt , OpKernelContext * ctx ) { <nl> } <nl> } <nl> } <nl> + <nl> + void SetReferencedTensors ( NodeExecStats * nt , <nl> + const TensorReferenceVector & tensors ) { <nl> + / / be careful not to increment the reference count on any tensor <nl> + / / while recording the information <nl> + for ( int i = 0 ; i < tensors . size ( ) ; + + i ) { <nl> + AllocationDescription * description = nt - > add_referenced_tensor ( ) ; <nl> + tensors . at ( i ) . FillDescription ( description ) ; <nl> + } <nl> + } <nl> + <nl> } / / namespace nodestats <nl> <nl> struct NodeItem { <nl> void ExecutorState : : Process ( TaggedNode tagged_node , int64 scheduled_usec ) { <nl> outputs . clear ( ) ; <nl> outputs . resize ( node - > num_outputs ( ) ) ; <nl> <nl> + TensorReferenceVector accessed_tensors ; <nl> + DeviceContext * device_context = nullptr ; <nl> / / Only execute this node if it is not dead or it is a send / recv <nl> / / transfer node . For transfer nodes , we need to propagate the " dead " <nl> / / bit even when the node is dead . <nl> void ExecutorState : : Process ( TaggedNode tagged_node , int64 scheduled_usec ) { <nl> / / Asynchronous computes . <nl> auto pcopy = CopyParams ( params ) ; <nl> auto ctx = new OpKernelContext ( * pcopy ) ; <nl> - auto done = [ this , tagged_node , item , first_input , ctx , stats , <nl> - pcopy ] ( ) { <nl> + auto done = [ this , tagged_node , item , first_input , ctx , stats , pcopy , <nl> + device ] ( ) { <nl> VLOG ( 2 ) < < this < < " Async kernel done : " <nl> < < SummarizeNodeDef ( item . node - > def ( ) ) ; <nl> if ( stats_collector_ ) nodestats : : SetOpEnd ( stats ) ; <nl> void ExecutorState : : Process ( TaggedNode tagged_node , int64 scheduled_usec ) { <nl> if ( s . ok ( ) ) { <nl> PropagateOutputs ( tagged_node , outputs , & ready ) ; <nl> } <nl> - / / Schedule to run all the ready ops in thread pool . <nl> + outputs . clear ( ) ; <nl> + if ( s . ok ( ) & & pcopy - > device - > RequiresRecordingAccessedTensors ( ) ) { <nl> + / / Get the list of all tensors accessed during the execution <nl> + TensorReferenceVector accessed ; <nl> + ctx - > retrieve_accessed_tensors ( & accessed ) ; <nl> + if ( stats_collector_ ) <nl> + nodestats : : SetReferencedTensors ( stats , accessed ) ; <nl> + / / callee takes ownership of the vector <nl> + device - > ConsumeListOfAccessedTensors ( ctx - > op_device_context ( ) , <nl> + accessed ) ; <nl> + } <nl> bool completed = NodeDone ( s , item . node , ready , stats , nullptr ) ; <nl> delete ctx ; <nl> DeleteParams ( pcopy ) ; <nl> void ExecutorState : : Process ( TaggedNode tagged_node , int64 scheduled_usec ) { <nl> device - > Compute ( CHECK_NOTNULL ( op_kernel ) , & ctx ) ; <nl> if ( stats_collector_ ) nodestats : : SetOpEnd ( stats ) ; <nl> <nl> - / / Processes outputs . <nl> s = ProcessOutputs ( item , & ctx , & outputs , stats ) ; <nl> + if ( s . ok ( ) & & params . device - > RequiresRecordingAccessedTensors ( ) ) { <nl> + / / Get the list of all tensors accessed during the execution <nl> + ctx . retrieve_accessed_tensors ( & accessed_tensors ) ; <nl> + device_context = ctx . op_device_context ( ) ; <nl> + } <nl> if ( stats_collector_ ) nodestats : : SetMemory ( stats , & ctx ) ; <nl> } <nl> } <nl> void ExecutorState : : Process ( TaggedNode tagged_node , int64 scheduled_usec ) { <nl> if ( s . ok ( ) ) { <nl> PropagateOutputs ( tagged_node , outputs , & ready ) ; <nl> } <nl> + outputs . clear ( ) ; <nl> + if ( ! accessed_tensors . empty ( ) ) { <nl> + if ( stats_collector_ ) <nl> + nodestats : : SetReferencedTensors ( stats , accessed_tensors ) ; <nl> + / / device_context is set above in synchronous computes <nl> + device - > ConsumeListOfAccessedTensors ( device_context , accessed_tensors ) ; <nl> + } <nl> if ( stats_collector_ ) { <nl> scheduled_usec = nodestats : : NowInUsec ( ) ; <nl> } <nl> Status ExecutorState : : ProcessOutputs ( const NodeItem & item , OpKernelContext * ctx , <nl> out - > val = * val . tensor ; <nl> } <nl> if ( stats_collector_ & & val . tensor - > IsInitialized ( ) ) { <nl> - nodestats : : SetOutput ( stats , i , ctx - > output_allocation_type ( i ) , <nl> - val . tensor ) ; <nl> + nodestats : : SetOutput ( stats , i , val . tensor ) ; <nl> } <nl> } else { <nl> s . Update ( errors : : Internal ( " Output " , i , " of type " , <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_bfc_allocator . cc <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_bfc_allocator . cc <nl> namespace gpu = : : perftools : : gputools ; <nl> namespace tensorflow { <nl> <nl> GPUBFCAllocator : : GPUBFCAllocator ( int device_id , size_t total_memory ) <nl> - : device_id_ ( device_id ) { <nl> + : device_id_ ( device_id ) , next_allocation_id_ ( 1 ) { <nl> / / Get a pointer to the stream_executor for this device <nl> stream_exec_ = GPUMachineManager ( ) - > ExecutorForDevice ( device_id ) . ValueOrDie ( ) ; <nl> <nl> GPUBFCAllocator : : GPUBFCAllocator ( int device_id , size_t total_memory ) <nl> GPUBFCAllocator : : Chunk * c = new GPUBFCAllocator : : Chunk ( ) ; <nl> c - > ptr = gpu_mem . opaque ( ) ; <nl> c - > size = gpu_memory_size_ ; <nl> - c - > in_use = false ; <nl> + c - > allocation_id = - 1 ; <nl> c - > prev = nullptr ; <nl> c - > next = nullptr ; <nl> <nl> void * GPUBFCAllocator : : AllocateRawInternal ( size_t unused_alignment , <nl> / / rounded_bytes . <nl> Bin * b = it - > second ; <nl> for ( GPUBFCAllocator : : Chunk * chunk : b - > free_chunks ) { <nl> - DCHECK ( ! chunk - > in_use ) ; <nl> + DCHECK ( ! chunk - > in_use ( ) ) ; <nl> if ( chunk - > size > = rounded_bytes ) { <nl> / / We found an existing chunk that fits us that wasn ' t in use , so remove <nl> / / it from the free bin structure prior to using . <nl> void * GPUBFCAllocator : : AllocateRawInternal ( size_t unused_alignment , <nl> / / The requested size of the returned chunk is what the user <nl> / / has allocated . <nl> chunk - > requested_size = num_bytes ; <nl> - chunk - > in_use = true ; <nl> + / / Assign a unique id and increment the id counter , marking the <nl> + / / chunk as being in use . <nl> + chunk - > allocation_id = next_allocation_id_ + + ; <nl> <nl> VLOG ( 4 ) < < " Returning : " < < chunk - > ptr ; <nl> return chunk - > ptr ; <nl> void * GPUBFCAllocator : : AllocateRawInternal ( size_t unused_alignment , <nl> } <nl> <nl> void GPUBFCAllocator : : SplitChunk ( GPUBFCAllocator : : Chunk * c , size_t num_bytes ) { <nl> - CHECK ( ! c - > in_use & & ! c - > bin ) ; <nl> + CHECK ( ! c - > in_use ( ) & & ! c - > bin ) ; <nl> <nl> / / Create a new chunk starting num_bytes after c <nl> GPUBFCAllocator : : Chunk * new_chunk = new GPUBFCAllocator : : Chunk ( ) ; <nl> void GPUBFCAllocator : : SplitChunk ( GPUBFCAllocator : : Chunk * c , size_t num_bytes ) { <nl> c - > size = num_bytes ; <nl> <nl> / / The new chunk is not in use . <nl> - new_chunk - > in_use = false ; <nl> + new_chunk - > allocation_id = - 1 ; <nl> <nl> / / Maintain the pointers . <nl> / / c < - > c_neighbor becomes <nl> void GPUBFCAllocator : : DeallocateRawInternal ( void * ptr ) { <nl> void GPUBFCAllocator : : Merge ( GPUBFCAllocator : : Chunk * c1 , <nl> GPUBFCAllocator : : Chunk * c2 ) { <nl> / / We can only merge chunks that are not in use . <nl> - CHECK ( ! c1 - > in_use & & ! c2 - > in_use ) ; <nl> + CHECK ( ! c1 - > in_use ( ) & & ! c2 - > in_use ( ) ) ; <nl> <nl> / / c1 ' s prev doesn ' t change , still points to the same ptr , and is <nl> / / still not in use . <nl> void GPUBFCAllocator : : DeleteChunk ( Chunk * c ) { <nl> } <nl> <nl> void GPUBFCAllocator : : InsertFreeChunkIntoBin ( GPUBFCAllocator : : Chunk * c ) { <nl> - CHECK ( ! c - > in_use & & ! c - > bin ) ; <nl> + CHECK ( ! c - > in_use ( ) & & ! c - > bin ) ; <nl> auto it = bins_ . lower_bound ( c - > size ) ; <nl> CHECK ( it ! = bins_ . end ( ) ) < < " Tried to reassign to non - existent bin for size " <nl> < < c - > size ; <nl> void GPUBFCAllocator : : InsertFreeChunkIntoBin ( GPUBFCAllocator : : Chunk * c ) { <nl> } <nl> <nl> void GPUBFCAllocator : : RemoveFreeChunkFromBin ( GPUBFCAllocator : : Chunk * c ) { <nl> - CHECK ( ! c - > in_use & & c - > bin ) ; <nl> + CHECK ( ! c - > in_use ( ) & & c - > bin ) ; <nl> int count = c - > bin - > free_chunks . erase ( c ) ; <nl> CHECK ( count > 0 ) < < " Could not find chunk in bin " ; <nl> c - > bin = nullptr ; <nl> } <nl> <nl> void GPUBFCAllocator : : FreeAndMaybeCoalesce ( GPUBFCAllocator : : Chunk * c ) { <nl> - CHECK ( c - > in_use & & ! c - > bin ) ; <nl> + CHECK ( c - > in_use ( ) & & ! c - > bin ) ; <nl> <nl> / / Mark the chunk as no longer in use <nl> - c - > in_use = false ; <nl> + c - > allocation_id = - 1 ; <nl> <nl> / / This chunk is no longer in - use , consider coalescing the chunk <nl> / / with adjacent chunks . <nl> void GPUBFCAllocator : : FreeAndMaybeCoalesce ( GPUBFCAllocator : : Chunk * c ) { <nl> <nl> / / If the next chunk is free , coalesce the two , if the result would <nl> / / fit in an existing bin . <nl> - if ( c - > next & & ! c - > next - > in_use ) { <nl> + if ( c - > next & & ! c - > next - > in_use ( ) ) { <nl> VLOG ( 8 ) < < " Chunk at " < < c - > next - > ptr < < " merging with c " < < c - > ptr ; <nl> <nl> chunk_to_reassign = c ; <nl> void GPUBFCAllocator : : FreeAndMaybeCoalesce ( GPUBFCAllocator : : Chunk * c ) { <nl> } <nl> <nl> / / If the previous chunk is free , coalesce the two <nl> - if ( c - > prev & & ! c - > prev - > in_use ) { <nl> + if ( c - > prev & & ! c - > prev - > in_use ( ) ) { <nl> VLOG ( 8 ) < < " Chunk at " < < c - > ptr < < " merging into c - > prev " <nl> < < c - > prev - > ptr ; <nl> <nl> size_t GPUBFCAllocator : : AllocatedSize ( void * ptr ) { <nl> return c - > size ; <nl> } <nl> <nl> + int64 GPUBFCAllocator : : AllocationId ( void * ptr ) { <nl> + mutex_lock l ( lock_ ) ; <nl> + auto it = ptr_to_chunk_map_ . find ( ptr ) ; <nl> + CHECK ( it ! = ptr_to_chunk_map_ . end ( ) ) <nl> + < < " Asked for allocation id of pointer we never allocated : " < < ptr ; <nl> + GPUBFCAllocator : : Chunk * c = it - > second ; <nl> + return c - > allocation_id ; <nl> + } <nl> + <nl> void GPUBFCAllocator : : DumpMemoryLog ( size_t num_bytes ) { <nl> / / For each bin : tally up the total number of chunks and bytes . <nl> / / Note that bins hold only free chunks . <nl> void GPUBFCAllocator : : DumpMemoryLog ( size_t num_bytes ) { <nl> total_bytes_in_bin + = c - > size ; <nl> total_requested_bytes_in_bin + = c - > requested_size ; <nl> + + total_chunks_in_bin ; <nl> - if ( c - > in_use ) { <nl> + if ( c - > in_use ( ) ) { <nl> total_bytes_in_use + = c - > size ; <nl> total_requested_bytes_in_use + = c - > requested_size ; <nl> + + total_chunks_in_use ; <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_bfc_allocator . h <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_bfc_allocator . h <nl> class GPUBFCAllocator : public VisitableAllocator { <nl> <nl> size_t AllocatedSize ( void * ptr ) override ; <nl> <nl> + int64 AllocationId ( void * ptr ) override ; <nl> + <nl> private : <nl> struct Bin ; <nl> <nl> class GPUBFCAllocator : public VisitableAllocator { <nl> / / strategy is efficient . <nl> size_t requested_size = 0 ; <nl> <nl> - bool in_use = false ; <nl> + / / allocation_id is set to - 1 when the chunk is not in use . It is assigned a <nl> + / / value greater than zero before the chunk is returned from <nl> + / / AllocateRaw , and this value is unique among values assigned by <nl> + / / the parent allocator . <nl> + int64 allocation_id = - 1 ; <nl> void * ptr = nullptr ; / / pointer to granted GPU subbuffer . <nl> <nl> / / If not null , the memory referred to by ' prev ' is directly <nl> class GPUBFCAllocator : public VisitableAllocator { <nl> / / What bin are we in ? <nl> Bin * bin = nullptr ; <nl> <nl> + bool in_use ( ) { return allocation_id ! = - 1 ; } <nl> + <nl> string DebugString ( bool recurse ) { <nl> string dbg ; <nl> strings : : StrAppend ( & dbg , " Size : " , strings : : HumanReadableNumBytes ( size ) , <nl> " | Requested Size : " , <nl> strings : : HumanReadableNumBytes ( requested_size ) , <nl> - " | in_use : " , in_use ) ; <nl> + " | in_use : " , in_use ( ) ) ; <nl> if ( recurse & & prev ) { <nl> strings : : StrAppend ( & dbg , " , prev : " , prev - > DebugString ( false ) ) ; <nl> } <nl> class GPUBFCAllocator : public VisitableAllocator { <nl> / / Called once on each region , ASAP . <nl> std : : vector < Visitor > region_visitors_ ; <nl> <nl> + / / Counter containing the next unique identifier to assign to a <nl> + / / newly - created chunk . <nl> + int64 next_allocation_id_ GUARDED_BY ( lock_ ) ; <nl> + <nl> TF_DISALLOW_COPY_AND_ASSIGN ( GPUBFCAllocator ) ; <nl> } ; <nl> <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_debug_allocator . cc <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_debug_allocator . cc <nl> size_t GPUDebugAllocator : : AllocatedSize ( void * ptr ) { <nl> return base_allocator_ - > AllocatedSize ( static_cast < char * > ( ptr ) - MASK_BYTES ) ; <nl> } <nl> <nl> + int64 GPUDebugAllocator : : AllocationId ( void * ptr ) { <nl> + return base_allocator_ - > AllocationId ( static_cast < char * > ( ptr ) - MASK_BYTES ) ; <nl> + } <nl> + <nl> bool GPUDebugAllocator : : CheckHeader ( void * ptr ) { <nl> return CheckMask ( stream_exec_ , static_cast < char * > ( ptr ) - MASK_BYTES , <nl> before_mask ) ; <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_debug_allocator . h <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_debug_allocator . h <nl> class GPUDebugAllocator : public VisitableAllocator { <nl> bool TracksAllocationSizes ( ) override ; <nl> size_t RequestedSize ( void * ptr ) override ; <nl> size_t AllocatedSize ( void * ptr ) override ; <nl> + int64 AllocationId ( void * ptr ) override ; <nl> <nl> / / For testing . <nl> bool CheckHeader ( void * ptr ) ; <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_device . cc <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_device . cc <nl> void BaseGPUDevice : : Compute ( OpKernel * op_kernel , OpKernelContext * context ) { <nl> } <nl> gpu : : cuda : : ScopedActivateExecutorContext scoped_activation { <nl> stream - > parent ( ) , gpu : : cuda : : MultiOpActivation : : kYes } ; <nl> - <nl> - if ( sync_every_op_ ) { <nl> - op_kernel - > Compute ( context ) ; <nl> - if ( context - > status ( ) . ok ( ) ) { <nl> + op_kernel - > Compute ( context ) ; <nl> + if ( context - > status ( ) . ok ( ) ) { <nl> + if ( sync_every_op_ ) { <nl> / / Note : GPUUtil : : Sync ( ) only syncs the default stream . <nl> / / We need to either sync the stream used by this op , or <nl> / / all streams . Given that this flag is typically used for <nl> / / debugging it makes more sense to sync all GPU activity . <nl> context - > SetStatus ( GPUUtil : : SyncAll ( this ) ) ; <nl> } <nl> - } else { <nl> - / / Keep a copy of the inputs before Compute runs , in case they get <nl> - / / deleted . TODO ( misard ) this will be fixed when the tracking is <nl> - / / done right . <nl> - EventMgr : : TensorReferenceVector tensor_refs ; <nl> - const int N_inputs = context - > num_inputs ( ) ; <nl> - tensor_refs . reserve ( N_inputs + context - > num_outputs ( ) ) ; <nl> - for ( int ii = 0 ; ii < N_inputs ; + + ii ) { <nl> - if ( context - > has_input ( ii ) ) { <nl> - if ( IsRefType ( context - > input_dtype ( ii ) ) ) { <nl> - Tensor in = context - > mutable_input ( ii , false ) ; <nl> - tensor_refs . push_back ( TensorReference ( in ) ) ; <nl> - } else { <nl> - const Tensor & in = context - > input ( ii ) ; <nl> - tensor_refs . push_back ( TensorReference ( in ) ) ; <nl> - } <nl> - } <nl> - } <nl> - op_kernel - > Compute ( context ) ; <nl> - if ( context - > status ( ) . ok ( ) ) { <nl> - / / The GPU kernel has been queued , but may not complete for some <nl> - / / time . As soon as this function completes , the caller will <nl> - / / discard its refs on the inputs , outputs and any scratch <nl> - / / tensors it created . Create additional refs here that will be <nl> - / / held until the kernel completes . <nl> - for ( int ii = 0 ; ii < context - > num_temps ( ) ; + + ii ) { <nl> - Tensor * temp = context - > temp ( ii ) ; <nl> - if ( vlog_2 ) { <nl> - VLOG ( 2 ) < < " Saving ref to temp Tensor @ " < < DMAHelper : : base ( temp ) ; <nl> - } <nl> - tensor_refs . push_back ( TensorReference ( * temp ) ) ; <nl> - } <nl> - for ( int ii = 0 ; ii < context - > num_outputs ( ) ; + + ii ) { <nl> - Tensor * temp = context - > mutable_output ( ii ) ; <nl> - if ( nullptr ! = temp ) { <nl> - tensor_refs . push_back ( TensorReference ( * temp ) ) ; <nl> - } <nl> - } <nl> - em_ - > ThenDeleteTensors ( stream , tensor_refs ) ; <nl> - } <nl> } <nl> } <nl> } <nl> <nl> + void BaseGPUDevice : : ConsumeListOfAccessedTensors ( <nl> + DeviceContext * device_context , const TensorReferenceVector & tensor_refs ) { <nl> + GPUDeviceContext * gpu_device_context = device_contexts_ [ 0 ] ; <nl> + if ( device_context ! = nullptr ) { <nl> + gpu_device_context = static_cast < GPUDeviceContext * > ( device_context ) ; <nl> + } <nl> + gpu : : Stream * stream = gpu_device_context - > stream ( ) ; <nl> + em_ - > ThenDeleteTensors ( stream , tensor_refs ) ; <nl> + } <nl> + <nl> Status BaseGPUDevice : : Sync ( ) { return GPUUtil : : Sync ( this ) ; } <nl> <nl> void BaseGPUDevice : : ComputeAsync ( AsyncOpKernel * op_kernel , <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_device . h <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_device . h <nl> class BaseGPUDevice : public LocalDevice { <nl> / / GPU devices require the Op Compute method to save a reference to <nl> / / any temporary tensors that are allocated until the Op execution <nl> / / completes . <nl> - bool SaveTemporaryTensors ( ) const override { return true ; } <nl> + bool RequiresRecordingAccessedTensors ( ) const override { return true ; } <nl> + <nl> + void ConsumeListOfAccessedTensors ( <nl> + DeviceContext * device_context , <nl> + const TensorReferenceVector & tensor_refs ) override ; <nl> <nl> Status FillContextMap ( const Graph * graph , <nl> DeviceContextMap * device_context_map ) ; <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_event_mgr . h <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_event_mgr . h <nl> class EventMgr { <nl> <nl> ~ EventMgr ( ) ; <nl> <nl> - typedef gtl : : InlinedVector < TensorReference , 4 > TensorReferenceVector ; <nl> - <nl> / / Releases the references on the elements of " tensors " as soon as <nl> / / all events currently enqueued on " stream " have completed . <nl> void ThenDeleteTensors ( perftools : : gputools : : Stream * stream , <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_event_mgr_test . cc <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_event_mgr_test . cc <nl> class TEST_EventMgrHelper { <nl> } <nl> <nl> void QueueTensors ( perftools : : gputools : : Stream * stream , <nl> - EventMgr : : TensorReferenceVector * tensors ) { <nl> + TensorReferenceVector * tensors ) { <nl> mutex_lock l ( em_ - > mu_ ) ; <nl> em_ - > QueueTensors ( stream , tensors ) ; <nl> } <nl> TEST ( EventMgr , Empty ) { <nl> EXPECT_EQ ( 0 , th . free_size ( ) ) ; <nl> } <nl> <nl> - static void AddTensorReference ( EventMgr : : TensorReferenceVector * v , int64 size ) { <nl> + static void AddTensorReference ( TensorReferenceVector * v , int64 size ) { <nl> TestTensorBuffer * buf = new TestTensorBuffer ( size ) ; <nl> v - > push_back ( TensorReference ( buf ) ) ; <nl> buf - > Unref ( ) ; <nl> TEST ( EventMgr , DelayedPolling ) { <nl> / / isn ' t needed to clear the queue . <nl> th . StopPollingLoop ( ) ; <nl> EXPECT_EQ ( 0 , th . queue_size ( ) ) ; <nl> - EventMgr : : TensorReferenceVector * v = nullptr ; <nl> + TensorReferenceVector * v = nullptr ; <nl> std : : unique_ptr < gpu : : Stream > stream ( new gpu : : Stream ( stream_exec ) ) ; <nl> CHECK ( stream . get ( ) ) ; <nl> stream - > Init ( ) ; <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> - v = new EventMgr : : TensorReferenceVector ; <nl> + v = new TensorReferenceVector ; <nl> AddTensorReference ( v , 100 * 1048576 ) ; <nl> th . QueueTensors ( stream . get ( ) , v ) ; <nl> EXPECT_EQ ( i + 1 , th . queue_size ( ) ) ; <nl> TEST ( EventMgr , DelayedPolling ) { <nl> EXPECT_EQ ( 5 , th . free_size ( ) ) ; <nl> for ( int j = 0 ; j < 2 ; + + j ) { <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> - v = new EventMgr : : TensorReferenceVector ; <nl> + v = new TensorReferenceVector ; <nl> AddTensorReference ( v , 100 * 1048576 ) ; <nl> th . QueueTensors ( stream . get ( ) , v ) ; <nl> EXPECT_EQ ( i + 1 , th . queue_size ( ) ) ; <nl> TEST ( EventMgr , FlushLargeTensorImmediately ) { <nl> CHECK ( stream . get ( ) ) ; <nl> stream - > Init ( ) ; <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> - EventMgr : : TensorReferenceVector v ; <nl> + TensorReferenceVector v ; <nl> AddTensorReference ( & v , 100 * 1048576 ) ; <nl> em . ThenDeleteTensors ( stream . get ( ) , v ) ; <nl> th . PollEvents ( false ) ; / / Ensure things get registered to be freed by Poll <nl> TEST ( EventMgr , ManySmallTensorsFlushedImmediately ) { <nl> CHECK ( stream . get ( ) ) ; <nl> stream - > Init ( ) ; <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> - EventMgr : : TensorReferenceVector v ; <nl> + TensorReferenceVector v ; <nl> for ( int i = 0 ; i < 1000 ; i + + ) { <nl> AddTensorReference ( & v , 100 * 1024 ) ; <nl> } <nl> TEST ( EventMgr , StreamSwitchingFlushesImmediately ) { <nl> std : : unique_ptr < gpu : : Stream > stream2 ( new gpu : : Stream ( stream_exec ) ) ; <nl> stream1 - > Init ( ) ; <nl> stream2 - > Init ( ) ; <nl> - EventMgr : : TensorReferenceVector v1 ; <nl> + TensorReferenceVector v1 ; <nl> AddTensorReference ( & v1 , 1024 ) ; <nl> em . ThenDeleteTensors ( stream1 . get ( ) , v1 ) ; <nl> <nl> - EventMgr : : TensorReferenceVector v2 ; <nl> + TensorReferenceVector v2 ; <nl> AddTensorReference ( & v2 , 1024 ) ; <nl> int64 initial_live_bytes = live_tensor_bytes ; <nl> em . ThenDeleteTensors ( stream2 . get ( ) , v2 ) ; <nl> TEST ( EventMgr , ManySmallTensorsSeperateCallsFlushed ) { <nl> stream - > Init ( ) ; <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> for ( int i = 0 ; i < 1000 ; i + + ) { <nl> - EventMgr : : TensorReferenceVector v ; <nl> + TensorReferenceVector v ; <nl> AddTensorReference ( & v , 100 * 1024 ) ; <nl> em . ThenDeleteTensors ( stream . get ( ) , v ) ; <nl> } <nl> TEST ( EventMgr , LongDelayedPolling ) { <nl> CHECK ( stream . get ( ) ) ; <nl> stream - > Init ( ) ; <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> - EventMgr : : TensorReferenceVector * v = new EventMgr : : TensorReferenceVector ; <nl> + TensorReferenceVector * v = new TensorReferenceVector ; <nl> AddTensorReference ( v , 100 * 1048576 ) ; <nl> th . QueueTensors ( stream . get ( ) , v ) ; <nl> EXPECT_EQ ( 1 + i , th . queue_size ( ) ) ; <nl> TEST ( EventMgr , NonEmptyShutdown ) { <nl> CHECK ( stream . get ( ) ) ; <nl> stream - > Init ( ) ; <nl> for ( int i = 0 ; i < 5 ; + + i ) { <nl> - EventMgr : : TensorReferenceVector * v = new EventMgr : : TensorReferenceVector ; <nl> + TensorReferenceVector * v = new TensorReferenceVector ; <nl> AddTensorReference ( v , 100 * 1048576 ) ; <nl> th . QueueTensors ( stream . get ( ) , v ) ; <nl> EXPECT_EQ ( 1 + i , th . queue_size ( ) ) ; <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_region_allocator . cc <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_region_allocator . cc <nl> namespace gpu = : : perftools : : gputools ; <nl> namespace tensorflow { <nl> <nl> GPURegionAllocator : : GPURegionAllocator ( int device_id , size_t total_bytes ) <nl> - : device_id_ ( device_id ) , total_bytes_ ( total_bytes ) { <nl> + : next_allocation_id_ ( 1 ) , device_id_ ( device_id ) , total_bytes_ ( total_bytes ) { <nl> / / Get a pointer to the stream_executor for this device <nl> stream_exec_ = GPUMachineManager ( ) - > ExecutorForDevice ( device_id ) . ValueOrDie ( ) ; <nl> <nl> void * GPURegionAllocator : : AllocateRawInternal ( size_t alignment , <nl> CHECK ( pool - > last ) ; <nl> Chunk * c = pool - > first ; <nl> CHECK ( c ) ; <nl> - CHECK ( ! c - > in_use ) ; <nl> + CHECK ( ! c - > in_use ( ) ) ; <nl> <nl> - c - > in_use = true ; <nl> + c - > allocation_id = next_allocation_id_ + + ; <nl> / / Move c to the back of the queue . <nl> if ( c - > next ! = nullptr ) { <nl> pool - > first = c - > next ; <nl> void GPURegionAllocator : : DeallocateRawInternal ( void * ptr ) { <nl> <nl> Pool * pool = & ( pools_ [ c - > size ] ) ; <nl> / / Move chunk to head of queue , and mark free . <nl> - DCHECK ( c - > in_use ) ; <nl> - c - > in_use = false ; <nl> + DCHECK ( c - > in_use ( ) ) ; <nl> + c - > allocation_id = - 1 ; <nl> if ( c - > prev ) c - > prev - > next = c - > next ; <nl> if ( c - > next ) c - > next - > prev = c - > prev ; <nl> if ( pool - > first = = c ) pool - > first = c - > next ; <nl> void GPURegionAllocator : : CheckForMemoryLeaks ( ) { <nl> const Pool & p = pool_map . second ; <nl> Chunk * curr_chunk = p . first ; <nl> while ( curr_chunk ! = nullptr ) { <nl> - if ( curr_chunk - > in_use ) { <nl> + if ( curr_chunk - > in_use ( ) ) { <nl> errors . push_back ( <nl> strings : : StrCat ( " Unfreed chunk of size " , curr_chunk - > size ) ) ; <nl> } <nl> void GPURegionAllocator : : DumpMemoryLog ( ) { <nl> / / Iterate backwards ( allocated chunks are last ) . <nl> Chunk * curr_chunk = p . last ; <nl> while ( curr_chunk ! = nullptr ) { <nl> - if ( curr_chunk - > in_use ) { <nl> + if ( curr_chunk - > in_use ( ) ) { <nl> + + chunks_in_use ; <nl> } <nl> curr_chunk = curr_chunk - > prev ; <nl> size_t GPURegionAllocator : : AllocatedSize ( void * ptr ) { <nl> return c - > size ; <nl> } <nl> <nl> + int64 GPURegionAllocator : : AllocationId ( void * ptr ) { <nl> + mutex_lock l ( lock_ ) ; <nl> + auto it = chunk_map_ . find ( ptr ) ; <nl> + CHECK ( it ! = chunk_map_ . end ( ) ) <nl> + < < " Asked for allocation id of pointer we never allocated : " < < ptr ; <nl> + Chunk * c = it - > second ; <nl> + return c - > allocation_id ; <nl> + } <nl> + <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / common_runtime / gpu / gpu_region_allocator . h <nl> ppp b / tensorflow / core / common_runtime / gpu / gpu_region_allocator . h <nl> class GPURegionAllocator : public VisitableAllocator { <nl> bool TracksAllocationSizes ( ) override ; <nl> size_t RequestedSize ( void * ptr ) override ; <nl> size_t AllocatedSize ( void * ptr ) override ; <nl> + int64 AllocationId ( void * ptr ) override ; <nl> <nl> private : <nl> / / A Chunk is the header on a single piece of memory given back <nl> class GPURegionAllocator : public VisitableAllocator { <nl> char * ptr ; / / pointer to granted GPU buffer . <nl> size_t size ; / / Full size of GPU buffer . <nl> size_t bytes_allocated ; / / Bytes asked for by client . <nl> - bool in_use ; <nl> + / / allocation_id is set to - 1 when the chunk is not in use . It is assigned a <nl> + / / value greater than zero before the chunk is returned from <nl> + / / AllocateRaw , and this value is unique among values assigned by <nl> + / / the parent allocator . <nl> + int64 allocation_id ; <nl> Chunk * prev ; / / Used for chaining in pool . <nl> Chunk * next ; <nl> Chunk ( ) <nl> : ptr ( nullptr ) , <nl> size ( 0 ) , <nl> bytes_allocated ( 0 ) , <nl> - in_use ( false ) , <nl> + allocation_id ( - 1 ) , <nl> prev ( nullptr ) , <nl> next ( nullptr ) { } <nl> + bool in_use ( ) { return allocation_id ! = - 1 ; } <nl> } ; <nl> <nl> / / A Pool is a collection of same - sized Chunks . <nl> class GPURegionAllocator : public VisitableAllocator { <nl> mutable mutex lock_ ; <nl> PoolMap pools_ GUARDED_BY ( lock_ ) ; <nl> <nl> + / / Counter containing the next unique identifier to assign to a <nl> + / / newly - created chunk . <nl> + int64 next_allocation_id_ GUARDED_BY ( lock_ ) ; <nl> + <nl> / / Owns regions . <nl> std : : vector < Region * > regions_ GUARDED_BY ( lock_ ) ; <nl> <nl> mmm a / tensorflow / core / framework / allocation_description . proto <nl> ppp b / tensorflow / core / framework / allocation_description . proto <nl> message AllocationDescription { <nl> <nl> / / Name of the allocator used <nl> string allocator_name = 3 ; <nl> + <nl> + / / Identifier of the allocated buffer if known <nl> + int64 allocation_id = 4 ; <nl> + <nl> + / / Set if this tensor only has one remaining reference <nl> + bool has_single_reference = 5 ; <nl> } ; <nl> mmm a / tensorflow / core / framework / allocator . h <nl> ppp b / tensorflow / core / framework / allocator . h <nl> class Allocator { <nl> / / allocated by this allocator . <nl> virtual size_t AllocatedSize ( void * ptr ) { return RequestedSize ( ptr ) ; } <nl> <nl> + / / Returns either 0 or an identifier assigned to the buffer at ' ptr ' <nl> + / / when the buffer was returned by AllocateRaw . If non - zero , the <nl> + / / identifier differs from every other ID assigned by this <nl> + / / allocator . <nl> + / / <nl> + / / REQUIRES : TracksAllocationSizes ( ) is true . <nl> + / / <nl> + / / REQUIRES : ' ptr ! = nullptr ' and points to a buffer previously <nl> + / / allocated by this allocator . <nl> + virtual int64 AllocationId ( void * ptr ) { return 0 ; } <nl> + <nl> / / is_simple < T > : : value if T [ ] can be safely constructed and destructed <nl> / / without running T ( ) and ~ T ( ) . We do not use std : : is_trivial < T > <nl> / / directly because std : : complex < float > is not trival but its array <nl> mmm a / tensorflow / core / framework / device_base . h <nl> ppp b / tensorflow / core / framework / device_base . h <nl> class DeviceBase { <nl> / / Override this to return true for devices that require an Op ' s <nl> / / compute method to save references to the temporary tensors it <nl> / / allocates until the Op execution completes <nl> - virtual bool SaveTemporaryTensors ( ) const { return false ; } <nl> + virtual bool RequiresRecordingAccessedTensors ( ) const { return false ; } <nl> <nl> struct CpuWorkerThreads { <nl> int num_threads = 0 ; <nl> mmm a / tensorflow / core / framework / op_kernel . cc <nl> ppp b / tensorflow / core / framework / op_kernel . cc <nl> Status OpKernelConstruction : : allocate_persistent ( <nl> / / OpKernelContext mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> OpKernelContext : : OpKernelContext ( const Params & params ) <nl> - : params_ ( params ) , <nl> - outputs_ ( params . op_kernel - > output_types ( ) . size ( ) ) , <nl> - output_allocation_types_ ( params . op_kernel - > output_types ( ) . size ( ) ) { <nl> + : params_ ( params ) , outputs_ ( params . op_kernel - > output_types ( ) . size ( ) ) { <nl> Allocator * eigen_gpu_allocator = get_allocator ( AllocatorAttributes ( ) ) ; <nl> eigen_gpu_device_ = params_ . device - > MakeGpuDevice ( params_ . op_device_context , <nl> eigen_gpu_allocator ) ; <nl> OpKernelContext : : ~ OpKernelContext ( ) { <nl> delete value . tensor ; <nl> } <nl> } <nl> - for ( Tensor * t : temp_tensors_ ) delete t ; <nl> delete eigen_gpu_device_ ; <nl> } <nl> <nl> - Status OpKernelContext : : input ( const string & name , const Tensor * * tensor ) const { <nl> + Status OpKernelContext : : input ( const string & name , const Tensor * * tensor ) { <nl> int start , stop ; <nl> TF_RETURN_IF_ERROR ( params_ . op_kernel - > InputRange ( name , & start , & stop ) ) ; <nl> if ( stop ! = start + 1 ) { <nl> Status OpKernelContext : : input ( const string & name , const Tensor * * tensor ) const { <nl> " ' when immutable input was expected " ) ; <nl> } <nl> * tensor = ( * params_ . inputs ) [ start ] . tensor ; <nl> + record_tensor_reference ( * * tensor ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> Status OpKernelContext : : mutable_input ( const string & name , Tensor * tensor , <nl> mutex_lock l ( * input_ref_mutex ( start ) ) ; <nl> * tensor = * ( * params_ . inputs ) [ start ] . tensor ; <nl> } <nl> + record_tensor_reference ( * tensor ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> Status OpKernelContext : : replace_ref_input ( const string & name , <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - Status OpKernelContext : : input_list ( const string & name , <nl> - OpInputList * list ) const { <nl> + Status OpKernelContext : : input_list ( const string & name , OpInputList * list ) { <nl> int start , stop ; <nl> TF_RETURN_IF_ERROR ( params_ . op_kernel - > InputRange ( name , & start , & stop ) ) ; <nl> * list = OpInputList ( this , start , stop ) ; <nl> mmm a / tensorflow / core / framework / op_kernel . h <nl> ppp b / tensorflow / core / framework / op_kernel . h <nl> limitations under the License . <nl> # include " tensorflow / core / framework / tracking_allocator . h " <nl> # include " tensorflow / core / framework / types . h " <nl> # include " tensorflow / core / framework / types . pb . h " <nl> + # include " tensorflow / core / framework / unique_tensor_references . h " <nl> # include " tensorflow / core / lib / core / errors . h " <nl> # include " tensorflow / core / platform / logging . h " <nl> # include " tensorflow / core / platform / macros . h " <nl> class OpInputList { <nl> public : <nl> typedef OpArgIterator < OpInputList , const Tensor & > Iterator ; <nl> OpInputList ( ) : ctx_ ( nullptr ) , start_ ( 0 ) , stop_ ( 0 ) { } <nl> - OpInputList ( const OpKernelContext * ctx , int start , int stop ) <nl> + OpInputList ( OpKernelContext * ctx , int start , int stop ) <nl> : ctx_ ( ctx ) , start_ ( start ) , stop_ ( stop ) { } <nl> OpInputList & operator = ( const OpInputList & other ) = default ; <nl> const Tensor & operator [ ] ( int i ) const ; <nl> class OpInputList { <nl> Iterator end ( ) const { return Iterator ( this , size ( ) ) ; } <nl> <nl> private : <nl> - const OpKernelContext * ctx_ ; / / not owned <nl> + OpKernelContext * ctx_ ; / / not owned <nl> int start_ ; <nl> int stop_ ; <nl> } ; <nl> class OpKernelContext { <nl> / / inputs . For Ref inputs use mutable_input below . <nl> / / REQUIRES : ! IsRefType ( input_dtype ( index ) ) <nl> / / TODO ( mrry ) : Convert this to return Status . <nl> - const Tensor & input ( int index ) const ; <nl> + const Tensor & input ( int index ) ; <nl> <nl> / / Returns the named immutable input tensor in " tensor " , as defined <nl> / / in the OpDef . May only be used for non - Ref inputs . For Ref inputs <nl> / / use mutable_input below . <nl> / / REQUIRES : ! IsRefType ( input_dtype ( index ) ) <nl> / / REQUIRES : the named input must not be a list . <nl> - Status input ( const string & name , const Tensor * * tensor ) const ; <nl> + Status input ( const string & name , const Tensor * * tensor ) ; <nl> <nl> / / Returns the named list - valued immutable input in " list " , as <nl> / / defined in the OpDef . If the named output is not list - valued , <nl> / / returns a one - element list . May only be used for non - Ref <nl> / / inputs . For Ref inputs use mutable_input below . <nl> / / REQUIRES : ! IsRefType ( input_dtype ( index ) ) <nl> - Status input_list ( const string & name , OpInputList * list ) const ; <nl> + Status input_list ( const string & name , OpInputList * list ) ; <nl> <nl> / / For mutable inputs , use the following together to make sure there <nl> / / is no concurrent access to mutable_input ( ) , e . g . : <nl> class OpKernelContext { <nl> / / TODO ( tucker ) : Add example usage . <nl> DeviceBase * device ( ) const { return params_ . device ; } <nl> <nl> - / / Access to list of temporary tensors . <nl> - int num_temps ( ) ; <nl> - Tensor * temp ( int index ) ; <nl> - <nl> - / / Access to information about whether each output was newly <nl> - / / allocated or copied from an existing tensor <nl> - AllocationType output_allocation_type ( int index ) const { <nl> - return output_allocation_types_ [ index ] ; <nl> - } <nl> + / / Retrieve list of referenced tensors in out_vector . Once this is <nl> + / / called , it is not legal to reference any more tensors . Should <nl> + / / not be called from Op kernels . <nl> + void retrieve_accessed_tensors ( TensorReferenceVector * out_vector ) ; <nl> <nl> / / Per - step resource manager for use by white - listed internal ops . <nl> ResourceMgr * step_resource_manager ( ) const { <nl> class OpKernelContext { <nl> } <nl> } <nl> <nl> + / / Internal method to add a tensor ' s buffer to the list of buffers <nl> + / / referenced during the execution of the Op , so that GPUs may <nl> + / / accurately track the memory that may not be reused until the Op <nl> + / / execution completes . <nl> + void record_tensor_reference ( const Tensor & tensor ) ; <nl> + <nl> / / Internal common method used when allocating tensor memory <nl> Status allocate_tensor ( DataType type , const TensorShape & shape , <nl> Tensor * out_tensor , <nl> class OpKernelContext { <nl> mutable mutex mu_ ; / / mutable so const accessors can acquire the lock <nl> gtl : : InlinedVector < WrappedAllocator , 4 > wrapped_allocators_ GUARDED_BY ( mu_ ) ; <nl> gtl : : InlinedVector < TensorValue , 4 > outputs_ ; <nl> - gtl : : InlinedVector < AllocationType , 4 > output_allocation_types_ ; <nl> - gtl : : InlinedVector < Tensor * , 4 > temp_tensors_ ; <nl> + UniqueTensorReferences referenced_tensors_ GUARDED_BY ( mu_ ) ; <nl> bool is_output_dead_ = false ; <nl> <nl> TF_DISALLOW_COPY_AND_ASSIGN ( OpKernelContext ) ; <nl> inline DataType OpKernelContext : : expected_output_dtype ( int index ) const { <nl> return params_ . op_kernel - > output_type ( index ) ; <nl> } <nl> <nl> - inline const Tensor & OpKernelContext : : input ( int index ) const { <nl> + inline void OpKernelContext : : record_tensor_reference ( const Tensor & tensor ) { <nl> + if ( params_ . device - > RequiresRecordingAccessedTensors ( ) ) { <nl> + mutex_lock l ( mu_ ) ; <nl> + / / Keep a reference to the underlying memory around . <nl> + referenced_tensors_ . Add ( tensor ) ; <nl> + } <nl> + } <nl> + <nl> + inline void OpKernelContext : : retrieve_accessed_tensors ( <nl> + TensorReferenceVector * out_vector ) { <nl> + mutex_lock l ( mu_ ) ; <nl> + referenced_tensors_ . FreezeAndReturnReferences ( out_vector ) ; <nl> + } <nl> + <nl> + inline const Tensor & OpKernelContext : : input ( int index ) { <nl> DCHECK_GE ( index , 0 ) ; <nl> DCHECK_LT ( index , params_ . inputs - > size ( ) ) ; <nl> DCHECK ( ! ( * params_ . inputs ) [ index ] . is_ref ( ) ) ; <nl> - return * ( ( * params_ . inputs ) [ index ] . tensor ) ; <nl> + const Tensor & tensor = * ( ( * params_ . inputs ) [ index ] . tensor ) ; <nl> + record_tensor_reference ( tensor ) ; <nl> + return tensor ; <nl> } <nl> <nl> inline Tensor OpKernelContext : : mutable_input ( int index , bool lock_held ) { <nl> inline Tensor OpKernelContext : : mutable_input ( int index , bool lock_held ) { <nl> DCHECK ( ( * params_ . inputs ) [ index ] . is_ref ( ) ) ; <nl> / / return a copy of the Ref acquired while holding the mutex <nl> if ( lock_held ) { <nl> - return * ( ( * params_ . inputs ) [ index ] . tensor ) ; <nl> + Tensor & tensor = * ( ( * params_ . inputs ) [ index ] . tensor ) ; <nl> + record_tensor_reference ( tensor ) ; <nl> + return tensor ; <nl> } else { <nl> mutex_lock l ( * input_ref_mutex ( index ) ) ; <nl> - return * ( ( * params_ . inputs ) [ index ] . tensor ) ; <nl> + Tensor & tensor = * ( ( * params_ . inputs ) [ index ] . tensor ) ; <nl> + record_tensor_reference ( tensor ) ; <nl> + return tensor ; <nl> } <nl> } <nl> <nl> inline void OpKernelContext : : replace_ref_input ( int index , const Tensor & tensor , <nl> mutex_lock l ( * input_ref_mutex ( index ) ) ; <nl> * ( * params_ . inputs ) [ index ] . tensor = tensor ; <nl> } <nl> + record_tensor_reference ( tensor ) ; <nl> } <nl> <nl> inline void OpKernelContext : : forward_ref_input_to_ref_output ( int input_index , <nl> inline Status OpKernelContext : : allocate_tensor ( <nl> shape . DebugString ( ) ) ; <nl> } <nl> * out_tensor = new_tensor ; <nl> + record_tensor_reference ( new_tensor ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> inline Status OpKernelContext : : allocate_output ( int index , <nl> AllocatorAttributes attr ) { <nl> DCHECK_GE ( index , 0 ) ; <nl> DCHECK_LT ( index , outputs_ . size ( ) ) ; <nl> - / / Record the fact that this output tensor was allocated by the Op <nl> - DCHECK_LT ( index , output_allocation_types_ . size ( ) ) ; <nl> - output_allocation_types_ [ index ] = AT_ALLOCATED ; <nl> const DataType type = params_ . op_kernel - > output_type ( index ) ; <nl> DCHECK ( ! IsRefType ( type ) ) ; <nl> DCHECK ( mutable_output ( index ) = = nullptr ) ; <nl> inline Status OpKernelContext : : allocate_temp ( <nl> const AllocationAttributes & allocation_attr ) { <nl> Status s = <nl> allocate_tensor ( type , shape , out_temp , allocator_attr , allocation_attr ) ; <nl> - if ( s . ok ( ) ) { <nl> - if ( params_ . device - > SaveTemporaryTensors ( ) ) { <nl> - / / keep a reference to the underlying memory around <nl> - temp_tensors_ . push_back ( new Tensor ( * out_temp ) ) ; <nl> - } <nl> - } <nl> return s ; <nl> } <nl> <nl> inline Status OpKernelContext : : allocate_persistent ( <nl> Status s = allocate_tensor ( type , shape , & persistent , attr ) ; <nl> if ( s . ok ( ) ) { <nl> * out_persistent = PersistentTensor ( persistent ) ; <nl> - / / This call saves a reference to the newly - allocated tensor if we <nl> - / / are saving temporary tensors <nl> - Tensor * allocated = out_persistent - > AccessTensor ( this ) ; <nl> if ( out_tensor ) { <nl> - * out_tensor = allocated ; <nl> + * out_tensor = out_persistent - > AccessTensor ( this ) ; <nl> } <nl> } <nl> return s ; <nl> } <nl> <nl> inline void OpKernelContext : : NotifyUseOfPersistentTensor ( const Tensor & t ) { <nl> - if ( t . IsInitialized ( ) & & params_ . device - > SaveTemporaryTensors ( ) ) { <nl> - / / keep a reference to the underlying memory around <nl> - temp_tensors_ . push_back ( new Tensor ( t ) ) ; <nl> + if ( t . IsInitialized ( ) ) { <nl> + record_tensor_reference ( t ) ; <nl> } <nl> } <nl> <nl> - inline int OpKernelContext : : num_temps ( ) { return temp_tensors_ . size ( ) ; } <nl> - <nl> - inline Tensor * OpKernelContext : : temp ( int index ) { <nl> - DCHECK_GE ( index , 0 ) ; <nl> - DCHECK_LT ( index , temp_tensors_ . size ( ) ) ; <nl> - return temp_tensors_ [ index ] ; <nl> - } <nl> - <nl> inline void OpKernelContext : : set_output ( int index , const Tensor & tensor ) { <nl> DCHECK_GE ( index , 0 ) ; <nl> DCHECK_LT ( index , outputs_ . size ( ) ) ; <nl> - / / Record the fact that this output tensor was set by the Op <nl> - DCHECK_LT ( index , output_allocation_types_ . size ( ) ) ; <nl> - output_allocation_types_ [ index ] = AT_EXISTING ; <nl> DCHECK ( ! IsRefType ( params_ . op_kernel - > output_type ( index ) ) ) ; <nl> DCHECK_EQ ( mutable_output ( index ) , nullptr ) ; <nl> + record_tensor_reference ( tensor ) ; <nl> outputs_ [ index ] = TensorValue ( new Tensor ( tensor ) ) ; <nl> } <nl> <nl> inline void OpKernelContext : : set_output_ref ( int index , mutex * mu , <nl> Tensor * tensor_for_ref ) { <nl> DCHECK_GE ( index , 0 ) ; <nl> DCHECK_LT ( index , outputs_ . size ( ) ) ; <nl> - / / Record the fact that this output tensor was set by reference the Op <nl> - DCHECK_LT ( index , output_allocation_types_ . size ( ) ) ; <nl> - output_allocation_types_ [ index ] = AT_REF ; <nl> DCHECK ( IsRefType ( params_ . op_kernel - > output_type ( index ) ) ) ; <nl> + record_tensor_reference ( * tensor_for_ref ) ; <nl> outputs_ [ index ] = TensorValue ( mu , tensor_for_ref ) ; <nl> } <nl> <nl> inline Tensor * OpKernelContext : : mutable_output ( int index ) { <nl> DCHECK_GE ( index , 0 ) ; <nl> DCHECK_LT ( index , outputs_ . size ( ) ) ; <nl> + / / No need to record_tensor_reference since the output must already <nl> + / / have been set by a call that did so . <nl> return outputs_ [ index ] . tensor ; <nl> } <nl> <nl> mmm a / tensorflow / core / framework / op_kernel_test . cc <nl> ppp b / tensorflow / core / framework / op_kernel_test . cc <nl> TEST_F ( OpKernelTest , MatchSignatureFailes ) { <nl> class DummyDevice : public DeviceBase { <nl> public : <nl> DummyDevice ( Env * env , bool save ) : DeviceBase ( env ) , save_ ( save ) { } <nl> - bool SaveTemporaryTensors ( ) const override { return save_ ; } <nl> + bool RequiresRecordingAccessedTensors ( ) const override { return save_ ; } <nl> Allocator * GetAllocator ( AllocatorAttributes / * attr * / ) override { <nl> return cpu_allocator ( ) ; <nl> } <nl> TEST_F ( OpKernelTest , SaveTempFalse ) { <nl> Tensor t ; <nl> EXPECT_OK ( ctx - > allocate_temp ( DT_FLOAT , TensorShape ( ) , & t ) ) ; <nl> <nl> - EXPECT_EQ ( 0 , ctx - > num_temps ( ) ) ; <nl> + TensorReferenceVector referenced_tensors ; <nl> + ctx - > retrieve_accessed_tensors ( & referenced_tensors ) ; <nl> + EXPECT_EQ ( 0 , referenced_tensors . size ( ) ) ; <nl> <nl> delete ctx ; <nl> delete params . device ; <nl> TEST_F ( OpKernelTest , SaveTempTrue ) { <nl> Tensor t ; <nl> EXPECT_OK ( ctx - > allocate_temp ( DT_FLOAT , TensorShape ( ) , & t ) ) ; <nl> <nl> - EXPECT_EQ ( 1 , ctx - > num_temps ( ) ) ; <nl> + TensorReferenceVector referenced_tensors ; <nl> + ctx - > retrieve_accessed_tensors ( & referenced_tensors ) ; <nl> + EXPECT_EQ ( 1 , referenced_tensors . size ( ) ) ; <nl> + for ( auto & ref : referenced_tensors ) { <nl> + ref . Unref ( ) ; <nl> + } <nl> <nl> delete ctx ; <nl> delete params . device ; <nl> mmm a / tensorflow / core / framework / step_stats . proto <nl> ppp b / tensorflow / core / framework / step_stats . proto <nl> syntax = " proto3 " ; <nl> package tensorflow ; <nl> / / option cc_enable_arenas = true ; <nl> <nl> + import " tensorflow / core / framework / allocation_description . proto " ; <nl> import " tensorflow / core / framework / tensor_description . proto " ; <nl> <nl> / / TODO ( tucker ) : The next 4 message defs are very similar to <nl> message AllocatorMemoryUsed { <nl> int64 peak_bytes = 3 ; <nl> } <nl> <nl> - enum AllocationType { <nl> - AT_NOTUSED = 0 ; / / tensor was not filled in <nl> - AT_ALLOCATED = 1 ; / / tensor was allocated by the Op <nl> - AT_EXISTING = 2 ; / / tensor was set to share the value of an existing tensor <nl> - AT_REF = 3 ; / / tensor was set to be a reference to an existing tensor <nl> - } <nl> - <nl> / / Output sizes recorded for a single execution of a graph node . <nl> message NodeOutput { <nl> int32 slot = 1 ; <nl> - / / Was the tensor allocated by this Op or a previous computation <nl> - AllocationType allocation_type = 2 ; <nl> TensorDescription tensor_description = 3 ; <nl> } ; <nl> <nl> message NodeExecStats { <nl> string timeline_label = 8 ; <nl> int64 scheduled_micros = 9 ; <nl> uint32 thread_id = 10 ; <nl> + repeated AllocationDescription referenced_tensor = 11 ; <nl> } ; <nl> <nl> message DeviceStepStats { <nl> mmm a / tensorflow / core / framework / tensor . cc <nl> ppp b / tensorflow / core / framework / tensor . cc <nl> class Buffer : public TensorBuffer { <nl> if ( alloc_ - > TracksAllocationSizes ( ) ) { <nl> int64 ab = alloc_ - > AllocatedSize ( data_ ) ; <nl> proto - > set_allocated_bytes ( ab ) ; <nl> + int64 id = alloc_ - > AllocationId ( data_ ) ; <nl> + if ( id > 0 ) { <nl> + proto - > set_allocation_id ( id ) ; <nl> + } <nl> + if ( RefCountIsOne ( ) ) { <nl> + proto - > set_has_single_reference ( true ) ; <nl> + } <nl> } <nl> } <nl> <nl> StringPiece Tensor : : tensor_data ( ) const { <nl> return StringPiece ( static_cast < char * > ( buf_ - > data ( ) ) , TotalBytes ( ) ) ; <nl> } <nl> <nl> + bool Tensor : : SharesBufferWith ( const Tensor & b ) const { <nl> + CHECK_NE ( nullptr , buf_ ) ; <nl> + CHECK_NE ( nullptr , b . buf_ ) ; <nl> + return buf_ - > root_buffer ( ) = = b . buf_ - > root_buffer ( ) ; <nl> + } <nl> + <nl> + size_t Tensor : : BufferHash ( ) const { <nl> + CHECK_NE ( nullptr , buf_ ) ; <nl> + return std : : hash < TensorBuffer * > ( ) ( buf_ - > root_buffer ( ) ) ; <nl> + } <nl> + <nl> string Tensor : : DebugString ( ) const { <nl> return strings : : StrCat ( " Tensor < type : " , DataTypeString ( dtype ( ) ) , " shape : " , <nl> shape ( ) . ShortDebugString ( ) , " values : " , <nl> string Tensor : : DebugString ( ) const { <nl> void Tensor : : FillDescription ( TensorDescription * description ) const { <nl> description - > set_dtype ( dtype ( ) ) ; <nl> shape ( ) . AsProto ( description - > mutable_shape ( ) ) ; <nl> - buf_ - > FillAllocationDescription ( <nl> - description - > mutable_allocation_description ( ) ) ; <nl> + if ( IsInitialized ( ) ) { <nl> + buf_ - > FillAllocationDescription ( <nl> + description - > mutable_allocation_description ( ) ) ; <nl> + } <nl> } <nl> <nl> } / / namespace tensorflow <nl> mmm a / tensorflow / core / framework / tensor_reference . h <nl> ppp b / tensorflow / core / framework / tensor_reference . h <nl> limitations under the License . <nl> # ifndef TENSORFLOW_FRAMEWORK_TENSOR_REFERENCE_H_ <nl> # define TENSORFLOW_FRAMEWORK_TENSOR_REFERENCE_H_ <nl> <nl> + # include " tensorflow / core / framework / allocation_description . pb . h " <nl> + # include " tensorflow / core / lib / gtl / inlined_vector . h " <nl> # include " tensorflow / core / public / tensor . h " <nl> <nl> namespace tensorflow { <nl> namespace tensorflow { <nl> / / IMPORTANT : If you do not call Unref ( ) , you will likely leak tensor memory . <nl> class TensorReference { <nl> public : <nl> - explicit TensorReference ( const Tensor & tensor ) : buf_ ( tensor . buf_ ) { <nl> + / / Take the reference of the root buffer so the size will be more accurate <nl> + explicit TensorReference ( const Tensor & tensor ) <nl> + : buf_ ( tensor . buf_ ? tensor . buf_ - > root_buffer ( ) : nullptr ) { <nl> if ( buf_ ) buf_ - > Ref ( ) ; <nl> } <nl> <nl> class TensorReference { <nl> return 128 + ( buf_ ? buf_ - > size ( ) : 0 ) ; <nl> } <nl> <nl> + void FillDescription ( AllocationDescription * description ) const { <nl> + if ( buf_ ) buf_ - > FillAllocationDescription ( description ) ; <nl> + } <nl> + <nl> + / / Convenience function for de - duplicating tensor references . <nl> + bool SharesBufferWith ( const TensorReference & t ) const { <nl> + return buf_ = = t . buf_ ; <nl> + } <nl> + <nl> + / / Convenience function for de - duplicating tensor references . <nl> + bool SharesBufferWith ( const Tensor & t ) const { <nl> + return buf_ = = ( t . buf_ ? t . buf_ - > root_buffer ( ) : nullptr ) ; <nl> + } <nl> + <nl> + / / Convenience function for de - duplicating tensor references . <nl> + size_t BufferHash ( ) const { return std : : hash < TensorBuffer * > ( ) ( buf_ ) ; } <nl> + <nl> / / A constructor used only for tests <nl> explicit TensorReference ( TensorBuffer * test_buffer ) : buf_ ( test_buffer ) { <nl> if ( buf_ ) buf_ - > Ref ( ) ; <nl> class TensorReference { <nl> TensorBuffer * buf_ ; <nl> } ; <nl> <nl> + typedef gtl : : InlinedVector < TensorReference , 4 > TensorReferenceVector ; <nl> + <nl> } / / namespace tensorflow <nl> <nl> # endif / / TENSORFLOW_FRAMEWORK_TENSOR_REFERENCE_H_ <nl> mmm a / tensorflow / core / framework / tracking_allocator . cc <nl> ppp b / tensorflow / core / framework / tracking_allocator . cc <nl> size_t TrackingAllocator : : AllocatedSize ( void * ptr ) { <nl> return allocator_ - > AllocatedSize ( ptr ) ; <nl> } <nl> <nl> + int64 TrackingAllocator : : AllocationId ( void * ptr ) { <nl> + return allocator_ - > AllocationId ( ptr ) ; <nl> + } <nl> + <nl> std : : pair < size_t , size_t > TrackingAllocator : : GetSizesAndUnRef ( ) { <nl> size_t high_watermark ; <nl> size_t total_bytes ; <nl> mmm a / tensorflow / core / framework / tracking_allocator . h <nl> ppp b / tensorflow / core / framework / tracking_allocator . h <nl> class TrackingAllocator : public Allocator { <nl> bool TracksAllocationSizes ( ) override ; <nl> size_t RequestedSize ( void * ptr ) override ; <nl> size_t AllocatedSize ( void * ptr ) override ; <nl> + int64 AllocationId ( void * ptr ) override ; <nl> <nl> / / If the underlying allocator tracks allocation sizes , this returns <nl> / / a pair where the first value is the total number of bytes <nl> new file mode 100644 <nl> index 0000000000000 . . 2bd8d6f9cffc4 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / framework / unique_tensor_references . h <nl> <nl> + # ifndef TENSORFLOW_FRAMEWORK_UNIQUE_TENSOR_REFERENCES_H_ <nl> + # define TENSORFLOW_FRAMEWORK_UNIQUE_TENSOR_REFERENCES_H_ <nl> + <nl> + # include < unordered_set > <nl> + <nl> + # include " tensorflow / core / framework / tensor_reference . h " <nl> + # include " tensorflow / core / lib / gtl / inlined_vector . h " <nl> + # include " tensorflow / core / public / tensor . h " <nl> + <nl> + namespace tensorflow { <nl> + <nl> + / / Helper class to maintain a unique set of tensor references . In the <nl> + / / common case tehre are not many references , so an inline vector is <nl> + / / used for < = kInVector unique elements , defaulting to 4 since that <nl> + / / is the inlined size of TensorReferenceVector . To avoid N ^ 2 <nl> + / / operations when adding N items , any larger number of unique tensor <nl> + / / references switches to using an unordered set . <nl> + class UniqueTensorReferences { <nl> + public : <nl> + UniqueTensorReferences ( ) : frozen_ ( false ) { } <nl> + <nl> + ~ UniqueTensorReferences ( ) { <nl> + if ( ! frozen_ ) { <nl> + / / The references were not retrieved so discard them to avoid <nl> + / / leaking memory . <nl> + TensorReferenceVector refs ; <nl> + FreezeAndReturnReferences ( & refs ) ; <nl> + for ( auto & tensor : refs ) { <nl> + tensor . Unref ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / Adds a reference to tensor if its buffer is not already referenced . <nl> + void Add ( const Tensor & tensor ) { <nl> + DCHECK ( ! frozen_ ) ; <nl> + / / Do nothing if the tensor has a null buffer . <nl> + if ( tensor . IsInitialized ( ) ) { <nl> + if ( referenced_tensors_set_ . size ( ) > 0 ) { <nl> + / / There are enough tensors that we are using a hash set to <nl> + / / de - duplicate . <nl> + const TensorReference tensor_ref ( tensor ) ; <nl> + if ( ! referenced_tensors_set_ . insert ( tensor_ref ) . second ) { <nl> + / / The tensor was a duplicate , so discard the reference . <nl> + tensor_ref . Unref ( ) ; <nl> + } <nl> + } else { <nl> + for ( int i = 0 ; i < referenced_tensors_vector_ . size ( ) ; + + i ) { <nl> + if ( referenced_tensors_vector_ [ i ] . SharesBufferWith ( tensor ) ) { <nl> + / / tensor is a duplicate , so nothing to do . <nl> + return ; <nl> + } <nl> + } <nl> + referenced_tensors_vector_ . push_back ( TensorReference ( tensor ) ) ; <nl> + if ( kInVector = = referenced_tensors_vector_ . size ( ) ) { <nl> + / / There are too many tensors to keep using the N ^ 2 algorithm <nl> + / / so start de - duplicating using a set . <nl> + DCHECK_EQ ( 0 , referenced_tensors_set_ . size ( ) ) ; <nl> + / / Transfer the refs from the vector to the set . <nl> + referenced_tensors_set_ . reserve ( kInVector ) ; <nl> + referenced_tensors_set_ . insert ( referenced_tensors_vector_ . begin ( ) , <nl> + referenced_tensors_vector_ . end ( ) ) ; <nl> + DCHECK_EQ ( kInVector , referenced_tensors_set_ . size ( ) ) ; <nl> + referenced_tensors_vector_ . clear ( ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / No more references may be added after this is called . The unique <nl> + / / references are returning in out_vector . <nl> + void FreezeAndReturnReferences ( TensorReferenceVector * out_vector ) { <nl> + / / Prevent any further additions . <nl> + frozen_ = true ; <nl> + if ( referenced_tensors_set_ . size ( ) > 0 ) { <nl> + DCHECK ( referenced_tensors_vector_ . empty ( ) ) ; <nl> + out_vector - > reserve ( referenced_tensors_set_ . size ( ) ) ; <nl> + for ( const auto & ref : referenced_tensors_set_ ) { <nl> + out_vector - > push_back ( ref ) ; <nl> + } <nl> + referenced_tensors_set_ . clear ( ) ; <nl> + } else { <nl> + out_vector - > reserve ( referenced_tensors_vector_ . size ( ) ) ; <nl> + for ( const auto & ref : referenced_tensors_vector_ ) { <nl> + out_vector - > push_back ( ref ) ; <nl> + } <nl> + referenced_tensors_vector_ . clear ( ) ; <nl> + } <nl> + } <nl> + <nl> + private : <nl> + / / Up to kInVector elements are stored in reference_tensors_vector_ <nl> + / / to avoid any allocations or hash computations in the common <nl> + / / case . When more unique elements are added they move to <nl> + / / referenced_tensors_set_ to avoid an N ^ 2 algorithm on insert . <nl> + static const int kInVector = 4 ; / / Must be > = 1 . <nl> + <nl> + struct TensorReferenceEqualFn { <nl> + bool operator ( ) ( const TensorReference & t1 , <nl> + const TensorReference & t2 ) const { <nl> + return t1 . SharesBufferWith ( t2 ) ; <nl> + } <nl> + } ; <nl> + <nl> + struct TensorReferenceHashFn { <nl> + size_t operator ( ) ( const TensorReference & t ) const { return t . BufferHash ( ) ; } <nl> + } ; <nl> + <nl> + bool frozen_ ; <nl> + TensorReferenceVector referenced_tensors_vector_ ; <nl> + std : : unordered_set < TensorReference , TensorReferenceHashFn , <nl> + TensorReferenceEqualFn > <nl> + referenced_tensors_set_ ; <nl> + } ; <nl> + <nl> + } / / end namespace tensorflow <nl> + <nl> + # endif / / TENSORFLOW_FRAMEWORK_UNIQUE_TENSOR_REFERENCES_H_ <nl> new file mode 100644 <nl> index 0000000000000 . . fd9a5168c4064 <nl> mmm / dev / null <nl> ppp b / tensorflow / core / framework / unique_tensor_references_test . cc <nl> <nl> + # include " tensorflow / core / framework / unique_tensor_references . h " <nl> + <nl> + # include < gtest / gtest . h > <nl> + # include " tensorflow / core / public / status . h " <nl> + <nl> + namespace tensorflow { <nl> + <nl> + TEST ( UniquifyTensors , TestUniqueVector ) { <nl> + UniqueTensorReferences refs ; <nl> + Tensor a ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor b ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + <nl> + EXPECT_FALSE ( a . SharesBufferWith ( b ) ) ; <nl> + <nl> + refs . Add ( a ) ; <nl> + refs . Add ( b ) ; <nl> + TensorReferenceVector tensors ; <nl> + refs . FreezeAndReturnReferences ( & tensors ) ; <nl> + EXPECT_EQ ( 2 , tensors . size ( ) ) ; <nl> + if ( tensors [ 0 ] . SharesBufferWith ( a ) ) { <nl> + EXPECT_TRUE ( tensors [ 1 ] . SharesBufferWith ( b ) ) ; <nl> + } else { <nl> + EXPECT_TRUE ( tensors [ 1 ] . SharesBufferWith ( a ) ) ; <nl> + EXPECT_TRUE ( tensors [ 0 ] . SharesBufferWith ( b ) ) ; <nl> + } <nl> + for ( auto & t : tensors ) { <nl> + t . Unref ( ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( UniquifyTensors , TestNonUniqueVector ) { <nl> + UniqueTensorReferences refs ; <nl> + Tensor a ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor b ( a ) ; <nl> + <nl> + EXPECT_TRUE ( a . SharesBufferWith ( b ) ) ; <nl> + <nl> + refs . Add ( a ) ; <nl> + refs . Add ( b ) ; <nl> + TensorReferenceVector tensors ; <nl> + refs . FreezeAndReturnReferences ( & tensors ) ; <nl> + EXPECT_EQ ( 1 , tensors . size ( ) ) ; <nl> + EXPECT_TRUE ( tensors [ 0 ] . SharesBufferWith ( a ) ) ; <nl> + EXPECT_TRUE ( tensors [ 0 ] . SharesBufferWith ( b ) ) ; <nl> + for ( auto & t : tensors ) { <nl> + t . Unref ( ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( UniquifyTensors , TestNoLeakVector ) { <nl> + UniqueTensorReferences refs ; <nl> + Tensor a ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor b ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + <nl> + EXPECT_FALSE ( a . SharesBufferWith ( b ) ) ; <nl> + <nl> + refs . Add ( a ) ; <nl> + refs . Add ( b ) ; <nl> + } <nl> + <nl> + TEST ( UniquifyTensors , TestUniqueSet ) { <nl> + UniqueTensorReferences refs ; <nl> + Tensor a ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor b ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor c ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor d ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor e ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + <nl> + EXPECT_FALSE ( a . SharesBufferWith ( b ) ) ; <nl> + <nl> + refs . Add ( a ) ; <nl> + refs . Add ( b ) ; <nl> + refs . Add ( c ) ; <nl> + refs . Add ( d ) ; <nl> + refs . Add ( e ) ; <nl> + TensorReferenceVector tensors ; <nl> + refs . FreezeAndReturnReferences ( & tensors ) ; <nl> + EXPECT_EQ ( 5 , tensors . size ( ) ) ; <nl> + for ( auto & t : tensors ) { <nl> + t . Unref ( ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( UniquifyTensors , TestNonUniqueSet ) { <nl> + UniqueTensorReferences refs ; <nl> + Tensor a ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor b ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor c ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor d ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor e ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor f ( c ) ; <nl> + <nl> + EXPECT_TRUE ( f . SharesBufferWith ( c ) ) ; <nl> + <nl> + refs . Add ( a ) ; <nl> + refs . Add ( b ) ; <nl> + refs . Add ( c ) ; <nl> + refs . Add ( d ) ; <nl> + refs . Add ( e ) ; <nl> + refs . Add ( f ) ; <nl> + TensorReferenceVector tensors ; <nl> + refs . FreezeAndReturnReferences ( & tensors ) ; <nl> + EXPECT_EQ ( 5 , tensors . size ( ) ) ; <nl> + for ( auto & t : tensors ) { <nl> + t . Unref ( ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( UniquifyTensors , TestNoLeakSet ) { <nl> + UniqueTensorReferences refs ; <nl> + Tensor a ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor b ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor c ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor d ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + Tensor e ( DT_FLOAT , TensorShape ( { 2 , 2 } ) ) ; <nl> + <nl> + refs . Add ( a ) ; <nl> + refs . Add ( b ) ; <nl> + refs . Add ( c ) ; <nl> + refs . Add ( d ) ; <nl> + refs . Add ( e ) ; <nl> + } <nl> + <nl> + } / / namespace tensorflow <nl> mmm a / tensorflow / core / public / tensor . h <nl> ppp b / tensorflow / core / public / tensor . h <nl> class Tensor { <nl> return shape ( ) . IsSameSize ( b . shape ( ) ) ; <nl> } <nl> <nl> + / / True iff the two tensors use the same underlying refcounted storage <nl> + bool SharesBufferWith ( const Tensor & b ) const ; <nl> + <nl> + / / The BufferHash of two tensors are equal when they share the same <nl> + / / underlying refcounted storage <nl> + size_t BufferHash ( ) const ; <nl> + <nl> / / / Has this Tensor been initialized ? <nl> bool IsInitialized ( ) const ; <nl> <nl>
|
Adds enough auditing to make it possible to track tensor buffers throughout an execution , and build a cost model of memory usage .
|
tensorflow/tensorflow
|
6f62e435ab6c36dfdfdef1acd580b5f278f6723c
|
2016-01-18T20:22:13Z
|
mmm a / core / io / translation_loader_po . cpp <nl> ppp b / core / io / translation_loader_po . cpp <nl> RES TranslationLoaderPO : : load_translation ( FileAccess * f , Error * r_error , const S <nl> String prop = c . substr ( 0 , p ) . strip_edges ( ) ; <nl> String value = c . substr ( p + 1 , c . length ( ) ) . strip_edges ( ) ; <nl> <nl> - if ( prop = = " X - Language " ) { <nl> + if ( prop = = " X - Language " | | prop = = " Language " ) { <nl> translation - > set_locale ( value ) ; <nl> } <nl> } <nl>
|
Fix for not picking up locale of some . po translation files
|
godotengine/godot
|
1065f06eef57b9c402fb731a94a6f4e69f70804d
|
2018-05-28T03:21:05Z
|
mmm a / Documentation / Books / Users / NewFeatures / NewFeatures28 . mdpp <nl> ppp b / Documentation / Books / Users / NewFeatures / NewFeatures28 . mdpp <nl> here . For a list of bugfixes , please consult the <nl> <nl> ! SECTION AQL improvements <nl> <nl> + ! SUBSECTION AQL Graph Traversals / Pattern Matching <nl> + <nl> + Aql offers a new feature to traverse over a graph without writing JavaScript functions <nl> + but with all the other features you know from AQL . <nl> + Therefore a special version of ` FOR variable - name IN expression ` has been introduced . <nl> + This special version has the following format : ` FOR vertex - variable , edge - variable , path - variable IN traversal - expression ` . <nl> + Where ` traversal - expression ` has the following format : <nl> + ` [ depth ] direction start - vertex graph - definition ` <nl> + With the following input parameters : <nl> + <nl> + * depth ( optional ) : can either be an integer value ( 3 ) or a range of integer values ( 1 . . 5 ) . Default is 1 . <nl> + Defines how many steps are executed . <nl> + * direction : can be OUTBOUND or INBOUND or ANY . <nl> + Defines which edge directions are followed . <nl> + * start - vertex : A ` _id ` value or a document . <nl> + Defines where the traversal is started . <nl> + * graph - definition : Either ` GRAPH graph - name ` for graphs created with the graph - module , or a list of edge collections ` edge - col1 , edge - col2 , . . edge - colN ` . <nl> + Defines which edge collections are used for the traversal . <nl> + <nl> + <nl> + The three output variables have the following semantics : <nl> + <nl> + * vertex - variable : The last visited vertex . <nl> + * edge - variable : The last visited edge ( optional ) . <nl> + * path - variable : The complete path from start - vertex to vertex - variable ( optional ) . <nl> + <nl> + This statement can be used identical to the original ` FOR variable - name IN expression ` and for instance filters <nl> + can be defined on the output variables . <nl> + <nl> + As an example one can now find the friends of a friend for a certain user with this AQL statement : <nl> + <nl> + ` ` ` <nl> + FOR foaf , e , path IN 2 ANY @ startUser GRAPH " relations " <nl> + FILTER path . edges [ 0 ] . type = = " friend " <nl> + FILTER path . edges [ 1 ] . type = = " friend " <nl> + FILTER foaf . _id ! = @ startUser <nl> + RETURN DISTINCT foaf <nl> + ` ` ` <nl> + <nl> + Also optimizer rules have been implemented to gain performance of the traversal statement . <nl> + This rules move filter statements into the traversal statement s . t . paths which can never <nl> + pass the filter are not emitted to the variables . <nl> + As an example take the query above and assume there are edges that do not have ` type = = " friend " ` . <nl> + If in the first edge step there is such a non - friend edge the second steps will never <nl> + be computed as they cannot fulfill the filter condition . <nl> + <nl> ! SUBSECTION Array Indexes <nl> <nl> Hash indexes and skiplist indexes can now optionally be defined for array values <nl>
|
Added AQL Graph Traversal in New Features 2 . 8 .
|
arangodb/arangodb
|
155727582d92260e06c755ce24eae1db0734e6a0
|
2015-12-04T14:04:19Z
|
mmm a / include / grpc / impl / codegen / byte_buffer_reader . h <nl> ppp b / include / grpc / impl / codegen / byte_buffer_reader . h <nl> struct grpc_byte_buffer_reader { <nl> struct grpc_byte_buffer * buffer_in ; <nl> struct grpc_byte_buffer * buffer_out ; <nl> / * * Different current objects correspond to different types of byte buffers * / <nl> - union { <nl> + union grpc_byte_buffer_reader_current { <nl> / * * Index into a slice buffer ' s array of slices * / <nl> unsigned index ; <nl> } current ; <nl> mmm a / include / grpc / impl / codegen / compression_types . h <nl> ppp b / include / grpc / impl / codegen / compression_types . h <nl> typedef struct grpc_compression_options { <nl> * behind \ a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL . If present , takes <nl> * precedence over \ a default_algorithm . <nl> * TODO ( dgq ) : currently only available for server channels . * / <nl> - struct { <nl> + struct grpc_compression_options_default_level { <nl> int is_set ; <nl> grpc_compression_level level ; <nl> } default_level ; <nl> typedef struct grpc_compression_options { <nl> / * * The default channel compression algorithm . It ' ll be used in the absence of <nl> * call specific settings . This option corresponds to the channel argument key <nl> * behind \ a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM . * / <nl> - struct { <nl> + struct grpc_compression_options_default_algorithm { <nl> int is_set ; <nl> grpc_compression_algorithm algorithm ; <nl> } default_algorithm ; <nl> mmm a / include / grpc / impl / codegen / grpc_types . h <nl> ppp b / include / grpc / impl / codegen / grpc_types . h <nl> typedef enum { <nl> typedef struct grpc_byte_buffer { <nl> void * reserved ; <nl> grpc_byte_buffer_type type ; <nl> - union { <nl> - struct { <nl> + union grpc_byte_buffer_data { <nl> + struct / * internal * / { <nl> void * reserved [ 8 ] ; <nl> } reserved ; <nl> - struct { <nl> + struct grpc_compressed_buffer { <nl> grpc_compression_algorithm compression ; <nl> grpc_slice_buffer slice_buffer ; <nl> } raw ; <nl> typedef struct grpc_arg_pointer_vtable { <nl> typedef struct { <nl> grpc_arg_type type ; <nl> char * key ; <nl> - union { <nl> + union grpc_arg_value { <nl> char * string ; <nl> int integer ; <nl> - struct { <nl> + struct grpc_arg_pointer { <nl> void * p ; <nl> const grpc_arg_pointer_vtable * vtable ; <nl> } pointer ; <nl> typedef struct grpc_metadata { <nl> / * * The following fields are reserved for grpc internal use . <nl> There is no need to initialize them , and they will be set to garbage <nl> during calls to grpc . * / <nl> - struct { <nl> + struct / * internal * / { <nl> void * obfuscated [ 4 ] ; <nl> } internal_data ; <nl> } grpc_metadata ; <nl> typedef struct grpc_op { <nl> uint32_t flags ; <nl> / * * Reserved for future usage * / <nl> void * reserved ; <nl> - union { <nl> + union grpc_op_data { <nl> / * * Reserved for future usage * / <nl> - struct { <nl> + struct / * internal * / { <nl> void * reserved [ 8 ] ; <nl> } reserved ; <nl> - struct { <nl> + struct grpc_op_send_initial_metadata { <nl> size_t count ; <nl> grpc_metadata * metadata ; <nl> / * * If \ a is_set , \ a compression_level will be used for the call . <nl> * Otherwise , \ a compression_level won ' t be considered * / <nl> - struct { <nl> + struct grpc_op_send_initial_metadata_maybe_compression_level { <nl> uint8_t is_set ; <nl> grpc_compression_level level ; <nl> } maybe_compression_level ; <nl> } send_initial_metadata ; <nl> - struct { <nl> + struct grpc_op_send_message { <nl> struct grpc_byte_buffer * send_message ; <nl> } send_message ; <nl> - struct { <nl> + struct grpc_op_send_status_from_server { <nl> size_t trailing_metadata_count ; <nl> grpc_metadata * trailing_metadata ; <nl> grpc_status_code status ; <nl> typedef struct grpc_op { <nl> object , recv_initial_metadata - > array is owned by the caller ) . <nl> After the operation completes , call grpc_metadata_array_destroy on this <nl> value , or reuse it in a future op . * / <nl> - struct { <nl> + struct grpc_op_recv_initial_metadata { <nl> grpc_metadata_array * recv_initial_metadata ; <nl> } recv_initial_metadata ; <nl> / * * ownership of the byte buffer is moved to the caller ; the caller must <nl> call grpc_byte_buffer_destroy on this value , or reuse it in a future op . <nl> * / <nl> - struct { <nl> + struct grpc_op_recv_message { <nl> struct grpc_byte_buffer * * recv_message ; <nl> } recv_message ; <nl> - struct { <nl> + struct grpc_op_recv_status_on_client { <nl> / * * ownership of the array is with the caller , but ownership of the <nl> elements stays with the call object ( ie key , value members are owned <nl> by the call object , trailing_metadata - > array is owned by the caller ) . <nl> typedef struct grpc_op { <nl> grpc_status_code * status ; <nl> grpc_slice * status_details ; <nl> } recv_status_on_client ; <nl> - struct { <nl> + struct grpc_op_recv_close_on_server { <nl> / * * out argument , set to 1 if the call failed in any way ( seen as a <nl> cancellation on the server ) , or 0 if the call succeeded * / <nl> int * cancelled ; <nl> mmm a / include / grpc / impl / codegen / slice . h <nl> ppp b / include / grpc / impl / codegen / slice . h <nl> typedef struct grpc_slice_refcount { <nl> of data that is copied by value . * / <nl> struct grpc_slice { <nl> struct grpc_slice_refcount * refcount ; <nl> - union { <nl> - struct { <nl> + union grpc_slice_data { <nl> + struct grpc_slice_refcounted { <nl> uint8_t * bytes ; <nl> size_t length ; <nl> } refcounted ; <nl> - struct { <nl> + struct grpc_slice_inlined { <nl> uint8_t length ; <nl> uint8_t bytes [ GRPC_SLICE_INLINED_SIZE ] ; <nl> } inlined ; <nl>
|
Add tags to tagless structs and unions .
|
grpc/grpc
|
b8e68dcdd6946beca5d01aa9ddb7126987ef8f78
|
2017-08-09T14:59:54Z
|
mmm a / tools / darwin / depends / yasm / Makefile <nl> ppp b / tools / darwin / depends / yasm / Makefile <nl> $ ( APPBIN ) : <nl> make - C $ ( SOURCE ) install <nl> <nl> $ ( YASM ) : $ ( APPBIN ) <nl> - rm - f $ ( YASM ) <nl> - ln - s $ ( APPBIN ) $ ( YASM ) <nl> + rm - f $ ( YASM ) ; ln - s $ ( APPBIN ) $ ( YASM ) <nl> <nl> clean : <nl> make - C $ ( SOURCE ) clean <nl>
|
[ osx / ios ] darwin depends , cosmetics
|
xbmc/xbmc
|
032a2f325abc69742d3afc849c88202d743b182a
|
2011-06-13T15:06:30Z
|
mmm a / framework / cybertron / tools / cvt / visualizer / texture . cpp <nl> ppp b / framework / cybertron / tools / cvt / visualizer / texture . cpp <nl> Texture : : Texture ( ) <nl> bool Texture : : UpdateData ( const QImage & img ) { <nl> if ( data_size_ < img . byteCount ( ) ) { <nl> if ( ! data_ ) { <nl> - delete data_ ; <nl> + delete [ ] data_ ; <nl> } <nl> <nl> data_ = new GLubyte [ img . byteCount ( ) ] ; <nl> mmm a / framework / cybertron / tools / cvt / visualizer / texture . h <nl> ppp b / framework / cybertron / tools / cvt / visualizer / texture . h <nl> class Texture { <nl> Texture ( void ) ; <nl> ~ Texture ( ) { <nl> if ( data_ ) { <nl> - delete data_ ; <nl> + delete [ ] data_ ; <nl> data_ = nullptr ; <nl> } <nl> } <nl>
|
Framework : fix memory issue
|
ApolloAuto/apollo
|
39e185c782c7bdaafb31f13ea626e992bb0202ff
|
2018-09-19T19:34:26Z
|
mmm a / hphp / runtime / base / object - data - inl . h <nl> ppp b / hphp / runtime / base / object - data - inl . h <nl> inline void ObjectData : : resetMaxId ( ) { <nl> inline ObjectData : : ObjectData ( Class * cls , uint16_t flags , HeaderKind kind ) <nl> : m_cls ( cls ) <nl> { <nl> - initHeader_16 ( kind , InitialValue , flags ) ; <nl> - assert ( m_aux16 = = flags & & hasExactlyOneRef ( ) ) ; <nl> + initHeader_16 ( kind , InitialValue , flags | cls - > getODAttrs ( ) ) ; <nl> assert ( isObjectKind ( m_kind ) ) ; <nl> assert ( ! cls - > needInitialization ( ) | | cls - > initialized ( ) ) ; <nl> + assert ( ! getAttribute ( IsCollection ) ) ; / / collections use NoInit { } <nl> o_id = + + os_max_id ; <nl> - <nl> - if ( flags & Attribute : : IsCollection ) { <nl> - / / Whatever attribute we need to set , do it via flags and void runtime <nl> - / / loading . These assertions guarantee that ` instanceInit ( cls ) ' is not <nl> - / / needed for collections . <nl> - assertx ( cls - > numDeclProperties ( ) = = 0 ) ; <nl> - return ; <nl> - } <nl> instanceInit ( cls ) ; <nl> } <nl> <nl> inline ObjectData : : ObjectData ( Class * cls , NoInit ) noexcept <nl> : m_cls ( cls ) <nl> { <nl> initHeader_16 ( HeaderKind : : Object , InitialValue , 0 ) ; <nl> - assert ( m_aux16 = = 0 & & hasExactlyOneRef ( ) ) ; <nl> assert ( ! cls - > needInitialization ( ) | | cls - > initialized ( ) ) ; <nl> o_id = + + os_max_id ; <nl> } <nl> inline ObjectData : : ObjectData ( Class * cls , <nl> : m_cls ( cls ) <nl> { <nl> initHeader_16 ( kind , InitialValue , flags ) ; <nl> - assert ( m_aux16 = = flags & & hasExactlyOneRef ( ) ) ; <nl> assert ( isObjectKind ( m_kind ) ) ; <nl> assert ( ! cls - > needInitialization ( ) | | cls - > initialized ( ) ) ; <nl> assert ( ! ( cls - > getODAttrs ( ) & ~ static_cast < uint16_t > ( flags ) ) ) ; <nl> inline ObjectData * ObjectData : : newInstanceNoPropInit ( Class * cls ) { <nl> } <nl> <nl> inline void ObjectData : : instanceInit ( Class * cls ) { <nl> - m_aux16 | = cls - > getODAttrs ( ) ; <nl> - <nl> size_t nProps = cls - > numDeclProperties ( ) ; <nl> if ( nProps > 0 ) { <nl> if ( cls - > pinitVec ( ) . size ( ) > 0 ) { <nl> mmm a / hphp / runtime / ext / collections / ext_collections - pair . h <nl> ppp b / hphp / runtime / ext / collections / ext_collections - pair . h <nl> struct c_Pair : ObjectData { <nl> <nl> c_Pair ( ) = delete ; <nl> explicit c_Pair ( const TypedValue & e0 , const TypedValue & e1 ) <nl> - : ObjectData ( c_Pair : : classof ( ) , collections : : objectFlags , HeaderKind : : Pair ) <nl> + : ObjectData ( c_Pair : : classof ( ) , collections : : objectFlags , HeaderKind : : Pair , <nl> + NoInit { } ) <nl> , m_size ( 2 ) <nl> { <nl> cellDup ( e0 , elm0 ) ; <nl> struct c_Pair : ObjectData { <nl> } <nl> enum class NoIncRef { } ; <nl> explicit c_Pair ( const TypedValue & e0 , const TypedValue & e1 , NoIncRef ) <nl> - : ObjectData ( c_Pair : : classof ( ) , collections : : objectFlags , HeaderKind : : Pair ) <nl> + : ObjectData ( c_Pair : : classof ( ) , collections : : objectFlags , HeaderKind : : Pair , <nl> + NoInit { } ) <nl> , m_size ( 2 ) <nl> { <nl> cellCopy ( e0 , elm0 ) ; <nl> mmm a / hphp / runtime / ext / collections / ext_collections - vector . h <nl> ppp b / hphp / runtime / ext / collections / ext_collections - vector . h <nl> struct BaseVector : ObjectData { <nl> protected : <nl> / / Make sure this one is inlined all the way <nl> explicit BaseVector ( Class * cls , HeaderKind kind ) <nl> - : ObjectData ( cls , collections : : objectFlags , kind ) <nl> + : ObjectData ( cls , collections : : objectFlags , kind , NoInit { } ) <nl> , m_versionAndSize ( 0 ) <nl> , m_arr ( staticEmptyVecArray ( ) ) <nl> { } <nl> explicit BaseVector ( Class * cls , HeaderKind kind , ArrayData * arr ) <nl> - : ObjectData ( cls , collections : : objectFlags , kind ) <nl> + : ObjectData ( cls , collections : : objectFlags , kind , NoInit { } ) <nl> , m_versionAndSize ( arr - > m_size ) <nl> , m_arr ( arr ) <nl> { <nl> assertx ( arr - > isVecArray ( ) ) ; <nl> } <nl> explicit BaseVector ( Class * cls , HeaderKind kind , uint32_t cap ) <nl> - : ObjectData ( cls , collections : : objectFlags , kind ) <nl> + : ObjectData ( cls , collections : : objectFlags , kind , NoInit { } ) <nl> , m_versionAndSize ( 0 ) <nl> , m_arr ( PackedArray : : MakeReserveVec ( cap ) ) <nl> { } <nl> mmm a / hphp / runtime / ext / collections / hash - collection . cpp <nl> ppp b / hphp / runtime / ext / collections / hash - collection . cpp <nl> namespace HPHP { <nl> / / HashCollection <nl> <nl> HashCollection : : HashCollection ( Class * cls , HeaderKind kind , uint32_t cap ) <nl> - : ObjectData ( cls , collections : : objectFlags , kind ) <nl> + : ObjectData ( cls , collections : : objectFlags , kind , NoInit { } ) <nl> , m_versionAndSize ( 0 ) <nl> , m_arr ( cap = = 0 ? staticEmptyDictArrayAsMixed ( ) : <nl> MixedArray : : asMixed ( MixedArray : : MakeReserveDict ( cap ) ) ) <nl> mmm a / hphp / runtime / ext / collections / hash - collection . h <nl> ppp b / hphp / runtime / ext / collections / hash - collection . h <nl> ALWAYS_INLINE MixedArray * staticEmptyDictArrayAsMixed ( ) { <nl> / / Common base class for BaseMap / BaseSet collections <nl> struct HashCollection : ObjectData { <nl> explicit HashCollection ( Class * cls , HeaderKind kind ) <nl> - : ObjectData ( cls , collections : : objectFlags , kind ) <nl> + : ObjectData ( cls , collections : : objectFlags , kind , NoInit { } ) <nl> , m_versionAndSize ( 0 ) <nl> , m_arr ( staticEmptyDictArrayAsMixed ( ) ) <nl> { } <nl> explicit HashCollection ( Class * cls , HeaderKind kind , ArrayData * arr ) <nl> - : ObjectData ( cls , collections : : objectFlags , kind ) <nl> + : ObjectData ( cls , collections : : objectFlags , kind , NoInit { } ) <nl> , m_versionAndSize ( arr - > m_size ) <nl> , m_arr ( MixedArray : : asMixed ( arr ) ) <nl> { } <nl>
|
Collections can use ObjectData : : NoInit constructors
|
facebook/hhvm
|
e5417f064f5e3b9c7803b73beaffbb5a2479e73d
|
2017-09-05T14:21:23Z
|
mmm a / tensorflow / python / kernel_tests / BUILD <nl> ppp b / tensorflow / python / kernel_tests / BUILD <nl> tf_py_test ( <nl> " / / tensorflow / python : framework_test_lib " , <nl> " / / tensorflow / python : lookup_ops " , <nl> " / / tensorflow / python : sparse_tensor " , <nl> + " / / tensorflow / python : tensor_spec " , <nl> " / / tensorflow / python : training " , <nl> " / / tensorflow / python / data / ops : dataset_ops " , <nl> " / / tensorflow / python / data / ops : readers " , <nl> + " / / tensorflow / python / saved_model : load " , <nl> + " / / tensorflow / python / saved_model : save " , <nl> ] , <nl> ) <nl> <nl> mmm a / tensorflow / python / kernel_tests / lookup_ops_test . py <nl> ppp b / tensorflow / python / kernel_tests / lookup_ops_test . py <nl> <nl> from tensorflow . python . framework import errors_impl <nl> from tensorflow . python . framework import ops <nl> from tensorflow . python . framework import sparse_tensor <nl> + from tensorflow . python . framework import tensor_spec <nl> from tensorflow . python . framework import test_util <nl> from tensorflow . python . ops import array_ops <nl> from tensorflow . python . ops import control_flow_ops <nl> <nl> from tensorflow . python . ops import variables <nl> from tensorflow . python . ops . ragged import ragged_tensor <nl> from tensorflow . python . platform import test <nl> + from tensorflow . python . saved_model import load as saved_model_load <nl> + from tensorflow . python . saved_model import save as saved_model_save <nl> from tensorflow . python . training import saver <nl> from tensorflow . python . training import server_lib <nl> from tensorflow . python . training . tracking import graph_view <nl> def testObjectSaveRestore ( self ) : <nl> output = load_table . lookup ( input_string ) <nl> self . assertAllEqual ( [ - 1 , 0 , 1 , 2 , - 1 ] , self . evaluate ( output ) ) <nl> <nl> + @ test_util . run_v2_only <nl> + def testSavedModelSaveRestore ( self ) : <nl> + save_dir = os . path . join ( self . get_temp_dir ( ) , " save_restore " ) <nl> + save_path = os . path . join ( tempfile . mkdtemp ( prefix = save_dir ) , " hash " ) <nl> + <nl> + root = tracking . AutoTrackable ( ) <nl> + <nl> + default_value = - 1 <nl> + empty_key = 0 <nl> + deleted_key = - 1 <nl> + keys = constant_op . constant ( [ 11 , 12 , 13 ] , dtypes . int64 ) <nl> + values = constant_op . constant ( [ 0 , 1 , 2 ] , dtypes . int64 ) <nl> + root . table = lookup_ops . DenseHashTable ( <nl> + dtypes . int64 , <nl> + dtypes . int64 , <nl> + default_value = default_value , <nl> + empty_key = empty_key , <nl> + deleted_key = deleted_key , <nl> + name = " t1 " , <nl> + checkpoint = True , <nl> + initial_num_buckets = 32 ) <nl> + <nl> + @ def_function . function ( <nl> + input_signature = [ tensor_spec . TensorSpec ( ( ) , dtypes . int64 ) ] ) <nl> + def lookup ( key ) : <nl> + return root . table . lookup ( key ) <nl> + <nl> + root . lookup = lookup <nl> + <nl> + self . assertAllEqual ( 0 , root . table . size ( ) ) <nl> + root . table . insert ( keys , values ) <nl> + self . assertAllEqual ( 3 , self . evaluate ( root . table . size ( ) ) ) <nl> + self . assertAllEqual ( 32 , len ( self . evaluate ( root . table . export ( ) [ 0 ] ) ) ) <nl> + <nl> + saved_model_save . save ( root , save_path ) <nl> + <nl> + del root <nl> + loaded = saved_model_load . load ( save_path ) <nl> + self . assertEqual ( loaded . lookup ( 12 ) , 1 ) <nl> + self . assertEqual ( loaded . lookup ( 10 ) , - 1 ) <nl> + <nl> @ test_util . run_v1_only ( " Saver V1 only " ) <nl> def testVectorSaveRestore ( self ) : <nl> save_dir = os . path . join ( self . get_temp_dir ( ) , " vector_save_restore " ) <nl> mmm a / tensorflow / python / ops / lookup_ops . py <nl> ppp b / tensorflow / python / ops / lookup_ops . py <nl> def __init__ ( self , <nl> self . _checkpoint = checkpoint <nl> self . _name = name <nl> <nl> - self . _empty_key = ops . convert_to_tensor ( <nl> - empty_key , dtype = key_dtype , name = " empty_key " ) <nl> - self . _deleted_key = ops . convert_to_tensor ( <nl> - deleted_key , dtype = key_dtype , name = " deleted_key " ) <nl> + self . _empty_key = empty_key <nl> + self . _deleted_key = deleted_key <nl> self . _shared_name = None <nl> if context . executing_eagerly ( ) : <nl> # TODO ( allenl ) : This will leak memory due to kernel caching by the <nl> def _create_resource ( self ) : <nl> # training to work correctly . Use the node name if no shared_name has been <nl> # explicitly specified . <nl> use_node_name_sharing = self . _checkpoint and self . _shared_name is None <nl> + empty_key = ops . convert_to_tensor ( <nl> + self . _empty_key , dtype = self . _key_dtype , name = " empty_key " ) <nl> + deleted_key = ops . convert_to_tensor ( <nl> + self . _deleted_key , dtype = self . _key_dtype , name = " deleted_key " ) <nl> table_ref = gen_lookup_ops . mutable_dense_hash_table_v2 ( <nl> - empty_key = self . _empty_key , <nl> - deleted_key = self . _deleted_key , <nl> + empty_key = empty_key , <nl> + deleted_key = deleted_key , <nl> shared_name = self . _shared_name , <nl> use_node_name_sharing = use_node_name_sharing , <nl> value_dtype = self . _value_dtype , <nl>
|
Fix a bug where ` DenseHashTable ` can ' t be saved to SavedModel , because it tries to save EagerTensors in a TF 1 . x tf . Graph ( used in TF 1 . x style serving APIs ) .
|
tensorflow/tensorflow
|
568e2bef00f24af1159a0846abf67c099ca78a21
|
2020-09-22T23:44:00Z
|
mmm a / dbms / src / Interpreters / InterpreterSelectQuery . cpp <nl> ppp b / dbms / src / Interpreters / InterpreterSelectQuery . cpp <nl> void InterpreterSelectQuery : : executeAggregation ( QueryPipeline & pipeline , const <nl> if ( pipeline . getNumStreams ( ) > 1 ) <nl> { <nl> / / / Add resize transform to uniformly distribute data between aggregating streams . <nl> - pipeline . resize ( pipeline . getNumStreams ( ) , true ) ; <nl> + pipeline . resize ( pipeline . getNumStreams ( ) , true , true ) ; <nl> <nl> auto many_data = std : : make_shared < ManyAggregatedData > ( pipeline . getNumStreams ( ) ) ; <nl> auto merge_threads = settings . aggregation_memory_efficient_merge_threads <nl> mmm a / dbms / src / Processors / QueryPipeline . cpp <nl> ppp b / dbms / src / Processors / QueryPipeline . cpp <nl> void QueryPipeline : : addDelayedStream ( ProcessorPtr source ) <nl> addPipe ( { std : : move ( processor ) } ) ; <nl> } <nl> <nl> - void QueryPipeline : : resize ( size_t num_streams , bool force ) <nl> + void QueryPipeline : : resize ( size_t num_streams , bool force , bool strict ) <nl> { <nl> checkInitialized ( ) ; <nl> <nl> void QueryPipeline : : resize ( size_t num_streams , bool force ) <nl> <nl> has_resize = true ; <nl> <nl> - auto resize = std : : make_shared < ResizeProcessor > ( current_header , getNumStreams ( ) , num_streams ) ; <nl> + ProcessorPtr resize ; <nl> + <nl> + if ( strict ) <nl> + resize = std : : make_shared < StrictResizeProcessor > ( current_header , getNumStreams ( ) , num_streams ) ; <nl> + else <nl> + resize = std : : make_shared < ResizeProcessor > ( current_header , getNumStreams ( ) , num_streams ) ; <nl> + <nl> auto stream = streams . begin ( ) ; <nl> for ( auto & input : resize - > getInputs ( ) ) <nl> connect ( * * ( stream + + ) , input ) ; <nl> mmm a / dbms / src / Processors / QueryPipeline . h <nl> ppp b / dbms / src / Processors / QueryPipeline . h <nl> class QueryPipeline <nl> / / / Check if resize transform was used . ( In that case another distinct transform will be added ) . <nl> bool hasMixedStreams ( ) const { return has_resize | | hasMoreThanOneStream ( ) ; } <nl> <nl> - void resize ( size_t num_streams , bool force = false ) ; <nl> + void resize ( size_t num_streams , bool force = false , bool strict = false ) ; <nl> <nl> void enableQuotaForCurrentStreams ( ) ; <nl> <nl> mmm a / dbms / src / Processors / ResizeProcessor . cpp <nl> ppp b / dbms / src / Processors / ResizeProcessor . cpp <nl> IProcessor : : Status ResizeProcessor : : prepare ( const PortNumbers & updated_inputs , <nl> { <nl> initialized = true ; <nl> <nl> + for ( auto & input : inputs ) <nl> + { <nl> + input . setNeeded ( ) ; <nl> + input_ports . push_back ( { . port = & input , . status = InputStatus : : NotActive } ) ; <nl> + } <nl> + <nl> + for ( auto & output : outputs ) <nl> + output_ports . push_back ( { . port = & output , . status = OutputStatus : : NotActive } ) ; <nl> + } <nl> + <nl> + for ( auto & output_number : updated_outputs ) <nl> + { <nl> + auto & output = output_ports [ output_number ] ; <nl> + if ( output . port - > isFinished ( ) ) <nl> + { <nl> + if ( output . status ! = OutputStatus : : Finished ) <nl> + { <nl> + + + num_finished_outputs ; <nl> + output . status = OutputStatus : : Finished ; <nl> + } <nl> + <nl> + continue ; <nl> + } <nl> + <nl> + if ( output . port - > canPush ( ) ) <nl> + { <nl> + if ( output . status ! = OutputStatus : : NeedData ) <nl> + { <nl> + output . status = OutputStatus : : NeedData ; <nl> + waiting_outputs . push ( output_number ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( num_finished_outputs = = outputs . size ( ) ) <nl> + { <nl> + for ( auto & input : inputs ) <nl> + input . close ( ) ; <nl> + <nl> + return Status : : Finished ; <nl> + } <nl> + <nl> + for ( auto & input_number : updated_inputs ) <nl> + { <nl> + auto & input = input_ports [ input_number ] ; <nl> + if ( input . port - > isFinished ( ) ) <nl> + { <nl> + if ( input . status ! = InputStatus : : Finished ) <nl> + { <nl> + input . status = InputStatus : : Finished ; <nl> + + + num_finished_inputs ; <nl> + } <nl> + continue ; <nl> + } <nl> + <nl> + if ( input . port - > hasData ( ) ) <nl> + { <nl> + if ( input . status ! = InputStatus : : HasData ) <nl> + { <nl> + input . status = InputStatus : : HasData ; <nl> + inputs_with_data . push ( input_number ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + while ( ! waiting_outputs . empty ( ) & & ! inputs_with_data . empty ( ) ) <nl> + { <nl> + auto & waiting_output = output_ports [ waiting_outputs . front ( ) ] ; <nl> + waiting_outputs . pop ( ) ; <nl> + <nl> + auto & input_with_data = input_ports [ inputs_with_data . front ( ) ] ; <nl> + inputs_with_data . pop ( ) ; <nl> + <nl> + waiting_output . port - > pushData ( input_with_data . port - > pullData ( ) ) ; <nl> + input_with_data . status = InputStatus : : NotActive ; <nl> + waiting_output . status = OutputStatus : : NotActive ; <nl> + <nl> + if ( input_with_data . port - > isFinished ( ) ) <nl> + { <nl> + input_with_data . status = InputStatus : : Finished ; <nl> + + + num_finished_inputs ; <nl> + } <nl> + } <nl> + <nl> + if ( num_finished_inputs = = inputs . size ( ) ) <nl> + { <nl> + for ( auto & output : outputs ) <nl> + output . finish ( ) ; <nl> + <nl> + return Status : : Finished ; <nl> + } <nl> + <nl> + if ( ! waiting_outputs . empty ( ) ) <nl> + return Status : : NeedData ; <nl> + <nl> + return Status : : PortFull ; <nl> + } <nl> + <nl> + IProcessor : : Status StrictResizeProcessor : : prepare ( const PortNumbers & updated_inputs , const PortNumbers & updated_outputs ) <nl> + { <nl> + if ( ! initialized ) <nl> + { <nl> + initialized = true ; <nl> + <nl> for ( auto & input : inputs ) <nl> input_ports . push_back ( { . port = & input , . status = InputStatus : : NotActive } ) ; <nl> <nl> IProcessor : : Status ResizeProcessor : : prepare ( const PortNumbers & updated_inputs , <nl> <nl> / / / Enable more inputs if needed . <nl> while ( ! disabled_input_ports . empty ( ) <nl> - & & ( inputs . size ( ) - disabled_input_ports . size ( ) ) < waiting_outputs . size ( ) ) <nl> + & & ( inputs . size ( ) - num_finished_inputs - disabled_input_ports . size ( ) ) < waiting_outputs . size ( ) ) <nl> { <nl> auto & input = input_ports [ disabled_input_ports . front ( ) ] ; <nl> disabled_input_ports . pop ( ) ; <nl> mmm a / dbms / src / Processors / ResizeProcessor . h <nl> ppp b / dbms / src / Processors / ResizeProcessor . h <nl> class ResizeProcessor : public IProcessor <nl> Status prepare ( ) override ; <nl> Status prepare ( const PortNumbers & , const PortNumbers & ) override ; <nl> <nl> + private : <nl> + InputPorts : : iterator current_input ; <nl> + OutputPorts : : iterator current_output ; <nl> + <nl> + size_t num_finished_inputs = 0 ; <nl> + size_t num_finished_outputs = 0 ; <nl> + std : : queue < UInt64 > waiting_outputs ; <nl> + std : : queue < UInt64 > inputs_with_data ; <nl> + bool initialized = false ; <nl> + <nl> + enum class OutputStatus <nl> + { <nl> + NotActive , <nl> + NeedData , <nl> + Finished , <nl> + } ; <nl> + <nl> + enum class InputStatus <nl> + { <nl> + NotActive , <nl> + HasData , <nl> + Finished , <nl> + } ; <nl> + <nl> + struct InputPortWithStatus <nl> + { <nl> + InputPort * port ; <nl> + InputStatus status ; <nl> + } ; <nl> + <nl> + struct OutputPortWithStatus <nl> + { <nl> + OutputPort * port ; <nl> + OutputStatus status ; <nl> + } ; <nl> + <nl> + std : : vector < InputPortWithStatus > input_ports ; <nl> + std : : vector < OutputPortWithStatus > output_ports ; <nl> + } ; <nl> + <nl> + class StrictResizeProcessor : public IProcessor <nl> + { <nl> + public : <nl> + / / / TODO Check that there is non zero number of inputs and outputs . <nl> + StrictResizeProcessor ( const Block & header , size_t num_inputs , size_t num_outputs ) <nl> + : IProcessor ( InputPorts ( num_inputs , header ) , OutputPorts ( num_outputs , header ) ) <nl> + , current_input ( inputs . begin ( ) ) <nl> + , current_output ( outputs . begin ( ) ) <nl> + { <nl> + } <nl> + <nl> + String getName ( ) const override { return " StrictResize " ; } <nl> + <nl> + Status prepare ( const PortNumbers & , const PortNumbers & ) override ; <nl> + <nl> private : <nl> InputPorts : : iterator current_input ; <nl> OutputPorts : : iterator current_output ; <nl>
|
Update ResizeProcessor .
|
ClickHouse/ClickHouse
|
edc28c3dd2ee101e25828059f583bdce163a2690
|
2020-01-13T12:04:02Z
|
mmm a / dbms / programs / server / users . xml <nl> ppp b / dbms / programs / server / users . xml <nl> <nl> < / default > <nl> <nl> < ! - - Example of user with readonly access . - - > <nl> - < readonly > <nl> + < ! - - < readonly > <nl> < password > < / password > <nl> < networks incl = " networks " replace = " replace " > <nl> < ip > : : 1 < / ip > <nl> <nl> < / networks > <nl> < profile > readonly < / profile > <nl> < quota > default < / quota > <nl> - < / readonly > <nl> + < / readonly > - - > <nl> < / users > <nl> <nl> < ! - - Quotas . - - > <nl>
|
Commented out readonly user
|
ClickHouse/ClickHouse
|
6732e4366c7b60ad658f924caea723d8a02af6cf
|
2019-03-19T21:34:44Z
|
mmm a / osquery / tables / networking / tests / darwin / wifi_tests . mm <nl> ppp b / osquery / tables / networking / tests / darwin / wifi_tests . mm <nl> <nl> # include < osquery / core / sql / query_data . h > <nl> # include < osquery / core / system . h > <nl> # include < osquery / registry / registry_factory . h > <nl> + # include < osquery / sql / sql . h > <nl> <nl> namespace osquery { <nl> namespace tables { <nl> void SetUp ( ) { <nl> } ; <nl> <nl> TEST_F ( WifiNetworksTest , test_parse_wifi_networks ) { <nl> - std : : string path = ( getTestConfigDirectory ( ) / " test_airport . plist " ) . string ( ) ; <nl> + / / the keys and values of the plist file have changed with new versions of <nl> + / / macOS , so the version of the test input file has to be consistent <nl> + auto qd = SQL : : selectAllFrom ( " os_version " ) ; <nl> + ASSERT_EQ ( qd . size ( ) , 1 ) ; <nl> + <nl> + std : : string file = <nl> + ( qd . front ( ) . at ( " major " ) < " 11 " & & qd . front ( ) . at ( " minor " ) < " 15 " ) <nl> + ? " test_airport_pre_macOS_10 . 15 . plist " <nl> + : " test_airport . plist " ; <nl> + std : : string path = ( getTestConfigDirectory ( ) / file ) . string ( ) ; <nl> <nl> auto plist = ( __bridge CFDictionaryRef ) <nl> [ NSDictionary dictionaryWithContentsOfFile : @ ( path . c_str ( ) ) ] ; <nl> + ASSERT_NE ( plist , nullptr ) ; <nl> ASSERT_GE ( ( long ) CFDictionaryGetCount ( plist ) , 1 ) ; <nl> std : : string key = " KnownNetworks " ; <nl> auto cfkey = CFStringCreateWithCString ( <nl> void SetUp ( ) { <nl> for ( CFIndex i = 0 ; i < count ; i + + ) { <nl> parseNetworks ( ( CFDictionaryRef ) values [ i ] , results ) ; <nl> } <nl> - ASSERT_GT ( results . size ( ) , 0 ) ; <nl> + ASSERT_EQ ( results . size ( ) , 2U ) ; <nl> <nl> Row expected1 = { <nl> - { " ssid " , " 2890d228 3487 " } , <nl> - { " network_name " , " High - Fi " } , <nl> - { " security_type " , " WPA2 Personal " } , <nl> - { " last_connected " , " 1419843361 " } , <nl> - { " passpoint " , " 0 " } , <nl> - { " possibly_hidden " , " 0 " } , <nl> - { " roaming " , " 0 " } , <nl> - { " roaming_profile " , " Single " } , <nl> - { " captive_portal " , " 0 " } , <nl> - { " auto_login " , " 0 " } , <nl> - { " temporarily_disabled " , " 0 " } , <nl> - { " disabled " , " 0 " } , <nl> - } ; <nl> - Row expected2 = { <nl> { " ssid " , " 85e965a1 63ab " } , <nl> { " network_name " , " WhyFi " } , <nl> { " security_type " , " Open " } , <nl> void SetUp ( ) { <nl> { " roaming " , " 0 " } , <nl> { " roaming_profile " , " None " } , <nl> { " captive_portal " , " 1 " } , <nl> - { " auto_login " , " 0 " } , <nl> { " temporarily_disabled " , " 0 " } , <nl> { " disabled " , " 0 " } , <nl> } ; <nl> - <nl> - for ( const auto & column : expected1 ) { <nl> - EXPECT_EQ ( results . front ( ) [ column . first ] , column . second ) ; <nl> - } <nl> - for ( const auto & column : expected2 ) { <nl> - EXPECT_EQ ( results . back ( ) [ column . first ] , column . second ) ; <nl> - } <nl> - } <nl> - <nl> - TEST_F ( WifiNetworksTest , test_parse_legacy_wifi_networks ) { <nl> - std : : string path = <nl> - ( getTestConfigDirectory ( ) / " test_airport_legacy . plist " ) . string ( ) ; <nl> - <nl> - auto plist = ( __bridge CFDictionaryRef ) <nl> - [ NSDictionary dictionaryWithContentsOfFile : @ ( path . c_str ( ) ) ] ; <nl> - ASSERT_GE ( ( long ) CFDictionaryGetCount ( plist ) , 1 ) ; <nl> - std : : string key = " RememberedNetworks " ; <nl> - auto cfkey = CFStringCreateWithCString ( <nl> - kCFAllocatorDefault , key . c_str ( ) , kCFStringEncodingUTF8 ) ; <nl> - auto networks = ( CFArrayRef ) CFDictionaryGetValue ( plist , cfkey ) ; <nl> - <nl> - CFRelease ( cfkey ) ; <nl> - <nl> - QueryData results ; <nl> - auto count = CFArrayGetCount ( networks ) ; <nl> - ASSERT_EQ ( ( long ) count , 2 ) ; <nl> - <nl> - for ( CFIndex i = 0 ; i < count ; i + + ) { <nl> - parseNetworks ( <nl> - ( CFDictionaryRef ) CFArrayGetValueAtIndex ( ( CFArrayRef ) networks , i ) , <nl> - results ) ; <nl> - } <nl> - ASSERT_GT ( results . size ( ) , 0 ) ; <nl> - <nl> - Row expected1 = { <nl> + Row expected2 = { <nl> { " ssid " , " 2890d228 3487 " } , <nl> { " network_name " , " High - Fi " } , <nl> { " security_type " , " WPA2 Personal " } , <nl> void SetUp ( ) { <nl> { " roaming " , " 0 " } , <nl> { " roaming_profile " , " Single " } , <nl> { " captive_portal " , " 0 " } , <nl> - { " auto_login " , " 0 " } , <nl> - { " temporarily_disabled " , " 0 " } , <nl> - { " disabled " , " 0 " } , <nl> - } ; <nl> - Row expected2 = { <nl> - { " ssid " , " 85e965a1 63ab " } , <nl> - { " network_name " , " WhyFi " } , <nl> - { " security_type " , " Open " } , <nl> - { " last_connected " , " 1437434883 " } , <nl> - { " passpoint " , " 0 " } , <nl> - { " possibly_hidden " , " 0 " } , <nl> - { " roaming " , " 0 " } , <nl> - { " roaming_profile " , " None " } , <nl> - { " captive_portal " , " 1 " } , <nl> - { " auto_login " , " 0 " } , <nl> { " temporarily_disabled " , " 0 " } , <nl> { " disabled " , " 0 " } , <nl> } ; <nl> <nl> - for ( const auto & column : expected2 ) { <nl> - EXPECT_EQ ( results . front ( ) [ column . first ] , column . second ) ; <nl> + / / Pre - macOS 10 . 15 , there was also an auto_login field to read <nl> + if ( qd . front ( ) . at ( " major " ) < " 11 " & & qd . front ( ) . at ( " minor " ) < " 15 " ) { <nl> + expected1 . insert ( std : : pair < std : : string , RowData > ( " auto_login " , " 0 " ) ) ; <nl> + expected2 . insert ( std : : pair < std : : string , RowData > ( " auto_login " , " 0 " ) ) ; <nl> } <nl> - for ( const auto & column : expected1 ) { <nl> - EXPECT_EQ ( results . back ( ) [ column . first ] , column . second ) ; <nl> + <nl> + / / The order of keys returned from parsing a plist file using <nl> + / / CFDictionaryGetKeysAndValues ( ) is deterministic , but not consistent across <nl> + / / versions of macOS . I . e . , the data in keys [ 0 ] and keys [ 1 ] are returned in <nl> + / / a different order on macOS 10 . 15 than on 10 . 14 and earlier . To test that <nl> + / / results [ ] rows ' contents are equal to that of the expected rows in this <nl> + / / test source , we first must peek at the value of the first column to match <nl> + / / the order in which the keys were read from the plist file by the API . <nl> + for ( auto & & testRow : results ) { <nl> + if ( testRow [ " ssid " ] = = " 85e965a1 63ab " ) { <nl> + for ( const auto & column : expected1 ) { <nl> + EXPECT_EQ ( testRow [ column . first ] , column . second ) ; <nl> + } <nl> + } else if ( testRow [ " ssid " ] = = " 2890d228 3487 " ) { <nl> + for ( const auto & column : expected2 ) { <nl> + EXPECT_EQ ( testRow [ column . first ] , column . second ) ; <nl> + } <nl> + } else { <nl> + FAIL ( ) < < " Unexpected data was read from airport . plist . " ; <nl> + } <nl> } <nl> } <nl> } <nl> mmm a / tools / tests / configs / test_airport . plist <nl> ppp b / tools / tests / configs / test_airport . plist <nl> <nl> < dict > <nl> < key > wifi . ssid . & lt ; 47f70e38 5cd1d54b 69 & gt ; < / key > <nl> < dict > <nl> - < key > AutoLogin < / key > <nl> - < false / > <nl> + < key > AddedBy < / key > <nl> + < integer > 2 < / integer > <nl> + < key > BSSIDList < / key > <nl> + < array > <nl> + < dict > <nl> + < key > LEAKY_AP_BSSID < / key > <nl> + < string > 14 : ed : bb : 34 : cd : 32 < / string > <nl> + < key > LEAKY_AP_LEARNED_DATA < / key > <nl> + < data > <nl> + < / data > <nl> + < / dict > <nl> + < / array > <nl> < key > Captive < / key > <nl> < true / > <nl> + < key > CaptiveBypass < / key > <nl> + < false / > <nl> < key > ChannelHistory < / key > <nl> < array > <nl> < dict > <nl> <nl> < date > 2015 - 07 - 20T23 : 28 : 03Z < / date > <nl> < / dict > <nl> < / array > <nl> - < key > Closed < / key > <nl> - < false / > <nl> < key > CollocatedGroup < / key > <nl> - < array > <nl> - < string > foo < / string > <nl> - < string > bar < / string > <nl> - < / array > <nl> + < array / > <nl> < key > Disabled < / key > <nl> < false / > <nl> - < key > LastConnected < / key > <nl> + < key > HiddenNetwork < / key > <nl> + < false / > <nl> + < key > LastAutoJoinAt < / key > <nl> < date > 2015 - 07 - 20T23 : 28 : 03Z < / date > <nl> + < key > NetworkWasCaptive < / key > <nl> + < false / > <nl> < key > Passpoint < / key > <nl> < false / > <nl> + < key > PersonalHotspot < / key > <nl> + < false / > <nl> < key > PossiblyHiddenNetwork < / key > <nl> < false / > <nl> < key > RoamingProfileType < / key > <nl> <nl> < string > WhyFi < / string > <nl> < key > SecurityType < / key > <nl> < string > Open < / string > <nl> + < key > ShareMode < / key > <nl> + < integer > 3 < / integer > <nl> < key > SystemMode < / key > <nl> < true / > <nl> < key > TemporarilyDisabled < / key > <nl> < false / > <nl> + < key > UserRole < / key > <nl> + < integer > 1 < / integer > <nl> < / dict > <nl> < key > wifi . ssid . & lt ; 06fa78ca 7a47b05e b61d74cc 2e9e6622 & gt ; < / key > <nl> < dict > <nl> - < key > AutoLogin < / key > <nl> - < false / > <nl> + < key > AddedBy < / key > <nl> + < integer > 2 < / integer > <nl> + < key > BSSIDList < / key > <nl> + < array > <nl> + < dict > <nl> + < key > LEAKY_AP_BSSID < / key > <nl> + < string > 14 : ed : bb : 34 : cd : 32 < / string > <nl> + < key > LEAKY_AP_LEARNED_DATA < / key > <nl> + < data > <nl> + < / data > <nl> + < / dict > <nl> + < / array > <nl> < key > Captive < / key > <nl> < false / > <nl> + < key > CaptiveBypass < / key > <nl> + < false / > <nl> < key > ChannelHistory < / key > <nl> < array > <nl> < dict > <nl> <nl> < date > 2014 - 12 - 29T08 : 56 : 02Z < / date > <nl> < / dict > <nl> < / array > <nl> - < key > Closed < / key > <nl> - < false / > <nl> < key > CollocatedGroup < / key > <nl> < array / > <nl> < key > Disabled < / key > <nl> < false / > <nl> - < key > LastConnected < / key > <nl> + < key > HiddenNetwork < / key > <nl> + < false / > <nl> + < key > LastAutoJoinAt < / key > <nl> < date > 2014 - 12 - 29T08 : 56 : 01Z < / date > <nl> + < key > NetworkWasCaptive < / key > <nl> + < false / > <nl> < key > Passpoint < / key > <nl> < false / > <nl> + < key > PersonalHotspot < / key > <nl> + < false / > <nl> < key > PossiblyHiddenNetwork < / key > <nl> < false / > <nl> < key > RoamingProfileType < / key > <nl> <nl> < string > High - Fi < / string > <nl> < key > SecurityType < / key > <nl> < string > WPA2 Personal < / string > <nl> + < key > ShareMode < / key > <nl> + < integer > 3 < / integer > <nl> < key > SystemMode < / key > <nl> < true / > <nl> < key > TemporarilyDisabled < / key > <nl> < false / > <nl> + < key > UserRole < / key > <nl> + < integer > 1 < / integer > <nl> < / dict > <nl> < / dict > <nl> < key > Version < / key > <nl> - < integer > 2200 < / integer > <nl> + < integer > 2600 < / integer > <nl> < / dict > <nl> < / plist > <nl> similarity index 89 % <nl> rename from tools / tests / configs / test_airport_legacy . plist <nl> rename to tools / tests / configs / test_airport_pre_macOS_10 . 15 . plist <nl> mmm a / tools / tests / configs / test_airport_legacy . plist <nl> ppp b / tools / tests / configs / test_airport_pre_macOS_10 . 15 . plist <nl> <nl> < ! DOCTYPE plist PUBLIC " - / / Apple / / DTD PLIST 1 . 0 / / EN " " http : / / www . apple . com / DTDs / PropertyList - 1 . 0 . dtd " > <nl> < plist version = " 1 . 0 " > <nl> < dict > <nl> - < key > RememberedNetworks < / key > <nl> - < array > <nl> + < key > Counter < / key > <nl> + < integer > 2 < / integer > <nl> + < key > KnownNetworks < / key > <nl> + < dict > <nl> + < key > wifi . ssid . & lt ; 47f70e38 5cd1d54b 69 & gt ; < / key > <nl> < dict > <nl> < key > AutoLogin < / key > <nl> < false / > <nl> <nl> < key > TemporarilyDisabled < / key > <nl> < false / > <nl> < / dict > <nl> + < key > wifi . ssid . & lt ; 06fa78ca 7a47b05e b61d74cc 2e9e6622 & gt ; < / key > <nl> < dict > <nl> < key > AutoLogin < / key > <nl> < false / > <nl> <nl> < key > TemporarilyDisabled < / key > <nl> < false / > <nl> < / dict > <nl> - < / array > <nl> + < / dict > <nl> < key > Version < / key > <nl> - < integer > 14 < / integer > <nl> + < integer > 2200 < / integer > <nl> < / dict > <nl> < / plist > <nl>
|
Fix wifi_tests on macOS 10 . 15 and above ( )
|
osquery/osquery
|
c42be2b841a91ed5a6fab0f5f92169fb9f50bac6
|
2020-12-18T03:17:36Z
|
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> add_library ( end2end_nosec_tests <nl> test / core / end2end / tests / retry_throttled . cc <nl> test / core / end2end / tests / retry_too_many_attempts . cc <nl> test / core / end2end / tests / server_finishes_request . cc <nl> + test / core / end2end / tests / server_streaming . cc <nl> test / core / end2end / tests / shutdown_finishes_calls . cc <nl> test / core / end2end / tests / shutdown_finishes_tags . cc <nl> test / core / end2end / tests / simple_cacheable_request . cc <nl> add_library ( end2end_tests <nl> test / core / end2end / tests / retry_throttled . cc <nl> test / core / end2end / tests / retry_too_many_attempts . cc <nl> test / core / end2end / tests / server_finishes_request . cc <nl> + test / core / end2end / tests / server_streaming . cc <nl> test / core / end2end / tests / shutdown_finishes_calls . cc <nl> test / core / end2end / tests / shutdown_finishes_tags . cc <nl> test / core / end2end / tests / simple_cacheable_request . cc <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> LIBEND2END_NOSEC_TESTS_SRC = \ <nl> test / core / end2end / tests / retry_throttled . cc \ <nl> test / core / end2end / tests / retry_too_many_attempts . cc \ <nl> test / core / end2end / tests / server_finishes_request . cc \ <nl> + test / core / end2end / tests / server_streaming . cc \ <nl> test / core / end2end / tests / shutdown_finishes_calls . cc \ <nl> test / core / end2end / tests / shutdown_finishes_tags . cc \ <nl> test / core / end2end / tests / simple_cacheable_request . cc \ <nl> LIBEND2END_TESTS_SRC = \ <nl> test / core / end2end / tests / retry_throttled . cc \ <nl> test / core / end2end / tests / retry_too_many_attempts . cc \ <nl> test / core / end2end / tests / server_finishes_request . cc \ <nl> + test / core / end2end / tests / server_streaming . cc \ <nl> test / core / end2end / tests / shutdown_finishes_calls . cc \ <nl> test / core / end2end / tests / shutdown_finishes_tags . cc \ <nl> test / core / end2end / tests / simple_cacheable_request . cc \ <nl> mmm a / build_autogenerated . yaml <nl> ppp b / build_autogenerated . yaml <nl> libs : <nl> - test / core / end2end / tests / retry_throttled . cc <nl> - test / core / end2end / tests / retry_too_many_attempts . cc <nl> - test / core / end2end / tests / server_finishes_request . cc <nl> + - test / core / end2end / tests / server_streaming . cc <nl> - test / core / end2end / tests / shutdown_finishes_calls . cc <nl> - test / core / end2end / tests / shutdown_finishes_tags . cc <nl> - test / core / end2end / tests / simple_cacheable_request . cc <nl> libs : <nl> - test / core / end2end / tests / retry_throttled . cc <nl> - test / core / end2end / tests / retry_too_many_attempts . cc <nl> - test / core / end2end / tests / server_finishes_request . cc <nl> + - test / core / end2end / tests / server_streaming . cc <nl> - test / core / end2end / tests / shutdown_finishes_calls . cc <nl> - test / core / end2end / tests / shutdown_finishes_tags . cc <nl> - test / core / end2end / tests / simple_cacheable_request . cc <nl> mmm a / doc / status_ordering . md <nl> ppp b / doc / status_ordering . md <nl> Ordering Status and Reads in the gRPC API <nl> <nl> Rules for implementors : <nl> 1 . Reads and Writes Must not succeed after Status has been delivered . <nl> - 2 . OK Status is only delivered after all buffered messages are read . <nl> + 2 . Status is only delivered after all buffered messages are read . <nl> 3 . Reads May continue to succeed after a failing write . <nl> However , once a write fails , all subsequent writes Must fail , <nl> and similarly , once a read fails , all subsequent reads Must fail . <nl> - 4 . When an error status is known to the library , if the user asks for status , <nl> + 4 . A non - OK status received from the server is not considered an error status . <nl> + 5 . When an error status is known to the library , if the user asks for status , <nl> the library Should discard messages received in the library but not delivered <nl> to the user and then deliver the status . If the user does not ask for status <nl> but continues reading , the library Should deliver buffered messages before <nl> mmm a / gRPC - Core . podspec <nl> ppp b / gRPC - Core . podspec <nl> Pod : : Spec . new do | s | <nl> ' test / core / end2end / tests / retry_throttled . cc ' , <nl> ' test / core / end2end / tests / retry_too_many_attempts . cc ' , <nl> ' test / core / end2end / tests / server_finishes_request . cc ' , <nl> + ' test / core / end2end / tests / server_streaming . cc ' , <nl> ' test / core / end2end / tests / shutdown_finishes_calls . cc ' , <nl> ' test / core / end2end / tests / shutdown_finishes_tags . cc ' , <nl> ' test / core / end2end / tests / simple_cacheable_request . cc ' , <nl> mmm a / grpc . gyp <nl> ppp b / grpc . gyp <nl> <nl> ' test / core / end2end / tests / retry_throttled . cc ' , <nl> ' test / core / end2end / tests / retry_too_many_attempts . cc ' , <nl> ' test / core / end2end / tests / server_finishes_request . cc ' , <nl> + ' test / core / end2end / tests / server_streaming . cc ' , <nl> ' test / core / end2end / tests / shutdown_finishes_calls . cc ' , <nl> ' test / core / end2end / tests / shutdown_finishes_tags . cc ' , <nl> ' test / core / end2end / tests / simple_cacheable_request . cc ' , <nl> <nl> ' test / core / end2end / tests / retry_throttled . cc ' , <nl> ' test / core / end2end / tests / retry_too_many_attempts . cc ' , <nl> ' test / core / end2end / tests / server_finishes_request . cc ' , <nl> + ' test / core / end2end / tests / server_streaming . cc ' , <nl> ' test / core / end2end / tests / shutdown_finishes_calls . cc ' , <nl> ' test / core / end2end / tests / shutdown_finishes_tags . cc ' , <nl> ' test / core / end2end / tests / simple_cacheable_request . cc ' , <nl> mmm a / src / core / ext / transport / chttp2 / transport / parsing . cc <nl> ppp b / src / core / ext / transport / chttp2 / transport / parsing . cc <nl> static bool md_key_cmp ( grpc_mdelem md , const grpc_slice & reference ) { <nl> return GRPC_MDKEY ( md ) . refcount = = reference . refcount ; <nl> } <nl> <nl> - static bool md_cmp ( grpc_mdelem md , grpc_mdelem ref_md , <nl> - const grpc_slice & ref_key ) { <nl> - if ( GPR_LIKELY ( GRPC_MDELEM_IS_INTERNED ( md ) ) ) { <nl> - return md . payload = = ref_md . payload ; <nl> - } <nl> - if ( md_key_cmp ( md , ref_key ) ) { <nl> - return grpc_slice_eq_static_interned ( GRPC_MDVALUE ( md ) , <nl> - GRPC_MDVALUE ( ref_md ) ) ; <nl> - } <nl> - return false ; <nl> - } <nl> - <nl> - static bool is_nonzero_status ( grpc_mdelem md ) { <nl> - / / If md . payload = = GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2 , <nl> - / / then we have seen an error . In fact , if it is a GRPC_STATUS and it ' s <nl> - / / not equal to GRPC_MDELEM_GRPC_STATUS_0 , then we have seen an error . <nl> - / / TODO ( ctiller ) : check for a status like " 0 " <nl> - return md_key_cmp ( md , GRPC_MDSTR_GRPC_STATUS ) & & <nl> - ! md_cmp ( md , GRPC_MDELEM_GRPC_STATUS_0 , GRPC_MDSTR_GRPC_STATUS ) ; <nl> - } <nl> - <nl> static void GPR_ATTRIBUTE_NOINLINE on_initial_header_log ( <nl> grpc_chttp2_transport * t , grpc_chttp2_stream * s , grpc_mdelem md ) { <nl> char * key = grpc_slice_to_c_string ( GRPC_MDKEY ( md ) ) ; <nl> static grpc_error * on_initial_header ( void * tp , grpc_mdelem md ) { <nl> on_initial_header_log ( t , s , md ) ; <nl> } <nl> <nl> - if ( is_nonzero_status ( md ) ) { / / not GRPC_MDELEM_GRPC_STATUS_0 ? <nl> - s - > seen_error = true ; <nl> - } else if ( md_key_cmp ( md , GRPC_MDSTR_GRPC_TIMEOUT ) ) { <nl> + if ( md_key_cmp ( md , GRPC_MDSTR_GRPC_TIMEOUT ) ) { <nl> return handle_timeout ( s , md ) ; <nl> } <nl> <nl> static grpc_error * on_trailing_header ( void * tp , grpc_mdelem md ) { <nl> gpr_free ( value ) ; <nl> } <nl> <nl> - if ( is_nonzero_status ( md ) ) { / / not GRPC_MDELEM_GRPC_STATUS_0 ? <nl> - s - > seen_error = true ; <nl> - } <nl> - <nl> const size_t new_size = s - > metadata_buffer [ 1 ] . size + GRPC_MDELEM_LENGTH ( md ) ; <nl> const size_t metadata_size_limit = <nl> t - > settings [ GRPC_ACKED_SETTINGS ] <nl> mmm a / test / core / end2end / cq_verifier . cc <nl> ppp b / test / core / end2end / cq_verifier . cc <nl> <nl> - / * <nl> - * <nl> - * Copyright 2015 gRPC authors . <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> + / / <nl> + / / <nl> + / / Copyright 2015 gRPC authors . <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> <nl> # include " test / core / end2end / cq_verifier . h " <nl> <nl> <nl> # include < stdio . h > <nl> # include < string . h > <nl> <nl> + # include < list > <nl> # include < string > <nl> # include < vector > <nl> <nl> <nl> <nl> # define ROOT_EXPECTATION 1000 <nl> <nl> - / * a set of metadata we expect to find on an event * / <nl> + / / a set of metadata we expect to find on an event <nl> typedef struct metadata { <nl> size_t count ; <nl> size_t cap ; <nl> typedef struct metadata { <nl> char * * values ; <nl> } metadata ; <nl> <nl> - / * details what we expect to find on a single event - and forms a linked <nl> - list to detail other expectations * / <nl> - typedef struct expectation { <nl> - struct expectation * next ; <nl> + / / details what we expect to find on a single event <nl> + struct Expectation { <nl> + Expectation ( const char * f , int l , grpc_completion_type t , void * tag_arg , <nl> + bool check_success_arg , int success_arg , bool * seen_arg ) <nl> + : file ( f ) , <nl> + line ( l ) , <nl> + type ( t ) , <nl> + tag ( tag_arg ) , <nl> + check_success ( check_success_arg ) , <nl> + success ( success_arg ) , <nl> + seen ( seen_arg ) { } <nl> const char * file ; <nl> int line ; <nl> grpc_completion_type type ; <nl> void * tag ; <nl> bool check_success ; <nl> int success ; <nl> - } expectation ; <nl> + bool * seen ; <nl> + } ; <nl> <nl> - / * the verifier itself * / <nl> + / / the verifier itself <nl> struct cq_verifier { <nl> - / * bound completion queue * / <nl> + / / bound completion queue <nl> grpc_completion_queue * cq ; <nl> - / * start of expectation list * / <nl> - expectation * first_expectation ; <nl> + / / expectation list <nl> + std : : list < Expectation > expectations ; <nl> + / / maybe expectation list <nl> + std : : list < Expectation > maybe_expectations ; <nl> } ; <nl> <nl> + / / TODO ( yashykt ) : Convert this to constructor / destructor pair <nl> cq_verifier * cq_verifier_create ( grpc_completion_queue * cq ) { <nl> - cq_verifier * v = static_cast < cq_verifier * > ( gpr_malloc ( sizeof ( cq_verifier ) ) ) ; <nl> + cq_verifier * v = new cq_verifier ; <nl> v - > cq = cq ; <nl> - v - > first_expectation = nullptr ; <nl> return v ; <nl> } <nl> <nl> void cq_verifier_destroy ( cq_verifier * v ) { <nl> cq_verify ( v ) ; <nl> - gpr_free ( v ) ; <nl> + delete v ; <nl> } <nl> <nl> static int has_metadata ( const grpc_metadata * md , size_t count , const char * key , <nl> static bool is_probably_integer ( void * p ) { return ( ( uintptr_t ) p ) < 1000000 ; } <nl> <nl> namespace { <nl> <nl> - std : : string ExpectationString ( const expectation & e ) { <nl> + std : : string ExpectationString ( const Expectation & e ) { <nl> std : : string out ; <nl> if ( is_probably_integer ( e . tag ) ) { <nl> out = absl : : StrFormat ( " tag ( % " PRIdPTR " ) " , ( intptr_t ) e . tag ) ; <nl> std : : string ExpectationString ( const expectation & e ) { <nl> <nl> std : : string ExpectationsString ( const cq_verifier & v ) { <nl> std : : vector < std : : string > expectations ; <nl> - for ( expectation * e = v . first_expectation ; e ! = nullptr ; e = e - > next ) { <nl> - expectations . push_back ( ExpectationString ( * e ) ) ; <nl> + for ( const auto & e : v . expectations ) { <nl> + expectations . push_back ( ExpectationString ( e ) ) ; <nl> } <nl> return absl : : StrJoin ( expectations , " \ n " ) ; <nl> } <nl> static void fail_no_event_received ( cq_verifier * v ) { <nl> abort ( ) ; <nl> } <nl> <nl> - static void verify_matches ( expectation * e , grpc_event * ev ) { <nl> - GPR_ASSERT ( e - > type = = ev - > type ) ; <nl> - switch ( e - > type ) { <nl> + static void verify_matches ( const Expectation & e , const grpc_event & ev ) { <nl> + GPR_ASSERT ( e . type = = ev . type ) ; <nl> + switch ( e . type ) { <nl> case GRPC_OP_COMPLETE : <nl> - if ( e - > check_success & & e - > success ! = ev - > success ) { <nl> + if ( e . check_success & & e . success ! = ev . success ) { <nl> gpr_log ( GPR_ERROR , " actual success does not match expected : % s " , <nl> - ExpectationString ( * e ) . c_str ( ) ) ; <nl> + ExpectationString ( e ) . c_str ( ) ) ; <nl> abort ( ) ; <nl> } <nl> break ; <nl> static void verify_matches ( expectation * e , grpc_event * ev ) { <nl> } <nl> } <nl> <nl> + / / Try to find the event in the expectations list <nl> + bool FindExpectations ( std : : list < Expectation > * expectations , <nl> + const grpc_event & ev ) { <nl> + for ( auto e = expectations - > begin ( ) ; e ! = expectations - > end ( ) ; + + e ) { <nl> + if ( e - > tag = = ev . tag ) { <nl> + verify_matches ( * e , ev ) ; <nl> + if ( e - > seen ! = nullptr ) { <nl> + * ( e - > seen ) = true ; <nl> + } <nl> + expectations - > erase ( e ) ; <nl> + return true ; <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> void cq_verify ( cq_verifier * v , int timeout_sec ) { <nl> const gpr_timespec deadline = grpc_timeout_seconds_to_deadline ( timeout_sec ) ; <nl> - while ( v - > first_expectation ! = nullptr ) { <nl> + while ( ! v - > expectations . empty ( ) ) { <nl> grpc_event ev = grpc_completion_queue_next ( v - > cq , deadline , nullptr ) ; <nl> if ( ev . type = = GRPC_QUEUE_TIMEOUT ) { <nl> fail_no_event_received ( v ) ; <nl> break ; <nl> } <nl> - expectation * e ; <nl> - expectation * prev = nullptr ; <nl> - for ( e = v - > first_expectation ; e ! = nullptr ; e = e - > next ) { <nl> - if ( e - > tag = = ev . tag ) { <nl> - verify_matches ( e , & ev ) ; <nl> - if ( e = = v - > first_expectation ) v - > first_expectation = e - > next ; <nl> - if ( prev ! = nullptr ) prev - > next = e - > next ; <nl> - gpr_free ( e ) ; <nl> - break ; <nl> - } <nl> - prev = e ; <nl> - } <nl> - if ( e = = nullptr ) { <nl> - gpr_log ( GPR_ERROR , " cq returned unexpected event : % s " , <nl> - grpc_event_string ( & ev ) . c_str ( ) ) ; <nl> - gpr_log ( GPR_ERROR , " expected tags : \ n % s " , ExpectationsString ( * v ) . c_str ( ) ) ; <nl> - abort ( ) ; <nl> - } <nl> + if ( FindExpectations ( & v - > expectations , ev ) ) continue ; <nl> + if ( FindExpectations ( & v - > maybe_expectations , ev ) ) continue ; <nl> + gpr_log ( GPR_ERROR , " cq returned unexpected event : % s " , <nl> + grpc_event_string ( & ev ) . c_str ( ) ) ; <nl> + gpr_log ( GPR_ERROR , " expected tags : \ n % s " , ExpectationsString ( * v ) . c_str ( ) ) ; <nl> + abort ( ) ; <nl> } <nl> + v - > maybe_expectations . clear ( ) ; <nl> } <nl> <nl> void cq_verify_empty_timeout ( cq_verifier * v , int timeout_sec ) { <nl> void cq_verify_empty_timeout ( cq_verifier * v , int timeout_sec ) { <nl> gpr_time_from_seconds ( timeout_sec , GPR_TIMESPAN ) ) ; <nl> grpc_event ev ; <nl> <nl> - GPR_ASSERT ( v - > first_expectation = = nullptr & & <nl> - " expectation queue must be empty " ) ; <nl> + GPR_ASSERT ( v - > expectations . empty ( ) & & " expectation queue must be empty " ) ; <nl> <nl> ev = grpc_completion_queue_next ( v - > cq , deadline , nullptr ) ; <nl> if ( ev . type ! = GRPC_QUEUE_TIMEOUT ) { <nl> void cq_verify_empty_timeout ( cq_verifier * v , int timeout_sec ) { <nl> <nl> void cq_verify_empty ( cq_verifier * v ) { cq_verify_empty_timeout ( v , 1 ) ; } <nl> <nl> + void cq_maybe_expect_completion ( cq_verifier * v , const char * file , int line , <nl> + void * tag , bool success , bool * seen ) { <nl> + v - > maybe_expectations . emplace_back ( file , line , GRPC_OP_COMPLETE , tag , true , <nl> + true , seen ) ; <nl> + } <nl> + <nl> static void add ( cq_verifier * v , const char * file , int line , <nl> grpc_completion_type type , void * tag , bool check_success , <nl> bool success ) { <nl> - expectation * e = static_cast < expectation * > ( gpr_malloc ( sizeof ( expectation ) ) ) ; <nl> - e - > type = type ; <nl> - e - > file = file ; <nl> - e - > line = line ; <nl> - e - > tag = tag ; <nl> - e - > check_success = check_success ; <nl> - e - > success = success ; <nl> - e - > next = v - > first_expectation ; <nl> - v - > first_expectation = e ; <nl> + v - > expectations . emplace_back ( file , line , type , tag , check_success , success , <nl> + nullptr ) ; <nl> } <nl> <nl> void cq_expect_completion ( cq_verifier * v , const char * file , int line , void * tag , <nl> mmm a / test / core / end2end / cq_verifier . h <nl> ppp b / test / core / end2end / cq_verifier . h <nl> void cq_verify_empty_timeout ( cq_verifier * v , int timeout_sec ) ; <nl> the event . * / <nl> void cq_expect_completion ( cq_verifier * v , const char * file , int line , void * tag , <nl> bool success ) ; <nl> + / * If the \ a tag is seen , \ a seen is set to true . * / <nl> + void cq_maybe_expect_completion ( cq_verifier * v , const char * file , int line , <nl> + void * tag , bool success , bool * seen ) ; <nl> void cq_expect_completion_any_status ( cq_verifier * v , const char * file , int line , <nl> void * tag ) ; <nl> # define CQ_EXPECT_COMPLETION ( v , tag , success ) \ <nl> cq_expect_completion ( v , __FILE__ , __LINE__ , tag , success ) <nl> + # define CQ_MAYBE_EXPECT_COMPLETION ( v , tag , success , seen ) \ <nl> + cq_maybe_expect_completion ( v , __FILE__ , __LINE__ , tag , success , seen ) <nl> # define CQ_EXPECT_COMPLETION_ANY_STATUS ( v , tag ) \ <nl> cq_expect_completion_any_status ( v , __FILE__ , __LINE__ , tag ) <nl> <nl> mmm a / test / core / end2end / end2end_nosec_tests . cc <nl> ppp b / test / core / end2end / end2end_nosec_tests . cc <nl> extern void retry_too_many_attempts ( grpc_end2end_test_config config ) ; <nl> extern void retry_too_many_attempts_pre_init ( void ) ; <nl> extern void server_finishes_request ( grpc_end2end_test_config config ) ; <nl> extern void server_finishes_request_pre_init ( void ) ; <nl> + extern void server_streaming ( grpc_end2end_test_config config ) ; <nl> + extern void server_streaming_pre_init ( void ) ; <nl> extern void shutdown_finishes_calls ( grpc_end2end_test_config config ) ; <nl> extern void shutdown_finishes_calls_pre_init ( void ) ; <nl> extern void shutdown_finishes_tags ( grpc_end2end_test_config config ) ; <nl> void grpc_end2end_tests_pre_init ( void ) { <nl> retry_throttled_pre_init ( ) ; <nl> retry_too_many_attempts_pre_init ( ) ; <nl> server_finishes_request_pre_init ( ) ; <nl> + server_streaming_pre_init ( ) ; <nl> shutdown_finishes_calls_pre_init ( ) ; <nl> shutdown_finishes_tags_pre_init ( ) ; <nl> simple_cacheable_request_pre_init ( ) ; <nl> void grpc_end2end_tests ( int argc , char * * argv , <nl> retry_throttled ( config ) ; <nl> retry_too_many_attempts ( config ) ; <nl> server_finishes_request ( config ) ; <nl> + server_streaming ( config ) ; <nl> shutdown_finishes_calls ( config ) ; <nl> shutdown_finishes_tags ( config ) ; <nl> simple_cacheable_request ( config ) ; <nl> void grpc_end2end_tests ( int argc , char * * argv , <nl> server_finishes_request ( config ) ; <nl> continue ; <nl> } <nl> + if ( 0 = = strcmp ( " server_streaming " , argv [ i ] ) ) { <nl> + server_streaming ( config ) ; <nl> + continue ; <nl> + } <nl> if ( 0 = = strcmp ( " shutdown_finishes_calls " , argv [ i ] ) ) { <nl> shutdown_finishes_calls ( config ) ; <nl> continue ; <nl> mmm a / test / core / end2end / end2end_tests . cc <nl> ppp b / test / core / end2end / end2end_tests . cc <nl> extern void retry_too_many_attempts ( grpc_end2end_test_config config ) ; <nl> extern void retry_too_many_attempts_pre_init ( void ) ; <nl> extern void server_finishes_request ( grpc_end2end_test_config config ) ; <nl> extern void server_finishes_request_pre_init ( void ) ; <nl> + extern void server_streaming ( grpc_end2end_test_config config ) ; <nl> + extern void server_streaming_pre_init ( void ) ; <nl> extern void shutdown_finishes_calls ( grpc_end2end_test_config config ) ; <nl> extern void shutdown_finishes_calls_pre_init ( void ) ; <nl> extern void shutdown_finishes_tags ( grpc_end2end_test_config config ) ; <nl> void grpc_end2end_tests_pre_init ( void ) { <nl> retry_throttled_pre_init ( ) ; <nl> retry_too_many_attempts_pre_init ( ) ; <nl> server_finishes_request_pre_init ( ) ; <nl> + server_streaming_pre_init ( ) ; <nl> shutdown_finishes_calls_pre_init ( ) ; <nl> shutdown_finishes_tags_pre_init ( ) ; <nl> simple_cacheable_request_pre_init ( ) ; <nl> void grpc_end2end_tests ( int argc , char * * argv , <nl> retry_throttled ( config ) ; <nl> retry_too_many_attempts ( config ) ; <nl> server_finishes_request ( config ) ; <nl> + server_streaming ( config ) ; <nl> shutdown_finishes_calls ( config ) ; <nl> shutdown_finishes_tags ( config ) ; <nl> simple_cacheable_request ( config ) ; <nl> void grpc_end2end_tests ( int argc , char * * argv , <nl> server_finishes_request ( config ) ; <nl> continue ; <nl> } <nl> + if ( 0 = = strcmp ( " server_streaming " , argv [ i ] ) ) { <nl> + server_streaming ( config ) ; <nl> + continue ; <nl> + } <nl> if ( 0 = = strcmp ( " shutdown_finishes_calls " , argv [ i ] ) ) { <nl> shutdown_finishes_calls ( config ) ; <nl> continue ; <nl> mmm a / test / core / end2end / generate_tests . bzl <nl> ppp b / test / core / end2end / generate_tests . bzl <nl> END2END_TESTS = { <nl> proxyable = False , <nl> ) , <nl> " server_finishes_request " : _test_options ( ) , <nl> + " server_streaming " : _test_options ( needs_http2 = True ) , <nl> " shutdown_finishes_calls " : _test_options ( ) , <nl> " shutdown_finishes_tags " : _test_options ( ) , <nl> " simple_cacheable_request " : _test_options ( ) , <nl> new file mode 100644 <nl> index 00000000000 . . ece86f80951 <nl> mmm / dev / null <nl> ppp b / test / core / end2end / tests / server_streaming . cc <nl> <nl> + / * <nl> + * <nl> + * Copyright 2020 gRPC authors . <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> + <nl> + # include " test / core / end2end / end2end_tests . h " <nl> + <nl> + # include < stdio . h > <nl> + # include < string . h > <nl> + <nl> + # include < grpc / byte_buffer . h > <nl> + # include < grpc / support / alloc . h > <nl> + # include < grpc / support / log . h > <nl> + # include < grpc / support / time . h > <nl> + # include " test / core / end2end / cq_verifier . h " <nl> + <nl> + static void * tag ( intptr_t t ) { return ( void * ) t ; } <nl> + <nl> + static grpc_end2end_test_fixture begin_test ( grpc_end2end_test_config config , <nl> + const char * test_name , <nl> + grpc_channel_args * client_args , <nl> + grpc_channel_args * server_args ) { <nl> + grpc_end2end_test_fixture f ; <nl> + gpr_log ( GPR_INFO , " Running test : % s / % s " , test_name , config . name ) ; <nl> + f = config . create_fixture ( client_args , server_args ) ; <nl> + config . init_server ( & f , server_args ) ; <nl> + config . init_client ( & f , client_args ) ; <nl> + return f ; <nl> + } <nl> + <nl> + static gpr_timespec n_seconds_from_now ( int n ) { <nl> + return grpc_timeout_seconds_to_deadline ( n ) ; <nl> + } <nl> + <nl> + static gpr_timespec five_seconds_from_now ( void ) { <nl> + return n_seconds_from_now ( 5 ) ; <nl> + } <nl> + <nl> + static void drain_cq ( grpc_completion_queue * cq ) { <nl> + grpc_event ev ; <nl> + do { <nl> + ev = grpc_completion_queue_next ( cq , five_seconds_from_now ( ) , nullptr ) ; <nl> + } while ( ev . type ! = GRPC_QUEUE_SHUTDOWN ) ; <nl> + } <nl> + <nl> + static void shutdown_server ( grpc_end2end_test_fixture * f ) { <nl> + if ( ! f - > server ) return ; <nl> + grpc_server_shutdown_and_notify ( f - > server , f - > shutdown_cq , tag ( 1000 ) ) ; <nl> + GPR_ASSERT ( grpc_completion_queue_pluck ( f - > shutdown_cq , tag ( 1000 ) , <nl> + grpc_timeout_seconds_to_deadline ( 5 ) , <nl> + nullptr ) <nl> + . type = = GRPC_OP_COMPLETE ) ; <nl> + grpc_server_destroy ( f - > server ) ; <nl> + f - > server = nullptr ; <nl> + } <nl> + <nl> + static void shutdown_client ( grpc_end2end_test_fixture * f ) { <nl> + if ( ! f - > client ) return ; <nl> + grpc_channel_destroy ( f - > client ) ; <nl> + f - > client = nullptr ; <nl> + } <nl> + <nl> + static void end_test ( grpc_end2end_test_fixture * f ) { <nl> + shutdown_server ( f ) ; <nl> + shutdown_client ( f ) ; <nl> + <nl> + grpc_completion_queue_shutdown ( f - > cq ) ; <nl> + drain_cq ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > cq ) ; <nl> + grpc_completion_queue_destroy ( f - > shutdown_cq ) ; <nl> + } <nl> + <nl> + / * Client requests status along with the initial metadata . Server streams <nl> + * messages and ends with a non - OK status . Client reads after server is done <nl> + * writing , and expects to get the status after the messages . * / <nl> + static void test_server_streaming ( grpc_end2end_test_config config , <nl> + int num_messages ) { <nl> + grpc_end2end_test_fixture f = <nl> + begin_test ( config , " test_server_streaming " , nullptr , nullptr ) ; <nl> + grpc_call * c ; <nl> + grpc_call * s ; <nl> + cq_verifier * cqv = cq_verifier_create ( f . cq ) ; <nl> + grpc_op ops [ 6 ] ; <nl> + grpc_op * op ; <nl> + grpc_metadata_array initial_metadata_recv ; <nl> + grpc_metadata_array trailing_metadata_recv ; <nl> + grpc_metadata_array request_metadata_recv ; <nl> + grpc_call_details call_details ; <nl> + grpc_status_code status ; <nl> + grpc_call_error error ; <nl> + grpc_slice details ; <nl> + int was_cancelled = 2 ; <nl> + grpc_byte_buffer * request_payload_recv ; <nl> + grpc_byte_buffer * response_payload ; <nl> + grpc_slice response_payload_slice = <nl> + grpc_slice_from_copied_string ( " hello world " ) ; <nl> + <nl> + gpr_timespec deadline = five_seconds_from_now ( ) ; <nl> + c = grpc_channel_create_call ( f . client , nullptr , GRPC_PROPAGATE_DEFAULTS , f . cq , <nl> + grpc_slice_from_static_string ( " / foo " ) , nullptr , <nl> + deadline , nullptr ) ; <nl> + GPR_ASSERT ( c ) ; <nl> + <nl> + grpc_metadata_array_init ( & initial_metadata_recv ) ; <nl> + grpc_metadata_array_init ( & trailing_metadata_recv ) ; <nl> + grpc_metadata_array_init ( & request_metadata_recv ) ; <nl> + grpc_call_details_init ( & call_details ) ; <nl> + <nl> + memset ( ops , 0 , sizeof ( ops ) ) ; <nl> + op = ops ; <nl> + op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> + op - > data . send_initial_metadata . count = 0 ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + op - > op = GRPC_OP_RECV_INITIAL_METADATA ; <nl> + op - > data . recv_initial_metadata . recv_initial_metadata = & initial_metadata_recv ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + / / Client requests status early but should not receive status till all the <nl> + / / messages are received . <nl> + op - > op = GRPC_OP_RECV_STATUS_ON_CLIENT ; <nl> + op - > data . recv_status_on_client . trailing_metadata = & trailing_metadata_recv ; <nl> + op - > data . recv_status_on_client . status = & status ; <nl> + op - > data . recv_status_on_client . status_details = & details ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + error = grpc_call_start_batch ( c , ops , static_cast < size_t > ( op - ops ) , tag ( 1 ) , <nl> + nullptr ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> + <nl> + / / Client sends close early <nl> + memset ( ops , 0 , sizeof ( ops ) ) ; <nl> + op = ops ; <nl> + op - > op = GRPC_OP_SEND_CLOSE_FROM_CLIENT ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + error = grpc_call_start_batch ( c , ops , static_cast < size_t > ( op - ops ) , tag ( 3 ) , <nl> + nullptr ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> + CQ_EXPECT_COMPLETION ( cqv , tag ( 3 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> + <nl> + error = <nl> + grpc_server_request_call ( f . server , & s , & call_details , <nl> + & request_metadata_recv , f . cq , f . cq , tag ( 100 ) ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> + CQ_EXPECT_COMPLETION ( cqv , tag ( 100 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> + <nl> + memset ( ops , 0 , sizeof ( ops ) ) ; <nl> + op = ops ; <nl> + op - > op = GRPC_OP_SEND_INITIAL_METADATA ; <nl> + op - > data . send_initial_metadata . count = 0 ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + error = grpc_call_start_batch ( s , ops , static_cast < size_t > ( op - ops ) , tag ( 101 ) , <nl> + nullptr ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> + <nl> + CQ_EXPECT_COMPLETION ( cqv , tag ( 101 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> + <nl> + / / Server writes bunch of messages <nl> + for ( int i = 0 ; i < num_messages ; i + + ) { <nl> + response_payload = grpc_raw_byte_buffer_create ( & response_payload_slice , 1 ) ; <nl> + <nl> + memset ( ops , 0 , sizeof ( ops ) ) ; <nl> + op = ops ; <nl> + op - > op = GRPC_OP_SEND_MESSAGE ; <nl> + op - > data . send_message . send_message = response_payload ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + error = grpc_call_start_batch ( s , ops , static_cast < size_t > ( op - ops ) , <nl> + tag ( 103 ) , nullptr ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> + CQ_EXPECT_COMPLETION ( cqv , tag ( 103 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> + <nl> + grpc_byte_buffer_destroy ( response_payload ) ; <nl> + } <nl> + <nl> + / / Server sends status <nl> + memset ( ops , 0 , sizeof ( ops ) ) ; <nl> + op = ops ; <nl> + op - > op = GRPC_OP_SEND_STATUS_FROM_SERVER ; <nl> + op - > data . send_status_from_server . trailing_metadata_count = 0 ; <nl> + op - > data . send_status_from_server . status = GRPC_STATUS_UNIMPLEMENTED ; <nl> + grpc_slice status_details = grpc_slice_from_static_string ( " xyz " ) ; <nl> + op - > data . send_status_from_server . status_details = & status_details ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> + op - > data . recv_close_on_server . cancelled = & was_cancelled ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + error = grpc_call_start_batch ( s , ops , static_cast < size_t > ( op - ops ) , tag ( 104 ) , <nl> + nullptr ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> + bool seen_status = false ; <nl> + CQ_MAYBE_EXPECT_COMPLETION ( cqv , tag ( 1 ) , true , & seen_status ) ; <nl> + CQ_EXPECT_COMPLETION ( cqv , tag ( 104 ) , 1 ) ; <nl> + cq_verify ( cqv ) ; <nl> + <nl> + / / Client keeps reading messages till it gets the status <nl> + int num_messages_received = 0 ; <nl> + while ( true ) { <nl> + memset ( ops , 0 , sizeof ( ops ) ) ; <nl> + op = ops ; <nl> + op - > op = GRPC_OP_RECV_MESSAGE ; <nl> + op - > data . recv_message . recv_message = & request_payload_recv ; <nl> + op - > flags = 0 ; <nl> + op - > reserved = nullptr ; <nl> + op + + ; <nl> + error = grpc_call_start_batch ( c , ops , static_cast < size_t > ( op - ops ) , <nl> + tag ( 102 ) , nullptr ) ; <nl> + GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> + CQ_MAYBE_EXPECT_COMPLETION ( cqv , tag ( 1 ) , true , & seen_status ) ; <nl> + CQ_EXPECT_COMPLETION ( cqv , tag ( 102 ) , true ) ; <nl> + cq_verify ( cqv ) ; <nl> + if ( request_payload_recv = = nullptr ) { <nl> + / / The transport has received the trailing metadata . <nl> + break ; <nl> + } <nl> + GPR_ASSERT ( byte_buffer_eq_string ( request_payload_recv , " hello world " ) ) ; <nl> + grpc_byte_buffer_destroy ( request_payload_recv ) ; <nl> + num_messages_received + + ; <nl> + } <nl> + GPR_ASSERT ( num_messages_received = = num_messages ) ; <nl> + if ( ! seen_status ) { <nl> + CQ_EXPECT_COMPLETION ( cqv , tag ( 1 ) , true ) ; <nl> + cq_verify ( cqv ) ; <nl> + } <nl> + GPR_ASSERT ( status = = GRPC_STATUS_UNIMPLEMENTED ) ; <nl> + GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( details , " xyz " ) ) ; <nl> + <nl> + grpc_slice_unref ( response_payload_slice ) ; <nl> + <nl> + grpc_call_unref ( c ) ; <nl> + grpc_call_unref ( s ) ; <nl> + <nl> + cq_verifier_destroy ( cqv ) ; <nl> + <nl> + grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl> + grpc_metadata_array_destroy ( & trailing_metadata_recv ) ; <nl> + grpc_metadata_array_destroy ( & request_metadata_recv ) ; <nl> + grpc_call_details_destroy ( & call_details ) ; <nl> + grpc_slice_unref ( details ) ; <nl> + <nl> + end_test ( & f ) ; <nl> + config . tear_down_data ( & f ) ; <nl> + } <nl> + <nl> + void server_streaming ( grpc_end2end_test_config config ) { <nl> + test_server_streaming ( config , 0 ) ; <nl> + test_server_streaming ( config , 1 ) ; <nl> + test_server_streaming ( config , 10 ) ; <nl> + } <nl> + <nl> + void server_streaming_pre_init ( void ) { } <nl> mmm a / test / core / end2end / tests / streaming_error_response . cc <nl> ppp b / test / core / end2end / tests / streaming_error_response . cc <nl> static void end_test ( grpc_end2end_test_fixture * f ) { <nl> grpc_completion_queue_destroy ( f - > shutdown_cq ) ; <nl> } <nl> <nl> - / / Client sends a request with payload , server reads then returns status . <nl> + / / Client sends a request with payload , potentially requesting status early . The <nl> + / / server reads and streams responses . The client cancels the RPC to get an <nl> + / / error status . ( Server sending a non - OK status is not considered an error <nl> + / / status . ) <nl> static void test ( grpc_end2end_test_config config , bool request_status_early , <nl> bool recv_message_separately ) { <nl> grpc_call * c ; <nl> static void test ( grpc_end2end_test_config config , bool request_status_early , <nl> cq_verify ( cqv ) ; <nl> } <nl> <nl> + / / Cancel the call so that the client sets up an error status . <nl> + grpc_call_cancel ( c , nullptr ) ; <nl> memset ( ops , 0 , sizeof ( ops ) ) ; <nl> op = ops ; <nl> op - > op = GRPC_OP_RECV_CLOSE_ON_SERVER ; <nl> op - > data . recv_close_on_server . cancelled = & was_cancelled ; <nl> op + + ; <nl> - op - > op = GRPC_OP_SEND_STATUS_FROM_SERVER ; <nl> - op - > data . send_status_from_server . trailing_metadata_count = 0 ; <nl> - op - > data . send_status_from_server . status = GRPC_STATUS_FAILED_PRECONDITION ; <nl> - grpc_slice status_details = grpc_slice_from_static_string ( " xyz " ) ; <nl> - op - > data . send_status_from_server . status_details = & status_details ; <nl> - op + + ; <nl> error = grpc_call_start_batch ( s , ops , static_cast < size_t > ( op - ops ) , tag ( 104 ) , <nl> nullptr ) ; <nl> GPR_ASSERT ( GRPC_CALL_OK = = error ) ; <nl> static void test ( grpc_end2end_test_config config , bool request_status_early , <nl> GPR_ASSERT ( response_payload2_recv ! = nullptr ) ; <nl> } <nl> <nl> - GPR_ASSERT ( status = = GRPC_STATUS_FAILED_PRECONDITION ) ; <nl> - GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( details , " xyz " ) ) ; <nl> - GPR_ASSERT ( 0 = = grpc_slice_str_cmp ( call_details . method , " / foo " ) ) ; <nl> - GPR_ASSERT ( was_cancelled = = 0 ) ; <nl> + GPR_ASSERT ( status = = GRPC_STATUS_CANCELLED ) ; <nl> + GPR_ASSERT ( was_cancelled = = 1 ) ; <nl> <nl> grpc_slice_unref ( details ) ; <nl> grpc_metadata_array_destroy ( & initial_metadata_recv ) ; <nl>
|
Merge pull request from yashykt / seenerror
|
grpc/grpc
|
a3d7152be63e9c6ceb2d12e00ce1f9eb1a847282
|
2020-08-15T07:20:45Z
|
mmm a / modules / objdetect / include / opencv2 / objdetect / objdetect . hpp <nl> ppp b / modules / objdetect / include / opencv2 / objdetect / objdetect . hpp <nl> class CV_EXPORTS PlanarObjectDetector <nl> <nl> } <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ <nl> + * Datamatrix * <nl> + \ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + typedef unsigned char uint8 ; <nl> + <nl> + class DatamatrixCode { <nl> + public : <nl> + char msg [ 4 ] ; <nl> + CvMat * original ; <nl> + CvMat * corners ; <nl> + } ; <nl> + # include < deque > <nl> + std : : deque < DatamatrixCode > findcodes ( CvMat * im ) ; <nl> + <nl> # endif <nl> <nl> # endif <nl> new file mode 100644 <nl> index 00000000000 . . 47414e418f9 <nl> mmm / dev / null <nl> ppp b / modules / objdetect / src / datamatrix . cpp <nl> <nl> + # include < xmmintrin . h > <nl> + # include " precomp . hpp " <nl> + # include < deque > <nl> + using namespace std ; <nl> + <nl> + # undef NDEBUG <nl> + # include < assert . h > <nl> + <nl> + class Sampler { <nl> + public : <nl> + CvMat * im ; <nl> + CvPoint o ; <nl> + CvPoint c , cc ; <nl> + CvMat * perim ; <nl> + CvPoint fcoord ( float fx , float fy ) ; <nl> + CvPoint coord ( int ix , int iy ) ; <nl> + Sampler ( ) { } <nl> + Sampler ( CvMat * _im , CvPoint _o , CvPoint _c , CvPoint _cc ) ; <nl> + uint8 getpixel ( int ix , int iy ) ; <nl> + int isinside ( int x , int y ) ; <nl> + int overlap ( Sampler & other ) ; <nl> + int hasbars ( ) ; <nl> + void timing ( ) ; <nl> + CvMat * extract ( ) ; <nl> + } ; <nl> + <nl> + class code { / / used in this file only <nl> + public : <nl> + char msg [ 4 ] ; <nl> + CvMat * original ; <nl> + Sampler sa ; <nl> + } ; <nl> + <nl> + # include " followblk . h " <nl> + <nl> + # define dethresh 0 . 92f <nl> + # define eincO ( 2 * dethresh ) / / e increment orthogonal <nl> + # define eincD ( 1 . 414 * dethresh ) / / e increment diagonal <nl> + <nl> + static const float eincs [ ] = { <nl> + eincO , eincD , <nl> + eincO , eincD , <nl> + eincO , eincD , <nl> + eincO , eincD , <nl> + 999 } ; <nl> + <nl> + # define Ki ( x ) _mm_set_epi32 ( ( x ) , ( x ) , ( x ) , ( x ) ) <nl> + # define Kf ( x ) _mm_set_ps ( ( x ) , ( x ) , ( x ) , ( x ) ) <nl> + # define _mm_abs_ps ( x ) ( __m128 ) _mm_and_ps ( ( __m128 ) ( x ) , ( __m128 ) Ki ( 0x7fffffff ) ) <nl> + <nl> + static void writexy ( CvMat * m , int r , CvPoint p ) <nl> + { <nl> + int * pdst = ( int * ) cvPtr2D ( m , r , 0 ) ; <nl> + pdst [ 0 ] = p . x ; <nl> + pdst [ 1 ] = p . y ; <nl> + } <nl> + <nl> + Sampler : : Sampler ( CvMat * _im , CvPoint _o , CvPoint _c , CvPoint _cc ) <nl> + { <nl> + im = _im ; <nl> + o = _o ; <nl> + c = _c ; <nl> + cc = _cc ; <nl> + perim = cvCreateMat ( 4 , 1 , CV_32SC2 ) ; <nl> + writexy ( perim , 0 , fcoord ( - . 2 , - . 2 ) ) ; <nl> + writexy ( perim , 1 , fcoord ( - . 2 , 1 . 2 ) ) ; <nl> + writexy ( perim , 2 , fcoord ( 1 . 2 , 1 . 2 ) ) ; <nl> + writexy ( perim , 3 , fcoord ( 1 . 2 , - . 2 ) ) ; <nl> + / / printf ( " Sampler % d , % d % d , % d % d , % d \ n " , o . x , o . y , c . x , c . y , cc . x , cc . y ) ; <nl> + } <nl> + <nl> + CvPoint Sampler : : fcoord ( float fx , float fy ) <nl> + { <nl> + CvPoint r ; <nl> + r . x = ( int ) ( o . x + fx * ( cc . x - o . x ) + fy * ( c . x - o . x ) ) ; <nl> + r . y = ( int ) ( o . y + fx * ( cc . y - o . y ) + fy * ( c . y - o . y ) ) ; <nl> + return r ; <nl> + } <nl> + <nl> + CvPoint Sampler : : coord ( int ix , int iy ) <nl> + { <nl> + return fcoord ( 0 . 05 + 0 . 1 * ix , 0 . 05 + 0 . 1 * iy ) ; <nl> + } <nl> + <nl> + uint8 Sampler : : getpixel ( int ix , int iy ) <nl> + { <nl> + CvPoint pt = coord ( ix , iy ) ; <nl> + / / printf ( " % d , % d \ n " , pt . x , pt . y ) ; <nl> + return * cvPtr2D ( im , pt . y , pt . x ) ; <nl> + } <nl> + <nl> + int Sampler : : isinside ( int x , int y ) <nl> + { <nl> + CvPoint2D32f fp ; <nl> + fp . x = x ; <nl> + fp . y = y ; <nl> + return cvPointPolygonTest ( perim , fp , 0 ) < 0 ; <nl> + } <nl> + <nl> + int Sampler : : overlap ( Sampler & other ) <nl> + { <nl> + for ( int i = 0 ; i < 4 ; i + + ) { <nl> + CvScalar p ; <nl> + p = cvGet2D ( other . perim , i , 0 ) ; <nl> + if ( isinside ( ( int ) p . val [ 0 ] , ( int ) p . val [ 1 ] ) ) <nl> + return 1 ; <nl> + p = cvGet2D ( perim , i , 0 ) ; <nl> + if ( other . isinside ( ( int ) p . val [ 0 ] , ( int ) p . val [ 1 ] ) ) <nl> + return 1 ; <nl> + } <nl> + return 0 ; <nl> + } <nl> + <nl> + int Sampler : : hasbars ( ) <nl> + { <nl> + return getpixel ( 9 , 1 ) > getpixel ( 9 , 0 ) ; <nl> + } <nl> + <nl> + void Sampler : : timing ( ) <nl> + { <nl> + uint8 dark = getpixel ( 9 , 0 ) ; <nl> + for ( int i = 1 ; i < 3 ; i + = 2 ) { <nl> + uint8 light = getpixel ( 9 , i ) ; <nl> + / / if ( light < = dark ) <nl> + / / goto endo ; <nl> + dark = getpixel ( 9 , i + 1 ) ; <nl> + / / if ( up < = down ) <nl> + / / goto endo ; <nl> + } <nl> + } <nl> + <nl> + CvMat * Sampler : : extract ( ) <nl> + { <nl> + / / return a 10x10 CvMat for the current contents , 0 is black , 255 is white <nl> + / / Sampler has ( 0 , 0 ) at bottom left , so invert Y <nl> + CvMat * r = cvCreateMat ( 10 , 10 , CV_8UC1 ) ; <nl> + for ( int x = 0 ; x < 10 ; x + + ) <nl> + for ( int y = 0 ; y < 10 ; y + + ) <nl> + * cvPtr2D ( r , 9 - y , x ) = ( getpixel ( x , y ) < 128 ) ? 0 : 255 ; <nl> + return r ; <nl> + } <nl> + <nl> + static void apron ( CvMat * v ) <nl> + { <nl> + int r = v - > rows ; <nl> + int c = v - > cols ; <nl> + memset ( cvPtr2D ( v , 0 , 0 ) , 0x22 , c ) ; <nl> + memset ( cvPtr2D ( v , 1 , 0 ) , 0x22 , c ) ; <nl> + memset ( cvPtr2D ( v , r - 2 , 0 ) , 0x22 , c ) ; <nl> + memset ( cvPtr2D ( v , r - 1 , 0 ) , 0x22 , c ) ; <nl> + int y ; <nl> + for ( y = 2 ; y < r - 2 ; y + + ) { <nl> + uchar * lp = cvPtr2D ( v , y , 0 ) ; <nl> + lp [ 0 ] = 0x22 ; <nl> + lp [ 1 ] = 0x22 ; <nl> + lp [ c - 2 ] = 0x22 ; <nl> + lp [ c - 1 ] = 0x22 ; <nl> + } <nl> + } <nl> + <nl> + static void cfollow ( CvMat * src , CvMat * dst ) <nl> + { <nl> + int sx , sy ; <nl> + uint8 * vpd = cvPtr2D ( src , 0 , 0 ) ; <nl> + for ( sy = 0 ; sy < src - > rows ; sy + + ) { <nl> + short * wr = ( short * ) cvPtr2D ( dst , sy , 0 ) ; <nl> + for ( sx = 0 ; sx < src - > cols ; sx + + ) { <nl> + int x = sx ; <nl> + int y = sy ; <nl> + float e = 0 ; <nl> + int ontrack = true ; <nl> + int dir ; <nl> + <nl> + while ( ontrack ) { <nl> + dir = vpd [ y * src - > step + x ] ; <nl> + int xd = ( ( dir & 0xf ) - 2 ) ; <nl> + int yd = ( ( dir > > 4 ) - 2 ) ; <nl> + e + = ( dir = = 0x22 ) ? 999 : ( ( dir & 1 ) ? eincD : eincO ) ; <nl> + x + = xd ; <nl> + y + = yd ; <nl> + if ( e > 10 . ) { <nl> + float d = ( ( x - sx ) * ( x - sx ) ) + ( ( y - sy ) * ( y - sy ) ) ; <nl> + ontrack = d > ( e * e ) ; <nl> + } <nl> + } <nl> + if ( ( 24 < = e ) & & ( e < 999 ) ) { <nl> + / / printf ( " sx = % d , sy = % d , x = % d , y = % d \ n " , sx , sy , x , y ) ; <nl> + * wr + + = x - sx ; <nl> + * wr + + = y - sy ; <nl> + } else { <nl> + * wr + + = 0 ; <nl> + * wr + + = 0 ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + static uint8 gf256mul ( uint8 a , uint8 b ) <nl> + { <nl> + return Alog [ ( Log [ a ] + Log [ b ] ) % 255 ] ; <nl> + } <nl> + <nl> + static int decode ( Sampler & sa , code & cc ) <nl> + { <nl> + uint8 binary [ 8 ] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; <nl> + uint8 b = 0 ; <nl> + <nl> + for ( int i = 0 ; i < 64 ; i + + ) { <nl> + b = ( b < < 1 ) + ( sa . getpixel ( pickup [ i ] . x , pickup [ i ] . y ) < = 128 ) ; <nl> + if ( ( i & 7 ) = = 7 ) { <nl> + binary [ i > > 3 ] = b ; <nl> + b = 0 ; <nl> + } <nl> + } <nl> + <nl> + / / Compute the 5 RS codewords for the 3 datawords <nl> + <nl> + uint8 c [ 5 ] = { 0 , 0 , 0 , 0 , 0 } ; <nl> + { <nl> + int i , j ; <nl> + uint8 a [ 5 ] = { 228 , 48 , 15 , 111 , 62 } ; <nl> + int k = 5 ; <nl> + for ( i = 0 ; i < 3 ; i + + ) { <nl> + uint8 t = binary [ i ] ^ c [ 4 ] ; <nl> + for ( j = k - 1 ; j ! = - 1 ; j - - ) { <nl> + if ( t = = 0 ) <nl> + c [ j ] = 0 ; <nl> + else <nl> + c [ j ] = gf256mul ( t , a [ j ] ) ; <nl> + if ( j > 0 ) <nl> + c [ j ] = c [ j - 1 ] ^ c [ j ] ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( ( c [ 4 ] = = binary [ 3 ] ) & & <nl> + ( c [ 3 ] = = binary [ 4 ] ) & & <nl> + ( c [ 2 ] = = binary [ 5 ] ) & & <nl> + ( c [ 1 ] = = binary [ 6 ] ) & & <nl> + ( c [ 0 ] = = binary [ 7 ] ) ) { <nl> + uint8 x = 0xff & ( binary [ 0 ] - 1 ) ; <nl> + uint8 y = 0xff & ( binary [ 1 ] - 1 ) ; <nl> + uint8 z = 0xff & ( binary [ 2 ] - 1 ) ; <nl> + cc . msg [ 0 ] = x ; <nl> + cc . msg [ 1 ] = y ; <nl> + cc . msg [ 2 ] = z ; <nl> + cc . msg [ 3 ] = 0 ; <nl> + cc . sa = sa ; <nl> + cc . original = sa . extract ( ) ; <nl> + return 1 ; <nl> + } else { <nl> + return 0 ; <nl> + } <nl> + } <nl> + <nl> + static deque < CvPoint > trailto ( CvMat * v , int x , int y , CvMat * terminal ) <nl> + { <nl> + CvPoint np ; <nl> + / * Return the last 10th of the trail of points following v from ( x , y ) <nl> + * to terminal <nl> + * / <nl> + <nl> + int ex = x + ( ( short * ) cvPtr2D ( terminal , y , x ) ) [ 0 ] ; <nl> + int ey = y + ( ( short * ) cvPtr2D ( terminal , y , x ) ) [ 1 ] ; <nl> + deque < CvPoint > r ; <nl> + while ( ( x ! = ex ) | | ( y ! = ey ) ) { <nl> + np . x = x ; <nl> + np . y = y ; <nl> + r . push_back ( np ) ; <nl> + int dir = * cvPtr2D ( v , y , x ) ; <nl> + int xd = ( ( dir & 0xf ) - 2 ) ; <nl> + int yd = ( ( dir > > 4 ) - 2 ) ; <nl> + x + = xd ; <nl> + y + = yd ; <nl> + } <nl> + <nl> + int l = r . size ( ) * 9 / 10 ; <nl> + while ( l - - ) <nl> + r . pop_front ( ) ; <nl> + return r ; <nl> + } <nl> + <nl> + deque < DatamatrixCode > findcodes ( CvMat * im ) <nl> + { <nl> + int r = im - > rows ; <nl> + int c = im - > cols ; <nl> + <nl> + # define SAMESIZE ( nm , ty ) CvMat * nm = cvCreateMat ( r , c , ty ) ; <nl> + <nl> + SAMESIZE ( thresh , CV_8UC1 ) <nl> + SAMESIZE ( vecpic , CV_8UC1 ) <nl> + SAMESIZE ( vc , CV_8UC1 ) <nl> + SAMESIZE ( vcc , CV_8UC1 ) <nl> + SAMESIZE ( cxy , CV_16SC2 ) <nl> + SAMESIZE ( ccxy , CV_16SC2 ) <nl> + <nl> + cvAdaptiveThreshold ( im , thresh , 255 . 0 , CV_ADAPTIVE_THRESH_MEAN_C , CV_THRESH_BINARY , 13 ) ; <nl> + { <nl> + int x , y ; <nl> + int sstride = thresh - > step ; <nl> + int sw = thresh - > cols ; / / source width <nl> + for ( y = 2 ; y < thresh - > rows - 2 ; y + + ) { <nl> + uint8 * ps = cvPtr2D ( thresh , y , 0 ) ; <nl> + uint8 * pd = cvPtr2D ( vecpic , y , 0 ) ; <nl> + uint8 * pvc = cvPtr2D ( vc , y , 0 ) ; <nl> + uint8 * pvcc = cvPtr2D ( vcc , y , 0 ) ; <nl> + for ( x = 0 ; x < sw ; x + + ) { <nl> + uint8 v = <nl> + ( 0x01 & ps [ - 2 * sstride ] ) | <nl> + ( 0x02 & ps [ - sstride + 1 ] ) | <nl> + ( 0x04 & ps [ 2 ] ) | <nl> + ( 0x08 & ps [ sstride + 1 ] ) | <nl> + ( 0x10 & ps [ 2 * sstride ] ) | <nl> + ( 0x20 & ps [ sstride - 1 ] ) | <nl> + ( 0x40 & ps [ - 2 ] ) | <nl> + ( 0x80 & ps [ - sstride - 1 ] ) ; <nl> + * pd + + = v ; <nl> + * pvc + + = cblk [ v ] ; <nl> + * pvcc + + = ccblk [ v ] ; <nl> + ps + + ; <nl> + } <nl> + } <nl> + apron ( vc ) ; <nl> + apron ( vcc ) ; <nl> + } <nl> + <nl> + cfollow ( vc , cxy ) ; <nl> + cfollow ( vcc , ccxy ) ; <nl> + <nl> + deque < CvPoint > candidates ; <nl> + { <nl> + int x , y ; <nl> + int r = cxy - > rows ; <nl> + int c = cxy - > cols ; <nl> + for ( y = 0 ; y < r ; y + + ) { <nl> + __m64 * cd = ( __m64 * ) cvPtr2D ( cxy , y , 0 ) ; <nl> + __m64 * ccd = ( __m64 * ) cvPtr2D ( ccxy , y , 0 ) ; <nl> + for ( x = 0 ; x < c ; x + = 4 ) { <nl> + __m128 cyxyxA = _mm_cvtpi16_ps ( * cd + + ) ; <nl> + __m128 cyxyxB = _mm_cvtpi16_ps ( * cd + + ) ; <nl> + __m128 cx = _mm_shuffle_ps ( cyxyxA , cyxyxB , _MM_SHUFFLE ( 0 , 2 , 0 , 2 ) ) ; <nl> + __m128 cy = _mm_shuffle_ps ( cyxyxA , cyxyxB , _MM_SHUFFLE ( 1 , 3 , 1 , 3 ) ) ; <nl> + __m128 cmag = _mm_sqrt_ps ( cx * cx + cy * cy ) ; <nl> + __m128 crmag = _mm_rcp_ps ( cmag ) ; <nl> + __m128 ncx = cx * crmag ; <nl> + __m128 ncy = cy * crmag ; <nl> + <nl> + __m128 ccyxyxA = _mm_cvtpi16_ps ( * ccd + + ) ; <nl> + __m128 ccyxyxB = _mm_cvtpi16_ps ( * ccd + + ) ; <nl> + __m128 ccx = _mm_shuffle_ps ( ccyxyxA , ccyxyxB , _MM_SHUFFLE ( 0 , 2 , 0 , 2 ) ) ; <nl> + __m128 ccy = _mm_shuffle_ps ( ccyxyxA , ccyxyxB , _MM_SHUFFLE ( 1 , 3 , 1 , 3 ) ) ; <nl> + __m128 ccmag = _mm_sqrt_ps ( ccx * ccx + ccy * ccy ) ; <nl> + __m128 ccrmag = _mm_rcp_ps ( ccmag ) ; <nl> + __m128 nccx = ccx * ccrmag ; <nl> + __m128 nccy = ccy * ccrmag ; <nl> + <nl> + __m128 dot = ncx * nccx + ncy * nccy ; <nl> + / / iscand = ( cmag > 30 ) & ( ccmag > 30 ) & ( numpy . minimum ( cmag , ccmag ) * 1 . 1 > numpy . maximum ( cmag , ccmag ) ) & ( abs ( dot ) < 0 . 25 ) <nl> + __m128 iscand = _mm_and_ps ( _mm_cmpgt_ps ( cmag , Kf ( 30 ) ) , _mm_cmpgt_ps ( ccmag , Kf ( 30 ) ) ) ; <nl> + iscand = _mm_and_ps ( iscand , _mm_cmpgt_ps ( _mm_min_ps ( cmag , ccmag ) * Kf ( 1 . 1 ) , _mm_max_ps ( cmag , ccmag ) ) ) ; <nl> + iscand = _mm_and_ps ( iscand , _mm_cmplt_ps ( _mm_abs_ps ( dot ) , Kf ( 0 . 25 ) ) ) ; <nl> + <nl> + unsigned int result [ 4 ] ; <nl> + * ( __m128 * ) result = iscand ; <nl> + int ix ; <nl> + CvPoint np ; <nl> + for ( ix = 0 ; ix < 4 ; ix + + ) { <nl> + if ( result [ ix ] ) { <nl> + np . x = x + ix ; <nl> + np . y = y ; <nl> + candidates . push_back ( np ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + deque < code > codes ; <nl> + size_t i , j , k ; <nl> + while ( ! candidates . empty ( ) ) { <nl> + CvPoint o = candidates . front ( ) ; <nl> + candidates . pop_front ( ) ; <nl> + deque < CvPoint > ptc = trailto ( vc , o . x , o . y , cxy ) ; <nl> + deque < CvPoint > ptcc = trailto ( vcc , o . x , o . y , ccxy ) ; <nl> + for ( j = 0 ; j < ptc . size ( ) ; j + + ) { <nl> + for ( k = 0 ; k < ptcc . size ( ) ; k + + ) { <nl> + code cc ; <nl> + Sampler sa ( im , o , ptc [ j ] , ptcc [ k ] ) ; <nl> + for ( i = 0 ; i < codes . size ( ) ; i + + ) { <nl> + if ( sa . overlap ( codes [ i ] . sa ) ) <nl> + goto endo ; <nl> + } <nl> + if ( codes . size ( ) > 0 ) { <nl> + printf ( " searching for more \ n " ) ; <nl> + } <nl> + if ( decode ( sa , cc ) ) { <nl> + codes . push_back ( cc ) ; <nl> + goto endo ; <nl> + } <nl> + } <nl> + } <nl> + endo : ; / / end search for this o <nl> + } <nl> + <nl> + cvFree ( & thresh ) ; <nl> + cvFree ( & vecpic ) ; <nl> + cvFree ( & vc ) ; <nl> + cvFree ( & vcc ) ; <nl> + cvFree ( & cxy ) ; <nl> + cvFree ( & ccxy ) ; <nl> + <nl> + deque < DatamatrixCode > rc ; <nl> + for ( i = 0 ; i < codes . size ( ) ; i + + ) { <nl> + DatamatrixCode cc ; <nl> + strcpy ( cc . msg , codes [ i ] . msg ) ; <nl> + cc . original = codes [ i ] . original ; <nl> + cc . corners = codes [ i ] . sa . perim ; <nl> + rc . push_back ( cc ) ; <nl> + } <nl> + return rc ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 5277a7e81a5 <nl> mmm / dev / null <nl> ppp b / modules / objdetect / src / followblk . h <nl> <nl> + unsigned char cblk [ 256 ] = { 34 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 66 , 19 , 36 , 36 , 66 , 19 , 66 , 66 , 49 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 49 , 19 , 36 , 36 , 49 , 19 , 49 , 49 , 32 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 66 , 19 , 36 , 36 , 66 , 19 , 66 , 66 , 32 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 32 , 19 , 36 , 36 , 32 , 19 , 32 , 32 , 17 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 66 , 19 , 36 , 36 , 66 , 19 , 66 , 66 , 49 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 49 , 19 , 36 , 36 , 49 , 19 , 49 , 49 , 17 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 66 , 19 , 36 , 36 , 66 , 19 , 66 , 66 , 17 , 19 , 36 , 36 , 51 , 19 , 51 , 51 , 17 , 19 , 36 , 36 , 17 , 19 , 17 , 17 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 66 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 49 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 66 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 32 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 66 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 49 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 66 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 51 , 2 , 19 , 2 , 36 , 2 , 19 , 2 , 34 } ; <nl> + unsigned char ccblk [ 256 ] = { 34 , 17 , 2 , 17 , 19 , 19 , 2 , 17 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 17 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 17 , 66 , 66 , 2 , 66 , 19 , 19 , 2 , 66 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 66 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 17 , 49 , 49 , 2 , 49 , 19 , 19 , 2 , 49 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 49 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 49 , 66 , 66 , 2 , 66 , 19 , 19 , 2 , 66 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 66 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 17 , 32 , 32 , 2 , 32 , 19 , 19 , 2 , 32 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 32 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 32 , 66 , 66 , 2 , 66 , 19 , 19 , 2 , 66 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 66 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 32 , 49 , 49 , 2 , 49 , 19 , 19 , 2 , 49 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 49 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 49 , 66 , 66 , 2 , 66 , 19 , 19 , 2 , 66 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 66 , 51 , 51 , 2 , 51 , 19 , 19 , 2 , 51 , 36 , 36 , 2 , 36 , 19 , 19 , 2 , 34 } ; <nl> + static const CvPoint pickup [ 64 ] = { { 7 , 6 } , { 8 , 6 } , { 7 , 5 } , { 8 , 5 } , { 1 , 5 } , { 7 , 4 } , { 8 , 4 } , { 1 , 4 } , { 1 , 8 } , { 2 , 8 } , { 1 , 7 } , { 2 , 7 } , { 3 , 7 } , { 1 , 6 } , { 2 , 6 } , { 3 , 6 } , { 3 , 2 } , { 4 , 2 } , { 3 , 1 } , { 4 , 1 } , { 5 , 1 } , { 3 , 8 } , { 4 , 8 } , { 5 , 8 } , { 6 , 1 } , { 7 , 1 } , { 6 , 8 } , { 7 , 8 } , { 8 , 8 } , { 6 , 7 } , { 7 , 7 } , { 8 , 7 } , { 4 , 7 } , { 5 , 7 } , { 4 , 6 } , { 5 , 6 } , { 6 , 6 } , { 4 , 5 } , { 5 , 5 } , { 6 , 5 } , { 2 , 5 } , { 3 , 5 } , { 2 , 4 } , { 3 , 4 } , { 4 , 4 } , { 2 , 3 } , { 3 , 3 } , { 4 , 3 } , { 8 , 3 } , { 1 , 3 } , { 8 , 2 } , { 1 , 2 } , { 2 , 2 } , { 8 , 1 } , { 1 , 1 } , { 2 , 1 } , { 5 , 4 } , { 6 , 4 } , { 5 , 3 } , { 6 , 3 } , { 7 , 3 } , { 5 , 2 } , { 6 , 2 } , { 7 , 2 } } ; <nl> + static const uint8 Alog [ 256 ] = { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 45 , 90 , 180 , 69 , 138 , 57 , 114 , 228 , 229 , 231 , 227 , 235 , 251 , 219 , 155 , 27 , 54 , 108 , 216 , 157 , 23 , 46 , 92 , 184 , 93 , 186 , 89 , 178 , 73 , 146 , 9 , 18 , 36 , 72 , 144 , 13 , 26 , 52 , 104 , 208 , 141 , 55 , 110 , 220 , 149 , 7 , 14 , 28 , 56 , 112 , 224 , 237 , 247 , 195 , 171 , 123 , 246 , 193 , 175 , 115 , 230 , 225 , 239 , 243 , 203 , 187 , 91 , 182 , 65 , 130 , 41 , 82 , 164 , 101 , 202 , 185 , 95 , 190 , 81 , 162 , 105 , 210 , 137 , 63 , 126 , 252 , 213 , 135 , 35 , 70 , 140 , 53 , 106 , 212 , 133 , 39 , 78 , 156 , 21 , 42 , 84 , 168 , 125 , 250 , 217 , 159 , 19 , 38 , 76 , 152 , 29 , 58 , 116 , 232 , 253 , 215 , 131 , 43 , 86 , 172 , 117 , 234 , 249 , 223 , 147 , 11 , 22 , 44 , 88 , 176 , 77 , 154 , 25 , 50 , 100 , 200 , 189 , 87 , 174 , 113 , 226 , 233 , 255 , 211 , 139 , 59 , 118 , 236 , 245 , 199 , 163 , 107 , 214 , 129 , 47 , 94 , 188 , 85 , 170 , 121 , 242 , 201 , 191 , 83 , 166 , 97 , 194 , 169 , 127 , 254 , 209 , 143 , 51 , 102 , 204 , 181 , 71 , 142 , 49 , 98 , 196 , 165 , 103 , 206 , 177 , 79 , 158 , 17 , 34 , 68 , 136 , 61 , 122 , 244 , 197 , 167 , 99 , 198 , 161 , 111 , 222 , 145 , 15 , 30 , 60 , 120 , 240 , 205 , 183 , 67 , 134 , 33 , 66 , 132 , 37 , 74 , 148 , 5 , 10 , 20 , 40 , 80 , 160 , 109 , 218 , 153 , 31 , 62 , 124 , 248 , 221 , 151 , 3 , 6 , 12 , 24 , 48 , 96 , 192 , 173 , 119 , 238 , 241 , 207 , 179 , 75 , 150 , 1 } ; <nl> + static const uint8 Log [ 256 ] = { - 255 , 255 , 1 , 240 , 2 , 225 , 241 , 53 , 3 , 38 , 226 , 133 , 242 , 43 , 54 , 210 , 4 , 195 , 39 , 114 , 227 , 106 , 134 , 28 , 243 , 140 , 44 , 23 , 55 , 118 , 211 , 234 , 5 , 219 , 196 , 96 , 40 , 222 , 115 , 103 , 228 , 78 , 107 , 125 , 135 , 8 , 29 , 162 , 244 , 186 , 141 , 180 , 45 , 99 , 24 , 49 , 56 , 13 , 119 , 153 , 212 , 199 , 235 , 91 , 6 , 76 , 220 , 217 , 197 , 11 , 97 , 184 , 41 , 36 , 223 , 253 , 116 , 138 , 104 , 193 , 229 , 86 , 79 , 171 , 108 , 165 , 126 , 145 , 136 , 34 , 9 , 74 , 30 , 32 , 163 , 84 , 245 , 173 , 187 , 204 , 142 , 81 , 181 , 190 , 46 , 88 , 100 , 159 , 25 , 231 , 50 , 207 , 57 , 147 , 14 , 67 , 120 , 128 , 154 , 248 , 213 , 167 , 200 , 63 , 236 , 110 , 92 , 176 , 7 , 161 , 77 , 124 , 221 , 102 , 218 , 95 , 198 , 90 , 12 , 152 , 98 , 48 , 185 , 179 , 42 , 209 , 37 , 132 , 224 , 52 , 254 , 239 , 117 , 233 , 139 , 22 , 105 , 27 , 194 , 113 , 230 , 206 , 87 , 158 , 80 , 189 , 172 , 203 , 109 , 175 , 166 , 62 , 127 , 247 , 146 , 66 , 137 , 192 , 35 , 252 , 10 , 183 , 75 , 216 , 31 , 83 , 33 , 73 , 164 , 144 , 85 , 170 , 246 , 65 , 174 , 61 , 188 , 202 , 205 , 157 , 143 , 169 , 82 , 72 , 182 , 215 , 191 , 251 , 47 , 178 , 89 , 151 , 101 , 94 , 160 , 123 , 26 , 112 , 232 , 21 , 51 , 238 , 208 , 131 , 58 , 69 , 148 , 18 , 15 , 16 , 68 , 17 , 121 , 149 , 129 , 19 , 155 , 59 , 249 , 70 , 214 , 250 , 168 , 71 , 201 , 156 , 64 , 60 , 237 , 130 , 111 , 20 , 93 , 122 , 177 , 150 } ; <nl> mmm a / modules / python / src / cv . cpp <nl> ppp b / modules / python / src / cv . cpp <nl> static PyObject * pycvClipLine ( PyObject * self , PyObject * args ) <nl> } <nl> } <nl> <nl> + static PyObject * pyfindcodes ( PyObject * self , PyObject * args ) <nl> + { <nl> + PyObject * pyim ; <nl> + if ( ! PyArg_ParseTuple ( args , " O " , & pyim ) ) <nl> + return NULL ; <nl> + <nl> + CvMat * image ; <nl> + if ( ! convert_to_CvMat ( pyim , & image , " image " ) ) return NULL ; <nl> + <nl> + std : : deque < DatamatrixCode > codes = findcodes ( image ) ; <nl> + <nl> + PyObject * pycodes = PyList_New ( codes . size ( ) ) ; <nl> + int i ; <nl> + for ( i = 0 ; i < codes . size ( ) ; i + + ) { <nl> + DatamatrixCode * pc = & codes [ i ] ; <nl> + PyList_SetItem ( pycodes , i , Py_BuildValue ( " ( sOO ) " , pc - > msg , FROM_CvMat ( pc - > corners ) , FROM_CvMat ( pc - > original ) ) ) ; <nl> + } <nl> + <nl> + return pycodes ; <nl> + } <nl> + <nl> static PyObject * temp_test ( PyObject * self , PyObject * args ) <nl> { <nl> # if 0 <nl> static PyMethodDef methods [ ] = { <nl> / / { " _HOGDetect " , ( PyCFunction ) pycvHOGDetect , METH_KEYWORDS , " _HOGDetect ( image , svm_classifier , win_stride = block_stride , locations = None , padding = ( 0 , 0 ) , win_size = ( 64 , 128 ) , block_size = ( 16 , 16 ) , block_stride = ( 8 , 8 ) , cell_size = ( 8 , 8 ) , nbins = 9 , gammaCorrection = true ) - > list_of_points " } , <nl> / / { " _HOGDetectMultiScale " , ( PyCFunction ) pycvHOGDetectMultiScale , METH_KEYWORDS , " _HOGDetectMultiScale ( image , svm_classifier , win_stride = block_stride , scale = 1 . 05 , group_threshold = 2 , padding = ( 0 , 0 ) , win_size = ( 64 , 128 ) , block_size = ( 16 , 16 ) , block_stride = ( 8 , 8 ) , cell_size = ( 8 , 8 ) , nbins = 9 , gammaCorrection = true ) - > list_of_points " } , <nl> <nl> + { " findcodes " , pyfindcodes , METH_VARARGS } , <nl> { " temp_test " , temp_test , METH_VARARGS } , <nl> <nl> # include " generated1 . i " <nl>
|
datamatrix
|
opencv/opencv
|
324e89ab3aec7e8d93e66c78b7cf65b3ed5b29f3
|
2011-04-21T00:21:42Z
|
mmm a / Code / CryEngine / RenderDll / Common / Renderer . h <nl> ppp b / Code / CryEngine / RenderDll / Common / Renderer . h <nl> class CManager ; <nl> <nl> namespace compute_skinning { <nl> class CStorage ; <nl> + struct IComputeSkinningStorage ; <nl> } <nl> <nl> typedef int ( * pDrawModelFunc ) ( void ) ; <nl> mmm a / Code / CryEngine / RenderDll / XRenderD3D9 / D3DMultiResRendering . cpp <nl> ppp b / Code / CryEngine / RenderDll / XRenderD3D9 / D3DMultiResRendering . cpp <nl> void CVrProjectionManager : : BeginFrame ( CGraphicsPipeline * pGraphicsPipeline ) <nl> { <nl> if ( ! m_passes | | m_passes - > currentKey ! = pGraphicsPipeline - > GetKey ( ) ) <nl> { <nl> - m_passes = std : : make_unique < SVRProjectionPasses > ( pGraphicsPipeline ) ; <nl> + m_passes = stl : : make_unique < SVRProjectionPasses > ( pGraphicsPipeline ) ; <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / RenderDll / XRenderD3D9 / D3D_SVO . h <nl> ppp b / Code / CryEngine / RenderDll / XRenderD3D9 / D3D_SVO . h <nl> class CSvoRenderer : public ISvoRenderer <nl> { <nl> if ( ! m_pPasses | | m_pPasses - > currentKey ! = pGraphicsPipeline - > GetKey ( ) ) <nl> { <nl> - m_pPasses = std : : make_unique < SSvoPrimitivePasses > ( pGraphicsPipeline ) ; <nl> + m_pPasses = stl : : make_unique < SSvoPrimitivePasses > ( pGraphicsPipeline ) ; <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / RenderDll / XRenderD3D9 / GraphicsPipeline / VolumetricClouds . cpp <nl> ppp b / Code / CryEngine / RenderDll / XRenderD3D9 / GraphicsPipeline / VolumetricClouds . cpp <nl> void CVolumetricCloudsStage : : ExecuteRenderClouds ( const VCCloudRenderContext & con <nl> <nl> const int32 currentRenderEye = static_cast < int32 > ( RenderView ( ) - > GetCurrentEye ( ) ) ; <nl> auto * pVolFogStage = m_graphicsPipeline . GetStage < CVolumetricFogStage > ( ) ; <nl> - auto * pFogStage = m_graphicsPipeline . GetStage < CFogStage > ( ) ; <nl> <nl> CShader * pShader = CShaderMan : : s_ShaderClouds ; <nl> <nl> void CVolumetricCloudsStage : : ExecuteRenderClouds ( const VCCloudRenderContext & con <nl> # if defined ( VOLUMETRIC_FOG_SHADOWS ) <nl> else if ( context . renderFogShadow ) <nl> { <nl> + auto * pFogStage = m_graphicsPipeline . GetStage < CFogStage > ( ) ; <nl> pass . SetTexture ( 8 , pFogStage - > m_pTexVolFogShadowBuf [ 0 ] ) ; <nl> pass . SetSampler ( 3 , EDefaultSamplerStates : : PointClamp ) ; <nl> } <nl> mmm a / Code / CryEngine / RenderDll / XRenderD3D9 / GraphicsPipeline / Water . cpp <nl> ppp b / Code / CryEngine / RenderDll / XRenderD3D9 / GraphicsPipeline / Water . cpp <nl> bool CWaterStage : : SetAndBuildPerPassResources ( bool bOnInit , EPass passId ) <nl> auto * pTiledLights = m_graphicsPipeline . GetStage < CTiledLightVolumesStage > ( ) ; <nl> auto * pVolFogStage = m_graphicsPipeline . GetStage < CVolumetricFogStage > ( ) ; <nl> auto * pRippleStage = m_graphicsPipeline . GetStage < CWaterRipplesStage > ( ) ; <nl> - auto * pFogStage = m_graphicsPipeline . GetStage < CFogStage > ( ) ; <nl> <nl> auto & resources = m_perPassResources [ passId ] ; <nl> auto & pResourceSet = m_pPerPassResourceSets [ passId ] ; <nl> bool CWaterStage : : SetAndBuildPerPassResources ( bool bOnInit , EPass passId ) <nl> # if defined ( VOLUMETRIC_FOG_SHADOWS ) <nl> if ( gcpRendD3D - > m_bVolFogShadowsEnabled ) <nl> { <nl> + auto * pFogStage = m_graphicsPipeline . GetStage < CFogStage > ( ) ; <nl> pVolFogShadowTex = pFogStage - > m_pTexVolFogShadowBuf [ 0 ] ; <nl> } <nl> # endif <nl>
|
! I integrate from / / ce / main . . .
|
CRYTEK/CRYENGINE
|
a04353e0f601bb9608fc783ec41e0370282de3b0
|
2019-03-22T09:02:07Z
|
mmm a / src / compiler / ia32 / code - generator - ia32 . cc <nl> ppp b / src / compiler / ia32 / code - generator - ia32 . cc <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> } <nl> break ; <nl> } <nl> + <nl> + # define I8x16_SPLAT ( reg , scratch , v ) \ <nl> + __ Move ( reg , static_cast < uint32_t > ( v ) ) ; \ <nl> + __ Pxor ( scratch , scratch ) ; \ <nl> + __ Pshufb ( reg , scratch ) <nl> + <nl> + case kSSEI8x16Shl : { <nl> + DCHECK_EQ ( i . OutputSimd128Register ( ) , i . InputSimd128Register ( 0 ) ) ; <nl> + XMMRegister src = i . InputSimd128Register ( 0 ) ; <nl> + int8_t shift = i . InputInt8 ( 1 ) & 0x7 ; <nl> + XMMRegister tmp = i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + <nl> + / / src = AAaa . . . AAaa <nl> + / / tmp = 0F0F . . . 0F0F ( shift = 4 ) <nl> + I8x16_SPLAT ( tmp , kScratchDoubleReg , 0xFFU > > shift ) ; <nl> + <nl> + / / src = src & tmp <nl> + / / = > 0A0a . . . 0A0a <nl> + __ pand ( src , tmp ) ; <nl> + <nl> + / / src = src < < shift <nl> + / / = > A0a0 . . . A0a0 ( shift = 4 ) <nl> + __ pslld ( src , shift ) ; <nl> + break ; <nl> + } <nl> + case kAVXI8x16Shl : { <nl> + CpuFeatureScope avx_scope ( tasm ( ) , AVX ) ; <nl> + XMMRegister dst = i . OutputSimd128Register ( ) ; <nl> + XMMRegister src = i . InputSimd128Register ( 0 ) ; <nl> + int8_t shift = i . InputInt8 ( 1 ) & 0x7 ; <nl> + XMMRegister tmp = <nl> + dst ! = src ? dst : i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + <nl> + / / src = AAaa . . . AAaa <nl> + / / tmp = 0F0F . . . 0F0F ( shift = 4 ) <nl> + I8x16_SPLAT ( tmp , kScratchDoubleReg , 0xFFU > > shift ) ; <nl> + <nl> + / / dst = src & tmp <nl> + / / = > 0A0a . . . 0A0a <nl> + __ vpand ( dst , src , tmp ) ; <nl> + <nl> + / / dst = dst < < shift <nl> + / / = > A0a0 . . . A0a0 ( shift = 4 ) <nl> + __ vpslld ( dst , dst , shift ) ; <nl> + break ; <nl> + } <nl> + case kSSEI8x16ShrS : { <nl> + DCHECK_EQ ( i . OutputSimd128Register ( ) , i . InputSimd128Register ( 0 ) ) ; <nl> + XMMRegister src = i . InputSimd128Register ( 0 ) ; <nl> + int8_t shift = i . InputInt8 ( 1 ) & 0x7 ; <nl> + XMMRegister tmp = i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + <nl> + / / I16x8 view of I8x16 <nl> + / / src = AAaa AAaa . . . AAaa AAaa <nl> + <nl> + / / tmp = aa00 aa00 . . . aa00 aa00 <nl> + __ movaps ( tmp , src ) ; <nl> + __ Move ( kScratchDoubleReg , static_cast < uint32_t > ( 0xff00 ) ) ; <nl> + __ psllw ( tmp , 8 ) ; <nl> + <nl> + / / src = I16x8ShrS ( src , shift ) <nl> + / / = > SAAa SAAa . . . SAAa SAAa ( shift = 4 ) <nl> + __ pshuflw ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + __ psraw ( src , shift ) ; <nl> + <nl> + / / tmp = I16x8ShrS ( tmp , shift ) <nl> + / / = > Saa0 Saa0 . . . Saa0 Saa0 ( shift = 4 ) <nl> + __ pshufd ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + __ psraw ( tmp , shift ) ; <nl> + <nl> + / / src = I16x8And ( src , 0xff00 ) <nl> + / / = > SA00 SA00 . . . SA00 SA00 <nl> + __ pand ( src , kScratchDoubleReg ) ; <nl> + <nl> + / / tmp = I16x8ShrU ( tmp , 8 ) <nl> + / / = > 00Sa 00Sa . . . 00Sa 00Sa ( shift = 4 ) <nl> + __ psrlw ( tmp , 8 ) ; <nl> + <nl> + / / src = I16x8Or ( src , tmp ) <nl> + / / = > SASa SASa . . . SASa SASa ( shift = 4 ) <nl> + __ por ( src , tmp ) ; <nl> + break ; <nl> + } <nl> + case kAVXI8x16ShrS : { <nl> + CpuFeatureScope avx_scope ( tasm ( ) , AVX ) ; <nl> + XMMRegister dst = i . OutputSimd128Register ( ) ; <nl> + XMMRegister src = i . InputSimd128Register ( 0 ) ; <nl> + int8_t shift = i . InputInt8 ( 1 ) & 0x7 ; <nl> + XMMRegister tmp = i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + <nl> + / / I16x8 view of I8x16 <nl> + / / src = AAaa AAaa . . . AAaa AAaa <nl> + <nl> + / / tmp = aa00 aa00 . . . aa00 aa00 <nl> + __ Move ( kScratchDoubleReg , static_cast < uint32_t > ( 0xff00 ) ) ; <nl> + __ vpsllw ( tmp , src , 8 ) ; <nl> + <nl> + / / dst = I16x8ShrS ( src , shift ) <nl> + / / = > SAAa SAAa . . . SAAa SAAa ( shift = 4 ) <nl> + __ vpshuflw ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + __ vpsraw ( dst , src , shift ) ; <nl> + <nl> + / / tmp = I16x8ShrS ( tmp , shift ) <nl> + / / = > Saa0 Saa0 . . . Saa0 Saa0 ( shift = 4 ) <nl> + __ vpshufd ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + __ vpsraw ( tmp , tmp , shift ) ; <nl> + <nl> + / / dst = I16x8And ( dst , 0xff00 ) <nl> + / / = > SA00 SA00 . . . SA00 SA00 <nl> + __ vpand ( dst , dst , kScratchDoubleReg ) ; <nl> + <nl> + / / tmp = I16x8ShrU ( tmp , 8 ) <nl> + / / = > 00Sa 00Sa . . . 00Sa 00Sa ( shift = 4 ) <nl> + __ vpsrlw ( tmp , tmp , 8 ) ; <nl> + <nl> + / / dst = I16x8Or ( dst , tmp ) <nl> + / / = > SASa SASa . . . SASa SASa ( shift = 4 ) <nl> + __ vpor ( dst , dst , tmp ) ; <nl> + break ; <nl> + } <nl> case kSSEI8x16Add : { <nl> DCHECK_EQ ( i . OutputSimd128Register ( ) , i . InputSimd128Register ( 0 ) ) ; <nl> __ paddb ( i . OutputSimd128Register ( ) , i . InputOperand ( 1 ) ) ; <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> i . InputOperand ( 1 ) ) ; <nl> break ; <nl> } <nl> + case kSSEI8x16Mul : { <nl> + DCHECK_EQ ( i . OutputSimd128Register ( ) , i . InputSimd128Register ( 0 ) ) ; <nl> + XMMRegister left = i . InputSimd128Register ( 0 ) ; <nl> + XMMRegister right = i . InputSimd128Register ( 1 ) ; <nl> + XMMRegister t0 = i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + XMMRegister t1 = i . ToSimd128Register ( instr - > TempAt ( 1 ) ) ; <nl> + <nl> + / / I16x8 view of I8x16 <nl> + / / left = AAaa AAaa . . . AAaa AAaa <nl> + / / right = BBbb BBbb . . . BBbb BBbb <nl> + <nl> + / / t0 = 00AA 00AA . . . 00AA 00AA <nl> + / / t1 = 00BB 00BB . . . 00BB 00BB <nl> + __ movaps ( t0 , left ) ; <nl> + __ movaps ( t1 , right ) ; <nl> + __ Move ( kScratchDoubleReg , static_cast < uint32_t > ( 0x00ff ) ) ; <nl> + __ psrlw ( t0 , 8 ) ; <nl> + __ psrlw ( t1 , 8 ) ; <nl> + <nl> + / / left = I16x8Mul ( left , right ) <nl> + / / = > __pp __pp . . . __pp __pp <nl> + / / t0 = I16x8Mul ( t0 , t1 ) <nl> + / / = > __PP __PP . . . __PP __PP <nl> + __ pshuflw ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + __ pmullw ( t0 , t1 ) ; <nl> + __ pmullw ( left , right ) ; <nl> + __ pshufd ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + <nl> + / / t0 = I16x8Shl ( t0 , 8 ) <nl> + / / = > PP00 PP00 . . . PP00 PP00 <nl> + __ psllw ( t0 , 8 ) ; <nl> + <nl> + / / left = I16x8And ( left , 0x00ff ) <nl> + / / = > 00pp 00pp . . . 00pp 00pp <nl> + __ pand ( left , kScratchDoubleReg ) ; <nl> + <nl> + / / left = I16x8Or ( left , t0 ) <nl> + / / = > PPpp PPpp . . . PPpp PPpp <nl> + __ por ( left , t0 ) ; <nl> + break ; <nl> + } <nl> + case kAVXI8x16Mul : { <nl> + CpuFeatureScope avx_scope ( tasm ( ) , AVX ) ; <nl> + XMMRegister dst = i . OutputSimd128Register ( ) ; <nl> + XMMRegister left = i . InputSimd128Register ( 0 ) ; <nl> + XMMRegister right = i . InputSimd128Register ( 1 ) ; <nl> + XMMRegister t0 = i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + XMMRegister t1 = i . ToSimd128Register ( instr - > TempAt ( 1 ) ) ; <nl> + <nl> + / / I16x8 view of I8x16 <nl> + / / left = AAaa AAaa . . . AAaa AAaa <nl> + / / right = BBbb BBbb . . . BBbb BBbb <nl> + <nl> + / / t0 = 00AA 00AA . . . 00AA 00AA <nl> + / / t1 = 00BB 00BB . . . 00BB 00BB <nl> + __ Move ( kScratchDoubleReg , static_cast < uint32_t > ( 0x00ff ) ) ; <nl> + __ vpsrlw ( t0 , left , 8 ) ; <nl> + __ vpsrlw ( t1 , right , 8 ) ; <nl> + <nl> + / / dst = I16x8Mul ( left , right ) <nl> + / / = > __pp __pp . . . __pp __pp <nl> + __ vpshuflw ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + __ vpmullw ( dst , left , right ) ; <nl> + <nl> + / / t0 = I16x8Mul ( t0 , t1 ) <nl> + / / = > __PP __PP . . . __PP __PP <nl> + __ vpmullw ( t0 , t0 , t1 ) ; <nl> + __ vpshufd ( kScratchDoubleReg , kScratchDoubleReg , 0x0 ) ; <nl> + <nl> + / / t0 = I16x8Shl ( t0 , 8 ) <nl> + / / = > PP00 PP00 . . . PP00 PP00 <nl> + __ vpsllw ( t0 , t0 , 8 ) ; <nl> + <nl> + / / dst = I16x8And ( dst , 0x00ff ) <nl> + / / = > 00pp 00pp . . . 00pp 00pp <nl> + __ vpand ( dst , dst , kScratchDoubleReg ) ; <nl> + <nl> + / / dst = I16x8Or ( dst , t0 ) <nl> + / / = > PPpp PPpp . . . PPpp PPpp <nl> + __ vpor ( dst , dst , t0 ) ; <nl> + break ; <nl> + } <nl> case kSSEI8x16MinS : { <nl> DCHECK_EQ ( i . OutputSimd128Register ( ) , i . InputSimd128Register ( 0 ) ) ; <nl> CpuFeatureScope sse_scope ( tasm ( ) , SSE4_1 ) ; <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> i . InputOperand ( 1 ) ) ; <nl> break ; <nl> } <nl> + case kSSEI8x16ShrU : { <nl> + DCHECK_EQ ( i . OutputSimd128Register ( ) , i . InputSimd128Register ( 0 ) ) ; <nl> + XMMRegister src = i . InputSimd128Register ( 0 ) ; <nl> + int8_t shift = i . InputInt8 ( 1 ) & 0x7 ; <nl> + XMMRegister tmp = i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + <nl> + / / src = AAaa . . . AAaa <nl> + / / tmp = F0F0 . . . F0F0 ( shift = 4 ) <nl> + <nl> + I8x16_SPLAT ( tmp , kScratchDoubleReg , 0xFFU < < shift ) ; / / needn ' t byte cast <nl> + <nl> + / / src = src & tmp <nl> + / / = > A0a0 . . . A0a0 <nl> + __ pand ( src , tmp ) ; <nl> + <nl> + / / src = src > > shift <nl> + / / = > 0A0a . . . 0A0a ( shift = 4 ) <nl> + __ psrld ( src , shift ) ; <nl> + break ; <nl> + } <nl> + case kAVXI8x16ShrU : { <nl> + CpuFeatureScope avx_scope ( tasm ( ) , AVX ) ; <nl> + XMMRegister dst = i . OutputSimd128Register ( ) ; <nl> + XMMRegister src = i . InputSimd128Register ( 0 ) ; <nl> + int8_t shift = i . InputInt8 ( 1 ) & 0x7 ; <nl> + XMMRegister tmp = <nl> + dst ! = src ? dst : i . ToSimd128Register ( instr - > TempAt ( 0 ) ) ; <nl> + <nl> + / / src = AAaa . . . AAaa <nl> + / / tmp = F0F0 . . . F0F0 ( shift = 4 ) <nl> + I8x16_SPLAT ( tmp , kScratchDoubleReg , 0xFFU < < shift ) ; <nl> + <nl> + / / src = src & tmp <nl> + / / = > A0a0 . . . A0a0 <nl> + __ vpand ( dst , src , tmp ) ; <nl> + <nl> + / / dst = dst > > shift <nl> + / / = > 0A0a . . . 0A0a ( shift = 4 ) <nl> + __ vpsrld ( dst , dst , shift ) ; <nl> + break ; <nl> + } <nl> + # undef I8x16_SPLAT <nl> case kSSEI8x16MinU : { <nl> DCHECK_EQ ( i . OutputSimd128Register ( ) , i . InputSimd128Register ( 0 ) ) ; <nl> __ pminub ( i . OutputSimd128Register ( ) , i . InputOperand ( 1 ) ) ; <nl> mmm a / src / compiler / ia32 / instruction - codes - ia32 . h <nl> ppp b / src / compiler / ia32 / instruction - codes - ia32 . h <nl> namespace compiler { <nl> V ( IA32I8x16ExtractLane ) \ <nl> V ( SSEI8x16ReplaceLane ) \ <nl> V ( AVXI8x16ReplaceLane ) \ <nl> + V ( SSEI8x16Shl ) \ <nl> + V ( AVXI8x16Shl ) \ <nl> + V ( SSEI8x16ShrS ) \ <nl> + V ( AVXI8x16ShrS ) \ <nl> V ( IA32I8x16Neg ) \ <nl> V ( SSEI8x16Add ) \ <nl> V ( AVXI8x16Add ) \ <nl> namespace compiler { <nl> V ( AVXI8x16Sub ) \ <nl> V ( SSEI8x16SubSaturateS ) \ <nl> V ( AVXI8x16SubSaturateS ) \ <nl> + V ( SSEI8x16Mul ) \ <nl> + V ( AVXI8x16Mul ) \ <nl> V ( SSEI8x16MinS ) \ <nl> V ( AVXI8x16MinS ) \ <nl> V ( SSEI8x16MaxS ) \ <nl> namespace compiler { <nl> V ( AVXI8x16AddSaturateU ) \ <nl> V ( SSEI8x16SubSaturateU ) \ <nl> V ( AVXI8x16SubSaturateU ) \ <nl> + V ( SSEI8x16ShrU ) \ <nl> + V ( AVXI8x16ShrU ) \ <nl> V ( SSEI8x16MinU ) \ <nl> V ( AVXI8x16MinU ) \ <nl> V ( SSEI8x16MaxU ) \ <nl> mmm a / src / compiler / ia32 / instruction - scheduler - ia32 . cc <nl> ppp b / src / compiler / ia32 / instruction - scheduler - ia32 . cc <nl> int InstructionScheduler : : GetTargetInstructionFlags ( <nl> case kSSEI8x16ReplaceLane : <nl> case kAVXI8x16ReplaceLane : <nl> case kIA32I8x16Neg : <nl> + case kSSEI8x16Shl : <nl> + case kAVXI8x16Shl : <nl> + case kSSEI8x16ShrS : <nl> + case kAVXI8x16ShrS : <nl> case kSSEI8x16Add : <nl> case kAVXI8x16Add : <nl> case kSSEI8x16AddSaturateS : <nl> int InstructionScheduler : : GetTargetInstructionFlags ( <nl> case kAVXI8x16Sub : <nl> case kSSEI8x16SubSaturateS : <nl> case kAVXI8x16SubSaturateS : <nl> + case kSSEI8x16Mul : <nl> + case kAVXI8x16Mul : <nl> case kSSEI8x16MinS : <nl> case kAVXI8x16MinS : <nl> case kSSEI8x16MaxS : <nl> int InstructionScheduler : : GetTargetInstructionFlags ( <nl> case kAVXI8x16AddSaturateU : <nl> case kSSEI8x16SubSaturateU : <nl> case kAVXI8x16SubSaturateU : <nl> + case kSSEI8x16ShrU : <nl> + case kAVXI8x16ShrU : <nl> case kSSEI8x16MinU : <nl> case kAVXI8x16MinU : <nl> case kSSEI8x16MaxU : <nl> mmm a / src / compiler / ia32 / instruction - selector - ia32 . cc <nl> ppp b / src / compiler / ia32 / instruction - selector - ia32 . cc <nl> void VisitFloatUnop ( InstructionSelector * selector , Node * node , Node * input , <nl> } <nl> } <nl> <nl> + void VisitRRISimd ( InstructionSelector * selector , Node * node , <nl> + ArchOpcode avx_opcode , ArchOpcode sse_opcode ) { <nl> + IA32OperandGenerator g ( selector ) ; <nl> + InstructionOperand operand0 = g . UseRegister ( node - > InputAt ( 0 ) ) ; <nl> + InstructionOperand operand1 = g . UseImmediate ( OpParameter < int32_t > ( node ) ) ; <nl> + InstructionOperand temps [ ] = { g . TempSimd128Register ( ) } ; <nl> + if ( selector - > IsSupported ( AVX ) ) { <nl> + selector - > Emit ( avx_opcode , g . DefineAsRegister ( node ) , operand0 , operand1 , <nl> + arraysize ( temps ) , temps ) ; <nl> + } else { <nl> + selector - > Emit ( sse_opcode , g . DefineSameAsFirst ( node ) , operand0 , operand1 , <nl> + arraysize ( temps ) , temps ) ; <nl> + } <nl> + } <nl> <nl> } / / namespace <nl> <nl> void InstructionSelector : : VisitF32x4ExtractLane ( Node * node ) { <nl> } <nl> } <nl> <nl> + # define SIMD_I8X16_SHIFT_OPCODES ( V ) \ <nl> + V ( I8x16Shl ) \ <nl> + V ( I8x16ShrS ) \ <nl> + V ( I8x16ShrU ) <nl> + <nl> + # define VISIT_SIMD_I8X16_SHIFT ( Op ) \ <nl> + void InstructionSelector : : Visit # # Op ( Node * node ) { \ <nl> + VisitRRISimd ( this , node , kAVX # # Op , kSSE # # Op ) ; \ <nl> + } <nl> + <nl> + SIMD_I8X16_SHIFT_OPCODES ( VISIT_SIMD_I8X16_SHIFT ) <nl> + # undef SIMD_I8X16_SHIFT_OPCODES <nl> + # undef VISIT_SIMD_I8X16_SHIFT <nl> + <nl> + void InstructionSelector : : VisitI8x16Mul ( Node * node ) { <nl> + IA32OperandGenerator g ( this ) ; <nl> + InstructionOperand operand0 = g . UseRegister ( node - > InputAt ( 0 ) ) ; <nl> + InstructionOperand operand1 = g . UseRegister ( node - > InputAt ( 1 ) ) ; <nl> + InstructionOperand temps [ ] = { g . TempSimd128Register ( ) , <nl> + g . TempSimd128Register ( ) } ; <nl> + if ( IsSupported ( AVX ) ) { <nl> + Emit ( kAVXI8x16Mul , g . DefineAsRegister ( node ) , operand0 , operand1 , <nl> + arraysize ( temps ) , temps ) ; <nl> + } else { <nl> + Emit ( kSSEI8x16Mul , g . DefineSameAsFirst ( node ) , operand0 , operand1 , <nl> + arraysize ( temps ) , temps ) ; <nl> + } <nl> + } <nl> + <nl> void InstructionSelector : : VisitS128Zero ( Node * node ) { <nl> IA32OperandGenerator g ( this ) ; <nl> Emit ( kIA32S128Zero , g . DefineAsRegister ( node ) ) ; <nl> } <nl> <nl> - <nl> # define VISIT_SIMD_SPLAT ( Type ) \ <nl> void InstructionSelector : : Visit # # Type # # Splat ( Node * node ) { \ <nl> VisitRO ( this , node , kIA32 # # Type # # Splat ) ; \ <nl> mmm a / src / compiler / instruction - selector - impl . h <nl> ppp b / src / compiler / instruction - selector - impl . h <nl> class OperandGenerator { <nl> return op ; <nl> } <nl> <nl> + InstructionOperand TempSimd128Register ( ) { <nl> + UnallocatedOperand op = UnallocatedOperand ( <nl> + UnallocatedOperand : : MUST_HAVE_REGISTER , <nl> + UnallocatedOperand : : USED_AT_START , sequence ( ) - > NextVirtualRegister ( ) ) ; <nl> + sequence ( ) - > MarkAsRepresentation ( MachineRepresentation : : kSimd128 , <nl> + op . virtual_register ( ) ) ; <nl> + return op ; <nl> + } <nl> + <nl> InstructionOperand TempRegister ( Register reg ) { <nl> return UnallocatedOperand ( UnallocatedOperand : : FIXED_REGISTER , reg . code ( ) , <nl> InstructionOperand : : kInvalidVirtualRegister ) ; <nl> mmm a / src / compiler / instruction - selector . cc <nl> ppp b / src / compiler / instruction - selector . cc <nl> void InstructionSelector : : VisitI16x8UConvertI8x16High ( Node * node ) { <nl> UNIMPLEMENTED ( ) ; <nl> } <nl> <nl> - void InstructionSelector : : VisitI8x16Shl ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> - <nl> - void InstructionSelector : : VisitI8x16ShrS ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> - <nl> void InstructionSelector : : VisitI8x16SConvertI16x8 ( Node * node ) { <nl> UNIMPLEMENTED ( ) ; <nl> } <nl> <nl> - void InstructionSelector : : VisitI8x16Mul ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> - <nl> - void InstructionSelector : : VisitI8x16ShrU ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> - <nl> void InstructionSelector : : VisitI8x16UConvertI16x8 ( Node * node ) { <nl> UNIMPLEMENTED ( ) ; <nl> } <nl> # endif / / ! V8_TARGET_ARCH_ARM & & ! V8_TARGET_ARCH_ARM64 & & ! V8_TARGET_ARCH_MIPS <nl> / / & & ! V8_TARGET_ARCH_MIPS64 <nl> <nl> + # if ! V8_TARGET_ARCH_ARM & & ! V8_TARGET_ARCH_ARM64 & & ! V8_TARGET_ARCH_MIPS & & \ <nl> + ! V8_TARGET_ARCH_MIPS64 & & ! V8_TARGET_ARCH_IA32 <nl> + void InstructionSelector : : VisitI8x16Shl ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> + void InstructionSelector : : VisitI8x16ShrS ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> + void InstructionSelector : : VisitI8x16ShrU ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + <nl> + void InstructionSelector : : VisitI8x16Mul ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> + # endif / / ! V8_TARGET_ARCH_ARM & & ! V8_TARGET_ARCH_ARM64 & & ! V8_TARGET_ARCH_MIPS <nl> + / / & & ! V8_TARGET_ARCH_MIPS64 & & ! V8_TARGET_ARCH_IA32 <nl> + <nl> # if ! V8_TARGET_ARCH_ARM & & ! V8_TARGET_ARCH_ARM64 & & ! V8_TARGET_ARCH_X64 & & \ <nl> ! V8_TARGET_ARCH_MIPS & & ! V8_TARGET_ARCH_MIPS64 <nl> void InstructionSelector : : VisitS128Select ( Node * node ) { UNIMPLEMENTED ( ) ; } <nl> mmm a / src / ia32 / macro - assembler - ia32 . cc <nl> ppp b / src / ia32 / macro - assembler - ia32 . cc <nl> void TurboAssembler : : Move ( XMMRegister dst , uint64_t src ) { <nl> push ( eax ) ; <nl> Move ( eax , Immediate ( lower ) ) ; <nl> movd ( dst , Operand ( eax ) ) ; <nl> - Move ( eax , Immediate ( upper ) ) ; <nl> + if ( upper ! = lower ) { <nl> + Move ( eax , Immediate ( upper ) ) ; <nl> + } <nl> pinsrd ( dst , Operand ( eax ) , 1 ) ; <nl> pop ( eax ) ; <nl> } else { <nl> mmm a / test / cctest / wasm / test - run - wasm - simd . cc <nl> ppp b / test / cctest / wasm / test - run - wasm - simd . cc <nl> WASM_SIMD_TEST ( I8x16LeU ) { <nl> } <nl> <nl> # if V8_TARGET_ARCH_ARM | | V8_TARGET_ARCH_ARM64 | | V8_TARGET_ARCH_MIPS | | \ <nl> - V8_TARGET_ARCH_MIPS64 <nl> + V8_TARGET_ARCH_MIPS64 | | V8_TARGET_ARCH_IA32 <nl> WASM_SIMD_TEST ( I8x16Mul ) { RunI8x16BinOpTest ( lower_simd , kExprI8x16Mul , Mul ) ; } <nl> # endif / / V8_TARGET_ARCH_ARM | | V8_TARGET_ARCH_ARM64 | | V8_TARGET_ARCH_MIPS | | <nl> - / / V8_TARGET_ARCH_MIPS64 <nl> + / / V8_TARGET_ARCH_MIPS64 | | V8_TARGET_ARCH_IA32 <nl> <nl> void RunI8x16ShiftOpTest ( LowerSimd lower_simd , WasmOpcode simd_op , <nl> Int8ShiftOp expected_op , int shift ) { <nl> void RunI8x16ShiftOpTest ( LowerSimd lower_simd , WasmOpcode simd_op , <nl> } <nl> <nl> # if V8_TARGET_ARCH_ARM | | V8_TARGET_ARCH_ARM64 | | V8_TARGET_ARCH_MIPS | | \ <nl> - V8_TARGET_ARCH_MIPS64 <nl> + V8_TARGET_ARCH_MIPS64 | | V8_TARGET_ARCH_IA32 <nl> WASM_SIMD_TEST ( I8x16Shl ) { <nl> RunI8x16ShiftOpTest ( lower_simd , kExprI8x16Shl , LogicalShiftLeft , 1 ) ; <nl> } <nl> WASM_SIMD_TEST ( I8x16ShrU ) { <nl> RunI8x16ShiftOpTest ( lower_simd , kExprI8x16ShrU , LogicalShiftRight , 1 ) ; <nl> } <nl> # endif / / V8_TARGET_ARCH_ARM | | V8_TARGET_ARCH_ARM64 | | V8_TARGET_ARCH_MIPS | | <nl> - / / V8_TARGET_ARCH_MIPS64 <nl> + / / V8_TARGET_ARCH_MIPS64 | | V8_TARGET_ARCH_IA32 <nl> <nl> # if V8_TARGET_ARCH_ARM | | V8_TARGET_ARCH_ARM64 | | V8_TARGET_ARCH_X64 | | \ <nl> V8_TARGET_ARCH_MIPS | | V8_TARGET_ARCH_MIPS64 <nl>
|
[ ia32 ] [ wasm ] Add I8x16 ShiftOp and MulOp .
|
v8/v8
|
a56d9349a15a595153fda9ede8a80f1c7ab28ed2
|
2018-01-30T04:06:35Z
|
mmm a / bindings / python / cntk / blocks . py <nl> ppp b / bindings / python / cntk / blocks . py <nl> <nl> # _trace_layers = True # uncomment this to log creation of graph through layers <nl> <nl> _default_initializer = glorot_uniform ( ) <nl> + _Inferred = ( InferredDimension , ) # as a tuple , makes life easier <nl> <nl> def UntestedBranchError ( name ) : <nl> # pass <nl> def LSTM ( shape , cell_shape = None , use_peepholes = False , init = _default_initializer , <nl> cell_shape_stacked = tuple ( cell_shape_list ) # patched dims with stack_axis duplicated 4 times <nl> <nl> # parameters <nl> - b = Parameter ( cell_shape_stacked , init = init_bias , name = ' b ' ) # a bias <nl> - W = Parameter ( ( InferredDimension , ) + cell_shape_stacked , init = init , name = ' W ' ) # input <nl> - A = Parameter ( ( InferredDimension , ) + cell_shape_stacked , init = init , name = ' A ' ) if has_aux else None # aux input ( optional ) <nl> - H = Parameter ( shape + cell_shape_stacked , init = init , name = ' H ' ) # hidden - to - hidden <nl> - Ci = Parameter ( cell_shape , init = init , name = ' Ci ' ) if use_peepholes else None # cell - to - hiddden { note : applied elementwise } <nl> - Cf = Parameter ( cell_shape , init = init , name = ' Cf ' ) if use_peepholes else None # cell - to - hiddden { note : applied elementwise } <nl> - Co = Parameter ( cell_shape , init = init , name = ' Co ' ) if use_peepholes else None # cell - to - hiddden { note : applied elementwise } <nl> + b = Parameter ( cell_shape_stacked , init = init_bias , name = ' b ' ) # a bias <nl> + W = Parameter ( _Inferred + cell_shape_stacked , init = init , name = ' W ' ) # input <nl> + A = Parameter ( _Inferred + cell_shape_stacked , init = init , name = ' A ' ) if has_aux else None # aux input ( optional ) <nl> + H = Parameter ( shape + cell_shape_stacked , init = init , name = ' H ' ) # hidden - to - hidden <nl> + Ci = Parameter ( cell_shape , init = init , name = ' Ci ' ) if use_peepholes else None # cell - to - hiddden { note : applied elementwise } <nl> + Cf = Parameter ( cell_shape , init = init , name = ' Cf ' ) if use_peepholes else None # cell - to - hiddden { note : applied elementwise } <nl> + Co = Parameter ( cell_shape , init = init , name = ' Co ' ) if use_peepholes else None # cell - to - hiddden { note : applied elementwise } <nl> <nl> Wmr = ParameterTensor ( cell_shape + shape , init = init , init_value_scale = init_value_scale ) if has_projection else None # final projection <nl> <nl> mmm a / bindings / python / cntk / layers . py <nl> ppp b / bindings / python / cntk / layers . py <nl> <nl> from cntk . blocks import * # TODO : reduce to what we actually use <nl> from cntk . blocks import _extend_Function , _name_and_extend_Function , _wrap_rename_Function , _trace_layers # ( debugging ) <nl> from cntk . initializer import glorot_uniform <nl> - from _cntk_py import InferredDimension <nl> <nl> abs_path = os . path . dirname ( os . path . abspath ( __file__ ) ) <nl> sys . path . append ( os . path . join ( abs_path , " . . " , " . . " ) ) <nl> <nl> from cntk . ops . variables import Variable <nl> <nl> # this is what we initialize weight matrices from by default <nl> - from cntk . blocks import _default_initializer <nl> + from cntk . blocks import _default_initializer , _Inferred <nl> <nl> # Dense - - create a fully - connected linear projection layer with optional non - linear activation <nl> # Note : shape may describe a tensor as well . <nl> - # TODO : change to new random - init descriptor <nl> - # inputRank given : number of zeroes to add to W ( mapRank must not be given ) <nl> - # mapRank given : expand W to leave exactly mapRank axes ( inputRank must not be given ) <nl> - # none given : expand W to all ( same as mapRank = 0 ) <nl> + # input_rank given : number of inferred axes to add to W ( map_rank must not be given ) <nl> + # map_rank given : expand W to leave exactly mapRank axes ( input_rank must not be given ) <nl> + # none given : expand W to all ( same as map_rank = 0 ) <nl> def Dense ( shape , init = _default_initializer , activation = identity , input_rank = None , map_rank = None , bias = True , init_bias = 0 ) : <nl> - out_shape = _as_tuple ( shape ) <nl> + output_shape = _as_tuple ( shape ) <nl> + <nl> + if input_rank is not None and map_rank is not None : <nl> + raise ValueError ( " Dense : input_rank and map_rank cannot be specified at the same time . " ) <nl> + <nl> + # determine meaning of axes <nl> + # W gets dimension ( input_shape + shape ) <nl> + # where input_shape is determined as : <nl> + # - by default , equal to the dimensions of the input passed to Dense ( ) <nl> + # - if input_rank is given , then the last ' input_rank ' dimensions of the input <nl> + # - if map_rank is given , then the first ' map_rank ' dimensions of the input <nl> + # where input_rank and map_rank are mutuallly exclusive . <nl> + output_rank = len ( output_shape ) # support outputs with tensor layouts <nl> + <nl> + # If input_rank not given then pass a single _Inferred ; map_rank if given will determine the input_rank . <nl> + # The dimension inference may still create multiple axes . <nl> + input_shape = _Inferred * ( input_rank if input_rank is not None else 1 ) <nl> <nl> if input_rank is not None : <nl> UntestedBranchError ( " Dense , input_rank option not implemented " ) <nl> - if map_rank is not None : <nl> + infer_input_rank_to_map = - 1 # means map_rank is not specified ; input_rank rules <nl> + elif map_rank is None : <nl> + infer_input_rank_to_map = 0 # neither given : default to ' infer W to use all input dims ' <nl> + else : <nl> UntestedBranchError ( " Dense , map_rank option not implemented " ) <nl> - # TODO : implement the full semantics of the BrainScript code <nl> - # inputShape = <nl> - # if BS . Constants . IsNone ( inputRank ) then Inferred # not given : one Inferred , which will get expanded <nl> - # else if ! BS . Constants . IsNone ( mapRank ) then Fail ( " ' inputRank ' and ' mapRank ' cannot be specified at the same time . " ) <nl> - # else Repeat ( inputRank , Inferred ) <nl> - # W = ParameterTensor { _ConcatArrays ( outDim , inputShape ) , init = init , initValueScale = initValueScale } <nl> - # b = ParameterTensor { outDim , initValue = 0 } <nl> - # outputRank = Length ( _AsArray ( outDim ) ) # support outputs with tensor layouts <nl> - # inferInputRankToMap = <nl> - # if ! BS . Constants . IsNone ( inputRank ) then - 1 # means not specified <nl> - # else if BS . Constants . IsNone ( mapRank ) then 0 # default to ' use all input dims ' <nl> - # else mapRank <nl> - # apply ( x ) = <nl> - # if bias <nl> - # then Times ( W , x , outputRank = outputRank , inferInputRankToMap = inferInputRankToMap ) + b <nl> - # else Times ( W , x , outputRank = outputRank , inferInputRankToMap = inferInputRankToMap ) <nl> + infer_input_rank_to_map = map_rank # infer W to use all input dims except the last ' map_rank ' ones <nl> <nl> - # TODO : change InferredDimension to a tuple <nl> - W = Parameter ( ( InferredDimension , ) + out_shape , init = init , name = ' W ' ) <nl> - b = Parameter ( out_shape , init = init_bias , name = ' b ' ) if bias else None <nl> + # parameters bound to this Function <nl> + W = Parameter ( input_shape + output_shape , init = init , name = ' W ' ) <nl> + b = Parameter ( output_shape , init = init_bias , name = ' b ' ) if bias else None <nl> + <nl> + # expression of this function <nl> x = Placeholder ( name = ' dense_arg ' ) <nl> - apply_x = Function . __matmul__ ( x , W ) + b if bias else \ <nl> - Function . __matmul__ ( x , W ) <nl> + apply_x = times ( x , W , output_rank = output_rank , infer_input_rank_to_map = infer_input_rank_to_map ) <nl> + if b : <nl> + apply_x = apply_x + b <nl> _extend_Function ( apply_x ) # ( this gets us the > > operator - - TODO : remove once Function natively supports this ) <nl> apply_x = apply_x > > activation <nl> _name_and_extend_Function ( apply_x , ' Dense ' ) <nl> return apply_x <nl> - # TODO : how to break after the else ? <nl> - <nl> - # def Dense ( shape , _inf , init = _default_initializer , activation = None , input_rank = None , map_rank = None , bias = True , init_bias = 0 ) : <nl> - # if activation is None : # TODO : change default to identity once we no longer need _inf <nl> - # activation = Identity ( _inf = shape ) <nl> - # apply_x = Linear ( shape , _inf , bias = bias , init = init , init_bias = init_bias , input_rank = input_rank , map_rank = map_rank ) \ <nl> - # > > activation <nl> - # # TODO : Any way to do some similar pattern ^ ^ without backslash ? <nl> - # # TODO : merge _Linear ( ) into here <nl> - # _name_and_extend_Function ( apply_x , ' Dense ' ) <nl> - # return apply_x <nl> <nl> # Embedding - - create a linear embedding layer <nl> - # TODO : after removing loading from file , now we have two similar params , weight and init which seems redundant . <nl> - # TODO : Once _inf is gone , change interface to pass weights as a Constant , e . g . <nl> - # Embedding ( shape , constant ( np . load ( ' PATH ' ) ) ) <nl> - # Not nice since now we don ' t need the output shape either . Grmpf . <nl> - def Embedding ( shape , weights = None , init = _default_initializer , transpose = False ) : <nl> + # To create an embedding from a file , use this : <nl> + # Embedding ( shape , Constant ( np . load ( ' PATH ' ) ) ) <nl> + # TODO : remove shape in case of Constant <nl> + def Embedding ( shape , init = _default_initializer , transpose = False ) : <nl> shape = _as_tuple ( shape ) <nl> + weights = None # TODO : finish the Constant ( ) thing <nl> if weights is None : # no weights given : learn the embedding <nl> - full_shape = ( InferredDimension , ) + shape <nl> + full_shape = _Inferred + shape <nl> E = Parameter ( full_shape , init = init , name = ' E ' ) <nl> else : # weights given : use them as constant <nl> UntestedBranchError ( " Embedding , from constant " ) <nl> # TODO : infer full_shape from weights ? Which in turn should be a constant . . . lots of TODO here <nl> - full_shape = ( shape + ( InferredDimension , ) ) if transpose else ( ( InferredDimension , ) + shape ) <nl> + full_shape = ( shape + _Inferred ) if transpose else ( _Inferred + shape ) <nl> E = Constant ( full_shape , init = weights , name = ' E ' ) # TODO : can ' weights ' be a CNTK object already ? Then how to do this ? <nl> x = Placeholder ( name = ' embedding_arg ' ) <nl> apply_x = Function . __matmul__ ( E , x ) if transpose else \ <nl>
|
updated layers . Dense ( ) to full semantics of core . bs
|
microsoft/CNTK
|
605dcd9ab1c1a2568667461f6489c4880aa8e209
|
2016-10-18T18:42:36Z
|
mmm a / doc / release - process . md <nl> ppp b / doc / release - process . md <nl> repackage gitian builds for release as stand - alone zip / tar / installer exe <nl> <nl> * update bitcoin . org version <nl> make sure all OS download links go to the right versions <nl> + <nl> + * update download sizes on bitcoin . org / _templates / download . html <nl> <nl> * update forum version <nl> <nl>
|
Merge pull request from Michagogo / release - process - binary - sizes
|
bitcoin/bitcoin
|
5235db2c1e0329ad20506815eed953faafd82f17
|
2013-11-18T08:24:58Z
|
mmm a / ios / sdk / WeexSDK / Sources / Component / WXRichText . mm <nl> ppp b / ios / sdk / WeexSDK / Sources / Component / WXRichText . mm <nl> - ( instancetype ) initWithRef : ( NSString * ) ref <nl> - ( void ) fillAttributes : ( NSDictionary * ) attributes <nl> { <nl> id value = attributes [ @ " value " ] ; <nl> + if ( [ value isKindOfClass : [ NSString class ] ] ) { <nl> + value = [ WXUtility objectFromJSON : value ] ; <nl> + } <nl> if ( [ value isKindOfClass : [ NSArray class ] ] ) { <nl> [ _richNodes removeAllObjects ] ; <nl> <nl>
|
[ iOS ] fix richtext show error on eagle
|
apache/incubator-weex
|
67cb4e4ae67b4b55c704ece8fc79e4b704d766dd
|
2019-04-09T02:16:58Z
|
mmm a / src / core / ext / transport / chttp2 / transport / frame_data . c <nl> ppp b / src / core / ext / transport / chttp2 / transport / frame_data . c <nl> grpc_chttp2_parse_error grpc_chttp2_data_parser_parse ( <nl> case GRPC_CHTTP2_DATA_ERROR : <nl> p - > state = GRPC_CHTTP2_DATA_ERROR ; <nl> return GRPC_CHTTP2_STREAM_ERROR ; <nl> - fh_0 : <nl> + fh_0 : <nl> case GRPC_CHTTP2_DATA_FH_0 : <nl> stream_parsing - > stats . incoming . framing_bytes + + ; <nl> p - > frame_type = * cur ; <nl>
|
clang - fmt
|
grpc/grpc
|
b1820661690fc11ca07f7f18e1e81c8df75ba70f
|
2016-04-07T00:20:02Z
|
mmm a / AirLib / include / vehicles / multirotor / firmwares / simple_flight / firmware / AdaptiveController . hpp <nl> ppp b / AirLib / include / vehicles / multirotor / firmwares / simple_flight / firmware / AdaptiveController . hpp <nl> class AdaptiveController : public IController { <nl> <nl> / / bias modification for level imu implementing deadband <nl> <nl> - if ( abs ( phi_in ) < = 0 . 0001 ) <nl> + if ( std : : abs ( phi_in ) < = 0 . 0001 ) <nl> phi_in = 0 ; <nl> <nl> - if ( abs ( theta_in ) < = 0 . 00001 ) <nl> + if ( std : : abs ( theta_in ) < = 0 . 00001 ) <nl> theta_in = 0 ; <nl> <nl> - if ( abs ( psi_in ) < = 0 . 0001 ) <nl> + if ( std : : abs ( psi_in ) < = 0 . 0001 ) <nl> psi_in = 0 ; <nl> } <nl> <nl> class AdaptiveController : public IController { <nl> <nl> / / Rescale such that the outputs normalize from - 1 , 1 <nl> <nl> - U1 = sqrt ( abs ( U1 ) ) / 6 . 20 ; / / I used sqrt to try and allow for smoother signal <nl> + U1 = sqrt ( std : : abs ( U1 ) ) / 6 . 20 ; / / I used sqrt to try and allow for smoother signal <nl> <nl> U2 = U2 / 80 ; <nl> <nl> class AdaptiveController : public IController { <nl> <nl> <nl> } <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl>
|
Merge pull request from KazW / bug / xcode_8 . 3 . x_compile_errors
|
microsoft/AirSim
|
4526689131832c8cec22b4a3267a00b73decdb86
|
2018-03-26T08:15:19Z
|
mmm a / buildscripts / resmokeconfig / suites / sharding_continuous_config_stepdown . yml <nl> ppp b / buildscripts / resmokeconfig / suites / sharding_continuous_config_stepdown . yml <nl> selector : <nl> - jstests / sharding / out_fails_to_replace_sharded_collection . js <nl> - jstests / sharding / out_stale_unique_key . js <nl> - jstests / sharding / out_unique_key_requires_index . js <nl> + # In this suite the cluster may end up in a state where each shard believes the <nl> + # collection is sharded and the mongos believes it is unsharded . $ out is not <nl> + # prepared to work correctly in this situation . This should be fixed by a future <nl> + # improvement in sharding infrastructure , and can be unblacklisted by SERVER - 40172 . <nl> + - jstests / sharding / out_to_existing . js <nl> <nl> executor : <nl> config : <nl>
|
SERVER - 39781 Blacklist out_to_existing . js from continuous_config_stepdown
|
mongodb/mongo
|
c90d961fbe008f81455ceaf53a4c8284eb76bbc5
|
2019-03-18T16:51:05Z
|
mmm a / Telegram / SourceFiles / base / qthelp_url . cpp <nl> ppp b / Telegram / SourceFiles / base / qthelp_url . cpp <nl> QMap < QString , QString > url_parse_params ( <nl> return result ; <nl> } <nl> <nl> + bool is_ipv6 ( const QString & ip ) { <nl> + / / static const auto regexp = QRegularExpression ( " ^ [ a - fA - F0 - 9 : ] + $ " ) ; <nl> + / / return regexp . match ( ip ) . hasMatch ( ) ; <nl> + return ip . indexOf ( ' : ' ) > = 0 ; <nl> + } <nl> + <nl> } / / namespace qthelp <nl> mmm a / Telegram / SourceFiles / base / qthelp_url . h <nl> ppp b / Telegram / SourceFiles / base / qthelp_url . h <nl> enum class UrlParamNameTransform { <nl> / / Parses a string like " p1 = v1 & p2 = v2 & . . & pn = vn " to a map . <nl> QMap < QString , QString > url_parse_params ( const QString & params , UrlParamNameTransform transform = UrlParamNameTransform : : NoTransform ) ; <nl> <nl> + bool is_ipv6 ( const QString & ip ) ; <nl> + <nl> } / / namespace qthelp <nl> mmm a / Telegram / SourceFiles / base / timer . cpp <nl> ppp b / Telegram / SourceFiles / base / timer . cpp <nl> QObject * TimersAdjuster ( ) { <nl> <nl> } / / namespace <nl> <nl> - Timer : : Timer ( base : : lambda < void ( ) > callback ) : QObject ( nullptr ) <nl> + Timer : : Timer ( <nl> + not_null < QThread * > thread , <nl> + base : : lambda < void ( ) > callback ) <nl> + : Timer ( std : : move ( callback ) ) { <nl> + moveToThread ( thread ) ; <nl> + } <nl> + <nl> + <nl> + Timer : : Timer ( base : : lambda < void ( ) > callback ) <nl> + : QObject ( nullptr ) <nl> , _callback ( std : : move ( callback ) ) <nl> , _type ( Qt : : PreciseTimer ) <nl> , _adjusted ( false ) { <nl> setRepeat ( Repeat : : Interval ) ; <nl> - connect ( TimersAdjuster ( ) , & QObject : : destroyed , this , [ this ] { adjust ( ) ; } , Qt : : QueuedConnection ) ; <nl> + connect ( <nl> + TimersAdjuster ( ) , <nl> + & QObject : : destroyed , <nl> + this , <nl> + [ this ] { adjust ( ) ; } , <nl> + Qt : : QueuedConnection ) ; <nl> } <nl> <nl> void Timer : : start ( TimeMs timeout , Qt : : TimerType type , Repeat repeat ) { <nl> TimeMs Timer : : remainingTime ( ) const { <nl> <nl> void Timer : : Adjust ( ) { <nl> QObject emitter ; <nl> - connect ( & emitter , & QObject : : destroyed , TimersAdjuster ( ) , & QObject : : destroyed ) ; <nl> + connect ( <nl> + & emitter , <nl> + & QObject : : destroyed , <nl> + TimersAdjuster ( ) , <nl> + & QObject : : destroyed ) ; <nl> } <nl> <nl> void Timer : : adjust ( ) { <nl> void Timer : : adjust ( ) { <nl> <nl> void Timer : : setTimeout ( TimeMs timeout ) { <nl> Expects ( timeout > = 0 & & timeout < = std : : numeric_limits < int > : : max ( ) ) ; <nl> + <nl> _timeout = static_cast < unsigned int > ( timeout ) ; <nl> } <nl> <nl> void Timer : : timerEvent ( QTimerEvent * e ) { <nl> } <nl> } <nl> <nl> - int DelayedCallTimer : : call ( TimeMs timeout , lambda_once < void ( ) > callback , Qt : : TimerType type ) { <nl> + int DelayedCallTimer : : call ( <nl> + TimeMs timeout , <nl> + lambda_once < void ( ) > callback , <nl> + Qt : : TimerType type ) { <nl> Expects ( timeout > = 0 ) ; <nl> + <nl> if ( ! callback ) { <nl> return 0 ; <nl> } <nl> int DelayedCallTimer : : call ( TimeMs timeout , lambda_once < void ( ) > callback , Qt : : Tim <nl> void DelayedCallTimer : : cancel ( int callId ) { <nl> if ( callId ) { <nl> killTimer ( callId ) ; <nl> - _callbacks . erase ( callId ) ; <nl> + _callbacks . remove ( callId ) ; <nl> } <nl> } <nl> <nl> mmm a / Telegram / SourceFiles / base / timer . h <nl> ppp b / Telegram / SourceFiles / base / timer . h <nl> namespace base { <nl> <nl> class Timer final : private QObject { <nl> public : <nl> - Timer ( base : : lambda < void ( ) > callback = base : : lambda < void ( ) > ( ) ) ; <nl> + explicit Timer ( <nl> + not_null < QThread * > thread , <nl> + base : : lambda < void ( ) > callback = nullptr ) ; <nl> + explicit Timer ( base : : lambda < void ( ) > callback = nullptr ) ; <nl> <nl> static Qt : : TimerType DefaultType ( TimeMs timeout ) { <nl> constexpr auto kThreshold = TimeMs ( 1000 ) ; <nl> class Timer final : private QObject { <nl> class DelayedCallTimer final : private QObject { <nl> public : <nl> int call ( TimeMs timeout , lambda_once < void ( ) > callback ) { <nl> - return call ( timeout , std : : move ( callback ) , Timer : : DefaultType ( timeout ) ) ; <nl> + return call ( <nl> + timeout , <nl> + std : : move ( callback ) , <nl> + Timer : : DefaultType ( timeout ) ) ; <nl> } <nl> <nl> - int call ( TimeMs timeout , lambda_once < void ( ) > callback , Qt : : TimerType type ) ; <nl> + int call ( <nl> + TimeMs timeout , <nl> + lambda_once < void ( ) > callback , <nl> + Qt : : TimerType type ) ; <nl> void cancel ( int callId ) ; <nl> <nl> protected : <nl> void timerEvent ( QTimerEvent * e ) override ; <nl> <nl> private : <nl> - std : : map < int , lambda_once < void ( ) > > _callbacks ; / / Better to use flatmap . <nl> + base : : flat_map < int , lambda_once < void ( ) > > _callbacks ; <nl> <nl> } ; <nl> <nl> mmm a / Telegram / SourceFiles / boxes / connection_box . cpp <nl> ppp b / Telegram / SourceFiles / boxes / connection_box . cpp <nl> bool ConnectionBox : : badProxyValue ( ) const { <nl> <nl> void ConnectionBox : : updateControlsVisibility ( ) { <nl> auto newHeight = st : : boxOptionListPadding . top ( ) + _autoRadio - > heightNoMargins ( ) + st : : boxOptionListSkip + _httpProxyRadio - > heightNoMargins ( ) + st : : boxOptionListSkip + _tcpProxyRadio - > heightNoMargins ( ) + st : : boxOptionListSkip + st : : connectionIPv6Skip + _tryIPv6 - > heightNoMargins ( ) + st : : defaultCheckbox . margin . bottom ( ) + st : : boxOptionListPadding . bottom ( ) + st : : boxPadding . bottom ( ) ; <nl> - if ( _typeGroup - > value ( ) = = dbictAuto & & badProxyValue ( ) ) { <nl> + if ( ! proxyFieldsVisible ( ) ) { <nl> _hostInput - > hide ( ) ; <nl> _portInput - > hide ( ) ; <nl> _userInput - > hide ( ) ; <nl> void ConnectionBox : : updateControlsVisibility ( ) { <nl> updateControlsPosition ( ) ; <nl> } <nl> <nl> + bool ConnectionBox : : proxyFieldsVisible ( ) const { <nl> + return ( _typeGroup - > value ( ) ! = dbictAuto ) <nl> + | | ( ! badProxyValue ( ) <nl> + & & ( _currentProxyType = = ProxyData : : Type : : Http <nl> + | | _currentProxyType = = ProxyData : : Type : : Socks5 ) ) ; <nl> + } <nl> + <nl> void ConnectionBox : : setInnerFocus ( ) { <nl> if ( _typeGroup - > value ( ) = = dbictAuto ) { <nl> setFocus ( ) ; <nl> void ConnectionBox : : updateControlsPosition ( ) { <nl> _httpProxyRadio - > moveToLeft ( st : : boxPadding . left ( ) + st : : boxOptionListPadding . left ( ) , _autoRadio - > bottomNoMargins ( ) + st : : boxOptionListSkip ) ; <nl> <nl> auto inputy = 0 ; <nl> - auto fieldsVisible = ( type ! = dbictAuto ) | | ( ! badProxyValue ( ) & & _currentProxyType ! = ProxyData : : Type : : None ) ; <nl> + auto fieldsVisible = proxyFieldsVisible ( ) ; <nl> auto fieldsBelowHttp = fieldsVisible & & ( type = = dbictHttpProxy | | ( type = = dbictAuto & & _currentProxyType = = ProxyData : : Type : : Http ) ) ; <nl> auto fieldsBelowTcp = fieldsVisible & & ( type = = dbictTcpProxy | | ( type = = dbictAuto & & _currentProxyType = = ProxyData : : Type : : Socks5 ) ) ; <nl> if ( fieldsBelowHttp ) { <nl> mmm a / Telegram / SourceFiles / boxes / connection_box . h <nl> ppp b / Telegram / SourceFiles / boxes / connection_box . h <nl> private slots : <nl> void updateControlsVisibility ( ) ; <nl> void updateControlsPosition ( ) ; <nl> bool badProxyValue ( ) const ; <nl> + bool proxyFieldsVisible ( ) const ; <nl> <nl> object_ptr < Ui : : InputField > _hostInput ; <nl> object_ptr < Ui : : PortInput > _portInput ; <nl> mmm a / Telegram / SourceFiles / config . h <nl> ppp b / Telegram / SourceFiles / config . h <nl> enum { <nl> MTPAckSendWaiting = 10000 , / / how much time to wait for some more requests , when sending msg acks <nl> MTPResendThreshold = 1 , / / how much ints should message contain for us not to resend , but to check it ' s state <nl> MTPContainerLives = 600 , / / container lives 10 minutes in haveSent map <nl> - MTPMinReceiveDelay = 4000 , / / 4 seconds <nl> - MTPMaxReceiveDelay = 64000 , / / 64 seconds <nl> - MTPMinConnectDelay = 1000 , / / tcp connect should take less then 1 second <nl> - MTPMaxConnectDelay = 8000 , / / tcp connect should take 8 seconds max <nl> - MTPConnectionOldTimeout = 192000 , / / 192 seconds <nl> - MTPTcpConnectionWaitTimeout = 2000 , / / 2 seconds waiting for tcp , until we accept http <nl> - MTPIPv4ConnectionWaitTimeout = 1000 , / / 1 seconds waiting for ipv4 , until we accept ipv6 <nl> <nl> MTPKillFileSessionTimeout = 5000 , / / how much time without upload / download causes additional session kill <nl> <nl> enum { <nl> <nl> MaxUsersPerInvite = 100 , / / max users in one super group invite request <nl> <nl> - MTPPingDelayDisconnect = 60 , / / 1 min <nl> - MTPPingSendAfterAuto = 30 , / / send new ping starting from 30 seconds ( add to existing container ) <nl> - MTPPingSendAfter = 45 , / / send new ping after 45 seconds without ping <nl> - <nl> MTPChannelGetDifferenceLimit = 100 , <nl> <nl> MaxSelectedItems = 100 , <nl> mmm a / Telegram / SourceFiles / mtproto / connection . cpp <nl> ppp b / Telegram / SourceFiles / mtproto / connection . cpp <nl> For license and copyright information please follow this link : <nl> # include " zlib . h " <nl> # include " lang / lang_keys . h " <nl> # include " base / openssl_help . h " <nl> + # include " base / qthelp_url . h " <nl> # include < openssl / bn . h > <nl> # include < openssl / err . h > <nl> # include < openssl / aes . h > <nl> namespace { <nl> constexpr auto kRecreateKeyId = AuthKey : : KeyId ( 0xFFFFFFFFFFFFFFFFULL ) ; <nl> constexpr auto kIntSize = static_cast < int > ( sizeof ( mtpPrime ) ) ; <nl> constexpr auto kMaxModExpSize = 256 ; <nl> + constexpr auto kWaitForBetterTimeout = TimeMs ( 2000 ) ; <nl> + constexpr auto kMinConnectedTimeout = TimeMs ( 1000 ) ; <nl> + constexpr auto kMaxConnectedTimeout = TimeMs ( 8000 ) ; <nl> + constexpr auto kMinReceiveTimeout = TimeMs ( 4000 ) ; <nl> + constexpr auto kMaxReceiveTimeout = TimeMs ( 64000 ) ; <nl> + constexpr auto kMarkConnectionOldTimeout = TimeMs ( 192000 ) ; <nl> + constexpr auto kPingDelayDisconnect = 60 ; <nl> + constexpr auto kPingSendAfter = TimeMs ( 30000 ) ; <nl> + constexpr auto kPingSendAfterForce = TimeMs ( 45000 ) ; <nl> <nl> / / If we can ' t connect for this time we will ask _instance to update config . <nl> constexpr auto kRequestConfigTimeout = TimeMs ( 8000 ) ; <nl> QString LogIdsVector ( const QVector < MTPlong > & ids ) { <nl> return idsStr + " ] " ; <nl> } <nl> <nl> + bytes : : vector ProtocolSecretFromPassword ( const QString & password ) { <nl> + const auto size = password . size ( ) ; <nl> + if ( size % 2 ) { <nl> + return { } ; <nl> + } <nl> + const auto length = size / 2 ; <nl> + const auto fromHex = [ ] ( QChar ch ) - > int { <nl> + const auto code = int ( ch . unicode ( ) ) ; <nl> + if ( code > = ' 0 ' & & code < = ' 9 ' ) { <nl> + return ( code - ' 0 ' ) ; <nl> + } else if ( code > = ' A ' & & code < = ' F ' ) { <nl> + return 10 + ( code - ' A ' ) ; <nl> + } else if ( ch > = ' a ' & & ch < = ' f ' ) { <nl> + return 10 + ( code - ' a ' ) ; <nl> + } <nl> + return - 1 ; <nl> + } ; <nl> + auto result = bytes : : vector ( length ) ; <nl> + for ( auto i = 0 ; i ! = length ; + + i ) { <nl> + const auto high = fromHex ( password [ 2 * i ] ) ; <nl> + const auto low = fromHex ( password [ 2 * i + 1 ] ) ; <nl> + if ( high < 0 | | low < 0 ) { <nl> + return { } ; <nl> + } <nl> + result [ i ] = static_cast < gsl : : byte > ( high * 16 + low ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> bool IsGoodModExpFirst ( const openssl : : BigNum & modexp , const openssl : : BigNum & prime ) { <nl> auto diff = prime - modexp ; <nl> if ( modexp . failed ( ) | | prime . failed ( ) | | diff . failed ( ) ) { <nl> bool parsePQ ( const QByteArray & pqStr , QByteArray & pStr , QByteArray & qStr ) { <nl> <nl> } / / namespace <nl> <nl> - Connection : : Connection ( Instance * instance ) : _instance ( instance ) { <nl> + Connection : : Connection ( not_null < Instance * > instance ) : _instance ( instance ) { <nl> } <nl> <nl> void Connection : : start ( SessionData * sessionData , ShiftedDcId shiftedDcId ) { <nl> - Expects ( thread = = nullptr & & data = = nullptr ) ; <nl> + Expects ( _thread = = nullptr & & _private = = nullptr ) ; <nl> <nl> - thread = std : : make_unique < Thread > ( ) ; <nl> - auto newData = std : : make_unique < ConnectionPrivate > ( _instance , thread . get ( ) , this , sessionData , shiftedDcId ) ; <nl> + _thread = std : : make_unique < Thread > ( ) ; <nl> + auto newData = std : : make_unique < ConnectionPrivate > ( <nl> + _instance , <nl> + _thread . get ( ) , <nl> + this , <nl> + sessionData , <nl> + shiftedDcId ) ; <nl> <nl> / / will be deleted in the thread : : finished signal <nl> - data = newData . release ( ) ; <nl> - thread - > start ( ) ; <nl> + _private = newData . release ( ) ; <nl> + _thread - > start ( ) ; <nl> } <nl> <nl> void Connection : : kill ( ) { <nl> - Expects ( data ! = nullptr & & thread ! = nullptr ) ; <nl> - data - > stop ( ) ; <nl> - data = nullptr ; <nl> - thread - > quit ( ) ; <nl> + Expects ( _private ! = nullptr & & _thread ! = nullptr ) ; <nl> + <nl> + _private - > stop ( ) ; <nl> + _private = nullptr ; <nl> + _thread - > quit ( ) ; <nl> } <nl> <nl> void Connection : : waitTillFinish ( ) { <nl> - Expects ( data = = nullptr & & thread ! = nullptr ) ; <nl> + Expects ( _private = = nullptr & & _thread ! = nullptr ) ; <nl> <nl> DEBUG_LOG ( ( " Waiting for connectionThread to finish " ) ) ; <nl> - thread - > wait ( ) ; <nl> - thread . reset ( ) ; <nl> + _thread - > wait ( ) ; <nl> + _thread . reset ( ) ; <nl> } <nl> <nl> int32 Connection : : state ( ) const { <nl> - Expects ( data ! = nullptr & & thread ! = nullptr ) ; <nl> + Expects ( _private ! = nullptr & & _thread ! = nullptr ) ; <nl> <nl> - return data - > getState ( ) ; <nl> + return _private - > getState ( ) ; <nl> } <nl> <nl> QString Connection : : transport ( ) const { <nl> - Expects ( data ! = nullptr & & thread ! = nullptr ) ; <nl> + Expects ( _private ! = nullptr & & _thread ! = nullptr ) ; <nl> <nl> - return data - > transport ( ) ; <nl> + return _private - > transport ( ) ; <nl> } <nl> <nl> Connection : : ~ Connection ( ) { <nl> - Expects ( data = = nullptr ) ; <nl> + Expects ( _private = = nullptr ) ; <nl> <nl> - if ( thread ) { <nl> + if ( _thread ) { <nl> waitTillFinish ( ) ; <nl> } <nl> } <nl> <nl> - void ConnectionPrivate : : createConn ( bool createIPv4 , bool createIPv6 ) { <nl> - destroyAllConnections ( ) ; <nl> - if ( createIPv4 ) { <nl> - QWriteLocker lock ( & stateConnMutex ) ; <nl> - _conn4 = AbstractConnection : : create ( <nl> - * _connectionOptions , <nl> - _shiftedDcId , <nl> - _dcType , <nl> - thread ( ) ) ; <nl> - connect ( _conn4 , SIGNAL ( error ( qint32 ) ) , this , SLOT ( onError4 ( qint32 ) ) ) ; <nl> - connect ( _conn4 , SIGNAL ( receivedSome ( ) ) , this , SLOT ( onReceivedSome ( ) ) ) ; <nl> - } <nl> - if ( createIPv6 ) { <nl> - QWriteLocker lock ( & stateConnMutex ) ; <nl> - _conn6 = AbstractConnection : : create ( <nl> - * _connectionOptions , <nl> - _shiftedDcId , <nl> - _dcType , <nl> - thread ( ) ) ; <nl> - connect ( _conn6 , SIGNAL ( error ( qint32 ) ) , this , SLOT ( onError6 ( qint32 ) ) ) ; <nl> - connect ( _conn6 , SIGNAL ( receivedSome ( ) ) , this , SLOT ( onReceivedSome ( ) ) ) ; <nl> - } <nl> + void ConnectionPrivate : : appendTestConnection ( <nl> + DcOptions : : Variants : : Protocol protocol , <nl> + const QString & ip , <nl> + int port , <nl> + const bytes : : vector & protocolSecret ) { <nl> + QWriteLocker lock ( & stateConnMutex ) ; <nl> + <nl> + const auto priority = ( qthelp : : is_ipv6 ( ip ) ? 0 : 1 ) <nl> + + ( protocol = = DcOptions : : Variants : : Tcp ? 1 : 0 ) ; <nl> + _testConnections . push_back ( { <nl> + AbstractConnection : : create ( protocol , thread ( ) ) , <nl> + priority <nl> + } ) ; <nl> + auto weak = _testConnections . back ( ) . data . get ( ) ; <nl> + connect ( weak , & AbstractConnection : : error , [ = ] ( int errorCode ) { <nl> + onError ( weak , errorCode ) ; <nl> + } ) ; <nl> + connect ( weak , & AbstractConnection : : receivedSome , [ = ] { <nl> + onReceivedSome ( ) ; <nl> + } ) ; <nl> firstSentAt = 0 ; <nl> - if ( oldConnection ) { <nl> - oldConnection = false ; <nl> + if ( _oldConnection ) { <nl> + _oldConnection = false ; <nl> DEBUG_LOG ( ( " This connection marked as not old ! " ) ) ; <nl> } <nl> - oldConnectionTimer . start ( MTPConnectionOldTimeout ) ; <nl> - } <nl> + _oldConnectionTimer . callOnce ( kMarkConnectionOldTimeout ) ; <nl> + connect ( weak , & AbstractConnection : : connected , [ = ] { <nl> + onConnected ( weak ) ; <nl> + } ) ; <nl> + connect ( weak , & AbstractConnection : : disconnected , [ = ] { <nl> + onDisconnected ( weak ) ; <nl> + } ) ; <nl> <nl> - void ConnectionPrivate : : destroyAllConnections ( ) { <nl> - destroyConnection ( _conn4 ) ; <nl> - destroyConnection ( _conn6 ) ; <nl> - _conn = nullptr ; <nl> + const auto protocolDcId = ( _dcType = = DcType : : MediaDownload ) <nl> + ? - MTP : : bareDcId ( _shiftedDcId ) <nl> + : MTP : : bareDcId ( _shiftedDcId ) ; <nl> + InvokeQueued ( _testConnections . back ( ) . data , [ = ] { <nl> + weak - > connectToServer ( ip , port , protocolSecret , protocolDcId ) ; <nl> + } ) ; <nl> } <nl> <nl> - void ConnectionPrivate : : destroyConnection ( AbstractConnection * & connection ) { <nl> - const auto taken = [ & ] { <nl> - QWriteLocker lock ( & stateConnMutex ) ; <nl> - if ( connection ) { <nl> - disconnect ( connection , SIGNAL ( connected ( ) ) , nullptr , nullptr ) ; <nl> - disconnect ( connection , SIGNAL ( disconnected ( ) ) , nullptr , nullptr ) ; <nl> - disconnect ( connection , SIGNAL ( error ( qint32 ) ) , nullptr , nullptr ) ; <nl> - disconnect ( connection , SIGNAL ( receivedData ( ) ) , nullptr , nullptr ) ; <nl> - disconnect ( connection , SIGNAL ( receivedSome ( ) ) , nullptr , nullptr ) ; <nl> - } <nl> - return base : : take ( connection ) ; <nl> - } ( ) ; <nl> - if ( taken ) { <nl> - taken - > disconnectFromServer ( ) ; <nl> - taken - > deleteLater ( ) ; <nl> - } <nl> - } <nl> - <nl> - ConnectionPrivate : : ConnectionPrivate ( Instance * instance , QThread * thread , Connection * owner , SessionData * data , ShiftedDcId shiftedDcId ) : QObject ( ) <nl> + void ConnectionPrivate : : destroyAllConnections ( ) { <nl> + _waitForBetterTimer . cancel ( ) ; <nl> + _waitForReceivedTimer . cancel ( ) ; <nl> + _waitForConnectedTimer . cancel ( ) ; <nl> + _testConnections . clear ( ) ; <nl> + _connection = nullptr ; <nl> + } <nl> + <nl> + ConnectionPrivate : : ConnectionPrivate ( <nl> + not_null < Instance * > instance , <nl> + not_null < QThread * > thread , <nl> + not_null < Connection * > owner , <nl> + not_null < SessionData * > data , <nl> + ShiftedDcId shiftedDcId ) <nl> + : QObject ( nullptr ) <nl> , _instance ( instance ) <nl> , _state ( DisconnectedState ) <nl> , _shiftedDcId ( shiftedDcId ) <nl> , _owner ( owner ) <nl> , _configWasFineAt ( getms ( true ) ) <nl> - , _waitForReceived ( MTPMinReceiveDelay ) <nl> - , _waitForConnected ( MTPMinConnectDelay ) <nl> - / / , sessionDataMutex ( QReadWriteLock : : Recursive ) <nl> + , _retryTimer ( thread , [ = ] { retryByTimer ( ) ; } ) <nl> + , _oldConnectionTimer ( thread , [ = ] { markConnectionOld ( ) ; } ) <nl> + , _waitForConnectedTimer ( thread , [ = ] { waitConnectedFailed ( ) ; } ) <nl> + , _waitForReceivedTimer ( thread , [ = ] { waitReceivedFailed ( ) ; } ) <nl> + , _waitForBetterTimer ( thread , [ = ] { waitBetterFailed ( ) ; } ) <nl> + , _waitForReceived ( kMinReceiveTimeout ) <nl> + , _waitForConnected ( kMinConnectedTimeout ) <nl> + , _pingSender ( thread , [ = ] { sendPingByTimer ( ) ; } ) <nl> , sessionData ( data ) { <nl> - oldConnectionTimer . moveToThread ( thread ) ; <nl> - _waitForConnectedTimer . moveToThread ( thread ) ; <nl> - _waitForReceivedTimer . moveToThread ( thread ) ; <nl> - _waitForIPv4Timer . moveToThread ( thread ) ; <nl> - _pingSender . moveToThread ( thread ) ; <nl> - retryTimer . moveToThread ( thread ) ; <nl> - moveToThread ( thread ) ; <nl> - <nl> Expects ( _shiftedDcId ! = 0 ) ; <nl> <nl> - connect ( thread , & QThread : : started , this , [ this ] { connectToServer ( ) ; } ) ; <nl> - connect ( thread , & QThread : : finished , this , [ this ] { finishAndDestroy ( ) ; } ) ; <nl> + moveToThread ( thread ) ; <nl> + <nl> + connect ( thread , & QThread : : started , this , [ = ] { connectToServer ( ) ; } ) ; <nl> + connect ( thread , & QThread : : finished , this , [ = ] { finishAndDestroy ( ) ; } ) ; <nl> connect ( this , SIGNAL ( finished ( internal : : Connection * ) ) , _instance , SLOT ( connectionFinished ( internal : : Connection * ) ) , Qt : : QueuedConnection ) ; <nl> <nl> - connect ( & retryTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( retryByTimer ( ) ) ) ; <nl> - connect ( & _waitForConnectedTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( onWaitConnectedFailed ( ) ) ) ; <nl> - connect ( & _waitForReceivedTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( onWaitReceivedFailed ( ) ) ) ; <nl> - connect ( & _waitForIPv4Timer , SIGNAL ( timeout ( ) ) , this , SLOT ( onWaitIPv4Failed ( ) ) ) ; <nl> - connect ( & oldConnectionTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( onOldConnection ( ) ) ) ; <nl> - connect ( & _pingSender , SIGNAL ( timeout ( ) ) , this , SLOT ( onPingSender ( ) ) ) ; <nl> connect ( sessionData - > owner ( ) , SIGNAL ( authKeyCreated ( ) ) , this , SLOT ( updateAuthKey ( ) ) , Qt : : QueuedConnection ) ; <nl> - <nl> connect ( sessionData - > owner ( ) , SIGNAL ( needToRestart ( ) ) , this , SLOT ( restartNow ( ) ) , Qt : : QueuedConnection ) ; <nl> connect ( this , SIGNAL ( needToReceive ( ) ) , sessionData - > owner ( ) , SLOT ( tryToReceive ( ) ) , Qt : : QueuedConnection ) ; <nl> connect ( this , SIGNAL ( stateChanged ( qint32 ) ) , sessionData - > owner ( ) , SLOT ( onConnectionStateChange ( qint32 ) ) , Qt : : QueuedConnection ) ; <nl> int32 ConnectionPrivate : : getState ( ) const { <nl> QReadLocker lock ( & stateConnMutex ) ; <nl> int32 result = _state ; <nl> if ( _state < 0 ) { <nl> - if ( retryTimer . isActive ( ) ) { <nl> - result = int32 ( getms ( true ) - retryWillFinish ) ; <nl> + if ( _retryTimer . isActive ( ) ) { <nl> + result = int32 ( getms ( true ) - _retryWillFinish ) ; <nl> if ( result > = 0 ) { <nl> result = - 1 ; <nl> } <nl> int32 ConnectionPrivate : : getState ( ) const { <nl> <nl> QString ConnectionPrivate : : transport ( ) const { <nl> QReadLocker lock ( & stateConnMutex ) ; <nl> - if ( ( ! _conn4 & & ! _conn6 ) | | ( _conn4 & & _conn6 ) | | ( _state < 0 ) ) { <nl> + if ( ! _connection | | ( _state < 0 ) ) { <nl> return QString ( ) ; <nl> } <nl> <nl> Assert ( _connectionOptions ! = nullptr ) ; <nl> - auto result = ( _conn4 ? _conn4 : _conn6 ) - > transport ( ) ; <nl> - if ( ! result . isEmpty ( ) & & _connectionOptions - > useIPv6 ) { <nl> - result + = ( _conn4 ? " / IPv4 " : " / IPv6 " ) ; <nl> - } <nl> - return result ; <nl> + return _connection - > transport ( ) ; <nl> } <nl> <nl> bool ConnectionPrivate : : setState ( int32 state , int32 ifState ) { <nl> bool ConnectionPrivate : : setState ( int32 state , int32 ifState ) { <nl> if ( _state = = state ) return false ; <nl> _state = state ; <nl> if ( state < 0 ) { <nl> - retryTimeout = - state ; <nl> - retryTimer . start ( retryTimeout ) ; <nl> - retryWillFinish = getms ( true ) + retryTimeout ; <nl> + _retryTimeout = - state ; <nl> + _retryTimer . callOnce ( _retryTimeout ) ; <nl> + _retryWillFinish = getms ( true ) + _retryTimeout ; <nl> } <nl> emit stateChanged ( state ) ; <nl> return true ; <nl> mtpMsgId ConnectionPrivate : : placeToContainer ( mtpRequest & toSendRequest , mtpMsgId <nl> <nl> void ConnectionPrivate : : tryToSend ( ) { <nl> QReadLocker lockFinished ( & sessionDataMutex ) ; <nl> - if ( ! sessionData | | ! _conn ) { <nl> + if ( ! sessionData | | ! _connection ) { <nl> return ; <nl> } <nl> <nl> void ConnectionPrivate : : tryToSend ( ) { <nl> ping . write ( * pingRequest ) ; <nl> DEBUG_LOG ( ( " MTP Info : sending ping , ping_id : % 1 " ) . arg ( _pingIdToSend ) ) ; <nl> } else { <nl> - MTPPing_delay_disconnect ping ( MTP_long ( _pingIdToSend ) , MTP_int ( MTPPingDelayDisconnect ) ) ; <nl> + MTPPing_delay_disconnect ping ( MTP_long ( _pingIdToSend ) , MTP_int ( kPingDelayDisconnect ) ) ; <nl> uint32 pingSize = ping . innerLength ( ) > > 2 ; / / copy from Session : : send <nl> pingRequest = mtpRequestData : : prepare ( pingSize ) ; <nl> ping . write ( * pingRequest ) ; <nl> void ConnectionPrivate : : tryToSend ( ) { <nl> } <nl> <nl> pingRequest - > msDate = getms ( true ) ; / / > 0 - can send without container <nl> - _pingSendAt = pingRequest - > msDate + ( MTPPingSendAfterAuto * 1000LL ) ; <nl> + _pingSendAt = pingRequest - > msDate + kPingSendAfter ; <nl> pingRequest - > requestId = 0 ; / / dont add to haveSent / wereAcked maps <nl> <nl> if ( _shiftedDcId = = bareDcId ( _shiftedDcId ) & & ! prependOnly ) { / / main session <nl> - _pingSender . start ( MTPPingSendAfter * 1000 ) ; <nl> + _pingSender . callOnce ( kPingSendAfterForce ) ; <nl> } <nl> <nl> _pingId = _pingIdToSend ; <nl> void ConnectionPrivate : : tryToSend ( ) { <nl> stateRequest - > msDate = getms ( true ) ; / / > 0 - can send without container <nl> stateRequest - > requestId = reqid ( ) ; / / add to haveSent / wereAcked maps , but don ' t add to requestMap <nl> } <nl> - if ( _conn - > usingHttpWait ( ) ) { <nl> + if ( _connection - > usingHttpWait ( ) ) { <nl> MTPHttpWait req ( MTP_http_wait ( MTP_int ( 100 ) , MTP_int ( 30 ) , MTP_int ( 25000 ) ) ) ; <nl> <nl> httpWaitRequest = mtpRequestData : : prepare ( req . innerLength ( ) > > 2 ) ; <nl> void ConnectionPrivate : : retryByTimer ( ) { <nl> QReadLocker lockFinished ( & sessionDataMutex ) ; <nl> if ( ! sessionData ) return ; <nl> <nl> - if ( retryTimeout < 3 ) { <nl> - + + retryTimeout ; <nl> - } else if ( retryTimeout = = 3 ) { <nl> - retryTimeout = 1000 ; <nl> - } else if ( retryTimeout < 64000 ) { <nl> - retryTimeout * = 2 ; <nl> + if ( _retryTimeout < 3 ) { <nl> + + + _retryTimeout ; <nl> + } else if ( _retryTimeout = = 3 ) { <nl> + _retryTimeout = 1000 ; <nl> + } else if ( _retryTimeout < 64000 ) { <nl> + _retryTimeout * = 2 ; <nl> } <nl> if ( keyId = = kRecreateKeyId ) { <nl> if ( sessionData - > getKey ( ) ) { <nl> void ConnectionPrivate : : retryByTimer ( ) { <nl> } <nl> <nl> void ConnectionPrivate : : restartNow ( ) { <nl> - retryTimeout = 1 ; <nl> - retryTimer . stop ( ) ; <nl> + _retryTimeout = 1 ; <nl> + _retryTimer . cancel ( ) ; <nl> restart ( ) ; <nl> } <nl> <nl> void ConnectionPrivate : : connectToServer ( bool afterConfig ) { <nl> } <nl> } <nl> <nl> - using Variants = DcOptions : : Variants ; <nl> - const auto kIPv4 = Variants : : IPv4 ; <nl> - const auto kIPv6 = Variants : : IPv6 ; <nl> - const auto kTcp = Variants : : Tcp ; <nl> - const auto kHttp = Variants : : Http ; <nl> - const auto variants = _instance - > dcOptions ( ) - > lookup ( bareDc , _dcType ) ; <nl> - const auto useIPv4 = ( _dcType = = DcType : : Temporary ) ? true : _connectionOptions - > useIPv4 ; <nl> - const auto useIPv6 = ( _dcType = = DcType : : Temporary ) ? false : _connectionOptions - > useIPv6 ; <nl> - const auto useTcp = ( _dcType = = DcType : : Temporary ) ? true : _connectionOptions - > useTcp ; <nl> - const auto useHttp = ( _dcType = = DcType : : Temporary ) ? false : _connectionOptions - > useHttp ; <nl> - auto noIPv4 = ( _dcType = = DcType : : Temporary ) ? ( variants . data [ kIPv4 ] [ kTcp ] . port = = 0 ) : ( ! useIPv4 | | ( variants . data [ kIPv4 ] [ kHttp ] . port = = 0 ) ) ; <nl> - auto noIPv6 = ( _dcType = = DcType : : Temporary ) ? true : ( ! useIPv6 | | ( variants . data [ kIPv6 ] [ kHttp ] . port = = 0 ) ) ; <nl> - if ( noIPv4 & & noIPv6 ) { <nl> + if ( afterConfig & & ( ! _testConnections . empty ( ) | | _connection ) ) { <nl> + return ; <nl> + } <nl> + <nl> + destroyAllConnections ( ) ; <nl> + if ( _connectionOptions - > proxy . type = = ProxyData : : Type : : Mtproto <nl> + & & _dcType ! = DcType : : Cdn ) { <nl> + appendTestConnection ( <nl> + DcOptions : : Variants : : Tcp , <nl> + _connectionOptions - > proxy . host , <nl> + _connectionOptions - > proxy . port , <nl> + ProtocolSecretFromPassword ( _connectionOptions - > proxy . password ) ) ; <nl> + } else { <nl> + using Variants = DcOptions : : Variants ; <nl> + const auto special = ( _dcType = = DcType : : Temporary ) ; <nl> + const auto variants = _instance - > dcOptions ( ) - > lookup ( <nl> + bareDc , <nl> + _dcType , <nl> + _connectionOptions - > proxy . type ! = ProxyData : : Type : : None ) ; <nl> + const auto useIPv4 = special ? true : _connectionOptions - > useIPv4 ; <nl> + const auto useIPv6 = special ? false : _connectionOptions - > useIPv6 ; <nl> + const auto useTcp = special ? true : _connectionOptions - > useTcp ; <nl> + const auto useHttp = special ? false : _connectionOptions - > useHttp ; <nl> + const auto skipAddress = ! useIPv4 <nl> + ? Variants : : IPv4 <nl> + : ! useIPv6 <nl> + ? Variants : : IPv6 <nl> + : Variants : : AddressTypeCount ; <nl> + const auto skipProtocol = ! useTcp <nl> + ? Variants : : Tcp <nl> + : ! useHttp <nl> + ? Variants : : Http <nl> + : Variants : : ProtocolCount ; <nl> + for ( auto address = 0 ; address ! = Variants : : AddressTypeCount ; + + address ) { <nl> + if ( address = = skipAddress ) { <nl> + continue ; <nl> + } <nl> + for ( auto protocol = 0 ; protocol ! = Variants : : ProtocolCount ; + + protocol ) { <nl> + if ( protocol = = skipProtocol ) { <nl> + continue ; <nl> + } <nl> + for ( const auto & endpoint : variants . data [ address ] [ protocol ] ) { <nl> + appendTestConnection ( <nl> + static_cast < Variants : : Protocol > ( protocol ) , <nl> + QString : : fromStdString ( endpoint . ip ) , <nl> + endpoint . port , <nl> + endpoint . protocolSecret ) ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + if ( _testConnections . empty ( ) ) { <nl> if ( _instance - > isKeysDestroyer ( ) ) { <nl> - LOG ( ( " MTP Error : DC % 1 options for IPv4 over HTTP not found for auth key destruction ! " ) . arg ( _shiftedDcId ) ) ; <nl> - if ( useIPv6 & & noIPv6 ) LOG ( ( " MTP Error : DC % 1 options for IPv6 over HTTP not found for auth key destruction ! " ) . arg ( _shiftedDcId ) ) ; <nl> + LOG ( ( " MTP Error : DC % 1 options for not found for auth key destruction ! " ) . arg ( _shiftedDcId ) ) ; <nl> emit _instance - > keyDestroyed ( _shiftedDcId ) ; <nl> return ; <nl> } else if ( afterConfig ) { <nl> - LOG ( ( " MTP Error : DC % 1 options for IPv4 over HTTP not found right after config load ! " ) . arg ( _shiftedDcId ) ) ; <nl> - if ( useIPv6 & & noIPv6 ) LOG ( ( " MTP Error : DC % 1 options for IPv6 over HTTP not found right after config load ! " ) . arg ( _shiftedDcId ) ) ; <nl> + LOG ( ( " MTP Error : DC % 1 options for not found right after config load ! " ) . arg ( _shiftedDcId ) ) ; <nl> return restart ( ) ; <nl> } <nl> - DEBUG_LOG ( ( " MTP Info : DC % 1 options for IPv4 over HTTP not found , waiting for config " ) . arg ( _shiftedDcId ) ) ; <nl> - if ( useIPv6 & & noIPv6 ) DEBUG_LOG ( ( " MTP Info : DC % 1 options for IPv6 over HTTP not found , waiting for config " ) . arg ( _shiftedDcId ) ) ; <nl> + DEBUG_LOG ( ( " MTP Info : DC % 1 options not found , waiting for config " ) . arg ( _shiftedDcId ) ) ; <nl> connect ( _instance , SIGNAL ( configLoaded ( ) ) , this , SLOT ( onConfigLoaded ( ) ) , Qt : : UniqueConnection ) ; <nl> InvokeQueued ( _instance , [ instance = _instance ] { <nl> instance - > requestConfig ( ) ; <nl> void ConnectionPrivate : : connectToServer ( bool afterConfig ) { <nl> return ; <nl> } <nl> <nl> - if ( afterConfig ) { <nl> - if ( _conn4 | | _conn6 ) { <nl> - return ; <nl> - } <nl> - } else if ( getms ( true ) - _configWasFineAt > kRequestConfigTimeout ) { <nl> + if ( getms ( true ) - _configWasFineAt > kRequestConfigTimeout ) { <nl> InvokeQueued ( _instance , [ instance = _instance ] { <nl> instance - > requestConfigIfOld ( ) ; <nl> } ) ; <nl> } <nl> <nl> - createConn ( ! noIPv4 , ! noIPv6 ) ; <nl> - retryTimer . stop ( ) ; <nl> - _waitForConnectedTimer . stop ( ) ; <nl> + _retryTimer . cancel ( ) ; <nl> + _waitForConnectedTimer . cancel ( ) ; <nl> <nl> setState ( ConnectingState ) ; <nl> _pingId = _pingMsgId = _pingIdToSend = _pingSendAt = 0 ; <nl> - _pingSender . stop ( ) ; <nl> - <nl> - if ( ! noIPv4 ) DEBUG_LOG ( ( " MTP Info : creating IPv4 connection to % 1 : % 2 ( tcp ) and % 3 : % 4 ( http ) . . . " ) . arg ( variants . data [ kIPv4 ] [ kTcp ] . ip . c_str ( ) ) . arg ( variants . data [ kIPv4 ] [ kTcp ] . port ) . arg ( variants . data [ kIPv4 ] [ kHttp ] . ip . c_str ( ) ) . arg ( variants . data [ kIPv4 ] [ kHttp ] . port ) ) ; <nl> - if ( ! noIPv6 ) DEBUG_LOG ( ( " MTP Info : creating IPv6 connection to [ % 1 ] : % 2 ( tcp ) and [ % 3 ] : % 4 ( http ) . . . " ) . arg ( variants . data [ kIPv6 ] [ kTcp ] . ip . c_str ( ) ) . arg ( variants . data [ kIPv6 ] [ kTcp ] . port ) . arg ( variants . data [ kIPv4 ] [ kHttp ] . ip . c_str ( ) ) . arg ( variants . data [ kIPv4 ] [ kHttp ] . port ) ) ; <nl> - <nl> - _waitForConnectedTimer . start ( _waitForConnected ) ; <nl> - if ( auto conn = _conn4 ) { <nl> - auto endpoint = DcOptions : : Endpoint ( ) ; <nl> - if ( _connectionOptions - > proxy . type = = ProxyData : : Type : : Mtproto ) { <nl> - endpoint . ip = _connectionOptions - > proxy . host . toStdString ( ) ; <nl> - endpoint . port = _connectionOptions - > proxy . port ; <nl> - endpoint . flags = MTPDdcOption : : Flag : : f_tcpo_only ; <nl> - } else { <nl> - endpoint = variants . data [ kIPv4 ] [ kTcp ] ; <nl> - } <nl> - connect ( conn , SIGNAL ( connected ( ) ) , this , SLOT ( onConnected4 ( ) ) ) ; <nl> - connect ( conn , SIGNAL ( disconnected ( ) ) , this , SLOT ( onDisconnected4 ( ) ) ) ; <nl> - conn - > connectTcp ( endpoint ) ; <nl> - conn - > connectHttp ( variants . data [ kIPv4 ] [ kHttp ] ) ; <nl> - } <nl> - if ( auto conn = _conn6 ) { <nl> - connect ( conn , SIGNAL ( connected ( ) ) , this , SLOT ( onConnected6 ( ) ) ) ; <nl> - connect ( conn , SIGNAL ( disconnected ( ) ) , this , SLOT ( onDisconnected6 ( ) ) ) ; <nl> - conn - > connectTcp ( variants . data [ kIPv6 ] [ kTcp ] ) ; <nl> - conn - > connectHttp ( variants . data [ kIPv6 ] [ kHttp ] ) ; <nl> - } <nl> + _pingSender . cancel ( ) ; <nl> + <nl> + _waitForConnectedTimer . callOnce ( _waitForConnected ) ; <nl> } <nl> <nl> void ConnectionPrivate : : restart ( ) { <nl> void ConnectionPrivate : : restart ( ) { <nl> <nl> DEBUG_LOG ( ( " MTP Info : restarting Connection " ) ) ; <nl> <nl> - _waitForReceivedTimer . stop ( ) ; <nl> - _waitForConnectedTimer . stop ( ) ; <nl> + _waitForReceivedTimer . cancel ( ) ; <nl> + _waitForConnectedTimer . cancel ( ) ; <nl> <nl> auto key = sessionData - > getKey ( ) ; <nl> if ( key ) { <nl> void ConnectionPrivate : : restart ( ) { <nl> resetSession ( ) ; <nl> } <nl> restarted = true ; <nl> - if ( retryTimer . isActive ( ) ) return ; <nl> + if ( _retryTimer . isActive ( ) ) return ; <nl> <nl> - DEBUG_LOG ( ( " MTP Info : restart timeout : % 1ms " ) . arg ( retryTimeout ) ) ; <nl> - setState ( - retryTimeout ) ; <nl> + DEBUG_LOG ( ( " MTP Info : restart timeout : % 1ms " ) . arg ( _retryTimeout ) ) ; <nl> + setState ( - _retryTimeout ) ; <nl> } <nl> <nl> void ConnectionPrivate : : onSentSome ( uint64 size ) { <nl> if ( ! _waitForReceivedTimer . isActive ( ) ) { <nl> auto remain = static_cast < uint64 > ( _waitForReceived ) ; <nl> - if ( ! oldConnection ) { <nl> - auto remainBySize = size * _waitForReceived / 8192 ; / / 8kb / sec , so 512 kb give 64 sec <nl> - remain = snap ( remainBySize , remain , uint64 ( MTPMaxReceiveDelay ) ) ; <nl> + if ( ! _oldConnection ) { <nl> + / / 8kb / sec , so 512 kb give 64 sec <nl> + auto remainBySize = size * _waitForReceived / 8192 ; <nl> + remain = snap ( remainBySize , remain , uint64 ( kMaxReceiveTimeout ) ) ; <nl> if ( remain ! = _waitForReceived ) { <nl> DEBUG_LOG ( ( " Checking connect for request with size % 1 bytes , delay will be % 2 " ) . arg ( size ) . arg ( remain ) ) ; <nl> } <nl> void ConnectionPrivate : : onSentSome ( uint64 size ) { <nl> } else if ( isDownloadDcId ( _shiftedDcId ) ) { <nl> remain * = kDownloadSessionsCount ; <nl> } <nl> - _waitForReceivedTimer . start ( remain ) ; <nl> + _waitForReceivedTimer . callOnce ( remain ) ; <nl> } <nl> if ( ! firstSentAt ) firstSentAt = getms ( true ) ; <nl> } <nl> <nl> void ConnectionPrivate : : onReceivedSome ( ) { <nl> - if ( oldConnection ) { <nl> - oldConnection = false ; <nl> + if ( _oldConnection ) { <nl> + _oldConnection = false ; <nl> DEBUG_LOG ( ( " This connection marked as not old ! " ) ) ; <nl> } <nl> - oldConnectionTimer . start ( MTPConnectionOldTimeout ) ; <nl> - _waitForReceivedTimer . stop ( ) ; <nl> + _oldConnectionTimer . callOnce ( kMarkConnectionOldTimeout ) ; <nl> + _waitForReceivedTimer . cancel ( ) ; <nl> if ( firstSentAt > 0 ) { <nl> int32 ms = getms ( true ) - firstSentAt ; <nl> DEBUG_LOG ( ( " MTP Info : response in % 1ms , _waitForReceived : % 2ms " ) . arg ( ms ) . arg ( _waitForReceived ) ) ; <nl> <nl> - if ( ms > 0 & & ms * 2 < int32 ( _waitForReceived ) ) _waitForReceived = qMax ( ms * 2 , int32 ( MTPMinReceiveDelay ) ) ; <nl> + if ( ms > 0 & & ms * 2 < int32 ( _waitForReceived ) ) { <nl> + _waitForReceived = qMax ( ms * 2 , int32 ( kMinReceiveTimeout ) ) ; <nl> + } <nl> firstSentAt = - 1 ; <nl> } <nl> } <nl> <nl> - void ConnectionPrivate : : onOldConnection ( ) { <nl> - oldConnection = true ; <nl> - _waitForReceived = MTPMinReceiveDelay ; <nl> + void ConnectionPrivate : : markConnectionOld ( ) { <nl> + _oldConnection = true ; <nl> + _waitForReceived = kMinReceiveTimeout ; <nl> DEBUG_LOG ( ( " This connection marked as old ! _waitForReceived now % 1ms " ) . arg ( _waitForReceived ) ) ; <nl> } <nl> <nl> - void ConnectionPrivate : : onPingSender ( ) { <nl> + void ConnectionPrivate : : sendPingByTimer ( ) { <nl> if ( _pingId ) { <nl> - if ( _pingSendAt + ( MTPPingSendAfter - MTPPingSendAfterAuto - 1 ) * 1000LL < getms ( true ) ) { <nl> - LOG ( ( " Could not send ping for MTPPingSendAfter seconds , restarting . . . " ) ) ; <nl> + if ( _pingSendAt + kPingSendAfterForce - kPingSendAfter - TimeMs ( 1000 ) < getms ( true ) ) { <nl> + LOG ( ( " Could not send ping for some seconds , restarting . . . " ) ) ; <nl> return restart ( ) ; <nl> } else { <nl> - _pingSender . start ( _pingSendAt + ( MTPPingSendAfter - MTPPingSendAfterAuto ) * 1000LL - getms ( true ) ) ; <nl> + _pingSender . callOnce ( _pingSendAt + kPingSendAfterForce - kPingSendAfter - getms ( true ) ) ; <nl> } <nl> } else { <nl> emit needToSendAsync ( ) ; <nl> void ConnectionPrivate : : onPingSendForce ( ) { <nl> } <nl> } <nl> <nl> - void ConnectionPrivate : : onWaitReceivedFailed ( ) { <nl> + void ConnectionPrivate : : waitReceivedFailed ( ) { <nl> Expects ( _connectionOptions ! = nullptr ) ; <nl> <nl> if ( ! _connectionOptions - > useTcp ) { <nl> void ConnectionPrivate : : onWaitReceivedFailed ( ) { <nl> } <nl> <nl> DEBUG_LOG ( ( " MTP Info : bad connection , _waitForReceived : % 1ms " ) . arg ( _waitForReceived ) ) ; <nl> - if ( _waitForReceived < MTPMaxReceiveDelay ) { <nl> + if ( _waitForReceived < kMaxReceiveTimeout ) { <nl> _waitForReceived * = 2 ; <nl> } <nl> doDisconnect ( ) ; <nl> restarted = true ; <nl> - if ( retryTimer . isActive ( ) ) return ; <nl> + if ( _retryTimer . isActive ( ) ) { <nl> + return ; <nl> + } <nl> <nl> DEBUG_LOG ( ( " MTP Info : immediate restart ! " ) ) ; <nl> InvokeQueued ( this , [ this ] { connectToServer ( ) ; } ) ; <nl> } <nl> <nl> - void ConnectionPrivate : : onWaitConnectedFailed ( ) { <nl> + void ConnectionPrivate : : waitConnectedFailed ( ) { <nl> DEBUG_LOG ( ( " MTP Info : can ' t connect in % 1ms " ) . arg ( _waitForConnected ) ) ; <nl> - if ( _waitForConnected < MTPMaxConnectDelay ) _waitForConnected * = 2 ; <nl> + if ( _waitForConnected < kMaxConnectedTimeout ) { <nl> + _waitForConnected * = 2 ; <nl> + } <nl> <nl> doDisconnect ( ) ; <nl> restarted = true ; <nl> void ConnectionPrivate : : onWaitConnectedFailed ( ) { <nl> InvokeQueued ( this , [ this ] { connectToServer ( ) ; } ) ; <nl> } <nl> <nl> - void ConnectionPrivate : : onWaitIPv4Failed ( ) { <nl> - _conn = _conn6 ; <nl> - destroyConnection ( _conn4 ) ; <nl> - <nl> - if ( _conn ) { <nl> - DEBUG_LOG ( ( " MTP Info : can ' t connect through IPv4 , using IPv6 connection . " ) ) ; <nl> - <nl> - updateAuthKey ( ) ; <nl> - } else { <nl> - restart ( ) ; <nl> - } <nl> + void ConnectionPrivate : : waitBetterFailed ( ) { <nl> + confirmBestConnection ( ) ; <nl> } <nl> <nl> void ConnectionPrivate : : doDisconnect ( ) { <nl> void ConnectionPrivate : : handleReceived ( ) { <nl> return restartOnError ( ) ; <nl> } <nl> <nl> - while ( ! _conn - > received ( ) . empty ( ) ) { <nl> - auto intsBuffer = std : : move ( _conn - > received ( ) . front ( ) ) ; <nl> - _conn - > received ( ) . pop_front ( ) ; <nl> + while ( ! _connection - > received ( ) . empty ( ) ) { <nl> + auto intsBuffer = std : : move ( _connection - > received ( ) . front ( ) ) ; <nl> + _connection - > received ( ) . pop_front ( ) ; <nl> <nl> constexpr auto kExternalHeaderIntsCount = 6U ; / / 2 auth_key_id , 4 msg_key <nl> constexpr auto kEncryptedHeaderIntsCount = 8U ; / / 2 salt , 2 session , 2 msg_id , 1 seq_no , 1 length <nl> void ConnectionPrivate : : handleReceived ( ) { <nl> <nl> return restartOnError ( ) ; <nl> } <nl> - retryTimeout = 1 ; / / reset restart ( ) timer <nl> + _retryTimeout = 1 ; / / reset restart ( ) timer <nl> <nl> if ( ! sessionData - > isCheckedKey ( ) ) { <nl> DEBUG_LOG ( ( " MTP Info : marked auth key as checked " ) ) ; <nl> void ConnectionPrivate : : handleReceived ( ) { <nl> } <nl> } <nl> } <nl> - if ( _conn - > needHttpWait ( ) ) { <nl> + if ( _connection - > needHttpWait ( ) ) { <nl> emit sendHttpWaitAsync ( ) ; <nl> } <nl> } <nl> void ConnectionPrivate : : resendMany ( QVector < quint64 > msgIds , qint64 msCanWait , bo <nl> emit resendManyAsync ( msgIds , msCanWait , forceContainer , sendMsgStateInfo ) ; <nl> } <nl> <nl> - void ConnectionPrivate : : onConnected4 ( ) { <nl> - _waitForConnected = MTPMinConnectDelay ; <nl> - _waitForConnectedTimer . stop ( ) ; <nl> - <nl> - _waitForIPv4Timer . stop ( ) ; <nl> - <nl> + void ConnectionPrivate : : onConnected ( <nl> + not_null < AbstractConnection * > connection ) { <nl> QReadLocker lockFinished ( & sessionDataMutex ) ; <nl> if ( ! sessionData ) return ; <nl> <nl> - disconnect ( _conn4 , SIGNAL ( connected ( ) ) , this , SLOT ( onConnected4 ( ) ) ) ; <nl> - if ( ! _conn4 - > isConnected ( ) ) { <nl> - LOG ( ( " Connection Error : not connected in onConnected4 ( ) , state : % 1 " ) . arg ( _conn4 - > debugState ( ) ) ) ; <nl> + disconnect ( connection , & AbstractConnection : : connected , nullptr , nullptr ) ; <nl> + if ( ! connection - > isConnected ( ) ) { <nl> + LOG ( ( " Connection Error : not connected in onConnected ( ) , " <nl> + " state : % 1 " ) . arg ( connection - > debugState ( ) ) ) ; <nl> <nl> lockFinished . unlock ( ) ; <nl> return restart ( ) ; <nl> } <nl> <nl> - _conn = _conn4 ; <nl> - destroyConnection ( _conn6 ) ; <nl> - <nl> - DEBUG_LOG ( ( " MTP Info : connection through IPv4 succeed . " ) ) ; <nl> - <nl> - lockFinished . unlock ( ) ; <nl> - updateAuthKey ( ) ; <nl> - } <nl> - <nl> - void ConnectionPrivate : : onConnected6 ( ) { <nl> - _waitForConnected = MTPMinConnectDelay ; <nl> - _waitForConnectedTimer . stop ( ) ; <nl> - <nl> - QReadLocker lockFinished ( & sessionDataMutex ) ; <nl> - if ( ! sessionData ) return ; <nl> - <nl> - disconnect ( _conn6 , SIGNAL ( connected ( ) ) , this , SLOT ( onConnected6 ( ) ) ) ; <nl> - if ( ! _conn6 - > isConnected ( ) ) { <nl> - LOG ( ( " Connection Error : not connected in onConnected ( ) , state : % 1 " ) . arg ( _conn6 - > debugState ( ) ) ) ; <nl> + _waitForConnected = kMinConnectedTimeout ; <nl> + _waitForConnectedTimer . cancel ( ) ; <nl> + <nl> + const auto i = ranges : : find ( <nl> + _testConnections , <nl> + connection . get ( ) , <nl> + [ ] ( const TestConnection & test ) { return test . data . get ( ) ; } ) ; <nl> + Assert ( i ! = end ( _testConnections ) ) ; <nl> + const auto my = i - > priority ; <nl> + const auto j = ranges : : find_if ( <nl> + _testConnections , <nl> + [ & ] ( const TestConnection & test ) { return test . priority > my ; } ) ; <nl> + if ( j ! = end ( _testConnections ) ) { <nl> + DEBUG_LOG ( ( " MTP Info : connection % 1 succeed , " <nl> + " waiting for % 2 . " ) . arg ( i - > data - > tag ( ) ) . arg ( j - > data - > tag ( ) ) ) ; <nl> + _waitForBetterTimer . callOnce ( kWaitForBetterTimeout ) ; <nl> + } else { <nl> + DEBUG_LOG ( ( " MTP Info : connection through IPv4 succeed . " ) ) ; <nl> + _waitForBetterTimer . cancel ( ) ; <nl> + _connection = std : : move ( i - > data ) ; <nl> + _testConnections . clear ( ) ; <nl> <nl> lockFinished . unlock ( ) ; <nl> - return restart ( ) ; <nl> + updateAuthKey ( ) ; <nl> } <nl> - <nl> - DEBUG_LOG ( ( " MTP Info : connection through IPv6 succeed , waiting IPv4 for % 1ms . " ) . arg ( MTPIPv4ConnectionWaitTimeout ) ) ; <nl> - <nl> - _waitForIPv4Timer . start ( MTPIPv4ConnectionWaitTimeout ) ; <nl> } <nl> <nl> - void ConnectionPrivate : : onDisconnected4 ( ) { <nl> - if ( _conn & & _conn = = _conn6 ) return ; / / disconnected the unused <nl> + void ConnectionPrivate : : onDisconnected ( <nl> + not_null < AbstractConnection * > connection ) { <nl> + removeTestConnection ( connection ) ; <nl> <nl> - if ( _conn | | ! _conn6 ) { <nl> - destroyAllConnections ( ) ; <nl> - restart ( ) ; <nl> + if ( _testConnections . empty ( ) ) { <nl> + if ( ! _connection | | _connection = = connection . get ( ) ) { <nl> + destroyAllConnections ( ) ; <nl> + restart ( ) ; <nl> + } <nl> } else { <nl> - destroyConnection ( _conn4 ) ; <nl> + confirmBestConnection ( ) ; <nl> } <nl> } <nl> <nl> - void ConnectionPrivate : : onDisconnected6 ( ) { <nl> - if ( _conn & & _conn = = _conn4 ) return ; / / disconnected the unused <nl> - <nl> - if ( _conn | | ! _conn4 ) { <nl> - destroyAllConnections ( ) ; <nl> - restart ( ) ; <nl> - } else { <nl> - destroyConnection ( _conn6 ) ; <nl> + void ConnectionPrivate : : confirmBestConnection ( ) { <nl> + if ( _waitForBetterTimer . isActive ( ) ) { <nl> + return ; <nl> } <nl> + const auto i = ranges : : max_element ( <nl> + _testConnections , <nl> + std : : less < > ( ) , <nl> + [ ] ( const TestConnection & test ) { <nl> + return test . data - > isConnected ( ) ? test . priority : - 1 ; <nl> + } ) ; <nl> + Assert ( i ! = end ( _testConnections ) ) ; <nl> + if ( ! i - > data - > isConnected ( ) ) { <nl> + return ; <nl> + } <nl> + <nl> + DEBUG_LOG ( ( " MTP Info : can ' t connect through better , using % 1 . " <nl> + ) . arg ( i - > data - > tag ( ) ) ) ; <nl> + <nl> + _connection = std : : move ( i - > data ) ; <nl> + _testConnections . clear ( ) ; <nl> + <nl> + updateAuthKey ( ) ; <nl> + } <nl> + <nl> + void ConnectionPrivate : : removeTestConnection ( <nl> + not_null < AbstractConnection * > connection ) { <nl> + _testConnections . erase ( <nl> + ranges : : remove ( <nl> + _testConnections , <nl> + connection . get ( ) , <nl> + [ ] ( const TestConnection & test ) { return test . data . get ( ) ; } ) , <nl> + end ( _testConnections ) ) ; <nl> } <nl> <nl> void ConnectionPrivate : : updateAuthKey ( ) { <nl> QReadLocker lockFinished ( & sessionDataMutex ) ; <nl> - if ( ! sessionData | | ! _conn ) return ; <nl> + if ( ! sessionData | | ! _connection ) return ; <nl> <nl> _configWasFineAt = getms ( true ) ; <nl> <nl> void ConnectionPrivate : : updateAuthKey ( ) { <nl> MTPReq_pq_multi req_pq ; <nl> req_pq . vnonce = _authKeyData - > nonce ; <nl> <nl> - connect ( _conn , SIGNAL ( receivedData ( ) ) , this , SLOT ( pqAnswered ( ) ) ) ; <nl> + connect ( _connection , & AbstractConnection : : receivedData , [ = ] { <nl> + pqAnswered ( ) ; <nl> + } ) ; <nl> <nl> DEBUG_LOG ( ( " AuthKey Info : sending Req_pq . . . " ) ) ; <nl> lockFinished . unlock ( ) ; <nl> void ConnectionPrivate : : updateAuthKey ( ) { <nl> } <nl> <nl> void ConnectionPrivate : : clearMessages ( ) { <nl> - if ( keyId & & keyId ! = kRecreateKeyId & & _conn ) { <nl> - _conn - > received ( ) . clear ( ) ; <nl> + if ( keyId & & keyId ! = kRecreateKeyId & & _connection ) { <nl> + _connection - > received ( ) . clear ( ) ; <nl> } <nl> } <nl> <nl> void ConnectionPrivate : : pqAnswered ( ) { <nl> - disconnect ( _conn , SIGNAL ( receivedData ( ) ) , this , SLOT ( pqAnswered ( ) ) ) ; <nl> + disconnect ( _connection , & AbstractConnection : : receivedData , nullptr , nullptr ) ; <nl> DEBUG_LOG ( ( " AuthKey Info : receiving Req_pq answer . . . " ) ) ; <nl> <nl> MTPReq_pq : : ResponseType res_pq ; <nl> void ConnectionPrivate : : pqAnswered ( ) { <nl> return restart ( ) ; <nl> } <nl> <nl> - connect ( _conn , SIGNAL ( receivedData ( ) ) , this , SLOT ( dhParamsAnswered ( ) ) ) ; <nl> + connect ( _connection , & AbstractConnection : : receivedData , [ = ] { <nl> + dhParamsAnswered ( ) ; <nl> + } ) ; <nl> <nl> DEBUG_LOG ( ( " AuthKey Info : sending Req_DH_params . . . " ) ) ; <nl> <nl> base : : byte_vector ConnectionPrivate : : encryptPQInnerRSA ( const MTPP_Q_inner_data & <nl> } <nl> <nl> void ConnectionPrivate : : dhParamsAnswered ( ) { <nl> - disconnect ( _conn , SIGNAL ( receivedData ( ) ) , this , SLOT ( dhParamsAnswered ( ) ) ) ; <nl> + disconnect ( _connection , & AbstractConnection : : receivedData , nullptr , nullptr ) ; <nl> DEBUG_LOG ( ( " AuthKey Info : receiving Req_DH_params answer . . . " ) ) ; <nl> <nl> MTPReq_DH_params : : ResponseType res_DH_params ; <nl> void ConnectionPrivate : : dhClientParamsSend ( ) { <nl> <nl> auto sdhEncString = encryptClientDHInner ( client_dh_inner ) ; <nl> <nl> - connect ( _conn , SIGNAL ( receivedData ( ) ) , this , SLOT ( dhClientParamsAnswered ( ) ) ) ; <nl> + connect ( _connection , & AbstractConnection : : receivedData , [ = ] { <nl> + dhClientParamsAnswered ( ) ; <nl> + } ) ; <nl> <nl> MTPSet_client_DH_params req_client_DH_params ; <nl> req_client_DH_params . vnonce = _authKeyData - > nonce ; <nl> void ConnectionPrivate : : dhClientParamsAnswered ( ) { <nl> QReadLocker lockFinished ( & sessionDataMutex ) ; <nl> if ( ! sessionData ) return ; <nl> <nl> - disconnect ( _conn , SIGNAL ( receivedData ( ) ) , this , SLOT ( dhClientParamsAnswered ( ) ) ) ; <nl> + disconnect ( _connection , & AbstractConnection : : receivedData , nullptr , nullptr ) ; <nl> DEBUG_LOG ( ( " AuthKey Info : receiving Req_client_DH_params answer . . . " ) ) ; <nl> <nl> MTPSet_client_DH_params : : ResponseType res_client_DH_params ; <nl> void ConnectionPrivate : : dhClientParamsAnswered ( ) { <nl> void ConnectionPrivate : : authKeyCreated ( ) { <nl> clearAuthKeyData ( ) ; <nl> <nl> - connect ( _conn , SIGNAL ( receivedData ( ) ) , this , SLOT ( handleReceived ( ) ) ) ; <nl> + connect ( _connection , & AbstractConnection : : receivedData , [ = ] { <nl> + handleReceived ( ) ; <nl> + } ) ; <nl> <nl> if ( sessionData - > getSalt ( ) ) { / / else receive salt in bad_server_salt first , then try to send all the requests <nl> setState ( ConnectedState ) ; <nl> void ConnectionPrivate : : clearAuthKeyData ( ) { <nl> } <nl> } <nl> <nl> - void ConnectionPrivate : : onError4 ( qint32 errorCode ) { <nl> - if ( _conn & & _conn = = _conn6 ) return ; / / error in the unused <nl> - <nl> - if ( errorCode = = - 429 ) { <nl> - LOG ( ( " Protocol Error : - 429 flood code returned ! " ) ) ; <nl> - } <nl> - if ( _conn | | ! _conn6 ) { <nl> - handleError ( errorCode ) ; <nl> - } else { <nl> - destroyConnection ( _conn4 ) ; <nl> + void ConnectionPrivate : : onError ( <nl> + not_null < AbstractConnection * > connection , <nl> + qint32 errorCode ) { <nl> + if ( _connection ) { <nl> + return ; <nl> } <nl> - } <nl> - <nl> - void ConnectionPrivate : : onError6 ( qint32 errorCode ) { <nl> - if ( _conn & & _conn = = _conn4 ) return ; / / error in the unused <nl> <nl> if ( errorCode = = - 429 ) { <nl> LOG ( ( " Protocol Error : - 429 flood code returned ! " ) ) ; <nl> } <nl> - if ( _conn | | ! _conn4 ) { <nl> - handleError ( errorCode ) ; <nl> + removeTestConnection ( connection ) ; <nl> + <nl> + if ( _testConnections . empty ( ) ) { <nl> + if ( ! _connection | | _connection = = connection . get ( ) ) { <nl> + handleError ( errorCode ) ; <nl> + } <nl> } else { <nl> - destroyConnection ( _conn6 ) ; <nl> + confirmBestConnection ( ) ; <nl> } <nl> } <nl> <nl> void ConnectionPrivate : : handleError ( int errorCode ) { <nl> destroyAllConnections ( ) ; <nl> - _waitForConnectedTimer . stop ( ) ; <nl> + _waitForConnectedTimer . cancel ( ) ; <nl> <nl> if ( errorCode = = - 404 ) { <nl> if ( _instance - > isKeysDestroyer ( ) ) { <nl> void ConnectionPrivate : : sendRequestNotSecure ( const TRequest & request ) { <nl> <nl> DEBUG_LOG ( ( " AuthKey Info : sending request , size : % 1 , num : % 2 , time : % 3 " ) . arg ( requestSize ) . arg ( _authKeyData - > req_num ) . arg ( buffer [ 5 ] ) ) ; <nl> <nl> - _conn - > sendData ( buffer ) ; <nl> + _connection - > sendData ( buffer ) ; <nl> <nl> onSentSome ( buffer . size ( ) * sizeof ( mtpPrime ) ) ; <nl> <nl> bool ConnectionPrivate : : readResponseNotSecure ( TResponse & response ) { <nl> onReceivedSome ( ) ; <nl> <nl> try { <nl> - if ( _conn - > received ( ) . empty ( ) ) { <nl> + if ( _connection - > received ( ) . empty ( ) ) { <nl> LOG ( ( " AuthKey Error : trying to read response from empty received list " ) ) ; <nl> return false ; <nl> } <nl> <nl> - auto buffer = std : : move ( _conn - > received ( ) . front ( ) ) ; <nl> - _conn - > received ( ) . pop_front ( ) ; <nl> + auto buffer = std : : move ( _connection - > received ( ) . front ( ) ) ; <nl> + _connection - > received ( ) . pop_front ( ) ; <nl> <nl> auto answer = buffer . constData ( ) ; <nl> auto len = buffer . size ( ) ; <nl> bool ConnectionPrivate : : sendRequest ( mtpRequest & request , bool needAnyResponse , Q <nl> <nl> DEBUG_LOG ( ( " MTP Info : sending request , size : % 1 , num : % 2 , time : % 3 " ) . arg ( fullSize + 6 ) . arg ( ( * request ) [ 4 ] ) . arg ( ( * request ) [ 5 ] ) ) ; <nl> <nl> - _conn - > setSentEncrypted ( ) ; <nl> - _conn - > sendData ( result ) ; <nl> + _connection - > setSentEncrypted ( ) ; <nl> + _connection - > sendData ( result ) ; <nl> <nl> if ( needAnyResponse ) { <nl> onSentSome ( result . size ( ) * sizeof ( mtpPrime ) ) ; <nl> void ConnectionPrivate : : unlockKey ( ) { <nl> <nl> ConnectionPrivate : : ~ ConnectionPrivate ( ) { <nl> clearAuthKeyData ( ) ; <nl> - Assert ( _finished & & _conn = = nullptr & & _conn4 = = nullptr & & _conn6 = = nullptr ) ; <nl> + Assert ( _finished & & _connection = = nullptr & & _testConnections . empty ( ) ) ; <nl> } <nl> <nl> void ConnectionPrivate : : stop ( ) { <nl> mmm a / Telegram / SourceFiles / mtproto / connection . h <nl> ppp b / Telegram / SourceFiles / mtproto / connection . h <nl> For license and copyright information please follow this link : <nl> <nl> # include " mtproto / auth_key . h " <nl> # include " mtproto / dc_options . h " <nl> - # include " core / single_timer . h " <nl> + # include " mtproto / connection_abstract . h " <nl> + # include " base / timer . h " <nl> <nl> namespace MTP { <nl> <nl> class Connection { <nl> HttpConnection <nl> } ; <nl> <nl> - Connection ( Instance * instance ) ; <nl> + Connection ( not_null < Instance * > instance ) ; <nl> <nl> void start ( SessionData * data , ShiftedDcId shiftedDcId ) ; <nl> <nl> class Connection { <nl> QString transport ( ) const ; <nl> <nl> private : <nl> - Instance * _instance = nullptr ; <nl> - std : : unique_ptr < QThread > thread ; <nl> - ConnectionPrivate * data = nullptr ; <nl> + not_null < Instance * > _instance ; <nl> + std : : unique_ptr < QThread > _thread ; <nl> + ConnectionPrivate * _private = nullptr ; <nl> <nl> } ; <nl> <nl> class ConnectionPrivate : public QObject { <nl> Q_OBJECT <nl> <nl> public : <nl> - ConnectionPrivate ( Instance * instance , QThread * thread , Connection * owner , SessionData * data , ShiftedDcId shiftedDcId ) ; <nl> + ConnectionPrivate ( <nl> + not_null < Instance * > instance , <nl> + not_null < QThread * > thread , <nl> + not_null < Connection * > owner , <nl> + not_null < SessionData * > data , <nl> + ShiftedDcId shiftedDcId ) ; <nl> ~ ConnectionPrivate ( ) ; <nl> <nl> void stop ( ) ; <nl> class ConnectionPrivate : public QObject { <nl> void finished ( internal : : Connection * connection ) ; <nl> <nl> public slots : <nl> - void retryByTimer ( ) ; <nl> void restartNow ( ) ; <nl> <nl> - void onPingSender ( ) ; <nl> void onPingSendForce ( ) ; <nl> <nl> - void onWaitConnectedFailed ( ) ; <nl> - void onWaitReceivedFailed ( ) ; <nl> - void onWaitIPv4Failed ( ) ; <nl> - <nl> - void onOldConnection ( ) ; <nl> void onSentSome ( uint64 size ) ; <nl> void onReceivedSome ( ) ; <nl> <nl> void onReadyData ( ) ; <nl> <nl> - void onConnected4 ( ) ; <nl> - void onConnected6 ( ) ; <nl> - void onDisconnected4 ( ) ; <nl> - void onDisconnected6 ( ) ; <nl> - void onError4 ( qint32 errorCode ) ; <nl> - void onError6 ( qint32 errorCode ) ; <nl> - <nl> / / Auth key creation packet receive slots <nl> void pqAnswered ( ) ; <nl> void dhParamsAnswered ( ) ; <nl> public slots : <nl> void onCDNConfigLoaded ( ) ; <nl> <nl> private : <nl> + struct TestConnection { <nl> + ConnectionPointer data ; <nl> + int priority = 0 ; <nl> + } ; <nl> void connectToServer ( bool afterConfig = false ) ; <nl> void doDisconnect ( ) ; <nl> void restart ( ) ; <nl> void finishAndDestroy ( ) ; <nl> void requestCDNConfig ( ) ; <nl> void handleError ( int errorCode ) ; <nl> + void onError ( <nl> + not_null < AbstractConnection * > connection , <nl> + qint32 errorCode ) ; <nl> + void onConnected ( not_null < AbstractConnection * > connection ) ; <nl> + void onDisconnected ( not_null < AbstractConnection * > connection ) ; <nl> + <nl> + void retryByTimer ( ) ; <nl> + void waitConnectedFailed ( ) ; <nl> + void waitReceivedFailed ( ) ; <nl> + void waitBetterFailed ( ) ; <nl> + void markConnectionOld ( ) ; <nl> + void sendPingByTimer ( ) ; <nl> <nl> - void createConn ( bool createIPv4 , bool createIPv6 ) ; <nl> void destroyAllConnections ( ) ; <nl> - void destroyConnection ( AbstractConnection * & connection ) ; <nl> + void confirmBestConnection ( ) ; <nl> + void removeTestConnection ( not_null < AbstractConnection * > connection ) ; <nl> <nl> mtpMsgId placeToContainer ( mtpRequest & toSendRequest , mtpMsgId & bigMsgId , mtpMsgId * & haveSentArr , mtpRequest & req ) ; <nl> mtpMsgId prepareToSend ( mtpRequest & request , mtpMsgId currentLastId ) ; <nl> public slots : <nl> <nl> base : : byte_vector encryptPQInnerRSA ( const MTPP_Q_inner_data & data , const MTP : : internal : : RSAPublicKey & key ) ; <nl> std : : string encryptClientDHInner ( const MTPClient_DH_Inner_Data & data ) ; <nl> + void appendTestConnection ( <nl> + DcOptions : : Variants : : Protocol protocol , <nl> + const QString & ip , <nl> + int port , <nl> + const bytes : : vector & protocolSecret ) ; <nl> + <nl> + / / if badTime received - search for ids in sessionData - > haveSent and sessionData - > wereAcked and sync time / salt , return true if found <nl> + bool requestsFixTimeSalt ( const QVector < MTPlong > & ids , int32 serverTime , uint64 serverSalt ) ; <nl> + <nl> + / / remove msgs with such ids from sessionData - > haveSent , add to sessionData - > wereAcked <nl> + void requestsAcked ( const QVector < MTPlong > & ids , bool byResponse = false ) ; <nl> + <nl> + void resend ( quint64 msgId , qint64 msCanWait = 0 , bool forceContainer = false , bool sendMsgStateInfo = false ) ; <nl> + void resendMany ( QVector < quint64 > msgIds , qint64 msCanWait = 0 , bool forceContainer = false , bool sendMsgStateInfo = false ) ; <nl> + <nl> + template < typename TRequest > <nl> + void sendRequestNotSecure ( const TRequest & request ) ; <nl> + <nl> + template < typename TResponse > <nl> + bool readResponseNotSecure ( TResponse & response ) ; <nl> <nl> Instance * _instance = nullptr ; <nl> DcType _dcType = DcType : : Regular ; <nl> public slots : <nl> void resetSession ( ) ; <nl> <nl> ShiftedDcId _shiftedDcId = 0 ; <nl> - Connection * _owner = nullptr ; <nl> - AbstractConnection * _conn = nullptr ; <nl> - AbstractConnection * _conn4 = nullptr ; <nl> - AbstractConnection * _conn6 = nullptr ; <nl> + not_null < Connection * > _owner ; <nl> + ConnectionPointer _connection ; <nl> + std : : vector < TestConnection > _testConnections ; <nl> TimeMs _configWasFineAt = 0 ; <nl> <nl> - SingleTimer retryTimer ; / / exp retry timer <nl> - int retryTimeout = 1 ; <nl> - qint64 retryWillFinish ; <nl> + base : : Timer _retryTimer ; / / exp retry timer <nl> + int _retryTimeout = 1 ; <nl> + qint64 _retryWillFinish = 0 ; <nl> <nl> - SingleTimer oldConnectionTimer ; <nl> - bool oldConnection = true ; <nl> + base : : Timer _oldConnectionTimer ; <nl> + bool _oldConnection = true ; <nl> <nl> - SingleTimer _waitForConnectedTimer , _waitForReceivedTimer , _waitForIPv4Timer ; <nl> - uint32 _waitForReceived , _waitForConnected ; <nl> + base : : Timer _waitForConnectedTimer ; <nl> + base : : Timer _waitForReceivedTimer ; <nl> + base : : Timer _waitForBetterTimer ; <nl> + uint32 _waitForReceived = 0 ; <nl> + uint32 _waitForConnected = 0 ; <nl> TimeMs firstSentAt = - 1 ; <nl> <nl> QVector < MTPlong > ackRequestData , resendRequestData ; <nl> <nl> - / / if badTime received - search for ids in sessionData - > haveSent and sessionData - > wereAcked and sync time / salt , return true if found <nl> - bool requestsFixTimeSalt ( const QVector < MTPlong > & ids , int32 serverTime , uint64 serverSalt ) ; <nl> - <nl> - / / remove msgs with such ids from sessionData - > haveSent , add to sessionData - > wereAcked <nl> - void requestsAcked ( const QVector < MTPlong > & ids , bool byResponse = false ) ; <nl> - <nl> mtpPingId _pingId = 0 ; <nl> mtpPingId _pingIdToSend = 0 ; <nl> TimeMs _pingSendAt = 0 ; <nl> mtpMsgId _pingMsgId = 0 ; <nl> - SingleTimer _pingSender ; <nl> - <nl> - void resend ( quint64 msgId , qint64 msCanWait = 0 , bool forceContainer = false , bool sendMsgStateInfo = false ) ; <nl> - void resendMany ( QVector < quint64 > msgIds , qint64 msCanWait = 0 , bool forceContainer = false , bool sendMsgStateInfo = false ) ; <nl> - <nl> - template < typename TRequest > <nl> - void sendRequestNotSecure ( const TRequest & request ) ; <nl> - <nl> - template < typename TResponse > <nl> - bool readResponseNotSecure ( TResponse & response ) ; <nl> + base : : Timer _pingSender ; <nl> <nl> bool restarted = false ; <nl> bool _finished = false ; <nl> mmm a / Telegram / SourceFiles / mtproto / connection_abstract . cpp <nl> ppp b / Telegram / SourceFiles / mtproto / connection_abstract . cpp <nl> For license and copyright information please follow this link : <nl> <nl> # include " mtproto / connection_tcp . h " <nl> # include " mtproto / connection_http . h " <nl> - # include " mtproto / connection_auto . h " <nl> # include " mtproto / session . h " <nl> <nl> namespace MTP { <nl> namespace internal { <nl> <nl> + ConnectionPointer : : ConnectionPointer ( ) = default ; <nl> + <nl> + ConnectionPointer : : ConnectionPointer ( std : : nullptr_t ) { <nl> + } <nl> + <nl> + ConnectionPointer : : ConnectionPointer ( AbstractConnection * value ) <nl> + : _value ( value ) { <nl> + } <nl> + <nl> + ConnectionPointer : : ConnectionPointer ( ConnectionPointer & & other ) <nl> + : _value ( base : : take ( other . _value ) ) { <nl> + } <nl> + <nl> + ConnectionPointer & ConnectionPointer : : operator = ( ConnectionPointer & & other ) { <nl> + reset ( base : : take ( other . _value ) ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + AbstractConnection * ConnectionPointer : : get ( ) const { <nl> + return _value ; <nl> + } <nl> + <nl> + void ConnectionPointer : : reset ( AbstractConnection * value ) { <nl> + if ( _value = = value ) { <nl> + return ; <nl> + } else if ( const auto old = base : : take ( _value ) ) { <nl> + const auto disconnect = [ & ] ( auto signal ) { <nl> + old - > disconnect ( old , signal , nullptr , nullptr ) ; <nl> + } ; <nl> + disconnect ( & AbstractConnection : : receivedData ) ; <nl> + disconnect ( & AbstractConnection : : receivedSome ) ; <nl> + disconnect ( & AbstractConnection : : error ) ; <nl> + disconnect ( & AbstractConnection : : connected ) ; <nl> + disconnect ( & AbstractConnection : : disconnected ) ; <nl> + old - > disconnectFromServer ( ) ; <nl> + old - > deleteLater ( ) ; <nl> + } <nl> + _value = value ; <nl> + } <nl> + <nl> + ConnectionPointer : : operator AbstractConnection * ( ) const { <nl> + return get ( ) ; <nl> + } <nl> + <nl> + AbstractConnection * ConnectionPointer : : operator - > ( ) const { <nl> + return get ( ) ; <nl> + } <nl> + <nl> + AbstractConnection & ConnectionPointer : : operator * ( ) const { <nl> + return * get ( ) ; <nl> + } <nl> + <nl> + ConnectionPointer : : operator bool ( ) const { <nl> + return get ( ) ! = nullptr ; <nl> + } <nl> + <nl> + ConnectionPointer : : ~ ConnectionPointer ( ) { <nl> + reset ( ) ; <nl> + } <nl> + <nl> AbstractConnection : : ~ AbstractConnection ( ) { <nl> } <nl> <nl> MTPResPQ AbstractConnection : : readPQFakeReply ( const mtpBuffer & buffer ) { <nl> return response ; <nl> } <nl> <nl> - AbstractConnection * AbstractConnection : : create ( <nl> - const ConnectionOptions & options , <nl> - ShiftedDcId shiftedDcId , <nl> - DcType type , <nl> + ConnectionPointer AbstractConnection : : create ( <nl> + DcOptions : : Variants : : Protocol protocol , <nl> QThread * thread ) { <nl> - const auto protocolDcId = ( type = = DcType : : MediaDownload ) <nl> - ? - MTP : : bareDcId ( shiftedDcId ) <nl> - : MTP : : bareDcId ( shiftedDcId ) ; <nl> - if ( ( type = = DcType : : Temporary ) | | ( ! options . useHttp ) ) { <nl> - return new TCPConnection ( thread , protocolDcId ) ; <nl> - } else if ( ! options . useTcp ) { <nl> - return new HTTPConnection ( thread ) ; <nl> + if ( protocol = = DcOptions : : Variants : : Tcp ) { <nl> + return ConnectionPointer ( new TCPConnection ( thread ) ) ; <nl> + } else { <nl> + return ConnectionPointer ( new HTTPConnection ( thread ) ) ; <nl> } <nl> - return new AutoConnection ( thread , protocolDcId ) ; <nl> } <nl> <nl> } / / namespace internal <nl> mmm a / Telegram / SourceFiles / mtproto / connection_abstract . h <nl> ppp b / Telegram / SourceFiles / mtproto / connection_abstract . h <nl> For license and copyright information please follow this link : <nl> # pragma once <nl> <nl> # include " mtproto / dc_options . h " <nl> + # include " base / bytes . h " <nl> <nl> namespace MTP { <nl> namespace internal { <nl> <nl> struct ConnectionOptions ; <nl> <nl> + class AbstractConnection ; <nl> + <nl> + class ConnectionPointer { <nl> + public : <nl> + ConnectionPointer ( ) ; <nl> + ConnectionPointer ( std : : nullptr_t ) ; <nl> + explicit ConnectionPointer ( AbstractConnection * value ) ; <nl> + ConnectionPointer ( ConnectionPointer & & other ) ; <nl> + ConnectionPointer & operator = ( ConnectionPointer & & other ) ; <nl> + <nl> + AbstractConnection * get ( ) const ; <nl> + void reset ( AbstractConnection * value = nullptr ) ; <nl> + operator AbstractConnection * ( ) const ; <nl> + AbstractConnection * operator - > ( ) const ; <nl> + AbstractConnection & operator * ( ) const ; <nl> + explicit operator bool ( ) const ; <nl> + <nl> + ~ ConnectionPointer ( ) ; <nl> + <nl> + private : <nl> + AbstractConnection * _value = nullptr ; <nl> + <nl> + } ; <nl> + <nl> class AbstractConnection : public QObject { <nl> Q_OBJECT <nl> <nl> class AbstractConnection : public QObject { <nl> virtual ~ AbstractConnection ( ) = 0 ; <nl> <nl> / / virtual constructor <nl> - static AbstractConnection * create ( <nl> - const ConnectionOptions & options , <nl> - ShiftedDcId shiftedDcId , <nl> - DcType type , <nl> + static ConnectionPointer create ( <nl> + DcOptions : : Variants : : Protocol protocol , <nl> QThread * thread ) ; <nl> <nl> void setSentEncrypted ( ) { <nl> class AbstractConnection : public QObject { <nl> <nl> virtual void sendData ( mtpBuffer & buffer ) = 0 ; / / has size + 3 , buffer [ 0 ] = len , buffer [ 1 ] = packetnum , buffer [ last ] = crc32 <nl> virtual void disconnectFromServer ( ) = 0 ; <nl> - virtual void connectTcp ( const DcOptions : : Endpoint & endpoint ) = 0 ; <nl> - virtual void connectHttp ( const DcOptions : : Endpoint & endpoint ) = 0 ; <nl> + virtual void connectToServer ( <nl> + const QString & ip , <nl> + int port , <nl> + const bytes : : vector & protocolSecret , <nl> + int16 protocolDcId ) = 0 ; <nl> virtual bool isConnected ( ) const = 0 ; <nl> virtual bool usingHttpWait ( ) { <nl> return false ; <nl> class AbstractConnection : public QObject { <nl> virtual int32 debugState ( ) const = 0 ; <nl> <nl> virtual QString transport ( ) const = 0 ; <nl> + virtual QString tag ( ) const = 0 ; <nl> <nl> using BuffersQueue = std : : deque < mtpBuffer > ; <nl> BuffersQueue & received ( ) { <nl> deleted file mode 100644 <nl> index 87f895c3d7c . . 00000000000 <nl> mmm a / Telegram / SourceFiles / mtproto / connection_auto . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - This file is part of Telegram Desktop , <nl> - the official desktop application for the Telegram messaging service . <nl> - <nl> - For license and copyright information please follow this link : <nl> - https : / / github . com / telegramdesktop / tdesktop / blob / master / LEGAL <nl> - * / <nl> - # include " mtproto / connection_auto . h " <nl> - <nl> - # include " mtproto / connection_http . h " <nl> - <nl> - namespace MTP { <nl> - namespace internal { <nl> - <nl> - AutoConnection : : AutoConnection ( QThread * thread , int16 protocolDcId ) <nl> - : AbstractTCPConnection ( thread , protocolDcId ) <nl> - , status ( WaitingBoth ) <nl> - , tcpNonce ( rand_value < MTPint128 > ( ) ) <nl> - , httpNonce ( rand_value < MTPint128 > ( ) ) <nl> - , _flagsTcp ( 0 ) <nl> - , _flagsHttp ( 0 ) <nl> - , _tcpTimeout ( MTPMinReceiveDelay ) { <nl> - manager . moveToThread ( thread ) ; <nl> - <nl> - httpStartTimer . moveToThread ( thread ) ; <nl> - httpStartTimer . setSingleShot ( true ) ; <nl> - connect ( & httpStartTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( onHttpStart ( ) ) ) ; <nl> - <nl> - tcpTimeoutTimer . moveToThread ( thread ) ; <nl> - tcpTimeoutTimer . setSingleShot ( true ) ; <nl> - connect ( & tcpTimeoutTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( onTcpTimeoutTimer ( ) ) ) ; <nl> - <nl> - sock . moveToThread ( thread ) ; <nl> - connect ( & sock , SIGNAL ( error ( QAbstractSocket : : SocketError ) ) , this , SLOT ( socketError ( QAbstractSocket : : SocketError ) ) ) ; <nl> - connect ( & sock , SIGNAL ( connected ( ) ) , this , SLOT ( onSocketConnected ( ) ) ) ; <nl> - connect ( & sock , SIGNAL ( disconnected ( ) ) , this , SLOT ( onSocketDisconnected ( ) ) ) ; <nl> - } <nl> - <nl> - void AutoConnection : : onHttpStart ( ) { <nl> - if ( status = = HttpReady ) { <nl> - DEBUG_LOG ( ( " Connection Info : HTTP / % 1 - transport chosen by timer " ) . arg ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - status = UsingHttp ; <nl> - sock . disconnectFromHost ( ) ; <nl> - emit connected ( ) ; <nl> - } <nl> - } <nl> - <nl> - void AutoConnection : : onSocketConnected ( ) { <nl> - if ( status = = HttpReady | | status = = WaitingBoth | | status = = WaitingTcp ) { <nl> - mtpBuffer buffer ( preparePQFake ( tcpNonce ) ) ; <nl> - <nl> - DEBUG_LOG ( ( " Connection Info : sending fake req_pq through TCP / % 1 transport " ) . arg ( ( _flagsTcp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - <nl> - if ( _tcpTimeout < 0 ) _tcpTimeout = - _tcpTimeout ; <nl> - tcpTimeoutTimer . start ( _tcpTimeout ) ; <nl> - <nl> - tcpSend ( buffer ) ; <nl> - } else if ( status = = WaitingHttp | | status = = UsingHttp ) { <nl> - sock . disconnectFromHost ( ) ; <nl> - } <nl> - } <nl> - <nl> - void AutoConnection : : onTcpTimeoutTimer ( ) { <nl> - if ( status = = HttpReady | | status = = WaitingBoth | | status = = WaitingTcp ) { <nl> - if ( _tcpTimeout < MTPMaxReceiveDelay ) _tcpTimeout * = 2 ; <nl> - _tcpTimeout = - _tcpTimeout ; <nl> - <nl> - QAbstractSocket : : SocketState state = sock . state ( ) ; <nl> - if ( state = = QAbstractSocket : : ConnectedState | | state = = QAbstractSocket : : ConnectingState | | state = = QAbstractSocket : : HostLookupState ) { <nl> - sock . disconnectFromHost ( ) ; <nl> - } else if ( state ! = QAbstractSocket : : ClosingState ) { <nl> - sock . connectToHost ( QHostAddress ( _addrTcp ) , _portTcp ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void AutoConnection : : onSocketDisconnected ( ) { <nl> - if ( _tcpTimeout < 0 ) { <nl> - _tcpTimeout = - _tcpTimeout ; <nl> - if ( status = = HttpReady | | status = = WaitingBoth | | status = = WaitingTcp ) { <nl> - sock . connectToHost ( QHostAddress ( _addrTcp ) , _portTcp ) ; <nl> - return ; <nl> - } <nl> - } <nl> - if ( status = = WaitingBoth ) { <nl> - status = WaitingHttp ; <nl> - } else if ( status = = WaitingTcp | | status = = UsingTcp ) { <nl> - emit disconnected ( ) ; <nl> - } else if ( status = = HttpReady ) { <nl> - DEBUG_LOG ( ( " Connection Info : HTTP / % 1 - transport chosen by socket disconnect " ) . arg ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - status = UsingHttp ; <nl> - emit connected ( ) ; <nl> - } <nl> - } <nl> - <nl> - void AutoConnection : : sendData ( mtpBuffer & buffer ) { <nl> - if ( status = = FinishedWork ) return ; <nl> - <nl> - if ( buffer . size ( ) < 3 ) { <nl> - LOG ( ( " TCP Error : writing bad packet , len = % 1 " ) . arg ( buffer . size ( ) * sizeof ( mtpPrime ) ) ) ; <nl> - TCP_LOG ( ( " TCP Error : bad packet % 1 " ) . arg ( Logs : : mb ( & buffer [ 0 ] , buffer . size ( ) * sizeof ( mtpPrime ) ) . str ( ) ) ) ; <nl> - emit error ( kErrorCodeOther ) ; <nl> - return ; <nl> - } <nl> - <nl> - if ( status = = UsingTcp ) { <nl> - tcpSend ( buffer ) ; <nl> - } else { <nl> - httpSend ( buffer ) ; <nl> - } <nl> - } <nl> - <nl> - void AutoConnection : : httpSend ( mtpBuffer & buffer ) { <nl> - int32 requestSize = ( buffer . size ( ) - 3 ) * sizeof ( mtpPrime ) ; <nl> - <nl> - QNetworkRequest request ( address ) ; <nl> - request . setHeader ( QNetworkRequest : : ContentLengthHeader , QVariant ( requestSize ) ) ; <nl> - request . setHeader ( QNetworkRequest : : ContentTypeHeader , QVariant ( qsl ( " application / x - www - form - urlencoded " ) ) ) ; <nl> - <nl> - TCP_LOG ( ( " HTTP Info : sending % 1 len request " ) . arg ( requestSize ) ) ; <nl> - requests . insert ( manager . post ( request , QByteArray ( ( const char * ) ( & buffer [ 2 ] ) , requestSize ) ) ) ; <nl> - } <nl> - <nl> - void AutoConnection : : disconnectFromServer ( ) { <nl> - if ( status = = FinishedWork ) return ; <nl> - status = FinishedWork ; <nl> - <nl> - Requests copy = requests ; <nl> - requests . clear ( ) ; <nl> - for ( Requests : : const_iterator i = copy . cbegin ( ) , e = copy . cend ( ) ; i ! = e ; + + i ) { <nl> - ( * i ) - > abort ( ) ; <nl> - ( * i ) - > deleteLater ( ) ; <nl> - } <nl> - <nl> - disconnect ( & manager , SIGNAL ( finished ( QNetworkReply * ) ) , this , SLOT ( requestFinished ( QNetworkReply * ) ) ) ; <nl> - <nl> - address = QUrl ( ) ; <nl> - <nl> - disconnect ( & sock , SIGNAL ( readyRead ( ) ) , 0 , 0 ) ; <nl> - sock . close ( ) ; <nl> - <nl> - httpStartTimer . stop ( ) ; <nl> - } <nl> - <nl> - void AutoConnection : : connectTcp ( const DcOptions : : Endpoint & endpoint ) { <nl> - _addrTcp = QString : : fromStdString ( endpoint . ip ) ; <nl> - _portTcp = endpoint . port ; <nl> - _flagsTcp = endpoint . flags ; <nl> - <nl> - connect ( & sock , SIGNAL ( readyRead ( ) ) , this , SLOT ( socketRead ( ) ) ) ; <nl> - sock . connectToHost ( QHostAddress ( _addrTcp ) , _portTcp ) ; <nl> - } <nl> - <nl> - void AutoConnection : : connectHttp ( const DcOptions : : Endpoint & endpoint ) { <nl> - _addrHttp = QString : : fromStdString ( endpoint . ip ) ; <nl> - _portHttp = endpoint . port ; <nl> - _flagsHttp = endpoint . flags ; <nl> - <nl> - / / not endpoint . port - always 80 port for http transport <nl> - address = QUrl ( ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? qsl ( " http : / / [ % 1 ] : % 2 / api " ) : qsl ( " http : / / % 1 : % 2 / api " ) ) . arg ( _addrHttp ) . arg ( 80 ) ) ; <nl> - TCP_LOG ( ( " HTTP Info : address is % 1 " ) . arg ( address . toDisplayString ( ) ) ) ; <nl> - connect ( & manager , SIGNAL ( finished ( QNetworkReply * ) ) , this , SLOT ( requestFinished ( QNetworkReply * ) ) ) ; <nl> - <nl> - mtpBuffer buffer ( preparePQFake ( httpNonce ) ) ; <nl> - <nl> - DEBUG_LOG ( ( " Connection Info : sending fake req_pq through HTTP / % 1 transport " ) . arg ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - <nl> - httpSend ( buffer ) ; <nl> - } <nl> - <nl> - bool AutoConnection : : isConnected ( ) const { <nl> - return ( status = = UsingTcp ) | | ( status = = UsingHttp ) ; <nl> - } <nl> - <nl> - void AutoConnection : : requestFinished ( QNetworkReply * reply ) { <nl> - if ( status = = FinishedWork ) return ; <nl> - <nl> - reply - > deleteLater ( ) ; <nl> - if ( reply - > error ( ) = = QNetworkReply : : NoError ) { <nl> - requests . remove ( reply ) ; <nl> - <nl> - mtpBuffer data = HTTPConnection : : handleResponse ( reply ) ; <nl> - if ( data . size ( ) = = 1 ) { <nl> - if ( status = = WaitingBoth ) { <nl> - status = WaitingTcp ; <nl> - } else { <nl> - emit error ( data [ 0 ] ) ; <nl> - } <nl> - } else if ( ! data . isEmpty ( ) ) { <nl> - if ( status = = UsingHttp ) { <nl> - _receivedQueue . push_back ( data ) ; <nl> - emit receivedData ( ) ; <nl> - } else if ( status = = WaitingBoth | | status = = WaitingHttp ) { <nl> - try { <nl> - auto res_pq = readPQFakeReply ( data ) ; <nl> - const auto & res_pq_data ( res_pq . c_resPQ ( ) ) ; <nl> - if ( res_pq_data . vnonce = = httpNonce ) { <nl> - if ( status = = WaitingBoth ) { <nl> - status = HttpReady ; <nl> - httpStartTimer . start ( MTPTcpConnectionWaitTimeout ) ; <nl> - } else { <nl> - DEBUG_LOG ( ( " Connection Info : HTTP / % 1 - transport chosen by pq - response , awaited " ) . arg ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - status = UsingHttp ; <nl> - sock . disconnectFromHost ( ) ; <nl> - emit connected ( ) ; <nl> - } <nl> - } <nl> - } catch ( Exception & e ) { <nl> - DEBUG_LOG ( ( " Connection Error : exception in parsing HTTP fake pq - responce , % 1 " ) . arg ( e . what ( ) ) ) ; <nl> - if ( status = = WaitingBoth ) { <nl> - status = WaitingTcp ; <nl> - } else { <nl> - emit error ( kErrorCodeOther ) ; <nl> - } <nl> - } <nl> - } else if ( status = = UsingTcp ) { <nl> - DEBUG_LOG ( ( " Connection Info : already using tcp , ignoring http response " ) ) ; <nl> - } <nl> - } <nl> - } else { <nl> - if ( ! requests . remove ( reply ) ) { <nl> - return ; <nl> - } <nl> - <nl> - if ( status = = WaitingBoth ) { <nl> - status = WaitingTcp ; <nl> - } else if ( status = = WaitingHttp | | status = = UsingHttp ) { <nl> - emit error ( HTTPConnection : : handleError ( reply ) ) ; <nl> - } else { <nl> - LOG ( ( " Strange Http Error : status % 1 " ) . arg ( status ) ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void AutoConnection : : socketPacket ( const char * packet , uint32 length ) { <nl> - if ( status = = FinishedWork ) return ; <nl> - <nl> - mtpBuffer data = AbstractTCPConnection : : handleResponse ( packet , length ) ; <nl> - if ( data . size ( ) = = 1 ) { <nl> - if ( status = = WaitingBoth ) { <nl> - status = WaitingHttp ; <nl> - sock . disconnectFromHost ( ) ; <nl> - } else if ( status = = HttpReady ) { <nl> - DEBUG_LOG ( ( " Connection Info : HTTP / % 1 - transport chosen by bad tcp response , ready " ) . arg ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - status = UsingHttp ; <nl> - sock . disconnectFromHost ( ) ; <nl> - emit connected ( ) ; <nl> - } else if ( status = = WaitingTcp | | status = = UsingTcp ) { <nl> - emit error ( data [ 0 ] ) ; <nl> - } else { <nl> - LOG ( ( " Strange Tcp Error ; status % 1 " ) . arg ( status ) ) ; <nl> - } <nl> - } else if ( status = = UsingTcp ) { <nl> - _receivedQueue . push_back ( data ) ; <nl> - emit receivedData ( ) ; <nl> - } else if ( status = = WaitingBoth | | status = = WaitingTcp | | status = = HttpReady ) { <nl> - tcpTimeoutTimer . stop ( ) ; <nl> - try { <nl> - auto res_pq = readPQFakeReply ( data ) ; <nl> - const auto & res_pq_data ( res_pq . c_resPQ ( ) ) ; <nl> - if ( res_pq_data . vnonce = = tcpNonce ) { <nl> - DEBUG_LOG ( ( " Connection Info : TCP / % 1 - transport chosen by pq - response " ) . arg ( ( _flagsTcp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - status = UsingTcp ; <nl> - emit connected ( ) ; <nl> - } <nl> - } catch ( Exception & e ) { <nl> - DEBUG_LOG ( ( " Connection Error : exception in parsing TCP fake pq - responce , % 1 " ) . arg ( e . what ( ) ) ) ; <nl> - if ( status = = WaitingBoth ) { <nl> - status = WaitingHttp ; <nl> - sock . disconnectFromHost ( ) ; <nl> - } else if ( status = = HttpReady ) { <nl> - DEBUG_LOG ( ( " Connection Info : HTTP / % 1 - transport chosen by bad tcp response , awaited " ) . arg ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - status = UsingHttp ; <nl> - sock . disconnectFromHost ( ) ; <nl> - emit connected ( ) ; <nl> - } else { <nl> - emit error ( kErrorCodeOther ) ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - bool AutoConnection : : usingHttpWait ( ) { <nl> - return ( status = = UsingHttp ) ; <nl> - } <nl> - <nl> - bool AutoConnection : : needHttpWait ( ) { <nl> - return ( status = = UsingHttp ) ? requests . isEmpty ( ) : false ; <nl> - } <nl> - <nl> - int32 AutoConnection : : debugState ( ) const { <nl> - return ( status = = UsingHttp ) ? - 1 : ( ( status = = UsingTcp ) ? sock . state ( ) : - 777 ) ; <nl> - } <nl> - <nl> - QString AutoConnection : : transport ( ) const { <nl> - if ( status = = UsingTcp ) { <nl> - return qsl ( " TCP " ) ; <nl> - } else if ( status = = UsingHttp ) { <nl> - return qsl ( " HTTP " ) ; <nl> - } else { <nl> - return QString ( ) ; <nl> - } <nl> - } <nl> - <nl> - void AutoConnection : : socketError ( QAbstractSocket : : SocketError e ) { <nl> - if ( status = = FinishedWork ) return ; <nl> - <nl> - AbstractTCPConnection : : handleError ( e , sock ) ; <nl> - if ( status = = WaitingBoth ) { <nl> - status = WaitingHttp ; <nl> - } else if ( status = = HttpReady ) { <nl> - DEBUG_LOG ( ( " Connection Info : HTTP / % 1 - transport chosen by tcp error , ready " ) . arg ( ( _flagsHttp & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> - status = UsingHttp ; <nl> - emit connected ( ) ; <nl> - } else if ( status = = WaitingTcp | | status = = UsingTcp ) { <nl> - emit error ( kErrorCodeOther ) ; <nl> - } else { <nl> - LOG ( ( " Strange Tcp Error : status % 1 " ) . arg ( status ) ) ; <nl> - } <nl> - } <nl> - <nl> - } / / namespace internal <nl> - } / / namespace MTP <nl> deleted file mode 100644 <nl> index b43afe9c4cf . . 00000000000 <nl> mmm a / Telegram / SourceFiles / mtproto / connection_auto . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - This file is part of Telegram Desktop , <nl> - the official desktop application for the Telegram messaging service . <nl> - <nl> - For license and copyright information please follow this link : <nl> - https : / / github . com / telegramdesktop / tdesktop / blob / master / LEGAL <nl> - * / <nl> - # pragma once <nl> - <nl> - # include " mtproto / connection_tcp . h " <nl> - <nl> - namespace MTP { <nl> - namespace internal { <nl> - <nl> - class AutoConnection : public AbstractTCPConnection { <nl> - Q_OBJECT <nl> - <nl> - public : <nl> - AutoConnection ( QThread * thread , int16 protocolDcId ) ; <nl> - <nl> - void sendData ( mtpBuffer & buffer ) override ; <nl> - void disconnectFromServer ( ) override ; <nl> - void connectTcp ( const DcOptions : : Endpoint & endpoint ) override ; <nl> - void connectHttp ( const DcOptions : : Endpoint & endpoint ) override ; <nl> - bool isConnected ( ) const override ; <nl> - bool usingHttpWait ( ) override ; <nl> - bool needHttpWait ( ) override ; <nl> - <nl> - int32 debugState ( ) const override ; <nl> - <nl> - QString transport ( ) const override ; <nl> - <nl> - public slots : <nl> - void socketError ( QAbstractSocket : : SocketError e ) ; <nl> - void requestFinished ( QNetworkReply * reply ) ; <nl> - <nl> - void onSocketConnected ( ) ; <nl> - void onSocketDisconnected ( ) ; <nl> - void onHttpStart ( ) ; <nl> - <nl> - void onTcpTimeoutTimer ( ) ; <nl> - <nl> - protected : <nl> - void socketPacket ( const char * packet , uint32 length ) override ; <nl> - <nl> - private : <nl> - void httpSend ( mtpBuffer & buffer ) ; <nl> - enum Status { <nl> - WaitingBoth = 0 , <nl> - WaitingHttp , <nl> - WaitingTcp , <nl> - HttpReady , <nl> - UsingHttp , <nl> - UsingTcp , <nl> - FinishedWork <nl> - } ; <nl> - Status status ; <nl> - MTPint128 tcpNonce , httpNonce ; <nl> - QTimer httpStartTimer ; <nl> - <nl> - QNetworkAccessManager manager ; <nl> - QUrl address ; <nl> - <nl> - typedef QSet < QNetworkReply * > Requests ; <nl> - Requests requests ; <nl> - <nl> - QString _addrTcp , _addrHttp ; <nl> - int32 _portTcp , _portHttp ; <nl> - MTPDdcOption : : Flags _flagsTcp , _flagsHttp ; <nl> - int32 _tcpTimeout ; <nl> - QTimer tcpTimeoutTimer ; <nl> - <nl> - } ; <nl> - <nl> - } / / namespace internal <nl> - } / / namespace MTP <nl> mmm a / Telegram / SourceFiles / mtproto / connection_http . cpp <nl> ppp b / Telegram / SourceFiles / mtproto / connection_http . cpp <nl> For license and copyright information please follow this link : <nl> * / <nl> # include " mtproto / connection_http . h " <nl> <nl> + # include " base / qthelp_url . h " <nl> + <nl> namespace MTP { <nl> namespace internal { <nl> + namespace { <nl> + <nl> + constexpr auto kForceHttpPort = 80 ; <nl> + <nl> + } / / namespace <nl> <nl> mtpBuffer HTTPConnection : : handleResponse ( QNetworkReply * reply ) { <nl> QByteArray response = reply - > readAll ( ) ; <nl> qint32 HTTPConnection : : handleError ( QNetworkReply * reply ) { / / returnes " maybe ba <nl> <nl> HTTPConnection : : HTTPConnection ( QThread * thread ) : AbstractConnection ( thread ) <nl> , status ( WaitingHttp ) <nl> - , httpNonce ( rand_value < MTPint128 > ( ) ) <nl> - , _flags ( 0 ) { <nl> + , httpNonce ( rand_value < MTPint128 > ( ) ) { <nl> manager . moveToThread ( thread ) ; <nl> } <nl> <nl> void HTTPConnection : : sendData ( mtpBuffer & buffer ) { <nl> <nl> int32 requestSize = ( buffer . size ( ) - 3 ) * sizeof ( mtpPrime ) ; <nl> <nl> - QNetworkRequest request ( address ) ; <nl> + QNetworkRequest request ( url ( ) ) ; <nl> request . setHeader ( QNetworkRequest : : ContentLengthHeader , QVariant ( requestSize ) ) ; <nl> request . setHeader ( QNetworkRequest : : ContentTypeHeader , QVariant ( qsl ( " application / x - www - form - urlencoded " ) ) ) ; <nl> <nl> void HTTPConnection : : disconnectFromServer ( ) { <nl> } <nl> <nl> disconnect ( & manager , SIGNAL ( finished ( QNetworkReply * ) ) , this , SLOT ( requestFinished ( QNetworkReply * ) ) ) ; <nl> - <nl> - address = QUrl ( ) ; <nl> } <nl> <nl> - void HTTPConnection : : connectHttp ( const DcOptions : : Endpoint & endpoint ) { <nl> - _flags = endpoint . flags ; <nl> - auto addr = QString : : fromStdString ( endpoint . ip ) ; <nl> - <nl> - / / not endpoint . port - always 80 port for http transport <nl> - address = QUrl ( ( ( _flags & MTPDdcOption : : Flag : : f_ipv6 ) ? qsl ( " http : / / [ % 1 ] : % 2 / api " ) : qsl ( " http : / / % 1 : % 2 / api " ) ) . arg ( addr ) . arg ( 80 ) ) ; <nl> - TCP_LOG ( ( " HTTP Info : address is % 1 " ) . arg ( address . toDisplayString ( ) ) ) ; <nl> + void HTTPConnection : : connectToServer ( <nl> + const QString & ip , <nl> + int port , <nl> + const bytes : : vector & protocolSecret , <nl> + int16 protocolDcId ) { <nl> + _address = ip ; <nl> + TCP_LOG ( ( " HTTP Info : address is % 1 " ) . arg ( url ( ) . toDisplayString ( ) ) ) ; <nl> connect ( & manager , SIGNAL ( finished ( QNetworkReply * ) ) , this , SLOT ( requestFinished ( QNetworkReply * ) ) ) ; <nl> <nl> mtpBuffer buffer ( preparePQFake ( httpNonce ) ) ; <nl> <nl> - DEBUG_LOG ( ( " Connection Info : sending fake req_pq through HTTP / % 1 transport " ) . arg ( ( _flags & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> + DEBUG_LOG ( ( " Connection Info : sending fake req_pq through HTTP transport to % 1 " ) . arg ( ip ) ) ; <nl> <nl> sendData ( buffer ) ; <nl> } <nl> void HTTPConnection : : requestFinished ( QNetworkReply * reply ) { <nl> auto res_pq = readPQFakeReply ( data ) ; <nl> const auto & res_pq_data ( res_pq . c_resPQ ( ) ) ; <nl> if ( res_pq_data . vnonce = = httpNonce ) { <nl> - DEBUG_LOG ( ( " Connection Info : HTTP / % 1 - transport connected by pq - response " ) . arg ( ( _flags & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> + DEBUG_LOG ( ( " Connection Info : HTTP - transport to % 1 connected by pq - response " ) . arg ( _address ) ) ; <nl> status = UsingHttp ; <nl> emit connected ( ) ; <nl> } <nl> int32 HTTPConnection : : debugState ( ) const { <nl> } <nl> <nl> QString HTTPConnection : : transport ( ) const { <nl> - if ( status = = UsingHttp ) { <nl> - return qsl ( " HTTP " ) ; <nl> - } else { <nl> + if ( ! isConnected ( ) ) { <nl> return QString ( ) ; <nl> } <nl> + auto result = qsl ( " HTTP " ) ; <nl> + if ( qthelp : : is_ipv6 ( _address ) ) { <nl> + result + = qsl ( " / IPv6 " ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> + QString HTTPConnection : : tag ( ) const { <nl> + auto result = qsl ( " HTTP " ) ; <nl> + if ( qthelp : : is_ipv6 ( _address ) ) { <nl> + result + = qsl ( " / IPv6 " ) ; <nl> + } else { <nl> + result + = qsl ( " / IPv4 " ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> + QUrl HTTPConnection : : url ( ) const { <nl> + const auto pattern = qthelp : : is_ipv6 ( _address ) <nl> + ? qsl ( " http : / / [ % 1 ] : % 2 / api " ) <nl> + : qsl ( " http : / / % 1 : % 2 / api " ) ; <nl> + <nl> + / / Not endpoint . port - always 80 port for http transport . <nl> + return QUrl ( pattern . arg ( _address ) . arg ( kForceHttpPort ) ) ; <nl> } <nl> <nl> } / / namespace internal <nl> mmm a / Telegram / SourceFiles / mtproto / connection_http . h <nl> ppp b / Telegram / SourceFiles / mtproto / connection_http . h <nl> class HTTPConnection : public AbstractConnection { <nl> <nl> void sendData ( mtpBuffer & buffer ) override ; <nl> void disconnectFromServer ( ) override ; <nl> - void connectTcp ( const DcOptions : : Endpoint & endpoint ) override { / / not supported <nl> - } <nl> - void connectHttp ( const DcOptions : : Endpoint & endpoint ) override ; <nl> + void connectToServer ( <nl> + const QString & ip , <nl> + int port , <nl> + const bytes : : vector & protocolSecret , <nl> + int16 protocolDcId ) override ; <nl> bool isConnected ( ) const override ; <nl> bool usingHttpWait ( ) override ; <nl> bool needHttpWait ( ) override ; <nl> class HTTPConnection : public AbstractConnection { <nl> int32 debugState ( ) const override ; <nl> <nl> QString transport ( ) const override ; <nl> + QString tag ( ) const override ; <nl> <nl> static mtpBuffer handleResponse ( QNetworkReply * reply ) ; <nl> static qint32 handleError ( QNetworkReply * reply ) ; / / returnes error code <nl> public slots : <nl> void requestFinished ( QNetworkReply * reply ) ; <nl> <nl> private : <nl> + QUrl url ( ) const ; <nl> + <nl> enum Status { <nl> WaitingHttp = 0 , <nl> UsingHttp , <nl> public slots : <nl> } ; <nl> Status status ; <nl> MTPint128 httpNonce ; <nl> - MTPDdcOption : : Flags _flags ; <nl> <nl> QNetworkAccessManager manager ; <nl> - QUrl address ; <nl> + QString _address ; <nl> <nl> typedef QSet < QNetworkReply * > Requests ; <nl> Requests requests ; <nl> mmm a / Telegram / SourceFiles / mtproto / connection_tcp . cpp <nl> ppp b / Telegram / SourceFiles / mtproto / connection_tcp . cpp <nl> For license and copyright information please follow this link : <nl> <nl> # include " base / bytes . h " <nl> # include " base / openssl_help . h " <nl> + # include " base / qthelp_url . h " <nl> # include < openssl / aes . h > <nl> <nl> namespace MTP { <nl> namespace internal { <nl> - <nl> namespace { <nl> <nl> + constexpr auto kMinReceiveTimeout = TimeMs ( 2000 ) ; <nl> + constexpr auto kMaxReceiveTimeout = TimeMs ( 8000 ) ; <nl> + <nl> uint32 tcpPacketSize ( const char * packet ) { / / must have at least 4 bytes readable <nl> uint32 result = ( packet [ 0 ] > 0 ) ? packet [ 0 ] : 0 ; <nl> if ( result = = 0x7f ) { <nl> uint32 tcpPacketSize ( const char * packet ) { / / must have at least 4 bytes readabl <nl> } / / namespace <nl> <nl> AbstractTCPConnection : : AbstractTCPConnection ( <nl> - QThread * thread , <nl> - int16 protocolDcId ) <nl> + QThread * thread ) <nl> : AbstractConnection ( thread ) <nl> - , _protocolDcId ( protocolDcId ) <nl> - , packetNum ( 0 ) <nl> - , packetRead ( 0 ) <nl> - , packetLeft ( 0 ) <nl> - , readingToShort ( true ) <nl> , currentPos ( ( char * ) shortBuffer ) { <nl> } <nl> <nl> void AbstractTCPConnection : : handleError ( QAbstractSocket : : SocketError e , QTcpSock <nl> TCP_LOG ( ( " TCP Error % 1 , restarting ! - % 2 " ) . arg ( e ) . arg ( sock . errorString ( ) ) ) ; <nl> } <nl> <nl> - TCPConnection : : TCPConnection ( QThread * thread , int16 protocolDcId ) <nl> - : AbstractTCPConnection ( thread , protocolDcId ) <nl> + TCPConnection : : TCPConnection ( QThread * thread ) <nl> + : AbstractTCPConnection ( thread ) <nl> , status ( WaitingTcp ) <nl> , tcpNonce ( rand_value < MTPint128 > ( ) ) <nl> - , _tcpTimeout ( MTPMinReceiveDelay ) <nl> - , _flags ( 0 ) { <nl> + , _tcpTimeout ( kMinReceiveTimeout ) { <nl> tcpTimeoutTimer . moveToThread ( thread ) ; <nl> tcpTimeoutTimer . setSingleShot ( true ) ; <nl> connect ( & tcpTimeoutTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( onTcpTimeoutTimer ( ) ) ) ; <nl> void TCPConnection : : onSocketConnected ( ) { <nl> if ( status = = WaitingTcp ) { <nl> mtpBuffer buffer ( preparePQFake ( tcpNonce ) ) ; <nl> <nl> - DEBUG_LOG ( ( " Connection Info : sending fake req_pq through TCP / % 1 transport " ) . arg ( ( _flags & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> + DEBUG_LOG ( ( " Connection Info : sending fake req_pq through TCP transport to % 1 " ) . arg ( _address ) ) ; <nl> <nl> if ( _tcpTimeout < 0 ) _tcpTimeout = - _tcpTimeout ; <nl> tcpTimeoutTimer . start ( _tcpTimeout ) ; <nl> void TCPConnection : : onSocketConnected ( ) { <nl> <nl> void TCPConnection : : onTcpTimeoutTimer ( ) { <nl> if ( status = = WaitingTcp ) { <nl> - if ( _tcpTimeout < MTPMaxReceiveDelay ) _tcpTimeout * = 2 ; <nl> + if ( _tcpTimeout < kMaxReceiveTimeout ) { <nl> + _tcpTimeout * = 2 ; <nl> + } <nl> _tcpTimeout = - _tcpTimeout ; <nl> <nl> QAbstractSocket : : SocketState state = sock . state ( ) ; <nl> if ( state = = QAbstractSocket : : ConnectedState | | state = = QAbstractSocket : : ConnectingState | | state = = QAbstractSocket : : HostLookupState ) { <nl> sock . disconnectFromHost ( ) ; <nl> } else if ( state ! = QAbstractSocket : : ClosingState ) { <nl> - sock . connectToHost ( QHostAddress ( _addr ) , _port ) ; <nl> + sock . connectToHost ( QHostAddress ( _address ) , _port ) ; <nl> } <nl> } <nl> } <nl> void TCPConnection : : onSocketDisconnected ( ) { <nl> if ( _tcpTimeout < 0 ) { <nl> _tcpTimeout = - _tcpTimeout ; <nl> if ( status = = WaitingTcp ) { <nl> - sock . connectToHost ( QHostAddress ( _addr ) , _port ) ; <nl> + sock . connectToHost ( QHostAddress ( _address ) , _port ) ; <nl> return ; <nl> } <nl> } <nl> void AbstractTCPConnection : : writeConnectionStart ( ) { <nl> | | * first = = reserved15 <nl> | | * second = = reserved21 ) ; <nl> <nl> + const auto prepareKey = [ & ] ( bytes : : span key , bytes : : const_span from ) { <nl> + if ( _protocolSecret . size ( ) = = 16 ) { <nl> + const auto payload = bytes : : concatenate ( from , _protocolSecret ) ; <nl> + bytes : : copy ( key , openssl : : Sha256 ( payload ) ) ; <nl> + } else if ( _protocolSecret . empty ( ) ) { <nl> + bytes : : copy ( key , from ) ; <nl> + } else { <nl> + bytes : : set_with_const ( key , gsl : : byte { } ) ; <nl> + } <nl> + } ; <nl> + <nl> / / prepare encryption key / iv <nl> - bytes : : copy ( <nl> + prepareKey ( <nl> bytes : : make_span ( _sendKey ) , <nl> nonce . subspan ( 8 , CTRState : : KeySize ) ) ; <nl> bytes : : copy ( <nl> void AbstractTCPConnection : : writeConnectionStart ( ) { <nl> const auto reversed = bytes : : make_span ( reversedBytes ) ; <nl> bytes : : copy ( reversed , nonce . subspan ( 8 , reversed . size ( ) ) ) ; <nl> std : : reverse ( reversed . begin ( ) , reversed . end ( ) ) ; <nl> - bytes : : copy ( <nl> + prepareKey ( <nl> bytes : : make_span ( _receiveKey ) , <nl> reversed . subspan ( 0 , CTRState : : KeySize ) ) ; <nl> bytes : : copy ( <nl> void TCPConnection : : disconnectFromServer ( ) { <nl> sock . close ( ) ; <nl> } <nl> <nl> - void TCPConnection : : connectTcp ( const DcOptions : : Endpoint & endpoint ) { <nl> - _addr = QString : : fromStdString ( endpoint . ip ) ; <nl> - _port = endpoint . port ; <nl> - _flags = endpoint . flags ; <nl> + void TCPConnection : : connectToServer ( <nl> + const QString & ip , <nl> + int port , <nl> + const bytes : : vector & protocolSecret , <nl> + int16 protocolDcId ) { <nl> + _address = ip ; <nl> + _port = port ; <nl> + _protocolSecret = protocolSecret ; <nl> + _protocolDcId = protocolDcId ; <nl> <nl> connect ( & sock , SIGNAL ( readyRead ( ) ) , this , SLOT ( socketRead ( ) ) ) ; <nl> - sock . connectToHost ( QHostAddress ( _addr ) , _port ) ; <nl> - auto proxy = sock . proxy ( ) ; <nl> + sock . connectToHost ( QHostAddress ( _address ) , _port ) ; <nl> } <nl> <nl> void TCPConnection : : socketPacket ( const char * packet , uint32 length ) { <nl> void TCPConnection : : socketPacket ( const char * packet , uint32 length ) { <nl> auto res_pq = readPQFakeReply ( data ) ; <nl> const auto & res_pq_data ( res_pq . c_resPQ ( ) ) ; <nl> if ( res_pq_data . vnonce = = tcpNonce ) { <nl> - DEBUG_LOG ( ( " Connection Info : TCP / % 1 - transport chosen by pq - response " ) . arg ( ( _flags & MTPDdcOption : : Flag : : f_ipv6 ) ? " IPv6 " : " IPv4 " ) ) ; <nl> + DEBUG_LOG ( ( " Connection Info : TCP - transport to % 1 chosen by pq - response " ) . arg ( _address ) ) ; <nl> status = UsingTcp ; <nl> emit connected ( ) ; <nl> } <nl> int32 TCPConnection : : debugState ( ) const { <nl> } <nl> <nl> QString TCPConnection : : transport ( ) const { <nl> - return isConnected ( ) ? qsl ( " TCP " ) : QString ( ) ; <nl> + if ( ! isConnected ( ) ) { <nl> + return QString ( ) ; <nl> + } <nl> + auto result = qsl ( " TCP " ) ; <nl> + if ( qthelp : : is_ipv6 ( _address ) ) { <nl> + result + = qsl ( " / IPv6 " ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> + QString TCPConnection : : tag ( ) const { <nl> + auto result = qsl ( " TCP " ) ; <nl> + if ( qthelp : : is_ipv6 ( _address ) ) { <nl> + result + = qsl ( " / IPv6 " ) ; <nl> + } else { <nl> + result + = qsl ( " / IPv4 " ) ; <nl> + } <nl> + return result ; <nl> } <nl> <nl> void TCPConnection : : socketError ( QAbstractSocket : : SocketError e ) { <nl> mmm a / Telegram / SourceFiles / mtproto / connection_tcp . h <nl> ppp b / Telegram / SourceFiles / mtproto / connection_tcp . h <nl> class AbstractTCPConnection : public AbstractConnection { <nl> Q_OBJECT <nl> <nl> public : <nl> - AbstractTCPConnection ( QThread * thread , int16 protocolDcId ) ; <nl> + AbstractTCPConnection ( QThread * thread ) ; <nl> virtual ~ AbstractTCPConnection ( ) = 0 ; <nl> <nl> public slots : <nl> public slots : <nl> void writeConnectionStart ( ) ; <nl> <nl> QTcpSocket sock ; <nl> - uint32 packetNum ; / / sent packet number <nl> + uint32 packetNum = 0 ; / / sent packet number <nl> <nl> - uint32 packetRead , packetLeft ; / / reading from socket <nl> - bool readingToShort ; <nl> + uint32 packetRead = 0 ; <nl> + uint32 packetLeft = 0 ; / / reading from socket <nl> + bool readingToShort = true ; <nl> char * currentPos ; <nl> mtpBuffer longBuffer ; <nl> mtpPrime shortBuffer [ MTPShortBufferSize ] ; <nl> public slots : <nl> uchar _receiveKey [ CTRState : : KeySize ] ; <nl> CTRState _receiveState ; <nl> int16 _protocolDcId = 0 ; <nl> + bytes : : vector _protocolSecret ; <nl> <nl> } ; <nl> <nl> class TCPConnection : public AbstractTCPConnection { <nl> Q_OBJECT <nl> <nl> public : <nl> - TCPConnection ( QThread * thread , int16 protocolDcId ) ; <nl> + TCPConnection ( QThread * thread ) ; <nl> <nl> void sendData ( mtpBuffer & buffer ) override ; <nl> void disconnectFromServer ( ) override ; <nl> - void connectTcp ( const DcOptions : : Endpoint & endpoint ) override ; <nl> - void connectHttp ( const DcOptions : : Endpoint & endpoint ) override { / / not supported <nl> - } <nl> + void connectToServer ( <nl> + const QString & ip , <nl> + int port , <nl> + const bytes : : vector & protocolSecret , <nl> + int16 protocolDcId ) override ; <nl> bool isConnected ( ) const override ; <nl> <nl> int32 debugState ( ) const override ; <nl> <nl> QString transport ( ) const override ; <nl> + QString tag ( ) const override ; <nl> <nl> public slots : <nl> - <nl> void socketError ( QAbstractSocket : : SocketError e ) ; <nl> <nl> void onSocketConnected ( ) ; <nl> public slots : <nl> void onTcpTimeoutTimer ( ) ; <nl> <nl> protected : <nl> - <nl> void socketPacket ( const char * packet , uint32 length ) override ; <nl> <nl> private : <nl> - <nl> enum Status { <nl> WaitingTcp = 0 , <nl> UsingTcp , <nl> public slots : <nl> Status status ; <nl> MTPint128 tcpNonce ; <nl> <nl> - QString _addr ; <nl> + QString _address ; <nl> int32 _port , _tcpTimeout ; <nl> - MTPDdcOption : : Flags _flags ; <nl> QTimer tcpTimeoutTimer ; <nl> <nl> } ; <nl> mmm a / Telegram / SourceFiles / mtproto / dc_options . cpp <nl> ppp b / Telegram / SourceFiles / mtproto / dc_options . cpp <nl> void DcOptions : : constructFromBuiltIn ( ) { <nl> <nl> auto bdcs = builtInDcs ( ) ; <nl> for ( auto i = 0 , l = builtInDcsCount ( ) ; i ! = l ; + + i ) { <nl> - auto flags = MTPDdcOption : : Flags ( 0 ) ; <nl> - auto idWithShift = MTP : : shiftDcId ( bdcs [ i ] . id , flags ) ; <nl> - _data . emplace ( idWithShift , Option ( bdcs [ i ] . id , flags , bdcs [ i ] . ip , bdcs [ i ] . port ) ) ; <nl> - DEBUG_LOG ( ( " MTP Info : adding built in DC % 1 connect option : % 2 : % 3 " ) . arg ( bdcs [ i ] . id ) . arg ( bdcs [ i ] . ip ) . arg ( bdcs [ i ] . port ) ) ; <nl> + const auto flags = MTPDdcOption : : Flags ( 0 ) ; <nl> + const auto bdc = bdcs [ i ] ; <nl> + const auto idWithShift = MTP : : shiftDcId ( bdc . id , flags ) ; <nl> + _data . emplace ( <nl> + idWithShift , <nl> + std : : vector < Option > ( <nl> + 1 , <nl> + Option ( bdc . id , flags , bdc . ip , bdc . port ) ) ) ; <nl> + DEBUG_LOG ( ( " MTP Info : adding built in DC % 1 connect option : " <nl> + " % 2 : % 3 " ) . arg ( bdc . id ) . arg ( bdc . ip ) . arg ( bdc . port ) ) ; <nl> } <nl> <nl> auto bdcsipv6 = builtInDcsIPv6 ( ) ; <nl> for ( auto i = 0 , l = builtInDcsCountIPv6 ( ) ; i ! = l ; + + i ) { <nl> - auto flags = MTPDdcOption : : Flags ( MTPDdcOption : : Flag : : f_ipv6 ) ; <nl> - auto idWithShift = MTP : : shiftDcId ( bdcsipv6 [ i ] . id , flags ) ; <nl> - _data . emplace ( idWithShift , Option ( bdcsipv6 [ i ] . id , flags , bdcsipv6 [ i ] . ip , bdcsipv6 [ i ] . port ) ) ; <nl> - DEBUG_LOG ( ( " MTP Info : adding built in DC % 1 IPv6 connect option : % 2 : % 3 " ) . arg ( bdcsipv6 [ i ] . id ) . arg ( bdcsipv6 [ i ] . ip ) . arg ( bdcsipv6 [ i ] . port ) ) ; <nl> + const auto flags = MTPDdcOption : : Flags ( MTPDdcOption : : Flag : : f_ipv6 ) ; <nl> + const auto bdc = bdcsipv6 [ i ] ; <nl> + const auto idWithShift = MTP : : shiftDcId ( bdc . id , flags ) ; <nl> + _data . emplace ( <nl> + idWithShift , <nl> + std : : vector < Option > ( <nl> + 1 , <nl> + Option ( bdc . id , flags , bdc . ip , bdc . port ) ) ) ; <nl> + DEBUG_LOG ( ( " MTP Info : adding built in DC % 1 IPv6 connect option : " <nl> + " % 2 : % 3 " ) . arg ( bdc . id ) . arg ( bdc . ip ) . arg ( bdc . port ) ) ; <nl> } <nl> } <nl> <nl> - void DcOptions : : processFromList ( const QVector < MTPDcOption > & options , bool overwrite ) { <nl> + void DcOptions : : processFromList ( <nl> + const QVector < MTPDcOption > & options , <nl> + bool overwrite ) { <nl> if ( options . empty ( ) | | _immutable ) { <nl> return ; <nl> } <nl> void DcOptions : : processFromList ( const QVector < MTPDcOption > & options , bool overwr <nl> auto dcId = option . vid . v ; <nl> auto flags = option . vflags . v ; <nl> auto dcIdWithShift = MTP : : shiftDcId ( dcId , flags ) ; <nl> - if ( base : : contains ( shiftedIdsProcessed , dcIdWithShift ) ) { <nl> - continue ; <nl> + if ( overwrite ) { <nl> + if ( ! base : : contains ( shiftedIdsProcessed , dcIdWithShift ) ) { <nl> + shiftedIdsProcessed . push_back ( dcIdWithShift ) ; <nl> + _data . erase ( dcIdWithShift ) ; <nl> + } <nl> } <nl> - <nl> - shiftedIdsProcessed . push_back ( dcIdWithShift ) ; <nl> - auto ip = std : : string ( option . vip_address . v . constData ( ) , option . vip_address . v . size ( ) ) ; <nl> + auto ip = std : : string ( <nl> + option . vip_address . v . constData ( ) , <nl> + option . vip_address . v . size ( ) ) ; <nl> auto port = option . vport . v ; <nl> if ( applyOneGuarded ( dcId , flags , ip , port ) ) { <nl> if ( ! base : : contains ( idsChanged , dcId ) ) { <nl> void DcOptions : : processFromList ( const QVector < MTPDcOption > & options , bool overwr <nl> if ( base : : contains ( shiftedIdsProcessed , i - > first ) ) { <nl> + + i ; <nl> } else { <nl> - if ( ! base : : contains ( idsChanged , i - > second . id ) ) { <nl> - idsChanged . push_back ( i - > second . id ) ; <nl> + const auto & options = i - > second ; <nl> + Assert ( ! options . empty ( ) ) ; <nl> + if ( ! base : : contains ( idsChanged , options . front ( ) . id ) ) { <nl> + idsChanged . push_back ( options . front ( ) . id ) ; <nl> } <nl> i = _data . erase ( i ) ; <nl> } <nl> void DcOptions : : addFromOther ( DcOptions & & options ) { <nl> idsChanged . reserve ( options . _data . size ( ) ) ; <nl> { <nl> WriteLocker lock ( this ) ; <nl> - for ( auto & item : base : : take ( options . _data ) ) { <nl> - auto dcId = item . second . id ; <nl> - auto flags = item . second . flags ; <nl> - auto & ip = item . second . ip ; <nl> - auto port = item . second . port ; <nl> - if ( applyOneGuarded ( dcId , flags , ip , port ) ) { <nl> - if ( ! base : : contains ( idsChanged , dcId ) ) { <nl> - idsChanged . push_back ( dcId ) ; <nl> + for ( const auto & item : base : : take ( options . _data ) ) { <nl> + for ( const auto & option : item . second ) { <nl> + auto dcId = option . id ; <nl> + auto flags = option . flags ; <nl> + auto & ip = option . ip ; <nl> + auto port = option . port ; <nl> + if ( applyOneGuarded ( dcId , flags , ip , port ) ) { <nl> + if ( ! base : : contains ( idsChanged , dcId ) ) { <nl> + idsChanged . push_back ( dcId ) ; <nl> + } <nl> } <nl> } <nl> } <nl> void DcOptions : : constructAddOne ( int id , MTPDdcOption : : Flags flags , const std : : st <nl> applyOneGuarded ( bareDcId ( id ) , flags , ip , port ) ; <nl> } <nl> <nl> - bool DcOptions : : applyOneGuarded ( DcId dcId , MTPDdcOption : : Flags flags , const std : : string & ip , int port ) { <nl> + bool DcOptions : : applyOneGuarded ( <nl> + DcId dcId , <nl> + MTPDdcOption : : Flags flags , <nl> + const std : : string & ip , <nl> + int port ) { <nl> auto dcIdWithShift = MTP : : shiftDcId ( dcId , flags ) ; <nl> auto i = _data . find ( dcIdWithShift ) ; <nl> if ( i ! = _data . cend ( ) ) { <nl> - if ( i - > second . ip = = ip & & i - > second . port = = port ) { <nl> - return false ; <nl> + for ( auto & option : i - > second ) { <nl> + if ( option . ip = = ip & & option . port = = port ) { <nl> + return false ; <nl> + } <nl> } <nl> - i - > second . ip = ip ; <nl> - i - > second . port = port ; <nl> + i - > second . push_back ( Option ( dcId , flags , ip , port ) ) ; <nl> } else { <nl> - _data . emplace ( dcIdWithShift , Option ( dcId , flags , ip , port ) ) ; <nl> + _data . emplace ( dcIdWithShift , std : : vector < Option > ( <nl> + 1 , <nl> + Option ( dcId , flags , ip , port ) ) ) ; <nl> } <nl> return true ; <nl> } <nl> QByteArray DcOptions : : serialize ( ) const { <nl> ReadLocker lock ( this ) ; <nl> <nl> auto size = sizeof ( qint32 ) ; <nl> - for ( auto & item : _data ) { <nl> + for ( const auto & item : _data ) { <nl> if ( isTemporaryDcId ( item . first ) ) { <nl> continue ; <nl> } <nl> - size + = sizeof ( qint32 ) + sizeof ( qint32 ) + sizeof ( qint32 ) ; / / id + flags + port <nl> - size + = sizeof ( qint32 ) + item . second . ip . size ( ) ; <nl> + for ( const auto & option : item . second ) { <nl> + size + = sizeof ( qint32 ) + sizeof ( qint32 ) + sizeof ( qint32 ) ; / / id + flags + port <nl> + size + = sizeof ( qint32 ) + option . ip . size ( ) ; <nl> + } <nl> } <nl> <nl> auto count = 0 ; <nl> QByteArray DcOptions : : serialize ( ) const { <nl> } ; <nl> std : : vector < SerializedPublicKey > publicKeys ; <nl> publicKeys . reserve ( count ) ; <nl> - for ( auto & keysInDc : _cdnPublicKeys ) { <nl> - for ( auto & entry : keysInDc . second ) { <nl> + for ( const auto & keysInDc : _cdnPublicKeys ) { <nl> + for ( const auto & entry : keysInDc . second ) { <nl> publicKeys . push_back ( { keysInDc . first , entry . second . getN ( ) , entry . second . getE ( ) } ) ; <nl> size + = sizeof ( qint32 ) + Serialize : : bytesSize ( publicKeys . back ( ) . n ) + Serialize : : bytesSize ( publicKeys . back ( ) . e ) ; <nl> } <nl> QByteArray DcOptions : : serialize ( ) const { <nl> QDataStream stream ( & result , QIODevice : : WriteOnly ) ; <nl> stream . setVersion ( QDataStream : : Qt_5_1 ) ; <nl> stream < < qint32 ( _data . size ( ) ) ; <nl> - for ( auto & item : _data ) { <nl> + for ( const auto & item : _data ) { <nl> if ( isTemporaryDcId ( item . first ) ) { <nl> continue ; <nl> } <nl> - stream < < qint32 ( item . second . id ) < < qint32 ( item . second . flags ) < < qint32 ( item . second . port ) ; <nl> - stream < < qint32 ( item . second . ip . size ( ) ) ; <nl> - stream . writeRawData ( item . second . ip . data ( ) , item . second . ip . size ( ) ) ; <nl> + for ( const auto & option : item . second ) { <nl> + stream < < qint32 ( option . id ) < < qint32 ( option . flags ) < < qint32 ( option . port ) ; <nl> + stream < < qint32 ( option . ip . size ( ) ) ; <nl> + stream . writeRawData ( option . ip . data ( ) , option . ip . size ( ) ) ; <nl> + } <nl> } <nl> stream < < qint32 ( publicKeys . size ( ) ) ; <nl> for ( auto & key : publicKeys ) { <nl> DcOptions : : Ids DcOptions : : configEnumDcIds ( ) const { <nl> ReadLocker lock ( this ) ; <nl> result . reserve ( _data . size ( ) ) ; <nl> for ( auto & item : _data ) { <nl> - if ( ! isCdnDc ( item . second . flags ) <nl> + const auto dcId = bareDcId ( item . first ) ; <nl> + Assert ( ! item . second . empty ( ) ) ; <nl> + if ( ! isCdnDc ( item . second . front ( ) . flags ) <nl> & & ! isTemporaryDcId ( item . first ) <nl> - & & ! base : : contains ( result , item . second . id ) ) { <nl> - result . push_back ( item . second . id ) ; <nl> + & & ! base : : contains ( result , dcId ) ) { <nl> + result . push_back ( dcId ) ; <nl> } <nl> } <nl> } <nl> bool DcOptions : : getDcRSAKey ( DcId dcId , const QVector < MTPlong > & fingerprints , int <nl> return findKey ( _publicKeys ) ; <nl> } <nl> <nl> - DcOptions : : Variants DcOptions : : lookup ( DcId dcId , DcType type ) const { <nl> - auto lookupDesiredFlags = [ type ] ( int address , int protocol ) - > std : : vector < MTPDdcOption : : Flags > { <nl> - auto throughProxy = ( Global : : ConnectionType ( ) ! = dbictAuto ) ; <nl> - <nl> + DcOptions : : Variants DcOptions : : lookup ( <nl> + DcId dcId , <nl> + DcType type , <nl> + bool throughProxy ) const { <nl> + auto lookupDesiredFlags = [ & ] ( int address , int protocol ) - > std : : vector < MTPDdcOption : : Flags > { <nl> switch ( type ) { <nl> case DcType : : Regular : <nl> case DcType : : Temporary : { <nl> DcOptions : : Variants DcOptions : : lookup ( DcId dcId , DcType type ) const { <nl> for ( auto protocol = 0 ; protocol ! = Variants : : ProtocolCount ; + + protocol ) { <nl> auto desiredFlags = lookupDesiredFlags ( address , protocol ) ; <nl> for ( auto flags : desiredFlags ) { <nl> - auto shift = static_cast < int > ( flags ) ; <nl> - if ( shift < 0 ) continue ; <nl> - <nl> - auto it = _data . find ( shiftDcId ( dcId , shift ) ) ; <nl> + const auto shift = static_cast < int > ( flags ) ; <nl> + const auto it = _data . find ( shiftDcId ( dcId , shift ) ) ; <nl> if ( it ! = _data . cend ( ) ) { <nl> - result . data [ address ] [ protocol ] . ip = it - > second . ip ; <nl> - result . data [ address ] [ protocol ] . flags = it - > second . flags ; <nl> - result . data [ address ] [ protocol ] . port = it - > second . port ; <nl> + for ( const auto & option : it - > second ) { <nl> + result . data [ address ] [ protocol ] . push_back ( { <nl> + option . ip , <nl> + option . port <nl> + } ) ; <nl> + } <nl> break ; <nl> } <nl> } <nl> DcOptions : : Variants DcOptions : : lookup ( DcId dcId , DcType type ) const { <nl> void DcOptions : : computeCdnDcIds ( ) { <nl> _cdnDcIds . clear ( ) ; <nl> for ( auto & item : _data ) { <nl> - if ( item . second . flags & MTPDdcOption : : Flag : : f_cdn ) { <nl> - _cdnDcIds . insert ( item . second . id ) ; <nl> + Assert ( ! item . second . empty ( ) ) ; <nl> + if ( item . second . front ( ) . flags & MTPDdcOption : : Flag : : f_cdn ) { <nl> + _cdnDcIds . insert ( bareDcId ( item . first ) ) ; <nl> } <nl> } <nl> } <nl> bool DcOptions : : writeToFile ( const QString & path ) const { <nl> stream . setCodec ( " UTF - 8 " ) ; <nl> <nl> ReadLocker lock ( this ) ; <nl> - for ( auto & item : _data ) { <nl> - auto & endpoint = item . second ; <nl> - stream < < endpoint . id < < ' ' < < QString : : fromStdString ( endpoint . ip ) < < ' ' < < endpoint . port ; <nl> - if ( endpoint . flags & MTPDdcOption : : Flag : : f_tcpo_only ) { <nl> - stream < < " tcpo_only " ; <nl> - } <nl> - if ( endpoint . flags & MTPDdcOption : : Flag : : f_media_only ) { <nl> - stream < < " media_only " ; <nl> + for ( const auto & item : _data ) { <nl> + for ( const auto & option : item . second ) { <nl> + stream <nl> + < < option . id <nl> + < < ' ' <nl> + < < QString : : fromStdString ( option . ip ) <nl> + < < ' ' < < option . port ; <nl> + if ( option . flags & MTPDdcOption : : Flag : : f_tcpo_only ) { <nl> + stream < < " tcpo_only " ; <nl> + } <nl> + if ( option . flags & MTPDdcOption : : Flag : : f_media_only ) { <nl> + stream < < " media_only " ; <nl> + } <nl> + stream < < ' \ n ' ; <nl> } <nl> - stream < < ' \ n ' ; <nl> } <nl> return true ; <nl> } <nl> mmm a / Telegram / SourceFiles / mtproto / dc_options . h <nl> ppp b / Telegram / SourceFiles / mtproto / dc_options . h <nl> For license and copyright information please follow this link : <nl> # pragma once <nl> <nl> # include " base / observer . h " <nl> + # include " base / bytes . h " <nl> # include " mtproto / rsa_public_key . h " <nl> # include < string > <nl> # include < vector > <nl> class DcOptions { <nl> / / construct methods don ' t notify " changed " subscribers . <nl> void constructFromSerialized ( const QByteArray & serialized ) ; <nl> void constructFromBuiltIn ( ) ; <nl> - void constructAddOne ( int id , MTPDdcOption : : Flags flags , const std : : string & ip , int port ) ; <nl> + void constructAddOne ( <nl> + int id , <nl> + MTPDdcOption : : Flags flags , <nl> + const std : : string & ip , <nl> + int port ) ; <nl> QByteArray serialize ( ) const ; <nl> <nl> using Ids = std : : vector < DcId > ; <nl> class DcOptions { <nl> struct Endpoint { <nl> std : : string ip ; <nl> int port = 0 ; <nl> - MTPDdcOption : : Flags flags = 0 ; <nl> + bytes : : vector protocolSecret ; <nl> } ; <nl> struct Variants { <nl> - enum { <nl> + enum Address { <nl> IPv4 = 0 , <nl> IPv6 = 1 , <nl> AddressTypeCount = 2 , <nl> } ; <nl> - enum { <nl> + enum Protocol { <nl> Tcp = 0 , <nl> Http = 1 , <nl> ProtocolCount = 2 , <nl> } ; <nl> - Endpoint data [ AddressTypeCount ] [ ProtocolCount ] ; <nl> + std : : vector < Endpoint > data [ AddressTypeCount ] [ ProtocolCount ] ; <nl> } ; <nl> - Variants lookup ( DcId dcId , DcType type ) const ; <nl> + Variants lookup ( DcId dcId , DcType type , bool throughProxy ) const ; <nl> DcType dcType ( ShiftedDcId shiftedDcId ) const ; <nl> <nl> void setCDNConfig ( const MTPDcdnConfig & config ) ; <nl> class DcOptions { <nl> class ReadLocker ; <nl> friend class ReadLocker ; <nl> <nl> - std : : map < ShiftedDcId , Option > _data ; <nl> + std : : map < ShiftedDcId , std : : vector < Option > > _data ; <nl> std : : set < DcId > _cdnDcIds ; <nl> std : : map < uint64 , internal : : RSAPublicKey > _publicKeys ; <nl> std : : map < DcId , std : : map < uint64 , internal : : RSAPublicKey > > _cdnPublicKeys ; <nl> mmm a / Telegram / SourceFiles / mtproto / session . cpp <nl> ppp b / Telegram / SourceFiles / mtproto / session . cpp <nl> void Session : : refreshDataFields ( ) { <nl> ( connectionType = = dbictAuto <nl> | | connectionType = = dbictHttpProxy ) ; <nl> const auto useIPv4 = true ; <nl> - const auto useIPv6 = ( proxyType ! = ProxyData : : Type : : Mtproto ) & & <nl> - Global : : TryIPv6 ( ) ; <nl> + const auto useIPv6 = Global : : TryIPv6 ( ) ; <nl> data . setConnectionOptions ( ConnectionOptions ( <nl> _instance - > systemLangCode ( ) , <nl> _instance - > cloudLangCode ( ) , <nl> mmm a / Telegram / gyp / telegram_sources . txt <nl> ppp b / Telegram / gyp / telegram_sources . txt <nl> <nl> < ( src_loc ) / mtproto / connection . h <nl> < ( src_loc ) / mtproto / connection_abstract . cpp <nl> < ( src_loc ) / mtproto / connection_abstract . h <nl> - < ( src_loc ) / mtproto / connection_auto . cpp <nl> - < ( src_loc ) / mtproto / connection_auto . h <nl> < ( src_loc ) / mtproto / connection_http . cpp <nl> < ( src_loc ) / mtproto / connection_http . h <nl> < ( src_loc ) / mtproto / connection_tcp . cpp <nl>
|
Support many config endpoints for one dc + params .
|
telegramdesktop/tdesktop
|
93f6d4b6e7b587efaca254ca3ba53e69e6baf571
|
2018-05-05T18:55:37Z
|
mmm a / MavLinkCom / include / MavLinkMessageBase . hpp <nl> ppp b / MavLinkCom / include / MavLinkMessageBase . hpp <nl> namespace mavlinkcom <nl> class MavLinkTelemetry : public MavLinkMessageBase { <nl> public : <nl> const static uint8_t kMessageId = 204 ; / / in the user range 180 - 229 . <nl> - MavLinkTelemetry ( ) { msgid = kMessageId ; } <nl> + MavLinkTelemetry ( ) : wifiInterfaceName ( nullptr ) { msgid = kMessageId ; } <nl> uint32_t messagesSent ; / / number of messages sent since the last telemetry message <nl> uint32_t messagesReceived ; / / number of messages received since the last telemetry message <nl> uint32_t messagesHandled ; / / number of messages handled since the last telemetry message <nl> mmm a / MavLinkCom / src / serial_com / wifi . cpp <nl> ppp b / MavLinkCom / src / serial_com / wifi . cpp <nl> <nl> <nl> int getWifiRssi ( int socket , const char * ifaceName ) <nl> { <nl> - struct iw_statistics stats ; <nl> - struct iwreq req ; <nl> - memset ( & stats , 0 , sizeof ( stats ) ) ; <nl> - memset ( & req , 0 , sizeof ( iwreq ) ) ; <nl> - <nl> - strncpy ( req . ifr_name , ifaceName , 16 ) ; <nl> - req . u . data . pointer = & stats ; <nl> - req . u . data . length = sizeof ( iw_statistics ) ; <nl> - <nl> - # ifdef CLEAR_UPDATED <nl> - req . u . data . flags = 1 ; <nl> - # endif <nl> - <nl> - / * Perform the ioctl * / <nl> - if ( ioctl ( socket , SIOCGIWSTATS , & req ) = = - 1 ) { <nl> - / / printf ( " Error performing SIOCGIWSTATS on % s \ n " , ifaceName ) ; <nl> - return - 127 ; <nl> - } <nl> - <nl> - return stats . qual . level ; <nl> + return 0 ; <nl> + / / This has not been properly tested <nl> + / / struct iw_statistics stats ; <nl> + / / struct iwreq req ; <nl> + / / memset ( & stats , 0 , sizeof ( stats ) ) ; <nl> + / / memset ( & req , 0 , sizeof ( iwreq ) ) ; <nl> + / / <nl> + / / strncpy ( req . ifr_name , ifaceName , 16 ) ; <nl> + / / req . u . data . pointer = & stats ; <nl> + / / req . u . data . length = sizeof ( iw_statistics ) ; <nl> + / / <nl> + / / # ifdef CLEAR_UPDATED <nl> + / / req . u . data . flags = 1 ; <nl> + / / # endif <nl> + / / <nl> + / / / * Perform the ioctl * / <nl> + / / if ( ioctl ( socket , SIOCGIWSTATS , & req ) = = - 1 ) { <nl> + / / / / printf ( " Error performing SIOCGIWSTATS on % s \ n " , ifaceName ) ; <nl> + / / return - 127 ; <nl> + / / } <nl> + / / <nl> + / / return stats . qual . level ; <nl> } <nl> <nl> # else <nl>
|
fix getrssi bug .
|
microsoft/AirSim
|
424c4e28060114ac9715e097bdc2d52a79a9eba9
|
2017-06-02T21:33:51Z
|
mmm a / xbmc / cores / dvdplayer / DVDCodecs / Video / CrystalHD . cpp <nl> ppp b / xbmc / cores / dvdplayer / DVDCodecs / Video / CrystalHD . cpp <nl> void CMPCOutputThread : : CopyOutAsNV12 ( CPictureBuffer * pBuffer , BCM : : BC_DTS_PROC_O <nl> } <nl> } <nl> <nl> - # if 0 <nl> + # if _WIN32 <nl> / / Taken from Xine Project ( color . c ) <nl> / / Copyright ( C ) 2000 - 2003 the xine project <nl> / / GNU General Public License version 2 of the License , <nl>
|
[ chd ] use c routines for yuy2 to yv12 convert under win platform
|
xbmc/xbmc
|
76fa470de7a8629f5f79b2a57db6a1d388c9eac5
|
2010-07-02T15:58:33Z
|
mmm a / README . md <nl> ppp b / README . md <nl> OpenPose <nl> <nl> # # Introduction <nl> <nl> - OpenPose is a * * library for real - time multi - person key - point detection and multi - threading written in C + + * * using OpenCV and Caffe * , authored by [ Gines Hidalgo ] ( https : / / www . linkedin . com / in / gineshidalgo / ) , [ Zhe Cao ] ( http : / / www . andrew . cmu . edu / user / zhecao ) , [ Tomas Simon ] ( http : / / www . cs . cmu . edu / ~ tsimon / ) , [ Shih - En Wei ] ( https : / / scholar . google . com / citations ? user = sFQD3k4AAAAJ & hl = en ) , [ Hanbyul Joo ] ( http : / / www . cs . cmu . edu / ~ hanbyulj / ) and [ Yaser Sheikh ] ( http : / / www . cs . cmu . edu / ~ yaser / ) . <nl> + OpenPose is a * * library for real - time multi - person keypoint detection and multi - threading written in C + + * * using OpenCV and Caffe * , authored by [ Gines Hidalgo ] ( https : / / www . linkedin . com / in / gineshidalgo / ) , [ Zhe Cao ] ( http : / / www . andrew . cmu . edu / user / zhecao ) , [ Tomas Simon ] ( http : / / www . cs . cmu . edu / ~ tsimon / ) , [ Shih - En Wei ] ( https : / / scholar . google . com / citations ? user = sFQD3k4AAAAJ & hl = en ) , [ Hanbyul Joo ] ( http : / / www . cs . cmu . edu / ~ hanbyulj / ) and [ Yaser Sheikh ] ( http : / / www . cs . cmu . edu / ~ yaser / ) . <nl> <nl> * It uses Caffe , but the code is ready to be ported to other frameworks ( e . g . Tensorflow or Torch ) . If you implement any of those , please , make a pull request and we will add it ! <nl> <nl> OpenPose is freely available for free non - commercial use , and may be redistribut <nl> <nl> Library main functionality : <nl> <nl> - * Multi - person 15 or * * 18 - key - point body pose * * estimation and rendering . <nl> + * Multi - person 15 or * * 18 - keypoint body pose * * estimation and rendering . <nl> <nl> - * Multi - person * * 2x21 - key - point hand * * estimation and rendering ( coming soon in around 1 - 2 months ! ) . <nl> + * Multi - person * * 2x21 - keypoint hand * * estimation and rendering ( coming soon in around 1 - 2 months ! ) . <nl> <nl> - * Multi - person * * 70 - key - point face * * estimation and rendering ( coming soon in around 2 - 3 months ! ) . <nl> + * Multi - person * * 70 - keypoint face * * estimation and rendering ( coming soon in around 2 - 3 months ! ) . <nl> <nl> * Flexible and easy - to - configure * * multi - threading * * module . <nl> <nl> mmm a / doc / library_overview . md <nl> ppp b / doc / library_overview . md <nl> In order to use and / or slightly extend the OpenPose library , we try to explain t <nl> <nl> 2 . The multi - threading module : ` thread ` . <nl> <nl> - 3 . The multi - person key - point detection module : ` pose ` . <nl> + 3 . The multi - person keypoint detection module : ` pose ` . <nl> <nl> <nl> # # Basic Module : ` core ` <nl> In order to be initialized , ` PoseExtractorCaffe ` has the following constructor a <nl> <nl> 2 . ` netOutputSize ` is the resolution of the last layer of the deep net . I . e . , the resulting heatmaps will have this size . Currently , it must be set to the same size as ` netInputSize ` . <nl> <nl> - 3 . ` outputSize ` is the final desired resolution to be used . The human pose key - point locations will be scaled to this output size . However , the heat - maps will have the ` netOutputSize ` size due to performance . <nl> + 3 . ` outputSize ` is the final desired resolution to be used . The human pose keypoint locations will be scaled to this output size . However , the heat - maps will have the ` netOutputSize ` size due to performance . <nl> <nl> 4 . ` scaleNumber ` and ` scaleGap ` specify the multi - scale parameters . Explained in the [ README . md ] ( . . / README . md ) , in the demo section . <nl> <nl>
|
Typo in doc fixed
|
CMU-Perceptual-Computing-Lab/openpose
|
8a963bda3bb5e9be90d64da9ec950b8de8dc1ab5
|
2017-05-07T03:28:13Z
|
mmm a / folly / io / async / AsyncSocket . cpp <nl> ppp b / folly / io / async / AsyncSocket . cpp <nl> class AsyncSocket : : BytesWriteRequest : public AsyncSocket : : WriteRequest { <nl> WriteResult performWrite ( ) override { <nl> WriteFlags writeFlags = flags_ ; <nl> if ( getNext ( ) ! = nullptr ) { <nl> - writeFlags = writeFlags | WriteFlags : : CORK ; <nl> + writeFlags | = WriteFlags : : CORK ; <nl> } <nl> auto writeResult = socket_ - > performWrite ( <nl> getOps ( ) , getOpCount ( ) , writeFlags , & opsWritten_ , & partialBytes_ ) ; <nl> mmm a / folly / io / async / AsyncTransport . h <nl> ppp b / folly / io / async / AsyncTransport . h <nl> inline WriteFlags operator | ( WriteFlags a , WriteFlags b ) { <nl> static_cast < uint32_t > ( a ) | static_cast < uint32_t > ( b ) ) ; <nl> } <nl> <nl> + / * <nl> + * compound assignment union operator <nl> + * / <nl> + inline WriteFlags & operator | = ( WriteFlags & a , WriteFlags b ) { <nl> + a = a | b ; <nl> + return a ; <nl> + } <nl> + <nl> / * <nl> * intersection operator <nl> * / <nl> inline WriteFlags operator & ( WriteFlags a , WriteFlags b ) { <nl> static_cast < uint32_t > ( a ) & static_cast < uint32_t > ( b ) ) ; <nl> } <nl> <nl> + / * <nl> + * compound assignment intersection operator <nl> + * / <nl> + inline WriteFlags & operator & = ( WriteFlags & a , WriteFlags b ) { <nl> + a = a & b ; <nl> + return a ; <nl> + } <nl> + <nl> / * <nl> * exclusion parameter <nl> * / <nl> new file mode 100644 <nl> index 00000000000 . . 0ae9fd9533e <nl> mmm / dev / null <nl> ppp b / folly / io / async / test / WriteFlagsTest . cpp <nl> <nl> + / * <nl> + * Copyright 2017 Facebook , Inc . <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> + # include < folly / io / async / AsyncTransport . h > <nl> + <nl> + / / # include < folly / io / async / test / MockAsyncTransport . h > <nl> + # include < folly / portability / GTest . h > <nl> + <nl> + using namespace testing ; <nl> + <nl> + namespace folly { <nl> + <nl> + TEST ( WriteFlagsTest , isSet ) { <nl> + WriteFlags flags = WriteFlags : : NONE ; <nl> + ASSERT_FALSE ( isSet ( flags , WriteFlags : : CORK ) ) ; <nl> + ASSERT_FALSE ( isSet ( flags , WriteFlags : : EOR ) ) ; <nl> + <nl> + flags = WriteFlags : : CORK ; <nl> + ASSERT_TRUE ( isSet ( flags , WriteFlags : : CORK ) ) ; <nl> + ASSERT_FALSE ( isSet ( flags , WriteFlags : : EOR ) ) ; <nl> + <nl> + flags = static_cast < WriteFlags > ( <nl> + static_cast < uint32_t > ( WriteFlags : : CORK ) | <nl> + static_cast < uint32_t > ( WriteFlags : : EOR ) ) ; <nl> + ASSERT_TRUE ( isSet ( flags , WriteFlags : : CORK ) ) ; <nl> + ASSERT_TRUE ( isSet ( flags , WriteFlags : : EOR ) ) ; <nl> + } <nl> + <nl> + TEST ( WriteFlagsTest , unionOperator ) { <nl> + WriteFlags flags = WriteFlags : : CORK | WriteFlags : : NONE ; <nl> + ASSERT_EQ ( flags , WriteFlags : : CORK ) ; <nl> + <nl> + flags = static_cast < WriteFlags > ( <nl> + static_cast < uint32_t > ( WriteFlags : : CORK ) | <nl> + static_cast < uint32_t > ( WriteFlags : : EOR ) ) ; <nl> + ASSERT_EQ ( flags , WriteFlags : : CORK | WriteFlags : : EOR ) ; <nl> + } <nl> + <nl> + TEST ( WriteFlagsTest , intersectionOperator ) { <nl> + ASSERT_EQ ( WriteFlags : : NONE & WriteFlags : : CORK , WriteFlags : : NONE ) ; <nl> + <nl> + WriteFlags flags = <nl> + WriteFlags : : CORK | WriteFlags : : EOR | WriteFlags : : WRITE_SHUTDOWN ; <nl> + ASSERT_EQ ( flags & WriteFlags : : CORK , WriteFlags : : CORK ) ; <nl> + ASSERT_EQ ( flags & WriteFlags : : EOR , WriteFlags : : EOR ) ; <nl> + ASSERT_EQ ( flags & WriteFlags : : WRITE_SHUTDOWN , WriteFlags : : WRITE_SHUTDOWN ) ; <nl> + } <nl> + <nl> + TEST ( WriteFlagsTest , exclusionOperator ) { <nl> + ASSERT_FALSE ( isSet ( ~ WriteFlags : : CORK , WriteFlags : : CORK ) ) ; <nl> + ASSERT_TRUE ( isSet ( ~ WriteFlags : : CORK , WriteFlags : : EOR ) ) ; <nl> + ASSERT_TRUE ( isSet ( ~ WriteFlags : : CORK , WriteFlags : : WRITE_SHUTDOWN ) ) ; <nl> + <nl> + ASSERT_FALSE ( isSet ( ~ WriteFlags : : EOR , WriteFlags : : EOR ) ) ; <nl> + ASSERT_TRUE ( isSet ( ~ WriteFlags : : EOR , WriteFlags : : CORK ) ) ; <nl> + ASSERT_TRUE ( isSet ( ~ WriteFlags : : EOR , WriteFlags : : WRITE_SHUTDOWN ) ) ; <nl> + } <nl> + <nl> + TEST ( WriteFlagsTest , unsetOperator ) { <nl> + WriteFlags flags = <nl> + WriteFlags : : CORK | WriteFlags : : EOR | WriteFlags : : WRITE_SHUTDOWN ; <nl> + ASSERT_TRUE ( isSet ( flags , WriteFlags : : CORK ) ) ; <nl> + ASSERT_TRUE ( isSet ( flags , WriteFlags : : EOR ) ) ; <nl> + ASSERT_TRUE ( isSet ( flags , WriteFlags : : WRITE_SHUTDOWN ) ) ; <nl> + <nl> + flags = WriteFlags : : CORK ; <nl> + ASSERT_TRUE ( isSet ( flags , WriteFlags : : CORK ) ) ; <nl> + ASSERT_FALSE ( isSet ( flags , WriteFlags : : EOR ) ) ; <nl> + ASSERT_FALSE ( isSet ( flags , WriteFlags : : WRITE_SHUTDOWN ) ) ; <nl> + } <nl> + <nl> + TEST ( WriteFlagsTest , compoundAssignmentUnionOperator ) { <nl> + WriteFlags flags = WriteFlags : : NONE ; <nl> + flags | = WriteFlags : : CORK ; <nl> + ASSERT_EQ ( flags , WriteFlags : : CORK ) ; <nl> + <nl> + flags = WriteFlags : : CORK ; <nl> + flags | = WriteFlags : : EOR ; <nl> + ASSERT_EQ ( flags , WriteFlags : : CORK | WriteFlags : : EOR ) ; <nl> + <nl> + flags = WriteFlags : : CORK | WriteFlags : : EOR ; <nl> + flags | = WriteFlags : : CORK ; <nl> + ASSERT_EQ ( flags , WriteFlags : : CORK | WriteFlags : : EOR ) ; <nl> + } <nl> + <nl> + TEST ( WriteFlagsTest , compoundAssignmentIntersectionOperator ) { <nl> + WriteFlags flags = WriteFlags : : CORK | WriteFlags : : EOR ; <nl> + flags & = WriteFlags : : CORK ; <nl> + ASSERT_EQ ( flags , WriteFlags : : CORK ) ; <nl> + <nl> + flags = WriteFlags : : CORK | WriteFlags : : EOR ; <nl> + flags & = WriteFlags : : EOR ; <nl> + ASSERT_EQ ( flags , WriteFlags : : EOR ) ; <nl> + <nl> + flags = WriteFlags : : NONE ; <nl> + flags & = WriteFlags : : EOR ; <nl> + ASSERT_EQ ( flags , WriteFlags : : NONE ) ; <nl> + } <nl> + <nl> + } / / namespace <nl>
|
Adding ' compound assignment union operator ' for folly : : WriteFlags enum class
|
facebook/folly
|
74261e41a1b94490607457e38b3b1c54cf6374a4
|
2017-01-18T22:32:57Z
|
mmm a / servers / visual / shader_language . cpp <nl> ppp b / servers / visual / shader_language . cpp <nl> ShaderLanguage : : Token ShaderLanguage : : read_token ( const CharType * p_text , int p_le <nl> <nl> <nl> while ( true ) { <nl> - if ( GETCHAR ( r_chars + 1 ) = = ' 0 ' ) <nl> + if ( GETCHAR ( r_chars + 1 ) = = 0 ) { <nl> + r_chars + = 1 ; <nl> break ; <nl> - if ( GETCHAR ( r_chars + 1 ) = = ' * ' & & GETCHAR ( r_chars + 2 ) = = ' / ' ) <nl> + } if ( GETCHAR ( r_chars + 1 ) = = ' * ' & & GETCHAR ( r_chars + 2 ) = = ' / ' ) { <nl> + r_chars + = 3 ; <nl> break ; <nl> - if ( GETCHAR ( r_chars + 1 ) = = ' \ n ' ) <nl> + } if ( GETCHAR ( r_chars + 1 ) = = ' \ n ' ) { <nl> r_line + + ; <nl> - r_chars + + ; <nl> + } <nl> + <nl> + r_chars + + ; <nl> } <nl> <nl> return Token ( ) ; <nl>
|
- Fixed shader commets , / * * / works well and crash is solved , fixes
|
godotengine/godot
|
972af0b0cbe1e67470d6a520233dd1f58f8ae02c
|
2015-04-26T15:34:42Z
|
mmm a / xbmc / cores / omxplayer / OMXImage . cpp <nl> ppp b / xbmc / cores / omxplayer / OMXImage . cpp <nl> OMX_IMAGE_CODINGTYPE COMXImage : : GetCodingType ( ) <nl> { <nl> switch ( marker ) <nl> { <nl> - case M_TEM : <nl> - case M_DRI : <nl> - CBitstreamConverter : : skip_bits ( & br , 16 ) ; <nl> - continue ; <nl> - case M_SOI : <nl> - case M_EOI : <nl> - continue ; <nl> - <nl> - case M_SOS : <nl> case M_DQT : <nl> case M_DNL : <nl> case M_DHP : <nl> OMX_IMAGE_CODINGTYPE COMXImage : : GetCodingType ( ) <nl> nMarker = true ; <nl> break ; <nl> <nl> + case M_SOS : <nl> default : <nl> nMarker = false ; <nl> break ; <nl> OMX_IMAGE_CODINGTYPE COMXImage : : GetCodingType ( ) <nl> { <nl> m_progressive = true ; <nl> } <nl> + int readBits = 2 ; <nl> SKIPN ( p , 1 ) ; <nl> + readBits + + ; <nl> m_omx_image . nFrameHeight = READ16 ( p ) ; <nl> + readBits + = 2 ; <nl> m_omx_image . nFrameWidth = READ16 ( p ) ; <nl> - SKIPN ( p , 1 * ( block_size - 9 ) ) ; <nl> + readBits + = 2 ; <nl> + SKIPN ( p , 1 * ( block_size - readBits ) ) ; <nl> } <nl> else if ( marker = = M_APP1 ) <nl> { <nl>
|
[ rbp / omxplayer ] Fix bugs with jpeg parsing
|
xbmc/xbmc
|
da1b7a2176a9e00caf920500dbe167ac826a0fbd
|
2013-10-06T17:52:33Z
|
mmm a / tensorflow / contrib / layers / python / layers / layers . py <nl> ppp b / tensorflow / contrib / layers / python / layers / layers . py <nl> def stack ( inputs , layer , stack_args , * * kwargs ) : <nl> x = fully_connected ( x , 128 , scope = ' fc / fc_3 ' ) <nl> ` ` ` <nl> <nl> + If the ` scope ` argument is not given in ` stack_args ` , it is set to <nl> + ` layer . __name__ ` , or ` layer . func . __name__ ` ( for ` functools . partial ` <nl> + objects ) . If neither ` __name__ ` nor ` func . __name__ ` is available , the <nl> + layers are called with ` scope = ' stack ' ` . <nl> + <nl> Args : <nl> inputs : A ` Tensor ` suitable for layer . <nl> - layer : A layer ( inputs , * args , * * kwargs ) <nl> + layer : A layer with arguments ` ( inputs , * args , * * kwargs ) ` <nl> stack_args : A list / tuple of parameters for each call of layer . <nl> * * kwargs : Extra kwargs for the layer . <nl> <nl> def stack ( inputs , layer , stack_args , * * kwargs ) : <nl> raise ValueError ( ' stack_args need to be a list or tuple ' ) <nl> with variable_scope . variable_op_scope ( [ inputs ] , scope , ' Stack ' ) : <nl> outputs = inputs <nl> - scope = scope or layer . __name__ <nl> + scope = scope <nl> + if scope is None : <nl> + if hasattr ( layer , ' __name__ ' ) : <nl> + scope = layer . __name__ <nl> + elif hasattr ( layer , ' func ' ) and hasattr ( layer . func , ' __name__ ' ) : <nl> + scope = layer . func . __name__ # In case layer is a functools . partial . <nl> + else : <nl> + scope = ' stack ' <nl> for i in range ( len ( stack_args ) ) : <nl> kwargs [ ' scope ' ] = scope + ' _ ' + str ( i + 1 ) <nl> layer_args = stack_args [ i ] <nl> mmm a / tensorflow / contrib / layers / python / layers / layers_test . py <nl> ppp b / tensorflow / contrib / layers / python / layers / layers_test . py <nl> def testStackFullyConnected ( self ) : <nl> self . assertEquals ( output . op . name , ' Stack / fully_connected_3 / Relu ' ) <nl> self . assertListEqual ( output . get_shape ( ) . as_list ( ) , [ 5 , 30 ] ) <nl> <nl> + def testStackRelu ( self ) : <nl> + height , width = 3 , 3 <nl> + with self . test_session ( ) : <nl> + images = tf . random_uniform ( ( 5 , height * width * 3 ) , seed = 1 , name = ' images ' ) <nl> + output = tf . contrib . layers . stack ( images , <nl> + tf . contrib . layers . relu , <nl> + [ 10 , 20 , 30 ] ) <nl> + self . assertEquals ( output . op . name , ' Stack / fully_connected_3 / Relu ' ) <nl> + self . assertListEqual ( output . get_shape ( ) . as_list ( ) , [ 5 , 30 ] ) <nl> + <nl> def testStackConvolution2d ( self ) : <nl> height , width = 3 , 3 <nl> with self . test_session ( ) : <nl>
|
Make stack work with functools . partial objects .
|
tensorflow/tensorflow
|
fee006586f4d018f829a333e74471ba224ed57ea
|
2016-06-22T23:17:19Z
|
mmm a / core / io / multiplayer_api . cpp <nl> ppp b / core / io / multiplayer_api . cpp <nl> <nl> # include " scene / main / node . h " <nl> # include < stdint . h > <nl> <nl> + # define NODE_ID_COMPRESSION_SHIFT 3 <nl> + # define NAME_ID_COMPRESSION_SHIFT 5 <nl> + # define BYTE_ONLY_OR_NO_ARGS_SHIFT 6 <nl> + <nl> # ifdef DEBUG_ENABLED <nl> # include " core / os / os . h " <nl> # endif <nl> Ref < NetworkedMultiplayerPeer > MultiplayerAPI : : get_network_peer ( ) const { <nl> return network_peer ; <nl> } <nl> <nl> + / / Returns the packet size stripping the node path added when the node is not yet cached . <nl> + int get_packet_len ( uint32_t p_node_target , int p_packet_len ) { <nl> + if ( p_node_target & 0x80000000 ) { <nl> + int ofs = p_node_target & 0x7FFFFFFF ; <nl> + return p_packet_len - ( p_packet_len - ofs ) ; <nl> + } else { <nl> + return p_packet_len ; <nl> + } <nl> + } <nl> + <nl> void MultiplayerAPI : : _process_packet ( int p_from , const uint8_t * p_packet , int p_packet_len ) { <nl> <nl> ERR_FAIL_COND_MSG ( root_node = = NULL , " Multiplayer root node was not initialized . If you are using custom multiplayer , remember to set the root node via MultiplayerAPI . set_root_node before using it . " ) ; <nl> void MultiplayerAPI : : _process_packet ( int p_from , const uint8_t * p_packet , int p_ <nl> int name_id_offset = 1 ; <nl> ERR_FAIL_COND_MSG ( p_packet_len < packet_min_size , " Invalid packet received . Size too small . " ) ; <nl> / / Compute the meta size , which depends on the compression level . <nl> - int node_id_compression = ( p_packet [ 0 ] & 24 ) > > 3 ; <nl> - int name_id_compression = ( p_packet [ 0 ] & 32 ) > > 5 ; <nl> + int node_id_compression = ( p_packet [ 0 ] & 24 ) > > NODE_ID_COMPRESSION_SHIFT ; <nl> + int name_id_compression = ( p_packet [ 0 ] & 32 ) > > NAME_ID_COMPRESSION_SHIFT ; <nl> <nl> switch ( node_id_compression ) { <nl> case NETWORK_NODE_ID_COMPRESSION_8 : <nl> void MultiplayerAPI : : _process_packet ( int p_from , const uint8_t * p_packet , int p_ <nl> / / Unreachable , checked before . <nl> CRASH_NOW ( ) ; <nl> } <nl> + <nl> Node * node = _process_get_node ( p_from , p_packet , node_target , p_packet_len ) ; <nl> ERR_FAIL_COND_MSG ( node = = NULL , " Invalid packet received . Requested node was not found . " ) ; <nl> <nl> void MultiplayerAPI : : _process_packet ( int p_from , const uint8_t * p_packet , int p_ <nl> CRASH_NOW ( ) ; <nl> } <nl> <nl> + const int packet_len = get_packet_len ( node_target , p_packet_len ) ; <nl> if ( packet_type = = NETWORK_COMMAND_REMOTE_CALL ) { <nl> <nl> - _process_rpc ( node , name_id , p_from , p_packet , p_packet_len , packet_min_size ) ; <nl> + _process_rpc ( node , name_id , p_from , p_packet , packet_len , packet_min_size ) ; <nl> <nl> } else { <nl> <nl> - _process_rset ( node , name_id , p_from , p_packet , p_packet_len , packet_min_size ) ; <nl> + _process_rset ( node , name_id , p_from , p_packet , packet_len , packet_min_size ) ; <nl> } <nl> <nl> } break ; <nl> Node * MultiplayerAPI : : _process_get_node ( int p_from , const uint8_t * p_packet , uin <nl> <nl> void MultiplayerAPI : : _process_rpc ( Node * p_node , const uint16_t p_rpc_method_id , int p_from , const uint8_t * p_packet , int p_packet_len , int p_offset ) { <nl> <nl> - ERR_FAIL_COND_MSG ( p_offset > = p_packet_len , " Invalid packet received . Size too small . " ) ; <nl> + ERR_FAIL_COND_MSG ( p_offset > p_packet_len , " Invalid packet received . Size too small . " ) ; <nl> <nl> / / Check that remote can call the RPC on this node . <nl> StringName name = p_node - > get_node_rpc_method ( p_rpc_method_id ) ; <nl> void MultiplayerAPI : : _process_rpc ( Node * p_node , const uint16_t p_rpc_method_id , <nl> bool can_call = _can_call_mode ( p_node , rpc_mode , p_from ) ; <nl> ERR_FAIL_COND_MSG ( ! can_call , " RPC ' " + String ( name ) + " ' is not allowed on node " + p_node - > get_path ( ) + " from : " + itos ( p_from ) + " . Mode is " + itos ( ( int ) rpc_mode ) + " , master is " + itos ( p_node - > get_network_master ( ) ) + " . " ) ; <nl> <nl> - int argc = p_packet [ p_offset ] ; <nl> + int argc = 0 ; <nl> + bool byte_only = false ; <nl> + <nl> + const bool byte_only_or_no_args = ( ( p_packet [ 0 ] & 64 ) > > BYTE_ONLY_OR_NO_ARGS_SHIFT ) = = 1 ; <nl> + if ( byte_only_or_no_args ) { <nl> + if ( p_offset < p_packet_len ) { <nl> + / / This packet contains only bytes . <nl> + argc = 1 ; <nl> + byte_only = true ; <nl> + } else { <nl> + / / This rpc calls a method without parameters . <nl> + } <nl> + } else { <nl> + / / Normal variant , takes the argument count from the packet . <nl> + ERR_FAIL_COND_MSG ( p_offset > = p_packet_len , " Invalid packet received . Size too small . " ) ; <nl> + argc = p_packet [ p_offset ] ; <nl> + p_offset + = 1 ; <nl> + } <nl> + <nl> Vector < Variant > args ; <nl> Vector < const Variant * > argp ; <nl> args . resize ( argc ) ; <nl> argp . resize ( argc ) ; <nl> <nl> - p_offset + + ; <nl> - <nl> # ifdef DEBUG_ENABLED <nl> if ( profiling ) { <nl> ObjectID id = p_node - > get_instance_id ( ) ; <nl> void MultiplayerAPI : : _process_rpc ( Node * p_node , const uint16_t p_rpc_method_id , <nl> } <nl> # endif <nl> <nl> - for ( int i = 0 ; i < argc ; i + + ) { <nl> + if ( byte_only ) { <nl> + Vector < uint8_t > pure_data ; <nl> + const int len = p_packet_len - p_offset ; <nl> + pure_data . resize ( len ) ; <nl> + memcpy ( pure_data . ptrw ( ) , & p_packet [ p_offset ] , len ) ; <nl> + args . write [ 0 ] = pure_data ; <nl> + argp . write [ 0 ] = & args [ 0 ] ; <nl> + p_offset + = len ; <nl> + } else { <nl> + for ( int i = 0 ; i < argc ; i + + ) { <nl> <nl> - ERR_FAIL_COND_MSG ( p_offset > = p_packet_len , " Invalid packet received . Size too small . " ) ; <nl> + ERR_FAIL_COND_MSG ( p_offset > = p_packet_len , " Invalid packet received . Size too small . " ) ; <nl> <nl> - int vlen ; <nl> - Error err = _decode_and_decompress_variant ( args . write [ i ] , & p_packet [ p_offset ] , p_packet_len - p_offset , & vlen ) ; <nl> - ERR_FAIL_COND_MSG ( err ! = OK , " Invalid packet received . Unable to decode RPC argument . " ) ; <nl> + int vlen ; <nl> + Error err = _decode_and_decompress_variant ( args . write [ i ] , & p_packet [ p_offset ] , p_packet_len - p_offset , & vlen ) ; <nl> + ERR_FAIL_COND_MSG ( err ! = OK , " Invalid packet received . Unable to decode RPC argument . " ) ; <nl> <nl> - argp . write [ i ] = & args [ i ] ; <nl> - p_offset + = vlen ; <nl> + argp . write [ i ] = & args [ i ] ; <nl> + p_offset + = vlen ; <nl> + } <nl> } <nl> <nl> Callable : : CallError ce ; <nl> void MultiplayerAPI : : _send_rpc ( Node * p_from , int p_to , bool p_unreliable , bool p <nl> / / - ` NetworkCommands ` in the first three bits . <nl> / / - ` NetworkNodeIdCompression ` in the next 2 bits . <nl> / / - ` NetworkNameIdCompression ` in the next 1 bit . <nl> - / / - So we still have the last two bits free ! <nl> + / / - ` byte_only_or_no_args ` in the next 1 bit . <nl> + / / - So we still have the last bit free ! <nl> uint8_t command_type = p_set ? NETWORK_COMMAND_REMOTE_SET : NETWORK_COMMAND_REMOTE_CALL ; <nl> uint8_t node_id_compression = UINT8_MAX ; <nl> uint8_t name_id_compression = UINT8_MAX ; <nl> + bool byte_only_or_no_args = false ; <nl> <nl> MAKE_ROOM ( 1 ) ; <nl> / / The meta is composed along the way , so just set 0 for now . <nl> void MultiplayerAPI : : _send_rpc ( Node * p_from , int p_to , bool p_unreliable , bool p <nl> ofs + = 2 ; <nl> } <nl> <nl> - / / Call arguments . <nl> - MAKE_ROOM ( ofs + 1 ) ; <nl> - packet_cache . write [ ofs ] = p_argcount ; <nl> - ofs + = 1 ; <nl> - for ( int i = 0 ; i < p_argcount ; i + + ) { <nl> - int len ( 0 ) ; <nl> - Error err = _encode_and_compress_variant ( * p_arg [ i ] , NULL , len ) ; <nl> - ERR_FAIL_COND_MSG ( err ! = OK , " Unable to encode RPC argument . THIS IS LIKELY A BUG IN THE ENGINE ! " ) ; <nl> - MAKE_ROOM ( ofs + len ) ; <nl> - _encode_and_compress_variant ( * p_arg [ i ] , & ( packet_cache . write [ ofs ] ) , len ) ; <nl> - ofs + = len ; <nl> + if ( p_argcount = = 0 ) { <nl> + byte_only_or_no_args = true ; <nl> + } else if ( p_argcount = = 1 & & p_arg [ 0 ] - > get_type ( ) = = Variant : : PACKED_BYTE_ARRAY ) { <nl> + byte_only_or_no_args = true ; <nl> + / / Special optimization when only the byte vector is sent . <nl> + const Vector < uint8_t > data = * p_arg [ 0 ] ; <nl> + MAKE_ROOM ( ofs + data . size ( ) ) ; <nl> + copymem ( & ( packet_cache . write [ ofs ] ) , data . ptr ( ) , sizeof ( uint8_t ) * data . size ( ) ) ; <nl> + ofs + = data . size ( ) ; <nl> + } else { <nl> + / / Arguments <nl> + MAKE_ROOM ( ofs + 1 ) ; <nl> + packet_cache . write [ ofs ] = p_argcount ; <nl> + ofs + = 1 ; <nl> + for ( int i = 0 ; i < p_argcount ; i + + ) { <nl> + int len ( 0 ) ; <nl> + Error err = _encode_and_compress_variant ( * p_arg [ i ] , NULL , len ) ; <nl> + ERR_FAIL_COND_MSG ( err ! = OK , " Unable to encode RPC argument . THIS IS LIKELY A BUG IN THE ENGINE ! " ) ; <nl> + MAKE_ROOM ( ofs + len ) ; <nl> + _encode_and_compress_variant ( * p_arg [ i ] , & ( packet_cache . write [ ofs ] ) , len ) ; <nl> + ofs + = len ; <nl> + } <nl> } <nl> } <nl> <nl> void MultiplayerAPI : : _send_rpc ( Node * p_from , int p_to , bool p_unreliable , bool p <nl> ERR_FAIL_COND ( name_id_compression > 1 ) ; <nl> <nl> / / We can now set the meta <nl> - packet_cache . write [ 0 ] = command_type + ( node_id_compression < < 3 ) + ( name_id_compression < < 5 ) ; <nl> + packet_cache . write [ 0 ] = command_type + ( node_id_compression < < NODE_ID_COMPRESSION_SHIFT ) + ( name_id_compression < < NAME_ID_COMPRESSION_SHIFT ) + ( ( byte_only_or_no_args ? 1 : 0 ) < < BYTE_ONLY_OR_NO_ARGS_SHIFT ) ; <nl> <nl> # ifdef DEBUG_ENABLED <nl> if ( profiling ) { <nl>
|
Optimized rpc packet size when only the ` PackedByteArray ` is sent .
|
godotengine/godot
|
1afd60d8f5ecb30f024d3eedc3e83c08dd1e9447
|
2020-02-27T07:19:59Z
|
mmm a / tools / profiling / microbenchmarks / bm_diff . py <nl> ppp b / tools / profiling / microbenchmarks / bm_diff . py <nl> <nl> import itertools <nl> import speedup <nl> <nl> + _INTERESTING = ( <nl> + ' cpu_time ' , <nl> + ' real_time ' , <nl> + ' locks_per_iteration ' , <nl> + ' allocs_per_iteration ' , <nl> + ' writes_per_iteration ' , <nl> + ' atm_cas_per_iteration ' , <nl> + ' atm_add_per_iteration ' , <nl> + ) <nl> + <nl> def changed_ratio ( n , o ) : <nl> if float ( o ) < = . 0001 : o = 0 <nl> if float ( n ) < = . 0001 : n = 0 <nl> def min_change ( pct ) : <nl> <nl> argp = argparse . ArgumentParser ( description = ' Perform diff on microbenchmarks ' ) <nl> argp . add_argument ( ' - t ' , ' - - track ' , <nl> - choices = sorted ( _INTERESTING . keys ( ) ) , <nl> + choices = sorted ( _INTERESTING ) , <nl> nargs = ' + ' , <nl> - default = sorted ( _INTERESTING . keys ( ) ) , <nl> + default = sorted ( _INTERESTING ) , <nl> help = ' Which metrics to track ' ) <nl> argp . add_argument ( ' - b ' , ' - - benchmarks ' , nargs = ' + ' , choices = _AVAILABLE_BENCHMARK_TESTS , default = [ ' bm_cq ' ] ) <nl> argp . add_argument ( ' - d ' , ' - - diff_base ' , type = str ) <nl>
|
fix
|
grpc/grpc
|
7281d19de374852abf38521a20ef96b88e2916e9
|
2017-04-05T22:04:55Z
|
mmm a / lib / AST / Expr . cpp <nl> ppp b / lib / AST / Expr . cpp <nl> namespace { <nl> <nl> / / / Returns true on failure . <nl> bool visitDecl ( Decl * D ) { <nl> - if ( ValueDecl * VD = dyn_cast < ValueDecl > ( D ) ) { <nl> + if ( VarDecl * VD = dyn_cast < VarDecl > ( D ) ) { <nl> if ( Expr * Init = VD - > getInit ( ) ) { <nl> # ifndef NDEBUG <nl> PrettyStackTraceDecl debugStack ( " walking into initializer for " , VD ) ; <nl> namespace { <nl> else <nl> return true ; <nl> } <nl> + } else if ( FuncDecl * FD = dyn_cast < FuncDecl > ( D ) ) { <nl> + if ( FuncExpr * Body = FD - > getBody ( ) ) { <nl> + # ifndef NDEBUG <nl> + PrettyStackTraceDecl debugStack ( " walking into body of " , FD ) ; <nl> + # endif <nl> + if ( FuncExpr * E2 = cast_or_null < FuncExpr > ( doIt ( Body ) ) ) <nl> + FD - > setBody ( E2 ) ; <nl> + else <nl> + return true ; <nl> + } <nl> + <nl> } else if ( ExtensionDecl * ED = dyn_cast < ExtensionDecl > ( D ) ) { <nl> for ( Decl * M : ED - > getMembers ( ) ) { <nl> if ( visitDecl ( M ) ) <nl>
|
stop using ValueDecl : : getInit
|
apple/swift
|
167129d0b064ed646576f127445e473a51214166
|
2012-01-18T07:01:05Z
|
mmm a / tensorflow / python / tpu / BUILD <nl> ppp b / tensorflow / python / tpu / BUILD <nl> tf_py_test ( <nl> tf_proto_library ( <nl> name = " tensor_tracer_proto " , <nl> srcs = [ " tensor_tracer . proto " ] , <nl> + cc_api_version = 2 , <nl> protodeps = [ <nl> " / / tensorflow / core : protos_all " , <nl> ] , <nl>
|
Add missing cc_api_version arg to proto library .
|
tensorflow/tensorflow
|
a5d49ba9366f19e71859291656fe53d3b48c08c2
|
2019-12-20T00:25:15Z
|
mmm a / lib / browser / api / menu . js <nl> ppp b / lib / browser / api / menu . js <nl> const bindings = process . atomBinding ( ' menu ' ) <nl> <nl> const { Menu } = bindings <nl> let applicationMenu = null <nl> - let nextGroupId = 0 <nl> + let groupIdIndex = 0 <nl> <nl> Object . setPrototypeOf ( Menu . prototype , EventEmitter . prototype ) <nl> <nl> Menu . prototype . _init = function ( ) { <nl> command . click ( event , BrowserWindow . getFocusedWindow ( ) , webContents . getFocusedWebContents ( ) ) <nl> } , <nl> menuWillShow : ( ) = > { <nl> - / / Make sure radio groups have at least one menu item seleted . <nl> - var checked , group , id , j , len , radioItem , ref1 <nl> - ref1 = this . groupsMap <nl> - for ( id in ref1 ) { <nl> - group = ref1 [ id ] <nl> - checked = false <nl> - for ( j = 0 , len = group . length ; j < len ; j + + ) { <nl> - radioItem = group [ j ] <nl> - if ( ! radioItem . checked ) { <nl> - continue <nl> - } <nl> - checked = true <nl> - break <nl> - } <nl> - if ( ! checked ) { <nl> - v8Util . setHiddenValue ( group [ 0 ] , ' checked ' , true ) <nl> - } <nl> + / / Ensure radio groups have at least one menu item seleted <nl> + for ( let id in this . groupsMap ) { <nl> + let found = this . groupsMap [ id ] . find ( item = > item . checked ) | | null <nl> + if ( ! found ) v8Util . setHiddenValue ( this . groupsMap [ id ] [ 0 ] , ' checked ' , true ) <nl> } <nl> } <nl> } <nl> Menu . buildFromTemplate = function ( template ) { <nl> <nl> / / Search between separators to find a radio menu item and return its group id , <nl> function generateGroupId ( items , pos ) { <nl> - var i , item , j , k , ref1 , ref2 , ref3 <nl> + let i , item <nl> if ( pos > 0 ) { <nl> - for ( i = j = ref1 = pos - 1 ; ref1 < = 0 ? j < = 0 : j > = 0 ; i = ref1 < = 0 ? + + j : - - j ) { <nl> + let asc , start <nl> + for ( start = pos - 1 , i = start , asc = start < = 0 ; asc ? i < = 0 : i > = 0 ; asc ? i + + : i - - ) { <nl> item = items [ i ] <nl> - if ( item . type = = = ' radio ' ) { <nl> - return item . groupId <nl> - } <nl> - if ( item . type = = = ' separator ' ) { <nl> - break <nl> - } <nl> + if ( item . type = = = ' radio ' ) { return item . groupId } <nl> + if ( item . type = = = ' separator ' ) { break } <nl> } <nl> } else if ( pos < items . length ) { <nl> - for ( i = k = ref2 = pos , ref3 = items . length - 1 ; ref2 < = ref3 ? k < = ref3 : k > = ref3 ; i = ref2 < = ref3 ? + + k : - - k ) { <nl> + let asc1 , end <nl> + for ( i = pos , end = items . length - 1 , asc1 = pos < = end ; asc1 ? i < = end : i > = end ; asc1 ? i + + : i - - ) { <nl> item = items [ i ] <nl> - if ( item . type = = = ' radio ' ) { <nl> - return item . groupId <nl> - } <nl> - if ( item . type = = = ' separator ' ) { <nl> - break <nl> - } <nl> + if ( item . type = = = ' radio ' ) { return item . groupId } <nl> + if ( item . type = = = ' separator ' ) { break } <nl> } <nl> } <nl> - return + + nextGroupId <nl> + return + + groupIdIndex <nl> } <nl> <nl> / / Returns the index of item according to | id | . <nl> function indexOfItemById ( items , id ) { <nl> } <nl> <nl> / / Returns the index of where to insert the item according to | position | <nl> + / / cleaned up <nl> function indexToInsertByPosition ( items , position ) { <nl> if ( ! position ) return items . length <nl> <nl> function indexToInsertByPosition ( items , position ) { <nl> return ( query in queries ) ? queries [ query ] ( idx ) : idx <nl> } <nl> <nl> - function computeNewIndexOnQuery ( idx , query ) { <nl> - <nl> - } <nl> - <nl> module . exports = Menu <nl> \ No newline at end of file <nl>
|
refactor menuWillShow
|
electron/electron
|
9b364d5be30c24e998bc2acb22f1812838f1ac06
|
2017-10-24T02:22:39Z
|
mmm a / src / Storages / IStorage . cpp <nl> ppp b / src / Storages / IStorage . cpp <nl> namespace DB <nl> <nl> namespace ErrorCodes <nl> { <nl> - extern const int LOGICAL_ERROR ; <nl> extern const int TABLE_IS_DROPPED ; <nl> extern const int NOT_IMPLEMENTED ; <nl> extern const int DEADLOCK_AVOIDED ; <nl>
|
Fix style
|
ClickHouse/ClickHouse
|
b3ee8967dce4f9b6e9e99e447ff3b63a4b2d7e63
|
2020-06-18T16:28:20Z
|
mmm a / Marlin / src / lcd / dwin / e3v2 / dwin . cpp <nl> ppp b / Marlin / src / lcd / dwin / e3v2 / dwin . cpp <nl> inline void Draw_Back_First ( const bool is_sel = true ) { <nl> if ( is_sel ) Draw_Menu_Cursor ( 0 ) ; <nl> } <nl> <nl> + inline bool Apply_Encoder ( const ENCODER_DiffState & encoder_diffState , auto & valref ) { <nl> + if ( encoder_diffState = = ENCODER_DIFF_CW ) <nl> + valref + = EncoderRate . encoderMoveValue ; <nl> + else if ( encoder_diffState = = ENCODER_DIFF_CCW ) <nl> + valref - = EncoderRate . encoderMoveValue ; <nl> + else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) <nl> + return true ; <nl> + return false ; <nl> + } <nl> + <nl> / / <nl> / / Draw Menus <nl> / / <nl> inline ENCODER_DiffState get_encoder_state ( ) { <nl> void HMI_Move_X ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Move_X_scale + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Move_X_scale - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Move_X_scale ) ) { <nl> checkkey = AxisMove ; <nl> EncoderRate . enabled = false ; <nl> DWIN_Draw_FloatValue ( true , true , 0 , font8x16 , Color_White , Color_Bg_Black , 3 , 1 , 216 , MBASE ( 1 ) , HMI_ValueStruct . Move_X_scale ) ; <nl> void HMI_Move_X ( ) { <nl> void HMI_Move_Y ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Move_Y_scale + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Move_Y_scale - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Move_Y_scale ) ) { <nl> checkkey = AxisMove ; <nl> EncoderRate . enabled = false ; <nl> DWIN_Draw_FloatValue ( true , true , 0 , font8x16 , Color_White , Color_Bg_Black , 3 , 1 , 216 , MBASE ( 2 ) , HMI_ValueStruct . Move_Y_scale ) ; <nl> void HMI_Move_Y ( ) { <nl> void HMI_Move_Z ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Move_Z_scale + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Move_Z_scale - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Move_Z_scale ) ) { <nl> checkkey = AxisMove ; <nl> EncoderRate . enabled = false ; <nl> DWIN_Draw_FloatValue ( true , true , 0 , font8x16 , Color_White , Color_Bg_Black , 3 , 1 , 216 , MBASE ( 3 ) , HMI_ValueStruct . Move_Z_scale ) ; <nl> void HMI_Move_Z ( ) { <nl> static float last_E_scale = 0 ; <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Move_E_scale + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Move_E_scale - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Move_E_scale ) ) { <nl> checkkey = AxisMove ; <nl> EncoderRate . enabled = false ; <nl> last_E_scale = HMI_ValueStruct . Move_E_scale ; <nl> void HMI_Move_Z ( ) { <nl> case - 4 : zoff_line = PREPARE_CASE_ZOFF + MROWS - index_prepare ; break ; <nl> default : zoff_line = TUNE_CASE_ZOFF + MROWS - index_tune ; <nl> } <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) <nl> - HMI_ValueStruct . offset_value + = EncoderRate . encoderMoveValue ; <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) <nl> - HMI_ValueStruct . offset_value - = EncoderRate . encoderMoveValue ; <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . offset_value ) ) { <nl> EncoderRate . enabled = false ; <nl> # if HAS_BED_PROBE <nl> probe . offset . z = dwin_zoffset ; <nl> void HMI_Move_Z ( ) { <nl> case - 3 : temp_line = PREHEAT_CASE_TEMP ; break ; <nl> default : temp_line = TUNE_CASE_TEMP + MROWS - index_tune ; <nl> } <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . E_Temp + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . E_Temp - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . E_Temp ) ) { <nl> EncoderRate . enabled = false ; <nl> if ( HMI_ValueStruct . show_mode = = - 1 ) { / / temperature <nl> checkkey = TemperatureID ; <nl> void HMI_Move_Z ( ) { <nl> case - 3 : bed_line = PREHEAT_CASE_BED ; break ; <nl> default : bed_line = TUNE_CASE_BED + MROWS - index_tune ; <nl> } <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Bed_Temp + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Bed_Temp - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Bed_Temp ) ) { <nl> EncoderRate . enabled = false ; <nl> if ( HMI_ValueStruct . show_mode = = - 1 ) { <nl> checkkey = TemperatureID ; <nl> void HMI_Move_Z ( ) { <nl> default : fan_line = TUNE_CASE_FAN + MROWS - index_tune ; <nl> } <nl> <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Fan_speed + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Fan_speed - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Fan_speed ) ) { <nl> EncoderRate . enabled = false ; <nl> if ( HMI_ValueStruct . show_mode = = - 1 ) { <nl> checkkey = TemperatureID ; <nl> void HMI_Move_Z ( ) { <nl> void HMI_PrintSpeed ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . print_speed + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . print_speed - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . print_speed ) ) { <nl> checkkey = Tune ; <nl> EncoderRate . enabled = false ; <nl> feedrate_percentage = HMI_ValueStruct . print_speed ; <nl> void HMI_PrintSpeed ( ) { <nl> void HMI_MaxFeedspeedXYZE ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Max_Feedspeed + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Max_Feedspeed - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Max_Feedspeed ) ) { <nl> checkkey = MaxSpeed ; <nl> EncoderRate . enabled = false ; <nl> if ( WITHIN ( HMI_flag . feedspeed_axis , X_AXIS , E_AXIS ) ) <nl> void HMI_MaxFeedspeedXYZE ( ) { <nl> void HMI_MaxAccelerationXYZE ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { HMI_ValueStruct . Max_Acceleration + = EncoderRate . encoderMoveValue ; } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { HMI_ValueStruct . Max_Acceleration - = EncoderRate . encoderMoveValue ; } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Max_Acceleration ) ) { <nl> checkkey = MaxAcceleration ; <nl> EncoderRate . enabled = false ; <nl> if ( HMI_flag . acc_axis = = X_AXIS ) planner . set_max_acceleration ( X_AXIS , HMI_ValueStruct . Max_Acceleration ) ; <nl> void HMI_MaxAccelerationXYZE ( ) { <nl> void HMI_MaxJerkXYZE ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) <nl> - HMI_ValueStruct . Max_Jerk + = EncoderRate . encoderMoveValue ; <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) <nl> - HMI_ValueStruct . Max_Jerk - = EncoderRate . encoderMoveValue ; <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Max_Jerk ) ) { <nl> checkkey = MaxJerk ; <nl> EncoderRate . enabled = false ; <nl> if ( WITHIN ( HMI_flag . step_axis , X_AXIS , E_AXIS ) ) <nl> void HMI_MaxAccelerationXYZE ( ) { <nl> void HMI_StepXYZE ( ) { <nl> ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze ( ) ; <nl> if ( encoder_diffState ! = ENCODER_DIFF_NO ) { <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> - HMI_ValueStruct . Max_Step + = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> - HMI_ValueStruct . Max_Step - = EncoderRate . encoderMoveValue ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { / / return <nl> + if ( Apply_Encoder ( encoder_diffState , HMI_ValueStruct . Max_Step ) ) { <nl> checkkey = Step ; <nl> EncoderRate . enabled = false ; <nl> if ( WITHIN ( HMI_flag . step_axis , X_AXIS , E_AXIS ) ) <nl> void HMI_SDCardUpdate ( ) { <nl> if ( DWIN_lcd_sd_status ! = card . isMounted ( ) ) { <nl> DWIN_lcd_sd_status = card . isMounted ( ) ; <nl> / / SERIAL_ECHOLNPAIR ( " HMI_SDCardUpdate : " , int ( DWIN_lcd_sd_status ) ) ; <nl> - if ( card . isMounted ( ) ) { <nl> + if ( DWIN_lcd_sd_status ) { <nl> if ( checkkey = = SelectFile ) <nl> Redraw_SD_List ( ) ; <nl> } <nl> void HMI_SDCardUpdate ( ) { <nl> } <nl> } <nl> <nl> - / * Start Frame * / <nl> - <nl> - void HMI_StartFrame ( const bool with_update ) { <nl> - Goto_MainMenu ( ) ; <nl> + / / <nl> + / / The status area is always on - screen , except during <nl> + / / full - screen modal dialogs . ( TODO : Keep alive during dialogs ) <nl> + / / <nl> + void Draw_Status_Area ( const bool with_update ) { <nl> <nl> / / Clear the bottom area of the screen <nl> DWIN_Draw_Rectangle ( 1 , Color_Bg_Black , 0 , STATUS_Y , DWIN_WIDTH , DWIN_HEIGHT - 1 ) ; <nl> void HMI_StartFrame ( const bool with_update ) { <nl> } <nl> } <nl> <nl> + void HMI_StartFrame ( const bool with_update ) { <nl> + Goto_MainMenu ( ) ; <nl> + Draw_Status_Area ( with_update ) ; <nl> + } <nl> + <nl> inline void Draw_Info_Menu ( ) { <nl> Clear_Main_Window ( ) ; <nl> <nl> void HMI_PauseOrStop ( ) { <nl> ENCODER_DiffState encoder_diffState = get_encoder_state ( ) ; <nl> if ( encoder_diffState = = ENCODER_DIFF_NO ) return ; <nl> <nl> - if ( encoder_diffState = = ENCODER_DIFF_CW ) { <nl> + if ( encoder_diffState = = ENCODER_DIFF_CW ) <nl> Draw_Select_Highlight ( false ) ; <nl> - } <nl> - else if ( encoder_diffState = = ENCODER_DIFF_CCW ) { <nl> + else if ( encoder_diffState = = ENCODER_DIFF_CCW ) <nl> Draw_Select_Highlight ( true ) ; <nl> - } <nl> else if ( encoder_diffState = = ENCODER_DIFF_ENTER ) { <nl> if ( select_print . now = = 1 ) { / / pause window <nl> if ( HMI_flag . select_flag ) { <nl> mmm a / Marlin / src / lcd / dwin / e3v2 / dwin . h <nl> ppp b / Marlin / src / lcd / dwin / e3v2 / dwin . h <nl> void Icon_temperature ( bool value ) ; <nl> void Icon_leveling ( bool value ) ; <nl> <nl> / / Other <nl> - bool Pause_HeatStatus ( ) ; <nl> - void HMI_StartFrame ( const bool with_update ) ; / / Startup screen <nl> + void Draw_Status_Area ( const bool with_update ) ; / / Status Area <nl> + void HMI_StartFrame ( const bool with_update ) ; / / Prepare the menu view <nl> void HMI_MainMenu ( ) ; / / Main process screen <nl> void HMI_SelectFile ( ) ; / / File page <nl> void HMI_Printing ( ) ; / / Print page <nl>
|
E3 DWIN : General cleanup
|
MarlinFirmware/Marlin
|
37cf156223058d7c2d576dbffc39e7b2987254ef
|
2020-09-27T21:55:57Z
|
mmm a / stdlib / public / core / ClosedRange . swift <nl> ppp b / stdlib / public / core / ClosedRange . swift <nl> public struct ClosedRange < Bound : Comparable > { <nl> / / / The range ' s upper bound . <nl> public let upperBound : Bound <nl> <nl> + / / This works around _debugPrecondition ( ) impacting the performance of <nl> + / / optimized code . ( rdar : / / 72246338 ) <nl> + @ _alwaysEmitIntoClient @ inline ( __always ) <nl> + internal init ( _uncheckedBounds bounds : ( lower : Bound , upper : Bound ) ) { <nl> + self . lowerBound = bounds . lower <nl> + self . upperBound = bounds . upper <nl> + } <nl> + <nl> / / / Creates an instance with the given bounds . <nl> / / / <nl> / / / Because this initializer does not perform any checks , it should be used <nl> public struct ClosedRange < Bound : Comparable > { <nl> / / / - Parameter bounds : A tuple of the lower and upper bounds of the range . <nl> @ inlinable <nl> public init ( uncheckedBounds bounds : ( lower : Bound , upper : Bound ) ) { <nl> - self . lowerBound = bounds . lower <nl> - self . upperBound = bounds . upper <nl> + _debugPrecondition ( bounds . lower < = bounds . upper , <nl> + " ClosedRange requires lowerBound < = upperBound " ) <nl> + self . init ( _uncheckedBounds : ( lower : bounds . lower , upper : bounds . upper ) ) <nl> } <nl> } <nl> <nl> extension ClosedRange : RangeExpression { <nl> public func relative < C : Collection > ( to collection : C ) - > Range < Bound > <nl> where C . Index = = Bound { <nl> return Range ( <nl> - uncheckedBounds : ( <nl> - lower : lowerBound , upper : collection . index ( after : self . upperBound ) ) ) <nl> + _uncheckedBounds : ( <nl> + lower : lowerBound , <nl> + upper : collection . index ( after : self . upperBound ) ) ) <nl> } <nl> <nl> / / / Returns a Boolean value indicating whether the given element is contained <nl> extension Comparable { <nl> public static func . . . ( minimum : Self , maximum : Self ) - > ClosedRange < Self > { <nl> _precondition ( <nl> minimum < = maximum , " Range requires lowerBound < = upperBound " ) <nl> - return ClosedRange ( uncheckedBounds : ( lower : minimum , upper : maximum ) ) <nl> + return ClosedRange ( _uncheckedBounds : ( lower : minimum , upper : maximum ) ) <nl> } <nl> } <nl> <nl> extension ClosedRange { <nl> limits . upperBound < self . upperBound ? limits . upperBound <nl> : limits . lowerBound > self . upperBound ? limits . lowerBound <nl> : self . upperBound <nl> - return ClosedRange ( uncheckedBounds : ( lower : lower , upper : upper ) ) <nl> + return ClosedRange ( _uncheckedBounds : ( lower : lower , upper : upper ) ) <nl> } <nl> } <nl> <nl> extension ClosedRange where Bound : Strideable , Bound . Stride : SignedInteger { <nl> public init ( _ other : Range < Bound > ) { <nl> _precondition ( ! other . isEmpty , " Can ' t form an empty closed range " ) <nl> let upperBound = other . upperBound . advanced ( by : - 1 ) <nl> - self . init ( uncheckedBounds : ( lower : other . lowerBound , upper : upperBound ) ) <nl> + self . init ( _uncheckedBounds : ( lower : other . lowerBound , upper : upperBound ) ) <nl> } <nl> } <nl> <nl> extension ClosedRange : Decodable where Bound : Decodable { <nl> codingPath : decoder . codingPath , <nl> debugDescription : " Cannot initialize \ ( ClosedRange . self ) with a lowerBound ( \ ( lowerBound ) ) greater than upperBound ( \ ( upperBound ) ) " ) ) <nl> } <nl> - self . init ( uncheckedBounds : ( lower : lowerBound , upper : upperBound ) ) <nl> + self . init ( _uncheckedBounds : ( lower : lowerBound , upper : upperBound ) ) <nl> } <nl> } <nl> <nl> mmm a / stdlib / public / core / Range . swift <nl> ppp b / stdlib / public / core / Range . swift <nl> public struct Range < Bound : Comparable > { <nl> / / / instance does not contain its upper bound . <nl> public let upperBound : Bound <nl> <nl> + / / This works around _debugPrecondition ( ) impacting the performance of <nl> + / / optimized code . ( rdar : / / 72246338 ) <nl> + @ _alwaysEmitIntoClient @ inline ( __always ) <nl> + internal init ( _uncheckedBounds bounds : ( lower : Bound , upper : Bound ) ) { <nl> + self . lowerBound = bounds . lower <nl> + self . upperBound = bounds . upper <nl> + } <nl> + <nl> / / / Creates an instance with the given bounds . <nl> / / / <nl> / / / Because this initializer does not perform any checks , it should be used <nl> public struct Range < Bound : Comparable > { <nl> / / / - Parameter bounds : A tuple of the lower and upper bounds of the range . <nl> @ inlinable <nl> public init ( uncheckedBounds bounds : ( lower : Bound , upper : Bound ) ) { <nl> - self . lowerBound = bounds . lower <nl> - self . upperBound = bounds . upper <nl> + _debugPrecondition ( bounds . lower < = bounds . upper , <nl> + " Range requires lowerBound < = upperBound " ) <nl> + self . init ( _uncheckedBounds : ( lower : bounds . lower , upper : bounds . upper ) ) <nl> } <nl> <nl> / / / Returns a Boolean value indicating whether the given element is contained <nl> extension Range where Bound : Strideable , Bound . Stride : SignedInteger { <nl> / / / require an upper bound of ` Int . max + 1 ` , which is not representable as <nl> public init ( _ other : ClosedRange < Bound > ) { <nl> let upperBound = other . upperBound . advanced ( by : 1 ) <nl> - self . init ( uncheckedBounds : ( lower : other . lowerBound , upper : upperBound ) ) <nl> + self . init ( _uncheckedBounds : ( lower : other . lowerBound , upper : upperBound ) ) <nl> } <nl> } <nl> <nl> extension Range : RangeExpression { <nl> @ inlinable / / trivial - implementation <nl> public func relative < C : Collection > ( to collection : C ) - > Range < Bound > <nl> where C . Index = = Bound { <nl> - return Range ( uncheckedBounds : ( lower : lowerBound , upper : upperBound ) ) <nl> + self <nl> } <nl> } <nl> <nl> extension Range { <nl> limits . upperBound < self . upperBound ? limits . upperBound <nl> : limits . lowerBound > self . upperBound ? limits . lowerBound <nl> : self . upperBound <nl> - return Range ( uncheckedBounds : ( lower : lower , upper : upper ) ) <nl> + return Range ( _uncheckedBounds : ( lower : lower , upper : upper ) ) <nl> } <nl> } <nl> <nl> extension Range : Decodable where Bound : Decodable { <nl> codingPath : decoder . codingPath , <nl> debugDescription : " Cannot initialize \ ( Range . self ) with a lowerBound ( \ ( lowerBound ) ) greater than upperBound ( \ ( upperBound ) ) " ) ) <nl> } <nl> - self . init ( uncheckedBounds : ( lower : lowerBound , upper : upperBound ) ) <nl> + self . init ( _uncheckedBounds : ( lower : lowerBound , upper : upperBound ) ) <nl> } <nl> } <nl> <nl> extension Comparable { <nl> public static func . . < ( minimum : Self , maximum : Self ) - > Range < Self > { <nl> _precondition ( minimum < = maximum , <nl> " Range requires lowerBound < = upperBound " ) <nl> - return Range ( uncheckedBounds : ( lower : minimum , upper : maximum ) ) <nl> + return Range ( _uncheckedBounds : ( lower : minimum , upper : maximum ) ) <nl> } <nl> <nl> / / / Returns a partial range up to , but not including , its upper bound . <nl> mmm a / stdlib / public / core / SmallString . swift <nl> ppp b / stdlib / public / core / SmallString . swift <nl> extension _SmallString { <nl> / / Restore the memory type of self . _storage <nl> _ = rawPtr . bindMemory ( to : RawBitPattern . self , capacity : 1 ) <nl> } <nl> - return try f ( UnsafeBufferPointer ( start : ptr , count : count ) ) <nl> + return try f ( UnsafeBufferPointer ( _uncheckedStart : ptr , count : count ) ) <nl> } <nl> } <nl> <nl> mmm a / stdlib / public / core / String . swift <nl> ppp b / stdlib / public / core / String . swift <nl> extension String { <nl> contigBytes . _providesContiguousBytesNoCopy <nl> { <nl> self = contigBytes . withUnsafeBytes { rawBufPtr in <nl> + Builtin . onFastPath ( ) / / encourage SIL Optimizer to inline this closure <nl> return String . _fromUTF8Repairing ( <nl> UnsafeBufferPointer ( <nl> start : rawBufPtr . baseAddress ? . assumingMemoryBound ( to : UInt8 . self ) , <nl> mmm a / stdlib / public / core / StringObject . swift <nl> ppp b / stdlib / public / core / StringObject . swift <nl> extension _StringObject { <nl> return sharedUTF8 <nl> } <nl> return UnsafeBufferPointer ( <nl> - start : self . nativeUTF8Start , count : self . largeCount ) <nl> + _uncheckedStart : self . nativeUTF8Start , count : self . largeCount ) <nl> } <nl> <nl> / / Whether the object stored can be bridged directly as a NSString <nl> mmm a / stdlib / public / core / StringProtocol . swift <nl> ppp b / stdlib / public / core / StringProtocol . swift <nl> extension StringProtocol { <nl> let end = endIndex <nl> _internalInvariant ( <nl> start . transcodedOffset = = 0 & & end . transcodedOffset = = 0 ) <nl> - return Range ( uncheckedBounds : ( start . _encodedOffset , end . _encodedOffset ) ) <nl> + return Range ( _uncheckedBounds : ( start . _encodedOffset , end . _encodedOffset ) ) <nl> } <nl> } <nl> <nl> mmm a / stdlib / public / core / StringStorageBridge . swift <nl> ppp b / stdlib / public / core / StringStorageBridge . swift <nl> extension _AbstractStringStorage { <nl> " Range out of bounds " ) <nl> <nl> let range = Range ( <nl> - uncheckedBounds : ( aRange . location , aRange . location + aRange . length ) ) <nl> + _uncheckedBounds : ( aRange . location , aRange . location + aRange . length ) ) <nl> let str = asString <nl> str . _copyUTF16CodeUnits ( <nl> into : UnsafeMutableBufferPointer ( start : buffer , count : range . count ) , <nl> mmm a / stdlib / public / core / Substring . swift <nl> ppp b / stdlib / public / core / Substring . swift <nl> public struct Substring { <nl> <nl> self . _slice = Slice ( <nl> base : slice . base , <nl> - bounds : Range ( uncheckedBounds : ( start , end ) ) ) <nl> + bounds : Range ( _uncheckedBounds : ( start , end ) ) ) <nl> _invariantCheck ( ) <nl> } <nl> <nl> extension Substring { <nl> @ inlinable @ inline ( __always ) <nl> internal var _offsetRange : Range < Int > { <nl> return Range ( <nl> - uncheckedBounds : ( startIndex . _encodedOffset , endIndex . _encodedOffset ) ) <nl> + _uncheckedBounds : ( startIndex . _encodedOffset , endIndex . _encodedOffset ) ) <nl> } <nl> <nl> # if ! INTERNAL_CHECKS_ENABLED <nl> extension Substring : CustomDebugStringConvertible { <nl> <nl> extension Substring : LosslessStringConvertible { <nl> public init ( _ content : String ) { <nl> - self = content [ . . . ] <nl> + let range = Range ( _uncheckedBounds : ( content . startIndex , content . endIndex ) ) <nl> + self . init ( Slice ( base : content , bounds : range ) ) <nl> } <nl> } <nl> <nl> extension Substring : RangeReplaceableCollection { <nl> public init < S : Sequence > ( _ elements : S ) <nl> where S . Element = = Character { <nl> if let str = elements as ? String { <nl> - self = str [ . . . ] <nl> + self . init ( str ) <nl> return <nl> } <nl> if let subStr = elements as ? Substring { <nl> self = subStr <nl> return <nl> } <nl> - self = String ( elements ) [ . . . ] <nl> + self . init ( String ( elements ) ) <nl> } <nl> <nl> @ inlinable / / specialize <nl> mmm a / stdlib / public / core / UnsafeBufferPointer . swift . gyb <nl> ppp b / stdlib / public / core / UnsafeBufferPointer . swift . gyb <nl> extension Unsafe $ { Mutable } BufferPointer : $ { Mutable } Collection , RandomAccessColle <nl> / / optimizer is not capable of creating partial specializations yet . <nl> / / NOTE : Range checks are not performed here , because it is done later by <nl> / / the subscript function . <nl> - return end - start <nl> + / / NOTE : We allow the subtraction to silently overflow in release builds <nl> + / / to eliminate a superflous check when ` start ` and ` end ` are both valid <nl> + / / indices . ( The operation can only overflow if ` start ` is negative , which <nl> + / / implies it ' s an invalid index . ) ` Collection ` does not specify what <nl> + / / ` distance ` should return when given an invalid index pair . <nl> + let result = end . subtractingReportingOverflow ( start ) <nl> + _debugPrecondition ( ! result . overflow ) <nl> + return result . partialValue <nl> } <nl> <nl> @ inlinable / / unsafe - performance <nl> extension Unsafe $ { Mutable } BufferPointer : $ { Mutable } Collection , RandomAccessColle <nl> } <nl> <nl> extension Unsafe $ { Mutable } BufferPointer { <nl> + / / This works around _debugPrecondition ( ) impacting the performance of <nl> + / / optimized code . ( rdar : / / 72246338 ) <nl> + @ _alwaysEmitIntoClient <nl> + internal init ( <nl> + @ _nonEphemeral _uncheckedStart start : Unsafe $ { Mutable } Pointer < Element > ? , <nl> + count : Int <nl> + ) { <nl> + _position = start <nl> + self . count = count <nl> + } <nl> + <nl> / / / Creates a new buffer pointer over the specified number of contiguous <nl> / / / instances beginning at the given pointer . <nl> / / / <nl> extension Unsafe $ { Mutable } BufferPointer { <nl> public init ( <nl> @ _nonEphemeral start : Unsafe $ { Mutable } Pointer < Element > ? , count : Int <nl> ) { <nl> - _precondition ( <nl> + _debugPrecondition ( <nl> count > = 0 , " Unsafe $ { Mutable } BufferPointer with negative count " ) <nl> - _precondition ( <nl> + _debugPrecondition ( <nl> count = = 0 | | start ! = nil , <nl> " Unsafe $ { Mutable } BufferPointer has a nil start and nonzero count " ) <nl> - _position = start <nl> - self . count = count <nl> + self . init ( _uncheckedStart : start , count : _assumeNonNegative ( count ) ) <nl> } <nl> <nl> @ inlinable / / unsafe - performance <nl> extension Unsafe $ { Mutable } BufferPointer { <nl> / / / - Parameter slice : The buffer slice to rebase . <nl> @ inlinable / / unsafe - performance <nl> public init ( rebasing slice : Slice < UnsafeBufferPointer < Element > > ) { <nl> + / / NOTE : ` Slice ` does not guarantee that its start / end indices are valid <nl> + / / in ` base ` - - it merely ensures that ` startIndex < = endIndex ` . <nl> + / / We need manually check that we aren ' t given an invalid slice , <nl> + / / or the resulting collection would allow access that was <nl> + / / out - of - bounds with respect to the original base buffer . <nl> + / / We only do this in debug builds to prevent a measurable performance <nl> + / / degradation wrt passing around pointers not wrapped in a BufferPointer <nl> + / / construct . <nl> + _debugPrecondition ( <nl> + slice . startIndex > = 0 & & slice . endIndex < = slice . base . count , <nl> + " Invalid slice " ) <nl> let base = slice . base . baseAddress ? . advanced ( by : slice . startIndex ) <nl> let count = slice . endIndex & - slice . startIndex <nl> self . init ( start : base , count : count ) <nl> mmm a / stdlib / public / core / UnsafeRawBufferPointer . swift . gyb <nl> ppp b / stdlib / public / core / UnsafeRawBufferPointer . swift . gyb <nl> extension Unsafe $ { Mutable } RawBufferPointer : $ { Mutable } Collection { <nl> @ inlinable <nl> public var count : Int { <nl> if let pos = _position { <nl> - return _end ! - pos <nl> + return _assumeNonNegative ( _end ! - pos ) <nl> } <nl> return 0 <nl> } <nl> extension Unsafe $ { Mutable } RawBufferPointer { <nl> public init ( <nl> @ _nonEphemeral start : Unsafe $ { Mutable } RawPointer ? , count : Int <nl> ) { <nl> - _precondition ( count > = 0 , " $ { Self } with negative count " ) <nl> - _precondition ( count = = 0 | | start ! = nil , <nl> + _debugPrecondition ( count > = 0 , " $ { Self } with negative count " ) <nl> + _debugPrecondition ( count = = 0 | | start ! = nil , <nl> " $ { Self } has a nil start and nonzero count " ) <nl> _position = start <nl> - _end = start . map { $ 0 + count } <nl> + _end = start . map { $ 0 + _assumeNonNegative ( count ) } <nl> } <nl> <nl> / / / Creates a new buffer over the same memory as the given buffer . <nl> extension Unsafe $ { Mutable } RawBufferPointer { <nl> / / / - Parameter slice : The raw buffer slice to rebase . <nl> @ inlinable <nl> public init ( rebasing slice : Slice < UnsafeRawBufferPointer > ) { <nl> + / / NOTE : ` Slice ` does not guarantee that its start / end indices are valid <nl> + / / in ` base ` - - it merely ensures that ` startIndex < = endIndex ` . <nl> + / / We need manually check that we aren ' t given an invalid slice , <nl> + / / or the resulting collection would allow access that was <nl> + / / out - of - bounds with respect to the original base buffer . <nl> + / / We only do this in debug builds to prevent a measurable performance <nl> + / / degradation wrt passing around pointers not wrapped in a BufferPointer <nl> + / / construct . <nl> + _debugPrecondition ( <nl> + slice . startIndex > = 0 & & slice . endIndex < = slice . base . count , <nl> + " Invalid slice " ) <nl> let base = slice . base . baseAddress ? . advanced ( by : slice . startIndex ) <nl> let count = slice . endIndex & - slice . startIndex <nl> self . init ( start : base , count : count ) <nl> mmm a / test / stdlib / RangeTraps . swift <nl> ppp b / test / stdlib / RangeTraps . swift <nl> RangeTraps . test ( " throughNaN " ) <nl> _ = . . . Double . nan <nl> } <nl> <nl> + RangeTraps . test ( " UncheckedHalfOpen " ) <nl> + . xfail ( . custom ( <nl> + { ! _isDebugAssertConfiguration ( ) } , <nl> + reason : " assertions are disabled in Release and Unchecked mode " ) ) <nl> + . code { <nl> + expectCrashLater ( ) <nl> + var range = Range ( uncheckedBounds : ( lower : 1 , upper : 0 ) ) <nl> + } <nl> + <nl> + RangeTraps . test ( " UncheckedClosed " ) <nl> + . xfail ( . custom ( <nl> + { ! _isDebugAssertConfiguration ( ) } , <nl> + reason : " assertions are disabled in Release and Unchecked mode " ) ) <nl> + . code { <nl> + expectCrashLater ( ) <nl> + var range = ClosedRange ( uncheckedBounds : ( lower : 1 , upper : 0 ) ) <nl> + } <nl> + <nl> runAllTests ( ) <nl> <nl> mmm a / validation - test / stdlib / ArrayTraps . swift . gyb <nl> ppp b / validation - test / stdlib / ArrayTraps . swift . gyb <nl> $ { ArrayTy } Traps . test ( " $ { ' remove ( at : ) / % s ' % index } " ) <nl> <nl> ArrayTraps . test ( " unsafeLength " ) <nl> . skip ( . custom ( <nl> - { _isFastAssertConfiguration ( ) } , <nl> - reason : " this trap is not guaranteed to happen in - Ounchecked " ) ) <nl> + { ! _isDebugAssertConfiguration ( ) } , <nl> + reason : " this trap is not guaranteed to happen in - O or - Ounchecked " ) ) <nl> . crashOutputMatches ( _isDebugAssertConfiguration ( ) ? <nl> " UnsafeBufferPointer with negative count " : " " ) <nl> . code { <nl> mmm a / validation - test / stdlib / Range . swift . gyb <nl> ppp b / validation - test / stdlib / Range . swift . gyb <nl> extension $ { Self } where Bound : TestProtocol1 { <nl> var $ { TestSuite } = TestSuite ( " $ { Self } " ) <nl> <nl> $ { TestSuite } . test ( " init ( uncheckedBounds : ) " ) <nl> - . forEach ( in : [ ( 1 , 2 ) , ( 1 , 1 ) , ( 2 , 1 ) ] ) { <nl> + . forEach ( in : [ ( 1 , 2 ) , ( 1 , 1 ) ] ) { <nl> ( lowerInt , upperInt ) in <nl> <nl> - / / Check that ' init ( uncheckedBounds : ) ' does not perform precondition checks , <nl> - / / allowing to create ranges that break invariants . <nl> let r = $ { Self } ( <nl> uncheckedBounds : ( lower : $ { Bound } ( lowerInt ) , upper : $ { Bound } ( upperInt ) ) ) <nl> expectEqual ( lowerInt , r . lowerBound . value ) <nl> expectEqual ( upperInt , r . upperBound . value ) <nl> } <nl> <nl> + $ { TestSuite } . test ( " init ( uncheckedBounds : ) with invalid values " ) <nl> + . xfail ( <nl> + . custom ( <nl> + { _isDebugAssertConfiguration ( ) } , <nl> + reason : " unchecked initializer still checks its input in Debug mode " ) ) <nl> + . code { <nl> + let low = 2 <nl> + let up = 1 <nl> + / / Check that ' init ( uncheckedBounds : ) ' does not perform precondition checks , <nl> + / / allowing to create ranges that break invariants . <nl> + let r = $ { Self } ( <nl> + uncheckedBounds : ( lower : $ { Bound } ( low ) , upper : $ { Bound } ( up ) ) ) <nl> + expectEqual ( low , r . lowerBound . value ) <nl> + expectEqual ( up , r . upperBound . value ) <nl> + } <nl> + <nl> % for ( DestinationSelf , _ , _ , _ ) in all_range_types : <nl> $ { TestSuite } . test ( " init ( $ { DestinationSelf } ) / whereBoundIsStrideable " ) <nl> . forEach ( in : [ ( 0 , 0 ) , ( 1 , 2 ) , ( 10 , 20 ) , ( Int . min , Int . max ) ] ) { <nl>
|
Merge remote - tracking branch ' origin / main ' into next
|
apple/swift
|
d1be3a18aeb1b62a419b76af0cc76bb3b5604350
|
2020-12-13T03:16:14Z
|
mmm a / include / swift / AST / DiagnosticsSema . def <nl> ppp b / include / swift / AST / DiagnosticsSema . def <nl> ERROR ( invalid_redecl , none , " invalid redeclaration of % 0 " , ( DeclName ) ) <nl> NOTE ( invalid_redecl_prev , none , <nl> " % 0 previously declared here " , ( DeclName ) ) <nl> <nl> + WARNING ( deprecated_redecl_by_optionality , none , <nl> + " invalid redeclaration of % 0 which differs only by the kind of optional passed as an inout argument ( % 1 vs . % 2 ) " , <nl> + ( DeclName , Type , Type ) ) <nl> + <nl> ERROR ( ambiguous_type_base , none , <nl> " % 0 is ambiguous for type lookup in this context " , ( Identifier ) ) <nl> ERROR ( invalid_member_type , none , <nl> mmm a / lib / Sema / TypeCheckDecl . cpp <nl> ppp b / lib / Sema / TypeCheckDecl . cpp <nl> static void checkRedeclaration ( TypeChecker & tc , ValueDecl * current ) { <nl> continue ; <nl> } <nl> <nl> + / / Signatures are the same , but interface types are not . We must <nl> + / / have a type that we ' ve massaged as part of signature <nl> + / / interface type generation . If it ' s a result of remapping a <nl> + / / function parameter from ' inout T ! ' to ' inout T ? ' , emit a <nl> + / / warning that these overloads are deprecated and will no <nl> + / / longer be supported in the future . <nl> + if ( ! current - > getInterfaceType ( ) - > isEqual ( other - > getInterfaceType ( ) ) ) { <nl> + auto diagnosed = false ; <nl> + auto currFnTy = current - > getInterfaceType ( ) - > getAs < AnyFunctionType > ( ) ; <nl> + auto otherFnTy = other - > getInterfaceType ( ) - > getAs < AnyFunctionType > ( ) ; <nl> + if ( currFnTy & & otherFnTy ) { <nl> + ArrayRef < AnyFunctionType : : Param > currParams = currFnTy - > getParams ( ) ; <nl> + ArrayRef < AnyFunctionType : : Param > otherParams = otherFnTy - > getParams ( ) ; <nl> + <nl> + if ( currParams . size ( ) = = otherParams . size ( ) ) { <nl> + for ( unsigned i : indices ( currParams ) ) { <nl> + if ( currParams [ i ] . isInOut ( ) & & otherParams [ i ] . isInOut ( ) ) { <nl> + auto currParamTy = currParams [ i ] <nl> + . getType ( ) <nl> + - > getAs < InOutType > ( ) <nl> + - > getObjectType ( ) ; <nl> + auto otherParamTy = otherParams [ i ] <nl> + . getType ( ) <nl> + - > getAs < InOutType > ( ) <nl> + - > getObjectType ( ) ; <nl> + OptionalTypeKind currOTK ; <nl> + OptionalTypeKind otherOTK ; <nl> + ( void ) currParamTy - > getAnyOptionalObjectType ( currOTK ) ; <nl> + ( void ) otherParamTy - > getAnyOptionalObjectType ( otherOTK ) ; <nl> + if ( currOTK ! = OTK_None & & otherOTK ! = OTK_None & & <nl> + currOTK ! = otherOTK ) { <nl> + tc . diagnose ( current , diag : : deprecated_redecl_by_optionality , <nl> + current - > getFullName ( ) , currParamTy , <nl> + otherParamTy ) ; <nl> + tc . diagnose ( other , diag : : invalid_redecl_prev , <nl> + other - > getFullName ( ) ) ; <nl> + diagnosed = true ; <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( diagnosed ) <nl> + break ; <nl> + } <nl> + } <nl> + } <nl> + <nl> / / If the conflicting declarations have non - overlapping availability and , <nl> / / we allow the redeclaration to proceed if . . . <nl> / / <nl> mmm a / test / decl / overload . swift <nl> ppp b / test / decl / overload . swift <nl> func optional ( x : Int ? ) { } / / expected - note { { previously declared } } <nl> func optional ( x : Int ! ) { } / / expected - error { { invalid redeclaration of ' optional ( x : ) ' } } <nl> <nl> func optionalInOut ( x : inout Int ? ) { } / / expected - note { { previously declared } } <nl> - func optionalInOut ( x : inout Int ! ) { } / / expected - error { { invalid redeclaration of ' optionalInOut ( x : ) ' } } <nl> + / / expected - note @ - 1 { { previously declared } } <nl> + func optionalInOut ( x : inout Int ! ) { } / / expected - warning { { invalid redeclaration of ' optionalInOut ( x : ) ' which differs only by the kind of optional passed as an inout argument ( ' Int ! ' vs . ' Int ? ' ) } } <nl> + / / expected - warning @ - 1 { { invalid redeclaration of ' optionalInOut ( x : ) ' which differs only by the kind of optional passed as an inout argument ( ' Int ! ' vs . ' Int ? ' ) } } <nl> <nl> func optional_3 ( ) - > Int ? { } / / expected - note { { previously declared } } <nl> func optional_3 ( ) - > Int ! { } / / expected - error { { invalid redeclaration of ' optional_3 ( ) ' } } <nl>
|
Downgrade from error to warning for overloading by kind of optional .
|
apple/swift
|
6347112a04eb1532a0f0cee1a9b5ea8b4bcd331d
|
2018-01-03T08:48:53Z
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.