diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> v8_source_set ( " v8_base_without_compiler " ) { <nl> " src / diagnostics / code - tracer . h " , <nl> " src / diagnostics / compilation - statistics . cc " , <nl> " src / diagnostics / compilation - statistics . h " , <nl> + " src / diagnostics / crash - key . h " , <nl> " src / diagnostics / disasm . h " , <nl> " src / diagnostics / disassembler . cc " , <nl> " src / diagnostics / disassembler . h " , <nl> v8_source_set ( " v8_base_without_compiler " ) { <nl> } <nl> } <nl> <nl> + v8_source_set ( " v8_crash_keys " ) { <nl> + visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> + <nl> + if ( build_with_chromium ) { <nl> + deps = [ <nl> + " / / components / crash / core / common : crash_key " , <nl> + ] <nl> + sources = [ <nl> + " src / diagnostics / crash - key . cc " , <nl> + ] <nl> + } else { <nl> + sources = [ <nl> + " src / diagnostics / crash - key - noop . cc " , <nl> + ] <nl> + } <nl> + <nl> + configs = [ " : internal_config " ] <nl> + } <nl> + <nl> group ( " v8_base " ) { <nl> public_deps = [ <nl> " : v8_base_without_compiler " , <nl> " : v8_compiler " , <nl> + " : v8_crash_keys " , <nl> ] <nl> } <nl> <nl> if ( v8_use_snapshot & & current_toolchain = = v8_snapshot_toolchain ) { <nl> visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> <nl> sources = [ <nl> + " src / diagnostics / crash - key - noop . cc " , <nl> " src / snapshot / embedded / embedded - file - writer . cc " , <nl> " src / snapshot / embedded / embedded - file - writer . h " , <nl> " src / snapshot / embedded / platform - embedded - file - writer - aix . cc " , <nl> new file mode 100644 <nl> index 00000000000 . . 90e574cf755 <nl> mmm / dev / null <nl> ppp b / src / diagnostics / DEPS <nl> <nl> + include_rules = [ <nl> + " + components / crash / core / common / crash_key . h " , <nl> + ] <nl> new file mode 100644 <nl> index 00000000000 . . d66530f4117 <nl> mmm / dev / null <nl> ppp b / src / diagnostics / crash - key - noop . cc <nl> <nl> + / / Copyright 2019 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Noop implementation of crash keys to be used by targets that don ' t support <nl> + / / crashpad . <nl> + <nl> + # include " src / diagnostics / crash - key . h " <nl> + <nl> + namespace v8 { <nl> + namespace internal { <nl> + namespace crash { <nl> + <nl> + void AddCrashKey ( int id , const char * name , uintptr_t value ) { <nl> + } <nl> + <nl> + } / / namespace crash <nl> + } / / namespace internal <nl> + } / / namespace v8 <nl> new file mode 100644 <nl> index 00000000000 . . 510c1a90c89 <nl> mmm / dev / null <nl> ppp b / src / diagnostics / crash - key . cc <nl> <nl> + / / Copyright 2019 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + # include " src / diagnostics / crash - key . h " <nl> + # include " components / crash / core / common / crash_key . h " <nl> + <nl> + # include < string > <nl> + # include < sstream > <nl> + <nl> + namespace v8 { <nl> + namespace internal { <nl> + namespace crash { <nl> + <nl> + using CrashKeyInstance = crash_reporter : : CrashKeyString < kKeySize > ; <nl> + static CrashKeyInstance crash_keys [ ] = { <nl> + { " v8 - 0 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 1 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 2 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 3 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 4 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 5 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 6 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 7 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 8 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 9 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 10 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 11 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 12 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 13 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 14 " , CrashKeyInstance : : Tag : : kArray } , <nl> + { " v8 - 15 " , CrashKeyInstance : : Tag : : kArray } , <nl> + } ; <nl> + <nl> + void AddCrashKey ( int id , const char * name , uintptr_t value ) { <nl> + static int current = 0 ; <nl> + if ( current > kMaxCrashKeysCount ) { <nl> + return ; <nl> + } <nl> + <nl> + if ( current = = kMaxCrashKeysCount ) { <nl> + static crash_reporter : : CrashKeyString < 1 > over ( " v8 - too - many - keys " ) ; <nl> + over . Set ( " 1 " ) ; <nl> + current + + ; <nl> + return ; <nl> + } <nl> + <nl> + auto & trace_key = crash_keys [ current ] ; <nl> + <nl> + std : : stringstream stream ; <nl> + stream < < name < < " " < < id < < " 0x " < < std : : hex < < value ; <nl> + trace_key . Set ( stream . str ( ) . substr ( 0 , kKeySize ) ) ; <nl> + <nl> + current + + ; <nl> + } <nl> + <nl> + } / / namespace crash <nl> + } / / namespace internal <nl> + } / / namespace v8 <nl> new file mode 100644 <nl> index 00000000000 . . 706e7b8706f <nl> mmm / dev / null <nl> ppp b / src / diagnostics / crash - key . h <nl> <nl> + / / Copyright 2019 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Conflicts between v8 / src / base and base prevent from including <nl> + / / components / crash / core / common / crash_key . h into most of v8 ' s files , so have to <nl> + / / provide wrappers to localize the include to v8 / src / base / crash - key . cc only . <nl> + <nl> + # ifndef V8_DIAGNOSTICS_CRASH_KEY_H_ <nl> + # define V8_DIAGNOSTICS_CRASH_KEY_H_ <nl> + <nl> + # include < stdint . h > <nl> + <nl> + namespace v8 { <nl> + namespace internal { <nl> + namespace crash { <nl> + <nl> + / / Crash keys must be statically allocated so we ' ll have a few slots for <nl> + / / pointer values and will log if we run out of space . The pointer value will <nl> + / / be combined with the given name and id . Names should be sufficiently short <nl> + / / to fit key_size limit . <nl> + / / The crash key in the dump will look similar to : <nl> + / / { " v8 - 0 " , " isolate 0 0x21951a41d90 " } <nl> + / / ( we assume a pointer is being logged and we convert it to hex ) . <nl> + constexpr int kKeySize = 64 ; <nl> + constexpr int kMaxCrashKeysCount = 16 ; <nl> + <nl> + void AddCrashKey ( int id , const char * name , uintptr_t value ) ; <nl> + <nl> + } / / namespace crash <nl> + } / / namespace internal <nl> + } / / namespace v8 <nl> + <nl> + # endif / / V8_DIAGNOSTICS_CRASH_KEY_H_ <nl> mmm a / src / execution / isolate . cc <nl> ppp b / src / execution / isolate . cc <nl> <nl> # include " src / debug / debug . h " <nl> # include " src / deoptimizer / deoptimizer . h " <nl> # include " src / diagnostics / compilation - statistics . h " <nl> + # include " src / diagnostics / crash - key . h " <nl> # include " src / execution / frames - inl . h " <nl> # include " src / execution / isolate - inl . h " <nl> # include " src / execution / messages . h " <nl> bool Isolate : : InitWithSnapshot ( ReadOnlyDeserializer * read_only_deserializer , <nl> return Init ( read_only_deserializer , startup_deserializer ) ; <nl> } <nl> <nl> + static void AddCrashKeysForIsolateAndHeapPointers ( Isolate * isolate ) { <nl> + const int id = isolate - > id ( ) ; <nl> + crash : : AddCrashKey ( id , " isolate " , reinterpret_cast < uintptr_t > ( isolate ) ) ; <nl> + <nl> + auto heap = isolate - > heap ( ) ; <nl> + crash : : AddCrashKey ( id , " ro_space " , <nl> + reinterpret_cast < uintptr_t > ( heap - > read_only_space ( ) - > first_page ( ) ) ) ; <nl> + crash : : AddCrashKey ( id , " map_space " , <nl> + reinterpret_cast < uintptr_t > ( heap - > map_space ( ) - > first_page ( ) ) ) ; <nl> + crash : : AddCrashKey ( id , " code_space " , <nl> + reinterpret_cast < uintptr_t > ( heap - > code_space ( ) - > first_page ( ) ) ) ; <nl> + } <nl> + <nl> bool Isolate : : Init ( ReadOnlyDeserializer * read_only_deserializer , <nl> StartupDeserializer * startup_deserializer ) { <nl> TRACE_ISOLATE ( init ) ; <nl> bool Isolate : : Init ( ReadOnlyDeserializer * read_only_deserializer , <nl> PrintF ( " [ Initializing isolate from scratch took % 0 . 3f ms ] \ n " , ms ) ; <nl> } <nl> <nl> + AddCrashKeysForIsolateAndHeapPointers ( this ) ; <nl> return true ; <nl> } <nl> <nl>
Add Crash Keys support
v8/v8
02103b276bee0bbee320121230e46e9b253a7f5e
2019-06-07T18:31:16Z
mmm a / arangod / Agency / Store . cpp <nl> ppp b / arangod / Agency / Store . cpp <nl> Node & Node : : operator = ( Slice const & slice ) { / / Assign value ( become leaf ) <nl> } <nl> <nl> Node & Node : : operator = ( Node const & node ) { / / Assign node <nl> - <nl> - _value . reset ( ) ; <nl> - _value . append ( ( char const * ) node . _value . data ( ) , node . _value . byteSize ( ) ) ; <nl> _name = node . _name ; <nl> _type = node . _type ; <nl> + _value = node . _value ; <nl> _children = node . _children ; <nl> return * this ; <nl> } <nl> bool Node : : apply ( arangodb : : velocypack : : Slice const & slice ) { <nl> return true ; <nl> } <nl> <nl> + void Node : : toBuilder ( Builder & builder ) const { <nl> + try { <nl> + if ( type ( ) = = NODE ) { <nl> + VPackObjectBuilder guard ( & builder ) ; <nl> + for ( auto const & child : _children ) { <nl> + std : : cout < < _name < < " : " < < std : : endl ; <nl> + builder . add ( VPackValue ( _name ) ) ; <nl> + child . second - > toBuilder ( builder ) ; <nl> + } <nl> + } else { <nl> + builder . add ( Slice ( _value . data ( ) ) ) ; <nl> + } <nl> + } catch ( std : : exception const & e ) { <nl> + LOG ( FATAL ) < < e . what ( ) ; <nl> + } <nl> + } <nl> + <nl> Store : : Store ( ) : Node ( " root " ) { } <nl> Store : : ~ Store ( ) { } <nl> <nl> query_t Store : : read ( query_t const & queries ) const { / / list of list of paths <nl> return result ; <nl> } <nl> <nl> - bool Store : : read ( arangodb : : velocypack : : Slice const & query , <nl> - Builder & ret ) const { <nl> + bool Store : : read ( arangodb : : velocypack : : Slice const & query , Builder & ret ) const { <nl> + <nl> + / / Collect all paths <nl> std : : list < std : : string > query_strs ; <nl> if ( query . type ( ) = = VPackValueType : : Array ) { <nl> for ( auto const & sub_query : VPackArrayIterator ( query ) ) <nl> bool Store : : read ( arangodb : : velocypack : : Slice const & query , <nl> } <nl> query_strs . sort ( ) ; / / sort paths <nl> <nl> - / / remove " double " entries <nl> + / / Remove double ranges ( inclusion / identity ) <nl> for ( auto i = query_strs . begin ( ) , j = i ; i ! = query_strs . end ( ) ; + + i ) { <nl> if ( i ! = j & & i - > compare ( 0 , j - > size ( ) , * j ) = = 0 ) { <nl> * i = " " ; <nl> bool Store : : read ( arangodb : : velocypack : : Slice const & query , <nl> auto cut = std : : remove_if ( query_strs . begin ( ) , query_strs . end ( ) , Empty ( ) ) ; <nl> query_strs . erase ( cut , query_strs . end ( ) ) ; <nl> <nl> + / / Create response tree <nl> Node node ( " root " ) ; <nl> for ( auto i = query_strs . begin ( ) ; i ! = query_strs . end ( ) ; + + i ) { <nl> node ( * i ) = ( * this ) ( * i ) ; <nl> } <nl> - <nl> - std : : cout < < node < < std : : endl ; <nl> + <nl> + / / Assemble builder from node <nl> + node . toBuilder ( ret ) ; <nl> + <nl> return true ; <nl> } <nl> <nl> - / * <nl> - { <nl> - Node * par = n . _parent ; <nl> - while ( par ! = 0 ) { <nl> - par = par - > _parent ; <nl> - os < < " " ; <nl> - } <nl> - os < < n . _name < < " : " ; <nl> - if ( n . type ( ) = = NODE ) { <nl> - os < < std : : endl ; <nl> - for ( auto const & i : n . _children ) <nl> - os < < * ( i . second ) ; <nl> - } else { <nl> - os < < n . _value . toString ( ) < < std : : endl ; <nl> - } <nl> - return os ; <nl> - } <nl> - * / <nl> <nl> <nl> mmm a / arangod / Agency / Store . h <nl> ppp b / arangod / Agency / Store . h <nl> class Node { <nl> for ( auto const & i : n . _children ) <nl> os < < * ( i . second ) ; <nl> } else { <nl> - os < < n . _value . toString ( ) < < std : : endl ; <nl> + os < < Slice ( n . _value . data ( ) ) . toJson ( ) < < std : : endl ; <nl> } <nl> return os ; <nl> } <nl> <nl> virtual bool apply ( arangodb : : velocypack : : Slice const & ) ; <nl> <nl> + void toBuilder ( Builder & ) const ; <nl> + <nl> protected : <nl> Node const * _parent ; <nl> Children _children ; <nl>
actually getting out what was put into kv - store
arangodb/arangodb
ac52b477085c4efa9df34d694e0ea1f564941619
2016-03-11T11:10:39Z
mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv ) <nl> pfrom - > nVersion = 300 ; <nl> if ( ! vRecv . empty ( ) ) <nl> vRecv > > addrFrom > > nNonce ; <nl> - if ( ! vRecv . empty ( ) ) <nl> + if ( ! vRecv . empty ( ) ) { <nl> vRecv > > pfrom - > strSubVer ; <nl> + pfrom - > cleanSubVer = SanitizeString ( pfrom - > strSubVer ) ; <nl> + } <nl> if ( ! vRecv . empty ( ) ) <nl> vRecv > > pfrom - > nStartingHeight ; <nl> if ( ! vRecv . empty ( ) ) <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv ) <nl> <nl> pfrom - > fSuccessfullyConnected = true ; <nl> <nl> - LogPrintf ( " receive version message : % s : version % d , blocks = % d , us = % s , them = % s , peer = % s \ n " , pfrom - > strSubVer . c_str ( ) , pfrom - > nVersion , pfrom - > nStartingHeight , addrMe . ToString ( ) . c_str ( ) , addrFrom . ToString ( ) . c_str ( ) , pfrom - > addr . ToString ( ) . c_str ( ) ) ; <nl> + LogPrintf ( " receive version message : % s : version % d , blocks = % d , us = % s , them = % s , peer = % s \ n " , pfrom - > cleanSubVer . c_str ( ) , pfrom - > nVersion , pfrom - > nStartingHeight , addrMe . ToString ( ) . c_str ( ) , addrFrom . ToString ( ) . c_str ( ) , pfrom - > addr . ToString ( ) . c_str ( ) ) ; <nl> <nl> AddTimeData ( pfrom - > addr , nTime ) ; <nl> <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv ) <nl> <nl> <nl> LogPrint ( " mempool " , " AcceptToMemoryPool : % s % s : accepted % s ( poolsz % " PRIszu " ) \ n " , <nl> - pfrom - > addr . ToString ( ) . c_str ( ) , pfrom - > strSubVer . c_str ( ) , <nl> + pfrom - > addr . ToString ( ) . c_str ( ) , pfrom - > cleanSubVer . c_str ( ) , <nl> tx . GetHash ( ) . ToString ( ) . c_str ( ) , <nl> mempool . mapTx . size ( ) ) ; <nl> <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv ) <nl> if ( state . IsInvalid ( nDoS ) ) <nl> { <nl> LogPrint ( " mempool " , " % s from % s % s was not accepted into the memory pool : % s \ n " , tx . GetHash ( ) . ToString ( ) . c_str ( ) , <nl> - pfrom - > addr . ToString ( ) . c_str ( ) , pfrom - > strSubVer . c_str ( ) , <nl> + pfrom - > addr . ToString ( ) . c_str ( ) , pfrom - > cleanSubVer . c_str ( ) , <nl> state . GetRejectReason ( ) . c_str ( ) ) ; <nl> pfrom - > PushMessage ( " reject " , strCommand , state . GetRejectCode ( ) , <nl> state . GetRejectReason ( ) , inv . hash ) ; <nl> bool static ProcessMessage ( CNode * pfrom , string strCommand , CDataStream & vRecv ) <nl> if ( ! ( sProblem . empty ( ) ) ) { <nl> LogPrint ( " net " , " pong % s % s : % s , % " PRIx64 " expected , % " PRIx64 " received , % " PRIszu " bytes \ n " , <nl> pfrom - > addr . ToString ( ) . c_str ( ) , <nl> - pfrom - > strSubVer . c_str ( ) , <nl> + pfrom - > cleanSubVer . c_str ( ) , <nl> sProblem . c_str ( ) , <nl> pfrom - > nPingNonceSent , <nl> nonce , <nl> mmm a / src / net . cpp <nl> ppp b / src / net . cpp <nl> void CNode : : copyStats ( CNodeStats & stats ) <nl> X ( nTimeConnected ) ; <nl> X ( addrName ) ; <nl> X ( nVersion ) ; <nl> - X ( strSubVer ) ; <nl> + X ( cleanSubVer ) ; <nl> X ( fInbound ) ; <nl> X ( nStartingHeight ) ; <nl> X ( nMisbehavior ) ; <nl> mmm a / src / net . h <nl> ppp b / src / net . h <nl> class CNodeStats <nl> int64_t nTimeConnected ; <nl> std : : string addrName ; <nl> int nVersion ; <nl> - std : : string strSubVer ; <nl> + std : : string cleanSubVer ; <nl> bool fInbound ; <nl> int nStartingHeight ; <nl> int nMisbehavior ; <nl> class CNode <nl> std : : string addrName ; <nl> CService addrLocal ; <nl> int nVersion ; <nl> - std : : string strSubVer ; <nl> + / / strSubVer is whatever byte array we read from the wire . However , this field is intended <nl> + / / to be printed out , displayed to humans in various forms and so on . So we sanitize it and <nl> + / / store the sanitized version in cleanSubVer . The original should be used when dealing with <nl> + / / the network or wire types and the cleaned string used when displayed or logged . <nl> + std : : string strSubVer , cleanSubVer ; <nl> bool fOneShot ; <nl> bool fClient ; <nl> bool fInbound ; <nl> mmm a / src / rpcnet . cpp <nl> ppp b / src / rpcnet . cpp <nl> Value getpeerinfo ( const Array & params , bool fHelp ) <nl> if ( stats . dPingWait > 0 . 0 ) <nl> obj . push_back ( Pair ( " pingwait " , stats . dPingWait ) ) ; <nl> obj . push_back ( Pair ( " version " , stats . nVersion ) ) ; <nl> - obj . push_back ( Pair ( " subver " , stats . strSubVer ) ) ; <nl> + / / Use the sanitized form of subver here , to avoid tricksy remote peers from <nl> + / / corrupting or modifiying the JSON output by putting special characters in <nl> + / / their ver message . <nl> + obj . push_back ( Pair ( " subver " , stats . cleanSubVer ) ) ; <nl> obj . push_back ( Pair ( " inbound " , stats . fInbound ) ) ; <nl> obj . push_back ( Pair ( " startingheight " , stats . nStartingHeight ) ) ; <nl> obj . push_back ( Pair ( " banscore " , stats . nMisbehavior ) ) ; <nl>
Store and use a sanitized subVer
bitcoin/bitcoin
a946aa8d3ec7009ac670eeb65a525efe5eeb6e84
2013-11-26T12:26:00Z
mmm a / modules / imgproc / CMakeLists . txt <nl> ppp b / modules / imgproc / CMakeLists . txt <nl> ocv_add_dispatched_file ( color_yuv SSE2 SSE4_1 AVX2 ) <nl> ocv_add_dispatched_file ( median_blur SSE2 SSE4_1 AVX2 ) <nl> ocv_add_dispatched_file ( morph SSE2 SSE4_1 AVX2 ) <nl> ocv_add_dispatched_file ( smooth SSE2 SSE4_1 AVX2 ) <nl> + ocv_add_dispatched_file ( sumpixels SSE2 AVX2 AVX512_SKX ) <nl> ocv_add_dispatched_file ( undistort SSE2 AVX2 ) <nl> ocv_define_module ( imgproc opencv_core WRAP java python js ) <nl> mmm a / modules / imgproc / src / sumpixels . avx512_skx . hpp <nl> ppp b / modules / imgproc / src / sumpixels . avx512_skx . hpp <nl> <nl> / / It is subject to the license terms in the LICENSE file found in the top - level directory <nl> / / of this distribution and at http : / / opencv . org / license . html . <nl> / / <nl> - / / Copyright ( C ) 2019 , Intel Corporation , all rights reserved . <nl> - # include " precomp . hpp " <nl> - # include " sumpixels . hpp " <nl> + / / Copyright ( C ) 2019 - 2020 , Intel Corporation , all rights reserved . <nl> <nl> # include " opencv2 / core / hal / intrin . hpp " <nl> <nl> + namespace cv { namespace hal { <nl> + CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN <nl> <nl> - namespace cv { <nl> namespace { / / Anonymous namespace to avoid exposing the implementation classes <nl> <nl> / / <nl> __m512d IntegralCalculator < 4 > : : calculate_integral ( const __m512i src_longs , c <nl> <nl> } / / end of anonymous namespace <nl> <nl> - namespace opt_AVX512_SKX { <nl> - <nl> - / / This is the implementation for the external callers interface entry point . <nl> - / / It should be the only function called into this file from outside <nl> - / / Any new implementations should be directed from here <nl> + static <nl> void calculate_integral_avx512 ( const uchar * src , size_t _srcstep , <nl> double * sum , size_t _sumstep , <nl> double * sqsum , size_t _sqsumstep , <nl> int width , int height , int cn ) <nl> { <nl> + CV_INSTRUMENT_REGION ( ) ; <nl> + <nl> switch ( cn ) { <nl> case 1 : { <nl> IntegralCalculator < 1 > calculator ; <nl> void calculate_integral_avx512 ( const uchar * src , size_t _srcstep , <nl> } <nl> <nl> <nl> - } / / end namespace opt_AVX512_SXK <nl> - } / / end namespace cv <nl> + CV_CPU_OPTIMIZATION_NAMESPACE_END <nl> + } } / / end namespace cv : : hal <nl> mmm a / modules / imgproc / src / sumpixels . dispatch . cpp <nl> ppp b / modules / imgproc / src / sumpixels . dispatch . cpp <nl> <nl> / / License Agreement <nl> / / For Open Source Computer Vision Library <nl> / / <nl> - / / Copyright ( C ) 2000 - 2008 , 2019 Intel Corporation , all rights reserved . <nl> + / / Copyright ( C ) 2000 - 2020 Intel Corporation , all rights reserved . <nl> / / Copyright ( C ) 2009 , Willow Garage Inc . , all rights reserved . <nl> / / Copyright ( C ) 2014 , Itseez Inc . , all rights reserved . <nl> / / Third party copyrights are property of their respective owners . <nl> <nl> # include " precomp . hpp " <nl> # include " opencl_kernels_imgproc . hpp " <nl> # include " opencv2 / core / hal / intrin . hpp " <nl> - # include " sumpixels . hpp " <nl> <nl> - namespace cv <nl> - { <nl> + # include " sumpixels . simd . hpp " <nl> + # include " sumpixels . simd_declarations . hpp " / / defines CV_CPU_DISPATCH_MODES_ALL = AVX2 , . . . , BASELINE based on CMakeLists . txt content <nl> + <nl> + <nl> + namespace cv { <nl> + <nl> + # ifdef HAVE_OPENCL <nl> <nl> - template < typename T , typename ST , typename QT > <nl> - struct Integral_SIMD <nl> + static bool ocl_integral ( InputArray _src , OutputArray _sum , int sdepth ) <nl> { <nl> - bool operator ( ) ( const T * , size_t , <nl> - ST * , size_t , <nl> - QT * , size_t , <nl> - ST * , size_t , <nl> - int , int , int ) const <nl> - { <nl> + bool doubleSupport = ocl : : Device : : getDefault ( ) . doubleFPConfig ( ) > 0 ; <nl> + <nl> + if ( ( _src . type ( ) ! = CV_8UC1 ) | | <nl> + ! ( sdepth = = CV_32S | | sdepth = = CV_32F | | ( doubleSupport & & sdepth = = CV_64F ) ) ) <nl> return false ; <nl> - } <nl> - } ; <nl> <nl> + static const int tileSize = 16 ; <nl> <nl> - template < > <nl> - struct Integral_SIMD < uchar , double , double > { <nl> - Integral_SIMD ( ) { } ; <nl> + String build_opt = format ( " - D sumT = % s - D LOCAL_SUM_SIZE = % d % s " , <nl> + ocl : : typeToStr ( sdepth ) , tileSize , <nl> + doubleSupport ? " - D DOUBLE_SUPPORT " : " " ) ; <nl> <nl> + ocl : : Kernel kcols ( " integral_sum_cols " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> + if ( kcols . empty ( ) ) <nl> + return false ; <nl> <nl> - bool operator ( ) ( const uchar * src , size_t _srcstep , <nl> - double * sum , size_t _sumstep , <nl> - double * sqsum , size_t _sqsumstep , <nl> - double * tilted , size_t _tiltedstep , <nl> - int width , int height , int cn ) const <nl> - { <nl> - # if CV_TRY_AVX512_SKX <nl> - CV_UNUSED ( _tiltedstep ) ; <nl> - / / TODO : Add support for 1 channel input ( WIP ) <nl> - if ( CV_CPU_HAS_SUPPORT_AVX512_SKX & & ! tilted & & ( cn < = 4 ) ) { <nl> - opt_AVX512_SKX : : calculate_integral_avx512 ( src , _srcstep , sum , _sumstep , <nl> - sqsum , _sqsumstep , width , height , cn ) ; <nl> - return true ; <nl> - } <nl> - # else <nl> - / / Avoid warnings in some builds <nl> - CV_UNUSED ( src ) ; CV_UNUSED ( _srcstep ) ; CV_UNUSED ( sum ) ; CV_UNUSED ( _sumstep ) ; <nl> - CV_UNUSED ( sqsum ) ; CV_UNUSED ( _sqsumstep ) ; CV_UNUSED ( tilted ) ; CV_UNUSED ( _tiltedstep ) ; <nl> - CV_UNUSED ( width ) ; CV_UNUSED ( height ) ; CV_UNUSED ( cn ) ; <nl> - # endif <nl> + UMat src = _src . getUMat ( ) ; <nl> + Size src_size = src . size ( ) ; <nl> + Size bufsize ( ( ( src_size . height + tileSize - 1 ) / tileSize ) * tileSize , ( ( src_size . width + tileSize - 1 ) / tileSize ) * tileSize ) ; <nl> + UMat buf ( bufsize , sdepth ) ; <nl> + kcols . args ( ocl : : KernelArg : : ReadOnly ( src ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf ) ) ; <nl> + size_t gt = src . cols , lt = tileSize ; <nl> + if ( ! kcols . run ( 1 , & gt , & lt , false ) ) <nl> return false ; <nl> - } <nl> <nl> - } ; <nl> + ocl : : Kernel krows ( " integral_sum_rows " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> + if ( krows . empty ( ) ) <nl> + return false ; <nl> <nl> - # if CV_SIMD & & CV_SIMD_WIDTH < = 64 <nl> + Size sumsize ( src_size . width + 1 , src_size . height + 1 ) ; <nl> + _sum . create ( sumsize , sdepth ) ; <nl> + UMat sum = _sum . getUMat ( ) ; <nl> <nl> - template < > <nl> - struct Integral_SIMD < uchar , int , double > <nl> - { <nl> - Integral_SIMD ( ) { } <nl> + krows . args ( ocl : : KernelArg : : ReadOnlyNoSize ( buf ) , ocl : : KernelArg : : WriteOnly ( sum ) ) ; <nl> + gt = src . rows ; <nl> + return krows . run ( 1 , & gt , & lt , false ) ; <nl> + } <nl> <nl> - bool operator ( ) ( const uchar * src , size_t _srcstep , <nl> - int * sum , size_t _sumstep , <nl> - double * sqsum , size_t , <nl> - int * tilted , size_t , <nl> - int width , int height , int cn ) const <nl> - { <nl> - if ( sqsum | | tilted | | cn ! = 1 ) <nl> - return false ; <nl> + static bool ocl_integral ( InputArray _src , OutputArray _sum , OutputArray _sqsum , int sdepth , int sqdepth ) <nl> + { <nl> + bool doubleSupport = ocl : : Device : : getDefault ( ) . doubleFPConfig ( ) > 0 ; <nl> <nl> - / / the first iteration <nl> - memset ( sum , 0 , ( width + 1 ) * sizeof ( int ) ) ; <nl> + if ( _src . type ( ) ! = CV_8UC1 | | ( ! doubleSupport & & ( sdepth = = CV_64F | | sqdepth = = CV_64F ) ) ) <nl> + return false ; <nl> <nl> - / / the others <nl> - for ( int i = 0 ; i < height ; + + i ) <nl> - { <nl> - const uchar * src_row = src + _srcstep * i ; <nl> - int * prev_sum_row = ( int * ) ( ( uchar * ) sum + _sumstep * i ) + 1 ; <nl> - int * sum_row = ( int * ) ( ( uchar * ) sum + _sumstep * ( i + 1 ) ) + 1 ; <nl> + static const int tileSize = 16 ; <nl> <nl> - sum_row [ - 1 ] = 0 ; <nl> + String build_opt = format ( " - D SUM_SQUARE - D sumT = % s - D sumSQT = % s - D LOCAL_SUM_SIZE = % d % s " , <nl> + ocl : : typeToStr ( sdepth ) , ocl : : typeToStr ( sqdepth ) , <nl> + tileSize , <nl> + doubleSupport ? " - D DOUBLE_SUPPORT " : " " ) ; <nl> <nl> - v_int32 prev = vx_setzero_s32 ( ) ; <nl> - int j = 0 ; <nl> - for ( ; j + v_uint16 : : nlanes < = width ; j + = v_uint16 : : nlanes ) <nl> - { <nl> - v_int16 el8 = v_reinterpret_as_s16 ( vx_load_expand ( src_row + j ) ) ; <nl> - v_int32 el4l , el4h ; <nl> - # if CV_AVX2 & & CV_SIMD_WIDTH = = 32 <nl> - __m256i vsum = _mm256_add_epi16 ( el8 . val , _mm256_slli_si256 ( el8 . val , 2 ) ) ; <nl> - vsum = _mm256_add_epi16 ( vsum , _mm256_slli_si256 ( vsum , 4 ) ) ; <nl> - vsum = _mm256_add_epi16 ( vsum , _mm256_slli_si256 ( vsum , 8 ) ) ; <nl> - __m256i shmask = _mm256_set1_epi32 ( 7 ) ; <nl> - el4l . val = _mm256_add_epi32 ( _mm256_cvtepi16_epi32 ( _v256_extract_low ( vsum ) ) , prev . val ) ; <nl> - el4h . val = _mm256_add_epi32 ( _mm256_cvtepi16_epi32 ( _v256_extract_high ( vsum ) ) , _mm256_permutevar8x32_epi32 ( el4l . val , shmask ) ) ; <nl> - prev . val = _mm256_permutevar8x32_epi32 ( el4h . val , shmask ) ; <nl> - # else <nl> - el8 + = v_rotate_left < 1 > ( el8 ) ; <nl> - el8 + = v_rotate_left < 2 > ( el8 ) ; <nl> - # if CV_SIMD_WIDTH > = 32 <nl> - el8 + = v_rotate_left < 4 > ( el8 ) ; <nl> - # if CV_SIMD_WIDTH = = 64 <nl> - el8 + = v_rotate_left < 8 > ( el8 ) ; <nl> - # endif <nl> - # endif <nl> - v_expand ( el8 , el4l , el4h ) ; <nl> - el4l + = prev ; <nl> - el4h + = el4l ; <nl> - <nl> - prev = v_broadcast_element < v_int32 : : nlanes - 1 > ( el4h ) ; <nl> - # endif <nl> - v_store ( sum_row + j , el4l + vx_load ( prev_sum_row + j ) ) ; <nl> - v_store ( sum_row + j + v_int32 : : nlanes , el4h + vx_load ( prev_sum_row + j + v_int32 : : nlanes ) ) ; <nl> - } <nl> + ocl : : Kernel kcols ( " integral_sum_cols " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> + if ( kcols . empty ( ) ) <nl> + return false ; <nl> <nl> - for ( int v = sum_row [ j - 1 ] - prev_sum_row [ j - 1 ] ; j < width ; + + j ) <nl> - sum_row [ j ] = ( v + = src_row [ j ] ) + prev_sum_row [ j ] ; <nl> - } <nl> - vx_cleanup ( ) ; <nl> + UMat src = _src . getUMat ( ) ; <nl> + Size src_size = src . size ( ) ; <nl> + Size bufsize ( ( ( src_size . height + tileSize - 1 ) / tileSize ) * tileSize , ( ( src_size . width + tileSize - 1 ) / tileSize ) * tileSize ) ; <nl> + UMat buf ( bufsize , sdepth ) ; <nl> + UMat buf_sq ( bufsize , sqdepth ) ; <nl> + kcols . args ( ocl : : KernelArg : : ReadOnly ( src ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf_sq ) ) ; <nl> + size_t gt = src . cols , lt = tileSize ; <nl> + if ( ! kcols . run ( 1 , & gt , & lt , false ) ) <nl> + return false ; <nl> <nl> - return true ; <nl> - } <nl> - } ; <nl> + ocl : : Kernel krows ( " integral_sum_rows " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> + if ( krows . empty ( ) ) <nl> + return false ; <nl> <nl> - template < > <nl> - struct Integral_SIMD < uchar , float , double > <nl> - { <nl> - Integral_SIMD ( ) { } <nl> + Size sumsize ( src_size . width + 1 , src_size . height + 1 ) ; <nl> + _sum . create ( sumsize , sdepth ) ; <nl> + UMat sum = _sum . getUMat ( ) ; <nl> + _sqsum . create ( sumsize , sqdepth ) ; <nl> + UMat sum_sq = _sqsum . getUMat ( ) ; <nl> <nl> - bool operator ( ) ( const uchar * src , size_t _srcstep , <nl> - float * sum , size_t _sumstep , <nl> - double * sqsum , size_t , <nl> - float * tilted , size_t , <nl> - int width , int height , int cn ) const <nl> - { <nl> - if ( sqsum | | tilted | | cn ! = 1 ) <nl> - return false ; <nl> + krows . args ( ocl : : KernelArg : : ReadOnlyNoSize ( buf ) , ocl : : KernelArg : : ReadOnlyNoSize ( buf_sq ) , ocl : : KernelArg : : WriteOnly ( sum ) , ocl : : KernelArg : : WriteOnlyNoSize ( sum_sq ) ) ; <nl> + gt = src . rows ; <nl> + return krows . run ( 1 , & gt , & lt , false ) ; <nl> + } <nl> <nl> - / / the first iteration <nl> - memset ( sum , 0 , ( width + 1 ) * sizeof ( int ) ) ; <nl> + # endif / / HAVE_OPENCL <nl> <nl> - / / the others <nl> - for ( int i = 0 ; i < height ; + + i ) <nl> - { <nl> - const uchar * src_row = src + _srcstep * i ; <nl> - float * prev_sum_row = ( float * ) ( ( uchar * ) sum + _sumstep * i ) + 1 ; <nl> - float * sum_row = ( float * ) ( ( uchar * ) sum + _sumstep * ( i + 1 ) ) + 1 ; <nl> + # ifdef HAVE_IPP <nl> <nl> - sum_row [ - 1 ] = 0 ; <nl> + static bool ipp_integral ( <nl> + int depth , int sdepth , int sqdepth , <nl> + const uchar * src , size_t srcstep , <nl> + uchar * sum , size_t sumstep , <nl> + uchar * sqsum , size_t sqsumstep , <nl> + uchar * tilted , size_t tstep , <nl> + int width , int height , int cn ) <nl> + { <nl> + CV_INSTRUMENT_REGION_IPP ( ) ; <nl> <nl> - v_float32 prev = vx_setzero_f32 ( ) ; <nl> - int j = 0 ; <nl> - for ( ; j + v_uint16 : : nlanes < = width ; j + = v_uint16 : : nlanes ) <nl> - { <nl> - v_int16 el8 = v_reinterpret_as_s16 ( vx_load_expand ( src_row + j ) ) ; <nl> - v_float32 el4l , el4h ; <nl> - # if CV_AVX2 & & CV_SIMD_WIDTH = = 32 <nl> - __m256i vsum = _mm256_add_epi16 ( el8 . val , _mm256_slli_si256 ( el8 . val , 2 ) ) ; <nl> - vsum = _mm256_add_epi16 ( vsum , _mm256_slli_si256 ( vsum , 4 ) ) ; <nl> - vsum = _mm256_add_epi16 ( vsum , _mm256_slli_si256 ( vsum , 8 ) ) ; <nl> - __m256i shmask = _mm256_set1_epi32 ( 7 ) ; <nl> - el4l . val = _mm256_add_ps ( _mm256_cvtepi32_ps ( _mm256_cvtepi16_epi32 ( _v256_extract_low ( vsum ) ) ) , prev . val ) ; <nl> - el4h . val = _mm256_add_ps ( _mm256_cvtepi32_ps ( _mm256_cvtepi16_epi32 ( _v256_extract_high ( vsum ) ) ) , _mm256_permutevar8x32_ps ( el4l . val , shmask ) ) ; <nl> - prev . val = _mm256_permutevar8x32_ps ( el4h . val , shmask ) ; <nl> - # else <nl> - el8 + = v_rotate_left < 1 > ( el8 ) ; <nl> - el8 + = v_rotate_left < 2 > ( el8 ) ; <nl> - # if CV_SIMD_WIDTH > = 32 <nl> - el8 + = v_rotate_left < 4 > ( el8 ) ; <nl> - # if CV_SIMD_WIDTH = = 64 <nl> - el8 + = v_rotate_left < 8 > ( el8 ) ; <nl> - # endif <nl> - # endif <nl> - v_int32 el4li , el4hi ; <nl> - v_expand ( el8 , el4li , el4hi ) ; <nl> - el4l = v_cvt_f32 ( el4li ) + prev ; <nl> - el4h = v_cvt_f32 ( el4hi ) + el4l ; <nl> - <nl> - prev = v_broadcast_element < v_float32 : : nlanes - 1 > ( el4h ) ; <nl> - # endif <nl> - v_store ( sum_row + j , el4l + vx_load ( prev_sum_row + j ) ) ; <nl> - v_store ( sum_row + j + v_float32 : : nlanes , el4h + vx_load ( prev_sum_row + j + v_float32 : : nlanes ) ) ; <nl> - } <nl> + IppiSize size = { width , height } ; <nl> <nl> - for ( float v = sum_row [ j - 1 ] - prev_sum_row [ j - 1 ] ; j < width ; + + j ) <nl> - sum_row [ j ] = ( v + = src_row [ j ] ) + prev_sum_row [ j ] ; <nl> - } <nl> - vx_cleanup ( ) ; <nl> + if ( cn > 1 ) <nl> + return false ; <nl> + if ( tilted ) <nl> + { <nl> + CV_UNUSED ( tstep ) ; <nl> + return false ; <nl> + } <nl> <nl> - return true ; <nl> + if ( ! sqsum ) <nl> + { <nl> + if ( depth = = CV_8U & & sdepth = = CV_32S ) <nl> + return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_8u32s_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , size , 0 ) > = 0 ; <nl> + else if ( depth = = CV_8UC1 & & sdepth = = CV_32F ) <nl> + return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_8u32f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , size , 0 ) > = 0 ; <nl> + else if ( depth = = CV_32FC1 & & sdepth = = CV_32F ) <nl> + return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_32f_C1R , ( const Ipp32f * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , size ) > = 0 ; <nl> + else <nl> + return false ; <nl> } <nl> - } ; <nl> + else <nl> + { <nl> + if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_32S ) <nl> + return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32s_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , ( Ipp32s * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> + else if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_64F ) <nl> + return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32s64f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , ( Ipp64f * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> + else if ( depth = = CV_8U & & sdepth = = CV_32F & & sqdepth = = CV_64F ) <nl> + return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32f64f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , ( Ipp64f * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> + else <nl> + return false ; <nl> + } <nl> + } <nl> <nl> - # endif <nl> + # endif / / HAVE_IPP <nl> <nl> - template < typename T , typename ST , typename QT > <nl> + namespace hal { <nl> + <nl> + template < typename T , typename ST , typename QT > static <nl> void integral_ ( const T * src , size_t _srcstep , ST * sum , size_t _sumstep , <nl> QT * sqsum , size_t _sqsumstep , ST * tilted , size_t _tiltedstep , <nl> int width , int height , int cn ) <nl> { <nl> int x , y , k ; <nl> <nl> - if ( Integral_SIMD < T , ST , QT > ( ) ( src , _srcstep , <nl> - sum , _sumstep , <nl> - sqsum , _sqsumstep , <nl> - tilted , _tiltedstep , <nl> - width , height , cn ) ) <nl> - return ; <nl> - <nl> int srcstep = ( int ) ( _srcstep / sizeof ( T ) ) ; <nl> int sumstep = ( int ) ( _sumstep / sizeof ( ST ) ) ; <nl> int tiltedstep = ( int ) ( _tiltedstep / sizeof ( ST ) ) ; <nl> void integral_ ( const T * src , size_t _srcstep , ST * sum , size_t _sumstep , <nl> } <nl> } <nl> <nl> - <nl> - # ifdef HAVE_OPENCL <nl> - <nl> - static bool ocl_integral ( InputArray _src , OutputArray _sum , int sdepth ) <nl> - { <nl> - bool doubleSupport = ocl : : Device : : getDefault ( ) . doubleFPConfig ( ) > 0 ; <nl> - <nl> - if ( ( _src . type ( ) ! = CV_8UC1 ) | | <nl> - ! ( sdepth = = CV_32S | | sdepth = = CV_32F | | ( doubleSupport & & sdepth = = CV_64F ) ) ) <nl> - return false ; <nl> - <nl> - static const int tileSize = 16 ; <nl> - <nl> - String build_opt = format ( " - D sumT = % s - D LOCAL_SUM_SIZE = % d % s " , <nl> - ocl : : typeToStr ( sdepth ) , tileSize , <nl> - doubleSupport ? " - D DOUBLE_SUPPORT " : " " ) ; <nl> - <nl> - ocl : : Kernel kcols ( " integral_sum_cols " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( kcols . empty ( ) ) <nl> - return false ; <nl> - <nl> - UMat src = _src . getUMat ( ) ; <nl> - Size src_size = src . size ( ) ; <nl> - Size bufsize ( ( ( src_size . height + tileSize - 1 ) / tileSize ) * tileSize , ( ( src_size . width + tileSize - 1 ) / tileSize ) * tileSize ) ; <nl> - UMat buf ( bufsize , sdepth ) ; <nl> - kcols . args ( ocl : : KernelArg : : ReadOnly ( src ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf ) ) ; <nl> - size_t gt = src . cols , lt = tileSize ; <nl> - if ( ! kcols . run ( 1 , & gt , & lt , false ) ) <nl> - return false ; <nl> - <nl> - ocl : : Kernel krows ( " integral_sum_rows " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( krows . empty ( ) ) <nl> - return false ; <nl> - <nl> - Size sumsize ( src_size . width + 1 , src_size . height + 1 ) ; <nl> - _sum . create ( sumsize , sdepth ) ; <nl> - UMat sum = _sum . getUMat ( ) ; <nl> - <nl> - krows . args ( ocl : : KernelArg : : ReadOnlyNoSize ( buf ) , ocl : : KernelArg : : WriteOnly ( sum ) ) ; <nl> - gt = src . rows ; <nl> - return krows . run ( 1 , & gt , & lt , false ) ; <nl> - } <nl> - <nl> - static bool ocl_integral ( InputArray _src , OutputArray _sum , OutputArray _sqsum , int sdepth , int sqdepth ) <nl> + static bool integral_SIMD ( <nl> + int depth , int sdepth , int sqdepth , <nl> + const uchar * src , size_t srcstep , <nl> + uchar * sum , size_t sumstep , <nl> + uchar * sqsum , size_t sqsumstep , <nl> + uchar * tilted , size_t tstep , <nl> + int width , int height , int cn ) <nl> { <nl> - bool doubleSupport = ocl : : Device : : getDefault ( ) . doubleFPConfig ( ) > 0 ; <nl> - <nl> - if ( _src . type ( ) ! = CV_8UC1 | | ( ! doubleSupport & & ( sdepth = = CV_64F | | sqdepth = = CV_64F ) ) ) <nl> - return false ; <nl> - <nl> - static const int tileSize = 16 ; <nl> - <nl> - String build_opt = format ( " - D SUM_SQUARE - D sumT = % s - D sumSQT = % s - D LOCAL_SUM_SIZE = % d % s " , <nl> - ocl : : typeToStr ( sdepth ) , ocl : : typeToStr ( sqdepth ) , <nl> - tileSize , <nl> - doubleSupport ? " - D DOUBLE_SUPPORT " : " " ) ; <nl> - <nl> - ocl : : Kernel kcols ( " integral_sum_cols " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( kcols . empty ( ) ) <nl> - return false ; <nl> - <nl> - UMat src = _src . getUMat ( ) ; <nl> - Size src_size = src . size ( ) ; <nl> - Size bufsize ( ( ( src_size . height + tileSize - 1 ) / tileSize ) * tileSize , ( ( src_size . width + tileSize - 1 ) / tileSize ) * tileSize ) ; <nl> - UMat buf ( bufsize , sdepth ) ; <nl> - UMat buf_sq ( bufsize , sqdepth ) ; <nl> - kcols . args ( ocl : : KernelArg : : ReadOnly ( src ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf_sq ) ) ; <nl> - size_t gt = src . cols , lt = tileSize ; <nl> - if ( ! kcols . run ( 1 , & gt , & lt , false ) ) <nl> - return false ; <nl> - <nl> - ocl : : Kernel krows ( " integral_sum_rows " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( krows . empty ( ) ) <nl> - return false ; <nl> - <nl> - Size sumsize ( src_size . width + 1 , src_size . height + 1 ) ; <nl> - _sum . create ( sumsize , sdepth ) ; <nl> - UMat sum = _sum . getUMat ( ) ; <nl> - _sqsum . create ( sumsize , sqdepth ) ; <nl> - UMat sum_sq = _sqsum . getUMat ( ) ; <nl> - <nl> - krows . args ( ocl : : KernelArg : : ReadOnlyNoSize ( buf ) , ocl : : KernelArg : : ReadOnlyNoSize ( buf_sq ) , ocl : : KernelArg : : WriteOnly ( sum ) , ocl : : KernelArg : : WriteOnlyNoSize ( sum_sq ) ) ; <nl> - gt = src . rows ; <nl> - return krows . run ( 1 , & gt , & lt , false ) ; <nl> - } <nl> - <nl> - # endif <nl> + CV_INSTRUMENT_REGION ( ) ; <nl> <nl> + CV_CPU_DISPATCH ( integral_SIMD , ( depth , sdepth , sqdepth , src , srcstep , sum , sumstep , sqsum , sqsumstep , tilted , tstep , width , height , cn ) , <nl> + CV_CPU_DISPATCH_MODES_ALL ) ; <nl> } <nl> <nl> - # if defined ( HAVE_IPP ) <nl> - namespace cv <nl> + void integral ( <nl> + int depth , int sdepth , int sqdepth , <nl> + const uchar * src , size_t srcstep , <nl> + uchar * sum , size_t sumstep , <nl> + uchar * sqsum , size_t sqsumstep , <nl> + uchar * tilted , size_t tstep , <nl> + int width , int height , int cn ) <nl> { <nl> - static bool ipp_integral ( <nl> - int depth , int sdepth , int sqdepth , <nl> - const uchar * src , size_t srcstep , <nl> - uchar * sum , size_t sumstep , <nl> - uchar * sqsum , size_t sqsumstep , <nl> - uchar * tilted , size_t tstep , <nl> - int width , int height , int cn ) <nl> - { <nl> - CV_INSTRUMENT_REGION_IPP ( ) ; <nl> - <nl> - IppiSize size = { width , height } ; <nl> - <nl> - if ( cn > 1 ) <nl> - return false ; <nl> - if ( tilted ) <nl> - { <nl> - CV_UNUSED ( tstep ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! sqsum ) <nl> - { <nl> - if ( depth = = CV_8U & & sdepth = = CV_32S ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_8u32s_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , size , 0 ) > = 0 ; <nl> - else if ( depth = = CV_8UC1 & & sdepth = = CV_32F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_8u32f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , size , 0 ) > = 0 ; <nl> - else if ( depth = = CV_32FC1 & & sdepth = = CV_32F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_32f_C1R , ( const Ipp32f * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , size ) > = 0 ; <nl> - else <nl> - return false ; <nl> - } <nl> - else <nl> - { <nl> - if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_32S ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32s_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , ( Ipp32s * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> - else if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_64F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32s64f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , ( Ipp64f * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> - else if ( depth = = CV_8U & & sdepth = = CV_32F & & sqdepth = = CV_64F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32f64f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , ( Ipp64f * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> - else <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - # endif <nl> - <nl> - namespace cv { namespace hal { <nl> + CV_INSTRUMENT_REGION ( ) ; <nl> <nl> - void integral ( int depth , int sdepth , int sqdepth , <nl> - const uchar * src , size_t srcstep , <nl> - uchar * sum , size_t sumstep , <nl> - uchar * sqsum , size_t sqsumstep , <nl> - uchar * tilted , size_t tstep , <nl> - int width , int height , int cn ) <nl> - { <nl> CALL_HAL ( integral , cv_hal_integral , depth , sdepth , sqdepth , src , srcstep , sum , sumstep , sqsum , sqsumstep , tilted , tstep , width , height , cn ) ; <nl> CV_IPP_RUN_FAST ( ipp_integral ( depth , sdepth , sqdepth , src , srcstep , sum , sumstep , sqsum , sqsumstep , tilted , tstep , width , height , cn ) ) ; <nl> <nl> + if ( integral_SIMD ( depth , sdepth , sqdepth , src , srcstep , sum , sumstep , sqsum , sqsumstep , tilted , tstep , width , height , cn ) ) <nl> + return ; <nl> + <nl> # define ONE_CALL ( A , B , C ) integral_ < A , B , C > ( ( const A * ) src , srcstep , ( B * ) sum , sumstep , ( C * ) sqsum , sqsumstep , ( B * ) tilted , tstep , width , height , cn ) <nl> <nl> if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_64F ) <nl> void integral ( int depth , int sdepth , int sqdepth , <nl> else if ( depth = = CV_64F & & sdepth = = CV_64F & & sqdepth = = CV_64F ) <nl> ONE_CALL ( double , double , double ) ; <nl> else <nl> - CV_Error ( CV_StsUnsupportedFormat , " " ) ; <nl> + CV_Error ( Error : : StsUnsupportedFormat , " " ) ; <nl> <nl> # undef ONE_CALL <nl> } <nl> <nl> - } } / / cv : : hal : : <nl> + } / / namespace hal <nl> <nl> - void cv : : integral ( InputArray _src , OutputArray _sum , OutputArray _sqsum , OutputArray _tilted , int sdepth , int sqdepth ) <nl> + void integral ( InputArray _src , OutputArray _sum , OutputArray _sqsum , OutputArray _tilted , int sdepth , int sqdepth ) <nl> { <nl> CV_INSTRUMENT_REGION ( ) ; <nl> <nl> void cv : : integral ( InputArray _src , OutputArray _sum , OutputArray _sqsum , Output <nl> src . cols , src . rows , cn ) ; <nl> } <nl> <nl> - void cv : : integral ( InputArray src , OutputArray sum , int sdepth ) <nl> + void integral ( InputArray src , OutputArray sum , int sdepth ) <nl> { <nl> CV_INSTRUMENT_REGION ( ) ; <nl> <nl> integral ( src , sum , noArray ( ) , noArray ( ) , sdepth ) ; <nl> } <nl> <nl> - void cv : : integral ( InputArray src , OutputArray sum , OutputArray sqsum , int sdepth , int sqdepth ) <nl> + void integral ( InputArray src , OutputArray sum , OutputArray sqsum , int sdepth , int sqdepth ) <nl> { <nl> CV_INSTRUMENT_REGION ( ) ; <nl> <nl> integral ( src , sum , sqsum , noArray ( ) , sdepth , sqdepth ) ; <nl> } <nl> <nl> + } / / namespace <nl> <nl> CV_IMPL void <nl> cvIntegral ( const CvArr * image , CvArr * sumImage , <nl> deleted file mode 100644 <nl> index 8d5ab0a851b . . 00000000000 <nl> mmm a / modules / imgproc / src / sumpixels . hpp <nl> ppp / dev / null <nl> <nl> - / / This file is part of OpenCV project . <nl> - / / It is subject to the license terms in the LICENSE file found in the top - level directory <nl> - / / of this distribution and at http : / / opencv . org / license . html . <nl> - / / <nl> - / / Copyright ( C ) 2019 , Intel Corporation , all rights reserved . <nl> - # ifndef OPENCV_IMGPROC_SUM_PIXELS_HPP <nl> - # define OPENCV_IMGPROC_SUM_PIXELS_HPP <nl> - <nl> - namespace cv <nl> - { <nl> - <nl> - namespace opt_AVX512_SKX <nl> - { <nl> - # if CV_TRY_AVX512_SKX <nl> - void calculate_integral_avx512 ( <nl> - const uchar * src , size_t _srcstep , <nl> - double * sum , size_t _sumstep , <nl> - double * sqsum , size_t _sqsumstep , <nl> - int width , int height , int cn ) ; <nl> - <nl> - # endif <nl> - } / / end namespace opt_AVX512_SKX <nl> - } / / end namespace cv <nl> - <nl> - # endif <nl> mmm a / modules / imgproc / src / sumpixels . simd . hpp <nl> ppp b / modules / imgproc / src / sumpixels . simd . hpp <nl> <nl> / / License Agreement <nl> / / For Open Source Computer Vision Library <nl> / / <nl> - / / Copyright ( C ) 2000 - 2008 , 2019 Intel Corporation , all rights reserved . <nl> + / / Copyright ( C ) 2000 - 2020 Intel Corporation , all rights reserved . <nl> / / Copyright ( C ) 2009 , Willow Garage Inc . , all rights reserved . <nl> / / Copyright ( C ) 2014 , Itseez Inc . , all rights reserved . <nl> / / Third party copyrights are property of their respective owners . <nl> <nl> / / <nl> / / M * / <nl> <nl> - # include " precomp . hpp " <nl> - # include " opencl_kernels_imgproc . hpp " <nl> # include " opencv2 / core / hal / intrin . hpp " <nl> - # include " sumpixels . hpp " <nl> <nl> - namespace cv <nl> - { <nl> + # if CV_AVX512_SKX <nl> + # include " sumpixels . avx512_skx . hpp " <nl> + # endif <nl> + <nl> + namespace cv { namespace hal { <nl> + CV_CPU_OPTIMIZATION_NAMESPACE_BEGIN <nl> + <nl> + / / forward declarations <nl> + bool integral_SIMD ( <nl> + int depth , int sdepth , int sqdepth , <nl> + const uchar * src , size_t srcstep , <nl> + uchar * sum , size_t sumstep , <nl> + uchar * sqsum , size_t sqsumstep , <nl> + uchar * tilted , size_t tstep , <nl> + int width , int height , int cn ) ; <nl> + <nl> + # ifndef CV_CPU_OPTIMIZATION_DECLARATIONS_ONLY <nl> + namespace { <nl> <nl> template < typename T , typename ST , typename QT > <nl> struct Integral_SIMD <nl> struct Integral_SIMD <nl> } <nl> } ; <nl> <nl> - <nl> + # if CV_AVX512_SKX <nl> template < > <nl> struct Integral_SIMD < uchar , double , double > { <nl> Integral_SIMD ( ) { } ; <nl> struct Integral_SIMD < uchar , double , double > { <nl> double * tilted , size_t _tiltedstep , <nl> int width , int height , int cn ) const <nl> { <nl> - # if CV_TRY_AVX512_SKX <nl> CV_UNUSED ( _tiltedstep ) ; <nl> / / TODO : Add support for 1 channel input ( WIP ) <nl> - if ( CV_CPU_HAS_SUPPORT_AVX512_SKX & & ! tilted & & ( cn < = 4 ) ) { <nl> - opt_AVX512_SKX : : calculate_integral_avx512 ( src , _srcstep , sum , _sumstep , <nl> - sqsum , _sqsumstep , width , height , cn ) ; <nl> + if ( ! tilted & & ( cn < = 4 ) ) <nl> + { <nl> + calculate_integral_avx512 ( src , _srcstep , sum , _sumstep , <nl> + sqsum , _sqsumstep , width , height , cn ) ; <nl> return true ; <nl> } <nl> - # else <nl> - / / Avoid warnings in some builds <nl> - CV_UNUSED ( src ) ; CV_UNUSED ( _srcstep ) ; CV_UNUSED ( sum ) ; CV_UNUSED ( _sumstep ) ; <nl> - CV_UNUSED ( sqsum ) ; CV_UNUSED ( _sqsumstep ) ; CV_UNUSED ( tilted ) ; CV_UNUSED ( _tiltedstep ) ; <nl> - CV_UNUSED ( width ) ; CV_UNUSED ( height ) ; CV_UNUSED ( cn ) ; <nl> - # endif <nl> return false ; <nl> } <nl> <nl> } ; <nl> + # endif <nl> <nl> # if CV_SIMD & & CV_SIMD_WIDTH < = 64 <nl> <nl> struct Integral_SIMD < uchar , int , double > <nl> for ( int v = sum_row [ j - 1 ] - prev_sum_row [ j - 1 ] ; j < width ; + + j ) <nl> sum_row [ j ] = ( v + = src_row [ j ] ) + prev_sum_row [ j ] ; <nl> } <nl> - vx_cleanup ( ) ; <nl> - <nl> return true ; <nl> } <nl> } ; <nl> struct Integral_SIMD < uchar , float , double > <nl> for ( float v = sum_row [ j - 1 ] - prev_sum_row [ j - 1 ] ; j < width ; + + j ) <nl> sum_row [ j ] = ( v + = src_row [ j ] ) + prev_sum_row [ j ] ; <nl> } <nl> - vx_cleanup ( ) ; <nl> - <nl> return true ; <nl> } <nl> } ; <nl> <nl> # endif <nl> <nl> - template < typename T , typename ST , typename QT > <nl> - void integral_ ( const T * src , size_t _srcstep , ST * sum , size_t _sumstep , <nl> - QT * sqsum , size_t _sqsumstep , ST * tilted , size_t _tiltedstep , <nl> - int width , int height , int cn ) <nl> - { <nl> - int x , y , k ; <nl> - <nl> - if ( Integral_SIMD < T , ST , QT > ( ) ( src , _srcstep , <nl> - sum , _sumstep , <nl> - sqsum , _sqsumstep , <nl> - tilted , _tiltedstep , <nl> - width , height , cn ) ) <nl> - return ; <nl> + } / / namespace anon <nl> <nl> - int srcstep = ( int ) ( _srcstep / sizeof ( T ) ) ; <nl> - int sumstep = ( int ) ( _sumstep / sizeof ( ST ) ) ; <nl> - int tiltedstep = ( int ) ( _tiltedstep / sizeof ( ST ) ) ; <nl> - int sqsumstep = ( int ) ( _sqsumstep / sizeof ( QT ) ) ; <nl> - <nl> - width * = cn ; <nl> - <nl> - memset ( sum , 0 , ( width + cn ) * sizeof ( sum [ 0 ] ) ) ; <nl> - sum + = sumstep + cn ; <nl> - <nl> - if ( sqsum ) <nl> - { <nl> - memset ( sqsum , 0 , ( width + cn ) * sizeof ( sqsum [ 0 ] ) ) ; <nl> - sqsum + = sqsumstep + cn ; <nl> - } <nl> - <nl> - if ( tilted ) <nl> - { <nl> - memset ( tilted , 0 , ( width + cn ) * sizeof ( tilted [ 0 ] ) ) ; <nl> - tilted + = tiltedstep + cn ; <nl> - } <nl> - <nl> - if ( sqsum = = 0 & & tilted = = 0 ) <nl> - { <nl> - for ( y = 0 ; y < height ; y + + , src + = srcstep - cn , sum + = sumstep - cn ) <nl> - { <nl> - for ( k = 0 ; k < cn ; k + + , src + + , sum + + ) <nl> - { <nl> - ST s = sum [ - cn ] = 0 ; <nl> - for ( x = 0 ; x < width ; x + = cn ) <nl> - { <nl> - s + = src [ x ] ; <nl> - sum [ x ] = sum [ x - sumstep ] + s ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - else if ( tilted = = 0 ) <nl> - { <nl> - for ( y = 0 ; y < height ; y + + , src + = srcstep - cn , <nl> - sum + = sumstep - cn , sqsum + = sqsumstep - cn ) <nl> - { <nl> - for ( k = 0 ; k < cn ; k + + , src + + , sum + + , sqsum + + ) <nl> - { <nl> - ST s = sum [ - cn ] = 0 ; <nl> - QT sq = sqsum [ - cn ] = 0 ; <nl> - for ( x = 0 ; x < width ; x + = cn ) <nl> - { <nl> - T it = src [ x ] ; <nl> - s + = it ; <nl> - sq + = ( QT ) it * it ; <nl> - ST t = sum [ x - sumstep ] + s ; <nl> - QT tq = sqsum [ x - sqsumstep ] + sq ; <nl> - sum [ x ] = t ; <nl> - sqsum [ x ] = tq ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - else <nl> - { <nl> - AutoBuffer < ST > _buf ( width + cn ) ; <nl> - ST * buf = _buf . data ( ) ; <nl> - ST s ; <nl> - QT sq ; <nl> - for ( k = 0 ; k < cn ; k + + , src + + , sum + + , tilted + + , buf + + ) <nl> - { <nl> - sum [ - cn ] = tilted [ - cn ] = 0 ; <nl> - <nl> - for ( x = 0 , s = 0 , sq = 0 ; x < width ; x + = cn ) <nl> - { <nl> - T it = src [ x ] ; <nl> - buf [ x ] = tilted [ x ] = it ; <nl> - s + = it ; <nl> - sq + = ( QT ) it * it ; <nl> - sum [ x ] = s ; <nl> - if ( sqsum ) <nl> - sqsum [ x ] = sq ; <nl> - } <nl> - <nl> - if ( width = = cn ) <nl> - buf [ cn ] = 0 ; <nl> - <nl> - if ( sqsum ) <nl> - { <nl> - sqsum [ - cn ] = 0 ; <nl> - sqsum + + ; <nl> - } <nl> - } <nl> - <nl> - for ( y = 1 ; y < height ; y + + ) <nl> - { <nl> - src + = srcstep - cn ; <nl> - sum + = sumstep - cn ; <nl> - tilted + = tiltedstep - cn ; <nl> - buf + = - cn ; <nl> - <nl> - if ( sqsum ) <nl> - sqsum + = sqsumstep - cn ; <nl> - <nl> - for ( k = 0 ; k < cn ; k + + , src + + , sum + + , tilted + + , buf + + ) <nl> - { <nl> - T it = src [ 0 ] ; <nl> - ST t0 = s = it ; <nl> - QT tq0 = sq = ( QT ) it * it ; <nl> - <nl> - sum [ - cn ] = 0 ; <nl> - if ( sqsum ) <nl> - sqsum [ - cn ] = 0 ; <nl> - tilted [ - cn ] = tilted [ - tiltedstep ] ; <nl> - <nl> - sum [ 0 ] = sum [ - sumstep ] + t0 ; <nl> - if ( sqsum ) <nl> - sqsum [ 0 ] = sqsum [ - sqsumstep ] + tq0 ; <nl> - tilted [ 0 ] = tilted [ - tiltedstep ] + t0 + buf [ cn ] ; <nl> - <nl> - for ( x = cn ; x < width - cn ; x + = cn ) <nl> - { <nl> - ST t1 = buf [ x ] ; <nl> - buf [ x - cn ] = t1 + t0 ; <nl> - t0 = it = src [ x ] ; <nl> - tq0 = ( QT ) it * it ; <nl> - s + = t0 ; <nl> - sq + = tq0 ; <nl> - sum [ x ] = sum [ x - sumstep ] + s ; <nl> - if ( sqsum ) <nl> - sqsum [ x ] = sqsum [ x - sqsumstep ] + sq ; <nl> - t1 + = buf [ x + cn ] + t0 + tilted [ x - tiltedstep - cn ] ; <nl> - tilted [ x ] = t1 ; <nl> - } <nl> - <nl> - if ( width > cn ) <nl> - { <nl> - ST t1 = buf [ x ] ; <nl> - buf [ x - cn ] = t1 + t0 ; <nl> - t0 = it = src [ x ] ; <nl> - tq0 = ( QT ) it * it ; <nl> - s + = t0 ; <nl> - sq + = tq0 ; <nl> - sum [ x ] = sum [ x - sumstep ] + s ; <nl> - if ( sqsum ) <nl> - sqsum [ x ] = sqsum [ x - sqsumstep ] + sq ; <nl> - tilted [ x ] = t0 + t1 + tilted [ x - tiltedstep - cn ] ; <nl> - buf [ x ] = t0 ; <nl> - } <nl> - <nl> - if ( sqsum ) <nl> - sqsum + + ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - <nl> - <nl> - # ifdef HAVE_OPENCL <nl> - <nl> - static bool ocl_integral ( InputArray _src , OutputArray _sum , int sdepth ) <nl> + bool integral_SIMD ( <nl> + int depth , int sdepth , int sqdepth , <nl> + const uchar * src , size_t srcstep , <nl> + uchar * sum , size_t sumstep , <nl> + uchar * sqsum , size_t sqsumstep , <nl> + uchar * tilted , size_t tstep , <nl> + int width , int height , int cn ) <nl> { <nl> - bool doubleSupport = ocl : : Device : : getDefault ( ) . doubleFPConfig ( ) > 0 ; <nl> - <nl> - if ( ( _src . type ( ) ! = CV_8UC1 ) | | <nl> - ! ( sdepth = = CV_32S | | sdepth = = CV_32F | | ( doubleSupport & & sdepth = = CV_64F ) ) ) <nl> - return false ; <nl> - <nl> - static const int tileSize = 16 ; <nl> - <nl> - String build_opt = format ( " - D sumT = % s - D LOCAL_SUM_SIZE = % d % s " , <nl> - ocl : : typeToStr ( sdepth ) , tileSize , <nl> - doubleSupport ? " - D DOUBLE_SUPPORT " : " " ) ; <nl> - <nl> - ocl : : Kernel kcols ( " integral_sum_cols " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( kcols . empty ( ) ) <nl> - return false ; <nl> - <nl> - UMat src = _src . getUMat ( ) ; <nl> - Size src_size = src . size ( ) ; <nl> - Size bufsize ( ( ( src_size . height + tileSize - 1 ) / tileSize ) * tileSize , ( ( src_size . width + tileSize - 1 ) / tileSize ) * tileSize ) ; <nl> - UMat buf ( bufsize , sdepth ) ; <nl> - kcols . args ( ocl : : KernelArg : : ReadOnly ( src ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf ) ) ; <nl> - size_t gt = src . cols , lt = tileSize ; <nl> - if ( ! kcols . run ( 1 , & gt , & lt , false ) ) <nl> - return false ; <nl> - <nl> - ocl : : Kernel krows ( " integral_sum_rows " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( krows . empty ( ) ) <nl> - return false ; <nl> - <nl> - Size sumsize ( src_size . width + 1 , src_size . height + 1 ) ; <nl> - _sum . create ( sumsize , sdepth ) ; <nl> - UMat sum = _sum . getUMat ( ) ; <nl> - <nl> - krows . args ( ocl : : KernelArg : : ReadOnlyNoSize ( buf ) , ocl : : KernelArg : : WriteOnly ( sum ) ) ; <nl> - gt = src . rows ; <nl> - return krows . run ( 1 , & gt , & lt , false ) ; <nl> - } <nl> - <nl> - static bool ocl_integral ( InputArray _src , OutputArray _sum , OutputArray _sqsum , int sdepth , int sqdepth ) <nl> - { <nl> - bool doubleSupport = ocl : : Device : : getDefault ( ) . doubleFPConfig ( ) > 0 ; <nl> - <nl> - if ( _src . type ( ) ! = CV_8UC1 | | ( ! doubleSupport & & ( sdepth = = CV_64F | | sqdepth = = CV_64F ) ) ) <nl> - return false ; <nl> - <nl> - static const int tileSize = 16 ; <nl> - <nl> - String build_opt = format ( " - D SUM_SQUARE - D sumT = % s - D sumSQT = % s - D LOCAL_SUM_SIZE = % d % s " , <nl> - ocl : : typeToStr ( sdepth ) , ocl : : typeToStr ( sqdepth ) , <nl> - tileSize , <nl> - doubleSupport ? " - D DOUBLE_SUPPORT " : " " ) ; <nl> - <nl> - ocl : : Kernel kcols ( " integral_sum_cols " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( kcols . empty ( ) ) <nl> - return false ; <nl> - <nl> - UMat src = _src . getUMat ( ) ; <nl> - Size src_size = src . size ( ) ; <nl> - Size bufsize ( ( ( src_size . height + tileSize - 1 ) / tileSize ) * tileSize , ( ( src_size . width + tileSize - 1 ) / tileSize ) * tileSize ) ; <nl> - UMat buf ( bufsize , sdepth ) ; <nl> - UMat buf_sq ( bufsize , sqdepth ) ; <nl> - kcols . args ( ocl : : KernelArg : : ReadOnly ( src ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf ) , ocl : : KernelArg : : WriteOnlyNoSize ( buf_sq ) ) ; <nl> - size_t gt = src . cols , lt = tileSize ; <nl> - if ( ! kcols . run ( 1 , & gt , & lt , false ) ) <nl> - return false ; <nl> - <nl> - ocl : : Kernel krows ( " integral_sum_rows " , ocl : : imgproc : : integral_sum_oclsrc , build_opt ) ; <nl> - if ( krows . empty ( ) ) <nl> - return false ; <nl> - <nl> - Size sumsize ( src_size . width + 1 , src_size . height + 1 ) ; <nl> - _sum . create ( sumsize , sdepth ) ; <nl> - UMat sum = _sum . getUMat ( ) ; <nl> - _sqsum . create ( sumsize , sqdepth ) ; <nl> - UMat sum_sq = _sqsum . getUMat ( ) ; <nl> - <nl> - krows . args ( ocl : : KernelArg : : ReadOnlyNoSize ( buf ) , ocl : : KernelArg : : ReadOnlyNoSize ( buf_sq ) , ocl : : KernelArg : : WriteOnly ( sum ) , ocl : : KernelArg : : WriteOnlyNoSize ( sum_sq ) ) ; <nl> - gt = src . rows ; <nl> - return krows . run ( 1 , & gt , & lt , false ) ; <nl> - } <nl> - <nl> - # endif <nl> - <nl> - } <nl> - <nl> - # if defined ( HAVE_IPP ) <nl> - namespace cv <nl> - { <nl> - static bool ipp_integral ( <nl> - int depth , int sdepth , int sqdepth , <nl> - const uchar * src , size_t srcstep , <nl> - uchar * sum , size_t sumstep , <nl> - uchar * sqsum , size_t sqsumstep , <nl> - uchar * tilted , size_t tstep , <nl> - int width , int height , int cn ) <nl> - { <nl> - CV_INSTRUMENT_REGION_IPP ( ) ; <nl> - <nl> - IppiSize size = { width , height } ; <nl> - <nl> - if ( cn > 1 ) <nl> - return false ; <nl> - if ( tilted ) <nl> - { <nl> - CV_UNUSED ( tstep ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( ! sqsum ) <nl> - { <nl> - if ( depth = = CV_8U & & sdepth = = CV_32S ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_8u32s_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , size , 0 ) > = 0 ; <nl> - else if ( depth = = CV_8UC1 & & sdepth = = CV_32F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_8u32f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , size , 0 ) > = 0 ; <nl> - else if ( depth = = CV_32FC1 & & sdepth = = CV_32F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiIntegral_32f_C1R , ( const Ipp32f * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , size ) > = 0 ; <nl> - else <nl> - return false ; <nl> - } <nl> - else <nl> - { <nl> - if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_32S ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32s_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , ( Ipp32s * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> - else if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_64F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32s64f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32s * ) sum , ( int ) sumstep , ( Ipp64f * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> - else if ( depth = = CV_8U & & sdepth = = CV_32F & & sqdepth = = CV_64F ) <nl> - return CV_INSTRUMENT_FUN_IPP ( ippiSqrIntegral_8u32f64f_C1R , ( const Ipp8u * ) src , ( int ) srcstep , ( Ipp32f * ) sum , ( int ) sumstep , ( Ipp64f * ) sqsum , ( int ) sqsumstep , size , 0 , 0 ) > = 0 ; <nl> - else <nl> - return false ; <nl> - } <nl> - } <nl> - } <nl> - # endif <nl> - <nl> - namespace cv { namespace hal { <nl> - <nl> - void integral ( int depth , int sdepth , int sqdepth , <nl> - const uchar * src , size_t srcstep , <nl> - uchar * sum , size_t sumstep , <nl> - uchar * sqsum , size_t sqsumstep , <nl> - uchar * tilted , size_t tstep , <nl> - int width , int height , int cn ) <nl> - { <nl> - CALL_HAL ( integral , cv_hal_integral , depth , sdepth , sqdepth , src , srcstep , sum , sumstep , sqsum , sqsumstep , tilted , tstep , width , height , cn ) ; <nl> - CV_IPP_RUN_FAST ( ipp_integral ( depth , sdepth , sqdepth , src , srcstep , sum , sumstep , sqsum , sqsumstep , tilted , tstep , width , height , cn ) ) ; <nl> + CV_INSTRUMENT_REGION ( ) ; <nl> <nl> - # define ONE_CALL ( A , B , C ) integral_ < A , B , C > ( ( const A * ) src , srcstep , ( B * ) sum , sumstep , ( C * ) sqsum , sqsumstep , ( B * ) tilted , tstep , width , height , cn ) <nl> + # define ONE_CALL ( T , ST , QT ) \ <nl> + return Integral_SIMD < T , ST , QT > ( ) ( ( const T * ) src , srcstep , ( ST * ) sum , sumstep , ( QT * ) sqsum , sqsumstep , ( ST * ) tilted , tstep , width , height , cn ) <nl> <nl> if ( depth = = CV_8U & & sdepth = = CV_32S & & sqdepth = = CV_64F ) <nl> ONE_CALL ( uchar , int , double ) ; <nl> void integral ( int depth , int sdepth , int sqdepth , <nl> else if ( depth = = CV_64F & & sdepth = = CV_64F & & sqdepth = = CV_64F ) <nl> ONE_CALL ( double , double , double ) ; <nl> else <nl> - CV_Error ( CV_StsUnsupportedFormat , " " ) ; <nl> + return false ; <nl> <nl> # undef ONE_CALL <nl> } <nl> <nl> + # endif <nl> + CV_CPU_OPTIMIZATION_NAMESPACE_END <nl> } } / / cv : : hal : : <nl> - <nl> - void cv : : integral ( InputArray _src , OutputArray _sum , OutputArray _sqsum , OutputArray _tilted , int sdepth , int sqdepth ) <nl> - { <nl> - CV_INSTRUMENT_REGION ( ) ; <nl> - <nl> - int type = _src . type ( ) , depth = CV_MAT_DEPTH ( type ) , cn = CV_MAT_CN ( type ) ; <nl> - if ( sdepth < = 0 ) <nl> - sdepth = depth = = CV_8U ? CV_32S : CV_64F ; <nl> - if ( sqdepth < = 0 ) <nl> - sqdepth = CV_64F ; <nl> - sdepth = CV_MAT_DEPTH ( sdepth ) , sqdepth = CV_MAT_DEPTH ( sqdepth ) ; <nl> - <nl> - CV_OCL_RUN ( _sum . isUMat ( ) & & ! _tilted . needed ( ) , <nl> - ( _sqsum . needed ( ) ? ocl_integral ( _src , _sum , _sqsum , sdepth , sqdepth ) : ocl_integral ( _src , _sum , sdepth ) ) ) ; <nl> - <nl> - Size ssize = _src . size ( ) , isize ( ssize . width + 1 , ssize . height + 1 ) ; <nl> - _sum . create ( isize , CV_MAKETYPE ( sdepth , cn ) ) ; <nl> - Mat src = _src . getMat ( ) , sum = _sum . getMat ( ) , sqsum , tilted ; <nl> - <nl> - if ( _sqsum . needed ( ) ) <nl> - { <nl> - _sqsum . create ( isize , CV_MAKETYPE ( sqdepth , cn ) ) ; <nl> - sqsum = _sqsum . getMat ( ) ; <nl> - } ; <nl> - <nl> - if ( _tilted . needed ( ) ) <nl> - { <nl> - _tilted . create ( isize , CV_MAKETYPE ( sdepth , cn ) ) ; <nl> - tilted = _tilted . getMat ( ) ; <nl> - } <nl> - <nl> - hal : : integral ( depth , sdepth , sqdepth , <nl> - src . ptr ( ) , src . step , <nl> - sum . ptr ( ) , sum . step , <nl> - sqsum . ptr ( ) , sqsum . step , <nl> - tilted . ptr ( ) , tilted . step , <nl> - src . cols , src . rows , cn ) ; <nl> - } <nl> - <nl> - void cv : : integral ( InputArray src , OutputArray sum , int sdepth ) <nl> - { <nl> - CV_INSTRUMENT_REGION ( ) ; <nl> - <nl> - integral ( src , sum , noArray ( ) , noArray ( ) , sdepth ) ; <nl> - } <nl> - <nl> - void cv : : integral ( InputArray src , OutputArray sum , OutputArray sqsum , int sdepth , int sqdepth ) <nl> - { <nl> - CV_INSTRUMENT_REGION ( ) ; <nl> - <nl> - integral ( src , sum , sqsum , noArray ( ) , sdepth , sqdepth ) ; <nl> - } <nl> - <nl> - <nl> - CV_IMPL void <nl> - cvIntegral ( const CvArr * image , CvArr * sumImage , <nl> - CvArr * sumSqImage , CvArr * tiltedSumImage ) <nl> - { <nl> - cv : : Mat src = cv : : cvarrToMat ( image ) , sum = cv : : cvarrToMat ( sumImage ) , sum0 = sum ; <nl> - cv : : Mat sqsum0 , sqsum , tilted0 , tilted ; <nl> - cv : : Mat * psqsum = 0 , * ptilted = 0 ; <nl> - <nl> - if ( sumSqImage ) <nl> - { <nl> - sqsum0 = sqsum = cv : : cvarrToMat ( sumSqImage ) ; <nl> - psqsum = & sqsum ; <nl> - } <nl> - <nl> - if ( tiltedSumImage ) <nl> - { <nl> - tilted0 = tilted = cv : : cvarrToMat ( tiltedSumImage ) ; <nl> - ptilted = & tilted ; <nl> - } <nl> - cv : : integral ( src , sum , psqsum ? cv : : _OutputArray ( * psqsum ) : cv : : _OutputArray ( ) , <nl> - ptilted ? cv : : _OutputArray ( * ptilted ) : cv : : _OutputArray ( ) , sum . depth ( ) ) ; <nl> - <nl> - CV_Assert ( sum . data = = sum0 . data & & sqsum . data = = sqsum0 . data & & tilted . data = = tilted0 . data ) ; <nl> - } <nl> - <nl> - / * End of file . * / <nl>
imgproc : dispatch sumpixels ( integral )
opencv/opencv
09b3383a7e1072ac831eaf71fc56a33941de4db9
2020-01-17T13:54:29Z
mmm a / cmake / protobuf - config . cmake . in <nl> ppp b / cmake / protobuf - config . cmake . in <nl> function ( protobuf_generate ) <nl> set ( _generated_srcs_all ) <nl> foreach ( _proto $ { protobuf_generate_PROTOS } ) <nl> get_filename_component ( _abs_file $ { _proto } ABSOLUTE ) <nl> + get_filename_component ( _abs_dir $ { _abs_file } DIRECTORY ) <nl> get_filename_component ( _basename $ { _proto } NAME_WE ) <nl> + file ( RELATIVE_PATH _rel_dir $ { CMAKE_CURRENT_SOURCE_DIR } $ { _abs_dir } ) <nl> <nl> set ( _generated_srcs ) <nl> foreach ( _ext $ { protobuf_generate_GENERATE_EXTENSIONS } ) <nl> - list ( APPEND _generated_srcs " $ { protobuf_generate_PROTOC_OUT_DIR } / $ { _basename } $ { _ext } " ) <nl> + list ( APPEND _generated_srcs " $ { protobuf_generate_PROTOC_OUT_DIR } / $ { _rel_dir } / $ { _basename } $ { _ext } " ) <nl> endforeach ( ) <nl> list ( APPEND _generated_srcs_all $ { _generated_srcs } ) <nl> <nl>
Fixed protobuf_generate output definition for files relative to the protobuf_generate command
protocolbuffers/protobuf
3e84147d53bea86f9e0e88c642f7af4b00365621
2018-06-25T09:29:56Z
mmm a / atom / browser / api / atom_api_window . cc <nl> ppp b / atom / browser / api / atom_api_window . cc <nl> Window : : Window ( v8 : : Isolate * isolate , v8 : : Local < v8 : : Object > wrapper , <nl> if ( options . Get ( " transparent " , & transparent ) ) <nl> web_preferences . Set ( " transparent " , transparent ) ; <nl> <nl> + / / Offscreen windows are always created frameless . <nl> + bool offscreen ; <nl> + if ( web_preferences . Get ( " offscreen " , & offscreen ) & & offscreen ) { <nl> + auto window_options = const_cast < mate : : Dictionary & > ( options ) ; <nl> + window_options . Set ( options : : kFrame , false ) ; <nl> + } <nl> + <nl> / / Creates the WebContents used by BrowserWindow . <nl> web_contents = WebContents : : Create ( isolate , web_preferences ) ; <nl> } <nl> mmm a / docs / tutorial / offscreen - rendering . md <nl> ppp b / docs / tutorial / offscreen - rendering . md <nl> when there is nothing happening on a webpage , no frames are generated . The <nl> maximum frame rate is 60 , because above that there is no benefit , just <nl> performance loss . <nl> <nl> + * * Note : * * An offscreen window is always created as a [ Frameless Window ] ( . . / api / frameless - window . md ) . <nl> + <nl> # # Two modes of rendering <nl> <nl> # # # GPU accelerated <nl>
Merge pull request from gerhardberger / osr - window - size - fix
electron/electron
6ea1bacc73d407d566b9cc4c18e2ee68668680e9
2016-12-29T17:10:14Z
mmm a / tensorflow / core / ops / tpu_cross_replica_ops . cc <nl> ppp b / tensorflow / core / ops / tpu_cross_replica_ops . cc <nl> REGISTER_OP ( " AllToAll " ) <nl> . Input ( " input : T " ) <nl> . Input ( " group_assignment : int32 " ) <nl> . Output ( " output : T " ) <nl> - . Attr ( " T : { bfloat16 , float } " ) <nl> + . Attr ( " T : { numbertype , bool } " ) <nl> . Attr ( " concat_dimension : int " ) <nl> . Attr ( " split_dimension : int " ) <nl> . Attr ( " split_count : int " ) <nl>
Support all numeric type in XLA all - to - all from TensorFlow .
tensorflow/tensorflow
f54635e27fb2789df1e6b29f92d41afb3d974814
2019-02-14T16:18:47Z
mmm a / test / Parse / confusables . swift <nl> ppp b / test / Parse / confusables . swift <nl> if ( true ꝸꝸꝸ false ) { } / / expected - note { { identifier ' ꝸꝸꝸ ' contains <nl> <nl> / / expected - error @ + 3 { { invalid character in source file } } <nl> / / expected - error @ + 2 { { expected ' , ' separator } } <nl> - / / expected - error @ + 1 { { argument type ' ( Int , Int ) ' does not conform to expected type ' BinaryInteger ' } } <nl> + / / expected - error @ + 1 { { type ' ( Int , Int ) ' cannot conform to ' BinaryInteger ' ; only struct / enum / class types can conform to protocols } } <nl> if ( 5 ‒ 5 ) = = 0 { } / / expected - note { { unicode character ' ‒ ' looks similar to ' - ' ; did you mean to use ' - ' ? } } { { 7 - 10 = - } } <nl> + / / expected - note @ - 1 { { required by referencing operator function ' = = ' on ' BinaryInteger ' where ' Self ' = ' ( Int , Int ) ' } } <nl>
[ Test ] Update Parse / confusables . swift with the " type cannot conform "
apple/swift
ea2acc6f9509578a43f3711cf25d6bcce43ca788
2019-09-17T20:21:54Z
mmm a / atom / browser / api / atom_api_web_contents . cc <nl> ppp b / atom / browser / api / atom_api_web_contents . cc <nl> void WebContents : : SetAllowTransparency ( bool allow ) { <nl> if ( guest_opaque_ ! = allow ) <nl> return ; <nl> <nl> + auto render_view_host = web_contents ( ) - > GetRenderViewHost ( ) ; <nl> guest_opaque_ = ! allow ; <nl> - if ( ! web_contents ( ) - > GetRenderViewHost ( ) - > GetView ( ) ) <nl> + if ( ! render_view_host - > GetView ( ) ) <nl> return ; <nl> <nl> if ( guest_opaque_ ) { <nl> - web_contents ( ) <nl> - - > GetRenderViewHost ( ) <nl> - - > GetView ( ) <nl> - - > SetBackgroundColorToDefault ( ) ; <nl> + render_view_host - > GetView ( ) - > SetBackgroundColorToDefault ( ) ; <nl> } else { <nl> - web_contents ( ) - > GetRenderViewHost ( ) - > GetView ( ) - > SetBackgroundColor ( <nl> - SK_ColorTRANSPARENT ) ; <nl> + render_view_host - > GetView ( ) - > SetBackgroundColor ( SK_ColorTRANSPARENT ) ; <nl> } <nl> } <nl> <nl>
Clean up SetAllowTransparency
electron/electron
2d65c3bcd0a6d5e987ece2555531fb1b2eb60507
2015-06-23T08:19:12Z
mmm a / buildscripts / burn_in_tests . py <nl> ppp b / buildscripts / burn_in_tests . py <nl> def find_last_activated_task ( revisions , variant , branch_name ) : <nl> build_prefix = " mongodb_mongo_ " + branch_name + " _ " + variant . replace ( ' - ' , ' _ ' ) <nl> <nl> evg_cfg = read_evg_config ( ) <nl> - if " api_server_host " in evg_cfg : <nl> + if evg_cfg is not None and " api_server_host " in evg_cfg : <nl> api_server = " { url . scheme } : / / { url . netloc } " . format ( <nl> url = urlparse . urlparse ( evg_cfg [ " api_server_host " ] ) ) <nl> else : <nl> def main ( ) : <nl> <nl> sys . exit ( 0 ) <nl> <nl> + <nl> if __name__ = = " __main__ " : <nl> main ( ) <nl>
SERVER - 28823 Add missing check that dict is None
mongodb/mongo
d4c1d45863a14d504404e0b606eb4ef01aacc2a1
2017-04-17T18:41:14Z
mmm a / docs / _static / js / options . js <nl> ppp b / docs / _static / js / options . js <nl> <nl> var versionSelect = defaultVersion = ' v1 . 2 . 0 ' ; <nl> - var deviceSelect = ' Linux ' ; <nl> + var platformSelect = ' Linux ' ; <nl> var languageSelect = ' Python ' ; <nl> var processorSelect = ' CPU ' ; <nl> var environSelect = ' Pip ' ; <nl> $ ( document ) . ready ( function ( ) { <nl> $ ( ' li a : contains ( ' + versionSelect + ' ) ' ) . parent ( ) . siblings ( ) . removeClass ( ' active ' ) ; <nl> $ ( ' li a : contains ( ' + versionSelect + ' ) ' ) . parent ( ) . addClass ( ' active ' ) ; <nl> $ ( ' . current - version ' ) . html ( versionSelect + ' < span class = " caret " > < / span > < / button > ' ) ; <nl> - if ( urlParams . get ( ' device ' ) ) <nl> - deviceSelect = urlParams . get ( ' device ' ) ; <nl> - $ ( ' button : contains ( ' + deviceSelect + ' ) ' ) . siblings ( ) . removeClass ( ' active ' ) ; <nl> - $ ( ' button : contains ( ' + deviceSelect + ' ) ' ) . addClass ( ' active ' ) ; <nl> + if ( urlParams . get ( ' platform ' ) ) <nl> + platformSelect = urlParams . get ( ' platform ' ) ; <nl> + $ ( ' button : contains ( ' + platformSelect + ' ) ' ) . siblings ( ) . removeClass ( ' active ' ) ; <nl> + $ ( ' button : contains ( ' + platformSelect + ' ) ' ) . addClass ( ' active ' ) ; <nl> if ( urlParams . get ( ' language ' ) ) <nl> languageSelect = urlParams . get ( ' language ' ) ; <nl> $ ( ' button : contains ( ' + languageSelect + ' ) ' ) . siblings ( ) . removeClass ( ' active ' ) ; <nl> $ ( document ) . ready ( function ( ) { <nl> showContent ( ) ; <nl> if ( window . location . href . includes ( " / install / index . html " ) ) { <nl> if ( versionSelect . includes ( defaultVersion ) ) { <nl> - history . pushState ( null , null , ' / install / index . html ? device = ' + deviceSelect + ' & language = ' + languageSelect + ' & processor = ' + processorSelect ) ; <nl> + history . pushState ( null , null , ' / install / index . html ? platform = ' + platformSelect + ' & language = ' + languageSelect + ' & processor = ' + processorSelect ) ; <nl> } else { <nl> - history . pushState ( null , null , ' / install / index . html ? version = ' + versionSelect + ' & device = ' + deviceSelect + ' & language = ' + languageSelect + ' & processor = ' + processorSelect ) ; <nl> + history . pushState ( null , null , ' / install / index . html ? version = ' + versionSelect + ' & platform = ' + platformSelect + ' & language = ' + languageSelect + ' & processor = ' + processorSelect ) ; <nl> } <nl> } <nl> } <nl> $ ( document ) . ready ( function ( ) { <nl> history . pushState ( null , null , ' / install / index . html ' + window . location . search . replace ( ' version ' , ' prev ' ) ) ; <nl> } <nl> } <nl> - else if ( $ ( this ) . hasClass ( " Devices " ) ) { <nl> - history . pushState ( null , null , ' / install / index . html ' + window . location . search . replace ( urlParams . get ( ' device ' ) , $ ( this ) . text ( ) ) ) ; <nl> + else if ( $ ( this ) . hasClass ( " platforms " ) ) { <nl> + history . pushState ( null , null , ' / install / index . html ' + window . location . search . replace ( urlParams . get ( ' platform ' ) , $ ( this ) . text ( ) ) ) ; <nl> } <nl> else if ( $ ( this ) . hasClass ( " languages " ) ) { <nl> history . pushState ( null , null , ' / install / index . html ' + window . location . search . replace ( urlParams . get ( ' language ' ) , $ ( this ) . text ( ) ) ) ; <nl> mmm a / docs / install / index . md <nl> ppp b / docs / install / index . md <nl> Indicate your preferred configuration . Then , follow the customized commands to i <nl> < ! - - START - OS Menu - - > <nl> <nl> < div class = " btn - group opt - group " role = " group " > <nl> - < button type = " button " class = " btn btn - default opt active Devices " > Linux < / button > <nl> - < button type = " button " class = " btn btn - default opt Devices " > MacOS < / button > <nl> - < button type = " button " class = " btn btn - default opt Devices " > Windows < / button > <nl> - < button type = " button " class = " btn btn - default opt Devices " > Cloud < / button > <nl> - < button type = " button " class = " btn btn - default opt Devices " > Devices < / button > <nl> + < button type = " button " class = " btn btn - default opt active platforms " > Linux < / button > <nl> + < button type = " button " class = " btn btn - default opt platforms " > MacOS < / button > <nl> + < button type = " button " class = " btn btn - default opt platforms " > Windows < / button > <nl> + < button type = " button " class = " btn btn - default opt platforms " > Cloud < / button > <nl> + < button type = " button " class = " btn btn - default opt platforms " > Devices < / button > <nl> < / div > <nl> <nl> < ! - - START - Language Menu - - > <nl> $ wget https : / / bootstrap . pypa . io / get - pip . py & & sudo python get - pip . py <nl> <nl> < div class = " v1 - 2 - 0 " > <nl> <nl> - * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 0 <nl> + * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 2 <nl> + <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90 <nl> + nvcc - - version <nl> ` ` ` <nl> <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> + <nl> + ` ` ` bash <nl> + $ pip install mxnet - cu92 <nl> + ` ` ` <nl> + <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> * * Step 3 * * Install [ Graphviz ] ( http : / / www . graphviz . org / ) . ( Optional , needed for graph visualization using ` mxnet . viz ` package ) . <nl> ` ` ` bash <nl> sudo apt - get install graphviz <nl> $ pip install mxnet - cu90mkl <nl> <nl> < div class = " v1 - 1 - 0 " > <nl> <nl> - * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 0 <nl> + * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 1 <nl> + <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90 = = 1 . 1 . 0 <nl> + nvcc - - version <nl> ` ` ` <nl> <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> + <nl> + ` ` ` bash <nl> + $ pip install mxnet - cu91 = = 1 . 1 . 0 <nl> + ` ` ` <nl> + <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> * * Step 3 * * Install [ Graphviz ] ( http : / / www . graphviz . org / ) . ( Optional , needed for graph visualization using ` mxnet . viz ` package ) . <nl> ` ` ` bash <nl> sudo apt - get install graphviz <nl> pip install graphviz <nl> <nl> * * Step 4 * * Validate the installation by running simple MXNet code described [ here ] ( # validate - mxnet - installation ) . <nl> <nl> - * * Experimental Choice * * If You would like to install mxnet with Intel MKL , try the experimental pip package with MKL : <nl> + * * Experimental Choice * * If You would like to install MXNet with Intel MKL , try the experimental pip package with MKL : <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90mkl = = 1 . 1 . 0 <nl> + $ pip install mxnet - cu91mkl = = 1 . 1 . 0 <nl> ` ` ` <nl> <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> < / div > < ! - - End of v1 - 1 - 0 - - > <nl> <nl> <nl> $ pip install mxnet - cu90mkl = = 0 . 12 . 0 <nl> <nl> < div class = " v0 - 11 - 0 " > <nl> <nl> - * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 0 <nl> + * * Step 2 * * Install * MXNet * with GPU support using CUDA 8 . 0 <nl> <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90 = = 0 . 11 . 0 <nl> + $ pip install mxnet - cu80 = = 0 . 11 . 0 <nl> ` ` ` <nl> <nl> * * Step 3 * * Install [ Graphviz ] ( http : / / www . graphviz . org / ) . ( Optional , needed for graph visualization using ` mxnet . viz ` package ) . <nl> pip install graphviz <nl> <nl> * * Step 4 * * Validate the installation by running simple MXNet code described [ here ] ( # validate - mxnet - installation ) . <nl> <nl> - * * Experimental Choice * * If You would like to install mxnet with Intel MKL , try the experimental pip package with MKL : <nl> + * * Experimental Choice * * If You would like to install MXNet with Intel MKL , try the experimental pip package with MKL : <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90mkl = = 0 . 11 . 0 <nl> + $ pip install mxnet - cu80mkl = = 0 . 11 . 0 <nl> ` ` ` <nl> <nl> < / div > < ! - - End of v0 - 11 - 0 - - > <nl> Installing * MXNet * with pip requires a latest version of ` pip ` . Install the late <nl> <nl> < div class = " v1 - 2 - 0 " > <nl> <nl> - Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> + <nl> + ` ` ` bash <nl> + nvcc - - version <nl> + ` ` ` <nl> + <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> + <nl> + Install * MXNet * with GPU support using CUDA 9 . 2 : <nl> <nl> ` ` ` bash <nl> - ( mxnet ) $ pip install mxnet - cu90 <nl> + ( mxnet ) $ pip install mxnet - cu92 <nl> ` ` ` <nl> <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> < / div > < ! - - End of v1 - 2 - 0 - - > <nl> <nl> <nl> < div class = " v1 - 1 - 0 " > <nl> <nl> - Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> + <nl> + ` ` ` bash <nl> + nvcc - - version <nl> + ` ` ` <nl> + <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> + <nl> + Install * MXNet * with GPU support using CUDA 9 . 1 : <nl> <nl> ` ` ` bash <nl> - ( mxnet ) $ pip install mxnet - cu90 = = 1 . 1 . 0 <nl> + ( mxnet ) $ pip install mxnet - cu91 = = 1 . 1 . 0 <nl> ` ` ` <nl> <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> < / div > < ! - - End of v1 - 1 - 0 - - > <nl> <nl> <nl> Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> ` ` ` bash <nl> ( mxnet ) $ pip install mxnet - cu90 = = 1 . 0 . 0 <nl> ` ` ` <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> <nl> < / div > < ! - - End of v1 - 0 - 0 - - > <nl> <nl> Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> ( mxnet ) $ pip install mxnet - cu90 = = 0 . 12 . 1 <nl> ` ` ` <nl> <nl> - For * MXNet * 0 . 12 . 0 with GPU support using CUDA 9 . 0 . <nl> - <nl> - ` ` ` bash <nl> - ( mxnet ) $ pip install mxnet - cu90 = = 0 . 12 . 0 <nl> - ` ` ` <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> <nl> < / div > < ! - - End of v0 - 12 - 1 - - > <nl> <nl> <nl> < div class = " v0 - 11 - 0 " > <nl> <nl> - Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + Install * MXNet * with GPU support using CUDA 8 . 0 . <nl> <nl> ` ` ` bash <nl> - ( mxnet ) $ pip install mxnet - cu90 = = 0 . 11 . 0 <nl> + ( mxnet ) $ pip install mxnet - cu80 = = 0 . 11 . 0 <nl> ` ` ` <nl> <nl> < / div > < ! - - End of v0 - 11 - 0 - - > <nl> <nl> < div class = " master " > <nl> <nl> - Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> + <nl> + ` ` ` bash <nl> + nvcc - - version <nl> + ` ` ` <nl> + <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> + <nl> + Install * MXNet * with GPU support using CUDA 9 . 2 . <nl> <nl> ` ` ` bash <nl> - ( mxnet ) $ pip install mxnet - cu90 - - pre <nl> + ( mxnet ) $ pip install mxnet - cu92 - - pre <nl> ` ` ` <nl> <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> < / div > < ! - - End of master - - > <nl> <nl> * * Step 4 * * Install [ Graphviz ] ( http : / / www . graphviz . org / ) . ( Optional , needed for graph visualization using ` mxnet . viz ` package ) . <nl> Follow the installation instructions [ in this guide ] ( . / windows_setup . md ) to set <nl> <nl> < div class = " v1 - 2 - 0 " > <nl> <nl> - * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 2 . <nl> + <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> + <nl> + ` ` ` bash <nl> + nvcc - - version <nl> + ` ` ` <nl> + <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90 <nl> + $ pip install mxnet - cu92 <nl> ` ` ` <nl> <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> < / div > < ! - - End of v1 - 2 - 0 - - > <nl> <nl> < div class = " v1 - 1 - 0 " > <nl> <nl> - * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 1 . <nl> + <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> + <nl> + ` ` ` bash <nl> + nvcc - - version <nl> + ` ` ` <nl> + <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90 = = 1 . 1 . 0 <nl> + $ pip install mxnet - cu91 = = 1 . 1 . 0 <nl> ` ` ` <nl> <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> < / div > < ! - - End of v1 - 1 - 0 - - > <nl> <nl> < div class = " v1 - 0 - 0 " > <nl> $ pip install mxnet - cu90 = = 0 . 12 . 0 <nl> <nl> < div class = " v0 - 11 - 0 " > <nl> <nl> - * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + * * Step 2 * * Install * MXNet * with GPU support using CUDA 8 . 0 . <nl> <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90 = = 0 . 11 . 0 <nl> + $ pip install mxnet - cu80 = = 0 . 11 . 0 <nl> ` ` ` <nl> <nl> < / div > < ! - - End of v0 - 11 - 0 - - > <nl> <nl> < div class = " master " > <nl> <nl> - * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 0 . <nl> + * * Step 2 * * Install * MXNet * with GPU support using CUDA 9 . 2 . <nl> + <nl> + * * Important * * : Make sure your installed CUDA version matches the CUDA version in the pip package . <nl> + Check your CUDA version with the following command : <nl> + <nl> + ` ` ` bash <nl> + nvcc - - version <nl> + ` ` ` <nl> + <nl> + You can either upgrade your CUDA install or install the MXNet package that supports your CUDA version . <nl> <nl> ` ` ` bash <nl> - $ pip install mxnet - cu90 - - pre <nl> + $ pip install mxnet - cu92 - - pre <nl> ` ` ` <nl> <nl> + Refer to [ pypi for older packages ] ( https : / / pypi . org / project / mxnet / ) . <nl> + <nl> < / div > < ! - - End of master - - > <nl> <nl> Refer to [ # 8671 ] ( https : / / github . com / apache / incubator - mxnet / issues / 8671 ) for status on CUDA 9 . 1 support . <nl> Refer to [ # 8671 ] ( https : / / github . com / apache / incubator - mxnet / issues / 8671 ) for stat <nl> <nl> We provide both options to build and install MXNet yourself using [ Microsoft Visual Studio 2017 ] ( https : / / www . visualstudio . com / downloads / ) , and [ Microsoft Visual Studio 2015 ] ( https : / / www . visualstudio . com / vs / older - downloads / ) . <nl> <nl> - * * Option 1 * * <nl> + * * Option 1 * * <nl> <nl> To build and install MXNet yourself using [ Microsoft Visual Studio 2017 ] ( https : / / www . visualstudio . com / downloads / ) , you need the following dependencies . Install the required dependencies : <nl> <nl> git clone https : / / github . com / apache / incubator - mxnet . git - - recursive <nl> " C : \ Program Files ( x86 ) \ Microsoft Visual Studio \ 2017 \ Community \ VC \ Auxiliary \ Build \ vcvars64 . bat " - vcvars_ver = 14 . 11 <nl> ` ` ` <nl> <nl> - 5 . Create a build dir using the following command and go to the directory , for example : <nl> + 5 . Create a build dir using the following command and go to the directory , for example : <nl> <nl> ` ` ` r <nl> mkdir C : \ build <nl> NOTE : make sure the DCUDNN_INCLUDE and DCUDNN_LIBRARY pointing to the “ include <nl> msbuild mxnet . sln / p : Configuration = Release ; Platform = x64 / maxcpucount <nl> ` ` ` <nl> <nl> - * * Option 2 * * <nl> + * * Option 2 * * <nl> <nl> To build and install MXNet yourself using [ Microsoft Visual Studio 2015 ] ( https : / / www . visualstudio . com / vs / older - downloads / ) , you need the following dependencies . Install the required dependencies : <nl> <nl> Follow the installation instructions [ in this guide ] ( . / windows_setup . md ) to set <nl> < p > To build the C + + package , please refer to < a href = " build_from_source . html # build - the - c - package " > this guide < / a > . < / p > <nl> < br / > <nl> < / div > < ! - - End of cpu gpu - - > <nl> - < / div > < ! - - End of C + + > <nl> + < / div > < ! - - End of C + + - - > <nl> < / div > < ! - - End of Windows - - > <nl> <nl> <nl> Will be available soon . <nl> # Source Download <nl> <nl> < a href = " download . html " > Download < / a > your required version of MXNet . <nl> - <nl>
[ MXNET - 541 ] Correcting the new install pages bugs ( )
apache/incubator-mxnet
258e96d036a9f011c4a6b01ca51e2ebe6d06ac09
2018-06-15T20:58:04Z
new file mode 100644 <nl> index 0000000000 . . b98720f9df <nl> mmm / dev / null <nl> ppp b / PowerEditor / installer / nativeLang / telugu . xml <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < ! - - <nl> + This is Telugu language file for Notepad + + . <nl> + I am Inspired by the Tamil and Hindi languages work done by Arivarasu B . and Rathin A . Dholakia . <nl> + Author : Sreedhar Reddy V <nl> + Email : srib4ufrnd @ gmail . com <nl> + Note : In case of any suggestions and improvements please contact me . Help Indian Languages To Grow . Thank you . <nl> + - - > <nl> + < NotepadPlus > <nl> + < Native - Langue name = " త ె ల ు గ ు " filename = " telugu . xml " > <nl> + < Menu > <nl> + < Main > <nl> + < ! - - Main Menu Entries - - > <nl> + < Entries > <nl> + < Item id = " 0 " name = " ఫ ై ల ్ ( & amp ; F ) " / > <nl> + < Item id = " 1 " name = " ఎడ ి ట ్ ( & amp ; E ) " / > <nl> + < Item id = " 2 " name = " సర ్ చ ్ ( & amp ; S ) " / > <nl> + < Item id = " 3 " name = " వ ్ య ూ ( & amp ; V ) " / > <nl> + < Item id = " 4 " name = " ఎన ్ ‌ క ో డ ి ం గ ్ ( & amp ; N ) " / > <nl> + < Item id = " 5 " name = " ల ్ య ా ం గ ్ వ ే జ ్ ( & amp ; L ) " / > <nl> + < Item id = " 6 " name = " స ె ట ్ ట ి ం గ ్ స ్ ( & amp ; T ) " / > <nl> + < Item id = " 7 " name = " మ ్ య ా క ్ ర ో " / > <nl> + < Item id = " 8 " name = " రన ్ " / > <nl> + < Item idName = " Plugins " name = " ప ్ లగ ి న ్ స ్ " / > <nl> + < Item idName = " Window " name = " వ ి ం డ ొ " / > <nl> + < / Entries > <nl> + < ! - - Sub Menu Entries - - > <nl> + < SubEntries > <nl> + < Item posX = " 1 " posY = " 9 " name = " క ా ప ీ ట ు క ్ ల ి ప ్ ‌ బ ో ర ్ డ ్ " / > <nl> + < Item posX = " 1 " posY = " 10 " name = " ఇన ్ ‌ డ ె ం ట ్ " / > <nl> + < Item posX = " 1 " posY = " 11 " name = " క ా న ్ ‌ వర ్ ట ్ క ే స ్ ట ు " / > <nl> + < Item posX = " 1 " posY = " 12 " name = " ల ై న ్ ఆపర ే షన ్ స ్ " / > <nl> + < Item posX = " 1 " posY = " 13 " name = " క ా మ ె ం ట ్ / అన ్ ‌ కమ ె ం ట ్ " / > <nl> + < Item posX = " 1 " posY = " 14 " name = " ఆట ో - క ం ప ్ ల ీ షన ్ " / > <nl> + < Item posX = " 1 " posY = " 15 " name = " ఈఓఎల ్ కన ్ వర ్ షన ్ " / > <nl> + < Item posX = " 1 " posY = " 16 " name = " బ ్ ల ్ య ా ం క ్ ఆపర ే షన ్ స ్ " / > <nl> + < Item posX = " 2 " posY = " 16 " name = " మ ా ర ్ క ్ ఆల ్ " / > <nl> + < Item posX = " 2 " posY = " 17 " name = " అన ్ ‌ మ ా ర ్ క ్ ఆల ్ " / > <nl> + < Item posX = " 2 " posY = " 18 " name = " జ ం ప ్ అప ్ " / > <nl> + < Item posX = " 2 " posY = " 19 " name = " జ ం ప ్ డ ౌ న ్ " / > <nl> + < Item posX = " 2 " posY = " 21 " name = " బ ు క ్ ‌ మ ా ర ్ క ్ " / > <nl> + < Item posX = " 3 " posY = " 4 " name = " ష ో స ి ం బల ్ " / > <nl> + < Item posX = " 3 " posY = " 5 " name = " జ ూ మ ్ " / > <nl> + < Item posX = " 3 " posY = " 6 " name = " మ ూ వ ్ / క ్ ల ో న ్ కర ె ం ట ్ డ ా క ్ య ు మ ె ం ట ్ " / > <nl> + < Item posX = " 3 " posY = " 16 " name = " క ొ ల ్ య ా ప ్ స ్ ల ె వ ె ల ్ " / > <nl> + < Item posX = " 3 " posY = " 17 " name = " అన ్ ‌ క ో ల ్ య ా ప ్ స ్ ల ె వ ె ల ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " name = " క ్ య ా రక ్ టర ్ స ె ట ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 0 " name = " అరబ ి క ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 1 " name = " బ ా ల ్ ట ి క ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 2 " name = " స ె ల ్ ‌ ట ి క ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 3 " name = " స ీ ర ీ ల ్ ళ ి క ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 4 " name = " స ె ం ట ్ రల ్ య ు ర ో ప ి యన ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 5 " name = " చ ై న ీ స ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 6 " name = " ఈస ్ టర ్ న ్ య ు ర ో ప ి యన ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 7 " name = " గ ్ ర ీ క ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 8 " name = " హ ి బ ్ ర ్ య ూ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 9 " name = " జప ా న ీ స ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 10 " name = " క ొ ర ి యన ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 11 " name = " న ా ర ్ త ్ య ు ర ో ప ి యన ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 12 " name = " థ ా య ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 13 " name = " టర ్ క ి ష ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 14 " name = " వ ె స ్ టర ్ న ్ య ు ర ో ప ి యన ్ " / > <nl> + < Item posX = " 4 " posY = " 5 " posZ = " 15 " name = " వ ి య ె ట ్ న ా మ ీ స ్ " / > <nl> + < Item posX = " 6 " posY = " 4 " name = " ఇ ం ప ో ర ్ ట ్ " / > <nl> + < / SubEntries > <nl> + < ! - - all menu item - - > <nl> + < Commands > <nl> + < Item id = " 41001 " name = " న ్ య ూ ( & amp ; N ) " / > <nl> + < Item id = " 41002 " name = " ఓప ె న ్ ( & amp ; O ) " / > <nl> + < Item id = " 41003 " name = " క ్ ల ో స ్ " / > <nl> + < Item id = " 41004 " name = " క ్ ల ో స ్ ఆల ్ ( & amp ; L ) " / > <nl> + < Item id = " 41005 " name = " క ్ ల ో స ్ ఆల ్ బట ్ కర ె ం ట ్ డ ా క ్ య ు మ ె ం ట ్ " / > <nl> + < Item id = " 41006 " name = " స ే వ ్ ( & amp ; S ) " / > <nl> + < Item id = " 41007 " name = " స ే వ ్ ఆల ్ ( & amp ; E ) " / > <nl> + < Item id = " 41008 " name = " స ే వ ్ య ా స ్ . . . ( & amp ; A ) " / > <nl> + < Item id = " 41010 " name = " ప ్ ర ి ం ట ్ . . . " / > <nl> + < Item id = " 1001 " name = " ప ్ ర ి ం ట ్ న ౌ " / > <nl> + < Item id = " 41011 " name = " ఎగ ్ స ి ట ్ ( & amp ; X ) " / > <nl> + < Item id = " 41012 " name = " ల ో డ ్ స ె షన ్ . . . " / > <nl> + < Item id = " 41013 " name = " స ే వ ్ స ె షన ్ . . . " / > <nl> + < Item id = " 41014 " name = " ర ీ ల ో డ ్ ఫ ్ రమ ్ డ ి స ్ క ్ " / > <nl> + < Item id = " 41015 " name = " స ే వ ్ ఏ క ా ప ీ య ా స ్ . . . " / > <nl> + < Item id = " 41016 " name = " డ ె ల ీ ట ్ ఫ ్ రమ ్ డ ి స ్ క ్ " / > <nl> + < Item id = " 41017 " name = " ర ీ న ే మ ్ . . . " / > <nl> + < Item id = " 42001 " name = " కట ్ ( & amp ; T ) " / > <nl> + < Item id = " 42002 " name = " క ా ప ీ ( & amp ; C ) " / > <nl> + < Item id = " 42003 " name = " అ ం డ ూ ( & amp ; U ) " / > <nl> + < Item id = " 42004 " name = " ర ి డ ూ ( & amp ; R ) " / > <nl> + < Item id = " 42005 " name = " ప ే స ్ ట ్ ( & amp ; P ) " / > <nl> + < Item id = " 42006 " name = " డ ె ల ీ ట ్ ( & amp ; D ) " / > <nl> + < Item id = " 42007 " name = " స ె ల ె క ్ ట ్ ఆల ్ ( & amp ; L ) " / > <nl> + < Item id = " 42008 " name = " ఇన ్ ‌ క ్ ర ీ స ్ ల ై న ్ ఇన ్ ‌ డ ె ం ట ్ " / > <nl> + < Item id = " 42009 " name = " డ ి క ్ ర ీ స ్ ల ై న ్ ఇన ్ ‌ డ ె ం ట ్ " / > <nl> + < Item id = " 42010 " name = " డ ్ య ూ ప ్ ల ి క ే ట ్ కర ె ం ట ్ ల ై న ్ " / > <nl> + < Item id = " 42012 " name = " స ్ ప ్ ల ి ట ్ ల ై న ్ స ్ " / > <nl> + < Item id = " 42013 " name = " జ ా ఇన ్ ల ై న ్ స ్ " / > <nl> + < Item id = " 42014 " name = " మ ూ వ ్ అప ్ కర ె ం ట ్ ల ై న ్ " / > <nl> + < Item id = " 42015 " name = " మ ూ వ ్ డ ౌ న ్ కర ె ం ట ్ ల ై న ్ " / > <nl> + < Item id = " 42016 " name = " అప ్ పర ్ ‌ క ే స ్ " / > <nl> + < Item id = " 42017 " name = " ల ో వ ె ర ్ కస ే " / > <nl> + < Item id = " 42018 " name = " స ్ ట ా ర ్ ట ్ ర ె క ా ర ్ డ ి ం గ ్ ( & amp ; S ) " / > <nl> + < Item id = " 42019 " name = " స ్ ట ా ప ్ ర ె క ా ర ్ డ ి ం గ ్ ( & amp ; S ) " / > <nl> + < Item id = " 42021 " name = " ప ్ ల ే బ ్ య ా క ్ ( & amp ; P ) " / > <nl> + < Item id = " 42022 " name = " ట ా గల ్ బ ్ ల ా క ్ క ా మ ె ం ట ్ " / > <nl> + < Item id = " 42023 " name = " స ్ ట ్ ర ీ మ ్ క ా మ ె ం ట ్ " / > <nl> + < Item id = " 42042 " name = " ట ్ ర ి మ ్ ల ీ డ ి ం గ ్ స ్ ప ే స ్ " / > <nl> + < Item id = " 42043 " name = " ట ్ ర ి మ ్ ల ీ డ ి ం గ ్ అ ం డ ్ ట ్ ర ే ల ి ం గ ్ స ్ ప ే స ్ " / > <nl> + < Item id = " 42044 " name = " ఈఓఎల ్ ట ు స ్ ప ే స ్ " / > <nl> + < Item id = " 42045 " name = " ర ి మ ూ వ ్ అన ్ న ె స ె సర ీ బ ్ ల ్ య ా ం క ్ అ ం డ ్ ఈఓఎల ్ " / > <nl> + < Item id = " 42046 " name = " ట ్ య ా బ ్ ట ు స ్ ప ే స ్ " / > <nl> + < Item id = " 42047 " name = " స ్ ప ే స ్ ట ు ట ్ య ా బ ్ " / > <nl> + < Item id = " 42024 " name = " ట ్ ర ి మ ్ ట ్ ర ే ల ి ం గ ్ స ్ ప ే స ్ " / > <nl> + < Item id = " 42025 " name = " స ే వ ్ కర ె ం ట ్ ల ీ ర ె క ా ర ్ డ ె డ ్ మ ్ య ా క ్ ర ో " / > <nl> + < Item id = " 42026 " name = " ట ె క ్ స ్ ట ్ డ ై ర ె క ్ షన ్ ఆర ్ ట ీ ఎల ్ " / > <nl> + < Item id = " 42027 " name = " ట ె క ్ స ్ ట ్ డ ై ర ె క ్ షన ్ ఎల ్ ట ీ ఆర ్ " / > <nl> + < Item id = " 42028 " name = " స ె ట ్ ర ీ డ ్ - ఓన ్ ల ీ " / > <nl> + < Item id = " 42029 " name = " కర ె ం ట ్ ఫ ై ల ్ ప ా త ్ ట ు క ్ ల ి ప ్ ‌ బ ో ర ్ డ ్ " / > <nl> + < Item id = " 42030 " name = " కర ె ం ట ్ ఫ ై ల ్ ‌ న ే మ ్ ట ు క ్ ల ి ప ్ ‌ బ ో ర ్ డ ్ " / > <nl> + < Item id = " 42031 " name = " కర ె ం ట ్ డ ై ర ్ . ప ా త ్ ట ు క ్ ల ి ప ్ ‌ బ ో ర ్ డ ్ " / > <nl> + < Item id = " 42032 " name = " రన ్ ఏ మ ్ య ా క ్ ర ో మల ్ ట ి పల ్ ట ై మ ్ స ్ . . . " / > <nl> + < Item id = " 42033 " name = " క ్ ల ి యర ్ ర ీ డ ్ - ఓన ్ ల ీ ఫ ్ ల ా గ ్ " / > <nl> + < Item id = " 42035 " name = " బ ్ ల ా క ్ క ా మ ె ం ట ్ " / > <nl> + < Item id = " 42036 " name = " బ ్ ల ా క ్ అన ్ ‌ కమ ె ం ట ్ " / > <nl> + < Item id = " 43001 " name = " ఫ ై ం డ ్ . . . ( & amp ; F ) " / > <nl> + < Item id = " 43002 " name = " ఫ ై ం డ ్ న ె క ్ స ్ ట ్ ( & amp ; N ) " / > <nl> + < Item id = " 43003 " name = " ర ీ ప ్ ల ే స ్ . . . " / > <nl> + < Item id = " 43004 " name = " గ ో ట ు . . . " / > <nl> + < Item id = " 43005 " name = " ట ా గల ్ బ ు క ్ ‌ మ ా ర ్ క ్ " / > <nl> + < Item id = " 43006 " name = " న ె క ్ స ్ ట ్ బ ు క ్ ‌ మ ా ర ్ క ్ " / > <nl> + < Item id = " 43007 " name = " ప ్ ర ీ వ ి యస ్ బ ు క ్ ‌ మ ా ర ్ క ్ " / > <nl> + < Item id = " 43008 " name = " క ్ ల ి యర ్ ఆల ్ బ ు క ్ ‌ మర ్ క ్ స ్ " / > <nl> + < Item id = " 43009 " name = " గ ో ట ు మ ్ య ా చ ి ం గ ్ బ ్ ర ే స ్ " / > <nl> + < Item id = " 43010 " name = " ఫ ై ం డ ్ ప ్ ర ీ వ ి యస ్ " / > <nl> + < Item id = " 43011 " name = " ఇ ం క ్ ర ి మ ె ం టల ్ సర ్ చ ్ ( & amp ; I ) " / > <nl> + < Item id = " 43013 " name = " ఫ ై ం డ ్ ఇన ్ ఫ ై ల ్ స ్ " / > <nl> + < Item id = " 43014 " name = " ఫ ై ం డ ్ ( వ ొ లట ై ల ్ ) న ె క ్ స ్ ట ్ " / > <nl> + < Item id = " 43015 " name = " ఫ ై ం డ ్ ( వ ొ లట ై ల ్ ) ప ్ ర ీ వ ి యస ్ " / > <nl> + < Item id = " 43016 " name = " మ ా ర ్ క ్ ఆల ్ " / > <nl> + < Item id = " 43017 " name = " అన ్ ‌ మ ా ర ్ క ్ ఆల ్ " / > <nl> + < Item id = " 43018 " name = " కట ్ బ ు క ్ ‌ మ ా ర ్ క ్ డ ్ ల ై న ్ స ్ " / > <nl> + < Item id = " 43019 " name = " క ా ప ీ బ ు క ్ ‌ మ ా ర ్ క ్ డ ్ ల ై న ్ స ్ " / > <nl> + < Item id = " 43020 " name = " ప ే స ్ ట ్ ట ు ( ర ీ ప ్ ల ే స ్ ) బ ు క ్ ‌ మ ా ర ్ క ్ డ ్ ల ై న ్ స ్ " / > <nl> + < Item id = " 43021 " name = " డ ె ల ీ ట ్ బ ు క ్ ‌ మ ా ర ్ క ్ డ ్ ల ై న ్ స ్ " / > <nl> + < Item id = " 43022 " name = " య ూ స ి ం గ ్ 1స ్ ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43023 " name = " క ్ ల ి యర ్ 1స ్ ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43024 " name = " య ూ స ి ం గ ్ 2న ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43025 " name = " క ్ ల ి యర ్ 2న ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43026 " name = " య ూ స ి ం గ ్ 3ర ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43027 " name = " క ్ ల ి యర ్ 3ర ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43028 " name = " య ూ స ి ం గ ్ 4త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43029 " name = " క ్ ల ి యర ్ 4త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43030 " name = " య ూ స ి ం గ ్ 5త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43031 " name = " క ్ ల ి యర ్ 5త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43032 " name = " క ్ ల ి యర ్ ఆల ్ స ్ ట ై ల ్ స ్ " / > <nl> + < Item id = " 43033 " name = " 1స ్ ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43034 " name = " 2న ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43035 " name = " 3ర ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43036 " name = " 4త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43037 " name = " 5త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43038 " name = " ఫ ై ం డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43039 " name = " 1స ్ ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43040 " name = " 2న ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43041 " name = " 3ర ్ డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43042 " name = " 4త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43043 " name = " 5త ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43044 " name = " ఫ ై ం డ ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 43045 " name = " సర ్ చ ్ ర ి సల ్ ట ్ స ్ వ ి ం డ ొ " / > <nl> + < Item id = " 43046 " name = " న ె క ్ స ్ ట ్ సర ్ చ ్ ర ి సల ్ ట ్ " / > <nl> + < Item id = " 43047 " name = " ప ్ ర ీ వ ి యస ్ సర ్ చ ్ ర ి సల ్ ట ్ " / > <nl> + < Item id = " 43048 " name = " స ె ల ె క ్ ట ్ అ ం డ ్ ఫ ై ం డ ్ న ె క ్ స ్ ట ్ " / > <nl> + < Item id = " 43049 " name = " స ె ల ె క ్ ట ్ అ ం డ ్ ఫ ై ం డ ్ ప ్ ర ీ వ ి యస ్ " / > <nl> + < Item id = " 43050 " name = " ఇన ్ ‌ వర ్ స ్ బ ు క ్ ‌ మ ా ర ్ క ్ " / > <nl> + < Item id = " 44009 " name = " ప ో స ్ ట ్ - ఇట ్ " / > <nl> + < Item id = " 44010 " name = " ఫ ో ల ్ డ ్ ఆల ్ " / > <nl> + < Item id = " 44011 " name = " య ూ సర ్ - డ ి ఫ ై ం డ ్ డ ై ల ా గ ్ . . . " / > <nl> + < Item id = " 44019 " name = " ష ో ఆల ్ క ్ య ా ర ె క ్ టర ్ స ్ " / > <nl> + < Item id = " 44020 " name = " ష ో ఇన ్ ‌ డ ె ం ట ్ గ ై డ ్ " / > <nl> + < Item id = " 44022 " name = " ర ్ య ా ప ్ " / > <nl> + < Item id = " 44023 " name = " జ ూ మ ్ ఇన ్ క ం ట ్ ర ో ల ్ + మ ౌ స ్ వ ీ ల ్ అప ్ ( & amp ; I ) " / > <nl> + < Item id = " 44024 " name = " జ ూ మ ్ ఔట ్ క ం ట ్ ర ో ల ్ + మ ౌ స ్ వ ీ ల ్ డ ౌ న ్ ( & amp ; O ) " / > <nl> + < Item id = " 44025 " name = " ష ో వ ై ట ్ స ్ ప ే స ్ అ ం డ ్ ట ్ య ా బ ్ " / > <nl> + < Item id = " 44026 " name = " ష ో ఎ ం డ ్ ఆఫ ్ ల ై న ్ " / > <nl> + < Item id = " 44029 " name = " అన ్ ‌ ఫ ో ల ్ డ ్ ఆల ్ " / > <nl> + < Item id = " 44030 " name = " క ొ ల ్ య ా ప ్ స ్ కర ె ం ట ్ ల ె వ ె ల ్ " / > <nl> + < Item id = " 44031 " name = " అన ్ ‌ క ో ల ్ య ా ప ్ స ్ కర ె ం ట ్ ల ె వ ె ల ్ " / > <nl> + < Item id = " 44032 " name = " ట ా గల ్ ఫ ు ల ్ స ్ క ్ ర ీ న ్ మ ో డ ్ " / > <nl> + < Item id = " 44033 " name = " ర ి స ్ ట ో ర ్ డ ి ఫ ా ల ్ ట ్ జ ూ మ ్ " / > <nl> + < Item id = " 44034 " name = " ఆల ్ వ ే స ్ ఆన ్ ట ా ప ్ " / > <nl> + < Item id = " 44049 " name = " సమ ్ మర ీ . . . " / > <nl> + < Item id = " 44035 " name = " స ి ం క ్ ర ో న ై స ్ వర ్ ట ి కల ్ స ్ క ్ ర ో ల ి ం గ ్ " / > <nl> + < Item id = " 44036 " name = " స ి ం క ్ ర ో న ై స ్ హ ా ర ి స ా ం టల ్ స ్ క ్ ర ో ల ి ం గ ్ " / > <nl> + < Item id = " 44041 " name = " ష ో ర ్ య ా ప ్ స ి ం బల ్ " / > <nl> + < Item id = " 44072 " name = " ఫ ో కస ్ ఆన ్ అనదర ్ వ ్ య ూ " / > <nl> + < Item id = " 45001 " name = " క ొ న ్ వ ె ర ్ ట ట ు వ ి ం డ ొ స ్ ఫ ా ర ్ మ ్ య ా ట ్ " / > <nl> + < Item id = " 45002 " name = " క ొ న ్ వ ె ర ్ ట ట ు య ూ న ి క ్ స ్ ఫ ా ర ్ మ ్ య ా ట ్ " / > <nl> + < Item id = " 45003 " name = " క ొ న ్ వ ె ర ్ ట ట ు మ ్ య ా క ్ ఫ ా ర ్ మ ్ య ా ట ్ " / > <nl> + < Item id = " 45004 " name = " ఎన ్ ‌ క ో డ ్ ఇన ్ ఆన ్ స ి " / > <nl> + < Item id = " 45005 " name = " ఎన ్ ‌ క ో డ ్ ఇన ్ య ూ ట ీ ఎఫ ్ - 8 " / > <nl> + < Item id = " 45006 " name = " ఎన ్ ‌ క ో డ ్ ఇన ్ య ూ స ీ ఎస ్ - 2 బ ి గ ్ ఎన ్ డ ీ యన ్ " / > <nl> + < Item id = " 45007 " name = " ఎన ్ ‌ క ో డ ్ ఇన ్ య ూ స ీ ఎస ్ - 2 ల ి ట ్ ల ్ ఎన ్ డ ీ యన ్ " / > <nl> + < Item id = " 45008 " name = " ఎన ్ ‌ క ో డ ్ ఇన ్ య ూ ట ీ ఎఫ ్ - 8 వ ి ద ౌ ట ్ బ ా మ ్ " / > <nl> + < Item id = " 45009 " name = " క ొ న ్ వ ె ర ్ ట ట ు ఆన ్ స ి " / > <nl> + < Item id = " 45010 " name = " క ొ న ్ వ ె ర ్ ట ట ు య ూ ట ీ ఎఫ ్ - 8 వ ి ద ౌ ట ్ బ ా మ ్ " / > <nl> + < Item id = " 45011 " name = " క ొ న ్ వ ె ర ్ ట ట ు య ూ ట ీ ఎఫ ్ - 8 " / > <nl> + < Item id = " 45012 " name = " క ొ న ్ వ ె ర ్ ట ట ు య ూ స ీ ఎస ్ - 2 బ ి గ ్ ఎన ్ డ ీ యన ్ " / > <nl> + < Item id = " 45013 " name = " క ొ న ్ వ ె ర ్ ట ట ు య ూ స ీ ఎస ్ - 2 ల ి ట ్ ల ్ ఎన ్ డ ీ యన ్ " / > <nl> + < Item id = " 10001 " name = " మ ూ వ ్ ట ు అదర ్ వ ్ య ూ " / > <nl> + < Item id = " 10002 " name = " క ్ ల ో న ్ ట ు అదర ్ వ ్ య ూ " / > <nl> + < Item id = " 10003 " name = " మ ూ వ ్ ట ు న ్ య ూ ఇన ్ స ్ ట ె న ్ స ్ " / > <nl> + < Item id = " 10004 " name = " ఓప ె న ్ ఇన ్ న ్ య ూ ఇన ్ స ్ ట ె న ్ స ్ " / > <nl> + < Item id = " 46001 " name = " స ్ ట ై ల ్ క ా న ్ ‌ ఫ ి గర ే టర ్ . . . " / > <nl> + < Item id = " 46080 " name = " య ూ సర ్ - డ ి ఫ ై ం డ ్ " / > <nl> + < Item id = " 47000 " name = " అబ ౌ ట ్ న ో ట ్ ప ్ య ా డ ్ + + . . . " / > <nl> + < Item id = " 47001 " name = " న ో ట ్ ప ్ య ా డ ్ + + హ ో మ ్ " / > <nl> + < Item id = " 47002 " name = " న ో ట ్ ప ్ య ా డ ్ + + ప ్ ర ా జ ె క ్ ట ్ ప ే జ ్ " / > <nl> + < Item id = " 47003 " name = " ఆన ్ ‌ ల ై న ్ డ ా క ్ య ు మ ె ం ట ే షన ్ " / > <nl> + < Item id = " 47004 " name = " ఫ ో రమ ్ " / > <nl> + < Item id = " 47005 " name = " గ ె ట ్ మ ో ర ే ప ్ లగ ి న ్ స ్ " / > <nl> + < Item id = " 47006 " name = " అప ్ ‌ డ ే ట ్ న ో ట ్ ప ్ య ా డ ్ + + " / > <nl> + < Item id = " 47008 " name = " హ ె ల ్ ప ్ క ా ం ట ె ం ట ్ స ్ " / > <nl> + < Item id = " 48005 " name = " ఇ ం ప ో ర ్ ట ్ ప ్ లగ ి న ్ ( శ ్ ) . . . " / > <nl> + < Item id = " 48006 " name = " ఇ ం ప ో ర ్ ట ్ థ ీ మ ్ ( శ ్ ) " / > <nl> + < Item id = " 48009 " name = " ష ా ర ్ ట ్ ‌ కట ్ మ ్ య ా పర ్ . . . " / > <nl> + < Item id = " 48011 " name = " ప ్ ర ి ఫర ె న ్ సస ్ . . . " / > <nl> + < Item id = " 49000 " name = " రన ్ . . . ( & amp ; R ) " / > <nl> + < Item id = " 50000 " name = " ఫ ం క ్ షన ్ క ం ప ్ ల ీ షన ్ " / > <nl> + < Item id = " 50001 " name = " వర ్ డ ్ క ం ప ్ ల ీ షన ్ " / > <nl> + < Item id = " 50002 " name = " ఫ ం క ్ షన ్ ప ్ య ా రమ ీ టర ్ స ్ హ ి ం ట ్ " / > <nl> + < Item id = " 42034 " name = " క ా లమ ్ ఎడ ి టర ్ . . . " / > <nl> + < Item id = " 44042 " name = " హ ై డ ్ ల ై న ్ స ్ " / > <nl> + < Item id = " 42040 " name = " ఓప ె న ్ ఆల ్ ర ీ స ె ం ట ్ ఫ ై ల ్ స ్ " / > <nl> + < Item id = " 42041 " name = " ఎ ం ప ్ ట ీ ర ీ స ె ం ట ్ ఫ ై ల ్ స ్ ల ి స ్ ట ్ " / > <nl> + < Item id = " 48016 " name = " మ ా డ ి ఫ ై ష ా ర ్ ట ్ ‌ కట ్ / డ ె ల ీ ట ్ మ ్ య ా క ్ ర ో . . . " / > <nl> + < Item id = " 48017 " name = " మ ా డ ి ఫ ై ష ా ర ్ ట ్ ‌ కట ్ / డ ె ల ీ ట ్ కమ ్ య ా ం డ ్ . . . " / > <nl> + < Item id = " 48018 " name = " ఎడ ి ట ్ ప ో ప ్ అప ్ క ా ం ట ె క ్ స ్ ట ్ మ ె న ూ " / > <nl> + < / Commands > <nl> + < / Main > <nl> + < Splitter > <nl> + < / Splitter > <nl> + < TabBar > <nl> + < Item order = " 0 " name = " క ్ ల ో స ్ " / > <nl> + < Item order = " 1 " name = " క ్ ల ో స ్ ఆల ్ బట ్ ద ి స ్ " / > <nl> + < Item order = " 2 " name = " స ే వ ్ " / > <nl> + < Item order = " 3 " name = " స ే వ ్ య ్ య ా స ్ . . . " / > <nl> + < Item order = " 4 " name = " ప ్ ర ి ం ట ్ " / > <nl> + < Item order = " 5 " name = " మ ూ వ ్ ట ు అదర ్ వ ్ య ూ " / > <nl> + < Item order = " 6 " name = " క ్ ల ో న ్ ట ు అదర ్ వ ్ య ూ " / > <nl> + < Item order = " 7 " name = " ఫ ు ల ్ ఫ ై ల ్ ప ా త ్ ట ు క ్ ల ి ప ్ ‌ బ ో ర ్ డ ్ " / > <nl> + < Item order = " 8 " name = " ఫ ై ల ్ ‌ న ే మ ్ ట ు క ్ ల ి ప ్ ‌ బ ో ర ్ డ ్ " / > <nl> + < Item order = " 9 " name = " కర ె ం ట ్ డ ై ర ్ . ప ా త ్ ట ు క ్ ల ి ప ్ ‌ బ ో ర ్ డ ్ " / > <nl> + < Item order = " 10 " name = " ర ి న ే మ ్ " / > <nl> + < Item order = " 11 " name = " డ ె ల ీ ట ్ " / > <nl> + < Item order = " 12 " name = " ర ీ డ ్ - ఓన ్ ల ీ " / > <nl> + < Item order = " 13 " name = " క ్ ల ి యర ్ ర ీ డ ్ - ఓన ్ ల ీ ఫ ్ ల ా గ ్ " / > <nl> + < Item order = " 14 " name = " మ ూ వ ్ ట ు న ్ య ూ ఇన ్ స ్ ట ె న ్ స ్ " / > <nl> + < Item order = " 15 " name = " ఓప ె న ్ ఇన ్ న ్ య ూ ఇన ్ స ్ ట ె న ్ స ్ " / > <nl> + < / TabBar > <nl> + < / Menu > <nl> + < Dialog > <nl> + < Find title = " " titleFind = " ఫ ై ం డ ్ " titleReplace = " ర ీ ప ్ ల ే స ్ " titleFindInFiles = " ఫ ై ం డ ్ ఇన ్ ఫ ై ల ్ స ్ " titleMark = " మ ా ర ్ క ్ " > <nl> + < Item id = " 1 " name = " ఫ ై ం డ ్ న ె క ్ స ్ ట ్ " / > <nl> + < Item id = " 2 " name = " క ్ ల ో జ ్ " / > <nl> + < Item id = " 1620 " name = " ఫ ై ం డ ్ వ ా ట ్ : " / > <nl> + < Item id = " 1603 " name = " మ ్ య ా చ ్ హ ో ల ్ వర ్ డ ్ ఓన ్ ల ీ ( & amp ; W ) " / > <nl> + < Item id = " 1604 " name = " మ ్ య ా చ ్ క ే స ్ ( & amp ; C ) " / > <nl> + < Item id = " 1605 " name = " ర ె గ ్ య ు లర ్ ఎక ్ స ్ ‌ ప ్ ర ె షన ్ ( & amp ; E ) " / > <nl> + < Item id = " 1606 " name = " ర ్ య ా ప ్ అర ౌ ం డ ్ ( & amp ; D ) " / > <nl> + < Item id = " 1612 " name = " అప ్ ( & amp ; U ) " / > <nl> + < Item id = " 1613 " name = " డ ౌ న ్ ( & amp ; D ) " / > <nl> + < Item id = " 1614 " name = " క ౌ ం ట ్ " / > <nl> + < Item id = " 1615 " name = " ఫ ై ం డ ్ ఆల ్ " / > <nl> + < Item id = " 1616 " name = " మ ా ర ్ క ్ ల ై న ్ " / > <nl> + < Item id = " 1617 " name = " స ్ ట ై ల ్ ఫ ౌ ం డ ్ ట ో క ె న ్ " / > <nl> + < Item id = " 1618 " name = " పర ్ జ ్ ఫ ో ర ్ ఈచ ్ సర ్ చ ్ " / > <nl> + < Item id = " 1621 " name = " డ ై ర ె క ్ షన ్ " / > <nl> + < Item id = " 1611 " name = " ర ీ ప ్ ల ే స ్ వ ి త ్ ( & amp ; P ) : " / > <nl> + < Item id = " 1608 " name = " ర ీ ప ్ ల ే స ్ ( & amp ; R ) " / > <nl> + < Item id = " 1609 " name = " ర ీ ప ్ ల ే స ్ ఆల ్ ( & amp ; A ) " / > <nl> + < Item id = " 1623 " name = " ట ్ ర ్ య ా న ్ స ్ పర ె న ్ స ీ " / > <nl> + < Item id = " 1687 " name = " ఆన ్ ల ూ స ి ం గ ్ ఫ ో కస ్ " / > <nl> + < Item id = " 1688 " name = " ఆల ్ వ ే స ్ " / > <nl> + < Item id = " 1632 " name = " ఇన ్ స ె ల ె క ్ షన ్ " / > <nl> + < Item id = " 1633 " name = " క ్ ల ి యర ్ " / > <nl> + < Item id = " 1635 " name = " ర ీ ప ్ ల ే స ్ ఆల ్ ఇన ్ ఆల ్ ఓప ె న ె డ ్ డ ా క ్ య ు మ ె ం ట ్ స ్ " / > <nl> + < Item id = " 1636 " name = " ఫ ై ం డ ్ ఆల ్ ఇన ్ ఆల ్ ఓప ె న ె డ ్ డ ా క ్ య ు మ ె ం ట ్ స ్ " / > <nl> + < Item id = " 1637 " name = " ఫ ై ం డ ్ ఇన ్ ఫ ై ల ్ స ్ " / > <nl> + < Item id = " 1654 " name = " ఫ ి ల ్ ‌ టర ్ స ్ : " / > <nl> + < Item id = " 1655 " name = " డ ై ర ె క ్ టర ీ : " / > <nl> + < Item id = " 1656 " name = " ఫ ై ం డ ్ ఆల ్ " / > <nl> + < Item id = " 1658 " name = " ఇన ్ ఆల ్ సబ ్ - ఫ ో ల ్ డర ్ స ్ " / > <nl> + < Item id = " 1659 " name = " ఇన ్ హ ి డన ్ ఫ ో ల ్ డర ్ స ్ " / > <nl> + < Item id = " 1624 " name = " సర ్ చ ్ మ ో డ ్ " / > <nl> + < Item id = " 1625 " name = " న ా ర ్ మల ్ " / > <nl> + < Item id = " 1626 " name = " ఎక ్ స ్ ‌ ట ె ం డ ె డ ్ ( \ n , \ r , \ t , \ 0 , \ x . . . ) " / > <nl> + < Item id = " 1660 " name = " ర ీ ప ్ ల ే స ్ ఇన ్ ఫ ై ల ్ స ్ " / > <nl> + < Item id = " 1661 " name = " ఫ ా ల ొ కర ె ం ట ్ డ ా క ్ . " / > <nl> + < Item id = " 1641 " name = " ఫ ై ం డ ్ ఆల ్ ఇన ్ కర ె ం ట ్ డ ా క ్ య ు మ ె ం ట ్ " / > <nl> + < Item id = " 1686 " name = " ట ్ ర ్ య ా న ్ స ్ పర ె న ్ స ీ " / > <nl> + < / Find > <nl> + < GoToLine title = " గ ో ట ు . . . " > <nl> + < Item id = " 2007 " name = " ల ై న ్ " / > <nl> + < Item id = " 2008 " name = " ఆఫ ్ ‌ స ె ట ్ " / > <nl> + < Item id = " 1 " name = " గ ో ( & amp ; G ) " / > <nl> + < Item id = " 2 " name = " ఐ ' మ ్ గ ో ఇ ం గ ్ న ో వ ే ర ్ " / > <nl> + < Item id = " 2004 " name = " య ూ ఆర ్ హ ి యర ్ : " / > <nl> + < Item id = " 2005 " name = " య ూ వ ా ం ట ్ ట ు గ ో ట ు : " / > <nl> + < Item id = " 2006 " name = " య ూ క ్ య ా న ్ ' ట ్ గ ో ఫర ్ దర ్ ద ్ య ా న ్ : " / > <nl> + < / GoToLine > <nl> + < Run title = " రన ్ . . . " > <nl> + < Item id = " 1903 " name = " ద ప ్ ర ో గ ్ ర ా మ ్ ట ు రన ్ " / > <nl> + < Item id = " 1 " name = " రన ్ " / > <nl> + < Item id = " 2 " name = " క ్ య ా న ్ సల ్ " / > <nl> + < Item id = " 1904 " name = " స ే వ ్ . . . " / > <nl> + < / Run > <nl> + < StyleConfig title = " స ్ ట ై ల ్ క ా న ్ ‌ ఫ ి గర ే టర ్ " > <nl> + < Item id = " 2 " name = " క ్ య ా న ్ సల ్ " / > <nl> + < Item id = " 2301 " name = " స ే వ ్ & amp ; & amp ; క ్ ల ో స ్ " / > <nl> + < Item id = " 2303 " name = " ట ్ ర ్ య ా న ్ స ్ పర ె న ్ స ీ " / > <nl> + < Item id = " 2306 " name = " స ె ల ె క ్ ట ్ థ ీ మ ్ : " / > <nl> + < SubDialog > <nl> + < Item id = " 2204 " name = " బ ో ల ్ డ ్ " / > <nl> + < Item id = " 2205 " name = " ఇట ా ల ి క ్ " / > <nl> + < Item id = " 2206 " name = " ఫ ో ర ్ ‌ గ ్ ర ౌ ం డ ్ కలర ్ " / > <nl> + < Item id = " 2207 " name = " బ ్ య ా క ్ ‌ గ ్ ర ౌ ం డ ్ కలర ్ " / > <nl> + < Item id = " 2208 " name = " ఫ ా ం ట ్ న ే మ ్ : " / > <nl> + < Item id = " 2209 " name = " ఫ ా ం ట ్ స ై జ ్ : : " / > <nl> + < Item id = " 2212 " name = " కలర ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 2213 " name = " ఫ ా ం ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 2214 " name = " డ ి ఫ ా ల ్ ట ్ ఎక ్ స ్ ట ్ . : " / > <nl> + < Item id = " 2216 " name = " య ూ సర ్ ఎక ్ స ్ ట ్ . : " / > <nl> + < Item id = " 2218 " name = " అ ం డర ్ ‌ ల ై న ్ " / > <nl> + < Item id = " 2219 " name = " డ ి ఫ ా ల ్ ట ్ క ీ వర ్ డ ్ స ్ " / > <nl> + < Item id = " 2221 " name = " య ూ సర ్ - డ ి ఫ ై ం డ ్ క ీ వర ్ డ ్ స ్ " / > <nl> + < Item id = " 2225 " name = " ల ్ య ా ం గ ్ వ ే జ ్ : " / > <nl> + < Item id = " 2226 " name = " ఎన ే బల ్ గ ్ ల ో బల ్ ఫ ో ర ్ ‌ గ ్ ర ౌ ం డ ్ కలర ్ " / > <nl> + < Item id = " 2227 " name = " ఎన ే బల ్ గ ్ ల ో బల ్ బ ్ య ా క ్ ‌ గ ్ ర ౌ ం డ ్ కలర ్ " / > <nl> + < Item id = " 2228 " name = " ఎన ే బల ్ గ ్ ల ో బల ్ ఫ ా ం ట ్ " / > <nl> + < Item id = " 2229 " name = " ఎన ే బల ్ గ ్ ల ో బల ్ ఫ ా ం ట ్ స ై జ ్ " / > <nl> + < Item id = " 2230 " name = " ఎన ే బల ్ గ ్ ల ో బల ్ బ ో ల ్ డ ్ ఫ ా ం ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 2231 " name = " ఎన ే బల ్ గ ్ ల ో బల ్ ఇట ా ల ి క ్ ఫ ా ం ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 2232 " name = " ఎన ే బల ్ గ ్ ల ో బల ్ అ ం డర ్ ‌ ల ై న ్ ఫ ా ం ట ్ స ్ ట ై ల ్ " / > <nl> + < / SubDialog > <nl> + < / StyleConfig > <nl> + < UserDefine title = " య ూ సర ్ - డ ి ఫ ై ం డ ్ " > <nl> + < Item id = " 20002 " name = " ర ీ న ే మ ్ " / > <nl> + < Item id = " 20003 " name = " క ్ ర ి య ే ట ్ న ్ య ూ . . . " / > <nl> + < Item id = " 20004 " name = " ర ి మ ూ వ ్ " / > <nl> + < Item id = " 20005 " name = " స ే వ ్ య ా జ ్ . . . . . . " / > <nl> + < Item id = " 20007 " name = " య ూ సర ్ ల ్ య ా ం గ ్ వ ే జ ్ : " / > <nl> + < Item id = " 20009 " name = " ఎక ్ స ్ ట ్ . : " / > <nl> + < Item id = " 20012 " name = " ఇగ ్ న ో ర ్ క ే స ్ " / > <nl> + < Item id = " 20011 " name = " ట ్ ర ్ య ా న ్ స ్ పర ె న ్ స ీ " / > <nl> + < Item id = " 20016 " name = " ఇ ం ప ో ర ్ ట ్ . . . " / > <nl> + < Item id = " 20015 " name = " ఎక ్ స ్ ‌ ప ో ర ్ ట ్ . . . " / > <nl> + < Item id = " 0 " name = " కలర ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 1 " name = " ఫ ో ర ్ ‌ గ ్ ర ౌ ం డ ్ కలర ్ " / > <nl> + < Item id = " 2 " name = " బ ్ య ా క ్ ‌ గ ్ ర ౌ ం డ ్ కలర ్ " / > <nl> + < Item id = " 3 " name = " ఫ ా ం ట ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 4 " name = " ఫ ా ం ట ్ న ే మ ్ : " / > <nl> + < Item id = " 5 " name = " ఫ ా ం ట ్ స ై జ ్ : " / > <nl> + < Item id = " 6 " name = " బ ో ల ్ డ ్ " / > <nl> + < Item id = " 7 " name = " ఇట ా ల ి క ్ " / > <nl> + < Item id = " 8 " name = " అ ం డర ్ ‌ ల ై న ్ " / > <nl> + < Folder title = " ఫ ో ల ్ డర ్ & amp ; & amp ; డ ి ఫ ా ల ్ ట ్ " > <nl> + < Item id = " 21101 " name = " డ ి ఫ ా ల ్ ట ్ స ్ ట ై ల ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < Item id = " 21201 " name = " ఫ ో ల ్ డర ్ ఓప ె న ్ క ీ వర ్ డ ్ స ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < Item id = " 21301 " name = " ఫ ో ల ్ డర ్ క ్ ల ో స ్ క ీ వర ్ డ ్ స ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < / Folder > <nl> + < Keywords title = " క ీ వర ్ డ ్ స ్ ల ి స ్ ట ్ స ్ " > <nl> + < Item id = " 22101 " name = " 1స ్ ట ్ గ ్ ర ూ ప ్ " / > <nl> + < Item id = " 22201 " name = " 2న ్ డ ్ గ ్ ర ూ ప ్ " / > <nl> + < Item id = " 22301 " name = " 3ర ్ డ ్ గ ్ ర ూ ప ్ " / > <nl> + < Item id = " 22401 " name = " 4త ్ గ ్ ర ూ ప ్ " / > <nl> + < Item id = " 22113 " name = " ప ్ ర ీ ఫ ి క ్ స ్ మ ో డ ్ " / > <nl> + < Item id = " 22213 " name = " ప ్ ర ీ ఫ ి క ్ స ్ మ ో డ ్ " / > <nl> + < Item id = " 22313 " name = " ప ్ ర ీ ఫ ి క ్ స ్ మ ో డ ్ " / > <nl> + < Item id = " 22413 " name = " ప ్ ర ీ ఫ ి క ్ స ్ మ ో డ ్ " / > <nl> + < / Keywords > <nl> + < Comment title = " క ా మ ె ం ట ్ & amp ; & amp ; న ం బర ్ " > <nl> + < Item id = " 23301 " name = " క ా మ ె ం ట ్ ల ై న ్ " / > <nl> + < Item id = " 23101 " name = " క ా మ ె ం ట ్ బ ్ ల ా క ్ " / > <nl> + < Item id = " 23113 " name = " క ా మ ె ం ట ్ ఓప ె న ్ : " / > <nl> + < Item id = " 23115 " name = " క ా మ ె ం ట ్ క ్ ల ో జ ్ : " / > <nl> + < Item id = " 23116 " name = " ట ్ ర ీ ట ్ క ీ వర ్ డ ్ య ా జ ్ స ి ం బల ్ " / > <nl> + < Item id = " 23117 " name = " ట ్ ర ీ ట ్ క ీ వర ్ డ ్ స ్ య ా జ ్ స ి ం బల ్ స ్ " / > <nl> + < Item id = " 23201 " name = " న ం బర ్ " / > <nl> + < / Comment > <nl> + < Operator title = " ఆపర ే టర ్ స ్ " > <nl> + < Item id = " 24107 " name = " ఆపర ే టర ్ " / > <nl> + < Item id = " 24103 " name = " అవ ే లబల ్ స ి ం బల ్ స ్ " / > <nl> + < Item id = " 24101 " name = " ఆక ్ ట ీ వ ే ట ె డ ్ ఆపర ే టర ్ స ్ " / > <nl> + < Item id = " 24201 " name = " డ ీ ల ి మ ి టర ్ 1 " / > <nl> + < Item id = " 24211 " name = " బ ౌ ం డ ్ ర ీ ఓప ె న ్ : " / > <nl> + < Item id = " 24214 " name = " బ ౌ ం డ ్ ర ీ క ్ ల ో జ ్ : " / > <nl> + < Item id = " 24301 " name = " డ ీ ల ి మ ి టర ్ 2 " / > <nl> + < Item id = " 24311 " name = " బ ౌ ం డ ్ ర ీ ఓప ె న ్ : " / > <nl> + < Item id = " 24314 " name = " బ ౌ ం డ ్ ర ీ క ్ ల ో జ ్ : " / > <nl> + < / Operator > <nl> + < Item id = " 24001 " name = " ఎన ే బల ్ ఎస ్ క ే ప ్ క ్ య ా రక ్ టర ్ : " / > <nl> + < / UserDefine > <nl> + < Preference title = " ప ్ ర ి ఫర ె న ్ సస ్ " > <nl> + < Item id = " 6001 " name = " క ్ ల ో జ ్ " / > <nl> + < Global title = " జనరల ్ " > <nl> + < Item id = " 6101 " name = " ట ూ ల ్ ‌ బ ా ర ్ " / > <nl> + < Item id = " 6102 " name = " హ ై డ ్ " / > <nl> + < Item id = " 6103 " name = " స ్ మ ా ల ్ ఐక ా న ్ స ్ " / > <nl> + < Item id = " 6104 " name = " బ ి గ ్ ఐక ా న ్ స ్ " / > <nl> + < Item id = " 6105 " name = " స ్ ట ా ం డర ్ డ ్ ఐక ా న ్ స ్ " / > <nl> + < Item id = " 6106 " name = " ట ్ య ా బ ్ బ ా ర ్ " / > <nl> + < Item id = " 6107 " name = " ర ె డ ్ య ూ స ్ " / > <nl> + < Item id = " 6108 " name = " ల ా క ్ ( న ో డ ్ రగ ్ అ ం డ ్ డ ్ ర ా ప ్ ) " / > <nl> + < Item id = " 6109 " name = " డ ా ర ్ కన ్ ఇన ్ య ా క ్ ట ి వ ్ ట ్ య ా బ ్ స ్ " / > <nl> + < Item id = " 6110 " name = " డ ్ ర ా ఏ కలర ్ డ ్ బ ా ర ్ ఆన ్ ఆక ్ ట ి వ ్ ట ్ య ా బ ్ " / > <nl> + < Item id = " 6111 " name = " ష ో స ్ ట ే టస ్ బ ా ర ్ " / > <nl> + < Item id = " 6112 " name = " ష ో క ్ ల ో స ్ బటన ్ ఆన ్ ఈచ ్ ట ్ య ా బ ్ " / > <nl> + < Item id = " 6113 " name = " డబల ్ క ్ ల ి క ్ ట ు క ్ ల ో జ ్ డ ా క ్ య ు మ ె ం ట ్ " / > <nl> + < Item id = " 6118 " name = " హ ై డ ్ " / > <nl> + < Item id = " 6119 " name = " మల ్ ట ీ - ల ై న ్ " / > <nl> + < Item id = " 6120 " name = " వర ్ ట ి కల ్ " / > <nl> + < Item id = " 6121 " name = " మ ే న ు బ ా ర ్ " / > <nl> + < Item id = " 6122 " name = " హ ై డ ్ ( య ూ జ ్ అల ్ ట ్ ఆర ్ ఎఫ ్ 10 క ీ ట ు ట ా గల ్ ) " / > <nl> + < Item id = " 6123 " name = " ల ో కల ై స ే షన ్ " / > <nl> + < / Global > <nl> + < Scintillas title = " ఎడ ి ట ి ం గ ్ " > <nl> + < Item id = " 6216 " name = " క ా ర ె ట ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < Item id = " 6217 " name = " వ ి డ ్ త ్ : " / > <nl> + < Item id = " 6219 " name = " బ ్ ల ి ం క ్ ర ే ట ్ : " / > <nl> + < Item id = " 6221 " name = " ఎఫ ్ " / > <nl> + < Item id = " 6222 " name = " ఎస ్ " / > <nl> + < Item id = " 6224 " name = " మల ్ ట ీ - ఎడ ి ట ి ం గ ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < Item id = " 6225 " name = " ఎన ే బల ్ ( క ం ట ్ ర ో ల ్ + మ ౌ స ్ క ్ ల ి క ్ / స ె ల ె క ్ షన ్ ) " / > <nl> + < Item id = " 6201 " name = " ఫ ో ల ్ డర ్ మ ా ర ్ జ ి న ్ స ్ ట ై ల ్ " / > <nl> + < Item id = " 6202 " name = " స ి ం ప ు ల ్ " / > <nl> + < Item id = " 6203 " name = " య ా ర ో " / > <nl> + < Item id = " 6204 " name = " సర ్ కల ్ ట ్ ర ీ " / > <nl> + < Item id = " 6205 " name = " బ ా క ్ స ్ ట ్ ర ీ " / > <nl> + < Item id = " 6226 " name = " నన ్ " / > <nl> + < Item id = " 6227 " name = " ల ై న ్ ర ్ య ా ప ్ " / > <nl> + < Item id = " 6228 " name = " డ ి ఫ ా ల ్ ట ్ " / > <nl> + < Item id = " 6229 " name = " అల ై ం డ ్ " / > <nl> + < Item id = " 6230 " name = " ఇన ్ ‌ డ ె ం ట ్ " / > <nl> + < Item id = " 6206 " name = " డ ి స ్ ‌ ప ్ ల ే ల ై న ్ న ం బర ్ స ్ " / > <nl> + < Item id = " 6207 " name = " డ ి స ్ ‌ ప ్ ల ే బ ు క ్ ‌ మర ్ క ్ స ్ " / > <nl> + < Item id = " 6208 " name = " ష ో వర ్ ట ి కల ్ ఎడ ్ జ ్ " / > <nl> + < Item id = " 6209 " name = " న ం బర ్ ఒఫ ్ క ా లమ ్ స ్ : " / > <nl> + < Item id = " 6211 " name = " వర ్ ట ి కల ్ ఎడ ్ జ ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < Item id = " 6212 " name = " ల ై న ్ మ ో డ ్ " / > <nl> + < Item id = " 6213 " name = " బ ్ య ా క ్ ‌ గ ్ ర ౌ ం డ ్ మ ో డ ్ " / > <nl> + < Item id = " 6214 " name = " ఎన ే బల ్ కర ె ం ట ్ ల ై న ్ హ ై ల ై ట ి ం గ ్ " / > <nl> + < / Scintillas > <nl> + < NewDoc title = " న ్ య ూ డ ా క ్ య ు మ ె ం ట ్ / డ ి ఫ ా ల ్ ట ్ డ ై ర ె క ్ టర ీ " > <nl> + < Item id = " 6401 " name = " ఫ ా ర ్ మ ్ య ా ట ్ " / > <nl> + < Item id = " 6402 " name = " వ ి ం డ ొ స ్ " / > <nl> + < Item id = " 6403 " name = " య ూ న ి క ్ స ్ " / > <nl> + < Item id = " 6404 " name = " మ ్ య ా క ్ " / > <nl> + < Item id = " 6405 " name = " ఎన ్ ‌ క ో డ ి ం గ ్ " / > <nl> + < Item id = " 6406 " name = " ఆన ్ స ి " / > <nl> + < Item id = " 6407 " name = " య ూ ట ీ ఎఫ ్ - 8 వ ి ద ౌ ట ్ బ ా మ ్ " / > <nl> + < Item id = " 6408 " name = " య ూ ట ీ ఎఫ ్ - 8 " / > <nl> + < Item id = " 6409 " name = " య ూ స ీ ఎస ్ - 2 బ ి గ ్ ఎన ్ డ ీ యన ్ " / > <nl> + < Item id = " 6410 " name = " య ూ స ీ ఎస ్ - 2 ల ి ట ్ ల ్ ఎన ్ డ ీ యన ్ " / > <nl> + < Item id = " 6411 " name = " డ ి ఫ ా ల ్ ట ్ ల ్ య ా ం గ ్ వ ే జ ్ : " / > <nl> + < Item id = " 6413 " name = " డ ి ఫ ా ల ్ ట ్ డ ై ర ె క ్ టర ీ ( ఓప ె న ్ / స ే వ ్ ) " / > <nl> + < Item id = " 6414 " name = " ఫ ా ల ొ కర ె ం ట ్ డ ా క ్ య ు మ ె ం ట ్ " / > <nl> + < Item id = " 6415 " name = " ర ి మ ె ం బర ్ ల ా స ్ ట ్ య ూ స ్ డ ్ డ ై ర ె క ్ టర ీ " / > <nl> + < Item id = " 6419 " name = " న ్ య ూ డ ా క ్ య ు మ ె ం ట ్ " / > <nl> + < Item id = " 6420 " name = " అప ్ ల ై ట ు ఓప ం డ ్ ఆన ్ స ి ఫ ై ల ్ స ్ " / > <nl> + < / NewDoc > <nl> + < FileAssoc title = " ఫ ై ల ్ అస ో స ి య ే షన ్ " > <nl> + < Item id = " 4009 " name = " సప ో ర ్ ట ె డ ్ ఎక ్ స ్ ‌ ట ె న ్ షన ్ స ్ : " / > <nl> + < Item id = " 4010 " name = " ర ి జ ి స ్ టర ్ డ ్ ఎక ్ స ్ ‌ ట ె న ్ షన ్ స ్ : " / > <nl> + < / FileAssoc > <nl> + < LangMenu title = " ల ్ య ా ం గ ్ వ ే జ ్ మ ే న ు / ట ్ య ా బ ్ స ె ట ్ ట ి ం గ ్ స ్ " > <nl> + < Item id = " 6301 " name = " ట ్ య ా బ ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < Item id = " 6302 " name = " ర ీ ప ్ ల ే స ్ బ ై స ్ ప ే స ్ " / > <nl> + < Item id = " 6303 " name = " ట ్ య ా బ ్ స ై జ ్ : " / > <nl> + < Item id = " 6505 " name = " అవ ే లబల ్ ఐటమ ్ స ్ " / > <nl> + < Item id = " 6506 " name = " డ ి స ే బల ్ డ ్ ఐటమ ్ స ్ " / > <nl> + < Item id = " 6507 " name = " మ ే క ్ ల ్ య ా ం గ ్ వ ే జ ్ మ ే న ు క ా ం ప ్ య ా క ్ ట ్ " / > <nl> + < Item id = " 6508 " name = " ల ్ య ా ం గ ్ వ ే జ ్ మ ే న ు " / > <nl> + < Item id = " 6510 " name = " య ూ స ్ డ ి ఫ ా ల ్ ట ్ వ ్ య ా ల ్ య ూ " / > <nl> + < / LangMenu > <nl> + < Print title = " ప ్ ర ి ం ట ్ " > <nl> + < Item id = " 6601 " name = " ప ్ ర ి ం ట ్ ల ై న ్ న ం బర ్ " / > <nl> + < Item id = " 6602 " name = " కలర ్ ఆప ్ షన ్ స ్ " / > <nl> + < Item id = " 6603 " name = " WYSIWYG " / > <nl> + < Item id = " 6604 " name = " ఇన ్ ‌ వర ్ ట ్ " / > <nl> + < Item id = " 6605 " name = " బ ్ ల ్ య ా క ్ ఆన ్ వ ై ట ్ " / > <nl> + < Item id = " 6606 " name = " న ో బ ్ య ా క ్ ‌ గ ్ ర ౌ ం డ ్ కలర ్ " / > <nl> + < Item id = " 6607 " name = " మ ా ర ్ జ ్ స ె ట ్ ట ి ం గ ్ స ్ ( య ూ న ి ట ్ : ఎమ ్ ఎమ ్ ) " / > <nl> + < Item id = " 6612 " name = " ల ె ఫ ్ ట ్ " / > <nl> + < Item id = " 6613 " name = " ట ా ప ్ " / > <nl> + < Item id = " 6614 " name = " ర ై ట ్ " / > <nl> + < Item id = " 6615 " name = " బ ా టమ ్ " / > <nl> + < Item id = " 6706 " name = " బ ో ల ్ డ ్ " / > <nl> + < Item id = " 6707 " name = " ఐట ్ య ా ల ి క ్ " / > <nl> + < Item id = " 6708 " name = " హ ె డర ్ " / > <nl> + < Item id = " 6709 " name = " ల ె ఫ ్ ట ్ ప ా ర ్ ట ్ " / > <nl> + < Item id = " 6710 " name = " మ ి డ ీ ల ్ ప ా ర ్ ట ్ " / > <nl> + < Item id = " 6711 " name = " ర ై ట ్ ప ా ర ్ ట ్ " / > <nl> + < Item id = " 6717 " name = " బ ో ల ్ డ ్ " / > <nl> + < Item id = " 6718 " name = " ఇట ా ల ి క ్ " / > <nl> + < Item id = " 6719 " name = " ఫ ు టర ్ " / > <nl> + < Item id = " 6720 " name = " ల ె ఫ ్ ట ్ ప ా ర ్ ట ్ " / > <nl> + < Item id = " 6721 " name = " మ ి డ ీ ల ్ ప ా ర ్ ట " / > <nl> + < Item id = " 6722 " name = " ర ై ట ్ ప ా ర ్ ట ్ " / > <nl> + < Item id = " 6723 " name = " య ా డ ్ " / > <nl> + < Item id = " 6725 " name = " వ ే ర ి యబల ్ : " / > <nl> + < Item id = " 6728 " name = " హ ె డర ్ అ ం డ ్ ఫ ు టర ్ " / > <nl> + < / Print > <nl> + < MISC title = " మ ి స ్ క ్ . " > <nl> + < Item id = " 6304 " name = " ర ీ స ె ం ట ్ ఫ ై ల ్ స ్ హ ి స ్ టర ీ " / > <nl> + < Item id = " 6305 " name = " డ ొ న ్ ' ట ్ చ ె క ్ అట ్ ల ా ం చ ్ ట ై మ ్ " / > <nl> + < Item id = " 6306 " name = " మ ్ య ా క ్ స ్ . న ం బర ్ ఆఫ ్ ఎ ం ట ్ ర ీ స ్ : " / > <nl> + < Item id = " 6307 " name = " ఎన ే బ ు ల ్ " / > <nl> + < Item id = " 6308 " name = " మ ి న ి మ ై స ్ ట ు స ి స ్ టమ ్ ట ్ ర ే " / > <nl> + < Item id = " 6309 " name = " ర ి మ ె ం బర ్ కర ె ం ట ్ స ె షన ్ ఫ ో ర ్ న ె క ్ స ్ ట ్ ల ా ం చ ్ " / > <nl> + < Item id = " 6312 " name = " ఫ ై ల ్ స ్ ట ే టస ్ ఆట ో - డ ి ట ె క ్ షన ్ " / > <nl> + < Item id = " 6313 " name = " అప ్ ‌ డ ే ట ్ స ై ల ె ం ట ్ ల ీ " / > <nl> + < Item id = " 6318 " name = " క ్ ల ి క ్ క ా బ ూ ల ్ ల ి ం క ్ స ె ట ్ ట ి ం గ ్ స ్ " / > <nl> + < Item id = " 6325 " name = " స ్ క ్ ర ో ల ్ ట ు ద ల ా స ్ ట ్ ల ై న ్ ఆఫ ్ టర ్ అప ్ ‌ డ ే ట ్ " / > <nl> + < Item id = " 6319 " name = " ఎన ే బ ు ల ్ " / > <nl> + < Item id = " 6320 " name = " న ో అ ం డర ్ ‌ ల ై న ్ " / > <nl> + < Item id = " 6322 " name = " స ె షన ్ ఫ ై ల ్ ఎక ్ స ్ ‌ ట ె న ్ షన ్ . : " / > <nl> + < Item id = " 6323 " name = " ఎన ే బ ు ల ్ న ో ట ్ ప ్ య ా డ ్ + + ఆట ో - అప ్ ‌ డ ే టర ్ " / > <nl> + < Item id = " 6324 " name = " డ ా క ్ య ు మ ె ం ట ్ స ్ వ ి చర ్ ( క ం ట ్ ర ో ల ్ + ట ్ య ా బ ్ ) " / > <nl> + < Item id = " 6326 " name = " ఎన ే బ ు ల ్ స ్ మ ా ర ్ ట ్ హ ై ల ై ట ి ం గ ్ " / > <nl> + < Item id = " 6329 " name = " హ ై ల ై ట ్ మ ్ య ా చ ి ం గ ్ ట ్ య ా గ ్ స ్ " / > <nl> + < Item id = " 6327 " name = " ఎన ే బ ు ల ్ " / > <nl> + < Item id = " 6328 " name = " హ ై ల ై ట ్ ట ్ య ా గ ్ ఆట ్ ర ి బ ్ య ూ ట ్ స ్ " / > <nl> + < Item id = " 6330 " name = " హ ై ల ై ట ్ క ా మ ె ం ట ్ / ప ీ హ ె చ ్ ప ీ / ఏఎస ్ ప ీ జ ొ న ్ " / > <nl> + < Item id = " 6331 " name = " ష ో ఓన ్ ల ీ ఫ ై ల ్ ‌ న ే మ ్ ఇన ్ ట ై ట ి ల ్ బ ా ర ్ " / > <nl> + < Item id = " 6114 " name = " ఎన ే బ ు ల ్ " / > <nl> + < Item id = " 6115 " name = " ఆట ో - ఇన ్ ‌ డ ె ం ట ్ " / > <nl> + < Item id = " 6117 " name = " ఎన ే బ ు ల ్ ఎమ ్ ఆర ్ య ూ బ ి హ ే వ ి యర ్ " / > <nl> + < / MISC > <nl> + < Backup title = " బ ్ య ా కప ్ / ఆట ో - క ం ప ్ ల ీ షన ్ " > <nl> + < Item id = " 6801 " name = " బ ్ య ా కప ్ " / > <nl> + < Item id = " 6315 " name = " నన ్ " / > <nl> + < Item id = " 6316 " name = " స ి ం ప ు ల ్ బ ్ య ా కప ్ " / > <nl> + < Item id = " 6317 " name = " వ ె ర ్ బ ో స ే బ ్ య ా కప ్ " / > <nl> + < Item id = " 6804 " name = " కస ్ టమ ్ బ ్ య ా కప ్ డ ై ర ె క ్ టర ీ " / > <nl> + < Item id = " 6803 " name = " డ ై ర ె క ్ టర ీ : " / > <nl> + < Item id = " 6807 " name = " ఆట ో - క ం ప ్ ల ీ షన ్ " / > <nl> + < Item id = " 6808 " name = " ఎన ే బ ు ల ్ ఆట ో - క ం ప ్ ల ీ షన ్ ఆన ్ ఈచ ్ ఇన ్ ప ు ట ్ " / > <nl> + < Item id = " 6809 " name = " ఫ ం క ్ షన ్ క ం ప ్ ల ీ షన ్ " / > <nl> + < Item id = " 6810 " name = " వర ్ డ ్ క ం ప ్ ల ీ షన ్ " / > <nl> + < Item id = " 6811 " name = " ఫ ్ రమ ్ " / > <nl> + < Item id = " 6813 " name = " త ్ క ్ య ా రక ్ టర ్ " / > <nl> + < Item id = " 6814 " name = " వ ్ య ా ల ి డ ్ వ ్ య ా ల ్ య ూ : 1 - 9 " / > <nl> + < Item id = " 6815 " name = " ఫ ం క ్ షన ్ ప ్ య ా రమ ీ టర ్ స ్ హ ి ం ట ్ ఆన ్ ఇన ్ ప ు ట ్ " / > <nl> + < / Backup > <nl> + < / Preference > <nl> + < MultiMacro title = " రన ్ ఏ మ ్ య ా క ్ ర ో మల ్ ట ి పల ్ ట ై మ ్ స ్ " > <nl> + < Item id = " 1 " name = " రన ్ " / > <nl> + < Item id = " 2 " name = " క ్ య ా న ్ సల ్ " / > <nl> + < Item id = " 8006 " name = " మ ్ య ా క ్ ర ో ట ు రన ్ : " / > <nl> + < Item id = " 8001 " name = " రన ్ " / > <nl> + < Item id = " 8005 " name = " ట ై మ ్ స ్ " / > <nl> + < Item id = " 8002 " name = " రన ్ అ ం ట ి ల ్ ద ఎ ం డ ్ ఆఫ ్ ఫ ై ల ్ " / > <nl> + < / MultiMacro > <nl> + < Window title = " వ ి ం డ ొ స ్ " > <nl> + < Item id = " 1 " name = " ఆక ్ ట ీ వ ే ట ్ " / > <nl> + < Item id = " 2 " name = " ఓక ే " / > <nl> + < Item id = " 7002 " name = " స ే వ ్ " / > <nl> + < Item id = " 7003 " name = " క ్ ల ో జ ్ వ ి ం డ ొ ( స ్ ) " / > <nl> + < Item id = " 7004 " name = " స ా ర ్ ట ్ ట ్ య ా బ ్ స ్ " / > <nl> + < / Window > <nl> + < ColumnEditor title = " క ా లమ ్ ఎడ ి టర ్ " > <nl> + < Item id = " 2023 " name = " ట ె క ్ స ్ ట ్ ట ు ఇన ్ ‌ సర ్ ట ్ " / > <nl> + < Item id = " 2033 " name = " న ం బర ్ ట ు ఇన ్ ‌ సర ్ ట ్ " / > <nl> + < Item id = " 2030 " name = " ఇన ి ష ి యల ్ న ం బర ్ : " / > <nl> + < Item id = " 2031 " name = " ఇన ్ ‌ క ్ ర ీ స ్ బ ై : " / > <nl> + < Item id = " 2035 " name = " ల ీ డ ి ం గ ్ జ ీ ర ో స ్ " / > <nl> + < Item id = " 2032 " name = " ఫ ా ర ్ మ ్ య ా ట ్ " / > <nl> + < Item id = " 2024 " name = " డ ె స ి మల ్ " / > <nl> + < Item id = " 2025 " name = " ఆక ్ టల ్ " / > <nl> + < Item id = " 2026 " name = " హ ె క ్ స ్ " / > <nl> + < Item id = " 2027 " name = " బ ి న ్ " / > <nl> + < Item id = " 1 " name = " ఓక ే " / > <nl> + < Item id = " 2 " name = " క ్ య ా న ్ సల ్ " / > <nl> + < / ColumnEditor > <nl> + < / Dialog > <nl> + < / Native - Langue > <nl> + < / NotepadPlus > <nl> \ No newline at end of file <nl> mmm a / PowerEditor / installer / nppSetup . nsi <nl> ppp b / PowerEditor / installer / nppSetup . nsi <nl> SectionGroup " Localization " localization <nl> Section / o " Tamil " tamil <nl> CopyFiles " $ TEMP \ nppLocalization \ tamil . xml " " $ INSTDIR \ localization \ tamil . xml " <nl> SectionEnd <nl> + Section / o " Telugu " telugu <nl> + CopyFiles " $ TEMP \ nppLocalization \ telugu . xml " " $ INSTDIR \ localization \ telugu . xml " <nl> + SectionEnd <nl> Section / o " Thai " thai <nl> CopyFiles " $ TEMP \ nppLocalization \ thai . xml " " $ INSTDIR \ localization \ thai . xml " <nl> SectionEnd <nl> SectionGroup " Localization " localization <nl> CopyFiles " $ TEMP \ nppLocalization \ turkish . xml " " $ INSTDIR \ localization \ turkish . xml " <nl> SectionEnd <nl> Section / o " Ukrainian " ukrainian <nl> - <nl> CopyFiles " $ TEMP \ nppLocalization \ ukrainian . xml " " $ INSTDIR \ localization \ ukrainian . xml " <nl> SectionEnd <nl> Section / o " Uzbek " uzbek <nl> SectionGroup " Localization " localization <nl> Section / o " Uzbek ( Cyrillic ) " uzbekCyrillic <nl> CopyFiles " $ TEMP \ nppLocalization \ uzbekCyrillic . xml " " $ INSTDIR \ localization \ uzbekCyrillic . xml " <nl> SectionEnd <nl> + Section / o " Uyghur " uyghur <nl> + CopyFiles " $ TEMP \ nppLocalization \ uyghur . xml " " $ INSTDIR \ localization \ uyghur . xml " <nl> + SectionEnd <nl> SectionGroupEnd <nl> <nl> SectionGroup " Themes " Themes <nl> mmm a / PowerEditor / src / WinControls / ProjectPanel / ProjectPanel . cpp <nl> ppp b / PowerEditor / src / WinControls / ProjectPanel / ProjectPanel . cpp <nl> BOOL CALLBACK ProjectPanel : : run_dlgProc ( UINT message , WPARAM wParam , LPARAM lPar <nl> } <nl> <nl> case WM_CONTEXTMENU : <nl> - showContextMenu ( GET_X_LPARAM ( lParam ) , GET_Y_LPARAM ( lParam ) ) ; <nl> + if ( ! _treeView . isDragging ( ) ) <nl> + showContextMenu ( GET_X_LPARAM ( lParam ) , GET_Y_LPARAM ( lParam ) ) ; <nl> return TRUE ; <nl> <nl> case WM_COMMAND : <nl> BOOL CALLBACK ProjectPanel : : run_dlgProc ( UINT message , WPARAM wParam , LPARAM lPar <nl> popupMenuCmd ( LOWORD ( wParam ) ) ; <nl> break ; <nl> } <nl> - / * <nl> - # define NPPM_INTERNAL_ISDRAGGING 40926 <nl> - case NPPM_INTERNAL_ISDRAGGING : <nl> - { <nl> - setDraggingBool ( true ) ; <nl> - break ; <nl> - } <nl> - * / <nl> + <nl> case WM_DESTROY : <nl> { <nl> _treeView . destroy ( ) ; <nl> mmm a / PowerEditor / src / WinControls / ProjectPanel / ProjectPanel . h <nl> ppp b / PowerEditor / src / WinControls / ProjectPanel / ProjectPanel . h <nl> class ProjectPanel : public DockingDlgInterface { <nl> return _isDirty ; <nl> } ; <nl> void checkIfNeedSave ( const TCHAR * title ) ; <nl> - / * <nl> - HWND getTreeHandle ( ) { <nl> - return _treeView . getHSelf ( ) ; <nl> - } ; <nl> <nl> - void setDraggingBool ( bool val ) { <nl> - _treeView . setDraggingBool ( val ) ; <nl> - } ; <nl> - * / <nl> protected : <nl> TreeView _treeView ; <nl> HIMAGELIST _hImaLst ; <nl> mmm a / PowerEditor / src / WinControls / ProjectPanel / TreeView . cpp <nl> ppp b / PowerEditor / src / WinControls / ProjectPanel / TreeView . cpp <nl> void TreeView : : init ( HINSTANCE hInst , HWND parent , int treeViewID ) <nl> WC_TREEVIEW , <nl> TEXT ( " Tree View " ) , <nl> WS_CHILD | WS_BORDER | WS_HSCROLL | WS_TABSTOP | TVS_LINESATROOT | TVS_HASLINES | <nl> - / * TVS_DISABLEDRAGDROP | * / TVS_HASBUTTONS | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_EDITLABELS | TVS_INFOTIP , <nl> + TVS_HASBUTTONS | TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_EDITLABELS | TVS_INFOTIP , <nl> 0 , 0 , 0 , 0 , <nl> _hParent , <nl> NULL , <nl> void TreeView : : destroy ( ) <nl> <nl> LRESULT TreeView : : runProc ( HWND hwnd , UINT Message , WPARAM wParam , LPARAM lParam ) <nl> { <nl> - / * <nl> - switch ( Message ) <nl> - { <nl> - <nl> - case WM_KEYDOWN : <nl> - if ( wParam = = VK_UP & & ( 0x80 & GetKeyState ( VK_CONTROL ) ) ) <nl> - { <nl> - HTREEITEM hTreeItem = getSelection ( ) ; <nl> - moveUp ( hTreeItem ) ; <nl> - return TRUE ; <nl> - } <nl> - else if ( wParam = = VK_DOWN & & ( 0x80 & GetKeyState ( VK_CONTROL ) ) ) <nl> - { <nl> - HTREEITEM hTreeItem = getSelection ( ) ; <nl> - moveDown ( hTreeItem ) ; <nl> - return TRUE ; <nl> - } <nl> - break ; <nl> - default : <nl> - return : : CallWindowProc ( _defaultProc , hwnd , Message , wParam , lParam ) ; <nl> - } <nl> - * / <nl> return : : CallWindowProc ( _defaultProc , hwnd , Message , wParam , lParam ) ; <nl> } <nl> <nl> bool TreeView : : swapTreeViewItem ( HTREEITEM itemGoDown , HTREEITEM itemGoUp ) <nl> / / get previous and next for both items with ( ) function <nl> HTREEITEM itemTop = getPrevSibling ( itemGoDown ) ; <nl> itemTop = itemTop ? itemTop : ( HTREEITEM ) TVI_FIRST ; <nl> - / / HTREEITEM itemBottom = getNextSibling ( itemGoUp ) ; <nl> HTREEITEM parentGoDown = getParent ( itemGoDown ) ; <nl> HTREEITEM parentGoUp = getParent ( itemGoUp ) ; <nl> <nl> mmm a / PowerEditor / src / WinControls / ProjectPanel / TreeView . h <nl> ppp b / PowerEditor / src / WinControls / ProjectPanel / TreeView . h <nl> class TreeView : public Window <nl> void addCanNotDragOutList ( int val2set ) { <nl> _canNotDragOutList . push_back ( val2set ) ; <nl> } ; <nl> - / * <nl> - void setDraggingBool ( bool val ) { <nl> - _isItemDragged = val ; <nl> - } ; <nl> - * / <nl> + <nl> bool moveDown ( HTREEITEM itemToMove ) ; <nl> bool moveUp ( HTREEITEM itemToMove ) ; <nl> bool swapTreeViewItem ( HTREEITEM itemGoDown , HTREEITEM itemGoUp ) ; <nl>
[ BUG_FIXED ] Fix mouse cursor disappearing bug on right click while a project item is dragging .
notepad-plus-plus/notepad-plus-plus
024c82e8806dff0d9413f0e1d9f5ec006fe77154
2012-05-01T11:53:54Z
mmm a / xbmc / guilib / GUIWindow . cpp <nl> ppp b / xbmc / guilib / GUIWindow . cpp <nl> void CGUIWindow : : Close_Internal ( bool forceClose / * = false * / , int nextWindowID / * <nl> } <nl> <nl> m_closing = false ; <nl> - CGUIMessage msg ( GUI_MSG_WINDOW_DEINIT , 0 , 0 ) ; <nl> + CGUIMessage msg ( GUI_MSG_WINDOW_DEINIT , 0 , 0 , nextWindowID ) ; <nl> OnMessage ( msg ) ; <nl> } <nl> <nl>
Merge pull request from ulion / add_missed_next_win_id_param_for_deinit_gui_message
xbmc/xbmc
9dc708c10ef95ee1244a1a5b7b0039870e7ed4fd
2013-03-11T18:44:57Z
mmm a / stdlib / public / CMakeLists . txt <nl> ppp b / stdlib / public / CMakeLists . txt <nl> endif ( ) <nl> <nl> add_subdirectory ( SwiftShims ) <nl> <nl> + # This static library is shared across swiftCore and swiftReflection <nl> + if ( SWIFT_BUILD_STDLIB OR SWIFT_BUILD_REMOTE_MIRROR ) <nl> + # TODO : due to the use of ` add_swift_target_library ` rather than ` add_library ` <nl> + # we cannot use ` target_sources ` and thus must resort to list manipulations to <nl> + # adjust the source list . <nl> + set ( swiftDemanglingSources <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Context . cpp " <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Demangler . cpp " <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / ManglingUtils . cpp " <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / NodePrinter . cpp " <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / OldDemangler . cpp " <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / OldRemangler . cpp " <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Punycode . cpp " <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Remangler . cpp " ) <nl> + <nl> + # When we ' re building with assertions , include the demangle node dumper to aid <nl> + # in debugging . <nl> + if ( LLVM_ENABLE_ASSERTIONS ) <nl> + list ( APPEND swiftDemanglingSources <nl> + " $ { SWIFT_SOURCE_DIR } / lib / Demangling / NodeDumper . cpp " ) <nl> + endif ( ) <nl> + <nl> + add_swift_target_library ( swiftDemangling OBJECT_LIBRARY <nl> + $ { swiftDemanglingSources } <nl> + C_COMPILE_FLAGS - DswiftCore_EXPORTS <nl> + INSTALL_IN_COMPONENT never_install ) <nl> + endif ( ) <nl> + <nl> if ( SWIFT_BUILD_STDLIB ) <nl> # These must be kept in dependency order so that any referenced targets <nl> # exist at the time we look for them in add_swift_ * . <nl> mmm a / stdlib / public / Reflection / CMakeLists . txt <nl> ppp b / stdlib / public / Reflection / CMakeLists . txt <nl> set ( swiftReflection_SOURCES <nl> MetadataSource . cpp <nl> TypeLowering . cpp <nl> TypeRef . cpp <nl> - TypeRefBuilder . cpp <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Context . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / OldDemangler . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Demangler . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / NodePrinter . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / ManglingUtils . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Punycode . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Remangler . cpp " ) <nl> - <nl> - # When we ' re building with assertions , include the demangle node dumper to aid <nl> - # in debugging . <nl> - if ( LLVM_ENABLE_ASSERTIONS ) <nl> - list ( APPEND swiftReflection_SOURCES <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / NodeDumper . cpp " ) <nl> - endif ( LLVM_ENABLE_ASSERTIONS ) <nl> + TypeRefBuilder . cpp ) <nl> <nl> add_swift_target_library ( swiftReflection STATIC <nl> $ { swiftReflection_SOURCES } <nl> C_COMPILE_FLAGS $ { SWIFT_RUNTIME_CXX_FLAGS } - DswiftCore_EXPORTS <nl> LINK_FLAGS $ { SWIFT_RUNTIME_LINK_FLAGS } <nl> - INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport <nl> + INCORPORATE_OBJECT_LIBRARIES <nl> + swiftLLVMSupport swiftDemangling <nl> SWIFT_COMPILE_FLAGS $ { SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS } <nl> INSTALL_IN_COMPONENT dev ) <nl> mmm a / stdlib / public / core / CMakeLists . txt <nl> ppp b / stdlib / public / core / CMakeLists . txt <nl> add_swift_target_library ( swiftCore <nl> PRIVATE_LINK_LIBRARIES <nl> $ { swift_core_private_link_libraries } <nl> INCORPORATE_OBJECT_LIBRARIES <nl> - swiftRuntime swiftLLVMSupport swiftStdlibStubs <nl> + swiftRuntime swiftLLVMSupport swiftDemangling swiftStdlibStubs <nl> FRAMEWORK_DEPENDS <nl> $ { swift_core_framework_depends } <nl> INSTALL_IN_COMPONENT <nl> mmm a / stdlib / public / runtime / CMakeLists . txt <nl> ppp b / stdlib / public / runtime / CMakeLists . txt <nl> set ( swift_runtime_objc_sources <nl> SwiftObject . mm <nl> SwiftValue . mm <nl> ReflectionMirror . mm <nl> - ObjCRuntimeGetImageNameFromClass . mm <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / OldRemangler . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Remangler . cpp " <nl> - ) <nl> + ObjCRuntimeGetImageNameFromClass . mm ) <nl> <nl> set ( swift_runtime_sources <nl> AnyHashableSupport . cpp <nl> set ( swift_runtime_sources <nl> ProtocolConformance . cpp <nl> RefCount . cpp <nl> RuntimeInvocationsTracking . cpp <nl> - SwiftDtoa . cpp <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / OldDemangler . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Demangler . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / NodePrinter . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Context . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / ManglingUtils . cpp " <nl> - " $ { SWIFT_SOURCE_DIR } / lib / Demangling / Punycode . cpp " ) <nl> - <nl> - # When we ' re building with assertions , include the demangle node dumper to aid <nl> - # in debugging . <nl> - if ( LLVM_ENABLE_ASSERTIONS ) <nl> - list ( APPEND swift_runtime_sources " $ { SWIFT_SOURCE_DIR } / lib / Demangling / NodeDumper . cpp " ) <nl> - endif ( LLVM_ENABLE_ASSERTIONS ) <nl> + SwiftDtoa . cpp ) <nl> <nl> # Acknowledge that the following sources are known . <nl> set ( LLVM_OPTIONAL_SOURCES <nl> add_swift_target_library ( swiftRuntime OBJECT_LIBRARY <nl> $ { swift_runtime_library_compile_flags } <nl> $ { _RUNTIME_NONATOMIC_FLAGS } <nl> LINK_FLAGS $ { swift_runtime_linker_flags } <nl> - INCORPORATE_OBJECT_LIBRARIES swiftLLVMSupport <nl> SWIFT_COMPILE_FLAGS $ { SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS } <nl> INSTALL_IN_COMPONENT never_install ) <nl> <nl> mmm a / unittests / runtime / CMakeLists . txt <nl> ppp b / unittests / runtime / CMakeLists . txt <nl> if ( ( " $ { SWIFT_HOST_VARIANT_SDK } " STREQUAL " $ { SWIFT_PRIMARY_VARIANT_SDK } " ) AND <nl> # and the stdlib . <nl> $ < TARGET_OBJECTS : swiftRuntime $ { SWIFT_PRIMARY_VARIANT_SUFFIX } > <nl> $ < TARGET_OBJECTS : swiftLLVMSupport $ { SWIFT_PRIMARY_VARIANT_SUFFIX } > <nl> + $ < TARGET_OBJECTS : swiftDemangling $ { SWIFT_PRIMARY_VARIANT_SUFFIX } > <nl> ) <nl> <nl> # The local stdlib implementation provides definitions of the swiftCore <nl> mmm a / unittests / runtime / LongTests / CMakeLists . txt <nl> ppp b / unittests / runtime / LongTests / CMakeLists . txt <nl> if ( ( " $ { SWIFT_HOST_VARIANT_SDK } " STREQUAL " $ { SWIFT_PRIMARY_VARIANT_SDK } " ) AND <nl> # and the stdlib . <nl> $ < TARGET_OBJECTS : swiftRuntime $ { SWIFT_PRIMARY_VARIANT_SUFFIX } > <nl> $ < TARGET_OBJECTS : swiftLLVMSupport $ { SWIFT_PRIMARY_VARIANT_SUFFIX } > <nl> + $ < TARGET_OBJECTS : swiftDemangling $ { SWIFT_PRIMARY_VARIANT_SUFFIX } > <nl> ) <nl> <nl> # The local stdlib implementation provides definitions of the swiftCore <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
6b044ebeaf9dd8b09a82ae19f5cb3401c65ca914
2020-06-01T15:38:20Z
mmm a / docs / rql / py_docs . json <nl> ppp b / docs / rql / py_docs . json <nl> <nl> " reconnect " : { <nl> " examples " : [ <nl> { <nl> - " code " : " conn . reconnect ( ) " , <nl> + " code " : " conn . reconnect ( noreply_wait = False ) " , <nl> " description " : " < p > < strong > Example : < / strong > Cancel outstanding requests / queries that are no longer needed . < / p > " <nl> } <nl> ] , <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nClose and attempt to reopen a connection . Has the effect of canceling any outstanding \ nrequest while keeping the connection open . \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nClose and reopen a connection . Closing a connection waits until all \ noutstanding requests have finished . If ` noreply_wait ` is set to \ n ` false ` , all outstanding requests are canceled immediately . \ n \ n " <nl> } , <nl> " index_drop " : { <nl> " examples " : [ <nl> <nl> ] , <nl> " description " : " \ n \ n \ n \ nGroups elements by the values of the given attributes and then applies the given \ nreduction . Though similar to ` groupedMapReduce ` , ` groupBy ` takes a standardized object \ nfor specifying the reduction . Can be used with a number of predefined common reductions . \ n \ n \ n \ n \ n \ n " <nl> } , <nl> - " table_list " : { <nl> + " index_status " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . db ( ' test ' ) . table_list ( ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > List all tables of the ' test ' database . < / p > " <nl> + " code " : " r . table ( ' test ' ) . index_status ( ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Get the status of all the indexes on < code > test < / code > : < / p > " <nl> + } , <nl> + { <nl> + " code " : " r . table ( ' test ' ) . index_status ( ' timestamp ' ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Get the status of the < code > timestamp < / code > index : < / p > " <nl> } <nl> ] , <nl> - " name " : " table_list " , <nl> + " name " : " index_status " , <nl> " io " : [ <nl> [ <nl> - " db " , <nl> + " table " , <nl> " array " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nList all table names in a database . The result is a list of strings . \ n \ n " <nl> + " description " : " \ n \ n \ n \ nGet the status of the specified indexes on this table , or the status \ nof all indexes on this table if no indexes are specified . \ n \ n \ n " <nl> } , <nl> " < " : { <nl> " examples " : [ <nl> <nl> " repl " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . connect ( ) . repl ( ) \ nr . table ( ' users ' ) . run ( ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Set the default connection in REPL , and call < code > run ( ) < / code > without specifying the connection . < / p > " <nl> + " code " : " r . connect ( db = ' marvel ' ) . repl ( ) \ nr . table ( ' heroes ' ) . run ( ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Set the default connection for the REPL , then call \ n < code > run ( ) < / code > without specifying the connection . < / p > " <nl> } <nl> ] , <nl> " name " : " repl " , <nl> <nl> null <nl> ] <nl> ] , <nl> - " description " : " < p > Set the default connection to make REPL use easier . Allows calling run ( ) without specifying a connection . < / p > \ n < p > Connection objects are not thread safe and repl connections should not be used in multi - threaded environments . < / p > " <nl> + " description " : " < p > Set the default connection to make REPL use easier . Allows calling \ n < code > . run ( ) < / code > on queries without specifying a connection . < / p > \ n < p > Connection objects are not thread - safe and REPL connections should not \ nbe used in multi - threaded environments . < / p > " <nl> + } , <nl> + " insert " : { <nl> + " examples " : [ <nl> + { <nl> + " code " : " r . table ( ' marvel ' ) . insert ( \ n { ' superhero ' : ' Iron Man ' , ' superpower ' : ' Arc Reactor ' } ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Insert a row into a table named ' marvel ' . < / p > " <nl> + } , <nl> + { <nl> + " code " : " r . table ( ' marvel ' ) . insert ( [ \ n { ' superhero ' : ' Wolverine ' , ' superpower ' : ' Adamantium ' } , \ n { ' superhero ' : ' Spiderman ' , ' superpower ' : ' spidy sense ' } \ n ] , durability = ' soft ' \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Insert multiple rows into a table named ' marvel ' . Also , specify that only \ nsoft durability is required . < / p > " <nl> + } , <nl> + { <nl> + " code " : " r . table ( ' marvel ' ) . insert ( \ n { ' superhero ' : ' Iron Man ' , ' superpower ' : ' Arc Reactor ' } , \ n upsert = True \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Insert a row into a table named ' marvel ' , overwriting if the document already exists . < / p > " <nl> + } , <nl> + { <nl> + " code " : " r . table ( ' marvel ' ) . insert ( \ n { ' superhero ' : ' Iron Man ' , ' superpower ' : ' Arc Reactor ' } , \ n upsert = True , return_vals = True \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Get back a copy of the new row , this is useful if you ' ve done an upsert or generated an ID . < / p > " <nl> + } <nl> + ] , <nl> + " name " : " insert " , <nl> + " io " : [ <nl> + [ <nl> + " table " , <nl> + " object " <nl> + ] , <nl> + [ <nl> + " selection " , <nl> + " object " <nl> + ] , <nl> + [ <nl> + " singleSelection " , <nl> + " object " <nl> + ] <nl> + ] , <nl> + " description " : " \ n \ n \ n \ n \ nInsert JSON documents into a table . Accepts a single JSON document or an array of \ ndocuments . \ n \ nInsert returns an object that contains the following attributes : \ n \ n - ` inserted ` : the number of documents that were succesfully inserted \ n - ` replaced ` : the number of documents that were updated when upsert is used \ n - ` unchanged ` : the number of documents that would have been modified , except that the \ nnew value was the same as the old value when doing an upsert \ n - ` errors ` : the number of errors encountered while inserting ; if errors where \ nencountered while inserting , ` first_error ` contains the text of the first error \ n - ` generated_keys ` : a list of generated primary key values \ n - ` deleted ` and ` skipped ` : 0 for an insert operation . \ n \ n \ n \ n \ n \ n \ n " <nl> } , <nl> " during " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( \ " posts \ " ) . filter ( \ n r . row [ ' date ' ] . during ( r . time ( 2013 , 12 , 1 ) , r . time ( 2013 , 12 , 10 ) ) \ n ) . run ( conn ) " , <nl> + " code " : " r . table ( \ " posts \ " ) . filter ( \ n r . row [ ' date ' ] . during ( r . time ( 2013 , 12 , 1 , \ " Z \ " ) , r . time ( 2013 , 12 , 10 , \ " Z \ " ) ) \ n ) . run ( conn ) " , <nl> " description " : " < p > < strong > Example : < / strong > Retrieve all the posts that were posted between December 1st , 2013 ( inclusive ) and December 10th , 2013 ( exclusive ) . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( \ " posts \ " ) . filter ( \ n r . row [ ' date ' ] . during ( r . time ( 2013 , 12 , 1 ) , r . time ( 2013 , 12 , 10 ) , left_bound = \ " open \ " , right_bound = \ " closed \ " ) \ n ) . run ( conn ) " , <nl> + " code " : " r . table ( \ " posts \ " ) . filter ( \ n r . row [ ' date ' ] . during ( r . time ( 2013 , 12 , 1 , \ " Z \ " ) , r . time ( 2013 , 12 , 10 , \ " Z \ " ) , left_bound = \ " open \ " , right_bound = \ " closed \ " ) \ n ) . run ( conn ) " , <nl> " description " : " < p > < strong > Example : < / strong > Retrieve all the posts that were posted between December 1st , 2013 ( exclusive ) and December 10th , 2013 ( inclusive ) . < / p > " <nl> } <nl> ] , <nl> <nl> ] , <nl> " description " : " \ n \ n \ n \ nInsert a value in to an array at a given index . Returns the modified array . \ n \ n \ n \ n " <nl> } , <nl> - " insert " : { <nl> + " noreply_wait " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . insert ( \ n { ' superhero ' : ' Iron Man ' , ' superpower ' : ' Arc Reactor ' } ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Insert a row into a table named ' marvel ' . < / p > " <nl> - } , <nl> - { <nl> - " code " : " r . table ( ' marvel ' ) . insert ( [ \ n { ' superhero ' : ' Wolverine ' , ' superpower ' : ' Adamantium ' } , \ n { ' superhero ' : ' Spiderman ' , ' superpower ' : ' spidy sense ' } \ n ] , durability = ' soft ' \ n ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Insert multiple rows into a table named ' marvel ' . Also , specify that only \ nsoft durability is required . < / p > " <nl> - } , <nl> - { <nl> - " code " : " r . table ( ' marvel ' ) . insert ( \ n { ' superhero ' : ' Iron Man ' , ' superpower ' : ' Arc Reactor ' } , \ n upsert = True \ n ) . run ( conn ) \ n \ n \ n__Example : __ Get back a copy of the new row , this is useful if you ' ve done an upsert or generated an ID . \ n \ n \ nr . table ( ' marvel ' ) . insert ( \ n { ' superhero ' : ' Iron Man ' , ' superpower ' : ' Arc Reactor ' } , \ n upsert = True , return_vals = True \ n ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Insert a row into a table named ' marvel ' , overwriting if the document already exists . < / p > " <nl> + " code " : " conn . noreply_wait ( ) " , <nl> + " description " : " < p > < strong > Example : < / strong > We have previously run queries with the < code > noreply < / code > argument set to < code > True < / code > . Now \ nwait until the server has processed them . < / p > " <nl> } <nl> ] , <nl> - " name " : " insert " , <nl> + " name " : " noreply_wait " , <nl> " io " : [ <nl> [ <nl> - " table " , <nl> - " object " <nl> - ] , <nl> - [ <nl> - " selection " , <nl> - " object " <nl> - ] , <nl> - [ <nl> - " singleSelection " , <nl> - " object " <nl> + " connection " , <nl> + null <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ n \ nInsert JSON documents into a table . Accepts a single JSON document or an array of \ ndocuments . \ n \ nInsert returns an object that contains the following attributes : \ n \ n - ` inserted ` : the number of documents that were succesfully inserted \ n - ` replaced ` : the number of documents that were updated when upsert is used \ n - ` unchanged ` : the number of documents that would have been modified , except that the \ nnew value was the same as the old value when doing an upsert \ n - ` errors ` : the number of errors encountered while inserting ; if errors where \ nencountered while inserting , ` first_error ` contains the text of the first error \ n - ` generated_keys ` : a list of generated primary key values \ n - ` deleted ` and ` skipped ` : 0 for an insert operation . \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ n ` noreply_wait ` ensures that previous queries with the ` noreply ` flag have been processed \ nby the server . Note that this guarantee only applies to queries run on the given connection . \ n \ n \ n " <nl> } , <nl> " indexes_of " : { <nl> " examples " : [ <nl> <nl> " array " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nConverts a value of one type into another . \ n \ nYou can convert : a selection , sequence , or object into an ARRAY , an array of pairs into an OBJECT , and any DATUM into a STRING . \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nConverts a value of one type into another . \ n \ nYou can convert : a selection , sequence , or object into an ARRAY , an array of pairs into an OBJECT , and any DATUM into a STRING . \ n \ n \ n \ n \ n \ n " <nl> } , <nl> " reduce " : { <nl> " examples " : [ <nl> <nl> ] , <nl> " description " : " \ n \ n \ n \ nProduce a single value from a sequence through repeated application of a reduction \ nfunction . \ n \ nThe reduce function gets invoked repeatedly not only for the input values but also for \ nresults of previous reduce invocations . The type and format of the object that is passed \ nin to reduce must be the same with the one returned from reduce . \ n \ n " <nl> } , <nl> + " sync " : { <nl> + " examples " : [ <nl> + { <nl> + " code " : " r . table ( ' marvel ' ) . sync ( ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > After having updated multiple heroes with soft durability , we now want to wait \ nuntil these changes are persisted . < / p > " <nl> + } <nl> + ] , <nl> + " name " : " sync " , <nl> + " io " : [ <nl> + [ <nl> + " table " , <nl> + " object " <nl> + ] <nl> + ] , <nl> + " description " : " \ n \ n \ n \ n ` sync ` ensures that writes on a given table are written to permanent storage . Queries \ nthat specify soft durability ( ` durability = ' soft ' ` ) do not give such guarantees , so \ n ` sync ` can be used to ensure the state of these queries . A call to ` sync ` does not return \ nuntil all previous writes to the table are persisted . \ n \ nIf successful , the operation returns an object : ` { \ " synced \ " : 1 } ` . \ n \ n \ n \ n " <nl> + } , <nl> " connect " : { <nl> " examples " : [ <nl> { <nl> - " code " : " conn = r . connect ( db = ' heroes ' ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Opens a connection using the default host and port but specifying the default database . < / p > " <nl> + " code " : " conn = r . connect ( db = ' marvel ' ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Opens a connection using the default host and port but \ nspecifying the default database . < / p > " <nl> } <nl> ] , <nl> " name " : " connect " , <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nCreate a new connection to the database server . \ n \ nIf the connection cannot be established , a ` RqlDriverError ` exception will be thrown \ n \ n " <nl> + " description " : " \ n \ n \ n \ nCreate a new connection to the database server . The keyword arguments are : \ n \ n - ` host ` : host of the RethinkDB instance . The default value is ` localhost ` . \ n - ` port ` : the driver port , by default ` 28015 ` . \ n - ` db ` : the database used if not explicitly specified in a query , by default ` test ` . \ n - ` auth_key ` : the authentification key , by default the empty string . \ n - ` timeout ` : timeout period for the connection to be opened , by default ` 20 ` ( seconds ) . \ n \ n \ nCreate a new connection to the database server . \ n \ nIf the connection cannot be established , a ` RqlDriverError ` exception \ nwill be thrown . \ n \ n " <nl> } , <nl> " year " : { <nl> " examples " : [ <nl> <nl> " examples " : [ <nl> { <nl> " code " : " conn . close ( ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Close an open connection . < / p > " <nl> + " description " : " < p > < strong > Example : < / strong > Close an open connection , waiting for noreply writes to finish . < / p > " <nl> + } , <nl> + { <nl> + " code " : " conn . close ( noreply_wait = False ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Close an open connection immediately . < / p > " <nl> } <nl> ] , <nl> " name " : " close " , <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nClose an open connection . Closing a connection cancels all outstanding requests and frees \ nthe memory associated with the open requests . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ n \ nClose an open connection . Closing a connection waits until all \ noutstanding requests have finished and then frees any open resources \ nassociated with the connection . If ` noreply_wait ` is set to ` false ` , \ nall outstanding requests are canceled immediately . \ n \ nClosing a connection cancels all outstanding requests and frees the \ nmemory associated with any open cursors . \ n \ n \ n " <nl> } , <nl> " db_list " : { <nl> " examples " : [ <nl> <nl> ] , <nl> " description " : " \ n \ n \ n \ nAppend a value to an array . \ n \ n \ n \ n " <nl> } , <nl> + " outer_join " : { <nl> + " examples " : [ <nl> + { <nl> + " code " : " r . table ( ' marvel ' ) . outer_join ( r . table ( ' dc ' ) , \ n lambda marvelRow , dcRow : marvelRow [ ' strength ' ] < dcRow [ ' strength ' ] ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Construct a sequence of documents containing all cross - universe matchups \ nwhere a marvel hero would lose , but keep marvel heroes who would never lose a matchup in \ nthe sequence . < / p > " <nl> + } <nl> + ] , <nl> + " name " : " outer_join " , <nl> + " io " : [ <nl> + [ <nl> + " sequence " , <nl> + " stream " <nl> + ] , <nl> + [ <nl> + " array " , <nl> + " array " <nl> + ] <nl> + ] , <nl> + " description " : " \ n \ n \ n \ nComputes a left outer join by retaining each row in the left table even if no match was \ nfound in the right table . \ n \ n \ n \ n " <nl> + } , <nl> " epoch_time " : { <nl> " examples " : [ <nl> { <nl> <nl> " time " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nCreate a time object based on seconds since epoch . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nCreate a time object based on seconds since epoch . The first argument is a double and \ nwill be rounded to three decimal places ( millisecond - precision ) . \ n \ n \ n \ n " <nl> } , <nl> " + " : { <nl> " examples " : [ <nl> <nl> " run " : { <nl> " examples " : [ <nl> { <nl> - " code " : " for doc in r . table ( ' marvel ' ) . run ( conn ) : \ nprint doc " , <nl> - " description " : " < p > < strong > Example : < / strong > Call run on the connection with a query to execute the query . < / p > " <nl> + " code " : " for doc in r . table ( ' marvel ' ) . run ( conn ) : \ n print doc " , <nl> + " description " : " < p > < strong > Example : < / strong > Run a query on the connection < code > conn < / code > and print out every \ nrow in the result . < / p > " <nl> } , <nl> { <nl> " code " : " r . table ( ' marvel ' ) . run ( conn , use_outdated = True ) " , <nl> - " description " : " < p > < strong > Example : < / strong > If you are OK with potentially out of date data from all the tables \ ninvolved in this query and want potentially faster reads , pass a flag allowing out of \ ndate data in an options object . Settings for individual tables will supercede this global \ nsetting for all tables in the query . < / p > " <nl> + " description " : " < p > < strong > Example : < / strong > If you are OK with potentially out of date data from all \ nthe tables involved in this query and want potentially faster reads , \ npass a flag allowing out of date data in an options object . Settings \ nfor individual tables will supercede this global setting for all \ ntables in the query . < / p > " <nl> } , <nl> { <nl> " code " : " r . table ( ' marvel ' ) . run ( conn , noreply = True ) " , <nl> - " description " : " < p > < strong > Example : < / strong > If you just want to send a write and forget about it , you can set < code > noreply < / code > \ nto true in the options . In this case < code > run < / code > will return immediately . < / p > " <nl> + " description " : " < p > < strong > Example : < / strong > If you just want to send a write and forget about it , you \ ncan set < code > noreply < / code > to true in the options . In this case < code > run < / code > will \ nreturn immediately . < / p > " <nl> } , <nl> { <nl> " code " : " r . table ( ' marvel ' ) \ n . insert ( { ' superhero ' : ' Iron Man ' , ' superpower ' : ' Arc Reactor ' } ) \ n . run ( conn , noreply = True , durability = ' soft ' ) " , <nl> - " description " : " < p > < strong > Example : < / strong > If you want to specify whether to wait for a write to be written to disk \ n ( overriding the table ' s default settings ) , you can set < code > durability < / code > to < code > ' hard ' < / code > or \ n < code > ' soft ' < / code > in the options . < / p > " <nl> + " description " : " < p > < strong > Example : < / strong > If you want to specify whether to wait for a write to be \ nwritten to disk ( overriding the table ' s default settings ) , you can set \ n < code > durability < / code > to < code > ' hard ' < / code > or < code > ' soft ' < / code > in the options . < / p > " <nl> } , <nl> { <nl> " code " : " r . now ( ) . run ( conn , time_format = \ " raw \ " ) " , <nl> - " description " : " < p > < strong > Example : < / strong > If you do not want a time object to be converted to a native date object , you can pass a time_format flag to prevent it ( valid flags are \ " raw \ " and \ " native \ " ) . This query returns an object with two fields ( epoch_time and $ reql_type $ ) instead of a native date object . < / p > " <nl> + " description " : " < p > < strong > Example : < / strong > If you do not want a time object to be converted to a \ nnative date object , you can pass a < code > time_format < / code > flag to prevent it \ n ( valid flags are \ " raw \ " and \ " native \ " ) . This query returns an object \ nwith two fields ( < code > epoch_time < / code > and < code > $ reql_type $ < / code > ) instead of a native date \ nobject . < / p > " <nl> } <nl> ] , <nl> " name " : " run " , <nl> <nl> null <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nRun a query on a connection . \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nRun a query on a connection , returning either a single JSON result or \ na cursor , depending on the query . \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> } , <nl> - " outer_join " : { <nl> + " index_wait " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . outer_join ( r . table ( ' dc ' ) , \ n lambda marvelRow , dcRow : marvelRow [ ' strength ' ] < dcRow [ ' strength ' ] ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Construct a sequence of documents containing all cross - universe matchups \ nwhere a marvel hero would lose , but keep marvel heroes who would never lose a matchup in \ nthe sequence . < / p > " <nl> + " code " : " r . table ( ' test ' ) . index_wait ( ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Wait for all indexes on the table < code > test < / code > to be ready : < / p > " <nl> + } , <nl> + { <nl> + " code " : " r . table ( ' test ' ) . index_wait ( ' timestamp ' ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Wait for the index < code > timestamp < / code > to be ready : < / p > " <nl> } <nl> ] , <nl> - " name " : " outer_join " , <nl> + " name " : " index_wait " , <nl> " io " : [ <nl> [ <nl> - " sequence " , <nl> - " stream " <nl> - ] , <nl> - [ <nl> - " array " , <nl> + " table " , <nl> " array " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nComputes a left outer join by retaining each row in the left table even if no match was \ nfound in the right table . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nWait for the specified indexes on this table to be ready , or for all \ nindexes on this table to be ready if no indexes are specified . \ n \ n \ n " <nl> } , <nl> " seconds " : { <nl> " examples " : [ <nl> <nl> " filter " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( ' users ' ) . filter ( { ' active ' : True , ' profile ' : { ' age ' : 30 } } ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Get all active users aged 30 . < / p > " <nl> + " code " : " r . table ( ' users ' ) . filter ( { \ " age \ " : 30 } ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Get all the users that are 30 years old . < / p > " <nl> + } , <nl> + { <nl> + " code " : " r . table ( \ " users \ " ) . filter ( r . row [ \ " age \ " ] > 18 ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Get all the users that are more than 18 years old . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( ' users ' ) . filter ( { ' active ' : True , ' profile ' : r . literal ( { ' age ' : 30 } ) } ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Filter supports the r . literal syntax if you want to get an exact match . < / p > " <nl> + " code " : " r . table ( \ " users \ " ) . filter ( r . row [ \ " age \ " ] < 18 , default = True ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Get all the users that are less than 18 years old or whose age is unknown \ n ( field < code > age < / code > missing ) . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( ' users ' ) . filter ( r . row [ ' magazines ' ] > 5 ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Select all documents where the ' magazines ' field is greater than 5 . < / p > " <nl> + " code " : " r . table ( \ " users \ " ) . filter ( r . row [ \ " age \ " ] > 18 , default = r . error ( ) ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Get all the users that are more than 18 years old . Throw an error if a \ ndocument is missing the field < code > age < / code > . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . filter ( \ n lambda hero : hero [ ' abilities ' ] . has_fields ( ' super - strength ' ) \ n ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Select all documents where the ' abilities ' embedded document has an \ nattribute called ' super - strength ' . < / p > " <nl> + " code " : " r . table ( ' users ' ) . filter ( lambda user : \ n user . has_fields ( ' phone_number ' ) \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Select all users who have given their phone number ( all the documents \ nwhose field < code > phone_number < / code > is defined and not < code > None < / code > ) . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . filter ( \ n r . row [ ' powers ' ] . filter ( lambda el : el = = 10 ) . count ( ) > 0 \ n ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Select all documents where the field ' powers ' containing an array has an \ nelement equal to 10 . < / p > " <nl> + " code " : " r . table ( \ " users \ " ) . filter ( lambda user : \ n user [ \ " subscription_date \ " ] . during ( r . time ( 2012 , 1 , 1 , ' Z ' ) , r . time ( 2013 , 1 , 1 , ' Z ' ) ) \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Retrieve all the users who subscribed between January 1st , 2012 \ n ( included ) and January 1st , 2013 ( excluded ) . < / p > " <nl> + } , <nl> + { <nl> + " code " : " r . table ( \ " users \ " ) . filter ( lambda user : \ n user [ \ " email \ " ] . match ( \ " @ gmail . com $ \ " ) \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Retrieve all the users who have a gmail account ( whose field < code > email < / code > ends \ nwith < code > @ gmail . com < / code > ) . < / p > " <nl> + } , <nl> + { <nl> + " code " : " { \ n \ " name \ " : < type ' str ' > \ n \ " places_visited \ " : [ < type ' str ' > ] \ n } " , <nl> + " description " : " < p > < strong > Example : < / strong > Filter based on the presence of a value in an array . < / p > \ n < p > Suppose the table < code > users < / code > has the following schema < / p > " <nl> + } , <nl> + { <nl> + " code " : " { \ n \ " id \ " : < type ' str ' > \ n \ " name \ " : { \ n \ " first \ " : < type ' str ' > , \ n \ " middle \ " : < type ' str ' > , \ n \ " last \ " : < type ' str ' > \ n } \ n } " , <nl> + " description " : " < p > < strong > Example : < / strong > Filter based on nested fields . < / p > \ n < p > Suppose we have a table < code > users < / code > containing documents with the following schema . < / p > " <nl> } <nl> ] , <nl> " name " : " filter " , <nl> <nl> " array " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nGet all the documents for which the given predicate is true . \ n \ nfilter can be called on a sequence , selection , or a field containing an array of \ nelements . The return type is the same as the type on which the function was called on . \ nThe body of every filter is wrapped in an implicit ` . default ( false ) ` , and the default \ nvalue can be changed by passing the optional argument ` default ` . Setting this optional \ nargument to ` r . error ( ) ` will cause any non - existence errors to abort the filter . \ n \ n \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nGet all the documents for which the given predicate is true . \ n \ n ` filter ` can be called on a sequence , selection , or a field containing an array of \ nelements . The return type is the same as the type on which the function was called on . \ n \ nThe body of every filter is wrapped in an implicit ` . default ( False ) ` , which means that \ nif a non - existence errors is thrown ( when you try to access a field that does not exist \ nin a document ) , RethinkDB will just ignore the document . \ nThe ` default ` value can be changed by passing the named argument ` default ` . \ nSetting this optional argument to ` r . error ( ) ` will cause any non - existence errors to \ nreturn a ` RqlRuntimeError ` . \ n \ n \ n \ nA more general way to write the previous query is to use ` r . row ` . \ n \ n ` ` ` py \ nr . table ( ' users ' ) . filter ( r . row [ \ " age \ " ] = = 30 ) . run ( conn ) \ n ` ` ` \ n \ nHere the predicate is ` r . row [ \ " age \ " ] = = 30 ` . \ n \ n - ` r . row ` refers to the current document \ n - ` r . row [ \ " age \ " ] ` refers to the field ` age ` of the current document \ n - ` r . row [ \ " age \ " ] = = 30 ` returns ` True ` if the field ` age ` is 30 \ n \ n \ nAn even more general way to write the same query is to use a lambda function . \ nRead the documentation about [ r . row ] ( . . / row / ) to know more about the differences \ nbetween ` r . row ` and lambda functions in ReQL . \ n \ n ` ` ` py \ nr . table ( ' users ' ) . filter ( lambda user : \ n user [ \ " age \ " ] = = 30 \ n ) . run ( conn ) \ n ` ` ` \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ nRetrieve all the users whose field ` places_visited ` contains ` France ` . \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( lambda user : \ n user [ \ " places_visited \ " ] . contains ( \ " France \ " ) \ n ) . run ( conn ) \ n ` ` ` \ n \ n \ nRetrieve all users named \ " William Adama \ " ( first name \ " William \ " , last name \ n \ " Adama \ " ) , with any middle name . \ n \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( { \ n \ " name \ " : { \ n \ " first \ " : \ " William \ " , \ n \ " last \ " : \ " Adama \ " \ n } \ n } ) . run ( conn ) \ n ` ` ` \ n \ nIf you want an exact match for a field that is an object , you will have to use ` r . literal ` . \ n \ nRetrieve all users named \ " William Adama \ " ( first name \ " William \ " , last name \ n \ " Adama \ " ) , and who do not have a middle name . \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( r . literal ( { \ n \ " name \ " : { \ n \ " first \ " : \ " William \ " , \ n \ " last \ " : \ " Adama \ " \ n } \ n } ) ) . run ( conn ) \ n ` ` ` \ n \ n \ nThe equivalent queries with a lambda function . \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( lambda user : \ n ( user [ \ " name \ " ] [ \ " first \ " ] = = \ " William \ " ) \ n & ( user [ \ " name \ " ] [ \ " last \ " ] = = \ " Adama \ " ) \ n ) . run ( conn ) \ n ` ` ` \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( lambda user : \ n user [ \ " name \ " ] = = { \ n \ " first \ " : \ " William \ " , \ n \ " last \ " : \ " Adama \ " \ n } \ n ) . run ( conn ) \ n ` ` ` \ n " <nl> } , <nl> " union " : { <nl> " examples " : [ <nl> <nl> ] , <nl> " description " : " \ n \ n \ n \ nDelete one or more documents from a table . The optional argument return_vals will return \ nthe old value of the row you ' re deleting when set to true ( only valid for single - row \ ndeletes ) . The optional argument durability with value ' hard ' or ' soft ' will override the \ ntable or query ' s default durability setting . \ n \ nDelete returns an object that contains the following attributes : \ n \ n - ` deleted ` : the number of documents that were deleted \ n - ` skipped ` : the number of documents from the selection that were left unmodified because \ nthere was nothing to do . For example , if you delete a row that has already been deleted , \ nthat row will be skipped \ n - ` errors ` L the number of errors encountered while deleting \ nif errors occured , first_error contains the text of the first error \ n - ` inserted ` , ` replaced ` , and ` unchanged ` : all 0 for a delete operation . \ n \ n \ n \ n \ n \ n \ n \ n " <nl> } , <nl> + " table_list " : { <nl> + " examples " : [ <nl> + { <nl> + " code " : " r . db ( ' test ' ) . table_list ( ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > List all tables of the ' test ' database . < / p > " <nl> + } <nl> + ] , <nl> + " name " : " table_list " , <nl> + " io " : [ <nl> + [ <nl> + " db " , <nl> + " array " <nl> + ] <nl> + ] , <nl> + " description " : " \ n \ n \ n \ nList all table names in a database . The result is a list of strings . \ n \ n " <nl> + } , <nl> " with_fields " : { <nl> " examples " : [ <nl> { <nl> <nl> ] , <nl> " description " : " \ n \ n \ n \ nGet a single field from an object . If called on a sequence , gets that field from every \ nobject in the sequence , skipping objects that lack it . \ n \ n " <nl> } , <nl> - " contains " : { <nl> + " * " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . get ( ' ironman ' ) [ ' opponents ' ] . contains ( ' superman ' ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Has Iron Man ever fought Superman ? < / p > " <nl> + " code " : " ( r . expr ( 2 ) * 2 ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > It ' s as easy as 2 * 2 = 4 . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . get ( ' ironman ' ) [ ' battles ' ] . contains ( lambda battle : \ n ( battle [ ' winner ' ] = = ' ironman ' ) & ( battle [ ' loser ' ] = = ' superman ' ) \ n ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Has Iron Man ever defeated Superman in battle ? < / p > " <nl> + " code " : " ( r . expr ( [ \ " This \ " , \ " is \ " , \ " the \ " , \ " song \ " , \ " that \ " , \ " never \ " , \ " ends . \ " ] ) * 100 ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Arrays can be multiplied by numbers as well . < / p > " <nl> } <nl> ] , <nl> - " name " : " contains " , <nl> + " name " : " * " , <nl> " io " : [ <nl> [ <nl> - " sequence " , <nl> - " value " <nl> + " number " , <nl> + " number " <nl> + ] , <nl> + [ <nl> + " array " , <nl> + " array " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nReturns whether or not a sequence contains all the specified values , or if functions are \ nprovided instead , returns whether or not a sequence contains values matching all the \ nspecified functions . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nMultiply two numbers , or make a periodic array . \ n \ n \ n \ n \ n " <nl> } , <nl> " > = " : { <nl> " examples " : [ <nl> <nl> " use " : { <nl> " examples " : [ <nl> { <nl> - " code " : " conn . use ( ' heroes ' ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Change the default database so that we don ' t need to specify the database \ nwhen referencing a table . < / p > " <nl> + " code " : " conn . use ( ' marvel ' ) \ nr . table ( ' heroes ' ) . run ( conn ) # refers to r . db ( ' marvel ' ) . table ( ' heroes ' ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Change the default database so that we don ' t need to \ nspecify the database when referencing a table . < / p > " <nl> } <nl> ] , <nl> " name " : " use " , <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nChange the default database on this connection . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nChange the default database on this connection . \ n \ n " <nl> } , <nl> " order_by " : { <nl> " examples " : [ <nl> <nl> " description " : " < p > < strong > Example : < / strong > Let ' s lead with our best vanquishers by specify descending ordering . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . order_by ( lambda doc : doc [ ' enemiesVanquished ' ] + doc [ ' ramselsSaved ' ] ) . run ( conn ) " , <nl> + " code " : " r . table ( ' marvel ' ) . order_by ( lambda doc : doc [ ' enemiesVanquished ' ] + doc [ ' damselsSaved ' ] ) . run ( conn ) " , <nl> " description " : " < p > < strong > Example : < / strong > You can use a function for ordering instead of just selecting an attribute . < / p > " <nl> } , <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . order_by ( r . desc ( lambda doc : doc [ ' enemiesVanquished ' ] + doc [ ' ramselsSaved ' ] ) ) . run ( conn ) " , <nl> + " code " : " r . table ( ' marvel ' ) . order_by ( r . desc ( lambda doc : doc [ ' enemiesVanquished ' ] + doc [ ' damselsSaved ' ] ) ) . run ( conn ) " , <nl> " description " : " < p > < strong > Example : < / strong > Functions can also be used descendingly . < / p > " <nl> } <nl> ] , <nl> <nl> ] , <nl> " description " : " \ n \ n \ n \ nRemove duplicate elements from the sequence . \ n \ n " <nl> } , <nl> - " * " : { <nl> + " contains " : { <nl> " examples " : [ <nl> { <nl> - " code " : " ( r . expr ( 2 ) * 2 ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > It ' s as easy as 2 * 2 = 4 . < / p > " <nl> + " code " : " r . table ( ' marvel ' ) . get ( ' ironman ' ) [ ' opponents ' ] . contains ( ' superman ' ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Has Iron Man ever fought Superman ? < / p > " <nl> } , <nl> { <nl> - " code " : " ( r . expr ( [ \ " This \ " , \ " is \ " , \ " the \ " , \ " song \ " , \ " that \ " , \ " never \ " , \ " ends . \ " ] ) * 100 ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Arrays can be multiplied by numbers as well . < / p > " <nl> + " code " : " r . table ( ' marvel ' ) . get ( ' ironman ' ) [ ' battles ' ] . contains ( lambda battle : \ n ( battle [ ' winner ' ] = = ' ironman ' ) & ( battle [ ' loser ' ] = = ' superman ' ) \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > Has Iron Man ever defeated Superman in battle ? < / p > " <nl> } <nl> ] , <nl> - " name " : " * " , <nl> + " name " : " contains " , <nl> " io " : [ <nl> [ <nl> - " number " , <nl> - " number " <nl> - ] , <nl> - [ <nl> - " array " , <nl> - " array " <nl> + " sequence " , <nl> + " value " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nMultiply two numbers , or make a periodic array . \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nReturns whether or not a sequence contains all the specified values , or if functions are \ nprovided instead , returns whether or not a sequence contains values matching all the \ nspecified functions . \ n \ n \ n \ n " <nl> } , <nl> " table_drop " : { <nl> " examples " : [ <nl> <nl> " object " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nGet information about a RQL value . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nGet information about a ReQL value . \ n \ n \ n \ n " <nl> } , <nl> " default " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( ' projects ' ) . map ( \ n lambda p : p [ ' staff ' ] . default ( 0 ) + p [ ' management ' ] . default ( 0 ) \ n ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Stark Industries made the mistake of trusting an intern with data entry , \ nand now a bunch of fields are missing from some of their documents . Iron Man takes a \ nbreak from fighting Mandarin to write some safe analytics queries . < / p > " <nl> + " code " : " r . table ( \ " users \ " ) . filter ( lambda user : \ n ( user [ \ " age \ " ] < 18 ) . default ( True ) \ n ) . run ( conn ) " , <nl> + " description " : " < p > < strong > Example : < / strong > The < code > default < / code > command can be useful to filter documents too . Suppose \ nwe want to retrieve all our users who are not grown - ups or whose age is unknown \ n ( i . e the field < code > age < / code > is missing or equals < code > None < / code > ) . We can do it with this query : < / p > " <nl> } <nl> ] , <nl> " name " : " default " , <nl> <nl> " any " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nHandle non - existence errors . Tries to evaluate and return its first argument . If an \ nerror related to the absence of a value is thrown in the process , or if its first \ nargument returns null , returns its second argument . ( Alternatively , the second argument \ nmay be a function which will be called with either the text of the non - existence error \ nor null . ) \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nHandle non - existence errors . Tries to evaluate and return its first argument . If an \ nerror related to the absence of a value is thrown in the process , or if its first \ nargument returns ` None ` , returns its second argument . ( Alternatively , the second argument \ nmay be a function which will be called with either the text of the non - existence error \ nor ` None ` . ) \ n \ n \ n__Exmple : __ Suppose we want to retrieve the titles and authors of the table ` posts ` . \ nIn the case where the author field is missing or ` None ` , we want to retrieve the string \ n ` Anonymous ` . \ n \ n ` ` ` py \ nr . table ( \ " posts \ " ) . map ( lambda post : \ n { \ n \ " title \ " : post [ \ " title \ " ] , \ n \ " author \ " : post [ \ " author \ " ] . default ( \ " Anonymous \ " ) \ n } \ n ) . run ( conn ) \ n ` ` ` \ n \ nWe can rewrite the previous query with ` r . branch ` too . \ n \ n ` ` ` py \ nr . table ( \ " posts \ " ) . map ( lambda post : \ n r . branch ( \ n post . has_fields ( \ " author \ " ) , \ n { \ n \ " title \ " : post [ \ " title \ " ] , \ n \ " author \ " : post [ \ " author \ " ] \ n } , \ n { \ n \ " title \ " : post [ \ " title \ " ] , \ n \ " author \ " : \ " Anonymous \ " \ n } \ n ) \ n ) . run ( conn ) \ n ` ` ` \ n \ n \ n \ nOne more way to write the previous query is to set the age to be ` - 1 ` when the \ nfield is missing . \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( lambda user : \ n user [ \ " age \ " ] . default ( - 1 ) < 18 \ n ) . run ( conn ) \ n ` ` ` \ n \ nOne last way to do the same query is to use ` has_fields ` . \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( lambda user : \ n user . has_fields ( \ " age \ " ) . not_ ( ) | ( user [ \ " age \ " ] < 18 ) \ n ) . run ( conn ) \ n ` ` ` \ n \ nThe body of every ` filter ` is wrapped in an implicit ` . default ( False ) ` . You can overwrite \ nthe value ` False ` by passing an option in filter , so the previous query can also be \ nwritten like this . \ n \ n ` ` ` py \ nr . table ( \ " users \ " ) . filter ( \ n lambda user : ( user [ \ " age \ " ] < 18 ) . default ( True ) , \ n default = True \ n ) . run ( conn ) \ n ` ` ` \ n \ n " <nl> } , <nl> " expr " : { <nl> " examples " : [ <nl> { <nl> " code " : " r . expr ( { ' a ' : ' b ' } ) . merge ( { ' b ' : [ 1 , 2 , 3 ] } ) . run ( conn ) " , <nl> - " description " : " < p > < strong > Example : < / strong > Objects wrapped with expr can then be manipulated by RQL API functions . < / p > " <nl> + " description " : " < p > < strong > Example : < / strong > Objects wrapped with expr can then be manipulated by ReQL API functions . < / p > " <nl> } <nl> ] , <nl> " name " : " expr " , <nl> <nl> " value " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nConstruct a RQL JSON object from a native object . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nConstruct a ReQL JSON object from a native object . \ n \ n \ n \ n " <nl> } , <nl> " day_of_week " : { <nl> " examples " : [ <nl> <nl> " r " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nThe top - level RQL namespace . \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nThe top - level ReQL namespace . \ n \ n \ n " <nl> } , <nl> " limit " : { <nl> " examples " : [ <nl> <nl> " timezone " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( \ " users \ " ) . filter ( lambda user : \ n user [ \ " subscriptionDate \ " ] . timezone ( ) = = \ " - 07 : 00 \ " \ n ) " , <nl> + " code " : " r . table ( \ " users \ " ) . filter ( lambda user : \ n user [ \ " subscriptionDate \ " ] . timezone ( ) = = \ " - 07 : 00 \ " \ n ) " , <nl> " description " : " < p > < strong > Example : < / strong > Return all the users in the \ " - 07 : 00 \ " timezone . < / p > " <nl> } <nl> ] , <nl> <nl> " boolean " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nTest if an object has all of the specified fields . An object has a field if it has the \ nspecified key and that key maps to a non - null value . For instance , the object \ n ` { ' a ' : 1 , ' b ' : 2 , ' c ' : null } ` has the fields ` a ` and ` b ` . \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nTest if an object has all of the specified fields . An object has a field if it has the \ nspecified key and that key maps to a non - null value . For instance , the object \ n ` { ' a ' : 1 , ' b ' : 2 , ' c ' : None } ` has the fields ` a ` and ` b ` . \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> } , <nl> " % " : { <nl> " examples " : [ <nl> <nl> " map " : { <nl> " examples " : [ <nl> { <nl> - " code " : " r . table ( ' marvel ' ) . map ( lambda hero : \ n hero [ ' combatPower ' ] + hero [ ' compassionPower ' ] * 2 \ n ) . run ( conn ) " , <nl> + " code " : " r . table ( ' marvel ' ) . map ( lambda hero : \ n hero [ ' combatPower ' ] + hero [ ' compassionPower ' ] * 2 \ n ) . run ( conn ) " , <nl> " description " : " < p > < strong > Example : < / strong > Construct a sequence of hero power ratings . < / p > " <nl> } <nl> ] , <nl> <nl> " object " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nUpdate JSON documents in a table . Accepts a JSON document , a RQL expression , or a \ ncombination of the two . You can pass options like ` returnVals ` that will return the old \ nand new values of the row you have modified . \ n \ nUpdate returns an object that contains the following attributes : \ n \ n - ` replaced ` : the number of documents that were updated \ n - ` unchanged ` : the number of documents that would have been modified except the new \ nvalue was the same as the old value ; \ n - ` skipped ` : the number of documents that were left unmodified because there was nothing \ nto do : either the row didn ' t exist or the new value is null ; \ n - ` errors ` : the number of errors encountered while performing the update ; if errors \ noccured , first_error contains the text of the first error ; \ n - ` deleted ` and ` inserted ` : 0 for an update operation . \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nUpdate JSON documents in a table . Accepts a JSON document , a ReQL expression , or a \ ncombination of the two . You can pass options like ` returnVals ` that will return the old \ nand new values of the row you have modified . \ n \ nUpdate returns an object that contains the following attributes : \ n \ n - ` replaced ` : the number of documents that were updated \ n - ` unchanged ` : the number of documents that would have been modified except the new \ nvalue was the same as the old value ; \ n - ` skipped ` : the number of documents that were left unmodified because there was nothing \ nto do : either the row didn ' t exist or the new value is ` None ` ; \ n - ` errors ` : the number of errors encountered while performing the update ; if errors \ noccured , first_error contains the text of the first error ; \ n - ` deleted ` and ` inserted ` : 0 for an update operation . \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> } , <nl> " is_empty " : { <nl> " examples " : [ <nl> <nl> " object " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nReplace documents in a table . Accepts a JSON document or a RQL expression , and replaces \ nthe original document with the new one . The new document must have the same primary key \ nas the original document . The optional argument durability with value ' hard ' or ' soft ' \ nwill override the table or query ' s default durability setting . The optional argument \ nreturn_vals will return the old and new values of the row you ' re modifying when set to \ ntrue ( only valid for single - row replacements ) . The optional argument non_atomic lets you \ npermit non - atomic updates . \ n \ nReplace returns an object that contains the following attributes : \ n \ n - ` replaced ` : the number of documents that were replaced \ n - ` unchanged ` : the number of documents that would have been modified , except that the \ nnew value was the same as the old value \ n - ` inserted ` : the number of new documents added . You can have new documents inserted if \ nyou do a point - replace on a key that isn ' t in the table or you do a replace on a \ nselection and one of the documents you are replacing has been deleted \ n - ` deleted ` : the number of deleted documents when doing a replace with null \ n - ` errors ` : the number of errors encountered while performing the replace ; if errors \ noccurred performing the replace , first_error contains the text of the first error encountered \ n - ` skipped ` : 0 for a replace operation \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nReplace documents in a table . Accepts a JSON document or a ReQL expression , and replaces \ nthe original document with the new one . The new document must have the same primary key \ nas the original document . The optional argument durability with value ' hard ' or ' soft ' \ nwill override the table or query ' s default durability setting . The optional argument \ nreturn_vals will return the old and new values of the row you ' re modifying when set to \ ntrue ( only valid for single - row replacements ) . The optional argument non_atomic lets you \ npermit non - atomic updates . \ n \ nReplace returns an object that contains the following attributes : \ n \ n - ` replaced ` : the number of documents that were replaced \ n - ` unchanged ` : the number of documents that would have been modified , except that the \ nnew value was the same as the old value \ n - ` inserted ` : the number of new documents added . You can have new documents inserted if \ nyou do a point - replace on a key that isn ' t in the table or you do a replace on a \ nselection and one of the documents you are replacing has been deleted \ n - ` deleted ` : the number of deleted documents when doing a replace with ` None ` \ n - ` errors ` : the number of errors encountered while performing the replace ; if errors \ noccurred performing the replace , first_error contains the text of the first error encountered \ n - ` skipped ` : 0 for a replace operation \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> } , <nl> " eq_join " : { <nl> " examples " : [ <nl> <nl> " table " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nCreate a table . A RethinkDB table is a collection of JSON documents . \ n \ nIf successful , the operation returns an object : ` { created : 1 } ` . If a table with the same \ nname already exists , the operation throws ` RqlRuntimeError ` . \ nNote : that you can only use alphanumeric characters and underscores for the table name . \ n \ nWhen creating a table you can specify the following options : \ n \ n - ` primary_key ` : the name of the primary key . The default primary key is id ; \ n - ` durability ` : if set to ` soft ` , this enables _soft durability_ on this table : \ nwrites will be acknowledged by the server immediately and flushed to disk in the \ nbackground . Default is ` hard ` ( acknowledgement of writes happens after data has been \ nwritten to disk ) ; \ n - ` cache_size ` : set the cache size ( in bytes ) to be used by the table . The \ ndefault is 1073741824 ( 1024MB ) ; \ n - ` datacenter ` : the name of the datacenter this table should be assigned to . \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nCreate a table . A RethinkDB table is a collection of JSON documents . \ n \ nIf successful , the operation returns an object : ` { created : 1 } ` . If a table with the same \ nname already exists , the operation throws ` RqlRuntimeError ` . \ nNote : that you can only use alphanumeric characters and underscores for the table name . \ n \ nWhen creating a table you can specify the following options : \ n \ n - ` primary_key ` : the name of the primary key . The default primary key is id ; \ n - ` durability ` : if set to ` soft ` , this enables _soft durability_ on this table : \ nwrites will be acknowledged by the server immediately and flushed to disk in the \ nbackground . Default is ` hard ` ( acknowledgement of writes happens after data has been \ nwritten to disk ) ; \ n - ` cache_size ` : set the cache size ( in bytes ) to be used by the table . The \ ndefault is 1073741824 ( 1024MB ) ; \ n - ` datacenter ` : the name of the datacenter this table should be assigned to . \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n " <nl> } , <nl> " date " : { <nl> " examples " : [ <nl> <nl> " time " <nl> ] <nl> ] , <nl> - " description " : " \ n \ n \ n \ nCreate a time object for a specific time . \ n \ n \ n \ n " <nl> + " description " : " \ n \ n \ n \ nCreate a time object for a specific time . \ n \ nA few restrictions exist on the arguments : \ n \ n - ` year ` is an integer between 1400 and 9 , 999 . \ n - ` month ` is an integer between 1 and 12 . \ n - ` day ` is an integer between 1 and 31 . \ n - ` hour ` is an integer . \ n - ` minutes ` is an integer . \ n - ` seconds ` is a double . Its value will be rounded to three decimal places \ n ( millisecond - precision ) . \ n - ` timezone ` can be ` ' Z ' ` ( for UTC ) or a string with the format ` \ u00b1 [ hh ] : [ mm ] ` . \ n \ n \ n \ n \ n " <nl> } , <nl> " splice_at " : { <nl> " examples " : [ <nl> mmm a / docs / rql / reql_docs . json <nl> ppp b / docs / rql / reql_docs . json <nl> <nl> { <nl> " api / javascript / connect / " : { <nl> - " body " : " r . connect ( opts , callback ) " , <nl> - " description " : " < p > Create a new connection to the database server . < / p > \ n < p > If the connection cannot be established , a < code > RqlDriverError < / code > exception will be thrown < / p > " , <nl> + " body " : " r . connect ( options , callback ) r . connect ( host , callback ) " , <nl> + " description " : " < p > Create a new connection to the database server . Accepts the following \ noptions : < / p > \ n < ul > \ n < li > < code > host < / code > : the host to connect to ( default < code > localhost < / code > ) . < / li > \ n < li > < code > port < / code > : the port to connect on ( default < code > 28015 < / code > ) . < / li > \ n < li > < code > db < / code > : the default database ( default < code > test < / code > ) . < / li > \ n < li > < code > authKey < / code > : the authentication key ( default none ) . < / li > \ n < / ul > \ n < p > If the connection cannot be established , a < code > RqlDriverError < / code > will be \ npassed to the callback instead of a connection . < / p > " , <nl> " url " : " connect " , <nl> " io " : [ <nl> [ <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Opens a new connection to the database . < / p > \ n < p > < code > r . connect ( { host : ' localhost ' , port : 28015 , db : ' marvel ' , authKey : ' hunter2 ' } , \ n function ( err , conn ) { . . . } ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Opens a new connection to the database . < / p > \ n < p > < code > r . connect ( { host : ' localhost ' , port : 28015 , db : ' marvel ' , authKey : ' hunter2 ' } , \ n function ( err , conn ) { . . . } ) < / code > < / p > " , <nl> " name " : " connect " <nl> } , <nl> " api / javascript / close / " : { <nl> - " body " : " conn . close ( ) " , <nl> - " description " : " < p > Close an open connection . Closing a connection cancels all outstanding requests and frees \ nthe memory associated with the open requests . < / p > " , <nl> + " body " : " conn . close ( [ opts , ] callback ) " , <nl> + " description " : " < p > Close an open connection . Accepts the following options : < / p > \ n < ul > \ n < li > < code > noreplyWait < / code > : whether to wait for noreply writes to complete \ n before closing ( default < code > true < / code > ) . If this is set to < code > false < / code > , some \ n outstanding noreply writes may be aborted . < / li > \ n < / ul > \ n < p > Closing a connection waits until all outstanding requests have \ nfinished and then frees any open resources associated with the \ nconnection . If < code > noreplyWait < / code > is set to < code > false < / code > , all outstanding \ nrequests are canceled immediately . < / p > " , <nl> " url " : " close " , <nl> " io " : [ <nl> [ <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Close an open connection . < / p > \ n < p > < code > conn . close ( ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Close an open connection , waiting for noreply writes to finish . < / p > \ n < p > < code > conn . close ( function ( err ) { if ( err ) throw err ; } ) < / code > < / p > \ n < p > < strong > Example : < / strong > Close an open connection immediately . < / p > \ n < p > < code > conn . close ( { noreplyWait : false } , function ( err ) { if ( err ) throw err ; } ) < / code > < / p > " , <nl> " name " : " close " <nl> } , <nl> " api / javascript / replace / " : { <nl> " body " : " table . replace ( json | expr [ , { durability : ' soft ' , return_vals : true } ] ) & rarr ; objectselection . replace ( json | expr [ , { durability : ' soft ' , return_vals : true } ] ) & rarr ; objectsingleSelection . replace ( json | expr [ , { durability : ' soft ' , return_vals : true } ] ) & rarr ; object " , <nl> - " description " : " < p > Replace documents in a table . Accepts a JSON document or a RQL expression , and replaces \ nthe original document with the new one . The new document must have the same primary key \ nas the original document . The optional argument durability with value ' hard ' or ' soft ' \ nwill override the table or query ' s default durability setting . The optional argument \ n < code > return_vals < / code > will return the old and new values of the row you ' re modifying when set to \ ntrue ( only valid for single - row replacements ) . The optional argument < code > non_atomic < / code > lets you \ npermit non - atomic updates . < / p > \ n < p > Replace returns an object that contains the following attributes : < / p > \ n < ul > \ n < li > < code > replaced < / code > : the number of documents that were replaced < / li > \ n < li > < code > unchanged < / code > : the number of documents that would have been modified , except that the \ nnew value was the same as the old value < / li > \ n < li > < code > inserted < / code > : the number of new documents added . You can have new documents inserted if \ nyou do a point - replace on a key that isn ' t in the table or you do a replace on a \ nselection and one of the documents you are replacing has been deleted < / li > \ n < li > < code > deleted < / code > : the number of deleted documents when doing a replace with null < / li > \ n < li > < code > errors < / code > : the number of errors encountered while performing the replace ; if errors \ noccurred performing the replace , first_error contains the text of the first error encountered < / li > \ n < li > < code > skipped < / code > : 0 for a replace operation < / li > \ n < / ul > " , <nl> + " description " : " < p > Replace documents in a table . Accepts a JSON document or a ReQL expression , and replaces \ nthe original document with the new one . The new document must have the same primary key \ nas the original document . The optional argument durability with value ' hard ' or ' soft ' \ nwill override the table or query ' s default durability setting . The optional argument \ n < code > return_vals < / code > will return the old and new values of the row you ' re modifying when set to \ ntrue ( only valid for single - row replacements ) . The optional argument < code > non_atomic < / code > lets you \ npermit non - atomic updates . < / p > \ n < p > Replace returns an object that contains the following attributes : < / p > \ n < ul > \ n < li > < code > replaced < / code > : the number of documents that were replaced < / li > \ n < li > < code > unchanged < / code > : the number of documents that would have been modified , except that the \ nnew value was the same as the old value < / li > \ n < li > < code > inserted < / code > : the number of new documents added . You can have new documents inserted if \ nyou do a point - replace on a key that isn ' t in the table or you do a replace on a \ nselection and one of the documents you are replacing has been deleted < / li > \ n < li > < code > deleted < / code > : the number of deleted documents when doing a replace with null < / li > \ n < li > < code > errors < / code > : the number of errors encountered while performing the replace ; if errors \ noccurred performing the replace , first_error contains the text of the first error encountered < / li > \ n < li > < code > skipped < / code > : 0 for a replace operation < / li > \ n < / ul > " , <nl> " url " : " replace " , <nl> " io " : [ <nl> [ <nl> <nl> " name " : " get " <nl> } , <nl> " api / javascript / add_listener / " : { <nl> - " body " : " connection . addListener ( event , listener ) " , <nl> + " body " : " conn . addListener ( event , listener ) " , <nl> " description " : " < p > The connection object also supports the event emitter interface so you can listen for \ nchanges in connection state . < / p > " , <nl> " url " : " add_listener " , <nl> " io " : [ <nl> <nl> " example " : " < p > < strong > Example : < / strong > It ' s as easy as 2 * 2 = 4 . < / p > \ n < p > < code > r . expr ( 2 ) . mul ( 2 ) . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " mul " <nl> } , <nl> + " api / javascript / index_wait / " : { <nl> + " body " : " table . indexWait ( [ , index . . . ] ) & rarr ; array " , <nl> + " description " : " < p > Wait for the specified indexes on this table to be ready , or for all \ nindexes on this table to be ready if no indexes are specified . < / p > " , <nl> + " url " : " index_wait " , <nl> + " io " : [ <nl> + [ <nl> + " table " , <nl> + " array " <nl> + ] <nl> + ] , <nl> + " example " : " < p > < strong > Example : < / strong > Wait for all indexes on the table < code > test < / code > to be ready : < / p > \ n < p > < code > r . table ( ' test ' ) . indexWait ( ) . run ( conn , callback ) < / code > < / p > \ n < p > < strong > Example : < / strong > Wait for the index < code > timestamp < / code > to be ready : < / p > \ n < p > < code > r . table ( ' test ' ) . indexWait ( ' timestamp ' ) . run ( conn , callback ) < / code > < / p > " , <nl> + " name " : " indexWait " <nl> + } , <nl> " api / javascript / index_create / " : { <nl> " body " : " table . indexCreate ( indexName [ , indexFunction ] ) & rarr ; object " , <nl> " description " : " < p > Create a new secondary index on this table . < / p > " , <nl> <nl> " name " : " indexCreate " <nl> } , <nl> " api / javascript / each / " : { <nl> - " body " : " cursor . each ( callback [ , onFinishedCallback ] ) " , <nl> + " body " : " cursor . each ( callback [ , onFinishedCallback ] ) array . each ( callback [ , onFinishedCallback ] ) " , <nl> " description " : " < p > Lazily iterate over the result set one element at a time . < / p > " , <nl> " url " : " each " , <nl> " io " : [ <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Let ' s process all the elements ! < / p > \ n < p > < code > cur . each ( function ( err , row ) { \ n processRow ( row ) ; \ n } ) ; < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Let ' s process all the elements ! < / p > \ n < p > < code > cursor . each ( function ( err , row ) { \ n if ( err ) throw err ; \ n processRow ( row ) ; \ n } ) ; < / code > < / p > " , <nl> " name " : " each " <nl> } , <nl> " api / javascript / year / " : { <nl> <nl> " example " : " < p > < strong > Example : < / strong > The object ( s ) passed to do ( ) can be bound to name ( s ) . The last argument is the expression to evaluate in the context of the bindings . < / p > \ n < p > < code > r . do ( r . table ( ' marvel ' ) . get ( ' IronMan ' ) , \ n function ( ironman ) { return ironman ( ' name ' ) ; } \ n ) . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " do " <nl> } , <nl> + " api / javascript / noreply_wait / " : { <nl> + " body " : " conn . noreplyWait ( callback ) " , <nl> + " description " : " < p > < code > noreplyWait < / code > ensures that previous queries with the < code > noreply < / code > flag have been processed \ nby the server . Note that this guarantee only applies to queries run on the given connection . < / p > " , <nl> + " url " : " noreply_wait " , <nl> + " io " : [ <nl> + [ <nl> + " connection " , <nl> + null <nl> + ] <nl> + ] , <nl> + " example " : " < p > < strong > Example : < / strong > We have previously run queries with the < code > noreply < / code > argument set to < code > true < / code > . Now \ nwait until the server has processed them . < / p > \ n < p > < code > conn . noreplyWait ( function ( err ) { . . . } ) < / code > < / p > " , <nl> + " name " : " noreplyWait " <nl> + } , <nl> " api / javascript / with_fields / " : { <nl> " body " : " sequence . withFields ( [ selector1 , selector2 . . . ] ) & rarr ; streamarray . withFields ( [ selector1 , selector2 . . . ] ) & rarr ; array " , <nl> " description " : " < p > Takes a sequence of objects and a list of fields . If any objects in the sequence don ' t \ nhave all of the specified fields , they ' re dropped from the sequence . The remaining \ nobjects have the specified fields plucked out . ( This is identical to < code > has_fields < / code > \ nfollowed by < code > pluck < / code > on a sequence . ) < / p > " , <nl> <nl> " name " : " setDifference " <nl> } , <nl> " api / javascript / reconnect / " : { <nl> - " body " : " conn . reconnect ( ) " , <nl> - " description " : " < p > Close and attempt to reopen a connection . Has the effect of canceling any outstanding \ nrequest while keeping the connection open . < / p > " , <nl> + " body " : " conn . reconnect ( [ opts , ] callback ) " , <nl> + " description " : " < p > Close and reopen a connection . Accepts the following options : < / p > \ n < ul > \ n < li > < code > noreplyWait < / code > : whether to wait for noreply writes to complete \ n before closing ( default < code > true < / code > ) . If this is set to < code > false < / code > , some \ n outstanding noreply writes may be aborted . < / li > \ n < / ul > \ n < p > Closing a connection waits until all outstanding requests have \ nfinished . If < code > noreplyWait < / code > is set to < code > false < / code > , all outstanding \ nrequests are canceled immediately . < / p > " , <nl> " url " : " reconnect " , <nl> " io " : [ <nl> [ <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Cancel outstanding requests / queries that are no longer needed . < / p > \ n < p > < code > conn . reconnect ( function ( errror , connection ) { . . . } ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Cancel outstanding requests / queries that are no longer needed . < / p > \ n < p > < code > conn . reconnect ( { noreplyWait : false } , function ( errror , connection ) { . . . } ) < / code > < / p > " , <nl> " name " : " reconnect " <nl> } , <nl> " api / javascript / time_of_day / " : { <nl> <nl> } , <nl> " api / javascript / default / " : { <nl> " body " : " value . default ( default_value ) & rarr ; anysequence . default ( default_value ) & rarr ; any " , <nl> - " description " : " < p > Handle non - existence errors . Tries to evaluate and return its first argument . If an \ nerror related to the absence of a value is thrown in the process , or if its first \ nargument returns null , returns its second argument . ( Alternatively , the second argument \ nmay be a function which will be called with either the text of the non - existence error \ nor null . ) < / p > " , <nl> + " description " : " < p > Handle non - existence errors . Tries to evaluate and return its first argument . If an \ nerror related to the absence of a value is thrown in the process , or if its first \ nargument returns < code > null < / code > , returns its second argument . ( Alternatively , the second argument \ nmay be a function which will be called with either the text of the non - existence error \ nor < code > null < / code > . ) < / p > \ n < p > < strong > Exmple : < / strong > Suppose we want to retrieve the titles and authors of the table < code > posts < / code > . \ nIn the case where the author field is missing or < code > null < / code > , we want to retrieve the string \ n < code > Anonymous < / code > . < / p > \ n < p > < code > js \ nr . table ( \ " posts \ " ) . map ( function ( post ) { \ n return { \ n title : post ( \ " title \ " ) , \ n author : post ( \ " author \ " ) . default ( \ " Anonymous \ " ) \ n } \ n } ) . run ( conn , callback ) < / code > < / p > " , <nl> " url " : " default " , <nl> " io " : [ <nl> [ <nl> <nl> " any " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Stark Industries made the mistake of trusting an intern with data entry , \ nand now a bunch of fields are missing from some of their documents . Iron Man takes a \ nbreak from fighting Mandarin to write some safe analytics queries . < / p > \ n < p > < code > r . table ( ' projects ' ) . map ( function ( p ) { \ n return p ( ' staff ' ) . default ( 0 ) . add ( p ( ' management ' ) . default ( 0 ) ) \ n } ) . run ( conn , callback ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Iron Man can ' t possibly have lost a battle : < / p > \ n < p > < code > r . table ( ' marvel ' ) . get ( ' IronMan ' ) . do ( function ( ironman ) { \ n return r . branch ( ironman ( ' victories ' ) . lt ( ironman ( ' battles ' ) ) , \ n r . error ( ' impossible code path ' ) , \ n ironman ) \ n } ) . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " default " <nl> } , <nl> " api / javascript / and / " : { <nl> <nl> } , <nl> " api / javascript / info / " : { <nl> " body " : " any . info ( ) & rarr ; object " , <nl> - " description " : " < p > Get information about a RQL value . < / p > " , <nl> + " description " : " < p > Get information about a ReQL value . < / p > " , <nl> " url " : " info " , <nl> " io " : [ <nl> [ <nl> <nl> } , <nl> " api / javascript / update / " : { <nl> " body " : " table . update ( json | expr [ , { durability : ' soft ' , return_vals : true ] ) & rarr ; objectselection . update ( json | expr [ , { durability : ' soft ' , return_vals : true ] ) & rarr ; objectsingleSelection . update ( json | expr [ , { durability : ' soft ' , return_vals : true ] ) & rarr ; object " , <nl> - " description " : " < p > Update JSON documents in a table . Accepts a JSON document , a RQL expression , or a \ ncombination of the two . You can pass options like < code > returnVals < / code > that will return the old \ nand new values of the row you have modified . < / p > \ n < p > Update returns an object that contains the following attributes : < / p > \ n < ul > \ n < li > < code > replaced < / code > : the number of documents that were updated < / li > \ n < li > < code > unchanged < / code > : the number of documents that would have been modified except the new \ nvalue was the same as the old value ; < / li > \ n < li > < code > skipped < / code > : the number of documents that were left unmodified because there was nothing \ nto do : either the row didn ' t exist or the new value is null ; < / li > \ n < li > < code > errors < / code > : the number of errors encountered while performing the update ; if errors \ noccured , first_error contains the text of the first error ; < / li > \ n < li > < code > deleted < / code > and < code > inserted < / code > : 0 for an update operation . < / li > \ n < / ul > " , <nl> + " description " : " < p > Update JSON documents in a table . Accepts a JSON document , a ReQL expression , or a \ ncombination of the two . You can pass options like < code > returnVals < / code > that will return the old \ nand new values of the row you have modified . < / p > \ n < p > Update returns an object that contains the following attributes : < / p > \ n < ul > \ n < li > < code > replaced < / code > : the number of documents that were updated < / li > \ n < li > < code > unchanged < / code > : the number of documents that would have been modified except the new \ nvalue was the same as the old value ; < / li > \ n < li > < code > skipped < / code > : the number of documents that were left unmodified because there was nothing \ nto do : either the row didn ' t exist or the new value is null ; < / li > \ n < li > < code > errors < / code > : the number of errors encountered while performing the update ; if errors \ noccured , first_error contains the text of the first error ; < / li > \ n < li > < code > deleted < / code > and < code > inserted < / code > : 0 for an update operation . < / li > \ n < / ul > " , <nl> " url " : " update " , <nl> " io " : [ <nl> [ <nl> <nl> " name " : " groupBy " <nl> } , <nl> " api / javascript / filter / " : { <nl> - " body " : " sequence . filter ( predicate ) & rarr ; selectionstream . filter ( predicate ) & rarr ; streamarray . filter ( predicate ) & rarr ; array " , <nl> - " description " : " < p > Get all the documents for which the given predicate is true . < / p > \ n < p > filter can be called on a sequence , selection , or a field containing an array of \ nelements . The return type is the same as the type on which the function was called on . \ nThe body of every filter is wrapped in an implicit < code > . default ( false ) < / code > , and the default \ nvalue can be changed by passing the optional argument < code > default < / code > . Setting this optional \ nargument to < code > r . error ( ) < / code > will cause any non - existence errors to abort the filter . < / p > " , <nl> + " body " : " sequence . filter ( predicate [ , { default : false } ] ) & rarr ; selectionstream . filter ( predicate [ , { default : false } ] ) & rarr ; streamarray . filter ( predicate [ , { default : false } ] ) & rarr ; array " , <nl> + " description " : " < p > Get all the documents for which the given predicate is true . < / p > \ n < p > < code > filter < / code > can be called on a sequence , selection , or a field containing an array of \ nelements . The return type is the same as the type on which the function was called on . < / p > \ n < p > The body of every filter is wrapped in an implicit < code > . default ( false ) < / code > , which means that \ nif a non - existence errors is thrown ( when you try to access a field that does not exist \ nin a document ) , RethinkDB will just ignore the document . \ nThe < code > default < / code > value can be changed by passing an object with a < code > default < / code > field . \ nSetting this optional argument to < code > r . error ( ) < / code > will cause any non - existence errors to \ nreturn a < code > RqlRuntimeError < / code > . < / p > " , <nl> " url " : " filter " , <nl> " io " : [ <nl> [ <nl> <nl> " array " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Get all active users aged 30 . < / p > \ n < p > < code > r . table ( ' users ' ) . filter ( { active : true , profile : { age : 30 } } ) . run ( conn , callback ) < / code > < / p > \ n < p > These commands allow the combination of multiple sequences into a single sequence < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Get all the users that are 30 years old . < / p > \ n < p > < code > r . table ( ' users ' ) . filter ( { age : 30 } ) . run ( conn , callback ) < / code > < / p > \ n < p > These commands allow the combination of multiple sequences into a single sequence < / p > " , <nl> " name " : " filter " <nl> } , <nl> " api / javascript / table_list / " : { <nl> <nl> } , <nl> " api / javascript / expr / " : { <nl> " body " : " r . expr ( value ) & rarr ; value " , <nl> - " description " : " < p > Construct a RQL JSON object from a native object . < / p > " , <nl> + " description " : " < p > Construct a ReQL JSON object from a native object . < / p > " , <nl> " url " : " expr " , <nl> " io " : [ <nl> [ <nl> <nl> " value " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Objects wrapped with expr can then be manipulated by RQL API functions . < / p > \ n < p > < code > r . expr ( { a : ' b ' } ) . merge ( { b : [ 1 , 2 , 3 ] } ) . run ( conn , callback ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Objects wrapped with < code > expr < / code > can then be manipulated by ReQL API functions . < / p > \ n < p > < code > r . expr ( { a : ' b ' } ) . merge ( { b : [ 1 , 2 , 3 ] } ) . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " expr " <nl> } , <nl> " api / javascript / js / " : { <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Change the default database so that we don ' t need to specify the database \ nwhen referencing a table . < / p > \ n < p > < code > conn . use ( ' heroes ' ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Change the default database so that we don ' t need to \ nspecify the database when referencing a table . < / p > \ n < p > < code > conn . use ( ' marvel ' ) \ nr . table ( ' heroes ' ) . run ( conn , . . . ) / / refers to r . db ( ' marvel ' ) . table ( ' heroes ' ) < / code > < / p > " , <nl> " name " : " use " <nl> } , <nl> " api / javascript / table / " : { <nl> <nl> " name " : " keys " <nl> } , <nl> " api / javascript / next / " : { <nl> - " body " : " cursor . next ( callback ) " , <nl> + " body " : " cursor . next ( callback ) array . next ( callback ) " , <nl> " description " : " < p > Get the next element in the cursor . < / p > " , <nl> " url " : " next " , <nl> " io " : [ <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Let ' s grab the next element ! < / p > \ n < p > < code > cur . next ( function ( err , row ) { \ n return processRow ( row ) ; \ n } ) ; < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Let ' s grab the next element ! < / p > \ n < p > < code > cursor . next ( function ( err , row ) { \ n if ( err ) throw err ; \ n processRow ( row ) ; \ n } ) ; < / code > < / p > " , <nl> " name " : " next " <nl> } , <nl> " api / javascript / insert_at / " : { <nl> <nl> " example " : " < p > < strong > Example : < / strong > Update the time of John ' s birth . < / p > \ n < p > < code > r . table ( \ " user \ " ) . get ( \ " John \ " ) . update ( { birth : r . ISO8601 ( ' 1986 - 11 - 03T08 : 30 : 00 - 07 : 00 ' ) } ) . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " ISO8601 " <nl> } , <nl> + " api / javascript / sync / " : { <nl> + " body " : " table . sync ( ) & rarr ; object " , <nl> + " description " : " < p > < code > sync < / code > ensures that writes on a given table are written to permanent storage . Queries \ nthat specify soft durability ( < code > { durability : ' soft ' } < / code > ) do not give such guarantees , so \ n < code > sync < / code > can be used to ensure the state of these queries . A call to < code > sync < / code > does not return \ nuntil all previous writes to the table are persisted . < / p > " , <nl> + " url " : " sync " , <nl> + " io " : [ <nl> + [ <nl> + " table " , <nl> + " object " <nl> + ] <nl> + ] , <nl> + " example " : " < p > < strong > Example : < / strong > After having updated multiple heroes with soft durability , we now want to wait \ nuntil these changes are persisted . < / p > \ n < p > < code > r . table ( ' marvel ' ) . sync ( ) . run ( conn , callback ) < / code > < / p > " , <nl> + " name " : " sync " <nl> + } , <nl> " api / javascript / indexes_of / " : { <nl> " body " : " sequence . indexesOf ( datum | predicate ) & rarr ; array " , <nl> " description " : " < p > Get the indexes of an element in a sequence . If the argument is a predicate , get the indexes of all elements matching it . < / p > " , <nl> <nl> " example " : " < p > < strong > Example : < / strong > Find all users with primary key & gt ; = 10 and & lt ; 20 ( a normal half - open interval ) . < / p > \ n < p > < code > r . table ( ' marvel ' ) . between ( 10 , 20 ) . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " between " <nl> } , <nl> - " api / javascript / ge / " : { <nl> - " body " : " value . ge ( value ) & rarr ; bool " , <nl> - " description " : " < p > Test if the first value is greater than or equal to other . < / p > " , <nl> - " url " : " ge " , <nl> + " api / javascript / table_drop / " : { <nl> + " body " : " db . tableDrop ( tableName ) & rarr ; object " , <nl> + " description " : " < p > Drop a table . The table and all its data will be deleted . < / p > \ n < p > If succesful , the operation returns an object : { dropped : 1 } . If the specified table \ ndoesn ' t exist a < code > RqlRuntimeError < / code > is thrown . < / p > " , <nl> + " url " : " table_drop " , <nl> " io " : [ <nl> [ <nl> - " value " , <nl> - " bool " <nl> + " db " , <nl> + " object " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Is 2 greater than or equal to 2 ? < / p > \ n < p > < code > r . expr ( 2 ) . ge ( 2 ) . run ( conn , callback ) < / code > < / p > " , <nl> - " name " : " ge " <nl> + " example " : " < p > < strong > Example : < / strong > Drop a table named ' dc_universe ' . < / p > \ n < p > < code > r . db ( ' test ' ) . tableDrop ( ' dc_universe ' ) . run ( conn , callback ) < / code > < / p > " , <nl> + " name " : " tableDrop " <nl> } , <nl> " api / javascript / type_of / " : { <nl> " body " : " any . typeOf ( ) & rarr ; string " , <nl> <nl> } , <nl> " api / javascript / r / " : { <nl> " body " : " r & rarr ; r " , <nl> - " description " : " < p > The top - level RQL namespace . < / p > " , <nl> + " description " : " < p > The top - level ReQL namespace . < / p > " , <nl> " url " : " r " , <nl> " io " : [ <nl> [ <nl> <nl> " r " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Setup your top level namespace . < / p > \ n < p > < code > var r = require ( ' rethinkdb ' ) ; < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Set up your top - level namespace . < / p > \ n < p > < code > var r = require ( ' rethinkdb ' ) ; < / code > < / p > " , <nl> " name " : " r " <nl> } , <nl> " api / javascript / run / " : { <nl> - " body " : " query . run ( connection , callback ) query . run ( options [ , callback ] ) " , <nl> - " description " : " < p > Run a query on a connection . < / p > " , <nl> + " body " : " query . run ( conn , callback ) query . run ( options [ , callback ] ) " , <nl> + " description " : " < p > Run a query on a connection . Accepts the following options : < / p > \ n < ul > \ n < li > < code > useOutdated < / code > : whether or not outdated reads are OK ( default : < code > false < / code > ) . < / li > \ n < li > < code > timeFormat < / code > : what format to return times in ( default : < code > ' native ' < / code > ) . \ n Set this to < code > ' raw ' < / code > if you want times returned as JSON objects for exporting . < / li > \ n < li > < code > profile < / code > : whether or not to return a profile of the query ' s \ n execution ( default : < code > false < / code > ) . < / li > \ n < / ul > \ n < p > The callback will get either an error , a single JSON result , or a \ ncursor , depending on the query . < / p > " , <nl> " url " : " run " , <nl> " io " : [ <nl> [ <nl> <nl> null <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Call run on the connection with a query to execute the query . The callback \ nwill get a cursor from which results may be retrieved . < / p > \ n < p > < code > r . table ( ' marvel ' ) . run ( conn , function ( err , cur ) { cur . each ( console . log ) ; } ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Run a query on the connection < code > conn < / code > and log each row in \ nthe result to the console . < / p > \ n < p > < code > r . table ( ' marvel ' ) . run ( conn , function ( err , cursor ) { cursor . each ( console . log ) ; } ) < / code > < / p > " , <nl> " name " : " run " <nl> } , <nl> " api / javascript / set_insert / " : { <nl> <nl> } , <nl> " api / javascript / time / " : { <nl> " body " : " r . time ( year , month , day [ , hour , minute , second ] , timezone ) & rarr ; time " , <nl> - " description " : " < p > Create a time object for a specific time . < / p > " , <nl> + " description " : " < p > Create a time object for a specific time . < / p > \ n < p > A few restrictions exist on the arguments : < / p > \ n < ul > \ n < li > < code > year < / code > is an integer between 1400 and 9 , 999 . < / li > \ n < li > < code > month < / code > is an integer between 1 and 12 . < / li > \ n < li > < code > day < / code > is an integer between 1 and 31 . < / li > \ n < li > < code > hour < / code > is an integer . < / li > \ n < li > < code > minutes < / code > is an integer . < / li > \ n < li > < code > seconds < / code > is a double . Its value will be rounded to three decimal places \ n ( millisecond - precision ) . < / li > \ n < li > < code > timezone < / code > can be < code > ' Z ' < / code > ( for UTC ) or a string with the format < code > \ u00b1 [ hh ] : [ mm ] < / code > . < / li > \ n < / ul > " , <nl> " url " : " time " , <nl> " io " : [ <nl> [ <nl> <nl> " time " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Update the birthdate of the user \ " John \ " to November 3rd , 1986 UTC . < / p > \ n < p > < code > r . table ( \ " user \ " ) . get ( \ " John \ " ) . update ( { birthdate : r . time ( 1986 , 11 , 3 , ' Z ' ) } ) . run ( conn , callback ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Update the birthdate of the user \ " John \ " to November 3rd , 1986 UTC . < / p > \ n < p > < code > r . table ( \ " user \ " ) . get ( \ " John \ " ) . update ( { birthdate : r . time ( 1986 , 11 , 3 , ' Z ' ) } ) \ n . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " time " <nl> } , <nl> " api / javascript / add / " : { <nl> <nl> } , <nl> " api / javascript / coerce_to / " : { <nl> " body " : " sequence . coerceTo ( typeName ) & rarr ; arrayvalue . coerceTo ( typeName ) & rarr ; stringarray . coerceTo ( typeName ) & rarr ; objectobject . coerceTo ( typeName ) & rarr ; array " , <nl> - " description " : " < p > Converts a value of one type into another . < / p > \ n < p > You can convert : a selection , sequence , or object into an ARRAY , an array of pairs into an OBJECT , and any DATUM into a STRING . < / p > " , <nl> + " description " : " < p > Converts a value of one type into another . < / p > \ n < p > You can convert : a selection , sequence , or object into an ARRAY , an array of pairs into an OBJECT , and any DATUM into a STRING . < / p > " , <nl> " url " : " coerce_to " , <nl> " io " : [ <nl> [ <nl> <nl> " name " : " outerJoin " <nl> } , <nl> " api / javascript / has_next / " : { <nl> - " body " : " cursor . hasNext ( ) & rarr ; bool " , <nl> + " body " : " cursor . hasNext ( ) & rarr ; boolarray . hasNext ( ) & rarr ; bool " , <nl> " description " : " < p > Check if there are more elements in the cursor . < / p > " , <nl> " url " : " has_next " , <nl> " io " : [ <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Are there more elements in the cursor ? < / p > \ n < p > < code > var hasMore = cur . hasNext ( ) ; < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Are there more elements in the cursor ? < / p > \ n < p > < code > var hasMore = cursor . hasNext ( ) ; < / code > < / p > " , <nl> " name " : " hasNext " <nl> } , <nl> " api / javascript / epoch_time / " : { <nl> " body " : " r . epochTime ( epochTime ) & rarr ; time " , <nl> - " description " : " < p > Create a time object based on seconds since epoch . < / p > " , <nl> + " description " : " < p > Create a time object based on seconds since epoch . The first argument is a double and \ nwill be rounded to three decimal places ( millisecond - precision ) . < / p > " , <nl> " url " : " epoch_time " , <nl> " io " : [ <nl> [ <nl> <nl> " time " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Update the birthdate of the user \ " John \ " to November 3rd , 1986 . < / p > \ n < p > < code > r . table ( \ " user \ " ) . get ( \ " John \ " ) . update ( { birthdate : r . epochTime ( 531360000 ) } ) . run ( conn , callback ) < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > Update the birthdate of the user \ " John \ " to November 3rd , 1986 . < / p > \ n < p > < code > r . table ( \ " user \ " ) . get ( \ " John \ " ) . update ( { birthdate : r . epochTime ( 531360000 ) } ) \ n . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " epochTime " <nl> } , <nl> " api / javascript / db_drop / " : { <nl> <nl> " name " : " reduce " <nl> } , <nl> " api / javascript / to_array / " : { <nl> - " body " : " cursor . toArray ( callback ) " , <nl> + " body " : " cursor . toArray ( callback ) array . toArray ( callback ) " , <nl> " description " : " < p > Retrieve all results and pass them as an array to the given callback . < / p > " , <nl> " url " : " to_array " , <nl> " io " : [ <nl> <nl> " undefined " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > For small result sets it may be more convenient to process them at once as \ nan array . < / p > \ n < p > < code > cur . toArray ( function ( err , results ) { \ n for ( var i in results ) { \ n processRow ( results [ i ] ) ; \ n } \ n } ) ; < / code > < / p > " , <nl> + " example " : " < p > < strong > Example : < / strong > For small result sets it may be more convenient to process them at once as \ nan array . < / p > \ n < p > < code > cursor . toArray ( function ( err , results ) { \ n if ( err ) throw err ; \ n processResults ( results ) ; \ n } ) ; < / code > < / p > " , <nl> " name " : " toArray " <nl> } , <nl> " api / javascript / to_iso8601 / " : { <nl> <nl> " example " : " < p > < strong > Example : < / strong > Return all the posts submitted after midnight and before 4am . < / p > \ n < p > < code > r . table ( \ " posts \ " ) . filter ( function ( post ) { \ n return post ( \ " date \ " ) . hours ( ) . lt ( 4 ) \ n } ) < / code > < / p > " , <nl> " name " : " hours " <nl> } , <nl> - " api / javascript / table_drop / " : { <nl> - " body " : " db . tableDrop ( tableName ) & rarr ; object " , <nl> - " description " : " < p > Drop a table . The table and all its data will be deleted . < / p > \ n < p > If succesful , the operation returns an object : { dropped : 1 } . If the specified table \ ndoesn ' t exist a < code > RqlRuntimeError < / code > is thrown . < / p > " , <nl> - " url " : " table_drop " , <nl> + " api / javascript / ge / " : { <nl> + " body " : " value . ge ( value ) & rarr ; bool " , <nl> + " description " : " < p > Test if the first value is greater than or equal to other . < / p > " , <nl> + " url " : " ge " , <nl> " io " : [ <nl> [ <nl> - " db " , <nl> - " object " <nl> + " value " , <nl> + " bool " <nl> ] <nl> ] , <nl> - " example " : " < p > < strong > Example : < / strong > Drop a table named ' dc_universe ' . < / p > \ n < p > < code > r . db ( ' test ' ) . tableDrop ( ' dc_universe ' ) . run ( conn , callback ) < / code > < / p > " , <nl> - " name " : " tableDrop " <nl> + " example " : " < p > < strong > Example : < / strong > Is 2 greater than or equal to 2 ? < / p > \ n < p > < code > r . expr ( 2 ) . ge ( 2 ) . run ( conn , callback ) < / code > < / p > " , <nl> + " name " : " ge " <nl> } , <nl> " api / javascript / to_epoch_time / " : { <nl> " body " : " time . to_epoch_time ( ) & rarr ; number " , <nl> <nl> } , <nl> " api / javascript / table_create / " : { <nl> " body " : " db . tableCreate ( tableName [ , options ] ) & rarr ; object " , <nl> - " description " : " < p > Create a table . A RethinkDB table is a collection of JSON documents . < / p > \ n < p > If successful , the operation returns an object : < code > { created : 1 } < / code > . If a table with the same \ nname already exists , the operation throws < code > RqlRuntimeError < / code > . \ nNote : that you can only use alphanumeric characters and underscores for the table name . < / p > \ n < p > When creating a table you can specify the following options : < / p > \ n < ul > \ n < li > < code > primaryKey < / code > : the name of the primary key . The default primary key is id ; < / li > \ n < li > < code > durability < / code > : if set to < code > soft < / code > , this enables < em > soft durability < / em > on this table : \ nwrites will be acknowledged by the server immediately and flushed to disk in the \ nbackground . Default is < code > hard < / code > ( acknowledgement of writes happens after data has been \ nwritten to disk ) ; < / li > \ n < li > < code > cacheSize < / code > : set the cache size ( in bytes ) to be used by the table . The \ ndefault is 1073741824 ( 1024MB ) ; < / li > \ n < li > < code > datacenter < / code > : the name of the datacenter this table should be assigned to . < / li > \ n < / ul > " , <nl> + " description " : " < p > Create a table . A RethinkDB table is a collection of JSON documents . < / p > \ n < p > If successful , the operation returns an object : < code > { created : 1 } < / code > . If a table with the same \ nname already exists , the operation throws < code > RqlRuntimeError < / code > . \ nNote : that you can only use alphanumeric characters and underscores for the table name . < / p > \ n < p > When creating a table you can specify the following options : < / p > \ n < ul > \ n < li > < code > primaryKey < / code > : the name of the primary key . The default primary key is id ; < / li > \ n < li > < code > durability < / code > : if set to < code > soft < / code > , this enables < em > soft durability < / em > on this table : \ nwrites will be acknowledged by the server immediately and flushed to disk in the \ nbackground . Default is < code > hard < / code > ( acknowledgement of writes happens after data has been \ nwritten to disk ) ; < / li > \ n < li > < code > cacheSize < / code > : set the cache size ( in bytes ) to be used by the table . The \ ndefault is 1073741824 ( 1024MB ) ; < / li > \ n < li > < code > datacenter < / code > : the name of the datacenter this table should be assigned to . < / li > \ n < / ul > " , <nl> " url " : " table_create " , <nl> " io " : [ <nl> [ <nl> <nl> " example " : " < p > < strong > Example : < / strong > Create a table named ' dc_universe ' with the default settings . < / p > \ n < p > < code > r . db ( ' test ' ) . tableCreate ( ' dc_universe ' ) . run ( conn , callback ) < / code > < / p > " , <nl> " name " : " tableCreate " <nl> } , <nl> + " api / javascript / index_status / " : { <nl> + " body " : " table . indexStatus ( [ , index . . . ] ) & rarr ; array " , <nl> + " description " : " < p > Get the status of the specified indexes on this table , or the status \ nof all indexes on this table if no indexes are specified . < / p > " , <nl> + " url " : " index_status " , <nl> + " io " : [ <nl> + [ <nl> + " table " , <nl> + " array " <nl> + ] <nl> + ] , <nl> + " example " : " < p > < strong > Example : < / strong > Get the status of all the indexes on < code > test < / code > : < / p > \ n < p > < code > r . table ( ' test ' ) . indexStatus ( ) . run ( conn , callback ) < / code > < / p > \ n < p > < strong > Example : < / strong > Get the status of the < code > timestamp < / code > index : < / p > \ n < p > < code > r . table ( ' test ' ) . indexStatus ( ' timestamp ' ) . run ( conn , callback ) < / code > < / p > " , <nl> + " name " : " indexStatus " <nl> + } , <nl> " api / javascript / db / " : { <nl> " body " : " r . db ( dbName ) & rarr ; db " , <nl> " description " : " < p > Reference a database . < / p > " , <nl> mmm a / drivers / python / gendocs . py <nl> ppp b / drivers / python / gendocs . py <nl> <nl> ' h1 ' : lambda text : " \ n " + text + " \ n " , <nl> ' ul ' : lambda text : " \ n " + text + " \ n " , <nl> ' li ' : lambda text : fill ( text , initial_indent = " * " , subsequent_indent = " " ) , <nl> - ' strong ' : lambda text : " * " + text + " * " <nl> + ' strong ' : lambda text : " * " + text + " * " , <nl> + ' em ' : lambda text : text , <nl> } <nl> <nl> nowrap_tags = [ ' ul ' , ' br ' ] <nl>
Generated documentation for 1 . 11 . 0
rethinkdb/rethinkdb
6027810ff6f4c428919b59a4dbb32d3663160c13
2013-11-24T18:33:21Z
mmm a / script / upload - checksums . py <nl> ppp b / script / upload - checksums . py <nl> def get_files_list ( version ) : <nl> return [ <nl> ' node - { 0 } . tar . gz ' . format ( version ) , <nl> ' iojs - { 0 } . tar . gz ' . format ( version ) , <nl> + ' iojs - { 0 } - headers . tar . gz ' . format ( version ) , <nl> ' node . lib ' , <nl> ' x64 / node . lib ' , <nl> ' win - x86 / iojs . lib ' , <nl> mmm a / script / upload - node - headers . py <nl> ppp b / script / upload - node - headers . py <nl> def main ( ) : <nl> args = parse_args ( ) <nl> node_headers_dir = os . path . join ( DIST_DIR , ' node - { 0 } ' . format ( args . version ) ) <nl> iojs_headers_dir = os . path . join ( DIST_DIR , ' iojs - { 0 } ' . format ( args . version ) ) <nl> + iojs2_headers_dir = os . path . join ( DIST_DIR , <nl> + ' iojs - { 0 } - headers ' . format ( args . version ) ) <nl> <nl> copy_headers ( node_headers_dir ) <nl> create_header_tarball ( node_headers_dir ) <nl> copy_headers ( iojs_headers_dir ) <nl> create_header_tarball ( iojs_headers_dir ) <nl> + copy_headers ( iojs2_headers_dir ) <nl> + create_header_tarball ( iojs2_headers_dir ) <nl> <nl> # Upload node ' s headers to S3 . <nl> bucket , access_key , secret_key = s3_config ( ) <nl>
Merge pull request from atom / iojs - new - headers
electron/electron
ebe70435efcf40dcfd4a34c0d72a6118d29ef926
2015-08-10T04:00:17Z
mmm a / src / heap / mark - compact . cc <nl> ppp b / src / heap / mark - compact . cc <nl> static void VerifyMarking ( Heap * heap , Address bottom , Address top ) { <nl> for ( Address current = bottom ; current < top ; current + = kPointerSize ) { <nl> object = HeapObject : : FromAddress ( current ) ; <nl> if ( MarkCompactCollector : : IsMarked ( object ) ) { <nl> + CHECK ( Marking : : IsBlack ( Marking : : MarkBitFrom ( object ) ) ) ; <nl> CHECK ( current > = next_object_must_be_here_or_later ) ; <nl> object - > Iterate ( & visitor ) ; <nl> next_object_must_be_here_or_later = current + object - > Size ( ) ; <nl>
Make VerifyMarking work in the presence of grey objects
v8/v8
34c43513a34db5b01b12d220f0c9a9d870a470da
2015-03-09T15:01:42Z
mmm a / apinotes / os . apinotes <nl> ppp b / apinotes / os . apinotes <nl> Typedefs : <nl> Availability : nonswift <nl> - Name : os_log_t <nl> Availability : nonswift <nl> + - Name : os_signpost_type_t <nl> + SwiftName : OSSignpostType <nl> Classes : <nl> - Name : OS_os_log <nl> SwiftName : OSLog <nl> Enumerators : <nl> SwiftPrivate : true <nl> - Name : OS_LOG_TYPE_FAULT <nl> SwiftPrivate : true <nl> + - Name : OS_SIGNPOST_INTERVAL_BEGIN <nl> + SwiftPrivate : true <nl> + - Name : OS_SIGNPOST_INTERVAL_END <nl> + SwiftPrivate : true <nl> + - Name : OS_SIGNPOST_EVENT <nl> + SwiftPrivate : true <nl> Functions : <nl> - Name : _os_log_impl <nl> Availability : nonswift <nl> AvailabilityMsg : ' Use os_log ' <nl> + - Name : _os_log_error_impl <nl> + Availability : nonswift <nl> + AvailabilityMsg : ' Use os_log ' <nl> + - Name : _os_log_fault_impl <nl> + Availability : nonswift <nl> + AvailabilityMsg : ' Use os_log ' <nl> - Name : _os_log_sensitive_deprecated <nl> Availability : nonswift <nl> - Name : _os_trace_with_buffer <nl> Functions : <nl> NullabilityOfRet : N <nl> - Name : os_log_is_debug_enabled <nl> Availability : nonswift <nl> + - Name : os_signpost_enabled <nl> + SwiftPrivate : true <nl> + - Name : os_signpost_id_generate <nl> + SwiftPrivate : true <nl> + NullabilityOfRet : O <nl> + - Name : os_signpost_id_make_with_pointer <nl> + SwiftPrivate : true <nl> + NullabilityOfRet : O <nl> + - Name : _os_signpost_emit_with_name_impl <nl> + Availability : nonswift <nl> + AvailabilityMsg : ' Use os_signpost ' <nl> mmm a / lib / Driver / Driver . cpp <nl> ppp b / lib / Driver / Driver . cpp <nl> static bool isSDKTooOld ( StringRef sdkPath , clang : : VersionTuple minVersion , <nl> / / / the given target . <nl> static bool isSDKTooOld ( StringRef sdkPath , const llvm : : Triple & target ) { <nl> if ( target . isMacOSX ( ) ) { <nl> - return isSDKTooOld ( sdkPath , clang : : VersionTuple ( 10 , 13 ) , " OSX " ) ; <nl> + return isSDKTooOld ( sdkPath , clang : : VersionTuple ( 10 , 14 ) , " OSX " ) ; <nl> <nl> } else if ( target . isiOS ( ) ) { <nl> / / Includes both iOS and TVOS . <nl> - return isSDKTooOld ( sdkPath , clang : : VersionTuple ( 11 , 0 ) , " Simulator " , " OS " ) ; <nl> + return isSDKTooOld ( sdkPath , clang : : VersionTuple ( 12 , 0 ) , " Simulator " , " OS " ) ; <nl> <nl> } else if ( target . isWatchOS ( ) ) { <nl> - return isSDKTooOld ( sdkPath , clang : : VersionTuple ( 4 , 0 ) , " Simulator " , " OS " ) ; <nl> + return isSDKTooOld ( sdkPath , clang : : VersionTuple ( 5 , 0 ) , " Simulator " , " OS " ) ; <nl> <nl> } else { <nl> return false ; <nl> mmm a / stdlib / public / SDK / ARKit / ARKit . swift <nl> ppp b / stdlib / public / SDK / ARKit / ARKit . swift <nl> extension ARCamera { <nl> return . limited ( reason ) <nl> } <nl> } <nl> + <nl> + @ available ( iOS , introduced : 12 . 0 ) <nl> + @ nonobjc <nl> + public func unprojectPoint ( <nl> + _ point : CGPoint , <nl> + ontoPlane planeTransform : simd_float4x4 , <nl> + orientation : UIInterfaceOrientation , <nl> + viewportSize : CGSize <nl> + ) - > simd_float3 ? { <nl> + let result = __unprojectPoint ( <nl> + point , <nl> + ontoPlaneWithTransform : planeTransform , <nl> + orientation : orientation , <nl> + viewportSize : viewportSize ) <nl> + if result . x . isNaN | | result . y . isNaN | | result . z . isNaN { <nl> + return nil <nl> + } <nl> + <nl> + return result <nl> + } <nl> + } <nl> + <nl> + @ available ( iOS , introduced : 12 . 0 ) <nl> + extension ARSCNView { <nl> + @ nonobjc public func unprojectPoint ( <nl> + _ point : CGPoint , ontoPlane planeTransform : simd_float4x4 <nl> + ) - > simd_float3 ? { <nl> + let result = __unprojectPoint ( <nl> + point , ontoPlaneWithTransform : planeTransform ) <nl> + if result . x . isNaN | | result . y . isNaN | | result . z . isNaN { <nl> + return nil <nl> + } <nl> + <nl> + return result <nl> + } <nl> } <nl> <nl> @ available ( iOS , introduced : 11 . 0 ) <nl> mmm a / stdlib / public / SDK / AVFoundation / AVError . swift <nl> ppp b / stdlib / public / SDK / AVFoundation / AVError . swift <nl> import Foundation <nl> <nl> extension AVError { <nl> / / / The device name . <nl> - public var device : String ? { <nl> - return userInfo [ AVErrorDeviceKey ] as ? String <nl> + # if os ( tvOS ) <nl> + @ available ( * , unavailable ) <nl> + public var device : String ? { return nil } <nl> + # else <nl> + @ available ( swift , obsoleted : 4 . 2 , message : " Use ` device : AVCaptureDevice ? ` instead " ) <nl> + public var device : String ? { return nil } <nl> + <nl> + @ available ( swift , introduced : 4 . 2 ) <nl> + public var device : AVCaptureDevice ? { <nl> + return userInfo [ AVErrorDeviceKey ] as ? AVCaptureDevice <nl> } <nl> + # endif <nl> <nl> / / / The time . <nl> public var time : CMTime ? { <nl> - return userInfo [ AVErrorTimeKey ] as ? CMTime <nl> + if let time = userInfo [ AVErrorTimeKey ] as ? CMTime { <nl> + return time <nl> + } <nl> + else if let timeDictionary = userInfo [ AVErrorTimeKey ] { <nl> + return CMTimeMakeFromDictionary ( ( timeDictionary as ! CFDictionary ) ) <nl> + } <nl> + else { <nl> + return nil <nl> + } <nl> } <nl> <nl> / / / The file size . <nl> public var fileSize : Int64 ? { <nl> - return ( userInfo [ AVErrorFileSizeKey ] as ? NSNumber ) ? . int64Value <nl> + return userInfo [ AVErrorFileSizeKey ] as ? Int64 <nl> } <nl> <nl> / / / The process ID number . <nl> extension AVError { <nl> } <nl> <nl> / / / The media type . <nl> - public var mediaType : String ? { <nl> - return userInfo [ AVErrorMediaTypeKey ] as ? String <nl> + public var mediaType : AVMediaType ? { <nl> + return userInfo [ AVErrorMediaTypeKey ] as ? AVMediaType <nl> } <nl> <nl> / / / The media subtypes . <nl> public var mediaSubtypes : [ Int ] ? { <nl> return userInfo [ AVErrorMediaSubTypeKey ] as ? [ Int ] <nl> } <nl> - } <nl> <nl> + / / / The presentation time stamp . <nl> + @ available ( swift , introduced : 4 . 2 ) <nl> + @ available ( macOS , introduced : 10 . 10 ) <nl> + @ available ( iOS , introduced : 8 . 0 ) <nl> + @ available ( tvOS , introduced : 9 . 0 ) <nl> + public var presentationTimeStamp : CMTime ? { <nl> + return userInfo [ AVErrorPresentationTimeStampKey ] as ? CMTime <nl> + } <nl> + <nl> + / / / The persistent track ID . <nl> + @ available ( swift , introduced : 4 . 2 ) <nl> + @ available ( macOS , introduced : 10 . 10 ) <nl> + @ available ( iOS , introduced : 8 . 0 ) <nl> + @ available ( tvOS , introduced : 9 . 0 ) <nl> + public var persistentTrackID : CMPersistentTrackID ? { <nl> + return userInfo [ AVErrorPersistentTrackIDKey ] as ? CMPersistentTrackID <nl> + } <nl> + <nl> + / / / The file type . <nl> + @ available ( swift , introduced : 4 . 2 ) <nl> + @ available ( macOS , introduced : 10 . 10 ) <nl> + @ available ( iOS , introduced : 8 . 0 ) <nl> + @ available ( tvOS , introduced : 9 . 0 ) <nl> + public var fileType : AVFileType ? { <nl> + return userInfo [ AVErrorFileTypeKey ] as ? AVFileType <nl> + } <nl> + } <nl> mmm a / stdlib / public / SDK / CMakeLists . txt <nl> ppp b / stdlib / public / SDK / CMakeLists . txt <nl> if ( SWIFT_BUILD_STATIC_SDK_OVERLAY ) <nl> list ( APPEND SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES STATIC ) <nl> endif ( ) <nl> <nl> - set ( all_overlays " Accelerate ; AppKit ; ARKit ; AssetsLibrary ; AVFoundation ; CallKit ; CloudKit ; Contacts ; CoreAudio ; CoreData ; CoreFoundation ; CoreGraphics ; CoreImage ; CoreLocation ; CoreMedia ; CryptoTokenKit ; Dispatch ; Foundation ; GameplayKit ; GLKit ; HomeKit ; IOKit ; Intents ; MapKit ; MediaPlayer ; Metal ; MetalKit ; ModelIO ; ObjectiveC ; OpenCL ; os ; Photos ; QuartzCore ; SafariServices ; SceneKit ; simd ; SpriteKit ; UIKit ; Vision ; WatchKit ; XCTest ; XPC " ) <nl> + set ( all_overlays " Accelerate ; AppKit ; ARKit ; AssetsLibrary ; AVFoundation ; CallKit ; CloudKit ; Contacts ; CoreAudio ; CoreData ; CoreFoundation ; CoreGraphics ; CoreImage ; CoreLocation ; CoreMedia ; CryptoTokenKit ; Dispatch ; Foundation ; GameplayKit ; GLKit ; HomeKit ; IOKit ; Intents ; MapKit ; MediaPlayer ; Metal ; MetalKit ; ModelIO ; NaturalLanguage ; Network ; ObjectiveC ; OpenCL ; os ; Photos ; QuartzCore ; SafariServices ; SceneKit ; simd ; SpriteKit ; UIKit ; Vision ; WatchKit ; XCTest ; XPC " ) <nl> <nl> if ( DEFINED SWIFT_OVERLAY_TARGETS ) <nl> set ( overlays_to_build $ { SWIFT_OVERLAY_TARGETS } ) <nl> mmm a / stdlib / public / SDK / CloudKit / CKError . swift <nl> ppp b / stdlib / public / SDK / CloudKit / CKError . swift <nl> <nl> / / <nl> / / This source file is part of the Swift . org open source project <nl> / / <nl> - / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> / / <nl> / / See https : / / swift . org / LICENSE . txt for license information <nl> new file mode 100644 <nl> index 000000000000 . . 1b146b38b3b9 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKFetchRecordZoneChangesOperation . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 5 . 0 , * ) <nl> + extension CKFetchRecordZoneChangesOperation . ZoneConfiguration { <nl> + / * * <nl> + Declares which user - defined keys should be fetched and added to the resulting CKRecords . <nl> + <nl> + If nil , declares the entire record should be downloaded . If set to an empty array , declares that no user fields should be downloaded . <nl> + Defaults to nil . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var desiredKeys : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __desiredKeys } <nl> + set { self . __desiredKeys = newValue } <nl> + } <nl> + <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( previousServerChangeToken : CKServerChangeToken ? = nil , resultsLimit : Int ? = nil , desiredKeys : [ CKRecord . FieldKey ] ? = nil ) { <nl> + self . init ( ) <nl> + if let previousServerChangeToken = previousServerChangeToken { <nl> + self . previousServerChangeToken = previousServerChangeToken <nl> + } <nl> + if let resultsLimit = resultsLimit { <nl> + self . resultsLimit = resultsLimit <nl> + } <nl> + if let desiredKeys = desiredKeys { <nl> + self . desiredKeys = desiredKeys <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 8d5ad1ab0b67 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKRecord . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit <nl> + <nl> + / / MARK : - Iterate over records <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + public struct CKRecordKeyValueIterator : IteratorProtocol { <nl> + private var keyArray : [ CKRecord . FieldKey ] <nl> + private var record : CKRecord <nl> + private var index : Array < CKRecord . FieldKey > . Index <nl> + <nl> + fileprivate init ( _ record : CKRecord ) { <nl> + self . record = record <nl> + keyArray = record . allKeys ( ) <nl> + index = keyArray . startIndex <nl> + } <nl> + <nl> + public mutating func next ( ) - > ( CKRecord . FieldKey , CKRecordValueProtocol ) ? { <nl> + var key : CKRecord . FieldKey ? = nil <nl> + var objcValue : __CKRecordObjCValue ? = nil <nl> + while objcValue = = nil { <nl> + guard index < keyArray . endIndex else { return nil } <nl> + key = keyArray [ index ] <nl> + objcValue = record [ key ! ] <nl> + index = index . advanced ( by : 1 ) <nl> + } <nl> + <nl> + let swiftValue = objcValue ! . asSwiftNativeValue ( ) <nl> + <nl> + return ( key ! , swiftValue ) <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecord : Sequence { <nl> + public func makeIterator ( ) - > CKRecordKeyValueIterator { <nl> + return CKRecordKeyValueIterator ( self ) <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecord { <nl> + public typealias RecordType = String <nl> + public typealias FieldKey = String <nl> + <nl> + @ available ( swift 4 . 2 ) <nl> + public enum SystemType { <nl> + public static let userRecord : CKRecord . RecordType = __CKRecordTypeUserRecord as CKRecord . RecordType <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + public static let share : CKRecord . RecordType = __CKRecordTypeShare as CKRecord . RecordType <nl> + } <nl> + <nl> + @ available ( swift 4 . 2 ) <nl> + public enum SystemFieldKey { <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + public static let parent : CKRecord . FieldKey = __CKRecordParentKey as CKRecord . RecordType <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + public static let share : CKRecord . FieldKey = __CKRecordShareKey as CKRecord . RecordType <nl> + } <nl> + } <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 4ff765b5e291 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKRecordValue . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit <nl> + <nl> + / / __CKRecordObjCValue - an ObjC object that ObjectiveC clients use as CKRecord values <nl> + / / CKRecordValueProtocol - a struct or class used only by Swift clients as CKRecord values <nl> + / / CKRecordValueConvertible - an ObjectiveC object that should be converted to a native Swift type before being used in Swift clients . <nl> + / / CKObjCRecordValueConvertible - a Swift struct or object that should be converted to a CKRecordObjCValue when set on a CKRecord <nl> + <nl> + / * CKRecordValueProtocol CKObjCRecordValueConvertible <nl> + __CKRecordObjCValue CKRecordValueConvertible <nl> + mmmmmmmmmmmmmmm - | mmmmmmmmm - - | mmmmmmmmm - - | mmmmmmmmm - - | mmmmmmmmm - - <nl> + String | | X | | X <nl> + Date | | X | | X <nl> + Data | | X | | X <nl> + Bool | | X | | X <nl> + Int | | X | | X <nl> + UInt | | X | | X <nl> + Float | | X | | X <nl> + Double | | X | | X <nl> + [ U ] Int8 et al | | X | | X <nl> + Int64 | | X | | X <nl> + Array | | X | | X <nl> + NSString | X | X | X | <nl> + NSDate | X | X | X | <nl> + NSData | X | X | X | <nl> + NSNumber | X | X | X | <nl> + NSArray | X | X | X | <nl> + CKReference | X | X | | <nl> + aka CKRecord . Reference <nl> + CKAsset | X | X | | <nl> + CLLocation | X | X | | <nl> + <nl> + * / <nl> + <nl> + / / MARK : - Protocols for bridging record value types <nl> + <nl> + / / / Anything that can be a record value in Swift . <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + public protocol CKRecordValueProtocol { } <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + public typealias CKRecordValue = __CKRecordObjCValue <nl> + <nl> + / / A Swift data type that is convertible to and from a __CKRecordObjCValue <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + private protocol CKObjCRecordValueConvertible : CKRecordValueProtocol { <nl> + / / Convert to __CKRecordObjCValue <nl> + func objcRecordValue ( ) - > __CKRecordObjCValue <nl> + / / Convert from __CKRecordObjCValue <nl> + static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Self <nl> + } <nl> + <nl> + / / An ObjC data type that is more naturally represented as a native Swift type when pulled from a CKRecord <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + internal protocol CKRecordValueConvertible : __CKRecordObjCValue { <nl> + / / Convert to CKRecordValueProtocols <nl> + func swiftNativeValue ( ) - > CKRecordValueProtocol <nl> + } <nl> + <nl> + / / MARK : - Converting between record value types <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension __CKRecordObjCValue { <nl> + internal func asSwiftNativeValue ( ) - > CKRecordValueProtocol { <nl> + let swiftValue : CKRecordValueProtocol <nl> + if let convertibleObjcRecordValue = self as ? CKRecordValueConvertible { <nl> + swiftValue = convertibleObjcRecordValue . swiftNativeValue ( ) <nl> + } else { <nl> + swiftValue = self as ! CKRecordValueProtocol <nl> + } <nl> + return swiftValue <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecordValueProtocol { <nl> + fileprivate func asObjCRecordValue ( ) - > __CKRecordObjCValue { <nl> + let objcValue : __CKRecordObjCValue <nl> + if let convertibleSwiftRecordValue = self as ? CKObjCRecordValueConvertible { <nl> + objcValue = convertibleSwiftRecordValue . objcRecordValue ( ) <nl> + } else { <nl> + objcValue = self as ! __CKRecordObjCValue <nl> + } <nl> + return objcValue <nl> + } <nl> + } <nl> + <nl> + / / MARK : - Get and Set RecordValues on records <nl> + <nl> + @ available ( macOS 10 . 11 , iOS 9 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecordKeyValueSetting { <nl> + @ nonobjc <nl> + public subscript < T : CKRecordValueProtocol > ( key : CKRecord . FieldKey ) - > T ? { <nl> + get { <nl> + if let objcValue : __CKRecordObjCValue = self . object ( forKey : key ) { <nl> + / * I ' d really like to do this statically , by implementing a separate subscript that takes < T : CKObjCRecordValueConvertible > . But that doesn ' t seem to work : < rdar : / / problem / 32911583 > Can ' t overload subscript generics with inherited protocols in protocol extension * / <nl> + if let ConvertibleT = T . self as ? CKObjCRecordValueConvertible . Type { <nl> + return ( ConvertibleT . fromObjcRecordValue ( objcValue ) as ! T ) <nl> + } else { <nl> + return ( objcValue . asSwiftNativeValue ( ) as ! T ) <nl> + } <nl> + } <nl> + return nil <nl> + } <nl> + set { <nl> + self [ key ] = newValue ? . asObjCRecordValue ( ) <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + public subscript ( key : CKRecord . FieldKey ) - > CKRecordValueProtocol ? { <nl> + get { <nl> + if let objcValue : __CKRecordObjCValue = self . object ( forKey : key ) { <nl> + return objcValue . asSwiftNativeValue ( ) <nl> + } <nl> + return nil <nl> + } <nl> + set { <nl> + self [ key ] = newValue ? . asObjCRecordValue ( ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / MARK : - CKRecord Value Protocol conformance <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKObjCRecordValueConvertible { <nl> + static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Self { <nl> + return objcRecordValue as ! Self <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension String : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return self as NSString } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Date : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return self as NSDate } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Data : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return self as NSData } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Bool : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Bool { return ( objcRecordValue as ! NSNumber ) . boolValue } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Double : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Double { return ( objcRecordValue as ! NSNumber ) . doubleValue } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Int : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Int { return ( objcRecordValue as ! NSNumber ) . intValue } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension UInt : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > UInt { return ( objcRecordValue as ! NSNumber ) . uintValue } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Int8 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Int8 { return ( objcRecordValue as ! NSNumber ) . int8Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension UInt8 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > UInt8 { return ( objcRecordValue as ! NSNumber ) . uint8Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Int16 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Int16 { return ( objcRecordValue as ! NSNumber ) . int16Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension UInt16 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > UInt16 { return ( objcRecordValue as ! NSNumber ) . uint16Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Int32 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Int32 { return ( objcRecordValue as ! NSNumber ) . int32Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension UInt32 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > UInt32 { return ( objcRecordValue as ! NSNumber ) . uint32Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Int64 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Int64 { return ( objcRecordValue as ! NSNumber ) . int64Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension UInt64 : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > UInt64 { return ( objcRecordValue as ! NSNumber ) . uint64Value } <nl> + } <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Float : CKRecordValueProtocol , CKObjCRecordValueConvertible { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { return NSNumber ( value : self ) } <nl> + fileprivate static func fromObjcRecordValue ( _ objcRecordValue : __CKRecordObjCValue ) - > Float { return ( objcRecordValue as ! NSNumber ) . floatValue } <nl> + } <nl> + <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension Array : CKRecordValueProtocol , CKObjCRecordValueConvertible where Element : CKRecordValueProtocol { <nl> + fileprivate func objcRecordValue ( ) - > __CKRecordObjCValue { <nl> + let retVal = NSMutableArray ( ) <nl> + self . forEach { retVal . add ( $ 0 . asObjCRecordValue ( ) ) } <nl> + return retVal <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension NSString : CKRecordValueProtocol , CKRecordValueConvertible { <nl> + internal func swiftNativeValue ( ) - > CKRecordValueProtocol { return self as String } <nl> + } <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension NSDate : CKRecordValueProtocol , CKRecordValueConvertible { <nl> + internal func swiftNativeValue ( ) - > CKRecordValueProtocol { return self as Date } <nl> + } <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension NSData : CKRecordValueProtocol , CKRecordValueConvertible { <nl> + internal func swiftNativeValue ( ) - > CKRecordValueProtocol { return self as Data } <nl> + } <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension NSNumber : CKRecordValueProtocol , CKRecordValueConvertible { <nl> + internal func swiftNativeValue ( ) - > CKRecordValueProtocol { <nl> + / / All numbers come back as Int64 or Double , matching our protobuf conversion <nl> + / / In some cases ( record accessor methods ) we have more type info , and can be smarter . But not here . <nl> + if CFNumberIsFloatType ( self ) { <nl> + return self . doubleValue <nl> + } else { <nl> + return self . int64Value <nl> + } <nl> + } <nl> + } <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension NSArray : CKRecordValueProtocol , CKRecordValueConvertible { <nl> + internal func swiftNativeValue ( ) - > CKRecordValueProtocol { <nl> + var retVal = [ CKRecordValueProtocol ] ( ) <nl> + for element in self { <nl> + let objcRecordValue = element as ! __CKRecordObjCValue <nl> + let swiftValue = objcRecordValue . asSwiftNativeValue ( ) <nl> + retVal . append ( swiftValue ) <nl> + } <nl> + return retVal as CKRecordValueProtocol <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecord . Reference : CKRecordValueProtocol { } <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKAsset : CKRecordValueProtocol { } <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CLLocation : CKRecordValueProtocol { } <nl> + <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 59eeb9d8c17e <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKRecordZone_ID . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecordZone . ID { <nl> + / * * <nl> + - parameter zoneName : Zone names must be 255 characters or less . Most UTF - 8 characters are valid . Defaults to CKRecordZone . ID . defaultZoneName <nl> + - parameter ownerName : defaults to CurrentUserDefaultName <nl> + * / <nl> + public convenience init ( zoneName : String = CKRecordZone . ID . defaultZoneName , ownerName : String = " __defaultOwner__ " ) { <nl> + / / CKCurrentUserDefaultName would be preferable to __defaultOwner__ , but that only came around in macOS 10 . 12 and friends . <nl> + self . init ( __zoneName : zoneName , ownerName : ownerName ) <nl> + } <nl> + <nl> + public static let ` default ` = CKRecordZone . ID ( zoneName : CKRecordZone . ID . defaultZoneName , ownerName : " __defaultOwner__ " ) <nl> + / / CKCurrentUserDefaultName would be preferable to __defaultOwner__ , but that only came around in macOS 10 . 12 and friends . <nl> + public static let defaultZoneName = __CKRecordZoneDefaultName <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKRecordZone . ID . defaultZoneName " ) <nl> + public let CKRecordZoneDefaultName : String = __CKRecordZoneDefaultName <nl> + <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . aecb5b2e2f1c <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKRecord_ID . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + / / / A class coupling a record name and a record zone id <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecord . ID { <nl> + / * * <nl> + - parameter recordName : CKRecord names must be 255 characters or less . Most UTF - 8 characters are valid . Defaults to UUID ( ) . uuidString <nl> + - parameter zoneID : defaults to the default record zone id <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( recordName : String = UUID ( ) . uuidString , zoneID : CKRecordZone . ID = CKRecordZone . ID . default ) { <nl> + self . init ( __recordName : recordName , zoneID : zoneID ) <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . e8a0240f9d31 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKRecord_Reference . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecord . Reference { <nl> + / / / TODO : replace this with a . apinotes entry once there ' s a fix for 39261783 <nl> + @ available ( swift 4 . 2 ) <nl> + public typealias Action = CKRecord_Reference_Action <nl> + } <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 4ee425359b6f <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKShare . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKShare { <nl> + @ available ( swift 4 . 2 ) <nl> + public enum SystemFieldKey { <nl> + public static let title : CKRecord . FieldKey = __CKShareTitleKey as CKRecord . FieldKey <nl> + public static let thumbnailImageData : CKRecord . FieldKey = __CKShareThumbnailImageDataKey as CKRecord . FieldKey <nl> + public static let shareType : CKRecord . FieldKey = __CKShareTypeKey as CKRecord . FieldKey <nl> + } <nl> + } <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . bacd8c710c48 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKShare_Participant . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKShare . Participant { <nl> + / / / TODO : replace these with a . apinotes entry once there ' s a fix for 39261783 <nl> + @ available ( swift 4 . 2 ) <nl> + public typealias AcceptanceStatus = CKShare_Participant_AcceptanceStatus <nl> + <nl> + @ available ( swift 4 . 2 ) <nl> + public typealias Permission = CKShare_Participant_Permission <nl> + <nl> + @ available ( swift 4 . 2 ) <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 5 . 0 , * ) <nl> + public typealias Role = CKShare_Participant_Role <nl> + <nl> + @ available ( swift 4 . 2 ) <nl> + @ available ( macOS , deprecated : 10 . 14 , renamed : " CKShare . Participant . Role " ) <nl> + @ available ( iOS , deprecated : 12 . 0 , renamed : " CKShare . Participant . Role " ) <nl> + @ available ( tvOS , deprecated : 12 . 0 , renamed : " CKShare . Participant . Role " ) <nl> + @ available ( watchOS , deprecated : 5 . 0 , renamed : " CKShare . Participant . Role " ) <nl> + public typealias ParticipantType = CKShare_Participant_ParticipantType <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 24e85cf7a0bc <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / CKSubscription_NotificationInfo . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + # if ! os ( watchOS ) <nl> + <nl> + / * * <nl> + The payload of a push notification delivered in the UIApplication ` application : didReceiveRemoteNotification : ` delegate method contains information about the firing subscription . <nl> + <nl> + Use ` Notification ( fromRemoteNotificationDictionary : ) ` to parse that payload . <nl> + On tvOS , alerts , badges , sounds , and categories are not handled in push notifications . However , Subscriptions remain available to help you avoid polling the server . <nl> + * / <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKSubscription . NotificationInfo { <nl> + / / / A list of field names to take from the matching record that is used as substitution variables in a formatted alert string . <nl> + # if ! os ( tvOS ) <nl> + <nl> + @ available ( tvOS , unavailable ) <nl> + @ available ( swift 4 . 2 ) <nl> + public var alertLocalizationArgs : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __alertLocalizationArgs } <nl> + set { self . __alertLocalizationArgs = newValue } <nl> + } <nl> + <nl> + / / / A list of field names to take from the matching record that is used as substitution variables in a formatted title string . <nl> + @ available ( macOS 10 . 13 , iOS 11 . 0 , * ) @ available ( tvOS , unavailable ) <nl> + @ available ( swift 4 . 2 ) <nl> + public var titleLocalizationArgs : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __titleLocalizationArgs } <nl> + set { self . __titleLocalizationArgs = newValue } <nl> + } <nl> + <nl> + / / / A list of field names to take from the matching record that is used as substitution variables in a formatted subtitle string . <nl> + @ available ( macOS 10 . 13 , iOS 11 . 0 , * ) @ available ( tvOS , unavailable ) <nl> + @ available ( swift 4 . 2 ) <nl> + public var subtitleLocalizationArgs : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __subtitleLocalizationArgs } <nl> + set { self . __subtitleLocalizationArgs = newValue } <nl> + } <nl> + <nl> + # endif / / ! os ( tvOS ) <nl> + <nl> + / * * <nl> + A list of keys from the matching record to include in the notification payload . <nl> + <nl> + Only some keys are allowed . The value types associated with those keys on the server must be one of these classes : <nl> + - CKRecord . Reference <nl> + - CLLocation <nl> + - NSDate <nl> + - NSNumber <nl> + - NSString <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var desiredKeys : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __desiredKeys } <nl> + set { self . __desiredKeys = newValue } <nl> + } <nl> + <nl> + public convenience init ( alertBody : String ? = nil , <nl> + alertLocalizationKey : String ? = nil , <nl> + alertLocalizationArgs : [ CKRecord . FieldKey ] = [ ] , <nl> + title : String ? = nil , <nl> + titleLocalizationKey : String ? = nil , <nl> + titleLocalizationArgs : [ CKRecord . FieldKey ] = [ ] , <nl> + subtitle : String ? = nil , <nl> + subtitleLocalizationKey : String ? = nil , <nl> + subtitleLocalizationArgs : [ CKRecord . FieldKey ] = [ ] , <nl> + alertActionLocalizationKey : String ? = nil , <nl> + alertLaunchImage : String ? = nil , <nl> + soundName : String ? = nil , <nl> + desiredKeys : [ CKRecord . FieldKey ] = [ ] , <nl> + shouldBadge : Bool = false , <nl> + shouldSendContentAvailable : Bool = false , <nl> + shouldSendMutableContent : Bool = false , <nl> + category : String ? = nil , <nl> + collapseIDKey : String ? = nil ) { <nl> + <nl> + self . init ( ) <nl> + <nl> + # if ! os ( tvOS ) <nl> + do { <nl> + self . alertBody = alertBody <nl> + self . alertLocalizationKey = alertLocalizationKey <nl> + self . alertLocalizationArgs = alertLocalizationArgs <nl> + <nl> + if # available ( macOS 10 . 13 , iOS 11 . 0 , * ) { <nl> + self . title = title <nl> + self . titleLocalizationKey = titleLocalizationKey <nl> + self . titleLocalizationArgs = titleLocalizationArgs <nl> + self . subtitle = subtitle <nl> + self . subtitleLocalizationKey = subtitleLocalizationKey <nl> + self . subtitleLocalizationArgs = subtitleLocalizationArgs <nl> + } <nl> + <nl> + self . alertActionLocalizationKey = alertActionLocalizationKey <nl> + self . alertLaunchImage = alertLaunchImage <nl> + self . soundName = soundName <nl> + } <nl> + # endif / / ! os ( tvOS ) <nl> + <nl> + self . desiredKeys = desiredKeys <nl> + <nl> + if # available ( tvOS 10 . 0 , * ) { <nl> + self . shouldBadge = shouldBadge <nl> + } <nl> + self . shouldSendContentAvailable = shouldSendContentAvailable <nl> + if # available ( macOS 10 . 13 , iOS 11 . 0 , tvOS 11 . 0 , * ) { <nl> + self . shouldSendMutableContent = shouldSendMutableContent <nl> + } <nl> + # if ! os ( tvOS ) <nl> + do { <nl> + if # available ( macOS 10 . 11 , iOS 9 . 0 , * ) { <nl> + self . category = category <nl> + } <nl> + } <nl> + # endif / / ! os ( tvOS ) <nl> + if # available ( macOS 10 . 13 , iOS 11 . 0 , tvOS 11 . 0 , * ) { <nl> + self . collapseIDKey = collapseIDKey <nl> + } <nl> + } <nl> + } <nl> + <nl> + # endif / / ! os ( watchOS ) <nl> mmm a / stdlib / public / SDK / CloudKit / CMakeLists . txt <nl> ppp b / stdlib / public / SDK / CloudKit / CMakeLists . txt <nl> cmake_minimum_required ( VERSION 3 . 4 . 3 ) <nl> include ( " . . / . . / . . / . . / cmake / modules / StandaloneOverlay . cmake " ) <nl> <nl> add_swift_library ( swiftCloudKit $ { SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES } IS_SDK_OVERLAY <nl> + NestedNames . swift <nl> + TypealiasStrings . swift <nl> CKError . swift <nl> + CKFetchRecordZoneChangesOperation . swift <nl> + CKRecord . swift <nl> + CKRecordZone_ID . swift <nl> + CKRecord_ID . swift <nl> + CKRecord_Reference . swift <nl> + CKShare . swift <nl> + CKShare_Participant . swift <nl> + CKSubscription_NotificationInfo . swift <nl> + CKRecordValue . swift <nl> + DefaultParameters . swift <nl> <nl> - SWIFT_COMPILE_FLAGS " $ { SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS } " <nl> + SWIFT_COMPILE_FLAGS " $ { SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS } " " - swift - version " " 4 . 2 " <nl> LINK_FLAGS " $ { SWIFT_RUNTIME_SWIFT_LINK_FLAGS } " <nl> TARGET_SDKS OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR WATCHOS WATCHOS_SIMULATOR <nl> <nl> new file mode 100644 <nl> index 000000000000 . . b4628faa87ab <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / DefaultParameters . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 5 . 0 , * ) <nl> + extension CKFetchRecordZoneChangesOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( recordZoneIDs : [ CKRecordZone . ID ] ? = nil , configurationsByRecordZoneID : [ CKRecordZone . ID : ZoneConfiguration ] ? = nil ) { <nl> + self . init ( ) <nl> + self . recordZoneIDs = recordZoneIDs <nl> + self . configurationsByRecordZoneID = configurationsByRecordZoneID <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKModifyRecordZonesOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( recordZonesToSave : [ CKRecordZone ] ? = nil , recordZoneIDsToDelete : [ CKRecordZone . ID ] ? = nil ) { <nl> + self . init ( ) <nl> + self . recordZonesToSave = recordZonesToSave <nl> + self . recordZoneIDsToDelete = recordZoneIDsToDelete <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKModifyRecordsOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( recordsToSave : [ CKRecord ] ? = nil , recordIDsToDelete : [ CKRecord . ID ] ? = nil ) { <nl> + self . init ( ) <nl> + self . recordsToSave = recordsToSave <nl> + self . recordIDsToDelete = recordIDsToDelete <nl> + } <nl> + } <nl> + <nl> + # if ! os ( watchOS ) <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKModifySubscriptionsOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( subscriptionsToSave : [ CKSubscription ] ? = nil , subscriptionIDsToDelete : [ CKSubscription . ID ] ? = nil ) { <nl> + self . init ( ) <nl> + self . subscriptionsToSave = subscriptionsToSave <nl> + self . __subscriptionIDsToDelete = subscriptionIDsToDelete <nl> + } <nl> + } <nl> + <nl> + # endif / / os ( watchOS ) <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecord { <nl> + @ available ( swift , introduced : 4 . 2 , deprecated : 4 . 2 , message : " Use init ( recordType : recordID : ) + CKRecord . ID ( zoneID : ) instead " ) <nl> + public convenience init ( recordType : CKRecord . RecordType , zoneID : CKRecordZone . ID ) { <nl> + self . init ( recordType : recordType , recordID : CKRecord . ID ( zoneID : zoneID ) ) <nl> + } <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( recordType : CKRecord . RecordType , recordID : CKRecord . ID = CKRecord . ID ( ) ) { <nl> + self . init ( __recordType : recordType , recordID : recordID ) <nl> + } <nl> + } <nl> + <nl> + # if ! os ( watchOS ) <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKQuerySubscription { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( recordType : CKRecord . RecordType , predicate : NSPredicate , subscriptionID : CKSubscription . ID = UUID ( ) . uuidString , options querySubscriptionOptions : CKQuerySubscription . Options = [ ] ) { <nl> + self . init ( __recordType : recordType , predicate : predicate , subscriptionID : subscriptionID , options : querySubscriptionOptions ) <nl> + } <nl> + } <nl> + <nl> + # endif / / ! os ( watchOS ) <nl> new file mode 100644 <nl> index 000000000000 . . e4bf2c577a58 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / NestedNames . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + / / Work arounds for 39295365 , 39261783 <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + public extension CKContainer { <nl> + @ available ( swift 4 . 2 ) <nl> + public enum Application { <nl> + public typealias Permissions = CKContainer_Application_Permissions <nl> + public typealias PermissionStatus = CKContainer_Application_PermissionStatus <nl> + public typealias PermissionBlock = CKContainer_Application_PermissionBlock <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public typealias ID = String <nl> + } <nl> + <nl> + # if os ( watchOS ) <nl> + <nl> + @ available ( watchOS 3 . 0 , * ) <nl> + public enum CKSubscription { } <nl> + <nl> + # endif / / os ( watchOS ) <nl> + <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKSubscription { <nl> + @ available ( swift 4 . 2 ) <nl> + public typealias ID = String <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . c6646076a1bd <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / CloudKit / TypealiasStrings . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import CloudKit / / Clang module <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 9 . 3 , tvOS 9 . 2 , watchOS 3 . 0 , * ) <nl> + extension CKContainer { <nl> + / * * <nl> + If a long lived operation is cancelled or finishes completely it is no longer returned by this call . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public func fetchAllLongLivedOperationIDs ( completionHandler : @ escaping ( [ CKOperation . ID ] ? , Error ? ) - > Void ) { <nl> + self . __fetchAllLongLivedOperationIDs ( completionHandler : completionHandler ) <nl> + } <nl> + / * * <nl> + Long lived CKOperations returned by this call must be started on an operation queue . <nl> + Remember to set the callback blocks before starting the operation . <nl> + If an operation has already completed against the server , and is subsequently resumed , that operation will replay all of its callbacks from the start of the operation , but the request will not be re - sent to the server . <nl> + If a long lived operation is cancelled or finishes completely it is no longer returned by this call . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public func fetchLongLivedOperation ( withID operationID : CKOperation . ID , completionHandler : @ escaping ( CKOperation ? , Error ? ) - > Void ) { <nl> + self . __fetchLongLivedOperation ( withID : operationID , completionHandler : completionHandler ) <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 9 . 3 , tvOS 9 . 2 , watchOS 3 . 0 , * ) <nl> + extension CKOperation { <nl> + / * * This is an identifier unique to this CKOperation . <nl> + <nl> + This value is chosen by the system , and will be unique to this instance of a CKOperation . This identifier will be sent to Apple ' s servers , and can be used to identify any server - side logging associated with this operation . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var operationID : CKOperation . ID { <nl> + get { return self . __operationID as CKOperation . ID } <nl> + } <nl> + } <nl> + <nl> + # if ! os ( watchOS ) <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKModifySubscriptionsOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public var subscriptionIDsToDelete : [ CKSubscription . ID ] ? { <nl> + get { return self . __subscriptionIDsToDelete } <nl> + set { self . __subscriptionIDsToDelete = newValue } <nl> + } <nl> + / * * This block is called when the operation completes . <nl> + <nl> + The Operation . completionBlock will also be called if both are set . <nl> + If the error is ` CKErrorPartialFailure ` , the error ' s userInfo dictionary contains a dictionary of subscriptionIDs to errors keyed off of ` CKPartialErrorsByItemIDKey ` . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var modifySubscriptionsCompletionBlock : ( ( [ CKSubscription ] ? , [ CKSubscription . ID ] ? , Error ? ) - > Void ) ? { <nl> + get { return self . __modifySubscriptionsCompletionBlock } <nl> + set { self . __modifySubscriptionsCompletionBlock = newValue } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKFetchSubscriptionsOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( subscriptionIDs : [ CKSubscription . ID ] ) { <nl> + self . init ( __subscriptionIDs : subscriptionIDs ) <nl> + } <nl> + <nl> + @ available ( swift 4 . 2 ) <nl> + public var subscriptionIDs : [ CKSubscription . ID ] ? { <nl> + get { return self . __subscriptionIDs } <nl> + set { self . __subscriptionIDs = newValue } <nl> + } <nl> + / * * This block is called when the operation completes . <nl> + <nl> + The Operation . completionBlock will also be called if both are set . <nl> + If the error is ` CKErrorPartialFailure ` , the error ' s userInfo dictionary contains a dictionary of subscriptionID to errors keyed off of ` CKPartialErrorsByItemIDKey ` . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var fetchSubscriptionCompletionBlock : ( ( [ CKSubscription . ID : CKSubscription ] ? , Error ? ) - > Void ) ? { <nl> + get { return self . __fetchSubscriptionCompletionBlock } <nl> + set { self . __fetchSubscriptionCompletionBlock = newValue } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKDatabase { <nl> + @ available ( swift 4 . 2 ) <nl> + public func fetch ( withSubscriptionID subscriptionID : CKSubscription . ID , completionHandler : @ escaping ( CKSubscription ? , Error ? ) - > Void ) { <nl> + self . __fetch ( withSubscriptionID : subscriptionID , completionHandler : completionHandler ) <nl> + } <nl> + @ available ( swift 4 . 2 ) <nl> + public func delete ( withSubscriptionID subscriptionID : CKSubscription . ID , completionHandler : @ escaping ( String ? , Error ? ) - > Void ) { <nl> + self . __delete ( withSubscriptionID : subscriptionID , completionHandler : completionHandler ) <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKSubscription { <nl> + @ available ( swift 4 . 2 ) <nl> + public var subscriptionID : CKSubscription . ID { <nl> + get { return self . __subscriptionID } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKQuerySubscription { <nl> + / / / The record type that this subscription watches <nl> + @ available ( swift 4 . 2 ) <nl> + public var recordType : CKRecord . RecordType ? { <nl> + get { return self . __recordType } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKRecordZoneSubscription { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( zoneID : CKRecordZone . ID , subscriptionID : CKSubscription . ID ) { <nl> + self . init ( __zoneID : zoneID , subscriptionID : subscriptionID ) <nl> + } <nl> + / / / Optional property . If set , a zone subscription is scoped to record changes for this record type <nl> + @ available ( swift 4 . 2 ) <nl> + public var recordType : CKRecord . RecordType ? { <nl> + get { return self . __recordType } <nl> + set { self . __recordType = newValue } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , * ) @ available ( watchOS , unavailable ) <nl> + extension CKDatabaseSubscription { <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( subscriptionID : CKSubscription . ID ) { <nl> + self . init ( __subscriptionID : subscriptionID ) <nl> + } <nl> + / / / Optional property . If set , a database subscription is scoped to record changes for this record type <nl> + @ available ( swift 4 . 2 ) <nl> + public var recordType : CKRecord . RecordType ? { <nl> + get { return self . __recordType } <nl> + set { self . __recordType = newValue } <nl> + } <nl> + } <nl> + <nl> + # endif / / ! os ( watchOS ) <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 11 , iOS 9 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKNotification { <nl> + / / / The ID of the subscription that caused this notification to fire <nl> + @ available ( swift 4 . 2 ) <nl> + public var subscriptionID : CKSubscription . ID ? { <nl> + get { return self . __subscriptionID } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKFetchRecordZoneChangesOperation { <nl> + @ available ( swift 4 . 2 ) <nl> + public var recordWithIDWasDeletedBlock : ( ( CKRecord . ID , CKRecord . RecordType ) - > Void ) ? { <nl> + get { return self . __recordWithIDWasDeletedBlock } <nl> + set { self . __recordWithIDWasDeletedBlock = newValue } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKQuery { <nl> + / / / Use ` NSPredicate ( value : true ) ` if you want to query for all records of a given type . <nl> + @ available ( swift 4 . 2 ) <nl> + public convenience init ( recordType : CKRecord . RecordType , predicate : NSPredicate ) { <nl> + self . init ( __recordType : recordType , predicate : predicate ) <nl> + } <nl> + @ available ( swift 4 . 2 ) <nl> + public var recordType : CKRecord . RecordType { <nl> + get { return self . __recordType } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKRecord { <nl> + @ available ( swift 4 . 2 ) <nl> + public var recordType : CKRecord . RecordType { <nl> + get { return self . __recordType } <nl> + } <nl> + / * * In addition to ` object ( forKey : ) ` and ` setObject ( _ : forKey : ) ` , dictionary - style subscripting ( ` record [ key ] ` and ` record [ key ] = value ` ) can be used to get and set values . <nl> + Acceptable value object classes are : <nl> + - String <nl> + - Date <nl> + - Data <nl> + - Bool <nl> + - Int <nl> + - UInt <nl> + - Float <nl> + - Double <nl> + - [ U ] Int8 et al <nl> + - CKReference / Record . Reference <nl> + - CKAsset <nl> + - CLLocation <nl> + - NSData <nl> + - NSDate <nl> + - NSNumber <nl> + - NSString <nl> + - Array and / or NSArray containing objects of any of the types above <nl> + <nl> + Any other classes will result in an exception with name ` NSInvalidArgumentException ` . <nl> + <nl> + Field keys starting with ' _ ' are reserved . Attempting to set a key prefixed with a ' _ ' will result in an error . <nl> + <nl> + Key names roughly match C variable name restrictions . They must begin with an ASCII letter and can contain ASCII letters and numbers and the underscore character . <nl> + The maximum key length is 255 characters . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public func object ( forKey key : CKRecord . FieldKey ) - > __CKRecordObjCValue ? { <nl> + return self . __object ( forKey : key ) <nl> + } <nl> + @ available ( swift 4 . 2 ) <nl> + public func setObject ( _ object : __CKRecordObjCValue ? , forKey key : CKRecord . FieldKey ) { <nl> + self . __setObject ( object , forKey : key ) <nl> + } <nl> + @ available ( swift 4 . 2 ) <nl> + public subscript ( key : CKRecord . FieldKey ) - > __CKRecordObjCValue ? { <nl> + get { return self . object ( forKey : key ) } <nl> + set { self . setObject ( newValue , forKey : key ) } <nl> + } <nl> + @ available ( swift 4 . 2 ) <nl> + public func allKeys ( ) - > [ CKRecord . FieldKey ] { <nl> + return self . __allKeys ( ) <nl> + } <nl> + / / / A list of keys that have been modified on the local CKRecord instance <nl> + @ available ( swift 4 . 2 ) <nl> + public func changedKeys ( ) - > [ CKRecord . FieldKey ] { <nl> + return self . __changedKeys ( ) <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKFetchShareMetadataOperation { <nl> + / * * Declares which user - defined keys should be fetched and added to the resulting ` rootRecord ` . <nl> + <nl> + Only consulted if ` shouldFetchRootRecord ` is YES . <nl> + If nil , declares the entire root record should be downloaded . If set to an empty array , declares that no user fields should be downloaded . <nl> + Defaults to nil . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var rootRecordDesiredKeys : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __rootRecordDesiredKeys } <nl> + set { self . __rootRecordDesiredKeys = newValue } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKFetchRecordsOperation { <nl> + / * * Declares which user - defined keys should be fetched and added to the resulting CKRecords . <nl> + <nl> + If nil , declares the entire record should be downloaded . If set to an empty array , declares that no user fields should be downloaded . <nl> + Defaults to nil . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var desiredKeys : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __desiredKeys } <nl> + set { self . __desiredKeys = newValue } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + extension CKQueryOperation { <nl> + / * * Declares which user - defined keys should be fetched and added to the resulting CKRecords . <nl> + <nl> + If nil , declares the entire record should be downloaded . If set to an empty array , declares that no user fields should be downloaded . <nl> + Defaults to nil . <nl> + * / <nl> + @ available ( swift 4 . 2 ) <nl> + public var desiredKeys : [ CKRecord . FieldKey ] ? { <nl> + get { return self . __desiredKeys } <nl> + set { self . __desiredKeys = newValue } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 10 , iOS 8 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKRecord . SystemType . userRecord " ) <nl> + public let CKRecordTypeUserRecord : String = __CKRecordTypeUserRecord <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKRecord . SystemFieldKey . parent " ) <nl> + public let CKRecordParentKey : String = __CKRecordParentKey <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKRecord . SystemFieldKey . share " ) <nl> + public let CKRecordShareKey : String = __CKRecordShareKey <nl> + <nl> + <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKRecord . SystemType . share " ) <nl> + public let CKRecordTypeShare : String = __CKRecordTypeShare <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKShare . SystemFieldKey . title " ) <nl> + public let CKShareTitleKey : String = __CKShareTitleKey <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKShare . SystemFieldKey . thumbnailImageData " ) <nl> + public let CKShareThumbnailImageDataKey : String = __CKShareThumbnailImageDataKey <nl> + <nl> + @ nonobjc <nl> + @ available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " CKShare . SystemFieldKey . shareType " ) <nl> + public let CKShareTypeKey : String = __CKShareTypeKey <nl> + <nl> + <nl> mmm a / stdlib / public / SDK / CoreMedia / CMTimeRange . swift <nl> ppp b / stdlib / public / SDK / CoreMedia / CMTimeRange . swift <nl> extension CMTimeRange { <nl> return self . isValid & & ( self . duration = = kCMTimeZero ) <nl> } <nl> <nl> - public var end : CMTime { <nl> - return CMTimeRangeGetEnd ( self ) <nl> - } <nl> - <nl> public func union ( _ otherRange : CMTimeRange ) - > CMTimeRange { <nl> return CMTimeRangeGetUnion ( self , otherRange ) <nl> } <nl> mmm a / stdlib / public / SDK / Foundation / NSCoder . swift <nl> ppp b / stdlib / public / SDK / Foundation / NSCoder . swift <nl> extension NSKeyedUnarchiver { <nl> <nl> @ nonobjc <nl> @ available ( macOS 10 . 13 , iOS 11 . 0 , watchOS 4 . 0 , tvOS 11 . 0 , * ) <nl> - public static func unarchivedObject < DecodedObjectType > ( ofClass cls : DecodedObjectType . Type , from data : Data ) throws - > DecodedObjectType ? { <nl> + public static func unarchivedObject < DecodedObjectType > ( ofClass cls : DecodedObjectType . Type , from data : Data ) throws - > DecodedObjectType ? where DecodedObjectType : NSCoding , DecodedObjectType : NSObject { <nl> var error : NSError ? <nl> let result = __NSKeyedUnarchiverSecureUnarchiveObjectOfClass ( cls as ! AnyClass , data , & error ) <nl> try resolveError ( error ) <nl> mmm a / stdlib / public / SDK / Intents / CMakeLists . txt <nl> ppp b / stdlib / public / SDK / Intents / CMakeLists . txt <nl> add_swift_library ( swiftIntents $ { SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES } IS_SDK_O <nl> INIntegerResolutionResult . swift <nl> INNotebookItemTypeResolutionResult . swift <nl> INParameter . swift <nl> + INPlayMediaIntent . swift <nl> INRequestRideIntent . swift <nl> INRideOption . swift <nl> INSaveProfileInCarIntent . swift <nl> add_swift_library ( swiftIntents $ { SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES } IS_SDK_O <nl> INSetSeatSettingsInCarIntent . swift <nl> INStartPhotoPlaybackIntentResponse . swift <nl> INStartWorkoutIntent . swift <nl> + NSStringIntents . swift <nl> <nl> SWIFT_COMPILE_FLAGS " $ { SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS } " <nl> LINK_FLAGS " $ { SWIFT_RUNTIME_SWIFT_LINK_FLAGS } " <nl> new file mode 100644 <nl> index 000000000000 . . e9e010d8d27f <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Intents / INPlayMediaIntent . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import Intents <nl> + import Foundation <nl> + <nl> + # if os ( iOS ) | | os ( watchOS ) <nl> + @ available ( iOS 12 . 0 , watchOS 5 . 0 , * ) <nl> + extension INPlayMediaIntent { <nl> + @ nonobjc <nl> + public convenience init ( <nl> + mediaItems : [ INMediaItem ] ? = nil , <nl> + mediaContainer : INMediaItem ? = nil , <nl> + playShuffled : Bool ? = nil , <nl> + playbackRepeatMode : INPlaybackRepeatMode = . unknown , <nl> + resumePlayback : Bool ? = nil <nl> + ) { <nl> + self . init ( __mediaItems : mediaItems , <nl> + mediaContainer : mediaContainer , <nl> + playShuffled : playShuffled . map { NSNumber ( value : $ 0 ) } , <nl> + playbackRepeatMode : playbackRepeatMode , <nl> + resumePlayback : resumePlayback . map { NSNumber ( value : $ 0 ) } ) <nl> + } <nl> + <nl> + @ nonobjc <nl> + public final var playShuffled : Bool ? { <nl> + return __playShuffled ? . boolValue <nl> + } <nl> + <nl> + @ nonobjc <nl> + public final var resumePlayback : Bool ? { <nl> + return __resumePlayback ? . boolValue <nl> + } <nl> + } <nl> + # endif <nl> new file mode 100644 <nl> index 000000000000 . . 9d6d00e9daa5 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Intents / NSStringIntents . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import Intents <nl> + import Foundation <nl> + <nl> + extension NSString { <nl> + @ available ( OSX 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , * ) <nl> + public class func deferredLocalizedIntentsString ( with format : String , _ args : CVarArg . . . ) - > NSString { <nl> + return withVaList ( args ) { <nl> + self . __deferredLocalizedIntentsString ( withFormat : format , fromTable : nil , arguments : $ 0 ) as NSString <nl> + } <nl> + } <nl> + <nl> + @ available ( OSX 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , * ) <nl> + public class func deferredLocalizedIntentsString ( with format : String , table : String , _ args : CVarArg . . . ) - > NSString { <nl> + return withVaList ( args ) { <nl> + self . __deferredLocalizedIntentsString ( withFormat : format , fromTable : table , arguments : $ 0 ) as NSString <nl> + } <nl> + } <nl> + <nl> + @ available ( OSX 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , * ) <nl> + public class func deferredLocalizedIntentsString ( with format : String , table : String , arguments : CVaListPointer ) - > NSString { <nl> + return self . __deferredLocalizedIntentsString ( withFormat : format , fromTable : table , arguments : arguments ) as NSString <nl> + } <nl> + } <nl> mmm a / stdlib / public / SDK / Metal / Metal . swift <nl> ppp b / stdlib / public / SDK / Metal / Metal . swift <nl> extension MTLComputeCommandEncoder { <nl> public func setSamplerStates ( _ samplers : [ MTLSamplerState ? ] , lodMinClamps : [ Float ] , lodMaxClamps : [ Float ] , range : Range < Int > ) { <nl> __setSamplerStates ( samplers , lodMinClamps : lodMinClamps , lodMaxClamps : lodMaxClamps , with : NSRange ( location : range . lowerBound , length : range . count ) ) <nl> } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , * ) <nl> + public func memoryBarrier ( _ resources : [ MTLResource ] ) { <nl> + __memoryBarrier ( resources : resources , count : resources . count ) <nl> + } <nl> } <nl> <nl> @ available ( macOS 10 . 11 , iOS 8 . 0 , tvOS 8 . 0 , * ) <nl> extension MTLRenderCommandEncoder { <nl> __setTileSamplerStates ( samplers , lodMinClamps : lodMinClamps , lodMaxClamps : lodMaxClamps , with : NSRange ( location : range . lowerBound , length : range . count ) ) <nl> } <nl> # endif <nl> + <nl> + # if os ( macOS ) <nl> + @ available ( macOS 10 . 14 , * ) <nl> + public func memoryBarrier ( _ resources : [ MTLResource ] , after : MTLRenderStages , before : MTLRenderStages ) { <nl> + __memoryBarrier ( resources : resources , count : resources . count , after : after , before : before ) <nl> + } <nl> + # endif <nl> } <nl> <nl> @ available ( macOS 10 . 11 , iOS 8 . 0 , tvOS 8 . 0 , * ) <nl> new file mode 100644 <nl> index 000000000000 . . 3d68fb2eaed1 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / NaturalLanguage / CMakeLists . txt <nl> <nl> + cmake_minimum_required ( VERSION 3 . 4 . 3 ) <nl> + include ( " . . / . . / . . / . . / cmake / modules / StandaloneOverlay . cmake " ) <nl> + <nl> + add_swift_library ( swiftNaturalLanguage $ { SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES } IS_SDK_OVERLAY <nl> + NLLanguageRecognizer . swift <nl> + NLTagger . swift <nl> + NLTokenizer . swift <nl> + <nl> + SWIFT_COMPILE_FLAGS " $ { SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS } " <nl> + LINK_FLAGS " $ { SWIFT_RUNTIME_SWIFT_LINK_FLAGS } " <nl> + TARGET_SDKS OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR # WATCHOS WATCHOS_SIMULATOR <nl> + SWIFT_MODULE_DEPENDS_OSX Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + SWIFT_MODULE_DEPENDS_IOS Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + SWIFT_MODULE_DEPENDS_TVOS Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + # SWIFT_MODULE_DEPENDS_WATCHOS Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + <nl> + FRAMEWORK_DEPENDS_WEAK NaturalLanguage <nl> + <nl> + DEPLOYMENT_VERSION_OSX $ { SWIFTLIB_DEPLOYMENT_VERSION_NATURALLANGUAGE_OSX } <nl> + DEPLOYMENT_VERSION_IOS $ { SWIFTLIB_DEPLOYMENT_VERSION_NATURALLANGUAGE_IOS } <nl> + DEPLOYMENT_VERSION_TVOS $ { SWIFTLIB_DEPLOYMENT_VERSION_NATURALLANGUAGE_TVOS } <nl> + # DEPLOYMENT_VERSION_WATCHOS $ { SWIFTLIB_DEPLOYMENT_VERSION_NATURALLANGUAGE_WATCHOS } <nl> + ) <nl> new file mode 100644 <nl> index 000000000000 . . 1ff503b9dbe4 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / NaturalLanguage / NLLanguageRecognizer . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import NaturalLanguage <nl> + import Foundation <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + extension NLLanguageRecognizer { <nl> + @ nonobjc <nl> + public var languageHints : [ NLLanguage : Double ] { <nl> + get { <nl> + return self . __languageHints . mapValues { $ 0 . doubleValue } <nl> + } <nl> + set ( newHints ) { <nl> + self . __languageHints = newHints . mapValues { NSNumber ( value : $ 0 ) } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func languageHypotheses ( withMaximum maxHypotheses : Int ) - > [ NLLanguage : Double ] { <nl> + return self . __languageHypotheses ( withMaximum : maxHypotheses ) . mapValues { $ 0 . doubleValue } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . a4e39a3e9a33 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / NaturalLanguage / NLTagger . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import NaturalLanguage <nl> + import Foundation <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + extension NLTagger { <nl> + @ nonobjc <nl> + public func tokenRange ( at index : String . Index , unit : NLTokenUnit ) - > Range < String . Index > { <nl> + let str = self . string ? ? " " <nl> + let characterIndex = index . encodedOffset <nl> + let nsrange = self . __tokenRange ( at : characterIndex , unit : unit ) <nl> + return Range ( nsrange , in : str ) ! <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func tag ( at index : String . Index , unit : NLTokenUnit , scheme : NLTagScheme ) - > ( NLTag ? , Range < String . Index > ) { <nl> + let str = self . string ? ? " " <nl> + let characterIndex = index . encodedOffset <nl> + let rangePointer = NSRangePointer . allocate ( capacity : 1 ) <nl> + rangePointer . initialize ( to : NSMakeRange ( 0 , 0 ) ) <nl> + let tag = self . __tag ( at : characterIndex , unit : unit , scheme : scheme , tokenRange : rangePointer ) <nl> + let range = Range ( rangePointer . pointee , in : str ) ! <nl> + rangePointer . deallocate ( ) <nl> + return ( tag , range ) <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func enumerateTags ( in range : Range < String . Index > , unit : NLTokenUnit , scheme : NLTagScheme , options : NLTagger . Options = [ ] , using block : ( NLTag ? , Range < String . Index > ) - > Bool ) { <nl> + guard let str = self . string else { return } <nl> + let nsrange = NSRange ( range , in : str ) <nl> + self . __enumerateTags ( in : nsrange , unit : unit , scheme : scheme , options : options ) { ( tag , tokenNSRange , stop ) in <nl> + if let tokenRange = Range ( tokenNSRange , in : str ) { <nl> + let keepGoing = block ( tag , tokenRange ) <nl> + if ( ! keepGoing ) { <nl> + stop . pointee = true <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func tags ( in range : Range < String . Index > , unit : NLTokenUnit , scheme : NLTagScheme , options : NLTagger . Options = [ ] ) - > [ ( NLTag ? , Range < String . Index > ) ] { <nl> + var array : [ ( NLTag ? , Range < String . Index > ) ] = [ ] <nl> + self . enumerateTags ( in : range , unit : unit , scheme : scheme , options : options ) { ( tag , tokenRange ) - > Bool in <nl> + array . append ( ( tag , tokenRange ) ) <nl> + return true <nl> + } <nl> + return array <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func setLanguage ( _ language : NLLanguage , range : Range < String . Index > ) { <nl> + guard let str = self . string else { return } <nl> + let nsrange = NSRange ( range , in : str ) <nl> + self . __setLanguage ( language , range : nsrange ) <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func setOrthography ( _ orthography : NSOrthography , range : Range < String . Index > ) { <nl> + guard let str = self . string else { return } <nl> + let nsrange = NSRange ( range , in : str ) <nl> + self . __setOrthography ( orthography , range : nsrange ) <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 0cfc2e656ceb <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / NaturalLanguage / NLTokenizer . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import NaturalLanguage <nl> + import Foundation <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + extension NLTokenizer { <nl> + @ nonobjc <nl> + public func tokenRange ( at index : String . Index ) - > Range < String . Index > { <nl> + let str = self . string ? ? " " <nl> + let characterIndex = index . encodedOffset <nl> + let nsrange = self . __tokenRange ( at : characterIndex ) <nl> + return Range ( nsrange , in : str ) ! <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func enumerateTokens ( in range : Range < String . Index > , using block : ( Range < String . Index > , NLTokenizer . Attributes ) - > Bool ) { <nl> + guard let str = self . string else { return } <nl> + let nsrange = NSRange ( range , in : str ) <nl> + self . __enumerateTokens ( in : nsrange ) { ( tokenNSRange , attrs , stop ) in <nl> + if let tokenRange = Range ( tokenNSRange , in : str ) { <nl> + let keepGoing = block ( tokenRange , attrs ) <nl> + if ( ! keepGoing ) { <nl> + stop . pointee = true <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + @ nonobjc <nl> + public func tokens ( for range : Range < String . Index > ) - > [ Range < String . Index > ] { <nl> + var array : [ Range < String . Index > ] = [ ] <nl> + self . enumerateTokens ( in : range ) { ( tokenRange , attrs ) - > Bool in <nl> + array . append ( tokenRange ) <nl> + return true <nl> + } <nl> + return array <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 5fbb6c07c7a5 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / CMakeLists . txt <nl> <nl> + cmake_minimum_required ( VERSION 3 . 4 . 3 ) <nl> + include ( " . . / . . / . . / . . / cmake / modules / StandaloneOverlay . cmake " ) <nl> + <nl> + add_swift_library ( swiftNetwork $ { SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES } IS_SDK_OVERLAY <nl> + Network . swift <nl> + NWConnection . swift <nl> + NWEndpoint . swift <nl> + NWError . swift <nl> + NWListener . swift <nl> + NWParameters . swift <nl> + NWPath . swift <nl> + NWProtocolIP . swift <nl> + NWProtocol . swift <nl> + NWProtocolTCP . swift <nl> + NWProtocolTLS . swift <nl> + NWProtocolUDP . swift <nl> + <nl> + SWIFT_COMPILE_FLAGS " $ { SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS } " <nl> + LINK_FLAGS " $ { SWIFT_RUNTIME_SWIFT_LINK_FLAGS } " <nl> + <nl> + TARGET_SDKS OSX IOS IOS_SIMULATOR TVOS TVOS_SIMULATOR # WATCHOS WATCHOS_SIMULATOR <nl> + SWIFT_MODULE_DEPENDS_OSX Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + SWIFT_MODULE_DEPENDS_IOS Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + SWIFT_MODULE_DEPENDS_TVOS Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + # SWIFT_MODULE_DEPENDS_WATCHOS Darwin Dispatch Foundation ObjectiveC # auto - updated <nl> + FRAMEWORK_DEPENDS_WEAK Network <nl> + <nl> + DEPLOYMENT_VERSION_OSX $ { SWIFTLIB_DEPLOYMENT_VERSION_NETWORK_OSX } <nl> + DEPLOYMENT_VERSION_IOS $ { SWIFTLIB_DEPLOYMENT_VERSION_NETWORK_IOS } <nl> + DEPLOYMENT_VERSION_TVOS $ { SWIFTLIB_DEPLOYMENT_VERSION_NETWORK_TVOS } <nl> + # DEPLOYMENT_VERSION_WATCHOS $ { SWIFTLIB_DEPLOYMENT_VERSION_NETWORK_WATCHOS } <nl> + ) <nl> new file mode 100644 <nl> index 000000000000 . . f5e46bc25ba6 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWConnection . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + import Dispatch <nl> + import Foundation <nl> + import _SwiftNetworkOverlayShims <nl> + <nl> + / / / An NWConnection is an object that represents a bi - directional data pipe between <nl> + / / / a local endpoint and a remote endpoint . <nl> + / / / <nl> + / / / A connection handles establishment of any transport , security , or application - level protocols <nl> + / / / required to transmit and receive user data . Multiple protocol instances may be attempted during <nl> + / / / the establishment phase of the connection . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public final class NWConnection : CustomDebugStringConvertible { <nl> + <nl> + public var debugDescription : String { <nl> + return String ( " \ ( self . nw ) " ) <nl> + } <nl> + <nl> + / / / States a connection may be in <nl> + public enum State : Equatable { <nl> + / / / The initial state prior to start <nl> + case setup <nl> + / / / Waiting connections have not yet been started , or do not have a viable network <nl> + case waiting ( NWError ) <nl> + / / / Preparing connections are actively establishing the connection <nl> + case preparing <nl> + / / / Ready connections can send and receive data <nl> + case ready <nl> + / / / Failed connections are disconnected and can no longer send or receive data <nl> + case failed ( NWError ) <nl> + / / / Cancelled connections have been invalidated by the client and will send no more events <nl> + case cancelled <nl> + <nl> + internal init ( _ nw : nw_connection_state_t , _ err : nw_error_t ? ) { <nl> + switch nw { <nl> + case Network . nw_connection_state_invalid : <nl> + self = . setup <nl> + case Network . nw_connection_state_waiting : <nl> + if let error = NWError ( err ) { <nl> + self = . waiting ( error ) <nl> + } else { <nl> + self = . waiting ( NWError . posix ( . ENETDOWN ) ) <nl> + } <nl> + case Network . nw_connection_state_preparing : <nl> + self = . preparing <nl> + case Network . nw_connection_state_ready : <nl> + self = . ready <nl> + case Network . nw_connection_state_failed : <nl> + if let error = NWError ( err ) { <nl> + self = . failed ( error ) <nl> + } else { <nl> + self = . failed ( NWError . posix ( . EINVAL ) ) <nl> + } <nl> + case Network . nw_connection_state_cancelled : <nl> + self = . cancelled <nl> + default : <nl> + self = . cancelled <nl> + } <nl> + } <nl> + } <nl> + <nl> + internal let nw : nw_connection_t <nl> + <nl> + private var _state = NWConnection . State . setup <nl> + <nl> + / / / Access the current state of the connection <nl> + public var state : NWConnection . State { <nl> + return _state <nl> + } <nl> + <nl> + private var _stateUpdateHandler : ( ( _ state : NWConnection . State ) - > Void ) ? <nl> + <nl> + / / / Set a block to be called when the connection ' s state changes , which may be called <nl> + / / / multiple times until the connection is cancelled . <nl> + public var stateUpdateHandler : ( ( _ state : NWConnection . State ) - > Void ) ? { <nl> + set { <nl> + self . _stateUpdateHandler = newValue <nl> + if let newValue = newValue { <nl> + nw_connection_set_state_changed_handler ( self . nw ) { ( state , error ) in <nl> + self . _state = NWConnection . State ( state , error ) <nl> + newValue ( self . _state ) <nl> + } <nl> + } else { <nl> + nw_connection_set_state_changed_handler ( self . nw , nil ) <nl> + } <nl> + } <nl> + get { <nl> + return self . _stateUpdateHandler <nl> + } <nl> + } <nl> + <nl> + private var _currentPath : NWPath ? = nil <nl> + <nl> + / / / Current path for the connection , which can be used to extract interface and effective endpoint information <nl> + public var currentPath : NWPath ? { <nl> + get { <nl> + if let path = nw_connection_copy_current_path ( self . nw ) { <nl> + return NWPath ( path ) <nl> + } <nl> + return nil <nl> + } <nl> + } <nl> + <nl> + private var _pathUpdateHandler : ( ( _ newPath : NWPath ) - > Void ) ? <nl> + <nl> + / / / Set a block to be called when the connection ' s path has changed , which may be called <nl> + / / / multiple times until the connection is cancelled . <nl> + public var pathUpdateHandler : ( ( _ newPath : NWPath ) - > Void ) ? { <nl> + set { <nl> + self . _pathUpdateHandler = newValue <nl> + if let newValue = newValue { <nl> + nw_connection_set_path_changed_handler ( self . nw ) { ( nwPath ) in <nl> + let newPath = NWPath ( nwPath ) <nl> + self . _currentPath = newPath <nl> + newValue ( newPath ) <nl> + } <nl> + } else { <nl> + nw_connection_set_path_changed_handler ( self . nw , nil ) <nl> + } <nl> + <nl> + } <nl> + get { <nl> + return self . _pathUpdateHandler <nl> + } <nl> + } <nl> + <nl> + private var _viabilityUpdateHandler : ( ( _ isViable : Bool ) - > Void ) ? <nl> + <nl> + / / / Set a block to be called when the connection ' s viability changes , which may be called <nl> + / / / multiple times until the connection is cancelled . <nl> + / / / <nl> + / / / Connections that are not currently viable do not have a route , and packets will not be <nl> + / / / sent or received . There is a possibility that the connection will become viable <nl> + / / / again when network connectivity changes . <nl> + public var viabilityUpdateHandler : ( ( _ isViable : Bool ) - > Void ) ? { <nl> + set { <nl> + self . _viabilityUpdateHandler = newValue <nl> + if let newValue = newValue { <nl> + nw_connection_set_viability_changed_handler ( self . nw ) { ( isViable ) in <nl> + newValue ( isViable ) <nl> + } <nl> + } else { <nl> + nw_connection_set_viability_changed_handler ( self . nw , nil ) <nl> + } <nl> + <nl> + } <nl> + get { <nl> + return self . _viabilityUpdateHandler <nl> + } <nl> + } <nl> + <nl> + private var _betterPathUpdateHandler : ( ( _ betterPathAvailable : Bool ) - > Void ) ? <nl> + <nl> + / / / A better path being available indicates that the system thinks there is a preferred path or <nl> + / / / interface to use , compared to the one this connection is actively using . As an example , the <nl> + / / / connection is established over an expensive cellular interface and an unmetered Wi - Fi interface <nl> + / / / is now available . <nl> + / / / <nl> + / / / Set a block to be called when a better path becomes available or unavailable , which may be called <nl> + / / / multiple times until the connection is cancelled . <nl> + / / / <nl> + / / / When a better path is available , if it is possible to migrate work from this connection to a new connection , <nl> + / / / create a new connection to the endpoint . Continue doing work on this connection until the new connection is <nl> + / / / ready . Once ready , transition work to the new connection and cancel this one . <nl> + public var betterPathUpdateHandler : ( ( _ betterPathAvailable : Bool ) - > Void ) ? { <nl> + set { <nl> + self . _betterPathUpdateHandler = newValue <nl> + if let newValue = newValue { <nl> + nw_connection_set_better_path_available_handler ( self . nw ) { ( betterPathAvailable ) in <nl> + newValue ( betterPathAvailable ) <nl> + } <nl> + } else { <nl> + nw_connection_set_better_path_available_handler ( self . nw , nil ) <nl> + } <nl> + <nl> + } <nl> + get { <nl> + return self . _betterPathUpdateHandler <nl> + } <nl> + } <nl> + <nl> + / / / The remote endpoint of the connection <nl> + public let endpoint : NWEndpoint <nl> + <nl> + / / / The set of parameters with which the connection was created <nl> + public let parameters : NWParameters <nl> + <nl> + private init ( to : NWEndpoint , using : NWParameters , connection : nw_connection_t ) { <nl> + self . endpoint = to <nl> + self . parameters = using <nl> + self . nw = connection <nl> + } <nl> + <nl> + convenience internal init ? ( using : NWParameters , inbound : nw_connection_t ) { <nl> + guard let peer = NWEndpoint ( nw_connection_copy_endpoint ( inbound ) ) else { <nl> + return nil <nl> + } <nl> + self . init ( to : peer , using : using , connection : inbound ) <nl> + } <nl> + <nl> + / / / Create a new outbound connection to an endpoint , with parameters . <nl> + / / / The parameters determine the protocols to be used for the connection , and their options . <nl> + / / / <nl> + / / / - Parameter to : The remote endpoint to which to connect . <nl> + / / / - Parameter using : The parameters define which protocols and path to use . <nl> + public init ( to : NWEndpoint , using : NWParameters ) { <nl> + self . endpoint = to <nl> + self . parameters = using <nl> + self . nw = nw_connection_create ( to . nw ! , using . nw ) <nl> + } <nl> + <nl> + / / / Create a new outbound connection to a hostname and port , with parameters . <nl> + / / / The parameters determine the protocols to be used for the connection , and their options . <nl> + / / / <nl> + / / / - Parameter host : The remote hostname to which to connect . <nl> + / / / - Parameter port : The remote port to which to connect . <nl> + / / / - Parameter using : The parameters define which protocols and path to use . <nl> + public convenience init ( host : NWEndpoint . Host , port : NWEndpoint . Port , using : NWParameters ) { <nl> + self . init ( to : . hostPort ( host : host , port : port ) , using : using ) <nl> + } <nl> + <nl> + / / / Start the connection and provide a dispatch queue for callback blocks . <nl> + / / / <nl> + / / / Starts the connection , which will cause the connection to evaluate its path , do resolution and try to become <nl> + / / / ready ( connected ) . NWConnection establishment is asynchronous . A stateUpdateHandler may be used to determine <nl> + / / / when the state changes . If the connection can not be established , the state will transition to waiting with <nl> + / / / an associated error describing the reason . If an unrecoverable error is encountered , the state will <nl> + / / / transition to failed with an associated NWError value . If the connection is established , the state will <nl> + / / / transition to ready . <nl> + / / / <nl> + / / / Start should only be called once on a connection , and multiple calls to start will <nl> + / / / be ignored . <nl> + public func start ( queue : DispatchQueue ) { <nl> + self . _queue = queue <nl> + nw_connection_set_queue ( self . nw , queue ) <nl> + nw_connection_start ( self . nw ) <nl> + } <nl> + <nl> + private var _queue : DispatchQueue ? <nl> + <nl> + / / / Get queue used for delivering block handlers , such as stateUpdateHandler , pathUpdateHandler , <nl> + / / / viabilityUpdateHandler , betterPathUpdateHandler , and completions for send and receive . <nl> + / / / If the connection has not yet been started , the queue will be nil . Once the connection has been <nl> + / / / started , the queue will be valid . <nl> + public var queue : DispatchQueue ? { <nl> + get { <nl> + return self . _queue <nl> + } <nl> + } <nl> + <nl> + / / / Cancel the connection , and cause all update handlers to be cancelled . <nl> + / / / <nl> + / / / Cancel is asynchronous . The last callback will be to the stateUpdateHandler with the cancelled state . After <nl> + / / / the stateUpdateHandlers are called with the cancelled state , all blocks are released to break retain cycles . <nl> + / / / <nl> + / / / Calls to cancel after the first one are ignored . <nl> + public func cancel ( ) { <nl> + nw_connection_cancel ( self . nw ) <nl> + } <nl> + <nl> + / / / A variant of cancel that performs non - graceful closure of the transport . <nl> + public func forceCancel ( ) { <nl> + nw_connection_force_cancel ( self . nw ) <nl> + } <nl> + <nl> + / / / Cancel the currently connected endpoint , causing the connection to fall through to the next endpoint if <nl> + / / / available , or to go to the waiting state if no more endpoints are available . <nl> + public func cancelCurrentEndpoint ( ) { <nl> + nw_connection_cancel_current_endpoint ( self . nw ) <nl> + } <nl> + <nl> + / / / NWConnections will normally re - attempt on network changes . This function causes a connection that is in <nl> + / / / the waiting state to re - attempt even without a network change . <nl> + public func restart ( ) { <nl> + nw_connection_restart ( self . nw ) <nl> + } <nl> + <nl> + / / / Content Context controls options for how data is sent , and access for metadata to send or receive . <nl> + / / / All properties of Content Context are valid for sending . For received Content Context , only the protocolMetdata <nl> + / / / values will be set . <nl> + public class ContentContext { <nl> + internal let nw : nw_content_context_t <nl> + <nl> + / / / A string description of the content , used for logging and debugging . <nl> + public let identifier : String <nl> + <nl> + / / / An expiration in milliseconds after scheduling a send , after which the content may be dropped . <nl> + / / / Defaults to 0 , which implies no expiration . Used only when sending . <nl> + public let expirationMilliseconds : UInt64 <nl> + <nl> + / / / A numeric value between 0 . 0 and 1 . 0 to specify priority of this data / message . Defaults to 0 . 5 . <nl> + / / / Used only when sending . <nl> + public let relativePriority : Double <nl> + <nl> + / / / Any content marked as an antecedent must be sent prior to this content being sent . Defaults to nil . <nl> + / / / Used only when sending . <nl> + public let antecedent : NWConnection . ContentContext ? <nl> + <nl> + / / / A boolean indicating if this context is the final context in a given direction on this connection . Defaults to false . <nl> + public let isFinal : Bool <nl> + <nl> + / / / An array of protocol metadata to send ( to inform the protocols of per - data options ) or receive ( to receive per - data options or statistics ) . <nl> + public var protocolMetadata : [ NWProtocolMetadata ] { <nl> + get { <nl> + var metadataArray : [ NWProtocolMetadata ] = [ ] <nl> + nw_content_context_foreach_protocol_metadata ( self . nw ) { ( definition , metadata ) in <nl> + if nw_protocol_metadata_is_tcp ( metadata ) { <nl> + metadataArray . append ( NWProtocolTCP . Metadata ( metadata ) ) <nl> + } else if nw_protocol_metadata_is_udp ( metadata ) { <nl> + metadataArray . append ( NWProtocolUDP . Metadata ( metadata ) ) <nl> + } else if nw_protocol_metadata_is_ip ( metadata ) { <nl> + metadataArray . append ( NWProtocolIP . Metadata ( metadata ) ) <nl> + } else if nw_protocol_metadata_is_tls ( metadata ) { <nl> + metadataArray . append ( NWProtocolTLS . Metadata ( metadata ) ) <nl> + } <nl> + } <nl> + return metadataArray <nl> + } <nl> + } <nl> + <nl> + / / / Access the metadata for a specific protocol from a context . The metadata may be nil . <nl> + public func protocolMetadata ( definition : NWProtocolDefinition ) - > NWProtocolMetadata ? { <nl> + if let metadata = nw_content_context_copy_protocol_metadata ( self . nw , definition . nw ) { <nl> + if nw_protocol_metadata_is_tcp ( metadata ) { <nl> + return NWProtocolTCP . Metadata ( metadata ) <nl> + } else if nw_protocol_metadata_is_udp ( metadata ) { <nl> + return NWProtocolUDP . Metadata ( metadata ) <nl> + } else if nw_protocol_metadata_is_ip ( metadata ) { <nl> + return NWProtocolIP . Metadata ( metadata ) <nl> + } else if nw_protocol_metadata_is_tls ( metadata ) { <nl> + return NWProtocolTLS . Metadata ( metadata ) <nl> + } <nl> + } <nl> + return nil <nl> + } <nl> + <nl> + / / / Create a context for sending , that optionally can set expiration ( default 0 ) , <nl> + / / / priority ( default 0 . 5 ) , antecendent ( default nil ) , and protocol metadata ( default [ ] ] ) . <nl> + public init ( identifier : String , expiration : UInt64 = 0 , priority : Double = 0 . 5 , isFinal : Bool = false , antecedent : NWConnection . ContentContext ? = nil , metadata : [ NWProtocolMetadata ] ? = [ ] ) { <nl> + self . nw = nw_content_context_create ( identifier ) <nl> + <nl> + self . identifier = identifier <nl> + <nl> + self . expirationMilliseconds = expiration <nl> + nw_content_context_set_expiration_milliseconds ( self . nw , expiration ) <nl> + <nl> + self . relativePriority = priority <nl> + nw_content_context_set_relative_priority ( self . nw , priority ) <nl> + <nl> + self . isFinal = isFinal <nl> + nw_content_context_set_is_final ( self . nw , isFinal ) <nl> + <nl> + self . antecedent = antecedent <nl> + if let otherContext = antecedent { <nl> + nw_content_context_set_antecedent ( self . nw , otherContext . nw ) <nl> + } <nl> + <nl> + if let metadataArray = metadata { <nl> + for singleMetadata in metadataArray { <nl> + nw_content_context_set_metadata_for_protocol ( self . nw , singleMetadata . nw ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / Use the default message context to send content with all default properties : <nl> + / / / default priority , no expiration , and not the final message . Marking this context <nl> + / / / as complete with a send indicates that the message content is now complete and any <nl> + / / / other messages that were blocked may be scheduled , but will not close the underlying <nl> + / / / connection . Use this context for any lightweight sends of datagrams or messages on <nl> + / / / top of a stream that do not require special properties . <nl> + / / / This context does not support overriding any properties . <nl> + public static let defaultMessage : NWConnection . ContentContext = NWConnection . ContentContext ( _swift_nw_content_context_default_message ( ) ) ! <nl> + <nl> + / / / Use the final message context to indicate that no more sends are expected <nl> + / / / once this context is complete . Like . defaultMessage , all properties are default . <nl> + / / / Marking a send as complete when using this context will close the sending side of the <nl> + / / / underlying connection . This is the equivalent of sending a FIN on a TCP stream . <nl> + / / / This context does not support overriding any properties . <nl> + public static let finalMessage : NWConnection . ContentContext = NWConnection . ContentContext ( _swift_nw_content_context_final_message ( ) ) ! <nl> + <nl> + / / / Use the default stream context to indicate that this sending context is <nl> + / / / the one that represents the entire connection . All context properties are default . <nl> + / / / This context behaves in the same way as . finalMessage , such that marking the <nl> + / / / context complete by sending isComplete will close the sending side of the <nl> + / / / underlying connection ( a FIN for a TCP stream ) . <nl> + / / / Note that this context is a convenience for sending a single , final context . <nl> + / / / If the protocol used by the connection is a stream ( such as TCP ) , the caller <nl> + / / / may still use . defaultMessage , . finalMessage , or a custom context with priorities <nl> + / / / and metadata to set properties of a particular chunk of stream data relative <nl> + / / / to other data on the stream . <nl> + / / / This context does not support overriding any properties . <nl> + public static let defaultStream : NWConnection . ContentContext = NWConnection . ContentContext ( _swift_nw_content_context_default_stream ( ) ) ! <nl> + <nl> + internal init ? ( _ nw : nw_content_context_t ? ) { <nl> + guard let nw = nw else { <nl> + return nil <nl> + } <nl> + <nl> + self . nw = nw <nl> + <nl> + / / Received content context doesn ' t have expiration , priority , or antecedents <nl> + self . expirationMilliseconds = 0 <nl> + self . relativePriority = 0 <nl> + self . antecedent = nil <nl> + self . isFinal = nw_content_context_get_is_final ( nw ) <nl> + self . identifier = String ( cString : nw_content_context_get_identifier ( nw ) ) <nl> + } <nl> + } <nl> + <nl> + / / / Receive data from a connection . This may be called before the connection <nl> + / / / is ready , in which case the receive request will be queued until the <nl> + / / / connection is ready . The completion handler will be invoked exactly <nl> + / / / once for each call , so the client must call this function multiple <nl> + / / / times to receive multiple chunks of data . For protocols that <nl> + / / / support flow control , such as TCP , calling receive opens the receive <nl> + / / / window . If the client stops calling receive , the receive window will <nl> + / / / fill up and the remote peer will stop sending . <nl> + / / / - Parameter minimumIncompleteLength : The minimum length to receive from the connection , <nl> + / / / until the content is complete . <nl> + / / / - Parameter maximumLength : The maximum length to receive from the connection in a single completion . <nl> + / / / - Parameter completion : A receive completion is invoked exactly once for a call to receive ( . . . ) . <nl> + / / / The completion indicates that the requested content has been received ( in which case <nl> + / / / the content is delivered ) , or else an error has occurred . Parameters to the completion are : <nl> + / / / <nl> + / / / - content : The received content , as constrained by the minimum and maximum length . This may <nl> + / / / be nil if the message or stream is complete ( without any more data to deliver ) , or if <nl> + / / / an error was encountered . <nl> + / / / <nl> + / / / - contentContext : Content context describing the received content . This includes protocol metadata <nl> + / / / that lets the caller introspect information about the received content ( such as flags on a packet ) . <nl> + / / / <nl> + / / / - isComplete : An indication that this context ( a message or stream , for example ) is now complete . For <nl> + / / / protocols such as TCP , this will be marked when the entire stream has be closed in the <nl> + / / / reading direction . For protocols such as UDP , this will be marked when the end of a <nl> + / / / datagram has been reached . <nl> + / / / <nl> + / / / - error : An error will be sent if the receive was terminated before completing . There may still <nl> + / / / be content delivered along with the error , but this content may be shorter than the requested <nl> + / / / ranges . An error will be sent for any outstanding receives when the connection is cancelled . <nl> + public func receive ( minimumIncompleteLength : Int , maximumLength : Int , <nl> + completion : @ escaping ( _ content : Data ? , <nl> + _ contentContext : NWConnection . ContentContext ? , <nl> + _ isComplete : Bool , _ error : NWError ? ) - > Void ) { <nl> + nw_connection_receive ( self . nw , UInt32 ( minimumIncompleteLength ) , UInt32 ( maximumLength ) ) { <nl> + ( content , context , complete , nwError ) in <nl> + completion ( NWCreateNSDataFromDispatchData ( content ) as Data ? , ContentContext ( context ) , complete , NWError ( nwError ) ) ; <nl> + } <nl> + } <nl> + <nl> + / / / Receive a complete content from the connection , waiting for the content to be marked complete <nl> + / / / ( or encounter an error ) before delivering the callback . This is useful for datagram or message - based <nl> + / / / protocols like UDP . See receive ( minimumIncompleteLength : , maximumLength : , completion : ) for a description <nl> + / / / of the completion handler . <nl> + public func receive ( completion : @ escaping ( _ completeContent : Data ? , <nl> + _ contentContext : NWConnection . ContentContext ? , <nl> + _ isComplete : Bool , _ error : NWError ? ) - > Void ) { <nl> + nw_connection_receive_message ( self . nw ) { ( content , context , complete , nwError ) in <nl> + completion ( NWCreateNSDataFromDispatchData ( content ) as Data ? , ContentContext ( context ) , complete , NWError ( nwError ) ) <nl> + } <nl> + } <nl> + <nl> + public enum SendCompletion { <nl> + / / / Completion handler to be invoked when send content has been successfully processed , or failed to send due to an error . <nl> + / / / Note that this does not guarantee that the data was sent out over the network , or acknowledge , but only that <nl> + / / / it has been consumed by the protocol stack . <nl> + case contentProcessed ( ( _ error : NWError ? ) - > Void ) <nl> + / / / Idempotent content may be sent multiple times when opening up a 0 - RTT connection , so there is no completion block <nl> + case idempotent <nl> + } <nl> + <nl> + / / / Send data on a connection . This may be called before the connection is ready , <nl> + / / / in which case the send will be enqueued until the connection is ready to send . <nl> + / / / This is an asynchronous send and the completion block can be used to <nl> + / / / determine when the send is complete . There is nothing preventing a client <nl> + / / / from issuing an excessive number of outstanding sends . To minmize memory <nl> + / / / footprint and excessive latency as a consequence of buffer bloat , it is <nl> + / / / advisable to keep a low number of outstanding sends . The completion block <nl> + / / / can be used to pace subsequent sends . <nl> + / / / - Parameter content : The data to send on the connection . May be nil if this send marks its context as complete , such <nl> + / / / as by sending . finalMessage as the context and marking isComplete to send a write - close . <nl> + / / / - Parameter contentContext : The context associated with the content , which represents a logical message <nl> + / / / to be sent on the connection . All content sent within a single context will <nl> + / / / be sent as an in - order unit , up until the point that the context is marked <nl> + / / / complete ( see isComplete ) . Once a context is marked complete , it may be re - used <nl> + / / / as a new logical message . Protocols like TCP that cannot send multiple <nl> + / / / independent messages at once ( serial streams ) will only start processing a new <nl> + / / / context once the prior context has been marked complete . Defaults to . defaultMessage . <nl> + / / / - Parameter isComplete : A flag indicating if the caller ' s sending context ( logical message ) is now complete . <nl> + / / / Until a context is marked complete , content sent for other contexts may not <nl> + / / / be sent immediately ( if the protocol requires sending bytes serially , like TCP ) . <nl> + / / / For datagram protocols , like UDP , isComplete indicates that the content represents <nl> + / / / a complete datagram . <nl> + / / / When sending directly on streaming protocols like TCP , isComplete can be used to <nl> + / / / indicate that the connection should send a " write close " ( a TCP FIN ) if the sending <nl> + / / / context is the final context on the connection . Specifically , to send a " write close " , <nl> + / / / pass . finalMessage or . defaultStream for the context ( or create a custom context and <nl> + / / / set . isFinal ) , and pass true for isComplete . <nl> + / / / - Parameter completion : A completion handler ( . contentProcessed ) to notify the caller when content has been processed by <nl> + / / / the connection , or a marker that this data is idempotent ( . idempotent ) and may be sent multiple times as fast open data . <nl> + public func send ( content : Data ? , contentContext : NWConnection . ContentContext = . defaultMessage , isComplete : Bool = true , completion : SendCompletion ) { <nl> + switch completion { <nl> + case . idempotent : <nl> + _swift_nw_connection_send_idempotent ( self . nw , NWCreateDispatchDataFromNSData ( content ) , contentContext . nw , isComplete ) <nl> + case . contentProcessed ( let handler ) : <nl> + _swift_nw_connection_send ( self . nw , NWCreateDispatchDataFromNSData ( content ) , contentContext . nw , isComplete ) { ( error ) in <nl> + handler ( NWError ( error ) ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / Batching allows multiple send or receive calls provides a hint to the connection that the operations <nl> + / / / should be coalesced to improve efficiency . Calls other than send and receive will not be affected . <nl> + public func batch ( _ block : ( ) - > Void ) { <nl> + nw_connection_batch ( self . nw , block ) <nl> + } <nl> + <nl> + / / / Access connection - wide protocol metadata on the connection . This allows access to state for protocols <nl> + / / / like TCP and TLS that have long - term state . <nl> + public func metadata ( definition : NWProtocolDefinition ) - > NWProtocolMetadata ? { <nl> + if let metadata = nw_connection_copy_protocol_metadata ( self . nw , definition . nw ) { <nl> + if nw_protocol_metadata_is_tcp ( metadata ) { <nl> + return NWProtocolTCP . Metadata ( metadata ) <nl> + } else if nw_protocol_metadata_is_udp ( metadata ) { <nl> + return NWProtocolUDP . Metadata ( metadata ) <nl> + } else if nw_protocol_metadata_is_ip ( metadata ) { <nl> + return NWProtocolIP . Metadata ( metadata ) <nl> + } else if nw_protocol_metadata_is_tls ( metadata ) { <nl> + return NWProtocolTLS . Metadata ( metadata ) <nl> + } <nl> + return NWProtocolMetadata ( metadata ) <nl> + } else { <nl> + return nil <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 2d5671b98ed5 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWEndpoint . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + import Darwin <nl> + import Foundation <nl> + import _SwiftNetworkOverlayShims <nl> + <nl> + internal extension sockaddr_in { <nl> + init ( _ address : in_addr , _ port : in_port_t ) { <nl> + self . init ( sin_len : UInt8 ( MemoryLayout < sockaddr_in > . size ) , sin_family : sa_family_t ( AF_INET ) , sin_port : port , <nl> + sin_addr : address , sin_zero : ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ) ) <nl> + } <nl> + <nl> + func withSockAddr < ReturnType > ( _ body : ( _ sa : UnsafePointer < sockaddr > ) throws - > ReturnType ) rethrows - > ReturnType { <nl> + / / We need to create a mutable copy of ` self ` so that we can pass it to ` withUnsafePointer ( to : _ : ) ` . <nl> + var sin = self <nl> + return try withUnsafePointer ( to : & sin ) { <nl> + try $ 0 . withMemoryRebound ( to : sockaddr . self , capacity : 1 ) { <nl> + try body ( $ 0 ) <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + internal extension sockaddr_in6 { <nl> + init ( _ address : in6_addr , _ port : in_port_t , flow : UInt32 = 0 , scope : UInt32 = 0 ) { <nl> + self . init ( sin6_len : UInt8 ( MemoryLayout < sockaddr_in6 > . size ) , sin6_family : sa_family_t ( AF_INET6 ) , sin6_port : port , <nl> + sin6_flowinfo : flow , sin6_addr : address , sin6_scope_id : scope ) <nl> + } <nl> + <nl> + func withSockAddr < ReturnType > ( _ body : ( _ sa : UnsafePointer < sockaddr > ) throws - > ReturnType ) rethrows - > ReturnType { <nl> + / / We need to create a mutable copy of ` self ` so that we can pass it to ` withUnsafePointer ( to : _ : ) ` . <nl> + var sin6 = self <nl> + return try withUnsafePointer ( to : & sin6 ) { <nl> + try $ 0 . withMemoryRebound ( to : sockaddr . self , capacity : 1 ) { <nl> + try body ( $ 0 ) <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + internal extension in_addr { <nl> + init ( address : UInt32 ) { <nl> + self . init ( ) <nl> + self . s_addr = address . bigEndian <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + private func getaddrinfo_numeric ( _ string : String , family : Int32 = 0 ) - > NWEndpoint . Host ? { <nl> + / / Determine if this string has an interface scope specified " 127 . 0 . 0 . 1 % lo0 " or " fe80 : : 1 % lo0 " <nl> + var string = string <nl> + var interface : NWInterface ? = nil <nl> + if let range = string . range ( of : " % " , options : String . CompareOptions . backwards ) { <nl> + interface = NWInterface ( String ( string [ range . upperBound . . . ] ) ) <nl> + if interface ! = nil { <nl> + string . removeSubrange ( range . lowerBound . . . ) <nl> + } <nl> + } <nl> + <nl> + / / call getaddrinfo <nl> + var hints = addrinfo ( ai_flags : AI_NUMERICHOST , ai_family : family , ai_socktype : SOCK_STREAM , ai_protocol : 0 , <nl> + ai_addrlen : 0 , ai_canonname : nil , ai_addr : nil , ai_next : nil ) <nl> + var resolved : UnsafeMutablePointer < addrinfo > ? = nil <nl> + / / After this point we must ensure we free addrinfo before we return <nl> + guard getaddrinfo ( string , nil , & hints , & resolved ) = = 0 , let addrinfo = resolved else { <nl> + return nil <nl> + } <nl> + <nl> + var result : NWEndpoint . Host ? = nil <nl> + <nl> + if let sa = addrinfo . pointee . ai_addr { <nl> + if ( sa . pointee . sa_family = = AF_INET ) { <nl> + sa . withMemoryRebound ( to : sockaddr_in . self , capacity : 1 , { ( sin ) - > Void in <nl> + result = NWEndpoint . Host . ipv4 ( IPv4Address ( sin . pointee . sin_addr , interface ) ) <nl> + } ) <nl> + } else if ( sa . pointee . sa_family = = AF_INET6 ) { <nl> + sa . withMemoryRebound ( to : sockaddr_in6 . self , capacity : 1 , { ( sin6 ) - > Void in <nl> + if ( sin6 . pointee . sin6_scope_id ! = 0 ) { <nl> + interface = NWInterface ( Int ( sin6 . pointee . sin6_scope_id ) ) <nl> + } <nl> + let ipv6 = IPv6Address ( sin6 . pointee . sin6_addr , interface ) ; <nl> + if ipv6 . isIPv4Mapped & & family = = AF_UNSPEC , let ipv4 = ipv6 . asIPv4 { <nl> + / / Treat IPv4 mapped as IPv4 <nl> + result = NWEndpoint . Host . ipv4 ( ipv4 ) <nl> + } else { <nl> + result = NWEndpoint . Host . ipv6 ( ipv6 ) <nl> + } <nl> + } ) <nl> + } <nl> + } <nl> + freeaddrinfo ( addrinfo ) <nl> + return result <nl> + } <nl> + <nl> + private func getnameinfo_numeric ( address : UnsafeRawPointer ) - > String { <nl> + let sa = address . assumingMemoryBound ( to : sockaddr . self ) <nl> + var result : String ? = nil <nl> + let maxLen = socklen_t ( 100 ) <nl> + let storage = UnsafeMutablePointer < Int8 > . allocate ( capacity : Int ( maxLen ) ) <nl> + if ( getnameinfo ( sa , socklen_t ( sa . pointee . sa_len ) , storage , maxLen , nil , 0 , NI_NUMERICHOST ) = = 0 ) { <nl> + result = String ( cString : storage ) <nl> + } <nl> + storage . deallocate ( ) <nl> + return result ? ? " ? " <nl> + } <nl> + <nl> + / / / An IP address <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public protocol IPAddress { <nl> + <nl> + / / / Fetch the raw address as data <nl> + var rawValue : Data { get } <nl> + <nl> + / / / Create an IP address from data . The length of the data must <nl> + / / / match the expected length of addresses in the address family <nl> + / / / ( four bytes for IPv4 , and sixteen bytes for IPv6 ) <nl> + init ? ( _ rawValue : Data , _ interface : NWInterface ? ) <nl> + <nl> + / / / Create an IP address from an address literal string . <nl> + / / / If the string contains ' % ' to indicate an interface , the interface will be <nl> + / / / associated with the address , such as " : : 1 % lo0 " being associated with the loopback <nl> + / / / interface . <nl> + / / / This function does not perform host name to address resolution . This is the same as calling getaddrinfo <nl> + / / / and using AI_NUMERICHOST . <nl> + init ? ( _ string : String ) <nl> + <nl> + / / / The interface the address is scoped to , if any . <nl> + var interface : NWInterface ? { get } <nl> + <nl> + / / / Indicates if this address is loopback <nl> + var isLoopback : Bool { get } <nl> + <nl> + / / / Indicates if this address is link - local <nl> + var isLinkLocal : Bool { get } <nl> + <nl> + / / / Indicates if this address is multicast <nl> + var isMulticast : Bool { get } <nl> + } <nl> + <nl> + / / / IPv4Address <nl> + / / / Base type to hold an IPv4 address and convert between strings and raw bytes . <nl> + / / / Note that an IPv4 address may be scoped to an interface . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public struct IPv4Address : IPAddress , Hashable , CustomDebugStringConvertible { <nl> + <nl> + / / / The IPv4 any address used for listening <nl> + public static let any = IPv4Address ( in_addr ( address : INADDR_ANY ) , nil ) <nl> + <nl> + / / / The IPv4 broadcast address used to broadcast to all hosts <nl> + public static let broadcast = IPv4Address ( in_addr ( address : INADDR_BROADCAST ) , nil ) <nl> + <nl> + / / / The IPv4 loopback address <nl> + public static let loopback = IPv4Address ( in_addr ( address : INADDR_LOOPBACK ) , nil ) <nl> + <nl> + / / / The IPv4 all hosts multicast group <nl> + public static let allHostsGroup = IPv4Address ( in_addr ( address : INADDR_ALLHOSTS_GROUP ) , nil ) <nl> + <nl> + / / / The IPv4 all routers multicast group <nl> + public static let allRoutersGroup = IPv4Address ( in_addr ( address : INADDR_ALLRTRS_GROUP ) , nil ) <nl> + <nl> + / / / The IPv4 all reports multicast group for ICMPv3 membership reports <nl> + public static let allReportsGroup = IPv4Address ( in_addr ( address : INADDR_ALLRPTS_GROUP ) , nil ) <nl> + <nl> + / / / The IPv4 multicast DNS group . ( Note : Use the dns_sd APIs instead of creating your own responder / resolver ) <nl> + public static let mdnsGroup = IPv4Address ( in_addr ( address : INADDR_ALLMDNS_GROUP ) , nil ) <nl> + <nl> + / / / Indicates if this IPv4 address is loopback ( 127 . 0 . 0 . 1 ) <nl> + public var isLoopback : Bool { <nl> + return self = = IPv4Address . loopback <nl> + } <nl> + <nl> + / / / Indicates if this IPv4 address is link - local <nl> + public var isLinkLocal : Bool { <nl> + let linkLocalMask : UInt32 = IN_CLASSB_NET <nl> + let linkLocalCompare : UInt32 = IN_LINKLOCALNETNUM <nl> + return ( self . address . s_addr & linkLocalMask . bigEndian ) = = linkLocalCompare . bigEndian <nl> + } <nl> + <nl> + / / / Indicates if this IPv4 address is multicast <nl> + public var isMulticast : Bool { <nl> + let multicastMask : UInt32 = IN_CLASSD_NET <nl> + let multicastCompare : UInt32 = INADDR_UNSPEC_GROUP <nl> + return ( self . address . s_addr & multicastMask . bigEndian ) = = multicastCompare . bigEndian <nl> + } <nl> + <nl> + / / / Fetch the raw address ( four bytes ) <nl> + public var rawValue : Data { <nl> + var temporary = self . address <nl> + return withUnsafeBytes ( of : & temporary ) { ( bytes ) - > Data in <nl> + Data ( bytes ) <nl> + } <nl> + } <nl> + <nl> + internal init ( _ address : in_addr , _ interface : NWInterface ? ) { <nl> + self . address = address <nl> + self . interface = interface <nl> + } <nl> + <nl> + / / / Create an IPv4 address from a 4 - byte data . Optionally specify an interface . <nl> + / / / <nl> + / / / - Parameter rawValue : The raw bytes of the IPv4 address , must be exactly 4 bytes or init will fail . <nl> + / / / - Parameter interface : An optional network interface to scope the address to . Defaults to nil . <nl> + / / / - Returns : An IPv4Address or nil if the Data parameter did not contain an IPv4 address . <nl> + public init ? ( _ rawValue : Data , _ interface : NWInterface ? = nil ) { <nl> + if ( rawValue . count ! = MemoryLayout < in_addr > . size ) { <nl> + return nil <nl> + } <nl> + let v4 = rawValue . withUnsafeBytes { ( ptr : UnsafePointer < in_addr > ) - > in_addr in <nl> + return ptr . pointee <nl> + } <nl> + self . init ( v4 , interface ) <nl> + } <nl> + <nl> + / / / Create an IPv4 address from an address literal string . <nl> + / / / <nl> + / / / This function does not perform host name to address resolution . This is the same as calling getaddrinfo <nl> + / / / and using AI_NUMERICHOST . <nl> + / / / <nl> + / / / - Parameter string : An IPv4 address literal string such as " 127 . 0 . 0 . 1 " , " 169 . 254 . 8 . 8 % en0 " . <nl> + / / / - Returns : An IPv4Address or nil if the string parameter did not <nl> + / / / contain an IPv4 address literal . <nl> + public init ? ( _ string : String ) { <nl> + guard let result = getaddrinfo_numeric ( string , family : AF_INET ) else { <nl> + return nil <nl> + } <nl> + guard case . ipv4 ( let address ) = result else { <nl> + return nil <nl> + } <nl> + self = address <nl> + } <nl> + <nl> + fileprivate let address : in_addr <nl> + <nl> + / / / The interface the address is scoped to , if any . <nl> + public let interface : NWInterface ? <nl> + <nl> + / / Hashable <nl> + public static func = = ( lhs : IPv4Address , rhs : IPv4Address ) - > Bool { <nl> + return lhs . address . s_addr = = rhs . address . s_addr & & lhs . interface = = rhs . interface <nl> + } <nl> + <nl> + public func hash ( into hasher : inout Hasher ) { <nl> + hasher . combine ( self . address . s_addr ) <nl> + hasher . combine ( self . interface ) <nl> + } <nl> + <nl> + / / CustomDebugStringConvertible <nl> + public var debugDescription : String { <nl> + var sin = sockaddr_in ( self . address , 0 ) <nl> + let addressString = getnameinfo_numeric ( address : & sin ) <nl> + if let interface = self . interface { <nl> + return String ( " \ ( addressString ) % \ ( interface ) " ) <nl> + } else { <nl> + return addressString <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / IPv6Address <nl> + / / / Base type to hold an IPv6 address and convert between strings and raw bytes . <nl> + / / / Note that an IPv6 address may be scoped to an interface . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public struct IPv6Address : IPAddress , Hashable , CustomDebugStringConvertible { <nl> + <nl> + / / / IPv6 any address <nl> + public static let any = IPv6Address ( in6addr_any , nil ) <nl> + <nl> + / / / IPv6 broadcast address <nl> + public static let broadcast = IPv6Address ( in6addr_any , nil ) <nl> + <nl> + / / / IPv6 loopback address <nl> + public static let loopback = IPv6Address ( in6addr_loopback , nil ) <nl> + <nl> + / / / IPv6 all node local nodes multicast <nl> + public static let nodeLocalNodes = IPv6Address ( in6addr_nodelocal_allnodes , nil ) <nl> + <nl> + / / / IPv6 all link local nodes multicast <nl> + public static let linkLocalNodes = IPv6Address ( in6addr_linklocal_allnodes , nil ) <nl> + <nl> + / / / IPv6 all link local routers multicast <nl> + public static let linkLocalRouters = IPv6Address ( in6addr_linklocal_allrouters , nil ) <nl> + <nl> + public enum Scope : UInt8 { <nl> + case nodeLocal = 1 <nl> + case linkLocal = 2 <nl> + case siteLocal = 5 <nl> + case organizationLocal = 8 <nl> + case global = 0x0e <nl> + } <nl> + <nl> + / / / Is the Any address " : : 0 " <nl> + public var isAny : Bool { <nl> + return self . address . __u6_addr . __u6_addr32 . 0 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 1 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 2 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 3 = = 0 <nl> + } <nl> + <nl> + / / / Is the looback address " : : 1 " <nl> + public var isLoopback : Bool { <nl> + return self . address . __u6_addr . __u6_addr32 . 0 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 1 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 2 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 3 ! = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 3 = = UInt32 ( 1 ) . bigEndian <nl> + } <nl> + <nl> + / / / Is an IPv4 compatible address <nl> + public var isIPv4Compatabile : Bool { <nl> + return self . address . __u6_addr . __u6_addr32 . 0 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 1 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 2 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 3 ! = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 3 ! = UInt32 ( 1 ) . bigEndian <nl> + } <nl> + <nl> + / / / Is an IPv4 mapped address such as " : : ffff : 1 . 2 . 3 . 4 " <nl> + public var isIPv4Mapped : Bool { <nl> + return self . address . __u6_addr . __u6_addr32 . 0 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 1 = = 0 & & <nl> + self . address . __u6_addr . __u6_addr32 . 2 = = UInt32 ( 0x0000ffff ) . bigEndian <nl> + } <nl> + <nl> + / / / For IPv6 addresses that are IPv4 mapped , returns the IPv4 address <nl> + / / / <nl> + / / / - Returns : nil unless the IPv6 address was mapped or compatible , in which case the IPv4 address is <nl> + / / / returned . <nl> + public var asIPv4 : IPv4Address ? { <nl> + guard self . isIPv4Mapped | | self . isIPv4Compatabile else { <nl> + return nil <nl> + } <nl> + return IPv4Address ( in_addr ( address : self . address . __u6_addr . __u6_addr32 . 3 . bigEndian ) , <nl> + self . interface ) <nl> + } <nl> + <nl> + / / / Is a 6to4 IPv6 address <nl> + public var is6to4 : Bool { <nl> + return self . address . __u6_addr . __u6_addr16 . 0 = = UInt16 ( 0x2002 ) . bigEndian <nl> + } <nl> + <nl> + / / / Is a link - local address <nl> + public var isLinkLocal : Bool { <nl> + return self . address . __u6_addr . __u6_addr8 . 0 = = UInt8 ( 0xfe ) & & <nl> + ( self . address . __u6_addr . __u6_addr8 . 1 & 0xc0 ) = = 0x80 <nl> + } <nl> + <nl> + / / / Is multicast <nl> + public var isMulticast : Bool { <nl> + return self . address . __u6_addr . __u6_addr8 . 0 = = 0xff <nl> + } <nl> + <nl> + / / / Returns the multicast scope <nl> + public var multicastScope : IPv6Address . Scope ? { <nl> + if ( self . isMulticast ) { <nl> + return IPv6Address . Scope ( rawValue : self . address . __u6_addr . __u6_addr8 . 1 & 0x0f ) <nl> + } <nl> + return nil <nl> + } <nl> + <nl> + internal init ( _ ip6 : in6_addr , _ interface : NWInterface ? ) { <nl> + self . address = ip6 <nl> + self . interface = interface <nl> + } <nl> + <nl> + / / / Create an IPv6 from a raw 16 byte value and optional interface <nl> + / / / <nl> + / / / - Parameter rawValue : A 16 byte IPv6 address <nl> + / / / - Parameter interface : An optional interface the address is scoped to . Defaults to nil . <nl> + / / / - Returns : nil unless the raw data contained an IPv6 address <nl> + public init ? ( _ rawValue : Data , _ interface : NWInterface ? = nil ) { <nl> + if ( rawValue . count ! = MemoryLayout < in6_addr > . size ) { <nl> + return nil <nl> + } <nl> + let v6 = rawValue . withUnsafeBytes { ( ptr : UnsafePointer < in6_addr > ) - > in6_addr in <nl> + return ptr . pointee <nl> + } <nl> + self . init ( v6 , interface ) <nl> + } <nl> + <nl> + / / / Create an IPv6 address from a string literal such as " fe80 : : 1 % lo0 " or " 2001 : DB8 : : 5 " <nl> + / / / <nl> + / / / This function does not perform hostname resolution . This is similar to calling getaddrinfo with <nl> + / / / AI_NUMERICHOST . <nl> + / / / <nl> + / / / - Parameter string : An IPv6 address literal string . <nl> + / / / - Returns : nil unless the string contained an IPv6 literal <nl> + public init ? ( _ string : String ) { <nl> + guard let result = getaddrinfo_numeric ( string , family : AF_INET6 ) else { <nl> + return nil <nl> + } <nl> + guard case . ipv6 ( let address ) = result else { <nl> + return nil <nl> + } <nl> + self = address <nl> + } <nl> + <nl> + fileprivate let address : in6_addr <nl> + <nl> + / / / The interface the address is scoped to , if any . <nl> + public let interface : NWInterface ? <nl> + <nl> + / / / Fetch the raw address ( sixteen bytes ) <nl> + public var rawValue : Data { <nl> + var temporary = self . address <nl> + return withUnsafeBytes ( of : & temporary ) { ( bytes ) - > Data in <nl> + Data ( bytes ) <nl> + } <nl> + } <nl> + <nl> + / / Hashable <nl> + public static func = = ( lhs : IPv6Address , rhs : IPv6Address ) - > Bool { <nl> + return lhs . address . __u6_addr . __u6_addr32 . 0 = = rhs . address . __u6_addr . __u6_addr32 . 0 & & <nl> + lhs . address . __u6_addr . __u6_addr32 . 1 = = rhs . address . __u6_addr . __u6_addr32 . 1 & & <nl> + lhs . address . __u6_addr . __u6_addr32 . 2 = = rhs . address . __u6_addr . __u6_addr32 . 2 & & <nl> + lhs . address . __u6_addr . __u6_addr32 . 3 = = rhs . address . __u6_addr . __u6_addr32 . 3 & & <nl> + lhs . interface = = rhs . interface <nl> + } <nl> + <nl> + public func hash ( into hasher : inout Hasher ) { <nl> + hasher . combine ( self . address . __u6_addr . __u6_addr32 . 0 ) <nl> + hasher . combine ( self . address . __u6_addr . __u6_addr32 . 1 ) <nl> + hasher . combine ( self . address . __u6_addr . __u6_addr32 . 2 ) <nl> + hasher . combine ( self . address . __u6_addr . __u6_addr32 . 3 ) <nl> + hasher . combine ( self . interface ) <nl> + } <nl> + <nl> + / / CustomDebugStringConvertible <nl> + public var debugDescription : String { <nl> + var sin6 = sockaddr_in6 ( self . address , 0 ) <nl> + let addressString = getnameinfo_numeric ( address : & sin6 ) <nl> + if let interface = self . interface { <nl> + return String ( " \ ( addressString ) % \ ( interface ) " ) <nl> + } else { <nl> + return addressString <nl> + } <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + / / / NWEndpoint represents something that can be connected to . <nl> + public enum NWEndpoint : Hashable , CustomDebugStringConvertible { <nl> + / / Depends on non - exhaustive enum support for forward compatibility - in the event we need to add <nl> + / / a new case in the future <nl> + / / https : / / github . com / apple / swift - evolution / blob / master / proposals / 0192 - non - exhaustive - enums . md <nl> + <nl> + / / / A host port endpoint represents an endpoint defined by the host and port . <nl> + case hostPort ( host : NWEndpoint . Host , port : NWEndpoint . Port ) <nl> + <nl> + / / / A service endpoint represents a Bonjour service <nl> + case service ( name : String , type : String , domain : String , interface : NWInterface ? ) <nl> + <nl> + / / / A unix endpoint represnts a path that supports connections using AF_UNIX domain sockets . <nl> + case unix ( path : String ) <nl> + <nl> + / / / A Host is a name or address <nl> + public enum Host : Hashable , CustomDebugStringConvertible , ExpressibleByStringLiteral { <nl> + public typealias StringLiteralType = String <nl> + <nl> + public func hash ( into hasher : inout Hasher ) { <nl> + switch self { <nl> + case . name ( let hostName , let hostInterface ) : <nl> + hasher . combine ( hostInterface ) <nl> + hasher . combine ( hostName ) <nl> + case . ipv4 ( let v4Address ) : <nl> + hasher . combine ( v4Address ) <nl> + case . ipv6 ( let v6Address ) : <nl> + hasher . combine ( v6Address ) <nl> + } <nl> + } <nl> + <nl> + / / / A host specified as a name and optional interface scope <nl> + case name ( String , NWInterface ? ) <nl> + <nl> + / / / A host specified as an IPv4 address <nl> + case ipv4 ( IPv4Address ) <nl> + <nl> + / / / A host specified an an IPv6 address <nl> + case ipv6 ( IPv6Address ) <nl> + <nl> + public init ( stringLiteral : StringLiteralType ) { <nl> + self . init ( stringLiteral ) <nl> + } <nl> + <nl> + / / / Create a host from a string . <nl> + / / / <nl> + / / / This is the preferred way to create a host . If the string is an IPv4 address literal ( " 198 . 51 . 100 . 2 " ) , an <nl> + / / / IPv4 host will be created . If the string is an IPv6 address literal ( " 2001 : DB8 : : 2 " , " fe80 : : 1 % lo " , etc ) , an IPv6 <nl> + / / / host will be created . If the string is an IPv4 mapped IPv6 address literal ( " : : ffff : 198 . 51 . 100 . 2 " ) an IPv4 <nl> + / / / host will be created . Otherwise , a named host will be created . <nl> + / / / <nl> + / / / - Parameter string : An IPv4 address literal , an IPv6 address literal , or a hostname . <nl> + / / / - Returns : A Host object <nl> + public init ( _ string : String ) { <nl> + if let result = getaddrinfo_numeric ( string ) { <nl> + self = result <nl> + } else { <nl> + if let range = string . range ( of : " % " , options : String . CompareOptions . backwards ) , <nl> + let interface = NWInterface ( String ( string [ range . upperBound . . . ] ) ) { <nl> + self = . name ( String ( string [ . . < range . lowerBound ] ) , interface ) <nl> + } else { <nl> + self = . name ( string , nil ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / Returns the interface the host is scoped to if any <nl> + public var interface : NWInterface ? { <nl> + switch self { <nl> + case . ipv4 ( let ip4 ) : <nl> + return ip4 . interface <nl> + case . ipv6 ( let ip6 ) : <nl> + return ip6 . interface <nl> + case . name ( _ , let interface ) : <nl> + return interface <nl> + } <nl> + } <nl> + <nl> + public var debugDescription : String { <nl> + switch self { <nl> + case . ipv4 ( let ip4 ) : <nl> + return ip4 . debugDescription <nl> + case . ipv6 ( let ip6 ) : <nl> + return ip6 . debugDescription <nl> + case . name ( let name , let interface ) : <nl> + if let interface = interface { <nl> + return String ( " \ ( name ) % \ ( interface ) " ) <nl> + } else { <nl> + return name <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / A network port ( TCP or UDP ) <nl> + public struct Port : Hashable , CustomDebugStringConvertible , ExpressibleByIntegerLiteral , RawRepresentable { <nl> + public typealias IntegerLiteralType = UInt16 <nl> + <nl> + fileprivate let port : IntegerLiteralType <nl> + <nl> + public static let any : NWEndpoint . Port = 0 <nl> + public static let ssh : NWEndpoint . Port = 22 <nl> + public static let smtp : NWEndpoint . Port = 25 <nl> + public static let http : NWEndpoint . Port = 80 <nl> + public static let pop : NWEndpoint . Port = 110 <nl> + public static let imap : NWEndpoint . Port = 143 <nl> + public static let https : NWEndpoint . Port = 443 <nl> + public static let imaps : NWEndpoint . Port = 993 <nl> + public static let socks : NWEndpoint . Port = 1080 <nl> + <nl> + public var rawValue : UInt16 { <nl> + return self . port <nl> + } <nl> + <nl> + / / / Create a port from a string . <nl> + / / / <nl> + / / / Supports common service names such as " http " as well as number strings such as " 80 " . <nl> + / / / <nl> + / / / - Parameter service : A service string such as " http " or a number string such as " 80 " <nl> + / / / - Returns : A port if the string can be converted to a port , nil otherwise . <nl> + public init ? ( _ service : String ) { <nl> + var hints = addrinfo ( ai_flags : AI_DEFAULT , ai_family : AF_INET6 , ai_socktype : SOCK_STREAM , ai_protocol : 0 , <nl> + ai_addrlen : 0 , ai_canonname : nil , ai_addr : nil , ai_next : nil ) <nl> + var resolved : UnsafeMutablePointer < addrinfo > ? = nil <nl> + if ( getaddrinfo ( nil , service , & hints , & resolved ) ! = 0 ) { <nl> + return nil <nl> + } <nl> + <nl> + / / Check that it didn ' t return NULL . <nl> + guard let addrinfo = resolved else { <nl> + return nil <nl> + } <nl> + <nl> + / / After this point we must ensure we free addrinfo before we return <nl> + guard let sa = addrinfo . pointee . ai_addr , sa . pointee . sa_family = = AF_INET6 else { <nl> + freeaddrinfo ( addrinfo ) <nl> + return nil <nl> + } <nl> + <nl> + self . port = sa . withMemoryRebound ( to : sockaddr_in6 . self , capacity : 1 ) { sin6 in <nl> + return sin6 . pointee . sin6_port . bigEndian <nl> + } <nl> + <nl> + freeaddrinfo ( addrinfo ) <nl> + } <nl> + <nl> + public init ( integerLiteral value : IntegerLiteralType ) { <nl> + self . port = value <nl> + } <nl> + <nl> + public init ? ( rawValue : UInt16 ) { <nl> + self . port = rawValue <nl> + } <nl> + <nl> + internal init ( _ value : UInt16 ) { <nl> + self . init ( integerLiteral : value ) <nl> + } <nl> + <nl> + public var debugDescription : String { <nl> + return String ( port ) <nl> + } <nl> + } <nl> + <nl> + / / / Returns the interface the endpoint is scoped to if any <nl> + public var interface : NWInterface ? { <nl> + switch self { <nl> + case . hostPort ( host : let host , port : _ ) : <nl> + return host . interface <nl> + case . service ( name : _ , type : _ , domain : _ , interface : let interface ) : <nl> + return interface <nl> + case . unix ( _ ) : <nl> + return nil <nl> + } <nl> + } <nl> + <nl> + internal init ? ( _ nw : nw_endpoint_t ? ) { <nl> + guard let nw = nw else { <nl> + return nil <nl> + } <nl> + var interface : NWInterface ? = nil <nl> + if let nwinterface = nw_endpoint_copy_interface ( nw ) { <nl> + interface = NWInterface ( nwinterface ) <nl> + } <nl> + if ( nw_endpoint_get_type ( nw ) = = Network . nw_endpoint_type_host ) <nl> + { <nl> + let host = NWEndpoint . Host . name ( String ( cString : nw_endpoint_get_hostname ( nw ) ) , interface ) <nl> + self = . hostPort ( host : host , port : NWEndpoint . Port ( nw_endpoint_get_port ( nw ) ) ) <nl> + } else if ( nw_endpoint_get_type ( nw ) = = Network . nw_endpoint_type_address ) { <nl> + let port = NWEndpoint . Port ( nw_endpoint_get_port ( nw ) ) <nl> + let address = nw_endpoint_get_address ( nw ) <nl> + if ( address . pointee . sa_family = = AF_INET & & address . pointee . sa_len = = MemoryLayout < sockaddr_in > . size ) { <nl> + let host = address . withMemoryRebound ( to : sockaddr_in . self , capacity : 1 ) { <nl> + ( sin : UnsafePointer < sockaddr_in > ) - > NWEndpoint . Host in <nl> + return NWEndpoint . Host . ipv4 ( IPv4Address ( sin . pointee . sin_addr , interface ) ) <nl> + } <nl> + self = . hostPort ( host : host , port : port ) <nl> + } else if ( address . pointee . sa_family = = AF_INET6 & & <nl> + address . pointee . sa_len = = MemoryLayout < sockaddr_in6 > . size ) { <nl> + let host = address . withMemoryRebound ( to : sockaddr_in6 . self , capacity : 1 ) { <nl> + ( sin6 ) - > NWEndpoint . Host in <nl> + if ( interface = = nil & & sin6 . pointee . sin6_scope_id ! = 0 ) { <nl> + interface = NWInterface ( Int ( sin6 . pointee . sin6_scope_id ) ) <nl> + } <nl> + return NWEndpoint . Host . ipv6 ( IPv6Address ( sin6 . pointee . sin6_addr , <nl> + interface ) ) <nl> + } <nl> + self = . hostPort ( host : host , port : port ) <nl> + } else if ( address . pointee . sa_family = = AF_UNIX ) { <nl> + / / sockaddr_un is very difficult to deal with in swift . Fortunately , nw_endpoint_copy_address_string <nl> + / / already does exactly what we need . <nl> + let path = nw_endpoint_copy_address_string ( nw ) <nl> + self = . unix ( path : String ( cString : path ) ) <nl> + path . deallocate ( ) <nl> + } else { <nl> + return nil <nl> + } <nl> + } else if ( nw_endpoint_get_type ( nw ) = = Network . nw_endpoint_type_bonjour_service ) { <nl> + self = . service ( name : String ( cString : nw_endpoint_get_bonjour_service_name ( nw ) ) , <nl> + type : String ( cString : nw_endpoint_get_bonjour_service_type ( nw ) ) , <nl> + domain : String ( cString : nw_endpoint_get_bonjour_service_domain ( nw ) ) , <nl> + interface : interface ) <nl> + } else { <nl> + return nil <nl> + } <nl> + } <nl> + <nl> + public func hash ( into hasher : inout Hasher ) { <nl> + switch self { <nl> + case . hostPort ( host : let host , port : let port ) : <nl> + hasher . combine ( host ) <nl> + hasher . combine ( port ) <nl> + case . service ( name : let name , type : let type , domain : let domain , interface : let interface ) : <nl> + hasher . combine ( name ) <nl> + hasher . combine ( type ) <nl> + hasher . combine ( domain ) <nl> + hasher . combine ( interface ) <nl> + case . unix ( let path ) : <nl> + hasher . combine ( path ) <nl> + } <nl> + } <nl> + <nl> + public var debugDescription : String { <nl> + switch self { <nl> + case . hostPort ( host : let host , port : let port ) : <nl> + var separator = " : " <nl> + if case . ipv6 = host { <nl> + separator = " . " <nl> + } <nl> + return String ( " \ ( host ) \ ( separator ) \ ( port ) " ) <nl> + case . service ( name : let name , type : let type , domain : let domain , interface : let interface ) : <nl> + if let interface = interface { <nl> + return String ( " \ ( name ) . \ ( type ) . \ ( domain ) % \ ( interface ) " ) <nl> + } <nl> + return String ( " \ ( name ) . \ ( type ) . \ ( domain ) " ) <nl> + case . unix ( let path ) : <nl> + return path <nl> + } <nl> + } <nl> + <nl> + internal var nw : nw_endpoint_t ? { <nl> + var endpoint : nw_endpoint_t ? = nil <nl> + var interface : NWInterface ? = nil <nl> + switch self { <nl> + case . hostPort ( host : let host , port : let port ) : <nl> + switch host { <nl> + case . ipv4 ( let ipv4 ) : <nl> + let sin = sockaddr_in ( ipv4 . address , port . port . bigEndian ) <nl> + endpoint = sin . withSockAddr { ( sa ) - > nw_endpoint_t in <nl> + nw_endpoint_create_address ( sa ) <nl> + } <nl> + interface = ipv4 . interface <nl> + case . ipv6 ( let ipv6 ) : <nl> + let sin6 = sockaddr_in6 ( ipv6 . address , port . port . bigEndian ) <nl> + endpoint = sin6 . withSockAddr { ( sa ) - > nw_endpoint_t ? in <nl> + nw_endpoint_create_address ( sa ) <nl> + } <nl> + interface = ipv6 . interface <nl> + case . name ( let host , let hostInterface ) : <nl> + endpoint = nw_endpoint_create_host ( host , port . debugDescription ) <nl> + interface = hostInterface <nl> + } <nl> + case . service ( name : let name , type : let type , domain : let domain , interface : let bonjourInterface ) : <nl> + endpoint = nw_endpoint_create_bonjour_service ( name , type , domain ) <nl> + interface = bonjourInterface <nl> + case . unix ( let path ) : <nl> + endpoint = nw_endpoint_create_unix ( path ) <nl> + } <nl> + if interface ! = nil & & endpoint ! = nil { <nl> + nw_endpoint_set_interface ( endpoint ! , interface ! . nw ) <nl> + } <nl> + return endpoint <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 863601c2c3c2 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWError . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + import Darwin <nl> + import Security <nl> + import _SwiftNetworkOverlayShims <nl> + <nl> + / / / NWError is a type to deliver error codes relevant to NWConnection and NWListener objects . <nl> + / / / Generic connectivity errors will be delivered in the posix domain , resolution errors will <nl> + / / / be delivered in the dns domain , and security errors will be delivered in the tls domain . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public enum NWError : Error , CustomDebugStringConvertible , Equatable { <nl> + <nl> + / / / The error code will be a POSIX error as defined in < sys / errno . h > <nl> + case posix ( POSIXErrorCode ) <nl> + <nl> + / / / The error code will be a DNSServiceErrorType error as defined in < dns_sd . h > <nl> + case dns ( DNSServiceErrorType ) <nl> + <nl> + / / / The error code will be a TLS error as defined in < Security / SecureTransport . h > <nl> + case tls ( OSStatus ) <nl> + <nl> + internal init ( _ nw : nw_error_t ) { <nl> + switch nw_error_get_error_domain ( nw ) { <nl> + case Network . nw_error_domain_posix : <nl> + if let errorCode = POSIXErrorCode ( rawValue : nw_error_get_error_code ( nw ) ) { <nl> + self = . posix ( errorCode ) <nl> + } else { <nl> + self = . posix ( . EINVAL ) <nl> + } <nl> + case Network . nw_error_domain_dns : <nl> + self = . dns ( DNSServiceErrorType ( nw_error_get_error_code ( nw ) ) ) <nl> + case Network . nw_error_domain_tls : <nl> + self = . tls ( OSStatus ( nw_error_get_error_code ( nw ) ) ) <nl> + default : <nl> + self = . posix ( . EINVAL ) <nl> + } <nl> + } <nl> + <nl> + internal init ? ( _ nw : nw_error_t ? ) { <nl> + guard let nw = nw else { <nl> + return nil <nl> + } <nl> + self . init ( nw ) <nl> + } <nl> + <nl> + public var debugDescription : String { <nl> + switch self { <nl> + case . posix ( let posixError ) : <nl> + let maxLen = 128 <nl> + let storage = UnsafeMutablePointer < Int8 > . allocate ( capacity : maxLen ) <nl> + var asString = " Unknown " <nl> + if strerror_r ( posixError . rawValue , storage , maxLen ) = = 0 { <nl> + asString = String ( cString : storage ) <nl> + } <nl> + storage . deallocate ( ) <nl> + return String ( " \ ( posixError ) : \ ( asString ) " ) <nl> + case . dns ( let dnsError ) : <nl> + return String ( " \ ( dnsError ) : \ ( String ( cString : nwlog_get_string_for_dns_service_error ( Int32 ( dnsError ) ) ) ) " ) <nl> + case . tls ( let tlsError ) : <nl> + return String ( " \ ( tlsError ) : \ ( String ( describing : SecCopyErrorMessageString ( Int32 ( tlsError ) , nil ) ) ) " ) <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . e12a560f9b9d <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWListener . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + import Darwin <nl> + import Dispatch <nl> + import Foundation <nl> + <nl> + / / / An NWListener is an object that is able to receive incoming NWConnection <nl> + / / / objects by binding to a local endpoint . A listener will accept connections based <nl> + / / / on the protocols defined in its stack . For transport listeners ( such as TCP and UDP ) , <nl> + / / / accepted connections will represent new local and remote address and port tuples . <nl> + / / / For listeners that include higher - level protocols that support multiplexing , <nl> + / / / accepted connections will represent multiplexed streams on a new or existing transport <nl> + / / / binding . <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public final class NWListener : CustomDebugStringConvertible { <nl> + public var debugDescription : String { <nl> + return String ( " \ ( self . nw ) " ) <nl> + } <nl> + <nl> + / / / Defines a service to advertise <nl> + public struct Service : Equatable , CustomDebugStringConvertible { <nl> + public var debugDescription : String { <nl> + var description = " " <nl> + if let name = self . name { <nl> + description = String ( " \ ( name ) . \ ( type ) " ) <nl> + } else { <nl> + description = String ( " * . \ ( type ) " ) <nl> + } <nl> + if let domain = self . domain { <nl> + description = String ( " \ ( description ) . \ ( domain ) " ) <nl> + } else { <nl> + description = String ( " \ ( description ) . * " ) <nl> + } <nl> + if txtRecord ! = nil & & txtRecord ! . count > 0 { <nl> + description = String ( " \ ( description ) < \ ( txtRecord ! . count ) bytes of txt > " ) <nl> + } <nl> + return description <nl> + } <nl> + <nl> + / / / Bonjour service name - if nil the system name will be used <nl> + public let name : String ? <nl> + <nl> + / / / Bonjour service type <nl> + public let type : String <nl> + <nl> + / / / Bonjour service domain - if nil the system will register in all appropriate domains <nl> + public let domain : String ? <nl> + <nl> + / / / Bonjour txtRecord - metadata for the service . Update the txtRecord by setting the <nl> + / / / service on the listener with the same name / type / domain and a new txtRecord . <nl> + public let txtRecord : Data ? <nl> + <nl> + / / / Create a Service to advertise for the listener . Name , domain , and txtRecord all default to nil . <nl> + public init ( name : String ? = nil , type : String , domain : String ? = nil , txtRecord : Data ? = nil ) { <nl> + self . name = name <nl> + self . type = type <nl> + self . domain = domain <nl> + self . txtRecord = txtRecord <nl> + } <nl> + <nl> + internal var nw : nw_advertise_descriptor_t { <nl> + get { <nl> + let descriptor = nw_advertise_descriptor_create_bonjour_service ( name , type , domain ) <nl> + if let txtRecord = txtRecord { <nl> + txtRecord . withUnsafeBytes ( { ( ptr : UnsafePointer < UInt8 > ) - > Void in <nl> + nw_advertise_descriptor_set_txt_record ( descriptor ! , ptr , txtRecord . count ) <nl> + } ) <nl> + } <nl> + return descriptor ! <nl> + } <nl> + } <nl> + } <nl> + <nl> + public enum State : Equatable { <nl> + / / / Prior to start , the listener will be in the setup state <nl> + case setup <nl> + <nl> + / / / Waiting listeners do not have a viable network <nl> + case waiting ( NWError ) <nl> + <nl> + / / / Ready listeners are able to receive incoming connections <nl> + / / / Bonjour service may not yet be registered <nl> + case ready <nl> + <nl> + / / / Failed listeners are no longer able to receive incoming connections <nl> + case failed ( NWError ) <nl> + <nl> + / / / Cancelled listeners have been invalidated by the client and will send no more events <nl> + case cancelled <nl> + <nl> + internal init ( _ nw : nw_listener_state_t , _ err : nw_error_t ? ) { <nl> + switch nw { <nl> + case Network . nw_listener_state_invalid : <nl> + self = . setup <nl> + case Network . nw_listener_state_waiting : <nl> + if let error = NWError ( err ) { <nl> + self = . waiting ( error ) <nl> + } else { <nl> + self = . waiting ( NWError . posix ( . ENETDOWN ) ) <nl> + } <nl> + case Network . nw_listener_state_ready : <nl> + self = . ready <nl> + case Network . nw_listener_state_failed : <nl> + if let error = NWError ( err ) { <nl> + self = . failed ( error ) <nl> + } else { <nl> + self = . failed ( NWError . posix ( . EINVAL ) ) <nl> + } <nl> + case Network . nw_listener_state_cancelled : <nl> + self = . cancelled <nl> + default : <nl> + self = . cancelled <nl> + } <nl> + } <nl> + } <nl> + <nl> + private var _newConnectionHandler : ( ( _ connection : NWConnection ) - > Void ) ? <nl> + <nl> + / / / Block to be called for new inbound connections <nl> + public var newConnectionHandler : ( ( _ connection : NWConnection ) - > Void ) ? { <nl> + set { <nl> + self . _newConnectionHandler = newValue <nl> + if let newValue = newValue { <nl> + nw_listener_set_new_connection_handler ( self . nw ) { ( nwConnection ) in <nl> + guard let newConnection = NWConnection ( using : self . parameters , inbound : nwConnection ) else { <nl> + return ; <nl> + } <nl> + newValue ( newConnection ) <nl> + } <nl> + } else { <nl> + nw_listener_set_state_changed_handler ( self . nw , nil ) <nl> + } <nl> + } <nl> + get { <nl> + return self . _newConnectionHandler <nl> + } <nl> + } <nl> + <nl> + private var _state : State = . setup <nl> + private let nw : nw_listener_t <nl> + <nl> + private var _stateUpdateHandler : ( ( _ state : NWListener . State ) - > Void ) ? <nl> + <nl> + / / / Set a block to be called when the listener ' s state changes , which may be called <nl> + / / / multiple times until the listener is cancelled . <nl> + public var stateUpdateHandler : ( ( _ state : NWListener . State ) - > Void ) ? { <nl> + set { <nl> + self . _stateUpdateHandler = newValue <nl> + if let newValue = newValue { <nl> + nw_listener_set_state_changed_handler ( self . nw ) { ( state , error ) in <nl> + self . _state = NWListener . State ( state , error ) <nl> + newValue ( self . _state ) <nl> + } <nl> + } else { <nl> + nw_listener_set_state_changed_handler ( self . nw , nil ) <nl> + } <nl> + } <nl> + get { <nl> + return self . _stateUpdateHandler <nl> + } <nl> + } <nl> + <nl> + / / / NWParameters used to create the listener <nl> + public let parameters : NWParameters <nl> + <nl> + private var _service : NWListener . Service ? <nl> + <nl> + / / / Optional Bonjour service to advertise with the listener <nl> + / / / May be modified on the fly to update the TXT record or <nl> + / / / change the advertised service . <nl> + public var service : NWListener . Service ? { <nl> + get { <nl> + return _service <nl> + } <nl> + set { <nl> + _service = newValue <nl> + if let service = _service { <nl> + nw_listener_set_advertise_descriptor ( nw , service . nw ) <nl> + } else { <nl> + nw_listener_set_advertise_descriptor ( nw , nil ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / The current port the listener is bound to , if any . The port is only valid when the listener is in the ready <nl> + / / / state . <nl> + public var port : NWEndpoint . Port ? { <nl> + return NWEndpoint . Port ( nw_listener_get_port ( self . nw ) ) <nl> + } <nl> + <nl> + public enum ServiceRegistrationChange { <nl> + / / / An event when a Bonjour service has been registered , with the endpoint being advertised <nl> + case add ( NWEndpoint ) <nl> + <nl> + / / / An event when a Bonjour service has been unregistered , with the endpoint being removed <nl> + case remove ( NWEndpoint ) <nl> + } <nl> + <nl> + private var _serviceRegistrationUpdateHandler : ( ( _ change : NWListener . ServiceRegistrationChange ) - > Void ) ? <nl> + <nl> + / / / Set a block to be called when the listener has added or removed a <nl> + / / / registered service . This may be called multiple times until the listener <nl> + / / / is cancelled . <nl> + public var serviceRegistrationUpdateHandler : ( ( _ change : NWListener . ServiceRegistrationChange ) - > Void ) ? { <nl> + set { <nl> + self . _serviceRegistrationUpdateHandler = newValue <nl> + if let newValue = newValue { <nl> + nw_listener_set_advertised_endpoint_changed_handler ( self . nw ) { ( endpoint , added ) in <nl> + if let changedEndpoint = NWEndpoint ( endpoint ) { <nl> + if added { <nl> + newValue ( NWListener . ServiceRegistrationChange . add ( changedEndpoint ) ) <nl> + } else { <nl> + newValue ( NWListener . ServiceRegistrationChange . remove ( changedEndpoint ) ) <nl> + } <nl> + } <nl> + } <nl> + } else { <nl> + nw_listener_set_advertised_endpoint_changed_handler ( self . nw , nil ) <nl> + } <nl> + } <nl> + get { <nl> + return self . _serviceRegistrationUpdateHandler <nl> + } <nl> + } <nl> + <nl> + internal init ( _ listener : nw_listener_t , _ parameters : NWParameters ) { <nl> + self . parameters = parameters ; <nl> + self . nw = listener <nl> + } <nl> + <nl> + / / / Creates a networking listener . The listener will be assigned a random <nl> + / / / port to listen on unless otherwise specified . <nl> + / / / <nl> + / / / - Parameter using : The parameters to use for the listener , which include the protocols to use for the <nl> + / / / listener . The parameters requiredLocalEndpoint may be used to specify the local address and port to listen on . <nl> + / / / - Parameter on : The port to listen on . Defaults to . any which will cause a random unused port to be assigned . <nl> + / / / Specifying a port that is already in use will cause the listener to fail after starting . <nl> + / / / - Returns : Returns a listener object that may be set up and started or throws an error if the parameters are <nl> + / / / not compatible with the provided port . <nl> + public init ( using : NWParameters , on : NWEndpoint . Port = . any ) throws { <nl> + if on ! = . any { <nl> + guard let listener = nw_listener_create_with_port ( " \ ( on ) " , using . nw ) else { <nl> + throw NWError . posix ( . EINVAL ) <nl> + } <nl> + self . parameters = using <nl> + self . nw = listener <nl> + } else { <nl> + guard let listener = nw_listener_create ( using . nw ) else { <nl> + throw NWError . posix ( . EINVAL ) <nl> + } <nl> + self . parameters = using <nl> + self . nw = listener <nl> + } <nl> + } <nl> + <nl> + / / / Creates a networking listener based on an existing <nl> + / / / multiplexing connection . If there are multiple protocols <nl> + / / / in the connection that support listening for incoming flows , <nl> + / / / the listener will be hooked up the highest in the stack <nl> + / / / ( the closest to the reading and writing of the client data ) . <nl> + / / / <nl> + / / / - Parameter withConnection : An existing connection that has a multiplexing protocol <nl> + / / / that supports receiving new connections . <nl> + / / / - Parameter parameters : The parameters to use for the listener . The protocol stack <nl> + / / / defined in the parameters must be able to join a protocol <nl> + / / / in the connection that supports listening protocols . <nl> + convenience internal init ? ( connection : NWConnection , parameters : NWParameters ) { <nl> + guard let listener = nw_listener_create_with_connection ( connection . nw , parameters . nw ) else { <nl> + return nil <nl> + } <nl> + self . init ( listener , parameters ) <nl> + } <nl> + <nl> + / / / Start the listener and provide a queue on which callback handlers will be executed . <nl> + / / / When the listener state moves to ready , the listener is registered with the system <nl> + / / / and can receive incoming connections . <nl> + / / / Start should only be called once on a listener , and multiple calls to start will <nl> + / / / be ignored . <nl> + public func start ( queue : DispatchQueue ) { <nl> + self . _queue = queue <nl> + nw_listener_set_queue ( self . nw , queue ) <nl> + nw_listener_start ( self . nw ) <nl> + } <nl> + <nl> + private var _queue : DispatchQueue ? = nil <nl> + <nl> + / / / Get queue used for delivering block handlers , such as stateUpdateHandler , <nl> + / / / serviceRegistrationUpdateHandler , and newConnectionHandler . <nl> + / / / If the listener has not yet been started , the queue will be nil . Once the listener has been <nl> + / / / started , the queue will be valid . <nl> + public var queue : DispatchQueue ? { <nl> + get { <nl> + return _queue <nl> + } <nl> + } <nl> + <nl> + / / / Cancel the listener . <nl> + / / / <nl> + / / / The cancel is asynchronous and the state will eventually transition to cancelled . Subsequent calls to <nl> + / / / cancel are ignored . <nl> + public func cancel ( ) { <nl> + nw_listener_cancel ( self . nw ) <nl> + } <nl> + } <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 8eb15a09b811 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWParameters . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + / / / An NWParameters object contains the parameters necessary to create <nl> + / / / a network connection or listener . NWParameters include any preferences for <nl> + / / / network paths ( such as required , prohibited , and preferred networks , and local <nl> + / / / endpoint requirements ) ; preferences for data transfer and quality of service ; <nl> + / / / and the protocols to be used for a connection along with any protocol - specific <nl> + / / / options . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public final class NWParameters : CustomDebugStringConvertible { <nl> + public var debugDescription : String { <nl> + return String ( " \ ( self . nw ) " ) <nl> + } <nl> + <nl> + internal let nw : nw_parameters_t <nl> + <nl> + / / / Creates a parameters object that is configured for TLS and TCP . The caller can use <nl> + / / / the default configuration for TLS and TCP , or set specific options for each protocol , <nl> + / / / or disable TLS . <nl> + / / / <nl> + / / / - Parameter tls : TLS options or nil for no TLS <nl> + / / / - Parameter tcp : TCP options . Defaults to NWProtocolTCP . Options ( ) with no options overridden . <nl> + / / / - Returns : NWParameters object that can be used for creating a connection or listener <nl> + public convenience init ( tls : NWProtocolTLS . Options ? , tcp : NWProtocolTCP . Options = NWProtocolTCP . Options ( ) ) { <nl> + self . init ( ) <nl> + let protocolStack = self . defaultProtocolStack <nl> + protocolStack . transportProtocol = tcp <nl> + if let tls = tls { <nl> + protocolStack . applicationProtocols = [ tls ] <nl> + } else { <nl> + protocolStack . applicationProtocols = [ ] <nl> + } <nl> + } <nl> + <nl> + / / / Creates a parameters object that is configured for DTLS and UDP . The caller can use <nl> + / / / the default configuration for DTLS and UDP , or set specific options for each protocol , <nl> + / / / or disable TLS . <nl> + / / / <nl> + / / / - Parameter dtls : DTLS options or nil for no DTLS <nl> + / / / - Parameter udp : UDP options . Defaults to NWProtocolUDP . Options ( ) with no options overridden . <nl> + / / / - Returns : NWParameters object that can be used for create a connection or listener <nl> + public convenience init ( dtls : NWProtocolTLS . Options ? , udp : NWProtocolUDP . Options = NWProtocolUDP . Options ( ) ) { <nl> + self . init ( ) <nl> + let protocolStack = self . defaultProtocolStack <nl> + protocolStack . transportProtocol = udp <nl> + if let dtls = dtls { <nl> + protocolStack . applicationProtocols = [ dtls ] <nl> + } else { <nl> + protocolStack . applicationProtocols = [ ] <nl> + } <nl> + } <nl> + <nl> + / / / Creates a generic NWParameters object . Note that in order to use parameters <nl> + / / / with a NWConnection or a NetworkListener , the parameters must have protocols <nl> + / / / added into the defaultProtocolStack . Clients using standard protocol <nl> + / / / configurations should use init ( tls : tcp : ) or init ( dtls : udp : ) . <nl> + public init ( ) { <nl> + self . nw = nw_parameters_create ( ) <nl> + } <nl> + <nl> + private init ( nw : nw_parameters_t ) { <nl> + self . nw = nw <nl> + } <nl> + <nl> + / / / Default set of parameters for TLS over TCP <nl> + / / / This is equivalent to calling init ( tls : NWProtocolTLS . Options ( ) , tcp : NWProtocolTCP . Options ( ) ) <nl> + public class var tls : NWParameters { <nl> + return NWParameters ( tls : NWProtocolTLS . Options ( ) ) <nl> + } <nl> + <nl> + / / / Default set of parameters for DTLS over UDP <nl> + / / / This is equivalent to calling init ( dtls : NWProtocolTLS . Options ( ) , udp : NWProtocolUDP . Options ( ) ) <nl> + public class var dtls : NWParameters { <nl> + return NWParameters ( dtls : NWProtocolTLS . Options ( ) ) <nl> + } <nl> + <nl> + / / / Default set of parameters for TCP <nl> + / / / This is equivalent to calling init ( tls : nil , tcp : NWProtocolTCP . Options ( ) ) <nl> + public class var tcp : NWParameters { <nl> + return NWParameters ( tls : nil ) <nl> + } <nl> + <nl> + / / / Default set of parameters for UDP <nl> + / / / This is equivalent to calling init ( dtls : nil , udp : NWProtocolUDP . Options ( ) ) <nl> + public class var udp : NWParameters { <nl> + return NWParameters ( dtls : nil ) <nl> + } <nl> + <nl> + / / / Require a connection to use a specific interface , or fail if not available <nl> + public var requiredInterface : NWInterface ? { <nl> + set { <nl> + if let interface = newValue { <nl> + nw_parameters_require_interface ( self . nw , interface . nw ) <nl> + } else { <nl> + nw_parameters_require_interface ( self . nw , nil ) <nl> + } <nl> + } <nl> + get { <nl> + if let interface = nw_parameters_copy_required_interface ( self . nw ) { <nl> + return NWInterface ( interface ) <nl> + } else { <nl> + return nil <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / Require a connection to use a specific interface type , or fail if not available <nl> + public var requiredInterfaceType : NWInterface . InterfaceType { <nl> + set { <nl> + nw_parameters_set_required_interface_type ( self . nw , newValue . nw ) <nl> + } <nl> + get { <nl> + return NWInterface . InterfaceType ( nw_parameters_get_required_interface_type ( self . nw ) ) <nl> + } <nl> + } <nl> + <nl> + / / / Define one or more interfaces that a connection will not be allowed to use <nl> + public var prohibitedInterfaces : [ NWInterface ] ? { <nl> + set { <nl> + nw_parameters_clear_prohibited_interfaces ( self . nw ) <nl> + if let prohibitedInterfaces = newValue { <nl> + for prohibitedInterface in prohibitedInterfaces { <nl> + nw_parameters_prohibit_interface ( self . nw , prohibitedInterface . nw ) <nl> + } <nl> + } <nl> + } <nl> + get { <nl> + var interfaces = [ NWInterface ] ( ) <nl> + nw_parameters_iterate_prohibited_interfaces ( self . nw ) { ( interface ) in <nl> + interfaces . append ( NWInterface ( interface ) ) <nl> + return true <nl> + } <nl> + return interfaces <nl> + } <nl> + } <nl> + <nl> + / / / Define one or more interface types that a connection will not be allowed to use <nl> + public var prohibitedInterfaceTypes : [ NWInterface . InterfaceType ] ? { <nl> + set { <nl> + nw_parameters_clear_prohibited_interface_types ( self . nw ) <nl> + if let prohibitedInterfaceTypes = newValue { <nl> + for prohibitedInterfaceType in prohibitedInterfaceTypes { <nl> + nw_parameters_prohibit_interface_type ( self . nw , prohibitedInterfaceType . nw ) <nl> + } <nl> + } <nl> + } <nl> + get { <nl> + var interfaceTypes = [ NWInterface . InterfaceType ] ( ) <nl> + nw_parameters_iterate_prohibited_interface_types ( self . nw ) { ( interfaceType ) in <nl> + interfaceTypes . append ( NWInterface . InterfaceType ( interfaceType ) ) <nl> + return true <nl> + } <nl> + return interfaceTypes <nl> + } <nl> + } <nl> + <nl> + / / / Disallow connection from using interfaces considered expensive <nl> + public var prohibitExpensivePaths : Bool { <nl> + set { <nl> + nw_parameters_set_prohibit_expensive ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return nw_parameters_get_prohibit_expensive ( self . nw ) <nl> + } <nl> + } <nl> + <nl> + / / / If true , a direct connection will be attempted first even if proxies are configured . If the direct connection <nl> + / / / fails , connecting through the proxies will still be attempted . <nl> + public var preferNoProxies : Bool { <nl> + set { <nl> + nw_parameters_set_prefer_no_proxy ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return nw_parameters_get_prefer_no_proxy ( self . nw ) <nl> + } <nl> + } <nl> + <nl> + / / / Force a specific local address to be used . This value is nil by <nl> + / / / default , in which case the system selects the most appropriate <nl> + / / / local address and selects a local port . <nl> + public var requiredLocalEndpoint : NWEndpoint ? { <nl> + set { <nl> + if let endpoint = newValue { <nl> + nw_parameters_set_local_endpoint ( self . nw , endpoint . nw ) <nl> + } else { <nl> + nw_parameters_set_local_endpoint ( self . nw , nil ) <nl> + } <nl> + } <nl> + get { <nl> + if let endpoint = nw_parameters_copy_local_endpoint ( self . nw ) { <nl> + return NWEndpoint ( endpoint ) <nl> + } else { <nl> + return nil <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / Allow multiple connections to use the same local address and port <nl> + / / / ( SO_REUSEADDR and SO_REUSEPORT ) . <nl> + public var allowLocalEndpointReuse : Bool { <nl> + set { <nl> + nw_parameters_set_reuse_local_address ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return nw_parameters_get_reuse_local_address ( self . nw ) <nl> + } <nl> + } <nl> + <nl> + / / / Cause an NWListener to only advertise services on the local link , <nl> + / / / and only accept connections from the local link . <nl> + public var acceptLocalOnly : Bool { <nl> + set { <nl> + nw_parameters_set_local_only ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return nw_parameters_get_local_only ( self . nw ) <nl> + } <nl> + } <nl> + <nl> + / / / The ServiceClass represents the network queuing priority to use <nl> + / / / for traffic generated by a NWConnection . <nl> + public enum ServiceClass { <nl> + / / / Default priority traffic <nl> + case bestEffort <nl> + / / / Bulk traffic , or traffic that can be de - prioritized behind foreground traffic <nl> + case background <nl> + / / / Interactive video traffic <nl> + case interactiveVideo <nl> + / / / Interactive voice traffic <nl> + case interactiveVoice <nl> + / / / Responsive data <nl> + case responsiveData <nl> + / / / Signaling <nl> + case signaling <nl> + <nl> + internal var nw : nw_service_class_t { <nl> + switch self { <nl> + case . bestEffort : <nl> + return Network . nw_service_class_best_effort <nl> + case . background : <nl> + return Network . nw_service_class_background <nl> + case . interactiveVideo : <nl> + return Network . nw_service_class_interactive_video <nl> + case . interactiveVoice : <nl> + return Network . nw_service_class_interactive_voice <nl> + case . responsiveData : <nl> + return Network . nw_service_class_responsive_data <nl> + case . signaling : <nl> + return Network . nw_service_class_signaling <nl> + } <nl> + } <nl> + <nl> + internal init ( _ nw : nw_service_class_t ) { <nl> + switch nw { <nl> + case Network . nw_service_class_best_effort : <nl> + self = . bestEffort <nl> + case Network . nw_service_class_background : <nl> + self = . background <nl> + case Network . nw_service_class_interactive_video : <nl> + self = . interactiveVideo <nl> + case Network . nw_service_class_interactive_voice : <nl> + self = . interactiveVoice <nl> + case Network . nw_service_class_responsive_data : <nl> + self = . responsiveData <nl> + case Network . nw_service_class_signaling : <nl> + self = . signaling <nl> + default : <nl> + self = . bestEffort <nl> + } <nl> + } <nl> + } <nl> + public var serviceClass : NWParameters . ServiceClass { <nl> + set { <nl> + nw_parameters_set_service_class ( self . nw , newValue . nw ) <nl> + } <nl> + get { <nl> + return NWParameters . ServiceClass ( nw_parameters_get_service_class ( self . nw ) ) <nl> + } <nl> + } <nl> + <nl> + / / / Multipath services represent the modes of multipath usage that are <nl> + / / / allowed for connections . <nl> + public enum MultipathServiceType { <nl> + / / / No multipath transport will be attempted <nl> + case disabled <nl> + / / / Only use the expensive interface when the when the primary one is not available <nl> + case handover <nl> + / / / Use the expensive interface more aggressively to reduce latency <nl> + case interactive <nl> + / / / Use all available interfaces to provide the highest throughput and lowest latency <nl> + case aggregate <nl> + <nl> + internal var nw : nw_multipath_service_t { <nl> + switch self { <nl> + case . disabled : <nl> + return Network . nw_multipath_service_disabled <nl> + case . handover : <nl> + return Network . nw_multipath_service_handover <nl> + case . interactive : <nl> + return Network . nw_multipath_service_interactive <nl> + case . aggregate : <nl> + return Network . nw_multipath_service_aggregate <nl> + } <nl> + } <nl> + <nl> + internal init ( _ nw : nw_multipath_service_t ) { <nl> + switch nw { <nl> + case Network . nw_multipath_service_disabled : <nl> + self = . disabled <nl> + case Network . nw_multipath_service_handover : <nl> + self = . handover <nl> + case Network . nw_multipath_service_interactive : <nl> + self = . interactive <nl> + case Network . nw_multipath_service_aggregate : <nl> + self = . aggregate <nl> + default : <nl> + self = . disabled <nl> + } <nl> + } <nl> + } <nl> + public var multipathServiceType : NWParameters . MultipathServiceType { <nl> + set { <nl> + nw_parameters_set_multipath_service ( self . nw , newValue . nw ) <nl> + } <nl> + get { <nl> + return NWParameters . MultipathServiceType ( nw_parameters_get_multipath_service ( self . nw ) ) <nl> + } <nl> + } <nl> + <nl> + / / / Use fast open for an outbound NWConnection , which may be done at any <nl> + / / / protocol level . Use of fast open requires that the caller send <nl> + / / / idempotent data on the connection before the connection may move <nl> + / / / into ready state . As a side effect , this may implicitly enable <nl> + / / / fast open for protocols in the stack , even if they did not have <nl> + / / / fast open expliclty enabled on them ( such as the option to enable <nl> + / / / TCP Fast Open ) . <nl> + public var allowFastOpen : Bool { <nl> + set { <nl> + nw_parameters_set_fast_open_enabled ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return nw_parameters_get_fast_open_enabled ( self . nw ) <nl> + } <nl> + } <nl> + <nl> + / / / Allow or prohibit the use of expired DNS answers during connection establishment . <nl> + / / / If allowed , a DNS answer that was previously returned may be re - used for new <nl> + / / / connections even after the answers are considered expired . A query for fresh answers <nl> + / / / will be sent in parallel , and the fresh answers will be used as alternate addresses <nl> + / / / in case the expired answers do not result in successful connections . <nl> + / / / By default , this value is . systemDefault , which allows the system to determine <nl> + / / / if it is appropriate to use expired answers . <nl> + public enum ExpiredDNSBehavior { <nl> + / / / Let the system determine whether or not to allow expired DNS answers <nl> + case systemDefault <nl> + / / / Explicitly allow the use of expired DNS answers <nl> + case allow <nl> + / / / Explicitly prohibit the use of expired DNS answers <nl> + case prohibit <nl> + <nl> + internal var nw : nw_parameters_expired_dns_behavior_t { <nl> + switch self { <nl> + case . systemDefault : <nl> + return Network . nw_parameters_expired_dns_behavior_default <nl> + case . allow : <nl> + return Network . nw_parameters_expired_dns_behavior_allow <nl> + case . prohibit : <nl> + return Network . nw_parameters_expired_dns_behavior_prohibit <nl> + } <nl> + } <nl> + <nl> + internal init ( _ nw : nw_parameters_expired_dns_behavior_t ) { <nl> + switch nw { <nl> + case Network . nw_parameters_expired_dns_behavior_default : <nl> + self = . systemDefault <nl> + case Network . nw_parameters_expired_dns_behavior_allow : <nl> + self = . allow <nl> + case Network . nw_parameters_expired_dns_behavior_prohibit : <nl> + self = . prohibit <nl> + default : <nl> + self = . systemDefault <nl> + } <nl> + } <nl> + } <nl> + public var expiredDNSBehavior : NWParameters . ExpiredDNSBehavior { <nl> + set { <nl> + nw_parameters_set_expired_dns_behavior ( self . nw , newValue . nw ) <nl> + } <nl> + get { <nl> + return NWParameters . ExpiredDNSBehavior ( nw_parameters_get_expired_dns_behavior ( self . nw ) ) <nl> + } <nl> + } <nl> + <nl> + / / / A ProtocolStack contains a list of protocols to use for a connection . <nl> + / / / The members of the protocol stack are NWProtocolOptions objects , each <nl> + / / / defining which protocol to use within the stack along with any protocol - specific <nl> + / / / options . Each stack includes an array of application - level protocols , a single <nl> + / / / transport - level protocol , and an optional internet - level protocol . If the internet - <nl> + / / / level protocol is not specified , any available and applicable IP address family <nl> + / / / may be used . <nl> + public class ProtocolStack { <nl> + public var applicationProtocols : [ NWProtocolOptions ] { <nl> + set { <nl> + nw_protocol_stack_clear_application_protocols ( self . nw ) <nl> + for applicationProtocol in newValue . reversed ( ) { <nl> + nw_protocol_stack_prepend_application_protocol ( self . nw , applicationProtocol . nw ) <nl> + } <nl> + } <nl> + get { <nl> + var applicationProtocols = [ NWProtocolOptions ] ( ) <nl> + nw_protocol_stack_iterate_application_protocols ( self . nw ) { ( protocolOptions ) in <nl> + let applicationDefinition = nw_protocol_options_copy_definition ( protocolOptions ) <nl> + if ( nw_protocol_definition_is_equal ( applicationDefinition , NWProtocolTLS . definition . nw ) ) { <nl> + applicationProtocols . append ( NWProtocolTLS . Options ( protocolOptions ) ) <nl> + } <nl> + } <nl> + return applicationProtocols <nl> + } <nl> + } <nl> + <nl> + public var transportProtocol : NWProtocolOptions ? { <nl> + set { <nl> + if let transport = newValue { <nl> + nw_protocol_stack_set_transport_protocol ( self . nw , transport . nw ) <nl> + } <nl> + } <nl> + get { <nl> + if let transport = nw_protocol_stack_copy_transport_protocol ( nw ) { <nl> + let transportDefinition = nw_protocol_options_copy_definition ( transport ) <nl> + if ( nw_protocol_definition_is_equal ( transportDefinition , NWProtocolTCP . definition . nw ) ) { <nl> + return NWProtocolTCP . Options ( transport ) <nl> + } else if ( nw_protocol_definition_is_equal ( transportDefinition , NWProtocolUDP . definition . nw ) ) { <nl> + return NWProtocolUDP . Options ( transport ) <nl> + } <nl> + } <nl> + return nil <nl> + } <nl> + } <nl> + <nl> + public var internetProtocol : NWProtocolOptions ? { <nl> + set { <nl> + / / Not currently allowed <nl> + return <nl> + } <nl> + get { <nl> + if let ip = nw_protocol_stack_copy_internet_protocol ( nw ) { <nl> + if ( nw_protocol_definition_is_equal ( nw_protocol_options_copy_definition ( ip ) , NWProtocolIP . definition . nw ) ) { <nl> + return NWProtocolIP . Options ( ip ) <nl> + } <nl> + } <nl> + return nil <nl> + } <nl> + } <nl> + <nl> + internal let nw : nw_protocol_stack_t <nl> + <nl> + internal init ( _ nw : nw_protocol_stack_t ) { <nl> + self . nw = nw <nl> + } <nl> + } <nl> + <nl> + / / / Every NWParameters has a default protocol stack , although it may start out empty . <nl> + public var defaultProtocolStack : NWParameters . ProtocolStack { <nl> + get { <nl> + return NWParameters . ProtocolStack ( nw_parameters_copy_default_protocol_stack ( self . nw ) ) <nl> + } <nl> + } <nl> + <nl> + / / / Perform a deep copy of parameters <nl> + public func copy ( ) - > NWParameters { <nl> + return NWParameters ( nw : nw_parameters_copy ( self . nw ) ) <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 24e9c4165520 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWPath . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + import Foundation <nl> + import _SwiftNetworkOverlayShims <nl> + <nl> + / / / An NWInterface object represents an instance of a network interface of a specific <nl> + / / / type , such as a Wi - Fi or Cellular interface . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public struct NWInterface : Hashable , CustomDebugStringConvertible { <nl> + <nl> + public var debugDescription : String { <nl> + return self . name <nl> + } <nl> + <nl> + public static func = = ( lhs : NWInterface , rhs : NWInterface ) - > Bool { <nl> + return lhs . index = = rhs . index & & lhs . name = = rhs . name <nl> + } <nl> + <nl> + public func hash ( into hasher : inout Hasher ) { <nl> + hasher . combine ( self . index ) <nl> + hasher . combine ( self . name ) <nl> + } <nl> + <nl> + / / / Interface types represent the underlying media for a network link <nl> + public enum InterfaceType { <nl> + / / / A virtual or otherwise unknown interface type <nl> + case other <nl> + / / / A Wi - Fi link <nl> + case wifi <nl> + / / / A Cellular link <nl> + case cellular <nl> + / / / A Wired Ethernet link <nl> + case wiredEthernet <nl> + / / / The Loopback Interface <nl> + case loopback <nl> + <nl> + internal var nw : nw_interface_type_t { <nl> + switch self { <nl> + case . wifi : <nl> + return Network . nw_interface_type_wifi <nl> + case . cellular : <nl> + return Network . nw_interface_type_cellular <nl> + case . wiredEthernet : <nl> + return Network . nw_interface_type_wired <nl> + case . loopback : <nl> + return Network . nw_interface_type_loopback <nl> + case . other : <nl> + return Network . nw_interface_type_other <nl> + } <nl> + } <nl> + <nl> + internal init ( _ nw : nw_interface_type_t ) { <nl> + switch nw { <nl> + case Network . nw_interface_type_wifi : <nl> + self = . wifi <nl> + case Network . nw_interface_type_cellular : <nl> + self = . cellular <nl> + case Network . nw_interface_type_wired : <nl> + self = . wiredEthernet <nl> + case Network . nw_interface_type_loopback : <nl> + self = . loopback <nl> + default : <nl> + self = . other <nl> + } <nl> + } <nl> + } <nl> + <nl> + public let type : InterfaceType <nl> + <nl> + / / / The name of the interface , such as " en0 " <nl> + public let name : String <nl> + <nl> + / / / The kernel index of the interface <nl> + public let index : Int <nl> + <nl> + internal let nw : nw_interface_t <nl> + <nl> + internal init ( _ nw : nw_interface_t ) { <nl> + self . nw = nw <nl> + self . type = NWInterface . InterfaceType ( nw_interface_get_type ( nw ) ) <nl> + self . name = String ( cString : nw_interface_get_name ( nw ) ) <nl> + self . index = Int ( nw_interface_get_index ( nw ) ) <nl> + } <nl> + <nl> + internal init ? ( _ index : Int ) { <nl> + guard let nw = nw_interface_create_with_index ( UInt32 ( index ) ) else { <nl> + return nil <nl> + } <nl> + self . init ( nw ) <nl> + } <nl> + <nl> + internal init ? ( _ name : String ) { <nl> + guard let nw = nw_interface_create_with_name ( name ) else { <nl> + return nil <nl> + } <nl> + self . init ( nw ) <nl> + } <nl> + } <nl> + <nl> + / / / An NWPath object represents a snapshot of network path state . This state <nl> + / / / represents the known information about the local interface and routes that may <nl> + / / / be used to send and receive data . If the network path for a connection changes <nl> + / / / due to interface characteristics , addresses , or other attributes , a new NWPath <nl> + / / / object will be generated . Note that the differences in the path attributes may not <nl> + / / / be visible through public accessors , and these changes should be treated merely <nl> + / / / as an indication that something about the network has changed . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public struct NWPath : Equatable , CustomDebugStringConvertible { <nl> + <nl> + public var debugDescription : String { <nl> + return String ( describing : self . nw ) <nl> + } <nl> + <nl> + / / / An NWPath status indicates if there is a usable route available upon which to send and receive data . <nl> + public enum Status { <nl> + / / / The path has a usable route upon which to send and receive data <nl> + case satisfied <nl> + / / / The path does not have a usable route . This may be due to a network interface being down , or due to system policy . <nl> + case unsatisfied <nl> + / / / The path does not currently have a usable route , but a connection attempt will trigger network attachment . <nl> + case requiresConnection <nl> + } <nl> + <nl> + public let status : NWPath . Status <nl> + <nl> + / / / A list of all interfaces currently available to this path <nl> + public let availableInterfaces : [ NWInterface ] <nl> + <nl> + / / / Checks if the path uses an NWInterface that is considered to be expensive <nl> + / / / <nl> + / / / Cellular interfaces are considered expensive . WiFi hotspots from an iOS device are considered expensive . Other <nl> + / / / interfaces may appear as expensive in the future . <nl> + public let isExpensive : Bool <nl> + public let supportsIPv4 : Bool <nl> + public let supportsIPv6 : Bool <nl> + public let supportsDNS : Bool <nl> + <nl> + / / / Check the local endpoint set on a path . This will be nil for paths <nl> + / / / from an NWPathMonitor . For paths from an NWConnection , this will <nl> + / / / be set to the local address and port in use by the connection . <nl> + public let localEndpoint : NWEndpoint ? <nl> + <nl> + / / / Check the remote endpoint set on a path . This will be nil for paths <nl> + / / / from an NWPathMonitor . For paths from an NWConnection , this will <nl> + / / / be set to the remote address and port in use by the connection . <nl> + public let remoteEndpoint : NWEndpoint ? <nl> + <nl> + / / / Checks if the path uses an NWInterface with the specified type <nl> + public func usesInterfaceType ( _ type : NWInterface . InterfaceType ) - > Bool { <nl> + if let path = self . nw { <nl> + return nw_path_uses_interface_type ( path , type . nw ) <nl> + } <nl> + return false <nl> + } <nl> + <nl> + internal let nw : nw_path_t ? <nl> + <nl> + internal init ( _ path : nw_path_t ? ) { <nl> + var interfaces = [ NWInterface ] ( ) <nl> + var local : NWEndpoint ? = nil <nl> + var remote : NWEndpoint ? = nil <nl> + if let path = path { <nl> + let nwstatus = nw_path_get_status ( path ) <nl> + switch ( nwstatus ) { <nl> + case Network . nw_path_status_satisfied : <nl> + self . status = . satisfied <nl> + case Network . nw_path_status_satisfiable : <nl> + self . status = . requiresConnection <nl> + default : <nl> + self . status = . unsatisfied <nl> + } <nl> + self . isExpensive = nw_path_is_expensive ( path ) <nl> + self . supportsDNS = nw_path_has_dns ( path ) <nl> + self . supportsIPv4 = nw_path_has_ipv4 ( path ) <nl> + self . supportsIPv6 = nw_path_has_ipv6 ( path ) <nl> + <nl> + nw_path_enumerate_interfaces ( path , { ( interface ) in <nl> + interfaces . append ( NWInterface ( interface ) ) <nl> + return true <nl> + } ) <nl> + <nl> + if let nwlocal = nw_path_copy_effective_local_endpoint ( path ) { <nl> + local = NWEndpoint ( nwlocal ) <nl> + } <nl> + if let nwremote = nw_path_copy_effective_remote_endpoint ( path ) { <nl> + remote = NWEndpoint ( nwremote ) <nl> + } <nl> + } else { <nl> + self . status = . unsatisfied <nl> + self . isExpensive = false <nl> + self . supportsDNS = false <nl> + self . supportsIPv4 = false <nl> + self . supportsIPv6 = false <nl> + } <nl> + self . availableInterfaces = interfaces <nl> + self . nw = path <nl> + self . localEndpoint = local <nl> + self . remoteEndpoint = remote <nl> + } <nl> + <nl> + public static func = = ( lhs : NWPath , rhs : NWPath ) - > Bool { <nl> + if let lnw = lhs . nw , let rnw = rhs . nw { <nl> + return nw_path_is_equal ( lnw , rnw ) <nl> + } <nl> + return lhs . nw = = nil & & rhs . nw = = nil <nl> + } <nl> + } <nl> + <nl> + / / / The NWPathMonitor allows the caller to fetch the current global path ( or <nl> + / / / a path restricted to a specific network interface type ) . The path for the monitor <nl> + / / / is an observable property that will be updated upon each network change . <nl> + / / / Paths generated by a path monitor are not specific to a given endpoint , and <nl> + / / / will not have the localEndpoint or remoteEndpoint properties set . <nl> + / / / The paths will watch the state of multiple interfaces , and allows the <nl> + / / / application to enumerate the available interfaces for use in creating connections <nl> + / / / or listeners bound to specific interfaces . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public final class NWPathMonitor { <nl> + <nl> + / / / Access the current network path tracked by the monitor <nl> + public var currentPath = NWPath ( nil ) <nl> + fileprivate let nw : nw_path_monitor_t <nl> + <nl> + / / / Set a block to be called when the network path changes <nl> + private var _pathUpdateHandler : ( ( _ newPath : NWPath ) - > Void ) ? <nl> + public var pathUpdateHandler : ( ( _ newPath : NWPath ) - > Void ) ? { <nl> + set { <nl> + self . _pathUpdateHandler = newValue <nl> + } <nl> + get { <nl> + return self . _pathUpdateHandler <nl> + } <nl> + } <nl> + <nl> + / / / Start the path monitor and set a queue on which path updates <nl> + / / / will be delivered . <nl> + / / / Start should only be called once on a monitor , and multiple calls to start will <nl> + / / / be ignored . <nl> + public func start ( queue : DispatchQueue ) { <nl> + self . _queue = queue <nl> + nw_path_monitor_set_queue ( self . nw , queue ) <nl> + nw_path_monitor_start ( self . nw ) <nl> + } <nl> + <nl> + / / / Cancel the path monitor , after which point no more path updates will <nl> + / / / be delivered . <nl> + public func cancel ( ) { <nl> + nw_path_monitor_cancel ( self . nw ) <nl> + } <nl> + <nl> + private var _queue : DispatchQueue ? <nl> + <nl> + / / / Get queue used for delivering the pathUpdateHandler block . <nl> + / / / If the path monitor has not yet been started , the queue will be nil . Once the <nl> + / / / path monitor has been started , the queue will be valid . <nl> + public var queue : DispatchQueue ? { <nl> + get { <nl> + return self . _queue <nl> + } <nl> + } <nl> + <nl> + <nl> + / / / Create a network path monitor to monitor overall network state for the <nl> + / / / system . This allows enumeration of all interfaces that are available for <nl> + / / / general use by the application . <nl> + public init ( ) { <nl> + self . nw = nw_path_monitor_create ( ) <nl> + nw_path_monitor_set_update_handler ( self . nw ) { ( newPath ) in <nl> + self . currentPath = NWPath ( newPath ) <nl> + if let handler = self . _pathUpdateHandler { <nl> + handler ( self . currentPath ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / Create a network path monitor that watches a single interface type . <nl> + public init ( requiredInterfaceType : NWInterface . InterfaceType ) { <nl> + self . nw = nw_path_monitor_create_with_type ( requiredInterfaceType . nw ) <nl> + nw_path_monitor_set_update_handler ( self . nw ) { ( newPath ) in <nl> + self . currentPath = NWPath ( newPath ) <nl> + if let handler = self . _pathUpdateHandler { <nl> + handler ( self . currentPath ) <nl> + } <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 2aa54b3c2d58 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWProtocol . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + / / / NWProtocolDefinition is an abstract superclass that represents the identifier of a <nl> + / / / protocol that can be used with connections and listeners , such as TCP . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocolDefinition : Equatable , CustomDebugStringConvertible { <nl> + public static func = = ( lhs : NWProtocolDefinition , rhs : NWProtocolDefinition ) - > Bool { <nl> + return nw_protocol_definition_is_equal ( lhs . nw , rhs . nw ) <nl> + } <nl> + <nl> + / / / The name of the protocol , such as " TCP " or " UDP " <nl> + public let name : String <nl> + internal let nw : nw_protocol_definition_t <nl> + <nl> + internal init ( _ nw : nw_protocol_definition_t , _ name : String ) { <nl> + self . name = name <nl> + self . nw = nw <nl> + } <nl> + <nl> + public var debugDescription : String { <nl> + return self . name <nl> + } <nl> + } <nl> + <nl> + / / / NWProtocolOptions is an abtract superclass that represents a configuration options <nl> + / / / that can be used to add a protocol into an NWParameters . ProtocolStack . These options <nl> + / / / configure the behavior of a protocol and cannot be changed after starting a connection . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocolOptions { <nl> + internal let nw : nw_protocol_options_t <nl> + <nl> + <nl> + internal init ( _ nw : nw_protocol_options_t ) { <nl> + self . nw = nw <nl> + } <nl> + } <nl> + <nl> + / / / NWProtocolMetadata is an abtract superclass . An instance of metadata holds a set of <nl> + / / / protocol - specific metadata . This metadata allows clients to pass down protocol requirements <nl> + / / / specific to some content being sent ; as well as to retrieve metadata specific to some <nl> + / / / content that was received . Each protocol is responsible for defining its own accessor <nl> + / / / functions to set and get metadata . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocolMetadata { <nl> + internal let nw : nw_protocol_metadata_t <nl> + <nl> + internal init ( _ nw : nw_protocol_metadata_t ) { <nl> + self . nw = nw <nl> + } <nl> + } <nl> + <nl> + / / / NWProtocol is an abstract superclass to which protocol implementations conform . <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocol { <nl> + <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 0f2ce0f62586 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWProtocolIP . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocolIP : NWProtocol { <nl> + public static let definition : NWProtocolDefinition = { <nl> + NWProtocolDefinition ( nw_protocol_copy_ip_definition ( ) , " ip " ) <nl> + } ( ) <nl> + <nl> + public class Options : NWProtocolOptions { <nl> + public enum Version { <nl> + / / / Allow any IP version <nl> + case any <nl> + / / / Use only IP version 4 ( IPv4 ) <nl> + case v4 <nl> + / / / Use only IP version 6 ( IPv6 ) <nl> + case v6 <nl> + <nl> + internal var nw : nw_ip_version_t { <nl> + switch self { <nl> + case . v4 : <nl> + return Network . nw_ip_version_4 <nl> + case . v6 : <nl> + return Network . nw_ip_version_6 <nl> + default : <nl> + return Network . nw_ip_version_any <nl> + } <nl> + } <nl> + <nl> + internal init ( _ nw : nw_ip_version_t ) { <nl> + switch nw { <nl> + case Network . nw_ip_version_4 : <nl> + self = . v4 <nl> + case Network . nw_ip_version_6 : <nl> + self = . v6 <nl> + default : <nl> + self = . any <nl> + } <nl> + } <nl> + } <nl> + <nl> + private var _version : Version = . any <nl> + <nl> + / / / Specify a single version of the Internet NWProtocol to allow . <nl> + / / / Setting this value will constrain which address endpoints can <nl> + / / / be used , and will filter DNS results during connection establishement . <nl> + public var version : Version { <nl> + set { <nl> + self . _version = newValue <nl> + nw_ip_options_set_version ( self . nw , newValue . nw ) <nl> + } <nl> + get { <nl> + return self . _version <nl> + } <nl> + } <nl> + <nl> + private var _hopLimit : UInt8 = 0 <nl> + <nl> + / / / Configure the IP hop limit , equivalent to IP_TTL for IPv4 <nl> + / / / and IPV6_HOPLIMIT for IPv6 . <nl> + public var hopLimit : UInt8 { <nl> + set { <nl> + self . _hopLimit = newValue <nl> + nw_ip_options_set_hop_limit ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _hopLimit <nl> + } <nl> + } <nl> + <nl> + private var _useMinimumMTU : Bool = false <nl> + <nl> + / / / Configure IP to use the minimum MTU value , which <nl> + / / / is 1280 bytes for IPv6 ( IPV6_USE_MIN_MTU ) . This value has <nl> + / / / no effect for IPv4 . <nl> + public var useMinimumMTU : Bool { <nl> + set { <nl> + self . _useMinimumMTU = newValue <nl> + nw_ip_options_set_use_minimum_mtu ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _useMinimumMTU <nl> + } <nl> + } <nl> + <nl> + private var _disableFragmentation : Bool = false <nl> + <nl> + / / / Configure IP to disable fragmentation on outgoing <nl> + / / / packets ( IPV6_DONTFRAG ) . This value has no effect <nl> + / / / for IPv4 . <nl> + public var disableFragmentation : Bool { <nl> + set { <nl> + self . _disableFragmentation = newValue <nl> + nw_ip_options_set_disable_fragmentation ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _disableFragmentation <nl> + } <nl> + } <nl> + <nl> + override internal init ( _ nw : nw_protocol_options_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + } <nl> + <nl> + / / / Values for Explicit Congestion Notification flags <nl> + public enum ECN { <nl> + / / / Non ECN - Capable Transport <nl> + case nonECT <nl> + / / / ECN Capable Transport ( 0 ) <nl> + case ect0 <nl> + / / / ECN Capable Transport ( 1 ) <nl> + case ect1 <nl> + / / / Congestion Experienced <nl> + case ce <nl> + <nl> + fileprivate init ( _ nw : nw_ip_ecn_flag_t ) { <nl> + switch nw { <nl> + case Network . nw_ip_ecn_flag_non_ect : <nl> + self = . nonECT <nl> + case Network . nw_ip_ecn_flag_ect_0 : <nl> + self = . ect0 <nl> + case Network . nw_ip_ecn_flag_ect_1 : <nl> + self = . ect1 <nl> + case Network . nw_ip_ecn_flag_ce : <nl> + self = . ce <nl> + default : <nl> + self = . nonECT <nl> + } <nl> + } <nl> + <nl> + fileprivate var nw : nw_ip_ecn_flag_t { <nl> + switch self { <nl> + case . nonECT : <nl> + return Network . nw_ip_ecn_flag_non_ect <nl> + case . ect0 : <nl> + return Network . nw_ip_ecn_flag_ect_0 <nl> + case . ect1 : <nl> + return Network . nw_ip_ecn_flag_ect_1 <nl> + case . ce : <nl> + return Network . nw_ip_ecn_flag_ce <nl> + } <nl> + } <nl> + } <nl> + <nl> + / / / IP Metadata can be sent or received as part of ContentContext <nl> + public class Metadata : NWProtocolMetadata { <nl> + / / / Set ECN flags to be sent on a packet , or get ECN flags <nl> + / / / received on a packet . These flags will not take effect <nl> + / / / for protocols such as TCP that deliver data without accounting <nl> + / / / for packet boundaries . <nl> + public var ecn : ECN { <nl> + set { <nl> + nw_ip_metadata_set_ecn_flag ( nw , newValue . nw ) <nl> + } <nl> + get { <nl> + return ECN ( nw_ip_metadata_get_ecn_flag ( nw ) ) <nl> + } <nl> + } <nl> + <nl> + / / / Set the network service class to be sent on a packet . The per - packet <nl> + / / / service class will not take effect for protocols such as TCP that deliver <nl> + / / / data without accounting for packet boundaries . If you need to set <nl> + / / / service class for TCP , use the serviceClass property of NWParameters . <nl> + public var serviceClass : NWParameters . ServiceClass { <nl> + set { <nl> + nw_ip_metadata_set_service_class ( nw , newValue . nw ) <nl> + } <nl> + get { <nl> + return NWParameters . ServiceClass ( nw_ip_metadata_get_service_class ( nw ) ) <nl> + } <nl> + } <nl> + <nl> + override internal init ( _ nw : nw_protocol_metadata_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + <nl> + / / / Create an empty IP metadata to send with ContentContext <nl> + public init ( ) { <nl> + super . init ( nw_ip_create_metadata ( ) ) <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . d85d5d727e3e <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWProtocolTCP . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocolTCP : NWProtocol { <nl> + public static let definition : NWProtocolDefinition = { <nl> + NWProtocolDefinition ( nw_protocol_copy_tcp_definition ( ) , " tcp " ) <nl> + } ( ) <nl> + <nl> + public class Options : NWProtocolOptions { <nl> + <nl> + private var _noDelay : Bool = false <nl> + <nl> + / / / A boolean indicating that TCP should disable <nl> + / / / Nagle ' s algorithm ( TCP_NODELAY ) . <nl> + public var noDelay : Bool { <nl> + set { <nl> + self . _noDelay = newValue <nl> + nw_tcp_options_set_no_delay ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _noDelay <nl> + } <nl> + } <nl> + <nl> + private var _noPush : Bool = false <nl> + <nl> + / / / A boolean indicating that TCP should be set into <nl> + / / / no - push mode ( TCP_NOPUSH ) . <nl> + public var noPush : Bool { <nl> + set { <nl> + self . _noPush = newValue <nl> + nw_tcp_options_set_no_push ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _noPush <nl> + } <nl> + } <nl> + <nl> + private var _noOptions : Bool = false <nl> + <nl> + / / / A boolean indicating that TCP should be set into <nl> + / / / no - options mode ( TCP_NOOPT ) . <nl> + public var noOptions : Bool { <nl> + set { <nl> + self . _noOptions = newValue <nl> + nw_tcp_options_set_no_options ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _noOptions <nl> + } <nl> + } <nl> + <nl> + private var _enableKeepalive : Bool = false <nl> + <nl> + / / / A boolean indicating that TCP should send keepalives <nl> + / / / ( SO_KEEPALIVE ) . <nl> + public var enableKeepalive : Bool { <nl> + set { <nl> + self . _enableKeepalive = newValue <nl> + nw_tcp_options_set_enable_keepalive ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _enableKeepalive <nl> + } <nl> + } <nl> + <nl> + private var _keepaliveCount : Int = 0 <nl> + <nl> + / / / The number of keepalive probes to send before terminating <nl> + / / / the connection ( TCP_KEEPCNT ) . <nl> + public var keepaliveCount : Int { <nl> + set { <nl> + self . _keepaliveCount = newValue <nl> + nw_tcp_options_set_keepalive_count ( self . nw , UInt32 ( newValue ) ) <nl> + } <nl> + get { <nl> + return self . _keepaliveCount <nl> + } <nl> + } <nl> + <nl> + private var _keepaliveIdle : Int = 0 <nl> + <nl> + / / / The number of seconds of idleness to wait before keepalive <nl> + / / / probes are sent by TCP ( TCP_KEEPALIVE ) . <nl> + public var keepaliveIdle : Int { <nl> + set { <nl> + self . _keepaliveIdle = newValue <nl> + nw_tcp_options_set_keepalive_idle_time ( self . nw , UInt32 ( newValue ) ) <nl> + } <nl> + get { <nl> + return self . _keepaliveIdle <nl> + } <nl> + } <nl> + <nl> + private var _keepaliveInterval : Int = 0 <nl> + <nl> + / / / The number of seconds of to wait before resending TCP <nl> + / / / keepalive probes ( TCP_KEEPINTVL ) . <nl> + public var keepaliveInterval : Int { <nl> + set { <nl> + self . _keepaliveInterval = newValue <nl> + nw_tcp_options_set_keepalive_interval ( self . nw , UInt32 ( newValue ) ) <nl> + } <nl> + get { <nl> + return self . _keepaliveInterval <nl> + } <nl> + } <nl> + <nl> + private var _maximumSegmentSize : Int = 0 <nl> + <nl> + / / / The maximum segment size in bytes ( TCP_MAXSEG ) . <nl> + public var maximumSegmentSize : Int { <nl> + set { <nl> + self . _maximumSegmentSize = newValue <nl> + nw_tcp_options_set_maximum_segment_size ( self . nw , UInt32 ( newValue ) ) <nl> + } <nl> + get { <nl> + return self . _maximumSegmentSize <nl> + } <nl> + } <nl> + <nl> + private var _connectionTimeout : Int = 0 <nl> + <nl> + / / / A timeout for TCP connection establishment , in seconds <nl> + / / / ( TCP_CONNECTIONTIMEOUT ) . <nl> + public var connectionTimeout : Int { <nl> + set { <nl> + self . _connectionTimeout = newValue <nl> + nw_tcp_options_set_connection_timeout ( self . nw , UInt32 ( newValue ) ) <nl> + } <nl> + get { <nl> + return self . _connectionTimeout <nl> + } <nl> + } <nl> + <nl> + private var _persistTimeout : Int = 0 <nl> + <nl> + / / / The TCP persist timeout , in seconds ( PERSIST_TIMEOUT ) . <nl> + / / / See RFC 6429 . <nl> + public var persistTimeout : Int { <nl> + set { <nl> + self . _persistTimeout = newValue <nl> + nw_tcp_options_set_persist_timeout ( self . nw , UInt32 ( newValue ) ) <nl> + } <nl> + get { <nl> + return self . _persistTimeout <nl> + } <nl> + } <nl> + <nl> + private var _connectionDropTime : Int = 0 <nl> + <nl> + / / / A timeout for TCP retransmission attempts , in seconds <nl> + / / / ( TCP_RXT_CONNDROPTIME ) . <nl> + public var connectionDropTime : Int { <nl> + set { <nl> + self . _connectionDropTime = newValue <nl> + nw_tcp_options_set_retransmit_connection_drop_time ( self . nw , UInt32 ( newValue ) ) <nl> + } <nl> + get { <nl> + return self . _connectionDropTime <nl> + } <nl> + } <nl> + <nl> + private var _retransmitFinDrop : Bool = false <nl> + <nl> + / / / A boolean to cause TCP to drop its connection after <nl> + / / / not receiving an ACK after a FIN ( TCP_RXT_FINDROP ) . <nl> + public var retransmitFinDrop : Bool { <nl> + set { <nl> + self . _retransmitFinDrop = newValue <nl> + nw_tcp_options_set_retransmit_fin_drop ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _retransmitFinDrop <nl> + } <nl> + } <nl> + <nl> + private var _disableAckStretching : Bool = false <nl> + <nl> + / / / A boolean to cause TCP to disable ACK stretching ( TCP_SENDMOREACKS ) . <nl> + public var disableAckStretching : Bool { <nl> + set { <nl> + self . _disableAckStretching = newValue <nl> + nw_tcp_options_set_disable_ack_stretching ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _disableAckStretching <nl> + } <nl> + } <nl> + <nl> + private var _enableFastOpen : Bool = false <nl> + <nl> + / / / Configure TCP to enable TCP Fast Open ( TFO ) . This may take effect <nl> + / / / even when TCP is not the top - level protocol in the protocol stack . <nl> + / / / For example , if TLS is running over TCP , the Client Hello message <nl> + / / / may be sent as fast open data . <nl> + / / / <nl> + / / / If TCP is the top - level protocol in the stack ( the one the application <nl> + / / / directly interacts with ) , TFO will be disabled unless the application <nl> + / / / indicated that it will provide its own fast open data by calling <nl> + / / / NWParameters . allowFastOpen . <nl> + public var enableFastOpen : Bool { <nl> + set { <nl> + self . _enableFastOpen = newValue <nl> + nw_tcp_options_set_enable_fast_open ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _enableFastOpen <nl> + } <nl> + } <nl> + <nl> + private var _disableECN : Bool = false <nl> + <nl> + / / / A boolean to disable ECN negotiation in TCP . <nl> + public var disableECN : Bool { <nl> + set { <nl> + self . _disableECN = newValue <nl> + nw_tcp_options_set_disable_ecn ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _disableECN <nl> + } <nl> + } <nl> + <nl> + / / / Create TCP options to set in an NWParameters . ProtocolStack <nl> + public init ( ) { <nl> + super . init ( nw_tcp_create_options ( ) ) <nl> + } <nl> + <nl> + override internal init ( _ nw : nw_protocol_options_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + } <nl> + <nl> + / / / Access TCP metadata using NWConnection . metadata ( protocolDefinition : NWProtocolTCP . definition ) <nl> + / / / or in received ContentContext <nl> + public class Metadata : NWProtocolMetadata { <nl> + override internal init ( _ nw : nw_protocol_metadata_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + <nl> + / / / Access the current number of bytes in TCP ' s receive buffer ( SO_NREAD ) . <nl> + public var availableReceiveBuffer : UInt32 { <nl> + get { <nl> + return nw_tcp_get_available_receive_buffer ( self . nw ) <nl> + } <nl> + } <nl> + <nl> + / / / Access the current number of bytes in TCP ' s send buffer ( SO_NWRITE ) . <nl> + public var availableSendBuffer : UInt32 { <nl> + get { <nl> + return nw_tcp_get_available_send_buffer ( self . nw ) <nl> + } <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . e929bfbaf84e <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWProtocolTLS . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocolTLS : NWProtocol { <nl> + public static let definition : NWProtocolDefinition = { <nl> + NWProtocolDefinition ( nw_protocol_copy_tls_definition ( ) , " tls " ) <nl> + } ( ) <nl> + <nl> + public class Options : NWProtocolOptions { <nl> + / / / Access the sec_protocol_options_t for a given network protocol <nl> + / / / options instance . See < Security / SecProtocolOptions . h > for functions <nl> + / / / to futher configure security options . <nl> + public var securityProtocolOptions : sec_protocol_options_t { <nl> + return nw_tls_copy_sec_protocol_options ( self . nw ) <nl> + } <nl> + <nl> + / / / Create TLS options to set in an NWParameters . ProtocolStack <nl> + public init ( ) { <nl> + super . init ( nw_tls_create_options ( ) ) <nl> + } <nl> + <nl> + override internal init ( _ nw : nw_protocol_options_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + } <nl> + <nl> + / / / Access TLS metadata using NWConnection . metadata ( protocolDefinition : NWProtocolTLS . definition ) <nl> + / / / or in received ContentContext <nl> + public class Metadata : NWProtocolMetadata { <nl> + / / / Access the sec_protocol_metadata_t for a given network protocol <nl> + / / / metadata instance . See < Security / SecProtocolMetadata . h > for functions <nl> + / / / to futher access security metadata . <nl> + public var securityProtocolMetadata : sec_protocol_metadata_t { <nl> + return nw_tls_copy_sec_protocol_metadata ( self . nw ) <nl> + } <nl> + <nl> + override internal init ( _ nw : nw_protocol_metadata_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . fe77087e8d74 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / NWProtocolUDP . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public class NWProtocolUDP : NWProtocol { <nl> + public static let definition : NWProtocolDefinition = { <nl> + NWProtocolDefinition ( nw_protocol_copy_udp_definition ( ) , " udp " ) <nl> + } ( ) <nl> + <nl> + public class Options : NWProtocolOptions { <nl> + <nl> + private var _preferNoChecksum : Bool = false <nl> + <nl> + / / / Configure UDP to skip computing checksums when sending . <nl> + / / / This will only take effect when running over IPv4 ( UDP_NOCKSUM ) . <nl> + public var preferNoChecksum : Bool { <nl> + set { <nl> + self . _preferNoChecksum = newValue <nl> + nw_udp_options_set_prefer_no_checksum ( self . nw , newValue ) <nl> + } <nl> + get { <nl> + return self . _preferNoChecksum <nl> + } <nl> + } <nl> + <nl> + / / / Create UDP options to set in an NWParameters . ProtocolStack <nl> + public init ( ) { <nl> + super . init ( nw_udp_create_options ( ) ) <nl> + } <nl> + <nl> + override internal init ( _ nw : nw_protocol_options_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + } <nl> + <nl> + public class Metadata : NWProtocolMetadata { <nl> + override internal init ( _ nw : nw_protocol_metadata_t ) { <nl> + super . init ( nw ) <nl> + } <nl> + <nl> + / / / Create an empty UDP metadata to send with ContentContext <nl> + public init ( ) { <nl> + super . init ( nw_udp_create_metadata ( ) ) <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 53172f56eb03 <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / Network / Network . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import Network <nl> mmm a / stdlib / public / SDK / UIKit / UIKit . swift <nl> ppp b / stdlib / public / SDK / UIKit / UIKit . swift <nl> import _SwiftUIKitOverlayShims <nl> / / UIGeometry <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - public extension UIEdgeInsets { <nl> - static var zero : UIEdgeInsets { <nl> + extension UIEdgeInsets { <nl> + @ available ( swift , obsoleted : 4 . 2 ) / / in 4 . 2 it is provided by the apinotes <nl> + public static var zero : UIEdgeInsets { <nl> @ _transparent / / @ fragile <nl> get { return UIEdgeInsets ( top : 0 . 0 , left : 0 . 0 , bottom : 0 . 0 , right : 0 . 0 ) } <nl> } <nl> } <nl> <nl> - public extension UIOffset { <nl> - static var zero : UIOffset { <nl> + extension UIOffset { <nl> + @ available ( swift , obsoleted : 4 . 2 ) / / in 4 . 2 it is provided by the apinotes <nl> + public static var zero : UIOffset { <nl> @ _transparent / / @ fragile <nl> get { return UIOffset ( horizontal : 0 . 0 , vertical : 0 . 0 ) } <nl> } <nl> } <nl> <nl> - / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> - / / Equatable types . <nl> - / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> - <nl> extension UIEdgeInsets : Equatable { <nl> @ _transparent / / @ fragile <nl> public static func = = ( lhs : UIEdgeInsets , rhs : UIEdgeInsets ) - > Bool { <nl> extension UIEdgeInsets : Equatable { <nl> } <nl> } <nl> <nl> + @ available ( iOS 11 . 0 , tvOS 11 . 0 , watchOS 4 . 0 , * ) <nl> + extension NSDirectionalEdgeInsets : Equatable { <nl> + @ _transparent / / @ fragile <nl> + public static func = = ( lhs : NSDirectionalEdgeInsets , rhs : NSDirectionalEdgeInsets ) - > Bool { <nl> + return lhs . top = = rhs . top & & <nl> + lhs . leading = = rhs . leading & & <nl> + lhs . bottom = = rhs . bottom & & <nl> + lhs . trailing = = rhs . trailing <nl> + } <nl> + } <nl> + <nl> extension UIOffset : Equatable { <nl> @ _transparent / / @ fragile <nl> public static func = = ( lhs : UIOffset , rhs : UIOffset ) - > Bool { <nl> extension UIOffset : Equatable { <nl> } <nl> } <nl> <nl> + # if os ( iOS ) | | os ( tvOS ) <nl> + extension UIFloatRange : Equatable { <nl> + @ _transparent / / @ fragile <nl> + public static func = = ( lhs : UIFloatRange , rhs : UIFloatRange ) - > Bool { <nl> + return lhs . minimum = = rhs . minimum & & <nl> + lhs . maximum = = rhs . maximum <nl> + } <nl> + } <nl> + # endif <nl> + <nl> + @ available ( swift , deprecated : 4 . 2 , message : " Use = = operator instead . " ) <nl> + public func UIEdgeInsetsEqualToEdgeInsets ( _ insets1 : UIEdgeInsets , _ insets2 : UIEdgeInsets ) - > Bool { <nl> + return insets1 = = insets2 <nl> + } <nl> + <nl> + @ available ( swift , deprecated : 4 . 2 , message : " Use = = operator instead . " ) <nl> + public func UIOffsetEqualToOffset ( _ offset1 : UIOffset , _ offset2 : UIOffset ) - > Bool { <nl> + return offset1 = = offset2 <nl> + } <nl> + <nl> + # if os ( iOS ) | | os ( tvOS ) <nl> + @ available ( swift , deprecated : 4 . 2 , message : " Use = = operator instead . " ) <nl> + public func UIFloatRangeIsEqualToRange ( _ range : UIFloatRange , _ otherRange : UIFloatRange ) - > Bool { <nl> + return range = = otherRange <nl> + } <nl> + # endif <nl> + <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> / / Numeric backed types <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> extension UILayoutPriority : _UIKitNumericRawRepresentable { } <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> # if ! os ( watchOS ) & & ! os ( tvOS ) <nl> - public extension UIDeviceOrientation { <nl> - var isLandscape : Bool { <nl> - return self = = . landscapeLeft | | self = = . landscapeRight <nl> - } <nl> - <nl> - var isPortrait : Bool { <nl> - return self = = . portrait | | self = = . portraitUpsideDown <nl> - } <nl> - <nl> - var isFlat : Bool { <nl> - return self = = . faceUp | | self = = . faceDown <nl> - } <nl> - <nl> - var isValidInterfaceOrientation : Bool { <nl> - switch self { <nl> - case . portrait , . portraitUpsideDown , . landscapeLeft , . landscapeRight : <nl> - return true <nl> - default : <nl> - return false <nl> - } <nl> - } <nl> - } <nl> - <nl> + @ available ( swift , obsoleted : 4 . 2 , <nl> + renamed : " getter : UIDeviceOrientation . isLandscape ( self : ) " ) <nl> public func UIDeviceOrientationIsLandscape ( <nl> _ orientation : UIDeviceOrientation <nl> ) - > Bool { <nl> return orientation . isLandscape <nl> } <nl> <nl> + @ available ( swift , obsoleted : 4 . 2 , <nl> + renamed : " getter : UIDeviceOrientation . isPortrait ( self : ) " ) <nl> public func UIDeviceOrientationIsPortrait ( <nl> _ orientation : UIDeviceOrientation <nl> ) - > Bool { <nl> return orientation . isPortrait <nl> } <nl> <nl> + @ available ( swift , obsoleted : 4 . 2 , <nl> + renamed : " getter : UIDeviceOrientation . isValidInterfaceOrientation ( self : ) " ) <nl> public func UIDeviceOrientationIsValidInterfaceOrientation ( <nl> - _ orientation : UIDeviceOrientation ) - > Bool <nl> - { <nl> + _ orientation : UIDeviceOrientation <nl> + ) - > Bool { <nl> return orientation . isValidInterfaceOrientation <nl> } <nl> # endif <nl> public func UIDeviceOrientationIsValidInterfaceOrientation ( <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> # if ! os ( watchOS ) & & ! os ( tvOS ) <nl> - public extension UIInterfaceOrientation { <nl> - var isLandscape : Bool { <nl> - return self = = . landscapeLeft | | self = = . landscapeRight <nl> - } <nl> - <nl> - var isPortrait : Bool { <nl> - return self = = . portrait | | self = = . portraitUpsideDown <nl> - } <nl> - } <nl> - <nl> + @ available ( swift , obsoleted : 4 . 2 , <nl> + renamed : " getter : UIInterfaceOrientation . isPortrait ( self : ) " ) <nl> public func UIInterfaceOrientationIsPortrait ( <nl> - _ orientation : UIInterfaceOrientation ) - > Bool { <nl> + _ orientation : UIInterfaceOrientation <nl> + ) - > Bool { <nl> return orientation . isPortrait <nl> } <nl> <nl> + @ available ( swift , obsoleted : 4 . 2 , <nl> + renamed : " getter : UIInterfaceOrientation . isLandscape ( self : ) " ) <nl> public func UIInterfaceOrientationIsLandscape ( <nl> _ orientation : UIInterfaceOrientation <nl> ) - > Bool { <nl> extension UIPasteboard { <nl> } <nl> <nl> # endif <nl> + <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / UIPrintError compatibility <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # if os ( iOS ) <nl> + <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " UIPrintError . Code . notAvailable . rawValue " ) <nl> + public let UIPrintingNotAvailableError = 1 <nl> + <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " UIPrintError . Code . noContent . rawValue " ) <nl> + public let UIPrintNoContentError = 2 <nl> + <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " UIPrintError . Code . unknownImageFormat . rawValue " ) <nl> + public let UIPrintUnknownImageFormatError = 3 <nl> + <nl> + @ available ( swift , obsoleted : 4 . 2 , renamed : " UIPrintError . Code . jobFailed . rawValue " ) <nl> + public let UIPrintJobFailedError = 4 <nl> + <nl> + # endif <nl> mmm a / stdlib / public / SDK / os / CMakeLists . txt <nl> ppp b / stdlib / public / SDK / os / CMakeLists . txt <nl> cmake_minimum_required ( VERSION 3 . 4 . 3 ) <nl> include ( " . . / . . / . . / . . / cmake / modules / StandaloneOverlay . cmake " ) <nl> <nl> add_swift_library ( swiftos $ { SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES } IS_SDK_OVERLAY <nl> + os . m <nl> os_log . swift <nl> - os_log . m <nl> + os_signpost . swift <nl> os_trace_blob . c <nl> thunks . mm <nl> <nl> similarity index 70 % <nl> rename from stdlib / public / SDK / os / os_log . m <nl> rename to stdlib / public / SDK / os / os . m <nl> mmm a / stdlib / public / SDK / os / os_log . m <nl> ppp b / stdlib / public / SDK / os / os . m <nl> <nl> # include < TargetConditionals . h > <nl> # include < Availability . h > <nl> # include < CoreFoundation / CoreFoundation . h > <nl> + # include < Foundation / Foundation . h > <nl> # include < dlfcn . h > <nl> # include < dispatch / dispatch . h > <nl> # include < os / base . h > <nl> # include < os / log . h > <nl> + # include < os / signpost . h > <nl> # include < objc / runtime . h > <nl> # include < wchar . h > <nl> <nl> <nl> uint8_t * <nl> _os_log_pack_fill ( os_log_pack_t pack , size_t size , int saved_errno , const void * dso , const char * fmt ) ; <nl> <nl> + API_AVAILABLE ( macosx ( 10 . 14 ) , ios ( 12 . 0 ) , tvos ( 12 . 0 ) , watchos ( 5 . 0 ) ) <nl> + uint8_t * <nl> + _os_signpost_pack_fill ( os_log_pack_t pack , size_t size , <nl> + int saved_errno , const void * dso , const char * fmt , <nl> + const char * spnm , os_signpost_id_t spid ) ; <nl> + <nl> API_AVAILABLE ( macosx ( 10 . 12 . 4 ) , ios ( 10 . 3 ) , tvos ( 10 . 2 ) , watchos ( 3 . 2 ) ) <nl> void <nl> os_log_pack_send ( os_log_pack_t pack , os_log_t log , os_log_type_t type ) ; <nl> <nl> + API_AVAILABLE ( macosx ( 10 . 14 ) , ios ( 12 . 0 ) , tvos ( 12 . 0 ) , watchos ( 5 . 0 ) ) <nl> + void <nl> + _os_signpost_pack_send ( os_log_pack_t pack , os_log_t h , <nl> + os_signpost_type_t spty ) ; <nl> + <nl> static inline void <nl> _os_log_encode_arg ( os_trace_blob_t ob , os_log_fmt_cmd_t cmd , const void * data ) <nl> { <nl> <nl> } <nl> <nl> static bool <nl> - _os_log_encode ( char buf [ OS_LOG_FMT_BUF_SIZE ] , const char * format , va_list args , int saved_errno , os_trace_blob_t ob ) <nl> + _os_log_encode ( char buf [ OS_LOG_FMT_BUF_SIZE ] , const char * format , va_list args , <nl> + int saved_errno , os_trace_blob_t ob ) <nl> { <nl> os_log_fmt_hdr_s hdr = { } ; <nl> os_trace_blob_add ( ob , & hdr , sizeof ( hdr ) ) ; <nl> <nl> } <nl> break ; <nl> <nl> + # define encode_nsstring ( ) ( { \ <nl> + NSString * __arg = va_arg ( args , NSString * ) ; \ <nl> + const char * _Nullable __var = __arg . UTF8String ; \ <nl> + cmd . cmd_size = sizeof ( __var ) ; \ <nl> + _os_log_encode_arg ( ob , & cmd , & __var ) ; \ <nl> + hdr . hdr_cmd_cnt + + ; \ <nl> + } ) <nl> + <nl> # define encode_smallint ( ty ) ( { \ <nl> int __var = va_arg ( args , int ) ; \ <nl> cmd . cmd_size = sizeof ( __var ) ; \ <nl> _os_log_encode_arg ( ob , & cmd , & __var ) ; \ <nl> - hdr . hdr_cmd_cnt + + ; } ) <nl> + hdr . hdr_cmd_cnt + + ; \ <nl> + } ) <nl> <nl> # define encode ( ty ) ( { \ <nl> ty __var = va_arg ( args , ty ) ; \ <nl> cmd . cmd_size = sizeof ( __var ) ; \ <nl> _os_log_encode_arg ( ob , & cmd , & __var ) ; \ <nl> - hdr . hdr_cmd_cnt + + ; } ) <nl> + hdr . hdr_cmd_cnt + + ; \ <nl> + } ) <nl> <nl> / * fixed types * / <nl> case ' c ' : / / char <nl> <nl> done = true ; <nl> break ; <nl> <nl> + case ' C ' : / / wchar is treated like % lc <nl> + cmd . cmd_type = OSLF_CMD_TYPE_SCALAR ; <nl> + encode_smallint ( wint_t ) ; <nl> + done = true ; <nl> + break ; <nl> + <nl> case ' P ' : / / pointer data <nl> if ( precision > 0 ) { / / only encode a pointer if we have been given a length <nl> hdr . hdr_flags | = OSLF_HDR_FLAG_HAS_NON_SCALAR ; <nl> <nl> done = true ; <nl> break ; <nl> <nl> - # if 0 <nl> - case ' C ' : / / wide - char <nl> - value . type . wch = va_arg ( args , wint_t ) ; <nl> - _os_log_encode_arg ( & value . type . wch , sizeof ( value . type . wch ) , OS_LOG_BUFFER_VALUE_TYPE_SCALAR , flags , context ) ; <nl> - done = true ; <nl> - break ; <nl> - # endif <nl> - <nl> - # if 0 <nl> - / / String types get sent from Swift as NSString objects . <nl> - case ' s ' : / / string <nl> - value . type . pch = va_arg ( args , char * ) ; <nl> - context - > buffer - > flags | = OS_LOG_BUFFER_HAS_NON_SCALAR ; <nl> - _os_log_encode_arg ( & value . type . pch , sizeof ( value . type . pch ) , OS_LOG_BUFFER_VALUE_TYPE_STRING , flags , context ) ; <nl> - prec = 0 ; <nl> + case ' s ' : / / Strings sent from Swift as NSString objects <nl> + hdr . hdr_flags | = OSLF_HDR_FLAG_HAS_NON_SCALAR ; <nl> + cmd . cmd_type = OSLF_CMD_TYPE_STRING ; <nl> + encode_nsstring ( ) ; <nl> + precision = 0 ; <nl> done = true ; <nl> break ; <nl> - # endif <nl> <nl> case ' @ ' : / / CFTypeRef aka NSObject * <nl> hdr . hdr_flags | = OSLF_HDR_FLAG_HAS_NON_SCALAR ; <nl> <nl> return true ; <nl> } <nl> <nl> + # undef encode_nsstring <nl> # undef encode_smallint <nl> # undef encode <nl> <nl> + __attribute__ ( ( __visibility__ ( " default " ) ) ) <nl> + void * <nl> + _swift_os_log_return_address ( void ) <nl> + { <nl> + return __builtin_return_address ( 1 ) ; <nl> + } <nl> + <nl> __attribute__ ( ( __visibility__ ( " default " ) ) ) <nl> void <nl> - _swift_os_log ( void * dso , void * retaddr , os_log_t oslog , os_log_type_t type , const char * format , va_list args ) <nl> + _swift_os_log ( <nl> + const void * _Nullable dso , <nl> + const void * _Nullable ra , <nl> + os_log_t _Nonnull h , <nl> + os_log_type_t type , <nl> + const char * _Nonnull fmt , <nl> + va_list args ) <nl> { <nl> int saved_errno = errno ; / / % m <nl> char buf [ OS_LOG_FMT_BUF_SIZE ] ; <nl> <nl> . ob_binary = true <nl> } ; <nl> <nl> - if ( _os_log_encode ( buf , format , args , saved_errno , & ob ) ) { <nl> - / / Use os_log_pack_send where available . <nl> + if ( _os_log_encode ( buf , fmt , args , saved_errno , & ob ) ) { <nl> if ( os_log_pack_send ) { <nl> size_t sz = _os_log_pack_size ( ob . ob_len ) ; <nl> - union { os_log_pack_s pack ; uint8_t buf [ OS_LOG_FMT_BUF_SIZE + sizeof ( os_log_pack_s ) ] ; } u ; <nl> - / / _os_log_encode has already packed ` saved_errno ` into a OSLF_CMD_TYPE_SCALAR command <nl> - / / as the OSLF_CMD_TYPE_ERRNO does not deploy backwards , so passes zero for errno here . <nl> - uint8_t * ptr = _os_log_pack_fill ( & u . pack , sz , 0 , dso , format ) ; <nl> - u . pack . olp_pc = retaddr ; <nl> + union { <nl> + os_log_pack_s pack ; <nl> + uint8_t buf [ OS_LOG_FMT_BUF_SIZE + sizeof ( os_log_pack_s ) ] ; <nl> + } u ; <nl> + / * <nl> + * _os_log_encode has already packed ` saved_errno ` into a <nl> + * OSLF_CMD_TYPE_SCALAR command as the OSLF_CMD_TYPE_ERRNO does not <nl> + * deploy backwards , so pass zero for errno here . <nl> + * / <nl> + uint8_t * ptr = _os_log_pack_fill ( & u . pack , sz , 0 , dso , fmt ) ; <nl> + u . pack . olp_pc = ra ; <nl> memcpy ( ptr , buf , ob . ob_len ) ; <nl> - os_log_pack_send ( & u . pack , oslog , type ) ; <nl> + os_log_pack_send ( & u . pack , h , type ) ; <nl> } else { <nl> - _os_log_impl ( dso , oslog , type , format , ( uint8_t * ) buf , ob . ob_len ) ; <nl> + _os_log_impl ( ( void * ) dso , h , type , fmt , ( uint8_t * ) buf , ob . ob_len ) ; <nl> } <nl> } <nl> } <nl> <nl> + API_AVAILABLE ( macosx ( 10 . 14 ) , ios ( 12 . 0 ) , tvos ( 12 . 0 ) , watchos ( 5 . 0 ) ) <nl> __attribute__ ( ( __visibility__ ( " default " ) ) ) <nl> - void * <nl> - _swift_os_log_return_address ( void ) <nl> + void <nl> + _swift_os_signpost_with_format ( <nl> + const void * _Nullable dso , <nl> + const void * _Nullable ra , <nl> + os_log_t _Nonnull h , <nl> + os_signpost_type_t spty , <nl> + const char * _Nonnull spnm , <nl> + os_signpost_id_t spid , <nl> + const char * _Nullable fmt , <nl> + va_list args ) <nl> { <nl> - return __builtin_return_address ( 1 ) ; <nl> + int saved_errno = errno ; / / % m <nl> + char buf [ OS_LOG_FMT_BUF_SIZE ] ; <nl> + os_trace_blob_s ob = { <nl> + . ob_s = buf , <nl> + . ob_size = OS_LOG_FMT_BUF_SIZE , <nl> + . ob_maxsize = OS_LOG_FMT_BUF_SIZE , <nl> + . ob_binary = true <nl> + } ; <nl> + <nl> + / * <nl> + * Signposts with a signpost name but no message / arguments are valid ; <nl> + * the underlying encode / pack / decode infrastructure agrees to treat <nl> + * these like having an empty format string . <nl> + * / <nl> + bool encoded = fmt = = NULL ? <nl> + _os_log_encode ( buf , " " , args , saved_errno , & ob ) : <nl> + _os_log_encode ( buf , fmt , args , saved_errno , & ob ) ; <nl> + if ( encoded ) { <nl> + size_t sz = _os_log_pack_size ( ob . ob_len ) ; <nl> + union { <nl> + os_log_pack_s pack ; <nl> + uint8_t buf [ OS_LOG_FMT_BUF_SIZE + sizeof ( os_log_pack_s ) ] ; <nl> + } u ; <nl> + uint8_t * ptr = _os_signpost_pack_fill ( & u . pack , sz , saved_errno , dso , <nl> + fmt , spnm , spid ) ; <nl> + u . pack . olp_pc = ra ; <nl> + memcpy ( ptr , buf , ob . ob_len ) ; <nl> + _os_signpost_pack_send ( & u . pack , h , spty ) ; <nl> + } <nl> } <nl> <nl> + API_AVAILABLE ( macosx ( 10 . 14 ) , ios ( 12 . 0 ) , tvos ( 12 . 0 ) , watchos ( 5 . 0 ) ) <nl> + __attribute__ ( ( __visibility__ ( " default " ) ) ) <nl> + void <nl> + _swift_os_signpost ( <nl> + const void * _Nullable dso , <nl> + const void * _Nullable ra , <nl> + os_log_t _Nonnull h , <nl> + os_signpost_type_t spty , <nl> + const char * _Nonnull spnm , <nl> + os_signpost_id_t spid ) <nl> + { <nl> + va_list x ; <nl> + _swift_os_signpost_with_format ( dso , ra , h , spty , spnm , spid , NULL , x ) ; <nl> + } <nl> mmm a / stdlib / public / SDK / os / os_log . swift <nl> ppp b / stdlib / public / SDK / os / os_log . swift <nl> <nl> @ _exported import os . log <nl> import _SwiftOSOverlayShims <nl> <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public func os_log ( <nl> + _ type : OSLogType , <nl> + dso : UnsafeRawPointer = # dsohandle , <nl> + log : OSLog = . default , <nl> + _ message : StaticString , <nl> + _ args : CVarArg . . . ) <nl> + { <nl> + guard log . isEnabled ( type : type ) else { return } <nl> + let ra = _swift_os_log_return_address ( ) <nl> + <nl> + message . withUTF8Buffer { ( buf : UnsafeBufferPointer < UInt8 > ) in <nl> + / / Since dladdr is in libc , it is safe to unsafeBitCast <nl> + / / the cstring argument type . <nl> + buf . baseAddress ! . withMemoryRebound ( <nl> + to : CChar . self , capacity : buf . count <nl> + ) { str in <nl> + withVaList ( args ) { valist in <nl> + _swift_os_log ( dso , ra , log , type , str , valist ) <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> @ available ( macOS 10 . 12 , iOS 10 . 0 , watchOS 3 . 0 , tvOS 10 . 0 , * ) <nl> public func os_log ( <nl> - _ message : StaticString , <nl> + _ message : StaticString , <nl> dso : UnsafeRawPointer ? = # dsohandle , <nl> - log : OSLog = . default , <nl> - type : OSLogType = . default , <nl> - _ args : CVarArg . . . ) <nl> + log : OSLog = . default , <nl> + type : OSLogType = . default , <nl> + _ args : CVarArg . . . ) <nl> { <nl> guard log . isEnabled ( type : type ) else { return } <nl> let ra = _swift_os_log_return_address ( ) <nl> new file mode 100644 <nl> index 000000000000 . . 49db19841c8e <nl> mmm / dev / null <nl> ppp b / stdlib / public / SDK / os / os_signpost . swift <nl> <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + @ _exported import os <nl> + @ _exported import os . signpost <nl> + import _SwiftOSOverlayShims <nl> + import os . log <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public func os_signpost ( <nl> + _ type : OSSignpostType , <nl> + dso : UnsafeRawPointer = # dsohandle , <nl> + log : OSLog , <nl> + name : StaticString , <nl> + signpostID : OSSignpostID = . exclusive <nl> + ) { <nl> + guard log . signpostsEnabled else { return } <nl> + let ra = _swift_os_log_return_address ( ) <nl> + name . withUTF8Buffer { ( nameBuf : UnsafeBufferPointer < UInt8 > ) in <nl> + / / Since dladdr is in libc , it is safe to unsafeBitCast <nl> + / / the cstring argument type . <nl> + nameBuf . baseAddress ! . withMemoryRebound ( <nl> + to : CChar . self , capacity : nameBuf . count <nl> + ) { nameStr in <nl> + _swift_os_signpost ( dso , ra , log , type , nameStr , signpostID . rawValue ) <nl> + } <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public func os_signpost ( <nl> + _ type : OSSignpostType , <nl> + dso : UnsafeRawPointer = # dsohandle , <nl> + log : OSLog , <nl> + name : StaticString , <nl> + signpostID : OSSignpostID = . exclusive , <nl> + _ format : StaticString , <nl> + _ arguments : CVarArg . . . <nl> + ) { <nl> + guard log . signpostsEnabled else { return } <nl> + let ra = _swift_os_log_return_address ( ) <nl> + name . withUTF8Buffer { ( nameBuf : UnsafeBufferPointer < UInt8 > ) in <nl> + / / Since dladdr is in libc , it is safe to unsafeBitCast <nl> + / / the cstring argument type . <nl> + nameBuf . baseAddress ! . withMemoryRebound ( <nl> + to : CChar . self , capacity : nameBuf . count <nl> + ) { nameStr in <nl> + format . withUTF8Buffer { ( formatBuf : UnsafeBufferPointer < UInt8 > ) in <nl> + / / Since dladdr is in libc , it is safe to unsafeBitCast <nl> + / / the cstring argument type . <nl> + formatBuf . baseAddress ! . withMemoryRebound ( <nl> + to : CChar . self , capacity : formatBuf . count <nl> + ) { formatStr in <nl> + withVaList ( arguments ) { valist in <nl> + _swift_os_signpost_with_format ( dso , ra , log , type , <nl> + nameStr , signpostID . rawValue , formatStr , valist ) <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + extension OSSignpostType { <nl> + public static let event = __OS_SIGNPOST_EVENT <nl> + public static let begin = __OS_SIGNPOST_INTERVAL_BEGIN <nl> + public static let end = __OS_SIGNPOST_INTERVAL_END <nl> + } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + public struct OSSignpostID { <nl> + public let rawValue : os_signpost_id_t <nl> + public static let exclusive = <nl> + OSSignpostID ( spid : _swift_os_signpost_id_exclusive ( ) ) <nl> + public static let invalid = <nl> + OSSignpostID ( spid : _swift_os_signpost_id_invalid ( ) ) <nl> + public static let null = <nl> + OSSignpostID ( spid : _swift_os_signpost_id_null ( ) ) <nl> + <nl> + public init ( log : OSLog ) { <nl> + self . rawValue = __os_signpost_id_generate ( log ) <nl> + } <nl> + <nl> + public init ( log : OSLog , object : AnyObject ) { <nl> + self . rawValue = __os_signpost_id_make_with_pointer ( log , <nl> + UnsafeRawPointer ( Unmanaged . passUnretained ( object ) . toOpaque ( ) ) ) <nl> + } <nl> + <nl> + fileprivate init ( spid : os_signpost_id_t ) { <nl> + self . rawValue = spid <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + extension OSSignpostID : Comparable { <nl> + public static func < ( a : OSSignpostID , b : OSSignpostID ) - > Bool { <nl> + return a . rawValue < b . rawValue <nl> + } <nl> + <nl> + public static func = = ( a : OSSignpostID , b : OSSignpostID ) - > Bool { <nl> + return a . rawValue = = b . rawValue <nl> + } <nl> + } <nl> + <nl> + @ available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) <nl> + extension OSLog { <nl> + public struct Category { <nl> + public let rawValue : String <nl> + public static let pointsOfInterest = <nl> + Category ( string : String ( cString : _swift_os_signpost_points_of_interest ( ) ) ) <nl> + private init ( string : String ) { <nl> + self . rawValue = string <nl> + } <nl> + } <nl> + <nl> + public convenience init ( subsystem : String , category : Category ) { <nl> + self . init ( __subsystem : subsystem , category : category . rawValue ) <nl> + } <nl> + <nl> + public var signpostsEnabled : Bool { <nl> + return __os_signpost_enabled ( self ) <nl> + } <nl> + } <nl> mmm a / stdlib / public / SwiftShims / CMakeLists . txt <nl> ppp b / stdlib / public / SwiftShims / CMakeLists . txt <nl> set ( sources <nl> Visibility . h <nl> <nl> DispatchOverlayShims . h <nl> + NetworkOverlayShims . h <nl> OSOverlayShims . h <nl> ObjectiveCOverlayShims . h <nl> SafariServicesOverlayShims . h <nl> new file mode 100644 <nl> index 000000000000 . . 053910664c8b <nl> mmm / dev / null <nl> ppp b / stdlib / public / SwiftShims / NetworkOverlayShims . h <nl> <nl> + / / = = = mmm NetworkOverlayShims . h mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm * - C + + - * - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2018 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + <nl> + # ifndef SWIFT_STDLIB_SHIMS_NETWORKSHIMS_H <nl> + # define SWIFT_STDLIB_SHIMS_NETWORKSHIMS_H <nl> + <nl> + @ import Network ; <nl> + <nl> + # ifdef __OBJC__ <nl> + # define SWIFT_NW_RETURNS_RETAINED __attribute__ ( ( __ns_returns_retained__ ) ) <nl> + # else <nl> + # define SWIFT_NW_RETURNS_RETAINED <nl> + # endif <nl> + <nl> + # pragma clang assume_nonnull begin <nl> + <nl> + typedef void ( ^ __swift_nw_connection_send_completion_t ) ( _Nullable nw_error_t error ) ; <nl> + <nl> + static inline SWIFT_NW_RETURNS_RETAINED nw_content_context_t <nl> + _swift_nw_content_context_default_message ( void ) { <nl> + return _nw_content_context_default_message ; <nl> + } <nl> + <nl> + static inline SWIFT_NW_RETURNS_RETAINED nw_content_context_t <nl> + _swift_nw_content_context_final_message ( void ) { <nl> + return _nw_content_context_final_send ; <nl> + } <nl> + <nl> + static inline SWIFT_NW_RETURNS_RETAINED nw_content_context_t <nl> + _swift_nw_content_context_default_stream ( void ) { <nl> + return _nw_content_context_default_stream ; <nl> + } <nl> + <nl> + static inline void <nl> + _swift_nw_connection_send_idempotent ( nw_connection_t connection , _Nullable dispatch_data_t content , _Nullable nw_content_context_t context , bool is_complete ) { <nl> + nw_connection_send ( connection , content , context , is_complete , _nw_connection_send_idempotent_content ) ; <nl> + } <nl> + <nl> + static inline void <nl> + _swift_nw_connection_send ( nw_connection_t connection , _Nullable dispatch_data_t content , nw_content_context_t context , bool is_complete , __swift_nw_connection_send_completion_t completion ) { <nl> + nw_connection_send ( connection , content , context , is_complete , completion ) ; <nl> + } <nl> + <nl> + _Nullable SWIFT_NW_RETURNS_RETAINED nw_endpoint_t <nl> + nw_endpoint_create_unix ( const char * path ) ; <nl> + <nl> + _Nullable SWIFT_NW_RETURNS_RETAINED nw_interface_t <nl> + nw_endpoint_copy_interface ( nw_endpoint_t endpoint ) ; <nl> + <nl> + void <nl> + nw_endpoint_set_interface ( nw_endpoint_t endpoint , <nl> + _Nullable nw_interface_t interface ) ; <nl> + <nl> + _Nullable SWIFT_NW_RETURNS_RETAINED nw_interface_t <nl> + nw_interface_create_with_name ( const char * interface_name ) ; <nl> + <nl> + _Nullable SWIFT_NW_RETURNS_RETAINED nw_interface_t <nl> + nw_interface_create_with_index ( uint32_t interface_index ) ; <nl> + <nl> + SWIFT_NW_RETURNS_RETAINED NSData * _Nullable <nl> + NWCreateNSDataFromDispatchData ( _Nullable dispatch_data_t data ) ; <nl> + <nl> + _Nullable SWIFT_NW_RETURNS_RETAINED dispatch_data_t <nl> + NWCreateDispatchDataFromNSData ( NSData * _Nullable data ) ; <nl> + <nl> + const char * <nl> + nwlog_get_string_for_dns_service_error ( int32_t err ) ; <nl> + <nl> + # pragma clang assume_nonnull end <nl> + <nl> + # endif / / SWIFT_STDLIB_SHIMS_NETWORKSHIMS_H <nl> + <nl> mmm a / stdlib / public / SwiftShims / OSOverlayShims . h <nl> ppp b / stdlib / public / SwiftShims / OSOverlayShims . h <nl> <nl> # define SWIFT_STDLIB_SHIMS_OS_OVERLAY_H <nl> <nl> # include < os / log . h > <nl> + # include < os / signpost . h > <nl> # include < stdarg . h > <nl> <nl> - extern const void * _Nullable _swift_os_log_return_address ( void ) ; <nl> - <nl> - extern void _swift_os_log ( const void * _Nullable dso , const void * _Nullable retaddr , <nl> - os_log_t _Nonnull oslog , os_log_type_t type , <nl> - const char * _Nonnull format , va_list args ) ; <nl> - <nl> static inline os_log_t _Nonnull <nl> _swift_os_log_default ( void ) { <nl> return OS_LOG_DEFAULT ; <nl> _swift_os_log_disabled ( void ) { <nl> return OS_LOG_DISABLED ; <nl> } <nl> <nl> - # endif / / SWIFT_STDLIB_SHIMS_OS_OVERLAY_H <nl> + static inline const unsigned char * _Nonnull <nl> + _swift_os_signpost_points_of_interest ( void ) { <nl> + / * OS_LOG_CATEGORY_POINTS_OF_INTEREST * / <nl> + return " PointsOfInterest " ; <nl> + } <nl> + <nl> + static inline os_signpost_id_t <nl> + _swift_os_signpost_id_exclusive ( void ) { <nl> + / * OS_SIGNPOST_ID_EXCLUSIVE * / <nl> + return ( os_signpost_id_t ) 0xCABA71571CC0FFEE ; <nl> + } <nl> + <nl> + static inline os_signpost_id_t <nl> + _swift_os_signpost_id_invalid ( void ) { <nl> + / * OS_SIGNPOST_ID_INVALID * / <nl> + return ( os_signpost_id_t ) ~ 0 ; <nl> + } <nl> <nl> + static inline os_signpost_id_t <nl> + _swift_os_signpost_id_null ( void ) { <nl> + / * OS_SIGNPOST_ID_NULL * / <nl> + return ( os_signpost_id_t ) 0 ; <nl> + } <nl> + <nl> + extern const void * _Nullable <nl> + _swift_os_log_return_address ( void ) ; <nl> + <nl> + extern void <nl> + _swift_os_log ( <nl> + const void * _Nullable dso , <nl> + const void * _Nullable ra , <nl> + os_log_t _Nonnull h , <nl> + os_log_type_t type , <nl> + const char * _Nonnull fmt , <nl> + va_list args ) ; <nl> + <nl> + extern void <nl> + _swift_os_signpost_with_format ( <nl> + const void * _Nullable dso , <nl> + const void * _Nullable ra , <nl> + os_log_t _Nonnull h , <nl> + os_signpost_type_t spty , <nl> + const char * _Nonnull spnm , <nl> + os_signpost_id_t spid , <nl> + const char * _Nullable fmt , <nl> + va_list args ) ; <nl> + <nl> + extern void <nl> + _swift_os_signpost ( <nl> + const void * _Nullable dso , <nl> + const void * _Nullable ra , <nl> + os_log_t _Nonnull h , <nl> + os_signpost_type_t spty , <nl> + const char * _Nonnull spnm , <nl> + os_signpost_id_t spid ) ; <nl> + <nl> + # endif / / SWIFT_STDLIB_SHIMS_OS_OVERLAY_H <nl> mmm a / stdlib / public / SwiftShims / module . modulemap <nl> ppp b / stdlib / public / SwiftShims / module . modulemap <nl> module _SwiftCoreFoundationOverlayShims { <nl> module _SwiftFoundationOverlayShims { <nl> header " FoundationOverlayShims . h " <nl> } <nl> + <nl> + module _SwiftNetworkOverlayShims { <nl> + header " NetworkOverlayShims . h " <nl> + } <nl> mmm a / test / Driver / sdk - apple . swift <nl> ppp b / test / Driver / sdk - apple . swift <nl> <nl> / / RUN : % empty - directory ( % t / MacOSX10 . 11 . Internal . sdk ) & & not % swift_driver - sdk % t / MacOSX10 . 11 . Internal . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / MacOSX10 . 12 . sdk ) & & not % swift_driver - sdk % t / MacOSX10 . 12 . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / MacOSX10 . 12 . Internal . sdk ) & & not % swift_driver - sdk % t / MacOSX10 . 12 . Internal . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> - / / RUN : % empty - directory ( % t / MacOSX10 . 13 . sdk ) & & % swift_driver - sdk % t / MacOSX10 . 13 . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> - / / RUN : % empty - directory ( % t / MacOSX10 . 13 . Internal . sdk ) & & % swift_driver - sdk % t / MacOSX10 . 13 . Internal . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : % empty - directory ( % t / MacOSX10 . 13 . sdk ) & & not % swift_driver - sdk % t / MacOSX10 . 13 . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : % empty - directory ( % t / MacOSX10 . 13 . Internal . sdk ) & & not % swift_driver - sdk % t / MacOSX10 . 13 . Internal . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : % empty - directory ( % t / MacOSX10 . 14 . sdk ) & & % swift_driver - sdk % t / MacOSX10 . 14 . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : % empty - directory ( % t / MacOSX10 . 14 . Internal . sdk ) & & % swift_driver - sdk % t / MacOSX10 . 14 . Internal . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> / / RUN : % empty - directory ( % t / OSX50 . sdk ) & & % swift_driver - sdk % t / OSX50 . sdk - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> <nl> / / RUN : not % swift_driver - sdk % t / MacOSX10 . 9 . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> <nl> / / RUN : not % swift_driver - sdk % t / MacOSX10 . 11 . Internal . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : not % swift_driver - sdk % t / MacOSX10 . 12 . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : not % swift_driver - sdk % t / MacOSX10 . 12 . Internal . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> - / / RUN : % swift_driver - sdk % t / MacOSX10 . 13 . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> - / / RUN : % swift_driver - sdk % t / MacOSX10 . 13 . Internal . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : not % swift_driver - sdk % t / MacOSX10 . 13 . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : not % swift_driver - sdk % t / MacOSX10 . 13 . Internal . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : % swift_driver - sdk % t / MacOSX10 . 14 . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : % swift_driver - sdk % t / MacOSX10 . 14 . Internal . sdk / - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> <nl> / / RUN : % empty - directory ( % t / iPhoneOS7 . 0 . sdk ) & & not % swift_driver - sdk % t / iPhoneOS7 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / iPhoneOS7 . 0 . Internal . sdk ) & & not % swift_driver - sdk % t / iPhoneOS7 . 0 . Internal . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> <nl> / / RUN : % empty - directory ( % t / iPhoneOS8 . 0 . Internal . sdk ) & & not % swift_driver - sdk % t / iPhoneOS8 . 0 . Internal . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / iPhoneOS9 . 0 . sdk ) & & not % swift_driver - sdk % t / iPhoneOS9 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / iPhoneOS10 . 0 . sdk ) & & not % swift_driver - sdk % t / iPhoneOS10 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> - / / RUN : % empty - directory ( % t / iPhoneOS11 . 0 . sdk ) & & % swift_driver - sdk % t / iPhoneOS11 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : % empty - directory ( % t / iPhoneOS11 . 0 . sdk ) & & not % swift_driver - sdk % t / iPhoneOS11 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : % empty - directory ( % t / iPhoneOS12 . 0 . sdk ) & & % swift_driver - sdk % t / iPhoneOS12 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> <nl> / / RUN : % empty - directory ( % t / tvOS8 . 0 . sdk ) & & not % swift_driver - sdk % t / tvOS8 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / tvOS8 . 0 . Internal . sdk ) & & not % swift_driver - sdk % t / tvOS8 . 0 . Internal . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / tvOS9 . 0 . sdk ) & & not % swift_driver - sdk % t / tvOS9 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / tvOS10 . 0 . sdk ) & & not % swift_driver - sdk % t / tvOS10 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> - / / RUN : % empty - directory ( % t / tvOS11 . 0 . sdk ) & & % swift_driver - sdk % t / tvOS11 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : % empty - directory ( % t / tvOS11 . 0 . sdk ) & & not % swift_driver - sdk % t / tvOS11 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : % empty - directory ( % t / tvOS12 . 0 . sdk ) & & % swift_driver - sdk % t / tvOS12 . 0 . sdk - target x86_64 - apple - tvos9 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> <nl> / / RUN : % empty - directory ( % t / watchOS1 . 0 . sdk ) & & not % swift_driver - sdk % t / watchOS1 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / watchOS1 . 0 . Internal . sdk ) & & not % swift_driver - sdk % t / watchOS1 . 0 . Internal . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / watchOS2 . 0 . sdk ) & & not % swift_driver - sdk % t / watchOS2 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / watchOS3 . 0 . sdk ) & & not % swift_driver - sdk % t / watchOS3 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> - / / RUN : % empty - directory ( % t / watchOS4 . 0 . sdk ) & & % swift_driver - sdk % t / watchOS4 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> + / / RUN : % empty - directory ( % t / watchOS4 . 0 . sdk ) & & not % swift_driver - sdk % t / watchOS4 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> + / / RUN : % empty - directory ( % t / watchOS5 . 0 . sdk ) & & % swift_driver - sdk % t / watchOS5 . 0 . sdk - target x86_64 - apple - watchos2 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - OKAY % s <nl> <nl> / / RUN : % empty - directory ( % t / iPhoneSimulator7 . 0 . sdk ) & & not % swift_driver - sdk % t / iPhoneSimulator7 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> / / RUN : % empty - directory ( % t / iPhoneSimulator8 . 0 . sdk ) & & not % swift_driver - sdk % t / iPhoneSimulator8 . 0 . sdk - target x86_64 - apple - ios7 - # # # 2 > & 1 | % FileCheck - check - prefix = SDK - TOO - OLD % s <nl> new file mode 100644 <nl> index 000000000000 . . f7d799e1fff0 <nl> mmm / dev / null <nl> ppp b / test / stdlib / CloudKit . swift <nl> <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : % target - build - swift - swift - version 4 - F % sdk / System / Library / PrivateFrameworks % s - o % t / a . out - 4 & & % target - run % t / a . out - 4 <nl> + / / RUN : % target - build - swift - swift - version 4 . 2 - F % sdk / System / Library / PrivateFrameworks % s - o % t / a . out - 4 . 2 & & % target - run % t / a . out - 4 . 2 <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : objc_interop <nl> + <nl> + import CloudKit <nl> + import StdlibUnittest <nl> + import StdlibUnittestFoundationExtras <nl> + <nl> + let CloudKitTests = TestSuite ( " CloudKit " ) <nl> + <nl> + <nl> + CloudKitTests . test ( " Type renames " ) { <nl> + if # available ( macOS 10 . 10 , iOS 8 . 0 , tvOS 9 . 0 , watchOS 3 . 0 , * ) { <nl> + # if swift ( > = 4 . 2 ) <nl> + let _ : CKRecord . ID ? = nil <nl> + let _ : CKRecord . Reference ? = nil <nl> + let _ : CKRecordZone . ID ? = nil <nl> + let _ : CKNotification . ID ? = nil <nl> + let _ : CKQueryOperation . Cursor ? = nil <nl> + let _ : CKModifyRecordsOperation . RecordSavePolicy ? = nil <nl> + let _ : CKNotification . NotificationType ? = nil <nl> + let _ : CKQueryNotification . Reason ? = nil <nl> + let _ : CKRecordZone . Capabilities ? = nil <nl> + # else <nl> + let _ : CKRecordID ? = nil <nl> + let _ : CKReference ? = nil <nl> + let _ : CKRecordZoneID ? = nil <nl> + let _ : CKNotificationID ? = nil <nl> + let _ : CKQueryCursor ? = nil <nl> + let _ : CKRecordSavePolicy ? = nil <nl> + let _ : CKNotificationType ? = nil <nl> + let _ : CKQueryNotificationReason ? = nil <nl> + let _ : CKRecordZoneCapabilities ? = nil <nl> + # endif <nl> + } <nl> + <nl> + if # available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , watchOS 3 . 0 , * ) { <nl> + # if swift ( > = 4 . 2 ) <nl> + let _ : CKShare . Participant ? = nil <nl> + let _ : CKUserIdentity . LookupInfo ? = nil <nl> + let _ : CKShare . Metadata ? = nil <nl> + let _ : CKDatabase . Scope ? = nil <nl> + # else <nl> + let _ : CKShareParticipant ? = nil <nl> + let _ : CKUserIdentityLookupInfo ? = nil <nl> + let _ : CKShareMetadata ? = nil <nl> + let _ : CKDatabaseScope ? = nil <nl> + # endif <nl> + } <nl> + <nl> + if # available ( macOS 10 . 13 , iOS 11 . 0 , tvOS 11 . 0 , watchOS 4 . 0 , * ) { <nl> + # if swift ( > = 4 . 2 ) <nl> + let _ : CKOperation . Configuration ? = nil <nl> + let _ : CKOperationGroup . TransferSize ? = nil <nl> + # else <nl> + let _ : CKOperationConfiguration ? = nil <nl> + let _ : CKOperationGroupTransferSize ? = nil <nl> + # endif <nl> + } <nl> + <nl> + # if ! os ( watchOS ) <nl> + if # available ( macOS 10 . 10 , iOS 8 . 0 , tvOS 9 . 0 , * ) { <nl> + # if swift ( > = 4 . 2 ) <nl> + let _ : CKSubscription . SubscriptionType ? = nil <nl> + let _ : CKSubscription . NotificationInfo ? = nil <nl> + # else <nl> + let _ : CKSubscriptionType ? = nil <nl> + let _ : CKNotificationInfo ? = nil <nl> + # endif / / swift ( > = 4 . 2 ) <nl> + } <nl> + <nl> + if # available ( macOS 10 . 12 , iOS 10 . 0 , tvOS 10 . 0 , * ) { <nl> + # if swift ( > = 4 . 2 ) <nl> + let _ : CKQuerySubscription . Options ? = nil <nl> + # else <nl> + let _ : CKQuerySubscriptionOptions ? = nil <nl> + # endif / / swift ( > = 4 . 2 ) <nl> + } <nl> + # endif / / ! os ( watchOS ) <nl> + } <nl> + <nl> + runAllTests ( ) <nl> mmm a / test / stdlib / Intents . swift <nl> ppp b / test / stdlib / Intents . swift <nl> if # available ( iOS 11 . 0 , * ) { <nl> } <nl> # endif <nl> <nl> + # if os ( iOS ) | | os ( watchOS ) <nl> + if # available ( iOS 12 . 0 , watchOS 5 . 0 , * ) { <nl> + <nl> + IntentsTestSuite . test ( " INPlayMediaIntent Initializer / \ ( swiftVersion ) " ) { <nl> + let intent = INPlayMediaIntent ( mediaItems : nil , mediaContainer : nil , playShuffled : false , playbackRepeatMode : . unknown , resumePlayback : true ) <nl> + expectFalse ( intent . playShuffled ? ? true ) <nl> + expectTrue ( intent . resumePlayback ? ? false ) <nl> + } <nl> + <nl> + } <nl> + # endif <nl> + <nl> runAllTests ( ) <nl> mmm a / test / stdlib / Metal . swift <nl> ppp b / test / stdlib / Metal . swift <nl> if # available ( OSX 10 . 13 , iOS 11 . 0 , tvOS 11 . 0 , * ) { <nl> encoder . setSamplerStates ( [ smplr ] , range : 0 . . < 1 ) <nl> encoder . setSamplerStates ( <nl> [ smplr ] , lodMinClamps : [ 0 ] , lodMaxClamps : [ 0 ] , range : 0 . . < 1 ) <nl> + if # available ( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , * ) <nl> + { <nl> + encoder . memoryBarrier ( [ buf ] ) <nl> + encoder . memoryBarrier ( MTLBarrierScope . buffers ) <nl> + } <nl> encoder . endEncoding ( ) <nl> } <nl> } <nl> if # available ( OSX 10 . 13 , iOS 11 . 0 , tvOS 11 . 0 , * ) { <nl> encoder . setTileSamplerStates ( <nl> [ smplr ] , lodMinClamps : [ 0 ] , lodMaxClamps : [ 0 ] , range : 0 . . < 1 ) <nl> # endif <nl> + # if os ( OSX ) <nl> + if # available ( macOS 10 . 14 , * ) <nl> + { <nl> + encoder . memoryBarrier ( [ buf ] , after : MTLRenderStages . fragment , before : MTLRenderStages . vertex ) <nl> + encoder . memoryBarrier ( MTLBarrierScope . renderTargets , after : MTLRenderStages . fragment , before : MTLRenderStages . vertex ) <nl> + } <nl> + # endif <nl> encoder . endEncoding ( ) <nl> } <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . 040f29873903 <nl> mmm / dev / null <nl> ppp b / test / stdlib / NaturalLanguage . swift <nl> <nl> + / / RUN : % target - run - simple - swift <nl> + / / REQUIRES : executable_test <nl> + / / REQUIRES : objc_interop <nl> + <nl> + / / FIXME : these lines should be removed effectively making NaturalLanguage <nl> + / / available on all platforms where ObjC runtime is available , once the SDK <nl> + / / issue has been figured out . <nl> + / / REQUIRES : OS = macosx <nl> + / / REQUIRES : OS = ios <nl> + / / REQUIRES : OS = tvos <nl> + <nl> + import StdlibUnittest <nl> + <nl> + import NaturalLanguage <nl> + <nl> + <nl> + var tests = TestSuite ( " NaturalLanguage " ) <nl> + <nl> + if # available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) { <nl> + tests . test ( " recognizer " ) { <nl> + let recognizer = NLLanguageRecognizer ( ) <nl> + let str = " This is a test mein Freund " <nl> + recognizer . processString ( str ) <nl> + recognizer . languageHints = [ . english : 0 . 9 , . german : 0 . 1 ] <nl> + let lang = recognizer . dominantLanguage <nl> + expectEqual ( NLLanguage . english , lang ) <nl> + let hypotheses = recognizer . languageHypotheses ( withMaximum : 2 ) <nl> + expectEqual ( hypotheses . count , 2 ) <nl> + let enProb = hypotheses [ . english ] ? ? 0 . 0 <nl> + let deProb = hypotheses [ . german ] ? ? 0 . 0 <nl> + let frProb = hypotheses [ . french ] ? ? 0 . 0 <nl> + expectNotEqual ( 0 . 0 , enProb ) <nl> + expectNotEqual ( 0 . 0 , deProb ) <nl> + expectEqual ( 0 . 0 , frProb ) <nl> + } <nl> + <nl> + tests . test ( " tokenizer " ) { <nl> + let tokenizer = NLTokenizer ( unit : . word ) <nl> + let str = " This is a test . 😀 " <nl> + let strRange = Range ( NSMakeRange ( 0 , 18 ) , in : str ) ! <nl> + tokenizer . string = str <nl> + tokenizer . setLanguage ( . english ) <nl> + let tokenRange1 = tokenizer . tokenRange ( at : str . startIndex ) <nl> + let tokenArray = tokenizer . tokens ( for : strRange ) <nl> + let tokenRange2 = tokenArray [ 0 ] <nl> + expectEqual ( tokenRange1 , tokenRange2 ) <nl> + expectEqual ( " This " , str [ tokenRange1 ] ) <nl> + expectEqual ( 5 , tokenArray . count ) <nl> + var numTokens = 0 <nl> + tokenizer . enumerateTokens ( in : strRange ) { ( tokenRange , attrs ) - > Bool in <nl> + if ( numTokens = = 0 ) { <nl> + expectEqual ( tokenRange , tokenRange1 ) <nl> + } <nl> + numTokens = numTokens + 1 <nl> + return true <nl> + } <nl> + expectEqual ( 5 , numTokens ) <nl> + expectEqual ( " 😀 " , str [ tokenArray [ 4 ] ] ) <nl> + } <nl> + <nl> + <nl> + tests . test ( " tagger " ) { <nl> + let tagger = NLTagger ( tagSchemes : [ . tokenType ] ) <nl> + let str = " This is a test . 😀 " <nl> + let strRange = Range ( NSMakeRange ( 0 , 18 ) , in : str ) ! <nl> + tagger . string = str <nl> + tagger . setLanguage ( . english , range : strRange ) <nl> + let ortho = NSOrthography . defaultOrthography ( forLanguage : " en " ) <nl> + tagger . setOrthography ( ortho , range : strRange ) <nl> + let ( tag1 , tokenRange1 ) = tagger . tag ( at : str . startIndex , unit : . word , scheme : . tokenType ) <nl> + let tags = tagger . tags ( in : strRange , unit : . word , scheme : . tokenType , options : . omitWhitespace ) <nl> + let ( tag2 , tokenRange2 ) = tags [ 0 ] <nl> + let tokenRange3 = tagger . tokenRange ( at : str . startIndex , unit : . word ) <nl> + expectEqual ( NLTag . word , tag1 ) <nl> + expectEqual ( NLTag . word , tag2 ) <nl> + expectEqual ( tokenRange1 , tokenRange2 ) <nl> + expectEqual ( tokenRange2 , tokenRange3 ) <nl> + expectEqual ( " This " , str [ tokenRange1 ] ) <nl> + expectEqual ( 6 , tags . count ) <nl> + var numTokens = 0 <nl> + tagger . enumerateTags ( in : strRange , unit : . word , scheme : . tokenType , options : . omitWhitespace ) { ( tag , tokenRange ) - > Bool in <nl> + let ( tagAt , tokenRangeAt ) = tagger . tag ( at : tokenRange . lowerBound , unit : . word , scheme : . tokenType ) <nl> + expectEqual ( tag , tagAt ) <nl> + expectEqual ( tokenRange , tokenRangeAt ) <nl> + if ( numTokens = = 0 ) { <nl> + expectEqual ( NLTag . word , tag ) <nl> + expectEqual ( tokenRange , tokenRange1 ) <nl> + } <nl> + numTokens + = 1 <nl> + return true <nl> + } <nl> + expectEqual ( 6 , numTokens ) <nl> + let ( _ , tokenRange4 ) = tags [ 5 ] <nl> + expectEqual ( " 😀 " , str [ tokenRange4 ] ) <nl> + } <nl> + } <nl> + <nl> + runAllTests ( ) <nl> new file mode 100644 <nl> index 000000000000 . . bc42f9fc851e <nl> mmm / dev / null <nl> ppp b / test / stdlib / Network . swift <nl> <nl> + / / RUN : % target - run - simple - swift <nl> + / / REQUIRES : executable_test <nl> + <nl> + / / REQUIRES : objc_interop <nl> + <nl> + import Network <nl> + import Foundation <nl> + import StdlibUnittest <nl> + <nl> + <nl> + defer { runAllTests ( ) } <nl> + <nl> + var NetworkAPI = TestSuite ( " NetworkAPI " ) <nl> + <nl> + # if ! os ( watchOS ) <nl> + <nl> + if # available ( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , * ) { <nl> + NetworkAPI . test ( " constants " ) { <nl> + expectNotNil ( NWConnection . ContentContext . defaultMessage ) <nl> + expectNotNil ( NWConnection . ContentContext . finalMessage ) <nl> + expectNotNil ( NWConnection . ContentContext . defaultStream ) <nl> + expectNotNil ( NWParameters . tcp ) <nl> + expectNotNil ( NWParameters . tls ) <nl> + expectNotNil ( NWParameters . udp ) <nl> + expectNotNil ( NWParameters . dtls ) <nl> + expectNotNil ( IPv4Address . any ) <nl> + expectNotNil ( IPv4Address . broadcast ) <nl> + expectNotNil ( IPv4Address . loopback ) <nl> + expectNotNil ( IPv4Address . allHostsGroup ) <nl> + expectNotNil ( IPv4Address . allRoutersGroup ) <nl> + expectNotNil ( IPv4Address . allReportsGroup ) <nl> + expectNotNil ( IPv4Address . mdnsGroup ) <nl> + expectNotNil ( IPv6Address . any ) <nl> + expectNotNil ( IPv6Address . loopback ) <nl> + expectNotNil ( IPv6Address . nodeLocalNodes ) <nl> + expectNotNil ( IPv6Address . linkLocalNodes ) <nl> + expectNotNil ( IPv6Address . linkLocalRouters ) <nl> + expectNotNil ( NWEndpoint . Port . any ) <nl> + expectNotNil ( NWEndpoint . Port . ssh ) <nl> + expectNotNil ( NWEndpoint . Port . smtp ) <nl> + expectNotNil ( NWEndpoint . Port . http ) <nl> + expectNotNil ( NWEndpoint . Port . pop ) <nl> + expectNotNil ( NWEndpoint . Port . imap ) <nl> + expectNotNil ( NWEndpoint . Port . https ) <nl> + expectNotNil ( NWEndpoint . Port . imaps ) <nl> + expectNotNil ( NWEndpoint . Port . socks ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWEndpoint " ) { <nl> + let hostEndpoint = NWEndpoint . hostPort ( host : " www . apple . com " , port : . http ) <nl> + expectNotNil ( hostEndpoint ) <nl> + expectNil ( hostEndpoint . interface ) <nl> + <nl> + let bonjourEndpoint = NWEndpoint . service ( name : " myprinter " , type : " _ipp . _tcp " , domain : " local " , interface : nil ) <nl> + expectNotNil ( bonjourEndpoint ) <nl> + expectNil ( bonjourEndpoint . interface ) <nl> + <nl> + let unixEndpoint = NWEndpoint . unix ( path : " / foo / bar " ) <nl> + expectNotNil ( unixEndpoint ) <nl> + expectNil ( unixEndpoint . interface ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWEndpoint . Host " ) { <nl> + var host = NWEndpoint . Host ( " www . apple . com " ) <nl> + expectNotNil ( host ) <nl> + expectNil ( host . interface ) <nl> + <nl> + host = NWEndpoint . Host ( " 127 . 0 . 0 . 1 " ) <nl> + expectNotNil ( host ) <nl> + expectNil ( host . interface ) <nl> + <nl> + host = NWEndpoint . Host ( " : : 1 " ) <nl> + expectNotNil ( host ) <nl> + expectNil ( host . interface ) <nl> + <nl> + host = NWEndpoint . Host ( " : : 1 % lo0 " ) <nl> + expectNotNil ( host ) <nl> + expectNotNil ( host . interface ) <nl> + if let interface = host . interface { <nl> + expectEqual ( interface . name , " lo0 " ) <nl> + expectEqual ( interface . type , . loopback ) <nl> + } <nl> + <nl> + var ipv4Address = IPv4Address ( " 127 . 0 . 0 . 1 " ) <nl> + expectNotNil ( ipv4Address ) <nl> + expectNotNil ( ipv4Address ! . rawValue ) <nl> + expectEqual ( ipv4Address ! . rawValue . count , 4 ) <nl> + expectNil ( ipv4Address ! . interface ) <nl> + expectTrue ( ipv4Address ! . isLoopback ) <nl> + <nl> + let otherIPv4Address = IPv4Address ( " 127 . 0 . 0 . 1 " ) <nl> + expectEqual ( ipv4Address , otherIPv4Address ) <nl> + <nl> + ipv4Address = IPv4Address ( " 169 . 254 . 1 . 0 " ) <nl> + expectNotNil ( ipv4Address ) <nl> + expectTrue ( ipv4Address ! . isLinkLocal ) <nl> + <nl> + ipv4Address = IPv4Address ( " 224 . 0 . 0 . 1 " ) <nl> + expectNotNil ( ipv4Address ) <nl> + expectTrue ( ipv4Address ! . isMulticast ) <nl> + <nl> + var ipv6Address = IPv6Address ( " : : 0 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isAny ) <nl> + expectNotNil ( ipv6Address ! . rawValue ) <nl> + expectEqual ( ipv6Address ! . rawValue . count , 16 ) <nl> + expectNil ( ipv6Address ! . interface ) <nl> + <nl> + ipv6Address = IPv6Address ( " : : 1 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isLoopback ) <nl> + expectNil ( ipv6Address ! . interface ) <nl> + <nl> + ipv6Address = IPv6Address ( " : : 1 % lo0 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isLoopback ) <nl> + expectNotNil ( ipv6Address ! . interface ) <nl> + if let interface = ipv6Address ! . interface { <nl> + expectEqual ( interface . name , " lo0 " ) <nl> + expectEqual ( interface . type , . loopback ) <nl> + } <nl> + <nl> + ipv6Address = IPv6Address ( " : : 1 . 2 . 3 . 4 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isIPv4Compatabile ) <nl> + <nl> + ipv6Address = IPv6Address ( " : : ffff : 1 . 2 . 3 . 4 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isIPv4Mapped ) <nl> + <nl> + ipv4Address = ipv6Address ! . asIPv4 <nl> + expectNotNil ( ipv4Address ) <nl> + <nl> + ipv6Address = IPv6Address ( " 2002 : : 1 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . is6to4 ) <nl> + <nl> + ipv6Address = IPv6Address ( " fe80 : : 1 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isLinkLocal ) <nl> + <nl> + ipv6Address = IPv6Address ( " ff02 : : 1 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isMulticast ) <nl> + <nl> + expectEqual ( ipv6Address ! . multicastScope , . linkLocal ) <nl> + <nl> + / / Try a bad multicast scope <nl> + ipv6Address = IPv6Address ( " ff03 : : 1 " ) <nl> + expectNotNil ( ipv6Address ) <nl> + expectTrue ( ipv6Address ! . isMulticast ) <nl> + expectTrue ( ipv6Address ! . multicastScope ! = . linkLocal ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWEndpoint . Port " ) { <nl> + let port : NWEndpoint . Port = 1234 <nl> + expectNotNil ( port ) <nl> + expectEqual ( port . rawValue , 1234 ) <nl> + <nl> + expectEqual ( NWEndpoint . Port . https , 443 ) <nl> + expectEqual ( NWEndpoint . Port ( " https " ) ! . rawValue , 443 ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWParameters " ) { <nl> + var parameters = NWParameters . tcp <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . internetProtocol is NWProtocolIP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 0 ) <nl> + <nl> + parameters = parameters . copy ( ) <nl> + expectTrue ( parameters . defaultProtocolStack . internetProtocol is NWProtocolIP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 0 ) <nl> + <nl> + parameters = NWParameters . udp <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolUDP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 0 ) <nl> + <nl> + parameters = NWParameters . tls <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 1 ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols [ 0 ] is NWProtocolTLS . Options ) <nl> + <nl> + parameters . defaultProtocolStack . transportProtocol = NWProtocolUDP . Options ( ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolUDP . Options ) <nl> + <nl> + parameters = NWParameters . tls <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + <nl> + parameters = NWParameters . dtls <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolUDP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 1 ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols [ 0 ] is NWProtocolTLS . Options ) <nl> + <nl> + parameters = NWParameters ( tls : nil , tcp : NWProtocolTCP . Options ( ) ) <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 0 ) <nl> + <nl> + parameters = NWParameters ( dtls : nil , udp : NWProtocolUDP . Options ( ) ) <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolUDP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 0 ) <nl> + <nl> + parameters = NWParameters ( tls : NWProtocolTLS . Options ( ) , tcp : NWProtocolTCP . Options ( ) ) <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 1 ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols [ 0 ] is NWProtocolTLS . Options ) <nl> + <nl> + parameters = NWParameters ( dtls : NWProtocolTLS . Options ( ) , udp : NWProtocolUDP . Options ( ) ) <nl> + expectNotNil ( parameters ) <nl> + expectTrue ( parameters . defaultProtocolStack . transportProtocol is NWProtocolUDP . Options ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 1 ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols [ 0 ] is NWProtocolTLS . Options ) <nl> + <nl> + parameters = NWParameters ( ) <nl> + expectNotNil ( parameters ) <nl> + expectNotNil ( parameters . defaultProtocolStack ) <nl> + expectTrue ( parameters . defaultProtocolStack . applicationProtocols . count = = 0 ) <nl> + expectNil ( parameters . defaultProtocolStack . transportProtocol ) <nl> + <nl> + parameters . defaultProtocolStack . transportProtocol = NWProtocolTCP . Options ( ) <nl> + <nl> + expectNil ( parameters . requiredInterface ) <nl> + <nl> + expectEqual ( parameters . requiredInterfaceType , NWInterface . InterfaceType . other ) <nl> + parameters . requiredInterfaceType = . wifi <nl> + expectEqual ( parameters . requiredInterfaceType , NWInterface . InterfaceType . wifi ) <nl> + <nl> + expectTrue ( parameters . prohibitedInterfaces = = nil | | <nl> + parameters . prohibitedInterfaces ! . count = = 0 ) <nl> + <nl> + expectTrue ( parameters . prohibitedInterfaceTypes = = nil | | <nl> + parameters . prohibitedInterfaceTypes ! . count = = 0 ) <nl> + parameters . prohibitedInterfaceTypes = [ . cellular ] <nl> + expectTrue ( parameters . prohibitedInterfaceTypes ! . count = = 1 ) <nl> + expectEqual ( parameters . prohibitedInterfaceTypes ! [ 0 ] , . cellular ) <nl> + <nl> + expectEqual ( parameters . prohibitExpensivePaths , false ) <nl> + parameters . prohibitExpensivePaths = true ; <nl> + expectEqual ( parameters . prohibitExpensivePaths , true ) <nl> + <nl> + expectEqual ( parameters . preferNoProxies , false ) <nl> + parameters . preferNoProxies = true ; <nl> + expectEqual ( parameters . preferNoProxies , true ) <nl> + <nl> + expectNil ( parameters . requiredLocalEndpoint ) <nl> + parameters . requiredLocalEndpoint = NWEndpoint . hostPort ( host : " 127 . 0 . 0 . 1 " , port : 1234 ) <nl> + expectNotNil ( parameters . requiredLocalEndpoint ) <nl> + <nl> + expectEqual ( parameters . allowLocalEndpointReuse , false ) <nl> + parameters . allowLocalEndpointReuse = true ; <nl> + expectEqual ( parameters . allowLocalEndpointReuse , true ) <nl> + <nl> + expectEqual ( parameters . acceptLocalOnly , false ) <nl> + parameters . acceptLocalOnly = true ; <nl> + expectEqual ( parameters . acceptLocalOnly , true ) <nl> + <nl> + expectEqual ( parameters . serviceClass , NWParameters . ServiceClass . bestEffort ) <nl> + parameters . serviceClass = . background ; <nl> + expectEqual ( parameters . serviceClass , NWParameters . ServiceClass . background ) <nl> + <nl> + expectEqual ( parameters . multipathServiceType , NWParameters . MultipathServiceType . disabled ) <nl> + parameters . multipathServiceType = . handover ; <nl> + expectEqual ( parameters . multipathServiceType , NWParameters . MultipathServiceType . handover ) <nl> + <nl> + expectEqual ( parameters . expiredDNSBehavior , NWParameters . ExpiredDNSBehavior . systemDefault ) <nl> + parameters . expiredDNSBehavior = . allow ; <nl> + expectEqual ( parameters . expiredDNSBehavior , NWParameters . ExpiredDNSBehavior . allow ) <nl> + <nl> + expectEqual ( parameters . allowFastOpen , false ) <nl> + parameters . allowFastOpen = true ; <nl> + expectEqual ( parameters . allowFastOpen , true ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWProtocolTCP " ) { <nl> + expectNotNil ( NWProtocolTCP . definition ) <nl> + expectEqual ( NWProtocolTCP . definition . name , " tcp " ) <nl> + <nl> + let options = NWProtocolTCP . Options ( ) <nl> + expectNotNil ( options ) <nl> + <nl> + expectEqual ( options . noDelay , false ) <nl> + options . noDelay = true ; <nl> + expectEqual ( options . noDelay , true ) <nl> + <nl> + expectEqual ( options . noPush , false ) <nl> + options . noPush = true ; <nl> + expectEqual ( options . noDelay , true ) <nl> + <nl> + expectEqual ( options . noOptions , false ) <nl> + options . noOptions = true ; <nl> + expectEqual ( options . noOptions , true ) <nl> + <nl> + expectEqual ( options . enableKeepalive , false ) <nl> + options . enableKeepalive = true ; <nl> + expectEqual ( options . enableKeepalive , true ) <nl> + <nl> + expectEqual ( options . keepaliveCount , 0 ) <nl> + options . keepaliveCount = 5 ; <nl> + expectEqual ( options . keepaliveCount , 5 ) <nl> + <nl> + expectEqual ( options . keepaliveIdle , 0 ) <nl> + options . keepaliveIdle = 5 ; <nl> + expectEqual ( options . keepaliveIdle , 5 ) <nl> + <nl> + expectEqual ( options . keepaliveInterval , 0 ) <nl> + options . keepaliveInterval = 5 ; <nl> + expectEqual ( options . keepaliveInterval , 5 ) <nl> + <nl> + expectEqual ( options . maximumSegmentSize , 0 ) <nl> + options . maximumSegmentSize = 500 ; <nl> + expectEqual ( options . maximumSegmentSize , 500 ) <nl> + <nl> + expectEqual ( options . connectionTimeout , 0 ) <nl> + options . connectionTimeout = 60 ; <nl> + expectEqual ( options . connectionTimeout , 60 ) <nl> + <nl> + expectEqual ( options . persistTimeout , 0 ) <nl> + options . persistTimeout = 60 ; <nl> + expectEqual ( options . persistTimeout , 60 ) <nl> + <nl> + expectEqual ( options . connectionDropTime , 0 ) <nl> + options . connectionDropTime = 60 ; <nl> + expectEqual ( options . connectionDropTime , 60 ) <nl> + <nl> + expectEqual ( options . retransmitFinDrop , false ) <nl> + options . retransmitFinDrop = true ; <nl> + expectEqual ( options . retransmitFinDrop , true ) <nl> + <nl> + expectEqual ( options . disableAckStretching , false ) <nl> + options . disableAckStretching = true ; <nl> + expectEqual ( options . disableAckStretching , true ) <nl> + <nl> + expectEqual ( options . enableFastOpen , false ) <nl> + options . enableFastOpen = true ; <nl> + expectEqual ( options . enableFastOpen , true ) <nl> + <nl> + expectEqual ( options . disableECN , false ) <nl> + options . disableECN = true ; <nl> + expectEqual ( options . disableECN , true ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWProtocolUDP " ) { <nl> + expectNotNil ( NWProtocolUDP . definition ) <nl> + expectEqual ( NWProtocolUDP . definition . name , " udp " ) <nl> + <nl> + let options = NWProtocolUDP . Options ( ) <nl> + expectNotNil ( options ) <nl> + <nl> + expectEqual ( options . preferNoChecksum , false ) <nl> + options . preferNoChecksum = true ; <nl> + expectEqual ( options . preferNoChecksum , true ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWProtocolIP " ) { <nl> + expectNotNil ( NWProtocolIP . definition ) <nl> + expectEqual ( NWProtocolIP . definition . name , " ip " ) <nl> + <nl> + let parameters = NWParameters ( ) <nl> + let options = parameters . defaultProtocolStack . internetProtocol <nl> + expectNotNil ( options ) <nl> + <nl> + expectTrue ( options is NWProtocolIP . Options ) <nl> + <nl> + let ipOptions = options as ! NWProtocolIP . Options <nl> + <nl> + expectEqual ( ipOptions . version , . any ) <nl> + ipOptions . version = . v6 ; <nl> + expectEqual ( ipOptions . version , . v6 ) <nl> + <nl> + expectEqual ( ipOptions . hopLimit , 0 ) <nl> + ipOptions . hopLimit = 5 ; <nl> + expectEqual ( ipOptions . hopLimit , 5 ) <nl> + <nl> + expectEqual ( ipOptions . useMinimumMTU , false ) <nl> + ipOptions . useMinimumMTU = true ; <nl> + expectEqual ( ipOptions . useMinimumMTU , true ) <nl> + <nl> + expectEqual ( ipOptions . disableFragmentation , false ) <nl> + ipOptions . disableFragmentation = true ; <nl> + expectEqual ( ipOptions . disableFragmentation , true ) <nl> + <nl> + let metadata = NWProtocolIP . Metadata ( ) <nl> + expectNotNil ( metadata ) <nl> + <nl> + expectEqual ( metadata . ecn , . nonECT ) <nl> + metadata . ecn = . ect0 ; <nl> + expectEqual ( metadata . ecn , . ect0 ) <nl> + <nl> + expectEqual ( metadata . serviceClass , . bestEffort ) <nl> + metadata . serviceClass = . background ; <nl> + expectEqual ( metadata . serviceClass , . background ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWProtocolTLS " ) { <nl> + expectNotNil ( NWProtocolTLS . definition ) <nl> + expectEqual ( NWProtocolTLS . definition . name , " tls " ) <nl> + <nl> + let options = NWProtocolTLS . Options ( ) <nl> + expectNotNil ( options ) <nl> + expectNotNil ( options . securityProtocolOptions ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWPath " ) <nl> + . skip ( . iOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . skip ( . tvOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . code { <nl> + let testQueue = DispatchQueue ( label : " testQueue " ) <nl> + let group = DispatchGroup ( ) <nl> + <nl> + let monitor = NWPathMonitor ( ) <nl> + expectNotNil ( monitor ) <nl> + <nl> + monitor . pathUpdateHandler = { ( newPath ) in <nl> + expectNotNil ( newPath ) <nl> + group . leave ( ) <nl> + } <nl> + <nl> + group . enter ( ) ; <nl> + monitor . start ( queue : testQueue ) <nl> + <nl> + let path = monitor . currentPath <nl> + expectNotNil ( path ) <nl> + <nl> + let result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + expectEqual ( monitor . queue , testQueue ) <nl> + <nl> + expectNil ( path . localEndpoint ) <nl> + expectNil ( path . remoteEndpoint ) <nl> + <nl> + for interface in path . availableInterfaces { <nl> + expectNotNil ( interface . name ) <nl> + expectTrue ( interface . index ! = 0 ) <nl> + } <nl> + <nl> + monitor . cancel ( ) <nl> + <nl> + let wifiMonitor = NWPathMonitor ( requiredInterfaceType : . wifi ) <nl> + expectNotNil ( wifiMonitor ) <nl> + <nl> + wifiMonitor . start ( queue : testQueue ) <nl> + <nl> + let wifiPath = wifiMonitor . currentPath <nl> + expectNotNil ( wifiPath ) <nl> + <nl> + if wifiPath . status = = . satisfied { <nl> + expectTrue ( wifiPath . usesInterfaceType ( . wifi ) ) <nl> + expectTrue ( wifiPath . supportsIPv4 | | wifiPath . supportsIPv6 | | wifiPath . supportsDNS ) <nl> + expectTrue ( wifiPath . availableInterfaces . count > 0 ) <nl> + var someInterfaceWiFi = false <nl> + for interface in wifiPath . availableInterfaces { <nl> + if ( interface . type = = . wifi ) { <nl> + someInterfaceWiFi = true <nl> + break <nl> + } <nl> + } <nl> + expectTrue ( someInterfaceWiFi ) <nl> + } <nl> + <nl> + wifiMonitor . cancel ( ) <nl> + <nl> + let loopbackMonitor = NWPathMonitor ( requiredInterfaceType : . loopback ) <nl> + expectNotNil ( loopbackMonitor ) <nl> + <nl> + loopbackMonitor . start ( queue : testQueue ) <nl> + <nl> + let loopbackPath = loopbackMonitor . currentPath <nl> + expectNotNil ( loopbackPath ) <nl> + <nl> + expectTrue ( ! loopbackPath . isExpensive ) <nl> + <nl> + loopbackMonitor . cancel ( ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWListener failure " ) <nl> + . skip ( . iOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . skip ( . tvOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . code { <nl> + let parameters : NWParameters = . tcp <nl> + parameters . requiredLocalEndpoint = NWEndpoint . hostPort ( host : " 127 . 0 . 0 . 1 " , port : 1234 ) <nl> + <nl> + var listener : NWListener ? = nil <nl> + do { <nl> + listener = try NWListener ( using : parameters , on : 2345 ) <nl> + } catch { <nl> + print ( " Received listener error : \ ( error ) . " ) <nl> + } <nl> + expectNil ( listener ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWListener " ) <nl> + . skip ( . iOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . skip ( . tvOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . code { <nl> + let testQueue = DispatchQueue ( label : " testQueue " ) <nl> + let group = DispatchGroup ( ) <nl> + let advertiseGroup = DispatchGroup ( ) <nl> + <nl> + let listener = try ! NWListener ( using : . tcp , on : 1234 ) <nl> + expectNotNil ( listener ) <nl> + <nl> + listener . service = NWListener . Service ( type : " _ipp . _tcp " ) <nl> + <nl> + listener . stateUpdateHandler = { ( newState ) in <nl> + switch ( newState ) { <nl> + case . ready : <nl> + group . leave ( ) <nl> + case . failed ( let error ) : <nl> + expectNotNil ( error ) <nl> + listener . cancel ( ) <nl> + case . cancelled : <nl> + group . leave ( ) <nl> + default : <nl> + break <nl> + } <nl> + } <nl> + <nl> + listener . newConnectionHandler = { ( newConn ) in <nl> + expectNotNil ( newConn ) <nl> + newConn . forceCancel ( ) <nl> + } <nl> + <nl> + listener . serviceRegistrationUpdateHandler = { ( serviceChange ) in <nl> + switch ( serviceChange ) { <nl> + case . add ( let endpoint ) : <nl> + expectNotNil ( endpoint ) <nl> + case . remove ( let endpoint ) : <nl> + expectNotNil ( endpoint ) <nl> + } <nl> + advertiseGroup . leave ( ) <nl> + } <nl> + <nl> + group . enter ( ) <nl> + advertiseGroup . enter ( ) <nl> + listener . start ( queue : testQueue ) <nl> + <nl> + / / Wait for ready <nl> + var result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + / / Wait for advertise <nl> + result = advertiseGroup . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + expectEqual ( listener . queue , testQueue ) <nl> + expectTrue ( listener . parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + expectEqual ( listener . port , 1234 ) <nl> + <nl> + group . enter ( ) <nl> + listener . cancel ( ) <nl> + <nl> + / / Wait for cancelled <nl> + result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWConnection creation " ) { <nl> + var connection = NWConnection ( host : " localhost " , port : 2345 , using : . tcp ) <nl> + expectNotNil ( connection ) <nl> + <nl> + connection = NWConnection ( to : . hostPort ( host : " localhost " , port : 2345 ) , using : . tcp ) <nl> + expectNotNil ( connection ) <nl> + <nl> + connection = NWConnection ( to : . service ( name : " myprinter " , type : " _ipp . _tcp " , domain : " local " , interface : nil ) , using : . tcp ) <nl> + expectNotNil ( connection ) <nl> + <nl> + connection = NWConnection ( to : . unix ( path : " / foo / bar " ) , using : . tcp ) <nl> + expectNotNil ( connection ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWConnection Waiting Reset " ) <nl> + . skip ( . iOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . skip ( . tvOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . code { <nl> + let testQueue = DispatchQueue ( label : " testQueue " ) <nl> + let group = DispatchGroup ( ) <nl> + <nl> + let connection = NWConnection ( host : " localhost " , port : 3456 , using : . tls ) <nl> + expectNotNil ( connection ) <nl> + <nl> + connection . stateUpdateHandler = { ( newState ) in <nl> + switch ( newState ) { <nl> + case . waiting ( let error ) : <nl> + expectNotNil ( error ) <nl> + switch ( error ) { <nl> + case . posix ( let code ) : <nl> + expectEqual ( code , . ECONNREFUSED ) <nl> + default : <nl> + break <nl> + } <nl> + group . leave ( ) <nl> + case . failed ( let error ) : <nl> + expectNotNil ( error ) <nl> + connection . cancel ( ) <nl> + case . cancelled : <nl> + group . leave ( ) <nl> + default : <nl> + break <nl> + } <nl> + } <nl> + <nl> + group . enter ( ) <nl> + connection . start ( queue : testQueue ) <nl> + <nl> + / / Wait for waiting <nl> + var result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + connection . restart ( ) <nl> + <nl> + group . enter ( ) <nl> + connection . cancel ( ) <nl> + <nl> + / / Wait for cancelled <nl> + result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWConnection Waiting DNS " ) <nl> + . skip ( . iOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . skip ( . tvOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . code { <nl> + let testQueue = DispatchQueue ( label : " testQueue " ) <nl> + let group = DispatchGroup ( ) <nl> + <nl> + let connection = NWConnection ( host : " foobar . fake . apple . com " , port : . https , using : . tls ) <nl> + expectNotNil ( connection ) <nl> + <nl> + connection . stateUpdateHandler = { ( newState ) in <nl> + switch ( newState ) { <nl> + case . waiting ( let error ) : <nl> + expectNotNil ( error ) <nl> + switch ( error ) { <nl> + case . dns ( let code ) : <nl> + expectEqual ( code , DNSServiceErrorType ( kDNSServiceErr_NoSuchRecord ) ) <nl> + default : <nl> + break <nl> + } <nl> + group . leave ( ) <nl> + case . failed ( let error ) : <nl> + expectNotNil ( error ) <nl> + connection . cancel ( ) <nl> + case . cancelled : <nl> + group . leave ( ) <nl> + default : <nl> + break <nl> + } <nl> + } <nl> + <nl> + group . enter ( ) <nl> + connection . start ( queue : testQueue ) <nl> + <nl> + / / Wait for waiting <nl> + var result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + group . enter ( ) <nl> + connection . cancel ( ) <nl> + <nl> + / / Wait for cancelled <nl> + result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWConnection TCP " ) <nl> + . skip ( . iOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . skip ( . tvOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . code { <nl> + let testQueue = DispatchQueue ( label : " testQueue " ) <nl> + let group = DispatchGroup ( ) <nl> + let viableGroup = DispatchGroup ( ) <nl> + let pathGroup = DispatchGroup ( ) <nl> + let sendGroup = DispatchGroup ( ) <nl> + let receiveGroup = DispatchGroup ( ) <nl> + <nl> + let listener = try ! NWListener ( using : . tcp , on : 2345 ) <nl> + expectNotNil ( listener ) <nl> + <nl> + var inboundConnection : NWConnection ? = nil <nl> + listener . newConnectionHandler = { ( newConn ) in <nl> + expectNotNil ( newConn ) <nl> + inboundConnection = newConn <nl> + newConn . receive ( minimumIncompleteLength : 5 , maximumLength : 5 ) { ( receivedContent , context , isComplete , receivedError ) in <nl> + expectTrue ( ! isComplete ) <nl> + expectNil ( receivedError ) <nl> + expectNotNil ( receivedContent ) <nl> + expectNotNil ( context ) <nl> + receiveGroup . leave ( ) <nl> + } <nl> + newConn . start ( queue : testQueue ) <nl> + } <nl> + listener . start ( queue : testQueue ) <nl> + <nl> + / / Make sure connecting by address works <nl> + let ipv4Address = IPv4Address ( " 127 . 0 . 0 . 1 " ) <nl> + let connection = NWConnection ( to : NWEndpoint . hostPort ( host : . ipv4 ( ipv4Address ! ) , port : 2345 ) , using : . tcp ) <nl> + expectNotNil ( connection ) <nl> + <nl> + connection . stateUpdateHandler = { ( newState ) in <nl> + switch ( newState ) { <nl> + case . ready : <nl> + group . leave ( ) <nl> + case . failed ( let error ) : <nl> + expectNotNil ( error ) <nl> + connection . cancel ( ) <nl> + case . cancelled : <nl> + group . leave ( ) <nl> + default : <nl> + break <nl> + } <nl> + } <nl> + <nl> + connection . pathUpdateHandler = { ( newPath ) in <nl> + expectNotNil ( newPath ) <nl> + pathGroup . leave ( ) <nl> + } <nl> + <nl> + connection . viabilityUpdateHandler = { ( isViable ) in <nl> + expectTrue ( isViable ) <nl> + viableGroup . leave ( ) <nl> + } <nl> + <nl> + connection . betterPathUpdateHandler = { ( betterPathAvailable ) in <nl> + expectTrue ( ! betterPathAvailable ) <nl> + } <nl> + <nl> + group . enter ( ) <nl> + viableGroup . enter ( ) <nl> + pathGroup . enter ( ) <nl> + receiveGroup . enter ( ) <nl> + connection . start ( queue : testQueue ) <nl> + <nl> + / / Wait for ready <nl> + var result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + let path = connection . currentPath <nl> + expectNotNil ( path ) <nl> + if let path = path { <nl> + expectTrue ( path . usesInterfaceType ( . loopback ) ) <nl> + expectNotNil ( path . localEndpoint ) <nl> + expectNotNil ( path . remoteEndpoint ) <nl> + } <nl> + <nl> + let metadata = connection . metadata ( definition : NWProtocolTCP . definition ) <nl> + expectNotNil ( metadata ) <nl> + expectTrue ( metadata is NWProtocolTCP . Metadata ) <nl> + <nl> + let tcpMetadata = metadata as ! NWProtocolTCP . Metadata <nl> + expectEqual ( tcpMetadata . availableReceiveBuffer , 0 ) <nl> + expectEqual ( tcpMetadata . availableSendBuffer , 0 ) <nl> + <nl> + / / Wait for viable <nl> + result = viableGroup . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + / / Wait for path <nl> + result = pathGroup . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + expectEqual ( connection . queue , testQueue ) <nl> + expectTrue ( connection . parameters . defaultProtocolStack . transportProtocol is NWProtocolTCP . Options ) <nl> + expectNotNil ( connection . endpoint ) <nl> + <nl> + sendGroup . enter ( ) <nl> + <nl> + let sendContent : Data = " hello " . data ( using : . utf8 ) ! <nl> + connection . send ( content : sendContent , isComplete : false , completion : . contentProcessed ( { ( sendError ) in <nl> + expectNil ( sendError ) <nl> + sendGroup . leave ( ) <nl> + } ) ) <nl> + <nl> + / / Wait for send <nl> + result = sendGroup . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + / / Wait for receive <nl> + result = receiveGroup . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + / / Send complete <nl> + connection . send ( content : sendContent , contentContext : . finalMessage , isComplete : true , completion : . idempotent ) <nl> + <nl> + group . enter ( ) <nl> + connection . cancel ( ) <nl> + <nl> + / / Wait for cancelled <nl> + result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + if let inboundConnection = inboundConnection { <nl> + inboundConnection . forceCancel ( ) <nl> + } <nl> + listener . cancel ( ) <nl> + } <nl> + <nl> + NetworkAPI . test ( " NWConnection UDP " ) <nl> + . skip ( . iOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . skip ( . tvOSSimulatorAny ( " Path not fully supported on simulator " ) ) <nl> + . code { <nl> + let testQueue = DispatchQueue ( label : " testQueue " ) <nl> + let group = DispatchGroup ( ) <nl> + let cancelGroup = DispatchGroup ( ) <nl> + let receiveGroup = DispatchGroup ( ) <nl> + <nl> + var inboundConnection : NWConnection ? = nil <nl> + let listener = try ! NWListener ( using : . udp , on : 4567 ) <nl> + expectNotNil ( listener ) <nl> + <nl> + listener . newConnectionHandler = { ( newConn ) in <nl> + expectNotNil ( newConn ) <nl> + inboundConnection = newConn <nl> + newConn . receive ( ) { ( receivedContent , context , isComplete , receivedError ) in <nl> + expectTrue ( isComplete ) <nl> + expectNil ( receivedError ) <nl> + expectNotNil ( receivedContent ) <nl> + expectNotNil ( context ) <nl> + receiveGroup . leave ( ) <nl> + } <nl> + newConn . start ( queue : testQueue ) <nl> + } <nl> + listener . start ( queue : testQueue ) <nl> + <nl> + let connection = NWConnection ( host : " localhost " , port : 4567 , using : . udp ) <nl> + expectNotNil ( connection ) <nl> + <nl> + connection . stateUpdateHandler = { ( newState ) in <nl> + switch ( newState ) { <nl> + case . ready : <nl> + group . leave ( ) <nl> + case . failed ( let error ) : <nl> + expectNotNil ( error ) <nl> + connection . cancel ( ) <nl> + case . cancelled : <nl> + cancelGroup . leave ( ) <nl> + default : <nl> + break <nl> + } <nl> + } <nl> + <nl> + group . enter ( ) <nl> + receiveGroup . enter ( ) <nl> + connection . start ( queue : testQueue ) <nl> + <nl> + / / Wait for ready <nl> + var result = group . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + expectEqual ( connection . queue , testQueue ) <nl> + expectTrue ( connection . parameters . defaultProtocolStack . transportProtocol is NWProtocolUDP . Options ) <nl> + expectNotNil ( connection . endpoint ) <nl> + <nl> + let ipMetadata = NWProtocolIP . Metadata ( ) <nl> + ipMetadata . ecn = . ect0 <nl> + let sendContext = NWConnection . ContentContext ( identifier : " sendHello " , expiration : 5000 , priority : 1 . 0 , isFinal : false , antecedent : nil , metadata : [ ipMetadata ] ) <nl> + <nl> + expectNotNil ( sendContext ) <nl> + expectNotNil ( sendContext . protocolMetadata ) <nl> + expectNil ( sendContext . antecedent ) <nl> + expectEqual ( sendContext . expirationMilliseconds , 5000 ) <nl> + expectEqual ( sendContext . relativePriority , 1 . 0 ) <nl> + expectEqual ( sendContext . isFinal , false ) <nl> + expectEqual ( sendContext . identifier , " sendHello " ) <nl> + <nl> + let sendContent : Data = " hello " . data ( using : . utf8 ) ! <nl> + <nl> + connection . batch { <nl> + connection . send ( content : sendContent , contentContext : sendContext , completion : . idempotent ) <nl> + } <nl> + <nl> + / / Wait for receive <nl> + result = receiveGroup . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + cancelGroup . enter ( ) <nl> + <nl> + connection . cancelCurrentEndpoint ( ) <nl> + connection . cancel ( ) <nl> + <nl> + / / Wait for cancelled <nl> + result = cancelGroup . wait ( timeout : DispatchTime . now ( ) + . seconds ( 10 ) ) <nl> + expectTrue ( result = = . success ) <nl> + <nl> + if let inboundConnection = inboundConnection { <nl> + inboundConnection . forceCancel ( ) <nl> + } <nl> + listener . cancel ( ) <nl> + } <nl> + } <nl> + <nl> + # endif <nl> mmm a / test / stdlib / UIKit . swift <nl> ppp b / test / stdlib / UIKit . swift <nl> <nl> / / RUN : % empty - directory ( % t ) <nl> / / RUN : % target - build - swift - swift - version 3 % s - o % t / a . out3 & & % target - run % t / a . out3 <nl> / / RUN : % target - build - swift - swift - version 4 % s - o % t / a . out4 & & % target - run % t / a . out4 <nl> + / / RUN : % target - build - swift - swift - version 4 . 2 % s - o % t / a . out4_2 & & % target - run % t / a . out4_2 <nl> / / REQUIRES : executable_test <nl> / / UNSUPPORTED : OS = macosx <nl> / / REQUIRES : objc_interop <nl> import StdlibUnittestFoundationExtras <nl> <nl> # if ! os ( watchOS ) & & ! os ( tvOS ) <nl> private func printDevice ( _ o : UIDeviceOrientation ) - > String { <nl> - var s = " \ ( o . isPortrait ) \ ( UIDeviceOrientationIsPortrait ( o ) ) , " <nl> - s + = " \ ( o . isLandscape ) \ ( UIDeviceOrientationIsLandscape ( o ) ) , " <nl> - s + = " \ ( o . isFlat ) , \ ( o . isValidInterfaceOrientation ) " <nl> - s + = " \ ( UIDeviceOrientationIsValidInterfaceOrientation ( o ) ) " <nl> - return s <nl> + return " \ ( o . isPortrait ) \ ( o . isLandscape ) \ ( o . isFlat ) \ ( o . isValidInterfaceOrientation ) " <nl> } <nl> <nl> private func printInterface ( _ o : UIInterfaceOrientation ) - > String { <nl> - return " \ ( o . isPortrait ) \ ( UIInterfaceOrientationIsPortrait ( o ) ) , " + <nl> - " \ ( o . isLandscape ) \ ( UIInterfaceOrientationIsLandscape ( o ) ) " <nl> + return " \ ( o . isPortrait ) \ ( o . isLandscape ) " <nl> } <nl> <nl> UIKitTests . test ( " UIDeviceOrientation " ) { <nl> - expectEqual ( " false false , false false , false , false false " , <nl> - printDevice ( . unknown ) ) <nl> - <nl> - expectEqual ( " true true , false false , false , true true " , <nl> - printDevice ( . portrait ) ) <nl> - <nl> - expectEqual ( " true true , false false , false , true true " , <nl> - printDevice ( . portraitUpsideDown ) ) <nl> - <nl> - expectEqual ( " false false , true true , false , true true " , <nl> - printDevice ( . landscapeLeft ) ) <nl> - <nl> - expectEqual ( " false false , true true , false , true true " , <nl> - printDevice ( . landscapeRight ) ) <nl> - <nl> - expectEqual ( " false false , false false , true , false false " , <nl> - printDevice ( . faceUp ) ) <nl> - <nl> - expectEqual ( " false false , false false , true , false false " , <nl> - printDevice ( . faceDown ) ) <nl> + expectEqual ( " false false false false " , printDevice ( . unknown ) ) <nl> + expectEqual ( " true false false true " , printDevice ( . portrait ) ) <nl> + expectEqual ( " true false false true " , printDevice ( . portraitUpsideDown ) ) <nl> + expectEqual ( " false true false true " , printDevice ( . landscapeLeft ) ) <nl> + expectEqual ( " false true false true " , printDevice ( . landscapeRight ) ) <nl> + expectEqual ( " false false true false " , printDevice ( . faceUp ) ) <nl> + expectEqual ( " false false true false " , printDevice ( . faceDown ) ) <nl> + # if ! swift ( > = 4 . 2 ) <nl> + / / Orientation functions should still be available <nl> + _ = UIDeviceOrientationIsLandscape <nl> + _ = UIDeviceOrientationIsPortrait <nl> + _ = UIDeviceOrientationIsValidInterfaceOrientation <nl> + # endif <nl> } <nl> <nl> UIKitTests . test ( " UIInterfaceOrientation " ) { <nl> - expectEqual ( " false false , false false " , <nl> - printInterface ( . unknown ) ) <nl> - <nl> - expectEqual ( " true true , false false " , <nl> - printInterface ( . portrait ) ) <nl> - <nl> - expectEqual ( " true true , false false " , <nl> - printInterface ( . portraitUpsideDown ) ) <nl> - <nl> - expectEqual ( " false false , true true " , <nl> - printInterface ( . landscapeLeft ) ) <nl> - <nl> - expectEqual ( " false false , true true " , <nl> - printInterface ( . landscapeRight ) ) <nl> - } <nl> + expectEqual ( " false false " , printInterface ( . unknown ) ) <nl> + expectEqual ( " true false " , printInterface ( . portrait ) ) <nl> + expectEqual ( " true false " , printInterface ( . portraitUpsideDown ) ) <nl> + expectEqual ( " false true " , printInterface ( . landscapeLeft ) ) <nl> + expectEqual ( " false true " , printInterface ( . landscapeRight ) ) <nl> + # if ! swift ( > = 4 . 2 ) <nl> + / / Orientation functions should still be available <nl> + _ = UIInterfaceOrientationIsLandscape <nl> + _ = UIInterfaceOrientationIsPortrait <nl> # endif <nl> + } <nl> + # endif / / ! os ( watchOS ) & & ! os ( tvOS ) <nl> <nl> UIKitTests . test ( " UIEdgeInsets " ) { <nl> let insets = [ <nl> UIKitTests . test ( " UIEdgeInsets " ) { <nl> UIEdgeInsets . zero <nl> ] <nl> checkEquatable ( insets , oracle : { $ 0 = = $ 1 } ) <nl> + expectFalse ( UIEdgeInsetsEqualToEdgeInsets ( insets [ 0 ] , insets [ 1 ] ) ) <nl> + } <nl> + <nl> + UIKitTests . test ( " NSDirectionalEdgeInsets " ) { <nl> + guard # available ( iOS 11 . 0 , tvOS 11 . 0 , watchOS 5 . 0 , * ) else { return } <nl> + let insets = [ <nl> + NSDirectionalEdgeInsets ( top : 1 . 0 , leading : 2 . 0 , bottom : 3 . 0 , trailing : 4 . 0 ) , <nl> + NSDirectionalEdgeInsets ( top : 1 . 0 , leading : 2 . 0 , bottom : 3 . 1 , trailing : 4 . 0 ) , <nl> + NSDirectionalEdgeInsets . zero <nl> + ] <nl> + checkEquatable ( insets , oracle : { $ 0 = = $ 1 } ) <nl> + / / NSDirectionalEdgeInsetsEqualToDirectionalEdgeInsets was never exposed in Swift <nl> } <nl> <nl> UIKitTests . test ( " UIOffset " ) { <nl> UIKitTests . test ( " UIOffset " ) { <nl> UIOffset . zero <nl> ] <nl> checkEquatable ( offsets , oracle : { $ 0 = = $ 1 } ) <nl> + expectFalse ( UIOffsetEqualToOffset ( offsets [ 0 ] , offsets [ 1 ] ) ) <nl> } <nl> <nl> + # if os ( iOS ) | | os ( tvOS ) <nl> + UIKitTests . test ( " UIFloatRange " ) { <nl> + guard # available ( iOS 9 . 0 , tvOS 9 . 0 , * ) else { return } <nl> + # if swift ( > = 4 . 2 ) <nl> + let zero = UIFloatRange . zero <nl> + # else <nl> + let zero = UIFloatRangeZero <nl> + # endif <nl> + <nl> + let ranges = [ <nl> + UIFloatRange ( minimum : 1 . 0 , maximum : 2 . 0 ) , <nl> + UIFloatRange ( minimum : 1 . 0 , maximum : 3 . 0 ) , <nl> + zero <nl> + ] <nl> + checkEquatable ( ranges , oracle : { $ 0 = = $ 1 } ) <nl> + expectFalse ( UIFloatRangeIsEqualToRange ( ranges [ 0 ] , ranges [ 1 ] ) ) <nl> + } <nl> + # endif <nl> + <nl> UIKitTests . test ( " UIFont . Weight " ) { <nl> guard # available ( iOS 8 . 2 , * ) else { return } <nl> # if swift ( > = 4 ) / / Swift 4 <nl> UIKitTests . test ( " UIContentSizeCategory comparison " ) { <nl> # if os ( iOS ) | | os ( watchOS ) | | os ( tvOS ) <nl> UIKitTests . test ( " UIFontMetrics scaling " ) { <nl> if # available ( iOS 11 . 0 , watchOS 4 . 0 , tvOS 11 . 0 , * ) { <nl> - let metrics = UIFontTextStyle . headline . metrics <nl> + let metrics = UIFont . TextStyle . headline . metrics <nl> expectTrue ( metrics ! = nil ) <nl> + # if ! swift ( > = 4 . 2 ) <nl> + _ = UIFontTextStyle . headline . metrics <nl> + # endif <nl> } <nl> } <nl> # endif <nl> UIKitTests . test ( " NSItemProviderReadingWriting support " ) { <nl> <nl> # endif <nl> <nl> + # if os ( iOS ) <nl> + UIKitTests . test ( " UIPrintError compatibility " ) { <nl> + # if swift ( > = 4 . 2 ) <nl> + _ = UIPrintError . Code . notAvailable <nl> + _ = UIPrintError . Code . noContent <nl> + _ = UIPrintError . Code . unknownImageFormat <nl> + _ = UIPrintError . Code . jobFailed <nl> + # else <nl> + _ = UIPrintingNotAvailableError <nl> + _ = UIPrintNoContentError <nl> + _ = UIPrintUnknownImageFormatError <nl> + _ = UIPrintJobFailedError <nl> + # endif <nl> + } <nl> + # endif <nl> + <nl> <nl> runAllTests ( ) <nl> mmm a / test / stdlib / os . swift <nl> ppp b / test / stdlib / os . swift <nl> if # available ( OSX 10 . 12 , iOS 10 . 0 , watchOS 3 . 0 , tvOS 10 . 0 , * ) { <nl> os_log ( " test " , log : newLog ) <nl> } <nl> } <nl> + <nl> + if # available ( macOS 10 . 14 , iOS 12 . 0 , watchOS 5 . 0 , tvOS 12 . 0 , * ) { <nl> + osAPI . test ( " signpost " ) { <nl> + let interestingLog = OSLog ( subsystem : " com . apple . example . swift " , <nl> + category : . pointsOfInterest ) <nl> + os_log ( . info , log : interestingLog , " a = % d b = % d c = % d " , 1 , 2 , 3 ) <nl> + os_signpost ( . event , log : interestingLog , name : " Basic Sans Message " ) <nl> + os_signpost ( . begin , log : interestingLog , name : " Basic Test " , " % d " , 42 ) <nl> + os_signpost ( . event , log : interestingLog , name : " Basic Test " , " % d " , 43 ) <nl> + os_signpost ( . end , log : interestingLog , name : " Basic Test " , " % d " , 44 ) <nl> + } <nl> + } <nl> mmm a / utils / build - script - impl <nl> ppp b / utils / build - script - impl <nl> function set_lldb_xcodebuild_options ( ) { <nl> LLDB_BUILD_DATE = " \ " $ { LLDB_BUILD_DATE } \ " " <nl> SYMROOT = " $ { lldb_build_dir } " <nl> OBJROOT = " $ { lldb_build_dir } " <nl> + - UseNewBuildSystem = NO <nl> $ { LLDB_EXTRA_XCODEBUILD_ARGS } <nl> ) <nl> if [ [ " $ { LLDB_NO_DEBUGSERVER } " ] ] ; then <nl>
Update master to build with Xcode 10 beta 1 , OS X 10 . 14 , iOS 12 , tvOS 12 , and watchOS 5 SDKs .
apple/swift
3f8ce7d2f9530584f98762151c24c7527f8ea96d
2018-06-05T06:14:19Z
mmm a / plugins / COMMUNITY . md <nl> ppp b / plugins / COMMUNITY . md <nl> Third parties are encouraged to make pull requests to this file ( ` develop ` branc <nl> <nl> | Description | URL | <nl> | mmmmmmmmm - - | mmm | <nl> - | Watch for specific actions and send them to an HTTP URL | https : / / github . com / eosauthority / eosio - watcher - plugin | <nl> + | ElasticSearch | https : / / github . com / EOSLaoMao / elasticsearch_plugin | <nl> | Kafka | https : / / github . com / TP - Lab / kafka_plugin | <nl> + | MySQL | https : / / github . com / eosBLACK / eosio_mysqldb_plugin | <nl> | SQL | https : / / github . com / asiniscalchi / eosio_sql_plugin | <nl> - | ElasticSearch | https : / / github . com / EOSLaoMao / elasticsearch_plugin | <nl> + | Watch for specific actions and send them to an HTTP URL | https : / / github . com / eosauthority / eosio - watcher - plugin | <nl> | ZeroMQ | https : / / github . com / cc32d9 / eos_zmq_plugin | <nl> <nl> # # DISCLAIMER : <nl>
Merge pull request from eosBLACK / develop
EOSIO/eos
d9982e3f265fd6a2236d6d656890adcb66ac0e3c
2018-10-05T12:57:58Z
mmm a / tests / bash - bats / eosio_build . sh <nl> ppp b / tests / bash - bats / eosio_build . sh <nl> TEST_LABEL = " [ eosio_build ] " <nl> run bash - c " . / eosio_build . sh - y - P " <nl> [ [ ! - z $ ( echo " $ { output } " | grep " PIN_COMPILER : true " ) ] ] | | exit <nl> # Ensure build - essentials is installed so we can compile cmake , clang , boost , etc <nl> - if [ [ $ NAME = = " Ubuntu " ] ] ; then <nl> + if [ [ $ VERSION_ID = = " 16 . 04 " ] ] ; then <nl> [ [ ! - z $ ( echo " $ { output } " | grep " Installed build - essential " ) ] ] | | exit <nl> fi <nl> [ [ " $ { output } " = ~ - DCMAKE_TOOLCHAIN_FILE = \ ' . * / scripts / . . / build / pinned_toolchain . cmake \ ' ] ] | | exit <nl>
quick fix
EOSIO/eos
d00eb75caf367d388d92d82998715eb2910b7aa3
2019-06-25T00:22:43Z
mmm a / lib / SIL / SILOwnershipVerifier . cpp <nl> ppp b / lib / SIL / SILOwnershipVerifier . cpp <nl> <nl> <nl> # define DEBUG_TYPE " sil - ownership - verifier " <nl> <nl> + # include " UseOwnershipRequirement . h " <nl> # include " swift / AST / ASTContext . h " <nl> # include " swift / AST / AnyFunctionRef . h " <nl> # include " swift / AST / Decl . h " <nl> <nl> # include " swift / Basic / STLExtras . h " <nl> # include " swift / Basic / TransformArrayRef . h " <nl> # include " swift / ClangImporter / ClangModule . h " <nl> + # include " swift / SIL / BasicBlockUtils . h " <nl> # include " swift / SIL / Dominance . h " <nl> # include " swift / SIL / DynamicCasts . h " <nl> # include " swift / SIL / OwnershipChecker . h " <nl> <nl> # include " swift / SIL / SILOpenedArchetypesTracker . h " <nl> # include " swift / SIL / SILVTable . h " <nl> # include " swift / SIL / SILVisitor . h " <nl> - # include " swift / SIL / BasicBlockUtils . h " <nl> # include " swift / SIL / TypeLowering . h " <nl> # include " llvm / ADT / DenseSet . h " <nl> # include " llvm / ADT / PostOrderIterator . h " <nl> struct ErrorBehaviorKind { <nl> struct OwnershipUseCheckerResult { <nl> bool HasCompatibleOwnership ; <nl> bool ShouldCheckForDataflowViolations ; <nl> + <nl> + OwnershipUseCheckerResult ( bool HasCompatibleOwnership , <nl> + UseLifetimeConstraint OwnershipRequirement ) <nl> + : HasCompatibleOwnership ( HasCompatibleOwnership ) , <nl> + ShouldCheckForDataflowViolations ( bool ( OwnershipRequirement ) ) { } <nl> } ; <nl> <nl> class OwnershipCompatibilityUseChecker <nl> class OwnershipCompatibilityUseChecker <nl> OwnershipUseCheckerResult <nl> visitNonTrivialEnum ( EnumDecl * E , ValueOwnershipKind RequiredConvention ) ; <nl> OwnershipUseCheckerResult <nl> - visitApplyParameter ( ValueOwnershipKind RequiredConvention , bool ShouldCheck ) ; <nl> + visitApplyParameter ( ValueOwnershipKind RequiredConvention , <nl> + UseLifetimeConstraint Requirement ) ; <nl> OwnershipUseCheckerResult <nl> visitFullApply ( FullApplySite apply ) ; <nl> <nl> NO_OPERAND_INST ( KeyPath ) <nl> # undef NO_OPERAND_INST <nl> <nl> / / / Instructions whose arguments are always compatible with one convention . <nl> - # define CONSTANT_OWNERSHIP_INST ( OWNERSHIP , \ <nl> - SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS , INST ) \ <nl> + # define CONSTANT_OWNERSHIP_INST ( OWNERSHIP , USE_LIFETIME_CONSTRAINT , INST ) \ <nl> OwnershipUseCheckerResult \ <nl> OwnershipCompatibilityUseChecker : : visit # # INST # # Inst ( INST # # Inst * I ) { \ <nl> assert ( I - > getNumOperands ( ) & & " Expected to have non - zero operands " ) ; \ <nl> NO_OPERAND_INST ( KeyPath ) <nl> } \ <nl> \ <nl> return { compatibleWithOwnership ( ValueOwnershipKind : : OWNERSHIP ) , \ <nl> - SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS } ; \ <nl> - } <nl> - CONSTANT_OWNERSHIP_INST ( Guaranteed , false , RefElementAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , AutoreleaseValue ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , DeallocBox ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , DeallocExistentialBox ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , DeallocRef ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , DestroyValue ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , ReleaseValue ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , ReleaseValueAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , StrongRelease ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , StrongUnpin ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , UnownedRelease ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , InitExistentialRef ) <nl> - CONSTANT_OWNERSHIP_INST ( Owned , true , EndLifetime ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , AddressToPointer ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , BeginAccess ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , BeginUnpairedAccess ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , BindMemory ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , CheckedCastAddrBranch ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , CondFail ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , CopyAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , DeallocStack ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , DebugValueAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , DeinitExistentialAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , DestroyAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , EndAccess ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , EndUnpairedAccess ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , IndexAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , IndexRawPointer ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , InitBlockStorageHeader ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , InitEnumDataAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , InitExistentialAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , InitExistentialMetatype ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , InjectEnumAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , IsNonnull ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , IsUnique ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , IsUniqueOrPinned ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , Load ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , LoadBorrow ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , LoadUnowned ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , LoadWeak ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , MarkFunctionEscape ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , MarkUninitializedBehavior ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ObjCExistentialMetatypeToObject ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ObjCMetatypeToObject ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ObjCToThickMetatype ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , OpenExistentialAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , OpenExistentialMetatype ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , PointerToAddress ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , PointerToThinFunction ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ProjectBlockStorage ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ProjectValueBuffer ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , RawPointerToRef ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , SelectEnumAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , SelectValue ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , StructElementAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , SwitchEnumAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , SwitchValue ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , TailAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ThickToObjCMetatype ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ThinFunctionToPointer ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , ThinToThickFunction ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , TupleElementAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , UncheckedAddrCast ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , UncheckedRefCastAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , UncheckedTakeEnumDataAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , UnconditionalCheckedCastAddr ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , UnmanagedToRef ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , AllocValueBuffer ) <nl> - CONSTANT_OWNERSHIP_INST ( Trivial , false , DeallocValueBuffer ) <nl> + UseLifetimeConstraint : : USE_LIFETIME_CONSTRAINT } ; \ <nl> + } <nl> + CONSTANT_OWNERSHIP_INST ( Guaranteed , MustBeLive , RefElementAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , AutoreleaseValue ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , DeallocBox ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , DeallocExistentialBox ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , DeallocRef ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , DestroyValue ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , ReleaseValue ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , ReleaseValueAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , StrongRelease ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , StrongUnpin ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , UnownedRelease ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , InitExistentialRef ) <nl> + CONSTANT_OWNERSHIP_INST ( Owned , MustBeInvalidated , EndLifetime ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , AddressToPointer ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , BeginAccess ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , BeginUnpairedAccess ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , BindMemory ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , CheckedCastAddrBranch ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , CondFail ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , CopyAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , DeallocStack ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , DebugValueAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , DeinitExistentialAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , DestroyAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , EndAccess ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , EndUnpairedAccess ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , IndexAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , IndexRawPointer ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , InitBlockStorageHeader ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , InitEnumDataAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , InitExistentialAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , InitExistentialMetatype ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , InjectEnumAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , IsNonnull ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , IsUnique ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , IsUniqueOrPinned ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , Load ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , LoadBorrow ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , LoadUnowned ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , LoadWeak ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , MarkFunctionEscape ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , MarkUninitializedBehavior ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ObjCExistentialMetatypeToObject ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ObjCMetatypeToObject ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ObjCToThickMetatype ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , OpenExistentialAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , OpenExistentialMetatype ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , PointerToAddress ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , PointerToThinFunction ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ProjectBlockStorage ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ProjectValueBuffer ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , RawPointerToRef ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , SelectEnumAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , SelectValue ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , StructElementAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , SwitchEnumAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , SwitchValue ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , TailAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ThickToObjCMetatype ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ThinFunctionToPointer ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , ThinToThickFunction ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , TupleElementAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , UncheckedAddrCast ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , UncheckedRefCastAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , UncheckedTakeEnumDataAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , UnconditionalCheckedCastAddr ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , UnmanagedToRef ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , AllocValueBuffer ) <nl> + CONSTANT_OWNERSHIP_INST ( Trivial , MustBeLive , DeallocValueBuffer ) <nl> # undef CONSTANT_OWNERSHIP_INST <nl> <nl> / / / Instructions whose arguments are always compatible with one convention . <nl> - # define CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( OWNERSHIP , \ <nl> - SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS , INST ) \ <nl> + # define CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( OWNERSHIP , USE_LIFETIME_CONSTRAINT , \ <nl> + INST ) \ <nl> OwnershipUseCheckerResult \ <nl> OwnershipCompatibilityUseChecker : : visit # # INST # # Inst ( INST # # Inst * I ) { \ <nl> assert ( I - > getNumOperands ( ) & & " Expected to have non - zero operands " ) ; \ <nl> CONSTANT_OWNERSHIP_INST ( Trivial , false , DeallocValueBuffer ) <nl> assert ( isAddressOrTrivialType ( ) & & \ <nl> " Trivial ownership requires a trivial type or an address " ) ; \ <nl> } \ <nl> - \ <nl> - if ( compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) ) { \ <nl> - return { true , false } ; \ <nl> - } \ <nl> + \ <nl> + if ( compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) ) { \ <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; \ <nl> + } \ <nl> return { compatibleWithOwnership ( ValueOwnershipKind : : OWNERSHIP ) , \ <nl> - SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS } ; \ <nl> - } <nl> - CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , true , CheckedCastValueBranch ) <nl> - CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , true , UnconditionalCheckedCastValue ) <nl> - CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , true , InitExistentialValue ) <nl> - CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , true , DeinitExistentialValue ) <nl> + UseLifetimeConstraint : : USE_LIFETIME_CONSTRAINT } ; \ <nl> + } <nl> + CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , MustBeInvalidated , <nl> + CheckedCastValueBranch ) <nl> + CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , MustBeInvalidated , <nl> + UnconditionalCheckedCastValue ) <nl> + CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , MustBeInvalidated , <nl> + InitExistentialValue ) <nl> + CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Owned , MustBeInvalidated , <nl> + DeinitExistentialValue ) <nl> # undef CONSTANT_OR_TRIVIAL_OWNERSHIP_INST <nl> <nl> # define ACCEPTS_ANY_OWNERSHIP_INST ( INST ) \ <nl> OwnershipUseCheckerResult \ <nl> OwnershipCompatibilityUseChecker : : visit # # INST # # Inst ( INST # # Inst * I ) { \ <nl> - return { true , false } ; \ <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; \ <nl> } <nl> ACCEPTS_ANY_OWNERSHIP_INST ( BeginBorrow ) <nl> ACCEPTS_ANY_OWNERSHIP_INST ( CopyValue ) <nl> ACCEPTS_ANY_OWNERSHIP_INST ( UncheckedOwnershipConversion ) <nl> # undef ACCEPTS_ANY_OWNERSHIP_INST <nl> <nl> / / Trivial if trivial typed , otherwise must accept owned ? <nl> - # define ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE ( \ <nl> - SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS , INST ) \ <nl> + # define ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE ( USE_LIFETIME_CONSTRAINT , \ <nl> + INST ) \ <nl> OwnershipUseCheckerResult \ <nl> OwnershipCompatibilityUseChecker : : visit # # INST # # Inst ( INST # # Inst * I ) { \ <nl> assert ( I - > getNumOperands ( ) & & " Expected to have non - zero operands " ) ; \ <nl> if ( getType ( ) . is < AnyMetatypeType > ( ) ) { \ <nl> - return { true , false } ; \ <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; \ <nl> } \ <nl> bool compatible = hasExactOwnership ( ValueOwnershipKind : : Any ) | | \ <nl> ! compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) ; \ <nl> - return { compatible , SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS } ; \ <nl> + return { compatible , UseLifetimeConstraint : : USE_LIFETIME_CONSTRAINT } ; \ <nl> } <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE ( false , ClassMethod ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE ( MustBeLive , ClassMethod ) <nl> # undef ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP_OR_METATYPE <nl> <nl> / / Trivial if trivial typed , otherwise must accept owned ? <nl> - # define ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS , \ <nl> - INST ) \ <nl> + # define ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( USE_LIFETIME_CONSTRAINT , INST ) \ <nl> OwnershipUseCheckerResult \ <nl> OwnershipCompatibilityUseChecker : : visit # # INST # # Inst ( INST # # Inst * I ) { \ <nl> assert ( I - > getNumOperands ( ) & & " Expected to have non - zero operands " ) ; \ <nl> bool compatible = hasExactOwnership ( ValueOwnershipKind : : Any ) | | \ <nl> ! compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) ; \ <nl> - return { compatible , SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS } ; \ <nl> - } <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , SuperMethod ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , BridgeObjectToWord ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , CopyBlock ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , DynamicMethod ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , OpenExistentialBox ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , OpenExistentialBoxValue ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , RefTailAddr ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , RefToRawPointer ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , RefToUnmanaged ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , RefToUnowned ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , SetDeallocating ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , StrongPin ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , UnownedToRef ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , CopyUnownedValue ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , ProjectExistentialBox ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , UnmanagedRetainValue ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , UnmanagedReleaseValue ) <nl> - ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( false , UnmanagedAutoreleaseValue ) <nl> + return { compatible , UseLifetimeConstraint : : USE_LIFETIME_CONSTRAINT } ; \ <nl> + } <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , SuperMethod ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , BridgeObjectToWord ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , CopyBlock ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , DynamicMethod ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , OpenExistentialBox ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , OpenExistentialBoxValue ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , RefTailAddr ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , RefToRawPointer ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , RefToUnmanaged ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , RefToUnowned ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , SetDeallocating ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , StrongPin ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , UnownedToRef ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , CopyUnownedValue ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , ProjectExistentialBox ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , UnmanagedRetainValue ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , UnmanagedReleaseValue ) <nl> + ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP ( MustBeLive , UnmanagedAutoreleaseValue ) <nl> # undef ACCEPTS_ANY_NONTRIVIAL_OWNERSHIP <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitForwardingInst ( SILInstruction * I , ArrayRe <nl> <nl> / / All trivial . <nl> if ( Iter = = Ops . end ( ) ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> unsigned Index = std : : distance ( Ops . begin ( ) , Iter ) ; <nl> OwnershipCompatibilityUseChecker : : visitForwardingInst ( SILInstruction * I , ArrayRe <nl> <nl> auto MergedValue = Base . merge ( OpKind . Value ) ; <nl> if ( ! MergedValue . hasValue ( ) ) { <nl> - return { false , true } ; <nl> + return { false , UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> Base = MergedValue . getValue ( ) ; <nl> } <nl> <nl> / / We only need to treat a forwarded instruction as a lifetime ending use of <nl> / / it is owned . <nl> - return { true , hasExactOwnership ( ValueOwnershipKind : : Owned ) } ; <nl> + auto lifetimeConstraint = hasExactOwnership ( ValueOwnershipKind : : Owned ) <nl> + ? UseLifetimeConstraint : : MustBeInvalidated <nl> + : UseLifetimeConstraint : : MustBeLive ; <nl> + return { true , lifetimeConstraint } ; <nl> } <nl> <nl> # define FORWARD_ANY_OWNERSHIP_INST ( INST ) \ <nl> FORWARD_ANY_OWNERSHIP_INST ( UncheckedEnumData ) <nl> <nl> / / An instruction that forwards a constant ownership or trivial ownership . <nl> # define FORWARD_CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( \ <nl> - OWNERSHIP , SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS , INST ) \ <nl> + OWNERSHIP , USE_LIFETIME_CONSTRAINT , INST ) \ <nl> OwnershipUseCheckerResult \ <nl> OwnershipCompatibilityUseChecker : : visit # # INST # # Inst ( INST # # Inst * I ) { \ <nl> assert ( I - > getNumOperands ( ) & & " Expected to have non - zero operands " ) ; \ <nl> FORWARD_ANY_OWNERSHIP_INST ( UncheckedEnumData ) <nl> hasExactOwnership ( ValueOwnershipKind : : Trivial ) ) { \ <nl> assert ( isAddressOrTrivialType ( ) & & \ <nl> " Trivial ownership requires a trivial type or an address " ) ; \ <nl> - return { true , false } ; \ <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; \ <nl> } \ <nl> if ( ValueOwnershipKind : : OWNERSHIP = = ValueOwnershipKind : : Trivial ) { \ <nl> assert ( isAddressOrTrivialType ( ) & & \ <nl> FORWARD_ANY_OWNERSHIP_INST ( UncheckedEnumData ) <nl> } \ <nl> \ <nl> return { compatibleWithOwnership ( ValueOwnershipKind : : OWNERSHIP ) , \ <nl> - SHOULD_CHECK_FOR_DATAFLOW_VIOLATIONS } ; \ <nl> + UseLifetimeConstraint : : USE_LIFETIME_CONSTRAINT } ; \ <nl> } <nl> - FORWARD_CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Guaranteed , false , TupleExtract ) <nl> - FORWARD_CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Guaranteed , false , StructExtract ) <nl> + FORWARD_CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Guaranteed , MustBeLive , TupleExtract ) <nl> + FORWARD_CONSTANT_OR_TRIVIAL_OWNERSHIP_INST ( Guaranteed , MustBeLive , <nl> + StructExtract ) <nl> # undef CONSTANT_OR_TRIVIAL_OWNERSHIP_INST <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitDeallocPartialRefInst ( <nl> DeallocPartialRefInst * I ) { <nl> if ( getValue ( ) = = I - > getInstance ( ) ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitEndBorrowArgumentInst ( <nl> / / If we are currently checking an end_borrow_argument as a subobject , then we <nl> / / treat this as just a use . <nl> if ( isCheckingSubObject ( ) ) <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> <nl> / / Otherwise , we must be checking an actual argument . Make sure it is guaranteed ! <nl> - return { true , hasExactOwnership ( ValueOwnershipKind : : Guaranteed ) } ; <nl> + auto lifetimeConstraint = hasExactOwnership ( ValueOwnershipKind : : Guaranteed ) <nl> + ? UseLifetimeConstraint : : MustBeInvalidated <nl> + : UseLifetimeConstraint : : MustBeLive ; <nl> + return { true , lifetimeConstraint } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitSelectEnumInst ( SelectEnumInst * I ) { <nl> if ( getValue ( ) = = I - > getEnumOperand ( ) ) { <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> return visitForwardingInst ( I , I - > getAllOperands ( ) . drop_front ( ) ) ; <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitAllocRefInst ( AllocRefInst * I ) { <nl> assert ( I - > getNumOperands ( ) ! = 0 <nl> & & " If we reach this point , we must have a tail operand " ) ; <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitAllocRefDynamicInst ( <nl> AllocRefDynamicInst * I ) { <nl> assert ( I - > getNumOperands ( ) ! = 0 & & <nl> " If we reach this point , we must have a tail operand " ) ; <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : checkTerminatorArgumentMatchesDestBB ( <nl> / / Then if we do not have an enum , make sure that the conventions match . <nl> EnumDecl * E = getType ( ) . getEnumOrBoundGenericEnum ( ) ; <nl> if ( ! E ) { <nl> - return { compatibleWithOwnership ( DestBlockArgOwnershipKind ) , <nl> - hasExactOwnership ( ValueOwnershipKind : : Owned ) } ; <nl> + bool matches = compatibleWithOwnership ( DestBlockArgOwnershipKind ) ; <nl> + auto lifetimeConstraint = hasExactOwnership ( ValueOwnershipKind : : Owned ) <nl> + ? UseLifetimeConstraint : : MustBeInvalidated <nl> + : UseLifetimeConstraint : : MustBeLive ; <nl> + return { matches , lifetimeConstraint } ; <nl> } <nl> <nl> return visitNonTrivialEnum ( E , DestBlockArgOwnershipKind ) ; <nl> OwnershipCompatibilityUseChecker : : visitCondBranchInst ( CondBranchInst * CBI ) { <nl> / / If our conditional branch is the condition , it is trivial . Check that the <nl> / / ownership kind is trivial . <nl> if ( CBI - > isConditionOperandIndex ( getOperandIndex ( ) ) ) <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> <nl> / / Otherwise , make sure that our operand matches the <nl> if ( CBI - > isTrueOperandIndex ( getOperandIndex ( ) ) ) { <nl> OwnershipCompatibilityUseChecker : : visitTransformingTerminatorInst ( <nl> TermInst * TI ) { <nl> / / If our operand was trivial , return early . <nl> if ( compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) ) <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> <nl> / / Then we need to go through all of our destinations and make sure that if <nl> / / they have a payload , the payload ' s convention matches our <nl> OwnershipCompatibilityUseChecker : : visitTransformingTerminatorInst ( <nl> <nl> / / Finally , if everything lines up , emit that we match and are a lifetime <nl> / / ending point if we are owned . <nl> - return { true , hasExactOwnership ( ValueOwnershipKind : : Owned ) } ; <nl> + auto lifetimeConstraint = hasExactOwnership ( ValueOwnershipKind : : Owned ) <nl> + ? UseLifetimeConstraint : : MustBeInvalidated <nl> + : UseLifetimeConstraint : : MustBeLive ; <nl> + return { true , lifetimeConstraint } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitReturnInst ( ReturnInst * RI ) { <nl> SILFunctionConventions fnConv = RI - > getFunction ( ) - > getConventions ( ) ; <nl> auto Results = fnConv . getDirectSILResults ( ) ; <nl> if ( Results . empty ( ) | | IsTrivial ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> CanGenericSignature Sig = fnConv . funcTy - > getGenericSignature ( ) ; <nl> OwnershipCompatibilityUseChecker : : visitReturnInst ( ReturnInst * RI ) { <nl> / / If we fail to merge all types in , bail . We can not come up with a proper <nl> / / result type . <nl> if ( ! MergedValue . hasValue ( ) ) { <nl> - return { false , false } ; <nl> + return { false , UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> / / In case Base is Any . <nl> Base = MergedValue . getValue ( ) ; <nl> OwnershipCompatibilityUseChecker : : visitReturnInst ( ReturnInst * RI ) { <nl> return visitNonTrivialEnum ( E , Base ) ; <nl> } <nl> <nl> - return { compatibleWithOwnership ( Base ) , true } ; <nl> + return { compatibleWithOwnership ( Base ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitEndBorrowInst ( EndBorrowInst * I ) { <nl> / / We do not consider the original value to be a verified use . But the value <nl> / / does need to be alive . <nl> if ( getOperandIndex ( ) = = EndBorrowInst : : OriginalValue ) <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> / / The borrowed value is a verified use though of the begin_borrow . <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Guaranteed ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Guaranteed ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitThrowInst ( ThrowInst * I ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitStoreUnownedInst ( StoreUnownedInst * I ) { <nl> if ( getValue ( ) = = I - > getSrc ( ) ) <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitStoreWeakInst ( StoreWeakInst * I ) { <nl> / / A store_weak instruction implies that the value to be stored to be live , <nl> / / but it does not touch the strong reference count of the value . <nl> if ( getValue ( ) = = I - > getSrc ( ) ) <nl> - return { true , false } ; <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitStoreBorrowInst ( StoreBorrowInst * I ) { <nl> if ( getValue ( ) = = I - > getSrc ( ) ) <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Guaranteed ) , false } ; <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Guaranteed ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> / / FIXME : Why not use SILArgumentConvention here ? <nl> OwnershipUseCheckerResult OwnershipCompatibilityUseChecker : : visitCallee ( <nl> case ParameterConvention : : Indirect_In_Constant : <nl> assert ( ! SILModuleConventions ( Mod ) . isSILIndirect ( <nl> SILParameterInfo ( SubstCalleeType , Conv ) ) ) ; <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> case ParameterConvention : : Indirect_In_Guaranteed : <nl> assert ( ! SILModuleConventions ( Mod ) . isSILIndirect ( <nl> SILParameterInfo ( SubstCalleeType , Conv ) ) ) ; <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> case ParameterConvention : : Indirect_Inout : <nl> case ParameterConvention : : Indirect_InoutAliasable : <nl> llvm_unreachable ( " Illegal convention for callee " ) ; <nl> case ParameterConvention : : Direct_Unowned : <nl> if ( isAddressOrTrivialType ( ) ) <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> / / We accept unowned , owned , and guaranteed in unowned positions . <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> case ParameterConvention : : Direct_Owned : <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> case ParameterConvention : : Direct_Guaranteed : <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Guaranteed ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Guaranteed ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> llvm_unreachable ( " Unhandled ParameterConvention in switch . " ) ; <nl> OwnershipUseCheckerResult OwnershipCompatibilityUseChecker : : visitNonTrivialEnum ( <nl> / / If we have all trivial cases , make sure we are compatible with a trivial <nl> / / ownership kind . <nl> if ( ! HasNonTrivialCase ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> / / Otherwise , if this value is a trivial ownership kind , return . <nl> if ( compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) ) { <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> / / And finally finish by making sure that if we have a non - trivial ownership <nl> / / kind that it matches the argument ' s convention . <nl> - return { compatibleWithOwnership ( RequiredKind ) , <nl> - hasExactOwnership ( ValueOwnershipKind : : Owned ) } ; <nl> + auto lifetimeConstraint = hasExactOwnership ( ValueOwnershipKind : : Owned ) <nl> + ? UseLifetimeConstraint : : MustBeInvalidated <nl> + : UseLifetimeConstraint : : MustBeLive ; <nl> + return { compatibleWithOwnership ( RequiredKind ) , lifetimeConstraint } ; <nl> } <nl> <nl> / / We allow for trivial cases of enums with non - trivial cases to be passed in <nl> / / non - trivial argument positions . This fits with modeling of a <nl> / / SILFunctionArgument as a phi in a global program graph . <nl> - OwnershipUseCheckerResult <nl> - OwnershipCompatibilityUseChecker : : visitApplyParameter ( ValueOwnershipKind Kind , <nl> - bool ShouldCheck ) { <nl> + OwnershipUseCheckerResult OwnershipCompatibilityUseChecker : : visitApplyParameter ( <nl> + ValueOwnershipKind Kind , UseLifetimeConstraint Requirement ) { <nl> / / Check if we have an enum . If not , then we just check against the passed in <nl> / / convention . <nl> EnumDecl * E = getType ( ) . getEnumOrBoundGenericEnum ( ) ; <nl> if ( ! E ) { <nl> - return { compatibleWithOwnership ( Kind ) , ShouldCheck } ; <nl> + return { compatibleWithOwnership ( Kind ) , Requirement } ; <nl> } <nl> return visitNonTrivialEnum ( E , Kind ) ; <nl> } <nl> visitFullApply ( FullApplySite apply ) { <nl> <nl> / / Indirect return arguments are address types . <nl> if ( isAddressOrTrivialType ( ) ) <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> <nl> unsigned argIndex = apply . getCalleeArgIndex ( Op ) ; <nl> SILParameterInfo paramInfo = <nl> visitFullApply ( FullApplySite apply ) { <nl> switch ( paramInfo . getConvention ( ) ) { <nl> case ParameterConvention : : Indirect_In : <nl> case ParameterConvention : : Direct_Owned : <nl> - return visitApplyParameter ( ValueOwnershipKind : : Owned , true ) ; <nl> + return visitApplyParameter ( ValueOwnershipKind : : Owned , <nl> + UseLifetimeConstraint : : MustBeInvalidated ) ; <nl> case ParameterConvention : : Indirect_In_Constant : <nl> case ParameterConvention : : Direct_Unowned : <nl> / / We accept unowned , owned , and guaranteed in unowned positions . <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> case ParameterConvention : : Indirect_In_Guaranteed : <nl> case ParameterConvention : : Direct_Guaranteed : <nl> - return visitApplyParameter ( ValueOwnershipKind : : Guaranteed , false ) ; <nl> + return visitApplyParameter ( ValueOwnershipKind : : Guaranteed , <nl> + UseLifetimeConstraint : : MustBeLive ) ; <nl> / / The following conventions should take address types . <nl> case ParameterConvention : : Indirect_Inout : <nl> case ParameterConvention : : Indirect_InoutAliasable : <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitPartialApplyInst ( PartialApplyInst * I ) { <nl> / / All non - trivial types should be captured . <nl> if ( isAddressOrTrivialType ( ) ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitAssignInst ( AssignInst * I ) { <nl> if ( getValue ( ) = = I - > getSrc ( ) ) { <nl> if ( isAddressOrTrivialType ( ) ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitStoreInst ( StoreInst * I ) { <nl> if ( getValue ( ) = = I - > getSrc ( ) ) { <nl> if ( isAddressOrTrivialType ( ) ) { <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , false } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Trivial ) , <nl> + UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> - return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , true } ; <nl> + return { compatibleWithOwnership ( ValueOwnershipKind : : Owned ) , <nl> + UseLifetimeConstraint : : MustBeInvalidated } ; <nl> } <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> OwnershipUseCheckerResult <nl> OwnershipCompatibilityUseChecker : : visitMarkDependenceInst ( <nl> MarkDependenceInst * MDI ) { <nl> / / We always treat mark dependence as a use that keeps a value alive . We will <nl> / / be introducing a begin_dependence / end_dependence version of this later . <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> class OwnershipCompatibilityBuiltinUseChecker <nl> llvm : : Intrinsic : : ID ID ) { <nl> / / LLVM intrinsics do not traffic in ownership , so if we have a result , it <nl> / / must be trivial . <nl> - return { true , false } ; <nl> + return { true , UseLifetimeConstraint : : MustBeLive } ; <nl> } <nl> <nl> # define BUILTIN ( ID , NAME , ATTRS ) \ <nl> class OwnershipCompatibilityBuiltinUseChecker <nl> / / This is correct today since we do not have any builtins which return <nl> / / @ guaranteed parameters . This means that we can only have a lifetime ending <nl> / / use with our builtins if it is owned . <nl> - # define CONSTANT_OWNERSHIP_BUILTIN ( OWNERSHIP , LIFETIME_ENDING_USE , ID ) \ <nl> + # define CONSTANT_OWNERSHIP_BUILTIN ( OWNERSHIP , USE_LIFETIME_CONSTRAINT , ID ) \ <nl> OwnershipUseCheckerResult \ <nl> OwnershipCompatibilityBuiltinUseChecker : : visit # # ID ( BuiltinInst * BI , \ <nl> StringRef Attr ) { \ <nl> return { compatibleWithOwnership ( ValueOwnershipKind : : OWNERSHIP ) , \ <nl> - LIFETIME_ENDING_USE } ; \ <nl> - } <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Owned , false , ErrorInMain ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Owned , false , UnexpectedError ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Owned , false , WillThrow ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Owned , true , UnsafeGuaranteed ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , AShr ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Add ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Alignof ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , AllocRaw ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , And ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , AssertConf ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , AssumeNonNegative ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , AtomicLoad ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , AtomicRMW ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , AtomicStore ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , BitCast ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , CanBeObjCClass ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , CmpXChg ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , CondUnreachable ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , CopyArray ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , DeallocRaw ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , DestroyArray ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ExactSDiv ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ExactUDiv ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ExtractElement ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FAdd ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_OEQ ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_OGE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_OGT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_OLE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_OLT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_ONE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_ORD ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_UEQ ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_UGE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_UGT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_ULE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_ULT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_UNE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FCMP_UNO ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FDiv ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FMul ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FNeg ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FPExt ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FPToSI ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FPToUI ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FPTrunc ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FRem ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , FSub ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Fence ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , GetObjCTypeEncoding ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_EQ ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_NE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_SGE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_SGT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_SLE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_SLT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_UGE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_UGT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_ULE ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ICMP_ULT ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , InsertElement ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , IntToFPWithOverflow ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , IntToPtr ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , IsOptionalType ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , IsPOD ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , IsSameMetatype ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , LShr ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Mul ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , OnFastPath ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Once ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , OnceWithContext ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Or ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , PtrToInt ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SAddOver ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SDiv ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SExt ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SExtOrBitCast ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SIToFP ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SMulOver ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SRem ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SSubOver ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SToSCheckedTrunc ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SToUCheckedTrunc ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , SUCheckedConversion ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Shl ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Sizeof ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , StaticReport ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Strideof ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Sub ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , TakeArrayBackToFront ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , TakeArrayFrontToBack ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Trunc ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , TruncOrBitCast ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , TSanInoutAccess ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , UAddOver ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , UDiv ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , UIToFP ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , UMulOver ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , URem ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , USCheckedConversion ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , USubOver ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , UToSCheckedTrunc ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , UToUCheckedTrunc ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Unreachable ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , UnsafeGuaranteedEnd ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Xor ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ZExt ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ZExtOrBitCast ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , ZeroInitializer ) <nl> - CONSTANT_OWNERSHIP_BUILTIN ( Trivial , false , Swift3ImplicitObjCEntrypoint ) <nl> + UseLifetimeConstraint : : USE_LIFETIME_CONSTRAINT } ; \ <nl> + } <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Owned , MustBeLive , ErrorInMain ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Owned , MustBeLive , UnexpectedError ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Owned , MustBeLive , WillThrow ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Owned , MustBeInvalidated , UnsafeGuaranteed ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , AShr ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Add ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Alignof ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , AllocRaw ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , And ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , AssertConf ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , AssumeNonNegative ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , AtomicLoad ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , AtomicRMW ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , AtomicStore ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , BitCast ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , CanBeObjCClass ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , CmpXChg ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , CondUnreachable ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , CopyArray ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , DeallocRaw ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , DestroyArray ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ExactSDiv ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ExactUDiv ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ExtractElement ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FAdd ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_OEQ ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_OGE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_OGT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_OLE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_OLT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_ONE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_ORD ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_UEQ ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_UGE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_UGT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_ULE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_ULT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_UNE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FCMP_UNO ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FDiv ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FMul ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FNeg ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FPExt ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FPToSI ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FPToUI ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FPTrunc ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FRem ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , FSub ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Fence ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , GetObjCTypeEncoding ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_EQ ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_NE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_SGE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_SGT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_SLE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_SLT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_UGE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_UGT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_ULE ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ICMP_ULT ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , InsertElement ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , IntToFPWithOverflow ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , IntToPtr ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , IsOptionalType ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , IsPOD ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , IsSameMetatype ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , LShr ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Mul ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , OnFastPath ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Once ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , OnceWithContext ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Or ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , PtrToInt ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SAddOver ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SDiv ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SExt ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SExtOrBitCast ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SIToFP ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SMulOver ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SRem ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SSubOver ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SToSCheckedTrunc ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SToUCheckedTrunc ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , SUCheckedConversion ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Shl ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Sizeof ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , StaticReport ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Strideof ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Sub ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , TakeArrayBackToFront ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , TakeArrayFrontToBack ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Trunc ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , TruncOrBitCast ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , TSanInoutAccess ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , UAddOver ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , UDiv ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , UIToFP ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , UMulOver ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , URem ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , USCheckedConversion ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , USubOver ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , UToSCheckedTrunc ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , UToUCheckedTrunc ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Unreachable ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , UnsafeGuaranteedEnd ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Xor ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ZExt ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ZExtOrBitCast ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , ZeroInitializer ) <nl> + CONSTANT_OWNERSHIP_BUILTIN ( Trivial , MustBeLive , Swift3ImplicitObjCEntrypoint ) <nl> # undef CONSTANT_OWNERSHIP_BUILTIN <nl> <nl> / / Builtins that should be lowered to SIL instructions so we should never see <nl> new file mode 100644 <nl> index 000000000000 . . 44eb24450a75 <nl> mmm / dev / null <nl> ppp b / lib / SIL / UseOwnershipRequirement . h <nl> <nl> + / / = = = mmm UseOwnershipRequirement . h mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / <nl> + / / This source file is part of the Swift . org open source project <nl> + / / <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + / / / <nl> + / / / \ file <nl> + / / / <nl> + / / / This file contains declarations that enable clients to compute the ownership <nl> + / / / requirements that a use puts on an SSA value . This is used in coordination <nl> + / / / with the OwnershipChecker in SILOwnershipVerifier . cpp and the SILValue <nl> + / / / ValueOwnershipKind visitor in ValueOwnershipKindClassifier . cpp to perform <nl> + / / / SIL level ownership verification . <nl> + / / / <nl> + / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> + <nl> + # ifndef SWIFT_SIL_USEOWNERSHIPREQUIREMENT_H <nl> + # define SWIFT_SIL_USEOWNERSHIPREQUIREMENT_H <nl> + <nl> + namespace swift { <nl> + <nl> + / / / What constraint does the given use of an SSA value put on the lifetime of <nl> + / / / the given SSA value . <nl> + / / / <nl> + / / / There are two possible constraints : MustBeLive and <nl> + / / / MustBeInvalidated . MustBeLive means that the SSA value must be able to be <nl> + / / / used in a valid way at the given use point . MustBeInvalidated means that any <nl> + / / / use of given SSA value after this instruction on any path through this <nl> + / / / instruction . <nl> + enum class UseLifetimeConstraint { <nl> + / / / This use requires the SSA value to be live after the given instruction ' s <nl> + / / / execution . <nl> + MustBeLive , <nl> + <nl> + / / / This use invalidates the given SSA value . <nl> + / / / <nl> + / / / This means that the given SSA value can not have any uses that are <nl> + / / / reachable from this instruction . When a value has owned semantics this <nl> + / / / means the SSA value is destroyed at this point . When a value has <nl> + / / / guaranteed ( i . e . shared borrow ) semantics this means that the program <nl> + / / / has left the scope of the borrowed SSA value and said value can not be <nl> + / / / used . <nl> + MustBeInvalidated , <nl> + } ; <nl> + <nl> + } / / end namespace swift <nl> + <nl> + # endif <nl>
[ sil - ownership ] Reify the lifetime constraint of a use from a bool into UseLifetimeConstraint .
apple/swift
ec44f55372dd447f49b8f03d8e5ee4b86bb806f2
2017-08-04T02:50:45Z
mmm a / tensorflow / compiler / jit / legacy_flags / mark_for_compilation_pass_flags . cc <nl> ppp b / tensorflow / compiler / jit / legacy_flags / mark_for_compilation_pass_flags . cc <nl> static void AllocateFlags ( ) { <nl> flags - > tf_xla_max_cluster_size = std : : numeric_limits < int32 > : : max ( ) ; <nl> flags - > tf_xla_clustering_debug = false ; <nl> flags - > tf_xla_cpu_global_jit = false ; <nl> + flags - > tf_xla_clustering_fuel = std : : numeric_limits < int64 > : : max ( ) ; <nl> flag_list = new std : : vector < Flag > ( <nl> { Flag ( " tf_xla_auto_jit " , & flags - > tf_xla_auto_jit , <nl> " Control compilation of operators into XLA computations on CPU and " <nl> static void AllocateFlags ( ) { <nl> Flag ( " tf_xla_clustering_debug " , & flags - > tf_xla_clustering_debug , <nl> " Dump graphs during XLA compilation . " ) , <nl> Flag ( " tf_xla_cpu_global_jit " , & flags - > tf_xla_cpu_global_jit , <nl> - " Enables global JIT compilation for CPU via SessionOptions . " ) } ) ; <nl> + " Enables global JIT compilation for CPU via SessionOptions . " ) , <nl> + Flag ( " tf_xla_clustering_fuel " , & flags - > tf_xla_clustering_fuel , <nl> + " Places an artificial limit on the number of ops marked as " <nl> + " eligible for clustering . " ) } ) ; <nl> xla : : legacy_flags : : ParseFlagsFromEnv ( * flag_list ) ; <nl> } <nl> <nl> mmm a / tensorflow / compiler / jit / legacy_flags / mark_for_compilation_pass_flags . h <nl> ppp b / tensorflow / compiler / jit / legacy_flags / mark_for_compilation_pass_flags . h <nl> typedef struct { <nl> bool tf_xla_clustering_debug ; / / Dump graphs during XLA compilation . <nl> bool tf_xla_cpu_global_jit ; / / Enables global JIT compilation for CPU <nl> / / via SessionOptions . <nl> + int64 tf_xla_clustering_fuel ; / / " Compiler fuel " for clustering . Only this <nl> + / / many ops will be marked as eligible for <nl> + / / clustering . <nl> } MarkForCompilationPassFlags ; <nl> <nl> / / Return a pointer to the MarkForCompilationPassFlags struct ; <nl> mmm a / tensorflow / compiler / jit / mark_for_compilation_pass . cc <nl> ppp b / tensorflow / compiler / jit / mark_for_compilation_pass . cc <nl> Status FindCompilationCandidates ( <nl> FunctionLibraryRuntime * lib_runtime = <nl> pflr - > GetFLR ( ProcessFunctionLibraryRuntime : : kDefaultFLRDevice ) ; <nl> <nl> + int64 & fuel = <nl> + legacy_flags : : GetMarkForCompilationPassFlags ( ) - > tf_xla_clustering_fuel ; <nl> + <nl> + / / Iterate over nodes in sorted order so that compiler fuel is deterministic . <nl> + / / We can ' t simply pass op_nodes ( ) . begin ( ) and op_nodes ( ) . end to the <nl> + / / std : : vector constructor because they ' re not proper iterators , with <nl> + / / iterator_traits defined and so on . <nl> + std : : vector < Node * > sorted_nodes ; <nl> for ( Node * node : graph . op_nodes ( ) ) { <nl> + sorted_nodes . push_back ( node ) ; <nl> + } <nl> + std : : sort ( sorted_nodes . begin ( ) , sorted_nodes . end ( ) , NodeCompare ( ) ) ; <nl> + <nl> + for ( Node * node : sorted_nodes ) { <nl> + VLOG ( 2 ) < < " Fuel : " < < fuel ; <nl> + if ( fuel < = 0 ) { <nl> + VLOG ( 2 ) <nl> + < < " Hit fuel limit ; not marking any remaining ops as clusterable . " ; <nl> + break ; <nl> + } <nl> + <nl> VLOG ( 2 ) < < " FindCompilationCandidates ( ) : Processing " <nl> < < node - > DebugString ( ) ; <nl> <nl> Status FindCompilationCandidates ( <nl> continue ; <nl> } <nl> candidates - > insert ( node ) ; <nl> + - - fuel ; <nl> } <nl> + VLOG ( 2 ) < < " candidates - > size ( ) = " < < candidates - > size ( ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> <nl>
[ TF : XLA ] Add compiler fuel to mark_for_compilation_pass .
tensorflow/tensorflow
979a1d449a98109b8e7319795c623c5e7ef17744
2018-03-14T10:51:23Z
mmm a / example / example . cpp <nl> ppp b / example / example . cpp <nl> int main ( int , char * [ ] ) <nl> spdlog : : trace ( " Backtrace message 1 " ) ; <nl> spdlog : : debug ( " Backtrace message 2 " ) ; <nl> spdlog : : debug ( " Backtrace message 3 " ) ; <nl> - spdlog : : error ( " This should trigger backtrace ! " ) <nl> + spdlog : : error ( " This should trigger backtrace ! " ) ; <nl> <nl> try <nl> { <nl>
Fix example
gabime/spdlog
e085ba7fcca482590887245a839b4bc42811ca1e
2019-08-22T23:48:40Z
new file mode 100644 <nl> index 00000000000 . . 25519e0d281 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / HH_FLAGS <nl> @ @ - 0 , 0 + 1 @ @ <nl> + - - use - new - type - errors <nl> new file mode 100644 <nl> index 00000000000 . . 9e4f5f6a6a4 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / ambiguous_inheritance . php <nl> <nl> + < ? hh / / strict <nl> + <nl> + interface I1 { <nl> + public function foo ( ) : mixed ; <nl> + } <nl> + <nl> + interface I2 { <nl> + public function foo ( ) : int ; <nl> + } <nl> + <nl> + abstract class C implements I1 , I2 { } <nl> new file mode 100644 <nl> index 00000000000 . . 3a2df8006c9 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / ambiguous_inheritance . php . exp <nl> <nl> + File " ambiguous_inheritance . php " , line 11 , characters 16 - 16 : <nl> + Class C does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " ambiguous_inheritance . php " , line 11 , characters 33 - 34 : <nl> + Some members are incompatible with those declared in type I2 <nl> + Read the following to see why : <nl> + File " ambiguous_inheritance . php " , line 4 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " ambiguous_inheritance . php " , line 8 , characters 26 - 28 : <nl> + Expected int <nl> + File " ambiguous_inheritance . php " , line 4 , characters 26 - 30 : <nl> + But got mixed <nl> + File " ambiguous_inheritance . php " , line 4 , characters 19 - 21 : <nl> + This declaration was inherited from an object of type I1 . Redeclare this member in C with a compatible signature . <nl> new file mode 100644 <nl> index 00000000000 . . 3a2df8006c9 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / ambiguous_inheritance . php . like_types . exp <nl> <nl> + File " ambiguous_inheritance . php " , line 11 , characters 16 - 16 : <nl> + Class C does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " ambiguous_inheritance . php " , line 11 , characters 33 - 34 : <nl> + Some members are incompatible with those declared in type I2 <nl> + Read the following to see why : <nl> + File " ambiguous_inheritance . php " , line 4 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " ambiguous_inheritance . php " , line 8 , characters 26 - 28 : <nl> + Expected int <nl> + File " ambiguous_inheritance . php " , line 4 , characters 26 - 30 : <nl> + But got mixed <nl> + File " ambiguous_inheritance . php " , line 4 , characters 19 - 21 : <nl> + This declaration was inherited from an object of type I1 . Redeclare this member in C with a compatible signature . <nl> new file mode 100644 <nl> index 00000000000 . . b68e3f8fc67 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / bad_inout_decl_parent1 . php <nl> <nl> + < ? hh / / strict <nl> + <nl> + class C1 { <nl> + public function foo ( string $ x , inout int $ y ) : void { } <nl> + } <nl> + <nl> + class C2 extends C1 { <nl> + public function foo ( string $ x , int $ y ) : void { } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 5553b936339 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / bad_inout_decl_parent1 . php . exp <nl> <nl> + File " bad_inout_decl_parent1 . php " , line 7 , characters 7 - 8 : <nl> + Class C2 does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " bad_inout_decl_parent1 . php " , line 7 , characters 18 - 19 : <nl> + Some members are incompatible with those declared in type C1 <nl> + Read the following to see why : <nl> + File " bad_inout_decl_parent1 . php " , line 8 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " bad_inout_decl_parent1 . php " , line 4 , characters 44 - 45 : <nl> + This is an inout parameter <nl> + File " bad_inout_decl_parent1 . php " , line 8 , characters 38 - 39 : <nl> + It is incompatible with a normal parameter <nl> new file mode 100644 <nl> index 00000000000 . . 5553b936339 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / bad_inout_decl_parent1 . php . like_types . exp <nl> <nl> + File " bad_inout_decl_parent1 . php " , line 7 , characters 7 - 8 : <nl> + Class C2 does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " bad_inout_decl_parent1 . php " , line 7 , characters 18 - 19 : <nl> + Some members are incompatible with those declared in type C1 <nl> + Read the following to see why : <nl> + File " bad_inout_decl_parent1 . php " , line 8 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " bad_inout_decl_parent1 . php " , line 4 , characters 44 - 45 : <nl> + This is an inout parameter <nl> + File " bad_inout_decl_parent1 . php " , line 8 , characters 38 - 39 : <nl> + It is incompatible with a normal parameter <nl> new file mode 100644 <nl> index 00000000000 . . f39fa17eb89 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / bad_subclass . php <nl> <nl> + < ? hh / / strict <nl> + <nl> + interface I { } <nl> + class C_isI implements I { } <nl> + class C_notI { } <nl> + <nl> + abstract class Super { <nl> + public abstract function nameOfISubclass ( ) : classname < I > ; <nl> + } <nl> + <nl> + class GoodSub extends Super { <nl> + public function nameOfISubclass ( ) : classname < I > { <nl> + return C_isI : : class ; <nl> + } <nl> + } <nl> + <nl> + class BadSub extends Super { <nl> + public function nameOfISubclass ( ) : classname < C_notI > { <nl> + return C_notI : : class ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . d4d16ab9669 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / bad_subclass . php . exp <nl> <nl> + File " bad_subclass . php " , line 17 , characters 7 - 12 : <nl> + Class BadSub does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " bad_subclass . php " , line 17 , characters 22 - 26 : <nl> + Some members are incompatible with those declared in type Super <nl> + Read the following to see why : <nl> + File " bad_subclass . php " , line 18 , characters 19 - 33 : <nl> + Member nameOfISubclass has the wrong type <nl> + File " bad_subclass . php " , line 8 , characters 57 - 57 : <nl> + Expected I <nl> + File " bad_subclass . php " , line 18 , characters 48 - 53 : <nl> + But got C_notI <nl> new file mode 100644 <nl> index 00000000000 . . 9067a5c50a4 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / bad_subclass . php . like_types . exp <nl> <nl> + File " bad_subclass . php " , line 17 , characters 7 - 12 : <nl> + Class BadSub does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " bad_subclass . php " , line 17 , characters 22 - 26 : <nl> + Some members are incompatible with those declared in type Super <nl> + Read the following to see why : <nl> + File " bad_subclass . php " , line 18 , characters 19 - 33 : <nl> + Member nameOfISubclass has the wrong type <nl> + File " bad_subclass . php " , line 8 , characters 47 - 58 : <nl> + Expected ~ classname < ~ I > because it is an unenforceable type <nl> + File " bad_subclass . php " , line 18 , characters 38 - 54 : <nl> + But got classname < ~ C_notI > <nl> new file mode 100644 <nl> index 00000000000 . . 1dec55bdbde <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / constraint_override_bad . php <nl> <nl> + < ? hh / / strict <nl> + / / Copyright 2004 - present Facebook . All Rights Reserved . <nl> + <nl> + class B { <nl> + public function foo < T super C > ( ) : T { <nl> + return new C ( ) ; <nl> + } <nl> + } <nl> + class C extends B { <nl> + public function foo < T super B > ( ) : T { <nl> + return new B ( ) ; <nl> + } <nl> + public function bar ( ) : void { <nl> + echo ' bar ' ; <nl> + } <nl> + } <nl> + <nl> + function CallOnB ( B $ b ) : void { <nl> + $ x = $ b - > foo ( ) ; <nl> + $ x - > bar ( ) ; <nl> + } <nl> + function TestIt ( ) : void { <nl> + $ c = new C ( ) ; <nl> + CallOnB ( $ c ) ; <nl> + } <nl> + / * HH_FIXME [ 1002 ] * / <nl> + TestIt ( ) ; <nl> new file mode 100644 <nl> index 00000000000 . . 95119c880b3 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / constraint_override_bad . php . exp <nl> <nl> + File " constraint_override_bad . php " , line 9 , characters 7 - 7 : <nl> + Class C does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " constraint_override_bad . php " , line 9 , characters 17 - 17 : <nl> + Some members are incompatible with those declared in type B <nl> + Read the following to see why : <nl> + File " constraint_override_bad . php " , line 10 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " constraint_override_bad . php " , line 10 , characters 31 - 31 : <nl> + Some type constraint ( s ) are violated here <nl> + File " constraint_override_bad . php " , line 10 , characters 23 - 23 : <nl> + T is a constrained type parameter <nl> + File " constraint_override_bad . php " , line 10 , characters 23 - 23 : <nl> + Expected T <nl> + File " constraint_override_bad . php " , line 10 , characters 31 - 31 : <nl> + But got B <nl> new file mode 100644 <nl> index 00000000000 . . 95119c880b3 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / constraint_override_bad . php . like_types . exp <nl> <nl> + File " constraint_override_bad . php " , line 9 , characters 7 - 7 : <nl> + Class C does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " constraint_override_bad . php " , line 9 , characters 17 - 17 : <nl> + Some members are incompatible with those declared in type B <nl> + Read the following to see why : <nl> + File " constraint_override_bad . php " , line 10 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " constraint_override_bad . php " , line 10 , characters 31 - 31 : <nl> + Some type constraint ( s ) are violated here <nl> + File " constraint_override_bad . php " , line 10 , characters 23 - 23 : <nl> + T is a constrained type parameter <nl> + File " constraint_override_bad . php " , line 10 , characters 23 - 23 : <nl> + Expected T <nl> + File " constraint_override_bad . php " , line 10 , characters 31 - 31 : <nl> + But got B <nl> new file mode 100644 <nl> index 00000000000 . . 28971f5444b <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / enforceable_type_consts . php <nl> <nl> + < ? hh / / strict <nl> + / / Copyright 2004 - present Facebook . All Rights Reserved . <nl> + <nl> + class Base { } <nl> + class GenericErased < T > extends Base { } <nl> + class GenericReified < reify T > extends Base { } <nl> + class Concrete extends Base { } <nl> + <nl> + abstract class Top { <nl> + < < __Enforceable > > <nl> + abstract const type TVassil as Base ; <nl> + } <nl> + <nl> + class E extends Top { <nl> + const type TVassil = GenericErased < int > ; <nl> + } <nl> + <nl> + class R extends Top { <nl> + const type TVassil = GenericReified < int > ; <nl> + } <nl> + <nl> + class C extends Top { <nl> + const type TVassil = Concrete ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . e5312f78edc <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / enforceable_type_consts . php . exp <nl> <nl> + File " enforceable_type_consts . php " , line 14 , characters 7 - 7 : <nl> + Class E does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " enforceable_type_consts . php " , line 14 , characters 17 - 19 : <nl> + Some members are incompatible with those declared in type Top <nl> + Read the following to see why : <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + Invalid type <nl> + File " enforceable_type_consts . php " , line 10 , characters 5 - 17 : <nl> + Type constant TVassil was declared __Enforceable here <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + This type is not enforceable because it has a type with an erased generic type argument <nl> new file mode 100644 <nl> index 00000000000 . . 6941bffd981 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / enforceable_type_consts . php . legacy_decl . exp <nl> <nl> + File " enforceable_type_consts . php " , line 14 , characters 7 - 7 : <nl> + Class E does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " enforceable_type_consts . php " , line 14 , characters 17 - 19 : <nl> + Some members are incompatible with those declared in type Top <nl> + Read the following to see why : <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + Invalid type <nl> + File " enforceable_type_consts . php " , line 10 , characters 5 - 17 : <nl> + Type constant TVassil was declared __Enforceable here <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + This type is not enforceable because it has a type with an erased generic type argument <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + Invalid type ( Typing [ 4302 ] ) <nl> + File " enforceable_type_consts . php " , line 10 , characters 5 - 17 : <nl> + Type constant TVassil was declared __Enforceable here <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + This type is not enforceable because it has a type with an erased generic type argument <nl> new file mode 100644 <nl> index 00000000000 . . 6941bffd981 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / enforceable_type_consts . php . like_types . exp <nl> <nl> + File " enforceable_type_consts . php " , line 14 , characters 7 - 7 : <nl> + Class E does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " enforceable_type_consts . php " , line 14 , characters 17 - 19 : <nl> + Some members are incompatible with those declared in type Top <nl> + Read the following to see why : <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + Invalid type <nl> + File " enforceable_type_consts . php " , line 10 , characters 5 - 17 : <nl> + Type constant TVassil was declared __Enforceable here <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + This type is not enforceable because it has a type with an erased generic type argument <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + Invalid type ( Typing [ 4302 ] ) <nl> + File " enforceable_type_consts . php " , line 10 , characters 5 - 17 : <nl> + Type constant TVassil was declared __Enforceable here <nl> + File " enforceable_type_consts . php " , line 15 , characters 24 - 41 : <nl> + This type is not enforceable because it has a type with an erased generic type argument <nl> new file mode 100644 <nl> index 00000000000 . . 3a6459874ff <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / fc_enum_non_arraykey_constraint . php <nl> <nl> + < ? hh / / strict <nl> + / / Copyright 2004 - present Facebook . All Rights Reserved . <nl> + <nl> + enum Enum : string as ? string { <nl> + VALUE = ' value ' ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 888006cb3dc <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / fc_enum_non_arraykey_constraint . php . exp <nl> <nl> + File " fc_enum_non_arraykey_constraint . php " , line 4 , characters 6 - 9 : <nl> + This enum declaration is invalid . <nl> + Read the following to see why : ( Typing [ 4342 ] ) <nl> + File " BuiltinEnum . hhi " , line 43 , characters 32 - 39 : <nl> + Member getNames has the wrong type <nl> + File " BuiltinEnum . hhi " , line 43 , characters 73 - 80 : <nl> + Expected arraykey <nl> + File " fc_enum_non_arraykey_constraint . php " , line 4 , characters 22 - 28 : <nl> + But got ? string <nl> + File " fc_enum_non_arraykey_constraint . php " , line 4 , characters 6 - 9 : <nl> + Enums must be int or string or arraykey , not ? string ( Typing [ 4024 ] ) <nl> new file mode 100644 <nl> index 00000000000 . . 888006cb3dc <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / fc_enum_non_arraykey_constraint . php . like_types . exp <nl> <nl> + File " fc_enum_non_arraykey_constraint . php " , line 4 , characters 6 - 9 : <nl> + This enum declaration is invalid . <nl> + Read the following to see why : ( Typing [ 4342 ] ) <nl> + File " BuiltinEnum . hhi " , line 43 , characters 32 - 39 : <nl> + Member getNames has the wrong type <nl> + File " BuiltinEnum . hhi " , line 43 , characters 73 - 80 : <nl> + Expected arraykey <nl> + File " fc_enum_non_arraykey_constraint . php " , line 4 , characters 22 - 28 : <nl> + But got ? string <nl> + File " fc_enum_non_arraykey_constraint . php " , line 4 , characters 6 - 9 : <nl> + Enums must be int or string or arraykey , not ? string ( Typing [ 4024 ] ) <nl> new file mode 100644 <nl> index 00000000000 . . 8dac261c1de <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / where_override_bad . php <nl> <nl> + < ? hh / / strict <nl> + / / Copyright 2004 - present Facebook . All Rights Reserved . <nl> + <nl> + class Base { } <nl> + class Derived extends Base { <nl> + public function bar ( ) : void { echo ' bar ' ; } <nl> + } <nl> + <nl> + class MyList < T > { <nl> + public function foo ( T $ x ) : void where T as Base { } <nl> + public function boo ( T $ x ) : void where T as Derived { } <nl> + } <nl> + <nl> + / / This is bad : we ' ve strengthened a constraint <nl> + class List4 < T > extends MyList < T > { <nl> + public function foo ( T $ x ) : void where T as Derived { <nl> + $ x - > bar ( ) ; <nl> + } <nl> + public function boo ( T $ x ) : void { <nl> + } <nl> + } <nl> + <nl> + <nl> + function BreakIt ( MyList < Base > $ l ) : void { <nl> + $ l - > foo ( new Base ( ) ) ; <nl> + } <nl> + <nl> + <nl> + function TestIt ( ) : void { <nl> + $ x = new List4 ( ) ; <nl> + BreakIt ( $ x ) ; <nl> + } <nl> + <nl> + / * HH_FIXME [ 1002 ] * / <nl> + TestIt ( ) ; <nl> new file mode 100644 <nl> index 00000000000 . . 19aea70d572 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / where_override_bad . php . exp <nl> <nl> + File " where_override_bad . php " , line 15 , characters 7 - 11 : <nl> + Class List4 does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " where_override_bad . php " , line 15 , characters 24 - 29 : <nl> + Some members are incompatible with those declared in type MyList <nl> + Read the following to see why : <nl> + File " where_override_bad . php " , line 16 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " where_override_bad . php " , line 16 , characters 45 - 51 : <nl> + Expected Derived <nl> + File " where_override_bad . php " , line 15 , characters 13 - 13 : <nl> + But got T <nl> + File " where_override_bad . php " , line 16 , characters 40 - 40 : <nl> + via this generic T <nl> new file mode 100644 <nl> index 00000000000 . . 7c29cde1762 <nl> mmm / dev / null <nl> ppp b / hphp / hack / test / typecheck / new_type_errors / error_relocation / where_override_bad . php . like_types . exp <nl> <nl> + File " where_override_bad . php " , line 25 , characters 7 - 9 : <nl> + A ' where ' type constraint is violated here ( Typing [ 4323 ] ) <nl> + File " where_override_bad . php " , line 10 , characters 19 - 21 : <nl> + This is the method with ' where ' type constraints <nl> + File " where_override_bad . php " , line 10 , characters 45 - 48 : <nl> + Expected Base <nl> + File " where_override_bad . php " , line 24 , characters 25 - 28 : <nl> + But got dynamic because it is an unenforceable type <nl> + File " where_override_bad . php " , line 15 , characters 7 - 11 : <nl> + Class List4 does not correctly implement all required members ( Typing [ 4340 ] ) <nl> + File " where_override_bad . php " , line 15 , characters 24 - 29 : <nl> + Some members are incompatible with those declared in type MyList <nl> + Read the following to see why : <nl> + File " where_override_bad . php " , line 16 , characters 19 - 21 : <nl> + Member foo has the wrong type <nl> + File " where_override_bad . php " , line 16 , characters 45 - 51 : <nl> + Expected Derived <nl> + File " where_override_bad . php " , line 15 , characters 13 - 13 : <nl> + But got T <nl> + File " where_override_bad . php " , line 16 , characters 40 - 40 : <nl> + via this generic T <nl>
A representative subset of errors that currently appear on declarations , but maybe shouldn ' t
facebook/hhvm
57bf7b5c8953ca64ee6fd14412c9258ae6558870
2019-08-06T23:27:22Z
mmm a / ports / libarchive / CONTROL <nl> ppp b / ports / libarchive / CONTROL <nl> <nl> Source : libarchive <nl> - Version : 3 . 2 . 2 - 1 <nl> + Version : 3 . 2 . 2 - 2 <nl> Description : Library for reading and writing streaming archives <nl> - Build - Depends : zlib , bzip2 , libxml2 , libiconv , lz4 , liblzma , openssl <nl> + Build - Depends : zlib , bzip2 , libxml2 , lz4 , liblzma , openssl <nl> mmm a / ports / libarchive / portfile . cmake <nl> ppp b / ports / libarchive / portfile . cmake <nl> vcpkg_configure_cmake ( <nl> - DENABLE_XATTR = OFF <nl> - DENABLE_ACL = OFF <nl> - DENABLE_TEST = OFF <nl> + - DENABLE_ICONV = OFF <nl> - DPOSIX_REGEX_LIB = NONE <nl> OPTIONS_DEBUG <nl> - DARCHIVE_SKIP_HEADERS = ON ) <nl>
[ libarchive ] Disable libiconv support
microsoft/vcpkg
490ddfe2f7362c442190f4da9e41386a8a811681
2017-01-26T05:14:57Z
mmm a / redis - desktop - manager / source / application . cpp <nl> ppp b / redis - desktop - manager / source / application . cpp <nl> void MainWin : : initFilter ( ) <nl> { <nl> connect ( ui . pbFindFilter , SIGNAL ( clicked ( ) ) , SLOT ( OnSetFilter ( ) ) ) ; <nl> connect ( ui . pbClearFilter , SIGNAL ( clicked ( ) ) , SLOT ( OnClearFilter ( ) ) ) ; <nl> + connect ( ui . leKeySearchPattern , SIGNAL ( returnPressed ( ) ) , ui . pbFindFilter , <nl> + SIGNAL ( clicked ( ) ) , Qt : : UniqueConnection ) ; <nl> } <nl> <nl> void MainWin : : initSystemConsole ( ) <nl> void MainWin : : OnUIUnlock ( ) <nl> void MainWin : : OnStatusMessage ( QString message ) <nl> { <nl> statusBar ( ) - > showMessage ( message ) ; <nl> - } <nl> \ No newline at end of file <nl> + } <nl>
Merge pull request from wsgfz / patch - 1
uglide/RedisDesktopManager
dcf54248ed4aa6123332d0ab0faa6222979d42ae
2014-05-30T06:44:45Z
mmm a / test / Interpreter / SDK / objc_mangling . swift <nl> ppp b / test / Interpreter / SDK / objc_mangling . swift <nl> <nl> <nl> / / rdar : / / problem / 56959761 <nl> / / UNSUPPORTED : OS = watchos <nl> - / / UNSUPPORTED : OS = tvos <nl> <nl> import Foundation <nl> <nl> mmm a / test / stdlib / SwiftObjectNSObject . swift <nl> ppp b / test / stdlib / SwiftObjectNSObject . swift <nl> <nl> <nl> / / rdar : / / problem / 56959761 <nl> / / UNSUPPORTED : OS = watchos <nl> - / / UNSUPPORTED : OS = tvos <nl> <nl> import Foundation <nl> <nl>
Merge pull request from apple / re - enable - test - 56959761
apple/swift
6b513a8cbaf4c144340724a3331a37862dd5ca08
2020-05-29T08:03:42Z
mmm a / src / mongo / bson / mutable / mutable_bson . cpp <nl> ppp b / src / mongo / bson / mutable / mutable_bson . cpp <nl> ElementRep & dstRep = _ctx - > _elements - > _vec [ ( * sibIt ) . _rep ] ; <nl> OpTime Element : : getTSValue ( ) const { <nl> return OpTime ( _ctx - > _elements - > _vec [ _rep ] . _value . tsVal ) ; <nl> } <nl> + int64_t Element : : getDateValue ( ) const { <nl> + return _ctx - > _elements - > _vec [ _rep ] . _value . dateVal ; <nl> + } <nl> double Element : : getDoubleValue ( ) const { <nl> return _ctx - > _elements - > _vec [ _rep ] . _value . doubleVal ; <nl> } <nl> ElementRep & dstRep = _ctx - > _elements - > _vec [ ( * sibIt ) . _rep ] ; <nl> } <nl> } <nl> <nl> - / / <nl> - / / Element BSONElement compatibility <nl> - / / <nl> - <nl> - std : : string Element : : String ( ) const { <nl> - ElementRep & e = _ctx - > _elements - > _vec [ _rep ] ; <nl> - if ( isInlineType ( ) ) return e . _value . shortStr ; <nl> - return _ctx - > getHeap ( ) - > getString ( e . _value . valueRef ) ; <nl> - } <nl> - <nl> - Date_t Element : : Date ( ) const { <nl> - return Date_t ( ) ; <nl> - } <nl> - <nl> - double Element : : Number ( ) const { <nl> - ElementRep & e = _ctx - > _elements - > _vec [ _rep ] ; <nl> - switch ( type ( ) ) { <nl> - case mongo : : NumberDouble : return e . _value . doubleVal ; break ; <nl> - case mongo : : Bool : return e . _value . boolVal ; break ; <nl> - case mongo : : NumberInt : return e . _value . intVal ; break ; <nl> - case mongo : : NumberLong : return e . _value . longVal ; break ; <nl> - <nl> - case mongo : : String : case mongo : : Object : case mongo : : Array : case mongo : : BinData : <nl> - case mongo : : Undefined : case mongo : : jstOID : case mongo : : Date : case mongo : : jstNULL : <nl> - case mongo : : RegEx : case mongo : : Symbol : case mongo : : CodeWScope : case mongo : : Timestamp : <nl> - case mongo : : MaxKey : case mongo : : MinKey : case mongo : : EOO : <nl> - default : return 0 . 0 ; <nl> - } <nl> - } <nl> - <nl> - double Element : : Double ( ) const { <nl> - return _ctx - > _elements - > _vec [ _rep ] . _value . doubleVal ; <nl> - } <nl> - <nl> - long long Element : : Long ( ) const { <nl> - return _ctx - > _elements - > _vec [ _rep ] . _value . longVal ; <nl> - } <nl> - <nl> - int Element : : Int ( ) const { <nl> - return _ctx - > _elements - > _vec [ _rep ] . _value . intVal ; <nl> - } <nl> - <nl> - bool Element : : Bool ( ) const { <nl> - return _ctx - > _elements - > _vec [ _rep ] . _value . boolVal ; <nl> - } <nl> - <nl> - mongo : : OID Element : : OID ( ) const { <nl> - return mongo : : OID ( & _ctx - > _elements - > _vec [ _rep ] . _value . shortStr [ 0 ] ) ; <nl> - } <nl> - <nl> - / * stub * / <nl> - const void * Element : : BinData ( ) const { <nl> - return NULL ; <nl> - } <nl> - <nl> - <nl> / / <nl> / / decoders <nl> / / <nl> <nl> Status Element : : prefix ( std : : string * result , char delim ) const { <nl> - std : : string s = String ( ) ; <nl> + std : : string s = getStringValue ( ) ; <nl> size_t n = s . find ( delim ) ; <nl> if ( n = = std : : string : : npos ) { <nl> return Status ( ErrorCodes : : IllegalOperation , " expecting regex format / PAT / flags " ) ; <nl> ElementRep & dstRep = _ctx - > _elements - > _vec [ ( * sibIt ) . _rep ] ; <nl> } <nl> <nl> Status Element : : suffix ( std : : string * result , char delim ) const { <nl> - std : : string s = String ( ) ; <nl> + std : : string s = getStringValue ( ) ; <nl> size_t n = s . find ( delim ) ; <nl> if ( n = = std : : string : : npos ) { <nl> return Status ( ErrorCodes : : IllegalOperation , " expecting regex format . / . pat / flags " ) ; <nl> ElementRep & dstRep = _ctx - > _elements - > _vec [ ( * sibIt ) . _rep ] ; <nl> switch ( type ( ) ) { <nl> case mongo : : MinKey : os < < " MinKey " ; break ; <nl> case mongo : : EOO : os < < " EOO " ; break ; <nl> - case mongo : : NumberDouble : os < < Double ( ) ; break ; <nl> - case mongo : : String : os < < " \ " " < < String ( ) < < " \ " " ; break ; <nl> + case mongo : : NumberDouble : os < < getDoubleValue ( ) ; break ; <nl> + case mongo : : String : os < < " \ " " < < getStringValue ( ) < < " \ " " ; break ; <nl> case mongo : : Object : break ; <nl> case mongo : : Array : break ; <nl> - case mongo : : BinData : os < < " | " < < String ( ) < < " | " ; break ; <nl> + case mongo : : BinData : os < < " | " < < getStringValue ( ) < < " | " ; break ; <nl> case mongo : : Undefined : os < < " Undefined " ; break ; <nl> case mongo : : jstOID : os < < OID ( ) ; break ; <nl> - case mongo : : Bool : os < < Bool ( ) ; break ; <nl> - case mongo : : Date : os < < Date ( ) ; break ; <nl> + case mongo : : Bool : os < < getBoolValue ( ) ; break ; <nl> + case mongo : : Date : os < < getDateValue ( ) ; break ; <nl> case mongo : : jstNULL : os < < " jstNULL " ; break ; <nl> - case mongo : : RegEx : os < < " Regex ( \ " " < < String ( ) < < " \ " ) " ; break ; <nl> - case mongo : : Symbol : os < < " Symbol ( \ " " < < String ( ) < < " \ " ) " ; break ; <nl> - case mongo : : CodeWScope : os < < " CodeWithScope ( \ " " < < String ( ) < < " \ " ) " ; break ; <nl> - case mongo : : NumberInt : os < < Int ( ) ; break ; <nl> - case mongo : : Timestamp : os < < Date ( ) ; break ; <nl> - case mongo : : NumberLong : os < < Long ( ) ; break ; <nl> + case mongo : : RegEx : os < < " Regex ( \ " " < < getStringValue ( ) < < " \ " ) " ; break ; <nl> + case mongo : : Symbol : os < < " Symbol ( \ " " < < getStringValue ( ) < < " \ " ) " ; break ; <nl> + case mongo : : CodeWScope : os < < " CodeWithScope ( \ " " < < getStringValue ( ) < < " \ " ) " ; break ; <nl> + case mongo : : NumberInt : os < < getIntValue ( ) ; break ; <nl> + case mongo : : Timestamp : os < < getDateValue ( ) ; break ; <nl> + case mongo : : NumberLong : os < < getLongValue ( ) ; break ; <nl> case mongo : : MaxKey : os < < " MaxKey " ; break ; <nl> default : ; <nl> } <nl> mmm a / src / mongo / bson / mutable / mutable_bson . h <nl> ppp b / src / mongo / bson / mutable / mutable_bson . h <nl> namespace mutablebson { <nl> void setRegexValue ( const StringData & re ) ; <nl> void setSafeNumValue ( const SafeNum & safeNum ) ; <nl> <nl> - / / <nl> - / / BSONElement compatibility <nl> - / / <nl> - <nl> - bool Bool ( ) const ; <nl> - int Int ( ) const ; <nl> - long long Long ( ) const ; <nl> - Date_t Date ( ) const ; <nl> - double Double ( ) const ; <nl> - double Number ( ) const ; <nl> - mongo : : OID OID ( ) const ; <nl> - std : : string String ( ) const ; <nl> - const void * BinData ( ) const ; <nl> - <nl> / / additional methods needed for BSON decoding <nl> Status prefix ( std : : string * result , char delim ) const ; <nl> Status suffix ( std : : string * result , char delim ) const ; <nl> mmm a / src / mongo / bson / mutable / mutable_bson_builder . cpp <nl> ppp b / src / mongo / bson / mutable / mutable_bson_builder . cpp <nl> namespace mutablebson { <nl> break ; <nl> } <nl> case NumberDouble : { <nl> - dst - > appendNumber ( src . fieldName ( ) , src . Double ( ) ) ; <nl> + dst - > appendNumber ( src . fieldName ( ) , src . getDoubleValue ( ) ) ; <nl> break ; <nl> } <nl> case String : { <nl> - dst - > append ( src . fieldName ( ) , src . String ( ) ) ; <nl> + dst - > append ( src . fieldName ( ) , src . getStringValue ( ) ) ; <nl> break ; <nl> } <nl> case Object : { <nl> namespace mutablebson { <nl> case BinData : { <nl> uint32_t len ( 0 ) ; <nl> BinDataType subType ( mongo : : BinDataGeneral ) ; <nl> - dst - > appendBinData ( src . fieldName ( ) , len , subType , src . BinData ( ) ) ; <nl> + dst - > appendBinData ( src . fieldName ( ) , len , subType , src . getStringValue ( ) ) ; <nl> break ; <nl> } <nl> case Undefined : { <nl> namespace mutablebson { <nl> break ; <nl> } <nl> case jstOID : { <nl> - mongo : : OID oid ( src . OID ( ) ) ; <nl> + mongo : : OID oid ( src . getOIDValue ( ) ) ; <nl> dst - > appendOID ( src . fieldName ( ) , & oid ) ; <nl> break ; <nl> } <nl> case Bool : { <nl> - dst - > appendBool ( src . fieldName ( ) , src . Bool ( ) ) ; <nl> + dst - > appendBool ( src . fieldName ( ) , src . getBoolValue ( ) ) ; <nl> break ; <nl> } <nl> case Date : { <nl> - dst - > appendDate ( src . fieldName ( ) , src . Date ( ) ) ; <nl> + dst - > appendDate ( src . fieldName ( ) , src . getDateValue ( ) ) ; <nl> break ; <nl> } <nl> case jstNULL : { <nl> namespace mutablebson { <nl> } <nl> <nl> case Code : { <nl> - dst - > appendCode ( src . fieldName ( ) , src . String ( ) . c_str ( ) ) ; <nl> + dst - > appendCode ( src . fieldName ( ) , src . getStringValue ( ) ) ; <nl> break ; <nl> } <nl> case Symbol : { <nl> - dst - > appendSymbol ( src . fieldName ( ) , src . String ( ) . c_str ( ) ) ; <nl> + dst - > appendSymbol ( src . fieldName ( ) , src . getStringValue ( ) ) ; <nl> break ; <nl> } <nl> case CodeWScope : { <nl> namespace mutablebson { <nl> } <nl> <nl> case NumberInt : { <nl> - dst - > appendNumber ( src . fieldName ( ) , src . Int ( ) ) ; <nl> + dst - > appendNumber ( src . fieldName ( ) , src . getIntValue ( ) ) ; <nl> break ; <nl> } <nl> case Timestamp : { <nl> - dst - > appendTimeT ( src . fieldName ( ) , src . Long ( ) ) ; <nl> + dst - > appendTimeT ( src . fieldName ( ) , src . getLongValue ( ) ) ; <nl> break ; <nl> } <nl> case NumberLong : { <nl> - dst - > appendNumber ( src . fieldName ( ) , src . Long ( ) ) ; <nl> + dst - > appendNumber ( src . fieldName ( ) , src . getLongValue ( ) ) ; <nl> break ; <nl> } <nl> case MaxKey : { <nl> mmm a / src / mongo / bson / mutable / mutable_bson_test . cpp <nl> ppp b / src / mongo / bson / mutable / mutable_bson_test . cpp <nl> namespace { <nl> <nl> mongo : : mutablebson : : Element e1 = ctx . makeArrayElement ( " a " ) ; <nl> mongo : : mutablebson : : Element e2 = ctx . makeIntElement ( " " , 10 ) ; <nl> - ASSERT_EQUALS ( 10 , e2 . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 10 , e2 . getIntValue ( ) ) ; <nl> mongo : : mutablebson : : Element e3 = ctx . makeIntElement ( " " , 20 ) ; <nl> - ASSERT_EQUALS ( 20 , e3 . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , e3 . getIntValue ( ) ) ; <nl> mongo : : mutablebson : : Element e4 = ctx . makeIntElement ( " " , 30 ) ; <nl> - ASSERT_EQUALS ( 30 , e4 . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 30 , e4 . getIntValue ( ) ) ; <nl> mongo : : mutablebson : : Element e5 = ctx . makeIntElement ( " " , 40 ) ; <nl> - ASSERT_EQUALS ( 40 , e5 . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 40 , e5 . getIntValue ( ) ) ; <nl> mongo : : mutablebson : : Element e6 = ctx . makeIntElement ( " " , 5 ) ; <nl> - ASSERT_EQUALS ( 5 , e6 . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 5 , e6 . getIntValue ( ) ) ; <nl> mongo : : mutablebson : : Element e7 = ctx . makeIntElement ( " " , 0 ) ; <nl> - ASSERT_EQUALS ( 0 , e7 . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 0 , e7 . getIntValue ( ) ) ; <nl> <nl> ASSERT_EQUALS ( e1 . pushBack ( e2 ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( e1 . pushBack ( e3 ) , mongo : : Status : : OK ( ) ) ; <nl> namespace { <nl> <nl> mongo : : mutablebson : : Element e ( & ctx , EMPTY_REP ) ; <nl> ASSERT_EQUALS ( e1 . get ( 0 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 0 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 0 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 1 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 5 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 5 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 2 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 10 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 10 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 3 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 20 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 4 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 30 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 30 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 5 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 40 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 40 , e . getIntValue ( ) ) ; <nl> <nl> ASSERT_EQUALS ( e1 . peekBack ( & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 40 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 40 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . popBack ( ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( e1 . arraySize ( & n ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( 5 , ( int ) n ) ; <nl> ASSERT_EQUALS ( e1 . get ( 0 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 0 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 0 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 1 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 5 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 5 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 2 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 10 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 10 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 3 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 20 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 4 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 30 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 30 , e . getIntValue ( ) ) ; <nl> <nl> ASSERT_EQUALS ( e1 . peekFront ( & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 0 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 0 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . popFront ( ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( e1 . arraySize ( & n ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( 4 , ( int ) n ) ; <nl> ASSERT_EQUALS ( e1 . get ( 0 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 5 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 5 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 1 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 10 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 10 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 2 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 20 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 3 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 30 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 30 , e . getIntValue ( ) ) ; <nl> <nl> ASSERT_EQUALS ( e1 . peekFront ( & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 5 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 5 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . popFront ( ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( e1 . arraySize ( & n ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( 3 , ( int ) n ) ; <nl> ASSERT_EQUALS ( e1 . get ( 0 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 10 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 10 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 1 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 20 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 2 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 30 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 30 , e . getIntValue ( ) ) ; <nl> <nl> ASSERT_EQUALS ( e1 . peekBack ( & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 30 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 30 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . popBack ( ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( e1 . arraySize ( & n ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( 2 , ( int ) n ) ; <nl> ASSERT_EQUALS ( e1 . get ( 0 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 10 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 10 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . get ( 1 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 20 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , e . getIntValue ( ) ) ; <nl> <nl> ASSERT_EQUALS ( e1 . peekFront ( & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 10 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 10 , e . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . popFront ( ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( e1 . arraySize ( & n ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( 1 , ( int ) n ) ; <nl> ASSERT_EQUALS ( e1 . get ( 0 , & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 20 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 20 , e . getIntValue ( ) ) ; <nl> <nl> mongo : : mutablebson : : Element e8 = ctx . makeIntElement ( " " , 100 ) ; <nl> - ASSERT_EQUALS ( 100 , e8 . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 100 , e8 . getIntValue ( ) ) ; <nl> ASSERT_EQUALS ( e1 . set ( 0 , e8 ) , mongo : : Status : : OK ( ) ) ; <nl> ASSERT_EQUALS ( e1 . peekFront ( & e ) , mongo : : Status : : OK ( ) ) ; <nl> - ASSERT_EQUALS ( 100 , e . Int ( ) ) ; <nl> + ASSERT_EQUALS ( 100 , e . getIntValue ( ) ) ; <nl> } <nl> <nl> <nl>
Remove BSONElement compatability API ' s from mutable BSON
mongodb/mongo
97ed3b5231d93b1c869ba7dbc95fe7a5644ea6ac
2012-11-18T19:38:04Z
mmm a / docs / ABI / Mangling . rst <nl> ppp b / docs / ABI / Mangling . rst <nl> Types <nl> type : : = ' Bf ' NATURAL ' _ ' / / Builtin . Float < n > <nl> type : : = ' Bi ' NATURAL ' _ ' / / Builtin . Int < n > <nl> type : : = ' BI ' / / Builtin . IntLiteral <nl> - type : : = ' BO ' / / Builtin . UnknownObject <nl> + type : : = ' BO ' / / Builtin . UnknownObject ( no longer a distinct type , but still used for AnyObject ) <nl> type : : = ' Bo ' / / Builtin . NativeObject <nl> type : : = ' Bp ' / / Builtin . RawPointer <nl> type : : = ' Bt ' / / Builtin . SILToken <nl> mmm a / docs / ARCOptimization . rst <nl> ppp b / docs / ARCOptimization . rst <nl> is_unique performs depends on the argument type : <nl> <nl> - Objective - C object types require an additional check that the <nl> dynamic object type uses native Swift reference counting : <nl> - ( Builtin . UnknownObject , unknown class reference , class existential ) <nl> + ( unknown class reference , class existential ) <nl> <nl> - Bridged object types allow the dynamic object type check to be <nl> bypassed based on the pointer encoding : <nl> mmm a / include / swift / AST / ASTContext . h <nl> ppp b / include / swift / AST / ASTContext . h <nl> class ASTContext final { <nl> const CanType TheAnyType ; / / / This is ' Any ' , the empty protocol composition <nl> const CanType TheNativeObjectType ; / / / Builtin . NativeObject <nl> const CanType TheBridgeObjectType ; / / / Builtin . BridgeObject <nl> - const CanType TheUnknownObjectType ; / / / Builtin . UnknownObject <nl> const CanType TheRawPointerType ; / / / Builtin . RawPointer <nl> const CanType TheUnsafeValueBufferType ; / / / Builtin . UnsafeValueBuffer <nl> const CanType TheSILTokenType ; / / / Builtin . SILToken <nl> mmm a / include / swift / AST / TypeMatcher . h <nl> ppp b / include / swift / AST / TypeMatcher . h <nl> class TypeMatcher { <nl> TRIVIAL_CASE ( BuiltinRawPointerType ) <nl> TRIVIAL_CASE ( BuiltinNativeObjectType ) <nl> TRIVIAL_CASE ( BuiltinBridgeObjectType ) <nl> - TRIVIAL_CASE ( BuiltinUnknownObjectType ) <nl> TRIVIAL_CASE ( BuiltinUnsafeValueBufferType ) <nl> TRIVIAL_CASE ( BuiltinVectorType ) <nl> TRIVIAL_CASE ( SILTokenType ) <nl> mmm a / include / swift / AST / TypeNodes . def <nl> ppp b / include / swift / AST / TypeNodes . def <nl> ABSTRACT_TYPE ( Builtin , Type ) <nl> BUILTIN_TYPE ( BuiltinRawPointer , BuiltinType ) <nl> BUILTIN_TYPE ( BuiltinNativeObject , BuiltinType ) <nl> BUILTIN_TYPE ( BuiltinBridgeObject , BuiltinType ) <nl> - BUILTIN_TYPE ( BuiltinUnknownObject , BuiltinType ) <nl> BUILTIN_TYPE ( BuiltinUnsafeValueBuffer , BuiltinType ) <nl> BUILTIN_TYPE ( BuiltinVector , BuiltinType ) <nl> TYPE_RANGE ( Builtin , BuiltinInteger , BuiltinVector ) <nl> mmm a / include / swift / AST / Types . h <nl> ppp b / include / swift / AST / Types . h <nl> class BuiltinBridgeObjectType : public BuiltinType { <nl> } ; <nl> DEFINE_EMPTY_CAN_TYPE_WRAPPER ( BuiltinBridgeObjectType , BuiltinType ) ; <nl> <nl> - / / / BuiltinUnknownObjectType - The builtin opaque Objective - C pointer type . <nl> - / / / Useful for pushing an Objective - C type through swift . <nl> - class BuiltinUnknownObjectType : public BuiltinType { <nl> - friend class ASTContext ; <nl> - BuiltinUnknownObjectType ( const ASTContext & C ) <nl> - : BuiltinType ( TypeKind : : BuiltinUnknownObject , C ) { } <nl> - public : <nl> - static bool classof ( const TypeBase * T ) { <nl> - return T - > getKind ( ) = = TypeKind : : BuiltinUnknownObject ; <nl> - } <nl> - } ; <nl> - DEFINE_EMPTY_CAN_TYPE_WRAPPER ( BuiltinUnknownObjectType , BuiltinType ) ; <nl> - <nl> / / / BuiltinUnsafeValueBufferType - The builtin opaque fixed - size value <nl> / / / buffer type , into which storage for an arbitrary value can be <nl> / / / allocated using Builtin . allocateValueBuffer . <nl> mmm a / include / swift / Reflection / ReflectionContext . h <nl> ppp b / include / swift / Reflection / ReflectionContext . h <nl> class ReflectionContext <nl> / / Class existentials have trivial layout . <nl> / / It is itself the pointer to the instance followed by the witness tables . <nl> case RecordKind : : ClassExistential : <nl> - / / This is just Builtin . UnknownObject <nl> + / / This is just AnyObject . <nl> * OutInstanceTR = ExistentialRecordTI - > getFields ( ) [ 0 ] . TR ; <nl> * OutInstanceAddress = ExistentialAddress ; <nl> return true ; <nl> mmm a / include / swift / Runtime / BuiltinTypes . def <nl> ppp b / include / swift / Runtime / BuiltinTypes . def <nl> BUILTIN_POINTER_TYPE ( Bb , " Builtin . BridgeObject " ) <nl> BUILTIN_POINTER_TYPE ( Bp , " Builtin . RawPointer " ) <nl> BUILTIN_TYPE ( BB , " Builtin . UnsafeValueBuffer " ) <nl> <nl> + / / No longer used in the compiler as an AST type , but still used for fields  <nl> + / / shaped like AnyObject ( normal mangling yXl ) . <nl> BUILTIN_POINTER_TYPE ( BO , " Builtin . UnknownObject " ) <nl> <nl> / / Int8 vector types <nl> mmm a / include / swift / SIL / SILType . h <nl> ppp b / include / swift / SIL / SILType . h <nl> class SILType { <nl> <nl> / / / Get the NativeObject type as a SILType . <nl> static SILType getNativeObjectType ( const ASTContext & C ) ; <nl> - / / / Get the UnknownObject type as a SILType . <nl> - static SILType getUnknownObjectType ( const ASTContext & C ) ; <nl> / / / Get the BridgeObject type as a SILType . <nl> static SILType getBridgeObjectType ( const ASTContext & C ) ; <nl> / / / Get the RawPointer type as a SILType . <nl> mmm a / include / swift / Strings . h <nl> ppp b / include / swift / Strings . h <nl> constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_RAWPOINTER = { <nl> constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_UNSAFEVALUEBUFFER = <nl> { " Builtin . UnsafeValueBuffer " } ; <nl> / / / The name of the Builtin type for UnknownObject <nl> + / / / <nl> + / / / This no longer exists as an AST - accessible type , but it ' s still used for  <nl> + / / / fields shaped like AnyObject when ObjC interop is enabled . <nl> constexpr static BuiltinNameStringLiteral BUILTIN_TYPE_NAME_UNKNOWNOBJECT = { <nl> " Builtin . UnknownObject " } ; <nl> / / / The name of the Builtin type for Vector <nl> mmm a / lib / AST / ASTContext . cpp <nl> ppp b / lib / AST / ASTContext . cpp <nl> ASTContext : : ASTContext ( LangOptions & langOpts , SearchPathOptions & SearchPathOpts , <nl> BuiltinNativeObjectType ( * this ) ) , <nl> TheBridgeObjectType ( new ( * this , AllocationArena : : Permanent ) <nl> BuiltinBridgeObjectType ( * this ) ) , <nl> - TheUnknownObjectType ( new ( * this , AllocationArena : : Permanent ) <nl> - BuiltinUnknownObjectType ( * this ) ) , <nl> TheRawPointerType ( new ( * this , AllocationArena : : Permanent ) <nl> BuiltinRawPointerType ( * this ) ) , <nl> TheUnsafeValueBufferType ( new ( * this , AllocationArena : : Permanent ) <nl> mmm a / lib / AST / ASTDumper . cpp <nl> ppp b / lib / AST / ASTDumper . cpp <nl> namespace { <nl> TRIVIAL_TYPE_PRINTER ( BuiltinRawPointer , builtin_raw_pointer ) <nl> TRIVIAL_TYPE_PRINTER ( BuiltinNativeObject , builtin_native_object ) <nl> TRIVIAL_TYPE_PRINTER ( BuiltinBridgeObject , builtin_bridge_object ) <nl> - TRIVIAL_TYPE_PRINTER ( BuiltinUnknownObject , builtin_unknown_object ) <nl> TRIVIAL_TYPE_PRINTER ( BuiltinUnsafeValueBuffer , builtin_unsafe_value_buffer ) <nl> TRIVIAL_TYPE_PRINTER ( SILToken , sil_token ) <nl> <nl> mmm a / lib / AST / ASTMangler . cpp <nl> ppp b / lib / AST / ASTMangler . cpp <nl> void ASTMangler : : appendType ( Type type , const ValueDecl * forDecl ) { <nl> return appendOperator ( " Bo " ) ; <nl> case TypeKind : : BuiltinBridgeObject : <nl> return appendOperator ( " Bb " ) ; <nl> - case TypeKind : : BuiltinUnknownObject : <nl> - return appendOperator ( " BO " ) ; <nl> case TypeKind : : BuiltinUnsafeValueBuffer : <nl> return appendOperator ( " BB " ) ; <nl> case TypeKind : : SILToken : <nl> mmm a / lib / AST / ASTPrinter . cpp <nl> ppp b / lib / AST / ASTPrinter . cpp <nl> class TypePrinter : public TypeVisitor < TypePrinter > { <nl> } <nl> ASTPRINTER_PRINT_BUILTINTYPE ( BuiltinRawPointerType ) <nl> ASTPRINTER_PRINT_BUILTINTYPE ( BuiltinNativeObjectType ) <nl> - ASTPRINTER_PRINT_BUILTINTYPE ( BuiltinUnknownObjectType ) <nl> ASTPRINTER_PRINT_BUILTINTYPE ( BuiltinBridgeObjectType ) <nl> ASTPRINTER_PRINT_BUILTINTYPE ( BuiltinUnsafeValueBufferType ) <nl> ASTPRINTER_PRINT_BUILTINTYPE ( BuiltinIntegerLiteralType ) <nl> mmm a / lib / AST / Builtins . cpp <nl> ppp b / lib / AST / Builtins . cpp <nl> Type swift : : getBuiltinType ( ASTContext & Context , StringRef Name ) { <nl> return Context . TheRawPointerType ; <nl> if ( Name = = " NativeObject " ) <nl> return Context . TheNativeObjectType ; <nl> - if ( Name = = " UnknownObject " ) <nl> - return Context . TheUnknownObjectType ; <nl> if ( Name = = " BridgeObject " ) <nl> return Context . TheBridgeObjectType ; <nl> if ( Name = = " SILToken " ) <nl> StringRef BuiltinType : : getTypeName ( SmallVectorImpl < char > & result , <nl> case BuiltinTypeKind : : BuiltinNativeObject : <nl> printer < < MAYBE_GET_NAMESPACED_BUILTIN ( BUILTIN_TYPE_NAME_NATIVEOBJECT ) ; <nl> break ; <nl> - case BuiltinTypeKind : : BuiltinUnknownObject : <nl> - printer < < MAYBE_GET_NAMESPACED_BUILTIN ( BUILTIN_TYPE_NAME_UNKNOWNOBJECT ) ; <nl> - break ; <nl> case BuiltinTypeKind : : BuiltinBridgeObject : <nl> printer < < MAYBE_GET_NAMESPACED_BUILTIN ( BUILTIN_TYPE_NAME_BRIDGEOBJECT ) ; <nl> break ; <nl> mmm a / lib / AST / Type . cpp <nl> ppp b / lib / AST / Type . cpp <nl> bool CanType : : isReferenceTypeImpl ( CanType type , GenericSignature * sig , <nl> llvm_unreachable ( " sugared canonical type ? " ) ; <nl> <nl> / / These types are always class references . <nl> - case TypeKind : : BuiltinUnknownObject : <nl> case TypeKind : : BuiltinNativeObject : <nl> case TypeKind : : BuiltinBridgeObject : <nl> case TypeKind : : Class : <nl> ReferenceCounting TypeBase : : getReferenceCounting ( ) { <nl> case TypeKind : : BuiltinBridgeObject : <nl> return ReferenceCounting : : Bridge ; <nl> <nl> - case TypeKind : : BuiltinUnknownObject : <nl> - return ReferenceCounting : : Unknown ; <nl> - <nl> case TypeKind : : Class : <nl> return getClassReferenceCounting ( cast < ClassType > ( type ) - > getDecl ( ) ) ; <nl> case TypeKind : : BoundGenericClass : <nl> mmm a / lib / IRGen / GenClangType . cpp <nl> ppp b / lib / IRGen / GenClangType . cpp <nl> class GenClangType : public CanTypeVisitor < GenClangType , clang : : CanQualType > { <nl> clang : : CanQualType visitBuiltinRawPointerType ( CanBuiltinRawPointerType type ) ; <nl> clang : : CanQualType visitBuiltinIntegerType ( CanBuiltinIntegerType type ) ; <nl> clang : : CanQualType visitBuiltinFloatType ( CanBuiltinFloatType type ) ; <nl> - clang : : CanQualType visitBuiltinUnknownObjectType ( <nl> - CanBuiltinUnknownObjectType type ) ; <nl> clang : : CanQualType visitArchetypeType ( CanArchetypeType type ) ; <nl> clang : : CanQualType visitSILFunctionType ( CanSILFunctionType type ) ; <nl> clang : : CanQualType visitGenericTypeParamType ( CanGenericTypeParamType type ) ; <nl> clang : : CanQualType GenClangType : : visitBuiltinFloatType ( <nl> llvm_unreachable ( " cannot translate floating - point format to C " ) ; <nl> } <nl> <nl> - clang : : CanQualType GenClangType : : visitBuiltinUnknownObjectType ( <nl> - CanBuiltinUnknownObjectType type ) { <nl> - / / Builtin . UnknownObject = = AnyObject , so it is also translated to ' id ' . <nl> - return getClangIdType ( getClangASTContext ( ) ) ; <nl> - } <nl> - <nl> clang : : CanQualType GenClangType : : visitArchetypeType ( CanArchetypeType type ) { <nl> / / We see these in the case where we invoke an @ objc function <nl> / / through a protocol . <nl> mmm a / lib / IRGen / GenMeta . cpp <nl> ppp b / lib / IRGen / GenMeta . cpp <nl> namespace { <nl> case ClassMetadataStrategy : : Fixed : { <nl> / / FIXME : Should this check HasImported instead ? <nl> auto type = ( Target - > checkAncestry ( AncestryFlags : : ObjC ) <nl> - ? IGM . Context . TheUnknownObjectType <nl> + ? IGM . Context . getAnyObjectType ( ) <nl> : IGM . Context . TheNativeObjectType ) ; <nl> auto wtable = IGM . getAddrOfValueWitnessTable ( type ) ; <nl> B . add ( wtable ) ; <nl> namespace { <nl> / / Without Objective - C interop , foreign classes must still use <nl> / / Swift native reference counting . <nl> auto type = ( IGM . ObjCInterop <nl> - ? IGM . Context . TheUnknownObjectType <nl> + ? IGM . Context . getAnyObjectType ( ) <nl> : IGM . Context . TheNativeObjectType ) ; <nl> auto wtable = IGM . getAddrOfValueWitnessTable ( type ) ; <nl> B . add ( wtable ) ; <nl> mmm a / lib / IRGen / GenObjC . cpp <nl> ppp b / lib / IRGen / GenObjC . cpp <nl> llvm : : Value * irgen : : emitObjCAutoreleaseReturnValue ( IRGenFunction & IGF , <nl> } <nl> <nl> namespace { <nl> - / / / A type - info implementation suitable for Builtin . UnknownObject . <nl> + / / / A type - info implementation suitable for AnyObject on platforms with ObjC <nl> + / / / interop . <nl> class UnknownTypeInfo : public HeapTypeInfo < UnknownTypeInfo > { <nl> public : <nl> UnknownTypeInfo ( llvm : : PointerType * storageType , Size size , <nl> namespace { <nl> : HeapTypeInfo ( storageType , size , spareBits , align ) { <nl> } <nl> <nl> - / / / Builtin . UnknownObject requires ObjC reference - counting . <nl> + / / / AnyObject requires ObjC reference - counting . <nl> ReferenceCounting getReferenceCounting ( ) const { <nl> return ReferenceCounting : : Unknown ; <nl> } <nl> mmm a / lib / IRGen / GenReflection . cpp <nl> ppp b / lib / IRGen / GenReflection . cpp <nl> class FixedTypeMetadataBuilder : public ReflectionMetadataBuilder { <nl> } <nl> <nl> void layout ( ) override { <nl> - addTypeRef ( type , CanGenericSignature ( ) ) ; <nl> + if ( type - > isAnyObject ( ) ) { <nl> + / / AnyObject isn ' t actually a builtin type ; we ' re emitting it as the old <nl> + / / Builtin . UnknownObject type for ABI compatibility . <nl> + B . addRelativeAddress ( <nl> + IGM . getAddrOfStringForTypeRef ( " BO " , MangledTypeRefRole : : Reflection ) ) ; <nl> + } else { <nl> + addTypeRef ( type , CanGenericSignature ( ) ) ; <nl> + } <nl> <nl> B . addInt32 ( ti - > getFixedSize ( ) . getValue ( ) ) ; <nl> <nl> emitAssociatedTypeMetadataRecord ( const RootProtocolConformance * conformance ) { <nl> void IRGenModule : : emitBuiltinReflectionMetadata ( ) { <nl> if ( getSwiftModule ( ) - > isStdlibModule ( ) ) { <nl> BuiltinTypes . insert ( Context . TheNativeObjectType ) ; <nl> - BuiltinTypes . insert ( Context . TheUnknownObjectType ) ; <nl> + BuiltinTypes . insert ( Context . getAnyObjectType ( ) ) ; <nl> BuiltinTypes . insert ( Context . TheBridgeObjectType ) ; <nl> BuiltinTypes . insert ( Context . TheRawPointerType ) ; <nl> BuiltinTypes . insert ( Context . TheUnsafeValueBufferType ) ; <nl> mmm a / lib / IRGen / GenType . cpp <nl> ppp b / lib / IRGen / GenType . cpp <nl> const TypeInfo * TypeConverter : : convertType ( CanType ty ) { <nl> } <nl> case TypeKind : : BuiltinNativeObject : <nl> return & getNativeObjectTypeInfo ( ) ; <nl> - case TypeKind : : BuiltinUnknownObject : <nl> - return & getUnknownObjectTypeInfo ( ) ; <nl> case TypeKind : : BuiltinBridgeObject : <nl> return & getBridgeObjectTypeInfo ( ) ; <nl> case TypeKind : : BuiltinUnsafeValueBuffer : <nl> mmm a / lib / IRGen / GenValueWitness . cpp <nl> ppp b / lib / IRGen / GenValueWitness . cpp <nl> getAddrOfKnownValueWitnessTable ( IRGenModule & IGM , CanType type , <nl> case ReferenceCounting : : ObjC : <nl> case ReferenceCounting : : Block : <nl> case ReferenceCounting : : Unknown : <nl> - witnessSurrogate = C . TheUnknownObjectType ; <nl> + witnessSurrogate = C . getAnyObjectType ( ) ; <nl> break ; <nl> case ReferenceCounting : : Bridge : <nl> witnessSurrogate = C . TheBridgeObjectType ; <nl> mmm a / lib / IRGen / IRGenDebugInfo . cpp <nl> ppp b / lib / IRGen / IRGenDebugInfo . cpp <nl> class IRGenDebugInfoImpl : public IRGenDebugInfo { <nl> break ; <nl> } <nl> <nl> - case TypeKind : : BuiltinUnknownObject : { <nl> - / / The builtin opaque Objective - C pointer type . Useful for pushing <nl> - / / an Objective - C type through swift . <nl> - unsigned PtrSize = CI . getTargetInfo ( ) . getPointerWidth ( 0 ) ; <nl> - auto IdTy = DBuilder . createForwardDecl ( llvm : : dwarf : : DW_TAG_structure_type , <nl> - MangledName , Scope , File , 0 , <nl> - llvm : : dwarf : : DW_LANG_ObjC , 0 , 0 ) ; <nl> - return DBuilder . createPointerType ( IdTy , PtrSize , 0 , <nl> - / * DWARFAddressSpace * / None , <nl> - MangledName ) ; <nl> - } <nl> - <nl> case TypeKind : : BuiltinNativeObject : { <nl> unsigned PtrSize = CI . getTargetInfo ( ) . getPointerWidth ( 0 ) ; <nl> auto PTy = <nl> mmm a / lib / IRGen / IRGenMangler . h <nl> ppp b / lib / IRGen / IRGenMangler . h <nl> class IRGenMangler : public Mangle : : ASTMangler { <nl> std : : string mangleValueWitness ( Type type , ValueWitness witness ) ; <nl> <nl> std : : string mangleValueWitnessTable ( Type type ) { <nl> - return mangleTypeSymbol ( type , " WV " ) ; <nl> + const char * const witnessTableOp = " WV " ; <nl> + if ( type - > isAnyObject ( ) ) { <nl> + / / Special - case for AnyObject , whose witness table is under the old name <nl> + / / Builtin . UnknownObject , even though we don ' t use that as a Type anymore . <nl> + beginMangling ( ) ; <nl> + appendOperator ( " BO " ) ; <nl> + appendOperator ( witnessTableOp ) ; <nl> + return finalize ( ) ; <nl> + } <nl> + return mangleTypeSymbol ( type , witnessTableOp ) ; <nl> } <nl> <nl> std : : string mangleTypeMetadataAccessFunction ( Type type ) { <nl> class IRGenMangler : public Mangle : : ASTMangler { <nl> } <nl> <nl> std : : string mangleReflectionBuiltinDescriptor ( Type type ) { <nl> - return mangleTypeSymbol ( type , " MB " ) ; <nl> + const char * const reflectionDescriptorOp = " MB " ; <nl> + if ( type - > isAnyObject ( ) ) { <nl> + / / Special - case for AnyObject , whose reflection descriptor is under the <nl> + / / old name Builtin . UnknownObject , even though we don ' t use that as a Type <nl> + / / anymore . <nl> + beginMangling ( ) ; <nl> + appendOperator ( " BO " ) ; <nl> + appendOperator ( reflectionDescriptorOp ) ; <nl> + return finalize ( ) ; <nl> + } <nl> + return mangleTypeSymbol ( type , reflectionDescriptorOp ) ; <nl> } <nl> <nl> std : : string mangleReflectionFieldDescriptor ( Type type ) { <nl> mmm a / lib / IRGen / IRGenSIL . cpp <nl> ppp b / lib / IRGen / IRGenSIL . cpp <nl> static bool hasReferenceSemantics ( IRGenSILFunction & IGF , <nl> return ( objType - > mayHaveSuperclass ( ) <nl> | | objType - > isClassExistentialType ( ) <nl> | | objType - > is < BuiltinNativeObjectType > ( ) <nl> - | | objType - > is < BuiltinBridgeObjectType > ( ) <nl> - | | objType - > is < BuiltinUnknownObjectType > ( ) ) ; <nl> + | | objType - > is < BuiltinBridgeObjectType > ( ) ) ; <nl> } <nl> <nl> static llvm : : Value * emitIsUnique ( IRGenSILFunction & IGF , SILValue operand , <nl> mmm a / lib / IRGen / MetadataRequest . cpp <nl> ppp b / lib / IRGen / MetadataRequest . cpp <nl> namespace { <nl> return emitDirectMetadataRef ( type ) ; <nl> } <nl> <nl> - MetadataResponse <nl> - visitBuiltinUnknownObjectType ( CanBuiltinUnknownObjectType type , <nl> - DynamicMetadataRequest request ) { <nl> - return emitDirectMetadataRef ( type ) ; <nl> - } <nl> - <nl> MetadataResponse <nl> visitBuiltinUnsafeValueBufferType ( CanBuiltinUnsafeValueBufferType type , <nl> DynamicMetadataRequest request ) { <nl> namespace { <nl> DynamicMetadataRequest request ) { <nl> / / All function types have the same layout regardless of arguments or <nl> / / abstraction level . Use the metadata for ( ) - > ( ) for thick functions , <nl> - / / or Builtin . UnknownObject for block functions . <nl> + / / or AnyObject for block functions . <nl> auto & C = type - > getASTContext ( ) ; <nl> switch ( type - > getRepresentation ( ) ) { <nl> case SILFunctionType : : Representation : : Thin : <nl> namespace { <nl> CanFunctionType : : get ( { } , C . TheEmptyTupleType ) , <nl> request ) . getMetadata ( ) ; <nl> case SILFunctionType : : Representation : : Block : <nl> - / / All block types look like Builtin . UnknownObject . <nl> - return emitDirectMetadataRef ( C . TheUnknownObjectType , request ) ; <nl> + / / All block types look like AnyObject . <nl> + return emitDirectMetadataRef ( C . getAnyObjectType ( ) , request ) ; <nl> } <nl> <nl> llvm_unreachable ( " Not a valid SILFunctionType . " ) ; <nl> namespace { <nl> auto & C = IGF . IGM . Context ; <nl> if ( t = = C . TheEmptyTupleType <nl> | | t = = C . TheNativeObjectType <nl> - | | t = = C . TheUnknownObjectType <nl> | | t = = C . TheBridgeObjectType <nl> - | | t = = C . TheRawPointerType ) <nl> + | | t = = C . TheRawPointerType <nl> + | | t = = C . getAnyObjectType ( ) ) <nl> return true ; <nl> if ( auto intTy = dyn_cast < BuiltinIntegerType > ( t ) ) { <nl> auto width = intTy - > getWidth ( ) ; <nl> namespace { <nl> return emitFromValueWitnessTable ( <nl> CanFunctionType : : get ( { } , C . TheEmptyTupleType ) ) ; <nl> case SILFunctionType : : Representation : : Block : <nl> - / / All block types look like Builtin . UnknownObject . <nl> - return emitFromValueWitnessTable ( C . TheUnknownObjectType ) ; <nl> + / / All block types look like AnyObject . <nl> + return emitFromValueWitnessTable ( C . getAnyObjectType ( ) ) ; <nl> } <nl> <nl> llvm_unreachable ( " Not a valid SILFunctionType . " ) ; <nl> namespace { <nl> case ReferenceCounting : : ObjC : <nl> case ReferenceCounting : : Block : <nl> case ReferenceCounting : : Unknown : <nl> - return emitFromValueWitnessTable ( IGF . IGM . Context . TheUnknownObjectType ) ; <nl> + return emitFromValueWitnessTable ( IGF . IGM . Context . getAnyObjectType ( ) ) ; <nl> <nl> case ReferenceCounting : : Bridge : <nl> case ReferenceCounting : : Error : <nl> mmm a / lib / IRGen / TypeVisitor . h <nl> ppp b / lib / IRGen / TypeVisitor . h <nl> class ReferenceTypeVisitor : public CanTypeVisitor < ImplClass , RetTy , Args . . . > { <nl> <nl> / / BuiltinNativeObject <nl> / / BuiltinBridgeObject <nl> - / / BuiltinUnknownObject <nl> / / Class <nl> / / BoundGenericClass <nl> / / Protocol <nl> mmm a / lib / SIL / SILType . cpp <nl> ppp b / lib / SIL / SILType . cpp <nl> SILType SILType : : getBridgeObjectType ( const ASTContext & C ) { <nl> return SILType ( C . TheBridgeObjectType , SILValueCategory : : Object ) ; <nl> } <nl> <nl> - SILType SILType : : getUnknownObjectType ( const ASTContext & C ) { <nl> - return getPrimitiveObjectType ( C . TheUnknownObjectType ) ; <nl> - } <nl> - <nl> SILType SILType : : getRawPointerType ( const ASTContext & C ) { <nl> return getPrimitiveObjectType ( C . TheRawPointerType ) ; <nl> } <nl> bool SILType : : isHeapObjectReferenceType ( ) const { <nl> return true ; <nl> if ( Ty - > isEqual ( C . TheBridgeObjectType ) ) <nl> return true ; <nl> - if ( Ty - > isEqual ( C . TheUnknownObjectType ) ) <nl> - return true ; <nl> if ( is < SILBoxType > ( ) ) <nl> return true ; <nl> return false ; <nl> mmm a / lib / SIL / TypeLowering . cpp <nl> ppp b / lib / SIL / TypeLowering . cpp <nl> namespace { <nl> IMPL ( BuiltinRawPointer , Trivial ) <nl> IMPL ( BuiltinNativeObject , Reference ) <nl> IMPL ( BuiltinBridgeObject , Reference ) <nl> - IMPL ( BuiltinUnknownObject , Reference ) <nl> IMPL ( BuiltinVector , Trivial ) <nl> IMPL ( SILToken , Trivial ) <nl> IMPL ( Class , Reference ) <nl> namespace { <nl> return getConcreteReferenceStorageReferent ( bound - > getCanonicalType ( ) ) ; <nl> } <nl> <nl> - return TC . Context . TheUnknownObjectType ; <nl> + return TC . Context . getAnyObjectType ( ) ; <nl> } <nl> <nl> return type ; <nl> mmm a / lib / SILOptimizer / Analysis / AliasAnalysis . cpp <nl> ppp b / lib / SILOptimizer / Analysis / AliasAnalysis . cpp <nl> static bool typedAccessTBAAMayAlias ( SILType LTy , SILType RTy , <nl> <nl> / / The Builtin reference types can alias any class instance . <nl> if ( LTyClass ) { <nl> - if ( RTy . is < BuiltinUnknownObjectType > ( ) | | <nl> - RTy . is < BuiltinNativeObjectType > ( ) | | <nl> + if ( RTy . is < BuiltinNativeObjectType > ( ) | | <nl> RTy . is < BuiltinBridgeObjectType > ( ) ) { <nl> return true ; <nl> } <nl> mmm a / stdlib / public / runtime / Enum . cpp <nl> ppp b / stdlib / public / runtime / Enum . cpp <nl> swift : : swift_initEnumMetadataSinglePayload ( EnumMetadata * self , <nl> / / a single empty case , then we can borrow the witnesses of the single <nl> / / refcounted pointer type , since swift_retain and objc_retain are both <nl> / / nil - aware . Most single - refcounted types will use the standard <nl> - / / value witness tables for NativeObject or UnknownObject . This isn ' t <nl> + / / value witness tables for NativeObject or AnyObject . This isn ' t <nl> / / foolproof but should catch the common case of optional class types . <nl> # if OPTIONAL_OBJECT_OPTIMIZATION <nl> auto payloadVWT = payload - > getValueWitnesses ( ) ; <nl> mmm a / stdlib / public / runtime / Metadata . cpp <nl> ppp b / stdlib / public / runtime / Metadata . cpp <nl> FunctionCacheEntry : : FunctionCacheEntry ( const Key & key ) { <nl> <nl> case FunctionMetadataConvention : : Block : <nl> # if SWIFT_OBJC_INTEROP <nl> - / / Blocks are ObjC objects , so can share the Builtin . UnknownObject value <nl> - / / witnesses . <nl> + / / Blocks are ObjC objects , so can share the AnyObject value <nl> + / / witnesses ( stored as " BO " rather than " yXl " for ABI compat ) . <nl> Data . ValueWitnesses = & VALUE_WITNESS_SYM ( BO ) ; <nl> # else <nl> assert ( false & & " objc block without objc interop ? " ) ; <nl> mmm a / stdlib / public / runtime / ReflectionMirror . mm <nl> ppp b / stdlib / public / runtime / ReflectionMirror . mm <nl> auto call ( OpaqueValue * passedValue , const Metadata * T , const Metadata * passedTyp <nl> <nl> case MetadataKind : : Opaque : { <nl> # if SWIFT_OBJC_INTEROP <nl> - / / If this is the Builtin . UnknownObject type , use the dynamic type of the <nl> + / / If this is the AnyObject type , use the dynamic type of the <nl> / / object reference . <nl> if ( type = = & METADATA_SYM ( BO ) . base ) { <nl> return callClass ( ) ; <nl> mmm a / test / IRGen / builtins . swift <nl> ppp b / test / IRGen / builtins . swift <nl> func isUnique ( _ ref : inout Builtin . NativeObject ) - > Bool { <nl> return Builtin . isUnique ( & ref ) <nl> } <nl> <nl> - / / CHECK : define hidden { { . * } } void @ " $ s8builtins27acceptsBuiltinUnknownObjectyyBOSgzF " ( [ [ BUILTIN_UNKNOWN_OBJECT_TY : % . * ] ] * nocapture dereferenceable ( { { . * } } ) ) { { . * } } { <nl> - func acceptsBuiltinUnknownObject ( _ ref : inout Builtin . UnknownObject ? ) { } <nl> + / / CHECK : define hidden { { . * } } void @ " $ s8builtins16acceptsAnyObjectyyyXlSgzF " ( [ [ OPTIONAL_ANYOBJECT_TY : % . * ] ] * nocapture dereferenceable ( { { . * } } ) ) { { . * } } { <nl> + func acceptsAnyObject ( _ ref : inout Builtin . AnyObject ? ) { } <nl> <nl> / / ObjC <nl> - / / CHECK - LABEL : define hidden { { . * } } i1 @ " $ s8builtins8isUniqueyBi1_BOSgzF " ( { { % . * } } * nocapture dereferenceable ( { { . * } } ) ) { { . * } } { <nl> + / / CHECK - LABEL : define hidden { { . * } } i1 @ " $ s8builtins8isUniqueyBi1_yXlSgzF " ( { { % . * } } * nocapture dereferenceable ( { { . * } } ) ) { { . * } } { <nl> / / CHECK - NEXT : entry : <nl> - / / CHECK - NEXT : bitcast [ [ BUILTIN_UNKNOWN_OBJECT_TY ] ] * % 0 to [ [ UNKNOWN_OBJECT : % objc_object | % swift \ . refcounted ] ] * * <nl> - / / CHECK - NEXT : load [ [ UNKNOWN_OBJECT ] ] * , [ [ UNKNOWN_OBJECT ] ] * * % 1 <nl> - / / CHECK - objc - NEXT : call i1 @ swift_isUniquelyReferencedNonObjC ( [ [ UNKNOWN_OBJECT ] ] * % 2 ) <nl> - / / CHECK - native - NEXT : call i1 @ swift_isUniquelyReferenced_native ( [ [ UNKNOWN_OBJECT ] ] * % 2 ) <nl> - / / CHECK - NEXT : ret i1 % 3 <nl> - func isUnique ( _ ref : inout Builtin . UnknownObject ? ) - > Bool { <nl> + / / CHECK - NEXT : [ [ ADDR : % . + ] ] = getelementptr inbounds [ [ OPTIONAL_ANYOBJECT_TY ] ] , [ [ OPTIONAL_ANYOBJECT_TY ] ] * % 0 , i32 0 , i32 0 <nl> + / / CHECK - NEXT : [ [ CASTED : % . + ] ] = bitcast { { . + } } * [ [ ADDR ] ] to [ [ UNKNOWN_OBJECT : % objc_object | % swift \ . refcounted ] ] * * <nl> + / / CHECK - NEXT : [ [ REF : % . + ] ] = load [ [ UNKNOWN_OBJECT ] ] * , [ [ UNKNOWN_OBJECT ] ] * * [ [ CASTED ] ] <nl> + / / CHECK - objc - NEXT : [ [ RESULT : % . + ] ] = call i1 @ swift_isUniquelyReferencedNonObjC ( [ [ UNKNOWN_OBJECT ] ] * [ [ REF ] ] ) <nl> + / / CHECK - native - NEXT : [ [ RESULT : % . + ] ] = call i1 @ swift_isUniquelyReferenced_native ( [ [ UNKNOWN_OBJECT ] ] * [ [ REF ] ] ) <nl> + / / CHECK - NEXT : ret i1 [ [ RESULT ] ] <nl> + func isUnique ( _ ref : inout Builtin . AnyObject ? ) - > Bool { <nl> return Builtin . isUnique ( & ref ) <nl> } <nl> <nl> / / ObjC nonNull <nl> - / / CHECK - LABEL : define hidden { { . * } } i1 @ " $ s8builtins8isUniqueyBi1_BOzF " <nl> - / / CHECK - SAME : ( [ [ UNKNOWN_OBJECT ] ] * * nocapture dereferenceable ( { { . * } } ) ) { { . * } } { <nl> + / / CHECK - LABEL : define hidden { { . * } } i1 @ " $ s8builtins8isUniqueyBi1_yXlzF " <nl> + / / CHECK - SAME : ( % AnyObject * nocapture dereferenceable ( { { . * } } ) ) { { . * } } { <nl> / / CHECK - NEXT : entry : <nl> - / / CHECK - NEXT : load [ [ UNKNOWN_OBJECT ] ] * , [ [ UNKNOWN_OBJECT ] ] * * % 0 <nl> - / / CHECK - objc - NEXT : call i1 @ swift_isUniquelyReferencedNonObjC_nonNull ( [ [ UNKNOWN_OBJECT ] ] * % 1 ) <nl> - / / CHECK - native - NEXT : call i1 @ swift_isUniquelyReferenced_nonNull_native ( [ [ UNKNOWN_OBJECT ] ] * % 1 ) <nl> - / / CHECK - NEXT : ret i1 % 2 <nl> - func isUnique ( _ ref : inout Builtin . UnknownObject ) - > Bool { <nl> + / / CHECK - NEXT : [ [ ADDR : % . + ] ] = getelementptr inbounds % AnyObject , % AnyObject * % 0 , i32 0 , i32 0 <nl> + / / CHECK - NEXT : [ [ REF : % . + ] ] = load [ [ UNKNOWN_OBJECT ] ] * , [ [ UNKNOWN_OBJECT ] ] * * [ [ ADDR ] ] <nl> + / / CHECK - objc - NEXT : [ [ RESULT : % . + ] ] = call i1 @ swift_isUniquelyReferencedNonObjC_nonNull ( [ [ UNKNOWN_OBJECT ] ] * [ [ REF ] ] ) <nl> + / / CHECK - native - NEXT : [ [ RESULT : % . + ] ] = call i1 @ swift_isUniquelyReferenced_nonNull_native ( [ [ UNKNOWN_OBJECT ] ] * [ [ REF ] ] ) <nl> + / / CHECK - NEXT : ret i1 [ [ RESULT ] ] <nl> + func isUnique ( _ ref : inout Builtin . AnyObject ) - > Bool { <nl> return Builtin . isUnique ( & ref ) <nl> } <nl> <nl> mmm a / test / IRGen / class . sil <nl> ppp b / test / IRGen / class . sil <nl> entry ( % c : $ C ) : <nl> <nl> / / CHECK : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc [ [ OBJCOBJ ] ] * @ ref_to_objc_pointer_cast ( [ [ C_CLASS ] ] * ) <nl> / / CHECK : bitcast [ [ C_CLASS ] ] * % 0 to [ [ OBJCOBJ ] ] * <nl> - sil @ ref_to_objc_pointer_cast : $ @ convention ( thin ) ( C ) - > Builtin . UnknownObject { <nl> + sil @ ref_to_objc_pointer_cast : $ @ convention ( thin ) ( C ) - > Builtin . AnyObject { <nl> entry ( % c : $ C ) : <nl> - % r = unchecked_ref_cast % c : $ C to $ Builtin . UnknownObject <nl> - return % r : $ Builtin . UnknownObject <nl> + % r = unchecked_ref_cast % c : $ C to $ Builtin . AnyObject <nl> + return % r : $ Builtin . AnyObject <nl> } <nl> <nl> / / CHECK - LABEL : define { { ( dllexport ) ? } } { { ( protected ) ? } } swiftcc % T5class1CC * @ alloc_ref_dynamic ( % swift . type * ) <nl> mmm a / test / IRGen / dynamic_lookup . sil <nl> ppp b / test / IRGen / dynamic_lookup . sil <nl> bb0 ( % 0 : $ AnyObject ) : <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> % 6 = open_existential_ref % 4 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> - % 7 = unchecked_ref_cast % 6 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject to $ Builtin . UnknownObject <nl> <nl> / / CHECK : [ [ SEL : % [ 0 - 9 ] + ] ] = load i8 * , i8 * * @ " \ 01L_selector ( f ) " <nl> / / CHECK : [ [ RESPONDS : % [ 0 - 9 ] + ] ] = load i8 * , i8 * * @ " \ 01L_selector ( respondsToSelector : ) " <nl> / / CHECK : [ [ HAS_SEL : % [ 0 - 9 ] ] ] = call i1 { { . * } } @ objc_msgSend { { . * } } ( % objc_object * [ [ OBJECT : % [ 0 - 9 ] + ] ] , i8 * [ [ RESPONDS ] ] , i8 * [ [ SEL ] ] ) <nl> / / CHECK : br i1 [ [ HAS_SEL ] ] <nl> - dynamic_method_br % 7 : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> + dynamic_method_br % 6 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> <nl> - bb1 ( % 8 : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + bb1 ( % 8 : $ @ convention ( objc_method ) ( @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject ) - > ( ) ) : <nl> br bb3 <nl> <nl> bb2 : <nl> sil @ _T1t23dynamic_lookup_propertyFT1xPSo13AnyObject__T_ : $ @ convention ( thin ) ( A <nl> % 6 = load % 1a : $ * AnyObject / / users : % 24 , % 8 , % 7 <nl> strong_retain % 6 : $ AnyObject <nl> % 8 = open_existential_ref % 6 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject / / users : % 11 , % 9 <nl> - % 9 = unchecked_ref_cast % 8 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject to $ Builtin . UnknownObject <nl> - dynamic_method_br % 9 : $ Builtin . UnknownObject , # X . value ! getter . 1 . foreign , bb1 , bb2 <nl> + dynamic_method_br % 8 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject , # X . value ! getter . 1 . foreign , bb1 , bb2 <nl> <nl> - bb1 ( % 10 : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > Int ) : <nl> + bb1 ( % 10 : $ @ convention ( objc_method ) ( @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject ) - > Int ) : <nl> br bb3 <nl> <nl> bb2 : <nl> bb0 ( % 0 : $ AnyObject , % 1 : $ Int ) : <nl> % 8 = load % 2a : $ * AnyObject <nl> strong_retain % 8 : $ AnyObject <nl> % 10 = open_existential_ref % 8 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject <nl> - % 11 = unchecked_ref_cast % 10 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject to $ Builtin . UnknownObject <nl> / / CHECK : [ [ SEL : % [ 0 - 9 ] + ] ] = load i8 * , i8 * * @ " \ 01L_selector ( objectAtIndexedSubscript : ) " , align { { ( 4 | 8 ) } } <nl> / / CHECK : [ [ RESPONDS : % [ 0 - 9 ] + ] ] = load i8 * , i8 * * @ " \ 01L_selector ( respondsToSelector : ) " <nl> / / CHECK - NEXT : [ [ HAS_SEL : % [ 0 - 9 ] ] ] = call i1 { { . * } } @ objc_msgSend { { . * } } ( % objc_object * [ [ OBJECT : % [ 0 - 9 ] + ] ] , i8 * [ [ RESPONDS ] ] , i8 * [ [ SEL ] ] ) <nl> / / CHECK - NEXT : br i1 [ [ HAS_SEL ] ] , label [ [ HAS_METHOD : % [ 0 - 9 ] + ] ] , label [ [ HAS_METHOD : % [ 0 - 9 ] + ] ] <nl> <nl> - dynamic_method_br % 11 : $ Builtin . UnknownObject , # X . subscript ! getter . 1 . foreign , bb1 , bb2 <nl> + dynamic_method_br % 10 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject , # X . subscript ! getter . 1 . foreign , bb1 , bb2 <nl> <nl> - bb1 ( % 13 : $ @ convention ( objc_method ) ( Int , Builtin . UnknownObject ) - > Int ) : / / Preds : bb0 <nl> - % 14 = partial_apply % 13 ( % 11 ) : $ @ convention ( objc_method ) ( Int , Builtin . UnknownObject ) - > Int <nl> + bb1 ( % 13 : $ @ convention ( objc_method ) ( Int , @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject ) - > Int ) : / / Preds : bb0 <nl> + % 14 = partial_apply % 13 ( % 10 ) : $ @ convention ( objc_method ) ( Int , @ opened ( " 01234567 - 89ab - cdef - 0123 - 111111111111 " ) AnyObject ) - > Int <nl> % 15 = load % 3a : $ * Int <nl> % 16 = apply % 14 ( % 15 ) : $ @ callee_owned ( Int ) - > Int <nl> br bb3 <nl> mmm a / test / IRGen / enum_value_semantics . sil <nl> ppp b / test / IRGen / enum_value_semantics . sil <nl> enum MultiPayloadEmptyPayload { <nl> enum MultiPayloadNontrivial { <nl> case payload1 ( Builtin . NativeObject ) <nl> case payload2 ( Builtin . Int64 ) <nl> - case payload3 ( Builtin . Int64 , Builtin . UnknownObject ) <nl> + case payload3 ( Builtin . Int64 , Builtin . NativeObject ) <nl> case payload4 ( Builtin . Int64 , Builtin . Int64 ) <nl> case a <nl> case b <nl> enum MultiPayloadGeneric < T > { <nl> enum MultiPayloadNontrivialSpareBits { <nl> case payload1 ( Builtin . NativeObject ) <nl> case payload2 ( Builtin . Int64 ) <nl> - case payload3 ( Builtin . Int64 , Builtin . UnknownObject ) <nl> + case payload3 ( Builtin . Int64 , Builtin . NativeObject ) <nl> case a <nl> case b <nl> case c <nl> mmm a / test / IRGen / enum_value_semantics_special_cases_objc . sil <nl> ppp b / test / IRGen / enum_value_semantics_special_cases_objc . sil <nl> import Builtin <nl> <nl> / / ObjC payloads can be nullable too . <nl> enum NullableObjCRefcounted { <nl> - case Ref ( Builtin . UnknownObject ) <nl> + case Ref ( Builtin . AnyObject ) <nl> case None <nl> } <nl> / / CHECK - LABEL : define internal void @ " $ s39enum_value_semantics_special_cases_objc22NullableObjCRefcountedOwxx " ( % swift . opaque * noalias % object , % swift . type * % NullableObjCRefcounted ) { { . * } } { <nl> enum NullableObjCRefcounted { <nl> / / CHECK : call void @ swift_unknownObjectRelease ( % objc_object * % 2 ) { { # [ 0 - 9 ] + } } <nl> / / CHECK : ret void <nl> / / CHECK : } <nl> - <nl> - class C { } <nl> - sil_vtable C { } <nl> - <nl> - sil @ $ s39enum_value_semantics_special_cases_objc1CCfD : $ @ convention ( method ) ( C ) - > ( ) <nl> - <nl> - enum AllMixedRefcounted { <nl> - case Ref ( Builtin . NativeObject ) <nl> - case CRef ( C ) <nl> - case ORef ( Builtin . UnknownObject ) <nl> - case None <nl> - } <nl> - <nl> - / / CHECK - LABEL : define internal void @ " $ s39enum_value_semantics_special_cases_objc18AllMixedRefcountedOwxx " ( % swift . opaque * noalias % object , % swift . type * % AllMixedRefcounted ) { { . * } } { <nl> - / / CHECK : entry : <nl> - / / CHECK : % 0 = bitcast % swift . opaque * % object to % T39enum_value_semantics_special_cases_objc18AllMixedRefcountedO * <nl> - / / CHECK : % 1 = bitcast % T39enum_value_semantics_special_cases_objc18AllMixedRefcountedO * % 0 to i64 * <nl> - / / CHECK : % 2 = load i64 , i64 * % 1 , align 8 <nl> - / / CHECK : % 3 = lshr i64 % 2 , 62 <nl> - / / CHECK : % 4 = trunc i64 % 3 to i8 <nl> - / / CHECK : % 5 = and i8 % 4 , 3 <nl> - / / CHECK : call void @ " $ s39enum_value_semantics_special_cases_objc18AllMixedRefcountedOWOe " ( i64 % 2 ) <nl> - / / CHECK : ret void <nl> - / / CHECK : } <nl> - <nl> - enum AllMixedRefcountedTwoSimple { <nl> - case Ref ( Builtin . NativeObject ) <nl> - case CRef ( C ) <nl> - case ORef ( Builtin . UnknownObject ) <nl> - case None <nl> - case Nothing <nl> - } <nl> - <nl> - / / CHECK - LABEL : define internal void @ " $ s39enum_value_semantics_special_cases_objc27AllMixedRefcountedTwoSimpleOwxx " <nl> - / / CHECK : call void @ " $ s39enum_value_semantics_special_cases_objc27AllMixedRefcountedTwoSimpleOWOy " <nl> - <nl> - struct Val { <nl> - } <nl> - <nl> - / / Currently , swift_unknownObjectRelease does not support the indirect heap object . <nl> - <nl> - enum MixedRefcountedWithIndirect { <nl> - indirect case Indirect ( Builtin . Int64 ) <nl> - case Ref ( Builtin . UnknownObject ) <nl> - case None <nl> - } <nl> - <nl> - / / CHECK - LABEL : define internal void @ " $ s39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectOwxx " ( % swift . opaque * noalias % object , % swift . type * % MixedRefcountedWithIndirect ) <nl> - / / CHECK : entry : <nl> - / / CHECK : % 0 = bitcast % swift . opaque * % object to % T39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectO * <nl> - / / CHECK : % 1 = bitcast % T39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectO * % 0 to i64 * <nl> - / / CHECK : % 2 = load i64 , i64 * % 1 , align 8 <nl> - / / CHECK : % 3 = lshr i64 % 2 , 62 <nl> - / / CHECK : % 4 = trunc i64 % 3 to i8 <nl> - / / CHECK : % 5 = and i8 % 4 , 3 <nl> - / / CHECK : call void @ " $ s39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectOWOe " ( i64 % 2 ) <nl> - / / CHECK : ret void <nl> - / / CHECK : } <nl> - <nl> - <nl> - / / CHECK - LABEL : define linkonce_odr hidden void @ " $ s39enum_value_semantics_special_cases_objc27MixedRefcountedWithIndirectOWOe " ( i64 ) <nl> - / / CHECK : entry : <nl> - / / CHECK : % 1 = lshr i64 % 0 , 62 <nl> - / / CHECK : % 2 = trunc i64 % 1 to i8 <nl> - / / CHECK : % 3 = and i8 % 2 , 3 <nl> - / / CHECK : switch i8 % 3 , label % 9 [ <nl> - / / CHECK : i8 0 , label % 4 <nl> - / / CHECK : i8 1 , label % 6 <nl> - / / CHECK : ] <nl> - <nl> - / / CHECK : ; < label > : 4 : <nl> - / / CHECK : % 5 = inttoptr i64 % 0 to % swift . refcounted * <nl> - / / CHECK : call void @ swift_release ( % swift . refcounted * % 5 ) # 1 <nl> - / / CHECK : br label % 9 <nl> - <nl> - / / CHECK : ; < label > : 6 : <nl> - / / CHECK : % 7 = and i64 % 0 , 4611686018427387903 <nl> - / / CHECK : % 8 = inttoptr i64 % 7 to % objc_object * <nl> - / / CHECK : call void @ swift_unknownObjectRelease ( % objc_object * % 8 ) # 1 <nl> - / / CHECK : br label % 9 <nl> - <nl> - / / CHECK : ; < label > : 9 : <nl> - / / CHECK : ret void <nl> mmm a / test / IRGen / partial_apply_objc . sil <nl> ppp b / test / IRGen / partial_apply_objc . sil <nl> entry ( % x : $ Int ) : <nl> / / CHECK : define internal swiftcc void [ [ DYNAMIC_LOOKUP_BR_PARTIAL_APPLY_STUB ] ] ( i64 , % swift . refcounted * swiftself ) { { . * } } { <nl> / / CHECK : load i8 * , i8 * * @ " \ 01L_selector ( methodWithX : ) " , align 8 <nl> <nl> - sil @ dynamic_lookup_br_partial_apply : $ @ convention ( thin ) ( Builtin . UnknownObject ) - > @ callee_owned ( Int ) - > ( ) { <nl> - entry ( % o : $ Builtin . UnknownObject ) : <nl> - dynamic_method_br % o : $ Builtin . UnknownObject , # ObjCClass . method ! 1 . foreign , yes , no <nl> + sil @ dynamic_lookup_br_partial_apply : $ @ convention ( thin ) ( Builtin . AnyObject ) - > @ callee_owned ( Int ) - > ( ) { <nl> + entry ( % o : $ Builtin . AnyObject ) : <nl> + dynamic_method_br % o : $ Builtin . AnyObject , # ObjCClass . method ! 1 . foreign , yes , no <nl> <nl> - yes ( % m : $ @ convention ( objc_method ) ( Int , Builtin . UnknownObject ) - > ( ) ) : <nl> - % p = partial_apply % m ( % o ) : $ @ convention ( objc_method ) ( Int , Builtin . UnknownObject ) - > ( ) <nl> + yes ( % m : $ @ convention ( objc_method ) ( Int , Builtin . AnyObject ) - > ( ) ) : <nl> + % p = partial_apply % m ( % o ) : $ @ convention ( objc_method ) ( Int , Builtin . AnyObject ) - > ( ) <nl> br done ( % p : $ @ callee_owned ( Int ) - > ( ) ) <nl> <nl> no : <nl> mmm a / test / IRGen / typed_boxes . sil <nl> ppp b / test / IRGen / typed_boxes . sil <nl> sil @ unknown_rc_box : $ @ convention ( thin ) ( ) - > ( ) { <nl> entry : <nl> / / CHECK - 32 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_allocObject ( % swift . type * { { . * } } [ [ UNKNOWN_RC_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD ] ] 12 , [ [ WORD ] ] 3 ) <nl> / / CHECK - 64 : [ [ BOX : % . * ] ] = call noalias % swift . refcounted * @ swift_allocObject ( % swift . type * { { . * } } [ [ UNKNOWN_RC_METADATA : @ metadata [ 0 - 9 . ] * ] ] , { { . * } } [ [ WORD ] ] 24 , [ [ WORD ] ] 7 ) <nl> - % a = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > <nl> - % b = project_box % a : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - dealloc_box % a : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > <nl> + % a = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > <nl> + % b = project_box % a : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > , 0 <nl> + dealloc_box % a : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > <nl> return undef : $ ( ) <nl> } <nl> <nl> mmm a / test / IRGen / unknown_object . sil <nl> ppp b / test / IRGen / unknown_object . sil <nl> sil_stage canonical <nl> import Builtin <nl> <nl> / / CHECK - LABEL : @ retain_release_unknown_object <nl> - sil [ ossa ] @ retain_release_unknown_object : $ @ convention ( thin ) ( @ guaranteed Builtin . UnknownObject ) - > ( ) { <nl> - entry ( % x : @ guaranteed $ Builtin . UnknownObject ) : <nl> + sil [ ossa ] @ retain_release_unknown_object : $ @ convention ( thin ) ( @ guaranteed Builtin . AnyObject ) - > ( ) { <nl> + entry ( % x : @ guaranteed $ Builtin . AnyObject ) : <nl> / / CHECK - native : swift_retain <nl> / / CHECK - objc : swift_unknownObjectRetain <nl> - % y = copy_value % x : $ Builtin . UnknownObject <nl> + % y = copy_value % x : $ Builtin . AnyObject <nl> / / CHECK - native : swift_release <nl> / / CHECK - objc : swift_unknownObjectRelease <nl> - destroy_value % y : $ Builtin . UnknownObject <nl> + destroy_value % y : $ Builtin . AnyObject <nl> return undef : $ ( ) <nl> } <nl> mmm a / test / SIL / Parser / basic . sil <nl> ppp b / test / SIL / Parser / basic . sil <nl> bb0 : <nl> % C = alloc_ref $ C <nl> / / CHECK : unchecked_ref_cast % 0 : $ C to $ Builtin . NativeObject <nl> % 1 = unchecked_ref_cast % C : $ C to $ Builtin . NativeObject <nl> - / / CHECK : unchecked_ref_cast % 0 : $ C to $ Builtin . UnknownObject <nl> - % O = unchecked_ref_cast % C : $ C to $ Builtin . UnknownObject <nl> + / / CHECK : unchecked_ref_cast % 0 : $ C to $ AnyObject <nl> + % O = unchecked_ref_cast % C : $ C to $ Builtin . AnyObject <nl> <nl> / / CHECK : class_method { { . * } } : $ C , # C . doIt ! 1 <nl> % 2 = class_method % C : $ C , # C . doIt ! 1 : ( C ) - > ( ) - > ( ) , $ @ convention ( method ) ( @ guaranteed C ) - > ( ) <nl> bb0 ( % 0 : $ AnyObject ) : <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> % 6 = open_existential_ref % 4 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject <nl> - % 7 = unchecked_ref_cast % 6 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject to $ Builtin . UnknownObject <nl> - dynamic_method_br % 7 : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> - bb1 ( % z : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + dynamic_method_br % 6 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> + bb1 ( % z : $ @ convention ( objc_method ) ( @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject ) - > ( ) ) : <nl> br bb3 <nl> <nl> bb2 : <nl> mmm a / test / SIL / ownership - verifier / use_verifier . sil <nl> ppp b / test / SIL / ownership - verifier / use_verifier . sil <nl> bb9 : <nl> sil [ ossa ] @ dynamic_method_br_test : $ @ convention ( thin ) ( @ owned AnyObject , @ thick AnyObject . Type ) - > ( ) { <nl> bb0 ( % 0 : @ owned $ AnyObject , % 1 : $ @ thick AnyObject . Type ) : <nl> % 2 = open_existential_ref % 0 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> - % 3 = unchecked_ref_cast % 2 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject to $ Builtin . UnknownObject <nl> - dynamic_method_br % 3 : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> + dynamic_method_br % 2 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> <nl> - bb1 ( % 4 : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + bb1 ( % 4 : $ @ convention ( objc_method ) ( @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject ) - > ( ) ) : <nl> br bb3 <nl> <nl> bb2 : <nl> br bb3 <nl> <nl> bb3 : <nl> - destroy_value % 3 : $ Builtin . UnknownObject <nl> + destroy_value % 2 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> % 5 = open_existential_metatype % 1 : $ @ thick AnyObject . Type to $ @ thick ( @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000001 " ) AnyObject ) . Type <nl> dynamic_method_br % 5 : $ @ thick ( @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000001 " ) AnyObject ) . Type , # X . g ! 1 . foreign , bb4 , bb5 <nl> <nl> mmm a / test / SILGen / builtins . swift <nl> ppp b / test / SILGen / builtins . swift <nl> func isUnique ( _ ref : inout Builtin . NativeObject ) - > Bool { <nl> return Bool ( _builtinBooleanLiteral : Builtin . isUnique ( & ref ) ) <nl> } <nl> <nl> - / / UnknownObject ( ObjC ) <nl> + / / AnyObject ( ObjC ) <nl> / / CHECK - LABEL : sil hidden [ ossa ] @ $ s8builtins8isUnique { { [ _0 - 9a - zA - Z ] * } } F <nl> - / / CHECK : bb0 ( % 0 : $ * Optional < Builtin . UnknownObject > ) : <nl> + / / CHECK : bb0 ( % 0 : $ * Optional < AnyObject > ) : <nl> / / CHECK : [ [ WRITE : % . * ] ] = begin_access [ modify ] [ unknown ] % 0 <nl> - / / CHECK : [ [ BUILTIN : % . * ] ] = is_unique [ [ WRITE ] ] : $ * Optional < Builtin . UnknownObject > <nl> + / / CHECK : [ [ BUILTIN : % . * ] ] = is_unique [ [ WRITE ] ] : $ * Optional < AnyObject > <nl> / / CHECK : return <nl> - func isUnique ( _ ref : inout Builtin . UnknownObject ? ) - > Bool { <nl> + func isUnique ( _ ref : inout Builtin . AnyObject ? ) - > Bool { <nl> return Bool ( _builtinBooleanLiteral : Builtin . isUnique ( & ref ) ) <nl> } <nl> <nl> - / / UnknownObject ( ObjC ) nonNull <nl> + / / AnyObject ( ObjC ) nonNull <nl> / / CHECK - LABEL : sil hidden [ ossa ] @ $ s8builtins8isUnique { { [ _0 - 9a - zA - Z ] * } } F <nl> - / / CHECK : bb0 ( % 0 : $ * Builtin . UnknownObject ) : <nl> + / / CHECK : bb0 ( % 0 : $ * AnyObject ) : <nl> / / CHECK : [ [ WRITE : % . * ] ] = begin_access [ modify ] [ unknown ] % 0 <nl> - / / CHECK : [ [ BUILTIN : % . * ] ] = is_unique [ [ WRITE ] ] : $ * Builtin . UnknownObject <nl> + / / CHECK : [ [ BUILTIN : % . * ] ] = is_unique [ [ WRITE ] ] : $ * AnyObject <nl> / / CHECK : return <nl> - func isUnique ( _ ref : inout Builtin . UnknownObject ) - > Bool { <nl> + func isUnique ( _ ref : inout Builtin . AnyObject ) - > Bool { <nl> return Bool ( _builtinBooleanLiteral : Builtin . isUnique ( & ref ) ) <nl> } <nl> <nl> mmm a / test / SILOptimizer / ownership_model_eliminator . sil <nl> ppp b / test / SILOptimizer / ownership_model_eliminator . sil <nl> bb0 ( % 0 : @ guaranteed $ Builtin . NativeObject ) : <nl> return % 1 : $ Builtin . NativeObject <nl> } <nl> <nl> - / / CHECK - LABEL : sil @ switch_enum_default_case : $ @ convention ( thin ) ( @ owned Either < Builtin . NativeObject , Builtin . UnknownObject > ) - > ( ) { <nl> - / / CHECK : bb0 ( [ [ ARG : % . * ] ] : $ Either < Builtin . NativeObject , Builtin . UnknownObject > ) : <nl> - / / CHECK : switch_enum [ [ ARG ] ] : $ Either < Builtin . NativeObject , Builtin . UnknownObject > , case # Either . left ! enumelt . 1 : [ [ SUCC_BB : bb [ 0 - 9 ] + ] ] , default [ [ DEFAULT_BB : bb [ 0 - 9 ] + ] ] <nl> + / / CHECK - LABEL : sil @ switch_enum_default_case : $ @ convention ( thin ) ( @ owned Either < Builtin . NativeObject , AnyObject > ) - > ( ) { <nl> + / / CHECK : bb0 ( [ [ ARG : % . * ] ] : $ Either < Builtin . NativeObject , AnyObject > ) : <nl> + / / CHECK : switch_enum [ [ ARG ] ] : $ Either < Builtin . NativeObject , AnyObject > , case # Either . left ! enumelt . 1 : [ [ SUCC_BB : bb [ 0 - 9 ] + ] ] , default [ [ DEFAULT_BB : bb [ 0 - 9 ] + ] ] <nl> / / <nl> / / CHECK : [ [ SUCC_BB ] ] ( [ [ LHS : % . * ] ] : $ Builtin . NativeObject <nl> / / CHECK : strong_release [ [ LHS ] ] <nl> bb0 ( % 0 : @ guaranteed $ Builtin . NativeObject ) : <nl> / / CHECK : [ [ EPILOG_BB ] ] : <nl> / / CHECK : return <nl> / / CHECK : } / / end sil function ' switch_enum_default_case ' <nl> - sil [ ossa ] @ switch_enum_default_case : $ @ convention ( thin ) ( @ owned Either < Builtin . NativeObject , Builtin . UnknownObject > ) - > ( ) { <nl> - bb0 ( % 0 : @ owned $ Either < Builtin . NativeObject , Builtin . UnknownObject > ) : <nl> - switch_enum % 0 : $ Either < Builtin . NativeObject , Builtin . UnknownObject > , case # Either . left ! enumelt . 1 : bb1 , default bb2 <nl> + sil [ ossa ] @ switch_enum_default_case : $ @ convention ( thin ) ( @ owned Either < Builtin . NativeObject , Builtin . AnyObject > ) - > ( ) { <nl> + bb0 ( % 0 : @ owned $ Either < Builtin . NativeObject , Builtin . AnyObject > ) : <nl> + switch_enum % 0 : $ Either < Builtin . NativeObject , Builtin . AnyObject > , case # Either . left ! enumelt . 1 : bb1 , default bb2 <nl> <nl> bb1 ( % 1 : @ owned $ Builtin . NativeObject ) : <nl> destroy_value % 1 : $ Builtin . NativeObject <nl> br bb3 <nl> <nl> - bb2 ( % 2 : @ owned $ Either < Builtin . NativeObject , Builtin . UnknownObject > ) : <nl> - destroy_value % 2 : $ Either < Builtin . NativeObject , Builtin . UnknownObject > <nl> + bb2 ( % 2 : @ owned $ Either < Builtin . NativeObject , Builtin . AnyObject > ) : <nl> + destroy_value % 2 : $ Either < Builtin . NativeObject , Builtin . AnyObject > <nl> br bb3 <nl> <nl> bb3 : <nl> mmm a / test / SILOptimizer / simplify_cfg . sil <nl> ppp b / test / SILOptimizer / simplify_cfg . sil <nl> sil @ external_g : $ @ convention ( thin ) ( ) - > ( ) <nl> / / CHECK : dynamic_method_br <nl> / / CHECK - NOT : dynamic_method_br <nl> / / CHECK : return <nl> - sil @ dont_tail_duplicate_dynamic_method_br : $ @ convention ( thin ) ( @ owned Builtin . UnknownObject , Builtin . Int1 ) - > ( ) { <nl> - bb0 ( % x : $ Builtin . UnknownObject , % b : $ Builtin . Int1 ) : <nl> + sil @ dont_tail_duplicate_dynamic_method_br : $ @ convention ( thin ) ( @ owned Builtin . AnyObject , Builtin . Int1 ) - > ( ) { <nl> + bb0 ( % x : $ Builtin . AnyObject , % b : $ Builtin . Int1 ) : <nl> cond_br % b , bb1 , bb2 <nl> <nl> bb1 : <nl> % f = function_ref @ external_f : $ @ convention ( thin ) ( ) - > ( ) <nl> apply % f ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> - strong_retain % x : $ Builtin . UnknownObject <nl> - br bb3 ( % x : $ Builtin . UnknownObject ) <nl> + strong_retain % x : $ Builtin . AnyObject <nl> + br bb3 ( % x : $ Builtin . AnyObject ) <nl> <nl> bb2 : <nl> % g = function_ref @ external_g : $ @ convention ( thin ) ( ) - > ( ) <nl> apply % g ( ) : $ @ convention ( thin ) ( ) - > ( ) <nl> - strong_retain % x : $ Builtin . UnknownObject <nl> - br bb3 ( % x : $ Builtin . UnknownObject ) <nl> + strong_retain % x : $ Builtin . AnyObject <nl> + br bb3 ( % x : $ Builtin . AnyObject ) <nl> <nl> - bb3 ( % y : $ Builtin . UnknownObject ) : <nl> - strong_release % y : $ Builtin . UnknownObject <nl> - dynamic_method_br % x : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb4 , bb5 <nl> + bb3 ( % y : $ Builtin . AnyObject ) : <nl> + strong_release % y : $ Builtin . AnyObject <nl> + dynamic_method_br % x : $ Builtin . AnyObject , # X . f ! 1 . foreign , bb4 , bb5 <nl> <nl> - bb4 ( % m : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + bb4 ( % m : $ @ convention ( objc_method ) ( Builtin . AnyObject ) - > ( ) ) : <nl> br bb6 <nl> <nl> bb5 : <nl> mmm a / test / SILOptimizer / split_critical_edges . sil <nl> ppp b / test / SILOptimizer / split_critical_edges . sil <nl> class X { <nl> / / CHECK : bb0 ( <nl> / / CHECK : cond_br % 1 , bb1 , bb2 <nl> / / CHECK : bb1 : <nl> - / / CHECK : dynamic_method_br { { . * } } : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb3 , bb4 <nl> + / / CHECK : dynamic_method_br { { . * } } : $ AnyObject , # X . f ! 1 . foreign , bb3 , bb4 <nl> / / CHECK : bb2 : <nl> - / / CHECK : dynamic_method_br { { . * } } : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb5 , bb6 <nl> - / / CHECK : bb3 ( { { . * } } : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) <nl> + / / CHECK : dynamic_method_br { { . * } } : $ AnyObject , # X . f ! 1 . foreign , bb5 , bb6 <nl> + / / CHECK : bb3 ( { { . * } } : $ @ convention ( objc_method ) ( AnyObject ) - > ( ) ) <nl> / / CHECK : br bb7 <nl> / / CHECK : bb4 : <nl> / / CHECK : br bb7 <nl> - / / CHECK : bb5 ( { { . * } } : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + / / CHECK : bb5 ( { { . * } } : $ @ convention ( objc_method ) ( AnyObject ) - > ( ) ) : <nl> / / CHECK : br bb7 <nl> / / CHECK : bb6 : <nl> / / CHECK : br bb7 <nl> lookup1 : <nl> % 3 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Optional < ( ) - > ( ) > > <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> - % 6 = open_existential_ref % 4 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> - % 7 = unchecked_ref_cast % 6 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject to $ Builtin . UnknownObject <nl> - dynamic_method_br % 7 : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> + dynamic_method_br % 4 : $ AnyObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> <nl> lookup2 : <nl> % 21 = alloc_box $ < τ_0_0 > { var τ_0_0 } < AnyObject > <nl> lookup2 : <nl> % 23 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Optional < ( ) - > ( ) > > <nl> % 24 = load % 21a : $ * AnyObject <nl> strong_retain % 24 : $ AnyObject <nl> - % 26 = open_existential_ref % 24 : $ AnyObject to $ @ opened ( " 12345678 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject <nl> - % 27 = unchecked_ref_cast % 26 : $ @ opened ( " 12345678 - 89ab - cdef - 0123 - 000000000000 " ) AnyObject to $ Builtin . UnknownObject <nl> - dynamic_method_br % 27 : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb3 , bb4 <nl> + dynamic_method_br % 24 : $ AnyObject , # X . f ! 1 . foreign , bb3 , bb4 <nl> <nl> - bb1 ( % 8 : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + bb1 ( % 8 : $ @ convention ( objc_method ) ( AnyObject ) - > ( ) ) : <nl> br bb5 <nl> <nl> bb2 : <nl> br bb5 <nl> <nl> - bb3 ( % 9 : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + bb3 ( % 9 : $ @ convention ( objc_method ) ( AnyObject ) - > ( ) ) : <nl> br bb5 <nl> <nl> bb4 : <nl> mmm a / test / SILOptimizer / typed - access - tb - aa . sil <nl> ppp b / test / SILOptimizer / typed - access - tb - aa . sil <nl> bb0 : <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 135 . <nl> / / CHECK - NEXT : % 7 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 136 . <nl> / / CHECK - NEXT : % 7 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> bb0 : <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 142 . <nl> / / CHECK - NEXT : % 7 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> - / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 143 . <nl> / / CHECK - NEXT : % 7 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> bb0 : <nl> / / Now check that a native object address may : <nl> / / <nl> / / 1 . May alias raw pointer addresses . <nl> - / / 2 . Not alias an unknown object . Objective - C objects are allocated differently <nl> - / / than Swift objects and may not alias . <nl> + / / 2 . May alias an unknown object . <nl> / / 3 . Does not alias scalar addresses . This can only occur via inttoptr and the <nl> / / like . Since we are using type oracles we are allowed to make the assumption <nl> / / that this type of type punning can be ignored . <nl> bb0 : <nl> <nl> / / CHECK : PAIR # 149 . <nl> / / CHECK - NEXT : % 8 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 150 . <nl> / / CHECK - NEXT : % 8 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> / / CHECK - NEXT : % 10 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> bb0 : <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 156 . <nl> / / CHECK - NEXT : % 8 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 157 . <nl> / / CHECK - NEXT : % 8 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> / / CHECK - NEXT : % 17 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> bb0 : <nl> / / CHECK - NEXT : % 20 = project_box % 6 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE64 > , 0 <nl> / / CHECK - NEXT : NoAlias <nl> <nl> - / / Check that unknown object addresses may only alias raw pointer addresses and <nl> - / / other unknown object addresses . Anything else should be no alias . <nl> + / / Check that AnyObject addresses can alias pretty much any object or untyped <nl> + / / pointer . <nl> + / / FIXME : We could do better here ; AnyObject is a particularly easy existential . <nl> / / CHECK : PAIR # 163 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 10 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 164 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 11 = project_box % 4 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 165 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 12 = project_box % 5 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 166 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 13 = project_box % 6 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE64 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 167 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 14 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 168 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 15 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 169 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 170 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 17 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 171 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 18 = project_box % 4 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 172 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 19 = project_box % 5 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 173 . <nl> - / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : % 20 = project_box % 6 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE64 > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : MayAlias <nl> <nl> / / Next check that Int8 addresses can only alias Int8 addresses and raw <nl> / / pointers . This includes ensuring that Int8 cannot alias Int32 addresses . <nl> bb0 : <nl> / / CHECK - NEXT : NoAlias <nl> / / CHECK : PAIR # 181 . <nl> / / CHECK - NEXT : % 10 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> - / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 182 . <nl> / / CHECK - NEXT : % 10 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> / / CHECK - NEXT : % 17 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> bb0 : <nl> / / CHECK - NEXT : NoAlias <nl> / / CHECK : PAIR # 202 . <nl> / / CHECK - NEXT : % 12 = project_box % 5 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> - / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 203 . <nl> / / CHECK - NEXT : % 12 = project_box % 5 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> / / CHECK - NEXT : % 17 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> sil @ builtin_test : $ @ convention ( thin ) ( ) - > ( ) { <nl> bb0 : <nl> % 0 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > <nl> % 1 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > <nl> - % 2 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > <nl> + % 2 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > <nl> % 3 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > <nl> % 4 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > <nl> % 5 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > <nl> bb0 : <nl> <nl> % 7 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> % 8 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + % 9 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > , 0 <nl> % 10 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> % 11 = project_box % 4 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> % 12 = project_box % 5 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> bb0 : <nl> / / makes it simpler to write these tests . <nl> % 14 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> % 15 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + % 16 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > , 0 <nl> % 17 = project_box % 3 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> % 18 = project_box % 4 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> % 19 = project_box % 5 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> bb0 : <nl> / / CHECK - NEXT : NoAlias <nl> / / CHECK : PAIR # 353 . <nl> / / CHECK - NEXT : % 13 = project_box % 6 : $ < τ_0_0 > { var τ_0_0 } < STest_S3 > , 0 <nl> - / / CHECK - NEXT : % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 354 . <nl> / / CHECK - NEXT : % 13 = project_box % 6 : $ < τ_0_0 > { var τ_0_0 } < STest_S3 > , 0 <nl> / / CHECK - NEXT : % 29 = project_box % 24 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> sil @ struct_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> <nl> % 21 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > <nl> % 22 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > <nl> - % 23 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > <nl> + % 23 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > <nl> % 24 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > <nl> % 25 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > <nl> <nl> % 26 = project_box % 21 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> % 27 = project_box % 22 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > , 0 <nl> % 29 = project_box % 24 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> % 30 = project_box % 25 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> <nl> sil @ struct_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : NoAlias <nl> / / CHECK : PAIR # 353 . <nl> / / CHECK - NEXT : % 13 = project_box % 6 : $ < τ_0_0 > { var τ_0_0 } < ETest_E3 > , 0 <nl> - / / CHECK - NEXT : % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 354 . <nl> / / CHECK - NEXT : % 13 = project_box % 6 : $ < τ_0_0 > { var τ_0_0 } < ETest_E3 > , 0 <nl> / / CHECK - NEXT : % 29 = project_box % 24 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> sil @ enum_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> <nl> % 21 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > <nl> % 22 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > <nl> - % 23 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > <nl> + % 23 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > <nl> % 24 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > <nl> % 25 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > <nl> <nl> % 26 = project_box % 21 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> % 27 = project_box % 22 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + % 28 = project_box % 23 : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > , 0 <nl> % 29 = project_box % 24 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> % 30 = project_box % 25 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> <nl> sil @ enum_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 85 . <nl> / / CHECK - NEXT : % 3 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < CTest_C1 > , 0 <nl> - / / CHECK - NEXT : % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 86 . <nl> / / CHECK - NEXT : % 3 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < CTest_C1 > , 0 <nl> sil @ enum_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 105 . <nl> / / CHECK - NEXT : % 4 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < CTest_C2 > , 0 <nl> - / / CHECK - NEXT : % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 106 . <nl> / / CHECK - NEXT : % 4 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < CTest_C2 > , 0 <nl> sil @ enum_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 124 . <nl> / / CHECK - NEXT : % 5 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < CTest_C3 > , 0 <nl> - / / CHECK - NEXT : % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + / / CHECK - NEXT : % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 125 . <nl> / / CHECK - NEXT : % 5 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < CTest_C3 > , 0 <nl> sil @ class_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> % 9 = alloc_box $ < τ_0_0 > { var τ_0_0 } < AnyObject > <nl> % 10 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > <nl> % 11 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > <nl> - % 12 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > <nl> + % 12 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > <nl> % 13 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > <nl> % 14 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > <nl> % 15 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > <nl> sil @ class_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> % 16 = project_box % 9 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> % 17 = project_box % 10 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> % 18 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + % 19 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > , 0 <nl> % 20 = project_box % 13 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> % 21 = project_box % 14 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> % 22 = project_box % 15 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> sil @ class_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : NoAlias <nl> / / CHECK : PAIR # 77 . <nl> / / CHECK - NEXT : % 3 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < ( Builtin . RawPointer , Builtin . Int64 ) > , 0 <nl> - / / CHECK - NEXT : % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 78 . <nl> / / CHECK - NEXT : % 3 = project_box % 0 : $ < τ_0_0 > { var τ_0_0 } < ( Builtin . RawPointer , Builtin . Int64 ) > , 0 <nl> / / CHECK - NEXT : % 18 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> sil @ class_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : NoAlias <nl> / / CHECK : PAIR # 95 . <nl> / / CHECK - NEXT : % 4 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < ( TTest_S1 , Builtin . Int64 ) > , 0 <nl> - / / CHECK - NEXT : % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 96 . <nl> / / CHECK - NEXT : % 4 = project_box % 1 : $ < τ_0_0 > { var τ_0_0 } < ( TTest_S1 , Builtin . Int64 ) > , 0 <nl> / / CHECK - NEXT : % 18 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> sil @ class_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> / / CHECK - NEXT : NoAlias <nl> / / CHECK : PAIR # 112 . <nl> / / CHECK - NEXT : % 5 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < ( TTest_E1 , Builtin . Int64 ) > , 0 <nl> - / / CHECK - NEXT : % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> - / / CHECK - NEXT : NoAlias <nl> + / / CHECK - NEXT : % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < AnyObject > , 0 <nl> + / / CHECK - NEXT : MayAlias <nl> / / CHECK : PAIR # 113 . <nl> / / CHECK - NEXT : % 5 = project_box % 2 : $ < τ_0_0 > { var τ_0_0 } < ( TTest_E1 , Builtin . Int64 ) > , 0 <nl> / / CHECK - NEXT : % 18 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> sil @ tuple_tests : $ @ convention ( thin ) ( ) - > ( ) { <nl> <nl> % 9 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > <nl> % 10 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > <nl> - % 11 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > <nl> + % 11 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > <nl> % 12 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > <nl> % 13 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > <nl> % 14 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > <nl> <nl> % 15 = project_box % 9 : $ < τ_0_0 > { var τ_0_0 } < Builtin . RawPointer > , 0 <nl> % 16 = project_box % 10 : $ < τ_0_0 > { var τ_0_0 } < Builtin . NativeObject > , 0 <nl> - % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < Builtin . UnknownObject > , 0 <nl> + % 17 = project_box % 11 : $ < τ_0_0 > { var τ_0_0 } < Builtin . AnyObject > , 0 <nl> % 18 = project_box % 12 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int8 > , 0 <nl> % 19 = project_box % 13 : $ < τ_0_0 > { var τ_0_0 } < Builtin . Int32 > , 0 <nl> % 20 = project_box % 14 : $ < τ_0_0 > { var τ_0_0 } < Builtin . FPIEEE32 > , 0 <nl> mmm a / test / Serialization / Inputs / def_basic . sil <nl> ppp b / test / Serialization / Inputs / def_basic . sil <nl> bb0 : <nl> % C = alloc_ref $ C <nl> / / CHECK : unchecked_ref_cast % 0 : $ C to $ Builtin . NativeObject <nl> % 1 = unchecked_ref_cast % C : $ C to $ Builtin . NativeObject <nl> - / / CHECK : unchecked_ref_cast % 0 : $ C to $ Builtin . UnknownObject <nl> - % O = unchecked_ref_cast % C : $ C to $ Builtin . UnknownObject <nl> + / / CHECK : unchecked_ref_cast % 0 : $ C to $ AnyObject <nl> + % O = unchecked_ref_cast % C : $ C to $ Builtin . AnyObject <nl> <nl> / / CHECK : class_method { { . * } } : $ C , # C . doIt ! 1 <nl> % 2 = class_method % C : $ C , # C . doIt ! 1 : ( C ) - > ( ) - > ( ) , $ @ convention ( method ) ( @ guaranteed C ) - > ( ) <nl> bb0 ( % 0 : $ AnyObject ) : <nl> % 3 = alloc_box $ < τ_0_0 > { var τ_0_0 } < Optional < ( ) - > ( ) > > <nl> % 4 = load % 1a : $ * AnyObject <nl> strong_retain % 4 : $ AnyObject <nl> - / / CHECK : open_existential_ref % { { . * } } : $ AnyObject to $ @ opened ( { { . * } } ) AnyObject <nl> + / / CHECK : open_existential_ref % { { . * } } : $ AnyObject to $ @ opened ( [ [ EXISTENTIAL_UUID : . * ] ] ) AnyObject <nl> % 6 = open_existential_ref % 4 : $ AnyObject to $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject <nl> - % 7 = unchecked_ref_cast % 6 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject to $ Builtin . UnknownObject <nl> - / / CHECK : dynamic_method_br % { { . * } } : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb { { . * } } , bb { { . * } } <nl> - dynamic_method_br % 7 : $ Builtin . UnknownObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> - bb1 ( % z : $ @ convention ( objc_method ) ( Builtin . UnknownObject ) - > ( ) ) : <nl> + / / CHECK : dynamic_method_br % { { . * } } : $ @ opened ( [ [ EXISTENTIAL_UUID ] ] ) AnyObject , # X . f ! 1 . foreign , bb { { . * } } , bb { { . * } } <nl> + dynamic_method_br % 6 : $ @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject , # X . f ! 1 . foreign , bb1 , bb2 <nl> + bb1 ( % z : $ @ convention ( objc_method ) ( @ opened ( " 01234567 - 89ab - cdef - 0123 - 222222222222 " ) AnyObject ) - > ( ) ) : <nl> br bb3 <nl> <nl> bb2 : <nl>
Eliminate Builtin . UnknownObject as an AST type ( )
apple/swift
a6dd630ca3ebb5a5049cd831640d0de03d799295
2019-09-27T00:48:04Z
mmm a / torch / autograd / gradcheck . py <nl> ppp b / torch / autograd / gradcheck . py <nl> def fail_test ( msg ) : <nl> if any ( t . is_sparse for t in tupled_inputs if isinstance ( t , torch . Tensor ) ) and not check_sparse_nnz : <nl> return fail_test ( ' gradcheck expects all tensor inputs are dense when check_sparse_nnz is set to False . ' ) <nl> <nl> - # Make sure that gradients are saved for all inputs <nl> + # Make sure that gradients are saved for at least one input <nl> any_input_requiring_grad = False <nl> - some_input_not_requiring_grad = False <nl> for inp in tupled_inputs : <nl> - if isinstance ( inp , torch . Tensor ) : <nl> - if inp . requires_grad : <nl> - if not ( inp . dtype = = torch . float64 or inp . dtype = = torch . complex128 ) : <nl> - warnings . warn ( <nl> - ' At least one of the inputs that requires gradient ' <nl> - ' is not of double precision floating point or complex . ' <nl> - ' This check will likely fail if all the inputs are ' <nl> - ' not of double precision floating point or complex . ' ) <nl> - any_input_requiring_grad = True <nl> - inp . retain_grad ( ) <nl> - else : <nl> - some_input_not_requiring_grad = True <nl> + if isinstance ( inp , torch . Tensor ) and inp . requires_grad : <nl> + if not ( inp . dtype = = torch . float64 or inp . dtype = = torch . complex128 ) : <nl> + warnings . warn ( <nl> + ' At least one of the inputs that requires gradient ' <nl> + ' is not of double precision floating point or complex . ' <nl> + ' This check will likely fail if all the inputs are ' <nl> + ' not of double precision floating point or complex . ' ) <nl> + any_input_requiring_grad = True <nl> + inp . retain_grad ( ) <nl> if not any_input_requiring_grad : <nl> raise ValueError ( <nl> ' gradcheck expects at least one input tensor to require gradient , ' <nl> ' but none of the them have requires_grad = True . ' ) <nl> - if some_input_not_requiring_grad : <nl> - raise ValueError ( <nl> - ' gradcheck expects if at least one input tensor is required gradient , ' <nl> - ' then all other inputs should have requires_grad = True . ' ) <nl> <nl> func_out = func ( * tupled_inputs ) <nl> output = _differentiable_outputs ( func_out ) <nl>
Fix unreachable validation for gradcheck ( )
pytorch/pytorch
628e3b6fbd518dd1589773854e082e339cf9754c
2020-05-14T15:18:14Z
mmm a / taichi / backends / codegen_llvm_ptx . cpp <nl> ppp b / taichi / backends / codegen_llvm_ptx . cpp <nl> class CodeGenLLVMGPU : public CodeGenLLVM { <nl> TC_ASSERT ( stmt - > width ( ) = = 1 ) ; <nl> int addr_space ; <nl> / / https : / / llvm . org / docs / NVPTXUsage . html # address - spaces <nl> - if ( stmt - > dest - > is < AllocaStmt > ( ) ) { <nl> - / / local <nl> - addr_space = 5 ; <nl> - } else { <nl> - / / global <nl> - addr_space = 1 ; <nl> - } <nl> - for ( int l = 0 ; l < stmt - > width ( ) ; l + + ) { <nl> + bool is_local = stmt - > dest - > is < AllocaStmt > ( ) ; <nl> + if ( is_local ) { <nl> + auto load = builder - > CreateLoad ( stmt - > dest - > value ) ; <nl> TC_ASSERT ( stmt - > op_type = = AtomicOpType : : add ) ; <nl> - if ( is_integral ( stmt - > val - > ret_type . data_type ) ) <nl> - builder - > CreateAtomicRMW ( <nl> - llvm : : AtomicRMWInst : : BinOp : : Add , stmt - > dest - > value , <nl> - stmt - > val - > value , llvm : : AtomicOrdering : : SequentiallyConsistent ) ; <nl> - else if ( stmt - > val - > ret_type . data_type = = DataType : : f32 ) { <nl> - auto dt = tlctx - > get_data_type ( DataType : : f32 ) ; <nl> - builder - > CreateIntrinsic ( Intrinsic : : nvvm_atomic_load_add_f32 , <nl> - { llvm : : PointerType : : get ( dt , addr_space ) } , <nl> - { stmt - > dest - > value , stmt - > val - > value } ) ; <nl> - } else if ( stmt - > val - > ret_type . data_type = = DataType : : f64 ) { <nl> - auto dt = tlctx - > get_data_type ( DataType : : f64 ) ; <nl> - builder - > CreateIntrinsic ( Intrinsic : : nvvm_atomic_load_add_f64 , <nl> - { llvm : : PointerType : : get ( dt , addr_space ) } , <nl> - { stmt - > dest - > value , stmt - > val - > value } ) ; <nl> - } else { <nl> - TC_NOT_IMPLEMENTED <nl> + auto add = builder - > CreateAdd ( load , stmt - > val - > value ) ; <nl> + builder - > CreateStore ( add , stmt - > dest - > value ) ; <nl> + } else { <nl> + for ( int l = 0 ; l < stmt - > width ( ) ; l + + ) { <nl> + TC_ASSERT ( stmt - > op_type = = AtomicOpType : : add ) ; <nl> + if ( is_integral ( stmt - > val - > ret_type . data_type ) ) { <nl> + builder - > CreateAtomicRMW ( <nl> + llvm : : AtomicRMWInst : : BinOp : : Add , stmt - > dest - > value , <nl> + stmt - > val - > value , llvm : : AtomicOrdering : : SequentiallyConsistent ) ; <nl> + } else if ( stmt - > val - > ret_type . data_type = = DataType : : f32 ) { <nl> + auto dt = tlctx - > get_data_type ( DataType : : f32 ) ; <nl> + builder - > CreateIntrinsic ( Intrinsic : : nvvm_atomic_load_add_f32 , <nl> + { llvm : : PointerType : : get ( dt , 0 ) } , <nl> + { stmt - > dest - > value , stmt - > val - > value } ) ; <nl> + } else if ( stmt - > val - > ret_type . data_type = = DataType : : f64 ) { <nl> + auto dt = tlctx - > get_data_type ( DataType : : f64 ) ; <nl> + builder - > CreateIntrinsic ( Intrinsic : : nvvm_atomic_load_add_f64 , <nl> + { llvm : : PointerType : : get ( dt , 0 ) } , <nl> + { stmt - > dest - > value , stmt - > val - > value } ) ; <nl> + } else { <nl> + TC_NOT_IMPLEMENTED <nl> + } <nl> } <nl> } <nl> } <nl> mmm a / tests / python / test_lang . py <nl> ppp b / tests / python / test_lang . py <nl> def place ( ) : <nl> assert x [ 0 ] = = 0 <nl> <nl> def test_nested_subscript ( ) : <nl> - return <nl> ti . reset ( ) <nl> - <nl> x = ti . var ( ti . i32 ) <nl> y = ti . var ( ti . i32 ) <nl> <nl> def inc ( ) : <nl> <nl> @ ti . all_archs <nl> def test_norm ( ) : <nl> - return <nl> val = ti . var ( ti . i32 ) <nl> f = ti . var ( ti . f32 ) <nl> <nl> def test ( ) : <nl> test ( ) <nl> <nl> <nl> - # @ ti . all_archs <nl> + @ ti . all_archs <nl> def test_local_atomics ( ) : <nl> - ti . reset ( ) <nl> - ti . cfg . arch = ti . cuda <nl> - ti . cfg . print_ir = True <nl> - # ti . cfg . print_kernel_llvm_ir = True <nl> - <nl> n = 32 <nl> val = ti . var ( ti . i32 , shape = n ) <nl> <nl> def test ( ) : <nl> s = 0 <nl> s + = 45 <nl> print ( s ) <nl> - # val [ i ] = s + i <nl> - # print ( val [ i ] ) <nl> + val [ i ] = s + i <nl> + print ( val [ i ] ) <nl> <nl> test ( ) <nl> <nl> - # for i in range ( n ) : <nl> - # assert val [ i ] = = i + 45 <nl> + for i in range ( n ) : <nl> + assert val [ i ] = = i + 45 <nl> <nl> - test_local_atomics ( ) <nl>
lower CUDA local ' atomic ' to RMW
taichi-dev/taichi
f71a7f1ea352bad94fa0bccce6f09954427c78be
2019-12-12T12:50:34Z
mmm a / modules / dnn / src / ocl4dnn / src / math_functions . cpp <nl> ppp b / modules / dnn / src / ocl4dnn / src / math_functions . cpp <nl> bool ocl4dnnGEMV < float > ( const CBLAS_TRANSPOSE TransA , <nl> ret = k . run ( 1 , globalsize , localsize , false ) ; <nl> } <nl> <nl> - if ( ( row_size % 4 ) ! = 0 & & ret ) <nl> + if ( row_size < 4 | | ( ( row_size % 4 ) ! = 0 & & ret ) ) <nl> { <nl> String kname = format ( " matvec_mul1_ % s " , use_half ? " half " : " float " ) ; <nl> ocl : : Kernel k_1 ( kname . c_str ( ) , cv : : ocl : : dnn : : matvec_mul_oclsrc , opts ) ; <nl> mmm a / modules / dnn / test / test_halide_layers . cpp <nl> ppp b / modules / dnn / test / test_halide_layers . cpp <nl> TEST_P ( Convolution , Accuracy ) <nl> int backendId = get < 0 > ( get < 7 > ( GetParam ( ) ) ) ; <nl> int targetId = get < 1 > ( get < 7 > ( GetParam ( ) ) ) ; <nl> <nl> - if ( ( backendId = = DNN_BACKEND_INFERENCE_ENGINE & & targetId = = DNN_TARGET_MYRIAD ) | | <nl> - ( backendId = = DNN_BACKEND_OPENCV & & targetId = = DNN_TARGET_OPENCL_FP16 ) ) <nl> + if ( backendId = = DNN_BACKEND_INFERENCE_ENGINE & & targetId = = DNN_TARGET_MYRIAD ) <nl> + throw SkipTestException ( " " ) ; <nl> + <nl> + / / TODO : unstable test cases <nl> + if ( backendId = = DNN_BACKEND_OPENCV & & ( targetId = = DNN_TARGET_OPENCL | | targetId = = DNN_TARGET_OPENCL_FP16 ) & & <nl> + inChannels = = 6 & & outChannels = = 9 & & group = = 1 & & inSize = = Size ( 5 , 6 ) & & <nl> + kernel = = Size ( 3 , 1 ) & & stride = = Size ( 1 , 1 ) & & pad = = Size ( 0 , 1 ) & & dilation = = Size ( 1 , 1 ) & & <nl> + hasBias ) <nl> throw SkipTestException ( " " ) ; <nl> <nl> int sz [ ] = { outChannels , inChannels / group , kernel . height , kernel . width } ; <nl> TEST_P ( FullyConnected , Accuracy ) <nl> bool hasBias = get < 3 > ( GetParam ( ) ) ; <nl> int backendId = get < 0 > ( get < 4 > ( GetParam ( ) ) ) ; <nl> int targetId = get < 1 > ( get < 4 > ( GetParam ( ) ) ) ; <nl> - if ( backendId = = DNN_BACKEND_INFERENCE_ENGINE | | <nl> - ( backendId = = DNN_BACKEND_OPENCV & & targetId = = DNN_TARGET_OPENCL_FP16 ) ) <nl> + if ( backendId = = DNN_BACKEND_INFERENCE_ENGINE ) <nl> throw SkipTestException ( " " ) ; <nl> <nl> Mat weights ( outChannels , inChannels * inSize . height * inSize . width , CV_32F ) ; <nl> TEST_P ( Eltwise , Accuracy ) <nl> int backendId = get < 0 > ( get < 4 > ( GetParam ( ) ) ) ; <nl> int targetId = get < 1 > ( get < 4 > ( GetParam ( ) ) ) ; <nl> <nl> - if ( backendId = = DNN_BACKEND_OPENCV & & <nl> - ( targetId = = DNN_TARGET_OPENCL | | targetId = = DNN_TARGET_OPENCL_FP16 ) ) <nl> - throw SkipTestException ( " " ) ; <nl> - <nl> Net net ; <nl> <nl> std : : vector < int > convLayerIds ( numConv ) ; <nl>
Merge pull request from dkurt : dnn_cl_fix_matmul
opencv/opencv
d6c669f5cf559d8da6a3df93b14408e6c85659c8
2018-07-16T11:10:32Z
mmm a / objectivec / GPBArray . h <nl> ppp b / objectivec / GPBArray . h <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a GPB # # NAME # # Array with the single element given . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param value The value to be placed in the array . <nl> / / % * <nl> / / % * @ return A newly instanced GPB # # NAME # # Array with value in it . <nl> NS_ASSUME_NONNULL_END <nl> / / % * * / <nl> / / % + ( instancetype ) arrayWithCapacity : ( NSUInteger ) count ; <nl> / / % <nl> - / / % / * * <nl> + / / % / * * <nl> / / % * @ return A newly initialized and empty GPB # # NAME # # Array . <nl> / / % * * / <nl> / / % - ( instancetype ) init NS_DESIGNATED_INITIALIZER ; <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Enumerates the values on this array with the given block . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param block The block to enumerate with . <nl> / / % * * * value * * : The current value being enumerated . <nl> / / % * * * idx * * : The index of the current value . <nl> NS_ASSUME_NONNULL_END <nl> / / % * Enumerates the values on this array with the given block . <nl> / / % * <nl> / / % * @ param opts Options to control the enumeration . <nl> - / / % * @ param block The block to enumerate with . <nl> + / / % * @ param block The block to enumerate with . <nl> / / % * * * value * * : The current value being enumerated . <nl> / / % * * * idx * * : The index of the current value . <nl> / / % * * * stop * * : A pointer to a boolean that when set stops the enumeration . <nl> mmm a / objectivec / GPBDictionary . h <nl> ppp b / objectivec / GPBDictionary . h <nl> NS_ASSUME_NONNULL_END <nl> / / % PDDM - DEFINE VALUE_FOR_KEY_POD ( KEY_TYPE , VALUE_TYPE , VNAME ) <nl> / / % / * * <nl> / / % * Gets the value for the given key . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param value Pointer into which the value will be set , if found . <nl> / / % * @ param key Key under which the value is stored , if present . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return YES if the key was found and the value was copied , NO otherwise . <nl> / / % * * / <nl> / / % - ( BOOL ) get # # VNAME # # : ( nullable VALUE_TYPE * ) value forKey : ( KEY_TYPE ) key ; <nl> / / % PDDM - DEFINE VALUE_FOR_KEY_OBJECT ( KEY_TYPE , VALUE_TYPE , VNAME ) <nl> / / % / * * <nl> / / % * Fetches the object stored under the given key . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param key Key under which the value is stored , if present . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return The object if found , nil otherwise . <nl> / / % * * / <nl> / / % - ( VALUE_TYPE ) objectForKey : ( KEY_TYPE ) key ; <nl> NS_ASSUME_NONNULL_END <nl> / / % / * * <nl> / / % * Class used for map fields of < # # KEY_TYPE # # , # # VALUE_TYPE # # > <nl> / / % * values . This performs better than boxing into NSNumbers in NSDictionaries . <nl> - / / % * <nl> + / / % * <nl> / / % * @ note This class is not meant to be subclassed . <nl> / / % * * / <nl> / / % @ interface DICTIONARY_CLASS_DECL # # VHELPER ( KEY_NAME , VALUE_NAME , VALUE_TYPE ) : NSObject < NSCopying > <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the single entry given . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param # # VNAME_VAR The value to be placed in the dictionary . <nl> / / % * @ param key # # VNAME_VAR $ S # # The key under which to store the value . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the key and value in it . <nl> / / % * * / <nl> / / % + ( instancetype ) dictionaryWith # # VNAME # # : ( VALUE_TYPE ) # # VNAME_VAR <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the entries given . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param # # VNAME_VAR # # s The values to be placed in the dictionary . <nl> / / % * @ param keys # # VNAME_VAR $ S # # The keys under which to store the values . <nl> / / % * @ param count # # VNAME_VAR $ S # # The number of entries to store in the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the keys and values in it . <nl> / / % * * / <nl> / / % + ( instancetype ) dictionaryWith # # VNAME # # s : ( const VALUE_TYPE ARRAY_ARG_MODIFIER # # VHELPER ( ) [ __nullable ] ) # # VNAME_VAR # # s <nl> NS_ASSUME_NONNULL_END <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the entries from the given . <nl> / / % * dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param dictionary Dictionary containing the entries to add to the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the entries from the given <nl> / / % * dictionary in it . <nl> / / % * * / <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the given capacity . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param numItems Capacity needed for the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the given capacity . <nl> / / % * * / <nl> / / % + ( instancetype ) dictionaryWithCapacity : ( NSUInteger ) numItems ; <nl> / / % <nl> / / % / * * <nl> / / % * Initializes this dictionary , copying the given values and keys . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param # # VNAME_VAR # # s The values to be placed in this dictionary . <nl> / / % * @ param keys # # VNAME_VAR $ S # # The keys under which to store the values . <nl> / / % * @ param count # # VNAME_VAR $ S # # The number of elements to copy into the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly initialized dictionary with a copy of the values and keys . <nl> / / % * * / <nl> / / % - ( instancetype ) initWith # # VNAME # # s : ( const VALUE_TYPE ARRAY_ARG_MODIFIER # # VHELPER ( ) [ __nullable ] ) # # VNAME_VAR # # s <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Initializes this dictionary , copying the entries from the given dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param dictionary Dictionary containing the entries to add to this dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly initialized dictionary with the entries of the given dictionary . <nl> / / % * * / <nl> / / % - ( instancetype ) initWithDictionary : ( GPB # # KEY_NAME # # VALUE_NAME # # Dictionary * ) dictionary ; <nl> / / % <nl> / / % / * * <nl> / / % * Initializes this dictionary with the requested capacity . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param numItems Number of items needed for this dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly initialized dictionary with the requested capacity . <nl> / / % * * / <nl> / / % - ( instancetype ) initWithCapacity : ( NSUInteger ) numItems ; <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Adds the keys and values from another dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param otherDictionary Dictionary containing entries to be added to this <nl> / / % * dictionary . <nl> / / % * * / <nl> NS_ASSUME_NONNULL_END <nl> / / % / * * <nl> / / % * Class used for map fields of < # # KEY_TYPE # # , # # VALUE_TYPE # # > <nl> / / % * values . This performs better than boxing into NSNumbers in NSDictionaries . <nl> - / / % * <nl> + / / % * <nl> / / % * @ note This class is not meant to be subclassed . <nl> / / % * * / <nl> / / % @ interface GPB # # KEY_NAME # # VALUE_NAME # # Dictionary : NSObject < NSCopying > <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the given validation function . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param func The enum validation function for the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary . <nl> / / % * * / <nl> / / % + ( instancetype ) dictionaryWithValidationFunction : ( nullable GPBEnumValidationFunc ) func ; <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the single entry given . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param func The enum validation function for the dictionary . <nl> / / % * @ param rawValue The raw enum value to be placed in the dictionary . <nl> / / % * @ param key The key under which to store the value . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the key and value in it . <nl> / / % * * / <nl> / / % + ( instancetype ) dictionaryWithValidationFunction : ( nullable GPBEnumValidationFunc ) func <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the entries given . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param func The enum validation function for the dictionary . <nl> / / % * @ param values The raw enum values values to be placed in the dictionary . <nl> / / % * @ param keys The keys under which to store the values . <nl> / / % * @ param count The number of entries to store in the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the keys and values in it . <nl> / / % * * / <nl> / / % + ( instancetype ) dictionaryWithValidationFunction : ( nullable GPBEnumValidationFunc ) func <nl> NS_ASSUME_NONNULL_END <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the entries from the given . <nl> / / % * dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param dictionary Dictionary containing the entries to add to the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the entries from the given <nl> / / % * dictionary in it . <nl> / / % * * / <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Creates and initializes a dictionary with the given capacity . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param func The enum validation function for the dictionary . <nl> / / % * @ param numItems Capacity needed for the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly instanced dictionary with the given capacity . <nl> / / % * * / <nl> / / % + ( instancetype ) dictionaryWithValidationFunction : ( nullable GPBEnumValidationFunc ) func <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Initializes a dictionary with the given validation function . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param func The enum validation function for the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly initialized dictionary . <nl> / / % * * / <nl> / / % - ( instancetype ) initWithValidationFunction : ( nullable GPBEnumValidationFunc ) func ; <nl> / / % <nl> / / % / * * <nl> / / % * Initializes a dictionary with the entries given . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param func The enum validation function for the dictionary . <nl> / / % * @ param values The raw enum values values to be placed in the dictionary . <nl> / / % * @ param keys The keys under which to store the values . <nl> / / % * @ param count The number of entries to store in the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly initialized dictionary with the keys and values in it . <nl> / / % * * / <nl> / / % - ( instancetype ) initWithValidationFunction : ( nullable GPBEnumValidationFunc ) func <nl> NS_ASSUME_NONNULL_END <nl> / / % / * * <nl> / / % * Initializes a dictionary with the entries from the given . <nl> / / % * dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param dictionary Dictionary containing the entries to add to the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly initialized dictionary with the entries from the given <nl> / / % * dictionary in it . <nl> / / % * * / <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Initializes a dictionary with the given capacity . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param func The enum validation function for the dictionary . <nl> / / % * @ param numItems Capacity needed for the dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return A newly initialized dictionary with the given capacity . <nl> / / % * * / <nl> / / % - ( instancetype ) initWithValidationFunction : ( nullable GPBEnumValidationFunc ) func <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Gets the raw enum value for the given key . <nl> - / / % * <nl> + / / % * <nl> / / % * @ note This method bypass the validationFunc to enable the access of values that <nl> / / % * were not known at the time the binary was compiled . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param rawValue Pointer into which the value will be set , if found . <nl> / / % * @ param key Key under which the value is stored , if present . <nl> - / / % * <nl> + / / % * <nl> / / % * @ return YES if the key was found and the value was copied , NO otherwise . <nl> / / % * * / <nl> / / % - ( BOOL ) getRawValue : ( nullable VALUE_TYPE * ) rawValue forKey : ( KEY_TYPE # # KisP $ S # # KisP ) key ; <nl> / / % <nl> / / % / * * <nl> / / % * Enumerates the keys and values on this dictionary with the given block . <nl> - / / % * <nl> + / / % * <nl> / / % * @ note This method bypass the validationFunc to enable the access of values that <nl> / / % * were not known at the time the binary was compiled . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param block The block to enumerate with . <nl> / / % * * * key * * : The key for the current entry . <nl> / / % * * * rawValue * * : The value for the current entry <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Adds the keys and raw enum values from another dictionary . <nl> - / / % * <nl> + / / % * <nl> / / % * @ note This method bypass the validationFunc to enable the setting of values that <nl> / / % * were not known at the time the binary was compiled . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param otherDictionary Dictionary containing entries to be added to this <nl> / / % * dictionary . <nl> / / % * * / <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Enumerates the keys and values on this dictionary with the given block . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param block The block to enumerate with . <nl> / / % * * * key * * : # # VNAME_VAR $ S # # The key for the current entry . <nl> / / % * * * VNAME_VAR * * : The value for the current entry <nl> NS_ASSUME_NONNULL_END <nl> / / % PDDM - DEFINE DICTIONARY_MUTABLE_INTERFACE ( KEY_NAME , KEY_TYPE , KisP , VALUE_NAME , VALUE_TYPE , VHELPER , VNAME , VNAME_VAR ) <nl> / / % / * * <nl> / / % * Sets the value for the given key . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param # # VNAME_VAR The value to set . <nl> / / % * @ param key # # VNAME_VAR $ S # # The key under which to store the value . <nl> / / % * * / <nl> NS_ASSUME_NONNULL_END <nl> / / % DICTIONARY_EXTRA_MUTABLE_METHODS_ # # VHELPER ( KEY_NAME , KEY_TYPE , KisP , VALUE_NAME , VALUE_TYPE ) <nl> / / % / * * <nl> / / % * Removes the entry for the given key . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param aKey Key to be removed from this dictionary . <nl> / / % * * / <nl> / / % - ( void ) remove # # VNAME # # ForKey : ( KEY_TYPE # # KisP $ S # # KisP ) aKey ; <nl> NS_ASSUME_NONNULL_END <nl> / / % <nl> / / % / * * <nl> / / % * Sets the raw enum value for the given key . <nl> - / / % * <nl> + / / % * <nl> / / % * @ note This method bypass the validationFunc to enable the setting of values that <nl> / / % * were not known at the time the binary was compiled . <nl> - / / % * <nl> + / / % * <nl> / / % * @ param rawValue The raw enum value to set . <nl> / / % * @ param key The key under which to store the raw enum value . <nl> / / % * * / <nl>
Merge pull request from sergiocampama / spaces
protocolbuffers/protobuf
36f51f963c99c0663d660b023f51158dd5ba391b
2017-02-07T16:59:59Z
mmm a / CocosDenshion / proj . win32 / CocosDenshion . win32 . vcproj . user <nl> ppp b / CocosDenshion / proj . win32 / CocosDenshion . win32 . vcproj . user <nl> @ @ - 1 + 1 @ @ <nl> - < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > < VisualStudioUserFile ProjectType = " Visual C + + " Version = " 9 . 00 " ShowAllFiles = " true " > < / VisualStudioUserFile > <nl> \ No newline at end of file <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > < VisualStudioUserFile ProjectType = " Visual C + + " Version = " 9 . 00 " ShowAllFiles = " false " > < / VisualStudioUserFile > <nl> \ No newline at end of file <nl>
[ win32 ] modify CocosDenshion project file to show correct in vs2008
cocos2d/cocos2d-x
1584a9621411f60b2bffcc3dab9834449c23bb02
2011-06-15T08:22:22Z
new file mode 100644 <nl> index 00000000000 . . 0afc4493175 <nl> mmm / dev / null <nl> ppp b / dbms / src / tests / serialization_type . cpp <nl> <nl> + # include < iostream > <nl> + # include < sstream > <nl> + # include < fstream > <nl> + # include < vector > <nl> + <nl> + # include < Poco / Types . h > <nl> + # include < Poco / SharedPtr . h > <nl> + # include < Poco / Stopwatch . h > <nl> + # include < Poco / BinaryWriter . h > <nl> + <nl> + <nl> + class ISerialization <nl> + { <nl> + public : <nl> + typedef std : : vector < Poco : : UInt64 > Bulk ; <nl> + <nl> + virtual void serialize ( Poco : : UInt64 x , std : : ostream & ostr ) = 0 ; <nl> + virtual void bulkSerialize ( const Bulk & bulk , std : : ostream & ostr ) = 0 ; <nl> + <nl> + virtual ~ ISerialization ( ) { } <nl> + } ; <nl> + <nl> + class Serialization1 : public ISerialization <nl> + { <nl> + public : <nl> + void serialize ( Poco : : UInt64 x , std : : ostream & ostr ) <nl> + { <nl> + ostr . write ( reinterpret_cast < char * > ( & x ) , sizeof ( x ) ) ; <nl> + } <nl> + <nl> + void bulkSerialize ( const Bulk & bulk , std : : ostream & ostr ) <nl> + { <nl> + ostr . write ( reinterpret_cast < const char * > ( & bulk [ 0 ] ) , bulk . size ( ) * sizeof ( bulk [ 0 ] ) ) ; <nl> + } <nl> + } ; <nl> + <nl> + class Serialization2 : public ISerialization <nl> + { <nl> + public : <nl> + void serialize ( Poco : : UInt64 x , std : : ostream & ostr ) <nl> + { <nl> + ostr . write ( reinterpret_cast < char * > ( & x ) , sizeof ( x ) ) ; <nl> + } <nl> + <nl> + void bulkSerialize ( const Bulk & bulk , std : : ostream & ostr ) <nl> + { <nl> + ostr . write ( reinterpret_cast < const char * > ( & bulk [ 0 ] ) , bulk . size ( ) * sizeof ( bulk [ 0 ] ) ) ; <nl> + } <nl> + } ; <nl> + <nl> + <nl> + int main ( int argc , char * * argv ) <nl> + { <nl> + Poco : : SharedPtr < ISerialization > serialization_virtual ; <nl> + if ( time ( 0 ) % 2 ) <nl> + serialization_virtual = new Serialization1 ; <nl> + else <nl> + serialization_virtual = new Serialization2 ; <nl> + <nl> + Serialization1 serialization_non_virtual ; <nl> + <nl> + int n = 100000000 / 8 ; <nl> + Poco : : Stopwatch stopwatch ; <nl> + <nl> + std : : vector < Poco : : UInt64 > bulk ( n , 0 ) ; <nl> + <nl> + { <nl> + std : : ofstream ostr ( " test1 " ) ; <nl> + <nl> + stopwatch . restart ( ) ; <nl> + for ( int i = 0 ; i < n ; + + i ) <nl> + serialization_virtual - > serialize ( i , ostr ) ; <nl> + stopwatch . stop ( ) ; <nl> + std : : cout < < " Virtual : " < < static_cast < double > ( stopwatch . elapsed ( ) ) / 1000000 < < std : : endl ; <nl> + } <nl> + <nl> + { <nl> + std : : ofstream ostr ( " test2 " ) ; <nl> + <nl> + stopwatch . restart ( ) ; <nl> + for ( int i = 0 ; i < n ; + + i ) <nl> + serialization_non_virtual . serialize ( i , ostr ) ; <nl> + stopwatch . stop ( ) ; <nl> + std : : cout < < " Non virtual : " < < static_cast < double > ( stopwatch . elapsed ( ) ) / 1000000 < < std : : endl ; <nl> + } <nl> + <nl> + { <nl> + std : : ofstream ostr ( " test3 " ) ; <nl> + <nl> + stopwatch . restart ( ) ; <nl> + serialization_virtual - > bulkSerialize ( bulk , ostr ) ; <nl> + stopwatch . stop ( ) ; <nl> + std : : cout < < " Virtual bulk : " < < static_cast < double > ( stopwatch . elapsed ( ) ) / 1000000 < < std : : endl ; <nl> + } <nl> + <nl> + { <nl> + std : : ofstream ostr ( " test4 " ) ; <nl> + <nl> + stopwatch . restart ( ) ; <nl> + serialization_non_virtual . bulkSerialize ( bulk , ostr ) ; <nl> + stopwatch . stop ( ) ; <nl> + std : : cout < < " Non virtual bulk : " < < static_cast < double > ( stopwatch . elapsed ( ) ) / 1000000 < < std : : endl ; <nl> + } <nl> + <nl> + return 0 ; <nl> + } <nl>
dbms : added test .
ClickHouse/ClickHouse
d0c2a744fe645e9cb40db6bbd759f71c8f8e22f6
2009-08-21T14:37:50Z
mmm a / docker / test / Dockerfile <nl> ppp b / docker / test / Dockerfile <nl> <nl> FROM ubuntu : 18 . 04 <nl> <nl> - ARG repository = " deb http : / / repo . clickhouse . tech / deb / stable / main / " <nl> + ARG repository = " deb https : / / repo . clickhouse . tech / deb / stable / main / " <nl> ARG version = 20 . 5 . 1 . * <nl> <nl> RUN apt - get update & & \ <nl>
Update Dockerfile
ClickHouse/ClickHouse
e5cd2716da4fc25cf1200410ea4e64152333eecf
2020-06-10T19:27:05Z
mmm a / test / stdlib / Runtime . swift . gyb <nl> ppp b / test / stdlib / Runtime . swift . gyb <nl> var BitTwiddlingTestSuite = TestSuite ( " BitTwiddling " ) <nl> BitTwiddlingTestSuite . test ( " _pointerSize " ) { <nl> # if arch ( i386 ) | | arch ( arm ) <nl> expectEqual ( 4 , MemoryLayout < Optional < AnyObject > > . size ) <nl> - # elseif arch ( x86_64 ) | | arch ( arm64 ) | | arch ( powerpc64 ) | | arch ( powerpc64le ) <nl> + # elseif arch ( x86_64 ) | | arch ( arm64 ) | | arch ( powerpc64 ) | | arch ( powerpc64le ) | | arch ( s390x ) <nl> expectEqual ( 8 , MemoryLayout < Optional < AnyObject > > . size ) <nl> # else <nl> fatalError ( " implement " ) <nl>
Merge pull request from linux - on - ibm - z / s390x - runtime - gyb - testcase - fix
apple/swift
bf16b275dd7999526623f950a4a2c5db4d397156
2018-11-02T19:19:15Z
mmm a / src / protocol / SSL . c <nl> ppp b / src / protocol / SSL . c <nl> ssize_t swSSL_recv ( swConnection * conn , void * __buf , size_t __n ) <nl> return SW_ERR ; <nl> <nl> case SSL_ERROR_SSL : <nl> - swSSL_connection_error ( conn , _errno , errno ) ; <nl> + swSSL_connection_error ( conn ) ; <nl> errno = SW_ERROR_SSL_BAD_CLIENT ; <nl> return SW_ERR ; <nl> <nl>
fix SSL error .
swoole/swoole-src
390e469cdfee2ddc7cb5120641493c1387ebb7aa
2017-09-20T08:32:03Z
mmm a / Makefile . in <nl> ppp b / Makefile . in <nl> am__bin_arangod_SOURCES_DIST = arangod / Actions / actions . cpp \ <nl> arangod / RestHandler / RestVocbaseBaseHandler . cpp \ <nl> arangod / RestHandler / BatchJob . cpp \ <nl> arangod / RestHandler / BatchSubjob . cpp \ <nl> - arangod / RestServer / ArangoHttpServer . cpp \ <nl> arangod / RestServer / ArangoServer . cpp \ <nl> arangod / RestServer / arango . cpp arangod / SkipLists / skiplist . c \ <nl> arangod / SkipLists / skiplistIndex . c \ <nl> am_bin_arangod_OBJECTS = \ <nl> arangod / RestHandler / bin_arangod - RestVocbaseBaseHandler . $ ( OBJEXT ) \ <nl> arangod / RestHandler / bin_arangod - BatchJob . $ ( OBJEXT ) \ <nl> arangod / RestHandler / bin_arangod - BatchSubjob . $ ( OBJEXT ) \ <nl> - arangod / RestServer / bin_arangod - ArangoHttpServer . $ ( OBJEXT ) \ <nl> arangod / RestServer / bin_arangod - ArangoServer . $ ( OBJEXT ) \ <nl> arangod / RestServer / bin_arangod - arango . $ ( OBJEXT ) \ <nl> arangod / SkipLists / bin_arangod - skiplist . $ ( OBJEXT ) \ <nl> bin_arangod_SOURCES = arangod / Actions / actions . cpp \ <nl> arangod / RestHandler / RestVocbaseBaseHandler . cpp \ <nl> arangod / RestHandler / BatchJob . cpp \ <nl> arangod / RestHandler / BatchSubjob . cpp \ <nl> - arangod / RestServer / ArangoHttpServer . cpp \ <nl> arangod / RestServer / ArangoServer . cpp \ <nl> arangod / RestServer / arango . cpp arangod / SkipLists / skiplist . c \ <nl> arangod / SkipLists / skiplistIndex . c \ <nl> arangod / RestServer / $ ( am__dirstamp ) : <nl> arangod / RestServer / $ ( DEPDIR ) / $ ( am__dirstamp ) : <nl> @ $ ( MKDIR_P ) arangod / RestServer / $ ( DEPDIR ) <nl> @ : > arangod / RestServer / $ ( DEPDIR ) / $ ( am__dirstamp ) <nl> - arangod / RestServer / bin_arangod - ArangoHttpServer . $ ( OBJEXT ) : \ <nl> - arangod / RestServer / $ ( am__dirstamp ) \ <nl> - arangod / RestServer / $ ( DEPDIR ) / $ ( am__dirstamp ) <nl> arangod / RestServer / bin_arangod - ArangoServer . $ ( OBJEXT ) : \ <nl> arangod / RestServer / $ ( am__dirstamp ) \ <nl> arangod / RestServer / $ ( DEPDIR ) / $ ( am__dirstamp ) <nl> mostlyclean - compile : <nl> - rm - f arangod / RestHandler / bin_arangod - RestImportHandler . $ ( OBJEXT ) <nl> - rm - f arangod / RestHandler / bin_arangod - RestVocbaseBaseHandler . $ ( OBJEXT ) <nl> - rm - f arangod / RestHandler / bin_arangod - StatisticsBaseHandler . $ ( OBJEXT ) <nl> - - rm - f arangod / RestServer / bin_arangod - ArangoHttpServer . $ ( OBJEXT ) <nl> - rm - f arangod / RestServer / bin_arangod - ArangoServer . $ ( OBJEXT ) <nl> - rm - f arangod / RestServer / bin_arangod - arango . $ ( OBJEXT ) <nl> - rm - f arangod / SkipLists / bin_arangod - skiplist . $ ( OBJEXT ) <nl> distclean - compile : <nl> @ AMDEP_TRUE @ @ am__include @ @ am__quote @ arangod / RestHandler / $ ( DEPDIR ) / bin_arangod - RestImportHandler . Po @ am__quote @ <nl> @ AMDEP_TRUE @ @ am__include @ @ am__quote @ arangod / RestHandler / $ ( DEPDIR ) / bin_arangod - RestVocbaseBaseHandler . Po @ am__quote @ <nl> @ AMDEP_TRUE @ @ am__include @ @ am__quote @ arangod / RestHandler / $ ( DEPDIR ) / bin_arangod - StatisticsBaseHandler . Po @ am__quote @ <nl> - @ AMDEP_TRUE @ @ am__include @ @ am__quote @ arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoHttpServer . Po @ am__quote @ <nl> @ AMDEP_TRUE @ @ am__include @ @ am__quote @ arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoServer . Po @ am__quote @ <nl> @ AMDEP_TRUE @ @ am__include @ @ am__quote @ arangod / RestServer / $ ( DEPDIR ) / bin_arangod - arango . Po @ am__quote @ <nl> @ AMDEP_TRUE @ @ am__include @ @ am__quote @ arangod / SkipLists / $ ( DEPDIR ) / bin_arangod - skiplist . Po @ am__quote @ <nl> arangod / RestHandler / bin_arangod - BatchSubjob . obj : arangod / RestHandler / BatchSubjob <nl> @ AMDEP_TRUE @ @ am__fastdepCXX_FALSE @ DEPDIR = $ ( DEPDIR ) $ ( CXXDEPMODE ) $ ( depcomp ) @ AMDEPBACKSLASH @ <nl> @ am__fastdepCXX_FALSE @ $ ( CXX ) $ ( DEFS ) $ ( DEFAULT_INCLUDES ) $ ( INCLUDES ) $ ( bin_arangod_CPPFLAGS ) $ ( CPPFLAGS ) $ ( AM_CXXFLAGS ) $ ( CXXFLAGS ) - c - o arangod / RestHandler / bin_arangod - BatchSubjob . obj ` if test - f ' arangod / RestHandler / BatchSubjob . cpp ' ; then $ ( CYGPATH_W ) ' arangod / RestHandler / BatchSubjob . cpp ' ; else $ ( CYGPATH_W ) ' $ ( srcdir ) / arangod / RestHandler / BatchSubjob . cpp ' ; fi ` <nl> <nl> - arangod / RestServer / bin_arangod - ArangoHttpServer . o : arangod / RestServer / ArangoHttpServer . cpp <nl> - @ am__fastdepCXX_TRUE @ $ ( AM_V_CXX ) $ ( CXX ) $ ( DEFS ) $ ( DEFAULT_INCLUDES ) $ ( INCLUDES ) $ ( bin_arangod_CPPFLAGS ) $ ( CPPFLAGS ) $ ( AM_CXXFLAGS ) $ ( CXXFLAGS ) - MT arangod / RestServer / bin_arangod - ArangoHttpServer . o - MD - MP - MF arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoHttpServer . Tpo - c - o arangod / RestServer / bin_arangod - ArangoHttpServer . o ` test - f ' arangod / RestServer / ArangoHttpServer . cpp ' | | echo ' $ ( srcdir ) / ' ` arangod / RestServer / ArangoHttpServer . cpp <nl> - @ am__fastdepCXX_TRUE @ $ ( AM_V_at ) $ ( am__mv ) arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoHttpServer . Tpo arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoHttpServer . Po <nl> - @ am__fastdepCXX_FALSE @ $ ( AM_V_CXX ) @ AM_BACKSLASH @ <nl> - @ AMDEP_TRUE @ @ am__fastdepCXX_FALSE @ source = ' arangod / RestServer / ArangoHttpServer . cpp ' object = ' arangod / RestServer / bin_arangod - ArangoHttpServer . o ' libtool = no @ AMDEPBACKSLASH @ <nl> - @ AMDEP_TRUE @ @ am__fastdepCXX_FALSE @ DEPDIR = $ ( DEPDIR ) $ ( CXXDEPMODE ) $ ( depcomp ) @ AMDEPBACKSLASH @ <nl> - @ am__fastdepCXX_FALSE @ $ ( CXX ) $ ( DEFS ) $ ( DEFAULT_INCLUDES ) $ ( INCLUDES ) $ ( bin_arangod_CPPFLAGS ) $ ( CPPFLAGS ) $ ( AM_CXXFLAGS ) $ ( CXXFLAGS ) - c - o arangod / RestServer / bin_arangod - ArangoHttpServer . o ` test - f ' arangod / RestServer / ArangoHttpServer . cpp ' | | echo ' $ ( srcdir ) / ' ` arangod / RestServer / ArangoHttpServer . cpp <nl> - <nl> - arangod / RestServer / bin_arangod - ArangoHttpServer . obj : arangod / RestServer / ArangoHttpServer . cpp <nl> - @ am__fastdepCXX_TRUE @ $ ( AM_V_CXX ) $ ( CXX ) $ ( DEFS ) $ ( DEFAULT_INCLUDES ) $ ( INCLUDES ) $ ( bin_arangod_CPPFLAGS ) $ ( CPPFLAGS ) $ ( AM_CXXFLAGS ) $ ( CXXFLAGS ) - MT arangod / RestServer / bin_arangod - ArangoHttpServer . obj - MD - MP - MF arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoHttpServer . Tpo - c - o arangod / RestServer / bin_arangod - ArangoHttpServer . obj ` if test - f ' arangod / RestServer / ArangoHttpServer . cpp ' ; then $ ( CYGPATH_W ) ' arangod / RestServer / ArangoHttpServer . cpp ' ; else $ ( CYGPATH_W ) ' $ ( srcdir ) / arangod / RestServer / ArangoHttpServer . cpp ' ; fi ` <nl> - @ am__fastdepCXX_TRUE @ $ ( AM_V_at ) $ ( am__mv ) arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoHttpServer . Tpo arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoHttpServer . Po <nl> - @ am__fastdepCXX_FALSE @ $ ( AM_V_CXX ) @ AM_BACKSLASH @ <nl> - @ AMDEP_TRUE @ @ am__fastdepCXX_FALSE @ source = ' arangod / RestServer / ArangoHttpServer . cpp ' object = ' arangod / RestServer / bin_arangod - ArangoHttpServer . obj ' libtool = no @ AMDEPBACKSLASH @ <nl> - @ AMDEP_TRUE @ @ am__fastdepCXX_FALSE @ DEPDIR = $ ( DEPDIR ) $ ( CXXDEPMODE ) $ ( depcomp ) @ AMDEPBACKSLASH @ <nl> - @ am__fastdepCXX_FALSE @ $ ( CXX ) $ ( DEFS ) $ ( DEFAULT_INCLUDES ) $ ( INCLUDES ) $ ( bin_arangod_CPPFLAGS ) $ ( CPPFLAGS ) $ ( AM_CXXFLAGS ) $ ( CXXFLAGS ) - c - o arangod / RestServer / bin_arangod - ArangoHttpServer . obj ` if test - f ' arangod / RestServer / ArangoHttpServer . cpp ' ; then $ ( CYGPATH_W ) ' arangod / RestServer / ArangoHttpServer . cpp ' ; else $ ( CYGPATH_W ) ' $ ( srcdir ) / arangod / RestServer / ArangoHttpServer . cpp ' ; fi ` <nl> - <nl> arangod / RestServer / bin_arangod - ArangoServer . o : arangod / RestServer / ArangoServer . cpp <nl> @ am__fastdepCXX_TRUE @ $ ( AM_V_CXX ) $ ( CXX ) $ ( DEFS ) $ ( DEFAULT_INCLUDES ) $ ( INCLUDES ) $ ( bin_arangod_CPPFLAGS ) $ ( CPPFLAGS ) $ ( AM_CXXFLAGS ) $ ( CXXFLAGS ) - MT arangod / RestServer / bin_arangod - ArangoServer . o - MD - MP - MF arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoServer . Tpo - c - o arangod / RestServer / bin_arangod - ArangoServer . o ` test - f ' arangod / RestServer / ArangoServer . cpp ' | | echo ' $ ( srcdir ) / ' ` arangod / RestServer / ArangoServer . cpp <nl> @ am__fastdepCXX_TRUE @ $ ( AM_V_at ) $ ( am__mv ) arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoServer . Tpo arangod / RestServer / $ ( DEPDIR ) / bin_arangod - ArangoServer . Po <nl> mmm a / arangod / Makefile . files <nl> ppp b / arangod / Makefile . files <nl> bin_arangod_SOURCES = \ <nl> arangod / RestHandler / RestVocbaseBaseHandler . cpp \ <nl> arangod / RestHandler / BatchJob . cpp \ <nl> arangod / RestHandler / BatchSubjob . cpp \ <nl> - arangod / RestServer / ArangoHttpServer . cpp \ <nl> arangod / RestServer / ArangoServer . cpp \ <nl> arangod / RestServer / arango . cpp \ <nl> arangod / SkipLists / skiplist . c \ <nl> deleted file mode 100644 <nl> index f703e20e4df . . 00000000000 <nl> mmm a / arangod / RestServer / ArangoHttpServer . cpp <nl> ppp / dev / null <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief arango http server <nl> - / / / <nl> - / / / @ file <nl> - / / / <nl> - / / / DISCLAIMER <nl> - / / / <nl> - / / / Copyright 2004 - 2012 triAGENS GmbH , Cologne , Germany <nl> - / / / <nl> - / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - / / / you may not use this file except in compliance with the License . <nl> - / / / You may obtain a copy of the License at <nl> - / / / <nl> - / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - / / / <nl> - / / / Unless required by applicable law or agreed to in writing , software <nl> - / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> - / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - / / / See the License for the specific language governing permissions and <nl> - / / / limitations under the License . <nl> - / / / <nl> - / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> - / / / <nl> - / / / @ author Dr . Frank Celler <nl> - / / / @ author Copyright 2011 - 2012 , triAGENS GmbH , Cologne , Germany <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # include " ArangoHttpServer . h " <nl> - <nl> - # include " HttpServer / HttpHandler . h " <nl> - <nl> - using namespace triagens : : rest ; <nl> - using namespace triagens : : arango ; <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / - - SECTION - - class ArangoHttpServer <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / - - SECTION - - constructors and destructors <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ addtogroup ArangoDB <nl> - / / / @ { <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief constructs a new http server <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - ArangoHttpServer : : ArangoHttpServer ( Scheduler * scheduler , Dispatcher * dispatcher ) <nl> - : HttpServer ( scheduler , dispatcher ) { <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / Local Variables : <nl> - / / mode : outline - minor <nl> - / / outline - regexp : " ^ \ \ ( / / / @ brief \ \ | / / / { @ inheritDoc } \ \ | / / / @ addtogroup \ \ | / / / @ page \ \ | / / - - SECTION - - \ \ | / / / @ \ \ } \ \ ) " <nl> - / / End : <nl> deleted file mode 100644 <nl> index 2e31d82701f . . 00000000000 <nl> mmm a / arangod / RestServer / ArangoHttpServer . h <nl> ppp / dev / null <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief arango http server <nl> - / / / <nl> - / / / @ file <nl> - / / / <nl> - / / / DISCLAIMER <nl> - / / / <nl> - / / / Copyright 2004 - 2012 triAGENS GmbH , Cologne , Germany <nl> - / / / <nl> - / / / Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> - / / / you may not use this file except in compliance with the License . <nl> - / / / You may obtain a copy of the License at <nl> - / / / <nl> - / / / http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> - / / / <nl> - / / / Unless required by applicable law or agreed to in writing , software <nl> - / / / distributed under the License is distributed on an " AS IS " BASIS , <nl> - / / / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> - / / / See the License for the specific language governing permissions and <nl> - / / / limitations under the License . <nl> - / / / <nl> - / / / Copyright holder is triAGENS GmbH , Cologne , Germany <nl> - / / / <nl> - / / / @ author Dr . Frank Celler <nl> - / / / @ author Copyright 2011 - 2012 , triAGENS GmbH , Cologne , Germany <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # ifndef TRIAGENS_REST_SERVER_ARANGO_HTTP_SERVER_H <nl> - # define TRIAGENS_REST_SERVER_ARANGO_HTTP_SERVER_H 1 <nl> - <nl> - # include " HttpServer / HttpServer . h " <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / - - SECTION - - class ArangoHttpServer <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ addtogroup ArangoDB <nl> - / / / @ { <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - namespace triagens { <nl> - namespace arango { <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief specialized http server <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - class ArangoHttpServer : public rest : : HttpServer { <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - / / - - SECTION - - constructors and destructors <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ addtogroup ArangoDB <nl> - / / / @ { <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - public : <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief constructs a new http server <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - ArangoHttpServer ( rest : : Scheduler * scheduler , rest : : Dispatcher * dispatcher ) ; <nl> - } ; <nl> - } <nl> - } <nl> - <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ } <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - # endif <nl> - <nl> - / / Local Variables : <nl> - / / mode : outline - minor <nl> - / / outline - regexp : " ^ \ \ ( / / / @ brief \ \ | / / / { @ inheritDoc } \ \ | / / / @ addtogroup \ \ | / / / @ page \ \ | / / - - SECTION - - \ \ | / / / @ \ \ } \ \ ) " <nl> - / / End : <nl> mmm a / arangod / RestServer / ArangoServer . cpp <nl> ppp b / arangod / RestServer / ArangoServer . cpp <nl> <nl> # include " RestHandler / RestDocumentHandler . h " <nl> # include " RestHandler / RestEdgeHandler . h " <nl> # include " RestHandler / RestImportHandler . h " <nl> - # include " RestServer / ArangoHttpServer . h " <nl> # include " Scheduler / ApplicationScheduler . h " <nl> # include " UserManager / ApplicationUserManager . h " <nl> # include " V8 / V8LineEditor . h " <nl> void ArangoServer : : buildApplicationServer ( ) { <nl> _applicationServer - > addFeature ( _applicationHttpServer ) ; <nl> <nl> # ifdef TRI_OPENSSL_VERSION <nl> - <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> / / an https server <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> <nl> _applicationHttpsServer = new ApplicationHttpsServer ( _applicationScheduler , _applicationDispatcher ) ; <nl> _applicationServer - > addFeature ( _applicationHttpsServer ) ; <nl> - <nl> # endif <nl> <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> int ArangoServer : : startupServer ( ) { <nl> <nl> Scheduler * scheduler = _applicationScheduler - > scheduler ( ) ; <nl> <nl> - / / we pass the options by reference , so keep them until shutdown <nl> - RestActionHandler : : action_options_t httpOptions ; <nl> - httpOptions . _vocbase = _vocbase ; <nl> - httpOptions . _queue = " STANDARD " ; <nl> - <nl> / / add & validate endpoints <nl> for ( vector < string > : : const_iterator i = _endpoints . begin ( ) ; i ! = _endpoints . end ( ) ; + + i ) { <nl> Endpoint * endpoint = Endpoint : : serverFactory ( * i ) ; <nl> int ArangoServer : : startupServer ( ) { <nl> cerr < < " invalid endpoint ' " < < * i < < " ' \ n " ; <nl> exit ( EXIT_FAILURE ) ; <nl> } <nl> - <nl> } <nl> <nl> - / / dump used endpoints <nl> - _endpointList . dump ( ) ; <nl> <nl> - / / create the server <nl> - _httpServer = _applicationHttpServer - > buildServer ( new ArangoHttpServer ( scheduler , dispatcher ) , & _endpointList ) ; <nl> + / / dump used endpoints for user information <nl> + _endpointList . dump ( ) ; <nl> + <nl> + / / we pass the options by reference , so keep them until shutdown <nl> + RestActionHandler : : action_options_t httpOptions ; <nl> + httpOptions . _vocbase = _vocbase ; <nl> + httpOptions . _queue = " STANDARD " ; <nl> <nl> / / create the handlers <nl> httpOptions . _contexts . insert ( " user " ) ; <nl> httpOptions . _contexts . insert ( " api " ) ; <nl> + httpOptions . _contexts . insert ( " admin " ) ; <nl> <nl> - DefineApiHandlers ( _httpServer , _applicationAdminServer , _vocbase ) ; <nl> + / / HTTP endpoints <nl> + if ( _endpointList . count ( Endpoint : : PROTOCOL_HTTP ) > 0 ) { <nl> + / / create the http server <nl> + _httpServer = _applicationHttpServer - > buildServer ( new HttpServer ( scheduler , dispatcher ) , & _endpointList ) ; <nl> <nl> - DefineAdminHandlers ( _httpServer , _applicationAdminServer , _applicationUserManager , _vocbase ) ; <nl> - httpOptions . _contexts . insert ( " admin " ) ; <nl> + DefineApiHandlers ( _httpServer , _applicationAdminServer , _vocbase ) ; <nl> <nl> - / / add action handler <nl> - _httpServer - > addPrefixHandler ( " / " , <nl> - RestHandlerCreator < RestActionHandler > : : createData < RestActionHandler : : action_options_t * > , <nl> - ( void * ) & httpOptions ) ; <nl> + DefineAdminHandlers ( _httpServer , _applicationAdminServer , _applicationUserManager , _vocbase ) ; <nl> + <nl> + / / add action handler <nl> + _httpServer - > addPrefixHandler ( " / " , <nl> + RestHandlerCreator < RestActionHandler > : : createData < RestActionHandler : : action_options_t * > , <nl> + ( void * ) & httpOptions ) ; <nl> + } <nl> <nl> # ifdef TRI_OPENSSL_VERSION <nl> - <nl> + / / HTTPS endpoints <nl> if ( _endpointList . count ( Endpoint : : PROTOCOL_HTTPS ) > 0 ) { <nl> / / create the https server <nl> _httpsServer = _applicationHttpsServer - > buildServer ( & _endpointList ) ; <nl> int ArangoServer : : startupServer ( ) { <nl> } <nl> # endif <nl> <nl> - / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> - / / create a admin http server and http handler factory <nl> - / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> - <nl> - / / we pass the options be reference , so keep them until shutdown <nl> - RestActionHandler : : action_options_t adminOptions ; <nl> - adminOptions . _vocbase = _vocbase ; <nl> - adminOptions . _queue = " SYSTEM " ; <nl> - <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> / / create a http handler factory for zeromq <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> mmm a / arangod / RestServer / ArangoServer . h <nl> ppp b / arangod / RestServer / ArangoServer . h <nl> namespace triagens { <nl> class ApplicationZeroMQ ; <nl> # endif <nl> class HttpServer ; <nl> + # ifdef TRI_OPENSSL_VERSION <nl> class HttpsServer ; <nl> + # endif <nl> } <nl> <nl> namespace admin { <nl> namespace triagens { <nl> / / / @ brief application https server <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> + # ifdef TRI_OPENSSL_VERSION <nl> rest : : ApplicationHttpsServer * _applicationHttpsServer ; <nl> + # endif <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief constructed admin server application <nl> namespace triagens { <nl> / / / @ brief constructed https server <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> + # ifdef TRI_OPENSSL_VERSION <nl> rest : : HttpsServer * _httpsServer ; <nl> + # endif <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief endpoint list container <nl> namespace triagens { <nl> <nl> vector < string > _endpoints ; <nl> <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief list port for client requests <nl> - / / / <nl> - / / / @ CMDOPT { - - server . http - port @ CA { port } } <nl> - / / / <nl> - / / / Specifies the @ CA { port } for HTTP requests by clients . This will bind to any <nl> - / / / address available . If you do not specify an admin port , then the http port <nl> - / / / will serve both client and administration request . If you have <nl> - / / / higher security requirements , you can use a special administration <nl> - / / / port . <nl> - / / / <nl> - / / / @ CMDOPT { - - server . http - port @ CA { address } : @ CA { port } } <nl> - / / / <nl> - / / / Specifies the @ CA { address } and @ CA { port } for HTTP requests by clients . This <nl> - / / / will bind to the given @ CA { address } , which can be a numeric value like <nl> - / / / @ CODE { 192 . 168 . 1 . 1 } or a name . <nl> - / / / <nl> - / / / @ CMDOPT { - - port @ CA { port } } <nl> - / / / <nl> - / / / This variant can be used as command line option . <nl> - / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - <nl> - string _httpPort ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief number of dispatcher threads for non - database worker <nl> / / / <nl>
minor cleanup
arangodb/arangodb
a8cf75b24546f7a7633c518e5f7c2b23776f053f
2012-07-24T06:43:38Z
mmm a / src / json . hpp . re2c <nl> ppp b / src / json . hpp . re2c <nl> class basic_json <nl> <nl> <nl> private : <nl> + / / / helper for exception - safe object creation <nl> + template < typename T , typename . . . Args > <nl> + static T * create ( Args & & . . . args ) <nl> + { <nl> + AllocatorType < T > alloc ; <nl> + auto deleter = [ & ] ( T * object ) { alloc . deallocate ( object , 1 ) ; } ; <nl> + std : : unique_ptr < T , decltype ( deleter ) > object ( alloc . allocate ( 1 ) , deleter ) ; <nl> + alloc . construct ( object . get ( ) , std : : forward < Args > ( args ) . . . ) ; <nl> + return object . release ( ) ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / JSON value storage / / <nl> / / / / / / / / / / / / / / / / / / / / / / / / <nl> class basic_json <nl> <nl> case ( value_t : : object ) : <nl> { <nl> - AllocatorType < object_t > alloc ; <nl> - object = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( object ) ; <nl> + object = create < object_t > ( ) ; <nl> break ; <nl> } <nl> <nl> case ( value_t : : array ) : <nl> { <nl> - AllocatorType < array_t > alloc ; <nl> - array = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( array ) ; <nl> + array = create < array_t > ( ) ; <nl> break ; <nl> } <nl> <nl> case ( value_t : : string ) : <nl> { <nl> - AllocatorType < string_t > alloc ; <nl> - string = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( string , " " ) ; <nl> + string = create < string_t > ( " " ) ; <nl> break ; <nl> } <nl> <nl> class basic_json <nl> / / / constructor for strings <nl> json_value ( const string_t & value ) <nl> { <nl> - AllocatorType < string_t > alloc ; <nl> - string = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( string , value ) ; <nl> + string = create < string_t > ( value ) ; <nl> } <nl> <nl> / / / constructor for objects <nl> json_value ( const object_t & value ) <nl> { <nl> - AllocatorType < object_t > alloc ; <nl> - object = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( object , value ) ; <nl> + object = create < object_t > ( value ) ; <nl> } <nl> <nl> / / / constructor for arrays <nl> json_value ( const array_t & value ) <nl> { <nl> - AllocatorType < array_t > alloc ; <nl> - array = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( array , value ) ; <nl> + array = create < array_t > ( value ) ; <nl> } <nl> } ; <nl> <nl> class basic_json <nl> basic_json ( const CompatibleObjectType & value ) <nl> : m_type ( value_t : : object ) <nl> { <nl> - AllocatorType < object_t > alloc ; <nl> - m_value . object = alloc . allocate ( 1 ) ; <nl> using std : : begin ; <nl> using std : : end ; <nl> - alloc . construct ( m_value . object , begin ( value ) , end ( value ) ) ; <nl> + m_value . object = create < object_t > ( begin ( value ) , end ( value ) ) ; <nl> } <nl> <nl> / * ! <nl> class basic_json <nl> basic_json ( const CompatibleArrayType & value ) <nl> : m_type ( value_t : : array ) <nl> { <nl> - AllocatorType < array_t > alloc ; <nl> - m_value . array = alloc . allocate ( 1 ) ; <nl> using std : : begin ; <nl> using std : : end ; <nl> - alloc . construct ( m_value . array , begin ( value ) , end ( value ) ) ; <nl> + m_value . array = create < array_t > ( begin ( value ) , end ( value ) ) ; <nl> } <nl> <nl> / * ! <nl> class basic_json <nl> { <nl> / / the initializer list describes an array - > create array <nl> m_type = value_t : : array ; <nl> - AllocatorType < array_t > alloc ; <nl> - m_value . array = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( m_value . array , std : : move ( init ) ) ; <nl> + m_value . array = create < array_t > ( std : : move ( init ) ) ; <nl> } <nl> } <nl> <nl> class basic_json <nl> basic_json ( size_type count , const basic_json & value ) <nl> : m_type ( value_t : : array ) <nl> { <nl> - AllocatorType < array_t > alloc ; <nl> - m_value . array = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( m_value . array , count , value ) ; <nl> + m_value . array = create < array_t > ( count , value ) ; <nl> } <nl> <nl> / * ! <nl> class basic_json <nl> <nl> case value_t : : object : <nl> { <nl> - AllocatorType < object_t > alloc ; <nl> - m_value . object = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( m_value . object , first . m_it . object_iterator , last . m_it . object_iterator ) ; <nl> + m_value . object = create < object_t > ( first . m_it . object_iterator , last . m_it . object_iterator ) ; <nl> break ; <nl> } <nl> <nl> case value_t : : array : <nl> { <nl> - AllocatorType < array_t > alloc ; <nl> - m_value . array = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( m_value . array , first . m_it . array_iterator , last . m_it . array_iterator ) ; <nl> + m_value . array = create < array_t > ( first . m_it . array_iterator , last . m_it . array_iterator ) ; <nl> break ; <nl> } <nl> <nl> class basic_json <nl> if ( m_type = = value_t : : null ) <nl> { <nl> m_type = value_t : : array ; <nl> - AllocatorType < array_t > alloc ; <nl> - m_value . array = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( m_value . array ) ; <nl> + m_value . array = create < array_t > ( ) ; <nl> } <nl> <nl> / / [ ] only works for arrays <nl> class basic_json <nl> if ( m_type = = value_t : : null ) <nl> { <nl> m_type = value_t : : object ; <nl> - AllocatorType < object_t > alloc ; <nl> - m_value . object = alloc . allocate ( 1 ) ; <nl> - alloc . construct ( m_value . object ) ; <nl> + m_value . object = create < object_t > ( ) ; <nl> } <nl> <nl> / / [ ] only works for objects <nl>
exception - safe object creation , fixes
nlohmann/json
f7fb40556463c73659151d1d0116deb5e7849a4b
2015-09-20T18:06:33Z
mmm a / src / proto / grpc / testing / test . proto <nl> ppp b / src / proto / grpc / testing / test . proto <nl> service LoadBalancerStatsService { <nl> rpc GetClientStats ( LoadBalancerStatsRequest ) <nl> returns ( LoadBalancerStatsResponse ) { } <nl> } <nl> + <nl> + / / A service to remotely control health status of an xDS test server . <nl> + service XdsUpdateHealthService { <nl> + rpc SetServing ( grpc . testing . Empty ) returns ( grpc . testing . Empty ) ; <nl> + rpc SetNotServing ( grpc . testing . Empty ) returns ( grpc . testing . Empty ) ; <nl> + } <nl> mmm a / tools / internal_ci / linux / grpc_xds_php_test_in_docker . sh <nl> ppp b / tools / internal_ci / linux / grpc_xds_php_test_in_docker . sh <nl> GRPC_VERBOSITY = debug GRPC_TRACE = xds_client , xds_resolver , xds_routing_lb , cds_lb , ed <nl> - - source_image = projects / grpc - testing / global / images / xds - test - server \ <nl> - - path_to_server_binary = / java_server / grpc - java / interop - testing / build / install / grpc - interop - testing / bin / xds - test - server \ <nl> - - gcp_suffix = $ ( date ' + % s ' ) \ <nl> - - - only_stable_gcp_apis \ <nl> - - verbose \ <nl> - - client_cmd = ' php - d extension = grpc . so - d extension = pthreads . so src / php / tests / interop / xds_client . php - - server = xds : / / / { server_uri } - - stats_port = { stats_port } - - qps = { qps } ' <nl> mmm a / tools / internal_ci / linux / grpc_xds_ruby_test_in_docker . sh <nl> ppp b / tools / internal_ci / linux / grpc_xds_ruby_test_in_docker . sh <nl> GRPC_VERBOSITY = debug GRPC_TRACE = xds_client , xds_resolver , xds_routing_lb , cds_lb , ed <nl> - - source_image = projects / grpc - testing / global / images / xds - test - server \ <nl> - - path_to_server_binary = / java_server / grpc - java / interop - testing / build / install / grpc - interop - testing / bin / xds - test - server \ <nl> - - gcp_suffix = $ ( date ' + % s ' ) \ <nl> - - - only_stable_gcp_apis \ <nl> - - verbose \ <nl> - - client_cmd = ' ruby src / ruby / pb / test / xds_client . rb - - server = xds : / / / { server_uri } - - stats_port = { stats_port } - - qps = { qps } ' <nl> mmm a / tools / run_tests / run_xds_tests . py <nl> ppp b / tools / run_tests / run_xds_tests . py <nl> <nl> import python_utils . jobset as jobset <nl> import python_utils . report_utils as report_utils <nl> <nl> + from src . proto . grpc . testing import empty_pb2 <nl> from src . proto . grpc . testing import messages_pb2 <nl> from src . proto . grpc . testing import test_pb2_grpc <nl> <nl> <nl> _TEST_CASES = [ <nl> ' backends_restart ' , <nl> ' change_backend_service ' , <nl> + ' gentle_failover ' , <nl> ' new_instance_group_receives_traffic ' , <nl> ' ping_pong ' , <nl> ' remove_instance_group ' , <nl> def parse_port_range ( port_arg ) : <nl> help = ' Log captured client output ' , <nl> default = False , <nl> action = ' store_true ' ) <nl> + # TODO ( ericgribkoff ) Remove this flag once all test environments are verified to <nl> + # have access to the alpha compute APIs . <nl> argp . add_argument ( ' - - only_stable_gcp_apis ' , <nl> - help = ' Do not use alpha compute APIs ' , <nl> + help = ' Do not use alpha compute APIs . Some tests may be ' <nl> + ' incompatible with this option ( gRPC health checks are ' <nl> + ' currently alpha and required for simulating server failure ' , <nl> default = False , <nl> action = ' store_true ' ) <nl> args = argp . parse_args ( ) <nl> def parse_port_range ( port_arg ) : <nl> _TESTS_TO_FAIL_ON_RPC_FAILURE = [ <nl> ' new_instance_group_receives_traffic ' , ' ping_pong ' , ' round_robin ' <nl> ] <nl> - _TESTS_USING_SECONDARY_IG = [ <nl> - ' secondary_locality_gets_no_requests_on_partial_primary_failure ' , <nl> - ' secondary_locality_gets_requests_on_primary_failure ' <nl> - ] <nl> - _USE_SECONDARY_IG = any ( <nl> - [ t in args . test_case for t in _TESTS_USING_SECONDARY_IG ] ) <nl> _PATH_MATCHER_NAME = ' path - matcher ' <nl> _BASE_TEMPLATE_NAME = ' test - template ' <nl> _BASE_INSTANCE_GROUP_NAME = ' test - ig ' <nl> def get_client_stats ( num_rpcs , timeout_sec ) : <nl> return response <nl> <nl> <nl> + class RpcDistributionError ( Exception ) : <nl> + pass <nl> + <nl> + <nl> def _verify_rpcs_to_given_backends ( backends , timeout_sec , num_rpcs , <nl> allow_failures ) : <nl> start_time = time . time ( ) <nl> def _verify_rpcs_to_given_backends ( backends , timeout_sec , num_rpcs , <nl> error_msg = ' % d RPCs failed ' % stats . num_failures <nl> if not error_msg : <nl> return <nl> - raise Exception ( error_msg ) <nl> + raise RpcDistributionError ( error_msg ) <nl> <nl> <nl> def wait_until_all_rpcs_go_to_given_backends_or_fail ( backends , <nl> def test_change_backend_service ( gcp , original_backend_service , instance_group , <nl> patch_backend_instances ( gcp , alternate_backend_service , [ ] ) <nl> <nl> <nl> + def test_gentle_failover ( gcp , <nl> + backend_service , <nl> + primary_instance_group , <nl> + secondary_instance_group , <nl> + swapped_primary_and_secondary = False ) : <nl> + logger . info ( ' Running test_gentle_failover ' ) <nl> + num_primary_instances = len ( get_instance_names ( gcp , primary_instance_group ) ) <nl> + min_instances_for_gentle_failover = 3 # Need > 50 % failure to start failover <nl> + try : <nl> + if num_primary_instances < min_instances_for_gentle_failover : <nl> + resize_instance_group ( gcp , primary_instance_group , <nl> + min_instances_for_gentle_failover ) <nl> + patch_backend_instances ( <nl> + gcp , backend_service , <nl> + [ primary_instance_group , secondary_instance_group ] ) <nl> + primary_instance_names = get_instance_names ( gcp , primary_instance_group ) <nl> + secondary_instance_names = get_instance_names ( gcp , <nl> + secondary_instance_group ) <nl> + wait_for_healthy_backends ( gcp , backend_service , primary_instance_group ) <nl> + wait_for_healthy_backends ( gcp , backend_service , <nl> + secondary_instance_group ) <nl> + wait_until_all_rpcs_go_to_given_backends ( primary_instance_names , <nl> + _WAIT_FOR_STATS_SEC ) <nl> + instances_to_stop = primary_instance_names [ : - 1 ] <nl> + remaining_instances = primary_instance_names [ - 1 : ] <nl> + try : <nl> + set_serving_status ( instances_to_stop , <nl> + gcp . service_port , <nl> + serving = False ) <nl> + wait_until_all_rpcs_go_to_given_backends ( <nl> + remaining_instances + secondary_instance_names , <nl> + _WAIT_FOR_BACKEND_SEC ) <nl> + finally : <nl> + set_serving_status ( primary_instance_names , <nl> + gcp . service_port , <nl> + serving = True ) <nl> + except RpcDistributionError as e : <nl> + if not swapped_primary_and_secondary and is_primary_instance_group ( <nl> + gcp , secondary_instance_group ) : <nl> + # Swap expectation of primary and secondary instance groups . <nl> + test_gentle_failover ( gcp , <nl> + backend_service , <nl> + secondary_instance_group , <nl> + primary_instance_group , <nl> + swapped_primary_and_secondary = True ) <nl> + else : <nl> + raise e <nl> + finally : <nl> + patch_backend_instances ( gcp , backend_service , [ primary_instance_group ] ) <nl> + resize_instance_group ( gcp , primary_instance_group , <nl> + num_primary_instances ) <nl> + instance_names = get_instance_names ( gcp , primary_instance_group ) <nl> + wait_until_all_rpcs_go_to_given_backends ( instance_names , <nl> + _WAIT_FOR_BACKEND_SEC ) <nl> + <nl> + <nl> def test_new_instance_group_receives_traffic ( gcp , backend_service , <nl> instance_group , <nl> same_zone_instance_group ) : <nl> def test_round_robin ( gcp , backend_service , instance_group ) : <nl> <nl> <nl> def test_secondary_locality_gets_no_requests_on_partial_primary_failure ( <nl> - gcp , backend_service , primary_instance_group , <nl> - secondary_zone_instance_group ) : <nl> + gcp , <nl> + backend_service , <nl> + primary_instance_group , <nl> + secondary_instance_group , <nl> + swapped_primary_and_secondary = False ) : <nl> logger . info ( <nl> - ' Running test_secondary_locality_gets_no_requests_on_partial_primary_failure ' <nl> + ' Running secondary_locality_gets_no_requests_on_partial_primary_failure ' <nl> ) <nl> try : <nl> patch_backend_instances ( <nl> gcp , backend_service , <nl> - [ primary_instance_group , secondary_zone_instance_group ] ) <nl> + [ primary_instance_group , secondary_instance_group ] ) <nl> wait_for_healthy_backends ( gcp , backend_service , primary_instance_group ) <nl> wait_for_healthy_backends ( gcp , backend_service , <nl> - secondary_zone_instance_group ) <nl> - primary_instance_names = get_instance_names ( gcp , instance_group ) <nl> - secondary_instance_names = get_instance_names ( <nl> - gcp , secondary_zone_instance_group ) <nl> + secondary_instance_group ) <nl> + primary_instance_names = get_instance_names ( gcp , primary_instance_group ) <nl> wait_until_all_rpcs_go_to_given_backends ( primary_instance_names , <nl> _WAIT_FOR_STATS_SEC ) <nl> - original_size = len ( primary_instance_names ) <nl> - resize_instance_group ( gcp , primary_instance_group , original_size - 1 ) <nl> - remaining_instance_names = get_instance_names ( gcp , <nl> - primary_instance_group ) <nl> - wait_until_all_rpcs_go_to_given_backends ( remaining_instance_names , <nl> - _WAIT_FOR_BACKEND_SEC ) <nl> + instances_to_stop = primary_instance_names [ : 1 ] <nl> + remaining_instances = primary_instance_names [ 1 : ] <nl> + try : <nl> + set_serving_status ( instances_to_stop , <nl> + gcp . service_port , <nl> + serving = False ) <nl> + wait_until_all_rpcs_go_to_given_backends ( remaining_instances , <nl> + _WAIT_FOR_BACKEND_SEC ) <nl> + finally : <nl> + set_serving_status ( primary_instance_names , <nl> + gcp . service_port , <nl> + serving = True ) <nl> + except RpcDistributionError as e : <nl> + if not swapped_primary_and_secondary and is_primary_instance_group ( <nl> + gcp , secondary_instance_group ) : <nl> + # Swap expectation of primary and secondary instance groups . <nl> + test_secondary_locality_gets_no_requests_on_partial_primary_failure ( <nl> + gcp , <nl> + backend_service , <nl> + secondary_instance_group , <nl> + primary_instance_group , <nl> + swapped_primary_and_secondary = True ) <nl> + else : <nl> + raise e <nl> finally : <nl> patch_backend_instances ( gcp , backend_service , [ primary_instance_group ] ) <nl> - resize_instance_group ( gcp , primary_instance_group , original_size ) <nl> <nl> <nl> def test_secondary_locality_gets_requests_on_primary_failure ( <nl> - gcp , backend_service , primary_instance_group , <nl> - secondary_zone_instance_group ) : <nl> - logger . info ( <nl> - ' Running test_secondary_locality_gets_requests_on_primary_failure ' ) <nl> + gcp , <nl> + backend_service , <nl> + primary_instance_group , <nl> + secondary_instance_group , <nl> + swapped_primary_and_secondary = False ) : <nl> + logger . info ( ' Running secondary_locality_gets_requests_on_primary_failure ' ) <nl> try : <nl> patch_backend_instances ( <nl> gcp , backend_service , <nl> - [ primary_instance_group , secondary_zone_instance_group ] ) <nl> + [ primary_instance_group , secondary_instance_group ] ) <nl> wait_for_healthy_backends ( gcp , backend_service , primary_instance_group ) <nl> wait_for_healthy_backends ( gcp , backend_service , <nl> - secondary_zone_instance_group ) <nl> - primary_instance_names = get_instance_names ( gcp , instance_group ) <nl> - secondary_instance_names = get_instance_names ( <nl> - gcp , secondary_zone_instance_group ) <nl> + secondary_instance_group ) <nl> + primary_instance_names = get_instance_names ( gcp , primary_instance_group ) <nl> + secondary_instance_names = get_instance_names ( gcp , <nl> + secondary_instance_group ) <nl> wait_until_all_rpcs_go_to_given_backends ( primary_instance_names , <nl> - _WAIT_FOR_BACKEND_SEC ) <nl> - original_size = len ( primary_instance_names ) <nl> - resize_instance_group ( gcp , primary_instance_group , 0 ) <nl> - wait_until_all_rpcs_go_to_given_backends ( secondary_instance_names , <nl> - _WAIT_FOR_BACKEND_SEC ) <nl> - <nl> - resize_instance_group ( gcp , primary_instance_group , original_size ) <nl> - new_instance_names = get_instance_names ( gcp , primary_instance_group ) <nl> - wait_for_healthy_backends ( gcp , backend_service , primary_instance_group ) <nl> - wait_until_all_rpcs_go_to_given_backends ( new_instance_names , <nl> - _WAIT_FOR_BACKEND_SEC ) <nl> + _WAIT_FOR_STATS_SEC ) <nl> + try : <nl> + set_serving_status ( primary_instance_names , <nl> + gcp . service_port , <nl> + serving = False ) <nl> + wait_until_all_rpcs_go_to_given_backends ( secondary_instance_names , <nl> + _WAIT_FOR_BACKEND_SEC ) <nl> + finally : <nl> + set_serving_status ( primary_instance_names , <nl> + gcp . service_port , <nl> + serving = True ) <nl> + except RpcDistributionError as e : <nl> + if not swapped_primary_and_secondary and is_primary_instance_group ( <nl> + gcp , secondary_instance_group ) : <nl> + # Swap expectation of primary and secondary instance groups . <nl> + test_secondary_locality_gets_requests_on_primary_failure ( <nl> + gcp , <nl> + backend_service , <nl> + secondary_instance_group , <nl> + primary_instance_group , <nl> + swapped_primary_and_secondary = True ) <nl> + else : <nl> + raise e <nl> finally : <nl> patch_backend_instances ( gcp , backend_service , [ primary_instance_group ] ) <nl> <nl> def test_traffic_splitting ( gcp , original_backend_service , instance_group , <nl> set_validate_for_proxyless ( gcp , True ) <nl> <nl> <nl> + def set_serving_status ( instances , service_port , serving ) : <nl> + for instance in instances : <nl> + with grpc . insecure_channel ( ' % s : % d ' % <nl> + ( instance , service_port ) ) as channel : <nl> + stub = test_pb2_grpc . XdsUpdateHealthServiceStub ( channel ) <nl> + if serving : <nl> + stub . SetServing ( empty_pb2 . Empty ( ) ) <nl> + else : <nl> + stub . SetNotServing ( empty_pb2 . Empty ( ) ) <nl> + <nl> + <nl> + def is_primary_instance_group ( gcp , instance_group ) : <nl> + # Clients may connect to a TD instance in a different region than the <nl> + # client , in which case primary / secondary assignments may not be based on <nl> + # the client ' s actual locality . <nl> + instance_names = get_instance_names ( gcp , instance_group ) <nl> + stats = get_client_stats ( _NUM_TEST_RPCS , _WAIT_FOR_STATS_SEC ) <nl> + return all ( peer in instance_names for peer in stats . rpcs_by_peer . keys ( ) ) <nl> + <nl> + <nl> def get_startup_script ( path_to_server_binary , service_port ) : <nl> if path_to_server_binary : <nl> return " nohup % s - - port = % d 1 > / dev / null & " % ( path_to_server_binary , <nl> def wait_for_healthy_backends ( gcp , <nl> timeout_sec = _WAIT_FOR_BACKEND_SEC ) : <nl> start_time = time . time ( ) <nl> config = { ' group ' : instance_group . url } <nl> + expected_size = len ( get_instance_names ( gcp , instance_group ) ) <nl> while time . time ( ) - start_time < = timeout_sec : <nl> result = gcp . compute . backendServices ( ) . getHealth ( <nl> project = gcp . project , <nl> backendService = backend_service . name , <nl> body = config ) . execute ( num_retries = _GCP_API_RETRIES ) <nl> if ' healthStatus ' in result : <nl> + logger . info ( ' received healthStatus : % s ' , result [ ' healthStatus ' ] ) <nl> healthy = True <nl> for instance in result [ ' healthStatus ' ] : <nl> if instance [ ' healthState ' ] ! = ' HEALTHY ' : <nl> healthy = False <nl> break <nl> - if healthy : <nl> + if healthy and expected_size = = len ( result [ ' healthStatus ' ] ) : <nl> return <nl> time . sleep ( 2 ) <nl> raise Exception ( ' Not all backends became healthy within % d seconds : % s ' % <nl> def get_instance_names ( gcp , instance_group ) : <nl> # just extract the name manually . <nl> instance_name = item [ ' instance ' ] . split ( ' / ' ) [ - 1 ] <nl> instance_names . append ( instance_name ) <nl> + logger . info ( ' retrieved instance names : % s ' , instance_names ) <nl> return instance_names <nl> <nl> <nl> def __init__ ( self , compute , alpha_compute , project ) : <nl> template_name = _BASE_TEMPLATE_NAME + args . gcp_suffix <nl> instance_group_name = _BASE_INSTANCE_GROUP_NAME + args . gcp_suffix <nl> same_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + ' - same - zone ' + args . gcp_suffix <nl> - if _USE_SECONDARY_IG : <nl> - secondary_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + ' - secondary - zone ' + args . gcp_suffix <nl> + secondary_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + ' - secondary - zone ' + args . gcp_suffix <nl> if args . use_existing_gcp_resources : <nl> logger . info ( ' Reusing existing GCP resources ' ) <nl> get_health_check ( gcp , health_check_name ) <nl> def __init__ ( self , compute , alpha_compute , project ) : <nl> instance_group = get_instance_group ( gcp , args . zone , instance_group_name ) <nl> same_zone_instance_group = get_instance_group ( <nl> gcp , args . zone , same_zone_instance_group_name ) <nl> - if _USE_SECONDARY_IG : <nl> - secondary_zone_instance_group = get_instance_group ( <nl> - gcp , args . secondary_zone , secondary_zone_instance_group_name ) <nl> + secondary_zone_instance_group = get_instance_group ( <nl> + gcp , args . secondary_zone , secondary_zone_instance_group_name ) <nl> else : <nl> create_health_check ( gcp , health_check_name ) <nl> create_health_check_firewall_rule ( gcp , firewall_name ) <nl> def __init__ ( self , compute , alpha_compute , project ) : <nl> patch_backend_instances ( gcp , backend_service , [ instance_group ] ) <nl> same_zone_instance_group = add_instance_group ( <nl> gcp , args . zone , same_zone_instance_group_name , _INSTANCE_GROUP_SIZE ) <nl> - if _USE_SECONDARY_IG : <nl> - secondary_zone_instance_group = add_instance_group ( <nl> - gcp , args . secondary_zone , secondary_zone_instance_group_name , <nl> - _INSTANCE_GROUP_SIZE ) <nl> + secondary_zone_instance_group = add_instance_group ( <nl> + gcp , args . secondary_zone , secondary_zone_instance_group_name , <nl> + _INSTANCE_GROUP_SIZE ) <nl> <nl> wait_for_healthy_backends ( gcp , backend_service , instance_group ) <nl> <nl> def __init__ ( self , compute , alpha_compute , project ) : <nl> instance_group , <nl> alternate_backend_service , <nl> same_zone_instance_group ) <nl> + elif test_case = = ' gentle_failover ' : <nl> + test_gentle_failover ( gcp , backend_service , instance_group , <nl> + secondary_zone_instance_group ) <nl> elif test_case = = ' new_instance_group_receives_traffic ' : <nl> test_new_instance_group_receives_traffic ( <nl> gcp , backend_service , instance_group , <nl>
Merge pull request from ericgribkoff / backport_gentle_failover
grpc/grpc
a738c1fe477c037d77cb1e90bdbf273ff6719b76
2020-06-19T02:12:19Z
mmm a / scripting / javascript / spidermonkey - win32 / lib / mozjs . dll . REMOVED . git - id <nl> ppp b / scripting / javascript / spidermonkey - win32 / lib / mozjs . dll . REMOVED . git - id <nl> @ @ - 1 + 1 @ @ <nl> - a63c014d165a6c8390f07040db1cb55d588edd53 <nl> \ No newline at end of file <nl> + 29c015353614a093d22d1bee3429e9188d368789 <nl> \ No newline at end of file <nl> mmm a / scripting / javascript / spidermonkey - win32 / lib / mozjs . lib . REMOVED . git - id <nl> ppp b / scripting / javascript / spidermonkey - win32 / lib / mozjs . lib . REMOVED . git - id <nl> @ @ - 1 + 1 @ @ <nl> - 7fd7d46ae368602d9da448188c2ccdde3d43b984 <nl> \ No newline at end of file <nl> + 8754a55b4cfc1c5e9d997ae3ed037cdfd5943c6c <nl> \ No newline at end of file <nl>
Updated mozjs . lib and mozjs . dll for win32 port . Built with Release mode .
cocos2d/cocos2d-x
b51ff47ed7b7b8ca66ae4f2786c911648824b724
2012-10-16T10:24:00Z
mmm a / src / mongo / util / net / ssl_manager . cpp <nl> ppp b / src / mongo / util / net / ssl_manager . cpp <nl> namespace mongo { <nl> / / Note : this is for blocking sockets only . <nl> SSL_CTX_set_mode ( * context , SSL_MODE_AUTO_RETRY ) ; <nl> <nl> - massert ( 28606 , <nl> + massert ( 28607 , <nl> mongoutils : : str : : stream ( ) < < " can ' t store ssl session id context : " < < <nl> getSSLErrorMessage ( ERR_get_error ( ) ) , <nl> SSL_CTX_set_session_id_context ( <nl>
SERVER - 17022 Update assert code to avoid conflicts in v3 . 0 branch
mongodb/mongo
e6e989f7fcf70d5bf5a5645b6927ac7a889dd5b7
2015-02-09T21:38:56Z
mmm a / src / she / skia / skia_display . h <nl> ppp b / src / she / skia / skia_display . h <nl> namespace she { <nl> class SkiaDisplay : public Display { <nl> public : <nl> SkiaDisplay ( int width , int height , int scale ) <nl> - : m_window ( & m_queue , this ) <nl> - , m_scale ( scale ) { <nl> + : m_window ( & m_queue , this ) { <nl> m_surface . create ( width , height ) ; <nl> + m_window . setScale ( scale ) ; <nl> m_window . setVisible ( true ) ; <nl> } <nl> <nl> class SkiaDisplay : public Display { <nl> } <nl> <nl> void setScale ( int scale ) override { <nl> - m_scale = scale ; <nl> + m_window . setScale ( scale ) ; <nl> } <nl> <nl> int scale ( ) const override { <nl> - return m_scale ; <nl> + return m_window . scale ( ) ; <nl> } <nl> <nl> / / Returns the main surface to draw into this display . <nl> class SkiaDisplay : public Display { <nl> SkiaEventQueue m_queue ; <nl> SkiaWindow m_window ; <nl> SkiaSurface m_surface ; <nl> - int m_scale ; <nl> } ; <nl> <nl> } / / namespace she <nl> mmm a / src / she / skia / skia_window . h <nl> ppp b / src / she / skia / skia_window . h <nl> class SkiaWindow : public Window < SkiaWindow > { <nl> <nl> ASSERT ( bitmap . width ( ) * bitmap . bytesPerPixel ( ) = = bitmap . rowBytes ( ) ) ; <nl> bitmap . lockPixels ( ) ; <nl> - int ret = SetDIBitsToDevice ( hdc , <nl> - 0 , 0 , <nl> - bitmap . width ( ) , bitmap . height ( ) , <nl> - 0 , 0 , <nl> - 0 , bitmap . height ( ) , <nl> + <nl> + int ret = StretchDIBits ( hdc , <nl> + 0 , 0 , bitmap . width ( ) * scale ( ) , bitmap . height ( ) * scale ( ) , <nl> + 0 , 0 , bitmap . width ( ) , bitmap . height ( ) , <nl> bitmap . getPixels ( ) , <nl> - & bmi , <nl> - DIB_RGB_COLORS ) ; <nl> + & bmi , DIB_RGB_COLORS , SRCCOPY ) ; <nl> ( void ) ret ; <nl> + <nl> bitmap . unlockPixels ( ) ; <nl> } <nl> <nl> mmm a / src / she / win / window . h <nl> ppp b / src / she / win / window . h <nl> static KeyScancode vkToScancode ( int vk ) { <nl> static_cast < T * > ( this ) - > queueEventImpl ( ev ) ; <nl> } <nl> <nl> + int scale ( ) const { <nl> + return m_scale ; <nl> + } <nl> + <nl> void setScale ( int scale ) { <nl> m_scale = scale ; <nl> } <nl>
Render SkiaWindow with scale factor
aseprite/aseprite
6e76d50864be2284447050dc36349d7ec05a2055
2015-03-25T20:27:43Z
mmm a / Makefile <nl> ppp b / Makefile <nl> test_cxx : buildtests_cxx <nl> $ ( Q ) . / bins / $ ( CONFIG ) / credentials_test | | ( echo test credentials_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing end2end_test " <nl> $ ( Q ) . / bins / $ ( CONFIG ) / end2end_test | | ( echo test end2end_test failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing qps_client " <nl> - $ ( Q ) . / bins / $ ( CONFIG ) / qps_client | | ( echo test qps_client failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing qps_server " <nl> - $ ( Q ) . / bins / $ ( CONFIG ) / qps_server | | ( echo test qps_server failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing status_test " <nl> $ ( Q ) . / bins / $ ( CONFIG ) / status_test | | ( echo test status_test failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing sync_client_async_server_test " <nl> mmm a / build . json <nl> ppp b / build . json <nl> <nl> { <nl> " name " : " qps_client " , <nl> " build " : " test " , <nl> + " run " : false , <nl> " language " : " c + + " , <nl> " src " : [ <nl> " test / cpp / qps / qpstest . proto " , <nl> <nl> { <nl> " name " : " qps_server " , <nl> " build " : " test " , <nl> + " run " : false , <nl> " language " : " c + + " , <nl> " src " : [ <nl> " test / cpp / qps / qpstest . proto " , <nl>
Merge pull request from vjpai / linkstatic
grpc/grpc
6c84ba09da913b5f77ac0229505f28ff1e957cf1
2015-02-10T19:43:29Z
mmm a / tensorflow / docs_src / install / install_windows . md <nl> ppp b / tensorflow / docs_src / install / install_windows . md <nl> TensorFlow } . <nl> If the system outputs an error message instead of a greeting , see [ Common <nl> installation problems ] ( # common_installation_problems ) . <nl> <nl> - There is also a helpful [ script ] ( # https : / / gist . github . com / mrry / ee5dbcfdd045fa48a27d56664411d41c ) <nl> + There is also a helpful [ script ] ( https : / / gist . github . com / mrry / ee5dbcfdd045fa48a27d56664411d41c ) <nl> that helps with Windows TensorFlow installation issues . <nl> <nl> # # Common installation problems <nl>
Removing accidental hash .
tensorflow/tensorflow
c7ad6bfef99d1e6a0d5714244e6326f10190dd28
2017-09-11T21:13:10Z
mmm a / . pylintrc <nl> ppp b / . pylintrc <nl> notes = FIXME , XXX <nl> # TODO : Enable no - init <nl> # TODO : Enable duplicate - code <nl> # TODO : Enable invalid - name <nl> - # TODO : Enable suppressed - message <nl> # TODO : Enable locally - disabled <nl> # TODO : Enable protected - access <nl> # TODO : Enable no - name - in - module <nl> notes = FIXME , XXX <nl> # TODO : Enable too - many - nested - blocks <nl> # TODO : Enable super - init - not - called <nl> <nl> - disable = missing - docstring , too - few - public - methods , too - many - arguments , no - init , duplicate - code , invalid - name , suppressed - message , locally - disabled , protected - access , no - name - in - module , unused - argument , wrong - import - order , cyclic - import , too - many - instance - attributes , too - many - locals , too - many - lines , redefined - variable - type , next - method - called , import - error , useless - else - on - loop , too - many - return - statements , too - many - nested - blocks , super - init - not - called <nl> + disable = missing - docstring , too - few - public - methods , too - many - arguments , no - init , duplicate - code , invalid - name , locally - disabled , protected - access , no - name - in - module , unused - argument , wrong - import - order , cyclic - import , too - many - instance - attributes , too - many - locals , too - many - lines , redefined - variable - type , next - method - called , import - error , useless - else - on - loop , too - many - return - statements , too - many - nested - blocks , super - init - not - called <nl>
Enable suppressed - message lint
grpc/grpc
d3d46a5385f9566cd630755679004c0088865744
2017-03-03T01:30:55Z
mmm a / src / mongo / db / instance . cpp <nl> ppp b / src / mongo / db / instance . cpp <nl> namespace mongo { <nl> globalOpCounters . gotOp ( op , isCommand ) ; <nl> <nl> Client & c = cc ( ) ; <nl> - <nl> + if ( c . getAuthenticationInfo ( ) ) <nl> + c . getAuthenticationInfo ( ) - > startRequest ( ) ; <nl> <nl> auto_ptr < CurOp > nestedOp ; <nl> CurOp * currentOpP = c . curop ( ) ; <nl> mmm a / src / mongo / db / security . cpp <nl> ppp b / src / mongo / db / security . cpp <nl> namespace mongo { <nl> } <nl> } <nl> <nl> + void AuthenticationInfo : : startRequest ( ) { <nl> + if ( _isLocalHost & & _isLocalHostAndLocalHostIsAuthorizedForAll ) { <nl> + if ( ! Lock : : isLocked ( ) ) { <nl> + / / we can ' t do this if we ' re already locked <nl> + / / as then we can deadlock <nl> + _isLocalHost = false ; <nl> + _isLocalHostAndLocalHostIsAuthorizedForAll = false ; <nl> + setIsALocalHostConnectionWithSpecialAuthPowers ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> bool CmdAuthenticate : : getUserObj ( const string & dbname , const string & user , BSONObj & userObj , string & pwd ) { <nl> if ( user = = internalSecurity . user ) { <nl> uassert ( 15889 , " key file must be used to log in with internal user " , cmdLine . keyFile ) ; <nl> mmm a / src / mongo / db / security . h <nl> ppp b / src / mongo / db / security . h <nl> namespace mongo { <nl> bool _isLocalHost ; <nl> bool _isLocalHostAndLocalHostIsAuthorizedForAll ; <nl> public : <nl> + void startRequest ( ) ; / / need to call at the beginning of each request <nl> void setIsALocalHostConnectionWithSpecialAuthPowers ( ) ; / / called , if localhost , when conneciton established . <nl> AuthenticationInfo ( ) { <nl> _isLocalHost = false ; <nl>
at the beginning of every request , if we have special admin local auth , check we still are allowed
mongodb/mongo
8bd22928b9ab630f74f5c10124f7662ce91c484d
2012-03-27T04:56:08Z
mmm a / tensorflow / compiler / mlir / xla / tests / lhlo - legalize - to - gpu . mlir <nl> ppp b / tensorflow / compiler / mlir / xla / tests / lhlo - legalize - to - gpu . mlir <nl> func @ reduce ( % arg : memref < 100x10xf32 > , <nl> : ( memref < 100x10xf32 > , memref < f32 > , memref < 100xf32 > ) - > ( ) <nl> return <nl> } <nl> - / / CHECK : # map0 = [ [ MAP : . * ] ] <nl> <nl> / / CHECK : func @ reduce ( % [ [ ARG0 : . * ] ] : memref < 100x10xf32 > , % [ [ ARG1 : . * ] ] : memref < f32 > , % [ [ ARG2 : . * ] ] : memref < 100xf32 > ) { <nl> / / CHECK - DAG : % [ [ C100 : . * ] ] = constant 100 : index <nl> func @ reduce ( % arg : memref < 100x10xf32 > , <nl> / / CHECK : loop . for % [ [ IDX1 : . * ] ] = % [ [ LB ] ] to % [ [ UB ] ] step % [ [ STEP ] ] { <nl> / / CHECK : % [ [ LHS : . * ] ] = linalg . slice % [ [ ARG2 ] ] [ % [ [ IDX ] ] ] : memref < 100xf32 > , index , memref < f32 , # map0 > <nl> / / CHECK : % [ [ RHS : . * ] ] = linalg . slice % [ [ ARG0 ] ] [ % [ [ IDX ] ] , % [ [ IDX1 ] ] ] : memref < 100x10xf32 > , index , index , memref < f32 , # map0 > <nl> - / / CHECK : " xla_lhlo . add " ( % [ [ LHS ] ] , % [ [ RHS ] ] , % [ [ LHS ] ] ) : ( memref < f32 , [ [ MAP ] ] > , memref < f32 , [ [ MAP ] ] > , memref < f32 , [ [ MAP ] ] > ) - > ( ) <nl> + / / CHECK : " xla_lhlo . add " ( % [ [ LHS ] ] , % [ [ RHS ] ] , % [ [ LHS ] ] ) : ( memref < f32 , { { . * } } > , memref < f32 , { { . * } } > , memref < f32 , { { . * } } > ) - > ( ) <nl> / / CHECK : } <nl> / / CHECK : gpu . terminator <nl> / / CHECK : } <nl>
Relax lhlo - legalize - to - gpu . mlir test expectation , which can vary . See f0fb09c33e39 .
tensorflow/tensorflow
a33791a27cc6be66703cd3401d6d2701c21001e8
2020-02-05T08:49:51Z
mmm a / lib / Frontend / DiagnosticVerifier . cpp <nl> ppp b / lib / Frontend / DiagnosticVerifier . cpp <nl> DiagnosticVerifier : : verifyFile ( unsigned BufferID , bool shouldAutoApplyFixes ) { <nl> / / fixit to add them in . <nl> auto actual = renderFixits ( FoundDiagnostic . getFixIts ( ) , InputFile ) ; <nl> auto replStartLoc = SMLoc : : getFromPointer ( expected . ExpectedEnd - 8 ) ; / / { { none } } length <nl> - auto replEndLoc = SMLoc : : getFromPointer ( expected . ExpectedEnd - 1 ) ; <nl> + auto replEndLoc = SMLoc : : getFromPointer ( expected . ExpectedEnd ) ; <nl> <nl> llvm : : SMFixIt fix ( llvm : : SMRange ( replStartLoc , replEndLoc ) , actual ) ; <nl> addError ( replStartLoc . getPointer ( ) , " expected no fix - its ; actual fix - it seen : " + actual , fix ) ; <nl> new file mode 100644 <nl> index 000000000000 . . 81c4943e39a4 <nl> mmm / dev / null <nl> ppp b / test / FixCode / verify - fixits . swift <nl> <nl> + / / RUN : cp % s % t <nl> + / / RUN : not % swift - typecheck - target % target - triple - verify - apply - fixes % t <nl> + / / RUN : diff % t % s . result <nl> + <nl> + func f1 ( ) { <nl> + guard true { return } / / expected - error { { . . . } } <nl> + <nl> + guard true { return } / / expected - error { { expected ' else ' after ' guard ' condition } } { { none } } <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . d6c3324067f7 <nl> mmm / dev / null <nl> ppp b / test / FixCode / verify - fixits . swift . result <nl> <nl> + / / RUN : cp % s % t <nl> + / / RUN : not % swift - typecheck - target % target - triple - verify - apply - fixes % t <nl> + / / RUN : diff % t % s . result <nl> + <nl> + func f1 ( ) { <nl> + guard true { return } / / expected - error { { expected ' else ' after ' guard ' condition } } <nl> + <nl> + guard true { return } / / expected - error { { expected ' else ' after ' guard ' condition } } { { 14 - 14 = else } } <nl> + } <nl> \ No newline at end of file <nl>
[ Diagnostics ] Fix range of fix - its in verify mode
apple/swift
3ccec26390fc5cf17ede8b431f94438606fe7e75
2020-03-19T09:47:57Z
mmm a / src / heap / heap - inl . h <nl> ppp b / src / heap / heap - inl . h <nl> WELL_KNOWN_SYMBOL_LIST ( SYMBOL_ACCESSOR ) <nl> ROOT_LIST ( ROOT_ACCESSOR ) <nl> # undef ROOT_ACCESSOR <nl> <nl> + PagedSpace * Heap : : paged_space ( int idx ) { <nl> + switch ( idx ) { <nl> + case OLD_SPACE : <nl> + return old_space ( ) ; <nl> + case MAP_SPACE : <nl> + return map_space ( ) ; <nl> + case CODE_SPACE : <nl> + return code_space ( ) ; <nl> + case NEW_SPACE : <nl> + case LO_SPACE : <nl> + UNREACHABLE ( ) ; <nl> + } <nl> + return NULL ; <nl> + } <nl> + <nl> + Space * Heap : : space ( int idx ) { <nl> + switch ( idx ) { <nl> + case NEW_SPACE : <nl> + return new_space ( ) ; <nl> + case LO_SPACE : <nl> + return lo_space ( ) ; <nl> + default : <nl> + return paged_space ( idx ) ; <nl> + } <nl> + } <nl> + <nl> + Address * Heap : : NewSpaceAllocationTopAddress ( ) { <nl> + return new_space_ . allocation_top_address ( ) ; <nl> + } <nl> + <nl> + Address * Heap : : NewSpaceAllocationLimitAddress ( ) { <nl> + return new_space_ . allocation_limit_address ( ) ; <nl> + } <nl> + <nl> + Address * Heap : : OldSpaceAllocationTopAddress ( ) { <nl> + return old_space_ - > allocation_top_address ( ) ; <nl> + } <nl> + <nl> + Address * Heap : : OldSpaceAllocationLimitAddress ( ) { <nl> + return old_space_ - > allocation_limit_address ( ) ; <nl> + } <nl> + <nl> + bool Heap : : HeapIsFullEnoughToStartIncrementalMarking ( intptr_t limit ) { <nl> + if ( FLAG_stress_compaction & & ( gc_count_ & 1 ) ! = 0 ) return true ; <nl> + <nl> + intptr_t adjusted_allocation_limit = limit - new_space_ . Capacity ( ) ; <nl> + <nl> + if ( PromotedTotalSize ( ) > = adjusted_allocation_limit ) return true ; <nl> + <nl> + if ( HighMemoryPressure ( ) ) return true ; <nl> + <nl> + return false ; <nl> + } <nl> + <nl> + void Heap : : UpdateNewSpaceAllocationCounter ( ) { <nl> + new_space_allocation_counter_ = NewSpaceAllocationCounter ( ) ; <nl> + } <nl> + <nl> + size_t Heap : : NewSpaceAllocationCounter ( ) { <nl> + return new_space_allocation_counter_ + new_space ( ) - > AllocatedSinceLastGC ( ) ; <nl> + } <nl> <nl> template < > <nl> bool inline Heap : : IsOneByte ( Vector < const char > str , int chars ) { <nl> void Heap : : FinalizeExternalString ( String * string ) { <nl> <nl> <nl> bool Heap : : InNewSpace ( Object * object ) { <nl> - bool result = new_space_ . Contains ( object ) ; <nl> + / / Inlined check from NewSpace : : Contains . <nl> + bool result = <nl> + object - > IsHeapObject ( ) & & <nl> + Page : : FromAddress ( HeapObject : : cast ( object ) - > address ( ) ) - > InNewSpace ( ) ; <nl> DCHECK ( ! result | | / / Either not in new space <nl> gc_state_ ! = NOT_IN_GC | | / / . . . or in the middle of GC <nl> InToSpace ( object ) ) ; / / . . . or in to - space ( where we allocate ) . <nl> bool Heap : : InNewSpace ( Object * object ) { <nl> } <nl> <nl> bool Heap : : InFromSpace ( Object * object ) { <nl> - return new_space_ . FromSpaceContains ( object ) ; <nl> + return object - > IsHeapObject ( ) & & <nl> + MemoryChunk : : FromAddress ( HeapObject : : cast ( object ) - > address ( ) ) <nl> + - > IsFlagSet ( Page : : IN_FROM_SPACE ) ; <nl> } <nl> <nl> <nl> bool Heap : : InToSpace ( Object * object ) { <nl> - return new_space_ . ToSpaceContains ( object ) ; <nl> + return object - > IsHeapObject ( ) & & <nl> + MemoryChunk : : FromAddress ( HeapObject : : cast ( object ) - > address ( ) ) <nl> + - > IsFlagSet ( Page : : IN_TO_SPACE ) ; <nl> } <nl> <nl> bool Heap : : InOldSpace ( Object * object ) { return old_space_ - > Contains ( object ) ; } <nl> mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> void Heap : : IncrementDeferredCount ( v8 : : Isolate : : UseCounterFeature feature ) { <nl> deferred_counters_ [ feature ] + + ; <nl> } <nl> <nl> + bool Heap : : UncommitFromSpace ( ) { return new_space_ . UncommitFromSpace ( ) ; } <nl> <nl> void Heap : : GarbageCollectionPrologue ( ) { <nl> { <nl> intptr_t Heap : : CalculateOldGenerationAllocationLimit ( double factor , <nl> return Min ( limit , halfway_to_the_max ) ; <nl> } <nl> <nl> + intptr_t Heap : : MinimumAllocationLimitGrowingStep ( ) { <nl> + const double kRegularAllocationLimitGrowingStep = 8 ; <nl> + const double kLowMemoryAllocationLimitGrowingStep = 2 ; <nl> + intptr_t limit = ( Page : : kPageSize > MB ? Page : : kPageSize : MB ) ; <nl> + return limit * ( ShouldOptimizeForMemoryUsage ( ) <nl> + ? kLowMemoryAllocationLimitGrowingStep <nl> + : kRegularAllocationLimitGrowingStep ) ; <nl> + } <nl> <nl> void Heap : : SetOldGenerationAllocationLimit ( intptr_t old_gen_size , <nl> double gc_speed , <nl> mmm a / src / heap / heap . h <nl> ppp b / src / heap / heap . h <nl> class HeapObjectsFilter ; <nl> class HeapStats ; <nl> class HistogramTimer ; <nl> class Isolate ; <nl> + class MemoryAllocator ; <nl> class MemoryReducer ; <nl> class ObjectStats ; <nl> + class PagedSpace ; <nl> class Scavenger ; <nl> class ScavengeJob ; <nl> + class Space ; <nl> class StoreBuffer ; <nl> class WeakObjectRetainer ; <nl> <nl> class Heap { <nl> <nl> bool always_allocate ( ) { return always_allocate_scope_count_ . Value ( ) ! = 0 ; } <nl> <nl> - Address * NewSpaceAllocationTopAddress ( ) { <nl> - return new_space_ . allocation_top_address ( ) ; <nl> - } <nl> - Address * NewSpaceAllocationLimitAddress ( ) { <nl> - return new_space_ . allocation_limit_address ( ) ; <nl> - } <nl> - <nl> - Address * OldSpaceAllocationTopAddress ( ) { <nl> - return old_space_ - > allocation_top_address ( ) ; <nl> - } <nl> - Address * OldSpaceAllocationLimitAddress ( ) { <nl> - return old_space_ - > allocation_limit_address ( ) ; <nl> - } <nl> + inline Address * NewSpaceAllocationTopAddress ( ) ; <nl> + inline Address * NewSpaceAllocationLimitAddress ( ) ; <nl> + inline Address * OldSpaceAllocationTopAddress ( ) ; <nl> + inline Address * OldSpaceAllocationLimitAddress ( ) ; <nl> <nl> bool CanExpandOldGeneration ( int size ) { <nl> if ( force_oom_ ) return false ; <nl> class Heap { <nl> / / Check new space expansion criteria and expand semispaces if it was hit . <nl> void CheckNewSpaceExpansionCriteria ( ) ; <nl> <nl> - inline bool HeapIsFullEnoughToStartIncrementalMarking ( intptr_t limit ) { <nl> - if ( FLAG_stress_compaction & & ( gc_count_ & 1 ) ! = 0 ) return true ; <nl> - <nl> - intptr_t adjusted_allocation_limit = limit - new_space_ . Capacity ( ) ; <nl> - <nl> - if ( PromotedTotalSize ( ) > = adjusted_allocation_limit ) return true ; <nl> - <nl> - if ( HighMemoryPressure ( ) ) return true ; <nl> - <nl> - return false ; <nl> - } <nl> + inline bool HeapIsFullEnoughToStartIncrementalMarking ( intptr_t limit ) ; <nl> <nl> void VisitExternalResources ( v8 : : ExternalResourceVisitor * visitor ) ; <nl> <nl> class Heap { <nl> MapSpace * map_space ( ) { return map_space_ ; } <nl> LargeObjectSpace * lo_space ( ) { return lo_space_ ; } <nl> <nl> - PagedSpace * paged_space ( int idx ) { <nl> - switch ( idx ) { <nl> - case OLD_SPACE : <nl> - return old_space ( ) ; <nl> - case MAP_SPACE : <nl> - return map_space ( ) ; <nl> - case CODE_SPACE : <nl> - return code_space ( ) ; <nl> - case NEW_SPACE : <nl> - case LO_SPACE : <nl> - UNREACHABLE ( ) ; <nl> - } <nl> - return NULL ; <nl> - } <nl> - <nl> - Space * space ( int idx ) { <nl> - switch ( idx ) { <nl> - case NEW_SPACE : <nl> - return new_space ( ) ; <nl> - case LO_SPACE : <nl> - return lo_space ( ) ; <nl> - default : <nl> - return paged_space ( idx ) ; <nl> - } <nl> - } <nl> + inline PagedSpace * paged_space ( int idx ) ; <nl> + inline Space * space ( int idx ) ; <nl> <nl> / / Returns name of the space . <nl> const char * GetSpaceName ( int idx ) ; <nl> class Heap { <nl> return static_cast < intptr_t > ( total ) ; <nl> } <nl> <nl> - void UpdateNewSpaceAllocationCounter ( ) { <nl> - new_space_allocation_counter_ = NewSpaceAllocationCounter ( ) ; <nl> - } <nl> + inline void UpdateNewSpaceAllocationCounter ( ) ; <nl> <nl> - size_t NewSpaceAllocationCounter ( ) { <nl> - return new_space_allocation_counter_ + new_space ( ) - > AllocatedSinceLastGC ( ) ; <nl> - } <nl> + inline size_t NewSpaceAllocationCounter ( ) ; <nl> <nl> / / This should be used only for testing . <nl> void set_new_space_allocation_counter ( size_t new_value ) { <nl> class Heap { <nl> void EnsureFromSpaceIsCommitted ( ) ; <nl> <nl> / / Uncommit unused semi space . <nl> - bool UncommitFromSpace ( ) { return new_space_ . UncommitFromSpace ( ) ; } <nl> + bool UncommitFromSpace ( ) ; <nl> <nl> / / Fill in bogus values in from space <nl> void ZapFromSpace ( ) ; <nl> class Heap { <nl> void SetOldGenerationAllocationLimit ( intptr_t old_gen_size , double gc_speed , <nl> double mutator_speed ) ; <nl> <nl> - intptr_t MinimumAllocationLimitGrowingStep ( ) { <nl> - const double kRegularAllocationLimitGrowingStep = 8 ; <nl> - const double kLowMemoryAllocationLimitGrowingStep = 2 ; <nl> - intptr_t limit = ( Page : : kPageSize > MB ? Page : : kPageSize : MB ) ; <nl> - return limit * ( ShouldOptimizeForMemoryUsage ( ) <nl> - ? kLowMemoryAllocationLimitGrowingStep <nl> - : kRegularAllocationLimitGrowingStep ) ; <nl> - } <nl> + intptr_t MinimumAllocationLimitGrowingStep ( ) ; <nl> <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> / / Idle notification . = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl>
[ heap ] Cleanup heap . h
v8/v8
985afadfcc843eac280a055dda85b9e663760ac6
2016-09-06T09:02:34Z
mmm a / tools / distrib / yapf_code . sh <nl> ppp b / tools / distrib / yapf_code . sh <nl> DIRS = ( <nl> ' tools / interop_matrix ' <nl> ' tools / profiling ' <nl> ' tools / run_tests / python_utils ' <nl> + ' tools / run_tests / sanity ' <nl> ) <nl> EXCLUSIONS = ( <nl> ' grpcio / grpc_ * . py ' <nl> mmm a / tools / run_tests / python_utils / jobset . py <nl> ppp b / tools / run_tests / python_utils / jobset . py <nl> def __repr__ ( self ) : <nl> self . cmdline ) <nl> <nl> def __str__ ( self ) : <nl> - return ' % s : % s % s ' % ( self . shortname , <nl> - ' ' . join ( ' % s = % s ' % kv <nl> - for kv in self . environ . items ( ) ) , <nl> - ' ' . join ( self . cmdline ) ) <nl> + return ' % s : % s % s ' % ( self . shortname , ' ' . join ( <nl> + ' % s = % s ' % kv <nl> + for kv in self . environ . items ( ) ) , ' ' . join ( self . cmdline ) ) <nl> <nl> <nl> class JobResult ( object ) : <nl> mmm a / tools / run_tests / python_utils / port_server . py <nl> ppp b / tools / run_tests / python_utils / port_server . py <nl> def do_GET ( self ) : <nl> self . end_headers ( ) <nl> mu . acquire ( ) <nl> now = time . time ( ) <nl> - out = yaml . dump ( <nl> - { <nl> - ' pool ' : pool , <nl> - ' in_use ' : dict ( ( k , now - v ) for k , v in in_use . items ( ) ) <nl> - } ) <nl> + out = yaml . dump ( { <nl> + ' pool ' : <nl> + pool , <nl> + ' in_use ' : <nl> + dict ( ( k , now - v ) for k , v in in_use . items ( ) ) <nl> + } ) <nl> mu . release ( ) <nl> self . wfile . write ( out ) <nl> elif self . path = = ' / quitquitquit ' : <nl> mmm a / tools / run_tests / sanity / check_bazel_workspace . py <nl> ppp b / tools / run_tests / sanity / check_bazel_workspace . py <nl> <nl> git_hash_pattern = re . compile ( ' [ 0 - 9a - f ] { 40 } ' ) <nl> <nl> # Parse git hashes from submodules <nl> - git_submodules = subprocess . check_output ( ' git submodule ' , shell = True ) . strip ( ) . split ( ' \ n ' ) <nl> - git_submodule_hashes = { re . search ( git_hash_pattern , s ) . group ( ) for s in git_submodules } <nl> + git_submodules = subprocess . check_output ( <nl> + ' git submodule ' , shell = True ) . strip ( ) . split ( ' \ n ' ) <nl> + git_submodule_hashes = { <nl> + re . search ( git_hash_pattern , s ) . group ( ) <nl> + for s in git_submodules <nl> + } <nl> <nl> # Parse git hashes from Bazel WORKSPACE { new_ } http_archive rules <nl> with open ( ' WORKSPACE ' , ' r ' ) as f : <nl> - workspace_rules = [ expr . value for expr in ast . parse ( f . read ( ) ) . body ] <nl> - <nl> - http_archive_rules = [ rule for rule in workspace_rules if rule . func . id . endswith ( ' http_archive ' ) ] <nl> - archive_urls = [ kw . value . s for rule in http_archive_rules for kw in rule . keywords if kw . arg = = ' url ' ] <nl> - workspace_git_hashes = { re . search ( git_hash_pattern , url ) . group ( ) for url in archive_urls } <nl> + workspace_rules = [ expr . value for expr in ast . parse ( f . read ( ) ) . body ] <nl> + <nl> + http_archive_rules = [ <nl> + rule for rule in workspace_rules if rule . func . id . endswith ( ' http_archive ' ) <nl> + ] <nl> + archive_urls = [ <nl> + kw . value . s for rule in http_archive_rules for kw in rule . keywords <nl> + if kw . arg = = ' url ' <nl> + ] <nl> + workspace_git_hashes = { <nl> + re . search ( git_hash_pattern , url ) . group ( ) <nl> + for url in archive_urls <nl> + } <nl> <nl> # Validate the equivalence of the git submodules and Bazel git dependencies . The <nl> # condition we impose is that there is a git submodule for every dependency in <nl> # the workspace , but not necessarily conversely . E . g . Bloaty is a dependency <nl> # not used by any of the targets built by Bazel . <nl> if len ( workspace_git_hashes - git_submodule_hashes ) > 0 : <nl> - print ( " Found discrepancies between git submodules and Bazel WORKSPACE dependencies " ) <nl> + print ( <nl> + " Found discrepancies between git submodules and Bazel WORKSPACE dependencies " <nl> + ) <nl> sys . exit ( 1 ) <nl> <nl> sys . exit ( 0 ) <nl> mmm a / tools / run_tests / sanity / check_sources_and_headers . py <nl> ppp b / tools / run_tests / sanity / check_sources_and_headers . py <nl> <nl> import sys <nl> <nl> root = os . path . abspath ( os . path . join ( os . path . dirname ( sys . argv [ 0 ] ) , ' . . / . . / . . ' ) ) <nl> - with open ( os . path . join ( root , ' tools ' , ' run_tests ' , ' generated ' , ' sources_and_headers . json ' ) ) as f : <nl> - js = json . loads ( f . read ( ) ) <nl> + with open ( <nl> + os . path . join ( root , ' tools ' , ' run_tests ' , ' generated ' , <nl> + ' sources_and_headers . json ' ) ) as f : <nl> + js = json . loads ( f . read ( ) ) <nl> <nl> re_inc1 = re . compile ( r ' ^ # \ s * include \ s * " ( [ ^ " ] * ) " ' ) <nl> assert re_inc1 . match ( ' # include " foo " ' ) . group ( 1 ) = = ' foo ' <nl> re_inc2 = re . compile ( r ' ^ # \ s * include \ s * < ( ( grpc | grpc \ + \ + ) / [ ^ " ] * ) > ' ) <nl> assert re_inc2 . match ( ' # include < grpc + + / foo > ' ) . group ( 1 ) = = ' grpc + + / foo ' <nl> <nl> + <nl> def get_target ( name ) : <nl> - for target in js : <nl> - if target [ ' name ' ] = = name : <nl> - return target <nl> - assert False , ' no target % s ' % name <nl> + for target in js : <nl> + if target [ ' name ' ] = = name : <nl> + return target <nl> + assert False , ' no target % s ' % name <nl> + <nl> <nl> def target_has_header ( target , name ) : <nl> - if name . startswith ( ' absl / ' ) : return True <nl> - # print target [ ' name ' ] , name <nl> - if name in target [ ' headers ' ] : <nl> - return True <nl> - for dep in target [ ' deps ' ] : <nl> - if target_has_header ( get_target ( dep ) , name ) : <nl> - return True <nl> - if name in [ ' src / core / lib / profiling / stap_probes . h ' , <nl> - ' src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . h ' ] : <nl> - return True <nl> - return False <nl> + if name . startswith ( ' absl / ' ) : return True <nl> + # print target [ ' name ' ] , name <nl> + if name in target [ ' headers ' ] : <nl> + return True <nl> + for dep in target [ ' deps ' ] : <nl> + if target_has_header ( get_target ( dep ) , name ) : <nl> + return True <nl> + if name in [ <nl> + ' src / core / lib / profiling / stap_probes . h ' , <nl> + ' src / proto / grpc / reflection / v1alpha / reflection . grpc . pb . h ' <nl> + ] : <nl> + return True <nl> + return False <nl> + <nl> <nl> def produces_object ( name ) : <nl> - return os . path . splitext ( name ) [ 1 ] in [ ' . c ' , ' . cc ' ] <nl> + return os . path . splitext ( name ) [ 1 ] in [ ' . c ' , ' . cc ' ] <nl> + <nl> <nl> c_ish = { } <nl> obj_producer_to_source = { ' c ' : c_ish , ' c + + ' : c_ish , ' csharp ' : { } } <nl> <nl> errors = 0 <nl> for target in js : <nl> - if not target [ ' third_party ' ] : <nl> - for fn in target [ ' src ' ] : <nl> - with open ( os . path . join ( root , fn ) ) as f : <nl> - src = f . read ( ) . splitlines ( ) <nl> - for line in src : <nl> - m = re_inc1 . match ( line ) <nl> - if m : <nl> - if not target_has_header ( target , m . group ( 1 ) ) : <nl> - print ( <nl> - ' target % s ( % s ) does not name header % s as a dependency ' % ( <nl> - target [ ' name ' ] , fn , m . group ( 1 ) ) ) <nl> - errors + = 1 <nl> - m = re_inc2 . match ( line ) <nl> - if m : <nl> - if not target_has_header ( target , ' include / ' + m . group ( 1 ) ) : <nl> - print ( <nl> - ' target % s ( % s ) does not name header % s as a dependency ' % ( <nl> - target [ ' name ' ] , fn , m . group ( 1 ) ) ) <nl> - errors + = 1 <nl> - if target [ ' type ' ] in [ ' lib ' , ' filegroup ' ] : <nl> - for fn in target [ ' src ' ] : <nl> - language = target [ ' language ' ] <nl> - if produces_object ( fn ) : <nl> - obj_base = os . path . splitext ( os . path . basename ( fn ) ) [ 0 ] <nl> - if obj_base in obj_producer_to_source [ language ] : <nl> - if obj_producer_to_source [ language ] [ obj_base ] ! = fn : <nl> - print ( <nl> - ' target % s ( % s ) produces an aliased object file with % s ' % ( <nl> - target [ ' name ' ] , fn , obj_producer_to_source [ language ] [ obj_base ] ) ) <nl> - else : <nl> - obj_producer_to_source [ language ] [ obj_base ] = fn <nl> + if not target [ ' third_party ' ] : <nl> + for fn in target [ ' src ' ] : <nl> + with open ( os . path . join ( root , fn ) ) as f : <nl> + src = f . read ( ) . splitlines ( ) <nl> + for line in src : <nl> + m = re_inc1 . match ( line ) <nl> + if m : <nl> + if not target_has_header ( target , m . group ( 1 ) ) : <nl> + print ( <nl> + ' target % s ( % s ) does not name header % s as a dependency ' <nl> + % ( target [ ' name ' ] , fn , m . group ( 1 ) ) ) <nl> + errors + = 1 <nl> + m = re_inc2 . match ( line ) <nl> + if m : <nl> + if not target_has_header ( target , ' include / ' + m . group ( 1 ) ) : <nl> + print ( <nl> + ' target % s ( % s ) does not name header % s as a dependency ' <nl> + % ( target [ ' name ' ] , fn , m . group ( 1 ) ) ) <nl> + errors + = 1 <nl> + if target [ ' type ' ] in [ ' lib ' , ' filegroup ' ] : <nl> + for fn in target [ ' src ' ] : <nl> + language = target [ ' language ' ] <nl> + if produces_object ( fn ) : <nl> + obj_base = os . path . splitext ( os . path . basename ( fn ) ) [ 0 ] <nl> + if obj_base in obj_producer_to_source [ language ] : <nl> + if obj_producer_to_source [ language ] [ obj_base ] ! = fn : <nl> + print ( <nl> + ' target % s ( % s ) produces an aliased object file with % s ' <nl> + % ( target [ ' name ' ] , fn , <nl> + obj_producer_to_source [ language ] [ obj_base ] ) ) <nl> + else : <nl> + obj_producer_to_source [ language ] [ obj_base ] = fn <nl> <nl> assert errors = = 0 <nl> mmm a / tools / run_tests / sanity / check_test_filtering . py <nl> ppp b / tools / run_tests / sanity / check_test_filtering . py <nl> <nl> # See the License for the specific language governing permissions and <nl> # limitations under the License . <nl> <nl> - <nl> import os <nl> import sys <nl> import unittest <nl> <nl> from run_tests_matrix import _create_test_jobs , _create_portability_test_jobs <nl> import python_utils . filter_pull_request_tests as filter_pull_request_tests <nl> <nl> - _LIST_OF_LANGUAGE_LABELS = [ ' c ' , ' c + + ' , ' csharp ' , ' grpc - node ' , ' objc ' , ' php ' , ' php7 ' , ' python ' , ' ruby ' ] <nl> + _LIST_OF_LANGUAGE_LABELS = [ <nl> + ' c ' , ' c + + ' , ' csharp ' , ' grpc - node ' , ' objc ' , ' php ' , ' php7 ' , ' python ' , ' ruby ' <nl> + ] <nl> _LIST_OF_PLATFORM_LABELS = [ ' linux ' , ' macos ' , ' windows ' ] <nl> <nl> + <nl> class TestFilteringTest ( unittest . TestCase ) : <nl> <nl> - def generate_all_tests ( self ) : <nl> - all_jobs = _create_test_jobs ( ) + _create_portability_test_jobs ( ) <nl> - self . assertIsNotNone ( all_jobs ) <nl> - return all_jobs <nl> + def generate_all_tests ( self ) : <nl> + all_jobs = _create_test_jobs ( ) + _create_portability_test_jobs ( ) <nl> + self . assertIsNotNone ( all_jobs ) <nl> + return all_jobs <nl> <nl> - def test_filtering ( self , changed_files = [ ] , labels = _LIST_OF_LANGUAGE_LABELS ) : <nl> - " " " <nl> + def test_filtering ( self , changed_files = [ ] , labels = _LIST_OF_LANGUAGE_LABELS ) : <nl> + " " " <nl> Default args should filter no tests because changed_files is empty and <nl> default labels should be able to match all jobs <nl> : param changed_files : mock list of changed_files from pull request <nl> : param labels : list of job labels that should be skipped <nl> " " " <nl> - all_jobs = self . generate_all_tests ( ) <nl> - # Replacing _get_changed_files function to allow specifying changed files in filter_tests function <nl> - def _get_changed_files ( foo ) : <nl> - return changed_files <nl> - filter_pull_request_tests . _get_changed_files = _get_changed_files <nl> - print ( ) <nl> - filtered_jobs = filter_pull_request_tests . filter_tests ( all_jobs , " test " ) <nl> - <nl> - # Make sure sanity tests aren ' t being filtered out <nl> - sanity_tests_in_all_jobs = 0 <nl> - sanity_tests_in_filtered_jobs = 0 <nl> - for job in all_jobs : <nl> - if " sanity " in job . labels : <nl> - sanity_tests_in_all_jobs + = 1 <nl> - all_jobs = [ job for job in all_jobs if " sanity " not in job . labels ] <nl> - for job in filtered_jobs : <nl> - if " sanity " in job . labels : <nl> - sanity_tests_in_filtered_jobs + = 1 <nl> - filtered_jobs = [ job for job in filtered_jobs if " sanity " not in job . labels ] <nl> - self . assertEquals ( sanity_tests_in_all_jobs , sanity_tests_in_filtered_jobs ) <nl> - <nl> - for label in labels : <nl> - for job in filtered_jobs : <nl> - self . assertNotIn ( label , job . labels ) <nl> - <nl> - jobs_matching_labels = 0 <nl> - for label in labels : <nl> - for job in all_jobs : <nl> - if ( label in job . labels ) : <nl> - jobs_matching_labels + = 1 <nl> - self . assertEquals ( len ( filtered_jobs ) , len ( all_jobs ) - jobs_matching_labels ) <nl> - <nl> - def test_individual_language_filters ( self ) : <nl> - # Changing unlisted file should trigger all languages <nl> - self . test_filtering ( [ ' ffffoo / bar . baz ' ] , [ _LIST_OF_LANGUAGE_LABELS ] ) <nl> - # Changing core should trigger all tests <nl> - self . test_filtering ( [ ' src / core / foo . bar ' ] , [ _LIST_OF_LANGUAGE_LABELS ] ) <nl> - # Testing individual languages <nl> - self . test_filtering ( [ ' test / core / foo . bar ' ] , [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _CORE_TEST_SUITE . labels + <nl> - filter_pull_request_tests . _CPP_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / cpp / foo . bar ' ] , [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _CPP_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / csharp / foo . bar ' ] , [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _CSHARP_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / objective - c / foo . bar ' ] , [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _OBJC_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / php / foo . bar ' ] , [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _PHP_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / python / foo . bar ' ] , [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _PYTHON_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / ruby / foo . bar ' ] , [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _RUBY_TEST_SUITE . labels ] ) <nl> - <nl> - def test_combined_language_filters ( self ) : <nl> - self . test_filtering ( [ ' src / cpp / foo . bar ' , ' test / core / foo . bar ' ] , <nl> - [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _CPP_TEST_SUITE . labels and label not in <nl> - filter_pull_request_tests . _CORE_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / cpp / foo . bar ' , " src / csharp / foo . bar " ] , <nl> - [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _CPP_TEST_SUITE . labels and label not in <nl> - filter_pull_request_tests . _CSHARP_TEST_SUITE . labels ] ) <nl> - self . test_filtering ( [ ' src / objective - c / foo . bar ' , ' src / php / foo . bar ' , " src / python / foo . bar " , " src / ruby / foo . bar " ] , <nl> - [ label for label in _LIST_OF_LANGUAGE_LABELS if label not in <nl> - filter_pull_request_tests . _OBJC_TEST_SUITE . labels and label not in <nl> - filter_pull_request_tests . _PHP_TEST_SUITE . labels and label not in <nl> - filter_pull_request_tests . _PYTHON_TEST_SUITE . labels and label not in <nl> - filter_pull_request_tests . _RUBY_TEST_SUITE . labels ] ) <nl> - <nl> - def test_platform_filter ( self ) : <nl> - self . test_filtering ( [ ' vsprojects / foo . bar ' ] , [ label for label in _LIST_OF_PLATFORM_LABELS if label not in <nl> - filter_pull_request_tests . _WINDOWS_TEST_SUITE . labels ] ) <nl> - <nl> - def test_whitelist ( self ) : <nl> - whitelist = filter_pull_request_tests . _WHITELIST_DICT <nl> - files_that_should_trigger_all_tests = [ ' src / core / foo . bar ' , <nl> - ' some_file_not_on_the_white_list ' , <nl> - ' BUILD ' , <nl> - ' etc / roots . pem ' , <nl> - ' Makefile ' , <nl> - ' tools / foo ' ] <nl> - for key in whitelist . keys ( ) : <nl> - for file_name in files_that_should_trigger_all_tests : <nl> - self . assertFalse ( re . match ( key , file_name ) ) <nl> + all_jobs = self . generate_all_tests ( ) <nl> + <nl> + # Replacing _get_changed_files function to allow specifying changed files in filter_tests function <nl> + def _get_changed_files ( foo ) : <nl> + return changed_files <nl> + <nl> + filter_pull_request_tests . _get_changed_files = _get_changed_files <nl> + print ( ) <nl> + filtered_jobs = filter_pull_request_tests . filter_tests ( all_jobs , " test " ) <nl> + <nl> + # Make sure sanity tests aren ' t being filtered out <nl> + sanity_tests_in_all_jobs = 0 <nl> + sanity_tests_in_filtered_jobs = 0 <nl> + for job in all_jobs : <nl> + if " sanity " in job . labels : <nl> + sanity_tests_in_all_jobs + = 1 <nl> + all_jobs = [ job for job in all_jobs if " sanity " not in job . labels ] <nl> + for job in filtered_jobs : <nl> + if " sanity " in job . labels : <nl> + sanity_tests_in_filtered_jobs + = 1 <nl> + filtered_jobs = [ <nl> + job for job in filtered_jobs if " sanity " not in job . labels <nl> + ] <nl> + self . assertEquals ( sanity_tests_in_all_jobs , <nl> + sanity_tests_in_filtered_jobs ) <nl> + <nl> + for label in labels : <nl> + for job in filtered_jobs : <nl> + self . assertNotIn ( label , job . labels ) <nl> + <nl> + jobs_matching_labels = 0 <nl> + for label in labels : <nl> + for job in all_jobs : <nl> + if ( label in job . labels ) : <nl> + jobs_matching_labels + = 1 <nl> + self . assertEquals ( <nl> + len ( filtered_jobs ) , len ( all_jobs ) - jobs_matching_labels ) <nl> + <nl> + def test_individual_language_filters ( self ) : <nl> + # Changing unlisted file should trigger all languages <nl> + self . test_filtering ( [ ' ffffoo / bar . baz ' ] , [ _LIST_OF_LANGUAGE_LABELS ] ) <nl> + # Changing core should trigger all tests <nl> + self . test_filtering ( [ ' src / core / foo . bar ' ] , [ _LIST_OF_LANGUAGE_LABELS ] ) <nl> + # Testing individual languages <nl> + self . test_filtering ( [ ' test / core / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _CORE_TEST_SUITE . labels + <nl> + filter_pull_request_tests . _CPP_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ ' src / cpp / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _CPP_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ ' src / csharp / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _CSHARP_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ ' src / objective - c / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _OBJC_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ ' src / php / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _PHP_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ ' src / python / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _PYTHON_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ ' src / ruby / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _RUBY_TEST_SUITE . labels <nl> + ] ) <nl> + <nl> + def test_combined_language_filters ( self ) : <nl> + self . test_filtering ( [ ' src / cpp / foo . bar ' , ' test / core / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _CPP_TEST_SUITE . labels and <nl> + label not in filter_pull_request_tests . _CORE_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ ' src / cpp / foo . bar ' , " src / csharp / foo . bar " ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _CPP_TEST_SUITE . labels and <nl> + label not in filter_pull_request_tests . _CSHARP_TEST_SUITE . labels <nl> + ] ) <nl> + self . test_filtering ( [ <nl> + ' src / objective - c / foo . bar ' , ' src / php / foo . bar ' , " src / python / foo . bar " , <nl> + " src / ruby / foo . bar " <nl> + ] , [ <nl> + label for label in _LIST_OF_LANGUAGE_LABELS <nl> + if label not in filter_pull_request_tests . _OBJC_TEST_SUITE . labels <nl> + and label not in filter_pull_request_tests . _PHP_TEST_SUITE . labels <nl> + and label not in filter_pull_request_tests . _PYTHON_TEST_SUITE . labels <nl> + and label not in filter_pull_request_tests . _RUBY_TEST_SUITE . labels <nl> + ] ) <nl> + <nl> + def test_platform_filter ( self ) : <nl> + self . test_filtering ( [ ' vsprojects / foo . bar ' ] , [ <nl> + label for label in _LIST_OF_PLATFORM_LABELS <nl> + if label not in filter_pull_request_tests . _WINDOWS_TEST_SUITE . labels <nl> + ] ) <nl> + <nl> + def test_whitelist ( self ) : <nl> + whitelist = filter_pull_request_tests . _WHITELIST_DICT <nl> + files_that_should_trigger_all_tests = [ <nl> + ' src / core / foo . bar ' , ' some_file_not_on_the_white_list ' , ' BUILD ' , <nl> + ' etc / roots . pem ' , ' Makefile ' , ' tools / foo ' <nl> + ] <nl> + for key in whitelist . keys ( ) : <nl> + for file_name in files_that_should_trigger_all_tests : <nl> + self . assertFalse ( re . match ( key , file_name ) ) <nl> + <nl> <nl> if __name__ = = ' __main__ ' : <nl> - unittest . main ( verbosity = 2 ) <nl> + unittest . main ( verbosity = 2 ) <nl> mmm a / tools / run_tests / sanity / check_tracer_sanity . py <nl> ppp b / tools / run_tests / sanity / check_tracer_sanity . py <nl> <nl> tracers = [ ] <nl> pattern = re . compile ( " GRPC_TRACER_INITIALIZER \ ( ( true | false ) , \ " ( . * ) \ " \ ) " ) <nl> for root , dirs , files in os . walk ( ' src / core ' ) : <nl> - for filename in files : <nl> - path = os . path . join ( root , filename ) <nl> - if os . path . splitext ( path ) [ 1 ] ! = ' . c ' : continue <nl> - with open ( path ) as f : <nl> - text = f . read ( ) <nl> - for o in pattern . findall ( text ) : <nl> - tracers . append ( o [ 1 ] ) <nl> + for filename in files : <nl> + path = os . path . join ( root , filename ) <nl> + if os . path . splitext ( path ) [ 1 ] ! = ' . c ' : continue <nl> + with open ( path ) as f : <nl> + text = f . read ( ) <nl> + for o in pattern . findall ( text ) : <nl> + tracers . append ( o [ 1 ] ) <nl> <nl> with open ( ' doc / environment_variables . md ' ) as f : <nl> - text = f . read ( ) <nl> + text = f . read ( ) <nl> <nl> for t in tracers : <nl> if t not in text : <nl> - print ( " ERROR : tracer \ " % s \ " is not mentioned in doc / environment_variables . md " % t ) <nl> + print ( <nl> + " ERROR : tracer \ " % s \ " is not mentioned in doc / environment_variables . md " <nl> + % t ) <nl> errors + = 1 <nl> <nl> - <nl> assert errors = = 0 <nl> mmm a / tools / run_tests / sanity / check_version . py <nl> ppp b / tools / run_tests / sanity / check_version . py <nl> <nl> from expand_version import Version <nl> <nl> try : <nl> - branch_name = subprocess . check_output ( <nl> - ' git rev - parse - - abbrev - ref HEAD ' , <nl> - shell = True ) <nl> + branch_name = subprocess . check_output ( <nl> + ' git rev - parse - - abbrev - ref HEAD ' , shell = True ) <nl> except : <nl> - print ( ' WARNING : not a git repository ' ) <nl> - branch_name = None <nl> + print ( ' WARNING : not a git repository ' ) <nl> + branch_name = None <nl> <nl> if branch_name is not None : <nl> - m = re . match ( r ' ^ release - ( [ 0 - 9 ] + ) _ ( [ 0 - 9 ] + ) $ ' , branch_name ) <nl> - if m : <nl> - print ( ' RELEASE branch ' ) <nl> - # version number should align with the branched version <nl> - check_version = lambda version : ( <nl> - version . major = = int ( m . group ( 1 ) ) and <nl> - version . minor = = int ( m . group ( 2 ) ) ) <nl> - warning = ' Version key " % % s " value " % % s " should have a major version % s and minor version % s ' % ( m . group ( 1 ) , m . group ( 2 ) ) <nl> - elif re . match ( r ' ^ debian / . * $ ' , branch_name ) : <nl> - # no additional version checks for debian branches <nl> - check_version = lambda version : True <nl> - else : <nl> - # all other branches should have a - dev tag <nl> - check_version = lambda version : version . tag = = ' dev ' <nl> - warning = ' Version key " % s " value " % s " should have a - dev tag ' <nl> + m = re . match ( r ' ^ release - ( [ 0 - 9 ] + ) _ ( [ 0 - 9 ] + ) $ ' , branch_name ) <nl> + if m : <nl> + print ( ' RELEASE branch ' ) <nl> + # version number should align with the branched version <nl> + check_version = lambda version : ( <nl> + version . major = = int ( m . group ( 1 ) ) and <nl> + version . minor = = int ( m . group ( 2 ) ) ) <nl> + warning = ' Version key " % % s " value " % % s " should have a major version % s and minor version % s ' % ( <nl> + m . group ( 1 ) , m . group ( 2 ) ) <nl> + elif re . match ( r ' ^ debian / . * $ ' , branch_name ) : <nl> + # no additional version checks for debian branches <nl> + check_version = lambda version : True <nl> + else : <nl> + # all other branches should have a - dev tag <nl> + check_version = lambda version : version . tag = = ' dev ' <nl> + warning = ' Version key " % s " value " % s " should have a - dev tag ' <nl> else : <nl> - check_version = lambda version : True <nl> + check_version = lambda version : True <nl> <nl> with open ( ' build . yaml ' , ' r ' ) as f : <nl> - build_yaml = yaml . load ( f . read ( ) ) <nl> + build_yaml = yaml . load ( f . read ( ) ) <nl> <nl> settings = build_yaml [ ' settings ' ] <nl> <nl> top_version = Version ( settings [ ' version ' ] ) <nl> if not check_version ( top_version ) : <nl> - errors + = 1 <nl> - print ( warning % ( ' version ' , top_version ) ) <nl> + errors + = 1 <nl> + print ( warning % ( ' version ' , top_version ) ) <nl> <nl> for tag , value in settings . iteritems ( ) : <nl> - if re . match ( r ' ^ [ a - z ] + _version $ ' , tag ) : <nl> - value = Version ( value ) <nl> - if tag ! = ' core_version ' : <nl> - if value . major ! = top_version . major : <nl> - errors + = 1 <nl> - print ( ' major version mismatch on % s : % d vs % d ' % ( tag , value . major , <nl> - top_version . major ) ) <nl> - if value . minor ! = top_version . minor : <nl> - errors + = 1 <nl> - print ( ' minor version mismatch on % s : % d vs % d ' % ( tag , value . minor , <nl> - top_version . minor ) ) <nl> - if not check_version ( value ) : <nl> - errors + = 1 <nl> - print ( warning % ( tag , value ) ) <nl> + if re . match ( r ' ^ [ a - z ] + _version $ ' , tag ) : <nl> + value = Version ( value ) <nl> + if tag ! = ' core_version ' : <nl> + if value . major ! = top_version . major : <nl> + errors + = 1 <nl> + print ( ' major version mismatch on % s : % d vs % d ' % <nl> + ( tag , value . major , top_version . major ) ) <nl> + if value . minor ! = top_version . minor : <nl> + errors + = 1 <nl> + print ( ' minor version mismatch on % s : % d vs % d ' % <nl> + ( tag , value . minor , top_version . minor ) ) <nl> + if not check_version ( value ) : <nl> + errors + = 1 <nl> + print ( warning % ( tag , value ) ) <nl> <nl> sys . exit ( errors ) <nl> mmm a / tools / run_tests / sanity / core_banned_functions . py <nl> ppp b / tools / run_tests / sanity / core_banned_functions . py <nl> <nl> ' grpc_wsa_error ( ' : [ ' src / core / lib / iomgr / error . c ' ] , <nl> ' grpc_log_if_error ( ' : [ ' src / core / lib / iomgr / error . c ' ] , <nl> ' grpc_slice_malloc ( ' : [ ' src / core / lib / slice / slice . c ' ] , <nl> - ' grpc_closure_create ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> - ' grpc_closure_init ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> - ' grpc_closure_sched ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> - ' grpc_closure_run ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> - ' grpc_closure_list_sched ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> - ' gpr_getenv_silent ( ' : [ ' src / core / lib / support / log . c ' , ' src / core / lib / support / env_linux . c ' , <nl> - ' src / core / lib / support / env_posix . c ' , ' src / core / lib / support / env_windows . c ' ] , <nl> + ' grpc_closure_create ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> + ' grpc_closure_init ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> + ' grpc_closure_sched ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> + ' grpc_closure_run ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> + ' grpc_closure_list_sched ( ' : [ ' src / core / lib / iomgr / closure . c ' ] , <nl> + ' gpr_getenv_silent ( ' : [ <nl> + ' src / core / lib / support / log . c ' , ' src / core / lib / support / env_linux . c ' , <nl> + ' src / core / lib / support / env_posix . c ' , ' src / core / lib / support / env_windows . c ' <nl> + ] , <nl> } <nl> <nl> errors = 0 <nl> for root , dirs , files in os . walk ( ' src / core ' ) : <nl> - for filename in files : <nl> - path = os . path . join ( root , filename ) <nl> - if os . path . splitext ( path ) [ 1 ] ! = ' . c ' : continue <nl> - with open ( path ) as f : <nl> - text = f . read ( ) <nl> - for banned , exceptions in BANNED_EXCEPT . items ( ) : <nl> - if path in exceptions : continue <nl> - if banned in text : <nl> - print ( ' Illegal use of " % s " in % s ' % ( banned , path ) ) <nl> - errors + = 1 <nl> + for filename in files : <nl> + path = os . path . join ( root , filename ) <nl> + if os . path . splitext ( path ) [ 1 ] ! = ' . c ' : continue <nl> + with open ( path ) as f : <nl> + text = f . read ( ) <nl> + for banned , exceptions in BANNED_EXCEPT . items ( ) : <nl> + if path in exceptions : continue <nl> + if banned in text : <nl> + print ( ' Illegal use of " % s " in % s ' % ( banned , path ) ) <nl> + errors + = 1 <nl> <nl> assert errors = = 0 <nl>
yapf tools / run_tests / sanity
grpc/grpc
0cd6cfefa0a21ccf8dc28d623c03f3425e9ed72b
2017-12-12T00:56:44Z
mmm a / cmake / Dependencies . cmake <nl> ppp b / cmake / Dependencies . cmake <nl> if ( BUILD_python ) <nl> # Find the matching boost python implementation <nl> set ( version $ { PYTHONLIBS_VERSION_STRING } ) <nl> <nl> - STRING ( REPLACE " . " " " boost_py_version $ { version } ) <nl> + STRING ( REGEX REPLACE " [ ^ 0 - 9 ] " " " boost_py_version $ { version } ) <nl> find_package ( Boost 1 . 46 COMPONENTS " python - py $ { boost_py_version } " ) <nl> set ( Boost_PYTHON_FOUND $ { Boost_PYTHON - PY $ { boost_py_version } _FOUND } ) <nl> <nl> while ( NOT " $ { version } " STREQUAL " " AND NOT Boost_PYTHON_FOUND ) <nl> STRING ( REGEX REPLACE " ( [ 0 - 9 . ] + ) . [ 0 - 9 ] + " " \ \ 1 " version $ { version } ) <nl> <nl> - STRING ( REPLACE " . " " " boost_py_version $ { version } ) <nl> + STRING ( REGEX REPLACE " [ ^ 0 - 9 ] " " " boost_py_version $ { version } ) <nl> find_package ( Boost 1 . 46 COMPONENTS " python - py $ { boost_py_version } " ) <nl> set ( Boost_PYTHON_FOUND $ { Boost_PYTHON - PY $ { boost_py_version } _FOUND } ) <nl> <nl>
CMake python version fix
BVLC/caffe
672f30ece38b41c0133d83501882551c53610885
2016-01-06T15:23:35Z
mmm a / buildscripts / generate_resmoke_suites . py <nl> ppp b / buildscripts / generate_resmoke_suites . py <nl> def get_config_options ( cmd_line_options , config_file ) : <nl> " " " <nl> config_file_data = read_config . read_config_file ( config_file ) <nl> <nl> - fallback_num_sub_suites = read_config . get_config_value ( " fallback_num_sub_suites " , <nl> - cmd_line_options , config_file_data , <nl> - required = True ) <nl> + fallback_num_sub_suites = read_config . get_config_value ( <nl> + " fallback_num_sub_suites " , cmd_line_options , config_file_data , required = True ) <nl> max_sub_suites = read_config . get_config_value ( " max_sub_suites " , cmd_line_options , <nl> config_file_data ) <nl> project = read_config . get_config_value ( " project " , cmd_line_options , config_file_data , <nl>
SERVER - 38509 fix lint
mongodb/mongo
ecfd09e147562d7e4403ad5065ea386a15c0b294
2018-12-13T23:41:47Z
mmm a / php7_wrapper . h <nl> ppp b / php7_wrapper . h <nl> inline int sw_zend_hash_find ( HashTable * ht , char * k , int len , void * * v ) ; <nl> # define SW_RETURN_STRINGL RETURN_STRINGL <nl> # define sw_zend_register_internal_class_ex zend_register_internal_class_ex <nl> # define sw_zend_call_method_with_2_params zend_call_method_with_2_params <nl> - # define zend_size_t int <nl> + typedef int zend_size_t ; <nl> <nl> # define SWOOLE_GET_SERVER ( zobject , serv ) zval * zserv ; \ <nl> if ( sw_zend_hash_find ( Z_OBJPROP_P ( zobject ) , ZEND_STRS ( " _server " ) , ( void * * ) & zserv ) = = FAILURE ) { \ <nl> inline int sw_zend_hash_find ( HashTable * ht , char * k , int len , void * * v ) ; <nl> RETURN_FALSE ; } \ <nl> ZEND_FETCH_RESOURCE ( process , swWorker * , & zprocess , - 1 , SW_RES_PROCESS_NAME , le_swoole_process ) ; <nl> <nl> - # define WRAPPER_ZEND_HASH_FOREACH_VAL ( ht , entry ) \ <nl> + # define SW_HASHTABLE_FOREACH_START ( ht , entry ) \ <nl> zval * * tmp = NULL ; \ <nl> for ( zend_hash_internal_pointer_reset ( ht ) ; \ <nl> zend_hash_has_more_elements ( ht ) = = SUCCESS ; \ <nl> inline int sw_zend_hash_find ( HashTable * ht , char * k , int len , void * * v ) ; <nl> continue ; \ <nl> } \ <nl> entry = * tmp ; <nl> - # define WRAPPER_ZEND_HASH_FOREACH_END ( ) } <nl> + # define SW_HASHTABLE_FOREACH_END ( ) } <nl> # define sw_zend_read_property zend_read_property <nl> # define wrapper_zend_hash_get_current_key ( a , b , c , d ) zend_hash_get_current_key_ex ( a , b , c , d , 0 , NULL ) <nl> # define sw_php_var_serialize ( a , b , c ) php_var_serialize ( a , & b , c ) <nl> inline int SW_Z_TYPE_P ( zval * z ) ; <nl> # define SW_Z_TYPE_PP ( z ) SW_Z_TYPE_P ( * z ) <nl> # else <nl> # define sw_php_var_serialize php_var_serialize <nl> - # define zend_size_t size_t <nl> + typedef size_t zend_size_t ; <nl> # define SW_RETVAL_STRINGL ( s , l , dup ) RETVAL_STRINGL ( s , l ) <nl> # define ZEND_SET_SYMBOL ( ht , str , arr ) zend_hash_str_update ( ht , str , sizeof ( str ) - 1 , arr ) ; <nl> inline int Z_BVAL_P ( zval * v ) ; <nl> # define sw_add_assoc_stringl ( __arg , __key , __str , __length , __duplicate ) sw_add_assoc_stringl_ex ( __arg , __key , strlen ( __key ) + 1 , __str , __length , __duplicate ) <nl> inline int sw_add_assoc_stringl_ex ( zval * arg , const char * key , size_t key_len , char * str , size_t length , int duplicate ) ; <nl> # define SW_Z_ARRVAL_P ( z ) Z_ARRVAL_P ( z ) - > ht <nl> - # define WRAPPER_ZEND_HASH_FOREACH_VAL ( ht , entry ) ZEND_HASH_FOREACH_VAL ( ht , entry ) { <nl> - # define WRAPPER_ZEND_HASH_FOREACH_END ( ) } ZEND_HASH_FOREACH_END ( ) ; <nl> + <nl> + # define SW_HASHTABLE_FOREACH_START ( ht , entry ) ZEND_HASH_FOREACH_VAL ( ht , entry ) { <nl> + # define SW_HASHTABLE_FOREACH_END ( ) } ZEND_HASH_FOREACH_END ( ) ; <nl> + <nl> # define Z_ARRVAL_PP ( s ) Z_ARRVAL_P ( * s ) <nl> # define SW_Z_TYPE_P Z_TYPE_P <nl> # define SW_Z_TYPE_PP ( s ) SW_Z_TYPE_P ( * s ) <nl> php_var_unserialize ( * rval , p , max , var_hash ) <nl> # define SW_ZVAL_STRING ( z , s , dup ) ZVAL_STRING ( z , s ) <nl> # define sw_smart_str smart_string <nl> <nl> - inline zval * sw_zend_read_property ( zend_class_entry * class_ptr , zval * obj , char * s , int len , int what ) ; <nl> + inline zval * sw_zend_read_property ( zend_class_entry * class_ptr , zval * obj , char * s , int len , int what ) ; <nl> inline int sw_zend_is_callable ( zval * cv , int a , char * * name ) ; <nl> inline int sw_zend_hash_del ( HashTable * ht , char * k , int len ) ; <nl> inline int sw_zend_hash_add ( HashTable * ht , char * k , int len , void * pData , int datasize , void * * pDest ) ; <nl> inline int sw_zend_hash_index_update ( HashTable * ht , int key , void * pData , int datasize , void * * pDest ) ; <nl> inline int sw_zend_hash_update ( HashTable * ht , char * k , int len , void * val , int size , void * ptr ) ; <nl> - inline int wrapper_zend_hash_get_current_key ( HashTable * ht , char * * key , uint * idx , ulong * num ) ; <nl> + inline int sw_zend_hash_get_current_key ( HashTable * ht , char * * key , uint32_t * idx , ulong * num ) ; <nl> inline int sw_zend_hash_find ( HashTable * ht , char * k , int len , void * * v ) ; <nl> inline int sw_zend_hash_exists ( HashTable * ht , char * k , int len ) ; <nl> # endif <nl> mmm a / swoole_async . c <nl> ppp b / swoole_async . c <nl> PHP_FUNCTION ( swoole_async_write ) <nl> zval * filename ; <nl> <nl> char * fcnt ; <nl> - int fcnt_len = 0 ; <nl> + zend_size_t fcnt_len = 0 ; <nl> int fd ; <nl> off_t offset = - 1 ; <nl> <nl> PHP_FUNCTION ( swoole_async_writefile ) <nl> zval * cb = NULL ; <nl> zval * filename ; <nl> char * fcnt ; <nl> - int fcnt_len ; <nl> + zend_size_t fcnt_len ; <nl> <nl> # ifdef HAVE_LINUX_NATIVE_AIO <nl> int open_flag = O_CREAT | O_WRONLY | O_DIRECT ; <nl> mmm a / swoole_buffer . c <nl> ppp b / swoole_buffer . c <nl> static PHP_METHOD ( swoole_buffer , write ) <nl> { <nl> long offset ; <nl> char * new_str ; <nl> - int length ; <nl> + zend_size_t length ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ls " , & offset , & new_str , & length ) = = FAILURE ) <nl> { <nl> mmm a / swoole_client . c <nl> ppp b / swoole_client . c <nl> static PHP_METHOD ( swoole_client , close ) <nl> static PHP_METHOD ( swoole_client , on ) <nl> { <nl> char * cb_name ; <nl> - int i , cb_name_len ; <nl> + zend_size_t cb_name_len ; <nl> zval * zcallback ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sz " , & cb_name , & cb_name_len , & zcallback ) = = FAILURE ) <nl> static PHP_METHOD ( swoole_client , on ) <nl> <nl> sw_zval_add_ref ( & zcallback ) ; <nl> <nl> + int i ; <nl> for ( i = 0 ; i < PHP_CLIENT_CALLBACK_NUM ; i + + ) <nl> { <nl> if ( strncasecmp ( php_sw_callbacks [ i ] + 2 , cb_name , cb_name_len ) = = 0 ) <nl> static int client_event_loop ( zval * sock_array , fd_set * fds TSRMLS_DC ) <nl> char * key = NULL ; <nl> int num = 0 ; <nl> ulong num_key = 0 ; <nl> - uint key_len = 0 ; <nl> + uint32_t key_len = 0 ; <nl> <nl> if ( SW_Z_TYPE_P ( sock_array ) ! = IS_ARRAY ) <nl> { <nl> static int client_event_loop ( zval * sock_array , fd_set * fds TSRMLS_DC ) <nl> } <nl> ALLOC_HASHTABLE ( new_hash ) ; <nl> zend_hash_init ( new_hash , zend_hash_num_elements ( Z_ARRVAL_P ( sock_array ) ) , NULL , ZVAL_PTR_DTOR , 0 ) ; <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( sock_array ) , * element ) <nl> - ce = Z_OBJCE_P ( * element ) ; <nl> - zsock = sw_zend_read_property ( ce , * element , SW_STRL ( " sock " ) - 1 , 0 TSRMLS_CC ) ; <nl> - if ( zsock = = NULL | | ZVAL_IS_NULL ( zsock ) ) <nl> - { <nl> - php_error_docref ( NULL TSRMLS_CC , E_WARNING , " object is not swoole_client object . " ) ; <nl> - continue ; <nl> - } <nl> - if ( ( Z_LVAL ( * zsock ) < FD_SETSIZE ) & & FD_ISSET ( Z_LVAL ( * zsock ) , fds ) ) <nl> - { <nl> - switch ( wrapper_zend_hash_get_current_key ( Z_ARRVAL_P ( sock_array ) , & key , & key_len , & num_key ) ) <nl> - { <nl> - case HASH_KEY_IS_STRING : <nl> - sw_zend_hash_add ( new_hash , key , key_len , ( void * ) element , sizeof ( zval * ) , ( void * * ) & dest_element ) ; <nl> - break ; <nl> - case HASH_KEY_IS_LONG : <nl> - sw_zend_hash_index_update ( new_hash , num_key , ( void * ) element , sizeof ( zval * ) , ( void * * ) & dest_element ) ; <nl> - break ; <nl> - } <nl> - if ( dest_element ) <nl> - { <nl> - sw_zval_add_ref ( dest_element ) ; <nl> - } <nl> - } <nl> - num + + ; <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( sock_array ) , * element ) <nl> + ce = Z_OBJCE_P ( * element ) ; <nl> + zsock = sw_zend_read_property ( ce , * element , SW_STRL ( " sock " ) - 1 , 0 TSRMLS_CC ) ; <nl> + if ( zsock = = NULL | | ZVAL_IS_NULL ( zsock ) ) <nl> + { <nl> + php_error_docref ( NULL TSRMLS_CC , E_WARNING , " object is not swoole_client object . " ) ; <nl> + continue ; <nl> + } <nl> + if ( ( Z_LVAL ( * zsock ) < FD_SETSIZE ) & & FD_ISSET ( Z_LVAL ( * zsock ) , fds ) ) <nl> + { <nl> + switch ( sw_zend_hash_get_current_key ( Z_ARRVAL_P ( sock_array ) , & key , & key_len , & num_key ) ) <nl> + { <nl> + case HASH_KEY_IS_STRING : <nl> + sw_zend_hash_add ( new_hash , key , key_len , ( void * ) element , sizeof ( zval * ) , ( void * * ) & dest_element ) ; <nl> + break ; <nl> + case HASH_KEY_IS_LONG : <nl> + sw_zend_hash_index_update ( new_hash , num_key , ( void * ) element , sizeof ( zval * ) , ( void * * ) & dest_element ) ; <nl> + break ; <nl> + } <nl> + if ( dest_element ) <nl> + { <nl> + sw_zval_add_ref ( dest_element ) ; <nl> + } <nl> + } <nl> + num + + ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> <nl> zend_hash_destroy ( Z_ARRVAL_P ( sock_array ) ) ; <nl> efree ( Z_ARRVAL_P ( sock_array ) ) ; <nl> static int client_event_add ( zval * sock_array , fd_set * fds , int * max_fd TSRMLS_DC <nl> { <nl> return 0 ; <nl> } <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( sock_array ) , * element ) <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( sock_array ) , * element ) <nl> ce = Z_OBJCE_P ( * element ) ; <nl> zsock = sw_zend_read_property ( ce , * element , SW_STRL ( " sock " ) - 1 , 0 TSRMLS_CC ) ; <nl> if ( zsock = = NULL | | ZVAL_IS_NULL ( zsock ) ) <nl> static int client_event_add ( zval * sock_array , fd_set * fds , int * max_fd TSRMLS_DC <nl> * max_fd = Z_LVAL ( * zsock ) ; <nl> } <nl> num + + ; <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> return num ? 1 : 0 ; <nl> } <nl> mmm a / swoole_event . c <nl> ppp b / swoole_event . c <nl> PHP_FUNCTION ( swoole_event_write ) <nl> { <nl> zval * * fd ; <nl> char * data ; <nl> - int len ; <nl> + zend_size_t len ; <nl> <nl> if ( ! SwooleG . main_reactor ) <nl> { <nl> mmm a / swoole_http . c <nl> ppp b / swoole_http . c <nl> static void http_global_merge ( zval * val , zval * zrequest , int type ) <nl> zval * server = sw_zend_read_property ( swoole_http_request_class_entry_ptr , zrequest , ZEND_STRL ( " server " ) , 1 TSRMLS_CC ) ; <nl> if ( server | | ! ZVAL_IS_NULL ( server ) ) <nl> { <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( server ) , value ) <nl> - keytype = wrapper_zend_hash_get_current_key ( Z_ARRVAL_P ( server ) , & key , & keylen , & idx ) ; <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( server ) , value ) <nl> + keytype = sw_zend_hash_get_current_key ( Z_ARRVAL_P ( server ) , & key , & keylen , & idx ) ; <nl> if ( HASH_KEY_IS_STRING ! = keytype ) <nl> { <nl> continue ; <nl> static void http_global_merge ( zval * val , zval * zrequest , int type ) <nl> php_strtoupper ( _php_key , keylen ) ; <nl> convert_to_string ( value ) ; <nl> sw_add_assoc_stringl_ex ( php_global_server , _php_key , keylen , Z_STRVAL_P ( value ) , Z_STRLEN_P ( value ) , 1 ) ; <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> } <nl> <nl> zval * header = sw_zend_read_property ( swoole_http_request_class_entry_ptr , zrequest , ZEND_STRL ( " header " ) , 1 TSRMLS_CC ) ; <nl> if ( header | | ! ZVAL_IS_NULL ( header ) ) <nl> { <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( header ) , value ) <nl> - keytype = wrapper_zend_hash_get_current_key ( Z_ARRVAL_P ( header ) , & key , & keylen , & idx ) ; <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( header ) , value ) <nl> + keytype = sw_zend_hash_get_current_key ( Z_ARRVAL_P ( header ) , & key , & keylen , & idx ) ; <nl> if ( HASH_KEY_IS_STRING ! = keytype ) <nl> { <nl> continue ; <nl> static void http_global_merge ( zval * val , zval * zrequest , int type ) <nl> php_strtoupper ( _php_key , keylen ) ; <nl> convert_to_string ( value ) ; <nl> sw_add_assoc_stringl_ex ( php_global_server , _php_key , keylen , Z_STRVAL_P ( value ) , Z_STRLEN_P ( value ) , 1 ) ; <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> } <nl> ZEND_SET_SYMBOL ( & EG ( symbol_table ) , " _SERVER " , php_global_server ) ; <nl> return ; <nl> void swoole_http_request_free ( swoole_http_client * client TSRMLS_DC ) <nl> zval * value ; <nl> char * key ; <nl> int keytype ; <nl> - uint idx ; <nl> + uint32_t keylen ; <nl> <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( zfiles ) , value ) <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( zfiles ) , value ) <nl> { <nl> - keytype = wrapper_zend_hash_get_current_key ( Z_ARRVAL_P ( zfiles ) , & key , & idx , 0 ) ; <nl> + keytype = sw_zend_hash_get_current_key ( Z_ARRVAL_P ( zfiles ) , & key , & keylen , 0 ) ; <nl> <nl> if ( HASH_KEY_IS_STRING ! = keytype ) <nl> { <nl> void swoole_http_request_free ( swoole_http_client * client TSRMLS_DC ) <nl> unlink ( Z_STRVAL_P ( file_path ) ) ; <nl> } sw_zval_ptr_dtor ( & value ) ; <nl> } <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> <nl> sw_zval_ptr_dtor ( & zfiles ) ; <nl> } <nl> void swoole_http_request_free ( swoole_http_client * client TSRMLS_DC ) <nl> if ( client - > response . zcookie ) <nl> { <nl> sw_zval_ptr_dtor ( & client - > response . zcookie ) ; <nl> + client - > response . zcookie = NULL ; <nl> } <nl> if ( client - > response . zheader ) <nl> { <nl> sw_zval_ptr_dtor ( & client - > response . zheader ) ; <nl> + client - > response . zheader = NULL ; <nl> } <nl> sw_zval_ptr_dtor ( & client - > response . zresponse_object ) ; <nl> client - > response . zresponse_object = NULL ; <nl> static void http_build_header ( swoole_http_client * client , zval * object , swString <nl> <nl> HashTable * ht = Z_ARRVAL_P ( header ) ; <nl> zval * value = NULL ; <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( ht , value ) <nl> - char * key ; <nl> - uint keylen ; <nl> - ulong idx ; <nl> - int type ; <nl> - <nl> - type = wrapper_zend_hash_get_current_key ( ht , & key , & keylen , & idx ) ; <nl> - if ( type = = HASH_KEY_IS_LONG ) <nl> + char * key = NULL ; <nl> + uint32_t keylen = 0 ; <nl> + ulong idx = 0 ; <nl> + int type ; <nl> + <nl> + SW_HASHTABLE_FOREACH_START ( ht , value ) <nl> + { <nl> + type = sw_zend_hash_get_current_key ( ht , & key , & keylen , & idx ) ; <nl> + if ( type ! = HASH_KEY_IS_STRING ) <nl> { <nl> continue ; <nl> } <nl> + if ( ! key ) <nl> + { <nl> + break ; <nl> + } <nl> if ( strcmp ( key , key_server ) = = 0 ) <nl> { <nl> flag | = HTTP_RESPONSE_SERVER ; <nl> static void http_build_header ( swoole_http_client * client , zval * object , swString <nl> } <nl> n = snprintf ( buf , sizeof ( buf ) , " % * s : % * s \ r \ n " , keylen - 1 , key , Z_STRLEN_P ( value ) , Z_STRVAL_P ( value ) ) ; <nl> swString_append_ptr ( response , buf , n ) ; <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + } <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> <nl> if ( ! ( flag & HTTP_RESPONSE_SERVER ) ) <nl> { <nl> static PHP_METHOD ( swoole_http_response , cookie ) <nl> long expires = 0 ; <nl> int encode = 1 ; <nl> zend_bool secure = 0 , httponly = 0 ; <nl> - int name_len , value_len = 0 , path_len = 0 , domain_len = 0 ; <nl> + zend_size_t name_len , value_len = 0 , path_len = 0 , domain_len = 0 ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s | slssbb " , & name , & name_len , & value , & value_len , & expires , <nl> & path , & path_len , & domain , & domain_len , & secure , & httponly ) = = FAILURE ) <nl> static PHP_METHOD ( swoole_http_response , rawcookie ) <nl> long expires = 0 ; <nl> int encode = 0 ; <nl> zend_bool secure = 0 , httponly = 0 ; <nl> - int name_len , value_len = 0 , path_len = 0 , domain_len = 0 ; <nl> + zend_size_t name_len , value_len = 0 , path_len = 0 , domain_len = 0 ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s | slssbb " , & name , & name_len , & value , & value_len , & expires , <nl> & path , & path_len , & domain , & domain_len , & secure , & httponly ) = = FAILURE ) <nl> static PHP_METHOD ( swoole_http_response , status ) <nl> static PHP_METHOD ( swoole_http_response , header ) <nl> { <nl> char * k , * v ; <nl> - int klen , vlen ; <nl> + zend_size_t klen , vlen ; <nl> + <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ss " , & k , & klen , & v , & vlen ) = = FAILURE ) <nl> { <nl> return ; <nl> static PHP_METHOD ( swoole_http_response , header ) <nl> { <nl> http_alloc_zval ( client , response , zheader ) ; <nl> array_init ( zheader ) ; <nl> - zend_update_property ( swoole_http_request_class_entry_ptr , getThis ( ) , ZEND_STRL ( " header " ) , zheader TSRMLS_CC ) ; <nl> + zend_update_property ( swoole_http_response_class_entry_ptr , getThis ( ) , ZEND_STRL ( " header " ) , zheader TSRMLS_CC ) ; <nl> } <nl> sw_add_assoc_stringl_ex ( zheader , k , klen + 1 , v , vlen , 1 ) ; <nl> } <nl> mmm a / swoole_lock . c <nl> ppp b / swoole_lock . c <nl> PHP_METHOD ( swoole_lock , __construct ) <nl> { <nl> long type = SW_MUTEX ; <nl> char * filelock ; <nl> - int filelock_len = 0 ; <nl> + zend_size_t filelock_len = 0 ; <nl> int ret ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " | ls " , & type , & filelock , & filelock_len ) = = FAILURE ) <nl> mmm a / swoole_phpng . c <nl> ppp b / swoole_phpng . c <nl> inline int sw_zend_hash_update ( HashTable * ht , char * k , int len , void * val , int <nl> return zend_hash_update ( ht , Z_STR ( key ) , val ) ? SUCCESS : FAILURE ; <nl> } <nl> <nl> - inline int wrapper_zend_hash_get_current_key ( HashTable * ht , char * * key , uint * idx , ulong * num ) { <nl> + inline int sw_zend_hash_get_current_key ( HashTable * ht , char * * key , uint32_t * keylen , ulong * num ) <nl> + { <nl> zval str_key ; <nl> - ZVAL_STRING ( & str_key , * key ) ; <nl> - int type = zend_hash_get_current_key ( ht , & Z_STR ( str_key ) , ( zend_ulong * ) num ) ; <nl> - * key = Z_STR ( str_key ) - > val ; <nl> + int type = zend_hash_get_current_key ( ht , & Z_STR ( str_key ) , ( zend_ulong * ) num ) ; <nl> + * key = Z_STRVAL ( str_key ) ; <nl> + * keylen = Z_STRLEN ( str_key ) ; <nl> return type ; <nl> } <nl> <nl> + inline int sw_zend_hash_exists ( HashTable * ht , char * k , int len ) <nl> + { <nl> + zval key ; <nl> + ZVAL_STRING ( & key , k ) ; <nl> + zval * value = zend_hash_find ( ht , Z_STR ( key ) ) ; <nl> <nl> - <nl> - inline int sw_zend_hash_exists ( HashTable * ht , char * k , int len ) { <nl> - zval key ; <nl> - ZVAL_STRING ( & key , k ) ; <nl> - <nl> - zval * value = zend_hash_find ( ht , Z_STR ( key ) ) ; <nl> - <nl> - if ( value = = NULL ) { <nl> - return FAILURE ; <nl> - } else { <nl> - return SUCCESS ; <nl> - } <nl> + if ( value = = NULL ) <nl> + { <nl> + return FAILURE ; <nl> + } <nl> + else <nl> + { <nl> + return SUCCESS ; <nl> + } <nl> } <nl> # else <nl> - inline int SW_Z_TYPE_P ( zval * z ) { <nl> - if ( Z_TYPE_P ( z ) = = IS_BOOL ) { <nl> - if ( ( uint8_t ) Z_BVAL_P ( z ) = = 1 ) { <nl> - return IS_TRUE ; <nl> - } else { <nl> - return 0 ; <nl> - } <nl> - } else { <nl> - return Z_TYPE_P ( z ) ; <nl> + inline int SW_Z_TYPE_P ( zval * z ) <nl> + { <nl> + if ( Z_TYPE_P ( z ) = = IS_BOOL ) <nl> + { <nl> + if ( ( uint8_t ) Z_BVAL_P ( z ) = = 1 ) <nl> + { <nl> + return IS_TRUE ; <nl> + } <nl> + else <nl> + { <nl> + return 0 ; <nl> } <nl> + } <nl> + else <nl> + { <nl> + return Z_TYPE_P ( z ) ; <nl> + } <nl> } <nl> # endif <nl> inline int sw_zend_hash_find ( HashTable * ht , char * k , int len , void * * v ) <nl> mmm a / swoole_process . c <nl> ppp b / swoole_process . c <nl> static PHP_METHOD ( swoole_process , read ) <nl> static PHP_METHOD ( swoole_process , write ) <nl> { <nl> char * data = NULL ; <nl> - int data_len = 0 ; <nl> + zend_size_t data_len = 0 ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & data , & data_len ) = = FAILURE ) <nl> { <nl> static PHP_METHOD ( swoole_process , write ) <nl> static PHP_METHOD ( swoole_process , push ) <nl> { <nl> char * data ; <nl> - int length ; <nl> + zend_size_t length ; <nl> <nl> struct <nl> { <nl> static PHP_METHOD ( swoole_process , pop ) <nl> static PHP_METHOD ( swoole_process , exec ) <nl> { <nl> char * execfile = NULL ; <nl> - int execfile_len = 0 ; <nl> + zend_size_t execfile_len = 0 ; <nl> zval * args ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sa " , & execfile , & execfile_len , & args ) = = FAILURE ) <nl> static PHP_METHOD ( swoole_process , exec ) <nl> / / _p = _p - > pListNext ; <nl> / / i + + ; <nl> / / } <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( args ) , value ) <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( args ) , value ) <nl> convert_to_string ( value ) ; <nl> <nl> sw_zval_add_ref ( & value ) ; <nl> exec_args [ i ] = Z_STRVAL_P ( value ) ; <nl> i + + ; <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> exec_args [ i ] = NULL ; <nl> <nl> if ( execv ( execfile , exec_args ) < 0 ) <nl> mmm a / swoole_server . c <nl> ppp b / swoole_server . c <nl> PHP_FUNCTION ( swoole_server_set ) <nl> for ( i = 0 ; i < SW_CPU_NUM ; i + + ) <nl> { <nl> flag = 1 ; <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( v ) , zval_core ) <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( v ) , zval_core ) <nl> int core = ( int ) Z_LVAL_P ( zval_core ) ; <nl> if ( i = = core ) <nl> { <nl> flag = 0 ; <nl> break ; <nl> } <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> if ( flag ) <nl> { <nl> available_cpu [ available_i ] = i ; <nl> PHP_FUNCTION ( swoole_server_handler ) <nl> { <nl> zval * zobject = getThis ( ) ; <nl> char * ha_name = NULL ; <nl> - int len , i ; <nl> + zend_size_t len ; <nl> + int i ; <nl> int ret = - 1 ; <nl> <nl> zval * cb ; <nl> PHP_METHOD ( swoole_server , sendto ) <nl> { <nl> zval * zobject = getThis ( ) ; <nl> <nl> + char * ip ; <nl> char * data ; <nl> - int len ; <nl> + zend_size_t len , ip_len ; <nl> <nl> - char * ip ; <nl> - char * ip_len ; <nl> long port ; <nl> long sock = - 1 ; <nl> zend_bool ipv6 = 0 ; <nl> PHP_METHOD ( swoole_server , sendto ) <nl> PHP_FUNCTION ( swoole_server_sendfile ) <nl> { <nl> zval * zobject = getThis ( ) ; <nl> - <nl> + zend_size_t len ; <nl> swSendData send_data ; <nl> <nl> char buffer [ SW_BUFFER_SIZE ] ; <nl> PHP_FUNCTION ( swoole_server_sendfile ) <nl> <nl> if ( zobject = = NULL ) <nl> { <nl> - if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " Ols " , & zobject , swoole_server_class_entry_ptr , & conn_fd , & filename , & send_data . info . len ) = = FAILURE ) <nl> + if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " Ols " , & zobject , swoole_server_class_entry_ptr , & conn_fd , & filename , & len ) = = FAILURE ) <nl> { <nl> return ; <nl> } <nl> PHP_FUNCTION ( swoole_server_sendfile ) <nl> php_error_docref ( NULL TSRMLS_CC , E_WARNING , " invalid fd [ % ld ] error . " , conn_fd ) ; <nl> RETURN_FALSE ; <nl> } <nl> - <nl> + send_data . info . len = len ; <nl> / / file name size <nl> if ( send_data . info . len > SW_BUFFER_SIZE - 1 ) <nl> { <nl> PHP_FUNCTION ( swoole_server_sendfile ) <nl> PHP_FUNCTION ( swoole_server_close ) <nl> { <nl> zval * zobject = getThis ( ) ; <nl> - <nl> zval * zfd ; <nl> <nl> if ( SwooleGS - > start = = 0 ) <nl> PHP_METHOD ( swoole_server , sendmessage ) <nl> zval * zobject = getThis ( ) ; <nl> swEventData buf ; <nl> <nl> - <nl> char * msg ; <nl> - int msglen ; <nl> + zend_size_t msglen ; <nl> long worker_id = - 1 ; <nl> <nl> if ( SwooleGS - > start = = 0 ) <nl> mmm a / swoole_table . c <nl> ppp b / swoole_table . c <nl> PHP_METHOD ( swoole_table , __destruct ) <nl> PHP_METHOD ( swoole_table , column ) <nl> { <nl> char * name ; <nl> - int len ; <nl> + zend_size_t len ; <nl> long type ; <nl> long size ; <nl> <nl> static PHP_METHOD ( swoole_table , set ) <nl> { <nl> zval * array ; <nl> char * key ; <nl> - int keylen ; <nl> + zend_size_t keylen ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " sa " , & key , & keylen , & array ) = = FAILURE ) <nl> { <nl> static PHP_METHOD ( swoole_table , set ) <nl> swTableColumn * col ; <nl> zval * v ; <nl> char * k ; <nl> - uint klen ; <nl> + uint32_t klen ; <nl> ulong knum ; <nl> <nl> sw_atomic_t * lock = & row - > lock ; <nl> sw_spinlock ( lock ) ; <nl> <nl> - WRAPPER_ZEND_HASH_FOREACH_VAL ( Z_ARRVAL_P ( array ) , v ) <nl> - wrapper_zend_hash_get_current_key ( Z_ARRVAL_P ( array ) , & k , & klen , & knum ) ; <nl> + SW_HASHTABLE_FOREACH_START ( Z_ARRVAL_P ( array ) , v ) <nl> + sw_zend_hash_get_current_key ( Z_ARRVAL_P ( array ) , & k , & klen , & knum ) ; <nl> col = swTableColumn_get ( table , k , klen - 1 ) ; <nl> if ( col = = NULL ) <nl> { <nl> static PHP_METHOD ( swoole_table , set ) <nl> convert_to_long ( v ) ; <nl> swTableRow_set_value ( row , col , & Z_LVAL_P ( v ) , 0 ) ; <nl> } <nl> - WRAPPER_ZEND_HASH_FOREACH_END ( ) ; <nl> + SW_HASHTABLE_FOREACH_END ( ) ; <nl> <nl> sw_spinlock_release ( lock ) ; <nl> <nl> static PHP_METHOD ( swoole_table , set ) <nl> static PHP_METHOD ( swoole_table , incr ) <nl> { <nl> char * key ; <nl> - int key_len ; <nl> + zend_size_t key_len ; <nl> char * col ; <nl> - int col_len ; <nl> + zend_size_t col_len ; <nl> zval * incrby = NULL ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ss | z " , & key , & key_len , & col , & col_len , & incrby ) = = FAILURE ) <nl> static PHP_METHOD ( swoole_table , incr ) <nl> static PHP_METHOD ( swoole_table , decr ) <nl> { <nl> char * key ; <nl> - int key_len ; <nl> + zend_size_t key_len ; <nl> char * col ; <nl> - int col_len ; <nl> + zend_size_t col_len ; <nl> zval * decrby = NULL ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " ss | z " , & key , & key_len , & col , & col_len , & decrby ) = = FAILURE ) <nl> static PHP_METHOD ( swoole_table , decr ) <nl> static PHP_METHOD ( swoole_table , get ) <nl> { <nl> char * key ; <nl> - int keylen ; <nl> + zend_size_t keylen ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & key , & keylen ) = = FAILURE ) <nl> { <nl> static PHP_METHOD ( swoole_table , get ) <nl> static PHP_METHOD ( swoole_table , exist ) <nl> { <nl> char * key ; <nl> - int keylen ; <nl> + zend_size_t keylen ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & key , & keylen ) = = FAILURE ) <nl> { <nl> static PHP_METHOD ( swoole_table , exist ) <nl> static PHP_METHOD ( swoole_table , del ) <nl> { <nl> char * key ; <nl> - int keylen ; <nl> + zend_size_t keylen ; <nl> <nl> if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , " s " , & key , & keylen ) = = FAILURE ) <nl> { <nl> static PHP_METHOD ( swoole_table , count ) <nl> <nl> static PHP_METHOD ( swoole_table , rewind ) <nl> { <nl> - if ( zend_parse_parameters_none ( ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> swTable * table = swoole_get_object ( getThis ( ) ) ; <nl> swTable_iterator_rewind ( table ) ; <nl> } <nl> <nl> static PHP_METHOD ( swoole_table , current ) <nl> { <nl> - if ( zend_parse_parameters_none ( ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> swTable * table = swoole_get_object ( getThis ( ) ) ; <nl> swTableRow * row = swTable_iterator_current ( table ) ; <nl> php_swoole_table_row2array ( table , row , return_value ) ; <nl> static PHP_METHOD ( swoole_table , current ) <nl> <nl> static PHP_METHOD ( swoole_table , key ) <nl> { <nl> - if ( zend_parse_parameters_none ( ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> swTable * table = swoole_get_object ( getThis ( ) ) ; <nl> swTableRow * row = swTable_iterator_current ( table ) ; <nl> RETURN_LONG ( row - > crc32 ) ; <nl> static PHP_METHOD ( swoole_table , key ) <nl> <nl> static PHP_METHOD ( swoole_table , next ) <nl> { <nl> - if ( zend_parse_parameters_none ( ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> swTable * table = swoole_get_object ( getThis ( ) ) ; <nl> swTable_iterator_forward ( table ) ; <nl> } <nl> <nl> static PHP_METHOD ( swoole_table , valid ) <nl> { <nl> - if ( zend_parse_parameters_none ( ) = = FAILURE ) <nl> - { <nl> - return ; <nl> - } <nl> - <nl> swTable * table = swoole_get_object ( getThis ( ) ) ; <nl> swTableRow * row = swTable_iterator_current ( table ) ; <nl> RETURN_BOOL ( row ! = NULL ) ; <nl>
fixed core dump with php7 .
swoole/swoole-src
41b99d01604faf5e2b08abf574c7b50a4d8c8eef
2015-06-23T09:10:01Z
mmm a / stdlib / public / core / FixedPoint . swift . gyb <nl> ppp b / stdlib / public / core / FixedPoint . swift . gyb <nl> public protocol _SignedIntegerType : _IntegerType , SignedNumberType { <nl> public protocol SignedIntegerType : _SignedIntegerType , IntegerType { <nl> } <nl> <nl> - / / / A set of common requirements for Swift ' s unsigned integer types . <nl> - public protocol UnsignedIntegerType : _IntegerType , IntegerType { <nl> + / / / This protocol is an implementation detail of ` SignedIntegerType ` ; <nl> + / / / do not use it directly . <nl> + / / / <nl> + / / / Its requirements are inherited by ` SignedIntegerType ` and thus <nl> + / / / must be satisfied by types conforming to that protocol . <nl> + public protocol _UnsignedIntegerType : _IntegerType { <nl> / / Used to create a deliberate ambiguity in cases like UInt ( 1 ) + <nl> / / Int ( 1 ) , which would otherwise compile due to the arithmetic <nl> / / operators defined for Strideable types ( unsigned types are <nl> public protocol UnsignedIntegerType : _IntegerType , IntegerType { <nl> init ( UIntMax ) <nl> } <nl> <nl> + / / / A set of common requirements for Swift ' s unsigned integer types . <nl> + public protocol UnsignedIntegerType : _UnsignedIntegerType , IntegerType { <nl> + } <nl> + <nl> / / / Convert ` x ` to type ` U ` , trapping on overflow in - Onone and - O <nl> / / / builds . <nl> / / / <nl> public func numericCast < <nl> / / / func f ( x : UInt32 ) { } <nl> / / / func g ( x : UInt64 ) { f ( numericCast ( x ) ) } <nl> public func numericCast < <nl> - T : UnsignedIntegerType , U : UnsignedIntegerType <nl> + T : _UnsignedIntegerType , U : _UnsignedIntegerType <nl> > ( x : T ) - > U { <nl> return U ( x . toUIntMax ( ) ) <nl> } <nl> public func numericCast < <nl> / / / func f ( x : UInt32 ) { } <nl> / / / func g ( x : Int64 ) { f ( numericCast ( x ) ) } <nl> public func numericCast < <nl> - T : _SignedIntegerType , U : UnsignedIntegerType <nl> + T : _SignedIntegerType , U : _UnsignedIntegerType <nl> > ( x : T ) - > U { <nl> return U ( UIntMax ( x . toIntMax ( ) ) ) <nl> } <nl> public func numericCast < <nl> / / / func f ( x : Int32 ) { } <nl> / / / func g ( x : UInt64 ) { f ( numericCast ( x ) ) } <nl> public func numericCast < <nl> - T : UnsignedIntegerType , U : _SignedIntegerType <nl> + T : _UnsignedIntegerType , U : _SignedIntegerType <nl> > ( x : T ) - > U { <nl> return U ( IntMax ( x . toUIntMax ( ) ) ) <nl> } <nl> mmm a / stdlib / public / core / Stride . swift <nl> ppp b / stdlib / public / core / Stride . swift <nl> public func - = < T : Strideable > ( inout lhs : T , rhs : T . Stride ) { <nl> / / overloads , expressions such as UInt ( 2 ) + Int ( 3 ) would compile . / / <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - public func + < T : UnsignedIntegerType > ( lhs : T , rhs : T . _DisallowMixedSignArithmetic ) - > T { <nl> + public func + < T : _UnsignedIntegerType > ( lhs : T , rhs : T . _DisallowMixedSignArithmetic ) - > T { <nl> _sanityCheckFailure ( " Should not be callable . " ) <nl> } <nl> <nl> - public func + < T : UnsignedIntegerType > ( lhs : T . _DisallowMixedSignArithmetic , rhs : T ) - > T { <nl> + public func + < T : _UnsignedIntegerType > ( lhs : T . _DisallowMixedSignArithmetic , rhs : T ) - > T { <nl> _sanityCheckFailure ( " Should not be callable . " ) <nl> } <nl> <nl> - public func - < T : UnsignedIntegerType > ( lhs : T , rhs : T . _DisallowMixedSignArithmetic ) - > T { <nl> + public func - < T : _UnsignedIntegerType > ( lhs : T , rhs : T . _DisallowMixedSignArithmetic ) - > T { <nl> _sanityCheckFailure ( " Should not be callable . " ) <nl> } <nl> <nl> - public func - < T : UnsignedIntegerType > ( lhs : T , rhs : T ) - > T . _DisallowMixedSignArithmetic { <nl> + public func - < T : _UnsignedIntegerType > ( lhs : T , rhs : T ) - > T . _DisallowMixedSignArithmetic { <nl> _sanityCheckFailure ( " Should not be callable . " ) <nl> } <nl> <nl> - public func + = < T : UnsignedIntegerType > ( inout lhs : T , rhs : T . _DisallowMixedSignArithmetic ) { <nl> + public func + = < T : _UnsignedIntegerType > ( inout lhs : T , rhs : T . _DisallowMixedSignArithmetic ) { <nl> _sanityCheckFailure ( " Should not be callable . " ) <nl> } <nl> <nl> - public func - = < T : UnsignedIntegerType > ( inout lhs : T , rhs : T . _DisallowMixedSignArithmetic ) { <nl> + public func - = < T : _UnsignedIntegerType > ( inout lhs : T , rhs : T . _DisallowMixedSignArithmetic ) { <nl> _sanityCheckFailure ( " Should not be callable . " ) <nl> } <nl> <nl> mmm a / stdlib / public / core / StringLegacy . swift <nl> ppp b / stdlib / public / core / StringLegacy . swift <nl> extension String { <nl> } <nl> <nl> / / / Create an instance representing ` v ` in base 10 . <nl> - public init < T : UnsignedIntegerType > ( _ v : T ) { <nl> + public init < T : _UnsignedIntegerType > ( _ v : T ) { <nl> self = _uint64ToString ( v . toUIntMax ( ) ) <nl> } <nl> <nl> extension String { <nl> / / / <nl> / / / Numerals greater than 9 are represented as roman letters , <nl> / / / starting with ` a ` if ` uppercase ` is ` false ` or ` A ` otherwise . <nl> - public init < T : UnsignedIntegerType > ( <nl> + public init < T : _UnsignedIntegerType > ( <nl> _ v : T , radix : Int , uppercase : Bool = false <nl> ) { <nl> _precondition ( radix > 1 , " Radix must be greater than 1 " ) <nl>
Revert " [ stdlib ] Kill _UnsignedIntegerType "
apple/swift
bc1500d50cf873436f2e4f646a72a9a1f48e3df4
2015-05-23T21:54:58Z
mmm a / caffe2 / onnx / onnx_exporter . cc <nl> ppp b / caffe2 / onnx / onnx_exporter . cc <nl> <nl> # include " caffe2 / proto / caffe2_legacy . pb . h " <nl> # include " caffe2 / utils / map_utils . h " <nl> # include " caffe2 / utils / proto_utils . h " <nl> + # include " caffe2 / utils / string_utils . h " <nl> <nl> # include < numeric > <nl> # include < unordered_set > <nl> : : ONNX_NAMESPACE : : TensorProto : : DataType Caffe2TypeToOnnxType ( <nl> # undef CAFFE2_TO_ONNX_TYPE <nl> } <nl> <nl> + void collectExternalsFromIfOpSubnet ( <nl> + const NetDef * net , <nl> + std : : vector < std : : string > * input , <nl> + std : : vector < std : : string > * output ) { <nl> + std : : set < std : : string > in_input , in_output ; <nl> + for ( const auto & op : net - > op ( ) ) { <nl> + for ( const auto & blob : op . input ( ) ) { <nl> + in_input . emplace ( blob ) ; <nl> + } <nl> + for ( const auto & blob : op . output ( ) ) { <nl> + in_output . emplace ( blob ) ; <nl> + } <nl> + } <nl> + <nl> + for ( const auto & blob : in_input ) { <nl> + if ( ! in_output . count ( blob ) ) { <nl> + input - > push_back ( blob ) ; <nl> + } <nl> + } <nl> + for ( const auto & blob : in_output ) { <nl> + if ( ! in_input . count ( blob ) ) { <nl> + output - > push_back ( blob ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + void rewriteSubnet ( <nl> + Argument * arg , <nl> + std : : map < std : : string , std : : string > oldname_to_newname ) { <nl> + NetDef * net = arg - > mutable_n ( ) ; <nl> + for ( auto & op : * ( net - > mutable_op ( ) ) ) { <nl> + for ( auto & input : * ( op . mutable_input ( ) ) ) { <nl> + if ( oldname_to_newname . find ( input ) ! = oldname_to_newname . end ( ) ) { <nl> + input = oldname_to_newname [ input ] ; <nl> + } <nl> + } <nl> + for ( auto & output : * ( op . mutable_output ( ) ) ) { <nl> + if ( oldname_to_newname . find ( output ) ! = oldname_to_newname . end ( ) ) { <nl> + output = oldname_to_newname [ output ] ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + Argument * getArgumentFromName ( OperatorDef * op , const std : : string & name ) { <nl> + for ( int i = 0 ; i < op - > arg_size ( ) ; i + + ) { <nl> + if ( op - > mutable_arg ( i ) - > name ( ) = = name ) { <nl> + return op - > mutable_arg ( i ) ; <nl> + } <nl> + } <nl> + return nullptr ; <nl> + } <nl> + <nl> + void ssaRewriteForIfOp ( <nl> + OperatorDef * op , <nl> + std : : unordered_map < std : : string , int > * blob_versions , <nl> + std : : set < std : : string > * is_initialized_tensor ) { <nl> + / / Get all the " external " inputs and outpus of the subnet <nl> + / / Since then_net and else_net has same external input / output , we only collect <nl> + / / external input / output from one of its subnet And perform the rewrite to <nl> + / / both then_net and else_net <nl> + std : : vector < std : : string > if_external_input ; <nl> + std : : vector < std : : string > if_external_output ; <nl> + ArgumentHelper helper ( * op ) ; <nl> + Argument * then_arg = nullptr , * else_arg = nullptr ; <nl> + NetDef * target_net = nullptr ; <nl> + bool has_then = false , has_else = false ; <nl> + <nl> + if ( helper . HasSingleArgumentOfType < NetDef > ( " then_net " ) ) { <nl> + then_arg = getArgumentFromName ( op , " then_net " ) ; <nl> + target_net = then_arg - > mutable_n ( ) ; <nl> + has_then = true ; <nl> + } <nl> + if ( helper . HasSingleArgumentOfType < NetDef > ( " else_net " ) ) { <nl> + else_arg = getArgumentFromName ( op , " else_net " ) ; <nl> + if ( ! has_then ) { <nl> + target_net = else_arg - > mutable_n ( ) ; <nl> + } <nl> + has_else = true ; <nl> + } <nl> + <nl> + if ( has_then | | has_else ) { <nl> + collectExternalsFromIfOpSubnet ( <nl> + target_net , & if_external_input , & if_external_output ) ; <nl> + std : : map < string , string > oldname_to_newname ; <nl> + <nl> + / / Build oldname_to_newname map <nl> + for ( auto & input : if_external_input ) { <nl> + const auto it = blob_versions - > find ( input ) ; <nl> + if ( it ! = blob_versions - > end ( ) ) { <nl> + oldname_to_newname [ input ] = SsaName ( input , it - > second ) ; <nl> + } <nl> + } <nl> + for ( auto & output : if_external_output ) { <nl> + auto it = blob_versions - > find ( output ) ; <nl> + if ( it ! = blob_versions - > end ( ) ) { <nl> + if ( is_initialized_tensor - > count ( output ) = = 0 ) { <nl> + it - > second + = 1 ; <nl> + } else { <nl> + is_initialized_tensor - > erase ( output ) ; <nl> + } <nl> + oldname_to_newname [ output ] = SsaName ( output , it - > second ) ; <nl> + } else { <nl> + blob_versions - > emplace ( output , 0 ) ; <nl> + oldname_to_newname [ output ] = SsaName ( output , 0 ) ; <nl> + } <nl> + } <nl> + <nl> + if ( has_then ) { <nl> + rewriteSubnet ( then_arg , oldname_to_newname ) ; <nl> + } <nl> + if ( has_else ) { <nl> + rewriteSubnet ( else_arg , oldname_to_newname ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> std : : unordered_map < std : : string , std : : string > SsaRewrite ( <nl> caffe2 : : NetDef * init_net , <nl> caffe2 : : NetDef * pred_net ) { <nl> std : : unordered_map < std : : string , std : : string > SsaRewrite ( <nl> blob_versions . clear ( ) ; <nl> } <nl> <nl> + std : : set < std : : string > is_initialized_tensor ; <nl> if ( pred_net ) { <nl> std : : unordered_set < std : : string > external_outputs ; <nl> for ( const auto & input : pred_net - > external_input ( ) ) { <nl> std : : unordered_map < std : : string , std : : string > SsaRewrite ( <nl> continue ; <nl> } <nl> } <nl> + / / Special SSA Rewrite for subnet of If Operator <nl> + if ( op . type ( ) = = " If " ) { <nl> + ssaRewriteForIfOp ( & op , & blob_versions , & is_initialized_tensor ) ; <nl> + } <nl> for ( auto & output : * op . mutable_output ( ) ) { <nl> auto it = blob_versions . find ( output ) ; <nl> if ( it ! = blob_versions . end ( ) ) { <nl> - it - > second + = 1 ; <nl> + if ( op . type ( ) ! = " If " ) { <nl> + if ( is_initialized_tensor . count ( output ) = = 0 ) { <nl> + it - > second + = 1 ; <nl> + } else { <nl> + is_initialized_tensor . erase ( output ) ; <nl> + } <nl> + } <nl> output = SsaName ( output , it - > second ) ; <nl> + <nl> } else { <nl> blob_versions . emplace ( output , 0 ) ; <nl> + / / These filling ops are designed for a by - default value for the <nl> + / / tensors generated by ops like If . For example , if an If op ' s <nl> + / / condition is not satisfied , and it does not have else_net , then it <nl> + / / will not generate any output blob , which may cause some error in <nl> + / / the future . Here we would like to ensure these tensors only been <nl> + / / ssa re - write once but not twice . ( One in the filling operator , one <nl> + / / in If op ) <nl> + if ( ( caffe2 : : StartsWith ( op . type ( ) , " GivenTensor " ) & & <nl> + caffe2 : : EndsWith ( op . type ( ) , " Fill " ) ) | | <nl> + op . type ( ) = = " ConstantFill " | | <nl> + op . type ( ) = = " Int8GivenTensorFill " | | <nl> + op . type ( ) = = " Int8GivenIntTensorFill " ) { <nl> + is_initialized_tensor . insert ( output ) ; <nl> + } <nl> output = SsaName ( output , 0 ) ; <nl> } <nl> } <nl> mmm a / caffe2 / opt / onnxifi_transformer . cc <nl> ppp b / caffe2 / opt / onnxifi_transformer . cc <nl> void getWeightsAndInputs ( <nl> } <nl> } <nl> <nl> - void unrollIfOps ( NetDef * net ) { <nl> + void collectInputsAndOutputs ( <nl> + const OperatorDef & op , <nl> + std : : set < std : : string > * inputs , <nl> + std : : set < std : : string > * outputs ) { <nl> + for ( const auto & blob : op . input ( ) ) { <nl> + inputs - > emplace ( blob ) ; <nl> + } <nl> + for ( const auto & blob : op . output ( ) ) { <nl> + outputs - > emplace ( blob ) ; <nl> + } <nl> + } <nl> + <nl> + void fetchInputsToIfOpsSubnet ( NetDef * net ) { <nl> NetDef clone ( * net ) ; <nl> clone . clear_op ( ) ; <nl> - for ( const auto & op : net - > op ( ) ) { <nl> + for ( auto & op : net - > op ( ) ) { <nl> if ( op . type ( ) = = " If " ) { <nl> + OperatorDef new_op ( op ) ; <nl> ArgumentHelper helper ( op ) ; <nl> + std : : set < std : : string > subnet_inputs , subnet_outputs ; <nl> if ( helper . HasSingleArgumentOfType < NetDef > ( " then_net " ) ) { <nl> auto then_net = helper . GetSingleArgument < NetDef > ( " then_net " , NetDef ( ) ) ; <nl> for ( const auto & nested_op : then_net . op ( ) ) { <nl> - clone . add_op ( ) - > CopyFrom ( nested_op ) ; <nl> + collectInputsAndOutputs ( nested_op , & subnet_inputs , & subnet_outputs ) ; <nl> } <nl> } <nl> if ( helper . HasSingleArgumentOfType < NetDef > ( " else_net " ) ) { <nl> auto else_net = helper . GetSingleArgument < NetDef > ( " else_net " , NetDef ( ) ) ; <nl> for ( const auto & nested_op : else_net . op ( ) ) { <nl> - clone . add_op ( ) - > CopyFrom ( nested_op ) ; <nl> + collectInputsAndOutputs ( nested_op , & subnet_inputs , & subnet_outputs ) ; <nl> + } <nl> + } <nl> + for ( const std : : string & blob : subnet_inputs ) { <nl> + if ( subnet_outputs . count ( blob ) = = 0 ) { <nl> + new_op . add_input ( blob ) ; <nl> } <nl> } <nl> + clone . add_op ( ) - > CopyFrom ( new_op ) ; <nl> } else { <nl> clone . add_op ( ) - > CopyFrom ( op ) ; <nl> } <nl> void OnnxifiTransformer : : transform ( <nl> onnxifi_op_id_ = 0 ; <nl> <nl> / / Unroll If ops <nl> - unrollIfOps ( pred_net ) ; <nl> + fetchInputsToIfOpsSubnet ( pred_net ) ; <nl> <nl> std : : unordered_set < std : : string > weights ( <nl> weight_names . begin ( ) , weight_names . end ( ) ) ; <nl>
Add if ops support for onnxifi and ssa - rewrite ( )
pytorch/pytorch
2f73b3d26efe9381ae26dad378d06079c025f032
2019-04-24T18:01:13Z
deleted file mode 100644 <nl> index b203ef0812 . . 0000000000 <nl> mmm a / code / data_structures / linked_list / circular_linked_list / CircularLinkedList . scala <nl> ppp / dev / null <nl> <nl> - <nl> - case class CircularLinkedList [ T ] ( data : T , private var next : CircularLinkedList [ T ] , private var prev : CircularLinkedList [ T ] ) { <nl> - def getNext ( ) : CircularLinkedList [ T ] = next <nl> - def getPrev ( ) : CircularLinkedList [ T ] = prev <nl> - <nl> - def apply ( newData : T ) : CircularLinkedList [ T ] = { <nl> - val newNode = CircularLinkedList ( newData , null , null ) <nl> - newNode . prev = newNode <nl> - newNode . next = newNode <nl> - newNode <nl> - } <nl> - <nl> - def append ( newData : T ) : CircularLinkedList [ T ] = { <nl> - / / this - > newNode - > this . next ( ) <nl> - val newNode = CircularLinkedList ( newData , this . next , this ) <nl> - this . next . prev = newNode <nl> - this . next = newNode <nl> - newNode <nl> - } <nl> - } <nl>
Revert " adding scala doubly linked list "
OpenGenus/cosmos
f62dabc4b449ecb92d24d625c862acbf32e17b70
2017-10-14T17:15:38Z
mmm a / ci / test / 04_install . sh <nl> ppp b / ci / test / 04_install . sh <nl> if [ " $ TRAVIS_OS_NAME " = = " osx " ] ; then <nl> git reset - - hard origin / master <nl> popd | | exit 1 <nl> set - o errexit <nl> + $ { CI_RETRY_EXE } brew unlink python @ 2 <nl> $ { CI_RETRY_EXE } brew update <nl> # brew upgrade returns an error if any of the packages is already up to date <nl> # Failure is safe to ignore , unless we really need an update . <nl>
Merge : ci : Fix brew python link
bitcoin/bitcoin
52900a764c4213f960d2b9c95d54f64753fcfedd
2020-01-02T18:51:33Z
mmm a / filament / src / fg / ResourceAllocator . cpp <nl> ppp b / filament / src / fg / ResourceAllocator . cpp <nl> backend : : TextureHandle ResourceAllocator : : createTexture ( const char * name , <nl> <nl> / / Some WebGL implementations complain about an incomplete framebuffer when the attachment sizes <nl> / / are heterogeneous . This merits further investigation . <nl> - # if defined ( __EMSCRIPTEN__ ) <nl> + # if ! defined ( __EMSCRIPTEN__ ) <nl> if ( ! ( usage & TextureUsage : : SAMPLEABLE ) ) { <nl> / / If this texture is not going to be sampled , we can round its size up <nl> / / this helps prevent many reallocations for small size changes . <nl>
Repair web samples by fixing typo in previous fix .
google/filament
0b7a08a2d83bbd87d80c549d5db61d5707b7a6f6
2019-12-19T02:06:21Z
mmm a / dbms / src / Interpreters / ExpressionAnalyzer . cpp <nl> ppp b / dbms / src / Interpreters / ExpressionAnalyzer . cpp <nl> void ExpressionAnalyzer : : collectUsedColumns ( ) <nl> / / / You need to read at least one column to find the number of rows . <nl> if ( select_query & & required . empty ( ) ) <nl> { <nl> - / / / We will find a column with minimum compressed size . Because it is the column that is cheapest to read . <nl> - size_t min_data_compressed = 0 ; <nl> - String min_column_name ; <nl> + / / / We will find a column with minimum < compressed_size , type_size , uncompressed_size > . <nl> + / / / Because it is the column that is cheapest to read . <nl> + struct ColumnSizeTuple <nl> + { <nl> + size_t compressed_size ; <nl> + size_t type_size ; <nl> + size_t uncompressed_size ; <nl> + String name ; <nl> + bool operator < ( const ColumnSizeTuple & that ) const <nl> + { <nl> + return std : : tie ( compressed_size , type_size , uncompressed_size ) <nl> + < std : : tie ( that . compressed_size , that . type_size , that . uncompressed_size ) ; <nl> + } <nl> + } ; <nl> + std : : vector < ColumnSizeTuple > columns ; <nl> if ( storage ) <nl> { <nl> auto column_sizes = storage - > getColumnSizes ( ) ; <nl> - for ( auto & [ column_name , column_size ] : column_sizes ) <nl> + for ( auto & source_column : source_columns ) <nl> { <nl> - if ( min_data_compressed = = 0 | | min_data_compressed > column_size . data_compressed ) <nl> - { <nl> - min_data_compressed = column_size . data_compressed ; <nl> - min_column_name = column_name ; <nl> - } <nl> + auto c = column_sizes . find ( source_column . name ) ; <nl> + if ( c = = column_sizes . end ( ) ) <nl> + continue ; <nl> + size_t type_size = source_column . type - > haveMaximumSizeOfValue ( ) ? source_column . type - > getMaximumSizeOfValueInMemory ( ) : 100 ; <nl> + columns . emplace_back ( ColumnSizeTuple { c - > second . data_compressed , type_size , c - > second . data_uncompressed , source_column . name } ) ; <nl> } <nl> } <nl> - if ( min_data_compressed > 0 ) <nl> - required . insert ( min_column_name ) ; <nl> + if ( columns . size ( ) ) <nl> + required . insert ( std : : min_element ( columns . begin ( ) , columns . end ( ) ) - > name ) ; <nl> else <nl> / / / If we have no information about columns sizes , choose a column of minimum size of its data type . <nl> required . insert ( ExpressionActions : : getSmallestColumn ( source_columns ) ) ; <nl>
Merge pull request from amosbird / c9
ClickHouse/ClickHouse
9dd9553d73b3dc947525d4aeebeb3c7bbd053b29
2019-08-06T10:55:45Z
mmm a / benchmarks / operator_benchmark / pt / qactivation_test . py <nl> ppp b / benchmarks / operator_benchmark / pt / qactivation_test . py <nl> <nl> <nl> qactivation_ops = op_bench . op_list ( <nl> attrs = ( <nl> - ( ' relu ' , nnq . functional . relu ) , <nl> + ( ' relu ' , torch . nn . ReLU ( ) ) , <nl> ( ' relu6 ' , torch . ops . quantized . relu6 ) , <nl> ( ' functional . hardtanh ' , nnq . functional . hardtanh ) , <nl> ( ' functional . hardsigmoid ' , nnq . functional . hardsigmoid ) , <nl>
[ OpBench ] change relu entry point after D24747035
pytorch/pytorch
0125e14c9a7cdd48f3d9c92447170c02d13ed24e
2020-11-13T23:38:27Z
mmm a / Telegram / SourceFiles / history / history_message . cpp <nl> ppp b / Telegram / SourceFiles / history / history_message . cpp <nl> void HistoryMessageReply : : paint ( Painter & p , const HistoryItem * holder , int x , in <nl> <nl> if ( w > st : : msgReplyBarSkip ) { <nl> if ( replyToMsg ) { <nl> - bool hasPreview = replyToMsg - > getMedia ( ) ? replyToMsg - > getMedia ( ) - > hasReplyPreview ( ) : false ; <nl> - int previewSkip = hasPreview ? ( st : : msgReplyBarSize . height ( ) + st : : msgReplyBarSkip - st : : msgReplyBarSize . width ( ) - st : : msgReplyBarPos . x ( ) ) : 0 ; <nl> + auto hasPreview = replyToMsg - > getMedia ( ) ? replyToMsg - > getMedia ( ) - > hasReplyPreview ( ) : false ; <nl> + if ( hasPreview & & w < st : : msgReplyBarSkip + st : : msgReplyBarSize . height ( ) ) { <nl> + hasPreview = false ; <nl> + } <nl> + auto previewSkip = hasPreview ? ( st : : msgReplyBarSize . height ( ) + st : : msgReplyBarSkip - st : : msgReplyBarSize . width ( ) - st : : msgReplyBarPos . x ( ) ) : 0 ; <nl> <nl> if ( hasPreview ) { <nl> ImagePtr replyPreview = replyToMsg - > getMedia ( ) - > replyPreview ( ) ; <nl>
Don ' t display reply preview if it doesn ' t fit .
telegramdesktop/tdesktop
7c6bb132ce7d1298391cc87c5a3a071e8222b407
2017-07-18T16:47:56Z
mmm a / tensorflow / contrib / data / python / ops / readers . py <nl> ppp b / tensorflow / contrib / data / python / ops / readers . py <nl> def _infer_column_names ( filenames , field_delim , use_quote_delim ) : <nl> " quoting " : csv . QUOTE_MINIMAL if use_quote_delim else csv . QUOTE_NONE <nl> } <nl> with file_io . FileIO ( filenames [ 0 ] , " r " ) as f : <nl> - column_names = next ( csv . reader ( f , * * csv_kwargs ) ) <nl> + try : <nl> + column_names = next ( csv . reader ( f , * * csv_kwargs ) ) <nl> + except StopIteration : <nl> + raise ValueError ( ( " Received StopIteration when reading the header line " <nl> + " of % s . Empty file ? " ) % filenames [ 0 ] ) <nl> <nl> for name in filenames [ 1 : ] : <nl> with file_io . FileIO ( name , " r " ) as f : <nl> - if next ( csv . reader ( f , * * csv_kwargs ) ) ! = column_names : <nl> - raise ValueError ( " Files have different column names in the header row . " ) <nl> + try : <nl> + if next ( csv . reader ( f , * * csv_kwargs ) ) ! = column_names : <nl> + raise ValueError ( <nl> + " Files have different column names in the header row . " ) <nl> + except StopIteration : <nl> + raise ValueError ( ( " Received StopIteration when reading the header line " <nl> + " of % s . Empty file ? " ) % filenames [ 0 ] ) <nl> return column_names <nl> <nl> <nl>
Improves error messaging for bad ( empty ) CSV files .
tensorflow/tensorflow
f4c6a318eb9eb01440c313a4fc423ac267fdb74e
2018-04-18T20:15:07Z
mmm a / docs / WindowsBuild . md <nl> ppp b / docs / WindowsBuild . md <nl> If you are building a debug version of Swift , you should also install the Python <nl> 4 . Select * Download debug binaries ( requires VS 2015 or later ) * <nl> 5 . Click * Install * <nl> <nl> + # # Enable Developer Mode <nl> + <nl> + From the settings application , go to ` Update & Security ` . In the ` For developers ` tab , select ` Developer Mode ` for ` Use Developer Features ` . This is required to enable the creation of symbolic links . <nl> + <nl> # # Clone the repositories <nl> <nl> 1 . Clone ` apple / llvm - project ` into a directory for the toolchain <nl> md " S : \ b \ toolchain " <nl> cmake - B " S : \ b \ toolchain " ^ <nl> - C S : \ swift - build \ cmake \ caches \ windows - x86_64 . cmake ^ <nl> - C S : \ swift - build \ cmake \ caches \ org . compnerd . dt . cmake ^ <nl> + - D CMAKE_BUILD_TYPE = Release ^ <nl> - D LLVM_ENABLE_ASSERTIONS = YES ^ <nl> - D LLVM_ENABLE_PROJECTS = " clang ; clang - tools - extra ; cmark ; swift ; lldb ; lld " ^ <nl> - D LLVM_EXTERNAL_PROJECTS = " cmark ; swift " ^ <nl>
Update WindowsBuild . md
apple/swift
7a50ad5163db4e74ec0357d8446d293e42d7e79f
2020-04-29T17:05:13Z
mmm a / arangod / Aql / Query . cpp <nl> ppp b / arangod / Aql / Query . cpp <nl> void Query : : registerWarning ( int code , <nl> } <nl> <nl> if ( details = = nullptr ) { <nl> - _warnings . emplace_back ( std : : make_pair ( code , TRI_errno_string ( code ) ) ) ; <nl> + _warnings . emplace_back ( code , TRI_errno_string ( code ) ) ; <nl> } <nl> else { <nl> - _warnings . emplace_back ( std : : make_pair ( code , details ) ) ; <nl> + _warnings . emplace_back ( code , details ) ; <nl> } <nl> } <nl> <nl> mmm a / lib / Basics / Utf8Helper . cpp <nl> ppp b / lib / Basics / Utf8Helper . cpp <nl> bool Utf8Helper : : getWords ( TRI_vector_string_t * & words , <nl> return true ; <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief builds a regex matcher for the specified pattern <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + RegexMatcher * Utf8Helper : : buildMatcher ( std : : string const & pattern ) { <nl> + UErrorCode status = U_ZERO_ERROR ; <nl> + <nl> + std : : unique_ptr < RegexMatcher > matcher ( new RegexMatcher ( UnicodeString : : fromUTF8 ( pattern ) , 0 , status ) ) ; <nl> + if ( U_FAILURE ( status ) ) { <nl> + return nullptr ; <nl> + } <nl> + <nl> + return matcher . release ( ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief whether or not value matches a regex <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + bool Utf8Helper : : matches ( RegexMatcher * matcher , <nl> + std : : string const & value , <nl> + bool & error ) { <nl> + return matches ( matcher , value . c_str ( ) , value . size ( ) , error ) ; <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief whether or not value matches a regex <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + bool Utf8Helper : : matches ( RegexMatcher * matcher , <nl> + char const * value , <nl> + size_t valueLength , <nl> + bool & error ) { <nl> + <nl> + TRI_ASSERT ( value ! = nullptr ) ; <nl> + UnicodeString v = UnicodeString : : fromUTF8 ( value ) ; <nl> + <nl> + matcher - > reset ( v ) ; <nl> + <nl> + UErrorCode status = U_ZERO_ERROR ; <nl> + error = false ; <nl> + <nl> + TRI_ASSERT ( matcher ! = nullptr ) ; <nl> + bool result = matcher - > matches ( status ) ; <nl> + if ( U_FAILURE ( status ) ) { <nl> + error = true ; <nl> + } <nl> + <nl> + return result ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief compare two utf16 strings <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> UChar * TRI_Utf8ToUChar ( TRI_memory_zone_t * zone , <nl> char const * utf8 , <nl> size_t inLength , <nl> size_t * outLength ) { <nl> - UErrorCode status ; <nl> - UChar * utf16 ; <nl> int32_t utf16Length ; <nl> <nl> / / 1 . convert utf8 string to utf16 <nl> / / calculate utf16 string length <nl> - status = U_ZERO_ERROR ; <nl> + UErrorCode status = U_ZERO_ERROR ; <nl> u_strFromUTF8 ( nullptr , 0 , & utf16Length , utf8 , ( int32_t ) inLength , & status ) ; <nl> if ( status ! = U_BUFFER_OVERFLOW_ERROR ) { <nl> return nullptr ; <nl> } <nl> <nl> - utf16 = ( UChar * ) TRI_Allocate ( zone , ( utf16Length + 1 ) * sizeof ( UChar ) , false ) ; <nl> + UChar * utf16 = ( UChar * ) TRI_Allocate ( zone , ( utf16Length + 1 ) * sizeof ( UChar ) , false ) ; <nl> if ( utf16 = = nullptr ) { <nl> return nullptr ; <nl> } <nl> char * TRI_UCharToUtf8 ( TRI_memory_zone_t * zone , <nl> UChar const * uchar , <nl> size_t inLength , <nl> size_t * outLength ) { <nl> - UErrorCode status ; <nl> - char * utf8 ; <nl> int32_t utf8Length ; <nl> <nl> / / calculate utf8 string length <nl> - status = U_ZERO_ERROR ; <nl> + UErrorCode status = U_ZERO_ERROR ; <nl> u_strToUTF8 ( nullptr , 0 , & utf8Length , uchar , ( int32_t ) inLength , & status ) ; <nl> if ( status ! = U_BUFFER_OVERFLOW_ERROR ) { <nl> return nullptr ; <nl> } <nl> <nl> - utf8 = static_cast < char * > ( TRI_Allocate ( zone , ( utf8Length + 1 ) * sizeof ( char ) , false ) ) ; <nl> + char * utf8 = static_cast < char * > ( TRI_Allocate ( zone , ( utf8Length + 1 ) * sizeof ( char ) , false ) ) ; <nl> <nl> if ( utf8 = = nullptr ) { <nl> return nullptr ; <nl> mmm a / lib / Basics / Utf8Helper . h <nl> ppp b / lib / Basics / Utf8Helper . h <nl> <nl> <nl> # include " Basics / Common . h " <nl> # include " Basics / vector . h " <nl> - <nl> - # include " unicode / coll . h " <nl> - # include " unicode / ustring . h " <nl> + # include < unicode / coll . h > <nl> + # include < unicode / regex . h > <nl> + # include < unicode / ustring . h > <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - class Utf8Helper <nl> namespace triagens { <nl> namespace basics { <nl> <nl> class Utf8Helper { <nl> - Utf8Helper ( Utf8Helper const & ) ; <nl> - Utf8Helper & operator = ( Utf8Helper const & ) ; <nl> + Utf8Helper ( Utf8Helper const & ) = delete ; <nl> + Utf8Helper & operator = ( Utf8Helper const & ) = delete ; <nl> <nl> public : <nl> <nl> namespace triagens { <nl> size_t maximalWordLength , <nl> bool lowerCase ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief builds a regex matcher for the specified pattern <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + RegexMatcher * buildMatcher ( std : : string const & ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief whether or not value matches a regex <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + bool matches ( RegexMatcher * , <nl> + std : : string const & , <nl> + bool & ) ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief whether or not value matches a regex <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + bool matches ( RegexMatcher * , <nl> + char const * , <nl> + size_t , <nl> + bool & ) ; <nl> + <nl> private : <nl> + <nl> Collator * _coll ; <nl> } ; <nl> <nl>
added function to create an ICU RegexMatcher
arangodb/arangodb
0f1ce26e41919845141f78315f2efd3214c143d9
2015-08-03T21:57:26Z
mmm a / ports / fmt / CONTROL <nl> ppp b / ports / fmt / CONTROL <nl> <nl> Source : fmt <nl> - Version : 6 . 2 . 0 <nl> + Version : 6 . 2 . 0 - 1 <nl> Homepage : https : / / github . com / fmtlib / fmt <nl> Description : Formatting library for C + + . It can be used as a safe alternative to printf or as a fast alternative to IOStreams . <nl> mmm a / ports / fmt / portfile . cmake <nl> ppp b / ports / fmt / portfile . cmake <nl> endif ( ) <nl> file ( REMOVE_RECURSE $ { CURRENT_PACKAGES_DIR } / debug / include ) <nl> <nl> vcpkg_fixup_cmake_targets ( ) <nl> + vcpkg_fixup_pkgconfig ( ) <nl> <nl> if ( VCPKG_TARGET_IS_WINDOWS ) <nl> if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL " debug " ) <nl>
[ fmt ] add vcpkg_fixup_pkgconfig ( )
microsoft/vcpkg
c5c350086508005af936a185949e910bfda2821d
2020-06-03T05:37:50Z
mmm a / RAW_RELEASE_NOTES . md <nl> ppp b / RAW_RELEASE_NOTES . md <nl> final version . <nl> * Added DOWNSTREAM_LOCAL_ADDRESS , DOWNSTREAM_LOCAL_ADDRESS_WITHOUT_PORT header formatters , and <nl> DOWNSTREAM_LOCAL_ADDRESS access log formatter . <nl> * Added support for HTTPS redirects on specific routes . <nl> + * access log : added less than or equal ( LE ) comparison filter . <nl> + * access log : added configuration to runtime filter to set default sampling rate , divisor , and <nl> + whether to use independent randomness or not . <nl> * Added the ability to pass a URL encoded Pem encoded peer certificate in the x - forwarded - client - cert header . <nl> * Added support for abstract unix domain sockets on linux . The abstract <nl> namespace can be used by prepending ' @ ' to a socket path . <nl> mmm a / bazel / repository_locations . bzl <nl> ppp b / bazel / repository_locations . bzl <nl> REPOSITORY_LOCATIONS = dict ( <nl> urls = [ " https : / / github . com / google / protobuf / archive / v3 . 5 . 0 . tar . gz " ] , <nl> ) , <nl> envoy_api = dict ( <nl> - commit = " 60dc08ddbcc4d10ec48cb55d34a1fdc1bdc72496 " , <nl> + commit = " e9c53c404b0105cd42cb4cf015251e5aa9187cd3 " , <nl> remote = " https : / / github . com / envoyproxy / data - plane - api " , <nl> ) , <nl> grpc_httpjson_transcoding = dict ( <nl> mmm a / include / envoy / runtime / runtime . h <nl> ppp b / include / envoy / runtime / runtime . h <nl> class Snapshot { <nl> * @ param random_value supplies the stable random value to use for determining whether the feature <nl> * is enabled . <nl> * @ param control max number of buckets for sampling . Sampled value will be in a range of <nl> - * [ 0 , num_buckets ) . <nl> + * [ 0 , num_buckets ) . <nl> * @ return true if the feature is enabled . <nl> * / <nl> virtual bool featureEnabled ( const std : : string & key , uint64_t default_value , uint64_t random_value , <nl> - uint16_t num_buckets ) const PURE ; <nl> + uint64_t num_buckets ) const PURE ; <nl> <nl> / * * <nl> * Fetch raw runtime data based on key . <nl> mmm a / source / common / access_log / access_log_impl . cc <nl> ppp b / source / common / access_log / access_log_impl . cc <nl> bool ComparisonFilter : : compareAgainstValue ( uint64_t lhs ) { <nl> return lhs > = value ; <nl> case envoy : : config : : filter : : accesslog : : v2 : : ComparisonFilter : : EQ : <nl> return lhs = = value ; <nl> + case envoy : : config : : filter : : accesslog : : v2 : : ComparisonFilter : : LE : <nl> + return lhs < = value ; <nl> default : <nl> NOT_REACHED ; <nl> } <nl> bool ComparisonFilter : : compareAgainstValue ( uint64_t lhs ) { <nl> <nl> FilterPtr <nl> FilterFactory : : fromProto ( const envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter & config , <nl> - Runtime : : Loader & runtime ) { <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) { <nl> switch ( config . filter_specifier_case ( ) ) { <nl> case envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter : : kStatusCodeFilter : <nl> return FilterPtr { new StatusCodeFilter ( config . status_code_filter ( ) , runtime ) } ; <nl> FilterFactory : : fromProto ( const envoy : : config : : filter : : accesslog : : v2 : : AccessLogFi <nl> case envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter : : kTraceableFilter : <nl> return FilterPtr { new TraceableRequestFilter ( ) } ; <nl> case envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter : : kRuntimeFilter : <nl> - return FilterPtr { new RuntimeFilter ( config . runtime_filter ( ) , runtime ) } ; <nl> + return FilterPtr { new RuntimeFilter ( config . runtime_filter ( ) , runtime , random ) } ; <nl> case envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter : : kAndFilter : <nl> - return FilterPtr { new AndFilter ( config . and_filter ( ) , runtime ) } ; <nl> + return FilterPtr { new AndFilter ( config . and_filter ( ) , runtime , random ) } ; <nl> case envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter : : kOrFilter : <nl> - return FilterPtr { new OrFilter ( config . or_filter ( ) , runtime ) } ; <nl> + return FilterPtr { new OrFilter ( config . or_filter ( ) , runtime , random ) } ; <nl> default : <nl> NOT_REACHED ; <nl> } <nl> bool DurationFilter : : evaluate ( const RequestInfo : : RequestInfo & info , const Http : : <nl> } <nl> <nl> RuntimeFilter : : RuntimeFilter ( const envoy : : config : : filter : : accesslog : : v2 : : RuntimeFilter & config , <nl> - Runtime : : Loader & runtime ) <nl> - : runtime_ ( runtime ) , runtime_key_ ( config . runtime_key ( ) ) { } <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) <nl> + : runtime_ ( runtime ) , random_ ( random ) , runtime_key_ ( config . runtime_key ( ) ) , <nl> + percent_ ( config . percent_sampled ( ) ) , <nl> + use_independent_randomness_ ( config . use_independent_randomness ( ) ) { } <nl> <nl> bool RuntimeFilter : : evaluate ( const RequestInfo : : RequestInfo & , <nl> const Http : : HeaderMap & request_header ) { <nl> const Http : : HeaderEntry * uuid = request_header . RequestId ( ) ; <nl> - uint16_t sampled_value ; <nl> - if ( uuid & & UuidUtils : : uuidModBy ( uuid - > value ( ) . c_str ( ) , sampled_value , 100 ) ) { <nl> - uint64_t runtime_value = <nl> - std : : min < uint64_t > ( runtime_ . snapshot ( ) . getInteger ( runtime_key_ , 0 ) , 100 ) ; <nl> - <nl> - return sampled_value < static_cast < uint16_t > ( runtime_value ) ; <nl> - } else { <nl> - return runtime_ . snapshot ( ) . featureEnabled ( runtime_key_ , 0 ) ; <nl> + uint64_t random_value ; <nl> + if ( use_independent_randomness_ | | uuid = = nullptr | | <nl> + ! UuidUtils : : uuidModBy ( uuid - > value ( ) . c_str ( ) , random_value , <nl> + ProtobufPercentHelper : : fractionalPercentDenominatorToInt ( percent_ ) ) ) { <nl> + random_value = random_ . random ( ) ; <nl> } <nl> + <nl> + return runtime_ . snapshot ( ) . featureEnabled ( <nl> + runtime_key_ , percent_ . numerator ( ) , random_value , <nl> + ProtobufPercentHelper : : fractionalPercentDenominatorToInt ( percent_ ) ) ; <nl> } <nl> <nl> OperatorFilter : : OperatorFilter ( const Protobuf : : RepeatedPtrField < <nl> envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter > & configs , <nl> - Runtime : : Loader & runtime ) { <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) { <nl> for ( const auto & config : configs ) { <nl> - filters_ . emplace_back ( FilterFactory : : fromProto ( config , runtime ) ) ; <nl> + filters_ . emplace_back ( FilterFactory : : fromProto ( config , runtime , random ) ) ; <nl> } <nl> } <nl> <nl> OrFilter : : OrFilter ( const envoy : : config : : filter : : accesslog : : v2 : : OrFilter & config , <nl> - Runtime : : Loader & runtime ) <nl> - : OperatorFilter ( config . filters ( ) , runtime ) { } <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) <nl> + : OperatorFilter ( config . filters ( ) , runtime , random ) { } <nl> <nl> AndFilter : : AndFilter ( const envoy : : config : : filter : : accesslog : : v2 : : AndFilter & config , <nl> - Runtime : : Loader & runtime ) <nl> - : OperatorFilter ( config . filters ( ) , runtime ) { } <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) <nl> + : OperatorFilter ( config . filters ( ) , runtime , random ) { } <nl> <nl> bool OrFilter : : evaluate ( const RequestInfo : : RequestInfo & info , <nl> const Http : : HeaderMap & request_headers ) { <nl> AccessLogFactory : : fromProto ( const envoy : : config : : filter : : accesslog : : v2 : : AccessLo <nl> Server : : Configuration : : FactoryContext & context ) { <nl> FilterPtr filter ; <nl> if ( config . has_filter ( ) ) { <nl> - filter = FilterFactory : : fromProto ( config . filter ( ) , context . runtime ( ) ) ; <nl> + filter = FilterFactory : : fromProto ( config . filter ( ) , context . runtime ( ) , context . random ( ) ) ; <nl> } <nl> <nl> auto & factory = <nl> mmm a / source / common / access_log / access_log_impl . h <nl> ppp b / source / common / access_log / access_log_impl . h <nl> class FilterFactory { <nl> * Read a filter definition from proto and instantiate a concrete filter class . <nl> * / <nl> static FilterPtr fromProto ( const envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter & config , <nl> - Runtime : : Loader & runtime ) ; <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) ; <nl> } ; <nl> <nl> / * * <nl> class OperatorFilter : public Filter { <nl> public : <nl> OperatorFilter ( const Protobuf : : RepeatedPtrField < <nl> envoy : : config : : filter : : accesslog : : v2 : : AccessLogFilter > & configs , <nl> - Runtime : : Loader & runtime ) ; <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) ; <nl> <nl> protected : <nl> std : : vector < FilterPtr > filters_ ; <nl> class OperatorFilter : public Filter { <nl> * / <nl> class AndFilter : public OperatorFilter { <nl> public : <nl> - AndFilter ( const envoy : : config : : filter : : accesslog : : v2 : : AndFilter & config , <nl> - Runtime : : Loader & runtime ) ; <nl> + AndFilter ( const envoy : : config : : filter : : accesslog : : v2 : : AndFilter & config , Runtime : : Loader & runtime , <nl> + Runtime : : RandomGenerator & random ) ; <nl> <nl> / / AccessLog : : Filter <nl> bool evaluate ( const RequestInfo : : RequestInfo & info , <nl> class AndFilter : public OperatorFilter { <nl> * / <nl> class OrFilter : public OperatorFilter { <nl> public : <nl> - OrFilter ( const envoy : : config : : filter : : accesslog : : v2 : : OrFilter & config , Runtime : : Loader & runtime ) ; <nl> + OrFilter ( const envoy : : config : : filter : : accesslog : : v2 : : OrFilter & config , Runtime : : Loader & runtime , <nl> + Runtime : : RandomGenerator & random ) ; <nl> <nl> / / AccessLog : : Filter <nl> bool evaluate ( const RequestInfo : : RequestInfo & info , <nl> class TraceableRequestFilter : public Filter { <nl> class RuntimeFilter : public Filter { <nl> public : <nl> RuntimeFilter ( const envoy : : config : : filter : : accesslog : : v2 : : RuntimeFilter & config , <nl> - Runtime : : Loader & runtime ) ; <nl> + Runtime : : Loader & runtime , Runtime : : RandomGenerator & random ) ; <nl> <nl> / / AccessLog : : Filter <nl> bool evaluate ( const RequestInfo : : RequestInfo & info , <nl> class RuntimeFilter : public Filter { <nl> <nl> private : <nl> Runtime : : Loader & runtime_ ; <nl> + Runtime : : RandomGenerator & random_ ; <nl> const std : : string runtime_key_ ; <nl> + const envoy : : type : : FractionalPercent percent_ ; <nl> + const bool use_independent_randomness_ ; <nl> } ; <nl> <nl> / * * <nl> mmm a / source / common / protobuf / utility . cc <nl> ppp b / source / common / protobuf / utility . cc <nl> uint64_t convertPercent ( double percent , uint64_t max_value ) { <nl> return max_value * ( percent / 100 . 0 ) ; <nl> } <nl> <nl> + uint64_t fractionalPercentDenominatorToInt ( const envoy : : type : : FractionalPercent & percent ) { <nl> + switch ( percent . denominator ( ) ) { <nl> + case envoy : : type : : FractionalPercent : : HUNDRED : <nl> + return 100 ; <nl> + case envoy : : type : : FractionalPercent : : TEN_THOUSAND : <nl> + return 10000 ; <nl> + case envoy : : type : : FractionalPercent : : MILLION : <nl> + return 1000000 ; <nl> + default : <nl> + / / Checked by schema . <nl> + NOT_REACHED ; <nl> + } <nl> + } <nl> + <nl> } / / namespace ProtobufPercentHelper <nl> <nl> MissingFieldException : : MissingFieldException ( const std : : string & field_name , <nl> mmm a / source / common / protobuf / utility . h <nl> ppp b / source / common / protobuf / utility . h <nl> namespace ProtobufPercentHelper { <nl> uint64_t checkAndReturnDefault ( uint64_t default_value , uint64_t max_value ) ; <nl> uint64_t convertPercent ( double percent , uint64_t max_value ) ; <nl> <nl> + / * * <nl> + * Convert a fractional percent denominator enum into an integer . <nl> + * @ param percent supplies percent to convert . <nl> + * @ return the converted denominator . <nl> + * / <nl> + uint64_t fractionalPercentDenominatorToInt ( const envoy : : type : : FractionalPercent & percent ) ; <nl> + <nl> } / / namespace ProtobufPercentHelper <nl> } / / namespace Envoy <nl> <nl> mmm a / source / common / runtime / runtime_impl . h <nl> ppp b / source / common / runtime / runtime_impl . h <nl> class SnapshotImpl : public Snapshot , <nl> <nl> / / Runtime : : Snapshot <nl> bool featureEnabled ( const std : : string & key , uint64_t default_value , uint64_t random_value , <nl> - uint16_t num_buckets ) const override { <nl> - return random_value % static_cast < uint64_t > ( num_buckets ) < <nl> - std : : min ( getInteger ( key , default_value ) , static_cast < uint64_t > ( num_buckets ) ) ; <nl> + uint64_t num_buckets ) const override { <nl> + return random_value % num_buckets < std : : min ( getInteger ( key , default_value ) , num_buckets ) ; <nl> } <nl> <nl> bool featureEnabled ( const std : : string & key , uint64_t default_value ) const override { <nl> class NullLoaderImpl : public Loader { <nl> <nl> / / Runtime : : Snapshot <nl> bool featureEnabled ( const std : : string & , uint64_t default_value , uint64_t random_value , <nl> - uint16_t num_buckets ) const override { <nl> - return random_value % static_cast < uint64_t > ( num_buckets ) < <nl> - std : : min ( default_value , static_cast < uint64_t > ( num_buckets ) ) ; <nl> + uint64_t num_buckets ) const override { <nl> + return random_value % num_buckets < std : : min ( default_value , num_buckets ) ; <nl> } <nl> <nl> bool featureEnabled ( const std : : string & key , uint64_t default_value ) const override { <nl> mmm a / source / common / runtime / uuid_util . cc <nl> ppp b / source / common / runtime / uuid_util . cc <nl> <nl> # include " common / runtime / runtime_impl . h " <nl> <nl> namespace Envoy { <nl> - bool UuidUtils : : uuidModBy ( const std : : string & uuid , uint16_t & out , uint16_t mod ) { <nl> + bool UuidUtils : : uuidModBy ( const std : : string & uuid , uint64_t & out , uint64_t mod ) { <nl> if ( uuid . length ( ) < 8 ) { <nl> return false ; <nl> } <nl> mmm a / source / common / runtime / uuid_util . h <nl> ppp b / source / common / runtime / uuid_util . h <nl> <nl> # include < string > <nl> <nl> namespace Envoy { <nl> + <nl> enum class UuidTraceStatus { NoTrace , Sampled , Client , Forced } ; <nl> <nl> - / * <nl> + / * * <nl> * Utils for uuid4 . <nl> * / <nl> class UuidUtils { <nl> class UuidUtils { <nl> * @ param out will contain the result of the operation . <nl> * @ param mod modulo used in the operation . <nl> * / <nl> - static bool uuidModBy ( const std : : string & uuid , uint16_t & out , uint16_t mod ) ; <nl> + static bool uuidModBy ( const std : : string & uuid , uint64_t & out , uint64_t mod ) ; <nl> <nl> / * * <nl> * Modify uuid in a way it can be detected if uuid is traceable or not . <nl> class UuidUtils { <nl> / / Initial value for freshly generated uuid4 . <nl> static const char NO_TRACE = ' 4 ' ; <nl> } ; <nl> + <nl> } / / namespace Envoy <nl> mmm a / source / common / tracing / http_tracer_impl . cc <nl> ppp b / source / common / tracing / http_tracer_impl . cc <nl> void HttpTracerUtility : : mutateHeaders ( Http : : HeaderMap & request_headers , Runtime : <nl> / / TODO PERF : Avoid copy . <nl> std : : string x_request_id = request_headers . RequestId ( ) - > value ( ) . c_str ( ) ; <nl> <nl> - uint16_t result ; <nl> + uint64_t result ; <nl> / / Skip if x - request - id is corrupted . <nl> if ( ! UuidUtils : : uuidModBy ( x_request_id , result , 10000 ) ) { <nl> return ; <nl> mmm a / test / common / access_log / access_log_impl_test . cc <nl> ppp b / test / common / access_log / access_log_impl_test . cc <nl> parseAccessLogFromJson ( const std : : string & json_string ) { <nl> return access_log ; <nl> } <nl> <nl> + envoy : : config : : filter : : accesslog : : v2 : : AccessLog parseAccessLogFromV2Yaml ( const std : : string & yaml ) { <nl> + envoy : : config : : filter : : accesslog : : v2 : : AccessLog access_log ; <nl> + MessageUtil : : loadFromYaml ( yaml , access_log ) ; <nl> + return access_log ; <nl> + } <nl> + <nl> class TestRequestInfo : public RequestInfo : : RequestInfo { <nl> public : <nl> TestRequestInfo ( ) { <nl> TEST_F ( AccessLogImplTest , RuntimeFilter ) { <nl> InstanceSharedPtr log = AccessLogFactory : : fromProto ( parseAccessLogFromJson ( json ) , context_ ) ; <nl> <nl> / / Value is taken from random generator . <nl> - EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 0 ) ) . WillOnce ( Return ( true ) ) ; <nl> + EXPECT_CALL ( context_ . random_ , random ( ) ) . WillOnce ( Return ( 42 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 0 , 42 , 100 ) ) <nl> + . WillOnce ( Return ( true ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + <nl> + EXPECT_CALL ( context_ . random_ , random ( ) ) . WillOnce ( Return ( 43 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 0 , 43 , 100 ) ) <nl> + . WillOnce ( Return ( false ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) . Times ( 0 ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + <nl> + / / Value is taken from x - request - id . <nl> + request_headers_ . addCopy ( " x - request - id " , " 000000ff - 0000 - 0000 - 0000 - 000000000000 " ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 0 , 55 , 100 ) ) <nl> + . WillOnce ( Return ( true ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 0 , 55 , 100 ) ) <nl> + . WillOnce ( Return ( false ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) . Times ( 0 ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + } <nl> + <nl> + TEST_F ( AccessLogImplTest , RuntimeFilterV2 ) { <nl> + const std : : string yaml = R " EOF ( <nl> + name : envoy . file_access_log <nl> + filter : <nl> + runtime_filter : <nl> + runtime_key : access_log . test_key <nl> + percent_sampled : <nl> + numerator : 5 <nl> + denominator : TEN_THOUSAND <nl> + config : <nl> + path : / dev / null <nl> + ) EOF " ; <nl> + <nl> + InstanceSharedPtr log = AccessLogFactory : : fromProto ( parseAccessLogFromV2Yaml ( yaml ) , context_ ) ; <nl> + <nl> + / / Value is taken from random generator . <nl> + EXPECT_CALL ( context_ . random_ , random ( ) ) . WillOnce ( Return ( 42 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 5 , 42 , 10000 ) ) <nl> + . WillOnce ( Return ( true ) ) ; <nl> EXPECT_CALL ( * file_ , write ( _ ) ) ; <nl> log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> <nl> - EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 0 ) ) . WillOnce ( Return ( false ) ) ; <nl> + EXPECT_CALL ( context_ . random_ , random ( ) ) . WillOnce ( Return ( 43 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 5 , 43 , 10000 ) ) <nl> + . WillOnce ( Return ( false ) ) ; <nl> EXPECT_CALL ( * file_ , write ( _ ) ) . Times ( 0 ) ; <nl> log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> <nl> / / Value is taken from x - request - id . <nl> request_headers_ . addCopy ( " x - request - id " , " 000000ff - 0000 - 0000 - 0000 - 000000000000 " ) ; <nl> - EXPECT_CALL ( runtime_ . snapshot_ , getInteger ( " access_log . test_key " , 0 ) ) . WillOnce ( Return ( 56 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 5 , 255 , 10000 ) ) <nl> + . WillOnce ( Return ( true ) ) ; <nl> EXPECT_CALL ( * file_ , write ( _ ) ) ; <nl> log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> <nl> - EXPECT_CALL ( runtime_ . snapshot_ , getInteger ( " access_log . test_key " , 0 ) ) . WillOnce ( Return ( 55 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 5 , 255 , 10000 ) ) <nl> + . WillOnce ( Return ( false ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) . Times ( 0 ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + } <nl> + <nl> + TEST_F ( AccessLogImplTest , RuntimeFilterV2IndependentRandomness ) { <nl> + const std : : string yaml = R " EOF ( <nl> + name : envoy . file_access_log <nl> + filter : <nl> + runtime_filter : <nl> + runtime_key : access_log . test_key <nl> + percent_sampled : <nl> + numerator : 5 <nl> + denominator : MILLION <nl> + use_independent_randomness : true <nl> + config : <nl> + path : / dev / null <nl> + ) EOF " ; <nl> + <nl> + InstanceSharedPtr log = AccessLogFactory : : fromProto ( parseAccessLogFromV2Yaml ( yaml ) , context_ ) ; <nl> + <nl> + / / Value should not be taken from x - request - id . <nl> + request_headers_ . addCopy ( " x - request - id " , " 000000ff - 0000 - 0000 - 0000 - 000000000000 " ) ; <nl> + EXPECT_CALL ( context_ . random_ , random ( ) ) . WillOnce ( Return ( 42 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 5 , 42 , 1000000 ) ) <nl> + . WillOnce ( Return ( true ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + <nl> + EXPECT_CALL ( context_ . random_ , random ( ) ) . WillOnce ( Return ( 43 ) ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , featureEnabled ( " access_log . test_key " , 5 , 43 , 1000000 ) ) <nl> + . WillOnce ( Return ( false ) ) ; <nl> EXPECT_CALL ( * file_ , write ( _ ) ) . Times ( 0 ) ; <nl> log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> } <nl> TEST ( AccessLogFilterTest , StatusCodeWithRuntimeKey ) { <nl> EXPECT_FALSE ( filter . evaluate ( info , request_headers ) ) ; <nl> } <nl> <nl> + TEST_F ( AccessLogImplTest , StatusCodeLessThan ) { <nl> + const std : : string yaml = R " EOF ( <nl> + name : envoy . file_access_log <nl> + filter : <nl> + status_code_filter : <nl> + comparison : <nl> + op : LE <nl> + value : <nl> + default_value : 499 <nl> + runtime_key : hello <nl> + config : <nl> + path : / dev / null <nl> + ) EOF " ; <nl> + <nl> + InstanceSharedPtr log = AccessLogFactory : : fromProto ( parseAccessLogFromV2Yaml ( yaml ) , context_ ) ; <nl> + <nl> + request_info_ . response_code_ . value ( 499 ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , getInteger ( " hello " , 499 ) ) . WillOnce ( Return ( 499 ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + <nl> + request_info_ . response_code_ . value ( 500 ) ; <nl> + EXPECT_CALL ( runtime_ . snapshot_ , getInteger ( " hello " , 499 ) ) . WillOnce ( Return ( 499 ) ) ; <nl> + EXPECT_CALL ( * file_ , write ( _ ) ) . Times ( 0 ) ; <nl> + log - > log ( & request_headers_ , & response_headers_ , request_info_ ) ; <nl> + } <nl> + <nl> } / / namespace <nl> } / / namespace AccessLog <nl> } / / namespace Envoy <nl> mmm a / test / common / runtime / uuid_util_test . cc <nl> ppp b / test / common / runtime / uuid_util_test . cc <nl> <nl> <nl> namespace Envoy { <nl> TEST ( UUIDUtilsTest , mod ) { <nl> - uint16_t result ; <nl> + uint64_t result ; <nl> EXPECT_TRUE ( UuidUtils : : uuidModBy ( " 00000000 - 0000 - 0000 - 0000 - 000000000000 " , result , 100 ) ) ; <nl> EXPECT_EQ ( 0 , result ) ; <nl> <nl> TEST ( UUIDUtilsTest , checkDistribution ) { <nl> ASSERT_TRUE ( uuid [ 14 ] = = ' 4 ' ) ; / / UUID version 4 ( random ) <nl> ASSERT_TRUE ( c = = ' 8 ' | | c = = ' 9 ' | | c = = ' a ' | | c = = ' b ' ) ; / / UUID variant 1 ( RFC4122 ) <nl> <nl> - uint16_t value ; <nl> + uint64_t value ; <nl> ASSERT_TRUE ( UuidUtils : : uuidModBy ( uuid , value , mod ) ) ; <nl> <nl> if ( value < required_percentage ) { <nl> mmm a / test / mocks / runtime / mocks . h <nl> ppp b / test / mocks / runtime / mocks . h <nl> class MockSnapshot : public Snapshot { <nl> MOCK_CONST_METHOD3 ( featureEnabled , <nl> bool ( const std : : string & key , uint64_t default_value , uint64_t random_value ) ) ; <nl> MOCK_CONST_METHOD4 ( featureEnabled , bool ( const std : : string & key , uint64_t default_value , <nl> - uint64_t random_value , uint16_t num_buckets ) ) ; <nl> + uint64_t random_value , uint64_t num_buckets ) ) ; <nl> MOCK_CONST_METHOD1 ( get , const std : : string & ( const std : : string & key ) ) ; <nl> MOCK_CONST_METHOD2 ( getInteger , uint64_t ( const std : : string & key , uint64_t default_value ) ) ; <nl> MOCK_CONST_METHOD0 ( getAll , const std : : unordered_map < std : : string , const Snapshot : : Entry > & ( ) ) ; <nl>
access log filters : various enhancements ( )
envoyproxy/envoy
d90a2b65e9ef28b4beccb410bf74171b2a20285e
2018-03-06T19:11:55Z
new file mode 100644 <nl> index 00000000000 . . cf7a8e936c5 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / serialization / map_unser . php <nl> <nl> + < ? hh <nl> + / / Remember to also update map_unser_big , which exercises the fast path . <nl> + <nl> + $ data = [ <nl> + ' K : 6 : " HH \ \ Map " : 0 : { } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : 3 : " bar " ; i : 7 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : 3 : " bar " ; i : ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : 3 : " bar " ; i : - ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : : " " ; i : ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; i : 456 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : - 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 55 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } blah ' , <nl> + ' K : 7 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' <nl> + ] ; <nl> + <nl> + foreach ( $ data as $ serialized ) { <nl> + var_dump ( unserialize ( $ serialized ) ) ; <nl> + } <nl> + <nl> + function makeBig ( $ n ) { <nl> + $ m = Map { ' foo ' = > 123 , ' bar ' = > 9876543210 } ; <nl> + for ( $ i = 0 ; $ i < $ n ; $ i + = 1 ) { <nl> + $ m [ ' key ' . $ i ] = $ i ; <nl> + } <nl> + return $ m ; <nl> + } <nl> + <nl> + $ sizes = [ 0 , 1 , 100 , 1000 ] ; <nl> + <nl> + foreach ( $ sizes as $ n ) { <nl> + var_dump ( unserialize ( serialize ( makeBig ( $ n ) ) ) ) ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 8cc4ea00eb6 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / serialization / map_unser . php . expectf <nl> <nl> + object ( HH \ Map ) # 1 ( 0 ) { <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " bar " ] = > <nl> + int ( 7 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " bar " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " bar " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " bar " ] = > <nl> + int ( 3 ) <nl> + [ " bling " ] = > <nl> + int ( 123 ) <nl> + } <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; } ] . Expected ' } ' but got ' s ' . in % s / test / slow / serialization / map_unser . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; i : 456 ; } ] . Expected ' } ' but got ' s ' . in % s / test / slow / serialization / map_unser . php on line 23 <nl> + bool ( false ) <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " bar " ] = > <nl> + int ( 3 ) <nl> + [ " bling " ] = > <nl> + int ( 123 ) <nl> + } <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; ] . Unexpected end of buffer during unserialization . in % s / test / slow / serialization / map_unser . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ] . Unexpected end of buffer during unserialization . in % s / test / slow / serialization / map_unser . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : - 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ] . Size of serialized string ( - 3 ) must not be negative . in % s / test / slow / serialization / map_unser . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 55 : " bling " ; i : 123 ; } ] . Unexpected end of buffer during unserialization . in % s / test / slow / serialization / map_unser . php on line 23 <nl> + bool ( false ) <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " bar " ] = > <nl> + int ( 3 ) <nl> + [ " bling " ] = > <nl> + int ( 123 ) <nl> + } <nl> + <nl> + Notice : Unable to unserialize : [ K : 7 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ] . Expected ' " ' but got ' : ' . in % s / test / slow / serialization / map_unser . php on line 23 <nl> + bool ( false ) <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 3 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + [ " key0 " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 102 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + [ " key0 " ] = > <nl> + int ( 0 ) <nl> + [ " key1 " ] = > <nl> + int ( 1 ) <nl> + [ " key2 " ] = > <nl> + int ( 2 ) <nl> + [ " key3 " ] = > <nl> + int ( 3 ) <nl> + [ " key4 " ] = > <nl> + int ( 4 ) <nl> + [ " key5 " ] = > <nl> + int ( 5 ) <nl> + [ " key6 " ] = > <nl> + int ( 6 ) <nl> + [ " key7 " ] = > <nl> + int ( 7 ) <nl> + [ " key8 " ] = > <nl> + int ( 8 ) <nl> + [ " key9 " ] = > <nl> + int ( 9 ) <nl> + [ " key10 " ] = > <nl> + int ( 10 ) <nl> + [ " key11 " ] = > <nl> + int ( 11 ) <nl> + [ " key12 " ] = > <nl> + int ( 12 ) <nl> + [ " key13 " ] = > <nl> + int ( 13 ) <nl> + [ " key14 " ] = > <nl> + int ( 14 ) <nl> + [ " key15 " ] = > <nl> + int ( 15 ) <nl> + [ " key16 " ] = > <nl> + int ( 16 ) <nl> + [ " key17 " ] = > <nl> + int ( 17 ) <nl> + [ " key18 " ] = > <nl> + int ( 18 ) <nl> + [ " key19 " ] = > <nl> + int ( 19 ) <nl> + [ " key20 " ] = > <nl> + int ( 20 ) <nl> + [ " key21 " ] = > <nl> + int ( 21 ) <nl> + [ " key22 " ] = > <nl> + int ( 22 ) <nl> + [ " key23 " ] = > <nl> + int ( 23 ) <nl> + [ " key24 " ] = > <nl> + int ( 24 ) <nl> + [ " key25 " ] = > <nl> + int ( 25 ) <nl> + [ " key26 " ] = > <nl> + int ( 26 ) <nl> + [ " key27 " ] = > <nl> + int ( 27 ) <nl> + [ " key28 " ] = > <nl> + int ( 28 ) <nl> + [ " key29 " ] = > <nl> + int ( 29 ) <nl> + [ " key30 " ] = > <nl> + int ( 30 ) <nl> + [ " key31 " ] = > <nl> + int ( 31 ) <nl> + [ " key32 " ] = > <nl> + int ( 32 ) <nl> + [ " key33 " ] = > <nl> + int ( 33 ) <nl> + [ " key34 " ] = > <nl> + int ( 34 ) <nl> + [ " key35 " ] = > <nl> + int ( 35 ) <nl> + [ " key36 " ] = > <nl> + int ( 36 ) <nl> + [ " key37 " ] = > <nl> + int ( 37 ) <nl> + [ " key38 " ] = > <nl> + int ( 38 ) <nl> + [ " key39 " ] = > <nl> + int ( 39 ) <nl> + [ " key40 " ] = > <nl> + int ( 40 ) <nl> + [ " key41 " ] = > <nl> + int ( 41 ) <nl> + [ " key42 " ] = > <nl> + int ( 42 ) <nl> + [ " key43 " ] = > <nl> + int ( 43 ) <nl> + [ " key44 " ] = > <nl> + int ( 44 ) <nl> + [ " key45 " ] = > <nl> + int ( 45 ) <nl> + [ " key46 " ] = > <nl> + int ( 46 ) <nl> + [ " key47 " ] = > <nl> + int ( 47 ) <nl> + [ " key48 " ] = > <nl> + int ( 48 ) <nl> + [ " key49 " ] = > <nl> + int ( 49 ) <nl> + [ " key50 " ] = > <nl> + int ( 50 ) <nl> + [ " key51 " ] = > <nl> + int ( 51 ) <nl> + [ " key52 " ] = > <nl> + int ( 52 ) <nl> + [ " key53 " ] = > <nl> + int ( 53 ) <nl> + [ " key54 " ] = > <nl> + int ( 54 ) <nl> + [ " key55 " ] = > <nl> + int ( 55 ) <nl> + [ " key56 " ] = > <nl> + int ( 56 ) <nl> + [ " key57 " ] = > <nl> + int ( 57 ) <nl> + [ " key58 " ] = > <nl> + int ( 58 ) <nl> + [ " key59 " ] = > <nl> + int ( 59 ) <nl> + [ " key60 " ] = > <nl> + int ( 60 ) <nl> + [ " key61 " ] = > <nl> + int ( 61 ) <nl> + [ " key62 " ] = > <nl> + int ( 62 ) <nl> + [ " key63 " ] = > <nl> + int ( 63 ) <nl> + [ " key64 " ] = > <nl> + int ( 64 ) <nl> + [ " key65 " ] = > <nl> + int ( 65 ) <nl> + [ " key66 " ] = > <nl> + int ( 66 ) <nl> + [ " key67 " ] = > <nl> + int ( 67 ) <nl> + [ " key68 " ] = > <nl> + int ( 68 ) <nl> + [ " key69 " ] = > <nl> + int ( 69 ) <nl> + [ " key70 " ] = > <nl> + int ( 70 ) <nl> + [ " key71 " ] = > <nl> + int ( 71 ) <nl> + [ " key72 " ] = > <nl> + int ( 72 ) <nl> + [ " key73 " ] = > <nl> + int ( 73 ) <nl> + [ " key74 " ] = > <nl> + int ( 74 ) <nl> + [ " key75 " ] = > <nl> + int ( 75 ) <nl> + [ " key76 " ] = > <nl> + int ( 76 ) <nl> + [ " key77 " ] = > <nl> + int ( 77 ) <nl> + [ " key78 " ] = > <nl> + int ( 78 ) <nl> + [ " key79 " ] = > <nl> + int ( 79 ) <nl> + [ " key80 " ] = > <nl> + int ( 80 ) <nl> + [ " key81 " ] = > <nl> + int ( 81 ) <nl> + [ " key82 " ] = > <nl> + int ( 82 ) <nl> + [ " key83 " ] = > <nl> + int ( 83 ) <nl> + [ " key84 " ] = > <nl> + int ( 84 ) <nl> + [ " key85 " ] = > <nl> + int ( 85 ) <nl> + [ " key86 " ] = > <nl> + int ( 86 ) <nl> + [ " key87 " ] = > <nl> + int ( 87 ) <nl> + [ " key88 " ] = > <nl> + int ( 88 ) <nl> + [ " key89 " ] = > <nl> + int ( 89 ) <nl> + [ " key90 " ] = > <nl> + int ( 90 ) <nl> + [ " key91 " ] = > <nl> + int ( 91 ) <nl> + [ " key92 " ] = > <nl> + int ( 92 ) <nl> + [ " key93 " ] = > <nl> + int ( 93 ) <nl> + [ " key94 " ] = > <nl> + int ( 94 ) <nl> + [ " key95 " ] = > <nl> + int ( 95 ) <nl> + [ " key96 " ] = > <nl> + int ( 96 ) <nl> + [ " key97 " ] = > <nl> + int ( 97 ) <nl> + [ " key98 " ] = > <nl> + int ( 98 ) <nl> + [ " key99 " ] = > <nl> + int ( 99 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1002 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + [ " key0 " ] = > <nl> + int ( 0 ) <nl> + [ " key1 " ] = > <nl> + int ( 1 ) <nl> + [ " key2 " ] = > <nl> + int ( 2 ) <nl> + [ " key3 " ] = > <nl> + int ( 3 ) <nl> + [ " key4 " ] = > <nl> + int ( 4 ) <nl> + [ " key5 " ] = > <nl> + int ( 5 ) <nl> + [ " key6 " ] = > <nl> + int ( 6 ) <nl> + [ " key7 " ] = > <nl> + int ( 7 ) <nl> + [ " key8 " ] = > <nl> + int ( 8 ) <nl> + [ " key9 " ] = > <nl> + int ( 9 ) <nl> + [ " key10 " ] = > <nl> + int ( 10 ) <nl> + [ " key11 " ] = > <nl> + int ( 11 ) <nl> + [ " key12 " ] = > <nl> + int ( 12 ) <nl> + [ " key13 " ] = > <nl> + int ( 13 ) <nl> + [ " key14 " ] = > <nl> + int ( 14 ) <nl> + [ " key15 " ] = > <nl> + int ( 15 ) <nl> + [ " key16 " ] = > <nl> + int ( 16 ) <nl> + [ " key17 " ] = > <nl> + int ( 17 ) <nl> + [ " key18 " ] = > <nl> + int ( 18 ) <nl> + [ " key19 " ] = > <nl> + int ( 19 ) <nl> + [ " key20 " ] = > <nl> + int ( 20 ) <nl> + [ " key21 " ] = > <nl> + int ( 21 ) <nl> + [ " key22 " ] = > <nl> + int ( 22 ) <nl> + [ " key23 " ] = > <nl> + int ( 23 ) <nl> + [ " key24 " ] = > <nl> + int ( 24 ) <nl> + [ " key25 " ] = > <nl> + int ( 25 ) <nl> + [ " key26 " ] = > <nl> + int ( 26 ) <nl> + [ " key27 " ] = > <nl> + int ( 27 ) <nl> + [ " key28 " ] = > <nl> + int ( 28 ) <nl> + [ " key29 " ] = > <nl> + int ( 29 ) <nl> + [ " key30 " ] = > <nl> + int ( 30 ) <nl> + [ " key31 " ] = > <nl> + int ( 31 ) <nl> + [ " key32 " ] = > <nl> + int ( 32 ) <nl> + [ " key33 " ] = > <nl> + int ( 33 ) <nl> + [ " key34 " ] = > <nl> + int ( 34 ) <nl> + [ " key35 " ] = > <nl> + int ( 35 ) <nl> + [ " key36 " ] = > <nl> + int ( 36 ) <nl> + [ " key37 " ] = > <nl> + int ( 37 ) <nl> + [ " key38 " ] = > <nl> + int ( 38 ) <nl> + [ " key39 " ] = > <nl> + int ( 39 ) <nl> + [ " key40 " ] = > <nl> + int ( 40 ) <nl> + [ " key41 " ] = > <nl> + int ( 41 ) <nl> + [ " key42 " ] = > <nl> + int ( 42 ) <nl> + [ " key43 " ] = > <nl> + int ( 43 ) <nl> + [ " key44 " ] = > <nl> + int ( 44 ) <nl> + [ " key45 " ] = > <nl> + int ( 45 ) <nl> + [ " key46 " ] = > <nl> + int ( 46 ) <nl> + [ " key47 " ] = > <nl> + int ( 47 ) <nl> + [ " key48 " ] = > <nl> + int ( 48 ) <nl> + [ " key49 " ] = > <nl> + int ( 49 ) <nl> + [ " key50 " ] = > <nl> + int ( 50 ) <nl> + [ " key51 " ] = > <nl> + int ( 51 ) <nl> + [ " key52 " ] = > <nl> + int ( 52 ) <nl> + [ " key53 " ] = > <nl> + int ( 53 ) <nl> + [ " key54 " ] = > <nl> + int ( 54 ) <nl> + [ " key55 " ] = > <nl> + int ( 55 ) <nl> + [ " key56 " ] = > <nl> + int ( 56 ) <nl> + [ " key57 " ] = > <nl> + int ( 57 ) <nl> + [ " key58 " ] = > <nl> + int ( 58 ) <nl> + [ " key59 " ] = > <nl> + int ( 59 ) <nl> + [ " key60 " ] = > <nl> + int ( 60 ) <nl> + [ " key61 " ] = > <nl> + int ( 61 ) <nl> + [ " key62 " ] = > <nl> + int ( 62 ) <nl> + [ " key63 " ] = > <nl> + int ( 63 ) <nl> + [ " key64 " ] = > <nl> + int ( 64 ) <nl> + [ " key65 " ] = > <nl> + int ( 65 ) <nl> + [ " key66 " ] = > <nl> + int ( 66 ) <nl> + [ " key67 " ] = > <nl> + int ( 67 ) <nl> + [ " key68 " ] = > <nl> + int ( 68 ) <nl> + [ " key69 " ] = > <nl> + int ( 69 ) <nl> + [ " key70 " ] = > <nl> + int ( 70 ) <nl> + [ " key71 " ] = > <nl> + int ( 71 ) <nl> + [ " key72 " ] = > <nl> + int ( 72 ) <nl> + [ " key73 " ] = > <nl> + int ( 73 ) <nl> + [ " key74 " ] = > <nl> + int ( 74 ) <nl> + [ " key75 " ] = > <nl> + int ( 75 ) <nl> + [ " key76 " ] = > <nl> + int ( 76 ) <nl> + [ " key77 " ] = > <nl> + int ( 77 ) <nl> + [ " key78 " ] = > <nl> + int ( 78 ) <nl> + [ " key79 " ] = > <nl> + int ( 79 ) <nl> + [ " key80 " ] = > <nl> + int ( 80 ) <nl> + [ " key81 " ] = > <nl> + int ( 81 ) <nl> + [ " key82 " ] = > <nl> + int ( 82 ) <nl> + [ " key83 " ] = > <nl> + int ( 83 ) <nl> + [ " key84 " ] = > <nl> + int ( 84 ) <nl> + [ " key85 " ] = > <nl> + int ( 85 ) <nl> + [ " key86 " ] = > <nl> + int ( 86 ) <nl> + [ " key87 " ] = > <nl> + int ( 87 ) <nl> + [ " key88 " ] = > <nl> + int ( 88 ) <nl> + [ " key89 " ] = > <nl> + int ( 89 ) <nl> + [ " key90 " ] = > <nl> + int ( 90 ) <nl> + [ " key91 " ] = > <nl> + int ( 91 ) <nl> + [ " key92 " ] = > <nl> + int ( 92 ) <nl> + [ " key93 " ] = > <nl> + int ( 93 ) <nl> + [ " key94 " ] = > <nl> + int ( 94 ) <nl> + [ " key95 " ] = > <nl> + int ( 95 ) <nl> + [ " key96 " ] = > <nl> + int ( 96 ) <nl> + [ " key97 " ] = > <nl> + int ( 97 ) <nl> + [ " key98 " ] = > <nl> + int ( 98 ) <nl> + [ " key99 " ] = > <nl> + int ( 99 ) <nl> + [ " key100 " ] = > <nl> + int ( 100 ) <nl> + [ " key101 " ] = > <nl> + int ( 101 ) <nl> + [ " key102 " ] = > <nl> + int ( 102 ) <nl> + [ " key103 " ] = > <nl> + int ( 103 ) <nl> + [ " key104 " ] = > <nl> + int ( 104 ) <nl> + [ " key105 " ] = > <nl> + int ( 105 ) <nl> + [ " key106 " ] = > <nl> + int ( 106 ) <nl> + [ " key107 " ] = > <nl> + int ( 107 ) <nl> + [ " key108 " ] = > <nl> + int ( 108 ) <nl> + [ " key109 " ] = > <nl> + int ( 109 ) <nl> + [ " key110 " ] = > <nl> + int ( 110 ) <nl> + [ " key111 " ] = > <nl> + int ( 111 ) <nl> + [ " key112 " ] = > <nl> + int ( 112 ) <nl> + [ " key113 " ] = > <nl> + int ( 113 ) <nl> + [ " key114 " ] = > <nl> + int ( 114 ) <nl> + [ " key115 " ] = > <nl> + int ( 115 ) <nl> + [ " key116 " ] = > <nl> + int ( 116 ) <nl> + [ " key117 " ] = > <nl> + int ( 117 ) <nl> + [ " key118 " ] = > <nl> + int ( 118 ) <nl> + [ " key119 " ] = > <nl> + int ( 119 ) <nl> + [ " key120 " ] = > <nl> + int ( 120 ) <nl> + [ " key121 " ] = > <nl> + int ( 121 ) <nl> + [ " key122 " ] = > <nl> + int ( 122 ) <nl> + [ " key123 " ] = > <nl> + int ( 123 ) <nl> + [ " key124 " ] = > <nl> + int ( 124 ) <nl> + [ " key125 " ] = > <nl> + int ( 125 ) <nl> + [ " key126 " ] = > <nl> + int ( 126 ) <nl> + [ " key127 " ] = > <nl> + int ( 127 ) <nl> + [ " key128 " ] = > <nl> + int ( 128 ) <nl> + [ " key129 " ] = > <nl> + int ( 129 ) <nl> + [ " key130 " ] = > <nl> + int ( 130 ) <nl> + [ " key131 " ] = > <nl> + int ( 131 ) <nl> + [ " key132 " ] = > <nl> + int ( 132 ) <nl> + [ " key133 " ] = > <nl> + int ( 133 ) <nl> + [ " key134 " ] = > <nl> + int ( 134 ) <nl> + [ " key135 " ] = > <nl> + int ( 135 ) <nl> + [ " key136 " ] = > <nl> + int ( 136 ) <nl> + [ " key137 " ] = > <nl> + int ( 137 ) <nl> + [ " key138 " ] = > <nl> + int ( 138 ) <nl> + [ " key139 " ] = > <nl> + int ( 139 ) <nl> + [ " key140 " ] = > <nl> + int ( 140 ) <nl> + [ " key141 " ] = > <nl> + int ( 141 ) <nl> + [ " key142 " ] = > <nl> + int ( 142 ) <nl> + [ " key143 " ] = > <nl> + int ( 143 ) <nl> + [ " key144 " ] = > <nl> + int ( 144 ) <nl> + [ " key145 " ] = > <nl> + int ( 145 ) <nl> + [ " key146 " ] = > <nl> + int ( 146 ) <nl> + [ " key147 " ] = > <nl> + int ( 147 ) <nl> + [ " key148 " ] = > <nl> + int ( 148 ) <nl> + [ " key149 " ] = > <nl> + int ( 149 ) <nl> + [ " key150 " ] = > <nl> + int ( 150 ) <nl> + [ " key151 " ] = > <nl> + int ( 151 ) <nl> + [ " key152 " ] = > <nl> + int ( 152 ) <nl> + [ " key153 " ] = > <nl> + int ( 153 ) <nl> + [ " key154 " ] = > <nl> + int ( 154 ) <nl> + [ " key155 " ] = > <nl> + int ( 155 ) <nl> + [ " key156 " ] = > <nl> + int ( 156 ) <nl> + [ " key157 " ] = > <nl> + int ( 157 ) <nl> + [ " key158 " ] = > <nl> + int ( 158 ) <nl> + [ " key159 " ] = > <nl> + int ( 159 ) <nl> + [ " key160 " ] = > <nl> + int ( 160 ) <nl> + [ " key161 " ] = > <nl> + int ( 161 ) <nl> + [ " key162 " ] = > <nl> + int ( 162 ) <nl> + [ " key163 " ] = > <nl> + int ( 163 ) <nl> + [ " key164 " ] = > <nl> + int ( 164 ) <nl> + [ " key165 " ] = > <nl> + int ( 165 ) <nl> + [ " key166 " ] = > <nl> + int ( 166 ) <nl> + [ " key167 " ] = > <nl> + int ( 167 ) <nl> + [ " key168 " ] = > <nl> + int ( 168 ) <nl> + [ " key169 " ] = > <nl> + int ( 169 ) <nl> + [ " key170 " ] = > <nl> + int ( 170 ) <nl> + [ " key171 " ] = > <nl> + int ( 171 ) <nl> + [ " key172 " ] = > <nl> + int ( 172 ) <nl> + [ " key173 " ] = > <nl> + int ( 173 ) <nl> + [ " key174 " ] = > <nl> + int ( 174 ) <nl> + [ " key175 " ] = > <nl> + int ( 175 ) <nl> + [ " key176 " ] = > <nl> + int ( 176 ) <nl> + [ " key177 " ] = > <nl> + int ( 177 ) <nl> + [ " key178 " ] = > <nl> + int ( 178 ) <nl> + [ " key179 " ] = > <nl> + int ( 179 ) <nl> + [ " key180 " ] = > <nl> + int ( 180 ) <nl> + [ " key181 " ] = > <nl> + int ( 181 ) <nl> + [ " key182 " ] = > <nl> + int ( 182 ) <nl> + [ " key183 " ] = > <nl> + int ( 183 ) <nl> + [ " key184 " ] = > <nl> + int ( 184 ) <nl> + [ " key185 " ] = > <nl> + int ( 185 ) <nl> + [ " key186 " ] = > <nl> + int ( 186 ) <nl> + [ " key187 " ] = > <nl> + int ( 187 ) <nl> + [ " key188 " ] = > <nl> + int ( 188 ) <nl> + [ " key189 " ] = > <nl> + int ( 189 ) <nl> + [ " key190 " ] = > <nl> + int ( 190 ) <nl> + [ " key191 " ] = > <nl> + int ( 191 ) <nl> + [ " key192 " ] = > <nl> + int ( 192 ) <nl> + [ " key193 " ] = > <nl> + int ( 193 ) <nl> + [ " key194 " ] = > <nl> + int ( 194 ) <nl> + [ " key195 " ] = > <nl> + int ( 195 ) <nl> + [ " key196 " ] = > <nl> + int ( 196 ) <nl> + [ " key197 " ] = > <nl> + int ( 197 ) <nl> + [ " key198 " ] = > <nl> + int ( 198 ) <nl> + [ " key199 " ] = > <nl> + int ( 199 ) <nl> + [ " key200 " ] = > <nl> + int ( 200 ) <nl> + [ " key201 " ] = > <nl> + int ( 201 ) <nl> + [ " key202 " ] = > <nl> + int ( 202 ) <nl> + [ " key203 " ] = > <nl> + int ( 203 ) <nl> + [ " key204 " ] = > <nl> + int ( 204 ) <nl> + [ " key205 " ] = > <nl> + int ( 205 ) <nl> + [ " key206 " ] = > <nl> + int ( 206 ) <nl> + [ " key207 " ] = > <nl> + int ( 207 ) <nl> + [ " key208 " ] = > <nl> + int ( 208 ) <nl> + [ " key209 " ] = > <nl> + int ( 209 ) <nl> + [ " key210 " ] = > <nl> + int ( 210 ) <nl> + [ " key211 " ] = > <nl> + int ( 211 ) <nl> + [ " key212 " ] = > <nl> + int ( 212 ) <nl> + [ " key213 " ] = > <nl> + int ( 213 ) <nl> + [ " key214 " ] = > <nl> + int ( 214 ) <nl> + [ " key215 " ] = > <nl> + int ( 215 ) <nl> + [ " key216 " ] = > <nl> + int ( 216 ) <nl> + [ " key217 " ] = > <nl> + int ( 217 ) <nl> + [ " key218 " ] = > <nl> + int ( 218 ) <nl> + [ " key219 " ] = > <nl> + int ( 219 ) <nl> + [ " key220 " ] = > <nl> + int ( 220 ) <nl> + [ " key221 " ] = > <nl> + int ( 221 ) <nl> + [ " key222 " ] = > <nl> + int ( 222 ) <nl> + [ " key223 " ] = > <nl> + int ( 223 ) <nl> + [ " key224 " ] = > <nl> + int ( 224 ) <nl> + [ " key225 " ] = > <nl> + int ( 225 ) <nl> + [ " key226 " ] = > <nl> + int ( 226 ) <nl> + [ " key227 " ] = > <nl> + int ( 227 ) <nl> + [ " key228 " ] = > <nl> + int ( 228 ) <nl> + [ " key229 " ] = > <nl> + int ( 229 ) <nl> + [ " key230 " ] = > <nl> + int ( 230 ) <nl> + [ " key231 " ] = > <nl> + int ( 231 ) <nl> + [ " key232 " ] = > <nl> + int ( 232 ) <nl> + [ " key233 " ] = > <nl> + int ( 233 ) <nl> + [ " key234 " ] = > <nl> + int ( 234 ) <nl> + [ " key235 " ] = > <nl> + int ( 235 ) <nl> + [ " key236 " ] = > <nl> + int ( 236 ) <nl> + [ " key237 " ] = > <nl> + int ( 237 ) <nl> + [ " key238 " ] = > <nl> + int ( 238 ) <nl> + [ " key239 " ] = > <nl> + int ( 239 ) <nl> + [ " key240 " ] = > <nl> + int ( 240 ) <nl> + [ " key241 " ] = > <nl> + int ( 241 ) <nl> + [ " key242 " ] = > <nl> + int ( 242 ) <nl> + [ " key243 " ] = > <nl> + int ( 243 ) <nl> + [ " key244 " ] = > <nl> + int ( 244 ) <nl> + [ " key245 " ] = > <nl> + int ( 245 ) <nl> + [ " key246 " ] = > <nl> + int ( 246 ) <nl> + [ " key247 " ] = > <nl> + int ( 247 ) <nl> + [ " key248 " ] = > <nl> + int ( 248 ) <nl> + [ " key249 " ] = > <nl> + int ( 249 ) <nl> + [ " key250 " ] = > <nl> + int ( 250 ) <nl> + [ " key251 " ] = > <nl> + int ( 251 ) <nl> + [ " key252 " ] = > <nl> + int ( 252 ) <nl> + [ " key253 " ] = > <nl> + int ( 253 ) <nl> + [ " key254 " ] = > <nl> + int ( 254 ) <nl> + [ " key255 " ] = > <nl> + int ( 255 ) <nl> + [ " key256 " ] = > <nl> + int ( 256 ) <nl> + [ " key257 " ] = > <nl> + int ( 257 ) <nl> + [ " key258 " ] = > <nl> + int ( 258 ) <nl> + [ " key259 " ] = > <nl> + int ( 259 ) <nl> + [ " key260 " ] = > <nl> + int ( 260 ) <nl> + [ " key261 " ] = > <nl> + int ( 261 ) <nl> + [ " key262 " ] = > <nl> + int ( 262 ) <nl> + [ " key263 " ] = > <nl> + int ( 263 ) <nl> + [ " key264 " ] = > <nl> + int ( 264 ) <nl> + [ " key265 " ] = > <nl> + int ( 265 ) <nl> + [ " key266 " ] = > <nl> + int ( 266 ) <nl> + [ " key267 " ] = > <nl> + int ( 267 ) <nl> + [ " key268 " ] = > <nl> + int ( 268 ) <nl> + [ " key269 " ] = > <nl> + int ( 269 ) <nl> + [ " key270 " ] = > <nl> + int ( 270 ) <nl> + [ " key271 " ] = > <nl> + int ( 271 ) <nl> + [ " key272 " ] = > <nl> + int ( 272 ) <nl> + [ " key273 " ] = > <nl> + int ( 273 ) <nl> + [ " key274 " ] = > <nl> + int ( 274 ) <nl> + [ " key275 " ] = > <nl> + int ( 275 ) <nl> + [ " key276 " ] = > <nl> + int ( 276 ) <nl> + [ " key277 " ] = > <nl> + int ( 277 ) <nl> + [ " key278 " ] = > <nl> + int ( 278 ) <nl> + [ " key279 " ] = > <nl> + int ( 279 ) <nl> + [ " key280 " ] = > <nl> + int ( 280 ) <nl> + [ " key281 " ] = > <nl> + int ( 281 ) <nl> + [ " key282 " ] = > <nl> + int ( 282 ) <nl> + [ " key283 " ] = > <nl> + int ( 283 ) <nl> + [ " key284 " ] = > <nl> + int ( 284 ) <nl> + [ " key285 " ] = > <nl> + int ( 285 ) <nl> + [ " key286 " ] = > <nl> + int ( 286 ) <nl> + [ " key287 " ] = > <nl> + int ( 287 ) <nl> + [ " key288 " ] = > <nl> + int ( 288 ) <nl> + [ " key289 " ] = > <nl> + int ( 289 ) <nl> + [ " key290 " ] = > <nl> + int ( 290 ) <nl> + [ " key291 " ] = > <nl> + int ( 291 ) <nl> + [ " key292 " ] = > <nl> + int ( 292 ) <nl> + [ " key293 " ] = > <nl> + int ( 293 ) <nl> + [ " key294 " ] = > <nl> + int ( 294 ) <nl> + [ " key295 " ] = > <nl> + int ( 295 ) <nl> + [ " key296 " ] = > <nl> + int ( 296 ) <nl> + [ " key297 " ] = > <nl> + int ( 297 ) <nl> + [ " key298 " ] = > <nl> + int ( 298 ) <nl> + [ " key299 " ] = > <nl> + int ( 299 ) <nl> + [ " key300 " ] = > <nl> + int ( 300 ) <nl> + [ " key301 " ] = > <nl> + int ( 301 ) <nl> + [ " key302 " ] = > <nl> + int ( 302 ) <nl> + [ " key303 " ] = > <nl> + int ( 303 ) <nl> + [ " key304 " ] = > <nl> + int ( 304 ) <nl> + [ " key305 " ] = > <nl> + int ( 305 ) <nl> + [ " key306 " ] = > <nl> + int ( 306 ) <nl> + [ " key307 " ] = > <nl> + int ( 307 ) <nl> + [ " key308 " ] = > <nl> + int ( 308 ) <nl> + [ " key309 " ] = > <nl> + int ( 309 ) <nl> + [ " key310 " ] = > <nl> + int ( 310 ) <nl> + [ " key311 " ] = > <nl> + int ( 311 ) <nl> + [ " key312 " ] = > <nl> + int ( 312 ) <nl> + [ " key313 " ] = > <nl> + int ( 313 ) <nl> + [ " key314 " ] = > <nl> + int ( 314 ) <nl> + [ " key315 " ] = > <nl> + int ( 315 ) <nl> + [ " key316 " ] = > <nl> + int ( 316 ) <nl> + [ " key317 " ] = > <nl> + int ( 317 ) <nl> + [ " key318 " ] = > <nl> + int ( 318 ) <nl> + [ " key319 " ] = > <nl> + int ( 319 ) <nl> + [ " key320 " ] = > <nl> + int ( 320 ) <nl> + [ " key321 " ] = > <nl> + int ( 321 ) <nl> + [ " key322 " ] = > <nl> + int ( 322 ) <nl> + [ " key323 " ] = > <nl> + int ( 323 ) <nl> + [ " key324 " ] = > <nl> + int ( 324 ) <nl> + [ " key325 " ] = > <nl> + int ( 325 ) <nl> + [ " key326 " ] = > <nl> + int ( 326 ) <nl> + [ " key327 " ] = > <nl> + int ( 327 ) <nl> + [ " key328 " ] = > <nl> + int ( 328 ) <nl> + [ " key329 " ] = > <nl> + int ( 329 ) <nl> + [ " key330 " ] = > <nl> + int ( 330 ) <nl> + [ " key331 " ] = > <nl> + int ( 331 ) <nl> + [ " key332 " ] = > <nl> + int ( 332 ) <nl> + [ " key333 " ] = > <nl> + int ( 333 ) <nl> + [ " key334 " ] = > <nl> + int ( 334 ) <nl> + [ " key335 " ] = > <nl> + int ( 335 ) <nl> + [ " key336 " ] = > <nl> + int ( 336 ) <nl> + [ " key337 " ] = > <nl> + int ( 337 ) <nl> + [ " key338 " ] = > <nl> + int ( 338 ) <nl> + [ " key339 " ] = > <nl> + int ( 339 ) <nl> + [ " key340 " ] = > <nl> + int ( 340 ) <nl> + [ " key341 " ] = > <nl> + int ( 341 ) <nl> + [ " key342 " ] = > <nl> + int ( 342 ) <nl> + [ " key343 " ] = > <nl> + int ( 343 ) <nl> + [ " key344 " ] = > <nl> + int ( 344 ) <nl> + [ " key345 " ] = > <nl> + int ( 345 ) <nl> + [ " key346 " ] = > <nl> + int ( 346 ) <nl> + [ " key347 " ] = > <nl> + int ( 347 ) <nl> + [ " key348 " ] = > <nl> + int ( 348 ) <nl> + [ " key349 " ] = > <nl> + int ( 349 ) <nl> + [ " key350 " ] = > <nl> + int ( 350 ) <nl> + [ " key351 " ] = > <nl> + int ( 351 ) <nl> + [ " key352 " ] = > <nl> + int ( 352 ) <nl> + [ " key353 " ] = > <nl> + int ( 353 ) <nl> + [ " key354 " ] = > <nl> + int ( 354 ) <nl> + [ " key355 " ] = > <nl> + int ( 355 ) <nl> + [ " key356 " ] = > <nl> + int ( 356 ) <nl> + [ " key357 " ] = > <nl> + int ( 357 ) <nl> + [ " key358 " ] = > <nl> + int ( 358 ) <nl> + [ " key359 " ] = > <nl> + int ( 359 ) <nl> + [ " key360 " ] = > <nl> + int ( 360 ) <nl> + [ " key361 " ] = > <nl> + int ( 361 ) <nl> + [ " key362 " ] = > <nl> + int ( 362 ) <nl> + [ " key363 " ] = > <nl> + int ( 363 ) <nl> + [ " key364 " ] = > <nl> + int ( 364 ) <nl> + [ " key365 " ] = > <nl> + int ( 365 ) <nl> + [ " key366 " ] = > <nl> + int ( 366 ) <nl> + [ " key367 " ] = > <nl> + int ( 367 ) <nl> + [ " key368 " ] = > <nl> + int ( 368 ) <nl> + [ " key369 " ] = > <nl> + int ( 369 ) <nl> + [ " key370 " ] = > <nl> + int ( 370 ) <nl> + [ " key371 " ] = > <nl> + int ( 371 ) <nl> + [ " key372 " ] = > <nl> + int ( 372 ) <nl> + [ " key373 " ] = > <nl> + int ( 373 ) <nl> + [ " key374 " ] = > <nl> + int ( 374 ) <nl> + [ " key375 " ] = > <nl> + int ( 375 ) <nl> + [ " key376 " ] = > <nl> + int ( 376 ) <nl> + [ " key377 " ] = > <nl> + int ( 377 ) <nl> + [ " key378 " ] = > <nl> + int ( 378 ) <nl> + [ " key379 " ] = > <nl> + int ( 379 ) <nl> + [ " key380 " ] = > <nl> + int ( 380 ) <nl> + [ " key381 " ] = > <nl> + int ( 381 ) <nl> + [ " key382 " ] = > <nl> + int ( 382 ) <nl> + [ " key383 " ] = > <nl> + int ( 383 ) <nl> + [ " key384 " ] = > <nl> + int ( 384 ) <nl> + [ " key385 " ] = > <nl> + int ( 385 ) <nl> + [ " key386 " ] = > <nl> + int ( 386 ) <nl> + [ " key387 " ] = > <nl> + int ( 387 ) <nl> + [ " key388 " ] = > <nl> + int ( 388 ) <nl> + [ " key389 " ] = > <nl> + int ( 389 ) <nl> + [ " key390 " ] = > <nl> + int ( 390 ) <nl> + [ " key391 " ] = > <nl> + int ( 391 ) <nl> + [ " key392 " ] = > <nl> + int ( 392 ) <nl> + [ " key393 " ] = > <nl> + int ( 393 ) <nl> + [ " key394 " ] = > <nl> + int ( 394 ) <nl> + [ " key395 " ] = > <nl> + int ( 395 ) <nl> + [ " key396 " ] = > <nl> + int ( 396 ) <nl> + [ " key397 " ] = > <nl> + int ( 397 ) <nl> + [ " key398 " ] = > <nl> + int ( 398 ) <nl> + [ " key399 " ] = > <nl> + int ( 399 ) <nl> + [ " key400 " ] = > <nl> + int ( 400 ) <nl> + [ " key401 " ] = > <nl> + int ( 401 ) <nl> + [ " key402 " ] = > <nl> + int ( 402 ) <nl> + [ " key403 " ] = > <nl> + int ( 403 ) <nl> + [ " key404 " ] = > <nl> + int ( 404 ) <nl> + [ " key405 " ] = > <nl> + int ( 405 ) <nl> + [ " key406 " ] = > <nl> + int ( 406 ) <nl> + [ " key407 " ] = > <nl> + int ( 407 ) <nl> + [ " key408 " ] = > <nl> + int ( 408 ) <nl> + [ " key409 " ] = > <nl> + int ( 409 ) <nl> + [ " key410 " ] = > <nl> + int ( 410 ) <nl> + [ " key411 " ] = > <nl> + int ( 411 ) <nl> + [ " key412 " ] = > <nl> + int ( 412 ) <nl> + [ " key413 " ] = > <nl> + int ( 413 ) <nl> + [ " key414 " ] = > <nl> + int ( 414 ) <nl> + [ " key415 " ] = > <nl> + int ( 415 ) <nl> + [ " key416 " ] = > <nl> + int ( 416 ) <nl> + [ " key417 " ] = > <nl> + int ( 417 ) <nl> + [ " key418 " ] = > <nl> + int ( 418 ) <nl> + [ " key419 " ] = > <nl> + int ( 419 ) <nl> + [ " key420 " ] = > <nl> + int ( 420 ) <nl> + [ " key421 " ] = > <nl> + int ( 421 ) <nl> + [ " key422 " ] = > <nl> + int ( 422 ) <nl> + [ " key423 " ] = > <nl> + int ( 423 ) <nl> + [ " key424 " ] = > <nl> + int ( 424 ) <nl> + [ " key425 " ] = > <nl> + int ( 425 ) <nl> + [ " key426 " ] = > <nl> + int ( 426 ) <nl> + [ " key427 " ] = > <nl> + int ( 427 ) <nl> + [ " key428 " ] = > <nl> + int ( 428 ) <nl> + [ " key429 " ] = > <nl> + int ( 429 ) <nl> + [ " key430 " ] = > <nl> + int ( 430 ) <nl> + [ " key431 " ] = > <nl> + int ( 431 ) <nl> + [ " key432 " ] = > <nl> + int ( 432 ) <nl> + [ " key433 " ] = > <nl> + int ( 433 ) <nl> + [ " key434 " ] = > <nl> + int ( 434 ) <nl> + [ " key435 " ] = > <nl> + int ( 435 ) <nl> + [ " key436 " ] = > <nl> + int ( 436 ) <nl> + [ " key437 " ] = > <nl> + int ( 437 ) <nl> + [ " key438 " ] = > <nl> + int ( 438 ) <nl> + [ " key439 " ] = > <nl> + int ( 439 ) <nl> + [ " key440 " ] = > <nl> + int ( 440 ) <nl> + [ " key441 " ] = > <nl> + int ( 441 ) <nl> + [ " key442 " ] = > <nl> + int ( 442 ) <nl> + [ " key443 " ] = > <nl> + int ( 443 ) <nl> + [ " key444 " ] = > <nl> + int ( 444 ) <nl> + [ " key445 " ] = > <nl> + int ( 445 ) <nl> + [ " key446 " ] = > <nl> + int ( 446 ) <nl> + [ " key447 " ] = > <nl> + int ( 447 ) <nl> + [ " key448 " ] = > <nl> + int ( 448 ) <nl> + [ " key449 " ] = > <nl> + int ( 449 ) <nl> + [ " key450 " ] = > <nl> + int ( 450 ) <nl> + [ " key451 " ] = > <nl> + int ( 451 ) <nl> + [ " key452 " ] = > <nl> + int ( 452 ) <nl> + [ " key453 " ] = > <nl> + int ( 453 ) <nl> + [ " key454 " ] = > <nl> + int ( 454 ) <nl> + [ " key455 " ] = > <nl> + int ( 455 ) <nl> + [ " key456 " ] = > <nl> + int ( 456 ) <nl> + [ " key457 " ] = > <nl> + int ( 457 ) <nl> + [ " key458 " ] = > <nl> + int ( 458 ) <nl> + [ " key459 " ] = > <nl> + int ( 459 ) <nl> + [ " key460 " ] = > <nl> + int ( 460 ) <nl> + [ " key461 " ] = > <nl> + int ( 461 ) <nl> + [ " key462 " ] = > <nl> + int ( 462 ) <nl> + [ " key463 " ] = > <nl> + int ( 463 ) <nl> + [ " key464 " ] = > <nl> + int ( 464 ) <nl> + [ " key465 " ] = > <nl> + int ( 465 ) <nl> + [ " key466 " ] = > <nl> + int ( 466 ) <nl> + [ " key467 " ] = > <nl> + int ( 467 ) <nl> + [ " key468 " ] = > <nl> + int ( 468 ) <nl> + [ " key469 " ] = > <nl> + int ( 469 ) <nl> + [ " key470 " ] = > <nl> + int ( 470 ) <nl> + [ " key471 " ] = > <nl> + int ( 471 ) <nl> + [ " key472 " ] = > <nl> + int ( 472 ) <nl> + [ " key473 " ] = > <nl> + int ( 473 ) <nl> + [ " key474 " ] = > <nl> + int ( 474 ) <nl> + [ " key475 " ] = > <nl> + int ( 475 ) <nl> + [ " key476 " ] = > <nl> + int ( 476 ) <nl> + [ " key477 " ] = > <nl> + int ( 477 ) <nl> + [ " key478 " ] = > <nl> + int ( 478 ) <nl> + [ " key479 " ] = > <nl> + int ( 479 ) <nl> + [ " key480 " ] = > <nl> + int ( 480 ) <nl> + [ " key481 " ] = > <nl> + int ( 481 ) <nl> + [ " key482 " ] = > <nl> + int ( 482 ) <nl> + [ " key483 " ] = > <nl> + int ( 483 ) <nl> + [ " key484 " ] = > <nl> + int ( 484 ) <nl> + [ " key485 " ] = > <nl> + int ( 485 ) <nl> + [ " key486 " ] = > <nl> + int ( 486 ) <nl> + [ " key487 " ] = > <nl> + int ( 487 ) <nl> + [ " key488 " ] = > <nl> + int ( 488 ) <nl> + [ " key489 " ] = > <nl> + int ( 489 ) <nl> + [ " key490 " ] = > <nl> + int ( 490 ) <nl> + [ " key491 " ] = > <nl> + int ( 491 ) <nl> + [ " key492 " ] = > <nl> + int ( 492 ) <nl> + [ " key493 " ] = > <nl> + int ( 493 ) <nl> + [ " key494 " ] = > <nl> + int ( 494 ) <nl> + [ " key495 " ] = > <nl> + int ( 495 ) <nl> + [ " key496 " ] = > <nl> + int ( 496 ) <nl> + [ " key497 " ] = > <nl> + int ( 497 ) <nl> + [ " key498 " ] = > <nl> + int ( 498 ) <nl> + [ " key499 " ] = > <nl> + int ( 499 ) <nl> + [ " key500 " ] = > <nl> + int ( 500 ) <nl> + [ " key501 " ] = > <nl> + int ( 501 ) <nl> + [ " key502 " ] = > <nl> + int ( 502 ) <nl> + [ " key503 " ] = > <nl> + int ( 503 ) <nl> + [ " key504 " ] = > <nl> + int ( 504 ) <nl> + [ " key505 " ] = > <nl> + int ( 505 ) <nl> + [ " key506 " ] = > <nl> + int ( 506 ) <nl> + [ " key507 " ] = > <nl> + int ( 507 ) <nl> + [ " key508 " ] = > <nl> + int ( 508 ) <nl> + [ " key509 " ] = > <nl> + int ( 509 ) <nl> + [ " key510 " ] = > <nl> + int ( 510 ) <nl> + [ " key511 " ] = > <nl> + int ( 511 ) <nl> + [ " key512 " ] = > <nl> + int ( 512 ) <nl> + [ " key513 " ] = > <nl> + int ( 513 ) <nl> + [ " key514 " ] = > <nl> + int ( 514 ) <nl> + [ " key515 " ] = > <nl> + int ( 515 ) <nl> + [ " key516 " ] = > <nl> + int ( 516 ) <nl> + [ " key517 " ] = > <nl> + int ( 517 ) <nl> + [ " key518 " ] = > <nl> + int ( 518 ) <nl> + [ " key519 " ] = > <nl> + int ( 519 ) <nl> + [ " key520 " ] = > <nl> + int ( 520 ) <nl> + [ " key521 " ] = > <nl> + int ( 521 ) <nl> + [ " key522 " ] = > <nl> + int ( 522 ) <nl> + [ " key523 " ] = > <nl> + int ( 523 ) <nl> + [ " key524 " ] = > <nl> + int ( 524 ) <nl> + [ " key525 " ] = > <nl> + int ( 525 ) <nl> + [ " key526 " ] = > <nl> + int ( 526 ) <nl> + [ " key527 " ] = > <nl> + int ( 527 ) <nl> + [ " key528 " ] = > <nl> + int ( 528 ) <nl> + [ " key529 " ] = > <nl> + int ( 529 ) <nl> + [ " key530 " ] = > <nl> + int ( 530 ) <nl> + [ " key531 " ] = > <nl> + int ( 531 ) <nl> + [ " key532 " ] = > <nl> + int ( 532 ) <nl> + [ " key533 " ] = > <nl> + int ( 533 ) <nl> + [ " key534 " ] = > <nl> + int ( 534 ) <nl> + [ " key535 " ] = > <nl> + int ( 535 ) <nl> + [ " key536 " ] = > <nl> + int ( 536 ) <nl> + [ " key537 " ] = > <nl> + int ( 537 ) <nl> + [ " key538 " ] = > <nl> + int ( 538 ) <nl> + [ " key539 " ] = > <nl> + int ( 539 ) <nl> + [ " key540 " ] = > <nl> + int ( 540 ) <nl> + [ " key541 " ] = > <nl> + int ( 541 ) <nl> + [ " key542 " ] = > <nl> + int ( 542 ) <nl> + [ " key543 " ] = > <nl> + int ( 543 ) <nl> + [ " key544 " ] = > <nl> + int ( 544 ) <nl> + [ " key545 " ] = > <nl> + int ( 545 ) <nl> + [ " key546 " ] = > <nl> + int ( 546 ) <nl> + [ " key547 " ] = > <nl> + int ( 547 ) <nl> + [ " key548 " ] = > <nl> + int ( 548 ) <nl> + [ " key549 " ] = > <nl> + int ( 549 ) <nl> + [ " key550 " ] = > <nl> + int ( 550 ) <nl> + [ " key551 " ] = > <nl> + int ( 551 ) <nl> + [ " key552 " ] = > <nl> + int ( 552 ) <nl> + [ " key553 " ] = > <nl> + int ( 553 ) <nl> + [ " key554 " ] = > <nl> + int ( 554 ) <nl> + [ " key555 " ] = > <nl> + int ( 555 ) <nl> + [ " key556 " ] = > <nl> + int ( 556 ) <nl> + [ " key557 " ] = > <nl> + int ( 557 ) <nl> + [ " key558 " ] = > <nl> + int ( 558 ) <nl> + [ " key559 " ] = > <nl> + int ( 559 ) <nl> + [ " key560 " ] = > <nl> + int ( 560 ) <nl> + [ " key561 " ] = > <nl> + int ( 561 ) <nl> + [ " key562 " ] = > <nl> + int ( 562 ) <nl> + [ " key563 " ] = > <nl> + int ( 563 ) <nl> + [ " key564 " ] = > <nl> + int ( 564 ) <nl> + [ " key565 " ] = > <nl> + int ( 565 ) <nl> + [ " key566 " ] = > <nl> + int ( 566 ) <nl> + [ " key567 " ] = > <nl> + int ( 567 ) <nl> + [ " key568 " ] = > <nl> + int ( 568 ) <nl> + [ " key569 " ] = > <nl> + int ( 569 ) <nl> + [ " key570 " ] = > <nl> + int ( 570 ) <nl> + [ " key571 " ] = > <nl> + int ( 571 ) <nl> + [ " key572 " ] = > <nl> + int ( 572 ) <nl> + [ " key573 " ] = > <nl> + int ( 573 ) <nl> + [ " key574 " ] = > <nl> + int ( 574 ) <nl> + [ " key575 " ] = > <nl> + int ( 575 ) <nl> + [ " key576 " ] = > <nl> + int ( 576 ) <nl> + [ " key577 " ] = > <nl> + int ( 577 ) <nl> + [ " key578 " ] = > <nl> + int ( 578 ) <nl> + [ " key579 " ] = > <nl> + int ( 579 ) <nl> + [ " key580 " ] = > <nl> + int ( 580 ) <nl> + [ " key581 " ] = > <nl> + int ( 581 ) <nl> + [ " key582 " ] = > <nl> + int ( 582 ) <nl> + [ " key583 " ] = > <nl> + int ( 583 ) <nl> + [ " key584 " ] = > <nl> + int ( 584 ) <nl> + [ " key585 " ] = > <nl> + int ( 585 ) <nl> + [ " key586 " ] = > <nl> + int ( 586 ) <nl> + [ " key587 " ] = > <nl> + int ( 587 ) <nl> + [ " key588 " ] = > <nl> + int ( 588 ) <nl> + [ " key589 " ] = > <nl> + int ( 589 ) <nl> + [ " key590 " ] = > <nl> + int ( 590 ) <nl> + [ " key591 " ] = > <nl> + int ( 591 ) <nl> + [ " key592 " ] = > <nl> + int ( 592 ) <nl> + [ " key593 " ] = > <nl> + int ( 593 ) <nl> + [ " key594 " ] = > <nl> + int ( 594 ) <nl> + [ " key595 " ] = > <nl> + int ( 595 ) <nl> + [ " key596 " ] = > <nl> + int ( 596 ) <nl> + [ " key597 " ] = > <nl> + int ( 597 ) <nl> + [ " key598 " ] = > <nl> + int ( 598 ) <nl> + [ " key599 " ] = > <nl> + int ( 599 ) <nl> + [ " key600 " ] = > <nl> + int ( 600 ) <nl> + [ " key601 " ] = > <nl> + int ( 601 ) <nl> + [ " key602 " ] = > <nl> + int ( 602 ) <nl> + [ " key603 " ] = > <nl> + int ( 603 ) <nl> + [ " key604 " ] = > <nl> + int ( 604 ) <nl> + [ " key605 " ] = > <nl> + int ( 605 ) <nl> + [ " key606 " ] = > <nl> + int ( 606 ) <nl> + [ " key607 " ] = > <nl> + int ( 607 ) <nl> + [ " key608 " ] = > <nl> + int ( 608 ) <nl> + [ " key609 " ] = > <nl> + int ( 609 ) <nl> + [ " key610 " ] = > <nl> + int ( 610 ) <nl> + [ " key611 " ] = > <nl> + int ( 611 ) <nl> + [ " key612 " ] = > <nl> + int ( 612 ) <nl> + [ " key613 " ] = > <nl> + int ( 613 ) <nl> + [ " key614 " ] = > <nl> + int ( 614 ) <nl> + [ " key615 " ] = > <nl> + int ( 615 ) <nl> + [ " key616 " ] = > <nl> + int ( 616 ) <nl> + [ " key617 " ] = > <nl> + int ( 617 ) <nl> + [ " key618 " ] = > <nl> + int ( 618 ) <nl> + [ " key619 " ] = > <nl> + int ( 619 ) <nl> + [ " key620 " ] = > <nl> + int ( 620 ) <nl> + [ " key621 " ] = > <nl> + int ( 621 ) <nl> + [ " key622 " ] = > <nl> + int ( 622 ) <nl> + [ " key623 " ] = > <nl> + int ( 623 ) <nl> + [ " key624 " ] = > <nl> + int ( 624 ) <nl> + [ " key625 " ] = > <nl> + int ( 625 ) <nl> + [ " key626 " ] = > <nl> + int ( 626 ) <nl> + [ " key627 " ] = > <nl> + int ( 627 ) <nl> + [ " key628 " ] = > <nl> + int ( 628 ) <nl> + [ " key629 " ] = > <nl> + int ( 629 ) <nl> + [ " key630 " ] = > <nl> + int ( 630 ) <nl> + [ " key631 " ] = > <nl> + int ( 631 ) <nl> + [ " key632 " ] = > <nl> + int ( 632 ) <nl> + [ " key633 " ] = > <nl> + int ( 633 ) <nl> + [ " key634 " ] = > <nl> + int ( 634 ) <nl> + [ " key635 " ] = > <nl> + int ( 635 ) <nl> + [ " key636 " ] = > <nl> + int ( 636 ) <nl> + [ " key637 " ] = > <nl> + int ( 637 ) <nl> + [ " key638 " ] = > <nl> + int ( 638 ) <nl> + [ " key639 " ] = > <nl> + int ( 639 ) <nl> + [ " key640 " ] = > <nl> + int ( 640 ) <nl> + [ " key641 " ] = > <nl> + int ( 641 ) <nl> + [ " key642 " ] = > <nl> + int ( 642 ) <nl> + [ " key643 " ] = > <nl> + int ( 643 ) <nl> + [ " key644 " ] = > <nl> + int ( 644 ) <nl> + [ " key645 " ] = > <nl> + int ( 645 ) <nl> + [ " key646 " ] = > <nl> + int ( 646 ) <nl> + [ " key647 " ] = > <nl> + int ( 647 ) <nl> + [ " key648 " ] = > <nl> + int ( 648 ) <nl> + [ " key649 " ] = > <nl> + int ( 649 ) <nl> + [ " key650 " ] = > <nl> + int ( 650 ) <nl> + [ " key651 " ] = > <nl> + int ( 651 ) <nl> + [ " key652 " ] = > <nl> + int ( 652 ) <nl> + [ " key653 " ] = > <nl> + int ( 653 ) <nl> + [ " key654 " ] = > <nl> + int ( 654 ) <nl> + [ " key655 " ] = > <nl> + int ( 655 ) <nl> + [ " key656 " ] = > <nl> + int ( 656 ) <nl> + [ " key657 " ] = > <nl> + int ( 657 ) <nl> + [ " key658 " ] = > <nl> + int ( 658 ) <nl> + [ " key659 " ] = > <nl> + int ( 659 ) <nl> + [ " key660 " ] = > <nl> + int ( 660 ) <nl> + [ " key661 " ] = > <nl> + int ( 661 ) <nl> + [ " key662 " ] = > <nl> + int ( 662 ) <nl> + [ " key663 " ] = > <nl> + int ( 663 ) <nl> + [ " key664 " ] = > <nl> + int ( 664 ) <nl> + [ " key665 " ] = > <nl> + int ( 665 ) <nl> + [ " key666 " ] = > <nl> + int ( 666 ) <nl> + [ " key667 " ] = > <nl> + int ( 667 ) <nl> + [ " key668 " ] = > <nl> + int ( 668 ) <nl> + [ " key669 " ] = > <nl> + int ( 669 ) <nl> + [ " key670 " ] = > <nl> + int ( 670 ) <nl> + [ " key671 " ] = > <nl> + int ( 671 ) <nl> + [ " key672 " ] = > <nl> + int ( 672 ) <nl> + [ " key673 " ] = > <nl> + int ( 673 ) <nl> + [ " key674 " ] = > <nl> + int ( 674 ) <nl> + [ " key675 " ] = > <nl> + int ( 675 ) <nl> + [ " key676 " ] = > <nl> + int ( 676 ) <nl> + [ " key677 " ] = > <nl> + int ( 677 ) <nl> + [ " key678 " ] = > <nl> + int ( 678 ) <nl> + [ " key679 " ] = > <nl> + int ( 679 ) <nl> + [ " key680 " ] = > <nl> + int ( 680 ) <nl> + [ " key681 " ] = > <nl> + int ( 681 ) <nl> + [ " key682 " ] = > <nl> + int ( 682 ) <nl> + [ " key683 " ] = > <nl> + int ( 683 ) <nl> + [ " key684 " ] = > <nl> + int ( 684 ) <nl> + [ " key685 " ] = > <nl> + int ( 685 ) <nl> + [ " key686 " ] = > <nl> + int ( 686 ) <nl> + [ " key687 " ] = > <nl> + int ( 687 ) <nl> + [ " key688 " ] = > <nl> + int ( 688 ) <nl> + [ " key689 " ] = > <nl> + int ( 689 ) <nl> + [ " key690 " ] = > <nl> + int ( 690 ) <nl> + [ " key691 " ] = > <nl> + int ( 691 ) <nl> + [ " key692 " ] = > <nl> + int ( 692 ) <nl> + [ " key693 " ] = > <nl> + int ( 693 ) <nl> + [ " key694 " ] = > <nl> + int ( 694 ) <nl> + [ " key695 " ] = > <nl> + int ( 695 ) <nl> + [ " key696 " ] = > <nl> + int ( 696 ) <nl> + [ " key697 " ] = > <nl> + int ( 697 ) <nl> + [ " key698 " ] = > <nl> + int ( 698 ) <nl> + [ " key699 " ] = > <nl> + int ( 699 ) <nl> + [ " key700 " ] = > <nl> + int ( 700 ) <nl> + [ " key701 " ] = > <nl> + int ( 701 ) <nl> + [ " key702 " ] = > <nl> + int ( 702 ) <nl> + [ " key703 " ] = > <nl> + int ( 703 ) <nl> + [ " key704 " ] = > <nl> + int ( 704 ) <nl> + [ " key705 " ] = > <nl> + int ( 705 ) <nl> + [ " key706 " ] = > <nl> + int ( 706 ) <nl> + [ " key707 " ] = > <nl> + int ( 707 ) <nl> + [ " key708 " ] = > <nl> + int ( 708 ) <nl> + [ " key709 " ] = > <nl> + int ( 709 ) <nl> + [ " key710 " ] = > <nl> + int ( 710 ) <nl> + [ " key711 " ] = > <nl> + int ( 711 ) <nl> + [ " key712 " ] = > <nl> + int ( 712 ) <nl> + [ " key713 " ] = > <nl> + int ( 713 ) <nl> + [ " key714 " ] = > <nl> + int ( 714 ) <nl> + [ " key715 " ] = > <nl> + int ( 715 ) <nl> + [ " key716 " ] = > <nl> + int ( 716 ) <nl> + [ " key717 " ] = > <nl> + int ( 717 ) <nl> + [ " key718 " ] = > <nl> + int ( 718 ) <nl> + [ " key719 " ] = > <nl> + int ( 719 ) <nl> + [ " key720 " ] = > <nl> + int ( 720 ) <nl> + [ " key721 " ] = > <nl> + int ( 721 ) <nl> + [ " key722 " ] = > <nl> + int ( 722 ) <nl> + [ " key723 " ] = > <nl> + int ( 723 ) <nl> + [ " key724 " ] = > <nl> + int ( 724 ) <nl> + [ " key725 " ] = > <nl> + int ( 725 ) <nl> + [ " key726 " ] = > <nl> + int ( 726 ) <nl> + [ " key727 " ] = > <nl> + int ( 727 ) <nl> + [ " key728 " ] = > <nl> + int ( 728 ) <nl> + [ " key729 " ] = > <nl> + int ( 729 ) <nl> + [ " key730 " ] = > <nl> + int ( 730 ) <nl> + [ " key731 " ] = > <nl> + int ( 731 ) <nl> + [ " key732 " ] = > <nl> + int ( 732 ) <nl> + [ " key733 " ] = > <nl> + int ( 733 ) <nl> + [ " key734 " ] = > <nl> + int ( 734 ) <nl> + [ " key735 " ] = > <nl> + int ( 735 ) <nl> + [ " key736 " ] = > <nl> + int ( 736 ) <nl> + [ " key737 " ] = > <nl> + int ( 737 ) <nl> + [ " key738 " ] = > <nl> + int ( 738 ) <nl> + [ " key739 " ] = > <nl> + int ( 739 ) <nl> + [ " key740 " ] = > <nl> + int ( 740 ) <nl> + [ " key741 " ] = > <nl> + int ( 741 ) <nl> + [ " key742 " ] = > <nl> + int ( 742 ) <nl> + [ " key743 " ] = > <nl> + int ( 743 ) <nl> + [ " key744 " ] = > <nl> + int ( 744 ) <nl> + [ " key745 " ] = > <nl> + int ( 745 ) <nl> + [ " key746 " ] = > <nl> + int ( 746 ) <nl> + [ " key747 " ] = > <nl> + int ( 747 ) <nl> + [ " key748 " ] = > <nl> + int ( 748 ) <nl> + [ " key749 " ] = > <nl> + int ( 749 ) <nl> + [ " key750 " ] = > <nl> + int ( 750 ) <nl> + [ " key751 " ] = > <nl> + int ( 751 ) <nl> + [ " key752 " ] = > <nl> + int ( 752 ) <nl> + [ " key753 " ] = > <nl> + int ( 753 ) <nl> + [ " key754 " ] = > <nl> + int ( 754 ) <nl> + [ " key755 " ] = > <nl> + int ( 755 ) <nl> + [ " key756 " ] = > <nl> + int ( 756 ) <nl> + [ " key757 " ] = > <nl> + int ( 757 ) <nl> + [ " key758 " ] = > <nl> + int ( 758 ) <nl> + [ " key759 " ] = > <nl> + int ( 759 ) <nl> + [ " key760 " ] = > <nl> + int ( 760 ) <nl> + [ " key761 " ] = > <nl> + int ( 761 ) <nl> + [ " key762 " ] = > <nl> + int ( 762 ) <nl> + [ " key763 " ] = > <nl> + int ( 763 ) <nl> + [ " key764 " ] = > <nl> + int ( 764 ) <nl> + [ " key765 " ] = > <nl> + int ( 765 ) <nl> + [ " key766 " ] = > <nl> + int ( 766 ) <nl> + [ " key767 " ] = > <nl> + int ( 767 ) <nl> + [ " key768 " ] = > <nl> + int ( 768 ) <nl> + [ " key769 " ] = > <nl> + int ( 769 ) <nl> + [ " key770 " ] = > <nl> + int ( 770 ) <nl> + [ " key771 " ] = > <nl> + int ( 771 ) <nl> + [ " key772 " ] = > <nl> + int ( 772 ) <nl> + [ " key773 " ] = > <nl> + int ( 773 ) <nl> + [ " key774 " ] = > <nl> + int ( 774 ) <nl> + [ " key775 " ] = > <nl> + int ( 775 ) <nl> + [ " key776 " ] = > <nl> + int ( 776 ) <nl> + [ " key777 " ] = > <nl> + int ( 777 ) <nl> + [ " key778 " ] = > <nl> + int ( 778 ) <nl> + [ " key779 " ] = > <nl> + int ( 779 ) <nl> + [ " key780 " ] = > <nl> + int ( 780 ) <nl> + [ " key781 " ] = > <nl> + int ( 781 ) <nl> + [ " key782 " ] = > <nl> + int ( 782 ) <nl> + [ " key783 " ] = > <nl> + int ( 783 ) <nl> + [ " key784 " ] = > <nl> + int ( 784 ) <nl> + [ " key785 " ] = > <nl> + int ( 785 ) <nl> + [ " key786 " ] = > <nl> + int ( 786 ) <nl> + [ " key787 " ] = > <nl> + int ( 787 ) <nl> + [ " key788 " ] = > <nl> + int ( 788 ) <nl> + [ " key789 " ] = > <nl> + int ( 789 ) <nl> + [ " key790 " ] = > <nl> + int ( 790 ) <nl> + [ " key791 " ] = > <nl> + int ( 791 ) <nl> + [ " key792 " ] = > <nl> + int ( 792 ) <nl> + [ " key793 " ] = > <nl> + int ( 793 ) <nl> + [ " key794 " ] = > <nl> + int ( 794 ) <nl> + [ " key795 " ] = > <nl> + int ( 795 ) <nl> + [ " key796 " ] = > <nl> + int ( 796 ) <nl> + [ " key797 " ] = > <nl> + int ( 797 ) <nl> + [ " key798 " ] = > <nl> + int ( 798 ) <nl> + [ " key799 " ] = > <nl> + int ( 799 ) <nl> + [ " key800 " ] = > <nl> + int ( 800 ) <nl> + [ " key801 " ] = > <nl> + int ( 801 ) <nl> + [ " key802 " ] = > <nl> + int ( 802 ) <nl> + [ " key803 " ] = > <nl> + int ( 803 ) <nl> + [ " key804 " ] = > <nl> + int ( 804 ) <nl> + [ " key805 " ] = > <nl> + int ( 805 ) <nl> + [ " key806 " ] = > <nl> + int ( 806 ) <nl> + [ " key807 " ] = > <nl> + int ( 807 ) <nl> + [ " key808 " ] = > <nl> + int ( 808 ) <nl> + [ " key809 " ] = > <nl> + int ( 809 ) <nl> + [ " key810 " ] = > <nl> + int ( 810 ) <nl> + [ " key811 " ] = > <nl> + int ( 811 ) <nl> + [ " key812 " ] = > <nl> + int ( 812 ) <nl> + [ " key813 " ] = > <nl> + int ( 813 ) <nl> + [ " key814 " ] = > <nl> + int ( 814 ) <nl> + [ " key815 " ] = > <nl> + int ( 815 ) <nl> + [ " key816 " ] = > <nl> + int ( 816 ) <nl> + [ " key817 " ] = > <nl> + int ( 817 ) <nl> + [ " key818 " ] = > <nl> + int ( 818 ) <nl> + [ " key819 " ] = > <nl> + int ( 819 ) <nl> + [ " key820 " ] = > <nl> + int ( 820 ) <nl> + [ " key821 " ] = > <nl> + int ( 821 ) <nl> + [ " key822 " ] = > <nl> + int ( 822 ) <nl> + [ " key823 " ] = > <nl> + int ( 823 ) <nl> + [ " key824 " ] = > <nl> + int ( 824 ) <nl> + [ " key825 " ] = > <nl> + int ( 825 ) <nl> + [ " key826 " ] = > <nl> + int ( 826 ) <nl> + [ " key827 " ] = > <nl> + int ( 827 ) <nl> + [ " key828 " ] = > <nl> + int ( 828 ) <nl> + [ " key829 " ] = > <nl> + int ( 829 ) <nl> + [ " key830 " ] = > <nl> + int ( 830 ) <nl> + [ " key831 " ] = > <nl> + int ( 831 ) <nl> + [ " key832 " ] = > <nl> + int ( 832 ) <nl> + [ " key833 " ] = > <nl> + int ( 833 ) <nl> + [ " key834 " ] = > <nl> + int ( 834 ) <nl> + [ " key835 " ] = > <nl> + int ( 835 ) <nl> + [ " key836 " ] = > <nl> + int ( 836 ) <nl> + [ " key837 " ] = > <nl> + int ( 837 ) <nl> + [ " key838 " ] = > <nl> + int ( 838 ) <nl> + [ " key839 " ] = > <nl> + int ( 839 ) <nl> + [ " key840 " ] = > <nl> + int ( 840 ) <nl> + [ " key841 " ] = > <nl> + int ( 841 ) <nl> + [ " key842 " ] = > <nl> + int ( 842 ) <nl> + [ " key843 " ] = > <nl> + int ( 843 ) <nl> + [ " key844 " ] = > <nl> + int ( 844 ) <nl> + [ " key845 " ] = > <nl> + int ( 845 ) <nl> + [ " key846 " ] = > <nl> + int ( 846 ) <nl> + [ " key847 " ] = > <nl> + int ( 847 ) <nl> + [ " key848 " ] = > <nl> + int ( 848 ) <nl> + [ " key849 " ] = > <nl> + int ( 849 ) <nl> + [ " key850 " ] = > <nl> + int ( 850 ) <nl> + [ " key851 " ] = > <nl> + int ( 851 ) <nl> + [ " key852 " ] = > <nl> + int ( 852 ) <nl> + [ " key853 " ] = > <nl> + int ( 853 ) <nl> + [ " key854 " ] = > <nl> + int ( 854 ) <nl> + [ " key855 " ] = > <nl> + int ( 855 ) <nl> + [ " key856 " ] = > <nl> + int ( 856 ) <nl> + [ " key857 " ] = > <nl> + int ( 857 ) <nl> + [ " key858 " ] = > <nl> + int ( 858 ) <nl> + [ " key859 " ] = > <nl> + int ( 859 ) <nl> + [ " key860 " ] = > <nl> + int ( 860 ) <nl> + [ " key861 " ] = > <nl> + int ( 861 ) <nl> + [ " key862 " ] = > <nl> + int ( 862 ) <nl> + [ " key863 " ] = > <nl> + int ( 863 ) <nl> + [ " key864 " ] = > <nl> + int ( 864 ) <nl> + [ " key865 " ] = > <nl> + int ( 865 ) <nl> + [ " key866 " ] = > <nl> + int ( 866 ) <nl> + [ " key867 " ] = > <nl> + int ( 867 ) <nl> + [ " key868 " ] = > <nl> + int ( 868 ) <nl> + [ " key869 " ] = > <nl> + int ( 869 ) <nl> + [ " key870 " ] = > <nl> + int ( 870 ) <nl> + [ " key871 " ] = > <nl> + int ( 871 ) <nl> + [ " key872 " ] = > <nl> + int ( 872 ) <nl> + [ " key873 " ] = > <nl> + int ( 873 ) <nl> + [ " key874 " ] = > <nl> + int ( 874 ) <nl> + [ " key875 " ] = > <nl> + int ( 875 ) <nl> + [ " key876 " ] = > <nl> + int ( 876 ) <nl> + [ " key877 " ] = > <nl> + int ( 877 ) <nl> + [ " key878 " ] = > <nl> + int ( 878 ) <nl> + [ " key879 " ] = > <nl> + int ( 879 ) <nl> + [ " key880 " ] = > <nl> + int ( 880 ) <nl> + [ " key881 " ] = > <nl> + int ( 881 ) <nl> + [ " key882 " ] = > <nl> + int ( 882 ) <nl> + [ " key883 " ] = > <nl> + int ( 883 ) <nl> + [ " key884 " ] = > <nl> + int ( 884 ) <nl> + [ " key885 " ] = > <nl> + int ( 885 ) <nl> + [ " key886 " ] = > <nl> + int ( 886 ) <nl> + [ " key887 " ] = > <nl> + int ( 887 ) <nl> + [ " key888 " ] = > <nl> + int ( 888 ) <nl> + [ " key889 " ] = > <nl> + int ( 889 ) <nl> + [ " key890 " ] = > <nl> + int ( 890 ) <nl> + [ " key891 " ] = > <nl> + int ( 891 ) <nl> + [ " key892 " ] = > <nl> + int ( 892 ) <nl> + [ " key893 " ] = > <nl> + int ( 893 ) <nl> + [ " key894 " ] = > <nl> + int ( 894 ) <nl> + [ " key895 " ] = > <nl> + int ( 895 ) <nl> + [ " key896 " ] = > <nl> + int ( 896 ) <nl> + [ " key897 " ] = > <nl> + int ( 897 ) <nl> + [ " key898 " ] = > <nl> + int ( 898 ) <nl> + [ " key899 " ] = > <nl> + int ( 899 ) <nl> + [ " key900 " ] = > <nl> + int ( 900 ) <nl> + [ " key901 " ] = > <nl> + int ( 901 ) <nl> + [ " key902 " ] = > <nl> + int ( 902 ) <nl> + [ " key903 " ] = > <nl> + int ( 903 ) <nl> + [ " key904 " ] = > <nl> + int ( 904 ) <nl> + [ " key905 " ] = > <nl> + int ( 905 ) <nl> + [ " key906 " ] = > <nl> + int ( 906 ) <nl> + [ " key907 " ] = > <nl> + int ( 907 ) <nl> + [ " key908 " ] = > <nl> + int ( 908 ) <nl> + [ " key909 " ] = > <nl> + int ( 909 ) <nl> + [ " key910 " ] = > <nl> + int ( 910 ) <nl> + [ " key911 " ] = > <nl> + int ( 911 ) <nl> + [ " key912 " ] = > <nl> + int ( 912 ) <nl> + [ " key913 " ] = > <nl> + int ( 913 ) <nl> + [ " key914 " ] = > <nl> + int ( 914 ) <nl> + [ " key915 " ] = > <nl> + int ( 915 ) <nl> + [ " key916 " ] = > <nl> + int ( 916 ) <nl> + [ " key917 " ] = > <nl> + int ( 917 ) <nl> + [ " key918 " ] = > <nl> + int ( 918 ) <nl> + [ " key919 " ] = > <nl> + int ( 919 ) <nl> + [ " key920 " ] = > <nl> + int ( 920 ) <nl> + [ " key921 " ] = > <nl> + int ( 921 ) <nl> + [ " key922 " ] = > <nl> + int ( 922 ) <nl> + [ " key923 " ] = > <nl> + int ( 923 ) <nl> + [ " key924 " ] = > <nl> + int ( 924 ) <nl> + [ " key925 " ] = > <nl> + int ( 925 ) <nl> + [ " key926 " ] = > <nl> + int ( 926 ) <nl> + [ " key927 " ] = > <nl> + int ( 927 ) <nl> + [ " key928 " ] = > <nl> + int ( 928 ) <nl> + [ " key929 " ] = > <nl> + int ( 929 ) <nl> + [ " key930 " ] = > <nl> + int ( 930 ) <nl> + [ " key931 " ] = > <nl> + int ( 931 ) <nl> + [ " key932 " ] = > <nl> + int ( 932 ) <nl> + [ " key933 " ] = > <nl> + int ( 933 ) <nl> + [ " key934 " ] = > <nl> + int ( 934 ) <nl> + [ " key935 " ] = > <nl> + int ( 935 ) <nl> + [ " key936 " ] = > <nl> + int ( 936 ) <nl> + [ " key937 " ] = > <nl> + int ( 937 ) <nl> + [ " key938 " ] = > <nl> + int ( 938 ) <nl> + [ " key939 " ] = > <nl> + int ( 939 ) <nl> + [ " key940 " ] = > <nl> + int ( 940 ) <nl> + [ " key941 " ] = > <nl> + int ( 941 ) <nl> + [ " key942 " ] = > <nl> + int ( 942 ) <nl> + [ " key943 " ] = > <nl> + int ( 943 ) <nl> + [ " key944 " ] = > <nl> + int ( 944 ) <nl> + [ " key945 " ] = > <nl> + int ( 945 ) <nl> + [ " key946 " ] = > <nl> + int ( 946 ) <nl> + [ " key947 " ] = > <nl> + int ( 947 ) <nl> + [ " key948 " ] = > <nl> + int ( 948 ) <nl> + [ " key949 " ] = > <nl> + int ( 949 ) <nl> + [ " key950 " ] = > <nl> + int ( 950 ) <nl> + [ " key951 " ] = > <nl> + int ( 951 ) <nl> + [ " key952 " ] = > <nl> + int ( 952 ) <nl> + [ " key953 " ] = > <nl> + int ( 953 ) <nl> + [ " key954 " ] = > <nl> + int ( 954 ) <nl> + [ " key955 " ] = > <nl> + int ( 955 ) <nl> + [ " key956 " ] = > <nl> + int ( 956 ) <nl> + [ " key957 " ] = > <nl> + int ( 957 ) <nl> + [ " key958 " ] = > <nl> + int ( 958 ) <nl> + [ " key959 " ] = > <nl> + int ( 959 ) <nl> + [ " key960 " ] = > <nl> + int ( 960 ) <nl> + [ " key961 " ] = > <nl> + int ( 961 ) <nl> + [ " key962 " ] = > <nl> + int ( 962 ) <nl> + [ " key963 " ] = > <nl> + int ( 963 ) <nl> + [ " key964 " ] = > <nl> + int ( 964 ) <nl> + [ " key965 " ] = > <nl> + int ( 965 ) <nl> + [ " key966 " ] = > <nl> + int ( 966 ) <nl> + [ " key967 " ] = > <nl> + int ( 967 ) <nl> + [ " key968 " ] = > <nl> + int ( 968 ) <nl> + [ " key969 " ] = > <nl> + int ( 969 ) <nl> + [ " key970 " ] = > <nl> + int ( 970 ) <nl> + [ " key971 " ] = > <nl> + int ( 971 ) <nl> + [ " key972 " ] = > <nl> + int ( 972 ) <nl> + [ " key973 " ] = > <nl> + int ( 973 ) <nl> + [ " key974 " ] = > <nl> + int ( 974 ) <nl> + [ " key975 " ] = > <nl> + int ( 975 ) <nl> + [ " key976 " ] = > <nl> + int ( 976 ) <nl> + [ " key977 " ] = > <nl> + int ( 977 ) <nl> + [ " key978 " ] = > <nl> + int ( 978 ) <nl> + [ " key979 " ] = > <nl> + int ( 979 ) <nl> + [ " key980 " ] = > <nl> + int ( 980 ) <nl> + [ " key981 " ] = > <nl> + int ( 981 ) <nl> + [ " key982 " ] = > <nl> + int ( 982 ) <nl> + [ " key983 " ] = > <nl> + int ( 983 ) <nl> + [ " key984 " ] = > <nl> + int ( 984 ) <nl> + [ " key985 " ] = > <nl> + int ( 985 ) <nl> + [ " key986 " ] = > <nl> + int ( 986 ) <nl> + [ " key987 " ] = > <nl> + int ( 987 ) <nl> + [ " key988 " ] = > <nl> + int ( 988 ) <nl> + [ " key989 " ] = > <nl> + int ( 989 ) <nl> + [ " key990 " ] = > <nl> + int ( 990 ) <nl> + [ " key991 " ] = > <nl> + int ( 991 ) <nl> + [ " key992 " ] = > <nl> + int ( 992 ) <nl> + [ " key993 " ] = > <nl> + int ( 993 ) <nl> + [ " key994 " ] = > <nl> + int ( 994 ) <nl> + [ " key995 " ] = > <nl> + int ( 995 ) <nl> + [ " key996 " ] = > <nl> + int ( 996 ) <nl> + [ " key997 " ] = > <nl> + int ( 997 ) <nl> + [ " key998 " ] = > <nl> + int ( 998 ) <nl> + [ " key999 " ] = > <nl> + int ( 999 ) <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . db5decebe51 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / serialization / map_unser_big . php <nl> <nl> + < ? hh <nl> + / / Same as map_unser . php , but with - vServer . UnserializationBigMapThreshold = 1 <nl> + <nl> + $ data = [ <nl> + ' K : 6 : " HH \ \ Map " : 0 : { } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : 3 : " bar " ; i : 7 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : 3 : " bar " ; i : ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : 3 : " bar " ; i : - ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 1 : { s : : " " ; i : ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; i : 456 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : - 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 55 : " bling " ; i : 123 ; } ' , <nl> + ' K : 6 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } blah ' , <nl> + ' K : 7 : " HH \ \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ' <nl> + ] ; <nl> + <nl> + foreach ( $ data as $ serialized ) { <nl> + var_dump ( unserialize ( $ serialized ) ) ; <nl> + } <nl> + <nl> + function makeBig ( $ n ) { <nl> + $ m = Map { ' foo ' = > 123 , ' bar ' = > 9876543210 } ; <nl> + for ( $ i = 0 ; $ i < $ n ; $ i + = 1 ) { <nl> + $ m [ ' key ' . $ i ] = $ i ; <nl> + } <nl> + return $ m ; <nl> + } <nl> + <nl> + $ sizes = [ 0 , 1 , 100 , 1000 ] ; <nl> + <nl> + foreach ( $ sizes as $ n ) { <nl> + var_dump ( unserialize ( serialize ( makeBig ( $ n ) ) ) ) ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 51082cd46a5 <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / serialization / map_unser_big . php . expectf <nl> <nl> + object ( HH \ Map ) # 1 ( 0 ) { <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " bar " ] = > <nl> + int ( 7 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " bar " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " bar " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1 ) { <nl> + [ " " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " bar " ] = > <nl> + int ( 3 ) <nl> + [ " bling " ] = > <nl> + int ( 123 ) <nl> + } <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; } ] . Expected ' } ' but got ' s ' . in % s / test / slow / serialization / map_unser_big . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; s : 5 : " extra " ; i : 456 ; } ] . Expected ' } ' but got ' s ' . in % s / test / slow / serialization / map_unser_big . php on line 23 <nl> + bool ( false ) <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " bar " ] = > <nl> + int ( 3 ) <nl> + [ " bling " ] = > <nl> + int ( 123 ) <nl> + } <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; ] . Unexpected end of buffer during unserialization . in % s / test / slow / serialization / map_unser_big . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ] . Unexpected end of buffer during unserialization . in % s / test / slow / serialization / map_unser_big . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : - 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ] . Size of serialized string ( - 3 ) must not be negative . in % s / test / slow / serialization / map_unser_big . php on line 23 <nl> + bool ( false ) <nl> + <nl> + Notice : Unable to unserialize : [ K : 6 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 55 : " bling " ; i : 123 ; } ] . Unexpected end of buffer during unserialization . in % s / test / slow / serialization / map_unser_big . php on line 23 <nl> + bool ( false ) <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " bar " ] = > <nl> + int ( 3 ) <nl> + [ " bling " ] = > <nl> + int ( 123 ) <nl> + } <nl> + <nl> + Notice : Unable to unserialize : [ K : 7 : " HH \ Map " : 2 : { s : 3 : " bar " ; i : 3 ; s : 5 : " bling " ; i : 123 ; } ] . Expected ' " ' but got ' : ' . in % s / test / slow / serialization / map_unser_big . php on line 23 <nl> + bool ( false ) <nl> + object ( HH \ Map ) # 1 ( 2 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 3 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + [ " key0 " ] = > <nl> + int ( 0 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 102 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + [ " key0 " ] = > <nl> + int ( 0 ) <nl> + [ " key1 " ] = > <nl> + int ( 1 ) <nl> + [ " key2 " ] = > <nl> + int ( 2 ) <nl> + [ " key3 " ] = > <nl> + int ( 3 ) <nl> + [ " key4 " ] = > <nl> + int ( 4 ) <nl> + [ " key5 " ] = > <nl> + int ( 5 ) <nl> + [ " key6 " ] = > <nl> + int ( 6 ) <nl> + [ " key7 " ] = > <nl> + int ( 7 ) <nl> + [ " key8 " ] = > <nl> + int ( 8 ) <nl> + [ " key9 " ] = > <nl> + int ( 9 ) <nl> + [ " key10 " ] = > <nl> + int ( 10 ) <nl> + [ " key11 " ] = > <nl> + int ( 11 ) <nl> + [ " key12 " ] = > <nl> + int ( 12 ) <nl> + [ " key13 " ] = > <nl> + int ( 13 ) <nl> + [ " key14 " ] = > <nl> + int ( 14 ) <nl> + [ " key15 " ] = > <nl> + int ( 15 ) <nl> + [ " key16 " ] = > <nl> + int ( 16 ) <nl> + [ " key17 " ] = > <nl> + int ( 17 ) <nl> + [ " key18 " ] = > <nl> + int ( 18 ) <nl> + [ " key19 " ] = > <nl> + int ( 19 ) <nl> + [ " key20 " ] = > <nl> + int ( 20 ) <nl> + [ " key21 " ] = > <nl> + int ( 21 ) <nl> + [ " key22 " ] = > <nl> + int ( 22 ) <nl> + [ " key23 " ] = > <nl> + int ( 23 ) <nl> + [ " key24 " ] = > <nl> + int ( 24 ) <nl> + [ " key25 " ] = > <nl> + int ( 25 ) <nl> + [ " key26 " ] = > <nl> + int ( 26 ) <nl> + [ " key27 " ] = > <nl> + int ( 27 ) <nl> + [ " key28 " ] = > <nl> + int ( 28 ) <nl> + [ " key29 " ] = > <nl> + int ( 29 ) <nl> + [ " key30 " ] = > <nl> + int ( 30 ) <nl> + [ " key31 " ] = > <nl> + int ( 31 ) <nl> + [ " key32 " ] = > <nl> + int ( 32 ) <nl> + [ " key33 " ] = > <nl> + int ( 33 ) <nl> + [ " key34 " ] = > <nl> + int ( 34 ) <nl> + [ " key35 " ] = > <nl> + int ( 35 ) <nl> + [ " key36 " ] = > <nl> + int ( 36 ) <nl> + [ " key37 " ] = > <nl> + int ( 37 ) <nl> + [ " key38 " ] = > <nl> + int ( 38 ) <nl> + [ " key39 " ] = > <nl> + int ( 39 ) <nl> + [ " key40 " ] = > <nl> + int ( 40 ) <nl> + [ " key41 " ] = > <nl> + int ( 41 ) <nl> + [ " key42 " ] = > <nl> + int ( 42 ) <nl> + [ " key43 " ] = > <nl> + int ( 43 ) <nl> + [ " key44 " ] = > <nl> + int ( 44 ) <nl> + [ " key45 " ] = > <nl> + int ( 45 ) <nl> + [ " key46 " ] = > <nl> + int ( 46 ) <nl> + [ " key47 " ] = > <nl> + int ( 47 ) <nl> + [ " key48 " ] = > <nl> + int ( 48 ) <nl> + [ " key49 " ] = > <nl> + int ( 49 ) <nl> + [ " key50 " ] = > <nl> + int ( 50 ) <nl> + [ " key51 " ] = > <nl> + int ( 51 ) <nl> + [ " key52 " ] = > <nl> + int ( 52 ) <nl> + [ " key53 " ] = > <nl> + int ( 53 ) <nl> + [ " key54 " ] = > <nl> + int ( 54 ) <nl> + [ " key55 " ] = > <nl> + int ( 55 ) <nl> + [ " key56 " ] = > <nl> + int ( 56 ) <nl> + [ " key57 " ] = > <nl> + int ( 57 ) <nl> + [ " key58 " ] = > <nl> + int ( 58 ) <nl> + [ " key59 " ] = > <nl> + int ( 59 ) <nl> + [ " key60 " ] = > <nl> + int ( 60 ) <nl> + [ " key61 " ] = > <nl> + int ( 61 ) <nl> + [ " key62 " ] = > <nl> + int ( 62 ) <nl> + [ " key63 " ] = > <nl> + int ( 63 ) <nl> + [ " key64 " ] = > <nl> + int ( 64 ) <nl> + [ " key65 " ] = > <nl> + int ( 65 ) <nl> + [ " key66 " ] = > <nl> + int ( 66 ) <nl> + [ " key67 " ] = > <nl> + int ( 67 ) <nl> + [ " key68 " ] = > <nl> + int ( 68 ) <nl> + [ " key69 " ] = > <nl> + int ( 69 ) <nl> + [ " key70 " ] = > <nl> + int ( 70 ) <nl> + [ " key71 " ] = > <nl> + int ( 71 ) <nl> + [ " key72 " ] = > <nl> + int ( 72 ) <nl> + [ " key73 " ] = > <nl> + int ( 73 ) <nl> + [ " key74 " ] = > <nl> + int ( 74 ) <nl> + [ " key75 " ] = > <nl> + int ( 75 ) <nl> + [ " key76 " ] = > <nl> + int ( 76 ) <nl> + [ " key77 " ] = > <nl> + int ( 77 ) <nl> + [ " key78 " ] = > <nl> + int ( 78 ) <nl> + [ " key79 " ] = > <nl> + int ( 79 ) <nl> + [ " key80 " ] = > <nl> + int ( 80 ) <nl> + [ " key81 " ] = > <nl> + int ( 81 ) <nl> + [ " key82 " ] = > <nl> + int ( 82 ) <nl> + [ " key83 " ] = > <nl> + int ( 83 ) <nl> + [ " key84 " ] = > <nl> + int ( 84 ) <nl> + [ " key85 " ] = > <nl> + int ( 85 ) <nl> + [ " key86 " ] = > <nl> + int ( 86 ) <nl> + [ " key87 " ] = > <nl> + int ( 87 ) <nl> + [ " key88 " ] = > <nl> + int ( 88 ) <nl> + [ " key89 " ] = > <nl> + int ( 89 ) <nl> + [ " key90 " ] = > <nl> + int ( 90 ) <nl> + [ " key91 " ] = > <nl> + int ( 91 ) <nl> + [ " key92 " ] = > <nl> + int ( 92 ) <nl> + [ " key93 " ] = > <nl> + int ( 93 ) <nl> + [ " key94 " ] = > <nl> + int ( 94 ) <nl> + [ " key95 " ] = > <nl> + int ( 95 ) <nl> + [ " key96 " ] = > <nl> + int ( 96 ) <nl> + [ " key97 " ] = > <nl> + int ( 97 ) <nl> + [ " key98 " ] = > <nl> + int ( 98 ) <nl> + [ " key99 " ] = > <nl> + int ( 99 ) <nl> + } <nl> + object ( HH \ Map ) # 1 ( 1002 ) { <nl> + [ " foo " ] = > <nl> + int ( 123 ) <nl> + [ " bar " ] = > <nl> + int ( 9876543210 ) <nl> + [ " key0 " ] = > <nl> + int ( 0 ) <nl> + [ " key1 " ] = > <nl> + int ( 1 ) <nl> + [ " key2 " ] = > <nl> + int ( 2 ) <nl> + [ " key3 " ] = > <nl> + int ( 3 ) <nl> + [ " key4 " ] = > <nl> + int ( 4 ) <nl> + [ " key5 " ] = > <nl> + int ( 5 ) <nl> + [ " key6 " ] = > <nl> + int ( 6 ) <nl> + [ " key7 " ] = > <nl> + int ( 7 ) <nl> + [ " key8 " ] = > <nl> + int ( 8 ) <nl> + [ " key9 " ] = > <nl> + int ( 9 ) <nl> + [ " key10 " ] = > <nl> + int ( 10 ) <nl> + [ " key11 " ] = > <nl> + int ( 11 ) <nl> + [ " key12 " ] = > <nl> + int ( 12 ) <nl> + [ " key13 " ] = > <nl> + int ( 13 ) <nl> + [ " key14 " ] = > <nl> + int ( 14 ) <nl> + [ " key15 " ] = > <nl> + int ( 15 ) <nl> + [ " key16 " ] = > <nl> + int ( 16 ) <nl> + [ " key17 " ] = > <nl> + int ( 17 ) <nl> + [ " key18 " ] = > <nl> + int ( 18 ) <nl> + [ " key19 " ] = > <nl> + int ( 19 ) <nl> + [ " key20 " ] = > <nl> + int ( 20 ) <nl> + [ " key21 " ] = > <nl> + int ( 21 ) <nl> + [ " key22 " ] = > <nl> + int ( 22 ) <nl> + [ " key23 " ] = > <nl> + int ( 23 ) <nl> + [ " key24 " ] = > <nl> + int ( 24 ) <nl> + [ " key25 " ] = > <nl> + int ( 25 ) <nl> + [ " key26 " ] = > <nl> + int ( 26 ) <nl> + [ " key27 " ] = > <nl> + int ( 27 ) <nl> + [ " key28 " ] = > <nl> + int ( 28 ) <nl> + [ " key29 " ] = > <nl> + int ( 29 ) <nl> + [ " key30 " ] = > <nl> + int ( 30 ) <nl> + [ " key31 " ] = > <nl> + int ( 31 ) <nl> + [ " key32 " ] = > <nl> + int ( 32 ) <nl> + [ " key33 " ] = > <nl> + int ( 33 ) <nl> + [ " key34 " ] = > <nl> + int ( 34 ) <nl> + [ " key35 " ] = > <nl> + int ( 35 ) <nl> + [ " key36 " ] = > <nl> + int ( 36 ) <nl> + [ " key37 " ] = > <nl> + int ( 37 ) <nl> + [ " key38 " ] = > <nl> + int ( 38 ) <nl> + [ " key39 " ] = > <nl> + int ( 39 ) <nl> + [ " key40 " ] = > <nl> + int ( 40 ) <nl> + [ " key41 " ] = > <nl> + int ( 41 ) <nl> + [ " key42 " ] = > <nl> + int ( 42 ) <nl> + [ " key43 " ] = > <nl> + int ( 43 ) <nl> + [ " key44 " ] = > <nl> + int ( 44 ) <nl> + [ " key45 " ] = > <nl> + int ( 45 ) <nl> + [ " key46 " ] = > <nl> + int ( 46 ) <nl> + [ " key47 " ] = > <nl> + int ( 47 ) <nl> + [ " key48 " ] = > <nl> + int ( 48 ) <nl> + [ " key49 " ] = > <nl> + int ( 49 ) <nl> + [ " key50 " ] = > <nl> + int ( 50 ) <nl> + [ " key51 " ] = > <nl> + int ( 51 ) <nl> + [ " key52 " ] = > <nl> + int ( 52 ) <nl> + [ " key53 " ] = > <nl> + int ( 53 ) <nl> + [ " key54 " ] = > <nl> + int ( 54 ) <nl> + [ " key55 " ] = > <nl> + int ( 55 ) <nl> + [ " key56 " ] = > <nl> + int ( 56 ) <nl> + [ " key57 " ] = > <nl> + int ( 57 ) <nl> + [ " key58 " ] = > <nl> + int ( 58 ) <nl> + [ " key59 " ] = > <nl> + int ( 59 ) <nl> + [ " key60 " ] = > <nl> + int ( 60 ) <nl> + [ " key61 " ] = > <nl> + int ( 61 ) <nl> + [ " key62 " ] = > <nl> + int ( 62 ) <nl> + [ " key63 " ] = > <nl> + int ( 63 ) <nl> + [ " key64 " ] = > <nl> + int ( 64 ) <nl> + [ " key65 " ] = > <nl> + int ( 65 ) <nl> + [ " key66 " ] = > <nl> + int ( 66 ) <nl> + [ " key67 " ] = > <nl> + int ( 67 ) <nl> + [ " key68 " ] = > <nl> + int ( 68 ) <nl> + [ " key69 " ] = > <nl> + int ( 69 ) <nl> + [ " key70 " ] = > <nl> + int ( 70 ) <nl> + [ " key71 " ] = > <nl> + int ( 71 ) <nl> + [ " key72 " ] = > <nl> + int ( 72 ) <nl> + [ " key73 " ] = > <nl> + int ( 73 ) <nl> + [ " key74 " ] = > <nl> + int ( 74 ) <nl> + [ " key75 " ] = > <nl> + int ( 75 ) <nl> + [ " key76 " ] = > <nl> + int ( 76 ) <nl> + [ " key77 " ] = > <nl> + int ( 77 ) <nl> + [ " key78 " ] = > <nl> + int ( 78 ) <nl> + [ " key79 " ] = > <nl> + int ( 79 ) <nl> + [ " key80 " ] = > <nl> + int ( 80 ) <nl> + [ " key81 " ] = > <nl> + int ( 81 ) <nl> + [ " key82 " ] = > <nl> + int ( 82 ) <nl> + [ " key83 " ] = > <nl> + int ( 83 ) <nl> + [ " key84 " ] = > <nl> + int ( 84 ) <nl> + [ " key85 " ] = > <nl> + int ( 85 ) <nl> + [ " key86 " ] = > <nl> + int ( 86 ) <nl> + [ " key87 " ] = > <nl> + int ( 87 ) <nl> + [ " key88 " ] = > <nl> + int ( 88 ) <nl> + [ " key89 " ] = > <nl> + int ( 89 ) <nl> + [ " key90 " ] = > <nl> + int ( 90 ) <nl> + [ " key91 " ] = > <nl> + int ( 91 ) <nl> + [ " key92 " ] = > <nl> + int ( 92 ) <nl> + [ " key93 " ] = > <nl> + int ( 93 ) <nl> + [ " key94 " ] = > <nl> + int ( 94 ) <nl> + [ " key95 " ] = > <nl> + int ( 95 ) <nl> + [ " key96 " ] = > <nl> + int ( 96 ) <nl> + [ " key97 " ] = > <nl> + int ( 97 ) <nl> + [ " key98 " ] = > <nl> + int ( 98 ) <nl> + [ " key99 " ] = > <nl> + int ( 99 ) <nl> + [ " key100 " ] = > <nl> + int ( 100 ) <nl> + [ " key101 " ] = > <nl> + int ( 101 ) <nl> + [ " key102 " ] = > <nl> + int ( 102 ) <nl> + [ " key103 " ] = > <nl> + int ( 103 ) <nl> + [ " key104 " ] = > <nl> + int ( 104 ) <nl> + [ " key105 " ] = > <nl> + int ( 105 ) <nl> + [ " key106 " ] = > <nl> + int ( 106 ) <nl> + [ " key107 " ] = > <nl> + int ( 107 ) <nl> + [ " key108 " ] = > <nl> + int ( 108 ) <nl> + [ " key109 " ] = > <nl> + int ( 109 ) <nl> + [ " key110 " ] = > <nl> + int ( 110 ) <nl> + [ " key111 " ] = > <nl> + int ( 111 ) <nl> + [ " key112 " ] = > <nl> + int ( 112 ) <nl> + [ " key113 " ] = > <nl> + int ( 113 ) <nl> + [ " key114 " ] = > <nl> + int ( 114 ) <nl> + [ " key115 " ] = > <nl> + int ( 115 ) <nl> + [ " key116 " ] = > <nl> + int ( 116 ) <nl> + [ " key117 " ] = > <nl> + int ( 117 ) <nl> + [ " key118 " ] = > <nl> + int ( 118 ) <nl> + [ " key119 " ] = > <nl> + int ( 119 ) <nl> + [ " key120 " ] = > <nl> + int ( 120 ) <nl> + [ " key121 " ] = > <nl> + int ( 121 ) <nl> + [ " key122 " ] = > <nl> + int ( 122 ) <nl> + [ " key123 " ] = > <nl> + int ( 123 ) <nl> + [ " key124 " ] = > <nl> + int ( 124 ) <nl> + [ " key125 " ] = > <nl> + int ( 125 ) <nl> + [ " key126 " ] = > <nl> + int ( 126 ) <nl> + [ " key127 " ] = > <nl> + int ( 127 ) <nl> + [ " key128 " ] = > <nl> + int ( 128 ) <nl> + [ " key129 " ] = > <nl> + int ( 129 ) <nl> + [ " key130 " ] = > <nl> + int ( 130 ) <nl> + [ " key131 " ] = > <nl> + int ( 131 ) <nl> + [ " key132 " ] = > <nl> + int ( 132 ) <nl> + [ " key133 " ] = > <nl> + int ( 133 ) <nl> + [ " key134 " ] = > <nl> + int ( 134 ) <nl> + [ " key135 " ] = > <nl> + int ( 135 ) <nl> + [ " key136 " ] = > <nl> + int ( 136 ) <nl> + [ " key137 " ] = > <nl> + int ( 137 ) <nl> + [ " key138 " ] = > <nl> + int ( 138 ) <nl> + [ " key139 " ] = > <nl> + int ( 139 ) <nl> + [ " key140 " ] = > <nl> + int ( 140 ) <nl> + [ " key141 " ] = > <nl> + int ( 141 ) <nl> + [ " key142 " ] = > <nl> + int ( 142 ) <nl> + [ " key143 " ] = > <nl> + int ( 143 ) <nl> + [ " key144 " ] = > <nl> + int ( 144 ) <nl> + [ " key145 " ] = > <nl> + int ( 145 ) <nl> + [ " key146 " ] = > <nl> + int ( 146 ) <nl> + [ " key147 " ] = > <nl> + int ( 147 ) <nl> + [ " key148 " ] = > <nl> + int ( 148 ) <nl> + [ " key149 " ] = > <nl> + int ( 149 ) <nl> + [ " key150 " ] = > <nl> + int ( 150 ) <nl> + [ " key151 " ] = > <nl> + int ( 151 ) <nl> + [ " key152 " ] = > <nl> + int ( 152 ) <nl> + [ " key153 " ] = > <nl> + int ( 153 ) <nl> + [ " key154 " ] = > <nl> + int ( 154 ) <nl> + [ " key155 " ] = > <nl> + int ( 155 ) <nl> + [ " key156 " ] = > <nl> + int ( 156 ) <nl> + [ " key157 " ] = > <nl> + int ( 157 ) <nl> + [ " key158 " ] = > <nl> + int ( 158 ) <nl> + [ " key159 " ] = > <nl> + int ( 159 ) <nl> + [ " key160 " ] = > <nl> + int ( 160 ) <nl> + [ " key161 " ] = > <nl> + int ( 161 ) <nl> + [ " key162 " ] = > <nl> + int ( 162 ) <nl> + [ " key163 " ] = > <nl> + int ( 163 ) <nl> + [ " key164 " ] = > <nl> + int ( 164 ) <nl> + [ " key165 " ] = > <nl> + int ( 165 ) <nl> + [ " key166 " ] = > <nl> + int ( 166 ) <nl> + [ " key167 " ] = > <nl> + int ( 167 ) <nl> + [ " key168 " ] = > <nl> + int ( 168 ) <nl> + [ " key169 " ] = > <nl> + int ( 169 ) <nl> + [ " key170 " ] = > <nl> + int ( 170 ) <nl> + [ " key171 " ] = > <nl> + int ( 171 ) <nl> + [ " key172 " ] = > <nl> + int ( 172 ) <nl> + [ " key173 " ] = > <nl> + int ( 173 ) <nl> + [ " key174 " ] = > <nl> + int ( 174 ) <nl> + [ " key175 " ] = > <nl> + int ( 175 ) <nl> + [ " key176 " ] = > <nl> + int ( 176 ) <nl> + [ " key177 " ] = > <nl> + int ( 177 ) <nl> + [ " key178 " ] = > <nl> + int ( 178 ) <nl> + [ " key179 " ] = > <nl> + int ( 179 ) <nl> + [ " key180 " ] = > <nl> + int ( 180 ) <nl> + [ " key181 " ] = > <nl> + int ( 181 ) <nl> + [ " key182 " ] = > <nl> + int ( 182 ) <nl> + [ " key183 " ] = > <nl> + int ( 183 ) <nl> + [ " key184 " ] = > <nl> + int ( 184 ) <nl> + [ " key185 " ] = > <nl> + int ( 185 ) <nl> + [ " key186 " ] = > <nl> + int ( 186 ) <nl> + [ " key187 " ] = > <nl> + int ( 187 ) <nl> + [ " key188 " ] = > <nl> + int ( 188 ) <nl> + [ " key189 " ] = > <nl> + int ( 189 ) <nl> + [ " key190 " ] = > <nl> + int ( 190 ) <nl> + [ " key191 " ] = > <nl> + int ( 191 ) <nl> + [ " key192 " ] = > <nl> + int ( 192 ) <nl> + [ " key193 " ] = > <nl> + int ( 193 ) <nl> + [ " key194 " ] = > <nl> + int ( 194 ) <nl> + [ " key195 " ] = > <nl> + int ( 195 ) <nl> + [ " key196 " ] = > <nl> + int ( 196 ) <nl> + [ " key197 " ] = > <nl> + int ( 197 ) <nl> + [ " key198 " ] = > <nl> + int ( 198 ) <nl> + [ " key199 " ] = > <nl> + int ( 199 ) <nl> + [ " key200 " ] = > <nl> + int ( 200 ) <nl> + [ " key201 " ] = > <nl> + int ( 201 ) <nl> + [ " key202 " ] = > <nl> + int ( 202 ) <nl> + [ " key203 " ] = > <nl> + int ( 203 ) <nl> + [ " key204 " ] = > <nl> + int ( 204 ) <nl> + [ " key205 " ] = > <nl> + int ( 205 ) <nl> + [ " key206 " ] = > <nl> + int ( 206 ) <nl> + [ " key207 " ] = > <nl> + int ( 207 ) <nl> + [ " key208 " ] = > <nl> + int ( 208 ) <nl> + [ " key209 " ] = > <nl> + int ( 209 ) <nl> + [ " key210 " ] = > <nl> + int ( 210 ) <nl> + [ " key211 " ] = > <nl> + int ( 211 ) <nl> + [ " key212 " ] = > <nl> + int ( 212 ) <nl> + [ " key213 " ] = > <nl> + int ( 213 ) <nl> + [ " key214 " ] = > <nl> + int ( 214 ) <nl> + [ " key215 " ] = > <nl> + int ( 215 ) <nl> + [ " key216 " ] = > <nl> + int ( 216 ) <nl> + [ " key217 " ] = > <nl> + int ( 217 ) <nl> + [ " key218 " ] = > <nl> + int ( 218 ) <nl> + [ " key219 " ] = > <nl> + int ( 219 ) <nl> + [ " key220 " ] = > <nl> + int ( 220 ) <nl> + [ " key221 " ] = > <nl> + int ( 221 ) <nl> + [ " key222 " ] = > <nl> + int ( 222 ) <nl> + [ " key223 " ] = > <nl> + int ( 223 ) <nl> + [ " key224 " ] = > <nl> + int ( 224 ) <nl> + [ " key225 " ] = > <nl> + int ( 225 ) <nl> + [ " key226 " ] = > <nl> + int ( 226 ) <nl> + [ " key227 " ] = > <nl> + int ( 227 ) <nl> + [ " key228 " ] = > <nl> + int ( 228 ) <nl> + [ " key229 " ] = > <nl> + int ( 229 ) <nl> + [ " key230 " ] = > <nl> + int ( 230 ) <nl> + [ " key231 " ] = > <nl> + int ( 231 ) <nl> + [ " key232 " ] = > <nl> + int ( 232 ) <nl> + [ " key233 " ] = > <nl> + int ( 233 ) <nl> + [ " key234 " ] = > <nl> + int ( 234 ) <nl> + [ " key235 " ] = > <nl> + int ( 235 ) <nl> + [ " key236 " ] = > <nl> + int ( 236 ) <nl> + [ " key237 " ] = > <nl> + int ( 237 ) <nl> + [ " key238 " ] = > <nl> + int ( 238 ) <nl> + [ " key239 " ] = > <nl> + int ( 239 ) <nl> + [ " key240 " ] = > <nl> + int ( 240 ) <nl> + [ " key241 " ] = > <nl> + int ( 241 ) <nl> + [ " key242 " ] = > <nl> + int ( 242 ) <nl> + [ " key243 " ] = > <nl> + int ( 243 ) <nl> + [ " key244 " ] = > <nl> + int ( 244 ) <nl> + [ " key245 " ] = > <nl> + int ( 245 ) <nl> + [ " key246 " ] = > <nl> + int ( 246 ) <nl> + [ " key247 " ] = > <nl> + int ( 247 ) <nl> + [ " key248 " ] = > <nl> + int ( 248 ) <nl> + [ " key249 " ] = > <nl> + int ( 249 ) <nl> + [ " key250 " ] = > <nl> + int ( 250 ) <nl> + [ " key251 " ] = > <nl> + int ( 251 ) <nl> + [ " key252 " ] = > <nl> + int ( 252 ) <nl> + [ " key253 " ] = > <nl> + int ( 253 ) <nl> + [ " key254 " ] = > <nl> + int ( 254 ) <nl> + [ " key255 " ] = > <nl> + int ( 255 ) <nl> + [ " key256 " ] = > <nl> + int ( 256 ) <nl> + [ " key257 " ] = > <nl> + int ( 257 ) <nl> + [ " key258 " ] = > <nl> + int ( 258 ) <nl> + [ " key259 " ] = > <nl> + int ( 259 ) <nl> + [ " key260 " ] = > <nl> + int ( 260 ) <nl> + [ " key261 " ] = > <nl> + int ( 261 ) <nl> + [ " key262 " ] = > <nl> + int ( 262 ) <nl> + [ " key263 " ] = > <nl> + int ( 263 ) <nl> + [ " key264 " ] = > <nl> + int ( 264 ) <nl> + [ " key265 " ] = > <nl> + int ( 265 ) <nl> + [ " key266 " ] = > <nl> + int ( 266 ) <nl> + [ " key267 " ] = > <nl> + int ( 267 ) <nl> + [ " key268 " ] = > <nl> + int ( 268 ) <nl> + [ " key269 " ] = > <nl> + int ( 269 ) <nl> + [ " key270 " ] = > <nl> + int ( 270 ) <nl> + [ " key271 " ] = > <nl> + int ( 271 ) <nl> + [ " key272 " ] = > <nl> + int ( 272 ) <nl> + [ " key273 " ] = > <nl> + int ( 273 ) <nl> + [ " key274 " ] = > <nl> + int ( 274 ) <nl> + [ " key275 " ] = > <nl> + int ( 275 ) <nl> + [ " key276 " ] = > <nl> + int ( 276 ) <nl> + [ " key277 " ] = > <nl> + int ( 277 ) <nl> + [ " key278 " ] = > <nl> + int ( 278 ) <nl> + [ " key279 " ] = > <nl> + int ( 279 ) <nl> + [ " key280 " ] = > <nl> + int ( 280 ) <nl> + [ " key281 " ] = > <nl> + int ( 281 ) <nl> + [ " key282 " ] = > <nl> + int ( 282 ) <nl> + [ " key283 " ] = > <nl> + int ( 283 ) <nl> + [ " key284 " ] = > <nl> + int ( 284 ) <nl> + [ " key285 " ] = > <nl> + int ( 285 ) <nl> + [ " key286 " ] = > <nl> + int ( 286 ) <nl> + [ " key287 " ] = > <nl> + int ( 287 ) <nl> + [ " key288 " ] = > <nl> + int ( 288 ) <nl> + [ " key289 " ] = > <nl> + int ( 289 ) <nl> + [ " key290 " ] = > <nl> + int ( 290 ) <nl> + [ " key291 " ] = > <nl> + int ( 291 ) <nl> + [ " key292 " ] = > <nl> + int ( 292 ) <nl> + [ " key293 " ] = > <nl> + int ( 293 ) <nl> + [ " key294 " ] = > <nl> + int ( 294 ) <nl> + [ " key295 " ] = > <nl> + int ( 295 ) <nl> + [ " key296 " ] = > <nl> + int ( 296 ) <nl> + [ " key297 " ] = > <nl> + int ( 297 ) <nl> + [ " key298 " ] = > <nl> + int ( 298 ) <nl> + [ " key299 " ] = > <nl> + int ( 299 ) <nl> + [ " key300 " ] = > <nl> + int ( 300 ) <nl> + [ " key301 " ] = > <nl> + int ( 301 ) <nl> + [ " key302 " ] = > <nl> + int ( 302 ) <nl> + [ " key303 " ] = > <nl> + int ( 303 ) <nl> + [ " key304 " ] = > <nl> + int ( 304 ) <nl> + [ " key305 " ] = > <nl> + int ( 305 ) <nl> + [ " key306 " ] = > <nl> + int ( 306 ) <nl> + [ " key307 " ] = > <nl> + int ( 307 ) <nl> + [ " key308 " ] = > <nl> + int ( 308 ) <nl> + [ " key309 " ] = > <nl> + int ( 309 ) <nl> + [ " key310 " ] = > <nl> + int ( 310 ) <nl> + [ " key311 " ] = > <nl> + int ( 311 ) <nl> + [ " key312 " ] = > <nl> + int ( 312 ) <nl> + [ " key313 " ] = > <nl> + int ( 313 ) <nl> + [ " key314 " ] = > <nl> + int ( 314 ) <nl> + [ " key315 " ] = > <nl> + int ( 315 ) <nl> + [ " key316 " ] = > <nl> + int ( 316 ) <nl> + [ " key317 " ] = > <nl> + int ( 317 ) <nl> + [ " key318 " ] = > <nl> + int ( 318 ) <nl> + [ " key319 " ] = > <nl> + int ( 319 ) <nl> + [ " key320 " ] = > <nl> + int ( 320 ) <nl> + [ " key321 " ] = > <nl> + int ( 321 ) <nl> + [ " key322 " ] = > <nl> + int ( 322 ) <nl> + [ " key323 " ] = > <nl> + int ( 323 ) <nl> + [ " key324 " ] = > <nl> + int ( 324 ) <nl> + [ " key325 " ] = > <nl> + int ( 325 ) <nl> + [ " key326 " ] = > <nl> + int ( 326 ) <nl> + [ " key327 " ] = > <nl> + int ( 327 ) <nl> + [ " key328 " ] = > <nl> + int ( 328 ) <nl> + [ " key329 " ] = > <nl> + int ( 329 ) <nl> + [ " key330 " ] = > <nl> + int ( 330 ) <nl> + [ " key331 " ] = > <nl> + int ( 331 ) <nl> + [ " key332 " ] = > <nl> + int ( 332 ) <nl> + [ " key333 " ] = > <nl> + int ( 333 ) <nl> + [ " key334 " ] = > <nl> + int ( 334 ) <nl> + [ " key335 " ] = > <nl> + int ( 335 ) <nl> + [ " key336 " ] = > <nl> + int ( 336 ) <nl> + [ " key337 " ] = > <nl> + int ( 337 ) <nl> + [ " key338 " ] = > <nl> + int ( 338 ) <nl> + [ " key339 " ] = > <nl> + int ( 339 ) <nl> + [ " key340 " ] = > <nl> + int ( 340 ) <nl> + [ " key341 " ] = > <nl> + int ( 341 ) <nl> + [ " key342 " ] = > <nl> + int ( 342 ) <nl> + [ " key343 " ] = > <nl> + int ( 343 ) <nl> + [ " key344 " ] = > <nl> + int ( 344 ) <nl> + [ " key345 " ] = > <nl> + int ( 345 ) <nl> + [ " key346 " ] = > <nl> + int ( 346 ) <nl> + [ " key347 " ] = > <nl> + int ( 347 ) <nl> + [ " key348 " ] = > <nl> + int ( 348 ) <nl> + [ " key349 " ] = > <nl> + int ( 349 ) <nl> + [ " key350 " ] = > <nl> + int ( 350 ) <nl> + [ " key351 " ] = > <nl> + int ( 351 ) <nl> + [ " key352 " ] = > <nl> + int ( 352 ) <nl> + [ " key353 " ] = > <nl> + int ( 353 ) <nl> + [ " key354 " ] = > <nl> + int ( 354 ) <nl> + [ " key355 " ] = > <nl> + int ( 355 ) <nl> + [ " key356 " ] = > <nl> + int ( 356 ) <nl> + [ " key357 " ] = > <nl> + int ( 357 ) <nl> + [ " key358 " ] = > <nl> + int ( 358 ) <nl> + [ " key359 " ] = > <nl> + int ( 359 ) <nl> + [ " key360 " ] = > <nl> + int ( 360 ) <nl> + [ " key361 " ] = > <nl> + int ( 361 ) <nl> + [ " key362 " ] = > <nl> + int ( 362 ) <nl> + [ " key363 " ] = > <nl> + int ( 363 ) <nl> + [ " key364 " ] = > <nl> + int ( 364 ) <nl> + [ " key365 " ] = > <nl> + int ( 365 ) <nl> + [ " key366 " ] = > <nl> + int ( 366 ) <nl> + [ " key367 " ] = > <nl> + int ( 367 ) <nl> + [ " key368 " ] = > <nl> + int ( 368 ) <nl> + [ " key369 " ] = > <nl> + int ( 369 ) <nl> + [ " key370 " ] = > <nl> + int ( 370 ) <nl> + [ " key371 " ] = > <nl> + int ( 371 ) <nl> + [ " key372 " ] = > <nl> + int ( 372 ) <nl> + [ " key373 " ] = > <nl> + int ( 373 ) <nl> + [ " key374 " ] = > <nl> + int ( 374 ) <nl> + [ " key375 " ] = > <nl> + int ( 375 ) <nl> + [ " key376 " ] = > <nl> + int ( 376 ) <nl> + [ " key377 " ] = > <nl> + int ( 377 ) <nl> + [ " key378 " ] = > <nl> + int ( 378 ) <nl> + [ " key379 " ] = > <nl> + int ( 379 ) <nl> + [ " key380 " ] = > <nl> + int ( 380 ) <nl> + [ " key381 " ] = > <nl> + int ( 381 ) <nl> + [ " key382 " ] = > <nl> + int ( 382 ) <nl> + [ " key383 " ] = > <nl> + int ( 383 ) <nl> + [ " key384 " ] = > <nl> + int ( 384 ) <nl> + [ " key385 " ] = > <nl> + int ( 385 ) <nl> + [ " key386 " ] = > <nl> + int ( 386 ) <nl> + [ " key387 " ] = > <nl> + int ( 387 ) <nl> + [ " key388 " ] = > <nl> + int ( 388 ) <nl> + [ " key389 " ] = > <nl> + int ( 389 ) <nl> + [ " key390 " ] = > <nl> + int ( 390 ) <nl> + [ " key391 " ] = > <nl> + int ( 391 ) <nl> + [ " key392 " ] = > <nl> + int ( 392 ) <nl> + [ " key393 " ] = > <nl> + int ( 393 ) <nl> + [ " key394 " ] = > <nl> + int ( 394 ) <nl> + [ " key395 " ] = > <nl> + int ( 395 ) <nl> + [ " key396 " ] = > <nl> + int ( 396 ) <nl> + [ " key397 " ] = > <nl> + int ( 397 ) <nl> + [ " key398 " ] = > <nl> + int ( 398 ) <nl> + [ " key399 " ] = > <nl> + int ( 399 ) <nl> + [ " key400 " ] = > <nl> + int ( 400 ) <nl> + [ " key401 " ] = > <nl> + int ( 401 ) <nl> + [ " key402 " ] = > <nl> + int ( 402 ) <nl> + [ " key403 " ] = > <nl> + int ( 403 ) <nl> + [ " key404 " ] = > <nl> + int ( 404 ) <nl> + [ " key405 " ] = > <nl> + int ( 405 ) <nl> + [ " key406 " ] = > <nl> + int ( 406 ) <nl> + [ " key407 " ] = > <nl> + int ( 407 ) <nl> + [ " key408 " ] = > <nl> + int ( 408 ) <nl> + [ " key409 " ] = > <nl> + int ( 409 ) <nl> + [ " key410 " ] = > <nl> + int ( 410 ) <nl> + [ " key411 " ] = > <nl> + int ( 411 ) <nl> + [ " key412 " ] = > <nl> + int ( 412 ) <nl> + [ " key413 " ] = > <nl> + int ( 413 ) <nl> + [ " key414 " ] = > <nl> + int ( 414 ) <nl> + [ " key415 " ] = > <nl> + int ( 415 ) <nl> + [ " key416 " ] = > <nl> + int ( 416 ) <nl> + [ " key417 " ] = > <nl> + int ( 417 ) <nl> + [ " key418 " ] = > <nl> + int ( 418 ) <nl> + [ " key419 " ] = > <nl> + int ( 419 ) <nl> + [ " key420 " ] = > <nl> + int ( 420 ) <nl> + [ " key421 " ] = > <nl> + int ( 421 ) <nl> + [ " key422 " ] = > <nl> + int ( 422 ) <nl> + [ " key423 " ] = > <nl> + int ( 423 ) <nl> + [ " key424 " ] = > <nl> + int ( 424 ) <nl> + [ " key425 " ] = > <nl> + int ( 425 ) <nl> + [ " key426 " ] = > <nl> + int ( 426 ) <nl> + [ " key427 " ] = > <nl> + int ( 427 ) <nl> + [ " key428 " ] = > <nl> + int ( 428 ) <nl> + [ " key429 " ] = > <nl> + int ( 429 ) <nl> + [ " key430 " ] = > <nl> + int ( 430 ) <nl> + [ " key431 " ] = > <nl> + int ( 431 ) <nl> + [ " key432 " ] = > <nl> + int ( 432 ) <nl> + [ " key433 " ] = > <nl> + int ( 433 ) <nl> + [ " key434 " ] = > <nl> + int ( 434 ) <nl> + [ " key435 " ] = > <nl> + int ( 435 ) <nl> + [ " key436 " ] = > <nl> + int ( 436 ) <nl> + [ " key437 " ] = > <nl> + int ( 437 ) <nl> + [ " key438 " ] = > <nl> + int ( 438 ) <nl> + [ " key439 " ] = > <nl> + int ( 439 ) <nl> + [ " key440 " ] = > <nl> + int ( 440 ) <nl> + [ " key441 " ] = > <nl> + int ( 441 ) <nl> + [ " key442 " ] = > <nl> + int ( 442 ) <nl> + [ " key443 " ] = > <nl> + int ( 443 ) <nl> + [ " key444 " ] = > <nl> + int ( 444 ) <nl> + [ " key445 " ] = > <nl> + int ( 445 ) <nl> + [ " key446 " ] = > <nl> + int ( 446 ) <nl> + [ " key447 " ] = > <nl> + int ( 447 ) <nl> + [ " key448 " ] = > <nl> + int ( 448 ) <nl> + [ " key449 " ] = > <nl> + int ( 449 ) <nl> + [ " key450 " ] = > <nl> + int ( 450 ) <nl> + [ " key451 " ] = > <nl> + int ( 451 ) <nl> + [ " key452 " ] = > <nl> + int ( 452 ) <nl> + [ " key453 " ] = > <nl> + int ( 453 ) <nl> + [ " key454 " ] = > <nl> + int ( 454 ) <nl> + [ " key455 " ] = > <nl> + int ( 455 ) <nl> + [ " key456 " ] = > <nl> + int ( 456 ) <nl> + [ " key457 " ] = > <nl> + int ( 457 ) <nl> + [ " key458 " ] = > <nl> + int ( 458 ) <nl> + [ " key459 " ] = > <nl> + int ( 459 ) <nl> + [ " key460 " ] = > <nl> + int ( 460 ) <nl> + [ " key461 " ] = > <nl> + int ( 461 ) <nl> + [ " key462 " ] = > <nl> + int ( 462 ) <nl> + [ " key463 " ] = > <nl> + int ( 463 ) <nl> + [ " key464 " ] = > <nl> + int ( 464 ) <nl> + [ " key465 " ] = > <nl> + int ( 465 ) <nl> + [ " key466 " ] = > <nl> + int ( 466 ) <nl> + [ " key467 " ] = > <nl> + int ( 467 ) <nl> + [ " key468 " ] = > <nl> + int ( 468 ) <nl> + [ " key469 " ] = > <nl> + int ( 469 ) <nl> + [ " key470 " ] = > <nl> + int ( 470 ) <nl> + [ " key471 " ] = > <nl> + int ( 471 ) <nl> + [ " key472 " ] = > <nl> + int ( 472 ) <nl> + [ " key473 " ] = > <nl> + int ( 473 ) <nl> + [ " key474 " ] = > <nl> + int ( 474 ) <nl> + [ " key475 " ] = > <nl> + int ( 475 ) <nl> + [ " key476 " ] = > <nl> + int ( 476 ) <nl> + [ " key477 " ] = > <nl> + int ( 477 ) <nl> + [ " key478 " ] = > <nl> + int ( 478 ) <nl> + [ " key479 " ] = > <nl> + int ( 479 ) <nl> + [ " key480 " ] = > <nl> + int ( 480 ) <nl> + [ " key481 " ] = > <nl> + int ( 481 ) <nl> + [ " key482 " ] = > <nl> + int ( 482 ) <nl> + [ " key483 " ] = > <nl> + int ( 483 ) <nl> + [ " key484 " ] = > <nl> + int ( 484 ) <nl> + [ " key485 " ] = > <nl> + int ( 485 ) <nl> + [ " key486 " ] = > <nl> + int ( 486 ) <nl> + [ " key487 " ] = > <nl> + int ( 487 ) <nl> + [ " key488 " ] = > <nl> + int ( 488 ) <nl> + [ " key489 " ] = > <nl> + int ( 489 ) <nl> + [ " key490 " ] = > <nl> + int ( 490 ) <nl> + [ " key491 " ] = > <nl> + int ( 491 ) <nl> + [ " key492 " ] = > <nl> + int ( 492 ) <nl> + [ " key493 " ] = > <nl> + int ( 493 ) <nl> + [ " key494 " ] = > <nl> + int ( 494 ) <nl> + [ " key495 " ] = > <nl> + int ( 495 ) <nl> + [ " key496 " ] = > <nl> + int ( 496 ) <nl> + [ " key497 " ] = > <nl> + int ( 497 ) <nl> + [ " key498 " ] = > <nl> + int ( 498 ) <nl> + [ " key499 " ] = > <nl> + int ( 499 ) <nl> + [ " key500 " ] = > <nl> + int ( 500 ) <nl> + [ " key501 " ] = > <nl> + int ( 501 ) <nl> + [ " key502 " ] = > <nl> + int ( 502 ) <nl> + [ " key503 " ] = > <nl> + int ( 503 ) <nl> + [ " key504 " ] = > <nl> + int ( 504 ) <nl> + [ " key505 " ] = > <nl> + int ( 505 ) <nl> + [ " key506 " ] = > <nl> + int ( 506 ) <nl> + [ " key507 " ] = > <nl> + int ( 507 ) <nl> + [ " key508 " ] = > <nl> + int ( 508 ) <nl> + [ " key509 " ] = > <nl> + int ( 509 ) <nl> + [ " key510 " ] = > <nl> + int ( 510 ) <nl> + [ " key511 " ] = > <nl> + int ( 511 ) <nl> + [ " key512 " ] = > <nl> + int ( 512 ) <nl> + [ " key513 " ] = > <nl> + int ( 513 ) <nl> + [ " key514 " ] = > <nl> + int ( 514 ) <nl> + [ " key515 " ] = > <nl> + int ( 515 ) <nl> + [ " key516 " ] = > <nl> + int ( 516 ) <nl> + [ " key517 " ] = > <nl> + int ( 517 ) <nl> + [ " key518 " ] = > <nl> + int ( 518 ) <nl> + [ " key519 " ] = > <nl> + int ( 519 ) <nl> + [ " key520 " ] = > <nl> + int ( 520 ) <nl> + [ " key521 " ] = > <nl> + int ( 521 ) <nl> + [ " key522 " ] = > <nl> + int ( 522 ) <nl> + [ " key523 " ] = > <nl> + int ( 523 ) <nl> + [ " key524 " ] = > <nl> + int ( 524 ) <nl> + [ " key525 " ] = > <nl> + int ( 525 ) <nl> + [ " key526 " ] = > <nl> + int ( 526 ) <nl> + [ " key527 " ] = > <nl> + int ( 527 ) <nl> + [ " key528 " ] = > <nl> + int ( 528 ) <nl> + [ " key529 " ] = > <nl> + int ( 529 ) <nl> + [ " key530 " ] = > <nl> + int ( 530 ) <nl> + [ " key531 " ] = > <nl> + int ( 531 ) <nl> + [ " key532 " ] = > <nl> + int ( 532 ) <nl> + [ " key533 " ] = > <nl> + int ( 533 ) <nl> + [ " key534 " ] = > <nl> + int ( 534 ) <nl> + [ " key535 " ] = > <nl> + int ( 535 ) <nl> + [ " key536 " ] = > <nl> + int ( 536 ) <nl> + [ " key537 " ] = > <nl> + int ( 537 ) <nl> + [ " key538 " ] = > <nl> + int ( 538 ) <nl> + [ " key539 " ] = > <nl> + int ( 539 ) <nl> + [ " key540 " ] = > <nl> + int ( 540 ) <nl> + [ " key541 " ] = > <nl> + int ( 541 ) <nl> + [ " key542 " ] = > <nl> + int ( 542 ) <nl> + [ " key543 " ] = > <nl> + int ( 543 ) <nl> + [ " key544 " ] = > <nl> + int ( 544 ) <nl> + [ " key545 " ] = > <nl> + int ( 545 ) <nl> + [ " key546 " ] = > <nl> + int ( 546 ) <nl> + [ " key547 " ] = > <nl> + int ( 547 ) <nl> + [ " key548 " ] = > <nl> + int ( 548 ) <nl> + [ " key549 " ] = > <nl> + int ( 549 ) <nl> + [ " key550 " ] = > <nl> + int ( 550 ) <nl> + [ " key551 " ] = > <nl> + int ( 551 ) <nl> + [ " key552 " ] = > <nl> + int ( 552 ) <nl> + [ " key553 " ] = > <nl> + int ( 553 ) <nl> + [ " key554 " ] = > <nl> + int ( 554 ) <nl> + [ " key555 " ] = > <nl> + int ( 555 ) <nl> + [ " key556 " ] = > <nl> + int ( 556 ) <nl> + [ " key557 " ] = > <nl> + int ( 557 ) <nl> + [ " key558 " ] = > <nl> + int ( 558 ) <nl> + [ " key559 " ] = > <nl> + int ( 559 ) <nl> + [ " key560 " ] = > <nl> + int ( 560 ) <nl> + [ " key561 " ] = > <nl> + int ( 561 ) <nl> + [ " key562 " ] = > <nl> + int ( 562 ) <nl> + [ " key563 " ] = > <nl> + int ( 563 ) <nl> + [ " key564 " ] = > <nl> + int ( 564 ) <nl> + [ " key565 " ] = > <nl> + int ( 565 ) <nl> + [ " key566 " ] = > <nl> + int ( 566 ) <nl> + [ " key567 " ] = > <nl> + int ( 567 ) <nl> + [ " key568 " ] = > <nl> + int ( 568 ) <nl> + [ " key569 " ] = > <nl> + int ( 569 ) <nl> + [ " key570 " ] = > <nl> + int ( 570 ) <nl> + [ " key571 " ] = > <nl> + int ( 571 ) <nl> + [ " key572 " ] = > <nl> + int ( 572 ) <nl> + [ " key573 " ] = > <nl> + int ( 573 ) <nl> + [ " key574 " ] = > <nl> + int ( 574 ) <nl> + [ " key575 " ] = > <nl> + int ( 575 ) <nl> + [ " key576 " ] = > <nl> + int ( 576 ) <nl> + [ " key577 " ] = > <nl> + int ( 577 ) <nl> + [ " key578 " ] = > <nl> + int ( 578 ) <nl> + [ " key579 " ] = > <nl> + int ( 579 ) <nl> + [ " key580 " ] = > <nl> + int ( 580 ) <nl> + [ " key581 " ] = > <nl> + int ( 581 ) <nl> + [ " key582 " ] = > <nl> + int ( 582 ) <nl> + [ " key583 " ] = > <nl> + int ( 583 ) <nl> + [ " key584 " ] = > <nl> + int ( 584 ) <nl> + [ " key585 " ] = > <nl> + int ( 585 ) <nl> + [ " key586 " ] = > <nl> + int ( 586 ) <nl> + [ " key587 " ] = > <nl> + int ( 587 ) <nl> + [ " key588 " ] = > <nl> + int ( 588 ) <nl> + [ " key589 " ] = > <nl> + int ( 589 ) <nl> + [ " key590 " ] = > <nl> + int ( 590 ) <nl> + [ " key591 " ] = > <nl> + int ( 591 ) <nl> + [ " key592 " ] = > <nl> + int ( 592 ) <nl> + [ " key593 " ] = > <nl> + int ( 593 ) <nl> + [ " key594 " ] = > <nl> + int ( 594 ) <nl> + [ " key595 " ] = > <nl> + int ( 595 ) <nl> + [ " key596 " ] = > <nl> + int ( 596 ) <nl> + [ " key597 " ] = > <nl> + int ( 597 ) <nl> + [ " key598 " ] = > <nl> + int ( 598 ) <nl> + [ " key599 " ] = > <nl> + int ( 599 ) <nl> + [ " key600 " ] = > <nl> + int ( 600 ) <nl> + [ " key601 " ] = > <nl> + int ( 601 ) <nl> + [ " key602 " ] = > <nl> + int ( 602 ) <nl> + [ " key603 " ] = > <nl> + int ( 603 ) <nl> + [ " key604 " ] = > <nl> + int ( 604 ) <nl> + [ " key605 " ] = > <nl> + int ( 605 ) <nl> + [ " key606 " ] = > <nl> + int ( 606 ) <nl> + [ " key607 " ] = > <nl> + int ( 607 ) <nl> + [ " key608 " ] = > <nl> + int ( 608 ) <nl> + [ " key609 " ] = > <nl> + int ( 609 ) <nl> + [ " key610 " ] = > <nl> + int ( 610 ) <nl> + [ " key611 " ] = > <nl> + int ( 611 ) <nl> + [ " key612 " ] = > <nl> + int ( 612 ) <nl> + [ " key613 " ] = > <nl> + int ( 613 ) <nl> + [ " key614 " ] = > <nl> + int ( 614 ) <nl> + [ " key615 " ] = > <nl> + int ( 615 ) <nl> + [ " key616 " ] = > <nl> + int ( 616 ) <nl> + [ " key617 " ] = > <nl> + int ( 617 ) <nl> + [ " key618 " ] = > <nl> + int ( 618 ) <nl> + [ " key619 " ] = > <nl> + int ( 619 ) <nl> + [ " key620 " ] = > <nl> + int ( 620 ) <nl> + [ " key621 " ] = > <nl> + int ( 621 ) <nl> + [ " key622 " ] = > <nl> + int ( 622 ) <nl> + [ " key623 " ] = > <nl> + int ( 623 ) <nl> + [ " key624 " ] = > <nl> + int ( 624 ) <nl> + [ " key625 " ] = > <nl> + int ( 625 ) <nl> + [ " key626 " ] = > <nl> + int ( 626 ) <nl> + [ " key627 " ] = > <nl> + int ( 627 ) <nl> + [ " key628 " ] = > <nl> + int ( 628 ) <nl> + [ " key629 " ] = > <nl> + int ( 629 ) <nl> + [ " key630 " ] = > <nl> + int ( 630 ) <nl> + [ " key631 " ] = > <nl> + int ( 631 ) <nl> + [ " key632 " ] = > <nl> + int ( 632 ) <nl> + [ " key633 " ] = > <nl> + int ( 633 ) <nl> + [ " key634 " ] = > <nl> + int ( 634 ) <nl> + [ " key635 " ] = > <nl> + int ( 635 ) <nl> + [ " key636 " ] = > <nl> + int ( 636 ) <nl> + [ " key637 " ] = > <nl> + int ( 637 ) <nl> + [ " key638 " ] = > <nl> + int ( 638 ) <nl> + [ " key639 " ] = > <nl> + int ( 639 ) <nl> + [ " key640 " ] = > <nl> + int ( 640 ) <nl> + [ " key641 " ] = > <nl> + int ( 641 ) <nl> + [ " key642 " ] = > <nl> + int ( 642 ) <nl> + [ " key643 " ] = > <nl> + int ( 643 ) <nl> + [ " key644 " ] = > <nl> + int ( 644 ) <nl> + [ " key645 " ] = > <nl> + int ( 645 ) <nl> + [ " key646 " ] = > <nl> + int ( 646 ) <nl> + [ " key647 " ] = > <nl> + int ( 647 ) <nl> + [ " key648 " ] = > <nl> + int ( 648 ) <nl> + [ " key649 " ] = > <nl> + int ( 649 ) <nl> + [ " key650 " ] = > <nl> + int ( 650 ) <nl> + [ " key651 " ] = > <nl> + int ( 651 ) <nl> + [ " key652 " ] = > <nl> + int ( 652 ) <nl> + [ " key653 " ] = > <nl> + int ( 653 ) <nl> + [ " key654 " ] = > <nl> + int ( 654 ) <nl> + [ " key655 " ] = > <nl> + int ( 655 ) <nl> + [ " key656 " ] = > <nl> + int ( 656 ) <nl> + [ " key657 " ] = > <nl> + int ( 657 ) <nl> + [ " key658 " ] = > <nl> + int ( 658 ) <nl> + [ " key659 " ] = > <nl> + int ( 659 ) <nl> + [ " key660 " ] = > <nl> + int ( 660 ) <nl> + [ " key661 " ] = > <nl> + int ( 661 ) <nl> + [ " key662 " ] = > <nl> + int ( 662 ) <nl> + [ " key663 " ] = > <nl> + int ( 663 ) <nl> + [ " key664 " ] = > <nl> + int ( 664 ) <nl> + [ " key665 " ] = > <nl> + int ( 665 ) <nl> + [ " key666 " ] = > <nl> + int ( 666 ) <nl> + [ " key667 " ] = > <nl> + int ( 667 ) <nl> + [ " key668 " ] = > <nl> + int ( 668 ) <nl> + [ " key669 " ] = > <nl> + int ( 669 ) <nl> + [ " key670 " ] = > <nl> + int ( 670 ) <nl> + [ " key671 " ] = > <nl> + int ( 671 ) <nl> + [ " key672 " ] = > <nl> + int ( 672 ) <nl> + [ " key673 " ] = > <nl> + int ( 673 ) <nl> + [ " key674 " ] = > <nl> + int ( 674 ) <nl> + [ " key675 " ] = > <nl> + int ( 675 ) <nl> + [ " key676 " ] = > <nl> + int ( 676 ) <nl> + [ " key677 " ] = > <nl> + int ( 677 ) <nl> + [ " key678 " ] = > <nl> + int ( 678 ) <nl> + [ " key679 " ] = > <nl> + int ( 679 ) <nl> + [ " key680 " ] = > <nl> + int ( 680 ) <nl> + [ " key681 " ] = > <nl> + int ( 681 ) <nl> + [ " key682 " ] = > <nl> + int ( 682 ) <nl> + [ " key683 " ] = > <nl> + int ( 683 ) <nl> + [ " key684 " ] = > <nl> + int ( 684 ) <nl> + [ " key685 " ] = > <nl> + int ( 685 ) <nl> + [ " key686 " ] = > <nl> + int ( 686 ) <nl> + [ " key687 " ] = > <nl> + int ( 687 ) <nl> + [ " key688 " ] = > <nl> + int ( 688 ) <nl> + [ " key689 " ] = > <nl> + int ( 689 ) <nl> + [ " key690 " ] = > <nl> + int ( 690 ) <nl> + [ " key691 " ] = > <nl> + int ( 691 ) <nl> + [ " key692 " ] = > <nl> + int ( 692 ) <nl> + [ " key693 " ] = > <nl> + int ( 693 ) <nl> + [ " key694 " ] = > <nl> + int ( 694 ) <nl> + [ " key695 " ] = > <nl> + int ( 695 ) <nl> + [ " key696 " ] = > <nl> + int ( 696 ) <nl> + [ " key697 " ] = > <nl> + int ( 697 ) <nl> + [ " key698 " ] = > <nl> + int ( 698 ) <nl> + [ " key699 " ] = > <nl> + int ( 699 ) <nl> + [ " key700 " ] = > <nl> + int ( 700 ) <nl> + [ " key701 " ] = > <nl> + int ( 701 ) <nl> + [ " key702 " ] = > <nl> + int ( 702 ) <nl> + [ " key703 " ] = > <nl> + int ( 703 ) <nl> + [ " key704 " ] = > <nl> + int ( 704 ) <nl> + [ " key705 " ] = > <nl> + int ( 705 ) <nl> + [ " key706 " ] = > <nl> + int ( 706 ) <nl> + [ " key707 " ] = > <nl> + int ( 707 ) <nl> + [ " key708 " ] = > <nl> + int ( 708 ) <nl> + [ " key709 " ] = > <nl> + int ( 709 ) <nl> + [ " key710 " ] = > <nl> + int ( 710 ) <nl> + [ " key711 " ] = > <nl> + int ( 711 ) <nl> + [ " key712 " ] = > <nl> + int ( 712 ) <nl> + [ " key713 " ] = > <nl> + int ( 713 ) <nl> + [ " key714 " ] = > <nl> + int ( 714 ) <nl> + [ " key715 " ] = > <nl> + int ( 715 ) <nl> + [ " key716 " ] = > <nl> + int ( 716 ) <nl> + [ " key717 " ] = > <nl> + int ( 717 ) <nl> + [ " key718 " ] = > <nl> + int ( 718 ) <nl> + [ " key719 " ] = > <nl> + int ( 719 ) <nl> + [ " key720 " ] = > <nl> + int ( 720 ) <nl> + [ " key721 " ] = > <nl> + int ( 721 ) <nl> + [ " key722 " ] = > <nl> + int ( 722 ) <nl> + [ " key723 " ] = > <nl> + int ( 723 ) <nl> + [ " key724 " ] = > <nl> + int ( 724 ) <nl> + [ " key725 " ] = > <nl> + int ( 725 ) <nl> + [ " key726 " ] = > <nl> + int ( 726 ) <nl> + [ " key727 " ] = > <nl> + int ( 727 ) <nl> + [ " key728 " ] = > <nl> + int ( 728 ) <nl> + [ " key729 " ] = > <nl> + int ( 729 ) <nl> + [ " key730 " ] = > <nl> + int ( 730 ) <nl> + [ " key731 " ] = > <nl> + int ( 731 ) <nl> + [ " key732 " ] = > <nl> + int ( 732 ) <nl> + [ " key733 " ] = > <nl> + int ( 733 ) <nl> + [ " key734 " ] = > <nl> + int ( 734 ) <nl> + [ " key735 " ] = > <nl> + int ( 735 ) <nl> + [ " key736 " ] = > <nl> + int ( 736 ) <nl> + [ " key737 " ] = > <nl> + int ( 737 ) <nl> + [ " key738 " ] = > <nl> + int ( 738 ) <nl> + [ " key739 " ] = > <nl> + int ( 739 ) <nl> + [ " key740 " ] = > <nl> + int ( 740 ) <nl> + [ " key741 " ] = > <nl> + int ( 741 ) <nl> + [ " key742 " ] = > <nl> + int ( 742 ) <nl> + [ " key743 " ] = > <nl> + int ( 743 ) <nl> + [ " key744 " ] = > <nl> + int ( 744 ) <nl> + [ " key745 " ] = > <nl> + int ( 745 ) <nl> + [ " key746 " ] = > <nl> + int ( 746 ) <nl> + [ " key747 " ] = > <nl> + int ( 747 ) <nl> + [ " key748 " ] = > <nl> + int ( 748 ) <nl> + [ " key749 " ] = > <nl> + int ( 749 ) <nl> + [ " key750 " ] = > <nl> + int ( 750 ) <nl> + [ " key751 " ] = > <nl> + int ( 751 ) <nl> + [ " key752 " ] = > <nl> + int ( 752 ) <nl> + [ " key753 " ] = > <nl> + int ( 753 ) <nl> + [ " key754 " ] = > <nl> + int ( 754 ) <nl> + [ " key755 " ] = > <nl> + int ( 755 ) <nl> + [ " key756 " ] = > <nl> + int ( 756 ) <nl> + [ " key757 " ] = > <nl> + int ( 757 ) <nl> + [ " key758 " ] = > <nl> + int ( 758 ) <nl> + [ " key759 " ] = > <nl> + int ( 759 ) <nl> + [ " key760 " ] = > <nl> + int ( 760 ) <nl> + [ " key761 " ] = > <nl> + int ( 761 ) <nl> + [ " key762 " ] = > <nl> + int ( 762 ) <nl> + [ " key763 " ] = > <nl> + int ( 763 ) <nl> + [ " key764 " ] = > <nl> + int ( 764 ) <nl> + [ " key765 " ] = > <nl> + int ( 765 ) <nl> + [ " key766 " ] = > <nl> + int ( 766 ) <nl> + [ " key767 " ] = > <nl> + int ( 767 ) <nl> + [ " key768 " ] = > <nl> + int ( 768 ) <nl> + [ " key769 " ] = > <nl> + int ( 769 ) <nl> + [ " key770 " ] = > <nl> + int ( 770 ) <nl> + [ " key771 " ] = > <nl> + int ( 771 ) <nl> + [ " key772 " ] = > <nl> + int ( 772 ) <nl> + [ " key773 " ] = > <nl> + int ( 773 ) <nl> + [ " key774 " ] = > <nl> + int ( 774 ) <nl> + [ " key775 " ] = > <nl> + int ( 775 ) <nl> + [ " key776 " ] = > <nl> + int ( 776 ) <nl> + [ " key777 " ] = > <nl> + int ( 777 ) <nl> + [ " key778 " ] = > <nl> + int ( 778 ) <nl> + [ " key779 " ] = > <nl> + int ( 779 ) <nl> + [ " key780 " ] = > <nl> + int ( 780 ) <nl> + [ " key781 " ] = > <nl> + int ( 781 ) <nl> + [ " key782 " ] = > <nl> + int ( 782 ) <nl> + [ " key783 " ] = > <nl> + int ( 783 ) <nl> + [ " key784 " ] = > <nl> + int ( 784 ) <nl> + [ " key785 " ] = > <nl> + int ( 785 ) <nl> + [ " key786 " ] = > <nl> + int ( 786 ) <nl> + [ " key787 " ] = > <nl> + int ( 787 ) <nl> + [ " key788 " ] = > <nl> + int ( 788 ) <nl> + [ " key789 " ] = > <nl> + int ( 789 ) <nl> + [ " key790 " ] = > <nl> + int ( 790 ) <nl> + [ " key791 " ] = > <nl> + int ( 791 ) <nl> + [ " key792 " ] = > <nl> + int ( 792 ) <nl> + [ " key793 " ] = > <nl> + int ( 793 ) <nl> + [ " key794 " ] = > <nl> + int ( 794 ) <nl> + [ " key795 " ] = > <nl> + int ( 795 ) <nl> + [ " key796 " ] = > <nl> + int ( 796 ) <nl> + [ " key797 " ] = > <nl> + int ( 797 ) <nl> + [ " key798 " ] = > <nl> + int ( 798 ) <nl> + [ " key799 " ] = > <nl> + int ( 799 ) <nl> + [ " key800 " ] = > <nl> + int ( 800 ) <nl> + [ " key801 " ] = > <nl> + int ( 801 ) <nl> + [ " key802 " ] = > <nl> + int ( 802 ) <nl> + [ " key803 " ] = > <nl> + int ( 803 ) <nl> + [ " key804 " ] = > <nl> + int ( 804 ) <nl> + [ " key805 " ] = > <nl> + int ( 805 ) <nl> + [ " key806 " ] = > <nl> + int ( 806 ) <nl> + [ " key807 " ] = > <nl> + int ( 807 ) <nl> + [ " key808 " ] = > <nl> + int ( 808 ) <nl> + [ " key809 " ] = > <nl> + int ( 809 ) <nl> + [ " key810 " ] = > <nl> + int ( 810 ) <nl> + [ " key811 " ] = > <nl> + int ( 811 ) <nl> + [ " key812 " ] = > <nl> + int ( 812 ) <nl> + [ " key813 " ] = > <nl> + int ( 813 ) <nl> + [ " key814 " ] = > <nl> + int ( 814 ) <nl> + [ " key815 " ] = > <nl> + int ( 815 ) <nl> + [ " key816 " ] = > <nl> + int ( 816 ) <nl> + [ " key817 " ] = > <nl> + int ( 817 ) <nl> + [ " key818 " ] = > <nl> + int ( 818 ) <nl> + [ " key819 " ] = > <nl> + int ( 819 ) <nl> + [ " key820 " ] = > <nl> + int ( 820 ) <nl> + [ " key821 " ] = > <nl> + int ( 821 ) <nl> + [ " key822 " ] = > <nl> + int ( 822 ) <nl> + [ " key823 " ] = > <nl> + int ( 823 ) <nl> + [ " key824 " ] = > <nl> + int ( 824 ) <nl> + [ " key825 " ] = > <nl> + int ( 825 ) <nl> + [ " key826 " ] = > <nl> + int ( 826 ) <nl> + [ " key827 " ] = > <nl> + int ( 827 ) <nl> + [ " key828 " ] = > <nl> + int ( 828 ) <nl> + [ " key829 " ] = > <nl> + int ( 829 ) <nl> + [ " key830 " ] = > <nl> + int ( 830 ) <nl> + [ " key831 " ] = > <nl> + int ( 831 ) <nl> + [ " key832 " ] = > <nl> + int ( 832 ) <nl> + [ " key833 " ] = > <nl> + int ( 833 ) <nl> + [ " key834 " ] = > <nl> + int ( 834 ) <nl> + [ " key835 " ] = > <nl> + int ( 835 ) <nl> + [ " key836 " ] = > <nl> + int ( 836 ) <nl> + [ " key837 " ] = > <nl> + int ( 837 ) <nl> + [ " key838 " ] = > <nl> + int ( 838 ) <nl> + [ " key839 " ] = > <nl> + int ( 839 ) <nl> + [ " key840 " ] = > <nl> + int ( 840 ) <nl> + [ " key841 " ] = > <nl> + int ( 841 ) <nl> + [ " key842 " ] = > <nl> + int ( 842 ) <nl> + [ " key843 " ] = > <nl> + int ( 843 ) <nl> + [ " key844 " ] = > <nl> + int ( 844 ) <nl> + [ " key845 " ] = > <nl> + int ( 845 ) <nl> + [ " key846 " ] = > <nl> + int ( 846 ) <nl> + [ " key847 " ] = > <nl> + int ( 847 ) <nl> + [ " key848 " ] = > <nl> + int ( 848 ) <nl> + [ " key849 " ] = > <nl> + int ( 849 ) <nl> + [ " key850 " ] = > <nl> + int ( 850 ) <nl> + [ " key851 " ] = > <nl> + int ( 851 ) <nl> + [ " key852 " ] = > <nl> + int ( 852 ) <nl> + [ " key853 " ] = > <nl> + int ( 853 ) <nl> + [ " key854 " ] = > <nl> + int ( 854 ) <nl> + [ " key855 " ] = > <nl> + int ( 855 ) <nl> + [ " key856 " ] = > <nl> + int ( 856 ) <nl> + [ " key857 " ] = > <nl> + int ( 857 ) <nl> + [ " key858 " ] = > <nl> + int ( 858 ) <nl> + [ " key859 " ] = > <nl> + int ( 859 ) <nl> + [ " key860 " ] = > <nl> + int ( 860 ) <nl> + [ " key861 " ] = > <nl> + int ( 861 ) <nl> + [ " key862 " ] = > <nl> + int ( 862 ) <nl> + [ " key863 " ] = > <nl> + int ( 863 ) <nl> + [ " key864 " ] = > <nl> + int ( 864 ) <nl> + [ " key865 " ] = > <nl> + int ( 865 ) <nl> + [ " key866 " ] = > <nl> + int ( 866 ) <nl> + [ " key867 " ] = > <nl> + int ( 867 ) <nl> + [ " key868 " ] = > <nl> + int ( 868 ) <nl> + [ " key869 " ] = > <nl> + int ( 869 ) <nl> + [ " key870 " ] = > <nl> + int ( 870 ) <nl> + [ " key871 " ] = > <nl> + int ( 871 ) <nl> + [ " key872 " ] = > <nl> + int ( 872 ) <nl> + [ " key873 " ] = > <nl> + int ( 873 ) <nl> + [ " key874 " ] = > <nl> + int ( 874 ) <nl> + [ " key875 " ] = > <nl> + int ( 875 ) <nl> + [ " key876 " ] = > <nl> + int ( 876 ) <nl> + [ " key877 " ] = > <nl> + int ( 877 ) <nl> + [ " key878 " ] = > <nl> + int ( 878 ) <nl> + [ " key879 " ] = > <nl> + int ( 879 ) <nl> + [ " key880 " ] = > <nl> + int ( 880 ) <nl> + [ " key881 " ] = > <nl> + int ( 881 ) <nl> + [ " key882 " ] = > <nl> + int ( 882 ) <nl> + [ " key883 " ] = > <nl> + int ( 883 ) <nl> + [ " key884 " ] = > <nl> + int ( 884 ) <nl> + [ " key885 " ] = > <nl> + int ( 885 ) <nl> + [ " key886 " ] = > <nl> + int ( 886 ) <nl> + [ " key887 " ] = > <nl> + int ( 887 ) <nl> + [ " key888 " ] = > <nl> + int ( 888 ) <nl> + [ " key889 " ] = > <nl> + int ( 889 ) <nl> + [ " key890 " ] = > <nl> + int ( 890 ) <nl> + [ " key891 " ] = > <nl> + int ( 891 ) <nl> + [ " key892 " ] = > <nl> + int ( 892 ) <nl> + [ " key893 " ] = > <nl> + int ( 893 ) <nl> + [ " key894 " ] = > <nl> + int ( 894 ) <nl> + [ " key895 " ] = > <nl> + int ( 895 ) <nl> + [ " key896 " ] = > <nl> + int ( 896 ) <nl> + [ " key897 " ] = > <nl> + int ( 897 ) <nl> + [ " key898 " ] = > <nl> + int ( 898 ) <nl> + [ " key899 " ] = > <nl> + int ( 899 ) <nl> + [ " key900 " ] = > <nl> + int ( 900 ) <nl> + [ " key901 " ] = > <nl> + int ( 901 ) <nl> + [ " key902 " ] = > <nl> + int ( 902 ) <nl> + [ " key903 " ] = > <nl> + int ( 903 ) <nl> + [ " key904 " ] = > <nl> + int ( 904 ) <nl> + [ " key905 " ] = > <nl> + int ( 905 ) <nl> + [ " key906 " ] = > <nl> + int ( 906 ) <nl> + [ " key907 " ] = > <nl> + int ( 907 ) <nl> + [ " key908 " ] = > <nl> + int ( 908 ) <nl> + [ " key909 " ] = > <nl> + int ( 909 ) <nl> + [ " key910 " ] = > <nl> + int ( 910 ) <nl> + [ " key911 " ] = > <nl> + int ( 911 ) <nl> + [ " key912 " ] = > <nl> + int ( 912 ) <nl> + [ " key913 " ] = > <nl> + int ( 913 ) <nl> + [ " key914 " ] = > <nl> + int ( 914 ) <nl> + [ " key915 " ] = > <nl> + int ( 915 ) <nl> + [ " key916 " ] = > <nl> + int ( 916 ) <nl> + [ " key917 " ] = > <nl> + int ( 917 ) <nl> + [ " key918 " ] = > <nl> + int ( 918 ) <nl> + [ " key919 " ] = > <nl> + int ( 919 ) <nl> + [ " key920 " ] = > <nl> + int ( 920 ) <nl> + [ " key921 " ] = > <nl> + int ( 921 ) <nl> + [ " key922 " ] = > <nl> + int ( 922 ) <nl> + [ " key923 " ] = > <nl> + int ( 923 ) <nl> + [ " key924 " ] = > <nl> + int ( 924 ) <nl> + [ " key925 " ] = > <nl> + int ( 925 ) <nl> + [ " key926 " ] = > <nl> + int ( 926 ) <nl> + [ " key927 " ] = > <nl> + int ( 927 ) <nl> + [ " key928 " ] = > <nl> + int ( 928 ) <nl> + [ " key929 " ] = > <nl> + int ( 929 ) <nl> + [ " key930 " ] = > <nl> + int ( 930 ) <nl> + [ " key931 " ] = > <nl> + int ( 931 ) <nl> + [ " key932 " ] = > <nl> + int ( 932 ) <nl> + [ " key933 " ] = > <nl> + int ( 933 ) <nl> + [ " key934 " ] = > <nl> + int ( 934 ) <nl> + [ " key935 " ] = > <nl> + int ( 935 ) <nl> + [ " key936 " ] = > <nl> + int ( 936 ) <nl> + [ " key937 " ] = > <nl> + int ( 937 ) <nl> + [ " key938 " ] = > <nl> + int ( 938 ) <nl> + [ " key939 " ] = > <nl> + int ( 939 ) <nl> + [ " key940 " ] = > <nl> + int ( 940 ) <nl> + [ " key941 " ] = > <nl> + int ( 941 ) <nl> + [ " key942 " ] = > <nl> + int ( 942 ) <nl> + [ " key943 " ] = > <nl> + int ( 943 ) <nl> + [ " key944 " ] = > <nl> + int ( 944 ) <nl> + [ " key945 " ] = > <nl> + int ( 945 ) <nl> + [ " key946 " ] = > <nl> + int ( 946 ) <nl> + [ " key947 " ] = > <nl> + int ( 947 ) <nl> + [ " key948 " ] = > <nl> + int ( 948 ) <nl> + [ " key949 " ] = > <nl> + int ( 949 ) <nl> + [ " key950 " ] = > <nl> + int ( 950 ) <nl> + [ " key951 " ] = > <nl> + int ( 951 ) <nl> + [ " key952 " ] = > <nl> + int ( 952 ) <nl> + [ " key953 " ] = > <nl> + int ( 953 ) <nl> + [ " key954 " ] = > <nl> + int ( 954 ) <nl> + [ " key955 " ] = > <nl> + int ( 955 ) <nl> + [ " key956 " ] = > <nl> + int ( 956 ) <nl> + [ " key957 " ] = > <nl> + int ( 957 ) <nl> + [ " key958 " ] = > <nl> + int ( 958 ) <nl> + [ " key959 " ] = > <nl> + int ( 959 ) <nl> + [ " key960 " ] = > <nl> + int ( 960 ) <nl> + [ " key961 " ] = > <nl> + int ( 961 ) <nl> + [ " key962 " ] = > <nl> + int ( 962 ) <nl> + [ " key963 " ] = > <nl> + int ( 963 ) <nl> + [ " key964 " ] = > <nl> + int ( 964 ) <nl> + [ " key965 " ] = > <nl> + int ( 965 ) <nl> + [ " key966 " ] = > <nl> + int ( 966 ) <nl> + [ " key967 " ] = > <nl> + int ( 967 ) <nl> + [ " key968 " ] = > <nl> + int ( 968 ) <nl> + [ " key969 " ] = > <nl> + int ( 969 ) <nl> + [ " key970 " ] = > <nl> + int ( 970 ) <nl> + [ " key971 " ] = > <nl> + int ( 971 ) <nl> + [ " key972 " ] = > <nl> + int ( 972 ) <nl> + [ " key973 " ] = > <nl> + int ( 973 ) <nl> + [ " key974 " ] = > <nl> + int ( 974 ) <nl> + [ " key975 " ] = > <nl> + int ( 975 ) <nl> + [ " key976 " ] = > <nl> + int ( 976 ) <nl> + [ " key977 " ] = > <nl> + int ( 977 ) <nl> + [ " key978 " ] = > <nl> + int ( 978 ) <nl> + [ " key979 " ] = > <nl> + int ( 979 ) <nl> + [ " key980 " ] = > <nl> + int ( 980 ) <nl> + [ " key981 " ] = > <nl> + int ( 981 ) <nl> + [ " key982 " ] = > <nl> + int ( 982 ) <nl> + [ " key983 " ] = > <nl> + int ( 983 ) <nl> + [ " key984 " ] = > <nl> + int ( 984 ) <nl> + [ " key985 " ] = > <nl> + int ( 985 ) <nl> + [ " key986 " ] = > <nl> + int ( 986 ) <nl> + [ " key987 " ] = > <nl> + int ( 987 ) <nl> + [ " key988 " ] = > <nl> + int ( 988 ) <nl> + [ " key989 " ] = > <nl> + int ( 989 ) <nl> + [ " key990 " ] = > <nl> + int ( 990 ) <nl> + [ " key991 " ] = > <nl> + int ( 991 ) <nl> + [ " key992 " ] = > <nl> + int ( 992 ) <nl> + [ " key993 " ] = > <nl> + int ( 993 ) <nl> + [ " key994 " ] = > <nl> + int ( 994 ) <nl> + [ " key995 " ] = > <nl> + int ( 995 ) <nl> + [ " key996 " ] = > <nl> + int ( 996 ) <nl> + [ " key997 " ] = > <nl> + int ( 997 ) <nl> + [ " key998 " ] = > <nl> + int ( 998 ) <nl> + [ " key999 " ] = > <nl> + int ( 999 ) <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . ddf754430ca <nl> mmm / dev / null <nl> ppp b / hphp / test / slow / serialization / map_unser_big . php . opts <nl> @ @ - 0 , 0 + 1 @ @ <nl> + - vServer . UnserializationBigMapThreshold = 1 <nl> \ No newline at end of file <nl>
Tests for Map unserialization
facebook/hhvm
180a69407471968156f899dc34752c215b1f53cf
2016-05-27T05:57:00Z
mmm a / tensorflow / stream_executor / dso_loader . cc <nl> ppp b / tensorflow / stream_executor / dso_loader . cc <nl> string GetCudnnVersion ( ) { return TF_CUDNN_VERSION ; } <nl> GetCudaDriverLibraryPath ( ) ) , <nl> dso_handle ) ; <nl> # else <nl> - return GetDsoHandle ( <nl> + port : : Status status = GetDsoHandle ( <nl> FindDsoPath ( port : : Env : : Default ( ) - > FormatLibraryFileName ( " cuda " , " 1 " ) , <nl> GetCudaDriverLibraryPath ( ) ) , <nl> dso_handle ) ; <nl> + # if defined ( __APPLE__ ) <nl> + / / On Mac OS X , CUDA sometimes installs libcuda . dylib instead of <nl> + / / libcuda . 1 . dylib . <nl> + return status . ok ( ) ? status : GetDsoHandle ( <nl> + FindDsoPath ( port : : Env : : Default ( ) - > FormatLibraryFileName ( " cuda " , " " ) , <nl> + GetCudaDriverLibraryPath ( ) ) , <nl> + dso_handle ) ; <nl> + # else <nl> + return status ; <nl> + # endif <nl> # endif <nl> } <nl> <nl>
Merge pull request from caisq / mac - cuda - loader - 2
tensorflow/tensorflow
28f5099d532ce59787ee58012b8ef04c498947ae
2017-01-28T21:19:32Z
mmm a / src / yuzu / configuration / config . cpp <nl> ppp b / src / yuzu / configuration / config . cpp <nl> void Config : : ReadValues ( ) { <nl> qt_config - > endGroup ( ) ; <nl> <nl> UISettings : : values . single_window_mode = qt_config - > value ( " singleWindowMode " , true ) . toBool ( ) ; <nl> + UISettings : : values . fullscreen = qt_config - > value ( " fullscreen " , false ) . toBool ( ) ; <nl> UISettings : : values . display_titlebar = qt_config - > value ( " displayTitleBars " , true ) . toBool ( ) ; <nl> UISettings : : values . show_filter_bar = qt_config - > value ( " showFilterBar " , true ) . toBool ( ) ; <nl> UISettings : : values . show_status_bar = qt_config - > value ( " showStatusBar " , true ) . toBool ( ) ; <nl> void Config : : SaveValues ( ) { <nl> qt_config - > endGroup ( ) ; <nl> <nl> qt_config - > setValue ( " singleWindowMode " , UISettings : : values . single_window_mode ) ; <nl> + qt_config - > setValue ( " fullscreen " , UISettings : : values . fullscreen ) ; <nl> qt_config - > setValue ( " displayTitleBars " , UISettings : : values . display_titlebar ) ; <nl> qt_config - > setValue ( " showFilterBar " , UISettings : : values . show_filter_bar ) ; <nl> qt_config - > setValue ( " showStatusBar " , UISettings : : values . show_status_bar ) ; <nl> mmm a / src / yuzu / main . cpp <nl> ppp b / src / yuzu / main . cpp <nl> void GMainWindow : : InitializeRecentFileMenuActions ( ) { <nl> void GMainWindow : : InitializeHotkeys ( ) { <nl> RegisterHotkey ( " Main Window " , " Load File " , QKeySequence : : Open ) ; <nl> RegisterHotkey ( " Main Window " , " Start Emulation " ) ; <nl> + RegisterHotkey ( " Main Window " , " Fullscreen " , QKeySequence : : FullScreen ) ; <nl> + RegisterHotkey ( " Main Window " , " Exit Fullscreen " , QKeySequence : : Cancel , Qt : : ApplicationShortcut ) ; <nl> LoadHotkeys ( ) ; <nl> <nl> connect ( GetHotkey ( " Main Window " , " Load File " , this ) , SIGNAL ( activated ( ) ) , this , <nl> SLOT ( OnMenuLoadFile ( ) ) ) ; <nl> connect ( GetHotkey ( " Main Window " , " Start Emulation " , this ) , SIGNAL ( activated ( ) ) , this , <nl> SLOT ( OnStartGame ( ) ) ) ; <nl> + connect ( GetHotkey ( " Main Window " , " Fullscreen " , render_window ) , & QShortcut : : activated , <nl> + ui . action_Fullscreen , & QAction : : trigger ) ; <nl> + connect ( GetHotkey ( " Main Window " , " Fullscreen " , render_window ) , & QShortcut : : activatedAmbiguously , <nl> + ui . action_Fullscreen , & QAction : : trigger ) ; <nl> + connect ( GetHotkey ( " Main Window " , " Exit Fullscreen " , this ) , & QShortcut : : activated , this , [ & ] { <nl> + if ( emulation_running ) { <nl> + ui . action_Fullscreen - > setChecked ( false ) ; <nl> + ToggleFullscreen ( ) ; <nl> + } <nl> + } ) ; <nl> } <nl> <nl> void GMainWindow : : SetDefaultUIGeometry ( ) { <nl> void GMainWindow : : RestoreUIState ( ) { <nl> ui . action_Single_Window_Mode - > setChecked ( UISettings : : values . single_window_mode ) ; <nl> ToggleWindowMode ( ) ; <nl> <nl> + ui . action_Fullscreen - > setChecked ( UISettings : : values . fullscreen ) ; <nl> + <nl> ui . action_Display_Dock_Widget_Headers - > setChecked ( UISettings : : values . display_titlebar ) ; <nl> OnDisplayTitleBars ( ui . action_Display_Dock_Widget_Headers - > isChecked ( ) ) ; <nl> <nl> void GMainWindow : : ConnectMenuEvents ( ) { <nl> connect ( ui . action_Show_Filter_Bar , & QAction : : triggered , this , & GMainWindow : : OnToggleFilterBar ) ; <nl> connect ( ui . action_Show_Status_Bar , & QAction : : triggered , statusBar ( ) , & QStatusBar : : setVisible ) ; <nl> <nl> + / / Fullscreen <nl> + ui . action_Fullscreen - > setShortcut ( GetHotkey ( " Main Window " , " Fullscreen " , this ) - > key ( ) ) ; <nl> + connect ( ui . action_Fullscreen , & QAction : : triggered , this , & GMainWindow : : ToggleFullscreen ) ; <nl> + <nl> / / Help <nl> connect ( ui . action_About , & QAction : : triggered , this , & GMainWindow : : OnAbout ) ; <nl> } <nl> void GMainWindow : : BootGame ( const QString & filename ) { <nl> render_window - > setFocus ( ) ; <nl> <nl> emulation_running = true ; <nl> + ToggleFullscreen ( ) ; <nl> OnStartGame ( ) ; <nl> } <nl> <nl> void GMainWindow : : OnStopGame ( ) { <nl> ShutdownGame ( ) ; <nl> } <nl> <nl> + void GMainWindow : : ToggleFullscreen ( ) { <nl> + if ( ! emulation_running ) { <nl> + return ; <nl> + } <nl> + if ( ui . action_Fullscreen - > isChecked ( ) ) { <nl> + if ( ui . action_Single_Window_Mode - > isChecked ( ) ) { <nl> + ui . menubar - > hide ( ) ; <nl> + statusBar ( ) - > hide ( ) ; <nl> + showFullScreen ( ) ; <nl> + } else { <nl> + render_window - > showFullScreen ( ) ; <nl> + } <nl> + } else { <nl> + if ( ui . action_Single_Window_Mode - > isChecked ( ) ) { <nl> + statusBar ( ) - > setVisible ( ui . action_Show_Status_Bar - > isChecked ( ) ) ; <nl> + ui . menubar - > show ( ) ; <nl> + showNormal ( ) ; <nl> + } else { <nl> + render_window - > showNormal ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> void GMainWindow : : ToggleWindowMode ( ) { <nl> if ( ui . action_Single_Window_Mode - > isChecked ( ) ) { <nl> / / Render in the main window . . . <nl> void GMainWindow : : closeEvent ( QCloseEvent * event ) { <nl> UISettings : : values . microprofile_visible = microProfileDialog - > isVisible ( ) ; <nl> # endif <nl> UISettings : : values . single_window_mode = ui . action_Single_Window_Mode - > isChecked ( ) ; <nl> + UISettings : : values . fullscreen = ui . action_Fullscreen - > isChecked ( ) ; <nl> UISettings : : values . display_titlebar = ui . action_Display_Dock_Widget_Headers - > isChecked ( ) ; <nl> UISettings : : values . show_filter_bar = ui . action_Show_Filter_Bar - > isChecked ( ) ; <nl> UISettings : : values . show_status_bar = ui . action_Show_Status_Bar - > isChecked ( ) ; <nl> mmm a / src / yuzu / main . h <nl> ppp b / src / yuzu / main . h <nl> private slots : <nl> void OnAbout ( ) ; <nl> void OnToggleFilterBar ( ) ; <nl> void OnDisplayTitleBars ( bool ) ; <nl> + void ToggleFullscreen ( ) ; <nl> void ToggleWindowMode ( ) ; <nl> void OnCoreError ( Core : : System : : ResultStatus , std : : string ) ; <nl> <nl> mmm a / src / yuzu / main . ui <nl> ppp b / src / yuzu / main . ui <nl> <nl> < string > Debugging < / string > <nl> < / property > <nl> < / widget > <nl> + < addaction name = " action_Fullscreen " / > <nl> < addaction name = " action_Single_Window_Mode " / > <nl> < addaction name = " action_Display_Dock_Widget_Headers " / > <nl> < addaction name = " action_Show_Filter_Bar " / > <nl> <nl> < string > Selects a folder to display in the game list < / string > <nl> < / property > <nl> < / action > <nl> - < / widget > <nl> + < action name = " action_Fullscreen " > <nl> + < property name = " checkable " > <nl> + < bool > true < / bool > <nl> + < / property > <nl> + < property name = " text " > <nl> + < string > Fullscreen < / string > <nl> + < / property > <nl> + < / action > <nl> + < / widget > <nl> < resources / > <nl> < / ui > <nl> mmm a / src / yuzu / ui_settings . h <nl> ppp b / src / yuzu / ui_settings . h <nl> struct Values { <nl> bool microprofile_visible ; <nl> <nl> bool single_window_mode ; <nl> + bool fullscreen ; <nl> bool display_titlebar ; <nl> bool show_filter_bar ; <nl> bool show_status_bar ; <nl>
Merge citra - emu PR by Styleoshin ( citra - qt : Adding fullscreen mode )
yuzu-emu/yuzu
f473780c52d2ee896e7c6ede3ffe9e8fadd37891
2018-01-16T14:50:33Z
mmm a / xbmc / addons / AddonDatabase . cpp <nl> ppp b / xbmc / addons / AddonDatabase . cpp <nl> bool CAddonDatabase : : GetBlacklisted ( std : : set < std : : string > & addons ) <nl> return false ; <nl> } <nl> <nl> - std : : string CAddonDatabase : : IsAddonBroken ( const std : : string & addonID ) <nl> + bool CAddonDatabase : : IsAddonBroken ( const std : : string & addonID ) <nl> { <nl> - return GetSingleValue ( PrepareSQL ( " SELECT reason FROM broken WHERE addonID = ' % s ' " , addonID . c_str ( ) ) ) ; <nl> + return ! GetSingleValue ( PrepareSQL ( " SELECT reason FROM broken WHERE addonID = ' % s ' " , addonID . c_str ( ) ) ) . empty ( ) ; <nl> } <nl> <nl> bool CAddonDatabase : : BlacklistAddon ( const std : : string & addonID ) <nl> mmm a / xbmc / addons / AddonDatabase . h <nl> ppp b / xbmc / addons / AddonDatabase . h <nl> class CAddonDatabase : public CDatabase <nl> <nl> / * ! \ brief Check whether an addon has been marked as broken via BreakAddon . <nl> \ param addonID id of the addon to check <nl> - \ return reason if the addon is broken , blank otherwise <nl> \ sa BreakAddon * / <nl> - std : : string IsAddonBroken ( const std : : string & addonID ) ; <nl> + bool IsAddonBroken ( const std : : string & addonID ) ; <nl> <nl> bool BlacklistAddon ( const std : : string & addonID ) ; <nl> bool RemoveAddonFromBlacklist ( const std : : string & addonID ) ; <nl> mmm a / xbmc / addons / Repository . cpp <nl> ppp b / xbmc / addons / Repository . cpp <nl> bool CRepositoryUpdateJob : : DoWork ( ) <nl> <nl> if ( localAddon ) <nl> { <nl> - bool brokenInDb = ! database . IsAddonBroken ( addon - > ID ( ) ) . empty ( ) ; <nl> + bool brokenInDb = database . IsAddonBroken ( addon - > ID ( ) ) ; <nl> if ( ! broken . empty ( ) & & ! brokenInDb ) <nl> { <nl> / / newly broken <nl>
[ addons ] CAddonDatabase : : IsAddonBroken : return bool instead of string
xbmc/xbmc
120fb748d6030e9dc5c18d55c066ee61eb282904
2016-06-18T12:23:24Z
mmm a / cocos / editor - support / cocostudio / ActionTimeline / CCTimeLine . cpp <nl> ppp b / cocos / editor - support / cocostudio / ActionTimeline / CCTimeLine . cpp <nl> void Timeline : : binarySearchKeyFrame ( int frameIndex ) <nl> needEnterFrame = true ; <nl> <nl> _fromIndex = 0 ; <nl> - <nl> - if ( length > 1 ) <nl> - _toIndex = 1 ; <nl> - else <nl> - _toIndex = 0 ; <nl> + _toIndex = 0 ; <nl> <nl> from = to = _frames . at ( 0 ) ; <nl> _currentKeyFrameIndex = 0 ; <nl>
fixed event frame will go twice loop when goto frame
cocos2d/cocos2d-x
1d7a4a5c0599bb180b560b72d3961400be3ec24d
2015-01-09T02:24:38Z
mmm a / xbmc / GUIWindowPointer . cpp <nl> ppp b / xbmc / GUIWindowPointer . cpp <nl> void CGUIWindowPointer : : OnWindowLoaded ( ) <nl> } <nl> CGUIWindow : : OnWindowLoaded ( ) ; <nl> DynamicResourceAlloc ( false ) ; <nl> + m_dwPointer = 0 ; <nl> } <nl> <nl> void CGUIWindowPointer : : Render ( ) <nl>
fixed : Ticket - the mystery of the disappearing mouse , merge from camelot r25910 .
xbmc/xbmc
78f95390a04ece84cf8c09448233eeabb7536062
2009-12-21T00:31:14Z
mmm a / src / flags / flag - definitions . h <nl> ppp b / src / flags / flag - definitions . h <nl> DEFINE_BOOL ( block_concurrent_recompilation , false , <nl> " block queued jobs until released " ) <nl> DEFINE_BOOL ( concurrent_inlining , false , <nl> " run optimizing compiler ' s inlining phase on a separate thread " ) <nl> - DEFINE_INT ( max_serializer_nesting , 25 , <nl> + DEFINE_INT ( max_serializer_nesting , 15 , <nl> " maximum levels for nesting child serializers " ) <nl> DEFINE_IMPLICATION ( future , concurrent_inlining ) <nl> DEFINE_BOOL ( trace_heap_broker_verbose , false , <nl>
[ Turbofan ] Reduce concurrent compilation recursion limit
v8/v8
a9a66826332cd6781da92651971925f34dbb3b86
2019-12-27T17:01:46Z
mmm a / xbmc / interfaces / python / PythonInvoker . cpp <nl> ppp b / xbmc / interfaces / python / PythonInvoker . cpp <nl> void CPythonInvoker : : initializeModules ( const std : : map < std : : string , PythonModuleI <nl> for ( std : : map < std : : string , PythonModuleInitialization > : : const_iterator module = modules . begin ( ) ; module ! = modules . end ( ) ; + + module ) <nl> { <nl> if ( ! initializeModule ( module - > second ) ) <nl> - CLog : : Log ( LOGWARNING , " CPythonInvoker ( % s , % i ) : unable to initialize python module \ " % s \ " " , module - > first . c_str ( ) , GetId ( ) , m_source ) ; <nl> + CLog : : Log ( LOGWARNING , " CPythonInvoker ( % d , % s ) : unable to initialize python module \ " % s \ " " , GetId ( ) , m_source , module - > first . c_str ( ) ) ; <nl> } <nl> } <nl> <nl>
CPythonInvoker : fix log message format ( thanks vdrfan )
xbmc/xbmc
d9a897d8eaaafec73d592eeeb6edf2bdeebb87fb
2013-09-09T11:49:54Z
mmm a / examples / objective - c / auth_sample / AuthTestService . podspec <nl> ppp b / examples / objective - c / auth_sample / AuthTestService . podspec <nl> Pod : : Spec . new do | s | <nl> ss . source_files = " # { dir } / * . pbrpc . { h , m } " , " # { dir } / * * / * . pbrpc . { h , m } " <nl> ss . header_mappings_dir = dir <nl> ss . requires_arc = true <nl> - ss . dependency " gRPC " , " ~ > 0 . 11 " <nl> + ss . dependency " gRPC " , " ~ > 0 . 12 " <nl> ss . dependency " # { s . name } / Messages " <nl> end <nl> end <nl> mmm a / examples / objective - c / helloworld / HelloWorld . podspec <nl> ppp b / examples / objective - c / helloworld / HelloWorld . podspec <nl> Pod : : Spec . new do | s | <nl> ss . source_files = " # { dir } / * . pbrpc . { h , m } " , " # { dir } / * * / * . pbrpc . { h , m } " <nl> ss . header_mappings_dir = dir <nl> ss . requires_arc = true <nl> - ss . dependency " gRPC " , " ~ > 0 . 11 " <nl> + ss . dependency " gRPC " , " ~ > 0 . 12 " <nl> ss . dependency " # { s . name } / Messages " <nl> end <nl> end <nl> mmm a / examples / objective - c / route_guide / RouteGuide . podspec <nl> ppp b / examples / objective - c / route_guide / RouteGuide . podspec <nl> Pod : : Spec . new do | s | <nl> ss . source_files = " # { dir } / * . pbrpc . { h , m } " , " # { dir } / * * / * . pbrpc . { h , m } " <nl> ss . header_mappings_dir = dir <nl> ss . requires_arc = true <nl> - ss . dependency " gRPC " , " ~ > 0 . 11 " <nl> + ss . dependency " gRPC " , " ~ > 0 . 12 " <nl> ss . dependency " # { s . name } / Messages " <nl> end <nl> end <nl> mmm a / gRPC . podspec <nl> ppp b / gRPC . podspec <nl> Pod : : Spec . new do | s | <nl> <nl> ss . requires_arc = false <nl> ss . libraries = ' z ' <nl> - ss . dependency ' OpenSSL ' , ' ~ > 1 . 0 . 200 ' <nl> + ss . dependency ' OpenSSL ' , ' ~ > 1 . 0 . 204 . 1 ' <nl> <nl> # ss . compiler_flags = ' - GCC_WARN_INHIBIT_ALL_WARNINGS ' , ' - w ' <nl> end <nl> mmm a / src / objective - c / README . md <nl> ppp b / src / objective - c / README . md <nl> Pod : : Spec . new do | s | <nl> s . version = ' 0 . 0 . 1 ' <nl> s . license = ' . . . ' <nl> <nl> - s . ios . deployment_target = ' 6 . 0 ' <nl> - s . osx . deployment_target = ' 10 . 8 ' <nl> + s . ios . deployment_target = ' 7 . 1 ' <nl> + s . osx . deployment_target = ' 10 . 9 ' <nl> <nl> # Run protoc with the Objective - C and gRPC plugins to generate protocol messages and gRPC clients . <nl> # You can run this command manually if you later change your protos and need to regenerate . <nl> Pod : : Spec . new do | s | <nl> ms . source_files = " * . pbobjc . { h , m } " <nl> ms . header_mappings_dir = " . " <nl> ms . requires_arc = false <nl> - ms . dependency " Protobuf " , " ~ > 3 . 0 . 0 - alpha - 3 " <nl> + ms . dependency " Protobuf " , " ~ > 3 . 0 . 0 - alpha - 4 " <nl> end <nl> <nl> # The - - objcgrpc_out plugin generates a pair of . pbrpc . h / . pbrpc . m files for each . proto file with <nl> Pod : : Spec . new do | s | <nl> ss . source_files = " * . pbrpc . { h , m } " <nl> ss . header_mappings_dir = " . " <nl> ss . requires_arc = true <nl> - ss . dependency " gRPC " , " ~ > 0 . 5 " <nl> + ss . dependency " gRPC " , " ~ > 0 . 12 " <nl> ss . dependency " # { s . name } / Messages " <nl> end <nl> end <nl> _protoc_ , in which case no system modification nor renaming is necessary . <nl> <nl> You need to compile the generated ` . pbobjc . * ` files ( the enums and messages ) without ARC support , <nl> and the generated ` . pbrpc . * ` files ( the services ) with ARC support . The generated code depends on <nl> - v0 . 5 + of the Objective - C gRPC runtime library and v3 . 0 . 0 - alpha - 3 + of the Objective - C Protobuf <nl> + v0 . 12 + of the Objective - C gRPC runtime library and v3 . 0 . 0 - alpha - 4 + of the Objective - C Protobuf <nl> runtime library . <nl> <nl> These libraries need to be integrated into your project as described in their respective Podspec <nl> mmm a / src / objective - c / examples / RemoteTestClient / RemoteTest . podspec <nl> ppp b / src / objective - c / examples / RemoteTestClient / RemoteTest . podspec <nl> Pod : : Spec . new do | s | <nl> s . version = " 0 . 0 . 1 " <nl> s . license = " New BSD " <nl> <nl> - s . ios . deployment_target = " 6 . 0 " <nl> - s . osx . deployment_target = " 10 . 8 " <nl> + s . ios . deployment_target = ' 7 . 1 ' <nl> + s . osx . deployment_target = ' 10 . 9 ' <nl> <nl> # Run protoc with the Objective - C and gRPC plugins to generate protocol messages and gRPC clients . <nl> s . prepare_command = < < - CMD <nl> Pod : : Spec . new do | s | <nl> ss . source_files = " * . pbrpc . { h , m } " <nl> ss . header_mappings_dir = " . " <nl> ss . requires_arc = true <nl> - ss . dependency " gRPC " , " ~ > 0 . 7 " <nl> + ss . dependency " gRPC " , " ~ > 0 . 12 " <nl> ss . dependency " # { s . name } / Messages " <nl> end <nl> end <nl> mmm a / src / objective - c / tests / RemoteTestClient / RemoteTest . podspec <nl> ppp b / src / objective - c / tests / RemoteTestClient / RemoteTest . podspec <nl> Pod : : Spec . new do | s | <nl> s . version = " 0 . 0 . 1 " <nl> s . license = " New BSD " <nl> <nl> - s . ios . deployment_target = " 6 . 0 " <nl> - s . osx . deployment_target = " 10 . 8 " <nl> + s . ios . deployment_target = ' 7 . 1 ' <nl> + s . osx . deployment_target = ' 10 . 9 ' <nl> <nl> # Run protoc with the Objective - C and gRPC plugins to generate protocol messages and gRPC clients . <nl> s . prepare_command = < < - CMD <nl> Pod : : Spec . new do | s | <nl> ms . source_files = " * . pbobjc . { h , m } " <nl> ms . header_mappings_dir = " . " <nl> ms . requires_arc = false <nl> - ms . dependency " Protobuf " , " ~ > 3 . 0 . 0 - alpha - 3 " <nl> + ms . dependency " Protobuf " , " ~ > 3 . 0 . 0 - alpha - 4 " <nl> end <nl> <nl> s . subspec " Services " do | ss | <nl> ss . source_files = " * . pbrpc . { h , m } " <nl> ss . header_mappings_dir = " . " <nl> ss . requires_arc = true <nl> - ss . dependency " gRPC " , " ~ > 0 . 5 " <nl> + ss . dependency " gRPC " , " ~ > 0 . 12 " <nl> ss . dependency " # { s . name } / Messages " <nl> end <nl> end <nl>
Adjust version requirements through samples and tests .
grpc/grpc
e3d9db2667c9ddd66745450fdd7bfd74f362093c
2015-11-26T06:16:38Z
mmm a / src / heap . cc <nl> ppp b / src / heap . cc <nl> Heap : : Heap ( ) <nl> gc_post_processing_depth_ ( 0 ) , <nl> ms_count_ ( 0 ) , <nl> gc_count_ ( 0 ) , <nl> + remembered_unmapped_pages_index_ ( 0 ) , <nl> unflattened_strings_length_ ( 0 ) , <nl> # ifdef DEBUG <nl> allocation_allowed_ ( true ) , <nl> void Heap : : FreeQueuedChunks ( ) { <nl> chunks_queued_for_free_ = NULL ; <nl> } <nl> <nl> + <nl> + void Heap : : RememberUnmappedPage ( Address page , bool compacted ) { <nl> + uintptr_t p = reinterpret_cast < uintptr_t > ( page ) ; <nl> + / / Tag the page pointer to make it findable in the dump file . <nl> + if ( compacted ) { <nl> + p ^ = 0xc1ead & ( Page : : kPageSize - 1 ) ; / / Cleared . <nl> + } else { <nl> + p ^ = 0x1d1ed & ( Page : : kPageSize - 1 ) ; / / I died . <nl> + } <nl> + remembered_unmapped_pages_ [ remembered_unmapped_pages_index_ ] = <nl> + reinterpret_cast < Address > ( p ) ; <nl> + remembered_unmapped_pages_index_ + + ; <nl> + remembered_unmapped_pages_index_ % = kRememberedUnmappedPages ; <nl> + } <nl> + <nl> } } / / namespace v8 : : internal <nl> mmm a / src / heap . h <nl> ppp b / src / heap . h <nl> class Heap { <nl> set_construct_stub_deopt_pc_offset ( Smi : : FromInt ( pc_offset ) ) ; <nl> } <nl> <nl> + / / For post mortem debugging . <nl> + void RememberUnmappedPage ( Address page , bool compacted ) ; <nl> + <nl> private : <nl> Heap ( ) ; <nl> <nl> class Heap { <nl> int ms_count_ ; / / how many mark - sweep collections happened <nl> unsigned int gc_count_ ; / / how many gc happened <nl> <nl> + / / For post mortem debugging . <nl> + static const int kRememberedUnmappedPages = 128 ; <nl> + int remembered_unmapped_pages_index_ ; <nl> + Address remembered_unmapped_pages_ [ kRememberedUnmappedPages ] ; <nl> + <nl> / / Total length of the strings we failed to flatten since the last GC . <nl> int unflattened_strings_length_ ; <nl> <nl> class Heap { <nl> <nl> inline void UpdateOldSpaceLimits ( ) ; <nl> <nl> - <nl> / / Allocate an uninitialized object in map space . The behavior is identical <nl> / / to Heap : : AllocateRaw ( size_in_bytes , MAP_SPACE ) , except that ( a ) it doesn ' t <nl> / / have to test the allocation space argument and ( b ) can reduce code size <nl> mmm a / src / mark - compact . cc <nl> ppp b / src / mark - compact . cc <nl> void MarkCompactCollector : : EvacuateNewSpaceAndCandidates ( ) { <nl> space - > Free ( p - > area_start ( ) , p - > area_size ( ) ) ; <nl> p - > set_scan_on_scavenge ( false ) ; <nl> slots_buffer_allocator_ . DeallocateChain ( p - > slots_buffer_address ( ) ) ; <nl> - p - > ClearEvacuationCandidate ( ) ; <nl> p - > ResetLiveBytes ( ) ; <nl> space - > ReleasePage ( p ) ; <nl> } <nl> mmm a / src / spaces . cc <nl> ppp b / src / spaces . cc <nl> void MemoryAllocator : : Free ( MemoryChunk * chunk ) { <nl> PerformAllocationCallback ( space , kAllocationActionFree , chunk - > size ( ) ) ; <nl> } <nl> <nl> + isolate_ - > heap ( ) - > RememberUnmappedPage ( <nl> + reinterpret_cast < Address > ( chunk ) , chunk - > IsEvacuationCandidate ( ) ) ; <nl> + <nl> delete chunk - > slots_buffer ( ) ; <nl> delete chunk - > skip_list ( ) ; <nl> <nl>
Record the addresses of pages that are unmapped to aid
v8/v8
e3774cf23f5033c34021122995ddcfa2950c49d7
2012-03-16T14:13:22Z
mmm a / ChangeLog <nl> ppp b / ChangeLog <nl> <nl> + 2010 - 04 - 12 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> + <nl> + Added warning for the system which lacks clock_gettime with <nl> + CLOCK_MONOTONIC . <nl> + * src / MultiUrlRequestInfo . cc <nl> + * src / TimerA2 . cc <nl> + * src / TimerA2 . h <nl> + <nl> 2010 - 04 - 12 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net > <nl> <nl> Removed redundant method call for DownloadEngine . <nl> mmm a / src / MultiUrlRequestInfo . cc <nl> ppp b / src / MultiUrlRequestInfo . cc <nl> downloadresultcode : : RESULT MultiUrlRequestInfo : : execute ( ) <nl> } <nl> SocketCore : : setTLSContext ( tlsContext ) ; <nl> # endif <nl> + if ( ! Timer : : monotonicClock ( ) ) { <nl> + _logger - > warn ( " Don ' t change system time while aria2c is running . " <nl> + " Doing this may make aria2c hang for long time . " ) ; <nl> + } <nl> <nl> std : : string serverStatIf = _option - > get ( PREF_SERVER_STAT_IF ) ; <nl> if ( ! serverStatIf . empty ( ) ) { <nl> mmm a / src / TimerA2 . cc <nl> ppp b / src / TimerA2 . cc <nl> void Timer : : advance ( time_t sec ) <nl> _tv . tv_sec + = sec ; <nl> } <nl> <nl> + bool Timer : : monotonicClock ( ) <nl> + { <nl> + return useClockGettime ( ) ; <nl> + } <nl> + <nl> } / / namespace aria2 <nl> mmm a / src / TimerA2 . h <nl> ppp b / src / TimerA2 . h <nl> class Timer { <nl> int64_t getTimeInMicros ( ) const ; <nl> <nl> int64_t getTimeInMillis ( ) const ; <nl> + <nl> + / / Returns true if this Timer is not affected by system time change . <nl> + / / Otherwise return false . <nl> + static bool monotonicClock ( ) ; <nl> } ; <nl> <nl> } / / namespace aria2 <nl>
2010 - 04 - 12 Tatsuhiro Tsujikawa < t - tujikawa @ users . sourceforge . net >
aria2/aria2
473d1ff6b5298e545de9973356da600c5c0efed6
2010-04-12T13:05:41Z
mmm a / CHANGELOG . md <nl> ppp b / CHANGELOG . md <nl> CHANGELOG <nl> Swift 5 . 3 <nl> mmmmmmmmm - <nl> <nl> + * [ SE - 0268 ] [ ] : <nl> + <nl> + A ` didSet ` observer which does not refer to the ` oldValue ` in its body or does not explicitly request it by placing it in the parameter list ( i . e . ` didSet ( oldValue ) ` ) will no longer trigger a call to the property getter to fetch the ` oldValue ` . <nl> + <nl> + ` ` ` swift <nl> + class C { <nl> + var value : Int = 0 { <nl> + didSet { print ( " didSet called ! " ) } <nl> + } <nl> + } <nl> + <nl> + let c = C ( ) <nl> + / / This does not trigger a call to the getter for ' value ' <nl> + / / because the ' didSet ' observer on ' value ' does not <nl> + / / refer to the ' oldValue ' in its body , which means <nl> + / / the ' oldValue ' does not need to be fetched . <nl> + c . value = 1 <nl> + ` ` ` <nl> + <nl> * [ SE - 0276 ] [ ] : <nl> <nl> Catch clauses in a ` do ` - ` catch ` statement can now include multiple patterns in a comma - separated list . The body of a ` catch ` clause will be executed if a thrown error matches any of its patterns . <nl> Swift 1 . 0 <nl> [ SE - 0254 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0254 - static - subscripts . md > <nl> [ SE - 0266 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0266 - synthesized - comparable - for - enumerations . md > <nl> [ SE - 0267 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0267 - where - on - contextually - generic . md > <nl> + [ SE - 0268 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0268 - didset - semantics . md > <nl> [ SE - 0269 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0269 - implicit - self - explicit - capture . md > <nl> [ SE - 0276 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0276 - multi - pattern - catch - clauses . md > <nl> [ SE - 0280 ] : < https : / / github . com / apple / swift - evolution / blob / master / proposals / 0280 - enum - cases - as - protocol - witnesses . md > <nl>
[ Changelog ] Add SE - 0268 to the changelog , under Swift 5 . 3 ( )
apple/swift
6b9dd236a433f0b27a02fd59b7e3c46f82284776
2020-04-10T16:18:23Z
mmm a / src / ast / ast - expression - rewriter . cc <nl> ppp b / src / ast / ast - expression - rewriter . cc <nl> void AstExpressionRewriter : : VisitClassLiteral ( ClassLiteral * node ) { <nl> } <nl> } <nl> <nl> + void AstExpressionRewriter : : VisitInitializeClassFieldsStatement ( <nl> + InitializeClassFieldsStatement * node ) { <nl> + ZoneList < typename ClassLiteral : : Property * > * properties = node - > fields ( ) ; <nl> + for ( int i = 0 ; i < properties - > length ( ) ; i + + ) { <nl> + VisitLiteralProperty ( properties - > at ( i ) ) ; <nl> + } <nl> + } <nl> + <nl> void AstExpressionRewriter : : VisitNativeFunctionLiteral ( <nl> NativeFunctionLiteral * node ) { <nl> REWRITE_THIS ( node ) ; <nl> mmm a / src / ast / ast - numbering . cc <nl> ppp b / src / ast / ast - numbering . cc <nl> void AstNumberingVisitor : : VisitClassLiteral ( ClassLiteral * node ) { <nl> } <nl> } <nl> <nl> + void AstNumberingVisitor : : VisitInitializeClassFieldsStatement ( <nl> + InitializeClassFieldsStatement * node ) { <nl> + for ( int i = 0 ; i < node - > fields ( ) - > length ( ) ; i + + ) { <nl> + VisitLiteralProperty ( node - > fields ( ) - > at ( i ) ) ; <nl> + } <nl> + } <nl> + <nl> void AstNumberingVisitor : : VisitObjectLiteral ( ObjectLiteral * node ) { <nl> for ( int i = 0 ; i < node - > properties ( ) - > length ( ) ; i + + ) { <nl> VisitLiteralProperty ( node - > properties ( ) - > at ( i ) ) ; <nl> mmm a / src / ast / ast - traversal - visitor . h <nl> ppp b / src / ast / ast - traversal - visitor . h <nl> void AstTraversalVisitor < Subclass > : : VisitClassLiteral ( ClassLiteral * expr ) { <nl> } <nl> } <nl> <nl> + template < class Subclass > <nl> + void AstTraversalVisitor < Subclass > : : VisitInitializeClassFieldsStatement ( <nl> + InitializeClassFieldsStatement * stmt ) { <nl> + PROCESS_NODE ( stmt ) ; <nl> + ZoneList < ClassLiteralProperty * > * props = stmt - > fields ( ) ; <nl> + for ( int i = 0 ; i < props - > length ( ) ; + + i ) { <nl> + ClassLiteralProperty * prop = props - > at ( i ) ; <nl> + if ( ! prop - > key ( ) - > IsLiteral ( ) ) { <nl> + RECURSE ( Visit ( prop - > key ( ) ) ) ; <nl> + } <nl> + RECURSE ( Visit ( prop - > value ( ) ) ) ; <nl> + } <nl> + } <nl> + <nl> template < class Subclass > <nl> void AstTraversalVisitor < Subclass > : : VisitSpread ( Spread * expr ) { <nl> PROCESS_EXPRESSION ( expr ) ; <nl> mmm a / src / ast / ast . h <nl> ppp b / src / ast / ast . h <nl> namespace internal { <nl> V ( WithStatement ) \ <nl> V ( TryCatchStatement ) \ <nl> V ( TryFinallyStatement ) \ <nl> - V ( DebuggerStatement ) <nl> + V ( DebuggerStatement ) \ <nl> + V ( InitializeClassFieldsStatement ) <nl> <nl> # define LITERAL_NODE_LIST ( V ) \ <nl> V ( RegExpLiteral ) \ <nl> class ClassLiteralProperty final : public LiteralProperty { <nl> bool is_static_ ; <nl> } ; <nl> <nl> + class InitializeClassFieldsStatement final : public Statement { <nl> + public : <nl> + typedef ClassLiteralProperty Property ; <nl> + ZoneList < Property * > * fields ( ) const { return fields_ ; } <nl> + bool needs_home_object ( ) const { return needs_home_object_ ; } <nl> + <nl> + private : <nl> + friend class AstNodeFactory ; <nl> + <nl> + InitializeClassFieldsStatement ( ZoneList < Property * > * fields , <nl> + bool needs_home_object , int pos ) <nl> + : Statement ( pos , kInitializeClassFieldsStatement ) , <nl> + fields_ ( fields ) , <nl> + needs_home_object_ ( needs_home_object ) { } <nl> + <nl> + ZoneList < Property * > * fields_ ; <nl> + bool needs_home_object_ ; <nl> + } ; <nl> + <nl> class ClassLiteral final : public Expression { <nl> public : <nl> typedef ClassLiteralProperty Property ; <nl> class AstNodeFactory final BASE_EMBEDDED { <nl> return new ( zone_ ) ImportCallExpression ( args , pos ) ; <nl> } <nl> <nl> + InitializeClassFieldsStatement * NewInitializeClassFieldsStatement ( <nl> + ZoneList < ClassLiteralProperty * > * args , bool needs_home_object , int pos ) { <nl> + return new ( zone_ ) <nl> + InitializeClassFieldsStatement ( args , needs_home_object , pos ) ; <nl> + } <nl> + <nl> Zone * zone ( ) const { return zone_ ; } <nl> void set_zone ( Zone * zone ) { zone_ = zone ; } <nl> <nl> mmm a / src / ast / prettyprinter . cc <nl> ppp b / src / ast / prettyprinter . cc <nl> void CallPrinter : : VisitClassLiteral ( ClassLiteral * node ) { <nl> } <nl> } <nl> <nl> + void CallPrinter : : VisitInitializeClassFieldsStatement ( <nl> + InitializeClassFieldsStatement * node ) { <nl> + for ( int i = 0 ; i < node - > fields ( ) - > length ( ) ; i + + ) { <nl> + Find ( node - > fields ( ) - > at ( i ) - > value ( ) ) ; <nl> + } <nl> + } <nl> <nl> void CallPrinter : : VisitNativeFunctionLiteral ( NativeFunctionLiteral * node ) { } <nl> <nl> void AstPrinter : : VisitClassLiteral ( ClassLiteral * node ) { <nl> PrintClassProperties ( node - > properties ( ) ) ; <nl> } <nl> <nl> + void AstPrinter : : VisitInitializeClassFieldsStatement ( <nl> + InitializeClassFieldsStatement * node ) { <nl> + IndentedScope indent ( this , " INITIALIZE CLASS FIELDS " , node - > position ( ) ) ; <nl> + PrintClassProperties ( node - > fields ( ) ) ; <nl> + } <nl> + <nl> void AstPrinter : : PrintClassProperties ( <nl> ZoneList < ClassLiteral : : Property * > * properties ) { <nl> for ( int i = 0 ; i < properties - > length ( ) ; i + + ) { <nl> mmm a / src / interpreter / bytecode - generator . cc <nl> ppp b / src / interpreter / bytecode - generator . cc <nl> void BytecodeGenerator : : VisitDebuggerStatement ( DebuggerStatement * stmt ) { <nl> } <nl> <nl> void BytecodeGenerator : : VisitFunctionLiteral ( FunctionLiteral * expr ) { <nl> - DCHECK_EQ ( expr - > scope ( ) - > outer_scope ( ) , current_scope ( ) ) ; <nl> + / / TODO ( gsathya ) : Fix the DCHECK once class literals use do expressions . <nl> + DCHECK ( expr - > scope ( ) - > outer_scope ( ) = = current_scope ( ) | | <nl> + FLAG_harmony_class_fields ) ; <nl> uint8_t flags = CreateClosureFlags : : Encode ( <nl> expr - > pretenure ( ) , closure_scope ( ) - > is_function_scope ( ) ) ; <nl> size_t entry = builder ( ) - > AllocateDeferredConstantPoolEntry ( ) ; <nl> void BytecodeGenerator : : VisitClassLiteralProperties ( ClassLiteral * expr , <nl> } <nl> } <nl> <nl> + void BytecodeGenerator : : VisitInitializeClassFieldsStatement ( <nl> + InitializeClassFieldsStatement * expr ) { <nl> + Register constructor ( builder ( ) - > Receiver ( ) ) ; <nl> + <nl> + if ( expr - > needs_home_object ( ) ) { <nl> + FeedbackSlot slot = feedback_spec ( ) - > AddStoreICSlot ( language_mode ( ) ) ; <nl> + builder ( ) <nl> + - > LoadAccumulatorWithRegister ( constructor ) <nl> + . StoreHomeObjectProperty ( Register : : function_closure ( ) , <nl> + feedback_index ( slot ) , language_mode ( ) ) ; <nl> + } <nl> + <nl> + Register key = register_allocator ( ) - > NewRegister ( ) ; <nl> + Register value = register_allocator ( ) - > NewRegister ( ) ; <nl> + <nl> + / / TODO ( gsathya ) : Fix evaluation order for computed properties . <nl> + for ( int i = 0 ; i < expr - > fields ( ) - > length ( ) ; i + + ) { <nl> + ClassLiteral : : Property * property = expr - > fields ( ) - > at ( i ) ; <nl> + BuildLoadPropertyKey ( property , key ) ; <nl> + DataPropertyInLiteralFlags flags = DataPropertyInLiteralFlag : : kNoFlags ; <nl> + FeedbackSlot slot = feedback_spec ( ) - > AddStoreDataPropertyInLiteralICSlot ( ) ; <nl> + <nl> + VisitForRegisterValue ( property - > value ( ) , value ) ; <nl> + VisitSetHomeObject ( value , constructor , property ) ; <nl> + <nl> + builder ( ) - > LoadAccumulatorWithRegister ( value ) . StoreDataPropertyInLiteral ( <nl> + constructor , key , flags , feedback_index ( slot ) ) ; <nl> + } <nl> + } <nl> + <nl> void BytecodeGenerator : : BuildClassLiteralNameProperty ( ClassLiteral * expr , <nl> Register literal ) { <nl> if ( ! expr - > has_name_static_property ( ) & & <nl> mmm a / src / parsing / parser - base . h <nl> ppp b / src / parsing / parser - base . h <nl> class ParserBase { <nl> : variable ( nullptr ) , <nl> extends ( parser - > impl ( ) - > NullExpression ( ) ) , <nl> properties ( parser - > impl ( ) - > NewClassPropertyList ( 4 ) ) , <nl> + static_fields ( parser - > impl ( ) - > NewClassPropertyList ( 4 ) ) , <nl> constructor ( parser - > impl ( ) - > NullExpression ( ) ) , <nl> has_seen_constructor ( false ) , <nl> has_name_static_property ( false ) , <nl> has_static_computed_names ( false ) , <nl> - is_anonymous ( false ) { } <nl> + is_anonymous ( false ) , <nl> + field_scope ( nullptr ) { } <nl> Variable * variable ; <nl> ExpressionT extends ; <nl> typename Types : : ClassPropertyList properties ; <nl> + typename Types : : ClassPropertyList static_fields ; <nl> FunctionLiteralT constructor ; <nl> bool has_seen_constructor ; <nl> bool has_name_static_property ; <nl> bool has_static_computed_names ; <nl> bool is_anonymous ; <nl> + DeclarationScope * field_scope ; <nl> } ; <nl> <nl> DeclarationScope * NewScriptScope ( ) const { <nl> class ParserBase { <nl> bool * ok ) ; <nl> ExpressionT ParseObjectLiteral ( bool * ok ) ; <nl> ClassLiteralPropertyT ParseClassPropertyDefinition ( <nl> - ClassLiteralChecker * checker , bool has_extends , bool * is_computed_name , <nl> - bool * has_seen_constructor , ClassLiteralProperty : : Kind * property_kind , <nl> - bool * is_static , bool * has_name_static_property , bool * ok ) ; <nl> + ClassLiteralChecker * checker , ClassInfo * class_info , bool has_extends , <nl> + bool * is_computed_name , bool * has_seen_constructor , <nl> + ClassLiteralProperty : : Kind * property_kind , bool * is_static , <nl> + bool * has_name_static_property , bool * ok ) ; <nl> FunctionLiteralT ParseClassFieldForInitializer ( bool has_initializer , <nl> bool * ok ) ; <nl> ObjectLiteralPropertyT ParseObjectPropertyDefinition ( <nl> typename ParserBase < Impl > : : ExpressionT ParserBase < Impl > : : ParsePropertyName ( <nl> template < typename Impl > <nl> typename ParserBase < Impl > : : ClassLiteralPropertyT <nl> ParserBase < Impl > : : ParseClassPropertyDefinition ( <nl> - ClassLiteralChecker * checker , bool has_extends , bool * is_computed_name , <nl> - bool * has_seen_constructor , ClassLiteralProperty : : Kind * property_kind , <nl> - bool * is_static , bool * has_name_static_property , bool * ok ) { <nl> + ClassLiteralChecker * checker , ClassInfo * class_info , bool has_extends , <nl> + bool * is_computed_name , bool * has_seen_constructor , <nl> + ClassLiteralProperty : : Kind * property_kind , bool * is_static , <nl> + bool * has_name_static_property , bool * ok ) { <nl> DCHECK_NOT_NULL ( has_seen_constructor ) ; <nl> DCHECK_NOT_NULL ( has_name_static_property ) ; <nl> bool is_get = false ; <nl> ParserBase < Impl > : : ParseClassPropertyDefinition ( <nl> case PropertyKind : : kValueProperty : <nl> if ( allow_harmony_class_fields ( ) ) { <nl> bool has_initializer = Check ( Token : : ASSIGN ) ; <nl> - ExpressionT function_literal = ParseClassFieldForInitializer ( <nl> - has_initializer , CHECK_OK_CUSTOM ( NullLiteralProperty ) ) ; <nl> + ExpressionT initializer ; <nl> + if ( class_info - > field_scope = = nullptr ) { <nl> + class_info - > field_scope = <nl> + NewFunctionScope ( FunctionKind : : kConciseMethod ) ; <nl> + / / TODO ( gsathya ) : Make scopes be non contiguous . <nl> + class_info - > field_scope - > set_start_position ( <nl> + scanner ( ) - > location ( ) . end_pos ) ; <nl> + scope ( ) - > SetLanguageMode ( LanguageMode : : kStrict ) ; <nl> + } <nl> + if ( has_initializer ) { <nl> + FunctionState initializer_state ( & function_state_ , & scope_ , <nl> + class_info - > field_scope ) ; <nl> + ExpressionClassifier expression_classifier ( this ) ; <nl> + initializer = <nl> + ParseAssignmentExpression ( true , CHECK_OK_CUSTOM ( NullExpression ) ) ; <nl> + impl ( ) - > RewriteNonPattern ( CHECK_OK_CUSTOM ( NullExpression ) ) ; <nl> + } else { <nl> + initializer = factory ( ) - > NewUndefinedLiteral ( kNoSourcePosition ) ; <nl> + } <nl> + class_info - > field_scope - > set_end_position ( <nl> + scanner ( ) - > location ( ) . end_pos ) ; <nl> ExpectSemicolon ( CHECK_OK_CUSTOM ( NullLiteralProperty ) ) ; <nl> * property_kind = ClassLiteralProperty : : FIELD ; <nl> ClassLiteralPropertyT result = factory ( ) - > NewClassLiteralProperty ( <nl> - name_expression , function_literal , * property_kind , * is_static , <nl> + name_expression , initializer , * property_kind , * is_static , <nl> * is_computed_name ) ; <nl> impl ( ) - > SetFunctionNameFromPropertyName ( result , name ) ; <nl> return result ; <nl> typename ParserBase < Impl > : : ExpressionT ParserBase < Impl > : : ParseClassLiteral ( <nl> / / property . <nl> bool is_constructor = ! class_info . has_seen_constructor ; <nl> ClassLiteralPropertyT property = ParseClassPropertyDefinition ( <nl> - & checker , has_extends , & is_computed_name , <nl> + & checker , & class_info , has_extends , & is_computed_name , <nl> & class_info . has_seen_constructor , & property_kind , & is_static , <nl> & class_info . has_name_static_property , CHECK_OK ) ; <nl> if ( ! class_info . has_static_computed_names & & is_static & & <nl> mmm a / src / parsing / parser . cc <nl> ppp b / src / parsing / parser . cc <nl> void Parser : : DeclareClassProperty ( const AstRawString * class_name , <nl> return ; <nl> } <nl> <nl> - if ( property - > kind ( ) = = ClassLiteralProperty : : FIELD ) { <nl> + if ( property - > kind ( ) = = ClassLiteralProperty : : FIELD & & is_static ) { <nl> DCHECK ( allow_harmony_class_fields ( ) ) ; <nl> - / / TODO ( littledan ) : Implement class fields <nl> + class_info - > static_fields - > Add ( property , zone ( ) ) ; <nl> + } else { <nl> + class_info - > properties - > Add ( property , zone ( ) ) ; <nl> } <nl> - class_info - > properties - > Add ( property , zone ( ) ) ; <nl> } <nl> <nl> / / This method generates a ClassLiteral AST node . <nl> Expression * Parser : : RewriteClassLiteral ( Scope * block_scope , <nl> <nl> AddFunctionForNameInference ( class_info - > constructor ) ; <nl> <nl> - return class_literal ; <nl> + Expression * result = class_literal ; <nl> + <nl> + if ( class_info - > static_fields - > length ( ) > 0 ) { <nl> + / / The class literal is rewritten to : <nl> + / / do { <nl> + / / temp = class { . . } ; <nl> + / / % _Call ( function ( ) { . . . static class fields initializer . . . } , temp ) ; <nl> + / / temp ; <nl> + / / } <nl> + Block * do_block = factory ( ) - > NewBlock ( 2 , false ) ; <nl> + <nl> + Variable * class_var = NewTemporary ( ast_value_factory ( ) - > empty_string ( ) ) ; <nl> + { <nl> + / / temp = class { . . } ; <nl> + VariableProxy * class_proxy = factory ( ) - > NewVariableProxy ( class_var ) ; <nl> + <nl> + Assignment * assign_class_proxy = factory ( ) - > NewAssignment ( <nl> + Token : : ASSIGN , class_proxy , class_literal , kNoSourcePosition ) ; <nl> + do_block - > statements ( ) - > Add ( factory ( ) - > NewExpressionStatement ( <nl> + assign_class_proxy , kNoSourcePosition ) , <nl> + zone ( ) ) ; <nl> + } <nl> + <nl> + FunctionLiteral * initializer ; <nl> + { <nl> + / / function ( ) { . . static class fields initializer . . } <nl> + ZoneList < Statement * > * statements = NewStatementList ( 1 ) ; <nl> + InitializeClassFieldsStatement * class_fields = <nl> + factory ( ) - > NewInitializeClassFieldsStatement ( <nl> + class_info - > static_fields , <nl> + class_info - > field_scope - > NeedsHomeObject ( ) , kNoSourcePosition ) ; <nl> + statements - > Add ( class_fields , zone ( ) ) ; <nl> + initializer = factory ( ) - > NewFunctionLiteral ( <nl> + ast_value_factory ( ) - > empty_string ( ) , class_info - > field_scope , <nl> + statements , 0 , 0 , 0 , FunctionLiteral : : kNoDuplicateParameters , <nl> + FunctionLiteral : : kAnonymousExpression , <nl> + FunctionLiteral : : kShouldEagerCompile , <nl> + class_info - > field_scope - > start_position ( ) , true , <nl> + GetNextFunctionLiteralId ( ) ) ; <nl> + } <nl> + <nl> + { <nl> + / / % _Call ( function ( ) { . . initializer . . } , temp ) ; <nl> + auto args = new ( zone ( ) ) ZoneList < Expression * > ( 2 , zone ( ) ) ; <nl> + args - > Add ( initializer , zone ( ) ) ; <nl> + args - > Add ( factory ( ) - > NewVariableProxy ( class_var ) , zone ( ) ) ; <nl> + <nl> + Expression * call = factory ( ) - > NewCallRuntime ( Runtime : : kInlineCall , args , <nl> + kNoSourcePosition ) ; <nl> + do_block - > statements ( ) - > Add ( <nl> + factory ( ) - > NewExpressionStatement ( call , kNoSourcePosition ) , zone ( ) ) ; <nl> + } <nl> + <nl> + result = factory ( ) - > NewDoExpression ( do_block , class_var , <nl> + class_literal - > position ( ) ) ; <nl> + } <nl> + <nl> + return result ; <nl> } <nl> <nl> void Parser : : CheckConflictingVarDeclarations ( Scope * scope , bool * ok ) { <nl> mmm a / src / parsing / pattern - rewriter . cc <nl> ppp b / src / parsing / pattern - rewriter . cc <nl> NOT_A_PATTERN ( WithStatement ) <nl> NOT_A_PATTERN ( Yield ) <nl> NOT_A_PATTERN ( YieldStar ) <nl> NOT_A_PATTERN ( Await ) <nl> + NOT_A_PATTERN ( InitializeClassFieldsStatement ) <nl> <nl> # undef NOT_A_PATTERN <nl> } / / namespace internal <nl> mmm a / src / parsing / rewriter . cc <nl> ppp b / src / parsing / rewriter . cc <nl> void Processor : : VisitDebuggerStatement ( DebuggerStatement * node ) { <nl> replacement_ = node ; <nl> } <nl> <nl> + void Processor : : VisitInitializeClassFieldsStatement ( <nl> + InitializeClassFieldsStatement * node ) { <nl> + replacement_ = node ; <nl> + } <nl> <nl> / / Expressions are never visited . <nl> # define DEF_VISIT ( type ) \ <nl> new file mode 100644 <nl> index 00000000000 . . 43faef9cf37 <nl> mmm / dev / null <nl> ppp b / test / mjsunit / harmony / public - class - fields . js <nl> <nl> + / / Copyright 2017 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Flags : - - harmony - class - fields <nl> + <nl> + { <nl> + class C { <nl> + static a ; <nl> + } <nl> + <nl> + assertEquals ( undefined , C . a ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . a ) ; <nl> + } <nl> + <nl> + { <nl> + let x = ' a ' ; <nl> + class C { <nl> + static a ; <nl> + static b = x ; <nl> + static c = 1 ; <nl> + } <nl> + <nl> + assertEquals ( undefined , C . a ) ; <nl> + assertEquals ( ' a ' , C . b ) ; <nl> + assertEquals ( 1 , C . c ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . a ) ; <nl> + assertEquals ( undefined , c . b ) ; <nl> + assertEquals ( undefined , c . c ) ; <nl> + } <nl> + <nl> + { <nl> + class C { <nl> + static c = this ; <nl> + static d = ( ) = > this ; <nl> + } <nl> + <nl> + assertEquals ( C , C . c ) ; <nl> + assertEquals ( C , C . d ( ) ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . c ) ; <nl> + assertEquals ( undefined , c . d ) ; <nl> + } <nl> + <nl> + { <nl> + this . c = 1 ; <nl> + class C { <nl> + static c = this . c ; <nl> + } <nl> + <nl> + assertEquals ( undefined , C . c ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . c ) ; <nl> + } <nl> + <nl> + { <nl> + class C { <nl> + static c = 1 ; <nl> + static d = this . c ; <nl> + } <nl> + <nl> + assertEquals ( 1 , C . c ) ; <nl> + assertEquals ( 1 , C . d ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . c ) ; <nl> + assertEquals ( undefined , c . d ) ; <nl> + } <nl> + <nl> + { <nl> + class C { <nl> + static b = 1 ; <nl> + static c = ( ) = > this . b ; <nl> + } <nl> + <nl> + assertEquals ( 1 , C . b ) ; <nl> + assertEquals ( 1 , C . c ( ) ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . c ) ; <nl> + } <nl> + <nl> + { <nl> + let x = ' a ' ; <nl> + class C { <nl> + static b = 1 ; <nl> + static c = ( ) = > this . b ; <nl> + static e = ( ) = > x ; <nl> + } <nl> + <nl> + assertEquals ( 1 , C . b ) ; <nl> + assertEquals ( ' a ' , C . e ( ) ) ; <nl> + <nl> + let a = { b : 2 } ; <nl> + assertEquals ( 1 , C . c . call ( a ) ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . b ) ; <nl> + assertEquals ( undefined , c . c ) ; <nl> + } <nl> + <nl> + { <nl> + let x = ' a ' ; <nl> + class C { <nl> + static c = 1 ; <nl> + static d = function ( ) { return this . c ; } ; <nl> + static e = function ( ) { return x ; } ; <nl> + } <nl> + <nl> + assertEquals ( 1 , C . c ) ; <nl> + assertEquals ( 1 , C . d ( ) ) ; <nl> + assertEquals ( ' a ' , C . e ( ) ) ; <nl> + <nl> + C . c = 2 ; <nl> + assertEquals ( 2 , C . d ( ) ) ; <nl> + <nl> + let a = { c : 3 } ; <nl> + assertEquals ( 3 , C . d . call ( a ) ) ; <nl> + <nl> + assertThrows ( C . d . bind ( undefined ) ) ; <nl> + <nl> + let c = new C ; <nl> + assertEquals ( undefined , c . c ) ; <nl> + assertEquals ( undefined , c . d ) ; <nl> + assertEquals ( undefined , c . e ) ; <nl> + } <nl> + <nl> + { <nl> + class C { <nl> + static c = function ( ) { return 1 } ; <nl> + } <nl> + <nl> + assertEquals ( ' c ' , C . c . name ) ; <nl> + } <nl> + <nl> + { <nl> + d = function ( ) { return new . target ; } <nl> + class C { <nl> + static c = d ; <nl> + } <nl> + <nl> + assertEquals ( undefined , C . c ( ) ) ; <nl> + assertEquals ( new d , new C . c ( ) ) ; <nl> + } <nl> + <nl> + { <nl> + class C { <nl> + static c = ( ) = > new . target ; <nl> + } <nl> + <nl> + assertEquals ( undefined , C . c ( ) ) ; <nl> + } <nl> + <nl> + { <nl> + class C { <nl> + static c = ( ) = > { <nl> + let b ; <nl> + class A { <nl> + constructor ( ) { <nl> + b = new . target ; <nl> + } <nl> + } ; <nl> + new A ; <nl> + assertEquals ( A , b ) ; <nl> + } <nl> + } <nl> + <nl> + C . c ( ) ; <nl> + } <nl> + <nl> + { <nl> + class C { <nl> + static c = new . target ; <nl> + } <nl> + <nl> + assertEquals ( undefined , C . c ) ; <nl> + } <nl> + <nl> + { <nl> + class B { <nl> + static d = 1 ; <nl> + static b = ( ) = > this . d ; <nl> + } <nl> + <nl> + class C extends B { <nl> + static c = super . d ; <nl> + static d = ( ) = > super . d ; <nl> + static e = ( ) = > super . b ( ) ; <nl> + } <nl> + <nl> + assertEquals ( 1 , C . c ) ; <nl> + assertEquals ( 1 , C . d ( ) ) ; <nl> + assertEquals ( 1 , C . e ( ) ) ; <nl> + } <nl> + <nl> + { <nl> + let foo = undefined ; <nl> + class B { <nl> + static set d ( x ) { <nl> + foo = x ; <nl> + } <nl> + } <nl> + <nl> + class C extends B { <nl> + static d = 2 ; <nl> + } <nl> + <nl> + assertEquals ( undefined , foo ) ; <nl> + assertEquals ( 2 , C . d ) ; <nl> + } <nl> + <nl> + <nl> + <nl> + / / { <nl> + / / let C = class { <nl> + / / static c ; <nl> + / / } ; <nl> + <nl> + / / assertEquals ( " C " , C . name ) ; <nl> + / / } <nl> + <nl> + / / { <nl> + / / class C { <nl> + / / static c = new C ; <nl> + / / } <nl> + <nl> + / / assertTrue ( c instanceof C ) ; <nl> + / / } <nl> + <nl> + / / ( function test ( ) { <nl> + / / function makeC ( ) { <nl> + / / var x = 1 ; <nl> + <nl> + / / return class { <nl> + / / static a = ( ) = > ( ) = > x ; <nl> + / / } <nl> + / / } <nl> + <nl> + / / let C = makeC ( ) ; <nl> + / / let f = C . a ( ) ; <nl> + / / assertEquals ( 1 , f ( ) ) ; <nl> + / / } ) ( ) <nl>
[ class ] Implement static public class fields
v8/v8
049844a1c29b43d24f91c7e8d4e2e5a773b831a7
2017-10-23T14:41:32Z
mmm a / arangod / VocBase / document - collection . cpp <nl> ppp b / arangod / VocBase / document - collection . cpp <nl> static int FillIndexBatch ( TRI_document_collection_t * document , <nl> } <nl> <nl> / / process the remainder of the documents <nl> - if ( ! documents . empty ( ) ) { <nl> + if ( res = = TRI_ERROR_NO_ERROR & & <nl> + ! documents . empty ( ) ) { <nl> res = idx - > batchInsert ( & documents , indexPool - > numThreads ( ) ) ; <nl> } <nl> <nl> mmm a / lib / Basics / AssocMulti . h <nl> ppp b / lib / Basics / AssocMulti . h <nl> namespace triagens { <nl> size_t lower = chunk * chunkSize ; <nl> size_t upper = ( chunk + 1 ) * chunkSize ; <nl> <nl> - if ( upper > elements . size ( ) ) { <nl> + if ( chunk + 1 = = numThreads ) { <nl> + / / last chunk . account for potential rounding errors <nl> + upper = elements . size ( ) ; <nl> + } <nl> + else if ( upper > elements . size ( ) ) { <nl> upper = elements . size ( ) ; <nl> } <nl> <nl> namespace triagens { <nl> it2 = allBuckets . emplace ( it . first , std : : vector < DocumentsPerBucket > ( ) ) . first ; <nl> } <nl> <nl> - for ( auto & it3 : ( * it2 ) . second ) { <nl> - ( * it2 ) . second . emplace_back ( std : : move ( it3 ) ) ; <nl> - } <nl> + ( * it2 ) . second . emplace_back ( std : : move ( it . second ) ) ; <nl> } <nl> } <nl> catch ( . . . ) { <nl>
fix parallel insertion
arangodb/arangodb
2a88c76e0e70280f1ce75f804f88e974ecc1118f
2015-08-05T13:16:07Z
mmm a / Makefile . am <nl> ppp b / Makefile . am <nl> EXTRA_DIST = $ ( top_srcdir ) / share / genbuild . sh qa / pull - tester / rpc - tests . py qa / rpc - <nl> <nl> CLEANFILES = $ ( OSX_DMG ) $ ( BITCOIN_WIN_INSTALLER ) <nl> <nl> - # This file is problematic for out - of - tree builds if it exists . <nl> - DISTCLEANFILES = qa / pull - tester / tests_config . pyc <nl> - <nl> . INTERMEDIATE : $ ( COVERAGE_INFO ) <nl> <nl> DISTCHECK_CONFIGURE_FLAGS = - - enable - man <nl> mmm a / configure . ac <nl> ppp b / configure . ac <nl> AC_SUBST ( ZMQ_LIBS ) <nl> AC_SUBST ( PROTOBUF_LIBS ) <nl> AC_SUBST ( QR_LIBS ) <nl> AC_CONFIG_FILES ( [ Makefile src / Makefile doc / man / Makefile share / setup . nsi share / qt / Info . plist src / test / buildenv . py ] ) <nl> - AC_CONFIG_FILES ( [ qa / pull - tester / tests_config . py ] , [ chmod + x qa / pull - tester / tests_config . py ] ) <nl> + AC_CONFIG_FILES ( [ qa / pull - tester / tests_config . ini ] , [ chmod + x qa / pull - tester / tests_config . ini ] ) <nl> AC_CONFIG_FILES ( [ contrib / devtools / split - debug . sh ] , [ chmod + x contrib / devtools / split - debug . sh ] ) <nl> AC_CONFIG_LINKS ( [ qa / pull - tester / rpc - tests . py : qa / pull - tester / rpc - tests . py ] ) <nl> <nl> mmm a / qa / pull - tester / rpc - tests . py <nl> ppp b / qa / pull - tester / rpc - tests . py <nl> <nl> <nl> " " " <nl> <nl> + import configparser <nl> import os <nl> import time <nl> import shutil <nl> <nl> import tempfile <nl> import re <nl> <nl> - sys . path . append ( " qa / pull - tester / " ) <nl> - from tests_config import * <nl> - <nl> BOLD = ( " " , " " ) <nl> if os . name = = ' posix ' : <nl> # primitive formatting on supported <nl> # terminal via ANSI escape sequences : <nl> BOLD = ( ' \ 033 [ 0m ' , ' \ 033 [ 1m ' ) <nl> <nl> - RPC_TESTS_DIR = SRCDIR + ' / qa / rpc - tests / ' <nl> + # Read config generated by configure . <nl> + config = configparser . ConfigParser ( ) <nl> + config . read_file ( open ( os . path . dirname ( __file__ ) + " / tests_config . ini " ) ) <nl> + <nl> + ENABLE_WALLET = config [ " components " ] [ " ENABLE_WALLET " ] = = " True " <nl> + ENABLE_UTILS = config [ " components " ] [ " ENABLE_UTILS " ] = = " True " <nl> + ENABLE_BITCOIND = config [ " components " ] [ " ENABLE_BITCOIND " ] = = " True " <nl> + ENABLE_ZMQ = config [ " components " ] [ " ENABLE_ZMQ " ] = = " True " <nl> <nl> - # If imported values are not defined then set to zero ( or disabled ) <nl> - if ' ENABLE_WALLET ' not in vars ( ) : <nl> - ENABLE_WALLET = 0 <nl> - if ' ENABLE_BITCOIND ' not in vars ( ) : <nl> - ENABLE_BITCOIND = 0 <nl> - if ' ENABLE_UTILS ' not in vars ( ) : <nl> - ENABLE_UTILS = 0 <nl> - if ' ENABLE_ZMQ ' not in vars ( ) : <nl> - ENABLE_ZMQ = 0 <nl> + RPC_TESTS_DIR = config [ " environment " ] [ " SRCDIR " ] + ' / qa / rpc - tests / ' <nl> <nl> ENABLE_COVERAGE = 0 <nl> <nl> <nl> <nl> # Set env vars <nl> if " BITCOIND " not in os . environ : <nl> - os . environ [ " BITCOIND " ] = BUILDDIR + ' / src / bitcoind ' + EXEEXT <nl> + os . environ [ " BITCOIND " ] = config [ " environment " ] [ " BUILDDIR " ] + ' / src / bitcoind ' + config [ " environment " ] [ " EXEEXT " ] <nl> <nl> - if EXEEXT = = " . exe " and " - win " not in opts : <nl> + if config [ " environment " ] [ " EXEEXT " ] = = " . exe " and " - win " not in opts : <nl> # https : / / github . com / bitcoin / bitcoin / commit / d52802551752140cf41f0d9a225a43e84404d3e9 <nl> # https : / / github . com / bitcoin / bitcoin / pull / 5677 # issuecomment - 136646964 <nl> print ( " Win tests currently disabled by default . Use - win option to enable " ) <nl> sys . exit ( 0 ) <nl> <nl> - if not ( ENABLE_WALLET = = 1 and ENABLE_UTILS = = 1 and ENABLE_BITCOIND = = 1 ) : <nl> + if not ( ENABLE_WALLET and ENABLE_UTILS and ENABLE_BITCOIND ) : <nl> print ( " No rpc tests to run . Wallet , utils , and bitcoind must all be enabled " ) <nl> sys . exit ( 0 ) <nl> <nl> def runtests ( ) : <nl> if ENABLE_COVERAGE : <nl> coverage = RPCCoverage ( ) <nl> print ( " Initializing coverage directory at % s \ n " % coverage . dir ) <nl> - flags = [ " - - srcdir = % s / src " % BUILDDIR ] + passon_args <nl> - flags . append ( " - - cachedir = % s / qa / cache " % BUILDDIR ) <nl> + flags = [ " - - srcdir = % s / src " % config [ " environment " ] [ " BUILDDIR " ] ] + passon_args <nl> + flags . append ( " - - cachedir = % s / qa / cache " % config [ " environment " ] [ " BUILDDIR " ] ) <nl> if coverage : <nl> flags . append ( coverage . flag ) <nl> <nl> new file mode 100644 <nl> index 000000000000 . . 8317caaeb514 <nl> mmm / dev / null <nl> ppp b / qa / pull - tester / tests_config . ini . in <nl> <nl> + # Copyright ( c ) 2013 - 2016 The Bitcoin Core developers <nl> + # Distributed under the MIT software license , see the accompanying <nl> + # file COPYING or http : / / www . opensource . org / licenses / mit - license . php . <nl> + <nl> + # These environment variables are set by the build process and read by <nl> + # rpc - tests . py <nl> + <nl> + [ DEFAULT ] <nl> + # Provides default values for whether different components are enabled <nl> + ENABLE_WALLET = False <nl> + ENABLE_UTILS = False <nl> + ENABLE_BITCOIND = False <nl> + ENABLE_ZMQ = False <nl> + <nl> + [ environment ] <nl> + SRCDIR = @ abs_top_srcdir @ <nl> + BUILDDIR = @ abs_top_builddir @ <nl> + EXEEXT = @ EXEEXT @ <nl> + <nl> + [ components ] <nl> + # Which components are enabled . These are commented out by ` configure ` if they were disabled when running config . <nl> + @ ENABLE_WALLET_TRUE @ ENABLE_WALLET = True <nl> + @ BUILD_BITCOIN_UTILS_TRUE @ ENABLE_UTILS = True <nl> + @ BUILD_BITCOIND_TRUE @ ENABLE_BITCOIND = True <nl> + @ ENABLE_ZMQ_TRUE @ ENABLE_ZMQ = True <nl> deleted file mode 100644 <nl> index a0d0a3d98a86 . . 000000000000 <nl> mmm a / qa / pull - tester / tests_config . py . in <nl> ppp / dev / null <nl> <nl> - # ! / usr / bin / env python3 <nl> - # Copyright ( c ) 2013 - 2016 The Bitcoin Core developers <nl> - # Distributed under the MIT software license , see the accompanying <nl> - # file COPYING or http : / / www . opensource . org / licenses / mit - license . php . <nl> - <nl> - SRCDIR = " @ abs_top_srcdir @ " <nl> - BUILDDIR = " @ abs_top_builddir @ " <nl> - EXEEXT = " @ EXEEXT @ " <nl> - <nl> - # These will turn into comments if they were disabled when configuring . <nl> - @ ENABLE_WALLET_TRUE @ ENABLE_WALLET = 1 <nl> - @ BUILD_BITCOIN_UTILS_TRUE @ ENABLE_UTILS = 1 <nl> - @ BUILD_BITCOIND_TRUE @ ENABLE_BITCOIND = 1 <nl> - @ ENABLE_ZMQ_TRUE @ ENABLE_ZMQ = 1 <nl>
Use configparser in rpc - tests . py
bitcoin/bitcoin
1581ecbc33edd9d6257e50b11d8854fbccaf8ad8
2017-02-01T02:03:14Z
mmm a / hphp / tools / hphpize / hphpize <nl> ppp b / hphp / tools / hphpize / hphpize <nl> <nl> - # ! / bin / sh <nl> + # ! / bin / bash <nl> <nl> if [ ! - f " config . cmake " ] ; then <nl> echo " config . cmake not found " > & 2 <nl>
Use / bin / bash for hphpize
facebook/hhvm
b14ee646914e600eae19a0e8c741f68802758ec1
2014-05-05T20:38:03Z
mmm a / modules / csg / csg_shape . cpp <nl> ppp b / modules / csg / csg_shape . cpp <nl> CSGBrush * CSGMesh : : _build_brush ( ) { <nl> PoolVector < bool > smooth ; <nl> PoolVector < Ref < Material > > materials ; <nl> PoolVector < Vector2 > uvs ; <nl> + Ref < Material > material = get_material ( ) ; <nl> <nl> for ( int i = 0 ; i < mesh - > get_surface_count ( ) ; i + + ) { <nl> <nl> CSGBrush * CSGMesh : : _build_brush ( ) { <nl> uvr_used = true ; <nl> } <nl> <nl> - Ref < Material > mat = mesh - > surface_get_material ( i ) ; <nl> + Ref < Material > mat ; <nl> + if ( material . is_valid ( ) ) { <nl> + mat = material ; <nl> + } else { <nl> + mat = mesh - > surface_get_material ( i ) ; <nl> + } <nl> <nl> PoolVector < int > aindices = arrays [ Mesh : : ARRAY_INDEX ] ; <nl> if ( aindices . size ( ) ) { <nl> void CSGMesh : : _mesh_changed ( ) { <nl> update_gizmo ( ) ; <nl> } <nl> <nl> + void CSGMesh : : set_material ( const Ref < Material > & p_material ) { <nl> + if ( material = = p_material ) <nl> + return ; <nl> + material = p_material ; <nl> + _make_dirty ( ) ; <nl> + } <nl> + <nl> + Ref < Material > CSGMesh : : get_material ( ) const { <nl> + <nl> + return material ; <nl> + } <nl> + <nl> void CSGMesh : : _bind_methods ( ) { <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " set_mesh " , " mesh " ) , & CSGMesh : : set_mesh ) ; <nl> void CSGMesh : : _bind_methods ( ) { <nl> <nl> ClassDB : : bind_method ( D_METHOD ( " _mesh_changed " ) , & CSGMesh : : _mesh_changed ) ; <nl> <nl> + ClassDB : : bind_method ( D_METHOD ( " set_material " , " material " ) , & CSGMesh : : set_material ) ; <nl> + ClassDB : : bind_method ( D_METHOD ( " get_material " ) , & CSGMesh : : get_material ) ; <nl> + <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : OBJECT , " mesh " , PROPERTY_HINT_RESOURCE_TYPE , " Mesh " ) , " set_mesh " , " get_mesh " ) ; <nl> + ADD_PROPERTY ( PropertyInfo ( Variant : : OBJECT , " material " , PROPERTY_HINT_RESOURCE_TYPE , " SpatialMaterial , ShaderMaterial " ) , " set_material " , " get_material " ) ; <nl> } <nl> <nl> void CSGMesh : : set_mesh ( const Ref < Mesh > & p_mesh ) { <nl> mmm a / modules / csg / csg_shape . h <nl> ppp b / modules / csg / csg_shape . h <nl> <nl> # include " scene / resources / concave_polygon_shape . h " <nl> # include " thirdparty / misc / mikktspace . h " <nl> <nl> - class CSGShape : public VisualInstance { <nl> - GDCLASS ( CSGShape , VisualInstance ) ; <nl> + class CSGShape : public GeometryInstance { <nl> + GDCLASS ( CSGShape , GeometryInstance ) ; <nl> <nl> public : <nl> enum Operation { <nl> class CSGMesh : public CSGPrimitive { <nl> virtual CSGBrush * _build_brush ( ) ; <nl> <nl> Ref < Mesh > mesh ; <nl> + Ref < Material > material ; <nl> <nl> void _mesh_changed ( ) ; <nl> <nl> class CSGMesh : public CSGPrimitive { <nl> public : <nl> void set_mesh ( const Ref < Mesh > & p_mesh ) ; <nl> Ref < Mesh > get_mesh ( ) ; <nl> + <nl> + void set_material ( const Ref < Material > & p_material ) ; <nl> + Ref < Material > get_material ( ) const ; <nl> } ; <nl> <nl> class CSGSphere : public CSGPrimitive { <nl>
Merge pull request from LeonardMeagher2 / fix_csgshape_geometryinstance
godotengine/godot
7d0275785b7582e34f488f7d28554f064168a428
2019-04-21T11:07:29Z
mmm a / folly / Makefile . am <nl> ppp b / folly / Makefile . am <nl> nobase_follyinclude_HEADERS = \ <nl> io / async / EventUtil . h \ <nl> io / async / NotificationQueue . h \ <nl> io / async / HHWheelTimer . h \ <nl> + io / async / OpenSSLPtrTypes . h \ <nl> io / async / Request . h \ <nl> io / async / SSLContext . h \ <nl> io / async / ScopedEventBaseThread . h \ <nl> mmm a / folly / io / async / AsyncSSLSocket . h <nl> ppp b / folly / io / async / AsyncSSLSocket . h <nl> <nl> # include < folly / io / async / AsyncSocket . h > <nl> # include < folly / io / async / SSLContext . h > <nl> # include < folly / io / async / AsyncTimeout . h > <nl> + # include < folly / io / async / OpenSSLPtrTypes . h > <nl> # include < folly / io / async / TimeoutManager . h > <nl> <nl> # include < folly / Bits . h > <nl> class AsyncSSLSocket : public virtual AsyncSocket { <nl> / * * <nl> * Returns the peer certificate , or nullptr if no peer certificate received . <nl> * / <nl> - virtual std : : unique_ptr < X509 , X509_deleter > getPeerCert ( ) const { <nl> + virtual X509_UniquePtr getPeerCert ( ) const { <nl> if ( ! ssl_ ) { <nl> return nullptr ; <nl> } <nl> <nl> X509 * cert = SSL_get_peer_certificate ( ssl_ ) ; <nl> - return std : : unique_ptr < X509 , X509_deleter > ( cert ) ; <nl> + return X509_UniquePtr ( cert ) ; <nl> } <nl> <nl> private : <nl> new file mode 100644 <nl> index 00000000000 . . 57d73b8e95b <nl> mmm / dev / null <nl> ppp b / folly / io / async / OpenSSLPtrTypes . h <nl> <nl> + / * <nl> + * Copyright 2016 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> + <nl> + # pragma once <nl> + <nl> + # include < folly / Memory . h > <nl> + # include < openssl / ssl . h > <nl> + <nl> + namespace folly { <nl> + <nl> + using X509_deleter = static_function_deleter < X509 , & X509_free > ; <nl> + using X509_UniquePtr = std : : unique_ptr < X509 , X509_deleter > ; <nl> + <nl> + using EVP_PKEY_deleter = <nl> + folly : : static_function_deleter < EVP_PKEY , & EVP_PKEY_free > ; <nl> + using EVP_PKEY_UniquePtr = std : : unique_ptr < EVP_PKEY , EVP_PKEY_deleter > ; <nl> + <nl> + using SSL_deleter = folly : : static_function_deleter < SSL , & SSL_free > ; <nl> + using SSL_UniquePtr = std : : unique_ptr < SSL , SSL_deleter > ; <nl> + } <nl> mmm a / folly / io / async / SSLContext . cpp <nl> ppp b / folly / io / async / SSLContext . cpp <nl> <nl> # include < folly / Format . h > <nl> # include < folly / Memory . h > <nl> # include < folly / SpinLock . h > <nl> + # include < folly / io / async / OpenSSLPtrTypes . h > <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> / / SSLContext implementation <nl> std : : mutex & initMutex ( ) { <nl> <nl> inline void BIO_free_fb ( BIO * bio ) { CHECK_EQ ( 1 , BIO_free ( bio ) ) ; } <nl> using BIO_deleter = folly : : static_function_deleter < BIO , & BIO_free_fb > ; <nl> - using X509_deleter = folly : : static_function_deleter < X509 , & X509_free > ; <nl> - using EVP_PKEY_deleter = <nl> - folly : : static_function_deleter < EVP_PKEY , & EVP_PKEY_free > ; <nl> <nl> } / / anonymous namespace <nl> <nl> void SSLContext : : loadCertificateFromBufferPEM ( folly : : StringPiece cert ) { <nl> throw std : : runtime_error ( " BIO_write : " + getErrors ( ) ) ; <nl> } <nl> <nl> - std : : unique_ptr < X509 , X509_deleter > x509 ( <nl> - PEM_read_bio_X509 ( bio . get ( ) , nullptr , nullptr , nullptr ) ) ; <nl> + X509_UniquePtr x509 ( PEM_read_bio_X509 ( bio . get ( ) , nullptr , nullptr , nullptr ) ) ; <nl> if ( x509 = = nullptr ) { <nl> throw std : : runtime_error ( " PEM_read_bio_X509 : " + getErrors ( ) ) ; <nl> } <nl> void SSLContext : : loadPrivateKeyFromBufferPEM ( folly : : StringPiece pkey ) { <nl> throw std : : runtime_error ( " BIO_write : " + getErrors ( ) ) ; <nl> } <nl> <nl> - std : : unique_ptr < EVP_PKEY , EVP_PKEY_deleter > key ( <nl> + EVP_PKEY_UniquePtr key ( <nl> PEM_read_bio_PrivateKey ( bio . get ( ) , nullptr , nullptr , nullptr ) ) ; <nl> if ( key = = nullptr ) { <nl> throw std : : runtime_error ( " PEM_read_bio_PrivateKey : " + getErrors ( ) ) ; <nl> mmm a / folly / io / async / test / AsyncSSLSocketTest . cpp <nl> ppp b / folly / io / async / test / AsyncSSLSocketTest . cpp <nl> constexpr size_t SSLClient : : kMaxReadsPerEvent ; <nl> <nl> inline void BIO_free_fb ( BIO * bio ) { CHECK_EQ ( 1 , BIO_free ( bio ) ) ; } <nl> using BIO_deleter = folly : : static_function_deleter < BIO , & BIO_free_fb > ; <nl> - using X509_deleter = folly : : static_function_deleter < X509 , & X509_free > ; <nl> - using SSL_deleter = folly : : static_function_deleter < SSL , & SSL_free > ; <nl> - using EVP_PKEY_deleter = <nl> - folly : : static_function_deleter < EVP_PKEY , & EVP_PKEY_free > ; <nl> <nl> TestSSLServer : : TestSSLServer ( SSLServerAcceptCallbackBase * acb ) <nl> : ctx_ ( new folly : : SSLContext ) , <nl> TEST ( AsyncSSLSocketTest , LoadCertFromMemory ) { <nl> BIO_write ( keyBio . get ( ) , key . data ( ) , key . size ( ) ) ; <nl> <nl> / / Create SSL structs from buffers to get properties <nl> - std : : unique_ptr < X509 , X509_deleter > certStruct ( <nl> + X509_UniquePtr certStruct ( <nl> PEM_read_bio_X509 ( certBio . get ( ) , nullptr , nullptr , nullptr ) ) ; <nl> - std : : unique_ptr < EVP_PKEY , EVP_PKEY_deleter > keyStruct ( <nl> + EVP_PKEY_UniquePtr keyStruct ( <nl> PEM_read_bio_PrivateKey ( keyBio . get ( ) , nullptr , nullptr , nullptr ) ) ; <nl> certBio = nullptr ; <nl> keyBio = nullptr ; <nl> TEST ( AsyncSSLSocketTest , LoadCertFromMemory ) { <nl> ctx - > loadCertificateFromBufferPEM ( cert ) ; <nl> ctx - > loadTrustedCertificates ( testCA ) ; <nl> <nl> - std : : unique_ptr < SSL , SSL_deleter > ssl ( ctx - > createSSL ( ) ) ; <nl> + SSL_UniquePtr ssl ( ctx - > createSSL ( ) ) ; <nl> <nl> auto newCert = SSL_get_certificate ( ssl . get ( ) ) ; <nl> auto newKey = SSL_get_privatekey ( ssl . get ( ) ) ; <nl>
Adding OpenSSLPtrTypes . h .
facebook/folly
85e8a2d4a5041a2409f4eaf20df99abe8550686d
2016-01-21T23:20:55Z
mmm a / scripts / buildsystems / msbuild / vcpkg . targets <nl> ppp b / scripts / buildsystems / msbuild / vcpkg . targets <nl> <nl> File = " $ ( TLogLocation ) $ ( ProjectName ) . write . 1u . tlog " <nl> Lines = " ^ $ ( TargetPath ) ; $ ( [ System . IO . Path ] : : Combine ( $ ( ProjectDir ) , $ ( IntDir ) ) ) vcpkg . applocal . log " Encoding = " Unicode " / > <nl> < Exec Condition = " $ ( VcpkgConfiguration . StartsWith ( ' Debug ' ) ) " <nl> - Command = " powershell . exe - ExecutionPolicy Bypass - noprofile - File % 22 $ ( MSBuildThisFileDirectory ) applocal . ps1 % 22 % 22 $ ( TargetPath ) % 22 % 22 $ ( VcpkgRoot ) debug \ bin % 22 % 22 $ ( TLogLocation ) $ ( ProjectName ) . write . 1u . tlog % 22 % 22 $ ( IntDir ) vcpkg . applocal . log % 22 " <nl> + Command = " $ ( SystemRoot ) \ WindowsPowerShell \ v1 . 0 \ powershell . exe - ExecutionPolicy Bypass - noprofile - File % 22 $ ( MSBuildThisFileDirectory ) applocal . ps1 % 22 % 22 $ ( TargetPath ) % 22 % 22 $ ( VcpkgRoot ) debug \ bin % 22 % 22 $ ( TLogLocation ) $ ( ProjectName ) . write . 1u . tlog % 22 % 22 $ ( IntDir ) vcpkg . applocal . log % 22 " <nl> StandardOutputImportance = " Normal " > <nl> < / Exec > <nl> < Exec Condition = " $ ( VcpkgConfiguration . StartsWith ( ' Release ' ) ) " <nl> - Command = " powershell . exe - ExecutionPolicy Bypass - noprofile - File % 22 $ ( MSBuildThisFileDirectory ) applocal . ps1 % 22 % 22 $ ( TargetPath ) % 22 % 22 $ ( VcpkgRoot ) bin % 22 % 22 $ ( TLogLocation ) $ ( ProjectName ) . write . 1u . tlog % 22 % 22 $ ( IntDir ) vcpkg . applocal . log % 22 " <nl> + Command = " $ ( SystemRoot ) \ WindowsPowerShell \ v1 . 0 \ powershell . exe - ExecutionPolicy Bypass - noprofile - File % 22 $ ( MSBuildThisFileDirectory ) applocal . ps1 % 22 % 22 $ ( TargetPath ) % 22 % 22 $ ( VcpkgRoot ) bin % 22 % 22 $ ( TLogLocation ) $ ( ProjectName ) . write . 1u . tlog % 22 % 22 $ ( IntDir ) vcpkg . applocal . log % 22 " <nl> StandardOutputImportance = " Normal " > <nl> < / Exec > <nl> < ReadLinesFromFile File = " $ ( IntDir ) vcpkg . applocal . log " > <nl>
[ vcpkg - msbuild - integration ] Address by using full path to powershell .
microsoft/vcpkg
a4f8515c9e6af66bbdcf704c75e5284daa240040
2017-12-05T23:22:21Z
mmm a / python / mxnet / ndarray / ndarray . py <nl> ppp b / python / mxnet / ndarray / ndarray . py <nl> def _get_index_range ( start , stop , length , step = 1 ) : <nl> elif start < 0 : <nl> start + = length <nl> if start < 0 : <nl> - raise IndexError ( ' Slicing start % d exceeds limit of % d ' % ( start - length , length ) ) <nl> + start = 0 <nl> elif start > = length : <nl> - raise IndexError ( ' Slicing start % d exceeds limit of % d ' % ( start , length ) ) <nl> + start = length <nl> <nl> if stop is None : <nl> if step > 0 : <nl> def _get_index_range ( start , stop , length , step = 1 ) : <nl> elif stop < 0 : <nl> stop + = length <nl> if stop < 0 : <nl> - raise IndexError ( ' Slicing stop % d exceeds limit of % d ' % ( stop - length , length ) ) <nl> + stop = 0 <nl> elif stop > length : <nl> - raise IndexError ( ' Slicing stop % d exceeds limit of % d ' % ( stop , length ) ) <nl> + stop = length <nl> <nl> return start , stop , step <nl> <nl> mmm a / tests / python / unittest / test_numpy_ndarray . py <nl> ppp b / tests / python / unittest / test_numpy_ndarray . py <nl> def test_getitem ( np_array , index ) : <nl> mx_indexed_array = mx_indexed_array . asnumpy ( ) <nl> assert same ( np_indexed_array , mx_indexed_array ) , ' Failed with index = { } ' . format ( index ) <nl> <nl> + def test_getitem_slice_bound ( ) : <nl> + mx_array = np . arange ( 10 ) <nl> + np_array = mx_array . asnumpy ( ) <nl> + assert_almost_equal ( mx_array [ 100 : ] , np_array [ 100 : ] ) <nl> + assert_almost_equal ( mx_array [ : 100 ] , np_array [ : 100 ] ) <nl> + assert_almost_equal ( mx_array [ - 100 : ] , np_array [ - 100 : ] ) <nl> + assert_almost_equal ( mx_array [ : - 100 ] , np_array [ : - 100 ] ) <nl> + <nl> + mx_array = np . arange ( 81 ) . reshape ( 3 , 3 , 3 , 3 ) <nl> + np_array = mx_array . asnumpy ( ) <nl> + assert_almost_equal ( mx_array [ 100 : ] , np_array [ 100 : ] ) <nl> + assert_almost_equal ( mx_array [ : 100 ] , np_array [ : 100 ] ) <nl> + assert_almost_equal ( mx_array [ - 100 : ] , np_array [ - 100 : ] ) <nl> + assert_almost_equal ( mx_array [ : - 100 ] , np_array [ : - 100 ] ) <nl> + <nl> def test_setitem ( np_array , index ) : <nl> def assert_same ( np_array , np_index , mx_array , mx_index , mx_value , np_value = None ) : <nl> if np_value is not None : <nl> def test_setitem_autograd ( np_array , index ) : <nl> test_setitem ( np_array , index ) <nl> test_getitem_autograd ( np_array , index ) <nl> test_setitem_autograd ( np_array , index ) <nl> + test_getitem_slice_bound ( ) <nl> <nl> <nl> @ with_seed ( ) <nl>
fix issue ( )
apache/incubator-mxnet
8e0dc928928f708b0b11e277ac0b7a8e5fffa45d
2020-02-06T06:03:29Z
mmm a / BUILD <nl> ppp b / BUILD <nl> cc_library ( <nl> " src / core / lib / support / block_annotate . h " , <nl> " src / core / lib / support / env . h " , <nl> " src / core / lib / support / load_file . h " , <nl> + " src / core / lib / support / mpscq . h " , <nl> " src / core / lib / support / murmur_hash . h " , <nl> " src / core / lib / support / stack_lockfree . h " , <nl> " src / core / lib / support / string . h " , <nl> cc_library ( <nl> " src / core / lib / support / log_linux . c " , <nl> " src / core / lib / support / log_posix . c " , <nl> " src / core / lib / support / log_win32 . c " , <nl> + " src / core / lib / support / mpscq . c " , <nl> " src / core / lib / support / murmur_hash . c " , <nl> " src / core / lib / support / slice . c " , <nl> " src / core / lib / support / slice_buffer . c " , <nl> - " src / core / lib / support / stack_lockfree . c " , <nl> " src / core / lib / support / string . c " , <nl> " src / core / lib / support / string_posix . c " , <nl> " src / core / lib / support / string_util_win32 . c " , <nl> objc_library ( <nl> " src / core / lib / support / log_linux . c " , <nl> " src / core / lib / support / log_posix . c " , <nl> " src / core / lib / support / log_win32 . c " , <nl> + " src / core / lib / support / mpscq . c " , <nl> " src / core / lib / support / murmur_hash . c " , <nl> " src / core / lib / support / slice . c " , <nl> " src / core / lib / support / slice_buffer . c " , <nl> - " src / core / lib / support / stack_lockfree . c " , <nl> " src / core / lib / support / string . c " , <nl> " src / core / lib / support / string_posix . c " , <nl> " src / core / lib / support / string_util_win32 . c " , <nl> objc_library ( <nl> " src / core / lib / support / block_annotate . h " , <nl> " src / core / lib / support / env . h " , <nl> " src / core / lib / support / load_file . h " , <nl> + " src / core / lib / support / mpscq . h " , <nl> " src / core / lib / support / murmur_hash . h " , <nl> " src / core / lib / support / stack_lockfree . h " , <nl> " src / core / lib / support / string . h " , <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> LIBGPR_SRC = \ <nl> src / core / lib / support / log_linux . c \ <nl> src / core / lib / support / log_posix . c \ <nl> src / core / lib / support / log_win32 . c \ <nl> + src / core / lib / support / mpscq . c \ <nl> src / core / lib / support / murmur_hash . c \ <nl> src / core / lib / support / slice . c \ <nl> src / core / lib / support / slice_buffer . c \ <nl> - src / core / lib / support / stack_lockfree . c \ <nl> src / core / lib / support / string . c \ <nl> src / core / lib / support / string_posix . c \ <nl> src / core / lib / support / string_util_win32 . c \ <nl> mmm a / binding . gyp <nl> ppp b / binding . gyp <nl> <nl> ' src / core / lib / support / log_linux . c ' , <nl> ' src / core / lib / support / log_posix . c ' , <nl> ' src / core / lib / support / log_win32 . c ' , <nl> + ' src / core / lib / support / mpscq . c ' , <nl> ' src / core / lib / support / murmur_hash . c ' , <nl> ' src / core / lib / support / slice . c ' , <nl> ' src / core / lib / support / slice_buffer . c ' , <nl> - ' src / core / lib / support / stack_lockfree . c ' , <nl> ' src / core / lib / support / string . c ' , <nl> ' src / core / lib / support / string_posix . c ' , <nl> ' src / core / lib / support / string_util_win32 . c ' , <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> - src / core / lib / support / block_annotate . h <nl> - src / core / lib / support / env . h <nl> - src / core / lib / support / load_file . h <nl> + - src / core / lib / support / mpscq . h <nl> - src / core / lib / support / murmur_hash . h <nl> - src / core / lib / support / stack_lockfree . h <nl> - src / core / lib / support / string . h <nl> filegroups : <nl> - src / core / lib / support / log_linux . c <nl> - src / core / lib / support / log_posix . c <nl> - src / core / lib / support / log_win32 . c <nl> + - src / core / lib / support / mpscq . c <nl> - src / core / lib / support / murmur_hash . c <nl> - src / core / lib / support / slice . c <nl> - src / core / lib / support / slice_buffer . c <nl> - - src / core / lib / support / stack_lockfree . c <nl> - src / core / lib / support / string . c <nl> - src / core / lib / support / string_posix . c <nl> - src / core / lib / support / string_util_win32 . c <nl> mmm a / config . m4 <nl> ppp b / config . m4 <nl> if test " $ PHP_GRPC " ! = " no " ; then <nl> src / core / lib / support / log_linux . c \ <nl> src / core / lib / support / log_posix . c \ <nl> src / core / lib / support / log_win32 . c \ <nl> + src / core / lib / support / mpscq . c \ <nl> src / core / lib / support / murmur_hash . c \ <nl> src / core / lib / support / slice . c \ <nl> src / core / lib / support / slice_buffer . c \ <nl> - src / core / lib / support / stack_lockfree . c \ <nl> src / core / lib / support / string . c \ <nl> src / core / lib / support / string_posix . c \ <nl> src / core / lib / support / string_util_win32 . c \ <nl> mmm a / gRPC . podspec <nl> ppp b / gRPC . podspec <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / support / block_annotate . h ' , <nl> ' src / core / lib / support / env . h ' , <nl> ' src / core / lib / support / load_file . h ' , <nl> + ' src / core / lib / support / mpscq . h ' , <nl> ' src / core / lib / support / murmur_hash . h ' , <nl> ' src / core / lib / support / stack_lockfree . h ' , <nl> ' src / core / lib / support / string . h ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / support / log_linux . c ' , <nl> ' src / core / lib / support / log_posix . c ' , <nl> ' src / core / lib / support / log_win32 . c ' , <nl> + ' src / core / lib / support / mpscq . c ' , <nl> ' src / core / lib / support / murmur_hash . c ' , <nl> ' src / core / lib / support / slice . c ' , <nl> ' src / core / lib / support / slice_buffer . c ' , <nl> - ' src / core / lib / support / stack_lockfree . c ' , <nl> ' src / core / lib / support / string . c ' , <nl> ' src / core / lib / support / string_posix . c ' , <nl> ' src / core / lib / support / string_util_win32 . c ' , <nl> Pod : : Spec . new do | s | <nl> ' src / core / lib / support / block_annotate . h ' , <nl> ' src / core / lib / support / env . h ' , <nl> ' src / core / lib / support / load_file . h ' , <nl> + ' src / core / lib / support / mpscq . h ' , <nl> ' src / core / lib / support / murmur_hash . h ' , <nl> ' src / core / lib / support / stack_lockfree . h ' , <nl> ' src / core / lib / support / string . h ' , <nl> mmm a / grpc . gemspec <nl> ppp b / grpc . gemspec <nl> Gem : : Specification . new do | s | <nl> s . files + = % w ( src / core / lib / support / block_annotate . h ) <nl> s . files + = % w ( src / core / lib / support / env . h ) <nl> s . files + = % w ( src / core / lib / support / load_file . h ) <nl> + s . files + = % w ( src / core / lib / support / mpscq . h ) <nl> s . files + = % w ( src / core / lib / support / murmur_hash . h ) <nl> s . files + = % w ( src / core / lib / support / stack_lockfree . h ) <nl> s . files + = % w ( src / core / lib / support / string . h ) <nl> Gem : : Specification . new do | s | <nl> s . files + = % w ( src / core / lib / support / log_linux . c ) <nl> s . files + = % w ( src / core / lib / support / log_posix . c ) <nl> s . files + = % w ( src / core / lib / support / log_win32 . c ) <nl> + s . files + = % w ( src / core / lib / support / mpscq . c ) <nl> s . files + = % w ( src / core / lib / support / murmur_hash . c ) <nl> s . files + = % w ( src / core / lib / support / slice . c ) <nl> s . files + = % w ( src / core / lib / support / slice_buffer . c ) <nl> - s . files + = % w ( src / core / lib / support / stack_lockfree . c ) <nl> s . files + = % w ( src / core / lib / support / string . c ) <nl> s . files + = % w ( src / core / lib / support / string_posix . c ) <nl> s . files + = % w ( src / core / lib / support / string_util_win32 . c ) <nl> mmm a / include / grpc / impl / codegen / atm . h <nl> ppp b / include / grpc / impl / codegen / atm . h <nl> <nl> int gpr_atm_no_barrier_cas ( gpr_atm * p , gpr_atm o , gpr_atm n ) ; <nl> int gpr_atm_acq_cas ( gpr_atm * p , gpr_atm o , gpr_atm n ) ; <nl> int gpr_atm_rel_cas ( gpr_atm * p , gpr_atm o , gpr_atm n ) ; <nl> + <nl> + / / Atomically , set * p = n and return the old value of * p <nl> + gpr_atm gpr_atm_full_xchg ( gpr_atm * p , gpr_atm n ) ; <nl> * / <nl> <nl> # include < grpc / impl / codegen / port_platform . h > <nl> mmm a / include / grpc / impl / codegen / atm_gcc_atomic . h <nl> ppp b / include / grpc / impl / codegen / atm_gcc_atomic . h <nl> static __inline int gpr_atm_rel_cas ( gpr_atm * p , gpr_atm o , gpr_atm n ) { <nl> __ATOMIC_RELAXED ) ; <nl> } <nl> <nl> + # define gpr_atm_full_xchg ( p , n ) __atomic_exchange_n ( ( p ) , ( n ) , __ATOMIC_ACQ_REL ) <nl> + <nl> # endif / * GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H * / <nl> mmm a / include / grpc / impl / codegen / atm_gcc_sync . h <nl> ppp b / include / grpc / impl / codegen / atm_gcc_sync . h <nl> static __inline void gpr_atm_no_barrier_store ( gpr_atm * p , gpr_atm value ) { <nl> # define gpr_atm_acq_cas ( p , o , n ) ( __sync_bool_compare_and_swap ( ( p ) , ( o ) , ( n ) ) ) <nl> # define gpr_atm_rel_cas ( p , o , n ) gpr_atm_acq_cas ( ( p ) , ( o ) , ( n ) ) <nl> <nl> + static __inline gpr_atm gpr_atm_full_xchg ( gpr_atm * p , gpr_atm n ) { <nl> + gpr_atm cur ; <nl> + do { <nl> + cur = gpr_atm_acq_load ( p ) ; <nl> + } while ( ! gpr_atm_rel_cas ( p , cur , n ) ) ; <nl> + } <nl> + <nl> # endif / * GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H * / <nl> mmm a / include / grpc / impl / codegen / atm_win32 . h <nl> ppp b / include / grpc / impl / codegen / atm_win32 . h <nl> static __inline gpr_atm gpr_atm_full_fetch_add ( gpr_atm * p , gpr_atm delta ) { <nl> return old ; <nl> } <nl> <nl> + static __inline gpr_atm gpr_atm_full_xchg ( gpr_atm * p , gpr_atm n ) { <nl> + return ( gpr_atm ) InterlockedExchangePointer ( ( PVOID * ) p , ( PVOID ) n ) ; <nl> + } <nl> + <nl> # endif / * GRPC_IMPL_CODEGEN_ATM_WIN32_H * / <nl> mmm a / package . xml <nl> ppp b / package . xml <nl> <nl> < file baseinstalldir = " / " name = " src / core / lib / support / block_annotate . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / env . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / load_file . h " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / support / mpscq . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / murmur_hash . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / stack_lockfree . h " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / string . h " role = " src " / > <nl> <nl> < file baseinstalldir = " / " name = " src / core / lib / support / log_linux . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / log_posix . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / log_win32 . c " role = " src " / > <nl> + < file baseinstalldir = " / " name = " src / core / lib / support / mpscq . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / murmur_hash . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / slice . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / slice_buffer . c " role = " src " / > <nl> - < file baseinstalldir = " / " name = " src / core / lib / support / stack_lockfree . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / string . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / string_posix . c " role = " src " / > <nl> < file baseinstalldir = " / " name = " src / core / lib / support / string_util_win32 . c " role = " src " / > <nl> new file mode 100644 <nl> index 00000000000 . . 911fdd161c0 <nl> mmm / dev / null <nl> ppp b / src / core / lib / support / mpscq . c <nl> <nl> + / * <nl> + * <nl> + * Copyright 2016 , 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> + # include " src / core / lib / support / mpscq . h " <nl> + <nl> + # include < grpc / support / log . h > <nl> + <nl> + void gpr_mpscq_init ( gpr_mpscq * q ) { <nl> + gpr_atm_no_barrier_store ( & q - > head , ( gpr_atm ) & q - > stub ) ; <nl> + q - > tail = & q - > stub ; <nl> + gpr_atm_no_barrier_store ( & q - > stub . next , 0 ) ; <nl> + } <nl> + <nl> + void gpr_mpscq_destroy ( gpr_mpscq * q ) { <nl> + GPR_ASSERT ( gpr_atm_no_barrier_load ( & q - > head ) = = ( gpr_atm ) & q - > stub ) ; <nl> + GPR_ASSERT ( q - > tail = = & q - > stub ) ; <nl> + } <nl> + <nl> + void gpr_mpscq_push ( gpr_mpscq * q , gpr_mpscq_node * n ) { <nl> + gpr_atm_no_barrier_store ( & n - > next , 0 ) ; <nl> + gpr_mpscq_node * prev = ( gpr_mpscq_node * ) gpr_atm_full_xchg ( & q - > head , ( gpr_atm ) n ) ; <nl> + gpr_atm_rel_store ( & prev - > next , ( gpr_atm ) n ) ; <nl> + } <nl> + <nl> + gpr_mpscq_node * gpr_mpscq_pop ( gpr_mpscq * q ) { <nl> + gpr_mpscq_node * tail = q - > tail ; <nl> + gpr_mpscq_node * next = ( gpr_mpscq_node * ) gpr_atm_acq_load ( & tail - > next ) ; <nl> + if ( tail = = & q - > stub ) { <nl> + if ( next = = NULL ) return NULL ; <nl> + q - > tail = next ; <nl> + tail = next ; <nl> + next = ( gpr_mpscq_node * ) gpr_atm_acq_load ( & tail - > next ) ; <nl> + } <nl> + if ( next ! = NULL ) { <nl> + q - > tail = next ; <nl> + return tail ; <nl> + } <nl> + gpr_mpscq_node * head = ( gpr_mpscq_node * ) gpr_atm_acq_load ( & q - > head ) ; <nl> + if ( tail ! = head ) { <nl> + return 0 ; <nl> + } <nl> + gpr_mpscq_push ( q , & q - > stub ) ; <nl> + next = ( gpr_mpscq_node * ) gpr_atm_acq_load ( & tail - > next ) ; <nl> + if ( next ! = NULL ) { <nl> + q - > tail = next ; <nl> + return tail ; <nl> + } <nl> + return NULL ; <nl> + } <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 30b37a94a18 <nl> mmm / dev / null <nl> ppp b / src / core / lib / support / mpscq . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2016 , 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> + # ifndef GRPC_CORE_LIB_SUPPORT_MPSCQ_H <nl> + # define GRPC_CORE_LIB_SUPPORT_MPSCQ_H <nl> + <nl> + # include < stddef . h > <nl> + # include < grpc / support / atm . h > <nl> + <nl> + typedef struct gpr_mpscq_node { <nl> + gpr_atm next ; <nl> + } gpr_mpscq_node ; <nl> + <nl> + typedef struct gpr_mpscq { <nl> + gpr_atm head ; <nl> + gpr_mpscq_node * tail ; <nl> + gpr_mpscq_node stub ; <nl> + } gpr_mpscq ; <nl> + <nl> + void gpr_mpscq_init ( gpr_mpscq * q ) ; <nl> + void gpr_mpscq_destroy ( gpr_mpscq * q ) ; <nl> + void gpr_mpscq_push ( gpr_mpscq * q , gpr_mpscq_node * n ) ; <nl> + gpr_mpscq_node * gpr_mpscq_pop ( gpr_mpscq * q ) ; <nl> + <nl> + # endif / * GRPC_CORE_LIB_SUPPORT_MPSCQ_H * / <nl> mmm a / src / python / grpcio / grpc_core_dependencies . py <nl> ppp b / src / python / grpcio / grpc_core_dependencies . py <nl> <nl> ' src / core / lib / support / log_linux . c ' , <nl> ' src / core / lib / support / log_posix . c ' , <nl> ' src / core / lib / support / log_win32 . c ' , <nl> + ' src / core / lib / support / mpscq . c ' , <nl> ' src / core / lib / support / murmur_hash . c ' , <nl> ' src / core / lib / support / slice . c ' , <nl> ' src / core / lib / support / slice_buffer . c ' , <nl> - ' src / core / lib / support / stack_lockfree . c ' , <nl> ' src / core / lib / support / string . c ' , <nl> ' src / core / lib / support / string_posix . c ' , <nl> ' src / core / lib / support / string_util_win32 . c ' , <nl> mmm a / tools / doxygen / Doxyfile . core . internal <nl> ppp b / tools / doxygen / Doxyfile . core . internal <nl> src / core / lib / support / backoff . h \ <nl> src / core / lib / support / block_annotate . h \ <nl> src / core / lib / support / env . h \ <nl> src / core / lib / support / load_file . h \ <nl> + src / core / lib / support / mpscq . h \ <nl> src / core / lib / support / murmur_hash . h \ <nl> src / core / lib / support / stack_lockfree . h \ <nl> src / core / lib / support / string . h \ <nl> src / core / lib / support / log_android . c \ <nl> src / core / lib / support / log_linux . c \ <nl> src / core / lib / support / log_posix . c \ <nl> src / core / lib / support / log_win32 . c \ <nl> + src / core / lib / support / mpscq . c \ <nl> src / core / lib / support / murmur_hash . c \ <nl> src / core / lib / support / slice . c \ <nl> src / core / lib / support / slice_buffer . c \ <nl> - src / core / lib / support / stack_lockfree . c \ <nl> src / core / lib / support / string . c \ <nl> src / core / lib / support / string_posix . c \ <nl> src / core / lib / support / string_util_win32 . c \ <nl> mmm a / tools / run_tests / sources_and_headers . json <nl> ppp b / tools / run_tests / sources_and_headers . json <nl> <nl> " src / core / lib / support / block_annotate . h " , <nl> " src / core / lib / support / env . h " , <nl> " src / core / lib / support / load_file . h " , <nl> + " src / core / lib / support / mpscq . h " , <nl> " src / core / lib / support / murmur_hash . h " , <nl> " src / core / lib / support / stack_lockfree . h " , <nl> " src / core / lib / support / string . h " , <nl> <nl> " src / core / lib / support / log_linux . c " , <nl> " src / core / lib / support / log_posix . c " , <nl> " src / core / lib / support / log_win32 . c " , <nl> + " src / core / lib / support / mpscq . c " , <nl> + " src / core / lib / support / mpscq . h " , <nl> " src / core / lib / support / murmur_hash . c " , <nl> " src / core / lib / support / murmur_hash . h " , <nl> " src / core / lib / support / slice . c " , <nl> " src / core / lib / support / slice_buffer . c " , <nl> - " src / core / lib / support / stack_lockfree . c " , <nl> " src / core / lib / support / stack_lockfree . h " , <nl> " src / core / lib / support / string . c " , <nl> " src / core / lib / support / string . h " , <nl> mmm a / vsprojects / vcxproj / gpr / gpr . vcxproj <nl> ppp b / vsprojects / vcxproj / gpr / gpr . vcxproj <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ block_annotate . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ env . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ load_file . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ mpscq . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ murmur_hash . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ stack_lockfree . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ string . h " / > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ log_win32 . c " > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ mpscq . c " > <nl> + < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ murmur_hash . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ slice . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ slice_buffer . c " > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ stack_lockfree . c " > <nl> - < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ string . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ string_posix . c " > <nl> mmm a / vsprojects / vcxproj / gpr / gpr . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / gpr / gpr . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ log_win32 . c " > <nl> < Filter > src \ core \ lib \ support < / Filter > <nl> < / ClCompile > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ mpscq . c " > <nl> + < Filter > src \ core \ lib \ support < / Filter > <nl> + < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ murmur_hash . c " > <nl> < Filter > src \ core \ lib \ support < / Filter > <nl> < / ClCompile > <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ slice_buffer . c " > <nl> < Filter > src \ core \ lib \ support < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ stack_lockfree . c " > <nl> - < Filter > src \ core \ lib \ support < / Filter > <nl> - < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ string . c " > <nl> < Filter > src \ core \ lib \ support < / Filter > <nl> < / ClCompile > <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ load_file . h " > <nl> < Filter > src \ core \ lib \ support < / Filter > <nl> < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ mpscq . h " > <nl> + < Filter > src \ core \ lib \ support < / Filter > <nl> + < / ClInclude > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ src \ core \ lib \ support \ murmur_hash . h " > <nl> < Filter > src \ core \ lib \ support < / Filter > <nl> < / ClInclude > <nl>
Direct translation of http : / / www . 1024cores . net / home / lock - free - algorithms / queues / intrusive - mpsc - node - based - queue
grpc/grpc
0bc11711b7f2f33bd4e399bda46e4c20ac4bc6ca
2016-05-03T04:22:46Z
mmm a / hphp / runtime / base / runtime - option . cpp <nl> ppp b / hphp / runtime / base / runtime - option . cpp <nl> int RuntimeOption : : ServerBacklog = 128 ; <nl> int RuntimeOption : : ServerConnectionLimit = 0 ; <nl> int RuntimeOption : : ServerThreadCount = 50 ; <nl> int RuntimeOption : : ServerQueueCount = 50 ; <nl> + bool RuntimeOption : : ServerLegacyBehavior = true ; <nl> int RuntimeOption : : ServerHugeThreadCount = 0 ; <nl> int RuntimeOption : : ServerHugeStackKb = 384 ; <nl> uint32_t RuntimeOption : : ServerLoopSampleRate = 0 ; <nl> void RuntimeOption : : Load ( <nl> Process : : GetCPUCount ( ) * 2 ) ; <nl> Config : : Bind ( ServerQueueCount , ini , config , " Server . QueueCount " , <nl> ServerThreadCount ) ; <nl> + Config : : Bind ( ServerLegacyBehavior , ini , config , " Server . LegacyBehavior " , <nl> + ServerLegacyBehavior ) ; <nl> Config : : Bind ( ServerHugeThreadCount , ini , config , <nl> " Server . HugeThreadCount " , 0 ) ; <nl> Config : : Bind ( ServerHugeStackKb , ini , config , " Server . HugeStackSizeKb " , 384 ) ; <nl> mmm a / hphp / runtime / base / runtime - option . h <nl> ppp b / hphp / runtime / base / runtime - option . h <nl> struct RuntimeOption { <nl> static int ServerConnectionLimit ; <nl> static int ServerThreadCount ; <nl> static int ServerQueueCount ; <nl> + static bool ServerLegacyBehavior ; <nl> / / Number of worker threads with stack partially on huge pages . <nl> static int ServerHugeThreadCount ; <nl> static int ServerHugeStackKb ; <nl> mmm a / hphp / runtime / server / http - server . cpp <nl> ppp b / hphp / runtime / server / http - server . cpp <nl> HttpServer : : HttpServer ( ) { <nl> ? RuntimeOption : : ServerIP : RuntimeOption : : ServerFileSocket ; <nl> ServerOptions options ( address , RuntimeOption : : ServerPort , <nl> RuntimeOption : : ServerThreadCount , startingThreadCount , <nl> - RuntimeOption : : ServerQueueCount ) ; <nl> + RuntimeOption : : ServerQueueCount , RuntimeOption : : ServerLegacyBehavior ) ; <nl> options . m_useFileSocket = ! RuntimeOption : : ServerFileSocket . empty ( ) ; <nl> options . m_serverFD = RuntimeOption : : ServerPortFd ; <nl> options . m_sslFD = RuntimeOption : : SSLPortFd ; <nl> mmm a / hphp / runtime / server / proxygen / proxygen - server . cpp <nl> ppp b / hphp / runtime / server / proxygen / proxygen - server . cpp <nl> ProxygenServer : : ProxygenServer ( <nl> options . m_hugeThreads , <nl> options . m_initThreads , <nl> options . m_hugeStackKb , <nl> - options . m_extraKb ) { <nl> + options . m_extraKb , <nl> + options . m_legacyBehavior ) { <nl> if ( options . m_loop_sample_rate > 0 ) { <nl> m_worker . getEventBase ( ) - > setObserver ( <nl> std : : make_shared < ProxygenEventBaseObserver > ( options . m_loop_sample_rate ) ) ; <nl> mmm a / hphp / runtime / server / server . h <nl> ppp b / hphp / runtime / server / server . h <nl> struct ServerOptions { <nl> uint16_t port , <nl> int maxThreads , <nl> int initThreads = - 1 , <nl> - int maxQueue = - 1 ) <nl> + int maxQueue = - 1 , <nl> + bool legacyBehavior = true ) <nl> : m_address ( address ) , <nl> m_port ( port ) , <nl> m_maxThreads ( maxThreads ) , <nl> m_initThreads ( initThreads ) , <nl> - m_maxQueue ( maxQueue = = - 1 ? maxThreads : maxQueue ) { <nl> + m_maxQueue ( maxQueue = = - 1 ? maxThreads : maxQueue ) , <nl> + m_legacyBehavior ( legacyBehavior ) { <nl> assertx ( m_maxThreads > = 0 ) ; <nl> if ( m_initThreads < 0 | | m_initThreads > m_maxThreads ) { <nl> m_initThreads = m_maxThreads ; <nl> struct ServerOptions { <nl> int m_maxThreads ; <nl> int m_initThreads ; <nl> int m_maxQueue ; <nl> + bool m_legacyBehavior ; <nl> int m_serverFD { - 1 } ; <nl> int m_sslFD { - 1 } ; <nl> std : : string m_takeoverFilename ; <nl> mmm a / hphp / util / job - queue . h <nl> ppp b / hphp / util / job - queue . h <nl> struct JobQueue : SynchronizableMulti { <nl> JobQueue ( int maxQueueCount , int dropCacheTimeout , <nl> bool dropStack , int lifoSwitchThreshold = INT_MAX , <nl> int maxJobQueuingMs = - 1 , int numPriorities = 1 , <nl> - IHostHealthObserver * healthStatus = nullptr ) <nl> + bool legacyBehavior = true ) <nl> : SynchronizableMulti ( maxQueueCount + 1 ) / / reaper added <nl> , m_dropCacheTimeout ( dropCacheTimeout ) <nl> , m_dropStack ( dropStack ) <nl> , m_lifoSwitchThreshold ( lifoSwitchThreshold ) <nl> , m_maxJobQueuingMs ( maxJobQueuingMs ) <nl> , m_jobReaperId ( maxQueueCount ) <nl> - , m_healthStatus ( healthStatus ) { <nl> + , m_legacyBehavior ( legacyBehavior ) { <nl> assertx ( maxQueueCount > 0 ) ; <nl> m_jobQueues . resize ( numPriorities ) ; <nl> } <nl> struct JobQueue : SynchronizableMulti { <nl> * Put a job into the queue and notify a worker to pick it up if requested . <nl> * / <nl> void enqueue ( TJob job , int priority = 0 , bool eagerNotify = true ) { <nl> + uint32_t kNumPriority = m_jobQueues . size ( ) ; <nl> assertx ( priority > = 0 ) ; <nl> - assertx ( priority < m_jobQueues . size ( ) ) ; <nl> + assertx ( priority < kNumPriority ) ; <nl> timespec enqueueTime ; <nl> Timer : : GetMonotonicTime ( enqueueTime ) ; <nl> Lock lock ( this ) ; <nl> m_jobQueues [ priority ] . emplace_back ( job , enqueueTime ) ; <nl> + + m_jobCount ; <nl> - if ( eagerNotify ) notify ( ) ; <nl> + if ( m_legacyBehavior ) { <nl> + if ( eagerNotify ) notify ( ) ; <nl> + } else { <nl> + if ( priority = = kNumPriority - 1 | | <nl> + getActiveWorker ( ) < <nl> + m_maxActiveWorkers . load ( std : : memory_order_acquire ) ) { <nl> + notify ( ) ; <nl> + } <nl> + } <nl> } <nl> <nl> / * * <nl> struct JobQueue : SynchronizableMulti { <nl> return m_jobCount ; <nl> } <nl> <nl> + void updateMaxActiveWorkers ( int num ) { <nl> + int old = m_maxActiveWorkers . exchange ( num , std : : memory_order_acq_rel ) ; <nl> + if ( ! m_legacyBehavior & & num > old ) { <nl> + Lock lock ( this ) ; <nl> + int workerCountChange = num - getActiveWorker ( ) ; <nl> + int toRelease = std : : min ( m_jobCount , workerCountChange ) ; <nl> + for ( ; toRelease > 0 ; - - toRelease ) { <nl> + notify ( ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> int releaseQueuedJobs ( int target = 0 ) { <nl> + assertx ( m_legacyBehavior ) ; <nl> if ( m_jobCount ) { <nl> Lock lock ( this ) ; <nl> const int active = getActiveWorker ( ) ; <nl> struct JobQueue : SynchronizableMulti { <nl> Lock lock ( this ) ; <nl> bool flushed = false ; <nl> <nl> + bool ableToDequeue ; <nl> while ( m_jobCount = = 0 | | <nl> - ( m_healthStatus & & <nl> - m_healthStatus - > getHealthLevel ( ) > = HealthLevel : : NoMore ) ) { <nl> + ! ( ableToDequeue = getActiveWorker ( ) < <nl> + m_maxActiveWorkers . load ( std : : memory_order_acquire ) ) ) { <nl> uint32_t kNumPriority = m_jobQueues . size ( ) ; <nl> if ( m_jobQueues [ kNumPriority - 1 ] . size ( ) > 0 ) { <nl> break ; <nl> struct JobQueue : SynchronizableMulti { <nl> / / without huge stack . <nl> wait ( id , q , highPri ? Priority : : High : Priority : : Low ) ; <nl> } else if ( m_dropCacheTimeout > 0 ) { <nl> - if ( ! wait ( id , q , ( highPri ? Priority : : Highest : Priority : : Normal ) , <nl> + / / When we can ' t dequeue due to the max active worker limit , we flush <nl> + / / the thread immediately to reduce resource pressure . <nl> + if ( ! ableToDequeue | | <nl> + ! wait ( id , q , ( highPri ? Priority : : Highest : Priority : : Normal ) , <nl> m_dropCacheTimeout ) ) { <nl> / / since we timed out , maybe we can turn idle without holding memory <nl> - if ( m_jobCount = = 0 ) { <nl> + if ( m_jobCount = = 0 | | ! ableToDequeue ) { <nl> ScopedUnlock unlock ( this ) ; <nl> flush_thread_caches ( ) ; <nl> if ( m_dropStack & & s_stackLimit ) { <nl> struct JobQueue : SynchronizableMulti { <nl> folly : : small_vector < std : : deque < std : : pair < TJob , timespec > > , 2 > m_jobQueues ; <nl> bool m_stopped { false } ; <nl> std : : atomic < int > m_workerCount { 0 } ; <nl> + std : : atomic < int > m_maxActiveWorkers { INT_MAX } ; <nl> const int m_dropCacheTimeout ; <nl> const bool m_dropStack ; <nl> const int m_lifoSwitchThreshold ; <nl> const int m_maxJobQueuingMs ; <nl> const int m_jobReaperId ; / / equals max worker thread count <nl> - IHostHealthObserver * m_healthStatus ; <nl> + const bool m_legacyBehavior ; <nl> } ; <nl> <nl> template < class TJob , class Policy > <nl> struct JobQueue < TJob , true , Policy > : JobQueue < TJob , false , Policy > { <nl> JobQueue ( int threadCount , int dropCacheTimeout , <nl> bool dropStack , int lifoSwitchThreshold = INT_MAX , <nl> int maxJobQueuingMs = - 1 , int numPriorities = 1 , <nl> - IHostHealthObserver * healthStatus = nullptr ) : <nl> + bool legacyBehavior = true ) : <nl> JobQueue < TJob , false , Policy > ( threadCount , <nl> dropCacheTimeout , <nl> dropStack , <nl> lifoSwitchThreshold , <nl> maxJobQueuingMs , <nl> numPriorities , <nl> - healthStatus ) { <nl> + legacyBehavior ) { <nl> pthread_cond_init ( & m_cond , nullptr ) ; <nl> } <nl> ~ JobQueue ( ) override { <nl> struct JobQueueDispatcher : IHostHealthObserver { <nl> int hugeCount = 0 , <nl> int initThreadCount = - 1 , <nl> unsigned hugeStackKb = 0 , <nl> - unsigned extraKb = 0 ) <nl> + unsigned extraKb = 0 , <nl> + bool legacyBehavior = true ) <nl> : m_startReaperThread ( maxJobQueuingMs > 0 ) <nl> , m_context ( context ) <nl> , m_maxThreadCount ( maxThreadCount ) <nl> struct JobQueueDispatcher : IHostHealthObserver { <nl> , m_hugeThreadCount ( hugeCount ) <nl> , m_hugeStackKb ( hugeStackKb ) <nl> , m_tlExtraKb ( extraKb ) <nl> + , m_legacyBehavior ( legacyBehavior ) <nl> , m_queue ( m_maxQueueCount , dropCacheTimeout , dropStack , <nl> lifoSwitchThreshold , maxJobQueuingMs , numPriorities , <nl> - this ) { <nl> + legacyBehavior ) { <nl> assertx ( maxThreadCount > = 1 ) ; <nl> assertx ( m_maxQueueCount > = maxThreadCount ) ; <nl> if ( maxQueueCountConfig < maxThreadCount ) { <nl> struct JobQueueDispatcher : IHostHealthObserver { <nl> * / <nl> void enqueue ( typename TWorker : : JobType job , int priority = 0 ) { <nl> auto const level = getHealthLevel ( ) ; <nl> - auto const eagerNotify = <nl> - ( level < HealthLevel : : Cautious ) | | <nl> - ( ( level = = HealthLevel : : Cautious ) & & <nl> - ( m_queue . getActiveWorker ( ) * 2 < = m_currThreadCountLimit ) ) ; <nl> - m_queue . enqueue ( job , priority , eagerNotify ) ; <nl> + if ( m_legacyBehavior ) { <nl> + auto const eagerNotify = <nl> + ( level < HealthLevel : : Cautious ) | | <nl> + ( ( level = = HealthLevel : : Cautious ) & & <nl> + ( m_queue . getActiveWorker ( ) * 2 < = m_currThreadCountLimit ) ) ; <nl> + m_queue . enqueue ( job , priority , eagerNotify ) ; <nl> + } else { <nl> + m_queue . enqueue ( job , priority ) ; <nl> + } <nl> <nl> / / Spin up another worker thread if appropriate . <nl> auto const target = getTargetNumWorkers ( ) ; <nl> struct JobQueueDispatcher : IHostHealthObserver { <nl> } <nl> <nl> void notifyNewStatus ( HealthLevel newStatus ) override { <nl> - if ( m_healthStatus > = HealthLevel : : NoMore & & <nl> - newStatus < HealthLevel : : NoMore ) { <nl> - m_healthStatus = newStatus ; <nl> - / / release blocked requests in queue if any <nl> - m_queue . releaseQueuedJobs ( m_currThreadCountLimit / 4 ) ; <nl> + if ( m_legacyBehavior ) { <nl> + if ( m_healthStatus > = HealthLevel : : NoMore & & <nl> + newStatus < HealthLevel : : NoMore ) { <nl> + m_healthStatus = newStatus ; <nl> + / / release blocked requests in queue if any <nl> + m_queue . updateMaxActiveWorkers ( INT_MAX ) ; <nl> + m_queue . releaseQueuedJobs ( m_currThreadCountLimit / 4 ) ; <nl> + } else if ( newStatus > = HealthLevel : : NoMore & & <nl> + m_healthStatus < HealthLevel : : NoMore ) { <nl> + m_healthStatus = newStatus ; <nl> + m_queue . updateMaxActiveWorkers ( 0 ) ; <nl> + } else { <nl> + m_healthStatus = newStatus ; <nl> + } <nl> } else { <nl> - m_healthStatus = newStatus ; <nl> + if ( m_healthStatus ! = newStatus ) { <nl> + / / TODO : Use an estimated safe number of workers . <nl> + if ( newStatus > = HealthLevel : : NoMore ) { <nl> + m_queue . updateMaxActiveWorkers ( 0 ) ; <nl> + } else { <nl> + m_queue . updateMaxActiveWorkers ( INT_MAX ) ; <nl> + } <nl> + <nl> + m_healthStatus = newStatus ; <nl> + } <nl> } <nl> } <nl> <nl> struct JobQueueDispatcher : IHostHealthObserver { <nl> int m_hugeThreadCount { 0 } ; <nl> unsigned m_hugeStackKb ; <nl> unsigned m_tlExtraKb ; <nl> + const bool m_legacyBehavior ; <nl> JobQueue < typename TWorker : : JobType , <nl> TWorker : : Waitable , <nl> typename TWorker : : DropCachePolicy > m_queue ; <nl>
Introduce alternate server job - queue dequeue limiter
facebook/hhvm
cbeaf125f3e9b6ce9d6c3991aa1e4d88533a5b33
2020-03-04T23:36:35Z
mmm a / arangod / Aql / ExecutionBlock . h <nl> ppp b / arangod / Aql / ExecutionBlock . h <nl> namespace triagens { <nl> <nl> struct VarInfo { <nl> unsigned int depth ; <nl> - unsigned int index ; <nl> - VarInfo ( int depth , int index ) : depth ( depth ) , index ( index ) { } <nl> + RegisterId registerId ; <nl> + VarInfo ( int depth , int registerId ) : depth ( depth ) , registerId ( registerId ) { } <nl> } ; <nl> <nl> struct VarOverview : public WalkerWorker { <nl> / / The following are collected for global usage in the ExecutionBlock : <nl> <nl> - / / map VariableIds to their depth and index : <nl> + / / map VariableIds to their depth and registerId : <nl> std : : unordered_map < VariableId , VarInfo > varInfo ; <nl> <nl> / / number of variables in the frame of the current depth : <nl> - std : : vector < VariableId > nrVarsHere ; <nl> + std : : vector < RegisterId > nrRegsHere ; <nl> <nl> / / number of variables in this and all outer frames together , <nl> / / the entry with index i here is always the sum of all values <nl> - / / in nrVarsHere from index 0 to i ( inclusively ) and the two <nl> + / / in nrRegsHere from index 0 to i ( inclusively ) and the two <nl> / / have the same length : <nl> - std : : vector < VariableId > nrVars ; <nl> + std : : vector < RegisterId > nrRegs ; <nl> <nl> / / Local for the walk : <nl> unsigned int depth ; <nl> - unsigned int totalNrVars ; <nl> + unsigned int totalNrRegs ; <nl> <nl> / / This is used to tell all Blocks and share a pointer to ourselves <nl> shared_ptr < VarOverview > * me ; <nl> <nl> VarOverview ( ) <nl> - : depth ( 0 ) , totalNrVars ( 0 ) , me ( nullptr ) { <nl> - nrVarsHere . push_back ( 0 ) ; <nl> - nrVars . push_back ( 0 ) ; <nl> + : depth ( 0 ) , totalNrRegs ( 0 ) , me ( nullptr ) { <nl> + nrRegsHere . push_back ( 0 ) ; <nl> + nrRegs . push_back ( 0 ) ; <nl> } ; <nl> <nl> void setSharedPtr ( shared_ptr < VarOverview > * shared ) { <nl> namespace triagens { <nl> <nl> / / Copy constructor used for a subquery : <nl> VarOverview ( VarOverview const & v ) <nl> - : varInfo ( v . varInfo ) , nrVarsHere ( v . nrVars ) , nrVars ( v . nrVars ) , <nl> - depth ( v . depth + 1 ) , totalNrVars ( v . totalNrVars ) , me ( nullptr ) { <nl> - nrVarsHere . push_back ( 0 ) ; <nl> - nrVars . push_back ( 0 ) ; <nl> + : varInfo ( v . varInfo ) , nrRegsHere ( v . nrRegs ) , nrRegs ( v . nrRegs ) , <nl> + depth ( v . depth + 1 ) , totalNrRegs ( v . totalNrRegs ) , me ( nullptr ) { <nl> + nrRegsHere . push_back ( 0 ) ; <nl> + nrRegs . push_back ( 0 ) ; <nl> } <nl> <nl> ~ VarOverview ( ) { } ; <nl> namespace triagens { <nl> switch ( eb - > getPlanNode ( ) - > getType ( ) ) { <nl> case ExecutionNode : : ENUMERATE_COLLECTION : { <nl> depth + + ; <nl> - nrVarsHere . push_back ( 1 ) ; <nl> - nrVars . push_back ( 1 + nrVars . back ( ) ) ; <nl> + nrRegsHere . push_back ( 1 ) ; <nl> + nrRegs . push_back ( 1 + nrRegs . back ( ) ) ; <nl> auto ep = static_cast < EnumerateCollectionNode const * > ( eb - > getPlanNode ( ) ) ; <nl> varInfo . insert ( make_pair ( ep - > _outVariable - > id , <nl> - VarInfo ( depth , totalNrVars ) ) ) ; <nl> - totalNrVars + + ; <nl> + VarInfo ( depth , totalNrRegs ) ) ) ; <nl> + totalNrRegs + + ; <nl> break ; <nl> } <nl> case ExecutionNode : : ENUMERATE_LIST : { <nl> depth + + ; <nl> - nrVarsHere . push_back ( 1 ) ; <nl> - nrVars . push_back ( 1 + nrVars . back ( ) ) ; <nl> + nrRegsHere . push_back ( 1 ) ; <nl> + nrRegs . push_back ( 1 + nrRegs . back ( ) ) ; <nl> auto ep = static_cast < EnumerateListNode const * > ( eb - > getPlanNode ( ) ) ; <nl> varInfo . insert ( make_pair ( ep - > _outVariable - > id , <nl> - VarInfo ( depth , totalNrVars ) ) ) ; <nl> - totalNrVars + + ; <nl> + VarInfo ( depth , totalNrRegs ) ) ) ; <nl> + totalNrRegs + + ; <nl> break ; <nl> } <nl> case ExecutionNode : : CALCULATION : { <nl> - nrVarsHere [ depth ] + + ; <nl> - nrVars [ depth ] + + ; <nl> + nrRegsHere [ depth ] + + ; <nl> + nrRegs [ depth ] + + ; <nl> auto ep = static_cast < CalculationNode const * > ( eb - > getPlanNode ( ) ) ; <nl> varInfo . insert ( make_pair ( ep - > _outVariable - > id , <nl> - VarInfo ( depth , totalNrVars ) ) ) ; <nl> - totalNrVars + + ; <nl> + VarInfo ( depth , totalNrRegs ) ) ) ; <nl> + totalNrRegs + + ; <nl> break ; <nl> } <nl> case ExecutionNode : : PROJECTION : { <nl> - nrVarsHere [ depth ] + + ; <nl> - nrVars [ depth ] + + ; <nl> + nrRegsHere [ depth ] + + ; <nl> + nrRegs [ depth ] + + ; <nl> auto ep = static_cast < ProjectionNode const * > ( eb - > getPlanNode ( ) ) ; <nl> varInfo . insert ( make_pair ( ep - > _outVariable - > id , <nl> - VarInfo ( depth , totalNrVars ) ) ) ; <nl> - totalNrVars + + ; <nl> + VarInfo ( depth , totalNrRegs ) ) ) ; <nl> + totalNrRegs + + ; <nl> break ; <nl> } <nl> case ExecutionNode : : SUBQUERY : { <nl> - nrVarsHere [ depth ] + + ; <nl> - nrVars [ depth ] + + ; <nl> + nrRegsHere [ depth ] + + ; <nl> + nrRegs [ depth ] + + ; <nl> auto ep = static_cast < SubqueryNode const * > ( eb - > getPlanNode ( ) ) ; <nl> varInfo . insert ( make_pair ( ep - > _outVariable - > id , <nl> - VarInfo ( depth , totalNrVars ) ) ) ; <nl> - totalNrVars + + ; <nl> + VarInfo ( depth , totalNrRegs ) ) ) ; <nl> + totalNrRegs + + ; <nl> break ; <nl> } <nl> / / TODO : potentially more cases <nl> namespace triagens { <nl> return nullptr ; <nl> } <nl> <nl> - AqlItemBlock * res ( new AqlItemBlock ( 1 , _varOverview - > nrVars [ _depth ] ) ) ; <nl> + AqlItemBlock * res ( new AqlItemBlock ( 1 , _varOverview - > nrRegs [ _depth ] ) ) ; <nl> _done = true ; <nl> return res ; <nl> } <nl> namespace triagens { <nl> return nullptr ; <nl> } <nl> <nl> - AqlItemBlock * res ( new AqlItemBlock ( 1 , _varOverview - > nrVars [ _depth ] ) ) ; <nl> + AqlItemBlock * res ( new AqlItemBlock ( 1 , _varOverview - > nrRegs [ _depth ] ) ) ; <nl> _done = true ; <nl> return res ; <nl> } <nl> namespace triagens { <nl> AqlItemBlock * cur = _buffer . front ( ) ; <nl> <nl> / / Copy stuff from frames above : <nl> - auto res = new AqlItemBlock ( 1 , _varOverview - > nrVars [ _depth ] ) ; <nl> - TRI_ASSERT ( cur - > getNrVars ( ) < = res - > getNrVars ( ) ) ; <nl> - for ( VariableId i = 0 ; i < cur - > getNrVars ( ) ; i + + ) { <nl> + auto res = new AqlItemBlock ( 1 , _varOverview - > nrRegs [ _depth ] ) ; <nl> + TRI_ASSERT ( cur - > getNrRegs ( ) < = res - > getNrRegs ( ) ) ; <nl> + for ( RegisterId i = 0 ; i < cur - > getNrRegs ( ) ; i + + ) { <nl> res - > setValue ( 0 , i , cur - > getValue ( _pos , i ) - > clone ( ) ) ; <nl> } <nl> <nl> / / The result is in the first variable of this depth , <nl> / / we do not need to do a lookup in _varOverview - > varInfo , <nl> - / / but can just take cur - > getNrVars ( ) as index : <nl> - res - > setValue ( 0 , cur - > getNrVars ( ) , <nl> + / / but can just take cur - > getNrRegs ( ) as registerId : <nl> + res - > setValue ( 0 , cur - > getNrRegs ( ) , <nl> new AqlValue ( new Json ( _allDocs [ _posInAllDocs + + ] - > copy ( ) ) ) ) ; <nl> <nl> / / Advance read position : <nl> namespace triagens { <nl> size_t available = _allDocs . size ( ) - _posInAllDocs ; <nl> size_t toSend = std : : min ( atMost , available ) ; <nl> <nl> - auto res = new AqlItemBlock ( toSend , _varOverview - > nrVars [ _depth ] ) ; <nl> - TRI_ASSERT ( cur - > getNrVars ( ) < = res - > getNrVars ( ) ) ; <nl> + auto res = new AqlItemBlock ( toSend , _varOverview - > nrRegs [ _depth ] ) ; <nl> + TRI_ASSERT ( cur - > getNrRegs ( ) < = res - > getNrRegs ( ) ) ; <nl> for ( size_t j = 0 ; j < toSend ; j + + ) { <nl> - for ( VariableId i = 0 ; i < cur - > getNrVars ( ) ; i + + ) { <nl> + for ( RegisterId i = 0 ; i < cur - > getNrRegs ( ) ; i + + ) { <nl> res - > setValue ( j , i , cur - > getValue ( _pos , i ) - > clone ( ) ) ; <nl> } <nl> / / The result is in the first variable of this depth , <nl> / / we do not need to do a lookup in _varOverview - > varInfo , <nl> - / / but can just take cur - > getNrVars ( ) as index : <nl> - res - > setValue ( j , cur - > getNrVars ( ) , <nl> + / / but can just take cur - > getNrRegs ( ) as registerId : <nl> + res - > setValue ( j , cur - > getNrRegs ( ) , <nl> new AqlValue ( new Json ( _allDocs [ _posInAllDocs + + ] - > copy ( ) ) ) ) ; <nl> } <nl> <nl> namespace triagens { <nl> size_t _posInAllDocs ; <nl> } ; <nl> <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / - - SECTION - - CalculationBlock <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + <nl> + class CalculationBlock : public ExecutionBlock { <nl> + <nl> + public : <nl> + <nl> + CalculationBlock ( CalculationNode const * en ) <nl> + : ExecutionBlock ( en ) , _expression ( en - > expression ( ) ) , _outReg ( 0 ) { <nl> + <nl> + std : : unordered_set < Variable * > inVars = _expression - > variables ( ) ; <nl> + for ( auto it = inVars . begin ( ) ; it ! = inVars . end ( ) ; + + it ) { <nl> + _inVars . push_back ( * it ) ; <nl> + auto it2 = _varOverview - > varInfo . find ( ( * it ) - > id ) ; <nl> + TRI_ASSERT ( it2 ! = _varOverview - > varInfo . end ( ) ) ; <nl> + _inRegs . push_back ( it2 - > second . registerId ) ; <nl> + } <nl> + <nl> + auto it3 = _varOverview - > varInfo . find ( en - > _outVariable - > id ) ; <nl> + TRI_ASSERT ( it3 ! = _varOverview - > varInfo . end ( ) ) ; <nl> + _outReg = it3 - > second . registerId ; <nl> + } <nl> + <nl> + ~ CalculationBlock ( ) { <nl> + } <nl> + <nl> + void doEvaluation ( AqlItemBlock * result ) { <nl> + <nl> + for ( size_t i = 0 ; i < result - > size ( ) ; i + + ) { <nl> + / / Now build V8 - Object as argument : <nl> + for ( size_t j = 0 ; j < _inVars . size ( ) ; j + + ) { <nl> + <nl> + } <nl> + } <nl> + } <nl> + <nl> + virtual AqlItemBlock * getOne ( ) { <nl> + AqlItemBlock * res = ExecutionBlock : : getOne ( ) ; <nl> + try { <nl> + doEvaluation ( res ) ; <nl> + return res ; <nl> + } <nl> + catch ( . . . ) { <nl> + delete res ; <nl> + throw ; <nl> + } <nl> + } <nl> + <nl> + virtual AqlItemBlock * getSome ( size_t atLeast , <nl> + size_t atMost ) { <nl> + AqlItemBlock * res = ExecutionBlock : : getSome ( atLeast , atMost ) ; <nl> + try { <nl> + doEvaluation ( res ) ; <nl> + return res ; <nl> + } <nl> + catch ( . . . ) { <nl> + delete res ; <nl> + throw ; <nl> + } <nl> + } <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief we hold a pointer to the expression in the plan <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + private : <nl> + Expression * _expression ; <nl> + std : : vector < Variable * > _inVars ; <nl> + std : : vector < RegisterId > _inRegs ; <nl> + RegisterId _outReg ; <nl> + <nl> + } ; <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - ReturnBlock <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> namespace triagens { <nl> auto ep = static_cast < ReturnNode const * > ( getPlanNode ( ) ) ; <nl> auto it = _varOverview - > varInfo . find ( ep - > _inVariable - > id ) ; <nl> TRI_ASSERT ( it ! = _varOverview - > varInfo . end ( ) ) ; <nl> - unsigned int index = it - > second . index ; <nl> - stripped - > setValue ( 0 , 0 , res - > getValue ( 0 , index ) ) ; <nl> - res - > setValue ( 0 , index , nullptr ) ; <nl> + RegisterId registerId = it - > second . registerId ; <nl> + stripped - > setValue ( 0 , 0 , res - > getValue ( 0 , registerId ) ) ; <nl> + res - > setValue ( 0 , registerId , nullptr ) ; <nl> delete res ; <nl> return stripped ; <nl> } <nl> namespace triagens { <nl> auto ep = static_cast < ReturnNode const * > ( getPlanNode ( ) ) ; <nl> auto it = _varOverview - > varInfo . find ( ep - > _inVariable - > id ) ; <nl> TRI_ASSERT ( it ! = _varOverview - > varInfo . end ( ) ) ; <nl> - unsigned int index = it - > second . index ; <nl> + RegisterId registerId = it - > second . registerId ; <nl> AqlItemBlock * stripped = new AqlItemBlock ( res - > size ( ) , 1 ) ; <nl> for ( size_t i = 0 ; i < res - > size ( ) ; i + + ) { <nl> - stripped - > setValue ( i , 0 , res - > getValue ( i , index ) ) ; <nl> - res - > setValue ( i , index , nullptr ) ; <nl> + stripped - > setValue ( i , 0 , res - > getValue ( i , registerId ) ) ; <nl> + res - > setValue ( i , registerId , nullptr ) ; <nl> } <nl> delete res ; <nl> return stripped ; <nl> mmm a / arangod / Aql / Types . cpp <nl> ppp b / arangod / Aql / Types . cpp <nl> AqlItemBlock * AqlItemBlock : : splice ( std : : vector < AqlItemBlock * > & blocks ) <nl> auto it = blocks . begin ( ) ; <nl> TRI_ASSERT ( it ! = blocks . end ( ) ) ; <nl> size_t totalSize = ( * it ) - > size ( ) ; <nl> - VariableId nrVars = ( * it ) - > getNrVars ( ) ; <nl> + RegisterId nrRegs = ( * it ) - > getNrVars ( ) ; <nl> <nl> while ( true ) { <nl> if ( + + it = = blocks . end ( ) ) { <nl> break ; <nl> } <nl> totalSize + = ( * it ) - > size ( ) ; <nl> - TRI_ASSERT ( ( * it ) - > getNrVars ( ) = = nrVars ) ; <nl> + TRI_ASSERT ( ( * it ) - > getNrVars ( ) = = nrRegs ) ; <nl> } <nl> <nl> - auto res = new AqlItemBlock ( totalSize , nrVars ) ; <nl> + auto res = new AqlItemBlock ( totalSize , nrRegs ) ; <nl> size_t pos = 0 ; <nl> for ( it = blocks . begin ( ) ; it ! = blocks . end ( ) ; + + it ) { <nl> for ( size_t row = 0 ; row < ( * it ) - > size ( ) ; + + row ) { <nl> - for ( VariableId col = 0 ; col < nrVars ; + + col ) { <nl> + for ( RegisterId col = 0 ; col < nrRegs ; + + col ) { <nl> res - > setValue ( pos + row , col , ( * it ) - > getValue ( row , col ) ) ; <nl> ( * it ) - > setValue ( row , col , nullptr ) ; <nl> } <nl> mmm a / arangod / Aql / Types . h <nl> ppp b / arangod / Aql / Types . h <nl> namespace triagens { <nl> / / - - SECTION - - AqlDoc <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> + typedef unsigned int RegisterId ; <nl> <nl> class AqlItemBlock ; <nl> <nl> namespace triagens { <nl> <nl> AqlValue * * _data ; <nl> size_t _nrItems ; <nl> - VariableId _nrVars ; <nl> + RegisterId _nrRegs ; <nl> <nl> public : <nl> <nl> - AqlItemBlock ( size_t nrItems , VariableId nrVars ) <nl> - : _nrItems ( nrItems ) , _nrVars ( nrVars ) { <nl> - if ( nrItems > 0 & & nrVars > 0 ) { <nl> - _data = new AqlValue * [ nrItems * nrVars ] ; <nl> - for ( size_t i = 0 ; i < nrItems * nrVars ; i + + ) { <nl> + AqlItemBlock ( size_t nrItems , RegisterId nrRegs ) <nl> + : _nrItems ( nrItems ) , _nrRegs ( nrRegs ) { <nl> + if ( nrItems > 0 & & nrRegs > 0 ) { <nl> + _data = new AqlValue * [ nrItems * nrRegs ] ; <nl> + for ( size_t i = 0 ; i < nrItems * nrRegs ; i + + ) { <nl> _data [ i ] = nullptr ; <nl> } <nl> } <nl> namespace triagens { <nl> ~ AqlItemBlock ( ) { <nl> std : : unordered_set < AqlValue * > cache ; <nl> if ( _data ! = nullptr ) { <nl> - for ( size_t i = 0 ; i < _nrItems * _nrVars ; i + + ) { <nl> + for ( size_t i = 0 ; i < _nrItems * _nrRegs ; i + + ) { <nl> if ( _data [ i ] ! = nullptr ) { <nl> auto it = cache . find ( _data [ i ] ) ; <nl> if ( it = = cache . end ( ) ) { <nl> namespace triagens { <nl> / / / @ brief getValue , get the value of a variable <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - AqlValue * getValue ( size_t index , VariableId varNr ) { <nl> + AqlValue * getValue ( size_t index , RegisterId varNr ) { <nl> if ( _data = = nullptr ) { <nl> return nullptr ; <nl> } <nl> else { <nl> - return _data [ index * _nrVars + varNr ] ; <nl> + return _data [ index * _nrRegs + varNr ] ; <nl> } <nl> } <nl> <nl> namespace triagens { <nl> / / / @ brief setValue , set the current value of a variable or attribute <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - void setValue ( size_t index , VariableId varNr , AqlValue * zeug ) { <nl> + void setValue ( size_t index , RegisterId varNr , AqlValue * zeug ) { <nl> if ( _data ! = nullptr ) { <nl> - _data [ index * _nrVars + varNr ] = zeug ; <nl> + _data [ index * _nrRegs + varNr ] = zeug ; <nl> } <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief getter for _nrVars <nl> + / / / @ brief getter for _nrRegs <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - VariableId getNrVars ( ) { <nl> - return _nrVars ; <nl> + RegisterId getNrRegs ( ) { <nl> + return _nrRegs ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> namespace triagens { <nl> AqlItemBlock * slice ( size_t from , size_t to ) { <nl> TRI_ASSERT ( from < to & & to < = _nrItems ) ; <nl> std : : unordered_map < AqlValue * , AqlValue * > cache ; <nl> - auto res = new AqlItemBlock ( to - from , _nrVars ) ; <nl> + auto res = new AqlItemBlock ( to - from , _nrRegs ) ; <nl> for ( size_t row = from ; row < to ; row + + ) { <nl> - for ( VariableId col = 0 ; col < _nrVars ; col + + ) { <nl> - AqlValue * a = _data [ row * _nrVars + col ] ; <nl> + for ( RegisterId col = 0 ; col < _nrRegs ; col + + ) { <nl> + AqlValue * a = _data [ row * _nrRegs + col ] ; <nl> auto it = cache . find ( a ) ; <nl> if ( it = = cache . end ( ) ) { <nl> AqlValue * b = a - > clone ( ) ; <nl> - res - > _data [ ( row - from ) * _nrVars + col ] = b ; <nl> + res - > _data [ ( row - from ) * _nrRegs + col ] = b ; <nl> cache . insert ( make_pair ( a , b ) ) ; <nl> } <nl> else { <nl> - res - > _data [ ( row - from ) * _nrVars + col ] = it - > second ; <nl> + res - > _data [ ( row - from ) * _nrRegs + col ] = it - > second ; <nl> } <nl> } <nl> } <nl>
Call many things register , because they are .
arangodb/arangodb
46424e9e0b0a2443ce82f905ebf1fb7c566480b7
2014-08-01T12:35:28Z
mmm a / src / arm / lithium - codegen - arm . cc <nl> ppp b / src / arm / lithium - codegen - arm . cc <nl> void LCodeGen : : DoLoadNamedFieldPolymorphic ( LLoadNamedFieldPolymorphic * instr ) { <nl> Register scratch = scratch0 ( ) ; <nl> int map_count = instr - > hydrogen ( ) - > types ( ) - > length ( ) ; <nl> Handle < String > name = instr - > hydrogen ( ) - > name ( ) ; <nl> - if ( map_count = = 0 ) { <nl> - ASSERT ( instr - > hydrogen ( ) - > need_generic ( ) ) ; <nl> + if ( map_count = = 0 & & instr - > hydrogen ( ) - > need_generic ( ) ) { <nl> __ mov ( r2 , Operand ( name ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > LoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> void LCodeGen : : DoLoadNamedFieldPolymorphic ( LLoadNamedFieldPolymorphic * instr ) { <nl> __ b ( & done ) ; <nl> __ bind ( & next ) ; <nl> } <nl> - Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> - __ cmp ( scratch , Operand ( map ) ) ; <nl> if ( instr - > hydrogen ( ) - > need_generic ( ) ) { <nl> - Label generic ; <nl> - __ b ( ne , & generic ) ; <nl> - EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> - __ b ( & done ) ; <nl> - __ bind ( & generic ) ; <nl> + if ( map_count ! = 0 ) { <nl> + Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> + __ cmp ( scratch , Operand ( map ) ) ; <nl> + Label generic ; <nl> + __ b ( ne , & generic ) ; <nl> + EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + __ b ( & done ) ; <nl> + __ bind ( & generic ) ; <nl> + } <nl> __ mov ( r2 , Operand ( name ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > LoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> } else { <nl> - DeoptimizeIf ( ne , instr - > environment ( ) ) ; <nl> - EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + if ( map_count ! = 0 ) { <nl> + Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> + __ cmp ( scratch , Operand ( map ) ) ; <nl> + DeoptimizeIf ( ne , instr - > environment ( ) ) ; <nl> + EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + } else { <nl> + DeoptimizeIf ( al , instr - > environment ( ) ) ; <nl> + } <nl> } <nl> __ bind ( & done ) ; <nl> } <nl> mmm a / src / mips / lithium - codegen - mips . cc <nl> ppp b / src / mips / lithium - codegen - mips . cc <nl> void LCodeGen : : DoLoadNamedFieldPolymorphic ( LLoadNamedFieldPolymorphic * instr ) { <nl> Register scratch = scratch0 ( ) ; <nl> int map_count = instr - > hydrogen ( ) - > types ( ) - > length ( ) ; <nl> Handle < String > name = instr - > hydrogen ( ) - > name ( ) ; <nl> - if ( map_count = = 0 ) { <nl> - ASSERT ( instr - > hydrogen ( ) - > need_generic ( ) ) ; <nl> + if ( map_count = = 0 & & instr - > hydrogen ( ) - > need_generic ( ) ) { <nl> __ li ( a2 , Operand ( name ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > LoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> void LCodeGen : : DoLoadNamedFieldPolymorphic ( LLoadNamedFieldPolymorphic * instr ) { <nl> __ Branch ( & done ) ; <nl> __ bind ( & next ) ; <nl> } <nl> - Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> if ( instr - > hydrogen ( ) - > need_generic ( ) ) { <nl> - Label generic ; <nl> - __ Branch ( & generic , ne , scratch , Operand ( map ) ) ; <nl> - EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> - __ Branch ( & done ) ; <nl> - __ bind ( & generic ) ; <nl> + if ( map_count ! = 0 ) { <nl> + Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> + Label generic ; <nl> + __ Branch ( & generic , ne , scratch , Operand ( map ) ) ; <nl> + EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + __ Branch ( & done ) ; <nl> + __ bind ( & generic ) ; <nl> + } <nl> __ li ( a2 , Operand ( name ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > LoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> } else { <nl> - DeoptimizeIf ( ne , instr - > environment ( ) , scratch , Operand ( map ) ) ; <nl> - EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + if ( map_count ! = 0 ) { <nl> + Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> + DeoptimizeIf ( ne , instr - > environment ( ) , scratch , Operand ( map ) ) ; <nl> + EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + } else { <nl> + DeoptimizeIf ( al , instr - > environment ( ) , zero_reg , Operand ( zero_reg ) ) ; <nl> + } <nl> } <nl> __ bind ( & done ) ; <nl> } <nl> mmm a / src / x64 / lithium - codegen - x64 . cc <nl> ppp b / src / x64 / lithium - codegen - x64 . cc <nl> void LCodeGen : : DoLoadNamedFieldPolymorphic ( LLoadNamedFieldPolymorphic * instr ) { <nl> int map_count = instr - > hydrogen ( ) - > types ( ) - > length ( ) ; <nl> Handle < String > name = instr - > hydrogen ( ) - > name ( ) ; <nl> <nl> - if ( map_count = = 0 ) { <nl> - ASSERT ( instr - > hydrogen ( ) - > need_generic ( ) ) ; <nl> + if ( map_count = = 0 & & instr - > hydrogen ( ) - > need_generic ( ) ) { <nl> __ Move ( rcx , instr - > hydrogen ( ) - > name ( ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > LoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> void LCodeGen : : DoLoadNamedFieldPolymorphic ( LLoadNamedFieldPolymorphic * instr ) { <nl> __ jmp ( & done , Label : : kNear ) ; <nl> __ bind ( & next ) ; <nl> } <nl> - Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> - __ Cmp ( FieldOperand ( object , HeapObject : : kMapOffset ) , map ) ; <nl> if ( instr - > hydrogen ( ) - > need_generic ( ) ) { <nl> - Label generic ; <nl> - __ j ( not_equal , & generic , Label : : kNear ) ; <nl> - EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> - __ jmp ( & done , Label : : kNear ) ; <nl> - __ bind ( & generic ) ; <nl> + if ( map_count ! = 0 ) { <nl> + Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> + __ Cmp ( FieldOperand ( object , HeapObject : : kMapOffset ) , map ) ; <nl> + Label generic ; <nl> + __ j ( not_equal , & generic , Label : : kNear ) ; <nl> + EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + __ jmp ( & done , Label : : kNear ) ; <nl> + __ bind ( & generic ) ; <nl> + } <nl> __ Move ( rcx , instr - > hydrogen ( ) - > name ( ) ) ; <nl> Handle < Code > ic = isolate ( ) - > builtins ( ) - > LoadIC_Initialize ( ) ; <nl> CallCode ( ic , RelocInfo : : CODE_TARGET , instr ) ; <nl> } else { <nl> - DeoptimizeIf ( not_equal , instr - > environment ( ) ) ; <nl> - EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + if ( map_count ! = 0 ) { <nl> + Handle < Map > map = instr - > hydrogen ( ) - > types ( ) - > last ( ) ; <nl> + __ Cmp ( FieldOperand ( object , HeapObject : : kMapOffset ) , map ) ; <nl> + DeoptimizeIf ( not_equal , instr - > environment ( ) ) ; <nl> + EmitLoadFieldOrConstantFunction ( result , object , map , name ) ; <nl> + } else { <nl> + DeoptimizeIf ( no_condition , instr - > environment ( ) ) ; <nl> + } <nl> } <nl> __ bind ( & done ) ; <nl> } <nl>
Fix compose - discard crasher from 11524 - port to x64 , ARM , MIPS .
v8/v8
f8bdbf1ce112003973cff03668ae5dfa648ac8ff
2012-05-10T21:25:49Z
mmm a / tensorflow / contrib / eager / python / examples / spinn / spinn_test . py <nl> ppp b / tensorflow / contrib / eager / python / examples / spinn / spinn_test . py <nl> def testInferSpinnWorks ( self ) : <nl> inference_sentences = ( " ( foo ( bar . ) ) " , " ( bar ( foo . ) ) " ) ) <nl> logits = spinn . train_or_infer_spinn ( <nl> embed , word2index , None , None , None , config ) <nl> - self . assertEqual ( np . float32 , logits . dtype ) <nl> + self . assertEqual ( tf . float32 , logits . dtype ) <nl> self . assertEqual ( ( 3 , ) , logits . shape ) <nl> <nl> def testInferSpinnThrowsErrorIfOnlyOneSentenceIsSpecified ( self ) : <nl> mmm a / third_party / examples / eager / spinn / README . md <nl> ppp b / third_party / examples / eager / spinn / README . md <nl> Other eager execution examples can be found under [ tensorflow / contrib / eager / pyth <nl> should all be separated by spaces . For instance , <nl> <nl> ` ` ` bash <nl> - pythons spinn . py - - data_root / tmp / spinn - data - - logdir / tmp / spinn - logs \ <nl> + python spinn . py - - data_root / tmp / spinn - data - - logdir / tmp / spinn - logs \ <nl> - - inference_premise ' ( ( The dog ) ( ( is running ) . ) ) ' \ <nl> - - inference_hypothesis ' ( ( The dog ) ( moves . ) ) ' <nl> ` ` ` <nl> Other eager execution examples can be found under [ tensorflow / contrib / eager / pyth <nl> By contrast , the following sentence pair : <nl> <nl> ` ` ` bash <nl> - pythons spinn . py - - data_root / tmp / spinn - data - - logdir / tmp / spinn - logs \ <nl> + python spinn . py - - data_root / tmp / spinn - data - - logdir / tmp / spinn - logs \ <nl> - - inference_premise ' ( ( The dog ) ( ( is running ) . ) ) ' \ <nl> - - inference_hypothesis ' ( ( The dog ) ( rests . ) ) ' <nl> ` ` ` <nl> mmm a / third_party / examples / eager / spinn / spinn . py <nl> ppp b / third_party / examples / eager / spinn / spinn . py <nl> <nl> import sys <nl> import time <nl> <nl> - import numpy as np <nl> from six . moves import xrange # pylint : disable = redefined - builtin <nl> import tensorflow as tf <nl> <nl> def train_or_infer_spinn ( embed , <nl> Returns : <nl> If ` config . inference_premise ` and ` config . inference_hypothesis ` are not <nl> ` None ` , i . e . , inference mode : the logits for the possible labels of the <nl> - SNLI data set , as numpy array of three floats . <nl> + SNLI data set , as a ` Tensor ` of three floats . <nl> else : <nl> The trainer object . <nl> Raises : <nl> def train_or_infer_spinn ( embed , <nl> inference_logits = model ( # pylint : disable = not - callable <nl> tf . constant ( prem ) , tf . constant ( prem_trans ) , <nl> tf . constant ( hypo ) , tf . constant ( hypo_trans ) , training = False ) <nl> - inference_logits = np . array ( inference_logits [ 0 ] [ 1 : ] ) <nl> - max_index = np . argmax ( inference_logits ) <nl> + inference_logits = inference_logits [ 0 ] [ 1 : ] <nl> + max_index = tf . argmax ( inference_logits ) <nl> print ( " \ nInference logits : " ) <nl> for i , ( label , logit ) in enumerate ( <nl> zip ( data . POSSIBLE_LABELS , inference_logits ) ) : <nl>
TFE SPINN example : use tensor instead of numpy array
tensorflow/tensorflow
98cf337e781977fd464c574656699b3181eddf19
2018-02-16T03:16:17Z
mmm a / imconfig . h <nl> ppp b / imconfig . h <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / COMPILE - TIME OPTIONS FOR DEAR IMGUI <nl> - / / Most options ( memory allocation , clipboard callbacks , etc . ) can be set at runtime via the ImGuiIO structure - ImGui : : GetIO ( ) . <nl> + / / Runtime options ( clipboard callbacks , enabling various features , etc . ) can generally be set via the ImGuiIO structure . <nl> + / / You can use ImGui : : SetAllocatorFunctions ( ) before calling ImGui : : CreateContext ( ) to rewire memory allocation functions . <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / A ) You may edit imconfig . h ( and not overwrite it when updating imgui , or maintain a patch / branch with your modifications to imconfig . h ) <nl> / / B ) or add configuration directives in your own file and compile with # define IMGUI_USER_CONFIG " myfilename . h " <nl> <nl> / / # define IMGUI_API __declspec ( dllexport ) <nl> / / # define IMGUI_API __declspec ( dllimport ) <nl> <nl> - / / mmm - Don ' t define obsolete functions names . Consider enabling from time to time or when updating to reduce likelihood of using already obsolete function / names <nl> + / / mmm - Don ' t define obsolete functions / enums names . Consider enabling from time to time after updating to avoid using soon - to - be obsolete function / names <nl> / / # define IMGUI_DISABLE_OBSOLETE_FUNCTIONS <nl> <nl> / / mmm - Don ' t implement default handlers for Windows ( so as not to link with certain functions ) <nl> <nl> / / # define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS / / Don ' t use and link with ImmGetContext / ImmSetCompositionWindow . <nl> <nl> / / mmm - Don ' t implement demo windows functionality ( ShowDemoWindow ( ) / ShowStyleEditor ( ) / ShowUserGuide ( ) methods will be empty ) <nl> - / / mmm - It is very strongly recommended to NOT disable the demo windows . Please read the comment at the top of imgui_demo . cpp . <nl> + / / mmm - It is very strongly recommended to NOT disable the demo windows during development . Please read the comments in imgui_demo . cpp . <nl> / / # define IMGUI_DISABLE_DEMO_WINDOWS <nl> <nl> / / mmm - Don ' t implement ImFormatString ( ) , ImFormatStringV ( ) so you can reimplement them yourself . <nl> <nl> operator MyVec4 ( ) const { return MyVec4 ( x , y , z , w ) ; } <nl> * / <nl> <nl> - / / mmm - Use 32 - bit vertex indices ( instead of default 16 - bit ) to allow meshes with more than 64K vertices . Render function needs to support it . <nl> + / / mmm - Use 32 - bit vertex indices ( default is 16 - bit ) to allow meshes with more than 64K vertices . Render function needs to support it . <nl> / / # define ImDrawIdx unsigned int <nl> <nl> / / mmm - Tip : You can add extra functions within the ImGui : : namespace , here or in your own headers files . <nl> mmm a / imgui . h <nl> ppp b / imgui . h <nl> <nl> <nl> # pragma once <nl> <nl> - / / User - editable configuration files ( edit stock imconfig . h or define IMGUI_USER_CONFIG to your own filename ) <nl> + / / Configuration file ( edit imconfig . h or define IMGUI_USER_CONFIG to set your own filename ) <nl> # ifdef IMGUI_USER_CONFIG <nl> # include IMGUI_USER_CONFIG <nl> # endif <nl> <nl> # endif <nl> <nl> / / Helpers <nl> - / / Some compilers support applying printf - style warnings to user functions . <nl> # if defined ( __clang__ ) | | defined ( __GNUC__ ) <nl> - # define IM_FMTARGS ( FMT ) __attribute__ ( ( format ( printf , FMT , FMT + 1 ) ) ) <nl> + # define IM_FMTARGS ( FMT ) __attribute__ ( ( format ( printf , FMT , FMT + 1 ) ) ) / / Apply printf - style warnings to user functions . <nl> # define IM_FMTLIST ( FMT ) __attribute__ ( ( format ( printf , FMT , 0 ) ) ) <nl> # else <nl> # define IM_FMTARGS ( FMT ) <nl> # define IM_FMTLIST ( FMT ) <nl> # endif <nl> - # define IM_ARRAYSIZE ( _ARR ) ( ( int ) ( sizeof ( _ARR ) / sizeof ( * _ARR ) ) ) <nl> - # define IM_OFFSETOF ( _TYPE , _MEMBER ) ( ( size_t ) & ( ( ( _TYPE * ) 0 ) - > _MEMBER ) ) / / Offset of _MEMBER within _TYPE . Standardized as offsetof ( ) in modern C + + . <nl> + # define IM_ARRAYSIZE ( _ARR ) ( ( int ) ( sizeof ( _ARR ) / sizeof ( * _ARR ) ) ) / / Size of a static C - style array . Don ' t use on pointers ! <nl> + # define IM_OFFSETOF ( _TYPE , _MEMBER ) ( ( size_t ) & ( ( ( _TYPE * ) 0 ) - > _MEMBER ) ) / / Offset of _MEMBER within _TYPE . Standardized as offsetof ( ) in modern C + + . <nl> <nl> # if defined ( __clang__ ) <nl> # pragma clang diagnostic push <nl> struct ImGuiPayload ; / / User data payload for drag and drop opera <nl> struct ImGuiContext ; / / ImGui context ( opaque ) <nl> <nl> # ifndef ImTextureID <nl> - typedef void * ImTextureID ; / / user data to identify a texture ( this is whatever to you want it to be ! read the FAQ about ImTextureID in imgui . cpp ) <nl> + typedef void * ImTextureID ; / / User data to identify a texture ( this is whatever to you want it to be ! read the FAQ about ImTextureID in imgui . cpp ) <nl> # endif <nl> <nl> / / Typedefs and Enumerations ( declared as int for compatibility with old C + + and to not pollute the top of this file ) <nl> typedef unsigned int ImU32 ; / / 32 - bit unsigned integer ( typically used to store packed colors ) <nl> - typedef unsigned int ImGuiID ; / / unique ID used by widgets ( typically hashed from a stack of string ) <nl> - typedef unsigned short ImWchar ; / / character for keyboard input / display <nl> + typedef unsigned int ImGuiID ; / / Unique ID used by widgets ( typically hashed from a stack of string ) <nl> + typedef unsigned short ImWchar ; / / Character for keyboard input / display <nl> typedef int ImGuiCol ; / / enum : a color identifier for styling / / enum ImGuiCol_ <nl> typedef int ImGuiDir ; / / enum : a cardinal direction / / enum ImGuiDir_ <nl> typedef int ImGuiCond ; / / enum : a condition for Set * ( ) / / enum ImGuiCond_ <nl> struct ImVec2 <nl> float x , y ; <nl> ImVec2 ( ) { x = y = 0 . 0f ; } <nl> ImVec2 ( float _x , float _y ) { x = _x ; y = _y ; } <nl> - float operator [ ] ( size_t idx ) const { IM_ASSERT ( idx < = 1 ) ; return ( & x ) [ idx ] ; } / / We very rarely use this [ ] operator , thus an assert is fine . <nl> + float operator [ ] ( size_t idx ) const { IM_ASSERT ( idx < = 1 ) ; return ( & x ) [ idx ] ; } / / We very rarely use this [ ] operator , the assert overhead is fine . <nl> # ifdef IM_VEC2_CLASS_EXTRA / / Define constructor and implicit cast operators in imconfig . h to convert back < > forth from your math types and ImVec2 . <nl> IM_VEC2_CLASS_EXTRA <nl> # endif <nl> struct ImVec4 <nl> / / In a namespace so that user can add extra functions in a separate file ( e . g . Value ( ) helpers for your vector or common types ) <nl> namespace ImGui <nl> { <nl> - / / Context creation and access , if you want to use multiple context , share context between modules ( e . g . DLL ) . <nl> + / / Context creation and access <nl> / / All contexts share a same ImFontAtlas by default . If you want different font atlas , you can new ( ) them and overwrite the GetIO ( ) . Fonts variable of an ImGui context . <nl> / / All those functions are not reliant on the current context . <nl> IMGUI_API ImGuiContext * CreateContext ( ImFontAtlas * shared_font_atlas = NULL ) ; <nl> - IMGUI_API void DestroyContext ( ImGuiContext * ctx = NULL ) ; / / NULL = Destroy current context <nl> + IMGUI_API void DestroyContext ( ImGuiContext * ctx = NULL ) ; / / NULL = destroy current context <nl> IMGUI_API ImGuiContext * GetCurrentContext ( ) ; <nl> IMGUI_API void SetCurrentContext ( ImGuiContext * ctx ) ; <nl> <nl> namespace ImGui <nl> IMGUI_API ImDrawData * GetDrawData ( ) ; / / valid after Render ( ) and until the next call to NewFrame ( ) . this is what you have to render . ( Obsolete : this used to be passed to your io . RenderDrawListsFn ( ) function . ) <nl> IMGUI_API void EndFrame ( ) ; / / ends the ImGui frame . automatically called by Render ( ) , so most likely don ' t need to ever call that yourself directly . If you don ' t need to render you may call EndFrame ( ) but you ' ll have wasted CPU already . If you don ' t need to render , better to not create any imgui windows instead ! <nl> <nl> - / / Demo , Debug , Informations <nl> + / / Demo , Debug , Information <nl> IMGUI_API void ShowDemoWindow ( bool * p_open = NULL ) ; / / create demo / test window ( previously called ShowTestWindow ) . demonstrate most ImGui features . call this to learn about the library ! try to make it always available in your application ! <nl> IMGUI_API void ShowMetricsWindow ( bool * p_open = NULL ) ; / / create metrics window . display ImGui internals : draw commands ( with individual draw calls and vertices ) , window list , basic internal state , etc . <nl> IMGUI_API void ShowStyleEditor ( ImGuiStyle * ref = NULL ) ; / / add style editor block ( not a window ) . you can pass in a reference ImGuiStyle structure to compare to , revert to and save to ( else it uses the default style ) <nl> - IMGUI_API bool ShowStyleSelector ( const char * label ) ; <nl> - IMGUI_API void ShowFontSelector ( const char * label ) ; <nl> + IMGUI_API bool ShowStyleSelector ( const char * label ) ; / / add style selector block ( not a window ) , essentially a combo listing the default styles . <nl> + IMGUI_API void ShowFontSelector ( const char * label ) ; / / add font selector block ( not a window ) , essentially a combo listing the loaded fonts . <nl> IMGUI_API void ShowUserGuide ( ) ; / / add basic help / info block ( not a window ) : how to manipulate ImGui as a end - user ( mouse / keyboard controls ) . <nl> - IMGUI_API const char * GetVersion ( ) ; <nl> + IMGUI_API const char * GetVersion ( ) ; / / get a version string e . g . " 1 . 23 " <nl> <nl> / / Styles <nl> - IMGUI_API void StyleColorsDark ( ImGuiStyle * dst = NULL ) ; / / New , recommended style <nl> - IMGUI_API void StyleColorsClassic ( ImGuiStyle * dst = NULL ) ; / / Classic imgui style ( default ) <nl> - IMGUI_API void StyleColorsLight ( ImGuiStyle * dst = NULL ) ; / / Best used with borders and a custom , thicker font <nl> - <nl> - / / Window <nl> - IMGUI_API bool Begin ( const char * name , bool * p_open = NULL , ImGuiWindowFlags flags = 0 ) ; / / push window to the stack and start appending to it . see . cpp for details . return false when window is collapsed ( so you can early out in your code ) but you always need to call End ( ) regardless . ' bool * p_open ' creates a widget on the upper - right to close the window ( which sets your bool to false ) . <nl> - IMGUI_API void End ( ) ; / / always call even if Begin ( ) return false ( which indicates a collapsed window ) ! finish appending to current window , pop it off the window stack . <nl> - IMGUI_API bool BeginChild ( const char * str_id , const ImVec2 & size = ImVec2 ( 0 , 0 ) , bool border = false , ImGuiWindowFlags flags = 0 ) ; / / begin a scrolling region . size = = 0 . 0f : use remaining window size , size < 0 . 0f : use remaining window size minus abs ( size ) . size > 0 . 0f : fixed size . each axis can use a different mode , e . g . ImVec2 ( 0 , 400 ) . <nl> - IMGUI_API bool BeginChild ( ImGuiID id , const ImVec2 & size = ImVec2 ( 0 , 0 ) , bool border = false , ImGuiWindowFlags flags = 0 ) ; / / " <nl> - IMGUI_API void EndChild ( ) ; / / always call even if BeginChild ( ) return false ( which indicates a collapsed or clipping child window ) <nl> - IMGUI_API ImVec2 GetContentRegionMax ( ) ; / / current content boundaries ( typically window boundaries including scrolling , or current column boundaries ) , in windows coordinates <nl> - IMGUI_API ImVec2 GetContentRegionAvail ( ) ; / / = = GetContentRegionMax ( ) - GetCursorPos ( ) <nl> - IMGUI_API float GetContentRegionAvailWidth ( ) ; / / <nl> - IMGUI_API ImVec2 GetWindowContentRegionMin ( ) ; / / content boundaries min ( roughly ( 0 , 0 ) - Scroll ) , in window coordinates <nl> - IMGUI_API ImVec2 GetWindowContentRegionMax ( ) ; / / content boundaries max ( roughly ( 0 , 0 ) + Size - Scroll ) where Size can be override with SetNextWindowContentSize ( ) , in window coordinates <nl> - IMGUI_API float GetWindowContentRegionWidth ( ) ; / / <nl> - IMGUI_API ImDrawList * GetWindowDrawList ( ) ; / / get rendering command - list if you want to append your own draw primitives <nl> - IMGUI_API ImVec2 GetWindowPos ( ) ; / / get current window position in screen space ( useful if you want to do your own drawing via the DrawList api ) <nl> - IMGUI_API ImVec2 GetWindowSize ( ) ; / / get current window size <nl> - IMGUI_API float GetWindowWidth ( ) ; <nl> - IMGUI_API float GetWindowHeight ( ) ; <nl> - IMGUI_API bool IsWindowCollapsed ( ) ; <nl> + IMGUI_API void StyleColorsDark ( ImGuiStyle * dst = NULL ) ; / / new , recommended style <nl> + IMGUI_API void StyleColorsClassic ( ImGuiStyle * dst = NULL ) ; / / old , classic imgui style ( default ) <nl> + IMGUI_API void StyleColorsLight ( ImGuiStyle * dst = NULL ) ; / / best used with borders and a custom , thicker font <nl> + <nl> + / / Windows <nl> + / / ( Begin = push window to the stack and start appending to it . End = pop window from the stack . You may append multiple times to the same window during the same frame ) <nl> + / / Begin ( ) / BeginChild ( ) return false to indicate the window being collapsed or fully clipped , so you may early out and omit submitting anything to the window . <nl> + / / However you need to always call a matching End ( ) / EndChild ( ) for a Begin ( ) / BeginChild ( ) call , regardless of its return value ( this is due to legacy reason and is inconsistent with BeginMenu / EndMenu , BeginPopup / EndPopup and other functions where the End call should only be called if the corresponding Begin function returned true . ) <nl> + / / Passing ' bool * p_open ! = NULL ' shows a close widget in the upper - right corner of the window , which when clicking will set the boolean to false . <nl> + / / Use child windows to introduce independent scrolling / clipping regions within a host window . Child windows can embed their own child . <nl> + IMGUI_API bool Begin ( const char * name , bool * p_open = NULL , ImGuiWindowFlags flags = 0 ) ; <nl> + IMGUI_API void End ( ) ; <nl> + IMGUI_API bool BeginChild ( const char * str_id , const ImVec2 & size = ImVec2 ( 0 , 0 ) , bool border = false , ImGuiWindowFlags flags = 0 ) ; / / Begin a scrolling region . size = = 0 . 0f : use remaining window size , size < 0 . 0f : use remaining window size minus abs ( size ) . size > 0 . 0f : fixed size . each axis can use a different mode , e . g . ImVec2 ( 0 , 400 ) . <nl> + IMGUI_API bool BeginChild ( ImGuiID id , const ImVec2 & size = ImVec2 ( 0 , 0 ) , bool border = false , ImGuiWindowFlags flags = 0 ) ; <nl> + IMGUI_API void EndChild ( ) ; <nl> + <nl> + / / Windows Utilities <nl> IMGUI_API bool IsWindowAppearing ( ) ; <nl> - IMGUI_API void SetWindowFontScale ( float scale ) ; / / per - window font scale . Adjust IO . FontGlobalScale if you want to scale all windows <nl> + IMGUI_API bool IsWindowCollapsed ( ) ; <nl> + IMGUI_API bool IsWindowFocused ( ImGuiFocusedFlags flags = 0 ) ; / / is current window focused ? or its root / child , depending on flags . see flags for options . <nl> + IMGUI_API bool IsWindowHovered ( ImGuiHoveredFlags flags = 0 ) ; / / is current window hovered ( and typically : not blocked by a popup / modal ) ? see flags for options . NB : If you are trying to check whether your mouse should be dispatched to imgui or to your app , you should use the ' io . WantCaptureMouse ' boolean for that ! Please read the FAQ ! <nl> + IMGUI_API ImDrawList * GetWindowDrawList ( ) ; / / get draw list associated to the window , to append your own drawing primitives <nl> + IMGUI_API ImVec2 GetWindowPos ( ) ; / / get current window position in screen space ( useful if you want to do your own drawing via the DrawList API ) <nl> + IMGUI_API ImVec2 GetWindowSize ( ) ; / / get current window size <nl> + IMGUI_API float GetWindowWidth ( ) ; / / get current window width ( shortcut for GetWindowSize ( ) . x ) <nl> + IMGUI_API float GetWindowHeight ( ) ; / / get current window height ( shortcut for GetWindowSize ( ) . y ) <nl> + IMGUI_API ImVec2 GetContentRegionMax ( ) ; / / current content boundaries ( typically window boundaries including scrolling , or current column boundaries ) , in windows coordinates <nl> + IMGUI_API ImVec2 GetContentRegionAvail ( ) ; / / = = GetContentRegionMax ( ) - GetCursorPos ( ) <nl> + IMGUI_API float GetContentRegionAvailWidth ( ) ; / / <nl> + IMGUI_API ImVec2 GetWindowContentRegionMin ( ) ; / / content boundaries min ( roughly ( 0 , 0 ) - Scroll ) , in window coordinates <nl> + IMGUI_API ImVec2 GetWindowContentRegionMax ( ) ; / / content boundaries max ( roughly ( 0 , 0 ) + Size - Scroll ) where Size can be override with SetNextWindowContentSize ( ) , in window coordinates <nl> + IMGUI_API float GetWindowContentRegionWidth ( ) ; / / <nl> <nl> IMGUI_API void SetNextWindowPos ( const ImVec2 & pos , ImGuiCond cond = 0 , const ImVec2 & pivot = ImVec2 ( 0 , 0 ) ) ; / / set next window position . call before Begin ( ) . use pivot = ( 0 . 5f , 0 . 5f ) to center on given point , etc . <nl> IMGUI_API void SetNextWindowSize ( const ImVec2 & size , ImGuiCond cond = 0 ) ; / / set next window size . set axis to 0 . 0f to force an auto - fit on this axis . call before Begin ( ) <nl> namespace ImGui <nl> IMGUI_API void SetWindowSize ( const ImVec2 & size , ImGuiCond cond = 0 ) ; / / ( not recommended ) set current window size - call within Begin ( ) / End ( ) . set to ImVec2 ( 0 , 0 ) to force an auto - fit . prefer using SetNextWindowSize ( ) , as this may incur tearing and minor side - effects . <nl> IMGUI_API void SetWindowCollapsed ( bool collapsed , ImGuiCond cond = 0 ) ; / / ( not recommended ) set current window collapsed state . prefer using SetNextWindowCollapsed ( ) . <nl> IMGUI_API void SetWindowFocus ( ) ; / / ( not recommended ) set current window to be focused / front - most . prefer using SetNextWindowFocus ( ) . <nl> + IMGUI_API void SetWindowFontScale ( float scale ) ; / / set font scale . Adjust IO . FontGlobalScale if you want to scale all windows <nl> IMGUI_API void SetWindowPos ( const char * name , const ImVec2 & pos , ImGuiCond cond = 0 ) ; / / set named window position . <nl> IMGUI_API void SetWindowSize ( const char * name , const ImVec2 & size , ImGuiCond cond = 0 ) ; / / set named window size . set axis to 0 . 0f to force an auto - fit on this axis . <nl> IMGUI_API void SetWindowCollapsed ( const char * name , bool collapsed , ImGuiCond cond = 0 ) ; / / set named window collapsed state <nl> IMGUI_API void SetWindowFocus ( const char * name ) ; / / set named window to be focused / front - most . use NULL to remove focus . <nl> <nl> - IMGUI_API float GetScrollX ( ) ; / / get scrolling amount [ 0 . . GetScrollMaxX ( ) ] <nl> - IMGUI_API float GetScrollY ( ) ; / / get scrolling amount [ 0 . . GetScrollMaxY ( ) ] <nl> - IMGUI_API float GetScrollMaxX ( ) ; / / get maximum scrolling amount ~ ~ ContentSize . X - WindowSize . X <nl> - IMGUI_API float GetScrollMaxY ( ) ; / / get maximum scrolling amount ~ ~ ContentSize . Y - WindowSize . Y <nl> - IMGUI_API void SetScrollX ( float scroll_x ) ; / / set scrolling amount [ 0 . . GetScrollMaxX ( ) ] <nl> - IMGUI_API void SetScrollY ( float scroll_y ) ; / / set scrolling amount [ 0 . . GetScrollMaxY ( ) ] <nl> - IMGUI_API void SetScrollHere ( float center_y_ratio = 0 . 5f ) ; / / adjust scrolling amount to make current cursor position visible . center_y_ratio = 0 . 0 : top , 0 . 5 : center , 1 . 0 : bottom . When using to make a " default / current item " visible , consider using SetItemDefaultFocus ( ) instead . <nl> - IMGUI_API void SetScrollFromPosY ( float pos_y , float center_y_ratio = 0 . 5f ) ; / / adjust scrolling amount to make given position valid . use GetCursorPos ( ) or GetCursorStartPos ( ) + offset to get valid positions . <nl> - IMGUI_API void SetStateStorage ( ImGuiStorage * tree ) ; / / replace tree state storage with our own ( if you want to manipulate it yourself , typically clear subsection of it ) <nl> - IMGUI_API ImGuiStorage * GetStateStorage ( ) ; <nl> + / / Windows Scrolling <nl> + IMGUI_API float GetScrollX ( ) ; / / get scrolling amount [ 0 . . GetScrollMaxX ( ) ] <nl> + IMGUI_API float GetScrollY ( ) ; / / get scrolling amount [ 0 . . GetScrollMaxY ( ) ] <nl> + IMGUI_API float GetScrollMaxX ( ) ; / / get maximum scrolling amount ~ ~ ContentSize . X - WindowSize . X <nl> + IMGUI_API float GetScrollMaxY ( ) ; / / get maximum scrolling amount ~ ~ ContentSize . Y - WindowSize . Y <nl> + IMGUI_API void SetScrollX ( float scroll_x ) ; / / set scrolling amount [ 0 . . GetScrollMaxX ( ) ] <nl> + IMGUI_API void SetScrollY ( float scroll_y ) ; / / set scrolling amount [ 0 . . GetScrollMaxY ( ) ] <nl> + IMGUI_API void SetScrollHere ( float center_y_ratio = 0 . 5f ) ; / / adjust scrolling amount to make current cursor position visible . center_y_ratio = 0 . 0 : top , 0 . 5 : center , 1 . 0 : bottom . When using to make a " default / current item " visible , consider using SetItemDefaultFocus ( ) instead . <nl> + IMGUI_API void SetScrollFromPosY ( float pos_y , float center_y_ratio = 0 . 5f ) ; / / adjust scrolling amount to make given position valid . use GetCursorPos ( ) or GetCursorStartPos ( ) + offset to get valid positions . <nl> <nl> / / Parameters stacks ( shared ) <nl> - IMGUI_API void PushFont ( ImFont * font ) ; / / use NULL as a shortcut to push default font <nl> + IMGUI_API void PushFont ( ImFont * font ) ; / / use NULL as a shortcut to push default font <nl> IMGUI_API void PopFont ( ) ; <nl> IMGUI_API void PushStyleColor ( ImGuiCol idx , ImU32 col ) ; <nl> IMGUI_API void PushStyleColor ( ImGuiCol idx , const ImVec4 & col ) ; <nl> namespace ImGui <nl> IMGUI_API float GetFrameHeight ( ) ; / / ~ FontSize + style . FramePadding . y * 2 <nl> IMGUI_API float GetFrameHeightWithSpacing ( ) ; / / ~ FontSize + style . FramePadding . y * 2 + style . ItemSpacing . y ( distance in pixels between 2 consecutive lines of framed widgets ) <nl> <nl> - / / ID scopes <nl> - / / If you are creating widgets in a loop you most likely want to push a unique identifier ( e . g . object pointer , loop index ) so ImGui can differentiate them . <nl> - / / You can also use the " # # foobar " syntax within widget label to distinguish them from each others . Read " A primer on the use of labels / IDs " in the FAQ for more details . <nl> - IMGUI_API void PushID ( const char * str_id ) ; / / push identifier into the ID stack . IDs are hash of the entire stack ! <nl> + / / ID stack / scopes <nl> + / / Read the FAQ for more details about how ID are handled in dear imgui . If you are creating widgets in a loop you most <nl> + / / likely want to push a unique identifier ( e . g . object pointer , loop index ) to uniquely differentiate them . <nl> + / / You can also use the " # # foobar " syntax within widget label to distinguish them from each others . <nl> + / / In this header file we use the " label " / " name " terminology to denote a string that will be displayed and used as an ID , <nl> + / / whereas " str_id " denote a string that is only used as an ID and not aimed to be displayed . <nl> + IMGUI_API void PushID ( const char * str_id ) ; / / push identifier into the ID stack . IDs are hash of the entire stack ! <nl> IMGUI_API void PushID ( const char * str_id_begin , const char * str_id_end ) ; <nl> IMGUI_API void PushID ( const void * ptr_id ) ; <nl> IMGUI_API void PushID ( int int_id ) ; <nl> IMGUI_API void PopID ( ) ; <nl> - IMGUI_API ImGuiID GetID ( const char * str_id ) ; / / calculate unique ID ( hash of whole ID stack + given parameter ) . e . g . if you want to query into ImGuiStorage yourself <nl> + IMGUI_API ImGuiID GetID ( const char * str_id ) ; / / calculate unique ID ( hash of whole ID stack + given parameter ) . e . g . if you want to query into ImGuiStorage yourself <nl> IMGUI_API ImGuiID GetID ( const char * str_id_begin , const char * str_id_end ) ; <nl> IMGUI_API ImGuiID GetID ( const void * ptr_id ) ; <nl> <nl> namespace ImGui <nl> IMGUI_API void BulletTextV ( const char * fmt , va_list args ) IM_FMTLIST ( 1 ) ; <nl> <nl> / / Widgets : Main <nl> - IMGUI_API bool Button ( const char * label , const ImVec2 & size = ImVec2 ( 0 , 0 ) ) ; / / button <nl> - IMGUI_API bool SmallButton ( const char * label ) ; / / button with FramePadding = ( 0 , 0 ) to easily embed within text <nl> + IMGUI_API bool Button ( const char * label , const ImVec2 & size = ImVec2 ( 0 , 0 ) ) ; / / button <nl> + IMGUI_API bool SmallButton ( const char * label ) ; / / button with FramePadding = ( 0 , 0 ) to easily embed within text <nl> IMGUI_API bool ArrowButton ( const char * str_id , ImGuiDir dir ) ; <nl> - IMGUI_API bool InvisibleButton ( const char * str_id , const ImVec2 & size ) ; / / button behavior without the visuals , useful to build custom behaviors using the public api ( along with IsItemActive , IsItemHovered , etc . ) <nl> + IMGUI_API bool InvisibleButton ( const char * str_id , const ImVec2 & size ) ; / / button behavior without the visuals , useful to build custom behaviors using the public api ( along with IsItemActive , IsItemHovered , etc . ) <nl> IMGUI_API void Image ( ImTextureID user_texture_id , const ImVec2 & size , const ImVec2 & uv0 = ImVec2 ( 0 , 0 ) , const ImVec2 & uv1 = ImVec2 ( 1 , 1 ) , const ImVec4 & tint_col = ImVec4 ( 1 , 1 , 1 , 1 ) , const ImVec4 & border_col = ImVec4 ( 0 , 0 , 0 , 0 ) ) ; <nl> IMGUI_API bool ImageButton ( ImTextureID user_texture_id , const ImVec2 & size , const ImVec2 & uv0 = ImVec2 ( 0 , 0 ) , const ImVec2 & uv1 = ImVec2 ( 1 , 1 ) , int frame_padding = - 1 , const ImVec4 & bg_col = ImVec4 ( 0 , 0 , 0 , 0 ) , const ImVec4 & tint_col = ImVec4 ( 1 , 1 , 1 , 1 ) ) ; / / < 0 frame_padding uses default frame padding settings . 0 for no padding <nl> IMGUI_API bool Checkbox ( const char * label , bool * v ) ; <nl> namespace ImGui <nl> IMGUI_API void PlotHistogram ( const char * label , const float * values , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) , int stride = sizeof ( float ) ) ; <nl> IMGUI_API void PlotHistogram ( const char * label , float ( * values_getter ) ( void * data , int idx ) , void * data , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) ) ; <nl> IMGUI_API void ProgressBar ( float fraction , const ImVec2 & size_arg = ImVec2 ( - 1 , 0 ) , const char * overlay = NULL ) ; <nl> + IMGUI_API void Bullet ( ) ; / / draw a small circle and keep the cursor on the same line . advance cursor x position by GetTreeNodeToLabelSpacing ( ) , same distance that TreeNode ( ) uses <nl> <nl> / / Widgets : Combo Box <nl> / / The new BeginCombo ( ) / EndCombo ( ) api allows you to manage your contents and selection state however you want it . <nl> namespace ImGui <nl> IMGUI_API bool ColorPicker3 ( const char * label , float col [ 3 ] , ImGuiColorEditFlags flags = 0 ) ; <nl> IMGUI_API bool ColorPicker4 ( const char * label , float col [ 4 ] , ImGuiColorEditFlags flags = 0 , const float * ref_col = NULL ) ; <nl> IMGUI_API bool ColorButton ( const char * desc_id , const ImVec4 & col , ImGuiColorEditFlags flags = 0 , ImVec2 size = ImVec2 ( 0 , 0 ) ) ; / / display a colored square / button , hover for details , return true when pressed . <nl> - IMGUI_API void SetColorEditOptions ( ImGuiColorEditFlags flags ) ; / / initialize current options ( generally on application startup ) if you want to select a default format , picker type , etc . User will be able to change many settings , unless you pass the _NoOptions flag to your calls . <nl> + IMGUI_API void SetColorEditOptions ( ImGuiColorEditFlags flags ) ; / / initialize current options ( generally on application startup ) if you want to select a default format , picker type , etc . User will be able to change many settings , unless you pass the _NoOptions flag to your calls . <nl> <nl> / / Widgets : Trees <nl> - IMGUI_API bool TreeNode ( const char * label ) ; / / if returning ' true ' the node is open and the tree id is pushed into the id stack . user is responsible for calling TreePop ( ) . <nl> - IMGUI_API bool TreeNode ( const char * str_id , const char * fmt , . . . ) IM_FMTARGS ( 2 ) ; / / read the FAQ about why and how to use ID . to align arbitrary text at the same level as a TreeNode ( ) you can use Bullet ( ) . <nl> - IMGUI_API bool TreeNode ( const void * ptr_id , const char * fmt , . . . ) IM_FMTARGS ( 2 ) ; / / " <nl> + IMGUI_API bool TreeNode ( const char * label ) ; / / if returning ' true ' the node is open and the tree id is pushed into the id stack . user is responsible for calling TreePop ( ) . <nl> + IMGUI_API bool TreeNode ( const char * str_id , const char * fmt , . . . ) IM_FMTARGS ( 2 ) ; / / read the FAQ about why and how to use ID . to align arbitrary text at the same level as a TreeNode ( ) you can use Bullet ( ) . <nl> + IMGUI_API bool TreeNode ( const void * ptr_id , const char * fmt , . . . ) IM_FMTARGS ( 2 ) ; / / " <nl> IMGUI_API bool TreeNodeV ( const char * str_id , const char * fmt , va_list args ) IM_FMTLIST ( 2 ) ; <nl> IMGUI_API bool TreeNodeV ( const void * ptr_id , const char * fmt , va_list args ) IM_FMTLIST ( 2 ) ; <nl> IMGUI_API bool TreeNodeEx ( const char * label , ImGuiTreeNodeFlags flags = 0 ) ; <nl> namespace ImGui <nl> IMGUI_API bool TreeNodeEx ( const void * ptr_id , ImGuiTreeNodeFlags flags , const char * fmt , . . . ) IM_FMTARGS ( 3 ) ; <nl> IMGUI_API bool TreeNodeExV ( const char * str_id , ImGuiTreeNodeFlags flags , const char * fmt , va_list args ) IM_FMTLIST ( 3 ) ; <nl> IMGUI_API bool TreeNodeExV ( const void * ptr_id , ImGuiTreeNodeFlags flags , const char * fmt , va_list args ) IM_FMTLIST ( 3 ) ; <nl> - IMGUI_API void TreePush ( const char * str_id ) ; / / ~ Indent ( ) + PushId ( ) . Already called by TreeNode ( ) when returning true , but you can call Push / Pop yourself for layout purpose <nl> - IMGUI_API void TreePush ( const void * ptr_id = NULL ) ; / / " <nl> - IMGUI_API void TreePop ( ) ; / / ~ Unindent ( ) + PopId ( ) <nl> - IMGUI_API void TreeAdvanceToLabelPos ( ) ; / / advance cursor x position by GetTreeNodeToLabelSpacing ( ) <nl> - IMGUI_API float GetTreeNodeToLabelSpacing ( ) ; / / horizontal distance preceding label when using TreeNode * ( ) or Bullet ( ) = = ( g . FontSize + style . FramePadding . x * 2 ) for a regular unframed TreeNode <nl> - IMGUI_API void SetNextTreeNodeOpen ( bool is_open , ImGuiCond cond = 0 ) ; / / set next TreeNode / CollapsingHeader open state . <nl> - IMGUI_API bool CollapsingHeader ( const char * label , ImGuiTreeNodeFlags flags = 0 ) ; / / if returning ' true ' the header is open . doesn ' t indent nor push on ID stack . user doesn ' t have to call TreePop ( ) . <nl> + IMGUI_API void TreePush ( const char * str_id ) ; / / ~ Indent ( ) + PushId ( ) . Already called by TreeNode ( ) when returning true , but you can call Push / Pop yourself for layout purpose <nl> + IMGUI_API void TreePush ( const void * ptr_id = NULL ) ; / / " <nl> + IMGUI_API void TreePop ( ) ; / / ~ Unindent ( ) + PopId ( ) <nl> + IMGUI_API void TreeAdvanceToLabelPos ( ) ; / / advance cursor x position by GetTreeNodeToLabelSpacing ( ) <nl> + IMGUI_API float GetTreeNodeToLabelSpacing ( ) ; / / horizontal distance preceding label when using TreeNode * ( ) or Bullet ( ) = = ( g . FontSize + style . FramePadding . x * 2 ) for a regular unframed TreeNode <nl> + IMGUI_API void SetNextTreeNodeOpen ( bool is_open , ImGuiCond cond = 0 ) ; / / set next TreeNode / CollapsingHeader open state . <nl> + IMGUI_API bool CollapsingHeader ( const char * label , ImGuiTreeNodeFlags flags = 0 ) ; / / if returning ' true ' the header is open . doesn ' t indent nor push on ID stack . user doesn ' t have to call TreePop ( ) . <nl> IMGUI_API bool CollapsingHeader ( const char * label , bool * p_open , ImGuiTreeNodeFlags flags = 0 ) ; / / when ' p_open ' isn ' t NULL , display an additional small close button on upper right of the header <nl> <nl> / / Widgets : Selectable / Lists <nl> namespace ImGui <nl> IMGUI_API bool Selectable ( const char * label , bool * p_selected , ImGuiSelectableFlags flags = 0 , const ImVec2 & size = ImVec2 ( 0 , 0 ) ) ; / / " bool * p_selected " point to the selection state ( read - write ) , as a convenient helper . <nl> IMGUI_API bool ListBox ( const char * label , int * current_item , const char * const items [ ] , int items_count , int height_in_items = - 1 ) ; <nl> IMGUI_API bool ListBox ( const char * label , int * current_item , bool ( * items_getter ) ( void * data , int idx , const char * * out_text ) , void * data , int items_count , int height_in_items = - 1 ) ; <nl> - IMGUI_API bool ListBoxHeader ( const char * label , const ImVec2 & size = ImVec2 ( 0 , 0 ) ) ; / / use if you want to reimplement ListBox ( ) will custom data or interactions . make sure to call ListBoxFooter ( ) afterwards . <nl> + IMGUI_API bool ListBoxHeader ( const char * label , const ImVec2 & size = ImVec2 ( 0 , 0 ) ) ; / / use if you want to reimplement ListBox ( ) will custom data or interactions . make sure to call ListBoxFooter ( ) afterwards . <nl> IMGUI_API bool ListBoxHeader ( const char * label , int items_count , int height_in_items = - 1 ) ; / / " <nl> - IMGUI_API void ListBoxFooter ( ) ; / / terminate the scrolling region <nl> + IMGUI_API void ListBoxFooter ( ) ; / / terminate the scrolling region <nl> <nl> / / Widgets : Value ( ) Helpers . Output single value in " name : value " format ( tip : freely declare more in your code to handle your types . you can add functions to the ImGui namespace ) <nl> IMGUI_API void Value ( const char * prefix , bool b ) ; <nl> namespace ImGui <nl> IMGUI_API bool BeginMenuBar ( ) ; / / append to menu - bar of current window ( requires ImGuiWindowFlags_MenuBar flag set on parent window ) . <nl> IMGUI_API void EndMenuBar ( ) ; / / only call EndMenuBar ( ) if BeginMenuBar ( ) returns true ! <nl> IMGUI_API bool BeginMenu ( const char * label , bool enabled = true ) ; / / create a sub - menu entry . only call EndMenu ( ) if this returns true ! <nl> - IMGUI_API void EndMenu ( ) ; / / only call EndBegin ( ) if BeginMenu ( ) returns true ! <nl> + IMGUI_API void EndMenu ( ) ; / / only call EndMenu ( ) if BeginMenu ( ) returns true ! <nl> IMGUI_API bool MenuItem ( const char * label , const char * shortcut = NULL , bool selected = false , bool enabled = true ) ; / / return true when activated . shortcuts are displayed for convenience but not processed by ImGui at the moment <nl> IMGUI_API bool MenuItem ( const char * label , const char * shortcut , bool * p_selected , bool enabled = true ) ; / / return true when activated + toggle ( * p_selected ) if p_selected ! = NULL <nl> <nl> namespace ImGui <nl> IMGUI_API ImVec2 GetItemRectMax ( ) ; / / " <nl> IMGUI_API ImVec2 GetItemRectSize ( ) ; / / get size of last item , in screen space <nl> IMGUI_API void SetItemAllowOverlap ( ) ; / / allow last item to be overlapped by a subsequent item . sometimes useful with invisible buttons , selectables , etc . to catch unused area . <nl> - IMGUI_API bool IsWindowFocused ( ImGuiFocusedFlags flags = 0 ) ; / / is current window focused ? or its root / child , depending on flags . see flags for options . <nl> - IMGUI_API bool IsWindowHovered ( ImGuiHoveredFlags flags = 0 ) ; / / is current window hovered ( and typically : not blocked by a popup / modal ) ? see flags for options . NB : If you are trying to check whether your mouse should be dispatched to imgui or to your app , you should use the ' io . WantCaptureMouse ' boolean for that ! Please read the FAQ ! <nl> IMGUI_API bool IsRectVisible ( const ImVec2 & size ) ; / / test if rectangle ( of given size , starting from cursor position ) is visible / not clipped . <nl> IMGUI_API bool IsRectVisible ( const ImVec2 & rect_min , const ImVec2 & rect_max ) ; / / test if rectangle ( in screen space ) is visible / not clipped . to perform coarse clipping on user ' s side . <nl> IMGUI_API float GetTime ( ) ; <nl> IMGUI_API int GetFrameCount ( ) ; <nl> IMGUI_API ImDrawList * GetOverlayDrawList ( ) ; / / this draw list will be the last rendered one , useful to quickly draw overlays shapes / text <nl> - IMGUI_API ImDrawListSharedData * GetDrawListSharedData ( ) ; <nl> + IMGUI_API ImDrawListSharedData * GetDrawListSharedData ( ) ; / / you may use this when creating your own ImDrawList instances <nl> IMGUI_API const char * GetStyleColorName ( ImGuiCol idx ) ; <nl> + IMGUI_API void SetStateStorage ( ImGuiStorage * storage ) ; / / replace current window storage with our own ( if you want to manipulate it yourself , typically clear subsection of it ) <nl> + IMGUI_API ImGuiStorage * GetStateStorage ( ) ; <nl> IMGUI_API ImVec2 CalcTextSize ( const char * text , const char * text_end = NULL , bool hide_text_after_double_hash = false , float wrap_width = - 1 . 0f ) ; <nl> IMGUI_API void CalcListClipping ( int items_count , float items_height , int * out_items_display_start , int * out_items_display_end ) ; / / calculate coarse clipping for large list of evenly sized items . Prefer using the ImGuiListClipper higher - level helper if you can . <nl> <nl> namespace ImGui <nl> IMGUI_API bool IsMouseHoveringRect ( const ImVec2 & r_min , const ImVec2 & r_max , bool clip = true ) ; / / is mouse hovering given bounding rect ( in screen space ) . clipped by current clipping settings . disregarding of consideration of focus / window ordering / blocked by a popup . <nl> IMGUI_API bool IsMousePosValid ( const ImVec2 * mouse_pos = NULL ) ; / / <nl> IMGUI_API ImVec2 GetMousePos ( ) ; / / shortcut to ImGui : : GetIO ( ) . MousePos provided by user , to be consistent with other calls <nl> - IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup ( ) ; / / retrieve backup of mouse positioning at the time of opening popup we have BeginPopup ( ) into <nl> + IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup ( ) ; / / retrieve backup of mouse position at the time of opening popup we have BeginPopup ( ) into <nl> IMGUI_API ImVec2 GetMouseDragDelta ( int button = 0 , float lock_threshold = - 1 . 0f ) ; / / dragging amount since clicking . if lock_threshold < - 1 . 0f uses io . MouseDraggingThreshold <nl> IMGUI_API void ResetMouseDragDelta ( int button = 0 ) ; / / <nl> IMGUI_API ImGuiMouseCursor GetMouseCursor ( ) ; / / get desired cursor type , reset in ImGui : : NewFrame ( ) , this is updated during the frame . valid before Render ( ) . If you use software rendering by setting io . MouseDrawCursor ImGui will render those for you <nl> enum ImGuiCol_ <nl> ImGuiCol_PlotHistogram , <nl> ImGuiCol_PlotHistogramHovered , <nl> ImGuiCol_TextSelectedBg , <nl> - ImGuiCol_ModalWindowDarkening , / / darken entire screen when a modal window is active <nl> + ImGuiCol_ModalWindowDarkening , / / darken / colorize entire screen behind a modal window , when one is active <nl> ImGuiCol_DragDropTarget , <nl> ImGuiCol_NavHighlight , / / gamepad / keyboard : current highlighted item <nl> ImGuiCol_NavWindowingHighlight , / / gamepad / keyboard : when holding NavMenu to focus / move / resize windows <nl> enum ImGuiColorEditFlags_ <nl> } ; <nl> <nl> / / Enumeration for GetMouseCursor ( ) <nl> + / / User code may request binding to display given cursor by calling SetMouseCursor ( ) , which is why we have some cursors that are marked unused here <nl> enum ImGuiMouseCursor_ <nl> { <nl> ImGuiMouseCursor_None = - 1 , <nl> ImGuiMouseCursor_Arrow = 0 , <nl> ImGuiMouseCursor_TextInput , / / When hovering over InputText , etc . <nl> - ImGuiMouseCursor_ResizeAll , / / Unused <nl> + ImGuiMouseCursor_ResizeAll , / / Unused by imgui functions <nl> ImGuiMouseCursor_ResizeNS , / / When hovering over an horizontal border <nl> ImGuiMouseCursor_ResizeEW , / / When hovering over a vertical border or a column <nl> ImGuiMouseCursor_ResizeNESW , / / When hovering over the bottom - left corner of a window <nl> enum ImGuiCond_ <nl> { <nl> ImGuiCond_Always = 1 < < 0 , / / Set the variable <nl> ImGuiCond_Once = 1 < < 1 , / / Set the variable once per runtime session ( only the first call with succeed ) <nl> - ImGuiCond_FirstUseEver = 1 < < 2 , / / Set the variable if the window has no saved data ( if doesn ' t exist in the . ini file ) <nl> - ImGuiCond_Appearing = 1 < < 3 / / Set the variable if the window is appearing after being hidden / inactive ( or the first time ) <nl> + ImGuiCond_FirstUseEver = 1 < < 2 , / / Set the variable if the object / window has no persistently saved data ( no entry in . ini file ) <nl> + ImGuiCond_Appearing = 1 < < 3 / / Set the variable if the object / window is appearing after being hidden / inactive ( or the first time ) <nl> <nl> / / Obsolete names ( will be removed ) <nl> # ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS <nl> enum ImGuiCond_ <nl> } ; <nl> <nl> / / You may modify the ImGui : : GetStyle ( ) main instance during initialization and before NewFrame ( ) . <nl> - / / During the frame , prefer using ImGui : : PushStyleVar ( ImGuiStyleVar_XXXX ) / PopStyleVar ( ) to alter the main style values , and ImGui : : PushStyleColor ( ImGuiCol_XXX ) / PopStyleColor ( ) for colors . <nl> + / / During the frame , use ImGui : : PushStyleVar ( ImGuiStyleVar_XXXX ) / PopStyleVar ( ) to alter the main style values , and ImGui : : PushStyleColor ( ImGuiCol_XXX ) / PopStyleColor ( ) for colors . <nl> struct ImGuiStyle <nl> { <nl> float Alpha ; / / Global alpha applies to everything in ImGui . <nl> namespace ImGui <nl> / / Helpers <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> <nl> - / / Lightweight std : : vector < > like class to avoid dragging dependencies ( also : Windows implementation of STL with debug enabled is absurdly slow , so let ' s bypass it so our code runs fast in debug ) . <nl> + / / Helper : Lightweight std : : vector < > like class to avoid dragging dependencies ( also : Windows implementation of STL with debug enabled is absurdly slow , so let ' s bypass it so our code runs fast in debug ) . <nl> / / * Important * Our implementation does NOT call C + + constructors / destructors . This is intentional , we do not require it but you have to be mindful of that . Do not use this class as a straight std : : vector replacement in your code ! <nl> template < typename T > <nl> class ImVector <nl> inline void operator delete ( void * , ImNewDummy , void * ) { } / / This is only requ <nl> # define IM_NEW ( _TYPE ) new ( ImNewDummy ( ) , ImGui : : MemAlloc ( sizeof ( _TYPE ) ) ) _TYPE <nl> template < typename T > void IM_DELETE ( T * & p ) { if ( p ) { p - > ~ T ( ) ; ImGui : : MemFree ( p ) ; p = NULL ; } } <nl> <nl> - / / Helper : execute a block of code at maximum once a frame . Convenient if you want to quickly create an UI within deep - nested code that runs multiple times every frame . <nl> + / / Helper : Execute a block of code at maximum once a frame . Convenient if you want to quickly create an UI within deep - nested code that runs multiple times every frame . <nl> / / Usage : static ImGuiOnceUponAFrame oaf ; if ( oaf ) ImGui : : Text ( " This will be called only once per frame " ) ; <nl> struct ImGuiOnceUponAFrame <nl> { <nl> struct ImGuiOnceUponAFrame <nl> operator bool ( ) const { int current_frame = ImGui : : GetFrameCount ( ) ; if ( RefFrame = = current_frame ) return false ; RefFrame = current_frame ; return true ; } <nl> } ; <nl> <nl> - / / Helper macro for ImGuiOnceUponAFrame . Attention : The macro expands into 2 statement so make sure you don ' t use it within e . g . an if ( ) statement without curly braces . <nl> + / / Helper : Macro for ImGuiOnceUponAFrame . Attention : The macro expands into 2 statement so make sure you don ' t use it within e . g . an if ( ) statement without curly braces . <nl> # ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS / / Will obsolete <nl> # define IMGUI_ONCE_UPON_A_FRAME static ImGuiOnceUponAFrame imgui_oaf ; if ( imgui_oaf ) <nl> # endif <nl> struct ImGuiTextBuffer <nl> <nl> / / Helper : Simple Key - > value storage <nl> / / Typically you don ' t have to worry about this since a storage is held within each Window . <nl> - / / We use it to e . g . store collapse state for a tree ( Int 0 / 1 ) , store color edit options . <nl> - / / This is optimized for efficient reading ( dichotomy into a contiguous buffer ) , rare writing ( typically tied to user interactions ) <nl> + / / We use it to e . g . store collapse state for a tree ( Int 0 / 1 ) <nl> + / / This is optimized for efficient lookup ( dichotomy into a contiguous buffer ) and rare insertion ( typically tied to user interactions aka max once a frame ) <nl> / / You can use it as custom user storage for temporary values . Declare your own storage if , for example : <nl> / / - You want to manipulate the open / close state of a particular sub - tree in your interface ( tree node uses Int 0 / 1 to store their state ) . <nl> / / - You want to store custom debug data easily without adding or editing structures in your code ( probably not efficient , but convenient ) <nl> struct ImGuiPayload <nl> # define IM_COL32_BLACK IM_COL32 ( 0 , 0 , 0 , 255 ) / / Opaque black <nl> # define IM_COL32_BLACK_TRANS IM_COL32 ( 0 , 0 , 0 , 0 ) / / Transparent black = 0x00000000 <nl> <nl> - / / ImColor ( ) helper to implicity converts colors to either ImU32 ( packed 4x1 byte ) or ImVec4 ( 4x1 float ) <nl> + / / Helper : ImColor ( ) implicity converts colors to either ImU32 ( packed 4x1 byte ) or ImVec4 ( 4x1 float ) <nl> / / Prefer using IM_COL32 ( ) macros if you want a guaranteed compile - time ImU32 for usage with ImDrawList API . <nl> / / * * Avoid storing ImColor ! Store either u32 of ImVec4 . This is not a full - featured color class . MAY OBSOLETE . <nl> / / * * None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats . Explicitly cast to ImU32 or ImVec4 if needed . <nl> struct ImDrawList <nl> ImVector < ImDrawCmd > CmdBuffer ; / / Draw commands . Typically 1 command = 1 GPU draw call , unless the command is a callback . <nl> ImVector < ImDrawIdx > IdxBuffer ; / / Index buffer . Each command consume ImDrawCmd : : ElemCount of those <nl> ImVector < ImDrawVert > VtxBuffer ; / / Vertex buffer . <nl> + ImDrawListFlags Flags ; / / Flags , you may poke into these to adjust anti - aliasing settings per - primitive . <nl> <nl> / / [ Internal , used while building lists ] <nl> - ImDrawListFlags Flags ; / / Flags , you may poke into these to adjust anti - aliasing settings per - primitive . <nl> const ImDrawListSharedData * _Data ; / / Pointer to shared draw data ( you can use ImGui : : GetDrawListSharedData ( ) to get the one from current ImGui context ) <nl> const char * _OwnerName ; / / Pointer to owner window ' s name for debugging <nl> unsigned int _VtxCurrentIdx ; / / [ Internal ] = = VtxBuffer . Size <nl>
imgui . h : Various comments and tweaks .
ocornut/imgui
d8d93f6360efb184e342a221b71018a2a2709778
2018-03-18T11:24:28Z
mmm a / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards . yml <nl> ppp b / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards . yml <nl> selector : <nl> - jstests / sharding / transactions_prohibited_in_sharded_cluster . js <nl> # Requires count command to be accurate on sharded clusters , introduced in v4 . 0 . <nl> - jstests / sharding / accurate_count_with_predicate . js <nl> + # Enable when SERVER - 33538 is backported . <nl> + - jstests / sharding / mapReduce_outSharded_checkUUID . js <nl> <nl> executor : <nl> config : <nl> mmm a / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards_misc . yml <nl> ppp b / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards_misc . yml <nl> selector : <nl> - jstests / sharding / user_flags_sharded . js <nl> - jstests / sharding / move_chunk_with_session_helper . js <nl> - jstests / sharding / movechunk_include . js <nl> + # Enable when SERVER - 33538 is backported . <nl> + - jstests / sharding / mapReduce_outSharded_checkUUID . js <nl> <nl> executor : <nl> config : <nl> mmm a / buildscripts / templates / generate_resmoke_suites / sharding_last_stable_mongos_and_mixed_shards . yml . j2 <nl> ppp b / buildscripts / templates / generate_resmoke_suites / sharding_last_stable_mongos_and_mixed_shards . yml . j2 <nl> selector : <nl> - jstests / sharding / transactions_prohibited_in_sharded_cluster . js <nl> # Requires count command to be accurate on sharded clusters , introduced in v4 . 0 . <nl> - jstests / sharding / accurate_count_with_predicate . js <nl> + # Enable when SERVER - 33538 is backported . <nl> + - jstests / sharding / mapReduce_outSharded_checkUUID . js <nl> { % if excluded_tests is defined % } <nl> { % for test in excluded_tests % } <nl> - { { test } } <nl> mmm a / jstests / sharding / forget_mr_temp_ns . js <nl> ppp b / jstests / sharding / forget_mr_temp_ns . js <nl> <nl> / / Tests whether we forget M / R ' s temporary namespaces for sharded output <nl> / / <nl> <nl> - / / TODO : SERVER - 33599 remove shardAsReplicaSet : false <nl> - var st = new ShardingTest ( { shards : 1 , mongos : 1 , other : { shardAsReplicaSet : false } } ) ; <nl> + var st = new ShardingTest ( { shards : 1 , mongos : 1 } ) ; <nl> <nl> var mongos = st . s0 ; <nl> var admin = mongos . getDB ( " admin " ) ; <nl> mmm a / jstests / sharding / mapReduce_outSharded . js <nl> ppp b / jstests / sharding / mapReduce_outSharded . js <nl> var verifyOutput = function ( out ) { <nl> assert . eq ( out . counts . output , 512 , " output count is wrong " ) ; <nl> } ; <nl> <nl> - / / TODO : SERVER - 33599 remove shardAsReplicaSet : false <nl> - var st = new ShardingTest ( { <nl> - shards : 2 , <nl> - verbose : 1 , <nl> - mongos : 1 , <nl> - other : { chunkSize : 1 , enableBalancer : true , shardAsReplicaSet : false } <nl> - } ) ; <nl> + var st = new ShardingTest ( <nl> + { shards : 2 , verbose : 1 , mongos : 1 , other : { chunkSize : 1 , enableBalancer : true } } ) ; <nl> <nl> st . adminCommand ( { enablesharding : " mrShard " } ) ; <nl> st . ensurePrimaryShard ( ' mrShard ' , st . shard1 . shardName ) ; <nl> new file mode 100644 <nl> index 000000000000 . . 96c3f26cd336 <nl> mmm / dev / null <nl> ppp b / jstests / sharding / mapReduce_outSharded_checkUUID . js <nl> <nl> + ( function ( ) { <nl> + " use strict " ; <nl> + load ( " jstests / libs / uuid_util . js " ) ; <nl> + <nl> + var verifyOutput = function ( out , output ) { <nl> + printjson ( out ) ; <nl> + assert . eq ( out . counts . input , 51200 , " input count is wrong " ) ; <nl> + assert . eq ( out . counts . emit , 51200 , " emit count is wrong " ) ; <nl> + assert . gt ( out . counts . reduce , 99 , " reduce count is wrong " ) ; <nl> + assert . eq ( out . counts . output , output , " output count is wrong " ) ; <nl> + } ; <nl> + <nl> + var st = new ShardingTest ( <nl> + { shards : 2 , verbose : 1 , mongos : 1 , other : { chunkSize : 1 , enableBalancer : true } } ) ; <nl> + <nl> + var admin = st . s0 . getDB ( ' admin ' ) ; <nl> + <nl> + assert . commandWorked ( admin . runCommand ( { enablesharding : " mrShard " } ) ) ; <nl> + st . ensurePrimaryShard ( ' mrShard ' , st . shard1 . shardName ) ; <nl> + assert . commandWorked ( <nl> + admin . runCommand ( { shardcollection : " mrShard . srcSharded " , key : { " _id " : 1 } } ) ) ; <nl> + <nl> + var db = st . s0 . getDB ( " mrShard " ) ; <nl> + <nl> + var bulk = db . srcSharded . initializeUnorderedBulkOp ( ) ; <nl> + for ( var j = 0 ; j < 100 ; j + + ) { <nl> + for ( var i = 0 ; i < 512 ; i + + ) { <nl> + bulk . insert ( { j : j , i : i } ) ; <nl> + } <nl> + } <nl> + assert . writeOK ( bulk . execute ( ) ) ; <nl> + <nl> + function map ( ) { <nl> + emit ( this . i , 1 ) ; <nl> + } <nl> + function reduce ( key , values ) { <nl> + return Array . sum ( values ) ; <nl> + } <nl> + <nl> + / / sharded src sharded dst <nl> + var suffix = " InShardedOutSharded " ; <nl> + <nl> + / / Check that merge to an existing empty sharded collection works and creates a new UUID after <nl> + / / M / R <nl> + st . adminCommand ( { shardcollection : " mrShard . mergeSharded " , key : { " _id " : 1 } } ) ; <nl> + var origUUID = getUUIDFromConfigCollections ( st . s , " mrShard . mergeSharded " ) ; <nl> + <nl> + var out = db . srcSharded . mapReduce ( map , reduce , { out : { merge : " mergeSharded " , sharded : true } } ) ; <nl> + verifyOutput ( out , 512 ) ; <nl> + <nl> + var newUUID = getUUIDFromConfigCollections ( st . s , " mrShard . mergeSharded " ) ; <nl> + assert . neq ( origUUID , newUUID ) ; <nl> + <nl> + / / Check that merge to an existing sharded collection has data on all shards works and that the <nl> + / / collection uses the same UUID after M / R <nl> + db . mergeSharded . drop ( ) ; <nl> + st . adminCommand ( { shardcollection : " mrShard . mergeSharded " , key : { " _id " : 1 } } ) ; <nl> + assert . commandWorked ( admin . runCommand ( { split : " mrShard . mergeSharded " , middle : { " _id " : 2000 } } ) ) ; <nl> + assert . commandWorked ( admin . runCommand ( <nl> + { moveChunk : " mrShard . mergeSharded " , find : { " _id " : 2000 } , to : st . shard0 . shardName } ) ) ; <nl> + assert . writeOK ( st . s . getCollection ( " mrShard . mergeSharded " ) . insert ( { _id : 1000 } ) ) ; <nl> + assert . writeOK ( st . s . getCollection ( " mrShard . mergeSharded " . toString ( ) ) . insert ( { _id : 2001 } ) ) ; <nl> + origUUID = getUUIDFromConfigCollections ( st . s , " mrShard . mergeSharded " ) ; <nl> + <nl> + out = db . srcSharded . mapReduce ( map , reduce , { out : { merge : " mergeSharded " , sharded : true } } ) ; <nl> + verifyOutput ( out , 514 ) ; <nl> + <nl> + newUUID = getUUIDFromConfigCollections ( st . s , " mrShard . mergeSharded " ) ; <nl> + assert . eq ( origUUID , newUUID ) ; <nl> + <nl> + / / Check that replace to an existing sharded collection has data on all shards works and that <nl> + / / the <nl> + / / collection creates a new UUID after M / R <nl> + db . replaceSharded . drop ( ) ; <nl> + st . adminCommand ( { shardcollection : " mrShard . replaceSharded " , key : { " _id " : 1 } } ) ; <nl> + assert . commandWorked ( <nl> + admin . runCommand ( { split : " mrShard . replaceSharded " , middle : { " _id " : 2000 } } ) ) ; <nl> + assert . commandWorked ( admin . runCommand ( <nl> + { moveChunk : " mrShard . replaceSharded " , find : { " _id " : 2000 } , to : st . shard0 . shardName } ) ) ; <nl> + assert . writeOK ( st . s . getCollection ( " mrShard . replaceSharded " ) . insert ( { _id : 1000 } ) ) ; <nl> + assert . writeOK ( st . s . getCollection ( " mrShard . replaceSharded " . toString ( ) ) . insert ( { _id : 2001 } ) ) ; <nl> + origUUID = getUUIDFromConfigCollections ( st . s , " mrShard . replaceSharded " ) ; <nl> + <nl> + out = db . srcSharded . mapReduce ( map , reduce , { out : { replace : " replaceSharded " , sharded : true } } ) ; <nl> + verifyOutput ( out , 512 ) ; <nl> + <nl> + newUUID = getUUIDFromConfigCollections ( st . s , " mrShard . replaceSharded " ) ; <nl> + assert . neq ( origUUID , newUUID ) ; <nl> + <nl> + / / Check that reduce to an existing unsharded collection fails when ` sharded : true ` <nl> + assert . commandWorked ( db . runCommand ( { create : " reduceUnsharded " } ) ) ; <nl> + assert . commandFailed ( db . runCommand ( { <nl> + mapReduce : " srcSharded " , <nl> + map : map , <nl> + reduce : reduce , <nl> + out : { reduce : " reduceUnsharded " , sharded : true } <nl> + } ) ) ; <nl> + <nl> + assert . commandWorked ( db . reduceUnsharded . insert ( { x : 1 } ) ) ; <nl> + assert . commandFailed ( db . runCommand ( { <nl> + mapReduce : " srcSharded " , <nl> + map : map , <nl> + reduce : reduce , <nl> + out : { reduce : " reduceUnsharded " , sharded : true } <nl> + } ) ) ; <nl> + <nl> + / / Check that replace to an existing unsharded collection works when ` sharded : true ` <nl> + assert . commandWorked ( db . runCommand ( { create : " replaceUnsharded " } ) ) ; <nl> + assert . commandWorked ( db . runCommand ( { <nl> + mapReduce : " srcSharded " , <nl> + map : map , <nl> + reduce : reduce , <nl> + out : { replace : " replaceUnsharded " , sharded : true } <nl> + } ) ) ; <nl> + <nl> + assert . commandWorked ( db . replaceUnsharded . insert ( { x : 1 } ) ) ; <nl> + assert . commandWorked ( db . runCommand ( { <nl> + mapReduce : " srcSharded " , <nl> + map : map , <nl> + reduce : reduce , <nl> + out : { replace : " replaceUnsharded " , sharded : true } <nl> + } ) ) ; <nl> + <nl> + st . stop ( ) ; <nl> + <nl> + } ) ( ) ; <nl> mmm a / jstests / sharding / mrShardedOutput . js <nl> ppp b / jstests / sharding / mrShardedOutput . js <nl> <nl> / / collection input twice the size of the first and outputs it to the new sharded <nl> / / collection created in the first pass . <nl> <nl> - / / TODO : SERVER - 33599 remove shardAsReplicaSet : false <nl> - var st = new ShardingTest ( { shards : 2 , other : { chunkSize : 1 , shardAsReplicaSet : false } } ) ; <nl> + var st = new ShardingTest ( { shards : 2 , other : { chunkSize : 1 } } ) ; <nl> <nl> var config = st . getDB ( " config " ) ; <nl> st . adminCommand ( { enablesharding : " test " } ) ; <nl> mmm a / src / mongo / db / commands / mr . cpp <nl> ppp b / src / mongo / db / commands / mr . cpp <nl> void State : : prepTempCollection ( ) { <nl> Collection * const finalColl = finalCtx . getCollection ( ) ; <nl> if ( finalColl ) { <nl> finalOptions = finalColl - > getCatalogEntry ( ) - > getCollectionOptions ( _opCtx ) ; <nl> - if ( _config . finalOutputCollUUID ) { <nl> - / / The final output collection ' s UUID is passed from mongos if the final output <nl> - / / collection is sharded . If a UUID was sent , ensure it matches what ' s on this <nl> - / / shard . <nl> - uassert ( ErrorCodes : : InternalError , <nl> - str : : stream ( ) <nl> - < < " UUID sent by mongos for sharded final output collection " <nl> - < < _config . outputOptions . finalNamespace . ns ( ) <nl> - < < " does not match UUID for the existing collection with that " <nl> - " name on this shard " , <nl> - finalColl - > uuid ( ) = = _config . finalOutputCollUUID ) ; <nl> - } <nl> <nl> IndexCatalog : : IndexIterator ii = <nl> finalColl - > getIndexCatalog ( ) - > getIndexIterator ( _opCtx , true ) ; <nl> class MapReduceFinishCommand : public BasicCommand { <nl> <nl> Config config ( dbname , cmdObj . firstElement ( ) . embeddedObjectUserCheck ( ) ) ; <nl> <nl> - if ( cmdObj [ " finalOutputCollIsSharded " ] . trueValue ( ) ) { <nl> - uassert ( ErrorCodes : : InvalidOptions , <nl> - " This shard has feature compatibility version 3 . 6 , so it expects mongos to " <nl> - " send the UUID to use for the sharded output collection . Was the mapReduce " <nl> - " request sent from a 3 . 4 mongos ? " , <nl> - cmdObj . hasField ( " shardedOutputCollUUID " ) ) ; <nl> + if ( cmdObj . hasField ( " shardedOutputCollUUID " ) ) { <nl> config . finalOutputCollUUID = <nl> uassertStatusOK ( UUID : : parse ( cmdObj [ " shardedOutputCollUUID " ] ) ) ; <nl> } <nl> mmm a / src / mongo / db / s / config / configsvr_shard_collection_command . cpp <nl> ppp b / src / mongo / db / s / config / configsvr_shard_collection_command . cpp <nl> class ConfigSvrShardCollectionCommand : public BasicCommand { <nl> opCtx , nss , proposedKey , shardKeyPattern , primaryShard , conn , request ) ; <nl> <nl> / / Step 4 . <nl> - auto uuid = getUUIDFromPrimaryShard ( nss , conn ) ; <nl> + boost : : optional < UUID > uuid ; <nl> + if ( request . getGetUUIDfromPrimaryShard ( ) ) { <nl> + uuid = getUUIDFromPrimaryShard ( nss , conn ) ; <nl> + } else { <nl> + uuid = UUID : : gen ( ) ; <nl> + } <nl> <nl> / / isEmpty is used by multiple steps below . <nl> bool isEmpty = ( conn - > count ( nss . ns ( ) ) = = 0 ) ; <nl> mmm a / src / mongo / s / commands / cluster_map_reduce_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_map_reduce_cmd . cpp <nl> class MRCmd : public ErrmsgCommandDeprecated { <nl> bool customOutDB = false ; <nl> NamespaceString outputCollNss ; <nl> bool inlineOutput = false ; <nl> + bool replaceOutput = false ; <nl> <nl> std : : string outDB = dbname ; <nl> <nl> class MRCmd : public ErrmsgCommandDeprecated { <nl> } else { <nl> / / Mode must be 1st element <nl> const std : : string finalColShort = customOut . firstElement ( ) . str ( ) ; <nl> + if ( customOut . hasField ( " replace " ) ) { <nl> + replaceOutput = true ; <nl> + } <nl> <nl> if ( customOut . hasField ( " db " ) ) { <nl> customOutDB = true ; <nl> class MRCmd : public ErrmsgCommandDeprecated { <nl> LOG ( 1 ) < < " MR with single shard output , NS = " < < outputCollNss <nl> < < " primary = " < < outputDbInfo . primaryId ( ) ; <nl> <nl> - / / Appending this field informs the shard that it can generate a UUID for the output <nl> - / / collection itself . <nl> - finalCmd . append ( " finalOutputCollIsSharded " , false ) ; <nl> - <nl> const auto outputShard = <nl> uassertStatusOK ( shardRegistry - > getShard ( opCtx , outputDbInfo . primaryId ( ) ) ) ; <nl> <nl> class MRCmd : public ErrmsgCommandDeprecated { <nl> } else { <nl> LOG ( 1 ) < < " MR with sharded output , NS = " < < outputCollNss . ns ( ) ; <nl> <nl> - auto outputRoutingInfo = <nl> - uassertStatusOK ( catalogCache - > getCollectionRoutingInfo ( opCtx , outputCollNss ) ) ; <nl> + auto outputRoutingInfo = uassertStatusOK ( <nl> + catalogCache - > getCollectionRoutingInfoWithRefresh ( opCtx , outputCollNss ) ) ; <nl> <nl> const auto catalogClient = Grid : : get ( opCtx ) - > catalogClient ( ) ; <nl> <nl> - / / Appending this field informs the shard that if the shard is in fcv > = 3 . 6 , the shard <nl> - / / should require a UUID to be sent as part of the mapreduce . shardedfinish request . <nl> - finalCmd . append ( " finalOutputCollIsSharded " , true ) ; <nl> + / / We need to determine whether we need to drop and shard the output collection and <nl> + / / send the UUID to the shards . We will always do this if we are using replace so we <nl> + / / can skip this check in that case . If using merge or reduce , we only want to do this <nl> + / / if the output collection does not exist or if it exists and is an empty sharded <nl> + / / collection . <nl> + int count ; <nl> + if ( ! replaceOutput & & outputCollNss . isValid ( ) ) { <nl> + const auto primaryShard = <nl> + uassertStatusOK ( shardRegistry - > getShard ( opCtx , outputDbInfo . primaryId ( ) ) ) ; <nl> + ScopedDbConnection conn ( primaryShard - > getConnString ( ) ) ; <nl> + <nl> + if ( ! outputRoutingInfo . cm ( ) ) { <nl> + / / The output collection either exists and is unsharded , or does not exist . If <nl> + / / the output collection exists and is unsharded , fail because we should not go <nl> + / / from unsharded to sharded . <nl> + BSONObj listCollsCmdResponse ; <nl> + ok = conn - > runCommand ( <nl> + outDB , <nl> + BSON ( " listCollections " < < 1 < < " filter " <nl> + < < BSON ( " name " < < outputCollNss . coll ( ) ) ) , <nl> + listCollsCmdResponse ) ; <nl> + BSONObj cursorObj = listCollsCmdResponse . getObjectField ( " cursor " ) ; <nl> + BSONObj collections = cursorObj [ " firstBatch " ] . Obj ( ) ; <nl> + <nl> + uassert ( ErrorCodes : : IllegalOperation , <nl> + " Cannot output to a sharded collection because " <nl> + " non - sharded collection exists already " , <nl> + collections . isEmpty ( ) ) ; <nl> + } else { <nl> + / / The output collection exists and is sharded . We need to determine whether the <nl> + / / collection is empty in order to decide whether we should drop and re - shard <nl> + / / it . <nl> + / / We don ' t want to do this if the collection is not empty . <nl> + count = conn - > count ( outputCollNss . ns ( ) ) ; <nl> + } <nl> <nl> + conn . done ( ) ; <nl> + } <nl> + <nl> + / / If we are using replace , the output collection exists and is sharded , or the output <nl> + / / collection doesn ' t exist we need to drop and shard the output collection . We send the <nl> + / / UUID generated during shardCollection to the shards to be used to create the temp <nl> + / / collections . <nl> boost : : optional < UUID > shardedOutputCollUUID ; <nl> - if ( ! outputRoutingInfo . cm ( ) ) { <nl> - / / Create the sharded collection if needed and parse the UUID from the response . <nl> + if ( replaceOutput | | <nl> + ( outputCollNss . isValid ( ) & & ( count = = 0 | | ! outputRoutingInfo . cm ( ) ) ) ) { <nl> + auto dropCmdResponse = uassertStatusOK ( <nl> + Grid : : get ( opCtx ) <nl> + - > shardRegistry ( ) <nl> + - > getConfigShard ( ) <nl> + - > runCommandWithFixedRetryAttempts ( <nl> + opCtx , <nl> + ReadPreferenceSetting ( ReadPreference : : PrimaryOnly ) , <nl> + " admin " , <nl> + BSON ( " _configsvrDropCollection " < < outputCollNss . toString ( ) ) , <nl> + Shard : : RetryPolicy : : kIdempotent ) ) ; <nl> + uassertStatusOK ( dropCmdResponse . commandStatus ) ; <nl> + uassertStatusOK ( dropCmdResponse . writeConcernStatus ) ; <nl> + <nl> outputRoutingInfo = createShardedOutputCollection ( <nl> opCtx , outputCollNss , splitPts , & shardedOutputCollUUID ) ; <nl> - } else { <nl> - / / Collection is already sharded ; read the collection ' s UUID from the config server . <nl> - const auto coll = <nl> - uassertStatusOK ( catalogClient - > getCollection ( opCtx , outputCollNss ) ) . value ; <nl> - shardedOutputCollUUID = coll . getUUID ( ) ; <nl> } <nl> - <nl> / / This mongos might not have seen a UUID if setFCV was called on the cluster just after <nl> / / this mongos tried to obtain the sharded output collection ' s UUID , so appending the <nl> / / UUID is optional . If setFCV = 3 . 6 has been called on the shard , the shard will error . <nl> class MRCmd : public ErrmsgCommandDeprecated { <nl> / / constructor automatically respects default values specified in the . idl . <nl> configShardCollRequest . setNumInitialChunks ( 0 ) ; <nl> configShardCollRequest . setInitialSplitPoints ( sortedSplitPts ) ; <nl> + configShardCollRequest . setGetUUIDfromPrimaryShard ( false ) ; <nl> <nl> auto cmdResponse = uassertStatusOK ( <nl> Grid : : get ( opCtx ) - > shardRegistry ( ) - > getConfigShard ( ) - > runCommandWithFixedRetryAttempts ( <nl> mmm a / src / mongo / s / request_types / shard_collection . idl <nl> ppp b / src / mongo / s / request_types / shard_collection . idl <nl> structs : <nl> type : object <nl> description : " The collation to use for the shard key index . " <nl> optional : true <nl> + getUUIDfromPrimaryShard : <nl> + type : bool <nl> + description : " Whether the collection should be created on the primary shard . This should only be false when used in mapReduce . " <nl> + default : true <nl> <nl> ConfigsvrShardCollectionResponse : <nl> description : " The response format of the internal shardCollection command on the config server " <nl>
SERVER - 33639 Fix UUID inconsistencies in mapReduce on a sharded output collection
mongodb/mongo
b69e6725325aaaae4fcca7563bf6428837ab7767
2018-05-22T20:54:22Z
mmm a / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CMakeLists . txt <nl> ppp b / Code / CryEngine / CryAudioSystem / implementations / CryAudioImplWwise / CMakeLists . txt <nl> if ( AUDIO_WWISE ) <nl> endif ( ) <nl> <nl> if ( ( WIN64 OR WIN32 OR DURANGO ) AND MSVC ) <nl> - set ( WWISE_LIB_PATH " $ { SDK_DIR } / Audio / wwise / SDK / $ { WWISE_PLATFORM_PATH } _ $ { MSVC_LIB_PREFIX } / $ < CONFIG > / lib / " ) <nl> + if ( MSVC_VERSION EQUAL 1700 ) <nl> + # Visual Studio 2012 <nl> + set ( MSVC_LIB_PREFIX_WWISE " vc110 " ) <nl> + elseif ( MSVC_VERSION EQUAL 1800 ) <nl> + # Visual Studio 2013 <nl> + set ( MSVC_LIB_PREFIX_WWISE " vc120 " ) <nl> + elseif ( MSVC_VERSION EQUAL 1900 ) <nl> + # Visual Studio 2015 <nl> + set ( MSVC_LIB_PREFIX_WWISE " vc140 " ) <nl> + elseif ( ( MSVC_VERSION GREATER 1900 ) AND ( MSVC_VERSION LESS_EQUAL 1919 ) ) <nl> + # Visual Studio 2017 <nl> + set ( MSVC_LIB_PREFIX_WWISE " vc150 " ) <nl> + elseif ( MSVC_VERSION GREATER 1919 ) <nl> + # Visual Studio 20 ? ? <nl> + set ( MSVC_LIB_PREFIX_WWISE " vc150 " ) <nl> + endif ( ) <nl> + set ( WWISE_LIB_PATH " $ { SDK_DIR } / Audio / wwise / SDK / $ { WWISE_PLATFORM_PATH } _ $ { MSVC_LIB_PREFIX_WWISE } / $ < CONFIG > / lib / " ) <nl> else ( ) <nl> set ( WWISE_LIB_PATH " $ { SDK_DIR } / Audio / wwise / SDK / $ { WWISE_PLATFORM_PATH } / $ < CONFIG > / lib / " ) <nl> endif ( ) <nl>
! XI ce / main - > ce / main_stabilisation
CRYTEK/CRYENGINE
a3a874cf7201d2ece74aeac77804c84cf73d3270
2018-03-22T12:55:45Z
mmm a / include / envoy / runtime / runtime . h <nl> ppp b / include / envoy / runtime / runtime . h <nl> class Loader { <nl> virtual void initialize ( Upstream : : ClusterManager & cm ) PURE ; <nl> <nl> / * * <nl> - * @ return Snapshot & the current snapshot . This reference is safe to use for the duration of <nl> + * @ return const Snapshot & the current snapshot . This reference is safe to use for the duration of <nl> * the calling routine , but may be overwritten on a future event loop cycle so should be <nl> * fetched again when needed . <nl> * / <nl> - virtual Snapshot & snapshot ( ) PURE ; <nl> + virtual const Snapshot & snapshot ( ) PURE ; <nl> <nl> / * * <nl> * Merge the given map of key - value pairs into the runtime ' s state . To remove a previous merge for <nl> mmm a / source / common / runtime / runtime_impl . cc <nl> ppp b / source / common / runtime / runtime_impl . cc <nl> void LoaderImpl : : loadNewSnapshot ( ) { <nl> } ) ; <nl> } <nl> <nl> - Snapshot & LoaderImpl : : snapshot ( ) { return tls_ - > getTyped < Snapshot > ( ) ; } <nl> + const Snapshot & LoaderImpl : : snapshot ( ) { return tls_ - > getTyped < Snapshot > ( ) ; } <nl> <nl> void LoaderImpl : : mergeValues ( const std : : unordered_map < std : : string , std : : string > & values ) { <nl> if ( admin_layer_ = = nullptr ) { <nl> mmm a / source / common / runtime / runtime_impl . h <nl> ppp b / source / common / runtime / runtime_impl . h <nl> class LoaderImpl : public Loader , Logger : : Loggable < Logger : : Id : : runtime > { <nl> <nl> / / Runtime : : Loader <nl> void initialize ( Upstream : : ClusterManager & cm ) override ; <nl> - Snapshot & snapshot ( ) override ; <nl> + const Snapshot & snapshot ( ) override ; <nl> void mergeValues ( const std : : unordered_map < std : : string , std : : string > & values ) override ; <nl> <nl> private : <nl> mmm a / test / common / runtime / runtime_impl_test . cc <nl> ppp b / test / common / runtime / runtime_impl_test . cc <nl> TEST_F ( DiskLoaderImplTest , All ) { <nl> EXPECT_EQ ( 123UL , loader_ - > snapshot ( ) . getInteger ( " file4 " , 1 ) ) ; <nl> <nl> bool value ; <nl> - SnapshotImpl * snapshot = reinterpret_cast < SnapshotImpl * > ( & loader_ - > snapshot ( ) ) ; <nl> + const SnapshotImpl * snapshot = reinterpret_cast < const SnapshotImpl * > ( & loader_ - > snapshot ( ) ) ; <nl> <nl> / / Validate that the layer name is set properly for static layers . <nl> EXPECT_EQ ( " base " , snapshot - > getLayers ( ) [ 0 ] - > name ( ) ) ; <nl> TEST_F ( StaticLoaderImplTest , ProtoParsing ) { <nl> <nl> / / Boolean getting . <nl> bool value ; <nl> - SnapshotImpl * snapshot = reinterpret_cast < SnapshotImpl * > ( & loader_ - > snapshot ( ) ) ; <nl> + const SnapshotImpl * snapshot = reinterpret_cast < const SnapshotImpl * > ( & loader_ - > snapshot ( ) ) ; <nl> <nl> EXPECT_EQ ( true , snapshot - > getBoolean ( " file11 " , value ) ) ; <nl> EXPECT_EQ ( true , value ) ; <nl> mmm a / test / mocks / runtime / mocks . h <nl> ppp b / test / mocks / runtime / mocks . h <nl> class MockLoader : public Loader { <nl> ~ MockLoader ( ) override ; <nl> <nl> MOCK_METHOD1 ( initialize , void ( Upstream : : ClusterManager & cm ) ) ; <nl> - MOCK_METHOD0 ( snapshot , Snapshot & ( ) ) ; <nl> + MOCK_METHOD0 ( snapshot , const Snapshot & ( ) ) ; <nl> MOCK_METHOD1 ( mergeValues , void ( const std : : unordered_map < std : : string , std : : string > & ) ) ; <nl> <nl> testing : : NiceMock < MockSnapshot > snapshot_ ; <nl>
runtime : changing snapshot access to be const ( )
envoyproxy/envoy
712000a711ee2bf7d3065ab107ad6c7438c5bd7f
2019-07-22T20:44:22Z
mmm a / lib / AST / NameLookup . cpp <nl> ppp b / lib / AST / NameLookup . cpp <nl> UnqualifiedLookup : : UnqualifiedLookup ( DeclName Name , DeclContext * DC , <nl> <nl> SmallVector < ValueDecl * , 4 > Lookup ; <nl> DC - > lookupQualified ( ExtendedType , Name , options , TypeResolver , Lookup ) ; <nl> - bool isMetatypeType = ExtendedType - > is < AnyMetatypeType > ( ) ; <nl> bool FoundAny = false ; <nl> for ( auto Result : Lookup ) { <nl> - / / If we ' re looking into an instance , skip static functions . <nl> - if ( ! isMetatypeType & & <nl> - isa < FuncDecl > ( Result ) & & <nl> - cast < FuncDecl > ( Result ) - > isStatic ( ) ) <nl> - continue ; <nl> - <nl> / / Classify this declaration . <nl> FoundAny = true ; <nl> <nl> UnqualifiedLookup : : UnqualifiedLookup ( DeclName Name , DeclContext * DC , <nl> else <nl> Results . push_back ( UnqualifiedLookupResult ( MetaBaseDecl , Result ) ) ; <nl> continue ; <nl> - } else if ( auto FD = dyn_cast < FuncDecl > ( Result ) ) { <nl> - if ( FD - > isStatic ( ) & & ! isMetatypeType ) <nl> - continue ; <nl> - } else if ( isa < EnumElementDecl > ( Result ) ) { <nl> - Results . push_back ( UnqualifiedLookupResult ( BaseDecl , Result ) ) ; <nl> - continue ; <nl> } <nl> <nl> Results . push_back ( UnqualifiedLookupResult ( BaseDecl , Result ) ) ; <nl> mmm a / stdlib / public / SDK / CoreGraphics / CGFloat . swift . gyb <nl> ppp b / stdlib / public / SDK / CoreGraphics / CGFloat . swift . gyb <nl> public struct CGFloat { <nl> } <nl> <nl> public var magnitude : CGFloat { <nl> - return CGFloat ( abs ( native ) ) <nl> + return CGFloat ( Swift . abs ( native ) ) <nl> } <nl> <nl> public mutating func negate ( ) { <nl> mmm a / test / expr / primary / unqualified_name . swift <nl> ppp b / test / expr / primary / unqualified_name . swift <nl> struct S0 { <nl> _ = self . f0 ( : y : z : ) / / expected - error { { an empty argument label is spelled with ' _ ' } } { { 17 - 17 = _ } } <nl> _ = self . f1 ( _ : ` while ` : ) / / expected - warning { { keyword ' while ' does not need to be escaped in argument list } } { { 19 - 20 = } } { { 25 - 26 = } } <nl> _ = self . f2 ( _ : ` let ` : ) <nl> + <nl> + _ = f3 ( _ : y : z : ) / / expected - error { { static member ' f3 ( _ : y : z : ) ' cannot be used on instance of type ' S0 ' } } <nl> + } <nl> + <nl> + static func testStaticS0 ( ) { <nl> + _ = f0 ( _ : y : z : ) <nl> + _ = f3 ( _ : y : z : ) <nl> } <nl> <nl> static func f3 ( _ x : Int , y : Int , z : Int ) - > S0 { return S0 ( ) } <nl> mmm a / test / expr / unary / selector / property . swift <nl> ppp b / test / expr / unary / selector / property . swift <nl> class ObjCClass { <nl> let _ = # selector ( setter : myConstant ) / / expected - error { { argument of ' # selector ( setter : ) ' refers to non - settable let ' myConstant ' } } <nl> let _ = # selector ( setter : myComputedReadOnlyProperty ) / / expected - error { { argument of ' # selector ( setter : ) ' refers to non - settable var ' myComputedReadOnlyProperty ' } } <nl> <nl> - let _ = # selector ( myClassFunc ) / / expected - error { { use of unresolved identifier ' myClassFunc ' } } <nl> + let _ = # selector ( myClassFunc ) / / expected - error { { static member ' myClassFunc ' cannot be used on instance of type ' ObjCClass ' } } <nl> } <nl> <nl> class func classMethod ( ) { <nl> class InstanceStaticTestClass { <nl> <nl> @ objc static func staticMethod ( ) { } <nl> <nl> - @ objc func instanceMethod ( ) { } / / expected - note { { did you mean ' instanceMethod ' ? } } <nl> + @ objc func instanceMethod ( ) { } <nl> <nl> @ objc func instanceAndStaticMethod ( ) { } <nl> @ objc class func instanceAndStaticMethod ( ) { } <nl> class InstanceStaticTestClass { <nl> let _ = # selector ( instanceMethod ) <nl> <nl> let _ = # selector ( getter : staticProperty ) / / expected - error { { static member ' staticProperty ' cannot be used on instance of type ' InstanceStaticTestClass ' } } <nl> - let _ = # selector ( classMethod ) / / expected - error { { use of unresolved identifier ' classMethod ' } } <nl> - let _ = # selector ( staticMethod ) / / expected - error { { use of unresolved identifier ' staticMethod ' } } <nl> + let _ = # selector ( classMethod ) / / expected - error { { static member ' classMethod ' cannot be used on instance of type ' InstanceStaticTestClass ' } } <nl> + let _ = # selector ( staticMethod ) / / expected - error { { static member ' staticMethod ' cannot be used on instance of type ' InstanceStaticTestClass ' } } <nl> <nl> let _ = # selector ( instanceAndStaticMethod ) <nl> } <nl>
AST : Name lookup shouldn ' t filter out static / instance methods from instance / static context
apple/swift
3ebd53d03c1c1fad8d1cddfab9ae79cff1ef445d
2016-08-05T21:27:16Z
mmm a / hphp / hack / src / recorder / turntable . ml <nl> ppp b / hphp / hack / src / recorder / turntable . ml <nl> <nl> * <nl> * ) <nl> <nl> - ( * * <nl> - * Turntable plays back a recording on a Hack server . Upon finishing playback , <nl> - * it sleeps until manually terminated , keeping the persistent connection <nl> - * alive so that the server state doesn ' t drop the IDE state ( allowing you to <nl> - * to interact with and inspect the server ) . <nl> - * ) <nl> - <nl> - module Args = struct <nl> - <nl> - type t = { <nl> - root : Path . t ; <nl> - recording : Path . t ; <nl> - } <nl> - <nl> - let usage = Printf . sprintf <nl> - " Usage : % s - - recording < recording file > [ REPO DIRECTORY ] \ n " <nl> - Sys . argv . ( 0 ) <nl> - <nl> - let parse ( ) = <nl> - let root = ref None in <nl> - let recording = ref " " in <nl> - let options = [ <nl> - " - - recording " , Arg . String ( fun x - > recording : = x ) , <nl> - " Path to the recording file " ; <nl> - ] in <nl> - let ( ) = Arg . parse options ( fun s - > root : = ( Some s ) ) usage in <nl> - let root = ClientArgsUtils . get_root ! root in <nl> - if ! recording = " " then <nl> - let ( ) = Printf . eprintf " % s " usage in <nl> - exit 1 <nl> - else <nl> - { <nl> - root = root ; <nl> - recording = Path . make ! recording ; <nl> - } <nl> - <nl> - let root args = args . root <nl> - <nl> - end ; ; <nl> - <nl> let not_yet_supported s = <nl> Printf . eprintf " Type not yet supported : % s " s <nl> <nl> let rec playback recording conn = <nl> in <nl> playback recording conn <nl> <nl> - let rec sleep_and_wait ( ) = <nl> - let _ , _ , _ = Unix . select [ ] [ ] [ ] 999999 . 999 in <nl> - sleep_and_wait ( ) <nl> - <nl> - let ( ) = <nl> - Daemon . check_entry_point ( ) ; ( * this call might not return * ) <nl> - Sys_utils . set_signal Sys . sigint ( Sys . Signal_handle ( fun _ - > <nl> - exit 0 ) ) ; <nl> - let args = Args . parse ( ) in <nl> - HackEventLogger . client_init @ @ Args . root args ; <nl> - let conn = ClientIde . connect_persistent { ClientIde . root = Args . root args } <nl> + let spin_record recording_path root = <nl> + let conn = ClientIde . connect_persistent { ClientIde . root = root } <nl> ~ retries : 800 in <nl> - let recording = args . Args . recording | > Path . to_string | > open_in in <nl> + let recording = recording_path | > Path . to_string | > open_in in <nl> try playback recording conn with <nl> | End_of_file - > <nl> - Printf . eprintf " End of recording . . . waiting for termination \ n % ! " ; <nl> - sleep_and_wait ( ) <nl> + ( ) <nl> | Failure s when s = " input_value : truncated object " - > <nl> - Printf . eprintf " End of recording . . . waiting for termination \ n % ! " ; <nl> - sleep_and_wait ( ) <nl> + ( ) <nl> new file mode 100644 <nl> index 00000000000 . . bb181a4aeed <nl> mmm / dev / null <nl> ppp b / hphp / hack / src / recorder / turntable_bin . ml <nl> <nl> + ( * * <nl> + * Copyright ( c ) 2016 , Facebook , Inc . <nl> + * All rights reserved . <nl> + * <nl> + * This source code is licensed under the BSD - style license found in the <nl> + * LICENSE file in the " hack " directory of this source tree . An additional grant <nl> + * of patent rights can be found in the PATENTS file in the same directory . <nl> + * <nl> + * ) <nl> + <nl> + ( * * <nl> + * Turntable plays back a recording on a Hack server . Upon finishing playback , <nl> + * it sleeps until manually terminated , keeping the persistent connection <nl> + * alive so that the server state doesn ' t drop the IDE state ( allowing you to <nl> + * to interact with and inspect the server ) . <nl> + * ) <nl> + <nl> + module Args = struct <nl> + <nl> + type t = { <nl> + root : Path . t ; <nl> + recording : Path . t ; <nl> + } <nl> + <nl> + let usage = Printf . sprintf <nl> + " Usage : % s - - recording < recording file > [ REPO DIRECTORY ] \ n " <nl> + Sys . argv . ( 0 ) <nl> + <nl> + let parse ( ) = <nl> + let root = ref None in <nl> + let recording = ref " " in <nl> + let options = [ <nl> + " - - recording " , Arg . String ( fun x - > recording : = x ) , <nl> + " Path to the recording file " ; <nl> + ] in <nl> + let ( ) = Arg . parse options ( fun s - > root : = ( Some s ) ) usage in <nl> + let root = ClientArgsUtils . get_root ! root in <nl> + if ! recording = " " then <nl> + let ( ) = Printf . eprintf " % s " usage in <nl> + exit 1 <nl> + else <nl> + { <nl> + root = root ; <nl> + recording = Path . make ! recording ; <nl> + } <nl> + <nl> + let root args = args . root <nl> + <nl> + end ; ; <nl> + <nl> + <nl> + let rec sleep_and_wait ( ) = <nl> + let _ , _ , _ = Unix . select [ ] [ ] [ ] 999999 . 999 in <nl> + sleep_and_wait ( ) <nl> + <nl> + let ( ) = <nl> + Daemon . check_entry_point ( ) ; ( * this call might not return * ) <nl> + Sys_utils . set_signal Sys . sigint ( Sys . Signal_handle ( fun _ - > <nl> + exit 0 ) ) ; <nl> + let args = Args . parse ( ) in <nl> + HackEventLogger . client_init @ @ Args . root args ; <nl> + let ( ) = Turntable . spin_record args . Args . recording ( Args . root args ) in <nl> + let ( ) = Printf . eprintf " End of recording . . . waiting for termination \ n % ! " in <nl> + sleep_and_wait ( ) <nl> mmm a / hphp / hack / test / integration / hh_paths . py <nl> ppp b / hphp / hack / test / integration / hh_paths . py <nl> <nl> hh_server = ' hh_server ' <nl> hh_client = ' hh_client ' <nl> recorder_cat = ' recorder_cat ' <nl> - turntable = ' turntable ' <nl> + turntable_bin = ' turntable_bin ' <nl> server_driver_bin = ' server_driver_bin ' <nl> mmm a / hphp / hack / test / integration / recorder_test . ml <nl> ppp b / hphp / hack / test / integration / recorder_test . ml <nl> module Test_harness = struct <nl> repo_dir : Path . t ; <nl> test_env : string list ; <nl> hh_client_path : string ; <nl> - hh_server_path : string <nl> + hh_server_path : string ; <nl> } <nl> <nl> ( * * Invoke a subprocess on the harness ' s repo with its environment . * ) <nl> module Test_harness = struct <nl> logs > > = fun logs - > <nl> try begin <nl> let _ = Str . search_forward recording_re logs 0 in <nl> - Some ( Str . matched_group 1 logs ) <nl> + Some ( Path . make ( Str . matched_group 1 logs ) ) <nl> end with <nl> | Not_found - > <nl> Printf . eprintf " recorder path not found \ n % ! " ; <nl> let rec read_recording_rec ic acc = <nl> acc <nl> <nl> let read_recording recording_path = <nl> - let ic = Pervasives . open_in recording_path in <nl> + let ic = Pervasives . open_in ( Path . to_string recording_path ) in <nl> Utils . try_finally ~ f : ( fun ( ) - > <nl> let items_rev = read_recording_rec ic [ ] in <nl> List . rev items_rev <nl> let test_server_driver_case_0 harness = <nl> let ( ) = assert_recording_matches expected recording harness in <nl> true <nl> <nl> - let test_server_driver_case_1 harness = <nl> + let test_server_driver_case_1_and_turntable harness = <nl> let results = Test_harness . check_cmd harness in <nl> let ( ) = String_asserter . assert_list_equals [ " No errors ! " ] results <nl> ( see_also_logs harness ) in <nl> let ( ) = Printf . eprintf " Finished check on : % s \ n % ! " <nl> ( Path . to_string harness . Test_harness . repo_dir ) in <nl> - let _ = Server_driver . connect_and_run_case 1 harness . Test_harness . repo_dir in <nl> + let _conn = Server_driver . connect_and_run_case 1 <nl> + harness . Test_harness . repo_dir in <nl> let results = Test_harness . check_cmd harness in <nl> let substitutions = ( module struct <nl> let substitutions = [ <nl> ( " repo " , ( Path . to_string harness . Test_harness . repo_dir ) ) ; <nl> ] <nl> end : Pattern_substitutions ) in <nl> + let expected_error = " { repo } / foo_1 . php : 3 : 26 , 37 : " ^ <nl> + " Undefined variable : $ missing_var ( Naming [ 2050 ] ) " in <nl> let module MySubstitutions = ( val substitutions : Pattern_substitutions ) in <nl> let module MyPatternComparator = Pattern_comparator ( MySubstitutions ) in <nl> let module MyAsserter = Make_asserter ( MyPatternComparator ) in <nl> - let ( ) = MyAsserter . assert_list_equals [ <nl> - " { repo } / foo_1 . php : 3 : 26 , 37 : Undefined variable : $ missing_var ( Naming [ 2050 ] ) " <nl> - ] results ( see_also_logs harness ) in <nl> - let _ = Test_harness . stop_server harness in <nl> - true <nl> + let ( ) = MyAsserter . assert_list_equals [ expected_error ] results <nl> + ( see_also_logs harness ) in <nl> + match Test_harness . get_recording_path harness with <nl> + | None - > <nl> + Printf . eprintf " Could not find recording \ n % ! " ; <nl> + false <nl> + | Some recording_path - > <nl> + let _ = Test_harness . stop_server harness in <nl> + ( * * After stopping server , recorder daemon might take a few seconds to <nl> + * see the server stopped . * ) <nl> + let _ , _ , _ = Unix . select [ ] [ ] [ ] 3 . 0 in <nl> + let results = Test_harness . check_cmd harness in <nl> + ( * * Fresh server has no errors . * ) <nl> + let ( ) = String_asserter . assert_list_equals [ " No errors ! " ] results <nl> + ( see_also_logs harness ) in <nl> + let ( ) = Turntable . spin_record recording_path <nl> + harness . Test_harness . repo_dir in <nl> + ( * * After playback , we get the previous errors again . * ) <nl> + let results = Test_harness . check_cmd harness in <nl> + let ( ) = MyAsserter . assert_list_equals [ expected_error ] results <nl> + ( see_also_logs harness ) in <nl> + true <nl> <nl> let tests args = [ <nl> ( " test_check_cmd " , fun ( ) - > Test_harness . run_test args ( <nl> let tests args = [ <nl> " use_watchman = true \ n " ^ <nl> " start_with_recorder_on = true \ n " ) <nl> test_server_driver_case_0 ) ) ; <nl> - ( " test_server_driver_case_1 " , fun ( ) - > Test_harness . run_test args ( <nl> + ( " test_server_driver_case_1_and_turntable " , <nl> + fun ( ) - > Test_harness . run_test args ( <nl> Test_harness . with_local_conf <nl> ( " use_mini_state = false \ n " ^ <nl> " use_watchman = true \ n " ^ <nl> " start_with_recorder_on = true \ n " ) <nl> - test_server_driver_case_1 ) ) ; <nl> + test_server_driver_case_1_and_turntable ) ) ; <nl> ] <nl> <nl> let ( ) = <nl> mmm a / hphp / hack / test / integration / test_hh_record . py <nl> ppp b / hphp / hack / test / integration / test_hh_record . py <nl> <nl> import sys <nl> import time <nl> <nl> - from hh_paths import hh_client , recorder_cat , server_driver_bin , turntable <nl> + from hh_paths import hh_client , recorder_cat , server_driver_bin , turntable_bin <nl> <nl> <nl> def boxed_string ( content ) : <nl> def run_server_driver_case ( self , case_num ) : <nl> # still - running process ) . <nl> def spin_record ( self , recording ) : <nl> proc = self . proc_create ( [ <nl> - turntable , <nl> + turntable_bin , <nl> ' - - recording ' , <nl> recording , <nl> self . repo_dir <nl>
Also test turntable in Ocaml integration test
facebook/hhvm
f29a327c390defeab5df0dbd384199c3e85f591f
2017-01-28T09:14:44Z
mmm a / cocos / 3d / CCSprite3D . cpp <nl> ppp b / cocos / 3d / CCSprite3D . cpp <nl> void Sprite3D : : createNode ( NodeData * nodedata , Node * root , const MaterialDatas & m <nl> ModelNodeData * modelNodeData = nodedata - > asModelNodeData ( ) ; <nl> if ( modelNodeData ) <nl> { <nl> - auto subMeshState = SubMeshState : : create ( modelNodeData - > id ) ; <nl> - if ( subMeshState ) <nl> + if ( modelNodeData - > bones . size ( ) > 0 ) <nl> { <nl> - _subMeshStates . pushBack ( subMeshState ) ; <nl> - subMeshState - > setSubMesh ( getSubMesh ( modelNodeData - > subMeshId ) ) ; <nl> - if ( _skeleton & & modelNodeData - > bones . size ( ) ) <nl> + auto subMeshState = SubMeshState : : create ( modelNodeData - > id ) ; <nl> + if ( subMeshState ) <nl> { <nl> - auto skin = MeshSkin : : create ( _skeleton , modelNodeData - > bones , modelNodeData - > invBindPose ) ; <nl> - subMeshState - > setSkin ( skin ) ; <nl> - } <nl> - <nl> - if ( modelNodeData - > matrialId = = " " & & matrialdatas . materials . size ( ) ) <nl> - { <nl> - const NTextureData * textureData = matrialdatas . materials [ 0 ] . getTextureData ( NTextureData : : Usage : : Diffuse ) ; <nl> - subMeshState - > setTexture ( textureData - > filename ) ; <nl> + _subMeshStates . pushBack ( subMeshState ) ; <nl> + subMeshState - > setSubMesh ( getSubMesh ( modelNodeData - > subMeshId ) ) ; <nl> + if ( _skeleton & & modelNodeData - > bones . size ( ) ) <nl> + { <nl> + auto skin = MeshSkin : : create ( _skeleton , modelNodeData - > bones , modelNodeData - > invBindPose ) ; <nl> + subMeshState - > setSkin ( skin ) ; <nl> + } <nl> + <nl> + if ( modelNodeData - > matrialId = = " " & & matrialdatas . materials . size ( ) ) <nl> + { <nl> + const NTextureData * textureData = matrialdatas . materials [ 0 ] . getTextureData ( NTextureData : : Usage : : Diffuse ) ; <nl> + subMeshState - > setTexture ( textureData - > filename ) ; <nl> + } <nl> + else <nl> + { <nl> + const NMaterialData * materialData = matrialdatas . getMaterialData ( modelNodeData - > matrialId ) ; <nl> + if ( materialData ) <nl> + { <nl> + const NTextureData * textureData = materialData - > getTextureData ( NTextureData : : Usage : : Diffuse ) ; <nl> + if ( textureData ) <nl> + { <nl> + auto tex = Director : : getInstance ( ) - > getTextureCache ( ) - > addImage ( textureData - > filename ) ; <nl> + if ( tex ) <nl> + { <nl> + Texture2D : : TexParams texParams ; <nl> + texParams . minFilter = GL_LINEAR ; <nl> + texParams . magFilter = GL_LINEAR ; <nl> + texParams . wrapS = textureData - > wrapS ; <nl> + texParams . wrapT = textureData - > wrapT ; <nl> + tex - > setTexParameters ( texParams ) ; <nl> + subMeshState - > setTexture ( tex ) ; <nl> + } <nl> + <nl> + } <nl> + } <nl> + } <nl> } <nl> - else <nl> + } <nl> + else <nl> + { <nl> + auto sprite = new Sprite3D ( ) ; <nl> + if ( sprite ) <nl> { <nl> - const NMaterialData * materialData = matrialdatas . getMaterialData ( modelNodeData - > matrialId ) ; <nl> - if ( materialData ) <nl> + auto subMeshState = SubMeshState : : create ( modelNodeData - > id ) ; <nl> + subMeshState - > setSubMesh ( getSubMesh ( modelNodeData - > subMeshId ) ) ; <nl> + if ( modelNodeData - > matrialId = = " " & & matrialdatas . materials . size ( ) ) <nl> + { <nl> + const NTextureData * textureData = matrialdatas . materials [ 0 ] . getTextureData ( NTextureData : : Usage : : Diffuse ) ; <nl> + subMeshState - > setTexture ( textureData - > filename ) ; <nl> + } <nl> + else <nl> { <nl> - const NTextureData * textureData = materialData - > getTextureData ( NTextureData : : Usage : : Diffuse ) ; <nl> - if ( textureData ) <nl> + const NMaterialData * materialData = matrialdatas . getMaterialData ( modelNodeData - > matrialId ) ; <nl> + if ( materialData ) <nl> { <nl> - auto tex = Director : : getInstance ( ) - > getTextureCache ( ) - > addImage ( textureData - > filename ) ; <nl> - if ( tex ) <nl> + const NTextureData * textureData = materialData - > getTextureData ( NTextureData : : Usage : : Diffuse ) ; <nl> + if ( textureData ) <nl> { <nl> - Texture2D : : TexParams texParams ; <nl> - texParams . minFilter = GL_LINEAR ; <nl> - texParams . magFilter = GL_LINEAR ; <nl> - texParams . wrapS = textureData - > wrapS ; <nl> - texParams . wrapT = textureData - > wrapT ; <nl> - tex - > setTexParameters ( texParams ) ; <nl> - subMeshState - > setTexture ( tex ) ; <nl> + auto tex = Director : : getInstance ( ) - > getTextureCache ( ) - > addImage ( textureData - > filename ) ; <nl> + if ( tex ) <nl> + { <nl> + Texture2D : : TexParams texParams ; <nl> + texParams . minFilter = GL_LINEAR ; <nl> + texParams . magFilter = GL_LINEAR ; <nl> + texParams . wrapS = textureData - > wrapS ; <nl> + texParams . wrapT = textureData - > wrapT ; <nl> + tex - > setTexParameters ( texParams ) ; <nl> + subMeshState - > setTexture ( tex ) ; <nl> + } <nl> + <nl> } <nl> - <nl> } <nl> } <nl> + sprite - > setAdditionalTransform ( & nodedata - > transform ) ; <nl> + sprite - > addSubMeshState ( subMeshState ) ; <nl> + sprite - > autorelease ( ) ; <nl> + sprite - > genGLProgramState ( ) ; <nl> + if ( root ) <nl> + { <nl> + root - > addChild ( sprite ) ; <nl> + } <nl> } <nl> + node = sprite ; <nl> } <nl> } <nl> else <nl> SubMesh * Sprite3D : : getSubMesh ( const std : : string & subMeshId ) const <nl> } <nl> return nullptr ; <nl> } <nl> - <nl> + void Sprite3D : : addSubMeshState ( SubMeshState * subMeshState ) <nl> + { <nl> + _meshes . pushBack ( subMeshState - > getSubMesh ( ) - > getMesh ( ) ) ; <nl> + _subMeshStates . pushBack ( subMeshState ) ; <nl> + } <nl> void Sprite3D : : genMaterials ( const std : : string & keyprefix , const std : : vector < std : : string > & texpaths ) <nl> { <nl> _subMeshStates . clear ( ) ; <nl> mmm a / cocos / 3d / CCSprite3D . h <nl> ppp b / cocos / 3d / CCSprite3D . h <nl> class CC_DLL Sprite3D : public Node , public BlendProtocol <nl> void createNode ( NodeData * nodedata , Node * root , const MaterialDatas & matrialdatas ) ; <nl> / * * get SubMesh by Id * / <nl> SubMesh * getSubMesh ( const std : : string & subMeshId ) const ; <nl> - <nl> + void addSubMeshState ( SubMeshState * subMeshState ) ; <nl> protected : <nl> Mesh * _mesh ; / / mesh <nl> MeshSkin * _skin ; / / skin <nl>
Modified load static model
cocos2d/cocos2d-x
2f816aea2c423ae84de288deee74f82563c5b398
2014-08-18T02:32:23Z