diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / hphp / runtime / base / runtime - option . cpp <nl> ppp b / hphp / runtime / base / runtime - option . cpp <nl> static inline bool hugePagesSoundNice ( ) { <nl> return RuntimeOption : : ServerExecutionMode ( ) ; <nl> } <nl> <nl> - static inline bool nsjrDefault ( ) { <nl> + static inline int nsjrDefault ( ) { <nl> return RuntimeOption : : ServerExecutionMode ( ) ? 5 : 0 ; <nl> } <nl> <nl>
Fix nsjrDefault ( ) ' s return type
facebook/hhvm
fb6af75f0a1c499fef716338c60bc12a0eba0042
2014-10-01T01:00:39Z
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> declare_args ( ) { <nl> v8_enable_pointer_compression = " " <nl> v8_enable_31bit_smis_on_64bit_arch = false <nl> <nl> + # Disable arguments adaptor frame ( sets - dV8_NO_ARGUMENTS_ADAPTOR ) . <nl> + v8_disable_arguments_adaptor = false <nl> + <nl> # Reverse JS arguments order in the stack ( sets - dV8_REVERSE_JSARGS ) . <nl> v8_enable_reverse_jsargs = <nl> v8_current_cpu ! = " mipsel " & & v8_current_cpu ! = " mips64el " <nl> assert ( <nl> assert ( ! v8_enable_heap_sandbox | | v8_enable_pointer_compression , <nl> " V8 Heap Sandbox requires pointer compression " ) <nl> <nl> + assert ( <nl> + ! v8_disable_arguments_adaptor | | v8_enable_reverse_jsargs , <nl> + " Disabling the arguments adaptor frame requires reversing the JS arguments stack " ) <nl> + <nl> assert ( ! v8_enable_unconditional_write_barriers | | ! v8_disable_write_barriers , <nl> " Write barriers can ' t be both enabled and disabled " ) <nl> <nl> config ( " v8_header_features " ) { <nl> if ( v8_imminent_deprecation_warnings ) { <nl> defines + = [ " V8_IMMINENT_DEPRECATION_WARNINGS " ] <nl> } <nl> + if ( v8_disable_arguments_adaptor ) { <nl> + defines + = [ " V8_NO_ARGUMENTS_ADAPTOR " ] <nl> + } <nl> if ( v8_enable_reverse_jsargs ) { <nl> defines + = [ " V8_REVERSE_JSARGS " ] <nl> } <nl>
[ BUILD ] GN flag to disable arguments adaptor frame
v8/v8
a49a9710db3977691e8daeca0ca5c9e46182edee
2020-09-09T09:59:14Z
mmm a / lib / Serialization / SerializedModuleLoader . cpp <nl> ppp b / lib / Serialization / SerializedModuleLoader . cpp <nl> bool SerializedModuleLoader : : maybeDiagnoseArchitectureMismatch ( <nl> return true ; <nl> } <nl> <nl> + static std : : pair < llvm : : SmallString < 16 > , llvm : : SmallString < 16 > > <nl> + getArchSpecificModuleFileNames ( StringRef archName ) { <nl> + llvm : : SmallString < 16 > archFile , archDocFile ; <nl> + <nl> + if ( ! archName . empty ( ) ) { <nl> + archFile + = archName ; <nl> + archFile + = ' . ' ; <nl> + archFile + = file_types : : getExtension ( file_types : : TY_SwiftModuleFile ) ; <nl> + <nl> + archDocFile + = archName ; <nl> + archDocFile + = ' . ' ; <nl> + archDocFile + = file_types : : getExtension ( file_types : : TY_SwiftModuleDocFile ) ; <nl> + } <nl> + <nl> + return { archFile , archDocFile } ; <nl> + } <nl> + <nl> bool <nl> SerializedModuleLoaderBase : : findModule ( AccessPathElem moduleID , <nl> std : : unique_ptr < llvm : : MemoryBuffer > * moduleBuffer , <nl> SerializedModuleLoaderBase : : findModule ( AccessPathElem moduleID , <nl> moduleDocFilename + = <nl> file_types : : getExtension ( file_types : : TY_SwiftModuleDocFile ) ; <nl> <nl> - / / FIXME : Which name should we be using here ? Do we care about CPU subtypes ? <nl> - / / FIXME : At the very least , don ' t hardcode " arch " . <nl> - llvm : : SmallString < 16 > archName { <nl> - Ctx . LangOpts . getPlatformConditionValue ( PlatformConditionKind : : Arch ) } ; <nl> - llvm : : SmallString < 16 > archFile { archName } ; <nl> - llvm : : SmallString < 16 > archDocFile { archName } ; <nl> - if ( ! archFile . empty ( ) ) { <nl> - archFile + = ' . ' ; <nl> - archFile + = file_types : : getExtension ( file_types : : TY_SwiftModuleFile ) ; <nl> + StringRef archName = Ctx . LangOpts . Target . getArchName ( ) ; <nl> + auto archFileNames = getArchSpecificModuleFileNames ( archName ) ; <nl> <nl> - archDocFile + = ' . ' ; <nl> - archDocFile + = file_types : : getExtension ( file_types : : TY_SwiftModuleDocFile ) ; <nl> - } <nl> + / / FIXME : We used to use " major architecture " names for these filesmmmthe <nl> + / / names checked in " # if arch ( . . . ) " . Fall back to that name in the one case <nl> + / / where it ' s different from what Swift 4 . 2 supported : 32 - bit ARM platforms . <nl> + / / We should be able to drop this once there ' s an Xcode that supports the <nl> + / / new names . <nl> + StringRef alternateArchName ; <nl> + if ( Ctx . LangOpts . Target . getArch ( ) = = llvm : : Triple : : ArchType : : arm ) <nl> + alternateArchName = " arm " ; <nl> + auto alternateArchFileNames = <nl> + getArchSpecificModuleFileNames ( alternateArchName ) ; <nl> <nl> auto & fs = * Ctx . SourceMgr . getFileSystem ( ) ; <nl> isFramework = false ; <nl> SerializedModuleLoaderBase : : findModule ( AccessPathElem moduleID , <nl> if ( statResult & & statResult - > isDirectory ( ) ) { <nl> / / A . swiftmodule directory contains architecture - specific files . <nl> result = openModuleFiles ( currPath , <nl> - archFile . str ( ) , archDocFile . str ( ) , <nl> + archFileNames . first , archFileNames . second , <nl> moduleBuffer , moduleDocBuffer , <nl> scratch ) ; <nl> <nl> + if ( result = = std : : errc : : no_such_file_or_directory & & <nl> + ! alternateArchName . empty ( ) ) { <nl> + result = openModuleFiles ( currPath , <nl> + alternateArchFileNames . first , <nl> + alternateArchFileNames . second , <nl> + moduleBuffer , moduleDocBuffer , <nl> + scratch ) ; <nl> + } <nl> + <nl> if ( result = = std : : errc : : no_such_file_or_directory ) { <nl> if ( maybeDiagnoseArchitectureMismatch ( moduleID . second , moduleName , <nl> archName , currPath ) ) { <nl> SerializedModuleLoaderBase : : findModule ( AccessPathElem moduleID , <nl> / / Frameworks always use architecture - specific files within a . swiftmodule <nl> / / directory . <nl> llvm : : sys : : path : : append ( currPath , " Modules " , moduleFilename . str ( ) ) ; <nl> - auto err = openModuleFiles ( currPath , archFile . str ( ) , archDocFile . str ( ) , <nl> + auto err = openModuleFiles ( currPath , <nl> + archFileNames . first , archFileNames . second , <nl> moduleBuffer , moduleDocBuffer , scratch ) ; <nl> <nl> + if ( err = = std : : errc : : no_such_file_or_directory & & <nl> + ! alternateArchName . empty ( ) ) { <nl> + err = openModuleFiles ( currPath , <nl> + alternateArchFileNames . first , <nl> + alternateArchFileNames . second , <nl> + moduleBuffer , moduleDocBuffer , scratch ) ; <nl> + } <nl> + <nl> if ( err = = std : : errc : : no_such_file_or_directory ) { <nl> if ( maybeDiagnoseArchitectureMismatch ( moduleID . second , moduleName , <nl> archName , currPath ) ) { <nl> new file mode 100644 <nl> index 000000000000 . . c0f2dc4f5bb5 <nl> mmm / dev / null <nl> ppp b / test / Serialization / load - arch - fallback - framework . swift <nl> <nl> + / / Test the fallback for 32 - bit ARM platforms . <nl> + <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : mkdir - p % t / empty . framework / Modules / empty . swiftmodule <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / empty . framework / Modules / empty . swiftmodule / arm . swiftmodule % S / . . / Inputs / empty . swift - module - name empty <nl> + / / RUN : % target - swift - frontend - typecheck % s - F % t <nl> + <nl> + / / RUN : mv % t / empty . framework / Modules / empty . swiftmodule / arm . swiftmodule % t / empty . framework / Modules / empty . swiftmodule / % target - swiftmodule - name <nl> + / / RUN : touch % t / empty . framework / Modules / empty . swiftmodule / arm . swiftmodule <nl> + / / RUN : % target - swift - frontend - typecheck % s - F % t <nl> + <nl> + / / RUN : rm % t / empty . framework / Modules / empty . swiftmodule / % target - swiftmodule - name <nl> + / / RUN : not % target - swift - frontend - typecheck % s - F % t 2 > & 1 | % FileCheck % s <nl> + <nl> + / / REQUIRES : CPU = armv7 | | CPU = armv7k | | CPU = armv7s <nl> + <nl> + import empty <nl> + / / CHECK : : [ [ @ LINE - 1 ] ] : 8 : error : malformed module file : { { . * } } arm . swiftmodule <nl> new file mode 100644 <nl> index 000000000000 . . a8f978e2eaa0 <nl> mmm / dev / null <nl> ppp b / test / Serialization / load - arch - fallback . swift <nl> <nl> + / / Test the fallback for 32 - bit ARM platforms . <nl> + <nl> + / / RUN : % empty - directory ( % t ) <nl> + / / RUN : mkdir % t / empty . swiftmodule <nl> + / / RUN : % target - swift - frontend - emit - module - o % t / empty . swiftmodule / arm . swiftmodule % S / . . / Inputs / empty . swift - module - name empty <nl> + / / RUN : % target - swift - frontend - typecheck % s - I % t <nl> + <nl> + / / RUN : mv % t / empty . swiftmodule / arm . swiftmodule % t / empty . swiftmodule / % target - swiftmodule - name <nl> + / / RUN : touch % t / empty . swiftmodule / arm . swiftmodule <nl> + / / RUN : % target - swift - frontend - typecheck % s - I % t <nl> + <nl> + / / RUN : rm % t / empty . swiftmodule / % target - swiftmodule - name <nl> + / / RUN : not % target - swift - frontend - typecheck % s - I % t 2 > & 1 | % FileCheck % s <nl> + <nl> + / / REQUIRES : CPU = armv7 | | CPU = armv7k | | CPU = armv7s <nl> + <nl> + import empty <nl> + / / CHECK : : [ [ @ LINE - 1 ] ] : 8 : error : malformed module file : { { . * } } arm . swiftmodule <nl> mmm a / test / lit . cfg <nl> ppp b / test / lit . cfg <nl> elif platform . system ( ) = = ' Linux ' : <nl> if ' swift_interpreter ' in config . available_features : <nl> config . available_features . add ( ' swift - remoteast - test ' ) <nl> <nl> - config . target_swiftmodule_name = " unknown . swiftmodule " <nl> - config . target_swiftdoc_name = " unknown . swiftdoc " <nl> config . target_runtime = " unknown " <nl> <nl> swift_reflection_test_name = ' swift - reflection - test ' + config . variant_suffix <nl> def use_interpreter_for_simple_runs ( ) : <nl> <nl> if run_vendor = = ' apple ' : <nl> config . available_features . add ( ' objc_interop ' ) <nl> - config . target_swiftmodule_name = run_cpu + " . swiftmodule " <nl> - config . target_swiftdoc_name = run_cpu + " . swiftdoc " <nl> config . target_object_format = " macho " <nl> config . target_dylib_extension = " dylib " <nl> config . target_codesign = " codesign - f - s - " <nl> if run_vendor = = ' apple ' : <nl> lit_config . note ( ' Testing watchOS ' + config . variant_triple ) <nl> xcrun_sdk_name = " watchos " <nl> <nl> - if run_cpu = = " armv7 " or run_cpu = = " armv7s " or run_cpu = = " armv7k " : <nl> - config . target_swiftmodule_name = " arm . swiftmodule " <nl> - config . target_swiftdoc_name = " arm . swiftdoc " <nl> - elif run_cpu = = " arm64 " : <nl> - config . target_swiftmodule_name = " arm64 . swiftmodule " <nl> - config . target_swiftdoc_name = " arm64 . swiftdoc " <nl> - else : <nl> - lit_config . fatal ( " Unknown CPU ' % s ' " % run_cpu ) <nl> - <nl> config . target_cc_options = ( <nl> " - arch % s - m % s - version - min = % s % s " % <nl> ( run_cpu , run_os , run_vers , clang_mcp_opt ) ) <nl> elif run_os in [ ' windows - msvc ' ] : <nl> config . target_dylib_extension = ' dll ' <nl> config . target_sdk_name = ' windows ' <nl> config . target_runtime = ' native ' <nl> - config . target_swiftmodule_name = run_cpu + ' . swiftmodule ' <nl> - config . target_swiftdoc_name = run_cpu + ' . swiftdoc ' <nl> <nl> config . target_build_swift = \ <nl> ( ' % r - target % s % s % s % s % s % s ' % ( config . swiftc , \ <nl> elif run_os in [ ' linux - gnu ' , ' linux - gnueabihf ' , ' freebsd ' , ' windows - cygnus ' , ' wi <nl> config . target_object_format = " elf " <nl> config . target_dylib_extension = " so " <nl> config . target_sdk_name = " linux " <nl> - config . target_swiftmodule_name = run_cpu + " . swiftmodule " <nl> - config . target_swiftdoc_name = run_cpu + " . swiftdoc " <nl> config . target_runtime = " native " <nl> config . target_swift_autolink_extract = inferSwiftBinary ( " swift - autolink - extract " ) <nl> config . target_build_swift = ( <nl> else : <nl> config . substitutions . insert ( 0 , ( ' % platform - module - dir ' , platform_module_dir ) ) <nl> config . substitutions . insert ( 0 , ( ' % platform - sdk - overlay - dir ' , platform_sdk_overlay_dir ) ) <nl> <nl> - config . substitutions . append ( ( ' % target - swiftmodule - name ' , config . target_swiftmodule_name ) ) <nl> - config . substitutions . append ( ( ' % target - swiftdoc - name ' , config . target_swiftdoc_name ) ) <nl> + config . substitutions . append ( ( ' % target - swiftmodule - name ' , run_cpu + ' . swiftmodule ' ) ) <nl> + config . substitutions . append ( ( ' % target - swiftdoc - name ' , run_cpu + ' . swiftdoc ' ) ) <nl> <nl> config . substitutions . append ( ( ' % target - object - format ' , config . target_object_format ) ) <nl> config . substitutions . append ( ( ' % target - dylib - extension ' , config . target_dylib_extension ) ) <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
433d968eedd57849f9f6a8ee2cf8204c472604cc
2018-12-06T21:31:29Z
new file mode 100644 <nl> index 000000000000 . . 15c537bb2357 <nl> mmm / dev / null <nl> ppp b / jstests / core / fts6 . js <nl> <nl> + / / SERVER - 13039 . Confirm that we return the right results when $ text is <nl> + / / inside an $ or . <nl> + <nl> + var t = db . jstests_fts6 ; <nl> + t . drop ( ) ; <nl> + <nl> + t . ensureIndex ( { a : 1 } ) ; <nl> + t . ensureIndex ( { b : " text " } ) ; <nl> + <nl> + t . save ( { _id : 1 , a : 0 } ) ; <nl> + t . save ( { _id : 2 , a : 0 , b : " foo " } ) ; <nl> + <nl> + var cursor = t . find ( { a : 0 , $ or : [ { _id : 2 } , { $ text : { $ search : " foo " } } ] } ) ; <nl> + var results = cursor . toArray ( ) ; <nl> + assert . eq ( 1 , results . length , " unexpected number of results " ) ; <nl> + assert . eq ( 2 , results [ 0 ] [ " _id " ] , " unexpected document returned " ) ; <nl> new file mode 100644 <nl> index 000000000000 . . 15c537bb2357 <nl> mmm / dev / null <nl> ppp b / jstests / fts6 . js <nl> <nl> + / / SERVER - 13039 . Confirm that we return the right results when $ text is <nl> + / / inside an $ or . <nl> + <nl> + var t = db . jstests_fts6 ; <nl> + t . drop ( ) ; <nl> + <nl> + t . ensureIndex ( { a : 1 } ) ; <nl> + t . ensureIndex ( { b : " text " } ) ; <nl> + <nl> + t . save ( { _id : 1 , a : 0 } ) ; <nl> + t . save ( { _id : 2 , a : 0 , b : " foo " } ) ; <nl> + <nl> + var cursor = t . find ( { a : 0 , $ or : [ { _id : 2 } , { $ text : { $ search : " foo " } } ] } ) ; <nl> + var results = cursor . toArray ( ) ; <nl> + assert . eq ( 1 , results . length , " unexpected number of results " ) ; <nl> + assert . eq ( 2 , results [ 0 ] [ " _id " ] , " unexpected document returned " ) ; <nl> mmm a / src / mongo / db / query / plan_enumerator . cpp <nl> ppp b / src / mongo / db / query / plan_enumerator . cpp <nl> <nl> <nl> namespace { <nl> <nl> + using namespace mongo ; <nl> + <nl> std : : string getPathPrefix ( std : : string path ) { <nl> if ( mongoutils : : str : : contains ( path , ' . ' ) ) { <nl> return mongoutils : : str : : before ( path , ' . ' ) ; <nl> namespace { <nl> } <nl> } <nl> <nl> + / * * <nl> + * Returns true if either ' node ' or a descendent of ' node ' <nl> + * is a predicate that is required to use an index . <nl> + * / <nl> + bool isIndexMandatory ( const MatchExpression * node ) { <nl> + return CanonicalQuery : : countNodes ( node , MatchExpression : : GEO_NEAR ) > 0 <nl> + | | CanonicalQuery : : countNodes ( node , MatchExpression : : TEXT ) > 0 ; <nl> + } <nl> + <nl> } / / namespace <nl> <nl> <nl> namespace mongo { <nl> IndexToPredMap idxToFirst ; <nl> IndexToPredMap idxToNotFirst ; <nl> <nl> - / / Children that aren ' t predicates . <nl> + / / Children that aren ' t predicates , and which do not necessarily need <nl> + / / to use an index . <nl> vector < MemoID > subnodes ; <nl> <nl> + / / Children that aren ' t predicates , but which * must * use an index . <nl> + / / ( e . g . an OR which contains a TEXT child ) . <nl> + vector < MemoID > mandatorySubnodes ; <nl> + <nl> / / A list of predicates contained in the subtree rooted at ' node ' <nl> / / obtained by traversing deeply through $ and and $ elemMatch children . <nl> vector < MatchExpression * > indexedPreds ; <nl> <nl> - / / Partition the childen into the children that aren ' t predicates <nl> - / / ( ' subnodes ' ) , and children that are predicates ( ' indexedPreds ' ) . <nl> - partitionPreds ( node , childContext , & indexedPreds , & subnodes ) ; <nl> + / / Partition the childen into the children that aren ' t predicates which may or may <nl> + / / not be indexed ( ' subnodes ' ) , children that aren ' t predicates which must use the <nl> + / / index ( ' mandatorySubnodes ' ) . and children that are predicates ( ' indexedPreds ' ) . <nl> + / / <nl> + / / We have to get the subnodes with mandatory assignments rather than adding the <nl> + / / mandatory preds to ' indexedPreds ' . Adding the mandatory preds directly to <nl> + / / ' indexedPreds ' would lead to problems such as pulling a predicate beneath an OR <nl> + / / into a set joined by an AND . <nl> + if ( ! partitionPreds ( node , childContext , & indexedPreds , <nl> + & subnodes , & mandatorySubnodes ) ) { <nl> + return false ; <nl> + } <nl> + <nl> + if ( mandatorySubnodes . size ( ) > 1 ) { <nl> + return false ; <nl> + } <nl> <nl> / / Indices we * must * use . TEXT or GEO . <nl> set < IndexID > mandatoryIndices ; <nl> namespace mongo { <nl> <nl> invariant ( Indexability : : nodeCanUseIndexOnOwnField ( child ) ) ; <nl> <nl> - bool childRequiresIndex = ( child - > matchType ( ) = = MatchExpression : : GEO_NEAR <nl> - | | child - > matchType ( ) = = MatchExpression : : TEXT ) ; <nl> + bool childRequiresIndex = isIndexMandatory ( child ) ; <nl> <nl> RelevantTag * rt = static_cast < RelevantTag * > ( child - > getTag ( ) ) ; <nl> <nl> namespace mongo { <nl> } <nl> <nl> / / If none of our children can use indices , bail out . <nl> - if ( idxToFirst . empty ( ) & & ( subnodes . size ( ) = = 0 ) ) { return false ; } <nl> + if ( idxToFirst . empty ( ) <nl> + & & ( subnodes . size ( ) = = 0 ) <nl> + & & ( mandatorySubnodes . size ( ) = = 0 ) ) { <nl> + return false ; <nl> + } <nl> <nl> / / At least one child can use an index , so we can create a memo entry . <nl> AndAssignment * andAssignment = new AndAssignment ( ) ; <nl> namespace mongo { <nl> / / Takes ownership . <nl> nodeAssignment - > andAssignment . reset ( andAssignment ) ; <nl> <nl> + / / Predicates which must use an index might be buried inside <nl> + / / a subnode . Handle that case here . <nl> + if ( 1 = = mandatorySubnodes . size ( ) ) { <nl> + AndEnumerableState aes ; <nl> + aes . subnodesToIndex . push_back ( mandatorySubnodes [ 0 ] ) ; <nl> + andAssignment - > choices . push_back ( aes ) ; <nl> + return true ; <nl> + } <nl> + <nl> / / Only near queries and text queries have mandatory indices . <nl> / / In this case there ' s no point to enumerating anything here ; both geoNear <nl> / / and text do fetches internally so we can ' t use any other indices in conjunction . <nl> namespace mongo { <nl> } <nl> } <nl> <nl> - void PlanEnumerator : : partitionPreds ( MatchExpression * node , <nl> + bool PlanEnumerator : : partitionPreds ( MatchExpression * node , <nl> PrepMemoContext context , <nl> vector < MatchExpression * > * indexOut , <nl> - vector < MemoID > * subnodesOut ) { <nl> + vector < MemoID > * subnodesOut , <nl> + vector < MemoID > * mandatorySubnodes ) { <nl> for ( size_t i = 0 ; i < node - > numChildren ( ) ; + + i ) { <nl> MatchExpression * child = node - > getChild ( i ) ; <nl> if ( Indexability : : nodeCanUseIndexOnOwnField ( child ) ) { <nl> namespace mongo { <nl> indexOut - > push_back ( child ) ; <nl> } <nl> else if ( Indexability : : isBoundsGeneratingNot ( child ) ) { <nl> - partitionPreds ( child , context , indexOut , subnodesOut ) ; <nl> + partitionPreds ( child , context , indexOut , subnodesOut , mandatorySubnodes ) ; <nl> } <nl> else if ( MatchExpression : : ELEM_MATCH_OBJECT = = child - > matchType ( ) ) { <nl> PrepMemoContext childContext ; <nl> childContext . elemMatchExpr = child ; <nl> - partitionPreds ( child , childContext , indexOut , subnodesOut ) ; <nl> + partitionPreds ( child , childContext , indexOut , subnodesOut , mandatorySubnodes ) ; <nl> } <nl> else if ( MatchExpression : : AND = = child - > matchType ( ) ) { <nl> - partitionPreds ( child , context , indexOut , subnodesOut ) ; <nl> + partitionPreds ( child , context , indexOut , subnodesOut , mandatorySubnodes ) ; <nl> } <nl> else { <nl> + bool mandatory = isIndexMandatory ( child ) ; <nl> + <nl> / / Recursively prepMemo for the subnode . We fall through <nl> / / to this case for logical nodes other than AND ( e . g . OR ) <nl> / / and for array nodes other than ELEM_MATCH_OBJECT or <nl> namespace mongo { <nl> size_t childID = _nodeToId [ child ] ; <nl> <nl> / / Output the subnode . <nl> - subnodesOut - > push_back ( childID ) ; <nl> + if ( mandatory ) { <nl> + mandatorySubnodes - > push_back ( childID ) ; <nl> + } <nl> + else { <nl> + subnodesOut - > push_back ( childID ) ; <nl> + } <nl> + } <nl> + else if ( mandatory ) { <nl> + / / The subnode is mandatory but cannot be indexed . This means <nl> + / / that the entire AND cannot be indexed either . <nl> + return false ; <nl> } <nl> } <nl> } <nl> + <nl> + return true ; <nl> } <nl> <nl> void PlanEnumerator : : getMultikeyCompoundablePreds ( const MatchExpression * assigned , <nl> mmm a / src / mongo / db / query / plan_enumerator . h <nl> ppp b / src / mongo / db / query / plan_enumerator . h <nl> namespace mongo { <nl> * information due to flattening . <nl> * <nl> * Nodes that cannot be deeply traversed are returned via the output <nl> - * vector ' subnodesOut ' . <nl> + * vectors ' subnodesOut ' and ' mandatorySubnodes ' . Subnodes are " mandatory " <nl> + * if they * must * use an index ( TEXT and GEO ) . <nl> * <nl> * Does not take ownership of arguments . <nl> + * <nl> + * Returns false if the AND cannot be indexed . Otherwise returns true . <nl> * / <nl> - void partitionPreds ( MatchExpression * node , <nl> + bool partitionPreds ( MatchExpression * node , <nl> PrepMemoContext context , <nl> vector < MatchExpression * > * indexOut , <nl> - vector < MemoID > * subnodesOut ) ; <nl> + vector < MemoID > * subnodesOut , <nl> + vector < MemoID > * mandatorySubnodes ) ; <nl> <nl> / * * <nl> * Finds a set of predicates that can be safely compounded with ' assigned ' , <nl> mmm a / src / mongo / db / query / query_planner_text_test . cpp <nl> ppp b / src / mongo / db / query / query_planner_text_test . cpp <nl> namespace { <nl> assertNumSolutions ( 1 ) ; <nl> } <nl> <nl> + TEST_F ( QueryPlannerTest , TextInsideAndWithCompoundIndex ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 < < " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { $ and : [ { a : 3 } , { $ text : { $ search : ' foo ' } } ] , a : 3 } " ) ) ; <nl> + <nl> + assertNumSolutions ( 1U ) ; <nl> + assertSolutionExists ( " { text : { prefix : { a : 3 } , search : ' foo ' } } " ) ; <nl> + } <nl> + <nl> + / / SERVER - 13039 : Test that we don ' t generate invalid solutions when the TEXT node <nl> + / / is buried beneath a logical node . <nl> + TEST_F ( QueryPlannerTest , TextInsideOrBasic ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { a : 0 , $ or : [ { _id : 1 } , { $ text : { $ search : ' foo ' } } ] } " ) ) ; <nl> + <nl> + assertNumSolutions ( 1U ) ; <nl> + assertSolutionExists ( " { fetch : { filter : { a : 0 } , node : { or : { nodes : [ " <nl> + " { text : { search : ' foo ' } } , " <nl> + " { ixscan : { filter : null , pattern : { _id : 1 } } } ] } } } } " ) ; <nl> + } <nl> + <nl> + / / SERVER - 13039 <nl> + TEST_F ( QueryPlannerTest , TextInsideOrWithAnotherOr ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { $ and : [ { $ or : [ { a : 3 } , { a : 4 } ] } , " <nl> + " { $ or : [ { $ text : { $ search : ' foo ' } } , { a : 5 } ] } ] } " ) ) ; <nl> + <nl> + assertNumSolutions ( 1U ) ; <nl> + assertSolutionExists ( " { fetch : { filter : { $ or : [ { a : 3 } , { a : 4 } ] } , node : " <nl> + " { or : { nodes : [ " <nl> + " { text : { search : ' foo ' } } , " <nl> + " { ixscan : { filter : null , pattern : { a : 1 } } } ] } } } } " ) ; <nl> + } <nl> + <nl> + / / SERVER - 13039 <nl> + TEST_F ( QueryPlannerTest , TextInsideOrOfAnd ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { $ or : [ { a : { $ gt : 1 , $ gt : 2 } } , " <nl> + " { a : { $ gt : 3 } , $ text : { $ search : ' foo ' } } ] } " ) ) ; <nl> + <nl> + assertNumSolutions ( 1U ) ; <nl> + assertSolutionExists ( " { fetch : { filter : null , node : { or : { nodes : [ " <nl> + " { ixscan : { filter : null , pattern : { a : 1 } , bounds : " <nl> + " { a : [ [ 2 , Infinity , false , true ] ] } } } , " <nl> + " { fetch : { filter : { a : { $ gt : 3 } } , node : " <nl> + " { text : { search : ' foo ' } } } } ] } } } } " ) ; <nl> + } <nl> + <nl> + / / SERVER - 13039 <nl> + TEST_F ( QueryPlannerTest , TextInsideAndOrAnd ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " b " < < 1 ) ) ; <nl> + addIndex ( BSON ( " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { a : 1 , $ or : [ { a : 2 } , { b : 2 } , " <nl> + " { a : 1 , $ text : { $ search : ' foo ' } } ] } " ) ) ; <nl> + <nl> + assertNumSolutions ( 1U ) ; <nl> + assertSolutionExists ( " { fetch : { filter : { a : 1 } , node : { or : { nodes : [ " <nl> + " { ixscan : { filter : null , pattern : { a : 1 } } } , " <nl> + " { fetch : { filter : { a : 1 } , node : { text : { search : ' foo ' } } } } , " <nl> + " { ixscan : { filter : null , pattern : { b : 1 } } } ] } } } } " ) ; <nl> + } <nl> + <nl> + / / SERVER - 13039 <nl> + TEST_F ( QueryPlannerTest , TextInsideAndOrAndOr ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { $ or : [ { a : { $ gt : 1 , $ gt : 2 } } , " <nl> + " { a : { $ gt : 3 } , $ or : [ { $ text : { $ search : ' foo ' } } , " <nl> + " { a : 6 } ] } ] , " <nl> + " a : 5 } " ) ) ; <nl> + <nl> + assertNumSolutions ( 1U ) ; <nl> + assertSolutionExists ( " { fetch : { filter : { a : 5 } , node : { or : { nodes : [ " <nl> + " { ixscan : { filter : null , pattern : { a : 1 } } } , " <nl> + " { fetch : { filter : { a : { $ gt : 3 } } , node : { or : { nodes : [ " <nl> + " { text : { search : ' foo ' } } , " <nl> + " { ixscan : { filter : null , pattern : { a : 1 } } } ] } } } } ] } } } } " ) ; <nl> + } <nl> + <nl> + / / If only one branch of the $ or can be indexed , then no indexed <nl> + / / solutions are generated , even if one branch is $ text . <nl> + TEST_F ( QueryPlannerTest , TextInsideOrOneBranchNotIndexed ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { a : 1 , $ or : [ { b : 2 } , { $ text : { $ search : ' foo ' } } ] } " ) ) ; <nl> + <nl> + assertNumSolutions ( 0 ) ; <nl> + } <nl> + <nl> + / / If the unindexable $ or is not the one containing the $ text predicate , <nl> + / / then we should still be able to generate an indexed solution . <nl> + TEST_F ( QueryPlannerTest , TextInsideOrWithAnotherUnindexableOr ) { <nl> + params . options = QueryPlannerParams : : NO_TABLE_SCAN ; <nl> + addIndex ( BSON ( " a " < < 1 ) ) ; <nl> + addIndex ( BSON ( " _fts " < < " text " < < " _ftsx " < < 1 ) ) ; <nl> + runQuery ( fromjson ( " { $ and : [ { $ or : [ { a : 1 } , { b : 1 } ] } , " <nl> + " { $ or : [ { a : 2 } , { $ text : { $ search : ' foo ' } } ] } ] } " ) ) ; <nl> + <nl> + assertNumSolutions ( 1U ) ; <nl> + assertSolutionExists ( " { fetch : { filter : { $ or : [ { a : 1 } , { b : 1 } ] } , node : { or : { nodes : [ " <nl> + " { text : { search : ' foo ' } } , " <nl> + " { ixscan : { filter : null , pattern : { a : 1 } } } ] } } } } " ) ; <nl> + } <nl> + <nl> } / / namespace <nl>
SERVER - 13039 handle subnodes which require an index during plan enumeration
mongodb/mongo
25596dbf48b18a76d3d2cdfdf1fcf23a43e46316
2014-03-10T20:02:02Z
mmm a / ports / boost / CONTROL <nl> ppp b / ports / boost / CONTROL <nl> <nl> Source : boost <nl> - Version : 1 . 64 - 4 <nl> + Version : 1 . 64 - 5 <nl> Description : Peer - reviewed portable C + + source libraries <nl> Build - Depends : zlib , bzip2 <nl> mmm a / ports / boost / portfile . cmake <nl> ppp b / ports / boost / portfile . cmake <nl> file ( <nl> file ( APPEND $ { CURRENT_PACKAGES_DIR } / include / boost / config / user . hpp <nl> " \ n # define BOOST_ALL_NO_LIB \ n " <nl> ) <nl> + file ( APPEND $ { CURRENT_PACKAGES_DIR } / include / boost / config / user . hpp <nl> + " \ n # undef BOOST_ALL_DYN_LINK \ n " <nl> + ) <nl> <nl> if ( VCPKG_LIBRARY_LINKAGE STREQUAL dynamic ) <nl> file ( APPEND $ { CURRENT_PACKAGES_DIR } / include / boost / config / user . hpp <nl>
Merge pull request from codicodi / boost - dyn - link - fix
microsoft/vcpkg
42450bfdfff62f6fa9330f0f9873f37689331b45
2017-05-31T02:27:16Z
mmm a / src / compiler / js - native - context - specialization . cc <nl> ppp b / src / compiler / js - native - context - specialization . cc <nl> Reduction JSNativeContextSpecialization : : ReduceJSLoadGlobal ( Node * node ) { <nl> <nl> DCHECK ( nexus . kind ( ) = = FeedbackSlotKind : : kLoadGlobalInsideTypeof | | <nl> nexus . kind ( ) = = FeedbackSlotKind : : kLoadGlobalNotInsideTypeof ) ; <nl> - if ( nexus . GetFeedback ( ) - > IsCleared ( ) ) return NoChange ( ) ; <nl> + if ( nexus . ic_state ( ) ! = MONOMORPHIC | | nexus . GetFeedback ( ) - > IsCleared ( ) ) { <nl> + return NoChange ( ) ; <nl> + } <nl> Handle < Object > feedback ( nexus . GetFeedback ( ) - > GetHeapObjectOrSmi ( ) , isolate ( ) ) ; <nl> <nl> if ( feedback - > IsSmi ( ) ) { <nl> Reduction JSNativeContextSpecialization : : ReduceJSStoreGlobal ( Node * node ) { <nl> <nl> DCHECK ( nexus . kind ( ) = = FeedbackSlotKind : : kStoreGlobalSloppy | | <nl> nexus . kind ( ) = = FeedbackSlotKind : : kStoreGlobalStrict ) ; <nl> - if ( nexus . GetFeedback ( ) - > IsCleared ( ) ) return NoChange ( ) ; <nl> + if ( nexus . ic_state ( ) ! = MONOMORPHIC | | nexus . GetFeedback ( ) - > IsCleared ( ) ) { <nl> + return NoChange ( ) ; <nl> + } <nl> Handle < Object > feedback ( nexus . GetFeedback ( ) - > GetHeapObjectOrSmi ( ) , isolate ( ) ) ; <nl> <nl> if ( feedback - > IsSmi ( ) ) { <nl> mmm a / test / cctest / test - api . cc <nl> ppp b / test / cctest / test - api . cc <nl> THREADED_TEST ( ShadowObjectAndDataProperty ) { <nl> CHECK ( heap_object - > IsPropertyCell ( ) ) ; <nl> } <nl> <nl> + THREADED_TEST ( ShadowObjectAndDataPropertyTurbo ) { <nl> + / / This test is the same as the previous one except that it triggers <nl> + / / optimization of { foo } after its first invocation . <nl> + i : : FLAG_allow_natives_syntax = true ; <nl> + <nl> + if ( i : : FLAG_lite_mode ) return ; <nl> + v8 : : Isolate * isolate = CcTest : : isolate ( ) ; <nl> + v8 : : HandleScope handle_scope ( isolate ) ; <nl> + <nl> + Local < ObjectTemplate > global_template = v8 : : ObjectTemplate : : New ( isolate ) ; <nl> + LocalContext context ( nullptr , global_template ) ; <nl> + <nl> + Local < v8 : : FunctionTemplate > t = v8 : : FunctionTemplate : : New ( isolate ) ; <nl> + t - > InstanceTemplate ( ) - > SetHandler ( <nl> + v8 : : NamedPropertyHandlerConfiguration ( ShadowNamedGet ) ) ; <nl> + <nl> + Local < Value > o = t - > GetFunction ( context . local ( ) ) <nl> + . ToLocalChecked ( ) <nl> + - > NewInstance ( context . local ( ) ) <nl> + . ToLocalChecked ( ) ; <nl> + CHECK ( context - > Global ( ) <nl> + - > Set ( context . local ( ) , v8_str ( " __proto__ " ) , o ) <nl> + . FromJust ( ) ) ; <nl> + <nl> + CompileRun ( <nl> + " function foo ( x ) { i = x ; } " <nl> + " foo ( 0 ) " ) ; <nl> + <nl> + i : : Handle < i : : JSFunction > foo ( i : : Handle < i : : JSFunction > : : cast ( <nl> + v8 : : Utils : : OpenHandle ( * context - > Global ( ) <nl> + - > Get ( context . local ( ) , v8_str ( " foo " ) ) <nl> + . ToLocalChecked ( ) ) ) ) ; <nl> + CHECK ( foo - > has_feedback_vector ( ) ) ; <nl> + i : : FeedbackSlot slot = i : : FeedbackVector : : ToSlot ( 0 ) ; <nl> + i : : FeedbackNexus nexus ( foo - > feedback_vector ( ) , slot ) ; <nl> + CHECK_EQ ( i : : FeedbackSlotKind : : kStoreGlobalSloppy , nexus . kind ( ) ) ; <nl> + CHECK_EQ ( i : : PREMONOMORPHIC , nexus . StateFromFeedback ( ) ) ; <nl> + CompileRun ( " % OptimizeFunctionOnNextCall ( foo ) ; foo ( 1 ) " ) ; <nl> + CHECK_EQ ( i : : MONOMORPHIC , nexus . StateFromFeedback ( ) ) ; <nl> + i : : HeapObject heap_object ; <nl> + CHECK ( nexus . GetFeedback ( ) . GetHeapObject ( & heap_object ) ) ; <nl> + CHECK ( heap_object - > IsPropertyCell ( ) ) ; <nl> + } <nl> + <nl> THREADED_TEST ( SetPrototype ) { <nl> LocalContext context ; <nl> v8 : : Isolate * isolate = context - > GetIsolate ( ) ; <nl>
[ turbofan ] Fix optimization of global loads and stores
v8/v8
87c985f50aa4400d0410aed19bb72752e4f1ba0e
2019-02-13T12:26:59Z
mmm a / tensorflow / compiler / mlir / lite / flatbuffer_import . cc <nl> ppp b / tensorflow / compiler / mlir / lite / flatbuffer_import . cc <nl> StatusOr < FuncOp > ConvertSubgraph ( <nl> subgraph , & builder , " outputs " , func_outputs ) ) ; <nl> } <nl> func . setAttr ( " tf . entry_function " , builder . getDictionaryAttr ( attributes ) ) ; <nl> + } else { <nl> + func . setVisibility ( FuncOp : : Visibility : : Private ) ; <nl> } <nl> <nl> absl : : flat_hash_set < const tflite : : OperatorT * > pruned_subgraph_ops ; <nl> mmm a / tensorflow / compiler / mlir / lite / tests / optimize_functional_ops . mlir <nl> ppp b / tensorflow / compiler / mlir / lite / tests / optimize_functional_ops . mlir <nl> func @ main ( % arg0 : tensor < f32 > , % arg1 : tensor < f32 > ) - > ( tensor < f32 > ) { <nl> return % 3 : tensor < f32 > <nl> } <nl> <nl> - / / CHECK - NOT : add <nl> - / / CHECK - NOT : sub <nl> - func @ add ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> + func @ add ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > attributes { sym_visibility = " private " } { <nl> % 0 = " tf . Add " ( % arg0 , % arg1 ) : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> return % 0 : tensor < * xf32 > <nl> } <nl> <nl> - func @ sub ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> + func @ sub ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > attributes { sym_visibility = " private " } { <nl> % 0 = " tf . Sub " ( % arg0 , % arg1 ) : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> return % 0 : tensor < * xf32 > <nl> } <nl> func @ main ( % arg0 : tensor < f32 > , % arg1 : tensor < f32 > ) - > ( tensor < f32 > ) { <nl> return % 3 : tensor < f32 > <nl> } <nl> <nl> - / / CHECK - NOT : addormul <nl> - / / CHECK - NOT : sub <nl> - / / CHECK - NOT : mul <nl> - / / CHECK - NOT : add <nl> - <nl> - func @ addormul ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> + func @ addormul ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > attributes { sym_visibility = " private " } { <nl> % 0 = constant dense < false > : tensor < i1 > <nl> % 1 = " tf . If " ( % 0 , % arg1 , % arg0 ) { else_branch = @ mul , then_branch = @ add , is_stateless = true } : ( tensor < i1 > , tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> return % 1 : tensor < * xf32 > <nl> } <nl> <nl> - func @ sub ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> + func @ sub ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > attributes { sym_visibility = " private " } { <nl> % 0 = " tf . Sub " ( % arg0 , % arg1 ) : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> return % 0 : tensor < * xf32 > <nl> } <nl> <nl> - func @ add ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> + func @ add ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > attributes { sym_visibility = " private " } { <nl> % 0 = " tf . Add " ( % arg0 , % arg1 ) : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> return % 0 : tensor < * xf32 > <nl> } <nl> <nl> - func @ mul ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> + func @ mul ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > attributes { sym_visibility = " private " } { <nl> % 0 = " tf . Multiply " ( % arg0 , % arg1 ) : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> return % 0 : tensor < * xf32 > <nl> } <nl> <nl> / / mmm - - <nl> <nl> - / / Verify that branch functions with multiple references are not erased . <nl> - <nl> - func @ main ( % arg0 : tensor < f32 > , % arg1 : tensor < f32 > , % arg2 : tensor < i1 > ) - > ( tensor < f32 > , tensor < f32 > ) { <nl> - % 0 = " tf . Placeholder . input " ( % arg0 ) : ( tensor < f32 > ) - > tensor < f32 > <nl> - % 1 = " tf . Placeholder . input " ( % arg1 ) : ( tensor < f32 > ) - > tensor < f32 > <nl> - % 2 = constant dense < true > : tensor < i1 > <nl> - <nl> - / / CHECK : tf . Add <nl> - % 3 = " tf . If " ( % 2 , % 0 , % 1 ) { else_branch = @ sub , then_branch = @ add , is_stateless = true } : ( tensor < i1 > , tensor < f32 > , tensor < f32 > ) - > tensor < f32 > <nl> - <nl> - / / CHECK : tf . If <nl> - % 4 = " tf . If " ( % arg2 , % 0 , % 1 ) { else_branch = @ sub , then_branch = @ add , is_stateless = true } : ( tensor < i1 > , tensor < f32 > , tensor < f32 > ) - > tensor < f32 > <nl> - return % 3 , % 4 : tensor < f32 > , tensor < f32 > <nl> - } <nl> - <nl> - / / CHECK : add <nl> - / / CHECK : sub <nl> - func @ add ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> - % 0 = " tf . Add " ( % arg0 , % arg1 ) : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> - return % 0 : tensor < * xf32 > <nl> - } <nl> - <nl> - func @ sub ( % arg0 : tensor < * xf32 > , % arg1 : tensor < * xf32 > ) - > tensor < * xf32 > { <nl> - % 0 = " tf . Sub " ( % arg0 , % arg1 ) : ( tensor < * xf32 > , tensor < * xf32 > ) - > tensor < * xf32 > <nl> - return % 0 : tensor < * xf32 > <nl> - } <nl> - <nl> - / / mmm - - <nl> - <nl> - / / Verify unused if with functions without side - effects are removed . <nl> - <nl> + / / Verify unused if with functions without side - effects is removed . <nl> + / / CHECK - LABEL : main <nl> func @ main ( % arg0 : tensor < 3x15x14x3xf32 > ) - > tensor < 3x15x14x8xf32 > <nl> attributes { tf . entry_function = { inputs = " input " , outputs = " Conv2D " } } { <nl> % cst = constant dense < [ 0 , 1 , 2 , 3 ] > : tensor < 4xi32 > <nl> func @ main ( % arg0 : tensor < 3x15x14x3xf32 > ) - > tensor < 3x15x14x8xf32 > <nl> return % 4 : tensor < 3x15x14x8xf32 > <nl> } <nl> <nl> - func @ _functionalize_if_else_branch_00 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > { <nl> + func @ _functionalize_if_else_branch_00 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > attributes { sym_visibility = " private " } { <nl> % cst = constant dense < false > : tensor < i1 > <nl> return % cst : tensor < i1 > <nl> } <nl> <nl> - func @ _functionalize_if_then_branch_00 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > { <nl> + func @ _functionalize_if_then_branch_00 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > attributes { sym_visibility = " private " } { <nl> % cst = constant dense < true > : tensor < i1 > <nl> return % cst : tensor < i1 > <nl> } <nl> - <nl> - / / CHECK : func @ main <nl> / / CHECK - NOT : tf . If <nl> / / CHECK : return <nl> - / / CHECK - NOT : func @ _functionalize_if_else_branch_00 <nl> - / / CHECK - NOT : func @ _functionalize_if_then_branch_00 <nl> <nl> / / mmm - - <nl> <nl> / / Verify unused if with function with side - effects is not removed . <nl> - <nl> + / / CHECK - LABEL : main <nl> func @ main ( % arg0 : tensor < 3x15x14x3xf32 > ) - > tensor < 3x15x14x8xf32 > <nl> attributes { tf . entry_function = { inputs = " input " , outputs = " Conv2D " } } { <nl> % cst = constant dense < [ 0 , 1 , 2 , 3 ] > : tensor < 4xi32 > <nl> func @ main ( % arg0 : tensor < 3x15x14x3xf32 > ) - > tensor < 3x15x14x8xf32 > <nl> return % 4 : tensor < 3x15x14x8xf32 > <nl> } <nl> <nl> - func @ _functionalize_if_else_branch_01 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > { <nl> + func @ _functionalize_if_else_branch_01 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > attributes { sym_visibility = " private " } { <nl> % cst = constant dense < false > : tensor < i1 > <nl> return % cst : tensor < i1 > <nl> } <nl> <nl> - func @ _functionalize_if_then_branch_01 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > { <nl> + func @ _functionalize_if_then_branch_01 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > attributes { sym_visibility = " private " } { <nl> % 0 = " tf . blah " ( ) : ( ) - > tensor < i1 > <nl> return % 0 : tensor < i1 > <nl> } <nl> <nl> - / / CHECK : func @ main <nl> / / CHECK : tf . If <nl> / / CHECK : return <nl> - / / CHECK : func @ _functionalize_if_else_branch_01 <nl> - / / CHECK : func @ _functionalize_if_then_branch_01 <nl> <nl> / / mmm - - <nl> <nl> / / Verify unused if with function with side - effects is removed if op says <nl> / / stateless . <nl> <nl> + / / CHECK - LABEL : main <nl> func @ main ( % arg0 : tensor < 3x15x14x3xf32 > ) - > tensor < 3x15x14x8xf32 > <nl> attributes { tf . entry_function = { inputs = " input " , outputs = " Conv2D " } } { <nl> % cst = constant dense < [ 0 , 1 , 2 , 3 ] > : tensor < 4xi32 > <nl> func @ main ( % arg0 : tensor < 3x15x14x3xf32 > ) - > tensor < 3x15x14x8xf32 > <nl> return % 4 : tensor < 3x15x14x8xf32 > <nl> } <nl> <nl> - func @ _functionalize_if_else_branch_02 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > { <nl> + func @ _functionalize_if_else_branch_02 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > attributes { sym_visibility = " private " } { <nl> % cst = constant dense < false > : tensor < i1 > <nl> return % cst : tensor < i1 > <nl> } <nl> <nl> - func @ _functionalize_if_then_branch_02 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > { <nl> + func @ _functionalize_if_then_branch_02 ( % arg0 : tensor < * xi1 > , % arg1 : tensor < * xf32 > , % arg2 : tensor < * xf32 > ) - > tensor < i1 > attributes { sym_visibility = " private " } { <nl> % 0 = " tf . blah " ( ) : ( ) - > tensor < i1 > <nl> return % 0 : tensor < i1 > <nl> } <nl> <nl> - / / CHECK : func @ main <nl> / / CHECK - NOT : tf . If <nl> / / CHECK : return <nl> - / / CHECK - NOT : func @ _functionalize_if_else_branch_02 <nl> - / / CHECK - NOT : func @ _functionalize_if_then_branch_02 <nl> mmm a / tensorflow / compiler / mlir / lite / tf_tfl_passes . cc <nl> ppp b / tensorflow / compiler / mlir / lite / tf_tfl_passes . cc <nl> void AddTFToTFLConversionPasses ( const mlir : : TFL : : PassConfig & pass_config , <nl> pass_manager - > addPass ( mlir : : TFL : : CreatePrepareCompositeFunctionsPass ( ) ) ; <nl> } <nl> <nl> - / / This pass marks non - exported functions as symbol visibility ' private ' <nl> - / / those deemed read - only as immutable . <nl> - pass_manager - > addPass ( <nl> - mlir : : tf_saved_model : : <nl> - CreateMarkFunctionVisibilityUsingSavedModelLinkagePass ( ) ) ; <nl> - <nl> pass_manager - > addPass ( mlir : : createInlinerPass ( ) ) ; <nl> pass_manager - > addPass ( mlir : : createSymbolDCEPass ( ) ) ; <nl> <nl> void AddTFToTFLConversionPasses ( const mlir : : TFL : : PassConfig & pass_config , <nl> / / so that it can target constants introduced once TensorFlow Identity ops <nl> / / are removed during legalization . <nl> pass_manager - > addPass ( mlir : : TFL : : CreateOptimizeFunctionalOpsPass ( ) ) ; <nl> + pass_manager - > addPass ( mlir : : createSymbolDCEPass ( ) ) ; <nl> pass_manager - > addNestedPass < mlir : : FuncOp > ( mlir : : createCanonicalizerPass ( ) ) ; <nl> pass_manager - > addNestedPass < mlir : : FuncOp > ( mlir : : createCSEPass ( ) ) ; <nl> / / This pass should be always at the end of the floating point model <nl> void CreateTFLStandardPipeline ( OpPassManager & pm , <nl> mlir : : TFL : : CreateLegalizeTFPass ( / * run_tfl_runtime_verification = * / true ) ) ; <nl> pm . addPass ( mlir : : TFL : : CreateOptimizePass ( ) ) ; <nl> pm . addPass ( mlir : : TFL : : CreateOptimizeFunctionalOpsPass ( ) ) ; <nl> + pm . addPass ( mlir : : createSymbolDCEPass ( ) ) ; <nl> <nl> / / Canonicalize , CSE etc . <nl> pm . addNestedPass < mlir : : FuncOp > ( mlir : : createCanonicalizerPass ( ) ) ; <nl> mmm a / tensorflow / compiler / mlir / lite / transforms / optimize_functional_ops . cc <nl> ppp b / tensorflow / compiler / mlir / lite / transforms / optimize_functional_ops . cc <nl> namespace mlir { <nl> namespace TFL { <nl> namespace { <nl> <nl> - using FuncSet = llvm : : SmallSet < FuncOp , 4 > ; <nl> - <nl> / / Module pass to optimize TensorFlow functional ops . <nl> struct OptimizeFunctionalOpsPass <nl> : public PassWrapper < OptimizeFunctionalOpsPass , OperationPass < ModuleOp > > { <nl> struct OptimizeFunctionalOpsPass <nl> / / op operands ' types . <nl> / / <nl> / / Requires the function has exactly one block . <nl> - static void UpdateFuncType ( FuncOp func ) { <nl> - Operation * terminator = & func . getBlocks ( ) . front ( ) . back ( ) ; <nl> + void UpdateFuncType ( FuncOp func ) { <nl> + Operation * terminator = func . front ( ) . getTerminator ( ) ; <nl> auto return_types = llvm : : to_vector < 4 > ( terminator - > getOperandTypes ( ) ) ; <nl> <nl> FunctionType func_type = func . getType ( ) ; <nl> static void UpdateFuncType ( FuncOp func ) { <nl> } <nl> <nl> / / TODO ( jpienaar ) : Remove when recursive side - effect modeling is added . <nl> - static bool IsSideEffectFree ( FuncOp func ) { <nl> + bool IsSideEffectFree ( FuncOp func ) { <nl> return ! func . getBody ( ) <nl> . walk ( [ & ] ( Operation * op ) { <nl> if ( ! MemoryEffectOpInterface : : hasNoEffect ( op ) & & <nl> static bool IsSideEffectFree ( FuncOp func ) { <nl> / / function body based on the conditional value . <nl> class FoldIfOp : public OpRewritePattern < TF : : IfOp > { <nl> public : <nl> - explicit FoldIfOp ( MLIRContext * context , FuncSet * inlined_funcs ) <nl> - : OpRewritePattern < TF : : IfOp > ( context ) , inlined_funcs_ ( inlined_funcs ) { } <nl> + explicit FoldIfOp ( MLIRContext * context ) <nl> + : OpRewritePattern < TF : : IfOp > ( context ) { } <nl> <nl> LogicalResult matchAndRewrite ( TF : : IfOp op , <nl> PatternRewriter & rewriter ) const override { <nl> class FoldIfOp : public OpRewritePattern < TF : : IfOp > { <nl> / / updated if operands ' shapes change after inlining . Without this <nl> / / restriction , it would require tensor cast ops . <nl> FuncOp parent_op = op . getParentOfType < FuncOp > ( ) ; <nl> - if ( parent_op . getBlocks ( ) . size ( ) ! = 1 ) return failure ( ) ; <nl> + if ( ! llvm : : hasSingleElement ( parent_op ) ) return failure ( ) ; <nl> <nl> / / Find the then and else branch functions . <nl> SymbolTable table ( op . getParentOfType < ModuleOp > ( ) ) ; <nl> class FoldIfOp : public OpRewritePattern < TF : : IfOp > { <nl> if ( op . use_empty ( ) & & <nl> ( op . is_stateless ( ) | | <nl> ( IsSideEffectFree ( then_branch ) & & IsSideEffectFree ( else_branch ) ) ) ) { <nl> - inlined_funcs_ - > insert ( then_branch ) ; <nl> - inlined_funcs_ - > insert ( else_branch ) ; <nl> rewriter . eraseOp ( op . getOperation ( ) ) ; <nl> return success ( ) ; <nl> } <nl> class FoldIfOp : public OpRewritePattern < TF : : IfOp > { <nl> / / Make sure that the function has exactly one block to simplify inlining . <nl> / / TFLite doesn ' t use control flow with blocks so functions with more than <nl> / / one blocks are not encountered in practice . <nl> - if ( func . getBody ( ) . getBlocks ( ) . size ( ) ! = 1 ) return failure ( ) ; <nl> + if ( ! llvm : : hasSingleElement ( func ) ) return failure ( ) ; <nl> <nl> BlockAndValueMapping mapper ; <nl> for ( int i = 0 , e = func . getNumArguments ( ) ; i ! = e ; + + i ) <nl> mapper . map ( func . getArgument ( i ) , op . getOperand ( i + 1 ) ) ; <nl> <nl> llvm : : SmallVector < Value , 4 > updated_results ; <nl> - for ( auto & op_to_inline : func . getBody ( ) . front ( ) ) { <nl> + for ( auto & op_to_inline : func . front ( ) ) { <nl> / / If this is a terminator , identify the values to use to replace the <nl> / / original If op . <nl> if ( op_to_inline . isKnownTerminator ( ) ) { <nl> class FoldIfOp : public OpRewritePattern < TF : : IfOp > { <nl> / / return type should be updated . <nl> UpdateFuncType ( parent_op ) ; <nl> <nl> - / / Track functions that could be erased if this op was the last reference <nl> - / / of the function . <nl> - inlined_funcs_ - > insert ( then_branch ) ; <nl> - inlined_funcs_ - > insert ( else_branch ) ; <nl> return success ( ) ; <nl> } <nl> - <nl> - private : <nl> - FuncSet * inlined_funcs_ ; <nl> } ; <nl> <nl> - / / Erases functions from the given candidates that are not referenced by any of <nl> - / / the ops in the module . <nl> - static void EraseDeadFuncs ( const FuncSet & candidate_funcs , ModuleOp module ) { <nl> - if ( candidate_funcs . empty ( ) ) return ; <nl> - <nl> - SymbolTable manager ( module ) ; <nl> - <nl> - / / Identify the functions that are used as symbols in the module and shouldn ' t <nl> - / / be erased . <nl> - FuncSet in_use_funcs ; <nl> - manager . getOp ( ) - > walk ( [ & ] ( Operation * op ) { <nl> - for ( auto attr : op - > getAttrs ( ) ) { <nl> - if ( auto symbol = attr . second . dyn_cast < FlatSymbolRefAttr > ( ) ) { <nl> - auto func = manager . lookup < FuncOp > ( symbol . getValue ( ) ) ; <nl> - in_use_funcs . insert ( func ) ; <nl> - } <nl> - } <nl> - } ) ; <nl> - <nl> - for ( FuncOp func : candidate_funcs ) { <nl> - if ( ! in_use_funcs . count ( func ) ) manager . erase ( func ) ; <nl> - } <nl> - } <nl> - <nl> void OptimizeFunctionalOpsPass : : runOnOperation ( ) { <nl> OwningRewritePatternList patterns ; <nl> <nl> - FuncSet inlined_funcs ; <nl> - patterns . insert < FoldIfOp > ( & getContext ( ) , & inlined_funcs ) ; <nl> + patterns . insert < FoldIfOp > ( & getContext ( ) ) ; <nl> <nl> ModuleOp module = getOperation ( ) ; <nl> applyPatternsAndFoldGreedily ( module , patterns ) ; <nl> - <nl> - / / Erase inlined functions that don ' t have any references . <nl> - / / <nl> - / / TODO ( hinsu ) : Update this to not erase entry points once TFLite support to <nl> - / / have multiple entry points is implemented . Until then , it is safe to <nl> - / / erase these functions . <nl> - EraseDeadFuncs ( inlined_funcs , module ) ; <nl> } <nl> + <nl> + PassRegistration < OptimizeFunctionalOpsPass > pass ( <nl> + " tfl - optimize - functional - ops " , " Optimize TensorFlow functional ops " ) ; <nl> } / / namespace <nl> <nl> std : : unique_ptr < OperationPass < ModuleOp > > CreateOptimizeFunctionalOpsPass ( ) { <nl> return std : : make_unique < OptimizeFunctionalOpsPass > ( ) ; <nl> } <nl> <nl> - static PassRegistration < OptimizeFunctionalOpsPass > pass ( <nl> - " tfl - optimize - functional - ops " , " Optimize TensorFlow functional ops " ) ; <nl> } / / namespace TFL <nl> } / / namespace mlir <nl> mmm a / tensorflow / compiler / mlir / tensorflow / tests / graphdef2mlir / function - func - attr . pbtxt <nl> ppp b / tensorflow / compiler / mlir / tensorflow / tests / graphdef2mlir / function - func - attr . pbtxt <nl> library { <nl> } <nl> } <nl> <nl> - # CHECK - DAG : func @ custom_relu { { [ 0 - 9 ] * } } ( ) attributes { tf . _implements = # tf . func < @ tensorflow . relu , { } > } <nl> - # CHECK - DAG : func @ custom_embedding_matmul { { [ 0 - 9 ] * } } ( ) attributes { tf . _implements = # tf . func < @ tensorflow . embedding_matmul , { key1 = 2 : i64 , key2 = false } > } <nl> + # CHECK - DAG : func @ custom_relu { { [ 0 - 9 ] * } } ( ) { { . + } } tf . _implements = # tf . func < @ tensorflow . relu , { } > } <nl> + # CHECK - DAG : func @ custom_embedding_matmul { { [ 0 - 9 ] * } } ( ) { { . + } } tf . _implements = # tf . func < @ tensorflow . embedding_matmul , { key1 = 2 : i64 , key2 = false } > } <nl> mmm a / tensorflow / compiler / mlir / tensorflow / tests / graphdef2mlir / graph - function - name - bug . pbtxt <nl> ppp b / tensorflow / compiler / mlir / tensorflow / tests / graphdef2mlir / graph - function - name - bug . pbtxt <nl> versions { <nl> # CHECK : " tf . LegacyCall " ( ) { _disable_call_shape_inference = false , f = @ foo110 } <nl> # CHECK : " tf . LegacyCall " ( ) { _disable_call_shape_inference = false , f = @ foo111 } <nl> <nl> - # CHECK - LABEL : func @ foo110 ( ) { <nl> - # CHECK - LABEL : func @ foo111 ( ) { <nl> + # CHECK - LABEL : func @ foo110 ( ) attributes { sym_visibility = " private " } <nl> + # CHECK - LABEL : func @ foo111 ( ) attributes { sym_visibility = " private " } <nl> mmm a / tensorflow / compiler / mlir / tensorflow / tests / graphdef2mlir / graph - library . pbtxt <nl> ppp b / tensorflow / compiler / mlir / tensorflow / tests / graphdef2mlir / graph - library . pbtxt <nl> versions { <nl> # CHECK : " tf . LegacyCall " ( ) { _disable_call_shape_inference = true , f = @ foo0 } <nl> # CHECK : " tf . LegacyCall " ( ) { _disable_call_shape_inference = false , f = @ bar0 } <nl> <nl> - # CHECK - LABEL : func @ foo0 ( ) { <nl> + # CHECK - LABEL : func @ foo0 ( ) attributes { sym_visibility = " private " } <nl> # CHECK : " tf . LegacyCall " ( ) { _disable_call_shape_inference = false , f = @ bar0 } <nl> <nl> - # CHECK - LABEL : func @ bar0 ( ) { <nl> + # CHECK - LABEL : func @ bar0 ( ) attributes { sym_visibility = " private " } <nl> mmm a / tensorflow / compiler / mlir / tensorflow / translate / import_model . cc <nl> ppp b / tensorflow / compiler / mlir / tensorflow / translate / import_model . cc <nl> class ImporterBase { <nl> const absl : : InlinedVector < OutputTensor , 4 > & arg_nodes , <nl> const absl : : InlinedVector < OutputTensor , 4 > & ret_nodes , <nl> const absl : : InlinedVector < Node * , 4 > & control_ret_nodes , <nl> - llvm : : ArrayRef < mlir : : NamedAttribute > attrs , <nl> - bool function_graph ) ; <nl> + llvm : : ArrayRef < mlir : : NamedAttribute > attrs ) ; <nl> <nl> / / Finds out the function definition for the given function name from the <nl> / / graph and converts it to a function of the module . This method is called <nl> Status ImporterBase : : ConvertLibFunction ( llvm : : StringRef func_name ) { <nl> <nl> TF_RETURN_IF_ERROR ( child_importer . Convert ( <nl> mlir_func_name , func_type , arg_nodes , ret_nodes , control_ret_nodes , <nl> - llvm : : makeArrayRef ( attributes . begin ( ) , attributes . end ( ) ) , <nl> - / * function_graph = * / true ) ) ; <nl> + llvm : : makeArrayRef ( attributes . begin ( ) , attributes . end ( ) ) ) ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> Status ImporterBase : : Convert ( <nl> const absl : : InlinedVector < OutputTensor , 4 > & arg_nodes , <nl> const absl : : InlinedVector < OutputTensor , 4 > & ret_nodes , <nl> const absl : : InlinedVector < Node * , 4 > & control_ret_nodes , <nl> - llvm : : ArrayRef < mlir : : NamedAttribute > attrs , bool function_graph ) { <nl> + llvm : : ArrayRef < mlir : : NamedAttribute > attrs ) { <nl> / / TODO ( b / 122040776 ) : Uses debug info for FunctionDef . <nl> auto function = mlir : : FuncOp : : create ( mlir : : UnknownLoc : : get ( context_ ) , <nl> func_name , func_type , attrs ) ; <nl> StatusOr < mlir : : OwningModuleRef > GraphDefImporter : : Convert ( <nl> PopulateTfVersions ( module . get ( ) , graph . versions ( ) ) ; <nl> <nl> TF_RETURN_IF_ERROR ( importer . ImporterBase : : Convert ( <nl> - func_name , func_type , arg_nodes , ret_nodes , control_ret_nodes , attrs , <nl> - specs . graph_as_function ) ) ; <nl> + func_name , func_type , arg_nodes , ret_nodes , control_ret_nodes , attrs ) ) ; <nl> + <nl> + / / Mark main function public , others private . <nl> + for ( auto function : module . get ( ) . getOps < mlir : : FuncOp > ( ) ) { <nl> + auto visibility = function . getName ( ) = = func_name <nl> + ? mlir : : FuncOp : : Visibility : : Public <nl> + : mlir : : FuncOp : : Visibility : : Private ; <nl> + function . setVisibility ( visibility ) ; <nl> + } <nl> return module ; <nl> } <nl> <nl> void AdjustBoundInputArgTypes ( mlir : : ModuleOp module ) { <nl> } <nl> } <nl> <nl> + / / Marks the visibility of functions in the saved model module . <nl> + void MarkSavedModelFunctionVisibility ( mlir : : ModuleOp module ) { <nl> + for ( auto func : module . getOps < mlir : : FuncOp > ( ) ) { <nl> + auto visibility = mlir : : tf_saved_model : : IsExported ( func ) <nl> + ? mlir : : FuncOp : : Visibility : : Public <nl> + : mlir : : FuncOp : : Visibility : : Private ; <nl> + func . setVisibility ( visibility ) ; <nl> + } <nl> + } <nl> + <nl> / / Reorder the ops in the module to make testing easier and less dependent <nl> / / on implementation details such as the order of functions in the <nl> / / FunctionDefLibrary . <nl> Status CreateSavedModelIR ( <nl> AdjustBoundInputArgTypes ( module ) ; <nl> module . setAttr ( " tf_saved_model . semantics " , builder . getUnitAttr ( ) ) ; <nl> SortSavedModelModule ( module ) ; <nl> + MarkSavedModelFunctionVisibility ( module ) ; <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> SavedModelSignatureDefImporter : : ConvertSignatures ( ) { <nl> mlir : : OpBuilder builder ( module_ - > getBodyRegion ( ) ) ; <nl> module_ - > setAttr ( " tf_saved_model . semantics " , builder . getUnitAttr ( ) ) ; <nl> SortSavedModelModule ( * module_ ) ; <nl> + MarkSavedModelFunctionVisibility ( * module_ ) ; <nl> <nl> return std : : move ( module_ ) ; <nl> } <nl>
[ MLIR ] Determine function visibility during import
tensorflow/tensorflow
14b5803e260829a146d6c3162850a726859d9dfe
2020-06-12T18:53:36Z
mmm a / scons - tools / emscripten . py <nl> ppp b / scons - tools / emscripten . py <nl> def generate ( env ) : <nl> <nl> def depend_on_embedder ( target , source , env ) : <nl> env . Depends ( target , env [ ' JS_EMBEDDER ' ] ) <nl> + files = [ ] <nl> + for src in source : <nl> + for dirpath , dirnames , filenames in os . walk ( str ( src . srcnode ( ) ) ) : <nl> + files . extend ( map ( lambda p : os . path . join ( dirpath , p ) , filenames ) ) <nl> + env . Depends ( target , env . Value ( sorted ( files ) ) ) <nl> return target , source <nl> <nl> def embed_files_in_js ( target , source , env , for_signature ) : <nl> mmm a / src / embind / emval . js <nl> ppp b / src / embind / emval . js <nl> <nl> / * global new_ * / <nl> / * global createNamedFunction * / <nl> / * global readLatin1String , writeStringToMemory * / <nl> - / * global requireRegisteredType , throwBindingError * / <nl> + / * global requireRegisteredType , throwBindingError , runDestructors * / <nl> / * jslint sub : true * / / * The symbols ' fromWireType ' and ' toWireType ' must be accessed via array notation to be closure - safe since craftInvokerFunction crafts functions as strings that can ' t be closured . * / <nl> <nl> var Module = Module | | { } ; <nl> function __emval_decref ( handle ) { <nl> } <nl> } <nl> <nl> + function __emval_run_destructors ( handle ) { <nl> + var destructors = _emval_handle_array [ handle ] . value ; <nl> + runDestructors ( destructors ) ; <nl> + __emval_decref ( handle ) ; <nl> + } <nl> + <nl> function __emval_new_array ( ) { <nl> return __emval_register ( [ ] ) ; <nl> } <nl> function __emval_set_property ( handle , key , value ) { <nl> _emval_handle_array [ handle ] . value [ _emval_handle_array [ key ] . value ] = _emval_handle_array [ value ] . value ; <nl> } <nl> <nl> - function __emval_as ( handle , returnType ) { <nl> + function __emval_as ( handle , returnType , destructorsRef ) { <nl> requireHandle ( handle ) ; <nl> returnType = requireRegisteredType ( returnType , ' emval : : as ' ) ; <nl> var destructors = [ ] ; <nl> - / / caller owns destructing <nl> + var rd = __emval_register ( destructors ) ; <nl> + HEAP32 [ destructorsRef > > 2 ] = rd ; <nl> return returnType [ ' toWireType ' ] ( destructors , _emval_handle_array [ handle ] . value ) ; <nl> } <nl> <nl> function lookupTypes ( argCount , argTypes , argWireTypes ) { <nl> return a ; <nl> } <nl> <nl> + function allocateDestructors ( destructorsRef ) { <nl> + var destructors = [ ] ; <nl> + HEAP32 [ destructorsRef > > 2 ] = __emval_register ( destructors ) ; <nl> + return destructors ; <nl> + } <nl> + <nl> function __emval_get_method_caller ( argCount , argTypes ) { <nl> var types = lookupTypes ( argCount , argTypes ) ; <nl> <nl> var retType = types [ 0 ] ; <nl> var signatureName = retType . name + " _ $ " + types . slice ( 1 ) . map ( function ( t ) { return t . name ; } ) . join ( " _ " ) + " $ " ; <nl> <nl> - var args1 = [ " addFunction " , " createNamedFunction " , " requireHandle " , " getStringOrSymbol " , " _emval_handle_array " , " retType " ] ; <nl> - var args2 = [ Runtime . addFunction , createNamedFunction , requireHandle , getStringOrSymbol , _emval_handle_array , retType ] ; <nl> + var args1 = [ " addFunction " , " createNamedFunction " , " requireHandle " , " getStringOrSymbol " , " _emval_handle_array " , " retType " , " allocateDestructors " ] ; <nl> + var args2 = [ Runtime . addFunction , createNamedFunction , requireHandle , getStringOrSymbol , _emval_handle_array , retType , allocateDestructors ] ; <nl> <nl> var argsList = " " ; / / ' arg0 , arg1 , arg2 , . . . , argN ' <nl> var argsListWired = " " ; / / ' arg0Wired , . . . , argNWired ' <nl> function __emval_get_method_caller ( argCount , argTypes ) { <nl> } <nl> <nl> var invokerFnBody = <nl> - " return addFunction ( createNamedFunction ( ' " + signatureName + " ' , function ( handle , name " + argsListWired + " ) { \ n " + <nl> - " requireHandle ( handle ) ; \ n " + <nl> - " name = getStringOrSymbol ( name ) ; \ n " ; <nl> + " return addFunction ( createNamedFunction ( ' " + signatureName + " ' , function ( handle , name , destructorsRef " + argsListWired + " ) { \ n " + <nl> + " requireHandle ( handle ) ; \ n " + <nl> + " name = getStringOrSymbol ( name ) ; \ n " ; <nl> <nl> for ( var i = 0 ; i < argCount - 1 ; + + i ) { <nl> - invokerFnBody + = " var arg " + i + " = argType " + i + " . fromWireType ( arg " + i + " Wired ) ; \ n " ; <nl> + invokerFnBody + = " var arg " + i + " = argType " + i + " . fromWireType ( arg " + i + " Wired ) ; \ n " ; <nl> } <nl> invokerFnBody + = <nl> - " var obj = _emval_handle_array [ handle ] . value ; \ n " + <nl> - " return retType . toWireType ( null , obj [ name ] ( " + argsList + " ) ) ; \ n " + <nl> + " var obj = _emval_handle_array [ handle ] . value ; \ n " + <nl> + " var rv = obj [ name ] ( " + argsList + " ) ; \ n " + <nl> + " return retType . toWireType ( allocateDestructors ( destructorsRef ) , rv ) ; \ n " + <nl> " } ) ) ; \ n " ; <nl> <nl> args1 . push ( invokerFnBody ) ; <nl> mmm a / system / include / emscripten / bind . h <nl> ppp b / system / include / emscripten / bind . h <nl> namespace emscripten { <nl> template < typename ClassType > <nl> class value_array : public internal : : noncopyable { <nl> public : <nl> + typedef ClassType class_type ; <nl> + <nl> value_array ( const char * name ) { <nl> using namespace internal ; <nl> _embind_register_value_array ( <nl> namespace emscripten { <nl> template < typename ClassType > <nl> class value_object : public internal : : noncopyable { <nl> public : <nl> + typedef ClassType class_type ; <nl> + <nl> value_object ( const char * name ) { <nl> using namespace internal ; <nl> _embind_register_value_object ( <nl> namespace emscripten { <nl> static void * share ( void * v ) { <nl> return 0 ; / / no sharing <nl> } <nl> + <nl> + static PointerType * construct_null ( ) { <nl> + return new PointerType ; <nl> + } <nl> } ; <nl> <nl> / / specialize if you have a different pointer type <nl> namespace emscripten { <nl> val_deleter ( val : : take_ownership ( v ) ) ) ; <nl> } <nl> <nl> + static PointerType * construct_null ( ) { <nl> + return new PointerType ; <nl> + } <nl> + <nl> private : <nl> class val_deleter { <nl> public : <nl> namespace emscripten { <nl> template < typename T > <nl> class wrapper : public T { <nl> public : <nl> + typedef T class_type ; <nl> + <nl> explicit wrapper ( val & & wrapped ) <nl> : wrapped ( std : : forward < val > ( wrapped ) ) <nl> { } <nl> namespace emscripten { <nl> / / NOTE : this returns the class type , not the pointer type <nl> template < typename T > <nl> inline TYPEID getActualType ( T * ptr ) { <nl> - assert ( ptr ) ; <nl> return reinterpret_cast < TYPEID > ( & typeid ( * ptr ) ) ; <nl> } ; <nl> } <nl> <nl> template < typename BaseClass > <nl> struct base { <nl> + typedef BaseClass class_type ; <nl> + <nl> template < typename ClassType > <nl> static void verify ( ) { <nl> static_assert ( ! std : : is_same < ClassType , BaseClass > : : value , " Base must not have same type as class " ) ; <nl> namespace emscripten { <nl> template < typename ClassType , typename BaseSpecifier = internal : : NoBaseClass > <nl> class class_ { <nl> public : <nl> + typedef ClassType class_type ; <nl> + typedef BaseSpecifier base_specifier ; <nl> + <nl> class_ ( ) = delete ; <nl> <nl> explicit class_ ( const char * name ) { <nl> namespace emscripten { <nl> } <nl> <nl> template < typename PointerType > <nl> - class_ & smart_ptr ( ) { <nl> + const class_ & smart_ptr ( ) const { <nl> using namespace internal ; <nl> <nl> typedef smart_ptr_trait < PointerType > PointerTrait ; <nl> namespace emscripten { <nl> typeid ( PointerType ) . name ( ) , <nl> PointerTrait : : get_sharing_policy ( ) , <nl> reinterpret_cast < GenericFunction > ( & PointerTrait : : get ) , <nl> - reinterpret_cast < GenericFunction > ( & operator_new < PointerType > ) , <nl> + reinterpret_cast < GenericFunction > ( & PointerTrait : : construct_null ) , <nl> reinterpret_cast < GenericFunction > ( & PointerTrait : : share ) , <nl> reinterpret_cast < GenericFunction > ( & raw_destructor < PointerType > ) ) ; <nl> return * this ; <nl> } ; <nl> <nl> template < typename . . . ConstructorArgs , typename . . . Policies > <nl> - class_ & constructor ( Policies . . . policies ) { <nl> + const class_ & constructor ( Policies . . . policies ) const { <nl> return constructor ( <nl> & internal : : operator_new < ClassType , ConstructorArgs . . . > , <nl> policies . . . ) ; <nl> } <nl> <nl> template < typename . . . Args , typename ReturnType , typename . . . Policies > <nl> - class_ & constructor ( ReturnType ( * factory ) ( Args . . . ) , Policies . . . ) { <nl> + const class_ & constructor ( ReturnType ( * factory ) ( Args . . . ) , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> / / TODO : allows all raw pointers . . . policies need a rethink <nl> namespace emscripten { <nl> } <nl> <nl> template < typename SmartPtr , typename . . . Args , typename . . . Policies > <nl> - class_ & smart_ptr_constructor ( SmartPtr ( * factory ) ( Args . . . ) , Policies . . . ) { <nl> + const class_ & smart_ptr_constructor ( SmartPtr ( * factory ) ( Args . . . ) , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> smart_ptr < SmartPtr > ( ) ; <nl> namespace emscripten { <nl> } <nl> <nl> template < typename WrapperType , typename PointerType = WrapperType * > <nl> - class_ & allow_subclass ( ) { <nl> + const class_ & allow_subclass ( ) const { <nl> using namespace internal ; <nl> <nl> auto cls = class_ < WrapperType , base < ClassType > > ( typeid ( WrapperType ) . name ( ) ) <nl> namespace emscripten { <nl> } <nl> <nl> template < typename ReturnType , typename . . . Args , typename . . . Policies > <nl> - class_ & function ( const char * methodName , ReturnType ( ClassType : : * memberFunction ) ( Args . . . ) , Policies . . . ) { <nl> + const class_ & function ( const char * methodName , ReturnType ( ClassType : : * memberFunction ) ( Args . . . ) , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , AllowedRawPointer < ClassType > , Args . . . > args ; <nl> namespace emscripten { <nl> } <nl> <nl> template < typename ReturnType , typename . . . Args , typename . . . Policies > <nl> - class_ & function ( const char * methodName , ReturnType ( ClassType : : * memberFunction ) ( Args . . . ) const , Policies . . . ) { <nl> + const class_ & function ( const char * methodName , ReturnType ( ClassType : : * memberFunction ) ( Args . . . ) const , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , AllowedRawPointer < const ClassType > , Args . . . > args ; <nl> namespace emscripten { <nl> } <nl> <nl> template < typename ReturnType , typename ThisType , typename . . . Args , typename . . . Policies > <nl> - class_ & function ( const char * methodName , ReturnType ( * function ) ( ThisType , Args . . . ) , Policies . . . ) { <nl> + const class_ & function ( const char * methodName , ReturnType ( * function ) ( ThisType , Args . . . ) , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , ThisType , Args . . . > args ; <nl> namespace emscripten { <nl> } <nl> <nl> template < typename FieldType , typename = typename std : : enable_if < ! std : : is_function < FieldType > : : value > : : type > <nl> - class_ & property ( const char * fieldName , const FieldType ClassType : : * field ) { <nl> + const class_ & property ( const char * fieldName , const FieldType ClassType : : * field ) const { <nl> using namespace internal ; <nl> <nl> _embind_register_class_property ( <nl> namespace emscripten { <nl> } <nl> <nl> template < typename FieldType , typename = typename std : : enable_if < ! std : : is_function < FieldType > : : value > : : type > <nl> - class_ & property ( const char * fieldName , FieldType ClassType : : * field ) { <nl> + const class_ & property ( const char * fieldName , FieldType ClassType : : * field ) const { <nl> using namespace internal ; <nl> <nl> _embind_register_class_property ( <nl> namespace emscripten { <nl> } <nl> <nl> template < typename Getter > <nl> - class_ & property ( const char * fieldName , Getter getter ) { <nl> + const class_ & property ( const char * fieldName , Getter getter ) const { <nl> using namespace internal ; <nl> typedef GetterPolicy < Getter > GP ; <nl> _embind_register_class_property ( <nl> namespace emscripten { <nl> } <nl> <nl> template < typename Getter , typename Setter > <nl> - class_ & property ( const char * fieldName , Getter getter , Setter setter ) { <nl> + const class_ & property ( const char * fieldName , Getter getter , Setter setter ) const { <nl> using namespace internal ; <nl> typedef GetterPolicy < Getter > GP ; <nl> typedef SetterPolicy < Setter > SP ; <nl> namespace emscripten { <nl> } <nl> <nl> template < typename ReturnType , typename . . . Args , typename . . . Policies > <nl> - class_ & class_function ( const char * methodName , ReturnType ( * classMethod ) ( Args . . . ) , Policies . . . ) { <nl> + const class_ & class_function ( const char * methodName , ReturnType ( * classMethod ) ( Args . . . ) , Policies . . . ) const { <nl> using namespace internal ; <nl> <nl> typename WithPolicies < Policies . . . > : : template ArgTypeList < ReturnType , Args . . . > args ; <nl> namespace emscripten { <nl> template < typename EnumType > <nl> class enum_ { <nl> public : <nl> + typedef EnumType enum_type ; <nl> + <nl> enum_ ( const char * name ) { <nl> _embind_register_enum ( <nl> internal : : TypeID < EnumType > : : get ( ) , <nl> namespace emscripten { <nl> _embind_register_constant ( <nl> name , <nl> TypeID < const ConstantType & > : : get ( ) , <nl> - asGenericValue ( BindingType < const ConstantType & > : : toWireType ( v ) ) ) ; <nl> + asGenericValue ( BT : : toWireType ( v ) ) ) ; <nl> } <nl> } <nl> <nl> mmm a / system / include / emscripten / val . h <nl> ppp b / system / include / emscripten / val . h <nl> namespace emscripten { <nl> void _emval_register_symbol ( const char * ) ; <nl> <nl> typedef struct _EM_VAL * EM_VAL ; <nl> + typedef struct _EM_DESTRUCTORS * EM_DESTRUCTORS ; <nl> + <nl> + / / TODO : functions returning this are reinterpret_cast <nl> + / / into the correct return type . this needs some thought <nl> + / / for asm . js . <nl> + typedef void _POLYMORPHIC_RESULT ; <nl> <nl> void _emval_incref ( EM_VAL value ) ; <nl> void _emval_decref ( EM_VAL value ) ; <nl> <nl> + void _emval_run_destructors ( EM_DESTRUCTORS handle ) ; <nl> + <nl> EM_VAL _emval_new_array ( ) ; <nl> EM_VAL _emval_new_object ( ) ; <nl> EM_VAL _emval_undefined ( ) ; <nl> namespace emscripten { <nl> EM_VAL _emval_get_module_property ( const char * name ) ; <nl> EM_VAL _emval_get_property ( EM_VAL object , EM_VAL key ) ; <nl> void _emval_set_property ( EM_VAL object , EM_VAL key , EM_VAL value ) ; <nl> - void _emval_as ( EM_VAL value , TYPEID returnType ) ; <nl> + _POLYMORPHIC_RESULT _emval_as ( EM_VAL value , TYPEID returnType , EM_DESTRUCTORS * runDestructors ) ; <nl> + <nl> EM_VAL _emval_call ( <nl> EM_VAL value , <nl> unsigned argCount , <nl> namespace emscripten { <nl> <nl> template < typename ReturnType , typename . . . Args > <nl> struct Signature { <nl> - typedef typename BindingType < ReturnType > : : WireType ( * MethodCaller ) ( EM_VAL value , const char * methodName , typename BindingType < Args > : : WireType . . . ) ; <nl> + typedef typename BindingType < ReturnType > : : WireType ( * MethodCaller ) ( <nl> + EM_VAL value , <nl> + const char * methodName , <nl> + EM_DESTRUCTORS * destructors , <nl> + typename BindingType < Args > : : WireType . . . ) ; <nl> <nl> static MethodCaller get_method_caller ( ) { <nl> static MethodCaller fp = reinterpret_cast < MethodCaller > ( init_method_caller ( ) ) ; <nl> namespace emscripten { <nl> } <nl> } ; <nl> <nl> + struct DestructorsRunner { <nl> + public : <nl> + explicit DestructorsRunner ( EM_DESTRUCTORS d ) <nl> + : destructors ( d ) <nl> + { } <nl> + ~ DestructorsRunner ( ) { <nl> + _emval_run_destructors ( destructors ) ; <nl> + } <nl> + <nl> + DestructorsRunner ( const DestructorsRunner & ) = delete ; <nl> + void operator = ( const DestructorsRunner & ) = delete ; <nl> + <nl> + private : <nl> + EM_DESTRUCTORS destructors ; <nl> + } ; <nl> + <nl> template < typename ReturnType , typename . . . Args > <nl> struct MethodCaller { <nl> static ReturnType call ( EM_VAL handle , const char * methodName , Args & & . . . args ) { <nl> auto caller = Signature < ReturnType , Args . . . > : : get_method_caller ( ) ; <nl> + <nl> + EM_DESTRUCTORS destructors ; <nl> auto wireType = caller ( <nl> handle , <nl> methodName , <nl> + & destructors , <nl> toWireType ( std : : forward < Args > ( args ) ) . . . ) ; <nl> - WireDeleter < ReturnType > deleter ( wireType ) ; <nl> + DestructorsRunner rd ( destructors ) ; <nl> return BindingType < ReturnType > : : fromWireType ( wireType ) ; <nl> } <nl> } ; <nl> namespace emscripten { <nl> struct MethodCaller < void , Args . . . > { <nl> static void call ( EM_VAL handle , const char * methodName , Args & & . . . args ) { <nl> auto caller = Signature < void , Args . . . > : : get_method_caller ( ) ; <nl> - return caller ( <nl> + <nl> + EM_DESTRUCTORS destructors ; <nl> + caller ( <nl> handle , <nl> methodName , <nl> + & destructors , <nl> toWireType ( std : : forward < Args > ( args ) ) . . . ) ; <nl> + DestructorsRunner rd ( destructors ) ; <nl> + / / void requires no translation <nl> } <nl> } ; <nl> } <nl> namespace emscripten { <nl> <nl> typedef typename BT : : WireType ( * TypedAs ) ( <nl> EM_VAL value , <nl> - TYPEID returnType ) ; <nl> + TYPEID returnType , <nl> + EM_DESTRUCTORS * runDestructors ) ; <nl> TypedAs typedAs = reinterpret_cast < TypedAs > ( & _emval_as ) ; <nl> <nl> - typename BT : : WireType wt = typedAs ( handle , TypeID < T > : : get ( ) ) ; <nl> - WireDeleter < T > deleter ( wt ) ; <nl> + EM_DESTRUCTORS destructors ; <nl> + typename BT : : WireType wt = typedAs ( handle , TypeID < T > : : get ( ) , & destructors ) ; <nl> + DestructorsRunner dr ( destructors ) ; <nl> return BT : : fromWireType ( wt ) ; <nl> } <nl> <nl> namespace emscripten { <nl> static val fromWireType ( WireType v ) { <nl> return val : : take_ownership ( v ) ; <nl> } <nl> - static void destroy ( WireType v ) { <nl> - } <nl> } ; <nl> } <nl> <nl> mmm a / system / include / emscripten / wire . h <nl> ppp b / system / include / emscripten / wire . h <nl> <nl> / / <nl> / / We ' ll call the on - the - wire type WireType . <nl> <nl> + # include < stdio . h > <nl> # include < cstdlib > <nl> # include < memory > <nl> # include < string > <nl> namespace emscripten { <nl> constexpr static type fromWireType ( WireType v ) { \ <nl> return v ; \ <nl> } \ <nl> - static void destroy ( WireType ) { \ <nl> - } \ <nl> } <nl> <nl> EMSCRIPTEN_DEFINE_NATIVE_BINDING_TYPE ( char ) ; <nl> namespace emscripten { <nl> static bool fromWireType ( WireType wt ) { <nl> return wt ; <nl> } <nl> - static void destroy ( WireType ) { <nl> - } <nl> } ; <nl> <nl> template < > <nl> namespace emscripten { <nl> static std : : string fromWireType ( WireType v ) { <nl> return std : : string ( v - > data , v - > length ) ; <nl> } <nl> - static void destroy ( WireType v ) { <nl> - free ( v ) ; <nl> - } <nl> } ; <nl> <nl> template < > <nl> namespace emscripten { <nl> static std : : wstring fromWireType ( WireType v ) { <nl> return std : : wstring ( v - > data , v - > length ) ; <nl> } <nl> - static void destroy ( WireType v ) { <nl> - free ( v ) ; <nl> - } <nl> } ; <nl> <nl> template < typename T > <nl> namespace emscripten { <nl> static ActualT & fromWireType ( WireType p ) { <nl> return * p ; <nl> } <nl> - <nl> - static void destroy ( WireType p ) { <nl> - delete p ; <nl> - } <nl> } ; <nl> <nl> / / Is this necessary ? <nl> namespace emscripten { <nl> static Enum fromWireType ( WireType v ) { <nl> return v ; <nl> } <nl> - static void destroy ( WireType ) { <nl> - } <nl> } ; <nl> <nl> / / catch - all generic binding <nl> namespace emscripten { <nl> auto toWireType ( T & & v ) - > typename BindingType < T > : : WireType { <nl> return BindingType < T > : : toWireType ( std : : forward < T > ( v ) ) ; <nl> } <nl> - <nl> - template < typename T > <nl> - struct WireDeleter { <nl> - typedef typename BindingType < T > : : WireType WireType ; <nl> - <nl> - WireDeleter ( WireType wt ) <nl> - : wt ( wt ) <nl> - { } <nl> - <nl> - ~ WireDeleter ( ) { <nl> - BindingType < T > : : destroy ( wt ) ; <nl> - } <nl> - <nl> - WireType wt ; <nl> - } ; <nl> } <nl> <nl> struct memory_view { <nl> mmm a / tests / embind / embind . test . js <nl> ppp b / tests / embind / embind . test . js <nl> module ( { <nl> } ) ; <nl> } ) ; <nl> } ) ; <nl> - <nl> + <nl> } <nl> <nl> BaseFixture . extend ( " access to base class members " , function ( ) { <nl> module ( { <nl> assert . equal ( " 0 " , cm . unsigned_int_to_string ( 0 ) ) ; <nl> assert . equal ( " 0 " , cm . long_to_string ( 0 ) ) ; <nl> assert . equal ( " 0 " , cm . unsigned_long_to_string ( 0 ) ) ; <nl> - <nl> + <nl> / / all types should have positive values . <nl> assert . equal ( " 5 " , cm . char_to_string ( 5 ) ) ; <nl> assert . equal ( " 5 " , cm . signed_char_to_string ( 5 ) ) ; <nl> module ( { <nl> assert . equal ( " - 32768 " , cm . short_to_string ( - 32768 ) ) ; <nl> assert . equal ( " - 2147483648 " , cm . int_to_string ( - 2147483648 ) ) ; <nl> assert . equal ( " - 2147483648 " , cm . long_to_string ( - 2147483648 ) ) ; <nl> - <nl> + <nl> / / passing out of range values should fail . <nl> assert . throws ( TypeError , function ( ) { cm . char_to_string ( - 129 ) ; } ) ; <nl> assert . throws ( TypeError , function ( ) { cm . char_to_string ( 128 ) ; } ) ; <nl> module ( { <nl> <nl> test ( " overloading of derived class member functions " , function ( ) { <nl> var foo = new cm . MultipleOverloadsDerived ( ) ; <nl> - <nl> + <nl> / / NOTE : In C + + , default lookup rules will hide overloads from base class if derived class creates them . <nl> / / In JS , we make the base class overloads implicitly available . In C + + , they would need to be explicitly <nl> / / invoked , like foo . MultipleOverloads : : Func ( 10 ) ; <nl> module ( { <nl> assert . equal ( foo . WhichFuncCalled ( ) , 4 ) ; <nl> foo . delete ( ) ; <nl> } ) ; <nl> - <nl> + <nl> test ( " overloading of class static functions " , function ( ) { <nl> assert . equal ( cm . MultipleOverloads . StaticFunc ( 10 ) , 1 ) ; <nl> assert . equal ( cm . MultipleOverloads . WhichStaticFuncCalled ( ) , 1 ) ; <nl> module ( { <nl> test ( " repr includes enum value " , function ( ) { <nl> assert . equal ( ' < # Enum_ONE { } > ' , IMVU . repr ( cm . Enum . ONE ) ) ; <nl> assert . equal ( ' < # Enum_TWO { } > ' , IMVU . repr ( cm . Enum . TWO ) ) ; <nl> - } ) ; <nl> + } ) ; <nl> } <nl> <nl> test ( " instanceof " , function ( ) { <nl> module ( { <nl> test ( " returning a new shared pointer from interfaces implemented in JS code does not leak " , function ( ) { <nl> var impl = cm . AbstractClass . implement ( { <nl> returnsSharedPtr : function ( ) { <nl> - return cm . embind_test_return_smart_derived_ptr ( ) ; <nl> + return cm . embind_test_return_smart_derived_ptr ( ) . deleteLater ( ) ; <nl> } <nl> } ) ; <nl> cm . callReturnsSharedPtrMethod ( impl ) ; <nl> module ( { <nl> } ) ; <nl> <nl> if ( typeof INVOKED_FROM_EMSCRIPTEN_TEST_RUNNER = = = " undefined " ) { / / TODO : Enable this to work in Emscripten runner as well ! <nl> - <nl> + <nl> BaseFixture . extend ( " unbound types " , function ( ) { <nl> function assertMessage ( fn , message ) { <nl> var e = assert . throws ( cm . UnboundTypeError , fn ) ; <nl> module ( { <nl> } , <nl> ' Cannot construct HasConstructorUsingUnboundArgumentAndUnboundBase due to unbound types : 18SecondUnboundClass ' ) ; <nl> } ) ; <nl> - <nl> + <nl> test ( ' class function with unbound argument ' , function ( ) { <nl> var x = new cm . BoundClass ; <nl> assertMessage ( <nl> module ( { <nl> } , ' Cannot access BoundClass . property due to unbound types : 12UnboundClass ' ) ; <nl> x . delete ( ) ; <nl> } ) ; <nl> - <nl> + <nl> / / todo : tuple elements <nl> / / todo : tuple element accessors <nl> / / todo : struct fields <nl> } ) ; <nl> - <nl> + <nl> } <nl> <nl> BaseFixture . extend ( " noncopyable " , function ( ) { <nl> module ( { <nl> <nl> BaseFixture . extend ( " constants " , function ( ) { <nl> assert . equal ( 10 , cm . INT_CONSTANT ) ; <nl> + <nl> + assert . equal ( 1 , cm . STATIC_CONST_INTEGER_VALUE_1 ) ; <nl> + assert . equal ( 1000 , cm . STATIC_CONST_INTEGER_VALUE_1000 ) ; <nl> + <nl> assert . equal ( " some string " , cm . STRING_CONSTANT ) ; <nl> assert . deepEqual ( [ 1 , 2 , 3 , 4 ] , cm . VALUE_ARRAY_CONSTANT ) ; <nl> assert . deepEqual ( { x : 1 , y : 2 , z : 3 , w : 4 } , cm . VALUE_OBJECT_CONSTANT ) ; <nl> module ( { <nl> sh . delete ( ) ; <nl> } ) ; <nl> } ) ; <nl> + <nl> + BaseFixture . extend ( " val : : as from pointer to value " , function ( ) { <nl> + test ( " calling as on pointer with value makes a copy " , function ( ) { <nl> + var sh1 = new cm . StringHolder ( " Hello world " ) ; <nl> + var sh2 = cm . return_StringHolder_copy ( sh1 ) ; <nl> + assert . equal ( " Hello world " , sh1 . get ( ) ) ; <nl> + assert . equal ( " Hello world " , sh2 . get ( ) ) ; <nl> + assert . false ( sh1 . isAliasOf ( sh2 ) ) ; <nl> + sh2 . delete ( ) ; <nl> + sh1 . delete ( ) ; <nl> + } ) ; <nl> + <nl> + test ( " calling function that returns a StringHolder " , function ( ) { <nl> + var sh1 = new cm . StringHolder ( " Hello world " ) ; <nl> + var sh2 = cm . call_StringHolder_func ( function ( ) { <nl> + return sh1 ; <nl> + } ) ; <nl> + assert . equal ( " Hello world " , sh1 . get ( ) ) ; <nl> + assert . equal ( " Hello world " , sh2 . get ( ) ) ; <nl> + assert . false ( sh1 . isAliasOf ( sh2 ) ) ; <nl> + sh2 . delete ( ) ; <nl> + sh1 . delete ( ) ; <nl> + } ) ; <nl> + } ) ; <nl> + <nl> + BaseFixture . extend ( " mixin " , function ( ) { <nl> + test ( " can call mixin method " , function ( ) { <nl> + var a = new cm . DerivedWithMixin ( ) ; <nl> + assert . instanceof ( a , cm . Base ) ; <nl> + assert . equal ( 10 , a . get10 ( ) ) ; <nl> + a . delete ( ) ; <nl> + } ) ; <nl> + } ) ; <nl> + <nl> + test ( " returning a cached new shared pointer from interfaces implemented in JS code does not leak " , function ( ) { <nl> + var derived = cm . embind_test_return_smart_derived_ptr ( ) ; <nl> + var impl = cm . AbstractClass . implement ( { <nl> + returnsSharedPtr : function ( ) { <nl> + return derived ; <nl> + } <nl> + } ) ; <nl> + cm . callReturnsSharedPtrMethod ( impl ) ; <nl> + impl . delete ( ) ; <nl> + derived . delete ( ) ; <nl> + / / Let the memory leak test superfixture check that no leaks occurred . <nl> + } ) ; <nl> } ) ; <nl> <nl> / * global run_all_tests * / <nl> mmm a / tests / embind / embind_test . cpp <nl> ppp b / tests / embind / embind_test . cpp <nl> std : : shared_ptr < HeldBySmartPtr > takesHeldBySmartPtrSharedPtr ( std : : shared_ptr < Hel <nl> namespace emscripten { <nl> template < typename T > <nl> struct smart_ptr_trait < CustomSmartPtr < T > > { <nl> + typedef CustomSmartPtr < T > pointer_type ; <nl> typedef T element_type ; <nl> <nl> static sharing_policy get_sharing_policy ( ) { <nl> namespace emscripten { <nl> + + ptr - > refcount ; / / implement an adopt API ? <nl> return CustomSmartPtr < T > ( ptr ) ; <nl> } <nl> + <nl> + static pointer_type * construct_null ( ) { <nl> + return new pointer_type ; <nl> + } <nl> } ; <nl> } <nl> <nl> EMSCRIPTEN_BINDINGS ( read_only_properties ) { <nl> ; <nl> } <nl> <nl> + struct StaticConstIntStruct { <nl> + static const int STATIC_CONST_INTEGER_VALUE_1 ; <nl> + static const int STATIC_CONST_INTEGER_VALUE_1000 ; <nl> + } ; <nl> + <nl> + const int StaticConstIntStruct : : STATIC_CONST_INTEGER_VALUE_1 = 1 ; <nl> + const int StaticConstIntStruct : : STATIC_CONST_INTEGER_VALUE_1000 = 1000 ; <nl> + <nl> EMSCRIPTEN_BINDINGS ( constants ) { <nl> constant ( " INT_CONSTANT " , 10 ) ; <nl> + <nl> + constant ( " STATIC_CONST_INTEGER_VALUE_1 " , StaticConstIntStruct : : STATIC_CONST_INTEGER_VALUE_1 ) ; <nl> + constant ( " STATIC_CONST_INTEGER_VALUE_1000 " , StaticConstIntStruct : : STATIC_CONST_INTEGER_VALUE_1000 ) ; <nl> + <nl> constant ( " STRING_CONSTANT " , std : : string ( " some string " ) ) ; <nl> <nl> TupleVector tv ( 1 , 2 , 3 , 4 ) ; <nl> void clear_StringHolder ( StringHolder & sh ) { <nl> EMSCRIPTEN_BINDINGS ( references ) { <nl> function ( " clear_StringHolder " , & clear_StringHolder ) ; <nl> } <nl> + <nl> + StringHolder return_StringHolder_copy ( val func ) { <nl> + return func . as < StringHolder > ( ) ; <nl> + } <nl> + <nl> + StringHolder call_StringHolder_func ( val func ) { <nl> + return func ( ) . as < StringHolder > ( ) ; <nl> + } <nl> + <nl> + EMSCRIPTEN_BINDINGS ( return_values ) { <nl> + function ( " return_StringHolder_copy " , & return_StringHolder_copy ) ; <nl> + function ( " call_StringHolder_func " , & call_StringHolder_func ) ; <nl> + } <nl> + <nl> + <nl> + struct Mixin { <nl> + int get10 ( ) const { <nl> + return 10 ; <nl> + } <nl> + } ; <nl> + <nl> + template < typename ClassBinding > <nl> + const ClassBinding & registerMixin ( const ClassBinding & binding ) { <nl> + / / need a wrapper for implicit conversion from DerivedWithMixin to Mixin <nl> + struct Local { <nl> + static int get10 ( const typename ClassBinding : : class_type & self ) { <nl> + return self . get10 ( ) ; <nl> + } <nl> + } ; <nl> + <nl> + return binding <nl> + . function ( " get10 " , & Local : : get10 ) <nl> + ; <nl> + } <nl> + <nl> + class DerivedWithMixin : public Base , public Mixin { <nl> + } ; <nl> + <nl> + EMSCRIPTEN_BINDINGS ( mixins ) { <nl> + registerMixin ( <nl> + class_ < DerivedWithMixin , base < Base > > ( " DerivedWithMixin " ) <nl> + . constructor < > ( ) <nl> + ) ; <nl> + } <nl>
Merge pull request from waywardmonkeys / upstream - from - imvu
emscripten-core/emscripten
ed896c9c00edc7c7bdd4c4cfaca057509c3cd628
2014-02-10T23:16:14Z
mmm a / Telegram / SourceFiles / core / application . cpp <nl> ppp b / Telegram / SourceFiles / core / application . cpp <nl> bool Application : : eventFilter ( QObject * object , QEvent * e ) { <nl> case QEvent : : MouseButtonPress : <nl> case QEvent : : TouchBegin : <nl> case QEvent : : Wheel : { <nl> - psUserActionDone ( ) ; <nl> + updateNonIdle ( ) ; <nl> } break ; <nl> <nl> case QEvent : : ShortcutOverride : { <nl> bool Application : : eventFilter ( QObject * object , QEvent * e ) { <nl> <nl> case QEvent : : ApplicationActivate : { <nl> if ( object = = QCoreApplication : : instance ( ) ) { <nl> - psUserActionDone ( ) ; <nl> + updateNonIdle ( ) ; <nl> } <nl> } break ; <nl> <nl> mmm a / Telegram / SourceFiles / mainwindow . cpp <nl> ppp b / Telegram / SourceFiles / mainwindow . cpp <nl> bool MainWindow : : eventFilter ( QObject * object , QEvent * e ) { <nl> <nl> case QEvent : : MouseMove : { <nl> if ( _main & & _main - > isIdle ( ) ) { <nl> - psUserActionDone ( ) ; <nl> + Core : : App ( ) . updateNonIdle ( ) ; <nl> _main - > checkIdleFinish ( ) ; <nl> } <nl> } break ; <nl> mmm a / Telegram / SourceFiles / platform / linux / specific_linux . cpp <nl> ppp b / Telegram / SourceFiles / platform / linux / specific_linux . cpp <nl> void psDeleteDir ( const QString & dir ) { <nl> _removeDirectory ( dir ) ; <nl> } <nl> <nl> - namespace { <nl> - <nl> - auto _lastUserAction = 0LL ; <nl> - <nl> - } / / namespace <nl> - <nl> - void psUserActionDone ( ) { <nl> - _lastUserAction = crl : : now ( ) ; <nl> - } <nl> - <nl> bool psIdleSupported ( ) { <nl> return false ; <nl> } <nl> bool OpenSystemSettings ( SystemSettingsType type ) { <nl> } <nl> <nl> crl : : time LastUserInputTime ( ) { <nl> - return _lastUserAction ; <nl> + return 0LL ; <nl> } <nl> <nl> namespace ThirdParty { <nl> mmm a / Telegram / SourceFiles / platform / linux / specific_linux . h <nl> ppp b / Telegram / SourceFiles / platform / linux / specific_linux . h <nl> void psWriteDump ( ) ; <nl> <nl> void psDeleteDir ( const QString & dir ) ; <nl> <nl> - void psUserActionDone ( ) ; <nl> bool psIdleSupported ( ) ; <nl> <nl> QStringList psInitLogs ( ) ; <nl> mmm a / Telegram / SourceFiles / platform / mac / specific_mac . h <nl> ppp b / Telegram / SourceFiles / platform / mac / specific_mac . h <nl> void psWriteDump ( ) ; <nl> <nl> void psDeleteDir ( const QString & dir ) ; <nl> <nl> - void psUserActionDone ( ) ; <nl> bool psIdleSupported ( ) ; <nl> <nl> QStringList psInitLogs ( ) ; <nl> mmm a / Telegram / SourceFiles / platform / mac / specific_mac . mm <nl> ppp b / Telegram / SourceFiles / platform / mac / specific_mac . mm <nl> void psDeleteDir ( const QString & dir ) { <nl> objc_deleteDir ( dir ) ; <nl> } <nl> <nl> - namespace { <nl> - <nl> - auto _lastUserAction = 0LL ; <nl> - <nl> - } / / namespace <nl> - <nl> - void psUserActionDone ( ) { <nl> - _lastUserAction = crl : : now ( ) ; <nl> - } <nl> - <nl> bool psIdleSupported ( ) { <nl> return objc_idleSupported ( ) ; <nl> } <nl> bool OpenSystemSettings ( SystemSettingsType type ) { <nl> <nl> crl : : time LastUserInputTime ( ) { <nl> auto idleTime = 0LL ; <nl> - return objc_idleTime ( idleTime ) ? ( crl : : now ( ) - crl : : time ( idleTime ) ) : _lastUserAction ; <nl> + return objc_idleTime ( idleTime ) ? ( crl : : now ( ) - crl : : time ( idleTime ) ) : 0LL ; <nl> } <nl> <nl> } / / namespace Platform <nl> mmm a / Telegram / SourceFiles / platform / win / specific_win . cpp <nl> ppp b / Telegram / SourceFiles / platform / win / specific_win . cpp <nl> namespace { <nl> } <nl> } <nl> <nl> - namespace { <nl> - <nl> - crl : : time _lastUserAction = 0 ; <nl> - <nl> - } / / namespace <nl> - <nl> - void psUserActionDone ( ) { <nl> - _lastUserAction = crl : : now ( ) ; <nl> - EventFilter : : getInstance ( ) - > setSessionLoggedOff ( false ) ; <nl> - } <nl> - <nl> bool psIdleSupported ( ) { <nl> LASTINPUTINFO lii ; <nl> lii . cbSize = sizeof ( LASTINPUTINFO ) ; <nl> QString CurrentExecutablePath ( int argc , char * argv [ ] ) { <nl> crl : : time LastUserInputTime ( ) { <nl> LASTINPUTINFO lii ; <nl> lii . cbSize = sizeof ( LASTINPUTINFO ) ; <nl> - return GetLastInputInfo ( & lii ) ? ( crl : : now ( ) + lii . dwTime - GetTickCount ( ) ) : _lastUserAction ; <nl> + return GetLastInputInfo ( & lii ) ? ( crl : : now ( ) + lii . dwTime - GetTickCount ( ) ) : 0LL ; <nl> } <nl> <nl> namespace { <nl> mmm a / Telegram / SourceFiles / platform / win / specific_win . h <nl> ppp b / Telegram / SourceFiles / platform / win / specific_win . h <nl> void psWriteDump ( ) ; <nl> <nl> void psDeleteDir ( const QString & dir ) ; <nl> <nl> - void psUserActionDone ( ) ; <nl> bool psIdleSupported ( ) ; <nl> <nl> QStringList psInitLogs ( ) ; <nl> mmm a / Telegram / SourceFiles / window / main_window . cpp <nl> ppp b / Telegram / SourceFiles / window / main_window . cpp <nl> void MainWindow : : init ( ) { <nl> void MainWindow : : handleStateChanged ( Qt : : WindowState state ) { <nl> stateChangedHook ( state ) ; <nl> updateIsActive ( ( state = = Qt : : WindowMinimized ) ? Global : : OfflineBlurTimeout ( ) : Global : : OnlineFocusTimeout ( ) ) ; <nl> - psUserActionDone ( ) ; <nl> + Core : : App ( ) . updateNonIdle ( ) ; <nl> if ( state = = Qt : : WindowMinimized & & Global : : WorkMode ( ) . value ( ) = = dbiwmTrayOnly ) { <nl> minimizeToTray ( ) ; <nl> } <nl> mmm a / Telegram / SourceFiles / window / notifications_manager_default . cpp <nl> ppp b / Telegram / SourceFiles / window / notifications_manager_default . cpp <nl> Notification : : Notification ( <nl> int shift , <nl> Direction shiftDirection ) <nl> : Widget ( manager , startPosition , shift , shiftDirection ) <nl> - # ifdef Q_OS_WIN <nl> - , _started ( GetTickCount ( ) ) <nl> - # endif / / Q_OS_WIN <nl> + , _started ( crl : : now ( ) ) <nl> , _history ( history ) <nl> , _peer ( peer ) <nl> , _author ( author ) <nl> void Notification : : prepareActionsCache ( ) { <nl> bool Notification : : checkLastInput ( bool hasReplyingNotifications ) { <nl> if ( ! _waitingForInput ) return true ; <nl> <nl> - auto wasUserInput = true ; / / TODO <nl> - # ifdef Q_OS_WIN <nl> - LASTINPUTINFO lii ; <nl> - lii . cbSize = sizeof ( LASTINPUTINFO ) ; <nl> - BOOL res = GetLastInputInfo ( & lii ) ; <nl> - wasUserInput = ( ! res | | lii . dwTime > = _started ) ; <nl> - # endif / / Q_OS_WIN <nl> - if ( wasUserInput ) { <nl> + if ( Core : : App ( ) . lastNonIdleTime ( ) > _started ) { <nl> _waitingForInput = false ; <nl> if ( ! hasReplyingNotifications ) { <nl> _hideTimer . start ( st : : notifyWaitLongHide ) ; <nl> mmm a / Telegram / SourceFiles / window / notifications_manager_default . h <nl> ppp b / Telegram / SourceFiles / window / notifications_manager_default . h <nl> class Notification : public Widget { <nl> Animation a_actionsOpacity ; <nl> QPixmap _buttonsCache ; <nl> <nl> - # ifdef Q_OS_WIN <nl> crl : : time _started ; <nl> - # endif / / Q_OS_WIN <nl> <nl> History * _history ; <nl> PeerData * _peer ; <nl>
Refactored checking of last input while notifications are displayed .
telegramdesktop/tdesktop
3372dfcd3e57df5acee893b43b1ad104b70b1999
2019-03-10T18:02:58Z
mmm a / Marlin / Marlin_main . cpp <nl> ppp b / Marlin / Marlin_main . cpp <nl> extern " C " { <nl> extern void digipot_i2c_init ( ) ; <nl> # endif <nl> <nl> + inline void echo_command ( char * const cmd ) { <nl> + SERIAL_ECHO_START ; <nl> + SERIAL_ECHOPAIR ( MSG_ENQUEUEING , cmd ) ; <nl> + SERIAL_CHAR ( ' " ' ) ; <nl> + SERIAL_EOL ; <nl> + } <nl> + <nl> + / * * <nl> + * Shove a command in RAM to the front of the main command queue . <nl> + * Return true if the command is successfully added . <nl> + * / <nl> + inline bool _shovecommand ( const char * cmd , bool say_ok = false ) { <nl> + if ( * cmd = = ' ; ' | | commands_in_queue > = BUFSIZE ) return false ; <nl> + cmd_queue_index_r = ( cmd_queue_index_r + BUFSIZE - 1 ) % BUFSIZE ; / / Index of the previous slot <nl> + commands_in_queue + + ; <nl> + strcpy ( command_queue [ cmd_queue_index_r ] , cmd ) ; <nl> + send_ok [ cmd_queue_index_r ] = say_ok ; <nl> + return true ; <nl> + } <nl> + <nl> + / * * <nl> + * Shove a command to the front of the queue with Serial Echo <nl> + * Return true if the command is successfully added . <nl> + * / <nl> + bool shove_and_echo_command ( const char * cmd , bool say_ok = false ) { <nl> + if ( _shovecommand ( cmd , say_ok ) ) { <nl> + echo_command ( cmd ) ; <nl> + return true ; <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> / * * <nl> - * Inject the next " immediate " command , when possible . <nl> + * Shove a command onto the front of the queue , <nl> + * and don ' t return until successful . <nl> + * / <nl> + void shove_and_echo_command_now ( const char * cmd ) { <nl> + while ( ! shove_and_echo_command ( cmd ) ) idle ( ) ; <nl> + } <nl> + <nl> + / * * <nl> + * Inject the next " immediate " command , when possible , onto the front of the queue . <nl> * Return true if any immediate commands remain to inject . <nl> * / <nl> static bool drain_injected_commands_P ( ) { <nl> static bool drain_injected_commands_P ( ) { <nl> cmd [ sizeof ( cmd ) - 1 ] = ' \ 0 ' ; <nl> while ( ( c = cmd [ i ] ) & & c ! = ' \ n ' ) i + + ; / / find the end of this gcode command <nl> cmd [ i ] = ' \ 0 ' ; <nl> - if ( enqueue_and_echo_command ( cmd ) ) { / / success ? <nl> + if ( shove_and_echo_command ( cmd ) ) { / / success ? <nl> if ( c ) / / newline char ? <nl> - injected_commands_P + = i + 1 ; / / advance to the next command <nl> + injected_commands_P + = i + 1 ; / / advance to the next command <nl> else <nl> - injected_commands_P = NULL ; / / nul char ? no more commands <nl> + injected_commands_P = NULL ; / / nul char ? no more commands <nl> } <nl> } <nl> - return ( injected_commands_P ! = NULL ) ; / / return whether any more remain <nl> + return ( injected_commands_P ! = NULL ) ; / / return whether any more remain <nl> } <nl> <nl> / * * <nl> void enqueue_and_echo_commands_P ( const char * pgcode ) { <nl> drain_injected_commands_P ( ) ; / / first command executed asap ( when possible ) <nl> } <nl> <nl> + / * * <nl> + * Clear the Marlin command queue <nl> + * / <nl> void clear_command_queue ( ) { <nl> cmd_queue_index_r = cmd_queue_index_w ; <nl> commands_in_queue = 0 ; <nl> inline void _commit_command ( bool say_ok ) { <nl> } <nl> <nl> / * * <nl> - * Copy a command directly into the main command buffer , from RAM . <nl> - * Returns true if successfully adds the command <nl> + * Copy a command from RAM into the main command buffer . <nl> + * Return true if the command was successfully added . <nl> + * Return false for a full buffer , or if the ' command ' is a comment . <nl> * / <nl> inline bool _enqueuecommand ( const char * cmd , bool say_ok = false ) { <nl> if ( * cmd = = ' ; ' | | commands_in_queue > = BUFSIZE ) return false ; <nl> inline bool _enqueuecommand ( const char * cmd , bool say_ok = false ) { <nl> return true ; <nl> } <nl> <nl> - void enqueue_and_echo_command_now ( const char * cmd ) { <nl> - while ( ! enqueue_and_echo_command ( cmd ) ) idle ( ) ; <nl> - } <nl> - <nl> / * * <nl> * Enqueue with Serial Echo <nl> * / <nl> bool enqueue_and_echo_command ( const char * cmd , bool say_ok / * = false * / ) { <nl> if ( _enqueuecommand ( cmd , say_ok ) ) { <nl> - SERIAL_ECHO_START ; <nl> - SERIAL_ECHOPAIR ( MSG_Enqueueing , cmd ) ; <nl> - SERIAL_CHAR ( ' " ' ) ; <nl> - SERIAL_EOL ; <nl> + echo_command ( cmd ) ; <nl> return true ; <nl> } <nl> return false ; <nl> } <nl> <nl> + void enqueue_and_echo_command_now ( const char * cmd ) { <nl> + while ( ! enqueue_and_echo_command ( cmd ) ) idle ( ) ; <nl> + } <nl> + <nl> void setup_killpin ( ) { <nl> # if HAS_KILL <nl> SET_INPUT_PULLUP ( KILL_PIN ) ; <nl> void setup_killpin ( ) { <nl> <nl> # endif <nl> <nl> - / / Set home pin <nl> void setup_homepin ( void ) { <nl> # if HAS_HOME <nl> SET_INPUT_PULLUP ( HOME_PIN ) ; <nl> void gcode_line_error ( const char * err , bool doFlush = true ) { <nl> serial_count = 0 ; <nl> } <nl> <nl> + / * * <nl> + * Get all commands waiting on the serial port and queue them . <nl> + * Exit when the buffer is full or when no more characters are <nl> + * left on the serial port . <nl> + * / <nl> inline void get_serial_commands ( ) { <nl> static char serial_line_buffer [ MAX_CMD_SIZE ] ; <nl> static bool serial_comment_mode = false ; <nl> inline void get_serial_commands ( ) { <nl> <nl> # if ENABLED ( SDSUPPORT ) <nl> <nl> + / * * <nl> + * Get commands from the SD Card until the command buffer is full <nl> + * or until the end of the file is reached . The special character ' # ' <nl> + * can also interrupt buffering . <nl> + * / <nl> inline void get_sdcard_commands ( ) { <nl> static bool stop_buffering = false , <nl> sd_comment_mode = false ; <nl> inline void get_serial_commands ( ) { <nl> uint16_t sd_count = 0 ; <nl> bool card_eof = card . eof ( ) ; <nl> while ( commands_in_queue < BUFSIZE & & ! card_eof & & ! stop_buffering ) { <nl> - int16_t n = card . get ( ) ; <nl> + const int16_t n = card . get ( ) ; <nl> char sd_char = ( char ) n ; <nl> card_eof = card . eof ( ) ; <nl> if ( card_eof | | n = = - 1 <nl> inline void get_serial_commands ( ) { <nl> } <nl> if ( sd_char = = ' # ' ) stop_buffering = true ; <nl> <nl> - sd_comment_mode = false ; / / for new command <nl> + sd_comment_mode = false ; / / for new command <nl> <nl> - if ( ! sd_count ) continue ; / / skip empty lines <nl> + if ( ! sd_count ) continue ; / / skip empty lines ( and comment lines ) <nl> <nl> - command_queue [ cmd_queue_index_w ] [ sd_count ] = ' \ 0 ' ; / / terminate string <nl> - sd_count = 0 ; / / clear buffer <nl> + command_queue [ cmd_queue_index_w ] [ sd_count ] = ' \ 0 ' ; / / terminate string <nl> + sd_count = 0 ; / / clear sd line buffer <nl> <nl> _commit_command ( false ) ; <nl> } <nl> mmm a / Marlin / language . h <nl> ppp b / Marlin / language . h <nl> <nl> <nl> / / Serial Console Messages ( do not translate those ! ) <nl> <nl> - # define MSG_Enqueueing " enqueueing \ " " <nl> + # define MSG_ENQUEUEING " enqueueing \ " " <nl> # define MSG_POWERUP " PowerUp " <nl> # define MSG_EXTERNAL_RESET " External Reset " <nl> # define MSG_BROWNOUT_RESET " Brown out Reset " <nl>
Merge pull request from thinkyhead / rc_immediate_shove
MarlinFirmware/Marlin
eab7854a7338970dd8a6f0f864e7dd346e3342a8
2017-03-24T10:52:27Z
mmm a / src / library_glfw . js <nl> ppp b / src / library_glfw . js <nl> var LibraryGLFW = { <nl> # endif <nl> } , <nl> <nl> + onMouseenter : function ( event ) { <nl> + if ( ! GLFW . active ) return ; <nl> + <nl> + if ( event . target ! = Module [ " canvas " ] | | ! GLFW . active . cursorEnterFunc ) return ; <nl> + <nl> + # if USE_GLFW = = 3 <nl> + Runtime . dynCall ( ' vii ' , GLFW . active . cursorEnterFunc , [ GLFW . active . id , 1 ] ) ; <nl> + # endif <nl> + } , <nl> + <nl> + onMouseleave : function ( event ) { <nl> + if ( ! GLFW . active ) return ; <nl> + <nl> + if ( event . target ! = Module [ " canvas " ] | | ! GLFW . active . cursorEnterFunc ) return ; <nl> + <nl> + # if USE_GLFW = = 3 <nl> + Runtime . dynCall ( ' vii ' , GLFW . active . cursorEnterFunc , [ GLFW . active . id , 0 ] ) ; <nl> + # endif <nl> + } , <nl> + <nl> onMouseButtonChanged : function ( event , status ) { <nl> if ( ! GLFW . active | | ! GLFW . active . mouseButtonFunc ) return ; <nl> <nl> var LibraryGLFW = { <nl> Module [ " canvas " ] . addEventListener ( " mouseup " , GLFW . onMouseButtonUp , true ) ; <nl> Module [ " canvas " ] . addEventListener ( ' wheel ' , GLFW . onMouseWheel , true ) ; <nl> Module [ " canvas " ] . addEventListener ( ' mousewheel ' , GLFW . onMouseWheel , true ) ; <nl> + Module [ " canvas " ] . addEventListener ( ' mouseenter ' , GLFW . onMouseenter , true ) ; <nl> + Module [ " canvas " ] . addEventListener ( ' mouseleave ' , GLFW . onMouseleave , true ) ; <nl> <nl> Browser . resizeListeners . push ( function ( width , height ) { <nl> GLFW . onCanvasResize ( width , height ) ; <nl> var LibraryGLFW = { <nl> Module [ " canvas " ] . removeEventListener ( " mouseup " , GLFW . onMouseButtonUp , true ) ; <nl> Module [ " canvas " ] . removeEventListener ( ' wheel ' , GLFW . onMouseWheel , true ) ; <nl> Module [ " canvas " ] . removeEventListener ( ' mousewheel ' , GLFW . onMouseWheel , true ) ; <nl> + Module [ " canvas " ] . removeEventListener ( ' mouseenter ' , GLFW . onMouseenter , true ) ; <nl> + Module [ " canvas " ] . removeEventListener ( ' mouseleave ' , GLFW . onMouseleave , true ) ; <nl> Module [ " canvas " ] . width = Module [ " canvas " ] . height = 1 ; <nl> GLFW . windows = null ; <nl> GLFW . active = null ; <nl>
Merge pull request from cgibson / glfw - mouseenter - callback - fix
emscripten-core/emscripten
3ac90308b3c77d1fcbb71fe0bdd465aa5003c00e
2016-05-07T09:03:30Z
mmm a / Telegram / SourceFiles / platform / mac / mac_touchbar . mm <nl> ppp b / Telegram / SourceFiles / platform / mac / mac_touchbar . mm <nl> <nl> constexpr auto kMaximumIconSize = 44 ; <nl> constexpr auto kCircleDiameter = 30 ; <nl> constexpr auto kPinnedButtonsSpace = 30 ; <nl> + constexpr auto kPinnedButtonsLeftSkip = kPinnedButtonsSpace / 2 ; <nl> <nl> constexpr auto kCommandPlayPause = 0x002 ; <nl> constexpr auto kCommandPlaylistPrevious = 0x003 ; <nl> <nl> } ; <nl> <nl> NSString * const kTypePinned = @ " pinned " ; <nl> + NSString * const kTypePinnedPanel = @ " pinnedPanel " ; <nl> NSString * const kTypeSlider = @ " slider " ; <nl> NSString * const kTypeButton = @ " button " ; <nl> NSString * const kTypeText = @ " text " ; <nl> <nl> const NSString * kCustomizationIdMain = @ " telegram . touchbarMain " ; <nl> const NSTouchBarItemIdentifier kSavedMessagesItemIdentifier = [ NSString stringWithFormat : @ " % @ . savedMessages " , kCustomizationIdMain ] ; <nl> const NSTouchBarItemIdentifier kArchiveFolderItemIdentifier = [ NSString stringWithFormat : @ " % @ . archiveFolder " , kCustomizationIdMain ] ; <nl> + const NSTouchBarItemIdentifier kPinnedPanelItemIdentifierOld = [ NSString stringWithFormat : @ " % @ . pinnedPanelOld " , kCustomizationIdMain ] ; <nl> const NSTouchBarItemIdentifier kPinnedPanelItemIdentifier = [ NSString stringWithFormat : @ " % @ . pinnedPanel " , kCustomizationIdMain ] ; <nl> <nl> const NSTouchBarItemIdentifier kSeekBarItemIdentifier = [ NSString stringWithFormat : @ " % @ . seekbar " , kCustomizationIdPlayer ] ; <nl> <nl> return [ qt_mac_create_nsimage ( pixmap ) autorelease ] ; <nl> } <nl> <nl> + int TouchXPosition ( NSEvent * e , NSView * v ) { <nl> + return [ [ [ e . allTouches allObjects ] objectAtIndex : 0 ] locationInView : v ] . x ; <nl> + } <nl> + <nl> + bool IsSingleTouch ( NSEvent * e ) { <nl> + return [ e . allTouches allObjects ] . count = = 1 ; <nl> + } <nl> + <nl> + QImage PrepareImage ( ) { <nl> + const auto s = kCircleDiameter * cIntRetinaFactor ( ) ; <nl> + auto result = QImage ( QSize ( s , s ) , QImage : : Format_ARGB32_Premultiplied ) ; <nl> + result . fill ( Qt : : transparent ) ; <nl> + return result ; <nl> + } <nl> + <nl> + QImage SavedMessagesUserpic ( ) { <nl> + auto result = PrepareImage ( ) ; <nl> + Painter paint ( & result ) ; <nl> + <nl> + const auto s = result . width ( ) ; <nl> + Ui : : EmptyUserpic : : PaintSavedMessages ( paint , 0 , 0 , s , s ) ; <nl> + return result ; <nl> + } <nl> + <nl> + QImage ArchiveUserpic ( not_null < Data : : Folder * > folder ) { <nl> + auto result = PrepareImage ( ) ; <nl> + Painter paint ( & result ) ; <nl> + <nl> + auto view = std : : shared_ptr < Data : : CloudImageView > ( ) ; <nl> + folder - > paintUserpic ( paint , view , 0 , 0 , result . width ( ) ) ; <nl> + return result ; <nl> + } <nl> + <nl> + NSRect PeerRectByIndex ( int index ) { <nl> + return NSMakeRect ( <nl> + index * ( kCircleDiameter + kPinnedButtonsSpace ) <nl> + + kPinnedButtonsLeftSkip , <nl> + 0 , <nl> + kCircleDiameter , <nl> + kCircleDiameter ) ; <nl> + } <nl> + <nl> int WidthFromString ( NSString * s ) { <nl> return ( int ) ceil ( <nl> [ [ NSTextField labelWithString : s ] frame ] . size . width ) * 1 . 2 ; <nl> bool PaintUnreadBadge ( Painter & p , PeerData * peer ) { <nl> 12 , <nl> unreadSt . font - > flags ( ) , <nl> unreadSt . font - > family ( ) ) ; <nl> - Dialogs : : Layout : : paintUnreadCount ( p , unread , kIdealIconSize , kIdealIconSize - unreadSt . size , unreadSt , nullptr , 2 ) ; <nl> + <nl> + Dialogs : : Layout : : paintUnreadCount ( <nl> + p , <nl> + unread , <nl> + kCircleDiameter , <nl> + kCircleDiameter - unreadSt . size , <nl> + unreadSt , <nl> + nullptr , <nl> + 2 ) ; <nl> return true ; <nl> } <nl> <nl> - ( int ) getTouchX : ( NSEvent * ) e { <nl> } <nl> @ end / / @ implementation PinButton <nl> <nl> + # pragma mark - PinnedDialogsPanel <nl> + <nl> + @ interface PinnedDialogsPanel : NSImageView <nl> + - ( id ) init : ( not_null < Main : : Session * > ) session ; <nl> + @ end / / @ interface PinnedDialogsPanel <nl> + <nl> + @ implementation PinnedDialogsPanel { <nl> + struct Pin { <nl> + PeerData * peer = nullptr ; <nl> + std : : shared_ptr < Data : : CloudImageView > userpicView = nullptr ; <nl> + int index = - 1 ; <nl> + QImage userpic ; <nl> + } ; <nl> + <nl> + rpl : : lifetime _lifetime ; <nl> + Main : : Session * _session ; <nl> + std : : vector < Pin > _pins ; <nl> + QImage _savedMessages ; <nl> + QImage _archive ; <nl> + base : : has_weak_ptr _guard ; <nl> + <nl> + bool _hasArchive ; <nl> + bool _selfUnpinned ; <nl> + int _startPosition ; <nl> + } <nl> + <nl> + - ( id ) init : ( not_null < Main : : Session * > ) session { <nl> + self = [ super init ] ; <nl> + _session = session ; <nl> + _startPosition = 0 ; <nl> + _hasArchive = _selfUnpinned = false ; <nl> + _savedMessages = SavedMessagesUserpic ( ) ; <nl> + <nl> + const auto downloadLifetime = _lifetime . make_state < rpl : : lifetime > ( ) ; <nl> + const auto peerChangedLifetime = _lifetime . make_state < rpl : : lifetime > ( ) ; <nl> + const auto lastDialogsCount = _lifetime . make_state < rpl : : variable < int > > ( 0 ) ; <nl> + auto & & peers = ranges : : views : : all ( <nl> + _pins <nl> + ) | ranges : : views : : transform ( & Pin : : peer ) ; <nl> + <nl> + const auto updateBadge = [ = ] ( Pin & pin ) { <nl> + const auto peer = pin . peer ; <nl> + if ( IsSelfPeer ( peer ) <nl> + | | ! peer - > owner ( ) . history ( peer - > id ) - > unreadCountForBadge ( ) ) { <nl> + return ; <nl> + } <nl> + auto pixmap = App : : pixmapFromImageInPlace ( <nl> + base : : take ( pin . userpic ) ) ; <nl> + if ( pixmap . isNull ( ) ) { <nl> + return ; <nl> + } <nl> + <nl> + Painter p ( & pixmap ) ; <nl> + PaintUnreadBadge ( p , peer ) ; <nl> + pin . userpic = pixmap . toImage ( ) ; <nl> + <nl> + const auto userpicIndex = pin . index + [ self shift ] ; <nl> + [ self setNeedsDisplayInRect : PeerRectByIndex ( userpicIndex ) ] ; <nl> + } ; <nl> + const auto updatePanelSize = [ = ] { <nl> + const auto size = lastDialogsCount - > current ( ) ; <nl> + self . image = [ [ NSImage alloc ] initWithSize : NSMakeSize ( <nl> + size * ( kCircleDiameter + kPinnedButtonsSpace ) <nl> + + kPinnedButtonsLeftSkip <nl> + - kPinnedButtonsSpace / 2 , <nl> + kCircleDiameter ) ] ; <nl> + } ; <nl> + lastDialogsCount - > changes ( <nl> + ) | rpl : : start_with_next ( updatePanelSize , _lifetime ) ; <nl> + const auto singleUserpic = [ = ] ( Pin & pin ) { <nl> + if ( IsSelfPeer ( pin . peer ) ) { <nl> + pin . userpic = _savedMessages ; <nl> + return ; <nl> + } <nl> + auto userpic = pin . peer - > genUserpic ( <nl> + pin . userpicView , <nl> + kCircleDiameter ) ; <nl> + <nl> + Painter p ( & userpic ) ; <nl> + PaintUnreadBadge ( p , pin . peer ) ; <nl> + userpic . setDevicePixelRatio ( cRetinaFactor ( ) ) ; <nl> + pin . userpic = userpic . toImage ( ) ; <nl> + } ; <nl> + const auto updateUserpics = [ = ] { <nl> + ranges : : for_each ( _pins , singleUserpic ) ; <nl> + * lastDialogsCount = [ self shift ] + std : : ssize ( _pins ) ; <nl> + [ self display ] ; <nl> + } ; <nl> + const auto listenToDownloaderFinished = [ = ] { <nl> + base : : ObservableViewer ( <nl> + _session - > downloaderTaskFinished ( ) <nl> + ) | rpl : : start_with_next ( [ = ] { <nl> + const auto all = ranges : : all_of ( _pins , [ = ] ( const auto & pin ) { <nl> + return ( ! pin . peer - > hasUserpic ( ) ) <nl> + | | ( pin . userpicView & & pin . userpicView - > image ( ) ) ; <nl> + } ) ; <nl> + if ( all ) { <nl> + downloadLifetime - > destroy ( ) ; <nl> + } <nl> + updateUserpics ( ) ; <nl> + } , * downloadLifetime ) ; <nl> + } ; <nl> + const auto updatePinnedChats = [ = ] { <nl> + _pins = ranges : : view : : zip ( <nl> + _session - > data ( ) . pinnedChatsOrder ( nullptr , FilterId ( ) ) , <nl> + ranges : : view : : ints ( 0 , ranges : : unreachable ) <nl> + ) | ranges : : views : : transform ( [ = ] ( const auto & pair ) - > Pin { <nl> + const auto index = pair . second ; <nl> + auto peer = pair . first . history ( ) - > peer ; <nl> + if ( ! _pins . empty ( ) & & index < std : : ssize ( _pins ) ) { <nl> + if ( peer - > id = = _pins [ index ] . peer - > id ) { <nl> + / / Reuse the existing pin . <nl> + return _pins [ index ] ; <nl> + } <nl> + } <nl> + auto view = peer - > createUserpicView ( ) ; <nl> + return { std : : move ( peer ) , std : : move ( view ) , index , QImage ( ) } ; <nl> + } ) ; <nl> + _selfUnpinned = ranges : : none_of ( peers , & PeerData : : isSelf ) ; <nl> + <nl> + peerChangedLifetime - > destroy ( ) ; <nl> + for ( const auto & pin : _pins ) { <nl> + _session - > changes ( ) . peerUpdates ( <nl> + pin . peer , <nl> + Data : : PeerUpdate : : Flag : : Photo <nl> + ) | rpl : : start_with_next ( <nl> + listenToDownloaderFinished , <nl> + * peerChangedLifetime ) ; <nl> + <nl> + using UpdateFlag = Data : : PeerUpdate : : Flag ; <nl> + auto to_empty = rpl : : map ( [ = ] { return rpl : : empty_value ( ) ; } ) ; <nl> + <nl> + rpl : : merge ( <nl> + _session - > changes ( ) . historyUpdates ( <nl> + _session - > data ( ) . history ( pin . peer ) , <nl> + Data : : HistoryUpdate : : Flag : : UnreadView <nl> + ) | to_empty , <nl> + _session - > changes ( ) . peerFlagsValue ( <nl> + pin . peer , <nl> + UpdateFlag : : Notifications <nl> + ) | to_empty <nl> + ) | rpl : : start_with_next ( [ = ] { <nl> + updateBadge ( _pins [ pin . index ] ) ; <nl> + } , * peerChangedLifetime ) ; <nl> + } <nl> + <nl> + updateUserpics ( ) ; <nl> + / / ranges : : for_each ( peers , updateBadge ) ; <nl> + } ; <nl> + <nl> + rpl : : single ( <nl> + rpl : : empty_value ( ) <nl> + ) | rpl : : then ( <nl> + _session - > data ( ) . pinnedDialogsOrderUpdated ( ) <nl> + ) | rpl : : start_with_next ( updatePinnedChats , _lifetime ) ; <nl> + <nl> + const auto ArchiveId = Data : : Folder : : kId ; <nl> + rpl : : single ( <nl> + rpl : : empty_value ( ) <nl> + ) | rpl : : map ( [ = ] { <nl> + return _session - > data ( ) . folderLoaded ( ArchiveId ) ; <nl> + } ) | rpl : : then ( <nl> + _session - > data ( ) . chatsListChanges ( ) <nl> + ) | rpl : : filter ( [ ] ( Data : : Folder * folder ) { <nl> + return folder & & ( folder - > id ( ) = = ArchiveId ) ; <nl> + } ) | rpl : : start_with_next ( [ = ] ( Data : : Folder * folder ) { <nl> + _hasArchive = ! folder - > chatsList ( ) - > empty ( ) ; <nl> + if ( _archive . isNull ( ) ) { <nl> + _archive = ArchiveUserpic ( folder ) ; <nl> + } <nl> + updateUserpics ( ) ; <nl> + } , _lifetime ) ; <nl> + <nl> + base : : ObservableViewer ( <nl> + * Window : : Theme : : Background ( ) <nl> + ) | rpl : : filter ( [ ] ( const Window : : Theme : : BackgroundUpdate & update ) { <nl> + return update . paletteChanged ( ) ; <nl> + } ) | rpl : : start_with_next ( [ = ] { <nl> + crl : : on_main ( & _guard , [ = ] { <nl> + if ( const auto f = _session - > data ( ) . folderLoaded ( ArchiveId ) ) { <nl> + _archive = ArchiveUserpic ( f ) ; <nl> + } <nl> + _savedMessages = SavedMessagesUserpic ( ) ; <nl> + updateUserpics ( ) ; <nl> + } ) ; <nl> + } , _lifetime ) ; <nl> + <nl> + listenToDownloaderFinished ( ) ; <nl> + return self ; <nl> + } <nl> + <nl> + - ( int ) shift { <nl> + return ( _hasArchive ? 1 : 0 ) + ( _selfUnpinned ? 1 : 0 ) ; <nl> + } <nl> + <nl> + - ( void ) touchesBeganWithEvent : ( NSEvent * ) event { <nl> + if ( ! IsSingleTouch ( event ) ) { <nl> + return ; <nl> + } <nl> + _startPosition = TouchXPosition ( event , self ) ; <nl> + [ super touchesBeganWithEvent : event ] ; <nl> + } <nl> + <nl> + - ( void ) touchesEndedWithEvent : ( NSEvent * ) event { <nl> + if ( ! IsSingleTouch ( event ) ) { <nl> + return ; <nl> + } <nl> + const auto currentPosition = TouchXPosition ( event , self ) ; <nl> + const auto step = kPinnedButtonsSpace ; <nl> + if ( std : : abs ( _startPosition - currentPosition ) < step ) { <nl> + [ self performAction : currentPosition ] ; <nl> + } <nl> + } <nl> + <nl> + - ( void ) performAction : ( int ) xPosition { <nl> + const auto x = xPosition <nl> + - kPinnedButtonsLeftSkip <nl> + + kPinnedButtonsSpace / 2 ; <nl> + const auto index = x / ( kCircleDiameter + kPinnedButtonsSpace ) <nl> + - [ self shift ] ; <nl> + <nl> + const auto peer = ( index < 0 | | index > = std : : ssize ( _pins ) ) <nl> + ? nullptr <nl> + : _pins [ index ] . peer ; <nl> + if ( ! peer & & ! _hasArchive & & ! _selfUnpinned ) { <nl> + return ; <nl> + } <nl> + <nl> + const auto active = Core : : App ( ) . activeWindow ( ) ; <nl> + const auto controller = active ? active - > sessionController ( ) : nullptr ; <nl> + const auto openFolder = [ = ] { <nl> + const auto folder = _session - > data ( ) . folderLoaded ( Data : : Folder : : kId ) ; <nl> + if ( folder & & controller ) { <nl> + controller - > openFolder ( folder ) ; <nl> + } <nl> + } ; <nl> + Core : : Sandbox : : Instance ( ) . customEnterFromEventLoop ( [ = ] { <nl> + ( _hasArchive & & ( index = = ( _selfUnpinned ? - 2 : - 1 ) ) ) <nl> + ? openFolder ( ) <nl> + : controller - > content ( ) - > choosePeer ( <nl> + ( _selfUnpinned & & index = = - 1 ) <nl> + ? _session - > userPeerId ( ) <nl> + : peer - > id , <nl> + ShowAtUnreadMsgId ) ; <nl> + } ) ; <nl> + } <nl> + <nl> + - ( QImage ) imageToDraw : ( int ) i { <nl> + Expects ( i < std : : ssize ( _pins ) ) ; <nl> + if ( i < 0 ) { <nl> + if ( _hasArchive & & ( i = = - [ self shift ] ) ) { <nl> + return _archive ; <nl> + } else if ( _selfUnpinned ) { <nl> + return _savedMessages ; <nl> + } <nl> + } <nl> + return _pins [ i ] . userpic ; <nl> + } <nl> + <nl> + - ( void ) drawRect : ( NSRect ) dirtyRect { <nl> + const auto shift = [ self shift ] ; <nl> + if ( _pins . empty ( ) & & ! shift ) { <nl> + return ; <nl> + } <nl> + for ( auto i = - shift ; i < std : : ssize ( _pins ) ; i + + ) { <nl> + const auto rect = PeerRectByIndex ( i + shift ) ; <nl> + if ( ! NSIntersectsRect ( rect , dirtyRect ) ) { <nl> + continue ; <nl> + } <nl> + CGContextRef context = [ [ NSGraphicsContext currentContext ] CGContext ] ; <nl> + CGImageRef image = ( [ self imageToDraw : i ] ) . toCGImage ( ) ; <nl> + CGContextDrawImage ( context , rect , image ) ; <nl> + CGImageRelease ( image ) ; <nl> + <nl> + } <nl> + } <nl> + <nl> + @ end / / @ @ implementation PinnedDialogsPanel <nl> + <nl> + # pragma mark - End PinnedDialogsPanel <nl> + <nl> @ interface PinnedDialogButton : NSCustomTouchBarItem <nl> <nl> @ property ( nonatomic , assign ) int number ; <nl> - ( id ) init : ( NSView * ) view session : ( not_null < Main : : Session * > ) session { <nl> _duration = 0 ; <nl> _parentView = view ; <nl> self . touchBarItems = @ { <nl> - kPinnedPanelItemIdentifier : [ NSMutableDictionary dictionaryWithDictionary : @ { <nl> + kPinnedPanelItemIdentifierOld : [ NSMutableDictionary dictionaryWithDictionary : @ { <nl> @ " type " : kTypePinned , <nl> } ] , <nl> + kPinnedPanelItemIdentifier : [ NSMutableDictionary dictionaryWithDictionary : @ { <nl> + @ " type " : kTypePinnedPanel , <nl> + } ] , <nl> kSeekBarItemIdentifier : [ NSMutableDictionary dictionaryWithDictionary : @ { <nl> @ " type " : kTypeSlider , <nl> @ " name " : @ " Seek Bar " <nl> - ( id ) init : ( NSView * ) view session : ( not_null < Main : : Session * > ) session { <nl> } , _lifetime ) ; <nl> <nl> _session - > data ( ) . pinnedDialogsOrderUpdated ( <nl> - ) | rpl : : start_with_next ( [ self ] { <nl> - [ self updatePinnedButtons ] ; <nl> + ) | rpl : : start_with_next ( [ ] { <nl> + / / [ self updatePinnedButtons ] ; <nl> } , _lifetime ) ; <nl> <nl> _session - > data ( ) . chatsListChanges ( <nl> - ( id ) init : ( NSView * ) view session : ( not_null < Main : : Session * > ) session { <nl> & & folder - > chatsList ( ) <nl> & & folder - > id ( ) = = Data : : Folder : : kId ; <nl> } ) | rpl : : start_with_next ( [ = ] ( Data : : Folder * folder ) { <nl> - [ self toggleArchiveButton : folder - > chatsList ( ) - > empty ( ) ] ; <nl> + / / [ self toggleArchiveButton : folder - > chatsList ( ) - > empty ( ) ] ; <nl> } , _lifetime ) ; <nl> <nl> <nl> - ( id ) init : ( NSView * ) view session : ( not_null < Main : : Session * > ) session { <nl> [ self updatePickerPopover : ScrubberItemType : : Emoji ] ; <nl> } , _lifetime ) ; <nl> <nl> - [ self updatePinnedButtons ] ; <nl> + / / [ self updatePinnedButtons ] ; <nl> <nl> return self ; <nl> } <nl> - ( nullable NSTouchBarItem * ) touchBar : ( NSTouchBar * ) touchBar <nl> item . view = stackView ; <nl> [ dictionaryItem setObject : item . view forKey : @ " view " ] ; <nl> return item ; <nl> + } else if ( isType ( kTypePinnedPanel ) ) { <nl> + auto * item = [ [ NSCustomTouchBarItem alloc ] initWithIdentifier : identifier ] ; <nl> + item . customizationLabel = @ " Pinned Panel " ; <nl> + item . view = [ [ PinnedDialogsPanel alloc ] init : _session ] ; <nl> + [ dictionaryItem setObject : item . view forKey : @ " view " ] ; <nl> + return item ; <nl> } <nl> <nl> return nil ; <nl> - ( void ) updatePickerPopover : ( ScrubberItemType ) type { <nl> - ( void ) toggleArchiveButton : ( bool ) hide { <nl> for ( PinnedDialogButton * button in _mainPinnedButtons ) { <nl> if ( button . number = = kArchiveId ) { <nl> - NSCustomTouchBarItem * item = [ _touchBarMain itemForIdentifier : kPinnedPanelItemIdentifier ] ; <nl> + NSCustomTouchBarItem * item = [ _touchBarMain itemForIdentifier : kPinnedPanelItemIdentifierOld ] ; <nl> NSStackView * stack = item . view ; <nl> [ button updateUserpic ] ; <nl> if ( hide & & ! button . isDeletedFromView ) { <nl> - ( void ) updatePinnedButtons { <nl> auto isSelfPeerPinned = false ; <nl> auto isArchivePinned = false ; <nl> PinnedDialogButton * selfChatButton ; <nl> - NSCustomTouchBarItem * item = [ _touchBarMain itemForIdentifier : kPinnedPanelItemIdentifier ] ; <nl> + NSCustomTouchBarItem * item = [ _touchBarMain itemForIdentifier : kPinnedPanelItemIdentifierOld ] ; <nl> NSStackView * stack = item . view ; <nl> <nl> for ( PinnedDialogButton * button in _mainPinnedButtons ) { <nl>
Reimplemented panel of pinned dialogs for touchbar .
telegramdesktop/tdesktop
0e794d53cdd5484f512437c06114c02f0cae2f04
2020-06-26T12:05:08Z
mmm a / dlib / test / CMakeLists . txt <nl> ppp b / dlib / test / CMakeLists . txt <nl> set ( tests <nl> conditioning_class_c . cpp <nl> conditioning_class . cpp <nl> config_reader . cpp <nl> + corellation_tracker . cpp <nl> crc32 . cpp <nl> create_iris_datafile . cpp <nl> data_io . cpp <nl> new file mode 100644 <nl> index 000000000 . . 5b666dfa7 <nl> mmm / dev / null <nl> ppp b / dlib / test / corellation_tracker . cpp <nl> <nl> + / / Copyright ( C ) 2013 Davis E . King ( davis @ dlib . net ) <nl> + / / License : Boost Software License See LICENSE . txt for the full license . <nl> + <nl> + # include " tester . h " <nl> + # include < dlib / image_processing . h > <nl> + # include < vector > <nl> + # include < sstream > <nl> + # include < dlib / compress_stream . h > <nl> + # include < dlib / base64 . h > <nl> + # include < dlib / image_io . h > <nl> + <nl> + namespace <nl> + { <nl> + using namespace test ; <nl> + using namespace dlib ; <nl> + using namespace std ; <nl> + dlib : : logger dlog ( " test . corellation_tracker " ) ; <nl> + <nl> + <nl> + class corellation_tracker_tester : public tester <nl> + { <nl> + public : <nl> + corellation_tracker_tester ( <nl> + ) : <nl> + tester ( <nl> + " test_corellation_tracker " , / / the command line argument name for this test <nl> + " Run tests on the corellation_tracker functions . " , / / the command line argument description <nl> + 0 / / the number of command line arguments for this test <nl> + ) <nl> + { <nl> + } <nl> + <nl> + void perform_test ( <nl> + ) <nl> + { <nl> + dlog < < LINFO < < " perform_test ( ) " ; <nl> + <nl> + typedef const std : : string ( * frame_fn_type ) ( ) ; <nl> + / / frames from examples folder <nl> + frame_fn_type frames [ ] = { & get_decoded_string_frame_000100 , <nl> + & get_decoded_string_frame_000101 , <nl> + & get_decoded_string_frame_000102 , <nl> + & get_decoded_string_frame_000103 <nl> + } ; <nl> + / / correct tracking rectangles - recorded by successful runs <nl> + drectangle correct_rects [ ] = { drectangle ( 74 , 67 , 111 , 152 ) , <nl> + drectangle ( 76 . 025 , 72 . 634 , 112 . 799 , 157 . 114 ) , <nl> + drectangle ( 78 . 6849 , 78 . 504 , 115 . 413 , 162 . 88 ) , <nl> + drectangle ( 82 . 7572 , 83 . 6035 , 120 . 319 , 169 . 895 ) <nl> + } ; <nl> + / / correct update results - recorded by successful runs <nl> + double correct_update_results [ ] = { 0 , 18 . 3077 , 16 . 8406 , 13 . 1716 } ; <nl> + <nl> + correlation_tracker tracker ; <nl> + std : : istringstream sin ( frames [ 0 ] ( ) ) ; <nl> + array2d < unsigned char > img ; <nl> + load_bmp ( img , sin ) ; <nl> + tracker . start_track ( img , centered_rect ( point ( 93 , 110 ) , 38 , 86 ) ) ; <nl> + for ( unsigned i = 1 ; i < sizeof ( frames ) / sizeof ( frames [ 0 ] ) ; + + i ) <nl> + { <nl> + std : : istringstream sin ( frames [ i ] ( ) ) ; <nl> + load_bmp ( img , sin ) ; <nl> + double res = tracker . update ( img ) ; <nl> + double correct_res = correct_update_results [ i ] ; <nl> + double res_diff = abs ( correct_res - res ) ; <nl> + / / small error possible due to rounding and different optimization options <nl> + drectangle pos = tracker . get_position ( ) ; <nl> + drectangle correct_pos = correct_rects [ i ] ; <nl> + drectangle pos_intresect = pos . intersect ( correct_pos ) ; <nl> + double pos_area = pos . area ( ) ; <nl> + double intersect_area = pos_intresect . area ( ) ; <nl> + double rect_confidence = intersect_area / pos_area ; <nl> + dlog < < LINFO < < " Frame # " < < i < < " res : " < < res < < " correct res : " < < correct_res < < " pos : " < < pos <nl> + < < " correct pos : " < < correct_pos < < " rect confidence : " < < rect_confidence ; <nl> + / / small error possible due to rounding and different optimization options <nl> + DLIB_TEST ( res_diff < = 1 ) ; <nl> + DLIB_TEST ( rect_confidence > = 0 . 99 ) ; <nl> + print_spinner ( ) ; <nl> + } <nl> + } <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + / / This function returns the contents of the file ' frame_000100 . bmp ' <nl> + static const std : : string get_decoded_string_frame_000100 ( ) <nl> + { <nl> + dlib : : base64 base64_coder ; <nl> + dlib : : compress_stream : : kernel_1ea compressor ; <nl> + std : : ostringstream sout ; <nl> + std : : istringstream sin ; <nl> + <nl> + / / The base64 encoded data from the file ' . . \ . . \ examples \ video_frames \ frame_000100 . bmp ' we want to decode and return . <nl> + sout < < " Qld + lmlZhXVX5NDRWIFG1T4 + OGdJbkmxAXXdHZEtpDf6knVTlRWyAhgv85Tf11KJZbhKv1dcsKtQ " ; <nl> + sout < < " fX3y / 9RxoGwtXxs / KaBv3IrfvBK5WFRWzOM7H11xVin5AjxdzyzgU28fRgEasu0Jvk3SaMBNM1cI " ; <nl> + sout < < " ZAK + MA + qEKwBn + rkuLbptS4sUNNC8PWaqLqNQ577TiMbsEgoa1FGkZX4feP8EfvV7w8H4FvbS + Cl " ; <nl> + sout < < " yJCj0Q0Bx2fqFCDaAVtlm41VIJUFS7AePKmSnVnAlYYOQ35XxWS2sjAlWZHXiEfKmWmSOTt3x9 / u " ; <nl> + sout < < " 5l78aPB0FvrUgF5RrvyVIOSgsC250JwINl8uulOOsykmhUUjRCw81dAITDr / d2EAYmPyiYNZWbvl " ; <nl> + sout < < " 0Iy4f9sOJr0HnaPdCSvojI9 / xdQVT3MVjHhu82UtpJ2cuc1MjUooCZdQmTn1mksdAdZtsn78aRMw " ; <nl> + sout < < " P97MKVgFmYMmG + yekaN6 + nYFgTXnuEnatHDszyavB3 + 73iWTYiYs + CDRqEJ7XUkp + F97W / hUuvFr " ; <nl> + sout < < " DwePerItRkWZN8Nmnjx0Jibv2wu37zkFVnFIAydvV9GzaFDd75hUwQE5rjGN8jp4dBMNwcK6l7kt " ; <nl> + sout < < " xLm5hYF2eo9sESGJqR + 8uAhGsQZESUpdBvLmf / + 28MVfY7Li0lmeq + bz + JxvIa / jF5ptffuTRtZd " ; <nl> + sout < < " WLbJK + EXlfeorbfh + 6di5CPp5 / 50W5zrOepXHeDfrzCIpz6XTCw4k749ajiMk5y5XUAk / gObe1bG " ; <nl> + sout < < " JZeGfMezy6bNcosolf5mmg5yDk07bK0JTLGFvYALT8aZFfUTHR8 + 47krp43r6XxaalqH3JFy3pYz " ; <nl> + sout < < " 3t1IQPC2wz9FiCGBpn + UdULDwpBt0oqbGJYGEHDWgzwv8dv31NEbqez + G + HSEfF7CWs80SH3yYzL " ; <nl> + sout < < " 9EjKo7ANmcYWtr8 + 3 / SpUl0Yyzn / 7zDL7191rWglr3N06 + bB + bdQy7J1yGueGtTsO5XMqfUEQL5n " ; <nl> + sout < < " xQ2FOU9c39cruW0Fp8TDkEKM6gowBRTelXMA1w84 + L9Dynheg1iLE8MSrzvA0 / TlXoFD7Wt1cC / 6 " ; <nl> + sout < < " EoYPulG3BRy / 3ugzUeiHm4ZWh95YOflbH2p8Ix + 5 / sBZ + W5xSr / 37NRYi1nQ1jFwqPdAHx / OGvfW " ; <nl> + sout < < " BKhz + PF3146JpvuVbq9fTqjqYeM + qcAu1mS + VqDyJTw3IlvRUsixyJu7 / eN01m08yumXP2mm4SwC " ; <nl> + sout < < " Q0j4aPKRzl4rRx5PJE4qnKxmrxSa5DavIO6ik + DKR + leGGk29zEqY + UcsqcJQLKWVy3k40wL8ouF " ; <nl> + sout < < " ihEPUISSZDTE / iU / 4wntqVXCP9vRNYnrnXVbh6EFFA6nr4dBrj + qnkkpDxrt3tGA0Dml1u68hNhI " ; <nl> + sout < < " aI2bAca + a1TXb9mn18JTJqK6tkoJmE4JP / T5W03PSGYhRDa0ddNEt06eVPuCrSyDwQ2lQVjHiF7N " ; <nl> + sout < < " iHVbLJOQ49 / / SmXdeId3 + sJ4NwRM0jquqURHrBAYwuEImtqZDgJ9Ac7iC5FDMuigc3KJ6Y3MRAI9 " ; <nl> + sout < < " irrbcei2XbALqQH4hsHiOvplAaUwqE2f8iaHHQrzSKdNoRpl / 0rWgEU4eWcKVl7JmmwLRWqRDg6x " ; <nl> + sout < < " jYDZ9Bu3KAR3llOBPHN6G6VcVx8TfP6qHb7bYh0 + lKqIv7qNYUdbVNZLnfBSrgYkrbf8LmgiUAyS " ; <nl> + sout < < " d3JNuR7XsICjOPdEgC5OhKHNT8w / wcZBN1T2svgaokoYxI + dV9t84s5h + W1RgCLTnEu5Lz811RlG " ; <nl> + sout < < " KEAZ + AgqPAk6PneeZs / Ujk1Q8ISZ / K6pL1SBnZN2RaN731UHMYJKK4 / yCfdkqGAtFBnS4vvA82tV " ; <nl> + sout < < " uv2SwPvhD2KHvZDCsAVPXFQWVVkzTWKRcSXe55vgnZjF33ziAFILy9xNklmZZ / tDpZa3I6VDkNUW " ; <nl> + sout < < " o5 + eLuUcJRi / dlrKnNaHSsjV6jQd0ud + JB + Gv2YfV9XcxFZDPavRGkNRdOTe045rJ7QKTI5OqZ5o " ; <nl> + sout < < " DZ9Olo25TyXVteyt9CwVAlLB2owBoEmni8HFWUS1TiFWmU + DupCJw60bwE9SLhR1KpfUp32Myg2S " ; <nl> + sout < < " 6e7PJVndER84KdqRkPFWZyJsBTXJ6U1g273ty7MLFxZYmCp7SwvtXNrPMJ5yCS5VGa7sX8xavNkJ " ; <nl> + sout < < " ade8iiSs0Upqbm71iDbMCp4oBRxa1w9zMWZ0VF + Qg4HVyKdyRmtJzBmRvUmujyYFCQwMtmzCgIu7 " ; <nl> + sout < < " mPCbA7EWkoteGnuFIgag9P7kAzEF6pI46gd6UyOOFF44eUytnP1AqCJYHvNexViNZ0FXzgoCzHMs " ; <nl> + sout < < " m6RPhsqJnQjG + KaefJm52DCfLNOPd6 + rj4mv5iQeVEyNUtdHuS3ll1svho7IKMF0KXyjajXV2X8i " ; <nl> + sout < < " BaHxZ25zSlogQy / / I4qdHx2SlUkiGJC8jpRZ9LVmaCWGCnbEnHn3uiiwTLRiPO0G2qgbMjgMvius " ; <nl> + sout < < " XjOSu1Dlbz4A4XJ5nxRyF + 7uG450OJbVF6LUYujHukrHn8LADkKQxY60sddDMcx16lofSVJEF2X8 " ; <nl> + sout < < " pwhXS + EcqDHQ5pT0Z7 + fMFSumC6kTWJIfcwXrTJDcWslF + cnQw / qmlnSjK1jnTyU5YpjyByETfWc " ; <nl> + sout < < " hpFJbt0INtrUIDjOwXha0dlbC / jLXrVbW26wTJrKmi7ftD6CJSE8cZBGLXCX4zakRRPg3DEHsv8D " ; <nl> + sout < < " BFwPWlX7keygRS8L6o8teh9LHlYSbFqlno7FNqKh1V7D1ERDvsBO + 6xoabo + mYXOdtyVWPWxJ0Kg " ; <nl> + sout < < " 1qsnFibHgmqi4RFHoSMkAcHVYj9cHhiFo3DSj8sm8l6FGBQSm + o + oehamFW6xIL9ICgm7gcBQH6N " ; <nl> + sout < < " BH3f6q0CorAetVw7kyLqNiEt7G3V1DRjJ7bcn0 / ziYsn6dZQ6kq9gslBWZe0dp227DpameI0TliG " ; <nl> + sout < < " pZ + d5 + sm6g1jE1H5H6Zlh6jJ9xDMywzNFOitOdcOL0YFuzsxKXVPA1Ye9 / wYqtUyJbFvO2ZqDSbC " ; <nl> + sout < < " k2z1UcbCv9KQhonO7aO6qgkaRIFmPmV82R7JsHqjA7CPQC / hURfB7qWP5mzvyB8oEqtd8LSuMgCC " ; <nl> + sout < < " 2WRsJTQ6GU40AoOcUFDPOo / Gv99uWzDQaGgJJzIxPlKhT3EtJWH7ZiapmojgRgdS2iEAXb4adzRQ " ; <nl> + sout < < " / NsD80C6PvsuxB6NEravtrBV4nz7fXq2u1mPkjv + / jmp0hHf5SV1YDE + j + EfZqNMgEMaWJfMDbxs " ; <nl> + sout < < " C70Ji0d8iv7zyevr8fIrVmTbttOxS73NShBRX7mHQnUcDZFDfLJy464v8PEvwX0gr8 / ytzdMJTrN " ; <nl> + sout < < " LEYHS / + ZxEN3CZyr5tzYL + DdqsTY4qFyuoQOQ0brplrGc2E1LubNhGVHXoKTsAE1 + D9oq81HG4VH " ; <nl> + sout < < " Y91M0A3 + ckyDvQ + dTtPx + KT0on8OkZzSLy0VUJ6yHVmzlzL2R2B / C8Gp2KHKk2YJLxE8DLPRkOyz " ; <nl> + sout < < " ZPrWyDUWKir87Cm6xHLScUj0MWujlg / ag1CLz38LKEBzoYxCzqQ / Zmyfp3NZRi + PEhSlSj8AyVPv " ; <nl> + sout < < " FOFacvTBn + dQwWq6uLbOBXJiycohjgBGxrLc7ILTp2FHmNfpELCTCowepYKuO8VnEBGlIUJAH7 + I " ; <nl> + sout < < " zTtM2bvgr7k0b8dwh4SMdCBSOWPfYxuY8kVy / vcW0xKeAkrwKlVuL1 + HJAtUTK0p9BOWl3bi7E4q " ; <nl> + sout < < " Ur5UH6CSaVzbn7QvGh1wSKbr48XdeOx / MlqvH6yKeXxT + iogx7BdmQAMOsndXWH + T + HBbmqIF6Z8 " ; <nl> + sout < < " qA68Q6qcooNpHu13lqIojIbbf6VUT9eG9RqGPYXxKBAdWuRDbMmklXYoM7PI4VlmBcIgq + 4U9Bps " ; <nl> + sout < < " Yge / Oqf6DPFxPaqG + FnYPl7GpcXHNHAsBh5JwaDAM5uKCq4Y720KHLKqG1buziPjRwUr / 5LhXyu6 " ; <nl> + sout < < " CF1ZzEKb6w26NDjD47myrFKRihB1zVZBxb6uIlHVcEqFZhJqC0uV / QQjRUfAQrG9G804Bcf7nuGM " ; <nl> + sout < < " 6u + nXr1Xl + oQIRiEYueMD1T0WbiIYIIO6lT0ICkSQQjoLQXq / 8KP21Yrutv3H4PjDZXOPi9Z6Rcl " ; <nl> + sout < < " 40Vfdt9jyqeRgBhkhloRYFOBwXLYxlb6umBcmXoT3cv / Zlh4SfQrpG / LrfAHtYFyfwoDzXcV8Xuq " ; <nl> + sout < < " qAtTkj97UcAVnfC0lNrBnWCT2SieQUl8nNLoIQl9uhzRBFHH7U9ey6uX3zop4esABGV / DL1ypLd2 " ; <nl> + sout < < " Yu2Q6XU + 1j7wh3Rn5zttubqvYR8P5jMEqMUaX2Fith42jHy0U1NuNzX / MPCm6DFLvah / G / 0sPKiP " ; <nl> + sout < < " lboucbKekedV / knGV3kx + h6MmMgBRC4OkkPf3HG5ewpVpe4I3SZ / auTk1ZnePM5RL5wskdGCdbND " ; <nl> + sout < < " njzEv5sKtTE1TxCAgVh6iFUtvr7c + 3DNDkTilcm + ILRMwEr9vCF / OGcOT3YWr9cW / eP6fy / 801bU " ; <nl> + sout < < " nhotDzcKSPQbbN7jd3WIe6kaeXjsBk6LIHmPjtGPT3UdRFhEJZrnABhQrasLPeY0 / + dODC5Y3GcC " ; <nl> + sout < < " fV68kmensUcZ / 5hFSEpLsScx / OtGvFI7hLNBAAJ6bhEuvgId7OXxQgWjQ6wKDhwOJmEB1Ra / Bztw " ; <nl> + sout < < " 4bGdRMl6c99nGcc9GmSWI1CmQZqbNfxL7AKO1oSkwpWbK9E9Cl + ZV5XyP28AQky4KQlYBvwUDH57 " ; <nl> + sout < < " LvtOvuIe / HzSagQjG8Sxf7wGF + MAz7MLRtFYGkHviL + mRvtp0NSHSYDEOqaIsnk1HbTWHUj0FUQt " ; <nl> + sout < < " AD14VkX9ReVi1LnJGJNwmjeLYk7keYTkksi / kKEWCkh / 8Av2Rlk7oZCwODxsAcnAyXStJV0tEAHN " ; <nl> + sout < < " lq7MaAJz5zWZ4ZsETA5mn + 3Qj4jIi5vbqJScxOh5KCvyOYfio9Eo + DPvyJtvyjGnqVkoFFk7v + 8H " ; <nl> + sout < < " e4d20Aq0vfYGKPzVNoXAtOPuA6 / d / 2yizrl9gEPBGVw2I3Q1 / XlFMIHHZ3yT1TGJfGXcVkrYRhDY " ; <nl> + sout < < " s8k6oEKbp0QQUiSkercwxbLpSMblFDaGeudPcWzKVwPE52rMEzh1 / jr72s6ZUd / + Os2b3 + CEg + lj " ; <nl> + sout < < " AlnkU1tNZVnanmzOb5xBnk1H + 3Q + FppUe9MgOK73344O7QlbBklWclKizZIoRVaOeP7WvjXSJK / A " ; <nl> + sout < < " PPXXyKLMwP8eYDDPKOTA7MvBH3q4r7j7Au5av2sn1ZGwxBHLH4aYFH54kXJa5rwl0TgsTAHsQ2 + 5 " ; <nl> + sout < < " 0 / OWixbr8Ysl2JxunMjcewhJFI3mLHFmsYfVYDwC2 + hIubW231HCxvqI5BgWZZRU + 9DZ2hdQ + orw " ; <nl> + sout < < " qocOI3yK5uHs6Qaxv9HPgWzNXLG4a1h2C + RbhIFMGNUcDAGrCgBCgepruLT0RLuaSYrsZY / gWRwj " ; <nl> + sout < < " krk1M69 / lnwvZlasFruau26RLyMAbELixpeeGpztv / tJx5fqStsjMGLHUsRj0SKgXgdawRdgUXUs " ; <nl> + sout < < " Hepp9HsmJ / HR + 5xAv8ORiEQekO02b / 2wgqGTYXyHGT + RP9f76A90kVJ6Px4njrOLrICyTUcIFrIh " ; <nl> + sout < < " 0AvbAEysPnxbtYcp5tdNbG2RuarygtgscOxERIa1NaunqnBouzW88mOLeTgBV9Ofh2fvX3qalfcs " ; <nl> + sout < < " xYY4 / / taBvyKWHiCanf5drYyOBPm1m8uzNP9ew6K6IYC6S4m8aklO + NrkoCqL2sq6Ged5y1nsWws " ; <nl> + sout < < " BLeSaCakjVDU3ysh + J8YamF1Tzp + cOfh9dAquG4sk2jJmSfgl31jtG2lCBkBRQf + Cybgr7QfJYGd " ; <nl> + sout < < " ZoX4RLzmSK3BXrufSNHntV7dXKCDT + 2NvrW4n1EUegwonALERWRTMRDmA2NPZYgqr5cy8v0KQr0V " ; <nl> + sout < < " hvEMjqP / 9SPJdTtbjJY7WtdTNU5Er4KdzasYcJjphAPU3zC5PtCHbtTVUGXNz1UneXnzrN13zlK4 " ; <nl> + sout < < " WyJ9UcXeWpjtztobQZ / 8NwXiYOndZ + / qF3BdYjHYDYhSjod4JyCnmLuy + cVG9yB3e21XVeUVC8sh " ; <nl> + sout < < " 7yg2oBx + 9yn1ZK5ResSEAmX + m6Jq0etJWVnYvnl6TSN0XAFbZRk5n6r9w443Frw8RVRfYyISbuTm " ; <nl> + sout < < " oLMaClZFf / XxxvCIQAd6 + IDMzukUDvEKObp2 + rbf7IWZtDUeR3VpCp3CJhTMr2UBRC68fwB3mx / n " ; <nl> + sout < < " C2pAyPNX8WbZ8ZpAbtW3ax8U + yh2rH + hEK6zJSXFZk0Ea9Yc4MNhtDqGEXLgBvPX / OMH4E5wJxTP " ; <nl> + sout < < " H070u7 + OQWwA + Aeup / / kJ + jm8EqF2RTAyGCiiYl8JXAMNBdIGaG + kzb9RzRD + YiyOrV / WyXn2pFv " ; <nl> + sout < < " 68NBt9sunIBnzNMLCPzT3lb4DcoOExmoOjcrziN6G2HjRsrkmyVnjvgoWO2wILYkm + yGy + ZEM1U4 " ; <nl> + sout < < " MpVYZgXikHOos / FR0GG9H65gUCPthPn448mtVNFvuYJhhenvuuSkUWI2IFW + rhEeOUXg + r4ZISpZ " ; <nl> + sout < < " F26 + EzKiDYKJWbJQNrVJv7CygE6SZ6E4VnKuXbzKHDct3O5EHoE3NDCO7J5kD7RyFE6HgUXusSgb " ; <nl> + sout < < " kH2DOgJrK8KXhwcDIH4AmrPFukCmgS0 / yTWOjiZKW8dmp9q9UHKQlRf1rqgmkph2fGXXBbi + AMLd " ; <nl> + sout < < " qtk8gsm5Gb / a / fHIg8zOJ295ZShCqWm87z9jK5lx0 / kFZKraB2JleJ0ryPFXCOp60hUbSvzzfxJ7 " ; <nl> + sout < < " JkH1dWoRvWr3wpXrwZucfHH11AeFRe3ShRaAKy42 + CclzPkWDFLnJQt8NXSkZeuoPjcx9A7lI6UP " ; <nl> + sout < < " WfwYZowJkoGDUq / / TSqzSK6XAvQBUHuviclx / 4 / C3BvCwu40wXDadUtt + 2xWJjNNvMlhnoPY3 / i0 " ; <nl> + sout < < " yKS / BSg4TsdTceqfkt0nU5FeTdyfpLW / 1TOAFERXkV2bTkEnoJ8g5LXHqj58hDZRnO45lxDXDYvX " ; <nl> + sout < < " / 3G7ja5OfBA + 8flE + MDTtRnWAxgUBDxlFEKD2T2RBgQlLcy0Xa23LgAD3qIWYH + o5UVAmVoI5HjL " ; <nl> + sout < < " mJ4FxQdvJOH7VwyIubukaioVoB63Ls1ySl1Ysk7EdgCpdiugM6I39QsFlYeHE3AlLeoHn4caWBFE " ; <nl> + sout < < " lWIhgKer7kBvPFG7M6bN5flAtzAbEXFAH4M35L / 6Cl + O2h + BvCJFiK1W / LZw2pkc + Ie0xC0YNWSn " ; <nl> + sout < < " 5nAPPxgGYtxCHLVl3R2XJvBcPpAHzbc05fAp2G4AKscWc75SZwfayKKYarX2U + zu3PVJIYbioSqD " ; <nl> + sout < < " B1b3Wq4vO7MDdD7AMZjJO1ZrX3 + 8piEVo1MeVbqZBy3VTbjsnkkErQfyOulxlQfdcblMj2Zn9NRg " ; <nl> + sout < < " EQwOnGEsWulIurqEe7bQEZldvTTz4pTOZ2W + uv8TqfnvtKgNESaqYvofF72ZFSJ4rMU + Z18Fqaep " ; <nl> + sout < < " 5MitEMIKwX3ttFQlgM4 / CWeaygkhyNMbFA2C / T3jIopsy3bPo7AwwhHxaZIo9ghkvt0nTP80dgtU " ; <nl> + sout < < " DhP2a2tg + fNUkvWFSfdP9 / NKyH5Fahlm9UPNozDehlI0dzeHvqSpdYFYuTYtf1jggNVeC3r / Zfq8 " ; <nl> + sout < < " + B7U2qq + e4iGW1KVkOlimC3tYTRfPj4ZILtHAUIwHh4HY7pTxxpErDLpxyEZJNkBUxgN0hPLm8UN " ; <nl> + sout < < " hTu3qFXzB149UpZCv / JmjmmEgLAWMT3PbBCebNVPEjfO6I59rTOvl + fVD3X2UJM1It4mh3NJPHzj " ; <nl> + sout < < " 4O7qLNm + S + A00bZx / g4ncCxrCvFkTpBmt21ZMAI / H4swFDlJ0gzKTq6 + nhI / nbiWsuRY8z + GNqcE " ; <nl> + sout < < " Snutk54hYXlQ3tVAxhRY4srAcEQMcHjX8pWrJUZjRiiYWnVfnmUf6U3rki8P25851GwTUGB6 / lL + " ; <nl> + sout < < " 6MWKQ + s1Sa71hc5icdJtxTJSWADg41KO8n1xQ0Pu0KJzvdNMM9G4AswY87XnASsaF9EXKDTSW4q / " ; <nl> + sout < < " s601Ghu8vEYKQVBNfJdiZ0wPsaLM2SvRwSS4Ji7agaJRLBvcv / cK0Hrxml20CNIGS2Q81xGS0Hdk " ; <nl> + sout < < " ykMptYe + 8pClFugfpJ + ETSqFgclYc0XoucOUxFh0vyg5CVE7WX6chpBmdhwWNnoyJz + WvNcoPIu9 " ; <nl> + sout < < " UZdYaseFLVhArb8cVaA9Mfk7tmFxaxNeXsIBFjiE4dcWKJbZXMnkhCaqG4k3SIHsswxjtj9hFoTB " ; <nl> + sout < < " BzmbIwFhxPg7sZVrG7Af26CYC01P2PGqNqJnZRZQt1LwtPVQHzvMk2v0r1I3DDD6ugGlva + PrHIP " ; <nl> + sout < < " D8FCY / mc0poDzTANlwAx28hkPTbtCpJIrWScZ / Vu / KYJo3F1Gk4C4CwcghgkwTYLhe2eMwlnA + Ww " ; <nl> + sout < < " vOlw5SD9jca7GrTA2tkTvsUnlskDgGlkAvEwc6N5DkS6clO1XRbh1mwhr4UwRhkR9Z8sQLLUv0yt " ; <nl> + sout < < " N / Wq4i6xuXuROdy78DSiSh9Gis5XQbqCvf1VKUOKkaA + / H0Y + XsrHrRCcqE5uaY0iIZtc62XgVHW " ; <nl> + sout < < " QyrlDHsh4Lt9qGD93Dx2EZQqyl8KoyhQ / WbgnG / s77zdSNGTkoJDEQKIrKLRk9ReptdqQzjLPJvf " ; <nl> + sout < < " GwN7wgO2N68B9XbX8hfXUmHX + G7kVnncugQzg0DS1qQ0Hbp4ibZHKEAUHtkoPEVgzGcsVowGYCqB " ; <nl> + sout < < " KCGaq6FqyyIYp + UO5j00xyftvh6uta3atuu + JHkWAPGKY7uooV3MGmdcnnF8umE1NDEBfrcWrrNi " ; <nl> + sout < < " IzQcnZe31Nxqo3WsknqYpRvCDwUZiU1f / EidxhykoQ1NCo1CY6ociQna6kpsM52E9ALvYlUyobN + " ; <nl> + sout < < " 7iJQcfagbJw6OpT + P54HFsedkIAlBgTIfZfag1u4lKZnibEZ5SEBfOGeI4pemf / ST + 4a + 2GalVHc " ; <nl> + sout < < " 4W5T3xhuJjQiIeE8X2 / nEwqEPQRHdTH109EW4BCv1rlh + XWqRXQVHPOYY3lVV4ONn7 / iWN0fslOG " ; <nl> + sout < < " z2 / MghTZb7Z1MhiWLxTcwpUXoyy / fexdBySIUf2ukM45ZPLr7T1aCrc + pW + XKfTewxqhWnKSjpVR " ; <nl> + sout < < " o4doFMv + eVk8mQPFjAP98MdIdYEgTakSQPoEdHijyq31ID0lI3qDPElGdFEq / yKpd9Tg0i2OaOvk " ; <nl> + sout < < " BiaBfldrXL + 7jlCSTB14Vo0RCiGIGuxqmEgQhUrT2iHV1baKVWUuKERauwS3jVNz + xq6PsAU9lWn " ; <nl> + sout < < " mC1WbmHOWyHpvoxE / X3X53njIVVIbRnGwEma / 1THUaFIZ + qb4UVfVqBXHCiCtyAnf7 + aH2 / T52Pd " ; <nl> + sout < < " gayp9h72ofbN / eBLbc0qXqECKcWLvwQlgiUkV5490CkjKnf49ubdFKRRH0PKCi0CR8T8lfhrHYnf " ; <nl> + sout < < " j29CDEgwX3LkIPw9GXt93ua7XgOilyqxhPm5vDXFpfgR98Y4iMUyheHms8U81xbRmM7SqAPXDJsO " ; <nl> + sout < < " vjoNtHmc20hgCb46BUQbMQMe / hhDjQNFMQ + HA83cvTyCqsXVdKcWIw3vPfD3RUqZ1R6LGgmLe + Xl " ; <nl> + sout < < " vS2S / uDJjBohq5pJ7xCSI2 + ylMf47qtS1pYd1bUXssnpJOu3kplTwqW5idkz8l01FlR + duXcn4we " ; <nl> + sout < < " Wop + 0ncMd5AsBpk2j868TAPVEJyC2lyQ9Qm6OouPEtMg4x0jyANl7JhyfEesTTvxIm3GNFe0fKTT " ; <nl> + sout < < " cFwOojUje215zqgOqwE0b7JkipU4ssQ6j1lSHuW8lWEVKa17Wr2B77lj21JxubQJ99iifjoarWGs " ; <nl> + sout < < " 5NX5nxCQKJGDEPagDVmL7TZaQj + Cp34MR9mCJtRTyLmA4g2rwARMsbq1btaKXUG91484ipcu2jot " ; <nl> + sout < < " / F3wLGdAhXQFWrxhIJS0ORxalPcSZ01zkECazBTIMokBrneVaX0RulGEMrs + CIGiSE6pFJKX18xs " ; <nl> + sout < < " 6dGqxF6TkPk3GalrQNn0al / 8FgetsD8zUX + d5PdqOpb7qNqEfHAClOcNxhv341nNrGnR7YuO + r8R " ; <nl> + sout < < " 67gAjqnan2NY02JmVhT7xqN1Uz9jCWqmbLNAPDUWPvVLvFtHAqqp556xhpVhJchWi81mIZJ3S2L2 " ; <nl> + sout < < " TKd + jGHjojiYNyjQxz3DD1S6ZN4mPgzK6JMC4txgvcQ9qoWhoqBDRDrj9s3lT5kkjZnHRPO0RE + s " ; <nl> + sout < < " W6m51Z6sKMT1 / yoneuJEnrwLxlD3Efd / cq8zmmUKREZgqR0q7WkXC1Tfs5sPVwHDlc45p2ejbze2 " ; <nl> + sout < < " iDEv4ULiYrNnj / wdOSwVnNt / 1DXvQ1FLtJ7K / Bt0qUszCNnNu6ZOwhOM2bqVugcOvONb6fLNOzY3 " ; <nl> + sout < < " WYA + 2RGS0nuHC / pFuzX / AQiRveFsq3IqtYxyexv8uxmlg4sPDb7Q8i3pT5fQDYAh6CIFX7mCITvy " ; <nl> + sout < < " 2JnjSfiVqGdITtvsHyJtUVO0YlQKUETRBzsUQ7bvQ9gTETskkHNPe3h / VR / Dpa6ukhyspf1G9XI5 " ; <nl> + sout < < " bobOkgu1 / 3ExBOTiCjbcxgGrgXw7VdmFURpq + FAQwuNxLDSoNfwFw6ISgP80lgBDV8 / 5l24p517f " ; <nl> + sout < < " fvNPTCus2I2A / / vLxMIQqU6cz + kIeViDq0fcTxoBiD7SoISwJiRTqciiJ005uVYFAisBpU06k0NJ " ; <nl> + sout < < " NQf1DfYz5JKAiP05ehMhQLCnJaHjbC3yILIfxXYu4wEV2lfLWWZ2u7 / 0oDBaZKNHv5JLzjQglqBr " ; <nl> + sout < < " o + 0GHf / hhu1EEqAyFRPWruxhJ1XzvbLt8sHc6wsxkQCYXPGfxlz5 + WMrSdNP6jPoEleH7xcL / b1r " ; <nl> + sout < < " mw5oP8fsoppeoxiK63Td0Ut6WtCI9grmCKOYJt9UfzTYI4TLDsI7mtofZPUvX8IeOOr8LySclV + m " ; <nl> + sout < < " AcwU6BJepTxRmINnck9tCe7m5unJI8nBy + uy6a9NvSILGvuoJ6bidAqS0dojvAV9m1smC / / ZJPLJ " ; <nl> + sout < < " 8UMVkhMUHEgx8n / Ss08rQXBFFqao1rCOvbUR1XC6g31GAju2dLm8Zyk9eomFmdOdtRTobmK4XbX4 " ; <nl> + sout < < " mNwCOlbKSZt1aBDN8JLYBR84cEBB4sjsPEXupIrJyKAe306c3RrnYj5lMxvnnknMqIfllkKr1BOm " ; <nl> + sout < < " kBYJ91aDe10mUd7zHQwW8KAjHI4pmDhLwusleQcl0RL2Q6CgOB3x6ZaYnXLtuWsOf958 + niS6dg1 " ; <nl> + sout < < " RA2Lv57ajSAOHzvuy7h / WV6uWhfsikjw6TEci8rQ6v5gY2DEMjrtSCbJeiJzcIqIC8bz4lvmEfiV " ; <nl> + sout < < " QpZPhGDgfS73qeZV7ljrfBcjvSuN9MPbMFQfkr5v9lTNJ + / AosXAjqM6aJ4TTrMq3XAYMcbuEaDt " ; <nl> + sout < < " 89cI2TabaBe8B7cniD + JBOu73fndg6YglAy0Cl41GFjU0u / xq0xHIim7e9TLVtTJE47CjTWRrBEX " ; <nl> + sout < < " ZAJLPDlnhevjsz + 0vEuLeqGnsX5yjbmtZzpkDvh + R6eZAJiBVq9uOLHbKqplwbjU31y2OO + Gf2Sg " ; <nl> + sout < < " C8nczxwSt6JT8ktG3CuGhuEIGi4l5LAjIjYd4LpQVcsUM / vP5cbzaC7 / XyLmSY92KfBD8OuUL6FJ " ; <nl> + sout < < " kMNyHHEtawNcKlUWsW6N7ybRpvZEwRXhQP + 5Q3QXHDbiQ9YJhvnnLWHFJx1TmMlhAQlyJBnuGD9q " ; <nl> + sout < < " Re5kqVi5ztXFHLY + yHAFHgCVbGq7WS3xxwQD + jeuLEnvbtNF5qUePj7u7psaPpYkQEj2DvRBoBGm " ; <nl> + sout < < " eEheol5Gc8NcW8wRw0hLr3Syw / 8b + 1uMl7c / Sxx08yvnB7e8JNQ4kQMkxVWFCWE + OXKul5nI5mBN " ; <nl> + sout < < " HRbSO5bBCuYU / 9P7DvvK2U / WmcnOvNuFFax6mmBc7E8nqao9wKmpypDvddWJ + aStllc1xZt875G + " ; <nl> + sout < < " xrYOX7Iv0MSfk41j + VwrawGyVYKLrssBQoft2lbeDqOsJBgxS1wFmxQXgFl5pW2ynnye7GuR9A + t " ; <nl> + sout < < " pbgKYqFhYg8v2ZIYJ / SDJey5H6TImYlPNriXZv / ocn888rvlfOBjDcG9KiJ / CJDLs6RdMMI67EOE " ; <nl> + sout < < " 5VBRISu61OMlhv / zp2bOsyvONztlHXERM + N6zViIlmbewanZ7ujo969A8Edx1YiD7eBR9AkB2VxW " ; <nl> + sout < < " nlnX2RzojsFbKIQjuE5NoFZdE49PsauvRhzYBid47XuPLu48IGlVWuX8dUENwWe8d3jUb3c8BPUv " ; <nl> + sout < < " 2E2TUEOcbEx / b + q5ex28LRk3CL2AolCUHMhw / aFKOj + P + AJMC2qAgzhEkVUWLfD5oHnN0gFzIr28 " ; <nl> + sout < < " EONuinHzkLIW / FcvxqVjNBn9O6svsz1RGQ7dOUStEjwpKDyYWboawNC12lNgh6 + JO5uA9jGqmSyF " ; <nl> + sout < < " uBacrq7GoETHISP5 / 7Mc6PkdsT3IQ7iy + suT5vTybsqlATrvJCR2 / 6S + M8kZCJdkIN3tVrbKqKHf " ; <nl> + sout < < " O5sHBb6MgPVWotsXQyZ5m5t5x2bquGfonmlEdOcjBpYJSEM9Gd + 8zvt36NgjRRr7Zgs8DU691FOE " ; <nl> + sout < < " eoOOYDfc5yzjHClH / b2k5po2saebjyh6Zf2 / EC5mQuqkHEeLtRbxSDSa0u5jbh80vEZ / / J / 3nhsr " ; <nl> + sout < < " lL7Am8nXsj6aqyEFVYnomyDo9Uk + KLWD11PqLqJiCNTnxZbsCwiqZDo6qo4JngJbvdbGZBQMpgzU " ; <nl> + sout < < " kj5cDYxSZLDARNLr + / M49l7esBKTtJUVtgJX2 + nejrlgeNAc2BwGQPecI9Zx9v7qHOhxSsCwSrGG " ; <nl> + sout < < " ZrHrTT3Pb08AKSzLQLmuijTWBRw9SmApDxTcUnSCI3RGTmqueOtpq8hGzD07OFhFU62SAdx8cW8w " ; <nl> + sout < < " oB / FAeZGOpIHY3hi47JXjZGTw3oGMtUkbq6RN6wQ5NJzij / HHjLzXyXKpd6CveDuxM24zzyvhEwY " ; <nl> + sout < < " Q3FNWhhgi8RcIFb5VutGDNZ4cd + jqf / veLh9Q1110CuDpR7MUUWm + MlG / / rMcScEZDOZORL / qMuw " ; <nl> + sout < < " + aKT4 + x2LXKb8G5uWwNovb3eZOJDTnb7Mvp4RfFql4X38BUjUgjZEAO5QXRPv + OfUi3PeeZBDQO9 " ; <nl> + sout < < " yjqeCNsecLNlu4cf222h7Et1rdp8zYPwMbdfLrI3pH69VxM5eSJ81OtprdbsO36svGkPOOB8 / rNq " ; <nl> + sout < < " Lu / xFCLKvWnHCPoGT5ng1vmcUl6Lkz3r + yD3 + Uy0X96 + + sXHnOVdiWxKyRhew + 3 / gSQuM6zoPumc " ; <nl> + sout < < " xzAkEjOiKghShOmqPKQzrsEUi + sZ3NnCBwRyUwlaFw7 / Fp1pi / N / 9bCX30AEfaD7ucsxJGtC78W1 " ; <nl> + sout < < " jWxi5K4qPpgaM + qU9VORlnJRFpYFBgu / nqvd8LkFrLkLsFDxkEO7bQDjEKX6xTltM7nbF / KVSasE " ; <nl> + sout < < " OXiMk4x9aOa8buelZrRiANp56cidcnJ8Ayv1GGAaA + hNYC + BNmTXZUal3NyMvxJOzFlKfaSUbgNB " ; <nl> + sout < < " EsYQusXQuVqkD6lW2Odx1Lt3hHzF0MYgMY3cuw5oeMKzarQoA97JDf74Lnp63MeuU + pjBanY5pNF " ; <nl> + sout < < " 9D3 / l1UIsrFh2ZyC0vS4i + 5SGDI0Fza9ZsopX14fbUOG5FFSkrHPL1ArMvIXAG7B3OPSRF9ChX1u " ; <nl> + sout < < " uPCaRK + 0JYxLdACdJB4x + Mhnv3fS8w5dDetUO2zy6swM2OonEXqln7lETWsBk5yQpXBo9sR8RamA " ; <nl> + sout < < " nt4HQhwaK0IAX4L6p2LMKJ27YUq2F3Xe2PWf9gMXdrUQPTvpq + MdEnDIJYf7sTkT + lyqLJJZap2y " ; <nl> + sout < < " jmuv5U6uQyaeJ2ayTd2TcvryYtrYg4dUEfTvjdlE1QdJPxUPCzjbkM / y9 / SrfPCXsWVlDZDtytup " ; <nl> + sout < < " tSK5GBlCH8JOpiiwgyBR5nAHNZ8SKP / e0K2Ps + mDx6xcSz4WL6loJUN5 + lPuMHYxXbT53LPOqwNX " ; <nl> + sout < < " nS + OCDPFclYZO / 0TxEerFNvxvjXLU9VxB87zLZRV24VAztABk3d5zrY48iSZ8WDUudPF0mf39geE " ; <nl> + sout < < " 4j9zhG2 / 3 + rc1yYFhAQFN0ch0G + Gu / mEEkSkxSZy / PK / v + ITne9JIqao8JfEVgwmQY2VCSyy4Rj / " ; <nl> + sout < < " KHb5SOY6CDIWIRMRj7GsqxI = " ; <nl> + <nl> + / / Put the data into the istream sin <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decode the base64 text into its compressed binary form <nl> + base64_coder . decode ( sin , sout ) ; <nl> + sin . clear ( ) ; <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decompress the data into its original form <nl> + compressor . decompress ( sin , sout ) ; <nl> + <nl> + / / Return the decoded and decompressed data <nl> + return sout . str ( ) ; <nl> + } <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + / / This function returns the contents of the file ' frame_000101 . bmp ' <nl> + static const std : : string get_decoded_string_frame_000101 ( ) <nl> + { <nl> + dlib : : base64 base64_coder ; <nl> + dlib : : compress_stream : : kernel_1ea compressor ; <nl> + std : : ostringstream sout ; <nl> + std : : istringstream sin ; <nl> + <nl> + / / The base64 encoded data from the file ' . . \ . . \ examples \ video_frames \ frame_000101 . bmp ' we want to decode and return . <nl> + sout < < " Qld + lmlZhXVX5NDRWIFG1T4 + OGdJbkmxAXXdHZEtpDf6knVTlRWyAhgv85Tf11KJZbhKv1dcsKtQ " ; <nl> + sout < < " fX3y / 9RxoGs2WfSxuQ88PN3jZemvW7PfY1s1vwY1Govp + hD6LGyg6qbJF5iSr2edUHLWGq / 00D7J " ; <nl> + sout < < " dhKHu / QsLpEM3w0yjnufc6hORX4GNjJ2a / k5xFnHf29G4ztGVp6OAlsQa4tcLsh3cOK / eyCjevG6 " ; <nl> + sout < < " 7GaMl / sfkK4TsjNfqdXM8sWxBCw / r6JTLrvlzVxDTmu6Sm2MpQ + IrRXFn4gK5vwPmc / mEp6etj4w " ; <nl> + sout < < " YeFI6w2jGVTFIg3R3ixaPUtvv + gaIOtPsF + 4StbI3AlmD1kDBt0t2xEyPOsmjOBuh + oy / si3xWt7 " ; <nl> + sout < < " RlCBakbDZnIihbzDMrLwTJvgoiQDgT3U4JRpH + 5cL8E / 3M5JAOuKWJU9nfdtNVIf1NuHCd1Ajsvt " ; <nl> + sout < < " LjRLI3 + rqQErHsKre5sId70rx + sYSqTWaiiGi0Nwg + JdCRuA1OwFmK4rahCAEjFr55py0iZxFuo / " ; <nl> + sout < < " r9DLOVGqKKIWDX2HQQrQ8N1gATa5Wh9ypd1RWKz0s1wghRS8nzIpFqtvXxJxYz39gjai7qUOP25M " ; <nl> + sout < < " zEL4RlnFsqP7GJaT7YnpV4PLkKAzYoq2SMTq4nlK2MGohKoPNj1JCfVcq3syGMJNYtNNOtN1m / E2 " ; <nl> + sout < < " 3AKUnpPX0CAEgA43Y5yMLR5ca4 + KGlvO / qWwex / bcU6uZSc6uEh2pcVaFvlnyUYdZlBg5huymL56 " ; <nl> + sout < < " HojkUQWiv48vxAoYtiEc2xsgsD / HeJxF7z + kWJ5nDeyxLhCLpDZfrc0g76TVEOVy68CtdGLuhDe0 " ; <nl> + sout < < " dhFhj + tlkmbNse + X7PlhhnI3Oq8kt8tFJly0YH9RXYd2eQDSK3Wz88jGhe9wcBEwcFir1foxdRa / " ; <nl> + sout < < " rj6qz9DeAo6bVEZkIEXPSXL9EmiyTxwqjHgIySK1il + csxW2Gpwb1hwlKQWr2x7bRf826W / DGplc " ; <nl> + sout < < " XNLAy0HLzQh + 8E1iJZhpCwYthe751RQLrYaBxlFNZtlHDKIfuGg6ByiFdr8y3T9dx1e4xJHHAEhE " ; <nl> + sout < < " Aem48B79Zp5xD / ZZOgAmJx / hrXJCnYXdH1 / 5FNhTyySNQKG2fChxHwALxDoOsB5BwFP77RkEuXkO " ; <nl> + sout < < " QWLOWFUtu8XYAvf2re0ZafPDonS / GoPZkMBWo4S6KNoczfDskSXQ4PqKAW2stt1K3BoxO5LXfQYG " ; <nl> + sout < < " qepdQBcZfL1Ir2WmA0L2HC3UmFr4bPwVkzaYCs4uQJqivpw1lD7CcNKi4BfBqWFTs0uWXQrwY1Yv " ; <nl> + sout < < " rmhEavMquYjJRdo2QnufXkSjrW8VpVEthiQK895ABfggCWg4F3yiqBlCR + aGcCetNoJZ9pS3sb3Z " ; <nl> + sout < < " 32tmtN4rrQ4jMb02QNnXPQ + vAavQaWok / dELaGYCG7PefjjcFqX48WNVmHQx + wLW4m0xo0mqXSxz " ; <nl> + sout < < " SQakpCGETfxuzyIlmYVRh41QcDdd / NH / CIwIMFVyga44Ewpcuew5mbz7bXP3k + FlxzXJ4e0ABVn9 " ; <nl> + sout < < " hO2sOG1V8teDymKMNPQOBuec5AenB + kchCtCDL8ZtglpBBqmijUCegyxiVpjnCzdGQvIq1XdfVmg " ; <nl> + sout < < " e / hWiXT1Vi0 + 1wtdL3CayA1h + zvUiIJspWD5QOHj8O6buKKWky + V2UZDPK24AuIl125ajH481E6H " ; <nl> + sout < < " sjS0 / FqKjHWfw / SayHcCdbqIt6 / 8AouwlkzGOK4C14HxAg1jmvGnRn + 46SCXNjlHBDH8 / mJ0Z1uw " ; <nl> + sout < < " C2Fv6G6t / IX1hcjJ8NBQOY / 3gXAtDRmkNUc3KImzaKNDUkS9N8U5QLFVqrBQ9Dw2kjJfc28QJcXy " ; <nl> + sout < < " OOItYP1RQmG942DKVwW + QQV / fvK8BFpRP5yuNgmzjGZI8gP5cqIOkW + D4eBFBb8PYsa15fOF9AWB " ; <nl> + sout < < " RXDztTbO3uXWcTpa5w / dSbawwBqfeOY5wh3lnYd16Q + Yorn9D0O9VGFWr2JqKwl / NcRtH5FFsNC4 " ; <nl> + sout < < " LpqcX12SoO3gsql2isJzJlyTmeSDB5C7o0mBE23CsBx9uqDwBJn + YAucIFxB6I4sxgF6EOilkA0B " ; <nl> + sout < < " 5CpLkspGnHs66pvrLeByoDMCpkt56bXRlcvFhjRo5nljY + GjBh6Ux3ZJnMdUG4Qded7oVaY65JVX " ; <nl> + sout < < " MpoHUUG / VSR8FWuHUP + SXh71QiEjsrAAVQ + Fm + fAH3xQ9Vjiv1ffRvxkb72G9O / LjF6NWWgowFcj " ; <nl> + sout < < " QBhuD / mTI2q + 6spFLWlZk9PmCWTBkQGsWouyZMuVQqr56sP0UEKANEGwpq + h3pq9t4 + eN8WcGhyd " ; <nl> + sout < < " kKgOgUvt8aY7Ib1HdckQt9cbtOrYyjxrQ7o7CXR8eg1SLPDJoWc05YevckkECeF4nQcZvoRxOlEV " ; <nl> + sout < < " rQwpnngQ9oNoREpNnGlZGtBr97bvWTw3UWwiEkqDJWTTbgoDSzjEroYV3RjVyVKu7BZRTvWDFz + / " ; <nl> + sout < < " xohrwbZ / NFA8wGZpgm0qtJRMCyDUIAJuQSEjxa925hWfdkVJxhExxXgWp7NQzhawF7 / 16Fa1tyMK " ; <nl> + sout < < " 62nnOYWV / OWcNOrRCt96RlQooSf0DbUqtLt0f6AzkjKobn3qpkaMxg4Fwzru + BaLmId2Cnsqdlvu " ; <nl> + sout < < " jCjsgpY9cfv7NdcnPvhLSPyykMPmBRe2XZycAzmQdpY04DpVI / A7gpkVyH3IvYP0ZC4SXNwt3Iht " ; <nl> + sout < < " CnmDh + VF9 + iVjlaG / JJ2cSXG1mDSfjPgQqEO2DtotkjN3cHmqqSkLqbmA2PMnbzCn5FJbdhES / C7 " ; <nl> + sout < < " uMRFLhsEyH7BF / UGHCyIkzbGQhF1q3PE1PP7A6UOtWr9tmKvctlDnsiEpGvxBN / 8wfDERqImT7Ex " ; <nl> + sout < < " f / 0fF7UbHD1 + lJc9VzXKeV2ZsFhFRp7r89yVcejSwiAcgHenFuvMEtZ3lgRqy7mFxwN7KNAh3O6Y " ; <nl> + sout < < " RqGFSz9w0gb2gmX / 1f7kVvoKTgibMHYXyHUSvusrjX9betzQ4NysjILBta51 / ZbeBIZPF8V7mhNE " ; <nl> + sout < < " 5c6iBo4j1i + jEzBGCbH4jGwNTRoD2S + uWFrDS2x3hYJL6uBoEWHN0oG5f7H3I82zkju7jkuUCM7V " ; <nl> + sout < < " bd02Suu / hjwDlr4YaQUTIo2aThnXT7ZgCaNhkWODTVU3BqX6M8WP3zFZrMWGtbuXrE6WdweK5ENk " ; <nl> + sout < < " + aV + 0CDcPHertb4LmJCOY3yXtPe15OsDHwedxxBJCt4y1UdamFtFo57XjHeAr5c17B / MWQ82 / ZlW " ; <nl> + sout < < " 1Rwrm + gNysxVGgfmzvmT0hpIiE / / g / HqI737ovjOo6yRfkjil8AqIlOT8Gw8mBbnME2OyjX / TPOw " ; <nl> + sout < < " wX4F52tAhs3oi9HmaKHW / / GlC7ILPqFN1Yg1azmvTgqVeYq3l76JbgZwNmPUEM5z / EfOcWu1GKT1 " ; <nl> + sout < < " Pc0Hz6WcPYYyANIlmv32CkBiZQwMi5AIhrUJvpGaD16hPW8f5lXO + oG3FSJlhZhiIQVKFX / 8UqZk " ; <nl> + sout < < " AzFhmyPjUHNHOsJo + 1c + 5FTnPsjHDzYwW5fUQRSz3L3 / rv6AY7g0BXKLmxCJYzIwxyQ5i7z810d0 " ; <nl> + sout < < " jTPy1DANcssoEqdA0P2u6udO3d0rtL1AY7dKoH5QYyKrOjx + HkLZcfxX2lpjp + kbq4uy89JYfo25 " ; <nl> + sout < < " M4tX0B45FKrUDDtIPKR9GRfb6VgsH2bi7aediwVXCoaTxPNgUyKaFWSf + y9gPBiD060TccAZfCqQ " ; <nl> + sout < < " HqI2fQUwEfsiv1XeTLGH8mNIHETMKP78LdWLhATM3ejl8aGcNxsRAbMXm9JgJmuHxaNViUdWmfPU " ; <nl> + sout < < " hJMksO1JBS66hcn0jBJhZEYF8qUwG855G65k8Vvo8tihDIbJhxGMDByP1beBLs6uoohknWTtDU0K " ; <nl> + sout < < " Q70nziEj + VDbaexOU + dF / b / ywH7Q + KUAFvHH / xObyc0 / maoRS / e0pfyhmB4OeGsbWAs9aGQNIaAn " ; <nl> + sout < < " Toh1zF + xQBFMKGurc3P4aPvh3Vo / cw2hQTMYJpUJQvhYx8XAnA + hRtnXZtHD2Jas88G0JXCCX5EG " ; <nl> + sout < < " 9te / j6MEP9Xwb / TjVLDGOc4IeMYqVftVFcmL9hrX6nk3TYDyUkvLjgn8vXEmJ7qB8CthBF7UUyjU " ; <nl> + sout < < " mcz3agjf1 / 6xrIotky + zbEAy45LvmZkcTfVVJt5nVyir5hvcGyXWUOpqp / 9NQr0ClEVhzfD2d1cd " ; <nl> + sout < < " xSSLaeTKsr0jTWFV9GDeIhprg4lJhxL / HbxFu3iOocrysDTTxsbLSTjO33ndrGiz08uW96K1QY2F " ; <nl> + sout < < " lqmK8FOhR8C1eaUdUFfIa / cINoThxQRkoYq3tUr313 + VzGTRO0I2SSJMIHgFBslLDHwX5AbkpJPs " ; <nl> + sout < < " 7jCQESWTp + LDoN6g2X + RmiLlPQiU7iJXxF7Y2SU09kmHOg7HFPKWZQ8bI + m6CG7kvBF9lWNuzfr0 " ; <nl> + sout < < " lWz08lEMExIEAAngM7G0LqqOuLJO + Dpk + lLWjO5OICoxQ / M7akvSJHtc2mVOhXNskHOYG7ZtEEEd " ; <nl> + sout < < " ceDN4bzzJ6qEuYMljZcKkh3NduZbETGnW7D7Ec / UqU6WNX01iMGt + 4lCWtu8NHySWGqIXcX + 8ITJ " ; <nl> + sout < < " euDFM4B86RSKk38VpVUXXLWd9GPUYa795WcoVxHlFRPULnHJK0G2 / AUuKe / K3CxHNqnxsk1aGdxS " ; <nl> + sout < < " NGVyQfhXJBWBA22f0Eclu / Z / UdzpKZjCZFFZWt / 4ppIWGyMvxheOSqjA55keu3QoFj + xhE0TUNlv " ; <nl> + sout < < " cYMT / b9kHJnHQ + j9X7ReicHMNdtWYmzybolMFV5P8fBwlReR6BS7nAk7hu37K4fpKoKujfMUfE76 " ; <nl> + sout < < " PYTfRoTxKKY0atJg87ZhID745jym89xIqFqex1vqb3Ysw0 + dZDWHbwiidUZjHza33U07hl66qo7M " ; <nl> + sout < < " iHWjOPzrMEhad9fsvLGQkA3WNjj4fjx5TLN0mfieIPgAjrQvZhCO9DspEWW + jwRP63BYUU3rB2sV " ; <nl> + sout < < " oEJfsyRSoam9ujGE2LF6ePYZhOOs41OHGsbUweduJ47XGdt8Z8 + wxnZ0ykwvxc4eVsNbNERVJ0pz " ; <nl> + sout < < " 5hULsfB5BCs0jc2cz6N + 1MLS397qKGNwnim8OBuU90wU0vMy + QWF78OnVb9jlg3asOK5riTvCWMb " ; <nl> + sout < < " qgj1qPo0GfWRojb6L2JaKiQlU7r5LiJSmmCQLdy7qnbtc2ul9kKn7iQZqxZVlHJklsrsOCdA3 / Lb " ; <nl> + sout < < " kzpWUbCp21oyQKgp8PRkMv4NhWt8JkushMklTjuvDhvqVTqrzFQE / UJoxWEBEjeZWRgTG9gYISJz " ; <nl> + sout < < " 9mnT + 89BXF + oSahu0YO8TKgNMqIDQ0d5GVrc / lakm / jQpZ3nl2tVbN5vLMtCuwbkeYRiFuaQKt8n " ; <nl> + sout < < " + 0HpFoECCJZdk6vyVFpIHNPSP7bfnsrZJHRiprvhz41LowOajR20mGW / + mlqo5K5eVxrW4I2Uumc " ; <nl> + sout < < " Xxp + DK5yhhIdYxY1SkRYi4CynSNUPLqoD3RaTFKfo + aGwd + N1abtMJpWmE / Xp5k3NNHXWi95ltoF " ; <nl> + sout < < " tU4BxGQWWDjG3UB9t6eUDoV / WXwCy5pxs4rbXLb2O9CM2HaBC + lDaW9RjxpOjI1jvAXmcQrs / MeT " ; <nl> + sout < < " ex8n5RxFcyRzjbaWhd / V4vZ5 + qY6eLoT / cUpYVOp0w3lQEBaGz0W8bcetjroDYGSV1U + 3nBgcKPb " ; <nl> + sout < < " rW1wp9l + x / ihlfM4yHdApD1WUTYfdIgnO6YAw3tlm0UxARb3WxyVjIQ7JMr1Xgle4UbFSWrjI8pD " ; <nl> + sout < < " U3arZPJzf7oN1eFDdS / V4fZ7I / B + j580QOmGI5LGvSBVR3Ic2iVSbZuk2mjWgK / YW4vg3kp7LjZe " ; <nl> + sout < < " yIxulHxWGysi / / Oe7bqcJsM8Jndw3sId9UYV9r9GaBGBf + E2YWibCRJCiDjzO4PizCVOnTGJlOMI " ; <nl> + sout < < " Y7BvFi0d0eLHGAfIm + 3d1bUqD1XcPblx0IYVa5AHY90JfMS7gBJHmJiY9Gv9 + WtQmLZmNkU6Tcy6 " ; <nl> + sout < < " yNyIMaIfI3UO03ApmhM9babcNpX8xhxYotZXzuxf19nnSdyOebzl40qU4BPzwwQmQMISK35A80xS " ; <nl> + sout < < " dvnVDMbcRQIC4fjwo / OKNWtk2oLY9ERJ6ixMMxG532tF12jN4ZbWn1X1HGFNXvSU2bFhuOLMSgDC " ; <nl> + sout < < " 1poVi4Cjjgd4n49BJmlkeBoL88z83sPikchLnW1kxHubG / 0VBwyHYBmocPrK46PL1rx1 + dSwc + Da " ; <nl> + sout < < " 3E + edMWBVe / ca2Z2lBDFIvo29fjwwumf5Ljg / M2YybU9jZC4vLR9VcdPJ9J / gi53iNOktmDcBcp8 " ; <nl> + sout < < " ThCOSXuaDyKBtQ6nvd3AUGdNdLADPuNXTRNybM + Lqc4k7cApgM6DZV3Elpz38473d3HDAW4pCOD3 " ; <nl> + sout < < " K / y2pYyog + / 27OSOW9SGoVkOuqOBKwqrFAuD1jIbI / yDq / LYajcJIPqhkUv3srTxHkPiOBbFy4pI " ; <nl> + sout < < " 6NAftTHf4GGy8VTGIzeD + z7L1qJToCogS + FoBG8ixRGUYKvUYEQyc1EhXdoPOYY6pZiMsA4xSGyN " ; <nl> + sout < < " aU9RrfweZH3ld9QU9Y2kjSqVOhQavzIPtD2wQBIDWxk3 / bmH1m76qrcEfY9WKCb7Sl / / 1oILVf / N " ; <nl> + sout < < " b0 / TZEqVSAFOMoTzTXO1ClXymBTA9b1bJKlQL / 8DRayUN0NUMllrwHT1PGOmpoJ + AyhUOjEmWREv " ; <nl> + sout < < " mKkaxiRkpyLdgKyphJhtYGid41FAAKacNN4CMl9W + fZnydgR0SDvYvpOwveSXr66xfDZlQti8ZR5 " ; <nl> + sout < < " i8Il6sq3 + 2ybJj / oakohjWPxMAA2rEvsOYkuUbviTAYQOM3jMXAVPIkgAYgwwXhvTpHjeRurdxho " ; <nl> + sout < < " 5dz5zGTwSRsxCUn6QSTtt4DhroBs4xBCmYa8BFsUAzG9nG + SP + ejIgc6HsrLCxZ9Orlgn5nkX26K " ; <nl> + sout < < " bI2dWHqUL8DIgM9OjrXeWath283tUxYQlnQ8XJ2 / IsmRkbq7eNJfBATvOmvk6CTJJdGrK3iX / xaI " ; <nl> + sout < < " WTJ8J4qY19ehkQoD8fLA0W9FitmfQyLGzxFSI4b3YOcl5KQUvSDjPpG053Ok4LhcQCILRhoHk5jl " ; <nl> + sout < < " usMw7nWyw97HV8XHrQkjsGyvkT0G0LyeNV5iYo6o8yFtF / s44 / mfI3sh + b5AzhdYOEyRcnPSlr7y " ; <nl> + sout < < " axPlZnAfZRfqccQnEricrTtaPvYaJIh / dbtnlM5crcub0tJ5WNWAlLdS6IShjiIivEzqakfqg1GD " ; <nl> + sout < < " w4TzFl4VeqaTR7JWeGT + yyRwTfqkIEFWp4 / 7DyRSXF1hbiUifVaBwy4mpar2tHuSL / eknEI2Hd9A " ; <nl> + sout < < " oIFg0F1y0Jg4uAewz1MvmFsfoHpVAT8ejEF5OdFjkeUL8fjSBlX2SwMNaV07UlWkDDGckuHch6r0 " ; <nl> + sout < < " FIDtx71pldsL2ALaQgKk + 85QC8YqJdzgtfK / lRT0MDYOh4NlCZoFqQAImSYqasRtsyeNYWVi7Hh5 " ; <nl> + sout < < " HUcaH4dpUrWFu8HFXN20rzWwkplYAGTeG1 / S6T / sBXzAcv78VXwd8ec3 + Soa / ZZNXY + yWuHziyrP " ; <nl> + sout < < " K7FFd / fcYHML + 2bB + E2Trm4MVpzv7n0a + Kuh9sy0SVe0IuVJMo68R2Ftl7tGgF + dTKVKmEHLHqcR " ; <nl> + sout < < " fSjxUAto2wxtM3Lormd / 1Yz3loH8CL83JrK1f699TQTZee6voQPJvlvKJlctr3NeWB0uwk3TIACf " ; <nl> + sout < < " 198pytEpHGhlLByCzpwV68aPjs9EV5yekrCJzEp0arZSIzfI / cgwYAZ35Ukff / bp6jxg6AB6yUL8 " ; <nl> + sout < < " Muq0rqGDqwpfTfTDaeBJAhwevEMyapDwrbzwHhnJLi7ZT5l67Q6Xjo / A8 / U60t9m2Sdm5ULwzBdo " ; <nl> + sout < < " KdSBd9S1UUueBxrx109Yh1gjvbk6k6d8L / Tuqjue77ZCUV5mOJ / rmuTi6OEDIKdzZuBgooisaIg + " ; <nl> + sout < < " CargeAu0U / JS54e + b + Emr / 56cogvgeJo2QeIKT5yhqHxtoEvHjhA + 7q8MGuosAeQtp / 9yYt5kPiM " ; <nl> + sout < < " j0d5GjKTviHQqgISzuskcAWAhjIfXSyVrFhiL2tZ9hqS0u3juXdBoUy3nXcx9WF1tLkyxONcILs9 " ; <nl> + sout < < " + dOGRg + VpsTcjRqQyJoKm6OzVoN5J8iWKFkdZGLm0IM + p7F + jRasFIgJd4iPjHMsxYBlFX / aNcxT " ; <nl> + sout < < " dt1W97L7uw42LMYVG + w3wnHdkO / ddrsp8DemUQzsT7yGDOhg5LMBqK + Lh1tcizQrb73NDpqjGmeh " ; <nl> + sout < < " wmSb9GCzxDxw9uxfaZBBbO7M4KXJiANLFF86djhSpYgmApyhO1QcTSl2UR4XptqikYbPGFFQzKIC " ; <nl> + sout < < " qjvmsXWnECWWSZK6pnNnHWZOMto8VUmPx64HIPe1hW7KeRM4ra7J5Imw6F5APG4 + Jg8IUf / sH86g " ; <nl> + sout < < " v3F35nnPnYeVvkQuYP3iLNapQqaKR + pQizKxXj / wgPagwSRrzlSDbKM7KqwbvdBGVMGfeW4PTpuP " ; <nl> + sout < < " FxtmMKzWMWAGUtPSBHktXyt2yn / Gp7HVfirM1FYaIOsWvNPtBfsQ7HGA3dvKbP9f6ZvRSonW / + kU " ; <nl> + sout < < " S + jp / UP + sIfihswVxrP8TO0YqQCwz6 + X3nCT1pW7sAJKggb + DZyEisyl0jwK8fVttFraIdhqO2Ko " ; <nl> + sout < < " o2Mfc8 + V5jVTIC / VPtuiK0Wjv0 + Eov2U1UgvFM0jsGIPfVZV5UDra0rWjp / vnzo5C9MBy / MxfCyZ " ; <nl> + sout < < " 5tC8AnEXpI6V5JSHSb8xRAHWZg4HUMmoZG9u4mX + fW9Lc1OET8xVMzfN68kndi25 / bnfx6SpR6f1 " ; <nl> + sout < < " 30Nhy8rd93qy7DpYUHhLLyhBgujuJiT4scogc2iDNwP / Fsam9RR / EeVjKv8gwDHrDSbbUbRbzfUD " ; <nl> + sout < < " fM7oph68ce4 / sQ0rCh1WbtPrSQWbNU225oOYZr1lgrfxlYnI6ROd1M8nWS623ofggs4Wfh5CMYXJ " ; <nl> + sout < < " OYe0XlSNliVnU1CX4MXuX8dIXaEmU2HUjfKWif6YAQY9eSLikPWVgEYvpthn6dur / TP1jC + W3a / Q " ; <nl> + sout < < " vigZwfynqIl / NC8Pe7tpm2qe / K6TcOgru5ojdaPeyLUsVx / wqvvVlT8ZOgVV2vKOXAUQ8bLXAH6N " ; <nl> + sout < < " kccB9Aw6NLtXi63VjdwUrgfBwT3orFckTuYA4u60vxs6e2ocbkJa8YsPyN71Q13O7t5q7aYP3O4H " ; <nl> + sout < < " JbDKncX6fZddc26LFxgRQem44nxcab0yoiP6H3cp8mHB86 + vkBuSQHWGSWN5uNK03BP0rlUntMT8 " ; <nl> + sout < < " zis2iDvOY2gDKYHPj57HszSQ8 / SZx7MFKiFRTIKMK5P39lNz0ylKhskAfZ4KDzLp6xzwjwxDsy70 " ; <nl> + sout < < " LQatqB5ojtaMcglatNYvdU48iHz7T / KPIU7fs / vySYdx4EHZ + Oei / dKFvpdK + y9lFyRJUoBXpb / L " ; <nl> + sout < < " LCs202cmGv01lonaN1Qe0QEL8OTPqvPwGb / rqsf6CNobSZd7mmiMwlQ4dARKyk3PWgYvalT7nm7w " ; <nl> + sout < < " aZvPlDUnws05FXtATiepdeNlffsCK + G / TEzH4vxOzbFsNwhwqL2tVf0t + 1UJwD + NQaF4p0mSoA8B " ; <nl> + sout < < " TZCslymygnhgF9Tu0jHPigJ99Nj36RhdYkndHiry2OlwpTACuBv2CFv9F8SDhfwuRw4sr3xQpomb " ; <nl> + sout < < " vpTNyGrXXmSVrsTnGP506nCBg4IQOi5zXA6MgVNXiy62mh6u0lceyZXfbvCKkGJi6wUj05DdrCvY " ; <nl> + sout < < " 3TrTH7DxcwTZ01O1e2A + 6A4v7u5 / GyN2vEQb / p + lSZ9XAWYLywIId2pFMJ6nDuD4HKuoVljrA4 + A " ; <nl> + sout < < " wrwACO6QAn0H15I4nIBRzxgEhL + / U9Cmhmudtl5iKeZCifsTrIda80CJ9rTl / w6knmll4 / 9rLceK " ; <nl> + sout < < " QmMKBXjd4sdpcDh8YNAUa4lWNsgL7ElkbTzmZlPe9ScYHAfcJGEtwrOuYDp5LfJOh76nM / LbGAkF " ; <nl> + sout < < " qR596 / Sqf23C + pfe4JH2lerREvbvkx + N9b6lRHEEU6tN5qx4AVPUlVDi2 / 1qo4wcIFJEKYS4bfKc " ; <nl> + sout < < " jZdriM9msBQPzO1GDoVTfUxcY7vVtkVSjVONgpjlM4Bsr8YdqtRH7xAEuMFG5y97X5PK6KkIAqAc " ; <nl> + sout < < " fXc8BSroGGBcXmIx5dAh / U6oQAu8gOe8mSvy84 / dz2sFbioZSlVWR8asbFLDjrfHHpo4d4EX3t1D " ; <nl> + sout < < " XsGHOG0QPuj5 / lH2QZerKkfyMZiD7rSJTnpf8oUyY + gw / e0aZMHk510G4ybRKgY + 9tCGnu / A3cJc " ; <nl> + sout < < " 5wi4HcD1PUKmZwKZI2PIfoIv / VUYQSZt7U26rf0wUZEMcuUldIxiU583HZ58fUGjmNhi5uWdDeIF " ; <nl> + sout < < " pgIvY8tvmwUNT3W7H3iw + idsfn1w1CjWmWiCRo + yjAB + TiOxHD4JCCNAcM5PCWDa / NXLBA2tO1h9 " ; <nl> + sout < < " Tk8h96lBlAtu4IQVJaB6 + o7iPk2GNq6FAiFQwYC2F / Oh5A3wKWrd2kqQ8JeZtNdk4L2 + eHg3aDAU " ; <nl> + sout < < " 4aXaYzfxDSOYHVHLgDj4VY6ulSZx9DBst5UPsHbaLaANf98uIZuji2hXOcg / FEnchb7A5bb + UIyV " ; <nl> + sout < < " jJH9d2D4R80e5GwPF / vVZK2GQr7h / pEgdGTh6hr8piMsR5fzJpEI9dS2jTJnet4FtnhDo90fImU7 " ; <nl> + sout < < " O07J4AT + uO6k0B + lKuc5QlmaXg5Hm3hCqq5CggvnHNKWHV4f1ux0GNn19RiXwX18EdkxSEDIX1W9 " ; <nl> + sout < < " CmdCn7gQtqznt3pNq3apLeITu3phYapWi3FlHhxoxOE8gKjF204FYOBeKztMqCqSlYa3ALQiac1W " ; <nl> + sout < < " bk5HyFaFvWEG5Rb2gs7bHSgHuDFlJwErbiDfHM8415fDkbWAOMJFTDh3YY / tuNz4vU4bNC7TcJHn " ; <nl> + sout < < " o5gak21470Iy5oZ9WHOgQm07tsFNxyJg / 98rl1fQ0lcjNF + 2nrhj8O3bXRpgt0eh9AQeu6QVTC9A " ; <nl> + sout < < " d7DzZeQ7N3HCWJl + VbwFCW8Jyo5umAkO5qFn + c15SO7QZ0KEjEORTiUnBDXzAtQjDHURr4yEjtiS " ; <nl> + sout < < " LkLTQsXwiwCmBOnoTdEPegCHIEeVSIye1t0x + dR2DeqK3WA / hB8mFawdIlhtmdEOZXov1mutXVDB " ; <nl> + sout < < " LBN80uBR / EypdQyctL5IR7IZIS8p1vG9kY2yceXlszfRZ / t1H3jx3sRSJEdVoMOP6Es4IpKj5uw4 " ; <nl> + sout < < " agZ / POEGbn9qKdL1N2MM0R3y6D6YjIXhQF6QO3XsYlzU / OeOWxoemfC3 / qn4yxwbaYyEWjICn / 9d " ; <nl> + sout < < " e + z3q8F3Kh2JC5VsuIVaKZ7MqXxvtn9SBuUQ2vsx / VqH / LyRi9glQZom7H7XYefzQ6neF1DobC / p " ; <nl> + sout < < " HsFSf3Q8QV215kXq7lm0FUxQHcA2p4F037be3CN4V8aa4NqL / ChPqdR / EMtB4C72nOJClAGY0BsL " ; <nl> + sout < < " 4ApuEZj / SfshLKcnMdTcJTsqBDrm2ykdu8JEg5PQT3vpG72eUbAm3Mbm3CYImISFQiZ07XYDnN6J " ; <nl> + sout < < " DUOjaiwfjJ4ydnkaAQbDnChIS6JXZV1LEMS19DCB0TLoRl6jnX3mNu4S + fugfFHqXYxgKIAen83P " ; <nl> + sout < < " YdaCotX2Q4qj7YjNhknIksW1OPA + 8VxgBhrO / xBocrJY + uEi4 + iVFJE / 8Ge8sXmYr4AcY8q6 / CuF " ; <nl> + sout < < " jYWYkmj8UZp69kE9QGJdiwmHBFOLIgAdnKMXuRS2NFZgFcoGMWMxeasH12WFGRmtuoS + eBi7RzUn " ; <nl> + sout < < " CC7RpHf + + XNJClYpMSPnEYafiDQOcMmjHcaBYkEBB6kRV6dPtwrb0ZQPGVFYnhhcOtcM8tkLD0k6 " ; <nl> + sout < < " Ek1 + UYaG75go18OFlshMOzU3Rq7SuuNwtSNQ6drsWWcGYEOWtQG1b6DniQ4 + e9hkP1sHI9GE3jMV " ; <nl> + sout < < " tbuSi8Q7pRY + vzyHyNIOH5FmnWCFPYLMkHt + 6aenSR4bh9b8Bx7khop + XymNuNOZg / hu863yOx7P " ; <nl> + sout < < " D / OCXH8BflcACMxVMFKcPMxYZHrxC4cINAO2wY7ooge06LSlM / 3gNNwfizSn5miDw + 3d4UsnnD6G " ; <nl> + sout < < " + oMA9AJTuPcy0tMqBsGqmBZMAIO3yHWroF9G0dS2TVJqMn8Yt5shS7TKoVn2ognWInejfbOSP8nl " ; <nl> + sout < < " wliaBSd4XCMRoacNMgoPilfwQsqwntNn1jsNRVG3YwQwJnSWXo0YUvbCeijqzP0pX7IezmCY8qgI " ; <nl> + sout < < " VG7spKv3J900W4CCvbAlNsfHnNAnjU / 5MWjs7I2j + WhuFv + b + + 3vDsedHI5nUWjTUYYy7N8O48LX " ; <nl> + sout < < " XH042vXLucXjT4inm + IWDpj + br + GmppCY / bZzqO / IwzMt8pWiReyU9NNtawN8ag6FYA9fxrqGwCf " ; <nl> + sout < < " j98DdzKzgBgo28R8Y2Al0oC52pFovY0Ym / ormPTSwtehSaq3lTFgbCKBhYR9QPfx3vMbYZupWWCD " ; <nl> + sout < < " FjnZYkKtJltasN + SKs7Wp / cCU + U + 6zPAqHmv + ZSWiNhC4lPgYDGSdyhPhp / sHz9rW582bdo0iUT0 " ; <nl> + sout < < " 8QRPz1UGheorTDK0K + V0sR6ltaIS4 / 5P7 / QzmVvGnnilWTFmqdBViBZRFv + 3wp5xMqMjtZthbZtI " ; <nl> + sout < < " 3YmEvxUwnPvJCu3 + veeErSbvB9AKDj0PJGmqLx8Cw + SbQgN874XSSq + w4WVXCT + GOUrspzZR1LNi " ; <nl> + sout < < " 59SSCEs6AKkKmXmjk7sdl6FocyINLIGBUSPc + nwCgESD4xSaR1cx2SjSf0CynPF / YprCxvqRvQEZ " ; <nl> + sout < < " dcKWvwgeU6oJP / 0tz55yIZjiIi47ucY4ySXSel5iPoofoh4Gg21tguOQovIAbzqYrkN44bmBy + 2S " ; <nl> + sout < < " Bpxa7JRdQr + QXwMMEbsnjrXbdHL7J5fZa / 80FkwOHY8Fvz1wCRoZ5y0EyAZCq1s5H4Vd4yHMaZmW " ; <nl> + sout < < " ZNJzXvADrDSO7NxyTDGo4pVX4Dxh / v854SiHkO12eDvoizsraCz2ENtE6cbpHIdRq0Tt / K1HEH1E " ; <nl> + sout < < " V9l7eNcD6XJrvSe + 6yBEJKD7srWbyC3MPSzfl7cFEZPbVzfkjSP8H7AnZl9mFnEv8AbuLvHJTVzq " ; <nl> + sout < < " LdwmDV35e4jFpDbf61 + kzeO0F9ABrphKOY2YP01f0sKoIicMWOcXyBVIMCtB / 9Bav / Pn6bH0pyn9 " ; <nl> + sout < < " fyVa22J4yLzvKdYKluBaKUYVVUS5GnvTT1Qxdtlv0AWceJApOg4sHx9zZmoUMDlQQqH54S9sikKk " ; <nl> + sout < < " NnW4TD + CbdPYFH7kgXAkoFveAOIKcZZhTUD3FLbarLFqwcU37NSuqM841MlPW4Koa5Jrc5ySoL2U " ; <nl> + sout < < " FU / Xu07j / PvrpxdVHbok0aRtPgNm44 + vPDAWmuG8zuxqluSW2xxzPi / YVo7nsWPvJoDKjZA1aRMr " ; <nl> + sout < < " LehSLFoQa66fCq39 / XXbQp83pL9b3tFGRndFnP8FxvMcCaYkG / SDevUg + cG1ysNbBSBJ1plCJe4S " ; <nl> + sout < < " loGs / jQUQCNIX2 / mR9L9PHM7FS + KfQn0tHgjipj5DRGiFInscy8cXn / 44uYSHLvZUTvdcg3 + I9hi " ; <nl> + sout < < " qdV0luQoUCZm9ooT / SBeEo4VzB6 + L + fsuOlYCQloHNtmJ3KrHtRtbk3caJcrbTcoQETMbSGN5awK " ; <nl> + sout < < " XueIC5Ar7zL30I4 / DTjrhho + / 6Kf4nRhplqPpt + 0lyLOSk9KjeNxWktMwnnplhggnxLqb9laXNAM " ; <nl> + sout < < " juhmMFkTHN21kH6F3TDmBE6rl8iMHHn1 + kSKhhYjDeb + n35qu3kYYEg651ow0NVdq + aPC4YYCvt8 " ; <nl> + sout < < " 44xqYd6LxPeXF66jNdNl + oOBdds5MLOyW8uIFdQbmh514Q41qZ3TEMieqT08Rp7qW4 / mqiPjRzp8 " ; <nl> + sout < < " DZgOaUXJnQnUKkVbqqaiBv + ot + ArYe5JB + e7nvzgyf2zxCZLk9 / Szpqn + JbGGEHFixV99XjJQRTU " ; <nl> + sout < < " q5DcOkzNjd2 / Da4VEXCfjQPWgYlYu1u4hSgasO4GVpGFnyuj76gnzPGbkSVq5GMJ4KzYtl7 / sta6 " ; <nl> + sout < < " sijpcScgVlvvL6ff7fhEVnwQfa4mCZn9 / umsDB5ZbG + VJufprMVSb5CMYcMyOU2KYDyvWHE6jSP3 " ; <nl> + sout < < " Za1W9Fjo1Fkzx99 + pV5Hex / GeiEOxyYCPjNEvCNpn9xJWjU8fx6 / 6BbN2mGET9hO18lol0OFeBio " ; <nl> + sout < < " 88h5F6msca4plFbxu7eLv1Mx4kyQNmvupkPaufis95NgiPhNwOUSPsGffK8WGIaJJx7 + g / SkgN1h " ; <nl> + sout < < " RqaZGgxZdrnY9nOOB4TsqNd1dG4p8ybarjysGHg0JQEFRcxj22DlC2PoAMEEILAjYb3cIX0xxy18 " ; <nl> + sout < < " D6TPca + XaHi6LoYixk1zz + S8FdUGweRHS43IaWzBa9KDJ5vEIxAAXpyJ5Uv5PRcBhAfdjqjeT8DN " ; <nl> + sout < < " bVN0R0D5QQA = " ; <nl> + <nl> + / / Put the data into the istream sin <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decode the base64 text into its compressed binary form <nl> + base64_coder . decode ( sin , sout ) ; <nl> + sin . clear ( ) ; <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decompress the data into its original form <nl> + compressor . decompress ( sin , sout ) ; <nl> + <nl> + / / Return the decoded and decompressed data <nl> + return sout . str ( ) ; <nl> + } <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + / / This function returns the contents of the file ' frame_000102 . bmp ' <nl> + static const std : : string get_decoded_string_frame_000102 ( ) <nl> + { <nl> + dlib : : base64 base64_coder ; <nl> + dlib : : compress_stream : : kernel_1ea compressor ; <nl> + std : : ostringstream sout ; <nl> + std : : istringstream sin ; <nl> + <nl> + / / The base64 encoded data from the file ' . . \ . . \ examples \ video_frames \ frame_000102 . bmp ' we want to decode and return . <nl> + sout < < " Qld + lmlZhXVX5NDRWIFG1T4 + OGdJbkmxAXXdHZEtpDf6knVTlRWyAhgv85Tf11KJZbhKv1dcsKtQ " ; <nl> + sout < < " fX3y / 9RxoGwtXxwFXCxbBrLRaklamboDoK5N06vzzd + CS5m2gEc6 / c0nITY0hfeRURvJI6cvb8OM " ; <nl> + sout < < " W3UbsFYtU1ntq1umGkQDDu2ukl7sV9LfHj5eh + n3zjy7VIX / RAghwQA44rcpnh2d9icwDh3G2dCo " ; <nl> + sout < < " KxHo3W4qqxVLis7IIGg0dzwguoB8ZGmlvOg7hdMz20beAel / LlU8TMghQk2Aj + 4NTKQRVwcfXfdd " ; <nl> + sout < < " AyOhcT9wYaLabnDZgL + 7yq8Ji3VHvlGqgVD14WJj87s83dgMGikK03QgTzhyY4dwADT1aQ + xqeec " ; <nl> + sout < < " K5d37u4xE + btNpcqFhHx1YCp1r6 + O9kjWRE08rfb1qWZB4qyCwTkxc1C5buXaeNRrw6pHHqSLWd0 " ; <nl> + sout < < " 9IFAbB0ukrEWmdHr8lVKAfBzL + fTFrAO8gjgT / vf15asPfqSIl + zJyHK + YJ1p0F / UwIzPkKl5nx2 " ; <nl> + sout < < " O3u06yBtIHKdflKGjRSXomDYGjrjeoLNjqF / / 7zBBXyNXXv9TsWwekzsX7A + qRdm / j / C0lCHU + sL " ; <nl> + sout < < " g6wWh7L0kL4ARqClFQfanO + 87 / EPhnu9LuovQzTY8PhLB7a0R2fhAncpTEPCHBm / 0bTEL5F7V + W3 " ; <nl> + sout < < " 8yzUfcgi1NOCAUBN1tVwWBDsVv / NUIl1x + FTKd1BFAsN7a0LLZO3IGnCikPyU / Tn + TCslyvvnU7C " ; <nl> + sout < < " SxgTwVZIeDC4sq0l7kk3Jc3UWrDI77EQHjxNFKG + lnJxMLXrNMy / lJ621WGz8uVPvpkcTajH / YdN " ; <nl> + sout < < " eaRRgbdqnkqmoSyX7cJeaZG4NE0n + isv3j7WU3cM6N8WKhYCH0ReG7XjbdBgrPHaUdFD1dV20eC1 " ; <nl> + sout < < " 2PSv5D2jEJkDUVNdMZSmwOtF / UDg4WRMY80YLGSKhxqLqoszhKWXltFdm1M2 + WPtSFOdr4i3wZRs " ; <nl> + sout < < " W1At1 + bmMTFCM18KnBg0mQv6zyjKRjzBPHLiQZQVBmv3al6bQnyLsbpNDM79oVd4cdEv + l6Cze9Q " ; <nl> + sout < < " gPwotlVgN8hi9gcF3lH + KTQ3Nmd7WK3 + 125inZjFasNLUVJZNLshz0DVnKWeaO4RGLx / Nb2ceMwG " ; <nl> + sout < < " YknvrhsARhzLZe8ZFcdvQs8JnlXwuNpN9OKtBNQMpQHf6ytCWCV / ZCsrFCT + GnKMQxCvR4 / LNIFU " ; <nl> + sout < < " vWKvSIe1iIDoOhUCgJknwUH1M1Ug / VLDpOxT4ylapmV + YoKSYnJANOQ3 + 3FhqHRc2KG8vGMTNzab " ; <nl> + sout < < " 3rs5TEQVOdP + fEtU8oynfcb / 0WK1BAKgmDRhKcz8XG28EX15aWyr6uJkAxqYE8UXHOr + kn27TuWA " ; <nl> + sout < < " 49KqCFNsNcjhvnjWQEBvwTwGRKofE4ASdnQi / fF6Ozk321H0GJYpXETW69XJiNzT0f6lDUYWR + Bd " ; <nl> + sout < < " HC1sW256R9dn / MBAcSH2FRUf0Mv7z0yhkb4aUwHNvGhHPX5g0Bhy6x1TCOqHtjubkHkxcq6YpwW0 " ; <nl> + sout < < " f + 9DXG2M / sK + IPqqgy4tY / fcJeYxq3Vd4 + voDPYfVxcWpmy / 4X5kzf + fFwtXEu2MBdYKQEKviV0Y " ; <nl> + sout < < " WixgGguhWig6d2vAbUKgAlJd9yixtBum62nEK1vMZmwzfokP80fimNdw7Wony6EA + v1oB + zHQojG " ; <nl> + sout < < " 1fNaBTacRa + NsW58U848DFrsJ94S / 9ss / RUx8GuaWwKP6WImvkhyHP + YdbtkykVPVzm3s798VWAX " ; <nl> + sout < < " nvjz9R2NlupUdBVgJg03BAH4DoJdYWOxnLtUChjW + + StA7OGgWoay7DDs / 6AJYycFh + TFW8D / HhA " ; <nl> + sout < < " sEQCUAYDnpze0aSX6CBZ7vHMr4z9Gr6V1zE4dbJ27Yv7ZFBetDLTN3MN1vk8SYDFeFHtzyMBfqor " ; <nl> + sout < < " hHXu4rKtGW2j084a3BQvlDVZ5bQX8mh6QBENJ + C3kBUhE4QthRIUwGsuarKCnOUAAL2Zt64CgGKi " ; <nl> + sout < < " gRF4wZ3V3Tt / FZ725pUJe2Td65CddbBd2mRqEzdN + qqn24au9ucznuEr7E2j0T3ey1RWEcU7Xsx9 " ; <nl> + sout < < " dEX6LoyFqowIEvyGOwdTlycOq4v53Z2cJTaitjGSvtaL1h1ASDW11jvsX0OHueMJJyLFwKOjj5JL " ; <nl> + sout < < " JrtfkGvWRrycw3UdT6g2n8IPKk8j96hds + UlDvgwIzmlromWvPfwixA9mt8MRqJlBIo94lKjOvuw " ; <nl> + sout < < " sS5FUcr31Dqmaz7uQcrwmxh35jAvW3EbMObKNdbaojaZl3u2Szt4LA0yFs7UJpkkJgEO9E7lGte3 " ; <nl> + sout < < " WAUC09lpDNq1CLvEfOEsWQqzXayT9AU86CCnFgi6iErKoA3uNToSaqQVOxOi8RWzQWuNfmkluBMF " ; <nl> + sout < < " 6NmgipWLj1nlLLBUOpQD6nVlwYqZEeiaQOhHRYUiSUFbJ1EVdBPoRi9CPOquM1WX5H9qbUOBchB1 " ; <nl> + sout < < " / oI2wsh86ZqOld75VfD5QsHXmrFsQ74mO4MyvAojodFWADFmRloe6UoEBFYhjXSlj2sUSTyAMfPh " ; <nl> + sout < < " jgRrJwdMb0 / 53hm / Emqz9AhG9FpTI5P6doDAm19dGp09NvQyYoZnCCWHC6fPpl + BS9WANNfsSZnl " ; <nl> + sout < < " dtI / JmBbtlx51QDTA + Dc / RqGZZFzIIDnBoIUnyFY6FBb / S03rQadSUdeuBInghBu3bw1UH0AImFZ " ; <nl> + sout < < " uy0gKklA51AkE3xVxtyGaCniGugrWwcGYl + FeiisBNKtZtbo3spTO / Rr2Fjg / mbJ1I0dCDf2gJt5 " ; <nl> + sout < < " qkjF7zRl35 + gl58FjkBxMdzM64289w8wqjKO6P1JBnJV2gsbU6QYGN / w3Xy9BC6Yq7WaHU2eUves " ; <nl> + sout < < " tyuWAxa2 + pl8SzrrvubhGUV0Rx4wVcRCLilUKHQ9VoCEJeou1y15h / hl8BkmuU65Do4a5txsH + Xt " ; <nl> + sout < < " 5zVkkmGnvrvq8xMd15UIz867U7lt + BwgV8UoDz5ZQnQXvwt4 + NLK8dLaRfr3Tb7KpLPOdymoOW1H " ; <nl> + sout < < " 7ZnfmR75beprkaMn29qygGhlTmVTxNC7CppNNfS97Yc3ki + g14rkFZMmIpETfUnM1eqp9O1 + y5Lt " ; <nl> + sout < < " 1p1DrkrZduSwZtg4DmJt / 2g0eV5xO7LPishn8ezxLTcMLCQYZDM4gjhiWt26U0XEQClxxouxQKiV " ; <nl> + sout < < " jpcwn99nBEj5r7tkQLfJ4clQW8gOuBidgJ3gWiAlR / Pwkys4L7cdQybo8WegBvXRJyNi0mDGsM4k " ; <nl> + sout < < " cD8A38 + zxN / mI7Z1Gv7y5zWUMrILQJvPVXCCWXo6gikdJpkLrprcp0RUXo0b1iUgGgOXVvY6PGA9 " ; <nl> + sout < < " HrM5 / u0t40 + Yh7 + 3XqzLWWU9kuOgDLvjwYeuRu7oniMmTWOuRtkWyqKmTXlrwjBz + yqIQJyiAa0h " ; <nl> + sout < < " NF + n6CNX4Bk1X2h7DIbZf / hCbYAsEQ / zHAudSiEfzew7T8r / h4YG2huCTjV6NrBNOzxk2Bu2A2kd " ; <nl> + sout < < " PbIOFbLWphpDX3pQtfSvx46IL0uX4O03VgTiz2NCvNKaH6oZZ8mTxkV7QmVnRdHG2my + oFsqtkv0 " ; <nl> + sout < < " uRF3h9xXKDij2r3lfNRhHrM3OAsySepTuXa0hN2bU0DIiX + BlxVjBKicOLIQUI2k9ws3akGMpicU " ; <nl> + sout < < " vO / fKIwOs7D5L2oUOqDcycceYM3DCTjyjdeP9hq9 + w3nxnuvtoNuFnE67nR0FA / XSYLjZOxq5EYD " ; <nl> + sout < < " N4LdNhDWzYFjEHXgmyvc6IrCcltsisuRN1GNZmXDTd + + / 8CdA9ThbqH / AZvMeUt3zZeKMmb4Ad3o " ; <nl> + sout < < " T9in73sligZv9ed32 / 6rc3w96aoiGtHgv5szIJ + h49hCNfuVoSR6GB89zKr3cHcsQ1PyI9 + S7ON / " ; <nl> + sout < < " / lTAQtwIUSGSQxM7xmawtKVSit1zv / gw307SfoWAZMmz3TzrMzKbe3mmNNwW91a6GLqe1iyaQ9Lf " ; <nl> + sout < < " KdIVsCHzqq3DKgex8X0XPnP699SlqSR9gjHWZvuVOzZkA5WE8oatWQNS / W / bhBaaAiT5 / 781O1s2 " ; <nl> + sout < < " 9y + RfF / lQh6tQbhPthbY / ALQDR07LM43qqvdaiinxT1gYh3pJJHs6oEQEAZwNvbjUZURmwbJ + hE7 " ; <nl> + sout < < " fJnWbYtftZn7pxlJXzXueWe7IPmYuzrn6jJEh4xbnANe2gpzkGPi2mHIlJ8ij9vp5KwkaZ + SkmEB " ; <nl> + sout < < " El1hUdhsJoXXErzKm76RD0oLriVUGd2yvI / pM5Mm / 3 / pykt8cARjatq2CVc2YE8P2M0cC3ItKD0Z " ; <nl> + sout < < " YqnMdxmJpxys5JoN7q9yemZFpiV2OMJ24kPc8BGJtgbVQBWpMUnNEOZOI0P17D3QRehHWf543 / X5 " ; <nl> + sout < < " PqzfHj9J1tUcJMNCpp3GFxejtpOvKD8J7JB7 + 0QzqCCOE8SQIC3Bs6IB3IeZiYj70f3XU1UPF028 " ; <nl> + sout < < " Kbkis0YuvkL79pWPoqNAoA7YVVGhnb7ed4p2 / lqFw1NHG0 + H4YQO1gz8U6MeiUrjcxA / IkwNFAZX " ; <nl> + sout < < " 5WsC2QSadmv7OtUT6L9ifTCs0sogqcC5UETke + cLIfprQ / c4qIMP6JWMqRasR4 + 0qjxZbSxovEme " ; <nl> + sout < < " 0oIBoRGE2za5L0 / Ulwcx4URU5 / iUu9u7IPEcUVQzABaMIN4wMA4Lbd2evs1Xjo6xcFLK / DBtOUdM " ; <nl> + sout < < " JTmiOUwloSGDd8MSx25d3BM1HdXfUc5uYihDFkk / 0AUSLa3x0GbKimowJYGAkr6Px / 5MsCnFW + Ix " ; <nl> + sout < < " anv9LFErILEMTwCvETg2LuRDSC / 2uyGNnndivYpOu8QGplJbW9n4ALWpvS / dc6PJKjZo6GhqqK / X " ; <nl> + sout < < " U8Q39jn5hSYIGb / LXS0mMJZ7CPTO1AcNCAZb2r7Fc3orKeMoBDA + 9R2x + ZQnlGWV8PdAzfpnfsIa " ; <nl> + sout < < " O + JL5Nh2NimtPQsqEVykbF1RF3caiYPCcEj + SAUFSDZ2pe + YfXPOpe2EOZ / BnGTQWdn8u87mw68G " ; <nl> + sout < < " Y2zcXQAjUHXuu8iF3IXR0bbRR4bDKp1MJ3YW3nlk2E37v0SEkyX7EpXg8hvNB0uReBLOk8pxw4Ha " ; <nl> + sout < < " 8R6ekjMAfMnOQynT0gi3tOoy6 / CNXBQFAp7 / u + Owz + DO + pRX9StkBjFUWe6 + 8ZeG9YJLnNJZUGkY " ; <nl> + sout < < " Ki0EEoWpBbW4zvGa0pOPJ / OceaYIzhL2 / 1DohO4dO9jJkOU6UxpYaHMOqxr56K7MCpJF6k3ii / q5 " ; <nl> + sout < < " yLDM1Ee3peTb6MfWrrkeYc9PhEtD6TdlJwQpHkivrFvBvp5tz4Tg2zoW4O27SZZn9Hr0MPAKCT9E " ; <nl> + sout < < " Vouc / LBstfyV8cwXm + nqNGg + f9ZLgns7No8isMXQTPso65SeRw1K48aIwSqeZ / LZ3fQZ + n8l0M0B " ; <nl> + sout < < " BSRAF11nGpSNKY / G + 7vKuJ + FVV1z1MXmc9wp4tjnYRMEBsmhTnL9fFpoHvDlOAgI7ZN + YTKFOP8R " ; <nl> + sout < < " RzeXkz6ne3 / ztgWIS6QZ1xFzl3rEPwvcADeMAT5C / j9COs8YXQUafQ4o2I42PM8PloMpz73nTNqR " ; <nl> + sout < < " yot / tF65hOa7X6sYFISZxTXvAq1qaV4j / bOyv7Rr4IMQkvPhZRnKuOKd1lEtEleREDKdNA + 3Un3u " ; <nl> + sout < < " 3czlYhhMp358CRLKGyMNsLc0oVmrc3Zf7AljUJg3j / WmyZdSWCfCFAUzh4y + OF0r0LSxy566EC0f " ; <nl> + sout < < " EvoeoqDl6Dn20my8VVm7Ek7kqtjGX8OPXh + OYw7q7GDHCLn + gSQKRPZEMAVwFPfY5J0qUdn2EhBi " ; <nl> + sout < < " bIdpDLJlX5A9Tuvsfk6 / TgWJWrd1ljnk5LRU1JdLpy9Gr3i7RuUzHVmxutyDezdNhJQ2a / dGJoyL " ; <nl> + sout < < " wqtRLh + sAldKv7SyftQMUr3mVgcuViK24HOW55optbEe8LiDnZVyjx0fWPnvUF3jrOu9iKpCzEQb " ; <nl> + sout < < " UcV / ItitPx76PWI / HUsXW9nPkyHBkVhy5n4A5OFbK4O7r1eiQBRttalZs9UPIX / zGjhL + mKsmDPZ " ; <nl> + sout < < " 5W1ejsVxJT54FOwFmCD6yxgeWyGirMHJ8iIwL12Vf2WG3NvnLTIMokCOIrJIGl2nsgpYWFh66aLF " ; <nl> + sout < < " BY52VplzlZ7uvieN8T1gFkoD1GKDTPvxJdbUIyCQG09lZhFsqWDT1h + sZMk2cE4UGFa9SUZY8cC3 " ; <nl> + sout < < " n8nDCxxmmQybJp70Ig8cQPy9US51O + PL8ZjyRJirlSwqhSXndjyvgm4xk9uOSk7AooavjRJYlO7r " ; <nl> + sout < < " Mm + U11XEN5mZJL10W3nMa3Ls99DQIrifOcWVAaY0pEjmeBWHizxOwwqt3X9CY + Sa / X35awGgaQCe " ; <nl> + sout < < " CaaIXBkxwkRLD8 / Of5fYQ8Dwg + LWZnkMjs1IBdauSjdWvT7B9CXK7O + YJC5kjduIGOAu8qfJqG6o " ; <nl> + sout < < " HP / uOEvCq4vT6Fg / gLbOjNenVhZSq6bAVSgG3C8 / WonUeNQiWnEI0xLm + WOU1L6bcqBNHNBOOiOB " ; <nl> + sout < < " yn1YojmgQszuBRj2yC4rCAkddymD / yzJ99g8QmhpzlakTRtpjf9LTErhIBDIQSd19U8mNdu1u + cT " ; <nl> + sout < < " PeIl7vlVmhhnojOHfLGRvD5Zy5dC9XZiXRRcNWHj9vOTdrmtwy0mPIZZMPSBLJnur3djgCLfMniS " ; <nl> + sout < < " Q8iBSo8Uzf00zSZBUBUmTekAAHFvf + we0 / ERcXVkJ2ikfZ0v3sxGf4zIVGAiI0Nx6PZTWgW1xH9a " ; <nl> + sout < < " 3OYLo3mzzz7TVy / Yueh2awJyZ6CWq / ysu9x3tSJG8DbBBc + 4segNq + IKeu52mYTcLmASIR9PT12z " ; <nl> + sout < < " ifAJWWtKNPR4T / FK1pDTkaVkULRPzqHP8jxerpBRMnt6FStshZiZOs + DZVrXJxSP64ZxFthgqMd2 " ; <nl> + sout < < " UvzcqeI8yD8ndIyd69Os5t9OoeWseLPWq95 + 5OUX5v13wiS + EHbJBNnZLLt4K8udeohSNUXEBDND " ; <nl> + sout < < " tj7TDkzLyXYpcm3KYkJgtRY88kwidchhjvMQRDNw15ozLnR01t7UsNLVLuBij9sUBDA81i4YXyrr " ; <nl> + sout < < " 5se81KvEZG5kLLkFCUnPKRU / 3aRb40F3zvY9pcBU6KeJsjBQzKRX / EqFise10qyClgAyvADqyW8P " ; <nl> + sout < < " jMDslvAq1mY3kJJU74AQNRuFP0iBJWTX5B3BinqVoE + VJzZPbziFVs0riZccQIoff2DiHS49f06c " ; <nl> + sout < < " NvWgHb04xNXz1skoINdhFVRSsjik + qmxbFE90F + h9eshTMxwQVobiRLdLv1pGkVOpsRxl0eDsPMI " ; <nl> + sout < < " NECgDvYSyRtSxXz + SUGk4dokSgkrTPa6NDx82FYiyITDu7wcgtQBOTj + SXRWrrG + KB1MR5cRHWP6 " ; <nl> + sout < < " nmELArZ2JquWF90mbylFHbzKZNB27 / TLN3X4 / 0cVqLNxyzow44 + Z8f26lOFFnh9qfzqS874839gB " ; <nl> + sout < < " IRvAiKnuSo7KCh9BbsvAHk8a23Ei / KNxJFH745cvLab2oVcPuFdwsDvuYgPNT22tuLb + / QN7djB + " ; <nl> + sout < < " 6a84 / 73zWFCnfeMlPgtGbxUE9yns4nYTNx + jLDUpKAmYBWeiPEiGhsvJYwy / dKvXF + CVdUHFbzJO " ; <nl> + sout < < " r6rnCYGBY4Urxy + S6KPldLloAnA2SgsqfiU3B59g18OuY2NyPQ2fj5 / Ytpum62hQo3SlZTVGXFq7 " ; <nl> + sout < < " pInYYEueHtHIyJA7xpqX7TG8HrdRJRbz0Obs5X0P1vbpELhaaI0vppEIcfzZrmrqQfOT9fUILia4 " ; <nl> + sout < < " DOCR6e6TWVirmzFa8hilcMLjG89m / + h34mO + pwqNsURvWoJ7oixSe9arMPUl2pKyA / wICP8AjQak " ; <nl> + sout < < " XXaacTp0DMIbcOsf1NY14cuKUgl7tcst714GMXCHfPCnYMUzoawg4o6LVOzHwHRgys0aWz4aNmQq " ; <nl> + sout < < " 5UJDqc1UWVweo8LD1 + + 5BCSMO2pNJaKdbHqVhT9yJP5NxIkV1UxvH1TowNN4SI7q7BMH2fxRBB5e " ; <nl> + sout < < " bu2XU2s / 5Vl7snSkKk0PxmbiiwWGiN1Dx9YIUCEZGJcomUh7phIlPaoT44MEDMT96z7neW110We6 " ; <nl> + sout < < " / FUCAtq2aeF887UH / ARplwM / elwZyI2BIDGAWF5udKyRtCrVznJdXgtlNND4a8MM2OQicC3D85Z4 " ; <nl> + sout < < " suz + m7cwYIW1o0xBcuM2ASLhhAdATCHoyD7A8fIm3dD0vMKM7vA8QQi8ETjiN7GzRqoyHOLt1 + 4U " ; <nl> + sout < < " wM / BQdskv + ufGD3KADK5CrKPyKzaosnPyGYyzclqSBbt / / QUdYBQO4AP2A3hqh / QySkGID1r4fUC " ; <nl> + sout < < " cM + fXd4DhwvNjAZHRPfGPD2xPguPOmmuCxkHU1CpcKdBSbxR2q4FTdaQ + 1HBbU6KZ6358kqT + 5by " ; <nl> + sout < < " 3LP0eS7VemMfP0d9rshtgbK / + nG30EGTtSIJe74inTJ63k3mkHb7jRu0rn + vmO2aO60HQM4SUiK5 " ; <nl> + sout < < " eKZUz9LGB6lD49IqbEwj55SpSUmLsITyO9HdZ2hhAAxRTQeMz2xatUny / fFOGSUiBSeYvyrmnWjs " ; <nl> + sout < < " R93uXWixgiS7DC15ARLHAkvkhT76lGJkxfdyhdkneQlImBYUecqxHmGRAEOQEUFB7o7ARObjdaFr " ; <nl> + sout < < " Cii / / 3Mj + 6 / YSOAaYlS1YInt2Wo2 + gin8 + eeqpBp88j4NIH7qyKiGw / fco3w0Yi / x / 2tbc + OR79D " ; <nl> + sout < < " HylA5tAU38lKI9ZuW3 / 8nYGw1mXE133YDK8ZVzGsU5JnTnCuIW1 + aVLf5pzzldfg3z49X2S11QnW " ; <nl> + sout < < " SNtd3gZ6cY2sWHnQ0gm / EIQCF8696kwZlp / J7fZonWd5Fr3P57QepBjktJs2ReoUXGQGAYABNJAK " ; <nl> + sout < < " VdbPpCSu / kWlizZFudp + 2MxUJnGMg72fGFn2AYhlW47Luuu3 / DNQiHhmrxaqXbnpqk + jn52j2rQT " ; <nl> + sout < < " BRiIujM4aCQk8bXqFCvgD2pcFpKMKtwgkKeLlLMhqX4H4kKZ2h2KpJPSHsTg4EW6p0p1boVMoD8H " ; <nl> + sout < < " ZFZWTuDKtJOorF / hCTAC7paeeY6EqeEs1S + 5ujoI2XjTNcai4TMAOe / pAdgpVIRIybPZP8kWAc44 " ; <nl> + sout < < " P56yfuv2RYxcqAvmpEjvPqhaP0lG + bOUzxAelJy0hu0xe14CdvwWZseSDq + mDaFrrM2fEqGp0eBw " ; <nl> + sout < < " ysDRYDp0HJaY + QM7mS1chGIw3iTOg5IfI + wgz4BqRz6ILSX1Ci93QzzMsr + t8AqDssxzDX9kMNsW " ; <nl> + sout < < " oSoRYt29qfxPr7wjBdWURj2KxpW5yCygTMfAh53XuqjyEmuiSu30o3fCOzdQFOppq / LUul6A / Xbj " ; <nl> + sout < < " anZBHBWlmaIpPtvtdvjcWrflDrwdsJVZENu3qKyEmY + wpE2MMqXUtctJRBr1eauRU / Kcn + 3JfSji " ; <nl> + sout < < " PtgwJ2W6ztTzjqr + 6 + TRCqJ7xnzIZ2Cj9jxjcD5VCEcqAVg1 / rlP50cHMlBrW + UIySQQRG1FtX7k " ; <nl> + sout < < " 8zqh30BJhM6Qff6NrvLkpzAl6qKkgcSe3tsbmovCf5EmB0irBvKg15LiCDxI0HyYT + KfKv5NBgjB " ; <nl> + sout < < " NQDDNZzqulGPMIqzBGaZc29SfIHaMxYihQS5mONL345HTVNQg7MkcHIYalGwbpIbq3GKv5MumOVj " ; <nl> + sout < < " SP1kZ2BGFt2U1A0ytDfQLhHan2a7v4 + 7T5JgUkRrvP8hKHRm0JTMFqFxZpzGOEQ9dwl6atFoNdQw " ; <nl> + sout < < " f + 5ZTWFfzYzWxfvZT0j18yQ4fo8VQzCqlOc5kLYatapswTogEQ1PGd3UH9gTs4SfMjmvrfre / kBL " ; <nl> + sout < < " nTISbSjaS3Z7N81jEQkExFHqRfxiMIK + h5VRZ / FwviueAATnsIY6vChZYueN9Y8m92Ou81EHj6Je " ; <nl> + sout < < " o4mKrrtkUETSWP7IkTd4wD / EC7hMWvA7c9cWpY7Q0nAcruSrfcUgks3mW / / cNgLmMo0UE4 + 0W8LM " ; <nl> + sout < < " H5Ib3drj / Ha1OAZK3NRhtUN2TRgJEaLWrvJ3fo / xDyIdmm / Ap0jf6jXGlXtdWl7KaMElGsmdnFyb " ; <nl> + sout < < " xgIsGgh9k6hyZ2uTFcTzeRFcsAVOBkQWOBhyqtqh2asmPFjOro / sNvstEVD4 + SrHSPG8rlqK3nr6 " ; <nl> + sout < < " SzNq0Is07At + PS14wWqp9ZseQSLr / pWwK7a / CyyAwxnbdJqhhsnxmODTz7nIWFgQittN2Z5l0RhP " ; <nl> + sout < < " C06ZoojtRQVQPyjCr8C0BnFGyKapnGPGWVbuzlu6xMhqC9C4T + 4zjsl / hVT5BaBKvGgjvxUJ9pWi " ; <nl> + sout < < " fs120RVW4ra / T6X1oAXvYrjp + 2i8QVcOPAC / jfE3zT1UpsTrt4IKYR1ILwbWsOi9ORJUqpQgQKpb " ; <nl> + sout < < " ZrMseH1LAmp1RzFN7M3Xo + wWx1fu9S0W3ZYizaVrkbWrGJyv99zuiCeIY8Ns7oqUfQAfBbJM2TPb " ; <nl> + sout < < " 6jmkCyD1U5a1tir6vGc3YDkBryvw1oXRdeQEuKPSF3YVsp7bHf03ALIn5glbDJwh + 8FvJVX0rkPa " ; <nl> + sout < < " yK4n0dU6mBDfyCt8yZ7 / uFqPHVr9Y3d7Ec6RJPEouC3MOlKhYzow / lkVnCVteEaGqhGh42TsKnHt " ; <nl> + sout < < " I4MUSgA6n2QVTcFfD / hsQdtjzWoFupA0v3PsXobN27vz / aEGrtHjaPXKNDLfbRyW0OQN1Rfj / nRG " ; <nl> + sout < < " + TbEr9Y17f87ar0qnd0aLd / hgEJ65lW41HWWj3bjRP / RL / X5HpKVzj5zOPBfnOH04vCT2XtjAK2o " ; <nl> + sout < < " J9gFPdwz + 6hWrKXGuQlrIJS + 7RpVwZG4woY4cgBv95rFjfWwLrLuuX7PYeCJNLFZKpoAz3WpzRYQ " ; <nl> + sout < < " PepcF0 / AzD6U / dLKAaI3pr / g3kItwzrhGIOz8ZLN4IrVYrSQ + kw + R9NuRWq6Wxg84hoRBWN3hfxt " ; <nl> + sout < < " A / 58J + s / + DnmBilHfrYMhysYMVe0TaN0fM / Am5VIQW + lQJOVY8nVFqxxxt3BTNDAQtVl1BwaRQw1 " ; <nl> + sout < < " 7PVWmpFsBKX / cIkJRfuUo47InS4SvzV6JEgNSJb4Jp7BHtNHQpwKDkCjfwcajIrde2nIEXCZ7CPX " ; <nl> + sout < < " 6TmNL3i / ys3IU0zW7v3uDZja60mepUlqvb3mJsiPNu0OkX26rIO + K / E9roqWnwp4HdzTCgv4Lmuz " ; <nl> + sout < < " 5jaVBx3ZVxdjB0Eb3Kkt96pZflyLdI6WSR5RVCfpl8ov / QOKAjZoihm3 / YZJJvytsUsj + Wi9CS3G " ; <nl> + sout < < " If3aps72fkcCfzlzB / 2H7HS2Xmfor9P + hBdfEjBiz0oMlkXo0 + JuamAk7ueQ5RO7YpnI61Q190x4 " ; <nl> + sout < < " vgeGRm588X3qNb5IXuhumYUZJ1ATmHc9mMkNSNWEGdFy13DJmhHl + fOrADwMAy2 + J8g0L2yHloaO " ; <nl> + sout < < " rSycaN7DgGe0YJD8IUbgS8QMOz8Kq1 / Dy2 / Uinix2smPobySnP + uQjRJ6ilbHnZCAa5t9KB1fNRs " ; <nl> + sout < < " HExRV0YMN0tZ / njB / hUsI + N / sg3lvPtSOOpXb8wAQQIcj5v7rCaCBbiGdfjWcgUbHfLDgFLTxq2q " ; <nl> + sout < < " LND3J3HmONGoE7kwPwNRBMD06KUY9PYwSqjQ7spkdBOYtuBVqCbnnaT6hnh / DsSTqG6DkymArX6G " ; <nl> + sout < < " Y4SesPr5KhQtUvkrHHQAAmQDWALzA7w0fKLi2unHSsRmteT1ctL4lGwVdEb / YFmNzxiD7BM3Zqvq " ; <nl> + sout < < " JtEDUScoB94K8R2BBOy / CQqEcln + DCoukLW8BdLAJ6b3mDaw8tLIevYutQwrQln0pc6HwXKmVTeb " ; <nl> + sout < < " AKKBMmZaAAClk5amuEkyI5YPen9gSZDX45yRohZcef7NSVOmI1ma3mc0rFYJYkJkC7T9bcpcHqAb " ; <nl> + sout < < " WONeENewbaLz1onBbrVYBdqPeBWjrGt4kOi + YSXtjm6WdZRtLf0cy2uRq1gvzg5oNIDGer12uAAA " ; <nl> + sout < < " AIqr189l1IrG / 3MtrYrKK / Km9wuukr7dJe5Qf / 96FXuft + BUsbt8WYQKOxeMZJgWfoZVUzKwkzEN " ; <nl> + sout < < " / + uWsF3fYne2EclBulQem6566qaX95eQMQv + mzrBVL7 + PG6lweDQ6r6ZETzX5ogxLqyeqLSue8qJ " ; <nl> + sout < < " xmVPMI9fr4rDFcRrt5XgwH2j / QB8ymhsIsqPVnZKbq9 + jrPUoRJDs1X6VCycaMS9bG36PFJwxW9y " ; <nl> + sout < < " Be + LAmVi2N4wlBCmNwXclqK1URJRvocKWAKrt0Kn4dILU1Y7hXNPjcUx / 0oG5Ffoh0f12glRsyva " ; <nl> + sout < < " FJjtV7ePY1hClgBK9v7owd1YZUz9e10XcWOzS6L8HOpX9pocEiBdfO / oTDYBPd6LNk / E5V032Usw " ; <nl> + sout < < " XdqReOtJL / zOBPW1vJ5xc1UMRyGxDeqUQFxCKLkFAQj46cG89dM3bhj + Dh4U5J5MPhQltLLhIVbZ " ; <nl> + sout < < " qHvKkLr8cCYqSS5h / SOF9HWJKjNfXOgpRbR2l3 / m8t71h6sSi5XR5o0NCi5V3 / VCgAs / CfXCYH / O " ; <nl> + sout < < " WEDkfZKw1IgO15FUghj5y1vzejXv1logti / MHvh3WqMlQ5i6B6SgaGmIbOdqNHdYUbQnNg41m + 8u " ; <nl> + sout < < " k5VPCiPWtGkbzzuzaYSx / Na14VdvAbZXDztFPbN3l1fMrAolDKlexOXohzVZhYOsqyu0xdGka67Q " ; <nl> + sout < < " i / Bz6DbYM / U4rF1lWoX1Xh9eslMlBlJjaAPdicvaJF7YArjzLKOHB9p + EZ5tfrotIKGfdGIbt / Yt " ; <nl> + sout < < " MSsyTx9PBINYD1u / JeI4SqXTwvWcfF8 + ZmnspgnEabm8NKufPXhaJODzrxL7filfb0 / JbL6qmf / b " ; <nl> + sout < < " 5ksG2XT2sPxBM3TjQE3DAtnS / Y3psQUGsXUuY8oGNF / PgRWd8e + Ek9IoAnMLuvW7S4D4MP / wmWTX " ; <nl> + sout < < " kZzlpZBnBBvlh7H5yDHGYCwGUofjCiOk + 4hU1LUNU4LGgZYUsfjNW + zbj81 / JSoK8AMlmB / ERH + S " ; <nl> + sout < < " yuBnOIDJNY7BG1n0q / YoDIU / YuM09fyzW4tAHNqfbxaYif2QldKZWbxUEiiOWaItpW4QTsQe0MaC " ; <nl> + sout < < " h6ppkigA6 / 7DUgUy3PKon + JB / jdrUdW / 2Q1qgLqV22zBLHJoq76n4QYZFmpLN7FkLFtabiXZigdm " ; <nl> + sout < < " 7y4GEh33CQIlETdes59sn / 0qIUj36ICMh1T / ujQOe8hlG1EIruBdZk9CtprIsVYdpuiftqJHRLmz " ; <nl> + sout < < " 271Lti8HdM / KSVqrupdYb1GO00XOGVU4 / kujCa / nzhCukpCpESV65sKSuIaW + VQlvYFATzX74WWL " ; <nl> + sout < < " bKfIvaa0TLR8pMz30JVDT7f + I568gRLEMsBdtMnLyJ8bgkPGdngpnz4G9FBOqkDeZdb / Ji0aKN8v " ; <nl> + sout < < " gwRZxrwUrjBE4EjfcRQy886hvReIP6GvKax4bwVcGfmYGdNuliSsCsPC6pLXSH3fnmYBHD8DbGct " ; <nl> + sout < < " Q7dlu1Z / aFTO / uY3yup3clLe89WTrPTK / N1lsUDULj / gPNwbWY5l3ay7YRoTFt49EjYPmx6wz3kc " ; <nl> + sout < < " YXYzOroiVWGspN9WfmHL4XN6pXWhiCOrMRG2Z43vbdUnqNk1992xy1q / ZHTw2ikxIwKy77wygWfx " ; <nl> + sout < < " 28l1Iqj1k8Km2Ci8sBy / QCLnql6olazxv2fxn6vj + 4QNrOcJb3sDuLbEm6BkUHIoiFzZEpc5nIpw " ; <nl> + sout < < " 5YBSARDuvqMt + 01 + ed7yBUTms08EFh6EwPIsJ5R / 6YE / Qt1aP / hfB7nGWlpGb + yqycdZbUw5XyZm " ; <nl> + sout < < " pOEHQHvW1j30bk27jCRHzktRYXRXQ3BpP + gVcAlXgxeoARjFfC3hYPFtKSQsmKpGKOFFMdvdO + qI " ; <nl> + sout < < " lwrru0fgpd0ctBiPsWR4loLRLpt / GHedyVRF29GtPPfP + JekSMDzQj4 / 73RZfIdHlc2b7zX + JdLz " ; <nl> + sout < < " Jk / 4yNb2NmUnum55ezFqq7sv4HPFvMBuOth14QPJsrT1f0NyUBP3qYocsTAY7yo / fg2gYqLFMBHK " ; <nl> + sout < < " + N9IvtHqxyn4actl6t8DIHeBTsM48AJVza + LkOrmuK6k1x61G5r / qyEVTbWVMqKagbySMYtIyJxd " ; <nl> + sout < < " G87XVnI5bbsfSdTdTSQ2EOry9U2H3HIrKIFzxOcj2NxJ + dNqpiLtreoN8XsfLvfM / 46NeNaynG17 " ; <nl> + sout < < " jIqcV8TL7MVqJ74 / OYv6Mek / 0vjLysUDQwPniEkka91ZCJboXzsuW41M5QkSfU / nxsD05TvQVbFj " ; <nl> + sout < < " GBNApTN8Oe8miBahONkbfBB2ks536yBwG8RXWGSHR5Jdl6yhUIw4mWb0WupVEd90sZmXEYeP1q4K " ; <nl> + sout < < " MvdHRuEQbNZfyXLskOtwKsFAqa9ebN6yVdM2tIOOp12Km3mabcUct0nOq / / / UyfEclOfrC5km0on " ; <nl> + sout < < " WWXFk + + 6vwChLbG + 5WCZl5SNeuxEWu1odbh2XZ5ng + XSz / T2P2l3Fa7ujEKilHAYYbS3foWHO + ev " ; <nl> + sout < < " sZlG35o8e5wuKiqnf7gGs8tAIFFyONtfRZuGzH1qy5W7BysZaohtU3ihEzJdomSI1xKHE7 + Dn94W " ; <nl> + sout < < " ZDi7S + Qp6VKbepW6JcdWctmtXyncC5AW + UzquyYuJzjoDRdVe7uEAA44Fhc7nHFHx7snTuZpaYcE " ; <nl> + sout < < " OfIBgzr61aCpVMKX7YJ6NOzRNgfTBIMl24JybjFG9Mcbk2qQVzKQ + w1StjfGTEexWIfYRDxhoUzB " ; <nl> + sout < < " I + 2cAA = = " ; <nl> + <nl> + / / Put the data into the istream sin <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decode the base64 text into its compressed binary form <nl> + base64_coder . decode ( sin , sout ) ; <nl> + sin . clear ( ) ; <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decompress the data into its original form <nl> + compressor . decompress ( sin , sout ) ; <nl> + <nl> + / / Return the decoded and decompressed data <nl> + return sout . str ( ) ; <nl> + } <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> + <nl> + / / This function returns the contents of the file ' frame_000103 . bmp ' <nl> + static const std : : string get_decoded_string_frame_000103 ( ) <nl> + { <nl> + dlib : : base64 base64_coder ; <nl> + dlib : : compress_stream : : kernel_1ea compressor ; <nl> + std : : ostringstream sout ; <nl> + std : : istringstream sin ; <nl> + <nl> + / / The base64 encoded data from the file ' . . \ . . \ examples \ video_frames \ frame_000103 . bmp ' we want to decode and return . <nl> + sout < < " Qld + lmlZhXVX5NDRWIFG1T4 + OGdJbkmxAXXdHZEtpDf6knVTlRWyAhgv85Tf11KJZbhKv1dcsKtQ " ; <nl> + sout < < " fX3y / 9RxoGwtXxwFXCxbBrLRaklZ0wCJRoLkFEbV5T2V0aJZQJTKWkAqP6JwJ7zPTyCiJkDRbGA9 " ; <nl> + sout < < " 1cIxGeLInzTUAlhbGO8eexmWzXHz6KhgZ87K5c4n + YcRjVfwTo3Bl2AB4QPv / bs5da4g6jZd7iwv " ; <nl> + sout < < " PYnF6pRCiwuiCobwvi8eG43pWnNEX2bIUtfMVGP2zA3e9Qg7Q7w6 / KNILIYSXeI4KjLlnmC9YPB2 " ; <nl> + sout < < " 2qPH0Q7DVlBLBBUHO8lZaFg1gR2Jb + 4rgSvuUg6JaoUbqAUMaFFnQCjw9bwdN4bJ1GFXCu4G2afO " ; <nl> + sout < < " / izIyq + QxXHIy / Ez1TZWTtkJfWRkKAjj59IBD7fRSqyvL2tSatSiYQffAcsyQJzcPMTHahKq3XeO " ; <nl> + sout < < " pFu5XOr3OsyxVr7ME4 / GAOcUjNpdW5pAMPNddRfL6 / Jy6S9ICHxppdwhMAtbxsaHiKv2xgcc / t3I " ; <nl> + sout < < " J0t4NPThn / QTNed + F4iFR30 + lwrS1EyOUiqRT7q51LFDQE + / ZyqCrq8vEGp + BRAxMEoL0ekA2B9W " ; <nl> + sout < < " vceyzfAlymEivr89KSSC9L + VZjE8qylGshgeXM30qladBEU4CKtcTlfJFWSHZX9Gm8qDXmp / 5bX1 " ; <nl> + sout < < " lT9 / GNd2E1hBWWQtmQ50DMlInp8oFsoURaMgzNu8zOelG1WAD663IxutR2wJY6ILYQfXNND70XrM " ; <nl> + sout < < " O2PI0ZVRWenZjLzXtSefvwSXCG1G2u5sjq45P4Uk35wtetzV + N2WzVinM3yYtcABa51N3Se2nDWP " ; <nl> + sout < < " huxbCEVYT0c5sfaNCy7XRQ0ijcrMdqMDbecOuTMSlE8FEu12Z0cNFQqao0R8q3601D39vmJoxIPM " ; <nl> + sout < < " wRIiHH6qVcCMBV3oVPWIiD8T96pUZoN3V9BpyQx43MEC6ZdVFqUVQtiYu / PgWqK2pwk4Lh4vpou3 " ; <nl> + sout < < " Jad9ENAsLdoVKZrtHlD8k70MVFOXNXJELqJarxwDy35JAha1 + dHBvcgU3q / 8pOnhS6xZ6judsmXX " ; <nl> + sout < < " LVBdUnKu4w / tbXgJA7lkLtwtODiXCL6edRCSkuXmTRLqXhrzUYzOVO3lZQSNWLLagHa73ce5B6Wu " ; <nl> + sout < < " rVTjMEVaNC3Guz5 / cOkZrveG7MTk / eKR56x7MhkDS3H9pbNiCoqO7Ub52x7j / aicE48SYYkXFTrM " ; <nl> + sout < < " ETpxS8VFa1i5VpaiDxhfZKKV03S / fA0QoUcakVISiSN3VgSrhYsu9KvVjD3kjW9IMKGMlcVH040t " ; <nl> + sout < < " 1cs0rHtLRVh / FjpMZlQxWxhI9ZMH0Ccfzpr7SbTN0Y4WfKaO1O / JfqYkzCnFTThvkrUMAeA1 + zHJ " ; <nl> + sout < < " 1HS44rFnT06RSAGFX6KaqrRFBOC3V3ljXEHyyrGJJe0OHWTUAwov + JzoXuB8onm10lcxUpV2Wd5R " ; <nl> + sout < < " RZ3dx / u9pEYgBolzQIXVkcE0YBYmkXMJfgXK3Rp6V + 1pIR9bTWUU76 / 0CgMHqVBKZOtpl1ykTQ90 " ; <nl> + sout < < " h / n2Mcjhmo9BtRIi + R7rBhr2a + oNj7GZHVPaaItTcdSvns42OxGjc8R6ZdzLHzNNPYx0NkbVeKnU " ; <nl> + sout < < " FSV4qd + iYq + N5hiPeTRfwdLU1wRL84Gvm + JfR3Y6eK8dBmMGCp0skspHGgpf8xTXXpYmOuZ1FmXV " ; <nl> + sout < < " YMKmrYMuTm0IigxtpmCmHPmRZ8U9xbe4Oc8UDxkkmCUvcuvMLS9SJKFOQiUJwxuXgf2IzzzePLcx " ; <nl> + sout < < " ePs3jrlOoD5GzQzSvDrJRIeSxjwTrVFiFT + qwMIIAR7TyTjBOWV51 + kM0 + 5mU9g89OwLmO4yxXes " ; <nl> + sout < < " F + + dusUFHv + DGSCxk2iGNwiNDQA8PktmdVKux3PpVBxWZ6P0W4Kyso6RNIXk9iAVZj59zCr9uPwK " ; <nl> + sout < < " MzIZ1ASN4a7lrfvv4cD + Uxovvt1s8Kck2wmIiWg95RiLdnopqSg8qZY / 3U5u6XmXCqnEFTYuKKVY " ; <nl> + sout < < " dWsDem2GxTTNM3DtxFN9fYbHN6MdbuyiVRPovBz / T + 9AYpx0PVaFst9WVLbf8Ph2Hs1S1vgrW5sS " ; <nl> + sout < < " qM3lBgjEYl4CvDzL5HbmqBV1gTOZrzkrEdr00ChKzRURvTBn7NlvPZewMhL + Hc0SVXYtzCLSl + p4 " ; <nl> + sout < < " C3tIOZaI2l8JIt8k3znBFs3UrWx1WGCv3GY8HEsTa6uX984B5dVvdlUqmstnqK0FgMEkYxiPWoKV " ; <nl> + sout < < " eYlx3k / sV8GChiZWY / 0k15KIY5c1ZUxBQezRc6a8IwYeuCK4dcfkMtn6AUpWu3W / vY / sx4dwNNaC " ; <nl> + sout < < " eWhKda7lBCMsfRdeOZvWgvFKoIknjnkh27uEJu0AskTF + xhdXdKwIfM2ThYFipLGAImNXGuHbtlN " ; <nl> + sout < < " CJ4FBcpn1BFWEY6E4Q + UeOlU1rv / / LgKYxgNC2GX64oLOAoPGgEOG6dTKmnad / 7y42k + kmQnvLvT " ; <nl> + sout < < " YNkffPIcqqBvhZCmvIg4eMR + cB5Kw5IN1tik / XNmrI2FP8y + 7OhNlFah1F + slgX9oHVKoRLtJFPT " ; <nl> + sout < < " e4rQDWqAnWMAoSqsITbHCq9Em1lP6Cq3anR7zsCNH79KJCsbZOZ + J9ccoLm7uLJQUl9BW4irlZH8 " ; <nl> + sout < < " fYZypsN59YE3kzHivG1xH0QsDLXrw4G9E2Z6CFojySfluCPiHXO9V9XxiMaU2X4uYHVb7ehs + / TX " ; <nl> + sout < < " h8uPIngi2rIspfThIzUPC8nl9k8xIH1BoWhryXHkzPi4M + ZAI9afBNr6dB9qa8O5gPvcfpeWPRvB " ; <nl> + sout < < " TGAw + OW3GX40CxJhqQ6n1G101LjjbFvWWdHTm94cR3cS4B2BYzfAqy9Fe2woNh8OT9520VCEMgWc " ; <nl> + sout < < " 4xYjf8rbQFq3kBgPDVEyu86VZCdVBaAs91vTnfd1i7tKCN8JECyr04O4qJ5IM1 + 5Mtv1Z6wlgT4r " ; <nl> + sout < < " NmW5FaCZIKwfORsXG55kuEeKBmvbnBUd6iO + jVtIn3D3RjWCHS05cBsw5uCvixNIHXIF48lTiHpR " ; <nl> + sout < < " hGITp + vcydTLUEeVRxnlKIn0RJX0Ht2PWFNNbU0RV2WFS4K8QGQxekj6i3XFsB0UWJn7ipi4eHJl " ; <nl> + sout < < " CIP6hG5bQ0qG1tvhC3a + Ve4et41gI / DZu9LbSqg3oNWUPjEgFSFadjJ6ZByhJ3QTm8Pl0uVdpzra " ; <nl> + sout < < " myKEafoz0tbaRgJgqAGpQwkIPgp1ocPZBplMSbI9zjBhrTlI6fXfH8aOw4FgB6F436yGuVl3 / Rjn " ; <nl> + sout < < " UuvOT27jH6TvUOGxWBbzXXcxU6250E9S45QSh17Ly1 / pfal5GdAcemaHKLRBeCLMwMszIr5ZOM8M " ; <nl> + sout < < " LxeGCXvWuMuoLIPmElzolFuKKEht5zAr + KGbhsILlLcVpQBnQRM3NxXfh6bO86V / lEOZxhy1b + Js " ; <nl> + sout < < " 1bQrn1Uj90QnhqDoI8t1P6aSFDWKvbsnzC30gPZ8E + FFTwsvvKlzijcoroFQ6I5rSdVehv8 / YNvf " ; <nl> + sout < < " 1yYpXA + hIK5wbbyIAXxxmi + 5OP2viwGEihe5rwkuHRTmtJJ09rHWFT2TbVQAF7775ZFNpSogY57b " ; <nl> + sout < < " GJVCa9pBGN8qzsahk99Z3tjeP + fP + 4F4Si8JyPJq + xmTO62ciKxHrHt9b6sE9H3N62huURtpP90g " ; <nl> + sout < < " 91QbEbFJU / 5JSPfJjJZIp299UhafpBSUACpOnnjBJT4xhVU1E3k5x6TKdrZYzAC / dsQ7BEwZgg + W " ; <nl> + sout < < " 5wfLTnkJsuvMLQgS5e + Ot / EUNd5 + 16kkR / wFeH6vtzG0EyxkWK4V7GrKtsrLWV7jOC6yY2mGwfnB " ; <nl> + sout < < " iWLdaI9Wj9pIeTk7w + PcyTZZfdDldyOF9TwYKvHAz6ea5s7sUe569Y + iDqOOXOwpjX7TMUVgyTCW " ; <nl> + sout < < " 4VC8ixQp + UNTdlKLoeS + 2fw2QupH395hLQ1DHBcO5Tuil8Yqxxw6nV + j27THym0CaB3j0JgA / 4Tq " ; <nl> + sout < < " vbqsEonwHgSaP55u / j + 0QRpycKoXfEkS4gh / qMhbLAPQyTNY7QLjE5cVUqzLG1twetMMcXZL2Dqf " ; <nl> + sout < < " dP2uDCswsX + RJdIAN8BFoa + J + uXHgBMgbxO4DrGz8GxuSr8RfS0JeEFReLiLpE3n + SrnLwKAUr8y " ; <nl> + sout < < " qWjNrqRD6XKVWpX4SY1I6wcE9 / 3jX0c27mGX + 87XnUZdIOZbNgXmntyS8J1P4uFaEZIy2rC2ahgg " ; <nl> + sout < < " 1mdwALsK29JJ5QEaSg / qd9UEmm6jnWLfquCgBIkacJgjG1wc / 029kL0 / Br9t7tuI4jPiKKp + XRM8 " ; <nl> + sout < < " ZZJGwjcB0DbJPB25JQ7zp01lbnEnNiGpNkNXUQtf7a9Z / F530W0M6wG4fOl3lW1HP2zF1Ad0GJxK " ; <nl> + sout < < " y9g9bj + tCsfJQfeymW / 5xaC1C + 9sEDOsg6hgVH6avh1a0ILiY / 5MddtCHDQKQF5tgkuiKXG1 + ihQ " ; <nl> + sout < < " CUlFov0Q7HG9UruG + eydcYSdyfKkdTqYQ6F8PjLP / rpiypX1jiZAodzEuvZwQcZLAgp3gqV1swZw " ; <nl> + sout < < " 6rm2JpyS2Kqc4yCanywpHAU8LkVsjbPTanJiOgDguguVRtYGpAh4fTje2Kofw3rbPjznNu + CC6 + 4 " ; <nl> + sout < < " 8QxPZtcc8USR2EShYVlE90d5uu13F + epClENFc5hww6ymXysLDCIop2vM0PuA6csUxJqf6YFZHBm " ; <nl> + sout < < " c1h + 7m2ULTr7DEVeRCbDkLvrXrL3zzqESvN2x7QDUW1lQRG + A + hLKS / nuibs6tI8uCZ0I3 / VDQKX " ; <nl> + sout < < " hAhNjD9x82FqKKyPGFikNASTaFg7I1DAHm2iHm1Rbff4I5S57UUIk5zr4o / pfQBh12XxfpLtvSfn " ; <nl> + sout < < " SGXRAUcTO5jYoftuSmX9tiMfjjSXopedLWjMKSUXE6m2yggIzxfAzd60Zyr9lNMBVzeXTSkrReAU " ; <nl> + sout < < " QjMxJ9zsAF / 86q2lsxr4gJKNmg9QkunRbsVlh3OXE7MkxBHlb2MkULioU83Gf8LiosiEEmYSB5vY " ; <nl> + sout < < " H8D6cgnXtB64BWoEJpQuG / R + zvnrWNHKmcBd3YkEi1j0dtL5G50SlMOJuai2xsD4RosbPEdV6Qx7 " ; <nl> + sout < < " ESWrAO1naNHp0fewaVl3d8qXh2rFZAKNZXP3O3H7h3BAoMOsxWMFNJwQ0xZshhRvASlOr3Yn3HB4 " ; <nl> + sout < < " fOqqLiPecX / o5r5FRa6qIfP75QaKqcu + iA23psV4 / bszP8L4wREKioaSFncsUwsMU5NyZn3hPDUo " ; <nl> + sout < < " kdW + ZGGQk1F6Md46VYMIvSxC0xer / NcISrDfWmae5WCoGlJGhv1rSnSjRmMrj213eEh2qpDNhz2C " ; <nl> + sout < < " 8dlByOZtSTOPejh42nYMZKCdBTK1lftdSeYdsHRGt51TQOauYYNjCwQkh87aW32Z5dsUi6H96k / c " ; <nl> + sout < < " NTnEoTZbmyqFdmov0QyQBgIfPmIUV / z + 3x9PnfuVHJr2PBdElqqgp7h0Z + Z / 7ESnDV + G / 0 / dx6nf " ; <nl> + sout < < " hfktS6 / 8axrd2xTKr7VrfBLvasV0dTC / GibZlQ1hvowffGgH8dgooP + Nc / S2UqhkYuMZz / Df1r5g " ; <nl> + sout < < " jYMY3rLQt3RqpbZmwU3p9MGe74SVOSCLgYXIDQiGyoGGPuwRwj4uhI5f26fC0UzG / 0RCe2g4dDe1 " ; <nl> + sout < < " vpDGatzd + 3ixmyzEf6K + 4UU4l7V7XAuUYs3lGEmtkz9li9mF3huDAUgOvvw + jErQrMnUGeyfzqDF " ; <nl> + sout < < " xyGfB50sK3Y1q / NSxYKQ1oHsyNYvnTr / aD5OPgMzbjv1Ii1mnwtP3m / EWmdSmAsvsjEq6Dy / yBuv " ; <nl> + sout < < " WZ9JO / XtxbusYXBNUxb6lU00DpJK5NGZVxv6UiQmrRqZvg531ratwkkaH0ZJSOwOzWlRAeVKiDPM " ; <nl> + sout < < " mxtnqoUGNcyr1SqIHBHvhFpr2BJKEeZ6MRwNHoQYCA1dQ4l2YJtZVITuL / o0SHNq1EXC + 5sWB00T " ; <nl> + sout < < " UFfHRWFOYH6 / baG2GJSvgzQrxBH9miEG4WzXQcdTQlmup0RZWjnwEoyHRMj4pc9cujSsTMaGktXD " ; <nl> + sout < < " ZzkAX52IncX0jqq2ZE4epQnx1UHg5IXANgb0Ed0y / FQjS24SZ57uIvl396ubCO1LQ04vGH2Mvs / m " ; <nl> + sout < < " bSM7jKGtcvjQ4uvVaCyk29Ek4EKJM + gUAuEj3IcKnoRNL / P7L2NEBlJuQBlIEgczCVG68kkIOFLZ " ; <nl> + sout < < " CqGgbf9IaBULEjthq4Pr + B5bUYmoBGtkUDM0KewVRJ + YA6A62AAAeStbx + myMgTTqq2b4idEllZn " ; <nl> + sout < < " 0Hc4kztLuBgtHfwaizv9gYEUbgKbXQWfTQdUNAGSyKyeY5dQ425q + eyHezNiXZ7C + tDiM2UN + Lg9 " ; <nl> + sout < < " t49U + 7urUylh189bDcZcGmbx10unLEwYGT0CgDPGA8DJRlkHUkXSlImHpz8 + 3hjRtgljVcz + kFXi " ; <nl> + sout < < " jP8F2VcEoiUDRpaTwdJTi4pRsWSZF6pDEvHWntpnhtBI51zoDzEpbkHJbjRbvBA2zl0b2MqmwGXW " ; <nl> + sout < < " 2qDOXOfSFVUVzTr7 + + omJ + UXxq9awcr / LVXz2tsuMyIvREj0Fx3c9jVozDSbOPzn97QD9LNh8Pau " ; <nl> + sout < < " bvPgfmMGz1Xj5f1UuKvUiCfvfP8ZZs5l08ChMadB64ipgmdWKK4adqE0ES0cTqcg + pJDDL8FgLYV " ; <nl> + sout < < " susPETHqp58vc13TMcBaqMAa44 / xA98rFy + KZpYNxFf + l2U1eq44OH / zdytXhOg6y8TWrKYIdX1A " ; <nl> + sout < < " C91FZWXj0t5KfTahGZE5t0nP5iKl1IdXnE + dOIvIHuzrTnyjM + IiHmj1DxClG1VQXhZcwvfBzIY6 " ; <nl> + sout < < " MRwFxUJXmt7O55uesEbZ / anmQB6LHdy7hMuvvCgeLBhoRnnyiRJYp3OAwNH5MLy7LXK84ZKTkodw " ; <nl> + sout < < " BuyRw5oJ9KOB13Buxj2yCRhLky572BT61cw0rXXkw2ZOGQgzHbO + cjikNk5LsVyMYfE49ClKM4w9 " ; <nl> + sout < < " 6pVtXDNzSPvQK0KSO0ZMKPDAr1 / MrV0PD5Y2v1JIVPOuKSjq1s2vP7ypzarrFHAJnsD1FrigYXME " ; <nl> + sout < < " 9amdaYhCmPIiOjj + 9xSfmuBrrsHJ / THe82pg0fO3mpsF7TVY3zQCpiMDY / UqDyRrgc8NQu6A2WRc " ; <nl> + sout < < " oGCRQ5QCWCTFhbIV1HQ / KXjiCeFrCd88KkZDLDwrWMqeeGDTM8eWQcTIqoMMtu / JiCrts9c8yiTj " ; <nl> + sout < < " IFiHTXnpZMYwxDeT9hvNkifueXVjFYbEs6hHySwX0kcUSgtRP3fUKyQe + Iz + u / iOi1tFHQgPsV5W " ; <nl> + sout < < " gltpMLE72aQmlQ9C1lYkJQoKrQJRFiJmiQn5S2hQKXurP2HOIsAYSpW4mpeeFJpxsF8lekzeniil " ; <nl> + sout < < " 96nrrpQlpc1vPdDhbmTY07tGoNlYRjoKTYaelkktnWA2a4n69x + kD8iBfVLANU + EFHNfCyQgmdJe " ; <nl> + sout < < " fWMYQwqwgxMWk88peAftdx7bDJ1ZJQ4q0zzkot7w7NB4oe0Q66awUwj2n4DYvDAum3SRz2LwsaiR " ; <nl> + sout < < " Ke8N8dMtRYN2mosZ / 108MktIKlnJ08bkI6eDnO5vHlbeBfLOfEP + + jGsgdS1KHrZHdIygtioQ9Zj " ; <nl> + sout < < " RzWb1fKOpoIbxV4mgh5MwpliqwHmG0DIq1UPIEqj8W / Vbd1T49FhWRJs8cyYraimx9MPklhyxlGA " ; <nl> + sout < < " HvHpQfuihMzLT7nNAVceWz6GzYfHy5uvje2MYBVHkoQ6RaMnJUCfFd64pbFTmsB + / + Teoo6q4I5G " ; <nl> + sout < < " fbeIMh26cs37X5MwocXcq7jSunVLgPJYDlBcbpIdhDt + Uuf5VPo1GXRAk80ouu1E9mrYvlZ4sanS " ; <nl> + sout < < " 5EJ61PNevEOSDPPdYWwfMR0rKZuoefUCNfvy7XyXpEnZpNLHKsO7Cs6ZyL6zQykBk + KQCfdRnTHa " ; <nl> + sout < < " SVSpKvmD34O1gGkrq7kSfyWO6eU0TU8HImJY1tpI8fcMTheZ24hxx2QsV6IbsM0wbxS3d2Qo15XC " ; <nl> + sout < < " oP9xQxVcn17iiHUg70awt7j2VFEuCb1QjMbNnd5lUvjSJ0jH6gi + n / on65AWEJYm73Akn9i3fP + v " ; <nl> + sout < < " oLTDxIOmjRZsDgzsAbgtxb0Ozu0rNutnPRH0Am9C + GGJX78X3u5qDVn0q2 + qD7eQkPOmW6oQiIYq " ; <nl> + sout < < " 8rWM8ya2N940j + H5HsvyW0FKyrqjSSXQ5fF2LJE27Wc5ob0tVuvWAzOQ8COZWMMapu / S2C61f + 2s " ; <nl> + sout < < " dFiCjJQqvr3Ai3pePmVrODBGROVHow3PXekC8iQLRwOYfNHwiM1jGwPOiMBZ3v + LghoBYHhmUh0Y " ; <nl> + sout < < " kZUb1j5Mncmgz3pctYS7KFhlHq1RHTDlF0pevtVLDXyy0QNXFoOqGydJaqLN2eILSl / eOGmsVlQz " ; <nl> + sout < < " lgyoCzPW0YsuN7Z4m0z0CfdP7WTpL4s2jlB7QpdaF3JOaip2nVZzX9xb6qXPosQ1WF9yixcznoAZ " ; <nl> + sout < < " bfWnipe5Lnxm + KHX8OUclbWUC6Twaxoq9Uo9jXuwkU6PZ5VzM5lao7D0JCPfVo7b55q1258j1AnN " ; <nl> + sout < < " 9JNYYcZ4ZjTEKvbXGdtb943Wmmr7CnI4IyKv7AFpeiMAYPVRgxIvn0RjWpJ6lzV7LutAjv0HXwZ7 " ; <nl> + sout < < " 5XHtqvvuIe + IIIG7Iqj + JBW / pgQsbb7CKXiRmrWwl1MTtDIrQuh6UP6mstikBOF / d + yOSqCvU71B " ; <nl> + sout < < " A / Bj8gEqiPEqB7uih1Kakz9wRraRAYo6VZphC8Q5LdkFQG45Bj7KnACHbBs7e9xe7GDrP4OVbQHh " ; <nl> + sout < < " m5QCONkNpd + 0umv74Adr64LDpsMr6CLBgHRrXukUXUGmFPqUCD7lC + quhu8psnZZrvSNPSa + goRp " ; <nl> + sout < < " PnO4wDlSeBSkuSdyC7utuC40jQtIZrkJmvkq5UURj4VcltYQ + 5KiypO7ixAK4fvKyBTgxV2WNVeY " ; <nl> + sout < < " QvxNeJcNck + IPEhYLyplcLzyoekhnP4ZDD6ALG2jWZ8QoKpShA8 + HdRSJoFguoERQRS7ePlMxywb " ; <nl> + sout < < " kcLPkcyEOlBu7lSjCRvjvdROmLAidz2GrlWvkuLrRe6clvs + U8JfBTjOON6P5nq41ElWNA33r9KN " ; <nl> + sout < < " kcCmEICyFl / Ier / YdjOUtXaHsKwHaMjmrXHQOTP7ELs7jouCbb4cTFVtgB20smKj3paJgoQysxmq " ; <nl> + sout < < " 12Ur3QnHaHjaoxzIQnlaD69TF4O7T6U68 / C6BwQDuZiD6iB + mkCQ7Uz0zFsiVMbF + RgFJKpjN4oo " ; <nl> + sout < < " SuR2gUL8sPlixeYmannuPwhCkJ1swN7NiVeUwTGFUDeQt2eJvJc2CllOpUZwF9PbyHSkxkQLs9kP " ; <nl> + sout < < " 9DkvDhKkqJ2aEHDlPGBjETFYjNGdoBfMIcr1yvWshl9fTGlEi8c7mxMW / 5Ed4sSdV3N6qRj3KZB7 " ; <nl> + sout < < " zdQJ4Ql6tH7zkYWfo / ZtTEggQQAe6FzyQ12 / xgFgdAulwF1IJZ / JlzY / SKePQPX0 / 89AooSUAl2q " ; <nl> + sout < < " / BfEFEI5XJhXDp2VJevsfFAjlmf0pbC5DkyBlUwdStZAoZpvfZPXcQ1NshCuD / hT4FinYmLl7GaW " ; <nl> + sout < < " LJSXkHegN09TBLWDdWe3DfKDZEWYqbIvtgt5Evgtw / 5Qvy5DtefyHPq21BoIT8C1zxkgfOqEhH + l " ; <nl> + sout < < " E / fLaDsROj + RUJ055ycF9Wa8mzCOZMnaqsD13eTXtEY7LQ7MEo / 15S1ny5JxaGNHxy7YJ3JfrshB " ; <nl> + sout < < " 0pZ5vL3jvb9iYwocPnlmFpli + Md6qEdonEN6K86WwcRNqV57mMlF / EhBZXi8VnW0nqglR3mT2xTz " ; <nl> + sout < < " CKiwPK1W / zOnR2K0SsQrHV5kaLCfRi4vM3Jv / bGjlgJSUYBkB1QC7jBKE + uA3H5EmspwnDKPAb + b " ; <nl> + sout < < " kYXzpMWfQbvMvzpumEs + nY / xbCf2Hr1vhZAAFR1L4F49xrxDr8rjP3DryRgtBquQH6 / 5qMwdg9pR " ; <nl> + sout < < " 4ACieRQts0S8jC77fxLAFW2GqifC5DBhwIcdhOhxR1FGLo5RzNktZkPob / fXEcC6u / Uz4v4Gy0j / " ; <nl> + sout < < " ZM783wye39lB2eymWQ5XPGC9FKR + ZLodyKJK + NXDBiFBXOjY4WNKEghllE7jAEU6VVmAN8NDkQdf " ; <nl> + sout < < " u6MiVlBZLK1cepTPDj6G / TGH2FK0I4O / z + Gb2WQdZ2VUObGhf3GpYNR4XEoBsJe0I8F + TKpHYpdY " ; <nl> + sout < < " guyaXCEMW9XpK0hTOBXfaooIQu4 + Yb9e18fKnkrW74Aj45mdseL80RH2RJGm8LeZa / Nluqm71cqu " ; <nl> + sout < < " 9zJkwZjxlfICDgLhkOXtt / Lihzoqav / abehnuZjlyWwJ34eIhCmEv9D7C0P9VE / 7B4P1S / demat + " ; <nl> + sout < < " W + rmgFScowUvs1lfxNr1I5uCyLEJ9VphPUXnykyJ0XM6zm2Za8jD17Nh82k / eCX + JFMWv5znDNQe " ; <nl> + sout < < " aDzkIRjTQhXWt4e6GNZ5zU6g9rr / TIePeMJyRE4D09xOF6orHWMBh / TFAL6PQnJaI6RUqCg8le0 + " ; <nl> + sout < < " ySd9qWCRpZsYBK + bZBEV9A1iJyvhLyKLgSGC8Q5Y0tQmE5zWSlYkRr4YtfASRn7e4l + Hz + hhcReD " ; <nl> + sout < < " F6s8jWCAHjsq4uZi8qf17LwZu2xpbSLmgCE1sij59Mli4sWlPDkX86ehGqvH2D2x3hKlXco1v + q5 " ; <nl> + sout < < " dbNe / zvwcng5KoCwL0pmT3itlXfQs08 + 1lXbpoqUf2wqmQFEi3 / TIWq + 1lF / zV + 6ICVx1d1eKarh " ; <nl> + sout < < " ZgdmD0C3QLlPNlUAG1j6qWQ4K32ICyKu2XWRjcaElm8uRxPBBJ2DKWJFyDwP8caoB80A2ApnnFCH " ; <nl> + sout < < " mrijgRO7LeQ6bQJJjOBSjeppPm4jTsVd5tlAefLV25uRwx4Reif0e4x + 24fxtPj9udHRWggwGu / 1 " ; <nl> + sout < < " Zs4 + wsJ7KmX2ekZ2LR5aotwtBCo8X1J9GaHal4WCzh9G7EqAeSjjrD63DoSgJx8PAUoH32QXUMxw " ; <nl> + sout < < " b6JR8Czkimh47Uv + aIqZsr6GDskW7xfxxgmzIPwSA0cJkulJKiOYEmjcfgzqaKHrcjMRb4LhJRTE " ; <nl> + sout < < " F7Xgdk4nJGT2hRv3Abqz4725TLPUsfd1DFTM8BJuJSWjGNa2cyQ6f3CTQPEZYFiyYMCtd4Ycytnq " ; <nl> + sout < < " N4djAycInnDJV / + XSjC94UB04UDvkq5lds + tgGMDf5YWClAz5EO0ztmL5PIQrA7qx1ykF7xiRHVB " ; <nl> + sout < < " Jy1Ln0oTEV9yf8jlIYILg3V / j716p61dkyJIvRtO6XhFdyE + 4ia0WdXaNWNwvx4wkzqRHD4IxMD0 " ; <nl> + sout < < " imBJe7IIMVztDzJ7T4K61P7nzwgGJgXHwfdh4xxYZC + 4Qf7LVyGOeH30AgAiZBzEFu6kCHmPMxgZ " ; <nl> + sout < < " VQIAvbW0 / 84nBgbqTvUTQTVytf9ufnhuVZSJfXbMlFGTxeCtHG9C6rgAAk2QNPHb8up8NL4ZnVcA " ; <nl> + sout < < " AWk0OHyU1DZrLFb26nmHBxwVZySrSppYbldjEYxMdewD2OIYBYrCBCKIJzZpTMP8D7QOIX7B05Vq " ; <nl> + sout < < " zPH2i9cAAAWjZjAkQxG25u2KhBSufKHwxVZ9xgi82dPIUZJRMhNOyUQ3uVhK4MilNqxi3Giw2KtP " ; <nl> + sout < < " lO1IWReKc0m1pXxv70r03E0i7kf19iQ6AAAABRagQbu / yzAW7Stqw18BH3pVGZSoj8no2Sn / A9QF " ; <nl> + sout < < " E49JB + qp6BejcC0vGwH + ogKo7pk9fecrkHEc / 6aH1Dt7ciMaDXfFII5rE9AAAAAB5kmFhDYODCNn " ; <nl> + sout < < " qZy5bb542mHiW4BxDLW3mQ4uKyXFV56IuntOj0rsjRZdrOATffLebKWyn1anGbGdQvJcOZcHvV6h " ; <nl> + sout < < " 1Aih5pmFfPxyhA2ba90hh + kPYjhT2QAAAIYcLHepOiMlf + gULTiFNjbeyaz5vgWcGTiwkv4q4ED3 " ; <nl> + sout < < " ZLE0lb + l / 7qt620m8kgPvUAOLnK6ysWdLpoTtevH7MY5LafF3R / YxEPOo9xgr7zDLrMKLkZILeIb " ; <nl> + sout < < " yegmBAnGeWonZpv3eidKXsbBFhHGw7DoSakVKAT7Jahlmyk6howH8x8VEVpK1QNbaAXt / pFXGrzr " ; <nl> + sout < < " dAO6LjOcrwxvW8iYPjPChEHqwYloPizhrN7k0u0F / oq / urAZxyJ / MP8Tx9afuHY4aocW8FIGmN8f " ; <nl> + sout < < " NSozaWDqqw209VkydVcnibQweQucq14zNKxGZgvnuw3SKeLPAc40Z3fSWsEfG / DImcOJ6QdmY8S8 " ; <nl> + sout < < " 34MKBXUjR8W0w1P0gs407lSQFRZBEmiOpU3HW + A4BisSe4fcFlzFt + lhP9VNDr7lBHpbAqkg1Ob4 " ; <nl> + sout < < " 8 / uu5w5qut8RiDJp2dYQFY1OieuY1lEN1BFYl4hoUuBQqGBpq3MDn6V40ZzXHl2Rbl + u2tXhNICL " ; <nl> + sout < < " FPOFo0Y + 7b0ppLIQGPAd5fBGTfMnibWFP9Bw8KDo9wUbvGslyV0ny303hYXO4TzIliPUUu + nsJRc " ; <nl> + sout < < " pBCeJdyRvQUjr6BjCXrNVSldiB6oCr7e0AfMBU1BErZAhzseZYzzlIavra3tEOdW4xweFxOO1JNp " ; <nl> + sout < < " BqoG5a9gozEd6VQvhurdttGa5jsSm / tEmGDZl0t14nN18hjVW6KCb0u3 + kCbcCRRcFz6tZ3 + eomJ " ; <nl> + sout < < " TQIBUJu40uNzrLmur + zJyT7 + JRRIq / xXSv2R1oJhIiYGe9P99wNd13TuTi5Oyx1b3hHJdysPjIt1 " ; <nl> + sout < < " / I8UGCpIQ / FCIEEplSCkhDgedfL9OtDOnU / + bI2cipB8tWSwpwbczIslv49e3 + xIqBzLf / 4gBDd2 " ; <nl> + sout < < " 4ZYwe2lHWGL7OXGYCAQbC9ELg2KuRDpLrG2ad4fhUuAnizCLb + q + 3Nd7qgkPXweeEMAbSHhp0vuN " ; <nl> + sout < < " XSbVB + cDaHkw7DxxJR0nn4IhdbkuQ54G975t + Wo5uPunpyZ5QvDXijG8NEhIAytpMmhXjkiyUbk / " ; <nl> + sout < < " XmaEnaSTOxOEVh / fBjeGfxHmjn0TgkQlw7GLHa1rB6Lp3y7hSWoZW0RSn0TmVQbWBFHen0cfhsp + " ; <nl> + sout < < " zc7gTzMeFxhMf3ZmBS9pmigcVHPAmU + rOLTtAzaklKumgxf0B + Su8YLZpcvc6Jy8t6rJgCYwIhR + " ; <nl> + sout < < " BiKEN1l6CxFeQtJp + 2Do6oEZ4Lfk0DoAnJdV8l5DhkiXiuwX4zPFiKZQtKSBsrp7bq6dqjDphbgL " ; <nl> + sout < < " 1A6JahmxkTYcJVOnVWG6LvfHYCIJ6hwDV4J23P + tNZtLCzfHPnDDdyJCmBExsOV1xXzNeGhqZhb3 " ; <nl> + sout < < " kSWXntkMAstuTSdgb8vPGYSyEMsTx + pTeXFGv3TN + YCdQTQIovV2f0KTZMxmjoTmlZKueVeFwzSP " ; <nl> + sout < < " S + G65EMEcgQUGloWsFPdIaRzPLYHUktOcJc4bqEDvwIUDLqfjH4zr7kgF6i0KfRUMP4Jrje78S9G " ; <nl> + sout < < " C7o9XJLGWbS32yrdKVlIG + 9f + 2YQRrZECzhex6WjV69 / JSe0jbilwXwsJSKtY6jFik8eE6RCZqN9 " ; <nl> + sout < < " c1vOxMcd + 5twMMkmnu4yvBEV6Y207UtegGSHaESpEW1MTvbDk / 75X46WMSECbeEe8lzlmNaaWyWY " ; <nl> + sout < < " C + siHamjyTgHAvJLEwiNlQ26LS3mJr4HmpOVizbTykoe2WGV / jmUrhhUg2AN0CrS2LqriZolW / JX " ; <nl> + sout < < " jJeehNlJ9Jy4e4NZE2Xn / Q5UC3zVJm3bpbC3JKre7sALksQSQInLf7OoYArfwgYmAdMWhgxRakIv " ; <nl> + sout < < " 0M0acqOuNUxmW0k4YEzEncfjSAQ3cAUkaL1XS55I5vm3o1RPiKBjjypzdi8GI7migOK5dRrIctP4 " ; <nl> + sout < < " U0S4L6uojFipn9VGhIjGiv0Rg6OcaZO2FDq9SOGmLZ4b92sE7v4rtEt8oxlbbxPdgT6CLQkVCCJh " ; <nl> + sout < < " uvjCIeAmV0wwhaKYzE2TpSkPFrtCPWhBjSulx5OwEGvdgzUq1NAnHBqlc6Oazt + 6Hb / b + zpziei2 " ; <nl> + sout < < " huprTtScOqJcYzqJYGIwYebjxpVM0f / 05a3LodBUWUNUIRNyzJpyEZluHCupDqfEgF7ObUDvtTDO " ; <nl> + sout < < " Zl1aCRWbztt2W0JE7SSCAZbzY + 3Dq + m0VUJj1L7NZkg5py0mUHHnz2lDveZjtHr9UBqETzN2xCuw " ; <nl> + sout < < " 8LQqbhDKR5I5ThHilGjZjxSN4VUKgBiBNUHXu8D2VN9RHr9xjQzmnSOJPHtcFuf9ioGO43OVtV + I " ; <nl> + sout < < " DvE3YjEt53F37uZBmvTQD3zcBvgRoNF24j6jjTeHE3I / MROKotCIBkxk5AZTF9Awzha4XwP3xOAI " ; <nl> + sout < < " FyhCle92a3102sdU / azu + 1n3Jq0ZeifCSicBjrAHgQpVM7afn / yha / YKXqiwingX4pvrN6IRKADv " ; <nl> + sout < < " edJG6C4OttSovas7ayKdaTWURKwQWQ2NQF / 24DUEmfGkWgk3e1uFjfdBNFez7 / omGkRqvSAoT5pe " ; <nl> + sout < < " rXpbWzb7nigtdMRUdVMdzAHooSObROsbHc7ngUn6sJ6rD88EJZH94kk3adWN6plDDTyRe / eu5Ah0 " ; <nl> + sout < < " XnBPmYIgVSYSZ / X6BvS5AZDElImmABuvuLEjOQ3Ydqc1NQIGOgMzWhn / Dc94YMxSOdmHCo5RyGjo " ; <nl> + sout < < " Zn0wntZDa + gKaR8PwzsIi + Q7RvReVKP4xKNPbI3W47v3sh1PeidJXt75OoHyKpoxJJcjwB8me4iZ " ; <nl> + sout < < " ctKBz0QZ5ZBuywtn2Lq69I5nmjHQbpIB + zmPqIxEJOworB7Qg6thkda97KcHsRbMJAA = " ; <nl> + <nl> + / / Put the data into the istream sin <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decode the base64 text into its compressed binary form <nl> + base64_coder . decode ( sin , sout ) ; <nl> + sin . clear ( ) ; <nl> + sin . str ( sout . str ( ) ) ; <nl> + sout . str ( " " ) ; <nl> + <nl> + / / Decompress the data into its original form <nl> + compressor . decompress ( sin , sout ) ; <nl> + <nl> + / / Return the decoded and decompressed data <nl> + return sout . str ( ) ; <nl> + } <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + } ; <nl> + <nl> + corellation_tracker_tester a ; <nl> + <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + <nl> + } <nl> + <nl> + <nl>
Added regression test for corellation_tracker
davisking/dlib
13ea9e581c8352d59443d3b06c7143308eb6fccd
2016-04-07T09:26:37Z
mmm a / classify / shapeclassifier . cpp <nl> ppp b / classify / shapeclassifier . cpp <nl> void ShapeClassifier : : UnicharPrintResults ( <nl> if ( results [ i ] . fonts . size ( ) ! = 0 ) { <nl> tprintf ( " Font Vector : " ) ; <nl> for ( int f = 0 ; f < results [ i ] . fonts . size ( ) ; + + f ) { <nl> - tprintf ( " % d " , results [ i ] . fonts [ f ] ) ; <nl> + tprintf ( " % d " , results [ i ] . fonts [ f ] . fontinfo_id ) ; <nl> } <nl> } <nl> tprintf ( " \ n " ) ; <nl>
Fix argument for tprintf
tesseract-ocr/tesseract
a95edd7e1338d08dec2426ccc39e051fa35692f8
2016-03-17T10:27:06Z
mmm a / algorithms / happyNumber / HappyNumber . cpp <nl> ppp b / algorithms / happyNumber / HappyNumber . cpp <nl> bool isHappy ( int n ) { <nl> <nl> while ( n ! = 1 ) { <nl> n = squares ( n ) ; <nl> - cout < < n < < endl ; <nl> + / / cout < < n < < endl ; <nl> if ( m . find ( n ) ! = m . end ( ) ) { <nl> return false ; <nl> } <nl>
remove debug information
haoel/leetcode
fe6574fe96876b5e11889e1b01f4c0c544ab0c1f
2015-06-08T12:06:40Z
deleted file mode 100644 <nl> index 4a9a15fb51 . . 0000000000 <nl> mmm a / code / cryptography / src / autokey_cipher / autokey_cipher . md <nl> ppp / dev / null <nl> <nl> - # Auto Key Cipher <nl> - <nl> - Auto Key Cipher is a Symmetric Polyalphabetic Substitution Cipher . This algorithm is about changing plaintext letters based on secret key letters . Each letter of the message is shifted along some alphabet positions . The number of positions is equal to the place in the alphabet of the current key letter . <nl> - <nl> - # # How this Algorithm works <nl> - <nl> - Formula used for Encryption : <nl> - <nl> - > Ei = ( Pi + Ki ) mod 2 <nl> - <nl> - Formula used for Decryption : <nl> - <nl> - > Di = ( Ei - Ki + 26 ) mod 26 <nl> - <nl> - * * Pseudo Code * * <nl> - <nl> - 1 . Convert the Plain Text or Cipher Text to either Upper or lower ( must be in one format ) . <nl> - 2 . Encryption : <nl> - 3 . for 0 to length ( text ) , use above formula for Dncryption , <nl> - 4 . nextkey = text [ i ] - ' A ' ; <nl> - 5 . text [ i ] = ( text [ i ] - ' A ' + keyvalue ) % 26 + ' A ' ; <nl> - 6 . Decryption : <nl> - 7 . for 0 to length ( text ) , use above formula for Decryption , <nl> - 8 . result = ( text [ i ] - ' A ' - keyvalue ) % 26 + ' A ' ; <nl> - 9 . text [ i ] = result < ' A ' ? ( result + 26 ) : ( result ) ; <nl> - 10 . nextkey = text [ i ] - ' A ' ; <nl> - 11 . Display the Results <nl> - <nl> - < p align = " center " > <nl> - For more insights , refer to < a href = " https : / / iq . opengenus . org / auto - key - cipher / " > Auto Key Cipher < / a > <nl> - < / p > <nl> - <nl> mmm - <nl> - <nl> - < p align = " center " > <nl> - A massive collaborative effort by < a href = " https : / / github . com / ravireddy07 " > me < / a > at < a href = " https : / / github . com / OpenGenus / cosmos " > OpenGenus Foundation < / a > <nl> - < / p > <nl> - <nl> mmm - <nl>
deleted unwanted files
OpenGenus/cosmos
2006573479f567c41626134b2b50ecc9595d671f
2020-05-31T18:11:53Z
mmm a / source / common / grpc / context_impl . cc <nl> ppp b / source / common / grpc / context_impl . cc <nl> ContextImpl : : resolveServiceAndMethod ( const Http : : HeaderEntry * path ) { <nl> if ( path = = nullptr ) { <nl> return request_names ; <nl> } <nl> - const auto parts = StringUtil : : splitToken ( path - > value ( ) . getStringView ( ) , " / " ) ; <nl> + absl : : string_view str = path - > value ( ) . getStringView ( ) ; <nl> + str = str . substr ( 0 , str . find ( ' ? ' ) ) ; <nl> + const auto parts = StringUtil : : splitToken ( str , " / " ) ; <nl> if ( parts . size ( ) ! = 2 ) { <nl> return request_names ; <nl> } <nl> mmm a / test / common / grpc / context_impl_test . cc <nl> ppp b / test / common / grpc / context_impl_test . cc <nl> TEST ( GrpcContextTest , ResolveServiceAndMethod ) { <nl> std : : string service ; <nl> std : : string method ; <nl> Http : : HeaderMapImpl headers ; <nl> - headers . setPath ( " / service_name / method_name " ) ; <nl> + headers . setPath ( " / service_name / method_name ? a = b " ) ; <nl> const Http : : HeaderEntry * path = headers . Path ( ) ; <nl> Stats : : TestSymbolTable symbol_table ; <nl> ContextImpl context ( * symbol_table ) ; <nl>
grpc : strip query params from stats ( )
envoyproxy/envoy
ec0f23d7270638481d4e7807fa12e033775160fe
2019-12-04T21:10:15Z
mmm a / addons / metadata . demo . albums / demo . py <nl> ppp b / addons / metadata . demo . albums / demo . py <nl> def get_params ( ) : <nl> <nl> <nl> params = get_params ( ) <nl> - print params <nl> + print ( params ) <nl> <nl> try : <nl> action = urllib . unquote_plus ( params [ " action " ] ) <nl> def get_params ( ) : <nl> except : <nl> pass <nl> <nl> - print ' Find album with title % s from artist % s ' % ( album , artist ) <nl> + print ( ' Find album with title % s from artist % s ' % ( album , artist ) ) <nl> liz = xbmcgui . ListItem ( ' Demo album 1 ' , thumbnailImage = ' DefaultAlbum . png ' , offscreen = True ) <nl> liz . setProperty ( ' relevance ' , ' 0 . 5 ' ) <nl> liz . setProperty ( ' album . artist ' , artist ) <nl> mmm a / addons / metadata . demo . artists / demo . py <nl> ppp b / addons / metadata . demo . artists / demo . py <nl> def get_params ( ) : <nl> except : <nl> pass <nl> <nl> - print ' Find artist with name % s ' % ( artist ) <nl> + print ( ' Find artist with name % s ' % ( artist ) ) <nl> liz = xbmcgui . ListItem ( ' Demo artist 1 ' , thumbnailImage = ' DefaultAlbum . png ' , offscreen = True ) <nl> liz . setProperty ( ' artist . genre ' , ' rock / pop ' ) <nl> liz . setProperty ( ' artist . born ' , ' 2002 ' ) <nl> def get_params ( ) : <nl> xbmcplugin . setResolvedUrl ( handle = int ( sys . argv [ 1 ] ) , succeeded = True , listitem = liz ) <nl> elif action = = ' getdetails ' : <nl> url = urllib . unquote_plus ( params [ " url " ] ) <nl> - print ' Artist with url % s ' % ( url ) <nl> + print ( ' Artist with url % s ' % ( url ) ) <nl> if url = = ' / path / to / artist ' : <nl> liz = xbmcgui . ListItem ( ' Demo artist 1 ' , offscreen = True ) <nl> liz . setProperty ( ' artist . musicbrainzid ' , ' 123 ' ) <nl> mmm a / addons / metadata . demo . movies / demo . py <nl> ppp b / addons / metadata . demo . movies / demo . py <nl> def get_params ( ) : <nl> except : <nl> pass <nl> <nl> - print ' Find movie with title % s from year % i ' % ( title , int ( year ) ) <nl> + print ( ' Find movie with title % s from year % i ' % ( title , int ( year ) ) ) <nl> liz = xbmcgui . ListItem ( ' Demo movie 1 ' , thumbnailImage = ' DefaultVideo . png ' , offscreen = True ) <nl> liz . setProperty ( ' relevance ' , ' 0 . 5 ' ) <nl> xbmcplugin . addDirectoryItem ( handle = int ( sys . argv [ 1 ] ) , url = " / path / to / movie " , listitem = liz , isFolder = True ) <nl> mmm a / addons / metadata . demo . tv / demo . py <nl> ppp b / addons / metadata . demo . tv / demo . py <nl> def get_params ( ) : <nl> except : <nl> pass <nl> <nl> - print ' Find TV show with title % s from year % i ' % ( title , int ( year ) ) <nl> + print ( ' Find TV show with title % s from year % i ' % ( title , int ( year ) ) ) <nl> liz = xbmcgui . ListItem ( ' Demo show 1 ' , thumbnailImage = ' DefaultVideo . png ' , offscreen = True ) <nl> liz . setProperty ( ' relevance ' , ' 0 . 5 ' ) <nl> xbmcplugin . addDirectoryItem ( handle = int ( sys . argv [ 1 ] ) , url = " / path / to / show " , listitem = liz , isFolder = True ) <nl> def get_params ( ) : <nl> xbmcplugin . setResolvedUrl ( handle = int ( sys . argv [ 1 ] ) , succeeded = True , listitem = liz ) <nl> elif action = = ' getepisodelist ' : <nl> url = urllib . unquote_plus ( params [ " url " ] ) <nl> - print ' in here yo ' + url <nl> + print ( ' in here yo ' + url ) <nl> if url = = ' / path / to / show / guide ' : <nl> liz = xbmcgui . ListItem ( ' Demo Episode 1x1 ' , offscreen = True ) <nl> liz . setProperty ( ' video . episode ' , ' 1 ' ) <nl>
[ addons ] [ python ] metadata . demo . * replace print statement with print function
xbmc/xbmc
63e33f6b950f953ecd9d300e38732f97400ab868
2017-11-23T08:11:02Z
mmm a / dbms / src / Storages / StorageMergeTree . cpp <nl> ppp b / dbms / src / Storages / StorageMergeTree . cpp <nl> void StorageMergeTree : : rename ( const String & new_path_to_db , const String & / * ne <nl> } <nl> <nl> <nl> - std : : vector < MergeTreeData : : AlterDataPartTransactionPtr > StorageMergeTree : : prepare_alter_transactions ( <nl> - const ColumnsDescription & new_columns , const IndicesDescription & new_indices , const Context & context ) <nl> + std : : vector < MergeTreeData : : AlterDataPartTransactionPtr > StorageMergeTree : : prepareAlterTransactions ( <nl> + const ColumnsDescription & new_columns , const IndicesDescription & new_indices , const Context & context ) <nl> { <nl> auto parts = data . getDataParts ( { MergeTreeDataPartState : : PreCommitted , MergeTreeDataPartState : : Committed , MergeTreeDataPartState : : Outdated } ) ; <nl> std : : vector < MergeTreeData : : AlterDataPartTransactionPtr > transactions ( parts . size ( ) ) ; <nl> std : : vector < MergeTreeData : : AlterDataPartTransactionPtr > StorageMergeTree : : prepar <nl> [ this , i , & transactions , & part , columns_for_parts , new_indices = new_indices . indices ] <nl> { <nl> if ( auto transaction = this - > data . alterDataPart ( part , columns_for_parts , new_indices , false ) ) <nl> - transactions [ i ] = ( std : : move ( transaction ) ) ; <nl> + transactions [ i ] = std : : move ( transaction ) ; <nl> } <nl> ) ; <nl> <nl> std : : vector < MergeTreeData : : AlterDataPartTransactionPtr > StorageMergeTree : : prepar <nl> thread_pool . wait ( ) ; <nl> <nl> auto erase_pos = std : : remove_if ( transactions . begin ( ) , transactions . end ( ) , <nl> - [ ] ( const MergeTreeData : : AlterDataPartTransactionPtr & transaction ) <nl> + [ ] ( const MergeTreeData : : AlterDataPartTransactionPtr & transaction ) <nl> { <nl> return transaction = = nullptr ; <nl> } <nl> void StorageMergeTree : : alter ( <nl> ASTPtr new_primary_key_ast = data . primary_key_ast ; <nl> params . apply ( new_columns , new_indices , new_order_by_ast , new_primary_key_ast ) ; <nl> <nl> - auto transactions = prepare_alter_transactions ( new_columns , new_indices , context ) ; <nl> + auto transactions = prepareAlterTransactions ( new_columns , new_indices , context ) ; <nl> <nl> auto table_hard_lock = lockStructureForAlter ( context . getCurrentQueryId ( ) ) ; <nl> <nl> void StorageMergeTree : : alter ( <nl> data . setPrimaryKeyIndicesAndColumns ( new_order_by_ast , new_primary_key_ast , new_columns , new_indices ) ; <nl> <nl> for ( auto & transaction : transactions ) <nl> - transaction - > commit ( ) ; <nl> + transaction - > commit ( ) ; <nl> <nl> / / / Columns sizes could be changed <nl> data . recalculateColumnSizes ( ) ; <nl> mmm a / dbms / src / Storages / StorageMergeTree . h <nl> ppp b / dbms / src / Storages / StorageMergeTree . h <nl> class StorageMergeTree : public ext : : shared_ptr_helper < StorageMergeTree > , public <nl> <nl> BackgroundProcessingPool : : TaskHandle background_task_handle ; <nl> <nl> - std : : vector < MergeTreeData : : AlterDataPartTransactionPtr > prepare_alter_transactions ( <nl> - const ColumnsDescription & new_columns , const IndicesDescription & new_indices , const Context & context ) ; <nl> + std : : vector < MergeTreeData : : AlterDataPartTransactionPtr > prepareAlterTransactions ( <nl> + const ColumnsDescription & new_columns , const IndicesDescription & new_indices , const Context & context ) ; <nl> <nl> void loadMutations ( ) ; <nl> <nl>
Merge remote - tracking branch ' origin / feat / parallel - alter - modify ' into feat / parallel - alter - modify
ClickHouse/ClickHouse
af02fe4a96dd43899ee7ac3c24a347104acb3c7c
2019-04-25T19:33:09Z
mmm a / docs / api / browser - window . md <nl> ppp b / docs / api / browser - window . md <nl> window . onbeforeunload = function ( e ) { <nl> console . log ( ' I do not want to be closed ' ) ; <nl> <nl> / / Unlike usual browsers , in which a string should be returned and the user is <nl> - / / prompted to confirm the page unload . Electron gives the power completely <nl> - / / to the developers , return empty string or false would prevent the unloading <nl> - / / now . You can also use the dialog API to let user confirm it . <nl> + / / prompted to confirm the page unload , Electron gives developers more options . <nl> + / / Returning empty string or false would prevent the unloading now . <nl> + / / You can also use the dialog API to let the user confirm closing the application . <nl> return false ; <nl> } ; <nl> ` ` ` <nl>
Try to clarify docs for window . onbeforeunload ( )
electron/electron
ab98dcd7cf30f80135f997a131c0562dbb656f08
2015-06-09T14:56:45Z
mmm a / Code / CryEngine / CryAISystem / AIActor . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIActor . cpp <nl> Cry : : AI : : CollisionAvoidance : : ETreatType CActorCollisionAvoidance : : GetTreatmentDu <nl> } <nl> else if ( ( aiType = = AIOBJECT_ALIENTICK ) | | ( aiType = = AIOBJECT_ACTOR ) | | ( aiType = = AIOBJECT_INFECTED ) ) <nl> { <nl> - const float targetCutoff = gAIEnv . CVars . CollisionAvoidanceTargetCutoffRange ; <nl> - const float pathEndCutoff = gAIEnv . CVars . CollisionAvoidancePathEndCutoffRange ; <nl> - const float smartObjectCutoff = gAIEnv . CVars . CollisionAvoidanceSmartObjectCutoffRange ; <nl> + const float targetCutoff = gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceTargetCutoffRange ; <nl> + const float pathEndCutoff = gAIEnv . CVars . collisionAvoidance . CollisionAvoidancePathEndCutoffRange ; <nl> + const float smartObjectCutoff = gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceSmartObjectCutoffRange ; <nl> <nl> const CPipeUser * pPipeUser = m_pActor - > CastToCPipeUser ( ) ; <nl> <nl> Cry : : AI : : CollisionAvoidance : : ETreatType CActorCollisionAvoidance : : GetTreatmentDu <nl> { <nl> case Cry : : AI : : CollisionAvoidance : : ETreatType : : Agent : <nl> { <nl> - const float forcedSpeed = gAIEnv . CVars . DebugCollisionAvoidanceForceSpeed ; <nl> + const float forcedSpeed = gAIEnv . CVars . collisionAvoidance . DebugCollisionAvoidanceForceSpeed ; <nl> const bool bUseForcedSpeed = fabs_tpl ( forcedSpeed ) > 0 . 0001f ; <nl> <nl> float minSpeed ; <nl> Cry : : AI : : CollisionAvoidance : : ETreatType CActorCollisionAvoidance : : GetTreatmentDu <nl> <nl> m_pActor - > GetMovementSpeedRange ( m_pActor - > m_State . fMovementUrgency , false , normalSpeed , minSpeed , maxSpeed ) ; <nl> <nl> - outAgent . radius = m_pActor - > m_Parameters . m_fPassRadius + gAIEnv . CVars . CollisionAvoidanceAgentExtraFat ; <nl> - if ( gAIEnv . CVars . CollisionAvoidanceEnableRadiusIncrement ) <nl> + outAgent . radius = m_pActor - > m_Parameters . m_fPassRadius + gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceAgentExtraFat ; <nl> + if ( gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceEnableRadiusIncrement ) <nl> outAgent . radius + = m_radiusIncrement ; <nl> outAgent . height = m_pActor - > GetBodyInfo ( ) . stanceSize . GetSize ( ) . z ; <nl> outAgent . maxSpeed = min ( m_pActor - > m_State . fDesiredSpeed , maxSpeed ) ; <nl> Cry : : AI : : CollisionAvoidance : : ETreatType CActorCollisionAvoidance : : GetTreatmentDu <nl> { <nl> outObstacle . currentLocation = m_pActor - > GetPhysicsPos ( ) ; <nl> outObstacle . currentVelocity = m_pActor - > GetVelocity ( ) ; <nl> - outObstacle . radius = m_pActor - > m_Parameters . m_fPassRadius + gAIEnv . CVars . CollisionAvoidanceAgentExtraFat ; <nl> + outObstacle . radius = m_pActor - > m_Parameters . m_fPassRadius + gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceAgentExtraFat ; <nl> outObstacle . height = m_pActor - > GetBodyInfo ( ) . stanceSize . GetSize ( ) . z ; <nl> break ; <nl> } <nl> void CActorCollisionAvoidance : : ApplyComputedVelocity ( const Vec2 & avoidanceVeloci <nl> m_pActor - > m_State . vMoveTarget . zero ( ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . CollisionAvoidanceEnableRadiusIncrement ) <nl> + if ( gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceEnableRadiusIncrement ) <nl> { <nl> if ( m_pActor - > m_State . fDesiredSpeed > 0 . 5f ) <nl> { <nl> m_radiusIncrement = min ( <nl> - m_radiusIncrement + ( m_pActor - > m_movementAbility . collisionAvoidanceRadiusIncrement * gAIEnv . CVars . CollisionAvoidanceRadiusIncrementIncreaseRate * updateTime ) , <nl> + m_radiusIncrement + ( m_pActor - > m_movementAbility . collisionAvoidanceRadiusIncrement * gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceRadiusIncrementIncreaseRate * updateTime ) , <nl> m_pActor - > m_movementAbility . collisionAvoidanceRadiusIncrement <nl> ) ; <nl> } <nl> else <nl> { <nl> m_radiusIncrement = max ( <nl> - m_radiusIncrement - ( m_pActor - > m_movementAbility . collisionAvoidanceRadiusIncrement * gAIEnv . CVars . CollisionAvoidanceRadiusIncrementDecreaseRate * updateTime ) , <nl> + m_radiusIncrement - ( m_pActor - > m_movementAbility . collisionAvoidanceRadiusIncrement * gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceRadiusIncrementDecreaseRate * updateTime ) , <nl> 0 . 0f <nl> ) ; <nl> } <nl> void CAIActor : : OnAIHandlerSentSignal ( const AISignals : : SignalSharedPtr & pSignal ) <nl> { <nl> CRY_ASSERT ( ! pSignal - > GetSignalDescription ( ) . IsNone ( ) ) ; <nl> <nl> - if ( gAIEnv . CVars . LogSignals ) <nl> + if ( gAIEnv . CVars . LegacyLogSignals ) <nl> gEnv - > pLog - > Log ( " OnAIHandlerSentSignal : ' % s ' [ % s ] . " , pSignal - > GetSignalDescription ( ) . GetName ( ) , GetName ( ) ) ; <nl> <nl> if ( IsRunningBehaviorTree ( ) ) <nl> void CAIActor : : HandleVisualStimulus ( SAIEVENT * pAIEvent ) <nl> <nl> const float fGlobalVisualPerceptionScale = gEnv - > pAISystem - > GetGlobalVisualScale ( this ) ; <nl> const float fVisualPerceptionScale = m_Parameters . m_PerceptionParams . perceptionScale . visual * fGlobalVisualPerceptionScale ; <nl> - if ( gAIEnv . CVars . IgnoreVisualStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fVisualPerceptionScale < = 0 . 0f ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreVisualStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fVisualPerceptionScale < = 0 . 0f ) <nl> return ; <nl> <nl> if ( gAIEnv . pTargetTrackManager - > IsEnabled ( ) ) <nl> void CAIActor : : HandleSoundEvent ( SAIEVENT * pAIEvent ) <nl> <nl> const float fGlobalAudioPerceptionScale = gEnv - > pAISystem - > GetGlobalAudioScale ( this ) ; <nl> const float fAudioPerceptionScale = m_Parameters . m_PerceptionParams . perceptionScale . audio * fGlobalAudioPerceptionScale ; <nl> - if ( gAIEnv . CVars . IgnoreSoundStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fAudioPerceptionScale < = 0 . 0f ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreSoundStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fAudioPerceptionScale < = 0 . 0f ) <nl> return ; <nl> <nl> if ( gAIEnv . pTargetTrackManager - > IsEnabled ( ) ) <nl> void CAIActor : : HandleBulletRain ( SAIEVENT * pAIEvent ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - if ( gAIEnv . CVars . IgnoreBulletRainStimulus | | m_Parameters . m_bAiIgnoreFgNode ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreBulletRainStimulus | | m_Parameters . m_bAiIgnoreFgNode ) <nl> return ; <nl> <nl> AISignals : : IAISignalExtraData * pData = GetAISystem ( ) - > CreateSignalExtraData ( ) ; <nl> new file mode 100644 <nl> index 0000000000 . . 9a6472b504 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / AIBubblesSystem / AIBubblesSystemConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + <nl> + # include " AIBubblesSystemConsoleVariables . h " <nl> + <nl> + # include < CryAISystem / IAIBubblesSystem . h > <nl> + <nl> + void SAIConsoleVarsLegacyBubblesSystem : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_BubblesSystemAlertnessFilter " , BubblesSystemAlertnessFilter , 7 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Specifies the type of messages you want to receive : \ n " <nl> + " 0 - none \ n " <nl> + " 1 - Only logs in the console \ n " <nl> + " 2 - Only bubbles \ n " <nl> + " 3 - Logs and bubbles \ n " <nl> + " 4 - Only blocking popups \ n " <nl> + " 5 - Blocking popups and logs \ n " <nl> + " 6 - Blocking popups and bubbles \ n " <nl> + " 7 - All notifications " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_BubblesSystemUseDepthTest " , BubblesSystemUseDepthTest , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Specifies if the BubblesSystem should use the depth test to show the messages " <nl> + " inside the 3D world . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_BubblesSystemAllowPrototypeDialogBubbles " , BubblesSystemAllowPrototypeDialogBubbles , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enabling the visualization of the bubbles created to prototype AI dialogs " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_BubblesSystemFontSize " , & BubblesSystemFontSize , 45 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , " Font size for the BubblesSystem . " ) ; <nl> + <nl> + REGISTER_CVAR2_CB ( " ai_BubblesSystemNameFilter " , & BubblesSystemNameFilter , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Filter BubblesSystem messages by name . Do not filter , if empty . " , & AIBubblesNameFilterCallback ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_BubblesSystem " , & EnableBubblesSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables / disables bubble notifier . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_BubblesSystemDecayTime " , & BubblesSystemDecayTime , 15 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Specifies the decay time for the bubbles drawn on screen . " ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyBubblesSystem : : AIBubblesNameFilterCallback ( ICVar * pCvar ) <nl> + { <nl> + if ( IAIBubblesSystem * pBubblesSystem = GetAISystem ( ) - > GetAIBubblesSystem ( ) ) <nl> + { <nl> + pBubblesSystem - > SetNameFilter ( pCvar - > GetString ( ) ) ; <nl> + } <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 2e381ba321 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / AIBubblesSystem / AIBubblesSystemConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyBubblesSystem <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( BubblesSystemAlertnessFilter , 7 ) ; <nl> + DeclareConstIntCVar ( BubblesSystemUseDepthTest , 0 ) ; <nl> + DeclareConstIntCVar ( BubblesSystemAllowPrototypeDialogBubbles , 0 ) ; <nl> + <nl> + int EnableBubblesSystem ; <nl> + float BubblesSystemFontSize ; <nl> + float BubblesSystemDecayTime ; <nl> + const char * BubblesSystemNameFilter ; <nl> + <nl> + static void AIBubblesNameFilterCallback ( ICVar * pCvar ) ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / AIBubblesSystem / AIBubblesSystemImpl . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIBubblesSystem / AIBubblesSystemImpl . cpp <nl> bool AIQueueBubbleMessage ( const char * messageName , const EntityId entityID , <nl> <nl> void CAIBubblesSystem : : Init ( ) <nl> { <nl> - SetNameFilter ( gAIEnv . CVars . BubblesSystemNameFilter ) ; <nl> + SetNameFilter ( gAIEnv . CVars . legacyBubblesSystem . BubblesSystemNameFilter ) ; <nl> } <nl> <nl> void CAIBubblesSystem : : Reset ( ) <nl> class CAIBubblesSystem : : CBubbleRender <nl> m_bubbleOnscreenPos = Vec3 ( x , y , z ) ; <nl> <nl> const float distance = gEnv - > pSystem - > GetViewCamera ( ) . GetPosition ( ) . GetDistance ( entityPos ) ; <nl> - m_currentTextSize = gAIEnv . CVars . BubblesSystemFontSize / distance ; <nl> + m_currentTextSize = gAIEnv . CVars . legacyBubblesSystem . BubblesSystemFontSize / distance ; <nl> } <nl> } <nl> } <nl> class CAIBubblesSystem : : CBubbleRender <nl> } <nl> else <nl> { <nl> - bUseDepthTest = ( ( gAIEnv . CVars . BubblesSystemUseDepthTest ) ! = 0 ) ; <nl> + bUseDepthTest = ( ( gAIEnv . CVars . legacyBubblesSystem . BubblesSystemUseDepthTest ) ! = 0 ) ; <nl> } <nl> <nl> DrawBubbleMessage ( message , drawingPosition , bFramed , bUseDepthTest ) ; <nl> bool CAIBubblesSystem : : DisplaySpeechBubble ( SAIBubbleRequestContainer & requestCon <nl> <nl> const TBubbleRequestOptionFlags requestFlags = request . GetFlags ( ) ; <nl> <nl> - if ( requestFlags & eBNS_Balloon & & gAIEnv . CVars . BubblesSystemAlertnessFilter & eBNS_Balloon ) <nl> + if ( requestFlags & eBNS_Balloon & & gAIEnv . CVars . legacyBubblesSystem . BubblesSystemAlertnessFilter & eBNS_Balloon ) <nl> { <nl> if ( ! bubbleRender . Prepare ( ) ) <nl> { <nl> bool CAIBubblesSystem : : DisplaySpeechBubble ( SAIBubbleRequestContainer & requestCon <nl> <nl> void CAIBubblesSystem : : LogMessage ( const char * const message , const TBubbleRequestOptionFlags flags ) const <nl> { <nl> - if ( gAIEnv . CVars . BubblesSystemAlertnessFilter & eBNS_Log ) <nl> + if ( gAIEnv . CVars . legacyBubblesSystem . BubblesSystemAlertnessFilter & eBNS_Log ) <nl> { <nl> if ( flags & eBNS_LogWarning ) <nl> { <nl> void CAIBubblesSystem : : PopupBlockingAlert ( const char * const message , const TBubb <nl> return ; <nl> } <nl> <nl> - if ( flags & eBNS_BlockingPopup & & gAIEnv . CVars . BubblesSystemAlertnessFilter & eBNS_BlockingPopup ) <nl> + if ( flags & eBNS_BlockingPopup & & gAIEnv . CVars . legacyBubblesSystem . BubblesSystemAlertnessFilter & eBNS_BlockingPopup ) <nl> { <nl> CryMessageBox ( message , " AIBubbleSystemMessageBox " ) ; <nl> } <nl> void CAIBubblesSystem : : PopupBlockingAlert ( const char * const message , const TBubb <nl> <nl> bool CAIBubblesSystem : : ShouldSuppressMessageVisibility ( const SAIBubbleRequest : : ERequestType requestType ) const <nl> { <nl> - if ( gAIEnv . CVars . EnableBubblesSystem ! = 1 ) <nl> + if ( gAIEnv . CVars . legacyBubblesSystem . EnableBubblesSystem ! = 1 ) <nl> { <nl> return true ; <nl> } <nl> bool CAIBubblesSystem : : ShouldSuppressMessageVisibility ( const SAIBubbleRequest : : E <nl> case SAIBubbleRequest : : eRT_ErrorMessage : <nl> return gAIEnv . CVars . DebugDraw < 1 ; <nl> case SAIBubbleRequest : : eRT_PrototypeDialog : <nl> - return gAIEnv . CVars . BubblesSystemAllowPrototypeDialogBubbles ! = 1 ; <nl> + return gAIEnv . CVars . legacyBubblesSystem . BubblesSystemAllowPrototypeDialogBubbles ! = 1 ; <nl> default : <nl> assert ( 0 ) ; <nl> return gAIEnv . CVars . DebugDraw > 0 ; <nl> mmm a / Code / CryEngine / CryAISystem / AIBubblesSystem / AIBubblesSystemImpl . h <nl> ppp b / Code / CryEngine / CryAISystem / AIBubblesSystem / AIBubblesSystemImpl . h <nl> class CAIBubblesSystem : public IAIBubblesSystem <nl> private : <nl> void UpdateDuration ( const float duration ) <nl> { <nl> - expiringTime = GetAISystem ( ) - > GetFrameStartTime ( ) + ( duration ? CTimeValue ( duration ) : CTimeValue ( gAIEnv . CVars . BubblesSystemDecayTime ) ) ; <nl> + expiringTime = GetAISystem ( ) - > GetFrameStartTime ( ) + ( duration ? CTimeValue ( duration ) : CTimeValue ( gAIEnv . CVars . legacyBubblesSystem . BubblesSystemDecayTime ) ) ; <nl> } <nl> <nl> uint32 messageNameId ; <nl> mmm a / Code / CryEngine / CryAISystem / AIConsoleVariables . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIConsoleVariables . cpp <nl> <nl> <nl> # include " StdAfx . h " <nl> # include " AIConsoleVariables . h " <nl> - # include " Communication / CommunicationManager . h " <nl> - # include " Communication / CommunicationTestManager . h " <nl> - # include " Navigation / NavigationSystem / NavigationSystem . h " <nl> # include " BehaviorTree / BehaviorTreeManager . h " <nl> - # include < CryAISystem / IAIBubblesSystem . h > <nl> - <nl> - void AIConsoleVars : : Init ( ) <nl> - { <nl> - AILogProgress ( " [ AISYSTEM ] Initialization : Creating console vars " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CompatibilityMode " , & CompatibilityMode , " " , VF_NULL , <nl> - " Set AI features to behave in earlier milestones - please use sparingly " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_Locate " , & DrawLocate , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Indicates position and some base states of specified objects . \ n " <nl> - " It will pinpoint position of the agents ; it ' s name ; it ' s attention target ; \ n " <nl> - " draw red cone if the agent is allowed to fire ; draw purple cone if agent is pressing trigger . \ n " <nl> - " none - off \ n " <nl> - " squad - squadmates \ n " <nl> - " enemy - all the enemies \ n " <nl> - " groupID - members of specified group " ) ; <nl> - REGISTER_CVAR2 ( " ai_DrawPath " , & DrawPath , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the generated paths of the AI agents . ai_drawoffset is used . \ n " <nl> - " Usage : ai_DrawPath [ name ] \ n " <nl> - " none - off ( default ) \ n " <nl> - " squad - squadmates \ n " <nl> - " enemy - all the enemies " ) ; <nl> - REGISTER_CVAR2 ( " ai_DrawPathAdjustment " , & DrawPathAdjustment , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the path adjustment for the AI agents . \ n " <nl> - " Usage : ai_DrawPathAdjustment [ name ] \ n " <nl> - " Default is none ( nobody ) . " ) ; <nl> - REGISTER_CVAR2 ( " ai_DrawRefPoints " , & DrawRefPoints , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles reference points and beacon view for debugging AI . \ n " <nl> - " Usage : ai_DrawRefPoints \ " all \ " , agent name , group id \ n " <nl> - " Default is the empty string ( off ) . Indicates the AI reference points by drawing \ n " <nl> - " balls at their positions . " ) ; <nl> - REGISTER_CVAR2 ( " ai_StatsTarget " , & StatsTarget , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Focus debugging information on a specific AI \ n " <nl> - " Display current goal pipe , current goal , subpipes and agentstats information for the selected AI agent . \ n " <nl> - " Long green line will represent the AI forward direction ( game forward ) . \ n " <nl> - " Long red / blue ( if AI firing on / off ) line will represent the AI view direction . \ n " <nl> - " Usage : ai_StatsTarget AIName \ n " <nl> - " Default is ' none ' . AIName is the name of the AI \ n " <nl> - " on which to focus . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawPhysicsAccess " , DebugDrawPhysicsAccess , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays current physics access statistics for the AI module . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_RayCasterQuota " , RayCasterQuota , 12 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Amount of deferred rays allowed to be cast per frame ! " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_IntersectionTesterQuota " , IntersectionTesterQuota , 12 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Amount of deferred intersection tests allowed to be cast per frame ! " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawShooting " , & DrawShooting , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Name of puppet to show fire stats " ) ; <nl> - REGISTER_CVAR2 ( " ai_DrawAgentStats " , & DrawAgentStats , " NkcBbtGgSfdDL " , VF_NULL , <nl> - " Flag field specifying which of the overhead agent stats to display : \ n " <nl> - " N - name \ n " <nl> - " k - groupID \ n " <nl> - " d - distances \ n " <nl> - " c - cover info \ n " <nl> - " B - currently selected behavior node \ n " <nl> - " b - current behavior \ n " <nl> - " t - target info \ n " <nl> - " G - goal pipe \ n " <nl> - " g - goal op \ n " <nl> - " S - stance \ n " <nl> - " f - fire \ n " <nl> - " w - territory / wave \ n " <nl> - " p - pathfinding status \ n " <nl> - " l - light level ( perception ) status \ n " <nl> - " D - various direction arrows ( aim target , move target , . . . ) status \ n " <nl> - " L - personal log \ n " <nl> - " a - alertness \ n " <nl> - " \ n " <nl> - " Default is NkcBbtGgSfdDL " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawAgentStatsGroupFilter " , & DrawAgentStatsGroupFilter , " " , VF_NULL , <nl> - " Filters Debug Draw Agent Stats displays to the specified groupIDs separated by spaces \ n " <nl> - " usage : ai_DrawAgentStatsGroupFilter 1011 1012 " ) ; <nl> - REGISTER_CVAR2 ( " ai_DrawPerceptionHandlerModifiers " , & DrawPerceptionHandlerModifiers , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws perception handler modifiers on a specific AI \ n " <nl> - " Usage : ai_DrawPerceptionHandlerModifiers AIName \ n " <nl> - " Default is ' none ' . AIName is the name of the AI " ) ; <nl> - REGISTER_CVAR2 ( " ai_ForceAGAction " , & ForceAGAction , " 0 " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Forces all AI characters to specified AG action input . 0 to disable . \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_ForceAGSignal " , & ForceAGSignal , " 0 " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Forces all AI characters to specified AG signal input . 0 to disable . \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_ForcePosture " , & ForcePosture , " 0 " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Forces all AI characters to specified posture . 0 to disable . \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_ForceLookAimTarget " , & ForceLookAimTarget , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Forces all AI characters to use / not use a fixed look / aim target \ n " <nl> - " none disables \ n " <nl> - " x , y , xz or yz sets it to the appropriate direction \ n " <nl> - " otherwise it forces looking / aiming at the entity with this name ( no name - > ( 0 , 0 , 0 ) ) " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_TacticalPointUpdateTime " , & TacticalPointUpdateTime , 0 . 0005f , VF_NULL , <nl> - " Maximum allowed update time in main AI thread for Tactical Point System \ n " <nl> - " Usage : ai_TacticalPointUpdateTime < number > \ n " <nl> - " Default is 0 . 0003 " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_UpdateAllAlways " , UpdateAllAlways , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " If non - zero then over - rides the auto - disabling of invisible / distant AI " ) ; <nl> - <nl> - / / is not cheat protected because it changes during game , depending on your settings <nl> - REGISTER_CVAR2 ( " ai_UpdateInterval " , & AIUpdateInterval , 0 . 13f , VF_NULL , <nl> - " In seconds the amount of time between two full updates for AI \ n " <nl> - " Usage : ai_UpdateInterval < number > \ n " <nl> - " Default is 0 . 1 . Number is time in seconds " ) ; <nl> - DefineConstIntCVarName ( " ai_AdjustPathsAroundDynamicObstacles " , AdjustPathsAroundDynamicObstacles , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Set to 1 / 0 to enable / disable AI path adjustment around dynamic obstacles " ) ; <nl> - / / is not cheat protected because it changes during game , depending on your settings <nl> - DefineConstIntCVarName ( " ai_EnableORCA " , EnableORCA , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable obstacle avoidance system . " ) ; <nl> - DefineConstIntCVarName ( " ai_CollisionAvoidanceUpdateVelocities " , CollisionAvoidanceUpdateVelocities , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable / disable agents updating their velocities after processing collision avoidance . " ) ; <nl> - DefineConstIntCVarName ( " ai_CollisionAvoidanceEnableRadiusIncrement " , CollisionAvoidanceEnableRadiusIncrement , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable / disable agents adding an increment to their collision avoidance radius when moving . " ) ; <nl> - DefineConstIntCVarName ( " ai_CollisionAvoidanceClampVelocitiesWithNavigationMesh " , CollisionAvoidanceClampVelocitiesWithNavigationMesh , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable / Disable the clamping of the speed resulting from ORCA with the navigation mesh " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCollisionAvoidance " , DebugDrawCollisionAvoidance , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable debugging obstacle avoidance system . " ) ; <nl> - / / Bubble System cvars <nl> - REGISTER_CVAR2 ( " ai_BubblesSystem " , & EnableBubblesSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables / disables bubble notifier . " ) ; <nl> - REGISTER_CVAR2 ( " ai_BubblesSystemDecayTime " , & BubblesSystemDecayTime , 15 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Specifies the decay time for the bubbles drawn on screen . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_BubblesSystemAlertnessFilter " , BubblesSystemAlertnessFilter , 7 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Specifies the type of messages you want to receive : \ n " <nl> - " 0 - none \ n " <nl> - " 1 - Only logs in the console \ n " <nl> - " 2 - Only bubbles \ n " <nl> - " 3 - Logs and bubbles \ n " <nl> - " 4 - Only blocking popups \ n " <nl> - " 5 - Blocking popups and logs \ n " <nl> - " 6 - Blocking popups and bubbles \ n " <nl> - " 7 - All notifications " ) ; <nl> - DefineConstIntCVarName ( " ai_BubblesSystemUseDepthTest " , BubblesSystemUseDepthTest , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Specifies if the BubblesSystem should use the depth test to show the messages " <nl> - " inside the 3D world . " ) ; <nl> - DefineConstIntCVarName ( " ai_BubblesSystemAllowPrototypeDialogBubbles " , BubblesSystemAllowPrototypeDialogBubbles , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enabling the visualization of the bubbles created to prototype AI dialogs " ) ; <nl> - REGISTER_CVAR2 ( " ai_BubblesSystemFontSize " , & BubblesSystemFontSize , 45 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , " Font size for the BubblesSystem . " ) ; <nl> - REGISTER_CVAR2_CB ( " ai_BubblesSystemNameFilter " , & BubblesSystemNameFilter , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Filter BubblesSystem messages by name . Do not filter , if empty . " , & AIBubblesNameFilterCallback ) ; <nl> - / / Bubble System cvars <nl> - <nl> - / / Pathfinding dangers <nl> - DefineConstIntCVarName ( " ai_PathfinderDangerCostForAttentionTarget " , PathfinderDangerCostForAttentionTarget , 5 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Cost used in the heuristic calculation for the danger created by the attention target position . " ) ; <nl> - DefineConstIntCVarName ( " ai_PathfinderDangerCostForExplosives " , PathfinderDangerCostForExplosives , 2 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Cost used in the heuristic calculation for the danger created by the position of explosive objects . " ) ; <nl> - DefineConstIntCVarName ( " ai_PathfinderAvoidanceCostForGroupMates " , PathfinderAvoidanceCostForGroupMates , 2 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Cost used in the heuristic calculation for the avoidance of the group mates ' s positions . " ) ; <nl> - REGISTER_CVAR2 ( " ai_PathfinderExplosiveDangerRadius " , & PathfinderExplosiveDangerRadius , 5 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Range used to evaluate the explosive threats in the path calculation . Outside this range a location is considered safe . " ) ; <nl> - REGISTER_CVAR2 ( " ai_PathfinderExplosiveDangerMaxThreatDistance " , & PathfinderExplosiveDangerMaxThreatDistance , 50 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Range used to decide if evaluate an explosive danger as an actual threat . " ) ; <nl> - REGISTER_CVAR2 ( " ai_PathfinderGroupMatesAvoidanceRadius " , & PathfinderGroupMatesAvoidanceRadius , 4 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Range used to evaluate the group mates avoidance in the path calculation . " ) ; <nl> - <nl> - / / Pathfinding dangers <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugMovementSystem " , DebugMovementSystem , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draw debug information to the screen regarding character movement . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugMovementSystemActorRequests " , DebugMovementSystemActorRequests , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draw queued movement requests of actors in the world as text above their head . \ n " <nl> - " 0 - Off \ n " <nl> - " 1 - Draw request queue of only the currently selected agent \ n " <nl> - " 2 - Draw request queue of all agents " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_OutputPersonalLogToConsole " , OutputPersonalLogToConsole , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Output the personal log messages to the console . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DrawModularBehaviorTreeStatistics " , DrawModularBehaviorTreeStatistics , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draw modular behavior statistics to the screen . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_MNMPathfinderPositionInTrianglePredictionType " , MNMPathfinderPositionInTrianglePredictionType , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Defines which type of prediction for the point inside each triangle used by the pathfinder heuristic to search for the " <nl> - " path with minimal cost . \ n " <nl> - " 0 - Triangle center . \ n " <nl> - " 1 - Advanced prediction . \ n " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_MovementSystemPathReplanningEnabled " , & MovementSystemPathReplanningEnabled , 0 , VF_NULL , <nl> - " Enable / disable path - replanning of moving actors in the MovementSystem every time \ n " <nl> - " a navigation - mesh change at runtime affects their current path . \ n " <nl> - " Ignores designer - placed paths . \ n " <nl> - " 0 - disabled ( default ) \ n " <nl> - " 1 - enabled " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceRange " , & CollisionAvoidanceRange , 10 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Range for collision avoidance . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceTargetCutoffRange " , & CollisionAvoidanceTargetCutoffRange , 3 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Distance from it ' s current target for an agent to stop avoiding obstacles . Other actors will still avoid the agent . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidancePathEndCutoffRange " , & CollisionAvoidancePathEndCutoffRange , 0 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Distance from it ' s current path end for an agent to stop avoiding obstacles . Other actors will still avoid the agent . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceSmartObjectCutoffRange " , & CollisionAvoidanceSmartObjectCutoffRange , 1 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Distance from it ' s next smart object for an agent to stop avoiding obstacles . Other actors will still avoid the agent . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceAgentExtraFat " , & CollisionAvoidanceAgentExtraFat , 0 . 025f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Extra radius to use in Collision Avoidance calculations as a buffer . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceRadiusIncrementIncreaseRate " , & CollisionAvoidanceRadiusIncrementIncreaseRate , 0 . 25f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Increase rate of the collision avoidance radius increment . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceRadiusIncrementDecreaseRate " , & CollisionAvoidanceRadiusIncrementDecreaseRate , 2 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Decrease rate of the collision avoidance radius increment . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceTimestep " , & CollisionAvoidanceTimeStep , 0 . 1f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " TimeStep used to calculate an agent ' s collision free velocity . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceMinSpeed " , & CollisionAvoidanceMinSpeed , 0 . 2f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Minimum speed allowed to be used by ORCA . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceAgentTimeHorizon " , & CollisionAvoidanceAgentTimeHorizon , 2 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Time horizon used to calculate an agent ' s collision free velocity against other agents . " ) ; <nl> - REGISTER_CVAR2 ( " ai_CollisionAvoidanceObstacleTimeHorizon " , & CollisionAvoidanceObstacleTimeHorizon , 1 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Time horizon used to calculate an agent ' s collision free velocity against static obstacles . " ) ; <nl> - REGISTER_CVAR2 ( " ai_DebugCollisionAvoidanceForceSpeed " , & DebugCollisionAvoidanceForceSpeed , 0 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Force agents velocity to it ' s current direction times the specified value . " ) ; <nl> - REGISTER_CVAR2 ( " ai_DebugDrawCollisionAvoidanceAgentName " , & DebugDrawCollisionAvoidanceAgentName , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Name of the agent to draw collision avoidance data for . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_SightRangeSuperDarkIllumMod " , & SightRangeSuperDarkIllumMod , 0 . 25f , VF_NULL , <nl> - " Multiplier for sightrange when the target is in super dark light condition . " ) ; <nl> - REGISTER_CVAR2 ( " ai_SightRangeDarkIllumMod " , & SightRangeDarkIllumMod , 0 . 5f , VF_NULL , <nl> - " Multiplier for sightrange when the target is in dark light condition . " ) ; <nl> - REGISTER_CVAR2 ( " ai_SightRangeMediumIllumMod " , & SightRangeMediumIllumMod , 0 . 8f , VF_NULL , <nl> - " Multiplier for sightrange when the target is in medium light condition . " ) ; <nl> - REGISTER_CVAR2 ( " ai_PathfindTimeLimit " , & AllowedTimeForPathfinding , 0 . 08f , VF_NULL , <nl> - " Specifies how many seconds an individual AI can hold the pathfinder blocked \ n " <nl> - " Usage : ai_PathfindTimeLimit 0 . 15 \ n " <nl> - " Default is 0 . 08 . A lower value will result in more path requests that end in NOPATH - \ n " <nl> - " although the path may actually exist . " ) ; <nl> - REGISTER_CVAR2 ( " ai_DrawAgentFOV " , & DrawAgentFOV , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles the vision cone of the AI agent . \ n " <nl> - " Usage : ai_DrawagentFOV [ 0 . . 1 ] \ n " <nl> - " Default is 0 ( off ) , value 1 will draw the cone all the way to \ n " <nl> - " the sight range , value 0 . 1 will draw the cone to distance of 10 % \ n " <nl> - " of the sight range , etc . ai_DebugDraw must be enabled before \ n " <nl> - " this tool can be used . " ) ; <nl> - REGISTER_CVAR2 ( " ai_FilterAgentName " , & FilterAgentName , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Only draws the AI info of the agent with the given name . \ n " <nl> - " Usage : ai_FilterAgentName name \ n " <nl> - " Default is none ( draws all of them if ai_debugdraw is on ) \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_AgentStatsDist " , & AgentStatsDist , 150 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Sets agent statistics draw distance , such as current goalpipe , command and target . \ n " <nl> - " Only information on enabled AI objects will be displayed . \ n " <nl> - " To display more information on particular AI agent , use ai_StatsTarget . \ n " <nl> - " Yellow line represents direction where AI is trying to move ; \ n " <nl> - " Red line represents direction where AI is trying to look ; \ n " <nl> - " Blue line represents forward dir ( entity forward ) ; \ n " <nl> - " Usage : ai_AgentStatsDist [ view distance ] \ n " <nl> - " Default is 20 meters . Works with ai_DebugDraw enabled . " ) ; <nl> - REGISTER_CVAR2 ( " ai_DebugDrawArrowLabelsVisibilityDistance " , & DebugDrawArrowLabelsVisibilityDistance , 50 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Provided ai_DebugDraw > 0 , if the camera is closer to an agent than this distance , \ n " <nl> - " agent arrows for look / fire / move arrows will have labels . \ n " <nl> - " Usage : ai_DebugDrawArrowLabelsVisibilityDistance [ distance ] \ n " <nl> - " Default is 50 . \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDraw " , DebugDraw , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles the AI debugging view . \ n " <nl> - " Usage : ai_DebugDraw [ - 1 / 0 / 1 ] \ n " <nl> - " Default is 0 ( minimal ) , value - 1 will draw nothing , value 1 displays AI rays and targets \ n " <nl> - " and enables the view for other AI debugging tools . " ) ; <nl> - DefineConstIntCVarName ( " ai_NetworkDebug " , NetworkDebug , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles the AI network debug . \ n " <nl> - " Usage : ai_NetworkDebug [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) . ai_NetworkDebug is used to direct DebugDraw information \ n " <nl> - " from the server to the client . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawVegetationCollisionDist " , DebugDrawVegetationCollisionDist , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables drawing vegetation collision closer than a distance projected onto the terrain . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugPathfinding " , DebugPathFinding , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles output of pathfinding information [ default 0 is off ] " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawBannedNavsos " , DebugDrawBannedNavsos , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles drawing banned navsos [ default 0 is off ] " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawGroups " , DebugDrawGroups , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles the AI Groups debugging view . \ n " <nl> - " Usage : ai_DebugDrawGroups [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) . ai_DebugDrawGroups displays groups ' leaders , members and their desired positions . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCoolMisses " , DebugDrawCoolMisses , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles displaying the cool miss locations around the player . \ n " <nl> - " Usage : ai_DebugDrawCoolMisses [ 0 / 1 ] " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawFireCommand " , DebugDrawFireCommand , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles displaying the fire command targets and modifications . \ n " <nl> - " Usage : ai_DebugDrawFireCommand [ 0 / 1 ] " ) ; <nl> - DefineConstIntCVarName ( " ai_CoverSystem " , CoverSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables the cover system . \ n " <nl> - " Usage : ai_CoverSystem [ 0 / 1 ] \ n " <nl> - " Default is 1 ( on ) \ n " <nl> - " 0 - off - use anchors \ n " <nl> - " 1 - use offline cover surfaces \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_CoverPredictTarget " , & CoverPredictTarget , 1 . 0f , VF_NULL , <nl> - " Enables simple cover system target location prediction . \ n " <nl> - " Usage : ai_CoverPredictTarget x \ n " <nl> - " Default x is 0 . 0 ( off ) \ n " <nl> - " x - how many seconds to look ahead \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_CoverSpacing " , & CoverSpacing , 0 . 5f , VF_NULL , <nl> - " Minimum spacing between agents when choosing cover . \ n " <nl> - " Usage : ai_CoverPredictTarget < x > \ n " <nl> - " x - Spacing width in meters \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_CoverExactPositioning " , CoverExactPositioning , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables using exact positioning for arriving at cover . \ n " <nl> - " Usage : ai_CoverPredictTarget [ 0 / 1 ] \ n " <nl> - " Default x is 0 ( off ) \ n " <nl> - " 0 - disable \ n " <nl> - " 1 - enable \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCover " , DebugDrawCover , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays cover debug information . \ n " <nl> - " Usage : ai_DebugDrawCover [ 0 / 1 / 2 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - currently being used \ n " <nl> - " 2 - all in 50m range ( slow ) \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCoverOccupancy " , DebugDrawCoverOccupancy , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Renders red balls at the location of occupied cover . \ n " <nl> - " Usage : ai_DebugDrawCoverOccupancy [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - render red balls at the location of occupied cover \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawNavigation " , DebugDrawNavigation , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays the navigation debug information . \ n " <nl> - " Usage : ai_DebugDrawNavigation [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - triangles and contour \ n " <nl> - " 2 - triangles , mesh and contours \ n " <nl> - " 3 - triangles , mesh contours and external links \ n " <nl> - " 4 - triangles , mesh contours , external links and triangle IDs \ n " <nl> - " 5 - triangles , mesh contours , external links and island IDs \ n " <nl> - " 6 - triangles with backfaces , mesh contours and external links \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawNavigationQueriesUDR " , DebugDrawNavigationQueriesUDR , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays the navigation queries debug information using UDR . \ n " <nl> - " Requires ai_debugDraw , ai_debugDrawNavigation and ai_storeNavigationQueriesHistory to be enabled . \ n " <nl> - " Usage : ai_DebugDrawNavigationQueriesUDR [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - Displays the query config , triangles by batches and invalidations \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawNavigationQueriesList " , DebugDrawNavigationQueriesList , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays a navigation queries list in the screen with all batches and elapsed times . \ n " <nl> - " Requires ai_debugDraw , ai_debugDrawNavigation and ai_storeNavigationQueriesHistory to be enabled . \ n " <nl> - " Note that , by their nature , instant queries won ' t be listed here . \ n " <nl> - " Usage : ai_DebugDrawNavigationQueriesList [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - on \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_MNMDebugTriangleOnCursor " , DebugTriangleOnCursor , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays the basic information about the MNM Triangle where the cursor is pointing . \ n " <nl> - " Usage : ai_MNMDebugTriangleOnCursor [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - show triangle information \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_NavigationSystemMT " , NavigationSystemMT , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables navigation information updates on a separate thread . \ n " <nl> - " Usage : ai_NavigationSystemMT [ 0 / 1 ] \ n " <nl> - " Default is 1 ( on ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - on \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_StoreNavigationQueriesHistory " , StoreNavigationQueriesHistory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables the storage of navigation queries in a history . History can be displayed enabling the cvar ai_DebugDrawNavigationQueries . \ n " <nl> - " Requires ai_debugDraw and ai_debugDrawNavigation to be enabled . \ n " <nl> - " Usage : ai_StoreNavigationQueriesHistory [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - on \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_NavGenThreadJobs " , NavGenThreadJobs , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Number of tile generation jobs per thread per frame . \ n " <nl> - " Usage : ai_NavGenThreadJobs [ 1 + ] \ n " <nl> - " Default is 1 . The more you have , the faster it will go but the frame rate will drop while it works . \ n " <nl> - " Recommendations : \ n " <nl> - " Fast machine [ 10 ] \ n " <nl> - " Slow machine [ 4 ] \ n " <nl> - " Smooth [ 1 ] \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_MNMDebugDrawFlag " , & MNMDebugDrawFlag , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Color the MNM triangles is overriden by the specified annotation flag color . \ n " <nl> - " Usage : ai_MNMDebugDrawFlag ' flagName ' \ n " <nl> - " Default is ' empty ' \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_NavmeshTileDistanceDraw " , & NavmeshTileDistanceDraw , 200 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Maximum distance from the camera for tile to be drawn . \ n " <nl> - " Usage : ai_NavmeshTileDistanceDraw [ 0 . 0 - . . . ] \ n " <nl> - " Default is 200 . 0 \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_NavmeshStabilizationTimeToUpdate " , & NavmeshStabilizationTimeToUpdate , 0 . 3f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Time that navmesh needs to be without any new updates to apply the latest changes . \ n " <nl> - " Usage : ai_NavmeshStabilizationTimeToUpdate [ 0 . 0 - . . . ] \ n " <nl> - " Default is 0 . 3 \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawNavigationWorldMonitor " , DebugDrawNavigationWorldMonitor , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables displaying bounding boxes for world changes . \ n " <nl> - " Usage : ai_DebugDrawNavigationWorldMonitor [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - on \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawSignalsHistory " , DebugDrawSignalsHistory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays a history of the 20 most recent signals sent by AI . \ n " <nl> - " Most recent signals are displayed at the top of the list . As time passes , old signals will turn gray . \ n " <nl> - " Usage : ai_DebugDrawSignalsList [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - on \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCoverPlanes " , DebugDrawCoverPlanes , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays cover planes . \ n " <nl> - " Usage : ai_DebugDrawCoverPlanes [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCoverLocations " , DebugDrawCoverLocations , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays cover locations . \ n " <nl> - " Usage : ai_DebugDrawCoverLocations [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCoverSampler " , DebugDrawCoverSampler , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays cover sampler debug rendering . \ n " <nl> - " Usage : ai_DebugDrawCoverSampler [ 0 / 1 / 2 / 3 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - display floor sampling \ n " <nl> - " 2 - display surface sampling \ n " <nl> - " 3 - display both \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawDynamicCoverSampler " , DebugDrawDynamicCoverSampler , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays dynamic cover sampler debug rendering . \ n " <nl> - " Usage : ai_DebugDrawDynamicCoverSampler [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) \ n " <nl> - " 0 - off \ n " <nl> - " 1 - on \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCommunication " , DebugDrawCommunication , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays communication debug information . \ n " <nl> - " Usage : ai_DebugDrawCommunication [ 0 / 1 / 2 ] \ n " <nl> - " 0 - disabled . ( default ) . \ n " <nl> - " 1 - draw playing and queued comms . \ n " <nl> - " 2 - draw debug history for each entity . \ n " <nl> - " 5 - extended debugging ( to log ) " <nl> - " 6 - outputs info about each line played " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCommunicationHistoryDepth " , DebugDrawCommunicationHistoryDepth , 5 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Tweaks how many historical entries are displayed per entity . \ n " <nl> - " Usage : ai_DebugDrawCommunicationHistoryDepth [ depth ] " ) ; <nl> - DefineConstIntCVarName ( " ai_RecordCommunicationStats " , RecordCommunicationStats , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Turns on / off recording of communication stats to a log . \ n " <nl> - " Usage : ai_RecordCommunicationStats [ 0 / 1 ] \ n " <nl> - ) ; <nl> - REGISTER_CVAR2 ( " ai_CommunicationManagerHeighThresholdForTargetPosition " , & CommunicationManagerHeightThresholdForTargetPosition , 5 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Defines the threshold used to detect if the target is above or below the entity that wants to play a communication . \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_CommunicationForceTestVoicePack " , CommunicationForceTestVoicePack , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Forces all the AI agents to use a test voice pack . The test voice pack will have the specified name in the archetype " <nl> - " or in the entity and the system will replace the _XX number with the _test string " ) ; <nl> - REGISTER_CVAR2 ( " ai_SystemUpdate " , & AiSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles the regular AI system update . \ n " <nl> - " Usage : ai_SystemUpdate [ 0 / 1 ] \ n " <nl> - " Default is 1 ( on ) . Set to 0 to disable ai system updating . " ) ; <nl> - DefineConstIntCVarName ( " ai_IgnorePlayer " , IgnorePlayer , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Makes AI ignore the player . \ n " <nl> - " Usage : ai_IgnorePlayer [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) . Set to 1 to make AI ignore the player . \ n " <nl> - " Used with ai_DebugDraw enabled . " ) ; <nl> - DefineConstIntCVarName ( " ai_IgnoreVisibilityChecks " , IgnoreVisibilityChecks , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Makes certain visibility checks ( for teleporting etc ) return false . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawFormations " , DrawFormations , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws all the currently active formations of the AI agents . \ n " <nl> - " Usage : ai_DrawFormations [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) . Set to 1 to draw the AI formations . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawSmartObjects " , DrawSmartObjects , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws smart object debug information . \ n " <nl> - " Usage : ai_DrawSmartObjects [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) . Set to 1 to draw the smart objects . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawGoals " , DrawGoals , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws all the active goal ops debug info . \ n " <nl> - " Usage : ai_DrawGoals [ 0 / 1 ] \ n " <nl> - " Default is 0 ( off ) . Set to 1 to draw the AI goal op debug info . " ) ; <nl> - DefineConstIntCVarName ( " ai_BeautifyPath " , BeautifyPath , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles AI optimisation of the generated path . \ n " <nl> - " Usage : ai_BeautifyPath [ 0 / 1 ] \ n " <nl> - " Default is 1 ( on ) . Optimisation is on by default . Set to 0 to \ n " <nl> - " disable path optimisation ( AI uses non - optimised path ) . " ) ; <nl> - DefineConstIntCVarName ( " ai_PathStringPullingIterations " , PathStringPullingIterations , 5 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Defines the number of iteration used for the string pulling operation to simplify the path " ) ; <nl> - DefineConstIntCVarName ( " ai_AttemptStraightPath " , AttemptStraightPath , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles AI attempting a simple straight path when possible . \ n " <nl> - " Default is 1 ( on ) . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawCrowdControl " , DebugDrawCrowdControl , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws crowd control debug information . 0 = off , 1 = on " ) ; <nl> - DefineConstIntCVarName ( " ai_PredictivePathFollowing " , PredictivePathFollowing , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Sets if AI should use the predictive path following if allowed by the type ' s config . " ) ; <nl> - REGISTER_CVAR2 ( " ai_SteepSlopeUpValue " , & SteepSlopeUpValue , 1 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Indicates slope value that is borderline - walkable up . \ n " <nl> - " Usage : ai_SteepSlopeUpValue 0 . 5 \ n " <nl> - " Default is 1 . 0 Zero means flat . Infinity means vertical . Set it smaller than ai_SteepSlopeAcrossValue " ) ; <nl> - REGISTER_CVAR2 ( " ai_SteepSlopeAcrossValue " , & SteepSlopeAcrossValue , 0 . 6f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Indicates slope value that is borderline - walkable across . \ n " <nl> - " Usage : ai_SteepSlopeAcrossValue 0 . 8 \ n " <nl> - " Default is 0 . 6 Zero means flat . Infinity means vertical . Set it greater than ai_SteepSlopeUpValue " ) ; <nl> - DefineConstIntCVarName ( " ai_UpdateProxy " , UpdateProxy , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles update of AI proxy ( model ) . \ n " <nl> - " Usage : ai_UpdateProxy [ 0 / 1 ] \ n " <nl> - " Default is 1 ( on ) . Updates proxy ( AI representation in game ) \ n " <nl> - " set to 0 to disable proxy updating . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawType " , DrawType , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Display all AI object of specified type . If object is enabled it will be displayed . \ n " <nl> - " with blue ball , otherwise with red ball . Yellow line will represent forward direction of the object . \ n " <nl> - " < 0 - off \ n " <nl> - " 0 - display all the dummy objects \ n " <nl> - " > 0 - type of AI objects to display " ) ; <nl> - REGISTER_CVAR2 ( " ai_DrawOffset " , & DebugDrawOffset , 0 . 1f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " vertical offset during debug drawing ( graph nodes , navigation paths , . . . ) " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawTargets " , DrawTargets , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Distance to display the perception events of all enabled puppets . \ n " <nl> - " Displays target type and priority " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawStats " , DrawStats , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles drawing stats ( in a table on top left of screen ) for AI objects within specified range . \ n " <nl> - " Will display attention target , goal pipe and current goal . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawAttentionTargetPositions " , DrawAttentionTargetsPosition , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays markers for the AI ' s current attention target position . " ) ; <nl> - REGISTER_CVAR2 ( " ai_ExtraRadiusDuringBeautification " , & ExtraRadiusDuringBeautification , 0 . 2f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Extra radius added to agents during beautification . " ) ; <nl> - REGISTER_CVAR2 ( " ai_ExtraForbiddenRadiusDuringBeautification " , & ExtraForbiddenRadiusDuringBeautification , 1 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Extra radius added to agents close to forbidden edges during beautification . " ) ; <nl> - DefineConstIntCVarName ( " ai_RecordLog " , RecordLog , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " log all the AI state changes on stats_target " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawGroupTactic " , DrawGroupTactic , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " draw group tactic : 0 = disabled , 1 = draw simple , 2 = draw complex . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawTrajectory " , DrawTrajectory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Record and draw the actual path taken by the agent specified in ai_StatsTarget . \ n " <nl> - " Path is displayed in aqua , and only a certain length will be displayed , after which \ n " <nl> - " old path gradually disappears as new path is drawn . \ n " <nl> - " 0 = do not record , 1 = record . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawRadar " , DrawRadar , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws AI radar : 0 = no radar , > 0 = size of the radar on screen " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawRadarDist " , DrawRadarDist , 20 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " AI radar draw distance in meters , default = 20m . " ) ; <nl> - / / should be off for release <nl> - DefineConstIntCVarName ( " ai_Recorder_Auto " , DebugRecordAuto , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Auto record the AI when in Editor mode game \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_Recorder_Buffer " , DebugRecordBuffer , 1024 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Set the size of the AI debug recording buffer " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawDistanceLUT " , DrawDistanceLUT , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the distance lookup table graph overlay . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawAreas " , DrawAreas , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables / Disables drawing behavior related areas . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawProbableTarget " , DrawProbableTarget , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables / Disables drawing the position of probable target . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawDamageParts " , DebugDrawDamageParts , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the damage parts of puppets and vehicles . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawStanceSize " , DebugDrawStanceSize , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the game logic representation of the stance size of the AI agents . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugTargetSilhouette " , DebugTargetSilhouette , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the silhouette used for missing the target while shooting . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_RODAliveTime " , & RODAliveTime , 3 . 0f , VF_NULL , <nl> - " The base level time the player can survive under fire . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODMoveInc " , & RODMoveInc , 3 . 0f , VF_NULL , <nl> - " Increment how the speed of the target affects the alive time ( the value is doubled for supersprint ) . 0 = disable " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODStanceInc " , & RODStanceInc , 2 . 0f , VF_NULL , <nl> - " Increment how the stance of the target affects the alive time , 0 = disable . \ n " <nl> - " The base value is for crouch , and it is doubled for prone . \ n " <nl> - " The crouch inc is disable in kill - zone and prone in kill and combat - near - zones " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODDirInc " , & RODDirInc , 0 . 0f , VF_NULL , <nl> - " Increment how the orientation of the target affects the alive time . 0 = disable " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODKillZoneInc " , & RODKillZoneInc , - 4 . 0f , VF_NULL , <nl> - " Increment how the target is within the kill - zone of the target . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODFakeHitChance " , & RODFakeHitChance , 0 . 2f , VF_NULL , <nl> - " Percentage of the missed hits that will instead be hits dealing very little damage . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODAmbientFireInc " , & RODAmbientFireInc , 3 . 0f , VF_NULL , <nl> - " Increment for the alive time when the target is within the kill - zone of the target . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_RODKillRangeMod " , & RODKillRangeMod , 0 . 15f , VF_NULL , <nl> - " Kill - zone distance = attackRange * killRangeMod . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODCombatRangeMod " , & RODCombatRangeMod , 0 . 55f , VF_NULL , <nl> - " Combat - zone distance = attackRange * combatRangeMod . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_RODCoverFireTimeMod " , & RODCoverFireTimeMod , 1 . 0f , VF_NULL , <nl> - " Multiplier for cover fire times set in weapon descriptor . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_RODReactionTime " , & RODReactionTime , 1 . 0f , VF_NULL , <nl> - " Uses rate of death as damage control method . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODReactionDistInc " , & RODReactionDistInc , 0 . 1f , VF_NULL , <nl> - " Increase for the reaction time when the target is in combat - far - zone or warn - zone . \ n " <nl> - " In warn - zone the increase is doubled . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODReactionDirInc " , & RODReactionDirInc , 2 . 0f , VF_NULL , <nl> - " Increase for the reaction time when the enemy is outside the players FOV or near the edge of the FOV . \ n " <nl> - " The increment is doubled when the target is behind the player . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODReactionLeanInc " , & RODReactionLeanInc , 0 . 2f , VF_NULL , <nl> - " Increase to the reaction to when the target is leaning . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODReactionSuperDarkIllumInc " , & RODReactionSuperDarkIllumInc , 0 . 4f , VF_NULL , <nl> - " Increase for reaction time when the target is in super dark light condition . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODReactionDarkIllumInc " , & RODReactionDarkIllumInc , 0 . 3f , VF_NULL , <nl> - " Increase for reaction time when the target is in dark light condition . " ) ; <nl> - REGISTER_CVAR2 ( " ai_RODReactionMediumIllumInc " , & RODReactionMediumIllumInc , 0 . 2f , VF_NULL , <nl> - " Increase for reaction time when the target is in medium light condition . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_RODLowHealthMercyTime " , & RODLowHealthMercyTime , 1 . 5f , VF_NULL , <nl> - " The amount of time the AI will not hit the target when the target crosses the low health threshold . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_AmbientFireEnable " , AmbientFireEnable , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable ambient fire system . " ) ; <nl> - REGISTER_CVAR2 ( " ai_AmbientFireUpdateInterval " , & AmbientFireUpdateInterval , 1 . 0f , VF_NULL , <nl> - " Ambient fire update interval . Controls how often puppet ' s ambient fire status is updated . " ) ; <nl> - REGISTER_CVAR2 ( " ai_AmbientFireQuota " , & AmbientFireQuota , 2 , 0 , <nl> - " Number of units allowed to hit the player at a time . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawAmbientFire " , DebugDrawAmbientFire , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays fire quota on puppets . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_PlayerAffectedByLight " , PlayerAffectedByLight , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Sets if player is affected by light from observable perception checks " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawExpensiveAccessoryQuota " , DebugDrawExpensiveAccessoryQuota , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Displays expensive accessory usage quota on puppets . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawDamageControl " , DebugDrawDamageControl , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Debugs the damage control system 0 = disabled , 1 = collect , 2 = collect & draw . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawFakeDamageInd " , DrawFakeDamageInd , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws fake damage indicators on the player . " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawPlayerRanges " , DrawPlayerRanges , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws rings around player to assist in gauging target distance " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawPerceptionIndicators " , DrawPerceptionIndicators , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws indicators showing enemy current perception level of player " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawPerceptionDebugging " , DrawPerceptionDebugging , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws indicators showing enemy view intersection with perception modifiers " ) ; <nl> - DefineConstIntCVarName ( " ai_DrawPerceptionModifiers " , DrawPerceptionModifiers , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws perception modifier areas in game mode " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugGlobalPerceptionScale " , DebugGlobalPerceptionScale , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws global perception scale multipliers on screen " ) ; <nl> - DefineConstIntCVarName ( " ai_TargetTracking " , TargetTracking , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable / disable target tracking . 0 = disable , any other value = Enable " ) ; <nl> - DefineConstIntCVarName ( " ai_TargetTracks_GlobalTargetLimit " , TargetTracks_GlobalTargetLimit , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Global override to control the number of agents that can actively target another agent ( unless there is no other choice ) \ n " <nl> - " A value of 0 means no global limit is applied . If the global target limit is less than the agent ' s target limit , the global limit is used . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugTargetTracksTarget " , TargetTracks_TargetDebugDraw , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws lines to illustrate where each agent ' s target is \ n " <nl> - " Usage : ai_DebugTargetTracking 0 / 1 / 2 \ n " <nl> - " 0 = Off . 1 = Show best target . 2 = Show all possible targets . " ) ; <nl> - REGISTER_CVAR2 ( " ai_DebugTargetTracksAgent " , & TargetTracks_AgentDebugDraw , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the target tracks for the given agent \ n " <nl> - " Usage : ai_DebugTargetTracksAgent AIName \ n " <nl> - " Default is ' none ' . AIName is the name of the AI agent to debug " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugTargetTracksConfig " , TargetTracks_ConfigDebugDraw , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Draws the information contained in the loaded target track configurations to the screen " ) ; <nl> - REGISTER_CVAR2 ( " ai_DebugTargetTracksConfig_Filter " , & TargetTracks_ConfigDebugFilter , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Filter what configurations are drawn when debugging target tracks \ n " <nl> - " Usage : ai_DebugTargetTracks_Filter Filter \ n " <nl> - " Default is ' none ' . Filter is a substring that must be in the configuration name " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawSelectedTargets " , & DrawSelectedTargets , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the debug helpers showing the AI ' s selected targets . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_ForceStance " , ForceStance , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Forces all AI characters to specified stance : \ n " <nl> - " Disable = - 1 , Stand = 0 , Crouch = 1 , Prone = 2 , Relaxed = 3 , Stealth = 4 , Cover = 5 , Swim = 6 , Zero - G = 7 " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_ForceAllowStrafing " , ForceAllowStrafing , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Forces all AI characters to use / not use strafing ( - 1 disables ) " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_InterestSystem " , InterestSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enable interest system " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugInterestSystem " , DebugInterest , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Display debugging information on interest system " ) ; <nl> - DefineConstIntCVarName ( " ai_InterestSystemCastRays " , InterestSystemCastRays , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Makes the Interest System check visibility with rays " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_BannedNavSoTime " , & BannedNavSoTime , 15 . 0f , VF_NULL , <nl> - " Time indicating how long invalid navsos should be banned . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawAdaptiveUrgency " , DebugDrawAdaptiveUrgency , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables drawing the adaptive movement urgency . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawReinforcements " , DebugDrawReinforcements , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables debug draw for reinforcement logic for specified group . \ n " <nl> - " Usage : ai_DebugDrawReinforcements < groupid > , or - 1 to disable . " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawPlayerActions " , DebugDrawPlayerActions , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Debug draw special player actions . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_EnableWaterOcclusion " , WaterOcclusionEnable , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables applying water occlusion to AI target visibility checks " ) ; <nl> - REGISTER_CVAR2 ( " ai_WaterOcclusion " , & WaterOcclusionScale , . 5f , VF_NULL , <nl> - " scales how much water hides player from AI " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawEnabledActors " , DebugDrawEnabledActors , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " list of AI Actors that are enabled and metadata " ) ; <nl> - DefineConstIntCVarName ( " ai_DebugDrawEnabledPlayers " , DebugDrawEnabledPlayers , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " list of AI players that are enabled and metadata " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DrawUpdate " , DebugDrawUpdate , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " list of AI forceUpdated entities " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawLightLevel " , DebugDrawLightLevel , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Debug AI light level manager " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_MinActorDynamicObstacleAvoidanceRadius " , & MinActorDynamicObstacleAvoidanceRadius , 0 . 6f , VF_NULL , <nl> - " Minimum value in meters to be added to the obstacle ' s own size for actors \ n " <nl> - " ( pathRadius property can override it if bigger ) " ) ; <nl> - REGISTER_CVAR2 ( " ai_ExtraVehicleAvoidanceRadiusBig " , & ExtraVehicleAvoidanceRadiusBig , 4 . 0f , VF_NULL , <nl> - " Value in meters to be added to a big obstacle ' s own size while computing obstacle \ n " <nl> - " size for purposes of vehicle steering . See also ai_ObstacleSizeThreshold . " ) ; <nl> - REGISTER_CVAR2 ( " ai_ExtraVehicleAvoidanceRadiusSmall " , & ExtraVehicleAvoidanceRadiusSmall , 0 . 5f , VF_NULL , <nl> - " Value in meters to be added to a big obstacle ' s own size while computing obstacle \ n " <nl> - " size for purposes of vehicle steering . See also ai_ObstacleSizeThreshold . " ) ; <nl> - REGISTER_CVAR2 ( " ai_ObstacleSizeThreshold " , & ObstacleSizeThreshold , 1 . 2f , VF_NULL , <nl> - " Obstacle size in meters that differentiates small obstacles from big ones so that vehicles can ignore the small ones " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_IgnoreVisualStimulus " , IgnoreVisualStimulus , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Have the Perception Handler ignore all visual stimulus always " ) ; <nl> - DefineConstIntCVarName ( " ai_IgnoreSoundStimulus " , IgnoreSoundStimulus , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Have the Perception Handler ignore all sound stimulus always " ) ; <nl> - DefineConstIntCVarName ( " ai_IgnoreBulletRainStimulus " , IgnoreBulletRainStimulus , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Have the Perception Handler ignore all bullet rain stimulus always " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_MNMPathFinderQuota " , & MNMPathFinderQuota , 0 . 001f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Set path finding frame time quota in seconds ( Set to 0 for no limit ) " ) ; <nl> - REGISTER_CVAR2 ( " ai_MNMPathFinderDebug " , & MNMPathFinderDebug , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable debug draw statistics on pathfinder load . Note that construction and beautify times are only calculated once this CVAR is enabled . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_MNMProfileMemory " , & MNMProfileMemory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Display navigation system memory statistics " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_MNMDebugAccessibility " , & MNMDebugAccessibility , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Display navigation unreachable areas in gray color . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_MNMDebugDrawTileStates " , & MNMDebugDrawTileStates , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Display tiles ' borders based on their update state . \ n " <nl> - " orange - in active updates queue \ n " <nl> - " yellow - update after stabilization \ n " <nl> - " blue - changed during disabled regeneration \ n " <nl> - " gray - changed during level load " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_MNMEditorBackgroundUpdate " , & MNMEditorBackgroundUpdate , 1 , VF_NULL , <nl> - " [ 0 - 1 ] Enable / Disable editor background update of the Navigation Meshes " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_UseSmartPathFollower " , UseSmartPathFollower , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enables Smart PathFollower ( default : 1 ) . " ) ; <nl> - REGISTER_CVAR2 ( " ai_UseSmartPathFollower_LookAheadDistance " , & SmartPathFollower_LookAheadDistance , 10 . 0f , VF_NULL , " LookAheadDistance of SmartPathFollower " ) ; <nl> - REGISTER_CVAR2 ( " ai_SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk " , & SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk , 0 . 5f , VF_NULL , <nl> - " Defines the time frame the AI is allowed to look ahead while moving strictly along a path to decide whether to cut towards the next point . ( Walk only ) \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint " , & SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint , 0 . 25f , VF_NULL , <nl> - " Defines the time frame the AI is allowed to look ahead while moving strictly along a path to decide whether to cut towards the next point . ( Run and Sprint only ) \ n " ) ; <nl> - REGISTER_CVAR2 ( " ai_SmartPathFollower_decelerationHuman " , & SmartPathFollower_decelerationHuman , 7 . 75f , VF_NULL , " Deceleration multiplier for non - vehicles " ) ; <nl> - REGISTER_CVAR2 ( " ai_SmartPathFollower_decelerationVehicle " , & SmartPathFollower_decelerationVehicle , 1 . 0f , VF_NULL , " Deceleration multiplier for vehicles " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_MNMPathfinderMT " , MNMPathfinderMT , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enable / Disable Multi Threading for the pathfinder . " ) ; <nl> - DefineConstIntCVarName ( " ai_MNMPathfinderConcurrentRequests " , MNMPathfinderConcurrentRequests , 4 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Defines the amount of concurrent pathfinder requests that can be served at the same time . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_MNMRaycastImplementation " , MNMRaycastImplementation , 2 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Defines which type of raycast implementation to use on the MNM meshes . " <nl> - " 0 - Version 1 . This version will be deprecated as it sometimes does not handle correctly the cases where the ray coincides with triangle egdes , which has been fixed in the new version . \ n " <nl> - " 1 - Version 2 . This version also fails in some cases when the ray goes exactly through triangle corners and then hitting the wall . \ n " <nl> - " 2 - Version 3 . The newest version that should be working in all special cases . This version is around 40 % faster then the previous one . \ n " <nl> - " Any other value is used for the biggest version . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_MNMRemoveInaccessibleTrianglesOnLoad " , MNMRemoveInaccessibleTrianglesOnLoad , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Defines whether inaccessible triangles can be removed from NavMeshes after they are loaded ( Note : the triangles are never removed in Editor ) . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_SmartPathFollower_useAdvancedPathShortcutting " , SmartPathFollower_useAdvancedPathShortcutting , 1 , VF_NULL , " Enables a more failsafe way of preventing the AI to shortcut through obstacles ( 0 = disable , any other value = enable ) " ) ; <nl> - DefineConstIntCVarName ( " ai_SmartPathFollower_useAdvancedPathShortcutting_debug " , SmartPathFollower_useAdvancedPathShortcutting_debug , 0 , VF_NULL , " Show debug lines for when CVar ai_SmartPathFollower_useAdvancedPathShortcutting_debug is enabled " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DrawPathFollower " , DrawPathFollower , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enables PathFollower debug drawing displaying agent paths and safe follow target . " ) ; <nl> - <nl> - # ifdef CONSOLE_CONST_CVAR_MODE <nl> - DefineConstIntCVarName ( " ai_LogConsoleVerbosity " , LogConsoleVerbosity , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> - DefineConstIntCVarName ( " ai_LogFileVerbosity " , LogFileVerbosity , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> - DefineConstIntCVarName ( " ai_EnableWarningsErrors " , EnableWarningsErrors , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enable AI warnings and errors : 1 or 0 " ) ; <nl> - # else <nl> - DefineConstIntCVarName ( " ai_LogConsoleVerbosity " , LogConsoleVerbosity , AI_LOG_OFF , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> - DefineConstIntCVarName ( " ai_LogFileVerbosity " , LogFileVerbosity , AI_LOG_PROGRESS , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> - DefineConstIntCVarName ( " ai_EnableWarningsErrors " , EnableWarningsErrors , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enable AI warnings and errors : 1 or 0 " ) ; <nl> - # endif <nl> - <nl> - REGISTER_CVAR2 ( " ai_OverlayMessageDuration " , & OverlayMessageDuration , 5 . 0f , VF_DUMPTODISK , " How long ( seconds ) to overlay AI warnings / errors " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_Recorder " , Recorder , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Sets AI Recorder mode . Default is 0 - off . " ) ; <nl> - DefineConstIntCVarName ( " ai_StatsDisplayMode " , StatsDisplayMode , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Select display mode for the AI stats manager \ n " <nl> - " Usage : 0 - Hidden , 1 - Show \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_VisionMapNumberOfPVSUpdatesPerFrame " , VisionMapNumberOfPVSUpdatesPerFrame , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " " ) ; <nl> - DefineConstIntCVarName ( " ai_VisionMapNumberOfVisibilityUpdatesPerFrame " , VisionMapNumberOfVisibilityUpdatesPerFrame , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawVisionMap " , DebugDrawVisionMap , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Toggles the debug drawing of the AI VisionMap . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawVisionMapStats " , DebugDrawVisionMapStats , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables the debug drawing of the AI VisionMap to show stats information . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawVisionMapVisibilityChecks " , DebugDrawVisionMapVisibilityChecks , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables the debug drawing of the AI VisionMap to show the status of the visibility checks . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawVisionMapObservers " , DebugDrawVisionMapObservers , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables the debug drawing of the AI VisionMap to show the location / stats of the observers . \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawVisionMapObserversFOV " , DebugDrawVisionMapObserversFOV , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables the debug drawing of the AI VisionMap to draw representations of the observers FOV . \ n " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DebugDrawVisionMapObservables " , DebugDrawVisionMapObservables , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enables the debug drawing of the AI VisionMap to show the location / stats of the observables . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_DrawFireEffectEnabled " , DrawFireEffectEnabled , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Enabled AI to sweep fire when starting to shoot after a break . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawFireEffectDecayRange " , & DrawFireEffectDecayRange , 30 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Distance under which the draw fire duration starts decaying linearly . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawFireEffectMinDistance " , & DrawFireEffectMinDistance , 7 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Distance under which the draw fire will be disabled . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawFireEffectMinTargetFOV " , & DrawFireEffectMinTargetFOV , 7 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " FOV under which the draw fire will be disabled . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawFireEffectMaxAngle " , & DrawFireEffectMaxAngle , 5 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Maximum angle actors actors are allowed to go away from their aiming direction during draw fire . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_DrawFireEffectTimeScale " , & DrawFireEffectTimeScale , 1 . 0f , VF_NULL , <nl> - " Scale for the weapon ' s draw fire time setting . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_AllowedToHitPlayer " , AllowedToHitPlayer , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " If turned off , all agents will miss the player all the time . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_AllowedToHit " , AllowedToHit , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " If turned off , all agents will miss all the time . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_EnableCoolMisses " , EnableCoolMisses , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " If turned on , when agents miss the player , they will pick cool objects to shoot at . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CoolMissesBoxSize " , & CoolMissesBoxSize , 10 . 0f , VF_NULL , <nl> - " Horizontal size of the box to collect potential cool objects to shoot at . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CoolMissesBoxHeight " , & CoolMissesBoxHeight , 2 . 5f , VF_NULL , <nl> - " Vertical size of the box to collect potential cool objects to shoot at . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CoolMissesMinMissDistance " , & CoolMissesMinMissDistance , 7 . 5f , VF_NULL , <nl> - " Maximum distance to go away from the player . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CoolMissesMaxLightweightEntityMass " , & CoolMissesMaxLightweightEntityMass , 20 . 0f , VF_NULL , <nl> - " Maximum mass of a non - destroyable , non - deformable , non - breakable rigid body entity to be considered . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CoolMissesProbability " , & CoolMissesProbability , 0 . 35f , VF_NULL , <nl> - " Agents ' chance to perform a cool miss ! " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_CoolMissesCooldown " , & CoolMissesCooldown , 0 . 25f , VF_NULL , <nl> - " Global time between potential cool misses . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_ForceSerializeAllObjects " , ForceSerializeAllObjects , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Serialize all AI objects ( ignore NO_SAVE flag ) . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_LobThrowMinAllowedDistanceFromFriends " , & LobThrowMinAllowedDistanceFromFriends , 15 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Minimum distance a grenade ( or any object thrown using a lob ) should land from mates to accept the throw trajectory . " ) ; <nl> - REGISTER_CVAR2 ( " ai_LobThrowTimePredictionForFriendPositions " , & LobThrowTimePredictionForFriendPositions , 2 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Time frame used to predict the next position of moving mates to score the landing position of the lob throw " ) ; <nl> - REGISTER_CVAR2 ( " ai_LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation " , & LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation , 0 . 0 , <nl> - VF_CHEAT | VF_CHEAT_NOCHECK , " This value identifies percentage of the distance to the target that will be used to simulate human inaccuracy with parabolic throws . " ) ; <nl> - DefineConstIntCVarName ( " ai_LobThrowUseRandomForInaccuracySimulation " , LobThrowSimulateRandomInaccuracy , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Uses random variation for simulating inaccuracy in the lob throw . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_LogSignals " , & LogSignals , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " Logs all the signals received in CAIActor : : NotifySignalReceived . " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_commTest " , CommTest , VF_NULL , <nl> - " Tests communication for the specified AI actor . \ n " <nl> - " If no communication name is specified all communications will be played . \ n " <nl> - " Usage : ai_commTest < actorName > [ commName ] \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_commTestStop " , CommTestStop , VF_NULL , <nl> - " Stop currently playing communication for the specified AI actor . \ n " <nl> - " Usage : ai_commTestStop < actorName > \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_writeCommStats " , CommWriteStats , VF_NULL , <nl> - " Dumps current statistics to log file . \ n " <nl> - " Usage : ai_writeCommStats \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_resetCommStats " , CommResetStats , VF_NULL , <nl> - " Resets current communication statistics . \ n " <nl> - " Usage : ai_resetCommStats \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_debugMNMAgentType " , DebugMNMAgentType , VF_NULL , <nl> - " Enabled MNM debug draw for an specific agent type . \ n " <nl> - " Usage : ai_debugMNMAgentType [ AgentTypeName ] \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_MNMCalculateAccessibility " , MNMCalculateAccessibility , VF_NULL , <nl> - " Calculate mesh reachability starting from designers placed MNM Seeds . \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_MNMComputeConnectedIslands " , MNMComputeConnectedIslands , VF_DEV_ONLY , <nl> - " Computes connected islands on the mnm mesh . \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_NavigationReloadConfig " , NavigationReloadConfig , VF_DEV_ONLY , <nl> - " Usage : ai_NavigationReloadConfig \ n " <nl> - " Reloads navigation config file . May lead to broken subsystems and weird bugs . For DEBUG purposes ONLY ! \ n " ) ; <nl> - <nl> - REGISTER_COMMAND ( " ai_DebugAgent " , DebugAgent , VF_NULL , <nl> - " Start debugging an agent more in - depth . Pick by name , closest or in center of view . \ n " <nl> - " Example : ai_DebugAgent closest \ n " <nl> - " Example : ai_DebugAgent centerview \ n " <nl> - " Example : ai_DebugAgent name \ n " <nl> - " Call without parameters to stop the in - depth debugging . \ n " <nl> - " Example : ai_DebugAgent \ n " <nl> - ) ; <nl> - <nl> - / / Behavior Tree <nl> - <nl> - REGISTER_CVAR2 ( " ai_ModularBehaviorTree " , & ModularBehaviorTree , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the usage of the modular behavior tree system . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugTree " , & ModularBehaviorTreeDebugTree , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree execution . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugVariables " , & ModularBehaviorTreeDebugVariables , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s variables . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugTimestamps " , & ModularBehaviorTreeDebugTimestamps , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the debug text of the modular behavior tree ' s timestamps . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugEvents " , & ModularBehaviorTreeDebugEvents , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s events . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugLog " , & ModularBehaviorTreeDebugLog , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s log . " ) ; <nl> - <nl> - REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugBlackboard " , & ModularBehaviorTreeDebugBlackboard , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s blackboards . " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_ModularBehaviorTreeDebugExecutionStacks " , LogModularBehaviorTreeExecutionStacks , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 2 ] Enable / Disable logging of the execution stacks of modular behavior trees to individual files in the MBT_Logs directory . \ n " <nl> - " 0 - Off \ n " <nl> - " 1 - Log execution stacks of only the currently selected agent \ n " <nl> - " 2 - Log execution stacks of all currently active agents " ) ; <nl> - <nl> - DefineConstIntCVarName ( " ai_ScriptBind " , ScriptBind , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the Script Bind AI subsystem . \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_CommunicationSystem " , CommunicationSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the Communication subsystem . \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_FormationSystem " , FormationSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enables / Dsiable the Formation System . \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_GroupSystem " , GroupSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the Group System . \ n " ) ; <nl> - DefineConstIntCVarName ( " ai_TacticalPointSystem " , TacticalPointSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Enable / Disable the Tactical Point System . \ n " ) ; <nl> - <nl> - / / MNM <nl> - <nl> - REGISTER_CVAR2 ( " ai_MNMAllowDynamicRegenInEditor " , & MNMAllowDynamicRegenInEditor , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> - " [ 0 - 1 ] Allow dynamic regeneration of MNM when in the editor , when in game mode . Put this CVar in your configuration file rather than changing it during execution . " ) ; <nl> - <nl> - } <nl> - <nl> - void AIConsoleVars : : CommTest ( IConsoleCmdArgs * args ) <nl> - { <nl> - if ( args - > GetArgCount ( ) < 2 ) <nl> - { <nl> - AIWarning ( " < CommTest > Expecting actorName as parameter . " ) ; <nl> - <nl> - return ; <nl> - } <nl> - <nl> - CAIActor * actor = 0 ; <nl> - <nl> - if ( IEntity * entity = gEnv - > pEntitySystem - > FindEntityByName ( args - > GetArg ( 1 ) ) ) <nl> - if ( IAIObject * aiObject = entity - > GetAI ( ) ) <nl> - actor = aiObject - > CastToCAIActor ( ) ; <nl> - <nl> - if ( ! actor ) <nl> - { <nl> - AIWarning ( " < CommTest > Could not find entity named ' % s ' or it ' s not an actor . " , args - > GetArg ( 1 ) ) ; <nl> - <nl> - return ; <nl> - } <nl> - <nl> - const char * commName = 0 ; <nl> - <nl> - if ( args - > GetArgCount ( ) > 2 ) <nl> - commName = args - > GetArg ( 2 ) ; <nl> - <nl> - int variationNumber = 0 ; <nl> - <nl> - if ( args - > GetArgCount ( ) > 3 ) <nl> - variationNumber = atoi ( args - > GetArg ( 3 ) ) ; <nl> - <nl> - gAIEnv . pCommunicationManager - > GetTestManager ( ) . StartFor ( actor - > GetEntityID ( ) , commName , variationNumber ) ; <nl> - } <nl> - <nl> - void AIConsoleVars : : CommTestStop ( IConsoleCmdArgs * args ) <nl> - { <nl> - if ( args - > GetArgCount ( ) < 2 ) <nl> - { <nl> - AIWarning ( " < CommTest > Expecting actorName as parameter . " ) ; <nl> - <nl> - return ; <nl> - } <nl> - <nl> - CAIActor * actor = 0 ; <nl> - <nl> - if ( IEntity * entity = gEnv - > pEntitySystem - > FindEntityByName ( args - > GetArg ( 1 ) ) ) <nl> - if ( IAIObject * aiObject = entity - > GetAI ( ) ) <nl> - actor = aiObject - > CastToCAIActor ( ) ; <nl> - <nl> - if ( ! actor ) <nl> - { <nl> - AIWarning ( " < CommTest > Could not find entity named ' % s ' or it ' s not an actor . " , args - > GetArg ( 1 ) ) ; <nl> - <nl> - return ; <nl> - } <nl> - <nl> - gAIEnv . pCommunicationManager - > GetTestManager ( ) . Stop ( actor - > GetEntityID ( ) ) ; <nl> - } <nl> - <nl> - void AIConsoleVars : : CommWriteStats ( IConsoleCmdArgs * args ) <nl> - { <nl> - gAIEnv . pCommunicationManager - > WriteStatistics ( ) ; <nl> - } <nl> - <nl> - void AIConsoleVars : : CommResetStats ( IConsoleCmdArgs * args ) <nl> - { <nl> - gAIEnv . pCommunicationManager - > ResetStatistics ( ) ; <nl> - } <nl> - <nl> - void AIConsoleVars : : DebugMNMAgentType ( IConsoleCmdArgs * args ) <nl> - { <nl> - if ( args - > GetArgCount ( ) < 2 ) <nl> - { <nl> - AIWarning ( " < DebugMNMAgentType > Expecting Agent Type as parameter . " ) ; <nl> - return ; <nl> - } <nl> - <nl> - const char * agentTypeName = args - > GetArg ( 1 ) ; <nl> - <nl> - NavigationAgentTypeID agentTypeID = gAIEnv . pNavigationSystem - > GetAgentTypeID ( agentTypeName ) ; <nl> - gAIEnv . pNavigationSystem - > SetDebugDisplayAgentType ( agentTypeID ) ; <nl> - } <nl> - <nl> - void AIConsoleVars : : MNMCalculateAccessibility ( IConsoleCmdArgs * args ) <nl> - { <nl> - gAIEnv . pNavigationSystem - > CalculateAccessibility ( ) ; <nl> - } <nl> <nl> namespace <nl> { <nl> void GatherPotentialDebugAgents ( PotentialDebugAgents & agents ) <nl> } <nl> } <nl> <nl> - void AIConsoleVars : : MNMComputeConnectedIslands ( IConsoleCmdArgs * args ) <nl> + void SAIConsoleVars : : Init ( ) <nl> { <nl> - gAIEnv . pNavigationSystem - > ComputeAllIslands ( ) ; <nl> - } <nl> + AILogProgress ( " [ AISYSTEM ] Initialization : Creating console vars " ) ; <nl> <nl> - void AIConsoleVars : : NavigationReloadConfig ( IConsoleCmdArgs * args ) <nl> - { <nl> - if ( INavigationSystem * pNavigationSystem = gAIEnv . pNavigationSystem ) <nl> - { <nl> - / / TODO pavloi 2016 . 03 . 09 : hack implementation . See comments in ReloadConfig . <nl> - if ( pNavigationSystem - > ReloadConfig ( ) ) <nl> - { <nl> - pNavigationSystem - > ClearAndNotify ( ) ; <nl> - } <nl> - else <nl> - { <nl> - AIWarning ( " Errors during config reloading " ) ; <nl> - } <nl> - return ; <nl> - } <nl> - AIWarning ( " Unable to obtain navigation system to reload config . " ) ; <nl> + navigation . Init ( ) ; <nl> + pathfinder . Init ( ) ; <nl> + pathFollower . Init ( ) ; <nl> + movement . Init ( ) ; <nl> + collisionAvoidance . Init ( ) ; <nl> + visionMap . Init ( ) ; <nl> + behaviorTree . Init ( ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDraw " , DebugDraw , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles the AI debugging view . \ n " <nl> + " Usage : ai_DebugDraw [ - 1 / 0 / 1 ] \ n " <nl> + " Default is 0 ( minimal ) , value - 1 will draw nothing , value 1 displays AI rays and targets \ n " <nl> + " and enables the view for other AI debugging tools . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_RayCasterQuota " , RayCasterQuota , 12 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Amount of deferred rays allowed to be cast per frame ! " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_NetworkDebug " , NetworkDebug , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles the AI network debug . \ n " <nl> + " Usage : ai_NetworkDebug [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) . ai_NetworkDebug is used to direct DebugDraw information \ n " <nl> + " from the server to the client . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_IntersectionTesterQuota " , IntersectionTesterQuota , 12 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Amount of deferred intersection tests allowed to be cast per frame ! " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_UpdateAllAlways " , UpdateAllAlways , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " If non - zero then over - rides the auto - disabling of invisible / distant AI " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawVegetationCollisionDist " , DebugDrawVegetationCollisionDist , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables drawing vegetation collision closer than a distance projected onto the terrain . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawPlayerRanges " , DrawPlayerRanges , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws rings around player to assist in gauging target distance " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_EnableWaterOcclusion " , WaterOcclusionEnable , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables applying water occlusion to AI target visibility checks " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_Recorder " , Recorder , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Sets AI Recorder mode . Default is 0 - off . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_StatsDisplayMode " , StatsDisplayMode , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Select display mode for the AI stats manager \ n " <nl> + " Usage : 0 - Hidden , 1 - Show \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawSignalsHistory " , DebugDrawSignalsHistory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays a history of the 20 most recent signals sent by AI . \ n " <nl> + " Most recent signals are displayed at the top of the list . As time passes , old signals will turn gray . \ n " <nl> + " Usage : ai_DebugDrawSignalsList [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - on \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_UpdateProxy " , UpdateProxy , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles update of AI proxy ( model ) . \ n " <nl> + " Usage : ai_UpdateProxy [ 0 / 1 ] \ n " <nl> + " Default is 1 ( on ) . Updates proxy ( AI representation in game ) \ n " <nl> + " set to 0 to disable proxy updating . " ) ; <nl> + <nl> + # ifdef CONSOLE_CONST_CVAR_MODE <nl> + DefineConstIntCVarName ( " ai_LogConsoleVerbosity " , LogConsoleVerbosity , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> + DefineConstIntCVarName ( " ai_LogFileVerbosity " , LogFileVerbosity , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> + DefineConstIntCVarName ( " ai_EnableWarningsErrors " , EnableWarningsErrors , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enable AI warnings and errors : 1 or 0 " ) ; <nl> + # else <nl> + DefineConstIntCVarName ( " ai_LogConsoleVerbosity " , LogConsoleVerbosity , AI_LOG_OFF , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> + DefineConstIntCVarName ( " ai_LogFileVerbosity " , LogFileVerbosity , AI_LOG_PROGRESS , VF_CHEAT | VF_CHEAT_NOCHECK , " None = 0 , progress / errors / warnings = 1 , event = 2 , comment = 3 " ) ; <nl> + DefineConstIntCVarName ( " ai_EnableWarningsErrors " , EnableWarningsErrors , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enable AI warnings and errors : 1 or 0 " ) ; <nl> + # endif <nl> + <nl> + REGISTER_CVAR2 ( " ai_SystemUpdate " , & AiSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles the regular AI system update . \ n " <nl> + " Usage : ai_SystemUpdate [ 0 / 1 ] \ n " <nl> + " Default is 1 ( on ) . Set to 0 to disable ai system updating . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_OverlayMessageDuration " , & OverlayMessageDuration , 5 . 0f , VF_DUMPTODISK , " How long ( seconds ) to overlay AI warnings / errors " ) ; <nl> + <nl> + / / is not cheat protected because it changes during game , depending on your settings <nl> + REGISTER_CVAR2 ( " ai_UpdateInterval " , & AIUpdateInterval , 0 . 13f , VF_NULL , <nl> + " In seconds the amount of time between two full updates for AI \ n " <nl> + " Usage : ai_UpdateInterval < number > \ n " <nl> + " Default is 0 . 1 . Number is time in seconds " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SteepSlopeUpValue " , & SteepSlopeUpValue , 1 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Indicates slope value that is borderline - walkable up . \ n " <nl> + " Usage : ai_SteepSlopeUpValue 0 . 5 \ n " <nl> + " Default is 1 . 0 Zero means flat . Infinity means vertical . Set it smaller than ai_SteepSlopeAcrossValue " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SteepSlopeAcrossValue " , & SteepSlopeAcrossValue , 0 . 6f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Indicates slope value that is borderline - walkable across . \ n " <nl> + " Usage : ai_SteepSlopeAcrossValue 0 . 8 \ n " <nl> + " Default is 0 . 6 Zero means flat . Infinity means vertical . Set it greater than ai_SteepSlopeUpValue " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_WaterOcclusion " , & WaterOcclusionScale , . 5f , VF_NULL , <nl> + " scales how much water hides player from AI " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawOffset " , & DebugDrawOffset , 0 . 1f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " vertical offset during debug drawing ( graph nodes , navigation paths , . . . ) " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_IgnorePlayer " , IgnorePlayer , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Makes AI ignore the player . \ n " <nl> + " Usage : ai_IgnorePlayer [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) . Set to 1 to make AI ignore the player . \ n " <nl> + " Used with ai_DebugDraw enabled . " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_DebugAgent " , DebugAgent , VF_NULL , <nl> + " Start debugging an agent more in - depth . Pick by name , closest or in center of view . \ n " <nl> + " Example : ai_DebugAgent closest \ n " <nl> + " Example : ai_DebugAgent centerview \ n " <nl> + " Example : ai_DebugAgent name \ n " <nl> + " Call without parameters to stop the in - depth debugging . \ n " <nl> + " Example : ai_DebugAgent \ n " <nl> + ) ; <nl> + <nl> + / / Legacy CVars <nl> + legacyCoverSystem . Init ( ) ; <nl> + legacyBubblesSystem . Init ( ) ; <nl> + legacySmartObjects . Init ( ) ; <nl> + legacyTacticalPointSystem . Init ( ) ; <nl> + legacyCommunicationSystem . Init ( ) ; <nl> + legacyPathObstacles . Init ( ) ; <nl> + legacyDebugDraw . Init ( ) ; <nl> + legacyGroupSystem . Init ( ) ; <nl> + legacyFormationSystem . Init ( ) ; <nl> + legacyPerception . Init ( ) ; <nl> + legacyTargetTracking . Init ( ) ; <nl> + legacyInterestSystem . Init ( ) ; <nl> + legacyPuppet . Init ( ) ; <nl> + legacyFiring . Init ( ) ; <nl> + legacyPuppetRod . Init ( ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugPathfinding " , LegacyDebugPathFinding , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles output of pathfinding information [ default 0 is off ] " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawBannedNavsos " , LegacyDebugDrawBannedNavsos , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles drawing banned navsos [ default 0 is off ] " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_CoverExactPositioning " , LegacyCoverExactPositioning , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables using exact positioning for arriving at cover . \ n " <nl> + " Usage : ai_CoverPredictTarget [ 0 / 1 ] \ n " <nl> + " Default x is 0 ( off ) \ n " <nl> + " 0 - disable \ n " <nl> + " 1 - enable \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_IgnoreVisibilityChecks " , LegacyIgnoreVisibilityChecks , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Makes certain visibility checks ( for teleporting etc ) return false . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_RecordLog " , LegacyRecordLog , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " log all the AI state changes on stats_target " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_Recorder_Auto " , LegacyDebugRecordAuto , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Auto record the AI when in Editor mode game \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_Recorder_Buffer " , LegacyDebugRecordBuffer , 1024 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Set the size of the AI debug recording buffer " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawAreas " , LegacyDrawAreas , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables / Disables drawing behavior related areas . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_AdjustPathsAroundDynamicObstacles " , LegacyAdjustPathsAroundDynamicObstacles , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Set to 1 / 0 to enable / disable AI path adjustment around dynamic obstacles " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_OutputPersonalLogToConsole " , LegacyOutputPersonalLogToConsole , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Output the personal log messages to the console . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_PredictivePathFollowing " , LegacyPredictivePathFollowing , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Sets if AI should use the predictive path following if allowed by the type ' s config . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_ForceSerializeAllObjects " , LegacyForceSerializeAllObjects , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Serialize all AI objects ( ignore NO_SAVE flag ) . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_LogSignals " , & LegacyLogSignals , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Logs all the signals received in CAIActor : : NotifySignalReceived . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CompatibilityMode " , & LegacyCompatibilityMode , " " , VF_NULL , <nl> + " Set AI features to behave in earlier milestones - please use sparingly " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_Locate " , & LegacyDrawLocate , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Indicates position and some base states of specified objects . \ n " <nl> + " It will pinpoint position of the agents ; it ' s name ; it ' s attention target ; \ n " <nl> + " draw red cone if the agent is allowed to fire ; draw purple cone if agent is pressing trigger . \ n " <nl> + " none - off \ n " <nl> + " squad - squadmates \ n " <nl> + " enemy - all the enemies \ n " <nl> + " groupID - members of specified group " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_ScriptBind " , LegacyScriptBind , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the Script Bind AI subsystem . \ n " ) ; <nl> + / / ~ Legacy CVars <nl> } <nl> <nl> - void AIConsoleVars : : DebugAgent ( IConsoleCmdArgs * args ) <nl> + void SAIConsoleVars : : DebugAgent ( IConsoleCmdArgs * args ) <nl> { <nl> EntityId debugTargetEntity = 0 ; <nl> Vec3 debugTargetEntityPos ( ZERO ) ; <nl> void AIConsoleVars : : DebugAgent ( IConsoleCmdArgs * args ) <nl> GetAISystem ( ) - > SetAgentDebugTarget ( debugTargetEntity ) ; <nl> <nl> gEnv - > pLog - > Log ( " Debug target is at position % f , % f , % f " , <nl> - debugTargetEntityPos . x , <nl> - debugTargetEntityPos . y , <nl> - debugTargetEntityPos . z ) ; <nl> + debugTargetEntityPos . x , <nl> + debugTargetEntityPos . y , <nl> + debugTargetEntityPos . z ) ; <nl> } <nl> else <nl> { <nl> void AIConsoleVars : : DebugAgent ( IConsoleCmdArgs * args ) <nl> } <nl> # endif <nl> <nl> - } <nl> - <nl> - void AIConsoleVars : : AIBubblesNameFilterCallback ( ICVar * pCvar ) <nl> - { <nl> - if ( IAIBubblesSystem * pBubblesSystem = GetAISystem ( ) - > GetAIBubblesSystem ( ) ) <nl> - { <nl> - pBubblesSystem - > SetNameFilter ( pCvar - > GetString ( ) ) ; <nl> - } <nl> - } <nl> + } <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / AIConsoleVariables . h <nl> ppp b / Code / CryEngine / CryAISystem / AIConsoleVariables . h <nl> <nl> / / Copyright 2001 - 2018 Crytek GmbH / Crytek Group . All rights reserved . <nl> <nl> - # ifndef AICONSOLEVARIABLES_H <nl> - # define AICONSOLEVARIABLES_H <nl> + # pragma once <nl> <nl> # include < CrySystem / ConsoleRegistration . h > <nl> <nl> - struct AIConsoleVars <nl> - { <nl> - / / cppcheck - suppress uninitMemberVar <nl> - AIConsoleVars ( ) { } <nl> + # include " BehaviorTree / BehaviorTreeConsoleVariables . h " <nl> + # include " CollisionAvoidance / CollisionAvoidanceConsoleVariables . h " <nl> + # include " VisionMapConsoleVariables . h " <nl> + # include " Movement / MovementConsoleVariables . h " <nl> + # include " Navigation / NavigationSystem / NavigationConsoleVariables . h " <nl> + # include " MNMPathfinderConsoleVariables . h " <nl> + # include " PathFollowerConsoleVariables . h " <nl> + # include " AILegacyConsoleVariables . h " <nl> <nl> + struct SAIConsoleVars <nl> + { <nl> void Init ( ) ; <nl> <nl> - DeclareConstIntCVar ( DebugDraw , - 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( DebugDrawCover , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawCoverOccupancy , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawNavigation , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawNavigationQueriesUDR , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawNavigationQueriesList , 0 ) ; <nl> - DeclareConstIntCVar ( DebugTriangleOnCursor , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawNavigationWorldMonitor , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawSignalsHistory , 0 ) ; <nl> - DeclareConstIntCVar ( NavigationSystemMT , 1 ) ; <nl> - DeclareConstIntCVar ( StoreNavigationQueriesHistory , 0 ) ; <nl> - DeclareConstIntCVar ( NavGenThreadJobs , 1 ) ; <nl> - float NavmeshStabilizationTimeToUpdate ; <nl> - float NavmeshTileDistanceDraw ; <nl> - DeclareConstIntCVar ( DebugDrawCoverPlanes , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawCoverLocations , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawCoverSampler , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawDynamicCoverSampler , 0 ) ; <nl> - DeclareConstIntCVar ( CoverSystem , 1 ) ; <nl> - DeclareConstIntCVar ( CoverExactPositioning , 0 ) ; <nl> - DeclareConstIntCVar ( NetworkDebug , 0 ) ; <nl> - DeclareConstIntCVar ( DebugPathFinding , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawBannedNavsos , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawGroups , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawCoolMisses , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawFireCommand , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( DebugDrawCommunication , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawCommunicationHistoryDepth , 5 ) ; <nl> - DeclareConstIntCVar ( RecordCommunicationStats , 0 ) ; <nl> - DeclareConstIntCVar ( CommunicationForceTestVoicePack , 0 ) ; <nl> - DeclareConstIntCVar ( IgnorePlayer , 0 ) ; <nl> - DeclareConstIntCVar ( IgnoreVisibilityChecks , 0 ) ; <nl> - DeclareConstIntCVar ( BeautifyPath , 1 ) ; <nl> - DeclareConstIntCVar ( PathStringPullingIterations , 5 ) ; <nl> - DeclareConstIntCVar ( AttemptStraightPath , 1 ) ; <nl> - DeclareConstIntCVar ( PredictivePathFollowing , 1 ) ; <nl> - DeclareConstIntCVar ( DebugDrawCrowdControl , 0 ) ; <nl> - DeclareConstIntCVar ( UpdateProxy , 1 ) ; <nl> - DeclareConstIntCVar ( DrawType , - 1 ) ; <nl> - DeclareConstIntCVar ( AdjustPathsAroundDynamicObstacles , 1 ) ; <nl> - DeclareConstIntCVar ( DrawFormations , 0 ) ; <nl> - DeclareConstIntCVar ( DrawSmartObjects , 0 ) ; <nl> - DeclareConstIntCVar ( DrawGoals , 0 ) ; <nl> - DeclareConstIntCVar ( DrawTargets , 0 ) ; <nl> - DeclareConstIntCVar ( DrawStats , 0 ) ; <nl> - DeclareConstIntCVar ( DrawAttentionTargetsPosition , 0 ) ; <nl> + static void DebugAgent ( IConsoleCmdArgs * args ) ; <nl> <nl> - DeclareConstIntCVar ( DebugDrawVegetationCollisionDist , 0 ) ; <nl> - DeclareConstIntCVar ( RecordLog , 0 ) ; <nl> - DeclareConstIntCVar ( DrawTrajectory , 0 ) ; <nl> - DeclareConstIntCVar ( DrawRadar , 0 ) ; <nl> - DeclareConstIntCVar ( DrawRadarDist , 20 ) ; <nl> - DeclareConstIntCVar ( DebugRecordAuto , 0 ) ; <nl> - DeclareConstIntCVar ( DebugRecordBuffer , 1024 ) ; <nl> - DeclareConstIntCVar ( DrawGroupTactic , 0 ) ; <nl> - DeclareConstIntCVar ( UpdateAllAlways , 0 ) ; <nl> - DeclareConstIntCVar ( DrawDistanceLUT , 0 ) ; <nl> - DeclareConstIntCVar ( DrawAreas , 0 ) ; <nl> - DeclareConstIntCVar ( DrawProbableTarget , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawDamageParts , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawStanceSize , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawUpdate , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawEnabledActors , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawEnabledPlayers , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawLightLevel , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawPhysicsAccess , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDraw , - 1 ) ; <nl> DeclareConstIntCVar ( RayCasterQuota , 12 ) ; <nl> + DeclareConstIntCVar ( NetworkDebug , 0 ) ; <nl> DeclareConstIntCVar ( IntersectionTesterQuota , 12 ) ; <nl> - DeclareConstIntCVar ( AmbientFireEnable , 1 ) ; <nl> - DeclareConstIntCVar ( DebugDrawAmbientFire , 0 ) ; <nl> - DeclareConstIntCVar ( PlayerAffectedByLight , 1 ) ; <nl> - DeclareConstIntCVar ( DebugDrawExpensiveAccessoryQuota , 0 ) ; <nl> - DeclareConstIntCVar ( DebugTargetSilhouette , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawDamageControl , 0 ) ; <nl> - DeclareConstIntCVar ( DrawFakeDamageInd , 0 ) ; <nl> + DeclareConstIntCVar ( UpdateAllAlways , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawVegetationCollisionDist , 0 ) ; <nl> DeclareConstIntCVar ( DrawPlayerRanges , 0 ) ; <nl> - DeclareConstIntCVar ( DrawPerceptionIndicators , 0 ) ; <nl> - DeclareConstIntCVar ( DrawPerceptionDebugging , 0 ) ; <nl> - DeclareConstIntCVar ( DrawPerceptionModifiers , 0 ) ; <nl> - DeclareConstIntCVar ( DebugGlobalPerceptionScale , 0 ) ; <nl> - DeclareConstIntCVar ( TargetTracking , 1 ) ; <nl> - DeclareConstIntCVar ( TargetTracks_GlobalTargetLimit , 0 ) ; <nl> - DeclareConstIntCVar ( TargetTracks_TargetDebugDraw , 0 ) ; <nl> - DeclareConstIntCVar ( TargetTracks_ConfigDebugDraw , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( ForceStance , - 1 ) ; <nl> - DeclareConstIntCVar ( ForceAllowStrafing , - 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( DebugDrawAdaptiveUrgency , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawReinforcements , - 1 ) ; <nl> - DeclareConstIntCVar ( DebugDrawPlayerActions , 0 ) ; <nl> - <nl> DeclareConstIntCVar ( WaterOcclusionEnable , 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( IgnoreVisualStimulus , 0 ) ; <nl> - DeclareConstIntCVar ( IgnoreSoundStimulus , 0 ) ; <nl> - DeclareConstIntCVar ( IgnoreBulletRainStimulus , 0 ) ; <nl> - <nl> - / / Interest system <nl> - DeclareConstIntCVar ( InterestSystem , 1 ) ; <nl> - DeclareConstIntCVar ( DebugInterest , 0 ) ; <nl> - DeclareConstIntCVar ( InterestSystemCastRays , 1 ) ; <nl> - <nl> - / / Path Follower <nl> - DeclareConstIntCVar ( UseSmartPathFollower , 1 ) ; <nl> - DeclareConstIntCVar ( SmartPathFollower_useAdvancedPathShortcutting , 1 ) ; <nl> - DeclareConstIntCVar ( SmartPathFollower_useAdvancedPathShortcutting_debug , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( DrawPathFollower , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( MNMPathfinderMT , 1 ) ; <nl> - DeclareConstIntCVar ( MNMPathfinderConcurrentRequests , 4 ) ; <nl> - DeclareConstIntCVar ( MNMRaycastImplementation , 2 ) ; <nl> - DeclareConstIntCVar ( MNMRemoveInaccessibleTrianglesOnLoad , 1 ) ; <nl> - <nl> + DeclareConstIntCVar ( Recorder , 0 ) ; <nl> + DeclareConstIntCVar ( StatsDisplayMode , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawSignalsHistory , 0 ) ; <nl> + DeclareConstIntCVar ( UpdateProxy , 1 ) ; <nl> DeclareConstIntCVar ( LogConsoleVerbosity , 0 ) ; <nl> DeclareConstIntCVar ( LogFileVerbosity , 0 ) ; <nl> DeclareConstIntCVar ( EnableWarningsErrors , 0 ) ; <nl> + DeclareConstIntCVar ( IgnorePlayer , 0 ) ; <nl> <nl> - DeclareConstIntCVar ( Recorder , 0 ) ; <nl> - DeclareConstIntCVar ( StatsDisplayMode , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( VisionMapNumberOfPVSUpdatesPerFrame , 1 ) ; <nl> - DeclareConstIntCVar ( VisionMapNumberOfVisibilityUpdatesPerFrame , 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( DebugDrawVisionMap , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawVisionMapStats , 1 ) ; <nl> - DeclareConstIntCVar ( DebugDrawVisionMapVisibilityChecks , 1 ) ; <nl> - DeclareConstIntCVar ( DebugDrawVisionMapObservers , 1 ) ; <nl> - DeclareConstIntCVar ( DebugDrawVisionMapObserversFOV , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawVisionMapObservables , 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( DrawFireEffectEnabled , 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( AllowedToHitPlayer , 1 ) ; <nl> - DeclareConstIntCVar ( AllowedToHit , 1 ) ; <nl> - DeclareConstIntCVar ( EnableCoolMisses , 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( ForceSerializeAllObjects , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( EnableORCA , 1 ) ; <nl> - DeclareConstIntCVar ( CollisionAvoidanceUpdateVelocities , 1 ) ; <nl> - DeclareConstIntCVar ( CollisionAvoidanceEnableRadiusIncrement , 1 ) ; <nl> - DeclareConstIntCVar ( CollisionAvoidanceClampVelocitiesWithNavigationMesh , 0 ) ; <nl> - DeclareConstIntCVar ( DebugDrawCollisionAvoidance , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( BubblesSystemAlertnessFilter , 7 ) ; <nl> - DeclareConstIntCVar ( BubblesSystemUseDepthTest , 0 ) ; <nl> - DeclareConstIntCVar ( BubblesSystemAllowPrototypeDialogBubbles , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( PathfinderDangerCostForAttentionTarget , 5 ) ; <nl> - DeclareConstIntCVar ( PathfinderDangerCostForExplosives , 2 ) ; <nl> - DeclareConstIntCVar ( PathfinderAvoidanceCostForGroupMates , 2 ) ; <nl> - float PathfinderExplosiveDangerRadius ; <nl> - float PathfinderExplosiveDangerMaxThreatDistance ; <nl> - float PathfinderGroupMatesAvoidanceRadius ; <nl> - <nl> - DeclareConstIntCVar ( DebugMovementSystem , 0 ) ; <nl> - DeclareConstIntCVar ( DebugMovementSystemActorRequests , 0 ) ; <nl> - DeclareConstIntCVar ( OutputPersonalLogToConsole , 0 ) ; <nl> - DeclareConstIntCVar ( DrawModularBehaviorTreeStatistics , 0 ) ; <nl> - DeclareConstIntCVar ( LogModularBehaviorTreeExecutionStacks , 0 ) ; <nl> - <nl> - DeclareConstIntCVar ( MNMPathfinderPositionInTrianglePredictionType , 1 ) ; <nl> - <nl> - DeclareConstIntCVar ( ScriptBind , 1 ) ; <nl> - DeclareConstIntCVar ( CommunicationSystem , 1 ) ; <nl> - DeclareConstIntCVar ( FormationSystem , 1 ) ; <nl> - DeclareConstIntCVar ( GroupSystem , 1 ) ; <nl> - DeclareConstIntCVar ( TacticalPointSystem , 1 ) ; <nl> - <nl> - int MovementSystemPathReplanningEnabled ; <nl> - <nl> - const char * DrawPath ; <nl> - const char * DrawPathAdjustment ; <nl> - <nl> - float TacticalPointUpdateTime ; <nl> - const char * CompatibilityMode ; <nl> - float AllowedTimeForPathfinding ; <nl> - float DrawAgentFOV ; <nl> - const char * FilterAgentName ; <nl> - float AgentStatsDist ; <nl> - int AiSystem ; <nl> - float DebugDrawArrowLabelsVisibilityDistance ; <nl> - <nl> - float CoverPredictTarget ; <nl> - float CoverSpacing ; <nl> - <nl> - const char * StatsTarget ; <nl> - float AIUpdateInterval ; <nl> - <nl> - float CollisionAvoidanceAgentExtraFat ; <nl> - float CollisionAvoidanceRadiusIncrementIncreaseRate ; <nl> - float CollisionAvoidanceRadiusIncrementDecreaseRate ; <nl> - float CollisionAvoidanceRange ; <nl> - float CollisionAvoidanceTargetCutoffRange ; <nl> - float CollisionAvoidancePathEndCutoffRange ; <nl> - float CollisionAvoidanceSmartObjectCutoffRange ; <nl> - float CollisionAvoidanceTimeStep ; <nl> - float CollisionAvoidanceMinSpeed ; <nl> - float CollisionAvoidanceAgentTimeHorizon ; <nl> - float CollisionAvoidanceObstacleTimeHorizon ; <nl> - float DebugCollisionAvoidanceForceSpeed ; <nl> - const char * DebugDrawCollisionAvoidanceAgentName ; <nl> - <nl> - const char * DrawRefPoints ; <nl> - const char * DrawLocate ; <nl> - float DebugDrawOffset ; <nl> - float SteepSlopeUpValue ; <nl> - float SteepSlopeAcrossValue ; <nl> - float ExtraRadiusDuringBeautification ; <nl> - float ExtraForbiddenRadiusDuringBeautification ; <nl> - const char * DrawShooting ; <nl> - const char * DrawAgentStats ; <nl> - <nl> - float SightRangeSuperDarkIllumMod ; <nl> - float SightRangeDarkIllumMod ; <nl> - float SightRangeMediumIllumMod ; <nl> - <nl> - float RODAliveTime ; <nl> - float RODMoveInc ; <nl> - float RODStanceInc ; <nl> - float RODDirInc ; <nl> - float RODAmbientFireInc ; <nl> - float RODKillZoneInc ; <nl> - float RODFakeHitChance ; <nl> - <nl> - float RODKillRangeMod ; <nl> - float RODCombatRangeMod ; <nl> - <nl> - float RODReactionTime ; <nl> - float RODReactionSuperDarkIllumInc ; <nl> - float RODReactionDarkIllumInc ; <nl> - float RODReactionMediumIllumInc ; <nl> - float RODReactionDistInc ; <nl> - float RODReactionDirInc ; <nl> - float RODReactionLeanInc ; <nl> - <nl> - float RODLowHealthMercyTime ; <nl> - <nl> - float RODCoverFireTimeMod ; <nl> - <nl> - int AmbientFireQuota ; <nl> - float AmbientFireUpdateInterval ; <nl> - <nl> - const char * DrawPerceptionHandlerModifiers ; <nl> - const char * TargetTracks_AgentDebugDraw ; <nl> - const char * TargetTracks_ConfigDebugFilter ; <nl> - const char * DrawAgentStatsGroupFilter ; <nl> - <nl> - int DrawSelectedTargets ; <nl> - <nl> - const char * ForceAGAction ; <nl> - const char * ForceAGSignal ; <nl> - const char * ForcePosture ; <nl> - const char * ForceLookAimTarget ; <nl> - <nl> - float BannedNavSoTime ; <nl> - float WaterOcclusionScale ; <nl> - <nl> - float MinActorDynamicObstacleAvoidanceRadius ; <nl> - float ExtraVehicleAvoidanceRadiusBig ; <nl> - float ExtraVehicleAvoidanceRadiusSmall ; <nl> - float ObstacleSizeThreshold ; <nl> - <nl> - int MNMDebugAccessibility ; <nl> - int MNMDebugDrawTileStates ; <nl> - const char * MNMDebugDrawFlag ; <nl> - <nl> - int MNMEditorBackgroundUpdate ; <nl> - <nl> - float MNMPathFinderQuota ; <nl> - int MNMPathFinderDebug ; <nl> - <nl> - int MNMProfileMemory ; <nl> - <nl> - int MNMAllowDynamicRegenInEditor ; <nl> - <nl> - int EnableBubblesSystem ; <nl> - float BubblesSystemFontSize ; <nl> - float BubblesSystemDecayTime ; <nl> - const char * BubblesSystemNameFilter ; <nl> - <nl> - float OverlayMessageDuration ; <nl> - float DrawFireEffectDecayRange ; <nl> - float DrawFireEffectMinDistance ; <nl> - float DrawFireEffectMinTargetFOV ; <nl> - float DrawFireEffectMaxAngle ; <nl> - float DrawFireEffectTimeScale ; <nl> - <nl> - float CoolMissesBoxSize ; <nl> - float CoolMissesBoxHeight ; <nl> - float CoolMissesMinMissDistance ; <nl> - float CoolMissesMaxLightweightEntityMass ; <nl> - float CoolMissesProbability ; <nl> - float CoolMissesCooldown ; <nl> - <nl> - float SmartPathFollower_LookAheadDistance ; <nl> - float SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk ; <nl> - float SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint ; <nl> - float SmartPathFollower_decelerationHuman ; <nl> - float SmartPathFollower_decelerationVehicle ; <nl> - <nl> - float LobThrowMinAllowedDistanceFromFriends ; <nl> - float LobThrowTimePredictionForFriendPositions ; <nl> - float LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation ; <nl> - DeclareConstIntCVar ( LobThrowSimulateRandomInaccuracy , 0 ) ; <nl> - <nl> - int LogSignals ; <nl> - <nl> - / / Modular Behavior Tree <nl> - int ModularBehaviorTree ; <nl> - int ModularBehaviorTreeDebug ; <nl> - int ModularBehaviorTreeDebugTree ; <nl> - int ModularBehaviorTreeDebugVariables ; <nl> - int ModularBehaviorTreeDebugTimestamps ; <nl> - int ModularBehaviorTreeDebugEvents ; <nl> - int ModularBehaviorTreeDebugLog ; <nl> - int ModularBehaviorTreeDebugBlackboard ; <nl> - <nl> - <nl> - float CommunicationManagerHeightThresholdForTargetPosition ; <nl> - <nl> - static void CommTest ( IConsoleCmdArgs * args ) ; <nl> - static void CommTestStop ( IConsoleCmdArgs * args ) ; <nl> - static void CommWriteStats ( IConsoleCmdArgs * args ) ; <nl> - static void CommResetStats ( IConsoleCmdArgs * args ) ; <nl> - static void DebugMNMAgentType ( IConsoleCmdArgs * args ) ; <nl> - static void MNMCalculateAccessibility ( IConsoleCmdArgs * args ) ; / / TODO : Remove when the seeds work <nl> - static void MNMComputeConnectedIslands ( IConsoleCmdArgs * args ) ; <nl> - static void NavigationReloadConfig ( IConsoleCmdArgs * args ) ; <nl> - static void DebugAgent ( IConsoleCmdArgs * args ) ; <nl> - static void AIBubblesNameFilterCallback ( ICVar * pCvar ) ; <nl> - } ; <nl> - <nl> - # endif <nl> + int AiSystem ; <nl> + float OverlayMessageDuration ; <nl> + float AIUpdateInterval ; <nl> + float SteepSlopeUpValue ; <nl> + float SteepSlopeAcrossValue ; <nl> + float WaterOcclusionScale ; <nl> + float DebugDrawOffset ; <nl> + <nl> + SAIConsoleVarsNavigation navigation ; <nl> + SAIConsoleVarsMNMPathfinder pathfinder ; <nl> + SAIConsoleVarsPathFollower pathFollower ; <nl> + SAIConsoleVarsMovement movement ; <nl> + SAIConsoleVarsCollisionAvoidance collisionAvoidance ; <nl> + SAIConsoleVarsVisionMap visionMap ; <nl> + SAIConsoleVarsBehaviorTree behaviorTree ; <nl> + <nl> + / / Legacy CVars <nl> + DeclareConstIntCVar ( LegacyDebugPathFinding , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyDebugDrawBannedNavsos , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyCoverExactPositioning , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyIgnoreVisibilityChecks , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyRecordLog , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyDebugRecordAuto , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyDebugRecordBuffer , 1024 ) ; <nl> + DeclareConstIntCVar ( LegacyDrawAreas , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyScriptBind , 1 ) ; <nl> + DeclareConstIntCVar ( LegacyAdjustPathsAroundDynamicObstacles , 1 ) ; <nl> + DeclareConstIntCVar ( LegacyOutputPersonalLogToConsole , 0 ) ; <nl> + DeclareConstIntCVar ( LegacyPredictivePathFollowing , 1 ) ; <nl> + DeclareConstIntCVar ( LegacyForceSerializeAllObjects , 0 ) ; <nl> + <nl> + int LegacyLogSignals ; <nl> + const char * LegacyCompatibilityMode ; <nl> + const char * LegacyDrawLocate ; <nl> + <nl> + SAIConsoleVarsLegacyCoverSystem legacyCoverSystem ; <nl> + SAIConsoleVarsLegacyBubblesSystem legacyBubblesSystem ; <nl> + SAIConsoleVarsLegacySmartObjects legacySmartObjects ; <nl> + SAIConsoleVarsLegacyTacticalPointSystem legacyTacticalPointSystem ; <nl> + SAIConsoleVarsLegacyCommunicationSystem legacyCommunicationSystem ; <nl> + SAIConsoleVarsLegacyPathObstacles legacyPathObstacles ; <nl> + SAIConsoleVarsLegacyDebugDraw legacyDebugDraw ; <nl> + SAIConsoleVarsLegacyGroupSystem legacyGroupSystem ; <nl> + SAIConsoleVarsLegacyFormation legacyFormationSystem ; <nl> + SAIConsoleVarsLegacyPerception legacyPerception ; <nl> + SAIConsoleVarsLegacyTargetTracking legacyTargetTracking ; <nl> + SAIConsoleVarsLegacyInterestSystem legacyInterestSystem ; <nl> + SAIConsoleVarsLegacyFiring legacyFiring ; <nl> + SAIConsoleVarsLegacyPuppet legacyPuppet ; <nl> + SAIConsoleVarsLegacyPuppetROD legacyPuppetRod ; <nl> + / / ~ Legacy CVars <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / AIDbgRecorder . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIDbgRecorder . cpp <nl> bool CAIDbgRecorder : : IsRecording ( const IAIObject * pTarget , IAIRecordable : : e_AIDb <nl> if ( ! pTarget ) <nl> return false ; <nl> <nl> - return ! strcmp ( gAIEnv . CVars . StatsTarget , " all " ) <nl> - | | ! strcmp ( gAIEnv . CVars . StatsTarget , pTarget - > GetName ( ) ) ; <nl> + return ! strcmp ( gAIEnv . CVars . legacyDebugDraw . StatsTarget , " all " ) <nl> + | | ! strcmp ( gAIEnv . CVars . legacyDebugDraw . StatsTarget , pTarget - > GetName ( ) ) ; <nl> } <nl> <nl> / / <nl> void CAIDbgRecorder : : Record ( const IAIObject * pTarget , IAIRecordable : : e_AIDbgEven <nl> <nl> / / Filter to only log the targets we are interested in <nl> / / I . e . if not " all " and if not our current target , return <nl> - const char * sStatsTarget = gAIEnv . CVars . StatsTarget ; <nl> + const char * sStatsTarget = gAIEnv . CVars . legacyDebugDraw . StatsTarget ; <nl> if ( ( strcmp ( sStatsTarget , " all " ) ! = 0 ) & & ( strcmp ( sStatsTarget , pTarget - > GetName ( ) ) ! = 0 ) ) <nl> return ; <nl> <nl> void CAIDbgRecorder : : InitFileSecondary ( ) const <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> void CAIDbgRecorder : : LogString ( const char * pString ) const <nl> { <nl> - bool mergeWithLog ( gAIEnv . CVars . RecordLog ! = 0 ) ; <nl> + bool mergeWithLog ( gAIEnv . CVars . LegacyRecordLog ! = 0 ) ; <nl> if ( ! mergeWithLog ) <nl> { <nl> if ( m_sFile . empty ( ) ) <nl> mmm a / Code / CryEngine / CryAISystem / AIGroup . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIGroup . cpp <nl> void CAIGroup : : Serialize ( TSerialize ser ) <nl> void CAIGroup : : DebugDraw ( ) <nl> { <nl> / / Debug draw reinforcement logic . <nl> - if ( gAIEnv . CVars . DebugDrawReinforcements = = m_groupID ) <nl> + if ( gAIEnv . CVars . legacyGroupSystem . DebugDrawReinforcements = = m_groupID ) <nl> { <nl> <nl> int totalCount = 0 ; <nl> new file mode 100644 <nl> index 0000000000 . . 7a83c75486 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / AIGroupConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + <nl> + # include " AIGroupConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyGroupSystem : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_GroupSystem " , GroupSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the Group System . \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawGroups " , DebugDrawGroups , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles the AI Groups debugging view . \ n " <nl> + " Usage : ai_DebugDrawGroups [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) . ai_DebugDrawGroups displays groups ' leaders , members and their desired positions . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawGroupTactic " , DrawGroupTactic , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " draw group tactic : 0 = disabled , 1 = draw simple , 2 = draw complex . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawReinforcements " , DebugDrawReinforcements , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables debug draw for reinforcement logic for specified group . \ n " <nl> + " Usage : ai_DebugDrawReinforcements < groupid > , or - 1 to disable . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawAgentStatsGroupFilter " , & DrawAgentStatsGroupFilter , " " , VF_NULL , <nl> + " Filters Debug Draw Agent Stats displays to the specified groupIDs separated by spaces \ n " <nl> + " usage : ai_DrawAgentStatsGroupFilter 1011 1012 " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 813d53d4b2 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / AIGroupConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyGroupSystem <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( GroupSystem , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawGroups , 0 ) ; <nl> + DeclareConstIntCVar ( DrawGroupTactic , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawReinforcements , - 1 ) ; <nl> + <nl> + const char * DrawAgentStatsGroupFilter ; <nl> + } ; <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 5d8e3068a5 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / AILegacyConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + <nl> + # include " AILegacyConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyPathObstacles : : Init ( ) <nl> + { <nl> + REGISTER_CVAR2 ( " ai_MinActorDynamicObstacleAvoidanceRadius " , & MinActorDynamicObstacleAvoidanceRadius , 0 . 6f , VF_NULL , <nl> + " Minimum value in meters to be added to the obstacle ' s own size for actors \ n " <nl> + " ( pathRadius property can override it if bigger ) " ) ; <nl> + REGISTER_CVAR2 ( " ai_ExtraVehicleAvoidanceRadiusBig " , & ExtraVehicleAvoidanceRadiusBig , 4 . 0f , VF_NULL , <nl> + " Value in meters to be added to a big obstacle ' s own size while computing obstacle \ n " <nl> + " size for purposes of vehicle steering . See also ai_ObstacleSizeThreshold . " ) ; <nl> + REGISTER_CVAR2 ( " ai_ExtraVehicleAvoidanceRadiusSmall " , & ExtraVehicleAvoidanceRadiusSmall , 0 . 5f , VF_NULL , <nl> + " Value in meters to be added to a big obstacle ' s own size while computing obstacle \ n " <nl> + " size for purposes of vehicle steering . See also ai_ObstacleSizeThreshold . " ) ; <nl> + REGISTER_CVAR2 ( " ai_ObstacleSizeThreshold " , & ObstacleSizeThreshold , 1 . 2f , VF_NULL , <nl> + " Obstacle size in meters that differentiates small obstacles from big ones so that vehicles can ignore the small ones " ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyPerception : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_DrawTargets " , DrawTargets , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Distance to display the perception events of all enabled puppets . \ n " <nl> + " Displays target type and priority " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_PlayerAffectedByLight " , PlayerAffectedByLight , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Sets if player is affected by light from observable perception checks " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawPerceptionIndicators " , DrawPerceptionIndicators , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws indicators showing enemy current perception level of player " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawPerceptionDebugging " , DrawPerceptionDebugging , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws indicators showing enemy view intersection with perception modifiers " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawPerceptionModifiers " , DrawPerceptionModifiers , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws perception modifier areas in game mode " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugGlobalPerceptionScale " , DebugGlobalPerceptionScale , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws global perception scale multipliers on screen " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_IgnoreVisualStimulus " , IgnoreVisualStimulus , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Have the Perception Handler ignore all visual stimulus always " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_IgnoreSoundStimulus " , IgnoreSoundStimulus , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Have the Perception Handler ignore all sound stimulus always " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_IgnoreBulletRainStimulus " , IgnoreBulletRainStimulus , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Have the Perception Handler ignore all bullet rain stimulus always " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawPerceptionHandlerModifiers " , & DrawPerceptionHandlerModifiers , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws perception handler modifiers on a specific AI \ n " <nl> + " Usage : ai_DrawPerceptionHandlerModifiers AIName \ n " <nl> + " Default is ' none ' . AIName is the name of the AI " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SightRangeSuperDarkIllumMod " , & SightRangeSuperDarkIllumMod , 0 . 25f , VF_NULL , <nl> + " Multiplier for sightrange when the target is in super dark light condition . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SightRangeDarkIllumMod " , & SightRangeDarkIllumMod , 0 . 5f , VF_NULL , <nl> + " Multiplier for sightrange when the target is in dark light condition . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SightRangeMediumIllumMod " , & SightRangeMediumIllumMod , 0 . 8f , VF_NULL , <nl> + " Multiplier for sightrange when the target is in medium light condition . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawAgentFOV " , & DrawAgentFOV , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles the vision cone of the AI agent . \ n " <nl> + " Usage : ai_DrawagentFOV [ 0 . . 1 ] \ n " <nl> + " Default is 0 ( off ) , value 1 will draw the cone all the way to \ n " <nl> + " the sight range , value 0 . 1 will draw the cone to distance of 10 % \ n " <nl> + " of the sight range , etc . ai_DebugDraw must be enabled before \ n " <nl> + " this tool can be used . " ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyInterestSystem : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_InterestSystem " , InterestSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable interest system " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugInterestSystem " , DebugInterest , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Display debugging information on interest system " ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyFiring : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_AmbientFireEnable " , AmbientFireEnable , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable ambient fire system . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawAmbientFire " , DebugDrawAmbientFire , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays fire quota on puppets . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawFireEffectEnabled " , DrawFireEffectEnabled , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enabled AI to sweep fire when starting to shoot after a break . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_AllowedToHitPlayer " , AllowedToHitPlayer , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " If turned off , all agents will miss the player all the time . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_AllowedToHit " , AllowedToHit , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " If turned off , all agents will miss all the time . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_EnableCoolMisses " , EnableCoolMisses , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " If turned on , when agents miss the player , they will pick cool objects to shoot at . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_LobThrowUseRandomForInaccuracySimulation " , LobThrowSimulateRandomInaccuracy , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Uses random variation for simulating inaccuracy in the lob throw . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_AmbientFireQuota " , & AmbientFireQuota , 2 , 0 , <nl> + " Number of units allowed to hit the player at a time . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_AmbientFireUpdateInterval " , & AmbientFireUpdateInterval , 1 . 0f , VF_NULL , <nl> + " Ambient fire update interval . Controls how often puppet ' s ambient fire status is updated . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawFireEffectDecayRange " , & DrawFireEffectDecayRange , 30 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Distance under which the draw fire duration starts decaying linearly . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawFireEffectMinDistance " , & DrawFireEffectMinDistance , 7 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Distance under which the draw fire will be disabled . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawFireEffectMinTargetFOV " , & DrawFireEffectMinTargetFOV , 7 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " FOV under which the draw fire will be disabled . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawFireEffectMaxAngle " , & DrawFireEffectMaxAngle , 5 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Maximum angle actors actors are allowed to go away from their aiming direction during draw fire . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawFireEffectTimeScale " , & DrawFireEffectTimeScale , 1 . 0f , VF_NULL , <nl> + " Scale for the weapon ' s draw fire time setting . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CoolMissesBoxSize " , & CoolMissesBoxSize , 10 . 0f , VF_NULL , <nl> + " Horizontal size of the box to collect potential cool objects to shoot at . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CoolMissesBoxHeight " , & CoolMissesBoxHeight , 2 . 5f , VF_NULL , <nl> + " Vertical size of the box to collect potential cool objects to shoot at . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CoolMissesMinMissDistance " , & CoolMissesMinMissDistance , 7 . 5f , VF_NULL , <nl> + " Maximum distance to go away from the player . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CoolMissesMaxLightweightEntityMass " , & CoolMissesMaxLightweightEntityMass , 20 . 0f , VF_NULL , <nl> + " Maximum mass of a non - destroyable , non - deformable , non - breakable rigid body entity to be considered . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CoolMissesProbability " , & CoolMissesProbability , 0 . 35f , VF_NULL , <nl> + " Agents ' chance to perform a cool miss ! " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CoolMissesCooldown " , & CoolMissesCooldown , 0 . 25f , VF_NULL , <nl> + " Global time between potential cool misses . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_LobThrowMinAllowedDistanceFromFriends " , & LobThrowMinAllowedDistanceFromFriends , 15 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Minimum distance a grenade ( or any object thrown using a lob ) should land from mates to accept the throw trajectory . " ) ; <nl> + REGISTER_CVAR2 ( " ai_LobThrowTimePredictionForFriendPositions " , & LobThrowTimePredictionForFriendPositions , 2 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Time frame used to predict the next position of moving mates to score the landing position of the lob throw " ) ; <nl> + REGISTER_CVAR2 ( " ai_LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation " , & LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation , 0 . 0 , <nl> + VF_CHEAT | VF_CHEAT_NOCHECK , " This value identifies percentage of the distance to the target that will be used to simulate human inaccuracy with parabolic throws . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . c3e618d404 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / AILegacyConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + # include " AIBubblesSystem / AIBubblesSystemConsoleVariables . h " <nl> + # include " Communication / CommunicationConsoleVariables . h " <nl> + # include " Cover / CoverSystemConsoleVariables . h " <nl> + # include " TacticalPointSystem / TacticalPointSystemConsoleVariables . h " <nl> + # include " Formation / FormationConsoleVariables . h " <nl> + # include " TargetSelection / TargetTrackConsoleVariables . h " <nl> + # include " AIGroupConsoleVariables . h " <nl> + # include " SmartObjectsConsoleVariables . h " <nl> + # include " PuppetConsoleVariables . h " <nl> + # include " PuppetRateOfDeathConsoleVariables . h " <nl> + # include " DebugDrawConsoleVariables . h " <nl> + <nl> + struct SAIConsoleVarsLegacyPathObstacles <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + float MinActorDynamicObstacleAvoidanceRadius ; <nl> + float ExtraVehicleAvoidanceRadiusBig ; <nl> + float ExtraVehicleAvoidanceRadiusSmall ; <nl> + float ObstacleSizeThreshold ; <nl> + } ; <nl> + <nl> + struct SAIConsoleVarsLegacyPerception <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( DrawTargets , 0 ) ; <nl> + DeclareConstIntCVar ( PlayerAffectedByLight , 1 ) ; <nl> + DeclareConstIntCVar ( DrawPerceptionIndicators , 0 ) ; <nl> + DeclareConstIntCVar ( DrawPerceptionDebugging , 0 ) ; <nl> + DeclareConstIntCVar ( DrawPerceptionModifiers , 0 ) ; <nl> + DeclareConstIntCVar ( DebugGlobalPerceptionScale , 0 ) ; <nl> + DeclareConstIntCVar ( IgnoreVisualStimulus , 0 ) ; <nl> + DeclareConstIntCVar ( IgnoreSoundStimulus , 0 ) ; <nl> + DeclareConstIntCVar ( IgnoreBulletRainStimulus , 0 ) ; <nl> + <nl> + const char * DrawPerceptionHandlerModifiers ; <nl> + float SightRangeSuperDarkIllumMod ; <nl> + float SightRangeDarkIllumMod ; <nl> + float SightRangeMediumIllumMod ; <nl> + float DrawAgentFOV ; <nl> + } ; <nl> + <nl> + struct SAIConsoleVarsLegacyInterestSystem <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( InterestSystem , 1 ) ; <nl> + DeclareConstIntCVar ( DebugInterest , 0 ) ; <nl> + } ; <nl> + <nl> + struct SAIConsoleVarsLegacyFiring <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( AmbientFireEnable , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawAmbientFire , 0 ) ; <nl> + DeclareConstIntCVar ( DrawFireEffectEnabled , 1 ) ; <nl> + DeclareConstIntCVar ( AllowedToHitPlayer , 1 ) ; <nl> + DeclareConstIntCVar ( AllowedToHit , 1 ) ; <nl> + DeclareConstIntCVar ( EnableCoolMisses , 1 ) ; <nl> + DeclareConstIntCVar ( LobThrowSimulateRandomInaccuracy , 0 ) ; <nl> + <nl> + int AmbientFireQuota ; <nl> + float AmbientFireUpdateInterval ; <nl> + float DrawFireEffectDecayRange ; <nl> + float DrawFireEffectMinDistance ; <nl> + float DrawFireEffectMinTargetFOV ; <nl> + float DrawFireEffectMaxAngle ; <nl> + float DrawFireEffectTimeScale ; <nl> + float CoolMissesBoxSize ; <nl> + float CoolMissesBoxHeight ; <nl> + float CoolMissesMinMissDistance ; <nl> + float CoolMissesMaxLightweightEntityMass ; <nl> + float CoolMissesProbability ; <nl> + float CoolMissesCooldown ; <nl> + float LobThrowMinAllowedDistanceFromFriends ; <nl> + float LobThrowTimePredictionForFriendPositions ; <nl> + float LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / AILightManager . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AILightManager . cpp <nl> void CAILightManager : : Update ( bool forceUpdate ) <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> void CAILightManager : : DebugDraw ( ) <nl> { <nl> - int mode = gAIEnv . CVars . DebugDrawLightLevel ; <nl> + int mode = gAIEnv . CVars . legacyDebugDraw . DebugDrawLightLevel ; <nl> if ( mode = = 0 ) <nl> return ; <nl> <nl> mmm a / Code / CryEngine / CryAISystem / AIObject . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIObject . cpp <nl> bool CAIObject : : ShouldSerialize ( ) const <nl> if ( ! m_serialize ) <nl> return false ; <nl> <nl> - if ( gAIEnv . CVars . ForceSerializeAllObjects = = 0 ) <nl> + if ( gAIEnv . CVars . LegacyForceSerializeAllObjects = = 0 ) <nl> { <nl> IEntity * pEntity = GetEntity ( ) ; <nl> return pEntity ? ( ( pEntity - > GetFlags ( ) & ENTITY_FLAG_NO_SAVE ) = = 0 ) : true ; <nl> mmm a / Code / CryEngine / CryAISystem / AIPlayer . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIPlayer . cpp <nl> float CAIPlayer : : AdjustTargetVisibleRange ( const CAIActor & observer , float fVisib <nl> { <nl> / / case AILL_LIGHT : SOMSpeed <nl> case AILL_MEDIUM : <nl> - fRangeScale * = gAIEnv . CVars . SightRangeMediumIllumMod ; <nl> + fRangeScale * = gAIEnv . CVars . legacyPerception . SightRangeMediumIllumMod ; <nl> break ; <nl> case AILL_DARK : <nl> - fRangeScale * = gAIEnv . CVars . SightRangeDarkIllumMod ; <nl> + fRangeScale * = gAIEnv . CVars . legacyPerception . SightRangeDarkIllumMod ; <nl> break ; <nl> case AILL_SUPERDARK : <nl> - fRangeScale * = gAIEnv . CVars . SightRangeSuperDarkIllumMod ; <nl> + fRangeScale * = gAIEnv . CVars . legacyPerception . SightRangeSuperDarkIllumMod ; <nl> break ; <nl> } <nl> } <nl> float CAIPlayer : : AdjustTargetVisibleRange ( const CAIActor & observer , float fVisib <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> bool CAIPlayer : : IsAffectedByLight ( ) const <nl> { <nl> - return ( gAIEnv . CVars . PlayerAffectedByLight ! = 0 | | <nl> + return ( gAIEnv . CVars . legacyPerception . PlayerAffectedByLight ! = 0 | | <nl> MyBase : : IsAffectedByLight ( ) ) ; <nl> } <nl> <nl> void CAIPlayer : : Update ( EUpdateType type ) <nl> CollectExposedCover ( ) ; <nl> <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - if ( gAIEnv . CVars . DebugDrawDamageControl > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageControl > 0 ) <nl> UpdateHealthHistory ( ) ; <nl> # endif <nl> <nl> void CAIPlayer : : Event ( unsigned short eType , SAIEVENT * pEvent ) <nl> case AIEVENT_LOWHEALTH : <nl> { <nl> const float scale = ( pEvent ! = NULL ) ? pEvent - > fThreat : 1 . 0f ; <nl> - m_mercyTimer = gAIEnv . CVars . RODLowHealthMercyTime * scale ; <nl> + m_mercyTimer = gAIEnv . CVars . legacyPuppetRod . RODLowHealthMercyTime * scale ; <nl> } <nl> break ; <nl> case AIEVENT_ENABLE : <nl> bool CAIPlayer : : GetMissLocation ( const Vec3 & shootPos , const Vec3 & shootDir , floa <nl> <nl> void CAIPlayer : : NotifyMissLocationConsumed ( ) <nl> { <nl> - m_coolMissCooldown + = gAIEnv . CVars . CoolMissesCooldown ; <nl> + m_coolMissCooldown + = gAIEnv . CVars . legacyFiring . CoolMissesCooldown ; <nl> } <nl> <nl> / / <nl> void CAIPlayer : : DebugDraw ( ) <nl> if ( IsLowHealthPauseActive ( ) ) <nl> { <nl> ICVar * pLowHealth = gEnv - > pConsole - > GetCVar ( " g_playerLowHealthThreshold " ) ; <nl> - dc - > Draw2dLabel ( 150 , 190 , 2 . 0f , color , true , " Mercy % . 2f / % . 2f ( when below % 0 . 2f ) " , m_mercyTimer , gAIEnv . CVars . RODLowHealthMercyTime , pLowHealth - > GetFVal ( ) ) ; <nl> + dc - > Draw2dLabel ( 150 , 190 , 2 . 0f , color , true , " Mercy % . 2f / % . 2f ( when below % 0 . 2f ) " , m_mercyTimer , gAIEnv . CVars . legacyPuppetRod . RODLowHealthMercyTime , pLowHealth - > GetFVal ( ) ) ; <nl> } <nl> <nl> for ( unsigned i = 0 , ni = m_exposedCoverObjects . size ( ) ; i < ni ; + + i ) <nl> mmm a / Code / CryEngine / CryAISystem / AIRecorder . cpp <nl> ppp b / Code / CryEngine / CryAISystem / AIRecorder . cpp <nl> void CAIRecorder : : OnReset ( IAISystem : : EResetReason reason ) <nl> / / if ( ! gEnv - > IsEditor ( ) ) <nl> / / return ; <nl> <nl> - if ( gAIEnv . CVars . DebugRecordAuto = = 0 ) <nl> + if ( gAIEnv . CVars . LegacyDebugRecordAuto = = 0 ) <nl> return ; <nl> <nl> const bool bIsSerializingFile = 0 ! = gEnv - > pSystem - > IsSerializingFile ( ) ; <nl> void CAIRecorder : : Start ( EAIRecorderMode mode , const char * filename ) <nl> } <nl> <nl> / / File is closed , so we have the chance to adjust buffer size <nl> - int newBufferSize = gAIEnv . CVars . DebugRecordBuffer ; <nl> + int newBufferSize = gAIEnv . CVars . LegacyDebugRecordBuffer ; <nl> newBufferSize = clamp_tpl ( newBufferSize , 128 , 1024000 ) ; <nl> if ( newBufferSize ! = m_lowLevelFileBufferSize ) <nl> { <nl> new file mode 100644 <nl> index 0000000000 . . 33194212e4 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / BehaviorTree / BehaviorTreeConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " BehaviorTreeConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsBehaviorTree : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_DrawModularBehaviorTreeStatistics " , DrawModularBehaviorTreeStatistics , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draw modular behavior statistics to the screen . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_ModularBehaviorTreeDebugExecutionStacks " , LogModularBehaviorTreeExecutionStacks , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 2 ] Enable / Disable logging of the execution stacks of modular behavior trees to individual files in the MBT_Logs directory . \ n " <nl> + " 0 - Off \ n " <nl> + " 1 - Log execution stacks of only the currently selected agent \ n " <nl> + " 2 - Log execution stacks of all currently active agents " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ModularBehaviorTree " , & ModularBehaviorTree , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the usage of the modular behavior tree system . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugTree " , & ModularBehaviorTreeDebugTree , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree execution . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugVariables " , & ModularBehaviorTreeDebugVariables , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s variables . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugTimestamps " , & ModularBehaviorTreeDebugTimestamps , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the debug text of the modular behavior tree ' s timestamps . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugEvents " , & ModularBehaviorTreeDebugEvents , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s events . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugLog " , & ModularBehaviorTreeDebugLog , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s log . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ModularBehaviorTreeDebugBlackboard " , & ModularBehaviorTreeDebugBlackboard , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the debug text of the behavior tree ' s blackboards . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 1d9b70661f <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / BehaviorTree / BehaviorTreeConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsBehaviorTree <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( DrawModularBehaviorTreeStatistics , 0 ) ; <nl> + DeclareConstIntCVar ( LogModularBehaviorTreeExecutionStacks , 0 ) ; <nl> + <nl> + int ModularBehaviorTree ; <nl> + int ModularBehaviorTreeDebugTree ; <nl> + int ModularBehaviorTreeDebugVariables ; <nl> + int ModularBehaviorTreeDebugTimestamps ; <nl> + int ModularBehaviorTreeDebugEvents ; <nl> + int ModularBehaviorTreeDebugLog ; <nl> + int ModularBehaviorTreeDebugBlackboard ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / BehaviorTree / BehaviorTreeManager . cpp <nl> ppp b / Code / CryEngine / CryAISystem / BehaviorTree / BehaviorTreeManager . cpp <nl> void BehaviorTreeManager : : Update ( const CTimeValue frameStartTime , const float fr <nl> UpdateDebugVisualization ( updateContext , entityId , debugTree , instance , agentEntity ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . LogModularBehaviorTreeExecutionStacks = = 1 & & debugThisAgent | | gAIEnv . CVars . LogModularBehaviorTreeExecutionStacks = = 2 ) <nl> + if ( gAIEnv . CVars . behaviorTree . LogModularBehaviorTreeExecutionStacks = = 1 & & debugThisAgent | | gAIEnv . CVars . behaviorTree . LogModularBehaviorTreeExecutionStacks = = 2 ) <nl> { <nl> UpdateExecutionStackLogging ( updateContext , entityId , debugTree , instance ) ; <nl> } <nl> void BehaviorTreeManager : : UpdateDebugVisualization ( UpdateContext updateContext , <nl> # endif / / DEBUG_MODULAR_BEHAVIOR_TREE <nl> <nl> # ifdef DEBUG_VARIABLE_COLLECTION <nl> - if ( gAIEnv . CVars . ModularBehaviorTreeDebugVariables ) <nl> + if ( gAIEnv . CVars . behaviorTree . ModularBehaviorTreeDebugVariables ) <nl> { <nl> Variables : : DebugHelper : : DebugDraw ( true , instance . variables , instance . behaviorTreeTemplate - > variableDeclarations ) ; <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / BehaviorTree / TreeVisualizer . cpp <nl> ppp b / Code / CryEngine / CryAISystem / BehaviorTree / TreeVisualizer . cpp <nl> void TreeVisualizer : : Draw ( <nl> const Blackboard & blackboard , <nl> const MessageQueue & eventsLog ) <nl> { <nl> - if ( gAIEnv . CVars . ModularBehaviorTreeDebugTree ) <nl> + if ( gAIEnv . CVars . behaviorTree . ModularBehaviorTreeDebugTree ) <nl> { <nl> const DebugNode * firstNode = tree . GetFirstNode ( ) . get ( ) ; <nl> if ( firstNode ) <nl> void TreeVisualizer : : Draw ( <nl> } <nl> } <nl> <nl> - if ( gAIEnv . CVars . ModularBehaviorTreeDebugLog ) <nl> + if ( gAIEnv . CVars . behaviorTree . ModularBehaviorTreeDebugLog ) <nl> { <nl> DrawBehaviorLog ( behaviorLog ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . ModularBehaviorTreeDebugTimestamps ) <nl> + if ( gAIEnv . CVars . behaviorTree . ModularBehaviorTreeDebugTimestamps ) <nl> { <nl> DrawTimestampCollection ( timestampCollection ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . ModularBehaviorTreeDebugBlackboard ) <nl> + if ( gAIEnv . CVars . behaviorTree . ModularBehaviorTreeDebugBlackboard ) <nl> { <nl> DrawBlackboard ( blackboard ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . ModularBehaviorTreeDebugEvents ) <nl> + if ( gAIEnv . CVars . behaviorTree . ModularBehaviorTreeDebugEvents ) <nl> { <nl> DrawEventLog ( eventsLog ) ; <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / CAISystem . cpp <nl> ppp b / Code / CryEngine / CryAISystem / CAISystem . cpp <nl> void CAISystem : : SetAIHacksConfiguration ( ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / TODO This is hack support and should go away at some point ! <nl> / / Set the compatibility mode for feature / setting emulation <nl> - const char * sValue = gAIEnv . CVars . CompatibilityMode ; <nl> + const char * sValue = gAIEnv . CVars . LegacyCompatibilityMode ; <nl> <nl> EConfigCompatabilityMode eCompatMode = ECCM_CRYSIS2 ; <nl> <nl> void CAISystem : : SetupAIEnvironment ( ) <nl> <nl> void CAISystem : : TrySubsystemInitScriptBind ( ) <nl> { <nl> - if ( gAIEnv . CVars . ScriptBind ) <nl> + if ( gAIEnv . CVars . LegacyScriptBind ) <nl> { <nl> if ( m_pScriptAI = = nullptr ) <nl> { <nl> void CAISystem : : TrySubsystemInitScriptBind ( ) <nl> / / ensure the available communications are ready before the AI scripts get loaded ( they in turn might load GoalPipes and other stuff that depend on communication data ) <nl> void CAISystem : : TrySubsystemInitCommunicationSystem ( ) <nl> { <nl> - if ( gAIEnv . CVars . CommunicationSystem ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . CommunicationSystem ) <nl> { <nl> if ( gAIEnv . pCommunicationManager = = nullptr ) <nl> { <nl> void CAISystem : : TrySubsystemInitCommunicationSystem ( ) <nl> <nl> void CAISystem : : TrySubsystemInitFormationSystem ( ) <nl> { <nl> - if ( gAIEnv . CVars . FormationSystem ) <nl> + if ( gAIEnv . CVars . legacyFormationSystem . FormationSystem ) <nl> { <nl> if ( gAIEnv . pFormationManager = = nullptr ) <nl> { <nl> void CAISystem : : TrySubsystemInitFormationSystem ( ) <nl> <nl> void CAISystem : : TrySubsystemInitGroupSystem ( ) <nl> { <nl> - if ( gAIEnv . CVars . GroupSystem ) <nl> + if ( gAIEnv . CVars . legacyGroupSystem . GroupSystem ) <nl> { <nl> if ( gAIEnv . pGroupManager = = nullptr ) <nl> { <nl> void CAISystem : : TrySubsystemInitGroupSystem ( ) <nl> <nl> void CAISystem : : TrySubsystemInitTacticalPointSystem ( ) <nl> { <nl> - if ( gAIEnv . CVars . TacticalPointSystem ) <nl> + if ( gAIEnv . CVars . legacyTacticalPointSystem . TacticalPointSystem ) <nl> { <nl> if ( gAIEnv . pTacticalPointSystem = = nullptr ) <nl> { <nl> void CAISystem : : TrySubsystemInitTacticalPointSystem ( ) <nl> <nl> void CAISystem : : TrySubsystemInitORCA ( ) <nl> { <nl> - if ( gAIEnv . CVars . EnableORCA ) <nl> + if ( gAIEnv . CVars . collisionAvoidance . EnableORCA ) <nl> { <nl> if ( gAIEnv . pCollisionAvoidanceSystem = = nullptr ) <nl> { <nl> void CAISystem : : TrySubsystemInitORCA ( ) <nl> <nl> void CAISystem : : TrySubsystemInitTargetTrackSystem ( ) <nl> { <nl> - if ( gAIEnv . CVars . TargetTracking ) <nl> + if ( gAIEnv . CVars . legacyTargetTracking . TargetTracking ) <nl> { <nl> if ( gAIEnv . pTargetTrackManager = = nullptr ) <nl> { <nl> void CAISystem : : Reset ( IAISystem : : EResetReason reason ) <nl> if ( ! m_bInitialized ) <nl> return ; <nl> <nl> - const char * sStatsTarget = gAIEnv . CVars . StatsTarget ; <nl> + const char * sStatsTarget = gAIEnv . CVars . legacyDebugDraw . StatsTarget ; <nl> if ( ( * sStatsTarget ! = ' \ 0 ' ) & & ( stricmp ( " none " , sStatsTarget ) ! = 0 ) ) <nl> Record ( NULL , IAIRecordable : : E_RESET , NULL ) ; <nl> <nl> float CAISystem : : GetRayPerceptionModifier ( const Vec3 & start , const Vec3 & end , co <nl> float fPerception = 1 . 0f ; <nl> Vec3 hit ; <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - int icvDrawPerceptionDebugging = gAIEnv . CVars . DrawPerceptionDebugging ; <nl> + int icvDrawPerceptionDebugging = gAIEnv . CVars . legacyPerception . DrawPerceptionDebugging ; <nl> # endif <nl> PerceptionModifierShapeMap : : iterator pmsi = m_mapPerceptionModifiers . begin ( ) , pmsiEnd = m_mapPerceptionModifiers . end ( ) ; <nl> for ( ; pmsi ! = pmsiEnd ; + + pmsi ) <nl> void CAISystem : : Serialize ( TSerialize ser ) <nl> gAIEnv . pObjectContainer - > Serialize ( ser ) ; <nl> ser . EndGroup ( ) ; <nl> <nl> - if ( gAIEnv . CVars . ForceSerializeAllObjects ) <nl> + if ( gAIEnv . CVars . LegacyForceSerializeAllObjects ) <nl> { <nl> ser . Value ( " ObjectOwners " , gAIEnv . pAIObjectManager - > m_Objects ) ; <nl> ser . Value ( " MapDummyObjects " , gAIEnv . pAIObjectManager - > m_mapDummyObjects ) ; <nl> void CAISystem : : NotifyDeath ( IAIObject * pVictim ) <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> bool CAISystem : : WouldHumanBeVisible ( const Vec3 & footPos , bool fullCheck ) const <nl> { <nl> - int ignore = gAIEnv . CVars . IgnoreVisibilityChecks ; <nl> + int ignore = gAIEnv . CVars . LegacyIgnoreVisibilityChecks ; <nl> if ( ignore ) <nl> return false ; <nl> <nl> mmm a / Code / CryEngine / CryAISystem / CAISystem . h <nl> ppp b / Code / CryEngine / CryAISystem / CAISystem . h <nl> class CAISystem : <nl> const ColorB & worldColor , bool drawWorld ) ; <nl> void DebugDrawCrowdControl ( ) ; <nl> void DebugDrawRadar ( ) ; <nl> - void DebugDrawDistanceLUT ( ) ; <nl> void DrawRadarPath ( CPipeUser * pPipeUser , const Matrix34 & world , const Matrix34 & screen ) ; <nl> void DebugDrawRecorderRange ( ) const ; <nl> void DebugDrawShooting ( ) const ; <nl> mmm a / Code / CryEngine / CryAISystem / CAISystemUpdate . cpp <nl> ppp b / Code / CryEngine / CryAISystem / CAISystemUpdate . cpp <nl> void CAISystem : : TryUpdateDebugFakeDamageIndicators ( ) <nl> } <nl> <nl> / / Update fake damage indicators <nl> - if ( gAIEnv . CVars . DrawFakeDamageInd > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawFakeDamageInd > 0 ) <nl> { <nl> for ( unsigned i = 0 ; i < m_DEBUG_fakeDamageInd . size ( ) ; ) <nl> { <nl> void CAISystem : : SubsystemUpdateSystemComponents ( ) <nl> void CAISystem : : SubsystemUpdateCommunicationManager ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) <nl> - if ( gAIEnv . CVars . CommunicationSystem ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . CommunicationSystem ) <nl> { <nl> CRY_ASSERT ( gAIEnv . pCommunicationManager ) ; <nl> gAIEnv . pCommunicationManager - > Update ( m_frameDeltaTime ) ; <nl> void CAISystem : : TrySubsystemUpdateAuditionMap ( const CTimeValue frameStartTime , c <nl> void CAISystem : : SubsystemUpdateGroupManager ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) <nl> - if ( gAIEnv . CVars . GroupSystem ) <nl> + if ( gAIEnv . CVars . legacyGroupSystem . GroupSystem ) <nl> { <nl> CRY_ASSERT ( gAIEnv . pGroupManager ) ; <nl> gAIEnv . pGroupManager - > Update ( m_frameDeltaTime ) ; <nl> void CAISystem : : SubsystemUpdateInterestManager ( ) <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) <nl> ICentralInterestManager * pInterestManager = CCentralInterestManager : : GetInstance ( ) ; <nl> CRY_ASSERT ( pInterestManager ) ; <nl> - if ( pInterestManager - > Enable ( gAIEnv . CVars . InterestSystem ! = 0 ) ) <nl> + if ( pInterestManager - > Enable ( gAIEnv . CVars . legacyInterestSystem . InterestSystem ! = 0 ) ) <nl> pInterestManager - > Update ( m_frameDeltaTime ) ; <nl> } <nl> <nl> void CAISystem : : TrySubsystemUpdateBehaviorTreeManager ( const CTimeValue frameStar <nl> void CAISystem : : SubsystemUpdateTacticalPointSystem ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) <nl> - if ( gAIEnv . CVars . TacticalPointSystem ) <nl> + if ( gAIEnv . CVars . legacyTacticalPointSystem . TacticalPointSystem ) <nl> { <nl> CRY_ASSERT ( gAIEnv . pTacticalPointSystem ) ; <nl> - gAIEnv . pTacticalPointSystem - > Update ( gAIEnv . CVars . TacticalPointUpdateTime ) ; <nl> + gAIEnv . pTacticalPointSystem - > Update ( gAIEnv . CVars . legacyTacticalPointSystem . TacticalPointUpdateTime ) ; <nl> } <nl> } <nl> <nl> void CAISystem : : SubsystemUpdateAmbientFire ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - if ( gAIEnv . CVars . AmbientFireEnable = = 0 ) <nl> + if ( gAIEnv . CVars . legacyFiring . AmbientFireEnable = = 0 ) <nl> return ; <nl> <nl> int64 dt ( ( GetFrameStartTime ( ) - m_lastAmbientFireUpdateTime ) . GetMilliSecondsAsInt64 ( ) ) ; <nl> - if ( dt < ( int ) ( gAIEnv . CVars . AmbientFireUpdateInterval * 1000 . 0f ) ) <nl> + if ( dt < ( int ) ( gAIEnv . CVars . legacyFiring . AmbientFireUpdateInterval * 1000 . 0f ) ) <nl> return ; <nl> <nl> / / Marcio : Update ambient fire towards all players . <nl> void CAISystem : : SubsystemUpdateAmbientFire ( ) <nl> std : : sort ( shooters . begin ( ) , shooters . end ( ) ) ; <nl> <nl> uint32 i = 0 ; <nl> - uint32 quota = gAIEnv . CVars . AmbientFireQuota ; <nl> + uint32 quota = gAIEnv . CVars . legacyFiring . AmbientFireQuota ; <nl> <nl> for ( TShooters : : iterator it = shooters . begin ( ) ; it ! = shooters . end ( ) ; + + it ) <nl> { <nl> void CAISystem : : SubsystemUpdateTargetTrackManager ( ) <nl> void CAISystem : : SubsystemUpdateCollisionAvoidanceSystem ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) <nl> - if ( gAIEnv . CVars . EnableORCA ) <nl> + if ( gAIEnv . CVars . collisionAvoidance . EnableORCA ) <nl> gAIEnv . pCollisionAvoidanceSystem - > Update ( m_frameDeltaTime ) ; <nl> } <nl> <nl> mmm a / Code / CryEngine / CryAISystem / CMakeLists . txt <nl> ppp b / Code / CryEngine / CryAISystem / CMakeLists . txt <nl> add_sources ( " CryAISystem_ai_object_uber . cpp " <nl> " AIVehicle . cpp " <nl> " PostureManager . cpp " <nl> " Puppet . cpp " <nl> + " PuppetConsoleVariables . cpp " <nl> " PuppetPhys . cpp " <nl> " PuppetRateOfDeath . cpp " <nl> + " PuppetRateOfDeathConsoleVariables . cpp " <nl> " PersonalLog . h " <nl> " ActorLookUp . h " <nl> " Adapters . h " <nl> add_sources ( " CryAISystem_ai_object_uber . cpp " <nl> " AIVehicle . h " <nl> " PostureManager . h " <nl> " Puppet . h " <nl> + " PuppetConsoleVariables . h " <nl> + " PuppetRateOfDeathConsoleVariables . h " <nl> " AIEntityComponent . cpp " <nl> " AIEntityComponent . h " <nl> SOURCE_GROUP " AIObject \ \ \ \ PipeUserMovement \ \ \ \ PipeUser " <nl> add_sources ( " CryAISystem_ai_object_uber . cpp " <nl> " LeaderAction . cpp " <nl> " UnitAction . cpp " <nl> " UnitImg . cpp " <nl> + " AIGroupConsoleVariables . cpp " <nl> " AIGroup . h " <nl> " BlackBoard . h " <nl> " Leader . h " <nl> " LeaderAction . h " <nl> " UnitAction . h " <nl> " UnitImg . h " <nl> + " AIGroupConsoleVariables . h " <nl> SOURCE_GROUP " AIObject \ \ \ \ Formation " <nl> " Formation / AIFormationDescriptor . h " <nl> " Formation / Formation . cpp " <nl> " Formation / Formation . h " <nl> " Formation / FormationManager . cpp " <nl> " Formation / FormationManager . h " <nl> + " Formation / FormationConsoleVariables . h " <nl> + " Formation / FormationConsoleVariables . cpp " <nl> ) <nl> <nl> add_sources ( " CryAISystem_helpers_uber . cpp " <nl> add_sources ( " CryAISystem_helpers_uber . cpp " <nl> " AIMemStats . cpp " <nl> " AIRecorder . cpp " <nl> " DebugDraw . cpp " <nl> + " DebugDrawConsoleVariables . cpp " <nl> " StatsManager . cpp " <nl> " AIDbgRecorder . h " <nl> " AIDebugDrawHelpers . h " <nl> add_sources ( " CryAISystem_helpers_uber . cpp " <nl> " DebugDrawContext . h " <nl> " NullAIDebugRenderer . h " <nl> " StatsManager . h " <nl> + " DebugDrawConsoleVariables . h " <nl> SOURCE_GROUP " Helpers \ \ \ \ Debug \ \ \ \ AIBubblesSystem " <nl> " AIBubblesSystem / AIBubblesSystemImpl . cpp " <nl> " AIBubblesSystem / AIBubblesSystemImpl . h " <nl> " AIBubblesSystem / AIBubblesSystem . h " <nl> + " AIBubblesSystem / AIBubblesSystemConsoleVariables . cpp " <nl> + " AIBubblesSystem / AIBubblesSystemConsoleVariables . h " <nl> ) <nl> <nl> add_sources ( " CryAISystem_navigation_uber_0 . cpp " <nl> add_sources ( " CryAISystem_navigation_uber_0 . cpp " <nl> " PathFollower . cpp " <nl> " PathMarker . cpp " <nl> " SmartPathFollower . cpp " <nl> + " PathFollowerConsoleVariables . cpp " <nl> + " MNMPathfinderConsoleVariables . cpp " <nl> " MNMPathfinder . h " <nl> " Navigation / PathHolder . h " <nl> " NavPath . h " <nl> " PathFollower . h " <nl> " PathMarker . h " <nl> " SmartPathFollower . h " <nl> + " MNMPathfinderConsoleVariables . h " <nl> + " PathFollowerConsoleVariables . h " <nl> ) <nl> <nl> add_sources ( " CryAISystem_navigation_uber_1 . cpp " <nl> add_sources ( " CryAISystem_navigation_uber_1 . cpp " <nl> " Navigation / NavigationSystem / OffMeshNavigationManager . cpp " <nl> " Navigation / NavigationSystem / VolumesManager . cpp " <nl> " Navigation / NavigationSystem / WorldMonitor . cpp " <nl> + " Navigation / NavigationSystem / NavigationConsoleVariables . cpp " <nl> " Navigation / NavigationSystemSchematyc . cpp " <nl> " Navigation / NavigationSystem / AnnotationsLibrary . h " <nl> " Navigation / NavigationSystem / IslandConnectionsManager . h " <nl> add_sources ( " CryAISystem_navigation_uber_1 . cpp " <nl> " Navigation / NavigationSystem / OffMeshNavigationManager . h " <nl> " Navigation / NavigationSystem / VolumesManager . h " <nl> " Navigation / NavigationSystem / WorldMonitor . h " <nl> + " Navigation / NavigationSystem / NavigationConsoleVariables . h " <nl> " Navigation / NavigationSystemSchematyc . h " <nl> ) <nl> <nl> add_sources ( " CryAISystem_uber_0 . cpp " <nl> SOURCE_GROUP " Perception " <nl> " GlobalPerceptionScaleHandler . cpp " <nl> " VisionMap . cpp " <nl> + " VisionMapConsoleVariables . cpp " <nl> " Perception / PerceptionSystemSchematyc . cpp " <nl> " GlobalPerceptionScaleHandler . h " <nl> " VisionMap . h " <nl> + " VisionMapConsoleVariables . h " <nl> " Perception / PerceptionSystemSchematyc . h " <nl> SOURCE_GROUP " Perception \ \ \ \ AuditionMap " <nl> " AuditionMap / AuditionMap . cpp " <nl> add_sources ( " CryAISystem_uber_0 . cpp " <nl> " TargetSelection / TargetTrackManager . cpp " <nl> " TargetSelection / TargetTrackModifiers . h " <nl> " TargetSelection / TargetTrackModifiers . cpp " <nl> + " TargetSelection / TargetTrackConsoleVariables . h " <nl> + " TargetSelection / TargetTrackConsoleVariables . cpp " <nl> SOURCE_GROUP " Scripting " <nl> " ScriptBind_AI . cpp " <nl> " ScriptBind_AI . h " <nl> add_sources ( " CryAISystem_uber_0 . cpp " <nl> " SmartObjects . h " <nl> " SmartObjectOffMeshNavigation . cpp " <nl> " SmartObjectOffMeshNavigation . h " <nl> + " SmartObjectsConsoleVariables . cpp " <nl> + " SmartObjectsConsoleVariables . h " <nl> ) <nl> <nl> add_sources ( " CryAISystem_uber_1 . cpp " <nl> add_sources ( " CryAISystem_uber_1 . cpp " <nl> " Cover / DynamicCoverManager . cpp " <nl> " Cover / EntityCoverSampler . cpp " <nl> " Cover / CoverSystemSchematyc . cpp " <nl> + " Cover / CoverSystemConsoleVariables . cpp " <nl> " Cover / Cover . h " <nl> " Cover / CoverSampler . h " <nl> " Cover / CoverScorer . h " <nl> add_sources ( " CryAISystem_uber_1 . cpp " <nl> " Cover / DynamicCoverManager . h " <nl> " Cover / EntityCoverSampler . h " <nl> " Cover / CoverSystemSchematyc . h " <nl> + " Cover / CoverSystemConsoleVariables . h " <nl> SOURCE_GROUP " Factions " <nl> " Factions / FactionMap . cpp " <nl> " Factions / FactionSystem . cpp " <nl> add_sources ( " CryAISystem_uber_2 . cpp " <nl> " Communication / CommunicationManager . h " <nl> " Communication / CommunicationPlayer . h " <nl> " Communication / CommunicationTestManager . h " <nl> + " Communication / CommunicationConsoleVariables . h " <nl> + " Communication / CommunicationConsoleVariables . cpp " <nl> SOURCE_GROUP " System " <nl> " AIConsoleVariables . cpp " <nl> + " AILegacyConsoleVariables . cpp " <nl> " CSignal . cpp " <nl> " CAISystem . cpp " <nl> " CAISystemPhys . cpp " <nl> add_sources ( " CryAISystem_uber_2 . cpp " <nl> " Environment . cpp " <nl> " ObjectContainer . cpp " <nl> " AIConsoleVariables . h " <nl> + " AILegacyConsoleVariables . h " <nl> " CSignal . h " <nl> " CAISystem . h " <nl> " Configuration . h " <nl> add_sources ( " CryAISystem_uber_3 . cpp " <nl> " Movement / MovementPlan . cpp " <nl> " Movement / MovementSystem . cpp " <nl> " Movement / MovementSystemCreator . cpp " <nl> + " Movement / MovementConsoleVariables . cpp " <nl> " Movement / MovementActor . h " <nl> " Movement / MovementPlanner . h " <nl> " Movement / MovementPlan . h " <nl> " Movement / MovementSystem . h " <nl> " Movement / MovementSystemCreator . h " <nl> + " Movement / MovementConsoleVariables . h " <nl> SOURCE_GROUP " Tactical Point System " <nl> " TacticalPointSystem / TacticalPointQuery . cpp " <nl> " TacticalPointSystem / TacticalPointSystem . cpp " <nl> " TacticalPointSystem / TacticalPointQuery . h " <nl> " TacticalPointSystem / TacticalPointQueryEnum . h " <nl> " TacticalPointSystem / TacticalPointSystem . h " <nl> + " TacticalPointSystem / TacticalPointSystemConsoleVariables . h " <nl> + " TacticalPointSystem / TacticalPointSystemConsoleVariables . cpp " <nl> ) <nl> <nl> add_sources ( " CryAISystem_uber_4 . cpp " <nl> add_sources ( " CryAISystem_uber_4 . cpp " <nl> " BehaviorTree / BehaviorTreeNodeRegistration . cpp " <nl> " BehaviorTree / ExecutionStackFileLogger . cpp " <nl> " BehaviorTree / ExecutionStackFileLogger . h " <nl> + " BehaviorTree / BehaviorTreeConsoleVariables . h " <nl> + " BehaviorTree / BehaviorTreeConsoleVariables . cpp " <nl> SOURCE_GROUP " Game Specific " <nl> " GameSpecific / GoalOp_Crysis2 . h " <nl> " GameSpecific / GoalOp_Crysis2 . cpp " <nl> add_sources ( " CryAISystem_uber_6 . cpp " <nl> SOURCE_GROUP " Collision Avoidance " <nl> " CollisionAvoidance / CollisionAvoidanceSystem . h " <nl> " CollisionAvoidance / CollisionAvoidanceSystem . cpp " <nl> + " CollisionAvoidance / CollisionAvoidanceConsoleVariables . h " <nl> + " CollisionAvoidance / CollisionAvoidanceConsoleVariables . cpp " <nl> SOURCE_GROUP " Goals " <nl> " GoalOp . h " <nl> " GoalOp . cpp " <nl> new file mode 100644 <nl> index 0000000000 . . 7659341a4d <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / CollisionAvoidance / CollisionAvoidanceConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + <nl> + # include " CollisionAvoidanceConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsCollisionAvoidance : : Init ( ) <nl> + { <nl> + / / is not cheat protected because it changes during game , depending on your settings <nl> + DefineConstIntCVarName ( " ai_EnableORCA " , EnableORCA , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable obstacle avoidance system . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_CollisionAvoidanceUpdateVelocities " , CollisionAvoidanceUpdateVelocities , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable / disable agents updating their velocities after processing collision avoidance . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_CollisionAvoidanceEnableRadiusIncrement " , CollisionAvoidanceEnableRadiusIncrement , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable / disable agents adding an increment to their collision avoidance radius when moving . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_CollisionAvoidanceClampVelocitiesWithNavigationMesh " , CollisionAvoidanceClampVelocitiesWithNavigationMesh , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable / Disable the clamping of the speed resulting from ORCA with the navigation mesh " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawCollisionAvoidance " , DebugDrawCollisionAvoidance , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable debugging obstacle avoidance system . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceAgentExtraFat " , & CollisionAvoidanceAgentExtraFat , 0 . 025f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Extra radius to use in Collision Avoidance calculations as a buffer . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceRadiusIncrementIncreaseRate " , & CollisionAvoidanceRadiusIncrementIncreaseRate , 0 . 25f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Increase rate of the collision avoidance radius increment . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceRadiusIncrementDecreaseRate " , & CollisionAvoidanceRadiusIncrementDecreaseRate , 2 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Decrease rate of the collision avoidance radius increment . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceRange " , & CollisionAvoidanceRange , 10 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Range for collision avoidance . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceTargetCutoffRange " , & CollisionAvoidanceTargetCutoffRange , 3 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Distance from it ' s current target for an agent to stop avoiding obstacles . Other actors will still avoid the agent . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidancePathEndCutoffRange " , & CollisionAvoidancePathEndCutoffRange , 0 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Distance from it ' s current path end for an agent to stop avoiding obstacles . Other actors will still avoid the agent . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceSmartObjectCutoffRange " , & CollisionAvoidanceSmartObjectCutoffRange , 1 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Distance from it ' s next smart object for an agent to stop avoiding obstacles . Other actors will still avoid the agent . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceTimestep " , & CollisionAvoidanceTimeStep , 0 . 1f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " TimeStep used to calculate an agent ' s collision free velocity . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceMinSpeed " , & CollisionAvoidanceMinSpeed , 0 . 2f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Minimum speed allowed to be used by ORCA . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceAgentTimeHorizon " , & CollisionAvoidanceAgentTimeHorizon , 2 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Time horizon used to calculate an agent ' s collision free velocity against other agents . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CollisionAvoidanceObstacleTimeHorizon " , & CollisionAvoidanceObstacleTimeHorizon , 1 . 5f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Time horizon used to calculate an agent ' s collision free velocity against static obstacles . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DebugCollisionAvoidanceForceSpeed " , & DebugCollisionAvoidanceForceSpeed , 0 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Force agents velocity to it ' s current direction times the specified value . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DebugDrawCollisionAvoidanceAgentName " , & DebugDrawCollisionAvoidanceAgentName , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Name of the agent to draw collision avoidance data for . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 0fff446da3 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / CollisionAvoidance / CollisionAvoidanceConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsCollisionAvoidance <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( EnableORCA , 1 ) ; <nl> + DeclareConstIntCVar ( CollisionAvoidanceUpdateVelocities , 1 ) ; <nl> + DeclareConstIntCVar ( CollisionAvoidanceEnableRadiusIncrement , 1 ) ; <nl> + DeclareConstIntCVar ( CollisionAvoidanceClampVelocitiesWithNavigationMesh , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCollisionAvoidance , 0 ) ; <nl> + <nl> + float CollisionAvoidanceAgentExtraFat ; <nl> + float CollisionAvoidanceRadiusIncrementIncreaseRate ; <nl> + float CollisionAvoidanceRadiusIncrementDecreaseRate ; <nl> + float CollisionAvoidanceRange ; <nl> + float CollisionAvoidanceTargetCutoffRange ; <nl> + float CollisionAvoidancePathEndCutoffRange ; <nl> + float CollisionAvoidanceSmartObjectCutoffRange ; <nl> + float CollisionAvoidanceTimeStep ; <nl> + float CollisionAvoidanceMinSpeed ; <nl> + float CollisionAvoidanceAgentTimeHorizon ; <nl> + float CollisionAvoidanceObstacleTimeHorizon ; <nl> + float DebugCollisionAvoidanceForceSpeed ; <nl> + const char * DebugDrawCollisionAvoidanceAgentName ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / CollisionAvoidance / CollisionAvoidanceSystem . cpp <nl> ppp b / Code / CryEngine / CryAISystem / CollisionAvoidance / CollisionAvoidanceSystem . cpp <nl> void CCollisionAvoidanceSystem : : PopulateState ( ) <nl> <nl> void CCollisionAvoidanceSystem : : ApplyResults ( float updateTime ) <nl> { <nl> - if ( gAIEnv . CVars . CollisionAvoidanceUpdateVelocities | | gAIEnv . CVars . CollisionAvoidanceEnableRadiusIncrement ) <nl> + if ( gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceUpdateVelocities | | gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceEnableRadiusIncrement ) <nl> { <nl> for ( size_t i = 0 , count = m_avoidingAgentsPtrs . size ( ) ; i < count ; + + i ) <nl> { <nl> void CCollisionAvoidanceSystem : : Update ( float updateTime ) <nl> m_nearbyAgents . clear ( ) ; <nl> m_nearbyObstacles . clear ( ) ; <nl> <nl> - const float range = gAIEnv . CVars . CollisionAvoidanceRange ; <nl> + const float range = gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceRange ; <nl> <nl> ComputeNearbyObstacles ( agent , index , range , m_nearbyObstacles ) ; <nl> ComputeNearbyAgents ( agent , index , range , m_nearbyAgents ) ; <nl> void CCollisionAvoidanceSystem : : Update ( float updateTime ) <nl> size_t vertexCount = ComputeFeasibleArea ( & m_constraintLines . front ( ) , constraintCount , agent . maxSpeed , <nl> feasibleArea ) ; <nl> <nl> - float minSpeed = gAIEnv . CVars . CollisionAvoidanceMinSpeed ; <nl> + float minSpeed = gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceMinSpeed ; <nl> <nl> SCandidateVelocity candidates [ FeasibleAreaMaxVertexCount + 1 ] ; / / + 1 for clipped desired velocity <nl> size_t candidateCount = ComputeOptimalAvoidanceVelocity ( feasibleArea , vertexCount , agent , minSpeed , agent . maxSpeed , & candidates [ 0 ] ) ; <nl> void CCollisionAvoidanceSystem : : Update ( float updateTime ) <nl> if ( debugDraw ) <nl> { <nl> const char * szAgentName = m_avoidingAgentsPtrs [ index ] - > GetDebugName ( ) ; <nl> - if ( * gAIEnv . CVars . DebugDrawCollisionAvoidanceAgentName & & szAgentName <nl> - & & ! stricmp ( szAgentName , gAIEnv . CVars . DebugDrawCollisionAvoidanceAgentName ) ) <nl> + if ( * gAIEnv . CVars . collisionAvoidance . DebugDrawCollisionAvoidanceAgentName & & szAgentName <nl> + & & ! stricmp ( szAgentName , gAIEnv . CVars . collisionAvoidance . DebugDrawCollisionAvoidanceAgentName ) ) <nl> { <nl> const Vec3 agentLocation = agent . currentLocation ; <nl> <nl> void CCollisionAvoidanceSystem : : ComputeObstacleConstraintLine ( const SAgentParams <nl> static const float heuristicWeightForDistance = 0 . 01f ; <nl> static const float minimumTimeHorizonScale = 0 . 25f ; <nl> const float adjustedTimeHorizonScale = max ( min ( timeHorizonScale , ( heuristicWeightForDistance * distanceSq ) ) , minimumTimeHorizonScale ) ; <nl> - const float TimeHorizon = gAIEnv . CVars . CollisionAvoidanceObstacleTimeHorizon * adjustedTimeHorizonScale ; <nl> + const float TimeHorizon = gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceObstacleTimeHorizon * adjustedTimeHorizonScale ; <nl> const float invTimeHorizon = 1 . 0f / TimeHorizon ; <nl> <nl> Vec2 u ; <nl> Vec2 CCollisionAvoidanceSystem : : ClampSpeedWithNavigationMesh ( const SNavigationPr <nl> const Vec3 & currentVelocity , const Vec2 & velocityToClamp ) const <nl> { <nl> Vec2 outputVelocity = velocityToClamp ; <nl> - if ( gAIEnv . CVars . CollisionAvoidanceClampVelocitiesWithNavigationMesh = = 1 ) <nl> + if ( gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceClampVelocitiesWithNavigationMesh = = 1 ) <nl> { <nl> - const float invTimeHorizon = 1 . 0f / gAIEnv . CVars . CollisionAvoidanceAgentTimeHorizon ; <nl> - const float TimeStep = gAIEnv . CVars . CollisionAvoidanceTimeStep ; <nl> + const float invTimeHorizon = 1 . 0f / gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceAgentTimeHorizon ; <nl> + const float TimeStep = gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceTimeStep ; <nl> <nl> const Vec3 from = agentPosition ; <nl> const Vec3 to = agentPosition + Vec3 ( velocityToClamp . x , velocityToClamp . y , 0 . 0f ) ; <nl> void CCollisionAvoidanceSystem : : ComputeAgentConstraintLine ( const SAgentParams & a <nl> const float radiiSq = sqr ( radii ) ; <nl> <nl> const float TimeHorizon = timeHorizonScale * <nl> - ( reciprocal ? gAIEnv . CVars . CollisionAvoidanceAgentTimeHorizon : gAIEnv . CVars . CollisionAvoidanceObstacleTimeHorizon ) ; <nl> - const float TimeStep = gAIEnv . CVars . CollisionAvoidanceTimeStep ; <nl> + ( reciprocal ? gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceAgentTimeHorizon : gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceObstacleTimeHorizon ) ; <nl> + const float TimeStep = gAIEnv . CVars . collisionAvoidance . CollisionAvoidanceTimeStep ; <nl> <nl> const float invTimeHorizon = 1 . 0f / TimeHorizon ; <nl> const float invTimeStep = 1 . 0f / TimeStep ; <nl> new file mode 100644 <nl> index 0000000000 . . 43f1ac96fd <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Communication / CommunicationConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + <nl> + # include " CommunicationConsoleVariables . h " <nl> + # include " Communication / CommunicationManager . h " <nl> + # include " Communication / CommunicationTestManager . h " <nl> + <nl> + void SAIConsoleVarsLegacyCommunicationSystem : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_CommunicationSystem " , CommunicationSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the Communication subsystem . \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawCommunication " , DebugDrawCommunication , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays communication debug information . \ n " <nl> + " Usage : ai_DebugDrawCommunication [ 0 / 1 / 2 ] \ n " <nl> + " 0 - disabled . ( default ) . \ n " <nl> + " 1 - draw playing and queued comms . \ n " <nl> + " 2 - draw debug history for each entity . \ n " <nl> + " 5 - extended debugging ( to log ) " <nl> + " 6 - outputs info about each line played " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawCommunicationHistoryDepth " , DebugDrawCommunicationHistoryDepth , 5 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Tweaks how many historical entries are displayed per entity . \ n " <nl> + " Usage : ai_DebugDrawCommunicationHistoryDepth [ depth ] " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_RecordCommunicationStats " , RecordCommunicationStats , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Turns on / off recording of communication stats to a log . \ n " <nl> + " Usage : ai_RecordCommunicationStats [ 0 / 1 ] \ n " <nl> + ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CommunicationManagerHeighThresholdForTargetPosition " , & CommunicationManagerHeightThresholdForTargetPosition , 5 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Defines the threshold used to detect if the target is above or below the entity that wants to play a communication . \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_CommunicationForceTestVoicePack " , CommunicationForceTestVoicePack , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Forces all the AI agents to use a test voice pack . The test voice pack will have the specified name in the archetype " <nl> + " or in the entity and the system will replace the _XX number with the _test string " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_commTest " , CommTest , VF_NULL , <nl> + " Tests communication for the specified AI actor . \ n " <nl> + " If no communication name is specified all communications will be played . \ n " <nl> + " Usage : ai_commTest < actorName > [ commName ] \ n " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_commTestStop " , CommTestStop , VF_NULL , <nl> + " Stop currently playing communication for the specified AI actor . \ n " <nl> + " Usage : ai_commTestStop < actorName > \ n " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_writeCommStats " , CommWriteStats , VF_NULL , <nl> + " Dumps current statistics to log file . \ n " <nl> + " Usage : ai_writeCommStats \ n " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_resetCommStats " , CommResetStats , VF_NULL , <nl> + " Resets current communication statistics . \ n " <nl> + " Usage : ai_resetCommStats \ n " ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyCommunicationSystem : : CommTest ( IConsoleCmdArgs * args ) <nl> + { <nl> + if ( args - > GetArgCount ( ) < 2 ) <nl> + { <nl> + AIWarning ( " < CommTest > Expecting actorName as parameter . " ) ; <nl> + <nl> + return ; <nl> + } <nl> + <nl> + CAIActor * actor = 0 ; <nl> + <nl> + if ( IEntity * entity = gEnv - > pEntitySystem - > FindEntityByName ( args - > GetArg ( 1 ) ) ) <nl> + if ( IAIObject * aiObject = entity - > GetAI ( ) ) <nl> + actor = aiObject - > CastToCAIActor ( ) ; <nl> + <nl> + if ( ! actor ) <nl> + { <nl> + AIWarning ( " < CommTest > Could not find entity named ' % s ' or it ' s not an actor . " , args - > GetArg ( 1 ) ) ; <nl> + <nl> + return ; <nl> + } <nl> + <nl> + const char * commName = 0 ; <nl> + <nl> + if ( args - > GetArgCount ( ) > 2 ) <nl> + commName = args - > GetArg ( 2 ) ; <nl> + <nl> + int variationNumber = 0 ; <nl> + <nl> + if ( args - > GetArgCount ( ) > 3 ) <nl> + variationNumber = atoi ( args - > GetArg ( 3 ) ) ; <nl> + <nl> + gAIEnv . pCommunicationManager - > GetTestManager ( ) . StartFor ( actor - > GetEntityID ( ) , commName , variationNumber ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyCommunicationSystem : : CommTestStop ( IConsoleCmdArgs * args ) <nl> + { <nl> + if ( args - > GetArgCount ( ) < 2 ) <nl> + { <nl> + AIWarning ( " < CommTest > Expecting actorName as parameter . " ) ; <nl> + <nl> + return ; <nl> + } <nl> + <nl> + CAIActor * actor = 0 ; <nl> + <nl> + if ( IEntity * entity = gEnv - > pEntitySystem - > FindEntityByName ( args - > GetArg ( 1 ) ) ) <nl> + if ( IAIObject * aiObject = entity - > GetAI ( ) ) <nl> + actor = aiObject - > CastToCAIActor ( ) ; <nl> + <nl> + if ( ! actor ) <nl> + { <nl> + AIWarning ( " < CommTest > Could not find entity named ' % s ' or it ' s not an actor . " , args - > GetArg ( 1 ) ) ; <nl> + <nl> + return ; <nl> + } <nl> + <nl> + gAIEnv . pCommunicationManager - > GetTestManager ( ) . Stop ( actor - > GetEntityID ( ) ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyCommunicationSystem : : CommWriteStats ( IConsoleCmdArgs * args ) <nl> + { <nl> + gAIEnv . pCommunicationManager - > WriteStatistics ( ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsLegacyCommunicationSystem : : CommResetStats ( IConsoleCmdArgs * args ) <nl> + { <nl> + gAIEnv . pCommunicationManager - > ResetStatistics ( ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . a2f0d09451 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Communication / CommunicationConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyCommunicationSystem <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + static void CommTest ( IConsoleCmdArgs * args ) ; <nl> + static void CommTestStop ( IConsoleCmdArgs * args ) ; <nl> + static void CommWriteStats ( IConsoleCmdArgs * args ) ; <nl> + static void CommResetStats ( IConsoleCmdArgs * args ) ; <nl> + <nl> + DeclareConstIntCVar ( CommunicationSystem , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCommunication , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCommunicationHistoryDepth , 5 ) ; <nl> + DeclareConstIntCVar ( RecordCommunicationStats , 0 ) ; <nl> + DeclareConstIntCVar ( CommunicationForceTestVoicePack , 0 ) ; <nl> + <nl> + float CommunicationManagerHeightThresholdForTargetPosition ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / Communication / CommunicationManager . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Communication / CommunicationManager . cpp <nl> void CCommunicationManager : : Update ( float updateTime ) <nl> <nl> CullPlayingCommunications ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCommunication > 1 & & gAIEnv . CVars . DebugDraw > 0 & & gAIEnv . CVars . DebugDrawCommunication ! = 6 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication > 1 & & gAIEnv . CVars . DebugDraw > 0 & & gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication ! = 6 ) <nl> UpdateDebugHistory ( updateTime ) ; <nl> } <nl> <nl> void CCommunicationManager : : DebugDraw ( ) <nl> } <nl> <nl> / / Draw the history of comms for each entity as 2d labels <nl> - if ( gAIEnv . CVars . DebugDrawCommunication > 1 & & gAIEnv . CVars . DebugDrawCommunication ! = 6 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication > 1 & & gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication ! = 6 ) <nl> { <nl> float offset = 0 . 0f ; <nl> <nl> void CCommunicationManager : : DebugDraw ( ) <nl> <nl> int numberDisplayed = 0 ; <nl> for ( std : : vector < CommDebugEntry > : : reverse_iterator entryIt = entityEntries . rbegin ( ) ; <nl> - entryIt ! = entityEntries . rend ( ) & & numberDisplayed < gAIEnv . CVars . DebugDrawCommunicationHistoryDepth ; <nl> + entryIt ! = entityEntries . rend ( ) & & numberDisplayed < gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunicationHistoryDepth ; <nl> + + entryIt , + + numberDisplayed ) <nl> { <nl> CommDebugEntry & entry = * entryIt ; <nl> CommPlayID CCommunicationManager : : PlayCommunication ( SCommunicationRequest & reque <nl> if ( ! m_playGenID ) <nl> + + m_playGenID . id ; <nl> <nl> - if ( gAIEnv . CVars . RecordCommunicationStats > 0 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . RecordCommunicationStats > 0 ) <nl> { <nl> / / Record the request here if statistics are being generated <nl> CommDebugCount & commCount = m_debugStatisticsMap [ CommKeys ( request . configID , request . commID ) ] ; <nl> void CCommunicationManager : : StopCommunication ( const CommPlayID & playID ) <nl> UpdateGlobalListeners ( CommunicationCancelled , playing . actorID , m_player . GetCommunicationID ( playID ) ) ; <nl> <nl> # if ! defined ( EXCLUDE_NORMAL_LOG ) <nl> - if ( gAIEnv . CVars . DebugDrawCommunication = = 5 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 5 ) <nl> { <nl> CommID commID = m_player . GetCommunicationID ( playID ) ; <nl> CryLogAlways ( " CommunicationManager : : StopCommunication : % s [ % u ] as playID [ % u ] " , GetCommunicationName ( commID ) , commID . id , playID . id ) ; <nl> void CCommunicationManager : : OnCommunicationFinished ( const CommPlayID & playID , ui <nl> UpdateGlobalListeners ( CommunicationFinished , playing . actorID , m_player . GetCommunicationID ( playID ) ) ; <nl> <nl> # if ! defined ( EXCLUDE_NORMAL_LOG ) <nl> - if ( gAIEnv . CVars . DebugDrawCommunication = = 5 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 5 ) <nl> { <nl> CommID commID = m_player . GetCommunicationID ( playID ) ; <nl> CryLogAlways ( " CommunicationManager : : OnCommunicationFinished : % s [ % u ] as playID [ % u ] " , GetCommunicationName ( commID ) , commID . id , playID . id ) ; <nl> void CCommunicationManager : : OnCommunicationFinished ( const CommPlayID & playID , ui <nl> m_playing . erase ( it ) ; <nl> <nl> } <nl> - else if ( gAIEnv . CVars . DebugDrawCommunication = = 5 ) <nl> + else if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 5 ) <nl> { <nl> CommID commID = m_player . GetCommunicationID ( playID ) ; <nl> CryWarning ( VALIDATOR_MODULE_AI , VALIDATOR_WARNING , " CommunicationManager : : OnCommunicationFinished - for unknown playID : % s [ % u ] as playID [ % u ] " , GetCommunicationName ( commID ) , commID . id , playID . id ) ; <nl> bool CCommunicationManager : : Play ( const CommPlayID & playID , SCommunicationRequest <nl> <nl> if ( canChooseVariation & & m_player . Play ( playID , request , comm , variation , this , ( void * ) ( EXPAND_PTR ) request . channelID . id ) ) <nl> { <nl> - if ( gAIEnv . CVars . RecordCommunicationStats > 0 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . RecordCommunicationStats > 0 ) <nl> { <nl> / / Record the request here if statistics are being generated <nl> CommDebugCount & commCount = m_debugStatisticsMap [ CommKeys ( request . configID , request . commID ) ] ; <nl> bool CCommunicationManager : : Play ( const CommPlayID & playID , SCommunicationRequest <nl> playResult = true ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCommunication = = 5 | | gAIEnv . CVars . DebugDrawCommunication = = 6 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 5 | | gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 6 ) <nl> { <nl> stack_string communicationPlayResult = canChooseVariation ? " PLAYED " : " NOT PLAYED " ; <nl> stack_string variationIndex ; <nl> void CCommunicationManager : : UpdateStateOfInternalVariables ( const SCommunicationR <nl> <nl> void CCommunicationManager : : UpdateStateOfTargetAboveBelowVariables ( const Vec3 & entityPos , const Vec3 & targetPos ) <nl> { <nl> - const float heightThreshold = gAIEnv . CVars . CommunicationManagerHeightThresholdForTargetPosition ; <nl> + const float heightThreshold = gAIEnv . CVars . legacyCommunicationSystem . CommunicationManagerHeightThresholdForTargetPosition ; <nl> const float heightDifference = targetPos . z - entityPos . z ; <nl> if ( heightDifference > heightThreshold ) <nl> { <nl> mmm a / Code / CryEngine / CryAISystem / Communication / CommunicationPlayer . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Communication / CommunicationPlayer . cpp <nl> void CommunicationPlayer : : PlayState : : OnCommunicationEvent ( <nl> break ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCommunication = = 5 & & prevFlags ! = finishedFlags ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 5 & & prevFlags ! = finishedFlags ) <nl> { <nl> if ( finishedFlags ! = FinishedAll ) <nl> { <nl> void CommunicationPlayer : : Update ( float updateTime ) <nl> <nl> PlayingCommunications : : iterator erased = it + + ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCommunication = = 5 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 5 ) <nl> CryLogAlways ( " CommunicationPlayer removed finished : % s [ % u ] as playID [ % u ] with listener [ % p ] " , gAIEnv . pCommunicationManager - > GetCommunicationName ( erased - > second . commID ) , erased - > second . commID . id , erased - > first . id , erased - > second . listener ) ; <nl> <nl> m_playing . erase ( erased ) ; <nl> void CommunicationPlayer : : Stop ( const CommPlayID & playID ) <nl> <nl> CleanUpPlayState ( playID , playState ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCommunication = = 5 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication = = 5 ) <nl> { <nl> CryLogAlways ( " CommunicationPlayer finished playing : % s [ % u ] as playID [ % u ] " , gAIEnv . pCommunicationManager - > GetCommunicationName ( playState . commID ) , playState . commID . id , it - > first . id ) ; <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / Cover / CoverSampler . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Cover / CoverSampler . cpp <nl> float CoverSampler : : SampleHeightInterval ( const Vec3 & position , const Vec3 & dir , <nl> { <nl> Vec3 top = position + CoverUp * interval ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCoverSampler & 2 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverSampler & 2 ) <nl> { <nl> GetAISystem ( ) - > AddDebugLine ( top , top + dir , 92 , 192 , 0 , 3 . 0f ) ; <nl> } <nl> float CoverSampler : : SampleHeightInterval ( const Vec3 & position , const Vec3 & dir , <nl> if ( surfaceType ) <nl> * surfaceType = result . surfaceType ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCoverSampler & 4 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverSampler & 4 ) <nl> { <nl> GetAISystem ( ) - > AddDebugLine ( result . position , result . position + result . normal , 0 , 128 , 192 , 3 . 0f ) ; <nl> } <nl> bool CoverSampler : : SampleFloor ( const Vec3 & position , float searchHeight , float s <nl> Vec3 center = position + CoverUp * ( searchHeight * 0 . 5f ) ; <nl> Vec3 dir = CoverUp * - searchHeight ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCoverSampler & 1 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverSampler & 1 ) <nl> { <nl> GetAISystem ( ) - > AddDebugLine ( center , center + dir , 214 , 164 , 96 , 3 . 0f ) ; <nl> GetAISystem ( ) - > AddDebugSphere ( center , 0 . 1f , 210 , 183 , 135 , 3 . 0f ) ; <nl> float CoverSampler : : SampleWidthInterval ( EDirection direction , float interval , fl <nl> m_state . depth = depth ; <nl> m_state . edgeHeight = height ; <nl> } <nl> - else if ( gAIEnv . CVars . DebugDrawCoverSampler & 8 ) <nl> + else if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverSampler & 8 ) <nl> { <nl> GetAISystem ( ) - > AddDebugSphere ( sample . position , 0 . 035f , 255 , 0 , 0 , 3 . 0f ) ; <nl> GetAISystem ( ) - > AddDebugLine ( sample . position + CoverUp * CoverOffsetUp , floor + CoverUp * CoverOffsetUp , 255 , 0 , 0 , 3 . 0f ) ; <nl> bool CoverSampler : : CheckClearance ( const Vec3 & floor , const Vec3 & floorNormal , co <nl> / * <nl> <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - if ( gAIEnv . CVars . DebugDrawCoverSampler & 16 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverSampler & 16 ) <nl> { <nl> Vec3 center = floor + CoverUp * ( slopeOffset + ( maxHeight - slopeOffset ) * 0 . 5f ) ; <nl> <nl> mmm a / Code / CryEngine / CryAISystem / Cover / CoverSurface . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Cover / CoverSurface . cpp <nl> bool CoverSurface : : CalculatePathCoverage ( const Vec3 & eye , const CoverPath & cover <nl> <nl> FindCoverPlanes ( eyeLoc , leftPlane , rightPlane ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCoverPlanes ! = 0 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverPlanes ! = 0 ) <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> void CoverSurface : : DebugDraw ( ) const <nl> } <nl> <nl> / / Locations <nl> - if ( gAIEnv . CVars . DebugDrawCoverLocations ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverLocations ) <nl> { <nl> uint32 locationCount = m_locations . size ( ) ; <nl> for ( uint32 i = 0 ; i < locationCount ; + + i ) <nl> mmm a / Code / CryEngine / CryAISystem / Cover / CoverSystem . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Cover / CoverSystem . cpp <nl> bool CCoverSystem : : IsCoverPhysicallyOccupiedByAnyOtherCoverUser ( const CoverID & c <nl> { <nl> const ICoverUser : : Params & params = coverUserSearchingForEmptySpace . GetParams ( ) ; <nl> const Vec3 locationToTest = GetCoverLocation ( coverID , params . distanceToCover ) ; <nl> - const float occupyRadius = params . inCoverRadius + gAIEnv . CVars . CoverSpacing ; <nl> + const float occupyRadius = params . inCoverRadius + gAIEnv . CVars . legacyCoverSystem . CoverSpacing ; <nl> const EntityId entityIdToSkip = params . userID ; <nl> <nl> for ( auto it = m_occupied . cbegin ( ) ; it ! = m_occupied . cend ( ) ; + + it ) <nl> void CCoverSystem : : Update ( const CTimeValue frameStartTime , const float frameTime <nl> void CCoverSystem : : DebugDraw ( ) <nl> { <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - if ( gAIEnv . CVars . DebugDrawCoverOccupancy > 0 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCoverOccupancy > 0 ) <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> void CCoverSystem : : DebugDraw ( ) <nl> } <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCover = = 5 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCover = = 5 ) <nl> { <nl> CDebugDrawContext dc ; <nl> dc - > TextToScreen ( 0 , 60 , " CoverLocationCache size : % " PRISIZE_T , m_coverLocationCache . size ( ) ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCover ! = 2 ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCover ! = 2 ) <nl> return ; <nl> <nl> const CCamera & cam = gEnv - > pSystem - > GetViewCamera ( ) ; <nl> new file mode 100644 <nl> index 0000000000 . . 0226151250 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Cover / CoverSystemConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + <nl> + # include " CoverSystemConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyCoverSystem : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_CoverSystem " , CoverSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables the cover system . \ n " <nl> + " Usage : ai_CoverSystem [ 0 / 1 ] \ n " <nl> + " Default is 1 ( on ) \ n " <nl> + " 0 - off - use anchors \ n " <nl> + " 1 - use offline cover surfaces \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawCover " , DebugDrawCover , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays cover debug information . \ n " <nl> + " Usage : ai_DebugDrawCover [ 0 / 1 / 2 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - currently being used \ n " <nl> + " 2 - all in 50m range ( slow ) \ n " ) ; <nl> + DefineConstIntCVarName ( " ai_DebugDrawCoverOccupancy " , DebugDrawCoverOccupancy , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Renders red balls at the location of occupied cover . \ n " <nl> + " Usage : ai_DebugDrawCoverOccupancy [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - render red balls at the location of occupied cover \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawCoverPlanes " , DebugDrawCoverPlanes , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays cover planes . \ n " <nl> + " Usage : ai_DebugDrawCoverPlanes [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " ) ; <nl> + DefineConstIntCVarName ( " ai_DebugDrawCoverLocations " , DebugDrawCoverLocations , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays cover locations . \ n " <nl> + " Usage : ai_DebugDrawCoverLocations [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " ) ; <nl> + DefineConstIntCVarName ( " ai_DebugDrawCoverSampler " , DebugDrawCoverSampler , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays cover sampler debug rendering . \ n " <nl> + " Usage : ai_DebugDrawCoverSampler [ 0 / 1 / 2 / 3 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - display floor sampling \ n " <nl> + " 2 - display surface sampling \ n " <nl> + " 3 - display both \ n " ) ; <nl> + DefineConstIntCVarName ( " ai_DebugDrawDynamicCoverSampler " , DebugDrawDynamicCoverSampler , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays dynamic cover sampler debug rendering . \ n " <nl> + " Usage : ai_DebugDrawDynamicCoverSampler [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - on \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_CoverPredictTarget " , & CoverPredictTarget , 1 . 0f , VF_NULL , <nl> + " Enables simple cover system target location prediction . \ n " <nl> + " Usage : ai_CoverPredictTarget x \ n " <nl> + " Default x is 0 . 0 ( off ) \ n " <nl> + " x - how many seconds to look ahead \ n " ) ; <nl> + REGISTER_CVAR2 ( " ai_CoverSpacing " , & CoverSpacing , 0 . 5f , VF_NULL , <nl> + " Minimum spacing between agents when choosing cover . \ n " <nl> + " Usage : ai_CoverPredictTarget < x > \ n " <nl> + " x - Spacing width in meters \ n " ) ; <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . 7a472633a3 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Cover / CoverSystemConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyCoverSystem <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( CoverSystem , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCover , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCoverOccupancy , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCoverPlanes , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCoverLocations , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCoverSampler , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawDynamicCoverSampler , 0 ) ; <nl> + <nl> + float CoverPredictTarget ; <nl> + float CoverSpacing ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / Cover / EntityCoverSampler . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Cover / EntityCoverSampler . cpp <nl> void EntityCoverSampler : : Update ( const CTimeValue frameStartTime , const float upd <nl> <nl> ICoverSampler : : ESamplerState state = m_sampler - > Update ( 0 . 00025f ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawDynamicCoverSampler ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawDynamicCoverSampler ) <nl> m_sampler - > DebugDraw ( ) ; <nl> <nl> if ( state ! = ICoverSampler : : InProgress ) <nl> void EntityCoverSampler : : Update ( const CTimeValue frameStartTime , const float upd <nl> break ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawDynamicCoverSampler ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawDynamicCoverSampler ) <nl> DebugDraw ( ) ; <nl> } <nl> <nl> mmm a / Code / CryEngine / CryAISystem / DebugDraw . cpp <nl> ppp b / Code / CryEngine / CryAISystem / DebugDraw . cpp <nl> void CAISystem : : DebugDrawDamageControlGraph ( ) const <nl> <nl> static std : : vector < Vec3 > values ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawDamageControl > 2 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageControl > 2 ) <nl> { <nl> / / Combined graph <nl> static std : : vector < CAIActor * > targets ; <nl> void CAISystem : : DebugDrawFakeDamageInd ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - int mode = gAIEnv . CVars . DrawFakeDamageInd ; <nl> + int mode = gAIEnv . CVars . legacyDebugDraw . DrawFakeDamageInd ; <nl> <nl> CAIObject * pPlayer = GetPlayer ( ) ; <nl> if ( pPlayer ) <nl> void CAISystem : : DebugDrawFakeDamageInd ( ) const <nl> } <nl> <nl> / / Draw ambient fire indicators <nl> - if ( gAIEnv . CVars . DebugDrawDamageControl > 1 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageControl > 1 ) <nl> { <nl> const Vec3 & playerPos = pPlayer - > GetPos ( ) ; <nl> AIObjectOwners : : const_iterator aio = gAIEnv . pAIObjectManager - > m_Objects . find ( AIOBJECT_ACTOR ) ; <nl> void CAISystem : : DebugDrawForceAGSignal ( ) const <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> ColorB colorRed ( 255 , 0 , 0 ) ; <nl> - const char * szInput = gAIEnv . CVars . ForceAGSignal ; <nl> + const char * szInput = gAIEnv . CVars . legacyPuppet . ForceAGSignal ; <nl> <nl> CDebugDrawContext dc ; <nl> dc - > Draw2dLabel ( 10 . f , dc - > GetHeight ( ) - 90 . f , 2 . 0f , colorRed , false , " Forced AG Signal Input : % s " , szInput ) ; <nl> void CAISystem : : DebugDrawForceAGAction ( ) const <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> ColorB colorRed ( 255 , 0 , 0 ) ; <nl> - const char * szInput = gAIEnv . CVars . ForceAGAction ; <nl> + const char * szInput = gAIEnv . CVars . legacyPuppet . ForceAGAction ; <nl> <nl> CDebugDrawContext dc ; <nl> dc - > Draw2dLabel ( 10 . f , dc - > GetHeight ( ) - 60 . f , 2 . 0f , colorRed , false , " Forced AG Action Input : % s " , szInput ) ; <nl> void CAISystem : : DebugDrawForceStance ( ) const <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> ColorB colorRed ( 255 , 0 , 0 ) ; <nl> - const char * szStance = GetStanceName ( gAIEnv . CVars . ForceStance ) ; <nl> + const char * szStance = GetStanceName ( gAIEnv . CVars . legacyPuppet . ForceStance ) ; <nl> <nl> CDebugDrawContext dc ; <nl> dc - > Draw2dLabel ( 10 . f , dc - > GetHeight ( ) - 30 . f , 2 . 0f , colorRed , false , " Forced Stance : % s " , szStance ) ; <nl> void CAISystem : : DebugDrawForcePosture ( ) const <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> ColorB colorRed ( 255 , 0 , 0 ) ; <nl> - const char * szPosture = gAIEnv . CVars . ForcePosture ; <nl> + const char * szPosture = gAIEnv . CVars . legacyPuppet . ForcePosture ; <nl> <nl> CDebugDrawContext dc ; <nl> dc - > Draw2dLabel ( 10 . f , dc - > GetHeight ( ) - 30 . f , 2 . 0f , colorRed , false , " Forced Posture : % s " , szPosture ) ; <nl> void CAISystem : : DebugDrawAdaptiveUrgency ( ) const <nl> <nl> Vec3 camPos = dc - > GetCameraPos ( ) ; <nl> <nl> - int mode = gAIEnv . CVars . DebugDrawAdaptiveUrgency ; <nl> + int mode = gAIEnv . CVars . legacyDebugDraw . DebugDrawAdaptiveUrgency ; <nl> <nl> AIObjectOwners : : const_iterator ai = gAIEnv . pAIObjectManager - > m_Objects . find ( AIOBJECT_ACTOR ) ; <nl> for ( ; ai ! = gAIEnv . pAIObjectManager - > m_Objects . end ( ) ; + + ai ) <nl> void CAISystem : : DrawRadarPath ( CPipeUser * pPipeUser , const Matrix34 & world , const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const char * pName = gAIEnv . CVars . DrawPath ; <nl> + const char * pName = gAIEnv . CVars . legacyDebugDraw . DrawPath ; <nl> if ( ! pName ) <nl> return ; <nl> CAIObject * pTargetObject = gAIEnv . pAIObjectManager - > GetAIObjectByName ( pName ) ; <nl> void CAISystem : : DebugDrawRadar ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - int size = gAIEnv . CVars . DrawRadar ; <nl> + int size = gAIEnv . CVars . legacyDebugDraw . DrawRadar ; <nl> if ( size = = 0 ) <nl> return ; <nl> <nl> void CAISystem : : DebugDrawRadar ( ) <nl> int centerx = w / 2 ; <nl> int centery = h / 2 ; <nl> <nl> - int radarDist = gAIEnv . CVars . DrawRadarDist ; <nl> + int radarDist = gAIEnv . CVars . legacyDebugDraw . DrawRadarDist ; <nl> float worldSize = radarDist * 2 . 0f ; <nl> <nl> Matrix34 worldToScreen ; <nl> void CAISystem : : DebugDrawRadar ( ) <nl> } <nl> } <nl> <nl> - void CAISystem : : DebugDrawDistanceLUT ( ) <nl> - { <nl> - CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> - <nl> - if ( gAIEnv . CVars . DrawDistanceLUT < 1 ) <nl> - return ; <nl> - } <nl> - <nl> struct SSlopeTriangle <nl> { <nl> SSlopeTriangle ( const Triangle & tri , float slope ) : triangle ( tri ) , slope ( slope ) { } <nl> void CAISystem : : DebugDrawPath ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const char * pName = gAIEnv . CVars . DrawPath ; <nl> + const char * pName = gAIEnv . CVars . legacyDebugDraw . DrawPath ; <nl> if ( ! pName ) <nl> return ; <nl> CAIObject * pTargetObject = gAIEnv . pAIObjectManager - > GetAIObjectByName ( pName ) ; <nl> void CAISystem : : DebugDrawPathAdjustments ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const char * pName = gAIEnv . CVars . DrawPathAdjustment ; <nl> + const char * pName = gAIEnv . CVars . legacyDebugDraw . DrawPathAdjustment ; <nl> if ( ! pName ) <nl> return ; <nl> CAIObject * pTargetObject = gAIEnv . pAIObjectManager - > GetAIObjectByName ( pName ) ; <nl> void CAISystem : : DebugDrawAgents ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - if ( gAIEnv . CVars . AgentStatsDist < = 1 . 0f ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . AgentStatsDist < = 1 . 0f ) <nl> return ; <nl> <nl> - bool filterName = strcmp ( " " , gAIEnv . CVars . FilterAgentName ) ! = 0 ; <nl> + bool filterName = strcmp ( " " , gAIEnv . CVars . legacyDebugDraw . FilterAgentName ) ! = 0 ; <nl> <nl> CDebugDrawContext dc ; <nl> - const float drawDistSq = sqr ( gAIEnv . CVars . AgentStatsDist ) ; <nl> + const float drawDistSq = sqr ( gAIEnv . CVars . legacyDebugDraw . AgentStatsDist ) ; <nl> <nl> CryFixedArray < GroupID , 128 > enabledGroups ; <nl> <nl> - stack_string groups = gAIEnv . CVars . DrawAgentStatsGroupFilter ; <nl> + stack_string groups = gAIEnv . CVars . legacyGroupSystem . DrawAgentStatsGroupFilter ; <nl> <nl> if ( ! groups . empty ( ) ) <nl> { <nl> void CAISystem : : DebugDrawAgents ( ) const <nl> continue ; <nl> <nl> if ( ( ! enabledGroups . size ( ) | | ( std : : find ( enabledGroups . begin ( ) , enabledGroups . end ( ) , pAIActor - > GetGroupId ( ) ) ! = enabledGroups . end ( ) ) ) & & <nl> - ! filterName | | ! strcmp ( pAIActor - > GetName ( ) , gAIEnv . CVars . FilterAgentName ) ) <nl> + ! filterName | | ! strcmp ( pAIActor - > GetName ( ) , gAIEnv . CVars . legacyDebugDraw . FilterAgentName ) ) <nl> DebugDrawAgent ( pAIActor ) ; <nl> } <nl> <nl> void CAISystem : : DebugDrawAgents ( ) const <nl> <nl> if ( aiObject & & <nl> ( ( ! enabledGroups . size ( ) | | ( std : : find ( enabledGroups . begin ( ) , enabledGroups . end ( ) , aiObject - > GetGroupId ( ) ) ! = enabledGroups . end ( ) ) ) & & <nl> - ! filterName | | ! strcmp ( aiObject - > GetName ( ) , gAIEnv . CVars . FilterAgentName ) ) ) <nl> + ! filterName | | ! strcmp ( aiObject - > GetName ( ) , gAIEnv . CVars . legacyDebugDraw . FilterAgentName ) ) ) <nl> DebugDrawAgent ( aiObject ) ; <nl> } <nl> <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> return ; <nl> <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - if ( gAIEnv . CVars . DebugDrawDamageControl > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageControl > 0 ) <nl> pAgent - > UpdateHealthHistory ( ) ; <nl> # endif <nl> <nl> CPuppet * pPuppet = pAgent - > CastToCPuppet ( ) ; <nl> <nl> if ( pPuppet ) <nl> - if ( ! stricmp ( gAIEnv . CVars . DrawPerceptionHandlerModifiers , pAgent - > GetName ( ) ) ) <nl> + if ( ! stricmp ( gAIEnv . CVars . legacyPerception . DrawPerceptionHandlerModifiers , pAgent - > GetName ( ) ) ) <nl> pPuppet - > DebugDrawPerceptionHandlerModifiers ( ) ; <nl> <nl> PREFAST_SUPPRESS_WARNING ( 6237 ) ; <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> CPipeUser * pPipeUser = pAgent - > CastToCPipeUser ( ) ; <nl> if ( pPipeUser ) <nl> { <nl> - if ( gAIEnv . CVars . DebugDrawCover ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCover ) <nl> { <nl> gAIEnv . pCoverSystem - > DebugDrawCoverUser ( pPipeUser - > GetEntityID ( ) ) ; <nl> } <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } ; <nl> const uint32 flagCount = CRY_ARRAY_COUNT ( flagMap ) ; <nl> <nl> - const char * enabledFlags = gAIEnv . CVars . DrawAgentStats ; <nl> + const char * enabledFlags = gAIEnv . CVars . legacyDebugDraw . DrawAgentStats ; <nl> uint32 enabledStats = 0 ; <nl> for ( uint32 i = 0 ; i < flagCount ; + + i ) <nl> { <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> y * = ( float ) dc - > GetHeight ( ) * 0 . 01f ; <nl> <nl> const bool bCameraNear = ( dc - > GetCameraPos ( ) - pos ) . GetLengthSquared ( ) < <nl> - sqr ( gAIEnv . CVars . DebugDrawArrowLabelsVisibilityDistance ) ; <nl> + sqr ( gAIEnv . CVars . legacyDebugDraw . DebugDrawArrowLabelsVisibilityDistance ) ; <nl> <nl> / / Define some colors used in the whole code . <nl> const ColorB white ( 255 , 255 , 255 , 255 ) ; <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } <nl> <nl> / / attentionTarget <nl> - if ( gAIEnv . CVars . DrawAttentionTargetsPosition ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawAttentionTargetsPosition ) <nl> dc - > DrawSphere ( attTargetPos , 0 . 1f , Col_Red ) ; <nl> } <nl> else <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> if ( pPipeUser ) <nl> { <nl> / / Debug Draw goal ops . <nl> - if ( gAIEnv . CVars . DrawGoals ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawGoals ) <nl> pPipeUser - > DebugDrawGoals ( ) ; <nl> } <nl> <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } <nl> } <nl> <nl> - const float drawFOV = gAIEnv . CVars . DrawAgentFOV ; <nl> + const float drawFOV = gAIEnv . CVars . legacyPerception . DrawAgentFOV ; <nl> if ( drawFOV > 0 ) <nl> { <nl> / / Draw the view cone <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } <nl> <nl> / / my Ref point - yellow <nl> - stack_string rfname = gAIEnv . CVars . DrawRefPoints ; <nl> + stack_string rfname = gAIEnv . CVars . legacyDebugDraw . DrawRefPoints ; <nl> if ( rfname ! = " " ) <nl> { <nl> / / cppcheck - suppress constStatement <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } <nl> } <nl> <nl> - if ( pPuppet & & ( gAIEnv . CVars . DebugTargetSilhouette > 0 ) ) <nl> + if ( pPuppet & & ( gAIEnv . CVars . legacyDebugDraw . DebugTargetSilhouette > 0 ) ) <nl> { <nl> CPuppet : : STargetSilhouette & targetSilhouette = pPuppet - > m_targetSilhouette ; <nl> if ( targetSilhouette . valid & & ! targetSilhouette . points . empty ( ) ) <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } <nl> } <nl> <nl> - if ( gAIEnv . CVars . DrawProbableTarget > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawProbableTarget > 0 ) <nl> { <nl> if ( pPipeUser ) <nl> { <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } <nl> <nl> / / Display damage parts . <nl> - if ( gAIEnv . CVars . DebugDrawDamageParts > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageParts > 0 ) <nl> { <nl> if ( pAgent - > GetDamageParts ( ) ) <nl> { <nl> void CAISystem : : DebugDrawAgent ( CAIObject * pAgentObj ) const <nl> } <nl> <nl> / / Draw the approximate stance size . <nl> - if ( gAIEnv . CVars . DebugDrawStanceSize > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawStanceSize > 0 ) <nl> { <nl> if ( pAgent - > GetProxy ( ) ) <nl> { <nl> void CAISystem : : DebugDrawStatsTarget ( const char * pName ) <nl> <nl> / / Track and draw the trajectory of the agent . <nl> Vec3 physicsPos = pTargetObject - > GetPhysicsPos ( ) ; <nl> - if ( gAIEnv . CVars . DrawTrajectory ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawTrajectory ) <nl> { <nl> - int type = gAIEnv . CVars . DrawTrajectory ; <nl> + int type = gAIEnv . CVars . legacyDebugDraw . DrawTrajectory ; <nl> static int lastReason = - 1 ; <nl> bool updated = false ; <nl> <nl> void CAISystem : : DebugDrawType ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - short type = static_cast < short > ( gAIEnv . CVars . DrawType ) ; <nl> + short type = static_cast < short > ( gAIEnv . CVars . legacyDebugDraw . DrawType ) ; <nl> <nl> AIObjectOwners : : const_iterator ai ; <nl> if ( ( ai = gAIEnv . pAIObjectManager - > m_Objects . find ( type ) ) ! = gAIEnv . pAIObjectManager - > m_Objects . end ( ) ) <nl> void CAISystem : : DebugDrawTargetsList ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - float drawDist2 = static_cast < float > ( gAIEnv . CVars . DrawTargets ) ; <nl> + float drawDist2 = static_cast < float > ( gAIEnv . CVars . legacyPerception . DrawTargets ) ; <nl> drawDist2 * = drawDist2 ; <nl> int column ( 1 ) , row ( 1 ) ; <nl> string eventDescr ; <nl> void CAISystem : : DebugDrawStatsList ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - float drawDist2 = static_cast < float > ( gAIEnv . CVars . DrawStats ) ; <nl> + float drawDist2 = static_cast < float > ( gAIEnv . CVars . legacyDebugDraw . DrawStats ) ; <nl> drawDist2 * = drawDist2 ; <nl> int column ( 1 ) , row ( 1 ) ; <nl> / / avoid memory allocations <nl> void CAISystem : : DebugDrawUpdate ( ) const <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> EDrawUpdateMode mode = DRAWUPDATE_NONE ; <nl> - switch ( gAIEnv . CVars . DebugDrawUpdate ) <nl> + switch ( gAIEnv . CVars . legacyDebugDraw . DebugDrawUpdate ) <nl> { <nl> case 1 : <nl> mode = DRAWUPDATE_NORMAL ; <nl> void CAISystem : : DebugDrawLocate ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const char * pString = gAIEnv . CVars . DrawLocate ; <nl> + const char * pString = gAIEnv . CVars . LegacyDrawLocate ; <nl> <nl> if ( pString [ 0 ] = = 0 | | ! strcmp ( pString , " none " ) ) <nl> return ; <nl> void CAISystem : : DebugDrawGroups ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - if ( ! gAIEnv . CVars . DebugDrawGroups ) <nl> + if ( ! gAIEnv . CVars . legacyGroupSystem . DebugDrawGroups ) <nl> return ; <nl> <nl> - bool drawWorld = gAIEnv . CVars . DebugDrawGroups > 2 ; <nl> + bool drawWorld = gAIEnv . CVars . legacyGroupSystem . DebugDrawGroups > 2 ; <nl> <nl> { <nl> GroupID lastGroupID = - 1 ; <nl> void CAISystem : : DebugDrawOneGroup ( float x , float & y , float & w , float fontSize , s <nl> if ( it = = end ) <nl> return ; <nl> <nl> - bool drawInactive = gAIEnv . CVars . DebugDrawGroups = = 2 ; <nl> + bool drawInactive = gAIEnv . CVars . legacyGroupSystem . DebugDrawGroups = = 2 ; <nl> <nl> CDebugDrawContext dc ; <nl> <nl> void CAISystem : : DebugDrawShooting ( ) const <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const char * pName ( gAIEnv . CVars . DrawShooting ) ; <nl> + const char * pName ( gAIEnv . CVars . legacyDebugDraw . DrawShooting ) ; <nl> if ( ! pName ) <nl> return ; <nl> <nl> void CAISystem : : DebugDrawAreas ( ) const <nl> CDebugDrawContext dc ; <nl> <nl> Vec3 camPos = dc - > GetCameraPos ( ) ; <nl> - float statsDist = gAIEnv . CVars . AgentStatsDist ; <nl> + float statsDist = gAIEnv . CVars . legacyDebugDraw . AgentStatsDist ; <nl> <nl> / / Draw standby areas <nl> for ( ShapeMap : : const_iterator it = m_mapGenericShapes . begin ( ) ; it ! = m_mapGenericShapes . end ( ) ; + + it ) <nl> void CAISystem : : DebugDrawSelectedTargets ( ) <nl> <nl> void CAISystem : : TryDebugDrawPhysicsAccess ( ) <nl> { <nl> - if ( ! gAIEnv . CVars . DebugDrawPhysicsAccess ) <nl> + if ( ! gAIEnv . CVars . legacyDebugDraw . DebugDrawPhysicsAccess ) <nl> return ; <nl> <nl> auto rstats = gAIEnv . pRayCaster - > GetContentionStats ( ) ; <nl> void CAISystem : : DebugDraw ( ) <nl> int debugDrawValue = gAIEnv . CVars . DebugDraw ; <nl> <nl> / / As a special case , we want to draw the InterestSystem alone sometimes <nl> - if ( gAIEnv . CVars . DebugInterest > 0 ) <nl> - DebugDrawInterestSystem ( gAIEnv . CVars . DebugInterest ) ; <nl> + if ( gAIEnv . CVars . legacyInterestSystem . DebugInterest > 0 ) <nl> + DebugDrawInterestSystem ( gAIEnv . CVars . legacyInterestSystem . DebugInterest ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawModularBehaviorTreeStatistics > 0 ) <nl> + if ( gAIEnv . CVars . behaviorTree . DrawModularBehaviorTreeStatistics > 0 ) <nl> gAIEnv . pBehaviorTreeManager - > DrawMemoryInformation ( ) ; <nl> <nl> if ( debugDrawValue < 0 ) <nl> void CAISystem : : DebugDraw ( ) <nl> systemComponent - > DebugDraw ( dc . operator - > ( ) ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCollisionAvoidance > 0 ) <nl> + if ( gAIEnv . CVars . collisionAvoidance . DebugDrawCollisionAvoidance > 0 ) <nl> gAIEnv . pCollisionAvoidanceSystem - > DebugDraw ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCommunication > 0 ) <nl> + if ( gAIEnv . CVars . legacyCommunicationSystem . DebugDrawCommunication > 0 ) <nl> gAIEnv . pCommunicationManager - > DebugDraw ( ) ; <nl> <nl> - if ( gAIEnv . pVisionMap & & gAIEnv . CVars . DebugDrawVisionMap ! = 0 ) <nl> + if ( gAIEnv . pVisionMap & & gAIEnv . CVars . visionMap . DebugDrawVisionMap ! = 0 ) <nl> gAIEnv . pVisionMap - > DebugDraw ( ) ; <nl> <nl> if ( gAIEnv . pCoverSystem ) <nl> gAIEnv . pCoverSystem - > DebugDraw ( ) ; <nl> <nl> - if ( gAIEnv . pNavigationSystem & & gAIEnv . CVars . DebugDrawNavigation > 0 ) <nl> + if ( gAIEnv . pNavigationSystem & & gAIEnv . CVars . navigation . DebugDrawNavigation > 0 ) <nl> gAIEnv . pNavigationSystem - > DebugDraw ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugGlobalPerceptionScale > 0 ) <nl> + if ( gAIEnv . CVars . legacyPerception . DebugGlobalPerceptionScale > 0 ) <nl> m_globalPerceptionScale . DebugDraw ( ) ; <nl> <nl> # ifdef CRYAISYSTEM_DEBUG <nl> void CAISystem : : DebugDraw ( ) <nl> return ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawEnabledActors = = 1 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawEnabledActors = = 1 ) <nl> DebugDrawEnabledActors ( ) ; / / Called only in this line = > Maybe we should remove it from the interface ? <nl> - else if ( gAIEnv . CVars . DebugDrawEnabledPlayers = = 1 ) <nl> + else if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawEnabledPlayers = = 1 ) <nl> DebugDrawEnabledPlayers ( ) ; <nl> <nl> DebugDrawUpdate ( ) ; / / Called only in this line = > Maybe we should remove it from the interface ? <nl> <nl> - if ( gAIEnv . CVars . DrawFakeDamageInd > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawFakeDamageInd > 0 ) <nl> DebugDrawFakeDamageInd ( ) ; <nl> <nl> if ( gAIEnv . CVars . DrawPlayerRanges > 0 ) <nl> DebugDrawPlayerRanges ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawPerceptionIndicators > 0 | | gAIEnv . CVars . DrawPerceptionDebugging > 0 ) <nl> + if ( gAIEnv . CVars . legacyPerception . DrawPerceptionIndicators > 0 | | gAIEnv . CVars . legacyPerception . DrawPerceptionDebugging > 0 ) <nl> DebugDrawPerceptionIndicators ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawPerceptionModifiers > 0 ) <nl> + if ( gAIEnv . CVars . legacyPerception . DrawPerceptionModifiers > 0 ) <nl> DebugDrawPerceptionModifiers ( ) ; <nl> <nl> DebugDrawTargetTracks ( ) ; <nl> void CAISystem : : DebugDraw ( ) <nl> <nl> DebugDrawNavigation ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawDamageControl > 1 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageControl > 1 ) <nl> DebugDrawDamageControlGraph ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawAreas > 0 ) <nl> + if ( gAIEnv . CVars . LegacyDrawAreas > 0 ) <nl> DebugDrawAreas ( ) ; <nl> <nl> DebugDrawSteepSlopes ( ) ; <nl> DebugDrawVegetationCollision ( ) ; <nl> <nl> - if ( m_bUpdateSmartObjects & & gAIEnv . CVars . DrawSmartObjects ) <nl> + if ( m_bUpdateSmartObjects & & gAIEnv . CVars . legacySmartObjects . DrawSmartObjects ) <nl> m_pSmartObjectManager - > DebugDraw ( ) ; <nl> <nl> DebugDrawPath ( ) ; <nl> DebugDrawPathAdjustments ( ) ; <nl> <nl> - DebugDrawStatsTarget ( gAIEnv . CVars . StatsTarget ) ; <nl> + DebugDrawStatsTarget ( gAIEnv . CVars . legacyDebugDraw . StatsTarget ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawFormations ) <nl> + if ( gAIEnv . CVars . legacyFormationSystem . DrawFormations ) <nl> gAIEnv . pFormationManager - > DebugDraw ( ) ; <nl> <nl> DebugDrawType ( ) ; <nl> DebugDrawLocate ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawTargets ) <nl> + if ( gAIEnv . CVars . legacyPerception . DrawTargets ) <nl> DebugDrawTargetsList ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawStats ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawStats ) <nl> DebugDrawStatsList ( ) ; <nl> <nl> DebugDrawGroups ( ) ; <nl> void CAISystem : : DebugDraw ( ) <nl> DebugDrawCheckGravity ( ) ; <nl> / / DebugDrawPaths ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawGroupTactic > 0 ) <nl> + if ( gAIEnv . CVars . legacyGroupSystem . DrawGroupTactic > 0 ) <nl> DebugDrawGroupTactic ( ) ; <nl> <nl> DebugDrawRadar ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawAmbientFire > 0 ) <nl> + if ( gAIEnv . CVars . legacyFiring . DebugDrawAmbientFire > 0 ) <nl> DebugDrawAmbientFire ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawExpensiveAccessoryQuota > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawExpensiveAccessoryQuota > 0 ) <nl> DebugDrawExpensiveAccessoryQuota ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawDamageParts > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageParts > 0 ) <nl> DebugDrawDamageParts ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawStanceSize > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawStanceSize > 0 ) <nl> DebugDrawStanceSize ( ) ; <nl> <nl> - if ( strcmp ( gAIEnv . CVars . ForcePosture , " 0 " ) ) <nl> + if ( strcmp ( gAIEnv . CVars . legacyPuppet . ForcePosture , " 0 " ) ) <nl> { <nl> DebugDrawForcePosture ( ) ; <nl> } <nl> else <nl> { <nl> - if ( strcmp ( gAIEnv . CVars . ForceAGAction , " 0 " ) ) <nl> + if ( strcmp ( gAIEnv . CVars . legacyPuppet . ForceAGAction , " 0 " ) ) <nl> DebugDrawForceAGAction ( ) ; <nl> <nl> - if ( strcmp ( gAIEnv . CVars . ForceAGSignal , " 0 " ) ) <nl> + if ( strcmp ( gAIEnv . CVars . legacyPuppet . ForceAGSignal , " 0 " ) ) <nl> DebugDrawForceAGSignal ( ) ; <nl> <nl> - if ( gAIEnv . CVars . ForceStance ! = - 1 ) <nl> + if ( gAIEnv . CVars . legacyPuppet . ForceStance ! = - 1 ) <nl> DebugDrawForceStance ( ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawAdaptiveUrgency > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawAdaptiveUrgency > 0 ) <nl> DebugDrawAdaptiveUrgency ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawPlayerActions > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawPlayerActions > 0 ) <nl> DebugDrawPlayerActions ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCrowdControl > 0 ) <nl> + if ( gAIEnv . CVars . legacyPuppet . DebugDrawCrowdControl > 0 ) <nl> DebugDrawCrowdControl ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawBannedNavsos > 0 ) <nl> + if ( gAIEnv . CVars . LegacyDebugDrawBannedNavsos > 0 ) <nl> m_pSmartObjectManager - > DebugDrawBannedNavsos ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawSelectedTargets > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DrawSelectedTargets > 0 ) <nl> DebugDrawSelectedTargets ( ) ; <nl> <nl> / / Aux render flags restored by helper <nl> new file mode 100644 <nl> index 0000000000 . . 96535a2f81 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / DebugDrawConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " DebugDrawConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyDebugDraw : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_DebugDrawCoolMisses " , DebugDrawCoolMisses , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles displaying the cool miss locations around the player . \ n " <nl> + " Usage : ai_DebugDrawCoolMisses [ 0 / 1 ] " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawFireCommand " , DebugDrawFireCommand , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles displaying the fire command targets and modifications . \ n " <nl> + " Usage : ai_DebugDrawFireCommand [ 0 / 1 ] " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawGoals " , DrawGoals , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws all the active goal ops debug info . \ n " <nl> + " Usage : ai_DrawGoals [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) . Set to 1 to draw the AI goal op debug info . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawStats " , DrawStats , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles drawing stats ( in a table on top left of screen ) for AI objects within specified range . \ n " <nl> + " Will display attention target , goal pipe and current goal . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawAttentionTargetPositions " , DrawAttentionTargetsPosition , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays markers for the AI ' s current attention target position . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawTrajectory " , DrawTrajectory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Record and draw the actual path taken by the agent specified in ai_StatsTarget . \ n " <nl> + " Path is displayed in aqua , and only a certain length will be displayed , after which \ n " <nl> + " old path gradually disappears as new path is drawn . \ n " <nl> + " 0 = do not record , 1 = record . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawRadar " , DrawRadar , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws AI radar : 0 = no radar , > 0 = size of the radar on screen " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawRadarDist " , DrawRadarDist , 20 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " AI radar draw distance in meters , default = 20m . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawProbableTarget " , DrawProbableTarget , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables / Disables drawing the position of probable target . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawDamageParts " , DebugDrawDamageParts , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws the damage parts of puppets and vehicles . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawStanceSize " , DebugDrawStanceSize , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws the game logic representation of the stance size of the AI agents . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawUpdate " , DebugDrawUpdate , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " list of AI forceUpdated entities " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawEnabledActors " , DebugDrawEnabledActors , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " list of AI Actors that are enabled and metadata " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawEnabledPlayers " , DebugDrawEnabledPlayers , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " list of AI players that are enabled and metadata " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawLightLevel " , DebugDrawLightLevel , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Debug AI light level manager " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawPhysicsAccess " , DebugDrawPhysicsAccess , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays current physics access statistics for the AI module . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugTargetSilhouette " , DebugTargetSilhouette , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws the silhouette used for missing the target while shooting . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawDamageControl " , DebugDrawDamageControl , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Debugs the damage control system 0 = disabled , 1 = collect , 2 = collect & draw . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawExpensiveAccessoryQuota " , DebugDrawExpensiveAccessoryQuota , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays expensive accessory usage quota on puppets . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawFakeDamageInd " , DrawFakeDamageInd , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws fake damage indicators on the player . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawAdaptiveUrgency " , DebugDrawAdaptiveUrgency , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables drawing the adaptive movement urgency . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawPlayerActions " , DebugDrawPlayerActions , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Debug draw special player actions . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawType " , DrawType , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Display all AI object of specified type . If object is enabled it will be displayed . \ n " <nl> + " with blue ball , otherwise with red ball . Yellow line will represent forward direction of the object . \ n " <nl> + " < 0 - off \ n " <nl> + " 0 - display all the dummy objects \ n " <nl> + " > 0 - type of AI objects to display " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawPath " , & DrawPath , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws the generated paths of the AI agents . ai_drawoffset is used . \ n " <nl> + " Usage : ai_DrawPath [ name ] \ n " <nl> + " none - off ( default ) \ n " <nl> + " squad - squadmates \ n " <nl> + " enemy - all the enemies " ) ; <nl> + REGISTER_CVAR2 ( " ai_DrawPathAdjustment " , & DrawPathAdjustment , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws the path adjustment for the AI agents . \ n " <nl> + " Usage : ai_DrawPathAdjustment [ name ] \ n " <nl> + " Default is none ( nobody ) . " ) ; <nl> + REGISTER_CVAR2 ( " ai_DrawRefPoints " , & DrawRefPoints , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles reference points and beacon view for debugging AI . \ n " <nl> + " Usage : ai_DrawRefPoints \ " all \ " , agent name , group id \ n " <nl> + " Default is the empty string ( off ) . Indicates the AI reference points by drawing \ n " <nl> + " balls at their positions . " ) ; <nl> + REGISTER_CVAR2 ( " ai_StatsTarget " , & StatsTarget , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Focus debugging information on a specific AI \ n " <nl> + " Display current goal pipe , current goal , subpipes and agentstats information for the selected AI agent . \ n " <nl> + " Long green line will represent the AI forward direction ( game forward ) . \ n " <nl> + " Long red / blue ( if AI firing on / off ) line will represent the AI view direction . \ n " <nl> + " Usage : ai_StatsTarget AIName \ n " <nl> + " Default is ' none ' . AIName is the name of the AI \ n " <nl> + " on which to focus . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawShooting " , & DrawShooting , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Name of puppet to show fire stats " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawAgentStats " , & DrawAgentStats , " NkcBbtGgSfdDL " , VF_NULL , <nl> + " Flag field specifying which of the overhead agent stats to display : \ n " <nl> + " N - name \ n " <nl> + " k - groupID \ n " <nl> + " d - distances \ n " <nl> + " c - cover info \ n " <nl> + " B - currently selected behavior node \ n " <nl> + " b - current behavior \ n " <nl> + " t - target info \ n " <nl> + " G - goal pipe \ n " <nl> + " g - goal op \ n " <nl> + " S - stance \ n " <nl> + " f - fire \ n " <nl> + " w - territory / wave \ n " <nl> + " p - pathfinding status \ n " <nl> + " l - light level ( perception ) status \ n " <nl> + " D - various direction arrows ( aim target , move target , . . . ) status \ n " <nl> + " L - personal log \ n " <nl> + " a - alertness \ n " <nl> + " \ n " <nl> + " Default is NkcBbtGgSfdDL " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_FilterAgentName " , & FilterAgentName , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Only draws the AI info of the agent with the given name . \ n " <nl> + " Usage : ai_FilterAgentName name \ n " <nl> + " Default is none ( draws all of them if ai_debugdraw is on ) \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_AgentStatsDist " , & AgentStatsDist , 150 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Sets agent statistics draw distance , such as current goalpipe , command and target . \ n " <nl> + " Only information on enabled AI objects will be displayed . \ n " <nl> + " To display more information on particular AI agent , use ai_StatsTarget . \ n " <nl> + " Yellow line represents direction where AI is trying to move ; \ n " <nl> + " Red line represents direction where AI is trying to look ; \ n " <nl> + " Blue line represents forward dir ( entity forward ) ; \ n " <nl> + " Usage : ai_AgentStatsDist [ view distance ] \ n " <nl> + " Default is 20 meters . Works with ai_DebugDraw enabled . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DebugDrawArrowLabelsVisibilityDistance " , & DebugDrawArrowLabelsVisibilityDistance , 50 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Provided ai_DebugDraw > 0 , if the camera is closer to an agent than this distance , \ n " <nl> + " agent arrows for look / fire / move arrows will have labels . \ n " <nl> + " Usage : ai_DebugDrawArrowLabelsVisibilityDistance [ distance ] \ n " <nl> + " Default is 50 . \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DrawSelectedTargets " , & DrawSelectedTargets , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the debug helpers showing the AI ' s selected targets . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 71d3e3c98f <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / DebugDrawConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyDebugDraw <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( DebugDrawCoolMisses , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawFireCommand , 0 ) ; <nl> + DeclareConstIntCVar ( DrawGoals , 0 ) ; <nl> + DeclareConstIntCVar ( DrawStats , 0 ) ; <nl> + DeclareConstIntCVar ( DrawAttentionTargetsPosition , 0 ) ; <nl> + DeclareConstIntCVar ( DrawTrajectory , 0 ) ; <nl> + DeclareConstIntCVar ( DrawRadar , 0 ) ; <nl> + DeclareConstIntCVar ( DrawRadarDist , 20 ) ; <nl> + DeclareConstIntCVar ( DrawProbableTarget , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawDamageParts , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawStanceSize , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawUpdate , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawEnabledActors , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawEnabledPlayers , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawLightLevel , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawPhysicsAccess , 0 ) ; <nl> + DeclareConstIntCVar ( DebugTargetSilhouette , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawDamageControl , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawExpensiveAccessoryQuota , 0 ) ; <nl> + DeclareConstIntCVar ( DrawFakeDamageInd , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawAdaptiveUrgency , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawPlayerActions , 0 ) ; <nl> + DeclareConstIntCVar ( DrawType , - 1 ) ; <nl> + <nl> + const char * DrawPath ; <nl> + const char * DrawPathAdjustment ; <nl> + const char * DrawRefPoints ; <nl> + const char * StatsTarget ; <nl> + const char * DrawShooting ; <nl> + const char * DrawAgentStats ; <nl> + const char * FilterAgentName ; <nl> + float DebugDrawArrowLabelsVisibilityDistance ; <nl> + float AgentStatsDist ; <nl> + int DrawSelectedTargets ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / Environment . h <nl> ppp b / Code / CryEngine / CryAISystem / Environment . h <nl> struct IAIBubblesSystem ; <nl> <nl> struct SAIEnvironment <nl> { <nl> - AIConsoleVars CVars ; <nl> + SAIConsoleVars CVars ; <nl> <nl> SConfiguration configuration ; <nl> <nl> mmm a / Code / CryEngine / CryAISystem / FireCommand . cpp <nl> ppp b / Code / CryEngine / CryAISystem / FireCommand . cpp <nl> EAIFireState CFireCommandInstant : : Update ( IAIObject * pITarget , bool canFire , EFir <nl> { <nl> float dt = GetAISystem ( ) - > GetFrameDeltaTime ( ) ; <nl> <nl> - m_coverFireTime = descriptor . coverFireTime * gAIEnv . CVars . RODCoverFireTimeMod ; <nl> + m_coverFireTime = descriptor . coverFireTime * gAIEnv . CVars . legacyPuppetRod . RODCoverFireTimeMod ; <nl> <nl> if ( ! canFire | | ! pITarget ) <nl> { <nl> EAIFireState CFireCommandInstant : : Update ( IAIObject * pITarget , bool canFire , EFir <nl> if ( ! canFire ) <nl> return eAIFS_Off ; <nl> <nl> - float FakeHitChance = gAIEnv . CVars . RODFakeHitChance ; <nl> + float FakeHitChance = gAIEnv . CVars . legacyPuppetRod . RODFakeHitChance ; <nl> if ( m_pShooter - > m_targetZone = = AIZONE_KILL ) <nl> FakeHitChance = 1 . 0f ; <nl> else if ( gAIEnv . configuration . eCompatibilityMode ! = ECCM_GAME04 ) <nl> EAIFireState CFireCommandInstant : : Update ( IAIObject * pITarget , bool canFire , EFir <nl> <nl> if ( m_drawFire . GetState ( ) ! = DrawFireEffect : : Finished ) <nl> { <nl> - if ( gAIEnv . CVars . DebugDrawFireCommand ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawFireCommand ) <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> EAIFireState CFireCommandInstant : : Update ( IAIObject * pITarget , bool canFire , EFir <nl> CAIPlayer * player = pITarget ? pITarget - > CastToCAIPlayer ( ) : 0 ; <nl> <nl> const bool canFakeHit = cry_random ( 0 . 0f , 1 . 0f ) < = FakeHitChance ; <nl> - const bool allowedToHit = gAIEnv . CVars . AllowedToHit & & ( ! player | | gAIEnv . CVars . AllowedToHitPlayer ) & & m_pShooter - > IsAllowedToHitTarget ( ) ; <nl> + const bool allowedToHit = gAIEnv . CVars . legacyFiring . AllowedToHit & & ( ! player | | gAIEnv . CVars . legacyFiring . AllowedToHitPlayer ) & & m_pShooter - > IsAllowedToHitTarget ( ) ; <nl> const bool shouldHit = m_pShooter - > CanDamageTarget ( ) | | canFakeHit ; <nl> <nl> if ( m_pShooter - > AdjustFireTarget ( targetObject , outShootTargetPos , allowedToHit & & shouldHit , descriptor . spreadRadius , <nl> EAIFireState CFireCommandInstant : : Update ( IAIObject * pITarget , bool canFire , EFir <nl> <nl> const size_t burstFirstHit = ( size_t ) ( ( m_curBurstBulletCount * burstCanStartHitPercent ) + 0 . 5f ) ; <nl> const bool canFakeHit = cry_random ( 0 . 0f , 1 . 0f ) < = FakeHitChance ; <nl> - const bool allowedToHit = gAIEnv . CVars . AllowedToHit & & ( ! player | | gAIEnv . CVars . AllowedToHitPlayer ) & & m_pShooter - > IsAllowedToHitTarget ( ) ; <nl> + const bool allowedToHit = gAIEnv . CVars . legacyFiring . AllowedToHit & & ( ! player | | gAIEnv . CVars . legacyFiring . AllowedToHitPlayer ) & & m_pShooter - > IsAllowedToHitTarget ( ) ; <nl> const bool shouldHit = m_pShooter - > CanDamageTarget ( ) | | canFakeHit ; <nl> const bool burstHit = ( size_t ) m_weaponBurstBulletCount > = burstFirstHit ; <nl> <nl> CFireCommandInstant : : DrawFireEffect : : EState CFireCommandInstant : : DrawFireEffect : <nl> bool CFireCommandInstant : : DrawFireEffect : : Update ( float updateTime , CPuppet * pShooter , IAIObject * pTarget , const AIWeaponDescriptor & descriptor , <nl> Vec3 & aimTarget , bool canFire ) <nl> { <nl> - if ( gAIEnv . CVars . DrawFireEffectEnabled < 1 ) <nl> + if ( gAIEnv . CVars . legacyFiring . DrawFireEffectEnabled < 1 ) <nl> { <nl> m_state . state = Finished ; <nl> return true ; <nl> bool CFireCommandInstant : : DrawFireEffect : : Update ( float updateTime , CPuppet * pSho <nl> return true ; <nl> } <nl> <nl> - const float tooClose = gAIEnv . CVars . DrawFireEffectMinDistance ; <nl> + const float tooClose = gAIEnv . CVars . legacyFiring . DrawFireEffectMinDistance ; <nl> const Vec3 & firePos = pShooter - > GetFirePos ( ) ; <nl> const Vec3 & targetPos = pTarget - > GetPos ( ) ; <nl> float distanceSq = Distance : : Point_PointSq ( targetPos , firePos ) ; <nl> bool CFireCommandInstant : : DrawFireEffect : : Update ( float updateTime , CPuppet * pSho <nl> return true ; <nl> } <nl> <nl> - float denom = gAIEnv . CVars . DrawFireEffectDecayRange - tooClose ; <nl> + float denom = gAIEnv . CVars . legacyFiring . DrawFireEffectDecayRange - tooClose ; <nl> float distance = sqrt_tpl ( distanceSq ) ; <nl> float distanceFactor = ( distance - tooClose ) / max ( denom , 1 . 0f ) ; <nl> distanceFactor = clamp_tpl ( distanceFactor , 0 . 0f , 1 . 0f ) ; <nl> <nl> - float fovCos = cos_tpl ( DEG2RAD ( gAIEnv . CVars . DrawFireEffectMinTargetFOV * 0 . 5f ) ) ; <nl> + float fovCos = cos_tpl ( DEG2RAD ( gAIEnv . CVars . legacyFiring . DrawFireEffectMinTargetFOV * 0 . 5f ) ) ; <nl> <nl> Vec3 viewTarget = ( firePos - targetPos ) * ( 1 . 0f / distance ) ; <nl> Vec3 targetViewDir = pTarget - > GetViewDir ( ) ; <nl> bool CFireCommandInstant : : DrawFireEffect : : Update ( float updateTime , CPuppet * pSho <nl> fovFactor = 2 . 5f * ( 1 . 0f - viewAngleCos ) / fovCos ; <nl> fovFactor = clamp_tpl ( fovFactor , 0 . 0f , 1 . 0f ) ; <nl> <nl> - float drawTime = gAIEnv . CVars . DrawFireEffectTimeScale * descriptor . drawTime ; <nl> + float drawTime = gAIEnv . CVars . legacyFiring . DrawFireEffectTimeScale * descriptor . drawTime ; <nl> drawTime = ( 0 . 75f * distanceFactor ) * drawTime + ( 0 . 25f * fovFactor ) * drawTime ; <nl> <nl> if ( drawTime < 0 . 125f ) <nl> bool CFireCommandInstant : : DrawFireEffect : : Update ( float updateTime , CPuppet * pSho <nl> front . Normalize ( ) ; <nl> <nl> float startDistance = distance2D - 5 . 0f ; <nl> - float angleDecay = clamp_tpl ( ( distance - gAIEnv . CVars . DrawFireEffectMinDistance ) / gAIEnv . CVars . DrawFireEffectDecayRange , 0 . 0f , 1 . 0f ) ; <nl> - float maxAngle = DEG2RAD ( gAIEnv . CVars . DrawFireEffectMaxAngle ) * angleDecay ; <nl> + float angleDecay = clamp_tpl ( ( distance - gAIEnv . CVars . legacyFiring . DrawFireEffectMinDistance ) / gAIEnv . CVars . legacyFiring . DrawFireEffectDecayRange , 0 . 0f , 1 . 0f ) ; <nl> + float maxAngle = DEG2RAD ( gAIEnv . CVars . legacyFiring . DrawFireEffectMaxAngle ) * angleDecay ; <nl> <nl> float angle = fabs_tpl ( atan2_tpl ( targetHeight , startDistance ) ) ; <nl> angle = clamp_tpl ( angle , 0 . 0f , maxAngle ) ; <nl> bool CFireCommandInstant : : DrawFireEffect : : Update ( float updateTime , CPuppet * pSho <nl> <nl> m_state . state = Running ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawAmbientFire ) <nl> + if ( gAIEnv . CVars . legacyFiring . DebugDrawAmbientFire ) <nl> { <nl> float terrainZ = gEnv - > p3DEngine - > GetTerrainElevation ( aimTarget . x , aimTarget . y ) ; <nl> <nl> EAIFireState CFireCommandLob : : GetBestLob ( IAIObject * pTarget , const AIWeaponDescr <nl> * / <nl> const float distScale = m_pShooter - > GetParameters ( ) . m_fProjectileLaunchDistScale ; <nl> const float distToTarget = targetDir2D . NormalizeSafe ( ) ; <nl> - const float inaccuracyRadius = distToTarget * gAIEnv . CVars . LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation ; <nl> + const float inaccuracyRadius = distToTarget * gAIEnv . CVars . legacyFiring . LobThrowPercentageOfDistanceToTargetUsedForInaccuracySimulation ; <nl> <nl> - const float randomPercentageForPerpendicularRadius = gAIEnv . CVars . LobThrowSimulateRandomInaccuracy ? cry_random ( 0 . 0f , 1 . 0f ) : 0 . 0f ; <nl> + const float randomPercentageForPerpendicularRadius = gAIEnv . CVars . legacyFiring . LobThrowSimulateRandomInaccuracy ? cry_random ( 0 . 0f , 1 . 0f ) : 0 . 0f ; <nl> float perpendicularRadius = - inaccuracyRadius + randomPercentageForPerpendicularRadius * ( 2 * inaccuracyRadius ) ; <nl> <nl> - const float randomPercentageForParallelRadius = gAIEnv . CVars . LobThrowSimulateRandomInaccuracy ? cry_random ( 0 . 0f , 1 . 0f ) : 0 . 0f ; <nl> + const float randomPercentageForParallelRadius = gAIEnv . CVars . legacyFiring . LobThrowSimulateRandomInaccuracy ? cry_random ( 0 . 0f , 1 . 0f ) : 0 . 0f ; <nl> float parallelRadius = randomPercentageForParallelRadius * inaccuracyRadius + ( 1 . 0f - distScale ) * distToTarget ; <nl> <nl> Vec3 targetRightDirection ( - targetDir2D . y , targetDir2D . x , 0 . 0f ) ; <nl> EAIFireState CFireCommandLob : : GetBestLob ( IAIObject * pTarget , const AIWeaponDescr <nl> const float distToTarget = targetDir2D . NormalizeSafe ( ) ; <nl> <nl> const float minimumDistanceToFriendsSq = sqr ( descriptor . minimumDistanceFromFriends > = 0 . 0f ? <nl> - descriptor . minimumDistanceFromFriends : gAIEnv . CVars . LobThrowMinAllowedDistanceFromFriends ) ; <nl> + descriptor . minimumDistanceFromFriends : gAIEnv . CVars . legacyFiring . LobThrowMinAllowedDistanceFromFriends ) ; <nl> <nl> const unsigned maxStepsPerUpdate = 1 ; <nl> const unsigned maxSteps = 5 ; <nl> bool CFireCommandLob : : IsValidDestination ( ERequestedGrenadeType eReqGrenadeType , <nl> } <nl> <nl> / / Check friendly distance <nl> - const float timePrediction = gAIEnv . CVars . LobThrowTimePredictionForFriendPositions ; <nl> + const float timePrediction = gAIEnv . CVars . legacyFiring . LobThrowTimePredictionForFriendPositions ; <nl> AutoAIObjectIter itFriend ( gAIEnv . pAIObjectManager - > GetFirstAIObject ( OBJFILTER_FACTION , m_pShooter - > GetFactionID ( ) ) ) ; <nl> IAIObject * pFriend = itFriend - > GetObject ( ) ; <nl> while ( bValid & & ( pFriend ! = NULL ) ) <nl> new file mode 100644 <nl> index 0000000000 . . c1ed0867c9 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Formation / FormationConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + <nl> + # include " FormationConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyFormation : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_FormationSystem " , FormationSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enables / Dsiable the Formation System . \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawFormations " , DrawFormations , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws all the currently active formations of the AI agents . \ n " <nl> + " Usage : ai_DrawFormations [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) . Set to 1 to draw the AI formations . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 0431aa30d0 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Formation / FormationConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyFormation <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( FormationSystem , 1 ) ; <nl> + DeclareConstIntCVar ( DrawFormations , 0 ) ; <nl> + } ; <nl> mmm a / Code / CryEngine / CryAISystem / GameSpecific / GoalOp_Crysis2 . cpp <nl> ppp b / Code / CryEngine / CryAISystem / GameSpecific / GoalOp_Crysis2 . cpp <nl> EGoalOpResult COPCrysis2Hide : : Execute ( CPipeUser * pPipeUser ) <nl> <nl> CreateHideTarget ( pPipeUser , pos , - normal ) ; <nl> <nl> - if ( gAIEnv . CVars . CoverExactPositioning ) <nl> + if ( gAIEnv . CVars . LegacyCoverExactPositioning ) <nl> { <nl> SAIActorTargetRequest req ; <nl> req . approachLocation = pos + normal * 0 . 25f ; <nl> EGoalOpResult COPCrysis2Hide : : Execute ( CPipeUser * pPipeUser ) <nl> } <nl> <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - if ( gAIEnv . CVars . DebugDrawCover ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . DebugDrawCover ) <nl> GetAISystem ( ) - > AddDebugCylinder ( pos + CoverUp * 0 . 015f , CoverUp , pPipeUser - > GetParameters ( ) . m_fPassRadius , 0 . 025f , Col_Red , 3 . 5f ) ; <nl> # endif <nl> } <nl> EGoalOpResult COPCrysis2Hide : : Execute ( CPipeUser * pPipeUser ) <nl> { <nl> if ( ! m_pPathfinder ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> const Vec3 & vPos = m_refHideTarget - > GetPos ( ) ; <nl> AILogAlways ( " COPCrysis2Hide : : Execute % s pathfinding to ( % 5 . 2f , % 5 . 2f , % 5 . 2f ) " , pPipeUser - > GetName ( ) , <nl> EGoalOpResult COPCrysis2Hide : : Execute ( CPipeUser * pPipeUser ) <nl> } <nl> <nl> CAIObject * targetObject = 0 ; <nl> - if ( gAIEnv . CVars . CoverSystem & & gAIEnv . CVars . CoverExactPositioning ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . CoverSystem & & gAIEnv . CVars . LegacyCoverExactPositioning ) <nl> targetObject = pPipeUser - > GetOrCreateSpecialAIObject ( CPipeUser : : AISPECIAL_ANIM_TARGET ) ; <nl> else <nl> targetObject = m_refHideTarget . GetAIObject ( ) ; <nl> EGoalOpResult COPCrysis2Hide : : Execute ( CPipeUser * pPipeUser ) <nl> { <nl> if ( pPipeUser - > m_nPathDecision = = PATHFINDER_PATHFOUND ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> const Vec3 & vPos = m_refHideTarget - > GetPos ( ) ; <nl> AILogAlways ( " COPCrysis2Hide : : Execute % s Creating trace to hide target ( % 5 . 2f , % 5 . 2f , % 5 . 2f ) " , pPipeUser - > GetName ( ) , <nl> EGoalOpResult COPCrysis2Fly : : Execute ( CPipeUser * pPipeUser ) <nl> result = eGOR_FAILED ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> gEnv - > pRenderer - > GetIRenderAuxGeom ( ) - > DrawCone ( nextPos + Vec3 ( 0 . 0f , 0 . 0f , 2 . 0f ) , Vec3 ( 0 . 0f , 0 . 0f , - 1 . 0f ) , 1 . 0f , 2 . 0f , colour ) ; <nl> } <nl> EGoalOpResult COPCrysis2Fly : : Execute ( CPipeUser * pPipeUser ) <nl> float lookDist = m_lookAheadDist ; <nl> GetLookAheadPoint ( m_PathOut , lookDist , lookAheadPos ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> gEnv - > pRenderer - > GetIRenderAuxGeom ( ) - > DrawCone ( lookAheadPos + Vec3 ( 0 . 0f , 0 . 0f , 2 . 0f ) , Vec3 ( 0 . 0f , 0 . 0f , - 1 . 0f ) , 1 . 0f , 2 . 0f , colour ) ; <nl> } <nl> EGoalOpResult COPCrysis2Fly : : Execute ( CPipeUser * pPipeUser ) <nl> <nl> GetLookAheadPoint ( m_PathOut , lookDist * 2 . 0f , lookAheadPos ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> colour . r = 0 ; <nl> colour . b = 255 ; <nl> EGoalOpResult COPCrysis2Fly : : Execute ( CPipeUser * pPipeUser ) <nl> break ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> CFlightNavRegion2 : : DrawPath ( m_PathOut ) ; <nl> <nl> EGoalOpResult COPCrysis2ChaseTarget : : Execute ( CPipeUser * pPipeUser ) <nl> Vec3 nextPos ; <nl> GetNextPathPoint ( m_PathOut , curPos , nextPos ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> gEnv - > pRenderer - > GetIRenderAuxGeom ( ) - > DrawCone ( nextPos + Vec3 ( 0 . 0f , 0 . 0f , 2 . 0f ) , Vec3 ( 0 . 0f , 0 . 0f , - 1 . 0f ) , 1 . 0f , 2 . 0f , colour ) ; <nl> } <nl> EGoalOpResult COPCrysis2ChaseTarget : : Execute ( CPipeUser * pPipeUser ) <nl> float lookDist = m_lookAheadDist ; <nl> GetLookAheadPoint ( m_PathOut , lookDist , lookAheadPos ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> gEnv - > pRenderer - > GetIRenderAuxGeom ( ) - > DrawCone ( lookAheadPos + Vec3 ( 0 . 0f , 0 . 0f , 2 . 0f ) , Vec3 ( 0 . 0f , 0 . 0f , - 1 . 0f ) , 1 . 0f , 2 . 0f , colour ) ; <nl> } <nl> EGoalOpResult COPCrysis2ChaseTarget : : Execute ( CPipeUser * pPipeUser ) <nl> pPipeUser - > m_State . fDistanceToPathEnd = distanceToEnd ; <nl> pPipeUser - > m_State . vLookTargetPos = lookAheadPos2 ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> colour . r = 0 ; <nl> colour . b = 255 ; <nl> mmm a / Code / CryEngine / CryAISystem / GameSpecific / GoalOp_G02 . cpp <nl> ppp b / Code / CryEngine / CryAISystem / GameSpecific / GoalOp_G02 . cpp <nl> EGoalOpResult COPSeekCover : : Execute ( CPipeUser * pOperand ) <nl> } <nl> else <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AIWarning ( " COPSeekCover : : Entity % s could not find path . " , pOperand - > GetName ( ) ) ; <nl> <nl> Reset ( pOperand ) ; <nl> mmm a / Code / CryEngine / CryAISystem / GameSpecific / GoalOp_G04 . cpp <nl> ppp b / Code / CryEngine / CryAISystem / GameSpecific / GoalOp_G04 . cpp <nl> COPG4Approach : : ~ COPG4Approach ( ) <nl> <nl> void COPG4Approach : : Reset ( CPipeUser * pOperand ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPG4Approach : : Reset % s " , pOperand ? pOperand - > GetName ( ) : " " ) ; <nl> <nl> delete m_pPathfindDirective ; <nl> mmm a / Code / CryEngine / CryAISystem / GoalOp . cpp <nl> ppp b / Code / CryEngine / CryAISystem / GoalOp . cpp <nl> EGoalOpResult COPApproach : : Execute ( CPipeUser * pPipeUser ) <nl> CCCPOINT ( COPApproach_Execute ) ; <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - int debugPathfinding = gAIEnv . CVars . DebugPathFinding ; <nl> + int debugPathfinding = gAIEnv . CVars . LegacyDebugPathFinding ; <nl> <nl> CAIObject * pTarget = static_cast < CAIObject * > ( pPipeUser - > GetAttentionTarget ( ) ) ; <nl> <nl> EGoalOpResult COPApproach : : Execute ( CPipeUser * pPipeUser ) <nl> <nl> void COPApproach : : Reset ( CPipeUser * pPipeUser ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> AILogAlways ( " COPApproach : : Reset % s " , GetNameSafe ( pPipeUser ) ) ; <nl> } <nl> EGoalOpResult COPTacticalPos : : Execute ( CPipeUser * pPipeUser ) <nl> CAIObject * pHideTarget = m_refHideTarget . GetAIObject ( ) ; <nl> assert ( pHideTarget ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> <nl> const Vec3 & vHidePos = pHideTarget - > GetPos ( ) ; <nl> EGoalOpResult COPTacticalPos : : Execute ( CPipeUser * pPipeUser ) <nl> CAIObject * pHideTarget = m_refHideTarget . GetAIObject ( ) ; <nl> if ( pPipeUser - > m_nPathDecision = = PATHFINDER_PATHFOUND ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> / / We should have hide target <nl> const Vec3 & vHidePos = pHideTarget - > GetPos ( ) ; <nl> COPSteer : : ~ COPSteer ( ) <nl> SAFE_DELETE ( m_pPathfindDirective ) ; <nl> SAFE_DELETE ( m_pTraceDirective ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPSteer : : ~ COPSteer % p " , this ) ; <nl> } <nl> <nl> void COPSteer : : DebugDraw ( CPipeUser * pPipeUser ) const <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> void COPSteer : : Reset ( CPipeUser * pPipeUser ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPSteer : : Reset % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> SAFE_DELETE ( m_pPathfindDirective ) ; <nl> void COPSteer : : RegeneratePath ( CPipeUser * pPipeUser , const Vec3 & destination ) <nl> <nl> m_fLastRegenTime = time ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPSteer : : RegeneratePath % s " , GetNameSafe ( pPipeUser ) ) ; <nl> m_pPathfindDirective - > Reset ( pPipeUser ) ; <nl> if ( m_pTraceDirective ) <nl> COPCompanionStick : : ~ COPCompanionStick ( ) <nl> SAFE_DELETE ( m_pPathfindDirective ) ; <nl> SAFE_DELETE ( m_pTraceDirective ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPSteer : : ~ COPSteer % p " , this ) ; <nl> } <nl> <nl> void COPCompanionStick : : ExecuteDry ( CPipeUser * pPipeUser ) <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> void COPCompanionStick : : Reset ( CPipeUser * pPipeUser ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPSteer : : Reset % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> SAFE_DELETE ( m_pPathfindDirective ) ; <nl> void COPCompanionStick : : RegeneratePath ( CPipeUser * pPipeUser , const Vec3 & destina <nl> <nl> m_fLastRegenTime = time ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPCompanionStick : : RegeneratePath % s " , GetNameSafe ( pPipeUser ) ) ; <nl> m_pPathfindDirective - > Reset ( pPipeUser ) ; <nl> if ( m_pTraceDirective ) <nl> mmm a / Code / CryEngine / CryAISystem / GoalOpStick . cpp <nl> ppp b / Code / CryEngine / CryAISystem / GoalOpStick . cpp <nl> COPStick : : COPStick ( float fStickDistance , float fEndAccuracy , float fDuration , in <nl> AIWarning ( " COPStick : : COPStick : Negative stick distance provided . " ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : COPStick % p " , this ) ; <nl> <nl> m_smoothedTargetVel . zero ( ) ; <nl> COPStick : : COPStick ( const XmlNodeRef & node ) : <nl> } <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : COPStick % p " , this ) ; <nl> <nl> m_lastVisibleTime . SetValue ( 0 ) ; <nl> COPStick : : ~ COPStick ( ) <nl> SAFE_DELETE ( m_pPathfindDirective ) ; <nl> SAFE_DELETE ( m_pTraceDirective ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : ~ COPStick % p " , this ) ; <nl> } <nl> <nl> COPStick : : ~ COPStick ( ) <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> void COPStick : : Reset ( CPipeUser * pPipeUser ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Reset % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> m_refStickTarget . Reset ( ) ; <nl> void COPStick : : RegeneratePath ( CPipeUser * pPipeUser , const Vec3 & vDestination ) <nl> if ( ! pPipeUser ) <nl> return ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : RegeneratePath % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> m_pPathfindDirective - > Reset ( pPipeUser ) ; <nl> EGoalOpResult COPStick : : Execute ( CPipeUser * pPipeUser ) <nl> { <nl> CCCPOINT ( COPStick_Execute_TargetRemoved ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute ( % p ) resetting due stick / sight target removed " , this ) ; <nl> <nl> Reset ( NULL ) ; <nl> EGoalOpResult COPStick : : Execute ( CPipeUser * pPipeUser ) <nl> if ( ! m_bContinuous & & pPipeUser - > m_nPathDecision = = PATHFINDER_NOPATH ) <nl> { <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute ( % p ) resetting due to non - continuous and no path % s " , this , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> Reset ( pPipeUser ) ; <nl> EGoalOpResult COPStick : : Execute ( CPipeUser * pPipeUser ) <nl> if ( ! m_pTraceDirective ) <nl> { <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute ( % p ) returning true due to no trace directive % s " , this , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> Reset ( pPipeUser ) ; <nl> bool COPStick : : GetStickAndSightTargets_CreatePathfindAndTraceGoalOps ( CPipeUser * <nl> } <nl> else <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute resetting due to no stick target % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> / / no target , nothing to stick to <nl> bool COPStick : : GetStickAndSightTargets_CreatePathfindAndTraceGoalOps ( CPipeUser * <nl> <nl> Vec3 vStickPos = pStickTarget - > GetPhysicsPos ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute ( % p ) Creating pathfind / trace directives to ( % 5 . 2f , % 5 . 2f , % 5 . 2f ) % s " , this , <nl> vStickPos . x , vStickPos . y , vStickPos . z , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> bool COPStick : : Trace ( CPipeUser * pPipeUser , CAIObject * pStickTarget , EGoalOpResul <nl> if ( ! m_bContinuous & & ( m_eTraceEndMode ! = eTEM_MinimumDistance ) ) <nl> { <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute ( % p ) finishing due to non - continuous and finished tracing % s " , this , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> Reset ( pPipeUser ) ; <nl> bool COPStick : : HandleHijack ( CPipeUser * pPipeUser , const Vec3 & vStickTargetPos , f <nl> m_fApproachTime = - 1 . f ; <nl> m_fHijackDistance = - 1 . f ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute ( % p ) finishing due to non - continuous and finished tracing % s " , this , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> Reset ( pPipeUser ) ; <nl> EGoalOpResult COPStick : : HandlePathDecision ( CPipeUser * pPipeUser , int nPathDecisi <nl> } <nl> else <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPStick : : Execute ( % p ) resetting due to no path % s " , this , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> Reset ( pPipeUser ) ; <nl> mmm a / Code / CryEngine / CryAISystem / GoalOpTrace . cpp <nl> ppp b / Code / CryEngine / CryAISystem / GoalOpTrace . cpp <nl> COPTrace : : COPTrace ( bool bExactFollow , float fEndAccuracy , bool bForceReturnParti <nl> , m_pendingActorTargetRequester ( eTATR_None ) <nl> , m_stopOnAnimationStart ( bStopOnAnimationStart ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPTrace : : COPTrace % p " , this ) ; <nl> <nl> + + s_instanceCount ; <nl> COPTrace : : ~ COPTrace ( ) <nl> m_refPipeUser . Reset ( ) ; <nl> m_refNavTarget . Release ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPTrace : : ~ COPTrace % p % s " , this , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> - - s_instanceCount ; <nl> void COPTrace : : Reset ( CPipeUser * pPipeUser ) <nl> { <nl> CCCPOINT ( COPTrace_Reset ) ; <nl> <nl> - if ( pPipeUser & & gAIEnv . CVars . DebugPathFinding ) <nl> + if ( pPipeUser & & gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPTrace : : Reset % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> if ( pPipeUser ) <nl> bool COPTrace : : ExecuteTrace ( CPipeUser * pPipeUser , bool bFullUpdate ) <nl> } <nl> else <nl> { <nl> - IPathFollower * pPathFollower = gAIEnv . CVars . PredictivePathFollowing ? pPipeUser - > GetPathFollower ( ) : 0 ; <nl> + IPathFollower * pPathFollower = gAIEnv . CVars . LegacyPredictivePathFollowing ? pPipeUser - > GetPathFollower ( ) : 0 ; <nl> float distToSmartObject = pPathFollower ? pPathFollower - > GetDistToSmartObject ( ) : pPipeUser - > m_Path . GetDistToSmartObject ( ! isUsing3DNavigation ) ; <nl> m_passingStraightNavSO = distToSmartObject < 1 . f ; <nl> } <nl> bool COPTrace : : ExecuteTrace ( CPipeUser * pPipeUser , bool bFullUpdate ) <nl> ! pPipeUser - > m_Path . GetParams ( ) . precalculatedPath & & <nl> ! pPipeUser - > m_Path . GetParams ( ) . inhibitPathRegeneration ) ) <nl> { <nl> - if ( gAIEnv . CVars . AdjustPathsAroundDynamicObstacles ! = 0 ) <nl> + if ( gAIEnv . CVars . LegacyAdjustPathsAroundDynamicObstacles ! = 0 ) <nl> { <nl> RegeneratePath ( pPipeUser , & bForceRegeneratePath ) ; <nl> } <nl> bool COPTrace : : ExecuteTrace ( CPipeUser * pPipeUser , bool bFullUpdate ) <nl> / / ExecuteTrace Core <nl> if ( ! m_bWaitingForPathResult & & ! m_bWaitingForBusySmartObject ) <nl> { <nl> - IPathFollower * pPathFollower = gAIEnv . CVars . PredictivePathFollowing ? pPipeUser - > GetPathFollower ( ) : 0 ; <nl> + IPathFollower * pPathFollower = gAIEnv . CVars . LegacyPredictivePathFollowing ? pPipeUser - > GetPathFollower ( ) : 0 ; <nl> bTraceFinished = pPathFollower ? ExecutePathFollower ( pPipeUser , bFullUpdate , pPathFollower ) <nl> : isUsing3DNavigation ? Execute3D ( pPipeUser , bFullUpdate ) : Execute2D ( pPipeUser , bFullUpdate ) ; <nl> } <nl> bool COPTrace : : ExecutePostamble ( CPipeUser * pPipeUser , bool & reachedEnd , bool ful <nl> if ( speed > criticalSpeed ) <nl> { <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPTrace reached end but waiting for speed % 5 . 2f to fall below % 5 . 2f % s " , <nl> speed , criticalSpeed , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> bool COPTrace : : ExecuteLanding ( CPipeUser * pPipeUser , const Vec3 & pathEnd ) <nl> if ( m_landingDir . IsZero ( ) ) <nl> { <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPTrace : : ExecuteLanding starting final landing % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> m_landingDir = pPipeUser - > GetMoveDir ( ) ; <nl> void COPTrace : : DebugDraw ( CPipeUser * pPipeUser ) const <nl> <nl> void COPTrace : : ExecuteTraceDebugDraw ( CPipeUser * pPipeUser ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> if ( IAIDebugRenderer * pRenderer = gAIEnv . GetDebugRenderer ( ) ) <nl> { <nl> bool COPTrace : : HandleAnimationPhase ( CPipeUser * pPipeUser , bool bFullUpdate , bool <nl> { <nl> case eTATR_EndOfPath : <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPTrace : : ExecuteTrace resetting since error occurred during exact positioning % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> if ( bFullUpdate ) <nl> bool COPTrace : : HandleAnimationPhase ( CPipeUser * pPipeUser , bool bFullUpdate , bool <nl> m_actorTargetRequester = eTATR_None ; <nl> / / Exact positioning has been finished at the end of the path , the trace is completed . <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " COPTrace : : ExecuteTrace resetting since exact position reached / animation finished % s " , GetNameSafe ( pPipeUser ) ) ; <nl> <nl> if ( bFullUpdate ) <nl> void COPTrace : : TriggerExactPositioning ( CPipeUser * pPipeUser , bool * pbForceRegene <nl> { <nl> case eATP_None : <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> SNavSOStates & pipeUserPendingNavSOStates = pPipeUser - > m_pendingNavSOStates ; <nl> if ( ! pipeUserPendingNavSOStates . IsEmpty ( ) ) <nl> mmm a / Code / CryEngine / CryAISystem / MNMPathfinder . cpp <nl> ppp b / Code / CryEngine / CryAISystem / MNMPathfinder . cpp <nl> void MNM : : PathfinderUtils : : QueuedRequest : : SetupAttentionTargetDanger ( ) <nl> const float effectRange = 0 . 0f ; / / Effect over all the world <nl> const Vec3 & dangerPosition = pEntity ? pEntity - > GetPos ( ) : pAttTarget - > GetPos ( ) ; <nl> MNM : : DangerAreaConstPtr info ; <nl> - info . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Direction > ( dangerPosition , effectRange , gAIEnv . CVars . PathfinderDangerCostForAttentionTarget ) ) ; <nl> + info . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Direction > ( dangerPosition , effectRange , gAIEnv . CVars . pathfinder . PathfinderDangerCostForAttentionTarget ) ) ; <nl> dangerousAreas . push_back ( info ) ; <nl> } <nl> } <nl> void MNM : : PathfinderUtils : : QueuedRequest : : SetupExplosiveDangers ( ) <nl> <nl> const IEntity * pEntity = gEnv - > pEntitySystem - > GetEntity ( requesterEntityId ) ; <nl> <nl> - const float maxDistanceSq = sqr ( gAIEnv . CVars . PathfinderExplosiveDangerMaxThreatDistance ) ; <nl> + const float maxDistanceSq = sqr ( gAIEnv . CVars . pathfinder . PathfinderExplosiveDangerMaxThreatDistance ) ; <nl> const float maxDistanceSqToMergeExplosivesThreat = 3 . 0f ; <nl> <nl> std : : vector < Vec3 > grenadesLocations ; <nl> void MNM : : PathfinderUtils : : QueuedRequest : : SetupExplosiveDangers ( ) <nl> if ( it = = dangerousAreas . end ( ) ) <nl> { <nl> MNM : : DangerAreaConstPtr info ; <nl> - info . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Range > ( pos , gAIEnv . CVars . PathfinderExplosiveDangerRadius , <nl> - gAIEnv . CVars . PathfinderDangerCostForExplosives ) ) ; <nl> + info . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Range > ( pos , gAIEnv . CVars . pathfinder . PathfinderExplosiveDangerRadius , <nl> + gAIEnv . CVars . pathfinder . PathfinderDangerCostForExplosives ) ) ; <nl> dangerousAreas . push_back ( info ) ; <nl> } <nl> } <nl> void MNM : : PathfinderUtils : : QueuedRequest : : SetupGroupMatesAvoidance ( ) <nl> MNM : : DangerAreaConstPtr dangerArea ; <nl> dangerArea . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Range > ( <nl> groupMemberAIObject - > GetPos ( ) , <nl> - gAIEnv . CVars . PathfinderGroupMatesAvoidanceRadius , <nl> - gAIEnv . CVars . PathfinderAvoidanceCostForGroupMates <nl> + gAIEnv . CVars . pathfinder . PathfinderGroupMatesAvoidanceRadius , <nl> + gAIEnv . CVars . pathfinder . PathfinderAvoidanceCostForGroupMates <nl> ) ) ; <nl> dangerousAreas . push_back ( dangerArea ) ; <nl> } <nl> DECLARE_JOB ( " PathConstruction " , PathConstructionJob , ConstructPathIfWayWasFoundJ <nl> <nl> CMNMPathfinder : : CMNMPathfinder ( ) <nl> { <nl> - m_pathfindingFailedEventsToDispatch . reserve ( gAIEnv . CVars . MNMPathfinderConcurrentRequests ) ; <nl> - m_pathfindingCompletedEventsToDispatch . reserve ( gAIEnv . CVars . MNMPathfinderConcurrentRequests ) ; <nl> + m_pathfindingFailedEventsToDispatch . reserve ( gAIEnv . CVars . pathfinder . MNMPathfinderConcurrentRequests ) ; <nl> + m_pathfindingCompletedEventsToDispatch . reserve ( gAIEnv . CVars . pathfinder . MNMPathfinderConcurrentRequests ) ; <nl> } <nl> <nl> CMNMPathfinder : : ~ CMNMPathfinder ( ) <nl> void CMNMPathfinder : : SetupNewValidPathRequests ( ) <nl> { <nl> MNM : : PathfinderUtils : : ProcessingContext & processingContext = m_processingContextsPool . GetContextAtPosition ( id ) ; <nl> assert ( processingContext . status = = MNM : : PathfinderUtils : : ProcessingContext : : Reserved ) ; <nl> - processingContext . workingSet . aStarNodesList . SetFrameTimeQuota ( gAIEnv . CVars . MNMPathFinderQuota ) ; <nl> + processingContext . workingSet . aStarNodesList . SetFrameTimeQuota ( gAIEnv . CVars . pathfinder . MNMPathFinderQuota ) ; <nl> <nl> const EMNMPathResult pathResult = SetupForNextPathRequest ( idQueuedRequest , requestToServe , processingContext ) ; <nl> if ( pathResult ! = EMNMPathResult : : Success ) <nl> void CMNMPathfinder : : SpawnJobs ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const bool isPathfinderMultithreaded = gAIEnv . CVars . MNMPathfinderMT ! = 0 ; <nl> + const bool isPathfinderMultithreaded = gAIEnv . CVars . pathfinder . MNMPathfinderMT ! = 0 ; <nl> if ( isPathfinderMultithreaded ) <nl> { <nl> m_processingContextsPool . ExecuteFunctionOnElements ( functor ( * this , & CMNMPathfinder : : SpawnAppropriateJobIfPossible ) ) ; <nl> void CMNMPathfinder : : Update ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - if ( gAIEnv . CVars . MNMPathFinderDebug ) <nl> + if ( gAIEnv . CVars . pathfinder . MNMPathFinderDebug ) <nl> { <nl> DebugAllStatistics ( ) ; <nl> } <nl> void CMNMPathfinder : : ConstructPathIfWayWasFound ( MNM : : PathfinderUtils : : Processing <nl> + + processingContext . constructedPathsCount ; <nl> <nl> CTimeValue timeBeforePathConstruction ; <nl> - if ( gAIEnv . CVars . MNMPathFinderDebug ) <nl> + if ( gAIEnv . CVars . pathfinder . MNMPathFinderDebug ) <nl> { <nl> timeBeforePathConstruction = gEnv - > pTimer - > GetAsyncCurTime ( ) ; <nl> } <nl> void CMNMPathfinder : : ConstructPathIfWayWasFound ( MNM : : PathfinderUtils : : Processing <nl> processingRequest . data . requestParams . endLocation , <nl> * & outputPath ) ; <nl> <nl> - if ( gAIEnv . CVars . MNMPathFinderDebug ) <nl> + if ( gAIEnv . CVars . pathfinder . MNMPathFinderDebug ) <nl> { <nl> CTimeValue timeAfterPathConstruction = gEnv - > pTimer - > GetAsyncCurTime ( ) ; <nl> const float constructionPathTime = timeAfterPathConstruction . GetDifferenceInSeconds ( timeBeforePathConstruction ) * 1000 . 0f ; <nl> void CMNMPathfinder : : ConstructPathIfWayWasFound ( MNM : : PathfinderUtils : : Processing <nl> <nl> if ( bPathConstructed ) <nl> { <nl> - if ( processingRequest . data . requestParams . beautify & & gAIEnv . CVars . BeautifyPath ) <nl> + if ( processingRequest . data . requestParams . beautify & & gAIEnv . CVars . pathfinder . BeautifyPath ) <nl> { <nl> CTimeValue timeBeforeBeautifyPath ; <nl> - if ( gAIEnv . CVars . MNMPathFinderDebug ) <nl> + if ( gAIEnv . CVars . pathfinder . MNMPathFinderDebug ) <nl> { <nl> timeBeforeBeautifyPath = gEnv - > pTimer - > GetAsyncCurTime ( ) ; <nl> } <nl> <nl> - outputPath . PullPathOnNavigationMesh ( navMesh , gAIEnv . CVars . PathStringPullingIterations , processingRequest . data . requestParams . pCustomPathCostComputer . get ( ) ) ; <nl> + outputPath . PullPathOnNavigationMesh ( navMesh , gAIEnv . CVars . pathfinder . PathStringPullingIterations , processingRequest . data . requestParams . pCustomPathCostComputer . get ( ) ) ; <nl> <nl> - if ( gAIEnv . CVars . MNMPathFinderDebug ) <nl> + if ( gAIEnv . CVars . pathfinder . MNMPathFinderDebug ) <nl> { <nl> CTimeValue timeAfterBeautifyPath = gEnv - > pTimer - > GetAsyncCurTime ( ) ; <nl> const float beautifyPathTime = timeAfterBeautifyPath . GetDifferenceInSeconds ( timeBeforeBeautifyPath ) * 1000 . 0f ; <nl> mmm a / Code / CryEngine / CryAISystem / MNMPathfinder . h <nl> ppp b / Code / CryEngine / CryAISystem / MNMPathfinder . h <nl> class ProcessingContextsPool <nl> <nl> void Reset ( ) <nl> { <nl> - const int poolSize = gAIEnv . CVars . MNMPathfinderConcurrentRequests ; <nl> + const int poolSize = gAIEnv . CVars . pathfinder . MNMPathfinderConcurrentRequests ; <nl> <nl> m_pool . clear ( ) ; <nl> m_pool . reserve ( poolSize ) ; <nl> new file mode 100644 <nl> index 0000000000 . . 10482d8097 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / MNMPathfinderConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " MNMPathfinderConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsMNMPathfinder : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_MNMPathfinderPositionInTrianglePredictionType " , MNMPathfinderPositionInTrianglePredictionType , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Defines which type of prediction for the point inside each triangle used by the pathfinder heuristic to search for the " <nl> + " path with minimal cost . \ n " <nl> + " 0 - Triangle center . \ n " <nl> + " 1 - Advanced prediction . \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_BeautifyPath " , BeautifyPath , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles AI optimisation of the generated path . \ n " <nl> + " Usage : ai_BeautifyPath [ 0 / 1 ] \ n " <nl> + " Default is 1 ( on ) . Optimisation is on by default . Set to 0 to \ n " <nl> + " disable path optimisation ( AI uses non - optimised path ) . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_PathStringPullingIterations " , PathStringPullingIterations , 5 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Defines the number of iteration used for the string pulling operation to simplify the path " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_MNMPathfinderMT " , MNMPathfinderMT , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enable / Disable Multi Threading for the pathfinder . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_MNMPathfinderConcurrentRequests " , MNMPathfinderConcurrentRequests , 4 , VF_CHEAT | VF_CHEAT_NOCHECK , " Defines the amount of concurrent pathfinder requests that can be served at the same time . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMPathFinderQuota " , & MNMPathFinderQuota , 0 . 001f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Set path finding frame time quota in seconds ( Set to 0 for no limit ) " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_PathfindTimeLimit " , & AllowedTimeForPathfinding , 0 . 08f , VF_NULL , <nl> + " Specifies how many seconds an individual AI can hold the pathfinder blocked \ n " <nl> + " Usage : ai_PathfindTimeLimit 0 . 15 \ n " <nl> + " Default is 0 . 08 . A lower value will result in more path requests that end in NOPATH - \ n " <nl> + " although the path may actually exist . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMPathFinderDebug " , & MNMPathFinderDebug , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable debug draw statistics on pathfinder load . Note that construction and beautify times are only calculated once this CVAR is enabled . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_PathfinderDangerCostForAttentionTarget " , PathfinderDangerCostForAttentionTarget , 5 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Cost used in the heuristic calculation for the danger created by the attention target position . " ) ; <nl> + DefineConstIntCVarName ( " ai_PathfinderDangerCostForExplosives " , PathfinderDangerCostForExplosives , 2 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Cost used in the heuristic calculation for the danger created by the position of explosive objects . " ) ; <nl> + DefineConstIntCVarName ( " ai_PathfinderAvoidanceCostForGroupMates " , PathfinderAvoidanceCostForGroupMates , 2 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Cost used in the heuristic calculation for the avoidance of the group mates ' s positions . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_PathfinderExplosiveDangerRadius " , & PathfinderExplosiveDangerRadius , 5 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Range used to evaluate the explosive threats in the path calculation . Outside this range a location is considered safe . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_PathfinderExplosiveDangerMaxThreatDistance " , & PathfinderExplosiveDangerMaxThreatDistance , 50 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Range used to decide if evaluate an explosive danger as an actual threat . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_PathfinderGroupMatesAvoidanceRadius " , & PathfinderGroupMatesAvoidanceRadius , 4 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Range used to evaluate the group mates avoidance in the path calculation . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . f275ee90ee <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / MNMPathfinderConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsMNMPathfinder <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( BeautifyPath , 1 ) ; <nl> + DeclareConstIntCVar ( PathStringPullingIterations , 5 ) ; <nl> + DeclareConstIntCVar ( MNMPathfinderMT , 1 ) ; <nl> + DeclareConstIntCVar ( MNMPathfinderConcurrentRequests , 4 ) ; <nl> + DeclareConstIntCVar ( MNMPathfinderPositionInTrianglePredictionType , 1 ) ; <nl> + DeclareConstIntCVar ( PathfinderDangerCostForAttentionTarget , 5 ) ; <nl> + DeclareConstIntCVar ( PathfinderDangerCostForExplosives , 2 ) ; <nl> + DeclareConstIntCVar ( PathfinderAvoidanceCostForGroupMates , 2 ) ; <nl> + <nl> + int MNMPathFinderDebug ; <nl> + float MNMPathFinderQuota ; <nl> + float AllowedTimeForPathfinding ; <nl> + float PathfinderExplosiveDangerRadius ; <nl> + float PathfinderExplosiveDangerMaxThreatDistance ; <nl> + float PathfinderGroupMatesAvoidanceRadius ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / MissLocationSensor . cpp <nl> ppp b / Code / CryEngine / CryAISystem / MissLocationSensor . cpp <nl> void CMissLocationSensor : : Collect ( int types ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const float boxHalfSize = gAIEnv . CVars . CoolMissesBoxSize * 0 . 5f ; <nl> - const float boxHeight = gAIEnv . CVars . CoolMissesBoxHeight ; <nl> + const float boxHalfSize = gAIEnv . CVars . legacyFiring . CoolMissesBoxSize * 0 . 5f ; <nl> + const float boxHeight = gAIEnv . CVars . legacyFiring . CoolMissesBoxHeight ; <nl> <nl> const Vec3 & feet = m_owner - > GetPhysicsPos ( ) ; <nl> const Vec3 & dir = m_owner - > GetViewDir ( ) ; <nl> bool CMissLocationSensor : : Filter ( float timeLimit ) <nl> CTimeValue start = now ; <nl> CTimeValue endTime = now + CTimeValue ( timeLimit ) ; <nl> <nl> - float MaxMass = gAIEnv . CVars . CoolMissesMaxLightweightEntityMass ; <nl> + float MaxMass = gAIEnv . CVars . legacyFiring . CoolMissesMaxLightweightEntityMass ; <nl> <nl> pe_params_part pp ; <nl> pe_status_dynamics dyn ; <nl> bool CMissLocationSensor : : GetLocation ( CAIObject * target , const Vec3 & shootPos , c <nl> const MissLocation & location = m_goodies [ cry_random ( ( size_t ) 0 , goodiesCount - 1 ) ] ; <nl> <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - if ( gAIEnv . CVars . DebugDrawCoolMisses ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawCoolMisses ) <nl> { <nl> GetAISystem ( ) - > AddDebugCone ( location . position + Vec3 ( 0 . 0f , 0 . 0f , 0 . 75f ) , Vec3 ( 0 . 0f , 0 . 0f , - 1 . 0f ) , 0 . 225f , 0 . 35f , <nl> Col_Green , 0 . 5f ) ; <nl> bool CMissLocationSensor : : GetLocation ( CAIObject * target , const Vec3 & shootPos , c <nl> void CMissLocationSensor : : DebugDraw ( ) <nl> { <nl> # ifdef CRYAISYSTEM_DEBUG <nl> - if ( gAIEnv . CVars . DebugDrawCoolMisses ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawCoolMisses ) <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> mmm a / Code / CryEngine / CryAISystem / Movement / MovementBlock_FollowPath . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Movement / MovementBlock_FollowPath . cpp <nl> void FollowPath : : OnNavigationAnnotationChanged ( NavigationAgentTypeID navigationA <nl> <nl> void FollowPath : : QueueNavigationChange ( NavigationAgentTypeID navigationAgentTypeID , NavigationMeshID meshID , MNM : : TileID tileID , const SMeshTileChange : : ChangeFlags & changeFlag ) <nl> { <nl> - if ( gAIEnv . CVars . MovementSystemPathReplanningEnabled ) <nl> + if ( gAIEnv . CVars . movement . MovementSystemPathReplanningEnabled ) <nl> { <nl> if ( m_path . GetMeshID ( ) = = meshID ) <nl> { <nl> new file mode 100644 <nl> index 0000000000 . . 14d6ad6a06 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Movement / MovementConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " MovementConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsMovement : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_DebugMovementSystem " , DebugMovementSystem , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draw debug information to the screen regarding character movement . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugMovementSystemActorRequests " , DebugMovementSystemActorRequests , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draw queued movement requests of actors in the world as text above their head . \ n " <nl> + " 0 - Off \ n " <nl> + " 1 - Draw request queue of only the currently selected agent \ n " <nl> + " 2 - Draw request queue of all agents " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MovementSystemPathReplanningEnabled " , & MovementSystemPathReplanningEnabled , 0 , VF_NULL , <nl> + " Enable / disable path - replanning of moving actors in the MovementSystem every time \ n " <nl> + " a navigation - mesh change at runtime affects their current path . \ n " <nl> + " Ignores designer - placed paths . \ n " <nl> + " 0 - disabled ( default ) \ n " <nl> + " 1 - enabled " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . e8c1d6916d <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Movement / MovementConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsMovement <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( DebugMovementSystem , 0 ) ; <nl> + DeclareConstIntCVar ( DebugMovementSystemActorRequests , 0 ) ; <nl> + <nl> + int MovementSystemPathReplanningEnabled ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / Movement / MovementSystem . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Movement / MovementSystem . cpp <nl> void MovementSystem : : Update ( const CTimeValue frameStartTime , const float frameDe <nl> UpdateActors ( ) ; <nl> <nl> # if defined ( COMPILE_WITH_MOVEMENT_SYSTEM_DEBUG ) <nl> - if ( gAIEnv . CVars . DebugMovementSystem ) <nl> + if ( gAIEnv . CVars . movement . DebugMovementSystem ) <nl> { <nl> DrawDebugInformation ( ) ; <nl> } <nl> - if ( gAIEnv . CVars . DebugMovementSystemActorRequests ) <nl> + if ( gAIEnv . CVars . movement . DebugMovementSystemActorRequests ) <nl> { <nl> - if ( gAIEnv . CVars . DebugMovementSystemActorRequests = = 1 ) <nl> + if ( gAIEnv . CVars . movement . DebugMovementSystemActorRequests = = 1 ) <nl> { <nl> Actors : : const_iterator itActor = std : : find_if ( m_actors . begin ( ) , m_actors . end ( ) , ActorMatchesIdPredicate ( GetAISystem ( ) - > GetAgentDebugTarget ( ) ) ) ; <nl> if ( itActor ! = m_actors . end ( ) ) <nl> void MovementSystem : : Update ( const CTimeValue frameStartTime , const float frameDe <nl> DrawMovementRequestsForActor ( * itActor ) ; <nl> } <nl> } <nl> - else if ( gAIEnv . CVars . DebugMovementSystemActorRequests = = 2 ) <nl> + else if ( gAIEnv . CVars . movement . DebugMovementSystemActorRequests = = 2 ) <nl> { <nl> for ( Actors : : const_iterator itActor = m_actors . begin ( ) ; itActor ! = m_actors . end ( ) ; + + itActor ) <nl> { <nl> mmm a / Code / CryEngine / CryAISystem / NavPath . cpp <nl> ppp b / Code / CryEngine / CryAISystem / NavPath . cpp <nl> bool CNavPath : : Empty ( ) const <nl> void CNavPath : : Clear ( const char * dbgString ) <nl> { <nl> + + m_version . v ; <nl> - if ( gAIEnv . CVars . DebugPathFinding & & ! m_pathPoints . empty ( ) ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding & & ! m_pathPoints . empty ( ) ) <nl> { <nl> const PathPointDescriptor & ppd = m_pathPoints . back ( ) ; <nl> AILogAlways ( " CNavPath : : Clear old path end is ( % 5 . 2f , % 5 . 2f , % 5 . 2f ) % s " , <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / NavMesh . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / NavMesh . cpp <nl> void CNavMesh : : PredictNextTriangleEntryPosition ( const TriangleID bestNodeTriangl <nl> const vector3_t v0 = tileOrigin + vector3_t ( currentTile . vertices [ triangle . vertex [ edgeIndex ] ] ) ; <nl> const vector3_t v1 = tileOrigin + vector3_t ( currentTile . vertices [ triangle . vertex [ Utils : : next_mod3 ( edgeIndex ) ] ] ) ; <nl> <nl> - switch ( gAIEnv . CVars . MNMPathfinderPositionInTrianglePredictionType ) <nl> + switch ( gAIEnv . CVars . pathfinder . MNMPathfinderPositionInTrianglePredictionType ) <nl> { <nl> case ePredictionType_TriangleCenter : <nl> { <nl> MNM : : ERayCastResult CNavMesh : : RayCast ( const vector3_t & fromLocalPosition , Triang <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - switch ( gAIEnv . CVars . MNMRaycastImplementation ) <nl> + switch ( gAIEnv . CVars . navigation . MNMRaycastImplementation ) <nl> { <nl> case 0 : <nl> return RayCast_v1 ( fromLocalPosition , fromTri , toLocalPosition , toTri , raycastRequest ) ; <nl> void CNavMesh : : Draw ( size_t drawFlags , const ITriangleColorSelector & colorSelecto <nl> <nl> const CCamera & camera = gEnv - > pSystem - > GetViewCamera ( ) ; <nl> const Vec3 cameraPos = camera . GetPosition ( ) ; <nl> - const float maxDistanceToRenderSqr = sqr ( gAIEnv . CVars . NavmeshTileDistanceDraw ) ; <nl> + const float maxDistanceToRenderSqr = sqr ( gAIEnv . CVars . navigation . NavmeshTileDistanceDraw ) ; <nl> <nl> / / collect areas <nl> / / TODO : Clean this up ! Temporary to get up and running . <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / NavMeshQuery . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / NavMeshQuery . cpp <nl> void CNavMeshQuery : : DebugQueryResult ( const CTimeValue & timeAtStart ) <nl> <nl> void CNavMeshQuery : : DebugDrawQueryConfig ( ) const <nl> { <nl> - if ( ! gAIEnv . CVars . DebugDrawNavigationQueriesUDR ) <nl> + if ( ! gAIEnv . CVars . navigation . DebugDrawNavigationQueriesUDR ) <nl> { <nl> return ; <nl> } <nl> void CNavMeshQuery : : DebugDrawQueryConfig ( ) const <nl> <nl> void CNavMeshQuery : : DebugDrawQueryBatch ( const MNM : : INavMeshQueryDebug : : SBatchData & queryBatch ) const <nl> { <nl> - if ( ! gAIEnv . CVars . DebugDrawNavigationQueriesUDR ) <nl> + if ( ! gAIEnv . CVars . navigation . DebugDrawNavigationQueriesUDR ) <nl> { <nl> return ; <nl> } <nl> void CNavMeshQuery : : DebugDrawQueryBatch ( const MNM : : INavMeshQueryDebug : : SBatchDat <nl> <nl> void CNavMeshQuery : : DebugDrawQueryInvalidation ( const MNM : : INavMeshQueryDebug : : SInvalidationData & invalidationData ) const <nl> { <nl> - if ( ! gAIEnv . CVars . DebugDrawNavigationQueriesUDR ) <nl> + if ( ! gAIEnv . CVars . navigation . DebugDrawNavigationQueriesUDR ) <nl> { <nl> return ; <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / NavMeshQueryDebug . h <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / NavMeshQueryDebug . h <nl> namespace MNM <nl> <nl> virtual bool AddBatchToHistory ( const INavMeshQueryDebug : : SBatchData & queryBatch ) override <nl> { <nl> - if ( ! gAIEnv . CVars . StoreNavigationQueriesHistory & & ! gAIEnv . CVars . DebugDrawNavigationQueriesUDR ) <nl> + if ( ! gAIEnv . CVars . navigation . StoreNavigationQueriesHistory & & ! gAIEnv . CVars . navigation . DebugDrawNavigationQueriesUDR ) <nl> { <nl> return false ; <nl> } <nl> namespace MNM <nl> <nl> virtual bool AddInvalidationToHistory ( const INavMeshQueryDebug : : SInvalidationData & queryInvalidation ) override <nl> { <nl> - if ( ! gAIEnv . CVars . StoreNavigationQueriesHistory & & ! gAIEnv . CVars . DebugDrawNavigationQueriesUDR ) <nl> + if ( ! gAIEnv . CVars . navigation . StoreNavigationQueriesHistory & & ! gAIEnv . CVars . navigation . DebugDrawNavigationQueriesUDR ) <nl> { <nl> return false ; <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / MNM / NavMeshQueryManager . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / MNM / NavMeshQueryManager . cpp <nl> namespace MNM <nl> <nl> void CNavMeshQueryManager : : DebugDrawQueriesList ( ) const <nl> { <nl> - if ( ! gAIEnv . CVars . DebugDrawNavigationQueriesList ) <nl> + if ( ! gAIEnv . CVars . navigation . DebugDrawNavigationQueriesList ) <nl> { <nl> return ; <nl> } <nl> new file mode 100644 <nl> index 0000000000 . . b64bd3a6d2 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " NavigationConsoleVariables . h " <nl> + # include " NavigationSystem . h " <nl> + <nl> + void SAIConsoleVarsNavigation : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_DebugDrawNavigation " , DebugDrawNavigation , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays the navigation debug information . \ n " <nl> + " Usage : ai_DebugDrawNavigation [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - triangles and contour \ n " <nl> + " 2 - triangles , mesh and contours \ n " <nl> + " 3 - triangles , mesh contours and external links \ n " <nl> + " 4 - triangles , mesh contours , external links and triangle IDs \ n " <nl> + " 5 - triangles , mesh contours , external links and island IDs \ n " <nl> + " 6 - triangles with backfaces , mesh contours and external links \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_MNMDebugTriangleOnCursor " , DebugTriangleOnCursor , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays the basic information about the MNM Triangle where the cursor is pointing . \ n " <nl> + " Usage : ai_MNMDebugTriangleOnCursor [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - show triangle information \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_NavigationSystemMT " , NavigationSystemMT , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables navigation information updates on a separate thread . \ n " <nl> + " Usage : ai_NavigationSystemMT [ 0 / 1 ] \ n " <nl> + " Default is 1 ( on ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - on \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_NavGenThreadJobs " , NavGenThreadJobs , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Number of tile generation jobs per thread per frame . \ n " <nl> + " Usage : ai_NavGenThreadJobs [ 1 + ] \ n " <nl> + " Default is 1 . The more you have , the faster it will go but the frame rate will drop while it works . \ n " <nl> + " Recommendations : \ n " <nl> + " Fast machine [ 10 ] \ n " <nl> + " Slow machine [ 4 ] \ n " <nl> + " Smooth [ 1 ] \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawNavigationWorldMonitor " , DebugDrawNavigationWorldMonitor , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables displaying bounding boxes for world changes . \ n " <nl> + " Usage : ai_DebugDrawNavigationWorldMonitor [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - on \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_MNMRaycastImplementation " , MNMRaycastImplementation , 2 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Defines which type of raycast implementation to use on the MNM meshes . " <nl> + " 0 - Version 1 . This version will be deprecated as it sometimes does not handle correctly the cases where the ray coincides with triangle egdes , which has been fixed in the new version . \ n " <nl> + " 1 - Version 2 . This version also fails in some cases when the ray goes exactly through triangle corners and then hitting the wall . \ n " <nl> + " 2 - Version 3 . The newest version that should be working in all special cases . This version is around 40 % faster then the previous one . \ n " <nl> + " Any other value is used for the biggest version . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_MNMRemoveInaccessibleTrianglesOnLoad " , MNMRemoveInaccessibleTrianglesOnLoad , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Defines whether inaccessible triangles can be removed from NavMeshes after they are loaded ( Note : the triangles are never removed in Editor ) . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_StoreNavigationQueriesHistory " , StoreNavigationQueriesHistory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables the storage of navigation queries in a history . History can be displayed enabling the cvar ai_DebugDrawNavigationQueries . \ n " <nl> + " Requires ai_debugDraw and ai_debugDrawNavigation to be enabled . \ n " <nl> + " Usage : ai_StoreNavigationQueriesHistory [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - on \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawNavigationQueriesUDR " , DebugDrawNavigationQueriesUDR , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays the navigation queries debug information using UDR . \ n " <nl> + " Requires ai_debugDraw , ai_debugDrawNavigation and ai_storeNavigationQueriesHistory to be enabled . \ n " <nl> + " Usage : ai_DebugDrawNavigationQueriesUDR [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - Displays the query config , triangles by batches and invalidations \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawNavigationQueriesList " , DebugDrawNavigationQueriesList , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Displays a navigation queries list in the screen with all batches and elapsed times . \ n " <nl> + " Requires ai_debugDraw , ai_debugDrawNavigation and ai_storeNavigationQueriesHistory to be enabled . \ n " <nl> + " Note that , by their nature , instant queries won ' t be listed here . \ n " <nl> + " Usage : ai_DebugDrawNavigationQueriesList [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) \ n " <nl> + " 0 - off \ n " <nl> + " 1 - on \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DebugDrawNavigationQueryListFilterByCaller " , & DebugDrawNavigationQueryListFilterByCaller , " None " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Navigation Queries list only displays those queries that contain the given filter string . \ n " <nl> + " By default value is set to None ( no filter is applied ) . \ n " <nl> + " Requires ai_debugDraw , ai_debugDrawNavigation and ai_DebugDrawNavigationQueriesList to be enabled . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMDebugDrawFlag " , & MNMDebugDrawFlag <nl> + , " " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Color the MNM triangles is overriden by the specified annotation flag color . \ n " <nl> + " Usage : ai_MNMDebugDrawFlag ' flagName ' \ n " <nl> + " Default is ' empty ' \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_NavmeshTileDistanceDraw " , & NavmeshTileDistanceDraw , 200 . 0f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Maximum distance from the camera for tile to be drawn . \ n " <nl> + " Usage : ai_NavmeshTileDistanceDraw [ 0 . 0 - . . . ] \ n " <nl> + " Default is 200 . 0 \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_NavmeshStabilizationTimeToUpdate " , & NavmeshStabilizationTimeToUpdate , 0 . 3f , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Time that navmesh needs to be without any new updates to apply the latest changes . \ n " <nl> + " Usage : ai_NavmeshStabilizationTimeToUpdate [ 0 . 0 - . . . ] \ n " <nl> + " Default is 0 . 3 \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMProfileMemory " , & MNMProfileMemory , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Display navigation system memory statistics " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMDebugAccessibility " , & MNMDebugAccessibility , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Display navigation unreachable areas in gray color . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMEditorBackgroundUpdate " , & MNMEditorBackgroundUpdate , 1 , VF_NULL , <nl> + " [ 0 - 1 ] Enable / Disable editor background update of the Navigation Meshes " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMAllowDynamicRegenInEditor " , & MNMAllowDynamicRegenInEditor , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Allow dynamic regeneration of MNM when in the editor , when in game mode . Put this CVar in your configuration file rather than changing it during execution . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_MNMDebugDrawTileStates " , & MNMDebugDrawTileStates , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Display tiles ' borders based on their update state . \ n " <nl> + " orange - in active updates queue \ n " <nl> + " yellow - update after stabilization \ n " <nl> + " blue - changed during disabled regeneration \ n " <nl> + " gray - changed during level load " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_debugMNMAgentType " , DebugMNMAgentType , VF_NULL , <nl> + " Enabled MNM debug draw for an specific agent type . \ n " <nl> + " Usage : ai_debugMNMAgentType [ AgentTypeName ] \ n " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_MNMCalculateAccessibility " , MNMCalculateAccessibility , VF_NULL , <nl> + " Calculate mesh reachability starting from designers placed MNM Seeds . \ n " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_MNMComputeConnectedIslands " , MNMComputeConnectedIslands , VF_DEV_ONLY , <nl> + " Computes connected islands on the mnm mesh . \ n " ) ; <nl> + <nl> + REGISTER_COMMAND ( " ai_NavigationReloadConfig " , NavigationReloadConfig , VF_DEV_ONLY , <nl> + " Usage : ai_NavigationReloadConfig \ n " <nl> + " Reloads navigation config file . May lead to broken subsystems and weird bugs . For DEBUG purposes ONLY ! \ n " ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsNavigation : : DebugMNMAgentType ( IConsoleCmdArgs * args ) <nl> + { <nl> + if ( args - > GetArgCount ( ) < 2 ) <nl> + { <nl> + AIWarning ( " < DebugMNMAgentType > Expecting Agent Type as parameter . " ) ; <nl> + return ; <nl> + } <nl> + <nl> + const char * agentTypeName = args - > GetArg ( 1 ) ; <nl> + <nl> + NavigationAgentTypeID agentTypeID = gAIEnv . pNavigationSystem - > GetAgentTypeID ( agentTypeName ) ; <nl> + gAIEnv . pNavigationSystem - > SetDebugDisplayAgentType ( agentTypeID ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsNavigation : : MNMCalculateAccessibility ( IConsoleCmdArgs * args ) <nl> + { <nl> + gAIEnv . pNavigationSystem - > CalculateAccessibility ( ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsNavigation : : MNMComputeConnectedIslands ( IConsoleCmdArgs * args ) <nl> + { <nl> + gAIEnv . pNavigationSystem - > ComputeAllIslands ( ) ; <nl> + } <nl> + <nl> + void SAIConsoleVarsNavigation : : NavigationReloadConfig ( IConsoleCmdArgs * args ) <nl> + { <nl> + if ( INavigationSystem * pNavigationSystem = gAIEnv . pNavigationSystem ) <nl> + { <nl> + / / TODO pavloi 2016 . 03 . 09 : hack implementation . See comments in ReloadConfig . <nl> + if ( pNavigationSystem - > ReloadConfig ( ) ) <nl> + { <nl> + pNavigationSystem - > ClearAndNotify ( ) ; <nl> + } <nl> + else <nl> + { <nl> + AIWarning ( " Errors during config reloading " ) ; <nl> + } <nl> + return ; <nl> + } <nl> + AIWarning ( " Unable to obtain navigation system to reload config . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 07bb1057f1 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsNavigation <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + static void DebugMNMAgentType ( IConsoleCmdArgs * args ) ; <nl> + static void MNMCalculateAccessibility ( IConsoleCmdArgs * args ) ; / / TODO : Remove when the seeds work <nl> + static void MNMComputeConnectedIslands ( IConsoleCmdArgs * args ) ; <nl> + static void NavigationReloadConfig ( IConsoleCmdArgs * args ) ; <nl> + <nl> + DeclareConstIntCVar ( DebugDrawNavigation , 0 ) ; <nl> + DeclareConstIntCVar ( DebugTriangleOnCursor , 0 ) ; <nl> + DeclareConstIntCVar ( NavigationSystemMT , 1 ) ; <nl> + DeclareConstIntCVar ( NavGenThreadJobs , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawNavigationWorldMonitor , 0 ) ; <nl> + DeclareConstIntCVar ( MNMRaycastImplementation , 2 ) ; <nl> + DeclareConstIntCVar ( MNMRemoveInaccessibleTrianglesOnLoad , 1 ) ; <nl> + <nl> + DeclareConstIntCVar ( StoreNavigationQueriesHistory , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawNavigationQueriesUDR , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawNavigationQueriesList , 0 ) ; <nl> + <nl> + const char * MNMDebugDrawFlag ; <nl> + const char * DebugDrawNavigationQueryListFilterByCaller ; <nl> + float NavmeshTileDistanceDraw ; <nl> + float NavmeshStabilizationTimeToUpdate ; <nl> + int MNMProfileMemory ; <nl> + int MNMDebugAccessibility ; <nl> + int MNMEditorBackgroundUpdate ; <nl> + int MNMAllowDynamicRegenInEditor ; <nl> + int MNMDebugDrawTileStates ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationSystem . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationSystem . cpp <nl> void NavigationSystem : : UpdateInternalNavigationSystemData ( const bool blocking ) <nl> { <nl> lastFrameStartTime = m_frameStartTime ; <nl> <nl> - UpdateMeshes ( m_frameStartTime , m_frameDeltaTime , blocking , gAIEnv . CVars . NavigationSystemMT ! = 0 , false ) ; <nl> + UpdateMeshes ( m_frameStartTime , m_frameDeltaTime , blocking , gAIEnv . CVars . navigation . NavigationSystemMT ! = 0 , false ) ; <nl> } <nl> # endif <nl> <nl> bool NavigationSystem : : SpawnJob ( TileTaskResult & result , NavigationMeshID meshID , <nl> GenerateTileJob ( params , & result . state , & result . tile , & result . metaData , & result . hashValue ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawNavigation ) <nl> + if ( gAIEnv . CVars . navigation . DebugDrawNavigation ) <nl> { <nl> if ( gEnv - > pRenderer ) <nl> { <nl> void NavigationSystem : : ProcessQueuedMeshUpdates ( ) <nl> # if NAV_MESH_REGENERATION_ENABLED <nl> do <nl> { <nl> - UpdateMeshesFromEditor ( false , gAIEnv . CVars . NavigationSystemMT ! = 0 , false ) ; <nl> + UpdateMeshesFromEditor ( false , gAIEnv . CVars . navigation . NavigationSystemMT ! = 0 , false ) ; <nl> } <nl> while ( m_state = = EWorkingState : : Working ) ; <nl> # endif <nl> void NavigationSystem : : SetupTasks ( ) <nl> / / will ever , ever , ever make that efficient . <nl> / / PeteB : Optimized the tile job time enough to make it viable to do more than one per frame . Added CVar <nl> / / multiplier to allow people to control it based on the speed of their machine . <nl> - m_maxRunningTaskCount = ( gEnv - > pJobManager - > GetNumWorkerThreads ( ) * 3 / 4 ) * gAIEnv . CVars . NavGenThreadJobs ; <nl> + m_maxRunningTaskCount = ( gEnv - > pJobManager - > GetNumWorkerThreads ( ) * 3 / 4 ) * gAIEnv . CVars . navigation . NavGenThreadJobs ; <nl> m_results . resize ( m_maxRunningTaskCount ) ; <nl> <nl> for ( uint16 i = 0 ; i < m_results . size ( ) ; + + i ) <nl> bool NavigationSystem : : ReadFromFile ( const char * fileName , bool bAfterExporting ) <nl> m_volumesManager . LoadData ( file , nFileVersion ) ; <nl> m_updatesManager . LoadData ( file , nFileVersion ) ; <nl> <nl> - if ( gAIEnv . CVars . MNMRemoveInaccessibleTrianglesOnLoad & & ! gEnv - > IsEditor ( ) ) <nl> + if ( gAIEnv . CVars . navigation . MNMRemoveInaccessibleTrianglesOnLoad & & ! gEnv - > IsEditor ( ) ) <nl> { <nl> RemoveAllTrianglesByFlags ( m_annotationsLibrary . GetInaccessibleAreaFlag ( ) . value ) ; <nl> } <nl> void NavigationSystemDebugDraw : : DebugDrawPathFinder ( NavigationSystem & navigation <nl> MNM : : DangerousAreasList dangersInfo ; <nl> MNM : : DangerAreaConstPtr info ; <nl> const Vec3 & cameraPos = gAIEnv . GetDebugRenderer ( ) - > GetCameraPos ( ) ; / / To simulate the player position and evaluate the path generation <nl> - info . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Direction > ( cameraPos , 0 . 0f , gAIEnv . CVars . PathfinderDangerCostForAttentionTarget ) ) ; <nl> + info . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Direction > ( cameraPos , 0 . 0f , gAIEnv . CVars . pathfinder . PathfinderDangerCostForAttentionTarget ) ) ; <nl> dangersInfo . push_back ( info ) ; <nl> <nl> / / This object is used to simulate the explosive threat and debug draw the behavior of the pathfinding <nl> void NavigationSystemDebugDraw : : DebugDrawPathFinder ( NavigationSystem & navigation <nl> if ( GetAISystem ( ) - > GetObjectDebugParamsFromName ( " MNMPathExplosiveThreat " , debugObjectExplosiveThreat ) ) <nl> { <nl> info . reset ( new MNM : : DangerAreaT < MNM : : eWCT_Range > ( debugObjectExplosiveThreat . objectPos , <nl> - gAIEnv . CVars . PathfinderExplosiveDangerRadius , gAIEnv . CVars . PathfinderDangerCostForExplosives ) ) ; <nl> + gAIEnv . CVars . pathfinder . PathfinderExplosiveDangerRadius , gAIEnv . CVars . pathfinder . PathfinderDangerCostForExplosives ) ) ; <nl> dangersInfo . push_back ( info ) ; <nl> } <nl> <nl> void NavigationSystemDebugDraw : : DebugDrawPathFinder ( NavigationSystem & navigation <nl> const Vec3 pathVerticalOffset = Vec3 ( . 0f , . 0f , . 1f ) ; <nl> drawPath ( renderAuxGeom , outputPath , Col_Gray , pathVerticalOffset ) ; <nl> <nl> - const bool bBeautifyPath = ( gAIEnv . CVars . BeautifyPath ! = 0 ) ; <nl> + const bool bBeautifyPath = ( gAIEnv . CVars . pathfinder . BeautifyPath ! = 0 ) ; <nl> CTimeValue stringPullingStartTime = gEnv - > pTimer - > GetAsyncTime ( ) ; <nl> if ( bBeautifyPath ) <nl> { <nl> - outputPath . PullPathOnNavigationMesh ( navMesh , gAIEnv . CVars . PathStringPullingIterations , nullptr ) ; <nl> + outputPath . PullPathOnNavigationMesh ( navMesh , gAIEnv . CVars . pathfinder . PathStringPullingIterations , nullptr ) ; <nl> } <nl> stringPullingTotalTime = gEnv - > pTimer - > GetAsyncTime ( ) - stringPullingStartTime ; <nl> <nl> void NavigationSystemDebugDraw : : DebugDrawPathFinder ( NavigationSystem & navigation <nl> } <nl> } <nl> <nl> - const stack_string predictionName = gAIEnv . CVars . MNMPathfinderPositionInTrianglePredictionType ? " Advanced prediction " : " Triangle Center " ; <nl> + const stack_string predictionName = gAIEnv . CVars . pathfinder . MNMPathfinderPositionInTrianglePredictionType ? " Advanced prediction " : " Triangle Center " ; <nl> <nl> CDebugDrawContext dc ; <nl> <nl> dc - > Draw2dLabel ( 10 . 0f , 172 . 0f , 1 . 3f , Col_White , false , <nl> " Start : % 08x - End : % 08x - Total Pathfinding time : % . 4fms - - Type of prediction for the point inside each triangle : % s " , closestTriangleStart . id , closestTriangleEnd . id , timeTotal . GetMilliSeconds ( ) , predictionName . c_str ( ) ) ; <nl> dc - > Draw2dLabel ( 10 . 0f , 184 . 0f , 1 . 3f , Col_White , false , <nl> - " String pulling operation - Iteration % d - Total time : % . 4fms - - Total Length : % f " , gAIEnv . CVars . PathStringPullingIterations , stringPullingTotalTime . GetMilliSeconds ( ) , totalPathLength ) ; <nl> + " String pulling operation - Iteration % d - Total time : % . 4fms - - Total Length : % f " , gAIEnv . CVars . pathfinder . PathStringPullingIterations , stringPullingTotalTime . GetMilliSeconds ( ) , totalPathLength ) ; <nl> } <nl> <nl> static bool FindObjectToTestIslandConnectivity ( const char * szName , Vec3 & outPos , IEntity * * ppOutEntityToTestOffGridLinks ) <nl> void NavigationSystemDebugDraw : : DebugDrawNavigationMeshesForSelectedAgent ( Naviga <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - const DefaultTriangleColorSelector colorSelector ( navigationSystem , gAIEnv . CVars . MNMDebugDrawFlag , ! ! gAIEnv . CVars . MNMDebugAccessibility ) ; <nl> + const DefaultTriangleColorSelector colorSelector ( navigationSystem , gAIEnv . CVars . navigation . MNMDebugDrawFlag , ! ! gAIEnv . CVars . navigation . MNMDebugAccessibility ) ; <nl> <nl> const AgentType & agentType = navigationSystem . m_agentTypes [ m_agentTypeID - 1 ] ; <nl> const CCamera & viewCamera = gEnv - > pSystem - > GetViewCamera ( ) ; <nl> void NavigationSystemDebugDraw : : DebugDrawNavigationMeshesForSelectedAgent ( Naviga <nl> if ( ! viewCamera . IsAABBVisible_F ( navigationSystem . m_volumes [ mesh . boundary ] . aabb ) ) <nl> continue ; <nl> <nl> - if ( gAIEnv . CVars . MNMDebugDrawTileStates ) <nl> + if ( gAIEnv . CVars . navigation . MNMDebugDrawTileStates ) <nl> { <nl> navigationSystem . m_updatesManager . DebugDrawMeshTilesState ( meshInfo . id ) ; <nl> } <nl> <nl> size_t drawFlag = MNM : : STile : : DrawTriangles | MNM : : STile : : DrawMeshBoundaries ; <nl> - if ( gAIEnv . CVars . MNMDebugAccessibility ) <nl> + if ( gAIEnv . CVars . navigation . MNMDebugAccessibility ) <nl> drawFlag | = MNM : : STile : : DrawAccessibility ; <nl> <nl> - switch ( gAIEnv . CVars . DebugDrawNavigation ) <nl> + switch ( gAIEnv . CVars . navigation . DebugDrawNavigation ) <nl> { <nl> case 0 : <nl> case 1 : <nl> void NavigationSystemDebugDraw : : DebugDrawMeshBorders ( NavigationSystem & navigatio <nl> <nl> void NavigationSystemDebugDraw : : DebugDrawTriangleOnCursor ( NavigationSystem & navigationSystem ) <nl> { <nl> - if ( ! gAIEnv . CVars . DebugTriangleOnCursor ) <nl> + if ( ! gAIEnv . CVars . navigation . DebugTriangleOnCursor ) <nl> return ; <nl> <nl> const CCamera & viewCamera = gEnv - > pSystem - > GetViewCamera ( ) ; <nl> void NavigationSystemDebugDraw : : DebugDrawNavigationSystemState ( NavigationSystem & <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawNavigation ) <nl> + if ( gAIEnv . CVars . navigation . DebugDrawNavigation ) <nl> { <nl> switch ( navigationSystem . m_state ) <nl> { <nl> void NavigationSystemDebugDraw : : DebugDrawNavigationSystemState ( NavigationSystem & <nl> <nl> void NavigationSystemDebugDraw : : DebugDrawMemoryStats ( NavigationSystem & navigationSystem ) <nl> { <nl> - if ( gAIEnv . CVars . MNMProfileMemory ) <nl> + if ( gAIEnv . CVars . navigation . MNMProfileMemory ) <nl> { <nl> const float kbInvert = 1 . 0f / 1024 . 0f ; <nl> <nl> void NavigationSystemBackgroundUpdate : : OnSystemEvent ( ESystemEvent event , UINT_PT <nl> else if ( event = = ESYSTEM_EVENT_CHANGE_FOCUS ) <nl> { <nl> / / wparam ! = 0 is focused , wparam = = 0 is not focused <nl> - const bool startBackGroundUpdate = ( wparam = = 0 ) & & ( gAIEnv . CVars . MNMEditorBackgroundUpdate ! = 0 ) & & ( m_navigationSystem . GetState ( ) = = INavigationSystem : : EWorkingState : : Working ) & & ! m_paused ; <nl> + const bool startBackGroundUpdate = ( wparam = = 0 ) & & ( gAIEnv . CVars . navigation . MNMEditorBackgroundUpdate ! = 0 ) & & ( m_navigationSystem . GetState ( ) = = INavigationSystem : : EWorkingState : : Working ) & & ! m_paused ; <nl> <nl> if ( startBackGroundUpdate ) <nl> { <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationUpdatesManager . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / NavigationUpdatesManager . cpp <nl> void CMNMUpdatesManager : : UpdatePostponedChanges ( ) <nl> if ( m_updateMode = = INavigationUpdatesManager : : EUpdateMode : : AfterStabilization ) <nl> { <nl> / / Uses global timer instead of AI timer because this has to work in Editor mode as well ( AI timer only runs in Game and Physics / AI Mode ) <nl> - if ( m_frameStartTime . GetDifferenceInSeconds ( m_lastUpdateTime ) < gAIEnv . CVars . NavmeshStabilizationTimeToUpdate ) <nl> + if ( m_frameStartTime . GetDifferenceInSeconds ( m_lastUpdateTime ) < gAIEnv . CVars . navigation . NavmeshStabilizationTimeToUpdate ) <nl> { <nl> return ; <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / WorldMonitor . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Navigation / NavigationSystem / WorldMonitor . cpp <nl> int WorldMonitor : : BBoxChangeHandler ( const EventPhys * pPhysEvent ) <nl> pthis - > m_callback ( entityId , aabbOld ) ; <nl> pthis - > m_callback ( entityId , aabbNew ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawNavigationWorldMonitor ) <nl> + if ( gAIEnv . CVars . navigation . DebugDrawNavigationWorldMonitor ) <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> int WorldMonitor : : EntityRemovedHandler ( const EventPhys * pPhysEvent ) <nl> { <nl> pthis - > m_callback ( change . entityId , change . aabb ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawNavigationWorldMonitor ) <nl> + if ( gAIEnv . CVars . navigation . DebugDrawNavigationWorldMonitor ) <nl> { <nl> CDebugDrawContext dc ; <nl> dc - > DrawAABB ( change . aabb , IDENTITY , false , Col_White , eBBD_Faceted ) ; <nl> void WorldMonitor : : FlushPendingAABBChanges ( ) <nl> m_callback ( aabbChange . entityId , aabbChange . aabb ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawNavigationWorldMonitor ) <nl> + if ( gAIEnv . CVars . navigation . DebugDrawNavigationWorldMonitor ) <nl> { <nl> CDebugDrawContext dc ; <nl> for ( const EntityAABBChange & aabbChange : changesInTheWorld ) <nl> mmm a / Code / CryEngine / CryAISystem / PathFollower . cpp <nl> ppp b / Code / CryEngine / CryAISystem / PathFollower . cpp <nl> bool CPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , const V <nl> } <nl> <nl> # ifndef _RELEASE <nl> - if ( gAIEnv . CVars . DrawPathFollower = = 1 ) <nl> + if ( gAIEnv . CVars . pathFollower . DrawPathFollower = = 1 ) <nl> { <nl> Draw ( ) ; <nl> } <nl> new file mode 100644 <nl> index 0000000000 . . 45095cf70a <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / PathFollowerConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " PathFollowerConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsPathFollower : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_UseSmartPathFollower " , UseSmartPathFollower , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enables Smart PathFollower ( default : 1 ) . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_SmartPathFollower_useAdvancedPathShortcutting " , SmartPathFollower_useAdvancedPathShortcutting , 1 , VF_NULL , " Enables a more failsafe way of preventing the AI to shortcut through obstacles ( 0 = disable , any other value = enable ) " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_SmartPathFollower_useAdvancedPathShortcutting_debug " , SmartPathFollower_useAdvancedPathShortcutting_debug , 0 , VF_NULL , " Show debug lines for when CVar ai_SmartPathFollower_useAdvancedPathShortcutting_debug is enabled " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DrawPathFollower " , DrawPathFollower , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , " Enables PathFollower debug drawing displaying agent paths and safe follow target . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_UseSmartPathFollower_LookAheadDistance " , & SmartPathFollower_LookAheadDistance , 10 . 0f , VF_NULL , " LookAheadDistance of SmartPathFollower " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk " , & SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk , 0 . 5f , VF_NULL , <nl> + " Defines the time frame the AI is allowed to look ahead while moving strictly along a path to decide whether to cut towards the next point . ( Walk only ) \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint " , & SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint , 0 . 25f , VF_NULL , <nl> + " Defines the time frame the AI is allowed to look ahead while moving strictly along a path to decide whether to cut towards the next point . ( Run and Sprint only ) \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SmartPathFollower_decelerationHuman " , & SmartPathFollower_decelerationHuman , 7 . 75f , VF_NULL , " Deceleration multiplier for non - vehicles " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_SmartPathFollower_decelerationVehicle " , & SmartPathFollower_decelerationVehicle , 1 . 0f , VF_NULL , " Deceleration multiplier for vehicles " ) ; <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . 2a59541e30 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / PathFollowerConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsPathFollower <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( UseSmartPathFollower , 1 ) ; <nl> + DeclareConstIntCVar ( SmartPathFollower_useAdvancedPathShortcutting , 1 ) ; <nl> + DeclareConstIntCVar ( SmartPathFollower_useAdvancedPathShortcutting_debug , 0 ) ; <nl> + DeclareConstIntCVar ( DrawPathFollower , 0 ) ; <nl> + <nl> + float SmartPathFollower_LookAheadDistance ; <nl> + float SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk ; <nl> + float SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint ; <nl> + float SmartPathFollower_decelerationHuman ; <nl> + float SmartPathFollower_decelerationVehicle ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / PathObstacles . cpp <nl> ppp b / Code / CryEngine / CryAISystem / PathObstacles . cpp <nl> static bool ObstacleDrawingIsOnForActor ( const CAIActor * pAIActor ) <nl> { <nl> if ( gAIEnv . CVars . DebugDraw > 0 ) <nl> { <nl> - const char * pathName = gAIEnv . CVars . DrawPathAdjustment ; <nl> + const char * pathName = gAIEnv . CVars . legacyDebugDraw . DrawPathAdjustment ; <nl> if ( * pathName & & ( ! strcmp ( pathName , " all " ) | | ( pAIActor & & ! strcmp ( pAIActor - > GetName ( ) , pathName ) ) ) ) <nl> return true ; <nl> } <nl> void CPathObstacles : : GetPathObstacles_PhysicalEntity ( IPhysicalEntity * pPhysicalE <nl> const float distToPath = pathObstaclesInfo . pNavPath - > GetDistToPath ( pathPos , distAlongPath , testPosition , pathObstaclesInfo . maxDistToCheckAhead , true ) ; <nl> if ( distToPath > = 0 . 0f & & distToPath < = pathObstaclesInfo . maxPathDeviation ) <nl> { <nl> - const bool obstacleIsSmall = boxRadius < gAIEnv . CVars . ObstacleSizeThreshold ; <nl> + const bool obstacleIsSmall = boxRadius < gAIEnv . CVars . legacyPathObstacles . ObstacleSizeThreshold ; <nl> const int actorType = pathObstaclesInfo . pAIActor ? pathObstaclesInfo . pAIActor - > GetType ( ) : AIOBJECT_ACTOR ; <nl> <nl> - float extraRadius = ( actorType = = AIOBJECT_VEHICLE & & obstacleIsSmall ? gAIEnv . CVars . ExtraVehicleAvoidanceRadiusSmall : pathObstaclesInfo . minAvRadius ) ; <nl> + float extraRadius = ( actorType = = AIOBJECT_VEHICLE & & obstacleIsSmall ? gAIEnv . CVars . legacyPathObstacles . ExtraVehicleAvoidanceRadiusSmall : pathObstaclesInfo . minAvRadius ) ; <nl> if ( bIsPushable & & pathObstaclesInfo . movementAbility . pushableObstacleWeakAvoidance ) <nl> { <nl> / / Partial avoidance - scale down radius <nl> void CPathObstacles : : GetPathObstacles ( TPathObstacles & obstacles , const AgentMove <nl> <nl> ClearObstacles ( obstacles ) ; <nl> <nl> - if ( gAIEnv . CVars . AdjustPathsAroundDynamicObstacles = = 0 ) <nl> + if ( gAIEnv . CVars . LegacyAdjustPathsAroundDynamicObstacles = = 0 ) <nl> return ; <nl> <nl> if ( pNavPath - > Empty ( ) ) <nl> void CPathObstacles : : GetPathObstacles ( TPathObstacles & obstacles , const AgentMove <nl> m_debugPathAdjustmentBoxes . resize ( 0 ) ; <nl> # endif <nl> <nl> - const float minActorAvRadius = gAIEnv . CVars . MinActorDynamicObstacleAvoidanceRadius ; <nl> - const float minVehicleAvRadius = gAIEnv . CVars . ExtraVehicleAvoidanceRadiusBig ; <nl> + const float minActorAvRadius = gAIEnv . CVars . legacyPathObstacles . MinActorDynamicObstacleAvoidanceRadius ; <nl> + const float minVehicleAvRadius = gAIEnv . CVars . legacyPathObstacles . ExtraVehicleAvoidanceRadiusBig ; <nl> <nl> const int actorType = pAIActor ? pAIActor - > GetType ( ) : AIOBJECT_ACTOR ; <nl> pathObstaclesInfo . minAvRadius = 0 . 125f + max ( ( actorType ! = AIOBJECT_ACTOR ? minVehicleAvRadius : minActorAvRadius ) , movementAbility . pathRadius ) ; <nl> mmm a / Code / CryEngine / CryAISystem / PersonalLog . cpp <nl> ppp b / Code / CryEngine / CryAISystem / PersonalLog . cpp <nl> void PersonalLog : : AddMessage ( const EntityId entityId , const char * message ) <nl> <nl> m_messages . push_back ( message ) ; <nl> <nl> - if ( gAIEnv . CVars . OutputPersonalLogToConsole ) <nl> + if ( gAIEnv . CVars . LegacyOutputPersonalLogToConsole ) <nl> { <nl> const char * name = " ( null ) " ; <nl> <nl> mmm a / Code / CryEngine / CryAISystem / PipeUser . cpp <nl> ppp b / Code / CryEngine / CryAISystem / PipeUser . cpp <nl> void CPipeUser : : SetCoverInvalidated ( CoverID coverID , ICoverUser * pCoverUser ) <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> bool CPipeUser : : IsCoverCompromised ( ) const <nl> { <nl> - if ( gAIEnv . CVars . CoverSystem ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . CoverSystem ) <nl> { <nl> return m_pCoverUser ? m_pCoverUser - > IsCompromised ( ) : false ; <nl> } <nl> void CPipeUser : : FillCoverEyes ( DynArray < Vec3 > & eyesContainer ) <nl> if ( ! pTarget | | eyesContainer . size ( ) > = kMaxEyesCount ) <nl> return ; <nl> <nl> - const bool prediction = gAIEnv . CVars . CoverPredictTarget > 0 . 001f ; <nl> + const bool prediction = gAIEnv . CVars . legacyCoverSystem . CoverPredictTarget > 0 . 001f ; <nl> const float RangeThresholdSq = sqr ( 0 . 5f ) ; <nl> <nl> if ( prediction & & pTarget - > IsAgent ( ) ) <nl> { <nl> const Vec3 targetVelocity = pTarget - > GetVelocity ( ) ; <nl> - const Vec3 futureLocation = eyesContainer . back ( ) + targetVelocity * gAIEnv . CVars . CoverPredictTarget ; <nl> + const Vec3 futureLocation = eyesContainer . back ( ) + targetVelocity * gAIEnv . CVars . legacyCoverSystem . CoverPredictTarget ; <nl> <nl> if ( ! HasPointInRangeSq ( eyesContainer . data ( ) , eyesContainer . size ( ) , futureLocation , RangeThresholdSq ) ) <nl> { <nl> void CPipeUser : : FillCoverEyes ( DynArray < Vec3 > & eyesContainer ) <nl> if ( prediction & & nextTargetObject - > IsAgent ( ) ) <nl> { <nl> Vec3 targetVelocity = nextTargetObject - > GetVelocity ( ) ; <nl> - Vec3 futureLocation = eyesContainer . back ( ) + targetVelocity * gAIEnv . CVars . CoverPredictTarget ; <nl> + Vec3 futureLocation = eyesContainer . back ( ) + targetVelocity * gAIEnv . CVars . legacyCoverSystem . CoverPredictTarget ; <nl> <nl> if ( ! HasPointInRangeSq ( eyesContainer . data ( ) , eyesContainer . size ( ) , futureLocation , RangeThresholdSq ) ) <nl> { <nl> void CPipeUser : : DebugDrawGoals ( ) <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> void CPipeUser : : SetPathToFollow ( const char * pathName ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " CPipeUser : : SetPathToFollow % s path = % s " , GetName ( ) , pathName ) ; <nl> m_pathToFollowName = pathName ; <nl> m_bPathToFollowIsSpline = false ; <nl> void CPipeUser : : SetPathAttributeToFollow ( bool bSpline ) <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> bool CPipeUser : : GetPathEntryPoint ( Vec3 & entryPos , bool reverse , bool startNearest ) const <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> AILogAlways ( " CPipeUser : : GetPathEntryPoint % s path = % s " , GetName ( ) , m_pathToFollowName . c_str ( ) ) ; <nl> <nl> if ( m_pathToFollowName . length ( ) = = 0 ) <nl> void CPipeUser : : HandlePathDecision ( MNMPathRequestResult & result ) <nl> { <nl> result . pPath - > CopyTo ( & pNavPath ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> const Vec3 & vEnd = pNavPath . GetLastPathPos ( ) ; <nl> const Vec3 & vStart = pNavPath . GetPrevPathPoint ( ) - > vPos ; <nl> void CPipeUser : : HandlePathDecision ( MNMPathRequestResult & result ) <nl> / / while the actor target has been requested . This should not happen . <nl> if ( m_eNavSOMethod ! = nSOmNone & & m_State . curActorTargetPhase = = eATP_Waiting ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> if ( m_State . actorTargetReq . animation . empty ( ) ) <nl> { <nl> void CPipeUser : : HandlePathDecision ( MNMPathRequestResult & result ) <nl> / / Path regeneration should be inhibited while preparing for actor target . <nl> if ( GetActiveActorTargetRequest ( ) & & m_State . curActorTargetPhase = = eATP_Waiting ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> if ( m_State . actorTargetReq . animation . empty ( ) ) <nl> { <nl> void CPipeUser : : HandlePathDecision ( MNMPathRequestResult & result ) <nl> } <nl> else <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> AILogAlways ( " CPipeUser : : HandlePathDecision % s No path " , GetName ( ) ) ; <nl> } <nl> void CPipeUser : : AdjustPath ( ) <nl> bool CPipeUser : : AdjustPathAroundObstacles ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> - if ( gAIEnv . CVars . AdjustPathsAroundDynamicObstacles ! = 0 ) <nl> + if ( gAIEnv . CVars . LegacyAdjustPathsAroundDynamicObstacles ! = 0 ) <nl> { <nl> CalculatePathObstacles ( ) ; <nl> <nl> IPathFollower * CPipeUser : : CreatePathFollower ( const PathFollowerParams & params ) <nl> { <nl> IPathFollower * pResult = NULL ; <nl> <nl> - if ( gAIEnv . CVars . UseSmartPathFollower = = 1 ) <nl> + if ( gAIEnv . CVars . pathFollower . UseSmartPathFollower = = 1 ) <nl> { <nl> CSmartPathFollower * pSmartPathFollower = new CSmartPathFollower ( params , m_pathAdjustmentObstacles ) ; <nl> pResult = pSmartPathFollower ; <nl> void CPipeUser : : HandleVisualStimulus ( SAIEVENT * pAIEvent ) <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> const float fGlobalVisualPerceptionScale = gEnv - > pAISystem - > GetGlobalVisualScale ( this ) ; <nl> const float fVisualPerceptionScale = m_Parameters . m_PerceptionParams . perceptionScale . visual * fGlobalVisualPerceptionScale ; <nl> - if ( gAIEnv . CVars . IgnoreVisualStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fVisualPerceptionScale < = 0 . 0f ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreVisualStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fVisualPerceptionScale < = 0 . 0f ) <nl> return ; <nl> <nl> if ( gAIEnv . pTargetTrackManager - > IsEnabled ( ) ) <nl> void CPipeUser : : HandleSoundEvent ( SAIEVENT * pAIEvent ) <nl> <nl> const float fGlobalAudioPerceptionScale = gEnv - > pAISystem - > GetGlobalAudioScale ( this ) ; <nl> const float fAudioPerceptionScale = m_Parameters . m_PerceptionParams . perceptionScale . audio * fGlobalAudioPerceptionScale ; <nl> - if ( gAIEnv . CVars . IgnoreSoundStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fAudioPerceptionScale < = 0 . 0f ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreSoundStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fAudioPerceptionScale < = 0 . 0f ) <nl> return ; <nl> <nl> if ( gAIEnv . pTargetTrackManager - > IsEnabled ( ) ) <nl> mmm a / Code / CryEngine / CryAISystem / Puppet . cpp <nl> ppp b / Code / CryEngine / CryAISystem / Puppet . cpp <nl> float CPuppet : : AdjustTargetVisibleRange ( const CAIActor & observer , float fVisible <nl> { <nl> / / case AILL_LIGHT : SOMSpeed <nl> case AILL_MEDIUM : <nl> - fRangeScale * = gAIEnv . CVars . SightRangeMediumIllumMod ; <nl> + fRangeScale * = gAIEnv . CVars . legacyPerception . SightRangeMediumIllumMod ; <nl> break ; <nl> case AILL_DARK : <nl> - fRangeScale * = gAIEnv . CVars . SightRangeDarkIllumMod ; <nl> + fRangeScale * = gAIEnv . CVars . legacyPerception . SightRangeDarkIllumMod ; <nl> break ; <nl> case AILL_SUPERDARK : <nl> - fRangeScale * = gAIEnv . CVars . SightRangeSuperDarkIllumMod ; <nl> + fRangeScale * = gAIEnv . CVars . legacyPerception . SightRangeSuperDarkIllumMod ; <nl> break ; <nl> } <nl> } <nl> void CPuppet : : UpdateProxy ( EUpdateType type ) <nl> / / Force stance etc <nl> / / int lastStance = m_State . bodystate ; <nl> bool forcedPosture = false ; <nl> - if ( strcmp ( gAIEnv . CVars . ForcePosture , " 0 " ) ) <nl> + if ( strcmp ( gAIEnv . CVars . legacyPuppet . ForcePosture , " 0 " ) ) <nl> { <nl> PostureManager : : PostureInfo posture ; <nl> <nl> - if ( m_postureManager . GetPostureByName ( gAIEnv . CVars . ForcePosture , & posture ) ) <nl> + if ( m_postureManager . GetPostureByName ( gAIEnv . CVars . legacyPuppet . ForcePosture , & posture ) ) <nl> { <nl> forcedPosture = true ; <nl> <nl> void CPuppet : : UpdateProxy ( EUpdateType type ) <nl> <nl> if ( ! forcedPosture ) <nl> { <nl> - if ( gAIEnv . CVars . ForceStance > - 1 ) <nl> - m_State . bodystate = gAIEnv . CVars . ForceStance ; <nl> + if ( gAIEnv . CVars . legacyPuppet . ForceStance > - 1 ) <nl> + m_State . bodystate = gAIEnv . CVars . legacyPuppet . ForceStance ; <nl> <nl> - if ( strcmp ( gAIEnv . CVars . ForceAGAction , " 0 " ) ) <nl> - pAIActorProxy - > SetAGInput ( AIAG_ACTION , gAIEnv . CVars . ForceAGAction ) ; <nl> + if ( strcmp ( gAIEnv . CVars . legacyPuppet . ForceAGAction , " 0 " ) ) <nl> + pAIActorProxy - > SetAGInput ( AIAG_ACTION , gAIEnv . CVars . legacyPuppet . ForceAGAction ) ; <nl> } <nl> <nl> - if ( strcmp ( gAIEnv . CVars . ForceAGSignal , " 0 " ) ) <nl> - pAIActorProxy - > SetAGInput ( AIAG_SIGNAL , gAIEnv . CVars . ForceAGSignal ) ; <nl> + if ( strcmp ( gAIEnv . CVars . legacyPuppet . ForceAGSignal , " 0 " ) ) <nl> + pAIActorProxy - > SetAGInput ( AIAG_SIGNAL , gAIEnv . CVars . legacyPuppet . ForceAGSignal ) ; <nl> <nl> - if ( gAIEnv . CVars . ForceAllowStrafing > - 1 ) <nl> - m_State . allowStrafing = gAIEnv . CVars . ForceAllowStrafing ! = 0 ; <nl> + if ( gAIEnv . CVars . legacyPuppet . ForceAllowStrafing > - 1 ) <nl> + m_State . allowStrafing = gAIEnv . CVars . legacyPuppet . ForceAllowStrafing ! = 0 ; <nl> <nl> - const char * forceLookAimTarget = gAIEnv . CVars . ForceLookAimTarget ; <nl> + const char * forceLookAimTarget = gAIEnv . CVars . legacyPuppet . ForceLookAimTarget ; <nl> if ( strcmp ( forceLookAimTarget , " none " ) ! = 0 ) <nl> { <nl> Vec3 targetPos = GetPos ( ) ; <nl> bool CPuppet : : UpdateTargetSelection ( STargetSelectionInfo & targetSelectionInfo ) <nl> { <nl> bool bResult = false ; <nl> <nl> - if ( gAIEnv . CVars . TargetTracking ) <nl> + if ( gAIEnv . CVars . legacyTargetTracking . TargetTracking ) <nl> { <nl> if ( GetTargetTrackBestTarget ( targetSelectionInfo . bestTarget , targetSelectionInfo . pTargetInfo , targetSelectionInfo . bCurrentTargetErased ) ) <nl> { <nl> void CPuppet : : HandleVisualStimulus ( SAIEVENT * pAIEvent ) <nl> <nl> const float fGlobalVisualPerceptionScale = gEnv - > pAISystem - > GetGlobalVisualScale ( this ) ; <nl> const float fVisualPerceptionScale = m_Parameters . m_PerceptionParams . perceptionScale . visual * fGlobalVisualPerceptionScale ; <nl> - if ( gAIEnv . CVars . IgnoreVisualStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fVisualPerceptionScale < = 0 . 0f ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreVisualStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fVisualPerceptionScale < = 0 . 0f ) <nl> return ; <nl> <nl> if ( gAIEnv . pTargetTrackManager - > IsEnabled ( ) ) <nl> void CPuppet : : HandleSoundEvent ( SAIEVENT * pEvent ) <nl> <nl> const float fGlobalAudioPerceptionScale = gEnv - > pAISystem - > GetGlobalAudioScale ( this ) ; <nl> const float fAudioPerceptionScale = m_Parameters . m_PerceptionParams . perceptionScale . audio * fGlobalAudioPerceptionScale ; <nl> - if ( gAIEnv . CVars . IgnoreSoundStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fAudioPerceptionScale < = 0 . 0f ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreSoundStimulus ! = 0 | | m_Parameters . m_bAiIgnoreFgNode | | fAudioPerceptionScale < = 0 . 0f ) <nl> return ; <nl> <nl> if ( gAIEnv . pTargetTrackManager - > IsEnabled ( ) ) <nl> bool CPuppet : : NavigateAroundObjects ( const Vec3 & targetPos , bool fullUpdate ) <nl> Vec3 oldMoveDir = m_State . vMoveDir ; <nl> m_State . vMoveDir = m_steeringOccupancy . GetNearestUnoccupiedDirection ( m_State . vMoveDir , m_steeringOccupancyBias ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawCrowdControl > 0 ) <nl> + if ( gAIEnv . CVars . legacyPuppet . DebugDrawCrowdControl > 0 ) <nl> { <nl> Vec3 pos = GetPhysicsPos ( ) + Vec3 ( 0 , 0 , 0 . 75f ) ; <nl> GetAISystem ( ) - > AddDebugLine ( pos , pos + oldMoveDir * 2 . 0f , 196 , 0 , 0 , 0 ) ; <nl> void CPuppet : : Reset ( EObjectResetType type ) <nl> pAISystem - > AddToGroup ( this , GetGroupId ( ) ) ; <nl> <nl> / / Initially allowed to hit target if not using ambient fire system <nl> - const bool bAmbientFireEnabled = ( gAIEnv . CVars . AmbientFireEnable ! = 0 ) ; <nl> + const bool bAmbientFireEnabled = ( gAIEnv . CVars . legacyFiring . AmbientFireEnable ! = 0 ) ; <nl> m_allowedToHitTarget = ! bAmbientFireEnabled ; <nl> <nl> m_allowedToUseExpensiveAccessory = false ; <nl> void CPuppet : : FireCommand ( float updateTime ) <nl> m_fireModeUpdated = false ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawFireCommand ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawFireCommand ) <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> void CPuppet : : FireCommand ( float updateTime ) <nl> <nl> m_State . fire = ( pTarget ? m_pFireCmdHandler - > Update ( pTarget , canFire , m_fireMode , m_CurrentWeaponDescriptor , m_State . vAimTargetPos ) : eAIFS_Off ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawFireCommand ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawFireCommand ) <nl> { <nl> CDebugDrawContext dc ; <nl> <nl> bool CPuppet : : GetPotentialTargets ( PotentialTargetMap & targetMap ) const <nl> { <nl> bool bResult = false ; <nl> <nl> - if ( gAIEnv . CVars . TargetTracking ) <nl> + if ( gAIEnv . CVars . legacyTargetTracking . TargetTracking ) <nl> { <nl> CWeakRef < CAIObject > refBestTarget ; <nl> SAIPotentialTarget * bestTargetEvent = 0 ; <nl> new file mode 100644 <nl> index 0000000000 . . 3f320f783e <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / PuppetConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " PuppetConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyPuppet : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_ForceStance " , ForceStance , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Forces all AI characters to specified stance : \ n " <nl> + " Disable = - 1 , Stand = 0 , Crouch = 1 , Prone = 2 , Relaxed = 3 , Stealth = 4 , Cover = 5 , Swim = 6 , Zero - G = 7 " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_ForceAllowStrafing " , ForceAllowStrafing , - 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Forces all AI characters to use / not use strafing ( - 1 disables ) " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawCrowdControl " , DebugDrawCrowdControl , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws crowd control debug information . 0 = off , 1 = on " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_ForceAGAction " , & ForceAGAction , " 0 " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Forces all AI characters to specified AG action input . 0 to disable . \ n " ) ; <nl> + REGISTER_CVAR2 ( " ai_ForceAGSignal " , & ForceAGSignal , " 0 " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Forces all AI characters to specified AG signal input . 0 to disable . \ n " ) ; <nl> + REGISTER_CVAR2 ( " ai_ForcePosture " , & ForcePosture , " 0 " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Forces all AI characters to specified posture . 0 to disable . \ n " ) ; <nl> + REGISTER_CVAR2 ( " ai_ForceLookAimTarget " , & ForceLookAimTarget , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Forces all AI characters to use / not use a fixed look / aim target \ n " <nl> + " none disables \ n " <nl> + " x , y , xz or yz sets it to the appropriate direction \ n " <nl> + " otherwise it forces looking / aiming at the entity with this name ( no name - > ( 0 , 0 , 0 ) ) " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . d7bb564e42 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / PuppetConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyPuppet <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( ForceStance , - 1 ) ; <nl> + DeclareConstIntCVar ( ForceAllowStrafing , - 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawCrowdControl , 0 ) ; <nl> + <nl> + const char * ForceAGAction ; <nl> + const char * ForceAGSignal ; <nl> + const char * ForcePosture ; <nl> + const char * ForceLookAimTarget ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / PuppetPhys . cpp <nl> ppp b / Code / CryEngine / CryAISystem / PuppetPhys . cpp <nl> bool CPuppet : : AdjustFireTarget ( CAIObject * targetObject , const Vec3 & target , bool <nl> { <nl> bool found = false ; <nl> <nl> - if ( targetObject & & gAIEnv . CVars . EnableCoolMisses & & cry_random ( 0 . 0f , 1 . 0f ) < gAIEnv . CVars . CoolMissesProbability ) <nl> + if ( targetObject & & gAIEnv . CVars . legacyFiring . EnableCoolMisses & & cry_random ( 0 . 0f , 1 . 0f ) < gAIEnv . CVars . legacyFiring . CoolMissesProbability ) <nl> { <nl> if ( CAIPlayer * player = targetObject - > CastToCAIPlayer ( ) ) <nl> { <nl> bool CPuppet : : AdjustFireTarget ( CAIObject * targetObject , const Vec3 & target , bool <nl> <nl> float distance = dir . NormalizeSafe ( ) ; <nl> <nl> - if ( distance > = gAIEnv . CVars . CoolMissesMinMissDistance ) <nl> + if ( distance > = gAIEnv . CVars . legacyFiring . CoolMissesMinMissDistance ) <nl> found = player - > GetMissLocation ( fireLocation , dir , clampAngle , out ) ; <nl> } <nl> } <nl> mmm a / Code / CryEngine / CryAISystem / PuppetRateOfDeath . cpp <nl> ppp b / Code / CryEngine / CryAISystem / PuppetRateOfDeath . cpp <nl> <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> float CPuppet : : GetTargetAliveTime ( ) <nl> { <nl> - float fTargetStayAliveTime = gAIEnv . CVars . RODAliveTime ; <nl> + float fTargetStayAliveTime = gAIEnv . CVars . legacyPuppetRod . RODAliveTime ; <nl> <nl> const CAIObject * pLiveTarget = GetLiveTarget ( m_refAttentionTarget ) . GetAIObject ( ) ; <nl> if ( ! pLiveTarget ) <nl> float CPuppet : : GetTargetAliveTime ( ) <nl> Vec3 vTargetDir = pLiveTarget - > GetPos ( ) - GetPos ( ) ; <nl> <nl> / / Scale target life time based on target speed . <nl> - const float fMoveInc = gAIEnv . CVars . RODMoveInc ; <nl> + const float fMoveInc = gAIEnv . CVars . legacyPuppetRod . RODMoveInc ; <nl> { <nl> float fIncrease = 0 . 0f ; <nl> <nl> float CPuppet : : GetTargetAliveTime ( ) <nl> } <nl> <nl> / / Scale target life time based on target stance . <nl> - const float fStanceInc = gAIEnv . CVars . RODStanceInc ; <nl> + const float fStanceInc = gAIEnv . CVars . legacyPuppetRod . RODStanceInc ; <nl> { <nl> float fIncrease = 0 . 0f ; <nl> <nl> float CPuppet : : GetTargetAliveTime ( ) <nl> } <nl> <nl> / / Scale target life time based on target vs . shooter orientation . <nl> - const float fDirectionInc = gAIEnv . CVars . RODDirInc ; <nl> + const float fDirectionInc = gAIEnv . CVars . legacyPuppetRod . RODDirInc ; <nl> { <nl> float fIncrease = 0 . 0f ; <nl> <nl> float CPuppet : : GetTargetAliveTime ( ) <nl> if ( ! m_allowedToHitTarget ) <nl> { <nl> / / If the agent is set not to be allowed to hit the target , let the others shoot first . <nl> - const float fAmbientFireInc = gAIEnv . CVars . RODAmbientFireInc ; <nl> + const float fAmbientFireInc = gAIEnv . CVars . legacyPuppetRod . RODAmbientFireInc ; <nl> fTargetStayAliveTime + = fAmbientFireInc ; <nl> } <nl> else if ( m_targetZone = = AIZONE_KILL ) <nl> float CPuppet : : GetTargetAliveTime ( ) <nl> const SAIBodyInfo bi = GetBodyInfo ( ) ; <nl> if ( ! bi . GetLinkedVehicleEntity ( ) ) <nl> { <nl> - const float fKillZoneInc = gAIEnv . CVars . RODKillZoneInc ; <nl> + const float fKillZoneInc = gAIEnv . CVars . legacyPuppetRod . RODKillZoneInc ; <nl> fTargetStayAliveTime + = fKillZoneInc ; <nl> } <nl> } <nl> void CPuppet : : UpdateHealthTracking ( ) <nl> m_targetDamageHealthThr = max ( 0 . 0f , m_targetDamageHealthThr - ( 1 . 0f / fTargetStayAliveTime ) * m_Parameters . m_fAccuracy * fFrametime ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawDamageControl > 0 ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . DebugDrawDamageControl > 0 ) <nl> { <nl> if ( ! m_targetDamageHealthThrHistory ) <nl> m_targetDamageHealthThrHistory = new CValueHistory < float > ( 100 , 0 . 1f ) ; <nl> void CPuppet : : UpdateHealthTracking ( ) <nl> float CPuppet : : GetFiringReactionTime ( const Vec3 & targetPos ) const <nl> { <nl> / / Apply archetype modifier <nl> - float fReactionTime = gAIEnv . CVars . RODReactionTime * GetParameters ( ) . m_PerceptionParams . reactionTime ; <nl> + float fReactionTime = gAIEnv . CVars . legacyPuppetRod . RODReactionTime * GetParameters ( ) . m_PerceptionParams . reactionTime ; <nl> <nl> const CAIActor * pLiveTarget = GetLiveTarget ( m_refAttentionTarget ) . GetAIObject ( ) ; <nl> if ( ! pLiveTarget ) <nl> float CPuppet : : GetFiringReactionTime ( const Vec3 & targetPos ) const <nl> EAILightLevel iTargetLightLevel = pLiveTarget - > GetLightLevel ( ) ; <nl> if ( iTargetLightLevel = = AILL_MEDIUM ) <nl> { <nl> - fReactionTime + = gAIEnv . CVars . RODReactionMediumIllumInc ; <nl> + fReactionTime + = gAIEnv . CVars . legacyPuppetRod . RODReactionMediumIllumInc ; <nl> } <nl> else if ( iTargetLightLevel = = AILL_DARK ) <nl> { <nl> - fReactionTime + = gAIEnv . CVars . RODReactionDarkIllumInc ; <nl> + fReactionTime + = gAIEnv . CVars . legacyPuppetRod . RODReactionDarkIllumInc ; <nl> } <nl> else if ( iTargetLightLevel = = AILL_SUPERDARK ) <nl> { <nl> - fReactionTime + = gAIEnv . CVars . RODReactionSuperDarkIllumInc ; <nl> + fReactionTime + = gAIEnv . CVars . legacyPuppetRod . RODReactionSuperDarkIllumInc ; <nl> } <nl> } <nl> <nl> - const float fDistInc = min ( 1 . 0f , gAIEnv . CVars . RODReactionDistInc ) ; <nl> + const float fDistInc = min ( 1 . 0f , gAIEnv . CVars . legacyPuppetRod . RODReactionDistInc ) ; <nl> / / Increase reaction time if the target is further away . <nl> if ( m_targetZone = = AIZONE_COMBAT_NEAR ) <nl> fReactionTime + = fDistInc ; <nl> float CPuppet : : GetFiringReactionTime ( const Vec3 & targetPos ) const <nl> const SAIBodyInfo & bi = pLiveActor - > GetBodyInfo ( ) ; <nl> if ( fabsf ( bi . lean ) > 0 . 01f ) <nl> { <nl> - fReactionTime + = gAIEnv . CVars . RODReactionLeanInc ; <nl> + fReactionTime + = gAIEnv . CVars . legacyPuppetRod . RODReactionLeanInc ; <nl> } <nl> <nl> Vec3 dirTargetToShooter = GetPos ( ) - pLiveTarget - > GetPos ( ) ; <nl> float CPuppet : : GetFiringReactionTime ( const Vec3 & targetPos ) const <nl> const float thr1 = cosf ( DEG2RAD ( 30 . 0f ) ) ; <nl> const float thr2 = cosf ( DEG2RAD ( 95 . 0f ) ) ; <nl> if ( fLeaningDot < thr1 ) <nl> - fReactionTime + = gAIEnv . CVars . RODReactionDirInc ; <nl> + fReactionTime + = gAIEnv . CVars . legacyPuppetRod . RODReactionDirInc ; <nl> else if ( fLeaningDot < thr2 ) <nl> - fReactionTime + = gAIEnv . CVars . RODReactionDirInc * 2 . 0f ; <nl> + fReactionTime + = gAIEnv . CVars . legacyPuppetRod . RODReactionDirInc * 2 . 0f ; <nl> } <nl> <nl> return fReactionTime ; <nl> void CPuppet : : UpdateTargetZone ( CWeakRef < CAIObject > refTarget ) <nl> } <nl> else <nl> { <nl> - const float fKillRange = gAIEnv . CVars . RODKillRangeMod ; <nl> - const float fCombatRange = gAIEnv . CVars . RODCombatRangeMod ; <nl> + const float fKillRange = gAIEnv . CVars . legacyPuppetRod . RODKillRangeMod ; <nl> + const float fCombatRange = gAIEnv . CVars . legacyPuppetRod . RODCombatRangeMod ; <nl> <nl> / / Calculate off of attack range <nl> const float fDistToTargetSqr = Distance : : Point_PointSq ( GetPos ( ) , pTarget - > GetPos ( ) ) ; <nl> void CPuppet : : ResetTargetTracking ( ) <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> float CPuppet : : GetCoverFireTime ( ) const <nl> { <nl> - return m_CurrentWeaponDescriptor . coverFireTime * gAIEnv . CVars . RODCoverFireTimeMod ; <nl> + return m_CurrentWeaponDescriptor . coverFireTime * gAIEnv . CVars . legacyPuppetRod . RODCoverFireTimeMod ; <nl> } <nl> <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> new file mode 100644 <nl> index 0000000000 . . 99cf33702d <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / PuppetRateOfDeathConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " PuppetRateOfDeathConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyPuppetROD : : Init ( ) <nl> + { <nl> + REGISTER_CVAR2 ( " ai_RODAliveTime " , & RODAliveTime , 3 . 0f , VF_NULL , <nl> + " The base level time the player can survive under fire . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODMoveInc " , & RODMoveInc , 3 . 0f , VF_NULL , <nl> + " Increment how the speed of the target affects the alive time ( the value is doubled for supersprint ) . 0 = disable " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODStanceInc " , & RODStanceInc , 2 . 0f , VF_NULL , <nl> + " Increment how the stance of the target affects the alive time , 0 = disable . \ n " <nl> + " The base value is for crouch , and it is doubled for prone . \ n " <nl> + " The crouch inc is disable in kill - zone and prone in kill and combat - near - zones " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODDirInc " , & RODDirInc , 0 . 0f , VF_NULL , <nl> + " Increment how the orientation of the target affects the alive time . 0 = disable " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODKillZoneInc " , & RODKillZoneInc , - 4 . 0f , VF_NULL , <nl> + " Increment how the target is within the kill - zone of the target . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODFakeHitChance " , & RODFakeHitChance , 0 . 2f , VF_NULL , <nl> + " Percentage of the missed hits that will instead be hits dealing very little damage . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODAmbientFireInc " , & RODAmbientFireInc , 3 . 0f , VF_NULL , <nl> + " Increment for the alive time when the target is within the kill - zone of the target . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_RODKillRangeMod " , & RODKillRangeMod , 0 . 15f , VF_NULL , <nl> + " Kill - zone distance = attackRange * killRangeMod . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODCombatRangeMod " , & RODCombatRangeMod , 0 . 55f , VF_NULL , <nl> + " Combat - zone distance = attackRange * combatRangeMod . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_RODCoverFireTimeMod " , & RODCoverFireTimeMod , 1 . 0f , VF_NULL , <nl> + " Multiplier for cover fire times set in weapon descriptor . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_RODReactionTime " , & RODReactionTime , 1 . 0f , VF_NULL , <nl> + " Uses rate of death as damage control method . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODReactionDistInc " , & RODReactionDistInc , 0 . 1f , VF_NULL , <nl> + " Increase for the reaction time when the target is in combat - far - zone or warn - zone . \ n " <nl> + " In warn - zone the increase is doubled . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODReactionDirInc " , & RODReactionDirInc , 2 . 0f , VF_NULL , <nl> + " Increase for the reaction time when the enemy is outside the players FOV or near the edge of the FOV . \ n " <nl> + " The increment is doubled when the target is behind the player . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODReactionLeanInc " , & RODReactionLeanInc , 0 . 2f , VF_NULL , <nl> + " Increase to the reaction to when the target is leaning . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODReactionSuperDarkIllumInc " , & RODReactionSuperDarkIllumInc , 0 . 4f , VF_NULL , <nl> + " Increase for reaction time when the target is in super dark light condition . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODReactionDarkIllumInc " , & RODReactionDarkIllumInc , 0 . 3f , VF_NULL , <nl> + " Increase for reaction time when the target is in dark light condition . " ) ; <nl> + REGISTER_CVAR2 ( " ai_RODReactionMediumIllumInc " , & RODReactionMediumIllumInc , 0 . 2f , VF_NULL , <nl> + " Increase for reaction time when the target is in medium light condition . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_RODLowHealthMercyTime " , & RODLowHealthMercyTime , 1 . 5f , VF_NULL , <nl> + " The amount of time the AI will not hit the target when the target crosses the low health threshold . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . e783674d9d <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / PuppetRateOfDeathConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyPuppetROD <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + float RODAliveTime ; <nl> + float RODMoveInc ; <nl> + float RODStanceInc ; <nl> + float RODDirInc ; <nl> + float RODAmbientFireInc ; <nl> + float RODKillZoneInc ; <nl> + float RODFakeHitChance ; <nl> + <nl> + float RODKillRangeMod ; <nl> + float RODCombatRangeMod ; <nl> + <nl> + float RODReactionTime ; <nl> + float RODReactionSuperDarkIllumInc ; <nl> + float RODReactionDarkIllumInc ; <nl> + float RODReactionMediumIllumInc ; <nl> + float RODReactionDistInc ; <nl> + float RODReactionDirInc ; <nl> + float RODReactionLeanInc ; <nl> + <nl> + float RODLowHealthMercyTime ; <nl> + <nl> + float RODCoverFireTimeMod ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / SmartObjects . cpp <nl> ppp b / Code / CryEngine / CryAISystem / SmartObjects . cpp <nl> void CSmartObjectManager : : UseSmartObject ( CSmartObject * pSmartObjectUser , CSmartO <nl> if ( ! pCondition - > objectPreActionStates . empty ( ) ) / / check is next state non - empty <nl> ModifySmartObjectStates ( pSmartObject , pCondition - > objectPreActionStates ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawSmartObjects ) <nl> + if ( gAIEnv . CVars . legacySmartObjects . DrawSmartObjects ) <nl> { <nl> if ( pCondition - > eActionType ! = eAT_None & & ! pCondition - > sAction . empty ( ) ) <nl> { <nl> void CSmartObjectManager : : UseSmartObject ( CSmartObject * pSmartObjectUser , CSmartO <nl> AILogComment ( " User % s should execute NULL action on smart object % s ! " , pSmartObjectUser - > GetName ( ) , pSmartObject - > GetName ( ) ) ; <nl> } <nl> <nl> - if ( gAIEnv . CVars . DrawSmartObjects ) <nl> + if ( gAIEnv . CVars . legacySmartObjects . DrawSmartObjects ) <nl> { <nl> / / show in debug draw <nl> CDebugUse debugUse = { GetAISystem ( ) - > GetFrameStartTime ( ) , pSmartObjectUser , pSmartObject } ; <nl> bool CSmartObjectManager : : PrepareUseNavigationSmartObject ( SAIActorTargetRequest & <nl> states . sAnimationFailUserStates = pCondition - > userPreActionStates . AsUndoString ( ) ; <nl> states . sAnimationFailObjectStates = pCondition - > objectPreActionStates . AsUndoString ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DrawSmartObjects ) <nl> + if ( gAIEnv . CVars . legacySmartObjects . DrawSmartObjects ) <nl> { <nl> AILogComment ( " User % s is going to play % s animation % s on navigation smart object % s ! " , pSmartObjectUser - > GetName ( ) , <nl> pCondition - > eActionType = = eAT_AnimationSignal | | pCondition - > eActionType = = eAT_PriorityAnimationSignal ? " one shot " : " looping " , pCondition - > sAction . c_str ( ) , pSmartObject - > GetName ( ) ) ; <nl> void CSmartObjectManager : : DebugDraw ( ) <nl> CDebugDrawContext dc ; <nl> dc - > SetAlphaBlended ( true ) ; <nl> <nl> - float drawDist2 = gAIEnv . CVars . AgentStatsDist ; <nl> + float drawDist2 = gAIEnv . CVars . legacyDebugDraw . AgentStatsDist ; <nl> if ( drawDist2 < = 0 | | ! GetAISystem ( ) - > GetPlayer ( ) ) <nl> return ; <nl> drawDist2 * = drawDist2 ; <nl> bool CSmartObjectManager : : GetSmartObjectLinkCostFactorForMNM ( const OffMeshLink_S <nl> <nl> return true ; <nl> } <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> AILogAlways ( " CAISystem : : GetSmartObjectLinkCostFactor % s Cannot find any links for NAVSO % s . " , <nl> pRequesterEntity - > GetName ( ) , pObject - > GetEntity ( ) ? pObject - > GetEntity ( ) - > GetName ( ) : " < unknown > " ) ; <nl> bool CSmartObjectManager : : GetSmartObjectLinkCostFactorForMNM ( const OffMeshLink_S <nl> } <nl> else / / if ( pObject - > GetValidationResult ( ) ! = eSOV_InvalidStatic ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> AILogAlways ( " CAISystem : : GetSmartObjectLinkCostFactor % s NAVSO % s is statically invalid . " , <nl> pRequesterEntity - > GetName ( ) , pObject - > GetEntity ( ) ? pObject - > GetEntity ( ) - > GetName ( ) : " < unknown > " ) ; <nl> bool CSmartObjectManager : : PrepareNavigateSmartObject ( CPipeUser * pPipeUser , CSmar <nl> / / Check if the NAVSO is valid . <nl> if ( pObject - > GetValidationResult ( ) = = eSOV_InvalidStatic ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> AILogAlways ( " CAISystem : : PrepareNavigateSmartObject % s NAVSO % s is statically invalid . " , <nl> pPipeUser - > GetName ( ) , pObject - > GetEntity ( ) ? pObject - > GetEntity ( ) - > GetName ( ) : " < unknown > " ) ; <nl> bool CSmartObjectManager : : PrepareNavigateSmartObject ( CPipeUser * pPipeUser , CSmar <nl> if ( ! ValidateTemplate ( pObject , checkForStaticObstablesOnly , pPipeUser - > GetEntity ( ) , <nl> pFromHelper - > templateHelperIndex , pToHelper - > templateHelperIndex ) ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> AILogAlways ( " CAISystem : : PrepareNavigateSmartObject % s Template validation for NAVSO % s failed . " , <nl> pPipeUser - > GetName ( ) , pObject - > GetEntity ( ) ? pObject - > GetEntity ( ) - > GetName ( ) : " < unknown > " ) ; <nl> } <nl> - m_bannedNavSmartObjects [ pObject ] = gAIEnv . CVars . BannedNavSoTime ; <nl> + m_bannedNavSmartObjects [ pObject ] = gAIEnv . CVars . legacySmartObjects . BannedNavSoTime ; <nl> return false ; <nl> } <nl> <nl> bool CSmartObjectManager : : PrepareNavigateSmartObject ( CPipeUser * pPipeUser , CSmar <nl> <nl> if ( ! numVariations ) <nl> { <nl> - if ( gAIEnv . CVars . DebugPathFinding ) <nl> + if ( gAIEnv . CVars . LegacyDebugPathFinding ) <nl> { <nl> string stateString ; <nl> const CSmartObject : : SetStates & states = pObject - > GetStates ( ) ; <nl> new file mode 100644 <nl> index 0000000000 . . 6ddb47f101 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / SmartObjectsConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " SmartObjectsConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacySmartObjects : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_DrawSmartObjects " , DrawSmartObjects , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws smart object debug information . \ n " <nl> + " Usage : ai_DrawSmartObjects [ 0 / 1 ] \ n " <nl> + " Default is 0 ( off ) . Set to 1 to draw the smart objects . " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_BannedNavSoTime " , & BannedNavSoTime , 15 . 0f , VF_NULL , <nl> + " Time indicating how long invalid navsos should be banned . " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 77e067e1ff <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / SmartObjectsConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacySmartObjects <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( DrawSmartObjects , 0 ) ; <nl> + <nl> + float BannedNavSoTime ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / SmartPathFollower . cpp <nl> ppp b / Code / CryEngine / CryAISystem / SmartPathFollower . cpp <nl> bool CSmartPathFollower : : FindReachableTarget ( float startIndex , float endIndex , f <nl> <nl> if ( reachableIndex > = 0 . 0f ) <nl> { <nl> - if ( gAIEnv . CVars . DrawPathFollower > 1 ) <nl> + if ( gAIEnv . CVars . pathFollower . DrawPathFollower > 1 ) <nl> GetAISystem ( ) - > AddDebugSphere ( m_path . GetPositionAtSegmentIndex ( nextIndex ) , 0 . 25f , 255 , 0 , 0 , 5 . 0f ) ; <nl> } <nl> <nl> bool CSmartPathFollower : : CanReachTargetStep ( float step , float endIndex , float ne <nl> <nl> while ( CanReachTarget ( nextIndex ) ) <nl> { <nl> - if ( gAIEnv . CVars . DrawPathFollower > 1 ) <nl> + if ( gAIEnv . CVars . pathFollower . DrawPathFollower > 1 ) <nl> GetAISystem ( ) - > AddDebugSphere ( m_path . GetPositionAtSegmentIndex ( nextIndex ) , 0 . 25f , 0 , 255 , 0 , 5 . 0f ) ; <nl> <nl> reachableIndex = nextIndex ; <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> const bool isInsideObstacles = m_pathObstacles . IsPointInsideObstacles ( m_curPos ) ; <nl> bool isAllowedToShortcut ; <nl> <nl> - if ( gAIEnv . CVars . SmartPathFollower_useAdvancedPathShortcutting = = 0 ) <nl> + if ( gAIEnv . CVars . pathFollower . SmartPathFollower_useAdvancedPathShortcutting = = 0 ) <nl> { <nl> isAllowedToShortcut = isInsideObstacles ? false : m_params . isAllowedToShortcut ; <nl> } <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> } <nl> <nl> const float currentDistance = m_path . GetDistanceAtSegmentIndex ( indexAtCurrentPos ) ; <nl> - indexAtLookAheadPos = m_path . FindSegmentIndexAtDistance ( currentDistance + gAIEnv . CVars . SmartPathFollower_LookAheadDistance ) ; <nl> + indexAtLookAheadPos = m_path . FindSegmentIndexAtDistance ( currentDistance + gAIEnv . CVars . pathFollower . SmartPathFollower_LookAheadDistance ) ; <nl> <nl> for ( float index = indexAtCurrentPos ; index < = indexAtLookAheadPos ; index + = 1 . 0f ) <nl> { <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> if ( m_pathObstacles . IsLineSegmentIntersectingObstaclesOrCloseToThem ( lineseg , maxDistanceToObstaclesToConsiderTooClose ) ) <nl> { <nl> # ifndef _RELEASE <nl> - if ( gAIEnv . CVars . SmartPathFollower_useAdvancedPathShortcutting_debug ! = 0 ) <nl> + if ( gAIEnv . CVars . pathFollower . SmartPathFollower_useAdvancedPathShortcutting_debug ! = 0 ) <nl> { <nl> gEnv - > pGameFramework - > GetIPersistantDebug ( ) - > Begin ( " SmartPathFollower_useAdvancedPathShortcutting_debug " , false ) ; <nl> gEnv - > pGameFramework - > GetIPersistantDebug ( ) - > AddLine ( lineseg . start + Vec3 ( 0 . 0 , 0 . 0f , 1 . 5f ) , lineseg . end + Vec3 ( 0 . 0f , 0 . 0f , 1 . 5f ) , ColorF ( 1 . 0f , 0 . 0f , 0 . 0f ) , 1 . 0f ) ; <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> } <nl> <nl> # ifndef _RELEASE <nl> - if ( gAIEnv . CVars . SmartPathFollower_useAdvancedPathShortcutting_debug ! = 0 ) <nl> + if ( gAIEnv . CVars . pathFollower . SmartPathFollower_useAdvancedPathShortcutting_debug ! = 0 ) <nl> { <nl> gEnv - > pGameFramework - > GetIPersistantDebug ( ) - > Begin ( " SmartPathFollower_useAdvancedPathShortcutting_debug " , false ) ; <nl> gEnv - > pGameFramework - > GetIPersistantDebug ( ) - > AddLine ( lineseg . start + Vec3 ( 0 . 0 , 0 . 0f , 1 . 5f ) , lineseg . end + Vec3 ( 0 . 0f , 0 . 0f , 1 . 5f ) , ColorF ( 0 . 0f , 1 . 0f , 0 . 0f ) , 1 . 0f ) ; <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> float currentIndex ; <nl> float lookAheadIndex ; <nl> <nl> - const float LookAheadDistance = gAIEnv . CVars . SmartPathFollower_LookAheadDistance ; <nl> + const float LookAheadDistance = gAIEnv . CVars . pathFollower . SmartPathFollower_LookAheadDistance ; <nl> <nl> / / Generate a look - ahead range based on the current FT index . <nl> if ( m_followTargetIndex > 0 . 0f ) <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> targetReachable = false ; <nl> <nl> # ifndef _RELEASE <nl> - if ( gAIEnv . CVars . DrawPathFollower > 0 ) <nl> + if ( gAIEnv . CVars . pathFollower . DrawPathFollower > 0 ) <nl> { <nl> CDebugDrawContext dc ; <nl> dc - > Draw3dLabel ( m_curPos , 1 . 6f , " Failed PathFollower ! " ) ; <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> else <nl> { <nl> float slowDownDist = 1 . 2f ; <nl> - const float decelerationMultiplier = m_params . isVehicle ? gAIEnv . CVars . SmartPathFollower_decelerationVehicle : gAIEnv . CVars . SmartPathFollower_decelerationHuman ; <nl> + const float decelerationMultiplier = m_params . isVehicle ? gAIEnv . CVars . pathFollower . SmartPathFollower_decelerationVehicle : gAIEnv . CVars . pathFollower . SmartPathFollower_decelerationHuman ; <nl> speed = min ( speed , decelerationMultiplier * distToEnd / slowDownDist ) ; <nl> } <nl> } <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> AIAssert ( result . velocityOut . IsValid ( ) ) ; <nl> <nl> # ifndef _RELEASE <nl> - if ( gAIEnv . CVars . DrawPathFollower > 0 ) <nl> + if ( gAIEnv . CVars . pathFollower . DrawPathFollower > 0 ) <nl> { <nl> / / Draw path <nl> Draw ( ) ; <nl> bool CSmartPathFollower : : Update ( PathFollowResult & result , const Vec3 & curPos , co <nl> float CSmartPathFollower : : GetPredictionTimeForMovingAlongPath ( const bool isInsideObstacles , <nl> const float currentSpeedSq ) <nl> { <nl> - float predictionTime = gAIEnv . CVars . SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk ; <nl> + float predictionTime = gAIEnv . CVars . pathFollower . SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathWalk ; <nl> if ( isInsideObstacles ) <nl> { <nl> / / Heuristic time to look ahead on the path when the agent moves inside the shape <nl> float CSmartPathFollower : : GetPredictionTimeForMovingAlongPath ( const bool isInsid <nl> const float minSpeedToBeConsideredRunningOrSprintingSq = sqr ( 2 . 0f ) ; <nl> if ( currentSpeedSq > minSpeedToBeConsideredRunningOrSprintingSq ) <nl> { <nl> - predictionTime = gAIEnv . CVars . SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint ; <nl> + predictionTime = gAIEnv . CVars . pathFollower . SmartPathFollower_LookAheadPredictionTimeForMovingAlongPathRunAndSprint ; <nl> } <nl> } <nl> <nl> mmm a / Code / CryEngine / CryAISystem / TacticalPointSystem / TacticalPointSystem . cpp <nl> ppp b / Code / CryEngine / CryAISystem / TacticalPointSystem / TacticalPointSystem . cpp <nl> bool CTacticalPointSystem : : GenerateInternal ( TTacticalPointQuery query , const Que <nl> { <nl> case eTPQ_GO_Cover : <nl> case eTPQ_GO_Hidespots : <nl> - if ( gAIEnv . CVars . CoverSystem ) <nl> + if ( gAIEnv . CVars . legacyCoverSystem . CoverSystem ) <nl> { <nl> CRY_PROFILE_SECTION ( PROFILE_AI , " TPS Generate Cover Locations " ) ; <nl> <nl> bool CTacticalPointSystem : : GenerateInternal ( TTacticalPointQuery query , const Que <nl> if ( context . pAIActor ! = nullptr ) <nl> { <nl> float distanceToCover = std : : max < float > ( context . distanceToCover , fAgentRadius ) ; <nl> - float occupyRadius = fAgentRadius + gAIEnv . CVars . CoverSpacing ; <nl> + float occupyRadius = fAgentRadius + gAIEnv . CVars . legacyCoverSystem . CoverSpacing ; <nl> <nl> for ( uint32 i = 0 ; i < coverCount ; + + i ) <nl> { <nl> void CTacticalPointSystem : : DebugDraw ( ) const <nl> <nl> / / Make sure the target AI is the current AI Stats Target , unless this is a ' special case ' <nl> EntityId id = 0 ; <nl> - if ( gAIEnv . CVars . StatsTarget ) <nl> + if ( gAIEnv . CVars . legacyDebugDraw . StatsTarget ) <nl> { <nl> - const char * sTarget = gAIEnv . CVars . StatsTarget ; <nl> + const char * sTarget = gAIEnv . CVars . legacyDebugDraw . StatsTarget ; <nl> if ( CAIObject * pTargetObject = gAIEnv . pAIObjectManager - > GetAIObjectByName ( sTarget ) ) <nl> id = pTargetObject - > GetEntityID ( ) ; <nl> - else if ( ! strcmp ( gAIEnv . CVars . StatsTarget , " all " ) ) <nl> + else if ( ! strcmp ( gAIEnv . CVars . legacyDebugDraw . StatsTarget , " all " ) ) <nl> id = - 1 ; <nl> } <nl> <nl> new file mode 100644 <nl> index 0000000000 . . c4cd08d186 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / TacticalPointSystem / TacticalPointSystemConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " TacticalPointSystemConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyTacticalPointSystem : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_TacticalPointSystem " , TacticalPointSystem , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " [ 0 - 1 ] Enable / Disable the Tactical Point System . \ n " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_TacticalPointUpdateTime " , & TacticalPointUpdateTime , 0 . 0005f , VF_NULL , <nl> + " Maximum allowed update time in main AI thread for Tactical Point System \ n " <nl> + " Usage : ai_TacticalPointUpdateTime < number > \ n " <nl> + " Default is 0 . 0003 " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . b55cbbe76f <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / TacticalPointSystem / TacticalPointSystemConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyTacticalPointSystem <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( TacticalPointSystem , 1 ) ; <nl> + <nl> + float TacticalPointUpdateTime ; <nl> + } ; <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . cf8173c9f3 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / TargetSelection / TargetTrackConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " TargetTrackConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsLegacyTargetTracking : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_TargetTracking " , TargetTracking , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enable / disable target tracking . 0 = disable , any other value = Enable " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_TargetTracks_GlobalTargetLimit " , TargetTracks_GlobalTargetLimit , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Global override to control the number of agents that can actively target another agent ( unless there is no other choice ) \ n " <nl> + " A value of 0 means no global limit is applied . If the global target limit is less than the agent ' s target limit , the global limit is used . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugTargetTracksTarget " , TargetTracks_TargetDebugDraw , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws lines to illustrate where each agent ' s target is \ n " <nl> + " Usage : ai_DebugTargetTracking 0 / 1 / 2 \ n " <nl> + " 0 = Off . 1 = Show best target . 2 = Show all possible targets . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugTargetTracksConfig " , TargetTracks_ConfigDebugDraw , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws the information contained in the loaded target track configurations to the screen " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DebugTargetTracksAgent " , & TargetTracks_AgentDebugDraw , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Draws the target tracks for the given agent \ n " <nl> + " Usage : ai_DebugTargetTracksAgent AIName \ n " <nl> + " Default is ' none ' . AIName is the name of the AI agent to debug " ) ; <nl> + <nl> + REGISTER_CVAR2 ( " ai_DebugTargetTracksConfig_Filter " , & TargetTracks_ConfigDebugFilter , " none " , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Filter what configurations are drawn when debugging target tracks \ n " <nl> + " Usage : ai_DebugTargetTracks_Filter Filter \ n " <nl> + " Default is ' none ' . Filter is a substring that must be in the configuration name " ) ; <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . 2bea3ef2d0 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / TargetSelection / TargetTrackConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsLegacyTargetTracking <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( TargetTracking , 1 ) ; <nl> + DeclareConstIntCVar ( TargetTracks_GlobalTargetLimit , 0 ) ; <nl> + DeclareConstIntCVar ( TargetTracks_TargetDebugDraw , 0 ) ; <nl> + DeclareConstIntCVar ( TargetTracks_ConfigDebugDraw , 0 ) ; <nl> + <nl> + const char * TargetTracks_AgentDebugDraw ; <nl> + const char * TargetTracks_ConfigDebugFilter ; <nl> + } ; <nl> \ No newline at end of file <nl> mmm a / Code / CryEngine / CryAISystem / TargetSelection / TargetTrackManager . cpp <nl> ppp b / Code / CryEngine / CryAISystem / TargetSelection / TargetTrackManager . cpp <nl> EAITargetThreat GetSoundStimulusThreatForNonPuppetEntities ( const int soundType ) <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> bool ShouldVisualStimulusBeHandled ( tAIObjectID objectID , const Vec3 eventPosition ) <nl> { <nl> - if ( gAIEnv . CVars . IgnoreVisualStimulus ! = 0 ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreVisualStimulus ! = 0 ) <nl> return false ; <nl> <nl> CWeakRef < CAIObject > refObject = gAIEnv . pObjectContainer - > GetWeakRef ( objectID ) ; <nl> bool ShouldVisualStimulusBeHandled ( tAIObjectID objectID , const Vec3 eventPositio <nl> <nl> bool ShouldSoundStimulusBeHandled ( tAIObjectID objectID , const Vec3 eventPosition , const float maxSoundDistanceAllowed ) <nl> { <nl> - if ( gAIEnv . CVars . IgnoreSoundStimulus ! = 0 ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreSoundStimulus ! = 0 ) <nl> return false ; <nl> <nl> CWeakRef < CAIObject > refObject = gAIEnv . pObjectContainer - > GetWeakRef ( objectID ) ; <nl> bool ShouldSoundStimulusBeHandled ( tAIObjectID objectID , const Vec3 eventPosition <nl> <nl> bool ShouldBulletRainStimulusBeHandled ( tAIObjectID objectID ) <nl> { <nl> - if ( gAIEnv . CVars . IgnoreBulletRainStimulus ! = 0 ) <nl> + if ( gAIEnv . CVars . legacyPerception . IgnoreBulletRainStimulus ! = 0 ) <nl> return false ; <nl> <nl> CWeakRef < CAIObject > refObject = gAIEnv . pObjectContainer - > GetWeakRef ( objectID ) ; <nl> void CTargetTrackManager : : PrepareModifiers ( ) <nl> bool CTargetTrackManager : : IsEnabled ( ) const <nl> { <nl> / / Currently based on cvar <nl> - return ( gAIEnv . CVars . TargetTracking ! = 0 ) ; <nl> + return ( gAIEnv . CVars . legacyTargetTracking . TargetTracking ! = 0 ) ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> int CTargetTrackManager : : GetTargetLimit ( tAIObjectID aiObjectId ) const <nl> { <nl> assert ( aiObjectId > 0 ) ; <nl> <nl> - int nResult = gAIEnv . CVars . TargetTracks_GlobalTargetLimit ; <nl> + int nResult = gAIEnv . CVars . legacyTargetTracking . TargetTracks_GlobalTargetLimit ; <nl> <nl> TAgentContainer : : const_iterator itAgent = m_Agents . find ( aiObjectId ) ; <nl> if ( itAgent ! = m_Agents . end ( ) ) <nl> uint32 CTargetTrackManager : : GetPulseNameHash ( const char * sPulseName ) <nl> void CTargetTrackManager : : DebugDraw ( ) <nl> { <nl> # ifdef TARGET_TRACK_DEBUG <nl> - const int nConfigMode = gAIEnv . CVars . TargetTracks_ConfigDebugDraw ; <nl> - const int nTargetMode = gAIEnv . CVars . TargetTracks_TargetDebugDraw ; <nl> - const char * szAgentName = gAIEnv . CVars . TargetTracks_AgentDebugDraw ; <nl> + const int nConfigMode = gAIEnv . CVars . legacyTargetTracking . TargetTracks_ConfigDebugDraw ; <nl> + const int nTargetMode = gAIEnv . CVars . legacyTargetTracking . TargetTracks_TargetDebugDraw ; <nl> + const char * szAgentName = gAIEnv . CVars . legacyTargetTracking . TargetTracks_AgentDebugDraw ; <nl> <nl> if ( szAgentName & & szAgentName [ 0 ] & & ( <nl> stricmp ( szAgentName , " 0 " ) = = 0 | | <nl> void CTargetTrackManager : : DebugDrawConfig ( int nMode ) <nl> dc - > Draw2dLabel ( fColumnX , fColumnY , 1 . 5f , textCol , false , " Target Track Configs : ( % " PRISIZE_T " ) " , m_Configs . size ( ) ) ; <nl> fColumnY + = 20 . 0f ; <nl> <nl> - const string sFilterName = gAIEnv . CVars . TargetTracks_ConfigDebugFilter ; <nl> + const string sFilterName = gAIEnv . CVars . legacyTargetTracking . TargetTracks_ConfigDebugFilter ; <nl> <nl> TConfigContainer : : const_iterator itConfig = m_Configs . begin ( ) ; <nl> TConfigContainer : : const_iterator itConfigEnd = m_Configs . end ( ) ; <nl> mmm a / Code / CryEngine / CryAISystem / VisionMap . cpp <nl> ppp b / Code / CryEngine / CryAISystem / VisionMap . cpp <nl> void CVisionMap : : UpdateObservers ( ) <nl> } <nl> } <nl> <nl> - int numberOfPVSUpdatesLeft = gAIEnv . CVars . VisionMapNumberOfPVSUpdatesPerFrame ; <nl> + int numberOfPVSUpdatesLeft = gAIEnv . CVars . visionMap . VisionMapNumberOfPVSUpdatesPerFrame ; <nl> while ( numberOfPVSUpdatesLeft > 0 & & m_observerPVSUpdateQueue . size ( ) > 0 ) <nl> { <nl> Observers : : iterator observerIt = m_observers . find ( m_observerPVSUpdateQueue . front ( ) ) ; <nl> void CVisionMap : : UpdateObservers ( ) <nl> } <nl> } <nl> <nl> - int numberOfVisibilityUpdatesLeft = gAIEnv . CVars . VisionMapNumberOfVisibilityUpdatesPerFrame ; <nl> + int numberOfVisibilityUpdatesLeft = gAIEnv . CVars . visionMap . VisionMapNumberOfVisibilityUpdatesPerFrame ; <nl> while ( numberOfVisibilityUpdatesLeft > 0 & & m_observerVisibilityUpdateQueue . size ( ) > 0 ) <nl> { <nl> Observers : : iterator observerIt = m_observers . find ( m_observerVisibilityUpdateQueue . front ( ) ) ; <nl> void CVisionMap : : DebugDraw ( ) <nl> { <nl> CRY_PROFILE_FUNCTION ( PROFILE_AI ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawVisionMap ) <nl> + if ( gAIEnv . CVars . visionMap . DebugDrawVisionMap ) <nl> { <nl> UpdateDebugVisionMapObjects ( ) ; <nl> <nl> DebugDrawObservers ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawVisionMapObservables ) <nl> + if ( gAIEnv . CVars . visionMap . DebugDrawVisionMapObservables ) <nl> DebugDrawObservables ( ) ; <nl> <nl> - if ( gAIEnv . CVars . DebugDrawVisionMapStats ) <nl> + if ( gAIEnv . CVars . visionMap . DebugDrawVisionMapStats ) <nl> DebugDrawVisionMapStats ( ) ; <nl> } <nl> } <nl> void CVisionMap : : DebugDrawObservers ( ) <nl> <nl> / / Visibility Checks / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - if ( gAIEnv . CVars . DebugDrawVisionMapVisibilityChecks ) <nl> + if ( gAIEnv . CVars . visionMap . DebugDrawVisionMapVisibilityChecks ) <nl> { <nl> for ( PVS : : const_iterator pvsIt = observerInfo . pvs . begin ( ) , end = observerInfo . pvs . end ( ) ; pvsIt ! = end ; + + pvsIt ) <nl> { <nl> void CVisionMap : : DebugDrawObservers ( ) <nl> } <nl> } <nl> <nl> - if ( gAIEnv . CVars . DebugDrawVisionMapObservers ) <nl> + if ( gAIEnv . CVars . visionMap . DebugDrawVisionMapObservers ) <nl> { <nl> / / Stats / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> { <nl> void CVisionMap : : DebugDrawObservers ( ) <nl> } <nl> <nl> / / FOVs / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - if ( gAIEnv . CVars . DebugDrawVisionMapObserversFOV ) <nl> + if ( gAIEnv . CVars . visionMap . DebugDrawVisionMapObserversFOV ) <nl> { <nl> const ObserverParams & observerParams = observerInfo . observerParams ; <nl> <nl> new file mode 100644 <nl> index 0000000000 . . 8da3a46e8b <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / VisionMapConsoleVariables . cpp <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # include " StdAfx . h " <nl> + # include " VisionMapConsoleVariables . h " <nl> + <nl> + void SAIConsoleVarsVisionMap : : Init ( ) <nl> + { <nl> + DefineConstIntCVarName ( " ai_DebugDrawVisionMap " , DebugDrawVisionMap , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Toggles the debug drawing of the AI VisionMap . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawVisionMapStats " , DebugDrawVisionMapStats , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables the debug drawing of the AI VisionMap to show stats information . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawVisionMapVisibilityChecks " , DebugDrawVisionMapVisibilityChecks , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables the debug drawing of the AI VisionMap to show the status of the visibility checks . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawVisionMapObservers " , DebugDrawVisionMapObservers , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables the debug drawing of the AI VisionMap to show the location / stats of the observers . \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawVisionMapObserversFOV " , DebugDrawVisionMapObserversFOV , 0 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables the debug drawing of the AI VisionMap to draw representations of the observers FOV . \ n " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_DebugDrawVisionMapObservables " , DebugDrawVisionMapObservables , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , <nl> + " Enables the debug drawing of the AI VisionMap to show the location / stats of the observables . " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_VisionMapNumberOfPVSUpdatesPerFrame " , VisionMapNumberOfPVSUpdatesPerFrame , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " " ) ; <nl> + <nl> + DefineConstIntCVarName ( " ai_VisionMapNumberOfVisibilityUpdatesPerFrame " , VisionMapNumberOfVisibilityUpdatesPerFrame , 1 , VF_CHEAT | VF_CHEAT_NOCHECK , " " ) ; <nl> + } <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 0000000000 . . 419495c647 <nl> mmm / dev / null <nl> ppp b / Code / CryEngine / CryAISystem / VisionMapConsoleVariables . h <nl> <nl> + / / Copyright 2001 - 2019 Crytek GmbH / Crytek Group . All rights reserved . <nl> + <nl> + # pragma once <nl> + <nl> + # include < CrySystem / ConsoleRegistration . h > <nl> + <nl> + struct SAIConsoleVarsVisionMap <nl> + { <nl> + void Init ( ) ; <nl> + <nl> + DeclareConstIntCVar ( VisionMapNumberOfPVSUpdatesPerFrame , 1 ) ; <nl> + DeclareConstIntCVar ( VisionMapNumberOfVisibilityUpdatesPerFrame , 1 ) ; <nl> + <nl> + DeclareConstIntCVar ( DebugDrawVisionMap , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawVisionMapStats , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawVisionMapVisibilityChecks , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawVisionMapObservers , 1 ) ; <nl> + DeclareConstIntCVar ( DebugDrawVisionMapObserversFOV , 0 ) ; <nl> + DeclareConstIntCVar ( DebugDrawVisionMapObservables , 1 ) ; <nl> + } ; <nl> mmm a / Code / CryEngine / CryEntitySystem / RopeProxy . cpp <nl> ppp b / Code / CryEngine / CryEntitySystem / RopeProxy . cpp <nl> void CEntityComponentRope : : ProcessEvent ( const SEntityEvent & event ) <nl> } <nl> break ; <nl> case ENTITY_EVENT_LEVEL_LOADED : <nl> + case ENTITY_EVENT_START_GAME : <nl> / / Relink physics . <nl> if ( m_pRopeRenderNode ) <nl> m_pRopeRenderNode - > LinkEndPoints ( ) ; <nl> void CEntityComponentRope : : ProcessEvent ( const SEntityEvent & event ) <nl> <nl> Cry : : Entity : : EventFlags CEntityComponentRope : : GetEventMask ( ) const <nl> { <nl> - return ENTITY_EVENT_HIDE | ENTITY_EVENT_UNHIDE | ENTITY_EVENT_VISIBLE | ENTITY_EVENT_INVISIBLE | ENTITY_EVENT_DONE | ENTITY_EVENT_PHYS_BREAK | ENTITY_EVENT_LEVEL_LOADED | ENTITY_EVENT_RESET ; <nl> + return ENTITY_EVENT_HIDE | ENTITY_EVENT_UNHIDE | ENTITY_EVENT_VISIBLE | ENTITY_EVENT_INVISIBLE | ENTITY_EVENT_DONE | ENTITY_EVENT_PHYS_BREAK | ENTITY_EVENT_LEVEL_LOADED | ENTITY_EVENT_RESET | ENTITY_EVENT_START_GAME ; <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl>
! I integrate from / / ce / main . . .
CRYTEK/CRYENGINE
35ab636b88400dadcf945fdd7eb10171901f259c
2019-05-17T11:02:07Z
similarity index 100 % <nl> rename from include / mlir / IR / Pass . h <nl> rename to include / mlir / Transforms / Pass . h <nl> mmm a / lib / Transforms / ConvertToCFG . cpp <nl> ppp b / lib / Transforms / ConvertToCFG . cpp <nl> <nl> # include " mlir / IR / CFGFunction . h " <nl> # include " mlir / IR / MLFunction . h " <nl> # include " mlir / IR / Module . h " <nl> - # include " mlir / IR / Pass . h " <nl> + # include " mlir / Transforms / Pass . h " <nl> # include " mlir / Transforms / Passes . h " <nl> # include " llvm / ADT / DenseSet . h " <nl> using namespace mlir ; <nl> mmm a / lib / Transforms / LoopUnroll . cpp <nl> ppp b / lib / Transforms / LoopUnroll . cpp <nl> <nl> # include " mlir / IR / MLFunction . h " <nl> # include " mlir / IR / Module . h " <nl> # include " mlir / IR / OperationSet . h " <nl> - # include " mlir / IR / Pass . h " <nl> # include " mlir / IR / StandardOps . h " <nl> # include " mlir / IR / Statements . h " <nl> # include " mlir / IR / StmtVisitor . h " <nl> + # include " mlir / Transforms / Pass . h " <nl> # include " mlir / Transforms / Passes . h " <nl> # include " llvm / ADT / DenseMap . h " <nl> # include " llvm / Support / raw_ostream . h " <nl> similarity index 93 % <nl> rename from lib / IR / Pass . cpp <nl> rename to lib / Transforms / Pass . cpp <nl> mmm a / lib / IR / Pass . cpp <nl> ppp b / lib / Transforms / Pass . cpp <nl> <nl> / / limitations under the License . <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> / / <nl> - / / This file implements loop unrolling . <nl> + / / This file implements common pass infrastructure . <nl> / / <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - # include " mlir / IR / Pass . h " <nl> + # include " mlir / Transforms / Pass . h " <nl> # include " mlir / IR / CFGFunction . h " <nl> # include " mlir / IR / MLFunction . h " <nl> # include " mlir / IR / Module . h " <nl> mmm a / tools / mlir - opt / mlir - opt . cpp <nl> ppp b / tools / mlir - opt / mlir - opt . cpp <nl> <nl> # include " mlir / IR / MLFunction . h " <nl> # include " mlir / IR / MLIRContext . h " <nl> # include " mlir / IR / Module . h " <nl> - # include " mlir / IR / Pass . h " <nl> # include " mlir / Parser . h " <nl> # include " mlir / TensorFlow / ControlFlowOps . h " <nl> # include " mlir / TensorFlow / Passes . h " <nl> + # include " mlir / Transforms / Pass . h " <nl> # include " mlir / Transforms / Passes . h " <nl> # include " llvm / Support / CommandLine . h " <nl> # include " llvm / Support / FileUtilities . h " <nl>
Move Pass . { h , cpp } from lib / IR / to lib / Transforms / .
tensorflow/tensorflow
6c1f66087cb6e5084c764c541e88121d6c9c02e3
2019-03-29T19:59:07Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> add_dependencies ( buildtests_cxx bm_error ) <nl> endif ( ) <nl> if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> - add_dependencies ( buildtests_cxx bm_fullstack ) <nl> + add_dependencies ( buildtests_cxx bm_fullstack_streaming_ping_pong ) <nl> + endif ( ) <nl> + if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> + add_dependencies ( buildtests_cxx bm_fullstack_streaming_pump ) <nl> + endif ( ) <nl> + if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> + add_dependencies ( buildtests_cxx bm_fullstack_trickle ) <nl> + endif ( ) <nl> + if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> + add_dependencies ( buildtests_cxx bm_fullstack_unary_ping_pong ) <nl> endif ( ) <nl> if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> add_dependencies ( buildtests_cxx bm_metadata ) <nl> add_library ( grpc_test_util <nl> test / core / security / oauth2_utils . c <nl> test / core / end2end / cq_verifier . c <nl> test / core / end2end / fake_resolver . c <nl> - test / core / end2end / fixtures / http_proxy . c <nl> + test / core / end2end / fixtures / http_proxy_fixture . c <nl> test / core / end2end / fixtures / proxy . c <nl> test / core / iomgr / endpoint_tests . c <nl> test / core / util / debugger_macros . c <nl> if ( gRPC_BUILD_TESTS ) <nl> add_library ( grpc_test_util_unsecure <nl> test / core / end2end / cq_verifier . c <nl> test / core / end2end / fake_resolver . c <nl> - test / core / end2end / fixtures / http_proxy . c <nl> + test / core / end2end / fixtures / http_proxy_fixture . c <nl> test / core / end2end / fixtures / proxy . c <nl> test / core / iomgr / endpoint_tests . c <nl> test / core / util / debugger_macros . c <nl> endif ( ) <nl> <nl> if ( gRPC_BUILD_TESTS ) <nl> <nl> + add_library ( grpc_benchmark <nl> + test / cpp / microbenchmarks / helpers . cc <nl> + ) <nl> + <nl> + if ( WIN32 AND MSVC ) <nl> + set_target_properties ( grpc_benchmark PROPERTIES COMPILE_PDB_NAME " grpc_benchmark " <nl> + COMPILE_PDB_OUTPUT_DIRECTORY " $ { CMAKE_BINARY_DIR } " <nl> + ) <nl> + if ( gRPC_INSTALL ) <nl> + install ( FILES $ { CMAKE_CURRENT_BINARY_DIR } / grpc_benchmark . pdb <nl> + DESTINATION $ { CMAKE_INSTALL_LIBDIR } OPTIONAL <nl> + ) <nl> + endif ( ) <nl> + endif ( ) <nl> + <nl> + <nl> + target_include_directories ( grpc_benchmark <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } / include <nl> + PRIVATE $ { BORINGSSL_ROOT_DIR } / include <nl> + PRIVATE $ { PROTOBUF_ROOT_DIR } / src <nl> + PRIVATE $ { ZLIB_INCLUDE_DIR } <nl> + PRIVATE $ { BENCHMARK } / include <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / zlib <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / gflags / include <nl> + PRIVATE third_party / googletest / include <nl> + PRIVATE third_party / googletest <nl> + PRIVATE $ { _gRPC_PROTO_GENS_DIR } <nl> + ) <nl> + <nl> + target_link_libraries ( grpc_benchmark <nl> + $ { _gRPC_PROTOBUF_LIBRARIES } <nl> + $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + benchmark <nl> + grpc + + <nl> + grpc_test_util <nl> + grpc <nl> + $ { _gRPC_GFLAGS_LIBRARIES } <nl> + ) <nl> + <nl> + <nl> + endif ( gRPC_BUILD_TESTS ) <nl> + if ( gRPC_BUILD_TESTS ) <nl> + <nl> add_library ( grpc_cli_libs <nl> test / cpp / util / cli_call . cc <nl> test / cpp / util / cli_credentials . cc <nl> target_include_directories ( bm_call_create <nl> target_link_libraries ( bm_call_create <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> benchmark <nl> grpc + + _test_util <nl> grpc_test_util <nl> target_include_directories ( bm_chttp2_hpack <nl> target_link_libraries ( bm_chttp2_hpack <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> benchmark <nl> grpc + + _test_util <nl> grpc_test_util <nl> target_include_directories ( bm_closure <nl> target_link_libraries ( bm_closure <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> benchmark <nl> grpc + + _test_util <nl> grpc_test_util <nl> target_include_directories ( bm_cq <nl> target_link_libraries ( bm_cq <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> benchmark <nl> grpc + + _test_util <nl> grpc_test_util <nl> target_include_directories ( bm_error <nl> target_link_libraries ( bm_error <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> + benchmark <nl> + grpc + + _test_util <nl> + grpc_test_util <nl> + grpc + + <nl> + grpc <nl> + gpr_test_util <nl> + gpr <nl> + $ { _gRPC_GFLAGS_LIBRARIES } <nl> + ) <nl> + <nl> + endif ( ) <nl> + endif ( gRPC_BUILD_TESTS ) <nl> + if ( gRPC_BUILD_TESTS ) <nl> + if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> + <nl> + add_executable ( bm_fullstack_streaming_ping_pong <nl> + test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . cc <nl> + third_party / googletest / src / gtest - all . cc <nl> + ) <nl> + <nl> + <nl> + target_include_directories ( bm_fullstack_streaming_ping_pong <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } / include <nl> + PRIVATE $ { BORINGSSL_ROOT_DIR } / include <nl> + PRIVATE $ { PROTOBUF_ROOT_DIR } / src <nl> + PRIVATE $ { BENCHMARK_ROOT_DIR } / include <nl> + PRIVATE $ { ZLIB_ROOT_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / zlib <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / gflags / include <nl> + PRIVATE third_party / googletest / include <nl> + PRIVATE third_party / googletest <nl> + PRIVATE $ { _gRPC_PROTO_GENS_DIR } <nl> + ) <nl> + <nl> + target_link_libraries ( bm_fullstack_streaming_ping_pong <nl> + $ { _gRPC_PROTOBUF_LIBRARIES } <nl> + $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> + benchmark <nl> + grpc + + _test_util <nl> + grpc_test_util <nl> + grpc + + <nl> + grpc <nl> + gpr_test_util <nl> + gpr <nl> + $ { _gRPC_GFLAGS_LIBRARIES } <nl> + ) <nl> + <nl> + endif ( ) <nl> + endif ( gRPC_BUILD_TESTS ) <nl> + if ( gRPC_BUILD_TESTS ) <nl> + if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> + <nl> + add_executable ( bm_fullstack_streaming_pump <nl> + test / cpp / microbenchmarks / bm_fullstack_streaming_pump . cc <nl> + third_party / googletest / src / gtest - all . cc <nl> + ) <nl> + <nl> + <nl> + target_include_directories ( bm_fullstack_streaming_pump <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } / include <nl> + PRIVATE $ { BORINGSSL_ROOT_DIR } / include <nl> + PRIVATE $ { PROTOBUF_ROOT_DIR } / src <nl> + PRIVATE $ { BENCHMARK_ROOT_DIR } / include <nl> + PRIVATE $ { ZLIB_ROOT_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / zlib <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / gflags / include <nl> + PRIVATE third_party / googletest / include <nl> + PRIVATE third_party / googletest <nl> + PRIVATE $ { _gRPC_PROTO_GENS_DIR } <nl> + ) <nl> + <nl> + target_link_libraries ( bm_fullstack_streaming_pump <nl> + $ { _gRPC_PROTOBUF_LIBRARIES } <nl> + $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> benchmark <nl> grpc + + _test_util <nl> grpc_test_util <nl> endif ( gRPC_BUILD_TESTS ) <nl> if ( gRPC_BUILD_TESTS ) <nl> if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> <nl> - add_executable ( bm_fullstack <nl> - test / cpp / microbenchmarks / bm_fullstack . cc <nl> + add_executable ( bm_fullstack_trickle <nl> + test / cpp / microbenchmarks / bm_fullstack_trickle . cc <nl> third_party / googletest / src / gtest - all . cc <nl> ) <nl> <nl> <nl> - target_include_directories ( bm_fullstack <nl> + target_include_directories ( bm_fullstack_trickle <nl> PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } <nl> PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } / include <nl> PRIVATE $ { BORINGSSL_ROOT_DIR } / include <nl> target_include_directories ( bm_fullstack <nl> PRIVATE $ { _gRPC_PROTO_GENS_DIR } <nl> ) <nl> <nl> - target_link_libraries ( bm_fullstack <nl> + target_link_libraries ( bm_fullstack_trickle <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> + benchmark <nl> + grpc + + _test_util <nl> + grpc_test_util <nl> + grpc + + <nl> + grpc <nl> + gpr_test_util <nl> + gpr <nl> + $ { _gRPC_GFLAGS_LIBRARIES } <nl> + ) <nl> + <nl> + endif ( ) <nl> + endif ( gRPC_BUILD_TESTS ) <nl> + if ( gRPC_BUILD_TESTS ) <nl> + if ( _gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX ) <nl> + <nl> + add_executable ( bm_fullstack_unary_ping_pong <nl> + test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . cc <nl> + third_party / googletest / src / gtest - all . cc <nl> + ) <nl> + <nl> + <nl> + target_include_directories ( bm_fullstack_unary_ping_pong <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_SOURCE_DIR } / include <nl> + PRIVATE $ { BORINGSSL_ROOT_DIR } / include <nl> + PRIVATE $ { PROTOBUF_ROOT_DIR } / src <nl> + PRIVATE $ { BENCHMARK_ROOT_DIR } / include <nl> + PRIVATE $ { ZLIB_ROOT_DIR } <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / zlib <nl> + PRIVATE $ { CMAKE_CURRENT_BINARY_DIR } / third_party / gflags / include <nl> + PRIVATE third_party / googletest / include <nl> + PRIVATE third_party / googletest <nl> + PRIVATE $ { _gRPC_PROTO_GENS_DIR } <nl> + ) <nl> + <nl> + target_link_libraries ( bm_fullstack_unary_ping_pong <nl> + $ { _gRPC_PROTOBUF_LIBRARIES } <nl> + $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> benchmark <nl> grpc + + _test_util <nl> grpc_test_util <nl> target_include_directories ( bm_metadata <nl> target_link_libraries ( bm_metadata <nl> $ { _gRPC_PROTOBUF_LIBRARIES } <nl> $ { _gRPC_ALLTARGETS_LIBRARIES } <nl> + grpc_benchmark <nl> benchmark <nl> + grpc + + _test_util <nl> grpc_test_util <nl> + grpc + + <nl> grpc <nl> gpr_test_util <nl> gpr <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> bm_chttp2_hpack : $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack <nl> bm_closure : $ ( BINDIR ) / $ ( CONFIG ) / bm_closure <nl> bm_cq : $ ( BINDIR ) / $ ( CONFIG ) / bm_cq <nl> bm_error : $ ( BINDIR ) / $ ( CONFIG ) / bm_error <nl> - bm_fullstack : $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack <nl> + bm_fullstack_streaming_ping_pong : $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong <nl> + bm_fullstack_streaming_pump : $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump <nl> + bm_fullstack_trickle : $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle <nl> + bm_fullstack_unary_ping_pong : $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong <nl> bm_metadata : $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata <nl> channel_arguments_test : $ ( BINDIR ) / $ ( CONFIG ) / channel_arguments_test <nl> channel_filter_test : $ ( BINDIR ) / $ ( CONFIG ) / channel_filter_test <nl> buildtests_cxx : privatelibs_cxx \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_closure \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_cq \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_error \ <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / channel_arguments_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / channel_filter_test \ <nl> buildtests_cxx : privatelibs_cxx \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_closure \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_cq \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_error \ <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle \ <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / channel_arguments_test \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / channel_filter_test \ <nl> test_cxx : buildtests_cxx <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_cq | | ( echo test bm_cq failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing bm_error " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_error | | ( echo test bm_error failed ; exit 1 ) <nl> - $ ( E ) " [ RUN ] Testing bm_fullstack " <nl> - $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack | | ( echo test bm_fullstack failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing bm_fullstack_streaming_ping_pong " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong | | ( echo test bm_fullstack_streaming_ping_pong failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing bm_fullstack_streaming_pump " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump | | ( echo test bm_fullstack_streaming_pump failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing bm_fullstack_trickle " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle | | ( echo test bm_fullstack_trickle failed ; exit 1 ) <nl> + $ ( E ) " [ RUN ] Testing bm_fullstack_unary_ping_pong " <nl> + $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong | | ( echo test bm_fullstack_unary_ping_pong failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing bm_metadata " <nl> $ ( Q ) $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata | | ( echo test bm_metadata failed ; exit 1 ) <nl> $ ( E ) " [ RUN ] Testing channel_arguments_test " <nl> LIBGRPC_TEST_UTIL_SRC = \ <nl> test / core / security / oauth2_utils . c \ <nl> test / core / end2end / cq_verifier . c \ <nl> test / core / end2end / fake_resolver . c \ <nl> - test / core / end2end / fixtures / http_proxy . c \ <nl> + test / core / end2end / fixtures / http_proxy_fixture . c \ <nl> test / core / end2end / fixtures / proxy . c \ <nl> test / core / iomgr / endpoint_tests . c \ <nl> test / core / util / debugger_macros . c \ <nl> endif <nl> LIBGRPC_TEST_UTIL_UNSECURE_SRC = \ <nl> test / core / end2end / cq_verifier . c \ <nl> test / core / end2end / fake_resolver . c \ <nl> - test / core / end2end / fixtures / http_proxy . c \ <nl> + test / core / end2end / fixtures / http_proxy_fixture . c \ <nl> test / core / end2end / fixtures / proxy . c \ <nl> test / core / iomgr / endpoint_tests . c \ <nl> test / core / util / debugger_macros . c \ <nl> ifneq ( $ ( NO_DEPS ) , true ) <nl> endif <nl> <nl> <nl> + LIBGRPC_BENCHMARK_SRC = \ <nl> + test / cpp / microbenchmarks / helpers . cc \ <nl> + <nl> + PUBLIC_HEADERS_CXX + = \ <nl> + <nl> + LIBGRPC_BENCHMARK_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( LIBGRPC_BENCHMARK_SRC ) ) ) ) <nl> + <nl> + <nl> + ifeq ( $ ( NO_SECURE ) , true ) <nl> + <nl> + # You can ' t build secure libraries if you don ' t have OpenSSL . <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a : openssl_dep_error <nl> + <nl> + <nl> + else <nl> + <nl> + ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> + <nl> + # You can ' t build a C + + library if you don ' t have protobuf - a bit overreached , but still okay . <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a : protobuf_dep_error <nl> + <nl> + <nl> + else <nl> + <nl> + $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a : $ ( ZLIB_DEP ) $ ( OPENSSL_DEP ) $ ( PROTOBUF_DEP ) $ ( LIBGRPC_BENCHMARK_OBJS ) <nl> + $ ( E ) " [ AR ] Creating $ @ " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) rm - f $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a <nl> + $ ( Q ) $ ( AR ) $ ( AROPTS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBGRPC_BENCHMARK_OBJS ) <nl> + ifeq ( $ ( SYSTEM ) , Darwin ) <nl> + $ ( Q ) ranlib - no_warning_for_no_symbols $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a <nl> + endif <nl> + <nl> + <nl> + <nl> + <nl> + endif <nl> + <nl> + endif <nl> + <nl> + ifneq ( $ ( NO_SECURE ) , true ) <nl> + ifneq ( $ ( NO_DEPS ) , true ) <nl> + - include $ ( LIBGRPC_BENCHMARK_OBJS : . o = . dep ) <nl> + endif <nl> + endif <nl> + <nl> + <nl> LIBGRPC_CLI_LIBS_SRC = \ <nl> test / cpp / util / cli_call . cc \ <nl> test / cpp / util / cli_credentials . cc \ <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create : $ ( PROTOBUF_DEP ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create : $ ( PROTOBUF_DEP ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CALL_CREATE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_call_create <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_call_create . o : $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_call_create . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_call_create : $ ( BM_CALL_CREATE_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack : $ ( PROTOBUF_DEP ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack : $ ( PROTOBUF_DEP ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CHTTP2_HPACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_chttp2_hpack <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_chttp2_hpack . o : $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_chttp2_hpack . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_chttp2_hpack : $ ( BM_CHTTP2_HPACK_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_closure : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_closure : $ ( PROTOBUF_DEP ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_closure : $ ( PROTOBUF_DEP ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_closure <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CLOSURE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_closure <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_closure . o : $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_closure . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_closure : $ ( BM_CLOSURE_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_cq : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_cq : $ ( PROTOBUF_DEP ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_cq : $ ( PROTOBUF_DEP ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_cq <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_CQ_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_cq <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_cq . o : $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_cq . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_cq : $ ( BM_CQ_OBJS : . o = . dep ) <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_error : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_error : $ ( PROTOBUF_DEP ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_error : $ ( PROTOBUF_DEP ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_error <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_ERROR_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_error <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_error . o : $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_error . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_error : $ ( BM_ERROR_OBJS : . o = . dep ) <nl> <nl> endif <nl> endif <nl> <nl> <nl> - BM_FULLSTACK_SRC = \ <nl> - test / cpp / microbenchmarks / bm_fullstack . cc \ <nl> + BM_FULLSTACK_STREAMING_PING_PONG_SRC = \ <nl> + test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . cc \ <nl> + <nl> + BM_FULLSTACK_STREAMING_PING_PONG_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( BM_FULLSTACK_STREAMING_PING_PONG_SRC ) ) ) ) <nl> + ifeq ( $ ( NO_SECURE ) , true ) <nl> + <nl> + # You can ' t build secure targets if you don ' t have OpenSSL . <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong : openssl_dep_error <nl> + <nl> + else <nl> + <nl> + <nl> + <nl> + <nl> + ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> + <nl> + # You can ' t build the protoc plugins or protobuf - enabled targets if you don ' t have protobuf 3 . 0 . 0 + . <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong : protobuf_dep_error <nl> + <nl> + else <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( E ) " [ LD ] Linking $ @ " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_ping_pong <nl> + <nl> + endif <nl> + <nl> + endif <nl> + <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + <nl> + deps_bm_fullstack_streaming_ping_pong : $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS : . o = . dep ) <nl> + <nl> + ifneq ( $ ( NO_SECURE ) , true ) <nl> + ifneq ( $ ( NO_DEPS ) , true ) <nl> + - include $ ( BM_FULLSTACK_STREAMING_PING_PONG_OBJS : . o = . dep ) <nl> + endif <nl> + endif <nl> + <nl> + <nl> + BM_FULLSTACK_STREAMING_PUMP_SRC = \ <nl> + test / cpp / microbenchmarks / bm_fullstack_streaming_pump . cc \ <nl> + <nl> + BM_FULLSTACK_STREAMING_PUMP_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( BM_FULLSTACK_STREAMING_PUMP_SRC ) ) ) ) <nl> + ifeq ( $ ( NO_SECURE ) , true ) <nl> + <nl> + # You can ' t build secure targets if you don ' t have OpenSSL . <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump : openssl_dep_error <nl> + <nl> + else <nl> + <nl> + <nl> + <nl> + <nl> + ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> + <nl> + # You can ' t build the protoc plugins or protobuf - enabled targets if you don ' t have protobuf 3 . 0 . 0 + . <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump : protobuf_dep_error <nl> + <nl> + else <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( E ) " [ LD ] Linking $ @ " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_streaming_pump <nl> + <nl> + endif <nl> + <nl> + endif <nl> + <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_streaming_pump . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + <nl> + deps_bm_fullstack_streaming_pump : $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS : . o = . dep ) <nl> + <nl> + ifneq ( $ ( NO_SECURE ) , true ) <nl> + ifneq ( $ ( NO_DEPS ) , true ) <nl> + - include $ ( BM_FULLSTACK_STREAMING_PUMP_OBJS : . o = . dep ) <nl> + endif <nl> + endif <nl> + <nl> + <nl> + BM_FULLSTACK_TRICKLE_SRC = \ <nl> + test / cpp / microbenchmarks / bm_fullstack_trickle . cc \ <nl> + <nl> + BM_FULLSTACK_TRICKLE_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( BM_FULLSTACK_TRICKLE_SRC ) ) ) ) <nl> + ifeq ( $ ( NO_SECURE ) , true ) <nl> + <nl> + # You can ' t build secure targets if you don ' t have OpenSSL . <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle : openssl_dep_error <nl> + <nl> + else <nl> + <nl> + <nl> + <nl> + <nl> + ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> + <nl> + # You can ' t build the protoc plugins or protobuf - enabled targets if you don ' t have protobuf 3 . 0 . 0 + . <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle : protobuf_dep_error <nl> + <nl> + else <nl> + <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_TRICKLE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( E ) " [ LD ] Linking $ @ " <nl> + $ ( Q ) mkdir - p ` dirname $ @ ` <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_TRICKLE_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_trickle <nl> + <nl> + endif <nl> + <nl> + endif <nl> + <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_trickle . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + <nl> + deps_bm_fullstack_trickle : $ ( BM_FULLSTACK_TRICKLE_OBJS : . o = . dep ) <nl> + <nl> + ifneq ( $ ( NO_SECURE ) , true ) <nl> + ifneq ( $ ( NO_DEPS ) , true ) <nl> + - include $ ( BM_FULLSTACK_TRICKLE_OBJS : . o = . dep ) <nl> + endif <nl> + endif <nl> + <nl> + <nl> + BM_FULLSTACK_UNARY_PING_PONG_SRC = \ <nl> + test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . cc \ <nl> <nl> - BM_FULLSTACK_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( BM_FULLSTACK_SRC ) ) ) ) <nl> + BM_FULLSTACK_UNARY_PING_PONG_OBJS = $ ( addprefix $ ( OBJDIR ) / $ ( CONFIG ) / , $ ( addsuffix . o , $ ( basename $ ( BM_FULLSTACK_UNARY_PING_PONG_SRC ) ) ) ) <nl> ifeq ( $ ( NO_SECURE ) , true ) <nl> <nl> # You can ' t build secure targets if you don ' t have OpenSSL . <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack : openssl_dep_error <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong : openssl_dep_error <nl> <nl> else <nl> <nl> ifeq ( $ ( NO_PROTOBUF ) , true ) <nl> <nl> # You can ' t build the protoc plugins or protobuf - enabled targets if you don ' t have protobuf 3 . 0 . 0 + . <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack : protobuf_dep_error <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong : $ ( PROTOBUF_DEP ) $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_fullstack_unary_ping_pong <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack . o : $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> - deps_bm_fullstack : $ ( BM_FULLSTACK_OBJS : . o = . dep ) <nl> + deps_bm_fullstack_unary_ping_pong : $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS : . o = . dep ) <nl> <nl> ifneq ( $ ( NO_SECURE ) , true ) <nl> ifneq ( $ ( NO_DEPS ) , true ) <nl> - - include $ ( BM_FULLSTACK_OBJS : . o = . dep ) <nl> + - include $ ( BM_FULLSTACK_UNARY_PING_PONG_OBJS : . o = . dep ) <nl> endif <nl> endif <nl> <nl> $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata : protobuf_dep_error <nl> <nl> else <nl> <nl> - $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata : $ ( PROTOBUF_DEP ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata : $ ( PROTOBUF_DEP ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> $ ( E ) " [ LD ] Linking $ @ " <nl> $ ( Q ) mkdir - p ` dirname $ @ ` <nl> - $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata <nl> + $ ( Q ) $ ( LDXX ) $ ( LDFLAGS ) $ ( BM_METADATA_OBJS ) $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a $ ( LDLIBSXX ) $ ( LDLIBS_PROTOBUF ) $ ( LDLIBS ) $ ( LDLIBS_SECURE ) $ ( GTEST_LIB ) - o $ ( BINDIR ) / $ ( CONFIG ) / bm_metadata <nl> <nl> endif <nl> <nl> endif <nl> <nl> - $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_metadata . o : $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> + $ ( OBJDIR ) / $ ( CONFIG ) / test / cpp / microbenchmarks / bm_metadata . o : $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_benchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libbenchmark . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + _test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc + + . a $ ( LIBDIR ) / $ ( CONFIG ) / libgrpc . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr_test_util . a $ ( LIBDIR ) / $ ( CONFIG ) / libgpr . a <nl> <nl> deps_bm_metadata : $ ( BM_METADATA_OBJS : . o = . dep ) <nl> <nl> test / cpp / interop / interop_client . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / interop / interop_server . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / interop / interop_server_bootstrap . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / interop / server_helper . cc : $ ( OPENSSL_DEP ) <nl> + test / cpp / microbenchmarks / helpers . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / qps / client_async . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / qps / client_sync . cc : $ ( OPENSSL_DEP ) <nl> test / cpp / qps / driver . cc : $ ( OPENSSL_DEP ) <nl> mmm a / build . yaml <nl> ppp b / build . yaml <nl> filegroups : <nl> headers : <nl> - test / core / end2end / cq_verifier . h <nl> - test / core / end2end / fake_resolver . h <nl> - - test / core / end2end / fixtures / http_proxy . h <nl> + - test / core / end2end / fixtures / http_proxy_fixture . h <nl> - test / core / end2end / fixtures / proxy . h <nl> - test / core / iomgr / endpoint_tests . h <nl> - test / core / util / debugger_macros . h <nl> filegroups : <nl> src : <nl> - test / core / end2end / cq_verifier . c <nl> - test / core / end2end / fake_resolver . c <nl> - - test / core / end2end / fixtures / http_proxy . c <nl> + - test / core / end2end / fixtures / http_proxy_fixture . c <nl> - test / core / end2end / fixtures / proxy . c <nl> - test / core / iomgr / endpoint_tests . c <nl> - test / core / util / debugger_macros . c <nl> libs : <nl> - grpc + + _codegen_base_src <nl> secure : false <nl> vs_project_guid : ' { 6EE56155 - DF7C - 4F6E - BFC4 - F6F776BEB211 } ' <nl> + - name : grpc_benchmark <nl> + build : test <nl> + language : c + + <nl> + headers : <nl> + - test / cpp / microbenchmarks / fullstack_context_mutators . h <nl> + - test / cpp / microbenchmarks / fullstack_fixtures . h <nl> + - test / cpp / microbenchmarks / helpers . h <nl> + src : <nl> + - test / cpp / microbenchmarks / helpers . cc <nl> + deps : <nl> + - benchmark <nl> + - grpc + + <nl> + - grpc_test_util <nl> + - grpc <nl> - name : grpc_cli_libs <nl> build : private <nl> language : c + + <nl> targets : <nl> src : <nl> - test / cpp / microbenchmarks / bm_call_create . cc <nl> deps : <nl> + - grpc_benchmark <nl> - benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> targets : <nl> src : <nl> - test / cpp / microbenchmarks / bm_chttp2_hpack . cc <nl> deps : <nl> + - grpc_benchmark <nl> - benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> targets : <nl> src : <nl> - test / cpp / microbenchmarks / bm_closure . cc <nl> deps : <nl> + - grpc_benchmark <nl> - benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> targets : <nl> src : <nl> - test / cpp / microbenchmarks / bm_cq . cc <nl> deps : <nl> + - grpc_benchmark <nl> - benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> targets : <nl> src : <nl> - test / cpp / microbenchmarks / bm_error . cc <nl> deps : <nl> + - grpc_benchmark <nl> + - benchmark <nl> + - grpc + + _test_util <nl> + - grpc_test_util <nl> + - grpc + + <nl> + - grpc <nl> + - gpr_test_util <nl> + - gpr <nl> + args : <nl> + - - - benchmark_min_time = 0 <nl> + platforms : <nl> + - mac <nl> + - linux <nl> + - posix <nl> + - name : bm_fullstack_streaming_ping_pong <nl> + build : test <nl> + language : c + + <nl> + src : <nl> + - test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . cc <nl> + deps : <nl> + - grpc_benchmark <nl> + - benchmark <nl> + - grpc + + _test_util <nl> + - grpc_test_util <nl> + - grpc + + <nl> + - grpc <nl> + - gpr_test_util <nl> + - gpr <nl> + args : <nl> + - - - benchmark_min_time = 0 <nl> + excluded_poll_engines : <nl> + - poll <nl> + - poll - cv <nl> + platforms : <nl> + - mac <nl> + - linux <nl> + - posix <nl> + timeout_seconds : 1200 <nl> + - name : bm_fullstack_streaming_pump <nl> + build : test <nl> + language : c + + <nl> + src : <nl> + - test / cpp / microbenchmarks / bm_fullstack_streaming_pump . cc <nl> + deps : <nl> + - grpc_benchmark <nl> - benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> targets : <nl> - gpr <nl> args : <nl> - - - benchmark_min_time = 0 <nl> + excluded_poll_engines : <nl> + - poll <nl> + - poll - cv <nl> platforms : <nl> - mac <nl> - linux <nl> - posix <nl> - - name : bm_fullstack <nl> + timeout_seconds : 1200 <nl> + - name : bm_fullstack_trickle <nl> build : test <nl> language : c + + <nl> src : <nl> - - test / cpp / microbenchmarks / bm_fullstack . cc <nl> + - test / cpp / microbenchmarks / bm_fullstack_trickle . cc <nl> deps : <nl> + - grpc_benchmark <nl> + - benchmark <nl> + - grpc + + _test_util <nl> + - grpc_test_util <nl> + - grpc + + <nl> + - grpc <nl> + - gpr_test_util <nl> + - gpr <nl> + args : <nl> + - - - benchmark_min_time = 0 <nl> + excluded_poll_engines : <nl> + - poll <nl> + - poll - cv <nl> + platforms : <nl> + - mac <nl> + - linux <nl> + - posix <nl> + timeout_seconds : 1200 <nl> + - name : bm_fullstack_unary_ping_pong <nl> + build : test <nl> + language : c + + <nl> + src : <nl> + - test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . cc <nl> + deps : <nl> + - grpc_benchmark <nl> - benchmark <nl> - grpc + + _test_util <nl> - grpc_test_util <nl> targets : <nl> src : <nl> - test / cpp / microbenchmarks / bm_metadata . cc <nl> deps : <nl> + - grpc_benchmark <nl> - benchmark <nl> + - grpc + + _test_util <nl> - grpc_test_util <nl> + - grpc + + <nl> - grpc <nl> - gpr_test_util <nl> - gpr <nl> mmm a / include / grpc / impl / codegen / sync . h <nl> ppp b / include / grpc / impl / codegen / sync . h <nl> <nl> provides no memory barriers . <nl> * / <nl> <nl> + # ifdef __cplusplus <nl> + extern " C " { <nl> + # endif <nl> + <nl> / * Platform - specific type declarations of gpr_mu and gpr_cv . * / <nl> # include < grpc / impl / codegen / port_platform . h > <nl> # include < grpc / impl / codegen / sync_generic . h > <nl> <nl> # error Unable to determine platform for sync <nl> # endif <nl> <nl> + # ifdef __cplusplus <nl> + } <nl> + # endif <nl> + <nl> # endif / * GRPC_IMPL_CODEGEN_SYNC_H * / <nl> mmm a / test / core / end2end / BUILD <nl> ppp b / test / core / end2end / BUILD <nl> cc_library ( <nl> <nl> cc_library ( <nl> name = ' http_proxy ' , <nl> - hdrs = [ ' fixtures / http_proxy . h ' ] , <nl> - srcs = [ ' fixtures / http_proxy . c ' ] , <nl> + hdrs = [ ' fixtures / http_proxy_fixture . h ' ] , <nl> + srcs = [ ' fixtures / http_proxy_fixture . c ' ] , <nl> copts = [ ' - std = c99 ' ] , <nl> deps = [ ' / / : gpr ' , ' / / : grpc ' , ' / / test / core / util : grpc_test_util ' ] <nl> ) <nl> mmm a / test / core / end2end / fixtures / h2_http_proxy . c <nl> ppp b / test / core / end2end / fixtures / h2_http_proxy . c <nl> <nl> # include " src / core / lib / support / env . h " <nl> # include " src / core / lib / surface / channel . h " <nl> # include " src / core / lib / surface / server . h " <nl> - # include " test / core / end2end / fixtures / http_proxy . h " <nl> + # include " test / core / end2end / fixtures / http_proxy_fixture . h " <nl> # include " test / core / util / port . h " <nl> # include " test / core / util / test_config . h " <nl> <nl> similarity index 99 % <nl> rename from test / core / end2end / fixtures / http_proxy . c <nl> rename to test / core / end2end / fixtures / http_proxy_fixture . c <nl> mmm a / test / core / end2end / fixtures / http_proxy . c <nl> ppp b / test / core / end2end / fixtures / http_proxy_fixture . c <nl> <nl> * <nl> * / <nl> <nl> - # include " test / core / end2end / fixtures / http_proxy . h " <nl> + # include " test / core / end2end / fixtures / http_proxy_fixture . h " <nl> <nl> # include " src / core / lib / iomgr / sockaddr . h " <nl> <nl> similarity index 100 % <nl> rename from test / core / end2end / fixtures / http_proxy . h <nl> rename to test / core / end2end / fixtures / http_proxy_fixture . h <nl> mmm a / test / cpp / microbenchmarks / bm_call_create . cc <nl> ppp b / test / cpp / microbenchmarks / bm_call_create . cc <nl> extern " C " { <nl> # include " src / core / lib / transport / transport_impl . h " <nl> } <nl> <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> <nl> - static struct Init { <nl> - Init ( ) { grpc_init ( ) ; } <nl> - ~ Init ( ) { grpc_shutdown ( ) ; } <nl> - } g_init ; <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> <nl> class BaseChannelFixture { <nl> public : <nl> class LameChannel : public BaseChannelFixture { <nl> <nl> template < class Fixture > <nl> static void BM_CallCreateDestroy ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> Fixture fixture ; <nl> grpc_completion_queue * cq = grpc_completion_queue_create ( NULL ) ; <nl> gpr_timespec deadline = gpr_inf_future ( GPR_CLOCK_MONOTONIC ) ; <nl> static void BM_CallCreateDestroy ( benchmark : : State & state ) { <nl> deadline , NULL ) ) ; <nl> } <nl> grpc_completion_queue_destroy ( cq ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> BENCHMARK_TEMPLATE ( BM_CallCreateDestroy , InsecureChannel ) ; <nl> class SendEmptyMetadata { <nl> / / perform on said filter . <nl> template < class Fixture , class TestOp > <nl> static void BM_IsolatedFilter ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> Fixture fixture ; <nl> std : : ostringstream label ; <nl> <nl> static void BM_IsolatedFilter ( benchmark : : State & state ) { <nl> gpr_free ( call_stack ) ; <nl> <nl> state . SetLabel ( label . str ( ) ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> typedef Fixture < nullptr , 0 > NoFilter ; <nl> mmm a / test / cpp / microbenchmarks / bm_chttp2_hpack . cc <nl> ppp b / test / cpp / microbenchmarks / bm_chttp2_hpack . cc <nl> extern " C " { <nl> # include " src / core / lib / slice / slice_internal . h " <nl> # include " src / core / lib / transport / static_metadata . h " <nl> } <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> <nl> - static struct Init { <nl> - Init ( ) { grpc_init ( ) ; } <nl> - ~ Init ( ) { grpc_shutdown ( ) ; } <nl> - } g_init ; <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / HPACK encoder <nl> / / <nl> <nl> static void BM_HpackEncoderInitDestroy ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_chttp2_hpack_compressor c ; <nl> while ( state . KeepRunning ( ) ) { <nl> static void BM_HpackEncoderInitDestroy ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_HpackEncoderInitDestroy ) ; <nl> <nl> template < class Fixture > <nl> static void BM_HpackEncoderEncodeHeader ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> <nl> grpc_metadata_batch b ; <nl> static void BM_HpackEncoderEncodeHeader ( benchmark : : State & state ) { <nl> < < " header_bytes / iter : " < < ( static_cast < double > ( stats . header_bytes ) / <nl> static_cast < double > ( state . iterations ( ) ) ) ; <nl> state . SetLabel ( label . str ( ) ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> namespace hpack_encoder_fixtures { <nl> BENCHMARK_TEMPLATE ( BM_HpackEncoderEncodeHeader , <nl> / / <nl> <nl> static void BM_HpackParserInitDestroy ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_chttp2_hpack_parser p ; <nl> while ( state . KeepRunning ( ) ) { <nl> static void BM_HpackParserInitDestroy ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_HpackParserInitDestroy ) ; <nl> <nl> static void UnrefHeader ( grpc_exec_ctx * exec_ctx , void * user_data , <nl> <nl> template < class Fixture > <nl> static void BM_HpackParserParseHeader ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> std : : vector < grpc_slice > init_slices = Fixture : : GetInitSlices ( ) ; <nl> std : : vector < grpc_slice > benchmark_slices = Fixture : : GetBenchmarkSlices ( ) ; <nl> static void BM_HpackParserParseHeader ( benchmark : : State & state ) { <nl> } <nl> grpc_chttp2_hpack_parser_destroy ( & exec_ctx , & p ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> namespace hpack_parser_fixtures { <nl> mmm a / test / cpp / microbenchmarks / bm_closure . cc <nl> ppp b / test / cpp / microbenchmarks / bm_closure . cc <nl> <nl> / * <nl> * <nl> - * Copyright 2015 , Google Inc . <nl> + * Copyright 2017 , Google Inc . <nl> * All rights reserved . <nl> * <nl> * Redistribution and use in source and binary forms , with or without <nl> extern " C " { <nl> # include " src / core / lib / support / spinlock . h " <nl> } <nl> <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> <nl> - # include < sstream > <nl> - <nl> - # ifdef GPR_LOW_LEVEL_COUNTERS <nl> - extern " C " gpr_atm gpr_mu_locks ; <nl> - # endif <nl> - <nl> - static class InitializeStuff { <nl> - public : <nl> - InitializeStuff ( ) { grpc_init ( ) ; } <nl> - ~ InitializeStuff ( ) { grpc_shutdown ( ) ; } <nl> - } initialize_stuff ; <nl> - <nl> - class TrackCounters { <nl> - public : <nl> - TrackCounters ( benchmark : : State & state ) : state_ ( state ) { } <nl> - <nl> - ~ TrackCounters ( ) { <nl> - std : : ostringstream out ; <nl> - # ifdef GPR_LOW_LEVEL_COUNTERS <nl> - out < < " locks / iter : " < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_mu_locks ) - <nl> - mu_locks_at_start_ ) / <nl> - ( double ) state_ . iterations ( ) ) <nl> - < < " atm_cas / iter : " <nl> - < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_counter_atm_cas ) - <nl> - atm_cas_at_start_ ) / <nl> - ( double ) state_ . iterations ( ) ) <nl> - < < " atm_add / iter : " <nl> - < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_counter_atm_add ) - <nl> - atm_add_at_start_ ) / <nl> - ( double ) state_ . iterations ( ) ) ; <nl> - # endif <nl> - state_ . SetLabel ( out . str ( ) ) ; <nl> - } <nl> - <nl> - private : <nl> - benchmark : : State & state_ ; <nl> - # ifdef GPR_LOW_LEVEL_COUNTERS <nl> - const size_t mu_locks_at_start_ = gpr_atm_no_barrier_load ( & gpr_mu_locks ) ; <nl> - const size_t atm_cas_at_start_ = <nl> - gpr_atm_no_barrier_load ( & gpr_counter_atm_cas ) ; <nl> - const size_t atm_add_at_start_ = <nl> - gpr_atm_no_barrier_load ( & gpr_counter_atm_add ) ; <nl> - # endif <nl> - } ; <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> <nl> static void BM_NoOpExecCtx ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_NoOpExecCtx ) ; <nl> <nl> static void BM_WellFlushed ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_WellFlushed ) ; <nl> <nl> static void DoNothing ( grpc_exec_ctx * exec_ctx , void * arg , grpc_error * error ) { } <nl> <nl> static void BM_ClosureInitAgainstExecCtx ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_closure c ; <nl> while ( state . KeepRunning ( ) ) { <nl> benchmark : : DoNotOptimize ( <nl> grpc_closure_init ( & c , DoNothing , NULL , grpc_schedule_on_exec_ctx ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureInitAgainstExecCtx ) ; <nl> <nl> static void BM_ClosureInitAgainstCombiner ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_combiner * combiner = grpc_combiner_create ( NULL ) ; <nl> grpc_closure c ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_ClosureInitAgainstCombiner ( benchmark : : State & state ) { <nl> } <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureInitAgainstCombiner ) ; <nl> <nl> static void BM_ClosureRunOnExecCtx ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_closure c ; <nl> grpc_closure_init ( & c , DoNothing , NULL , grpc_schedule_on_exec_ctx ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_ClosureRunOnExecCtx ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureRunOnExecCtx ) ; <nl> <nl> static void BM_ClosureCreateAndRun ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_closure_run ( & exec_ctx , grpc_closure_create ( DoNothing , NULL , <nl> static void BM_ClosureCreateAndRun ( benchmark : : State & state ) { <nl> GRPC_ERROR_NONE ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureCreateAndRun ) ; <nl> <nl> static void BM_ClosureInitAndRun ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_closure c ; <nl> while ( state . KeepRunning ( ) ) { <nl> static void BM_ClosureInitAndRun ( benchmark : : State & state ) { <nl> GRPC_ERROR_NONE ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureInitAndRun ) ; <nl> <nl> static void BM_ClosureSchedOnExecCtx ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_closure c ; <nl> grpc_closure_init ( & c , DoNothing , NULL , grpc_schedule_on_exec_ctx ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_ClosureSchedOnExecCtx ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSchedOnExecCtx ) ; <nl> <nl> static void BM_ClosureSched2OnExecCtx ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_closure c1 ; <nl> grpc_closure c2 ; <nl> grpc_closure_init ( & c1 , DoNothing , NULL , grpc_schedule_on_exec_ctx ) ; <nl> static void BM_ClosureSched2OnExecCtx ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSched2OnExecCtx ) ; <nl> <nl> static void BM_ClosureSched3OnExecCtx ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_closure c1 ; <nl> grpc_closure c2 ; <nl> grpc_closure c3 ; <nl> static void BM_ClosureSched3OnExecCtx ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSched3OnExecCtx ) ; <nl> <nl> static void BM_AcquireMutex ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> / / for comparison with the combiner stuff below <nl> gpr_mu mu ; <nl> gpr_mu_init ( & mu ) ; <nl> static void BM_AcquireMutex ( benchmark : : State & state ) { <nl> gpr_mu_unlock ( & mu ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_AcquireMutex ) ; <nl> <nl> static void BM_TryAcquireMutex ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> / / for comparison with the combiner stuff below <nl> gpr_mu mu ; <nl> gpr_mu_init ( & mu ) ; <nl> static void BM_TryAcquireMutex ( benchmark : : State & state ) { <nl> } <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_TryAcquireMutex ) ; <nl> <nl> static void BM_AcquireSpinlock ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> / / for comparison with the combiner stuff below <nl> gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_AcquireSpinlock ( benchmark : : State & state ) { <nl> gpr_spinlock_unlock ( & mu ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_AcquireSpinlock ) ; <nl> <nl> static void BM_TryAcquireSpinlock ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> / / for comparison with the combiner stuff below <nl> gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_TryAcquireSpinlock ( benchmark : : State & state ) { <nl> } <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_TryAcquireSpinlock ) ; <nl> <nl> static void BM_ClosureSchedOnCombiner ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_combiner * combiner = grpc_combiner_create ( NULL ) ; <nl> grpc_closure c ; <nl> grpc_closure_init ( & c , DoNothing , NULL , <nl> static void BM_ClosureSchedOnCombiner ( benchmark : : State & state ) { <nl> } <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSchedOnCombiner ) ; <nl> <nl> static void BM_ClosureSched2OnCombiner ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_combiner * combiner = grpc_combiner_create ( NULL ) ; <nl> grpc_closure c1 ; <nl> grpc_closure c2 ; <nl> static void BM_ClosureSched2OnCombiner ( benchmark : : State & state ) { <nl> } <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSched2OnCombiner ) ; <nl> <nl> static void BM_ClosureSched3OnCombiner ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_combiner * combiner = grpc_combiner_create ( NULL ) ; <nl> grpc_closure c1 ; <nl> grpc_closure c2 ; <nl> static void BM_ClosureSched3OnCombiner ( benchmark : : State & state ) { <nl> } <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSched3OnCombiner ) ; <nl> <nl> static void BM_ClosureSched2OnTwoCombiners ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_combiner * combiner1 = grpc_combiner_create ( NULL ) ; <nl> grpc_combiner * combiner2 = grpc_combiner_create ( NULL ) ; <nl> grpc_closure c1 ; <nl> static void BM_ClosureSched2OnTwoCombiners ( benchmark : : State & state ) { <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner1 , " finished " ) ; <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner2 , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSched2OnTwoCombiners ) ; <nl> <nl> static void BM_ClosureSched4OnTwoCombiners ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_combiner * combiner1 = grpc_combiner_create ( NULL ) ; <nl> grpc_combiner * combiner2 = grpc_combiner_create ( NULL ) ; <nl> grpc_closure c1 ; <nl> static void BM_ClosureSched4OnTwoCombiners ( benchmark : : State & state ) { <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner1 , " finished " ) ; <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner2 , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureSched4OnTwoCombiners ) ; <nl> <nl> class Rescheduler { <nl> } ; <nl> <nl> static void BM_ClosureReschedOnExecCtx ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> Rescheduler r ( state , grpc_schedule_on_exec_ctx ) ; <nl> r . ScheduleFirst ( & exec_ctx ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureReschedOnExecCtx ) ; <nl> <nl> static void BM_ClosureReschedOnCombiner ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_combiner * combiner = grpc_combiner_create ( NULL ) ; <nl> Rescheduler r ( state , grpc_combiner_scheduler ( combiner , false ) ) ; <nl> static void BM_ClosureReschedOnCombiner ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureReschedOnCombiner ) ; <nl> <nl> static void BM_ClosureReschedOnCombinerFinally ( benchmark : : State & state ) { <nl> - TrackCounters track_counters ( state ) ; <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_combiner * combiner = grpc_combiner_create ( NULL ) ; <nl> Rescheduler r ( state , grpc_combiner_finally_scheduler ( combiner , false ) ) ; <nl> static void BM_ClosureReschedOnCombinerFinally ( benchmark : : State & state ) { <nl> grpc_exec_ctx_flush ( & exec_ctx ) ; <nl> GRPC_COMBINER_UNREF ( & exec_ctx , combiner , " finished " ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ClosureReschedOnCombinerFinally ) ; <nl> <nl> mmm a / test / cpp / microbenchmarks / bm_cq . cc <nl> ppp b / test / cpp / microbenchmarks / bm_cq . cc <nl> <nl> # include < grpc + + / impl / grpc_library . h > <nl> # include < grpc / grpc . h > <nl> <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> <nl> extern " C " { <nl> extern " C " { <nl> namespace grpc { <nl> namespace testing { <nl> <nl> - static class InitializeStuff { <nl> - public : <nl> - InitializeStuff ( ) { init_lib_ . init ( ) ; } <nl> - ~ InitializeStuff ( ) { init_lib_ . shutdown ( ) ; } <nl> - <nl> - private : <nl> - internal : : GrpcLibrary init_lib_ ; <nl> - internal : : GrpcLibraryInitializer init_ ; <nl> - } initialize_stuff ; <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> <nl> static void BM_CreateDestroyCpp ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> CompletionQueue cq ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_CreateDestroyCpp ) ; <nl> <nl> static void BM_CreateDestroyCore ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_completion_queue_destroy ( grpc_completion_queue_create ( NULL ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_CreateDestroyCore ) ; <nl> <nl> class DummyTag final : public CompletionQueueTag { <nl> } ; <nl> <nl> static void BM_Pass1Cpp ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> CompletionQueue cq ; <nl> grpc_completion_queue * c_cq = cq . cq ( ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> static void BM_Pass1Cpp ( benchmark : : State & state ) { <nl> bool ok ; <nl> cq . Next ( & tag , & ok ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_Pass1Cpp ) ; <nl> <nl> static void BM_Pass1Core ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_completion_queue * cq = grpc_completion_queue_create ( NULL ) ; <nl> gpr_timespec deadline = gpr_inf_future ( GPR_CLOCK_MONOTONIC ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> static void BM_Pass1Core ( benchmark : : State & state ) { <nl> grpc_completion_queue_next ( cq , deadline , NULL ) ; <nl> } <nl> grpc_completion_queue_destroy ( cq ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_Pass1Core ) ; <nl> <nl> static void BM_Pluck1Core ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_completion_queue * cq = grpc_completion_queue_create ( NULL ) ; <nl> gpr_timespec deadline = gpr_inf_future ( GPR_CLOCK_MONOTONIC ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> static void BM_Pluck1Core ( benchmark : : State & state ) { <nl> grpc_completion_queue_pluck ( cq , NULL , deadline , NULL ) ; <nl> } <nl> grpc_completion_queue_destroy ( cq ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_Pluck1Core ) ; <nl> <nl> static void BM_EmptyCore ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_completion_queue * cq = grpc_completion_queue_create ( NULL ) ; <nl> gpr_timespec deadline = gpr_inf_past ( GPR_CLOCK_MONOTONIC ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_completion_queue_next ( cq , deadline , NULL ) ; <nl> } <nl> grpc_completion_queue_destroy ( cq ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_EmptyCore ) ; <nl> <nl> mmm a / test / cpp / microbenchmarks / bm_error . cc <nl> ppp b / test / cpp / microbenchmarks / bm_error . cc <nl> extern " C " { <nl> # include " src / core / lib / transport / error_utils . h " <nl> } <nl> <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> + <nl> class ErrorDeleter { <nl> public : <nl> void operator ( ) ( grpc_error * error ) { GRPC_ERROR_UNREF ( error ) ; } <nl> class ErrorDeleter { <nl> typedef std : : unique_ptr < grpc_error , ErrorDeleter > ErrorPtr ; <nl> <nl> static void BM_ErrorCreate ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> GRPC_ERROR_UNREF ( GRPC_ERROR_CREATE ( " Error " ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ErrorCreate ) ; <nl> <nl> static void BM_ErrorCreateAndSetStatus ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> GRPC_ERROR_UNREF ( grpc_error_set_int ( GRPC_ERROR_CREATE ( " Error " ) , <nl> GRPC_ERROR_INT_GRPC_STATUS , <nl> GRPC_STATUS_ABORTED ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ErrorCreateAndSetStatus ) ; <nl> <nl> static void BM_ErrorRefUnref ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_error * error = GRPC_ERROR_CREATE ( " Error " ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> GRPC_ERROR_UNREF ( GRPC_ERROR_REF ( error ) ) ; <nl> } <nl> GRPC_ERROR_UNREF ( error ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ErrorRefUnref ) ; <nl> <nl> static void BM_ErrorUnrefNone ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> GRPC_ERROR_UNREF ( GRPC_ERROR_NONE ) ; <nl> } <nl> static void BM_ErrorUnrefNone ( benchmark : : State & state ) { <nl> BENCHMARK ( BM_ErrorUnrefNone ) ; <nl> <nl> static void BM_ErrorGetIntFromNoError ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> intptr_t value ; <nl> grpc_error_get_int ( GRPC_ERROR_NONE , GRPC_ERROR_INT_GRPC_STATUS , & value ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ErrorGetIntFromNoError ) ; <nl> <nl> static void BM_ErrorGetMissingInt ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> ErrorPtr error ( <nl> grpc_error_set_int ( GRPC_ERROR_CREATE ( " Error " ) , GRPC_ERROR_INT_INDEX , 1 ) ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> intptr_t value ; <nl> grpc_error_get_int ( error . get ( ) , GRPC_ERROR_INT_OFFSET , & value ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ErrorGetMissingInt ) ; <nl> <nl> static void BM_ErrorGetPresentInt ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> ErrorPtr error ( <nl> grpc_error_set_int ( GRPC_ERROR_CREATE ( " Error " ) , GRPC_ERROR_INT_OFFSET , 1 ) ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> intptr_t value ; <nl> grpc_error_get_int ( error . get ( ) , GRPC_ERROR_INT_OFFSET , & value ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_ErrorGetPresentInt ) ; <nl> <nl> class ErrorWithNestedGrpcStatus { <nl> <nl> template < class Fixture > <nl> static void BM_ErrorStringOnNewError ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> Fixture fixture ; <nl> grpc_error_string ( fixture . error ( ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> template < class Fixture > <nl> static void BM_ErrorStringRepeatedly ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> Fixture fixture ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_error_string ( fixture . error ( ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> template < class Fixture > <nl> static void BM_ErrorGetStatus ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> Fixture fixture ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_status_code status ; <nl> static void BM_ErrorGetStatus ( benchmark : : State & state ) { <nl> grpc_error_get_status ( fixture . error ( ) , fixture . deadline ( ) , & status , & msg , <nl> NULL ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> template < class Fixture > <nl> static void BM_ErrorGetStatusCode ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> Fixture fixture ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_status_code status ; <nl> grpc_error_get_status ( fixture . error ( ) , fixture . deadline ( ) , & status , NULL , <nl> NULL ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> template < class Fixture > <nl> static void BM_ErrorHttpError ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> Fixture fixture ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_http2_error_code error ; <nl> grpc_error_get_status ( fixture . error ( ) , fixture . deadline ( ) , NULL , NULL , <nl> & error ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> template < class Fixture > <nl> static void BM_HasClearGrpcStatus ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> Fixture fixture ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_error_has_clear_grpc_status ( fixture . error ( ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> <nl> # define BENCHMARK_SUITE ( fixture ) \ <nl> deleted file mode 100644 <nl> index 48e131f1be0 . . 00000000000 <nl> mmm a / test / cpp / microbenchmarks / bm_fullstack . cc <nl> ppp / dev / null <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> - / * Benchmark gRPC end2end in various configurations * / <nl> - <nl> - # include < sstream > <nl> - <nl> - # include < grpc + + / channel . h > <nl> - # include < grpc + + / create_channel . h > <nl> - # include < grpc + + / impl / grpc_library . h > <nl> - # include < grpc + + / security / credentials . h > <nl> - # include < grpc + + / security / server_credentials . h > <nl> - # include < grpc + + / server . h > <nl> - # include < grpc + + / server_builder . h > <nl> - # include < grpc / support / log . h > <nl> - <nl> - extern " C " { <nl> - # include " src / core / ext / transport / chttp2 / transport / chttp2_transport . h " <nl> - # include " src / core / ext / transport / chttp2 / transport / internal . h " <nl> - # include " src / core / lib / channel / channel_args . h " <nl> - # include " src / core / lib / iomgr / endpoint . h " <nl> - # include " src / core / lib / iomgr / endpoint_pair . h " <nl> - # include " src / core / lib / iomgr / exec_ctx . h " <nl> - # include " src / core / lib / iomgr / tcp_posix . h " <nl> - # include " src / core / lib / surface / channel . h " <nl> - # include " src / core / lib / surface / completion_queue . h " <nl> - # include " src / core / lib / surface / server . h " <nl> - # include " test / core / util / memory_counters . h " <nl> - # include " test / core / util / passthru_endpoint . h " <nl> - # include " test / core / util / port . h " <nl> - # include " test / core / util / trickle_endpoint . h " <nl> - } <nl> - # include " src / core / lib / profiling / timers . h " <nl> - # include " src / cpp / client / create_channel_internal . h " <nl> - # include " src / proto / grpc / testing / echo . grpc . pb . h " <nl> - # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> - <nl> - namespace grpc { <nl> - namespace testing { <nl> - <nl> - static class InitializeStuff { <nl> - public : <nl> - InitializeStuff ( ) { <nl> - grpc_memory_counters_init ( ) ; <nl> - init_lib_ . init ( ) ; <nl> - rq_ = grpc_resource_quota_create ( " bm " ) ; <nl> - } <nl> - <nl> - ~ InitializeStuff ( ) { init_lib_ . shutdown ( ) ; } <nl> - <nl> - grpc_resource_quota * rq ( ) { return rq_ ; } <nl> - <nl> - private : <nl> - internal : : GrpcLibrary init_lib_ ; <nl> - grpc_resource_quota * rq_ ; <nl> - } initialize_stuff ; <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * FIXTURES <nl> - * / <nl> - <nl> - static void ApplyCommonServerBuilderConfig ( ServerBuilder * b ) { <nl> - b - > SetMaxReceiveMessageSize ( INT_MAX ) ; <nl> - b - > SetMaxSendMessageSize ( INT_MAX ) ; <nl> - } <nl> - <nl> - static void ApplyCommonChannelArguments ( ChannelArguments * c ) { <nl> - c - > SetInt ( GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH , INT_MAX ) ; <nl> - c - > SetInt ( GRPC_ARG_MAX_SEND_MESSAGE_LENGTH , INT_MAX ) ; <nl> - } <nl> - <nl> - # ifdef GPR_LOW_LEVEL_COUNTERS <nl> - extern " C " gpr_atm gpr_mu_locks ; <nl> - extern " C " gpr_atm gpr_counter_atm_cas ; <nl> - extern " C " gpr_atm gpr_counter_atm_add ; <nl> - # endif <nl> - <nl> - class BaseFixture { <nl> - public : <nl> - void Finish ( benchmark : : State & s ) { <nl> - std : : ostringstream out ; <nl> - this - > AddToLabel ( out , s ) ; <nl> - # ifdef GPR_LOW_LEVEL_COUNTERS <nl> - out < < " locks / iter : " < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_mu_locks ) - <nl> - mu_locks_at_start_ ) / <nl> - ( double ) s . iterations ( ) ) <nl> - < < " atm_cas / iter : " <nl> - < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_counter_atm_cas ) - <nl> - atm_cas_at_start_ ) / <nl> - ( double ) s . iterations ( ) ) <nl> - < < " atm_add / iter : " <nl> - < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_counter_atm_add ) - <nl> - atm_add_at_start_ ) / <nl> - ( double ) s . iterations ( ) ) ; <nl> - # endif <nl> - grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot ( ) ; <nl> - out < < " allocs / iter : " <nl> - < < ( ( double ) ( counters_at_end . total_allocs_absolute - <nl> - counters_at_start_ . total_allocs_absolute ) / <nl> - ( double ) s . iterations ( ) ) ; <nl> - auto label = out . str ( ) ; <nl> - if ( label . length ( ) & & label [ 0 ] = = ' ' ) { <nl> - label = label . substr ( 1 ) ; <nl> - } <nl> - s . SetLabel ( label ) ; <nl> - } <nl> - <nl> - virtual void AddToLabel ( std : : ostream & out , benchmark : : State & s ) = 0 ; <nl> - <nl> - private : <nl> - # ifdef GPR_LOW_LEVEL_COUNTERS <nl> - const size_t mu_locks_at_start_ = gpr_atm_no_barrier_load ( & gpr_mu_locks ) ; <nl> - const size_t atm_cas_at_start_ = <nl> - gpr_atm_no_barrier_load ( & gpr_counter_atm_cas ) ; <nl> - const size_t atm_add_at_start_ = <nl> - gpr_atm_no_barrier_load ( & gpr_counter_atm_add ) ; <nl> - # endif <nl> - grpc_memory_counters counters_at_start_ = grpc_memory_counters_snapshot ( ) ; <nl> - } ; <nl> - <nl> - class FullstackFixture : public BaseFixture { <nl> - public : <nl> - FullstackFixture ( Service * service , const grpc : : string & address ) { <nl> - ServerBuilder b ; <nl> - b . AddListeningPort ( address , InsecureServerCredentials ( ) ) ; <nl> - cq_ = b . AddCompletionQueue ( true ) ; <nl> - b . RegisterService ( service ) ; <nl> - ApplyCommonServerBuilderConfig ( & b ) ; <nl> - server_ = b . BuildAndStart ( ) ; <nl> - ChannelArguments args ; <nl> - ApplyCommonChannelArguments ( & args ) ; <nl> - channel_ = CreateCustomChannel ( address , InsecureChannelCredentials ( ) , args ) ; <nl> - } <nl> - <nl> - virtual ~ FullstackFixture ( ) { <nl> - server_ - > Shutdown ( ) ; <nl> - cq_ - > Shutdown ( ) ; <nl> - void * tag ; <nl> - bool ok ; <nl> - while ( cq_ - > Next ( & tag , & ok ) ) { <nl> - } <nl> - } <nl> - <nl> - ServerCompletionQueue * cq ( ) { return cq_ . get ( ) ; } <nl> - std : : shared_ptr < Channel > channel ( ) { return channel_ ; } <nl> - <nl> - private : <nl> - std : : unique_ptr < Server > server_ ; <nl> - std : : unique_ptr < ServerCompletionQueue > cq_ ; <nl> - std : : shared_ptr < Channel > channel_ ; <nl> - } ; <nl> - <nl> - class TCP : public FullstackFixture { <nl> - public : <nl> - TCP ( Service * service ) : FullstackFixture ( service , MakeAddress ( ) ) { } <nl> - <nl> - void AddToLabel ( std : : ostream & out , benchmark : : State & state ) { } <nl> - <nl> - private : <nl> - static grpc : : string MakeAddress ( ) { <nl> - int port = grpc_pick_unused_port_or_die ( ) ; <nl> - std : : stringstream addr ; <nl> - addr < < " localhost : " < < port ; <nl> - return addr . str ( ) ; <nl> - } <nl> - } ; <nl> - <nl> - class UDS : public FullstackFixture { <nl> - public : <nl> - UDS ( Service * service ) : FullstackFixture ( service , MakeAddress ( ) ) { } <nl> - <nl> - void AddToLabel ( std : : ostream & out , benchmark : : State & state ) override { } <nl> - <nl> - private : <nl> - static grpc : : string MakeAddress ( ) { <nl> - int port = grpc_pick_unused_port_or_die ( ) ; / / just for a unique id - not a <nl> - / / real port <nl> - std : : stringstream addr ; <nl> - addr < < " unix : / tmp / bm_fullstack . " < < port ; <nl> - return addr . str ( ) ; <nl> - } <nl> - } ; <nl> - <nl> - class EndpointPairFixture : public BaseFixture { <nl> - public : <nl> - EndpointPairFixture ( Service * service , grpc_endpoint_pair endpoints ) <nl> - : endpoint_pair_ ( endpoints ) { <nl> - ServerBuilder b ; <nl> - cq_ = b . AddCompletionQueue ( true ) ; <nl> - b . RegisterService ( service ) ; <nl> - ApplyCommonServerBuilderConfig ( & b ) ; <nl> - server_ = b . BuildAndStart ( ) ; <nl> - <nl> - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> - <nl> - / * add server endpoint to server_ * / <nl> - { <nl> - const grpc_channel_args * server_args = <nl> - grpc_server_get_channel_args ( server_ - > c_server ( ) ) ; <nl> - server_transport_ = grpc_create_chttp2_transport ( <nl> - & exec_ctx , server_args , endpoints . server , 0 / * is_client * / ) ; <nl> - <nl> - grpc_pollset * * pollsets ; <nl> - size_t num_pollsets = 0 ; <nl> - grpc_server_get_pollsets ( server_ - > c_server ( ) , & pollsets , & num_pollsets ) ; <nl> - <nl> - for ( size_t i = 0 ; i < num_pollsets ; i + + ) { <nl> - grpc_endpoint_add_to_pollset ( & exec_ctx , endpoints . server , pollsets [ i ] ) ; <nl> - } <nl> - <nl> - grpc_server_setup_transport ( & exec_ctx , server_ - > c_server ( ) , <nl> - server_transport_ , NULL , server_args ) ; <nl> - grpc_chttp2_transport_start_reading ( & exec_ctx , server_transport_ , NULL ) ; <nl> - } <nl> - <nl> - / * create channel * / <nl> - { <nl> - ChannelArguments args ; <nl> - args . SetString ( GRPC_ARG_DEFAULT_AUTHORITY , " test . authority " ) ; <nl> - ApplyCommonChannelArguments ( & args ) ; <nl> - <nl> - grpc_channel_args c_args = args . c_channel_args ( ) ; <nl> - client_transport_ = <nl> - grpc_create_chttp2_transport ( & exec_ctx , & c_args , endpoints . client , 1 ) ; <nl> - GPR_ASSERT ( client_transport_ ) ; <nl> - grpc_channel * channel = <nl> - grpc_channel_create ( & exec_ctx , " target " , & c_args , <nl> - GRPC_CLIENT_DIRECT_CHANNEL , client_transport_ ) ; <nl> - grpc_chttp2_transport_start_reading ( & exec_ctx , client_transport_ , NULL ) ; <nl> - <nl> - channel_ = CreateChannelInternal ( " " , channel ) ; <nl> - } <nl> - <nl> - grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> - } <nl> - <nl> - virtual ~ EndpointPairFixture ( ) { <nl> - server_ - > Shutdown ( ) ; <nl> - cq_ - > Shutdown ( ) ; <nl> - void * tag ; <nl> - bool ok ; <nl> - while ( cq_ - > Next ( & tag , & ok ) ) { <nl> - } <nl> - } <nl> - <nl> - ServerCompletionQueue * cq ( ) { return cq_ . get ( ) ; } <nl> - std : : shared_ptr < Channel > channel ( ) { return channel_ ; } <nl> - <nl> - protected : <nl> - grpc_endpoint_pair endpoint_pair_ ; <nl> - grpc_transport * client_transport_ ; <nl> - grpc_transport * server_transport_ ; <nl> - <nl> - private : <nl> - std : : unique_ptr < Server > server_ ; <nl> - std : : unique_ptr < ServerCompletionQueue > cq_ ; <nl> - std : : shared_ptr < Channel > channel_ ; <nl> - } ; <nl> - <nl> - class SockPair : public EndpointPairFixture { <nl> - public : <nl> - SockPair ( Service * service ) <nl> - : EndpointPairFixture ( service , grpc_iomgr_create_endpoint_pair ( <nl> - " test " , initialize_stuff . rq ( ) , 8192 ) ) { <nl> - } <nl> - <nl> - void AddToLabel ( std : : ostream & out , benchmark : : State & state ) { } <nl> - } ; <nl> - <nl> - class InProcessCHTTP2 : public EndpointPairFixture { <nl> - public : <nl> - InProcessCHTTP2 ( Service * service ) <nl> - : EndpointPairFixture ( service , MakeEndpoints ( ) ) { } <nl> - <nl> - void AddToLabel ( std : : ostream & out , benchmark : : State & state ) { <nl> - out < < " writes / iter : " <nl> - < < ( ( double ) stats_ . num_writes / ( double ) state . iterations ( ) ) ; <nl> - } <nl> - <nl> - private : <nl> - grpc_passthru_endpoint_stats stats_ ; <nl> - <nl> - grpc_endpoint_pair MakeEndpoints ( ) { <nl> - grpc_endpoint_pair p ; <nl> - grpc_passthru_endpoint_create ( & p . client , & p . server , initialize_stuff . rq ( ) , <nl> - & stats_ ) ; <nl> - return p ; <nl> - } <nl> - } ; <nl> - <nl> - class TrickledCHTTP2 : public EndpointPairFixture { <nl> - public : <nl> - TrickledCHTTP2 ( Service * service , size_t megabits_per_second ) <nl> - : EndpointPairFixture ( service , MakeEndpoints ( megabits_per_second ) ) { } <nl> - <nl> - void AddToLabel ( std : : ostream & out , benchmark : : State & state ) { <nl> - out < < " writes / iter : " <nl> - < < ( ( double ) stats_ . num_writes / ( double ) state . iterations ( ) ) <nl> - < < " cli_transport_stalls / iter : " <nl> - < < ( ( double ) <nl> - client_stats_ . streams_stalled_due_to_transport_flow_control / <nl> - ( double ) state . iterations ( ) ) <nl> - < < " cli_stream_stalls / iter : " <nl> - < < ( ( double ) client_stats_ . streams_stalled_due_to_stream_flow_control / <nl> - ( double ) state . iterations ( ) ) <nl> - < < " svr_transport_stalls / iter : " <nl> - < < ( ( double ) <nl> - server_stats_ . streams_stalled_due_to_transport_flow_control / <nl> - ( double ) state . iterations ( ) ) <nl> - < < " svr_stream_stalls / iter : " <nl> - < < ( ( double ) server_stats_ . streams_stalled_due_to_stream_flow_control / <nl> - ( double ) state . iterations ( ) ) ; <nl> - } <nl> - <nl> - void Step ( ) { <nl> - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> - size_t client_backlog = <nl> - grpc_trickle_endpoint_trickle ( & exec_ctx , endpoint_pair_ . client ) ; <nl> - size_t server_backlog = <nl> - grpc_trickle_endpoint_trickle ( & exec_ctx , endpoint_pair_ . server ) ; <nl> - grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> - <nl> - UpdateStats ( ( grpc_chttp2_transport * ) client_transport_ , & client_stats_ , <nl> - client_backlog ) ; <nl> - UpdateStats ( ( grpc_chttp2_transport * ) server_transport_ , & server_stats_ , <nl> - server_backlog ) ; <nl> - } <nl> - <nl> - private : <nl> - grpc_passthru_endpoint_stats stats_ ; <nl> - struct Stats { <nl> - int streams_stalled_due_to_stream_flow_control = 0 ; <nl> - int streams_stalled_due_to_transport_flow_control = 0 ; <nl> - } ; <nl> - Stats client_stats_ ; <nl> - Stats server_stats_ ; <nl> - <nl> - grpc_endpoint_pair MakeEndpoints ( size_t kilobits ) { <nl> - grpc_endpoint_pair p ; <nl> - grpc_passthru_endpoint_create ( & p . client , & p . server , initialize_stuff . rq ( ) , <nl> - & stats_ ) ; <nl> - double bytes_per_second = 125 . 0 * kilobits ; <nl> - p . client = grpc_trickle_endpoint_create ( p . client , bytes_per_second ) ; <nl> - p . server = grpc_trickle_endpoint_create ( p . server , bytes_per_second ) ; <nl> - return p ; <nl> - } <nl> - <nl> - void UpdateStats ( grpc_chttp2_transport * t , Stats * s , size_t backlog ) { <nl> - if ( backlog = = 0 ) { <nl> - if ( t - > lists [ GRPC_CHTTP2_LIST_STALLED_BY_STREAM ] . head ! = NULL ) { <nl> - s - > streams_stalled_due_to_stream_flow_control + + ; <nl> - } <nl> - if ( t - > lists [ GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT ] . head ! = NULL ) { <nl> - s - > streams_stalled_due_to_transport_flow_control + + ; <nl> - } <nl> - } <nl> - } <nl> - } ; <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * CONTEXT MUTATORS <nl> - * / <nl> - <nl> - static const int kPregenerateKeyCount = 100000 ; <nl> - <nl> - template < class F > <nl> - auto MakeVector ( size_t length , F f ) - > std : : vector < decltype ( f ( ) ) > { <nl> - std : : vector < decltype ( f ( ) ) > out ; <nl> - out . reserve ( length ) ; <nl> - for ( size_t i = 0 ; i < length ; i + + ) { <nl> - out . push_back ( f ( ) ) ; <nl> - } <nl> - return out ; <nl> - } <nl> - <nl> - class NoOpMutator { <nl> - public : <nl> - template < class ContextType > <nl> - NoOpMutator ( ContextType * context ) { } <nl> - } ; <nl> - <nl> - template < int length > <nl> - class RandomBinaryMetadata { <nl> - public : <nl> - static const grpc : : string & Key ( ) { return kKey ; } <nl> - <nl> - static const grpc : : string & Value ( ) { <nl> - return kValues [ rand ( ) % kValues . size ( ) ] ; <nl> - } <nl> - <nl> - private : <nl> - static const grpc : : string kKey ; <nl> - static const std : : vector < grpc : : string > kValues ; <nl> - <nl> - static grpc : : string GenerateOneString ( ) { <nl> - grpc : : string s ; <nl> - s . reserve ( length + 1 ) ; <nl> - for ( int i = 0 ; i < length ; i + + ) { <nl> - s + = ( char ) rand ( ) ; <nl> - } <nl> - return s ; <nl> - } <nl> - } ; <nl> - <nl> - template < int length > <nl> - const grpc : : string RandomBinaryMetadata < length > : : kKey = " foo - bin " ; <nl> - <nl> - template < int length > <nl> - const std : : vector < grpc : : string > RandomBinaryMetadata < length > : : kValues = <nl> - MakeVector ( kPregenerateKeyCount , GenerateOneString ) ; <nl> - <nl> - template < int length > <nl> - class RandomAsciiMetadata { <nl> - public : <nl> - static const grpc : : string & Key ( ) { return kKey ; } <nl> - <nl> - static const grpc : : string & Value ( ) { <nl> - return kValues [ rand ( ) % kValues . size ( ) ] ; <nl> - } <nl> - <nl> - private : <nl> - static const grpc : : string kKey ; <nl> - static const std : : vector < grpc : : string > kValues ; <nl> - <nl> - static grpc : : string GenerateOneString ( ) { <nl> - grpc : : string s ; <nl> - s . reserve ( length + 1 ) ; <nl> - for ( int i = 0 ; i < length ; i + + ) { <nl> - s + = ( char ) ( rand ( ) % 26 + ' a ' ) ; <nl> - } <nl> - return s ; <nl> - } <nl> - } ; <nl> - <nl> - template < int length > <nl> - const grpc : : string RandomAsciiMetadata < length > : : kKey = " foo " ; <nl> - <nl> - template < int length > <nl> - const std : : vector < grpc : : string > RandomAsciiMetadata < length > : : kValues = <nl> - MakeVector ( kPregenerateKeyCount , GenerateOneString ) ; <nl> - <nl> - template < class Generator , int kNumKeys > <nl> - class Client_AddMetadata : public NoOpMutator { <nl> - public : <nl> - Client_AddMetadata ( ClientContext * context ) : NoOpMutator ( context ) { <nl> - for ( int i = 0 ; i < kNumKeys ; i + + ) { <nl> - context - > AddMetadata ( Generator : : Key ( ) , Generator : : Value ( ) ) ; <nl> - } <nl> - } <nl> - } ; <nl> - <nl> - template < class Generator , int kNumKeys > <nl> - class Server_AddInitialMetadata : public NoOpMutator { <nl> - public : <nl> - Server_AddInitialMetadata ( ServerContext * context ) : NoOpMutator ( context ) { <nl> - for ( int i = 0 ; i < kNumKeys ; i + + ) { <nl> - context - > AddInitialMetadata ( Generator : : Key ( ) , Generator : : Value ( ) ) ; <nl> - } <nl> - } <nl> - } ; <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * BENCHMARKING KERNELS <nl> - * / <nl> - <nl> - static void * tag ( intptr_t x ) { return reinterpret_cast < void * > ( x ) ; } <nl> - <nl> - template < class Fixture , class ClientContextMutator , class ServerContextMutator > <nl> - static void BM_UnaryPingPong ( benchmark : : State & state ) { <nl> - EchoTestService : : AsyncService service ; <nl> - std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> - EchoRequest send_request ; <nl> - EchoResponse send_response ; <nl> - EchoResponse recv_response ; <nl> - if ( state . range ( 0 ) > 0 ) { <nl> - send_request . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> - } <nl> - if ( state . range ( 1 ) > 0 ) { <nl> - send_response . set_message ( std : : string ( state . range ( 1 ) , ' a ' ) ) ; <nl> - } <nl> - Status recv_status ; <nl> - struct ServerEnv { <nl> - ServerContext ctx ; <nl> - EchoRequest recv_request ; <nl> - grpc : : ServerAsyncResponseWriter < EchoResponse > response_writer ; <nl> - ServerEnv ( ) : response_writer ( & ctx ) { } <nl> - } ; <nl> - uint8_t server_env_buffer [ 2 * sizeof ( ServerEnv ) ] ; <nl> - ServerEnv * server_env [ 2 ] = { <nl> - reinterpret_cast < ServerEnv * > ( server_env_buffer ) , <nl> - reinterpret_cast < ServerEnv * > ( server_env_buffer + sizeof ( ServerEnv ) ) } ; <nl> - new ( server_env [ 0 ] ) ServerEnv ; <nl> - new ( server_env [ 1 ] ) ServerEnv ; <nl> - service . RequestEcho ( & server_env [ 0 ] - > ctx , & server_env [ 0 ] - > recv_request , <nl> - & server_env [ 0 ] - > response_writer , fixture - > cq ( ) , <nl> - fixture - > cq ( ) , tag ( 0 ) ) ; <nl> - service . RequestEcho ( & server_env [ 1 ] - > ctx , & server_env [ 1 ] - > recv_request , <nl> - & server_env [ 1 ] - > response_writer , fixture - > cq ( ) , <nl> - fixture - > cq ( ) , tag ( 1 ) ) ; <nl> - std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> - EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> - while ( state . KeepRunning ( ) ) { <nl> - GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> - recv_response . Clear ( ) ; <nl> - ClientContext cli_ctx ; <nl> - ClientContextMutator cli_ctx_mut ( & cli_ctx ) ; <nl> - std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> - stub - > AsyncEcho ( & cli_ctx , send_request , fixture - > cq ( ) ) ) ; <nl> - void * t ; <nl> - bool ok ; <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - GPR_ASSERT ( t = = tag ( 0 ) | | t = = tag ( 1 ) ) ; <nl> - intptr_t slot = reinterpret_cast < intptr_t > ( t ) ; <nl> - ServerEnv * senv = server_env [ slot ] ; <nl> - ServerContextMutator svr_ctx_mut ( & senv - > ctx ) ; <nl> - senv - > response_writer . Finish ( send_response , Status : : OK , tag ( 3 ) ) ; <nl> - response_reader - > Finish ( & recv_response , & recv_status , tag ( 4 ) ) ; <nl> - for ( int i = ( 1 < < 3 ) | ( 1 < < 4 ) ; i ! = 0 ; ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int tagnum = ( int ) reinterpret_cast < intptr_t > ( t ) ; <nl> - GPR_ASSERT ( i & ( 1 < < tagnum ) ) ; <nl> - i - = 1 < < tagnum ; <nl> - } <nl> - GPR_ASSERT ( recv_status . ok ( ) ) ; <nl> - <nl> - senv - > ~ ServerEnv ( ) ; <nl> - senv = new ( senv ) ServerEnv ( ) ; <nl> - service . RequestEcho ( & senv - > ctx , & senv - > recv_request , & senv - > response_writer , <nl> - fixture - > cq ( ) , fixture - > cq ( ) , tag ( slot ) ) ; <nl> - } <nl> - fixture - > Finish ( state ) ; <nl> - fixture . reset ( ) ; <nl> - server_env [ 0 ] - > ~ ServerEnv ( ) ; <nl> - server_env [ 1 ] - > ~ ServerEnv ( ) ; <nl> - state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) + <nl> - state . range ( 1 ) * state . iterations ( ) ) ; <nl> - } <nl> - <nl> - / / Repeatedly makes Streaming Bidi calls ( exchanging a configurable number of <nl> - / / messages in each call ) in a loop on a single channel <nl> - / / <nl> - / / First parmeter ( i . e state . range ( 0 ) ) : Message size ( in bytes ) to use <nl> - / / Second parameter ( i . e state . range ( 1 ) ) : Number of ping pong messages . <nl> - / / Note : One ping - pong means two messages ( one from client to server and <nl> - / / the other from server to client ) : <nl> - template < class Fixture , class ClientContextMutator , class ServerContextMutator > <nl> - static void BM_StreamingPingPong ( benchmark : : State & state ) { <nl> - const int msg_size = state . range ( 0 ) ; <nl> - const int max_ping_pongs = state . range ( 1 ) ; <nl> - <nl> - EchoTestService : : AsyncService service ; <nl> - std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> - { <nl> - EchoResponse send_response ; <nl> - EchoResponse recv_response ; <nl> - EchoRequest send_request ; <nl> - EchoRequest recv_request ; <nl> - <nl> - if ( msg_size > 0 ) { <nl> - send_request . set_message ( std : : string ( msg_size , ' a ' ) ) ; <nl> - send_response . set_message ( std : : string ( msg_size , ' b ' ) ) ; <nl> - } <nl> - <nl> - std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> - EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> - <nl> - while ( state . KeepRunning ( ) ) { <nl> - ServerContext svr_ctx ; <nl> - ServerContextMutator svr_ctx_mut ( & svr_ctx ) ; <nl> - ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> - service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> - fixture - > cq ( ) , tag ( 0 ) ) ; <nl> - <nl> - ClientContext cli_ctx ; <nl> - ClientContextMutator cli_ctx_mut ( & cli_ctx ) ; <nl> - auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> - <nl> - / / Establish async stream between client side and server side <nl> - void * t ; <nl> - bool ok ; <nl> - int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - <nl> - / / Send ' max_ping_pongs ' number of ping pong messages <nl> - int ping_pong_cnt = 0 ; <nl> - while ( ping_pong_cnt < max_ping_pongs ) { <nl> - request_rw - > Write ( send_request , tag ( 0 ) ) ; / / Start client send <nl> - response_rw . Read ( & recv_request , tag ( 1 ) ) ; / / Start server recv <nl> - request_rw - > Read ( & recv_response , tag ( 2 ) ) ; / / Start client recv <nl> - <nl> - need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) | ( 1 < < 2 ) | ( 1 < < 3 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - <nl> - / / If server recv is complete , start the server send operation <nl> - if ( i = = 1 ) { <nl> - response_rw . Write ( send_response , tag ( 3 ) ) ; <nl> - } <nl> - <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - <nl> - ping_pong_cnt + + ; <nl> - } <nl> - <nl> - request_rw - > WritesDone ( tag ( 0 ) ) ; <nl> - response_rw . Finish ( Status : : OK , tag ( 1 ) ) ; <nl> - <nl> - Status recv_status ; <nl> - request_rw - > Finish ( & recv_status , tag ( 2 ) ) ; <nl> - <nl> - need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) | ( 1 < < 2 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - <nl> - GPR_ASSERT ( recv_status . ok ( ) ) ; <nl> - } <nl> - } <nl> - <nl> - fixture - > Finish ( state ) ; <nl> - fixture . reset ( ) ; <nl> - state . SetBytesProcessed ( msg_size * state . iterations ( ) * max_ping_pongs * 2 ) ; <nl> - } <nl> - <nl> - / / Repeatedly sends ping pong messages in a single streaming Bidi call in a loop <nl> - / / First parmeter ( i . e state . range ( 0 ) ) : Message size ( in bytes ) to use <nl> - template < class Fixture , class ClientContextMutator , class ServerContextMutator > <nl> - static void BM_StreamingPingPongMsgs ( benchmark : : State & state ) { <nl> - const int msg_size = state . range ( 0 ) ; <nl> - <nl> - EchoTestService : : AsyncService service ; <nl> - std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> - { <nl> - EchoResponse send_response ; <nl> - EchoResponse recv_response ; <nl> - EchoRequest send_request ; <nl> - EchoRequest recv_request ; <nl> - <nl> - if ( msg_size > 0 ) { <nl> - send_request . set_message ( std : : string ( msg_size , ' a ' ) ) ; <nl> - send_response . set_message ( std : : string ( msg_size , ' b ' ) ) ; <nl> - } <nl> - <nl> - std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> - EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> - <nl> - ServerContext svr_ctx ; <nl> - ServerContextMutator svr_ctx_mut ( & svr_ctx ) ; <nl> - ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> - service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> - fixture - > cq ( ) , tag ( 0 ) ) ; <nl> - <nl> - ClientContext cli_ctx ; <nl> - ClientContextMutator cli_ctx_mut ( & cli_ctx ) ; <nl> - auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> - <nl> - / / Establish async stream between client side and server side <nl> - void * t ; <nl> - bool ok ; <nl> - int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - <nl> - while ( state . KeepRunning ( ) ) { <nl> - GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> - request_rw - > Write ( send_request , tag ( 0 ) ) ; / / Start client send <nl> - response_rw . Read ( & recv_request , tag ( 1 ) ) ; / / Start server recv <nl> - request_rw - > Read ( & recv_response , tag ( 2 ) ) ; / / Start client recv <nl> - <nl> - need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) | ( 1 < < 2 ) | ( 1 < < 3 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - <nl> - / / If server recv is complete , start the server send operation <nl> - if ( i = = 1 ) { <nl> - response_rw . Write ( send_response , tag ( 3 ) ) ; <nl> - } <nl> - <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - } <nl> - <nl> - request_rw - > WritesDone ( tag ( 0 ) ) ; <nl> - response_rw . Finish ( Status : : OK , tag ( 1 ) ) ; <nl> - Status recv_status ; <nl> - request_rw - > Finish ( & recv_status , tag ( 2 ) ) ; <nl> - <nl> - need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) | ( 1 < < 2 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - <nl> - GPR_ASSERT ( recv_status . ok ( ) ) ; <nl> - } <nl> - <nl> - fixture - > Finish ( state ) ; <nl> - fixture . reset ( ) ; <nl> - state . SetBytesProcessed ( msg_size * state . iterations ( ) * 2 ) ; <nl> - } <nl> - <nl> - template < class Fixture > <nl> - static void BM_PumpStreamClientToServer ( benchmark : : State & state ) { <nl> - EchoTestService : : AsyncService service ; <nl> - std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> - { <nl> - EchoRequest send_request ; <nl> - EchoRequest recv_request ; <nl> - if ( state . range ( 0 ) > 0 ) { <nl> - send_request . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> - } <nl> - Status recv_status ; <nl> - ServerContext svr_ctx ; <nl> - ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> - service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> - fixture - > cq ( ) , tag ( 0 ) ) ; <nl> - std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> - EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> - ClientContext cli_ctx ; <nl> - auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> - int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - void * t ; <nl> - bool ok ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - response_rw . Read ( & recv_request , tag ( 0 ) ) ; <nl> - while ( state . KeepRunning ( ) ) { <nl> - GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> - request_rw - > Write ( send_request , tag ( 1 ) ) ; <nl> - while ( true ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - if ( t = = tag ( 0 ) ) { <nl> - response_rw . Read ( & recv_request , tag ( 0 ) ) ; <nl> - } else if ( t = = tag ( 1 ) ) { <nl> - break ; <nl> - } else { <nl> - GPR_ASSERT ( false ) ; <nl> - } <nl> - } <nl> - } <nl> - request_rw - > WritesDone ( tag ( 1 ) ) ; <nl> - need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - } <nl> - fixture - > Finish ( state ) ; <nl> - fixture . reset ( ) ; <nl> - state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> - } <nl> - <nl> - template < class Fixture > <nl> - static void BM_PumpStreamServerToClient ( benchmark : : State & state ) { <nl> - EchoTestService : : AsyncService service ; <nl> - std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> - { <nl> - EchoResponse send_response ; <nl> - EchoResponse recv_response ; <nl> - if ( state . range ( 0 ) > 0 ) { <nl> - send_response . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> - } <nl> - Status recv_status ; <nl> - ServerContext svr_ctx ; <nl> - ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> - service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> - fixture - > cq ( ) , tag ( 0 ) ) ; <nl> - std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> - EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> - ClientContext cli_ctx ; <nl> - auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> - int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - void * t ; <nl> - bool ok ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> - while ( state . KeepRunning ( ) ) { <nl> - GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> - response_rw . Write ( send_response , tag ( 1 ) ) ; <nl> - while ( true ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - if ( t = = tag ( 0 ) ) { <nl> - request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> - } else if ( t = = tag ( 1 ) ) { <nl> - break ; <nl> - } else { <nl> - GPR_ASSERT ( false ) ; <nl> - } <nl> - } <nl> - } <nl> - response_rw . Finish ( Status : : OK , tag ( 1 ) ) ; <nl> - need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - while ( need_tags ) { <nl> - GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - } <nl> - fixture - > Finish ( state ) ; <nl> - fixture . reset ( ) ; <nl> - state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> - } <nl> - <nl> - static void TrickleCQNext ( TrickledCHTTP2 * fixture , void * * t , bool * ok ) { <nl> - while ( true ) { <nl> - switch ( fixture - > cq ( ) - > AsyncNext ( <nl> - t , ok , gpr_time_add ( gpr_now ( GPR_CLOCK_MONOTONIC ) , <nl> - gpr_time_from_micros ( 100 , GPR_TIMESPAN ) ) ) ) { <nl> - case CompletionQueue : : TIMEOUT : <nl> - fixture - > Step ( ) ; <nl> - break ; <nl> - case CompletionQueue : : SHUTDOWN : <nl> - GPR_ASSERT ( false ) ; <nl> - break ; <nl> - case CompletionQueue : : GOT_EVENT : <nl> - return ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - static void BM_PumpStreamServerToClient_Trickle ( benchmark : : State & state ) { <nl> - EchoTestService : : AsyncService service ; <nl> - std : : unique_ptr < TrickledCHTTP2 > fixture ( <nl> - new TrickledCHTTP2 ( & service , state . range ( 1 ) ) ) ; <nl> - { <nl> - EchoResponse send_response ; <nl> - EchoResponse recv_response ; <nl> - if ( state . range ( 0 ) > 0 ) { <nl> - send_response . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> - } <nl> - Status recv_status ; <nl> - ServerContext svr_ctx ; <nl> - ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> - service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> - fixture - > cq ( ) , tag ( 0 ) ) ; <nl> - std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> - EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> - ClientContext cli_ctx ; <nl> - auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> - int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - void * t ; <nl> - bool ok ; <nl> - while ( need_tags ) { <nl> - TrickleCQNext ( fixture . get ( ) , & t , & ok ) ; <nl> - GPR_ASSERT ( ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> - while ( state . KeepRunning ( ) ) { <nl> - GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> - response_rw . Write ( send_response , tag ( 1 ) ) ; <nl> - while ( true ) { <nl> - TrickleCQNext ( fixture . get ( ) , & t , & ok ) ; <nl> - if ( t = = tag ( 0 ) ) { <nl> - request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> - } else if ( t = = tag ( 1 ) ) { <nl> - break ; <nl> - } else { <nl> - GPR_ASSERT ( false ) ; <nl> - } <nl> - } <nl> - } <nl> - response_rw . Finish ( Status : : OK , tag ( 1 ) ) ; <nl> - need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> - while ( need_tags ) { <nl> - TrickleCQNext ( fixture . get ( ) , & t , & ok ) ; <nl> - int i = ( int ) ( intptr_t ) t ; <nl> - GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> - need_tags & = ~ ( 1 < < i ) ; <nl> - } <nl> - } <nl> - fixture - > Finish ( state ) ; <nl> - fixture . reset ( ) ; <nl> - state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> - } <nl> - <nl> - / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - * CONFIGURATIONS <nl> - * / <nl> - <nl> - static void SweepSizesArgs ( benchmark : : internal : : Benchmark * b ) { <nl> - b - > Args ( { 0 , 0 } ) ; <nl> - for ( int i = 1 ; i < = 128 * 1024 * 1024 ; i * = 8 ) { <nl> - b - > Args ( { i , 0 } ) ; <nl> - b - > Args ( { 0 , i } ) ; <nl> - b - > Args ( { i , i } ) ; <nl> - } <nl> - } <nl> - <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , TCP , NoOpMutator , NoOpMutator ) <nl> - - > Apply ( SweepSizesArgs ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , UDS , NoOpMutator , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , SockPair , NoOpMutator , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , NoOpMutator ) <nl> - - > Apply ( SweepSizesArgs ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomBinaryMetadata < 10 > , 1 > , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomBinaryMetadata < 31 > , 1 > , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomBinaryMetadata < 100 > , 1 > , <nl> - NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomBinaryMetadata < 10 > , 2 > , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomBinaryMetadata < 31 > , 2 > , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomBinaryMetadata < 100 > , 2 > , <nl> - NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - Server_AddInitialMetadata < RandomBinaryMetadata < 10 > , 1 > ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - Server_AddInitialMetadata < RandomBinaryMetadata < 31 > , 1 > ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - Server_AddInitialMetadata < RandomBinaryMetadata < 100 > , 1 > ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomAsciiMetadata < 10 > , 1 > , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomAsciiMetadata < 31 > , 1 > , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> - Client_AddMetadata < RandomAsciiMetadata < 100 > , 1 > , NoOpMutator ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - Server_AddInitialMetadata < RandomAsciiMetadata < 10 > , 1 > ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - Server_AddInitialMetadata < RandomAsciiMetadata < 31 > , 1 > ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - Server_AddInitialMetadata < RandomAsciiMetadata < 100 > , 1 > ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - Server_AddInitialMetadata < RandomAsciiMetadata < 10 > , 100 > ) <nl> - - > Args ( { 0 , 0 } ) ; <nl> - <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , TCP ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , UDS ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , SockPair ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , InProcessCHTTP2 ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , TCP ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , UDS ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , SockPair ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , InProcessCHTTP2 ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - <nl> - static void TrickleArgs ( benchmark : : internal : : Benchmark * b ) { <nl> - for ( int i = 1 ; i < = 128 * 1024 * 1024 ; i * = 8 ) { <nl> - for ( int j = 1 ; j < = 128 * 1024 * 1024 ; j * = 8 ) { <nl> - double expected_time = <nl> - static_cast < double > ( 14 + i ) / ( 125 . 0 * static_cast < double > ( j ) ) ; <nl> - if ( expected_time > 0 . 01 ) continue ; <nl> - b - > Args ( { i , j } ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - BENCHMARK ( BM_PumpStreamServerToClient_Trickle ) - > Apply ( TrickleArgs ) ; <nl> - <nl> - / / Generate Args for StreamingPingPong benchmarks . Currently generates args for <nl> - / / only " small streams " ( i . e streams with 0 , 1 or 2 messages ) <nl> - static void StreamingPingPongArgs ( benchmark : : internal : : Benchmark * b ) { <nl> - int msg_size = 0 ; <nl> - <nl> - b - > Args ( { 0 , 0 } ) ; / / spl case : 0 ping - pong msgs ( msg_size doesn ' t matter here ) <nl> - <nl> - for ( msg_size = 0 ; msg_size < = 128 * 1024 * 1024 ; <nl> - msg_size = = 0 ? msg_size + + : msg_size * = 8 ) { <nl> - b - > Args ( { msg_size , 1 } ) ; <nl> - b - > Args ( { msg_size , 2 } ) ; <nl> - } <nl> - } <nl> - <nl> - BENCHMARK_TEMPLATE ( BM_StreamingPingPong , InProcessCHTTP2 , NoOpMutator , <nl> - NoOpMutator ) <nl> - - > Apply ( StreamingPingPongArgs ) ; <nl> - BENCHMARK_TEMPLATE ( BM_StreamingPingPong , TCP , NoOpMutator , NoOpMutator ) <nl> - - > Apply ( StreamingPingPongArgs ) ; <nl> - <nl> - BENCHMARK_TEMPLATE ( BM_StreamingPingPongMsgs , InProcessCHTTP2 , NoOpMutator , <nl> - NoOpMutator ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - BENCHMARK_TEMPLATE ( BM_StreamingPingPongMsgs , TCP , NoOpMutator , NoOpMutator ) <nl> - - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> - <nl> - } / / namespace testing <nl> - } / / namespace grpc <nl> - <nl> - BENCHMARK_MAIN ( ) ; <nl> new file mode 100644 <nl> index 00000000000 . . dc0e7d769ab <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . cc <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> + / * Benchmark gRPC end2end in various configurations * / <nl> + <nl> + # include < sstream > <nl> + <nl> + # include " src / core / lib / profiling / timers . h " <nl> + # include " src / cpp / client / create_channel_internal . h " <nl> + # include " src / proto / grpc / testing / echo . grpc . pb . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_context_mutators . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_fixtures . h " <nl> + # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> + <nl> + namespace grpc { <nl> + namespace testing { <nl> + <nl> + / / force library initialization <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * BENCHMARKING KERNELS <nl> + * / <nl> + <nl> + static void * tag ( intptr_t x ) { return reinterpret_cast < void * > ( x ) ; } <nl> + <nl> + template < class Fixture > <nl> + static void BM_PumpStreamClientToServer ( benchmark : : State & state ) { <nl> + EchoTestService : : AsyncService service ; <nl> + std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> + { <nl> + EchoRequest send_request ; <nl> + EchoRequest recv_request ; <nl> + if ( state . range ( 0 ) > 0 ) { <nl> + send_request . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> + } <nl> + Status recv_status ; <nl> + ServerContext svr_ctx ; <nl> + ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> + service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> + fixture - > cq ( ) , tag ( 0 ) ) ; <nl> + std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> + EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> + ClientContext cli_ctx ; <nl> + auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> + int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + void * t ; <nl> + bool ok ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + GPR_ASSERT ( ok ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + response_rw . Read ( & recv_request , tag ( 0 ) ) ; <nl> + while ( state . KeepRunning ( ) ) { <nl> + GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> + request_rw - > Write ( send_request , tag ( 1 ) ) ; <nl> + while ( true ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + if ( t = = tag ( 0 ) ) { <nl> + response_rw . Read ( & recv_request , tag ( 0 ) ) ; <nl> + } else if ( t = = tag ( 1 ) ) { <nl> + break ; <nl> + } else { <nl> + GPR_ASSERT ( false ) ; <nl> + } <nl> + } <nl> + } <nl> + request_rw - > WritesDone ( tag ( 1 ) ) ; <nl> + need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + } <nl> + fixture - > Finish ( state ) ; <nl> + fixture . reset ( ) ; <nl> + state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> + } <nl> + <nl> + template < class Fixture > <nl> + static void BM_PumpStreamServerToClient ( benchmark : : State & state ) { <nl> + EchoTestService : : AsyncService service ; <nl> + std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> + { <nl> + EchoResponse send_response ; <nl> + EchoResponse recv_response ; <nl> + if ( state . range ( 0 ) > 0 ) { <nl> + send_response . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> + } <nl> + Status recv_status ; <nl> + ServerContext svr_ctx ; <nl> + ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> + service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> + fixture - > cq ( ) , tag ( 0 ) ) ; <nl> + std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> + EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> + ClientContext cli_ctx ; <nl> + auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> + int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + void * t ; <nl> + bool ok ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + GPR_ASSERT ( ok ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> + while ( state . KeepRunning ( ) ) { <nl> + GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> + response_rw . Write ( send_response , tag ( 1 ) ) ; <nl> + while ( true ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + if ( t = = tag ( 0 ) ) { <nl> + request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> + } else if ( t = = tag ( 1 ) ) { <nl> + break ; <nl> + } else { <nl> + GPR_ASSERT ( false ) ; <nl> + } <nl> + } <nl> + } <nl> + response_rw . Finish ( Status : : OK , tag ( 1 ) ) ; <nl> + need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + } <nl> + fixture - > Finish ( state ) ; <nl> + fixture . reset ( ) ; <nl> + state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> + } <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * CONFIGURATIONS <nl> + * / <nl> + <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , TCP ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , UDS ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , SockPair ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , InProcessCHTTP2 ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , TCP ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , UDS ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , SockPair ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , InProcessCHTTP2 ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc <nl> + <nl> + BENCHMARK_MAIN ( ) ; <nl> new file mode 100644 <nl> index 00000000000 . . dc0e7d769ab <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / bm_fullstack_streaming_pump . cc <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> + / * Benchmark gRPC end2end in various configurations * / <nl> + <nl> + # include < sstream > <nl> + <nl> + # include " src / core / lib / profiling / timers . h " <nl> + # include " src / cpp / client / create_channel_internal . h " <nl> + # include " src / proto / grpc / testing / echo . grpc . pb . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_context_mutators . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_fixtures . h " <nl> + # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> + <nl> + namespace grpc { <nl> + namespace testing { <nl> + <nl> + / / force library initialization <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * BENCHMARKING KERNELS <nl> + * / <nl> + <nl> + static void * tag ( intptr_t x ) { return reinterpret_cast < void * > ( x ) ; } <nl> + <nl> + template < class Fixture > <nl> + static void BM_PumpStreamClientToServer ( benchmark : : State & state ) { <nl> + EchoTestService : : AsyncService service ; <nl> + std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> + { <nl> + EchoRequest send_request ; <nl> + EchoRequest recv_request ; <nl> + if ( state . range ( 0 ) > 0 ) { <nl> + send_request . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> + } <nl> + Status recv_status ; <nl> + ServerContext svr_ctx ; <nl> + ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> + service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> + fixture - > cq ( ) , tag ( 0 ) ) ; <nl> + std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> + EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> + ClientContext cli_ctx ; <nl> + auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> + int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + void * t ; <nl> + bool ok ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + GPR_ASSERT ( ok ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + response_rw . Read ( & recv_request , tag ( 0 ) ) ; <nl> + while ( state . KeepRunning ( ) ) { <nl> + GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> + request_rw - > Write ( send_request , tag ( 1 ) ) ; <nl> + while ( true ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + if ( t = = tag ( 0 ) ) { <nl> + response_rw . Read ( & recv_request , tag ( 0 ) ) ; <nl> + } else if ( t = = tag ( 1 ) ) { <nl> + break ; <nl> + } else { <nl> + GPR_ASSERT ( false ) ; <nl> + } <nl> + } <nl> + } <nl> + request_rw - > WritesDone ( tag ( 1 ) ) ; <nl> + need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + } <nl> + fixture - > Finish ( state ) ; <nl> + fixture . reset ( ) ; <nl> + state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> + } <nl> + <nl> + template < class Fixture > <nl> + static void BM_PumpStreamServerToClient ( benchmark : : State & state ) { <nl> + EchoTestService : : AsyncService service ; <nl> + std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> + { <nl> + EchoResponse send_response ; <nl> + EchoResponse recv_response ; <nl> + if ( state . range ( 0 ) > 0 ) { <nl> + send_response . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> + } <nl> + Status recv_status ; <nl> + ServerContext svr_ctx ; <nl> + ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> + service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> + fixture - > cq ( ) , tag ( 0 ) ) ; <nl> + std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> + EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> + ClientContext cli_ctx ; <nl> + auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> + int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + void * t ; <nl> + bool ok ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + GPR_ASSERT ( ok ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> + while ( state . KeepRunning ( ) ) { <nl> + GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> + response_rw . Write ( send_response , tag ( 1 ) ) ; <nl> + while ( true ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + if ( t = = tag ( 0 ) ) { <nl> + request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> + } else if ( t = = tag ( 1 ) ) { <nl> + break ; <nl> + } else { <nl> + GPR_ASSERT ( false ) ; <nl> + } <nl> + } <nl> + } <nl> + response_rw . Finish ( Status : : OK , tag ( 1 ) ) ; <nl> + need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + while ( need_tags ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + } <nl> + fixture - > Finish ( state ) ; <nl> + fixture . reset ( ) ; <nl> + state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> + } <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * CONFIGURATIONS <nl> + * / <nl> + <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , TCP ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , UDS ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , SockPair ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamClientToServer , InProcessCHTTP2 ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , TCP ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , UDS ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , SockPair ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + BENCHMARK_TEMPLATE ( BM_PumpStreamServerToClient , InProcessCHTTP2 ) <nl> + - > Range ( 0 , 128 * 1024 * 1024 ) ; <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc <nl> + <nl> + BENCHMARK_MAIN ( ) ; <nl> new file mode 100644 <nl> index 00000000000 . . 5011f06368e <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / bm_fullstack_trickle . cc <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> + / * Benchmark gRPC end2end in various configurations * / <nl> + <nl> + # include " src / core / lib / profiling / timers . h " <nl> + # include " src / cpp / client / create_channel_internal . h " <nl> + # include " src / proto / grpc / testing / echo . grpc . pb . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_context_mutators . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_fixtures . h " <nl> + # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> + extern " C " { <nl> + # include " src / core / ext / transport / chttp2 / transport / chttp2_transport . h " <nl> + # include " src / core / ext / transport / chttp2 / transport / internal . h " <nl> + # include " test / core / util / trickle_endpoint . h " <nl> + } <nl> + <nl> + namespace grpc { <nl> + namespace testing { <nl> + <nl> + static void * tag ( intptr_t x ) { return reinterpret_cast < void * > ( x ) ; } <nl> + <nl> + class TrickledCHTTP2 : public EndpointPairFixture { <nl> + public : <nl> + TrickledCHTTP2 ( Service * service , size_t megabits_per_second ) <nl> + : EndpointPairFixture ( service , MakeEndpoints ( megabits_per_second ) ) { } <nl> + <nl> + void AddToLabel ( std : : ostream & out , benchmark : : State & state ) { <nl> + out < < " writes / iter : " <nl> + < < ( ( double ) stats_ . num_writes / ( double ) state . iterations ( ) ) <nl> + < < " cli_transport_stalls / iter : " <nl> + < < ( ( double ) <nl> + client_stats_ . streams_stalled_due_to_transport_flow_control / <nl> + ( double ) state . iterations ( ) ) <nl> + < < " cli_stream_stalls / iter : " <nl> + < < ( ( double ) client_stats_ . streams_stalled_due_to_stream_flow_control / <nl> + ( double ) state . iterations ( ) ) <nl> + < < " svr_transport_stalls / iter : " <nl> + < < ( ( double ) <nl> + server_stats_ . streams_stalled_due_to_transport_flow_control / <nl> + ( double ) state . iterations ( ) ) <nl> + < < " svr_stream_stalls / iter : " <nl> + < < ( ( double ) server_stats_ . streams_stalled_due_to_stream_flow_control / <nl> + ( double ) state . iterations ( ) ) ; <nl> + } <nl> + <nl> + void Step ( ) { <nl> + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> + size_t client_backlog = <nl> + grpc_trickle_endpoint_trickle ( & exec_ctx , endpoint_pair_ . client ) ; <nl> + size_t server_backlog = <nl> + grpc_trickle_endpoint_trickle ( & exec_ctx , endpoint_pair_ . server ) ; <nl> + grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + <nl> + UpdateStats ( ( grpc_chttp2_transport * ) client_transport_ , & client_stats_ , <nl> + client_backlog ) ; <nl> + UpdateStats ( ( grpc_chttp2_transport * ) server_transport_ , & server_stats_ , <nl> + server_backlog ) ; <nl> + } <nl> + <nl> + private : <nl> + grpc_passthru_endpoint_stats stats_ ; <nl> + struct Stats { <nl> + int streams_stalled_due_to_stream_flow_control = 0 ; <nl> + int streams_stalled_due_to_transport_flow_control = 0 ; <nl> + } ; <nl> + Stats client_stats_ ; <nl> + Stats server_stats_ ; <nl> + <nl> + grpc_endpoint_pair MakeEndpoints ( size_t kilobits ) { <nl> + grpc_endpoint_pair p ; <nl> + grpc_passthru_endpoint_create ( & p . client , & p . server , Library : : get ( ) . rq ( ) , <nl> + & stats_ ) ; <nl> + double bytes_per_second = 125 . 0 * kilobits ; <nl> + p . client = grpc_trickle_endpoint_create ( p . client , bytes_per_second ) ; <nl> + p . server = grpc_trickle_endpoint_create ( p . server , bytes_per_second ) ; <nl> + return p ; <nl> + } <nl> + <nl> + void UpdateStats ( grpc_chttp2_transport * t , Stats * s , size_t backlog ) { <nl> + if ( backlog = = 0 ) { <nl> + if ( t - > lists [ GRPC_CHTTP2_LIST_STALLED_BY_STREAM ] . head ! = NULL ) { <nl> + s - > streams_stalled_due_to_stream_flow_control + + ; <nl> + } <nl> + if ( t - > lists [ GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT ] . head ! = NULL ) { <nl> + s - > streams_stalled_due_to_transport_flow_control + + ; <nl> + } <nl> + } <nl> + } <nl> + } ; <nl> + <nl> + / / force library initialization <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> + <nl> + static void TrickleCQNext ( TrickledCHTTP2 * fixture , void * * t , bool * ok ) { <nl> + while ( true ) { <nl> + switch ( fixture - > cq ( ) - > AsyncNext ( <nl> + t , ok , gpr_time_add ( gpr_now ( GPR_CLOCK_MONOTONIC ) , <nl> + gpr_time_from_micros ( 100 , GPR_TIMESPAN ) ) ) ) { <nl> + case CompletionQueue : : TIMEOUT : <nl> + fixture - > Step ( ) ; <nl> + break ; <nl> + case CompletionQueue : : SHUTDOWN : <nl> + GPR_ASSERT ( false ) ; <nl> + break ; <nl> + case CompletionQueue : : GOT_EVENT : <nl> + return ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + static void BM_PumpStreamServerToClient_Trickle ( benchmark : : State & state ) { <nl> + EchoTestService : : AsyncService service ; <nl> + std : : unique_ptr < TrickledCHTTP2 > fixture ( <nl> + new TrickledCHTTP2 ( & service , state . range ( 1 ) ) ) ; <nl> + { <nl> + EchoResponse send_response ; <nl> + EchoResponse recv_response ; <nl> + if ( state . range ( 0 ) > 0 ) { <nl> + send_response . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> + } <nl> + Status recv_status ; <nl> + ServerContext svr_ctx ; <nl> + ServerAsyncReaderWriter < EchoResponse , EchoRequest > response_rw ( & svr_ctx ) ; <nl> + service . RequestBidiStream ( & svr_ctx , & response_rw , fixture - > cq ( ) , <nl> + fixture - > cq ( ) , tag ( 0 ) ) ; <nl> + std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> + EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> + ClientContext cli_ctx ; <nl> + auto request_rw = stub - > AsyncBidiStream ( & cli_ctx , fixture - > cq ( ) , tag ( 1 ) ) ; <nl> + int need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + void * t ; <nl> + bool ok ; <nl> + while ( need_tags ) { <nl> + TrickleCQNext ( fixture . get ( ) , & t , & ok ) ; <nl> + GPR_ASSERT ( ok ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> + while ( state . KeepRunning ( ) ) { <nl> + GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> + response_rw . Write ( send_response , tag ( 1 ) ) ; <nl> + while ( true ) { <nl> + TrickleCQNext ( fixture . get ( ) , & t , & ok ) ; <nl> + if ( t = = tag ( 0 ) ) { <nl> + request_rw - > Read ( & recv_response , tag ( 0 ) ) ; <nl> + } else if ( t = = tag ( 1 ) ) { <nl> + break ; <nl> + } else { <nl> + GPR_ASSERT ( false ) ; <nl> + } <nl> + } <nl> + } <nl> + response_rw . Finish ( Status : : OK , tag ( 1 ) ) ; <nl> + need_tags = ( 1 < < 0 ) | ( 1 < < 1 ) ; <nl> + while ( need_tags ) { <nl> + TrickleCQNext ( fixture . get ( ) , & t , & ok ) ; <nl> + int i = ( int ) ( intptr_t ) t ; <nl> + GPR_ASSERT ( need_tags & ( 1 < < i ) ) ; <nl> + need_tags & = ~ ( 1 < < i ) ; <nl> + } <nl> + } <nl> + fixture - > Finish ( state ) ; <nl> + fixture . reset ( ) ; <nl> + state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) ) ; <nl> + } <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * CONFIGURATIONS <nl> + * / <nl> + <nl> + static void TrickleArgs ( benchmark : : internal : : Benchmark * b ) { <nl> + for ( int i = 1 ; i < = 128 * 1024 * 1024 ; i * = 8 ) { <nl> + for ( int j = 1 ; j < = 128 * 1024 * 1024 ; j * = 8 ) { <nl> + double expected_time = <nl> + static_cast < double > ( 14 + i ) / ( 125 . 0 * static_cast < double > ( j ) ) ; <nl> + if ( expected_time > 0 . 01 ) continue ; <nl> + b - > Args ( { i , j } ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + BENCHMARK ( BM_PumpStreamServerToClient_Trickle ) - > Apply ( TrickleArgs ) ; <nl> + } <nl> + } <nl> + <nl> + BENCHMARK_MAIN ( ) ; <nl> new file mode 100644 <nl> index 00000000000 . . e51d272b104 <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . cc <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> + / * Benchmark gRPC end2end in various configurations * / <nl> + <nl> + # include < sstream > <nl> + <nl> + # include " src / core / lib / profiling / timers . h " <nl> + # include " src / cpp / client / create_channel_internal . h " <nl> + # include " src / proto / grpc / testing / echo . grpc . pb . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_context_mutators . h " <nl> + # include " test / cpp / microbenchmarks / fullstack_fixtures . h " <nl> + # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> + <nl> + namespace grpc { <nl> + namespace testing { <nl> + <nl> + / / force library initialization <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * BENCHMARKING KERNELS <nl> + * / <nl> + <nl> + static void * tag ( intptr_t x ) { return reinterpret_cast < void * > ( x ) ; } <nl> + <nl> + template < class Fixture , class ClientContextMutator , class ServerContextMutator > <nl> + static void BM_UnaryPingPong ( benchmark : : State & state ) { <nl> + EchoTestService : : AsyncService service ; <nl> + std : : unique_ptr < Fixture > fixture ( new Fixture ( & service ) ) ; <nl> + EchoRequest send_request ; <nl> + EchoResponse send_response ; <nl> + EchoResponse recv_response ; <nl> + if ( state . range ( 0 ) > 0 ) { <nl> + send_request . set_message ( std : : string ( state . range ( 0 ) , ' a ' ) ) ; <nl> + } <nl> + if ( state . range ( 1 ) > 0 ) { <nl> + send_response . set_message ( std : : string ( state . range ( 1 ) , ' a ' ) ) ; <nl> + } <nl> + Status recv_status ; <nl> + struct ServerEnv { <nl> + ServerContext ctx ; <nl> + EchoRequest recv_request ; <nl> + grpc : : ServerAsyncResponseWriter < EchoResponse > response_writer ; <nl> + ServerEnv ( ) : response_writer ( & ctx ) { } <nl> + } ; <nl> + uint8_t server_env_buffer [ 2 * sizeof ( ServerEnv ) ] ; <nl> + ServerEnv * server_env [ 2 ] = { <nl> + reinterpret_cast < ServerEnv * > ( server_env_buffer ) , <nl> + reinterpret_cast < ServerEnv * > ( server_env_buffer + sizeof ( ServerEnv ) ) } ; <nl> + new ( server_env [ 0 ] ) ServerEnv ; <nl> + new ( server_env [ 1 ] ) ServerEnv ; <nl> + service . RequestEcho ( & server_env [ 0 ] - > ctx , & server_env [ 0 ] - > recv_request , <nl> + & server_env [ 0 ] - > response_writer , fixture - > cq ( ) , <nl> + fixture - > cq ( ) , tag ( 0 ) ) ; <nl> + service . RequestEcho ( & server_env [ 1 ] - > ctx , & server_env [ 1 ] - > recv_request , <nl> + & server_env [ 1 ] - > response_writer , fixture - > cq ( ) , <nl> + fixture - > cq ( ) , tag ( 1 ) ) ; <nl> + std : : unique_ptr < EchoTestService : : Stub > stub ( <nl> + EchoTestService : : NewStub ( fixture - > channel ( ) ) ) ; <nl> + while ( state . KeepRunning ( ) ) { <nl> + GPR_TIMER_SCOPE ( " BenchmarkCycle " , 0 ) ; <nl> + recv_response . Clear ( ) ; <nl> + ClientContext cli_ctx ; <nl> + ClientContextMutator cli_ctx_mut ( & cli_ctx ) ; <nl> + std : : unique_ptr < ClientAsyncResponseReader < EchoResponse > > response_reader ( <nl> + stub - > AsyncEcho ( & cli_ctx , send_request , fixture - > cq ( ) ) ) ; <nl> + void * t ; <nl> + bool ok ; <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + GPR_ASSERT ( ok ) ; <nl> + GPR_ASSERT ( t = = tag ( 0 ) | | t = = tag ( 1 ) ) ; <nl> + intptr_t slot = reinterpret_cast < intptr_t > ( t ) ; <nl> + ServerEnv * senv = server_env [ slot ] ; <nl> + ServerContextMutator svr_ctx_mut ( & senv - > ctx ) ; <nl> + senv - > response_writer . Finish ( send_response , Status : : OK , tag ( 3 ) ) ; <nl> + response_reader - > Finish ( & recv_response , & recv_status , tag ( 4 ) ) ; <nl> + for ( int i = ( 1 < < 3 ) | ( 1 < < 4 ) ; i ! = 0 ; ) { <nl> + GPR_ASSERT ( fixture - > cq ( ) - > Next ( & t , & ok ) ) ; <nl> + GPR_ASSERT ( ok ) ; <nl> + int tagnum = ( int ) reinterpret_cast < intptr_t > ( t ) ; <nl> + GPR_ASSERT ( i & ( 1 < < tagnum ) ) ; <nl> + i - = 1 < < tagnum ; <nl> + } <nl> + GPR_ASSERT ( recv_status . ok ( ) ) ; <nl> + <nl> + senv - > ~ ServerEnv ( ) ; <nl> + senv = new ( senv ) ServerEnv ( ) ; <nl> + service . RequestEcho ( & senv - > ctx , & senv - > recv_request , & senv - > response_writer , <nl> + fixture - > cq ( ) , fixture - > cq ( ) , tag ( slot ) ) ; <nl> + } <nl> + fixture - > Finish ( state ) ; <nl> + fixture . reset ( ) ; <nl> + server_env [ 0 ] - > ~ ServerEnv ( ) ; <nl> + server_env [ 1 ] - > ~ ServerEnv ( ) ; <nl> + state . SetBytesProcessed ( state . range ( 0 ) * state . iterations ( ) + <nl> + state . range ( 1 ) * state . iterations ( ) ) ; <nl> + } <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * CONFIGURATIONS <nl> + * / <nl> + <nl> + static void SweepSizesArgs ( benchmark : : internal : : Benchmark * b ) { <nl> + b - > Args ( { 0 , 0 } ) ; <nl> + for ( int i = 1 ; i < = 128 * 1024 * 1024 ; i * = 8 ) { <nl> + b - > Args ( { i , 0 } ) ; <nl> + b - > Args ( { 0 , i } ) ; <nl> + b - > Args ( { i , i } ) ; <nl> + } <nl> + } <nl> + <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , TCP , NoOpMutator , NoOpMutator ) <nl> + - > Apply ( SweepSizesArgs ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , UDS , NoOpMutator , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , SockPair , NoOpMutator , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , NoOpMutator ) <nl> + - > Apply ( SweepSizesArgs ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomBinaryMetadata < 10 > , 1 > , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomBinaryMetadata < 31 > , 1 > , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomBinaryMetadata < 100 > , 1 > , <nl> + NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomBinaryMetadata < 10 > , 2 > , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomBinaryMetadata < 31 > , 2 > , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomBinaryMetadata < 100 > , 2 > , <nl> + NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> + Server_AddInitialMetadata < RandomBinaryMetadata < 10 > , 1 > ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> + Server_AddInitialMetadata < RandomBinaryMetadata < 31 > , 1 > ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> + Server_AddInitialMetadata < RandomBinaryMetadata < 100 > , 1 > ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomAsciiMetadata < 10 > , 1 > , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomAsciiMetadata < 31 > , 1 > , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , <nl> + Client_AddMetadata < RandomAsciiMetadata < 100 > , 1 > , NoOpMutator ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> + Server_AddInitialMetadata < RandomAsciiMetadata < 10 > , 1 > ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> + Server_AddInitialMetadata < RandomAsciiMetadata < 31 > , 1 > ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> + Server_AddInitialMetadata < RandomAsciiMetadata < 100 > , 1 > ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + BENCHMARK_TEMPLATE ( BM_UnaryPingPong , InProcessCHTTP2 , NoOpMutator , <nl> + Server_AddInitialMetadata < RandomAsciiMetadata < 10 > , 100 > ) <nl> + - > Args ( { 0 , 0 } ) ; <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc <nl> + <nl> + BENCHMARK_MAIN ( ) ; <nl> mmm a / test / cpp / microbenchmarks / bm_metadata . cc <nl> ppp b / test / cpp / microbenchmarks / bm_metadata . cc <nl> extern " C " { <nl> # include " src / core / lib / transport / transport . h " <nl> } <nl> <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> <nl> - static class InitializeStuff { <nl> - public : <nl> - InitializeStuff ( ) { grpc_init ( ) ; } <nl> - ~ InitializeStuff ( ) { grpc_shutdown ( ) ; } <nl> - } initialize_stuff ; <nl> + auto & force_library_initialization = Library : : get ( ) ; <nl> <nl> static void BM_SliceFromStatic ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> benchmark : : DoNotOptimize ( grpc_slice_from_static_string ( " abc " ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_SliceFromStatic ) ; <nl> <nl> static void BM_SliceFromCopied ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_slice_unref ( grpc_slice_from_copied_string ( " abc " ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_SliceFromCopied ) ; <nl> <nl> static void BM_SliceFromStreamOwnedBuffer ( benchmark : : State & state ) { <nl> BENCHMARK ( BM_SliceFromStreamOwnedBuffer ) ; <nl> <nl> static void BM_SliceIntern ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice slice = grpc_slice_from_static_string ( " abc " ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_slice_unref ( grpc_slice_intern ( slice ) ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_SliceIntern ) ; <nl> <nl> static void BM_SliceReIntern ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice slice = grpc_slice_intern ( grpc_slice_from_static_string ( " abc " ) ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_slice_unref ( grpc_slice_intern ( slice ) ) ; <nl> } <nl> grpc_slice_unref ( slice ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_SliceReIntern ) ; <nl> <nl> static void BM_SliceInternStaticMetadata ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_slice_intern ( GRPC_MDSTR_GZIP ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_SliceInternStaticMetadata ) ; <nl> <nl> static void BM_SliceInternEqualToStaticMetadata ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice slice = grpc_slice_from_static_string ( " gzip " ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> grpc_slice_intern ( slice ) ; <nl> } <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_SliceInternEqualToStaticMetadata ) ; <nl> <nl> static void BM_MetadataFromNonInternedSlices ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = grpc_slice_from_static_string ( " key " ) ; <nl> gpr_slice v = grpc_slice_from_static_string ( " value " ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_MetadataFromNonInternedSlices ( benchmark : : State & state ) { <nl> GRPC_MDELEM_UNREF ( & exec_ctx , grpc_mdelem_create ( & exec_ctx , k , v , NULL ) ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromNonInternedSlices ) ; <nl> <nl> static void BM_MetadataFromInternedSlices ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = grpc_slice_intern ( grpc_slice_from_static_string ( " key " ) ) ; <nl> gpr_slice v = grpc_slice_intern ( grpc_slice_from_static_string ( " value " ) ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_MetadataFromInternedSlices ( benchmark : : State & state ) { <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_slice_unref ( k ) ; <nl> grpc_slice_unref ( v ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromInternedSlices ) ; <nl> <nl> static void BM_MetadataFromInternedSlicesAlreadyInIndex ( <nl> benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = grpc_slice_intern ( grpc_slice_from_static_string ( " key " ) ) ; <nl> gpr_slice v = grpc_slice_intern ( grpc_slice_from_static_string ( " value " ) ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_MetadataFromInternedSlicesAlreadyInIndex ( <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_slice_unref ( k ) ; <nl> grpc_slice_unref ( v ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromInternedSlicesAlreadyInIndex ) ; <nl> <nl> static void BM_MetadataFromInternedKey ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = grpc_slice_intern ( grpc_slice_from_static_string ( " key " ) ) ; <nl> gpr_slice v = grpc_slice_from_static_string ( " value " ) ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_MetadataFromInternedKey ( benchmark : : State & state ) { <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_slice_unref ( k ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromInternedKey ) ; <nl> <nl> static void BM_MetadataFromNonInternedSlicesWithBackingStore ( <nl> benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = grpc_slice_from_static_string ( " key " ) ; <nl> gpr_slice v = grpc_slice_from_static_string ( " value " ) ; <nl> char backing_store [ sizeof ( grpc_mdelem_data ) ] ; <nl> static void BM_MetadataFromNonInternedSlicesWithBackingStore ( <nl> reinterpret_cast < grpc_mdelem_data * > ( backing_store ) ) ) ; <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromNonInternedSlicesWithBackingStore ) ; <nl> <nl> static void BM_MetadataFromInternedSlicesWithBackingStore ( <nl> benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = grpc_slice_intern ( grpc_slice_from_static_string ( " key " ) ) ; <nl> gpr_slice v = grpc_slice_intern ( grpc_slice_from_static_string ( " value " ) ) ; <nl> char backing_store [ sizeof ( grpc_mdelem_data ) ] ; <nl> static void BM_MetadataFromInternedSlicesWithBackingStore ( <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_slice_unref ( k ) ; <nl> grpc_slice_unref ( v ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromInternedSlicesWithBackingStore ) ; <nl> <nl> static void BM_MetadataFromInternedKeyWithBackingStore ( <nl> benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = grpc_slice_intern ( grpc_slice_from_static_string ( " key " ) ) ; <nl> gpr_slice v = grpc_slice_from_static_string ( " value " ) ; <nl> char backing_store [ sizeof ( grpc_mdelem_data ) ] ; <nl> static void BM_MetadataFromInternedKeyWithBackingStore ( <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_slice_unref ( k ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromInternedKeyWithBackingStore ) ; <nl> <nl> static void BM_MetadataFromStaticMetadataStrings ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = GRPC_MDSTR_STATUS ; <nl> gpr_slice v = GRPC_MDSTR_200 ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_MetadataFromStaticMetadataStrings ( benchmark : : State & state ) { <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_slice_unref ( k ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromStaticMetadataStrings ) ; <nl> <nl> static void BM_MetadataFromStaticMetadataStringsNotIndexed ( <nl> benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> gpr_slice k = GRPC_MDSTR_STATUS ; <nl> gpr_slice v = GRPC_MDSTR_GZIP ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> static void BM_MetadataFromStaticMetadataStringsNotIndexed ( <nl> } <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_slice_unref ( k ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataFromStaticMetadataStringsNotIndexed ) ; <nl> <nl> static void BM_MetadataRefUnrefExternal ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> char backing_store [ sizeof ( grpc_mdelem_data ) ] ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_mdelem el = <nl> static void BM_MetadataRefUnrefExternal ( benchmark : : State & state ) { <nl> } <nl> GRPC_MDELEM_UNREF ( & exec_ctx , el ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataRefUnrefExternal ) ; <nl> <nl> static void BM_MetadataRefUnrefInterned ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> char backing_store [ sizeof ( grpc_mdelem_data ) ] ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> gpr_slice k = grpc_slice_intern ( grpc_slice_from_static_string ( " key " ) ) ; <nl> static void BM_MetadataRefUnrefInterned ( benchmark : : State & state ) { <nl> } <nl> GRPC_MDELEM_UNREF ( & exec_ctx , el ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataRefUnrefInterned ) ; <nl> <nl> static void BM_MetadataRefUnrefAllocated ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_mdelem el = <nl> grpc_mdelem_create ( & exec_ctx , grpc_slice_from_static_string ( " a " ) , <nl> static void BM_MetadataRefUnrefAllocated ( benchmark : : State & state ) { <nl> } <nl> GRPC_MDELEM_UNREF ( & exec_ctx , el ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataRefUnrefAllocated ) ; <nl> <nl> static void BM_MetadataRefUnrefStatic ( benchmark : : State & state ) { <nl> + TrackCounters track_counters ; <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> grpc_mdelem el = <nl> grpc_mdelem_create ( & exec_ctx , GRPC_MDSTR_STATUS , GRPC_MDSTR_200 , NULL ) ; <nl> static void BM_MetadataRefUnrefStatic ( benchmark : : State & state ) { <nl> } <nl> GRPC_MDELEM_UNREF ( & exec_ctx , el ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + track_counters . Finish ( state ) ; <nl> } <nl> BENCHMARK ( BM_MetadataRefUnrefStatic ) ; <nl> <nl> new file mode 100644 <nl> index 00000000000 . . 676f9aa1cc6 <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / fullstack_context_mutators . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2017 , 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 TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H <nl> + # define TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H <nl> + <nl> + # include < grpc + + / channel . h > <nl> + # include < grpc + + / create_channel . h > <nl> + # include < grpc + + / security / credentials . h > <nl> + # include < grpc + + / security / server_credentials . h > <nl> + # include < grpc + + / server . h > <nl> + # include < grpc + + / server_builder . h > <nl> + # include < grpc + + / server_context . h > <nl> + # include < grpc / support / log . h > <nl> + <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> + <nl> + namespace grpc { <nl> + namespace testing { <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * CONTEXT MUTATORS <nl> + * / <nl> + <nl> + static const int kPregenerateKeyCount = 100000 ; <nl> + <nl> + template < class F > <nl> + auto MakeVector ( size_t length , F f ) - > std : : vector < decltype ( f ( ) ) > { <nl> + std : : vector < decltype ( f ( ) ) > out ; <nl> + out . reserve ( length ) ; <nl> + for ( size_t i = 0 ; i < length ; i + + ) { <nl> + out . push_back ( f ( ) ) ; <nl> + } <nl> + return out ; <nl> + } <nl> + <nl> + class NoOpMutator { <nl> + public : <nl> + template < class ContextType > <nl> + NoOpMutator ( ContextType * context ) { } <nl> + } ; <nl> + <nl> + template < int length > <nl> + class RandomBinaryMetadata { <nl> + public : <nl> + static const grpc : : string & Key ( ) { return kKey ; } <nl> + <nl> + static const grpc : : string & Value ( ) { <nl> + return kValues [ rand ( ) % kValues . size ( ) ] ; <nl> + } <nl> + <nl> + private : <nl> + static const grpc : : string kKey ; <nl> + static const std : : vector < grpc : : string > kValues ; <nl> + <nl> + static grpc : : string GenerateOneString ( ) { <nl> + grpc : : string s ; <nl> + s . reserve ( length + 1 ) ; <nl> + for ( int i = 0 ; i < length ; i + + ) { <nl> + s + = ( char ) rand ( ) ; <nl> + } <nl> + return s ; <nl> + } <nl> + } ; <nl> + <nl> + template < int length > <nl> + class RandomAsciiMetadata { <nl> + public : <nl> + static const grpc : : string & Key ( ) { return kKey ; } <nl> + <nl> + static const grpc : : string & Value ( ) { <nl> + return kValues [ rand ( ) % kValues . size ( ) ] ; <nl> + } <nl> + <nl> + private : <nl> + static const grpc : : string kKey ; <nl> + static const std : : vector < grpc : : string > kValues ; <nl> + <nl> + static grpc : : string GenerateOneString ( ) { <nl> + grpc : : string s ; <nl> + s . reserve ( length + 1 ) ; <nl> + for ( int i = 0 ; i < length ; i + + ) { <nl> + s + = ( char ) ( rand ( ) % 26 + ' a ' ) ; <nl> + } <nl> + return s ; <nl> + } <nl> + } ; <nl> + <nl> + template < class Generator , int kNumKeys > <nl> + class Client_AddMetadata : public NoOpMutator { <nl> + public : <nl> + Client_AddMetadata ( ClientContext * context ) : NoOpMutator ( context ) { <nl> + for ( int i = 0 ; i < kNumKeys ; i + + ) { <nl> + context - > AddMetadata ( Generator : : Key ( ) , Generator : : Value ( ) ) ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> + template < class Generator , int kNumKeys > <nl> + class Server_AddInitialMetadata : public NoOpMutator { <nl> + public : <nl> + Server_AddInitialMetadata ( ServerContext * context ) : NoOpMutator ( context ) { <nl> + for ( int i = 0 ; i < kNumKeys ; i + + ) { <nl> + context - > AddInitialMetadata ( Generator : : Key ( ) , Generator : : Value ( ) ) ; <nl> + } <nl> + } <nl> + } ; <nl> + <nl> + / / static initialization <nl> + <nl> + template < int length > <nl> + const grpc : : string RandomBinaryMetadata < length > : : kKey = " foo - bin " ; <nl> + <nl> + template < int length > <nl> + const std : : vector < grpc : : string > RandomBinaryMetadata < length > : : kValues = <nl> + MakeVector ( kPregenerateKeyCount , GenerateOneString ) ; <nl> + <nl> + template < int length > <nl> + const grpc : : string RandomAsciiMetadata < length > : : kKey = " foo " ; <nl> + <nl> + template < int length > <nl> + const std : : vector < grpc : : string > RandomAsciiMetadata < length > : : kValues = <nl> + MakeVector ( kPregenerateKeyCount , GenerateOneString ) ; <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc <nl> + <nl> + # endif <nl> new file mode 100644 <nl> index 00000000000 . . dc297010599 <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / fullstack_fixtures . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2017 , 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 TEST_CPP_MICROBENCHMARKS_FULLSTACK_FIXTURES_H <nl> + # define TEST_CPP_MICROBENCHMARKS_FULLSTACK_FIXTURES_H <nl> + <nl> + # include < grpc + + / channel . h > <nl> + # include < grpc + + / create_channel . h > <nl> + # include < grpc + + / security / credentials . h > <nl> + # include < grpc + + / security / server_credentials . h > <nl> + # include < grpc + + / server . h > <nl> + # include < grpc + + / server_builder . h > <nl> + # include < grpc / support / log . h > <nl> + <nl> + extern " C " { <nl> + # include " src / core / ext / transport / chttp2 / transport / chttp2_transport . h " <nl> + # include " src / core / lib / channel / channel_args . h " <nl> + # include " src / core / lib / iomgr / endpoint . h " <nl> + # include " src / core / lib / iomgr / endpoint_pair . h " <nl> + # include " src / core / lib / iomgr / exec_ctx . h " <nl> + # include " src / core / lib / iomgr / tcp_posix . h " <nl> + # include " src / core / lib / surface / channel . h " <nl> + # include " src / core / lib / surface / completion_queue . h " <nl> + # include " src / core / lib / surface / server . h " <nl> + # include " test / core / util / passthru_endpoint . h " <nl> + # include " test / core / util / port . h " <nl> + } <nl> + <nl> + # include " test / cpp / microbenchmarks / helpers . h " <nl> + <nl> + namespace grpc { <nl> + namespace testing { <nl> + <nl> + static void ApplyCommonServerBuilderConfig ( ServerBuilder * b ) { <nl> + b - > SetMaxReceiveMessageSize ( INT_MAX ) ; <nl> + b - > SetMaxSendMessageSize ( INT_MAX ) ; <nl> + } <nl> + <nl> + static void ApplyCommonChannelArguments ( ChannelArguments * c ) { <nl> + c - > SetInt ( GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH , INT_MAX ) ; <nl> + c - > SetInt ( GRPC_ARG_MAX_SEND_MESSAGE_LENGTH , INT_MAX ) ; <nl> + } <nl> + <nl> + class BaseFixture : public TrackCounters { } ; <nl> + <nl> + class FullstackFixture : public BaseFixture { <nl> + public : <nl> + FullstackFixture ( Service * service , const grpc : : string & address ) { <nl> + ServerBuilder b ; <nl> + b . AddListeningPort ( address , InsecureServerCredentials ( ) ) ; <nl> + cq_ = b . AddCompletionQueue ( true ) ; <nl> + b . RegisterService ( service ) ; <nl> + ApplyCommonServerBuilderConfig ( & b ) ; <nl> + server_ = b . BuildAndStart ( ) ; <nl> + ChannelArguments args ; <nl> + ApplyCommonChannelArguments ( & args ) ; <nl> + channel_ = CreateCustomChannel ( address , InsecureChannelCredentials ( ) , args ) ; <nl> + } <nl> + <nl> + virtual ~ FullstackFixture ( ) { <nl> + server_ - > Shutdown ( ) ; <nl> + cq_ - > Shutdown ( ) ; <nl> + void * tag ; <nl> + bool ok ; <nl> + while ( cq_ - > Next ( & tag , & ok ) ) { <nl> + } <nl> + } <nl> + <nl> + ServerCompletionQueue * cq ( ) { return cq_ . get ( ) ; } <nl> + std : : shared_ptr < Channel > channel ( ) { return channel_ ; } <nl> + <nl> + private : <nl> + std : : unique_ptr < Server > server_ ; <nl> + std : : unique_ptr < ServerCompletionQueue > cq_ ; <nl> + std : : shared_ptr < Channel > channel_ ; <nl> + } ; <nl> + <nl> + class TCP : public FullstackFixture { <nl> + public : <nl> + TCP ( Service * service ) : FullstackFixture ( service , MakeAddress ( ) ) { } <nl> + <nl> + private : <nl> + static grpc : : string MakeAddress ( ) { <nl> + int port = grpc_pick_unused_port_or_die ( ) ; <nl> + std : : stringstream addr ; <nl> + addr < < " localhost : " < < port ; <nl> + return addr . str ( ) ; <nl> + } <nl> + } ; <nl> + <nl> + class UDS : public FullstackFixture { <nl> + public : <nl> + UDS ( Service * service ) : FullstackFixture ( service , MakeAddress ( ) ) { } <nl> + <nl> + private : <nl> + static grpc : : string MakeAddress ( ) { <nl> + int port = grpc_pick_unused_port_or_die ( ) ; / / just for a unique id - not a <nl> + / / real port <nl> + std : : stringstream addr ; <nl> + addr < < " unix : / tmp / bm_fullstack . " < < port ; <nl> + return addr . str ( ) ; <nl> + } <nl> + } ; <nl> + <nl> + class EndpointPairFixture : public BaseFixture { <nl> + public : <nl> + EndpointPairFixture ( Service * service , grpc_endpoint_pair endpoints ) <nl> + : endpoint_pair_ ( endpoints ) { <nl> + ServerBuilder b ; <nl> + cq_ = b . AddCompletionQueue ( true ) ; <nl> + b . RegisterService ( service ) ; <nl> + ApplyCommonServerBuilderConfig ( & b ) ; <nl> + server_ = b . BuildAndStart ( ) ; <nl> + <nl> + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> + <nl> + / * add server endpoint to server_ <nl> + * * / <nl> + { <nl> + const grpc_channel_args * server_args = <nl> + grpc_server_get_channel_args ( server_ - > c_server ( ) ) ; <nl> + server_transport_ = grpc_create_chttp2_transport ( <nl> + & exec_ctx , server_args , endpoints . server , 0 / * is_client * / ) ; <nl> + <nl> + grpc_pollset * * pollsets ; <nl> + size_t num_pollsets = 0 ; <nl> + grpc_server_get_pollsets ( server_ - > c_server ( ) , & pollsets , & num_pollsets ) ; <nl> + <nl> + for ( size_t i = 0 ; i < num_pollsets ; i + + ) { <nl> + grpc_endpoint_add_to_pollset ( & exec_ctx , endpoints . server , pollsets [ i ] ) ; <nl> + } <nl> + <nl> + grpc_server_setup_transport ( & exec_ctx , server_ - > c_server ( ) , <nl> + server_transport_ , NULL , server_args ) ; <nl> + grpc_chttp2_transport_start_reading ( & exec_ctx , server_transport_ , NULL ) ; <nl> + } <nl> + <nl> + / * create channel * / <nl> + { <nl> + ChannelArguments args ; <nl> + args . SetString ( GRPC_ARG_DEFAULT_AUTHORITY , " test . authority " ) ; <nl> + ApplyCommonChannelArguments ( & args ) ; <nl> + <nl> + grpc_channel_args c_args = args . c_channel_args ( ) ; <nl> + client_transport_ = <nl> + grpc_create_chttp2_transport ( & exec_ctx , & c_args , endpoints . client , 1 ) ; <nl> + GPR_ASSERT ( client_transport_ ) ; <nl> + grpc_channel * channel = <nl> + grpc_channel_create ( & exec_ctx , " target " , & c_args , <nl> + GRPC_CLIENT_DIRECT_CHANNEL , client_transport_ ) ; <nl> + grpc_chttp2_transport_start_reading ( & exec_ctx , client_transport_ , NULL ) ; <nl> + <nl> + channel_ = CreateChannelInternal ( " " , channel ) ; <nl> + } <nl> + <nl> + grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + } <nl> + <nl> + virtual ~ EndpointPairFixture ( ) { <nl> + server_ - > Shutdown ( ) ; <nl> + cq_ - > Shutdown ( ) ; <nl> + void * tag ; <nl> + bool ok ; <nl> + while ( cq_ - > Next ( & tag , & ok ) ) { <nl> + } <nl> + } <nl> + <nl> + ServerCompletionQueue * cq ( ) { return cq_ . get ( ) ; } <nl> + std : : shared_ptr < Channel > channel ( ) { return channel_ ; } <nl> + <nl> + protected : <nl> + grpc_endpoint_pair endpoint_pair_ ; <nl> + grpc_transport * client_transport_ ; <nl> + grpc_transport * server_transport_ ; <nl> + <nl> + private : <nl> + std : : unique_ptr < Server > server_ ; <nl> + std : : unique_ptr < ServerCompletionQueue > cq_ ; <nl> + std : : shared_ptr < Channel > channel_ ; <nl> + } ; <nl> + <nl> + class SockPair : public EndpointPairFixture { <nl> + public : <nl> + SockPair ( Service * service ) <nl> + : EndpointPairFixture ( service , grpc_iomgr_create_endpoint_pair ( <nl> + " test " , Library : : get ( ) . rq ( ) , 8192 ) ) { } <nl> + } ; <nl> + <nl> + class InProcessCHTTP2 : public EndpointPairFixture { <nl> + public : <nl> + InProcessCHTTP2 ( Service * service ) <nl> + : EndpointPairFixture ( service , MakeEndpoints ( ) ) { } <nl> + <nl> + void AddToLabel ( std : : ostream & out , benchmark : : State & state ) { <nl> + EndpointPairFixture : : AddToLabel ( out , state ) ; <nl> + out < < " writes / iter : " <nl> + < < ( ( double ) stats_ . num_writes / ( double ) state . iterations ( ) ) ; <nl> + } <nl> + <nl> + private : <nl> + grpc_passthru_endpoint_stats stats_ ; <nl> + <nl> + grpc_endpoint_pair MakeEndpoints ( ) { <nl> + grpc_endpoint_pair p ; <nl> + grpc_passthru_endpoint_create ( & p . client , & p . server , Library : : get ( ) . rq ( ) , <nl> + & stats_ ) ; <nl> + return p ; <nl> + } <nl> + } ; <nl> + <nl> + } / / namespace testing <nl> + } / / namespace grpc <nl> + <nl> + # endif <nl> new file mode 100644 <nl> index 00000000000 . . 947e81ffd83 <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / helpers . cc <nl> <nl> + / * <nl> + * <nl> + * Copyright 2017 , 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 " test / cpp / microbenchmarks / helpers . h " <nl> + <nl> + void TrackCounters : : Finish ( benchmark : : State & state ) { <nl> + std : : ostringstream out ; <nl> + AddToLabel ( out , state ) ; <nl> + auto label = out . str ( ) ; <nl> + if ( label . length ( ) & & label [ 0 ] = = ' ' ) { <nl> + label = label . substr ( 1 ) ; <nl> + } <nl> + state . SetLabel ( label ) ; <nl> + } <nl> + <nl> + void TrackCounters : : AddToLabel ( std : : ostream & out , benchmark : : State & state ) { <nl> + # ifdef GPR_LOW_LEVEL_COUNTERS <nl> + out < < " locks / iter : " < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_mu_locks ) - <nl> + mu_locks_at_start_ ) / <nl> + ( double ) state . iterations ( ) ) <nl> + < < " atm_cas / iter : " <nl> + < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_counter_atm_cas ) - <nl> + atm_cas_at_start_ ) / <nl> + ( double ) state . iterations ( ) ) <nl> + < < " atm_add / iter : " <nl> + < < ( ( double ) ( gpr_atm_no_barrier_load ( & gpr_counter_atm_add ) - <nl> + atm_add_at_start_ ) / <nl> + ( double ) state . iterations ( ) ) ; <nl> + # endif <nl> + grpc_memory_counters counters_at_end = grpc_memory_counters_snapshot ( ) ; <nl> + out < < " allocs / iter : " <nl> + < < ( ( double ) ( counters_at_end . total_allocs_absolute - <nl> + counters_at_start_ . total_allocs_absolute ) / <nl> + ( double ) state . iterations ( ) ) ; <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 42a8fbaf0bf <nl> mmm / dev / null <nl> ppp b / test / cpp / microbenchmarks / helpers . h <nl> <nl> + / * <nl> + * <nl> + * Copyright 2017 , 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 TEST_CPP_MICROBENCHMARKS_COUNTERS_H <nl> + # define TEST_CPP_MICROBENCHMARKS_COUNTERS_H <nl> + <nl> + # include < sstream > <nl> + <nl> + extern " C " { <nl> + # include < grpc / support / port_platform . h > <nl> + # include " test / core / util / memory_counters . h " <nl> + } <nl> + <nl> + # include < grpc + + / impl / grpc_library . h > <nl> + # include " third_party / benchmark / include / benchmark / benchmark . h " <nl> + <nl> + class Library { <nl> + public : <nl> + static Library & get ( ) { <nl> + static Library lib ; <nl> + return lib ; <nl> + } <nl> + <nl> + grpc_resource_quota * rq ( ) { return rq_ ; } <nl> + <nl> + private : <nl> + Library ( ) { <nl> + grpc_memory_counters_init ( ) ; <nl> + init_lib_ . init ( ) ; <nl> + rq_ = grpc_resource_quota_create ( " bm " ) ; <nl> + } <nl> + <nl> + ~ Library ( ) { init_lib_ . shutdown ( ) ; } <nl> + <nl> + grpc : : internal : : GrpcLibrary init_lib_ ; <nl> + grpc_resource_quota * rq_ ; <nl> + } ; <nl> + <nl> + # ifdef GPR_LOW_LEVEL_COUNTERS <nl> + extern " C " gpr_atm gpr_mu_locks ; <nl> + extern " C " gpr_atm gpr_counter_atm_cas ; <nl> + extern " C " gpr_atm gpr_counter_atm_add ; <nl> + # endif <nl> + <nl> + class TrackCounters { <nl> + public : <nl> + virtual void Finish ( benchmark : : State & state ) ; <nl> + virtual void AddToLabel ( std : : ostream & out , benchmark : : State & state ) ; <nl> + <nl> + private : <nl> + # ifdef GPR_LOW_LEVEL_COUNTERS <nl> + const size_t mu_locks_at_start_ = gpr_atm_no_barrier_load ( & gpr_mu_locks ) ; <nl> + const size_t atm_cas_at_start_ = <nl> + gpr_atm_no_barrier_load ( & gpr_counter_atm_cas ) ; <nl> + const size_t atm_add_at_start_ = <nl> + gpr_atm_no_barrier_load ( & gpr_counter_atm_add ) ; <nl> + # endif <nl> + grpc_memory_counters counters_at_start_ = grpc_memory_counters_snapshot ( ) ; <nl> + } ; <nl> + <nl> + # endif <nl> mmm a / tools / run_tests / generated / sources_and_headers . json <nl> ppp b / tools / run_tests / generated / sources_and_headers . json <nl> <nl> " grpc " , <nl> " grpc + + " , <nl> " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> " grpc_test_util " <nl> ] , <nl> " headers " : [ ] , <nl> <nl> " grpc " , <nl> " grpc + + " , <nl> " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> " grpc_test_util " <nl> ] , <nl> " headers " : [ ] , <nl> <nl> " grpc " , <nl> " grpc + + " , <nl> " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> " grpc_test_util " <nl> ] , <nl> " headers " : [ ] , <nl> <nl> " grpc " , <nl> " grpc + + " , <nl> " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> " grpc_test_util " <nl> ] , <nl> " headers " : [ ] , <nl> <nl> " grpc " , <nl> " grpc + + " , <nl> " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> " grpc_test_util " <nl> ] , <nl> " headers " : [ ] , <nl> <nl> " grpc " , <nl> " grpc + + " , <nl> " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> " grpc_test_util " <nl> ] , <nl> " headers " : [ ] , <nl> " is_filegroup " : false , <nl> " language " : " c + + " , <nl> - " name " : " bm_fullstack " , <nl> + " name " : " bm_fullstack_streaming_ping_pong " , <nl> " src " : [ <nl> - " test / cpp / microbenchmarks / bm_fullstack . cc " <nl> + " test / cpp / microbenchmarks / bm_fullstack_streaming_ping_pong . cc " <nl> ] , <nl> " third_party " : false , <nl> " type " : " target " <nl> <nl> " gpr " , <nl> " gpr_test_util " , <nl> " grpc " , <nl> + " grpc + + " , <nl> + " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> + " grpc_test_util " <nl> + ] , <nl> + " headers " : [ ] , <nl> + " is_filegroup " : false , <nl> + " language " : " c + + " , <nl> + " name " : " bm_fullstack_streaming_pump " , <nl> + " src " : [ <nl> + " test / cpp / microbenchmarks / bm_fullstack_streaming_pump . cc " <nl> + ] , <nl> + " third_party " : false , <nl> + " type " : " target " <nl> + } , <nl> + { <nl> + " deps " : [ <nl> + " benchmark " , <nl> + " gpr " , <nl> + " gpr_test_util " , <nl> + " grpc " , <nl> + " grpc + + " , <nl> + " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> + " grpc_test_util " <nl> + ] , <nl> + " headers " : [ ] , <nl> + " is_filegroup " : false , <nl> + " language " : " c + + " , <nl> + " name " : " bm_fullstack_trickle " , <nl> + " src " : [ <nl> + " test / cpp / microbenchmarks / bm_fullstack_trickle . cc " <nl> + ] , <nl> + " third_party " : false , <nl> + " type " : " target " <nl> + } , <nl> + { <nl> + " deps " : [ <nl> + " benchmark " , <nl> + " gpr " , <nl> + " gpr_test_util " , <nl> + " grpc " , <nl> + " grpc + + " , <nl> + " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> + " grpc_test_util " <nl> + ] , <nl> + " headers " : [ ] , <nl> + " is_filegroup " : false , <nl> + " language " : " c + + " , <nl> + " name " : " bm_fullstack_unary_ping_pong " , <nl> + " src " : [ <nl> + " test / cpp / microbenchmarks / bm_fullstack_unary_ping_pong . cc " <nl> + ] , <nl> + " third_party " : false , <nl> + " type " : " target " <nl> + } , <nl> + { <nl> + " deps " : [ <nl> + " benchmark " , <nl> + " gpr " , <nl> + " gpr_test_util " , <nl> + " grpc " , <nl> + " grpc + + " , <nl> + " grpc + + _test_util " , <nl> + " grpc_benchmark " , <nl> " grpc_test_util " <nl> ] , <nl> " headers " : [ ] , <nl> <nl> " third_party " : false , <nl> " type " : " lib " <nl> } , <nl> + { <nl> + " deps " : [ <nl> + " benchmark " , <nl> + " grpc " , <nl> + " grpc + + " , <nl> + " grpc_test_util " <nl> + ] , <nl> + " headers " : [ <nl> + " test / cpp / microbenchmarks / fullstack_context_mutators . h " , <nl> + " test / cpp / microbenchmarks / fullstack_fixtures . h " , <nl> + " test / cpp / microbenchmarks / helpers . h " <nl> + ] , <nl> + " is_filegroup " : false , <nl> + " language " : " c + + " , <nl> + " name " : " grpc_benchmark " , <nl> + " src " : [ <nl> + " test / cpp / microbenchmarks / fullstack_context_mutators . h " , <nl> + " test / cpp / microbenchmarks / fullstack_fixtures . h " , <nl> + " test / cpp / microbenchmarks / helpers . cc " , <nl> + " test / cpp / microbenchmarks / helpers . h " <nl> + ] , <nl> + " third_party " : false , <nl> + " type " : " lib " <nl> + } , <nl> { <nl> " deps " : [ <nl> " grpc + + " , <nl> <nl> " headers " : [ <nl> " test / core / end2end / cq_verifier . h " , <nl> " test / core / end2end / fake_resolver . h " , <nl> - " test / core / end2end / fixtures / http_proxy . h " , <nl> + " test / core / end2end / fixtures / http_proxy_fixture . h " , <nl> " test / core / end2end / fixtures / proxy . h " , <nl> " test / core / iomgr / endpoint_tests . h " , <nl> " test / core / util / debugger_macros . h " , <nl> <nl> " test / core / end2end / cq_verifier . h " , <nl> " test / core / end2end / fake_resolver . c " , <nl> " test / core / end2end / fake_resolver . h " , <nl> - " test / core / end2end / fixtures / http_proxy . c " , <nl> - " test / core / end2end / fixtures / http_proxy . h " , <nl> + " test / core / end2end / fixtures / http_proxy_fixture . c " , <nl> + " test / core / end2end / fixtures / http_proxy_fixture . h " , <nl> " test / core / end2end / fixtures / proxy . c " , <nl> " test / core / end2end / fixtures / proxy . h " , <nl> " test / core / iomgr / endpoint_tests . c " , <nl> mmm a / tools / run_tests / generated / tests . json <nl> ppp b / tools / run_tests / generated / tests . json <nl> <nl> " flaky " : false , <nl> " gtest " : false , <nl> " language " : " c + + " , <nl> - " name " : " bm_fullstack " , <nl> + " name " : " bm_fullstack_streaming_ping_pong " , <nl> + " platforms " : [ <nl> + " linux " , <nl> + " mac " , <nl> + " posix " <nl> + ] , <nl> + " timeout_seconds " : 1200 <nl> + } , <nl> + { <nl> + " args " : [ <nl> + " - - benchmark_min_time = 0 " <nl> + ] , <nl> + " ci_platforms " : [ <nl> + " linux " , <nl> + " mac " , <nl> + " posix " <nl> + ] , <nl> + " cpu_cost " : 1 . 0 , <nl> + " exclude_configs " : [ ] , <nl> + " exclude_iomgrs " : [ ] , <nl> + " excluded_poll_engines " : [ <nl> + " poll " , <nl> + " poll - cv " <nl> + ] , <nl> + " flaky " : false , <nl> + " gtest " : false , <nl> + " language " : " c + + " , <nl> + " name " : " bm_fullstack_streaming_pump " , <nl> + " platforms " : [ <nl> + " linux " , <nl> + " mac " , <nl> + " posix " <nl> + ] , <nl> + " timeout_seconds " : 1200 <nl> + } , <nl> + { <nl> + " args " : [ <nl> + " - - benchmark_min_time = 0 " <nl> + ] , <nl> + " ci_platforms " : [ <nl> + " linux " , <nl> + " mac " , <nl> + " posix " <nl> + ] , <nl> + " cpu_cost " : 1 . 0 , <nl> + " exclude_configs " : [ ] , <nl> + " exclude_iomgrs " : [ ] , <nl> + " excluded_poll_engines " : [ <nl> + " poll " , <nl> + " poll - cv " <nl> + ] , <nl> + " flaky " : false , <nl> + " gtest " : false , <nl> + " language " : " c + + " , <nl> + " name " : " bm_fullstack_trickle " , <nl> + " platforms " : [ <nl> + " linux " , <nl> + " mac " , <nl> + " posix " <nl> + ] , <nl> + " timeout_seconds " : 1200 <nl> + } , <nl> + { <nl> + " args " : [ <nl> + " - - benchmark_min_time = 0 " <nl> + ] , <nl> + " ci_platforms " : [ <nl> + " linux " , <nl> + " mac " , <nl> + " posix " <nl> + ] , <nl> + " cpu_cost " : 1 . 0 , <nl> + " exclude_configs " : [ ] , <nl> + " exclude_iomgrs " : [ ] , <nl> + " excluded_poll_engines " : [ <nl> + " poll " , <nl> + " poll - cv " <nl> + ] , <nl> + " flaky " : false , <nl> + " gtest " : false , <nl> + " language " : " c + + " , <nl> + " name " : " bm_fullstack_unary_ping_pong " , <nl> " platforms " : [ <nl> " linux " , <nl> " mac " , <nl> mmm a / tools / run_tests / run_microbenchmark . py <nl> ppp b / tools / run_tests / run_microbenchmark . py <nl> def collect_summary ( bm_name , args ) : <nl> default = sorted ( collectors . keys ( ) ) , <nl> help = ' Which collectors should be run against each benchmark ' ) <nl> argp . add_argument ( ' - b ' , ' - - benchmarks ' , <nl> - default = [ ' bm_fullstack ' , <nl> + default = [ ' bm_fullstack_unary_ping_pong ' , <nl> + ' bm_fullstack_streaming_ping_pong ' , <nl> + ' bm_fullstack_streaming_pump ' , <nl> ' bm_closure ' , <nl> ' bm_cq ' , <nl> ' bm_call_create ' , <nl> ' bm_error ' , <nl> ' bm_chttp2_hpack ' , <nl> - ' bm_metadata ' ] , <nl> + ' bm_metadata ' , <nl> + ' bm_fullstack_trickle ' , <nl> + ] , <nl> nargs = ' + ' , <nl> type = str , <nl> help = ' Which microbenchmarks should be run ' ) <nl> mmm a / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj <nl> ppp b / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ security \ oauth2_utils . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ cq_verifier . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . h " / > <nl> - < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ iomgr \ endpoint_tests . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ debugger_macros . h " / > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . c " > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . c " > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . c " > <nl> < / ClCompile > <nl> mmm a / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / grpc_test_util / grpc_test_util . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . c " > <nl> < Filter > test \ core \ end2end < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . c " > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . c " > <nl> < Filter > test \ core \ end2end \ fixtures < / Filter > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . c " > <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . h " > <nl> < Filter > test \ core \ end2end < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . h " > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . h " > <nl> < Filter > test \ core \ end2end \ fixtures < / Filter > <nl> < / ClInclude > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . h " > <nl> mmm a / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj <nl> ppp b / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj <nl> <nl> < ItemGroup > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ cq_verifier . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . h " / > <nl> - < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ iomgr \ endpoint_tests . h " / > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ util \ debugger_macros . h " / > <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . c " > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . c " > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . c " > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . c " > <nl> < / ClCompile > <nl> mmm a / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj . filters <nl> ppp b / vsprojects / vcxproj / grpc_test_util_unsecure / grpc_test_util_unsecure . vcxproj . filters <nl> <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . c " > <nl> < Filter > test \ core \ end2end < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . c " > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . c " > <nl> < Filter > test \ core \ end2end \ fixtures < / Filter > <nl> < / ClCompile > <nl> < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . c " > <nl> <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fake_resolver . h " > <nl> < Filter > test \ core \ end2end < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy . h " > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ http_proxy_fixture . h " > <nl> < Filter > test \ core \ end2end \ fixtures < / Filter > <nl> < / ClInclude > <nl> < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ core \ end2end \ fixtures \ proxy . h " > <nl> new file mode 100644 <nl> index 00000000000 . . 58586f0cb8d <nl> mmm / dev / null <nl> ppp b / vsprojects / vcxproj / test / grpc_benchmark / grpc_benchmark . vcxproj <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project DefaultTargets = " Build " ToolsVersion = " 12 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . props " Condition = " Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ 1 . 0 . 204 . 1 . props ' ) " / > <nl> + < ItemGroup Label = " ProjectConfigurations " > <nl> + < ProjectConfiguration Include = " Debug | Win32 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Debug | x64 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > x64 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | Win32 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | x64 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > x64 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < / ItemGroup > <nl> + < PropertyGroup Label = " Globals " > <nl> + < ProjectGuid > { 31FCED31 - 7D88 - BE3D - 2D61 - 0840F08E0850 } < / ProjectGuid > <nl> + < IgnoreWarnIntDirInTempDetected > true < / IgnoreWarnIntDirInTempDetected > <nl> + < IntDir > $ ( SolutionDir ) IntDir \ $ ( MSBuildProjectName ) \ < / IntDir > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . Default . props " / > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 10 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v100 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 11 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v110 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 12 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( VisualStudioVersion ) ' = = ' 14 . 0 ' " Label = " Configuration " > <nl> + < PlatformToolset > v140 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > true < / WholeProgramOptimization > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . props " / > <nl> + < ImportGroup Label = " ExtensionSettings " > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " > <nl> + < Import Project = " $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props " Condition = " exists ( ' $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props ' ) " Label = " LocalAppDataPlatform " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ cpptest . props " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ global . props " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ openssl . props " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ protobuf . props " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ winsock . props " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ zlib . props " / > <nl> + < / ImportGroup > <nl> + < PropertyGroup Label = " UserMacros " / > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Debug ' " > <nl> + < TargetName > grpc_benchmark < / TargetName > <nl> + < Linkage - grpc_dependencies_zlib > static < / Linkage - grpc_dependencies_zlib > <nl> + < Configuration - grpc_dependencies_zlib > Debug < / Configuration - grpc_dependencies_zlib > <nl> + < Linkage - grpc_dependencies_openssl > static < / Linkage - grpc_dependencies_openssl > <nl> + < Configuration - grpc_dependencies_openssl > Debug < / Configuration - grpc_dependencies_openssl > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) ' = = ' Release ' " > <nl> + < TargetName > grpc_benchmark < / TargetName > <nl> + < Linkage - grpc_dependencies_zlib > static < / Linkage - grpc_dependencies_zlib > <nl> + < Configuration - grpc_dependencies_zlib > Release < / Configuration - grpc_dependencies_zlib > <nl> + < Linkage - grpc_dependencies_openssl > static < / Linkage - grpc_dependencies_openssl > <nl> + < Configuration - grpc_dependencies_openssl > Release < / Configuration - grpc_dependencies_openssl > <nl> + < / PropertyGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > Disabled < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; _DEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreadedDebug < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | x64 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > Disabled < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; _DEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreadedDebug < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > MaxSpeed < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; NDEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < FunctionLevelLinking > true < / FunctionLevelLinking > <nl> + < IntrinsicFunctions > true < / IntrinsicFunctions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < EnableCOMDATFolding > true < / EnableCOMDATFolding > <nl> + < OptimizeReferences > true < / OptimizeReferences > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | x64 ' " > <nl> + < ClCompile > <nl> + < PrecompiledHeader > NotUsing < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < Optimization > MaxSpeed < / Optimization > <nl> + < PreprocessorDefinitions > WIN32 ; NDEBUG ; _LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < FunctionLevelLinking > true < / FunctionLevelLinking > <nl> + < IntrinsicFunctions > true < / IntrinsicFunctions > <nl> + < SDLCheck > true < / SDLCheck > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> + < TreatWarningAsError > true < / TreatWarningAsError > <nl> + < DebugInformationFormat Condition = " $ ( Jenkins ) " > None < / DebugInformationFormat > <nl> + < MinimalRebuild Condition = " $ ( Jenkins ) " > false < / MinimalRebuild > <nl> + < / ClCompile > <nl> + < Link > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < GenerateDebugInformation Condition = " ! $ ( Jenkins ) " > true < / GenerateDebugInformation > <nl> + < GenerateDebugInformation Condition = " $ ( Jenkins ) " > false < / GenerateDebugInformation > <nl> + < EnableCOMDATFolding > true < / EnableCOMDATFolding > <nl> + < OptimizeReferences > true < / OptimizeReferences > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ fullstack_context_mutators . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ fullstack_fixtures . h " / > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ helpers . h " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ helpers . cc " > <nl> + < / ClCompile > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ benchmark \ benchmark . vcxproj " > <nl> + < Project > { 07978586 - E47C - 8709 - A63E - 895FBF3C3C7D } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc + + \ grpc + + . vcxproj " > <nl> + < Project > { C187A093 - A0FE - 489D - A40A - 6E33DE0F9FEB } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc_test_util \ grpc_test_util . vcxproj " > <nl> + < Project > { 17BCAFC0 - 5FDC - 4C94 - AEB9 - 95F3E220614B } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " $ ( SolutionDir ) \ . . \ vsprojects \ vcxproj \ . \ grpc \ grpc . vcxproj " > <nl> + < Project > { 29D16885 - 7228 - 4C31 - 81ED - 5F9187C7F2A9 } < / Project > <nl> + < / ProjectReference > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < None Include = " packages . config " / > <nl> + < / ItemGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> + < ImportGroup Label = " ExtensionTargets " > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . redist . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies . zlib . redist . targets " Condition = " Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . redist . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies \ grpc . dependencies . zlib . targets ' ) " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies . zlib . targets " Condition = " Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies \ grpc . dependencies . zlib . targets ' ) " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . redist . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . redist . targets " Condition = " Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . redist . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies \ grpc . dependencies . openssl . targets ' ) " / > <nl> + < Import Project = " $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . targets " Condition = " Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies \ grpc . dependencies . openssl . targets ' ) " / > <nl> + < / ImportGroup > <nl> + < Target Name = " EnsureNuGetPackageBuildImports " BeforeTargets = " PrepareForBuild " > <nl> + < PropertyGroup > <nl> + < ErrorText > This project references NuGet package ( s ) that are missing on this computer . Enable NuGet Package Restore to download them . For more information , see http : / / go . microsoft . com / fwlink / ? LinkID = 322105 . The missing file is { 0 } . < / ErrorText > <nl> + < / PropertyGroup > <nl> + < Error Condition = " ! Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . redist . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies . zlib . redist . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . redist . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies . zlib . redist . targets ' ) " / > <nl> + < Error Condition = " ! Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies . zlib . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . zlib . 1 . 2 . 8 . 10 \ build \ native \ grpc . dependencies . zlib . targets ' ) " / > <nl> + < Error Condition = " ! Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . redist . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . redist . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . redist . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . redist . targets ' ) " / > <nl> + < Error Condition = " ! Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . props ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . props ' ) " / > <nl> + < Error Condition = " ! Exists ( ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . targets ' ) " Text = " $ ( [ System . String ] : : Format ( ' $ ( ErrorText ) ' , ' $ ( SolutionDir ) \ . . \ vsprojects \ packages \ grpc . dependencies . openssl . 1 . 0 . 204 . 1 \ build \ native \ grpc . dependencies . openssl . targets ' ) " / > <nl> + < / Target > <nl> + < / Project > <nl> + <nl> new file mode 100644 <nl> index 00000000000 . . 8e865bcc1bb <nl> mmm / dev / null <nl> ppp b / vsprojects / vcxproj / test / grpc_benchmark / grpc_benchmark . vcxproj . filters <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project ToolsVersion = " 4 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup > <nl> + < ClCompile Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ helpers . cc " > <nl> + < Filter > test \ cpp \ microbenchmarks < / Filter > <nl> + < / ClCompile > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ fullstack_context_mutators . h " > <nl> + < Filter > test \ cpp \ microbenchmarks < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ fullstack_fixtures . h " > <nl> + < Filter > test \ cpp \ microbenchmarks < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( SolutionDir ) \ . . \ test \ cpp \ microbenchmarks \ helpers . h " > <nl> + < Filter > test \ cpp \ microbenchmarks < / Filter > <nl> + < / ClInclude > <nl> + < / ItemGroup > <nl> + <nl> + < ItemGroup > <nl> + < Filter Include = " test " > <nl> + < UniqueIdentifier > { 46d1162d - 13b8 - d144 - 8b76 - 77a6d982a9f1 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " test \ cpp " > <nl> + < UniqueIdentifier > { 1d2b47d7 - 8fc3 - a5b6 - cc85 - 47e31600e9d7 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " test \ cpp \ microbenchmarks " > <nl> + < UniqueIdentifier > { 2a1ac913 - 6c7b - fbd2 - 6e8f - 1215e92b4af8 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < / ItemGroup > <nl> + < / Project > <nl> + <nl>
Merge pull request from ctiller / fmac
grpc/grpc
8d7ce8cc9ddfad0d629f8419d3a0f254f353224e
2017-03-09T18:07:00Z
mmm a / dbms / src / Dictionaries / Embedded / RegionsHierarchy . cpp <nl> ppp b / dbms / src / Dictionaries / Embedded / RegionsHierarchy . cpp <nl> void RegionsHierarchy : : reload ( ) <nl> if ( read_parent_id > = 0 ) <nl> parent_id = read_parent_id ; <nl> <nl> - RegionType type = read_type ; <nl> + RegionType type = static_cast < RegionType > ( read_type ) ; <nl> <nl> if ( region_id > max_region_id ) <nl> { <nl> void RegionsHierarchy : : reload ( ) <nl> / / / prescribe the cities and countries for the regions <nl> for ( RegionID i = 0 ; i < = max_region_id ; + + i ) <nl> { <nl> - if ( types [ i ] = = REGION_TYPE_CITY ) <nl> + if ( types [ i ] = = RegionType : : City ) <nl> new_city [ i ] = i ; <nl> <nl> - if ( types [ i ] = = REGION_TYPE_AREA ) <nl> + if ( types [ i ] = = RegionType : : Area ) <nl> new_area [ i ] = i ; <nl> <nl> - if ( types [ i ] = = REGION_TYPE_DISTRICT ) <nl> + if ( types [ i ] = = RegionType : : District ) <nl> new_district [ i ] = i ; <nl> <nl> - if ( types [ i ] = = REGION_TYPE_COUNTRY ) <nl> + if ( types [ i ] = = RegionType : : Country ) <nl> new_country [ i ] = i ; <nl> <nl> - if ( types [ i ] = = REGION_TYPE_CONTINENT ) <nl> + if ( types [ i ] = = RegionType : : Continent ) <nl> { <nl> new_continent [ i ] = i ; <nl> new_top_continent [ i ] = i ; <nl> void RegionsHierarchy : : reload ( ) <nl> if ( current > max_region_id ) <nl> throw Poco : : Exception ( " Logical error in regions hierarchy : region " + DB : : toString ( current ) + " ( specified as parent ) doesn ' t exist " ) ; <nl> <nl> - if ( types [ current ] = = REGION_TYPE_CITY ) <nl> + if ( types [ current ] = = RegionType : : City ) <nl> new_city [ i ] = current ; <nl> <nl> - if ( types [ current ] = = REGION_TYPE_AREA ) <nl> + if ( types [ current ] = = RegionType : : Area ) <nl> new_area [ i ] = current ; <nl> <nl> - if ( types [ current ] = = REGION_TYPE_DISTRICT ) <nl> + if ( types [ current ] = = RegionType : : District ) <nl> new_district [ i ] = current ; <nl> <nl> - if ( types [ current ] = = REGION_TYPE_COUNTRY ) <nl> + if ( types [ current ] = = RegionType : : Country ) <nl> new_country [ i ] = current ; <nl> <nl> - if ( types [ current ] = = REGION_TYPE_CONTINENT ) <nl> + if ( types [ current ] = = RegionType : : Continent ) <nl> { <nl> if ( ! new_continent [ i ] ) <nl> new_continent [ i ] = current ; <nl> mmm a / dbms / src / Dictionaries / Embedded / RegionsHierarchy . h <nl> ppp b / dbms / src / Dictionaries / Embedded / RegionsHierarchy . h <nl> <nl> # include < common / Types . h > <nl> <nl> <nl> - # define REGION_TYPE_CITY 6 <nl> - # define REGION_TYPE_AREA 5 <nl> - # define REGION_TYPE_DISTRICT 4 <nl> - # define REGION_TYPE_COUNTRY 3 <nl> - # define REGION_TYPE_CONTINENT 1 <nl> - <nl> - <nl> / * * A class that lets you know if a region belongs to one RegionID region with another RegionID . <nl> * Information about the hierarchy of regions is downloaded from a text file . <nl> * Can on request update the data . <nl> class RegionsHierarchy : private boost : : noncopyable <nl> time_t file_modification_time = 0 ; <nl> <nl> using RegionID = UInt32 ; <nl> - using RegionType = UInt8 ; <nl> using RegionDepth = UInt8 ; <nl> using RegionPopulation = UInt32 ; <nl> <nl> + enum class RegionType : Int8 <nl> + { <nl> + Hidden = - 1 , <nl> + Continent = 1 , <nl> + Country = 3 , <nl> + District = 4 , <nl> + Area = 5 , <nl> + City = 6 , <nl> + } ; <nl> + <nl> / / / Relationship parent ; 0 , if there are no parents , the usual lookup table . <nl> using RegionParents = std : : vector < RegionID > ; <nl> / / / type of region <nl>
RegionsHierarchy : minor modification [ # CLICKHOUSE - 3427 ] .
ClickHouse/ClickHouse
5ef829c5f3e4237aa85e8fbba0d57ee4c16a0832
2017-11-16T18:47:59Z
mmm a / modules / planning / proto / planning_config . proto <nl> ppp b / modules / planning / proto / planning_config . proto <nl> enum TaskType { <nl> NAVI_OBSTACLE_DECIDER = 9 ; <nl> QP_PIECEWISE_JERK_PATH_OPTIMIZER = 10 ; <nl> DECIDER_CREEP = 11 ; <nl> + DECIDER_STOP_SIGN_MONITOR = 12 ; <nl> + SIDE_PASS_PATH_DECIDER = 13 ; <nl> + SIDE_PATH_SAFETY = 14 ; <nl> + PROCEED_WITH_CAUTION_SPEED = 15 ; <nl> } ; <nl> <nl> message PathDeciderConfig { <nl> mmm a / modules / planning / scenarios / side_pass / BUILD <nl> ppp b / modules / planning / scenarios / side_pass / BUILD <nl> cc_library ( <nl> " side_pass_scenario . h " , <nl> ] , <nl> deps = [ <nl> + " @ eigen " , <nl> " / / cybertron " , <nl> " / / external : gflags " , <nl> " / / modules / common " , <nl> cc_library ( <nl> " / / modules / planning / reference_line " , <nl> " / / modules / planning / reference_line : qp_spline_reference_line_smoother " , <nl> " / / modules / planning / scenarios : scenario_lib " , <nl> + " / / modules / planning / toolkits / deciders : decider " , <nl> " / / modules / planning / toolkits / optimizers : path_optimizer " , <nl> " / / modules / planning / toolkits / optimizers : speed_optimizer " , <nl> " / / modules / planning / toolkits / optimizers / dp_poly_path : dp_poly_path_optimizer " , <nl> " / / modules / planning / toolkits / optimizers / dp_st_speed : dp_st_speed_optimizer " , <nl> " / / modules / planning / toolkits / optimizers / path_decider " , <nl> " / / modules / planning / toolkits / optimizers / poly_st_speed : poly_st_speed_optimizer " , <nl> + " / / modules / planning / toolkits / optimizers / proceed_with_caution_speed : proceed_with_caution_speed_generator " , <nl> " / / modules / planning / toolkits / optimizers / qp_spline_path " , <nl> " / / modules / planning / toolkits / optimizers / qp_spline_st_speed : qp_spline_st_speed_optimizer " , <nl> " / / modules / planning / toolkits / optimizers / speed_decider " , <nl> - " @ eigen " , <nl> ] , <nl> ) <nl> <nl> cc_test ( <nl> " / / modules / planning : planning_conf " , <nl> ] , <nl> deps = [ <nl> - " : side_pass " , <nl> " @ gtest / / : main " , <nl> + " : side_pass " , <nl> ] , <nl> ) <nl> <nl> mmm a / modules / planning / toolkits / deciders / side_pass_path_decider . cc <nl> ppp b / modules / planning / toolkits / deciders / side_pass_path_decider . cc <nl> using : : apollo : : common : : ErrorCode ; <nl> using : : apollo : : common : : Status ; <nl> using : : apollo : : hdmap : : PathOverlap ; <nl> <nl> + SidePassPathDecider : : SidePassPathDecider ( ) : Decider ( " SidePassPathDecider " ) { } <nl> + <nl> bool SidePassPathDecider : : Init ( <nl> const ScenarioConfig : : ScenarioTaskConfig & config ) { <nl> is_init_ = true ; <nl> mmm a / modules / planning / toolkits / deciders / side_pass_safety . cc <nl> ppp b / modules / planning / toolkits / deciders / side_pass_safety . cc <nl> using : : apollo : : common : : ErrorCode ; <nl> using : : apollo : : common : : Status ; <nl> using : : apollo : : hdmap : : PathOverlap ; <nl> <nl> + SidePassSafety : : SidePassSafety ( ) : Decider ( " SidePassSafety " ) { } <nl> + <nl> bool SidePassSafety : : Init ( const ScenarioConfig : : ScenarioTaskConfig & config ) { <nl> is_init_ = true ; <nl> return true ; <nl>
planning : added new tasks into proto and fixs a few issues .
ApolloAuto/apollo
8f5033cee9a3d446ace688309470b83048c2ee9f
2018-10-13T02:42:39Z
mmm a / MachineLearning / CNTKEval / CNTKEval . vcxproj <nl> ppp b / MachineLearning / CNTKEval / CNTKEval . vcxproj <nl> <nl> < AdditionalIncludeDirectories > . . \ . . \ common \ include ; . . \ . . \ math \ math < / AdditionalIncludeDirectories > <nl> < OpenMPSupport > false < / OpenMPSupport > <nl> < AdditionalOptions > / d2Zi + % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> < / ClCompile > <nl> < Link > <nl> < SubSystem > Windows < / SubSystem > <nl> mmm a / Math / Math / Math . vcxproj <nl> ppp b / Math / Math / Math . vcxproj <nl> <nl> < FloatingPointExceptions > false < / FloatingPointExceptions > <nl> < TreatWarningAsError > false < / TreatWarningAsError > <nl> < AdditionalOptions > / d2Zi + % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> < / ClCompile > <nl> < Link > <nl> < SubSystem > Windows < / SubSystem > <nl>
Changed CRT to be static version
microsoft/CNTK
f5e41bb3bb081e8b228798aaa0f2b6e524fe5b0e
2014-10-08T23:00:59Z
mmm a / PythonClient / airsim / client . py <nl> ppp b / PythonClient / airsim / client . py <nl> def simCharSetBonePoses ( self , poses , character_name = " " ) : <nl> def simCharGetBonePoses ( self , bone_names , character_name = " " ) : <nl> return self . client . call ( ' simGetBonePoses ' , bone_names , character_name ) <nl> <nl> - def cancelLastTask ( ) : <nl> - self . client . call ( ' cancelLastTask ' ) <nl> - def waitOnLastTask ( timeout_sec = float ( ' nan ' ) ) : <nl> + def cancelLastTask ( self , vehicle_name = ' ' ) : <nl> + self . client . call ( ' cancelLastTask ' , vehicle_name ) <nl> + def waitOnLastTask ( self , timeout_sec = float ( ' nan ' ) ) : <nl> return self . client . call ( ' waitOnLastTask ' , timeout_sec ) <nl> <nl> # legacy handling <nl>
Merge pull request from madratman / PR / python / cancellasttask_waitonlasttask
microsoft/AirSim
fead8f7dbecf6b200f5d34db2488be67b61987e2
2019-09-13T01:04:22Z
mmm a / src / arm / lithium - arm . cc <nl> ppp b / src / arm / lithium - arm . cc <nl> void LChunk : : MarkEmptyBlocks ( ) { <nl> <nl> <nl> void LChunk : : AddInstruction ( LInstruction * instr , HBasicBlock * block ) { <nl> - LInstructionGap * gap = new LInstructionGap ( block ) ; <nl> + LInstructionGap * gap = new ( graph_ - > zone ( ) ) LInstructionGap ( block ) ; <nl> int index = - 1 ; <nl> if ( instr - > IsControl ( ) ) { <nl> instructions_ . Add ( gap ) ; <nl> Representation LChunk : : LookupLiteralRepresentation ( <nl> <nl> LChunk * LChunkBuilder : : Build ( ) { <nl> ASSERT ( is_unused ( ) ) ; <nl> - chunk_ = new LChunk ( info ( ) , graph ( ) ) ; <nl> + chunk_ = new ( zone ( ) ) LChunk ( info ( ) , graph ( ) ) ; <nl> HPhase phase ( " Building chunk " , chunk_ ) ; <nl> status_ = BUILDING ; <nl> const ZoneList < HBasicBlock * > * blocks = graph ( ) - > blocks ( ) ; <nl> void LChunkBuilder : : Abort ( const char * format , . . . ) { <nl> <nl> <nl> LUnallocated * LChunkBuilder : : ToUnallocated ( Register reg ) { <nl> - return new LUnallocated ( LUnallocated : : FIXED_REGISTER , <nl> - Register : : ToAllocationIndex ( reg ) ) ; <nl> + return new ( zone ( ) ) LUnallocated ( LUnallocated : : FIXED_REGISTER , <nl> + Register : : ToAllocationIndex ( reg ) ) ; <nl> } <nl> <nl> <nl> LUnallocated * LChunkBuilder : : ToUnallocated ( DoubleRegister reg ) { <nl> - return new LUnallocated ( LUnallocated : : FIXED_DOUBLE_REGISTER , <nl> - DoubleRegister : : ToAllocationIndex ( reg ) ) ; <nl> + return new ( zone ( ) ) LUnallocated ( LUnallocated : : FIXED_DOUBLE_REGISTER , <nl> + DoubleRegister : : ToAllocationIndex ( reg ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseFixedDouble ( HValue * value , DoubleRegister reg ) { <nl> <nl> <nl> LOperand * LChunkBuilder : : UseRegister ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseRegisterAtStart ( HValue * value ) { <nl> return Use ( value , <nl> - new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER , <nl> - LUnallocated : : USED_AT_START ) ) ; <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER , <nl> + LUnallocated : : USED_AT_START ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseTempRegister ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : WRITABLE_REGISTER ) ) ; <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : WRITABLE_REGISTER ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : Use ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : NONE ) ) ; <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : NONE ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseAtStart ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : NONE , <nl> - LUnallocated : : USED_AT_START ) ) ; <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : NONE , <nl> + LUnallocated : : USED_AT_START ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseRegisterOrConstantAtStart ( HValue * value ) { <nl> LOperand * LChunkBuilder : : UseAny ( HValue * value ) { <nl> return value - > IsConstant ( ) <nl> ? chunk_ - > DefineConstantOperand ( HConstant : : cast ( value ) ) <nl> - : Use ( value , new LUnallocated ( LUnallocated : : ANY ) ) ; <nl> + : Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : ANY ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : Define ( LTemplateInstruction < 1 , I , T > * instr , <nl> template < int I , int T > <nl> LInstruction * LChunkBuilder : : DefineAsRegister ( <nl> LTemplateInstruction < 1 , I , T > * instr ) { <nl> - return Define ( instr , new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> + return Define ( instr , <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> } <nl> <nl> <nl> template < int I , int T > <nl> LInstruction * LChunkBuilder : : DefineAsSpilled ( <nl> LTemplateInstruction < 1 , I , T > * instr , int index ) { <nl> - return Define ( instr , new LUnallocated ( LUnallocated : : FIXED_SLOT , index ) ) ; <nl> + return Define ( instr , <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : FIXED_SLOT , index ) ) ; <nl> } <nl> <nl> <nl> template < int I , int T > <nl> LInstruction * LChunkBuilder : : DefineSameAsFirst ( <nl> LTemplateInstruction < 1 , I , T > * instr ) { <nl> - return Define ( instr , new LUnallocated ( LUnallocated : : SAME_AS_FIRST_INPUT ) ) ; <nl> + return Define ( instr , <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : SAME_AS_FIRST_INPUT ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : MarkAsSaveDoubles ( LInstruction * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : AssignPointerMap ( LInstruction * instr ) { <nl> ASSERT ( ! instr - > HasPointerMap ( ) ) ; <nl> - instr - > set_pointer_map ( new LPointerMap ( position_ ) ) ; <nl> + instr - > set_pointer_map ( new ( zone ( ) ) LPointerMap ( position_ ) ) ; <nl> return instr ; <nl> } <nl> <nl> <nl> LUnallocated * LChunkBuilder : : TempRegister ( ) { <nl> - LUnallocated * operand = new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ; <nl> + LUnallocated * operand = <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ; <nl> operand - > set_virtual_register ( allocator_ - > GetVirtualRegister ( ) ) ; <nl> if ( ! allocator_ - > AllocationOk ( ) ) Abort ( " Not enough virtual registers . " ) ; <nl> return operand ; <nl> LOperand * LChunkBuilder : : FixedTemp ( DoubleRegister reg ) { <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBlockEntry ( HBlockEntry * instr ) { <nl> - return new LLabel ( instr - > block ( ) ) ; <nl> + return new ( zone ( ) ) LLabel ( instr - > block ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoSoftDeoptimize ( HSoftDeoptimize * instr ) { <nl> - return AssignEnvironment ( new LDeoptimize ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LDeoptimize ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoDeoptimize ( HDeoptimize * instr ) { <nl> - return AssignEnvironment ( new LDeoptimize ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LDeoptimize ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoShift ( Token : : Value op , <nl> <nl> LOperand * left = UseFixed ( instr - > left ( ) , r1 ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , r0 ) ; <nl> - LArithmeticT * result = new LArithmeticT ( op , left , right ) ; <nl> + LArithmeticT * result = new ( zone ( ) ) LArithmeticT ( op , left , right ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoShift ( Token : : Value op , <nl> } <nl> <nl> LInstruction * result = <nl> - DefineAsRegister ( new LShiftI ( op , left , right , does_deopt ) ) ; <nl> + DefineAsRegister ( new ( zone ( ) ) LShiftI ( op , left , right , does_deopt ) ) ; <nl> return does_deopt ? AssignEnvironment ( result ) : result ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoArithmeticD ( Token : : Value op , <nl> ASSERT ( op ! = Token : : MOD ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseRegisterAtStart ( instr - > right ( ) ) ; <nl> - LArithmeticD * result = new LArithmeticD ( op , left , right ) ; <nl> + LArithmeticD * result = new ( zone ( ) ) LArithmeticD ( op , left , right ) ; <nl> return DefineAsRegister ( result ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoArithmeticT ( Token : : Value op , <nl> ASSERT ( right - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * left_operand = UseFixed ( left , r1 ) ; <nl> LOperand * right_operand = UseFixed ( right , r0 ) ; <nl> - LArithmeticT * result = new LArithmeticT ( op , left_operand , right_operand ) ; <nl> + LArithmeticT * result = <nl> + new ( zone ( ) ) LArithmeticT ( op , left_operand , right_operand ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> LEnvironment * LChunkBuilder : : CreateEnvironment ( <nl> ASSERT ( ast_id ! = AstNode : : kNoNumber | | <nl> hydrogen_env - > frame_type ( ) ! = JS_FUNCTION ) ; <nl> int value_count = hydrogen_env - > length ( ) ; <nl> - LEnvironment * result = new LEnvironment ( hydrogen_env - > closure ( ) , <nl> - hydrogen_env - > frame_type ( ) , <nl> - ast_id , <nl> - hydrogen_env - > parameter_count ( ) , <nl> - argument_count_ , <nl> - value_count , <nl> - outer ) ; <nl> + LEnvironment * result = new ( zone ( ) ) LEnvironment ( <nl> + hydrogen_env - > closure ( ) , <nl> + hydrogen_env - > frame_type ( ) , <nl> + ast_id , <nl> + hydrogen_env - > parameter_count ( ) , <nl> + argument_count_ , <nl> + value_count , <nl> + outer ) ; <nl> int argument_index = * argument_index_accumulator ; <nl> for ( int i = 0 ; i < value_count ; + + i ) { <nl> if ( hydrogen_env - > is_special_index ( i ) ) continue ; <nl> LEnvironment * LChunkBuilder : : CreateEnvironment ( <nl> if ( value - > IsArgumentsObject ( ) ) { <nl> op = NULL ; <nl> } else if ( value - > IsPushArgument ( ) ) { <nl> - op = new LArgument ( argument_index + + ) ; <nl> + op = new ( zone ( ) ) LArgument ( argument_index + + ) ; <nl> } else { <nl> op = UseAny ( value ) ; <nl> } <nl> LEnvironment * LChunkBuilder : : CreateEnvironment ( <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGoto ( HGoto * instr ) { <nl> - return new LGoto ( instr - > FirstSuccessor ( ) - > block_id ( ) ) ; <nl> + return new ( zone ( ) ) LGoto ( instr - > FirstSuccessor ( ) - > block_id ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBranch ( HBranch * instr ) { <nl> HBasicBlock * successor = HConstant : : cast ( value ) - > ToBoolean ( ) <nl> ? instr - > FirstSuccessor ( ) <nl> : instr - > SecondSuccessor ( ) ; <nl> - return new LGoto ( successor - > block_id ( ) ) ; <nl> + return new ( zone ( ) ) LGoto ( successor - > block_id ( ) ) ; <nl> } <nl> <nl> - LBranch * result = new LBranch ( UseRegister ( value ) ) ; <nl> + LBranch * result = new ( zone ( ) ) LBranch ( UseRegister ( value ) ) ; <nl> / / Tagged values that are not known smis or booleans require a <nl> / / deoptimization environment . <nl> Representation rep = value - > representation ( ) ; <nl> LInstruction * LChunkBuilder : : DoCompareMap ( HCompareMap * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> LOperand * temp = TempRegister ( ) ; <nl> - return new LCmpMapAndBranch ( value , temp ) ; <nl> + return new ( zone ( ) ) LCmpMapAndBranch ( value , temp ) ; <nl> } <nl> <nl> <nl> - LInstruction * LChunkBuilder : : DoArgumentsLength ( HArgumentsLength * length ) { <nl> - return DefineAsRegister ( new LArgumentsLength ( UseRegister ( length - > value ( ) ) ) ) ; <nl> + LInstruction * LChunkBuilder : : DoArgumentsLength ( HArgumentsLength * instr ) { <nl> + LOperand * value = UseRegister ( instr - > value ( ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LArgumentsLength ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoArgumentsElements ( HArgumentsElements * elems ) { <nl> - return DefineAsRegister ( new LArgumentsElements ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LArgumentsElements ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoInstanceOf ( HInstanceOf * instr ) { <nl> LInstanceOf * result = <nl> - new LInstanceOf ( UseFixed ( instr - > left ( ) , r0 ) , <nl> + new ( zone ( ) ) LInstanceOf ( UseFixed ( instr - > left ( ) , r0 ) , <nl> UseFixed ( instr - > right ( ) , r1 ) ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> LInstruction * LChunkBuilder : : DoInstanceOf ( HInstanceOf * instr ) { <nl> LInstruction * LChunkBuilder : : DoInstanceOfKnownGlobal ( <nl> HInstanceOfKnownGlobal * instr ) { <nl> LInstanceOfKnownGlobal * result = <nl> - new LInstanceOfKnownGlobal ( UseFixed ( instr - > left ( ) , r0 ) , FixedTemp ( r4 ) ) ; <nl> + new ( zone ( ) ) LInstanceOfKnownGlobal ( UseFixed ( instr - > left ( ) , r0 ) , <nl> + FixedTemp ( r4 ) ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoApplyArguments ( HApplyArguments * instr ) { <nl> LOperand * receiver = UseFixed ( instr - > receiver ( ) , r0 ) ; <nl> LOperand * length = UseFixed ( instr - > length ( ) , r2 ) ; <nl> LOperand * elements = UseFixed ( instr - > elements ( ) , r3 ) ; <nl> - LApplyArguments * result = new LApplyArguments ( function , <nl> + LApplyArguments * result = new ( zone ( ) ) LApplyArguments ( function , <nl> receiver , <nl> length , <nl> elements ) ; <nl> LInstruction * LChunkBuilder : : DoApplyArguments ( HApplyArguments * instr ) { <nl> LInstruction * LChunkBuilder : : DoPushArgument ( HPushArgument * instr ) { <nl> + + argument_count_ ; <nl> LOperand * argument = Use ( instr - > argument ( ) ) ; <nl> - return new LPushArgument ( argument ) ; <nl> + return new ( zone ( ) ) LPushArgument ( argument ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoThisFunction ( HThisFunction * instr ) { <nl> - return instr - > HasNoUses ( ) ? NULL : DefineAsRegister ( new LThisFunction ) ; <nl> + return instr - > HasNoUses ( ) <nl> + ? NULL <nl> + : DefineAsRegister ( new ( zone ( ) ) LThisFunction ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoContext ( HContext * instr ) { <nl> - return instr - > HasNoUses ( ) ? NULL : DefineAsRegister ( new LContext ) ; <nl> + return instr - > HasNoUses ( ) ? NULL : DefineAsRegister ( new ( zone ( ) ) LContext ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoOuterContext ( HOuterContext * instr ) { <nl> LOperand * context = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LOuterContext ( context ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LOuterContext ( context ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoDeclareGlobals ( HDeclareGlobals * instr ) { <nl> - return MarkAsCall ( new LDeclareGlobals , instr ) ; <nl> + return MarkAsCall ( new ( zone ( ) ) LDeclareGlobals , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGlobalObject ( HGlobalObject * instr ) { <nl> LOperand * context = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LGlobalObject ( context ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LGlobalObject ( context ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGlobalReceiver ( HGlobalReceiver * instr ) { <nl> LOperand * global_object = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LGlobalReceiver ( global_object ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LGlobalReceiver ( global_object ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallConstantFunction ( <nl> HCallConstantFunction * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallConstantFunction , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallConstantFunction , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoInvokeFunction ( HInvokeFunction * instr ) { <nl> LOperand * function = UseFixed ( instr - > function ( ) , r1 ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - LInvokeFunction * result = new LInvokeFunction ( function ) ; <nl> + LInvokeFunction * result = new ( zone ( ) ) LInvokeFunction ( function ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr , CANNOT_DEOPTIMIZE_EAGERLY ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoUnaryMathOperation ( HUnaryMathOperation * instr ) { <nl> BuiltinFunctionId op = instr - > op ( ) ; <nl> if ( op = = kMathLog | | op = = kMathSin | | op = = kMathCos ) { <nl> LOperand * input = UseFixedDouble ( instr - > value ( ) , d2 ) ; <nl> - LUnaryMathOperation * result = new LUnaryMathOperation ( input , NULL ) ; <nl> + LUnaryMathOperation * result = new ( zone ( ) ) LUnaryMathOperation ( input , NULL ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , d2 ) , instr ) ; <nl> } else if ( op = = kMathPowHalf ) { <nl> LOperand * input = UseFixedDouble ( instr - > value ( ) , d2 ) ; <nl> LOperand * temp = FixedTemp ( d3 ) ; <nl> - LUnaryMathOperation * result = new LUnaryMathOperation ( input , temp ) ; <nl> + LUnaryMathOperation * result = new ( zone ( ) ) LUnaryMathOperation ( input , temp ) ; <nl> return DefineFixedDouble ( result , d2 ) ; <nl> } else { <nl> LOperand * input = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> LOperand * temp = ( op = = kMathFloor ) ? TempRegister ( ) : NULL ; <nl> - LUnaryMathOperation * result = new LUnaryMathOperation ( input , temp ) ; <nl> + LUnaryMathOperation * result = new ( zone ( ) ) LUnaryMathOperation ( input , temp ) ; <nl> switch ( op ) { <nl> case kMathAbs : <nl> return AssignEnvironment ( AssignPointerMap ( DefineAsRegister ( result ) ) ) ; <nl> LInstruction * LChunkBuilder : : DoCallKeyed ( HCallKeyed * instr ) { <nl> ASSERT ( instr - > key ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> LOperand * key = UseFixed ( instr - > key ( ) , r2 ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallKeyed ( key ) , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallKeyed ( key ) , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallNamed ( HCallNamed * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallNamed , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallNamed , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallGlobal ( HCallGlobal * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallGlobal , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallGlobal , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallKnownGlobal ( HCallKnownGlobal * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallKnownGlobal , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallKnownGlobal , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallNew ( HCallNew * instr ) { <nl> LOperand * constructor = UseFixed ( instr - > constructor ( ) , r1 ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - LCallNew * result = new LCallNew ( constructor ) ; <nl> + LCallNew * result = new ( zone ( ) ) LCallNew ( constructor ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCallNew ( HCallNew * instr ) { <nl> LInstruction * LChunkBuilder : : DoCallFunction ( HCallFunction * instr ) { <nl> LOperand * function = UseFixed ( instr - > function ( ) , r1 ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallFunction ( function ) , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallFunction ( function ) , r0 ) , <nl> + instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallRuntime ( HCallRuntime * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallRuntime , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallRuntime , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBitwise ( HBitwise * instr ) { <nl> <nl> LOperand * left = UseRegisterAtStart ( instr - > LeastConstantOperand ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > MostConstantOperand ( ) ) ; <nl> - return DefineAsRegister ( new LBitI ( left , right ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LBitI ( left , right ) ) ; <nl> } else { <nl> ASSERT ( instr - > representation ( ) . IsTagged ( ) ) ; <nl> ASSERT ( instr - > left ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoBitwise ( HBitwise * instr ) { <nl> <nl> LOperand * left = UseFixed ( instr - > left ( ) , r1 ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , r0 ) ; <nl> - LArithmeticT * result = new LArithmeticT ( instr - > op ( ) , left , right ) ; <nl> + LArithmeticT * result = new ( zone ( ) ) LArithmeticT ( instr - > op ( ) , left , right ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoBitwise ( HBitwise * instr ) { <nl> LInstruction * LChunkBuilder : : DoBitNot ( HBitNot * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> ASSERT ( instr - > representation ( ) . IsInteger32 ( ) ) ; <nl> - return DefineAsRegister ( new LBitNotI ( UseRegisterAtStart ( instr - > value ( ) ) ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LBitNotI ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoDiv ( HDiv * instr ) { <nl> LOperand * dividend = UseFixed ( instr - > left ( ) , r0 ) ; <nl> LOperand * divisor = UseFixed ( instr - > right ( ) , r1 ) ; <nl> return AssignEnvironment ( AssignPointerMap ( <nl> - DefineFixed ( new LDivI ( dividend , divisor ) , r0 ) ) ) ; <nl> + DefineFixed ( new ( zone ( ) ) LDivI ( dividend , divisor ) , r0 ) ) ) ; <nl> } else { <nl> return DoArithmeticT ( Token : : DIV , instr ) ; <nl> } <nl> LInstruction * LChunkBuilder : : DoMod ( HMod * instr ) { <nl> if ( instr - > HasPowerOf2Divisor ( ) ) { <nl> ASSERT ( ! instr - > CheckFlag ( HValue : : kCanBeDivByZero ) ) ; <nl> LOperand * value = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> - mod = new LModI ( value , UseOrConstant ( instr - > right ( ) ) ) ; <nl> + mod = new ( zone ( ) ) LModI ( value , UseOrConstant ( instr - > right ( ) ) ) ; <nl> } else { <nl> LOperand * dividend = UseRegister ( instr - > left ( ) ) ; <nl> LOperand * divisor = UseRegister ( instr - > right ( ) ) ; <nl> - mod = new LModI ( dividend , <nl> - divisor , <nl> - TempRegister ( ) , <nl> - FixedTemp ( d10 ) , <nl> - FixedTemp ( d11 ) ) ; <nl> + mod = new ( zone ( ) ) LModI ( dividend , <nl> + divisor , <nl> + TempRegister ( ) , <nl> + FixedTemp ( d10 ) , <nl> + FixedTemp ( d11 ) ) ; <nl> } <nl> <nl> if ( instr - > CheckFlag ( HValue : : kBailoutOnMinusZero ) | | <nl> LInstruction * LChunkBuilder : : DoMod ( HMod * instr ) { <nl> / / TODO ( fschneider ) : Allow any register as input registers . <nl> LOperand * left = UseFixedDouble ( instr - > left ( ) , d1 ) ; <nl> LOperand * right = UseFixedDouble ( instr - > right ( ) , d2 ) ; <nl> - LArithmeticD * result = new LArithmeticD ( Token : : MOD , left , right ) ; <nl> + LArithmeticD * result = new ( zone ( ) ) LArithmeticD ( Token : : MOD , left , right ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , d1 ) , instr ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoMul ( HMul * instr ) { <nl> } else { <nl> left = UseRegisterAtStart ( instr - > LeastConstantOperand ( ) ) ; <nl> } <nl> - LMulI * mul = new LMulI ( left , right , temp ) ; <nl> + LMulI * mul = new ( zone ( ) ) LMulI ( left , right , temp ) ; <nl> if ( instr - > CheckFlag ( HValue : : kCanOverflow ) | | <nl> instr - > CheckFlag ( HValue : : kBailoutOnMinusZero ) ) { <nl> AssignEnvironment ( mul ) ; <nl> LInstruction * LChunkBuilder : : DoSub ( HSub * instr ) { <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > right ( ) ) ; <nl> - LSubI * sub = new LSubI ( left , right ) ; <nl> + LSubI * sub = new ( zone ( ) ) LSubI ( left , right ) ; <nl> LInstruction * result = DefineAsRegister ( sub ) ; <nl> if ( instr - > CheckFlag ( HValue : : kCanOverflow ) ) { <nl> result = AssignEnvironment ( result ) ; <nl> LInstruction * LChunkBuilder : : DoAdd ( HAdd * instr ) { <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > LeastConstantOperand ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > MostConstantOperand ( ) ) ; <nl> - LAddI * add = new LAddI ( left , right ) ; <nl> + LAddI * add = new ( zone ( ) ) LAddI ( left , right ) ; <nl> LInstruction * result = DefineAsRegister ( add ) ; <nl> if ( instr - > CheckFlag ( HValue : : kCanOverflow ) ) { <nl> result = AssignEnvironment ( result ) ; <nl> LInstruction * LChunkBuilder : : DoPower ( HPower * instr ) { <nl> LOperand * right = exponent_type . IsDouble ( ) ? <nl> UseFixedDouble ( instr - > right ( ) , d2 ) : <nl> UseFixed ( instr - > right ( ) , r2 ) ; <nl> - LPower * result = new LPower ( left , right ) ; <nl> + LPower * result = new ( zone ( ) ) LPower ( left , right ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , d3 ) , <nl> instr , <nl> CAN_DEOPTIMIZE_EAGERLY ) ; <nl> LInstruction * LChunkBuilder : : DoRandom ( HRandom * instr ) { <nl> ASSERT ( instr - > representation ( ) . IsDouble ( ) ) ; <nl> ASSERT ( instr - > global_object ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * global_object = UseFixed ( instr - > global_object ( ) , r0 ) ; <nl> - LRandom * result = new LRandom ( global_object ) ; <nl> + LRandom * result = new ( zone ( ) ) LRandom ( global_object ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , d7 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCompareGeneric ( HCompareGeneric * instr ) { <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * left = UseFixed ( instr - > left ( ) , r1 ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , r0 ) ; <nl> - LCmpT * result = new LCmpT ( left , right ) ; <nl> + LCmpT * result = new ( zone ( ) ) LCmpT ( left , right ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCompareIDAndBranch ( <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * left = UseRegisterOrConstantAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseRegisterOrConstantAtStart ( instr - > right ( ) ) ; <nl> - return new LCmpIDAndBranch ( left , right ) ; <nl> + return new ( zone ( ) ) LCmpIDAndBranch ( left , right ) ; <nl> } else { <nl> ASSERT ( r . IsDouble ( ) ) ; <nl> ASSERT ( instr - > left ( ) - > representation ( ) . IsDouble ( ) ) ; <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsDouble ( ) ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseRegisterAtStart ( instr - > right ( ) ) ; <nl> - return new LCmpIDAndBranch ( left , right ) ; <nl> + return new ( zone ( ) ) LCmpIDAndBranch ( left , right ) ; <nl> } <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCompareObjectEqAndBranch ( <nl> HCompareObjectEqAndBranch * instr ) { <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseRegisterAtStart ( instr - > right ( ) ) ; <nl> - return new LCmpObjectEqAndBranch ( left , right ) ; <nl> + return new ( zone ( ) ) LCmpObjectEqAndBranch ( left , right ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCompareConstantEqAndBranch ( <nl> HCompareConstantEqAndBranch * instr ) { <nl> - return new LCmpConstantEqAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LCmpConstantEqAndBranch ( value ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsNilAndBranch ( HIsNilAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LIsNilAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> + return new ( zone ( ) ) LIsNilAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsObjectAndBranch ( HIsObjectAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> LOperand * temp = TempRegister ( ) ; <nl> - return new LIsObjectAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) , temp ) ; <nl> + return new ( zone ( ) ) LIsObjectAndBranch ( value , temp ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsStringAndBranch ( HIsStringAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> LOperand * temp = TempRegister ( ) ; <nl> - return new LIsStringAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) , temp ) ; <nl> + return new ( zone ( ) ) LIsStringAndBranch ( value , temp ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsSmiAndBranch ( HIsSmiAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LIsSmiAndBranch ( Use ( instr - > value ( ) ) ) ; <nl> + return new ( zone ( ) ) LIsSmiAndBranch ( Use ( instr - > value ( ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsUndetectableAndBranch ( <nl> HIsUndetectableAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LIsUndetectableAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) , <nl> - TempRegister ( ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LIsUndetectableAndBranch ( value , TempRegister ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringCompareAndBranch ( <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * left = UseFixed ( instr - > left ( ) , r1 ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , r0 ) ; <nl> - LStringCompareAndBranch * result = new LStringCompareAndBranch ( left , right ) ; <nl> + LStringCompareAndBranch * result = <nl> + new ( zone ( ) ) LStringCompareAndBranch ( left , right ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStringCompareAndBranch ( <nl> LInstruction * LChunkBuilder : : DoHasInstanceTypeAndBranch ( <nl> HHasInstanceTypeAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LHasInstanceTypeAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LHasInstanceTypeAndBranch ( value ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGetCachedArrayIndex ( <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> <nl> - return DefineAsRegister ( new LGetCachedArrayIndex ( value ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LGetCachedArrayIndex ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoHasCachedArrayIndexAndBranch ( <nl> HHasCachedArrayIndexAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LHasCachedArrayIndexAndBranch ( <nl> + return new ( zone ( ) ) LHasCachedArrayIndexAndBranch ( <nl> UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoHasCachedArrayIndexAndBranch ( <nl> LInstruction * LChunkBuilder : : DoClassOfTestAndBranch ( <nl> HClassOfTestAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LClassOfTestAndBranch ( UseRegister ( instr - > value ( ) ) , <nl> - TempRegister ( ) ) ; <nl> + LOperand * value = UseRegister ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LClassOfTestAndBranch ( value , TempRegister ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoJSArrayLength ( HJSArrayLength * instr ) { <nl> LOperand * array = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LJSArrayLength ( array ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LJSArrayLength ( array ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoFixedArrayBaseLength ( <nl> HFixedArrayBaseLength * instr ) { <nl> LOperand * array = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LFixedArrayBaseLength ( array ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LFixedArrayBaseLength ( array ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoElementsKind ( HElementsKind * instr ) { <nl> LOperand * object = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LElementsKind ( object ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LElementsKind ( object ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoValueOf ( HValueOf * instr ) { <nl> LOperand * object = UseRegister ( instr - > value ( ) ) ; <nl> - LValueOf * result = new LValueOf ( object , TempRegister ( ) ) ; <nl> + LValueOf * result = new ( zone ( ) ) LValueOf ( object , TempRegister ( ) ) ; <nl> return DefineAsRegister ( result ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBoundsCheck ( HBoundsCheck * instr ) { <nl> - return AssignEnvironment ( new LBoundsCheck ( UseRegisterAtStart ( instr - > index ( ) ) , <nl> - UseRegister ( instr - > length ( ) ) ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > index ( ) ) ; <nl> + LOperand * length = UseRegister ( instr - > length ( ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LBoundsCheck ( value , length ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoAbnormalExit ( HAbnormalExit * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoThrow ( HThrow * instr ) { <nl> LOperand * value = UseFixed ( instr - > value ( ) , r0 ) ; <nl> - return MarkAsCall ( new LThrow ( value ) , instr ) ; <nl> + return MarkAsCall ( new ( zone ( ) ) LThrow ( value ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> if ( from . IsTagged ( ) ) { <nl> if ( to . IsDouble ( ) ) { <nl> LOperand * value = UseRegister ( instr - > value ( ) ) ; <nl> - LNumberUntagD * res = new LNumberUntagD ( value ) ; <nl> + LNumberUntagD * res = new ( zone ( ) ) LNumberUntagD ( value ) ; <nl> return AssignEnvironment ( DefineAsRegister ( res ) ) ; <nl> } else { <nl> ASSERT ( to . IsInteger32 ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> bool needs_check = ! instr - > value ( ) - > type ( ) . IsSmi ( ) ; <nl> LInstruction * res = NULL ; <nl> if ( ! needs_check ) { <nl> - res = DefineAsRegister ( new LSmiUntag ( value , needs_check ) ) ; <nl> + res = DefineAsRegister ( new ( zone ( ) ) LSmiUntag ( value , needs_check ) ) ; <nl> } else { <nl> LOperand * temp1 = TempRegister ( ) ; <nl> LOperand * temp2 = instr - > CanTruncateToInt32 ( ) ? TempRegister ( ) <nl> : NULL ; <nl> LOperand * temp3 = instr - > CanTruncateToInt32 ( ) ? FixedTemp ( d11 ) <nl> : NULL ; <nl> - res = DefineSameAsFirst ( new LTaggedToI ( value , temp1 , temp2 , temp3 ) ) ; <nl> + res = DefineSameAsFirst ( new ( zone ( ) ) LTaggedToI ( value , <nl> + temp1 , <nl> + temp2 , <nl> + temp3 ) ) ; <nl> res = AssignEnvironment ( res ) ; <nl> } <nl> return res ; <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> / / Make sure that the temp and result_temp registers are <nl> / / different . <nl> LUnallocated * result_temp = TempRegister ( ) ; <nl> - LNumberTagD * result = new LNumberTagD ( value , temp1 , temp2 ) ; <nl> + LNumberTagD * result = new ( zone ( ) ) LNumberTagD ( value , temp1 , temp2 ) ; <nl> Define ( result , result_temp ) ; <nl> return AssignPointerMap ( result ) ; <nl> } else { <nl> ASSERT ( to . IsInteger32 ( ) ) ; <nl> LOperand * value = UseRegister ( instr - > value ( ) ) ; <nl> - LDoubleToI * res = <nl> - new LDoubleToI ( value , <nl> - TempRegister ( ) , <nl> - instr - > CanTruncateToInt32 ( ) ? TempRegister ( ) : NULL ) ; <nl> + LOperand * temp1 = TempRegister ( ) ; <nl> + LOperand * temp2 = instr - > CanTruncateToInt32 ( ) ? TempRegister ( ) : NULL ; <nl> + LDoubleToI * res = new ( zone ( ) ) LDoubleToI ( value , temp1 , temp2 ) ; <nl> return AssignEnvironment ( DefineAsRegister ( res ) ) ; <nl> } <nl> } else if ( from . IsInteger32 ( ) ) { <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> HValue * val = instr - > value ( ) ; <nl> LOperand * value = UseRegisterAtStart ( val ) ; <nl> if ( val - > HasRange ( ) & & val - > range ( ) - > IsInSmiRange ( ) ) { <nl> - return DefineAsRegister ( new LSmiTag ( value ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LSmiTag ( value ) ) ; <nl> } else { <nl> - LNumberTagI * result = new LNumberTagI ( value ) ; <nl> + LNumberTagI * result = new ( zone ( ) ) LNumberTagI ( value ) ; <nl> return AssignEnvironment ( AssignPointerMap ( DefineAsRegister ( result ) ) ) ; <nl> } <nl> } else { <nl> ASSERT ( to . IsDouble ( ) ) ; <nl> LOperand * value = Use ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LInteger32ToDouble ( value ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LInteger32ToDouble ( value ) ) ; <nl> } <nl> } <nl> UNREACHABLE ( ) ; <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoCheckNonSmi ( HCheckNonSmi * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return AssignEnvironment ( new LCheckNonSmi ( value ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckNonSmi ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckInstanceType ( HCheckInstanceType * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LInstruction * result = new LCheckInstanceType ( value ) ; <nl> + LInstruction * result = new ( zone ( ) ) LCheckInstanceType ( value ) ; <nl> return AssignEnvironment ( result ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCheckInstanceType ( HCheckInstanceType * instr ) { <nl> LInstruction * LChunkBuilder : : DoCheckPrototypeMaps ( HCheckPrototypeMaps * instr ) { <nl> LOperand * temp1 = TempRegister ( ) ; <nl> LOperand * temp2 = TempRegister ( ) ; <nl> - LInstruction * result = new LCheckPrototypeMaps ( temp1 , temp2 ) ; <nl> + LInstruction * result = new ( zone ( ) ) LCheckPrototypeMaps ( temp1 , temp2 ) ; <nl> return AssignEnvironment ( result ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckSmi ( HCheckSmi * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return AssignEnvironment ( new LCheckSmi ( value ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckSmi ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckFunction ( HCheckFunction * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return AssignEnvironment ( new LCheckFunction ( value ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckFunction ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckMap ( HCheckMap * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LInstruction * result = new LCheckMap ( value ) ; <nl> + LInstruction * result = new ( zone ( ) ) LCheckMap ( value ) ; <nl> return AssignEnvironment ( result ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoClampToUint8 ( HClampToUint8 * instr ) { <nl> Representation input_rep = value - > representation ( ) ; <nl> LOperand * reg = UseRegister ( value ) ; <nl> if ( input_rep . IsDouble ( ) ) { <nl> - return DefineAsRegister ( new LClampDToUint8 ( reg , FixedTemp ( d11 ) ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LClampDToUint8 ( reg , FixedTemp ( d11 ) ) ) ; <nl> } else if ( input_rep . IsInteger32 ( ) ) { <nl> - return DefineAsRegister ( new LClampIToUint8 ( reg ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LClampIToUint8 ( reg ) ) ; <nl> } else { <nl> ASSERT ( input_rep . IsTagged ( ) ) ; <nl> / / Register allocator doesn ' t ( yet ) support allocation of double <nl> / / temps . Reserve d1 explicitly . <nl> - LClampTToUint8 * result = new LClampTToUint8 ( reg , FixedTemp ( d11 ) ) ; <nl> + LClampTToUint8 * result = new ( zone ( ) ) LClampTToUint8 ( reg , FixedTemp ( d11 ) ) ; <nl> return AssignEnvironment ( DefineAsRegister ( result ) ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoToInt32 ( HToInt32 * instr ) { <nl> if ( input_rep . IsDouble ( ) ) { <nl> LOperand * temp1 = TempRegister ( ) ; <nl> LOperand * temp2 = TempRegister ( ) ; <nl> - LDoubleToI * res = new LDoubleToI ( reg , temp1 , temp2 ) ; <nl> + LDoubleToI * res = new ( zone ( ) ) LDoubleToI ( reg , temp1 , temp2 ) ; <nl> return AssignEnvironment ( DefineAsRegister ( res ) ) ; <nl> } else if ( input_rep . IsInteger32 ( ) ) { <nl> / / Canonicalization should already have removed the hydrogen instruction in <nl> LInstruction * LChunkBuilder : : DoToInt32 ( HToInt32 * instr ) { <nl> LOperand * temp1 = TempRegister ( ) ; <nl> LOperand * temp2 = TempRegister ( ) ; <nl> LOperand * temp3 = FixedTemp ( d11 ) ; <nl> - LTaggedToI * res = new LTaggedToI ( reg , temp1 , temp2 , temp3 ) ; <nl> + LTaggedToI * res = new ( zone ( ) ) LTaggedToI ( reg , temp1 , temp2 , temp3 ) ; <nl> return AssignEnvironment ( DefineSameAsFirst ( res ) ) ; <nl> } <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoReturn ( HReturn * instr ) { <nl> - return new LReturn ( UseFixed ( instr - > value ( ) , r0 ) ) ; <nl> + return new ( zone ( ) ) LReturn ( UseFixed ( instr - > value ( ) , r0 ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoConstant ( HConstant * instr ) { <nl> Representation r = instr - > representation ( ) ; <nl> if ( r . IsInteger32 ( ) ) { <nl> - return DefineAsRegister ( new LConstantI ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LConstantI ) ; <nl> } else if ( r . IsDouble ( ) ) { <nl> - return DefineAsRegister ( new LConstantD ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LConstantD ) ; <nl> } else if ( r . IsTagged ( ) ) { <nl> - return DefineAsRegister ( new LConstantT ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LConstantT ) ; <nl> } else { <nl> UNREACHABLE ( ) ; <nl> return NULL ; <nl> LInstruction * LChunkBuilder : : DoConstant ( HConstant * instr ) { <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadGlobalCell ( HLoadGlobalCell * instr ) { <nl> - LLoadGlobalCell * result = new LLoadGlobalCell ; <nl> + LLoadGlobalCell * result = new ( zone ( ) ) LLoadGlobalCell ; <nl> return instr - > RequiresHoleCheck ( ) <nl> ? AssignEnvironment ( DefineAsRegister ( result ) ) <nl> : DefineAsRegister ( result ) ; <nl> LInstruction * LChunkBuilder : : DoLoadGlobalCell ( HLoadGlobalCell * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoLoadGlobalGeneric ( HLoadGlobalGeneric * instr ) { <nl> LOperand * global_object = UseFixed ( instr - > global_object ( ) , r0 ) ; <nl> - LLoadGlobalGeneric * result = new LLoadGlobalGeneric ( global_object ) ; <nl> + LLoadGlobalGeneric * result = new ( zone ( ) ) LLoadGlobalGeneric ( global_object ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreGlobalCell ( HStoreGlobalCell * instr ) { <nl> / / Use a temp to check the value in the cell in the case where we perform <nl> / / a hole check . <nl> return instr - > RequiresHoleCheck ( ) <nl> - ? AssignEnvironment ( new LStoreGlobalCell ( value , TempRegister ( ) ) ) <nl> - : new LStoreGlobalCell ( value , NULL ) ; <nl> + ? AssignEnvironment ( new ( zone ( ) ) LStoreGlobalCell ( value , TempRegister ( ) ) ) <nl> + : new ( zone ( ) ) LStoreGlobalCell ( value , NULL ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreGlobalGeneric ( HStoreGlobalGeneric * instr ) { <nl> LOperand * global_object = UseFixed ( instr - > global_object ( ) , r1 ) ; <nl> LOperand * value = UseFixed ( instr - > value ( ) , r0 ) ; <nl> LStoreGlobalGeneric * result = <nl> - new LStoreGlobalGeneric ( global_object , value ) ; <nl> + new ( zone ( ) ) LStoreGlobalGeneric ( global_object , value ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadContextSlot ( HLoadContextSlot * instr ) { <nl> LOperand * context = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LInstruction * result = DefineAsRegister ( new LLoadContextSlot ( context ) ) ; <nl> + LInstruction * result = <nl> + DefineAsRegister ( new ( zone ( ) ) LLoadContextSlot ( context ) ) ; <nl> return instr - > RequiresHoleCheck ( ) ? AssignEnvironment ( result ) : result ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreContextSlot ( HStoreContextSlot * instr ) { <nl> context = UseRegister ( instr - > context ( ) ) ; <nl> value = UseRegister ( instr - > value ( ) ) ; <nl> } <nl> - LInstruction * result = new LStoreContextSlot ( context , value ) ; <nl> + LInstruction * result = new ( zone ( ) ) LStoreContextSlot ( context , value ) ; <nl> return instr - > RequiresHoleCheck ( ) ? AssignEnvironment ( result ) : result ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadNamedField ( HLoadNamedField * instr ) { <nl> return DefineAsRegister ( <nl> - new LLoadNamedField ( UseRegisterAtStart ( instr - > object ( ) ) ) ) ; <nl> + new ( zone ( ) ) LLoadNamedField ( UseRegisterAtStart ( instr - > object ( ) ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadNamedFieldPolymorphic ( <nl> ASSERT ( instr - > representation ( ) . IsTagged ( ) ) ; <nl> if ( instr - > need_generic ( ) ) { <nl> LOperand * obj = UseFixed ( instr - > object ( ) , r0 ) ; <nl> - LLoadNamedFieldPolymorphic * result = new LLoadNamedFieldPolymorphic ( obj ) ; <nl> + LLoadNamedFieldPolymorphic * result = <nl> + new ( zone ( ) ) LLoadNamedFieldPolymorphic ( obj ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } else { <nl> LOperand * obj = UseRegisterAtStart ( instr - > object ( ) ) ; <nl> - LLoadNamedFieldPolymorphic * result = new LLoadNamedFieldPolymorphic ( obj ) ; <nl> + LLoadNamedFieldPolymorphic * result = <nl> + new ( zone ( ) ) LLoadNamedFieldPolymorphic ( obj ) ; <nl> return AssignEnvironment ( DefineAsRegister ( result ) ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoLoadNamedFieldPolymorphic ( <nl> <nl> LInstruction * LChunkBuilder : : DoLoadNamedGeneric ( HLoadNamedGeneric * instr ) { <nl> LOperand * object = UseFixed ( instr - > object ( ) , r0 ) ; <nl> - LInstruction * result = DefineFixed ( new LLoadNamedGeneric ( object ) , r0 ) ; <nl> + LInstruction * result = DefineFixed ( new ( zone ( ) ) LLoadNamedGeneric ( object ) , r0 ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoLoadNamedGeneric ( HLoadNamedGeneric * instr ) { <nl> LInstruction * LChunkBuilder : : DoLoadFunctionPrototype ( <nl> HLoadFunctionPrototype * instr ) { <nl> return AssignEnvironment ( DefineAsRegister ( <nl> - new LLoadFunctionPrototype ( UseRegister ( instr - > function ( ) ) ) ) ) ; <nl> + new ( zone ( ) ) LLoadFunctionPrototype ( UseRegister ( instr - > function ( ) ) ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadElements ( HLoadElements * instr ) { <nl> LOperand * input = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LLoadElements ( input ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LLoadElements ( input ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadExternalArrayPointer ( <nl> HLoadExternalArrayPointer * instr ) { <nl> LOperand * input = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LLoadExternalArrayPointer ( input ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LLoadExternalArrayPointer ( input ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedFastElement ( <nl> ASSERT ( instr - > key ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * obj = UseRegisterAtStart ( instr - > object ( ) ) ; <nl> LOperand * key = UseRegisterAtStart ( instr - > key ( ) ) ; <nl> - LLoadKeyedFastElement * result = new LLoadKeyedFastElement ( obj , key ) ; <nl> + LLoadKeyedFastElement * result = new ( zone ( ) ) LLoadKeyedFastElement ( obj , key ) ; <nl> if ( instr - > RequiresHoleCheck ( ) ) AssignEnvironment ( result ) ; <nl> return DefineAsRegister ( result ) ; <nl> } <nl> LInstruction * LChunkBuilder : : DoLoadKeyedFastDoubleElement ( <nl> LOperand * elements = UseTempRegister ( instr - > elements ( ) ) ; <nl> LOperand * key = UseRegisterOrConstantAtStart ( instr - > key ( ) ) ; <nl> LLoadKeyedFastDoubleElement * result = <nl> - new LLoadKeyedFastDoubleElement ( elements , key ) ; <nl> + new ( zone ( ) ) LLoadKeyedFastDoubleElement ( elements , key ) ; <nl> return AssignEnvironment ( DefineAsRegister ( result ) ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedSpecializedArrayElement ( <nl> LOperand * external_pointer = UseRegister ( instr - > external_pointer ( ) ) ; <nl> LOperand * key = UseRegisterOrConstant ( instr - > key ( ) ) ; <nl> LLoadKeyedSpecializedArrayElement * result = <nl> - new LLoadKeyedSpecializedArrayElement ( external_pointer , key ) ; <nl> + new ( zone ( ) ) LLoadKeyedSpecializedArrayElement ( external_pointer , key ) ; <nl> LInstruction * load_instr = DefineAsRegister ( result ) ; <nl> / / An unsigned int array load might overflow and cause a deopt , make sure it <nl> / / has an environment . <nl> LInstruction * LChunkBuilder : : DoLoadKeyedGeneric ( HLoadKeyedGeneric * instr ) { <nl> LOperand * key = UseFixed ( instr - > key ( ) , r0 ) ; <nl> <nl> LInstruction * result = <nl> - DefineFixed ( new LLoadKeyedGeneric ( object , key ) , r0 ) ; <nl> + DefineFixed ( new ( zone ( ) ) LLoadKeyedGeneric ( object , key ) , r0 ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedFastElement ( <nl> LOperand * key = needs_write_barrier <nl> ? UseTempRegister ( instr - > key ( ) ) <nl> : UseRegisterOrConstantAtStart ( instr - > key ( ) ) ; <nl> - return new LStoreKeyedFastElement ( obj , key , val ) ; <nl> + return new ( zone ( ) ) LStoreKeyedFastElement ( obj , key , val ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedFastDoubleElement ( <nl> LOperand * val = UseTempRegister ( instr - > value ( ) ) ; <nl> LOperand * key = UseRegisterOrConstantAtStart ( instr - > key ( ) ) ; <nl> <nl> - return new LStoreKeyedFastDoubleElement ( elements , key , val ) ; <nl> + return new ( zone ( ) ) LStoreKeyedFastDoubleElement ( elements , key , val ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedSpecializedArrayElement ( <nl> : UseRegister ( instr - > value ( ) ) ; <nl> LOperand * key = UseRegisterOrConstant ( instr - > key ( ) ) ; <nl> <nl> - return new LStoreKeyedSpecializedArrayElement ( external_pointer , <nl> - key , <nl> - val ) ; <nl> + return new ( zone ( ) ) LStoreKeyedSpecializedArrayElement ( external_pointer , <nl> + key , <nl> + val ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedGeneric ( HStoreKeyedGeneric * instr ) { <nl> ASSERT ( instr - > key ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> <nl> - return MarkAsCall ( new LStoreKeyedGeneric ( obj , key , val ) , instr ) ; <nl> + return MarkAsCall ( new ( zone ( ) ) LStoreKeyedGeneric ( obj , key , val ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoTransitionElementsKind ( <nl> LOperand * object = UseRegister ( instr - > object ( ) ) ; <nl> LOperand * new_map_reg = TempRegister ( ) ; <nl> LTransitionElementsKind * result = <nl> - new LTransitionElementsKind ( object , new_map_reg , NULL ) ; <nl> + new ( zone ( ) ) LTransitionElementsKind ( object , new_map_reg , NULL ) ; <nl> return DefineSameAsFirst ( result ) ; <nl> } else { <nl> LOperand * object = UseFixed ( instr - > object ( ) , r0 ) ; <nl> LOperand * fixed_object_reg = FixedTemp ( r2 ) ; <nl> LOperand * new_map_reg = FixedTemp ( r3 ) ; <nl> LTransitionElementsKind * result = <nl> - new LTransitionElementsKind ( object , new_map_reg , fixed_object_reg ) ; <nl> + new ( zone ( ) ) LTransitionElementsKind ( object , <nl> + new_map_reg , <nl> + fixed_object_reg ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoStoreNamedField ( HStoreNamedField * instr ) { <nl> ? UseTempRegister ( instr - > value ( ) ) <nl> : UseRegister ( instr - > value ( ) ) ; <nl> <nl> - return new LStoreNamedField ( obj , val ) ; <nl> + return new ( zone ( ) ) LStoreNamedField ( obj , val ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreNamedGeneric ( HStoreNamedGeneric * instr ) { <nl> LOperand * obj = UseFixed ( instr - > object ( ) , r1 ) ; <nl> LOperand * val = UseFixed ( instr - > value ( ) , r0 ) ; <nl> <nl> - LInstruction * result = new LStoreNamedGeneric ( obj , val ) ; <nl> + LInstruction * result = new ( zone ( ) ) LStoreNamedGeneric ( obj , val ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreNamedGeneric ( HStoreNamedGeneric * instr ) { <nl> LInstruction * LChunkBuilder : : DoStringAdd ( HStringAdd * instr ) { <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseRegisterAtStart ( instr - > right ( ) ) ; <nl> - return MarkAsCall ( DefineFixed ( new LStringAdd ( left , right ) , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LStringAdd ( left , right ) , r0 ) , <nl> + instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringCharCodeAt ( HStringCharCodeAt * instr ) { <nl> LOperand * string = UseTempRegister ( instr - > string ( ) ) ; <nl> LOperand * index = UseTempRegister ( instr - > index ( ) ) ; <nl> - LStringCharCodeAt * result = new LStringCharCodeAt ( string , index ) ; <nl> + LStringCharCodeAt * result = new ( zone ( ) ) LStringCharCodeAt ( string , index ) ; <nl> return AssignEnvironment ( AssignPointerMap ( DefineAsRegister ( result ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringCharFromCode ( HStringCharFromCode * instr ) { <nl> LOperand * char_code = UseRegister ( instr - > value ( ) ) ; <nl> - LStringCharFromCode * result = new LStringCharFromCode ( char_code ) ; <nl> + LStringCharFromCode * result = new ( zone ( ) ) LStringCharFromCode ( char_code ) ; <nl> return AssignPointerMap ( DefineAsRegister ( result ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringLength ( HStringLength * instr ) { <nl> LOperand * string = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LStringLength ( string ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LStringLength ( string ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoAllocateObject ( HAllocateObject * instr ) { <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoFastLiteral ( HFastLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LFastLiteral , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LFastLiteral , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoArrayLiteral ( HArrayLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LArrayLiteral , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LArrayLiteral , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoObjectLiteral ( HObjectLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LObjectLiteral , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LObjectLiteral , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoRegExpLiteral ( HRegExpLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LRegExpLiteral , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LRegExpLiteral , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoFunctionLiteral ( HFunctionLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LFunctionLiteral , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LFunctionLiteral , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoDeleteProperty ( HDeleteProperty * instr ) { <nl> LOperand * object = UseFixed ( instr - > object ( ) , r0 ) ; <nl> LOperand * key = UseFixed ( instr - > key ( ) , r1 ) ; <nl> - LDeleteProperty * result = new LDeleteProperty ( object , key ) ; <nl> + LDeleteProperty * result = new ( zone ( ) ) LDeleteProperty ( object , key ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoDeleteProperty ( HDeleteProperty * instr ) { <nl> LInstruction * LChunkBuilder : : DoOsrEntry ( HOsrEntry * instr ) { <nl> allocator_ - > MarkAsOsrEntry ( ) ; <nl> current_block_ - > last_environment ( ) - > set_ast_id ( instr - > ast_id ( ) ) ; <nl> - return AssignEnvironment ( new LOsrEntry ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LOsrEntry ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoParameter ( HParameter * instr ) { <nl> int spill_index = chunk ( ) - > GetParameterStackSlot ( instr - > index ( ) ) ; <nl> - return DefineAsSpilled ( new LParameter , spill_index ) ; <nl> + return DefineAsSpilled ( new ( zone ( ) ) LParameter , spill_index ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoUnknownOSRValue ( HUnknownOSRValue * instr ) { <nl> Abort ( " Too many spill slots needed for OSR " ) ; <nl> spill_index = 0 ; <nl> } <nl> - return DefineAsSpilled ( new LUnknownOSRValue , spill_index ) ; <nl> + return DefineAsSpilled ( new ( zone ( ) ) LUnknownOSRValue , spill_index ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallStub ( HCallStub * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallStub , r0 ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallStub , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoAccessArgumentsAt ( HAccessArgumentsAt * instr ) { <nl> LOperand * arguments = UseRegister ( instr - > arguments ( ) ) ; <nl> LOperand * length = UseTempRegister ( instr - > length ( ) ) ; <nl> LOperand * index = UseRegister ( instr - > index ( ) ) ; <nl> - LAccessArgumentsAt * result = new LAccessArgumentsAt ( arguments , length , index ) ; <nl> + LAccessArgumentsAt * result = <nl> + new ( zone ( ) ) LAccessArgumentsAt ( arguments , length , index ) ; <nl> return AssignEnvironment ( DefineAsRegister ( result ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoToFastProperties ( HToFastProperties * instr ) { <nl> LOperand * object = UseFixed ( instr - > value ( ) , r0 ) ; <nl> - LToFastProperties * result = new LToFastProperties ( object ) ; <nl> + LToFastProperties * result = new ( zone ( ) ) LToFastProperties ( object ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoTypeof ( HTypeof * instr ) { <nl> - LTypeof * result = new LTypeof ( UseFixed ( instr - > value ( ) , r0 ) ) ; <nl> + LTypeof * result = new ( zone ( ) ) LTypeof ( UseFixed ( instr - > value ( ) , r0 ) ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoTypeofIsAndBranch ( HTypeofIsAndBranch * instr ) { <nl> - return new LTypeofIsAndBranch ( UseTempRegister ( instr - > value ( ) ) ) ; <nl> + return new ( zone ( ) ) LTypeofIsAndBranch ( UseTempRegister ( instr - > value ( ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsConstructCallAndBranch ( <nl> HIsConstructCallAndBranch * instr ) { <nl> - return new LIsConstructCallAndBranch ( TempRegister ( ) ) ; <nl> + return new ( zone ( ) ) LIsConstructCallAndBranch ( TempRegister ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoSimulate ( HSimulate * instr ) { <nl> / / If there is an instruction pending deoptimization environment create a <nl> / / lazy bailout instruction to capture the environment . <nl> if ( pending_deoptimization_ast_id_ = = instr - > ast_id ( ) ) { <nl> - LInstruction * result = new LLazyBailout ; <nl> + LInstruction * result = new ( zone ( ) ) LLazyBailout ; <nl> result = AssignEnvironment ( result ) ; <nl> instruction_pending_deoptimization_environment_ - > <nl> set_deoptimization_environment ( result - > environment ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoSimulate ( HSimulate * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoStackCheck ( HStackCheck * instr ) { <nl> if ( instr - > is_function_entry ( ) ) { <nl> - return MarkAsCall ( new LStackCheck , instr ) ; <nl> + return MarkAsCall ( new ( zone ( ) ) LStackCheck , instr ) ; <nl> } else { <nl> ASSERT ( instr - > is_backwards_branch ( ) ) ; <nl> - return AssignEnvironment ( AssignPointerMap ( new LStackCheck ) ) ; <nl> + return AssignEnvironment ( AssignPointerMap ( new ( zone ( ) ) LStackCheck ) ) ; <nl> } <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoLeaveInlined ( HLeaveInlined * instr ) { <nl> LInstruction * LChunkBuilder : : DoIn ( HIn * instr ) { <nl> LOperand * key = UseRegisterAtStart ( instr - > key ( ) ) ; <nl> LOperand * object = UseRegisterAtStart ( instr - > object ( ) ) ; <nl> - LIn * result = new LIn ( key , object ) ; <nl> + LIn * result = new ( zone ( ) ) LIn ( key , object ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoForInPrepareMap ( HForInPrepareMap * instr ) { <nl> LOperand * object = UseFixed ( instr - > enumerable ( ) , r0 ) ; <nl> - LForInPrepareMap * result = new LForInPrepareMap ( object ) ; <nl> + LForInPrepareMap * result = new ( zone ( ) ) LForInPrepareMap ( object ) ; <nl> return MarkAsCall ( DefineFixed ( result , r0 ) , instr , CAN_DEOPTIMIZE_EAGERLY ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoForInPrepareMap ( HForInPrepareMap * instr ) { <nl> LInstruction * LChunkBuilder : : DoForInCacheArray ( HForInCacheArray * instr ) { <nl> LOperand * map = UseRegister ( instr - > map ( ) ) ; <nl> return AssignEnvironment ( DefineAsRegister ( <nl> - new LForInCacheArray ( map ) ) ) ; <nl> + new ( zone ( ) ) LForInCacheArray ( map ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckMapValue ( HCheckMapValue * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> LOperand * map = UseRegisterAtStart ( instr - > map ( ) ) ; <nl> - return AssignEnvironment ( new LCheckMapValue ( value , map ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckMapValue ( value , map ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadFieldByIndex ( HLoadFieldByIndex * instr ) { <nl> LOperand * object = UseRegister ( instr - > object ( ) ) ; <nl> LOperand * index = UseRegister ( instr - > index ( ) ) ; <nl> - return DefineAsRegister ( new LLoadFieldByIndex ( object , index ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LLoadFieldByIndex ( object , index ) ) ; <nl> } <nl> <nl> <nl> mmm a / src / arm / lithium - arm . h <nl> ppp b / src / arm / lithium - arm . h <nl> class LChunkBuilder BASE_EMBEDDED { <nl> : chunk_ ( NULL ) , <nl> info_ ( info ) , <nl> graph_ ( graph ) , <nl> + zone_ ( graph - > isolate ( ) - > zone ( ) ) , <nl> status_ ( UNUSED ) , <nl> current_instruction_ ( NULL ) , <nl> current_block_ ( NULL ) , <nl> class LChunkBuilder BASE_EMBEDDED { <nl> LChunk * chunk ( ) const { return chunk_ ; } <nl> CompilationInfo * info ( ) const { return info_ ; } <nl> HGraph * graph ( ) const { return graph_ ; } <nl> + Zone * zone ( ) const { return zone_ ; } <nl> <nl> bool is_unused ( ) const { return status_ = = UNUSED ; } <nl> bool is_building ( ) const { return status_ = = BUILDING ; } <nl> class LChunkBuilder BASE_EMBEDDED { <nl> LChunk * chunk_ ; <nl> CompilationInfo * info_ ; <nl> HGraph * const graph_ ; <nl> + Zone * zone_ ; <nl> Status status_ ; <nl> HInstruction * current_instruction_ ; <nl> HBasicBlock * current_block_ ; <nl> mmm a / src / ia32 / lithium - ia32 . h <nl> ppp b / src / ia32 / lithium - ia32 . h <nl> class LChunkBuilder BASE_EMBEDDED { <nl> : chunk_ ( NULL ) , <nl> info_ ( info ) , <nl> graph_ ( graph ) , <nl> - isolate_ ( graph - > isolate ( ) ) , <nl> + zone_ ( graph - > isolate ( ) - > zone ( ) ) , <nl> status_ ( UNUSED ) , <nl> current_instruction_ ( NULL ) , <nl> current_block_ ( NULL ) , <nl> class LChunkBuilder BASE_EMBEDDED { <nl> LChunk * chunk ( ) const { return chunk_ ; } <nl> CompilationInfo * info ( ) const { return info_ ; } <nl> HGraph * graph ( ) const { return graph_ ; } <nl> - Zone * zone ( ) { return isolate_ - > zone ( ) ; } <nl> + Zone * zone ( ) { return zone_ ; } <nl> <nl> bool is_unused ( ) const { return status_ = = UNUSED ; } <nl> bool is_building ( ) const { return status_ = = BUILDING ; } <nl> class LChunkBuilder BASE_EMBEDDED { <nl> LChunk * chunk_ ; <nl> CompilationInfo * info_ ; <nl> HGraph * const graph_ ; <nl> - Isolate * isolate_ ; <nl> + Zone * zone_ ; <nl> Status status_ ; <nl> HInstruction * current_instruction_ ; <nl> HBasicBlock * current_block_ ; <nl> mmm a / src / x64 / lithium - x64 . cc <nl> ppp b / src / x64 / lithium - x64 . cc <nl> void LTransitionElementsKind : : PrintDataTo ( StringStream * stream ) { <nl> <nl> <nl> void LChunk : : AddInstruction ( LInstruction * instr , HBasicBlock * block ) { <nl> - LInstructionGap * gap = new LInstructionGap ( block ) ; <nl> + LInstructionGap * gap = new ( graph_ - > zone ( ) ) LInstructionGap ( block ) ; <nl> int index = - 1 ; <nl> if ( instr - > IsControl ( ) ) { <nl> instructions_ . Add ( gap ) ; <nl> Representation LChunk : : LookupLiteralRepresentation ( <nl> <nl> LChunk * LChunkBuilder : : Build ( ) { <nl> ASSERT ( is_unused ( ) ) ; <nl> - chunk_ = new LChunk ( info ( ) , graph ( ) ) ; <nl> + chunk_ = new ( zone ( ) ) LChunk ( info ( ) , graph ( ) ) ; <nl> HPhase phase ( " Building chunk " , chunk_ ) ; <nl> status_ = BUILDING ; <nl> const ZoneList < HBasicBlock * > * blocks = graph ( ) - > blocks ( ) ; <nl> void LChunkBuilder : : Abort ( const char * format , . . . ) { <nl> <nl> <nl> LUnallocated * LChunkBuilder : : ToUnallocated ( Register reg ) { <nl> - return new LUnallocated ( LUnallocated : : FIXED_REGISTER , <nl> - Register : : ToAllocationIndex ( reg ) ) ; <nl> + return new ( zone ( ) ) LUnallocated ( LUnallocated : : FIXED_REGISTER , <nl> + Register : : ToAllocationIndex ( reg ) ) ; <nl> } <nl> <nl> <nl> LUnallocated * LChunkBuilder : : ToUnallocated ( XMMRegister reg ) { <nl> - return new LUnallocated ( LUnallocated : : FIXED_DOUBLE_REGISTER , <nl> - XMMRegister : : ToAllocationIndex ( reg ) ) ; <nl> + return new ( zone ( ) ) LUnallocated ( LUnallocated : : FIXED_DOUBLE_REGISTER , <nl> + XMMRegister : : ToAllocationIndex ( reg ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseFixedDouble ( HValue * value , XMMRegister reg ) { <nl> <nl> <nl> LOperand * LChunkBuilder : : UseRegister ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseRegisterAtStart ( HValue * value ) { <nl> return Use ( value , <nl> - new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER , <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER , <nl> LUnallocated : : USED_AT_START ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseTempRegister ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : WRITABLE_REGISTER ) ) ; <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : WRITABLE_REGISTER ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : Use ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : NONE ) ) ; <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : NONE ) ) ; <nl> } <nl> <nl> <nl> LOperand * LChunkBuilder : : UseAtStart ( HValue * value ) { <nl> - return Use ( value , new LUnallocated ( LUnallocated : : NONE , <nl> + return Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : NONE , <nl> LUnallocated : : USED_AT_START ) ) ; <nl> } <nl> <nl> LOperand * LChunkBuilder : : UseRegisterOrConstantAtStart ( HValue * value ) { <nl> LOperand * LChunkBuilder : : UseAny ( HValue * value ) { <nl> return value - > IsConstant ( ) <nl> ? chunk_ - > DefineConstantOperand ( HConstant : : cast ( value ) ) <nl> - : Use ( value , new LUnallocated ( LUnallocated : : ANY ) ) ; <nl> + : Use ( value , new ( zone ( ) ) LUnallocated ( LUnallocated : : ANY ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : Define ( LTemplateInstruction < 1 , I , T > * instr , <nl> template < int I , int T > <nl> LInstruction * LChunkBuilder : : DefineAsRegister ( <nl> LTemplateInstruction < 1 , I , T > * instr ) { <nl> - return Define ( instr , new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> + return Define ( instr , <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ) ; <nl> } <nl> <nl> <nl> template < int I , int T > <nl> LInstruction * LChunkBuilder : : DefineAsSpilled ( <nl> LTemplateInstruction < 1 , I , T > * instr , <nl> int index ) { <nl> - return Define ( instr , new LUnallocated ( LUnallocated : : FIXED_SLOT , index ) ) ; <nl> + return Define ( instr , <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : FIXED_SLOT , index ) ) ; <nl> } <nl> <nl> <nl> template < int I , int T > <nl> LInstruction * LChunkBuilder : : DefineSameAsFirst ( <nl> LTemplateInstruction < 1 , I , T > * instr ) { <nl> - return Define ( instr , new LUnallocated ( LUnallocated : : SAME_AS_FIRST_INPUT ) ) ; <nl> + return Define ( instr , <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : SAME_AS_FIRST_INPUT ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : MarkAsSaveDoubles ( LInstruction * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : AssignPointerMap ( LInstruction * instr ) { <nl> ASSERT ( ! instr - > HasPointerMap ( ) ) ; <nl> - instr - > set_pointer_map ( new LPointerMap ( position_ ) ) ; <nl> + instr - > set_pointer_map ( new ( zone ( ) ) LPointerMap ( position_ ) ) ; <nl> return instr ; <nl> } <nl> <nl> <nl> LUnallocated * LChunkBuilder : : TempRegister ( ) { <nl> - LUnallocated * operand = new LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ; <nl> + LUnallocated * operand = <nl> + new ( zone ( ) ) LUnallocated ( LUnallocated : : MUST_HAVE_REGISTER ) ; <nl> operand - > set_virtual_register ( allocator_ - > GetVirtualRegister ( ) ) ; <nl> if ( ! allocator_ - > AllocationOk ( ) ) Abort ( " Not enough virtual registers . " ) ; <nl> return operand ; <nl> LOperand * LChunkBuilder : : FixedTemp ( XMMRegister reg ) { <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBlockEntry ( HBlockEntry * instr ) { <nl> - return new LLabel ( instr - > block ( ) ) ; <nl> + return new ( zone ( ) ) LLabel ( instr - > block ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoSoftDeoptimize ( HSoftDeoptimize * instr ) { <nl> - return AssignEnvironment ( new LDeoptimize ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LDeoptimize ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoDeoptimize ( HDeoptimize * instr ) { <nl> - return AssignEnvironment ( new LDeoptimize ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LDeoptimize ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoShift ( Token : : Value op , <nl> <nl> LOperand * left = UseFixed ( instr - > left ( ) , rdx ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , rax ) ; <nl> - LArithmeticT * result = new LArithmeticT ( op , left , right ) ; <nl> + LArithmeticT * result = new ( zone ( ) ) LArithmeticT ( op , left , right ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoShift ( Token : : Value op , <nl> } <nl> <nl> LInstruction * result = <nl> - DefineSameAsFirst ( new LShiftI ( op , left , right , does_deopt ) ) ; <nl> + DefineSameAsFirst ( new ( zone ( ) ) LShiftI ( op , left , right , does_deopt ) ) ; <nl> return does_deopt ? AssignEnvironment ( result ) : result ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoArithmeticD ( Token : : Value op , <nl> ASSERT ( op ! = Token : : MOD ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseRegisterAtStart ( instr - > right ( ) ) ; <nl> - LArithmeticD * result = new LArithmeticD ( op , left , right ) ; <nl> + LArithmeticD * result = new ( zone ( ) ) LArithmeticD ( op , left , right ) ; <nl> return DefineSameAsFirst ( result ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoArithmeticT ( Token : : Value op , <nl> ASSERT ( right - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * left_operand = UseFixed ( left , rdx ) ; <nl> LOperand * right_operand = UseFixed ( right , rax ) ; <nl> - LArithmeticT * result = new LArithmeticT ( op , left_operand , right_operand ) ; <nl> + LArithmeticT * result = <nl> + new ( zone ( ) ) LArithmeticT ( op , left_operand , right_operand ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LEnvironment * LChunkBuilder : : CreateEnvironment ( <nl> ASSERT ( ast_id ! = AstNode : : kNoNumber | | <nl> hydrogen_env - > frame_type ( ) ! = JS_FUNCTION ) ; <nl> int value_count = hydrogen_env - > length ( ) ; <nl> - LEnvironment * result = new LEnvironment ( hydrogen_env - > closure ( ) , <nl> - hydrogen_env - > frame_type ( ) , <nl> - ast_id , <nl> - hydrogen_env - > parameter_count ( ) , <nl> - argument_count_ , <nl> - value_count , <nl> - outer ) ; <nl> + LEnvironment * result = new ( zone ( ) ) LEnvironment ( <nl> + hydrogen_env - > closure ( ) , <nl> + hydrogen_env - > frame_type ( ) , <nl> + ast_id , <nl> + hydrogen_env - > parameter_count ( ) , <nl> + argument_count_ , <nl> + value_count , <nl> + outer ) ; <nl> int argument_index = * argument_index_accumulator ; <nl> for ( int i = 0 ; i < value_count ; + + i ) { <nl> if ( hydrogen_env - > is_special_index ( i ) ) continue ; <nl> LEnvironment * LChunkBuilder : : CreateEnvironment ( <nl> if ( value - > IsArgumentsObject ( ) ) { <nl> op = NULL ; <nl> } else if ( value - > IsPushArgument ( ) ) { <nl> - op = new LArgument ( argument_index + + ) ; <nl> + op = new ( zone ( ) ) LArgument ( argument_index + + ) ; <nl> } else { <nl> op = UseAny ( value ) ; <nl> } <nl> LEnvironment * LChunkBuilder : : CreateEnvironment ( <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGoto ( HGoto * instr ) { <nl> - return new LGoto ( instr - > FirstSuccessor ( ) - > block_id ( ) ) ; <nl> + return new ( zone ( ) ) LGoto ( instr - > FirstSuccessor ( ) - > block_id ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBranch ( HBranch * instr ) { <nl> HBasicBlock * successor = HConstant : : cast ( value ) - > ToBoolean ( ) <nl> ? instr - > FirstSuccessor ( ) <nl> : instr - > SecondSuccessor ( ) ; <nl> - return new LGoto ( successor - > block_id ( ) ) ; <nl> + return new ( zone ( ) ) LGoto ( successor - > block_id ( ) ) ; <nl> } <nl> <nl> - LBranch * result = new LBranch ( UseRegister ( value ) ) ; <nl> + LBranch * result = new ( zone ( ) ) LBranch ( UseRegister ( value ) ) ; <nl> / / Tagged values that are not known smis or booleans require a <nl> / / deoptimization environment . <nl> Representation rep = value - > representation ( ) ; <nl> LInstruction * LChunkBuilder : : DoBranch ( HBranch * instr ) { <nl> LInstruction * LChunkBuilder : : DoCompareMap ( HCompareMap * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return new LCmpMapAndBranch ( value ) ; <nl> + return new ( zone ( ) ) LCmpMapAndBranch ( value ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoArgumentsLength ( HArgumentsLength * length ) { <nl> - return DefineAsRegister ( new LArgumentsLength ( Use ( length - > value ( ) ) ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LArgumentsLength ( Use ( length - > value ( ) ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoArgumentsElements ( HArgumentsElements * elems ) { <nl> - return DefineAsRegister ( new LArgumentsElements ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LArgumentsElements ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoInstanceOf ( HInstanceOf * instr ) { <nl> LOperand * left = UseFixed ( instr - > left ( ) , rax ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , rdx ) ; <nl> - LInstanceOf * result = new LInstanceOf ( left , right ) ; <nl> + LInstanceOf * result = new ( zone ( ) ) LInstanceOf ( left , right ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoInstanceOf ( HInstanceOf * instr ) { <nl> LInstruction * LChunkBuilder : : DoInstanceOfKnownGlobal ( <nl> HInstanceOfKnownGlobal * instr ) { <nl> LInstanceOfKnownGlobal * result = <nl> - new LInstanceOfKnownGlobal ( UseFixed ( instr - > left ( ) , rax ) , <nl> - FixedTemp ( rdi ) ) ; <nl> + new ( zone ( ) ) LInstanceOfKnownGlobal ( UseFixed ( instr - > left ( ) , rax ) , <nl> + FixedTemp ( rdi ) ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoApplyArguments ( HApplyArguments * instr ) { <nl> LOperand * receiver = UseFixed ( instr - > receiver ( ) , rax ) ; <nl> LOperand * length = UseFixed ( instr - > length ( ) , rbx ) ; <nl> LOperand * elements = UseFixed ( instr - > elements ( ) , rcx ) ; <nl> - LApplyArguments * result = new LApplyArguments ( function , <nl> + LApplyArguments * result = new ( zone ( ) ) LApplyArguments ( function , <nl> receiver , <nl> length , <nl> elements ) ; <nl> LInstruction * LChunkBuilder : : DoApplyArguments ( HApplyArguments * instr ) { <nl> LInstruction * LChunkBuilder : : DoPushArgument ( HPushArgument * instr ) { <nl> + + argument_count_ ; <nl> LOperand * argument = UseOrConstant ( instr - > argument ( ) ) ; <nl> - return new LPushArgument ( argument ) ; <nl> + return new ( zone ( ) ) LPushArgument ( argument ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoThisFunction ( HThisFunction * instr ) { <nl> - return instr - > HasNoUses ( ) ? NULL : DefineAsRegister ( new LThisFunction ) ; <nl> + return instr - > HasNoUses ( ) <nl> + ? NULL <nl> + : DefineAsRegister ( new ( zone ( ) ) LThisFunction ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoContext ( HContext * instr ) { <nl> - return instr - > HasNoUses ( ) ? NULL : DefineAsRegister ( new LContext ) ; <nl> + return instr - > HasNoUses ( ) ? NULL : DefineAsRegister ( new ( zone ( ) ) LContext ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoOuterContext ( HOuterContext * instr ) { <nl> LOperand * context = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LOuterContext ( context ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LOuterContext ( context ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoDeclareGlobals ( HDeclareGlobals * instr ) { <nl> - return MarkAsCall ( new LDeclareGlobals , instr ) ; <nl> + return MarkAsCall ( new ( zone ( ) ) LDeclareGlobals , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGlobalObject ( HGlobalObject * instr ) { <nl> - return DefineAsRegister ( new LGlobalObject ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LGlobalObject ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGlobalReceiver ( HGlobalReceiver * instr ) { <nl> LOperand * global_object = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LGlobalReceiver ( global_object ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LGlobalReceiver ( global_object ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallConstantFunction ( <nl> HCallConstantFunction * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallConstantFunction , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallConstantFunction , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoInvokeFunction ( HInvokeFunction * instr ) { <nl> LOperand * function = UseFixed ( instr - > function ( ) , rdi ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - LInvokeFunction * result = new LInvokeFunction ( function ) ; <nl> + LInvokeFunction * result = new ( zone ( ) ) LInvokeFunction ( function ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr , CANNOT_DEOPTIMIZE_EAGERLY ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoUnaryMathOperation ( HUnaryMathOperation * instr ) { <nl> BuiltinFunctionId op = instr - > op ( ) ; <nl> if ( op = = kMathLog | | op = = kMathSin | | op = = kMathCos ) { <nl> LOperand * input = UseFixedDouble ( instr - > value ( ) , xmm1 ) ; <nl> - LUnaryMathOperation * result = new LUnaryMathOperation ( input ) ; <nl> + LUnaryMathOperation * result = new ( zone ( ) ) LUnaryMathOperation ( input ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , xmm1 ) , instr ) ; <nl> } else { <nl> LOperand * input = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LUnaryMathOperation * result = new LUnaryMathOperation ( input ) ; <nl> + LUnaryMathOperation * result = new ( zone ( ) ) LUnaryMathOperation ( input ) ; <nl> switch ( op ) { <nl> case kMathAbs : <nl> return AssignEnvironment ( AssignPointerMap ( DefineSameAsFirst ( result ) ) ) ; <nl> LInstruction * LChunkBuilder : : DoCallKeyed ( HCallKeyed * instr ) { <nl> ASSERT ( instr - > key ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * key = UseFixed ( instr - > key ( ) , rcx ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - LCallKeyed * result = new LCallKeyed ( key ) ; <nl> + LCallKeyed * result = new ( zone ( ) ) LCallKeyed ( key ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallNamed ( HCallNamed * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallNamed , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallNamed , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallGlobal ( HCallGlobal * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallGlobal , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallGlobal , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallKnownGlobal ( HCallKnownGlobal * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallKnownGlobal , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallKnownGlobal , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallNew ( HCallNew * instr ) { <nl> LOperand * constructor = UseFixed ( instr - > constructor ( ) , rdi ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - LCallNew * result = new LCallNew ( constructor ) ; <nl> + LCallNew * result = new ( zone ( ) ) LCallNew ( constructor ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCallNew ( HCallNew * instr ) { <nl> LInstruction * LChunkBuilder : : DoCallFunction ( HCallFunction * instr ) { <nl> LOperand * function = UseFixed ( instr - > function ( ) , rdi ) ; <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - LCallFunction * result = new LCallFunction ( function ) ; <nl> + LCallFunction * result = new ( zone ( ) ) LCallFunction ( function ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallRuntime ( HCallRuntime * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallRuntime , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallRuntime , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBitwise ( HBitwise * instr ) { <nl> <nl> LOperand * left = UseRegisterAtStart ( instr - > LeastConstantOperand ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > MostConstantOperand ( ) ) ; <nl> - return DefineSameAsFirst ( new LBitI ( left , right ) ) ; <nl> + return DefineSameAsFirst ( new ( zone ( ) ) LBitI ( left , right ) ) ; <nl> } else { <nl> ASSERT ( instr - > representation ( ) . IsTagged ( ) ) ; <nl> ASSERT ( instr - > left ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoBitwise ( HBitwise * instr ) { <nl> <nl> LOperand * left = UseFixed ( instr - > left ( ) , rdx ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , rax ) ; <nl> - LArithmeticT * result = new LArithmeticT ( instr - > op ( ) , left , right ) ; <nl> + LArithmeticT * result = new ( zone ( ) ) LArithmeticT ( instr - > op ( ) , left , right ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoBitNot ( HBitNot * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> ASSERT ( instr - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * input = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LBitNotI * result = new LBitNotI ( input ) ; <nl> + LBitNotI * result = new ( zone ( ) ) LBitNotI ( input ) ; <nl> return DefineSameAsFirst ( result ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoDiv ( HDiv * instr ) { <nl> LOperand * temp = FixedTemp ( rdx ) ; <nl> LOperand * dividend = UseFixed ( instr - > left ( ) , rax ) ; <nl> LOperand * divisor = UseRegister ( instr - > right ( ) ) ; <nl> - LDivI * result = new LDivI ( dividend , divisor , temp ) ; <nl> + LDivI * result = new ( zone ( ) ) LDivI ( dividend , divisor , temp ) ; <nl> return AssignEnvironment ( DefineFixed ( result , rax ) ) ; <nl> } else { <nl> ASSERT ( instr - > representation ( ) . IsTagged ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoMod ( HMod * instr ) { <nl> if ( instr - > HasPowerOf2Divisor ( ) ) { <nl> ASSERT ( ! instr - > CheckFlag ( HValue : : kCanBeDivByZero ) ) ; <nl> LOperand * value = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> - LModI * mod = new LModI ( value , UseOrConstant ( instr - > right ( ) ) , NULL ) ; <nl> + LModI * mod = <nl> + new ( zone ( ) ) LModI ( value , UseOrConstant ( instr - > right ( ) ) , NULL ) ; <nl> result = DefineSameAsFirst ( mod ) ; <nl> } else { <nl> / / The temporary operand is necessary to ensure that right is not <nl> LInstruction * LChunkBuilder : : DoMod ( HMod * instr ) { <nl> LOperand * temp = FixedTemp ( rdx ) ; <nl> LOperand * value = UseFixed ( instr - > left ( ) , rax ) ; <nl> LOperand * divisor = UseRegister ( instr - > right ( ) ) ; <nl> - LModI * mod = new LModI ( value , divisor , temp ) ; <nl> + LModI * mod = new ( zone ( ) ) LModI ( value , divisor , temp ) ; <nl> result = DefineFixed ( mod , rdx ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoMod ( HMod * instr ) { <nl> / / TODO ( fschneider ) : Allow any register as input registers . <nl> LOperand * left = UseFixedDouble ( instr - > left ( ) , xmm2 ) ; <nl> LOperand * right = UseFixedDouble ( instr - > right ( ) , xmm1 ) ; <nl> - LArithmeticD * result = new LArithmeticD ( Token : : MOD , left , right ) ; <nl> + LArithmeticD * result = new ( zone ( ) ) LArithmeticD ( Token : : MOD , left , right ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , xmm1 ) , instr ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoMul ( HMul * instr ) { <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > LeastConstantOperand ( ) ) ; <nl> LOperand * right = UseOrConstant ( instr - > MostConstantOperand ( ) ) ; <nl> - LMulI * mul = new LMulI ( left , right ) ; <nl> + LMulI * mul = new ( zone ( ) ) LMulI ( left , right ) ; <nl> if ( instr - > CheckFlag ( HValue : : kCanOverflow ) | | <nl> instr - > CheckFlag ( HValue : : kBailoutOnMinusZero ) ) { <nl> AssignEnvironment ( mul ) ; <nl> LInstruction * LChunkBuilder : : DoSub ( HSub * instr ) { <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > right ( ) ) ; <nl> - LSubI * sub = new LSubI ( left , right ) ; <nl> + LSubI * sub = new ( zone ( ) ) LSubI ( left , right ) ; <nl> LInstruction * result = DefineSameAsFirst ( sub ) ; <nl> if ( instr - > CheckFlag ( HValue : : kCanOverflow ) ) { <nl> result = AssignEnvironment ( result ) ; <nl> LInstruction * LChunkBuilder : : DoAdd ( HAdd * instr ) { <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * left = UseRegisterAtStart ( instr - > LeastConstantOperand ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > MostConstantOperand ( ) ) ; <nl> - LAddI * add = new LAddI ( left , right ) ; <nl> + LAddI * add = new ( zone ( ) ) LAddI ( left , right ) ; <nl> LInstruction * result = DefineSameAsFirst ( add ) ; <nl> if ( instr - > CheckFlag ( HValue : : kCanOverflow ) ) { <nl> result = AssignEnvironment ( result ) ; <nl> LInstruction * LChunkBuilder : : DoPower ( HPower * instr ) { <nl> # else <nl> UseFixed ( instr - > right ( ) , rdi ) ; <nl> # endif <nl> - LPower * result = new LPower ( left , right ) ; <nl> + LPower * result = new ( zone ( ) ) LPower ( left , right ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , xmm3 ) , instr , <nl> CAN_DEOPTIMIZE_EAGERLY ) ; <nl> } <nl> LInstruction * LChunkBuilder : : DoRandom ( HRandom * instr ) { <nl> # else <nl> LOperand * global_object = UseFixed ( instr - > global_object ( ) , rdi ) ; <nl> # endif <nl> - LRandom * result = new LRandom ( global_object ) ; <nl> + LRandom * result = new ( zone ( ) ) LRandom ( global_object ) ; <nl> return MarkAsCall ( DefineFixedDouble ( result , xmm1 ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCompareGeneric ( HCompareGeneric * instr ) { <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * left = UseFixed ( instr - > left ( ) , rdx ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , rax ) ; <nl> - LCmpT * result = new LCmpT ( left , right ) ; <nl> + LCmpT * result = new ( zone ( ) ) LCmpT ( left , right ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCompareIDAndBranch ( <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * left = UseRegisterOrConstantAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > right ( ) ) ; <nl> - return new LCmpIDAndBranch ( left , right ) ; <nl> + return new ( zone ( ) ) LCmpIDAndBranch ( left , right ) ; <nl> } else { <nl> ASSERT ( r . IsDouble ( ) ) ; <nl> ASSERT ( instr - > left ( ) - > representation ( ) . IsDouble ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoCompareIDAndBranch ( <nl> left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> right = UseRegisterAtStart ( instr - > right ( ) ) ; <nl> } <nl> - return new LCmpIDAndBranch ( left , right ) ; <nl> + return new ( zone ( ) ) LCmpIDAndBranch ( left , right ) ; <nl> } <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoCompareObjectEqAndBranch ( <nl> HCompareObjectEqAndBranch * instr ) { <nl> LOperand * left = UseRegisterAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseRegisterAtStart ( instr - > right ( ) ) ; <nl> - return new LCmpObjectEqAndBranch ( left , right ) ; <nl> + return new ( zone ( ) ) LCmpObjectEqAndBranch ( left , right ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCompareConstantEqAndBranch ( <nl> HCompareConstantEqAndBranch * instr ) { <nl> - return new LCmpConstantEqAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LCmpConstantEqAndBranch ( value ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsNilAndBranch ( HIsNilAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * temp = instr - > kind ( ) = = kStrictEquality ? NULL : TempRegister ( ) ; <nl> - return new LIsNilAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) , temp ) ; <nl> + return new ( zone ( ) ) LIsNilAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) , temp ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsObjectAndBranch ( HIsObjectAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LIsObjectAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> + return new ( zone ( ) ) LIsObjectAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsStringAndBranch ( HIsStringAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> LOperand * temp = TempRegister ( ) ; <nl> - return new LIsStringAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) , temp ) ; <nl> + return new ( zone ( ) ) LIsStringAndBranch ( value , temp ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsSmiAndBranch ( HIsSmiAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LIsSmiAndBranch ( Use ( instr - > value ( ) ) ) ; <nl> + return new ( zone ( ) ) LIsSmiAndBranch ( Use ( instr - > value ( ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsUndetectableAndBranch ( <nl> HIsUndetectableAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LIsUndetectableAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) , <nl> - TempRegister ( ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + LOperand * temp = TempRegister ( ) ; <nl> + return new ( zone ( ) ) LIsUndetectableAndBranch ( value , temp ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringCompareAndBranch ( <nl> ASSERT ( instr - > right ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * left = UseFixed ( instr - > left ( ) , rdx ) ; <nl> LOperand * right = UseFixed ( instr - > right ( ) , rax ) ; <nl> - LStringCompareAndBranch * result = new LStringCompareAndBranch ( left , right ) ; <nl> + LStringCompareAndBranch * result = <nl> + new ( zone ( ) ) LStringCompareAndBranch ( left , right ) ; <nl> <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> LInstruction * LChunkBuilder : : DoStringCompareAndBranch ( <nl> LInstruction * LChunkBuilder : : DoHasInstanceTypeAndBranch ( <nl> HHasInstanceTypeAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LHasInstanceTypeAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LHasInstanceTypeAndBranch ( value ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoGetCachedArrayIndex ( <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> <nl> - return DefineAsRegister ( new LGetCachedArrayIndex ( value ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LGetCachedArrayIndex ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoHasCachedArrayIndexAndBranch ( <nl> HHasCachedArrayIndexAndBranch * instr ) { <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> - return new LHasCachedArrayIndexAndBranch ( UseRegisterAtStart ( instr - > value ( ) ) ) ; <nl> + LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LHasCachedArrayIndexAndBranch ( value ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoClassOfTestAndBranch ( <nl> HClassOfTestAndBranch * instr ) { <nl> - return new LClassOfTestAndBranch ( UseRegister ( instr - > value ( ) ) , <nl> - TempRegister ( ) , <nl> - TempRegister ( ) ) ; <nl> + LOperand * value = UseRegister ( instr - > value ( ) ) ; <nl> + return new ( zone ( ) ) LClassOfTestAndBranch ( value , <nl> + TempRegister ( ) , <nl> + TempRegister ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoJSArrayLength ( HJSArrayLength * instr ) { <nl> LOperand * array = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LJSArrayLength ( array ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LJSArrayLength ( array ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoFixedArrayBaseLength ( <nl> HFixedArrayBaseLength * instr ) { <nl> LOperand * array = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LFixedArrayBaseLength ( array ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LFixedArrayBaseLength ( array ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoElementsKind ( HElementsKind * instr ) { <nl> LOperand * object = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LElementsKind ( object ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LElementsKind ( object ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoValueOf ( HValueOf * instr ) { <nl> LOperand * object = UseRegister ( instr - > value ( ) ) ; <nl> - LValueOf * result = new LValueOf ( object ) ; <nl> + LValueOf * result = new ( zone ( ) ) LValueOf ( object ) ; <nl> return DefineSameAsFirst ( result ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoBoundsCheck ( HBoundsCheck * instr ) { <nl> - return AssignEnvironment ( new LBoundsCheck ( <nl> - UseRegisterOrConstantAtStart ( instr - > index ( ) ) , <nl> - Use ( instr - > length ( ) ) ) ) ; <nl> + LOperand * value = UseRegisterOrConstantAtStart ( instr - > index ( ) ) ; <nl> + LOperand * length = Use ( instr - > length ( ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LBoundsCheck ( value , length ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoAbnormalExit ( HAbnormalExit * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoThrow ( HThrow * instr ) { <nl> LOperand * value = UseFixed ( instr - > value ( ) , rax ) ; <nl> - return MarkAsCall ( new LThrow ( value ) , instr ) ; <nl> + return MarkAsCall ( new ( zone ( ) ) LThrow ( value ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> if ( from . IsTagged ( ) ) { <nl> if ( to . IsDouble ( ) ) { <nl> LOperand * value = UseRegister ( instr - > value ( ) ) ; <nl> - LNumberUntagD * res = new LNumberUntagD ( value ) ; <nl> + LNumberUntagD * res = new ( zone ( ) ) LNumberUntagD ( value ) ; <nl> return AssignEnvironment ( DefineAsRegister ( res ) ) ; <nl> } else { <nl> ASSERT ( to . IsInteger32 ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> if ( needs_check ) { <nl> bool truncating = instr - > CanTruncateToInt32 ( ) ; <nl> LOperand * xmm_temp = truncating ? NULL : FixedTemp ( xmm1 ) ; <nl> - LTaggedToI * res = new LTaggedToI ( value , xmm_temp ) ; <nl> + LTaggedToI * res = new ( zone ( ) ) LTaggedToI ( value , xmm_temp ) ; <nl> return AssignEnvironment ( DefineSameAsFirst ( res ) ) ; <nl> } else { <nl> - return DefineSameAsFirst ( new LSmiUntag ( value , needs_check ) ) ; <nl> + return DefineSameAsFirst ( new ( zone ( ) ) LSmiUntag ( value , needs_check ) ) ; <nl> } <nl> } <nl> } else if ( from . IsDouble ( ) ) { <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> <nl> / / Make sure that temp and result_temp are different registers . <nl> LUnallocated * result_temp = TempRegister ( ) ; <nl> - LNumberTagD * result = new LNumberTagD ( value , temp ) ; <nl> + LNumberTagD * result = new ( zone ( ) ) LNumberTagD ( value , temp ) ; <nl> return AssignPointerMap ( Define ( result , result_temp ) ) ; <nl> } else { <nl> ASSERT ( to . IsInteger32 ( ) ) ; <nl> LOperand * value = UseRegister ( instr - > value ( ) ) ; <nl> - return AssignEnvironment ( DefineAsRegister ( new LDoubleToI ( value ) ) ) ; <nl> + return AssignEnvironment ( DefineAsRegister ( new ( zone ( ) ) LDoubleToI ( value ) ) ) ; <nl> } <nl> } else if ( from . IsInteger32 ( ) ) { <nl> if ( to . IsTagged ( ) ) { <nl> HValue * val = instr - > value ( ) ; <nl> LOperand * value = UseRegister ( val ) ; <nl> if ( val - > HasRange ( ) & & val - > range ( ) - > IsInSmiRange ( ) ) { <nl> - return DefineSameAsFirst ( new LSmiTag ( value ) ) ; <nl> + return DefineSameAsFirst ( new ( zone ( ) ) LSmiTag ( value ) ) ; <nl> } else { <nl> - LNumberTagI * result = new LNumberTagI ( value ) ; <nl> + LNumberTagI * result = new ( zone ( ) ) LNumberTagI ( value ) ; <nl> return AssignEnvironment ( AssignPointerMap ( DefineSameAsFirst ( result ) ) ) ; <nl> } <nl> } else { <nl> ASSERT ( to . IsDouble ( ) ) ; <nl> - return DefineAsRegister ( new LInteger32ToDouble ( Use ( instr - > value ( ) ) ) ) ; <nl> + LOperand * value = Use ( instr - > value ( ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LInteger32ToDouble ( value ) ) ; <nl> } <nl> } <nl> UNREACHABLE ( ) ; <nl> LInstruction * LChunkBuilder : : DoChange ( HChange * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoCheckNonSmi ( HCheckNonSmi * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return AssignEnvironment ( new LCheckNonSmi ( value ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckNonSmi ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckInstanceType ( HCheckInstanceType * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LCheckInstanceType * result = new LCheckInstanceType ( value ) ; <nl> + LCheckInstanceType * result = new ( zone ( ) ) LCheckInstanceType ( value ) ; <nl> return AssignEnvironment ( result ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckPrototypeMaps ( HCheckPrototypeMaps * instr ) { <nl> LOperand * temp = TempRegister ( ) ; <nl> - LCheckPrototypeMaps * result = new LCheckPrototypeMaps ( temp ) ; <nl> + LCheckPrototypeMaps * result = new ( zone ( ) ) LCheckPrototypeMaps ( temp ) ; <nl> return AssignEnvironment ( result ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckSmi ( HCheckSmi * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return AssignEnvironment ( new LCheckSmi ( value ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckSmi ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckFunction ( HCheckFunction * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return AssignEnvironment ( new LCheckFunction ( value ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckFunction ( value ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckMap ( HCheckMap * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LCheckMap * result = new LCheckMap ( value ) ; <nl> + LCheckMap * result = new ( zone ( ) ) LCheckMap ( value ) ; <nl> return AssignEnvironment ( result ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoClampToUint8 ( HClampToUint8 * instr ) { <nl> Representation input_rep = value - > representation ( ) ; <nl> LOperand * reg = UseRegister ( value ) ; <nl> if ( input_rep . IsDouble ( ) ) { <nl> - return DefineAsRegister ( new LClampDToUint8 ( reg , <nl> + return DefineAsRegister ( new ( zone ( ) ) LClampDToUint8 ( reg , <nl> TempRegister ( ) ) ) ; <nl> } else if ( input_rep . IsInteger32 ( ) ) { <nl> - return DefineSameAsFirst ( new LClampIToUint8 ( reg ) ) ; <nl> + return DefineSameAsFirst ( new ( zone ( ) ) LClampIToUint8 ( reg ) ) ; <nl> } else { <nl> ASSERT ( input_rep . IsTagged ( ) ) ; <nl> / / Register allocator doesn ' t ( yet ) support allocation of double <nl> / / temps . Reserve xmm1 explicitly . <nl> - LClampTToUint8 * result = new LClampTToUint8 ( reg , <nl> - TempRegister ( ) , <nl> - FixedTemp ( xmm1 ) ) ; <nl> + LClampTToUint8 * result = new ( zone ( ) ) LClampTToUint8 ( reg , <nl> + TempRegister ( ) , <nl> + FixedTemp ( xmm1 ) ) ; <nl> return AssignEnvironment ( DefineSameAsFirst ( result ) ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoToInt32 ( HToInt32 * instr ) { <nl> Representation input_rep = value - > representation ( ) ; <nl> LOperand * reg = UseRegister ( value ) ; <nl> if ( input_rep . IsDouble ( ) ) { <nl> - return AssignEnvironment ( DefineAsRegister ( new LDoubleToI ( reg ) ) ) ; <nl> + return AssignEnvironment ( DefineAsRegister ( new ( zone ( ) ) LDoubleToI ( reg ) ) ) ; <nl> } else if ( input_rep . IsInteger32 ( ) ) { <nl> / / Canonicalization should already have removed the hydrogen instruction in <nl> / / this case , since it is a noop . <nl> LInstruction * LChunkBuilder : : DoToInt32 ( HToInt32 * instr ) { <nl> ? NULL <nl> : FixedTemp ( xmm1 ) ; <nl> return AssignEnvironment ( <nl> - DefineSameAsFirst ( new LTaggedToI ( reg , xmm_temp ) ) ) ; <nl> + DefineSameAsFirst ( new ( zone ( ) ) LTaggedToI ( reg , xmm_temp ) ) ) ; <nl> } <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoReturn ( HReturn * instr ) { <nl> - return new LReturn ( UseFixed ( instr - > value ( ) , rax ) ) ; <nl> + return new ( zone ( ) ) LReturn ( UseFixed ( instr - > value ( ) , rax ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoConstant ( HConstant * instr ) { <nl> Representation r = instr - > representation ( ) ; <nl> if ( r . IsInteger32 ( ) ) { <nl> - return DefineAsRegister ( new LConstantI ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LConstantI ) ; <nl> } else if ( r . IsDouble ( ) ) { <nl> LOperand * temp = TempRegister ( ) ; <nl> - return DefineAsRegister ( new LConstantD ( temp ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LConstantD ( temp ) ) ; <nl> } else if ( r . IsTagged ( ) ) { <nl> - return DefineAsRegister ( new LConstantT ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LConstantT ) ; <nl> } else { <nl> UNREACHABLE ( ) ; <nl> return NULL ; <nl> LInstruction * LChunkBuilder : : DoConstant ( HConstant * instr ) { <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadGlobalCell ( HLoadGlobalCell * instr ) { <nl> - LLoadGlobalCell * result = new LLoadGlobalCell ; <nl> + LLoadGlobalCell * result = new ( zone ( ) ) LLoadGlobalCell ; <nl> return instr - > RequiresHoleCheck ( ) <nl> ? AssignEnvironment ( DefineAsRegister ( result ) ) <nl> : DefineAsRegister ( result ) ; <nl> LInstruction * LChunkBuilder : : DoLoadGlobalCell ( HLoadGlobalCell * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoLoadGlobalGeneric ( HLoadGlobalGeneric * instr ) { <nl> LOperand * global_object = UseFixed ( instr - > global_object ( ) , rax ) ; <nl> - LLoadGlobalGeneric * result = new LLoadGlobalGeneric ( global_object ) ; <nl> + LLoadGlobalGeneric * result = new ( zone ( ) ) LLoadGlobalGeneric ( global_object ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreGlobalCell ( HStoreGlobalCell * instr ) { <nl> / / Use a temp to avoid reloading the cell value address in the case where <nl> / / we perform a hole check . <nl> return instr - > RequiresHoleCheck ( ) <nl> - ? AssignEnvironment ( new LStoreGlobalCell ( value , TempRegister ( ) ) ) <nl> - : new LStoreGlobalCell ( value , NULL ) ; <nl> + ? AssignEnvironment ( new ( zone ( ) ) LStoreGlobalCell ( value , TempRegister ( ) ) ) <nl> + : new ( zone ( ) ) LStoreGlobalCell ( value , NULL ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreGlobalGeneric ( HStoreGlobalGeneric * instr ) { <nl> LOperand * global_object = UseFixed ( instr - > global_object ( ) , rdx ) ; <nl> LOperand * value = UseFixed ( instr - > value ( ) , rax ) ; <nl> - LStoreGlobalGeneric * result = new LStoreGlobalGeneric ( global_object , value ) ; <nl> + LStoreGlobalGeneric * result = new ( zone ( ) ) LStoreGlobalGeneric ( global_object , <nl> + value ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadContextSlot ( HLoadContextSlot * instr ) { <nl> LOperand * context = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - LInstruction * result = DefineAsRegister ( new LLoadContextSlot ( context ) ) ; <nl> + LInstruction * result = <nl> + DefineAsRegister ( new ( zone ( ) ) LLoadContextSlot ( context ) ) ; <nl> return instr - > RequiresHoleCheck ( ) ? AssignEnvironment ( result ) : result ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreContextSlot ( HStoreContextSlot * instr ) { <nl> value = UseRegister ( instr - > value ( ) ) ; <nl> temp = NULL ; <nl> } <nl> - LInstruction * result = new LStoreContextSlot ( context , value , temp ) ; <nl> + LInstruction * result = new ( zone ( ) ) LStoreContextSlot ( context , value , temp ) ; <nl> return instr - > RequiresHoleCheck ( ) ? AssignEnvironment ( result ) : result ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreContextSlot ( HStoreContextSlot * instr ) { <nl> LInstruction * LChunkBuilder : : DoLoadNamedField ( HLoadNamedField * instr ) { <nl> ASSERT ( instr - > representation ( ) . IsTagged ( ) ) ; <nl> LOperand * obj = UseRegisterAtStart ( instr - > object ( ) ) ; <nl> - return DefineAsRegister ( new LLoadNamedField ( obj ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LLoadNamedField ( obj ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadNamedFieldPolymorphic ( <nl> ASSERT ( instr - > representation ( ) . IsTagged ( ) ) ; <nl> if ( instr - > need_generic ( ) ) { <nl> LOperand * obj = UseFixed ( instr - > object ( ) , rax ) ; <nl> - LLoadNamedFieldPolymorphic * result = new LLoadNamedFieldPolymorphic ( obj ) ; <nl> + LLoadNamedFieldPolymorphic * result = <nl> + new ( zone ( ) ) LLoadNamedFieldPolymorphic ( obj ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } else { <nl> LOperand * obj = UseRegisterAtStart ( instr - > object ( ) ) ; <nl> - LLoadNamedFieldPolymorphic * result = new LLoadNamedFieldPolymorphic ( obj ) ; <nl> + LLoadNamedFieldPolymorphic * result = <nl> + new ( zone ( ) ) LLoadNamedFieldPolymorphic ( obj ) ; <nl> return AssignEnvironment ( DefineAsRegister ( result ) ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoLoadNamedFieldPolymorphic ( <nl> <nl> LInstruction * LChunkBuilder : : DoLoadNamedGeneric ( HLoadNamedGeneric * instr ) { <nl> LOperand * object = UseFixed ( instr - > object ( ) , rax ) ; <nl> - LLoadNamedGeneric * result = new LLoadNamedGeneric ( object ) ; <nl> + LLoadNamedGeneric * result = new ( zone ( ) ) LLoadNamedGeneric ( object ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoLoadNamedGeneric ( HLoadNamedGeneric * instr ) { <nl> LInstruction * LChunkBuilder : : DoLoadFunctionPrototype ( <nl> HLoadFunctionPrototype * instr ) { <nl> return AssignEnvironment ( DefineAsRegister ( <nl> - new LLoadFunctionPrototype ( UseRegister ( instr - > function ( ) ) ) ) ) ; <nl> + new ( zone ( ) ) LLoadFunctionPrototype ( UseRegister ( instr - > function ( ) ) ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadElements ( HLoadElements * instr ) { <nl> LOperand * input = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LLoadElements ( input ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LLoadElements ( input ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadExternalArrayPointer ( <nl> HLoadExternalArrayPointer * instr ) { <nl> LOperand * input = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LLoadExternalArrayPointer ( input ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LLoadExternalArrayPointer ( input ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedFastElement ( <nl> ASSERT ( instr - > key ( ) - > representation ( ) . IsInteger32 ( ) ) ; <nl> LOperand * obj = UseRegisterAtStart ( instr - > object ( ) ) ; <nl> LOperand * key = UseRegisterOrConstantAtStart ( instr - > key ( ) ) ; <nl> - LLoadKeyedFastElement * result = new LLoadKeyedFastElement ( obj , key ) ; <nl> + LLoadKeyedFastElement * result = new ( zone ( ) ) LLoadKeyedFastElement ( obj , key ) ; <nl> if ( instr - > RequiresHoleCheck ( ) ) AssignEnvironment ( result ) ; <nl> return DefineAsRegister ( result ) ; <nl> } <nl> LInstruction * LChunkBuilder : : DoLoadKeyedFastDoubleElement ( <nl> LOperand * elements = UseRegisterAtStart ( instr - > elements ( ) ) ; <nl> LOperand * key = UseRegisterOrConstantAtStart ( instr - > key ( ) ) ; <nl> LLoadKeyedFastDoubleElement * result = <nl> - new LLoadKeyedFastDoubleElement ( elements , key ) ; <nl> + new ( zone ( ) ) LLoadKeyedFastDoubleElement ( elements , key ) ; <nl> return AssignEnvironment ( DefineAsRegister ( result ) ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoLoadKeyedSpecializedArrayElement ( <nl> LOperand * external_pointer = UseRegister ( instr - > external_pointer ( ) ) ; <nl> LOperand * key = UseRegisterOrConstant ( instr - > key ( ) ) ; <nl> LLoadKeyedSpecializedArrayElement * result = <nl> - new LLoadKeyedSpecializedArrayElement ( external_pointer , key ) ; <nl> + new ( zone ( ) ) LLoadKeyedSpecializedArrayElement ( external_pointer , key ) ; <nl> LInstruction * load_instr = DefineAsRegister ( result ) ; <nl> / / An unsigned int array load might overflow and cause a deopt , make sure it <nl> / / has an environment . <nl> LInstruction * LChunkBuilder : : DoLoadKeyedGeneric ( HLoadKeyedGeneric * instr ) { <nl> LOperand * object = UseFixed ( instr - > object ( ) , rdx ) ; <nl> LOperand * key = UseFixed ( instr - > key ( ) , rax ) ; <nl> <nl> - LLoadKeyedGeneric * result = new LLoadKeyedGeneric ( object , key ) ; <nl> + LLoadKeyedGeneric * result = new ( zone ( ) ) LLoadKeyedGeneric ( object , key ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedFastElement ( <nl> LOperand * key = needs_write_barrier <nl> ? UseTempRegister ( instr - > key ( ) ) <nl> : UseRegisterOrConstantAtStart ( instr - > key ( ) ) ; <nl> - return new LStoreKeyedFastElement ( obj , key , val ) ; <nl> + return new ( zone ( ) ) LStoreKeyedFastElement ( obj , key , val ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedFastDoubleElement ( <nl> LOperand * val = UseTempRegister ( instr - > value ( ) ) ; <nl> LOperand * key = UseRegisterOrConstantAtStart ( instr - > key ( ) ) ; <nl> <nl> - return new LStoreKeyedFastDoubleElement ( elements , key , val ) ; <nl> + return new ( zone ( ) ) LStoreKeyedFastDoubleElement ( elements , key , val ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedSpecializedArrayElement ( <nl> : UseRegister ( instr - > value ( ) ) ; <nl> LOperand * key = UseRegisterOrConstant ( instr - > key ( ) ) ; <nl> <nl> - return new LStoreKeyedSpecializedArrayElement ( external_pointer , <nl> - key , <nl> - val ) ; <nl> + return new ( zone ( ) ) LStoreKeyedSpecializedArrayElement ( external_pointer , <nl> + key , <nl> + val ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreKeyedGeneric ( HStoreKeyedGeneric * instr ) { <nl> ASSERT ( instr - > key ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> ASSERT ( instr - > value ( ) - > representation ( ) . IsTagged ( ) ) ; <nl> <nl> - LStoreKeyedGeneric * result = new LStoreKeyedGeneric ( object , key , value ) ; <nl> + LStoreKeyedGeneric * result = <nl> + new ( zone ( ) ) LStoreKeyedGeneric ( object , key , value ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoTransitionElementsKind ( <nl> LOperand * new_map_reg = TempRegister ( ) ; <nl> LOperand * temp_reg = TempRegister ( ) ; <nl> LTransitionElementsKind * result = <nl> - new LTransitionElementsKind ( object , new_map_reg , temp_reg ) ; <nl> + new ( zone ( ) ) LTransitionElementsKind ( object , new_map_reg , temp_reg ) ; <nl> return DefineSameAsFirst ( result ) ; <nl> } else { <nl> LOperand * object = UseFixed ( instr - > object ( ) , rax ) ; <nl> LOperand * fixed_object_reg = FixedTemp ( rdx ) ; <nl> LOperand * new_map_reg = FixedTemp ( rbx ) ; <nl> LTransitionElementsKind * result = <nl> - new LTransitionElementsKind ( object , new_map_reg , fixed_object_reg ) ; <nl> + new ( zone ( ) ) LTransitionElementsKind ( object , <nl> + new_map_reg , <nl> + fixed_object_reg ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> } <nl> LInstruction * LChunkBuilder : : DoStoreNamedField ( HStoreNamedField * instr ) { <nl> LOperand * temp = ( ! instr - > is_in_object ( ) | | needs_write_barrier ) <nl> ? TempRegister ( ) : NULL ; <nl> <nl> - return new LStoreNamedField ( obj , val , temp ) ; <nl> + return new ( zone ( ) ) LStoreNamedField ( obj , val , temp ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStoreNamedGeneric ( HStoreNamedGeneric * instr ) { <nl> LOperand * object = UseFixed ( instr - > object ( ) , rdx ) ; <nl> LOperand * value = UseFixed ( instr - > value ( ) , rax ) ; <nl> <nl> - LStoreNamedGeneric * result = new LStoreNamedGeneric ( object , value ) ; <nl> + LStoreNamedGeneric * result = new ( zone ( ) ) LStoreNamedGeneric ( object , value ) ; <nl> return MarkAsCall ( result , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoStoreNamedGeneric ( HStoreNamedGeneric * instr ) { <nl> LInstruction * LChunkBuilder : : DoStringAdd ( HStringAdd * instr ) { <nl> LOperand * left = UseOrConstantAtStart ( instr - > left ( ) ) ; <nl> LOperand * right = UseOrConstantAtStart ( instr - > right ( ) ) ; <nl> - return MarkAsCall ( DefineFixed ( new LStringAdd ( left , right ) , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LStringAdd ( left , right ) , rax ) , <nl> + instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringCharCodeAt ( HStringCharCodeAt * instr ) { <nl> LOperand * string = UseTempRegister ( instr - > string ( ) ) ; <nl> LOperand * index = UseTempRegister ( instr - > index ( ) ) ; <nl> - LStringCharCodeAt * result = new LStringCharCodeAt ( string , index ) ; <nl> + LStringCharCodeAt * result = new ( zone ( ) ) LStringCharCodeAt ( string , index ) ; <nl> return AssignEnvironment ( AssignPointerMap ( DefineAsRegister ( result ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringCharFromCode ( HStringCharFromCode * instr ) { <nl> LOperand * char_code = UseRegister ( instr - > value ( ) ) ; <nl> - LStringCharFromCode * result = new LStringCharFromCode ( char_code ) ; <nl> + LStringCharFromCode * result = new ( zone ( ) ) LStringCharFromCode ( char_code ) ; <nl> return AssignPointerMap ( DefineAsRegister ( result ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoStringLength ( HStringLength * instr ) { <nl> LOperand * string = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> - return DefineAsRegister ( new LStringLength ( string ) ) ; <nl> + return DefineAsRegister ( new ( zone ( ) ) LStringLength ( string ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoAllocateObject ( HAllocateObject * instr ) { <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoFastLiteral ( HFastLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LFastLiteral , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LFastLiteral , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoArrayLiteral ( HArrayLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LArrayLiteral , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LArrayLiteral , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoObjectLiteral ( HObjectLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LObjectLiteral , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LObjectLiteral , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoRegExpLiteral ( HRegExpLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LRegExpLiteral , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LRegExpLiteral , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoFunctionLiteral ( HFunctionLiteral * instr ) { <nl> - return MarkAsCall ( DefineFixed ( new LFunctionLiteral , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LFunctionLiteral , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoDeleteProperty ( HDeleteProperty * instr ) { <nl> - LDeleteProperty * result = <nl> - new LDeleteProperty ( UseAtStart ( instr - > object ( ) ) , <nl> - UseOrConstantAtStart ( instr - > key ( ) ) ) ; <nl> + LOperand * object = UseAtStart ( instr - > object ( ) ) ; <nl> + LOperand * key = UseOrConstantAtStart ( instr - > key ( ) ) ; <nl> + LDeleteProperty * result = new ( zone ( ) ) LDeleteProperty ( object , key ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoDeleteProperty ( HDeleteProperty * instr ) { <nl> LInstruction * LChunkBuilder : : DoOsrEntry ( HOsrEntry * instr ) { <nl> allocator_ - > MarkAsOsrEntry ( ) ; <nl> current_block_ - > last_environment ( ) - > set_ast_id ( instr - > ast_id ( ) ) ; <nl> - return AssignEnvironment ( new LOsrEntry ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LOsrEntry ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoParameter ( HParameter * instr ) { <nl> int spill_index = chunk ( ) - > GetParameterStackSlot ( instr - > index ( ) ) ; <nl> - return DefineAsSpilled ( new LParameter , spill_index ) ; <nl> + return DefineAsSpilled ( new ( zone ( ) ) LParameter , spill_index ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoUnknownOSRValue ( HUnknownOSRValue * instr ) { <nl> Abort ( " Too many spill slots needed for OSR " ) ; <nl> spill_index = 0 ; <nl> } <nl> - return DefineAsSpilled ( new LUnknownOSRValue , spill_index ) ; <nl> + return DefineAsSpilled ( new ( zone ( ) ) LUnknownOSRValue , spill_index ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCallStub ( HCallStub * instr ) { <nl> argument_count_ - = instr - > argument_count ( ) ; <nl> - return MarkAsCall ( DefineFixed ( new LCallStub , rax ) , instr ) ; <nl> + return MarkAsCall ( DefineFixed ( new ( zone ( ) ) LCallStub , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoAccessArgumentsAt ( HAccessArgumentsAt * instr ) { <nl> LOperand * arguments = UseRegister ( instr - > arguments ( ) ) ; <nl> LOperand * length = UseTempRegister ( instr - > length ( ) ) ; <nl> LOperand * index = Use ( instr - > index ( ) ) ; <nl> - LAccessArgumentsAt * result = new LAccessArgumentsAt ( arguments , length , index ) ; <nl> + LAccessArgumentsAt * result = <nl> + new ( zone ( ) ) LAccessArgumentsAt ( arguments , length , index ) ; <nl> return AssignEnvironment ( DefineAsRegister ( result ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoToFastProperties ( HToFastProperties * instr ) { <nl> LOperand * object = UseFixed ( instr - > value ( ) , rax ) ; <nl> - LToFastProperties * result = new LToFastProperties ( object ) ; <nl> + LToFastProperties * result = new ( zone ( ) ) LToFastProperties ( object ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoTypeof ( HTypeof * instr ) { <nl> - LTypeof * result = new LTypeof ( UseAtStart ( instr - > value ( ) ) ) ; <nl> + LTypeof * result = new ( zone ( ) ) LTypeof ( UseAtStart ( instr - > value ( ) ) ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoTypeofIsAndBranch ( HTypeofIsAndBranch * instr ) { <nl> - return new LTypeofIsAndBranch ( UseTempRegister ( instr - > value ( ) ) ) ; <nl> + return new ( zone ( ) ) LTypeofIsAndBranch ( UseTempRegister ( instr - > value ( ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoIsConstructCallAndBranch ( <nl> HIsConstructCallAndBranch * instr ) { <nl> - return new LIsConstructCallAndBranch ( TempRegister ( ) ) ; <nl> + return new ( zone ( ) ) LIsConstructCallAndBranch ( TempRegister ( ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoSimulate ( HSimulate * instr ) { <nl> / / If there is an instruction pending deoptimization environment create a <nl> / / lazy bailout instruction to capture the environment . <nl> if ( pending_deoptimization_ast_id_ = = instr - > ast_id ( ) ) { <nl> - LLazyBailout * lazy_bailout = new LLazyBailout ; <nl> + LLazyBailout * lazy_bailout = new ( zone ( ) ) LLazyBailout ; <nl> LInstruction * result = AssignEnvironment ( lazy_bailout ) ; <nl> instruction_pending_deoptimization_environment_ - > <nl> set_deoptimization_environment ( result - > environment ( ) ) ; <nl> LInstruction * LChunkBuilder : : DoSimulate ( HSimulate * instr ) { <nl> <nl> LInstruction * LChunkBuilder : : DoStackCheck ( HStackCheck * instr ) { <nl> if ( instr - > is_function_entry ( ) ) { <nl> - return MarkAsCall ( new LStackCheck , instr ) ; <nl> + return MarkAsCall ( new ( zone ( ) ) LStackCheck , instr ) ; <nl> } else { <nl> ASSERT ( instr - > is_backwards_branch ( ) ) ; <nl> - return AssignEnvironment ( AssignPointerMap ( new LStackCheck ) ) ; <nl> + return AssignEnvironment ( AssignPointerMap ( new ( zone ( ) ) LStackCheck ) ) ; <nl> } <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoLeaveInlined ( HLeaveInlined * instr ) { <nl> LInstruction * LChunkBuilder : : DoIn ( HIn * instr ) { <nl> LOperand * key = UseOrConstantAtStart ( instr - > key ( ) ) ; <nl> LOperand * object = UseOrConstantAtStart ( instr - > object ( ) ) ; <nl> - LIn * result = new LIn ( key , object ) ; <nl> + LIn * result = new ( zone ( ) ) LIn ( key , object ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoForInPrepareMap ( HForInPrepareMap * instr ) { <nl> LOperand * object = UseFixed ( instr - > enumerable ( ) , rax ) ; <nl> - LForInPrepareMap * result = new LForInPrepareMap ( object ) ; <nl> + LForInPrepareMap * result = new ( zone ( ) ) LForInPrepareMap ( object ) ; <nl> return MarkAsCall ( DefineFixed ( result , rax ) , instr , CAN_DEOPTIMIZE_EAGERLY ) ; <nl> } <nl> <nl> LInstruction * LChunkBuilder : : DoForInPrepareMap ( HForInPrepareMap * instr ) { <nl> LInstruction * LChunkBuilder : : DoForInCacheArray ( HForInCacheArray * instr ) { <nl> LOperand * map = UseRegister ( instr - > map ( ) ) ; <nl> return AssignEnvironment ( DefineAsRegister ( <nl> - new LForInCacheArray ( map ) ) ) ; <nl> + new ( zone ( ) ) LForInCacheArray ( map ) ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoCheckMapValue ( HCheckMapValue * instr ) { <nl> LOperand * value = UseRegisterAtStart ( instr - > value ( ) ) ; <nl> LOperand * map = UseRegisterAtStart ( instr - > map ( ) ) ; <nl> - return AssignEnvironment ( new LCheckMapValue ( value , map ) ) ; <nl> + return AssignEnvironment ( new ( zone ( ) ) LCheckMapValue ( value , map ) ) ; <nl> } <nl> <nl> <nl> LInstruction * LChunkBuilder : : DoLoadFieldByIndex ( HLoadFieldByIndex * instr ) { <nl> LOperand * object = UseRegister ( instr - > object ( ) ) ; <nl> LOperand * index = UseTempRegister ( instr - > index ( ) ) ; <nl> - return DefineSameAsFirst ( new LLoadFieldByIndex ( object , index ) ) ; <nl> + return DefineSameAsFirst ( new ( zone ( ) ) LLoadFieldByIndex ( object , index ) ) ; <nl> } <nl> <nl> <nl> mmm a / src / x64 / lithium - x64 . h <nl> ppp b / src / x64 / lithium - x64 . h <nl> class LChunkBuilder BASE_EMBEDDED { <nl> : chunk_ ( NULL ) , <nl> info_ ( info ) , <nl> graph_ ( graph ) , <nl> + zone_ ( graph - > isolate ( ) - > zone ( ) ) , <nl> status_ ( UNUSED ) , <nl> current_instruction_ ( NULL ) , <nl> current_block_ ( NULL ) , <nl> class LChunkBuilder BASE_EMBEDDED { <nl> LChunk * chunk ( ) const { return chunk_ ; } <nl> CompilationInfo * info ( ) const { return info_ ; } <nl> HGraph * graph ( ) const { return graph_ ; } <nl> + Zone * zone ( ) const { return zone_ ; } <nl> <nl> bool is_unused ( ) const { return status_ = = UNUSED ; } <nl> bool is_building ( ) const { return status_ = = BUILDING ; } <nl> class LChunkBuilder BASE_EMBEDDED { <nl> LChunk * chunk_ ; <nl> CompilationInfo * info_ ; <nl> HGraph * const graph_ ; <nl> + Zone * zone_ ; <nl> Status status_ ; <nl> HInstruction * current_instruction_ ; <nl> HBasicBlock * current_block_ ; <nl>
Pass zone explicitly to zone - allocation on x64 and ARM .
v8/v8
15542081e9ed29396eba8856c2ab4ba8992df10e
2012-02-28T10:53:13Z
new file mode 100644 <nl> index 000000000000 . . 8bd3f8a2be31 <nl> mmm / dev / null <nl> ppp b / test / SourceKit / Sema / educational_note_diags . swift <nl> <nl> + extension ( Int , Int ) { } <nl> + <nl> + / / RUN : % sourcekitd - test - req = sema % s - - - Xfrontend - enable - descriptive - diagnostics - Xfrontend - diagnostic - documentation - path - Xfrontend / educational / notes / path / prefix % s | % FileCheck % s - check - prefix = DESCRIPTIVE <nl> + <nl> + / / DESCRIPTIVE : key . description : " non - nominal type <nl> + / / DESCRIPTIVE : key . educational_note_paths : [ <nl> + / / DESCRIPTIVE - NEXT : " / educational / notes / path / prefix / nominal - types . md " <nl> + / / DESCRIPTIVE - NEXT : ] <nl> + <nl> + / / RUN : % sourcekitd - test - req = sema % s - - % s | % FileCheck % s - check - prefix = DESCRIPTIVE - DISABLED <nl> + <nl> + / / DESCRIPTIVE - DISABLED : key . description : " non - nominal type <nl> + / / DESCRIPTIVE - DISABLED - NOT : key . educational_note_paths <nl> mmm a / tools / SourceKit / docs / Protocol . md <nl> ppp b / tools / SourceKit / docs / Protocol . md <nl> of diagnostic entries . A diagnostic entry has this format : <nl> [ opts ] < key . fixits > : ( array ) [ fixit + ] / / one or more entries for fixits <nl> [ opts ] < key . ranges > : ( array ) [ range + ] / / one or more entries for ranges <nl> [ opts ] < key . diagnostics > : ( array ) [ diagnostic + ] / / one or more sub - diagnostic entries <nl> + [ opts ] < key . educational_note_paths > : ( array ) [ string + ] / / one or more absolute paths of educational notes , formatted as Markdown <nl> } <nl> ` ` ` <nl> <nl> mmm a / tools / SourceKit / include / SourceKit / Core / LangSupport . h <nl> ppp b / tools / SourceKit / include / SourceKit / Core / LangSupport . h <nl> struct DiagnosticEntryInfoBase { <nl> std : : string Filename ; <nl> SmallVector < std : : pair < unsigned , unsigned > , 2 > Ranges ; <nl> SmallVector < Fixit , 2 > Fixits ; <nl> + SmallVector < std : : string , 1 > EducationalNotePaths ; <nl> } ; <nl> <nl> struct DiagnosticEntryInfo : DiagnosticEntryInfoBase { <nl> mmm a / tools / SourceKit / lib / SwiftLang / SwiftEditor . cpp <nl> ppp b / tools / SourceKit / lib / SwiftLang / SwiftEditor . cpp <nl> void EditorDiagConsumer : : handleDiagnostic ( SourceManager & SM , <nl> } <nl> SKInfo . Description = Text . str ( ) ; <nl> <nl> + for ( auto notePath : Info . EducationalNotePaths ) <nl> + SKInfo . EducationalNotePaths . push_back ( notePath ) ; <nl> + <nl> Optional < unsigned > BufferIDOpt ; <nl> if ( Info . Loc . isValid ( ) ) { <nl> BufferIDOpt = SM . findBufferContainingLoc ( Info . Loc ) ; <nl> mmm a / tools / SourceKit / tools / sourcekitd / lib / API / Requests . cpp <nl> ppp b / tools / SourceKit / tools / sourcekitd / lib / API / Requests . cpp <nl> static void fillDictionaryForDiagnosticInfoBase ( <nl> if ( ! Info . Filename . empty ( ) ) <nl> Elem . set ( KeyFilePath , Info . Filename ) ; <nl> <nl> + if ( ! Info . EducationalNotePaths . empty ( ) ) <nl> + Elem . set ( KeyEducationalNotePaths , Info . EducationalNotePaths ) ; <nl> + <nl> if ( ! Info . Ranges . empty ( ) ) { <nl> auto RangesArr = Elem . setArray ( KeyRanges ) ; <nl> for ( auto R : Info . Ranges ) { <nl> mmm a / utils / gyb_sourcekit_support / UIDs . py <nl> ppp b / utils / gyb_sourcekit_support / UIDs . py <nl> def __init__ ( self , internal_name , external_name ) : <nl> KEY ( ' Ranges ' , ' key . ranges ' ) , <nl> KEY ( ' Fixits ' , ' key . fixits ' ) , <nl> KEY ( ' Diagnostics ' , ' key . diagnostics ' ) , <nl> + KEY ( ' EducationalNotePaths ' , ' key . educational_note_paths ' ) , <nl> KEY ( ' FormatOptions ' , ' key . editor . format . options ' ) , <nl> KEY ( ' CodeCompleteOptions ' , ' key . codecomplete . options ' ) , <nl> KEY ( ' FilterRules ' , ' key . codecomplete . filterrules ' ) , <nl>
Merge pull request from owenv / sourcekit - edu - notes
apple/swift
78b6759ba49b06239917f3e7d6af4d8eab401b42
2020-02-27T16:12:35Z
mmm a / cores / esp8266 / HardwareSerial . cpp <nl> ppp b / cores / esp8266 / HardwareSerial . cpp <nl> int HardwareSerial : : available ( void ) <nl> result + = 1 ; <nl> } <nl> if ( ! result ) { <nl> - optimistic_yield ( USD ( _uart_nr ) / 128 ) ; <nl> + optimistic_yield ( 10000 ) ; <nl> } <nl> return result ; <nl> } <nl>
Remove UART register reference from HardwareSerial
esp8266/Arduino
d1149c53e68ef79292486368e2b01da408422ab4
2016-01-26T19:58:00Z
mmm a / python / mxnet / function . py <nl> ppp b / python / mxnet / function . py <nl> def __init__ ( self ) : <nl> ctypes . byref ( plist ) ) ) <nl> hmap = { } <nl> for i in range ( size . value ) : <nl> - hdl = plist [ i ] <nl> + hdl = ctypes . c_void_p ( plist [ i ] ) <nl> name = ctypes . c_char_p ( ) <nl> check_call ( _LIB . MXFuncGetName ( hdl , ctypes . byref ( name ) ) ) <nl> hmap [ name . value ] = _Function ( hdl , name . value ) <nl> mmm a / python / mxnet / symbol_creator . py <nl> ppp b / python / mxnet / symbol_creator . py <nl> def __init__ ( self ) : <nl> ctypes . byref ( plist ) ) ) <nl> hmap = { } <nl> for i in range ( size . value ) : <nl> + hdl = ctypes . c_void_p ( plist [ i ] ) <nl> name = ctypes . c_char_p ( ) <nl> - check_call ( _LIB . MXSymbolGetAtomicSymbolName ( plist [ i ] , ctypes . byref ( name ) ) ) <nl> - hmap [ name . value ] = _SymbolCreator ( name , plist [ i ] ) <nl> + check_call ( _LIB . MXSymbolGetAtomicSymbolName ( hdl , ctypes . byref ( name ) ) ) <nl> + hmap [ name . value ] = _SymbolCreator ( name , hdl ) <nl> self . __dict__ . update ( hmap ) <nl> <nl> def Variable ( self , name ) : <nl>
Merge pull request from mavenlin / master
apache/incubator-mxnet
c956ae7ab5eefa5885e107eb6dab3ca281413412
2015-08-20T15:06:14Z
mmm a / src / coroutine / socket . cc <nl> ppp b / src / coroutine / socket . cc <nl> bool Socket : : http_proxy_handshake ( ) <nl> return false ; <nl> } <nl> <nl> - static inline int socket_connect ( int fd , const struct sockaddr * addr , socklen_t len ) <nl> - { <nl> - int retval ; <nl> - while ( 1 ) <nl> - { <nl> - retval = : : connect ( fd , addr , len ) ; <nl> - if ( retval < 0 ) <nl> - { <nl> - if ( errno = = EINTR ) <nl> - { <nl> - continue ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - return retval ; <nl> - } <nl> - <nl> void Socket : : init_sock ( ) <nl> { <nl> # ifdef SOCK_CLOEXEC <nl> bool Socket : : connect ( const struct sockaddr * addr , socklen_t addrlen ) <nl> { <nl> return false ; <nl> } <nl> - int retval = socket_connect ( socket - > fd , addr , addrlen ) ; <nl> - if ( retval = = - 1 ) <nl> + int retval ; <nl> + do { <nl> + retval = : : connect ( socket - > fd , addr , addrlen ) ; <nl> + } while ( retval < 0 & & errno = = EINTR ) ; <nl> + if ( retval < 0 ) <nl> { <nl> if ( errno ! = EINPROGRESS ) <nl> { <nl> bool Socket : : connect ( const struct sockaddr * addr , socklen_t addrlen ) <nl> { <nl> return false ; <nl> } <nl> - / / Connection is closed <nl> if ( socket - > closed ) <nl> { <nl> set_err ( ECONNABORTED ) ; <nl> bool Socket : : connect ( const struct sockaddr * addr , socklen_t addrlen ) <nl> return false ; <nl> } <nl> } <nl> - set_err ( 0 ) ; <nl> socket - > active = 1 ; <nl> + set_err ( 0 ) ; <nl> return true ; <nl> } <nl> <nl>
Streamlining the code of connect .
swoole/swoole-src
51a100778e0b7fee2e0837b44dcaa245e2c5f39b
2019-01-17T09:53:57Z
mmm a / buildscripts / smoke . py <nl> ppp b / buildscripts / smoke . py <nl> <nl> winners = [ ] <nl> losers = { } <nl> <nl> + # Finally , atexit functions seem to be a little oblivious to whether <nl> + # Python is exiting because of an error , so we ' ll use this to <nl> + # communicate with the report ( ) function . <nl> + exit_bad = True <nl> + <nl> # For replication hash checking <nl> replicated_dbs = [ ] <nl> lost_in_slave = [ ] <nl> def start ( self ) : <nl> self . port + = 1 <nl> self . slave = True <nl> if os . path . exists ( dirName ) : <nl> - Popen ( [ " python " , " buildscripts / cleanbb . py " , dirName ] ) <nl> + call ( [ " python " , " buildscripts / cleanbb . py " , dirName ] ) <nl> utils . ensureDir ( dirName ) <nl> argv = [ mongodExecutable , " - - port " , str ( self . port ) , " - - dbpath " , dirName ] <nl> if ' smallOplog ' in self . kwargs : <nl> def missing ( lst , src , dst ) : <nl> print " % s \ t % s " % ( db , screwy_in_slave [ db ] ) <nl> if smallOplog and not ( lost_in_master or lost_in_slave or screwy_in_slave ) : <nl> print " replication ok for % d databases " % ( len ( replicated_dbs ) ) <nl> - if ( losers or lost_in_slave or lost_in_master or screwy_in_slave ) : <nl> + if ( exit_bad or losers or lost_in_slave or lost_in_master or screwy_in_slave ) : <nl> status = 1 <nl> else : <nl> status = 0 <nl> def main ( ) : <nl> elif options . mode = = ' files ' : <nl> tests = [ ( os . path . abspath ( test ) , True ) for test in tests ] <nl> <nl> - return runTests ( tests ) <nl> + runTests ( tests ) <nl> + exit_bad = False <nl> <nl> atexit . register ( report ) <nl> <nl>
Make smoke . py more careful about exit status SERVER - 253 & SERVER - 1051
mongodb/mongo
29cff651d4b89e82001dec35b4622ff804554f99
2010-06-11T21:06:00Z
mmm a / include / swift / ABI / Metadata . h <nl> ppp b / include / swift / ABI / Metadata . h <nl> struct TargetGenericWitnessTable { <nl> return WitnessTablePrivateSizeInWordsAndRequiresInstantiation > > 1 ; <nl> } <nl> <nl> - / / / Whether the witness table is known to require instantiation . <nl> + / / / This bit doesn ' t really mean anything . Currently , the compiler always <nl> + / / / sets it when emitting a generic witness table . <nl> uint16_t requiresInstantiation ( ) const { <nl> return WitnessTablePrivateSizeInWordsAndRequiresInstantiation & 0x01 ; <nl> } <nl> mmm a / lib / IRGen / ConformanceDescription . h <nl> ppp b / lib / IRGen / ConformanceDescription . h <nl> class ConformanceDescription { <nl> / / / Whether this witness table requires runtime specialization . <nl> const unsigned requiresSpecialization : 1 ; <nl> <nl> - / / / Whether this witness table contains dependent associated type witnesses . <nl> - const unsigned hasDependentAssociatedTypeWitnesses : 1 ; <nl> - <nl> / / / The instantiation function , to be run at the end of witness table <nl> / / / instantiation . <nl> llvm : : Constant * instantiationFn = nullptr ; <nl> class ConformanceDescription { <nl> llvm : : Constant * pattern , <nl> uint16_t witnessTableSize , <nl> uint16_t witnessTablePrivateSize , <nl> - bool requiresSpecialization , <nl> - bool hasDependentAssociatedTypeWitnesses ) <nl> + bool requiresSpecialization ) <nl> : conformance ( conformance ) , wtable ( wtable ) , pattern ( pattern ) , <nl> witnessTableSize ( witnessTableSize ) , <nl> witnessTablePrivateSize ( witnessTablePrivateSize ) , <nl> - requiresSpecialization ( requiresSpecialization ) , <nl> - hasDependentAssociatedTypeWitnesses ( hasDependentAssociatedTypeWitnesses ) <nl> + requiresSpecialization ( requiresSpecialization ) <nl> { <nl> } <nl> } ; <nl> mmm a / lib / IRGen / GenProto . cpp <nl> ppp b / lib / IRGen / GenProto . cpp <nl> static bool hasDependentTypeWitness ( <nl> static bool isDependentConformance ( <nl> IRGenModule & IGM , <nl> const RootProtocolConformance * rootConformance , <nl> - bool considerResilience , <nl> llvm : : SmallPtrSet < const NormalProtocolConformance * , 4 > & visited ) { <nl> / / Self - conformances are never dependent . <nl> auto conformance = dyn_cast < NormalProtocolConformance > ( rootConformance ) ; <nl> static bool isDependentConformance ( <nl> return false ; <nl> <nl> / / If the conformance is resilient , this is always true . <nl> - if ( considerResilience & & IGM . isResilientConformance ( conformance ) ) <nl> + if ( IGM . isResilientConformance ( conformance ) ) <nl> return true ; <nl> <nl> / / Check whether any of the conformances are dependent . <nl> static bool isDependentConformance ( <nl> isDependentConformance ( IGM , <nl> assocConformance . getConcrete ( ) <nl> - > getRootConformance ( ) , <nl> - considerResilience , <nl> visited ) ) <nl> return true ; <nl> } <nl> static bool isDependentConformance ( <nl> / / / Is there anything about the given conformance that requires witness <nl> / / / tables to be dependently - generated ? <nl> bool IRGenModule : : isDependentConformance ( <nl> - const RootProtocolConformance * conformance , <nl> - bool considerResilience ) { <nl> + const RootProtocolConformance * conformance ) { <nl> llvm : : SmallPtrSet < const NormalProtocolConformance * , 4 > visited ; <nl> - return : : isDependentConformance ( * this , conformance , considerResilience , <nl> - visited ) ; <nl> + return : : isDependentConformance ( * this , conformance , visited ) ; <nl> } <nl> <nl> static bool isSynthesizedNonUnique ( const RootProtocolConformance * conformance ) { <nl> class AccessorConformanceInfo : public ConformanceInfo { <nl> / / offsets , with conditional conformances closest to 0 . <nl> unsigned NextPrivateDataIndex = 0 ; <nl> bool ResilientConformance ; <nl> - bool RequiresSpecialization = false ; <nl> <nl> const ProtocolInfo & PI ; <nl> <nl> class AccessorConformanceInfo : public ConformanceInfo { <nl> PI ( IGM . getProtocolInfo ( SILWT - > getConformance ( ) - > getProtocol ( ) , <nl> ( ResilientConformance <nl> ? ProtocolInfoKind : : RequirementSignature <nl> - : ProtocolInfoKind : : Full ) ) ) { <nl> - / / If the conformance is resilient , we require runtime instantiation . <nl> - if ( ResilientConformance ) <nl> - RequiresSpecialization = true ; <nl> - } <nl> + : ProtocolInfoKind : : Full ) ) ) { } <nl> <nl> / / / The number of entries in the witness table . <nl> unsigned getTableSize ( ) const { return TableSize ; } <nl> class AccessorConformanceInfo : public ConformanceInfo { <nl> / / / The number of private entries in the witness table . <nl> unsigned getTablePrivateSize ( ) const { return NextPrivateDataIndex ; } <nl> <nl> - / / / Whether this witness table must be specialized at runtime . <nl> - bool requiresSpecialization ( ) const { return RequiresSpecialization ; } <nl> - <nl> / / / The top - level entry point . <nl> void build ( ) ; <nl> <nl> class AccessorConformanceInfo : public ConformanceInfo { <nl> } <nl> <nl> / / Otherwise , we ' ll need to derive it at instantiation time . <nl> - RequiresSpecialization = true ; <nl> SpecializedBaseConformances . push_back ( { Table . size ( ) , & conf } ) ; <nl> Table . addNullPointer ( IGM . Int8PtrTy ) ; <nl> } <nl> class AccessorConformanceInfo : public ConformanceInfo { <nl> auto associate = <nl> Conformance . getTypeWitness ( requirement . getAssociation ( ) , nullptr ) <nl> - > getCanonicalType ( ) ; <nl> - if ( associate - > hasTypeParameter ( ) ) <nl> - RequiresSpecialization = true ; <nl> llvm : : Constant * witness = <nl> IGM . getAssociatedTypeWitness ( associate , / * inProtocolContext = * / false ) ; <nl> Table . addBitCast ( witness , IGM . Int8PtrTy ) ; <nl> class AccessorConformanceInfo : public ConformanceInfo { <nl> requirement . getAssociation ( ) , <nl> requirement . getAssociatedRequirement ( ) ) ; <nl> <nl> - if ( requirement . getAssociation ( ) - > hasTypeParameter ( ) ) <nl> - RequiresSpecialization = true ; <nl> - <nl> # ifndef NDEBUG <nl> assert ( entry . getKind ( ) = = SILWitnessTable : : AssociatedTypeProtocol <nl> & & " sil witness table does not match protocol " ) ; <nl> class AccessorConformanceInfo : public ConformanceInfo { <nl> <nl> / / / Allocate another word of private data storage in the conformance table . <nl> unsigned getNextPrivateDataIndex ( ) { <nl> - RequiresSpecialization = true ; <nl> return NextPrivateDataIndex + + ; <nl> } <nl> <nl> namespace { <nl> / / WitnessTablePrivateSizeInWordsAndRequiresInstantiation <nl> B . addInt ( IGM . Int16Ty , <nl> ( Description . witnessTablePrivateSize < < 1 ) | <nl> - Description . hasDependentAssociatedTypeWitnesses ) ; <nl> + Description . requiresSpecialization ) ; <nl> / / Instantiation function <nl> B . addRelativeAddressOrNull ( Description . instantiationFn ) ; <nl> / / Private data <nl> IRGenModule : : getConformanceInfo ( const ProtocolDecl * protocol , <nl> <nl> const ConformanceInfo * info ; <nl> / / If the conformance is dependent in any way , we need to unique it . <nl> - / / TODO : maybe this should apply whenever it ' s out of the module ? <nl> - / / TODO : actually enable this <nl> + / / <nl> / / FIXME : Both implementations of ConformanceInfo are trivially - destructible , <nl> / / so in theory we could allocate them on a BumpPtrAllocator . But there ' s not <nl> / / a good one for us to use . ( The ASTContext ' s outlives the IRGenModule in <nl> / / batch mode . ) <nl> - if ( isDependentConformance ( rootConformance , / * considerResilience = * / true ) | | <nl> + if ( isDependentConformance ( rootConformance ) | | <nl> / / Foreign types need to go through the accessor to unique the witness <nl> / / table . <nl> isSynthesizedNonUnique ( rootConformance ) ) { <nl> void IRGenModule : : emitSILWitnessTable ( SILWitnessTable * wt ) { <nl> / / Produce the initializer value . <nl> auto initializer = wtableContents . finishAndCreateFuture ( ) ; <nl> <nl> + bool isDependent = isDependentConformance ( conf ) ; <nl> + <nl> llvm : : GlobalVariable * global = nullptr ; <nl> unsigned tableSize ; <nl> if ( ! isResilientConformance ( conf ) ) { <nl> - bool isDependent = <nl> - isDependentConformance ( conf , / * considerResilience = * / false ) ; <nl> global = cast < llvm : : GlobalVariable > ( <nl> - isDependent <nl> + ( isDependent & & conf - > getDeclContext ( ) - > isGenericContext ( ) ) <nl> ? getAddrOfWitnessTablePattern ( cast < NormalProtocolConformance > ( conf ) , <nl> initializer ) <nl> : getAddrOfWitnessTable ( conf , initializer ) ) ; <nl> void IRGenModule : : emitSILWitnessTable ( SILWitnessTable * wt ) { <nl> / / descriptor . <nl> ConformanceDescription description ( conf , wt , global , tableSize , <nl> wtableBuilder . getTablePrivateSize ( ) , <nl> - wtableBuilder . requiresSpecialization ( ) , <nl> - isDependentConformance ( <nl> - conf , <nl> - / * considerResilience = * / false ) ) ; <nl> + isDependent ) ; <nl> <nl> / / Build the instantiation function , we if need one . <nl> description . instantiationFn = wtableBuilder . buildInstantiationFunction ( ) ; <nl> mmm a / lib / IRGen / IRGenModule . h <nl> ppp b / lib / IRGen / IRGenModule . h <nl> class IRGenModule { <nl> <nl> bool isResilientConformance ( const NormalProtocolConformance * conformance ) ; <nl> bool isResilientConformance ( const RootProtocolConformance * root ) ; <nl> - bool isDependentConformance ( const RootProtocolConformance * conformance , <nl> - bool considerResilience ) ; <nl> + bool isDependentConformance ( const RootProtocolConformance * conformance ) ; <nl> <nl> Alignment getCappedAlignment ( Alignment alignment ) ; <nl> <nl> mmm a / test / IRGen / protocol_conformance_records . swift <nl> ppp b / test / IRGen / protocol_conformance_records . swift <nl> public protocol Runcible { <nl> / / - - witness table <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records15NativeValueTypeVAA8RuncibleAAWP " <nl> / / - - flags <nl> - / / CHECK - SAME : i32 0 <nl> - / / CHECK - SAME : } , <nl> + / / CHECK - SAME : i32 0 } , <nl> public struct NativeValueType : Runcible { <nl> public func runce ( ) { } <nl> } <nl> public struct NativeValueType : Runcible { <nl> / / - - witness table <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records15NativeClassTypeCAA8RuncibleAAWP " <nl> / / - - flags <nl> - / / CHECK - SAME : i32 0 <nl> - / / CHECK - SAME : } , <nl> + / / CHECK - SAME : i32 0 } , <nl> public class NativeClassType : Runcible { <nl> public func runce ( ) { } <nl> } <nl> public class NativeClassType : Runcible { <nl> / / - - witness table <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records17NativeGenericTypeVyxGAA8RuncibleAAWP " <nl> / / - - flags <nl> - / / CHECK - SAME : i32 0 <nl> - / / CHECK - SAME : } , <nl> + / / CHECK - SAME : i32 0 } , <nl> public struct NativeGenericType < T > : Runcible { <nl> public func runce ( ) { } <nl> } <nl> extension Size : Runcible { <nl> public func runce ( ) { } <nl> } <nl> <nl> + / / A non - dependent type conforming to a protocol with associated conformances <nl> + / / does not require a generic witness table . <nl> + public protocol Simple { } <nl> + <nl> + public protocol AssociateConformance { <nl> + associatedtype X : Simple <nl> + } <nl> + <nl> + public struct Other : Simple { } <nl> + <nl> + public struct Concrete : AssociateConformance { <nl> + public typealias X = Other <nl> + } <nl> + <nl> + / / CHECK - LABEL : @ " $ s28protocol_conformance_records8ConcreteVAA20AssociateConformanceAAMc " = { { dllexport | protected | } } constant <nl> + / / - - protocol descriptor <nl> + / / CHECK - SAME : @ " $ s28protocol_conformance_records20AssociateConformanceMp " <nl> + / / - - nominal type descriptor <nl> + / / CHECK - SAME : @ " $ s28protocol_conformance_records8ConcreteVMn " <nl> + / / - - witness table <nl> + / / CHECK - SAME : @ " $ s28protocol_conformance_records8ConcreteVAA20AssociateConformanceAAWP " <nl> + / / - - no flags are set , and no generic witness table follows <nl> + / / CHECK - SAME : i32 0 } <nl> + <nl> / / CHECK - LABEL : @ " \ 01l_protocols " <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records8RuncibleMp " <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records5SpoonMp " <nl> extension Int : OtherResilientProtocol { } <nl> / / - - witness table pattern <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records9DependentVyxGAA9AssociateAAWp " <nl> / / - - flags <nl> - / / CHECK - SAME : i32 0 <nl> + / / CHECK - SAME : i32 131072 , <nl> / / - - number of words in witness table <nl> / / CHECK - SAME : i16 2 , <nl> / / - - number of private words in witness table + bit for " needs instantiation " <nl> extension Dependent : Associate { <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records15NativeClassTypeCAA8RuncibleAAMc " <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records17NativeGenericTypeVyxGAA8RuncibleAAMc " <nl> / / CHECK - SAME : @ " $ s16resilient_struct4SizeV28protocol_conformance_records8RuncibleADMc " <nl> + / / CHECK - SAME : @ " $ s28protocol_conformance_records8ConcreteVAA20AssociateConformanceAAMc " <nl> / / CHECK - SAME : @ " $ s28protocol_conformance_records17NativeGenericTypeVyxGAA5SpoonA2aERzlMc " <nl> - / / CHECK - SAME : @ " $ sSi18resilient_protocol22OtherResilientProtocol0B20_conformance_recordsMc " <nl> + / / CHECK - SAME : @ " $ sSi18resilient_protocol22OtherResilientProtocol0B20_conformance_recordsMc " <nl> \ No newline at end of file <nl> mmm a / test / IRGen / protocol_resilience . sil <nl> ppp b / test / IRGen / protocol_resilience . sil <nl> protocol InternalProtocol { <nl> / / - - number of witness table entries <nl> / / CHECK - SAME : i16 0 , <nl> <nl> - / / - - size of private area + ' requires instantiation ' bit ( not set ) <nl> - / / CHECK - SAME : i16 0 , <nl> + / / - - size of private area + ' requires instantiation ' bit <nl> + / / CHECK - SAME : i16 1 , <nl> <nl> / / - - instantiator function <nl> / / CHECK - SAME : i32 0 <nl> protocol InternalProtocol { <nl> / / - - number of witness table entries <nl> / / CHECK - SAME : i16 0 , <nl> <nl> - / / - - size of private area + ' requires instantiation ' bit ( not set ) <nl> - / / CHECK - SAME : i16 0 , <nl> + / / - - size of private area + ' requires instantiation ' bit <nl> + / / CHECK - SAME : i16 1 , <nl> <nl> / / - - instantiator function <nl> / / CHECK - SAME : i32 0 <nl> mmm a / test / IRGen / protocol_resilience_descriptors . swift <nl> ppp b / test / IRGen / protocol_resilience_descriptors . swift <nl> public struct ConditionallyConforms < Element > { } <nl> public struct Y { } <nl> <nl> / / CHECK - USAGE - LABEL : @ " $ s31protocol_resilience_descriptors1YV010resilient_A022OtherResilientProtocolAAMc " = <nl> + / / - - flags : has generic witness table <nl> / / CHECK - USAGE - SAME : i32 131072 , <nl> + / / - - number of witness table entries <nl> / / CHECK - USAGE - SAME : i16 0 , <nl> - / / CHECK - USAGE - SAME : i16 0 , <nl> - / / CHECK - USAGE - SAME : i32 0 <nl> + / / - - size of private area + ' requires instantiation ' bit <nl> + / / CHECK - USAGE - SAME : i16 1 , <nl> + / / - - instantiator function <nl> + / / CHECK - USAGE - SAME : i32 0 , <nl> + / / - - private data area <nl> + / / CHECK - USAGE - SAME : { { @ [ 0 - 9 ] + } } <nl> + / / - - <nl> + / / CHECK - USAGE - SAME : } <nl> extension Y : OtherResilientProtocol { } <nl> <nl> / / CHECK - USAGE : @ " $ s31protocol_resilience_descriptors29ConformsWithAssocRequirementsV010resilient_A008ProtocoleF12TypeDefaultsAAMc " = <nl>
Merge pull request from slavapestov / resilient - witness - table - cleanup
apple/swift
88bc29a511cfaabf3fbd643df8db5840e56efc0a
2019-02-23T02:55:52Z
mmm a / browser / api / lib / window . coffee <nl> ppp b / browser / api / lib / window . coffee <nl> <nl> EventEmitter = require ( ' events ' ) . EventEmitter <nl> <nl> Window = process . atom_binding ( ' window ' ) . Window <nl> - <nl> - # Inherits EventEmitter . <nl> - for prop , func of EventEmitter . prototype <nl> - Window . prototype [ prop ] = func <nl> + Window . prototype . __proto__ = EventEmitter . prototype <nl> <nl> # Convient accessors . <nl> setupGetterAndSetter = ( constructor , name , getter , setter ) - > <nl>
Simpler way of inheriting EventEmitter .
electron/electron
db0717851d40734998b140bf0fb3310ac0a8e74a
2013-04-22T08:11:56Z
mmm a / hphp / runtime / base / array - data . cpp <nl> ppp b / hphp / runtime / base / array - data . cpp <nl> <nl> # include " hphp / runtime / base / builtin - functions . h " <nl> # include " hphp / runtime / base / comparisons . h " <nl> # include " hphp / runtime / base / memory - manager . h " <nl> + # include " hphp / runtime / base / memory - manager - defs . h " <nl> # include " hphp / runtime / base / mixed - array . h " <nl> # include " hphp / runtime / base / packed - array . h " <nl> # include " hphp / runtime / base / request - info . h " <nl> size_t loadedStaticArrayCount ( ) { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - size_t ArrayData : : allocSize ( ) const { <nl> - if ( hasVanillaMixedLayout ( ) ) return MixedArray : : asMixed ( this ) - > heapSize ( ) ; <nl> - if ( isKeysetKind ( ) ) return SetArray : : asSet ( this ) - > heapSize ( ) ; <nl> - return PackedArray : : heapSize ( this ) ; <nl> - } <nl> - <nl> void ArrayData : : GetScalarArray ( ArrayData * * parr , arrprov : : Tag tag ) { <nl> auto const arr = * parr ; <nl> auto const requested_tag = RuntimeOption : : EvalArrayProvenance & & tag . valid ( ) ; <nl> void ArrayData : : GetScalarArray ( ArrayData * * parr , arrprov : : Tag tag ) { <nl> <nl> auto ad = arr - > copyStatic ( ) ; <nl> assertx ( ad - > isStatic ( ) ) ; <nl> - MemoryStats : : LogAlloc ( AllocKind : : StaticArray , ad - > allocSize ( ) ) ; <nl> + MemoryStats : : LogAlloc ( AllocKind : : StaticArray , allocSize ( ad ) ) ; <nl> <nl> s_cachedHash . first = ad ; <nl> assertx ( ScalarHash { } . raw_hash ( ad ) = = s_cachedHash . second ) ; <nl> mmm a / hphp / runtime / base / array - data . h <nl> ppp b / hphp / runtime / base / array - data . h <nl> struct ArrayData : MaybeCountable { <nl> * / <nl> void onSetEvalScalar ( ) ; <nl> <nl> - / * <nl> - * Total size on the heap . <nl> - * / <nl> - size_t allocSize ( ) const ; <nl> - <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / Other functions . <nl> / / <nl>
Delete ArrayData : : allocSize
facebook/hhvm
683a160e5029a9ce97ebfb22bcc529949b85094c
2020-06-04T02:24:03Z
mmm a / dbms / tests / queries / 0_stateless / 00700_decimal_null . sql <nl> ppp b / dbms / tests / queries / 0_stateless / 00700_decimal_null . sql <nl> CREATE TABLE IF NOT EXISTS test . decimal <nl> SELECT toNullable ( toDecimal32 ( 32 , 0 ) ) AS x , assumeNotNull ( x ) ; <nl> SELECT toNullable ( toDecimal64 ( 64 , 0 ) ) AS x , assumeNotNull ( x ) ; <nl> SELECT toNullable ( toDecimal128 ( 128 , 0 ) ) AS x , assumeNotNull ( x ) ; <nl> - SELECT NULL AS x , assumeNotNull ( x ) ; - - { serverError 48 } <nl> <nl> SELECT ifNull ( toDecimal32 ( 1 , 0 ) , NULL ) , ifNull ( toDecimal64 ( 1 , 0 ) , NULL ) , ifNull ( toDecimal128 ( 1 , 0 ) , NULL ) ; <nl> SELECT ifNull ( toNullable ( toDecimal32 ( 2 , 0 ) ) , NULL ) , ifNull ( toNullable ( toDecimal64 ( 2 , 0 ) ) , NULL ) , ifNull ( toNullable ( toDecimal128 ( 2 , 0 ) ) , NULL ) ; <nl>
fix test
ClickHouse/ClickHouse
94997889c514198277f8db163c7eeb20d5ddab68
2018-09-04T22:17:01Z
mmm a / arangod / VocBase / ExampleMatcher . cpp <nl> ppp b / arangod / VocBase / ExampleMatcher . cpp <nl> void ExampleMatcher : : fillExampleDefinition ( TRI_json_t const * example , <nl> string const key ( keyStr ) ; <nl> auto jsonValue = static_cast < TRI_json_t const * > ( TRI_AtVector ( & objects , i + 1 ) ) ; <nl> if ( ! TRI_IsStringJson ( jsonValue ) ) { <nl> - / / TODO FIXME incorrect Error here <nl> - throw TRI_RESULT_ELEMENT_NOT_FOUND ; <nl> + throw TRI_ERROR_TYPE_ERROR ; <nl> } <nl> string keyVal ( jsonValue - > _value . _string . data ) ; <nl> if ( TRI_VOC_ATTRIBUTE_KEY = = key ) { <nl>
The ExampleMatcher now returns a fitting error in case the example JSON is corrupted
arangodb/arangodb
85dbb1c88bb970728883a4843084e1113c113d15
2015-07-29T07:39:24Z
mmm a / src / inspector / v8 - console . cc <nl> ppp b / src / inspector / v8 - console . cc <nl> v8 : : Local < v8 : : Object > V8Console : : createCommandLineAPI ( <nl> DCHECK ( success ) ; <nl> USE ( success ) ; <nl> <nl> - / / TODO ( dgozman ) : this CommandLineAPIData instance leaks . Use PodArray maybe ? <nl> - v8 : : Local < v8 : : External > data = <nl> - v8 : : External : : New ( isolate , new CommandLineAPIData ( this , sessionId ) ) ; <nl> + v8 : : Local < v8 : : ArrayBuffer > data = <nl> + v8 : : ArrayBuffer : : New ( isolate , sizeof ( CommandLineAPIData ) ) ; <nl> + * static_cast < CommandLineAPIData * > ( data - > GetContents ( ) . Data ( ) ) = <nl> + CommandLineAPIData ( this , sessionId ) ; <nl> createBoundFunctionProperty ( context , commandLineAPI , data , " dir " , <nl> & V8Console : : call < & V8Console : : Dir > , <nl> " function dir ( value ) { [ Command Line API ] } " ) ; <nl> mmm a / src / inspector / v8 - console . h <nl> ppp b / src / inspector / v8 - console . h <nl> class V8Console : public v8 : : debug : : ConsoleDelegate { <nl> int ) > <nl> static void call ( const v8 : : FunctionCallbackInfo < v8 : : Value > & info ) { <nl> CommandLineAPIData * data = static_cast < CommandLineAPIData * > ( <nl> - info . Data ( ) . As < v8 : : External > ( ) - > Value ( ) ) ; <nl> + info . Data ( ) . As < v8 : : ArrayBuffer > ( ) - > GetContents ( ) . Data ( ) ) ; <nl> ( data - > first - > * func ) ( info , data - > second ) ; <nl> } <nl> template < void ( V8Console : : * func ) ( const v8 : : debug : : ConsoleCallArguments & , <nl> const v8 : : debug : : ConsoleContext & ) > <nl> static void call ( const v8 : : FunctionCallbackInfo < v8 : : Value > & info ) { <nl> CommandLineAPIData * data = static_cast < CommandLineAPIData * > ( <nl> - info . Data ( ) . As < v8 : : External > ( ) - > Value ( ) ) ; <nl> + info . Data ( ) . As < v8 : : ArrayBuffer > ( ) - > GetContents ( ) . Data ( ) ) ; <nl> v8 : : debug : : ConsoleCallArguments args ( info ) ; <nl> ( data - > first - > * func ) ( args , v8 : : debug : : ConsoleContext ( ) ) ; <nl> } <nl>
[ inspector ] fixed CommandLineAPIData leak
v8/v8
f51192bc4d233087f2a1a04b542bb42866026714
2017-11-15T17:17:25Z
mmm a / src / ia32 / lithium - codegen - ia32 . cc <nl> ppp b / src / ia32 / lithium - codegen - ia32 . cc <nl> void LCodeGen : : EmitNumberUntagD ( Register input_reg , <nl> void LCodeGen : : DoDeferredTaggedToI ( LTaggedToI * instr , Label * done ) { <nl> Register input_reg = ToRegister ( instr - > value ( ) ) ; <nl> <nl> + / / The input was optimistically untagged ; revert it . <nl> + STATIC_ASSERT ( kSmiTagSize = = 1 ) ; <nl> + __ lea ( input_reg , Operand ( input_reg , times_2 , kHeapObjectTag ) ) ; <nl> + <nl> if ( instr - > truncating ( ) ) { <nl> Label no_heap_number , check_bools , check_false ; <nl> <nl> void LCodeGen : : DoDeferredTaggedToI ( LTaggedToI * instr , Label * done ) { <nl> __ RecordComment ( " Deferred TaggedToI : cannot truncate " ) ; <nl> DeoptimizeIf ( not_equal , instr - > environment ( ) ) ; <nl> __ Set ( input_reg , Immediate ( 0 ) ) ; <nl> - __ jmp ( done ) ; <nl> } else { <nl> Label bailout ; <nl> XMMRegister scratch = ( instr - > temp ( ) ! = NULL ) <nl> void LCodeGen : : DoTaggedToI ( LTaggedToI * instr ) { <nl> } else { <nl> DeferredTaggedToI * deferred = <nl> new ( zone ( ) ) DeferredTaggedToI ( this , instr , x87_stack_ ) ; <nl> - <nl> - __ JumpIfNotSmi ( input_reg , deferred - > entry ( ) ) ; <nl> + / / Optimistically untag the input . <nl> + / / If the input is a HeapObject , SmiUntag will set the carry flag . <nl> + STATIC_ASSERT ( kSmiTagSize = = 1 & & kSmiTag = = 0 ) ; <nl> __ SmiUntag ( input_reg ) ; <nl> + / / Branch to deferred code if the input was tagged . <nl> + / / The deferred code will take care of restoring the tag . <nl> + __ j ( carry , deferred - > entry ( ) ) ; <nl> __ bind ( deferred - > exit ( ) ) ; <nl> } <nl> } <nl>
Optimistically untag the input in tagged - to - i .
v8/v8
a4d3fbdc8f6cb8382ad22e686aa943f176657848
2014-03-07T08:36:13Z
mmm a / tests / runner . py <nl> ppp b / tests / runner . py <nl> def get_bullet_library ( runner_core , use_cmake ) : <nl> <nl> python tests / runner . py ALL . test_hello_world <nl> <nl> + Debugging : You can run <nl> + <nl> + EM_SAVE_DIR = 1 python tests / runner . py ALL . test_hello_world <nl> + <nl> + in order to save the test runner directory , in / tmp / emscripten_temp . All files <nl> + created by the test will be present there . You can also use EMCC_DEBUG to <nl> + further debug the compiler itself , which works outside of the test suite as <nl> + well : EMCC_DEBUG = 1 will emit emcc - * files in that temp dir for each stage <nl> + of the compiler , while EMCC_DEBUG = 2 will emit even more files , one for each <nl> + js optimizer phase . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> ' ' ' <nl>
comment on test suite debugging
emscripten-core/emscripten
39278a5af2241f81551f85d79aeec2557de72f69
2014-02-10T21:35:55Z
mmm a / fdbrpc / FlowTransport . actor . cpp <nl> ppp b / fdbrpc / FlowTransport . actor . cpp <nl> struct Peer : NonCopyable { <nl> ( peer - > lastDataPacketSentTime < now ( ) - FLOW_KNOBS - > CONNECTION_MONITOR_UNREFERENCED_CLOSE_DELAY ) ) { <nl> / / TODO : What about when peerReference = = - 1 ? <nl> throw connection_unreferenced ( ) ; <nl> - } else if ( FlowTransport : : transport ( ) . isClient ( ) & & peer - > destination . isPublic ( ) & & <nl> + } else if ( FlowTransport : : transport ( ) . isClient ( ) & & peer - > compatible & & peer - > destination . isPublic ( ) & & <nl> ( peer - > lastConnectTime < now ( ) - FLOW_KNOBS - > CONNECTION_MONITOR_IDLE_TIMEOUT ) & & <nl> ( peer - > lastDataPacketSentTime < now ( ) - FLOW_KNOBS - > CONNECTION_MONITOR_IDLE_TIMEOUT ) ) { <nl> / / First condition is necessary because we may get here if we are server . <nl>
do not close idle network connections with incompatible servers
apple/foundationdb
84fd1003a53002801e5a48ec307bf41e6bb76064
2019-08-09T06:47:00Z
new file mode 100644 <nl> index 0000000000 . . a54a2ff320 <nl> mmm / dev / null <nl> ppp b / code / sorting / bubble_sort / bubble_sort . sml <nl> <nl> + ( * Bubblesort <nl> + * Time complexity : O ( n ^ 2 ) <nl> + * ) <nl> + fun bubblesort [ ] = [ ] <nl> + | bubblesort ( x : : xs ) = <nl> + let <nl> + val ( y , ys , s ) = foldl ( fn ( c , ( p , ps , s ) ) = > <nl> + if c < p then ( p , c : : ps , true ) else ( c , p : : ps , s ) <nl> + ) ( x , [ ] , false ) xs ; <nl> + val xs ' = foldl op : : [ ] ( y : : ys ) <nl> + in <nl> + if s then bubblesort xs ' else xs ' <nl> + end <nl> + <nl> + val test_0 = bubblesort [ ] = [ ] <nl> + val test_1 = bubblesort [ 1 , 2 , 3 ] = [ 1 , 2 , 3 ] <nl> + val test_2 = bubblesort [ 1 , 3 , 2 ] = [ 1 , 2 , 3 ] <nl> + val test_3 = bubblesort [ 6 , 2 , 7 , 5 , 8 , 1 , 3 , 4 ] = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] <nl>
Add a Standard ML implementation of bubble sort
OpenGenus/cosmos
50896f16b78c51fa9d9af63a56daf46dc23bc573
2017-10-17T13:39:16Z
mmm a / test / IRGen / ordering_x86 . sil <nl> ppp b / test / IRGen / ordering_x86 . sil <nl> bb0 : <nl> / / the order of features differs . <nl> <nl> / / X86_64 : define { { ( protected ) ? } } swiftcc void @ baz { { . * } } # 0 <nl> - / / X86_64 : # 0 = { { . * } } " target - features " = " + cx16 , + fxsr , + mmx , + sse , + sse2 , + sse3 , + ssse3 , + x87 " <nl> + / / X86_64 : # 0 = { { . * } } " target - features " = " + cx16 , + fxsr , + mmx , + sahf , + sse , + sse2 , + sse3 , + ssse3 , + x87 " <nl>
Attempt to fix IRGen test affected by clang change
apple/swift
58fb682374b2ea7afe5390f7736c8a5df767b090
2018-05-17T16:47:16Z
mmm a / unittest / apiexample_test . cc <nl> ppp b / unittest / apiexample_test . cc <nl> class QuickTest : public testing : : Test { <nl> protected : <nl> virtual void SetUp ( ) { start_time_ = time ( nullptr ) ; } <nl> virtual void TearDown ( ) { <nl> + # if defined ( DEBUG ) <nl> + / / Debug builds can be very slow , so allow 4 min for OCR of a test image . <nl> + / / apitest_example including disabled tests takes about 18 min on ARMv7 . <nl> + const time_t MAX_SECONDS_FOR_TEST = 240 ; <nl> + # else <nl> + / / Release builds typically need less than 10 s for OCR of a test image , <nl> + / / apitest_example including disabled tests takes about 90 s on ARMv7 . <nl> + const time_t MAX_SECONDS_FOR_TEST = 55 ; <nl> + # endif <nl> const time_t end_time = time ( nullptr ) ; <nl> - EXPECT_TRUE ( end_time - start_time_ < = 55 ) <nl> + EXPECT_TRUE ( end_time - start_time_ < = MAX_SECONDS_FOR_TEST ) <nl> < < " The test took too long - " <nl> < < : : testing : : PrintToString ( end_time - start_time_ ) ; <nl> } <nl>
unittest : Allow more time for apiexample_test when using a debug build
tesseract-ocr/tesseract
c4de29d16fc5ac826d56633b940cba01f2079988
2019-01-14T16:56:35Z
mmm a / Telegram . sln <nl> ppp b / Telegram . sln <nl> VisualStudioVersion = 14 . 0 . 24720 . 0 <nl> MinimumVisualStudioVersion = 10 . 0 . 40219 . 1 <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " Telegram " , " Telegram \ Telegram . vcxproj " , " { B12702AD - ABFB - 343A - A199 - 8E24837244A3 } " <nl> ProjectSection ( ProjectDependencies ) = postProject <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } = { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } <nl> { E4DF8176 - 4DEF - 4859 - 962F - B497E3E7A323 } = { E4DF8176 - 4DEF - 4859 - 962F - B497E3E7A323 } <nl> { E417CAA4 - 259B - 4C99 - 88E3 - 805F1300E8EB } = { E417CAA4 - 259B - 4C99 - 88E3 - 805F1300E8EB } <nl> { EB7D16AC - EACF - 4577 - B05A - F28E5F356794 } = { EB7D16AC - EACF - 4577 - B05A - F28E5F356794 } <nl> { 7C25BFBD - 7930 - 4DE2 - AF33 - 27CE1CC521E6 } = { 7C25BFBD - 7930 - 4DE2 - AF33 - 27CE1CC521E6 } <nl> EndProjectSection <nl> EndProject <nl> - Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " MetaStyle " , " Telegram \ MetaStyle . vcxproj " , " { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } " <nl> - EndProject <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " MetaEmoji " , " Telegram \ MetaEmoji . vcxproj " , " { EB7D16AC - EACF - 4577 - B05A - F28E5F356794 } " <nl> EndProject <nl> Project ( " { 8BC9CEB8 - 8B4A - 11D0 - 8D11 - 00A0C91BC942 } " ) = " Updater " , " Telegram \ Updater . vcxproj " , " { 6B4BA3BE - 7B15 - 4B4C - B200 - 81ABFDEF2C76 } " <nl> Global <nl> { B12702AD - ABFB - 343A - A199 - 8E24837244A3 } . Release | Win32 . ActiveCfg = Release | Win32 <nl> { B12702AD - ABFB - 343A - A199 - 8E24837244A3 } . Release | Win32 . Build . 0 = Release | Win32 <nl> { B12702AD - ABFB - 343A - A199 - 8E24837244A3 } . Release | x64 . ActiveCfg = Release | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Debug | Win32 . ActiveCfg = Debug | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Debug | Win32 . Build . 0 = Debug | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Debug | x64 . ActiveCfg = Debug | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Deploy | Win32 . ActiveCfg = Deploy | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Deploy | Win32 . Build . 0 = Deploy | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Deploy | x64 . ActiveCfg = Release | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Release | Win32 . ActiveCfg = Release | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Release | Win32 . Build . 0 = Release | Win32 <nl> - { 6F483617 - 7C84 - 4E7E - 91D8 - 1FF28A4CE3A0 } . Release | x64 . ActiveCfg = Release | Win32 <nl> { EB7D16AC - EACF - 4577 - B05A - F28E5F356794 } . Debug | Win32 . ActiveCfg = Debug | Win32 <nl> { EB7D16AC - EACF - 4577 - B05A - F28E5F356794 } . Debug | x64 . ActiveCfg = Debug | Win32 <nl> { EB7D16AC - EACF - 4577 - B05A - F28E5F356794 } . Deploy | Win32 . ActiveCfg = Deploy | Win32 <nl> mmm a / Telegram / SourceFiles / codegen / common / basic_tokenized_file . cpp <nl> ppp b / Telegram / SourceFiles / codegen / common / basic_tokenized_file . cpp <nl> Token invalidToken ( ) { <nl> BasicTokenizedFile : : BasicTokenizedFile ( const QString & filepath ) : reader_ ( filepath ) { <nl> } <nl> <nl> + BasicTokenizedFile : : BasicTokenizedFile ( const QByteArray & content , const QString & filepath ) : reader_ ( content , filepath ) { <nl> + } <nl> + <nl> bool BasicTokenizedFile : : putBack ( ) { <nl> if ( currentToken_ > 0 ) { <nl> - - currentToken_ ; <nl> mmm a / Telegram / SourceFiles / codegen / common / basic_tokenized_file . h <nl> ppp b / Telegram / SourceFiles / codegen / common / basic_tokenized_file . h <nl> class LogStream ; <nl> class BasicTokenizedFile { <nl> public : <nl> explicit BasicTokenizedFile ( const QString & filepath ) ; <nl> + explicit BasicTokenizedFile ( const QByteArray & content , const QString & filepath = QString ( ) ) ; <nl> BasicTokenizedFile ( const BasicTokenizedFile & other ) = delete ; <nl> BasicTokenizedFile & operator = ( const BasicTokenizedFile & other ) = delete ; <nl> <nl> mmm a / Telegram / SourceFiles / codegen / common / clean_file . cpp <nl> ppp b / Telegram / SourceFiles / codegen / common / clean_file . cpp <nl> bool readFile ( const QString & filepath , QByteArray * outResult ) { <nl> } / / namespace <nl> <nl> <nl> - CleanFile : : CleanFile ( const QString & filepath ) : filepath_ ( filepath ) { <nl> + CleanFile : : CleanFile ( const QString & filepath ) <nl> + : filepath_ ( filepath ) <nl> + , read_ ( true ) { <nl> + } <nl> + <nl> + CleanFile : : CleanFile ( const QByteArray & content , const QString & filepath ) <nl> + : filepath_ ( filepath ) <nl> + , content_ ( content ) <nl> + , read_ ( false ) { <nl> } <nl> <nl> bool CleanFile : : read ( ) { <nl> - QByteArray content ; <nl> - if ( ! readFile ( filepath_ , & content ) ) { <nl> - return false ; <nl> + if ( read_ ) { <nl> + if ( ! readFile ( filepath_ , & content_ ) ) { <nl> + return false ; <nl> + } <nl> } <nl> filepath_ = QFileInfo ( filepath_ ) . absoluteFilePath ( ) ; <nl> <nl> bool CleanFile : : read ( ) { <nl> auto insideComment = InsideComment : : None ; <nl> bool insideString = false ; <nl> <nl> - const char * begin = content . cbegin ( ) , * end = content . cend ( ) , * offset = begin ; <nl> + const char * begin = content_ . cbegin ( ) , * end = content_ . cend ( ) , * offset = begin ; <nl> auto feedContent = [ this , & offset , end ] ( const char * ch ) { <nl> if ( ch > offset ) { <nl> - if ( content_ . isEmpty ( ) ) content_ . reserve ( end - offset - 2 ) ; <nl> - content_ . append ( offset , ch - offset ) ; <nl> + if ( result_ . isEmpty ( ) ) result_ . reserve ( end - offset - 2 ) ; <nl> + result_ . append ( offset , ch - offset ) ; <nl> offset = ch ; <nl> } <nl> } ; <nl> auto feedComment = [ this , & offset , end ] ( const char * ch ) { <nl> if ( ch > offset ) { <nl> / / comments_ . push_back ( { content_ . size ( ) , QByteArray ( offset , ch - offset ) } ) ; <nl> - if ( content_ . isEmpty ( ) ) content_ . reserve ( end - offset - 2 ) ; <nl> - content_ . append ( ' ' ) ; <nl> + if ( result_ . isEmpty ( ) ) result_ . reserve ( end - offset - 2 ) ; <nl> + result_ . append ( ' ' ) ; <nl> offset = ch ; <nl> } <nl> } ; <nl> bool CleanFile : : read ( ) { <nl> return false ; <nl> } <nl> if ( insideComment = = InsideComment : : None & & end > offset ) { <nl> - if ( content_ . isEmpty ( ) ) { <nl> - content_ = content ; <nl> + if ( result_ . isEmpty ( ) ) { <nl> + result_ = content_ ; <nl> } else { <nl> - content_ . append ( offset , end - offset ) ; <nl> + result_ . append ( offset , end - offset ) ; <nl> } <nl> } <nl> return true ; <nl> mmm a / Telegram / SourceFiles / codegen / common / clean_file . h <nl> ppp b / Telegram / SourceFiles / codegen / common / clean_file . h <nl> namespace common { <nl> class CleanFile { <nl> public : <nl> explicit CleanFile ( const QString & filepath ) ; <nl> + explicit CleanFile ( const QByteArray & content , const QString & filepath = QString ( ) ) ; <nl> CleanFile ( const CleanFile & other ) = delete ; <nl> CleanFile & operator = ( const CleanFile & other ) = delete ; <nl> <nl> bool read ( ) ; <nl> <nl> const char * data ( ) const { <nl> - return content_ . constData ( ) ; <nl> + return result_ . constData ( ) ; <nl> } <nl> const char * end ( ) const { <nl> - return content_ . constEnd ( ) ; <nl> + return result_ . constEnd ( ) ; <nl> } <nl> <nl> static constexpr int MaxSize = 10 * 1024 * 1024 ; <nl> class CleanFile { <nl> <nl> private : <nl> QString filepath_ ; <nl> - <nl> - QByteArray content_ ; <nl> + QByteArray content_ , result_ ; <nl> + bool read_ ; <nl> / / struct Comment { <nl> / / int offset ; <nl> / / QByteArray content ; <nl> mmm a / Telegram / SourceFiles / codegen / common / clean_file_reader . h <nl> ppp b / Telegram / SourceFiles / codegen / common / clean_file_reader . h <nl> namespace common { <nl> / / Wrapper allows you to read forward the CleanFile without overflow checks . <nl> class CleanFileReader { <nl> public : <nl> - CleanFileReader ( const QString & filepath ) : file_ ( filepath ) { <nl> + explicit CleanFileReader ( const QString & filepath ) : file_ ( filepath ) { <nl> + } <nl> + explicit CleanFileReader ( const QByteArray & content , const QString & filepath = QString ( ) ) : file_ ( content , filepath ) { <nl> } <nl> <nl> bool read ( ) { <nl> class CleanFileReader { <nl> const char * currentPtr ( ) const { <nl> return pos_ ; <nl> } <nl> + int charsLeft ( ) const { <nl> + return ( end_ - pos_ ) ; <nl> + } <nl> <nl> / / Log error to std : : cerr with ' code ' at line number ' line ' in data ( ) . <nl> LogStream logError ( int code , int line ) const { <nl> mmm a / Telegram / SourceFiles / codegen / numbers / generator . cpp <nl> ppp b / Telegram / SourceFiles / codegen / numbers / generator . cpp <nl> bool Generator : : writeHeader ( ) { <nl> bool Generator : : writeSource ( ) { <nl> source_ = std : : make_unique < common : : CppFile > ( basePath_ + " . cpp " , project_ ) ; <nl> <nl> + source_ - > stream ( ) < < " \ <nl> + QVector < int > phoneNumberParse ( const QString & number ) { \ n \ <nl> + QVector < int > result ; \ n \ <nl> + \ n \ <nl> + int32 len = number . size ( ) ; \ n \ <nl> + if ( len > 0 ) switch ( number . at ( 0 ) . unicode ( ) ) { \ n " ; <nl> + <nl> + QString already ; <nl> + for ( auto i = rules_ . data . cend ( ) , e = rules_ . data . cbegin ( ) ; i ! = e ; ) { <nl> + - - i ; <nl> + QString k = i . key ( ) ; <nl> + bool onlyLastChanged = true ; <nl> + while ( ! already . isEmpty ( ) & & ( already . size ( ) > k . size ( ) | | ! already . endsWith ( k . at ( already . size ( ) - 1 ) ) ) ) { <nl> + if ( ! onlyLastChanged ) { <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " } \ n " ; <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( already . size ( ) ) < < " break ; \ n " ; <nl> + } <nl> + already = already . mid ( 0 , already . size ( ) - 1 ) ; <nl> + onlyLastChanged = false ; <nl> + } <nl> + if ( already = = k ) { <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " } \ n " ; <nl> + } else { <nl> + bool onlyFirstCheck = true ; <nl> + while ( already . size ( ) < k . size ( ) ) { <nl> + if ( ! onlyFirstCheck ) source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " if ( len > " < < already . size ( ) < < " ) switch ( number . at ( " < < already . size ( ) < < " ) . unicode ( ) ) { \ n " ; <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " case ' " < < k . at ( already . size ( ) ) . toLatin1 ( ) < < " ' : \ n " ; <nl> + already . push_back ( k . at ( already . size ( ) ) ) ; <nl> + onlyFirstCheck = false ; <nl> + } <nl> + } <nl> + if ( i . value ( ) . isEmpty ( ) ) { <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " return QVector < int > ( 1 , " < < k . size ( ) < < " ) ; \ n " ; <nl> + } else { <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " result . reserve ( " < < ( i . value ( ) . size ( ) + 1 ) < < " ) ; \ n " ; <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " result . push_back ( " < < k . size ( ) < < " ) ; \ n " ; <nl> + for ( int j = 0 , l = i . value ( ) . size ( ) ; j < l ; + + j ) { <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " result . push_back ( " < < i . value ( ) . at ( j ) < < " ) ; \ n " ; <nl> + } <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " return result ; \ n " ; <nl> + } <nl> + } <nl> + bool onlyLastChanged = true ; <nl> + while ( ! already . isEmpty ( ) ) { <nl> + if ( ! onlyLastChanged ) { <nl> + source_ - > stream ( ) < < QString ( " \ t " ) . repeated ( 1 + already . size ( ) ) < < " } \ n " ; <nl> + } <nl> + already = already . mid ( 0 , already . size ( ) - 1 ) ; <nl> + onlyLastChanged = false ; <nl> + } <nl> + source_ - > stream ( ) < < " \ <nl> + } \ n \ <nl> + \ n \ <nl> + return result ; \ n \ <nl> + } \ n " ; <nl> + <nl> return source_ - > finalize ( ) ; <nl> } <nl> <nl> mmm a / Telegram / SourceFiles / codegen / numbers / parsed_file . cpp <nl> ppp b / Telegram / SourceFiles / codegen / numbers / parsed_file . cpp <nl> Copyright ( c ) 2014 - 2016 John Preston , https : / / desktop . telegram . org <nl> # include < QtCore / QRegularExpression > <nl> # include " codegen / common / basic_tokenized_file . h " <nl> # include " codegen / common / logging . h " <nl> + # include " codegen / common / clean_file_reader . h " <nl> + # include " codegen / common / checked_utf8_string . h " <nl> <nl> using BasicToken = codegen : : common : : BasicTokenizedFile : : Token ; <nl> using BasicType = BasicToken : : Type ; <nl> namespace codegen { <nl> namespace numbers { <nl> namespace { <nl> <nl> + QByteArray replaceStrings ( const QString & filepath ) { <nl> + common : : CleanFileReader reader ( filepath ) ; <nl> + if ( ! reader . read ( ) ) { <nl> + return QByteArray ( ) ; <nl> + } <nl> + common : : CheckedUtf8String string ( reader . currentPtr ( ) , reader . charsLeft ( ) ) ; <nl> + if ( ! string . isValid ( ) ) { <nl> + return QByteArray ( ) ; <nl> + } <nl> + <nl> + QStringList lines = string . toString ( ) . split ( ' \ n ' ) ; <nl> + for ( auto & line : lines ) { <nl> + auto match = QRegularExpression ( " ^ ( \ \ d + ; [ A - Z ] + ; ) ( [ ^ ; ] + ) ( ; . + ) ? $ " ) . match ( line ) ; <nl> + if ( match . hasMatch ( ) ) { <nl> + line = match . captured ( 1 ) + ' " ' + match . captured ( 2 ) + ' " ' + match . captured ( 3 ) ; <nl> + } <nl> + } <nl> + return lines . join ( ' \ n ' ) . toUtf8 ( ) ; <nl> + } <nl> + <nl> } / / namespace <nl> <nl> ParsedFile : : ParsedFile ( const Options & options ) <nl> - : file_ ( options . inputPath ) <nl> + : content_ ( replaceStrings ( options . inputPath ) ) <nl> + , file_ ( content_ , options . inputPath ) <nl> , options_ ( options ) { <nl> } <nl> <nl> bool ParsedFile : : read ( ) { <nl> - if ( ! file_ . read ( ) ) { <nl> + if ( content_ . isEmpty ( ) | | ! file_ . read ( ) ) { <nl> return false ; <nl> } <nl> <nl> auto filepath = QFileInfo ( options_ . inputPath ) . absoluteFilePath ( ) ; <nl> do { <nl> - if ( auto startToken = file_ . getToken ( BasicType : : Name ) ) { <nl> + if ( auto code = file_ . getToken ( BasicType : : Int ) ) { <nl> + if ( ! file_ . getToken ( BasicType : : Semicolon ) ) { <nl> + logErrorUnexpectedToken ( ) < < " ' ; ' " ; <nl> + return false ; <nl> + } <nl> + if ( ! file_ . getToken ( BasicType : : Name ) ) { <nl> + logErrorUnexpectedToken ( ) < < " country code " ; <nl> + return false ; <nl> + } <nl> + if ( ! file_ . getToken ( BasicType : : Semicolon ) ) { <nl> + logErrorUnexpectedToken ( ) < < " ' ; ' " ; <nl> + return false ; <nl> + } <nl> + if ( ! file_ . getToken ( BasicType : : String ) ) { <nl> + logErrorUnexpectedToken ( ) < < " country name " ; <nl> + return false ; <nl> + } <nl> + if ( file_ . getToken ( BasicType : : Semicolon ) ) { <nl> + if ( auto firstPart = file_ . getToken ( BasicType : : Int ) ) { <nl> + if ( firstPart . original . toByteArray ( ) ! = code . original . toByteArray ( ) ) { <nl> + file_ . putBack ( ) ; <nl> + result_ . data . insert ( code . original . toStringUnchecked ( ) , Rule ( ) ) ; <nl> + continue ; <nl> + } <nl> + <nl> + Rule rule ; <nl> + while ( auto part = file_ . getToken ( BasicType : : Name ) ) { <nl> + rule . push_back ( part . original . size ( ) ) ; <nl> + } <nl> + result_ . data . insert ( code . original . toStringUnchecked ( ) , rule ) ; <nl> + if ( rule . isEmpty ( ) ) { <nl> + logErrorUnexpectedToken ( ) < < " bad phone pattern " ; <nl> + return false ; <nl> + } <nl> + <nl> + if ( ! file_ . getToken ( BasicType : : Semicolon ) ) { <nl> + logErrorUnexpectedToken ( ) < < " ' ; ' " ; <nl> + return false ; <nl> + } <nl> + if ( ! file_ . getToken ( BasicType : : Int ) ) { <nl> + logErrorUnexpectedToken ( ) < < " country phone len " ; <nl> + return false ; <nl> + } <nl> + file_ . getToken ( BasicType : : Semicolon ) ; <nl> + continue ; <nl> + } else { <nl> + logErrorUnexpectedToken ( ) < < " country phone pattern " ; <nl> + return false ; <nl> + } <nl> + } else if ( file_ . getToken ( BasicType : : Int ) ) { <nl> + file_ . putBack ( ) ; <nl> + result_ . data . insert ( code . original . toStringUnchecked ( ) , Rule ( ) ) ; <nl> + continue ; <nl> + } else { <nl> + logErrorUnexpectedToken ( ) < < " country phone pattern " ; <nl> + return false ; <nl> + } <nl> } <nl> if ( file_ . atEnd ( ) ) { <nl> break ; <nl> mmm a / Telegram / SourceFiles / codegen / numbers / parsed_file . h <nl> ppp b / Telegram / SourceFiles / codegen / numbers / parsed_file . h <nl> Copyright ( c ) 2014 - 2016 John Preston , https : / / desktop . telegram . org <nl> namespace codegen { <nl> namespace numbers { <nl> <nl> - struct Rule { <nl> - } ; <nl> + using Rule = QVector < int > ; <nl> struct Rules { <nl> - QVector < Rule > data ; <nl> + QMap < QString , Rule > data ; <nl> } ; <nl> <nl> / / Parses an input file to the internal struct . <nl> class ParsedFile { <nl> return file_ . logErrorUnexpectedToken ( ) ; <nl> } <nl> <nl> + QByteArray content_ ; <nl> common : : BasicTokenizedFile file_ ; <nl> Options options_ ; <nl> bool failed_ = false ; <nl> mmm a / Telegram / Telegram . vcxproj <nl> ppp b / Telegram / Telegram . vcxproj <nl> <nl> < / ClCompile > <nl> < ClCompile Include = " GeneratedFiles \ styles \ style_basic . cpp " / > <nl> < ClCompile Include = " GeneratedFiles \ styles \ style_basic_types . cpp " / > <nl> - < ClCompile Include = " GeneratedFiles \ style_auto . cpp " > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > true < / ExcludedFromBuild > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Deploy | Win32 ' " > true < / ExcludedFromBuild > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > true < / ExcludedFromBuild > <nl> - < / ClCompile > <nl> < ClCompile Include = " SourceFiles \ apiwrap . cpp " / > <nl> < ClCompile Include = " SourceFiles \ app . cpp " / > <nl> < ClCompile Include = " SourceFiles \ application . cpp " / > <nl> <nl> < Outputs Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > . \ GeneratedFiles \ $ ( ConfigurationName ) \ moc_ % ( Filename ) . cpp < / Outputs > <nl> < Command Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > " $ ( QTDIR ) \ bin \ moc . exe " " % ( FullPath ) " - o " . \ GeneratedFiles \ $ ( ConfigurationName ) \ moc_ % ( Filename ) . cpp " " - fstdafx . h " " - f . . / . . / SourceFiles / core / basic_types . h " - DAL_LIBTYPE_STATIC - DUNICODE - DWIN32 - DWIN64 - DHAVE_STDINT_H - DZLIB_WINAPI - DQT_NO_DEBUG - DNDEBUG - D_SCL_SECURE_NO_WARNINGS " - I . \ . . \ . . \ Libraries \ lzma \ C " " - I . \ . . \ . . \ Libraries \ libexif - 0 . 6 . 20 " " - I . \ . . \ . . \ Libraries \ zlib - 1 . 2 . 8 " " - I . \ . . \ . . \ Libraries \ openssl \ Release \ include " " - I . \ . . \ . . \ Libraries \ ffmpeg " " - I . \ . . \ . . \ Libraries \ openal - soft \ include " " - I . \ SourceFiles " " - I . \ GeneratedFiles " " - I . \ . . \ . . \ Libraries \ breakpad \ src " " - I . \ ThirdParty \ minizip " " - I . " " - I $ ( QTDIR ) \ include " " - I . \ GeneratedFiles \ $ ( ConfigurationName ) \ . " " - I . \ . . \ . . \ Libraries \ QtStatic \ qtbase \ include \ QtCore \ 5 . 5 . 1 \ QtCore " " - I . \ . . \ . . \ Libraries \ QtStatic \ qtbase \ include \ QtGui \ 5 . 5 . 1 \ QtGui " < / Command > <nl> < / CustomBuild > <nl> + < ClInclude Include = " GeneratedFiles \ numbers . h " / > <nl> < ClInclude Include = " GeneratedFiles \ styles \ style_basic . h " / > <nl> < ClInclude Include = " GeneratedFiles \ styles \ style_basic_types . h " / > <nl> < ClInclude Include = " SourceFiles \ core \ click_handler . h " / > <nl> <nl> < AdditionalInputs Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > $ ( QTDIR ) \ bin \ moc . exe ; % ( FullPath ) ; $ ( QTDIR ) \ bin \ moc . exe ; % ( FullPath ) < / AdditionalInputs > <nl> < AdditionalInputs Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > $ ( QTDIR ) \ bin \ moc . exe ; % ( FullPath ) ; $ ( QTDIR ) \ bin \ moc . exe ; % ( FullPath ) < / AdditionalInputs > <nl> < / CustomBuild > <nl> - < CustomBuild Include = " Resources \ style_classes . txt " > <nl> - < Outputs > . \ GeneratedFiles \ style_classes . h < / Outputs > <nl> - < Command > " $ ( SolutionDir ) $ ( Platform ) \ $ ( Configuration ) Style \ MetaStyle . exe " - classes_in " . \ Resources \ style_classes . txt " - classes_out " . \ GeneratedFiles \ style_classes . h " - styles_in " . \ Resources \ style . txt " - styles_out " . \ GeneratedFiles \ style_auto . h " - path_to_sprites " . \ Resources \ art \ \ " < / Command > <nl> - < / CustomBuild > <nl> - < CustomBuild Include = " Resources \ style . txt " > <nl> - < Outputs > . \ GeneratedFiles \ style_auto . h < / Outputs > <nl> - < Outputs > . \ GeneratedFiles \ style_auto . cpp < / Outputs > <nl> - < Command > " $ ( SolutionDir ) $ ( Platform ) \ $ ( Configuration ) Style \ MetaStyle . exe " - classes_in " . \ Resources \ style_classes . txt " - classes_out " . \ GeneratedFiles \ style_classes . h " - styles_in " . \ Resources \ style . txt " - styles_out " . \ GeneratedFiles \ style_auto . h " - path_to_sprites " . \ Resources \ art \ \ " < / Command > <nl> - < / CustomBuild > <nl> < CustomBuild Include = " Resources \ numbers . txt " > <nl> + < Outputs > . \ GeneratedFiles \ numbers . h < / Outputs > <nl> < Outputs > . \ GeneratedFiles \ numbers . cpp < / Outputs > <nl> - < Command > " $ ( SolutionDir ) $ ( Platform ) \ $ ( Configuration ) Style \ MetaStyle . exe " - classes_in " . \ Resources \ style_classes . txt " - classes_out " . \ GeneratedFiles \ style_classes . h " - styles_in " . \ Resources \ style . txt " - styles_out " . \ GeneratedFiles \ style_auto . h " - path_to_sprites " . \ Resources \ art \ \ " < / Command > <nl> + < Command > " $ ( SolutionDir ) $ ( Platform ) \ codegen \ $ ( Configuration ) \ codegen_numbers . exe " " - o . \ GeneratedFiles " " . \ Resources \ numbers . txt " < / Command > <nl> < / CustomBuild > <nl> < CustomBuild Include = " Resources \ lang . strings " > <nl> < Outputs > . \ GeneratedFiles \ lang_auto . h < / Outputs > <nl> <nl> < AdditionalInputs Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > $ ( QTDIR ) \ bin \ moc . exe ; % ( FullPath ) < / AdditionalInputs > <nl> < / CustomBuild > <nl> < ClInclude Include = " GeneratedFiles \ lang_auto . h " / > <nl> - < ClInclude Include = " GeneratedFiles \ style_auto . h " > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > true < / ExcludedFromBuild > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Deploy | Win32 ' " > true < / ExcludedFromBuild > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > true < / ExcludedFromBuild > <nl> - < / ClInclude > <nl> - < ClInclude Include = " GeneratedFiles \ style_classes . h " > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > true < / ExcludedFromBuild > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Deploy | Win32 ' " > true < / ExcludedFromBuild > <nl> - < ExcludedFromBuild Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > true < / ExcludedFromBuild > <nl> - < / ClInclude > <nl> < ClInclude Include = " resource . h " / > <nl> < CustomBuild Include = " SourceFiles \ apiwrap . h " > <nl> < AdditionalInputs Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Deploy | Win32 ' " > $ ( QTDIR ) \ bin \ moc . exe ; % ( FullPath ) < / AdditionalInputs > <nl> <nl> < Outputs Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > . \ GeneratedFiles \ $ ( ConfigurationName ) \ moc_ % ( Filename ) . cpp < / Outputs > <nl> < Command Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > " $ ( QTDIR ) \ bin \ moc . exe " " % ( FullPath ) " - o " . \ GeneratedFiles \ $ ( ConfigurationName ) \ moc_ % ( Filename ) . cpp " - DAL_LIBTYPE_STATIC - DUNICODE - DWIN32 - DWIN64 - DHAVE_STDINT_H - DZLIB_WINAPI - DQT_NO_DEBUG - DNDEBUG - D_SCL_SECURE_NO_WARNINGS " - I . \ . . \ . . \ Libraries \ lzma \ C " " - I . \ . . \ . . \ Libraries \ libexif - 0 . 6 . 20 " " - I . \ . . \ . . \ Libraries \ zlib - 1 . 2 . 8 " " - I . \ . . \ . . \ Libraries \ openssl \ Release \ include " " - I . \ . . \ . . \ Libraries \ ffmpeg " " - I . \ . . \ . . \ Libraries \ openal - soft \ include " " - I . \ SourceFiles " " - I . \ GeneratedFiles " " - I . \ . . \ . . \ Libraries \ breakpad \ src " " - I . \ ThirdParty \ minizip " " - I . " " - I $ ( QTDIR ) \ include " " - I . \ GeneratedFiles \ $ ( ConfigurationName ) \ . " " - I . \ . . \ . . \ Libraries \ QtStatic \ qtbase \ include \ QtCore \ 5 . 5 . 1 \ QtCore " " - I . \ . . \ . . \ Libraries \ QtStatic \ qtbase \ include \ QtGui \ 5 . 5 . 1 \ QtGui " " - fstdafx . h " " - f . . / . . / SourceFiles / playerwidget . h " < / Command > <nl> < / CustomBuild > <nl> - < ClInclude Include = " SourceFiles \ numbers . h " / > <nl> < ClInclude Include = " SourceFiles \ pspecific . h " / > <nl> < CustomBuild Include = " SourceFiles \ pspecific_linux . h " > <nl> < AdditionalInputs Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Deploy | Win32 ' " > $ ( QTDIR ) \ bin \ moc . exe ; % ( FullPath ) < / AdditionalInputs > <nl> mmm a / Telegram / Telegram . vcxproj . filters <nl> ppp b / Telegram / Telegram . vcxproj . filters <nl> <nl> < ClCompile Include = " SourceFiles \ mainwidget . cpp " > <nl> < Filter > SourceFiles < / Filter > <nl> < / ClCompile > <nl> - < ClCompile Include = " GeneratedFiles \ style_auto . cpp " > <nl> - < Filter > GeneratedFiles < / Filter > <nl> - < / ClCompile > <nl> < ClCompile Include = " SourceFiles \ app . cpp " > <nl> < Filter > SourceFiles < / Filter > <nl> < / ClCompile > <nl> <nl> < ClInclude Include = " SourceFiles \ logs . h " > <nl> < Filter > SourceFiles < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " GeneratedFiles \ style_auto . h " > <nl> - < Filter > GeneratedFiles < / Filter > <nl> - < / ClInclude > <nl> - < ClInclude Include = " GeneratedFiles \ style_classes . h " > <nl> - < Filter > GeneratedFiles < / Filter > <nl> - < / ClInclude > <nl> < ClInclude Include = " SourceFiles \ countries . h " > <nl> < Filter > SourceFiles < / Filter > <nl> < / ClInclude > <nl> <nl> < ClInclude Include = " SourceFiles \ pspecific_mac_p . h " > <nl> < Filter > SourceFiles < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " SourceFiles \ numbers . h " > <nl> - < Filter > SourceFiles < / Filter > <nl> - < / ClInclude > <nl> < ClInclude Include = " SourceFiles \ config . h " > <nl> < Filter > Version < / Filter > <nl> < / ClInclude > <nl> <nl> < ClInclude Include = " GeneratedFiles \ styles \ style_basic_types . h " > <nl> < Filter > GeneratedFiles \ styles < / Filter > <nl> < / ClInclude > <nl> + < ClInclude Include = " GeneratedFiles \ numbers . h " > <nl> + < Filter > GeneratedFiles < / Filter > <nl> + < / ClInclude > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < CustomBuild Include = " SourceFiles \ application . h " > <nl> mmm a / Telegram / build / vc / codegen_style / codegen_style . vcxproj <nl> ppp b / Telegram / build / vc / codegen_style / codegen_style . vcxproj <nl> <nl> < ClCompile > <nl> < PreprocessorDefinitions > UNICODE ; WIN32 ; QT_NO_DEBUG ; NDEBUG ; QT_CORE_LIB ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> < DebugInformationFormat / > <nl> - < RuntimeLibrary > MultiThreadedDLL < / RuntimeLibrary > <nl> + < RuntimeLibrary > MultiThreaded < / RuntimeLibrary > <nl> < AdditionalIncludeDirectories > . ; $ ( QTDIR ) \ include ; . \ GeneratedFiles \ $ ( ConfigurationName ) ; . \ . . \ . . \ . . \ SourceFiles ; $ ( QTDIR ) \ include \ QtCore ; . \ . . \ % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> < TreatWChar_tAsBuiltInType > true < / TreatWChar_tAsBuiltInType > <nl> < WarningLevel > Level4 < / WarningLevel > <nl>
Replaced MetaStyle project with codegen_style / numbers in MSVC .
telegramdesktop/tdesktop
6859109503d573b63280041588e9e1eb62e50402
2016-04-18T22:00:54Z
mmm a / tensorflow / core / public / version . h <nl> ppp b / tensorflow / core / public / version . h <nl> limitations under the License . <nl> <nl> # define TF_GRAPH_DEF_VERSION_MIN_PRODUCER 0 <nl> # define TF_GRAPH_DEF_VERSION_MIN_CONSUMER 0 <nl> - # define TF_GRAPH_DEF_VERSION 376 / / Updated : 2020 / 4 / 19 <nl> + # define TF_GRAPH_DEF_VERSION 377 / / Updated : 2020 / 4 / 20 <nl> <nl> / / Checkpoint compatibility versions ( the versions field in SavedSliceMeta ) . <nl> / / <nl>
Update GraphDef version to 377 .
tensorflow/tensorflow
f3b33698c537e46a95072e337f75461d57964d51
2020-04-20T09:07:47Z
mmm a / include / swift / AST / DiagnosticsParse . def <nl> ppp b / include / swift / AST / DiagnosticsParse . def <nl> ERROR ( duplicate_attribute , none , <nl> " duplicate % select { attribute | modifier } 0 " , ( bool ) ) <nl> NOTE ( previous_attribute , none , <nl> " % select { attribute | modifier } 0 already specified here " , ( bool ) ) <nl> + ERROR ( mutually_exclusive_attrs , none , <nl> + " ' % 0 ' contradicts previous % select { attribute | modifier } 2 ' % 1 ' " , ( StringRef , StringRef , bool ) ) <nl> + <nl> + ERROR ( invalid_infix_on_func , none , <nl> + " ' infix ' modifier is not required or allowed on func declarations " , ( ) ) <nl> <nl> - ERROR ( cannot_combine_attribute , none , <nl> - " attribute ' % 0 ' cannot be combined with this attribute " , ( StringRef ) ) <nl> ERROR ( expected_in_attribute_list , none , <nl> " expected ' ] ' or ' , ' in attribute list " , ( ) ) <nl> <nl> mmm a / include / swift / AST / DiagnosticsSema . def <nl> ppp b / include / swift / AST / DiagnosticsSema . def <nl> ERROR ( operator_not_func , none , <nl> " operators must be declared with ' func ' " , ( ) ) <nl> ERROR ( redefining_builtin_operator , none , <nl> " cannot declare a custom % 0 ' % 1 ' operator " , ( StringRef , StringRef ) ) <nl> - ERROR ( invalid_infix_on_func , none , <nl> - " ' infix ' modifier is not required or allowed on func declarations " , ( ) ) <nl> ERROR ( attribute_requires_operator_identifier , none , <nl> " ' % 0 ' requires a function with an operator identifier " , ( StringRef ) ) <nl> ERROR ( attribute_requires_single_argument , none , <nl> mmm a / lib / Parse / ParseDecl . cpp <nl> ppp b / lib / Parse / ParseDecl . cpp <nl> bool Parser : : parseNewDeclAttribute ( DeclAttributes & Attributes , SourceLoc AtLoc , <nl> / / Delay issuing the diagnostic until we parse the attribute . <nl> DiscardAttribute = true ; <nl> } <nl> - <nl> - if ( ( DK = = DAK_Prefix | | DK = = DAK_Postfix ) & & ! DiscardAttribute & & <nl> - Attributes . getUnaryOperatorKind ( ) ! = UnaryOperatorKind : : None ) { <nl> - diagnose ( Loc , diag : : cannot_combine_attribute , <nl> - DK = = DAK_Prefix ? " postfix " : " prefix " ) ; <nl> - DiscardAttribute = true ; <nl> - } <nl> <nl> / / If this is a SIL - only attribute , reject it . <nl> if ( ( DeclAttribute : : getOptions ( DK ) & DeclAttribute : : SILOnly ) ! = 0 & & <nl> static bool isStartOfOperatorDecl ( const Token & Tok , const Token & Tok2 ) { <nl> Tok2 . isContextualKeyword ( " infix " ) ) ; <nl> } <nl> <nl> + / / / \ brief Diagnose issues with fixity attributes , if any . <nl> + static void diagnoseOperatorFixityAttributes ( Parser & P , <nl> + DeclAttributes & Attrs , <nl> + const Decl * D ) { <nl> + auto isFixityAttr = [ ] ( DeclAttribute * attr ) { <nl> + DeclAttrKind kind = attr - > getKind ( ) ; <nl> + return attr - > isValid ( ) & & ( kind = = DAK_Prefix | | <nl> + kind = = DAK_Infix | | <nl> + kind = = DAK_Postfix ) ; <nl> + } ; <nl> + <nl> + SmallVector < DeclAttribute * , 3 > fixityAttrs ; <nl> + std : : copy_if ( Attrs . begin ( ) , Attrs . end ( ) , <nl> + std : : back_inserter ( fixityAttrs ) , isFixityAttr ) ; <nl> + std : : reverse ( fixityAttrs . begin ( ) , fixityAttrs . end ( ) ) ; <nl> + <nl> + for ( auto it = fixityAttrs . begin ( ) ; it ! = fixityAttrs . end ( ) ; + + it ) { <nl> + if ( it ! = fixityAttrs . begin ( ) ) { <nl> + auto * attr = * it ; <nl> + P . diagnose ( attr - > getLocation ( ) , diag : : mutually_exclusive_attrs , <nl> + attr - > getAttrName ( ) , fixityAttrs . front ( ) - > getAttrName ( ) , <nl> + attr - > isDeclModifier ( ) ) <nl> + . fixItRemove ( attr - > getRange ( ) ) ; <nl> + attr - > setInvalid ( ) ; <nl> + } <nl> + } <nl> + <nl> + / / Operator declarations must specify a fixity . <nl> + if ( auto * OD = dyn_cast < OperatorDecl > ( D ) ) { <nl> + if ( fixityAttrs . empty ( ) ) { <nl> + P . diagnose ( OD - > getOperatorLoc ( ) , diag : : operator_decl_no_fixity ) ; <nl> + } <nl> + } <nl> + / / Infix operator is only allowed on operator declarations , not on func . <nl> + else if ( isa < FuncDecl > ( D ) ) { <nl> + if ( auto * attr = Attrs . getAttribute < InfixAttr > ( ) ) { <nl> + P . diagnose ( attr - > getLocation ( ) , diag : : invalid_infix_on_func ) <nl> + . fixItRemove ( attr - > getLocation ( ) ) ; <nl> + attr - > setInvalid ( ) ; <nl> + } <nl> + } else { <nl> + llvm_unreachable ( " unexpected decl kind ? " ) ; <nl> + } <nl> + } <nl> + <nl> static bool isKeywordPossibleDeclStart ( const Token & Tok ) { <nl> switch ( Tok . getKind ( ) ) { <nl> case tok : : at_sign : <nl> Parser : : parseDeclFunc ( SourceLoc StaticLoc , StaticSpellingKind StaticSpelling , <nl> GenericParams , BodyParams , Type ( ) , FuncRetTy , <nl> CurDeclContext ) ; <nl> <nl> + diagnoseOperatorFixityAttributes ( * this , Attributes , FD ) ; <nl> + <nl> / / Add the attributes here so if we need them while parsing the body <nl> / / they are available . <nl> FD - > getAttrs ( ) = Attributes ; <nl> Parser : : parseDeclOperatorImpl ( SourceLoc OperatorLoc , Identifier Name , <nl> ( void ) consumeIf ( tok : : r_brace ) ; <nl> } <nl> <nl> - <nl> OperatorDecl * res ; <nl> if ( Attributes . hasAttribute < PrefixAttr > ( ) ) <nl> res = new ( Context ) PrefixOperatorDecl ( CurDeclContext , OperatorLoc , <nl> Parser : : parseDeclOperatorImpl ( SourceLoc OperatorLoc , Identifier Name , <nl> else if ( Attributes . hasAttribute < PostfixAttr > ( ) ) <nl> res = new ( Context ) PostfixOperatorDecl ( CurDeclContext , OperatorLoc , <nl> Name , NameLoc ) ; <nl> - else { <nl> - if ( ! Attributes . hasAttribute < InfixAttr > ( ) ) <nl> - diagnose ( OperatorLoc , diag : : operator_decl_no_fixity ) ; <nl> - <nl> + else <nl> res = new ( Context ) InfixOperatorDecl ( CurDeclContext , OperatorLoc , <nl> Name , NameLoc , colonLoc , <nl> precedenceGroupName , <nl> precedenceGroupNameLoc ) ; <nl> - } <nl> + <nl> + diagnoseOperatorFixityAttributes ( * this , Attributes , res ) ; <nl> <nl> res - > getAttrs ( ) = Attributes ; <nl> return makeParserResult ( res ) ; <nl> mmm a / lib / Sema / TypeCheckAttr . cpp <nl> ppp b / lib / Sema / TypeCheckAttr . cpp <nl> void AttributeChecker : : checkOperatorAttribute ( DeclAttribute * attr ) { <nl> return ; <nl> } <nl> <nl> - / / Infix operator is only allowed on operator declarations , not on func . <nl> - if ( isa < InfixAttr > ( attr ) ) { <nl> - TC . diagnose ( attr - > getLocation ( ) , diag : : invalid_infix_on_func ) <nl> - . fixItRemove ( attr - > getLocation ( ) ) ; <nl> - attr - > setInvalid ( ) ; <nl> - return ; <nl> - } <nl> - <nl> / / Otherwise , must be unary . <nl> if ( ! FD - > isUnaryOperator ( ) ) { <nl> TC . diagnose ( attr - > getLocation ( ) , diag : : attribute_requires_single_argument , <nl> mmm a / test / decl / func / operator . swift <nl> ppp b / test / decl / func / operator . swift <nl> precedencegroup ReallyHighPrecedence { <nl> associativity : left <nl> } <nl> <nl> - infix func fn_binary ( _ lhs : Int , rhs : Int ) { } / / expected - error { { ' infix ' requires a function with an operator identifier } } <nl> + infix func fn_binary ( _ lhs : Int , rhs : Int ) { } / / expected - error { { ' infix ' modifier is not required or allowed on func declarations } } <nl> <nl> <nl> func ppp + ( lhs : X , rhs : X ) - > X { } <nl> func test_14705150 ( ) { <nl> <nl> } <nl> <nl> - prefix postfix func + + ( x : Int ) { } / / expected - error { { attribute ' prefix ' cannot be combined with this attribute } } <nl> - postfix prefix func + + ( x : Int ) { } / / expected - error { { attribute ' postfix ' cannot be combined with this attribute } } <nl> + prefix postfix func + + ( x : Int ) { } / / expected - error { { ' postfix ' contradicts previous modifier ' prefix ' } } { { 8 - 16 = } } <nl> + postfix prefix func + + ( x : Float ) { } / / expected - error { { ' prefix ' contradicts previous modifier ' postfix ' } } { { 9 - 16 = } } <nl> + postfix prefix infix func + + ( x : Double ) { } / / expected - error { { ' prefix ' contradicts previous modifier ' postfix ' } } { { 9 - 16 = } } expected - error { { ' infix ' contradicts previous modifier ' postfix ' } } { { 16 - 22 = } } <nl> + infix prefix func + - + ( x : Int , y : Int ) { } / / expected - error { { ' infix ' modifier is not required or allowed on func declarations } } { { 1 - 7 = } } expected - error { { ' prefix ' contradicts previous modifier ' infix ' } } { { 7 - 14 = } } <nl> <nl> / / Don ' t allow one to define a postfix ' ! ' ; it ' s built into the <nl> / / language . <nl>
[ QoI ] diagnose operator fixity attrs together ; improve messages
apple/swift
682ab47c2dbb641856a468523c0f1da496833c5f
2016-09-21T03:54:07Z
mmm a / src / app / dialogs / mainwindow . cpp <nl> ppp b / src / app / dialogs / mainwindow . cpp <nl> MainWin : : MainWin ( QWidget * parent ) <nl> QRect scr = desktop - > screenGeometry ( ) ; <nl> <nl> / * Smart resize on big screens * / <nl> - LOG ( DEBUG ) < < " Current ratio width : " < < geometry ( ) . width ( ) / ( float ) scr . width ( ) ; <nl> - LOG ( DEBUG ) < < " Current ratio height : " < < geometry ( ) . height ( ) / ( float ) scr . height ( ) ; <nl> + float wRatio = geometry ( ) . width ( ) / ( float ) scr . width ( ) ; <nl> + float hRatio = geometry ( ) . height ( ) / ( float ) scr . height ( ) ; <nl> + <nl> + LOG ( DEBUG ) < < " Current ratio width : " < < wRatio ; <nl> + LOG ( DEBUG ) < < " Current ratio height : " < < hRatio ; <nl> + <nl> float minimumRatioW = 0 . 5 ; <nl> float minimumRatioH = 0 . 7 ; <nl> - if ( geometry ( ) . width ( ) / ( float ) scr . width ( ) < minimumRatioW ) { <nl> + <nl> + if ( wRatio < minimumRatioW <nl> + | | hRatio < minimumRatioH ) { <nl> LOG ( DEBUG ) < < " Resize main window " ; <nl> setGeometry ( geometry ( ) . x ( ) , geometry ( ) . y ( ) , <nl> ( int ) ( scr . width ( ) * minimumRatioW ) , <nl> ( int ) ( scr . height ( ) * minimumRatioH ) ) ; <nl> + } else if ( hRatio > 1 | | wRatio > 1 ) { <nl> + LOG ( DEBUG ) < < " Ratio > 1 . 0 . Resize main window . " ; <nl> + setGeometry ( geometry ( ) . x ( ) , geometry ( ) . y ( ) , <nl> + ( int ) ( scr . width ( ) * 0 . 9 ) , <nl> + ( int ) ( scr . height ( ) * 0 . 8 ) ) ; <nl> } <nl> move ( scr . center ( ) - rect ( ) . center ( ) ) ; <nl> <nl>
Resize main window if ratio > 1
uglide/RedisDesktopManager
8d7ed93b9fd14ec0268320a5030e8e01c157d3a5
2015-10-23T05:11:48Z
mmm a / src / generic / stage2_build_tape . h <nl> ppp b / src / generic / stage2_build_tape . h <nl> struct structural_parser { <nl> const uint8_t * const buf ; <nl> const size_t len ; <nl> ParsedJson & pj ; <nl> - uint32_t i ; / / next structural index <nl> - uint32_t idx ; / / location of the structural character in the input ( buf ) <nl> + size_t i ; / / next structural index <nl> + size_t idx ; / / location of the structural character in the input ( buf ) <nl> uint8_t c ; / / used to track the ( structural ) character we are looking at <nl> uint32_t depth = 0 ; / / could have an arbitrary starting depth <nl> <nl>
I think that i and idx should be size_t ( 64 - bit ) . ( )
simdjson/simdjson
a804351a76db1b7e096d4fbbc53607f2174552f2
2020-01-13T22:42:52Z
new file mode 100644 <nl> index 0000000000 . . 89218b4a9f <nl> mmm / dev / null <nl> ppp b / include / dmlc / base . h <nl> <nl> + / * ! <nl> + * Copyright ( c ) 2015 by Contributors <nl> + * \ file base . h <nl> + * \ brief defines configuration macros <nl> + * / <nl> + # ifndef DMLC_BASE_H_ <nl> + # define DMLC_BASE_H_ <nl> + <nl> + / * ! \ brief whether use glog for logging * / <nl> + # ifndef DMLC_USE_GLOG <nl> + # define DMLC_USE_GLOG 0 <nl> + # endif <nl> + <nl> + / * ! \ brief whether compile with hdfs support * / <nl> + # ifndef DMLC_USE_HDFS <nl> + # define DMLC_USE_HDFS 0 <nl> + # endif <nl> + <nl> + / * ! \ brief whether compile with s3 support * / <nl> + # ifndef DMLC_USE_S3 <nl> + # define DMLC_USE_S3 0 <nl> + # endif <nl> + <nl> + / * ! \ brief whether or not use parameter server * / <nl> + # ifndef DMLC_USE_PS <nl> + # define DMLC_USE_PS 0 <nl> + # endif <nl> + <nl> + / * ! \ brief whether or not use c + + 11 support * / <nl> + # ifndef DMLC_USE_CXX11 <nl> + # define DMLC_USE_CXX11 defined ( __GXX_EXPERIMENTAL_CXX0X ) | | __cplusplus > = 201103L | | defined ( _MSC_VER ) <nl> + # endif <nl> + <nl> + / / / <nl> + / / / code block to handle optionally loading <nl> + / / / <nl> + # if ! defined ( __GNUC__ ) <nl> + # define fopen64 std : : fopen <nl> + # endif <nl> + # ifdef _MSC_VER <nl> + / / NOTE : sprintf_s is not equivalent to snprintf , <nl> + / / they are equivalent when success , which is sufficient for our case <nl> + # define snprintf sprintf_s <nl> + # define vsnprintf vsprintf_s <nl> + # else <nl> + # ifdef _FILE_OFFSET_BITS <nl> + # if _FILE_OFFSET_BITS = = 32 <nl> + # pragma message ( " Warning : FILE OFFSET BITS defined to be 32 bit " ) <nl> + # endif <nl> + # endif <nl> + <nl> + # ifdef __APPLE__ <nl> + # define off64_t off_t <nl> + # define fopen64 std : : fopen <nl> + # endif <nl> + <nl> + extern " C " { <nl> + # include < sys / types . h > <nl> + } <nl> + # endif <nl> + <nl> + # ifdef _MSC_VER <nl> + typedef unsigned __int16 uint16_t ; <nl> + typedef unsigned __int32 uint32_t ; <nl> + typedef unsigned __int64 uint64_t ; <nl> + typedef __int64 int64_t ; <nl> + # else <nl> + # include < inttypes . h > <nl> + # endif <nl> + # include < vector > <nl> + # include < string > <nl> + <nl> + / * ! \ brief namespace for dmlc * / <nl> + namespace dmlc { <nl> + / * ! <nl> + * \ brief safely get the beginning address of a vector <nl> + * \ param vec input vector <nl> + * \ return beginning address of a vector <nl> + * / <nl> + template < typename T > <nl> + inline T * BeginPtr ( std : : vector < T > & vec ) { <nl> + if ( vec . size ( ) = = 0 ) { <nl> + return NULL ; <nl> + } else { <nl> + return & vec [ 0 ] ; <nl> + } <nl> + } <nl> + / * ! \ brief get the beginning address of a vector * / <nl> + template < typename T > <nl> + inline const T * BeginPtr ( const std : : vector < T > & vec ) { <nl> + if ( vec . size ( ) = = 0 ) { <nl> + return NULL ; <nl> + } else { <nl> + return & vec [ 0 ] ; <nl> + } <nl> + } <nl> + inline char * BeginPtr ( std : : string & str ) { <nl> + if ( str . length ( ) = = 0 ) return NULL ; <nl> + return & str [ 0 ] ; <nl> + } <nl> + inline const char * BeginPtr ( const std : : string & str ) { <nl> + if ( str . length ( ) = = 0 ) return NULL ; <nl> + return & str [ 0 ] ; <nl> + } <nl> + } / / namespace dmlc <nl> + # endif / / DMLC_BASE_H_ <nl> mmm a / include / dmlc / io . h <nl> ppp b / include / dmlc / io . h <nl> <nl> # include < istream > <nl> # include < ostream > <nl> # include < streambuf > <nl> + # include " . / base . h " <nl> <nl> / * ! \ brief namespace for dmlc * / <nl> namespace dmlc { <nl> class InputSplit { <nl> / * ! \ brief size of the memory region * / <nl> size_t size ; <nl> } ; <nl> + / * ! <nl> + * \ brief hint the inputsplit how large the chunk size <nl> + * it should return when implementing NextChunk <nl> + * this is a hint so may not be enforced , <nl> + * but InputSplit will try adjust its internal buffer <nl> + * size to the hinted value <nl> + * \ param chunk_size the chunk size <nl> + * / <nl> + virtual void HintChunkSize ( size_t chunk_size ) { } <nl> / * ! \ brief reset the position of InputSplit to beginning * / <nl> virtual void BeforeFirst ( void ) = 0 ; <nl> / * ! <nl> * \ brief get the next record , the returning value <nl> * is valid until next call to NextRecord or NextChunk <nl> * caller can modify the memory content of out_rec <nl> + * <nl> + * For text , out_rec contains a single line <nl> + * For recordio , out_rec contains one record content ( with header striped ) <nl> + * <nl> * \ param out_rec used to store the result <nl> * \ return true if we can successfully get next record <nl> * false if we reached end of split <nl> class InputSplit { <nl> * \ brief get a chunk of memory that can contain multiple records , <nl> * the caller needs to parse the content of the resulting chunk , <nl> * for text file , out_chunk can contain data of multiple lines <nl> - * for recordio , out_chunk can contain data of multiple records <nl> + * for recordio , out_chunk can contain multiple records ( including headers ) <nl> * <nl> * This function ensures there won ' t be partial record in the chunk <nl> * caller can modify the memory content of out_chunk , <nl> class InputSplit { <nl> * \ return true if we can successfully get next record <nl> * false if we reached end of split <nl> * \ sa InputSplit : : Create for definition of record <nl> + * \ sa RecordIOChunkReader to parse recordio content from out_chunk <nl> * / <nl> virtual bool NextChunk ( Blob * out_chunk ) = 0 ; <nl> / * ! \ brief destructor * / <nl>
checkin new dmlc interface
dmlc/xgboost
a5d77ca08dd6f92acaae261d52879cb3ee99c087
2015-04-30T03:17:27Z
mmm a / Makefile <nl> ppp b / Makefile <nl> PLATFORM_CFLAGS = - DLEVELDB_PLATFORM_POSIX - std = c + + 0x <nl> PORT_MODULE = port_posix . o <nl> endif # UNAME <nl> <nl> - CFLAGS = - c - I . - I . / include $ ( PLATFORM_CFLAGS ) $ ( OPT ) <nl> + # Set ' SNAPPY ' to 1 if you have the Snappy compression library <nl> + # installed and want to enable its use in LevelDB <nl> + # ( see http : / / code . google . com / p / snappy / ) <nl> + SNAPPY = 0 <nl> + <nl> + ifeq ( $ ( SNAPPY ) , 0 ) <nl> + SNAPPY_CFLAGS = <nl> + SNAPPY_LDFLAGS = <nl> + else <nl> + SNAPPY_CFLAGS = - DSNAPPY <nl> + SNAPPY_LDFLAGS = - lsnappy <nl> + endif <nl> <nl> - LDFLAGS = - lpthread <nl> + CFLAGS = - c - I . - I . / include $ ( PLATFORM_CFLAGS ) $ ( OPT ) $ ( SNAPPY_CFLAGS ) <nl> + <nl> + LDFLAGS = - lpthread $ ( SNAPPY_LDFLAGS ) <nl> <nl> LIBOBJECTS = \ <nl> . / db / builder . o \ <nl> TESTS = \ <nl> skiplist_test \ <nl> table_test \ <nl> version_edit_test \ <nl> + version_set_test \ <nl> write_batch_test <nl> <nl> PROGRAMS = db_bench $ ( TESTS ) <nl> skiplist_test : db / skiplist_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> version_edit_test : db / version_edit_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CC ) $ ( LDFLAGS ) db / version_edit_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) - o $ @ <nl> <nl> + version_set_test : db / version_set_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> + $ ( CC ) $ ( LDFLAGS ) db / version_set_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) - o $ @ <nl> + <nl> write_batch_test : db / write_batch_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CC ) $ ( LDFLAGS ) db / write_batch_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) - o $ @ <nl> <nl> ifeq ( $ ( PLATFORM ) , IOS ) <nl> # For iOS , create universal object files to be used on both the simulator and <nl> # a device . <nl> + SIMULATORROOT = / Developer / Platforms / iPhoneSimulator . platform / Developer <nl> + DEVICEROOT = / Developer / Platforms / iPhoneOS . platform / Developer <nl> + IOSVERSION = $ ( shell defaults read / Developer / Platforms / iPhoneOS . platform / version CFBundleShortVersionString ) <nl> . cc . o : <nl> mkdir - p ios - x86 / $ ( dir $ @ ) <nl> - $ ( CC ) $ ( CFLAGS ) - isysroot / Developer / Platforms / iPhoneSimulator . platform / Developer / SDKs / iPhoneSimulator4 . 3 . sdk - arch i686 $ < - o ios - x86 / $ @ <nl> + $ ( SIMULATORROOT ) / usr / bin / $ ( CC ) $ ( CFLAGS ) - isysroot $ ( SIMULATORROOT ) / SDKs / iPhoneSimulator $ ( IOSVERSION ) . sdk - arch i686 $ < - o ios - x86 / $ @ <nl> mkdir - p ios - arm / $ ( dir $ @ ) <nl> - $ ( CC ) $ ( CFLAGS ) - isysroot / Developer / Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS4 . 3 . sdk - arch armv6 - arch armv7 $ < - o ios - arm / $ @ <nl> + $ ( DEVICEROOT ) / usr / bin / $ ( CC ) $ ( CFLAGS ) - isysroot $ ( DEVICEROOT ) / SDKs / iPhoneOS $ ( IOSVERSION ) . sdk - arch armv6 - arch armv7 $ < - o ios - arm / $ @ <nl> lipo ios - x86 / $ @ ios - arm / $ @ - create - output $ @ <nl> else <nl> . cc . o : <nl> mmm a / TODO <nl> ppp b / TODO <nl> db <nl> object stores , etc . can be done in the background anyway , so <nl> probably not that important . <nl> <nl> - api changes : <nl> - - Make it wrappable <nl> - <nl> - Faster Get implementation <nl> + After a range is completely deleted , what gets rid of the <nl> + corresponding files if we do no future changes to that range . Make <nl> + the conditions for triggering compactions fire in more situations ? <nl> mmm a / db / builder . cc <nl> ppp b / db / builder . cc <nl> Status BuildTable ( const std : : string & dbname , <nl> const Options & options , <nl> TableCache * table_cache , <nl> Iterator * iter , <nl> - FileMetaData * meta , <nl> - VersionEdit * edit ) { <nl> + FileMetaData * meta ) { <nl> Status s ; <nl> meta - > file_size = 0 ; <nl> iter - > SeekToFirst ( ) ; <nl> Status BuildTable ( const std : : string & dbname , <nl> } <nl> <nl> if ( s . ok ( ) & & meta - > file_size > 0 ) { <nl> - edit - > AddFile ( 0 , meta - > number , meta - > file_size , <nl> - meta - > smallest , meta - > largest ) ; <nl> + / / Keep it <nl> } else { <nl> env - > DeleteFile ( fname ) ; <nl> } <nl> mmm a / db / builder . h <nl> ppp b / db / builder . h <nl> class VersionEdit ; <nl> <nl> / / Build a Table file from the contents of * iter . The generated file <nl> / / will be named according to meta - > number . On success , the rest of <nl> - / / * meta will be filled with metadata about the generated table , and <nl> - / / the file information will be added to * edit . If no data is present <nl> - / / in * iter , meta - > file_size will be set to zero , and no Table file <nl> - / / will be produced . <nl> + / / * meta will be filled with metadata about the generated table . <nl> + / / If no data is present in * iter , meta - > file_size will be set to <nl> + / / zero , and no Table file will be produced . <nl> extern Status BuildTable ( const std : : string & dbname , <nl> Env * env , <nl> const Options & options , <nl> TableCache * table_cache , <nl> Iterator * iter , <nl> - FileMetaData * meta , <nl> - VersionEdit * edit ) ; <nl> + FileMetaData * meta ) ; <nl> <nl> } <nl> <nl> mmm a / db / corruption_test . cc <nl> ppp b / db / corruption_test . cc <nl> static const int kValueSize = 1000 ; <nl> class CorruptionTest { <nl> public : <nl> test : : ErrorEnv env_ ; <nl> - Random rnd_ ; <nl> std : : string dbname_ ; <nl> Cache * tiny_cache_ ; <nl> Options options_ ; <nl> DB * db_ ; <nl> <nl> - CorruptionTest ( ) : rnd_ ( test : : RandomSeed ( ) ) { <nl> + CorruptionTest ( ) { <nl> tiny_cache_ = NewLRUCache ( 100 ) ; <nl> options_ . env = & env_ ; <nl> dbname_ = test : : TmpDir ( ) + " / db_test " ; <nl> class CorruptionTest { <nl> ASSERT_OK ( env_ . GetChildren ( dbname_ , & filenames ) ) ; <nl> uint64_t number ; <nl> FileType type ; <nl> - std : : vector < std : : string > candidates ; <nl> + std : : string fname ; <nl> + int picked_number = - 1 ; <nl> for ( int i = 0 ; i < filenames . size ( ) ; i + + ) { <nl> if ( ParseFileName ( filenames [ i ] , & number , & type ) & & <nl> - type = = filetype ) { <nl> - candidates . push_back ( dbname_ + " / " + filenames [ i ] ) ; <nl> + type = = filetype & & <nl> + int ( number ) > picked_number ) { / / Pick latest file <nl> + fname = dbname_ + " / " + filenames [ i ] ; <nl> + picked_number = number ; <nl> } <nl> } <nl> - ASSERT_TRUE ( ! candidates . empty ( ) ) < < filetype ; <nl> - std : : string fname = candidates [ rnd_ . Uniform ( candidates . size ( ) ) ] ; <nl> + ASSERT_TRUE ( ! fname . empty ( ) ) < < filetype ; <nl> <nl> struct stat sbuf ; <nl> if ( stat ( fname . c_str ( ) , & sbuf ) ! = 0 ) { <nl> TEST ( CorruptionTest , TableFileIndexData ) { <nl> Build ( 10000 ) ; / / Enough to build multiple Tables <nl> DBImpl * dbi = reinterpret_cast < DBImpl * > ( db_ ) ; <nl> dbi - > TEST_CompactMemTable ( ) ; <nl> - dbi - > TEST_CompactRange ( 0 , " " , " ~ " ) ; <nl> - dbi - > TEST_CompactRange ( 1 , " " , " ~ " ) ; <nl> <nl> Corrupt ( kTableFile , - 2000 , 500 ) ; <nl> Reopen ( ) ; <nl> TEST ( CorruptionTest , CompactionInputError ) { <nl> Build ( 10 ) ; <nl> DBImpl * dbi = reinterpret_cast < DBImpl * > ( db_ ) ; <nl> dbi - > TEST_CompactMemTable ( ) ; <nl> - ASSERT_EQ ( 1 , Property ( " leveldb . num - files - at - level0 " ) ) ; <nl> + const int last = config : : kNumLevels - 1 ; <nl> + ASSERT_EQ ( 1 , Property ( " leveldb . num - files - at - level " + NumberToString ( last ) ) ) ; <nl> <nl> Corrupt ( kTableFile , 100 , 1 ) ; <nl> Check ( 9 , 9 ) ; <nl> TEST ( CorruptionTest , CompactionInputError ) { <nl> / / Force compactions by writing lots of values <nl> Build ( 10000 ) ; <nl> Check ( 10000 , 10000 ) ; <nl> - dbi - > TEST_CompactRange ( 0 , " " , " ~ " ) ; <nl> - ASSERT_EQ ( 0 , Property ( " leveldb . num - files - at - level0 " ) ) ; <nl> } <nl> <nl> TEST ( CorruptionTest , CompactionInputErrorParanoid ) { <nl> TEST ( CorruptionTest , CompactionInputErrorParanoid ) { <nl> options . paranoid_checks = true ; <nl> options . write_buffer_size = 1048576 ; <nl> Reopen ( & options ) ; <nl> + DBImpl * dbi = reinterpret_cast < DBImpl * > ( db_ ) ; <nl> + <nl> + / / Fill levels > = 1 so memtable compaction outputs to level 1 <nl> + for ( int level = 1 ; level < config : : kNumLevels ; level + + ) { <nl> + dbi - > Put ( WriteOptions ( ) , " " , " begin " ) ; <nl> + dbi - > Put ( WriteOptions ( ) , " ~ " , " end " ) ; <nl> + dbi - > TEST_CompactMemTable ( ) ; <nl> + } <nl> <nl> Build ( 10 ) ; <nl> - DBImpl * dbi = reinterpret_cast < DBImpl * > ( db_ ) ; <nl> dbi - > TEST_CompactMemTable ( ) ; <nl> ASSERT_EQ ( 1 , Property ( " leveldb . num - files - at - level0 " ) ) ; <nl> <nl> mmm a / db / db_bench . cc <nl> ppp b / db / db_bench . cc <nl> static int FLAGS_open_files = 0 ; <nl> / / benchmark will fail . <nl> static bool FLAGS_use_existing_db = false ; <nl> <nl> + / / Use the db with the following name . <nl> + static const char * FLAGS_db = " / tmp / dbbench " ; <nl> + <nl> namespace leveldb { <nl> <nl> / / Helper for quickly generating random data . <nl> class Benchmark { <nl> bytes_ ( 0 ) , <nl> rand_ ( 301 ) { <nl> std : : vector < std : : string > files ; <nl> - Env : : Default ( ) - > GetChildren ( " / tmp / dbbench " , & files ) ; <nl> + Env : : Default ( ) - > GetChildren ( FLAGS_db , & files ) ; <nl> for ( int i = 0 ; i < files . size ( ) ; i + + ) { <nl> if ( Slice ( files [ i ] ) . starts_with ( " heap - " ) ) { <nl> - Env : : Default ( ) - > DeleteFile ( " / tmp / dbbench / " + files [ i ] ) ; <nl> + Env : : Default ( ) - > DeleteFile ( std : : string ( FLAGS_db ) + " / " + files [ i ] ) ; <nl> } <nl> } <nl> if ( ! FLAGS_use_existing_db ) { <nl> - DestroyDB ( " / tmp / dbbench " , Options ( ) ) ; <nl> + DestroyDB ( FLAGS_db , Options ( ) ) ; <nl> } <nl> } <nl> <nl> class Benchmark { <nl> Write ( write_options , RANDOM , EXISTING , num_ , FLAGS_value_size , 1 ) ; <nl> } else if ( name = = Slice ( " fillsync " ) ) { <nl> write_options . sync = true ; <nl> - Write ( write_options , RANDOM , FRESH , num_ / 100 , FLAGS_value_size , 1 ) ; <nl> + Write ( write_options , RANDOM , FRESH , num_ / 1000 , FLAGS_value_size , 1 ) ; <nl> } else if ( name = = Slice ( " fill100K " ) ) { <nl> Write ( write_options , RANDOM , FRESH , num_ / 1000 , 100 * 1000 , 1 ) ; <nl> } else if ( name = = Slice ( " readseq " ) ) { <nl> class Benchmark { <nl> options . create_if_missing = ! FLAGS_use_existing_db ; <nl> options . block_cache = cache_ ; <nl> options . write_buffer_size = FLAGS_write_buffer_size ; <nl> - Status s = DB : : Open ( options , " / tmp / dbbench " , & db_ ) ; <nl> + Status s = DB : : Open ( options , FLAGS_db , & db_ ) ; <nl> if ( ! s . ok ( ) ) { <nl> fprintf ( stderr , " open error : % s \ n " , s . ToString ( ) . c_str ( ) ) ; <nl> exit ( 1 ) ; <nl> class Benchmark { <nl> } <nl> delete db_ ; <nl> db_ = NULL ; <nl> - DestroyDB ( " / tmp / dbbench " , Options ( ) ) ; <nl> + DestroyDB ( FLAGS_db , Options ( ) ) ; <nl> Open ( ) ; <nl> Start ( ) ; / / Do not count time taken to destroy / open <nl> } <nl> class Benchmark { <nl> <nl> void HeapProfile ( ) { <nl> char fname [ 100 ] ; <nl> - snprintf ( fname , sizeof ( fname ) , " / tmp / dbbench / heap - % 04d " , + + heap_counter_ ) ; <nl> + snprintf ( fname , sizeof ( fname ) , " % s / heap - % 04d " , FLAGS_db , + + heap_counter_ ) ; <nl> WritableFile * file ; <nl> Status s = Env : : Default ( ) - > NewWritableFile ( fname , & file ) ; <nl> if ( ! s . ok ( ) ) { <nl> int main ( int argc , char * * argv ) { <nl> FLAGS_cache_size = n ; <nl> } else if ( sscanf ( argv [ i ] , " - - open_files = % d % c " , & n , & junk ) = = 1 ) { <nl> FLAGS_open_files = n ; <nl> + } else if ( strncmp ( argv [ i ] , " - - db = " , 5 ) = = 0 ) { <nl> + FLAGS_db = argv [ i ] + 5 ; <nl> } else { <nl> fprintf ( stderr , " Invalid flag ' % s ' \ n " , argv [ i ] ) ; <nl> exit ( 1 ) ; <nl> mmm a / db / db_impl . cc <nl> ppp b / db / db_impl . cc <nl> DBImpl : : DBImpl ( const Options & options , const std : : string & dbname ) <nl> mem_ ( new MemTable ( internal_comparator_ ) ) , <nl> imm_ ( NULL ) , <nl> logfile_ ( NULL ) , <nl> + logfile_number_ ( 0 ) , <nl> log_ ( NULL ) , <nl> bg_compaction_scheduled_ ( false ) , <nl> manual_compaction_ ( NULL ) { <nl> void DBImpl : : DeleteObsoleteFiles ( ) { <nl> bool keep = true ; <nl> switch ( type ) { <nl> case kLogFile : <nl> - keep = ( ( number = = versions_ - > LogNumber ( ) ) | | <nl> + keep = ( ( number > = versions_ - > LogNumber ( ) ) | | <nl> ( number = = versions_ - > PrevLogNumber ( ) ) ) ; <nl> break ; <nl> case kDescriptorFile : <nl> Status DBImpl : : Recover ( VersionEdit * edit ) { <nl> <nl> s = versions_ - > Recover ( ) ; <nl> if ( s . ok ( ) ) { <nl> - / / Recover from the log files named in the descriptor <nl> SequenceNumber max_sequence ( 0 ) ; <nl> - if ( versions_ - > PrevLogNumber ( ) ! = 0 ) { / / log # = = 0 means no prev log <nl> - s = RecoverLogFile ( versions_ - > PrevLogNumber ( ) , edit , & max_sequence ) ; <nl> + <nl> + / / Recover from all newer log files than the ones named in the <nl> + / / descriptor ( new log files may have been added by the previous <nl> + / / incarnation without registering them in the descriptor ) . <nl> + / / <nl> + / / Note that PrevLogNumber ( ) is no longer used , but we pay <nl> + / / attention to it in case we are recovering a database <nl> + / / produced by an older version of leveldb . <nl> + const uint64_t min_log = versions_ - > LogNumber ( ) ; <nl> + const uint64_t prev_log = versions_ - > PrevLogNumber ( ) ; <nl> + std : : vector < std : : string > filenames ; <nl> + s = env_ - > GetChildren ( dbname_ , & filenames ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + return s ; <nl> + } <nl> + uint64_t number ; <nl> + FileType type ; <nl> + std : : vector < uint64_t > logs ; <nl> + for ( size_t i = 0 ; i < filenames . size ( ) ; i + + ) { <nl> + if ( ParseFileName ( filenames [ i ] , & number , & type ) <nl> + & & type = = kLogFile <nl> + & & ( ( number > = min_log ) | | ( number = = prev_log ) ) ) { <nl> + logs . push_back ( number ) ; <nl> + } <nl> } <nl> - if ( s . ok ( ) & & versions_ - > LogNumber ( ) ! = 0 ) { / / log # = = 0 for initial state <nl> - s = RecoverLogFile ( versions_ - > LogNumber ( ) , edit , & max_sequence ) ; <nl> + <nl> + / / Recover in the order in which the logs were generated <nl> + std : : sort ( logs . begin ( ) , logs . end ( ) ) ; <nl> + for ( size_t i = 0 ; i < logs . size ( ) ; i + + ) { <nl> + s = RecoverLogFile ( logs [ i ] , edit , & max_sequence ) ; <nl> } <nl> + <nl> if ( s . ok ( ) ) { <nl> if ( versions_ - > LastSequence ( ) < max_sequence ) { <nl> versions_ - > SetLastSequence ( max_sequence ) ; <nl> Status DBImpl : : RecoverLogFile ( uint64_t log_number , <nl> } <nl> <nl> if ( mem - > ApproximateMemoryUsage ( ) > options_ . write_buffer_size ) { <nl> - status = WriteLevel0Table ( mem , edit ) ; <nl> + status = WriteLevel0Table ( mem , edit , NULL ) ; <nl> if ( ! status . ok ( ) ) { <nl> / / Reflect errors immediately so that conditions like full <nl> / / file - systems cause the DB : : Open ( ) to fail . <nl> Status DBImpl : : RecoverLogFile ( uint64_t log_number , <nl> } <nl> <nl> if ( status . ok ( ) & & mem ! = NULL ) { <nl> - status = WriteLevel0Table ( mem , edit ) ; <nl> + status = WriteLevel0Table ( mem , edit , NULL ) ; <nl> / / Reflect errors immediately so that conditions like full <nl> / / file - systems cause the DB : : Open ( ) to fail . <nl> } <nl> Status DBImpl : : RecoverLogFile ( uint64_t log_number , <nl> return status ; <nl> } <nl> <nl> - Status DBImpl : : WriteLevel0Table ( MemTable * mem , VersionEdit * edit ) { <nl> + Status DBImpl : : WriteLevel0Table ( MemTable * mem , VersionEdit * edit , <nl> + Version * base ) { <nl> mutex_ . AssertHeld ( ) ; <nl> const uint64_t start_micros = env_ - > NowMicros ( ) ; <nl> FileMetaData meta ; <nl> Status DBImpl : : WriteLevel0Table ( MemTable * mem , VersionEdit * edit ) { <nl> Status s ; <nl> { <nl> mutex_ . Unlock ( ) ; <nl> - s = BuildTable ( dbname_ , env_ , options_ , table_cache_ , iter , & meta , edit ) ; <nl> + s = BuildTable ( dbname_ , env_ , options_ , table_cache_ , iter , & meta ) ; <nl> mutex_ . Lock ( ) ; <nl> } <nl> <nl> Status DBImpl : : WriteLevel0Table ( MemTable * mem , VersionEdit * edit ) { <nl> delete iter ; <nl> pending_outputs_ . erase ( meta . number ) ; <nl> <nl> + <nl> + / / Note that if file_size is zero , the file has been deleted and <nl> + / / should not be added to the manifest . <nl> + int level = 0 ; <nl> + if ( s . ok ( ) & & meta . file_size > 0 ) { <nl> + if ( base ! = NULL & & ! base - > OverlapInLevel ( 0 , meta . smallest , meta . largest ) ) { <nl> + / / Push to largest level we can without causing overlaps <nl> + while ( level + 1 < config : : kNumLevels & & <nl> + ! base - > OverlapInLevel ( level + 1 , meta . smallest , meta . largest ) ) { <nl> + level + + ; <nl> + } <nl> + } <nl> + edit - > AddFile ( level , meta . number , meta . file_size , <nl> + meta . smallest , meta . largest ) ; <nl> + } <nl> + <nl> CompactionStats stats ; <nl> stats . micros = env_ - > NowMicros ( ) - start_micros ; <nl> stats . bytes_written = meta . file_size ; <nl> - stats_ [ 0 ] . Add ( stats ) ; <nl> + stats_ [ level ] . Add ( stats ) ; <nl> return s ; <nl> } <nl> <nl> Status DBImpl : : CompactMemTable ( ) { <nl> <nl> / / Save the contents of the memtable as a new Table <nl> VersionEdit edit ; <nl> - Status s = WriteLevel0Table ( imm_ , & edit ) ; <nl> + Version * base = versions_ - > current ( ) ; <nl> + base - > Ref ( ) ; <nl> + Status s = WriteLevel0Table ( imm_ , & edit , base ) ; <nl> + base - > Unref ( ) ; <nl> + <nl> + if ( s . ok ( ) & & shutting_down_ . Acquire_Load ( ) ) { <nl> + s = Status : : IOError ( " Deleting DB during memtable compaction " ) ; <nl> + } <nl> <nl> / / Replace immutable memtable with the generated Table <nl> if ( s . ok ( ) ) { <nl> edit . SetPrevLogNumber ( 0 ) ; <nl> + edit . SetLogNumber ( logfile_number_ ) ; / / Earlier logs no longer needed <nl> s = versions_ - > LogAndApply ( & edit ) ; <nl> } <nl> <nl> void DBImpl : : TEST_CompactRange ( <nl> int level , <nl> const std : : string & begin , <nl> const std : : string & end ) { <nl> + assert ( level > = 0 ) ; <nl> + assert ( level + 1 < config : : kNumLevels ) ; <nl> + <nl> MutexLock l ( & mutex_ ) ; <nl> while ( manual_compaction_ ! = NULL ) { <nl> bg_cv_ . Wait ( ) ; <nl> int64_t DBImpl : : TEST_MaxNextLevelOverlappingBytes ( ) { <nl> Status DBImpl : : Get ( const ReadOptions & options , <nl> const Slice & key , <nl> std : : string * value ) { <nl> - / / TODO ( opt ) : faster implementation <nl> - Iterator * iter = NewIterator ( options ) ; <nl> - iter - > Seek ( key ) ; <nl> - bool found = false ; <nl> - if ( iter - > Valid ( ) & & user_comparator ( ) - > Compare ( key , iter - > key ( ) ) = = 0 ) { <nl> - Slice v = iter - > value ( ) ; <nl> - value - > assign ( v . data ( ) , v . size ( ) ) ; <nl> - found = true ; <nl> - } <nl> - / / Non - OK iterator status trumps everything else <nl> - Status result = iter - > status ( ) ; <nl> - if ( result . ok ( ) & & ! found ) { <nl> - result = Status : : NotFound ( Slice ( ) ) ; / / Use an empty error message for speed <nl> + Status s ; <nl> + MutexLock l ( & mutex_ ) ; <nl> + SequenceNumber snapshot ; <nl> + if ( options . snapshot ! = NULL ) { <nl> + snapshot = reinterpret_cast < const SnapshotImpl * > ( options . snapshot ) - > number_ ; <nl> + } else { <nl> + snapshot = versions_ - > LastSequence ( ) ; <nl> } <nl> - delete iter ; <nl> - return result ; <nl> + <nl> + / / First look in the memtable , then in the immutable memtable ( if any ) . <nl> + LookupKey lkey ( key , snapshot ) ; <nl> + if ( mem_ - > Get ( lkey , value , & s ) ) { <nl> + return s ; <nl> + } <nl> + if ( imm_ ! = NULL & & imm_ - > Get ( lkey , value , & s ) ) { <nl> + return s ; <nl> + } <nl> + <nl> + / / Not in memtable ( s ) ; try live files in level order <nl> + Version * current = versions_ - > current ( ) ; <nl> + current - > Ref ( ) ; <nl> + Version : : GetStats stats ; <nl> + { / / Unlock while reading from files <nl> + mutex_ . Unlock ( ) ; <nl> + s = current - > Get ( options , lkey , value , & stats ) ; <nl> + mutex_ . Lock ( ) ; <nl> + } <nl> + if ( current - > UpdateStats ( stats ) ) { <nl> + MaybeScheduleCompaction ( ) ; <nl> + } <nl> + current - > Unref ( ) ; <nl> + return s ; <nl> } <nl> <nl> Iterator * DBImpl : : NewIterator ( const ReadOptions & options ) { <nl> Status DBImpl : : MakeRoomForWrite ( bool force ) { <nl> if ( ! s . ok ( ) ) { <nl> break ; <nl> } <nl> - VersionEdit edit ; <nl> - edit . SetPrevLogNumber ( versions_ - > LogNumber ( ) ) ; <nl> - edit . SetLogNumber ( new_log_number ) ; <nl> - s = versions_ - > LogAndApply ( & edit ) ; <nl> - if ( ! s . ok ( ) ) { <nl> - delete lfile ; <nl> - env_ - > DeleteFile ( LogFileName ( dbname_ , new_log_number ) ) ; <nl> - break ; <nl> - } <nl> delete log_ ; <nl> delete logfile_ ; <nl> logfile_ = lfile ; <nl> + logfile_number_ = new_log_number ; <nl> log_ = new log : : Writer ( lfile ) ; <nl> imm_ = mem_ ; <nl> has_imm_ . Release_Store ( imm_ ) ; <nl> Status DB : : Open ( const Options & options , const std : : string & dbname , <nl> if ( s . ok ( ) ) { <nl> edit . SetLogNumber ( new_log_number ) ; <nl> impl - > logfile_ = lfile ; <nl> + impl - > logfile_number_ = new_log_number ; <nl> impl - > log_ = new log : : Writer ( lfile ) ; <nl> s = impl - > versions_ - > LogAndApply ( & edit ) ; <nl> } <nl> mmm a / db / db_impl . h <nl> ppp b / db / db_impl . h <nl> class DBImpl : public DB { <nl> VersionEdit * edit , <nl> SequenceNumber * max_sequence ) ; <nl> <nl> - Status WriteLevel0Table ( MemTable * mem , VersionEdit * edit ) ; <nl> + Status WriteLevel0Table ( MemTable * mem , VersionEdit * edit , Version * base ) ; <nl> <nl> Status MakeRoomForWrite ( bool force / * compact even if there is room ? * / ) ; <nl> <nl> class DBImpl : public DB { <nl> MemTable * imm_ ; / / Memtable being compacted <nl> port : : AtomicPointer has_imm_ ; / / So bg thread can detect non - NULL imm_ <nl> WritableFile * logfile_ ; <nl> + uint64_t logfile_number_ ; <nl> log : : Writer * log_ ; <nl> SnapshotList snapshots_ ; <nl> <nl> mmm a / db / db_test . cc <nl> ppp b / db / db_test . cc <nl> static std : : string RandomString ( Random * rnd , int len ) { <nl> return r ; <nl> } <nl> <nl> + / / Special Env used to delay background operations <nl> + class SpecialEnv : public EnvWrapper { <nl> + public : <nl> + / / sstable Sync ( ) calls are blocked while this pointer is non - NULL . <nl> + port : : AtomicPointer delay_sstable_sync_ ; <nl> + <nl> + explicit SpecialEnv ( Env * base ) : EnvWrapper ( base ) { <nl> + delay_sstable_sync_ . Release_Store ( NULL ) ; <nl> + } <nl> + <nl> + Status NewWritableFile ( const std : : string & f , WritableFile * * r ) { <nl> + class SSTableFile : public WritableFile { <nl> + private : <nl> + SpecialEnv * env_ ; <nl> + WritableFile * base_ ; <nl> + <nl> + public : <nl> + SSTableFile ( SpecialEnv * env , WritableFile * base ) <nl> + : env_ ( env ) , <nl> + base_ ( base ) { <nl> + } <nl> + Status Append ( const Slice & data ) { return base_ - > Append ( data ) ; } <nl> + Status Close ( ) { return base_ - > Close ( ) ; } <nl> + Status Flush ( ) { return base_ - > Flush ( ) ; } <nl> + Status Sync ( ) { <nl> + while ( env_ - > delay_sstable_sync_ . Acquire_Load ( ) ! = NULL ) { <nl> + env_ - > SleepForMicroseconds ( 100000 ) ; <nl> + } <nl> + return base_ - > Sync ( ) ; <nl> + } <nl> + } ; <nl> + <nl> + Status s = target ( ) - > NewWritableFile ( f , r ) ; <nl> + if ( s . ok ( ) ) { <nl> + if ( strstr ( f . c_str ( ) , " . sst " ) ! = NULL ) { <nl> + * r = new SSTableFile ( this , * r ) ; <nl> + } <nl> + } <nl> + return s ; <nl> + } <nl> + } ; <nl> + <nl> class DBTest { <nl> public : <nl> std : : string dbname_ ; <nl> - Env * env_ ; <nl> + SpecialEnv * env_ ; <nl> DB * db_ ; <nl> <nl> Options last_options_ ; <nl> <nl> - DBTest ( ) : env_ ( Env : : Default ( ) ) { <nl> + DBTest ( ) : env_ ( new SpecialEnv ( Env : : Default ( ) ) ) { <nl> dbname_ = test : : TmpDir ( ) + " / db_test " ; <nl> DestroyDB ( dbname_ , Options ( ) ) ; <nl> db_ = NULL ; <nl> class DBTest { <nl> ~ DBTest ( ) { <nl> delete db_ ; <nl> DestroyDB ( dbname_ , Options ( ) ) ; <nl> + delete env_ ; <nl> } <nl> <nl> DBImpl * dbfull ( ) { <nl> class DBTest { <nl> return atoi ( property . c_str ( ) ) ; <nl> } <nl> <nl> + int TotalTableFiles ( ) { <nl> + int result = 0 ; <nl> + for ( int level = 0 ; level < config : : kNumLevels ; level + + ) { <nl> + result + = NumTableFilesAtLevel ( level ) ; <nl> + } <nl> + return result ; <nl> + } <nl> + <nl> uint64_t Size ( const Slice & start , const Slice & limit ) { <nl> Range r ( start , limit ) ; <nl> uint64_t size ; <nl> class DBTest { <nl> } <nl> } <nl> <nl> + / / Prevent pushing of new sstables into deeper levels by adding <nl> + / / tables that cover a specified range to all levels . <nl> + void FillLevels ( const std : : string & smallest , const std : : string & largest ) { <nl> + for ( int level = 0 ; level < config : : kNumLevels ; level + + ) { <nl> + Put ( smallest , " begin " ) ; <nl> + Put ( largest , " end " ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + } <nl> + } <nl> + <nl> void DumpFileCounts ( const char * label ) { <nl> fprintf ( stderr , " mmm \ n % s : \ n " , label ) ; <nl> fprintf ( stderr , " maxoverlap : % lld \ n " , <nl> TEST ( DBTest , PutDeleteGet ) { <nl> ASSERT_EQ ( " NOT_FOUND " , Get ( " foo " ) ) ; <nl> } <nl> <nl> + TEST ( DBTest , GetFromImmutableLayer ) { <nl> + Options options ; <nl> + options . env = env_ ; <nl> + options . write_buffer_size = 100000 ; / / Small write buffer <nl> + Reopen ( & options ) ; <nl> + <nl> + ASSERT_OK ( Put ( " foo " , " v1 " ) ) ; <nl> + ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ; <nl> + <nl> + env_ - > delay_sstable_sync_ . Release_Store ( env_ ) ; / / Block sync calls <nl> + Put ( " k1 " , std : : string ( 100000 , ' x ' ) ) ; / / Fill memtable <nl> + Put ( " k2 " , std : : string ( 100000 , ' y ' ) ) ; / / Trigger compaction <nl> + ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ; <nl> + env_ - > delay_sstable_sync_ . Release_Store ( NULL ) ; / / Release sync calls <nl> + } <nl> + <nl> + TEST ( DBTest , GetFromVersions ) { <nl> + ASSERT_OK ( Put ( " foo " , " v1 " ) ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ; <nl> + } <nl> + <nl> + TEST ( DBTest , GetSnapshot ) { <nl> + / / Try with both a short key and a long key <nl> + for ( int i = 0 ; i < 2 ; i + + ) { <nl> + std : : string key = ( i = = 0 ) ? std : : string ( " foo " ) : std : : string ( 200 , ' x ' ) ; <nl> + ASSERT_OK ( Put ( key , " v1 " ) ) ; <nl> + const Snapshot * s1 = db_ - > GetSnapshot ( ) ; <nl> + ASSERT_OK ( Put ( key , " v2 " ) ) ; <nl> + ASSERT_EQ ( " v2 " , Get ( key ) ) ; <nl> + ASSERT_EQ ( " v1 " , Get ( key , s1 ) ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + ASSERT_EQ ( " v2 " , Get ( key ) ) ; <nl> + ASSERT_EQ ( " v1 " , Get ( key , s1 ) ) ; <nl> + db_ - > ReleaseSnapshot ( s1 ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( DBTest , GetLevel0Ordering ) { <nl> + / / Check that we process level - 0 files in correct order . The code <nl> + / / below generates two level - 0 files where the earlier one comes <nl> + / / before the later one in the level - 0 file list since the earlier <nl> + / / one has a smaller " smallest " key . <nl> + ASSERT_OK ( Put ( " bar " , " b " ) ) ; <nl> + ASSERT_OK ( Put ( " foo " , " v1 " ) ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + ASSERT_OK ( Put ( " foo " , " v2 " ) ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + ASSERT_EQ ( " v2 " , Get ( " foo " ) ) ; <nl> + } <nl> + <nl> + TEST ( DBTest , GetOrderedByLevels ) { <nl> + ASSERT_OK ( Put ( " foo " , " v1 " ) ) ; <nl> + Compact ( " a " , " z " ) ; <nl> + ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ; <nl> + ASSERT_OK ( Put ( " foo " , " v2 " ) ) ; <nl> + ASSERT_EQ ( " v2 " , Get ( " foo " ) ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + ASSERT_EQ ( " v2 " , Get ( " foo " ) ) ; <nl> + } <nl> + <nl> + TEST ( DBTest , GetPicksCorrectFile ) { <nl> + / / Arrange to have multiple files in a non - level - 0 level . <nl> + ASSERT_OK ( Put ( " a " , " va " ) ) ; <nl> + Compact ( " a " , " b " ) ; <nl> + ASSERT_OK ( Put ( " x " , " vx " ) ) ; <nl> + Compact ( " x " , " y " ) ; <nl> + ASSERT_OK ( Put ( " f " , " vf " ) ) ; <nl> + Compact ( " f " , " g " ) ; <nl> + ASSERT_EQ ( " va " , Get ( " a " ) ) ; <nl> + ASSERT_EQ ( " vf " , Get ( " f " ) ) ; <nl> + ASSERT_EQ ( " vx " , Get ( " x " ) ) ; <nl> + } <nl> + <nl> TEST ( DBTest , IterEmpty ) { <nl> Iterator * iter = db_ - > NewIterator ( ReadOptions ( ) ) ; <nl> <nl> TEST ( DBTest , RecoveryWithEmptyLog ) { <nl> ASSERT_EQ ( " v3 " , Get ( " foo " ) ) ; <nl> } <nl> <nl> + / / Check that writes done during a memtable compaction are recovered <nl> + / / if the database is shutdown during the memtable compaction . <nl> + TEST ( DBTest , RecoverDuringMemtableCompaction ) { <nl> + Options options ; <nl> + options . env = env_ ; <nl> + options . write_buffer_size = 1000000 ; <nl> + Reopen ( & options ) ; <nl> + <nl> + / / Trigger a long memtable compaction and reopen the database during it <nl> + ASSERT_OK ( Put ( " foo " , " v1 " ) ) ; / / Goes to 1st log file <nl> + ASSERT_OK ( Put ( " big1 " , std : : string ( 10000000 , ' x ' ) ) ) ; / / Fills memtable <nl> + ASSERT_OK ( Put ( " big2 " , std : : string ( 1000 , ' y ' ) ) ) ; / / Triggers compaction <nl> + ASSERT_OK ( Put ( " bar " , " v2 " ) ) ; / / Goes to new log file <nl> + <nl> + Reopen ( & options ) ; <nl> + ASSERT_EQ ( " v1 " , Get ( " foo " ) ) ; <nl> + ASSERT_EQ ( " v2 " , Get ( " bar " ) ) ; <nl> + ASSERT_EQ ( std : : string ( 10000000 , ' x ' ) , Get ( " big1 " ) ) ; <nl> + ASSERT_EQ ( std : : string ( 1000 , ' y ' ) , Get ( " big2 " ) ) ; <nl> + } <nl> + <nl> static std : : string Key ( int i ) { <nl> char buf [ 100 ] ; <nl> snprintf ( buf , sizeof ( buf ) , " key % 06d " , i ) ; <nl> TEST ( DBTest , MinorCompactionsHappen ) { <nl> <nl> const int N = 500 ; <nl> <nl> - int starting_num_tables = NumTableFilesAtLevel ( 0 ) ; <nl> + int starting_num_tables = TotalTableFiles ( ) ; <nl> for ( int i = 0 ; i < N ; i + + ) { <nl> ASSERT_OK ( Put ( Key ( i ) , Key ( i ) + std : : string ( 1000 , ' v ' ) ) ) ; <nl> } <nl> - int ending_num_tables = NumTableFilesAtLevel ( 0 ) ; <nl> + int ending_num_tables = TotalTableFiles ( ) ; <nl> ASSERT_GT ( ending_num_tables , starting_num_tables ) ; <nl> <nl> for ( int i = 0 ; i < N ; i + + ) { <nl> TEST ( DBTest , SparseMerge ) { <nl> options . compression = kNoCompression ; <nl> Reopen ( & options ) ; <nl> <nl> + FillLevels ( " A " , " Z " ) ; <nl> + <nl> / / Suppose there is : <nl> / / small amount of data with prefix A <nl> / / large amount of data with prefix B <nl> TEST ( DBTest , SparseMerge ) { <nl> Put ( key , value ) ; <nl> } <nl> Put ( " C " , " vc " ) ; <nl> - Compact ( " " , " z " ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + dbfull ( ) - > TEST_CompactRange ( 0 , " A " , " Z " ) ; <nl> <nl> / / Make sparse update <nl> Put ( " A " , " va2 " ) ; <nl> TEST ( DBTest , Snapshot ) { <nl> <nl> TEST ( DBTest , HiddenValuesAreRemoved ) { <nl> Random rnd ( 301 ) ; <nl> + FillLevels ( " a " , " z " ) ; <nl> + <nl> std : : string big = RandomString ( & rnd , 50000 ) ; <nl> Put ( " foo " , big ) ; <nl> Put ( " pastfoo " , " v " ) ; <nl> TEST ( DBTest , HiddenValuesAreRemoved ) { <nl> TEST ( DBTest , DeletionMarkers1 ) { <nl> Put ( " foo " , " v1 " ) ; <nl> ASSERT_OK ( dbfull ( ) - > TEST_CompactMemTable ( ) ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 0 , " " , " z " ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 1 , " " , " z " ) ; <nl> - ASSERT_EQ ( NumTableFilesAtLevel ( 2 ) , 1 ) ; / / foo = > v1 is now in level 2 file <nl> + const int last = config : : kNumLevels - 1 ; <nl> + ASSERT_EQ ( NumTableFilesAtLevel ( last ) , 1 ) ; / / foo = > v1 is now in last level <nl> + <nl> + / / Place a table at level last - 1 to prevent merging with preceding mutation <nl> + Put ( " a " , " begin " ) ; <nl> + Put ( " z " , " end " ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + ASSERT_EQ ( NumTableFilesAtLevel ( last ) , 1 ) ; <nl> + ASSERT_EQ ( NumTableFilesAtLevel ( last - 1 ) , 1 ) ; <nl> + <nl> Delete ( " foo " ) ; <nl> Put ( " foo " , " v2 " ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ v2 , DEL , v1 ] " ) ; <nl> - ASSERT_OK ( dbfull ( ) - > TEST_CompactMemTable ( ) ) ; <nl> + ASSERT_OK ( dbfull ( ) - > TEST_CompactMemTable ( ) ) ; / / Moves to level last - 2 <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ v2 , DEL , v1 ] " ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 0 , " " , " z " ) ; <nl> + dbfull ( ) - > TEST_CompactRange ( last - 2 , " " , " z " ) ; <nl> / / DEL eliminated , but v1 remains because we aren ' t compacting that level <nl> / / ( DEL can be eliminated because v2 hides v1 ) . <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ v2 , v1 ] " ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 1 , " " , " z " ) ; <nl> - / / Merging L1 w / L2 , so we are the base level for " foo " , so DEL is removed . <nl> - / / ( as is v1 ) . <nl> + dbfull ( ) - > TEST_CompactRange ( last - 1 , " " , " z " ) ; <nl> + / / Merging last - 1 w / last , so we are the base level for " foo " , so <nl> + / / DEL is removed . ( as is v1 ) . <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ v2 ] " ) ; <nl> } <nl> <nl> TEST ( DBTest , DeletionMarkers2 ) { <nl> Put ( " foo " , " v1 " ) ; <nl> ASSERT_OK ( dbfull ( ) - > TEST_CompactMemTable ( ) ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 0 , " " , " z " ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 1 , " " , " z " ) ; <nl> - ASSERT_EQ ( NumTableFilesAtLevel ( 2 ) , 1 ) ; / / foo = > v1 is now in level 2 file <nl> + const int last = config : : kNumLevels - 1 ; <nl> + ASSERT_EQ ( NumTableFilesAtLevel ( last ) , 1 ) ; / / foo = > v1 is now in last level <nl> + <nl> + / / Place a table at level last - 1 to prevent merging with preceding mutation <nl> + Put ( " a " , " begin " ) ; <nl> + Put ( " z " , " end " ) ; <nl> + dbfull ( ) - > TEST_CompactMemTable ( ) ; <nl> + ASSERT_EQ ( NumTableFilesAtLevel ( last ) , 1 ) ; <nl> + ASSERT_EQ ( NumTableFilesAtLevel ( last - 1 ) , 1 ) ; <nl> + <nl> Delete ( " foo " ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ DEL , v1 ] " ) ; <nl> - ASSERT_OK ( dbfull ( ) - > TEST_CompactMemTable ( ) ) ; <nl> + ASSERT_OK ( dbfull ( ) - > TEST_CompactMemTable ( ) ) ; / / Moves to level last - 2 <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ DEL , v1 ] " ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 0 , " " , " z " ) ; <nl> - / / DEL kept : L2 file overlaps <nl> + dbfull ( ) - > TEST_CompactRange ( last - 2 , " " , " z " ) ; <nl> + / / DEL kept : " last " file overlaps <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ DEL , v1 ] " ) ; <nl> - dbfull ( ) - > TEST_CompactRange ( 1 , " " , " z " ) ; <nl> - / / Merging L1 w / L2 , so we are the base level for " foo " , so DEL is removed . <nl> - / / ( as is v1 ) . <nl> + dbfull ( ) - > TEST_CompactRange ( last - 1 , " " , " z " ) ; <nl> + / / Merging last - 1 w / last , so we are the base level for " foo " , so <nl> + / / DEL is removed . ( as is v1 ) . <nl> ASSERT_EQ ( AllEntriesFor ( " foo " ) , " [ ] " ) ; <nl> } <nl> <nl> mmm a / db / dbformat . cc <nl> ppp b / db / dbformat . cc <nl> void InternalKeyComparator : : FindShortSuccessor ( std : : string * key ) const { <nl> } <nl> } <nl> <nl> + LookupKey : : LookupKey ( const Slice & user_key , SequenceNumber s ) { <nl> + size_t usize = user_key . size ( ) ; <nl> + size_t needed = usize + 13 ; / / A conservative estimate <nl> + char * dst ; <nl> + if ( needed < = sizeof ( space_ ) ) { <nl> + dst = space_ ; <nl> + } else { <nl> + dst = new char [ needed ] ; <nl> + } <nl> + start_ = dst ; <nl> + dst = EncodeVarint32 ( dst , usize + 8 ) ; <nl> + kstart_ = dst ; <nl> + memcpy ( dst , user_key . data ( ) , usize ) ; <nl> + dst + = usize ; <nl> + EncodeFixed64 ( dst , PackSequenceAndType ( s , kValueTypeForSeek ) ) ; <nl> + dst + = 8 ; <nl> + end_ = dst ; <nl> + } <nl> + <nl> } <nl> mmm a / db / dbformat . h <nl> ppp b / db / dbformat . h <nl> inline bool ParseInternalKey ( const Slice & internal_key , <nl> return ( c < = static_cast < unsigned char > ( kTypeValue ) ) ; <nl> } <nl> <nl> + / / A helper class useful for DBImpl : : Get ( ) <nl> + class LookupKey { <nl> + public : <nl> + / / Initialize * this for looking up user_key at a snapshot with <nl> + / / the specified sequence number . <nl> + LookupKey ( const Slice & user_key , SequenceNumber sequence ) ; <nl> + <nl> + ~ LookupKey ( ) ; <nl> + <nl> + / / Return a key suitable for lookup in a MemTable . <nl> + Slice memtable_key ( ) const { return Slice ( start_ , end_ - start_ ) ; } <nl> + <nl> + / / Return an internal key ( suitable for passing to an internal iterator ) <nl> + Slice internal_key ( ) const { return Slice ( kstart_ , end_ - kstart_ ) ; } <nl> + <nl> + / / Return the user key <nl> + Slice user_key ( ) const { return Slice ( kstart_ , end_ - kstart_ - 8 ) ; } <nl> + <nl> + private : <nl> + / / We construct a char array of the form : <nl> + / / klength varint32 < - - start_ <nl> + / / userkey char [ klength ] < - - kstart_ <nl> + / / tag uint64 <nl> + / / < - - end_ <nl> + / / The array is a suitable MemTable key . <nl> + / / The suffix starting with " userkey " can be used as an InternalKey . <nl> + const char * start_ ; <nl> + const char * kstart_ ; <nl> + const char * end_ ; <nl> + char space_ [ 200 ] ; / / Avoid allocation for short keys <nl> + <nl> + / / No copying allowed <nl> + LookupKey ( const LookupKey & ) ; <nl> + void operator = ( const LookupKey & ) ; <nl> + } ; <nl> + <nl> + inline LookupKey : : ~ LookupKey ( ) { <nl> + if ( start_ ! = space_ ) delete [ ] start_ ; <nl> + } <nl> + <nl> } <nl> <nl> # endif / / STORAGE_LEVELDB_DB_FORMAT_H_ <nl> mmm a / db / memtable . cc <nl> ppp b / db / memtable . cc <nl> void MemTable : : Add ( SequenceNumber s , ValueType type , <nl> table_ . Insert ( buf ) ; <nl> } <nl> <nl> + bool MemTable : : Get ( const LookupKey & key , std : : string * value , Status * s ) { <nl> + Slice memkey = key . memtable_key ( ) ; <nl> + Table : : Iterator iter ( & table_ ) ; <nl> + iter . Seek ( memkey . data ( ) ) ; <nl> + if ( iter . Valid ( ) ) { <nl> + / / entry format is : <nl> + / / klength varint32 <nl> + / / userkey char [ klength ] <nl> + / / tag uint64 <nl> + / / vlength varint32 <nl> + / / value char [ vlength ] <nl> + / / Check that it belongs to same user key . We do not check the <nl> + / / sequence number since the Seek ( ) call above should have skipped <nl> + / / all entries with overly large sequence numbers . <nl> + const char * entry = iter . key ( ) ; <nl> + uint32_t key_length ; <nl> + const char * key_ptr = GetVarint32Ptr ( entry , entry + 5 , & key_length ) ; <nl> + if ( comparator_ . comparator . user_comparator ( ) - > Compare ( <nl> + Slice ( key_ptr , key_length - 8 ) , <nl> + key . user_key ( ) ) = = 0 ) { <nl> + / / Correct user key <nl> + const uint64_t tag = DecodeFixed64 ( key_ptr + key_length - 8 ) ; <nl> + switch ( static_cast < ValueType > ( tag & 0xff ) ) { <nl> + case kTypeValue : { <nl> + Slice v = GetLengthPrefixedSlice ( key_ptr + key_length ) ; <nl> + value - > assign ( v . data ( ) , v . size ( ) ) ; <nl> + return true ; <nl> + } <nl> + case kTypeDeletion : <nl> + * s = Status : : NotFound ( Slice ( ) ) ; <nl> + return true ; <nl> + } <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> } <nl> mmm a / db / memtable . h <nl> ppp b / db / memtable . h <nl> class MemTable { <nl> const Slice & key , <nl> const Slice & value ) ; <nl> <nl> + / / If memtable contains a value for key , store it in * value and return true . <nl> + / / If memtable contains a deletion for key , store a NotFound ( ) error <nl> + / / in * status and return true . <nl> + / / Else , return false . <nl> + bool Get ( const LookupKey & key , std : : string * value , Status * s ) ; <nl> + <nl> private : <nl> ~ MemTable ( ) ; / / Private since only Unref ( ) should be used to delete it <nl> <nl> mmm a / db / repair . cc <nl> ppp b / db / repair . cc <nl> class Repairer { <nl> } <nl> delete lfile ; <nl> <nl> - / / We ignore any version edits generated by the conversion to a Table <nl> + / / Do not record a version edit for this conversion to a Table <nl> / / since ExtractMetaData ( ) will also generate edits . <nl> - VersionEdit skipped ; <nl> FileMetaData meta ; <nl> meta . number = next_file_number_ + + ; <nl> Iterator * iter = mem - > NewIterator ( ) ; <nl> - status = BuildTable ( dbname_ , env_ , options_ , table_cache_ , iter , <nl> - & meta , & skipped ) ; <nl> + status = BuildTable ( dbname_ , env_ , options_ , table_cache_ , iter , & meta ) ; <nl> delete iter ; <nl> mem - > Unref ( ) ; <nl> mem = NULL ; <nl> mmm a / db / version_edit . h <nl> ppp b / db / version_edit . h <nl> class VersionSet ; <nl> <nl> struct FileMetaData { <nl> int refs ; <nl> + int allowed_seeks ; / / Seeks allowed until compaction <nl> uint64_t number ; <nl> uint64_t file_size ; / / File size in bytes <nl> InternalKey smallest ; / / Smallest internal key served by table <nl> InternalKey largest ; / / Largest internal key served by table <nl> <nl> - FileMetaData ( ) : refs ( 0 ) , file_size ( 0 ) { } <nl> + FileMetaData ( ) : refs ( 0 ) , allowed_seeks ( 1 < < 30 ) , file_size ( 0 ) { } <nl> } ; <nl> <nl> class VersionEdit { <nl> mmm a / db / version_set . cc <nl> ppp b / db / version_set . cc <nl> Version : : ~ Version ( ) { <nl> } <nl> } <nl> <nl> + int FindFile ( const InternalKeyComparator & icmp , <nl> + const std : : vector < FileMetaData * > & files , <nl> + const Slice & key ) { <nl> + uint32_t left = 0 ; <nl> + uint32_t right = files . size ( ) ; <nl> + while ( left < right ) { <nl> + uint32_t mid = ( left + right ) / 2 ; <nl> + const FileMetaData * f = files [ mid ] ; <nl> + if ( icmp . InternalKeyComparator : : Compare ( f - > largest . Encode ( ) , key ) < 0 ) { <nl> + / / Key at " mid . largest " is < " target " . Therefore all <nl> + / / files at or before " mid " are uninteresting . <nl> + left = mid + 1 ; <nl> + } else { <nl> + / / Key at " mid . largest " is > = " target " . Therefore all files <nl> + / / after " mid " are uninteresting . <nl> + right = mid ; <nl> + } <nl> + } <nl> + return right ; <nl> + } <nl> + <nl> + bool SomeFileOverlapsRange ( <nl> + const InternalKeyComparator & icmp , <nl> + const std : : vector < FileMetaData * > & files , <nl> + const InternalKey & smallest , <nl> + const InternalKey & largest ) { <nl> + const int index = FindFile ( icmp , files , smallest . Encode ( ) ) ; <nl> + return ( ( index < files . size ( ) ) & & <nl> + icmp . Compare ( largest , files [ index ] - > smallest ) > = 0 ) ; <nl> + } <nl> + <nl> / / An internal iterator . For a given version / level pair , yields <nl> / / information about the files in the level . For a given entry , key ( ) <nl> / / is the largest key that occurs in the file , and value ( ) is an <nl> class Version : : LevelFileNumIterator : public Iterator { <nl> return index_ < flist_ - > size ( ) ; <nl> } <nl> virtual void Seek ( const Slice & target ) { <nl> - uint32_t left = 0 ; <nl> - uint32_t right = flist_ - > size ( ) - 1 ; <nl> - while ( left < right ) { <nl> - uint32_t mid = ( left + right ) / 2 ; <nl> - int cmp = icmp_ . Compare ( ( * flist_ ) [ mid ] - > largest . Encode ( ) , target ) ; <nl> - if ( cmp < 0 ) { <nl> - / / Key at " mid . largest " is < than " target " . Therefore all <nl> - / / files at or before " mid " are uninteresting . <nl> - left = mid + 1 ; <nl> - } else { <nl> - / / Key at " mid . largest " is > = " target " . Therefore all files <nl> - / / after " mid " are uninteresting . <nl> - right = mid ; <nl> - } <nl> - } <nl> - index_ = left ; <nl> + index_ = FindFile ( icmp_ , * flist_ , target ) ; <nl> } <nl> virtual void SeekToFirst ( ) { index_ = 0 ; } <nl> virtual void SeekToLast ( ) { <nl> void Version : : AddIterators ( const ReadOptions & options , <nl> } <nl> } <nl> <nl> + / / If " * iter " points at a value or deletion for user_key , store <nl> + / / either the value , or a NotFound error and return true . <nl> + / / Else return false . <nl> + static bool GetValue ( Iterator * iter , const Slice & user_key , <nl> + std : : string * value , <nl> + Status * s ) { <nl> + if ( ! iter - > Valid ( ) ) { <nl> + return false ; <nl> + } <nl> + ParsedInternalKey parsed_key ; <nl> + if ( ! ParseInternalKey ( iter - > key ( ) , & parsed_key ) ) { <nl> + * s = Status : : Corruption ( " corrupted key for " , user_key ) ; <nl> + return true ; <nl> + } <nl> + if ( parsed_key . user_key ! = user_key ) { <nl> + return false ; <nl> + } <nl> + switch ( parsed_key . type ) { <nl> + case kTypeDeletion : <nl> + * s = Status : : NotFound ( Slice ( ) ) ; / / Use an empty error message for speed <nl> + break ; <nl> + case kTypeValue : { <nl> + Slice v = iter - > value ( ) ; <nl> + value - > assign ( v . data ( ) , v . size ( ) ) ; <nl> + break ; <nl> + } <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + static bool NewestFirst ( FileMetaData * a , FileMetaData * b ) { <nl> + return a - > number > b - > number ; <nl> + } <nl> + <nl> + Status Version : : Get ( const ReadOptions & options , <nl> + const LookupKey & k , <nl> + std : : string * value , <nl> + GetStats * stats ) { <nl> + Slice ikey = k . internal_key ( ) ; <nl> + Slice user_key = k . user_key ( ) ; <nl> + const Comparator * ucmp = vset_ - > icmp_ . user_comparator ( ) ; <nl> + Status s ; <nl> + <nl> + stats - > seek_file = NULL ; <nl> + stats - > seek_file_level = - 1 ; <nl> + FileMetaData * last_file_read = NULL ; <nl> + <nl> + / / We can search level - by - level since entries never hop across <nl> + / / levels . Therefore we are guaranteed that if we find data <nl> + / / in an smaller level , later levels are irrelevant . <nl> + std : : vector < FileMetaData * > tmp ; <nl> + FileMetaData * tmp2 ; <nl> + for ( int level = 0 ; level < config : : kNumLevels ; level + + ) { <nl> + size_t num_files = files_ [ level ] . size ( ) ; <nl> + if ( num_files = = 0 ) continue ; <nl> + <nl> + / / Get the list of files to search in this level <nl> + FileMetaData * const * files = & files_ [ level ] [ 0 ] ; <nl> + if ( level = = 0 ) { <nl> + / / Level - 0 files may overlap each other . Find all files that <nl> + / / overlap user_key and process them in order from newest to oldest . <nl> + tmp . reserve ( num_files ) ; <nl> + for ( int i = 0 ; i < num_files ; i + + ) { <nl> + FileMetaData * f = files [ i ] ; <nl> + if ( ucmp - > Compare ( user_key , f - > smallest . user_key ( ) ) > = 0 & & <nl> + ucmp - > Compare ( user_key , f - > largest . user_key ( ) ) < = 0 ) { <nl> + tmp . push_back ( f ) ; <nl> + } <nl> + } <nl> + if ( tmp . empty ( ) ) continue ; <nl> + <nl> + std : : sort ( tmp . begin ( ) , tmp . end ( ) , NewestFirst ) ; <nl> + files = & tmp [ 0 ] ; <nl> + num_files = tmp . size ( ) ; <nl> + } else { <nl> + / / Binary search to find earliest index whose largest key > = ikey . <nl> + uint32_t index = FindFile ( vset_ - > icmp_ , files_ [ level ] , ikey ) ; <nl> + if ( index > = num_files ) { <nl> + files = NULL ; <nl> + num_files = 0 ; <nl> + } else { <nl> + tmp2 = files [ index ] ; <nl> + if ( ucmp - > Compare ( user_key , tmp2 - > smallest . user_key ( ) ) < 0 ) { <nl> + / / All of " tmp2 " is past any data for user_key <nl> + files = NULL ; <nl> + num_files = 0 ; <nl> + } else { <nl> + files = & tmp2 ; <nl> + num_files = 1 ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + for ( int i = 0 ; i < num_files ; + + i ) { <nl> + if ( last_file_read ! = NULL & & stats - > seek_file = = NULL ) { <nl> + / / We have had more than one seek for this read . Charge the 1st file . <nl> + stats - > seek_file = last_file_read ; <nl> + stats - > seek_file_level = ( i = = 0 ? level - 1 : level ) ; <nl> + } <nl> + <nl> + FileMetaData * f = files [ i ] ; <nl> + last_file_read = f ; <nl> + <nl> + Iterator * iter = vset_ - > table_cache_ - > NewIterator ( <nl> + options , <nl> + f - > number , <nl> + f - > file_size ) ; <nl> + iter - > Seek ( ikey ) ; <nl> + const bool done = GetValue ( iter , user_key , value , & s ) ; <nl> + if ( ! iter - > status ( ) . ok ( ) ) { <nl> + s = iter - > status ( ) ; <nl> + delete iter ; <nl> + return s ; <nl> + } else { <nl> + delete iter ; <nl> + if ( done ) { <nl> + return s ; <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + return Status : : NotFound ( Slice ( ) ) ; / / Use an empty error message for speed <nl> + } <nl> + <nl> + bool Version : : UpdateStats ( const GetStats & stats ) { <nl> + FileMetaData * f = stats . seek_file ; <nl> + if ( f ! = NULL ) { <nl> + f - > allowed_seeks - - ; <nl> + if ( f - > allowed_seeks < = 0 & & file_to_compact_ = = NULL ) { <nl> + file_to_compact_ = f ; <nl> + file_to_compact_level_ = stats . seek_file_level ; <nl> + return true ; <nl> + } <nl> + } <nl> + return false ; <nl> + } <nl> + <nl> void Version : : Ref ( ) { <nl> + + refs_ ; <nl> } <nl> void Version : : Unref ( ) { <nl> } <nl> } <nl> <nl> + bool Version : : OverlapInLevel ( int level , <nl> + const InternalKey & smallest , <nl> + const InternalKey & largest ) { <nl> + return SomeFileOverlapsRange ( vset_ - > icmp_ , files_ [ level ] , smallest , largest ) ; <nl> + } <nl> + <nl> std : : string Version : : DebugString ( ) const { <nl> std : : string r ; <nl> for ( int level = 0 ; level < config : : kNumLevels ; level + + ) { <nl> - / / E . g . , level 1 : 17 : 123 [ ' a ' . . ' d ' ] 20 : 43 [ ' e ' . . ' g ' ] <nl> - r . append ( " level " ) ; <nl> + / / E . g . , <nl> + / / mmm level 1 mmm <nl> + / / 17 : 123 [ ' a ' . . ' d ' ] <nl> + / / 20 : 43 [ ' e ' . . ' g ' ] <nl> + r . append ( " mmm level " ) ; <nl> AppendNumberTo ( & r , level ) ; <nl> - r . push_back ( ' : ' ) ; <nl> + r . append ( " mmm \ n " ) ; <nl> const std : : vector < FileMetaData * > & files = files_ [ level ] ; <nl> for ( size_t i = 0 ; i < files . size ( ) ; i + + ) { <nl> r . push_back ( ' ' ) ; <nl> std : : string Version : : DebugString ( ) const { <nl> AppendEscapedStringTo ( & r , files [ i ] - > smallest . Encode ( ) ) ; <nl> r . append ( " ' . . ' " ) ; <nl> AppendEscapedStringTo ( & r , files [ i ] - > largest . Encode ( ) ) ; <nl> - r . append ( " ' ] " ) ; <nl> + r . append ( " ' ] \ n " ) ; <nl> } <nl> - r . push_back ( ' \ n ' ) ; <nl> } <nl> return r ; <nl> } <nl> class VersionSet : : Builder { <nl> const int level = edit - > new_files_ [ i ] . first ; <nl> FileMetaData * f = new FileMetaData ( edit - > new_files_ [ i ] . second ) ; <nl> f - > refs = 1 ; <nl> + <nl> + / / We arrange to automatically compact this file after <nl> + / / a certain number of seeks . Let ' s assume : <nl> + / / ( 1 ) One seek costs 10ms <nl> + / / ( 2 ) Writing or reading 1MB costs 10ms ( 100MB / s ) <nl> + / / ( 3 ) A compaction of 1MB does 25MB of IO : <nl> + / / 1MB read from this level <nl> + / / 10 - 12MB read from next level ( boundaries may be misaligned ) <nl> + / / 10 - 12MB written to next level <nl> + / / This implies that 25 seeks cost the same as the compaction <nl> + / / of 1MB of data . I . e . , one seek costs approximately the <nl> + / / same as the compaction of 40KB of data . We are a little <nl> + / / conservative and allow approximately one seek for every 16KB <nl> + / / of data before triggering a compaction . <nl> + f - > allowed_seeks = ( f - > file_size / 16384 ) ; <nl> + if ( f - > allowed_seeks < 100 ) f - > allowed_seeks = 100 ; <nl> + <nl> levels_ [ level ] . deleted_files . erase ( f - > number ) ; <nl> levels_ [ level ] . added_files - > insert ( f ) ; <nl> } <nl> class VersionSet : : Builder { <nl> if ( levels_ [ level ] . deleted_files . count ( f - > number ) > 0 ) { <nl> / / File is deleted : do nothing <nl> } else { <nl> + std : : vector < FileMetaData * > * files = & v - > files_ [ level ] ; <nl> + if ( level > 0 & & ! files - > empty ( ) ) { <nl> + / / Must not overlap <nl> + assert ( vset_ - > icmp_ . Compare ( ( * files ) [ files - > size ( ) - 1 ] - > largest , <nl> + f - > smallest ) < 0 ) ; <nl> + } <nl> f - > refs + + ; <nl> - v - > files_ [ level ] . push_back ( f ) ; <nl> + files - > push_back ( f ) ; <nl> } <nl> } <nl> } ; <nl> int64_t VersionSet : : NumLevelBytes ( int level ) const { <nl> int64_t VersionSet : : MaxNextLevelOverlappingBytes ( ) { <nl> int64_t result = 0 ; <nl> std : : vector < FileMetaData * > overlaps ; <nl> - for ( int level = 0 ; level < config : : kNumLevels - 1 ; level + + ) { <nl> + for ( int level = 1 ; level < config : : kNumLevels - 1 ; level + + ) { <nl> for ( size_t i = 0 ; i < current_ - > files_ [ level ] . size ( ) ; i + + ) { <nl> const FileMetaData * f = current_ - > files_ [ level ] [ i ] ; <nl> GetOverlappingInputs ( level + 1 , f - > smallest , f - > largest , & overlaps ) ; <nl> Iterator * VersionSet : : MakeInputIterator ( Compaction * c ) { <nl> } <nl> <nl> Compaction * VersionSet : : PickCompaction ( ) { <nl> - if ( ! NeedsCompaction ( ) ) { <nl> + Compaction * c ; <nl> + int level ; <nl> + <nl> + / / We prefer compactions triggered by too much data in a level over <nl> + / / the compactions triggered by seeks . <nl> + const bool size_compaction = ( current_ - > compaction_score_ > = 1 ) ; <nl> + const bool seek_compaction = ( current_ - > file_to_compact_ ! = NULL ) ; <nl> + if ( size_compaction ) { <nl> + level = current_ - > compaction_level_ ; <nl> + assert ( level > = 0 ) ; <nl> + assert ( level + 1 < config : : kNumLevels ) ; <nl> + c = new Compaction ( level ) ; <nl> + <nl> + / / Pick the first file that comes after compact_pointer_ [ level ] <nl> + for ( size_t i = 0 ; i < current_ - > files_ [ level ] . size ( ) ; i + + ) { <nl> + FileMetaData * f = current_ - > files_ [ level ] [ i ] ; <nl> + if ( compact_pointer_ [ level ] . empty ( ) | | <nl> + icmp_ . Compare ( f - > largest . Encode ( ) , compact_pointer_ [ level ] ) > 0 ) { <nl> + c - > inputs_ [ 0 ] . push_back ( f ) ; <nl> + break ; <nl> + } <nl> + } <nl> + if ( c - > inputs_ [ 0 ] . empty ( ) ) { <nl> + / / Wrap - around to the beginning of the key space <nl> + c - > inputs_ [ 0 ] . push_back ( current_ - > files_ [ level ] [ 0 ] ) ; <nl> + } <nl> + } else if ( seek_compaction ) { <nl> + level = current_ - > file_to_compact_level_ ; <nl> + c = new Compaction ( level ) ; <nl> + c - > inputs_ [ 0 ] . push_back ( current_ - > file_to_compact_ ) ; <nl> + } else { <nl> return NULL ; <nl> } <nl> - const int level = current_ - > compaction_level_ ; <nl> - assert ( level > = 0 ) ; <nl> - assert ( level + 1 < config : : kNumLevels ) ; <nl> <nl> - Compaction * c = new Compaction ( level ) ; <nl> c - > input_version_ = current_ ; <nl> c - > input_version_ - > Ref ( ) ; <nl> <nl> - / / Pick the first file that comes after compact_pointer_ [ level ] <nl> - for ( size_t i = 0 ; i < current_ - > files_ [ level ] . size ( ) ; i + + ) { <nl> - FileMetaData * f = current_ - > files_ [ level ] [ i ] ; <nl> - if ( compact_pointer_ [ level ] . empty ( ) | | <nl> - icmp_ . Compare ( f - > largest . Encode ( ) , compact_pointer_ [ level ] ) > 0 ) { <nl> - c - > inputs_ [ 0 ] . push_back ( f ) ; <nl> - break ; <nl> - } <nl> - } <nl> - if ( c - > inputs_ [ 0 ] . empty ( ) ) { <nl> - / / Wrap - around to the beginning of the key space <nl> - c - > inputs_ [ 0 ] . push_back ( current_ - > files_ [ level ] [ 0 ] ) ; <nl> - } <nl> - <nl> / / Files in level 0 may overlap each other , so pick up all overlapping ones <nl> if ( level = = 0 ) { <nl> InternalKey smallest , largest ; <nl> mmm a / db / version_set . h <nl> ppp b / db / version_set . h <nl> class Version ; <nl> class VersionSet ; <nl> class WritableFile ; <nl> <nl> + / / Return the smallest index i such that files [ i ] - > largest > = key . <nl> + / / Return files . size ( ) if there is no such file . <nl> + / / REQUIRES : " files " contains a sorted list of non - overlapping files . <nl> + extern int FindFile ( const InternalKeyComparator & icmp , <nl> + const std : : vector < FileMetaData * > & files , <nl> + const Slice & key ) ; <nl> + <nl> + / / Returns true iff some file in " files " overlaps some part of <nl> + / / [ smallest , largest ] . <nl> + extern bool SomeFileOverlapsRange ( <nl> + const InternalKeyComparator & icmp , <nl> + const std : : vector < FileMetaData * > & files , <nl> + const InternalKey & smallest , <nl> + const InternalKey & largest ) ; <nl> + <nl> class Version { <nl> public : <nl> / / Append to * iters a sequence of iterators that will <nl> class Version { <nl> / / REQUIRES : This version has been saved ( see VersionSet : : SaveTo ) <nl> void AddIterators ( const ReadOptions & , std : : vector < Iterator * > * iters ) ; <nl> <nl> + / / Lookup the value for key . If found , store it in * val and <nl> + / / return OK . Else return a non - OK status . Fills * stats . <nl> + / / REQUIRES : lock is not held <nl> + struct GetStats { <nl> + FileMetaData * seek_file ; <nl> + int seek_file_level ; <nl> + } ; <nl> + Status Get ( const ReadOptions & , const LookupKey & key , std : : string * val , <nl> + GetStats * stats ) ; <nl> + <nl> + / / Adds " stats " into the current state . Returns true if a new <nl> + / / compaction may need to be triggered , false otherwise . <nl> + / / REQUIRES : lock is held <nl> + bool UpdateStats ( const GetStats & stats ) ; <nl> + <nl> / / Reference count management ( so Versions do not disappear out from <nl> / / under live iterators ) <nl> void Ref ( ) ; <nl> void Unref ( ) ; <nl> <nl> + / / Returns true iff some file in the specified level overlaps <nl> + / / some part of [ smallest , largest ] . <nl> + bool OverlapInLevel ( int level , <nl> + const InternalKey & smallest , <nl> + const InternalKey & largest ) ; <nl> + <nl> + int NumFiles ( int level ) const { return files_ [ level ] . size ( ) ; } <nl> + <nl> / / Return a human readable string that describes this version ' s contents . <nl> std : : string DebugString ( ) const ; <nl> <nl> class Version { <nl> / / List of files per level <nl> std : : vector < FileMetaData * > files_ [ config : : kNumLevels ] ; <nl> <nl> + / / Next file to compact based on seek stats . <nl> + FileMetaData * file_to_compact_ ; <nl> + int file_to_compact_level_ ; <nl> + <nl> / / Level that should be compacted next and its compaction score . <nl> / / Score < 1 means compaction is not strictly needed . These fields <nl> / / are initialized by Finalize ( ) . <nl> class Version { <nl> <nl> explicit Version ( VersionSet * vset ) <nl> : vset_ ( vset ) , next_ ( this ) , prev_ ( this ) , refs_ ( 0 ) , <nl> + file_to_compact_ ( NULL ) , <nl> + file_to_compact_level_ ( - 1 ) , <nl> compaction_score_ ( - 1 ) , <nl> compaction_level_ ( - 1 ) { <nl> } <nl> class VersionSet { <nl> Iterator * MakeInputIterator ( Compaction * c ) ; <nl> <nl> / / Returns true iff some level needs a compaction . <nl> - bool NeedsCompaction ( ) const { return current_ - > compaction_score_ > = 1 ; } <nl> + bool NeedsCompaction ( ) const { <nl> + Version * v = current_ ; <nl> + return ( v - > compaction_score_ > = 1 ) | | ( v - > file_to_compact_ ! = NULL ) ; <nl> + } <nl> <nl> / / Add all files listed in any live version to * live . <nl> / / May also mutate some internal state . <nl> mmm a / port / port_posix . h <nl> ppp b / port / port_posix . h <nl> <nl> <nl> # include < endian . h > <nl> # include < pthread . h > <nl> + # ifdef SNAPPY <nl> + # include < snappy . h > <nl> + # endif <nl> # include < stdint . h > <nl> # include < string > <nl> # include < cstdatomic > <nl> class AtomicPointer { <nl> } <nl> } ; <nl> <nl> - / / TODO ( gabor ) : Implement actual compress <nl> inline bool Snappy_Compress ( const char * input , size_t input_length , <nl> std : : string * output ) { <nl> + # ifdef SNAPPY <nl> + output - > resize ( snappy : : MaxCompressedLength ( input_length ) ) ; <nl> + size_t outlen ; <nl> + snappy : : RawCompress ( input , input_length , & ( * output ) [ 0 ] , & outlen ) ; <nl> + output - > resize ( outlen ) ; <nl> + return true ; <nl> + # endif <nl> + <nl> return false ; <nl> } <nl> <nl> - / / TODO ( gabor ) : Implement actual uncompress <nl> inline bool Snappy_Uncompress ( const char * input_data , size_t input_length , <nl> std : : string * output ) { <nl> + # ifdef SNAPPY <nl> + size_t ulength ; <nl> + if ( ! snappy : : GetUncompressedLength ( input_data , ulength , & ulength ) ) { <nl> + return false ; <nl> + } <nl> + output - > resize ( ulength ) ; <nl> + return snappy : : RawUncompress ( input_data , input_length , & ( * output ) [ 0 ] ) ; <nl> + # endif <nl> + <nl> return false ; <nl> } <nl> <nl> mmm a / table / table_test . cc <nl> ppp b / table / table_test . cc <nl> TEST ( Harness , RandomizedLongDB ) { <nl> Test ( & rnd ) ; <nl> <nl> / / We must have created enough data to force merging <nl> - std : : string l0_files , l1_files ; <nl> - ASSERT_TRUE ( db ( ) - > GetProperty ( " leveldb . num - files - at - level0 " , & l0_files ) ) ; <nl> - ASSERT_TRUE ( db ( ) - > GetProperty ( " leveldb . num - files - at - level1 " , & l1_files ) ) ; <nl> - ASSERT_GT ( atoi ( l0_files . c_str ( ) ) + atoi ( l1_files . c_str ( ) ) , 0 ) ; <nl> - <nl> + int files = 0 ; <nl> + for ( int level = 0 ; level < config : : kNumLevels ; level + + ) { <nl> + std : : string value ; <nl> + char name [ 100 ] ; <nl> + snprintf ( name , sizeof ( name ) , " leveldb . num - files - at - level % d " , level ) ; <nl> + ASSERT_TRUE ( db ( ) - > GetProperty ( name , & value ) ) ; <nl> + files + = atoi ( value . c_str ( ) ) ; <nl> + } <nl> + ASSERT_GT ( files , 0 ) ; <nl> } <nl> <nl> class MemTableTest { } ; <nl>
A number of smaller fixes and performance improvements :
facebook/rocksdb
ccf0fcd5c2946f9228068d657a56d91af9671575
2011-06-22T02:36:45Z
mmm a / src / core / hle / service / gsp_gpu . cpp <nl> ppp b / src / core / hle / service / gsp_gpu . cpp <nl> static void FlushDataCache ( Service : : Interface * self ) { <nl> u32 size = cmd_buff [ 2 ] ; <nl> u32 process = cmd_buff [ 4 ] ; <nl> <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyFlush ( Memory : : VirtualToPhysicalAddress ( address ) , size ) ; <nl> + VideoCore : : g_renderer - > rasterizer - > InvalidateRegion ( Memory : : VirtualToPhysicalAddress ( address ) , size ) ; <nl> <nl> / / TODO ( purpasmart96 ) : Verify return header on HW <nl> <nl> static void ExecuteCommand ( const Command & command , u32 thread_id ) { <nl> <nl> / / GX request DMA - typically used for copying memory from GSP heap to VRAM <nl> case CommandId : : REQUEST_DMA : <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyPreRead ( Memory : : VirtualToPhysicalAddress ( command . dma_request . source_address ) , <nl> + VideoCore : : g_renderer - > rasterizer - > FlushRegion ( Memory : : VirtualToPhysicalAddress ( command . dma_request . source_address ) , <nl> command . dma_request . size ) ; <nl> <nl> memcpy ( Memory : : GetPointer ( command . dma_request . dest_address ) , <nl> static void ExecuteCommand ( const Command & command , u32 thread_id ) { <nl> command . dma_request . size ) ; <nl> SignalInterrupt ( InterruptId : : DMA ) ; <nl> <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyFlush ( Memory : : VirtualToPhysicalAddress ( command . dma_request . dest_address ) , <nl> + VideoCore : : g_renderer - > rasterizer - > InvalidateRegion ( Memory : : VirtualToPhysicalAddress ( command . dma_request . dest_address ) , <nl> command . dma_request . size ) ; <nl> break ; <nl> <nl> static void ExecuteCommand ( const Command & command , u32 thread_id ) { <nl> if ( region . size = = 0 ) <nl> break ; <nl> <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyFlush ( <nl> + VideoCore : : g_renderer - > rasterizer - > InvalidateRegion ( <nl> Memory : : VirtualToPhysicalAddress ( region . address ) , region . size ) ; <nl> } <nl> break ; <nl> mmm a / src / core / hle / service / y2r_u . cpp <nl> ppp b / src / core / hle / service / y2r_u . cpp <nl> static void StartConversion ( Service : : Interface * self ) { <nl> / / dst_image_size would seem to be perfect for this , but it doesn ' t include the gap : ( <nl> u32 total_output_size = conversion . input_lines * <nl> ( conversion . dst . transfer_unit + conversion . dst . gap ) ; <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyFlush ( <nl> + VideoCore : : g_renderer - > rasterizer - > InvalidateRegion ( <nl> Memory : : VirtualToPhysicalAddress ( conversion . dst . address ) , total_output_size ) ; <nl> <nl> LOG_DEBUG ( Service_Y2R , " called " ) ; <nl> mmm a / src / core / hw / gpu . cpp <nl> ppp b / src / core / hw / gpu . cpp <nl> <nl> # include " core / tracer / recorder . h " <nl> <nl> # include " video_core / command_processor . h " <nl> - # include " video_core / hwrasterizer_base . h " <nl> + # include " video_core / rasterizer_interface . h " <nl> # include " video_core / renderer_base . h " <nl> # include " video_core / utils . h " <nl> # include " video_core / video_core . h " <nl> inline void Write ( u32 addr , const T data ) { <nl> GSP_GPU : : SignalInterrupt ( GSP_GPU : : InterruptId : : PSC1 ) ; <nl> } <nl> <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyFlush ( config . GetStartAddress ( ) , config . GetEndAddress ( ) - config . GetStartAddress ( ) ) ; <nl> + VideoCore : : g_renderer - > rasterizer - > InvalidateRegion ( config . GetStartAddress ( ) , config . GetEndAddress ( ) - config . GetStartAddress ( ) ) ; <nl> } <nl> <nl> / / Reset " trigger " flag and set the " finish " flag <nl> inline void Write ( u32 addr , const T data ) { <nl> u32 output_gap = config . texture_copy . output_gap * 16 ; <nl> <nl> size_t contiguous_input_size = config . texture_copy . size / input_width * ( input_width + input_gap ) ; <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyPreRead ( config . GetPhysicalInputAddress ( ) , contiguous_input_size ) ; <nl> + VideoCore : : g_renderer - > rasterizer - > FlushRegion ( config . GetPhysicalInputAddress ( ) , contiguous_input_size ) ; <nl> <nl> u32 remaining_size = config . texture_copy . size ; <nl> u32 remaining_input = input_width ; <nl> inline void Write ( u32 addr , const T data ) { <nl> config . flags ) ; <nl> <nl> size_t contiguous_output_size = config . texture_copy . size / output_width * ( output_width + output_gap ) ; <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyFlush ( config . GetPhysicalOutputAddress ( ) , contiguous_output_size ) ; <nl> + VideoCore : : g_renderer - > rasterizer - > InvalidateRegion ( config . GetPhysicalOutputAddress ( ) , contiguous_output_size ) ; <nl> <nl> GSP_GPU : : SignalInterrupt ( GSP_GPU : : InterruptId : : PPF ) ; <nl> break ; <nl> inline void Write ( u32 addr , const T data ) { <nl> u32 input_size = config . input_width * config . input_height * GPU : : Regs : : BytesPerPixel ( config . input_format ) ; <nl> u32 output_size = output_width * output_height * GPU : : Regs : : BytesPerPixel ( config . output_format ) ; <nl> <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyPreRead ( config . GetPhysicalInputAddress ( ) , input_size ) ; <nl> + VideoCore : : g_renderer - > rasterizer - > FlushRegion ( config . GetPhysicalInputAddress ( ) , input_size ) ; <nl> <nl> for ( u32 y = 0 ; y < output_height ; + + y ) { <nl> for ( u32 x = 0 ; x < output_width ; + + x ) { <nl> inline void Write ( u32 addr , const T data ) { <nl> g_regs . display_transfer_config . trigger = 0 ; <nl> GSP_GPU : : SignalInterrupt ( GSP_GPU : : InterruptId : : PPF ) ; <nl> <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyFlush ( config . GetPhysicalOutputAddress ( ) , output_size ) ; <nl> + VideoCore : : g_renderer - > rasterizer - > InvalidateRegion ( config . GetPhysicalOutputAddress ( ) , output_size ) ; <nl> } <nl> break ; <nl> } <nl> mmm a / src / video_core / CMakeLists . txt <nl> ppp b / src / video_core / CMakeLists . txt <nl> set ( SRCS <nl> pica . cpp <nl> primitive_assembly . cpp <nl> rasterizer . cpp <nl> + renderer_base . cpp <nl> shader / shader . cpp <nl> shader / shader_interpreter . cpp <nl> + swrasterizer . cpp <nl> utils . cpp <nl> video_core . cpp <nl> ) <nl> set ( HEADERS <nl> clipper . h <nl> command_processor . h <nl> gpu_debugger . h <nl> - hwrasterizer_base . h <nl> pica . h <nl> primitive_assembly . h <nl> rasterizer . h <nl> + rasterizer_interface . h <nl> renderer_base . h <nl> shader / shader . h <nl> shader / shader_interpreter . h <nl> + swrasterizer . h <nl> utils . h <nl> video_core . h <nl> ) <nl> mmm a / src / video_core / clipper . cpp <nl> ppp b / src / video_core / clipper . cpp <nl> static void InitScreenCoordinates ( OutputVertex & vtx ) <nl> vtx . screenpos [ 2 ] = viewport . offset_z + vtx . pos . z * inv_w * viewport . zscale ; <nl> } <nl> <nl> - void ProcessTriangle ( OutputVertex & v0 , OutputVertex & v1 , OutputVertex & v2 ) { <nl> + void ProcessTriangle ( const OutputVertex & v0 , const OutputVertex & v1 , const OutputVertex & v2 ) { <nl> using boost : : container : : static_vector ; <nl> <nl> / / Clipping a planar n - gon against a plane will remove at least 1 vertex and introduces 2 at <nl> mmm a / src / video_core / clipper . h <nl> ppp b / src / video_core / clipper . h <nl> namespace Clipper { <nl> <nl> using Shader : : OutputVertex ; <nl> <nl> - void ProcessTriangle ( OutputVertex & v0 , OutputVertex & v1 , OutputVertex & v2 ) ; <nl> + void ProcessTriangle ( const OutputVertex & v0 , const OutputVertex & v1 , const OutputVertex & v2 ) ; <nl> <nl> } / / namespace <nl> <nl> mmm a / src / video_core / command_processor . cpp <nl> ppp b / src / video_core / command_processor . cpp <nl> static void WritePicaReg ( u32 id , u32 value , u32 mask ) { <nl> } <nl> } <nl> <nl> - if ( Settings : : values . use_hw_renderer ) { <nl> - / / Send to hardware renderer <nl> - static auto AddHWTriangle = [ ] ( const Pica : : Shader : : OutputVertex & v0 , <nl> - const Pica : : Shader : : OutputVertex & v1 , <nl> - const Pica : : Shader : : OutputVertex & v2 ) { <nl> - VideoCore : : g_renderer - > hw_rasterizer - > AddTriangle ( v0 , v1 , v2 ) ; <nl> - } ; <nl> - <nl> - primitive_assembler . SubmitVertex ( output , AddHWTriangle ) ; <nl> - } else { <nl> - / / Send to triangle clipper <nl> - primitive_assembler . SubmitVertex ( output , Clipper : : ProcessTriangle ) ; <nl> - } <nl> + / / Send to renderer <nl> + using Pica : : Shader : : OutputVertex ; <nl> + auto AddTriangle = [ ] ( <nl> + const OutputVertex & v0 , const OutputVertex & v1 , const OutputVertex & v2 ) { <nl> + VideoCore : : g_renderer - > rasterizer - > AddTriangle ( v0 , v1 , v2 ) ; <nl> + } ; <nl> + <nl> + primitive_assembler . SubmitVertex ( output , AddTriangle ) ; <nl> } <nl> <nl> for ( auto & range : memory_accesses . ranges ) { <nl> static void WritePicaReg ( u32 id , u32 value , u32 mask ) { <nl> range . second , range . first ) ; <nl> } <nl> <nl> - if ( Settings : : values . use_hw_renderer ) { <nl> - VideoCore : : g_renderer - > hw_rasterizer - > DrawTriangles ( ) ; <nl> - } <nl> + VideoCore : : g_renderer - > rasterizer - > DrawTriangles ( ) ; <nl> <nl> # if PICA_DUMP_GEOMETRY <nl> geometry_dumper . Dump ( ) ; <nl> static void WritePicaReg ( u32 id , u32 value , u32 mask ) { <nl> break ; <nl> } <nl> <nl> - VideoCore : : g_renderer - > hw_rasterizer - > NotifyPicaRegisterChanged ( id ) ; <nl> + VideoCore : : g_renderer - > rasterizer - > NotifyPicaRegisterChanged ( id ) ; <nl> <nl> if ( g_debug_context ) <nl> g_debug_context - > OnEvent ( DebugContext : : Event : : PicaCommandProcessed , reinterpret_cast < void * > ( & id ) ) ; <nl> mmm a / src / video_core / debug_utils / debug_utils . cpp <nl> ppp b / src / video_core / debug_utils / debug_utils . cpp <nl> void DebugContext : : OnEvent ( Event event , void * data ) { <nl> { <nl> std : : unique_lock < std : : mutex > lock ( breakpoint_mutex ) ; <nl> <nl> - if ( Settings : : values . use_hw_renderer ) { <nl> - / / Commit the hardware renderer ' s framebuffer so it will show on debug widgets <nl> - VideoCore : : g_renderer - > hw_rasterizer - > CommitFramebuffer ( ) ; <nl> - } <nl> + / / Commit the hardware renderer ' s framebuffer so it will show on debug widgets <nl> + VideoCore : : g_renderer - > rasterizer - > FlushFramebuffer ( ) ; <nl> <nl> / / TODO : Should stop the CPU thread here once we multithread emulation . <nl> <nl> similarity index 69 % <nl> rename from src / video_core / hwrasterizer_base . h <nl> rename to src / video_core / rasterizer_interface . h <nl> mmm a / src / video_core / hwrasterizer_base . h <nl> ppp b / src / video_core / rasterizer_interface . h <nl> struct OutputVertex ; <nl> } <nl> } <nl> <nl> - class HWRasterizer { <nl> + namespace VideoCore { <nl> + <nl> + class RasterizerInterface { <nl> public : <nl> - virtual ~ HWRasterizer ( ) { <nl> - } <nl> + virtual ~ RasterizerInterface ( ) { } <nl> <nl> / / / Initialize API - specific GPU objects <nl> virtual void InitObjects ( ) = 0 ; <nl> class HWRasterizer { <nl> virtual void DrawTriangles ( ) = 0 ; <nl> <nl> / / / Commit the rasterizer ' s framebuffer contents immediately to the current 3DS memory framebuffer <nl> - virtual void CommitFramebuffer ( ) = 0 ; <nl> + virtual void FlushFramebuffer ( ) = 0 ; <nl> <nl> / / / Notify rasterizer that the specified PICA register has been changed <nl> virtual void NotifyPicaRegisterChanged ( u32 id ) = 0 ; <nl> <nl> - / / / Notify rasterizer that the specified 3DS memory region will be read from after this notification <nl> - virtual void NotifyPreRead ( PAddr addr , u32 size ) = 0 ; <nl> + / / / Notify rasterizer that any caches of the specified region should be flushed to 3DS memory . <nl> + virtual void FlushRegion ( PAddr addr , u32 size ) = 0 ; <nl> <nl> - / / / Notify rasterizer that a 3DS memory region has been changed <nl> - virtual void NotifyFlush ( PAddr addr , u32 size ) = 0 ; <nl> + / / / Notify rasterizer that any caches of the specified region should be discraded and reloaded from 3DS memory . <nl> + virtual void InvalidateRegion ( PAddr addr , u32 size ) = 0 ; <nl> } ; <nl> + <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . 93e980216a1 <nl> mmm / dev / null <nl> ppp b / src / video_core / renderer_base . cpp <nl> <nl> + / / Copyright 2015 Citra Emulator Project <nl> + / / Licensed under GPLv2 or any later version <nl> + / / Refer to the license . txt file included . <nl> + <nl> + # include < memory > <nl> + <nl> + # include " common / make_unique . h " <nl> + <nl> + # include " core / settings . h " <nl> + <nl> + # include " video_core / renderer_base . h " <nl> + # include " video_core / video_core . h " <nl> + # include " video_core / swrasterizer . h " <nl> + # include " video_core / renderer_opengl / gl_rasterizer . h " <nl> + <nl> + void RendererBase : : RefreshRasterizerSetting ( ) { <nl> + bool hw_renderer_enabled = VideoCore : : g_hw_renderer_enabled ; <nl> + if ( rasterizer = = nullptr | | opengl_rasterizer_active ! = hw_renderer_enabled ) { <nl> + opengl_rasterizer_active = hw_renderer_enabled ; <nl> + <nl> + if ( hw_renderer_enabled ) { <nl> + rasterizer = Common : : make_unique < RasterizerOpenGL > ( ) ; <nl> + } else { <nl> + rasterizer = Common : : make_unique < VideoCore : : SWRasterizer > ( ) ; <nl> + } <nl> + rasterizer - > InitObjects ( ) ; <nl> + } <nl> + } <nl> mmm a / src / video_core / renderer_base . h <nl> ppp b / src / video_core / renderer_base . h <nl> <nl> <nl> # include " common / common_types . h " <nl> <nl> - # include " video_core / hwrasterizer_base . h " <nl> + # include " video_core / rasterizer_interface . h " <nl> <nl> class EmuWindow ; <nl> <nl> class RendererBase : NonCopyable { <nl> return m_current_frame ; <nl> } <nl> <nl> - std : : unique_ptr < HWRasterizer > hw_rasterizer ; <nl> + void RefreshRasterizerSetting ( ) ; <nl> + <nl> + std : : unique_ptr < VideoCore : : RasterizerInterface > rasterizer ; <nl> <nl> protected : <nl> f32 m_current_fps ; / / / < Current framerate , should be set by the renderer <nl> int m_current_frame ; / / / < Current frame , should be set by the renderer <nl> <nl> + private : <nl> + bool opengl_rasterizer_active = false ; <nl> } ; <nl> mmm a / src / video_core / renderer_opengl / gl_rasterizer . cpp <nl> ppp b / src / video_core / renderer_opengl / gl_rasterizer . cpp <nl> void RasterizerOpenGL : : Reset ( ) { <nl> <nl> SetShader ( ) ; <nl> <nl> - res_cache . FullFlush ( ) ; <nl> + res_cache . InvalidateAll ( ) ; <nl> } <nl> <nl> void RasterizerOpenGL : : AddTriangle ( const Pica : : Shader : : OutputVertex & v0 , <nl> void RasterizerOpenGL : : DrawTriangles ( ) { <nl> u32 cur_fb_depth_size = Pica : : Regs : : BytesPerDepthPixel ( regs . framebuffer . depth_format ) <nl> * regs . framebuffer . GetWidth ( ) * regs . framebuffer . GetHeight ( ) ; <nl> <nl> - res_cache . NotifyFlush ( cur_fb_color_addr , cur_fb_color_size , true ) ; <nl> - res_cache . NotifyFlush ( cur_fb_depth_addr , cur_fb_depth_size , true ) ; <nl> + res_cache . InvalidateInRange ( cur_fb_color_addr , cur_fb_color_size , true ) ; <nl> + res_cache . InvalidateInRange ( cur_fb_depth_addr , cur_fb_depth_size , true ) ; <nl> } <nl> <nl> - void RasterizerOpenGL : : CommitFramebuffer ( ) { <nl> + void RasterizerOpenGL : : FlushFramebuffer ( ) { <nl> CommitColorBuffer ( ) ; <nl> CommitDepthBuffer ( ) ; <nl> } <nl> void RasterizerOpenGL : : CommitFramebuffer ( ) { <nl> void RasterizerOpenGL : : NotifyPicaRegisterChanged ( u32 id ) { <nl> const auto & regs = Pica : : g_state . regs ; <nl> <nl> - if ( ! Settings : : values . use_hw_renderer ) <nl> - return ; <nl> - <nl> switch ( id ) { <nl> / / Culling <nl> case PICA_REG_INDEX ( cull_mode ) : <nl> void RasterizerOpenGL : : NotifyPicaRegisterChanged ( u32 id ) { <nl> } <nl> } <nl> <nl> - void RasterizerOpenGL : : NotifyPreRead ( PAddr addr , u32 size ) { <nl> + void RasterizerOpenGL : : FlushRegion ( PAddr addr , u32 size ) { <nl> const auto & regs = Pica : : g_state . regs ; <nl> <nl> - if ( ! Settings : : values . use_hw_renderer ) <nl> - return ; <nl> - <nl> PAddr cur_fb_color_addr = regs . framebuffer . GetColorBufferPhysicalAddress ( ) ; <nl> u32 cur_fb_color_size = Pica : : Regs : : BytesPerColorPixel ( regs . framebuffer . color_format ) <nl> * regs . framebuffer . GetWidth ( ) * regs . framebuffer . GetHeight ( ) ; <nl> void RasterizerOpenGL : : NotifyPreRead ( PAddr addr , u32 size ) { <nl> CommitDepthBuffer ( ) ; <nl> } <nl> <nl> - void RasterizerOpenGL : : NotifyFlush ( PAddr addr , u32 size ) { <nl> + void RasterizerOpenGL : : InvalidateRegion ( PAddr addr , u32 size ) { <nl> const auto & regs = Pica : : g_state . regs ; <nl> <nl> - if ( ! Settings : : values . use_hw_renderer ) <nl> - return ; <nl> - <nl> PAddr cur_fb_color_addr = regs . framebuffer . GetColorBufferPhysicalAddress ( ) ; <nl> u32 cur_fb_color_size = Pica : : Regs : : BytesPerColorPixel ( regs . framebuffer . color_format ) <nl> * regs . framebuffer . GetWidth ( ) * regs . framebuffer . GetHeight ( ) ; <nl> void RasterizerOpenGL : : NotifyFlush ( PAddr addr , u32 size ) { <nl> ReloadDepthBuffer ( ) ; <nl> <nl> / / Notify cache of flush in case the region touches a cached resource <nl> - res_cache . NotifyFlush ( addr , size ) ; <nl> + res_cache . InvalidateInRange ( addr , size ) ; <nl> } <nl> <nl> void RasterizerOpenGL : : SamplerInfo : : Create ( ) { <nl> mmm a / src / video_core / renderer_opengl / gl_rasterizer . h <nl> ppp b / src / video_core / renderer_opengl / gl_rasterizer . h <nl> <nl> # include " common / hash . h " <nl> <nl> # include " video_core / pica . h " <nl> - # include " video_core / hwrasterizer_base . h " <nl> + # include " video_core / rasterizer_interface . h " <nl> # include " video_core / renderer_opengl / gl_rasterizer_cache . h " <nl> # include " video_core / renderer_opengl / gl_state . h " <nl> # include " video_core / shader / shader_interpreter . h " <nl> struct hash < PicaShaderConfig > { <nl> <nl> } / / namespace std <nl> <nl> - class RasterizerOpenGL : public HWRasterizer { <nl> + class RasterizerOpenGL : public VideoCore : : RasterizerInterface { <nl> public : <nl> <nl> RasterizerOpenGL ( ) ; <nl> ~ RasterizerOpenGL ( ) override ; <nl> <nl> - / / / Initialize API - specific GPU objects <nl> void InitObjects ( ) override ; <nl> - <nl> - / / / Reset the rasterizer , such as flushing all caches and updating all state <nl> void Reset ( ) override ; <nl> - <nl> - / / / Queues the primitive formed by the given vertices for rendering <nl> void AddTriangle ( const Pica : : Shader : : OutputVertex & v0 , <nl> const Pica : : Shader : : OutputVertex & v1 , <nl> const Pica : : Shader : : OutputVertex & v2 ) override ; <nl> - <nl> - / / / Draw the current batch of triangles <nl> void DrawTriangles ( ) override ; <nl> - <nl> - / / / Commit the rasterizer ' s framebuffer contents immediately to the current 3DS memory framebuffer <nl> - void CommitFramebuffer ( ) override ; <nl> - <nl> - / / / Notify rasterizer that the specified PICA register has been changed <nl> + void FlushFramebuffer ( ) override ; <nl> void NotifyPicaRegisterChanged ( u32 id ) override ; <nl> - <nl> - / / / Notify rasterizer that the specified 3DS memory region will be read from after this notification <nl> - void NotifyPreRead ( PAddr addr , u32 size ) override ; <nl> - <nl> - / / / Notify rasterizer that a 3DS memory region has been changed <nl> - void NotifyFlush ( PAddr addr , u32 size ) override ; <nl> + void FlushRegion ( PAddr addr , u32 size ) override ; <nl> + void InvalidateRegion ( PAddr addr , u32 size ) override ; <nl> <nl> / / / OpenGL shader generated for a given Pica register state <nl> struct PicaShader { <nl> mmm a / src / video_core / renderer_opengl / gl_rasterizer_cache . cpp <nl> ppp b / src / video_core / renderer_opengl / gl_rasterizer_cache . cpp <nl> <nl> # include " video_core / renderer_opengl / pica_to_gl . h " <nl> <nl> RasterizerCacheOpenGL : : ~ RasterizerCacheOpenGL ( ) { <nl> - FullFlush ( ) ; <nl> + InvalidateAll ( ) ; <nl> } <nl> <nl> MICROPROFILE_DEFINE ( OpenGL_TextureUpload , " OpenGL " , " Texture Upload " , MP_RGB ( 128 , 64 , 192 ) ) ; <nl> void RasterizerCacheOpenGL : : LoadAndBindTexture ( OpenGLState & state , unsigned text <nl> } <nl> } <nl> <nl> - void RasterizerCacheOpenGL : : NotifyFlush ( PAddr addr , u32 size , bool ignore_hash ) { <nl> - / / Flush any texture that falls in the flushed region <nl> + void RasterizerCacheOpenGL : : InvalidateInRange ( PAddr addr , u32 size , bool ignore_hash ) { <nl> / / TODO : Optimize by also inserting upper bound ( addr + size ) of each texture into the same map and also narrow using lower_bound <nl> auto cache_upper_bound = texture_cache . upper_bound ( addr + size ) ; <nl> <nl> void RasterizerCacheOpenGL : : NotifyFlush ( PAddr addr , u32 size , bool ignore_hash ) <nl> } <nl> } <nl> <nl> - void RasterizerCacheOpenGL : : FullFlush ( ) { <nl> + void RasterizerCacheOpenGL : : InvalidateAll ( ) { <nl> texture_cache . clear ( ) ; <nl> } <nl> mmm a / src / video_core / renderer_opengl / gl_rasterizer_cache . h <nl> ppp b / src / video_core / renderer_opengl / gl_rasterizer_cache . h <nl> class RasterizerCacheOpenGL : NonCopyable { <nl> LoadAndBindTexture ( state , texture_unit , Pica : : DebugUtils : : TextureInfo : : FromPicaRegister ( config . config , config . format ) ) ; <nl> } <nl> <nl> - / / / Flush any cached resource that touches the flushed region <nl> - void NotifyFlush ( PAddr addr , u32 size , bool ignore_hash = false ) ; <nl> + / / / Invalidate any cached resource intersecting the specified region . <nl> + void InvalidateInRange ( PAddr addr , u32 size , bool ignore_hash = false ) ; <nl> <nl> - / / / Flush all cached OpenGL resources tracked by this cache manager <nl> - void FullFlush ( ) ; <nl> + / / / Invalidate all cached OpenGL resources tracked by this cache manager <nl> + void InvalidateAll ( ) ; <nl> <nl> private : <nl> struct CachedTexture { <nl> mmm a / src / video_core / renderer_opengl / renderer_opengl . cpp <nl> ppp b / src / video_core / renderer_opengl / renderer_opengl . cpp <nl> static std : : array < GLfloat , 3 * 2 > MakeOrthographicMatrix ( const float width , const <nl> <nl> / / / RendererOpenGL constructor <nl> RendererOpenGL : : RendererOpenGL ( ) { <nl> - hw_rasterizer . reset ( new RasterizerOpenGL ( ) ) ; <nl> resolution_width = std : : max ( VideoCore : : kScreenTopWidth , VideoCore : : kScreenBottomWidth ) ; <nl> resolution_height = VideoCore : : kScreenTopHeight + VideoCore : : kScreenBottomHeight ; <nl> } <nl> void RendererOpenGL : : SwapBuffers ( ) { <nl> <nl> profiler . BeginFrame ( ) ; <nl> <nl> - bool hw_renderer_enabled = VideoCore : : g_hw_renderer_enabled ; <nl> - if ( Settings : : values . use_hw_renderer ! = hw_renderer_enabled ) { <nl> - / / TODO : Save new setting value to config file for next startup <nl> - Settings : : values . use_hw_renderer = hw_renderer_enabled ; <nl> - <nl> - if ( Settings : : values . use_hw_renderer ) { <nl> - hw_rasterizer - > Reset ( ) ; <nl> - } <nl> - } <nl> + RefreshRasterizerSetting ( ) ; <nl> <nl> if ( Pica : : g_debug_context & & Pica : : g_debug_context - > recorder ) { <nl> Pica : : g_debug_context - > recorder - > FrameFinished ( ) ; <nl> void RendererOpenGL : : InitOpenGLObjects ( ) { <nl> <nl> state . texture_units [ 0 ] . texture_2d = 0 ; <nl> state . Apply ( ) ; <nl> - <nl> - hw_rasterizer - > InitObjects ( ) ; <nl> } <nl> <nl> void RendererOpenGL : : ConfigureFramebufferTexture ( TextureInfo & texture , <nl> void RendererOpenGL : : Init ( ) { <nl> LOG_INFO ( Render_OpenGL , " GL_VENDOR : % s " , glGetString ( GL_VENDOR ) ) ; <nl> LOG_INFO ( Render_OpenGL , " GL_RENDERER : % s " , glGetString ( GL_RENDERER ) ) ; <nl> InitOpenGLObjects ( ) ; <nl> + <nl> + RefreshRasterizerSetting ( ) ; <nl> } <nl> <nl> / / / Shutdown the renderer <nl> new file mode 100644 <nl> index 00000000000 . . 03df15b0135 <nl> mmm / dev / null <nl> ppp b / src / video_core / swrasterizer . cpp <nl> <nl> + / / Copyright 2015 Citra Emulator Project <nl> + / / Licensed under GPLv2 or any later version <nl> + / / Refer to the license . txt file included . <nl> + <nl> + # include " video_core / clipper . h " <nl> + # include " video_core / swrasterizer . h " <nl> + <nl> + namespace VideoCore { <nl> + <nl> + void SWRasterizer : : AddTriangle ( const Pica : : Shader : : OutputVertex & v0 , <nl> + const Pica : : Shader : : OutputVertex & v1 , <nl> + const Pica : : Shader : : OutputVertex & v2 ) { <nl> + Pica : : Clipper : : ProcessTriangle ( v0 , v1 , v2 ) ; <nl> + } <nl> + <nl> + } <nl> new file mode 100644 <nl> index 00000000000 . . e9a4e39c6e5 <nl> mmm / dev / null <nl> ppp b / src / video_core / swrasterizer . h <nl> <nl> + / / Copyright 2015 Citra Emulator Project <nl> + / / Licensed under GPLv2 or any later version <nl> + / / Refer to the license . txt file included . <nl> + <nl> + # pragma once <nl> + <nl> + # include " common / common_types . h " <nl> + <nl> + # include " video_core / rasterizer_interface . h " <nl> + <nl> + namespace VideoCore { <nl> + <nl> + class SWRasterizer : public RasterizerInterface { <nl> + void InitObjects ( ) override { } <nl> + void Reset ( ) override { } <nl> + void AddTriangle ( const Pica : : Shader : : OutputVertex & v0 , <nl> + const Pica : : Shader : : OutputVertex & v1 , <nl> + const Pica : : Shader : : OutputVertex & v2 ) ; <nl> + void DrawTriangles ( ) override { } <nl> + void FlushFramebuffer ( ) override { } <nl> + void NotifyPicaRegisterChanged ( u32 id ) override { } <nl> + void FlushRegion ( PAddr addr , u32 size ) override { } <nl> + void InvalidateRegion ( PAddr addr , u32 size ) override { } <nl> + } ; <nl> + <nl> + } <nl>
Merge pull request from yuriks / merge - rasterizer
yuzu-emu/yuzu
31764c48fb8f78b998b6627ef4ea4f1b2ec83903
2015-12-08T04:21:06Z
mmm a / tensorflow / BUILD <nl> ppp b / tensorflow / BUILD <nl> filegroup ( <nl> " / / tensorflow / contrib / framework : all_files " , <nl> " / / tensorflow / contrib / graph_editor : all_files " , <nl> " / / tensorflow / contrib / grid_rnn : all_files " , <nl> + " / / tensorflow / contrib / hooks : all_files " , <nl> " / / tensorflow / contrib / image : all_files " , <nl> " / / tensorflow / contrib / input_pipeline : all_files " , <nl> " / / tensorflow / contrib / input_pipeline / kernels : all_files " , <nl> mmm a / tensorflow / contrib / BUILD <nl> ppp b / tensorflow / contrib / BUILD <nl> py_library ( <nl> " / / tensorflow / contrib / framework : framework_py " , <nl> " / / tensorflow / contrib / graph_editor : graph_editor_py " , <nl> " / / tensorflow / contrib / grid_rnn : grid_rnn_py " , <nl> + " / / tensorflow / contrib / hooks " , <nl> " / / tensorflow / contrib / image : image_py " , <nl> " / / tensorflow / contrib / input_pipeline : input_pipeline_py " , <nl> " / / tensorflow / contrib / integrate : integrate_py " , <nl> mmm a / tensorflow / contrib / cmake / tf_python . cmake <nl> ppp b / tensorflow / contrib / cmake / tf_python . cmake <nl> add_python_module ( " tensorflow / contrib / grid_rnn " ) <nl> add_python_module ( " tensorflow / contrib / grid_rnn / python " ) <nl> add_python_module ( " tensorflow / contrib / grid_rnn / python / kernel_tests " ) <nl> add_python_module ( " tensorflow / contrib / grid_rnn / python / ops " ) <nl> + add_python_module ( " tensorflow / contrib / hooks " ) <nl> add_python_module ( " tensorflow / contrib / image " ) <nl> add_python_module ( " tensorflow / contrib / image / python " ) <nl> add_python_module ( " tensorflow / contrib / image / python / ops " ) <nl> new file mode 100644 <nl> index 0000000000000 . . 25eccab69e23e <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hooks / BUILD <nl> <nl> + # Description : <nl> + # Contains ` SessionRunHook ` s for use with ` MonitoredSession ` and the <nl> + # wrappers around it . <nl> + <nl> + licenses ( [ " notice " ] ) # Apache 2 . 0 <nl> + <nl> + exports_files ( [ " LICENSE " ] ) <nl> + <nl> + package ( default_visibility = [ " / / tensorflow : __subpackages__ " ] ) <nl> + <nl> + py_library ( <nl> + name = " hooks " , <nl> + srcs = [ <nl> + " __init__ . py " , <nl> + " python / training / __init__ . py " , <nl> + " python / training / profiler_hook . py " , <nl> + ] , <nl> + srcs_version = " PY2AND3 " , <nl> + deps = [ <nl> + " / / tensorflow / contrib / framework : framework_py " , <nl> + " / / tensorflow / python : framework " , <nl> + " / / tensorflow / python : framework_for_generated_wrappers " , <nl> + " / / tensorflow / python : state_ops " , <nl> + " / / tensorflow / python : training " , <nl> + " / / tensorflow / python : variables " , <nl> + ] , <nl> + ) <nl> + <nl> + py_test ( <nl> + name = " profiler_hook_test " , <nl> + size = " small " , <nl> + srcs = [ " python / training / profiler_hook_test . py " ] , <nl> + srcs_version = " PY2AND3 " , <nl> + deps = [ <nl> + " : hooks " , <nl> + " / / tensorflow / python : client_testlib " , <nl> + " / / tensorflow / python : framework_for_generated_wrappers " , <nl> + " / / tensorflow / python : framework_test_lib " , <nl> + " / / tensorflow / python : platform_test " , <nl> + ] , <nl> + ) <nl> + <nl> + filegroup ( <nl> + name = " all_files " , <nl> + srcs = glob ( <nl> + [ " * * / * " ] , <nl> + exclude = [ <nl> + " * * / METADATA " , <nl> + " * * / OWNERS " , <nl> + ] , <nl> + ) , <nl> + ) <nl> new file mode 100644 <nl> index 0000000000000 . . c7f88bb1113f0 <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hooks / README . md <nl> <nl> + # TensorFlow Experimental SessionRunHooks <nl> + <nl> + These hooks complement those in tensorflow / python / training . They are instances <nl> + of ` SessionRunHook ` and are to be used with helpers like ` MonitoredSession ` <nl> + and ` learn . Estimator ` that wrap ` tensorflow . Session ` . <nl> + <nl> + The hooks are called between invocations of ` Session . run ( ) ` to perform custom <nl> + behaviour . <nl> + <nl> + For example the ` ProfilerHook ` periodically collects ` RunMetadata ` after <nl> + ` Session . run ( ) ` and saves profiling information that can be viewed in a <nl> + neat timeline through a Chromium - based web browser ( via <nl> + [ about : tracing ] ( chrome : / / tracing ) ) or the standalone [ Catapult ] ( https : / / github . com / catapult - project / catapult / blob / master / tracing / README . md ) tool . <nl> + <nl> + ` ` ` python <nl> + from tensorflow . contrib . hooks import ProfilerHook <nl> + <nl> + hooks = [ ProfilerHook ( save_secs = 30 , output_dir = " profiling " ) ] <nl> + with SingularMonitoredSession ( hooks = hooks ) as sess : <nl> + while not sess . should_stop ( ) : <nl> + sess . run ( some_op ) <nl> + ` ` ` <nl> + <nl> + Or similarly with contrib . learn : <nl> + <nl> + ` ` ` python <nl> + hooks = [ ProfilerHook ( save_steps = 10 , output_dir = " profiling " ) ] <nl> + estimator = learn . Estimator ( . . . ) <nl> + estimator . fit ( input_fn , monitors = hooks ) <nl> + ` ` ` <nl> new file mode 100644 <nl> index 0000000000000 . . 4b7319f843daf <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hooks / __init__ . py <nl> <nl> + # Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + " " " hooks : A module containing ` SessionRunHook ` s for use with ` MonitoredSession ` . <nl> + <nl> + @ @ ProfilerHook <nl> + " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + # pylint : disable = wildcard - import <nl> + from tensorflow . contrib . hooks . python . training import * <nl> + # pylint : enable = wildcard - import <nl> + <nl> + from tensorflow . python . util . all_util import remove_undocumented <nl> + <nl> + _allowed_symbols = [ ' ProfilerHook ' ] <nl> + <nl> + remove_undocumented ( __name__ , _allowed_symbols ) <nl> new file mode 100644 <nl> index 0000000000000 . . 8f9c49896e930 <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hooks / python / __init__ . py <nl> <nl> + # Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + <nl> + " " " Experimental ` SessionRunHooks ` for use with ` MonitoredSession ` . " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + # pylint : disable = wildcard - import <nl> + from tensorflow . contrib . hooks . python . training import * <nl> + # pylint : enable = wildcard - import <nl> new file mode 100644 <nl> index 0000000000000 . . cc4726497f8bd <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hooks / python / training / __init__ . py <nl> <nl> + # Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + " " " hooks : A module containing ` SessionRunHook ` s for use with ` MonitoredSession ` . <nl> + " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + from tensorflow . contrib . hooks . python . training . profiler_hook import ProfilerHook <nl> new file mode 100644 <nl> index 0000000000000 . . 35aa25edfde6f <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hooks / python / training / profiler_hook . py <nl> <nl> + # Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + " " " Additional ` SessionRunHook ` implementations to complement those in <nl> + tensorflow / python / training . <nl> + <nl> + " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + import os . path <nl> + <nl> + from tensorflow . core . protobuf import config_pb2 <nl> + from tensorflow . python . client import timeline <nl> + from tensorflow . python . platform import gfile <nl> + from tensorflow . python . platform import tf_logging as logging <nl> + from tensorflow . python . training . basic_session_run_hooks import SecondOrStepTimer <nl> + from tensorflow . python . training . session_run_hook import SessionRunArgs <nl> + from tensorflow . python . training import session_run_hook <nl> + from tensorflow . python . training import training_util <nl> + <nl> + <nl> + class ProfilerHook ( session_run_hook . SessionRunHook ) : <nl> + " " " Captures CPU / GPU profiling information every N steps or seconds . <nl> + <nl> + This produces files called " timeline - < step > . json " , which are in Chrome <nl> + Trace format . <nl> + <nl> + For more information see : <nl> + https : / / github . com / catapult - project / catapult / blob / master / tracing / README . md " " " <nl> + <nl> + def __init__ ( self , <nl> + save_steps = None , <nl> + save_secs = None , <nl> + output_dir = " " , <nl> + show_dataflow = True , <nl> + show_memory = False ) : <nl> + " " " Initializes a hook that takes periodic profiling snapshots . <nl> + <nl> + Args : <nl> + save_steps : ` int ` , save profile traces every N steps . Exactly one of <nl> + ` save_secs ` and ` save_steps ` should be set . <nl> + save_secs : ` int ` , save profile traces every N seconds . <nl> + output_dir : ` string ` , the directory to save the profile traces to . <nl> + Defaults to the current directory . <nl> + show_dataflow : ` bool ` , if True , add flow events to the trace connecting <nl> + producers and consumers of tensors . <nl> + show_memory : ` bool ` , if True , add object snapshot events to the trace <nl> + showing the sizes and lifetimes of tensors . <nl> + " " " <nl> + self . _output_file = os . path . join ( output_dir , " timeline - { } . json " ) <nl> + self . _show_dataflow = show_dataflow <nl> + self . _show_memory = show_memory <nl> + self . _timer = SecondOrStepTimer ( every_secs = save_secs , <nl> + every_steps = save_steps ) <nl> + <nl> + def begin ( self ) : <nl> + self . _next_step = None <nl> + self . _global_step_tensor = training_util . get_global_step ( ) <nl> + if self . _global_step_tensor is None : <nl> + raise RuntimeError ( <nl> + " Global step should be created to use ProfilerHook . " ) <nl> + <nl> + def before_run ( self , run_context ) : <nl> + self . _request_summary = ( <nl> + self . _next_step is None or <nl> + self . _timer . should_trigger_for_step ( self . _next_step ) ) <nl> + requests = { " global_step " : self . _global_step_tensor } <nl> + opts = ( config_pb2 . RunOptions ( trace_level = config_pb2 . RunOptions . FULL_TRACE ) <nl> + if self . _request_summary else None ) <nl> + <nl> + return SessionRunArgs ( requests , options = opts ) <nl> + <nl> + def after_run ( self , run_context , run_values ) : <nl> + global_step = run_values . results [ " global_step " ] <nl> + <nl> + if self . _request_summary : <nl> + self . _timer . update_last_triggered_step ( global_step ) <nl> + self . _save ( global_step , <nl> + self . _output_file . format ( global_step ) , <nl> + run_values . run_metadata . step_stats ) <nl> + <nl> + self . _next_step = global_step + 1 <nl> + <nl> + def _save ( self , step , save_path , step_stats ) : <nl> + logging . info ( " Saving timeline for % d into ' % s ' . " , step , save_path ) <nl> + with gfile . Open ( save_path , " w " ) as f : <nl> + trace = timeline . Timeline ( step_stats ) <nl> + f . write ( trace . generate_chrome_trace_format ( <nl> + show_dataflow = self . _show_dataflow , <nl> + show_memory = self . _show_memory ) ) <nl> new file mode 100644 <nl> index 0000000000000 . . e7ecb5eb2fcc5 <nl> mmm / dev / null <nl> ppp b / tensorflow / contrib / hooks / python / training / profiler_hook_test . py <nl> <nl> + # Copyright 2017 The TensorFlow Authors . All Rights Reserved . <nl> + # <nl> + # Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + # you may not use this file except in compliance with the License . <nl> + # You may obtain a copy of the License at <nl> + # <nl> + # http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + # <nl> + # Unless required by applicable law or agreed to in writing , software <nl> + # distributed under the License is distributed on an " AS IS " BASIS , <nl> + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + # See the License for the specific language governing permissions and <nl> + # limitations under the License . <nl> + # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + " " " Tests for profiler_hook . " " " <nl> + <nl> + from __future__ import absolute_import <nl> + from __future__ import division <nl> + from __future__ import print_function <nl> + <nl> + import os . path <nl> + import shutil <nl> + import tempfile <nl> + <nl> + from tensorflow . contrib . framework . python . ops import variables <nl> + from tensorflow . contrib . hooks . python . training import ProfilerHook <nl> + from tensorflow . python . framework import ops <nl> + from tensorflow . python . ops import state_ops <nl> + from tensorflow . python . platform import gfile <nl> + from tensorflow . python . platform import test <nl> + from tensorflow . python . training import monitored_session <nl> + <nl> + <nl> + class ProfilerHookTest ( test . TestCase ) : <nl> + <nl> + def setUp ( self ) : <nl> + super ( ProfilerHookTest , self ) . setUp ( ) <nl> + self . output_dir = tempfile . mkdtemp ( ) <nl> + self . graph = ops . Graph ( ) <nl> + self . filepattern = os . path . join ( self . output_dir , " timeline - * . json " ) <nl> + with self . graph . as_default ( ) : <nl> + self . global_step = variables . get_or_create_global_step ( ) <nl> + self . train_op = state_ops . assign_add ( self . global_step , 1 ) <nl> + <nl> + def tearDown ( self ) : <nl> + super ( ProfilerHookTest , self ) . tearDown ( ) <nl> + shutil . rmtree ( self . output_dir , ignore_errors = True ) <nl> + <nl> + def _count_timeline_files ( self ) : <nl> + return len ( gfile . Glob ( self . filepattern ) ) <nl> + <nl> + def test_raise_in_both_secs_and_steps ( self ) : <nl> + with self . assertRaises ( ValueError ) : <nl> + ProfilerHook ( save_secs = 10 , save_steps = 20 ) <nl> + <nl> + def test_raise_in_none_secs_and_steps ( self ) : <nl> + with self . assertRaises ( ValueError ) : <nl> + ProfilerHook ( save_secs = None , save_steps = None ) <nl> + <nl> + def test_save_secs_saves_in_first_step ( self ) : <nl> + with self . graph . as_default ( ) : <nl> + hook = ProfilerHook ( save_secs = 2 , output_dir = self . output_dir ) <nl> + with monitored_session . SingularMonitoredSession ( hooks = [ hook ] ) as sess : <nl> + sess . run ( self . train_op ) <nl> + self . assertEqual ( 1 , self . _count_timeline_files ( ) ) <nl> + <nl> + @ test . mock . patch ( ' time . time ' ) <nl> + def test_save_secs_saves_periodically ( self , mock_time ) : <nl> + # Pick a fixed start time . <nl> + current_time = 1484863632 . 320497 <nl> + <nl> + with self . graph . as_default ( ) : <nl> + mock_time . return_value = current_time <nl> + hook = ProfilerHook ( save_secs = 2 , output_dir = self . output_dir ) <nl> + with monitored_session . SingularMonitoredSession ( hooks = [ hook ] ) as sess : <nl> + sess . run ( self . train_op ) # Saved . <nl> + self . assertEqual ( 1 , self . _count_timeline_files ( ) ) <nl> + sess . run ( self . train_op ) # Not saved . <nl> + self . assertEqual ( 1 , self . _count_timeline_files ( ) ) <nl> + # Simulate 2 . 5 seconds of sleep . <nl> + mock_time . return_value = current_time + 2 . 5 <nl> + sess . run ( self . train_op ) # Saved . <nl> + <nl> + # Pretend some small amount of time has passed . <nl> + mock_time . return_value = current_time + 0 . 1 <nl> + sess . run ( self . train_op ) # Not saved . <nl> + # Edge test just before we should save the timeline . <nl> + mock_time . return_value = current_time + 1 . 9 <nl> + sess . run ( self . train_op ) # Not saved . <nl> + self . assertEqual ( 2 , self . _count_timeline_files ( ) ) <nl> + <nl> + mock_time . return_value = current_time + 4 . 5 <nl> + sess . run ( self . train_op ) # Saved . <nl> + self . assertEqual ( 3 , self . _count_timeline_files ( ) ) <nl> + <nl> + def test_save_steps_saves_in_first_step ( self ) : <nl> + with self . graph . as_default ( ) : <nl> + hook = ProfilerHook ( save_secs = 2 , output_dir = self . output_dir ) <nl> + with monitored_session . SingularMonitoredSession ( hooks = [ hook ] ) as sess : <nl> + sess . run ( self . train_op ) # Saved . <nl> + sess . run ( self . train_op ) # Not saved . <nl> + self . assertEqual ( 1 , self . _count_timeline_files ( ) ) <nl> + <nl> + def test_save_steps_saves_periodically ( self ) : <nl> + with self . graph . as_default ( ) : <nl> + hook = ProfilerHook ( save_steps = 2 , output_dir = self . output_dir ) <nl> + with monitored_session . SingularMonitoredSession ( hooks = [ hook ] ) as sess : <nl> + self . assertEqual ( 0 , self . _count_timeline_files ( ) ) <nl> + sess . run ( self . train_op ) # Saved . <nl> + self . assertEqual ( 1 , self . _count_timeline_files ( ) ) <nl> + sess . run ( self . train_op ) # Not saved . <nl> + self . assertEqual ( 1 , self . _count_timeline_files ( ) ) <nl> + sess . run ( self . train_op ) # Saved . <nl> + self . assertEqual ( 2 , self . _count_timeline_files ( ) ) <nl> + sess . run ( self . train_op ) # Not saved . <nl> + self . assertEqual ( 2 , self . _count_timeline_files ( ) ) <nl> + sess . run ( self . train_op ) # Saved . <nl> + self . assertEqual ( 3 , self . _count_timeline_files ( ) ) <nl> + <nl> + <nl> + if __name__ = = ' __main__ ' : <nl> + test . main ( ) <nl>
Add ProfilerHook for capturing CPU / GPU profiling information with MonitoredSession ( )
tensorflow/tensorflow
9949045460ffb7bfc037f4b3a5396325791e0f09
2017-02-13T01:21:28Z
mmm a / dbms / include / DB / IO / CompressedReadBufferBase . h <nl> ppp b / dbms / include / DB / IO / CompressedReadBufferBase . h <nl> class CompressedReadBufferBase <nl> if ( ! qlz_state ) <nl> qlz_state = std : : make_unique < qlz_state_decompress > ( ) ; <nl> <nl> - qlz_decompress ( & compressed_buffer [ 0 ] , to , qlz_state ) ; <nl> + qlz_decompress ( & compressed_buffer [ 0 ] , to , qlz_state . get ( ) ) ; <nl> # else <nl> throw Exception ( " QuickLZ compression method is disabled " , ErrorCodes : : UNKNOWN_COMPRESSION_METHOD ) ; <nl> # endif <nl>
dbms : Fixed build with QuickLZ . [ # METR - 19660 ]
ClickHouse/ClickHouse
0432288b3265199559b3834ec6b289e6299e9558
2016-06-16T08:33:49Z
mmm a / fdbserver / OldTLogServer_4_6 . actor . cpp <nl> ppp b / fdbserver / OldTLogServer_4_6 . actor . cpp <nl> using std : : make_pair ; <nl> using std : : min ; <nl> using std : : max ; <nl> <nl> - # define TLOG_VERSION " 4 . 6 " <nl> namespace oldTLog_4_6 { <nl> <nl> typedef int16_t OldTag ; <nl> namespace oldTLog_4_6 { <nl> / / These are initialized differently on init ( ) or recovery <nl> recoveryCount ( ) , stopped ( false ) , initialized ( false ) , queueCommittingVersion ( 0 ) , newPersistentDataVersion ( invalidVersion ) , recovery ( Void ( ) ) <nl> { <nl> - std : : map < std : : string , std : : string > details ; <nl> - details [ " TLogVersion " ] = TLOG_VERSION ; <nl> - startRole ( Role : : TRANSACTION_LOG , interf . id ( ) , tLogData - > workerID , details , " Restored " ) ; <nl> + startRole ( Role : : TRANSACTION_LOG , interf . id ( ) , tLogData - > workerID , { { " SharedTLog " , tLogData - > dbgid . shortString ( ) } } , " Restored " ) ; <nl> <nl> persistentDataVersion . init ( LiteralStringRef ( " TLog . PersistentDataVersion " ) , cc . id ) ; <nl> persistentDataDurableVersion . init ( LiteralStringRef ( " TLog . PersistentDataDurableVersion " ) , cc . id ) ; <nl> namespace oldTLog_4_6 { <nl> / / The TLogRejoinRequest is needed to establish communications with a new master , which doesn ' t have our TLogInterface <nl> TLogRejoinRequest req ; <nl> req . myInterface = tli ; <nl> - TraceEvent ( " TLogRejoining " , self - > dbgid ) . detail ( " Master " , self - > dbInfo - > get ( ) . master . id ( ) ) ; <nl> + TraceEvent ( " TLogRejoining " , tli . id ( ) ) . detail ( " Master " , self - > dbInfo - > get ( ) . master . id ( ) ) ; <nl> choose { <nl> when ( TLogRejoinReply rep = <nl> wait ( brokenPromiseToNever ( self - > dbInfo - > get ( ) . master . tlogRejoin . getReply ( req ) ) ) ) { <nl> mmm a / fdbserver / OldTLogServer_6_0 . actor . cpp <nl> ppp b / fdbserver / OldTLogServer_6_0 . actor . cpp <nl> using std : : make_pair ; <nl> using std : : min ; <nl> using std : : max ; <nl> <nl> - # define TLOG_VERSION " 6 . 0 " <nl> namespace oldTLog_6_0 { <nl> <nl> struct TLogQueueEntryRef { <nl> struct LogData : NonCopyable , public ReferenceCounted < LogData > { <nl> recoveryCount ( ) , stopped ( false ) , initialized ( false ) , queueCommittingVersion ( 0 ) , newPersistentDataVersion ( invalidVersion ) , unrecoveredBefore ( 1 ) , recoveredAt ( 1 ) , unpoppedRecoveredTags ( 0 ) , <nl> logRouterPopToVersion ( 0 ) , locality ( tagLocalityInvalid ) , execOpCommitInProgress ( false ) <nl> { <nl> - std : : map < std : : string , std : : string > details ; <nl> - details [ " TLogVersion " ] = TLOG_VERSION ; <nl> - startRole ( Role : : TRANSACTION_LOG , interf . id ( ) , tLogData - > workerID , details , context ) ; <nl> + startRole ( Role : : TRANSACTION_LOG , interf . id ( ) , tLogData - > workerID , { { " SharedTLog " , tLogData - > dbgid . shortString ( ) } } , context ) ; <nl> <nl> persistentDataVersion . init ( LiteralStringRef ( " TLog . PersistentDataVersion " ) , cc . id ) ; <nl> persistentDataDurableVersion . init ( LiteralStringRef ( " TLog . PersistentDataDurableVersion " ) , cc . id ) ; <nl> ACTOR Future < Void > rejoinMasters ( TLogData * self , TLogInterface tli , DBRecoveryC <nl> if ( self - > dbInfo - > get ( ) . master . id ( ) ! = lastMasterID ) { <nl> / / The TLogRejoinRequest is needed to establish communications with a new master , which doesn ' t have our TLogInterface <nl> TLogRejoinRequest req ( tli ) ; <nl> - TraceEvent ( " TLogRejoining " , self - > dbgid ) . detail ( " Master " , self - > dbInfo - > get ( ) . master . id ( ) ) ; <nl> + TraceEvent ( " TLogRejoining " , tli . id ( ) ) . detail ( " Master " , self - > dbInfo - > get ( ) . master . id ( ) ) ; <nl> choose { <nl> when ( TLogRejoinReply rep = <nl> wait ( brokenPromiseToNever ( self - > dbInfo - > get ( ) . master . tlogRejoin . getReply ( req ) ) ) ) { <nl> mmm a / fdbserver / TLogServer . actor . cpp <nl> ppp b / fdbserver / TLogServer . actor . cpp <nl> using std : : make_pair ; <nl> using std : : min ; <nl> using std : : max ; <nl> <nl> - # define TLOG_VERSION " 6 . 2 " <nl> - <nl> struct TLogQueueEntryRef { <nl> UID id ; <nl> Version version ; <nl> struct LogData : NonCopyable , public ReferenceCounted < LogData > { <nl> recoveryCount ( ) , stopped ( false ) , initialized ( false ) , queueCommittingVersion ( 0 ) , newPersistentDataVersion ( invalidVersion ) , unrecoveredBefore ( 1 ) , recoveredAt ( 1 ) , unpoppedRecoveredTags ( 0 ) , <nl> logRouterPopToVersion ( 0 ) , locality ( tagLocalityInvalid ) , execOpCommitInProgress ( false ) <nl> { <nl> - std : : map < std : : string , std : : string > details ; <nl> - details [ " TLogVersion " ] = TLOG_VERSION ; <nl> - startRole ( Role : : TRANSACTION_LOG , interf . id ( ) , tLogData - > workerID , details , context ) ; <nl> + startRole ( Role : : TRANSACTION_LOG , interf . id ( ) , tLogData - > workerID , { { " SharedTLog " , tLogData - > dbgid . shortString ( ) } } , context ) ; <nl> <nl> persistentDataVersion . init ( LiteralStringRef ( " TLog . PersistentDataVersion " ) , cc . id ) ; <nl> persistentDataDurableVersion . init ( LiteralStringRef ( " TLog . PersistentDataDurableVersion " ) , cc . id ) ; <nl> ACTOR Future < Void > rejoinMasters ( TLogData * self , TLogInterface tli , DBRecoveryC <nl> if ( self - > dbInfo - > get ( ) . master . id ( ) ! = lastMasterID ) { <nl> / / The TLogRejoinRequest is needed to establish communications with a new master , which doesn ' t have our TLogInterface <nl> TLogRejoinRequest req ( tli ) ; <nl> - TraceEvent ( " TLogRejoining " , self - > dbgid ) . detail ( " Master " , self - > dbInfo - > get ( ) . master . id ( ) ) ; <nl> + TraceEvent ( " TLogRejoining " , tli . id ( ) ) . detail ( " Master " , self - > dbInfo - > get ( ) . master . id ( ) ) ; <nl> choose { <nl> when ( TLogRejoinReply rep = <nl> wait ( brokenPromiseToNever ( self - > dbInfo - > get ( ) . master . tlogRejoin . getReply ( req ) ) ) ) { <nl> mmm a / fdbserver / WorkerInterface . actor . h <nl> ppp b / fdbserver / WorkerInterface . actor . h <nl> struct Role { <nl> } <nl> } ; <nl> <nl> - void startRole ( const Role & role , UID roleId , UID workerId , std : : map < std : : string , std : : string > details = std : : map < std : : string , std : : string > ( ) , std : : string origination = " Recruited " ) ; <nl> + void startRole ( const Role & role , UID roleId , UID workerId , const std : : map < std : : string , std : : string > & details = std : : map < std : : string , std : : string > ( ) , const std : : string & origination = " Recruited " ) ; <nl> void endRole ( const Role & role , UID id , std : : string reason , bool ok = true , Error e = Error ( ) ) ; <nl> <nl> struct ServerDBInfo ; <nl> mmm a / fdbserver / worker . actor . cpp <nl> ppp b / fdbserver / worker . actor . cpp <nl> Standalone < StringRef > roleString ( std : : set < std : : pair < std : : string , std : : string > > r <nl> return StringRef ( result ) ; <nl> } <nl> <nl> - void startRole ( const Role & role , UID roleId , UID workerId , std : : map < std : : string , std : : string > details , std : : string origination ) { <nl> + void startRole ( const Role & role , UID roleId , UID workerId , const std : : map < std : : string , std : : string > & details , const std : : string & origination ) { <nl> if ( role . includeInTraceRoles ) { <nl> addTraceRole ( role . abbreviation ) ; <nl> } <nl>
Removed TLogVersion logging .
apple/foundationdb
1d9140d87492b46c7ddcfd7ccd60678012f47319
2020-02-14T20:33:43Z
mmm a / src / mongo / db / commands / getmore_cmd . cpp <nl> ppp b / src / mongo / db / commands / getmore_cmd . cpp <nl> void validateTxnNumber ( OperationContext * opCtx , <nl> * Can be used in combination with any cursor - generating command ( e . g . find , aggregate , <nl> * listIndexes ) . <nl> * / <nl> - class GetMoreCmd : public BasicCommand { <nl> - MONGO_DISALLOW_COPYING ( GetMoreCmd ) ; <nl> - <nl> + class GetMoreCmd final : public Command { <nl> public : <nl> - GetMoreCmd ( ) : BasicCommand ( " getMore " ) { } <nl> - <nl> - <nl> - virtual bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> - return false ; <nl> - } <nl> - <nl> - virtual bool allowsAfterClusterTime ( const BSONObj & cmdObj ) const override { <nl> - return false ; <nl> - } <nl> - <nl> - AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> - return AllowedOnSecondary : : kAlways ; <nl> - } <nl> - <nl> - bool maintenanceOk ( ) const override { <nl> - return false ; <nl> - } <nl> + GetMoreCmd ( ) : Command ( " getMore " ) { } <nl> <nl> - bool adminOnly ( ) const override { <nl> - return false ; <nl> - } <nl> - <nl> - bool supportsReadConcern ( const std : : string & dbName , <nl> - const BSONObj & cmdObj , <nl> - repl : : ReadConcernLevel level ) const final { <nl> - / / Uses the readConcern setting from whatever created the cursor . <nl> - return level = = repl : : ReadConcernLevel : : kLocalReadConcern ; <nl> - } <nl> - <nl> - ReadWriteType getReadWriteType ( ) const { <nl> - return ReadWriteType : : kRead ; <nl> + std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> + const OpMsgRequest & opMsgRequest ) override { <nl> + return std : : make_unique < Invocation > ( this , opMsgRequest ) ; <nl> } <nl> <nl> - std : : string help ( ) const override { <nl> - return " retrieve more results from an existing cursor " ; <nl> - } <nl> - <nl> - LogicalOp getLogicalOp ( ) const override { <nl> - return LogicalOp : : opGetMore ; <nl> - } <nl> + class Invocation final : public CommandInvocation { <nl> + public : <nl> + Invocation ( Command * cmd , const OpMsgRequest & request ) <nl> + : CommandInvocation ( cmd ) , <nl> + _request ( uassertStatusOK ( <nl> + GetMoreRequest : : parseFromBSON ( request . getDatabase ( ) . toString ( ) , request . body ) ) ) { } <nl> <nl> - std : : size_t reserveBytesForReply ( ) const override { <nl> - / / The extra 1K is an artifact of how we construct batches . We consider a batch to be full <nl> - / / when it exceeds the goal batch size . In the case that we are just below the limit and <nl> - / / then read a large document , the extra 1K helps prevent a final realloc + memcpy . <nl> - return FindCommon : : kMaxBytesToReturnToClientAtOnce + 1024u ; <nl> - } <nl> + private : <nl> + bool supportsWriteConcern ( ) const override { <nl> + return false ; <nl> + } <nl> <nl> - / * * <nl> - * A getMore command increments the getMore counter , not the command counter . <nl> - * / <nl> - bool shouldAffectCommandCounter ( ) const override { <nl> - return false ; <nl> - } <nl> + bool allowsAfterClusterTime ( ) const override { <nl> + return false ; <nl> + } <nl> <nl> - std : : string parseNs ( const std : : string & dbname , const BSONObj & cmdObj ) const override { <nl> - return GetMoreRequest : : parseNs ( dbname , cmdObj ) . ns ( ) ; <nl> - } <nl> + NamespaceString ns ( ) const override { <nl> + return _request . nss ; <nl> + } <nl> <nl> - Status checkAuthForCommand ( Client * client , <nl> - const std : : string & dbname , <nl> - const BSONObj & cmdObj ) const override { <nl> - StatusWith < GetMoreRequest > parseStatus = GetMoreRequest : : parseFromBSON ( dbname , cmdObj ) ; <nl> - if ( ! parseStatus . isOK ( ) ) { <nl> - return parseStatus . getStatus ( ) ; <nl> + void doCheckAuthorization ( OperationContext * opCtx ) const override { <nl> + uassertStatusOK ( AuthorizationSession : : get ( opCtx - > getClient ( ) ) <nl> + - > checkAuthForGetMore ( _request . nss , <nl> + _request . cursorid , <nl> + _request . term . is_initialized ( ) ) ) ; <nl> } <nl> - const GetMoreRequest & request = parseStatus . getValue ( ) ; <nl> <nl> - return AuthorizationSession : : get ( client ) - > checkAuthForGetMore ( <nl> - request . nss , request . cursorid , request . term . is_initialized ( ) ) ; <nl> - } <nl> + / * * <nl> + * Uses ' cursor ' and ' request ' to fill out ' nextBatch ' with the batch of result documents to <nl> + * be returned by this getMore . <nl> + * <nl> + * Returns the number of documents in the batch in * numResults , which must be initialized to <nl> + * zero by the caller . Returns the final ExecState returned by the cursor in * state . <nl> + * <nl> + * Returns an OK status if the batch was successfully generated , and a non - OK status if the <nl> + * PlanExecutor encounters a failure . <nl> + * / <nl> + Status generateBatch ( OperationContext * opCtx , <nl> + ClientCursor * cursor , <nl> + const GetMoreRequest & request , <nl> + CursorResponseBuilder * nextBatch , <nl> + PlanExecutor : : ExecState * state , <nl> + long long * numResults ) { <nl> + PlanExecutor * exec = cursor - > getExecutor ( ) ; <nl> + <nl> + / / If an awaitData getMore is killed during this process due to our max time expiring at <nl> + / / an interrupt point , we just continue as normal and return rather than reporting a <nl> + / / timeout to the user . <nl> + BSONObj obj ; <nl> + try { <nl> + while ( ! FindCommon : : enoughForGetMore ( request . batchSize . value_or ( 0 ) , * numResults ) & & <nl> + PlanExecutor : : ADVANCED = = ( * state = exec - > getNext ( & obj , NULL ) ) ) { <nl> + / / If adding this object will cause us to exceed the message size limit , then we <nl> + / / stash it for later . <nl> + if ( ! FindCommon : : haveSpaceForNext ( obj , * numResults , nextBatch - > bytesUsed ( ) ) ) { <nl> + exec - > enqueue ( obj ) ; <nl> + break ; <nl> + } <nl> + <nl> + / / As soon as we get a result , this operation no longer waits . <nl> + awaitDataState ( opCtx ) . shouldWaitForInserts = false ; <nl> + / / Add result to output buffer . <nl> + nextBatch - > setLatestOplogTimestamp ( exec - > getLatestOplogTimestamp ( ) ) ; <nl> + nextBatch - > append ( obj ) ; <nl> + ( * numResults ) + + ; <nl> + } <nl> + } catch ( const ExceptionFor < ErrorCodes : : CloseChangeStream > & ) { <nl> + / / FAILURE state will make getMore command close the cursor even if it ' s tailable . <nl> + * state = PlanExecutor : : FAILURE ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + switch ( * state ) { <nl> + case PlanExecutor : : FAILURE : <nl> + / / Log an error message and then perform the same cleanup as DEAD . <nl> + error ( ) < < " GetMore command executor error : " < < PlanExecutor : : statestr ( * state ) <nl> + < < " , stats : " < < redact ( Explain : : getWinningPlanStats ( exec ) ) ; <nl> + case PlanExecutor : : DEAD : { <nl> + nextBatch - > abandon ( ) ; <nl> + / / We should always have a valid status member object at this point . <nl> + auto status = WorkingSetCommon : : getMemberObjectStatus ( obj ) ; <nl> + invariant ( ! status . isOK ( ) ) ; <nl> + return status ; <nl> + } <nl> + case PlanExecutor : : IS_EOF : <nl> + / / This causes the reported latest oplog timestamp to advance even when there <nl> + / / are <nl> + / / no results for this particular query . <nl> + nextBatch - > setLatestOplogTimestamp ( exec - > getLatestOplogTimestamp ( ) ) ; <nl> + default : <nl> + return Status : : OK ( ) ; <nl> + } <nl> <nl> - bool runParsed ( OperationContext * opCtx , <nl> - const NamespaceString & origNss , <nl> - const GetMoreRequest & request , <nl> - const BSONObj & cmdObj , <nl> - BSONObjBuilder & result ) { <nl> - auto curOp = CurOp : : get ( opCtx ) ; <nl> - curOp - > debug ( ) . cursorid = request . cursorid ; <nl> - <nl> - / / Validate term before acquiring locks , if provided . <nl> - if ( request . term ) { <nl> - auto replCoord = repl : : ReplicationCoordinator : : get ( opCtx ) ; <nl> - Status status = replCoord - > updateTerm ( opCtx , * request . term ) ; <nl> - / / Note : updateTerm returns ok if term stayed the same . <nl> - uassertStatusOK ( status ) ; <nl> + MONGO_UNREACHABLE ; <nl> } <nl> <nl> - / / Cursors come in one of two flavors : <nl> - / / - Cursors owned by the collection cursor manager , such as those generated via the find <nl> - / / command . For these cursors , we hold the appropriate collection lock for the duration of <nl> - / / the getMore using AutoGetCollectionForRead . <nl> - / / - Cursors owned by the global cursor manager , such as those generated via the aggregate <nl> - / / command . These cursors either hold no collection state or manage their collection state <nl> - / / internally , so we acquire no locks . <nl> - / / <nl> - / / While we only need to acquire locks in the case of a cursor which is * not * globally <nl> - / / owned , we need to create an AutoStatsTracker in either case . This is responsible for <nl> - / / updating statistics in CurOp and Top . We avoid using AutoGetCollectionForReadCommand <nl> - / / because we may need to drop and reacquire locks when the cursor is awaitData , but we <nl> - / / don ' t want to update the stats twice . <nl> - / / <nl> - / / Note that we acquire our locks before our ClientCursorPin , in order to ensure that <nl> - / / the pin ' s destructor is called before the lock ' s destructor ( if there is one ) so that the <nl> - / / cursor cleanup can occur under the lock . <nl> - boost : : optional < AutoGetCollectionForRead > readLock ; <nl> - boost : : optional < AutoStatsTracker > statsTracker ; <nl> - CursorManager * cursorManager ; <nl> - <nl> - if ( CursorManager : : isGloballyManagedCursor ( request . cursorid ) ) { <nl> - cursorManager = CursorManager : : getGlobalCursorManager ( ) ; <nl> - <nl> - if ( boost : : optional < NamespaceString > nssForCurOp = <nl> - request . nss . isGloballyManagedNamespace ( ) <nl> - ? request . nss . getTargetNSForGloballyManagedNamespace ( ) <nl> - : request . nss ) { <nl> - const boost : : optional < int > dbProfilingLevel = boost : : none ; <nl> - statsTracker . emplace ( <nl> - opCtx , * nssForCurOp , Top : : LockType : : NotLocked , dbProfilingLevel ) ; <nl> + void run ( OperationContext * opCtx , rpc : : ReplyBuilderInterface * reply ) override { <nl> + / / Counted as a getMore , not as a command . <nl> + globalOpCounters . gotGetMore ( ) ; <nl> + auto result = reply - > getBodyBuilder ( ) ; <nl> + auto curOp = CurOp : : get ( opCtx ) ; <nl> + curOp - > debug ( ) . cursorid = _request . cursorid ; <nl> + <nl> + / / Validate term before acquiring locks , if provided . <nl> + if ( _request . term ) { <nl> + auto replCoord = repl : : ReplicationCoordinator : : get ( opCtx ) ; <nl> + / / Note : updateTerm returns ok if term stayed the same . <nl> + uassertStatusOK ( replCoord - > updateTerm ( opCtx , * _request . term ) ) ; <nl> } <nl> - } else { <nl> - readLock . emplace ( opCtx , request . nss ) ; <nl> - const int doNotChangeProfilingLevel = 0 ; <nl> - statsTracker . emplace ( opCtx , <nl> - request . nss , <nl> - Top : : LockType : : ReadLocked , <nl> - readLock - > getDb ( ) ? readLock - > getDb ( ) - > getProfilingLevel ( ) <nl> - : doNotChangeProfilingLevel ) ; <nl> - <nl> - Collection * collection = readLock - > getCollection ( ) ; <nl> - if ( ! collection ) { <nl> - uasserted ( ErrorCodes : : OperationFailed , " collection dropped between getMore calls " ) ; <nl> + <nl> + / / Cursors come in one of two flavors : <nl> + / / - Cursors owned by the collection cursor manager , such as those generated via the <nl> + / / find <nl> + / / command . For these cursors , we hold the appropriate collection lock for the <nl> + / / duration of <nl> + / / the getMore using AutoGetCollectionForRead . <nl> + / / - Cursors owned by the global cursor manager , such as those generated via the <nl> + / / aggregate <nl> + / / command . These cursors either hold no collection state or manage their collection <nl> + / / state <nl> + / / internally , so we acquire no locks . <nl> + / / <nl> + / / While we only need to acquire locks in the case of a cursor which is * not * globally <nl> + / / owned , we need to create an AutoStatsTracker in either case . This is responsible for <nl> + / / updating statistics in CurOp and Top . We avoid using AutoGetCollectionForReadCommand <nl> + / / because we may need to drop and reacquire locks when the cursor is awaitData , but we <nl> + / / don ' t want to update the stats twice . <nl> + / / <nl> + / / Note that we acquire our locks before our ClientCursorPin , in order to ensure that <nl> + / / the pin ' s destructor is called before the lock ' s destructor ( if there is one ) so that <nl> + / / the <nl> + / / cursor cleanup can occur under the lock . <nl> + boost : : optional < AutoGetCollectionForRead > readLock ; <nl> + boost : : optional < AutoStatsTracker > statsTracker ; <nl> + CursorManager * cursorManager ; <nl> + <nl> + if ( CursorManager : : isGloballyManagedCursor ( _request . cursorid ) ) { <nl> + cursorManager = CursorManager : : getGlobalCursorManager ( ) ; <nl> + <nl> + if ( boost : : optional < NamespaceString > nssForCurOp = <nl> + _request . nss . isGloballyManagedNamespace ( ) <nl> + ? _request . nss . getTargetNSForGloballyManagedNamespace ( ) <nl> + : _request . nss ) { <nl> + const boost : : optional < int > dbProfilingLevel = boost : : none ; <nl> + statsTracker . emplace ( <nl> + opCtx , * nssForCurOp , Top : : LockType : : NotLocked , dbProfilingLevel ) ; <nl> + } <nl> + } else { <nl> + readLock . emplace ( opCtx , _request . nss ) ; <nl> + const int doNotChangeProfilingLevel = 0 ; <nl> + statsTracker . emplace ( opCtx , <nl> + _request . nss , <nl> + Top : : LockType : : ReadLocked , <nl> + readLock - > getDb ( ) ? readLock - > getDb ( ) - > getProfilingLevel ( ) <nl> + : doNotChangeProfilingLevel ) ; <nl> + <nl> + Collection * collection = readLock - > getCollection ( ) ; <nl> + if ( ! collection ) { <nl> + uasserted ( ErrorCodes : : OperationFailed , <nl> + " collection dropped between getMore calls " ) ; <nl> + } <nl> + cursorManager = collection - > getCursorManager ( ) ; <nl> } <nl> - cursorManager = collection - > getCursorManager ( ) ; <nl> - } <nl> <nl> - auto ccPin = cursorManager - > pinCursor ( opCtx , request . cursorid ) ; <nl> - uassertStatusOK ( ccPin . getStatus ( ) ) ; <nl> - <nl> - ClientCursor * cursor = ccPin . getValue ( ) . getCursor ( ) ; <nl> - <nl> - / / Only used by the failpoints . <nl> - const auto dropAndReaquireReadLock = [ & readLock , opCtx , & request ] ( ) { <nl> - / / Make sure an interrupted operation does not prevent us from reacquiring the lock . <nl> - UninterruptibleLockGuard noInterrupt ( opCtx - > lockState ( ) ) ; <nl> - <nl> - readLock . reset ( ) ; <nl> - readLock . emplace ( opCtx , request . nss ) ; <nl> - } ; <nl> - <nl> - / / If the ' waitAfterPinningCursorBeforeGetMoreBatch ' fail point is enabled , set the ' msg ' <nl> - / / field of this operation ' s CurOp to signal that we ' ve hit this point and then repeatedly <nl> - / / release and re - acquire the collection readLock at regular intervals until the failpoint <nl> - / / is released . This is done in order to avoid deadlocks caused by the pinned - cursor <nl> - / / failpoints in this file ( see SERVER - 21997 ) . <nl> - if ( MONGO_FAIL_POINT ( waitAfterPinningCursorBeforeGetMoreBatch ) ) { <nl> - CurOpFailpointHelpers : : waitWhileFailPointEnabled ( <nl> - & waitAfterPinningCursorBeforeGetMoreBatch , <nl> - opCtx , <nl> - " waitAfterPinningCursorBeforeGetMoreBatch " , <nl> - dropAndReaquireReadLock ) ; <nl> - } <nl> + auto ccPin = uassertStatusOK ( cursorManager - > pinCursor ( opCtx , _request . cursorid ) ) ; <nl> + ClientCursor * cursor = ccPin . getCursor ( ) ; <nl> + <nl> + / / Only used by the failpoints . <nl> + const auto dropAndReaquireReadLock = [ & readLock , opCtx , this ] ( ) { <nl> + / / Make sure an interrupted operation does not prevent us from reacquiring the lock . <nl> + UninterruptibleLockGuard noInterrupt ( opCtx - > lockState ( ) ) ; <nl> + <nl> + readLock . reset ( ) ; <nl> + readLock . emplace ( opCtx , _request . nss ) ; <nl> + } ; <nl> + <nl> + / / If the ' waitAfterPinningCursorBeforeGetMoreBatch ' fail point is enabled , set the <nl> + / / ' msg ' <nl> + / / field of this operation ' s CurOp to signal that we ' ve hit this point and then <nl> + / / repeatedly <nl> + / / release and re - acquire the collection readLock at regular intervals until the <nl> + / / failpoint <nl> + / / is released . This is done in order to avoid deadlocks caused by the pinned - cursor <nl> + / / failpoints in this file ( see SERVER - 21997 ) . <nl> + if ( MONGO_FAIL_POINT ( waitAfterPinningCursorBeforeGetMoreBatch ) ) { <nl> + CurOpFailpointHelpers : : waitWhileFailPointEnabled ( <nl> + & waitAfterPinningCursorBeforeGetMoreBatch , <nl> + opCtx , <nl> + " waitAfterPinningCursorBeforeGetMoreBatch " , <nl> + dropAndReaquireReadLock ) ; <nl> + } <nl> <nl> - / / A user can only call getMore on their own cursor . If there were multiple users <nl> - / / authenticated when the cursor was created , then at least one of them must be <nl> - / / authenticated in order to run getMore on the cursor . <nl> - if ( ! AuthorizationSession : : get ( opCtx - > getClient ( ) ) <nl> - - > isCoauthorizedWith ( cursor - > getAuthenticatedUsers ( ) ) ) { <nl> - uasserted ( ErrorCodes : : Unauthorized , <nl> - str : : stream ( ) < < " cursor id " < < request . cursorid <nl> - < < " was not created by the authenticated user " ) ; <nl> - } <nl> + / / A user can only call getMore on their own cursor . If there were multiple users <nl> + / / authenticated when the cursor was created , then at least one of them must be <nl> + / / authenticated in order to run getMore on the cursor . <nl> + if ( ! AuthorizationSession : : get ( opCtx - > getClient ( ) ) <nl> + - > isCoauthorizedWith ( cursor - > getAuthenticatedUsers ( ) ) ) { <nl> + uasserted ( ErrorCodes : : Unauthorized , <nl> + str : : stream ( ) < < " cursor id " < < _request . cursorid <nl> + < < " was not created by the authenticated user " ) ; <nl> + } <nl> <nl> - if ( request . nss ! = cursor - > nss ( ) ) { <nl> - uasserted ( ErrorCodes : : Unauthorized , <nl> - str : : stream ( ) < < " Requested getMore on namespace ' " < < request . nss . ns ( ) <nl> - < < " ' , but cursor belongs to a different namespace " <nl> - < < cursor - > nss ( ) . ns ( ) ) ; <nl> - } <nl> + if ( _request . nss ! = cursor - > nss ( ) ) { <nl> + uasserted ( ErrorCodes : : Unauthorized , <nl> + str : : stream ( ) < < " Requested getMore on namespace ' " < < _request . nss . ns ( ) <nl> + < < " ' , but cursor belongs to a different namespace " <nl> + < < cursor - > nss ( ) . ns ( ) ) ; <nl> + } <nl> <nl> - / / Ensure the lsid and txnNumber of the getMore match that of the originating command . <nl> - validateLSID ( opCtx , request , cursor ) ; <nl> - validateTxnNumber ( opCtx , request , cursor ) ; <nl> + / / Ensure the lsid and txnNumber of the getMore match that of the originating command . <nl> + validateLSID ( opCtx , _request , cursor ) ; <nl> + validateTxnNumber ( opCtx , _request , cursor ) ; <nl> <nl> - if ( request . nss . isOplog ( ) & & MONGO_FAIL_POINT ( rsStopGetMoreCmd ) ) { <nl> - uasserted ( ErrorCodes : : CommandFailed , <nl> - str : : stream ( ) < < " getMore on " < < request . nss . ns ( ) <nl> - < < " rejected due to active fail point rsStopGetMoreCmd " ) ; <nl> - } <nl> + if ( _request . nss . isOplog ( ) & & MONGO_FAIL_POINT ( rsStopGetMoreCmd ) ) { <nl> + uasserted ( ErrorCodes : : CommandFailed , <nl> + str : : stream ( ) < < " getMore on " < < _request . nss . ns ( ) <nl> + < < " rejected due to active fail point rsStopGetMoreCmd " ) ; <nl> + } <nl> <nl> - / / Validation related to awaitData . <nl> - if ( cursor - > isAwaitData ( ) ) { <nl> - invariant ( cursor - > isTailable ( ) ) ; <nl> - } <nl> + / / Validation related to awaitData . <nl> + if ( cursor - > isAwaitData ( ) ) { <nl> + invariant ( cursor - > isTailable ( ) ) ; <nl> + } <nl> <nl> - if ( request . awaitDataTimeout & & ! cursor - > isAwaitData ( ) ) { <nl> - Status status ( ErrorCodes : : BadValue , <nl> + if ( _request . awaitDataTimeout & & ! cursor - > isAwaitData ( ) ) { <nl> + uasserted ( ErrorCodes : : BadValue , <nl> " cannot set maxTimeMS on getMore command for a non - awaitData cursor " ) ; <nl> - uassertStatusOK ( status ) ; <nl> - } <nl> + } <nl> <nl> - / / On early return , get rid of the cursor . <nl> - ScopeGuard cursorFreer = MakeGuard ( & ClientCursorPin : : deleteUnderlying , & ccPin . getValue ( ) ) ; <nl> + / / On early return , get rid of the cursor . <nl> + ScopeGuard cursorFreer = MakeGuard ( & ClientCursorPin : : deleteUnderlying , & ccPin ) ; <nl> <nl> - const auto replicationMode = repl : : ReplicationCoordinator : : get ( opCtx ) - > getReplicationMode ( ) ; <nl> - if ( replicationMode = = repl : : ReplicationCoordinator : : modeReplSet & & <nl> - cursor - > getReadConcernLevel ( ) = = repl : : ReadConcernLevel : : kMajorityReadConcern ) { <nl> - opCtx - > recoveryUnit ( ) - > setTimestampReadSource ( <nl> - RecoveryUnit : : ReadSource : : kMajorityCommitted ) ; <nl> - uassertStatusOK ( opCtx - > recoveryUnit ( ) - > obtainMajorityCommittedSnapshot ( ) ) ; <nl> - } <nl> + const auto replicationMode = <nl> + repl : : ReplicationCoordinator : : get ( opCtx ) - > getReplicationMode ( ) ; <nl> + if ( replicationMode = = repl : : ReplicationCoordinator : : modeReplSet & & <nl> + cursor - > getReadConcernLevel ( ) = = repl : : ReadConcernLevel : : kMajorityReadConcern ) { <nl> + opCtx - > recoveryUnit ( ) - > setTimestampReadSource ( <nl> + RecoveryUnit : : ReadSource : : kMajorityCommitted ) ; <nl> + uassertStatusOK ( opCtx - > recoveryUnit ( ) - > obtainMajorityCommittedSnapshot ( ) ) ; <nl> + } <nl> <nl> - const bool disableAwaitDataFailpointActive = <nl> - MONGO_FAIL_POINT ( disableAwaitDataForGetMoreCmd ) ; <nl> + const bool disableAwaitDataFailpointActive = <nl> + MONGO_FAIL_POINT ( disableAwaitDataForGetMoreCmd ) ; <nl> + <nl> + / / We assume that cursors created through a DBDirectClient are always used from their <nl> + / / original OperationContext , so we do not need to move time to and from the cursor . <nl> + if ( ! opCtx - > getClient ( ) - > isInDirectClient ( ) ) { <nl> + / / There is no time limit set directly on this getMore command . If the cursor is <nl> + / / awaitData , then we supply a default time of one second . Otherwise we roll over <nl> + / / any leftover time from the maxTimeMS of the operation that spawned this cursor , <nl> + / / applying it to this getMore . <nl> + if ( cursor - > isAwaitData ( ) & & ! disableAwaitDataFailpointActive ) { <nl> + awaitDataState ( opCtx ) . waitForInsertsDeadline = <nl> + opCtx - > getServiceContext ( ) - > getPreciseClockSource ( ) - > now ( ) + <nl> + _request . awaitDataTimeout . value_or ( Seconds { 1 } ) ; <nl> + } else if ( cursor - > getLeftoverMaxTimeMicros ( ) < Microseconds : : max ( ) ) { <nl> + opCtx - > setDeadlineAfterNowBy ( cursor - > getLeftoverMaxTimeMicros ( ) ) ; <nl> + } <nl> + } <nl> + if ( ! cursor - > isAwaitData ( ) ) { <nl> + opCtx - > checkForInterrupt ( ) ; / / May trigger maxTimeAlwaysTimeOut fail point . <nl> + } <nl> <nl> - / / We assume that cursors created through a DBDirectClient are always used from their <nl> - / / original OperationContext , so we do not need to move time to and from the cursor . <nl> - if ( ! opCtx - > getClient ( ) - > isInDirectClient ( ) ) { <nl> - / / There is no time limit set directly on this getMore command . If the cursor is <nl> - / / awaitData , then we supply a default time of one second . Otherwise we roll over <nl> - / / any leftover time from the maxTimeMS of the operation that spawned this cursor , <nl> - / / applying it to this getMore . <nl> - if ( cursor - > isAwaitData ( ) & & ! disableAwaitDataFailpointActive ) { <nl> - awaitDataState ( opCtx ) . waitForInsertsDeadline = <nl> - opCtx - > getServiceContext ( ) - > getPreciseClockSource ( ) - > now ( ) + <nl> - request . awaitDataTimeout . value_or ( Seconds { 1 } ) ; <nl> - } else if ( cursor - > getLeftoverMaxTimeMicros ( ) < Microseconds : : max ( ) ) { <nl> - opCtx - > setDeadlineAfterNowBy ( cursor - > getLeftoverMaxTimeMicros ( ) ) ; <nl> + PlanExecutor * exec = cursor - > getExecutor ( ) ; <nl> + exec - > reattachToOperationContext ( opCtx ) ; <nl> + uassertStatusOK ( exec - > restoreState ( ) ) ; <nl> + <nl> + auto planSummary = Explain : : getPlanSummary ( exec ) ; <nl> + { <nl> + stdx : : lock_guard < Client > lk ( * opCtx - > getClient ( ) ) ; <nl> + curOp - > setPlanSummary_inlock ( planSummary ) ; <nl> + <nl> + / / Ensure that the original query or command object is available in the slow query <nl> + / / log , <nl> + / / profiler and currentOp . <nl> + auto originatingCommand = cursor - > getOriginatingCommandObj ( ) ; <nl> + if ( ! originatingCommand . isEmpty ( ) ) { <nl> + curOp - > setOriginatingCommand_inlock ( originatingCommand ) ; <nl> + } <nl> } <nl> - } <nl> - if ( ! cursor - > isAwaitData ( ) ) { <nl> - opCtx - > checkForInterrupt ( ) ; / / May trigger maxTimeAlwaysTimeOut fail point . <nl> - } <nl> <nl> - PlanExecutor * exec = cursor - > getExecutor ( ) ; <nl> - exec - > reattachToOperationContext ( opCtx ) ; <nl> - uassertStatusOK ( exec - > restoreState ( ) ) ; <nl> + CursorId respondWithId = 0 ; <nl> + CursorResponseBuilder nextBatch ( / * isInitialResponse * / false , & result ) ; <nl> + BSONObj obj ; <nl> + PlanExecutor : : ExecState state = PlanExecutor : : ADVANCED ; <nl> + long long numResults = 0 ; <nl> <nl> - auto planSummary = Explain : : getPlanSummary ( exec ) ; <nl> - { <nl> - stdx : : lock_guard < Client > lk ( * opCtx - > getClient ( ) ) ; <nl> - curOp - > setPlanSummary_inlock ( planSummary ) ; <nl> + / / We report keysExamined and docsExamined to OpDebug for a given getMore operation . To <nl> + / / obtain these values we need to take a diff of the pre - execution and post - execution <nl> + / / metrics , as they accumulate over the course of a cursor ' s lifetime . <nl> + PlanSummaryStats preExecutionStats ; <nl> + Explain : : getSummaryStats ( * exec , & preExecutionStats ) ; <nl> <nl> - / / Ensure that the original query or command object is available in the slow query log , <nl> - / / profiler and currentOp . <nl> - auto originatingCommand = cursor - > getOriginatingCommandObj ( ) ; <nl> - if ( ! originatingCommand . isEmpty ( ) ) { <nl> - curOp - > setOriginatingCommand_inlock ( originatingCommand ) ; <nl> + / / Mark this as an AwaitData operation if appropriate . <nl> + if ( cursor - > isAwaitData ( ) & & ! disableAwaitDataFailpointActive ) { <nl> + if ( _request . lastKnownCommittedOpTime ) <nl> + clientsLastKnownCommittedOpTime ( opCtx ) = <nl> + _request . lastKnownCommittedOpTime . get ( ) ; <nl> + awaitDataState ( opCtx ) . shouldWaitForInserts = true ; <nl> } <nl> - } <nl> <nl> - CursorId respondWithId = 0 ; <nl> - CursorResponseBuilder nextBatch ( / * isInitialResponse * / false , & result ) ; <nl> - BSONObj obj ; <nl> - PlanExecutor : : ExecState state = PlanExecutor : : ADVANCED ; <nl> - long long numResults = 0 ; <nl> - <nl> - / / We report keysExamined and docsExamined to OpDebug for a given getMore operation . To <nl> - / / obtain these values we need to take a diff of the pre - execution and post - execution <nl> - / / metrics , as they accumulate over the course of a cursor ' s lifetime . <nl> - PlanSummaryStats preExecutionStats ; <nl> - Explain : : getSummaryStats ( * exec , & preExecutionStats ) ; <nl> - <nl> - / / Mark this as an AwaitData operation if appropriate . <nl> - if ( cursor - > isAwaitData ( ) & & ! disableAwaitDataFailpointActive ) { <nl> - if ( request . lastKnownCommittedOpTime ) <nl> - clientsLastKnownCommittedOpTime ( opCtx ) = request . lastKnownCommittedOpTime . get ( ) ; <nl> - awaitDataState ( opCtx ) . shouldWaitForInserts = true ; <nl> - } <nl> + / / We ' re about to begin running the PlanExecutor in order to fill the getMore batch . If <nl> + / / the <nl> + / / ' waitWithPinnedCursorDuringGetMoreBatch ' failpoint is active , set the ' msg ' field of <nl> + / / this <nl> + / / operation ' s CurOp to signal that we ' ve hit this point and then spin until the <nl> + / / failpoint <nl> + / / is released . <nl> + if ( MONGO_FAIL_POINT ( waitWithPinnedCursorDuringGetMoreBatch ) ) { <nl> + CurOpFailpointHelpers : : waitWhileFailPointEnabled ( <nl> + & waitWithPinnedCursorDuringGetMoreBatch , <nl> + opCtx , <nl> + " waitWithPinnedCursorDuringGetMoreBatch " , <nl> + dropAndReaquireReadLock ) ; <nl> + } <nl> <nl> - / / We ' re about to begin running the PlanExecutor in order to fill the getMore batch . If the <nl> - / / ' waitWithPinnedCursorDuringGetMoreBatch ' failpoint is active , set the ' msg ' field of this <nl> - / / operation ' s CurOp to signal that we ' ve hit this point and then spin until the failpoint <nl> - / / is released . <nl> - if ( MONGO_FAIL_POINT ( waitWithPinnedCursorDuringGetMoreBatch ) ) { <nl> - CurOpFailpointHelpers : : waitWhileFailPointEnabled ( <nl> - & waitWithPinnedCursorDuringGetMoreBatch , <nl> - opCtx , <nl> - " waitWithPinnedCursorDuringGetMoreBatch " , <nl> - dropAndReaquireReadLock ) ; <nl> - } <nl> + uassertStatusOK ( <nl> + generateBatch ( opCtx , cursor , _request , & nextBatch , & state , & numResults ) ) ; <nl> + <nl> + PlanSummaryStats postExecutionStats ; <nl> + Explain : : getSummaryStats ( * exec , & postExecutionStats ) ; <nl> + postExecutionStats . totalKeysExamined - = preExecutionStats . totalKeysExamined ; <nl> + postExecutionStats . totalDocsExamined - = preExecutionStats . totalDocsExamined ; <nl> + curOp - > debug ( ) . setPlanSummaryMetrics ( postExecutionStats ) ; <nl> + <nl> + / / We do not report ' execStats ' for aggregation or other globally managed cursors , both <nl> + / / in <nl> + / / the original request and subsequent getMore . It would be useful to have this <nl> + / / information <nl> + / / for an aggregation , but the source PlanExecutor could be destroyed before we know <nl> + / / whether <nl> + / / we need execStats and we do not want to generate for all operations due to cost . <nl> + if ( ! CursorManager : : isGloballyManagedCursor ( _request . cursorid ) & & <nl> + curOp - > shouldDBProfile ( ) ) { <nl> + BSONObjBuilder execStatsBob ; <nl> + Explain : : getWinningPlanStats ( exec , & execStatsBob ) ; <nl> + curOp - > debug ( ) . execStats = execStatsBob . obj ( ) ; <nl> + } <nl> <nl> - Status batchStatus = generateBatch ( opCtx , cursor , request , & nextBatch , & state , & numResults ) ; <nl> - uassertStatusOK ( batchStatus ) ; <nl> - <nl> - PlanSummaryStats postExecutionStats ; <nl> - Explain : : getSummaryStats ( * exec , & postExecutionStats ) ; <nl> - postExecutionStats . totalKeysExamined - = preExecutionStats . totalKeysExamined ; <nl> - postExecutionStats . totalDocsExamined - = preExecutionStats . totalDocsExamined ; <nl> - curOp - > debug ( ) . setPlanSummaryMetrics ( postExecutionStats ) ; <nl> - <nl> - / / We do not report ' execStats ' for aggregation or other globally managed cursors , both in <nl> - / / the original request and subsequent getMore . It would be useful to have this information <nl> - / / for an aggregation , but the source PlanExecutor could be destroyed before we know whether <nl> - / / we need execStats and we do not want to generate for all operations due to cost . <nl> - if ( ! CursorManager : : isGloballyManagedCursor ( request . cursorid ) & & curOp - > shouldDBProfile ( ) ) { <nl> - BSONObjBuilder execStatsBob ; <nl> - Explain : : getWinningPlanStats ( exec , & execStatsBob ) ; <nl> - curOp - > debug ( ) . execStats = execStatsBob . obj ( ) ; <nl> - } <nl> + if ( shouldSaveCursorGetMore ( state , exec , cursor - > isTailable ( ) ) ) { <nl> + respondWithId = _request . cursorid ; <nl> <nl> - if ( shouldSaveCursorGetMore ( state , exec , cursor - > isTailable ( ) ) ) { <nl> - respondWithId = request . cursorid ; <nl> + exec - > saveState ( ) ; <nl> + exec - > detachFromOperationContext ( ) ; <nl> <nl> - exec - > saveState ( ) ; <nl> - exec - > detachFromOperationContext ( ) ; <nl> + cursor - > setLeftoverMaxTimeMicros ( opCtx - > getRemainingMaxTimeMicros ( ) ) ; <nl> + cursor - > incPos ( numResults ) ; <nl> + } else { <nl> + curOp - > debug ( ) . cursorExhausted = true ; <nl> + } <nl> <nl> - cursor - > setLeftoverMaxTimeMicros ( opCtx - > getRemainingMaxTimeMicros ( ) ) ; <nl> - cursor - > incPos ( numResults ) ; <nl> - } else { <nl> - curOp - > debug ( ) . cursorExhausted = true ; <nl> - } <nl> + nextBatch . done ( respondWithId , _request . nss . ns ( ) ) ; <nl> <nl> - nextBatch . done ( respondWithId , request . nss . ns ( ) ) ; <nl> + / / Ensure log and profiler include the number of results returned in this getMore ' s <nl> + / / response <nl> + / / batch . <nl> + curOp - > debug ( ) . nreturned = numResults ; <nl> <nl> - / / Ensure log and profiler include the number of results returned in this getMore ' s response <nl> - / / batch . <nl> - curOp - > debug ( ) . nreturned = numResults ; <nl> + if ( respondWithId ) { <nl> + cursorFreer . Dismiss ( ) ; <nl> + } <nl> <nl> - if ( respondWithId ) { <nl> - cursorFreer . Dismiss ( ) ; <nl> + / / We ' re about to unpin the cursor as the ClientCursorPin goes out of scope ( or delete <nl> + / / it , <nl> + / / if it has been exhausted ) . If the <nl> + / / ' waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch ' <nl> + / / failpoint is active , set the ' msg ' field of this operation ' s CurOp to signal that <nl> + / / we ' ve <nl> + / / hit this point and then spin until the failpoint is released . <nl> + if ( MONGO_FAIL_POINT ( waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch ) ) { <nl> + CurOpFailpointHelpers : : waitWhileFailPointEnabled ( <nl> + & waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch , <nl> + opCtx , <nl> + " waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch " , <nl> + dropAndReaquireReadLock ) ; <nl> + } <nl> } <nl> <nl> - / / We ' re about to unpin the cursor as the ClientCursorPin goes out of scope ( or delete it , <nl> - / / if it has been exhausted ) . If the ' waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch ' <nl> - / / failpoint is active , set the ' msg ' field of this operation ' s CurOp to signal that we ' ve <nl> - / / hit this point and then spin until the failpoint is released . <nl> - if ( MONGO_FAIL_POINT ( waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch ) ) { <nl> - CurOpFailpointHelpers : : waitWhileFailPointEnabled ( <nl> - & waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch , <nl> - opCtx , <nl> - " waitBeforeUnpinningOrDeletingCursorAfterGetMoreBatch " , <nl> - dropAndReaquireReadLock ) ; <nl> - } <nl> + const GetMoreRequest _request ; <nl> + } ; <nl> <nl> - return true ; <nl> + bool maintenanceOk ( ) const override { <nl> + return false ; <nl> } <nl> <nl> - bool run ( OperationContext * opCtx , <nl> - const std : : string & dbname , <nl> - const BSONObj & cmdObj , <nl> - BSONObjBuilder & result ) override { <nl> - / / Counted as a getMore , not as a command . <nl> - globalOpCounters . gotGetMore ( ) ; <nl> - <nl> - StatusWith < GetMoreRequest > parsedRequest = GetMoreRequest : : parseFromBSON ( dbname , cmdObj ) ; <nl> - uassertStatusOK ( parsedRequest . getStatus ( ) ) ; <nl> - auto request = parsedRequest . getValue ( ) ; <nl> - return runParsed ( opCtx , request . nss , request , cmdObj , result ) ; <nl> + AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> + return AllowedOnSecondary : : kAlways ; <nl> } <nl> <nl> - / * * <nl> - * Uses ' cursor ' and ' request ' to fill out ' nextBatch ' with the batch of result documents to <nl> - * be returned by this getMore . <nl> - * <nl> - * Returns the number of documents in the batch in * numResults , which must be initialized to <nl> - * zero by the caller . Returns the final ExecState returned by the cursor in * state . <nl> - * <nl> - * Returns an OK status if the batch was successfully generated , and a non - OK status if the <nl> - * PlanExecutor encounters a failure . <nl> - * / <nl> - Status generateBatch ( OperationContext * opCtx , <nl> - ClientCursor * cursor , <nl> - const GetMoreRequest & request , <nl> - CursorResponseBuilder * nextBatch , <nl> - PlanExecutor : : ExecState * state , <nl> - long long * numResults ) { <nl> - PlanExecutor * exec = cursor - > getExecutor ( ) ; <nl> - <nl> - / / If an awaitData getMore is killed during this process due to our max time expiring at <nl> - / / an interrupt point , we just continue as normal and return rather than reporting a <nl> - / / timeout to the user . <nl> - BSONObj obj ; <nl> - try { <nl> - while ( ! FindCommon : : enoughForGetMore ( request . batchSize . value_or ( 0 ) , * numResults ) & & <nl> - PlanExecutor : : ADVANCED = = ( * state = exec - > getNext ( & obj , NULL ) ) ) { <nl> - / / If adding this object will cause us to exceed the message size limit , then we <nl> - / / stash it for later . <nl> - if ( ! FindCommon : : haveSpaceForNext ( obj , * numResults , nextBatch - > bytesUsed ( ) ) ) { <nl> - exec - > enqueue ( obj ) ; <nl> - break ; <nl> - } <nl> + ReadWriteType getReadWriteType ( ) const { <nl> + return ReadWriteType : : kRead ; <nl> + } <nl> <nl> - / / As soon as we get a result , this operation no longer waits . <nl> - awaitDataState ( opCtx ) . shouldWaitForInserts = false ; <nl> - / / Add result to output buffer . <nl> - nextBatch - > setLatestOplogTimestamp ( exec - > getLatestOplogTimestamp ( ) ) ; <nl> - nextBatch - > append ( obj ) ; <nl> - ( * numResults ) + + ; <nl> - } <nl> - } catch ( const ExceptionFor < ErrorCodes : : CloseChangeStream > & ) { <nl> - / / FAILURE state will make getMore command close the cursor even if it ' s tailable . <nl> - * state = PlanExecutor : : FAILURE ; <nl> - return Status : : OK ( ) ; <nl> - } <nl> + std : : string help ( ) const override { <nl> + return " retrieve more results from an existing cursor " ; <nl> + } <nl> <nl> - switch ( * state ) { <nl> - case PlanExecutor : : FAILURE : <nl> - / / Log an error message and then perform the same cleanup as DEAD . <nl> - error ( ) < < " GetMore command executor error : " < < PlanExecutor : : statestr ( * state ) <nl> - < < " , stats : " < < redact ( Explain : : getWinningPlanStats ( exec ) ) ; <nl> - case PlanExecutor : : DEAD : { <nl> - nextBatch - > abandon ( ) ; <nl> - / / We should always have a valid status member object at this point . <nl> - auto status = WorkingSetCommon : : getMemberObjectStatus ( obj ) ; <nl> - invariant ( ! status . isOK ( ) ) ; <nl> - return status ; <nl> - } <nl> - case PlanExecutor : : IS_EOF : <nl> - / / This causes the reported latest oplog timestamp to advance even when there are <nl> - / / no results for this particular query . <nl> - nextBatch - > setLatestOplogTimestamp ( exec - > getLatestOplogTimestamp ( ) ) ; <nl> - default : <nl> - return Status : : OK ( ) ; <nl> - } <nl> + LogicalOp getLogicalOp ( ) const override { <nl> + return LogicalOp : : opGetMore ; <nl> + } <nl> <nl> - MONGO_UNREACHABLE ; <nl> + std : : size_t reserveBytesForReply ( ) const override { <nl> + / / The extra 1K is an artifact of how we construct batches . We consider a batch to be full <nl> + / / when it exceeds the goal batch size . In the case that we are just below the limit and <nl> + / / then read a large document , the extra 1K helps prevent a final realloc + memcpy . <nl> + return FindCommon : : kMaxBytesToReturnToClientAtOnce + 1024u ; <nl> } <nl> <nl> + / * * <nl> + * A getMore command increments the getMore counter , not the command counter . <nl> + * / <nl> + bool shouldAffectCommandCounter ( ) const override { <nl> + return false ; <nl> + } <nl> + <nl> + bool adminOnly ( ) const override { <nl> + return false ; <nl> + } <nl> } getMoreCmd ; <nl> <nl> } / / namespace <nl> mmm a / src / mongo / db / query / getmore_request . cpp <nl> ppp b / src / mongo / db / query / getmore_request . cpp <nl> Status GetMoreRequest : : isValid ( ) const { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - / / static <nl> - NamespaceString GetMoreRequest : : parseNs ( const std : : string & dbname , const BSONObj & cmdObj ) { <nl> - BSONElement collElt = cmdObj [ " collection " ] ; <nl> - const std : : string coll = ( collElt . type ( ) = = BSONType : : String ) ? collElt . String ( ) : " " ; <nl> - <nl> - return NamespaceString ( dbname , coll ) ; <nl> - } <nl> - <nl> / / static <nl> StatusWith < GetMoreRequest > GetMoreRequest : : parseFromBSON ( const std : : string & dbname , <nl> const BSONObj & cmdObj ) { <nl> - invariant ( ! dbname . empty ( ) ) ; <nl> - <nl> / / Required fields . <nl> boost : : optional < CursorId > cursorid ; <nl> boost : : optional < NamespaceString > nss ; <nl> StatusWith < GetMoreRequest > GetMoreRequest : : parseFromBSON ( const std : : string & dbna <nl> < < cmdObj } ; <nl> } <nl> <nl> - nss = parseNs ( dbname , cmdObj ) ; <nl> + BSONElement collElt = cmdObj [ " collection " ] ; <nl> + const std : : string coll = ( collElt . type ( ) = = BSONType : : String ) ? collElt . String ( ) : " " ; <nl> + nss = NamespaceString ( dbname , coll ) ; <nl> } else if ( fieldName = = kBatchSizeField ) { <nl> if ( ! el . isNumber ( ) ) { <nl> return { ErrorCodes : : TypeMismatch , <nl> mmm a / src / mongo / db / query / getmore_request . h <nl> ppp b / src / mongo / db / query / getmore_request . h <nl> struct GetMoreRequest { <nl> * / <nl> BSONObj toBSON ( ) const ; <nl> <nl> - static NamespaceString parseNs ( const std : : string & dbname , const BSONObj & cmdObj ) ; <nl> - <nl> const NamespaceString nss ; <nl> const CursorId cursorid ; <nl> <nl> mmm a / src / mongo / s / commands / cluster_getmore_cmd . cpp <nl> ppp b / src / mongo / s / commands / cluster_getmore_cmd . cpp <nl> namespace { <nl> * corresponding to the cursor id passed from the application . In order to generate these results , <nl> * may issue getMore commands to remote nodes in one or more shards . <nl> * / <nl> - class ClusterGetMoreCmd final : public BasicCommand { <nl> - MONGO_DISALLOW_COPYING ( ClusterGetMoreCmd ) ; <nl> - <nl> + class ClusterGetMoreCmd final : public Command { <nl> public : <nl> - ClusterGetMoreCmd ( ) : BasicCommand ( " getMore " ) { } <nl> + ClusterGetMoreCmd ( ) : Command ( " getMore " ) { } <nl> <nl> - std : : string parseNs ( const std : : string & dbname , const BSONObj & cmdObj ) const final { <nl> - return GetMoreRequest : : parseNs ( dbname , cmdObj ) . ns ( ) ; <nl> + std : : unique_ptr < CommandInvocation > parse ( OperationContext * opCtx , <nl> + const OpMsgRequest & opMsgRequest ) override { <nl> + return std : : make_unique < Invocation > ( this , opMsgRequest ) ; <nl> } <nl> <nl> - virtual bool supportsWriteConcern ( const BSONObj & cmd ) const override { <nl> - return false ; <nl> - } <nl> + class Invocation final : public CommandInvocation { <nl> + public : <nl> + Invocation ( Command * cmd , const OpMsgRequest & request ) <nl> + : CommandInvocation ( cmd ) , <nl> + _request ( uassertStatusOK ( <nl> + GetMoreRequest : : parseFromBSON ( request . getDatabase ( ) . toString ( ) , request . body ) ) ) { } <nl> + <nl> + private : <nl> + NamespaceString ns ( ) const override { <nl> + return _request . nss ; <nl> + } <nl> + <nl> + bool supportsWriteConcern ( ) const override { <nl> + return false ; <nl> + } <nl> + <nl> + void doCheckAuthorization ( OperationContext * opCtx ) const override { <nl> + uassertStatusOK ( AuthorizationSession : : get ( opCtx - > getClient ( ) ) <nl> + - > checkAuthForGetMore ( _request . nss , <nl> + _request . cursorid , <nl> + _request . term . is_initialized ( ) ) ) ; <nl> + } <nl> + <nl> + void run ( OperationContext * opCtx , rpc : : ReplyBuilderInterface * reply ) override { <nl> + / / Counted as a getMore , not as a command . <nl> + globalOpCounters . gotGetMore ( ) ; <nl> + auto bob = reply - > getBodyBuilder ( ) ; <nl> + auto response = uassertStatusOK ( ClusterFind : : runGetMore ( opCtx , _request ) ) ; <nl> + response . addToBSON ( CursorResponse : : ResponseType : : SubsequentResponse , & bob ) ; <nl> + } <nl> <nl> - AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const final { <nl> + const GetMoreRequest _request ; <nl> + } ; <nl> + <nl> + AllowedOnSecondary secondaryAllowed ( ServiceContext * ) const override { <nl> return AllowedOnSecondary : : kAlways ; <nl> } <nl> <nl> - bool maintenanceOk ( ) const final { <nl> + bool maintenanceOk ( ) const override { <nl> return false ; <nl> } <nl> <nl> - bool adminOnly ( ) const final { <nl> + bool adminOnly ( ) const override { <nl> return false ; <nl> } <nl> <nl> / * * <nl> * A getMore command increments the getMore counter , not the command counter . <nl> * / <nl> - bool shouldAffectCommandCounter ( ) const final { <nl> + bool shouldAffectCommandCounter ( ) const override { <nl> return false ; <nl> } <nl> <nl> - std : : string help ( ) const final { <nl> + std : : string help ( ) const override { <nl> return " retrieve more documents for a cursor id " ; <nl> } <nl> <nl> - LogicalOp getLogicalOp ( ) const final { <nl> + LogicalOp getLogicalOp ( ) const override { <nl> return LogicalOp : : opGetMore ; <nl> } <nl> - <nl> - Status checkAuthForCommand ( Client * client , <nl> - const std : : string & dbname , <nl> - const BSONObj & cmdObj ) const final { <nl> - StatusWith < GetMoreRequest > parseStatus = GetMoreRequest : : parseFromBSON ( dbname , cmdObj ) ; <nl> - if ( ! parseStatus . isOK ( ) ) { <nl> - return parseStatus . getStatus ( ) ; <nl> - } <nl> - const GetMoreRequest & request = parseStatus . getValue ( ) ; <nl> - <nl> - return AuthorizationSession : : get ( client ) - > checkAuthForGetMore ( <nl> - request . nss , request . cursorid , request . term . is_initialized ( ) ) ; <nl> - } <nl> - <nl> - bool run ( OperationContext * opCtx , <nl> - const std : : string & dbname , <nl> - const BSONObj & cmdObj , <nl> - BSONObjBuilder & result ) final { <nl> - / / Counted as a getMore , not as a command . <nl> - globalOpCounters . gotGetMore ( ) ; <nl> - <nl> - StatusWith < GetMoreRequest > parseStatus = GetMoreRequest : : parseFromBSON ( dbname , cmdObj ) ; <nl> - uassertStatusOK ( parseStatus . getStatus ( ) ) ; <nl> - const GetMoreRequest & request = parseStatus . getValue ( ) ; <nl> - <nl> - auto response = ClusterFind : : runGetMore ( opCtx , request ) ; <nl> - uassertStatusOK ( response . getStatus ( ) ) ; <nl> - <nl> - response . getValue ( ) . addToBSON ( CursorResponse : : ResponseType : : SubsequentResponse , & result ) ; <nl> - return true ; <nl> - } <nl> - <nl> } cmdGetMoreCluster ; <nl> <nl> } / / namespace <nl>
SERVER - 35911 Upgraded GetMoreCmd and ClusterGetMoreCmd to use TypedCommand
mongodb/mongo
143b979d16031cdcb0d4b6ecc70a11da52822960
2018-07-11T17:51:43Z
mmm a / test / test_distributed . py <nl> ppp b / test / test_distributed . py <nl> def wrapper ( * args , * * kwargs ) : <nl> return wrapper <nl> <nl> <nl> + def require_backend ( backends ) : <nl> + if BACKEND not in backends : <nl> + return unittest . skip ( " Test requires backend to be one of % s " % backends ) <nl> + return lambda func : func <nl> + <nl> + <nl> + def require_backends_available ( backends ) : <nl> + def check ( backend ) : <nl> + if backend = = dist . Backend . GLOO : <nl> + return dist . is_gloo_available ( ) <nl> + if backend = = dist . Backend . NCCL : <nl> + return dist . is_nccl_available ( ) <nl> + if backend = = dist . Backend . MPI : <nl> + return dist . is_mpi_available ( ) <nl> + return False <nl> + backends = map ( lambda b : dist . Backend ( b ) , backends ) <nl> + if not all ( map ( check , backends ) ) : <nl> + return unittest . skip ( <nl> + " Test requires backends to be available % s " % backends ) <nl> + return lambda func : func <nl> + <nl> + <nl> + def require_world_size ( world_size ) : <nl> + if int ( os . environ [ " WORLD_SIZE " ] ) < world_size : <nl> + return unittest . skip ( " Test requires world size of % d " % world_size ) <nl> + return lambda func : func <nl> + <nl> + <nl> + def require_num_gpus ( n ) : <nl> + " " " <nl> + Require environment to have access to at least ` n ` GPUs . <nl> + Test is skipped otherwise . <nl> + <nl> + Note : this check cannot run in the parent process , because calling <nl> + ` torch . cuda . is_initialized ( ) ` will cause lazy initialization of a <nl> + CUDA runtime API context , and CUDA doesn ' t support forking . <nl> + " " " <nl> + def decorator ( func ) : <nl> + func . skip_if_no_gpu = True <nl> + <nl> + @ wraps ( func ) <nl> + def wrapper ( * args , * * kwargs ) : <nl> + if not torch . cuda . is_available ( ) : <nl> + sys . exit ( SKIP_IF_NO_CUDA_EXIT_CODE ) <nl> + if torch . cuda . device_count ( ) < n : <nl> + sys . exit ( SKIP_IF_NO_GPU_EXIT_CODE ) <nl> + return func ( * args , * * kwargs ) <nl> + return wrapper <nl> + <nl> + return decorator <nl> + <nl> + <nl> def apply_hack_for_nccl ( ) : <nl> # This is a hack for a known NCCL issue using multiprocess <nl> # in conjunction with multiple threads to manage different GPUs which <nl> def test_barrier_timeout_full_group ( self ) : <nl> if group_id is not None : <nl> self . _test_barrier_timeout ( group_id , timeout ) <nl> <nl> + # This test helper can only be used when using the Gloo or NCCL backend <nl> + # * * and * * both the Gloo and NCCL backends are available . <nl> + # See the @ skip annotations below . <nl> + def _test_group_override_backend ( self , initializer ) : <nl> + if BACKEND = = " gloo " : <nl> + new_backend = " nccl " <nl> + if BACKEND = = " nccl " : <nl> + new_backend = " gloo " <nl> + <nl> + group , group_id , rank = initializer ( backend = new_backend ) <nl> + if group_id is None : <nl> + return <nl> + <nl> + if new_backend = = " gloo " : <nl> + self . assertTrue ( isinstance ( group_id , dist . ProcessGroupGloo ) ) <nl> + if new_backend = = " nccl " : <nl> + self . assertTrue ( isinstance ( group_id , dist . ProcessGroupNCCL ) ) <nl> + <nl> + self . assertEqual ( rank , group [ dist . get_rank ( group_id ) ] ) <nl> + self . assertEqual ( len ( group ) , dist . get_world_size ( group_id ) ) <nl> + <nl> + # Pin device ( so we avoid NCCL race conditions / deadlocks ) . <nl> + group_rank = dist . get_rank ( group_id ) <nl> + torch . cuda . set_device ( group_rank ) <nl> + <nl> + # Run broadcast of CUDA tensor ( so it works for both Gloo and NCCL ) . <nl> + tensor = _build_tensor ( 2 , value = group_rank ) . cuda ( ) <nl> + dist . broadcast ( tensor , src = group [ 0 ] , group = group_id ) <nl> + self . assertEqual ( _build_tensor ( 2 , value = 0 ) , tensor . to ( " cpu " ) ) <nl> + <nl> + @ require_backend ( { " gloo " , " nccl " } ) <nl> + @ require_backends_available ( { " gloo " , " nccl " } ) <nl> + @ require_world_size ( 3 ) <nl> + @ require_num_gpus ( 2 ) <nl> + def test_backend_group ( self ) : <nl> + self . _test_group_override_backend ( self . _init_group_test ) <nl> + <nl> + @ require_backend ( { " gloo " , " nccl " } ) <nl> + @ require_backends_available ( { " gloo " , " nccl " } ) <nl> + @ require_num_gpus ( 3 ) <nl> + def test_backend_full_group ( self ) : <nl> + self . _test_group_override_backend ( self . _init_full_group_test ) <nl> + <nl> # SEND RECV <nl> @ unittest . skipIf ( BACKEND = = " nccl " , " Nccl does not support send / recv " ) <nl> def test_send_recv ( self ) : <nl> def setUpClass ( cls ) : <nl> for attr in dir ( cls ) : <nl> if attr . startswith ( " test " ) : <nl> fn = getattr ( cls , attr ) <nl> - setattr ( cls , attr , cls . manager_join ( fn ) ) <nl> + if not getattr ( fn , " __unittest_skip__ " , False ) : <nl> + setattr ( cls , attr , cls . manager_join ( fn ) ) <nl> <nl> def setUp ( self ) : <nl> super ( TestDistBackend , self ) . setUp ( ) <nl> mmm a / torch / distributed / distributed_c10d . py <nl> ppp b / torch / distributed / distributed_c10d . py <nl> <nl> ScatterOptions , GatherOptions <nl> from . import ReduceOp <nl> from . import PrefixStore <nl> - from . import ProcessGroupGloo <nl> <nl> <nl> _MPI_AVAILABLE = True <nl> _NCCL_AVAILABLE = True <nl> + _GLOO_AVAILABLE = True <nl> <nl> <nl> try : <nl> <nl> except ImportError : <nl> _NCCL_AVAILABLE = False <nl> <nl> + try : <nl> + from . import ProcessGroupGloo <nl> + except ImportError : <nl> + _GLOO_AVAILABLE = False <nl> + <nl> <nl> class Backend ( object ) : <nl> " " " <nl> def _check_tensor_list ( param , param_name ) : <nl> <nl> def is_mpi_available ( ) : <nl> " " " <nl> - Checks if MPI is available <nl> + Checks if the MPI backend is available . <nl> <nl> " " " <nl> return _MPI_AVAILABLE <nl> def is_mpi_available ( ) : <nl> <nl> def is_nccl_available ( ) : <nl> " " " <nl> - Checks if NCCL is available <nl> + Checks if the NCCL backend is available . <nl> <nl> " " " <nl> return _NCCL_AVAILABLE <nl> <nl> <nl> + def is_gloo_available ( ) : <nl> + " " " <nl> + Checks if the Gloo backend is available . <nl> + <nl> + " " " <nl> + return _GLOO_AVAILABLE <nl> + <nl> + <nl> def is_initialized ( ) : <nl> " " " <nl> Checking if the default process group has been initialized <nl> def _new_process_group_helper ( world_size , <nl> group_ranks , <nl> in_group , <nl> group_name , <nl> - timeout = _default_pg_timeout ) : <nl> + timeout = _default_pg_timeout , <nl> + backend = None ) : <nl> " " " <nl> Create a new distributed process group . And the new process group can be <nl> used to perform collective operations . <nl> def _new_process_group_helper ( world_size , <nl> " datetime . timedelta " ) <nl> <nl> default_backend , default_store = _pg_map [ _default_pg ] <nl> + if backend is None : <nl> + backend = default_backend <nl> + else : <nl> + backend = Backend ( backend ) <nl> <nl> - if default_backend = = Backend . MPI : <nl> + if backend = = Backend . MPI : <nl> if not is_mpi_available ( ) : <nl> raise RuntimeError ( " Distributed package doesn ' t have MPI built in " ) <nl> pg = ProcessGroupMPI ( group_ranks ) <nl> def _new_process_group_helper ( world_size , <nl> # Create the prefix store <nl> store = PrefixStore ( group_name , default_store ) <nl> <nl> - if default_backend = = Backend . GLOO : <nl> + if backend = = Backend . GLOO : <nl> pg = ProcessGroupGloo ( <nl> store , <nl> rank , <nl> def _new_process_group_helper ( world_size , <nl> timeout = timeout ) <nl> _pg_map [ pg ] = ( Backend . GLOO , store ) <nl> _pg_names [ pg ] = group_name <nl> - elif default_backend = = Backend . NCCL : <nl> + elif backend = = Backend . NCCL : <nl> if not is_nccl_available ( ) : <nl> raise RuntimeError ( " Distributed package doesn ' t have NCCL " <nl> " built in " ) <nl> def barrier ( group = group . WORLD , <nl> work . wait ( ) <nl> <nl> <nl> - def new_group ( ranks = None , timeout = _default_pg_timeout ) : <nl> + def new_group ( ranks = None , timeout = _default_pg_timeout , backend = None ) : <nl> " " " <nl> Creates a new distributed group . <nl> <nl> def new_group ( ranks = None , timeout = _default_pg_timeout ) : <nl> timeout ( timedelta , optional ) : Timeout for operations executed against <nl> the process group . Default value equals 30 minutes . <nl> This is only applicable for the ` ` gloo ` ` backend . <nl> + backend ( str or Backend , optional ) : The backend to use . Depending on <nl> + build - time configurations , valid values are ` ` gloo ` ` and ` ` nccl ` ` . <nl> + By default uses the same backend as the global group . This field <nl> + should be given as a lowercase string ( e . g . , ` ` " gloo " ` ` ) , which can <nl> + also be accessed via : class : ` Backend ` attributes ( e . g . , <nl> + ` ` Backend . GLOO ` ` ) . <nl> <nl> Returns : <nl> A handle of distributed group that can be given to collective calls . <nl> def new_group ( ranks = None , timeout = _default_pg_timeout ) : <nl> return GroupMember . NON_GROUP_MEMBER <nl> <nl> if default_backend ! = Backend . MPI : <nl> + if backend is None : <nl> + backend = default_backend <nl> pg = _new_process_group_helper ( group_world_size , <nl> group_rank , <nl> input_ranks , <nl> True , <nl> group_name , <nl> - timeout = timeout ) <nl> + timeout = timeout , <nl> + backend = backend ) <nl> <nl> # Create the global rank to group rank mapping <nl> _pg_group_ranks [ pg ] = { } <nl>
Allow override of backend in dist . new_group ( ) ( )
pytorch/pytorch
7a19d3c9e1975742d4a11ab4c3250796c57c4593
2019-04-04T21:23:03Z
mmm a / include / grpc + + / impl / grpc_library . h <nl> ppp b / include / grpc + + / impl / grpc_library . h <nl> static CoreCodegen g_core_codegen ; <nl> class GrpcLibraryInitializer GRPC_FINAL { <nl> public : <nl> GrpcLibraryInitializer ( ) { <nl> - grpc : : g_glip = & g_gli ; <nl> - grpc : : g_core_codegen_interface = & g_core_codegen ; <nl> + if ( grpc : : g_glip = = nullptr ) { <nl> + grpc : : g_glip = & g_gli ; <nl> + } <nl> + if ( grpc : : g_core_codegen_interface = = nullptr ) { <nl> + grpc : : g_core_codegen_interface = & g_core_codegen ; <nl> + } <nl> } <nl> <nl> / / / A no - op method to force the linker to reference this class , which will <nl> mmm a / src / cpp / client / secure_credentials . cc <nl> ppp b / src / cpp / client / secure_credentials . cc <nl> std : : shared_ptr < grpc : : Channel > SecureChannelCredentials : : CreateChannel ( <nl> <nl> SecureCallCredentials : : SecureCallCredentials ( grpc_call_credentials * c_creds ) <nl> : c_creds_ ( c_creds ) { <nl> - internal : : GrpcLibraryInitializer gli_initializer ; <nl> - gli_initializer . summon ( ) ; <nl> + g_gli_initializer . summon ( ) ; <nl> } <nl> <nl> bool SecureCallCredentials : : ApplyToCall ( grpc_call * call ) { <nl>
Merge remote - tracking branch ' dgq / fix - grpc - lib ' into make_clang_great_again_v2
grpc/grpc
2446114b8fa1f925f6497a2d8d420f37e547b7af
2016-03-19T13:22:00Z
mmm a / src / arch / io / disk . cc <nl> ppp b / src / arch / io / disk . cc <nl> void linux_file_t : : set_size ( size_t size ) { <nl> <nl> int fcntl_res ; <nl> do { <nl> - fcntl_res = fcntl ( fd , F_FULLFSYNC ) ; <nl> + fcntl_res = fcntl ( fd . get ( ) , F_FULLFSYNC ) ; <nl> } while ( fcntl_res = = - 1 & & errno = = EINTR ) ; <nl> <nl> # elif FILE_SYNC_TECHNIQUE = = FILE_SYNC_TECHNIQUE_DSYNC <nl>
Made the F_FULLFSYNC call on OS X after call to ftruncate actually compile ! * blush *
rethinkdb/rethinkdb
549f2bf417fcc9a8a2d74189725d62d0cb69cd32
2013-01-28T23:45:23Z
mmm a / . cicd / generate - pipeline . sh <nl> ppp b / . cicd / generate - pipeline . sh <nl> echo ' - wait ' <nl> echo ' ' <nl> # tests <nl> for RUN in $ ( seq 1 $ RUNS ) ; do <nl> + echo " # run group $ RUN of $ RUNS " <nl> # parallel tests <nl> echo ' # parallel tests ' <nl> echo $ PLATFORMS_JSON_ARRAY | jq - cr ' . [ ] ' | while read - r PLATFORM_JSON ; do <nl>
Print run group index in YAML comment
EOSIO/eos
14ed18cc354835abe8e955d43573812802959c38
2019-09-11T19:50:04Z
mmm a / src / rdb_protocol / func . cc <nl> ppp b / src / rdb_protocol / func . cc <nl> bool func_term_t : : is_deterministic_impl ( ) const { <nl> } <nl> <nl> bool func_t : : filter_call ( counted_t < const datum_t > arg ) { <nl> + / / We have to catch every exception type and save it so we can rethrow it later <nl> + / / So we don ' t trigger a coroutine wait in a catch statement <nl> + std : : exception_ptr saved_exception ; <nl> + base_exc_t : : type_t exception_type ; <nl> + <nl> try { <nl> counted_t < const datum_t > d = call ( arg ) - > as_datum ( ) ; <nl> if ( d - > get_type ( ) = = datum_t : : R_OBJECT & & <nl> bool func_t : : filter_call ( counted_t < const datum_t > arg ) { <nl> return d - > as_bool ( ) ; <nl> } <nl> } catch ( const base_exc_t & e ) { <nl> - if ( e . get_type ( ) = = base_exc_t : : NON_EXISTENCE ) { <nl> - / / If a non - existence error is thrown inside a ` filter ` , we return <nl> - / / the default value . Note that we will enter this branch if the <nl> - / / function passed to ` filter ` returns NULL , since the type error <nl> - / / above will produce a non - existence error in the case where ` d ` is <nl> - / / NULL . <nl> - try { <nl> - if ( default_filter_val ) { <nl> - return default_filter_val - > call ( ) - > as_bool ( ) ; <nl> - } else { <nl> - return false ; <nl> - } <nl> - } catch ( const base_exc_t & e2 ) { <nl> - if ( e2 . get_type ( ) ! = base_exc_t : : EMPTY_USER ) { <nl> - / / If the default value throws a non - EMPTY_USER exception , <nl> - / / we re - throw that exception . <nl> - throw ; <nl> - } <nl> + saved_exception = std : : current_exception ( ) ; <nl> + exception_type = e . get_type ( ) ; <nl> + } <nl> + <nl> + / / We can ' t call the default_filter_val earlier because it could block , <nl> + / / which would crash since we were in an exception handler <nl> + guarantee ( saved_exception ! = std : : exception_ptr ( ) ) ; <nl> + <nl> + if ( exception_type = = base_exc_t : : NON_EXISTENCE ) { <nl> + / / If a non - existence error is thrown inside a ` filter ` , we return <nl> + / / the default value . Note that we will enter this code if the <nl> + / / function passed to ` filter ` returns NULL , since the type error <nl> + / / above will produce a non - existence error in the case where ` d ` is <nl> + / / NULL . <nl> + try { <nl> + if ( default_filter_val ) { <nl> + return default_filter_val - > call ( ) - > as_bool ( ) ; <nl> + } else { <nl> + return false ; <nl> + } <nl> + } catch ( const base_exc_t & e ) { <nl> + if ( e . get_type ( ) ! = base_exc_t : : EMPTY_USER ) { <nl> + / / If the default value throws a non - EMPTY_USER exception , <nl> + / / we re - throw that exception . <nl> + throw ; <nl> } <nl> } <nl> - / / If we caught a non - NON_EXISTENCE exception or we caught a <nl> - / / NON_EXISTENCE exception and the default value threw an EMPTY_USER <nl> - / / exception , we re - throw the original exception . <nl> - throw ; <nl> } <nl> + <nl> + / / If we caught a non - NON_EXISTENCE exception or we caught a <nl> + / / NON_EXISTENCE exception and the default value threw an EMPTY_USER <nl> + / / exception , we re - throw the original exception . <nl> + std : : rethrow_exception ( saved_exception ) ; <nl> } <nl> <nl> counted_t < func_t > func_t : : new_constant_func ( env_t * env , counted_t < const datum_t > obj , <nl> counted_t < func_t > func_t : : new_pluck_func ( env_t * env , counted_t < const datum_t > ob <nl> protob_t < Term > twrap = make_counted_term ( ) ; <nl> Term * const arg = twrap . get ( ) ; <nl> int var = env - > gensym ( ) ; <nl> - N2 ( FUNC , N1 ( MAKE_ARRAY , NDATUM ( static_cast < double > ( var ) ) ) , <nl> + N2 ( FUNC , N1 ( MAKE_ARRAY , NDATUM ( static_cast < double > ( var ) ) ) , <nl> N2 ( PLUCK , NVAR ( var ) , NDATUM ( obj ) ) ) ; <nl> propagate_backtrace ( twrap . get ( ) , bt_src . get ( ) ) ; <nl> return make_counted < func_t > ( env , twrap ) ; <nl> mmm a / test / rql_test / src / default . yaml <nl> ppp b / test / rql_test / src / default . yaml <nl> tests : <nl> py : arr . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = True ) <nl> js : arr . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) } , { ' default ' : true } ) <nl> ot : [ { } , { ' a ' : 1 } ] # ` null ` compares not equal to 1 with no error <nl> + - cd : arr . filter ( : default = > r . js ( ' true ' ) ) { | x | x [ ' a ' ] . eq ( 1 ) } <nl> + py : arr . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = r . js ( ' true ' ) ) <nl> + js : arr . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) } , { ' default ' : r . js ( ' true ' ) } ) <nl> + ot : [ { } , { ' a ' : 1 } ] <nl> + - cd : arr . filter ( : default = > r . js ( ' false ' ) ) { | x | x [ ' a ' ] . eq ( 1 ) } <nl> + py : arr . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = r . js ( ' false ' ) ) <nl> + js : arr . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) } , { ' default ' : r . js ( ' false ' ) } ) <nl> + ot : [ { ' a ' : 1 } ] <nl> - cd : arr . filter ( : default = > r . error ) { | x | x [ ' a ' ] . eq ( 1 ) } <nl> py : arr . filter ( lambda x : x [ ' a ' ] . eq ( 1 ) , default = r . error ( ) ) <nl> js : arr . filter ( function ( x ) { return x ( ' a ' ) . eq ( 1 ) } , { ' default ' : r . error ( ) } ) <nl>
fixing crash on non - deterministic filter default value
rethinkdb/rethinkdb
7e3eb79dbfb67dd04d7fb7606e02a15d5d5e7fcd
2013-08-16T22:43:29Z
mmm a / docs - translations / ko - KR / api / browser - window . md <nl> ppp b / docs - translations / ko - KR / api / browser - window . md <nl> window . onbeforeunload = ( e ) = > { <nl> <nl> # # # # Event : ' blur ' <nl> <nl> - 윈도우가 포커스를 잃었을 떄 발생하는 이벤트입니다 . <nl> + 윈도우가 포커스를 잃었을 때 발생하는 이벤트입니다 . <nl> <nl> # # # # Event : ' focus ' <nl> <nl> mmm a / docs - translations / ko - KR / api / remote . md <nl> ppp b / docs - translations / ko - KR / api / remote . md <nl> win . loadURL ( ' https : / / github . com ' ) ; <nl> * * 참고 : * * remote 객체가 처음 참조될 때 표시되는 <nl> [ enumerable 속성 ] [ enumerable - properties ] 은 remote를 통해서만 접근할 수 있습니다 . <nl> <nl> - * * 참고 : * * 배열과 버퍼는 ` remote ` 모듈을 통해 접근할 떄 IPC 를 통해 <nl> + * * 참고 : * * 배열과 버퍼는 ` remote ` 모듈을 통해 접근할 때 IPC 를 통해 <nl> 복사됩니다 . 렌더러 프로세스에서의 수정은 메인 프로세스의 것을 수정하지 않으며 , <nl> 반대의 경우도 마찬가지 입니다 . <nl> <nl> mmm a / docs - translations / ko - KR / development / debug - instructions - macos . md <nl> ppp b / docs - translations / ko - KR / development / debug - instructions - macos . md <nl> Process 25244 stopped <nl> <nl> 디버깅을 끝내려면 , ` process continue ` 를 실행하세요 . 또한 쓰레드에서 실행 줄 <nl> 수를 지정할 수 있습니다 ( ` thread until 100 ` ) . 이 명령은 현재 프레임에서 100 줄에 <nl> - 도달하거나 현재 프레임을 나가려고 할 떄 까지 쓰레드를 실행합니다 . <nl> + 도달하거나 현재 프레임을 나가려고 할 때 까지 쓰레드를 실행합니다 . <nl> <nl> 이제 , Electron 의 개발자 도구를 열고 ` setName ` 을 호출하면 , 다시 중단점을 만날 <nl> 것 입니다 . <nl> mmm a / docs / tutorial / accessibility . md <nl> ppp b / docs / tutorial / accessibility . md <nl> In Devtron there is a new accessibility tab which will allow you to audit a page <nl> <nl> Both of these tools are using the [ Accessibility Developer Tools ] ( https : / / github . com / GoogleChrome / accessibility - developer - tools ) library built by Google for Chrome . You can learn more about the accessibility audit rules this library uses on that [ repository ' s wiki ] ( https : / / github . com / GoogleChrome / accessibility - developer - tools / wiki / Audit - Rules ) . <nl> <nl> - If you know of other great accessibility tools for Electron , add them to the [ accessibility documentation ] ( http : / / electron . atom . io / docs / tutorials / accessibility ) with a pull request . <nl> + If you know of other great accessibility tools for Electron , add them to the [ accessibility documentation ] ( http : / / electron . atom . io / docs / tutorial / accessibility ) with a pull request . <nl>
Fix errata
electron/electron
d7fc7ef2eeb45838cf17a7dedbd09ee06aaef6ef
2016-09-23T23:19:24Z
new file mode 100644 <nl> index 0000000000 . . 2f3302b2ec <nl> mmm / dev / null <nl> ppp b / change / react - native - windows - e6f9e1a2 - 9958 - 4c28 - af55 - 80100258ac48 . json <nl> <nl> + { <nl> + " type " : " prerelease " , <nl> + " comment " : " Add ReactContext : : ExecuteJsi method to use JSI in NativeModules " , <nl> + " packageName " : " react - native - windows " , <nl> + " email " : " vmorozov @ microsoft . com " , <nl> + " dependentChangeType " : " patch " <nl> + } <nl> mmm a / vnext / JSI / Shared / ChakraRuntime . cpp <nl> ppp b / vnext / JSI / Shared / ChakraRuntime . cpp <nl> JsValueRef CALLBACK ChakraRuntime : : HostFunctionCall ( <nl> return RunInMethodContext ( " HostObject : : get " , [ & ] ( ) { <nl> return chakraRuntime - > ToJsValueRef ( hostObject - > get ( * chakraRuntime , propertyId ) ) ; <nl> } ) ; <nl> - } else if ( <nl> - GetValueType ( propertyName ) = = JsValueType : : JsSymbol & & <nl> - GetPropertyIdFromSymbol ( propertyName ) = = chakraRuntime - > m_propertyId . hostObjectSymbol ) { <nl> - / / The special property to retrieve the target object . <nl> - return target ; <nl> + } else if ( GetValueType ( propertyName ) = = JsValueType : : JsSymbol ) { <nl> + const auto chakraPropertyId = GetPropertyIdFromSymbol ( propertyName ) ; <nl> + if ( chakraPropertyId = = chakraRuntime - > m_propertyId . hostObjectSymbol ) { <nl> + / / The special property to retrieve the target object . <nl> + return target ; <nl> + } else { <nl> + auto const & hostObject = * static_cast < std : : shared_ptr < facebook : : jsi : : HostObject > * > ( GetExternalData ( target ) ) ; <nl> + const PropNameIDView propertyId { chakraPropertyId } ; <nl> + return RunInMethodContext ( " HostObject : : get " , [ & ] ( ) { <nl> + return chakraRuntime - > ToJsValueRef ( hostObject - > get ( * chakraRuntime , propertyId ) ) ; <nl> + } ) ; <nl> + } <nl> } <nl> <nl> return static_cast < JsValueRef > ( chakraRuntime - > m_undefinedValue ) ; <nl> mmm a / vnext / Microsoft . ReactNative . Cxx . UnitTests / ReactContextTest . cpp <nl> ppp b / vnext / Microsoft . ReactNative . Cxx . UnitTests / ReactContextTest . cpp <nl> struct ReactContextStub : implements < ReactContextStub , IReactContext > { <nl> VerifyElseCrashSz ( false , " Not implemented " ) ; <nl> } <nl> <nl> + JsiRuntime JsiRuntime ( ) noexcept { <nl> + VerifyElseCrashSz ( false , " Not implemented " ) ; <nl> + } <nl> + <nl> void DispatchEvent ( <nl> xaml : : FrameworkElement const & / * view * / , <nl> hstring const & / * eventName * / , <nl> mmm a / vnext / Microsoft . ReactNative . Cxx . UnitTests / ReactModuleBuilderMock . h <nl> ppp b / vnext / Microsoft . ReactNative . Cxx . UnitTests / ReactModuleBuilderMock . h <nl> struct ReactContextMock : implements < ReactContextMock , IReactContext > { <nl> VerifyElseCrashSz ( false , " Not implemented " ) ; <nl> } <nl> <nl> + JsiRuntime JsiRuntime ( ) noexcept { <nl> + VerifyElseCrashSz ( false , " Not implemented " ) ; <nl> + } <nl> + <nl> void DispatchEvent ( <nl> xaml : : FrameworkElement const & / * view * / , <nl> hstring const & / * eventName * / , <nl> mmm a / vnext / Microsoft . ReactNative . Cxx / JSI / JsiAbiApi . cpp <nl> ppp b / vnext / Microsoft . ReactNative . Cxx / JSI / JsiAbiApi . cpp <nl> namespace winrt : : Microsoft : : ReactNative { <nl> <nl> / / The macro to simplify recording JSI exceptions . <nl> / / It looks strange to keep the normal structure of the try / catch in code . <nl> - # define JSI_RUNTIME_SET_ERROR ( runtime ) \ <nl> - facebook : : jsi : : JSError const & jsError ) { \ <nl> - JsiAbiRuntime : : FromJsiRuntime ( runtime ) - > SetJsiError ( jsError ) ; \ <nl> - throw ; \ <nl> - } \ <nl> - catch ( std : : exception const & ex ) { \ <nl> - JsiAbiRuntime : : FromJsiRuntime ( runtime ) - > SetJsiError ( ex ) ; \ <nl> - throw ; \ <nl> + # define JSI_RUNTIME_SET_ERROR ( runtime ) \ <nl> + facebook : : jsi : : JSError const & jsError ) { \ <nl> + JsiAbiRuntime : : GetOrCreate ( runtime ) - > SetJsiError ( jsError ) ; \ <nl> + throw ; \ <nl> + } \ <nl> + catch ( std : : exception const & ex ) { \ <nl> + JsiAbiRuntime : : GetOrCreate ( runtime ) - > SetJsiError ( ex ) ; \ <nl> + throw ; \ <nl> } catch ( . . . <nl> <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> JsiHostObjectWrapper : : ~ JsiHostObjectWrapper ( ) noexcept { <nl> } <nl> <nl> JsiValueRef JsiHostObjectWrapper : : GetProperty ( JsiRuntime const & runtime , JsiPropertyIdRef const & name ) try { <nl> - JsiAbiRuntime * rt = JsiAbiRuntime : : FromJsiRuntime ( runtime ) ; <nl> + JsiAbiRuntimeHolder rt { JsiAbiRuntime : : GetOrCreate ( runtime ) } ; <nl> JsiAbiRuntime : : PropNameIDRef nameRef { name } ; <nl> return JsiAbiRuntime : : DetachJsiValueRef ( m_hostObject - > get ( * rt , nameRef ) ) ; <nl> } catch ( JSI_RUNTIME_SET_ERROR ( runtime ) ) { <nl> void JsiHostObjectWrapper : : SetProperty ( <nl> JsiRuntime const & runtime , <nl> JsiPropertyIdRef const & name , <nl> JsiValueRef const & value ) try { <nl> - JsiAbiRuntime * rt = JsiAbiRuntime : : FromJsiRuntime ( runtime ) ; <nl> + JsiAbiRuntimeHolder rt { JsiAbiRuntime : : GetOrCreate ( runtime ) } ; <nl> m_hostObject - > set ( * rt , JsiAbiRuntime : : PropNameIDRef { name } , JsiAbiRuntime : : ValueRef ( value ) ) ; <nl> } catch ( JSI_RUNTIME_SET_ERROR ( runtime ) ) { <nl> throw ; <nl> void JsiHostObjectWrapper : : SetProperty ( <nl> <nl> Windows : : Foundation : : Collections : : IVector < JsiPropertyIdRef > JsiHostObjectWrapper : : GetPropertyIds ( <nl> JsiRuntime const & runtime ) try { <nl> - JsiAbiRuntime * rt = JsiAbiRuntime : : FromJsiRuntime ( runtime ) ; <nl> + JsiAbiRuntimeHolder rt { JsiAbiRuntime : : GetOrCreate ( runtime ) } ; <nl> auto names = m_hostObject - > getPropertyNames ( * rt ) ; <nl> std : : vector < JsiPropertyIdRef > result ; <nl> result . reserve ( names . size ( ) ) ; <nl> JsiHostFunctionWrapper : : ~ JsiHostFunctionWrapper ( ) noexcept { <nl> <nl> JsiValueRef JsiHostFunctionWrapper : : <nl> operator ( ) ( JsiRuntime const & runtime , JsiValueRef const & thisArg , array_view < JsiValueRef const > args ) try { <nl> - JsiAbiRuntime * rt = JsiAbiRuntime : : FromJsiRuntime ( runtime ) ; <nl> + JsiAbiRuntimeHolder rt { JsiAbiRuntime : : GetOrCreate ( runtime ) } ; <nl> JsiAbiRuntime : : ValueRefArray valueRefArgs { args } ; <nl> return JsiAbiRuntime : : DetachJsiValueRef ( <nl> m_hostFunction ( * rt , JsiAbiRuntime : : ValueRef { thisArg } , valueRefArgs . Data ( ) , valueRefArgs . Size ( ) ) ) ; <nl> operator ( ) ( JsiRuntime const & runtime , JsiValueRef const & thisArg , array_view < Jsi <nl> VerifyElseCrashSz ( false , " Function is not a host function " ) ; <nl> } <nl> <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + / / JsiAbiRuntimeHolder implementation <nl> + / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> + <nl> + JsiAbiRuntimeHolder : : JsiAbiRuntimeHolder ( std : : unique_ptr < JsiAbiRuntime > jsiRuntime ) noexcept <nl> + : m_jsiRuntime { std : : move ( jsiRuntime ) } , m_isOwning { true } { } <nl> + <nl> + JsiAbiRuntimeHolder : : JsiAbiRuntimeHolder ( JsiAbiRuntime * jsiRuntime ) noexcept : m_jsiRuntime { jsiRuntime } { } <nl> + <nl> + JsiAbiRuntimeHolder : : operator bool ( ) noexcept { <nl> + return m_jsiRuntime ! = nullptr ; <nl> + } <nl> + <nl> + JsiAbiRuntime & JsiAbiRuntimeHolder : : operator * ( ) noexcept { <nl> + return * m_jsiRuntime ; <nl> + } <nl> + <nl> + JsiAbiRuntime * JsiAbiRuntimeHolder : : operator - > ( ) noexcept { <nl> + return m_jsiRuntime . get ( ) ; <nl> + } <nl> + <nl> + JsiAbiRuntimeHolder : : ~ JsiAbiRuntimeHolder ( ) noexcept { <nl> + if ( ! m_isOwning ) { <nl> + m_jsiRuntime . release ( ) ; <nl> + } <nl> + } <nl> + <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> / / JsiAbiRuntime implementation <nl> / / = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - / * static * / std : : mutex JsiAbiRuntime : : s_mutex ; <nl> - / * static * / std : : map < void * , JsiAbiRuntime * > JsiAbiRuntime : : s_jsiAbiRuntimeMap ; <nl> + / / The tls_jsiAbiRuntimeMap map allows us to associate JsiAbiRuntime with JsiRuntime . <nl> + / / The association is thread - specific and DLL - specific . <nl> + / / It is thread specific because we want to have the safe access only in JS thread . <nl> + / / It is DLL - specific because JsiAbiRuntime is not ABI - safe and each module DLL will <nl> + / / have their own JsiAbiRuntime instance . <nl> + static thread_local std : : map < void * , JsiAbiRuntime * > * tls_jsiAbiRuntimeMap { nullptr } ; <nl> <nl> JsiAbiRuntime : : JsiAbiRuntime ( JsiRuntime const & runtime ) noexcept : m_runtime { runtime } { <nl> - std : : scoped_lock lock { s_mutex } ; <nl> - s_jsiAbiRuntimeMap . try_emplace ( get_abi ( runtime ) , this ) ; <nl> + VerifyElseCrashSz ( runtime , " JSI runtime is null " ) ; <nl> + VerifyElseCrashSz ( <nl> + GetFromJsiRuntime ( runtime ) = = nullptr , <nl> + " We can have only one instance of JsiAbiRuntime for JsiRuntime in the thread . " ) ; <nl> + if ( ! tls_jsiAbiRuntimeMap ) { <nl> + tls_jsiAbiRuntimeMap = new std : : map < void * , JsiAbiRuntime * > ( ) ; <nl> + } <nl> + tls_jsiAbiRuntimeMap - > try_emplace ( get_abi ( runtime ) , this ) ; <nl> } <nl> <nl> JsiAbiRuntime : : ~ JsiAbiRuntime ( ) { <nl> - std : : scoped_lock lock { s_mutex } ; <nl> - s_jsiAbiRuntimeMap . erase ( get_abi ( m_runtime ) ) ; <nl> + VerifyElseCrashSz ( <nl> + GetFromJsiRuntime ( m_runtime ) ! = nullptr , " JsiAbiRuntime must be called in the same thread where it was created . " ) ; <nl> + tls_jsiAbiRuntimeMap - > erase ( get_abi ( m_runtime ) ) ; <nl> + if ( tls_jsiAbiRuntimeMap - > empty ( ) ) { <nl> + delete tls_jsiAbiRuntimeMap ; <nl> + tls_jsiAbiRuntimeMap = nullptr ; <nl> + } <nl> } <nl> <nl> - / * static * / JsiAbiRuntime * JsiAbiRuntime : : FromJsiRuntime ( JsiRuntime const & jsiRuntime ) noexcept { <nl> - std : : scoped_lock lock { s_mutex } ; <nl> - auto it = s_jsiAbiRuntimeMap . find ( get_abi ( jsiRuntime ) ) ; <nl> - if ( it ! = s_jsiAbiRuntimeMap . end ( ) ) { <nl> - return it - > second ; <nl> - } else { <nl> - return nullptr ; <nl> + / * static * / JsiAbiRuntime * JsiAbiRuntime : : GetFromJsiRuntime ( JsiRuntime const & runtime ) noexcept { <nl> + if ( tls_jsiAbiRuntimeMap & & runtime ) { <nl> + auto it = tls_jsiAbiRuntimeMap - > find ( get_abi ( runtime ) ) ; <nl> + if ( it ! = tls_jsiAbiRuntimeMap - > end ( ) ) { <nl> + return it - > second ; <nl> + } <nl> + } <nl> + return nullptr ; <nl> + } <nl> + <nl> + / * static * / JsiAbiRuntimeHolder JsiAbiRuntime : : GetOrCreate ( JsiRuntime const & runtime ) noexcept { <nl> + JsiAbiRuntimeHolder result { GetFromJsiRuntime ( runtime ) } ; <nl> + if ( ! result ) { <nl> + result = std : : make_unique < JsiAbiRuntime > ( runtime ) ; <nl> } <nl> + return result ; <nl> } <nl> <nl> Value JsiAbiRuntime : : evaluateJavaScript ( const std : : shared_ptr < const Buffer > & buffer , const std : : string & sourceURL ) try { <nl> Value JsiAbiRuntime : : evaluateJavaScript ( const std : : shared_ptr < const Buffer > & buf <nl> std : : shared_ptr < const PreparedJavaScript > JsiAbiRuntime : : prepareJavaScript ( <nl> const std : : shared_ptr < const Buffer > & buffer , <nl> std : : string sourceURL ) try { <nl> - return std : : make_shared < JsiPreparedJavaScriptWrapper > ( m_runtime . PrepareJavaScript ( <nl> - winrt : : make < JsiByteBufferWrapper > ( m_runtime , std : : move ( buffer ) ) , to_hstring ( sourceURL ) ) ) ; <nl> + return std : : make_shared < JsiPreparedJavaScriptWrapper > ( <nl> + m_runtime . PrepareJavaScript ( winrt : : make < JsiByteBufferWrapper > ( m_runtime , buffer ) , to_hstring ( sourceURL ) ) ) ; <nl> } catch ( hresult_error const & ) { <nl> RethrowJsiError ( ) ; <nl> throw ; <nl> mmm a / vnext / Microsoft . ReactNative . Cxx / JSI / JsiAbiApi . h <nl> ppp b / vnext / Microsoft . ReactNative . Cxx / JSI / JsiAbiApi . h <nl> struct JsiHostFunctionWrapper { <nl> static std : : map < uint64_t , JsiHostFunctionWrapper * > s_functionDataToFunctionWrapper ; <nl> } ; <nl> <nl> + struct JsiAbiRuntime ; <nl> + <nl> + / / Keeps owning or not owning pointer to JsiAbiRuntime <nl> + struct JsiAbiRuntimeHolder { <nl> + JsiAbiRuntimeHolder ( std : : unique_ptr < JsiAbiRuntime > jsiRuntime ) noexcept ; <nl> + JsiAbiRuntimeHolder ( JsiAbiRuntime * jsiRuntime ) noexcept ; <nl> + ~ JsiAbiRuntimeHolder ( ) noexcept ; <nl> + <nl> + JsiAbiRuntimeHolder ( JsiAbiRuntimeHolder const & ) = delete ; <nl> + JsiAbiRuntimeHolder & operator = ( JsiAbiRuntimeHolder const & ) = delete ; <nl> + JsiAbiRuntimeHolder ( JsiAbiRuntimeHolder & & ) = default ; <nl> + JsiAbiRuntimeHolder & operator = ( JsiAbiRuntimeHolder & & ) = default ; <nl> + <nl> + explicit operator bool ( ) noexcept ; <nl> + JsiAbiRuntime & operator * ( ) noexcept ; <nl> + JsiAbiRuntime * operator - > ( ) noexcept ; <nl> + <nl> + private : <nl> + std : : unique_ptr < JsiAbiRuntime > m_jsiRuntime ; <nl> + bool m_isOwning { false } ; <nl> + } ; <nl> + <nl> / / JSI runtime implementation as a wrapper for the ABI - safe JsiRuntime . <nl> struct JsiAbiRuntime : facebook : : jsi : : Runtime { <nl> JsiAbiRuntime ( JsiRuntime const & runtime ) noexcept ; <nl> ~ JsiAbiRuntime ( ) noexcept ; <nl> <nl> - static JsiAbiRuntime * FromJsiRuntime ( JsiRuntime const & jsiRuntime ) noexcept ; <nl> + / / Get JsiAbiRuntime from JsiRuntime in current thread . <nl> + static JsiAbiRuntime * GetFromJsiRuntime ( JsiRuntime const & runtime ) noexcept ; <nl> + <nl> + / / Get JsiAbiRuntime from JsiRuntime in current thread or create a new one . <nl> + static JsiAbiRuntimeHolder GetOrCreate ( JsiRuntime const & runtime ) noexcept ; <nl> <nl> facebook : : jsi : : Value evaluateJavaScript ( <nl> const std : : shared_ptr < const facebook : : jsi : : Buffer > & buffer , <nl> struct JsiAbiRuntime : facebook : : jsi : : Runtime { <nl> <nl> private : <nl> JsiRuntime m_runtime ; <nl> - <nl> - static std : : mutex s_mutex ; <nl> - static std : : map < void * , JsiAbiRuntime * > s_jsiAbiRuntimeMap ; <nl> } ; <nl> <nl> } / / namespace winrt : : Microsoft : : ReactNative <nl> mmm a / vnext / Microsoft . ReactNative . Cxx / Microsoft . ReactNative . Cxx . vcxitems . filters <nl> ppp b / vnext / Microsoft . ReactNative . Cxx / Microsoft . ReactNative . Cxx . vcxitems . filters <nl> <nl> < ClCompile Include = " $ ( MSBuildThisFileDirectory ) JSValueTreeWriter . cpp " / > <nl> < ClCompile Include = " $ ( MSBuildThisFileDirectory ) ModuleRegistration . cpp " / > <nl> < ClCompile Include = " $ ( MSBuildThisFileDirectory ) ReactPromise . cpp " / > <nl> - < ClCompile Include = " $ ( JSI_SourcePath ) \ jsi \ jsi . cpp " / > <nl> - < ClCompile Include = " $ ( MSBuildThisFileDirectory ) JSI \ JsiAbiApi . cpp " / > <nl> + < ClCompile Include = " $ ( JSI_SourcePath ) \ jsi \ jsi . cpp " > <nl> + < Filter > JSI < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) JSI \ JsiAbiApi . cpp " > <nl> + < Filter > JSI < / Filter > <nl> + < / ClCompile > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < ClInclude Include = " $ ( MSBuildThisFileDirectory ) Crash . h " / > <nl> <nl> < ClInclude Include = " $ ( MSBuildThisFileDirectory ) NamespaceRedirect . h " > <nl> < Filter > UI < / Filter > <nl> < / ClInclude > <nl> - < ClInclude Include = " $ ( MSBuildThisFileDirectory ) UI . Xaml . Hosting . DesktopWindowXamlSource . h " / > <nl> - < ClInclude Include = " $ ( MSBuildThisFileDirectory ) UI . Xaml . Hosting . h " / > <nl> - < ClInclude Include = " $ ( JSI_SourcePath ) \ jsi \ instrumentation . h " / > <nl> - < ClInclude Include = " $ ( JSI_SourcePath ) \ jsi \ jsi - inl . h " / > <nl> - < ClInclude Include = " $ ( JSI_SourcePath ) \ jsi \ jsi . h " / > <nl> - < ClInclude Include = " $ ( MSBuildThisFileDirectory ) JSI \ JsiAbiApi . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) JSI \ JsiAbiApi . h " > <nl> + < Filter > JSI < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( JSI_SourcePath ) \ jsi \ jsi . h " > <nl> + < Filter > JSI < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( JSI_SourcePath ) \ jsi \ jsi - inl . h " > <nl> + < Filter > JSI < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) UI . Xaml . Hosting . DesktopWindowXamlSource . h " > <nl> + < Filter > UI < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) UI . Xaml . Hosting . h " > <nl> + < Filter > UI < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( JSI_SourcePath ) \ jsi \ instrumentation . h " > <nl> + < Filter > JSI < / Filter > <nl> + < / ClInclude > <nl> < / ItemGroup > <nl> < ItemGroup > <nl> < Filter Include = " JSI " > <nl> mmm a / vnext / Microsoft . ReactNative . Cxx / ReactContext . h <nl> ppp b / vnext / Microsoft . ReactNative . Cxx / ReactContext . h <nl> <nl> # include < CppWinRTIncludes . h > <nl> # endif <nl> # include < string_view > <nl> + # include " JSI / JsiAbiApi . h " <nl> # include " JSValueWriter . h " <nl> # include " ReactNotificationService . h " <nl> # include " ReactPropertyBag . h " <nl> struct ReactContext { <nl> return ReactDispatcher { m_handle . JSDispatcher ( ) } ; <nl> } <nl> <nl> + / / Call provided lambda with the facebook : : jsi : : Runtime & parameter . <nl> + / / For example : context . ExecuteJsi ( [ ] ( facebook : : jsi : : Runtime & runtime ) { . . . } ) <nl> + / / The code is executed synchronously if it is already in JSDispatcher , or asynchronously otherwise . <nl> + template < class TCodeWithRuntime > <nl> + void ExecuteJsi ( TCodeWithRuntime const & code ) const { <nl> + ReactDispatcher jsDispatcher = JSDispatcher ( ) ; <nl> + if ( jsDispatcher . HasThreadAccess ( ) ) { <nl> + code ( * JsiAbiRuntime : : GetOrCreate ( m_handle . JsiRuntime ( ) ) ) ; / / Execute immediately if we are in JS thread . <nl> + } else { <nl> + / / Otherwise , schedule work in JS thread . <nl> + jsDispatcher . Post ( [ context = ReactContext { * this } , code ] ( ) noexcept { <nl> + code ( * JsiAbiRuntime : : GetOrCreate ( context . m_handle . JsiRuntime ( ) ) ) ; <nl> + } ) ; <nl> + } <nl> + } <nl> + <nl> / / Call methodName JS function of module with moduleName . <nl> / / args are either function arguments or a single lambda with ' IJSValueWriter const & ' argument . <nl> template < class . . . TArgs > <nl> mmm a / vnext / Microsoft . ReactNative . IntegrationTests / AddValues . js <nl> ppp b / vnext / Microsoft . ReactNative . IntegrationTests / AddValues . js <nl> class TestHostModuleFunctions { <nl> } <nl> } <nl> <nl> - global . __fbBatchedBridge . registerLazyCallableModule ( ' TestHostModuleFunctions ' , ( ) = > new TestHostModuleFunctions ( ) ) ; <nl> + / / Accessing TestHostModule has a side effect of initializing global . __fbBatchedBridge <nl> + if ( NativeModules . TestHostModule ) { <nl> + global . __fbBatchedBridge . registerLazyCallableModule ( ' TestHostModuleFunctions ' , ( ) = > new TestHostModuleFunctions ( ) ) ; <nl> <nl> - / / Native modules are created on demand from JavaScript code . <nl> - NativeModules . TestHostModule . start ( ) ; <nl> + / / Native modules are created on demand from JavaScript code . <nl> + NativeModules . TestHostModule . start ( ) ; <nl> + } <nl> mmm a / vnext / Microsoft . ReactNative . IntegrationTests / ReactNativeHostTests . cpp <nl> ppp b / vnext / Microsoft . ReactNative . IntegrationTests / ReactNativeHostTests . cpp <nl> <nl> # include < NativeModules . h > <nl> # include < winrt / Windows . System . h > <nl> # include " MockReactPackageProvider . h " <nl> + <nl> using namespace React ; <nl> <nl> namespace ReactNativeIntegrationTests { <nl> namespace ReactNativeIntegrationTests { <nl> REACT_MODULE ( TestHostModule ) <nl> struct TestHostModule { <nl> REACT_INIT ( Initialize ) <nl> - void Initialize ( ReactContext const & / * reactContext * / ) noexcept { <nl> + void Initialize ( ReactContext const & reactContext ) noexcept { <nl> TestHostModule : : Instance . set_value ( * this ) ; <nl> + <nl> + bool jsiExecuted { false } ; <nl> + reactContext . ExecuteJsi ( [ & ] ( facebook : : jsi : : Runtime & rt ) { <nl> + jsiExecuted = true ; <nl> + auto eval = rt . global ( ) . getPropertyAsFunction ( rt , " eval " ) ; <nl> + auto addFunc = eval . call ( rt , " ( function ( x , y ) { return x + y ; } ) " ) . getObject ( rt ) . getFunction ( rt ) ; <nl> + TestCheckEqual ( 7 , addFunc . call ( rt , 3 , 4 ) . getNumber ( ) ) ; <nl> + } ) ; <nl> + TestCheck ( jsiExecuted ) ; <nl> } <nl> <nl> REACT_FUNCTION ( addValues , L " addValues " , L " TestHostModuleFunctions " ) <nl> TEST_CLASS ( ReactNativeHostTests ) { <nl> TestCheckEqual ( std : : wstring_view { path } , ( std : : wstring_view ) host . InstanceSettings ( ) . BundleRootPath ( ) ) ; <nl> } <nl> <nl> - SKIPTESTMETHOD ( JsFunctionCall_Succeeds ) { <nl> + TEST_METHOD ( JsFunctionCall_Succeeds ) { <nl> std : : future < TestHostModule & > testHostModule = TestHostModule : : Instance . get_future ( ) ; <nl> std : : future < int > returnValue = TestHostModule : : IntReturnValue . get_future ( ) ; <nl> <nl> TEST_CLASS ( ReactNativeHostTests ) { <nl> host . InstanceSettings ( ) . UseLiveReload ( false ) ; <nl> host . InstanceSettings ( ) . EnableDeveloperMenu ( false ) ; <nl> <nl> + host . InstanceSettings ( ) . UseDirectDebugger ( true ) ; <nl> + <nl> host . LoadInstance ( ) ; <nl> } ) ; <nl> <nl> mmm a / vnext / Microsoft . ReactNative . Managed . UnitTests / ReactModuleBuilderMock . cs <nl> ppp b / vnext / Microsoft . ReactNative . Managed . UnitTests / ReactModuleBuilderMock . cs <nl> public ReactContextMock ( ReactModuleBuilderMock builder ) <nl> <nl> public IReactDispatcher JSDispatcher = > Properties . Get ( ReactDispatcherHelper . JSDispatcherProperty ) as IReactDispatcher ; <nl> <nl> + public JsiRuntime JsiRuntime = > throw new NotImplementedException ( ) ; <nl> + <nl> public void DispatchEvent ( FrameworkElement view , string eventName , JSValueArgWriter eventDataArgWriter ) <nl> { <nl> throw new NotImplementedException ( ) ; <nl> mmm a / vnext / Microsoft . ReactNative / IReactContext . cpp <nl> ppp b / vnext / Microsoft . ReactNative / IReactContext . cpp <nl> void ReactContext : : EmitJSEvent ( <nl> m_context - > CallJSFunction ( to_string ( eventEmitterName ) , " emit " , std : : move ( params ) ) ; <nl> } <nl> <nl> + ReactNative : : JsiRuntime ReactContext : : JsiRuntime ( ) noexcept { <nl> + return m_context - > JsiRuntime ( ) ; <nl> + } <nl> + <nl> # ifndef CORE_ABI <nl> bool ReactContext : : UseWebDebugger ( ) const noexcept { <nl> return m_context - > UseWebDebugger ( ) ; <nl> mmm a / vnext / Microsoft . ReactNative / IReactContext . h <nl> ppp b / vnext / Microsoft . ReactNative / IReactContext . h <nl> struct ReactContext : winrt : : implements < ReactContext , IReactContext > { <nl> hstring const & eventName , <nl> JSValueArgWriter const & paramsArgWriter ) noexcept ; <nl> <nl> + ReactNative : : JsiRuntime JsiRuntime ( ) noexcept ; <nl> + <nl> bool UseWebDebugger ( ) const noexcept ; <nl> bool UseFastRefresh ( ) const noexcept ; <nl> bool UseDirectDebugger ( ) const noexcept ; <nl> mmm a / vnext / Microsoft . ReactNative / IReactContext . idl <nl> ppp b / vnext / Microsoft . ReactNative / IReactContext . idl <nl> <nl> import " IJSValueWriter . idl " ; <nl> import " IReactNotificationService . idl " ; <nl> import " IReactPropertyBag . idl " ; <nl> + import " JsiApi . idl " ; <nl> <nl> # ifndef CORE_ABI <nl> # include " NamespaceRedirect . h " <nl> The subscriptions added to the ` IReactInstanceSettings . Notifications ` are kept a <nl> DOC_STRING ( " Get ` ReactDispatcherHelper : : JSDispatcherProperty ` from the Properties property bag . " ) <nl> IReactDispatcher JSDispatcher { get ; } ; <nl> <nl> + DOC_STRING ( " Get the JSI runtime for the running React instance . It can be null if Web debugging is used . " ) <nl> + JsiRuntime JsiRuntime { get ; } ; <nl> + <nl> # ifndef CORE_ABI <nl> / / Deprecated : Use DispatchEvent on XamlUIService instead <nl> DOC_STRING ( " > Deprecated : Use ` DispatchEvent ` on [ ` XamlUIService ` ] ( XamlUIService . md ) instead " ) <nl> mmm a / vnext / Microsoft . ReactNative / JsiApi . cpp <nl> ppp b / vnext / Microsoft . ReactNative / JsiApi . cpp <nl> ReactNative : : JsiRuntime JsiRuntime : : MakeChakraRuntime ( ) { <nl> auto runtimeHolder = std : : make_shared < : : Microsoft : : JSI : : ChakraRuntimeHolder > ( <nl> std : : move ( devSettings ) , std : : move ( jsThread ) , nullptr , nullptr ) ; <nl> auto runtime = runtimeHolder - > getRuntime ( ) ; <nl> - ReactNative : : JsiRuntime result { make < JsiRuntime > ( std : : move ( runtimeHolder ) , runtime ) } ; <nl> + ReactNative : : JsiRuntime result { make < JsiRuntime > ( std : : move ( runtimeHolder ) , Mso : : Copy ( runtime ) ) } ; <nl> std : : scoped_lock lock { s_mutex } ; <nl> s_jsiRuntimeMap . try_emplace ( reinterpret_cast < uintptr_t > ( runtime . get ( ) ) , result ) ; <nl> return result ; <nl> } <nl> <nl> JsiRuntime : : JsiRuntime ( <nl> - std : : shared_ptr < : : Microsoft : : JSI : : ChakraRuntimeHolder > runtimeHolder , <nl> - std : : shared_ptr < facebook : : jsi : : Runtime > runtime ) noexcept <nl> + std : : shared_ptr < facebook : : jsi : : RuntimeHolderLazyInit > & & runtimeHolder , <nl> + std : : shared_ptr < facebook : : jsi : : Runtime > & & runtime ) noexcept <nl> : m_runtimeHolder { std : : move ( runtimeHolder ) } , m_runtime { std : : move ( runtime ) } { } <nl> <nl> JsiRuntime : : ~ JsiRuntime ( ) noexcept { <nl> mmm a / vnext / Microsoft . ReactNative / JsiApi . h <nl> ppp b / vnext / Microsoft . ReactNative / JsiApi . h <nl> struct JsiError : JsiErrorT < JsiError > { <nl> <nl> struct JsiRuntime : JsiRuntimeT < JsiRuntime > { <nl> JsiRuntime ( <nl> - std : : shared_ptr < : : Microsoft : : JSI : : ChakraRuntimeHolder > runtimeHolder , <nl> - std : : shared_ptr < facebook : : jsi : : Runtime > runtime ) noexcept ; <nl> + std : : shared_ptr < facebook : : jsi : : RuntimeHolderLazyInit > & & runtimeHolder , <nl> + std : : shared_ptr < facebook : : jsi : : Runtime > & & runtime ) noexcept ; <nl> ~ JsiRuntime ( ) noexcept ; <nl> <nl> static ReactNative : : JsiRuntime FromRuntime ( facebook : : jsi : : Runtime & runtime ) noexcept ; <nl> struct JsiRuntime : JsiRuntimeT < JsiRuntime > { <nl> void SetError ( facebook : : jsi : : JSINativeException const & nativeException ) noexcept ; <nl> <nl> private : <nl> - std : : shared_ptr < : : Microsoft : : JSI : : ChakraRuntimeHolder > m_runtimeHolder ; <nl> + std : : shared_ptr < facebook : : jsi : : RuntimeHolderLazyInit > m_runtimeHolder ; <nl> std : : shared_ptr < facebook : : jsi : : Runtime > m_runtime ; <nl> std : : mutex m_mutex ; <nl> ReactNative : : JsiError m_error { nullptr } ; <nl> mmm a / vnext / Microsoft . ReactNative / JsiApi . idl <nl> ppp b / vnext / Microsoft . ReactNative / JsiApi . idl <nl> <nl> <nl> namespace Microsoft . ReactNative <nl> { <nl> - interface IJsiRuntime ; <nl> - <nl> / / JsiByteArrayUser delegate receives a range of bytes as a byte array . <nl> / / The array of bytes is implemented in ABI as two parameters : array length and a pointer to the array start . <nl> / / It effectively provides a ' view ' to the byte array provided by the delegate invoker . <nl> mmm a / vnext / Microsoft . ReactNative / ReactHost / React . h <nl> ppp b / vnext / Microsoft . ReactNative / ReactHost / React . h <nl> struct IReactContext : IUnknown { <nl> virtual winrt : : Microsoft : : ReactNative : : IReactPropertyBag Properties ( ) const noexcept = 0 ; <nl> virtual void CallJSFunction ( std : : string & & module , std : : string & & method , folly : : dynamic & & params ) const noexcept = 0 ; <nl> virtual void DispatchEvent ( int64_t viewTag , std : : string & & eventName , folly : : dynamic & & eventData ) const noexcept = 0 ; <nl> + virtual winrt : : Microsoft : : ReactNative : : JsiRuntime JsiRuntime ( ) const noexcept = 0 ; <nl> # ifndef CORE_ABI <nl> virtual ReactInstanceState State ( ) const noexcept = 0 ; <nl> virtual bool IsLoaded ( ) const noexcept = 0 ; <nl> mmm a / vnext / Microsoft . ReactNative / ReactHost / ReactContext . cpp <nl> ppp b / vnext / Microsoft . ReactNative / ReactHost / ReactContext . cpp <nl> void ReactContext : : DispatchEvent ( int64_t viewTag , std : : string & & eventName , folly <nl> # endif <nl> } <nl> <nl> + winrt : : Microsoft : : ReactNative : : JsiRuntime ReactContext : : JsiRuntime ( ) const noexcept { <nl> + # ifndef CORE_ABI / / requires instance <nl> + if ( auto instance = m_reactInstance . GetStrongPtr ( ) ) { <nl> + return instance - > JsiRuntime ( ) ; <nl> + } else { <nl> + return nullptr ; <nl> + } <nl> + # else <nl> + return nullptr ; <nl> + # endif <nl> + } <nl> + <nl> # ifndef CORE_ABI <nl> ReactInstanceState ReactContext : : State ( ) const noexcept { <nl> if ( auto instance = m_reactInstance . GetStrongPtr ( ) ) { <nl> mmm a / vnext / Microsoft . ReactNative / ReactHost / ReactContext . h <nl> ppp b / vnext / Microsoft . ReactNative / ReactHost / ReactContext . h <nl> <nl> <nl> # include " React . h " <nl> <nl> + namespace facebook : : jsi { <nl> + struct RuntimeHolderLazyInit ; <nl> + } / / namespace facebook : : jsi <nl> + <nl> namespace Mso : : React { <nl> <nl> class ReactInstanceWin ; <nl> class ReactContext final : public Mso : : UnknownObject < IReactContext > { <nl> winrt : : Microsoft : : ReactNative : : IReactNotificationService Notifications ( ) const noexcept override ; <nl> void CallJSFunction ( std : : string & & module , std : : string & & method , folly : : dynamic & & params ) const noexcept override ; <nl> void DispatchEvent ( int64_t viewTag , std : : string & & eventName , folly : : dynamic & & eventData ) const noexcept override ; <nl> + winrt : : Microsoft : : ReactNative : : JsiRuntime JsiRuntime ( ) const noexcept override ; <nl> # ifndef CORE_ABI <nl> ReactInstanceState State ( ) const noexcept override ; <nl> bool IsLoaded ( ) const noexcept override ; <nl> class ReactContext final : public Mso : : UnknownObject < IReactContext > { <nl> uint16_t SourceBundlePort ( ) const noexcept override ; <nl> std : : string JavaScriptBundleFile ( ) const noexcept override ; <nl> bool UseDeveloperSupport ( ) const noexcept override ; <nl> - <nl> # endif <nl> <nl> private : <nl> class ReactContext final : public Mso : : UnknownObject < IReactContext > { <nl> winrt : : Microsoft : : ReactNative : : IReactPropertyBag m_properties ; <nl> winrt : : Microsoft : : ReactNative : : IReactNotificationService m_notifications ; <nl> } ; <nl> + <nl> } / / namespace Mso : : React <nl> mmm a / vnext / Microsoft . ReactNative / ReactHost / ReactInstanceWin . cpp <nl> ppp b / vnext / Microsoft . ReactNative / ReactHost / ReactInstanceWin . cpp <nl> <nl> # include < tuple > <nl> # include " ChakraRuntimeHolder . h " <nl> <nl> + # include " JsiApi . h " <nl> + <nl> namespace Microsoft : : ReactNative { <nl> <nl> void AddStandardViewManagers ( <nl> void ReactInstanceWin : : Initialize ( ) noexcept { <nl> devSettings , m_jsMessageThread . Load ( ) , std : : move ( scriptStore ) , std : : move ( preparedScriptStore ) ) ; <nl> break ; <nl> } <nl> + <nl> + m_jsiRuntimeHolder = devSettings - > jsiRuntimeHolder ; <nl> } <nl> <nl> try { <nl> Mso : : Future < void > ReactInstanceWin : : Destroy ( ) noexcept { <nl> <nl> / / Make sure that the instance is not destroyed yet <nl> if ( auto instance = m_instance . Exchange ( nullptr ) ) { <nl> + { <nl> + / / Release the JSI runtime <nl> + std : : scoped_lock lock { m_mutex } ; <nl> + m_jsiRuntimeHolder = nullptr ; <nl> + m_jsiRuntime = nullptr ; <nl> + } <nl> / / Release the message queues before the ui manager and instance . <nl> m_nativeMessageThread . Exchange ( nullptr ) ; <nl> m_jsMessageThread . Exchange ( nullptr ) ; <nl> void ReactInstanceWin : : DispatchEvent ( int64_t viewTag , std : : string & & eventName , f <nl> CallJsFunction ( " RCTEventEmitter " , " receiveEvent " , std : : move ( params ) ) ; <nl> } <nl> <nl> + winrt : : Microsoft : : ReactNative : : JsiRuntime ReactInstanceWin : : JsiRuntime ( ) noexcept { <nl> + std : : shared_ptr < facebook : : jsi : : RuntimeHolderLazyInit > jsiRuntimeHolder ; <nl> + { <nl> + std : : scoped_lock lock { m_mutex } ; <nl> + if ( m_jsiRuntime ) { <nl> + return m_jsiRuntime ; <nl> + } else { <nl> + jsiRuntimeHolder = m_jsiRuntimeHolder ; <nl> + } <nl> + } <nl> + <nl> + auto jsiRuntime = jsiRuntimeHolder ? jsiRuntimeHolder - > getRuntime ( ) : nullptr ; <nl> + <nl> + { <nl> + std : : scoped_lock lock { m_mutex } ; <nl> + if ( ! m_jsiRuntime & & jsiRuntime ) { <nl> + / / Set only if other thread did not do it yet . <nl> + m_jsiRuntime = winrt : : make < winrt : : Microsoft : : ReactNative : : implementation : : JsiRuntime > ( <nl> + std : : move ( jsiRuntimeHolder ) , std : : move ( jsiRuntime ) ) ; <nl> + } <nl> + <nl> + return m_jsiRuntime ; <nl> + } <nl> + } <nl> + <nl> std : : shared_ptr < facebook : : react : : Instance > ReactInstanceWin : : GetInnerInstance ( ) noexcept { <nl> return m_instance . LoadWithLock ( ) ; <nl> } <nl> mmm a / vnext / Microsoft . ReactNative / ReactHost / ReactInstanceWin . h <nl> ppp b / vnext / Microsoft . ReactNative / ReactHost / ReactInstanceWin . h <nl> class ReactInstanceWin final : public Mso : : ActiveObject < IReactInstanceInternal > <nl> public : <nl> void CallJsFunction ( std : : string & & moduleName , std : : string & & method , folly : : dynamic & & params ) noexcept ; <nl> void DispatchEvent ( int64_t viewTag , std : : string & & eventName , folly : : dynamic & & eventData ) noexcept ; <nl> + winrt : : Microsoft : : ReactNative : : JsiRuntime JsiRuntime ( ) noexcept ; <nl> std : : shared_ptr < facebook : : react : : Instance > GetInnerInstance ( ) noexcept ; <nl> bool IsLoaded ( ) const noexcept ; <nl> # ifndef CORE_ABI <nl> class ReactInstanceWin final : public Mso : : ActiveObject < IReactInstanceInternal > <nl> # endif <nl> Mso : : DispatchQueue m_uiQueue ; <nl> std : : deque < JSCallEntry > m_jsCallQueue ; <nl> + <nl> + std : : shared_ptr < facebook : : jsi : : RuntimeHolderLazyInit > m_jsiRuntimeHolder ; <nl> + winrt : : Microsoft : : ReactNative : : JsiRuntime m_jsiRuntime { nullptr } ; <nl> } ; <nl> <nl> } / / namespace Mso : : React <nl>
Add ReactContext : : ExecuteJsi method to use JSI in NativeModules ( )
microsoft/react-native-windows
d7cdd84367953a02848f1c19ee509e0ab5af2ad7
2020-11-20T06:31:05Z
mmm a / stdlib / private / SwiftPrivateThreadExtras / CMakeLists . txt <nl> ppp b / stdlib / private / SwiftPrivateThreadExtras / CMakeLists . txt <nl> add_swift_target_library ( swiftSwiftPrivateThreadExtras $ { SWIFT_STDLIB_LIBRARY_BU <nl> SWIFT_MODULE_DEPENDS_FREEBSD Glibc <nl> SWIFT_MODULE_DEPENDS_CYGWIN Glibc <nl> SWIFT_MODULE_DEPENDS_HAIKU Glibc <nl> - SWIFT_MODULE_DEPENDS_WINDOWS MSVCRT <nl> + SWIFT_MODULE_DEPENDS_WINDOWS MSVCRT WinSDK <nl> SWIFT_COMPILE_FLAGS <nl> INSTALL_IN_COMPONENT stdlib - experimental ) <nl> <nl> mmm a / stdlib / private / SwiftPrivateThreadExtras / SwiftPrivateThreadExtras . swift <nl> ppp b / stdlib / private / SwiftPrivateThreadExtras / SwiftPrivateThreadExtras . swift <nl> public func _stdlib_thread_join < Result > ( <nl> _ resultType : Result . Type <nl> ) - > ( CInt , Result ? ) { <nl> # if os ( Windows ) <nl> - / / TODO ( compnerd ) modularize rpc . h for INFINITE ( 0xffffffff ) <nl> - let result = WaitForSingleObject ( thread , 0xffffffff ) ; <nl> - / / TODO ( compnerd ) modularize WinBase . h for WAIT_OBJECT_0 ( 0 ) <nl> - if result = = 0 { <nl> + let result = WaitForSingleObject ( thread , INFINITE ) <nl> + if result = = WAIT_OBJECT_0 { <nl> var threadResult : DWORD = 0 <nl> GetExitCodeThread ( thread , & threadResult ) <nl> CloseHandle ( thread ) <nl> mmm a / stdlib / private / SwiftPrivateThreadExtras / ThreadBarriers . swift <nl> ppp b / stdlib / private / SwiftPrivateThreadExtras / ThreadBarriers . swift <nl> public func _stdlib_thread_barrier_wait ( <nl> if barrier . pointee . numThreadsWaiting < barrier . pointee . count { <nl> / / Put the thread to sleep . <nl> # if os ( Windows ) <nl> - / / TODO ( compnerd ) modularize rpc . h to get INFIITE ( 0xffffffff ) <nl> if SleepConditionVariableSRW ( barrier . pointee . cond ! , barrier . pointee . mutex ! , <nl> - 0xffffffff , 0 ) = = 0 { <nl> + INFINITE , 0 ) = = 0 { <nl> return - 1 <nl> } <nl> ReleaseSRWLockExclusive ( barrier . pointee . mutex ! ) <nl>
SwiftPrivateThreadExtras : clean up using WinSDK SDK overlay
apple/swift
98d71ff38f4e375569ab4780aaa38af2567e8079
2018-12-01T19:04:13Z
mmm a / test / expect / TestJit . test_pretty_printer - loop_use_test . expect <nl> ppp b / test / expect / TestJit . test_pretty_printer - loop_use_test . expect <nl> <nl> def loop_use_test ( y : Tensor ) - > Tuple [ Tensor , Tensor ] : <nl> x = torch . add ( y , 1 , 1 ) <nl> z = torch . add ( x , 5 , 1 ) <nl> - z0 , y0 = z , y <nl> + z0 = z <nl> + y0 = y <nl> _0 = bool ( torch . lt ( y , 8 ) ) <nl> while _0 : <nl> y1 = torch . add_ ( y0 , 1 , 1 ) <nl> mmm a / test / expect / TestJit . test_pretty_printer - while_if_test . expect <nl> ppp b / test / expect / TestJit . test_pretty_printer - while_if_test . expect <nl> <nl> def while_if_test ( a : Tensor , <nl> b : Tensor ) - > Tensor : <nl> - a0 , c , b0 = a , 0 , b <nl> + a0 = a <nl> + c = 0 <nl> + b0 = b <nl> _0 = bool ( torch . lt ( a , 10 ) ) <nl> while _0 : <nl> a1 = torch . add ( a0 , 1 , 1 ) <nl> mmm a / test / expect / TestJit . test_pretty_printer - while_test . expect <nl> ppp b / test / expect / TestJit . test_pretty_printer - while_test . expect <nl> <nl> def while_test ( a : Tensor , <nl> i : Tensor ) - > Tensor : <nl> - a0 , i0 = a , i <nl> + a0 = a <nl> + i0 = i <nl> _0 = bool ( torch . lt ( i , 3 ) ) <nl> while _0 : <nl> a1 = torch . mul_ ( a0 , a0 ) <nl> mmm a / test / test_jit_py3 . py <nl> ppp b / test / test_jit_py3 . py <nl> <nl> from jit_utils import JitTestCase <nl> from torch . testing import FileCheck <nl> from typing import NamedTuple , List , Optional <nl> - <nl> import unittest <nl> import torch <nl> <nl> def fn ( ) : <nl> a : List [ int ] = [ ] <nl> b : torch . Tensor = torch . ones ( 2 , 2 ) <nl> c : Optional [ torch . Tensor ] = None <nl> + d : Optional [ torch . Tensor ] = torch . ones ( 3 , 4 ) <nl> for _ in range ( 10 ) : <nl> a . append ( 4 ) <nl> c = torch . ones ( 2 , 2 ) <nl> - return a , b , c <nl> + d = None <nl> + return a , b , c , d <nl> <nl> self . checkScript ( fn , ( ) ) <nl> <nl> def test_parser_bug ( self ) : <nl> def parser_bug ( o : Optional [ torch . Tensor ] ) : <nl> pass <nl> <nl> + def test_mismatched_annotation ( self ) : <nl> + with self . assertRaisesRegex ( RuntimeError , ' annotated with type ' ) : <nl> + @ torch . jit . script <nl> + def foo ( ) : <nl> + x : str = 4 <nl> + return x <nl> + <nl> + def test_reannotate ( self ) : <nl> + with self . assertRaisesRegex ( RuntimeError , ' declare and annotate ' ) : <nl> + @ torch . jit . script <nl> + def foo ( ) : <nl> + x = 5 <nl> + if True : <nl> + x : Optional [ int ] = 7 <nl> <nl> <nl> if __name__ = = ' __main__ ' : <nl> mmm a / torch / csrc / jit / passes / python_print . cpp <nl> ppp b / torch / csrc / jit / passes / python_print . cpp <nl> struct PythonPrintPass { <nl> } <nl> <nl> void printAssignment ( at : : ArrayRef < Value * > lhs , at : : ArrayRef < Value * > rhs ) { <nl> - if ( lhs . size ( ) > 0 ) { <nl> + if ( lhs . size ( ) = = 0 ) { <nl> + return ; <nl> + } <nl> + indent ( ) ; <nl> + printValueList ( body_ , lhs ) ; <nl> + body_ < < " = " ; <nl> + printValueList ( body_ , rhs ) ; <nl> + body_ < < " \ n " ; <nl> + } <nl> + <nl> + bool requiresAnnotation ( Value * lhs , Value * rhs ) { <nl> + return * lhs - > type ( ) ! = * rhs - > type ( ) ; <nl> + } <nl> + <nl> + void printAnnotatedAssignment ( <nl> + at : : ArrayRef < Value * > lhs , <nl> + at : : ArrayRef < Value * > rhs ) { <nl> + for ( size_t i = 0 ; i < lhs . size ( ) ; + + i ) { <nl> indent ( ) ; <nl> - printValueList ( body_ , lhs ) ; <nl> - body_ < < " = " ; <nl> - printValueList ( body_ , rhs ) ; <nl> - body_ < < " \ n " ; <nl> + body_ < < useOf ( lhs [ i ] ) ; <nl> + if ( requiresAnnotation ( lhs [ i ] , rhs [ i ] ) ) { <nl> + body_ < < " : " < < lhs [ i ] - > type ( ) - > python_str ( ) ; <nl> + } <nl> + body_ < < " = " < < useOf ( rhs [ i ] ) < < " \ n " ; <nl> } <nl> } <nl> <nl> struct PythonPrintPass { <nl> } ) ; <nl> <nl> / / Print initial assignments of loop node outputs = loop node inputs <nl> - printAssignment ( stmt . carriedOutputs ( ) , stmt . carriedInputs ( ) ) ; <nl> + printAnnotatedAssignment ( stmt . carriedOutputs ( ) , stmt . carriedInputs ( ) ) ; <nl> <nl> assignValuesToTheirUniqueNames ( stmt . currentTripCount ( ) ) ; <nl> / / Loop header <nl> mmm a / torch / csrc / jit / script / compiler . cpp <nl> ppp b / torch / csrc / jit / script / compiler . cpp <nl> struct Environment { <nl> return std : : make_shared < SimpleValue > ( load - > output ( ) ) ; <nl> } <nl> <nl> - void insertStore ( const std : : string & name , const SourceRange & loc , Value * v ) { <nl> + / / note : type is not always the same as v - > type ( ) , e . g . <nl> + / / type : Optional [ Tensor ] <nl> + / / v - > type ( ) : Tensor <nl> + void insertStore ( <nl> + const std : : string & name , <nl> + const SourceRange & loc , <nl> + Value * v , <nl> + TypePtr type ) { <nl> auto g = b - > owningGraph ( ) ; <nl> - auto store = g - > insertNode ( g - > createStore ( name , v ) ) - > setSourceRange ( loc ) ; <nl> - type_table [ name ] = store - > input ( ) - > type ( ) ; <nl> + g - > insertNode ( g - > createStore ( name , v ) ) - > setSourceRange ( loc ) ; <nl> + type_table [ name ] = type ; <nl> } <nl> <nl> SugaredValuePtr findInThisFrame ( const std : : string & name ) { <nl> struct Environment { <nl> } <nl> <nl> void setVar ( const SourceRange & loc , const std : : string & name , Value * value ) { <nl> - setSugaredVar ( loc , name , std : : make_shared < SimpleValue > ( value ) ) ; <nl> + setSugaredVar ( <nl> + loc , <nl> + name , <nl> + std : : make_shared < SimpleValue > ( value ) , <nl> + / * annotated_type = * / nullptr ) ; <nl> } <nl> <nl> void setSugaredVar ( <nl> const SourceRange & loc , <nl> const std : : string & name , <nl> - SugaredValuePtr value ) { <nl> + SugaredValuePtr value , <nl> + TypePtr annotated_type ) { <nl> Value * as_simple_value = asSimple ( value ) ; <nl> if ( as_simple_value & & ! as_simple_value - > hasDebugName ( ) & & <nl> meaningfulName ( name ) & & <nl> struct Environment { <nl> / / requires ' a ' to be first - class in the graph since its value depends on <nl> / / control flow <nl> if ( auto parent = findInParentFrame ( name ) ) { <nl> + if ( annotated_type ) { <nl> + throw ErrorReport ( loc ) <nl> + < < " Attempting to declare and annotate the type of variable ' " <nl> + < < name < < " ' but it is already defined in an outer block " ; <nl> + } <nl> if ( ! as_simple_value ) { <nl> throw ErrorReport ( loc ) <nl> < < " Cannot re - assign ' " < < name < < " ' to a value of type " <nl> struct Environment { <nl> < < value - > kind ( ) < < " and " < < name <nl> < < " is not a first - class value . Only reassignments to first - class values are allowed " ; <nl> } <nl> - if ( ! as_simple_value - > type ( ) - > isSubtypeOf ( <nl> - unshapedType ( simple_parent - > type ( ) ) ) ) { <nl> + <nl> + auto parent_type = unshapedType ( simple_parent - > type ( ) ) ; <nl> + as_simple_value = tryConvertToType ( <nl> + loc , <nl> + * b - > owningGraph ( ) , <nl> + parent_type , <nl> + as_simple_value , <nl> + / * allow_conversions = * / true ) ; <nl> + if ( ! as_simple_value - > type ( ) - > isSubtypeOf ( parent_type ) ) { <nl> auto error = ErrorReport ( loc ) ; <nl> error < < " Variable ' " < < name < < " ' previously has type " <nl> < < simple_parent - > type ( ) - > python_str ( ) <nl> struct Environment { <nl> } <nl> } <nl> if ( as_simple_value ) { <nl> - insertStore ( name , loc , std : : move ( as_simple_value ) ) ; <nl> + if ( ! annotated_type ) { <nl> + annotated_type = as_simple_value - > type ( ) ; <nl> + } <nl> + if ( ! as_simple_value - > type ( ) - > isSubtypeOf ( annotated_type ) ) { <nl> + throw ErrorReport ( loc ) <nl> + < < " Variable ' " < < name < < " ' is annotated with type " <nl> + < < annotated_type - > python_str ( ) <nl> + < < " but is being assigned to a value of type " <nl> + < < as_simple_value - > type ( ) - > python_str ( ) ; <nl> + } <nl> + insertStore ( name , loc , std : : move ( as_simple_value ) , annotated_type ) ; <nl> } else { <nl> value_table [ name ] = std : : move ( value ) ; <nl> } <nl> struct to_ir { <nl> const auto & name = ( * it ) . ident ( ) . name ( ) ; <nl> Value * new_input = block - > addInput ( ) - > setDebugName ( name ) ; <nl> environment_stack - > setSugaredVar ( <nl> - ( * it ) . ident ( ) . range ( ) , name , self - > makeSugared ( new_input ) ) ; <nl> + ( * it ) . ident ( ) . range ( ) , <nl> + name , <nl> + self - > makeSugared ( new_input ) , <nl> + / * annotated_type = * / nullptr ) ; <nl> arguments . emplace_back ( name , new_input - > type ( ) ) ; <nl> + + it ; <nl> } <nl> struct to_ir { <nl> } ; <nl> auto closure_value = emitClosure ( emit_body ) ; <nl> environment_stack - > setSugaredVar ( <nl> - def . name ( ) . range ( ) , def . name ( ) . name ( ) , closure_value ) ; <nl> + def . name ( ) . range ( ) , <nl> + def . name ( ) . name ( ) , <nl> + closure_value , <nl> + / * annotated_type = * / nullptr ) ; <nl> } <nl> <nl> void emitBreak ( const Break & stmt ) { <nl> struct to_ir { <nl> case TK_AUG_ASSIGN : <nl> emitAugAssignment ( AugAssign ( stmt ) ) ; <nl> break ; <nl> - case TK_GLOBAL : <nl> - for ( auto ident : Global ( stmt ) . names ( ) ) { <nl> - const auto & name = Ident ( ident ) . name ( ) ; <nl> - environment_stack - > setVar ( <nl> - ident . range ( ) , name , graph - > addInput ( name ) ) ; <nl> - } <nl> - break ; <nl> case TK_EXPR_STMT : { <nl> auto expr = ExprStmt ( stmt ) . expr ( ) ; <nl> emitSugaredExpr ( expr , 0 ) ; <nl> struct to_ir { <nl> break ; <nl> case TK_VAR : <nl> environment_stack - > setSugaredVar ( <nl> - assignee . range ( ) , Var ( assignee ) . name ( ) . name ( ) , outputs . at ( i ) ) ; <nl> + assignee . range ( ) , <nl> + Var ( assignee ) . name ( ) . name ( ) , <nl> + outputs . at ( i ) , <nl> + / * annotated_type = * / nullptr ) ; <nl> i + + ; <nl> break ; <nl> case TK_STARRED : { <nl> struct to_ir { <nl> / / from left to right the assignments are made <nl> const auto tmp_name = createTempName ( " $ tmp_assign_ " ) ; <nl> environment_stack - > setSugaredVar ( <nl> - stmt . rhs ( ) . range ( ) , tmp_name , emitSugaredExpr ( stmt . rhs ( ) . get ( ) , 1 ) ) ; <nl> + stmt . rhs ( ) . range ( ) , <nl> + tmp_name , <nl> + emitSugaredExpr ( stmt . rhs ( ) . get ( ) , 1 ) , <nl> + / * annotated_type = * / nullptr ) ; <nl> auto ident = Var : : create ( <nl> stmt . rhs ( ) . range ( ) , Ident : : create ( stmt . rhs ( ) . range ( ) , tmp_name ) ) ; <nl> for ( auto expr : stmt . lhs_list ( ) ) { <nl> struct to_ir { <nl> type = typeParser_ . parseTypeFromExpr ( stmt . type ( ) . get ( ) ) ; <nl> } <nl> environment_stack - > setSugaredVar ( <nl> - v . range ( ) , v . name ( ) . name ( ) , emitSugaredExpr ( rhs , 1 , type ) ) ; <nl> + v . range ( ) , <nl> + v . name ( ) . name ( ) , <nl> + emitSugaredExpr ( rhs , 1 , type ) , <nl> + / * annotated_type = * / type ) ; <nl> } break ; <nl> case TK_TUPLE_LITERAL : <nl> emitTupleAssign ( TupleLiteral ( stmt . lhs ( ) ) , rhs ) ; <nl> mmm a / torch / csrc / jit / script / convert_to_ssa . cpp <nl> ppp b / torch / csrc / jit / script / convert_to_ssa . cpp <nl> struct ControlFlowLoadStores { <nl> auto loop_vars = addControlFlowLoadStores ( body_block ) ; <nl> <nl> for ( const auto & name : loop_vars - > definedVariables ( ) ) { <nl> - / / we require that the variable is defined outside the loop to be emitted , <nl> - / / and we do not refine the type of the parent variable since the loop may <nl> - / / not be entered . <nl> + / / if the variable local to the loop body , then <nl> + / / we do not need a loop carried variable for it <nl> auto parent_type = environment_stack - > findInAnyFrame ( name ) ; <nl> if ( ! parent_type ) { <nl> continue ; <nl> } <nl> <nl> + / / since the loop may execute 0 or many times , the output types <nl> + / / of the loop and the input loop carried dependencies are conservatively <nl> + / / the union of the output of the body and the input to the loop <nl> + auto block_type = loop_vars - > findInThisFrame ( name ) ; <nl> + auto unified_type = unifyTypes ( parent_type , block_type ) . value ( ) ; <nl> + <nl> / / Insert a store at the beginning of the loop block , so that all <nl> / / loads of the variable will use the loop carried value <nl> addNodeInput ( n , parent_type , name ) ; <nl> - addBlockInput ( body_block , parent_type , name ) ; <nl> - addBlockOutput ( body_block , parent_type , name ) ; <nl> - addNodeOutput ( n , parent_type , name ) ; <nl> + addBlockInput ( body_block , unified_type , name ) ; <nl> + addBlockOutput ( body_block , block_type , name ) ; <nl> + addNodeOutput ( n , unified_type , name ) ; <nl> } <nl> } <nl> <nl>
Fix bugs in assignment to optionals ( )
pytorch/pytorch
121839b2f821bd2ab5c8cc35ac501dfa2ad5f483
2019-08-26T20:47:54Z
mmm a / js / node / node_modules / jshint / node_modules / cli / cli . js <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / cli . js <nl> cli . argc = 0 ; <nl> <nl> cli . options = { } ; <nl> cli . args = [ ] ; <nl> - cli . command ; <nl> + cli . command = null ; <nl> <nl> cli . width = 70 ; <nl> cli . option_width = 25 ; <nl> var define_native = function ( module ) { <nl> configurable : true , <nl> get : function ( ) { <nl> delete cli . native [ module ] ; <nl> - return cli . native [ module ] = require ( module ) ; <nl> + return ( cli . native [ module ] = require ( module ) ) ; <nl> } <nl> } ) ; <nl> } ; <nl> cli . setArgv = function ( arr , keep_arg0 ) { <nl> / / So this is still broken and will break if you are calling node through a <nl> / / symlink , unless you are lucky enough to have it as ' node ' literal . Latter <nl> / / is a hack , but resolving abspaths / symlinks is an unportable can of worms . <nl> - if ( ! keep_arg0 & & ( ' node ' = = = cli . native . path . basename ( cli . app ) <nl> + if ( ! keep_arg0 & & ( [ ' node ' , ' node . exe ' ] . indexOf ( cli . native . path . basename ( cli . app ) ) ! = = - 1 <nl> | | cli . native . path . basename ( process . execPath ) = = = cli . app <nl> | | process . execPath = = = cli . app ) ) { <nl> cli . app = arr . shift ( ) ; <nl> cli . parse = function ( opts , command_def ) { <nl> if ( commands & & ! Array . isArray ( commands ) ) { <nl> command_list = Object . keys ( commands ) ; <nl> } <nl> - while ( o = cli . next ( ) ) { <nl> + while ( ( o = cli . next ( ) ) ) { <nl> seen = false ; <nl> - for ( opt in opt_list ) { <nl> + for ( var opt in opt_list ) { <nl> if ( ! ( opt_list [ opt ] instanceof Array ) ) { <nl> continue ; <nl> } <nl> cli . parse = function ( opts , command_def ) { <nl> } <nl> } <nl> / / Fill the remaining options with their default value or null <nl> - for ( opt in opt_list ) { <nl> + for ( var opt in opt_list ) { <nl> default_val = opt_list [ opt ] . length = = = 4 ? opt_list [ opt ] [ 3 ] : null ; <nl> if ( ! ( opt_list [ opt ] instanceof Array ) ) { <nl> parsed [ opt ] = opt_list [ opt ] ; <nl> cli . getUsage = function ( code ) { <nl> console . error ( ' \ x1b [ 1mUsage \ x1b [ 0m : \ n ' + usage ) ; <nl> console . error ( ' \ n \ x1b [ 1mOptions \ x1b [ 0m : ' ) ; <nl> } <nl> - for ( opt in opt_list ) { <nl> + for ( var opt in opt_list ) { <nl> <nl> if ( opt . length = = = 1 ) { <nl> long = opt_list [ opt ] [ 0 ] ; <nl> cli . daemon = function ( arg , callback ) { <nl> cli . native . fs . readFileSync ( lock_file ) ; <nl> } catch ( e ) { <nl> return cli . error ( ' Daemon is not running ' ) ; <nl> - } ; <nl> + } <nl> daemon . kill ( lock_file , function ( err , pid ) { <nl> if ( err & & err . errno = = = 3 ) { <nl> return cli . error ( ' Daemon is not running ' ) ; <nl> cli . daemon = function ( arg , callback ) { <nl> cli . native . fs . createReadStream ( log_file , { encoding : ' utf8 ' } ) . pipe ( process . stdout ) ; <nl> } catch ( e ) { <nl> return cli . error ( ' No daemon log file ' ) ; <nl> - } ; <nl> + } <nl> break ; <nl> case ' pid ' : <nl> try { <nl> cli . daemon = function ( arg , callback ) { <nl> cli . info ( pid ) ; <nl> } catch ( e ) { <nl> return cli . error ( ' Daemon is not running ' ) ; <nl> - } ; <nl> + } <nl> break ; <nl> default : <nl> start ( ) ; <nl> cli . createServer = function ( / * layers * / ) { <nl> res . writeHead ( 404 , { " Content - Type " : " text / plain " } ) ; <nl> res . end ( " Not Found \ n " ) ; <nl> } ; <nl> - var handle = error = defaultStackErrorHandler , <nl> - layers = Array . prototype . slice . call ( arguments ) ; <nl> + var handle , error ; <nl> + handle = error = defaultStackErrorHandler ; <nl> + var layers = Array . prototype . slice . call ( arguments ) ; <nl> <nl> / / Allow createServer ( a , b , c ) and createServer ( [ a , b , c ] ) <nl> if ( layers . length & & layers [ 0 ] instanceof Array ) { <nl> mmm a / js / node / node_modules / jshint / node_modules / cli / examples / echo . js <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / examples / echo . js <nl> cli . main ( function ( args , options ) { <nl> if ( options . escape ) { <nl> var replace = { ' \ \ n ' : ' \ n ' , ' \ \ r ' : ' \ r ' , ' \ \ t ' : ' \ t ' , ' \ \ e ' : ' \ e ' , ' \ \ v ' : ' \ v ' , ' \ \ f ' : ' \ f ' , ' \ \ c ' : ' \ c ' , ' \ \ b ' : ' \ b ' , ' \ \ a ' : ' \ a ' , ' \ \ \ \ ' : ' \ \ ' } ; <nl> var escape = function ( str ) { <nl> - string + = ' ' ; <nl> + str + = ' ' ; <nl> for ( j in replace ) { <nl> - string = string . replace ( i , replace [ i ] ) ; <nl> + str = str . replace ( i , replace [ i ] ) ; <nl> } <nl> - return string ; <nl> + return str ; <nl> } <nl> for ( i = 0 , l = this . argc ; i < l ; i + + ) { <nl> args [ i ] = escape ( args [ i ] ) ; <nl> cli . main ( function ( args , options ) { <nl> } catch ( e ) { <nl> this . fatal ( ' Could not write to output stream ' ) ; <nl> } <nl> - } ) ; <nl> \ No newline at end of file <nl> + } ) ; <nl> mmm a / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / inherits / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / inherits / package . json <nl> <nl> " bugs " : { <nl> " url " : " https : / / github . com / isaacs / inherits / issues " <nl> } , <nl> - " homepage " : " https : / / github . com / isaacs / inherits " , <nl> " _id " : " inherits @ 2 . 0 . 1 " , <nl> - " _from " : " inherits @ 2 " <nl> + " dist " : { <nl> + " shasum " : " b17d08d326b4423e568eff719f91b0b1cbdf69f1 " , <nl> + " tarball " : " http : / / registry . npmjs . org / inherits / - / inherits - 2 . 0 . 1 . tgz " <nl> + } , <nl> + " _from " : " inherits @ > = 2 . 0 . 0 < 3 . 0 . 0 " , <nl> + " _npmVersion " : " 1 . 3 . 8 " , <nl> + " _npmUser " : { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } <nl> + ] , <nl> + " directories " : { } , <nl> + " _shasum " : " b17d08d326b4423e568eff719f91b0b1cbdf69f1 " , <nl> + " _resolved " : " https : / / registry . npmjs . org / inherits / - / inherits - 2 . 0 . 1 . tgz " , <nl> + " homepage " : " https : / / github . com / isaacs / inherits " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / minimatch / node_modules / lru - cache / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / minimatch / node_modules / lru - cache / package . json <nl> <nl> " type " : " MIT " , <nl> " url " : " http : / / github . com / isaacs / node - lru - cache / raw / master / LICENSE " <nl> } , <nl> - " readme " : " # lru cache \ n \ nA cache object that deletes the least - recently - used items . \ n \ n # # Usage : \ n \ n ` ` ` javascript \ nvar LRU = require ( \ " lru - cache \ " ) \ n , options = { max : 500 \ n , length : function ( n ) { return n * 2 } \ n , dispose : function ( key , n ) { n . close ( ) } \ n , maxAge : 1000 * 60 * 60 } \ n , cache = LRU ( options ) \ n , otherCache = LRU ( 50 ) / / sets just the max size \ n \ ncache . set ( \ " key \ " , \ " value \ " ) \ ncache . get ( \ " key \ " ) / / \ " value \ " \ n \ ncache . reset ( ) / / empty the cache \ n ` ` ` \ n \ nIf you put more stuff in it , then items will fall out . \ n \ nIf you try to put an oversized thing in it , then it ' ll fall out right \ naway . \ n \ n # # Options \ n \ n * ` max ` The maximum size of the cache , checked by applying the length \ n function to all values in the cache . Not setting this is kind of \ n silly , since that ' s the whole purpose of this lib , but it defaults \ n to ` Infinity ` . \ n * ` maxAge ` Maximum age in ms . Items are not pro - actively pruned out \ n as they age , but if you try to get an item that is too old , it ' ll \ n drop it and return undefined instead of giving it to you . \ n * ` length ` Function that is used to calculate the length of stored \ n items . If you ' re storing strings or buffers , then you probably want \ n to do something like ` function ( n ) { return n . length } ` . The default is \ n ` function ( n ) { return 1 } ` , which is fine if you want to store ` n ` \ n like - sized things . \ n * ` dispose ` Function that is called on items when they are dropped \ n from the cache . This can be handy if you want to close file \ n descriptors or do other cleanup tasks when items are no longer \ n accessible . Called with ` key , value ` . It ' s called * before * \ n actually removing the item from the internal cache , so if you want \ n to immediately put it back in , you ' ll have to do that in a \ n ` nextTick ` or ` setTimeout ` callback or it won ' t do anything . \ n * ` stale ` By default , if you set a ` maxAge ` , it ' ll only actually pull \ n stale items out of the cache when you ` get ( key ) ` . ( That is , it ' s \ n not pre - emptively doing a ` setTimeout ` or anything . ) If you set \ n ` stale : true ` , it ' ll return the stale value before deleting it . If \ n you don ' t set this , then it ' ll return ` undefined ` when you try to \ n get a stale entry , as if it had already been deleted . \ n \ n # # API \ n \ n * ` set ( key , value ) ` \ n * ` get ( key ) = > value ` \ n \ n Both of these will update the \ " recently used \ " - ness of the key . \ n They do what you think . \ n \ n * ` peek ( key ) ` \ n \ n Returns the key value ( or ` undefined ` if not found ) without \ n updating the \ " recently used \ " - ness of the key . \ n \ n ( If you find yourself using this a lot , you * might * be using the \ n wrong sort of data structure , but there are some use cases where \ n it ' s handy . ) \ n \ n * ` del ( key ) ` \ n \ n Deletes a key out of the cache . \ n \ n * ` reset ( ) ` \ n \ n Clear the cache entirely , throwing away all values . \ n \ n * ` has ( key ) ` \ n \ n Check if a key is in the cache , without updating the recent - ness \ n or deleting it for being stale . \ n \ n * ` forEach ( function ( value , key , cache ) , [ thisp ] ) ` \ n \ n Just like ` Array . prototype . forEach ` . Iterates over all the keys \ n in the cache , in order of recent - ness . ( Ie , more recently used \ n items are iterated over first . ) \ n \ n * ` keys ( ) ` \ n \ n Return an array of the keys in the cache . \ n \ n * ` values ( ) ` \ n \ n Return an array of the values in the cache . \ n " , <nl> - " readmeFilename " : " README . md " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / isaacs / node - lru - cache / issues " <nl> } , <nl> " homepage " : " https : / / github . com / isaacs / node - lru - cache " , <nl> " _id " : " lru - cache @ 2 . 5 . 0 " , <nl> - " _from " : " lru - cache @ 2 " <nl> + " dist " : { <nl> + " shasum " : " d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb " , <nl> + " tarball " : " http : / / registry . npmjs . org / lru - cache / - / lru - cache - 2 . 5 . 0 . tgz " <nl> + } , <nl> + " _from " : " lru - cache @ > = 2 . 0 . 0 < 3 . 0 . 0 " , <nl> + " _npmVersion " : " 1 . 3 . 15 " , <nl> + " _npmUser " : { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } <nl> + ] , <nl> + " directories " : { } , <nl> + " _shasum " : " d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb " , <nl> + " _resolved " : " https : / / registry . npmjs . org / lru - cache / - / lru - cache - 2 . 5 . 0 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / minimatch / node_modules / sigmund / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / minimatch / node_modules / sigmund / package . json <nl> <nl> } , <nl> " license " : " BSD " , <nl> " readme " : " # sigmund \ n \ nQuick and dirty signatures for Objects . \ n \ nThis is like a much faster ` deepEquals ` comparison , which returns a \ nstring key suitable for caches and the like . \ n \ n # # Usage \ n \ n ` ` ` javascript \ nfunction doSomething ( someObj ) { \ n var key = sigmund ( someObj , maxDepth ) / / max depth defaults to 10 \ n var cached = cache . get ( key ) \ n if ( cached ) return cached ) \ n \ n var result = expensiveCalculation ( someObj ) \ n cache . set ( key , result ) \ n return result \ n } \ n ` ` ` \ n \ nThe resulting key will be as unique and reproducible as calling \ n ` JSON . stringify ` or ` util . inspect ` on the object , but is much faster . \ nIn order to achieve this speed , some differences are glossed over . \ nFor example , the object ` { 0 : ' foo ' } ` will be treated identically to the \ narray ` [ ' foo ' ] ` . \ n \ nAlso , just as there is no way to summon the soul from the scribblings \ nof a cocain - addled psychoanalyst , there is no way to revive the object \ nfrom the signature string that sigmund gives you . In fact , it ' s \ nbarely even readable . \ n \ nAs with ` sys . inspect ` and ` JSON . stringify ` , larger objects will \ nproduce larger signature strings . \ n \ nBecause sigmund is a bit less strict than the more thorough \ nalternatives , the strings will be shorter , and also there is a \ nslightly higher chance for collisions . For example , these objects \ nhave the same signature : \ n \ n var obj1 = { a : ' b ' , c : / def / , g : [ ' h ' , ' i ' , { j : ' ' , k : ' l ' } ] } \ n var obj2 = { a : ' b ' , c : ' / def / ' , g : [ ' h ' , ' i ' , ' { jkl ' ] } \ n \ nLike a good Freudian , sigmund is most effective when you already have \ nsome understanding of what you ' re looking for . It can help you help \ nyourself , but you must be willing to do some work as well . \ n \ nCycles are handled , and cyclical objects are silently omitted ( though \ nthe key is included in the signature output . ) \ n \ nThe second argument is the maximum depth , which defaults to 10 , \ nbecause that is the maximum object traversal depth covered by most \ ninsurance carriers . \ n " , <nl> - " readmeFilename " : " README . md " , <nl> + " _id " : " sigmund @ 1 . 0 . 0 " , <nl> + " dist " : { <nl> + " shasum " : " 66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296 " , <nl> + " tarball " : " http : / / registry . npmjs . org / sigmund / - / sigmund - 1 . 0 . 0 . tgz " <nl> + } , <nl> + " _npmVersion " : " 1 . 1 . 48 " , <nl> + " _npmUser " : { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } <nl> + ] , <nl> + " _shasum " : " 66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296 " , <nl> + " _from " : " sigmund @ > = 1 . 0 . 0 < 1 . 1 . 0 " , <nl> + " _resolved " : " https : / / registry . npmjs . org / sigmund / - / sigmund - 1 . 0 . 0 . tgz " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / isaacs / sigmund / issues " <nl> } , <nl> - " homepage " : " https : / / github . com / isaacs / sigmund " , <nl> - " _id " : " sigmund @ 1 . 0 . 0 " , <nl> - " _from " : " sigmund @ ~ 1 . 0 . 0 " <nl> + " homepage " : " https : / / github . com / isaacs / sigmund " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / minimatch / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / node_modules / minimatch / package . json <nl> <nl> " type " : " MIT " , <nl> " url " : " http : / / github . com / isaacs / minimatch / raw / master / LICENSE " <nl> } , <nl> - " readme " : " # minimatch \ n \ nA minimal matching utility . \ n \ n [ ! [ Build Status ] ( https : / / secure . travis - ci . org / isaacs / minimatch . png ) ] ( http : / / travis - ci . org / isaacs / minimatch ) \ n \ n \ nThis is the matching library used internally by npm . \ n \ nEventually , it will replace the C binding in node - glob . \ n \ nIt works by converting glob expressions into JavaScript ` RegExp ` \ nobjects . \ n \ n # # Usage \ n \ n ` ` ` javascript \ nvar minimatch = require ( \ " minimatch \ " ) \ n \ nminimatch ( \ " bar . foo \ " , \ " * . foo \ " ) / / true ! \ nminimatch ( \ " bar . foo \ " , \ " * . bar \ " ) / / false ! \ nminimatch ( \ " bar . foo \ " , \ " * . + ( bar | foo ) \ " , { debug : true } ) / / true , and noisy ! \ n ` ` ` \ n \ n # # Features \ n \ nSupports these glob features : \ n \ n * Brace Expansion \ n * Extended glob matching \ n * \ " Globstar \ " ` * * ` matching \ n \ nSee : \ n \ n * ` man sh ` \ n * ` man bash ` \ n * ` man 3 fnmatch ` \ n * ` man 5 gitignore ` \ n \ n # # Minimatch Class \ n \ nCreate a minimatch object by instanting the ` minimatch . Minimatch ` class . \ n \ n ` ` ` javascript \ nvar Minimatch = require ( \ " minimatch \ " ) . Minimatch \ nvar mm = new Minimatch ( pattern , options ) \ n ` ` ` \ n \ n # # # Properties \ n \ n * ` pattern ` The original pattern the minimatch object represents . \ n * ` options ` The options supplied to the constructor . \ n * ` set ` A 2 - dimensional array of regexp or string expressions . \ n Each row in the \ n array corresponds to a brace - expanded pattern . Each item in the row \ n corresponds to a single path - part . For example , the pattern \ n ` { a , b / c } / d ` would expand to a set of patterns like : \ n \ n [ [ a , d ] \ n , [ b , c , d ] ] \ n \ n If a portion of the pattern doesn ' t have any \ " magic \ " in it \ n ( that is , it ' s something like ` \ " foo \ " ` rather than ` fo * o ? ` ) , then it \ n will be left as a string rather than converted to a regular \ n expression . \ n \ n * ` regexp ` Created by the ` makeRe ` method . A single regular expression \ n expressing the entire pattern . This is useful in cases where you wish \ n to use the pattern somewhat like ` fnmatch ( 3 ) ` with ` FNM_PATH ` enabled . \ n * ` negate ` True if the pattern is negated . \ n * ` comment ` True if the pattern is a comment . \ n * ` empty ` True if the pattern is ` \ " \ " ` . \ n \ n # # # Methods \ n \ n * ` makeRe ` Generate the ` regexp ` member if necessary , and return it . \ n Will return ` false ` if the pattern is invalid . \ n * ` match ( fname ) ` Return true if the filename matches the pattern , or \ n false otherwise . \ n * ` matchOne ( fileArray , patternArray , partial ) ` Take a ` / ` - split \ n filename , and match it against a single row in the ` regExpSet ` . This \ n method is mainly for internal use , but is exposed so that it can be \ n used by a glob - walker that needs to avoid excessive filesystem calls . \ n \ nAll other methods are internal , and will be called as necessary . \ n \ n # # Functions \ n \ nThe top - level exported function has a ` cache ` property , which is an LRU \ ncache set to store 100 items . So , calling these methods repeatedly \ nwith the same pattern and options will use the same Minimatch object , \ nsaving the cost of parsing it multiple times . \ n \ n # # # minimatch ( path , pattern , options ) \ n \ nMain export . Tests a path against the pattern using the options . \ n \ n ` ` ` javascript \ nvar isJS = minimatch ( file , \ " * . js \ " , { matchBase : true } ) \ n ` ` ` \ n \ n # # # minimatch . filter ( pattern , options ) \ n \ nReturns a function that tests its \ nsupplied argument , suitable for use with ` Array . filter ` . Example : \ n \ n ` ` ` javascript \ nvar javascripts = fileList . filter ( minimatch . filter ( \ " * . js \ " , { matchBase : true } ) ) \ n ` ` ` \ n \ n # # # minimatch . match ( list , pattern , options ) \ n \ nMatch against the list of \ nfiles , in the style of fnmatch or glob . If nothing is matched , and \ noptions . nonull is set , then return a list containing the pattern itself . \ n \ n ` ` ` javascript \ nvar javascripts = minimatch . match ( fileList , \ " * . js \ " , { matchBase : true } ) ) \ n ` ` ` \ n \ n # # # minimatch . makeRe ( pattern , options ) \ n \ nMake a regular expression object from the pattern . \ n \ n # # Options \ n \ nAll options are ` false ` by default . \ n \ n # # # debug \ n \ nDump a ton of stuff to stderr . \ n \ n # # # nobrace \ n \ nDo not expand ` { a , b } ` and ` { 1 . . 3 } ` brace sets . \ n \ n # # # noglobstar \ n \ nDisable ` * * ` matching against multiple folder names . \ n \ n # # # dot \ n \ nAllow patterns to match filenames starting with a period , even if \ nthe pattern does not explicitly have a period in that spot . \ n \ nNote that by default , ` a / * * / b ` will * * not * * match ` a / . d / b ` , unless ` dot ` \ nis set . \ n \ n # # # noext \ n \ nDisable \ " extglob \ " style patterns like ` + ( a | b ) ` . \ n \ n # # # nocase \ n \ nPerform a case - insensitive match . \ n \ n # # # nonull \ n \ nWhen a match is not found by ` minimatch . match ` , return a list containing \ nthe pattern itself if this option is set . When not set , an empty list \ nis returned if there are no matches . \ n \ n # # # matchBase \ n \ nIf set , then patterns without slashes will be matched \ nagainst the basename of the path if it contains slashes . For example , \ n ` a ? b ` would match the path ` / xyz / 123 / acb ` , but not ` / xyz / acb / 123 ` . \ n \ n # # # nocomment \ n \ nSuppress the behavior of treating ` # ` at the start of a pattern as a \ ncomment . \ n \ n # # # nonegate \ n \ nSuppress the behavior of treating a leading ` ! ` character as negation . \ n \ n # # # flipNegate \ n \ nReturns from negate expressions the same as if they were not negated . \ n ( Ie , true on a hit , false on a miss . ) \ n \ n \ n # # Comparisons to other fnmatch / glob implementations \ n \ nWhile strict compliance with the existing standards is a worthwhile \ ngoal , some discrepancies exist between minimatch and other \ nimplementations , and are intentional . \ n \ nIf the pattern starts with a ` ! ` character , then it is negated . Set the \ n ` nonegate ` flag to suppress this behavior , and treat leading ` ! ` \ ncharacters normally . This is perhaps relevant if you wish to start the \ npattern with a negative extglob pattern like ` ! ( a | B ) ` . Multiple ` ! ` \ ncharacters at the start of a pattern will negate the pattern multiple \ ntimes . \ n \ nIf a pattern starts with ` # ` , then it is treated as a comment , and \ nwill not match anything . Use ` \ \ # ` to match a literal ` # ` at the \ nstart of a line , or set the ` nocomment ` flag to suppress this behavior . \ n \ nThe double - star character ` * * ` is supported by default , unless the \ n ` noglobstar ` flag is set . This is supported in the manner of bsdglob \ nand bash 4 . 1 , where ` * * ` only has special significance if it is the only \ nthing in a path part . That is , ` a / * * / b ` will match ` a / x / y / b ` , but \ n ` a / * * b ` will not . \ n \ nIf an escaped pattern has no matches , and the ` nonull ` flag is set , \ nthen minimatch . match returns the pattern as - provided , rather than \ ninterpreting the character escapes . For example , \ n ` minimatch . match ( [ ] , \ " \ \ \ \ * a \ \ \ \ ? \ " ) ` will return ` \ " \ \ \ \ * a \ \ \ \ ? \ " ` rather than \ n ` \ " * a ? \ " ` . This is akin to setting the ` nullglob ` option in bash , except \ nthat it does not resolve escaped pattern characters . \ n \ nIf brace expansion is not disabled , then it is performed before any \ nother interpretation of the glob pattern . Thus , a pattern like \ n ` + ( a | { b ) , c ) } ` , which would not be valid in bash or zsh , is expanded \ n * * first * * into the set of ` + ( a | b ) ` and ` + ( a | c ) ` , and those patterns are \ nchecked for validity . Since those two are valid , matching proceeds . \ n " , <nl> - " readmeFilename " : " README . md " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / isaacs / minimatch / issues " <nl> } , <nl> " homepage " : " https : / / github . com / isaacs / minimatch " , <nl> " _id " : " minimatch @ 0 . 3 . 0 " , <nl> - " _from " : " minimatch @ 0 . 3 " <nl> + " _shasum " : " 275d8edaac4f1bb3326472089e7949c8394699dd " , <nl> + " _from " : " minimatch @ > = 0 . 3 . 0 < 0 . 4 . 0 " , <nl> + " _npmVersion " : " 1 . 4 . 10 " , <nl> + " _npmUser " : { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } <nl> + ] , <nl> + " dist " : { <nl> + " shasum " : " 275d8edaac4f1bb3326472089e7949c8394699dd " , <nl> + " tarball " : " http : / / registry . npmjs . org / minimatch / - / minimatch - 0 . 3 . 0 . tgz " <nl> + } , <nl> + " directories " : { } , <nl> + " _resolved " : " https : / / registry . npmjs . org / minimatch / - / minimatch - 0 . 3 . 0 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / node_modules / glob / package . json <nl> <nl> " test - regen " : " TEST_REGEN = 1 node test / 00 - setup . js " <nl> } , <nl> " license " : " BSD " , <nl> - " readme " : " # Glob \ n \ nMatch files using the patterns the shell uses , like stars and stuff . \ n \ nThis is a glob implementation in JavaScript . It uses the ` minimatch ` \ nlibrary to do its matching . \ n \ n # # Attention : node - glob users ! \ n \ nThe API has changed dramatically between 2 . x and 3 . x . This library is \ nnow 100 % JavaScript , and the integer flags have been replaced with an \ noptions object . \ n \ nAlso , there ' s an event emitter class , proper tests , and all the other \ nthings you ' ve come to expect from node modules . \ n \ nAnd best of all , no compilation ! \ n \ n # # Usage \ n \ n ` ` ` javascript \ nvar glob = require ( \ " glob \ " ) \ n \ n / / options is optional \ nglob ( \ " * * / * . js \ " , options , function ( er , files ) { \ n / / files is an array of filenames . \ n / / If the ` nonull ` option is set , and nothing \ n / / was found , then files is [ \ " * * / * . js \ " ] \ n / / er is an error object or null . \ n } ) \ n ` ` ` \ n \ n # # Features \ n \ nPlease see the [ minimatch \ ndocumentation ] ( https : / / github . com / isaacs / minimatch ) for more details . \ n \ nSupports these glob features : \ n \ n * Brace Expansion \ n * Extended glob matching \ n * \ " Globstar \ " ` * * ` matching \ n \ nSee : \ n \ n * ` man sh ` \ n * ` man bash ` \ n * ` man 3 fnmatch ` \ n * ` man 5 gitignore ` \ n * [ minimatch documentation ] ( https : / / github . com / isaacs / minimatch ) \ n \ n # # glob ( pattern , [ options ] , cb ) \ n \ n * ` pattern ` { String } Pattern to be matched \ n * ` options ` { Object } \ n * ` cb ` { Function } \ n * ` err ` { Error | null } \ n * ` matches ` { Array < String > } filenames found matching the pattern \ n \ nPerform an asynchronous glob search . \ n \ n # # glob . sync ( pattern , [ options ] ) \ n \ n * ` pattern ` { String } Pattern to be matched \ n * ` options ` { Object } \ n * return : { Array < String > } filenames found matching the pattern \ n \ nPerform a synchronous glob search . \ n \ n # # Class : glob . Glob \ n \ nCreate a Glob object by instanting the ` glob . Glob ` class . \ n \ n ` ` ` javascript \ nvar Glob = require ( \ " glob \ " ) . Glob \ nvar mg = new Glob ( pattern , options , cb ) \ n ` ` ` \ n \ nIt ' s an EventEmitter , and starts walking the filesystem to find matches \ nimmediately . \ n \ n # # # new glob . Glob ( pattern , [ options ] , [ cb ] ) \ n \ n * ` pattern ` { String } pattern to search for \ n * ` options ` { Object } \ n * ` cb ` { Function } Called when an error occurs , or matches are found \ n * ` err ` { Error | null } \ n * ` matches ` { Array < String > } filenames found matching the pattern \ n \ nNote that if the ` sync ` flag is set in the options , then matches will \ nbe immediately available on the ` g . found ` member . \ n \ n # # # Properties \ n \ n * ` minimatch ` The minimatch object that the glob uses . \ n * ` options ` The options object passed in . \ n * ` error ` The error encountered . When an error is encountered , the \ n glob object is in an undefined state , and should be discarded . \ n * ` aborted ` Boolean which is set to true when calling ` abort ( ) ` . There \ n is no way at this time to continue a glob search after aborting , but \ n you can re - use the statCache to avoid having to duplicate syscalls . \ n * ` statCache ` Collection of all the stat results the glob search \ n performed . \ n * ` cache ` Convenience object . Each field has the following possible \ n values : \ n * ` false ` - Path does not exist \ n * ` true ` - Path exists \ n * ` 1 ` - Path exists , and is not a directory \ n * ` 2 ` - Path exists , and is a directory \ n * ` [ file , entries , . . . ] ` - Path exists , is a directory , and the \ n array value is the results of ` fs . readdir ` \ n \ n # # # Events \ n \ n * ` end ` When the matching is finished , this is emitted with all the \ n matches found . If the ` nonull ` option is set , and no match was found , \ n then the ` matches ` list contains the original pattern . The matches \ n are sorted , unless the ` nosort ` flag is set . \ n * ` match ` Every time a match is found , this is emitted with the matched . \ n * ` error ` Emitted when an unexpected error is encountered , or whenever \ n any fs error occurs if ` options . strict ` is set . \ n * ` abort ` When ` abort ( ) ` is called , this event is raised . \ n \ n # # # Methods \ n \ n * ` abort ` Stop the search . \ n \ n # # # Options \ n \ nAll the options that can be passed to Minimatch can also be passed to \ nGlob to change pattern matching behavior . Also , some have been added , \ nor have glob - specific ramifications . \ n \ nAll options are false by default , unless otherwise noted . \ n \ nAll options are added to the glob object , as well . \ n \ n * ` cwd ` The current working directory in which to search . Defaults \ n to ` process . cwd ( ) ` . \ n * ` root ` The place where patterns starting with ` / ` will be mounted \ n onto . Defaults to ` path . resolve ( options . cwd , \ " / \ " ) ` ( ` / ` on Unix \ n systems , and ` C : \ \ ` or some such on Windows . ) \ n * ` dot ` Include ` . dot ` files in normal matches and ` globstar ` matches . \ n Note that an explicit dot in a portion of the pattern will always \ n match dot files . \ n * ` nomount ` By default , a pattern starting with a forward - slash will be \ n \ " mounted \ " onto the root setting , so that a valid filesystem path is \ n returned . Set this flag to disable that behavior . \ n * ` mark ` Add a ` / ` character to directory matches . Note that this \ n requires additional stat calls . \ n * ` nosort ` Don ' t sort the results . \ n * ` stat ` Set to true to stat * all * results . This reduces performance \ n somewhat , and is completely unnecessary , unless ` readdir ` is presumed \ n to be an untrustworthy indicator of file existence . It will cause \ n ELOOP to be triggered one level sooner in the case of cyclical \ n symbolic links . \ n * ` silent ` When an unusual error is encountered \ n when attempting to read a directory , a warning will be printed to \ n stderr . Set the ` silent ` option to true to suppress these warnings . \ n * ` strict ` When an unusual error is encountered \ n when attempting to read a directory , the process will just continue on \ n in search of other matches . Set the ` strict ` option to raise an error \ n in these cases . \ n * ` cache ` See ` cache ` property above . Pass in a previously generated \ n cache object to save some fs calls . \ n * ` statCache ` A cache of results of filesystem information , to prevent \ n unnecessary stat calls . While it should not normally be necessary to \ n set this , you may pass the statCache from one glob ( ) call to the \ n options object of another , if you know that the filesystem will not \ n change between calls . ( See \ " Race Conditions \ " below . ) \ n * ` sync ` Perform a synchronous glob search . \ n * ` nounique ` In some cases , brace - expanded patterns can result in the \ n same file showing up multiple times in the result set . By default , \ n this implementation prevents duplicates in the result set . \ n Set this flag to disable that behavior . \ n * ` nonull ` Set to never return an empty set , instead returning a set \ n containing the pattern itself . This is the default in glob ( 3 ) . \ n * ` nocase ` Perform a case - insensitive match . Note that case - insensitive \ n filesystems will sometimes result in glob returning results that are \ n case - insensitively matched anyway , since readdir and stat will not \ n raise an error . \ n * ` debug ` Set to enable debug logging in minimatch and glob . \ n * ` globDebug ` Set to enable debug logging in glob , but not minimatch . \ n \ n # # Comparisons to other fnmatch / glob implementations \ n \ nWhile strict compliance with the existing standards is a worthwhile \ ngoal , some discrepancies exist between node - glob and other \ nimplementations , and are intentional . \ n \ nIf the pattern starts with a ` ! ` character , then it is negated . Set the \ n ` nonegate ` flag to suppress this behavior , and treat leading ` ! ` \ ncharacters normally . This is perhaps relevant if you wish to start the \ npattern with a negative extglob pattern like ` ! ( a | B ) ` . Multiple ` ! ` \ ncharacters at the start of a pattern will negate the pattern multiple \ ntimes . \ n \ nIf a pattern starts with ` # ` , then it is treated as a comment , and \ nwill not match anything . Use ` \ \ # ` to match a literal ` # ` at the \ nstart of a line , or set the ` nocomment ` flag to suppress this behavior . \ n \ nThe double - star character ` * * ` is supported by default , unless the \ n ` noglobstar ` flag is set . This is supported in the manner of bsdglob \ nand bash 4 . 1 , where ` * * ` only has special significance if it is the only \ nthing in a path part . That is , ` a / * * / b ` will match ` a / x / y / b ` , but \ n ` a / * * b ` will not . \ n \ nIf an escaped pattern has no matches , and the ` nonull ` flag is set , \ nthen glob returns the pattern as - provided , rather than \ ninterpreting the character escapes . For example , \ n ` glob . match ( [ ] , \ " \ \ \ \ * a \ \ \ \ ? \ " ) ` will return ` \ " \ \ \ \ * a \ \ \ \ ? \ " ` rather than \ n ` \ " * a ? \ " ` . This is akin to setting the ` nullglob ` option in bash , except \ nthat it does not resolve escaped pattern characters . \ n \ nIf brace expansion is not disabled , then it is performed before any \ nother interpretation of the glob pattern . Thus , a pattern like \ n ` + ( a | { b ) , c ) } ` , which would not be valid in bash or zsh , is expanded \ n * * first * * into the set of ` + ( a | b ) ` and ` + ( a | c ) ` , and those patterns are \ nchecked for validity . Since those two are valid , matching proceeds . \ n \ n # # Windows \ n \ n * * Please only use forward - slashes in glob expressions . * * \ n \ nThough windows uses either ` / ` or ` \ \ ` as its path separator , only ` / ` \ ncharacters are used by this glob implementation . You must use \ nforward - slashes * * only * * in glob expressions . Back - slashes will always \ nbe interpreted as escape characters , not path separators . \ n \ nResults from absolute patterns such as ` / foo / * ` are mounted onto the \ nroot setting using ` path . join ` . On windows , this will by default result \ nin ` / foo / * ` matching ` C : \ \ foo \ \ bar . txt ` . \ n \ n # # Race Conditions \ n \ nGlob searching , by its very nature , is susceptible to race conditions , \ nsince it relies on directory walking and such . \ n \ nAs a result , it is possible that a file that exists when glob looks for \ nit may have been deleted or modified by the time it returns the result . \ n \ nAs part of its internal implementation , this program caches all stat \ nand readdir calls that it makes , in order to cut down on system \ noverhead . However , this also makes it even more susceptible to races , \ nespecially if the cache or statCache objects are reused between glob \ ncalls . \ n \ nUsers are thus advised not to use a glob result as a guarantee of \ nfilesystem state in the face of rapid changes . For the vast majority \ nof operations , this is never a problem . \ n " , <nl> - " readmeFilename " : " README . md " , <nl> + " gitHead " : " 73f57e99510582b2024b762305970ebcf9b70aa2 " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / isaacs / node - glob / issues " <nl> } , <nl> " homepage " : " https : / / github . com / isaacs / node - glob " , <nl> " _id " : " glob @ 3 . 2 . 11 " , <nl> - " _from " : " glob @ ~ 3 . 2 . 1 " <nl> + " _shasum " : " 4a973f635b9190f715d10987d5c00fd2815ebe3d " , <nl> + " _from " : " glob @ > = 3 . 2 . 1 < 3 . 3 . 0 " , <nl> + " _npmVersion " : " 1 . 4 . 10 " , <nl> + " _npmUser " : { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } <nl> + ] , <nl> + " dist " : { <nl> + " shasum " : " 4a973f635b9190f715d10987d5c00fd2815ebe3d " , <nl> + " tarball " : " http : / / registry . npmjs . org / glob / - / glob - 3 . 2 . 11 . tgz " <nl> + } , <nl> + " directories " : { } , <nl> + " _resolved " : " https : / / registry . npmjs . org / glob / - / glob - 3 . 2 . 11 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / cli / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / cli / package . json <nl> <nl> { <nl> " name " : " cli " , <nl> " description " : " A tool for rapidly building command line apps " , <nl> - " version " : " 0 . 6 . 3 " , <nl> + " version " : " 0 . 6 . 5 " , <nl> " homepage " : " http : / / github . com / chriso / cli " , <nl> " keywords " : [ <nl> " cli " , <nl> <nl> " type " : " MIT " <nl> } <nl> ] , <nl> - " _id " : " cli @ 0 . 6 . 3 " , <nl> - " _shasum " : " 31418ed08d60a1b02cf180c6d6fee3204bfe65cd " , <nl> - " _from " : " cli @ 0 . 6 . x " , <nl> - " _npmVersion " : " 1 . 4 . 10 " , <nl> + " gitHead " : " 18eca8df3813a399b2998dcb58e9a21af63caf4c " , <nl> + " _id " : " cli @ 0 . 6 . 5 " , <nl> + " scripts " : { } , <nl> + " _shasum " : " f4edda12dfa8d56d726b43b0b558e089b0d2a85c " , <nl> + " _from " : " cli @ > = 0 . 6 . 0 < 0 . 7 . 0 " , <nl> + " _npmVersion " : " 2 . 0 . 0 " , <nl> " _npmUser " : { <nl> " name " : " cohara87 " , <nl> " email " : " cohara87 @ gmail . com " <nl> <nl> } <nl> ] , <nl> " dist " : { <nl> - " shasum " : " 31418ed08d60a1b02cf180c6d6fee3204bfe65cd " , <nl> - " tarball " : " http : / / registry . npmjs . org / cli / - / cli - 0 . 6 . 3 . tgz " <nl> + " shasum " : " f4edda12dfa8d56d726b43b0b558e089b0d2a85c " , <nl> + " tarball " : " http : / / registry . npmjs . org / cli / - / cli - 0 . 6 . 5 . tgz " <nl> } , <nl> " directories " : { } , <nl> - " _resolved " : " https : / / registry . npmjs . org / cli / - / cli - 0 . 6 . 3 . tgz " , <nl> - " readme " : " ERROR : No README data found ! " , <nl> - " scripts " : { } <nl> + " _resolved " : " https : / / registry . npmjs . org / cli / - / cli - 0 . 6 . 5 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / console - browserify / node_modules / date - now / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / console - browserify / node_modules / date - now / package . json <nl> <nl> ] <nl> } <nl> } , <nl> - " readme " : " # date - now \ n \ n [ ! [ build status ] [ 1 ] ] [ 2 ] \ n \ n [ ! [ browser support ] [ 3 ] ] [ 4 ] \ n \ nA requirable version of Date . now ( ) \ n \ nUse - case is to be able to mock out Date . now ( ) using require interception . \ n \ n # # Example \ n \ n ` ` ` js \ nvar now = require ( \ " date - now \ " ) \ n \ nvar ts = now ( ) \ nvar ts2 = Date . now ( ) \ nassert . equal ( ts , ts2 ) \ n ` ` ` \ n \ n # # example of seed \ n \ n ` ` ` \ nvar now = require ( \ " date - now / seed \ " ) ( timeStampFromServer ) \ n \ n / / ts is in \ " sync \ " with the seed value from the server \ n / / useful if your users have their local time being a few minutes \ n / / out of your server time . \ nvar ts = now ( ) \ n ` ` ` \ n \ n # # Installation \ n \ n ` npm install date - now ` \ n \ n # # Contributors \ n \ n - Raynos \ n \ n # # MIT Licenced \ n \ n [ 1 ] : https : / / secure . travis - ci . org / Colingo / date - now . png \ n [ 2 ] : http : / / travis - ci . org / Colingo / date - now \ n [ 3 ] : http : / / ci . testling . com / Colingo / date - now . png \ n [ 4 ] : http : / / ci . testling . com / Colingo / date - now \ n " , <nl> - " readmeFilename " : " README . md " , <nl> " _id " : " date - now @ 0 . 1 . 4 " , <nl> - " _from " : " date - now @ ^ 0 . 1 . 4 " <nl> + " dist " : { <nl> + " shasum " : " eaf439fd4d4848ad74e5cc7dbef200672b9e345b " , <nl> + " tarball " : " http : / / registry . npmjs . org / date - now / - / date - now - 0 . 1 . 4 . tgz " <nl> + } , <nl> + " _from " : " date - now @ > = 0 . 1 . 4 < 0 . 2 . 0 " , <nl> + " _npmVersion " : " 1 . 2 . 3 " , <nl> + " _npmUser " : { <nl> + " name " : " raynos " , <nl> + " email " : " raynos2 @ gmail . com " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " raynos " , <nl> + " email " : " raynos2 @ gmail . com " <nl> + } <nl> + ] , <nl> + " directories " : { } , <nl> + " _shasum " : " eaf439fd4d4848ad74e5cc7dbef200672b9e345b " , <nl> + " _resolved " : " https : / / registry . npmjs . org / date - now / - / date - now - 0 . 1 . 4 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / console - browserify / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / console - browserify / package . json <nl> <nl> " android - browser / 4 . 2 . . latest " <nl> ] <nl> } , <nl> - " readme " : " # console - browserify \ n \ n [ ! [ build status ] [ 1 ] ] [ 2 ] \ n \ n [ ! [ browser support ] [ 3 ] ] [ 4 ] \ n \ n \ nEmulate console for all the browsers \ n \ n # # Example \ n \ n ` ` ` js \ nvar console = require ( \ " console - browserify \ " ) \ n \ nconsole . log ( \ " hello world ! \ " ) \ n ` ` ` \ n \ n # # Installation \ n \ n ` npm install console - browserify ` \ n \ n # # Contributors \ n \ n - Raynos \ n \ n # # MIT Licenced \ n \ n \ n \ n [ 1 ] : https : / / secure . travis - ci . org / Raynos / console - browserify . png \ n [ 2 ] : http : / / travis - ci . org / Raynos / console - browserify \ n [ 3 ] : http : / / ci . testling . com / Raynos / console - browserify . png \ n [ 4 ] : http : / / ci . testling . com / Raynos / console - browserify \ n " , <nl> - " readmeFilename " : " README . md " , <nl> " _id " : " console - browserify @ 1 . 1 . 0 " , <nl> - " _from " : " console - browserify @ 1 . 1 . x " <nl> + " dist " : { <nl> + " shasum " : " f0241c45730a9fc6323b206dbf38edc741d0bb10 " , <nl> + " tarball " : " http : / / registry . npmjs . org / console - browserify / - / console - browserify - 1 . 1 . 0 . tgz " <nl> + } , <nl> + " _from " : " console - browserify @ > = 1 . 1 . 0 < 1 . 2 . 0 " , <nl> + " _npmVersion " : " 1 . 4 . 6 " , <nl> + " _npmUser " : { <nl> + " name " : " raynos " , <nl> + " email " : " raynos2 @ gmail . com " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " raynos " , <nl> + " email " : " raynos2 @ gmail . com " <nl> + } <nl> + ] , <nl> + " directories " : { } , <nl> + " _shasum " : " f0241c45730a9fc6323b206dbf38edc741d0bb10 " , <nl> + " _resolved " : " https : / / registry . npmjs . org / console - browserify / - / console - browserify - 1 . 1 . 0 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / exit / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / exit / package . json <nl> <nl> " readme " : " # exit [ ! [ Build Status ] ( https : / / secure . travis - ci . org / cowboy / node - exit . png ? branch = master ) ] ( http : / / travis - ci . org / cowboy / node - exit ) \ n \ nA replacement for process . exit that ensures stdio are fully drained before exiting . \ n \ nTo make a long story short , if ` process . exit ` is called on Windows , script output is often truncated when pipe - redirecting ` stdout ` or ` stderr ` . This module attempts to work around this issue by waiting until those streams have been completely drained before actually calling ` process . exit ` . \ n \ nSee [ Node . js issue # 3584 ] ( https : / / github . com / joyent / node / issues / 3584 ) for further reference . \ n \ nTested in OS X 10 . 8 , Windows 7 on Node . js 0 . 8 . 25 and 0 . 10 . 18 . \ n \ nBased on some code by [ @ vladikoff ] ( https : / / github . com / vladikoff ) . \ n \ n # # Getting Started \ nInstall the module with : ` npm install exit ` \ n \ n ` ` ` javascript \ nvar exit = require ( ' exit ' ) ; \ n \ n / / These lines should appear in the output , EVEN ON WINDOWS . \ nconsole . log ( \ " omg \ " ) ; \ nconsole . error ( \ " yay \ " ) ; \ n \ n / / process . exit ( 5 ) ; \ nexit ( 5 ) ; \ n \ n / / These lines shouldn ' t appear in the output . \ nconsole . log ( \ " wtf \ " ) ; \ nconsole . error ( \ " bro \ " ) ; \ n ` ` ` \ n \ n # # Don ' t believe me ? Try it for yourself . \ n \ nIn Windows , clone the repo and cd to the ` test \ \ fixtures ` directory . The only difference between [ log . js ] ( test / fixtures / log . js ) and [ log - broken . js ] ( test / fixtures / log - broken . js ) is that the former uses ` exit ` while the latter calls ` process . exit ` directly . \ n \ nThis test was done using cmd . exe , but you can see the same results using ` | grep \ " std \ " ` in either PowerShell or git - bash . \ n \ n ` ` ` \ nC : \ \ node - exit \ \ test \ \ fixtures > node log . js 0 10 stdout stderr 2 > & 1 | find \ " std \ " \ nstdout 0 \ nstderr 0 \ nstdout 1 \ nstderr 1 \ nstdout 2 \ nstderr 2 \ nstdout 3 \ nstderr 3 \ nstdout 4 \ nstderr 4 \ nstdout 5 \ nstderr 5 \ nstdout 6 \ nstderr 6 \ nstdout 7 \ nstderr 7 \ nstdout 8 \ nstderr 8 \ nstdout 9 \ nstderr 9 \ n \ nC : \ \ node - exit \ \ test \ \ fixtures > node log - broken . js 0 10 stdout stderr 2 > & 1 | find \ " std \ " \ n \ nC : \ \ node - exit \ \ test \ \ fixtures > \ n ` ` ` \ n \ n # # Contributing \ nIn lieu of a formal styleguide , take care to maintain the existing coding style . Add unit tests for any new or changed functionality . Lint and test your code using [ Grunt ] ( http : / / gruntjs . com / ) . \ n \ n # # Release History \ n2013 - 11 - 26 - v0 . 1 . 2 - Fixed a bug with hanging processes . \ n2013 - 09 - 26 - v0 . 1 . 1 - Fixed some bugs . It seems to actually work now ! \ n2013 - 09 - 20 - v0 . 1 . 0 - Initial release . \ n \ n # # License \ nCopyright ( c ) 2013 \ " Cowboy \ " Ben Alman \ nLicensed under the MIT license . \ n " , <nl> " readmeFilename " : " README . md " , <nl> " _id " : " exit @ 0 . 1 . 2 " , <nl> - " _from " : " exit @ 0 . 1 . x " <nl> + " dist " : { <nl> + " shasum " : " 0632638f8d877cc82107d30a0fff1a17cba1cd0c " , <nl> + " tarball " : " http : / / registry . npmjs . org / exit / - / exit - 0 . 1 . 2 . tgz " <nl> + } , <nl> + " _from " : " exit @ > = 0 . 1 . 0 < 0 . 2 . 0 " , <nl> + " _npmVersion " : " 1 . 3 . 11 " , <nl> + " _npmUser " : { <nl> + " name " : " cowboy " , <nl> + " email " : " cowboy @ rj3 . net " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " cowboy " , <nl> + " email " : " cowboy @ rj3 . net " <nl> + } <nl> + ] , <nl> + " directories " : { } , <nl> + " _shasum " : " 0632638f8d877cc82107d30a0fff1a17cba1cd0c " , <nl> + " _resolved " : " https : / / registry . npmjs . org / exit / - / exit - 0 . 1 . 2 . tgz " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / minimatch / node_modules / lru - cache / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / minimatch / node_modules / lru - cache / package . json <nl> <nl> " type " : " MIT " , <nl> " url " : " http : / / github . com / isaacs / node - lru - cache / raw / master / LICENSE " <nl> } , <nl> - " readme " : " # lru cache \ n \ nA cache object that deletes the least - recently - used items . \ n \ n # # Usage : \ n \ n ` ` ` javascript \ nvar LRU = require ( \ " lru - cache \ " ) \ n , options = { max : 500 \ n , length : function ( n ) { return n * 2 } \ n , dispose : function ( key , n ) { n . close ( ) } \ n , maxAge : 1000 * 60 * 60 } \ n , cache = LRU ( options ) \ n , otherCache = LRU ( 50 ) / / sets just the max size \ n \ ncache . set ( \ " key \ " , \ " value \ " ) \ ncache . get ( \ " key \ " ) / / \ " value \ " \ n \ ncache . reset ( ) / / empty the cache \ n ` ` ` \ n \ nIf you put more stuff in it , then items will fall out . \ n \ nIf you try to put an oversized thing in it , then it ' ll fall out right \ naway . \ n \ n # # Options \ n \ n * ` max ` The maximum size of the cache , checked by applying the length \ n function to all values in the cache . Not setting this is kind of \ n silly , since that ' s the whole purpose of this lib , but it defaults \ n to ` Infinity ` . \ n * ` maxAge ` Maximum age in ms . Items are not pro - actively pruned out \ n as they age , but if you try to get an item that is too old , it ' ll \ n drop it and return undefined instead of giving it to you . \ n * ` length ` Function that is used to calculate the length of stored \ n items . If you ' re storing strings or buffers , then you probably want \ n to do something like ` function ( n ) { return n . length } ` . The default is \ n ` function ( n ) { return 1 } ` , which is fine if you want to store ` n ` \ n like - sized things . \ n * ` dispose ` Function that is called on items when they are dropped \ n from the cache . This can be handy if you want to close file \ n descriptors or do other cleanup tasks when items are no longer \ n accessible . Called with ` key , value ` . It ' s called * before * \ n actually removing the item from the internal cache , so if you want \ n to immediately put it back in , you ' ll have to do that in a \ n ` nextTick ` or ` setTimeout ` callback or it won ' t do anything . \ n * ` stale ` By default , if you set a ` maxAge ` , it ' ll only actually pull \ n stale items out of the cache when you ` get ( key ) ` . ( That is , it ' s \ n not pre - emptively doing a ` setTimeout ` or anything . ) If you set \ n ` stale : true ` , it ' ll return the stale value before deleting it . If \ n you don ' t set this , then it ' ll return ` undefined ` when you try to \ n get a stale entry , as if it had already been deleted . \ n \ n # # API \ n \ n * ` set ( key , value ) ` \ n * ` get ( key ) = > value ` \ n \ n Both of these will update the \ " recently used \ " - ness of the key . \ n They do what you think . \ n \ n * ` peek ( key ) ` \ n \ n Returns the key value ( or ` undefined ` if not found ) without \ n updating the \ " recently used \ " - ness of the key . \ n \ n ( If you find yourself using this a lot , you * might * be using the \ n wrong sort of data structure , but there are some use cases where \ n it ' s handy . ) \ n \ n * ` del ( key ) ` \ n \ n Deletes a key out of the cache . \ n \ n * ` reset ( ) ` \ n \ n Clear the cache entirely , throwing away all values . \ n \ n * ` has ( key ) ` \ n \ n Check if a key is in the cache , without updating the recent - ness \ n or deleting it for being stale . \ n \ n * ` forEach ( function ( value , key , cache ) , [ thisp ] ) ` \ n \ n Just like ` Array . prototype . forEach ` . Iterates over all the keys \ n in the cache , in order of recent - ness . ( Ie , more recently used \ n items are iterated over first . ) \ n \ n * ` keys ( ) ` \ n \ n Return an array of the keys in the cache . \ n \ n * ` values ( ) ` \ n \ n Return an array of the values in the cache . \ n " , <nl> - " readmeFilename " : " README . md " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / isaacs / node - lru - cache / issues " <nl> } , <nl> " homepage " : " https : / / github . com / isaacs / node - lru - cache " , <nl> " _id " : " lru - cache @ 2 . 5 . 0 " , <nl> - " _from " : " lru - cache @ 2 " <nl> + " dist " : { <nl> + " shasum " : " d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb " , <nl> + " tarball " : " http : / / registry . npmjs . org / lru - cache / - / lru - cache - 2 . 5 . 0 . tgz " <nl> + } , <nl> + " _from " : " lru - cache @ > = 2 . 0 . 0 < 3 . 0 . 0 " , <nl> + " _npmVersion " : " 1 . 3 . 15 " , <nl> + " _npmUser " : { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } <nl> + ] , <nl> + " directories " : { } , <nl> + " _shasum " : " d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb " , <nl> + " _resolved " : " https : / / registry . npmjs . org / lru - cache / - / lru - cache - 2 . 5 . 0 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / minimatch / node_modules / sigmund / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / minimatch / node_modules / sigmund / package . json <nl> <nl> } , <nl> " license " : " BSD " , <nl> " readme " : " # sigmund \ n \ nQuick and dirty signatures for Objects . \ n \ nThis is like a much faster ` deepEquals ` comparison , which returns a \ nstring key suitable for caches and the like . \ n \ n # # Usage \ n \ n ` ` ` javascript \ nfunction doSomething ( someObj ) { \ n var key = sigmund ( someObj , maxDepth ) / / max depth defaults to 10 \ n var cached = cache . get ( key ) \ n if ( cached ) return cached ) \ n \ n var result = expensiveCalculation ( someObj ) \ n cache . set ( key , result ) \ n return result \ n } \ n ` ` ` \ n \ nThe resulting key will be as unique and reproducible as calling \ n ` JSON . stringify ` or ` util . inspect ` on the object , but is much faster . \ nIn order to achieve this speed , some differences are glossed over . \ nFor example , the object ` { 0 : ' foo ' } ` will be treated identically to the \ narray ` [ ' foo ' ] ` . \ n \ nAlso , just as there is no way to summon the soul from the scribblings \ nof a cocain - addled psychoanalyst , there is no way to revive the object \ nfrom the signature string that sigmund gives you . In fact , it ' s \ nbarely even readable . \ n \ nAs with ` sys . inspect ` and ` JSON . stringify ` , larger objects will \ nproduce larger signature strings . \ n \ nBecause sigmund is a bit less strict than the more thorough \ nalternatives , the strings will be shorter , and also there is a \ nslightly higher chance for collisions . For example , these objects \ nhave the same signature : \ n \ n var obj1 = { a : ' b ' , c : / def / , g : [ ' h ' , ' i ' , { j : ' ' , k : ' l ' } ] } \ n var obj2 = { a : ' b ' , c : ' / def / ' , g : [ ' h ' , ' i ' , ' { jkl ' ] } \ n \ nLike a good Freudian , sigmund is most effective when you already have \ nsome understanding of what you ' re looking for . It can help you help \ nyourself , but you must be willing to do some work as well . \ n \ nCycles are handled , and cyclical objects are silently omitted ( though \ nthe key is included in the signature output . ) \ n \ nThe second argument is the maximum depth , which defaults to 10 , \ nbecause that is the maximum object traversal depth covered by most \ ninsurance carriers . \ n " , <nl> - " readmeFilename " : " README . md " , <nl> + " _id " : " sigmund @ 1 . 0 . 0 " , <nl> + " dist " : { <nl> + " shasum " : " 66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296 " , <nl> + " tarball " : " http : / / registry . npmjs . org / sigmund / - / sigmund - 1 . 0 . 0 . tgz " <nl> + } , <nl> + " _npmVersion " : " 1 . 1 . 48 " , <nl> + " _npmUser " : { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " isaacs " , <nl> + " email " : " i @ izs . me " <nl> + } <nl> + ] , <nl> + " _shasum " : " 66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296 " , <nl> + " _from " : " sigmund @ > = 1 . 0 . 0 < 1 . 1 . 0 " , <nl> + " _resolved " : " https : / / registry . npmjs . org / sigmund / - / sigmund - 1 . 0 . 0 . tgz " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / isaacs / sigmund / issues " <nl> } , <nl> - " homepage " : " https : / / github . com / isaacs / sigmund " , <nl> - " _id " : " sigmund @ 1 . 0 . 0 " , <nl> - " _from " : " sigmund @ ~ 1 . 0 . 0 " <nl> + " homepage " : " https : / / github . com / isaacs / sigmund " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / minimatch / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / minimatch / package . json <nl> <nl> " homepage " : " https : / / github . com / isaacs / minimatch " , <nl> " _id " : " minimatch @ 0 . 4 . 0 " , <nl> " _shasum " : " bd2c7d060d2c8c8fd7cde7f1f2ed2d5b270fdb1b " , <nl> - " _from " : " minimatch @ 0 . x . x " , <nl> + " _from " : " minimatch @ > = 0 . 0 . 0 < 1 . 0 . 0 " , <nl> " _npmVersion " : " 1 . 5 . 0 - alpha - 1 " , <nl> " _npmUser " : { <nl> " name " : " isaacs " , <nl> mmm a / js / node / node_modules / jshint / node_modules / shelljs / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / shelljs / package . json <nl> <nl> " engines " : { <nl> " node " : " > = 0 . 8 . 0 " <nl> } , <nl> - " readme " : " # ShellJS - Unix shell commands for Node . js [ ! [ Build Status ] ( https : / / secure . travis - ci . org / arturadib / shelljs . png ) ] ( http : / / travis - ci . org / arturadib / shelljs ) \ n \ nShellJS is a portable * * ( Windows / Linux / OS X ) * * implementation of Unix shell commands on top of the Node . js API . You can use it to eliminate your shell script ' s dependency on Unix while still keeping its familiar and powerful commands . You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts ! \ n \ nThe project is [ unit - tested ] ( http : / / travis - ci . org / arturadib / shelljs ) and battled - tested in projects like : \ n \ n + [ PDF . js ] ( http : / / github . com / mozilla / pdf . js ) - Firefox ' s next - gen PDF reader \ n + [ Firebug ] ( http : / / getfirebug . com / ) - Firefox ' s infamous debugger \ n + [ JSHint ] ( http : / / jshint . com ) - Most popular JavaScript linter \ n + [ Zepto ] ( http : / / zeptojs . com ) - jQuery - compatible JavaScript library for modern browsers \ n + [ Yeoman ] ( http : / / yeoman . io / ) - Web application stack and development tool \ n + [ Deployd . com ] ( http : / / deployd . com ) - Open source PaaS for quick API backend generation \ n \ nand [ many more ] ( https : / / npmjs . org / browse / depended / shelljs ) . \ n \ n # # Installing \ n \ nVia npm : \ n \ n ` ` ` bash \ n $ npm install [ - g ] shelljs \ n ` ` ` \ n \ nIf the global option ` - g ` is specified , the binary ` shjs ` will be installed . This makes it possible to \ nrun ShellJS scripts much like any shell script from the command line , i . e . without requiring a ` node_modules ` folder : \ n \ n ` ` ` bash \ n $ shjs my_script \ n ` ` ` \ n \ nYou can also just copy ` shell . js ` into your project ' s directory , and ` require ( ) ` accordingly . \ n \ n \ n # # Examples \ n \ n # # # JavaScript \ n \ n ` ` ` javascript \ nrequire ( ' shelljs / global ' ) ; \ n \ nif ( ! which ( ' git ' ) ) { \ n echo ( ' Sorry , this script requires git ' ) ; \ n exit ( 1 ) ; \ n } \ n \ n / / Copy files to release dir \ nmkdir ( ' - p ' , ' out / Release ' ) ; \ ncp ( ' - R ' , ' stuff / * ' , ' out / Release ' ) ; \ n \ n / / Replace macros in each . js file \ ncd ( ' lib ' ) ; \ nls ( ' * . js ' ) . forEach ( function ( file ) { \ n sed ( ' - i ' , ' BUILD_VERSION ' , ' v0 . 1 . 2 ' , file ) ; \ n sed ( ' - i ' , / . * REMOVE_THIS_LINE . * \ \ n / , ' ' , file ) ; \ n sed ( ' - i ' , / . * REPLACE_LINE_WITH_MACRO . * \ \ n / , cat ( ' macro . js ' ) , file ) ; \ n } ) ; \ ncd ( ' . . ' ) ; \ n \ n / / Run external tool synchronously \ nif ( exec ( ' git commit - am \ " Auto - commit \ " ' ) . code ! = = 0 ) { \ n echo ( ' Error : Git commit failed ' ) ; \ n exit ( 1 ) ; \ n } \ n ` ` ` \ n \ n # # # CoffeeScript \ n \ n ` ` ` coffeescript \ nrequire ' shelljs / global ' \ n \ nif not which ' git ' \ n echo ' Sorry , this script requires git ' \ n exit 1 \ n \ n # Copy files to release dir \ nmkdir ' - p ' , ' out / Release ' \ ncp ' - R ' , ' stuff / * ' , ' out / Release ' \ n \ n # Replace macros in each . js file \ ncd ' lib ' \ nfor file in ls ' * . js ' \ n sed ' - i ' , ' BUILD_VERSION ' , ' v0 . 1 . 2 ' , file \ n sed ' - i ' , / . * REMOVE_THIS_LINE . * \ \ n / , ' ' , file \ n sed ' - i ' , / . * REPLACE_LINE_WITH_MACRO . * \ \ n / , cat ' macro . js ' , file \ ncd ' . . ' \ n \ n # Run external tool synchronously \ nif ( exec ' git commit - am \ " Auto - commit \ " ' ) . code ! = 0 \ n echo ' Error : Git commit failed ' \ n exit 1 \ n ` ` ` \ n \ n # # Global vs . Local \ n \ nThe example above uses the convenience script ` shelljs / global ` to reduce verbosity . If polluting your global namespace is not desirable , simply require ` shelljs ` . \ n \ nExample : \ n \ n ` ` ` javascript \ nvar shell = require ( ' shelljs ' ) ; \ nshell . echo ( ' hello world ' ) ; \ n ` ` ` \ n \ n # # Make tool \ n \ nA convenience script ` shelljs / make ` is also provided to mimic the behavior of a Unix Makefile . In this case all shell objects are global , and command line arguments will cause the script to execute only the corresponding function in the global ` target ` object . To avoid redundant calls , target functions are executed only once per script . \ n \ nExample ( CoffeeScript ) : \ n \ n ` ` ` coffeescript \ nrequire ' shelljs / make ' \ n \ ntarget . all = - > \ n target . bundle ( ) \ n target . docs ( ) \ n \ ntarget . bundle = - > \ n cd __dirname \ n mkdir ' build ' \ n cd ' lib ' \ n ( cat ' * . js ' ) . to ' . . / build / output . js ' \ n \ ntarget . docs = - > \ n cd __dirname \ n mkdir ' docs ' \ n cd ' lib ' \ n for file in ls ' * . js ' \ n text = grep ' / / @ ' , file # extract special comments \ n text . replace ' / / @ ' , ' ' # remove comment tags \ n text . to ' docs / my_docs . md ' \ n ` ` ` \ n \ nTo run the target ` all ` , call the above script without arguments : ` $ node make ` . To run the target ` docs ` : ` $ node make docs ` , and so on . \ n \ n \ n \ n < ! - - \ n \ n DO NOT MODIFY BEYOND THIS POINT - IT ' S AUTOMATICALLY GENERATED \ n \ n - - > \ n \ n \ n # # Command reference \ n \ n \ nAll commands run synchronously , unless otherwise stated . \ n \ n \ n # # # cd ( ' dir ' ) \ nChanges to directory ` dir ` for the duration of the script \ n \ n \ n # # # pwd ( ) \ nReturns the current directory . \ n \ n \ n # # # ls ( [ options , ] path [ , path . . . ] ) \ n # # # ls ( [ options , ] path_array ) \ nAvailable options : \ n \ n + ` - R ` : recursive \ n + ` - A ` : all files ( include files beginning with ` . ` , except for ` . ` and ` . . ` ) \ n \ nExamples : \ n \ n ` ` ` javascript \ nls ( ' projs / * . js ' ) ; \ nls ( ' - R ' , ' / users / me ' , ' / tmp ' ) ; \ nls ( ' - R ' , [ ' / users / me ' , ' / tmp ' ] ) ; / / same as above \ n ` ` ` \ n \ nReturns array of files in the given path , or in current directory if no path provided . \ n \ n \ n # # # find ( path [ , path . . . ] ) \ n # # # find ( path_array ) \ nExamples : \ n \ n ` ` ` javascript \ nfind ( ' src ' , ' lib ' ) ; \ nfind ( [ ' src ' , ' lib ' ] ) ; / / same as above \ nfind ( ' . ' ) . filter ( function ( file ) { return file . match ( / \ \ . js $ / ) ; } ) ; \ n ` ` ` \ n \ nReturns array of all files ( however deep ) in the given paths . \ n \ nThe main difference from ` ls ( ' - R ' , path ) ` is that the resulting file names \ ninclude the base directories , e . g . ` lib / resources / file1 ` instead of just ` file1 ` . \ n \ n \ n # # # cp ( [ options , ] source [ , source . . . ] , dest ) \ n # # # cp ( [ options , ] source_array , dest ) \ nAvailable options : \ n \ n + ` - f ` : force \ n + ` - r , - R ` : recursive \ n \ nExamples : \ n \ n ` ` ` javascript \ ncp ( ' file1 ' , ' dir1 ' ) ; \ ncp ( ' - Rf ' , ' / tmp / * ' , ' / usr / local / * ' , ' / home / tmp ' ) ; \ ncp ( ' - Rf ' , [ ' / tmp / * ' , ' / usr / local / * ' ] , ' / home / tmp ' ) ; / / same as above \ n ` ` ` \ n \ nCopies files . The wildcard ` * ` is accepted . \ n \ n \ n # # # rm ( [ options , ] file [ , file . . . ] ) \ n # # # rm ( [ options , ] file_array ) \ nAvailable options : \ n \ n + ` - f ` : force \ n + ` - r , - R ` : recursive \ n \ nExamples : \ n \ n ` ` ` javascript \ nrm ( ' - rf ' , ' / tmp / * ' ) ; \ nrm ( ' some_file . txt ' , ' another_file . txt ' ) ; \ nrm ( [ ' some_file . txt ' , ' another_file . txt ' ] ) ; / / same as above \ n ` ` ` \ n \ nRemoves files . The wildcard ` * ` is accepted . \ n \ n \ n # # # mv ( source [ , source . . . ] , dest ' ) \ n # # # mv ( source_array , dest ' ) \ nAvailable options : \ n \ n + ` f ` : force \ n \ nExamples : \ n \ n ` ` ` javascript \ nmv ( ' - f ' , ' file ' , ' dir / ' ) ; \ nmv ( ' file1 ' , ' file2 ' , ' dir / ' ) ; \ nmv ( [ ' file1 ' , ' file2 ' ] , ' dir / ' ) ; / / same as above \ n ` ` ` \ n \ nMoves files . The wildcard ` * ` is accepted . \ n \ n \ n # # # mkdir ( [ options , ] dir [ , dir . . . ] ) \ n # # # mkdir ( [ options , ] dir_array ) \ nAvailable options : \ n \ n + ` p ` : full path ( will create intermediate dirs if necessary ) \ n \ nExamples : \ n \ n ` ` ` javascript \ nmkdir ( ' - p ' , ' / tmp / a / b / c / d ' , ' / tmp / e / f / g ' ) ; \ nmkdir ( ' - p ' , [ ' / tmp / a / b / c / d ' , ' / tmp / e / f / g ' ] ) ; / / same as above \ n ` ` ` \ n \ nCreates directories . \ n \ n \ n # # # test ( expression ) \ nAvailable expression primaries : \ n \ n + ` ' - b ' , ' path ' ` : true if path is a block device \ n + ` ' - c ' , ' path ' ` : true if path is a character device \ n + ` ' - d ' , ' path ' ` : true if path is a directory \ n + ` ' - e ' , ' path ' ` : true if path exists \ n + ` ' - f ' , ' path ' ` : true if path is a regular file \ n + ` ' - L ' , ' path ' ` : true if path is a symboilc link \ n + ` ' - p ' , ' path ' ` : true if path is a pipe ( FIFO ) \ n + ` ' - S ' , ' path ' ` : true if path is a socket \ n \ nExamples : \ n \ n ` ` ` javascript \ nif ( test ( ' - d ' , path ) ) { / * do something with dir * / } ; \ nif ( ! test ( ' - f ' , path ) ) continue ; / / skip if it ' s a regular file \ n ` ` ` \ n \ nEvaluates expression using the available primaries and returns corresponding value . \ n \ n \ n # # # cat ( file [ , file . . . ] ) \ n # # # cat ( file_array ) \ n \ nExamples : \ n \ n ` ` ` javascript \ nvar str = cat ( ' file * . txt ' ) ; \ nvar str = cat ( ' file1 ' , ' file2 ' ) ; \ nvar str = cat ( [ ' file1 ' , ' file2 ' ] ) ; / / same as above \ n ` ` ` \ n \ nReturns a string containing the given file , or a concatenated string \ ncontaining the files if more than one file is given ( a new line character is \ nintroduced between each file ) . Wildcard ` * ` accepted . \ n \ n \ n # # # ' string ' . to ( file ) \ n \ nExamples : \ n \ n ` ` ` javascript \ ncat ( ' input . txt ' ) . to ( ' output . txt ' ) ; \ n ` ` ` \ n \ nAnalogous to the redirection operator ` > ` in Unix , but works with JavaScript strings ( such as \ nthose returned by ` cat ` , ` grep ` , etc ) . _Like Unix redirections , ` to ( ) ` will overwrite any existing file ! _ \ n \ n \ n # # # ' string ' . toEnd ( file ) \ n \ nExamples : \ n \ n ` ` ` javascript \ ncat ( ' input . txt ' ) . toEnd ( ' output . txt ' ) ; \ n ` ` ` \ n \ nAnalogous to the redirect - and - append operator ` > > ` in Unix , but works with JavaScript strings ( such as \ nthose returned by ` cat ` , ` grep ` , etc ) . \ n \ n \ n # # # sed ( [ options , ] search_regex , replacement , file ) \ nAvailable options : \ n \ n + ` - i ` : Replace contents of ' file ' in - place . _Note that no backups will be created ! _ \ n \ nExamples : \ n \ n ` ` ` javascript \ nsed ( ' - i ' , ' PROGRAM_VERSION ' , ' v0 . 1 . 3 ' , ' source . js ' ) ; \ nsed ( / . * DELETE_THIS_LINE . * \ \ n / , ' ' , ' source . js ' ) ; \ n ` ` ` \ n \ nReads an input string from ` file ` and performs a JavaScript ` replace ( ) ` on the input \ nusing the given search regex and replacement string or function . Returns the new string after replacement . \ n \ n \ n # # # grep ( [ options , ] regex_filter , file [ , file . . . ] ) \ n # # # grep ( [ options , ] regex_filter , file_array ) \ nAvailable options : \ n \ n + ` - v ` : Inverse the sense of the regex and print the lines not matching the criteria . \ n \ nExamples : \ n \ n ` ` ` javascript \ ngrep ( ' - v ' , ' GLOBAL_VARIABLE ' , ' * . js ' ) ; \ ngrep ( ' GLOBAL_VARIABLE ' , ' * . js ' ) ; \ n ` ` ` \ n \ nReads input string from given files and returns a string containing all lines of the \ nfile that match the given ` regex_filter ` . Wildcard ` * ` accepted . \ n \ n \ n # # # which ( command ) \ n \ nExamples : \ n \ n ` ` ` javascript \ nvar nodeExec = which ( ' node ' ) ; \ n ` ` ` \ n \ nSearches for ` command ` in the system ' s PATH . On Windows looks for ` . exe ` , ` . cmd ` , and ` . bat ` extensions . \ nReturns string containing the absolute path to the command . \ n \ n \ n # # # echo ( string [ , string . . . ] ) \ n \ nExamples : \ n \ n ` ` ` javascript \ necho ( ' hello world ' ) ; \ nvar str = echo ( ' hello world ' ) ; \ n ` ` ` \ n \ nPrints string to stdout , and returns string with additional utility methods \ nlike ` . to ( ) ` . \ n \ n \ n # # # pushd ( [ options , ] [ dir | ' - N ' | ' + N ' ] ) \ n \ nAvailable options : \ n \ n + ` - n ` : Suppresses the normal change of directory when adding directories to the stack , so that only the stack is manipulated . \ n \ nArguments : \ n \ n + ` dir ` : Makes the current working directory be the top of the stack , and then executes the equivalent of ` cd dir ` . \ n + ` + N ` : Brings the Nth directory ( counting from the left of the list printed by dirs , starting with zero ) to the top of the list by rotating the stack . \ n + ` - N ` : Brings the Nth directory ( counting from the right of the list printed by dirs , starting with zero ) to the top of the list by rotating the stack . \ n \ nExamples : \ n \ n ` ` ` javascript \ n / / process . cwd ( ) = = = ' / usr ' \ npushd ( ' / etc ' ) ; / / Returns / etc / usr \ npushd ( ' + 1 ' ) ; / / Returns / usr / etc \ n ` ` ` \ n \ nSave the current directory on the top of the directory stack and then cd to ` dir ` . With no arguments , pushd exchanges the top two directories . Returns an array of paths in the stack . \ n \ n # # # popd ( [ options , ] [ ' - N ' | ' + N ' ] ) \ n \ nAvailable options : \ n \ n + ` - n ` : Suppresses the normal change of directory when removing directories from the stack , so that only the stack is manipulated . \ n \ nArguments : \ n \ n + ` + N ` : Removes the Nth directory ( counting from the left of the list printed by dirs ) , starting with zero . \ n + ` - N ` : Removes the Nth directory ( counting from the right of the list printed by dirs ) , starting with zero . \ n \ nExamples : \ n \ n ` ` ` javascript \ necho ( process . cwd ( ) ) ; / / ' / usr ' \ npushd ( ' / etc ' ) ; / / ' / etc / usr ' \ necho ( process . cwd ( ) ) ; / / ' / etc ' \ npopd ( ) ; / / ' / usr ' \ necho ( process . cwd ( ) ) ; / / ' / usr ' \ n ` ` ` \ n \ nWhen no arguments are given , popd removes the top directory from the stack and performs a cd to the new top directory . The elements are numbered from 0 starting at the first directory listed with dirs ; i . e . , popd is equivalent to popd + 0 . Returns an array of paths in the stack . \ n \ n # # # dirs ( [ options | ' + N ' | ' - N ' ] ) \ n \ nAvailable options : \ n \ n + ` - c ` : Clears the directory stack by deleting all of the elements . \ n \ nArguments : \ n \ n + ` + N ` : Displays the Nth directory ( counting from the left of the list printed by dirs when invoked without options ) , starting with zero . \ n + ` - N ` : Displays the Nth directory ( counting from the right of the list printed by dirs when invoked without options ) , starting with zero . \ n \ nDisplay the list of currently remembered directories . Returns an array of paths in the stack , or a single path if + N or - N was specified . \ n \ nSee also : pushd , popd \ n \ n \ n # # # ln ( options , source , dest ) \ n # # # ln ( source , dest ) \ nAvailable options : \ n \ n + ` s ` : symlink \ n + ` f ` : force \ n \ nExamples : \ n \ n ` ` ` javascript \ nln ( ' file ' , ' newlink ' ) ; \ nln ( ' - sf ' , ' file ' , ' existing ' ) ; \ n ` ` ` \ n \ nLinks source to dest . Use - f to force the link , should dest already exist . \ n \ n \ n # # # exit ( code ) \ nExits the current process with the given exit code . \ n \ n # # # env [ ' VAR_NAME ' ] \ nObject containing environment variables ( both getter and setter ) . Shortcut to process . env . \ n \ n # # # exec ( command [ , options ] [ , callback ] ) \ nAvailable options ( all ` false ` by default ) : \ n \ n + ` async ` : Asynchronous execution . Defaults to true if a callback is provided . \ n + ` silent ` : Do not echo program output to console . \ n \ nExamples : \ n \ n ` ` ` javascript \ nvar version = exec ( ' node - - version ' , { silent : true } ) . output ; \ n \ nvar child = exec ( ' some_long_running_process ' , { async : true } ) ; \ nchild . stdout . on ( ' data ' , function ( data ) { \ n / * . . . do something with data . . . * / \ n } ) ; \ n \ nexec ( ' some_long_running_process ' , function ( code , output ) { \ n console . log ( ' Exit code : ' , code ) ; \ n console . log ( ' Program output : ' , output ) ; \ n } ) ; \ n ` ` ` \ n \ nExecutes the given ` command ` _synchronously_ , unless otherwise specified . \ nWhen in synchronous mode returns the object ` { code : . . . , output : . . . } ` , containing the program ' s \ n ` output ` ( stdout + stderr ) and its exit ` code ` . Otherwise returns the child process object , and \ nthe ` callback ` gets the arguments ` ( code , output ) ` . \ n \ n * * Note : * * For long - lived processes , it ' s best to run ` exec ( ) ` asynchronously as \ nthe current synchronous implementation uses a lot of CPU . This should be getting \ nfixed soon . \ n \ n \ n # # # chmod ( octal_mode | | octal_string , file ) \ n # # # chmod ( symbolic_mode , file ) \ n \ nAvailable options : \ n \ n + ` - v ` : output a diagnostic for every file processed \ n + ` - c ` : like verbose but report only when a change is made \ n + ` - R ` : change files and directories recursively \ n \ nExamples : \ n \ n ` ` ` javascript \ nchmod ( 755 , ' / Users / brandon ' ) ; \ nchmod ( ' 755 ' , ' / Users / brandon ' ) ; / / same as above \ nchmod ( ' u + x ' , ' / Users / brandon ' ) ; \ n ` ` ` \ n \ nAlters the permissions of a file or directory by either specifying the \ nabsolute permissions in octal form or expressing the changes in symbols . \ nThis command tries to mimic the POSIX behavior as much as possible . \ nNotable exceptions : \ n \ n + In symbolic modes , ' a - r ' and ' - r ' are identical . No consideration is \ n given to the umask . \ n + There is no \ " quiet \ " option since default behavior is to run silent . \ n \ n \ n # # Non - Unix commands \ n \ n \ n # # # tempdir ( ) \ n \ nExamples : \ n \ n ` ` ` javascript \ nvar tmp = tempdir ( ) ; / / \ " / tmp \ " for most * nix platforms \ n ` ` ` \ n \ nSearches and returns string containing a writeable , platform - dependent temporary directory . \ nFollows Python ' s [ tempfile algorithm ] ( http : / / docs . python . org / library / tempfile . html # tempfile . tempdir ) . \ n \ n \ n # # # error ( ) \ nTests if error occurred in the last command . Returns ` null ` if no error occurred , \ notherwise returns string explaining the error \ n \ n \ n # # Configuration \ n \ n \ n # # # config . silent \ nExample : \ n \ n ` ` ` javascript \ nvar silentState = config . silent ; / / save old silent state \ nconfig . silent = true ; \ n / * . . . * / \ nconfig . silent = silentState ; / / restore old silent state \ n ` ` ` \ n \ nSuppresses all command output if ` true ` , except for ` echo ( ) ` calls . \ nDefault is ` false ` . \ n \ n # # # config . fatal \ nExample : \ n \ n ` ` ` javascript \ nconfig . fatal = true ; \ ncp ( ' this_file_does_not_exist ' , ' / dev / null ' ) ; / / dies here \ n / * more commands . . . * / \ n ` ` ` \ n \ nIf ` true ` the script will die on errors . Default is ` false ` . \ n " , <nl> - " readmeFilename " : " README . md " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / arturadib / shelljs / issues " <nl> } , <nl> " _id " : " shelljs @ 0 . 3 . 0 " , <nl> - " _from " : " shelljs @ 0 . 3 . x " <nl> + " dist " : { <nl> + " shasum " : " 3596e6307a781544f591f37da618360f31db57b1 " , <nl> + " tarball " : " http : / / registry . npmjs . org / shelljs / - / shelljs - 0 . 3 . 0 . tgz " <nl> + } , <nl> + " _from " : " shelljs @ > = 0 . 3 . 0 < 0 . 4 . 0 " , <nl> + " _npmVersion " : " 1 . 3 . 11 " , <nl> + " _npmUser " : { <nl> + " name " : " artur " , <nl> + " email " : " arturadib @ gmail . com " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " artur " , <nl> + " email " : " arturadib @ gmail . com " <nl> + } <nl> + ] , <nl> + " directories " : { } , <nl> + " _shasum " : " 3596e6307a781544f591f37da618360f31db57b1 " , <nl> + " _resolved " : " https : / / registry . npmjs . org / shelljs / - / shelljs - 0 . 3 . 0 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / node_modules / strip - json - comments / package . json <nl> ppp b / js / node / node_modules / jshint / node_modules / strip - json - comments / package . json <nl> <nl> " engines " : { <nl> " node " : " > = 0 . 8 . 0 " <nl> } , <nl> - " readme " : " # strip - json - comments [ ! [ Build Status ] ( https : / / travis - ci . org / sindresorhus / strip - json - comments . svg ? branch = master ) ] ( https : / / travis - ci . org / sindresorhus / strip - json - comments ) \ n \ n > Strip comments from JSON . Lets you use comments in your JSON files ! \ n \ nThis is now possible : \ n \ n ` ` ` js \ n { \ n \ t / / rainbows \ n \ t \ " unicorn \ " : / * ❤ * / \ " cake \ " \ n } \ n ` ` ` \ n \ nIt will remove single - line comments ` / / ` and mult - line comments ` / * * / ` . \ n \ nAlso available as a [ gulp ] ( https : / / github . com / sindresorhus / gulp - strip - json - comments ) / [ grunt ] ( https : / / github . com / sindresorhus / grunt - strip - json - comments ) / [ broccoli ] ( https : / / github . com / sindresorhus / broccoli - strip - json - comments ) plugin and a [ require hook ] ( https : / / github . com / uTest / autostrip - json - comments ) . \ n \ n \ n * There ' s already [ json - comments ] ( https : / / npmjs . org / package / json - comments ) , but it ' s only for Node . js and uses a naive regex to strip comments which fails on simple cases like ` { \ " a \ " : \ " / / \ " } ` . This module however parses out the comments . * \ n \ n \ n # # Install \ n \ n ` ` ` sh \ n $ npm install - - save strip - json - comments \ n ` ` ` \ n \ n ` ` ` sh \ n $ bower install - - save strip - json - comments \ n ` ` ` \ n \ n ` ` ` sh \ n $ component install sindresorhus / strip - json - comments \ n ` ` ` \ n \ n \ n # # Usage \ n \ n ` ` ` js \ nvar json = ' { / * rainbows * / \ " unicorn \ " : \ " cake \ " } ' ; \ nJSON . parse ( stripJsonComments ( json ) ) ; \ n / / = > { unicorn : ' cake ' } \ n ` ` ` \ n \ n \ n # # API \ n \ n # # # stripJsonComments ( input ) \ n \ n # # # # input \ n \ nType : ` string ` \ n \ nAccepts a string with JSON and returns a string without comments . \ n \ n \ n # # CLI \ n \ n ` ` ` sh \ n $ npm install - - global strip - json - comments \ n ` ` ` \ n \ n ` ` ` sh \ n $ strip - json - comments - - help \ n \ nstrip - json - comments < input - file > > < output - file > \ n # or \ ncat < input - file > | strip - json - comments > < output - file > \ n ` ` ` \ n \ n \ n # # License \ n \ nMIT © [ Sindre Sorhus ] ( http : / / sindresorhus . com ) \ n " , <nl> - " readmeFilename " : " readme . md " , <nl> + " gitHead " : " cbd5aede7ccbe5d5a9065b1d47070fd99ad579af " , <nl> " bugs " : { <nl> " url " : " https : / / github . com / sindresorhus / strip - json - comments / issues " <nl> } , <nl> " homepage " : " https : / / github . com / sindresorhus / strip - json - comments " , <nl> " _id " : " strip - json - comments @ 0 . 1 . 3 " , <nl> - " _from " : " strip - json - comments @ 0 . 1 . x " <nl> + " _shasum " : " 164c64e370a8a3cc00c9e01b539e569823f0ee54 " , <nl> + " _from " : " strip - json - comments @ > = 0 . 1 . 0 < 0 . 2 . 0 " , <nl> + " _npmVersion " : " 1 . 4 . 13 " , <nl> + " _npmUser " : { <nl> + " name " : " sindresorhus " , <nl> + " email " : " sindresorhus @ gmail . com " <nl> + } , <nl> + " maintainers " : [ <nl> + { <nl> + " name " : " sindresorhus " , <nl> + " email " : " sindresorhus @ gmail . com " <nl> + } <nl> + ] , <nl> + " dist " : { <nl> + " shasum " : " 164c64e370a8a3cc00c9e01b539e569823f0ee54 " , <nl> + " tarball " : " http : / / registry . npmjs . org / strip - json - comments / - / strip - json - comments - 0 . 1 . 3 . tgz " <nl> + } , <nl> + " directories " : { } , <nl> + " _resolved " : " https : / / registry . npmjs . org / strip - json - comments / - / strip - json - comments - 0 . 1 . 3 . tgz " , <nl> + " readme " : " ERROR : No README data found ! " <nl> } <nl> mmm a / js / node / node_modules / jshint / package . json <nl> ppp b / js / node / node_modules / jshint / package . json <nl> <nl> " gitHead " : " 94df11c872bccd979c8deffed612e4421abdf17d " , <nl> " _id " : " jshint @ 2 . 5 . 5 " , <nl> " _shasum " : " 9f24958dcd11c5e2ceba96ec92225873b02f4775 " , <nl> - " _from " : " jshint @ " , <nl> + " _from " : " jshint @ 2 . 5 . 5 " , <nl> " _npmVersion " : " 1 . 5 . 0 - alpha - 1 " , <nl> " _npmUser " : { <nl> " name " : " rwaldron " , <nl>
Updated JSHint
arangodb/arangodb
a820ce477717106fb991726636c489f0b09637a5
2015-03-09T11:07:23Z
mmm a / src / arm / lithium - codegen - arm . cc <nl> ppp b / src / arm / lithium - codegen - arm . cc <nl> void LCodeGen : : DoCmpHoleAndBranch ( LCmpHoleAndBranch * instr ) { <nl> void LCodeGen : : DoCompareMinusZeroAndBranch ( LCompareMinusZeroAndBranch * instr ) { <nl> Representation rep = instr - > hydrogen ( ) - > value ( ) - > representation ( ) ; <nl> ASSERT ( ! rep . IsInteger32 ( ) ) ; <nl> - Label if_false ; <nl> Register scratch = ToRegister ( instr - > temp ( ) ) ; <nl> <nl> if ( rep . IsDouble ( ) ) { <nl> DwVfpRegister value = ToDoubleRegister ( instr - > value ( ) ) ; <nl> __ VFPCompareAndSetFlags ( value , 0 . 0 ) ; <nl> - __ b ( ne , & if_false ) ; <nl> + EmitFalseBranch ( instr , ne ) ; <nl> __ VmovHigh ( scratch , value ) ; <nl> __ cmp ( scratch , Operand ( 0x80000000 ) ) ; <nl> } else { <nl> Register value = ToRegister ( instr - > value ( ) ) ; <nl> - __ CheckMap ( <nl> - value , scratch , Heap : : kHeapNumberMapRootIndex , & if_false , DO_SMI_CHECK ) ; <nl> + __ CheckMap ( value , <nl> + scratch , <nl> + Heap : : kHeapNumberMapRootIndex , <nl> + instr - > FalseLabel ( chunk ( ) ) , <nl> + DO_SMI_CHECK ) ; <nl> __ ldr ( scratch , FieldMemOperand ( value , HeapNumber : : kExponentOffset ) ) ; <nl> __ ldr ( ip , FieldMemOperand ( value , HeapNumber : : kMantissaOffset ) ) ; <nl> __ cmp ( scratch , Operand ( 0x80000000 ) ) ; <nl> __ cmp ( ip , Operand ( 0x00000000 ) , eq ) ; <nl> } <nl> EmitBranch ( instr , eq ) ; <nl> - <nl> - __ bind ( & if_false ) ; <nl> - EmitFalseBranch ( instr , al ) ; <nl> } <nl> <nl> <nl> mmm a / src / arm / lithium - codegen - arm . h <nl> ppp b / src / arm / lithium - codegen - arm . h <nl> class LCodeGen : public LCodeGenBase { <nl> <nl> static Condition TokenToCondition ( Token : : Value op , bool is_unsigned ) ; <nl> void EmitGoto ( int block ) ; <nl> + <nl> + / / EmitBranch expects to be the last instruction of a block . <nl> template < class InstrType > <nl> void EmitBranch ( InstrType instr , Condition condition ) ; <nl> template < class InstrType > <nl> mmm a / src / ia32 / lithium - codegen - ia32 . cc <nl> ppp b / src / ia32 / lithium - codegen - ia32 . cc <nl> void LCodeGen : : DoCmpHoleAndBranch ( LCmpHoleAndBranch * instr ) { <nl> void LCodeGen : : DoCompareMinusZeroAndBranch ( LCompareMinusZeroAndBranch * instr ) { <nl> Representation rep = instr - > hydrogen ( ) - > value ( ) - > representation ( ) ; <nl> ASSERT ( ! rep . IsInteger32 ( ) ) ; <nl> - Label if_false ; <nl> Register scratch = ToRegister ( instr - > temp ( ) ) ; <nl> <nl> if ( rep . IsDouble ( ) ) { <nl> void LCodeGen : : DoCompareMinusZeroAndBranch ( LCompareMinusZeroAndBranch * instr ) { <nl> XMMRegister xmm_scratch = double_scratch0 ( ) ; <nl> __ xorps ( xmm_scratch , xmm_scratch ) ; <nl> __ ucomisd ( xmm_scratch , value ) ; <nl> - __ j ( not_equal , & if_false ) ; <nl> + EmitFalseBranch ( instr , not_equal ) ; <nl> __ movmskpd ( scratch , value ) ; <nl> __ test ( scratch , Immediate ( 1 ) ) ; <nl> EmitBranch ( instr , not_zero ) ; <nl> } else { <nl> Register value = ToRegister ( instr - > value ( ) ) ; <nl> Handle < Map > map = masm ( ) - > isolate ( ) - > factory ( ) - > heap_number_map ( ) ; <nl> - __ CheckMap ( value , map , & if_false , DO_SMI_CHECK ) ; <nl> + __ CheckMap ( value , map , instr - > FalseLabel ( chunk ( ) ) , DO_SMI_CHECK ) ; <nl> __ cmp ( FieldOperand ( value , HeapNumber : : kExponentOffset ) , <nl> Immediate ( 0x80000000 ) ) ; <nl> - __ j ( not_equal , & if_false ) ; <nl> + EmitFalseBranch ( instr , not_equal ) ; <nl> __ cmp ( FieldOperand ( value , HeapNumber : : kMantissaOffset ) , <nl> Immediate ( 0x00000000 ) ) ; <nl> EmitBranch ( instr , equal ) ; <nl> } <nl> - <nl> - __ bind ( & if_false ) ; <nl> - EmitFalseBranch ( instr , no_condition ) ; <nl> } <nl> <nl> <nl> mmm a / src / ia32 / lithium - codegen - ia32 . h <nl> ppp b / src / ia32 / lithium - codegen - ia32 . h <nl> class LCodeGen : public LCodeGenBase { <nl> <nl> static Condition TokenToCondition ( Token : : Value op , bool is_unsigned ) ; <nl> void EmitGoto ( int block ) ; <nl> + <nl> + / / EmitBranch expects to be the last instruction of a block . <nl> template < class InstrType > <nl> void EmitBranch ( InstrType instr , Condition cc ) ; <nl> template < class InstrType > <nl> mmm a / src / x64 / lithium - codegen - x64 . cc <nl> ppp b / src / x64 / lithium - codegen - x64 . cc <nl> void LCodeGen : : DoCmpHoleAndBranch ( LCmpHoleAndBranch * instr ) { <nl> void LCodeGen : : DoCompareMinusZeroAndBranch ( LCompareMinusZeroAndBranch * instr ) { <nl> Representation rep = instr - > hydrogen ( ) - > value ( ) - > representation ( ) ; <nl> ASSERT ( ! rep . IsInteger32 ( ) ) ; <nl> - Label if_false ; <nl> <nl> if ( rep . IsDouble ( ) ) { <nl> XMMRegister value = ToDoubleRegister ( instr - > value ( ) ) ; <nl> XMMRegister xmm_scratch = double_scratch0 ( ) ; <nl> __ xorps ( xmm_scratch , xmm_scratch ) ; <nl> __ ucomisd ( xmm_scratch , value ) ; <nl> - __ j ( not_equal , & if_false ) ; <nl> + EmitFalseBranch ( instr , not_equal ) ; <nl> __ movmskpd ( kScratchRegister , value ) ; <nl> __ testl ( kScratchRegister , Immediate ( 1 ) ) ; <nl> EmitBranch ( instr , not_zero ) ; <nl> } else { <nl> Register value = ToRegister ( instr - > value ( ) ) ; <nl> Handle < Map > map = masm ( ) - > isolate ( ) - > factory ( ) - > heap_number_map ( ) ; <nl> - __ CheckMap ( value , map , & if_false , DO_SMI_CHECK ) ; <nl> + __ CheckMap ( value , map , instr - > FalseLabel ( chunk ( ) ) , DO_SMI_CHECK ) ; <nl> __ cmpl ( FieldOperand ( value , HeapNumber : : kExponentOffset ) , <nl> Immediate ( 0x80000000 ) ) ; <nl> - __ j ( not_equal , & if_false ) ; <nl> + EmitFalseBranch ( instr , not_equal ) ; <nl> __ cmpl ( FieldOperand ( value , HeapNumber : : kMantissaOffset ) , <nl> Immediate ( 0x00000000 ) ) ; <nl> EmitBranch ( instr , equal ) ; <nl> } <nl> - <nl> - __ bind ( & if_false ) ; <nl> - EmitFalseBranch ( instr , always ) ; <nl> } <nl> <nl> <nl> mmm a / src / x64 / lithium - codegen - x64 . h <nl> ppp b / src / x64 / lithium - codegen - x64 . h <nl> class LCodeGen : public LCodeGenBase { <nl> <nl> static Condition TokenToCondition ( Token : : Value op , bool is_unsigned ) ; <nl> void EmitGoto ( int block ) ; <nl> + <nl> + / / EmitBranch expects to be the last instruction of a block . <nl> template < class InstrType > <nl> void EmitBranch ( InstrType instr , Condition cc ) ; <nl> template < class InstrType > <nl>
Fix usage of EmitBranch in compare - minus - zero - and - branch .
v8/v8
108538f151c50f270e81f50537cb8ad5f0e0ee28
2013-11-12T17:18:05Z
mmm a / extensions / GUI / CCControlExtension / CCControlButton . cpp <nl> ppp b / extensions / GUI / CCControlExtension / CCControlButton . cpp <nl> CCControlButton * CCControlButton : : create ( CCScale9Sprite * sprite ) <nl> <nl> void CCControlButton : : setMargins ( int marginH , int marginV ) <nl> { <nl> - m_marginV = marginV ; <nl> - m_marginH = marginH ; <nl> + m_marginV = marginV ; <nl> + m_marginH = marginH ; <nl> needsLayout ( ) ; <nl> } <nl> <nl> void CCControlButton : : setSelected ( bool enabled ) <nl> <nl> void CCControlButton : : setHighlighted ( bool enabled ) <nl> { <nl> + if ( enabled = = true ) <nl> + { <nl> + m_eState = CCControlStateHighlighted ; <nl> + } <nl> + else <nl> + { <nl> + m_eState = CCControlStateNormal ; <nl> + } <nl> + <nl> CCControl : : setHighlighted ( enabled ) ; <nl> <nl> - CCAction * action = getActionByTag ( kZoomActionTag ) ; <nl> + CCAction * action = getActionByTag ( kZoomActionTag ) ; <nl> if ( action ) <nl> { <nl> stopAction ( action ) ; <nl> void CCControlButton : : setHighlighted ( bool enabled ) <nl> if ( m_zoomOnTouchDown ) <nl> { <nl> float scaleValue = ( isHighlighted ( ) & & isEnabled ( ) & & ! isSelected ( ) ) ? 1 . 1f : 1 . 0f ; <nl> - CCAction * zoomAction = CCScaleTo : : create ( 0 . 05f , scaleValue ) ; <nl> + CCAction * zoomAction = CCScaleTo : : create ( 0 . 05f , scaleValue ) ; <nl> zoomAction - > setTag ( kZoomActionTag ) ; <nl> runAction ( zoomAction ) ; <nl> } <nl> const ccColor3B CCControlButton : : getTitleColorForState ( CCControlState state ) <nl> CCColor3bObject * colorObject = ( CCColor3bObject * ) m_titleColorDispatchTable - > objectForKey ( state ) ; <nl> if ( colorObject ) <nl> { <nl> - returnColor = colorObject - > value ; <nl> + returnColor = colorObject - > value ; <nl> break ; <nl> } <nl> <nl> - colorObject = ( CCColor3bObject * ) m_titleColorDispatchTable - > objectForKey ( CCControlStateNormal ) ; <nl> + colorObject = ( CCColor3bObject * ) m_titleColorDispatchTable - > objectForKey ( CCControlStateNormal ) ; <nl> if ( colorObject ) <nl> { <nl> - returnColor = colorObject - > value ; <nl> + returnColor = colorObject - > value ; <nl> } <nl> } while ( 0 ) ; <nl> <nl> void CCControlButton : : setTitleColorForState ( ccColor3B color , CCControlState stat <nl> <nl> CCNode * CCControlButton : : getTitleLabelForState ( CCControlState state ) <nl> { <nl> - CCNode * titleLabel = ( CCNode * ) m_titleLabelDispatchTable - > objectForKey ( state ) ; <nl> + CCNode * titleLabel = ( CCNode * ) m_titleLabelDispatchTable - > objectForKey ( state ) ; <nl> if ( titleLabel ) <nl> { <nl> return titleLabel ; <nl> const char * CCControlButton : : getTitleBMFontForState ( CCControlState state ) <nl> <nl> CCScale9Sprite * CCControlButton : : getBackgroundSpriteForState ( CCControlState state ) <nl> { <nl> - CCScale9Sprite * backgroundSprite = ( CCScale9Sprite * ) m_backgroundSpriteDispatchTable - > objectForKey ( state ) ; <nl> + CCScale9Sprite * backgroundSprite = ( CCScale9Sprite * ) m_backgroundSpriteDispatchTable - > objectForKey ( state ) ; <nl> if ( backgroundSprite ) <nl> { <nl> return backgroundSprite ; <nl> void CCControlButton : : needsLayout ( ) <nl> m_currentTitle = getTitleForState ( m_eState ) ; <nl> CC_SAFE_RETAIN ( m_currentTitle ) ; <nl> <nl> - m_currentTitleColor = getTitleColorForState ( m_eState ) ; <nl> + m_currentTitleColor = getTitleColorForState ( m_eState ) ; <nl> <nl> this - > setTitleLabel ( getTitleLabelForState ( m_eState ) ) ; <nl> <nl> bool CCControlButton : : ccTouchBegan ( CCTouch * pTouch , CCEvent * pEvent ) <nl> return false ; <nl> } <nl> <nl> - m_eState = CCControlStateHighlighted ; <nl> - m_isPushed = true ; <nl> + m_isPushed = true ; <nl> this - > setHighlighted ( true ) ; <nl> sendActionsForControlEvents ( CCControlEventTouchDown ) ; <nl> return true ; <nl> void CCControlButton : : ccTouchMoved ( CCTouch * pTouch , CCEvent * pEvent ) <nl> bool isTouchMoveInside = isTouchInside ( pTouch ) ; <nl> if ( isTouchMoveInside & & ! isHighlighted ( ) ) <nl> { <nl> - m_eState = CCControlStateHighlighted ; <nl> setHighlighted ( true ) ; <nl> sendActionsForControlEvents ( CCControlEventTouchDragEnter ) ; <nl> } <nl> void CCControlButton : : ccTouchMoved ( CCTouch * pTouch , CCEvent * pEvent ) <nl> } <nl> else if ( ! isTouchMoveInside & & isHighlighted ( ) ) <nl> { <nl> - m_eState = CCControlStateNormal ; <nl> setHighlighted ( false ) ; <nl> <nl> sendActionsForControlEvents ( CCControlEventTouchDragExit ) ; <nl> void CCControlButton : : ccTouchMoved ( CCTouch * pTouch , CCEvent * pEvent ) <nl> } <nl> void CCControlButton : : ccTouchEnded ( CCTouch * pTouch , CCEvent * pEvent ) <nl> { <nl> - m_eState = CCControlStateNormal ; <nl> m_isPushed = false ; <nl> setHighlighted ( false ) ; <nl> <nl> GLubyte CCControlButton : : getOpacity ( ) <nl> <nl> void CCControlButton : : ccTouchCancelled ( CCTouch * pTouch , CCEvent * pEvent ) <nl> { <nl> - m_eState = CCControlStateNormal ; <nl> m_isPushed = false ; <nl> setHighlighted ( false ) ; <nl> sendActionsForControlEvents ( CCControlEventTouchCancel ) ; <nl>
Update CCControlButton . cpp
cocos2d/cocos2d-x
68c2219d3389772e3c4c8816d40291414c4c64fe
2013-03-05T08:26:37Z
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> env : <nl> global : <nl> - RUBY_VERSION = 2 . 1 <nl> matrix : <nl> - - CONFIG = dbg TEST = c <nl> - - CONFIG = dbg TEST = c + + <nl> - - CONFIG = opt TEST = c <nl> - - CONFIG = opt TEST = c + + <nl> - - CONFIG = opt TEST = node <nl> - - CONFIG = opt TEST = ruby <nl> - CONFIG = opt TEST = python <nl> script : <nl> - rvm use $ RUBY_VERSION <nl> mmm a / tools / run_tests / run_python . sh <nl> ppp b / tools / run_tests / run_python . sh <nl> cd $ ( dirname $ 0 ) / . . / . . <nl> root = ` pwd ` <nl> export LD_LIBRARY_PATH = $ root / libs / opt <nl> source python2 . 7_virtual_environment / bin / activate <nl> + ldd python2 . 7 <nl> + ldd python2 . 7_virtual_environment / local / lib / python2 . 7 / site - packages / grpc / _adapter / _c . so <nl> # TODO ( issue 215 ) : Properly itemize these in run_tests . py so that they can be parallelized . <nl> # TODO ( atash ) : Enable dynamic unused port discovery for this test . <nl> # TODO ( mlumish ) : Re - enable this test when we can install protoc <nl>
Added logging for python tests
grpc/grpc
985c5bf2e075697fc89e8cb13f10a9324ee148a9
2015-03-02T19:50:23Z
mmm a / test / inspector / inspector . status <nl> ppp b / test / inspector / inspector . status <nl> <nl> ' cpu - profiler / coverage - block ' : [ SKIP ] , <nl> ' runtime / internal - properties - entries ' : [ SKIP ] , <nl> ' runtime - call - stats / collection ' : [ SKIP ] , <nl> + <nl> + # Skip tests that might fail with concurrent allocation <nl> + ' debugger / pause - on - oom - wide ' : [ SKIP ] , <nl> } ] , # stress_concurrent_allocation <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl>
[ test ] Disable test with stress_concurrent_allocation
v8/v8
666418d54bdca795f3479edf25aef2a2c9628091
2020-12-16T13:49:14Z
mmm a / src / rss / automatedrssdownloader . cpp <nl> ppp b / src / rss / automatedrssdownloader . cpp <nl> AutomatedRssDownloader : : AutomatedRssDownloader ( const QWeakPointer < RssManager > & m <nl> Q_ASSERT ( ok ) ; <nl> ok = connect ( ui - > listRules , SIGNAL ( customContextMenuRequested ( const QPoint & ) ) , this , SLOT ( displayRulesListMenu ( const QPoint & ) ) ) ; <nl> Q_ASSERT ( ok ) ; <nl> - m_ruleList = RssDownloadRuleList : : instance ( ) ; <nl> + m_ruleList = manager . toStrongRef ( ) - > downloadRules ( ) ; <nl> initLabelCombobox ( ) ; <nl> loadFeedList ( ) ; <nl> loadSettings ( ) ; <nl> mmm a / src / rss / rssdownloadrulelist . cpp <nl> ppp b / src / rss / rssdownloadrulelist . cpp <nl> <nl> # include " rsssettings . h " <nl> # include " qinisettings . h " <nl> <nl> - RssDownloadRuleList * RssDownloadRuleList : : m_instance = 0 ; <nl> - <nl> - RssDownloadRuleList : : RssDownloadRuleList ( ) { <nl> - loadRulesFromStorage ( ) ; <nl> - } <nl> - <nl> - RssDownloadRuleList * RssDownloadRuleList : : instance ( ) <nl> + RssDownloadRuleList : : RssDownloadRuleList ( ) <nl> { <nl> - if ( ! m_instance ) <nl> - m_instance = new RssDownloadRuleList ; <nl> - return m_instance ; <nl> - } <nl> - <nl> - void RssDownloadRuleList : : drop ( ) <nl> - { <nl> - if ( m_instance ) { <nl> - delete m_instance ; <nl> - m_instance = 0 ; <nl> - } <nl> + loadRulesFromStorage ( ) ; <nl> } <nl> <nl> RssDownloadRulePtr RssDownloadRuleList : : findMatchingRule ( const QString & feed_url , const QString & article_title ) const <nl> mmm a / src / rss / rssdownloadrulelist . h <nl> ppp b / src / rss / rssdownloadrulelist . h <nl> class RssDownloadRuleList <nl> { <nl> Q_DISABLE_COPY ( RssDownloadRuleList ) <nl> <nl> - private : <nl> - explicit RssDownloadRuleList ( ) ; <nl> - static RssDownloadRuleList * m_instance ; <nl> - <nl> public : <nl> - static RssDownloadRuleList * instance ( ) ; <nl> - static void drop ( ) ; <nl> + RssDownloadRuleList ( ) ; <nl> RssDownloadRulePtr findMatchingRule ( const QString & feed_url , const QString & article_title ) const ; <nl> / / Operators <nl> void saveRule ( const RssDownloadRulePtr & rule ) ; <nl> mmm a / src / rss / rssfeed . cpp <nl> ppp b / src / rss / rssfeed . cpp <nl> bool RssFeed : : parseRSS ( QIODevice * device ) { <nl> <nl> void RssFeed : : downloadMatchingArticleTorrents ( ) { <nl> Q_ASSERT ( RssSettings ( ) . isRssDownloadingEnabled ( ) ) ; <nl> + RssDownloadRuleList * download_rules = m_manager - > downloadRules ( ) ; <nl> for ( RssArticleHash : : ConstIterator it = m_articles . begin ( ) ; it ! = m_articles . end ( ) ; it + + ) { <nl> RssArticlePtr item = it . value ( ) ; <nl> if ( item - > isRead ( ) ) continue ; <nl> void RssFeed : : downloadMatchingArticleTorrents ( ) { <nl> else <nl> torrent_url = item - > link ( ) ; <nl> / / Check if the item should be automatically downloaded <nl> - RssDownloadRulePtr matching_rule = RssDownloadRuleList : : instance ( ) - > findMatchingRule ( m_url , item - > title ( ) ) ; <nl> + RssDownloadRulePtr matching_rule = download_rules - > findMatchingRule ( m_url , item - > title ( ) ) ; <nl> if ( matching_rule ) { <nl> / / Item was downloaded , consider it as Read <nl> item - > markAsRead ( ) ; <nl> mmm a / src / rss / rssmanager . cpp <nl> ppp b / src / rss / rssmanager . cpp <nl> <nl> # include " rssdownloadrulelist . h " <nl> # include " downloadthread . h " <nl> <nl> - RssManager : : RssManager ( ) : m_rssDownloader ( new DownloadThread ( this ) ) { <nl> + RssManager : : RssManager ( ) : <nl> + m_rssDownloader ( new DownloadThread ( this ) ) , m_downloadRules ( new RssDownloadRuleList ) <nl> + { <nl> connect ( & m_refreshTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( refresh ( ) ) ) ; <nl> m_refreshInterval = RssSettings ( ) . getRSSRefreshInterval ( ) ; <nl> m_refreshTimer . start ( m_refreshInterval * 60000 ) ; <nl> } <nl> <nl> RssManager : : ~ RssManager ( ) { <nl> - qDebug ( " Deleting RSSManager " ) ; <nl> - m_refreshTimer . stop ( ) ; <nl> + qDebug ( " Deleting RSSManager . . . " ) ; <nl> delete m_rssDownloader ; <nl> - RssDownloadRuleList : : drop ( ) ; <nl> + delete m_downloadRules ; <nl> saveItemsToDisk ( ) ; <nl> saveStreamList ( ) ; <nl> qDebug ( " RSSManager deleted " ) ; <nl> void RssManager : : moveFile ( const RssFilePtr & file , const RssFolderPtr & dest_folde <nl> void RssManager : : saveStreamList ( ) const { <nl> QStringList streamsUrl ; <nl> QStringList aliases ; <nl> - QList < RssFeedPtr > streams = getAllFeeds ( ) ; <nl> + RssFeedList streams = getAllFeeds ( ) ; <nl> foreach ( const RssFeedPtr & stream , streams ) { <nl> QString stream_path = stream - > pathHierarchy ( ) . join ( " \ \ " ) ; <nl> if ( stream_path . isNull ( ) ) { <nl> static bool laterItemDate ( const RssArticlePtr & a , const RssArticlePtr & b ) <nl> void RssManager : : sortNewsList ( RssArticleList & news_list ) { <nl> qSort ( news_list . begin ( ) , news_list . end ( ) , laterItemDate ) ; <nl> } <nl> + <nl> + RssDownloadRuleList * RssManager : : downloadRules ( ) const <nl> + { <nl> + Q_ASSERT ( m_downloadRules ) ; <nl> + return m_downloadRules ; <nl> + } <nl> mmm a / src / rss / rssmanager . h <nl> ppp b / src / rss / rssmanager . h <nl> <nl> # include " rssfolder . h " <nl> <nl> class DownloadThread ; <nl> + class RssDownloadRuleList ; <nl> <nl> class RssManager ; <nl> typedef QSharedPointer < RssManager > RssManagerPtr ; <nl> class RssManager : public RssFolder { <nl> virtual ~ RssManager ( ) ; <nl> <nl> inline DownloadThread * rssDownloader ( ) const { return m_rssDownloader ; } <nl> - static void insertSortElem ( RssArticleList & list , const RssArticlePtr & item ) ; <nl> static void sortNewsList ( RssArticleList & news_list ) ; <nl> <nl> + RssDownloadRuleList * downloadRules ( ) const ; <nl> + <nl> public slots : <nl> void loadStreamList ( ) ; <nl> void saveStreamList ( ) const ; <nl> public slots : <nl> QTimer m_refreshTimer ; <nl> uint m_refreshInterval ; <nl> DownloadThread * m_rssDownloader ; <nl> - <nl> + RssDownloadRuleList * m_downloadRules ; <nl> } ; <nl> <nl> # endif / / RSSMANAGER_H <nl>
RSS : Remove last singleton
qbittorrent/qBittorrent
00b4ad6ec808341703a9714ec29222406a7c0bb5
2012-02-20T17:49:35Z
mmm a / include / osquery / core . h <nl> ppp b / include / osquery / core . h <nl> <nl> <nl> namespace osquery { <nl> <nl> - / * * <nl> - * @ brief The version of osquery <nl> - * / <nl> + / / / The version of osquery , includes the git revision if not tagged . <nl> extern const std : : string kVersion ; <nl> + <nl> + / / / The SDK version removes any git revision hash ( 1 . 6 . 1 - g0000 becomes 1 . 6 . 1 ) . <nl> extern const std : : string kSDKVersion ; <nl> + <nl> + / / / Identifies the build platform of either the core extension . <nl> extern const std : : string kSDKPlatform ; <nl> <nl> / / / Use a macro for the sdk / platform literal , symbols available in lib . cpp . <nl> enum ToolType { <nl> OSQUERY_EXTENSION , <nl> } ; <nl> <nl> - typedef boost : : unique_lock < boost : : shared_mutex > WriteLock ; <nl> - typedef boost : : shared_lock < boost : : shared_mutex > ReadLock ; <nl> + / / / Helper alias for write locking a mutex . <nl> + using WriteLock = boost : : unique_lock < boost : : shared_mutex > ; <nl> + / / / Helper alias for read locking a mutex . <nl> + using ReadLock = boost : : shared_lock < boost : : shared_mutex > ; <nl> <nl> / / / The osquery tool type for runtime decisions . <nl> extern ToolType kToolType ; <nl> class Initializer : private boost : : noncopyable { <nl> * A daemon has additional constraints , it can use a process mutex , check <nl> * for sane / non - default configurations , etc . <nl> * / <nl> - void initDaemon ( ) ; <nl> + void initDaemon ( ) const ; <nl> <nl> / * * <nl> * @ brief Daemon tools may want to continually spawn worker processes <nl> class Initializer : private boost : : noncopyable { <nl> * <nl> * @ param name The name of the worker process . <nl> * / <nl> - void initWorkerWatcher ( const std : : string & name ) ; <nl> + void initWorkerWatcher ( const std : : string & name ) const ; <nl> <nl> / / / Assume initialization finished , start work . <nl> - void start ( ) ; <nl> + void start ( ) const ; <nl> + <nl> / / / Turns off various aspects of osquery such as event loops . <nl> - void shutdown ( ) ; <nl> + void shutdown ( ) const ; <nl> <nl> / * * <nl> * @ brief Check if a process is an osquery worker . <nl> class Initializer : private boost : : noncopyable { <nl> <nl> private : <nl> / / / Initialize this process as an osquery daemon worker . <nl> - void initWorker ( const std : : string & name ) ; <nl> + void initWorker ( const std : : string & name ) const ; <nl> + <nl> / / / Initialize the osquery watcher , optionally spawn a worker . <nl> - void initWatcher ( ) ; <nl> + void initWatcher ( ) const ; <nl> + <nl> / / / Set and wait for an active plugin optionally broadcasted . <nl> - void initActivePlugin ( const std : : string & type , const std : : string & name ) ; <nl> + void initActivePlugin ( const std : : string & type , const std : : string & name ) const ; <nl> <nl> private : <nl> int * argc_ { nullptr } ; <nl> inline size_t utf8StringSize ( const std : : string & str ) { <nl> * / <nl> Status createPidFile ( ) ; <nl> <nl> + / * * <nl> + * @ brief Forcefully request the application stop . <nl> + * <nl> + * Since all osquery tools may implement various ' dispatched ' services in the <nl> + * form of event handler threads or thrift service and client pools , a stop <nl> + * request should behave nicely and request these services stop . <nl> + * <nl> + * Use shutdown whenever you would normally call : : exit . <nl> + * / <nl> + void shutdown ( int recode , bool wait = false ) ; <nl> + <nl> class DropPrivileges ; <nl> typedef std : : shared_ptr < DropPrivileges > DropPrivilegesRef ; <nl> <nl> mmm a / include / osquery / events . h <nl> ppp b / include / osquery / events . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include < atomic > <nl> # include < functional > <nl> # include < memory > <nl> # include < map > <nl> <nl> # include < boost / thread / locks . hpp > <nl> # include < boost / thread / mutex . hpp > <nl> <nl> + # include < osquery / core . h > <nl> # include < osquery / registry . h > <nl> # include < osquery / status . h > <nl> # include < osquery / tables . h > <nl> class EventPublisherPlugin : public Plugin { <nl> <nl> private : <nl> / / / Set ending to True to cause event type run loops to finish . <nl> - bool ending_ { false } ; <nl> + std : : atomic < bool > ending_ { false } ; <nl> <nl> / / / Set to indicate whether the event run loop ever started . <nl> - bool started_ { false } ; <nl> + std : : atomic < bool > started_ { false } ; <nl> <nl> / / / A lock for incrementing the next EventContextID . <nl> boost : : mutex ec_id_lock_ ; <nl> <nl> / / / A helper count of event publisher runloop iterations . <nl> - size_t restart_count_ { 0 } ; <nl> + std : : atomic < size_t > restart_count_ { 0 } ; <nl> <nl> private : <nl> / / / Enable event factory " callins " through static publisher callbacks . <nl> class EventFactory : private boost : : noncopyable { <nl> * / <nl> static void end ( bool join = false ) ; <nl> <nl> + / / / Request a write lock to make publisher registrations / deregistrations . <nl> + static WriteLock requestWrite ( ) { <nl> + return WriteLock ( getInstance ( ) . factory_lock_ ) ; <nl> + } <nl> + <nl> + / / / Request a read lock to access publisher data . <nl> + static ReadLock requestRead ( ) { <nl> + return ReadLock ( getInstance ( ) . factory_lock_ ) ; <nl> + } <nl> + <nl> public : <nl> EventFactory ( EventFactory const & ) = delete ; <nl> EventFactory & operator = ( EventFactory const & ) = delete ; <nl> class EventFactory : private boost : : noncopyable { <nl> <nl> / / / Set of running EventPublisher run loop threads . <nl> std : : vector < std : : shared_ptr < boost : : thread > > threads_ ; <nl> + <nl> + / / / Factory publisher state manipulation . <nl> + boost : : shared_mutex factory_lock_ ; <nl> } ; <nl> <nl> / * * <nl> mmm a / osquery / config / config . cpp <nl> ppp b / osquery / config / config . cpp <nl> Status Config : : load ( ) { <nl> content . first . c_str ( ) , <nl> content . second . c_str ( ) ) ; <nl> } <nl> - : : exit ( EXIT_SUCCESS ) ; <nl> + osquery : : shutdown ( EXIT_SUCCESS ) ; <nl> } <nl> status = update ( response [ 0 ] ) ; <nl> } <nl> mmm a / osquery / core / init . cpp <nl> ppp b / osquery / core / init . cpp <nl> <nl> # include < osquery / registry . h > <nl> <nl> # include " osquery / core / watcher . h " <nl> + # include " osquery / dispatcher / dispatcher . h " <nl> # include " osquery / database / db_handle . h " <nl> <nl> # if defined ( __linux__ ) | | defined ( __FreeBSD__ ) <nl> Initializer : : Initializer ( int & argc , char * * & argv , ToolType tool ) <nl> help = = " - h " ) & & <nl> tool ! = OSQUERY_TOOL_TEST ) { <nl> printUsage ( binary_ , tool_ ) ; <nl> - : : exit ( 0 ) ; <nl> + : : exit ( EXIT_SUCCESS ) ; <nl> } <nl> } <nl> <nl> Initializer : : Initializer ( int & argc , char * * & argv , ToolType tool ) <nl> } <nl> } <nl> <nl> - void Initializer : : initDaemon ( ) { <nl> + void Initializer : : initDaemon ( ) const { <nl> if ( FLAGS_config_check ) { <nl> / / No need to daemonize , emit log lines , or create process mutexes . <nl> return ; <nl> void Initializer : : initDaemon ( ) { <nl> } <nl> } <nl> <nl> - void Initializer : : initWatcher ( ) { <nl> + void Initializer : : initWatcher ( ) const { <nl> / / The watcher takes a list of paths to autoload extensions from . <nl> osquery : : loadExtensions ( ) ; <nl> <nl> void Initializer : : initWatcher ( ) { <nl> Dispatcher : : joinServices ( ) ; <nl> / / Execution should only reach this point if a signal was handled by the <nl> / / worker and watcher . <nl> - : : exit ( ( kHandledSignal > 0 ) ? 128 + kHandledSignal : EXIT_FAILURE ) ; <nl> + auto retcode = 0 ; <nl> + if ( kHandledSignal > 0 ) { <nl> + retcode = 128 + kHandledSignal ; <nl> + } else if ( Watcher : : getWorkerStatus ( ) > = 0 ) { <nl> + retcode = Watcher : : getWorkerStatus ( ) ; <nl> + } else { <nl> + retcode = EXIT_FAILURE ; <nl> + } <nl> + osquery : : shutdown ( retcode , true ) ; <nl> } <nl> } <nl> <nl> - void Initializer : : initWorker ( const std : : string & name ) { <nl> + void Initializer : : initWorker ( const std : : string & name ) const { <nl> / / Clear worker ' s arguments . <nl> size_t name_size = strlen ( ( * argv_ ) [ 0 ] ) ; <nl> auto original_name = std : : string ( ( * argv_ ) [ 0 ] ) ; <nl> void Initializer : : initWorker ( const std : : string & name ) { <nl> Dispatcher : : addService ( std : : make_shared < WatcherWatcherRunner > ( getppid ( ) ) ) ; <nl> } <nl> <nl> - void Initializer : : initWorkerWatcher ( const std : : string & name ) { <nl> + void Initializer : : initWorkerWatcher ( const std : : string & name ) const { <nl> if ( isWorker ( ) ) { <nl> initWorker ( name ) ; <nl> } else { <nl> void Initializer : : initWorkerWatcher ( const std : : string & name ) { <nl> bool Initializer : : isWorker ( ) { return hasWorkerVariable ( ) ; } <nl> <nl> void Initializer : : initActivePlugin ( const std : : string & type , <nl> - const std : : string & name ) { <nl> + const std : : string & name ) const { <nl> / / Use a delay , meaning the amount of milliseconds waited for extensions . <nl> size_t delay = 0 ; <nl> / / The timeout is the maximum microseconds in seconds to wait for extensions . <nl> void Initializer : : initActivePlugin ( const std : : string & type , <nl> while ( ! Registry : : setActive ( type , name ) ) { <nl> if ( ! Watcher : : hasManagedExtensions ( ) | | delay > timeout ) { <nl> LOG ( ERROR ) < < " Active " < < type < < " plugin not found : " < < name ; <nl> - : : exit ( EXIT_CATASTROPHIC ) ; <nl> + osquery : : shutdown ( EXIT_CATASTROPHIC ) ; <nl> } <nl> delay + = kExtensionInitializeLatencyUS ; <nl> : : usleep ( kExtensionInitializeLatencyUS ) ; <nl> } <nl> } <nl> <nl> - void Initializer : : start ( ) { <nl> + void Initializer : : start ( ) const { <nl> / / Load registry / extension modules before extensions . <nl> osquery : : loadModules ( ) ; <nl> <nl> void Initializer : : start ( ) { <nl> if ( ! DBHandle : : checkDB ( ) ) { <nl> LOG ( ERROR ) < < RLOG ( 1629 ) < < binary_ <nl> < < " initialize failed : Could not open RocksDB " ; <nl> - if ( isWorker ( ) ) { <nl> - : : exit ( EXIT_CATASTROPHIC ) ; <nl> - } else { <nl> - : : exit ( EXIT_FAILURE ) ; <nl> - } <nl> + auto retcode = ( isWorker ( ) ) ? EXIT_CATASTROPHIC : EXIT_FAILURE ; <nl> + : : exit ( retcode ) ; <nl> } <nl> <nl> / / Bind to an extensions socket and wait for registry additions . <nl> + / / After starting the extension manager , osquery MUST shutdown using the <nl> + / / internal ' shutdown ' method . <nl> osquery : : startExtensionManager ( ) ; <nl> <nl> / / Then set the config plugin , which uses a single / active plugin . <nl> void Initializer : : start ( ) { <nl> std : : cerr < < " Error reading config : " < < s . toString ( ) < < " \ n " ; <nl> } <nl> / / A configuration check exits the application . <nl> - : : exit ( s . getCode ( ) ) ; <nl> + osquery : : shutdown ( s . getCode ( ) ) ; <nl> } <nl> <nl> if ( FLAGS_database_dump ) { <nl> dumpDatabase ( ) ; <nl> - : : exit ( EXIT_SUCCESS ) ; <nl> + osquery : : shutdown ( EXIT_SUCCESS ) ; <nl> } <nl> <nl> / / Load the osquery config using the default / active config plugin . <nl> void Initializer : : start ( ) { <nl> EventFactory : : delay ( ) ; <nl> } <nl> <nl> - void Initializer : : shutdown ( ) { <nl> + void Initializer : : shutdown ( ) const { osquery : : shutdown ( EXIT_SUCCESS , false ) ; } <nl> + <nl> + void shutdown ( int retcode , bool wait ) { <nl> / / End any event type run loops . <nl> - EventFactory : : end ( ) ; <nl> + EventFactory : : end ( wait ) ; <nl> + / / Stop thrift services / clients / and their thread pools . <nl> + Dispatcher : : stopServices ( ) ; <nl> + Dispatcher : : joinServices ( ) ; <nl> <nl> / / Hopefully release memory used by global string constructors in gflags . <nl> GFLAGS_NAMESPACE : : ShutDownCommandLineFlags ( ) ; <nl> + : : exit ( retcode ) ; <nl> } <nl> } <nl> mmm a / osquery / core / watcher . cpp <nl> ppp b / osquery / core / watcher . cpp <nl> CLI_FLAG ( int32 , <nl> <nl> CLI_FLAG ( bool , disable_watchdog , false , " Disable userland watchdog process " ) ; <nl> <nl> - / / / If the worker exits the watcher will inspect the return code . <nl> - void childHandler ( int signum ) { <nl> - siginfo_t info ; <nl> - / / Make sure WNOWAIT is used to the wait information is not removed . <nl> - / / Watcher : : watch implements a thread to poll for this information . <nl> - waitid ( P_ALL , 0 , & info , WEXITED | WSTOPPED | WNOHANG | WNOWAIT ) ; <nl> - if ( info . si_code = = CLD_EXITED ) { <nl> - if ( info . si_status = = EXIT_CATASTROPHIC ) { <nl> - / / A child process had a catastrophic error , abort the watcher . <nl> - : : exit ( EXIT_FAILURE ) ; <nl> - } else if ( info . si_status = = EXIT_SUCCESS ) { <nl> - / / Child process is finished . <nl> - : : exit ( EXIT_SUCCESS ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> void Watcher : : resetWorkerCounters ( size_t respawn_time ) { <nl> / / Reset the monitoring counters for the watcher . <nl> auto & state = instance ( ) . state_ ; <nl> bool Watcher : : hasManagedExtensions ( ) { <nl> <nl> bool WatcherRunner : : ok ( ) { <nl> interruptableSleep ( getWorkerLimit ( INTERVAL ) * 1000 ) ; <nl> + / / Inspect the exit code , on success or catastrophic , end the watcher . <nl> + auto status = Watcher : : getWorkerStatus ( ) ; <nl> + if ( status = = EXIT_SUCCESS | | status = = EXIT_CATASTROPHIC ) { <nl> + return false ; <nl> + } <nl> / / Watcher is OK to run if a worker or at least one extension exists . <nl> return ( Watcher : : getWorker ( ) > = 0 | | Watcher : : hasManagedExtensions ( ) ) ; <nl> } <nl> bool WatcherRunner : : ok ( ) { <nl> void WatcherRunner : : start ( ) { <nl> / / Set worker performance counters to an initial state . <nl> Watcher : : resetWorkerCounters ( 0 ) ; <nl> - signal ( SIGCHLD , childHandler ) ; <nl> <nl> / / Enter the watch loop . <nl> do { <nl> if ( use_worker_ & & ! watch ( Watcher : : getWorker ( ) ) ) { <nl> if ( Watcher : : fatesBound ( ) ) { <nl> + / / A signal has interrupted the watcher . <nl> break ; <nl> } <nl> / / The watcher failed , create a worker . <nl> void WatcherRunner : : start ( ) { <nl> } <nl> <nl> bool WatcherRunner : : watch ( pid_t child ) { <nl> - int status ; <nl> + int status = 0 ; <nl> pid_t result = waitpid ( child , & status , WNOHANG ) ; <nl> - if ( child = = 0 | | result = = child ) { <nl> + if ( Watcher : : fatesBound ( ) ) { <nl> + / / A signal was handled while the watcher was watching . <nl> + return false ; <nl> + } <nl> + <nl> + if ( child = = 0 | | result < 0 ) { <nl> / / Worker does not exist or never existed . <nl> return false ; <nl> } else if ( result = = 0 ) { <nl> bool WatcherRunner : : watch ( pid_t child ) { <nl> stopChild ( child ) ; <nl> return false ; <nl> } <nl> + return true ; <nl> + } <nl> + <nl> + if ( WIFEXITED ( status ) ) { <nl> + / / If the worker process existed , store the exit code . <nl> + Watcher : : instance ( ) . worker_status_ = WEXITSTATUS ( status ) ; <nl> } <nl> return true ; <nl> } <nl> void WatcherRunner : : createWorker ( ) { <nl> auto qd = SQL : : selectAllFrom ( " processes " , " pid " , EQUALS , INTEGER ( getpid ( ) ) ) ; <nl> if ( qd . size ( ) ! = 1 | | qd [ 0 ] . count ( " path " ) = = 0 | | qd [ 0 ] [ " path " ] . size ( ) = = 0 ) { <nl> LOG ( ERROR ) < < " osquery watcher cannot determine process path for worker " ; <nl> - : : exit ( EXIT_FAILURE ) ; <nl> + osquery : : shutdown ( EXIT_FAILURE ) ; <nl> } <nl> <nl> / / Set an environment signaling to potential plugin - dependent workers to wait <nl> void WatcherRunner : : createWorker ( ) { <nl> / / osqueryd binary has become unsafe . <nl> LOG ( ERROR ) < < RLOG ( 1382 ) <nl> < < " osqueryd has unsafe permissions : " < < exec_path . string ( ) ; <nl> - : : exit ( EXIT_FAILURE ) ; <nl> + osquery : : shutdown ( EXIT_FAILURE ) ; <nl> } <nl> <nl> auto worker_pid = fork ( ) ; <nl> if ( worker_pid < 0 ) { <nl> / / Unrecoverable error , cannot create a worker process . <nl> LOG ( ERROR ) < < " osqueryd could not create a worker process " ; <nl> - : : exit ( EXIT_FAILURE ) ; <nl> + osquery : : shutdown ( EXIT_FAILURE ) ; <nl> } else if ( worker_pid = = 0 ) { <nl> / / This is the new worker process , no watching needed . <nl> setenv ( " OSQUERY_WORKER " , std : : to_string ( getpid ( ) ) . c_str ( ) , 1 ) ; <nl> execve ( exec_path . string ( ) . c_str ( ) , argv_ , environ ) ; <nl> / / Code should never reach this point . <nl> LOG ( ERROR ) < < " osqueryd could not start worker process " ; <nl> - : : exit ( EXIT_CATASTROPHIC ) ; <nl> + osquery : : shutdown ( EXIT_CATASTROPHIC ) ; <nl> } <nl> <nl> Watcher : : setWorker ( worker_pid ) ; <nl> bool WatcherRunner : : createExtension ( const std : : string & extension ) { <nl> if ( ext_pid < 0 ) { <nl> / / Unrecoverable error , cannot create an extension process . <nl> LOG ( ERROR ) < < " Cannot create extension process : " < < extension ; <nl> - : : exit ( EXIT_FAILURE ) ; <nl> + osquery : : shutdown ( EXIT_FAILURE ) ; <nl> } else if ( ext_pid = = 0 ) { <nl> / / Pass the current extension socket and a set timeout to the extension . <nl> setenv ( " OSQUERY_EXTENSION " , std : : to_string ( getpid ( ) ) . c_str ( ) , 1 ) ; <nl> bool WatcherRunner : : createExtension ( const std : : string & extension ) { <nl> environ ) ; <nl> / / Code should never reach this point . <nl> VLOG ( 1 ) < < " Could not start extension process : " < < extension ; <nl> - : : exit ( EXIT_FAILURE ) ; <nl> + osquery : : shutdown ( EXIT_FAILURE ) ; <nl> } <nl> <nl> Watcher : : setExtension ( extension , ext_pid ) ; <nl> void WatcherWatcherRunner : : start ( ) { <nl> / / Watcher died , the worker must follow . <nl> VLOG ( 1 ) < < " osqueryd worker ( " < < getpid ( ) <nl> < < " ) detected killed watcher ( " < < watcher_ < < " ) " ; <nl> - Dispatcher : : stopServices ( ) ; <nl> / / The watcher watcher is a thread . Do not join services after removing . <nl> - : : exit ( EXIT_SUCCESS ) ; <nl> + : : exit ( EXIT_FAILURE ) ; <nl> } <nl> interruptableSleep ( getWorkerLimit ( INTERVAL ) * 1000 ) ; <nl> } <nl> mmm a / osquery / core / watcher . h <nl> ppp b / osquery / core / watcher . h <nl> <nl> <nl> # pragma once <nl> <nl> - # include < csignal > <nl> + # include < atomic > <nl> # include < string > <nl> <nl> # include < unistd . h > <nl> class Watcher : private boost : : noncopyable { <nl> * / <nl> static bool hasManagedExtensions ( ) ; <nl> <nl> + / / / Check the status of the last worker . <nl> + static int getWorkerStatus ( ) { return instance ( ) . worker_status_ ; } <nl> + <nl> private : <nl> / / / Do not request the lock until extensions are used . <nl> Watcher ( ) <nl> : worker_ ( - 1 ) , worker_restarts_ ( 0 ) , lock_ ( mutex_ , boost : : defer_lock ) { } <nl> Watcher ( Watcher const & ) ; <nl> + <nl> void operator = ( Watcher const & ) ; <nl> virtual ~ Watcher ( ) { } <nl> <nl> class Watcher : private boost : : noncopyable { <nl> private : <nl> / / / Performance state for the worker process . <nl> PerformanceState state_ ; <nl> + <nl> / / / Performance states for each autoloadable extension binary . <nl> std : : map < std : : string , PerformanceState > extension_states_ ; <nl> <nl> private : <nl> / / / Keep the single worker process / thread ID for inspection . <nl> - std : : sig_atomic_t worker_ { - 1 } ; <nl> + std : : atomic < int > worker_ { - 1 } ; <nl> + <nl> / / / Number of worker restarts NOT induced by a watchdog process . <nl> size_t worker_restarts_ { 0 } ; <nl> + <nl> / / / Keep a list of resolved extension paths and their managed pids . <nl> std : : map < std : : string , pid_t > extensions_ ; <nl> + <nl> / / / Paths to autoload extensions . <nl> std : : vector < std : : string > extensions_paths_ ; <nl> + <nl> / / / Bind the fate of the watcher to the worker . <nl> bool restart_worker_ { true } ; <nl> <nl> + / / / Record the exit status of the most recent worker . <nl> + std : : atomic < int > worker_status_ { - 1 } ; <nl> + <nl> private : <nl> / / / Mutex and lock around extensions access . <nl> boost : : mutex mutex_ ; <nl> + <nl> / / / Mutex and lock around extensions access . <nl> boost : : unique_lock < boost : : mutex > lock_ ; <nl> <nl> mmm a / osquery / devtools / shell . cpp <nl> ppp b / osquery / devtools / shell . cpp <nl> static int shell_exec ( <nl> ) { <nl> / / Grab a lock on the managed DB instance . <nl> auto dbc = osquery : : SQLiteDBManager : : get ( ) ; <nl> - auto db = dbc . db ( ) ; <nl> + auto db = dbc - > db ( ) ; <nl> <nl> sqlite3_stmt * pStmt = nullptr ; / * Statement to execute . * / <nl> int rc = SQLITE_OK ; / * Return Code * / <nl> static sqlite3_int64 integerValue ( const char * zArg ) { <nl> char * zSuffix ; <nl> int iMult ; <nl> } aMult [ ] = { <nl> - { ( char * ) " KiB " , 1024 } , <nl> - { ( char * ) " MiB " , 1024 * 1024 } , <nl> - { ( char * ) " GiB " , 1024 * 1024 * 1024 } , <nl> - { ( char * ) " KB " , 1000 } , <nl> - { ( char * ) " MB " , 1000000 } , <nl> - { ( char * ) " GB " , 1000000000 } , <nl> - { ( char * ) " K " , 1000 } , <nl> - { ( char * ) " M " , 1000000 } , <nl> - { ( char * ) " G " , 1000000000 } , <nl> - } ; <nl> + { ( char * ) " KiB " , 1024 } , <nl> + { ( char * ) " MiB " , 1024 * 1024 } , <nl> + { ( char * ) " GiB " , 1024 * 1024 * 1024 } , <nl> + { ( char * ) " KB " , 1000 } , <nl> + { ( char * ) " MB " , 1000000 } , <nl> + { ( char * ) " GB " , 1000000000 } , <nl> + { ( char * ) " K " , 1000 } , <nl> + { ( char * ) " M " , 1000000 } , <nl> + { ( char * ) " G " , 1000000000 } , <nl> + } ; <nl> int i ; <nl> int isNeg = 0 ; <nl> if ( zArg [ 0 ] = = ' - ' ) { <nl> static int do_meta_command ( char * zLine , struct callback_data * p ) { <nl> <nl> / / A meta command may act on the database , grab a lock and instance . <nl> auto dbc = osquery : : SQLiteDBManager : : get ( ) ; <nl> - auto db = dbc . db ( ) ; <nl> + auto db = dbc - > db ( ) ; <nl> <nl> / * Parse the input line into tokens . <nl> * / <nl> int launchIntoShell ( int argc , char * * argv ) { <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> / / Add some shell - specific functions to the instance . <nl> sqlite3_create_function ( <nl> - dbc . db ( ) , " shellstatic " , 0 , SQLITE_UTF8 , 0 , shellstaticFunc , 0 , 0 ) ; <nl> + dbc - > db ( ) , " shellstatic " , 0 , SQLITE_UTF8 , 0 , shellstaticFunc , 0 , 0 ) ; <nl> } <nl> <nl> stdin_is_interactive = isatty ( 0 ) ; <nl> mmm a / osquery / dispatcher / dispatcher . h <nl> ppp b / osquery / dispatcher / dispatcher . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include < atomic > <nl> # include < memory > <nl> # include < set > <nl> # include < string > <nl> using namespace apache : : thrift : : concurrency ; <nl> <nl> / / / Create easier to reference typedefs for Thrift layer implementations . <nl> # define SHARED_PTR_IMPL OSQUERY_THRIFT_POINTER : : shared_ptr <nl> - typedef apache : : thrift : : concurrency : : ThreadManager InternalThreadManager ; <nl> - typedef SHARED_PTR_IMPL < InternalThreadManager > InternalThreadManagerRef ; <nl> + using InternalThreadManager = apache : : thrift : : concurrency : : ThreadManager ; <nl> + using InternalThreadManagerRef = SHARED_PTR_IMPL < InternalThreadManager > ; <nl> <nl> / * * <nl> * @ brief Default number of threads in the thread pool . <nl> class InternalRunnable : public Runnable { <nl> virtual void start ( ) = 0 ; <nl> <nl> private : <nl> - bool run_ ; <nl> + std : : atomic < bool > run_ { false } ; <nl> } ; <nl> <nl> / / / An internal runnable used throughout osquery as dispatcher services . <nl> - typedef std : : shared_ptr < InternalRunnable > InternalRunnableRef ; <nl> - typedef std : : shared_ptr < boost : : thread > InternalThreadRef ; <nl> + using InternalRunnableRef = std : : shared_ptr < InternalRunnable > ; <nl> + using InternalThreadRef = std : : shared_ptr < boost : : thread > ; <nl> / / / A thrift internal runnable with variable pointer wrapping . <nl> - typedef SHARED_PTR_IMPL < InternalRunnable > ThriftInternalRunnableRef ; <nl> - typedef SHARED_PTR_IMPL < PosixThreadFactory > ThriftThreadFactory ; <nl> + using ThriftInternalRunnableRef = SHARED_PTR_IMPL < InternalRunnable > ; <nl> + using ThriftThreadFactory = SHARED_PTR_IMPL < PosixThreadFactory > ; <nl> <nl> / * * <nl> * @ brief Singleton for queuing asynchronous tasks to be executed in parallel <nl> mmm a / osquery / events / events . cpp <nl> ppp b / osquery / events / events . cpp <nl> QueryData EventSubscriberPlugin : : get ( EventTime start , EventTime stop ) { <nl> } <nl> <nl> Status EventSubscriberPlugin : : add ( Row & r , EventTime event_time ) { <nl> - std : : shared_ptr < DBHandle > db = nullptr ; <nl> - try { <nl> - db = DBHandle : : getInstance ( ) ; <nl> - } catch ( const std : : runtime_error & e ) { <nl> - return Status ( 1 , e . what ( ) ) ; <nl> - } <nl> - <nl> + auto db = DBHandle : : getInstance ( ) ; <nl> / / Get and increment the EID for this module . <nl> EventID eid = getEventID ( ) ; <nl> / / Without encouraging a missing event time , do not support a 0 - time . <nl> void EventFactory : : delay ( ) { <nl> } <nl> <nl> Status EventFactory : : run ( EventPublisherID & type_id ) { <nl> - auto & ef = EventFactory : : getInstance ( ) ; <nl> if ( FLAGS_disable_events ) { <nl> return Status ( 0 , " Events disabled " ) ; <nl> } <nl> Status EventFactory : : run ( EventPublisherID & type_id ) { <nl> / / Assume it can either make use of an entrypoint poller / selector or <nl> / / take care of async callback registrations in setUp / configure / run <nl> / / only once and handle event queuing / firing in callbacks . <nl> - EventPublisherRef publisher = ef . getEventPublisher ( type_id ) ; <nl> + EventPublisherRef publisher = nullptr ; <nl> + { <nl> + auto & ef = EventFactory : : getInstance ( ) ; <nl> + auto read_lock = ef . requestRead ( ) ; <nl> + publisher = ef . getEventPublisher ( type_id ) ; <nl> + } <nl> <nl> if ( publisher = = nullptr ) { <nl> return Status ( 1 , " Event publisher is missing " ) ; <nl> Status EventFactory : : run ( EventPublisherID & type_id ) { <nl> / / If the event factory ' s ` end ` method was called these publishers will be <nl> / / cleaned up after their thread context is removed ; otherwise , a removed <nl> / / thread context and failed publisher will remain available for stats . <nl> - / / ef . event_pubs_ . erase ( type_id ) ; <nl> return Status ( 0 , " OK " ) ; <nl> } <nl> <nl> std : : vector < std : : string > EventFactory : : subscriberNames ( ) { <nl> void EventFactory : : end ( bool join ) { <nl> auto & ef = EventFactory : : getInstance ( ) ; <nl> <nl> - / / Call deregister on each publisher . <nl> - for ( const auto & publisher : ef . publisherTypes ( ) ) { <nl> - deregisterEventPublisher ( publisher ) ; <nl> + { <nl> + auto write_lock = ef . requestWrite ( ) ; <nl> + / / Call deregister on each publisher . <nl> + for ( const auto & publisher : ef . publisherTypes ( ) ) { <nl> + deregisterEventPublisher ( publisher ) ; <nl> + } <nl> } <nl> <nl> / / Stop handling exceptions for the publisher threads . <nl> void EventFactory : : end ( bool join ) { <nl> } <nl> } <nl> <nl> - / / A small cool off helps OS API event publisher flushing . <nl> - if ( ! FLAGS_disable_events ) { <nl> - : : usleep ( 400 ) ; <nl> - ef . threads_ . clear ( ) ; <nl> - } <nl> + { <nl> + auto write_lock = ef . requestWrite ( ) ; <nl> + / / A small cool off helps OS API event publisher flushing . <nl> + if ( ! FLAGS_disable_events ) { <nl> + ef . threads_ . clear ( ) ; <nl> + } <nl> <nl> - / / Threads may still be executing , when they finish , release publishers . <nl> - ef . event_pubs_ . clear ( ) ; <nl> - ef . event_subs_ . clear ( ) ; <nl> + / / Threads may still be executing , when they finish , release publishers . <nl> + ef . event_pubs_ . clear ( ) ; <nl> + ef . event_subs_ . clear ( ) ; <nl> + } <nl> } <nl> <nl> void attachEvents ( ) { <nl> mmm a / osquery / extensions / interface . cpp <nl> ppp b / osquery / extensions / interface . cpp <nl> bool ExtensionManagerHandler : : exists ( const std : : string & name ) { <nl> ExtensionRunnerCore : : ~ ExtensionRunnerCore ( ) { remove ( path_ ) ; } <nl> <nl> void ExtensionRunnerCore : : stop ( ) { <nl> - if ( server_ ! = nullptr ) { <nl> - server_ - > stop ( ) ; <nl> + boost : : lock_guard < boost : : mutex > lock ( service_start_ ) ; <nl> + service_stopping_ = true ; <nl> + if ( transport_ ! = nullptr ) { <nl> + transport_ - > interrupt ( ) ; <nl> + } <nl> + <nl> + { <nl> + / / In most cases the service thread has started before the stop request . <nl> + boost : : lock_guard < boost : : mutex > lock ( service_run_ ) ; <nl> + if ( server_ ! = nullptr ) { <nl> + server_ - > stop ( ) ; <nl> + } <nl> } <nl> } <nl> <nl> inline void removeStalePaths ( const std : : string & manager ) { <nl> } <nl> <nl> void ExtensionRunnerCore : : startServer ( TProcessorRef processor ) { <nl> - auto transport = TServerTransportRef ( new TServerSocket ( path_ ) ) ; <nl> - / / Before starting and after stopping the manager , remove stale sockets . <nl> - removeStalePaths ( path_ ) ; <nl> + { <nl> + boost : : lock_guard < boost : : mutex > lock ( service_start_ ) ; <nl> + / / A request to stop the service may occur before the thread starts . <nl> + if ( service_stopping_ ) { <nl> + return ; <nl> + } <nl> <nl> - auto transport_fac = TTransportFactoryRef ( new TBufferedTransportFactory ( ) ) ; <nl> - auto protocol_fac = TProtocolFactoryRef ( new TBinaryProtocolFactory ( ) ) ; <nl> + transport_ = TServerTransportRef ( new TServerSocket ( path_ ) ) ; <nl> + / / Before starting and after stopping the manager , remove stale sockets . <nl> + removeStalePaths ( path_ ) ; <nl> + <nl> + / / Construct the service ' s transport , protocol , thread pool . <nl> + auto transport_fac = TTransportFactoryRef ( new TBufferedTransportFactory ( ) ) ; <nl> + auto protocol_fac = TProtocolFactoryRef ( new TBinaryProtocolFactory ( ) ) ; <nl> <nl> - / / The minimum number of worker threads is 1 . <nl> - size_t threads = ( FLAGS_worker_threads > 0 ) ? FLAGS_worker_threads : 1 ; <nl> - manager_ = ThreadManager : : newSimpleThreadManager ( threads , 0 ) ; <nl> - auto thread_fac = ThriftThreadFactory ( new PosixThreadFactory ( ) ) ; <nl> - manager_ - > threadFactory ( thread_fac ) ; <nl> - manager_ - > start ( ) ; <nl> + / / Start the Thrift server ' s run loop . <nl> + server_ = TThreadedServerRef ( new TThreadedServer ( <nl> + processor , transport_ , transport_fac , protocol_fac ) ) ; <nl> + } <nl> <nl> - / / Start the Thrift server ' s run loop . <nl> - server_ = TThreadPoolServerRef ( new TThreadPoolServer ( <nl> - processor , transport , transport_fac , protocol_fac , manager_ ) ) ; <nl> - server_ - > serve ( ) ; <nl> + { <nl> + boost : : lock_guard < boost : : mutex > lock ( service_run_ ) ; <nl> + server_ - > serve ( ) ; <nl> + } <nl> } <nl> <nl> void ExtensionRunner : : start ( ) { <nl> void ExtensionRunner : : start ( ) { <nl> } <nl> <nl> ExtensionManagerRunner : : ~ ExtensionManagerRunner ( ) { <nl> + / / Only attempt to remove stale paths if the server was started . <nl> + boost : : lock_guard < boost : : mutex > lock ( service_start_ ) ; <nl> if ( server_ ! = nullptr ) { <nl> - / / Eventually this extension manager should be stopped . <nl> - / / This involves a lock around assuring the thread context for destruction <nl> - / / matches and the server has begun serving ( potentially opaque to our <nl> - / / our use of ThreadPollServer API ) . <nl> - / / In newer ( forks ) version of thrift this server implementation has been <nl> - / / deprecated . <nl> - / / server_ - > stop ( ) ; <nl> removeStalePaths ( path_ ) ; <nl> } <nl> } <nl> mmm a / osquery / extensions / interface . h <nl> ppp b / osquery / extensions / interface . h <nl> <nl> / / paths for their includes . Unfortunately , changing include paths is not <nl> / / possible in every build system . <nl> / / clang - format off <nl> - # include CONCAT ( OSQUERY_THRIFT_SERVER_LIB , / TThreadPoolServer . h ) <nl> + # include CONCAT ( OSQUERY_THRIFT_SERVER_LIB , / TThreadedServer . h ) <nl> # include CONCAT ( OSQUERY_THRIFT_LIB , / protocol / TBinaryProtocol . h ) <nl> # include CONCAT ( OSQUERY_THRIFT_LIB , / transport / TServerSocket . h ) <nl> # include CONCAT ( OSQUERY_THRIFT_LIB , / transport / TBufferTransports . h ) <nl> typedef SHARED_PTR_IMPL < TTransportFactory > TTransportFactoryRef ; <nl> typedef SHARED_PTR_IMPL < TProtocolFactory > TProtocolFactoryRef ; <nl> typedef SHARED_PTR_IMPL < ThreadManager > TThreadManagerRef ; <nl> typedef SHARED_PTR_IMPL < PosixThreadFactory > PosixThreadFactoryRef ; <nl> - typedef std : : shared_ptr < TThreadPoolServer > TThreadPoolServerRef ; <nl> + using TThreadedServerRef = std : : shared_ptr < TThreadedServer > ; <nl> <nl> namespace extensions { <nl> <nl> class ExtensionRunnerCore : public InternalRunnable { <nl> / / / The UNIX domain socket used for requests from the ExtensionManager . <nl> std : : string path_ ; <nl> <nl> + / / / Transport instance , will be interrupted if the thread is removed . <nl> + TServerTransportRef transport_ { nullptr } ; <nl> + <nl> / / / Server instance , will be stopped if thread service is removed . <nl> - TThreadPoolServerRef server_ { nullptr } ; <nl> - TThreadManagerRef manager_ { nullptr } ; <nl> + TThreadedServerRef server_ { nullptr } ; <nl> + <nl> + / / / Protect the service start and stop , this mutex protects server creation . <nl> + boost : : mutex service_start_ ; <nl> + <nl> + private : <nl> + / / / Protect the service start and stop , this mutex protects the transport . <nl> + boost : : mutex service_run_ ; <nl> + <nl> + / / / Record a dispatcher ' s request to stop the service . <nl> + bool service_stopping_ { false } ; <nl> } ; <nl> <nl> / * * <nl> mmm a / osquery / main / shell . cpp <nl> ppp b / osquery / main / shell . cpp <nl> int profile ( int argc , char * argv [ ] ) { <nl> auto dbc = osquery : : SQLiteDBManager : : get ( ) ; <nl> for ( size_t i = 0 ; i < static_cast < size_t > ( osquery : : FLAGS_profile ) ; + + i ) { <nl> osquery : : QueryData results ; <nl> - auto status = osquery : : queryInternal ( query , results , dbc . db ( ) ) ; <nl> + auto status = osquery : : queryInternal ( query , results , dbc - > db ( ) ) ; <nl> if ( ! status ) { <nl> fprintf ( stderr , <nl> " Query failed ( % d ) : % s \ n " , <nl> mmm a / osquery / sql / benchmarks / sql_benchmarks . cpp <nl> ppp b / osquery / sql / benchmarks / sql_benchmarks . cpp <nl> static void SQL_virtual_table_internal ( benchmark : : State & state ) { <nl> <nl> / / Attach a sample virtual table . <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - attachTableInternal ( " benchmark " , columnDefinition ( res ) , dbc . db ( ) ) ; <nl> + attachTableInternal ( " benchmark " , columnDefinition ( res ) , dbc - > db ( ) ) ; <nl> <nl> while ( state . KeepRunning ( ) ) { <nl> QueryData results ; <nl> - queryInternal ( " select * from benchmark " , results , dbc . db ( ) ) ; <nl> + queryInternal ( " select * from benchmark " , results , dbc - > db ( ) ) ; <nl> } <nl> } <nl> <nl> static void SQL_virtual_table_internal_long ( benchmark : : State & state ) { <nl> <nl> / / Attach a sample virtual table . <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - attachTableInternal ( " long_benchmark " , columnDefinition ( res ) , dbc . db ( ) ) ; <nl> + attachTableInternal ( " long_benchmark " , columnDefinition ( res ) , dbc - > db ( ) ) ; <nl> <nl> while ( state . KeepRunning ( ) ) { <nl> QueryData results ; <nl> - queryInternal ( " select * from long_benchmark " , results , dbc . db ( ) ) ; <nl> + queryInternal ( " select * from long_benchmark " , results , dbc - > db ( ) ) ; <nl> } <nl> } <nl> <nl> static void SQL_virtual_table_internal_wide ( benchmark : : State & state ) { <nl> <nl> / / Attach a sample virtual table . <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - attachTableInternal ( " wide_benchmark " , columnDefinition ( res ) , dbc . db ( ) ) ; <nl> + attachTableInternal ( " wide_benchmark " , columnDefinition ( res ) , dbc - > db ( ) ) ; <nl> <nl> while ( state . KeepRunning ( ) ) { <nl> QueryData results ; <nl> - queryInternal ( " select * from wide_benchmark " , results , dbc . db ( ) ) ; <nl> + queryInternal ( " select * from wide_benchmark " , results , dbc - > db ( ) ) ; <nl> } <nl> } <nl> <nl> static void SQL_select_metadata ( benchmark : : State & state ) { <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> while ( state . KeepRunning ( ) ) { <nl> QueryData results ; <nl> - queryInternal ( <nl> - " select count ( * ) from sqlite_temp_master ; " , results , dbc . db ( ) ) ; <nl> + queryInternal ( " select count ( * ) from sqlite_temp_master ; " , results , <nl> + dbc - > db ( ) ) ; <nl> } <nl> } <nl> <nl> mmm a / osquery / sql / sqlite_util . cpp <nl> ppp b / osquery / sql / sqlite_util . cpp <nl> FLAG ( string , <nl> " Not Specified " , <nl> " Comma - delimited list of table names to be disabled " ) ; <nl> <nl> + using SQLiteDBInstanceRef = std : : shared_ptr < SQLiteDBInstance > ; <nl> + <nl> / * * <nl> * @ brief A map of SQLite status codes to their corresponding message string <nl> * <nl> std : : string getStringForSQLiteReturnCode ( int code ) { <nl> Status SQLiteSQLPlugin : : attach ( const std : : string & name ) { <nl> / / This may be the managed DB , or a transient . <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - if ( ! dbc . isPrimary ( ) ) { <nl> + if ( ! dbc - > isPrimary ( ) ) { <nl> / / Do not " reattach " to transient instance . <nl> return Status ( 0 , " OK " ) ; <nl> } <nl> Status SQLiteSQLPlugin : : attach ( const std : : string & name ) { <nl> } <nl> <nl> auto statement = columnDefinition ( response ) ; <nl> - return attachTableInternal ( name , statement , dbc . db ( ) ) ; <nl> + return attachTableInternal ( name , statement , dbc - > db ( ) ) ; <nl> } <nl> <nl> void SQLiteSQLPlugin : : detach ( const std : : string & name ) { <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - if ( ! dbc . isPrimary ( ) ) { <nl> + if ( ! dbc - > isPrimary ( ) ) { <nl> return ; <nl> } <nl> - detachTableInternal ( name , dbc . db ( ) ) ; <nl> + detachTableInternal ( name , dbc - > db ( ) ) ; <nl> } <nl> <nl> SQLiteDBInstance : : SQLiteDBInstance ( ) { <nl> SQLiteDBInstance : : SQLiteDBInstance ( ) { <nl> attachVirtualTables ( db_ ) ; <nl> } <nl> <nl> - SQLiteDBInstance : : SQLiteDBInstance ( sqlite3 * & db ) { <nl> - primary_ = true ; <nl> - db_ = db ; <nl> + SQLiteDBInstance : : SQLiteDBInstance ( sqlite3 * & db , std : : mutex & mtx ) <nl> + : db_ ( db ) , lock_ ( mtx , std : : try_to_lock ) { <nl> + if ( lock_ . owns_lock ( ) ) { <nl> + primary_ = true ; <nl> + } else { <nl> + db_ = nullptr ; <nl> + VLOG ( 1 ) < < " DBManager contention : opening transient SQLite database " ; <nl> + SQLiteDBInstance ( ) ; <nl> + } <nl> } <nl> <nl> SQLiteDBInstance : : ~ SQLiteDBInstance ( ) { <nl> if ( ! primary_ ) { <nl> sqlite3_close ( db_ ) ; <nl> } else { <nl> - SQLiteDBManager : : unlock ( ) ; <nl> db_ = nullptr ; <nl> } <nl> } <nl> <nl> - void SQLiteDBManager : : unlock ( ) { instance ( ) . lock_ . unlock ( ) ; } <nl> - <nl> bool SQLiteDBManager : : isDisabled ( const std : : string & table_name ) { <nl> const auto & element = instance ( ) . disabled_tables_ . find ( table_name ) ; <nl> return ( element ! = instance ( ) . disabled_tables_ . end ( ) ) ; <nl> std : : unordered_set < std : : string > SQLiteDBManager : : parseDisableTablesFlag ( <nl> return std : : unordered_set < std : : string > ( tables . begin ( ) , tables . end ( ) ) ; <nl> } <nl> <nl> - SQLiteDBInstance SQLiteDBManager : : getUnique ( ) { return SQLiteDBInstance ( ) ; } <nl> + SQLiteDBInstanceRef SQLiteDBManager : : getUnique ( ) { <nl> + return std : : make_shared < SQLiteDBInstance > ( ) ; <nl> + } <nl> <nl> - SQLiteDBInstance SQLiteDBManager : : get ( ) { <nl> + SQLiteDBInstanceRef SQLiteDBManager : : get ( ) { <nl> auto & self = instance ( ) ; <nl> + std : : unique_lock < std : : mutex > lock ( self . create_mutex_ ) ; <nl> <nl> - if ( ! self . lock_ . owns_lock ( ) & & self . lock_ . try_lock ( ) ) { <nl> - if ( self . db_ = = nullptr ) { <nl> - / / Create primary SQLite DB instance . <nl> - sqlite3_open ( " : memory : " , & self . db_ ) ; <nl> - attachVirtualTables ( self . db_ ) ; <nl> - } <nl> - return SQLiteDBInstance ( self . db_ ) ; <nl> - } else { <nl> - / / If this thread or another has the lock , return a transient db . <nl> - VLOG ( 1 ) < < " DBManager contention : opening transient SQLite database " ; <nl> - return SQLiteDBInstance ( ) ; <nl> + if ( self . db_ = = nullptr ) { <nl> + / / Create primary SQLite DB instance . <nl> + sqlite3_open ( " : memory : " , & self . db_ ) ; <nl> + attachVirtualTables ( self . db_ ) ; <nl> } <nl> + <nl> + return std : : make_shared < SQLiteDBInstance > ( self . db_ , self . mutex_ ) ; <nl> } <nl> <nl> SQLiteDBManager : : ~ SQLiteDBManager ( ) { <nl> Status getQueryColumnsInternal ( const std : : string & q , <nl> TableColumns & columns , <nl> sqlite3 * db ) { <nl> / / Turn the query into a prepared statement <nl> - sqlite3_stmt * stmt { nullptr } ; <nl> + sqlite3_stmt * stmt { nullptr } ; <nl> auto rc = sqlite3_prepare_v2 ( db , q . c_str ( ) , q . length ( ) + 1 , & stmt , nullptr ) ; <nl> if ( rc ! = SQLITE_OK | | stmt = = nullptr ) { <nl> if ( stmt ! = nullptr ) { <nl> mmm a / osquery / sql / sqlite_util . h <nl> ppp b / osquery / sql / sqlite_util . h <nl> <nl> <nl> # pragma once <nl> <nl> + # include < atomic > <nl> # include < map > <nl> # include < mutex > <nl> # include < unordered_set > <nl> <nl> # include < sqlite3 . h > <nl> <nl> - # include < boost / thread / mutex . hpp > <nl> # include < boost / noncopyable . hpp > <nl> <nl> # include < osquery / sql . h > <nl> namespace osquery { <nl> * abstraction layer ) , then the SQLiteDBManager will provide a transient <nl> * SQLiteDBInstance . <nl> * / <nl> - class SQLiteDBInstance { <nl> + class SQLiteDBInstance : private boost : : noncopyable { <nl> public : <nl> SQLiteDBInstance ( ) ; <nl> - explicit SQLiteDBInstance ( sqlite3 * & db ) ; <nl> + SQLiteDBInstance ( sqlite3 * & db , std : : mutex & mtx ) ; <nl> ~ SQLiteDBInstance ( ) ; <nl> <nl> / / / Check if the instance is the osquery primary . <nl> - bool isPrimary ( ) { return primary_ ; } <nl> + bool isPrimary ( ) const { return primary_ ; } <nl> <nl> / * * <nl> * @ brief Accessor to the internal ` sqlite3 ` object , do not store references <nl> * to the object within osquery code . <nl> * / <nl> - sqlite3 * db ( ) { return db_ ; } <nl> + sqlite3 * db ( ) const { return db_ ; } <nl> <nl> private : <nl> - bool primary_ ; <nl> - sqlite3 * db_ ; <nl> + / / / Introspection into the database pointer , primary means managed . <nl> + bool primary_ { false } ; <nl> + <nl> + / / / Either the managed primary database or an ephemeral instance . <nl> + sqlite3 * db_ { nullptr } ; <nl> + <nl> + / / / An attempted unique lock on the manager ' s primary database access mutex . <nl> + std : : unique_lock < std : : mutex > lock_ ; <nl> } ; <nl> <nl> / * * <nl> class SQLiteDBManager : private boost : : noncopyable { <nl> * <nl> * @ return a SQLiteDBInstance with all virtual tables attached . <nl> * / <nl> - static SQLiteDBInstance get ( ) ; <nl> + static std : : shared_ptr < SQLiteDBInstance > get ( ) ; <nl> <nl> / / / See ` get ` but always return a transient DB connection ( for testing ) . <nl> - static SQLiteDBInstance getUnique ( ) ; <nl> + static std : : shared_ptr < SQLiteDBInstance > getUnique ( ) ; <nl> <nl> / * * <nl> * @ brief Check if ` table_name ` is disabled . <nl> class SQLiteDBManager : private boost : : noncopyable { <nl> static void unlock ( ) ; <nl> <nl> protected : <nl> - SQLiteDBManager ( ) : db_ ( nullptr ) , lock_ ( mutex_ , boost : : defer_lock ) { <nl> + SQLiteDBManager ( ) : db_ ( nullptr ) { <nl> sqlite3_soft_heap_limit64 ( SQLITE_SOFT_HEAP_LIMIT ) ; <nl> disabled_tables_ = parseDisableTablesFlag ( Flag : : getValue ( " disable_tables " ) ) ; <nl> } <nl> class SQLiteDBManager : private boost : : noncopyable { <nl> <nl> private : <nl> / / / Primary ( managed ) sqlite3 database . <nl> - sqlite3 * db_ ; <nl> - / / / Mutex and lock around sqlite3 access . <nl> - boost : : mutex mutex_ ; <nl> + sqlite3 * db_ { nullptr } ; <nl> + <nl> / / / Mutex and lock around sqlite3 access . <nl> - boost : : unique_lock < boost : : mutex > lock_ ; <nl> + std : : mutex mutex_ ; <nl> + <nl> + / / / A write mutex for initializing the primary database . <nl> + std : : mutex create_mutex_ ; <nl> + <nl> / / / Member variable to hold set of disabled tables . <nl> std : : unordered_set < std : : string > disabled_tables_ ; <nl> + <nl> / / / Parse a comma - delimited set of tables names , passed in as a flag . <nl> std : : unordered_set < std : : string > parseDisableTablesFlag ( const std : : string & s ) ; <nl> } ; <nl> class SQLiteDBManager : private boost : : noncopyable { <nl> * and requires string tokenization and lexical casting . Only run a planner <nl> * once per new query and only when needed ( aka an unusable expression ) . <nl> * / <nl> - class QueryPlanner { <nl> + class QueryPlanner : private boost : : noncopyable { <nl> public : <nl> explicit QueryPlanner ( const std : : string & query ) <nl> - : QueryPlanner ( query , SQLiteDBManager : : get ( ) . db ( ) ) { } <nl> + : QueryPlanner ( query , SQLiteDBManager : : get ( ) - > db ( ) ) { } <nl> QueryPlanner ( const std : : string & query , sqlite3 * db ) ; <nl> ~ QueryPlanner ( ) { } <nl> <nl> class SQLiteSQLPlugin : SQLPlugin { <nl> public : <nl> Status query ( const std : : string & q , QueryData & results ) const { <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - return queryInternal ( q , results , dbc . db ( ) ) ; <nl> + return queryInternal ( q , results , dbc - > db ( ) ) ; <nl> } <nl> <nl> Status getQueryColumns ( const std : : string & q , TableColumns & columns ) const { <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - return getQueryColumnsInternal ( q , columns , dbc . db ( ) ) ; <nl> + return getQueryColumnsInternal ( q , columns , dbc - > db ( ) ) ; <nl> } <nl> <nl> / / / Create a SQLite module and attach ( CREATE ) . <nl> class SQLInternal : public SQL { <nl> * / <nl> explicit SQLInternal ( const std : : string & q ) { <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> - status_ = queryInternal ( q , results_ , dbc . db ( ) ) ; <nl> + status_ = queryInternal ( q , results_ , dbc - > db ( ) ) ; <nl> } <nl> } ; <nl> <nl> mmm a / osquery / sql / tests / sqlite_util_tests . cpp <nl> ppp b / osquery / sql / tests / sqlite_util_tests . cpp <nl> namespace osquery { <nl> <nl> class SQLiteUtilTests : public testing : : Test { } ; <nl> <nl> - SQLiteDBInstance getTestDBC ( ) { <nl> - SQLiteDBInstance dbc = SQLiteDBManager : : getUnique ( ) ; <nl> + std : : shared_ptr < SQLiteDBInstance > getTestDBC ( ) { <nl> + auto dbc = SQLiteDBManager : : getUnique ( ) ; <nl> char * err = nullptr ; <nl> std : : vector < std : : string > queries = { <nl> " CREATE TABLE test_table ( username varchar ( 30 ) primary key , age int ) " , <nl> SQLiteDBInstance getTestDBC ( ) { <nl> " INSERT INTO test_table VALUES ( \ " matt \ " , 24 ) " } ; <nl> <nl> for ( auto q : queries ) { <nl> - sqlite3_exec ( dbc . db ( ) , q . c_str ( ) , nullptr , nullptr , & err ) ; <nl> + sqlite3_exec ( dbc - > db ( ) , q . c_str ( ) , nullptr , nullptr , & err ) ; <nl> if ( err ! = nullptr ) { <nl> throw std : : domain_error ( std : : string ( " Cannot create testing DBC ' s db : " ) + <nl> err ) ; <nl> TEST_F ( SQLiteUtilTests , test_simple_query_execution ) { <nl> TEST_F ( SQLiteUtilTests , test_sqlite_instance_manager ) { <nl> auto dbc1 = SQLiteDBManager : : get ( ) ; <nl> auto dbc2 = SQLiteDBManager : : get ( ) ; <nl> - EXPECT_NE ( dbc1 . db ( ) , dbc2 . db ( ) ) ; <nl> - EXPECT_EQ ( dbc1 . db ( ) , dbc1 . db ( ) ) ; <nl> + EXPECT_NE ( dbc1 - > db ( ) , dbc2 - > db ( ) ) ; <nl> + EXPECT_EQ ( dbc1 - > db ( ) , dbc1 - > db ( ) ) ; <nl> } <nl> <nl> TEST_F ( SQLiteUtilTests , test_sqlite_instance ) { <nl> / / Don ' t do this at home kids . <nl> / / Keep a copy of the internal DB and let the SQLiteDBInstance go oos . <nl> - auto internal_db = SQLiteDBManager : : get ( ) . db ( ) ; <nl> + auto internal_db = SQLiteDBManager : : get ( ) - > db ( ) ; <nl> / / Compare the internal DB to another request with no SQLiteDBInstances <nl> / / in scope , meaning the primary will be returned . <nl> - EXPECT_EQ ( internal_db , SQLiteDBManager : : get ( ) . db ( ) ) ; <nl> + EXPECT_EQ ( internal_db , SQLiteDBManager : : get ( ) - > db ( ) ) ; <nl> } <nl> <nl> TEST_F ( SQLiteUtilTests , test_direct_query_execution ) { <nl> auto dbc = getTestDBC ( ) ; <nl> QueryData results ; <nl> - auto status = queryInternal ( kTestQuery , results , dbc . db ( ) ) ; <nl> + auto status = queryInternal ( kTestQuery , results , dbc - > db ( ) ) ; <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> EXPECT_EQ ( results , getTestDBExpectedResults ( ) ) ; <nl> } <nl> TEST_F ( SQLiteUtilTests , test_direct_query_execution ) { <nl> TEST_F ( SQLiteUtilTests , test_passing_callback_no_data_param ) { <nl> char * err = nullptr ; <nl> auto dbc = getTestDBC ( ) ; <nl> - sqlite3_exec ( dbc . db ( ) , kTestQuery . c_str ( ) , queryDataCallback , nullptr , & err ) ; <nl> + sqlite3_exec ( dbc - > db ( ) , kTestQuery . c_str ( ) , queryDataCallback , nullptr , & err ) ; <nl> EXPECT_TRUE ( err ! = nullptr ) ; <nl> if ( err ! = nullptr ) { <nl> sqlite3_free ( err ) ; <nl> TEST_F ( SQLiteUtilTests , test_passing_callback_no_data_param ) { <nl> TEST_F ( SQLiteUtilTests , test_aggregate_query ) { <nl> auto dbc = getTestDBC ( ) ; <nl> QueryData results ; <nl> - auto status = queryInternal ( kTestQuery , results , dbc . db ( ) ) ; <nl> + auto status = queryInternal ( kTestQuery , results , dbc - > db ( ) ) ; <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> EXPECT_EQ ( results , getTestDBExpectedResults ( ) ) ; <nl> } <nl> TEST_F ( SQLiteUtilTests , test_get_test_db_result_stream ) { <nl> auto results = getTestDBResultStream ( ) ; <nl> for ( auto r : results ) { <nl> char * err_char = nullptr ; <nl> - sqlite3_exec ( dbc . db ( ) , ( r . first ) . c_str ( ) , nullptr , nullptr , & err_char ) ; <nl> + sqlite3_exec ( dbc - > db ( ) , ( r . first ) . c_str ( ) , nullptr , nullptr , & err_char ) ; <nl> EXPECT_TRUE ( err_char = = nullptr ) ; <nl> if ( err_char ! = nullptr ) { <nl> sqlite3_free ( err_char ) ; <nl> TEST_F ( SQLiteUtilTests , test_get_test_db_result_stream ) { <nl> } <nl> <nl> QueryData expected ; <nl> - auto status = queryInternal ( kTestQuery , expected , dbc . db ( ) ) ; <nl> + auto status = queryInternal ( kTestQuery , expected , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( expected , r . second ) ; <nl> } <nl> } <nl> TEST_F ( SQLiteUtilTests , test_get_query_columns ) { <nl> TableColumns results ; <nl> <nl> std : : string query = " SELECT seconds , version FROM time JOIN osquery_info " ; <nl> - auto status = getQueryColumnsInternal ( query , results , dbc . db ( ) ) ; <nl> + auto status = getQueryColumnsInternal ( query , results , dbc - > db ( ) ) ; <nl> ASSERT_TRUE ( status . ok ( ) ) ; <nl> ASSERT_EQ ( 2U , results . size ( ) ) ; <nl> EXPECT_EQ ( std : : make_pair ( std : : string ( " seconds " ) , INTEGER_TYPE ) , results [ 0 ] ) ; <nl> EXPECT_EQ ( std : : make_pair ( std : : string ( " version " ) , TEXT_TYPE ) , results [ 1 ] ) ; <nl> <nl> query = " SELECT * FROM foo " ; <nl> - status = getQueryColumnsInternal ( query , results , dbc . db ( ) ) ; <nl> + status = getQueryColumnsInternal ( query , results , dbc - > db ( ) ) ; <nl> ASSERT_FALSE ( status . ok ( ) ) ; <nl> } <nl> <nl> TEST_F ( SQLiteUtilTests , test_query_planner ) { <nl> TableColumns columns ; <nl> <nl> std : : string query = " select path , path from file " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { TEXT_TYPE , TEXT_TYPE } ) ) ; <nl> <nl> query = " select path , seconds from file , time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { TEXT_TYPE , INTEGER_TYPE } ) ) ; <nl> <nl> query = " select path | | path from file " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { TEXT_TYPE } ) ) ; <nl> <nl> query = " select seconds , path | | path from file , time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { INTEGER_TYPE , TEXT_TYPE } ) ) ; <nl> <nl> query = " select seconds , seconds from time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { INTEGER_TYPE , INTEGER_TYPE } ) ) ; <nl> <nl> query = " select count ( * ) from time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { BIGINT_TYPE } ) ) ; <nl> <nl> query = " select count ( * ) , count ( seconds ) , seconds from time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , <nl> TypeList ( { BIGINT_TYPE , BIGINT_TYPE , INTEGER_TYPE } ) ) ; <nl> <nl> query = " select 1 , ' path ' , path from file " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { INTEGER_TYPE , TEXT_TYPE , TEXT_TYPE } ) ) ; <nl> <nl> query = " select weekday , day , count ( * ) , seconds from time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , <nl> TypeList ( { TEXT_TYPE , INTEGER_TYPE , BIGINT_TYPE , INTEGER_TYPE } ) ) ; <nl> <nl> query = " select seconds + 1 from time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { BIGINT_TYPE } ) ) ; <nl> <nl> query = " select seconds * seconds from time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { BIGINT_TYPE } ) ) ; <nl> <nl> query = " select seconds > 1 , seconds , count ( seconds ) from time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , <nl> TypeList ( { INTEGER_TYPE , INTEGER_TYPE , BIGINT_TYPE } ) ) ; <nl> <nl> query = <nl> " select f1 . * , seconds , f2 . directory from ( select path | | path from file ) " <nl> " f1 , file as f2 , time " ; <nl> - getQueryColumnsInternal ( query , columns , dbc . db ( ) ) ; <nl> + getQueryColumnsInternal ( query , columns , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( getTypes ( columns ) , TypeList ( { TEXT_TYPE , INTEGER_TYPE , TEXT_TYPE } ) ) ; <nl> } <nl> } <nl> mmm a / osquery / sql / tests / virtual_table_tests . cpp <nl> ppp b / osquery / sql / tests / virtual_table_tests . cpp <nl> TEST_F ( VirtualTableTests , test_sqlite3_attach_vtable ) { <nl> auto dbc = SQLiteDBManager : : get ( ) ; <nl> <nl> / / Virtual tables require the registry / plugin API to query tables . <nl> - auto status = attachTableInternal ( " failed_sample " , " ( foo INTEGER ) " , dbc . db ( ) ) ; <nl> + auto status = <nl> + attachTableInternal ( " failed_sample " , " ( foo INTEGER ) " , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( status . getCode ( ) , SQLITE_ERROR ) ; <nl> <nl> / / The table attach will complete only when the table name is registered . <nl> TEST_F ( VirtualTableTests , test_sqlite3_attach_vtable ) { <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> <nl> / / Use the table name , plugin - generated schema to attach . <nl> - status = attachTableInternal ( " sample " , columnDefinition ( response ) , dbc . db ( ) ) ; <nl> + status = attachTableInternal ( " sample " , columnDefinition ( response ) , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( status . getCode ( ) , SQLITE_OK ) ; <nl> <nl> std : : string q = " SELECT sql FROM sqlite_temp_master WHERE tbl_name = ' sample ' ; " ; <nl> QueryData results ; <nl> - status = queryInternal ( q , results , dbc . db ( ) ) ; <nl> + status = queryInternal ( q , results , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( <nl> " CREATE VIRTUAL TABLE sample USING sample ( ` foo ` INTEGER , ` bar ` TEXT ) " , <nl> results [ 0 ] [ " sql " ] ) ; <nl> TEST_F ( VirtualTableTests , test_sqlite3_table_joins ) { <nl> / / Run a query with a join within . <nl> std : : string statement = <nl> " SELECT p . pid FROM osquery_info oi , processes p WHERE oi . pid = p . pid " ; <nl> - auto status = queryInternal ( statement , results , dbc . db ( ) ) ; <nl> + auto status = queryInternal ( statement , results , dbc - > db ( ) ) ; <nl> EXPECT_TRUE ( status . ok ( ) ) ; <nl> EXPECT_EQ ( results . size ( ) , 1U ) ; <nl> } <nl> TEST_F ( VirtualTableTests , test_constraints_stacking ) { <nl> { <nl> / / To simplify the attach , just access the column definition directly . <nl> auto p = std : : make_shared < pTablePlugin > ( ) ; <nl> - attachTableInternal ( " p " , p - > columnDefinition ( ) , dbc . db ( ) ) ; <nl> + attachTableInternal ( " p " , p - > columnDefinition ( ) , dbc - > db ( ) ) ; <nl> auto k = std : : make_shared < kTablePlugin > ( ) ; <nl> - attachTableInternal ( " k " , k - > columnDefinition ( ) , dbc . db ( ) ) ; <nl> + attachTableInternal ( " k " , k - > columnDefinition ( ) , dbc - > db ( ) ) ; <nl> } <nl> <nl> QueryData results ; <nl> TEST_F ( VirtualTableTests , test_constraints_stacking ) { <nl> <nl> for ( const auto & test : constraint_tests ) { <nl> QueryData results ; <nl> - queryInternal ( test . first , results , dbc . db ( ) ) ; <nl> + queryInternal ( test . first , results , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( results , test . second ) ; <nl> } <nl> <nl> TEST_F ( VirtualTableTests , test_constraints_stacking ) { <nl> size_t index = 0 ; <nl> for ( const auto & test : constraint_tests ) { <nl> QueryData results ; <nl> - queryInternal ( test . first + " union " + test . first , results , dbc . db ( ) ) ; <nl> + queryInternal ( test . first + " union " + test . first , results , dbc - > db ( ) ) ; <nl> EXPECT_EQ ( results , union_results [ index + + ] ) ; <nl> } <nl> } <nl> mmm a / tools / tests / sanitize_blacklist . txt <nl> ppp b / tools / tests / sanitize_blacklist . txt <nl> src : * asio / impl / * <nl> # GFlags <nl> fun : * SetArgv * <nl> <nl> + # GLog <nl> + # This is a confirmed race , but deemed low pri <nl> + fun : * RawLog__SetLastTime * <nl> + <nl> + # Thrift <nl> + fun : * TServerSocket * <nl> + src : * thrift / transport / TServerSocket . cpp <nl> + <nl> # RocksDB <nl> - fun : * ColumnFamilyOptions * <nl> \ No newline at end of file <nl> + fun : * ColumnFamilyOptions * <nl> mmm a / tools / tests / test_base . py <nl> ppp b / tools / tests / test_base . py <nl> def __init__ ( self , cmd = [ ] , timeout_sec = 1 ) : <nl> self . stdout , self . stderr = self . proc . communicate ( ) <nl> timer . cancel ( ) <nl> <nl> + <nl> def flaky ( gen ) : <nl> exceptions = [ ] <nl> def attempt ( this ) : <nl> def wrapper ( this ) : <nl> raise exceptions [ 0 ] [ 0 ] <nl> return wrapper <nl> <nl> + <nl> class Tester ( object ) : <nl> <nl> def __init__ ( self ) : <nl> mmm a / tools / tests / test_osqueryi . py <nl> ppp b / tools / tests / test_osqueryi . py <nl> def test_config_check_failure ( self ) : <nl> SHELL_TIMEOUT ) <nl> self . assertNotEqual ( proc . stderr , " " ) <nl> self . assertNotEqual ( proc . proc . poll ( ) , 0 ) <nl> + # Also do not accept a SIGSEG <nl> + # It should exit EX_CONFIG = 78 <nl> + self . assertEqual ( proc . proc . poll ( ) , 78 ) <nl> <nl> @ test_base . flaky <nl> def test_config_check_example ( self ) : <nl>
Merge pull request from theopolis / dispatcher_refactor
osquery/osquery
1deee80bf2b3109de076bf0b0c74931cefe61d30
2016-02-05T23:17:05Z
mmm a / api / envoy / api / v2 / core / config_source . proto <nl> ppp b / api / envoy / api / v2 / core / config_source . proto <nl> message RateLimitSettings { <nl> / / < arch_overview_service_discovery > ` etc . may either be sourced from the <nl> / / filesystem or from an xDS API source . Filesystem configs are watched with <nl> / / inotify for updates . <nl> - / / [ # next - free - field : 6 ] <nl> + / / [ # next - free - field : 7 ] <nl> message ConfigSource { <nl> + enum XdsApiVersion { <nl> + / / use for describing explicitly that xDS API version is set automatically . In default , xDS API <nl> + / / version is V2 <nl> + AUTO = 0 ; <nl> + <nl> + / / use xDS v2 API <nl> + V2 = 1 ; <nl> + <nl> + / / use xDS v3alpha API <nl> + V3ALPHA = 2 ; <nl> + } <nl> + <nl> oneof config_source_specifier { <nl> option ( validate . required ) = true ; <nl> <nl> message ConfigSource { <nl> / / means no timeout - Envoy will wait indefinitely for the first xDS config ( unless another <nl> / / timeout applies ) . The default is 15s . <nl> google . protobuf . Duration initial_fetch_timeout = 4 ; <nl> + <nl> + / / API version for xDS endpoint <nl> + XdsApiVersion xds_api_version = 6 ; <nl> } <nl> mmm a / api / envoy / api / v3alpha / core / config_source . proto <nl> ppp b / api / envoy / api / v3alpha / core / config_source . proto <nl> message RateLimitSettings { <nl> / / < arch_overview_service_discovery > ` etc . may either be sourced from the <nl> / / filesystem or from an xDS API source . Filesystem configs are watched with <nl> / / inotify for updates . <nl> - / / [ # next - free - field : 6 ] <nl> + / / [ # next - free - field : 7 ] <nl> message ConfigSource { <nl> option ( udpa . annotations . versioning ) . previous_message_type = " envoy . api . v2 . core . ConfigSource " ; <nl> <nl> + enum XdsApiVersion { <nl> + / / use for describing explicitly that xDS API version is set automatically . In default , xDS API <nl> + / / version is V2 <nl> + AUTO = 0 ; <nl> + <nl> + / / use xDS v2 API <nl> + V2 = 1 ; <nl> + <nl> + / / use xDS v3alpha API <nl> + V3ALPHA = 2 ; <nl> + } <nl> + <nl> oneof config_source_specifier { <nl> option ( validate . required ) = true ; <nl> <nl> message ConfigSource { <nl> / / means no timeout - Envoy will wait indefinitely for the first xDS config ( unless another <nl> / / timeout applies ) . The default is 15s . <nl> google . protobuf . Duration initial_fetch_timeout = 4 ; <nl> + <nl> + / / API version for xDS endpoint <nl> + XdsApiVersion xds_api_version = 6 ; <nl> } <nl> mmm a / generated_api_shadow / envoy / api / v2 / core / config_source . proto <nl> ppp b / generated_api_shadow / envoy / api / v2 / core / config_source . proto <nl> message RateLimitSettings { <nl> / / < arch_overview_service_discovery > ` etc . may either be sourced from the <nl> / / filesystem or from an xDS API source . Filesystem configs are watched with <nl> / / inotify for updates . <nl> - / / [ # next - free - field : 6 ] <nl> + / / [ # next - free - field : 7 ] <nl> message ConfigSource { <nl> + enum XdsApiVersion { <nl> + / / use for describing explicitly that xDS API version is set automatically . In default , xDS API <nl> + / / version is V2 <nl> + AUTO = 0 ; <nl> + <nl> + / / use xDS v2 API <nl> + V2 = 1 ; <nl> + <nl> + / / use xDS v3alpha API <nl> + V3ALPHA = 2 ; <nl> + } <nl> + <nl> oneof config_source_specifier { <nl> option ( validate . required ) = true ; <nl> <nl> message ConfigSource { <nl> / / means no timeout - Envoy will wait indefinitely for the first xDS config ( unless another <nl> / / timeout applies ) . The default is 15s . <nl> google . protobuf . Duration initial_fetch_timeout = 4 ; <nl> + <nl> + / / API version for xDS endpoint <nl> + XdsApiVersion xds_api_version = 6 ; <nl> } <nl> mmm a / generated_api_shadow / envoy / api / v3alpha / core / config_source . proto <nl> ppp b / generated_api_shadow / envoy / api / v3alpha / core / config_source . proto <nl> message RateLimitSettings { <nl> / / < arch_overview_service_discovery > ` etc . may either be sourced from the <nl> / / filesystem or from an xDS API source . Filesystem configs are watched with <nl> / / inotify for updates . <nl> - / / [ # next - free - field : 6 ] <nl> + / / [ # next - free - field : 7 ] <nl> message ConfigSource { <nl> option ( udpa . annotations . versioning ) . previous_message_type = " envoy . api . v2 . core . ConfigSource " ; <nl> <nl> + enum XdsApiVersion { <nl> + / / use for describing explicitly that xDS API version is set automatically . In default , xDS API <nl> + / / version is V2 <nl> + AUTO = 0 ; <nl> + <nl> + / / use xDS v2 API <nl> + V2 = 1 ; <nl> + <nl> + / / use xDS v3alpha API <nl> + V3ALPHA = 2 ; <nl> + } <nl> + <nl> oneof config_source_specifier { <nl> option ( validate . required ) = true ; <nl> <nl> message ConfigSource { <nl> / / means no timeout - Envoy will wait indefinitely for the first xDS config ( unless another <nl> / / timeout applies ) . The default is 15s . <nl> google . protobuf . Duration initial_fetch_timeout = 4 ; <nl> + <nl> + / / API version for xDS endpoint <nl> + XdsApiVersion xds_api_version = 6 ; <nl> } <nl> mmm a / source / common / router / BUILD <nl> ppp b / source / common / router / BUILD <nl> envoy_cc_library ( <nl> " @ envoy_api / / envoy / api / v2 : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 / core : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 / route : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / api / v3alpha / route : pkg_cc_proto " , <nl> ] , <nl> ) <nl> <nl> envoy_cc_library ( <nl> " / / source / common / router : vhds_lib " , <nl> " @ envoy_api / / envoy / admin / v2alpha : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / api / v2 / core : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / api / v3alpha : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / config / filter / network / http_connection_manager / v2 : pkg_cc_proto " , <nl> ] , <nl> ) <nl> envoy_cc_library ( <nl> " @ envoy_api / / envoy / api / v2 : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 / core : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / config / filter / network / http_connection_manager / v2 : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / service / route / v3alpha : pkg_cc_proto " , <nl> ] , <nl> ) <nl> <nl> mmm a / source / common / router / rds_impl . cc <nl> ppp b / source / common / router / rds_impl . cc <nl> <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / rds . pb . h " <nl> # include " envoy / api / v2 / rds . pb . validate . h " <nl> + # include " envoy / api / v3alpha / rds . pb . h " <nl> # include " envoy / config / filter / network / http_connection_manager / v2 / http_connection_manager . pb . h " <nl> <nl> # include " common / common / assert . h " <nl> RdsRouteConfigSubscription : : RdsRouteConfigSubscription ( <nl> const uint64_t manager_identifier , Server : : Configuration : : ServerFactoryContext & factory_context , <nl> ProtobufMessage : : ValidationVisitor & validator , Init : : Manager & init_manager , <nl> const std : : string & stat_prefix , <nl> - Envoy : : Router : : RouteConfigProviderManagerImpl & route_config_provider_manager ) <nl> + Envoy : : Router : : RouteConfigProviderManagerImpl & route_config_provider_manager , <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version ) <nl> : route_config_name_ ( rds . route_config_name ( ) ) , factory_context_ ( factory_context ) , <nl> validator_ ( validator ) , init_manager_ ( init_manager ) , <nl> init_target_ ( fmt : : format ( " RdsRouteConfigSubscription { } " , route_config_name_ ) , <nl> RdsRouteConfigSubscription : : RdsRouteConfigSubscription ( <nl> scope_ ( factory_context . scope ( ) . createScope ( stat_prefix + " rds . " + route_config_name_ + " . " ) ) , <nl> stat_prefix_ ( stat_prefix ) , stats_ ( { ALL_RDS_STATS ( POOL_COUNTER ( * scope_ ) ) } ) , <nl> route_config_provider_manager_ ( route_config_provider_manager ) , <nl> - manager_identifier_ ( manager_identifier ) { <nl> + manager_identifier_ ( manager_identifier ) , xds_api_version_ ( xds_api_version ) { <nl> <nl> subscription_ = <nl> factory_context . clusterManager ( ) . subscriptionFactory ( ) . subscriptionFromConfigSource ( <nl> - rds . config_source ( ) , <nl> - Grpc : : Common : : typeUrl ( <nl> - API_NO_BOOST ( envoy : : api : : v2 : : RouteConfiguration ) ( ) . GetDescriptor ( ) - > full_name ( ) ) , <nl> - * scope_ , * this ) ; <nl> + rds . config_source ( ) , loadTypeUrl ( ) , * scope_ , * this ) ; <nl> config_update_info_ = <nl> std : : make_unique < RouteConfigUpdateReceiverImpl > ( factory_context . timeSource ( ) , validator ) ; <nl> } <nl> void RdsRouteConfigSubscription : : onConfigUpdate ( <nl> / / TODO ( dmitri - d ) : It ' s unsafe to depend directly on factory context here , <nl> / / the listener might have been torn down , need to remove this . <nl> vhds_subscription_ = std : : make_unique < VhdsSubscription > ( <nl> - config_update_info_ , factory_context_ , stat_prefix_ , route_config_providers_ ) ; <nl> + config_update_info_ , factory_context_ , stat_prefix_ , route_config_providers_ , <nl> + config_update_info_ - > routeConfiguration ( ) . vhds ( ) . config_source ( ) . xds_api_version ( ) ) ; <nl> vhds_subscription_ - > registerInitTargetWithInitManager ( <nl> noop_init_manager = = nullptr ? getRdsConfigInitManager ( ) : * noop_init_manager ) ; <nl> } else { <nl> bool RdsRouteConfigSubscription : : validateUpdateSize ( int num_resources ) { <nl> return true ; <nl> } <nl> <nl> + std : : string RdsRouteConfigSubscription : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : RouteConfiguration ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v3alpha : : RouteConfiguration ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> + <nl> RdsRouteConfigProviderImpl : : RdsRouteConfigProviderImpl ( <nl> RdsRouteConfigSubscriptionSharedPtr & & subscription , <nl> Server : : Configuration : : FactoryContext & factory_context ) <nl> Router : : RouteConfigProviderSharedPtr RouteConfigProviderManagerImpl : : createRdsRo <nl> RdsRouteConfigSubscriptionSharedPtr subscription ( new RdsRouteConfigSubscription ( <nl> rds , manager_identifier , factory_context . getServerFactoryContext ( ) , <nl> factory_context . messageValidationVisitor ( ) , factory_context . initManager ( ) , stat_prefix , <nl> - * this ) ) ; <nl> + * this , rds . config_source ( ) . xds_api_version ( ) ) ) ; <nl> init_manager . add ( subscription - > init_target_ ) ; <nl> std : : shared_ptr < RdsRouteConfigProviderImpl > new_provider { <nl> new RdsRouteConfigProviderImpl ( std : : move ( subscription ) , factory_context ) } ; <nl> mmm a / source / common / router / rds_impl . h <nl> ppp b / source / common / router / rds_impl . h <nl> <nl> # include < unordered_set > <nl> <nl> # include " envoy / admin / v2alpha / config_dump . pb . h " <nl> + # include " envoy / api / v2 / core / config_source . pb . h " <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / rds . pb . h " <nl> # include " envoy / config / filter / network / http_connection_manager / v2 / http_connection_manager . pb . h " <nl> class RdsRouteConfigSubscription : Envoy : : Config : : SubscriptionCallbacks , <nl> const uint64_t manager_identifier , <nl> Server : : Configuration : : ServerFactoryContext & factory_context , <nl> ProtobufMessage : : ValidationVisitor & validator , Init : : Manager & init_manager , <nl> - const std : : string & stat_prefix , <nl> - RouteConfigProviderManagerImpl & route_config_provider_manager ) ; <nl> + const std : : string & stat_prefix , RouteConfigProviderManagerImpl & route_config_provider_manager , <nl> + const envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version = <nl> + envoy : : api : : v2 : : core : : ConfigSource : : AUTO ) ; <nl> <nl> bool validateUpdateSize ( int num_resources ) ; <nl> + std : : string loadTypeUrl ( ) ; <nl> <nl> Init : : Manager & getRdsConfigInitManager ( ) { return init_manager_ ; } <nl> <nl> class RdsRouteConfigSubscription : Envoy : : Config : : SubscriptionCallbacks , <nl> VhdsSubscriptionPtr vhds_subscription_ ; <nl> RouteConfigUpdatePtr config_update_info_ ; <nl> Common : : CallbackManager < > update_callback_manager_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> <nl> friend class RouteConfigProviderManagerImpl ; <nl> / / Access to addUpdateCallback <nl> mmm a / source / common / router / scoped_rds . cc <nl> ppp b / source / common / router / scoped_rds . cc <nl> <nl> # include " envoy / api / v2 / srds . pb . h " <nl> # include " envoy / api / v2 / srds . pb . validate . h " <nl> # include " envoy / config / filter / network / http_connection_manager / v2 / http_connection_manager . pb . h " <nl> + # include " envoy / service / route / v3alpha / srds . pb . h " <nl> <nl> # include " common / common / assert . h " <nl> # include " common / common / cleanup . h " <nl> ScopedRdsConfigSubscription : : ScopedRdsConfigSubscription ( <nl> stats_ ( { ALL_SCOPED_RDS_STATS ( POOL_COUNTER ( * scope_ ) ) } ) , <nl> rds_config_source_ ( std : : move ( rds_config_source ) ) , <nl> validation_visitor_ ( factory_context . messageValidationVisitor ( ) ) , stat_prefix_ ( stat_prefix ) , <nl> - route_config_provider_manager_ ( route_config_provider_manager ) { <nl> + route_config_provider_manager_ ( route_config_provider_manager ) , <nl> + xds_api_version_ ( rds_config_source_ . xds_api_version ( ) ) { <nl> subscription_ = <nl> factory_context . clusterManager ( ) . subscriptionFactory ( ) . subscriptionFromConfigSource ( <nl> - scoped_rds . scoped_rds_config_source ( ) , <nl> - Grpc : : Common : : typeUrl ( API_NO_BOOST ( envoy : : api : : v2 : : ScopedRouteConfiguration ) ( ) <nl> - . GetDescriptor ( ) <nl> - - > full_name ( ) ) , <nl> - * scope_ , * this ) ; <nl> + scoped_rds . scoped_rds_config_source ( ) , loadTypeUrl ( ) , * scope_ , * this ) ; <nl> <nl> initialize ( [ scope_key_builder ] ( ) - > Envoy : : Config : : ConfigProvider : : ConfigConstSharedPtr { <nl> return std : : make_shared < ScopedConfigImpl > ( <nl> void ScopedRdsConfigSubscription : : onConfigUpdate ( <nl> onConfigUpdate ( to_add_repeated , to_remove_repeated , version_info ) ; <nl> } <nl> <nl> + std : : string ScopedRdsConfigSubscription : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : ScopedRouteConfiguration ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( API_NO_BOOST ( <nl> + envoy : : service : : route : : v3alpha : : ScopedRouteConfiguration ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> + <nl> ScopedRdsConfigProvider : : ScopedRdsConfigProvider ( <nl> ScopedRdsConfigSubscriptionSharedPtr & & subscription ) <nl> : MutableConfigProviderCommonBase ( std : : move ( subscription ) , ConfigProvider : : ApiType : : Delta ) { } <nl> mmm a / source / common / router / scoped_rds . h <nl> ppp b / source / common / router / scoped_rds . h <nl> class ScopedRdsConfigSubscription : public Envoy : : Config : : DeltaConfigSubscriptio <nl> std : : string resourceName ( const ProtobufWkt : : Any & resource ) override { <nl> return MessageUtil : : anyConvert < envoy : : api : : v2 : : ScopedRouteConfiguration > ( resource ) . name ( ) ; <nl> } <nl> + std : : string loadTypeUrl ( ) ; <nl> / / Propagate RDS updates to ScopeConfigImpl in workers . <nl> void onRdsConfigUpdate ( const std : : string & scope_name , <nl> RdsRouteConfigSubscription & rds_subscription ) ; <nl> class ScopedRdsConfigSubscription : public Envoy : : Config : : DeltaConfigSubscriptio <nl> ProtobufMessage : : ValidationVisitor & validation_visitor_ ; <nl> const std : : string stat_prefix_ ; <nl> RouteConfigProviderManager & route_config_provider_manager_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> } ; <nl> <nl> using ScopedRdsConfigSubscriptionSharedPtr = std : : shared_ptr < ScopedRdsConfigSubscription > ; <nl> mmm a / source / common / router / vhds . cc <nl> ppp b / source / common / router / vhds . cc <nl> <nl> # include " envoy / api / v2 / core / config_source . pb . h " <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / route / route . pb . h " <nl> + # include " envoy / api / v3alpha / route / route . pb . h " <nl> <nl> # include " common / common / assert . h " <nl> # include " common / common / fmt . h " <nl> namespace Envoy { <nl> namespace Router { <nl> <nl> / / Implements callbacks to handle DeltaDiscovery protocol for VirtualHostDiscoveryService <nl> - VhdsSubscription : : VhdsSubscription ( RouteConfigUpdatePtr & config_update_info , <nl> - Server : : Configuration : : ServerFactoryContext & factory_context , <nl> - const std : : string & stat_prefix , <nl> - std : : unordered_set < RouteConfigProvider * > & route_config_providers ) <nl> + VhdsSubscription : : VhdsSubscription ( <nl> + RouteConfigUpdatePtr & config_update_info , <nl> + Server : : Configuration : : ServerFactoryContext & factory_context , const std : : string & stat_prefix , <nl> + std : : unordered_set < RouteConfigProvider * > & route_config_providers , <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version ) <nl> : config_update_info_ ( config_update_info ) , <nl> scope_ ( factory_context . scope ( ) . createScope ( stat_prefix + " vhds . " + <nl> config_update_info_ - > routeConfigName ( ) + " . " ) ) , <nl> stats_ ( { ALL_VHDS_STATS ( POOL_COUNTER ( * scope_ ) ) } ) , <nl> init_target_ ( fmt : : format ( " VhdsConfigSubscription { } " , config_update_info_ - > routeConfigName ( ) ) , <nl> [ this ] ( ) { subscription_ - > start ( { } ) ; } ) , <nl> - route_config_providers_ ( route_config_providers ) { <nl> + route_config_providers_ ( route_config_providers ) , xds_api_version_ ( xds_api_version ) { <nl> const auto & config_source = config_update_info_ - > routeConfiguration ( ) <nl> . vhds ( ) <nl> . config_source ( ) <nl> VhdsSubscription : : VhdsSubscription ( RouteConfigUpdatePtr & config_update_info , <nl> <nl> subscription_ = <nl> factory_context . clusterManager ( ) . subscriptionFactory ( ) . subscriptionFromConfigSource ( <nl> - config_update_info_ - > routeConfiguration ( ) . vhds ( ) . config_source ( ) , <nl> - Grpc : : Common : : typeUrl ( <nl> - API_NO_BOOST ( envoy : : api : : v2 : : route : : VirtualHost ) ( ) . GetDescriptor ( ) - > full_name ( ) ) , <nl> - * scope_ , * this ) ; <nl> + config_update_info_ - > routeConfiguration ( ) . vhds ( ) . config_source ( ) , loadTypeUrl ( ) , * scope_ , <nl> + * this ) ; <nl> } <nl> <nl> void VhdsSubscription : : onConfigUpdateFailed ( Envoy : : Config : : ConfigUpdateFailureReason reason , <nl> void VhdsSubscription : : onConfigUpdate ( <nl> init_target_ . ready ( ) ; <nl> } <nl> <nl> + std : : string VhdsSubscription : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : route : : VirtualHost ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : route : : VirtualHost ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> } / / namespace Router <nl> } / / namespace Envoy <nl> mmm a / source / common / router / vhds . h <nl> ppp b / source / common / router / vhds . h <nl> <nl> # include < unordered_map > <nl> # include < unordered_set > <nl> <nl> + # include " envoy / api / v2 / core / config_source . pb . h " <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / route / route . pb . h " <nl> # include " envoy / config / subscription . h " <nl> class VhdsSubscription : Envoy : : Config : : SubscriptionCallbacks , <nl> VhdsSubscription ( RouteConfigUpdatePtr & config_update_info , <nl> Server : : Configuration : : ServerFactoryContext & factory_context , <nl> const std : : string & stat_prefix , <nl> - std : : unordered_set < RouteConfigProvider * > & route_config_providers ) ; <nl> + std : : unordered_set < RouteConfigProvider * > & route_config_providers , <nl> + const envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version = <nl> + envoy : : api : : v2 : : core : : ConfigSource : : AUTO ) ; <nl> ~ VhdsSubscription ( ) override { init_target_ . ready ( ) ; } <nl> <nl> void registerInitTargetWithInitManager ( Init : : Manager & m ) { m . add ( init_target_ ) ; } <nl> class VhdsSubscription : Envoy : : Config : : SubscriptionCallbacks , <nl> std : : string resourceName ( const ProtobufWkt : : Any & resource ) override { <nl> return MessageUtil : : anyConvert < envoy : : api : : v2 : : route : : VirtualHost > ( resource ) . name ( ) ; <nl> } <nl> + std : : string loadTypeUrl ( ) ; <nl> <nl> RouteConfigUpdatePtr & config_update_info_ ; <nl> Stats : : ScopePtr scope_ ; <nl> class VhdsSubscription : Envoy : : Config : : SubscriptionCallbacks , <nl> std : : unique_ptr < Envoy : : Config : : Subscription > subscription_ ; <nl> Init : : TargetImpl init_target_ ; <nl> std : : unordered_set < RouteConfigProvider * > & route_config_providers_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> } ; <nl> <nl> using VhdsSubscriptionPtr = std : : unique_ptr < VhdsSubscription > ; <nl> mmm a / source / common / runtime / BUILD <nl> ppp b / source / common / runtime / BUILD <nl> envoy_cc_library ( <nl> " @ envoy_api / / envoy / api / v2 / core : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / config / bootstrap / v2 : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / service / discovery / v2 : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / service / discovery / v3alpha : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / type : pkg_cc_proto " , <nl> ] , <nl> ) <nl> mmm a / source / common / runtime / runtime_impl . cc <nl> ppp b / source / common / runtime / runtime_impl . cc <nl> <nl> # include " envoy / event / dispatcher . h " <nl> # include " envoy / service / discovery / v2 / rtds . pb . h " <nl> # include " envoy / service / discovery / v2 / rtds . pb . validate . h " <nl> + # include " envoy / service / discovery / v3alpha / rtds . pb . h " <nl> # include " envoy / thread_local / thread_local . h " <nl> # include " envoy / type / percent . pb . h " <nl> # include " envoy / type / percent . pb . validate . h " <nl> RtdsSubscription : : RtdsSubscription ( <nl> : parent_ ( parent ) , config_source_ ( rtds_layer . rtds_config ( ) ) , store_ ( store ) , <nl> resource_name_ ( rtds_layer . name ( ) ) , <nl> init_target_ ( " RTDS " + resource_name_ , [ this ] ( ) { start ( ) ; } ) , <nl> - validation_visitor_ ( validation_visitor ) { } <nl> + validation_visitor_ ( validation_visitor ) , xds_api_version_ ( config_source_ . xds_api_version ( ) ) { } <nl> <nl> void RtdsSubscription : : onConfigUpdate ( const Protobuf : : RepeatedPtrField < ProtobufWkt : : Any > & resources , <nl> const std : : string & ) { <nl> void RtdsSubscription : : start ( ) { <nl> / / cluster manager resources are not available in the constructor when <nl> / / instantiated in the server instance . <nl> subscription_ = parent_ . cm_ - > subscriptionFactory ( ) . subscriptionFromConfigSource ( <nl> - config_source_ , <nl> - Grpc : : Common : : typeUrl ( <nl> - API_NO_BOOST ( envoy : : service : : discovery : : v2 : : Runtime ) ( ) . GetDescriptor ( ) - > full_name ( ) ) , <nl> - store_ , * this ) ; <nl> + config_source_ , loadTypeUrl ( ) , store_ , * this ) ; <nl> subscription_ - > start ( { resource_name_ } ) ; <nl> } <nl> <nl> void RtdsSubscription : : validateUpdateSize ( uint32_t num_resources ) { <nl> } <nl> } <nl> <nl> + std : : string RtdsSubscription : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : service : : discovery : : v2 : : Runtime ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : service : : discovery : : v3alpha : : Runtime ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> + <nl> void LoaderImpl : : loadNewSnapshot ( ) { <nl> std : : shared_ptr < SnapshotImpl > ptr = createNewSnapshot ( ) ; <nl> tls_ - > set ( [ ptr ] ( Event : : Dispatcher & ) - > ThreadLocal : : ThreadLocalObjectSharedPtr { <nl> mmm a / source / common / runtime / runtime_impl . h <nl> ppp b / source / common / runtime / runtime_impl . h <nl> struct RtdsSubscription : Config : : SubscriptionCallbacks , Logger : : Loggable < Logger <nl> <nl> void start ( ) ; <nl> void validateUpdateSize ( uint32_t num_resources ) ; <nl> + std : : string loadTypeUrl ( ) ; <nl> <nl> LoaderImpl & parent_ ; <nl> const envoy : : api : : v2 : : core : : ConfigSource config_source_ ; <nl> struct RtdsSubscription : Config : : SubscriptionCallbacks , Logger : : Loggable < Logger <nl> Init : : TargetImpl init_target_ ; <nl> ProtobufWkt : : Struct proto_ ; <nl> ProtobufMessage : : ValidationVisitor & validation_visitor_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> } ; <nl> <nl> using RtdsSubscriptionPtr = std : : unique_ptr < RtdsSubscription > ; <nl> mmm a / source / common / secret / sds_api . cc <nl> ppp b / source / common / secret / sds_api . cc <nl> SdsApi : : SdsApi ( envoy : : api : : v2 : : core : : ConfigSource sds_config , absl : : string_view <nl> secret_hash_ ( 0 ) , clean_up_ ( std : : move ( destructor_cb ) ) , validation_visitor_ ( validation_visitor ) , <nl> subscription_factory_ ( subscription_factory ) , <nl> time_source_ ( time_source ) , secret_data_ { sds_config_name_ , " uninitialized " , <nl> - time_source_ . systemTime ( ) } { <nl> + time_source_ . systemTime ( ) } , <nl> + xds_api_version_ ( sds_config_ . xds_api_version ( ) ) { <nl> / / TODO ( JimmyCYJ ) : Implement chained_init_manager , so that multiple init_manager <nl> / / can be chained together to behave as one init_manager . In that way , we let <nl> / / two listeners which share same SdsApi to register at separate init managers , and <nl> void SdsApi : : validateUpdateSize ( int num_resources ) { <nl> } <nl> <nl> void SdsApi : : initialize ( ) { <nl> - subscription_ = subscription_factory_ . subscriptionFromConfigSource ( <nl> - sds_config_ , <nl> - Grpc : : Common : : typeUrl ( <nl> - API_NO_BOOST ( envoy : : api : : v2 : : auth : : Secret ) ( ) . GetDescriptor ( ) - > full_name ( ) ) , <nl> - stats_ , * this ) ; <nl> + subscription_ = <nl> + subscription_factory_ . subscriptionFromConfigSource ( sds_config_ , loadTypeUrl ( ) , stats_ , * this ) ; <nl> subscription_ - > start ( { sds_config_name_ } ) ; <nl> } <nl> <nl> + std : : string SdsApi : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : auth : : Secret ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : auth : : Secret ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> + <nl> SdsApi : : SecretData SdsApi : : secretData ( ) { return secret_data_ ; } <nl> <nl> } / / namespace Secret <nl> mmm a / source / common / secret / sds_api . h <nl> ppp b / source / common / secret / sds_api . h <nl> class SdsApi : public Config : : SubscriptionCallbacks { <nl> std : : string resourceName ( const ProtobufWkt : : Any & resource ) override { <nl> return MessageUtil : : anyConvert < envoy : : api : : v2 : : auth : : Secret > ( resource ) . name ( ) ; <nl> } <nl> + std : : string loadTypeUrl ( ) ; <nl> <nl> private : <nl> void validateUpdateSize ( int num_resources ) ; <nl> class SdsApi : public Config : : SubscriptionCallbacks { <nl> Config : : SubscriptionFactory & subscription_factory_ ; <nl> TimeSource & time_source_ ; <nl> SecretData secret_data_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> } ; <nl> <nl> class TlsCertificateSdsApi ; <nl> mmm a / source / common / upstream / BUILD <nl> ppp b / source / common / upstream / BUILD <nl> envoy_cc_library ( <nl> " / / source / common / protobuf : utility_lib " , <nl> " @ envoy_api / / envoy / api / v2 : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 / core : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / api / v3alpha : pkg_cc_proto " , <nl> ] , <nl> ) <nl> <nl> envoy_cc_library ( <nl> " / / source / extensions / clusters : well_known_names " , <nl> " @ envoy_api / / envoy / api / v2 : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 / core : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / api / v3alpha : pkg_cc_proto " , <nl> ] , <nl> ) <nl> <nl> mmm a / source / common / upstream / cds_api_impl . cc <nl> ppp b / source / common / upstream / cds_api_impl . cc <nl> <nl> # include " envoy / api / v2 / cds . pb . validate . h " <nl> # include " envoy / api / v2 / core / config_source . pb . h " <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> + # include " envoy / api / v3alpha / cds . pb . h " <nl> # include " envoy / stats / scope . h " <nl> <nl> # include " common / common / cleanup . h " <nl> CdsApiPtr CdsApiImpl : : create ( const envoy : : api : : v2 : : core : : ConfigSource & cds_confi <nl> CdsApiImpl : : CdsApiImpl ( const envoy : : api : : v2 : : core : : ConfigSource & cds_config , ClusterManager & cm , <nl> Stats : : Scope & scope , ProtobufMessage : : ValidationVisitor & validation_visitor ) <nl> : cm_ ( cm ) , scope_ ( scope . createScope ( " cluster_manager . cds . " ) ) , <nl> - validation_visitor_ ( validation_visitor ) { <nl> - subscription_ = cm_ . subscriptionFactory ( ) . subscriptionFromConfigSource ( <nl> - cds_config , <nl> - Grpc : : Common : : typeUrl ( API_NO_BOOST ( envoy : : api : : v2 : : Cluster ) ( ) . GetDescriptor ( ) - > full_name ( ) ) , <nl> - * scope_ , * this ) ; <nl> + validation_visitor_ ( validation_visitor ) , xds_api_version_ ( cds_config . xds_api_version ( ) ) { <nl> + subscription_ = cm_ . subscriptionFactory ( ) . subscriptionFromConfigSource ( cds_config , loadTypeUrl ( ) , <nl> + * scope_ , * this ) ; <nl> } <nl> <nl> void CdsApiImpl : : onConfigUpdate ( const Protobuf : : RepeatedPtrField < ProtobufWkt : : Any > & resources , <nl> void CdsApiImpl : : runInitializeCallbackIfAny ( ) { <nl> } <nl> } <nl> <nl> + std : : string CdsApiImpl : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : Cluster ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v3alpha : : Cluster ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> + <nl> } / / namespace Upstream <nl> } / / namespace Envoy <nl> mmm a / source / common / upstream / cds_api_impl . h <nl> ppp b / source / common / upstream / cds_api_impl . h <nl> class CdsApiImpl : public CdsApi , <nl> std : : string resourceName ( const ProtobufWkt : : Any & resource ) override { <nl> return MessageUtil : : anyConvert < envoy : : api : : v2 : : Cluster > ( resource ) . name ( ) ; <nl> } <nl> - <nl> + std : : string loadTypeUrl ( ) ; <nl> CdsApiImpl ( const envoy : : api : : v2 : : core : : ConfigSource & cds_config , ClusterManager & cm , <nl> Stats : : Scope & scope , ProtobufMessage : : ValidationVisitor & validation_visitor ) ; <nl> void runInitializeCallbackIfAny ( ) ; <nl> class CdsApiImpl : public CdsApi , <nl> std : : function < void ( ) > initialize_callback_ ; <nl> Stats : : ScopePtr scope_ ; <nl> ProtobufMessage : : ValidationVisitor & validation_visitor_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> } ; <nl> <nl> } / / namespace Upstream <nl> mmm a / source / common / upstream / eds . cc <nl> ppp b / source / common / upstream / eds . cc <nl> <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / eds . pb . h " <nl> # include " envoy / api / v2 / eds . pb . validate . h " <nl> + # include " envoy / api / v3alpha / cds . pb . h " <nl> + # include " envoy / common / exception . h " <nl> <nl> # include " common / common / utility . h " <nl> # include " common / config / api_version . h " <nl> EdsClusterImpl : : EdsClusterImpl ( <nl> cluster_name_ ( cluster . eds_cluster_config ( ) . service_name ( ) . empty ( ) <nl> ? cluster . name ( ) <nl> : cluster . eds_cluster_config ( ) . service_name ( ) ) , <nl> - validation_visitor_ ( factory_context . messageValidationVisitor ( ) ) { <nl> + validation_visitor_ ( factory_context . messageValidationVisitor ( ) ) , <nl> + xds_api_version_ ( cluster . eds_cluster_config ( ) . eds_config ( ) . xds_api_version ( ) ) { <nl> Event : : Dispatcher & dispatcher = factory_context . dispatcher ( ) ; <nl> assignment_timeout_ = dispatcher . createTimer ( [ this ] ( ) - > void { onAssignmentTimeout ( ) ; } ) ; <nl> const auto & eds_config = cluster . eds_cluster_config ( ) . eds_config ( ) ; <nl> EdsClusterImpl : : EdsClusterImpl ( <nl> } <nl> subscription_ = <nl> factory_context . clusterManager ( ) . subscriptionFactory ( ) . subscriptionFromConfigSource ( <nl> - eds_config , <nl> - Grpc : : Common : : typeUrl ( <nl> - API_NO_BOOST ( envoy : : api : : v2 : : ClusterLoadAssignment ) ( ) . GetDescriptor ( ) - > full_name ( ) ) , <nl> - info_ - > statsScope ( ) , * this ) ; <nl> + eds_config , loadTypeUrl ( ) , info_ - > statsScope ( ) , * this ) ; <nl> } <nl> <nl> void EdsClusterImpl : : startPreInit ( ) { subscription_ - > start ( { cluster_name_ } ) ; } <nl> void EdsClusterImpl : : reloadHealthyHostsHelper ( const HostSharedPtr & host ) { <nl> } <nl> } <nl> <nl> + std : : string EdsClusterImpl : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : ClusterLoadAssignment ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v3alpha : : ClusterLoadAssignment ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> + <nl> bool EdsClusterImpl : : updateHostsPerLocality ( <nl> const uint32_t priority , const uint32_t overprovisioning_factor , const HostVector & new_hosts , <nl> LocalityWeightsMap & locality_weights_map , LocalityWeightsMap & new_locality_weights_map , <nl> mmm a / source / common / upstream / eds . h <nl> ppp b / source / common / upstream / eds . h <nl> <nl> <nl> # include " envoy / api / v2 / cds . pb . h " <nl> # include " envoy / api / v2 / core / base . pb . h " <nl> + # include " envoy / api / v2 / core / config_source . pb . h " <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / eds . pb . h " <nl> # include " envoy / config / subscription . h " <nl> class EdsClusterImpl : public BaseDynamicClusterImpl , Config : : SubscriptionCallba <nl> std : : string resourceName ( const ProtobufWkt : : Any & resource ) override { <nl> return MessageUtil : : anyConvert < envoy : : api : : v2 : : ClusterLoadAssignment > ( resource ) . cluster_name ( ) ; <nl> } <nl> - <nl> + std : : string loadTypeUrl ( ) ; <nl> using LocalityWeightsMap = <nl> std : : unordered_map < envoy : : api : : v2 : : core : : Locality , uint32_t , LocalityHash , LocalityEqualTo > ; <nl> bool updateHostsPerLocality ( const uint32_t priority , const uint32_t overprovisioning_factor , <nl> class EdsClusterImpl : public BaseDynamicClusterImpl , Config : : SubscriptionCallba <nl> Event : : TimerPtr assignment_timeout_ ; <nl> ProtobufMessage : : ValidationVisitor & validation_visitor_ ; <nl> InitializePhase initialize_phase_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> } ; <nl> <nl> class EdsClusterFactory : public ClusterFactoryImplBase { <nl> mmm a / source / server / BUILD <nl> ppp b / source / server / BUILD <nl> envoy_cc_library ( <nl> " @ envoy_api / / envoy / admin / v2alpha : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 : pkg_cc_proto " , <nl> " @ envoy_api / / envoy / api / v2 / core : pkg_cc_proto " , <nl> + " @ envoy_api / / envoy / api / v3alpha : pkg_cc_proto " , <nl> ] , <nl> ) <nl> <nl> mmm a / source / server / lds_api . cc <nl> ppp b / source / server / lds_api . cc <nl> <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / lds . pb . h " <nl> # include " envoy / api / v2 / lds . pb . validate . h " <nl> + # include " envoy / api / v3alpha / lds . pb . h " <nl> # include " envoy / stats / scope . h " <nl> <nl> # include " common / common / cleanup . h " <nl> LdsApiImpl : : LdsApiImpl ( const envoy : : api : : v2 : : core : : ConfigSource & lds_config , <nl> ProtobufMessage : : ValidationVisitor & validation_visitor ) <nl> : listener_manager_ ( lm ) , scope_ ( scope . createScope ( " listener_manager . lds . " ) ) , cm_ ( cm ) , <nl> init_target_ ( " LDS " , [ this ] ( ) { subscription_ - > start ( { } ) ; } ) , <nl> - validation_visitor_ ( validation_visitor ) { <nl> - subscription_ = cm . subscriptionFactory ( ) . subscriptionFromConfigSource ( <nl> - lds_config , <nl> - Grpc : : Common : : typeUrl ( API_NO_BOOST ( envoy : : api : : v2 : : Listener ) ( ) . GetDescriptor ( ) - > full_name ( ) ) , <nl> - * scope_ , * this ) ; <nl> + validation_visitor_ ( validation_visitor ) , xds_api_version_ ( lds_config . xds_api_version ( ) ) { <nl> + subscription_ = cm . subscriptionFactory ( ) . subscriptionFromConfigSource ( lds_config , loadTypeUrl ( ) , <nl> + * scope_ , * this ) ; <nl> init_manager . add ( init_target_ ) ; <nl> } <nl> <nl> void LdsApiImpl : : onConfigUpdateFailed ( Envoy : : Config : : ConfigUpdateFailureReason r <nl> init_target_ . ready ( ) ; <nl> } <nl> <nl> + std : : string LdsApiImpl : : loadTypeUrl ( ) { <nl> + switch ( xds_api_version_ ) { <nl> + / / automatically set api version as V2 <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : AUTO : <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V2 : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v2 : : Listener ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + case envoy : : api : : v2 : : core : : ConfigSource : : V3ALPHA : <nl> + return Grpc : : Common : : typeUrl ( <nl> + API_NO_BOOST ( envoy : : api : : v3alpha : : Listener ( ) . GetDescriptor ( ) - > full_name ( ) ) ) ; <nl> + default : <nl> + throw EnvoyException ( fmt : : format ( " type { } is not supported " , xds_api_version_ ) ) ; <nl> + } <nl> + } <nl> } / / namespace Server <nl> } / / namespace Envoy <nl> mmm a / source / server / lds_api . h <nl> ppp b / source / server / lds_api . h <nl> <nl> # include " envoy / api / v2 / core / config_source . pb . h " <nl> # include " envoy / api / v2 / discovery . pb . h " <nl> # include " envoy / api / v2 / lds . pb . h " <nl> + # include " envoy / api / v3alpha / lds . pb . h " <nl> # include " envoy / config / subscription . h " <nl> # include " envoy / config / subscription_factory . h " <nl> # include " envoy / init / manager . h " <nl> class LdsApiImpl : public LdsApi , <nl> std : : string resourceName ( const ProtobufWkt : : Any & resource ) override { <nl> return MessageUtil : : anyConvert < envoy : : api : : v2 : : Listener > ( resource ) . name ( ) ; <nl> } <nl> + std : : string loadTypeUrl ( ) ; <nl> <nl> std : : unique_ptr < Config : : Subscription > subscription_ ; <nl> std : : string system_version_info_ ; <nl> class LdsApiImpl : public LdsApi , <nl> Upstream : : ClusterManager & cm_ ; <nl> Init : : TargetImpl init_target_ ; <nl> ProtobufMessage : : ValidationVisitor & validation_visitor_ ; <nl> + envoy : : api : : v2 : : core : : ConfigSource : : XdsApiVersion xds_api_version_ ; <nl> } ; <nl> <nl> } / / namespace Server <nl> mmm a / tools / spelling_dictionary . txt <nl> ppp b / tools / spelling_dictionary . txt <nl> idx <nl> ie <nl> ifdef <nl> iff <nl> + ified <nl> impl <nl> implementors <nl> impls <nl> refetch <nl> regex <nl> regexes <nl> reimplements <nl> + rele <nl> releasor <nl> reloadable <nl> reparse <nl> strerr <nl> strerror <nl> stringbuf <nl> stringified <nl> + stringify <nl> stringstream <nl> strtoull <nl> struct <nl>
api : xDS API version specifier ( )
envoyproxy/envoy
e3717b54b8d91d1862b096f73efbe96086862183
2019-12-30T18:43:36Z
mmm a / src / Core / NamesAndTypes . cpp <nl> ppp b / src / Core / NamesAndTypes . cpp <nl> NamesAndTypesList NamesAndTypesList : : filter ( const Names & names ) const <nl> <nl> NamesAndTypesList NamesAndTypesList : : addTypes ( const Names & names ) const <nl> { <nl> - std : : unordered_map < String , const NameAndTypePair * > self_columns ; <nl> + std : : unordered_map < std : : string_view , const NameAndTypePair * > self_columns ; <nl> <nl> for ( const auto & column : * this ) <nl> self_columns [ column . name ] = & column ; <nl> mmm a / src / Core / NamesAndTypes . h <nl> ppp b / src / Core / NamesAndTypes . h <nl> struct NameAndTypePair <nl> { <nl> public : <nl> NameAndTypePair ( ) = default ; <nl> - NameAndTypePair ( const String & name_ , const DataTypePtr & type_ ) : name ( name_ ) , type ( type_ ) { } <nl> + NameAndTypePair ( const String & name_ , const DataTypePtr & type_ ) : name ( name_ ) , type ( type_ ) , storage_type ( type_ ) { } <nl> NameAndTypePair ( const String & name_ , const String & subcolumn_name_ , <nl> const DataTypePtr & storage_type_ , const DataTypePtr & type_ ) ; <nl> <nl> mmm a / src / DataTypes / DataTypeArray . cpp <nl> ppp b / src / DataTypes / DataTypeArray . cpp <nl> namespace <nl> offset_values . resize ( i ) ; <nl> } <nl> <nl> - MutableColumnPtr getArraySizesPositionIndependent ( ColumnArray & column_array ) <nl> + MutableColumnPtr getArraySizesPositionIndependent ( const ColumnArray & column_array ) <nl> { <nl> - ColumnArray : : Offsets & offset_values = column_array . getOffsets ( ) ; <nl> + const auto & offset_values = column_array . getOffsets ( ) ; <nl> MutableColumnPtr new_offsets = column_array . getOffsetsColumn ( ) . cloneEmpty ( ) ; <nl> <nl> if ( offset_values . empty ( ) ) <nl> mmm a / src / DataTypes / IDataType . cpp <nl> ppp b / src / DataTypes / IDataType . cpp <nl> String IDataType : : getFileNameForStream ( const NameAndTypePair & column , const IDa <nl> else if ( elem . type = = Substream : : ArraySizes ) <nl> { <nl> size_t nested_level = column . type - > getNestedLevel ( ) ; <nl> - <nl> for ( size_t i = 0 ; i < nested_level - current_nested_level ; + + i ) <nl> { <nl> if ( subcolumn_parts . empty ( ) ) <nl> String IDataType : : getFileNameForStream ( const NameAndTypePair & column , const IDa <nl> return getNameForSubstreamPath ( std : : move ( stream_name ) , path , " % 2E " ) ; <nl> } <nl> <nl> - String IDataType : : getFileNameForStream ( const String & column_name , const IDataType : : SubstreamPath & path ) <nl> - { <nl> - / / / Sizes of arrays ( elements of Nested type ) are shared ( all reside in single file ) . <nl> - String nested_table_name = Nested : : extractTableName ( column_name ) ; <nl> - <nl> - bool is_sizes_of_nested_type = <nl> - path . size ( ) = = 1 / / / Nested structure may have arrays as nested elements ( so effectively we have multidimensional arrays ) . <nl> - / / / Sizes of arrays are shared only at first level . <nl> - & & path [ 0 ] . type = = IDataType : : Substream : : ArraySizes <nl> - & & nested_table_name ! = column_name ; <nl> - <nl> - auto stream_name = escapeForFileName ( is_sizes_of_nested_type ? nested_table_name : column_name ) ; <nl> - <nl> - / / / For compatibility reasons , we use % 2E instead of dot . <nl> - / / / Because nested data may be represented not by Array of Tuple , <nl> - / / / but by separate Array columns with names in a form of a . b , <nl> - / / / and name is encoded as a whole . <nl> - return getNameForSubstreamPath ( std : : move ( stream_name ) , path , " % 2E " ) ; <nl> - } <nl> - <nl> String IDataType : : getSubcolumnNameForStream ( String stream_name , const SubstreamPath & path ) <nl> { <nl> return getNameForSubstreamPath ( std : : move ( stream_name ) , path ) ; <nl> mmm a / src / DataTypes / IDataType . h <nl> ppp b / src / DataTypes / IDataType . h <nl> class IDataType : private boost : : noncopyable <nl> static void updateAvgValueSizeHint ( const IColumn & column , double & avg_value_size_hint ) ; <nl> <nl> static String getFileNameForStream ( const NameAndTypePair & column , const SubstreamPath & path ) ; <nl> - static String getFileNameForStream ( const String & column_name , const SubstreamPath & path ) ; <nl> static String getSubcolumnNameForStream ( String stream_name , const SubstreamPath & path ) ; <nl> <nl> / / / Substream path supports special compression methods like codec Delta . <nl> mmm a / src / Storages / MergeTree / IMergedBlockOutputStream . cpp <nl> ppp b / src / Storages / MergeTree / IMergedBlockOutputStream . cpp <nl> NameSet IMergedBlockOutputStream : : removeEmptyColumnsFromPart ( <nl> const String mrk_extension = data_part - > getMarksFileExtension ( ) ; <nl> for ( const auto & column_name : empty_columns ) <nl> { <nl> + auto column_with_type = columns . tryGetByName ( column_name ) ; <nl> + if ( ! column_with_type ) <nl> + continue ; <nl> + <nl> IDataType : : StreamCallback callback = [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_path * / ) <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( column_name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( * column_with_type , substream_path ) ; <nl> / / / Delete files if they are no longer shared with another column . <nl> if ( - - stream_counts [ stream_name ] = = 0 ) <nl> { <nl> NameSet IMergedBlockOutputStream : : removeEmptyColumnsFromPart ( <nl> remove_files . emplace ( stream_name + mrk_extension ) ; <nl> } <nl> } ; <nl> + <nl> IDataType : : SubstreamPath stream_path ; <nl> - auto column_with_type = columns . tryGetByName ( column_name ) ; <nl> - if ( column_with_type ) <nl> - column_with_type - > type - > enumerateStreams ( callback , stream_path ) ; <nl> + column_with_type - > type - > enumerateStreams ( callback , stream_path ) ; <nl> } <nl> <nl> / / / Remove files on disk and checksums <nl> mmm a / src / Storages / MergeTree / MergeTreeDataMergerMutator . cpp <nl> ppp b / src / Storages / MergeTree / MergeTreeDataMergerMutator . cpp <nl> NameToNameVector MergeTreeDataMergerMutator : : collectFilesForRenames ( <nl> column . type - > enumerateStreams ( <nl> [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - + + stream_counts [ IDataType : : getFileNameForStream ( column . name , substream_path ) ] ; <nl> + + + stream_counts [ IDataType : : getFileNameForStream ( column , substream_path ) ] ; <nl> } , <nl> { } ) ; <nl> } <nl> NameToNameVector MergeTreeDataMergerMutator : : collectFilesForRenames ( <nl> { <nl> IDataType : : StreamCallback callback = [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( command . column_name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( { command . column_name , command . data_type } , substream_path ) ; <nl> / / / Delete files if they are no longer shared with another column . <nl> if ( - - stream_counts [ stream_name ] = = 0 ) <nl> { <nl> NameToNameVector MergeTreeDataMergerMutator : : collectFilesForRenames ( <nl> <nl> IDataType : : StreamCallback callback = [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - String stream_from = IDataType : : getFileNameForStream ( command . column_name , substream_path ) ; <nl> + String stream_from = IDataType : : getFileNameForStream ( { command . column_name , command . data_type } , substream_path ) ; <nl> <nl> String stream_to = boost : : replace_first_copy ( stream_from , escaped_name_from , escaped_name_to ) ; <nl> <nl> NameSet MergeTreeDataMergerMutator : : collectFilesToSkip ( <nl> { <nl> IDataType : : StreamCallback callback = [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( entry . name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( { entry . name , entry . type } , substream_path ) ; <nl> files_to_skip . insert ( stream_name + " . bin " ) ; <nl> files_to_skip . insert ( stream_name + mrk_extension ) ; <nl> } ; <nl> mmm a / src / Storages / MergeTree / MergeTreeDataPartWide . cpp <nl> ppp b / src / Storages / MergeTree / MergeTreeDataPartWide . cpp <nl> IMergeTreeDataPart : : MergeTreeWriterPtr MergeTreeDataPartWide : : getWriter ( <nl> / / / Takes into account the fact that several columns can e . g . share their . size substreams . <nl> / / / When calculating totals these should be counted only once . <nl> ColumnSize MergeTreeDataPartWide : : getColumnSizeImpl ( <nl> - const String & column_name , const IDataType & type , std : : unordered_set < String > * processed_substreams ) const <nl> + const NameAndTypePair & column , std : : unordered_set < String > * processed_substreams ) const <nl> { <nl> ColumnSize size ; <nl> if ( checksums . empty ( ) ) <nl> return size ; <nl> <nl> - type . enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> + column . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - String file_name = IDataType : : getFileNameForStream ( column_name , substream_path ) ; <nl> + String file_name = IDataType : : getFileNameForStream ( column , substream_path ) ; <nl> <nl> if ( processed_substreams & & ! processed_substreams - > insert ( file_name ) . second ) <nl> return ; <nl> void MergeTreeDataPartWide : : checkConsistency ( bool require_part_metadata ) const <nl> IDataType : : SubstreamPath stream_path ; <nl> name_type . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - String file_name = IDataType : : getFileNameForStream ( name_type . name , substream_path ) ; <nl> + String file_name = IDataType : : getFileNameForStream ( name_type , substream_path ) ; <nl> String mrk_file_name = file_name + index_granularity_info . marks_file_extension ; <nl> String bin_file_name = file_name + " . bin " ; <nl> if ( ! checksums . files . count ( mrk_file_name ) ) <nl> void MergeTreeDataPartWide : : checkConsistency ( bool require_part_metadata ) const <nl> { <nl> name_type . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - auto file_path = path + IDataType : : getFileNameForStream ( name_type . name , substream_path ) + index_granularity_info . marks_file_extension ; <nl> + auto file_path = path + IDataType : : getFileNameForStream ( name_type , substream_path ) + index_granularity_info . marks_file_extension ; <nl> <nl> / / / Missing file is Ok for case when new column was added . <nl> if ( volume - > getDisk ( ) - > exists ( file_path ) ) <nl> String MergeTreeDataPartWide : : getFileNameForColumn ( const NameAndTypePair & colum <nl> column . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> if ( filename . empty ( ) ) <nl> - filename = IDataType : : getFileNameForStream ( column . name , substream_path ) ; <nl> + filename = IDataType : : getFileNameForStream ( column , substream_path ) ; <nl> } ) ; <nl> return filename ; <nl> } <nl> void MergeTreeDataPartWide : : calculateEachColumnSizes ( ColumnSizeByName & each_col <nl> std : : unordered_set < String > processed_substreams ; <nl> for ( const NameAndTypePair & column : columns ) <nl> { <nl> - ColumnSize size = getColumnSizeImpl ( column . name , * column . type , & processed_substreams ) ; <nl> + ColumnSize size = getColumnSizeImpl ( column , & processed_substreams ) ; <nl> each_columns_size [ column . name ] = size ; <nl> total_size . add ( size ) ; <nl> <nl> mmm a / src / Storages / MergeTree / MergeTreeDataPartWide . h <nl> ppp b / src / Storages / MergeTree / MergeTreeDataPartWide . h <nl> class MergeTreeDataPartWide : public IMergeTreeDataPart <nl> / / / Loads marks index granularity into memory <nl> void loadIndexGranularity ( ) override ; <nl> <nl> - ColumnSize getColumnSizeImpl ( const String & name , const IDataType & type , std : : unordered_set < String > * processed_substreams ) const ; <nl> + ColumnSize getColumnSizeImpl ( const NameAndTypePair & column , std : : unordered_set < String > * processed_substreams ) const ; <nl> <nl> void calculateEachColumnSizes ( ColumnSizeByName & each_columns_size , ColumnSize & total_size ) const override ; <nl> } ; <nl> mmm a / src / Storages / MergeTree / MergeTreeDataPartWriterCompact . cpp <nl> ppp b / src / Storages / MergeTree / MergeTreeDataPartWriterCompact . cpp <nl> MergeTreeDataPartWriterCompact : : MergeTreeDataPartWriterCompact ( <nl> { <nl> const auto & storage_columns = metadata_snapshot - > getColumns ( ) ; <nl> for ( const auto & column : columns_list ) <nl> - addStreams ( column . name , * column . type , storage_columns . getCodecDescOrDefault ( column . name , default_codec ) ) ; <nl> + addStreams ( column , storage_columns . getCodecDescOrDefault ( column . name , default_codec ) ) ; <nl> } <nl> <nl> - void MergeTreeDataPartWriterCompact : : addStreams ( const String & name , const IDataType & type , const ASTPtr & effective_codec_desc ) <nl> + void MergeTreeDataPartWriterCompact : : addStreams ( const NameAndTypePair & column , const ASTPtr & effective_codec_desc ) <nl> { <nl> IDataType : : StreamCallback callback = [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & substream_type ) <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( column , substream_path ) ; <nl> <nl> / / / Shared offsets for Nested type . <nl> if ( compressed_streams . count ( stream_name ) ) <nl> void MergeTreeDataPartWriterCompact : : addStreams ( const String & name , const IData <nl> } ; <nl> <nl> IDataType : : SubstreamPath stream_path ; <nl> - type . enumerateStreams ( callback , stream_path ) ; <nl> + column . type - > enumerateStreams ( callback , stream_path ) ; <nl> } <nl> <nl> void MergeTreeDataPartWriterCompact : : write ( <nl> void MergeTreeDataPartWriterCompact : : writeBlock ( const Block & block ) <nl> CompressedStreamPtr prev_stream ; <nl> auto stream_getter = [ & , this ] ( const IDataType : : SubstreamPath & substream_path ) - > WriteBuffer * <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( name_and_type - > name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( * name_and_type , substream_path ) ; <nl> <nl> auto & result_stream = compressed_streams [ stream_name ] ; <nl> / / / Write one compressed block per column in granule for more optimal reading . <nl> mmm a / src / Storages / MergeTree / MergeTreeDataPartWriterCompact . h <nl> ppp b / src / Storages / MergeTree / MergeTreeDataPartWriterCompact . h <nl> class MergeTreeDataPartWriterCompact : public MergeTreeDataPartWriterOnDisk <nl> <nl> void addToChecksums ( MergeTreeDataPartChecksums & checksums ) ; <nl> <nl> - void addStreams ( const String & name , const IDataType & type , const ASTPtr & effective_codec_desc ) ; <nl> + void addStreams ( const NameAndTypePair & column , const ASTPtr & effective_codec_desc ) ; <nl> <nl> Block header ; <nl> <nl> mmm a / src / Storages / MergeTree / MergeTreeDataPartWriterWide . cpp <nl> ppp b / src / Storages / MergeTree / MergeTreeDataPartWriterWide . cpp <nl> MergeTreeDataPartWriterWide : : MergeTreeDataPartWriterWide ( <nl> { <nl> const auto & columns = metadata_snapshot - > getColumns ( ) ; <nl> for ( const auto & it : columns_list ) <nl> - addStreams ( it . name , * it . type , columns . getCodecDescOrDefault ( it . name , default_codec ) , settings . estimated_size ) ; <nl> + addStreams ( it , columns . getCodecDescOrDefault ( it . name , default_codec ) , settings . estimated_size ) ; <nl> } <nl> <nl> void MergeTreeDataPartWriterWide : : addStreams ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & column , <nl> const ASTPtr & effective_codec_desc , <nl> size_t estimated_size ) <nl> { <nl> IDataType : : StreamCallback callback = [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & substream_type ) <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( column , substream_path ) ; <nl> / / / Shared offsets for Nested type . <nl> if ( column_streams . count ( stream_name ) ) <nl> return ; <nl> void MergeTreeDataPartWriterWide : : addStreams ( <nl> } ; <nl> <nl> IDataType : : SubstreamPath stream_path ; <nl> - type . enumerateStreams ( callback , stream_path ) ; <nl> + column . type - > enumerateStreams ( callback , stream_path ) ; <nl> } <nl> <nl> <nl> IDataType : : OutputStreamGetter MergeTreeDataPartWriterWide : : createStreamGetter ( <nl> - const String & name , WrittenOffsetColumns & offset_columns ) <nl> + const NameAndTypePair & column , WrittenOffsetColumns & offset_columns ) <nl> { <nl> return [ & , this ] ( const IDataType : : SubstreamPath & substream_path ) - > WriteBuffer * <nl> { <nl> bool is_offsets = ! substream_path . empty ( ) & & substream_path . back ( ) . type = = IDataType : : Substream : : ArraySizes ; <nl> <nl> - String stream_name = IDataType : : getFileNameForStream ( name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( column , substream_path ) ; <nl> <nl> / / / Don ' t write offsets more than one time for Nested type . <nl> if ( is_offsets & & offset_columns . count ( stream_name ) ) <nl> void MergeTreeDataPartWriterWide : : write ( const Block & block , <nl> for ( size_t i = 0 ; i < columns_list . size ( ) ; + + i , + + it ) <nl> { <nl> const ColumnWithTypeAndName & column = block . getByName ( it - > name ) ; <nl> + auto name_and_type = NameAndTypePair ( column . name , column . type ) ; <nl> <nl> if ( permutation ) <nl> { <nl> if ( primary_key_block . has ( it - > name ) ) <nl> { <nl> const auto & primary_column = * primary_key_block . getByName ( it - > name ) . column ; <nl> - writeColumn ( column . name , * column . type , primary_column , offset_columns ) ; <nl> + writeColumn ( name_and_type , primary_column , offset_columns ) ; <nl> } <nl> else if ( skip_indexes_block . has ( it - > name ) ) <nl> { <nl> const auto & index_column = * skip_indexes_block . getByName ( it - > name ) . column ; <nl> - writeColumn ( column . name , * column . type , index_column , offset_columns ) ; <nl> + writeColumn ( name_and_type , index_column , offset_columns ) ; <nl> } <nl> else <nl> { <nl> / / / We rearrange the columns that are not included in the primary key here ; Then the result is released - to save RAM . <nl> ColumnPtr permuted_column = column . column - > permute ( * permutation , 0 ) ; <nl> - writeColumn ( column . name , * column . type , * permuted_column , offset_columns ) ; <nl> + writeColumn ( name_and_type , * permuted_column , offset_columns ) ; <nl> } <nl> } <nl> else <nl> { <nl> - writeColumn ( column . name , * column . type , * column . column , offset_columns ) ; <nl> + writeColumn ( name_and_type , * column . column , offset_columns ) ; <nl> } <nl> } <nl> } <nl> <nl> void MergeTreeDataPartWriterWide : : writeSingleMark ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & column , <nl> WrittenOffsetColumns & offset_columns , <nl> size_t number_of_rows , <nl> DB : : IDataType : : SubstreamPath & path ) <nl> { <nl> - type . enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> + column . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> bool is_offsets = ! substream_path . empty ( ) & & substream_path . back ( ) . type = = IDataType : : Substream : : ArraySizes ; <nl> <nl> - String stream_name = IDataType : : getFileNameForStream ( name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( column , substream_path ) ; <nl> <nl> / / / Don ' t write offsets more than one time for Nested type . <nl> if ( is_offsets & & offset_columns . count ( stream_name ) ) <nl> void MergeTreeDataPartWriterWide : : writeSingleMark ( <nl> } <nl> <nl> size_t MergeTreeDataPartWriterWide : : writeSingleGranule ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & name_and_type , <nl> const IColumn & column , <nl> WrittenOffsetColumns & offset_columns , <nl> IDataType : : SerializeBinaryBulkStatePtr & serialization_state , <nl> size_t MergeTreeDataPartWriterWide : : writeSingleGranule ( <nl> bool write_marks ) <nl> { <nl> if ( write_marks ) <nl> - writeSingleMark ( name , type , offset_columns , number_of_rows , serialize_settings . path ) ; <nl> + writeSingleMark ( name_and_type , offset_columns , number_of_rows , serialize_settings . path ) ; <nl> <nl> - type . serializeBinaryBulkWithMultipleStreams ( column , from_row , number_of_rows , serialize_settings , serialization_state ) ; <nl> + name_and_type . type - > serializeBinaryBulkWithMultipleStreams ( column , from_row , number_of_rows , serialize_settings , serialization_state ) ; <nl> <nl> / / / So that instead of the marks pointing to the end of the compressed block , there were marks pointing to the beginning of the next one . <nl> - type . enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> + name_and_type . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> bool is_offsets = ! substream_path . empty ( ) & & substream_path . back ( ) . type = = IDataType : : Substream : : ArraySizes ; <nl> <nl> - String stream_name = IDataType : : getFileNameForStream ( name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( name_and_type , substream_path ) ; <nl> <nl> / / / Don ' t write offsets more than one time for Nested type . <nl> if ( is_offsets & & offset_columns . count ( stream_name ) ) <nl> size_t MergeTreeDataPartWriterWide : : writeSingleGranule ( <nl> <nl> / / / Column must not be empty . ( column . size ( ) ! = = 0 ) <nl> void MergeTreeDataPartWriterWide : : writeColumn ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & name_and_type , <nl> const IColumn & column , <nl> WrittenOffsetColumns & offset_columns ) <nl> { <nl> - auto [ it , inserted ] = serialization_states . emplace ( name , nullptr ) ; <nl> + auto [ it , inserted ] = serialization_states . emplace ( name_and_type . name , nullptr ) ; <nl> if ( inserted ) <nl> { <nl> IDataType : : SerializeBinaryBulkSettings serialize_settings ; <nl> - serialize_settings . getter = createStreamGetter ( name , offset_columns ) ; <nl> - type . serializeBinaryBulkStatePrefix ( serialize_settings , it - > second ) ; <nl> + serialize_settings . getter = createStreamGetter ( name_and_type , offset_columns ) ; <nl> + name_and_type . type - > serializeBinaryBulkStatePrefix ( serialize_settings , it - > second ) ; <nl> } <nl> <nl> const auto & global_settings = storage . global_context . getSettingsRef ( ) ; <nl> IDataType : : SerializeBinaryBulkSettings serialize_settings ; <nl> - serialize_settings . getter = createStreamGetter ( name , offset_columns ) ; <nl> + serialize_settings . getter = createStreamGetter ( name_and_type , offset_columns ) ; <nl> serialize_settings . low_cardinality_max_dictionary_size = global_settings . low_cardinality_max_dictionary_size ; <nl> serialize_settings . low_cardinality_use_single_dictionary_for_part = global_settings . low_cardinality_use_single_dictionary_for_part ! = 0 ; <nl> <nl> void MergeTreeDataPartWriterWide : : writeColumn ( <nl> data_written = true ; <nl> <nl> current_row = writeSingleGranule ( <nl> - name , <nl> - type , <nl> + name_and_type , <nl> column , <nl> offset_columns , <nl> it - > second , <nl> void MergeTreeDataPartWriterWide : : writeColumn ( <nl> current_column_mark + + ; <nl> } <nl> <nl> - type . enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> + name_and_type . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> bool is_offsets = ! substream_path . empty ( ) & & substream_path . back ( ) . type = = IDataType : : Substream : : ArraySizes ; <nl> if ( is_offsets ) <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( name_and_type , substream_path ) ; <nl> offset_columns . insert ( stream_name ) ; <nl> } <nl> } , serialize_settings . path ) ; <nl> void MergeTreeDataPartWriterWide : : finishDataSerialization ( IMergeTreeDataPart : : Ch <nl> { <nl> if ( ! serialization_states . empty ( ) ) <nl> { <nl> - serialize_settings . getter = createStreamGetter ( it - > name , written_offset_columns ? * written_offset_columns : offset_columns ) ; <nl> + serialize_settings . getter = createStreamGetter ( * it , written_offset_columns ? * written_offset_columns : offset_columns ) ; <nl> it - > type - > serializeBinaryBulkStateSuffix ( serialize_settings , serialization_states [ it - > name ] ) ; <nl> } <nl> <nl> if ( write_final_mark ) <nl> { <nl> - writeFinalMark ( it - > name , it - > type , offset_columns , serialize_settings . path ) ; <nl> + writeFinalMark ( * it , offset_columns , serialize_settings . path ) ; <nl> } <nl> } <nl> } <nl> void MergeTreeDataPartWriterWide : : finishDataSerialization ( IMergeTreeDataPart : : Ch <nl> } <nl> <nl> void MergeTreeDataPartWriterWide : : writeFinalMark ( <nl> - const std : : string & column_name , <nl> - const DataTypePtr column_type , <nl> + const NameAndTypePair & column , <nl> WrittenOffsetColumns & offset_columns , <nl> DB : : IDataType : : SubstreamPath & path ) <nl> { <nl> - writeSingleMark ( column_name , * column_type , offset_columns , 0 , path ) ; <nl> + writeSingleMark ( column , offset_columns , 0 , path ) ; <nl> / / / Memoize information about offsets <nl> - column_type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> + column . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> bool is_offsets = ! substream_path . empty ( ) & & substream_path . back ( ) . type = = IDataType : : Substream : : ArraySizes ; <nl> if ( is_offsets ) <nl> { <nl> - String stream_name = IDataType : : getFileNameForStream ( column_name , substream_path ) ; <nl> + String stream_name = IDataType : : getFileNameForStream ( column , substream_path ) ; <nl> offset_columns . insert ( stream_name ) ; <nl> } <nl> } , path ) ; <nl> mmm a / src / Storages / MergeTree / MergeTreeDataPartWriterWide . h <nl> ppp b / src / Storages / MergeTree / MergeTreeDataPartWriterWide . h <nl> class MergeTreeDataPartWriterWide : public MergeTreeDataPartWriterOnDisk <nl> <nl> void finishDataSerialization ( IMergeTreeDataPart : : Checksums & checksums , bool sync ) override ; <nl> <nl> - IDataType : : OutputStreamGetter createStreamGetter ( const String & name , WrittenOffsetColumns & offset_columns ) ; <nl> + IDataType : : OutputStreamGetter createStreamGetter ( const NameAndTypePair & column , WrittenOffsetColumns & offset_columns ) ; <nl> <nl> private : <nl> / / / Write data of one column . <nl> / / / Return how many marks were written and <nl> / / / how many rows were written for last mark <nl> void writeColumn ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & name_and_type , <nl> const IColumn & column , <nl> WrittenOffsetColumns & offset_columns ) ; <nl> <nl> / / / Write single granule of one column ( rows between 2 marks ) <nl> size_t writeSingleGranule ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & name_and_type , <nl> const IColumn & column , <nl> WrittenOffsetColumns & offset_columns , <nl> IDataType : : SerializeBinaryBulkStatePtr & serialization_state , <nl> class MergeTreeDataPartWriterWide : public MergeTreeDataPartWriterOnDisk <nl> <nl> / / / Write mark for column <nl> void writeSingleMark ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & column , <nl> WrittenOffsetColumns & offset_columns , <nl> size_t number_of_rows , <nl> DB : : IDataType : : SubstreamPath & path ) ; <nl> <nl> void writeFinalMark ( <nl> - const std : : string & column_name , <nl> - const DataTypePtr column_type , <nl> + const NameAndTypePair & column , <nl> WrittenOffsetColumns & offset_columns , <nl> DB : : IDataType : : SubstreamPath & path ) ; <nl> <nl> void addStreams ( <nl> - const String & name , <nl> - const IDataType & type , <nl> + const NameAndTypePair & column , <nl> const ASTPtr & effective_codec_desc , <nl> size_t estimated_size ) ; <nl> <nl> mmm a / src / Storages / MergeTree / MergeTreeReaderInMemory . cpp <nl> ppp b / src / Storages / MergeTree / MergeTreeReaderInMemory . cpp <nl> MergeTreeReaderInMemory : : MergeTreeReaderInMemory ( <nl> } <nl> } <nl> <nl> + static ColumnPtr getColumnFromBlock ( const Block & block , const NameAndTypePair & name_and_type ) <nl> + { <nl> + auto storage_name = name_and_type . getStorageName ( ) ; <nl> + if ( ! block . has ( storage_name ) ) <nl> + throw Exception ( ErrorCodes : : LOGICAL_ERROR , " Not found column ' { } ' in block " , storage_name ) ; <nl> + <nl> + const auto & column = block . getByName ( storage_name ) . column ; <nl> + if ( name_and_type . isSubcolumn ( ) ) <nl> + return name_and_type . getStorageType ( ) - > getSubcolumn ( name_and_type . getSubcolumnName ( ) , * column - > assumeMutable ( ) ) ; <nl> + <nl> + return column ; <nl> + } <nl> + <nl> size_t MergeTreeReaderInMemory : : readRows ( size_t from_mark , bool continue_reading , size_t max_rows_to_read , Columns & res_columns ) <nl> { <nl> if ( ! continue_reading ) <nl> size_t MergeTreeReaderInMemory : : readRows ( size_t from_mark , bool continue_reading <nl> auto column_it = columns . begin ( ) ; <nl> for ( size_t i = 0 ; i < num_columns ; + + i , + + column_it ) <nl> { <nl> - auto [ name , type ] = getColumnFromPart ( * column_it ) ; <nl> + auto name_type = getColumnFromPart ( * column_it ) ; <nl> <nl> / / / Copy offsets , if array of Nested column is missing in part . <nl> - auto offsets_it = positions_for_offsets . find ( name ) ; <nl> - if ( offsets_it ! = positions_for_offsets . end ( ) ) <nl> + auto offsets_it = positions_for_offsets . find ( name_type . name ) ; <nl> + if ( offsets_it ! = positions_for_offsets . end ( ) & & ! name_type . isSubcolumn ( ) ) <nl> { <nl> const auto & source_offsets = assert_cast < const ColumnArray & > ( <nl> * part_in_memory - > block . getByPosition ( offsets_it - > second ) . column ) . getOffsets ( ) ; <nl> <nl> if ( res_columns [ i ] = = nullptr ) <nl> - res_columns [ i ] = type - > createColumn ( ) ; <nl> + res_columns [ i ] = name_type . type - > createColumn ( ) ; <nl> <nl> auto mutable_column = res_columns [ i ] - > assumeMutable ( ) ; <nl> auto & res_offstes = assert_cast < ColumnArray & > ( * mutable_column ) . getOffsets ( ) ; <nl> size_t MergeTreeReaderInMemory : : readRows ( size_t from_mark , bool continue_reading <nl> <nl> res_columns [ i ] = std : : move ( mutable_column ) ; <nl> } <nl> - else if ( part_in_memory - > block . has ( name ) ) <nl> + else if ( part_in_memory - > hasColumnFiles ( name_type ) ) <nl> { <nl> - const auto & block_column = part_in_memory - > block . getByName ( name ) . column ; <nl> + auto block_column = getColumnFromBlock ( part_in_memory - > block , name_type ) ; <nl> if ( rows_to_read = = part_rows ) <nl> { <nl> res_columns [ i ] = block_column ; <nl> size_t MergeTreeReaderInMemory : : readRows ( size_t from_mark , bool continue_reading <nl> else <nl> { <nl> if ( res_columns [ i ] = = nullptr ) <nl> - res_columns [ i ] = type - > createColumn ( ) ; <nl> + res_columns [ i ] = name_type . type - > createColumn ( ) ; <nl> <nl> auto mutable_column = res_columns [ i ] - > assumeMutable ( ) ; <nl> mutable_column - > insertRangeFrom ( * block_column , total_rows_read , rows_to_read ) ; <nl> mmm a / src / Storages / MergeTree / checkDataPart . cpp <nl> ppp b / src / Storages / MergeTree / checkDataPart . cpp <nl> IMergeTreeDataPart : : Checksums checkDataPart ( <nl> { <nl> column . type - > enumerateStreams ( [ & ] ( const IDataType : : SubstreamPath & substream_path , const IDataType & / * substream_type * / ) <nl> { <nl> - String file_name = IDataType : : getFileNameForStream ( column . name , substream_path ) + " . bin " ; <nl> + String file_name = IDataType : : getFileNameForStream ( column , substream_path ) + " . bin " ; <nl> checksums_data . files [ file_name ] = checksum_compressed_file ( disk , path + file_name ) ; <nl> } , { } ) ; <nl> } <nl> mmm a / src / Storages / StorageLog . cpp <nl> ppp b / src / Storages / StorageLog . cpp <nl> <nl> <nl> # include < IO / ReadBufferFromFileBase . h > <nl> # include < IO / WriteBufferFromFileBase . h > <nl> - # include < Compression / CompressedReadBuffer . h > <nl> + # include < Compression / CompressedReadBufferFromFile . h > <nl> # include < Compression / CompressedWriteBuffer . h > <nl> # include < IO / ReadHelpers . h > <nl> # include < IO / WriteHelpers . h > <nl> namespace ErrorCodes <nl> extern const int INCORRECT_FILE_NAME ; <nl> } <nl> <nl> - <nl> class LogSource final : public SourceWithProgress <nl> { <nl> public : <nl> class LogSource final : public SourceWithProgress <nl> struct Stream <nl> { <nl> Stream ( const DiskPtr & disk , const String & data_path , size_t offset , size_t max_read_buffer_size_ ) <nl> - : plain ( disk - > readFile ( data_path , std : : min ( max_read_buffer_size_ , disk - > getFileSize ( data_path ) ) ) ) , <nl> - compressed ( * plain ) <nl> + : compressed ( disk - > readFile ( data_path , std : : min ( max_read_buffer_size_ , disk - > getFileSize ( data_path ) ) ) ) <nl> { <nl> if ( offset ) <nl> - plain - > seek ( offset , SEEK_SET ) ; <nl> + compressed . seek ( offset , 0 ) ; <nl> } <nl> <nl> - std : : unique_ptr < ReadBufferFromFileBase > plain ; <nl> - CompressedReadBuffer compressed ; <nl> + CompressedReadBufferFromFile compressed ; <nl> } ; <nl> <nl> using FileStreams = std : : map < String , Stream > ; <nl> void LogSource : : readData ( const NameAndTypePair & name_and_type , IColumn & column <nl> IDataType : : DeserializeBinaryBulkSettings settings ; / / / TODO Use avg_value_size_hint . <nl> const auto & [ name , type ] = name_and_type ; <nl> <nl> - auto create_string_getter = [ & ] ( bool stream_for_prefix ) <nl> + auto create_stream_getter = [ & ] ( bool stream_for_prefix ) <nl> { <nl> return [ & , stream_for_prefix ] ( const IDataType : : SubstreamPath & path ) - > ReadBuffer * <nl> { <nl> void LogSource : : readData ( const NameAndTypePair & name_and_type , IColumn & column <nl> <nl> auto & data_file_path = file_it - > second . data_file_path ; <nl> auto it = streams . try_emplace ( stream_name , storage . disk , data_file_path , offset , max_read_buffer_size ) . first ; <nl> + <nl> + / / / FIXME : avoid double reading of subcolumns <nl> + it - > second . compressed . seek ( 0 , 0 ) ; <nl> + <nl> return & it - > second . compressed ; <nl> } ; <nl> } ; <nl> <nl> if ( deserialize_states . count ( name ) = = 0 ) <nl> { <nl> - settings . getter = create_string_getter ( true ) ; <nl> + settings . getter = create_stream_getter ( true ) ; <nl> type - > deserializeBinaryBulkStatePrefix ( settings , deserialize_states [ name ] ) ; <nl> } <nl> <nl> - settings . getter = create_string_getter ( false ) ; <nl> + settings . getter = create_stream_getter ( false ) ; <nl> type - > deserializeBinaryBulkWithMultipleStreams ( column , max_rows_to_read , settings , deserialize_states [ name ] ) ; <nl> } <nl> <nl> Pipe StorageLog : : read ( <nl> metadata_snapshot - > check ( column_names , getVirtuals ( ) , getStorageID ( ) ) ; <nl> loadMarks ( ) ; <nl> <nl> - NamesAndTypesList all_columns = Nested : : collect ( metadata_snapshot - > getColumns ( ) . getAllPhysical ( ) . addTypes ( column_names ) ) ; <nl> + NamesAndTypesList all_columns = metadata_snapshot - > getColumns ( ) . getAllWithSubcolumns ( ) . addTypes ( column_names ) ; <nl> <nl> std : : shared_lock < std : : shared_mutex > lock ( rwlock ) ; <nl> <nl> mmm a / src / Storages / StorageMemory . cpp <nl> ppp b / src / Storages / StorageMemory . cpp <nl> class MemorySource : public SourceWithProgress <nl> const StorageMemory & storage , <nl> const StorageMetadataPtr & metadata_snapshot ) <nl> : SourceWithProgress ( metadata_snapshot - > getSampleBlockForColumns ( column_names_ , storage . getVirtuals ( ) , storage . getStorageID ( ) ) ) <nl> - , column_names ( std : : move ( column_names_ ) ) <nl> + , column_names_and_types ( metadata_snapshot - > getColumns ( ) . getAllWithSubcolumns ( ) . addTypes ( std : : move ( column_names_ ) ) ) <nl> , current_it ( first_ ) <nl> , num_blocks ( num_blocks_ ) <nl> { <nl> class MemorySource : public SourceWithProgress <nl> { <nl> const Block & src = * current_it ; <nl> Columns columns ; <nl> - columns . reserve ( column_names . size ( ) ) ; <nl> + columns . reserve ( columns . size ( ) ) ; <nl> <nl> / / / Add only required columns to ` res ` . <nl> - for ( const auto & name : column_names ) <nl> - columns . emplace_back ( src . getByName ( name ) . column ) ; <nl> + for ( const auto & elem : column_names_and_types ) <nl> + { <nl> + auto current_column = src . getByName ( elem . getStorageName ( ) ) . column ; <nl> + if ( elem . isSubcolumn ( ) ) <nl> + columns . emplace_back ( elem . getStorageType ( ) - > getSubcolumn ( elem . getSubcolumnName ( ) , * current_column - > assumeMutable ( ) ) ) ; <nl> + else <nl> + columns . emplace_back ( std : : move ( current_column ) ) ; <nl> + } <nl> <nl> + + current_block_idx ; <nl> <nl> class MemorySource : public SourceWithProgress <nl> } <nl> } <nl> private : <nl> - Names column_names ; <nl> + NamesAndTypesList column_names_and_types ; <nl> BlocksList : : iterator current_it ; <nl> size_t current_block_idx = 0 ; <nl> size_t num_blocks ; <nl> mmm a / src / Storages / StorageTinyLog . cpp <nl> ppp b / src / Storages / StorageTinyLog . cpp <nl> <nl> # include < IO / ReadBufferFromFileBase . h > <nl> # include < IO / WriteBufferFromFileBase . h > <nl> # include < Compression / CompressionFactory . h > <nl> - # include < Compression / CompressedReadBuffer . h > <nl> + # include < Compression / CompressedReadBufferFromFile . h > <nl> # include < Compression / CompressedWriteBuffer . h > <nl> # include < IO / ReadHelpers . h > <nl> # include < IO / WriteHelpers . h > <nl> class TinyLogSource final : public SourceWithProgress <nl> struct Stream <nl> { <nl> Stream ( const DiskPtr & disk , const String & data_path , size_t max_read_buffer_size_ ) <nl> - : plain ( disk - > readFile ( data_path , std : : min ( max_read_buffer_size_ , disk - > getFileSize ( data_path ) ) ) ) , <nl> - compressed ( * plain ) <nl> + : compressed ( disk - > readFile ( data_path , std : : min ( max_read_buffer_size_ , disk - > getFileSize ( data_path ) ) ) ) <nl> { <nl> } <nl> <nl> - std : : unique_ptr < ReadBuffer > plain ; <nl> - CompressedReadBuffer compressed ; <nl> + CompressedReadBufferFromFile compressed ; <nl> } ; <nl> <nl> using FileStreams = std : : map < String , std : : unique_ptr < Stream > > ; <nl> void TinyLogSource : : readData ( const NameAndTypePair & name_and_type , IColumn & co <nl> { <nl> String stream_name = IDataType : : getFileNameForStream ( name_and_type , path ) ; <nl> <nl> - if ( ! streams . count ( stream_name ) ) <nl> - streams [ stream_name ] = std : : make_unique < Stream > ( storage . disk , storage . files [ stream_name ] . data_file_path , max_read_buffer_size ) ; <nl> + auto & stream = streams [ stream_name ] ; <nl> + if ( ! stream ) <nl> + stream = std : : make_unique < Stream > ( storage . disk , storage . files [ stream_name ] . data_file_path , max_read_buffer_size ) ; <nl> <nl> - return & streams [ stream_name ] - > compressed ; <nl> + / / / FIXME : avoid double reading of subcolumns <nl> + stream - > compressed . seek ( 0 , 0 ) ; <nl> + <nl> + return & stream - > compressed ; <nl> } ; <nl> <nl> if ( deserialize_states . count ( name ) = = 0 ) <nl> Pipe StorageTinyLog : : read ( <nl> / / When reading , we lock the entire storage , because we only have one file <nl> / / per column and can ' t modify it concurrently . <nl> return Pipe ( std : : make_shared < TinyLogSource > ( <nl> - max_block_size , Nested : : collect ( metadata_snapshot - > getColumns ( ) . getAllPhysical ( ) . addTypes ( column_names ) ) , * this , context . getSettingsRef ( ) . max_read_buffer_size ) ) ; <nl> + max_block_size , metadata_snapshot - > getColumns ( ) . getAllWithSubcolumns ( ) . addTypes ( column_names ) , <nl> + * this , context . getSettingsRef ( ) . max_read_buffer_size ) ) ; <nl> } <nl> <nl> <nl> new file mode 100644 <nl> index 00000000000 . . f848977a55d <nl> mmm / dev / null <nl> ppp b / tests / queries / 0_stateless / 01475_read_subcolumns_storages . reference <nl> <nl> + Log <nl> + 100 [ 1 , 2 , 3 ] [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] [ 1 , NULL , 2 ] ( ' foo ' , 200 ) <nl> + 100 0 [ 1 , 2 , 3 ] 3 [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] 3 [ 3 , 2 , 1 ] [ [ 2 , 0 , 1 ] , [ 2 , 2 ] , [ 0 ] ] [ 1 , NULL , 2 ] 3 [ 0 , 1 , 0 ] ( ' foo ' , 200 ) foo 200 <nl> + TinyLog <nl> + 100 [ 1 , 2 , 3 ] [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] [ 1 , NULL , 2 ] ( ' foo ' , 200 ) <nl> + 100 0 [ 1 , 2 , 3 ] 3 [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] 3 [ 3 , 2 , 1 ] [ [ 2 , 0 , 1 ] , [ 2 , 2 ] , [ 0 ] ] [ 1 , NULL , 2 ] 3 [ 0 , 1 , 0 ] ( ' foo ' , 200 ) foo 200 <nl> + Memory <nl> + 100 [ 1 , 2 , 3 ] [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] [ 1 , NULL , 2 ] ( ' foo ' , 200 ) <nl> + 100 0 [ 1 , 2 , 3 ] 3 [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] 3 [ 3 , 2 , 1 ] [ [ 2 , 0 , 1 ] , [ 2 , 2 ] , [ 0 ] ] [ 1 , NULL , 2 ] 3 [ 0 , 1 , 0 ] ( ' foo ' , 200 ) foo 200 <nl> + MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_compact_part = ' 10M ' <nl> + 100 [ 1 , 2 , 3 ] [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] [ 1 , NULL , 2 ] ( ' foo ' , 200 ) <nl> + 100 0 [ 1 , 2 , 3 ] 3 [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] 3 [ 3 , 2 , 1 ] [ [ 2 , 0 , 1 ] , [ 2 , 2 ] , [ 0 ] ] [ 1 , NULL , 2 ] 3 [ 0 , 1 , 0 ] ( ' foo ' , 200 ) foo 200 <nl> + MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_wide_part = ' 10M ' <nl> + 100 [ 1 , 2 , 3 ] [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] [ 1 , NULL , 2 ] ( ' foo ' , 200 ) <nl> + 100 0 [ 1 , 2 , 3 ] 3 [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] 3 [ 3 , 2 , 1 ] [ [ 2 , 0 , 1 ] , [ 2 , 2 ] , [ 0 ] ] [ 1 , NULL , 2 ] 3 [ 0 , 1 , 0 ] ( ' foo ' , 200 ) foo 200 <nl> + MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_wide_part = 0 <nl> + 100 [ 1 , 2 , 3 ] [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] [ 1 , NULL , 2 ] ( ' foo ' , 200 ) <nl> + 100 0 [ 1 , 2 , 3 ] 3 [ [ [ 1 , 2 ] , [ ] , [ 4 ] ] , [ [ 5 , 6 ] , [ 7 , 8 ] ] , [ [ ] ] ] 3 [ 3 , 2 , 1 ] [ [ 2 , 0 , 1 ] , [ 2 , 2 ] , [ 0 ] ] [ 1 , NULL , 2 ] 3 [ 0 , 1 , 0 ] ( ' foo ' , 200 ) foo 200 <nl> mmm a / tests / queries / 0_stateless / 01475_read_subcolumns_storages . sh <nl> ppp b / tests / queries / 0_stateless / 01475_read_subcolumns_storages . sh <nl> set - e <nl> create_query = " CREATE TABLE subcolumns ( n Nullable ( UInt32 ) , a1 Array ( UInt32 ) , \ <nl> a2 Array ( Array ( Array ( UInt32 ) ) ) , a3 Array ( Nullable ( UInt32 ) ) , t Tuple ( s String , v UInt32 ) ) " <nl> <nl> - declare - a ENGINES = ( " Log " " StripeLog " " TinyLog " " Memory " \ <nl> - " MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_compact_part = ' 10M ' " <nl> - " MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_wide_part = ' 10M ' " <nl> + # " StripeLog " <nl> + declare - a ENGINES = ( " Log " " TinyLog " " Memory " \ <nl> + " MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_compact_part = ' 10M ' " \ <nl> + " MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_wide_part = ' 10M ' " \ <nl> " MergeTree ORDER BY tuple ( ) SETTINGS min_bytes_for_wide_part = 0 " ) <nl> <nl> for engine in " $ { ENGINES [ @ ] } " ; do <nl>
allow to read subhcolumns from other storages
ClickHouse/ClickHouse
06dc0155e5c65c3b8214ff4c814c864d85113d08
2020-10-23T14:44:23Z
mmm a / RELEASES . md <nl> ppp b / RELEASES . md <nl> Version 0 . 8 . 0 ( 2020 - 11 - 30 ) <nl> * Grey panda is no longer supported , upgrade to comma two or black panda <nl> * Lexus NX 2018 support thanks to matt12eagles ! <nl> * Kia Niro EV 2020 support thanks to nickn17 ! <nl> + * Toyota Prius 2021 support thanks to rav4kumar ! <nl> * Improved lane positioning with uncertain lanelines , wide lanes and exits <nl> * Improved lateral control for Prius and Subaru <nl> <nl>
Update RELEASES . md
commaai/openpilot
d56e04c0d960c8d3d4ab88b578dc508a2b4e07dc
2020-11-24T21:51:51Z
mmm a / hphp / idl / asio . idl . json <nl> ppp b / hphp / idl / asio . idl . json <nl> <nl> " consts " : [ <nl> ] , <nl> " funcs " : [ <nl> - { <nl> - " name " : " asio_enter_context " , <nl> - " desc " : " DEPRECATED : does nothing " , <nl> - " flags " : [ <nl> - " HasDocComment " <nl> - ] , <nl> - " return " : { <nl> - " type " : null <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> - { <nl> - " name " : " asio_exit_context " , <nl> - " desc " : " DEPRECATED : does nothing " , <nl> - " flags " : [ <nl> - " HasDocComment " <nl> - ] , <nl> - " return " : { <nl> - " type " : null <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> { <nl> " name " : " asio_get_current_context_idx " , <nl> " desc " : " Get index of the current scheduler context , or 0 if there is none " , <nl> <nl> " args " : [ <nl> ] <nl> } , <nl> - { <nl> - " name " : " asio_get_current " , <nl> - " desc " : " DEPRECATED : use asio_get_running " , <nl> - " flags " : [ <nl> - " HasDocComment " <nl> - ] , <nl> - " return " : { <nl> - " type " : " Object " , <nl> - " desc " : " A ContinuationWaitHandle that is running in the current context " <nl> - } , <nl> - " args " : [ <nl> - ] <nl> - } , <nl> { <nl> " name " : " asio_set_on_failed_callback " , <nl> " desc " : " Set callback to be called when wait handle fails " , <nl> <nl> ] <nl> } <nl> ] <nl> - } <nl> \ No newline at end of file <nl> + } <nl> mmm a / hphp / runtime / ext / ext_asio . cpp <nl> ppp b / hphp / runtime / ext / ext_asio . cpp <nl> <nl> namespace HPHP { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - void f_asio_enter_context ( ) { <nl> - / / TODO : remove from API <nl> - } <nl> - <nl> - void f_asio_exit_context ( ) { <nl> - / / TODO : remove from API <nl> - } <nl> - <nl> int f_asio_get_current_context_idx ( ) { <nl> return AsioSession : : Get ( ) - > getCurrentContextIdx ( ) ; <nl> } <nl> Object f_asio_get_running ( ) { <nl> return AsioSession : : Get ( ) - > getCurrentWaitHandle ( ) ; <nl> } <nl> <nl> - Object f_asio_get_current ( ) { <nl> - return AsioSession : : Get ( ) - > getCurrentWaitHandle ( ) ; <nl> - } <nl> - <nl> void f_asio_set_on_failed_callback ( CVarRef on_failed_cb ) { <nl> if ( ! on_failed_cb . isNull ( ) & & ! on_failed_cb . instanceof ( c_Closure : : s_cls ) ) { <nl> Object e ( SystemLib : : AllocInvalidArgumentExceptionObject ( <nl> mmm a / hphp / runtime / ext / ext_asio . h <nl> ppp b / hphp / runtime / ext / ext_asio . h <nl> <nl> namespace HPHP { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - void f_asio_enter_context ( ) ; <nl> - void f_asio_exit_context ( ) ; <nl> int f_asio_get_current_context_idx ( ) ; <nl> Object f_asio_get_running_in_context ( int ctx_idx ) ; <nl> Object f_asio_get_running ( ) ; <nl> - Object f_asio_get_current ( ) ; <nl> void f_asio_set_on_failed_callback ( CVarRef on_failed_cb ) ; <nl> void f_asio_set_on_started_callback ( CVarRef on_started_cb ) ; <nl> <nl> mmm a / hphp / system / class_map . cpp <nl> ppp b / hphp / system / class_map . cpp <nl> <nl> | license @ php . net so we can mail you a copy immediately . | <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - + <nl> * / <nl> + / / @ generated by idl / class_map . php <nl> # include < runtime / base / base_includes . h > <nl> # include < runtime / ext / ext . h > <nl> namespace HPHP { <nl> const char * g_class_map [ ] = { <nl> NULL , <nl> NULL , <nl> NULL , <nl> - ( const char * ) 0x10006040 , " asio_enter_context " , " " , ( const char * ) 0 , ( const char * ) 0 , <nl> - " / * * \ n * ( excerpt from http : / / php . net / manual / en / function . asio - enter - context . php \ n * ) \ n * \ n * DEPRECATED : does nothing \ n * \ n * / " , <nl> - ( const char * ) 0x8 / * KindOfNull * / , NULL , <nl> - NULL , <nl> - NULL , <nl> - ( const char * ) 0x10006040 , " asio_exit_context " , " " , ( const char * ) 0 , ( const char * ) 0 , <nl> - " / * * \ n * ( excerpt from http : / / php . net / manual / en / function . asio - exit - context . php ) \ n * \ n * DEPRECATED : does nothing \ n * \ n * / " , <nl> - ( const char * ) 0x8 / * KindOfNull * / , NULL , <nl> - NULL , <nl> - NULL , <nl> ( const char * ) 0x10006040 , " asio_get_current_context_idx " , " " , ( const char * ) 0 , ( const char * ) 0 , <nl> " / * * \ n * ( excerpt from \ n * http : / / php . net / manual / en / function . asio - get - current - context - idx . php ) \ n * \ n * Get index of the current scheduler context , or 0 if there is none \ n * \ n * @ return int An index of the current scheduler context \ n * / " , <nl> ( const char * ) 0xa / * KindOfInt64 * / , NULL , <nl> const char * g_class_map [ ] = { <nl> ( const char * ) 0x40 / * KindOfObject * / , NULL , <nl> NULL , <nl> NULL , <nl> - ( const char * ) 0x10006040 , " asio_get_current " , " " , ( const char * ) 0 , ( const char * ) 0 , <nl> - " / * * \ n * ( excerpt from http : / / php . net / manual / en / function . asio - get - current . php ) \ n * \ n * DEPRECATED : use asio_get_running \ n * \ n * @ return object A ContinuationWaitHandle that is running in the \ n * current context \ n * / " , <nl> - ( const char * ) 0x40 / * KindOfObject * / , NULL , <nl> - NULL , <nl> - NULL , <nl> ( const char * ) 0x10006040 , " asio_set_on_failed_callback " , " " , ( const char * ) 0 , ( const char * ) 0 , <nl> " / * * \ n * ( excerpt from \ n * http : / / php . net / manual / en / function . asio - set - on - failed - callback . php ) \ n * \ n * Set callback to be called when wait handle fails \ n * \ n * @ on_failed_cb \ n * mixed A Closure to be called when wait handle fails \ n * / " , <nl> ( const char * ) 0x8 / * KindOfNull * / , ( const char * ) 0x2000 , " on_failed_cb " , " " , ( const char * ) 0xffffffff / * KindOfUnknown : $ t : Variant * / , " " , ( const char * ) 0 , " " , ( const char * ) 0 , NULL , <nl> mmm a / hphp / test / test_ext_asio . cpp <nl> ppp b / hphp / test / test_ext_asio . cpp <nl> IMPLEMENT_SEP_EXTENSION_TEST ( Asio ) ; <nl> bool TestExtAsio : : RunTests ( const std : : string & which ) { <nl> bool ret = true ; <nl> <nl> - RUN_TEST ( test_asio_enter_context ) ; <nl> - RUN_TEST ( test_asio_exit_context ) ; <nl> - RUN_TEST ( test_asio_get_current ) ; <nl> RUN_TEST ( test_asio_set_on_failed_callback ) ; <nl> RUN_TEST ( test_WaitHandle ) ; <nl> RUN_TEST ( test_StaticWaitHandle ) ; <nl> bool TestExtAsio : : RunTests ( const std : : string & which ) { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - bool TestExtAsio : : test_asio_enter_context ( ) { <nl> - return Count ( true ) ; <nl> - } <nl> - <nl> - bool TestExtAsio : : test_asio_exit_context ( ) { <nl> - return Count ( true ) ; <nl> - } <nl> - <nl> - bool TestExtAsio : : test_asio_get_current ( ) { <nl> - return Count ( true ) ; <nl> - } <nl> - <nl> bool TestExtAsio : : test_asio_set_on_failed_callback ( ) { <nl> return Count ( true ) ; <nl> } <nl>
Remove deprecated asio_ * methods
facebook/hhvm
102c37cdcb9ffd7ecb5dffba5283030c03f101a9
2013-05-02T03:59:45Z
mmm a / php / tests / undefined_test . php <nl> ppp b / php / tests / undefined_test . php <nl> public function testMessageSetOtherMessageValueFail ( ) <nl> / * * <nl> * @ expectedException PHPUnit_Framework_Error <nl> * / <nl> - public function testMessageSetNullFail ( ) <nl> + public function testMessageSetNullFailMap ( ) <nl> { <nl> $ arr = <nl> new MapField ( GPBType : : INT32 , GPBType : : MESSAGE , TestMessage : : class ) ; <nl>
rename duplicate testMessageSetNullFail function ( )
protocolbuffers/protobuf
d65d5821bc76a5e43bfac0a227d970f5bc88b789
2018-06-25T21:57:40Z
mmm a / src / python / grpcio / grpc / __init__ . py <nl> ppp b / src / python / grpcio / grpc / __init__ . py <nl> class FutureCancelledError ( Exception ) : <nl> class Future ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> " " " A representation of a computation in another control flow . <nl> <nl> - Computations represented by a Future may be yet to be begun , may be ongoing , <nl> - or may have already completed . <nl> - " " " <nl> + Computations represented by a Future may be yet to be begun , <nl> + may be ongoing , or may have already completed . <nl> + " " " <nl> <nl> @ abc . abstractmethod <nl> def cancel ( self ) : <nl> " " " Attempts to cancel the computation . <nl> <nl> - This method does not block . <nl> + This method does not block . <nl> <nl> - Returns : <nl> - bool : <nl> - Returns True if the computation was canceled . <nl> - Returns False under all other circumstances , for example : <nl> - 1 . computation has begun and could not be canceled . <nl> - 2 . computation has finished <nl> - 3 . computation is scheduled for execution and it is impossible to <nl> - determine its state without blocking . <nl> - " " " <nl> + Returns : <nl> + bool : <nl> + Returns True if the computation was canceled . <nl> + Returns False under all other circumstances , for example : <nl> + 1 . computation has begun and could not be canceled . <nl> + 2 . computation has finished <nl> + 3 . computation is scheduled for execution and it is impossible <nl> + to determine its state without blocking . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def cancelled ( self ) : <nl> " " " Describes whether the computation was cancelled . <nl> <nl> - This method does not block . <nl> + This method does not block . <nl> <nl> - Returns : <nl> - bool : <nl> - Returns True if the computation was cancelled before its result became <nl> - available . <nl> - False under all other circumstances , for example : <nl> - 1 . computation was not cancelled . <nl> - 2 . computation ' s result is available . <nl> - " " " <nl> + Returns : <nl> + bool : <nl> + Returns True if the computation was cancelled before its result became <nl> + available . <nl> + False under all other circumstances , for example : <nl> + 1 . computation was not cancelled . <nl> + 2 . computation ' s result is available . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def running ( self ) : <nl> " " " Describes whether the computation is taking place . <nl> <nl> - This method does not block . <nl> + This method does not block . <nl> <nl> - Returns : <nl> - bool : <nl> - Returns True if the computation is scheduled for execution or currently <nl> - executing . <nl> - Returns False if the computation already executed or was cancelled . <nl> - " " " <nl> + Returns : <nl> + bool : <nl> + Returns True if the computation is scheduled for execution or <nl> + currently executing . <nl> + Returns False if the computation already executed or was cancelled . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def done ( self ) : <nl> " " " Describes whether the computation has taken place . <nl> <nl> - This method does not block . <nl> + This method does not block . <nl> <nl> - Returns : <nl> - bool : <nl> - Returns True if the computation already executed or was cancelled . <nl> - Returns False if the computation is scheduled for execution or currently <nl> - executing . <nl> - This is exactly opposite of the running ( ) method ' s result . <nl> - " " " <nl> + Returns : <nl> + bool : <nl> + Returns True if the computation already executed or was cancelled . <nl> + Returns False if the computation is scheduled for execution or <nl> + currently executing . <nl> + This is exactly opposite of the running ( ) method ' s result . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def result ( self , timeout = None ) : <nl> " " " Returns the result of the computation or raises its exception . <nl> <nl> - This method may return immediately or may block . <nl> + This method may return immediately or may block . <nl> <nl> - Args : <nl> - timeout : The length of time in seconds to wait for the computation to <nl> - finish or be cancelled . If None , the call will block until the <nl> - computations ' s termination . <nl> + Args : <nl> + timeout : The length of time in seconds to wait for the computation to <nl> + finish or be cancelled . If None , the call will block until the <nl> + computations ' s termination . <nl> <nl> - Returns : <nl> - The return value of the computation . <nl> + Returns : <nl> + The return value of the computation . <nl> <nl> - Raises : <nl> - FutureTimeoutError : If a timeout value is passed and the computation does <nl> - not terminate within the allotted time . <nl> - FutureCancelledError : If the computation was cancelled . <nl> - Exception : If the computation raised an exception , this call will raise <nl> - the same exception . <nl> - " " " <nl> + Raises : <nl> + FutureTimeoutError : If a timeout value is passed and the computation <nl> + does not terminate within the allotted time . <nl> + FutureCancelledError : If the computation was cancelled . <nl> + Exception : If the computation raised an exception , this call will <nl> + raise the same exception . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def exception ( self , timeout = None ) : <nl> " " " Return the exception raised by the computation . <nl> <nl> - This method may return immediately or may block . <nl> + This method may return immediately or may block . <nl> <nl> - Args : <nl> - timeout : The length of time in seconds to wait for the computation to <nl> - terminate or be cancelled . If None , the call will block until the <nl> - computations ' s termination . <nl> + Args : <nl> + timeout : The length of time in seconds to wait for the computation to <nl> + terminate or be cancelled . If None , the call will block until the <nl> + computations ' s termination . <nl> <nl> - Returns : <nl> - The exception raised by the computation , or None if the computation did <nl> - not raise an exception . <nl> + Returns : <nl> + The exception raised by the computation , or None if the computation <nl> + did not raise an exception . <nl> <nl> - Raises : <nl> - FutureTimeoutError : If a timeout value is passed and the computation does <nl> - not terminate within the allotted time . <nl> - FutureCancelledError : If the computation was cancelled . <nl> - " " " <nl> + Raises : <nl> + FutureTimeoutError : If a timeout value is passed and the computation <nl> + does not terminate within the allotted time . <nl> + FutureCancelledError : If the computation was cancelled . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def traceback ( self , timeout = None ) : <nl> " " " Access the traceback of the exception raised by the computation . <nl> <nl> - This method may return immediately or may block . <nl> + This method may return immediately or may block . <nl> <nl> - Args : <nl> - timeout : The length of time in seconds to wait for the computation to <nl> - terminate or be cancelled . If None , the call will block until the <nl> - computations ' s termination . <nl> + Args : <nl> + timeout : The length of time in seconds to wait for the computation <nl> + to terminate or be cancelled . If None , the call will block until <nl> + the computation ' s termination . <nl> <nl> - Returns : <nl> - The traceback of the exception raised by the computation , or None if the <nl> - computation did not raise an exception . <nl> + Returns : <nl> + The traceback of the exception raised by the computation , or None <nl> + if the computation did not raise an exception . <nl> <nl> - Raises : <nl> - FutureTimeoutError : If a timeout value is passed and the computation does <nl> - not terminate within the allotted time . <nl> - FutureCancelledError : If the computation was cancelled . <nl> - " " " <nl> + Raises : <nl> + FutureTimeoutError : If a timeout value is passed and the computation <nl> + does not terminate within the allotted time . <nl> + FutureCancelledError : If the computation was cancelled . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def add_done_callback ( self , fn ) : <nl> " " " Adds a function to be called at completion of the computation . <nl> <nl> - The callback will be passed this Future object describing the outcome of <nl> - the computation . <nl> + The callback will be passed this Future object describing the outcome <nl> + of the computation . <nl> <nl> - If the computation has already completed , the callback will be called <nl> - immediately . <nl> + If the computation has already completed , the callback will be called <nl> + immediately . <nl> <nl> - Args : <nl> - fn : A callable taking this Future object as its single parameter . <nl> - " " " <nl> + Args : <nl> + fn : A callable taking this Future object as its single parameter . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> def add_done_callback ( self , fn ) : <nl> class ChannelConnectivity ( enum . Enum ) : <nl> " " " Mirrors grpc_connectivity_state in the gRPC Core . <nl> <nl> - Attributes : <nl> - IDLE : The channel is idle . <nl> - CONNECTING : The channel is connecting . <nl> - READY : The channel is ready to conduct RPCs . <nl> - TRANSIENT_FAILURE : The channel has seen a failure from which it expects to <nl> - recover . <nl> - SHUTDOWN : The channel has seen a failure from which it cannot recover . <nl> - " " " <nl> + Attributes : <nl> + IDLE : The channel is idle . <nl> + CONNECTING : The channel is connecting . <nl> + READY : The channel is ready to conduct RPCs . <nl> + TRANSIENT_FAILURE : The channel has seen a failure from which it expects <nl> + to recover . <nl> + SHUTDOWN : The channel has seen a failure from which it cannot recover . <nl> + " " " <nl> IDLE = ( _cygrpc . ConnectivityState . idle , ' idle ' ) <nl> CONNECTING = ( _cygrpc . ConnectivityState . connecting , ' connecting ' ) <nl> READY = ( _cygrpc . ConnectivityState . ready , ' ready ' ) <nl> class RpcContext ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> def is_active ( self ) : <nl> " " " Describes whether the RPC is active or has terminated . <nl> <nl> - Returns : <nl> - bool : <nl> - True if RPC is active , False otherwise . <nl> - " " " <nl> + Returns : <nl> + bool : <nl> + True if RPC is active , False otherwise . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def time_remaining ( self ) : <nl> " " " Describes the length of allowed time remaining for the RPC . <nl> <nl> - Returns : <nl> - A nonnegative float indicating the length of allowed time in seconds <nl> - remaining for the RPC to complete before it is considered to have timed <nl> - out , or None if no deadline was specified for the RPC . <nl> - " " " <nl> + Returns : <nl> + A nonnegative float indicating the length of allowed time in seconds <nl> + remaining for the RPC to complete before it is considered to have <nl> + timed out , or None if no deadline was specified for the RPC . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def cancel ( self ) : <nl> " " " Cancels the RPC . <nl> <nl> - Idempotent and has no effect if the RPC has already terminated . <nl> - " " " <nl> + Idempotent and has no effect if the RPC has already terminated . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def add_callback ( self , callback ) : <nl> " " " Registers a callback to be called on RPC termination . <nl> <nl> - Args : <nl> - callback : A no - parameter callable to be called on RPC termination . <nl> + Args : <nl> + callback : A no - parameter callable to be called on RPC termination . <nl> <nl> - Returns : <nl> - bool : <nl> - True if the callback was added and will be called later ; False if the <nl> - callback was not added and will not be called ( because the RPC <nl> - already terminated or some other reason ) . <nl> - " " " <nl> + Returns : <nl> + bool : <nl> + True if the callback was added and will be called later ; False if <nl> + the callback was not added and will not be called ( because the RPC <nl> + already terminated or some other reason ) . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> class Call ( six . with_metaclass ( abc . ABCMeta , RpcContext ) ) : <nl> def initial_metadata ( self ) : <nl> " " " Accesses the initial metadata sent by the server . <nl> <nl> - This method blocks until the value is available . <nl> + This method blocks until the value is available . <nl> <nl> - Returns : <nl> - The initial : term : ` metadata ` . <nl> - " " " <nl> + Returns : <nl> + The initial : term : ` metadata ` . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def trailing_metadata ( self ) : <nl> " " " Accesses the trailing metadata sent by the server . <nl> <nl> - This method blocks until the value is available . <nl> + This method blocks until the value is available . <nl> <nl> - Returns : <nl> - The trailing : term : ` metadata ` . <nl> - " " " <nl> + Returns : <nl> + The trailing : term : ` metadata ` . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def code ( self ) : <nl> " " " Accesses the status code sent by the server . <nl> <nl> - This method blocks until the value is available . <nl> + This method blocks until the value is available . <nl> <nl> - Returns : <nl> - The StatusCode value for the RPC . <nl> - " " " <nl> + Returns : <nl> + The StatusCode value for the RPC . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def details ( self ) : <nl> " " " Accesses the details sent by the server . <nl> <nl> - This method blocks until the value is available . <nl> + This method blocks until the value is available . <nl> <nl> - Returns : <nl> - The details string of the RPC . <nl> - " " " <nl> + Returns : <nl> + The details string of the RPC . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> def __call__ ( self , context , callback ) : <nl> class ServerCredentials ( object ) : <nl> " " " An encapsulation of the data required to open a secure port on a Server . <nl> <nl> - This class has no supported interface - it exists to define the type of its <nl> - instances and its instances exist to be passed to other functions . <nl> - " " " <nl> + This class has no supported interface - it exists to define the type of its <nl> + instances and its instances exist to be passed to other functions . <nl> + " " " <nl> <nl> def __init__ ( self , credentials ) : <nl> self . _credentials = credentials <nl> class UnaryUnaryMultiCallable ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> def __call__ ( self , request , timeout = None , metadata = None , credentials = None ) : <nl> " " " Synchronously invokes the underlying RPC . <nl> <nl> - Args : <nl> - request : The request value for the RPC . <nl> - timeout : An optional duration of time in seconds to allow for the RPC . <nl> - metadata : Optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request : The request value for the RPC . <nl> + timeout : An optional duration of time in seconds to allow <nl> + for the RPC . <nl> + metadata : Optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - The response value for the RPC . <nl> + Returns : <nl> + The response value for the RPC . <nl> <nl> - Raises : <nl> - RpcError : Indicating that the RPC terminated with non - OK status . The <nl> - raised RpcError will also be a Call for the RPC affording the RPC ' s <nl> - metadata , status code , and details . <nl> - " " " <nl> + Raises : <nl> + RpcError : Indicating that the RPC terminated with non - OK status . The <nl> + raised RpcError will also be a Call for the RPC affording the RPC ' s <nl> + metadata , status code , and details . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def with_call ( self , request , timeout = None , metadata = None , credentials = None ) : <nl> " " " Synchronously invokes the underlying RPC . <nl> <nl> - Args : <nl> - request : The request value for the RPC . <nl> - timeout : An optional durating of time in seconds to allow for the RPC . <nl> - metadata : Optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request : The request value for the RPC . <nl> + timeout : An optional durating of time in seconds to allow for <nl> + the RPC . <nl> + metadata : Optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - The response value for the RPC and a Call value for the RPC . <nl> + Returns : <nl> + The response value for the RPC and a Call value for the RPC . <nl> <nl> - Raises : <nl> - RpcError : Indicating that the RPC terminated with non - OK status . The <nl> - raised RpcError will also be a Call for the RPC affording the RPC ' s <nl> - metadata , status code , and details . <nl> - " " " <nl> + Raises : <nl> + RpcError : Indicating that the RPC terminated with non - OK status . The <nl> + raised RpcError will also be a Call for the RPC affording the RPC ' s <nl> + metadata , status code , and details . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def future ( self , request , timeout = None , metadata = None , credentials = None ) : <nl> " " " Asynchronously invokes the underlying RPC . <nl> <nl> - Args : <nl> - request : The request value for the RPC . <nl> - timeout : An optional duration of time in seconds to allow for the RPC . <nl> - metadata : Optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request : The request value for the RPC . <nl> + timeout : An optional duration of time in seconds to allow for <nl> + the RPC . <nl> + metadata : Optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - An object that is both a Call for the RPC and a Future . In the event of <nl> - RPC completion , the return Call - Future ' s result value will be the <nl> - response message of the RPC . Should the event terminate with non - OK <nl> - status , the returned Call - Future ' s exception value will be an RpcError . <nl> - " " " <nl> + Returns : <nl> + An object that is both a Call for the RPC and a Future . <nl> + In the event of RPC completion , the return Call - Future ' s result <nl> + value will be the response message of the RPC . <nl> + Should the event terminate with non - OK status , <nl> + the returned Call - Future ' s exception value will be an RpcError . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> class UnaryStreamMultiCallable ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> def __call__ ( self , request , timeout = None , metadata = None , credentials = None ) : <nl> " " " Invokes the underlying RPC . <nl> <nl> - Args : <nl> - request : The request value for the RPC . <nl> - timeout : An optional duration of time in seconds to allow for the RPC . <nl> - If None , the timeout is considered infinite . <nl> - metadata : An optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request : The request value for the RPC . <nl> + timeout : An optional duration of time in seconds to allow for <nl> + the RPC . If None , the timeout is considered infinite . <nl> + metadata : An optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - An object that is both a Call for the RPC and an iterator of response <nl> - values . Drawing response values from the returned Call - iterator may <nl> - raise RpcError indicating termination of the RPC with non - OK status . <nl> - " " " <nl> + Returns : <nl> + An object that is both a Call for the RPC and an iterator of <nl> + response values . Drawing response values from the returned <nl> + Call - iterator may raise RpcError indicating termination of the <nl> + RPC with non - OK status . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> def __call__ ( self , <nl> credentials = None ) : <nl> " " " Synchronously invokes the underlying RPC . <nl> <nl> - Args : <nl> - request_iterator : An iterator that yields request values for the RPC . <nl> - timeout : An optional duration of time in seconds to allow for the RPC . <nl> - If None , the timeout is considered infinite . <nl> - metadata : Optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request_iterator : An iterator that yields request values for <nl> + the RPC . <nl> + timeout : An optional duration of time in seconds to allow for <nl> + the RPC . If None , the timeout is considered infinite . <nl> + metadata : Optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - The response value for the RPC . <nl> + Returns : <nl> + The response value for the RPC . <nl> <nl> - Raises : <nl> - RpcError : Indicating that the RPC terminated with non - OK status . The <nl> - raised RpcError will also implement grpc . Call , affording methods <nl> - such as metadata , code , and details . <nl> - " " " <nl> + Raises : <nl> + RpcError : Indicating that the RPC terminated with non - OK status . The <nl> + raised RpcError will also implement grpc . Call , affording methods <nl> + such as metadata , code , and details . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def with_call ( self , <nl> credentials = None ) : <nl> " " " Synchronously invokes the underlying RPC on the client . <nl> <nl> - Args : <nl> - request_iterator : An iterator that yields request values for the RPC . <nl> - timeout : An optional duration of time in seconds to allow for the RPC . <nl> - If None , the timeout is considered infinite . <nl> - metadata : Optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request_iterator : An iterator that yields request values for <nl> + the RPC . <nl> + timeout : An optional duration of time in seconds to allow for <nl> + the RPC . If None , the timeout is considered infinite . <nl> + metadata : Optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - The response value for the RPC and a Call object for the RPC . <nl> + Returns : <nl> + The response value for the RPC and a Call object for the RPC . <nl> <nl> - Raises : <nl> - RpcError : Indicating that the RPC terminated with non - OK status . The <nl> - raised RpcError will also be a Call for the RPC affording the RPC ' s <nl> - metadata , status code , and details . <nl> - " " " <nl> + Raises : <nl> + RpcError : Indicating that the RPC terminated with non - OK status . The <nl> + raised RpcError will also be a Call for the RPC affording the RPC ' s <nl> + metadata , status code , and details . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def future ( self , <nl> credentials = None ) : <nl> " " " Asynchronously invokes the underlying RPC on the client . <nl> <nl> - Args : <nl> - request_iterator : An iterator that yields request values for the RPC . <nl> - timeout : An optional duration of time in seconds to allow for the RPC . <nl> - If None , the timeout is considered infinite . <nl> - metadata : Optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request_iterator : An iterator that yields request values for the RPC . <nl> + timeout : An optional duration of time in seconds to allow for <nl> + the RPC . If None , the timeout is considered infinite . <nl> + metadata : Optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - An object that is both a Call for the RPC and a Future . In the event of <nl> - RPC completion , the return Call - Future ' s result value will be the <nl> - response message of the RPC . Should the event terminate with non - OK <nl> - status , the returned Call - Future ' s exception value will be an RpcError . <nl> - " " " <nl> + Returns : <nl> + An object that is both a Call for the RPC and a Future . <nl> + In the event of RPC completion , the return Call - Future ' s result value <nl> + will be the response message of the RPC . Should the event terminate <nl> + with non - OK status , the returned Call - Future ' s exception value will <nl> + be an RpcError . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> def __call__ ( self , <nl> credentials = None ) : <nl> " " " Invokes the underlying RPC on the client . <nl> <nl> - Args : <nl> - request_iterator : An iterator that yields request values for the RPC . <nl> - timeout : An optional duration of time in seconds to allow for the RPC . <nl> - if not specified the timeout is considered infinite . <nl> - metadata : Optional : term : ` metadata ` to be transmitted to the <nl> - service - side of the RPC . <nl> - credentials : An optional CallCredentials for the RPC . <nl> + Args : <nl> + request_iterator : An iterator that yields request values for the RPC . <nl> + timeout : An optional duration of time in seconds to allow for <nl> + the RPC . If not specified , the timeout is considered infinite . <nl> + metadata : Optional : term : ` metadata ` to be transmitted to the <nl> + service - side of the RPC . <nl> + credentials : An optional CallCredentials for the RPC . <nl> <nl> - Returns : <nl> - An object that is both a Call for the RPC and an iterator of response <nl> - values . Drawing response values from the returned Call - iterator may <nl> - raise RpcError indicating termination of the RPC with non - OK status . <nl> - " " " <nl> + Returns : <nl> + An object that is both a Call for the RPC and an iterator of <nl> + response values . Drawing response values from the returned <nl> + Call - iterator may raise RpcError indicating termination of the <nl> + RPC with non - OK status . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> class Channel ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> def subscribe ( self , callback , try_to_connect = False ) : <nl> " " " Subscribe to this Channel ' s connectivity state machine . <nl> <nl> - A Channel may be in any of the states described by ChannelConnectivity . <nl> - This method allows application to monitor the state transitions . <nl> - The typical use case is to debug or gain better visibility into gRPC <nl> - runtime ' s state . <nl> + A Channel may be in any of the states described by ChannelConnectivity . <nl> + This method allows application to monitor the state transitions . <nl> + The typical use case is to debug or gain better visibility into gRPC <nl> + runtime ' s state . <nl> <nl> - Args : <nl> - callback : A callable to be invoked with ChannelConnectivity argument . <nl> - ChannelConnectivity describes current state of the channel . <nl> - The callable will be invoked immediately upon subscription and again for <nl> - every change to ChannelConnectivity until it is unsubscribed or this <nl> - Channel object goes out of scope . <nl> - try_to_connect : A boolean indicating whether or not this Channel should <nl> - attempt to connect immediately . If set to False , gRPC runtime decides <nl> - when to connect . <nl> - " " " <nl> + Args : <nl> + callback : A callable to be invoked with ChannelConnectivity argument . <nl> + ChannelConnectivity describes current state of the channel . <nl> + The callable will be invoked immediately upon subscription <nl> + and again for every change to ChannelConnectivity until it <nl> + is unsubscribed or this Channel object goes out of scope . <nl> + try_to_connect : A boolean indicating whether or not this Channel <nl> + should attempt to connect immediately . If set to False , gRPC <nl> + runtime decides when to connect . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def unsubscribe ( self , callback ) : <nl> " " " Unsubscribes a subscribed callback from this Channel ' s connectivity . <nl> <nl> - Args : <nl> - callback : A callable previously registered with this Channel from having <nl> - been passed to its " subscribe " method . <nl> - " " " <nl> + Args : <nl> + callback : A callable previously registered with this Channel from <nl> + having been passed to its " subscribe " method . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def unary_unary ( self , <nl> response_deserializer = None ) : <nl> " " " Creates a UnaryUnaryMultiCallable for a unary - unary method . <nl> <nl> - Args : <nl> - method : The name of the RPC method . <nl> - request_serializer : Optional behaviour for serializing the request <nl> - message . Request goes unserialized in case None is passed . <nl> - response_deserializer : Optional behaviour for deserializing the response <nl> - message . Response goes undeserialized in case None is passed . <nl> + Args : <nl> + method : The name of the RPC method . <nl> + request_serializer : Optional behaviour for serializing the request <nl> + message . Request goes unserialized in case None is passed . <nl> + response_deserializer : Optional behaviour for deserializing the <nl> + response message . Response goes undeserialized in case None <nl> + is passed . <nl> <nl> - Returns : <nl> - A UnaryUnaryMultiCallable value for the named unary - unary method . <nl> - " " " <nl> + Returns : <nl> + A UnaryUnaryMultiCallable value for the named unary - unary method . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def unary_stream ( self , <nl> response_deserializer = None ) : <nl> " " " Creates a UnaryStreamMultiCallable for a unary - stream method . <nl> <nl> - Args : <nl> - method : The name of the RPC method . <nl> - request_serializer : Optional behaviour for serializing the request <nl> - message . Request goes unserialized in case None is passed . <nl> - response_deserializer : Optional behaviour for deserializing the response <nl> - message . Response goes undeserialized in case None is passed . <nl> + Args : <nl> + method : The name of the RPC method . <nl> + request_serializer : Optional behaviour for serializing the request <nl> + message . Request goes unserialized in case None is passed . <nl> + response_deserializer : Optional behaviour for deserializing the <nl> + response message . Response goes undeserialized in case None is <nl> + passed . <nl> <nl> - Returns : <nl> - A UnaryStreamMultiCallable value for the name unary - stream method . <nl> - " " " <nl> + Returns : <nl> + A UnaryStreamMultiCallable value for the name unary - stream method . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def stream_unary ( self , <nl> response_deserializer = None ) : <nl> " " " Creates a StreamUnaryMultiCallable for a stream - unary method . <nl> <nl> - Args : <nl> - method : The name of the RPC method . <nl> - request_serializer : Optional behaviour for serializing the request <nl> - message . Request goes unserialized in case None is passed . <nl> - response_deserializer : Optional behaviour for deserializing the response <nl> - message . Response goes undeserialized in case None is passed . <nl> + Args : <nl> + method : The name of the RPC method . <nl> + request_serializer : Optional behaviour for serializing the request <nl> + message . Request goes unserialized in case None is passed . <nl> + response_deserializer : Optional behaviour for deserializing the <nl> + response message . Response goes undeserialized in case None is <nl> + passed . <nl> <nl> - Returns : <nl> - A StreamUnaryMultiCallable value for the named stream - unary method . <nl> - " " " <nl> + Returns : <nl> + A StreamUnaryMultiCallable value for the named stream - unary method . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def stream_stream ( self , <nl> response_deserializer = None ) : <nl> " " " Creates a StreamStreamMultiCallable for a stream - stream method . <nl> <nl> - Args : <nl> - method : The name of the RPC method . <nl> - request_serializer : Optional behaviour for serializing the request <nl> - message . Request goes unserialized in case None is passed . <nl> - response_deserializer : Optional behaviour for deserializing the response <nl> - message . Response goes undeserialized in case None is passed . <nl> + Args : <nl> + method : The name of the RPC method . <nl> + request_serializer : Optional behaviour for serializing the request <nl> + message . Request goes unserialized in case None is passed . <nl> + response_deserializer : Optional behaviour for deserializing the <nl> + response message . Response goes undeserialized in case None <nl> + is passed . <nl> <nl> - Returns : <nl> - A StreamStreamMultiCallable value for the named stream - stream method . <nl> - " " " <nl> + Returns : <nl> + A StreamStreamMultiCallable value for the named stream - stream method . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> class ServicerContext ( six . with_metaclass ( abc . ABCMeta , RpcContext ) ) : <nl> def invocation_metadata ( self ) : <nl> " " " Accesses the metadata from the sent by the client . <nl> <nl> - Returns : <nl> - The invocation : term : ` metadata ` . <nl> - " " " <nl> + Returns : <nl> + The invocation : term : ` metadata ` . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def peer ( self ) : <nl> " " " Identifies the peer that invoked the RPC being serviced . <nl> <nl> - Returns : <nl> - A string identifying the peer that invoked the RPC being serviced . <nl> - The string format is determined by gRPC runtime . <nl> - " " " <nl> + Returns : <nl> + A string identifying the peer that invoked the RPC being serviced . <nl> + The string format is determined by gRPC runtime . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def peer_identities ( self ) : <nl> " " " Gets one or more peer identity ( s ) . <nl> <nl> - Equivalent to <nl> - servicer_context . auth_context ( ) . get ( <nl> - servicer_context . peer_identity_key ( ) ) <nl> + Equivalent to <nl> + servicer_context . auth_context ( ) . get ( <nl> + servicer_context . peer_identity_key ( ) ) <nl> <nl> - Returns : <nl> - An iterable of the identities , or None if the call is not authenticated . <nl> - Each identity is returned as a raw bytes type . <nl> - " " " <nl> + Returns : <nl> + An iterable of the identities , or None if the call is not <nl> + authenticated . Each identity is returned as a raw bytes type . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def peer_identity_key ( self ) : <nl> " " " The auth property used to identify the peer . <nl> <nl> - For example , " x509_common_name " or " x509_subject_alternative_name " are <nl> - used to identify an SSL peer . <nl> + For example , " x509_common_name " or " x509_subject_alternative_name " are <nl> + used to identify an SSL peer . <nl> <nl> - Returns : <nl> - The auth property ( string ) that indicates the <nl> - peer identity , or None if the call is not authenticated . <nl> - " " " <nl> + Returns : <nl> + The auth property ( string ) that indicates the <nl> + peer identity , or None if the call is not authenticated . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def auth_context ( self ) : <nl> " " " Gets the auth context for the call . <nl> <nl> - Returns : <nl> - A map of strings to an iterable of bytes for each auth property . <nl> - " " " <nl> + Returns : <nl> + A map of strings to an iterable of bytes for each auth property . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def send_initial_metadata ( self , initial_metadata ) : <nl> " " " Sends the initial metadata value to the client . <nl> <nl> - This method need not be called by implementations if they have no <nl> - metadata to add to what the gRPC runtime will transmit . <nl> + This method need not be called by implementations if they have no <nl> + metadata to add to what the gRPC runtime will transmit . <nl> <nl> - Args : <nl> - initial_metadata : The initial : term : ` metadata ` . <nl> - " " " <nl> + Args : <nl> + initial_metadata : The initial : term : ` metadata ` . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def set_trailing_metadata ( self , trailing_metadata ) : <nl> " " " Sends the trailing metadata for the RPC . <nl> <nl> - This method need not be called by implementations if they have no <nl> - metadata to add to what the gRPC runtime will transmit . <nl> + This method need not be called by implementations if they have no <nl> + metadata to add to what the gRPC runtime will transmit . <nl> <nl> - Args : <nl> - trailing_metadata : The trailing : term : ` metadata ` . <nl> - " " " <nl> + Args : <nl> + trailing_metadata : The trailing : term : ` metadata ` . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def set_details ( self , details ) : <nl> class RpcMethodHandler ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> " " " An implementation of a single RPC method . <nl> <nl> - Attributes : <nl> - request_streaming : Whether the RPC supports exactly one request message or <nl> - any arbitrary number of request messages . <nl> - response_streaming : Whether the RPC supports exactly one response message or <nl> - any arbitrary number of response messages . <nl> - request_deserializer : A callable behavior that accepts a byte string and <nl> - returns an object suitable to be passed to this object ' s business logic , <nl> - or None to indicate that this object ' s business logic should be passed the <nl> - raw request bytes . <nl> - response_serializer : A callable behavior that accepts an object produced by <nl> - this object ' s business logic and returns a byte string , or None to <nl> - indicate that the byte strings produced by this object ' s business logic <nl> - should be transmitted on the wire as they are . <nl> - unary_unary : This object ' s application - specific business logic as a callable <nl> - value that takes a request value and a ServicerContext object and returns <nl> - a response value . Only non - None if both request_streaming and <nl> - response_streaming are False . <nl> - unary_stream : This object ' s application - specific business logic as a <nl> - callable value that takes a request value and a ServicerContext object and <nl> - returns an iterator of response values . Only non - None if request_streaming <nl> - is False and response_streaming is True . <nl> - stream_unary : This object ' s application - specific business logic as a <nl> - callable value that takes an iterator of request values and a <nl> - ServicerContext object and returns a response value . Only non - None if <nl> - request_streaming is True and response_streaming is False . <nl> - stream_stream : This object ' s application - specific business logic as a <nl> - callable value that takes an iterator of request values and a <nl> - ServicerContext object and returns an iterator of response values . Only <nl> - non - None if request_streaming and response_streaming are both True . <nl> - " " " <nl> + Attributes : <nl> + request_streaming : Whether the RPC supports exactly one request message <nl> + or any arbitrary number of request messages . <nl> + response_streaming : Whether the RPC supports exactly one response message <nl> + or any arbitrary number of response messages . <nl> + request_deserializer : A callable behavior that accepts a byte string and <nl> + returns an object suitable to be passed to this object ' s business <nl> + logic , or None to indicate that this object ' s business logic should be <nl> + passed the raw request bytes . <nl> + response_serializer : A callable behavior that accepts an object produced <nl> + by this object ' s business logic and returns a byte string , or None to <nl> + indicate that the byte strings produced by this object ' s business logic <nl> + should be transmitted on the wire as they are . <nl> + unary_unary : This object ' s application - specific business logic as a <nl> + callable value that takes a request value and a ServicerContext object <nl> + and returns a response value . Only non - None if both request_streaming <nl> + and response_streaming are False . <nl> + unary_stream : This object ' s application - specific business logic as a <nl> + callable value that takes a request value and a ServicerContext object <nl> + and returns an iterator of response values . Only non - None if <nl> + request_streaming is False and response_streaming is True . <nl> + stream_unary : This object ' s application - specific business logic as a <nl> + callable value that takes an iterator of request values and a <nl> + ServicerContext object and returns a response value . Only non - None if <nl> + request_streaming is True and response_streaming is False . <nl> + stream_stream : This object ' s application - specific business logic as a <nl> + callable value that takes an iterator of request values and a <nl> + ServicerContext object and returns an iterator of response values . <nl> + Only non - None if request_streaming and response_streaming are both <nl> + True . <nl> + " " " <nl> <nl> <nl> class HandlerCallDetails ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> " " " Describes an RPC that has just arrived for service . <nl> - Attributes : <nl> - method : The method name of the RPC . <nl> - invocation_metadata : The : term : ` metadata ` sent by the client . <nl> - " " " <nl> + Attributes : <nl> + method : The method name of the RPC . <nl> + invocation_metadata : The : term : ` metadata ` sent by the client . <nl> + " " " <nl> <nl> <nl> class GenericRpcHandler ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> class GenericRpcHandler ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> def service ( self , handler_call_details ) : <nl> " " " Returns the handler for servicing the RPC . <nl> <nl> - Args : <nl> - handler_call_details : A HandlerCallDetails describing the RPC . <nl> + Args : <nl> + handler_call_details : A HandlerCallDetails describing the RPC . <nl> <nl> - Returns : <nl> - An RpcMethodHandler with which the RPC may be serviced if the <nl> - implementation chooses to service this RPC , or None otherwise . <nl> - " " " <nl> + Returns : <nl> + An RpcMethodHandler with which the RPC may be serviced if the <nl> + implementation chooses to service this RPC , or None otherwise . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> class ServiceRpcHandler ( six . with_metaclass ( abc . ABCMeta , GenericRpcHandler ) ) : <nl> " " " An implementation of RPC methods belonging to a service . <nl> <nl> - A service handles RPC methods with structured names of the form <nl> - ' / Service . Name / Service . Method ' , where ' Service . Name ' is the value <nl> - returned by service_name ( ) , and ' Service . Method ' is the method <nl> - name . A service can have multiple method names , but only a single <nl> - service name . <nl> - " " " <nl> + A service handles RPC methods with structured names of the form <nl> + ' / Service . Name / Service . Method ' , where ' Service . Name ' is the value <nl> + returned by service_name ( ) , and ' Service . Method ' is the method <nl> + name . A service can have multiple method names , but only a single <nl> + service name . <nl> + " " " <nl> <nl> @ abc . abstractmethod <nl> def service_name ( self ) : <nl> " " " Returns this service ' s name . <nl> <nl> - Returns : <nl> - The service name . <nl> - " " " <nl> + Returns : <nl> + The service name . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> class Server ( six . with_metaclass ( abc . ABCMeta ) ) : <nl> def add_generic_rpc_handlers ( self , generic_rpc_handlers ) : <nl> " " " Registers GenericRpcHandlers with this Server . <nl> <nl> - This method is only safe to call before the server is started . <nl> + This method is only safe to call before the server is started . <nl> <nl> - Args : <nl> - generic_rpc_handlers : An iterable of GenericRpcHandlers that will be used <nl> - to service RPCs . <nl> - " " " <nl> + Args : <nl> + generic_rpc_handlers : An iterable of GenericRpcHandlers that will be <nl> + used to service RPCs . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def add_insecure_port ( self , address ) : <nl> " " " Opens an insecure port for accepting RPCs . <nl> <nl> - This method may only be called before starting the server . <nl> + This method may only be called before starting the server . <nl> <nl> - Args : <nl> - address : The address for which to open a port . <nl> - if the port is 0 , or not specified in the address , then gRPC runtime <nl> - will choose a port . <nl> + Args : <nl> + address : The address for which to open a port . <nl> + if the port is 0 , or not specified in the address , then gRPC runtime <nl> + will choose a port . <nl> <nl> - Returns : <nl> - integer : <nl> - An integer port on which server will accept RPC requests . <nl> - " " " <nl> + Returns : <nl> + integer : <nl> + An integer port on which server will accept RPC requests . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def add_secure_port ( self , address , server_credentials ) : <nl> " " " Opens a secure port for accepting RPCs . <nl> <nl> - This method may only be called before starting the server . <nl> + This method may only be called before starting the server . <nl> <nl> - Args : <nl> - address : The address for which to open a port . <nl> - if the port is 0 , or not specified in the address , then gRPC runtime <nl> - will choose a port . <nl> - server_credentials : A ServerCredentials object . <nl> + Args : <nl> + address : The address for which to open a port . <nl> + if the port is 0 , or not specified in the address , then gRPC <nl> + runtime will choose a port . <nl> + server_credentials : A ServerCredentials object . <nl> <nl> - Returns : <nl> - integer : <nl> - An integer port on which server will accept RPC requests . <nl> - " " " <nl> + Returns : <nl> + integer : <nl> + An integer port on which server will accept RPC requests . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def start ( self ) : <nl> " " " Starts this Server . <nl> <nl> - This method may only be called once . ( i . e . it is not idempotent ) . <nl> - " " " <nl> + This method may only be called once . ( i . e . it is not idempotent ) . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> @ abc . abstractmethod <nl> def stop ( self , grace ) : <nl> " " " Stops this Server . <nl> <nl> - This method immediately stop service of new RPCs in all cases . <nl> - If a grace period is specified , this method returns immediately <nl> - and all RPCs active at the end of the grace period are aborted . <nl> + This method immediately stop service of new RPCs in all cases . <nl> + If a grace period is specified , this method returns immediately <nl> + and all RPCs active at the end of the grace period are aborted . <nl> <nl> - If a grace period is not specified , then all existing RPCs are <nl> - teriminated immediately and the this method blocks until the last <nl> - RPC handler terminates . <nl> + If a grace period is not specified , then all existing RPCs are <nl> + teriminated immediately and the this method blocks until the last <nl> + RPC handler terminates . <nl> <nl> - This method is idempotent and may be called at any time . Passing a smaller <nl> - grace value in subsequentcall will have the effect of stopping the Server <nl> - sooner . Passing a larger grace value in subsequent call * will not * have the <nl> - effect of stopping the server later ( i . e . the most restrictive grace <nl> - value is used ) . <nl> + This method is idempotent and may be called at any time . <nl> + Passing a smaller grace value in subsequent call will have <nl> + the effect of stopping the Server sooner . Passing a larger <nl> + grace value in subsequent call * will not * have the effect of <nl> + stopping the server later ( i . e . the most restrictive grace <nl> + value is used ) . <nl> <nl> - Args : <nl> - grace : A duration of time in seconds or None . <nl> + Args : <nl> + grace : A duration of time in seconds or None . <nl> <nl> - Returns : <nl> - A threading . Event that will be set when this Server has completely <nl> - stopped , i . e . when running RPCs either complete or are aborted and <nl> - all handlers have terminated . <nl> - " " " <nl> + Returns : <nl> + A threading . Event that will be set when this Server has completely <nl> + stopped , i . e . when running RPCs either complete or are aborted and <nl> + all handlers have terminated . <nl> + " " " <nl> raise NotImplementedError ( ) <nl> <nl> <nl> def unary_unary_rpc_method_handler ( behavior , <nl> response_serializer = None ) : <nl> " " " Creates an RpcMethodHandler for a unary - unary RPC method . <nl> <nl> - Args : <nl> - behavior : The implementation of an RPC that accepts one request and returns <nl> - one response . <nl> - request_deserializer : An optional behavior for request deserialization . <nl> - response_serializer : An optional behavior for response serialization . <nl> + Args : <nl> + behavior : The implementation of an RPC that accepts one request <nl> + and returns one response . <nl> + request_deserializer : An optional behavior for request deserialization . <nl> + response_serializer : An optional behavior for response serialization . <nl> <nl> - Returns : <nl> - An RpcMethodHandler object that is typically used by grpc . Server . <nl> - " " " <nl> + Returns : <nl> + An RpcMethodHandler object that is typically used by grpc . Server . <nl> + " " " <nl> from grpc import _utilities # pylint : disable = cyclic - import <nl> return _utilities . RpcMethodHandler ( False , False , request_deserializer , <nl> response_serializer , behavior , None , <nl> def unary_stream_rpc_method_handler ( behavior , <nl> response_serializer = None ) : <nl> " " " Creates an RpcMethodHandler for a unary - stream RPC method . <nl> <nl> - Args : <nl> - behavior : The implementation of an RPC that accepts one request and returns <nl> - an iterator of response values . <nl> - request_deserializer : An optional behavior for request deserialization . <nl> - response_serializer : An optional behavior for response serialization . <nl> + Args : <nl> + behavior : The implementation of an RPC that accepts one request <nl> + and returns an iterator of response values . <nl> + request_deserializer : An optional behavior for request deserialization . <nl> + response_serializer : An optional behavior for response serialization . <nl> <nl> - Returns : <nl> - An RpcMethodHandler object that is typically used by grpc . Server . <nl> - " " " <nl> + Returns : <nl> + An RpcMethodHandler object that is typically used by grpc . Server . <nl> + " " " <nl> from grpc import _utilities # pylint : disable = cyclic - import <nl> return _utilities . RpcMethodHandler ( False , True , request_deserializer , <nl> response_serializer , None , behavior , <nl> def stream_unary_rpc_method_handler ( behavior , <nl> response_serializer = None ) : <nl> " " " Creates an RpcMethodHandler for a stream - unary RPC method . <nl> <nl> - Args : <nl> - behavior : The implementation of an RPC that accepts an iterator of request <nl> - values and returns a single response value . <nl> - request_deserializer : An optional behavior for request deserialization . <nl> - response_serializer : An optional behavior for response serialization . <nl> + Args : <nl> + behavior : The implementation of an RPC that accepts an iterator of <nl> + request values and returns a single response value . <nl> + request_deserializer : An optional behavior for request deserialization . <nl> + response_serializer : An optional behavior for response serialization . <nl> <nl> - Returns : <nl> - An RpcMethodHandler object that is typically used by grpc . Server . <nl> - " " " <nl> + Returns : <nl> + An RpcMethodHandler object that is typically used by grpc . Server . <nl> + " " " <nl> from grpc import _utilities # pylint : disable = cyclic - import <nl> return _utilities . RpcMethodHandler ( True , False , request_deserializer , <nl> response_serializer , None , None , <nl> def stream_stream_rpc_method_handler ( behavior , <nl> response_serializer = None ) : <nl> " " " Creates an RpcMethodHandler for a stream - stream RPC method . <nl> <nl> - Args : <nl> - behavior : The implementation of an RPC that accepts an iterator of request <nl> - values and returns an iterator of response values . <nl> - request_deserializer : An optional behavior for request deserialization . <nl> - response_serializer : An optional behavior for response serialization . <nl> + Args : <nl> + behavior : The implementation of an RPC that accepts an iterator of <nl> + request values and returns an iterator of response values . <nl> + request_deserializer : An optional behavior for request deserialization . <nl> + response_serializer : An optional behavior for response serialization . <nl> <nl> - Returns : <nl> - An RpcMethodHandler object that is typically used by grpc . Server . <nl> - " " " <nl> + Returns : <nl> + An RpcMethodHandler object that is typically used by grpc . Server . <nl> + " " " <nl> from grpc import _utilities # pylint : disable = cyclic - import <nl> return _utilities . RpcMethodHandler ( True , True , request_deserializer , <nl> response_serializer , None , None , None , <nl> def stream_stream_rpc_method_handler ( behavior , <nl> def method_handlers_generic_handler ( service , method_handlers ) : <nl> " " " Creates a GenericRpcHandler from RpcMethodHandlers . <nl> <nl> - Args : <nl> - service : The name of the service that is implemented by the method_handlers . <nl> - method_handlers : A dictionary that maps method names to corresponding <nl> - RpcMethodHandler . <nl> + Args : <nl> + service : The name of the service that is implemented by the <nl> + method_handlers . <nl> + method_handlers : A dictionary that maps method names to corresponding <nl> + RpcMethodHandler . <nl> <nl> - Returns : <nl> - A GenericRpcHandler . This is typically added to the grpc . Server object <nl> - with add_generic_rpc_handlers ( ) before starting the server . <nl> - " " " <nl> + Returns : <nl> + A GenericRpcHandler . This is typically added to the grpc . Server object <nl> + with add_generic_rpc_handlers ( ) before starting the server . <nl> + " " " <nl> from grpc import _utilities # pylint : disable = cyclic - import <nl> return _utilities . DictionaryGenericHandler ( service , method_handlers ) <nl> <nl> def ssl_server_credentials ( private_key_certificate_chain_pairs , <nl> require_client_auth = False ) : <nl> " " " Creates a ServerCredentials for use with an SSL - enabled Server . <nl> <nl> - Args : <nl> - private_key_certificate_chain_pairs : A list of pairs of the form <nl> - [ PEM - encoded private key , PEM - encoded certificate chain ] . <nl> - root_certificates : An optional byte string of PEM - encoded client root <nl> - certificates that the server will use to verify client authentication . <nl> - If omitted , require_client_auth must also be False . <nl> - require_client_auth : A boolean indicating whether or not to require <nl> - clients to be authenticated . May only be True if root_certificates <nl> - is not None . <nl> - <nl> - Returns : <nl> - A ServerCredentials for use with an SSL - enabled Server . Typically , this <nl> - object is an argument to add_secure_port ( ) method during server setup . <nl> - " " " <nl> + Args : <nl> + private_key_certificate_chain_pairs : A list of pairs of the form <nl> + [ PEM - encoded private key , PEM - encoded certificate chain ] . <nl> + root_certificates : An optional byte string of PEM - encoded client root <nl> + certificates that the server will use to verify client authentication . <nl> + If omitted , require_client_auth must also be False . <nl> + require_client_auth : A boolean indicating whether or not to require <nl> + clients to be authenticated . May only be True if root_certificates <nl> + is not None . <nl> + <nl> + Returns : <nl> + A ServerCredentials for use with an SSL - enabled Server . Typically , this <nl> + object is an argument to add_secure_port ( ) method during server setup . <nl> + " " " <nl> if len ( private_key_certificate_chain_pairs ) = = 0 : <nl> raise ValueError ( <nl> ' At least one private key - certificate chain pair is required ! ' ) <nl> def dynamic_ssl_server_credentials ( initial_certificate_configuration , <nl> def channel_ready_future ( channel ) : <nl> " " " Creates a Future that tracks when a Channel is ready . <nl> <nl> - Cancelling the Future does not affect the channel ' s state machine . <nl> - It merely decouples the Future from channel state machine . <nl> + Cancelling the Future does not affect the channel ' s state machine . <nl> + It merely decouples the Future from channel state machine . <nl> <nl> - Args : <nl> - channel : A Channel object . <nl> + Args : <nl> + channel : A Channel object . <nl> <nl> - Returns : <nl> - A Future object that matures when the channel connectivity is <nl> - ChannelConnectivity . READY . <nl> - " " " <nl> + Returns : <nl> + A Future object that matures when the channel connectivity is <nl> + ChannelConnectivity . READY . <nl> + " " " <nl> from grpc import _utilities # pylint : disable = cyclic - import <nl> return _utilities . channel_ready_future ( channel ) <nl> <nl> def channel_ready_future ( channel ) : <nl> def insecure_channel ( target , options = None ) : <nl> " " " Creates an insecure Channel to a server . <nl> <nl> - Args : <nl> - target : The server address <nl> - options : An optional list of key - value pairs ( channel args in gRPC runtime ) <nl> - to configure the channel . <nl> + Args : <nl> + target : The server address <nl> + options : An optional list of key - value pairs ( channel args <nl> + in gRPC Core runtime ) to configure the channel . <nl> <nl> - Returns : <nl> - A Channel object . <nl> - " " " <nl> + Returns : <nl> + A Channel object . <nl> + " " " <nl> from grpc import _channel # pylint : disable = cyclic - import <nl> return _channel . Channel ( target , ( ) if options is None else options , None ) <nl> <nl> def insecure_channel ( target , options = None ) : <nl> def secure_channel ( target , credentials , options = None ) : <nl> " " " Creates a secure Channel to a server . <nl> <nl> - Args : <nl> - target : The server address . <nl> - credentials : A ChannelCredentials instance . <nl> - options : An optional list of key - value pairs ( channel args in gRPC runtime ) <nl> - to configure the channel . <nl> + Args : <nl> + target : The server address . <nl> + credentials : A ChannelCredentials instance . <nl> + options : An optional list of key - value pairs ( channel args <nl> + in gRPC Core runtime ) to configure the channel . <nl> <nl> - Returns : <nl> - A Channel object . <nl> - " " " <nl> + Returns : <nl> + A Channel object . <nl> + " " " <nl> from grpc import _channel # pylint : disable = cyclic - import <nl> return _channel . Channel ( target , ( ) if options is None else options , <nl> credentials . _credentials ) <nl>
Merge pull request from mehrdada / reformat - pydocstrings
grpc/grpc
7562c4eb6fbe7f7f1893ae7f828d1cad45aafe10
2018-01-18T03:55:49Z
mmm a / scripting / javascript / bindings / cocos2d_specifics . cpp . REMOVED . git - id <nl> ppp b / scripting / javascript / bindings / cocos2d_specifics . cpp . REMOVED . git - id <nl> @ @ - 1 + 1 @ @ <nl> - b38d2c580ab11cf5223b472d2ceb4518fc41b0de <nl> \ No newline at end of file <nl> + 732840b42077e8a3de8f8774bcaf60a69ef20c4e <nl> \ No newline at end of file <nl> mmm a / scripting / javascript / bindings / js_bindings_ccbreader . cpp <nl> ppp b / scripting / javascript / bindings / js_bindings_ccbreader . cpp <nl> JSBool js_CocosBuilder_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> <nl> } <nl> <nl> - extern JSObject * js_cocos2dx_CCBReader_prototype ; <nl> - extern JSObject * js_cocos2dx_CCBAnimationManager_prototype ; <nl> + extern JSObject * jsb_CCBReader_prototype ; <nl> + extern JSObject * jsb_CCBAnimationManager_prototype ; <nl> <nl> void register_CCBuilderReader ( JSContext * cx , JSObject * obj ) { <nl> jsval nsval ; <nl> void register_CCBuilderReader ( JSContext * cx , JSObject * obj ) { <nl> JS_DefineFunction ( cx , tmpObj , " create " , js_CocosBuilder_create , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> JS_DefineFunction ( cx , tmpObj , " loadScene " , js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> <nl> - JS_DefineFunction ( cx , js_cocos2dx_CCBReader_prototype , " load " , js_cocos2dx_CCBReader_readNodeGraphFromFile , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> - JS_DefineFunction ( cx , js_cocos2dx_CCBAnimationManager_prototype , " setCompletedAnimationCallback " , js_cocos2dx_CCBAnimationManager_animationCompleteCallback , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> + JS_DefineFunction ( cx , jsb_CCBReader_prototype , " load " , js_cocos2dx_CCBReader_readNodeGraphFromFile , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> + JS_DefineFunction ( cx , jsb_CCBAnimationManager_prototype , " setCompletedAnimationCallback " , js_cocos2dx_CCBAnimationManager_animationCompleteCallback , 2 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> } <nl> mmm a / tools / cxx - generator <nl> ppp b / tools / cxx - generator <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit ff1bd686c877b108c0738fee8f280c55fc9f20f3 <nl> + Subproject commit 0cc9a6b46adc1daa7c4cfe52a8358fe396d59078 <nl> mmm a / tools / tojs / cocos2dx - win32 . ini <nl> ppp b / tools / tojs / cocos2dx - win32 . ini <nl> headers = % ( cocosdir ) s / cocos2dx / include / cocos2d . h % ( cocosdir ) s / CocosDenshion / inc <nl> <nl> # what classes to produce code for . You can use regular expressions here . When testing the regular <nl> # expression , it will be enclosed in " ^ $ " , like this : " ^ CCMenu * $ " . <nl> - classes = CCSprite . * CCScene CCNode . * CCDirector CCLayer . * CCMenu . * CCTouch CC . * Action . * CCMove . * CCRotate . * CCBlink . * CCTint . * CCSequence CCRepeat . * CCFade . * CCEase . * CCScale . * CCTransition . * CCSpawn CCSequence CCAnimat . * CCFlip . * CCDelay . * CCSkew . * CCJump . * CCPlace . * CCShow . * CCProgress . * CCPointArray CCToggleVisibility . * CCHide CCParticle . * CCLabel . * CCAtlas . * CCTextureCache . * CCTexture2D CCCardinal . * CCCatmullRom . * CCParallaxNode CCTileMap . * CCTMX . * CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCBReader . * CCBAnimationManager . * CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit . * CCFollow . * CCBezier . * CCCardinalSpline . * CCControlButton . * CCCamera . * CCDrawNode CC . * 3D $ CCLiquid $ CCWaves $ CCShuffleTiles $ CCTurnOffTiles $ CCSplit . * CCTwirl $ CCFileUtils $ CCScrollView $ CCTableView $ CCTableViewCell $ <nl> + classes = CCSprite . * CCScene CCNode . * CCDirector CCLayer . * CCMenu . * CCTouch CC . * Action . * CCMove . * CCRotate . * CCBlink . * CCTint . * CCSequence CCRepeat . * CCFade . * CCEase . * CCScale . * CCTransition . * CCSpawn CCSequence CCAnimat . * CCFlip . * CCDelay . * CCSkew . * CCJump . * CCPlace . * CCShow . * CCProgress . * CCPointArray CCToggleVisibility . * CCHide CCParticle . * CCLabel . * CCAtlas . * CCTextureCache . * CCTexture2D CCCardinal . * CCCatmullRom . * CCParallaxNode CCTileMap . * CCTMX . * CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCGridBase $ CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCBReader . * CCBAnimationManager . * CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit . * CCFollow . * CCBezier . * CCCardinalSpline . * CCControl $ CCControlButton . * CCCamera . * CCDrawNode CC . * 3D $ CCLiquid $ CCWaves $ CCShuffleTiles $ CCTurnOffTiles $ CCSplit . * CCTwirl $ CCFileUtils $ CCScrollView $ CCTableView $ CCTableViewCell $ <nl> <nl> # what should we skip ? in the format ClassName : : [ function function ] <nl> # ClassName is a regular expression , but will be used like this : " ^ ClassName $ " functions are also <nl> rename_classes = CCParticleSystemQuad : : CCParticleSystem , <nl> # for all class names , should we remove something when registering in the target VM ? <nl> remove_prefix = CC <nl> <nl> - # objects for which there will be no " parent " lookup <nl> - base_objects = CCNode CCDirector SimpleAudioEngine CCFileUtils <nl> + # classes for which there will be no " parent " lookup <nl> + classes_have_no_parents = CCNode CCDirector SimpleAudioEngine CCFileUtils CCTMXMapInfo <nl> + <nl> + # base classes which will be skipped when their sub - classes found them . <nl> + base_classes_to_skip = CCObject <nl> <nl> # classes that create no constructor <nl> # CCSet is special and we will use a hand - written constructor <nl> abstract_classes = CCDirector CCSpriteFrameCache CCTransitionEaseScene CCSet SimpleAudioEngine CCFileUtils <nl> + <nl> + # Determining whether to use script object ( js object ) to control the lifecycle of native ( cpp ) object or the other way around . Supported values are ' yes ' or ' no ' . <nl> + script_control_cpp = no <nl> + <nl> mmm a / tools / tojs / cocos2dx . ini <nl> ppp b / tools / tojs / cocos2dx . ini <nl> headers = % ( cocosdir ) s / cocos2dx / include / cocos2d . h % ( cocosdir ) s / CocosDenshion / inc <nl> <nl> # what classes to produce code for . You can use regular expressions here . When testing the regular <nl> # expression , it will be enclosed in " ^ $ " , like this : " ^ CCMenu * $ " . <nl> - classes = CCSprite . * CCScene CCNode . * CCDirector CCLayer . * CCMenu . * CCTouch CC . * Action . * CCMove . * CCRotate . * CCBlink . * CCTint . * CCSequence CCRepeat . * CCFade . * CCEase . * CCScale . * CCTransition . * CCSpawn CCSequence CCAnimat . * CCFlip . * CCDelay . * CCSkew . * CCJump . * CCPlace . * CCShow . * CCProgress . * CCPointArray CCToggleVisibility . * CCHide CCParticle . * CCLabel . * CCAtlas . * CCTextureCache . * CCTexture2D CCCardinal . * CCCatmullRom . * CCParallaxNode CCTileMap . * CCTMX . * CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCBReader . * CCBAnimationManager . * CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit . * CCFollow . * CCBezier . * CCCardinalSpline . * CCControlButton . * CCCamera . * CCDrawNode CC . * 3D $ CCLiquid $ CCWaves $ CCShuffleTiles $ CCTurnOffTiles $ CCSplit . * CCTwirl $ CCFileUtils $ CCScrollView $ CCTableView $ CCTableViewCell $ <nl> + classes = CCSprite . * CCScene CCNode . * CCDirector CCLayer . * CCMenu . * CCTouch CC . * Action . * CCMove . * CCRotate . * CCBlink . * CCTint . * CCSequence CCRepeat . * CCFade . * CCEase . * CCScale . * CCTransition . * CCSpawn CCSequence CCAnimat . * CCFlip . * CCDelay . * CCSkew . * CCJump . * CCPlace . * CCShow . * CCProgress . * CCPointArray CCToggleVisibility . * CCHide CCParticle . * CCLabel . * CCAtlas . * CCTextureCache . * CCTexture2D CCCardinal . * CCCatmullRom . * CCParallaxNode CCTileMap . * CCTMX . * CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCGridBase $ CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCBReader . * CCBAnimationManager . * CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit . * CCFollow . * CCBezier . * CCCardinalSpline . * CCControl $ CCControlButton . * CCCamera . * CCDrawNode CC . * 3D $ CCLiquid $ CCWaves $ CCShuffleTiles $ CCTurnOffTiles $ CCSplit . * CCTwirl $ CCFileUtils $ CCScrollView $ CCTableView $ CCTableViewCell $ <nl> <nl> # what should we skip ? in the format ClassName : : [ function function ] <nl> # ClassName is a regular expression , but will be used like this : " ^ ClassName $ " functions are also <nl> rename_classes = CCParticleSystemQuad : : CCParticleSystem , <nl> # for all class names , should we remove something when registering in the target VM ? <nl> remove_prefix = CC <nl> <nl> - # objects for which there will be no " parent " lookup <nl> - base_objects = CCNode CCDirector SimpleAudioEngine CCFileUtils <nl> + # classes for which there will be no " parent " lookup <nl> + classes_have_no_parents = CCNode CCDirector SimpleAudioEngine CCFileUtils CCTMXMapInfo <nl> + <nl> + # base classes which will be skipped when their sub - classes found them . <nl> + base_classes_to_skip = CCObject <nl> <nl> # classes that create no constructor <nl> # CCSet is special and we will use a hand - written constructor <nl> abstract_classes = CCDirector CCSpriteFrameCache CCTransitionEaseScene CCSet SimpleAudioEngine CCFileUtils <nl> + <nl> + # Determining whether to use script object ( js object ) to control the lifecycle of native ( cpp ) object or the other way around . Supported values are ' yes ' or ' no ' . <nl> + script_control_cpp = no <nl> + <nl>
Merge pull request from dumganhar / master
cocos2d/cocos2d-x
1059267beefd7c4b5020d7c29dc66640be2eae6c
2013-03-10T06:01:21Z
mmm a / tensorflow / lite / micro / kernels / arc_mli / depthwise_conv . cc <nl> ppp b / tensorflow / lite / micro / kernels / arc_mli / depthwise_conv . cc <nl> bool IsMliApplicable ( TfLiteContext * context , const TfLiteTensor * input , <nl> const TfLiteDepthwiseConvParams * params ) { <nl> const auto * affine_quantization = <nl> reinterpret_cast < TfLiteAffineQuantization * > ( filter - > quantization . params ) ; <nl> + const int in_ch = SizeOfDimension ( input , 3 ) ; <nl> + const int filters_num = SizeOfDimension ( filter , 3 ) ; <nl> + <nl> / / MLI optimized version only supports int8 dataype , dilation factor of 1 and <nl> / / per - axis quantization of weights ( no broadcasting / per - tensor ) <nl> + / / TODO : ( ( in_ch = = filters_num ) | | ( in_ch = = 1 ) ) is a forbidding of <nl> + / / channel multiplier logic for multichannel input . <nl> + / / To be removed after it will be supported in MLI <nl> bool ret_val = ( filter - > type = = kTfLiteInt8 ) & & <nl> ( input - > type = = kTfLiteInt8 ) & & <nl> ( bias - > type = = kTfLiteInt32 ) & & <nl> bool IsMliApplicable ( TfLiteContext * context , const TfLiteTensor * input , <nl> ( params - > dilation_height_factor = = 1 ) & & <nl> ( affine_quantization - > scale - > size = = <nl> filter - > dims - > data [ kDepthwiseConvQuantizedDimension ] ) & & <nl> + ( ( in_ch = = filters_num ) | | ( in_ch = = 1 ) ) & & <nl> affine_quantization - > scale - > size < = ( kMaxChannels * 2 ) ; <nl> return ret_val ; <nl> } <nl>
Cases with channel multiplier for DW conv ( int8 ) temporarily fallback to reference code
tensorflow/tensorflow
5b2f6d322cb4943548935b0fc52b528e18c4ad7d
2020-05-01T12:24:34Z
mmm a / src / video_core / shader / shader_ir . cpp <nl> ppp b / src / video_core / shader / shader_ir . cpp <nl> OperationCode ShaderIR : : GetPredicateCombiner ( PredOperation operation ) { <nl> return op - > second ; <nl> } <nl> <nl> + Node ShaderIR : : GetConditionCode ( Tegra : : Shader : : ConditionCode cc ) { <nl> + switch ( cc ) { <nl> + case Tegra : : Shader : : ConditionCode : : NEU : <nl> + return GetInternalFlag ( InternalFlag : : Zero , true ) ; <nl> + default : <nl> + UNIMPLEMENTED_MSG ( " Unimplemented condition code : { } " , static_cast < u32 > ( cc ) ) ; <nl> + return GetPredicate ( static_cast < u64 > ( Pred : : NeverExecute ) ) ; <nl> + } <nl> + } <nl> + <nl> void ShaderIR : : SetRegister ( BasicBlock & bb , Register dest , Node src ) { <nl> bb . push_back ( Operation ( OperationCode : : Assign , GetRegister ( dest ) , src ) ) ; <nl> } <nl> mmm a / src / video_core / shader / shader_ir . h <nl> ppp b / src / video_core / shader / shader_ir . h <nl> class ShaderIR final { <nl> / / / Returns a predicate combiner operation <nl> OperationCode GetPredicateCombiner ( Tegra : : Shader : : PredOperation operation ) ; <nl> <nl> + / / / Returns a condition code evaluated from internal flags <nl> + Node GetConditionCode ( Tegra : : Shader : : ConditionCode cc ) ; <nl> + <nl> template < typename . . . T > <nl> inline Node Operation ( OperationCode code , const T * . . . operands ) { <nl> return StoreNode ( OperationNode ( code , operands . . . ) ) ; <nl>
shader_ir : Add condition code helper
yuzu-emu/yuzu
fbc67a05637f3acb47f933066fb2e548f9d35d8c
2019-01-15T20:54:50Z
mmm a / src / mongo / transport / message_compressor_manager . cpp <nl> ppp b / src / mongo / transport / message_compressor_manager . cpp <nl> void MessageCompressorManager : : serverNegotiate ( const BSONObj & input , BSONObjBuil <nl> sub . append ( algo - > getName ( ) ) ; <nl> } <nl> sub . doneFast ( ) ; <nl> + } else { <nl> + LOG ( 3 ) < < " Compression negotiation not requested by client " ; <nl> } <nl> return ; <nl> } <nl> void MessageCompressorManager : : serverNegotiate ( const BSONObj & input , BSONObjBuil <nl> <nl> / / First we go through all the compressor names that the client has requested support for <nl> BSONObj theirObj = elem . Obj ( ) ; <nl> + <nl> + if ( ! theirObj . nFields ( ) ) { <nl> + LOG ( 3 ) < < " No compressors provided " ; <nl> + return ; <nl> + } <nl> + <nl> for ( const auto & elem : theirObj ) { <nl> MessageCompressorBase * cur ; <nl> auto curName = elem . checkAndGetStringData ( ) ; <nl> void MessageCompressorManager : : serverNegotiate ( const BSONObj & input , BSONObjBuil <nl> sub . append ( algo - > getName ( ) ) ; <nl> } <nl> sub . doneFast ( ) ; <nl> + } else { <nl> + LOG ( 3 ) < < " Could not agree on compressor to use " ; <nl> } <nl> } <nl> <nl>
SERVER - 28986 Improve compression negotiation logging
mongodb/mongo
6a11fc05770306b5d660b21f339cba110d6d67d4
2017-05-30T14:28:44Z
mmm a / lib / IRGen / IRGenDebugInfo . cpp <nl> ppp b / lib / IRGen / IRGenDebugInfo . cpp <nl> IRGenDebugInfoImpl : : IRGenDebugInfoImpl ( const IRGenOptions & Opts , <nl> " no debug info should be generated " ) ; <nl> StringRef SourceFileName = <nl> SF ? SF - > getFilename ( ) : StringRef ( Opts . MainInputFilename ) ; <nl> - StringRef Dir ; <nl> llvm : : SmallString < 256 > AbsMainFile ; <nl> if ( SourceFileName . empty ( ) ) <nl> AbsMainFile = " < unknown > " ; <nl> mmm a / lib / Sema / CSApply . cpp <nl> ppp b / lib / Sema / CSApply . cpp <nl> Expr * ExprRewriter : : finishApply ( ApplyExpr * apply , Type openedType , <nl> CEA = TSE - > getSubExpr ( ) ; <nl> / / The argument is either a ParenExpr or TupleExpr . <nl> ArrayRef < Expr * > arguments ; <nl> - ArrayRef < TypeBase * > types ; <nl> <nl> SmallVector < Expr * , 1 > Scratch ; <nl> if ( auto * TE = dyn_cast < TupleExpr > ( CEA ) ) <nl>
[ gardening ] Remove some unused variables . NFCI .
apple/swift
330fb1ce2f73d10058d23fad0c0f364b677a0fac
2017-10-30T22:19:55Z
mmm a / src / Functions / abtesting . cpp <nl> ppp b / src / Functions / abtesting . cpp <nl> class FunctionBayesAB : public IFunction <nl> return std : : make_shared < DataTypeString > ( ) ; <nl> } <nl> <nl> - bool toFloat64 ( const ColumnConst * col_const_arr , PODArray < Float64 > & output ) const <nl> + static bool toFloat64 ( const ColumnConst * col_const_arr , PODArray < Float64 > & output ) const <nl> { <nl> Array src_arr = col_const_arr - > getValue < Array > ( ) ; <nl> <nl>
Add static to toFloat64
ClickHouse/ClickHouse
e1172755f0f6ed840cc5a58cb2c4ced6314bebb6
2020-07-24T02:20:43Z
new file mode 100644 <nl> index 000000000000 . . 14cdec57ef6d <nl> mmm / dev / null <nl> ppp b / jstests / parallel / manyclients . js <nl> <nl> + / / perform inserts in parallel from a large number of clients <nl> + <nl> + f = db . jstests_parallel_manyclients ; <nl> + f . drop ( ) ; <nl> + f . ensureIndex ( { who : 1 } ) ; <nl> + <nl> + Random . setRandomSeed ( ) ; <nl> + <nl> + t = new ParallelTester ( ) ; <nl> + <nl> + for ( id = 0 ; id < 200 ; + + id ) { <nl> + var g = new EventGenerator ( id , " jstests_parallel_manyclients " , Random . randInt ( 20 ) ) ; <nl> + for ( j = 0 ; j < 1000 ; + + j ) { <nl> + if ( j % 50 = = 0 ) { <nl> + g . addCheckCount ( j , { who : id } , true ) ; <nl> + } <nl> + g . addInsert ( { i : j , who : id } ) ; <nl> + } <nl> + t . add ( EventGenerator . dispatch , g . getEvents ( ) ) ; <nl> + } <nl> + <nl> + print ( " done preparing test " ) ; <nl> + <nl> + t . run ( " one or more tests failed " ) ; <nl> + <nl> + assert ( f . validate ( ) . valid ) ; <nl> mmm a / mongo . xcodeproj / project . pbxproj <nl> ppp b / mongo . xcodeproj / project . pbxproj <nl> <nl> 93BCE36310F2BD8300FA139B / * updatetests . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = updatetests . cpp ; sourceTree = " < group > " ; } ; <nl> 93BCE41810F3AF1B00FA139B / * capped2 . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = capped2 . js ; sourceTree = " < group > " ; } ; <nl> 93BCE4B510F3C8DB00FA139B / * allops . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = allops . js ; sourceTree = " < group > " ; } ; <nl> + 93BCE5A510F3F8E900FA139B / * manyclients . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = manyclients . js ; sourceTree = " < group > " ; } ; <nl> 93C38E940FA66622007D6E4A / * basictests . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = basictests . cpp ; sourceTree = " < group > " ; } ; <nl> 93D0C1520EF1D377005253B7 / * jsobjtests . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = jsobjtests . cpp ; sourceTree = " < group > " ; } ; <nl> 93D0C1FB0EF1E267005253B7 / * namespacetests . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = namespacetests . cpp ; sourceTree = " < group > " ; } ; <nl> <nl> 93F0956F10E165E50053380C / * parallel * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 93BCE5A510F3F8E900FA139B / * manyclients . js * / , <nl> 93BCE4B510F3C8DB00FA139B / * allops . js * / , <nl> 93AEC57A10E94749005DF720 / * insert . js * / , <nl> 93F095CC10E16FF70053380C / * shellfork . js * / , <nl>
SERVER - 470 add test with 200 clients
mongodb/mongo
b4230ff11ee0c4080b7e1846ad53f0f3acdf9221
2010-01-05T22:55:34Z
mmm a / tensorflow / go / op / wrappers . go <nl> ppp b / tensorflow / go / op / wrappers . go <nl> func DepthwiseConv2dNativeBackpropFilterDataFormat ( value string ) DepthwiseConv2d <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropFilterDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func SampleDistortedBoundingBoxV2Seed2 ( value int64 ) SampleDistortedBoundingBoxV2 <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxV2AspectRatioRange ( value [ ] float32 ) SampleDistort <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxV2AreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func SampleDistortedBoundingBoxMinObjectCovered ( value float32 ) SampleDistortedBo <nl> / / <nl> / / value : The cropped area of the image must have an aspect ratio = <nl> / / width / height within this range . <nl> - / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> + / / If not specified , defaults to { f : 0 . 75 f : 1 . 33 } <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " aspect_ratio_range " ] = value <nl> func SampleDistortedBoundingBoxAspectRatioRange ( value [ ] float32 ) SampleDistorted <nl> / / <nl> / / value : The cropped area of the image must contain a fraction of the <nl> / / supplied image within this range . <nl> - / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> + / / If not specified , defaults to { f : 0 . 05 f : 1 } <nl> func SampleDistortedBoundingBoxAreaRange ( value [ ] float32 ) SampleDistortedBoundingBoxAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " area_range " ] = value <nl> func ImageSummaryMaxImages ( value int64 ) ImageSummaryAttr { <nl> / / ImageSummaryBadColor sets the optional bad_color attribute to value . <nl> / / <nl> / / value : Color to use for pixels with non - finite values . <nl> - / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> + / / If not specified , defaults to { dtype : DT_UINT8 tensor_shape : { dim : { size : 4 } } int_val : 255 int_val : 0 int_val : 0 int_val : 255 } <nl> func ImageSummaryBadColor ( value tf . Tensor ) ImageSummaryAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " bad_color " ] = value <nl> func Conv3DBackpropFilterV2DataFormat ( value string ) Conv3DBackpropFilterV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterV2Dilations ( value [ ] int64 ) Conv3DBackpropFilterV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropInputDataFormat ( value string ) Conv2DBackpropInputAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropInputDilations ( value [ ] int64 ) Conv2DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DDataFormat ( value string ) Conv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DDilations ( value [ ] int64 ) Conv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeOutType ( value tf . DataTy <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAndRequantizeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasAndReluOutType ( value tf . DataType ) Quantized <nl> / / QuantizedDepthwiseConv2DWithBiasAndReluDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasAndReluDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAndReluAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DWithBiasOutType ( value tf . DataType ) QuantizedDepthwi <nl> / / QuantizedDepthwiseConv2DWithBiasDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DWithBiasDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DWithBiasAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedDepthwiseConv2DOutType ( value tf . DataType ) QuantizedDepthwiseConv2D <nl> / / QuantizedDepthwiseConv2DDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : List of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedDepthwiseConv2DDilations ( value [ ] int64 ) QuantizedDepthwiseConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DPerChannelOutType ( value tf . DataType ) QuantizedConv2DPerChann <nl> / / QuantizedConv2DPerChannelDilations sets the optional dilations attribute to value . <nl> / / <nl> / / value : list of dilation values . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DPerChannelDilations ( value [ ] int64 ) QuantizedConv2DPerChannelAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DBackpropInputV2DataFormat ( value string ) Conv3DBackpropInputV2Attr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputV2Dilations ( value [ ] int64 ) Conv3DBackpropInputV2Attr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func AvgPool3DGrad ( scope * Scope , orig_input_shape tf . Output , grad tf . Output , ksi <nl> type Conv3DBackpropFilterAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropFilterDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropFilterDilations ( value [ ] int64 ) Conv3DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeDataFormat ( value string ) DepthwiseConv2dNativeAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeDilations ( value [ ] int64 ) DepthwiseConv2dNativeAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNative ( scope * Scope , input tf . Output , filter tf . Output , stri <nl> type Conv3DBackpropInputAttr func ( optionalAttr ) <nl> <nl> / / Conv3DBackpropInputDilations sets the optional dilations attribute to value . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DBackpropInputDilations ( value [ ] int64 ) Conv3DBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func DepthwiseConv2dNativeBackpropInputDataFormat ( value string ) DepthwiseConv2dN <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func DepthwiseConv2dNativeBackpropInputDilations ( value [ ] int64 ) DepthwiseConv2dNativeBackpropInputAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func QuantizedConv2DOutType ( value tf . DataType ) QuantizedConv2DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func QuantizedConv2DDilations ( value [ ] int64 ) QuantizedConv2DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv3DDataFormat ( value string ) Conv3DAttr { <nl> / / filter element on that dimension . The dimension order is determined by the <nl> / / value of ` data_format ` , see above for details . Dilations in the batch and <nl> / / depth dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 i : 1 } <nl> func Conv3DDilations ( value [ ] int64 ) Conv3DAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl> func Conv2DBackpropFilterDataFormat ( value string ) Conv2DBackpropFilterAttr { <nl> / / element on that dimension . The dimension order is determined by the value of <nl> / / ` data_format ` , see above for details . Dilations in the batch and depth <nl> / / dimensions must be 1 . <nl> - / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> + / / If not specified , defaults to { i : 1 i : 1 i : 1 i : 1 } <nl> func Conv2DBackpropFilterDilations ( value [ ] int64 ) Conv2DBackpropFilterAttr { <nl> return func ( m optionalAttr ) { <nl> m [ " dilations " ] = value <nl>
Go : Update generated wrapper functions for TensorFlow ops .
tensorflow/tensorflow
2445598e9ea726d1f774e58ecfaca142dfca47a0
2020-02-09T14:50:13Z
mmm a / doc / server_reflection_tutorial . md <nl> ppp b / doc / server_reflection_tutorial . md <nl> contain symbols used by the application . On these platforms , LD flag <nl> ` - - no - as - needed ` is needed for for dynamic linking and ` - - whole - archive ` is <nl> needed for for static linking . <nl> <nl> - This [ Makefile ] ( examples / cpp / helloworld / Makefile # L37 # L45 ) demonstrates enabling <nl> - c + + server reflection on Linux and MacOS . <nl> + This [ Makefile ] ( . . / examples / cpp / helloworld / Makefile # L37 # L45 ) demonstrates <nl> + enabling c + + server reflection on Linux and MacOS . <nl> <nl> # # Test services using Server Reflection <nl> <nl> gRPC Server Reflection is supported by gRPC CLI . After enabling Server <nl> Reflection in a server application , you can use gRPC CLI to test its services . <nl> <nl> Instructions on how to use gRPC CLI can be found at <nl> - [ command_line_tool . md ] ( doc / command_line_tool . md ) , or using ` grpc_cli help ` <nl> - command . <nl> + [ command_line_tool . md ] ( command_line_tool . md ) , or using ` grpc_cli help ` command . <nl> <nl> Here we use ` examples / cpp / helloworld ` as an example to show the use of gRPC <nl> Server Reflection and gRPC CLI . First , we need to build gRPC CLI and setup an <nl> example server with Server Reflection enabled . <nl> - Setup an example server <nl> <nl> Server Reflection has already been enabled in the <nl> - [ Makefile ] ( examples / cpp / helloworld / Makefile ) of the helloworld example . We can <nl> - simply make it and run the greeter_server . <nl> + [ Makefile ] ( . . / examples / cpp / helloworld / Makefile ) of the helloworld example . We <nl> + can simply make it and run the greeter_server . <nl> <nl> ` ` ` sh <nl> $ make - C examples / cpp / helloworld <nl> We can send RPCs to a server and get responses using ` grpc_cli call ` command . <nl> <nl> Server Reflection can be used by clients to get information about gRPC services <nl> at runtime . We ' ve provided a descriptor database called <nl> - [ grpc : : ProtoReflectionDescriptorDatabase ] ( test / cpp / util / proto_reflection_descriptor_database . h ) <nl> + [ grpc : : ProtoReflectionDescriptorDatabase ] ( . . / test / cpp / util / proto_reflection_descriptor_database . h ) <nl> which implements the <nl> [ google : : protobuf : : DescriptorDatabase ] ( https : / / developers . google . com / protocol - buffers / docs / reference / cpp / google . protobuf . descriptor_database # DescriptorDatabase ) <nl> interface . It manages the communication between clients and reflection services <nl>
Fix dead links
grpc/grpc
a8f2621d78e27b5d1cc6b0c462d2d1e22ab7704c
2016-09-13T18:14:28Z
mmm a / tensorflow / core / platform / macros . h <nl> ppp b / tensorflow / core / platform / macros . h <nl> limitations under the License . <nl> do { \ <nl> } while ( 0 ) <nl> # endif <nl> + <nl> namespace tensorflow { <nl> namespace internal { <nl> template < typename T > <nl>
Update tensorflow / core / platform / macros . h
tensorflow/tensorflow
82be9d5dbf0988c6bd9e9103991a0b5f5828d7e8
2020-07-22T19:12:21Z
mmm a / build . yaml <nl> ppp b / build . yaml <nl> targets : <nl> - gpr_test_util <nl> - gpr <nl> - name : dns_resolver_connectivity_test <nl> + cpu_cost : 0 . 1 <nl> build : test <nl> language : c <nl> src : <nl> mmm a / src / core / client_config / resolvers / dns_resolver . c <nl> ppp b / src / core / client_config / resolvers / dns_resolver . c <nl> static const grpc_resolver_vtable dns_resolver_vtable = { <nl> static void dns_shutdown ( grpc_exec_ctx * exec_ctx , grpc_resolver * resolver ) { <nl> dns_resolver * r = ( dns_resolver * ) resolver ; <nl> gpr_mu_lock ( & r - > mu ) ; <nl> + if ( r - > have_retry_timer ) { <nl> + grpc_timer_cancel ( exec_ctx , & r - > retry_timer ) ; <nl> + } <nl> if ( r - > next_completion ! = NULL ) { <nl> * r - > target_config = NULL ; <nl> grpc_exec_ctx_enqueue ( exec_ctx , r - > next_completion , true , NULL ) ; <nl> static void dns_on_retry_timer ( grpc_exec_ctx * exec_ctx , void * arg , <nl> bool success ) { <nl> dns_resolver * r = arg ; <nl> <nl> + gpr_mu_lock ( & r - > mu ) ; <nl> + r - > have_retry_timer = false ; <nl> if ( success ) { <nl> - gpr_mu_lock ( & r - > mu ) ; <nl> if ( ! r - > resolving ) { <nl> dns_start_resolving_locked ( r ) ; <nl> } <nl> - gpr_mu_unlock ( & r - > mu ) ; <nl> } <nl> + gpr_mu_unlock ( & r - > mu ) ; <nl> <nl> GRPC_RESOLVER_UNREF ( exec_ctx , & r - > base , " retry - timer " ) ; <nl> } <nl> mmm a / tools / run_tests / tests . json <nl> ppp b / tools / run_tests / tests . json <nl> <nl> " posix " , <nl> " windows " <nl> ] , <nl> - " cpu_cost " : 1 . 0 , <nl> + " cpu_cost " : 0 . 1 , <nl> " exclude_configs " : [ ] , <nl> " flaky " : false , <nl> " gtest " : false , <nl>
Fit and finish for dns retry loop
grpc/grpc
e2327dbb8e45936c81802119142a7cda28230f24
2016-03-11T17:52:42Z
mmm a / src / arm / macro - assembler - arm . cc <nl> ppp b / src / arm / macro - assembler - arm . cc <nl> void TurboAssembler : : LoadRoot ( Register destination , RootIndex index , <nl> MemOperand ( kRootRegister , RootRegisterOffsetForRootIndex ( index ) ) , cond ) ; <nl> } <nl> <nl> - <nl> void MacroAssembler : : RecordWriteField ( Register object , int offset , <nl> - Register value , Register dst , <nl> + Register value , <nl> LinkRegisterStatus lr_status , <nl> SaveFPRegsMode save_fp , <nl> RememberedSetAction remembered_set_action , <nl> void MacroAssembler : : RecordWriteField ( Register object , int offset , <nl> / / of the object , so so offset must be a multiple of kPointerSize . <nl> DCHECK ( IsAligned ( offset , kPointerSize ) ) ; <nl> <nl> - add ( dst , object , Operand ( offset - kHeapObjectTag ) ) ; <nl> if ( emit_debug_code ( ) ) { <nl> Label ok ; <nl> - tst ( dst , Operand ( kPointerSize - 1 ) ) ; <nl> + UseScratchRegisterScope temps ( this ) ; <nl> + Register scratch = temps . Acquire ( ) ; <nl> + add ( scratch , object , Operand ( offset - kHeapObjectTag ) ) ; <nl> + tst ( scratch , Operand ( kPointerSize - 1 ) ) ; <nl> b ( eq , & ok ) ; <nl> stop ( " Unaligned cell in write barrier " ) ; <nl> bind ( & ok ) ; <nl> } <nl> <nl> - RecordWrite ( object , dst , value , lr_status , save_fp , remembered_set_action , <nl> - OMIT_SMI_CHECK ) ; <nl> + RecordWrite ( object , Operand ( offset - kHeapObjectTag ) , value , lr_status , <nl> + save_fp , remembered_set_action , OMIT_SMI_CHECK ) ; <nl> <nl> bind ( & done ) ; <nl> - <nl> - / / Clobber clobbered input registers when running with the debug - code flag <nl> - / / turned on to provoke errors . <nl> - if ( emit_debug_code ( ) ) { <nl> - mov ( value , Operand ( bit_cast < int32_t > ( kZapValue + 4 ) ) ) ; <nl> - mov ( dst , Operand ( bit_cast < int32_t > ( kZapValue + 8 ) ) ) ; <nl> - } <nl> } <nl> <nl> void TurboAssembler : : SaveRegisters ( RegList registers ) { <nl> void TurboAssembler : : RestoreRegisters ( RegList registers ) { <nl> ldm ( ia_w , sp , regs ) ; <nl> } <nl> <nl> - void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Register address , <nl> + void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Operand offset , <nl> SaveFPRegsMode fp_mode ) { <nl> EphemeronKeyBarrierDescriptor descriptor ; <nl> RegList registers = descriptor . allocatable_registers ( ) ; <nl> void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Register address , <nl> Register fp_mode_parameter ( <nl> descriptor . GetRegisterParameter ( EphemeronKeyBarrierDescriptor : : kFPMode ) ) ; <nl> <nl> - MovePair ( object_parameter , object , slot_parameter , address ) ; <nl> + MoveObjectAndSlot ( object_parameter , slot_parameter , object , offset ) ; <nl> Move ( fp_mode_parameter , Smi : : FromEnum ( fp_mode ) ) ; <nl> Call ( isolate ( ) - > builtins ( ) - > builtin_handle ( Builtins : : kEphemeronKeyBarrier ) , <nl> RelocInfo : : CODE_TARGET ) ; <nl> void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Register address , <nl> } <nl> <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> - Register object , Register address , <nl> - RememberedSetAction remembered_set_action , SaveFPRegsMode fp_mode ) { <nl> + Register object , Operand offset , RememberedSetAction remembered_set_action , <nl> + SaveFPRegsMode fp_mode ) { <nl> CallRecordWriteStub ( <nl> - object , address , remembered_set_action , fp_mode , <nl> + object , offset , remembered_set_action , fp_mode , <nl> isolate ( ) - > builtins ( ) - > builtin_handle ( Builtins : : kRecordWrite ) , <nl> kNullAddress ) ; <nl> } <nl> <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> - Register object , Register address , <nl> - RememberedSetAction remembered_set_action , SaveFPRegsMode fp_mode , <nl> - Address wasm_target ) { <nl> - CallRecordWriteStub ( object , address , remembered_set_action , fp_mode , <nl> + Register object , Operand offset , RememberedSetAction remembered_set_action , <nl> + SaveFPRegsMode fp_mode , Address wasm_target ) { <nl> + CallRecordWriteStub ( object , offset , remembered_set_action , fp_mode , <nl> Handle < Code > : : null ( ) , wasm_target ) ; <nl> } <nl> <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> - Register object , Register address , <nl> - RememberedSetAction remembered_set_action , SaveFPRegsMode fp_mode , <nl> - Handle < Code > code_target , Address wasm_target ) { <nl> + Register object , Operand offset , RememberedSetAction remembered_set_action , <nl> + SaveFPRegsMode fp_mode , Handle < Code > code_target , Address wasm_target ) { <nl> DCHECK_NE ( code_target . is_null ( ) , wasm_target = = kNullAddress ) ; <nl> / / TODO ( albertnetymk ) : For now we ignore remembered_set_action and fp_mode , <nl> / / i . e . always emit remember set and save FP registers in RecordWriteStub . If <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> Register fp_mode_parameter ( <nl> descriptor . GetRegisterParameter ( RecordWriteDescriptor : : kFPMode ) ) ; <nl> <nl> - MovePair ( object_parameter , object , slot_parameter , address ) ; <nl> + MoveObjectAndSlot ( object_parameter , slot_parameter , object , offset ) ; <nl> <nl> Move ( remembered_set_parameter , Smi : : FromEnum ( remembered_set_action ) ) ; <nl> Move ( fp_mode_parameter , Smi : : FromEnum ( fp_mode ) ) ; <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> RestoreRegisters ( registers ) ; <nl> } <nl> <nl> - / / Will clobber 3 registers : object , address , and value . The register ' object ' <nl> - / / contains a heap object pointer . The heap object tag is shifted away . <nl> - / / A scratch register also needs to be available . <nl> - void MacroAssembler : : RecordWrite ( Register object , Register address , <nl> + void TurboAssembler : : MoveObjectAndSlot ( Register dst_object , Register dst_slot , <nl> + Register object , Operand offset ) { <nl> + DCHECK_NE ( dst_object , dst_slot ) ; <nl> + DCHECK ( offset . IsRegister ( ) | | offset . IsImmediate ( ) ) ; <nl> + / / If ` offset ` is a register , it cannot overlap with ` object ` . <nl> + DCHECK_IMPLIES ( offset . IsRegister ( ) , offset . rm ( ) ! = object ) ; <nl> + <nl> + / / If the slot register does not overlap with the object register , we can <nl> + / / overwrite it . <nl> + if ( dst_slot ! = object ) { <nl> + add ( dst_slot , object , offset ) ; <nl> + Move ( dst_object , object ) ; <nl> + return ; <nl> + } <nl> + <nl> + DCHECK_EQ ( dst_slot , object ) ; <nl> + <nl> + / / If the destination object register does not overlap with the offset <nl> + / / register , we can overwrite it . <nl> + if ( ! offset . IsRegister ( ) | | ( offset . rm ( ) ! = dst_object ) ) { <nl> + Move ( dst_object , dst_slot ) ; <nl> + add ( dst_slot , dst_slot , offset ) ; <nl> + return ; <nl> + } <nl> + <nl> + DCHECK_EQ ( dst_object , offset . rm ( ) ) ; <nl> + <nl> + / / We only have ` dst_slot ` and ` dst_object ` left as distinct registers so we <nl> + / / have to swap them . We write this as a add + sub sequence to avoid using a <nl> + / / scratch register . <nl> + add ( dst_slot , dst_slot , dst_object ) ; <nl> + sub ( dst_object , dst_slot , dst_object ) ; <nl> + } <nl> + <nl> + / / The register ' object ' contains a heap object pointer . The heap object tag is <nl> + / / shifted away . A scratch register also needs to be available . <nl> + void MacroAssembler : : RecordWrite ( Register object , Operand offset , <nl> Register value , LinkRegisterStatus lr_status , <nl> SaveFPRegsMode fp_mode , <nl> RememberedSetAction remembered_set_action , <nl> SmiCheck smi_check ) { <nl> - DCHECK ( object ! = value ) ; <nl> + DCHECK_NE ( object , value ) ; <nl> if ( emit_debug_code ( ) ) { <nl> { <nl> UseScratchRegisterScope temps ( this ) ; <nl> Register scratch = temps . Acquire ( ) ; <nl> - ldr ( scratch , MemOperand ( address ) ) ; <nl> + add ( scratch , object , offset ) ; <nl> + ldr ( scratch , MemOperand ( scratch ) ) ; <nl> cmp ( scratch , value ) ; <nl> } <nl> Check ( eq , AbortReason : : kWrongAddressOrValuePassedToRecordWrite ) ; <nl> void MacroAssembler : : RecordWrite ( Register object , Register address , <nl> JumpIfSmi ( value , & done ) ; <nl> } <nl> <nl> - CheckPageFlag ( value , <nl> - value , / / Used as scratch . <nl> - MemoryChunk : : kPointersToHereAreInterestingMask , eq , & done ) ; <nl> - CheckPageFlag ( object , <nl> - value , / / Used as scratch . <nl> - MemoryChunk : : kPointersFromHereAreInterestingMask , <nl> - eq , <nl> + CheckPageFlag ( value , MemoryChunk : : kPointersToHereAreInterestingMask , eq , <nl> + & done ) ; <nl> + CheckPageFlag ( object , MemoryChunk : : kPointersFromHereAreInterestingMask , eq , <nl> & done ) ; <nl> <nl> / / Record the actual write . <nl> if ( lr_status = = kLRHasNotBeenSaved ) { <nl> push ( lr ) ; <nl> } <nl> - CallRecordWriteStub ( object , address , remembered_set_action , fp_mode ) ; <nl> + CallRecordWriteStub ( object , offset , remembered_set_action , fp_mode ) ; <nl> if ( lr_status = = kLRHasNotBeenSaved ) { <nl> pop ( lr ) ; <nl> } <nl> <nl> bind ( & done ) ; <nl> - <nl> - / / Clobber clobbered registers when running with the debug - code flag <nl> - / / turned on to provoke errors . <nl> - if ( emit_debug_code ( ) ) { <nl> - mov ( address , Operand ( bit_cast < int32_t > ( kZapValue + 12 ) ) ) ; <nl> - mov ( value , Operand ( bit_cast < int32_t > ( kZapValue + 16 ) ) ) ; <nl> - } <nl> } <nl> <nl> void TurboAssembler : : PushCommonFrame ( Register marker_reg ) { <nl> void TurboAssembler : : CallCFunctionHelper ( Register function , <nl> } <nl> } <nl> <nl> - void TurboAssembler : : CheckPageFlag ( Register object , Register scratch , int mask , <nl> - Condition cc , Label * condition_met ) { <nl> + void TurboAssembler : : CheckPageFlag ( Register object , int mask , Condition cc , <nl> + Label * condition_met ) { <nl> + UseScratchRegisterScope temps ( this ) ; <nl> + Register scratch = temps . Acquire ( ) ; <nl> DCHECK ( cc = = eq | | cc = = ne ) ; <nl> Bfc ( scratch , object , 0 , kPageSizeBits ) ; <nl> ldr ( scratch , MemOperand ( scratch , MemoryChunk : : kFlagsOffset ) ) ; <nl> mmm a / src / arm / macro - assembler - arm . h <nl> ppp b / src / arm / macro - assembler - arm . h <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> void VmovLow ( Register dst , DwVfpRegister src ) ; <nl> void VmovLow ( DwVfpRegister dst , Register src ) ; <nl> <nl> - void CheckPageFlag ( Register object , Register scratch , int mask , Condition cc , <nl> + void CheckPageFlag ( Register object , int mask , Condition cc , <nl> Label * condition_met ) ; <nl> <nl> / / Check whether d16 - d31 are available on the CPU . The result is given by the <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> void SaveRegisters ( RegList registers ) ; <nl> void RestoreRegisters ( RegList registers ) ; <nl> <nl> - void CallRecordWriteStub ( Register object , Register address , <nl> + void CallRecordWriteStub ( Register object , Operand offset , <nl> RememberedSetAction remembered_set_action , <nl> SaveFPRegsMode fp_mode ) ; <nl> - void CallRecordWriteStub ( Register object , Register address , <nl> + void CallRecordWriteStub ( Register object , Operand offset , <nl> RememberedSetAction remembered_set_action , <nl> SaveFPRegsMode fp_mode , Address wasm_target ) ; <nl> - void CallEphemeronKeyBarrier ( Register object , Register address , <nl> + void CallEphemeronKeyBarrier ( Register object , Operand offset , <nl> SaveFPRegsMode fp_mode ) ; <nl> <nl> + / / For a given | object | and | offset | : <nl> + / / - Move | object | to | dst_object | . <nl> + / / - Compute the address of the slot pointed to by | offset | in | object | and <nl> + / / write it to | dst_slot | . | offset | can be either an immediate or a <nl> + / / register . <nl> + / / This method makes sure | object | and | offset | are allowed to overlap with <nl> + / / the destination registers . <nl> + void MoveObjectAndSlot ( Register dst_object , Register dst_slot , <nl> + Register object , Operand offset ) ; <nl> + <nl> / / Does a runtime check for 16 / 32 FP registers . Either way , pushes 32 double <nl> / / values to location , saving [ d0 . . ( d15 | d31 ) ] . <nl> void SaveFPRegs ( Register location , Register scratch ) ; <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> void CallCFunctionHelper ( Register function , int num_reg_arguments , <nl> int num_double_arguments ) ; <nl> <nl> - void CallRecordWriteStub ( Register object , Register address , <nl> + void CallRecordWriteStub ( Register object , Operand offset , <nl> RememberedSetAction remembered_set_action , <nl> SaveFPRegsMode fp_mode , Handle < Code > code_target , <nl> Address wasm_target ) ; <nl> class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { <nl> <nl> / / Notify the garbage collector that we wrote a pointer into an object . <nl> / / | object | is the object being stored into , | value | is the object being <nl> - / / stored . value and scratch registers are clobbered by the operation . <nl> + / / stored . <nl> / / The offset is the offset from the start of the object , not the offset from <nl> / / the tagged HeapObject pointer . For use with FieldMemOperand ( reg , off ) . <nl> void RecordWriteField ( <nl> - Register object , int offset , Register value , Register scratch , <nl> - LinkRegisterStatus lr_status , SaveFPRegsMode save_fp , <nl> + Register object , int offset , Register value , LinkRegisterStatus lr_status , <nl> + SaveFPRegsMode save_fp , <nl> RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET , <nl> SmiCheck smi_check = INLINE_SMI_CHECK ) ; <nl> <nl> - / / For a given | object | notify the garbage collector that the slot | address | <nl> - / / has been written . | value | is the object being stored . The value and <nl> - / / address registers are clobbered by the operation . <nl> + / / For a given | object | notify the garbage collector that the slot at | offset | <nl> + / / has been written . | value | is the object being stored . <nl> void RecordWrite ( <nl> - Register object , Register address , Register value , <nl> + Register object , Operand offset , Register value , <nl> LinkRegisterStatus lr_status , SaveFPRegsMode save_fp , <nl> RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET , <nl> SmiCheck smi_check = INLINE_SMI_CHECK ) ; <nl> mmm a / src / arm64 / macro - assembler - arm64 . cc <nl> ppp b / src / arm64 / macro - assembler - arm64 . cc <nl> int MacroAssembler : : SafepointRegisterStackIndex ( int reg_code ) { <nl> } <nl> } <nl> <nl> - void TurboAssembler : : CheckPageFlag ( const Register & object , <nl> - const Register & scratch , int mask , <nl> + void TurboAssembler : : CheckPageFlag ( const Register & object , int mask , <nl> Condition cc , Label * condition_met ) { <nl> + UseScratchRegisterScope temps ( this ) ; <nl> + Register scratch = temps . AcquireX ( ) ; <nl> And ( scratch , object , ~ kPageAlignmentMask ) ; <nl> Ldr ( scratch , MemOperand ( scratch , MemoryChunk : : kFlagsOffset ) ) ; <nl> if ( cc = = eq ) { <nl> void TurboAssembler : : CheckPageFlag ( const Register & object , <nl> } <nl> <nl> void MacroAssembler : : RecordWriteField ( Register object , int offset , <nl> - Register value , Register scratch , <nl> + Register value , <nl> LinkRegisterStatus lr_status , <nl> SaveFPRegsMode save_fp , <nl> RememberedSetAction remembered_set_action , <nl> void MacroAssembler : : RecordWriteField ( Register object , int offset , <nl> / / of the object , so offset must be a multiple of kTaggedSize . <nl> DCHECK ( IsAligned ( offset , kTaggedSize ) ) ; <nl> <nl> - Add ( scratch , object , offset - kHeapObjectTag ) ; <nl> if ( emit_debug_code ( ) ) { <nl> Label ok ; <nl> + UseScratchRegisterScope temps ( this ) ; <nl> + Register scratch = temps . AcquireX ( ) ; <nl> + Add ( scratch , object , offset - kHeapObjectTag ) ; <nl> Tst ( scratch , kTaggedSize - 1 ) ; <nl> B ( eq , & ok ) ; <nl> Abort ( AbortReason : : kUnalignedCellInWriteBarrier ) ; <nl> Bind ( & ok ) ; <nl> } <nl> <nl> - RecordWrite ( object , scratch , value , lr_status , save_fp , remembered_set_action , <nl> - OMIT_SMI_CHECK ) ; <nl> + RecordWrite ( object , Operand ( offset - kHeapObjectTag ) , value , lr_status , <nl> + save_fp , remembered_set_action , OMIT_SMI_CHECK ) ; <nl> <nl> Bind ( & done ) ; <nl> - <nl> - / / Clobber clobbered input registers when running with the debug - code flag <nl> - / / turned on to provoke errors . <nl> - if ( emit_debug_code ( ) ) { <nl> - Mov ( value , Operand ( bit_cast < int64_t > ( kZapValue + 4 ) ) ) ; <nl> - Mov ( scratch , Operand ( bit_cast < int64_t > ( kZapValue + 8 ) ) ) ; <nl> - } <nl> } <nl> <nl> void TurboAssembler : : SaveRegisters ( RegList registers ) { <nl> void TurboAssembler : : RestoreRegisters ( RegList registers ) { <nl> PopCPURegList ( regs ) ; <nl> } <nl> <nl> - void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Register address , <nl> + void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Operand offset , <nl> SaveFPRegsMode fp_mode ) { <nl> EphemeronKeyBarrierDescriptor descriptor ; <nl> RegList registers = descriptor . allocatable_registers ( ) ; <nl> void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Register address , <nl> Register fp_mode_parameter ( <nl> descriptor . GetRegisterParameter ( EphemeronKeyBarrierDescriptor : : kFPMode ) ) ; <nl> <nl> - MovePair ( object_parameter , object , slot_parameter , address ) ; <nl> + MoveObjectAndSlot ( object_parameter , slot_parameter , object , offset ) ; <nl> <nl> Mov ( fp_mode_parameter , Smi : : FromEnum ( fp_mode ) ) ; <nl> Call ( isolate ( ) - > builtins ( ) - > builtin_handle ( Builtins : : kEphemeronKeyBarrier ) , <nl> void TurboAssembler : : CallEphemeronKeyBarrier ( Register object , Register address , <nl> } <nl> <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> - Register object , Register address , <nl> - RememberedSetAction remembered_set_action , SaveFPRegsMode fp_mode ) { <nl> + Register object , Operand offset , RememberedSetAction remembered_set_action , <nl> + SaveFPRegsMode fp_mode ) { <nl> CallRecordWriteStub ( <nl> - object , address , remembered_set_action , fp_mode , <nl> + object , offset , remembered_set_action , fp_mode , <nl> isolate ( ) - > builtins ( ) - > builtin_handle ( Builtins : : kRecordWrite ) , <nl> kNullAddress ) ; <nl> } <nl> <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> - Register object , Register address , <nl> - RememberedSetAction remembered_set_action , SaveFPRegsMode fp_mode , <nl> - Address wasm_target ) { <nl> - CallRecordWriteStub ( object , address , remembered_set_action , fp_mode , <nl> + Register object , Operand offset , RememberedSetAction remembered_set_action , <nl> + SaveFPRegsMode fp_mode , Address wasm_target ) { <nl> + CallRecordWriteStub ( object , offset , remembered_set_action , fp_mode , <nl> Handle < Code > : : null ( ) , wasm_target ) ; <nl> } <nl> <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> - Register object , Register address , <nl> - RememberedSetAction remembered_set_action , SaveFPRegsMode fp_mode , <nl> - Handle < Code > code_target , Address wasm_target ) { <nl> + Register object , Operand offset , RememberedSetAction remembered_set_action , <nl> + SaveFPRegsMode fp_mode , Handle < Code > code_target , Address wasm_target ) { <nl> DCHECK_NE ( code_target . is_null ( ) , wasm_target = = kNullAddress ) ; <nl> / / TODO ( albertnetymk ) : For now we ignore remembered_set_action and fp_mode , <nl> / / i . e . always emit remember set and save FP registers in RecordWriteStub . If <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> Register fp_mode_parameter ( <nl> descriptor . GetRegisterParameter ( RecordWriteDescriptor : : kFPMode ) ) ; <nl> <nl> - MovePair ( object_parameter , object , slot_parameter , address ) ; <nl> + MoveObjectAndSlot ( object_parameter , slot_parameter , object , offset ) ; <nl> <nl> Mov ( remembered_set_parameter , Smi : : FromEnum ( remembered_set_action ) ) ; <nl> Mov ( fp_mode_parameter , Smi : : FromEnum ( fp_mode ) ) ; <nl> void TurboAssembler : : CallRecordWriteStub ( <nl> RestoreRegisters ( registers ) ; <nl> } <nl> <nl> - / / Will clobber : object , address , value . <nl> - / / If lr_status is kLRHasBeenSaved , lr will also be clobbered . <nl> + void TurboAssembler : : MoveObjectAndSlot ( Register dst_object , Register dst_slot , <nl> + Register object , Operand offset ) { <nl> + DCHECK_NE ( dst_object , dst_slot ) ; <nl> + / / If ` offset ` is a register , it cannot overlap with ` object ` . <nl> + DCHECK_IMPLIES ( ! offset . IsImmediate ( ) , offset . reg ( ) ! = object ) ; <nl> + <nl> + / / If the slot register does not overlap with the object register , we can <nl> + / / overwrite it . <nl> + if ( dst_slot ! = object ) { <nl> + Add ( dst_slot , object , offset ) ; <nl> + Mov ( dst_object , object ) ; <nl> + return ; <nl> + } <nl> + <nl> + DCHECK_EQ ( dst_slot , object ) ; <nl> + <nl> + / / If the destination object register does not overlap with the offset <nl> + / / register , we can overwrite it . <nl> + if ( offset . IsImmediate ( ) | | ( offset . reg ( ) ! = dst_object ) ) { <nl> + Mov ( dst_object , dst_slot ) ; <nl> + Add ( dst_slot , dst_slot , offset ) ; <nl> + return ; <nl> + } <nl> + <nl> + DCHECK_EQ ( dst_object , offset . reg ( ) ) ; <nl> + <nl> + / / We only have ` dst_slot ` and ` dst_object ` left as distinct registers so we <nl> + / / have to swap them . We write this as a add + sub sequence to avoid using a <nl> + / / scratch register . <nl> + Add ( dst_slot , dst_slot , dst_object ) ; <nl> + Sub ( dst_object , dst_slot , dst_object ) ; <nl> + } <nl> + <nl> + / / If lr_status is kLRHasBeenSaved , lr will be clobbered . <nl> / / <nl> / / The register ' object ' contains a heap object pointer . The heap object tag is <nl> / / shifted away . <nl> - void MacroAssembler : : RecordWrite ( Register object , Register address , <nl> + void MacroAssembler : : RecordWrite ( Register object , Operand offset , <nl> Register value , LinkRegisterStatus lr_status , <nl> SaveFPRegsMode fp_mode , <nl> RememberedSetAction remembered_set_action , <nl> void MacroAssembler : : RecordWrite ( Register object , Register address , <nl> UseScratchRegisterScope temps ( this ) ; <nl> Register temp = temps . AcquireX ( ) ; <nl> <nl> - LoadTaggedPointerField ( temp , MemOperand ( address ) ) ; <nl> + Add ( temp , object , offset ) ; <nl> + LoadTaggedPointerField ( temp , MemOperand ( temp ) ) ; <nl> Cmp ( temp , value ) ; <nl> Check ( eq , AbortReason : : kWrongAddressOrValuePassedToRecordWrite ) ; <nl> } <nl> void MacroAssembler : : RecordWrite ( Register object , Register address , <nl> DCHECK_EQ ( 0 , kSmiTag ) ; <nl> JumpIfSmi ( value , & done ) ; <nl> } <nl> - CheckPageFlag ( value , <nl> - value , / / Used as scratch . <nl> - MemoryChunk : : kPointersToHereAreInterestingMask , ne , & done ) ; <nl> + CheckPageFlag ( value , MemoryChunk : : kPointersToHereAreInterestingMask , ne , <nl> + & done ) ; <nl> <nl> - CheckPageFlag ( object , <nl> - value , / / Used as scratch . <nl> - MemoryChunk : : kPointersFromHereAreInterestingMask , ne , & done ) ; <nl> + CheckPageFlag ( object , MemoryChunk : : kPointersFromHereAreInterestingMask , ne , <nl> + & done ) ; <nl> <nl> / / Record the actual write . <nl> if ( lr_status = = kLRHasNotBeenSaved ) { <nl> Push ( padreg , lr ) ; <nl> } <nl> - CallRecordWriteStub ( object , address , remembered_set_action , fp_mode ) ; <nl> + CallRecordWriteStub ( object , offset , remembered_set_action , fp_mode ) ; <nl> if ( lr_status = = kLRHasNotBeenSaved ) { <nl> Pop ( lr , padreg ) ; <nl> } <nl> <nl> Bind ( & done ) ; <nl> - <nl> - / / Clobber clobbered registers when running with the debug - code flag <nl> - / / turned on to provoke errors . <nl> - if ( emit_debug_code ( ) ) { <nl> - Mov ( address , Operand ( bit_cast < int64_t > ( kZapValue + 12 ) ) ) ; <nl> - Mov ( value , Operand ( bit_cast < int64_t > ( kZapValue + 16 ) ) ) ; <nl> - } <nl> } <nl> <nl> void TurboAssembler : : Assert ( Condition cond , AbortReason reason ) { <nl> mmm a / src / arm64 / macro - assembler - arm64 . h <nl> ppp b / src / arm64 / macro - assembler - arm64 . h <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> void SaveRegisters ( RegList registers ) ; <nl> void RestoreRegisters ( RegList registers ) ; <nl> <nl> - void CallRecordWriteStub ( Register object , Register address , <nl> + void CallRecordWriteStub ( Register object , Operand offset , <nl> RememberedSetAction remembered_set_action , <nl> SaveFPRegsMode fp_mode ) ; <nl> - void CallRecordWriteStub ( Register object , Register address , <nl> + void CallRecordWriteStub ( Register object , Operand offset , <nl> RememberedSetAction remembered_set_action , <nl> SaveFPRegsMode fp_mode , Address wasm_target ) ; <nl> - void CallEphemeronKeyBarrier ( Register object , Register address , <nl> + void CallEphemeronKeyBarrier ( Register object , Operand offset , <nl> SaveFPRegsMode fp_mode ) ; <nl> <nl> + / / For a given | object | and | offset | : <nl> + / / - Move | object | to | dst_object | . <nl> + / / - Compute the address of the slot pointed to by | offset | in | object | and <nl> + / / write it to | dst_slot | . <nl> + / / This method makes sure | object | and | offset | are allowed to overlap with <nl> + / / the destination registers . <nl> + void MoveObjectAndSlot ( Register dst_object , Register dst_slot , <nl> + Register object , Operand offset ) ; <nl> + <nl> / / Alternative forms of Push and Pop , taking a RegList or CPURegList that <nl> / / specifies the registers that are to be pushed or popped . Higher - numbered <nl> / / registers are associated with higher memory addresses ( as in the A32 push <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> Operand MoveImmediateForShiftedOp ( const Register & dst , int64_t imm , <nl> PreShiftImmMode mode ) ; <nl> <nl> - void CheckPageFlag ( const Register & object , const Register & scratch , int mask , <nl> - Condition cc , Label * condition_met ) ; <nl> + void CheckPageFlag ( const Register & object , int mask , Condition cc , <nl> + Label * condition_met ) ; <nl> <nl> / / Test the bits of register defined by bit_pattern , and branch if ANY of <nl> / / those bits are set . May corrupt the status flags . <nl> class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase { <nl> <nl> void JumpHelper ( int64_t offset , RelocInfo : : Mode rmode , Condition cond = al ) ; <nl> <nl> - void CallRecordWriteStub ( Register object , Register address , <nl> + void CallRecordWriteStub ( Register object , Operand offset , <nl> RememberedSetAction remembered_set_action , <nl> SaveFPRegsMode fp_mode , Handle < Code > code_target , <nl> Address wasm_target ) ; <nl> class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler { <nl> <nl> / / Notify the garbage collector that we wrote a pointer into an object . <nl> / / | object | is the object being stored into , | value | is the object being <nl> - / / stored . value and scratch registers are clobbered by the operation . <nl> + / / stored . <nl> / / The offset is the offset from the start of the object , not the offset from <nl> / / the tagged HeapObject pointer . For use with FieldMemOperand ( reg , off ) . <nl> void RecordWriteField ( <nl> - Register object , int offset , Register value , Register scratch , <nl> - LinkRegisterStatus lr_status , SaveFPRegsMode save_fp , <nl> + Register object , int offset , Register value , LinkRegisterStatus lr_status , <nl> + SaveFPRegsMode save_fp , <nl> RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET , <nl> SmiCheck smi_check = INLINE_SMI_CHECK ) ; <nl> <nl> - / / For a given | object | notify the garbage collector that the slot | address | <nl> - / / has been written . | value | is the object being stored . The value and <nl> - / / address registers are clobbered by the operation . <nl> + / / For a given | object | notify the garbage collector that the slot at | offset | <nl> + / / has been written . | value | is the object being stored . <nl> void RecordWrite ( <nl> - Register object , Register address , Register value , <nl> + Register object , Operand offset , Register value , <nl> LinkRegisterStatus lr_status , SaveFPRegsMode save_fp , <nl> RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET , <nl> SmiCheck smi_check = INLINE_SMI_CHECK ) ; <nl> mmm a / src / builtins / arm / builtins - arm . cc <nl> ppp b / src / builtins / arm / builtins - arm . cc <nl> void Builtins : : Generate_ResumeGeneratorTrampoline ( MacroAssembler * masm ) { <nl> <nl> / / Store input value into generator object . <nl> __ str ( r0 , FieldMemOperand ( r1 , JSGeneratorObject : : kInputOrDebugPosOffset ) ) ; <nl> - __ RecordWriteField ( r1 , JSGeneratorObject : : kInputOrDebugPosOffset , r0 , r3 , <nl> + __ RecordWriteField ( r1 , JSGeneratorObject : : kInputOrDebugPosOffset , r0 , <nl> kLRHasNotBeenSaved , kDontSaveFPRegs ) ; <nl> <nl> / / Load suspended function and context . <nl> void Builtins : : Generate_RunMicrotasksTrampoline ( MacroAssembler * masm ) { <nl> __ Jump ( BUILTIN_CODE ( masm - > isolate ( ) , RunMicrotasks ) , RelocInfo : : CODE_TARGET ) ; <nl> } <nl> <nl> - static void ReplaceClosureCodeWithOptimizedCode ( <nl> - MacroAssembler * masm , Register optimized_code , Register closure , <nl> - Register scratch1 , Register scratch2 , Register scratch3 ) { <nl> + static void ReplaceClosureCodeWithOptimizedCode ( MacroAssembler * masm , <nl> + Register optimized_code , <nl> + Register closure ) { <nl> / / Store code entry in the closure . <nl> __ str ( optimized_code , FieldMemOperand ( closure , JSFunction : : kCodeOffset ) ) ; <nl> - __ mov ( scratch1 , optimized_code ) ; / / Write barrier clobbers scratch1 below . <nl> - __ RecordWriteField ( closure , JSFunction : : kCodeOffset , scratch1 , scratch2 , <nl> + __ RecordWriteField ( closure , JSFunction : : kCodeOffset , optimized_code , <nl> kLRHasNotBeenSaved , kDontSaveFPRegs , OMIT_REMEMBERED_SET , <nl> OMIT_SMI_CHECK ) ; <nl> } <nl> static void TailCallRuntimeIfMarkerEquals ( MacroAssembler * masm , <nl> <nl> static void MaybeTailCallOptimizedCodeSlot ( MacroAssembler * masm , <nl> Register feedback_vector , <nl> - Register scratch1 , Register scratch2 , <nl> - Register scratch3 ) { <nl> + Register scratch1 , <nl> + Register scratch2 ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> / / - - r3 : new target ( preserved for callee if needed , and caller ) <nl> / / - - r1 : target function ( preserved for callee if needed , and caller ) <nl> / / - - feedback vector ( preserved for caller if needed ) <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - DCHECK ( ! AreAliased ( feedback_vector , r1 , r3 , scratch1 , scratch2 , scratch3 ) ) ; <nl> + DCHECK ( ! AreAliased ( feedback_vector , r1 , r3 , scratch1 , scratch2 ) ) ; <nl> <nl> Label optimized_code_slot_is_weak_ref , fallthrough ; <nl> <nl> static void MaybeTailCallOptimizedCodeSlot ( MacroAssembler * masm , <nl> / / the optimized functions list , then tail call the optimized code . <nl> / / The feedback vector is no longer used , so re - use it as a scratch <nl> / / register . <nl> - ReplaceClosureCodeWithOptimizedCode ( masm , optimized_code_entry , closure , <nl> - scratch2 , scratch3 , feedback_vector ) ; <nl> + ReplaceClosureCodeWithOptimizedCode ( masm , optimized_code_entry , closure ) ; <nl> static_assert ( kJavaScriptCallCodeStartRegister = = r2 , " ABI mismatch " ) ; <nl> __ LoadCodeObjectEntry ( r2 , optimized_code_entry ) ; <nl> __ Jump ( r2 ) ; <nl> void Builtins : : Generate_InterpreterEntryTrampoline ( MacroAssembler * masm ) { <nl> <nl> / / Read off the optimized code slot in the feedback vector , and if there <nl> / / is optimized code or an optimization marker , call that instead . <nl> - MaybeTailCallOptimizedCodeSlot ( masm , feedback_vector , r4 , r6 , r5 ) ; <nl> + MaybeTailCallOptimizedCodeSlot ( masm , feedback_vector , r4 , r6 ) ; <nl> <nl> / / Increment invocation count for the function . <nl> __ ldr ( r9 , FieldMemOperand ( feedback_vector , <nl> mmm a / src / builtins / arm64 / builtins - arm64 . cc <nl> ppp b / src / builtins / arm64 / builtins - arm64 . cc <nl> void Builtins : : Generate_ResumeGeneratorTrampoline ( MacroAssembler * masm ) { <nl> / / Store input value into generator object . <nl> __ StoreTaggedField ( <nl> x0 , FieldMemOperand ( x1 , JSGeneratorObject : : kInputOrDebugPosOffset ) ) ; <nl> - __ RecordWriteField ( x1 , JSGeneratorObject : : kInputOrDebugPosOffset , x0 , x3 , <nl> + __ RecordWriteField ( x1 , JSGeneratorObject : : kInputOrDebugPosOffset , x0 , <nl> kLRHasNotBeenSaved , kDontSaveFPRegs ) ; <nl> <nl> / / Load suspended function and context . <nl> void Builtins : : Generate_RunMicrotasksTrampoline ( MacroAssembler * masm ) { <nl> __ Jump ( BUILTIN_CODE ( masm - > isolate ( ) , RunMicrotasks ) , RelocInfo : : CODE_TARGET ) ; <nl> } <nl> <nl> - static void ReplaceClosureCodeWithOptimizedCode ( <nl> - MacroAssembler * masm , Register optimized_code , Register closure , <nl> - Register scratch1 , Register scratch2 , Register scratch3 ) { <nl> + static void ReplaceClosureCodeWithOptimizedCode ( MacroAssembler * masm , <nl> + Register optimized_code , <nl> + Register closure ) { <nl> / / Store code entry in the closure . <nl> __ StoreTaggedField ( optimized_code , <nl> FieldMemOperand ( closure , JSFunction : : kCodeOffset ) ) ; <nl> - __ Mov ( scratch1 , optimized_code ) ; / / Write barrier clobbers scratch1 below . <nl> - __ RecordWriteField ( closure , JSFunction : : kCodeOffset , scratch1 , scratch2 , <nl> + __ RecordWriteField ( closure , JSFunction : : kCodeOffset , optimized_code , <nl> kLRHasNotBeenSaved , kDontSaveFPRegs , OMIT_REMEMBERED_SET , <nl> OMIT_SMI_CHECK ) ; <nl> } <nl> static void TailCallRuntimeIfMarkerEquals ( MacroAssembler * masm , <nl> <nl> static void MaybeTailCallOptimizedCodeSlot ( MacroAssembler * masm , <nl> Register feedback_vector , <nl> - Register scratch1 , Register scratch2 , <nl> - Register scratch3 ) { <nl> + Register scratch1 , <nl> + Register scratch2 ) { <nl> / / mmmmmmmmm - - S t a t e mmmmmmmmmmmm - <nl> / / - - x3 : new target ( preserved for callee if needed , and caller ) <nl> / / - - x1 : target function ( preserved for callee if needed , and caller ) <nl> / / - - feedback vector ( preserved for caller if needed ) <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - DCHECK ( ! AreAliased ( feedback_vector , x1 , x3 , scratch1 , scratch2 , scratch3 ) ) ; <nl> + DCHECK ( ! AreAliased ( feedback_vector , x1 , x3 , scratch1 , scratch2 ) ) ; <nl> <nl> Label optimized_code_slot_is_weak_ref , fallthrough ; <nl> <nl> static void MaybeTailCallOptimizedCodeSlot ( MacroAssembler * masm , <nl> / / the optimized functions list , then tail call the optimized code . <nl> / / The feedback vector is no longer used , so re - use it as a scratch <nl> / / register . <nl> - ReplaceClosureCodeWithOptimizedCode ( masm , optimized_code_entry , closure , <nl> - scratch2 , scratch3 , feedback_vector ) ; <nl> + ReplaceClosureCodeWithOptimizedCode ( masm , optimized_code_entry , closure ) ; <nl> static_assert ( kJavaScriptCallCodeStartRegister = = x2 , " ABI mismatch " ) ; <nl> __ LoadCodeObjectEntry ( x2 , optimized_code_entry ) ; <nl> __ Jump ( x2 ) ; <nl> void Builtins : : Generate_InterpreterEntryTrampoline ( MacroAssembler * masm ) { <nl> <nl> / / Read off the optimized code slot in the feedback vector , and if there <nl> / / is optimized code or an optimization marker , call that instead . <nl> - MaybeTailCallOptimizedCodeSlot ( masm , feedback_vector , x7 , x4 , x5 ) ; <nl> + MaybeTailCallOptimizedCodeSlot ( masm , feedback_vector , x7 , x4 ) ; <nl> <nl> / / Increment invocation count for the function . <nl> / / MaybeTailCallOptimizedCodeSlot preserves feedback_vector , so safe to reuse <nl> mmm a / src / compiler / backend / arm / code - generator - arm . cc <nl> ppp b / src / compiler / backend / arm / code - generator - arm . cc <nl> namespace { <nl> <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> public : <nl> - OutOfLineRecordWrite ( CodeGenerator * gen , Register object , Register index , <nl> - Register value , Register scratch0 , Register scratch1 , <nl> - RecordWriteMode mode , StubCallMode stub_mode , <nl> + OutOfLineRecordWrite ( CodeGenerator * gen , Register object , Operand offset , <nl> + Register value , RecordWriteMode mode , <nl> + StubCallMode stub_mode , <nl> UnwindingInfoWriter * unwinding_info_writer ) <nl> : OutOfLineCode ( gen ) , <nl> object_ ( object ) , <nl> - index_ ( index ) , <nl> - index_immediate_ ( 0 ) , <nl> + offset_ ( offset ) , <nl> value_ ( value ) , <nl> - scratch0_ ( scratch0 ) , <nl> - scratch1_ ( scratch1 ) , <nl> - mode_ ( mode ) , <nl> - stub_mode_ ( stub_mode ) , <nl> - must_save_lr_ ( ! gen - > frame_access_state ( ) - > has_frame ( ) ) , <nl> - unwinding_info_writer_ ( unwinding_info_writer ) , <nl> - zone_ ( gen - > zone ( ) ) { } <nl> - <nl> - OutOfLineRecordWrite ( CodeGenerator * gen , Register object , int32_t index , <nl> - Register value , Register scratch0 , Register scratch1 , <nl> - RecordWriteMode mode , StubCallMode stub_mode , <nl> - UnwindingInfoWriter * unwinding_info_writer ) <nl> - : OutOfLineCode ( gen ) , <nl> - object_ ( object ) , <nl> - index_ ( no_reg ) , <nl> - index_immediate_ ( index ) , <nl> - value_ ( value ) , <nl> - scratch0_ ( scratch0 ) , <nl> - scratch1_ ( scratch1 ) , <nl> mode_ ( mode ) , <nl> stub_mode_ ( stub_mode ) , <nl> must_save_lr_ ( ! gen - > frame_access_state ( ) - > has_frame ( ) ) , <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> if ( mode_ > RecordWriteMode : : kValueIsPointer ) { <nl> __ JumpIfSmi ( value_ , exit ( ) ) ; <nl> } <nl> - __ CheckPageFlag ( value_ , scratch0_ , <nl> - MemoryChunk : : kPointersToHereAreInterestingMask , eq , <nl> + __ CheckPageFlag ( value_ , MemoryChunk : : kPointersToHereAreInterestingMask , eq , <nl> exit ( ) ) ; <nl> - if ( index_ = = no_reg ) { <nl> - __ add ( scratch1_ , object_ , Operand ( index_immediate_ ) ) ; <nl> - } else { <nl> - DCHECK_EQ ( 0 , index_immediate_ ) ; <nl> - __ add ( scratch1_ , object_ , Operand ( index_ ) ) ; <nl> - } <nl> RememberedSetAction const remembered_set_action = <nl> mode_ > RecordWriteMode : : kValueIsMap ? EMIT_REMEMBERED_SET <nl> : OMIT_REMEMBERED_SET ; <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> unwinding_info_writer_ - > MarkLinkRegisterOnTopOfStack ( __ pc_offset ( ) ) ; <nl> } <nl> if ( mode_ = = RecordWriteMode : : kValueIsEphemeronKey ) { <nl> - __ CallEphemeronKeyBarrier ( object_ , scratch1_ , save_fp_mode ) ; <nl> + __ CallEphemeronKeyBarrier ( object_ , offset_ , save_fp_mode ) ; <nl> } else if ( stub_mode_ = = StubCallMode : : kCallWasmRuntimeStub ) { <nl> - __ CallRecordWriteStub ( object_ , scratch1_ , remembered_set_action , <nl> + __ CallRecordWriteStub ( object_ , offset_ , remembered_set_action , <nl> save_fp_mode , wasm : : WasmCode : : kWasmRecordWrite ) ; <nl> } else { <nl> - __ CallRecordWriteStub ( object_ , scratch1_ , remembered_set_action , <nl> + __ CallRecordWriteStub ( object_ , offset_ , remembered_set_action , <nl> save_fp_mode ) ; <nl> } <nl> if ( must_save_lr_ ) { <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> <nl> private : <nl> Register const object_ ; <nl> - Register const index_ ; <nl> - int32_t const index_immediate_ ; / / Valid if index_ = = no_reg . <nl> + Operand const offset_ ; <nl> Register const value_ ; <nl> - Register const scratch0_ ; <nl> - Register const scratch1_ ; <nl> RecordWriteMode const mode_ ; <nl> StubCallMode stub_mode_ ; <nl> bool must_save_lr_ ; <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> static_cast < RecordWriteMode > ( MiscField : : decode ( instr - > opcode ( ) ) ) ; <nl> Register object = i . InputRegister ( 0 ) ; <nl> Register value = i . InputRegister ( 2 ) ; <nl> - Register scratch0 = i . TempRegister ( 0 ) ; <nl> - Register scratch1 = i . TempRegister ( 1 ) ; <nl> - OutOfLineRecordWrite * ool ; <nl> <nl> AddressingMode addressing_mode = <nl> AddressingModeField : : decode ( instr - > opcode ( ) ) ; <nl> + Operand offset ( 0 ) ; <nl> if ( addressing_mode = = kMode_Offset_RI ) { <nl> - int32_t index = i . InputInt32 ( 1 ) ; <nl> - ool = new ( zone ( ) ) OutOfLineRecordWrite ( <nl> - this , object , index , value , scratch0 , scratch1 , mode , <nl> - DetermineStubCallMode ( ) , & unwinding_info_writer_ ) ; <nl> - __ str ( value , MemOperand ( object , index ) ) ; <nl> + int32_t immediate = i . InputInt32 ( 1 ) ; <nl> + offset = Operand ( immediate ) ; <nl> + __ str ( value , MemOperand ( object , immediate ) ) ; <nl> } else { <nl> DCHECK_EQ ( kMode_Offset_RR , addressing_mode ) ; <nl> - Register index ( i . InputRegister ( 1 ) ) ; <nl> - ool = new ( zone ( ) ) OutOfLineRecordWrite ( <nl> - this , object , index , value , scratch0 , scratch1 , mode , <nl> - DetermineStubCallMode ( ) , & unwinding_info_writer_ ) ; <nl> - __ str ( value , MemOperand ( object , index ) ) ; <nl> + Register reg = i . InputRegister ( 1 ) ; <nl> + offset = Operand ( reg ) ; <nl> + __ str ( value , MemOperand ( object , reg ) ) ; <nl> } <nl> - __ CheckPageFlag ( object , scratch0 , <nl> - MemoryChunk : : kPointersFromHereAreInterestingMask , ne , <nl> - ool - > entry ( ) ) ; <nl> + auto ool = new ( zone ( ) ) OutOfLineRecordWrite ( <nl> + this , object , offset , value , mode , DetermineStubCallMode ( ) , <nl> + & unwinding_info_writer_ ) ; <nl> + __ CheckPageFlag ( object , MemoryChunk : : kPointersFromHereAreInterestingMask , <nl> + ne , ool - > entry ( ) ) ; <nl> __ bind ( ool - > exit ( ) ) ; <nl> break ; <nl> } <nl> mmm a / src / compiler / backend / arm / instruction - selector - arm . cc <nl> ppp b / src / compiler / backend / arm / instruction - selector - arm . cc <nl> void InstructionSelector : : VisitStore ( Node * node ) { <nl> inputs [ input_count + + ] = g . UseUniqueRegister ( value ) ; <nl> RecordWriteMode record_write_mode = <nl> WriteBarrierKindToRecordWriteMode ( write_barrier_kind ) ; <nl> - InstructionOperand temps [ ] = { g . TempRegister ( ) , g . TempRegister ( ) } ; <nl> - size_t const temp_count = arraysize ( temps ) ; <nl> InstructionCode code = kArchStoreWithWriteBarrier ; <nl> code | = AddressingModeField : : encode ( addressing_mode ) ; <nl> code | = MiscField : : encode ( static_cast < int > ( record_write_mode ) ) ; <nl> - Emit ( code , 0 , nullptr , input_count , inputs , temp_count , temps ) ; <nl> + Emit ( code , 0 , nullptr , input_count , inputs ) ; <nl> } else { <nl> InstructionCode opcode = kArchNop ; <nl> switch ( rep ) { <nl> mmm a / src / compiler / backend / arm64 / code - generator - arm64 . cc <nl> ppp b / src / compiler / backend / arm64 / code - generator - arm64 . cc <nl> namespace { <nl> <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> public : <nl> - OutOfLineRecordWrite ( CodeGenerator * gen , Register object , Operand index , <nl> - Register value , Register scratch0 , Register scratch1 , <nl> - RecordWriteMode mode , StubCallMode stub_mode , <nl> + OutOfLineRecordWrite ( CodeGenerator * gen , Register object , Operand offset , <nl> + Register value , RecordWriteMode mode , <nl> + StubCallMode stub_mode , <nl> UnwindingInfoWriter * unwinding_info_writer ) <nl> : OutOfLineCode ( gen ) , <nl> object_ ( object ) , <nl> - index_ ( index ) , <nl> + offset_ ( offset ) , <nl> value_ ( value ) , <nl> - scratch0_ ( scratch0 ) , <nl> - scratch1_ ( scratch1 ) , <nl> mode_ ( mode ) , <nl> stub_mode_ ( stub_mode ) , <nl> must_save_lr_ ( ! gen - > frame_access_state ( ) - > has_frame ( ) ) , <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> if ( COMPRESS_POINTERS_BOOL ) { <nl> __ DecompressTaggedPointer ( value_ , value_ ) ; <nl> } <nl> - __ CheckPageFlag ( value_ , scratch0_ , <nl> - MemoryChunk : : kPointersToHereAreInterestingMask , ne , <nl> + __ CheckPageFlag ( value_ , MemoryChunk : : kPointersToHereAreInterestingMask , ne , <nl> exit ( ) ) ; <nl> - __ Add ( scratch1_ , object_ , index_ ) ; <nl> RememberedSetAction const remembered_set_action = <nl> mode_ > RecordWriteMode : : kValueIsMap ? EMIT_REMEMBERED_SET <nl> : OMIT_REMEMBERED_SET ; <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> unwinding_info_writer_ - > MarkLinkRegisterOnTopOfStack ( __ pc_offset ( ) , sp ) ; <nl> } <nl> if ( mode_ = = RecordWriteMode : : kValueIsEphemeronKey ) { <nl> - __ CallEphemeronKeyBarrier ( object_ , scratch1_ , save_fp_mode ) ; <nl> + __ CallEphemeronKeyBarrier ( object_ , offset_ , save_fp_mode ) ; <nl> } else if ( stub_mode_ = = StubCallMode : : kCallWasmRuntimeStub ) { <nl> / / A direct call to a wasm runtime stub defined in this module . <nl> / / Just encode the stub index . This will be patched when the code <nl> / / is added to the native module and copied into wasm code space . <nl> - __ CallRecordWriteStub ( object_ , scratch1_ , remembered_set_action , <nl> + __ CallRecordWriteStub ( object_ , offset_ , remembered_set_action , <nl> save_fp_mode , wasm : : WasmCode : : kWasmRecordWrite ) ; <nl> } else { <nl> - __ CallRecordWriteStub ( object_ , scratch1_ , remembered_set_action , <nl> + __ CallRecordWriteStub ( object_ , offset_ , remembered_set_action , <nl> save_fp_mode ) ; <nl> } <nl> if ( must_save_lr_ ) { <nl> class OutOfLineRecordWrite final : public OutOfLineCode { <nl> <nl> private : <nl> Register const object_ ; <nl> - Operand const index_ ; <nl> + Operand const offset_ ; <nl> Register const value_ ; <nl> - Register const scratch0_ ; <nl> - Register const scratch1_ ; <nl> RecordWriteMode const mode_ ; <nl> StubCallMode const stub_mode_ ; <nl> bool must_save_lr_ ; <nl> CodeGenerator : : CodeGenResult CodeGenerator : : AssembleArchInstruction ( <nl> AddressingMode addressing_mode = <nl> AddressingModeField : : decode ( instr - > opcode ( ) ) ; <nl> Register object = i . InputRegister ( 0 ) ; <nl> - Operand index ( 0 ) ; <nl> + Operand offset ( 0 ) ; <nl> if ( addressing_mode = = kMode_MRI ) { <nl> - index = Operand ( i . InputInt64 ( 1 ) ) ; <nl> + offset = Operand ( i . InputInt64 ( 1 ) ) ; <nl> } else { <nl> DCHECK_EQ ( addressing_mode , kMode_MRR ) ; <nl> - index = Operand ( i . InputRegister ( 1 ) ) ; <nl> + offset = Operand ( i . InputRegister ( 1 ) ) ; <nl> } <nl> Register value = i . InputRegister ( 2 ) ; <nl> - Register scratch0 = i . TempRegister ( 0 ) ; <nl> - Register scratch1 = i . TempRegister ( 1 ) ; <nl> auto ool = new ( zone ( ) ) OutOfLineRecordWrite ( <nl> - this , object , index , value , scratch0 , scratch1 , mode , <nl> - DetermineStubCallMode ( ) , & unwinding_info_writer_ ) ; <nl> - __ StoreTaggedField ( value , MemOperand ( object , index ) ) ; <nl> + this , object , offset , value , mode , DetermineStubCallMode ( ) , <nl> + & unwinding_info_writer_ ) ; <nl> + __ StoreTaggedField ( value , MemOperand ( object , offset ) ) ; <nl> if ( COMPRESS_POINTERS_BOOL ) { <nl> __ DecompressTaggedPointer ( object , object ) ; <nl> } <nl> - __ CheckPageFlag ( object , scratch0 , <nl> - MemoryChunk : : kPointersFromHereAreInterestingMask , eq , <nl> - ool - > entry ( ) ) ; <nl> + __ CheckPageFlag ( object , MemoryChunk : : kPointersFromHereAreInterestingMask , <nl> + eq , ool - > entry ( ) ) ; <nl> __ Bind ( ool - > exit ( ) ) ; <nl> break ; <nl> } <nl> mmm a / src / compiler / backend / arm64 / instruction - selector - arm64 . cc <nl> ppp b / src / compiler / backend / arm64 / instruction - selector - arm64 . cc <nl> void InstructionSelector : : VisitStore ( Node * node ) { <nl> inputs [ input_count + + ] = g . UseUniqueRegister ( value ) ; <nl> RecordWriteMode record_write_mode = <nl> WriteBarrierKindToRecordWriteMode ( write_barrier_kind ) ; <nl> - InstructionOperand temps [ ] = { g . TempRegister ( ) , g . TempRegister ( ) } ; <nl> - size_t const temp_count = arraysize ( temps ) ; <nl> InstructionCode code = kArchStoreWithWriteBarrier ; <nl> code | = AddressingModeField : : encode ( addressing_mode ) ; <nl> code | = MiscField : : encode ( static_cast < int > ( record_write_mode ) ) ; <nl> - Emit ( code , 0 , nullptr , input_count , inputs , temp_count , temps ) ; <nl> + Emit ( code , 0 , nullptr , input_count , inputs ) ; <nl> } else { <nl> InstructionOperand inputs [ 4 ] ; <nl> size_t input_count = 0 ; <nl> mmm a / test / unittests / assembler / turbo - assembler - arm - unittest . cc <nl> ppp b / test / unittests / assembler / turbo - assembler - arm - unittest . cc <nl> <nl> <nl> # include " src / arm / assembler - arm - inl . h " <nl> # include " src / macro - assembler . h " <nl> + # include " src / ostreams . h " <nl> # include " src / simulator . h " <nl> # include " test / common / assembler - tester . h " <nl> # include " test / unittests / test - utils . h " <nl> TEST_F ( TurboAssemblerTest , TestCheck ) { <nl> ASSERT_DEATH_IF_SUPPORTED ( { f . Call ( 17 ) ; } , ERROR_MESSAGE ( " abort : no reason " ) ) ; <nl> } <nl> <nl> + struct MoveObjectAndSlotTestCase { <nl> + const char * comment ; <nl> + Register dst_object ; <nl> + Register dst_slot ; <nl> + Register object ; <nl> + Register offset_register = no_reg ; <nl> + } ; <nl> + <nl> + const MoveObjectAndSlotTestCase kMoveObjectAndSlotTestCases [ ] = { <nl> + { " no overlap " , r0 , r1 , r2 } , <nl> + { " no overlap " , r0 , r1 , r2 , r3 } , <nl> + <nl> + { " object = = dst_object " , r2 , r1 , r2 } , <nl> + { " object = = dst_object " , r2 , r1 , r2 , r3 } , <nl> + <nl> + { " object = = dst_slot " , r1 , r2 , r2 } , <nl> + { " object = = dst_slot " , r1 , r2 , r2 , r3 } , <nl> + <nl> + { " offset = = dst_object " , r0 , r1 , r2 , r0 } , <nl> + <nl> + { " offset = = dst_object & & object = = dst_slot " , r0 , r1 , r1 , r0 } , <nl> + <nl> + { " offset = = dst_slot " , r0 , r1 , r2 , r1 } , <nl> + <nl> + { " offset = = dst_slot & & object = = dst_object " , r0 , r1 , r0 , r1 } } ; <nl> + <nl> + / / Make sure we include offsets that cannot be encoded in an add instruction . <nl> + const int kOffsets [ ] = { 0 , 42 , kMaxRegularHeapObjectSize , 0x101001 } ; <nl> + <nl> + template < typename T > <nl> + class TurboAssemblerTestWithParam : public TurboAssemblerTest , <nl> + public : : testing : : WithParamInterface < T > { } ; <nl> + <nl> + using TurboAssemblerTestMoveObjectAndSlot = <nl> + TurboAssemblerTestWithParam < MoveObjectAndSlotTestCase > ; <nl> + <nl> + TEST_P ( TurboAssemblerTestMoveObjectAndSlot , MoveObjectAndSlot ) { <nl> + const MoveObjectAndSlotTestCase test_case = GetParam ( ) ; <nl> + TRACED_FOREACH ( int32_t , offset , kOffsets ) { <nl> + auto buffer = AllocateAssemblerBuffer ( ) ; <nl> + TurboAssembler tasm ( nullptr , AssemblerOptions { } , CodeObjectRequired : : kNo , <nl> + buffer - > CreateView ( ) ) ; <nl> + __ Push ( r0 ) ; <nl> + __ Move ( test_case . object , r1 ) ; <nl> + <nl> + Register src_object = test_case . object ; <nl> + Register dst_object = test_case . dst_object ; <nl> + Register dst_slot = test_case . dst_slot ; <nl> + <nl> + Operand offset_operand ( 0 ) ; <nl> + if ( test_case . offset_register = = no_reg ) { <nl> + offset_operand = Operand ( offset ) ; <nl> + } else { <nl> + __ mov ( test_case . offset_register , Operand ( offset ) ) ; <nl> + offset_operand = Operand ( test_case . offset_register ) ; <nl> + } <nl> + <nl> + std : : stringstream comment ; <nl> + comment < < " - - " < < test_case . comment < < " : MoveObjectAndSlot ( " <nl> + < < dst_object < < " , " < < dst_slot < < " , " < < src_object < < " , " ; <nl> + if ( test_case . offset_register = = no_reg ) { <nl> + comment < < " # " < < offset ; <nl> + } else { <nl> + comment < < test_case . offset_register ; <nl> + } <nl> + comment < < " ) - - " ; <nl> + __ RecordComment ( comment . str ( ) . c_str ( ) ) ; <nl> + __ MoveObjectAndSlot ( dst_object , dst_slot , src_object , offset_operand ) ; <nl> + __ RecordComment ( " - - " ) ; <nl> + <nl> + / / The ` result ` pointer was saved on the stack . <nl> + UseScratchRegisterScope temps ( & tasm ) ; <nl> + Register scratch = temps . Acquire ( ) ; <nl> + __ Pop ( scratch ) ; <nl> + __ str ( dst_object , MemOperand ( scratch ) ) ; <nl> + __ str ( dst_slot , MemOperand ( scratch , kSystemPointerSize ) ) ; <nl> + <nl> + __ Ret ( ) ; <nl> + <nl> + CodeDesc desc ; <nl> + tasm . GetCode ( nullptr , & desc ) ; <nl> + if ( FLAG_print_code ) { <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate ( ) , desc , Code : : STUB ) . Build ( ) ; <nl> + StdoutStream os ; <nl> + code - > Print ( os ) ; <nl> + } <nl> + <nl> + buffer - > MakeExecutable ( ) ; <nl> + / / We need an isolate here to execute in the simulator . <nl> + auto f = GeneratedCode < void , byte * * , byte * > : : FromBuffer ( isolate ( ) , <nl> + buffer - > start ( ) ) ; <nl> + <nl> + byte * object = new byte [ offset ] ; <nl> + byte * result [ ] = { nullptr , nullptr } ; <nl> + <nl> + f . Call ( result , object ) ; <nl> + <nl> + / / The first element must be the address of the object , and the second the <nl> + / / slot addressed by ` offset ` . <nl> + EXPECT_EQ ( result [ 0 ] , & object [ 0 ] ) ; <nl> + EXPECT_EQ ( result [ 1 ] , & object [ offset ] ) ; <nl> + <nl> + delete [ ] object ; <nl> + } <nl> + } <nl> + <nl> + INSTANTIATE_TEST_SUITE_P ( TurboAssemblerTest , <nl> + TurboAssemblerTestMoveObjectAndSlot , <nl> + : : testing : : ValuesIn ( kMoveObjectAndSlotTestCases ) ) ; <nl> + <nl> # undef __ <nl> # undef ERROR_MESSAGE <nl> <nl> mmm a / test / unittests / assembler / turbo - assembler - arm64 - unittest . cc <nl> ppp b / test / unittests / assembler / turbo - assembler - arm64 - unittest . cc <nl> <nl> <nl> # include " src / arm64 / macro - assembler - arm64 - inl . h " <nl> # include " src / macro - assembler . h " <nl> + # include " src / ostreams . h " <nl> # include " src / simulator . h " <nl> # include " test / common / assembler - tester . h " <nl> # include " test / unittests / test - utils . h " <nl> TEST_F ( TurboAssemblerTest , TestCheck ) { <nl> ASSERT_DEATH_IF_SUPPORTED ( { f . Call ( 17 ) ; } , ERROR_MESSAGE ( " abort : no reason " ) ) ; <nl> } <nl> <nl> + struct MoveObjectAndSlotTestCase { <nl> + const char * comment ; <nl> + Register dst_object ; <nl> + Register dst_slot ; <nl> + Register object ; <nl> + Register offset_register = no_reg ; <nl> + } ; <nl> + <nl> + const MoveObjectAndSlotTestCase kMoveObjectAndSlotTestCases [ ] = { <nl> + { " no overlap " , x0 , x1 , x2 } , <nl> + { " no overlap " , x0 , x1 , x2 , x3 } , <nl> + <nl> + { " object = = dst_object " , x2 , x1 , x2 } , <nl> + { " object = = dst_object " , x2 , x1 , x2 , x3 } , <nl> + <nl> + { " object = = dst_slot " , x1 , x2 , x2 } , <nl> + { " object = = dst_slot " , x1 , x2 , x2 , x3 } , <nl> + <nl> + { " offset = = dst_object " , x0 , x1 , x2 , x0 } , <nl> + <nl> + { " offset = = dst_object & & object = = dst_slot " , x0 , x1 , x1 , x0 } , <nl> + <nl> + { " offset = = dst_slot " , x0 , x1 , x2 , x1 } , <nl> + <nl> + { " offset = = dst_slot & & object = = dst_object " , x0 , x1 , x0 , x1 } } ; <nl> + <nl> + / / Make sure we include offsets that cannot be encoded in an add instruction . <nl> + const int kOffsets [ ] = { 0 , 42 , kMaxRegularHeapObjectSize , 0x101001 } ; <nl> + <nl> + template < typename T > <nl> + class TurboAssemblerTestWithParam : public TurboAssemblerTest , <nl> + public : : testing : : WithParamInterface < T > { } ; <nl> + <nl> + using TurboAssemblerTestMoveObjectAndSlot = <nl> + TurboAssemblerTestWithParam < MoveObjectAndSlotTestCase > ; <nl> + <nl> + TEST_P ( TurboAssemblerTestMoveObjectAndSlot , MoveObjectAndSlot ) { <nl> + const MoveObjectAndSlotTestCase test_case = GetParam ( ) ; <nl> + TRACED_FOREACH ( int32_t , offset , kOffsets ) { <nl> + auto buffer = AllocateAssemblerBuffer ( ) ; <nl> + TurboAssembler tasm ( nullptr , AssemblerOptions { } , CodeObjectRequired : : kNo , <nl> + buffer - > CreateView ( ) ) ; <nl> + <nl> + __ Push ( x0 , padreg ) ; <nl> + __ Mov ( test_case . object , x1 ) ; <nl> + <nl> + Register src_object = test_case . object ; <nl> + Register dst_object = test_case . dst_object ; <nl> + Register dst_slot = test_case . dst_slot ; <nl> + <nl> + Operand offset_operand ( 0 ) ; <nl> + if ( test_case . offset_register . Is ( no_reg ) ) { <nl> + offset_operand = Operand ( offset ) ; <nl> + } else { <nl> + __ Mov ( test_case . offset_register , Operand ( offset ) ) ; <nl> + offset_operand = Operand ( test_case . offset_register ) ; <nl> + } <nl> + <nl> + std : : stringstream comment ; <nl> + comment < < " - - " < < test_case . comment < < " : MoveObjectAndSlot ( " <nl> + < < dst_object < < " , " < < dst_slot < < " , " < < src_object < < " , " ; <nl> + if ( test_case . offset_register . Is ( no_reg ) ) { <nl> + comment < < " # " < < offset ; <nl> + } else { <nl> + comment < < test_case . offset_register ; <nl> + } <nl> + comment < < " ) - - " ; <nl> + __ RecordComment ( comment . str ( ) . c_str ( ) ) ; <nl> + __ MoveObjectAndSlot ( dst_object , dst_slot , src_object , offset_operand ) ; <nl> + __ RecordComment ( " - - " ) ; <nl> + <nl> + / / The ` result ` pointer was saved on the stack . <nl> + UseScratchRegisterScope temps ( & tasm ) ; <nl> + Register scratch = temps . AcquireX ( ) ; <nl> + __ Pop ( padreg , scratch ) ; <nl> + __ Str ( dst_object , MemOperand ( scratch ) ) ; <nl> + __ Str ( dst_slot , MemOperand ( scratch , kSystemPointerSize ) ) ; <nl> + <nl> + __ Ret ( ) ; <nl> + <nl> + CodeDesc desc ; <nl> + tasm . GetCode ( nullptr , & desc ) ; <nl> + if ( FLAG_print_code ) { <nl> + Handle < Code > code = <nl> + Factory : : CodeBuilder ( isolate ( ) , desc , Code : : STUB ) . Build ( ) ; <nl> + StdoutStream os ; <nl> + code - > Print ( os ) ; <nl> + } <nl> + <nl> + buffer - > MakeExecutable ( ) ; <nl> + / / We need an isolate here to execute in the simulator . <nl> + auto f = GeneratedCode < void , byte * * , byte * > : : FromBuffer ( isolate ( ) , <nl> + buffer - > start ( ) ) ; <nl> + <nl> + byte * object = new byte [ offset ] ; <nl> + byte * result [ ] = { nullptr , nullptr } ; <nl> + <nl> + f . Call ( result , object ) ; <nl> + <nl> + / / The first element must be the address of the object , and the second the <nl> + / / slot addressed by ` offset ` . <nl> + EXPECT_EQ ( result [ 0 ] , & object [ 0 ] ) ; <nl> + EXPECT_EQ ( result [ 1 ] , & object [ offset ] ) ; <nl> + <nl> + delete [ ] object ; <nl> + } <nl> + } <nl> + <nl> + INSTANTIATE_TEST_SUITE_P ( TurboAssemblerTest , <nl> + TurboAssemblerTestMoveObjectAndSlot , <nl> + : : testing : : ValuesIn ( kMoveObjectAndSlotTestCases ) ) ; <nl> + <nl> # undef __ <nl> # undef ERROR_MESSAGE <nl> <nl>
[ arm ] [ arm64 ] Do not allocate temp registers for the write barrier .
v8/v8
3f1a59f47fc73dc2dfb16f747a1c4977cf29b712
2019-05-02T11:19:00Z
deleted file mode 100644 <nl> index e4b797ee8ef . . 00000000000 <nl> mmm a / examples / csharp / helloworld - from - cli / global . json <nl> ppp / dev / null <nl> <nl> - { <nl> - " sdk " : { <nl> - " version " : " 1 . 0 . 0 " <nl> - } <nl> - } <nl> mmm a / src / csharp / Grpc . Core / NativeDeps . Mac . csproj . include <nl> ppp b / src / csharp / Grpc . Core / NativeDeps . Mac . csproj . include <nl> <nl> < Project > <nl> < ItemGroup > <nl> - < ! - - We are relying on run_tests . py to build grpc_csharp_ext with the right bitness <nl> - and we copy it as both x86 ( needed by net45 ) and x64 ( needed by netcoreapp1 . 0 ) as we don ' t <nl> - know which one will be needed to run the tests . - - > <nl> - < Content Include = " . . \ . . \ . . \ libs \ $ ( NativeDependenciesConfigurationUnix ) \ libgrpc_csharp_ext . dylib " > <nl> - < Link > libgrpc_csharp_ext . x86 . dylib < / Link > <nl> - < CopyToOutputDirectory > PreserveNewest < / CopyToOutputDirectory > <nl> - < Pack > false < / Pack > <nl> - < / Content > <nl> < Content Include = " . . \ . . \ . . \ libs \ $ ( NativeDependenciesConfigurationUnix ) \ libgrpc_csharp_ext . dylib " > <nl> < Link > libgrpc_csharp_ext . x64 . dylib < / Link > <nl> < CopyToOutputDirectory > PreserveNewest < / CopyToOutputDirectory > <nl> deleted file mode 100644 <nl> index 815be4bfb90 . . 00000000000 <nl> mmm a / src / csharp / global . json <nl> ppp / dev / null <nl> <nl> - { <nl> - " sdk " : { <nl> - " version " : " 2 . 1 . 4 " <nl> - } <nl> - } <nl> mmm a / tools / run_tests / run_tests . py <nl> ppp b / tools / run_tests / run_tests . py <nl> def configure ( self , config , args ) : <nl> if self . platform = = ' mac ' : <nl> # TODO ( jtattermusch ) : EMBED_ZLIB = true currently breaks the mac build <nl> self . _make_options = [ ' EMBED_OPENSSL = true ' ] <nl> - if self . args . compiler ! = ' coreclr ' : <nl> - # On Mac , official distribution of mono is 32bit . <nl> - self . _make_options + = [ ' ARCH_FLAGS = - m32 ' , ' LDFLAGS = - m32 ' ] <nl> else : <nl> self . _make_options = [ ' EMBED_OPENSSL = true ' , ' EMBED_ZLIB = true ' ] <nl> <nl> def test_specs ( self ) : <nl> assembly_subdir + = ' / net45 ' <nl> if self . platform = = ' windows ' : <nl> runtime_cmd = [ ] <nl> + elif self . platform = = ' mac ' : <nl> + # mono before version 5 . 2 on MacOS defaults to 32bit runtime <nl> + runtime_cmd = [ ' mono ' , ' - - arch = 64 ' ] <nl> else : <nl> runtime_cmd = [ ' mono ' ] <nl> <nl>
Merge pull request from jtattermusch / fix_csharp_macos
grpc/grpc
fe9a6d5ec2b6f5f32b5b650acf55489db66970ac
2018-04-20T18:22:36Z
mmm a / addons / resource . language . en_gb / resources / strings . po <nl> ppp b / addons / resource . language . en_gb / resources / strings . po <nl> msgstr " " <nl> # . Description of setting " Music - > File lists - > Enable tag reading " with label # 258 <nl> # : system / settings / settings . xml <nl> msgctxt " # 36274 " <nl> - msgid " Read the tag information from song files . For large directories this can slow down read time , especially over a network . " <nl> + msgid " Read the tag information from song files . For large directories this can increase read time , especially over a network . " <nl> msgstr " " <nl> <nl> # . Description of setting " Music - > File lists - > Track naming template " with label # 13307 <nl>
[ lang ] fix typo
xbmc/xbmc
2add13b600847aedd1644d99006d961ecea98818
2015-06-27T18:51:31Z
mmm a / cmake / modules / AddSwift . cmake <nl> ppp b / cmake / modules / AddSwift . cmake <nl> endfunction ( ) <nl> # [ STATIC ] <nl> # [ DEPENDS dep1 . . . ] <nl> # [ LINK_LIBS lib1 . . . ] <nl> - # [ INTERFACE_LINK_LIBRARIES dep1 . . . ] <nl> # [ SWIFT_MODULE_DEPENDS dep1 . . . ] <nl> # [ LINK_COMPONENTS comp1 . . . ] <nl> # [ LINK_FLAGS flag1 . . . ] <nl> function ( add_swift_host_library name ) <nl> set ( single_parameter_options ) <nl> set ( multiple_parameter_options <nl> DEPENDS <nl> - INTERFACE_LINK_LIBRARIES <nl> LINK_FLAGS <nl> LINK_LIBS <nl> LINK_COMPONENTS ) <nl> function ( add_swift_host_library name ) <nl> LINK_LIBRARIES $ { ASHL_LINK_LIBS } <nl> LLVM_COMPONENT_DEPENDS $ { ASHL_LINK_COMPONENTS } <nl> LINK_FLAGS $ { ASHL_LINK_FLAGS } <nl> - INTERFACE_LINK_LIBRARIES $ { ASHL_INTERFACE_LINK_LIBRARIES } <nl> INSTALL_IN_COMPONENT " dev " <nl> ) <nl> <nl> mmm a / lib / AST / CMakeLists . txt <nl> ppp b / lib / AST / CMakeLists . txt <nl> add_swift_host_library ( swiftAST STATIC <nl> swiftBasic <nl> swiftSyntax <nl> <nl> - INTERFACE_LINK_LIBRARIES <nl> - # Clang dependencies . <nl> - # FIXME : Clang should really export these in some reasonable manner . <nl> - clangCodeGen <nl> - clangIndex <nl> - clangFormat <nl> - clangToolingCore <nl> - clangFrontendTool <nl> - clangFrontend <nl> - clangDriver <nl> - clangSerialization <nl> - clangParse <nl> - clangSema <nl> - clangAnalysis <nl> - clangEdit <nl> - clangRewriteFrontend <nl> - clangRewrite <nl> - clangAST <nl> - clangLex <nl> - clangAPINotes <nl> - clangBasic <nl> - <nl> LINK_COMPONENTS <nl> bitreader bitwriter coroutines coverage irreader debuginfoDWARF <nl> profiledata instrumentation object objcarcopts mc mcparser <nl> add_swift_host_library ( swiftAST STATIC <nl> <nl> $ { EXTRA_AST_FLAGS } <nl> ) <nl> + target_link_libraries ( swiftAST <nl> + INTERFACE <nl> + clangTooling <nl> + clangFrontendTool ) <nl> <nl> # intrinsics_gen is the LLVM tablegen target that generates the include files <nl> # where intrinsics and attributes are declared . swiftAST depends on these <nl>
add_swift_host_library : remove LINK_INTERFACE_LIBRARIES
apple/swift
ce32a87d794d05c327ba89fc38bdf9cd9aa1faa7
2018-10-31T19:46:31Z
mmm a / conformance / failure_list_objc . txt <nl> ppp b / conformance / failure_list_objc . txt <nl> <nl> - # All tests currently passing . <nl> - # <nl> # JSON input or output tests are skipped ( in conformance_objc . m ) as mobile <nl> # platforms don ' t support JSON wire format to avoid code bloat . <nl> + Required . ProtobufInput . IllegalZeroFieldNum_Case_0 <nl> + Required . ProtobufInput . IllegalZeroFieldNum_Case_1 <nl> + Required . ProtobufInput . IllegalZeroFieldNum_Case_2 <nl> + Required . ProtobufInput . IllegalZeroFieldNum_Case_3 <nl>
Update objective - c conformance failure list .
protocolbuffers/protobuf
624d44f042ece176c4bd2bd2b2976a87f03958dc
2017-03-31T00:45:14Z
mmm a / modules / prediction / container / obstacles / obstacle . cc <nl> ppp b / modules / prediction / container / obstacles / obstacle . cc <nl> bool Obstacle : : Insert ( const PerceptionObstacle & perception_obstacle , <nl> } <nl> <nl> / / Trim historical features <nl> - Trim ( ) ; <nl> + DiscardOutdatedHistory ( ) ; <nl> return true ; <nl> } <nl> <nl> void Obstacle : : UpdateStatus ( Feature * feature ) { <nl> } <nl> <nl> bool Obstacle : : SetId ( const PerceptionObstacle & perception_obstacle , <nl> - Feature * feature , int prediction_obstacle_id ) { <nl> + Feature * feature , const int prediction_obstacle_id ) { <nl> int id = prediction_obstacle_id > 0 ? <nl> prediction_obstacle_id : perception_obstacle . id ( ) ; <nl> if ( id_ < 0 ) { <nl> bool Obstacle : : ReceivedNewerMessage ( const double timestamp ) const { <nl> return timestamp < = last_timestamp_received ; <nl> } <nl> <nl> - void Obstacle : : Trim ( ) { <nl> - if ( feature_history_ . size ( ) < 2 ) { <nl> - return ; <nl> - } <nl> - int count = 0 ; <nl> + void Obstacle : : DiscardOutdatedHistory ( ) { <nl> + auto num_of_frames = feature_history_ . size ( ) ; <nl> const double latest_ts = feature_history_ . front ( ) . timestamp ( ) ; <nl> - while ( ! feature_history_ . empty ( ) & & <nl> - latest_ts - feature_history_ . back ( ) . timestamp ( ) > = <nl> + while ( latest_ts - feature_history_ . back ( ) . timestamp ( ) > = <nl> FLAGS_max_history_time ) { <nl> feature_history_ . pop_back ( ) ; <nl> - + + count ; <nl> } <nl> - if ( count > 0 ) { <nl> - ADEBUG < < " Obstacle [ " < < id_ < < " ] trimmed " < < count <nl> + auto num_of_discarded_frames = num_of_frames - feature_history_ . size ( ) ; <nl> + if ( num_of_discarded_frames > 0 ) { <nl> + ADEBUG < < " Obstacle [ " < < id_ < < " ] discards " < < num_of_discarded_frames <nl> < < " historical features " ; <nl> } <nl> } <nl> mmm a / modules / prediction / container / obstacles / obstacle . h <nl> ppp b / modules / prediction / container / obstacles / obstacle . h <nl> class Obstacle { <nl> void UpdateStatus ( Feature * feature ) ; <nl> <nl> bool SetId ( const perception : : PerceptionObstacle & perception_obstacle , <nl> - Feature * feature , int prediction_id = - 1 ) ; <nl> + Feature * feature , const int prediction_id = - 1 ) ; <nl> <nl> bool SetType ( const perception : : PerceptionObstacle & perception_obstacle , <nl> Feature * feature ) ; <nl> class Obstacle { <nl> <nl> void SetJunctionFeatureWithoutEnterLane ( Feature * const feature_ptr ) ; <nl> <nl> - void Trim ( ) ; <nl> + void DiscardOutdatedHistory ( ) ; <nl> <nl> private : <nl> int id_ = - 1 ; <nl> mmm a / modules / prediction / container / obstacles / obstacles_container . cc <nl> ppp b / modules / prediction / container / obstacles / obstacles_container . cc <nl> void ObstaclesContainer : : Insert ( const : : google : : protobuf : : Message & message ) { <nl> } <nl> <nl> <nl> - Obstacle * ObstaclesContainer : : GetObstacle ( const int id ) { <nl> - auto ptr_obstacle = ptr_obstacles_ . GetSilently ( id ) ; <nl> + Obstacle * ObstaclesContainer : : GetObstacle ( const int perception_id ) { <nl> + auto ptr_obstacle = ptr_obstacles_ . GetSilently ( perception_id ) ; <nl> if ( ptr_obstacle ! = nullptr ) { <nl> return ptr_obstacle - > get ( ) ; <nl> } <nl>
prediction : obstacle . cc refactor
ApolloAuto/apollo
3263e162584d6bc2eca7255b6cba11be89ef41ef
2019-01-15T02:17:04Z
mmm a / src / consensus / validation . h <nl> ppp b / src / consensus / validation . h <nl> enum class TxValidationResult { <nl> TX_MISSING_INPUTS , / / ! < transaction was missing some of its inputs <nl> TX_PREMATURE_SPEND , / / ! < transaction spends a coinbase too early , or violates locktime / sequence locks <nl> / * * <nl> - * Transaction might be missing a witness , have a witness prior to SegWit <nl> + * Transaction might have a witness prior to SegWit <nl> * activation , or witness may have been malleated ( which includes <nl> * non - standard witnesses ) . <nl> * / <nl> TX_WITNESS_MUTATED , <nl> + / * * <nl> + * Transaction is missing a witness . <nl> + * / <nl> + TX_WITNESS_STRIPPED , <nl> / * * <nl> * Tx already in mempool or conflicts with a tx in the chain <nl> * ( if it conflicts with another tx in mempool , we use MEMPOOL_POLICY as it failed to reach the RBF threshold ) <nl> mmm a / src / net_processing . cpp <nl> ppp b / src / net_processing . cpp <nl> static bool MaybePunishNodeForTx ( NodeId nodeid , const TxValidationState & state , <nl> case TxValidationResult : : TX_MISSING_INPUTS : <nl> case TxValidationResult : : TX_PREMATURE_SPEND : <nl> case TxValidationResult : : TX_WITNESS_MUTATED : <nl> + case TxValidationResult : : TX_WITNESS_STRIPPED : <nl> case TxValidationResult : : TX_CONFLICT : <nl> case TxValidationResult : : TX_MEMPOOL_POLICY : <nl> break ; <nl> void static ProcessOrphanTx ( CConnman & connman , CTxMemPool & mempool , std : : set < uin <nl> / / Has inputs but not accepted to mempool <nl> / / Probably non - standard or insufficient fee <nl> LogPrint ( BCLog : : MEMPOOL , " removed orphan tx % s \ n " , orphanHash . ToString ( ) ) ; <nl> - if ( orphanTx . HasWitness ( ) | | orphan_state . GetResult ( ) ! = TxValidationResult : : TX_WITNESS_MUTATED ) { <nl> - / / Do not use rejection cache for witness transactions or <nl> - / / witness - stripped transactions , as they can have been malleated . <nl> - / / See https : / / github . com / bitcoin / bitcoin / issues / 8279 for details . <nl> + if ( orphan_state . GetResult ( ) ! = TxValidationResult : : TX_WITNESS_STRIPPED ) { <nl> + / / Do not add txids of witness transactions or witness - stripped <nl> + / / transactions to the filter , as they can have been malleated ; <nl> + / / adding such txids to the reject filter would potentially <nl> + / / interfere with relay of valid transactions from peers that <nl> + / / do not support wtxid - based relay . See <nl> + / / https : / / github . com / bitcoin / bitcoin / issues / 8279 for details . <nl> + / / We can remove this restriction ( and always add wtxids to <nl> + / / the filter even for witness stripped transactions ) once <nl> + / / wtxid - based relay is broadly deployed . <nl> + / / See also comments in https : / / github . com / bitcoin / bitcoin / pull / 18044 # discussion_r443419034 <nl> + / / for concerns around weakening security of unupgraded nodes <nl> + / / if we start doing this too early . <nl> assert ( recentRejects ) ; <nl> recentRejects - > insert ( orphanTx . GetWitnessHash ( ) ) ; <nl> } <nl> void ProcessMessage ( <nl> recentRejects - > insert ( tx . GetWitnessHash ( ) ) ; <nl> } <nl> } else { <nl> - if ( tx . HasWitness ( ) | | state . GetResult ( ) ! = TxValidationResult : : TX_WITNESS_MUTATED ) { <nl> - / / Do not use rejection cache for witness transactions or <nl> - / / witness - stripped transactions , as they can have been malleated . <nl> - / / See https : / / github . com / bitcoin / bitcoin / issues / 8279 for details . <nl> + if ( state . GetResult ( ) ! = TxValidationResult : : TX_WITNESS_STRIPPED ) { <nl> + / / Do not add txids of witness transactions or witness - stripped <nl> + / / transactions to the filter , as they can have been malleated ; <nl> + / / adding such txids to the reject filter would potentially <nl> + / / interfere with relay of valid transactions from peers that <nl> + / / do not support wtxid - based relay . See <nl> + / / https : / / github . com / bitcoin / bitcoin / issues / 8279 for details . <nl> + / / We can remove this restriction ( and always add wtxids to <nl> + / / the filter even for witness stripped transactions ) once <nl> + / / wtxid - based relay is broadly deployed . <nl> + / / See also comments in https : / / github . com / bitcoin / bitcoin / pull / 18044 # discussion_r443419034 <nl> + / / for concerns around weakening security of unupgraded nodes <nl> + / / if we start doing this too early . <nl> assert ( recentRejects ) ; <nl> recentRejects - > insert ( tx . GetWitnessHash ( ) ) ; <nl> if ( RecursiveDynamicUsage ( * ptx ) < 100000 ) { <nl> mmm a / src / validation . cpp <nl> ppp b / src / validation . cpp <nl> bool MemPoolAccept : : PolicyScriptChecks ( ATMPArgs & args , Workspace & ws , Precompute <nl> if ( ! tx . HasWitness ( ) & & CheckInputScripts ( tx , state_dummy , m_view , scriptVerifyFlags & ~ ( SCRIPT_VERIFY_WITNESS | SCRIPT_VERIFY_CLEANSTACK ) , true , false , txdata ) & & <nl> ! CheckInputScripts ( tx , state_dummy , m_view , scriptVerifyFlags & ~ SCRIPT_VERIFY_CLEANSTACK , true , false , txdata ) ) { <nl> / / Only the witness is missing , so the transaction itself may be fine . <nl> - state . Invalid ( TxValidationResult : : TX_WITNESS_MUTATED , <nl> + state . Invalid ( TxValidationResult : : TX_WITNESS_STRIPPED , <nl> state . GetRejectReason ( ) , state . GetDebugMessage ( ) ) ; <nl> } <nl> return false ; / / state filled in by CheckInputScripts <nl>
Make TX_WITNESS_STRIPPED its own rejection reason
bitcoin/bitcoin
4eb515574e1012bc8ea5dafc3042dcdf4c766f26
2020-07-19T06:10:42Z
mmm a / PowerEditor / bin / change . log <nl> ppp b / PowerEditor / bin / change . log <nl> v4 . 2 fixed bugs and added features ( from v4 . 1 . 2 ) : <nl> 6 . Fix TeX syntax highlighting corruption problem while switching off then switching back to current document . <nl> 7 . Fix User Define Language extension recognition problem for sensitive case ( now it ' s insensitive ) . <nl> 8 . Add a menu entry to access to notepad + + plugins project page . <nl> + 9 . Enhance file open dialog ( add all supported extensions in the filters list ) . <nl> + 10 . Fix bug of Run macro until EOF . <nl> <nl> Plugins included in v4 . 2 : <nl> <nl> 1 . TexFX v0 . 24a <nl> 2 . Function list v1 . 2 <nl> 3 . ConvertExt v1 . 1 <nl> - 4 . NppExec v0 . 2 beta 3 <nl> + 4 . NppExec v0 . 2 beta 4 <nl> 5 . Spell checker v1 . 1 <nl> 6 . Quick text v0 . 02 <nl> 7 . Explorer v1 . 4 <nl> mmm a / PowerEditor / installer / nppSetup . nsi <nl> ppp b / PowerEditor / installer / nppSetup . nsi <nl> <nl> <nl> ; Define the application name <nl> ! define APPNAME " Notepad + + " <nl> - ! define APPNAMEANDVERSION " Notepad + + v4 . 1 . 2 " <nl> + ! define APPNAMEANDVERSION " Notepad + + v4 . 2 " <nl> <nl> ; Main Install settings <nl> Name " $ { APPNAMEANDVERSION } " <nl> InstallDir " $ PROGRAMFILES \ Notepad + + " <nl> InstallDirRegKey HKLM " Software \ $ { APPNAME } " " " <nl> - OutFile " . . \ bin \ npp . 4 . 1 . 2 . Installer . exe " <nl> + OutFile " . . \ bin \ npp . 4 . 2 . Installer . exe " <nl> <nl> <nl> <nl> OutFile " . . \ bin \ npp . 4 . 1 . 2 . Installer . exe " <nl> ! insertmacro MUI_LANGUAGE " PortugueseBR " <nl> ! insertmacro MUI_LANGUAGE " Ukrainian " <nl> ! insertmacro MUI_LANGUAGE " Turkish " <nl> - ! insertmacro MUI_LANGUAGE " Catalan " <nl> + ; ! insertmacro MUI_LANGUAGE " Catalan " <nl> ! insertmacro MUI_LANGUAGE " Arabic " <nl> ! insertmacro MUI_LANGUAGE " Lithuanian " <nl> ! insertmacro MUI_LANGUAGE " Finnish " <nl> SubSection " Plugins " Plugins <nl> SetOutPath " $ INSTDIR \ plugins " <nl> File " . . \ bin \ plugins \ FunctionList . dll " <nl> SectionEnd <nl> - / * <nl> + <nl> Section " File Browser " FileBrowser <nl> Delete " $ INSTDIR \ plugins \ ExplorerPlugin . dll " <nl> SetOutPath " $ INSTDIR \ plugins " <nl> SubSection " Plugins " Plugins <nl> SetOutPath " $ INSTDIR \ plugins " <nl> File " . . \ bin \ plugins \ HexEditor . dll " <nl> SectionEnd <nl> - * / <nl> + <nl> Section " ConvertExt " ConvertExt <nl> SetOutPath " $ INSTDIR \ plugins " <nl> File " . . \ bin \ plugins \ ConvertExt . dll " <nl> SubSection un . Plugins <nl> Delete " $ INSTDIR \ plugins \ FunctionList . dll " <nl> RMDir " $ INSTDIR \ plugins \ " <nl> SectionEnd <nl> - / * <nl> + <nl> Section un . FileBrowser <nl> Delete " $ INSTDIR \ plugins \ Explorer . dll " <nl> Delete " $ INSTDIR \ plugins \ Config \ Explorer . ini " <nl> SubSection un . Plugins <nl> Delete " $ INSTDIR \ plugins \ HexEditor . dll " <nl> RMDir " $ INSTDIR \ plugins \ " <nl> SectionEnd <nl> - * / <nl> + <nl> Section un . ConvertExt <nl> Delete " $ INSTDIR \ plugins \ ConvertExt . dll " <nl> <nl> mmm a / PowerEditor / src / Notepad_plus . cpp <nl> ppp b / PowerEditor / src / Notepad_plus . cpp <nl> bool Notepad_plus : : doOpen ( const char * fileName , bool isReadOnly ) <nl> return false ; <nl> } <nl> } <nl> + string exts2Filters ( string exts ) { <nl> + const char * extStr = exts . c_str ( ) ; <nl> + char aExt [ MAX_PATH ] ; <nl> + string filters ( " " ) ; <nl> + <nl> + int j = 0 ; <nl> + bool stop = false ; <nl> + for ( size_t i = 0 ; i < exts . length ( ) ; i + + ) <nl> + { <nl> + if ( extStr [ i ] = = ' ' ) <nl> + { <nl> + if ( ! stop ) <nl> + { <nl> + aExt [ j ] = ' \ 0 ' ; <nl> + stop = true ; <nl> + <nl> + if ( aExt [ 0 ] ) <nl> + { <nl> + filters + = " * . " ; <nl> + filters + = aExt ; <nl> + filters + = " ; " ; <nl> + } <nl> + j = 0 ; <nl> + } <nl> + } <nl> + else <nl> + { <nl> + aExt [ j ] = extStr [ i ] ; <nl> + stop = false ; <nl> + j + + ; <nl> + } <nl> + } <nl> + <nl> + if ( j > 0 ) <nl> + { <nl> + aExt [ j ] = ' \ 0 ' ; <nl> + if ( aExt [ 0 ] ) <nl> + { <nl> + filters + = " * . " ; <nl> + filters + = aExt ; <nl> + filters + = " ; " ; <nl> + } <nl> + } <nl> + <nl> + / / remove the last ' ; ' <nl> + filters = filters . substr ( 0 , filters . length ( ) - 1 ) ; <nl> + return filters ; <nl> + } ; <nl> <nl> void Notepad_plus : : fileOpen ( ) <nl> { <nl> FileDialog fDlg ( _hSelf , _hInst ) ; <nl> + fDlg . setExtFilter ( " All types " , " . * " , NULL ) ; <nl> <nl> - fDlg . setExtFilter ( " All types " , " . * " , NULL ) ; <nl> - fDlg . setExtFilter ( " c / c + + src file " , " . c " , " . cpp " , " . cxx " , " . cc " , " . h " , NULL ) ; <nl> - fDlg . setExtFilter ( " Window Resource File " , " . rc " , NULL ) ; <nl> + <nl> + NppParameters * pNppParam = NppParameters : : getInstance ( ) ; <nl> + NppGUI & nppGUI = ( NppGUI & ) pNppParam - > getNppGUI ( ) ; <nl> + <nl> + int i = 0 ; <nl> + Lang * l = NppParameters : : getInstance ( ) - > getLangFromIndex ( i + + ) ; <nl> + while ( l ) <nl> + { <nl> + LangType lid = l - > getLangID ( ) ; <nl> + <nl> + bool inExcludedList = false ; <nl> + <nl> + for ( size_t j = 0 ; j < nppGUI . _excludedLangList . size ( ) ; j + + ) <nl> + { <nl> + if ( lid = = nppGUI . _excludedLangList [ j ] . _langType ) <nl> + { <nl> + inExcludedList = true ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + if ( ! inExcludedList ) <nl> + { <nl> + const char * defList = l - > getDefaultExtList ( ) ; <nl> + const char * userList = NULL ; <nl> + <nl> + LexerStylerArray & lsa = ( NppParameters : : getInstance ( ) ) - > getLStylerArray ( ) ; <nl> + const char * lName = l - > getLangName ( ) ; <nl> + LexerStyler * pLS = lsa . getLexerStylerByName ( lName ) ; <nl> + <nl> + if ( pLS ) <nl> + userList = pLS - > getLexerUserExt ( ) ; <nl> + <nl> + std : : string list ( " " ) ; <nl> + if ( defList ) <nl> + list + = defList ; <nl> + if ( userList ) <nl> + { <nl> + list + = " " ; <nl> + list + = userList ; <nl> + } <nl> + <nl> + string stringFilters = exts2Filters ( list ) ; <nl> + const char * filters = stringFilters . c_str ( ) ; <nl> + if ( filters [ 0 ] ) <nl> + fDlg . setExtsFilter ( getLangDesc ( lid , true ) . c_str ( ) , filters ) ; <nl> + } <nl> + l = ( NppParameters : : getInstance ( ) ) - > getLangFromIndex ( i + + ) ; <nl> + } <nl> <nl> - fDlg . setExtFilter ( " Java src file " , " . java " , NULL ) ; <nl> - fDlg . setExtFilter ( " HTML file " , " . html " , " . htm " , NULL ) ; <nl> - fDlg . setExtFilter ( " XML file " , " . xml " , NULL ) ; <nl> - fDlg . setExtFilter ( " Makefile " , " makefile " , " GNUmakefile " , " . makefile " , NULL ) ; <nl> - fDlg . setExtFilter ( " php file " , " . php " , " . php3 " , " . phtml " , NULL ) ; <nl> - fDlg . setExtFilter ( " asp file " , " . asp " , NULL ) ; <nl> - fDlg . setExtFilter ( " ini file " , " . ini " , NULL ) ; <nl> - fDlg . setExtFilter ( " nfo file " , " . nfo " , NULL ) ; <nl> - fDlg . setExtFilter ( " VB / VBS file " , " . vb " , " . vbs " , NULL ) ; <nl> - fDlg . setExtFilter ( " SQL file " , " . sql " , NULL ) ; <nl> - fDlg . setExtFilter ( " Objective C file " , " . m " , " . h " , NULL ) ; <nl> if ( stringVector * pfns = fDlg . doOpenMultiFilesDlg ( ) ) <nl> { <nl> int sz = int ( pfns - > size ( ) ) ; <nl> void Notepad_plus : : checkLangsMenu ( int id ) const <nl> } <nl> : : CheckMenuRadioItem ( : : GetMenu ( _hSelf ) , IDM_LANG_C , IDM_LANG_USER_LIMIT , id , MF_BYCOMMAND ) ; <nl> } <nl> - void Notepad_plus : : setLangStatus ( LangType langType ) <nl> + string Notepad_plus : : getLangDesc ( LangType langType , bool shortDesc ) <nl> { <nl> string str2Show ; <nl> <nl> switch ( langType ) <nl> { <nl> - case L_C : <nl> - str2Show = " c source file " ; break ; <nl> + case L_C : <nl> + str2Show = ( shortDesc ) ? " C " : " C source file " ; break ; <nl> <nl> - case L_CPP : <nl> - str2Show = " c + + source file " ; break ; <nl> + case L_CPP : <nl> + str2Show = ( shortDesc ) ? " C + + " : " C + + source file " ; break ; <nl> <nl> - case L_OBJC : <nl> - str2Show = " Objective C source file " ; break ; <nl> + case L_OBJC : <nl> + str2Show = ( shortDesc ) ? " Objective - C " : " Objective - C source file " ; break ; <nl> <nl> - case L_JAVA : <nl> - str2Show = " Java source file " ; break ; <nl> + case L_JAVA : <nl> + str2Show = ( shortDesc ) ? " Java " : " Java source file " ; break ; <nl> <nl> - case L_CS : <nl> - str2Show = " C # source file " ; break ; <nl> + case L_CS : <nl> + str2Show = ( shortDesc ) ? " C # " : " C # source file " ; break ; <nl> <nl> - case L_RC : <nl> - str2Show = " Windows Resource file " ; break ; <nl> - <nl> - case L_MAKEFILE : <nl> - str2Show = " Makefile " ; break ; <nl> + case L_RC : <nl> + str2Show = ( shortDesc ) ? " RC " : " Windows Resource file " ; break ; <nl> + <nl> + case L_MAKEFILE : <nl> + str2Show = " Makefile " ; break ; <nl> <nl> - case L_HTML : <nl> - str2Show = " Hyper Text Markup Language file " ; break ; <nl> + case L_HTML : <nl> + str2Show = ( shortDesc ) ? " HTML " : " Hyper Text Markup Language file " ; break ; <nl> <nl> - case L_XML : <nl> - str2Show = " eXtensible Markup Language file " ; break ; <nl> + case L_XML : <nl> + str2Show = ( shortDesc ) ? " XML " : " eXtensible Markup Language file " ; break ; <nl> <nl> - case L_JS : <nl> - str2Show = " Javascript file " ; break ; <nl> + case L_JS : <nl> + str2Show = ( shortDesc ) ? " JavaScript " : " JavaScript file " ; break ; <nl> <nl> - case L_PHP : <nl> - str2Show = " PHP Hypertext Preprocessor file " ; break ; <nl> + case L_PHP : <nl> + str2Show = ( shortDesc ) ? " PHP " : " PHP Hypertext Preprocessor file " ; break ; <nl> <nl> - case L_ASP : <nl> - str2Show = " Active Server Pages script file " ; break ; <nl> + case L_ASP : <nl> + str2Show = ( shortDesc ) ? " ASP " : " Active Server Pages script file " ; break ; <nl> <nl> - case L_CSS : <nl> - str2Show = " Cascade Style Sheets File " ; break ; <nl> + case L_CSS : <nl> + str2Show = ( shortDesc ) ? " CSS " : " Cascade Style Sheets File " ; break ; <nl> <nl> - case L_LUA : <nl> - str2Show = " Lua source File " ; break ; <nl> + case L_LUA : <nl> + str2Show = ( shortDesc ) ? " Lua " : " Lua source File " ; break ; <nl> <nl> - case L_NFO : <nl> - str2Show = " MSDOS Style " ; break ; <nl> + case L_NFO : <nl> + str2Show = ( shortDesc ) ? " NFO " : " MSDOS Style " ; break ; <nl> <nl> - case L_SQL : <nl> - str2Show = " Structure Query Language file " ; break ; <nl> + case L_SQL : <nl> + str2Show = ( shortDesc ) ? " SQL " : " Structure Query Language file " ; break ; <nl> <nl> - case L_VB : <nl> - str2Show = " Visual Basic file " ; break ; <nl> + case L_VB : <nl> + str2Show = ( shortDesc ) ? " VB " : " Visual Basic file " ; break ; <nl> <nl> - case L_BATCH : <nl> - str2Show = " Batch file " ; break ; <nl> + case L_BATCH : <nl> + str2Show = ( shortDesc ) ? " Batch " : " Batch file " ; break ; <nl> <nl> - case L_PASCAL : <nl> - str2Show = " Pascal source file " ; break ; <nl> + case L_PASCAL : <nl> + str2Show = ( shortDesc ) ? " Pascal " : " Pascal source file " ; break ; <nl> <nl> - case L_PERL : <nl> - str2Show = " Perl source file " ; break ; <nl> + case L_PERL : <nl> + str2Show = ( shortDesc ) ? " Perl " : " Perl source file " ; break ; <nl> <nl> - case L_PYTHON : <nl> - str2Show = " Python file " ; break ; <nl> + case L_PYTHON : <nl> + str2Show = ( shortDesc ) ? " Python " : " Python file " ; break ; <nl> <nl> - case L_TEX : <nl> - str2Show = " TeX file " ; break ; <nl> + case L_TEX : <nl> + str2Show = ( shortDesc ) ? " TeX " : " TeX file " ; break ; <nl> <nl> - case L_FORTRAN : <nl> - str2Show = " Fortran source file " ; break ; <nl> + case L_FORTRAN : <nl> + str2Show = ( shortDesc ) ? " Fortran " : " Fortran source file " ; break ; <nl> <nl> - case L_BASH : <nl> - str2Show = " Unix script file " ; break ; <nl> + case L_BASH : <nl> + str2Show = ( shortDesc ) ? " Shell " : " Unix script file " ; break ; <nl> <nl> - case L_FLASH : <nl> - str2Show = " Flash Action script file " ; break ; <nl> + case L_FLASH : <nl> + str2Show = ( shortDesc ) ? " Flash Action " : " Flash Action script file " ; break ; <nl> <nl> - case L_NSIS : <nl> - str2Show = " Nullsoft Scriptable Install System script file " ; break ; <nl> + case L_NSIS : <nl> + str2Show = ( shortDesc ) ? " NSIS " : " Nullsoft Scriptable Install System script file " ; break ; <nl> <nl> - case L_TCL : <nl> - str2Show = " Tool Command Language file " ; break ; <nl> + case L_TCL : <nl> + str2Show = ( shortDesc ) ? " TCL " : " Tool Command Language file " ; break ; <nl> <nl> - case L_LISP : <nl> - str2Show = " List Processing language file " ; break ; <nl> + case L_LISP : <nl> + str2Show = ( shortDesc ) ? " Lisp " : " List Processing language file " ; break ; <nl> <nl> - case L_SCHEME : <nl> - str2Show = " Sheme file " ; break ; <nl> + case L_SCHEME : <nl> + str2Show = ( shortDesc ) ? " Scheme " : " Scheme file " ; break ; <nl> <nl> - case L_ASM : <nl> - str2Show = " Assembler file " ; break ; <nl> + case L_ASM : <nl> + str2Show = ( shortDesc ) ? " Assembler " : " Assembler file " ; break ; <nl> <nl> - case L_DIFF : <nl> - str2Show = " Diff file " ; break ; <nl> + case L_DIFF : <nl> + str2Show = ( shortDesc ) ? " Diff " : " Diff file " ; break ; <nl> <nl> - case L_PROPS : <nl> - str2Show = " Properties file " ; break ; <nl> + case L_PROPS : <nl> + str2Show = " Properties file " ; break ; <nl> <nl> - case L_PS : <nl> - str2Show = " Postscript file " ; break ; <nl> + case L_PS : <nl> + str2Show = ( shortDesc ) ? " Postscript " : " Postscript file " ; break ; <nl> <nl> - case L_RUBY : <nl> - str2Show = " Ruby file " ; break ; <nl> + case L_RUBY : <nl> + str2Show = ( shortDesc ) ? " Ruby " : " Ruby file " ; break ; <nl> <nl> - case L_SMALLTALK : <nl> - str2Show = " Smalltalk file " ; break ; <nl> + case L_SMALLTALK : <nl> + str2Show = ( shortDesc ) ? " Smalltalk " : " Smalltalk file " ; break ; <nl> <nl> - case L_VHDL : <nl> - str2Show = " VHSIC Hardware Description Language file " ; break ; <nl> + case L_VHDL : <nl> + str2Show = ( shortDesc ) ? " VHDL " : " VHSIC Hardware Description Language file " ; break ; <nl> <nl> - case L_VERILOG : <nl> - str2Show = " Verilog file " ; break ; <nl> + case L_VERILOG : <nl> + str2Show = ( shortDesc ) ? " Verilog " : " Verilog file " ; break ; <nl> <nl> - case L_KIX : <nl> - str2Show = " KiXtart file " ; break ; <nl> + case L_KIX : <nl> + str2Show = ( shortDesc ) ? " KiXtart " : " KiXtart file " ; break ; <nl> <nl> - case L_ADA : <nl> - str2Show = " Ada file " ; break ; <nl> + case L_ADA : <nl> + str2Show = ( shortDesc ) ? " Ada " : " Ada file " ; break ; <nl> <nl> - case L_CAML : <nl> - str2Show = " Categorical Abstract Machine Language " ; break ; <nl> + case L_CAML : <nl> + str2Show = ( shortDesc ) ? " CAML " : " Categorical Abstract Machine Language " ; break ; <nl> <nl> - case L_AU3 : <nl> - str2Show = " AutoIt " ; break ; <nl> + case L_AU3 : <nl> + str2Show = ( shortDesc ) ? " AutoIt " : " AutoIt " ; break ; <nl> <nl> - case L_MATLAB : <nl> - str2Show = " MATrix LABoratory " ; break ; <nl> + case L_MATLAB : <nl> + str2Show = ( shortDesc ) ? " MATLAB " : " MATrix LABoratory " ; break ; <nl> <nl> - case L_HASKELL : <nl> - str2Show = " Haskell " ; break ; <nl> + case L_HASKELL : <nl> + str2Show = " Haskell " ; break ; <nl> <nl> - case L_INNO : <nl> - str2Show = " Inno Setup script " ; break ; <nl> + case L_INNO : <nl> + str2Show = ( shortDesc ) ? " Inno " : " Inno Setup script " ; break ; <nl> <nl> - case L_CMAKE : <nl> - str2Show = " CMAKEFILE " ; break ; <nl> + case L_CMAKE : <nl> + str2Show = " CMAKEFILE " ; break ; <nl> <nl> - case L_USER : <nl> - { <nl> - str2Show = " User Define File " ; <nl> - Buffer & currentBuf = _pEditView - > getCurrentBuffer ( ) ; <nl> - if ( currentBuf . isUserDefineLangExt ( ) ) <nl> + case L_USER : <nl> { <nl> - str2Show + = " - " ; <nl> - str2Show + = currentBuf . getUserDefineLangName ( ) ; <nl> + str2Show = " User Define File " ; <nl> + Buffer & currentBuf = _pEditView - > getCurrentBuffer ( ) ; <nl> + if ( currentBuf . isUserDefineLangExt ( ) ) <nl> + { <nl> + str2Show + = " - " ; <nl> + str2Show + = currentBuf . getUserDefineLangName ( ) ; <nl> + } <nl> + break ; <nl> } <nl> - break ; <nl> - } <nl> <nl> - default : <nl> - str2Show = " Normal text file " ; <nl> + default : <nl> + str2Show = " Normal text file " ; <nl> <nl> } <nl> - _statusBar . setText ( str2Show . c_str ( ) , STATUSBAR_DOC_TYPE ) ; <nl> + return str2Show ; <nl> } <nl> <nl> + <nl> void Notepad_plus : : getApiFileName ( LangType langType , string & fn ) <nl> { <nl> <nl> LRESULT Notepad_plus : : runProc ( HWND hwnd , UINT Message , WPARAM wParam , LPARAM lPa <nl> <nl> const char * dir = NULL ; <nl> char currentDir [ MAX_PATH ] ; <nl> + const char * fltr ; <nl> <nl> if ( wParam ) <nl> dir = ( const char * ) wParam ; <nl> LRESULT Notepad_plus : : runProc ( HWND hwnd , UINT Message , WPARAM wParam , LPARAM lPa <nl> : : GetCurrentDirectory ( MAX_PATH , currentDir ) ; <nl> dir = currentDir ; <nl> } <nl> + <nl> if ( lParam ) <nl> { <nl> - const char * filtre = ( const char * ) lParam ; <nl> - _findReplaceDlg . setFindInFilesDirFilter ( dir , filtre ) ; <nl> + fltr = ( const char * ) lParam ; <nl> } <nl> else <nl> { <nl> LRESULT Notepad_plus : : runProc ( HWND hwnd , UINT Message , WPARAM wParam , LPARAM lPa <nl> filtres + = " * . " ; <nl> filtres + = vStr [ i ] + " " ; <nl> } <nl> - / / : : SetDlgItemText ( _hSelf , IDD_FINDINFILES_FILTERS_COMBO , filtres . c_str ( ) ) ; <nl> - _findReplaceDlg . setFindInFilesDirFilter ( currentDir , filtres . c_str ( ) ) ; <nl> + fltr = filtres . c_str ( ) ; <nl> } <nl> else <nl> - _findReplaceDlg . setFindInFilesDirFilter ( currentDir , " * . * " ) ; <nl> + fltr = " * . * " ; <nl> } <nl> + _findReplaceDlg . setFindInFilesDirFilter ( dir , fltr ) ; <nl> return TRUE ; <nl> } <nl> <nl> LRESULT Notepad_plus : : runProc ( HWND hwnd , UINT Message , WPARAM wParam , LPARAM lPa <nl> int lastLine = int ( _pEditView - > execute ( SCI_GETLINECOUNT ) ) - 1 ; <nl> int currLine = _pEditView - > getCurrentLineNumber ( ) ; <nl> int indexMacro = _runMacroDlg . getMacro2Exec ( ) ; <nl> + int deltaLastLine = 0 ; <nl> + int deltaCurrLine = 0 ; <nl> <nl> Macro m = _macro ; <nl> <nl> LRESULT Notepad_plus : : runProc ( HWND hwnd , UINT Message , WPARAM wParam , LPARAM lPa <nl> } <nl> else / / run until eof <nl> { <nl> - if ( currLine = = _pEditView - > getCurrentLineNumber ( ) ) / / line no . not changed ? <nl> + bool cursorMovedUp = deltaCurrLine < 0 ; <nl> + deltaLastLine = int ( _pEditView - > execute ( SCI_GETLINECOUNT ) ) - 1 - lastLine ; <nl> + deltaCurrLine = _pEditView - > getCurrentLineNumber ( ) - currLine ; <nl> + <nl> + if ( ( deltaCurrLine = = 0 ) / / line no . not changed ? <nl> + & & ( deltaLastLine > = 0 ) ) / / and no lines removed ? <nl> break ; / / exit <nl> <nl> + / / Update the line count , but only if the number of lines is shrinking . <nl> + / / Otherwise , the macro playback may never end . <nl> + if ( deltaLastLine < 0 ) <nl> + lastLine + = deltaLastLine ; <nl> + <nl> / / save current line <nl> - currLine = _pEditView - > getCurrentLineNumber ( ) ; <nl> + currLine + = deltaCurrLine ; <nl> <nl> / / eof ? <nl> - if ( ( currLine > = lastLine ) | | ( currLine < = 0 ) ) <nl> + if ( ( currLine > = lastLine ) | | ( currLine < 0 ) <nl> + | | ( ( deltaCurrLine = = 0 ) & & ( currLine = = 0 ) & & ( ( deltaLastLine > = 0 ) | | cursorMovedUp ) ) ) <nl> break ; <nl> } <nl> } <nl> mmm a / PowerEditor / src / Notepad_plus . h <nl> ppp b / PowerEditor / src / Notepad_plus . h <nl> class Notepad_plus : public Window { <nl> <nl> void synchronise ( ) ; <nl> <nl> - void setLangStatus ( LangType langType ) ; <nl> + string getLangDesc ( LangType langType , bool shortDesc = false ) ; <nl> + <nl> + void setLangStatus ( LangType langType ) { <nl> + _statusBar . setText ( getLangDesc ( langType ) . c_str ( ) , STATUSBAR_DOC_TYPE ) ; <nl> + } ; <nl> <nl> void setDisplayFormat ( formatType f ) { <nl> std : : string str ; <nl> mmm a / PowerEditor / src / Parameters . cpp <nl> ppp b / PowerEditor / src / Parameters . cpp <nl> int NppParameters : : langTypeToCommandID ( LangType lt ) const <nl> case L_CMAKE : <nl> id = IDM_LANG_CMAKE ; break ; <nl> <nl> + case L_SEARCHRESULT : <nl> + id = - 1 ; break ; <nl> + <nl> case L_TXT : <nl> id = IDM_LANG_TEXT ; break ; <nl> default : <nl> mmm a / PowerEditor / src / ScitillaComponent / FindReplaceDlg . cpp <nl> ppp b / PowerEditor / src / ScitillaComponent / FindReplaceDlg . cpp <nl> BOOL CALLBACK FindReplaceDlg : : run_dlgProc ( UINT message , WPARAM wParam , LPARAM lP <nl> addText2Combo ( str2Search . c_str ( ) , hFindCombo , isUnicode ) ; <nl> processFindNext ( str2Search . c_str ( ) ) ; <nl> } <nl> + else if ( _currentStatus = = FINDINFILES_DLG ) <nl> + { <nl> + : : SendMessage ( _hSelf , WM_COMMAND , IDD_FINDINFILES_FIND_BUTTON , ( LPARAM ) _hSelf ) ; <nl> + } <nl> } <nl> return TRUE ; <nl> <nl> void FindReplaceDlg : : enableReplaceFunc ( bool isEnable ) <nl> RECT * pClosePos = isEnable ? & _replaceClosePos : & _findClosePos ; <nl> <nl> / / : : EnableWindow ( : : GetDlgItem ( _hSelf , IDD_FINDINFILES_FIND_BUTTON ) , FALSE ) ; <nl> - : : EnableWindow ( : : GetDlgItem ( _hSelf , IDOK ) , TRUE ) ; <nl> + / / : : EnableWindow ( : : GetDlgItem ( _hSelf , IDOK ) , TRUE ) ; <nl> enableFindInFilesControls ( false ) ; <nl> <nl> / / replce controls <nl> mmm a / PowerEditor / src / ScitillaComponent / FindReplaceDlg . h <nl> ppp b / PowerEditor / src / ScitillaComponent / FindReplaceDlg . h <nl> private : <nl> void enableFindInFilesFunc ( ) { <nl> enableFindInFilesControls ( ) ; <nl> <nl> - : : EnableWindow ( : : GetDlgItem ( _hSelf , IDOK ) , FALSE ) ; <nl> + / / : : EnableWindow ( : : GetDlgItem ( _hSelf , IDOK ) , FALSE ) ; <nl> <nl> _currentStatus = FINDINFILES_DLG ; <nl> gotoCorrectTab ( ) ; <nl> mmm a / PowerEditor / src / WinControls / ColourPicker / WordStyleDlg . cpp <nl> ppp b / PowerEditor / src / WinControls / ColourPicker / WordStyleDlg . cpp <nl> BOOL CALLBACK WordStyleDlg : : run_dlgProc ( UINT Message , WPARAM wParam , LPARAM lPar <nl> : : SendDlgItemMessage ( _hSelf , IDC_LANGUAGES_LIST , LB_ADDSTRING , 0 , ( LPARAM ) _lsArray . getLexerDescFromIndex ( i ) ) ; <nl> } <nl> <nl> - _hStyleList = : : GetDlgItem ( _hSelf , IDC_STYLES_LIST ) ; <nl> + / / _hStyleList = : : GetDlgItem ( _hSelf , IDC_STYLES_LIST ) ; <nl> _hCheckBold = : : GetDlgItem ( _hSelf , IDC_BOLD_CHECK ) ; <nl> _hCheckItalic = : : GetDlgItem ( _hSelf , IDC_ITALIC_CHECK ) ; <nl> _hCheckUnderline = : : GetDlgItem ( _hSelf , IDC_UNDERLINE_CHECK ) ; <nl> void WordStyleDlg : : setStyleListFromLexer ( int index ) <nl> <nl> / / Fill out Styles listbox <nl> / / Before filling out , we clean it <nl> - : : SendMessage ( _hStyleList , LB_RESETCONTENT , 0 , 0 ) ; <nl> + : : SendDlgItemMessage ( _hSelf , IDC_STYLES_LIST , LB_RESETCONTENT , 0 , 0 ) ; <nl> <nl> if ( index ) <nl> { <nl> void WordStyleDlg : : setStyleListFromLexer ( int index ) <nl> const char * userExt = ( _lsArray . getLexerStylerByName ( langName ) ) - > getLexerUserExt ( ) ; <nl> : : SendDlgItemMessage ( _hSelf , IDC_DEF_EXT_EDIT , WM_SETTEXT , 0 , ( LPARAM ) ( ext ) ) ; <nl> : : SendDlgItemMessage ( _hSelf , IDC_USER_EXT_EDIT , WM_SETTEXT , 0 , ( LPARAM ) ( userExt ) ) ; <nl> - / / : : SetWindowText ( : : GetDlgItem ( _hSelf , IDC_USER_EXT_EDIT ) , userExt ) ; <nl> } <nl> : : ShowWindow ( : : GetDlgItem ( _hSelf , IDC_DEF_EXT_EDIT ) , index ? SW_SHOW : SW_HIDE ) ; <nl> : : ShowWindow ( : : GetDlgItem ( _hSelf , IDC_DEF_EXT_STATIC ) , index ? SW_SHOW : SW_HIDE ) ; <nl> void WordStyleDlg : : setStyleListFromLexer ( int index ) <nl> for ( int i = 0 ; i < lexerStyler . getNbStyler ( ) ; i + + ) <nl> { <nl> Style & style = lexerStyler . getStyler ( i ) ; <nl> - : : SendMessage ( _hStyleList , LB_ADDSTRING , 0 , ( LPARAM ) style . _styleDesc ) ; <nl> + : : SendDlgItemMessage ( _hSelf , IDC_STYLES_LIST , LB_ADDSTRING , 0 , ( LPARAM ) style . _styleDesc ) ; <nl> } <nl> - : : SendMessage ( _hStyleList , LB_SETCURSEL , 0 , 0 ) ; <nl> + : : SendDlgItemMessage ( _hSelf , IDC_STYLES_LIST , LB_SETCURSEL , 0 , 0 ) ; <nl> setVisualFromStyleList ( ) ; <nl> } <nl> <nl> mmm a / PowerEditor / src / WinControls / ColourPicker / WordStyleDlg . h <nl> ppp b / PowerEditor / src / WinControls / ColourPicker / WordStyleDlg . h <nl> public : <nl> private : <nl> COLORREF _colour ; <nl> WNDPROC _oldProc ; <nl> - / / HFONT _hFont ; <nl> <nl> static BOOL CALLBACK staticProc ( HWND hwnd , UINT message , WPARAM wParam , LPARAM lParam ) { <nl> ColourStaticTextHooker * pColourStaticTextHooker = reinterpret_cast < ColourStaticTextHooker * > ( : : GetWindowLong ( hwnd , GWL_USERDATA ) ) ; <nl> private : <nl> <nl> int _currentLexerIndex ; <nl> <nl> - HWND _hStyleList ; <nl> HWND _hCheckBold ; <nl> HWND _hCheckItalic ; <nl> HWND _hCheckUnderline ; <nl> private : <nl> <nl> <nl> Style & getCurrentStyler ( ) { <nl> - int styleIndex = int ( : : SendMessage ( _hStyleList , LB_GETCURSEL , 0 , 0 ) ) ; <nl> + int styleIndex = : : SendDlgItemMessage ( _hSelf , IDC_STYLES_LIST , LB_GETCURSEL , 0 , 0 ) ; <nl> if ( _currentLexerIndex = = 0 ) <nl> return _globalStyles . getStyler ( styleIndex ) ; <nl> else <nl> mmm a / PowerEditor / src / WinControls / OpenSaveFileDialog / FileDialog . cpp <nl> ppp b / PowerEditor / src / WinControls / OpenSaveFileDialog / FileDialog . cpp <nl> void FileDialog : : setExtFilter ( const char * extText , const char * ext , . . . ) <nl> _nbCharFileExt + = exts . length ( ) + 1 ; <nl> } <nl> <nl> + void FileDialog : : setExtsFilter ( const char * extText , const char * exts ) <nl> + { <nl> + / / fill out the ext array for save as file dialog <nl> + if ( _nbExt < nbExtMax ) <nl> + strcpy ( _extArray [ _nbExt + + ] , exts ) ; <nl> + / / <nl> + std : : string extFilter = extText ; <nl> + <nl> + extFilter + = " ( " ; <nl> + extFilter + = exts ; <nl> + extFilter + = " ) " ; <nl> + <nl> + char * pFileExt = _fileExt + _nbCharFileExt ; <nl> + memcpy ( pFileExt , extFilter . c_str ( ) , extFilter . length ( ) + 1 ) ; <nl> + _nbCharFileExt + = extFilter . length ( ) + 1 ; <nl> + <nl> + pFileExt = _fileExt + _nbCharFileExt ; <nl> + memcpy ( pFileExt , exts , strlen ( exts ) + 1 ) ; <nl> + _nbCharFileExt + = strlen ( exts ) + 1 ; <nl> + } <nl> + <nl> char * FileDialog : : doOpenSingleFileDlg ( ) <nl> { <nl> char dir [ MAX_PATH ] ; <nl> mmm a / PowerEditor / src / WinControls / OpenSaveFileDialog / FileDialog . h <nl> ppp b / PowerEditor / src / WinControls / OpenSaveFileDialog / FileDialog . h <nl> class FileDialog <nl> public : <nl> FileDialog ( HWND hwnd , HINSTANCE hInst ) ; <nl> void setExtFilter ( const char * , const char * , . . . ) ; <nl> + <nl> + void setExtsFilter ( const char * extText , const char * exts ) ; <nl> void setDefFileName ( const char * fn ) { strcpy ( _fileName , fn ) ; } <nl> <nl> char * doSaveDlg ( ) ; <nl> protected : <nl> private : <nl> char _fileName [ MAX_PATH * 8 ] ; <nl> <nl> - char _fileExt [ MAX_PATH * 2 ] ; <nl> + char _fileExt [ MAX_PATH * 10 ] ; <nl> int _nbCharFileExt ; <nl> - / / bool _isMultiSel ; <nl> <nl> stringVector _fileNames ; <nl> OPENFILENAME _ofn ; <nl> mmm a / PowerEditor / src / WinControls / Preference / preferenceDlg . cpp <nl> ppp b / PowerEditor / src / WinControls / Preference / preferenceDlg . cpp <nl> BOOL CALLBACK DefaultNewDocDlg : : run_dlgProc ( UINT Message , WPARAM wParam , LPARAM <nl> / / if ( ( LangType ) i ! = L_END ) <nl> { <nl> int cmdID = pNppParam - > langTypeToCommandID ( ( LangType ) i ) ; <nl> - if ( getNameStrFromCmd ( cmdID , str ) = = TYPE_CMD ) <nl> + if ( ( cmdID ! = - 1 ) & & ( getNameStrFromCmd ( cmdID , str ) = = TYPE_CMD ) ) <nl> { <nl> _langList . push_back ( LangID_Name ( ( LangType ) i , str ) ) ; <nl> : : SendDlgItemMessage ( _hSelf , IDC_COMBO_DEFAULTLANG , CB_ADDSTRING , 0 , ( LPARAM ) str . c_str ( ) ) ; <nl> mmm a / PowerEditor / src / WinControls / shortcut / RunMacroDlg . cpp <nl> ppp b / PowerEditor / src / WinControls / shortcut / RunMacroDlg . cpp <nl> <nl> - / / this file is part of notepad + + <nl> - / / Copyright ( C ) 2003 Don HO ( donho @ altern . org ) <nl> - / / <nl> - / / This program is free software ; you can redistribute it and / or <nl> - / / modify it under the terms of the GNU General Public License <nl> - / / as published by the Free Software Foundation ; either <nl> - / / version 2 of the License , or ( at your option ) any later version . <nl> - / / <nl> - / / This program is distributed in the hope that it will be useful , <nl> - / / but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> - / / MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> - / / GNU General Public License for more details . <nl> - / / <nl> - / / You should have received a copy of the GNU General Public License <nl> - / / along with this program ; if not , write to the Free Software <nl> - / / Foundation , Inc . , 675 Mass Ave , Cambridge , MA 02139 , USA . <nl> - <nl> - / / created by Daniel Volk mordorpost @ volkarts . com <nl> - <nl> - # include " RunMacroDlg . h " <nl> - # include " ScintillaEditView . h " <nl> - # include " Notepad_plus_msgs . h " <nl> - # include " constant . h " <nl> - <nl> - <nl> - BOOL CALLBACK RunMacroDlg : : run_dlgProc ( UINT message , WPARAM wParam , LPARAM lParam ) <nl> - { <nl> - switch ( message ) <nl> - { <nl> - case WM_INITDIALOG : <nl> - { <nl> - initMacroList ( ) ; <nl> - <nl> - char str [ 512 ] ; <nl> - ltoa ( m_Times , str , 10 ) ; <nl> - <nl> - : : SetDlgItemText ( _hSelf , IDC_M_RUN_TIMES , str ) ; <nl> - switch ( m_Mode ) <nl> - { <nl> - case RM_RUN_MULTI : <nl> - check ( IDC_M_RUN_MULTI ) ; <nl> - break ; <nl> - case RM_RUN_EOF : <nl> - check ( IDC_M_RUN_EOF ) ; <nl> - break ; <nl> - } <nl> - : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_TIMES , EM_LIMITTEXT , 4 , 0 ) ; <nl> - goToCenter ( ) ; <nl> - <nl> - return TRUE ; <nl> - } <nl> - <nl> - case WM_COMMAND : <nl> - { <nl> - if ( HIWORD ( wParam ) = = EN_CHANGE ) <nl> - { <nl> - switch ( LOWORD ( wParam ) ) <nl> - { <nl> - case IDC_M_RUN_TIMES : <nl> - check ( IDC_M_RUN_MULTI ) ; <nl> - return TRUE ; <nl> - <nl> - default : <nl> - return FALSE ; <nl> - } <nl> - } <nl> - <nl> - switch ( wParam ) <nl> - { <nl> - case IDCANCEL : <nl> - : : ShowWindow ( _hSelf , SW_HIDE ) ; <nl> - return TRUE ; <nl> - <nl> - case IDOK : <nl> - if ( isCheckedOrNot ( IDC_M_RUN_MULTI ) ) <nl> - { <nl> - / / char str [ 512 ] ; <nl> - <nl> - m_Mode = RM_RUN_MULTI ; <nl> - m_Times = : : GetDlgItemInt ( _hSelf , IDC_M_RUN_TIMES , NULL , FALSE ) ; <nl> - } <nl> - else if ( isCheckedOrNot ( IDC_M_RUN_EOF ) ) <nl> - { <nl> - m_Mode = RM_RUN_EOF ; <nl> - } <nl> - <nl> - if ( : : SendDlgItemMessage ( _hSelf , IDC_MACRO_COMBO , CB_GETCOUNT , 0 , 0 ) ) <nl> - : : SendMessage ( _hParent , WM_MACRODLGRUNMACRO , 0 , 0 ) ; <nl> - <nl> - return TRUE ; <nl> - <nl> + / / this file is part of notepad + + <nl> + / / Copyright ( C ) 2003 Don HO ( donho @ altern . org ) <nl> + / / <nl> + / / This program is free software ; you can redistribute it and / or <nl> + / / modify it under the terms of the GNU General Public License <nl> + / / as published by the Free Software Foundation ; either <nl> + / / version 2 of the License , or ( at your option ) any later version . <nl> + / / <nl> + / / This program is distributed in the hope that it will be useful , <nl> + / / but WITHOUT ANY WARRANTY ; without even the implied warranty of <nl> + / / MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the <nl> + / / GNU General Public License for more details . <nl> + / / <nl> + / / You should have received a copy of the GNU General Public License <nl> + / / along with this program ; if not , write to the Free Software <nl> + / / Foundation , Inc . , 675 Mass Ave , Cambridge , MA 02139 , USA . <nl> + <nl> + / / created by Daniel Volk mordorpost @ volkarts . com <nl> + <nl> + # include " RunMacroDlg . h " <nl> + # include " ScintillaEditView . h " <nl> + # include " Notepad_plus_msgs . h " <nl> + # include " constant . h " <nl> + <nl> + <nl> + BOOL CALLBACK RunMacroDlg : : run_dlgProc ( UINT message , WPARAM wParam , LPARAM lParam ) <nl> + { <nl> + switch ( message ) <nl> + { <nl> + case WM_INITDIALOG : <nl> + { <nl> + initMacroList ( ) ; <nl> + <nl> + char str [ 512 ] ; <nl> + ltoa ( m_Times , str , 10 ) ; <nl> + <nl> + : : SetDlgItemText ( _hSelf , IDC_M_RUN_TIMES , str ) ; <nl> + switch ( m_Mode ) <nl> + { <nl> + case RM_RUN_MULTI : <nl> + check ( IDC_M_RUN_MULTI ) ; <nl> + break ; <nl> + case RM_RUN_EOF : <nl> + check ( IDC_M_RUN_EOF ) ; <nl> + break ; <nl> + } <nl> + : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_TIMES , EM_LIMITTEXT , 4 , 0 ) ; <nl> + goToCenter ( ) ; <nl> + <nl> + return TRUE ; <nl> + } <nl> + <nl> + case WM_COMMAND : <nl> + { <nl> + if ( HIWORD ( wParam ) = = EN_CHANGE ) <nl> + { <nl> + switch ( LOWORD ( wParam ) ) <nl> + { <nl> + case IDC_M_RUN_TIMES : <nl> + check ( IDC_M_RUN_MULTI ) ; <nl> + return TRUE ; <nl> + <nl> + default : <nl> + return FALSE ; <nl> + } <nl> + } <nl> + <nl> + switch ( wParam ) <nl> + { <nl> + case IDCANCEL : <nl> + : : ShowWindow ( _hSelf , SW_HIDE ) ; <nl> + return TRUE ; <nl> + <nl> + case IDOK : <nl> + if ( isCheckedOrNot ( IDC_M_RUN_MULTI ) ) <nl> + { <nl> + m_Mode = RM_RUN_MULTI ; <nl> + m_Times = : : GetDlgItemInt ( _hSelf , IDC_M_RUN_TIMES , NULL , FALSE ) ; <nl> + } <nl> + else if ( isCheckedOrNot ( IDC_M_RUN_EOF ) ) <nl> + { <nl> + m_Mode = RM_RUN_EOF ; <nl> + } <nl> + <nl> + if ( : : SendDlgItemMessage ( _hSelf , IDC_MACRO_COMBO , CB_GETCOUNT , 0 , 0 ) ) <nl> + : : SendMessage ( _hParent , WM_MACRODLGRUNMACRO , 0 , 0 ) ; <nl> + <nl> + return TRUE ; <nl> + <nl> default : <nl> if ( ( HIWORD ( wParam ) = = CBN_SELCHANGE ) & & ( LOWORD ( wParam ) = = IDC_MACRO_COMBO ) ) <nl> { <nl> m_macroIndex = : : SendDlgItemMessage ( _hSelf , IDC_MACRO_COMBO , CB_GETCURSEL , 0 , 0 ) ; <nl> return TRUE ; <nl> - } <nl> - } <nl> - } <nl> - } <nl> - return FALSE ; <nl> - } <nl> - <nl> - void RunMacroDlg : : check ( int id ) <nl> - { <nl> - / / IDC_M_RUN_MULTI <nl> - if ( id = = IDC_M_RUN_MULTI ) <nl> - : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_MULTI , BM_SETCHECK , BST_CHECKED , 0 ) ; <nl> - else <nl> - : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_MULTI , BM_SETCHECK , BST_UNCHECKED , 0 ) ; <nl> - <nl> - / / IDC_M_RUN_EOF <nl> - if ( id = = IDC_M_RUN_EOF ) <nl> - : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_EOF , BM_SETCHECK , BST_CHECKED , 0 ) ; <nl> - else <nl> - : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_EOF , BM_SETCHECK , BST_UNCHECKED , 0 ) ; <nl> - } <nl> + } <nl> + } <nl> + } <nl> + } <nl> + return FALSE ; <nl> + } <nl> + <nl> + void RunMacroDlg : : check ( int id ) <nl> + { <nl> + / / IDC_M_RUN_MULTI <nl> + if ( id = = IDC_M_RUN_MULTI ) <nl> + : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_MULTI , BM_SETCHECK , BST_CHECKED , 0 ) ; <nl> + else <nl> + : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_MULTI , BM_SETCHECK , BST_UNCHECKED , 0 ) ; <nl> + <nl> + / / IDC_M_RUN_EOF <nl> + if ( id = = IDC_M_RUN_EOF ) <nl> + : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_EOF , BM_SETCHECK , BST_CHECKED , 0 ) ; <nl> + else <nl> + : : SendDlgItemMessage ( _hSelf , IDC_M_RUN_EOF , BM_SETCHECK , BST_UNCHECKED , 0 ) ; <nl> + } <nl> mmm a / PowerEditor / src / WinControls / shortcut / shortcut . cpp <nl> ppp b / PowerEditor / src / WinControls / shortcut / shortcut . cpp <nl> void recordedMacroStep : : PlayBack ( Window * pNotepad , ScintillaEditView * pEditView ) <nl> if ( MacroType = = mtUseSParameter ) <nl> lParam = reinterpret_cast < long > ( sParameter . c_str ( ) ) ; <nl> pEditView - > execute ( message , wParameter , lParam ) ; <nl> + if ( ( message = = SCI_SETTEXT ) <nl> + | | ( message = = SCI_REPLACESEL ) <nl> + | | ( message = = SCI_ADDTEXT ) <nl> + | | ( message = = SCI_ADDSTYLEDTEXT ) <nl> + | | ( message = = SCI_INSERTTEXT ) <nl> + | | ( message = = SCI_APPENDTEXT ) ) { <nl> + SCNotification scnN ; <nl> + scnN . nmhdr . code = SCN_CHARADDED ; <nl> + scnN . nmhdr . hwndFrom = pEditView - > getHSelf ( ) ; <nl> + scnN . nmhdr . idFrom = 0 ; <nl> + scnN . ch = sParameter . at ( 0 ) ; <nl> + : : SendMessage ( pNotepad - > getHSelf ( ) , WM_NOTIFY , 0 , reinterpret_cast < LPARAM > ( & scnN ) ) ; <nl> + } <nl> } <nl> } <nl>
[ RELEASE_V42 ]
notepad-plus-plus/notepad-plus-plus
232269464975d1b6b314556637b16bb4a72a6f0a
2007-08-12T23:21:25Z
mmm a / . gitmodules <nl> ppp b / . gitmodules <nl> <nl> [ submodule " contrib / cctz " ] <nl> path = contrib / cctz <nl> url = https : / / github . com / google / cctz . git <nl> + [ submodule " contrib / zlib - ng " ] <nl> + path = contrib / zlib - ng <nl> + url = https : / / github . com / Dead2 / zlib - ng . git <nl> mmm a / contrib / CMakeLists . txt <nl> ppp b / contrib / CMakeLists . txt <nl> if ( USE_INTERNAL_UNWIND_LIBRARY ) <nl> endif ( ) <nl> <nl> if ( USE_INTERNAL_ZLIB_LIBRARY ) <nl> - add_subdirectory ( libzlib - ng ) <nl> + add_subdirectory ( zlib - ng ) <nl> + # todo : make pull to Dead2 / zlib - ng and remove : <nl> + # We should use same defines when including zlib . h as used when zlib compiled <nl> + target_compile_definitions ( zlib PUBLIC ZLIB_COMPAT WITH_GZFILEOP ) <nl> + target_compile_definitions ( zlibstatic PUBLIC ZLIB_COMPAT WITH_GZFILEOP ) <nl> endif ( ) <nl> <nl> if ( USE_INTERNAL_CCTZ_LIBRARY ) <nl> new file mode 160000 <nl> index 00000000000 . . e07a52dbaa3 <nl> mmm / dev / null <nl> ppp b / contrib / zlib - ng <nl> @ @ - 0 , 0 + 1 @ @ <nl> + Subproject commit e07a52dbaa35d003f5659b221b29d220c091667b <nl> mmm a / dbms / src / Common / BackgroundSchedulePool . h <nl> ppp b / dbms / src / Common / BackgroundSchedulePool . h <nl> <nl> # include < Poco / Notification . h > <nl> # include < Poco / NotificationQueue . h > <nl> # include < Poco / Timestamp . h > <nl> - <nl> # include < thread > <nl> # include < atomic > <nl> # include < mutex > <nl> + # include < condition_variable > <nl> # include < vector > <nl> # include < map > <nl> # include < functional > <nl> mmm a / libs / libdaemon / src / BaseDaemon . cpp <nl> ppp b / libs / libdaemon / src / BaseDaemon . cpp <nl> void BaseDaemon : : buildLoggers ( ) <nl> pf - > setProperty ( " times " , " local " ) ; <nl> Poco : : AutoPtr < FormattingChannel > log = new FormattingChannel ( pf ) ; <nl> log_file = new FileChannel ; <nl> - log_file - > setProperty ( " path " , Poco : : Path ( config ( ) . getString ( " logger . log " ) ) . absolute ( ) . toString ( ) ) ; <nl> - log_file - > setProperty ( " rotation " , config ( ) . getRawString ( " logger . size " , " 100M " ) ) ; <nl> - log_file - > setProperty ( " archive " , " number " ) ; <nl> - log_file - > setProperty ( " compress " , config ( ) . getRawString ( " logger . compress " , " true " ) ) ; <nl> - log_file - > setProperty ( " purgeCount " , config ( ) . getRawString ( " logger . count " , " 1 " ) ) ; <nl> + log_file - > setProperty ( Poco : : FileChannel : : PROP_PATH , Poco : : Path ( config ( ) . getString ( " logger . log " ) ) . absolute ( ) . toString ( ) ) ; <nl> + log_file - > setProperty ( Poco : : FileChannel : : PROP_ROTATION , config ( ) . getRawString ( " logger . size " , " 100M " ) ) ; <nl> + log_file - > setProperty ( Poco : : FileChannel : : PROP_ARCHIVE , " number " ) ; <nl> + log_file - > setProperty ( Poco : : FileChannel : : PROP_COMPRESS , config ( ) . getRawString ( " logger . compress " , " true " ) ) ; <nl> + log_file - > setProperty ( Poco : : FileChannel : : PROP_PURGECOUNT , config ( ) . getRawString ( " logger . count " , " 1 " ) ) ; <nl> + log_file - > setProperty ( Poco : : FileChannel : : PROP_FLUSH , config ( ) . getRawString ( " logger . flush " , " true " ) ) ; <nl> + log_file - > setProperty ( Poco : : FileChannel : : PROP_ROTATEONOPEN , config ( ) . getRawString ( " logger . rotateOnOpen " , " false " ) ) ; <nl> log - > setChannel ( log_file ) ; <nl> split - > addChannel ( log ) ; <nl> log_file - > open ( ) ; <nl> void BaseDaemon : : buildLoggers ( ) <nl> pf - > setProperty ( " times " , " local " ) ; <nl> Poco : : AutoPtr < FormattingChannel > errorlog = new FormattingChannel ( pf ) ; <nl> error_log_file = new FileChannel ; <nl> - error_log_file - > setProperty ( " path " , Poco : : Path ( config ( ) . getString ( " logger . errorlog " ) ) . absolute ( ) . toString ( ) ) ; <nl> - error_log_file - > setProperty ( " rotation " , config ( ) . getRawString ( " logger . size " , " 100M " ) ) ; <nl> - error_log_file - > setProperty ( " archive " , " number " ) ; <nl> - error_log_file - > setProperty ( " compress " , config ( ) . getRawString ( " logger . compress " , " true " ) ) ; <nl> - error_log_file - > setProperty ( " purgeCount " , config ( ) . getRawString ( " logger . count " , " 1 " ) ) ; <nl> + error_log_file - > setProperty ( Poco : : FileChannel : : PROP_PATH , Poco : : Path ( config ( ) . getString ( " logger . errorlog " ) ) . absolute ( ) . toString ( ) ) ; <nl> + error_log_file - > setProperty ( Poco : : FileChannel : : PROP_ROTATION , config ( ) . getRawString ( " logger . size " , " 100M " ) ) ; <nl> + error_log_file - > setProperty ( Poco : : FileChannel : : PROP_ARCHIVE , " number " ) ; <nl> + error_log_file - > setProperty ( Poco : : FileChannel : : PROP_COMPRESS , config ( ) . getRawString ( " logger . compress " , " true " ) ) ; <nl> + error_log_file - > setProperty ( Poco : : FileChannel : : PROP_PURGECOUNT , config ( ) . getRawString ( " logger . count " , " 1 " ) ) ; <nl> + error_log_file - > setProperty ( Poco : : FileChannel : : PROP_FLUSH , config ( ) . getRawString ( " logger . flush " , " true " ) ) ; <nl> + error_log_file - > setProperty ( Poco : : FileChannel : : PROP_ROTATEONOPEN , config ( ) . getRawString ( " logger . rotateOnOpen " , " false " ) ) ; <nl> errorlog - > setChannel ( error_log_file ) ; <nl> level - > setChannel ( errorlog ) ; <nl> split - > addChannel ( level ) ; <nl>
Merge remote - tracking branch ' origin / master ' into unify - data - types - that - serialized - with - multiple - streams
ClickHouse/ClickHouse
f9cd1e7afc4c6f200d8b3f8a50964ad6b6739171
2017-11-21T20:10:58Z
mmm a / classify / mf . cpp <nl> ppp b / classify / mf . cpp <nl> <nl> * the features into the new format . Then deallocate the <nl> * old micro - features . <nl> * @ param Blob blob to extract micro - features from <nl> - * @ param bl_denorm currently unused <nl> * @ param cn_denorm control parameter to feature extractor . <nl> - * @ param fx_info currently unused <nl> * @ return Micro - features for Blob . <nl> * @ note Exceptions : none <nl> * @ note History : Wed May 23 18 : 06 : 38 1990 , DSJ , Created . <nl> * / <nl> - FEATURE_SET ExtractMicros ( TBLOB * Blob , const DENORM & bl_denorm , <nl> - const DENORM & cn_denorm , <nl> - const INT_FX_RESULT_STRUCT & fx_info ) { <nl> + FEATURE_SET ExtractMicros ( TBLOB * Blob , const DENORM & cn_denorm ) { <nl> int NumFeatures ; <nl> MICROFEATURES Features , OldFeatures ; <nl> FEATURE_SET FeatureSet ; <nl>
What the . . . ? Git ' s merge failed hard .
tesseract-ocr/tesseract
953523bbe2b319de4bea94504abc4d493a16c4fe
2015-07-20T21:42:58Z