diff
stringlengths
41
2.03M
msg
stringlengths
1
1.5k
repo
stringlengths
5
40
sha
stringlengths
40
40
time
stringlengths
20
20
mmm a / lib / ClangImporter / ImportDecl . cpp <nl> ppp b / lib / ClangImporter / ImportDecl . cpp <nl> namespace { <nl> <nl> bool hasReferenceableFields = ! members . empty ( ) ; <nl> <nl> - if ( hasZeroInitializableStorage & & <nl> - ! Impl . SwiftContext . LangOpts . EnableCXXInterop ) { <nl> - / / Add constructors for the struct . <nl> + const clang : : CXXRecordDecl * cxxRecordDecl = <nl> + dyn_cast < clang : : CXXRecordDecl > ( decl ) ; <nl> + if ( hasZeroInitializableStorage & & ! cxxRecordDecl ) { <nl> + / / Add default constructor for the struct if compiling in C mode . <nl> + / / If we ' re compiling for C + + , we ' ll import the C + + default constructor <nl> + / / ( if there is one ) , so we don ' t need to synthesize one here . <nl> ctors . push_back ( createDefaultConstructor ( Impl , result ) ) ; <nl> } <nl> <nl> + bool hasUserDeclaredConstructor = <nl> + cxxRecordDecl & & cxxRecordDecl - > hasUserDeclaredConstructor ( ) ; <nl> if ( hasReferenceableFields & & hasMemberwiseInitializer & & <nl> - ! Impl . SwiftContext . LangOpts . EnableCXXInterop ) { <nl> + ! hasUserDeclaredConstructor ) { <nl> / / The default zero initializer suppresses the implicit value <nl> / / constructor that would normally be formed , so we have to add that <nl> / / explicitly as well . <nl> namespace { <nl> <nl> AbstractFunctionDecl * result = nullptr ; <nl> if ( auto * ctordecl = dyn_cast < clang : : CXXConstructorDecl > ( decl ) ) { <nl> - / / TODO : Is failable , throws etc . correct ? <nl> DeclName ctorName ( Impl . SwiftContext , DeclBaseName : : createConstructor ( ) , <nl> bodyParams ) ; <nl> result = Impl . createDeclWithClangNode < ConstructorDecl > ( <nl> mmm a / lib / IRGen / GenCall . cpp <nl> ppp b / lib / IRGen / GenCall . cpp <nl> namespace { <nl> <nl> private : <nl> void expand ( SILParameterInfo param ) ; <nl> - llvm : : Type * addIndirectResult ( bool noCapture = true ) ; <nl> + llvm : : Type * addIndirectResult ( ) ; <nl> <nl> SILFunctionConventions getSILFuncConventions ( ) const { <nl> return SILFunctionConventions ( FnType , IGM . getSILModule ( ) ) ; <nl> llvm : : Type * SignatureExpansion : : addIndirectResult ( ) { <nl> auto resultType = getSILFuncConventions ( ) . getSILResultType ( <nl> IGM . getMaximalTypeExpansionContext ( ) ) ; <nl> const TypeInfo & resultTI = IGM . getTypeInfo ( resultType ) ; <nl> - addIndirectResultAttributes ( IGM , Attrs , ParamIRTypes . size ( ) , claimSRet ( ) , <nl> - noCapture ) ; <nl> + addIndirectResultAttributes ( IGM , Attrs , ParamIRTypes . size ( ) , claimSRet ( ) ) ; <nl> addPointerParameter ( resultTI . getStorageType ( ) ) ; <nl> return IGM . VoidTy ; <nl> } <nl> void SignatureExpansion : : expandExternalSignatureTypes ( ) { <nl> SmallVector < clang : : CanQualType , 4 > paramTys ; <nl> auto const & clangCtx = IGM . getClangASTContext ( ) ; <nl> <nl> + bool formalIndirectResult = FnType - > getNumResults ( ) > 0 & & <nl> + FnType - > getSingleResult ( ) . isFormalIndirect ( ) ; <nl> + if ( formalIndirectResult ) { <nl> + auto resultType = getSILFuncConventions ( ) . getSingleSILResultType ( <nl> + IGM . getMaximalTypeExpansionContext ( ) ) ; <nl> + auto clangTy = <nl> + IGM . getClangASTContext ( ) . getPointerType ( IGM . getClangType ( resultType ) ) ; <nl> + paramTys . push_back ( clangTy ) ; <nl> + } <nl> + <nl> switch ( FnType - > getRepresentation ( ) ) { <nl> case SILFunctionTypeRepresentation : : ObjCMethod : { <nl> / / ObjC methods take their ' self ' argument first , followed by an <nl> void SignatureExpansion : : expandExternalSignatureTypes ( ) { <nl> } <nl> <nl> / / If we return indirectly , that is the first parameter type . <nl> - bool formalIndirect = FnType - > getNumResults ( ) > 0 & & <nl> - FnType - > getSingleResult ( ) . isFormalIndirect ( ) ; <nl> - if ( formalIndirect | | returnInfo . isIndirect ( ) ) { <nl> - / / Specify " nocapture " if we ' re returning the result indirectly for <nl> - / / low - level ABI reasons , as the called function never sees the implicit <nl> - / / output parameter . <nl> - / / On the other hand , if the result is a formal indirect result in SIL , that <nl> - / / means that the Clang function has an explicit output parameter ( e . g . it ' s <nl> - / / a C + + constructor ) , which it might capture - - so don ' t specify <nl> - / / " nocapture " in that case . <nl> - addIndirectResult ( / * noCapture = * / returnInfo . isIndirect ( ) ) ; <nl> + if ( returnInfo . isIndirect ( ) ) { <nl> + addIndirectResult ( ) ; <nl> } <nl> <nl> size_t firstParamToLowerNormally = 0 ; <nl> void SignatureExpansion : : expandExternalSignatureTypes ( ) { <nl> } <nl> } <nl> <nl> + if ( formalIndirectResult ) { <nl> + / / If the result is a formal indirect result in SIL , that means that the <nl> + / / Clang function has an explicit output parameter ( e . g . it ' s a C + + <nl> + / / constructor ) , which it might capture - - so don ' t specify " nocapture " . <nl> + addIndirectResultAttributes ( IGM , Attrs , 0 , claimSRet ( ) , / * nocapture = * / false ) ; <nl> + } <nl> + <nl> if ( returnInfo . isIndirect ( ) | | returnInfo . isIgnore ( ) ) { <nl> ResultIRType = IGM . VoidTy ; <nl> } else { <nl> static void externalizeArguments ( IRGenFunction & IGF , const Callee & callee , <nl> = = SILFunctionTypeRepresentation : : Block ) { <nl> / / Ignore the physical block - object parameter . <nl> firstParam + = 1 ; <nl> + / / Or the indirect result parameter . <nl> + } else if ( fnType - > getNumResults ( ) > 0 & & <nl> + fnType - > getSingleResult ( ) . isFormalIndirect ( ) ) { <nl> + / / Ignore the indirect result parameter . <nl> + firstParam + = 1 ; <nl> } <nl> <nl> for ( unsigned i = firstParam , e = FI . arg_size ( ) ; i ! = e ; + + i ) { <nl> mmm a / lib / IRGen / GenDecl . cpp <nl> ppp b / lib / IRGen / GenDecl . cpp <nl> <nl> # include " clang / AST / ASTContext . h " <nl> # include " clang / AST / DeclCXX . h " <nl> # include " clang / AST / GlobalDecl . h " <nl> + # include " clang / CodeGen / CodeGenABITypes . h " <nl> + # include " clang / CodeGen / ModuleBuilder . h " <nl> # include " llvm / ADT / SmallString . h " <nl> # include " llvm / IR / DerivedTypes . h " <nl> # include " llvm / IR / GlobalAlias . h " <nl> void IRGenModule : : emitDynamicReplacementOriginalFunctionThunk ( SILFunction * f ) { <nl> IGF . Builder . CreateRet ( Res ) ; <nl> } <nl> <nl> + / / / If the calling convention for ` ctor ` doesn ' t match the calling convention <nl> + / / / that we assumed for it when we imported it as ` initializer ` , emit and <nl> + / / / return a thunk that conforms to the assumed calling convention . The thunk <nl> + / / / is marked ` alwaysinline ` , so it doesn ' t generate any runtime overhead . <nl> + / / / If the assumed calling convention was correct , just return ` ctor ` . <nl> + / / / <nl> + / / / See also comments in CXXMethodConventions in SIL / IR / SILFunctionType . cpp . <nl> + static llvm : : Constant * <nl> + emitCXXConstructorThunkIfNeeded ( IRGenModule & IGM , SILFunction * initializer , <nl> + const clang : : CXXConstructorDecl * ctor , <nl> + const LinkEntity & entity , <nl> + llvm : : Constant * ctorAddress ) { <nl> + Signature signature = IGM . getSignature ( initializer - > getLoweredFunctionType ( ) ) ; <nl> + <nl> + llvm : : FunctionType * assumedFnType = signature . getType ( ) ; <nl> + llvm : : FunctionType * ctorFnType = <nl> + cast < llvm : : FunctionType > ( ctorAddress - > getType ( ) - > getPointerElementType ( ) ) ; <nl> + <nl> + if ( assumedFnType = = ctorFnType ) { <nl> + return ctorAddress ; <nl> + } <nl> + <nl> + / / The thunk has private linkage , so it doesn ' t need to have a predictable <nl> + / / mangled name - - we just need to make sure the name is unique . <nl> + llvm : : SmallString < 32 > name ; <nl> + llvm : : raw_svector_ostream stream ( name ) ; <nl> + stream < < " __swift_cxx_ctor " ; <nl> + entity . mangle ( stream ) ; <nl> + <nl> + llvm : : Function * thunk = llvm : : Function : : Create ( <nl> + assumedFnType , llvm : : Function : : PrivateLinkage , name , & IGM . Module ) ; <nl> + <nl> + thunk - > setCallingConv ( llvm : : CallingConv : : C ) ; <nl> + <nl> + llvm : : AttrBuilder attrBuilder ; <nl> + IGM . constructInitialFnAttributes ( attrBuilder ) ; <nl> + attrBuilder . addAttribute ( llvm : : Attribute : : AlwaysInline ) ; <nl> + llvm : : AttributeList attr = signature . getAttributes ( ) . addAttributes ( <nl> + IGM . getLLVMContext ( ) , llvm : : AttributeList : : FunctionIndex , attrBuilder ) ; <nl> + thunk - > setAttributes ( attr ) ; <nl> + <nl> + IRGenFunction subIGF ( IGM , thunk ) ; <nl> + if ( IGM . DebugInfo ) <nl> + IGM . DebugInfo - > emitArtificialFunction ( subIGF , thunk ) ; <nl> + <nl> + SmallVector < llvm : : Value * , 8 > Args ; <nl> + for ( auto i = thunk - > arg_begin ( ) , e = thunk - > arg_end ( ) ; i ! = e ; + + i ) { <nl> + auto * argTy = i - > getType ( ) ; <nl> + auto * paramTy = ctorFnType - > getParamType ( i - thunk - > arg_begin ( ) ) ; <nl> + if ( paramTy ! = argTy ) <nl> + Args . push_back ( subIGF . coerceValue ( i , paramTy , IGM . DataLayout ) ) ; <nl> + else <nl> + Args . push_back ( i ) ; <nl> + } <nl> + <nl> + clang : : CodeGen : : ImplicitCXXConstructorArgs implicitArgs = <nl> + clang : : CodeGen : : getImplicitCXXConstructorArgs ( IGM . ClangCodeGen - > CGM ( ) , <nl> + ctor ) ; <nl> + for ( size_t i = 0 ; i < implicitArgs . Prefix . size ( ) ; + + i ) { <nl> + Args . insert ( Args . begin ( ) + 1 + i , implicitArgs . Prefix [ i ] ) ; <nl> + } <nl> + for ( const auto & arg : implicitArgs . Suffix ) { <nl> + Args . push_back ( arg ) ; <nl> + } <nl> + <nl> + subIGF . Builder . CreateCall ( ctorFnType , ctorAddress , Args ) ; <nl> + subIGF . Builder . CreateRetVoid ( ) ; <nl> + <nl> + return thunk ; <nl> + } <nl> + <nl> / / / Find the entry point for a SIL function . <nl> llvm : : Function * IRGenModule : : getAddrOfSILFunction ( <nl> SILFunction * f , ForDefinition_t forDefinition , <nl> llvm : : Function * IRGenModule : : getAddrOfSILFunction ( <nl> if ( auto clangDecl = f - > getClangDecl ( ) ) { <nl> auto globalDecl = getClangGlobalDeclForFunction ( clangDecl ) ; <nl> clangAddr = getAddrOfClangGlobalDecl ( globalDecl , forDefinition ) ; <nl> + <nl> + if ( auto ctor = dyn_cast < clang : : CXXConstructorDecl > ( clangDecl ) ) { <nl> + clangAddr = <nl> + emitCXXConstructorThunkIfNeeded ( * this , f , ctor , entity , clangAddr ) ; <nl> + } <nl> } <nl> <nl> bool isDefinition = f - > isDefinition ( ) ; <nl> mmm a / test / Interop / Cxx / class / Inputs / cxx - constructors . h <nl> ppp b / test / Interop / Cxx / class / Inputs / cxx - constructors . h <nl> struct DefaultConstructorDeleted { <nl> } ; <nl> <nl> struct ConstructorWithParam { <nl> - ConstructorWithParam ( int val ) : x ( val ) { } <nl> + ConstructorWithParam ( int val ) : x ( val + 42 ) { } <nl> int x ; <nl> } ; <nl> + <nl> + struct Base { } ; <nl> + <nl> + struct ArgType { <nl> + int i = 42 ; <nl> + } ; <nl> + <nl> + struct HasVirtualBase : public virtual Base { <nl> + HasVirtualBase ( ) = delete ; <nl> + HasVirtualBase ( ArgType Arg ) { } <nl> + int i ; <nl> + } ; <nl> mmm a / test / Interop / Cxx / class / cxx - constructors - executable . swift <nl> ppp b / test / Interop / Cxx / class / cxx - constructors - executable . swift <nl> <nl> - / / RUN : % empty - directory ( % t ) <nl> - / / RUN : % target - build - swift % s - I % S / Inputs / - o % t / cxx_interop - Xfrontend - enable - cxx - interop <nl> - / / RUN : % target - codesign % t / cxx_interop <nl> - / / RUN : % target - run % t / cxx_interop <nl> + / / RUN : % target - run - simple - swift ( - I % S / Inputs / - Xfrontend - enable - cxx - interop ) <nl> / / <nl> / / REQUIRES : executable_test <nl> <nl> CxxConstructorTestSuite . test ( " MemberOfClassType " ) { <nl> } <nl> <nl> CxxConstructorTestSuite . test ( " ConstructorWithParam " ) { <nl> - let instance = ConstructorWithParam ( 123456 ) <nl> + let instance = ConstructorWithParam ( 2 ) <nl> <nl> - expectEqual ( 123456 , instance . x ) <nl> + expectEqual ( 44 , instance . x ) <nl> } <nl> <nl> runAllTests ( ) <nl> mmm a / test / Interop / Cxx / class / cxx - constructors - ir . swift <nl> ppp b / test / Interop / Cxx / class / cxx - constructors - ir . swift <nl> <nl> - / / RUN : % target - swift - frontend - I % S / Inputs - enable - cxx - interop - emit - ir % s | % FileCheck % s <nl> + / / Target - specific tests for C + + constructor call code generation . <nl> + <nl> + / / RUN : % swift - module - name Swift - target x86_64 - apple - macosx10 . 9 - dump - clang - diagnostics - I % S / Inputs - enable - cxx - interop - emit - ir % s - parse - stdlib - parse - as - library - disable - legacy - type - info | % FileCheck % s - check - prefix = ITANIUM_X64 <nl> + / / RUN : % swift - module - name Swift - target armv7 - none - linux - androideabi - dump - clang - diagnostics - I % S / Inputs - enable - cxx - interop - emit - ir % s - parse - stdlib - parse - as - library - disable - legacy - type - info | % FileCheck % s - check - prefix = ITANIUM_ARM <nl> + / / RUN : % swift - module - name Swift - target x86_64 - unknown - windows - msvc - dump - clang - diagnostics - I % S / Inputs - enable - cxx - interop - emit - ir % s - parse - stdlib - parse - as - library - disable - legacy - type - info | % FileCheck % s - check - prefix = MICROSOFT_X64 <nl> <nl> import CxxConstructors <nl> <nl> - / / Note : <nl> - / / - The ` this ` parameter should carry a ` noalias ` attribute , as it is <nl> - / / guaranteed that nothing will alias the object before it has been fully <nl> - / / constructed . It should also carry an ` sret ` attribute to indicate that this <nl> - / / is an out parameter for a structure being returned by the function . <nl> - / / - The ` this ` parameter should _not_ carry a ` nocapture ` attribute ( unlike <nl> - / / Swift constructors that return their result indirectly ) because the C + + has <nl> - / / explicit access to ` this ` and may capture it . <nl> - / / CHECK : call void @ _ZN20ConstructorWithParamC2Ei ( % struct . ConstructorWithParam * noalias sret % { { [ 0 - 9 ] + } } , i32 42 ) <nl> - let _ = ConstructorWithParam ( 42 ) <nl> + typealias Void = ( ) <nl> + <nl> + public func createHasVirtualBase ( ) - > HasVirtualBase { <nl> + / / - The ` this ` parameter should carry a ` noalias ` attribute , as it is <nl> + / / guaranteed that nothing will alias the object before it has been fully <nl> + / / constructed . It should also carry an ` sret ` attribute to indicate that <nl> + / / this is an out parameter for a structure being returned by the function . <nl> + / / Note that this doesn ' t apply on ABIs ( Itanium ARM , Microsoft x64 ) <nl> + / / where we insert an ( inlined ) thunk ; in this case , we ' re getting the <nl> + / / attributes of the constructor that was generated by Clang , which doesn ' t <nl> + / / insert these attributes . <nl> + / / <nl> + / / - The ` this ` parameter should _not_ carry a ` nocapture ` attribute ( unlike <nl> + / / Swift constructors that return their result indirectly ) because the C + + <nl> + / / constructor has explicit access to ` this ` and may capture it . <nl> + / / <nl> + / / ITANIUM_X64 : define swiftcc { i8 * , i32 } @ " $ ss20createHasVirtualBaseSo0bcD0VyF " ( ) <nl> + / / ITANIUM_X64 - NOT : define <nl> + / / ITANIUM_X64 : call void @ _ZN14HasVirtualBaseC1E7ArgType ( % struct . HasVirtualBase * noalias sret % { { [ 0 - 9 ] + } } , i32 % { { [ 0 - 9 ] + } } ) <nl> + / / <nl> + / / ITANIUM_ARM : define protected swiftcc { i8 * , i32 } @ " $ ss20createHasVirtualBaseSo0bcD0VyF " ( ) <nl> + / / To verify that the thunk is inlined , make sure there ' s no intervening <nl> + / / ` define ` , i . e . the call to the C + + constructor happens in <nl> + / / createHasVirtualBase ( ) , not some later function . <nl> + / / ITANIUM_ARM - NOT : define <nl> + / / Note ` this ` return type . <nl> + / / ITANIUM_ARM : call % struct . HasVirtualBase * @ _ZN14HasVirtualBaseC1E7ArgType ( % struct . HasVirtualBase * % { { [ 0 - 9 ] + } } , [ 1 x i32 ] % { { [ 0 - 9 ] + } } ) <nl> + / / <nl> + / / MICROSOFT_X64 : define dllexport swiftcc { i8 * , i32 } @ " $ ss20createHasVirtualBaseSo0bcD0VyF " ( ) <nl> + / / MICROSOFT_X64 - NOT : define <nl> + / / Note ` this ` return type and implicit " most derived " argument . <nl> + / / MICROSOFT_X64 : call % struct . HasVirtualBase * @ " ? ? 0HasVirtualBase @ @ QEAA @ UArgType @ @ @ Z " ( % struct . HasVirtualBase * % { { [ 0 - 9 ] + } } , i32 % { { [ 0 - 9 ] + } } , i32 1 ) <nl> + return HasVirtualBase ( ArgType ( ) ) <nl> + } <nl> mmm a / test / Interop / Cxx / class / cxx - constructors - module - interface . swift <nl> ppp b / test / Interop / Cxx / class / cxx - constructors - module - interface . swift <nl> <nl> / / CHECK - NEXT : struct ImplicitDefaultConstructor { <nl> / / CHECK - NEXT : var x : Int32 <nl> / / CHECK - NEXT : init ( ) <nl> + / / CHECK - NEXT : init ( x : Int32 ) <nl> / / CHECK - NEXT : } <nl> / / CHECK - NEXT : struct MemberOfClassType { <nl> / / CHECK - NEXT : var member : ImplicitDefaultConstructor <nl> / / CHECK - NEXT : init ( ) <nl> + / / CHECK - NEXT : init ( member : ImplicitDefaultConstructor ) <nl> / / CHECK - NEXT : } <nl> / / CHECK - NEXT : struct DefaultConstructorDeleted { <nl> / / CHECK - NEXT : } <nl> <nl> / / CHECK - NEXT : var x : Int32 <nl> / / CHECK - NEXT : init ( _ val : Int32 ) <nl> / / CHECK - NEXT : } <nl> + / / CHECK - NEXT : struct Base { <nl> + / / CHECK - NEXT : init ( ) <nl> + / / CHECK - NEXT : } <nl> + / / CHECK - NEXT : struct ArgType { <nl> + / / CHECK - NEXT : var i : Int32 <nl> + / / CHECK - NEXT : init ( ) <nl> + / / CHECK - NEXT : init ( i : Int32 ) <nl> + / / CHECK - NEXT : } <nl> + / / CHECK - NEXT : struct HasVirtualBase { <nl> + / / CHECK - NEXT : var i : Int32 <nl> + / / CHECK - NEXT : init ( _ Arg : ArgType ) <nl> + / / CHECK - NEXT : } <nl>
Add a constructor thunk if required to add additional constructor
apple/swift
b2c5a3eeed4e0d80c819f98c816481fbedc49526
2020-10-09T17:42:48Z
mmm a / hphp / runtime / vm / jit / vasm - util . cpp <nl> ppp b / hphp / runtime / vm / jit / vasm - util . cpp <nl> struct SSAConverter { <nl> void fillPhi ( Vlabel block , <nl> Vreg phi , <nl> Vreg pre , <nl> - const jit : : vector < Vlabel > & preds ) { <nl> + const PredVector : : value_type & preds ) { <nl> assertx ( block ! = unit . entry ) ; <nl> VregList phiInputs ; <nl> phiInputs . reserve ( preds . size ( ) ) ; <nl> mmm a / hphp / runtime / vm / jit / vasm - visit . h <nl> ppp b / hphp / runtime / vm / jit / vasm - visit . h <nl> struct PostorderWalker { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - using PredVector = jit : : vector < jit : : vector < Vlabel > > ; <nl> + using PredVector = jit : : vector < TinyVector < Vlabel , 3 > > ; <nl> PredVector computePreds ( const Vunit & unit ) ; <nl> <nl> } } <nl>
Speed up computePreds ( )
facebook/hhvm
75f003d5efefdf4b52f25cb0d19b0ebf19a13308
2019-10-19T23:27:23Z
mmm a / src / mongo / db / pipeline / document_source_change_stream . cpp <nl> ppp b / src / mongo / db / pipeline / document_source_change_stream . cpp <nl> void DocumentSourceChangeStream : : checkValueType ( const Value v , <nl> namespace { <nl> <nl> / * * <nl> - * Constructs a filter matching ' applyOps ' oplog entries that : <nl> - * 1 ) Represent a committed transaction ( i . e . , not just the " prepare " part of a two - phase <nl> - * transaction ) . <nl> - * 2 ) Have sub - entries which should be returned in the change stream . <nl> + * Constructs a filter matching any ' applyOps ' commands that commit a transaction . An ' applyOps ' <nl> + * command implicitly commits a transaction if _both_ of the following are true : <nl> + * 1 ) it is not marked with the ' partialTxn ' field , which would indicate that there are more entries <nl> + * to come in the transaction and <nl> + * 2 ) it is not marked with the ' prepare ' field , which would indicate that the transaction is only <nl> + * committed if there is a follow - up ' commitTransaction ' command in the oplog . <nl> + * <nl> + * This filter will ignore all but the last ' applyOps ' command in a transaction comprising multiple <nl> + * ' applyOps ' commands , and it will ignore all ' applyOps ' commands in a prepared transaction . The <nl> + * change stream traverses back through the oplog to recover the ignored commands when it sees an <nl> + * entry that commits a transaction . <nl> + * <nl> + * As an optimization , this filter also ignores any transaction with just a single ' applyOps ' if <nl> + * that ' applyOps ' does not contain any updates that modify the namespace that the change stream is <nl> + * watching . <nl> * / <nl> BSONObj getTxnApplyOpsFilter ( BSONElement nsMatch , const NamespaceString & nss ) { <nl> BSONObjBuilder applyOpsBuilder ; <nl> applyOpsBuilder . append ( " op " , " c " ) ; <nl> + <nl> + / / " o . applyOps " must be an array with at least one element <nl> + applyOpsBuilder . append ( " o . applyOps . 0 " , BSON ( " $ exists " < < true ) ) ; <nl> applyOpsBuilder . append ( " lsid " , BSON ( " $ exists " < < true ) ) ; <nl> applyOpsBuilder . append ( " txnNumber " , BSON ( " $ exists " < < true ) ) ; <nl> applyOpsBuilder . append ( " o . prepare " , BSON ( " $ not " < < BSON ( " $ eq " < < true ) ) ) ; <nl> - const std : : string & kApplyOpsNs = " o . applyOps . ns " ; <nl> - applyOpsBuilder . appendAs ( nsMatch , kApplyOpsNs ) ; <nl> + applyOpsBuilder . append ( " o . partialTxn " , BSON ( " $ not " < < BSON ( " $ eq " < < true ) ) ) ; <nl> + { <nl> + / / Include this ' applyOps ' if it has an operation with a matching namespace _or_ if it has a <nl> + / / ' prevOpTime ' link to another ' applyOps ' command , indicating a multi - entry transaction . <nl> + BSONArrayBuilder orBuilder ( applyOpsBuilder . subarrayStart ( " $ or " ) ) ; <nl> + { <nl> + { <nl> + BSONObjBuilder nsMatchBuilder ( orBuilder . subobjStart ( ) ) ; <nl> + nsMatchBuilder . appendAs ( nsMatch , " o . applyOps . ns " _sd ) ; <nl> + } <nl> + / / The default repl : : OpTime is the value used to indicate a null " prevOpTime " link . <nl> + orBuilder . append ( BSON ( repl : : OplogEntry : : kPrevWriteOpTimeInTransactionFieldName <nl> + < < BSON ( " $ ne " < < repl : : OpTime ( ) . toBSON ( ) ) ) ) ; <nl> + } <nl> + } <nl> return applyOpsBuilder . obj ( ) ; <nl> } <nl> } / / namespace <nl> mmm a / src / mongo / db / pipeline / document_source_change_stream_test . cpp <nl> ppp b / src / mongo / db / pipeline / document_source_change_stream_test . cpp <nl> <nl> # include " mongo / db / pipeline / value_comparator . h " <nl> # include " mongo / db / repl / oplog_entry . h " <nl> # include " mongo / db / repl / replication_coordinator_mock . h " <nl> + # include " mongo / db / transaction_history_iterator . h " <nl> # include " mongo / stdx / memory . h " <nl> # include " mongo / unittest / death_test . h " <nl> # include " mongo / unittest / unittest . h " <nl> using DSChangeStream = DocumentSourceChangeStream ; <nl> <nl> static const Timestamp kDefaultTs ( 100 , 1 ) ; <nl> static const repl : : OpTime kDefaultOpTime ( kDefaultTs , 1 ) ; <nl> - static const Timestamp kPreparedTransactionTs ( 99 , 1 ) ; <nl> - static const repl : : OpTime kPreparedTransactionOpTime ( kPreparedTransactionTs , 1 ) ; <nl> static const NamespaceString nss ( " unittests . change_stream " ) ; <nl> static const BSONObj kDefaultSpec = fromjson ( " { $ changeStream : { } } " ) ; <nl> <nl> class ChangeStreamStageTestNoSetup : public AggregationContextFixture { <nl> <nl> struct MockMongoInterface final : public StubMongoProcessInterface { <nl> <nl> + / / This mock iterator simulates a traversal of transaction history in the oplog by returning <nl> + / / mock oplog entries from a list . <nl> + struct MockTransactionHistoryIterator : public TransactionHistoryIteratorBase { <nl> + bool hasNext ( ) const final { <nl> + return ( mockEntriesIt ! = mockEntries . end ( ) ) ; <nl> + } <nl> + <nl> + repl : : OplogEntry next ( OperationContext * opCtx ) final { <nl> + ASSERT ( hasNext ( ) ) ; <nl> + return * ( mockEntriesIt + + ) ; <nl> + } <nl> + <nl> + repl : : OpTime nextOpTime ( OperationContext * opCtx ) final { <nl> + ASSERT ( hasNext ( ) ) ; <nl> + return ( mockEntriesIt + + ) - > getOpTime ( ) ; <nl> + } <nl> + <nl> + std : : vector < repl : : OplogEntry > mockEntries ; <nl> + std : : vector < repl : : OplogEntry > : : const_iterator mockEntriesIt ; <nl> + } ; <nl> + <nl> MockMongoInterface ( std : : vector < FieldPath > fields , <nl> - boost : : optional < repl : : OplogEntry > preparedTransaction = { } ) <nl> - : _fields ( std : : move ( fields ) ) , _preparedTransaction ( preparedTransaction ) { } <nl> - <nl> - / / For tests of " commitTransaction " commands . <nl> - repl : : OplogEntry lookUpOplogEntryByOpTime ( OperationContext * opCtx , <nl> - repl : : OpTime lookupTime ) final { <nl> - invariant ( _preparedTransaction & & ( lookupTime = = _preparedTransaction - > getOpTime ( ) ) ) ; <nl> - return * _preparedTransaction ; <nl> + std : : vector < repl : : OplogEntry > transactionEntries = { } ) <nl> + : _fields ( std : : move ( fields ) ) , _transactionEntries ( std : : move ( transactionEntries ) ) { } <nl> + <nl> + / / For tests of transactions that involve multiple oplog entries . <nl> + std : : unique_ptr < TransactionHistoryIteratorBase > createTransactionHistoryIterator ( <nl> + repl : : OpTime time ) const { <nl> + auto iterator = stdx : : make_unique < MockTransactionHistoryIterator > ( ) ; <nl> + <nl> + / / Simulate a lookup on the oplog timestamp by manually advancing the iterator until we <nl> + / / reach the desired timestamp . <nl> + iterator - > mockEntries = _transactionEntries ; <nl> + ASSERT ( iterator - > mockEntries . size ( ) > 0 ) ; <nl> + for ( iterator - > mockEntriesIt = iterator - > mockEntries . begin ( ) ; <nl> + iterator - > mockEntriesIt - > getOpTime ( ) ! = time ; <nl> + + + iterator - > mockEntriesIt ) { <nl> + ASSERT ( iterator - > mockEntriesIt ! = iterator - > mockEntries . end ( ) ) ; <nl> + } <nl> + <nl> + return iterator ; <nl> } <nl> <nl> / / For " insert " tests . <nl> struct MockMongoInterface final : public StubMongoProcessInterface { <nl> } <nl> <nl> std : : vector < FieldPath > _fields ; <nl> - boost : : optional < repl : : OplogEntry > _preparedTransaction ; <nl> + <nl> + / / Stores oplog entries associated with a commit operation , including the oplog entries that a <nl> + / / real DocumentSourceChangeStream would not see , because they are marked with a " prepare " or <nl> + / / " partialTxn " flag . When the DocumentSourceChangeStream sees the commit for the transaction , <nl> + / / either an explicit " commitCommand " or an implicit commit represented by an " applyOps " that is <nl> + / / not marked with the " prepare " or " partialTxn " flag , it uses a TransactionHistoryIterator to <nl> + / / go back and look up these entries . <nl> + / / <nl> + / / These entries are stored in the order they would be returned by the <nl> + / / TransactionHistoryIterator , which is the _reverse_ of the order they appear in the oplog . <nl> + std : : vector < repl : : OplogEntry > _transactionEntries ; <nl> } ; <nl> <nl> class ChangeStreamStageTest : public ChangeStreamStageTestNoSetup { <nl> class ChangeStreamStageTest : public ChangeStreamStageTestNoSetup { <nl> std : : vector < FieldPath > docKeyFields = { } , <nl> const BSONObj & spec = kDefaultSpec , <nl> const boost : : optional < Document > expectedInvalidate = { } , <nl> - const boost : : optional < repl : : OplogEntry > preparedTransaction = { } ) { <nl> + const std : : vector < repl : : OplogEntry > transactionEntries = { } ) { <nl> vector < intrusive_ptr < DocumentSource > > stages = makeStages ( entry . toBSON ( ) , spec ) ; <nl> auto closeCursor = stages . back ( ) ; <nl> <nl> getExpCtx ( ) - > mongoProcessInterface = <nl> - stdx : : make_unique < MockMongoInterface > ( docKeyFields , preparedTransaction ) ; <nl> + stdx : : make_unique < MockMongoInterface > ( docKeyFields , transactionEntries ) ; <nl> <nl> auto next = closeCursor - > getNext ( ) ; <nl> / / Match stage should pass the doc down if expectedDoc is given . <nl> class ChangeStreamStageTest : public ChangeStreamStageTestNoSetup { <nl> ImplicitValue uuid = Value ( ) , <nl> ImplicitValue docKey = Value ( ) , <nl> ResumeTokenData : : FromInvalidate fromInvalidate = <nl> - ResumeTokenData : : FromInvalidate : : kNotFromInvalidate ) { <nl> + ResumeTokenData : : FromInvalidate : : kNotFromInvalidate , <nl> + size_t txnOpIndex = 0 ) { <nl> ResumeTokenData tokenData ; <nl> tokenData . clusterTime = ts ; <nl> tokenData . documentKey = docKey ; <nl> tokenData . fromInvalidate = fromInvalidate ; <nl> + tokenData . txnOpIndex = txnOpIndex ; <nl> if ( ! uuid . missing ( ) ) <nl> tokenData . uuid = uuid . getUuid ( ) ; <nl> return ResumeToken ( tokenData ) . toDocument ( ) ; <nl> class ChangeStreamStageTest : public ChangeStreamStageTestNoSetup { <nl> boost : : optional < UUID > uuid = testUuid ( ) , <nl> boost : : optional < bool > fromMigrate = boost : : none , <nl> boost : : optional < BSONObj > object2 = boost : : none , <nl> - boost : : optional < repl : : OpTime > opTime = boost : : none ) { <nl> + boost : : optional < repl : : OpTime > opTime = boost : : none , <nl> + OperationSessionInfo sessionInfo = { } , <nl> + boost : : optional < repl : : OpTime > prevOpTime = { } ) { <nl> long long hash = 1LL ; <nl> return repl : : OplogEntry ( opTime ? * opTime : kDefaultOpTime , / / optime <nl> hash , / / hash <nl> class ChangeStreamStageTest : public ChangeStreamStageTestNoSetup { <nl> repl : : OplogEntry : : kOplogVersion , / / version <nl> object , / / o <nl> object2 , / / o2 <nl> - { } , / / sessionInfo <nl> + sessionInfo , / / sessionInfo <nl> boost : : none , / / upsert <nl> boost : : none , / / wall clock time <nl> boost : : none , / / statement id <nl> - boost : : none , / / optime of previous write within same transaction <nl> + prevOpTime , / / optime of previous write within same transaction <nl> boost : : none , / / pre - image optime <nl> boost : : none ) ; / / post - image optime <nl> } <nl> TEST_F ( ChangeStreamStageTest , CommitCommandReturnsOperationsFromPreparedTransact <nl> Document preparedApplyOps { <nl> { " applyOps " , <nl> Value { std : : vector < Document > { <nl> - Document { { " op " , " i " _sd } , <nl> - { " ns " , nss . ns ( ) } , <nl> - { " ui " , testUuid ( ) } , <nl> - { " o " , Value { Document { { " _id " , 123 } } } } } , <nl> + D { { " op " , " i " _sd } , { " ns " , nss . ns ( ) } , { " ui " , testUuid ( ) } , { " o " , V { D { { " _id " , 123 } } } } } , <nl> } } } , <nl> { " prepare " , true } , <nl> } ; <nl> <nl> + repl : : OpTime applyOpsOpTime ( Timestamp ( 99 , 1 ) , 1 ) ; <nl> auto preparedTransaction = makeOplogEntry ( OpTypeEnum : : kCommand , <nl> nss . getCommandNS ( ) , <nl> preparedApplyOps . toBson ( ) , <nl> testUuid ( ) , <nl> boost : : none , / / fromMigrate <nl> boost : : none , / / o2 field <nl> - kPreparedTransactionOpTime ) ; <nl> + applyOpsOpTime ) ; <nl> <nl> / / Create an oplog entry representing the commit for the prepared transaction . The commit has a <nl> / / ' prevWriteOpTimeInTransaction ' value that matches the ' preparedApplyOps ' entry , which the <nl> TEST_F ( ChangeStreamStageTest , CommitCommandReturnsOperationsFromPreparedTransact <nl> OperationSessionInfo sessionInfo ; <nl> sessionInfo . setTxnNumber ( 1 ) ; <nl> sessionInfo . setSessionId ( makeLogicalSessionIdForTest ( ) ) ; <nl> - auto oplogEntry = repl : : OplogEntry ( <nl> - kDefaultOpTime , / / optime <nl> - 1LL , / / hash <nl> - OpTypeEnum : : kCommand , / / opType <nl> - nss . getCommandNS ( ) , / / namespace <nl> - boost : : none , / / uuid <nl> - boost : : none , / / fromMigrate <nl> - repl : : OplogEntry : : kOplogVersion , / / version <nl> - BSON ( " commitTransaction " < < 1 ) , / / o <nl> - boost : : none , / / o2 <nl> - sessionInfo , / / sessionInfo <nl> - boost : : none , / / upsert <nl> - boost : : none , / / wall clock time <nl> - boost : : none , / / statement id <nl> - kPreparedTransactionOpTime , / / optime of previous write within same transaction <nl> - boost : : none , / / pre - image optime <nl> - boost : : none ) ; / / post - image optime <nl> + auto oplogEntry = <nl> + repl : : OplogEntry ( kDefaultOpTime , / / optime <nl> + 1LL , / / hash <nl> + OpTypeEnum : : kCommand , / / opType <nl> + nss . getCommandNS ( ) , / / namespace <nl> + boost : : none , / / uuid <nl> + boost : : none , / / fromMigrate <nl> + repl : : OplogEntry : : kOplogVersion , / / version <nl> + BSON ( " commitTransaction " < < 1 ) , / / o <nl> + boost : : none , / / o2 <nl> + sessionInfo , / / sessionInfo <nl> + boost : : none , / / upsert <nl> + boost : : none , / / wall clock time <nl> + boost : : none , / / statement id <nl> + applyOpsOpTime , / / optime of previous write within same transaction <nl> + boost : : none , / / pre - image optime <nl> + boost : : none ) ; / / post - image optime <nl> <nl> / / When the DocumentSourceChangeStreamTransform sees the " commitTransaction " oplog entry , we <nl> / / expect it to return the insert op within our ' preparedApplyOps ' oplog entry . <nl> TEST_F ( ChangeStreamStageTest , CommitCommandReturnsOperationsFromPreparedTransact <nl> { DSChangeStream : : kDocumentKeyField , D { } } , <nl> } ; <nl> <nl> - checkTransformation ( oplogEntry , expectedResult , { } , kDefaultSpec , { } , preparedTransaction ) ; <nl> + checkTransformation ( oplogEntry , expectedResult , { } , kDefaultSpec , { } , { preparedTransaction } ) ; <nl> + } <nl> + <nl> + TEST_F ( ChangeStreamStageTest , TransactionWithMultipleOplogEntries ) { <nl> + OperationSessionInfo sessionInfo ; <nl> + sessionInfo . setTxnNumber ( 1 ) ; <nl> + sessionInfo . setSessionId ( makeLogicalSessionIdForTest ( ) ) ; <nl> + <nl> + / / Create two applyOps entries that together represent a whole transaction . <nl> + repl : : OpTime applyOpsOpTime1 ( Timestamp ( 100 , 1 ) , 1 ) ; <nl> + Document applyOps1 { <nl> + { " applyOps " , <nl> + V { std : : vector < Document > { <nl> + D { { " op " , " i " _sd } , <nl> + { " ns " , nss . ns ( ) } , <nl> + { " ui " , testUuid ( ) } , <nl> + { " o " , V { Document { { " _id " , 123 } } } } } , <nl> + D { { " op " , " i " _sd } , <nl> + { " ns " , nss . ns ( ) } , <nl> + { " ui " , testUuid ( ) } , <nl> + { " o " , V { Document { { " _id " , 456 } } } } } , <nl> + } } } , <nl> + { " partialTxn " , true } , <nl> + } ; <nl> + <nl> + auto transactionEntry1 = makeOplogEntry ( OpTypeEnum : : kCommand , <nl> + nss . getCommandNS ( ) , <nl> + applyOps1 . toBson ( ) , <nl> + testUuid ( ) , <nl> + boost : : none , / / fromMigrate <nl> + boost : : none , / / o2 field <nl> + applyOpsOpTime1 , <nl> + sessionInfo , <nl> + repl : : OpTime ( ) ) ; <nl> + <nl> + repl : : OpTime applyOpsOpTime2 ( Timestamp ( 100 , 2 ) , 1 ) ; <nl> + Document applyOps2 { <nl> + { " applyOps " , <nl> + V { std : : vector < Document > { <nl> + D { { " op " , " i " _sd } , { " ns " , nss . ns ( ) } , { " ui " , testUuid ( ) } , { " o " , V { D { { " _id " , 789 } } } } } , <nl> + } } } , <nl> + / * The abscence of the " partialTxn " and " prepare " fields indicates that this command commits <nl> + the transaction . * / <nl> + } ; <nl> + <nl> + auto transactionEntry2 = makeOplogEntry ( OpTypeEnum : : kCommand , <nl> + nss . getCommandNS ( ) , <nl> + applyOps2 . toBson ( ) , <nl> + testUuid ( ) , <nl> + boost : : none , / / fromMigrate <nl> + boost : : none , / / o2 field <nl> + applyOpsOpTime2 , <nl> + sessionInfo , <nl> + applyOpsOpTime1 ) ; <nl> + <nl> + / / We do not use the checkTransformation ( ) pattern that other tests use since we expect multiple <nl> + / / documents to be returned from one applyOps . <nl> + auto stages = makeStages ( transactionEntry2 ) ; <nl> + auto transform = stages [ 2 ] . get ( ) ; <nl> + invariant ( dynamic_cast < DocumentSourceChangeStreamTransform * > ( transform ) ! = nullptr ) ; <nl> + <nl> + / / Populate the MockTransactionHistoryEditor in reverse chronological order . <nl> + getExpCtx ( ) - > mongoProcessInterface = stdx : : make_unique < MockMongoInterface > ( <nl> + std : : vector < FieldPath > { } , <nl> + std : : vector < repl : : OplogEntry > { transactionEntry2 , transactionEntry1 } ) ; <nl> + <nl> + / / We should get three documents from the change stream , based on the documents in the two <nl> + / / applyOps entries . <nl> + auto next = transform - > getNext ( ) ; <nl> + ASSERT ( next . isAdvanced ( ) ) ; <nl> + auto nextDoc = next . releaseDocument ( ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kTxnNumberField ] . getLong ( ) , * sessionInfo . getTxnNumber ( ) ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kOperationTypeField ] . getString ( ) , <nl> + DSChangeStream : : kInsertOpType ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kFullDocumentField ] [ " _id " ] . getInt ( ) , 123 ) ; <nl> + ASSERT_EQ ( <nl> + nextDoc [ " lsid " ] . getDocument ( ) . toBson ( ) . woCompare ( sessionInfo . getSessionId ( ) - > toBSON ( ) ) , 0 ) ; <nl> + auto resumeToken = ResumeToken : : parse ( nextDoc [ " _id " ] . getDocument ( ) ) . toDocument ( ) ; <nl> + ASSERT_DOCUMENT_EQ ( resumeToken , <nl> + makeResumeToken ( applyOpsOpTime2 . getTimestamp ( ) , <nl> + testUuid ( ) , <nl> + V { D { } } , <nl> + ResumeTokenData : : FromInvalidate : : kNotFromInvalidate , <nl> + 0 ) ) ; <nl> + <nl> + next = transform - > getNext ( ) ; <nl> + ASSERT ( next . isAdvanced ( ) ) ; <nl> + nextDoc = next . releaseDocument ( ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kTxnNumberField ] . getLong ( ) , * sessionInfo . getTxnNumber ( ) ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kOperationTypeField ] . getString ( ) , <nl> + DSChangeStream : : kInsertOpType ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kFullDocumentField ] [ " _id " ] . getInt ( ) , 456 ) ; <nl> + ASSERT_EQ ( <nl> + nextDoc [ " lsid " ] . getDocument ( ) . toBson ( ) . woCompare ( sessionInfo . getSessionId ( ) - > toBSON ( ) ) , 0 ) ; <nl> + resumeToken = ResumeToken : : parse ( nextDoc [ " _id " ] . getDocument ( ) ) . toDocument ( ) ; <nl> + ASSERT_DOCUMENT_EQ ( resumeToken , <nl> + makeResumeToken ( applyOpsOpTime2 . getTimestamp ( ) , <nl> + testUuid ( ) , <nl> + V { D { } } , <nl> + ResumeTokenData : : FromInvalidate : : kNotFromInvalidate , <nl> + 1 ) ) ; <nl> + <nl> + next = transform - > getNext ( ) ; <nl> + ASSERT ( next . isAdvanced ( ) ) ; <nl> + nextDoc = next . releaseDocument ( ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kTxnNumberField ] . getLong ( ) , * sessionInfo . getTxnNumber ( ) ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kOperationTypeField ] . getString ( ) , <nl> + DSChangeStream : : kInsertOpType ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kFullDocumentField ] [ " _id " ] . getInt ( ) , 789 ) ; <nl> + ASSERT_EQ ( <nl> + nextDoc [ " lsid " ] . getDocument ( ) . toBson ( ) . woCompare ( sessionInfo . getSessionId ( ) - > toBSON ( ) ) , 0 ) ; <nl> + resumeToken = ResumeToken : : parse ( nextDoc [ " _id " ] . getDocument ( ) ) . toDocument ( ) ; <nl> + ASSERT_DOCUMENT_EQ ( resumeToken , <nl> + makeResumeToken ( applyOpsOpTime2 . getTimestamp ( ) , <nl> + testUuid ( ) , <nl> + V { D { } } , <nl> + ResumeTokenData : : FromInvalidate : : kNotFromInvalidate , <nl> + 2 ) ) ; <nl> + } <nl> + <nl> + TEST_F ( ChangeStreamStageTest , PreparedTransactionWithMultipleOplogEntries ) { <nl> + OperationSessionInfo sessionInfo ; <nl> + sessionInfo . setTxnNumber ( 1 ) ; <nl> + sessionInfo . setSessionId ( makeLogicalSessionIdForTest ( ) ) ; <nl> + <nl> + / / Create two applyOps entries that together represent a whole transaction . <nl> + repl : : OpTime applyOpsOpTime1 ( Timestamp ( 99 , 1 ) , 1 ) ; <nl> + Document applyOps1 { <nl> + { " applyOps " , <nl> + V { std : : vector < Document > { <nl> + D { { " op " , " i " _sd } , { " ns " , nss . ns ( ) } , { " ui " , testUuid ( ) } , { " o " , V { D { { " _id " , 123 } } } } } , <nl> + D { { " op " , " i " _sd } , { " ns " , nss . ns ( ) } , { " ui " , testUuid ( ) } , { " o " , V { D { { " _id " , 456 } } } } } , <nl> + } } } , <nl> + { " partialTxn " , true } , <nl> + } ; <nl> + <nl> + auto transactionEntry1 = makeOplogEntry ( OpTypeEnum : : kCommand , <nl> + nss . getCommandNS ( ) , <nl> + applyOps1 . toBson ( ) , <nl> + testUuid ( ) , <nl> + boost : : none , / / fromMigrate <nl> + boost : : none , / / o2 field <nl> + applyOpsOpTime1 , <nl> + sessionInfo , <nl> + repl : : OpTime ( ) ) ; <nl> + <nl> + repl : : OpTime applyOpsOpTime2 ( Timestamp ( 99 , 2 ) , 1 ) ; <nl> + Document applyOps2 { <nl> + { " applyOps " , <nl> + V { std : : vector < Document > { <nl> + D { { " op " , " i " _sd } , { " ns " , nss . ns ( ) } , { " ui " , testUuid ( ) } , { " o " , V { D { { " _id " , 789 } } } } } , <nl> + } } } , <nl> + { " prepare " , true } , <nl> + } ; <nl> + <nl> + auto transactionEntry2 = makeOplogEntry ( OpTypeEnum : : kCommand , <nl> + nss . getCommandNS ( ) , <nl> + applyOps2 . toBson ( ) , <nl> + testUuid ( ) , <nl> + boost : : none , / / fromMigrate <nl> + boost : : none , / / o2 field <nl> + applyOpsOpTime2 , <nl> + sessionInfo , <nl> + applyOpsOpTime1 ) ; <nl> + <nl> + / / Create an oplog entry representing the commit for the prepared transaction . <nl> + auto commitEntry = <nl> + repl : : OplogEntry ( kDefaultOpTime , / / optime <nl> + 1LL , / / hash <nl> + OpTypeEnum : : kCommand , / / opType <nl> + nss . getCommandNS ( ) , / / namespace <nl> + boost : : none , / / uuid <nl> + boost : : none , / / fromMigrate <nl> + repl : : OplogEntry : : kOplogVersion , / / version <nl> + BSON ( " commitTransaction " < < 1 ) , / / o <nl> + boost : : none , / / o2 <nl> + sessionInfo , / / sessionInfo <nl> + boost : : none , / / upsert <nl> + boost : : none , / / wall clock time <nl> + boost : : none , / / statement id <nl> + applyOpsOpTime2 , / / optime of previous write within same transaction <nl> + boost : : none , / / pre - image optime <nl> + boost : : none ) ; / / post - image optime <nl> + <nl> + / / We do not use the checkTransformation ( ) pattern that other tests use since we expect multiple <nl> + / / documents to be returned from one applyOps . <nl> + auto stages = makeStages ( commitEntry ) ; <nl> + auto transform = stages [ 2 ] . get ( ) ; <nl> + invariant ( dynamic_cast < DocumentSourceChangeStreamTransform * > ( transform ) ! = nullptr ) ; <nl> + <nl> + / / Populate the MockTransactionHistoryEditor in reverse chronological order . <nl> + getExpCtx ( ) - > mongoProcessInterface = stdx : : make_unique < MockMongoInterface > ( <nl> + std : : vector < FieldPath > { } , <nl> + std : : vector < repl : : OplogEntry > { commitEntry , transactionEntry2 , transactionEntry1 } ) ; <nl> + <nl> + / / We should get three documents from the change stream , based on the documents in the two <nl> + / / applyOps entries . <nl> + auto next = transform - > getNext ( ) ; <nl> + ASSERT ( next . isAdvanced ( ) ) ; <nl> + auto nextDoc = next . releaseDocument ( ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kTxnNumberField ] . getLong ( ) , * sessionInfo . getTxnNumber ( ) ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kOperationTypeField ] . getString ( ) , <nl> + DSChangeStream : : kInsertOpType ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kFullDocumentField ] [ " _id " ] . getInt ( ) , 123 ) ; <nl> + ASSERT_EQ ( <nl> + nextDoc [ " lsid " ] . getDocument ( ) . toBson ( ) . woCompare ( sessionInfo . getSessionId ( ) - > toBSON ( ) ) , 0 ) ; <nl> + auto resumeToken = ResumeToken : : parse ( nextDoc [ " _id " ] . getDocument ( ) ) . toDocument ( ) ; <nl> + ASSERT_DOCUMENT_EQ ( <nl> + resumeToken , <nl> + makeResumeToken ( kDefaultOpTime . getTimestamp ( ) , / / Timestamp of the commitCommand . <nl> + testUuid ( ) , <nl> + V { D { } } , <nl> + ResumeTokenData : : FromInvalidate : : kNotFromInvalidate , <nl> + 0 ) ) ; <nl> + <nl> + next = transform - > getNext ( ) ; <nl> + ASSERT ( next . isAdvanced ( ) ) ; <nl> + nextDoc = next . releaseDocument ( ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kTxnNumberField ] . getLong ( ) , * sessionInfo . getTxnNumber ( ) ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kOperationTypeField ] . getString ( ) , <nl> + DSChangeStream : : kInsertOpType ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kFullDocumentField ] [ " _id " ] . getInt ( ) , 456 ) ; <nl> + ASSERT_EQ ( <nl> + nextDoc [ " lsid " ] . getDocument ( ) . toBson ( ) . woCompare ( sessionInfo . getSessionId ( ) - > toBSON ( ) ) , 0 ) ; <nl> + resumeToken = ResumeToken : : parse ( nextDoc [ " _id " ] . getDocument ( ) ) . toDocument ( ) ; <nl> + ASSERT_DOCUMENT_EQ ( <nl> + resumeToken , <nl> + makeResumeToken ( kDefaultOpTime . getTimestamp ( ) , / / Timestamp of the commitCommand . <nl> + testUuid ( ) , <nl> + V { D { } } , <nl> + ResumeTokenData : : FromInvalidate : : kNotFromInvalidate , <nl> + 1 ) ) ; <nl> + <nl> + next = transform - > getNext ( ) ; <nl> + ASSERT ( next . isAdvanced ( ) ) ; <nl> + nextDoc = next . releaseDocument ( ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kTxnNumberField ] . getLong ( ) , * sessionInfo . getTxnNumber ( ) ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kOperationTypeField ] . getString ( ) , <nl> + DSChangeStream : : kInsertOpType ) ; <nl> + ASSERT_EQ ( nextDoc [ DSChangeStream : : kFullDocumentField ] [ " _id " ] . getInt ( ) , 789 ) ; <nl> + ASSERT_EQ ( <nl> + nextDoc [ " lsid " ] . getDocument ( ) . toBson ( ) . woCompare ( sessionInfo . getSessionId ( ) - > toBSON ( ) ) , 0 ) ; <nl> + resumeToken = ResumeToken : : parse ( nextDoc [ " _id " ] . getDocument ( ) ) . toDocument ( ) ; <nl> + ASSERT_DOCUMENT_EQ ( <nl> + resumeToken , <nl> + makeResumeToken ( kDefaultOpTime . getTimestamp ( ) , / / Timestamp of the commitCommand . <nl> + testUuid ( ) , <nl> + V { D { } } , <nl> + ResumeTokenData : : FromInvalidate : : kNotFromInvalidate , <nl> + 2 ) ) ; <nl> } <nl> <nl> TEST_F ( ChangeStreamStageTest , TransformApplyOps ) { <nl> mmm a / src / mongo / db / pipeline / document_source_change_stream_transform . cpp <nl> ppp b / src / mongo / db / pipeline / document_source_change_stream_transform . cpp <nl> ResumeTokenData DocumentSourceChangeStreamTransform : : getResumeToken ( Value ts , <nl> Value uuid , <nl> Value documentKey ) { <nl> ResumeTokenData resumeTokenData ; <nl> - if ( _txnContext ) { <nl> + if ( _txnIterator ) { <nl> / / We ' re in the middle of unwinding an ' applyOps ' . <nl> <nl> / / Use the clusterTime from the higher level applyOps <nl> - resumeTokenData . clusterTime = _txnContext - > clusterTime ; <nl> - <nl> - / / ' pos ' points to the _next_ applyOps index , so we must subtract one to get the index of <nl> - / / the entry being examined right now . <nl> - invariant ( _txnContext - > pos > = 1 ) ; <nl> - resumeTokenData . applyOpsIndex = _txnContext - > pos - 1 ; <nl> + resumeTokenData . clusterTime = _txnIterator - > clusterTime ( ) ; <nl> + resumeTokenData . txnOpIndex = _txnIterator - > txnOpIndex ( ) ; <nl> } else { <nl> resumeTokenData . clusterTime = ts . getTimestamp ( ) ; <nl> - resumeTokenData . applyOpsIndex = 0 ; <nl> + resumeTokenData . txnOpIndex = 0 ; <nl> } <nl> <nl> resumeTokenData . documentKey = documentKey ; <nl> Document DocumentSourceChangeStreamTransform : : applyTransformation ( const Document <nl> auto resumeToken = ResumeToken ( resumeTokenData ) . toDocument ( ) ; <nl> <nl> / / Add some additional fields only relevant to transactions . <nl> - if ( _txnContext ) { <nl> + if ( _txnIterator ) { <nl> doc . addField ( DocumentSourceChangeStream : : kTxnNumberField , <nl> - Value ( static_cast < long long > ( _txnContext - > txnNumber ) ) ) ; <nl> - doc . addField ( DocumentSourceChangeStream : : kLsidField , Value ( _txnContext - > lsid ) ) ; <nl> + Value ( static_cast < long long > ( _txnIterator - > txnNumber ( ) ) ) ) ; <nl> + doc . addField ( DocumentSourceChangeStream : : kLsidField , Value ( _txnIterator - > lsid ( ) ) ) ; <nl> } <nl> <nl> doc . addField ( DocumentSourceChangeStream : : kIdField , Value ( resumeToken ) ) ; <nl> DocumentSource : : GetModPathsReturn DocumentSourceChangeStreamTransform : : getModifi <nl> return { DocumentSource : : GetModPathsReturn : : Type : : kAllPaths , std : : set < string > { } , { } } ; <nl> } <nl> <nl> - void DocumentSourceChangeStreamTransform : : initializeTransactionContext ( const Document & input ) { <nl> - / / The only two commands we will see here are an applyOps or a commit , which both mean we <nl> - / / need to open a " transaction context " representing a group of updates that all occurred at <nl> - / / once as part of a transaction . If we already have a transaction context open , that would <nl> - / / mean we are looking at an applyOps or commit nested within an applyOps , which is not <nl> - / / allowed in the oplog . <nl> - invariant ( ! _txnContext ) ; <nl> - <nl> - Value lsid = input [ " lsid " ] ; <nl> - checkValueType ( lsid , " lsid " , BSONType : : Object ) ; <nl> - <nl> - Value txnNumber = input [ " txnNumber " ] ; <nl> - checkValueType ( txnNumber , " txnNumber " , BSONType : : NumberLong ) ; <nl> - <nl> - Value ts = input [ repl : : OplogEntry : : kTimestampFieldName ] ; <nl> - Timestamp txnApplyTime = ts . getTimestamp ( ) ; <nl> - <nl> - auto commandObj = input [ " o " ] . getDocument ( ) ; <nl> - Value applyOps = commandObj [ " applyOps " ] ; <nl> - if ( ! applyOps . missing ( ) ) { <nl> - / / An " applyOps " command represents an immediately - committed transaction . We place the <nl> - / / operations within the " applyOps " array directly into the transaction context . <nl> - applyOps = input . getNestedField ( " o . applyOps " ) ; <nl> - } else { <nl> - invariant ( ! commandObj [ " commitTransaction " ] . missing ( ) ) ; <nl> - <nl> - / / A " commit " command is the second part of a transaction that has been split up into <nl> - / / two oplog entries . The lsid , txnNumber , and timestamp are in this entry , but the <nl> - / / " applyOps " array is in a previous entry , which we must look up . <nl> - repl : : OpTime opTime ; <nl> - uassertStatusOK ( bsonExtractOpTimeField ( input . toBson ( ) , " prevOpTime " , & opTime ) ) ; <nl> - <nl> - auto applyOpsEntry = <nl> - pExpCtx - > mongoProcessInterface - > lookUpOplogEntryByOpTime ( pExpCtx - > opCtx , opTime ) ; <nl> - invariant ( applyOpsEntry . isCommand ( ) & & <nl> - ( repl : : OplogEntry : : CommandType : : kApplyOps = = applyOpsEntry . getCommandType ( ) ) ) ; <nl> - invariant ( applyOpsEntry . shouldPrepare ( ) ) ; <nl> - <nl> - auto bsonOp = applyOpsEntry . getOperationToApply ( ) ; <nl> - invariant ( BSONType : : Array = = bsonOp [ " applyOps " ] . type ( ) ) ; <nl> - applyOps = Value ( bsonOp [ " applyOps " ] ) ; <nl> - } <nl> - <nl> - checkValueType ( applyOps , " applyOps " , BSONType : : Array ) ; <nl> - invariant ( applyOps . getArrayLength ( ) > 0 ) ; <nl> - <nl> - _txnContext . emplace ( applyOps , txnApplyTime , lsid . getDocument ( ) , txnNumber . getLong ( ) ) ; <nl> - } <nl> - <nl> DocumentSource : : GetNextResult DocumentSourceChangeStreamTransform : : getNext ( ) { <nl> pExpCtx - > checkForInterrupt ( ) ; <nl> <nl> DocumentSource : : GetNextResult DocumentSourceChangeStreamTransform : : getNext ( ) { <nl> while ( 1 ) { <nl> / / If we ' re unwinding an ' applyOps ' from a transaction , check if there are any documents we <nl> / / have stored that can be returned . <nl> - if ( _txnContext ) { <nl> - if ( auto next = extractNextApplyOpsEntry ( ) ) { <nl> + if ( _txnIterator ) { <nl> + if ( auto next = _txnIterator - > getNextTransactionOp ( pExpCtx - > opCtx ) ) { <nl> return applyTransformation ( * next ) ; <nl> } <nl> + _txnIterator = boost : : none ; <nl> } <nl> <nl> / / Get the next input document . <nl> DocumentSource : : GetNextResult DocumentSourceChangeStreamTransform : : getNext ( ) { <nl> return applyTransformation ( doc ) ; <nl> } <nl> <nl> - initializeTransactionContext ( doc ) ; <nl> + / / The only two commands we will see here are an applyOps or a commit , which both mean we <nl> + / / need to open a " transaction context " representing a group of updates that all occurred at <nl> + / / once as part of a transaction . If we already have a transaction context open , that would <nl> + / / mean we are looking at an applyOps or commit nested within an applyOps , which is not <nl> + / / allowed in the oplog . <nl> + invariant ( ! _txnIterator ) ; <nl> + _txnIterator . emplace ( pExpCtx - > opCtx , pExpCtx - > mongoProcessInterface , doc , * _nsRegex ) ; <nl> + <nl> + / / Once we initialize the transaction iterator , we can loop back to the top in order to call <nl> + / / ' getNextTransactionOp ' on it . Note that is possible for the transaction iterator <nl> + / / to be empty of any relevant operations , meaning that this loop may need to execute <nl> + / / multiple times before it encounters a relevant change to return . <nl> + } <nl> + } <nl> + <nl> + DocumentSourceChangeStreamTransform : : TransactionOpIterator : : TransactionOpIterator ( <nl> + OperationContext * opCtx , <nl> + std : : shared_ptr < MongoProcessInterface > mongoProcessInterface , <nl> + const Document & input , <nl> + const pcrecpp : : RE & nsRegex ) <nl> + : _mongoProcessInterface ( mongoProcessInterface ) , _nsRegex ( nsRegex ) { <nl> + Value lsidValue = input [ " lsid " ] ; <nl> + checkValueType ( lsidValue , " lsid " , BSONType : : Object ) ; <nl> + _lsid = lsidValue . getDocument ( ) ; <nl> + <nl> + Value txnNumberValue = input [ " txnNumber " ] ; <nl> + checkValueType ( txnNumberValue , " txnNumber " , BSONType : : NumberLong ) ; <nl> + _txnNumber = txnNumberValue . getLong ( ) ; <nl> + <nl> + / / We want to parse the OpTime out of this document using the BSON OpTime parser . Instead of <nl> + / / converting the entire Document back to BSON , we convert only the fields we need . <nl> + repl : : OpTime txnOpTime = repl : : OpTime : : parse ( BSON ( repl : : OpTime : : kTimestampFieldName <nl> + < < input [ repl : : OpTime : : kTimestampFieldName ] <nl> + < < repl : : OpTime : : kTermFieldName <nl> + < < input [ repl : : OpTime : : kTermFieldName ] ) ) ; <nl> + _clusterTime = txnOpTime . getTimestamp ( ) ; <nl> + <nl> + auto commandObj = input [ " o " ] . getDocument ( ) ; <nl> + Value applyOps = commandObj [ " applyOps " ] ; <nl> + <nl> + if ( ! applyOps . missing ( ) ) { <nl> + / / We found an applyOps that implicitly commits a transaction . We include it in the <nl> + / / ' _txnOplogEntries ' stack of applyOps entries that the change stream should process as <nl> + / / part of this transaction . There may be additional applyOps entries linked through the <nl> + / / ' prevOpTime ' field , which will also get added to ' _txnOplogEntries ' later in this <nl> + / / function . Note that this style of transaction does not have a ' commitTransaction ' <nl> + / / command . <nl> + _txnOplogEntries . push ( txnOpTime ) ; <nl> + } else { <nl> + / / This must be a " commitTransaction " command , which commits a prepared transaction . This <nl> + / / style of transaction does not have an applyOps entry that implicitly commits it , as in <nl> + / / the previous case . We ' re going to iterate through the other oplog entries in the <nl> + / / transaction , but this entry does not have any updates in it , so we do not include it in <nl> + / / the ' _txnOplogEntries ' stack . <nl> + invariant ( ! commandObj [ " commitTransaction " ] . missing ( ) ) ; <nl> + } <nl> <nl> - / / Once we initialize the transaction context , we can loop back to the top in order to call <nl> - / / ' extractNextApplyOpsEntry ' on it . Note that is possible for the transaction context to be <nl> - / / empty of any relevant operations , meaning that this loop may need to execute multiple <nl> - / / times before it encounters a relevant change to return . <nl> + if ( BSONType : : Object = = <nl> + input [ repl : : OplogEntry : : kPrevWriteOpTimeInTransactionFieldName ] . getType ( ) ) { <nl> + / / As with the ' txnOpTime ' parsing above , we convert a portion of ' input ' back to BSON in <nl> + / / order to parse an OpTime , this time from the " prevOpTime " field . <nl> + repl : : OpTime prevOpTime = repl : : OpTime : : parse ( <nl> + input [ repl : : OplogEntry : : kPrevWriteOpTimeInTransactionFieldName ] . getDocument ( ) . toBson ( ) ) ; <nl> + _collectAllOpTimesFromTransaction ( opCtx , prevOpTime ) ; <nl> } <nl> + <nl> + / / Pop the first OpTime off the stack and use it to load the first oplog entry into the <nl> + / / ' _currentApplyOps ' field . <nl> + invariant ( _txnOplogEntries . size ( ) > 0 ) ; <nl> + const auto firstTimestamp = _txnOplogEntries . top ( ) ; <nl> + _txnOplogEntries . pop ( ) ; <nl> + <nl> + if ( firstTimestamp = = txnOpTime ) { <nl> + / / This transaction consists of only one oplog entry , from which we have already extracted <nl> + / / the " applyOps " array , so there is no need to do any more work . <nl> + invariant ( _txnOplogEntries . size ( ) = = 0 ) ; <nl> + _currentApplyOps = std : : move ( applyOps ) ; <nl> + } else { <nl> + / / This transaction consists of multiple oplog entries ; grab the chronologically first entry <nl> + / / and extract its " applyOps " array . <nl> + auto firstApplyOpsEntry = _lookUpOplogEntryByOpTime ( opCtx , firstTimestamp ) ; <nl> + <nl> + auto bsonOp = firstApplyOpsEntry . getOperationToApply ( ) ; <nl> + invariant ( BSONType : : Array = = bsonOp [ " applyOps " ] . type ( ) ) ; <nl> + _currentApplyOps = Value ( bsonOp [ " applyOps " ] ) ; <nl> + } <nl> + <nl> + checkValueType ( _currentApplyOps , " applyOps " , BSONType : : Array ) ; <nl> + invariant ( _currentApplyOps . getArrayLength ( ) > 0 ) ; <nl> + <nl> + / / Initialize iterators at the beginning of the transaction . <nl> + _currentApplyOpsIt = _currentApplyOps . getArray ( ) . begin ( ) ; <nl> + _txnOpIndex = 0 ; <nl> } <nl> <nl> - bool DocumentSourceChangeStreamTransform : : isDocumentRelevant ( const Document & d ) { <nl> + bool DocumentSourceChangeStreamTransform : : TransactionOpIterator : : _isDocumentRelevant ( <nl> + const Document & d ) const { <nl> invariant ( <nl> d [ " op " ] . getType ( ) = = BSONType : : String , <nl> str : : stream ( ) <nl> bool DocumentSourceChangeStreamTransform : : isDocumentRelevant ( const Document & d ) <nl> Value nsField = d [ " ns " ] ; <nl> invariant ( ! nsField . missing ( ) ) ; <nl> <nl> - return _nsRegex - > PartialMatch ( nsField . getString ( ) ) ; <nl> + return _nsRegex . PartialMatch ( nsField . getString ( ) ) ; <nl> } <nl> <nl> - boost : : optional < Document > DocumentSourceChangeStreamTransform : : extractNextApplyOpsEntry ( ) { <nl> + boost : : optional < Document > <nl> + DocumentSourceChangeStreamTransform : : TransactionOpIterator : : getNextTransactionOp ( <nl> + OperationContext * opCtx ) { <nl> + while ( true ) { <nl> + while ( _currentApplyOpsIt ! = _currentApplyOps . getArray ( ) . end ( ) ) { <nl> + Document d = ( _currentApplyOpsIt + + ) - > getDocument ( ) ; <nl> + + + _txnOpIndex ; <nl> + if ( _isDocumentRelevant ( d ) ) { <nl> + return d ; <nl> + } <nl> + } <nl> <nl> - while ( _txnContext & & _txnContext - > pos < _txnContext - > arr . size ( ) ) { <nl> - Document d = _txnContext - > arr [ _txnContext - > pos + + ] . getDocument ( ) ; <nl> - if ( isDocumentRelevant ( d ) ) { <nl> - return d ; <nl> + if ( _txnOplogEntries . empty ( ) ) { <nl> + / / There are no more operations in this transaction . <nl> + return boost : : none ; <nl> } <nl> + <nl> + / / We ' ve processed all the operations in the previous applyOps entry , but we have a new one <nl> + / / to process . <nl> + auto applyOpsEntry = _lookUpOplogEntryByOpTime ( opCtx , _txnOplogEntries . top ( ) ) ; <nl> + _txnOplogEntries . pop ( ) ; <nl> + <nl> + auto bsonOp = applyOpsEntry . getOperationToApply ( ) ; <nl> + invariant ( BSONType : : Array = = bsonOp [ " applyOps " ] . type ( ) ) ; <nl> + <nl> + _currentApplyOps = Value ( bsonOp [ " applyOps " ] ) ; <nl> + _currentApplyOpsIt = _currentApplyOps . getArray ( ) . begin ( ) ; <nl> } <nl> + } <nl> + <nl> + repl : : OplogEntry <nl> + DocumentSourceChangeStreamTransform : : TransactionOpIterator : : _lookUpOplogEntryByOpTime ( <nl> + OperationContext * opCtx , repl : : OpTime lookupTime ) const { <nl> + invariant ( ! lookupTime . isNull ( ) ) ; <nl> + <nl> + std : : unique_ptr < TransactionHistoryIteratorBase > iterator ( <nl> + _mongoProcessInterface - > createTransactionHistoryIterator ( lookupTime ) ) ; <nl> + try { <nl> + return iterator - > next ( opCtx ) ; <nl> + } catch ( ExceptionFor < ErrorCodes : : IncompleteTransactionHistory > & ex ) { <nl> + ex . addContext ( <nl> + " Oplog no longer has history necessary for $ changeStream to observe operations from a " <nl> + " committed transaction . " ) ; <nl> + uasserted ( ErrorCodes : : ChangeStreamHistoryLost , ex . reason ( ) ) ; <nl> + } <nl> + } <nl> <nl> - _txnContext = boost : : none ; <nl> + void DocumentSourceChangeStreamTransform : : TransactionOpIterator : : _collectAllOpTimesFromTransaction ( <nl> + OperationContext * opCtx , repl : : OpTime firstOpTime ) { <nl> + std : : unique_ptr < TransactionHistoryIteratorBase > iterator ( <nl> + _mongoProcessInterface - > createTransactionHistoryIterator ( firstOpTime ) ) ; <nl> <nl> - return boost : : none ; <nl> + try { <nl> + while ( iterator - > hasNext ( ) ) { <nl> + _txnOplogEntries . push ( iterator - > nextOpTime ( opCtx ) ) ; <nl> + } <nl> + } catch ( ExceptionFor < ErrorCodes : : IncompleteTransactionHistory > & ex ) { <nl> + ex . addContext ( <nl> + " Oplog no longer has history necessary for $ changeStream to observe operations from a " <nl> + " committed transaction . " ) ; <nl> + uasserted ( ErrorCodes : : ChangeStreamHistoryLost , ex . reason ( ) ) ; <nl> + } <nl> } <nl> <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / pipeline / document_source_change_stream_transform . h <nl> ppp b / src / mongo / db / pipeline / document_source_change_stream_transform . h <nl> class DocumentSourceChangeStreamTransform : public DocumentSource { <nl> } ; <nl> <nl> / * * <nl> - * Represents the DocumentSource ' s state if it ' s currently reading from an ' applyOps ' entry <nl> - * which was created as part of a transaction . <nl> + * Represents the DocumentSource ' s state if it ' s currently reading from a transaction . <nl> + * Transaction operations are packed into ' applyOps ' entries in the oplog . <nl> + * <nl> + * This iterator returns operations from a transaction that are relevant to the change stream in <nl> + * the same order they appear on the oplog ( chronological order ) . Note that the <nl> + * TransactionHistoryIterator , which this class uses to query the oplog , returns the oplog <nl> + * entries in _reverse_ order . We internally reverse the output of the <nl> + * TransactionHistoryIterator in order to get the desired order . <nl> + * <nl> + * Note that our view of a transaction in the oplog is like an array of arrays with an " outer " <nl> + * array of applyOps entries represented by the ' txnOplogEntries ' field and " inner " arrays of <nl> + * applyOps entries . Each applyOps entry gets loaded on demand , with only a single applyOps <nl> + * loaded into ' _applyOpsValue ' and ' _currentApplyOps ' at any time . <nl> + * <nl> + * Likewise , there are " outer " and " inner " iterators , ' txnOplogEntriesIt ' and <nl> + * ' _currentApplyOpsIt ' respectively , that together reference the current transaction operation . <nl> * / <nl> - struct TransactionContext { <nl> - TransactionContext ( const TransactionContext & ) = delete ; <nl> - TransactionContext & operator = ( const TransactionContext & ) = delete ; <nl> - <nl> - / / The array of oplog entries from an ' applyOps ' representing the transaction . Only kept <nl> - / / around so that the underlying memory of ' arr ' isn ' t freed . <nl> - Value opArray ; <nl> - <nl> - / / Array representation of the ' opArray ' field . Stored like this to avoid re - typechecking <nl> - / / each call to next ( ) , or copying the entire array . <nl> - const std : : vector < Value > & arr ; <nl> - <nl> - / / Our current place in the ' opArray ' . <nl> - size_t pos ; <nl> - <nl> - / / The clusterTime of the applyOps . <nl> - Timestamp clusterTime ; <nl> - <nl> - / / Fields that were taken from the ' applyOps ' oplog entry . <nl> - Document lsid ; <nl> - TxnNumber txnNumber ; <nl> - <nl> - TransactionContext ( const Value & applyOpsVal , <nl> - Timestamp ts , <nl> - const Document & lsidDoc , <nl> - TxnNumber n ) <nl> - : opArray ( applyOpsVal ) , <nl> - arr ( opArray . getArray ( ) ) , <nl> - pos ( 0 ) , <nl> - clusterTime ( ts ) , <nl> - lsid ( lsidDoc ) , <nl> - txnNumber ( n ) { } <nl> + class TransactionOpIterator { <nl> + public : <nl> + TransactionOpIterator ( const TransactionOpIterator & ) = delete ; <nl> + TransactionOpIterator & operator = ( const TransactionOpIterator & ) = delete ; <nl> + <nl> + TransactionOpIterator ( OperationContext * opCtx , <nl> + std : : shared_ptr < MongoProcessInterface > mongoProcessInterface , <nl> + const Document & input , <nl> + const pcrecpp : : RE & nsRegex ) ; <nl> + <nl> + / / Returns the index for the last operation returned by getNextTransactionOp ( ) . It is <nl> + / / illegal to call this before calling getNextTransactionOp ( ) at least once . <nl> + size_t txnOpIndex ( ) const { <nl> + / / ' txnOpIndex ' points to the _next_ transaction index , so we must subtract one to get <nl> + / / the index of the entry being examined right now . <nl> + invariant ( _txnOpIndex > = 1 ) ; <nl> + return _txnOpIndex - 1 ; <nl> + } <nl> + <nl> + Timestamp clusterTime ( ) const { <nl> + return _clusterTime ; <nl> + } <nl> + <nl> + Document lsid ( ) const { <nl> + return _lsid ; <nl> + } <nl> + <nl> + TxnNumber txnNumber ( ) const { <nl> + return _txnNumber ; <nl> + } <nl> + <nl> + / / Extract one Document from the transaction and advance the iterator . Returns boost : : none <nl> + / / to indicate that there are no operations left . <nl> + boost : : optional < Document > getNextTransactionOp ( OperationContext * opCtx ) ; <nl> + <nl> + private : <nl> + / / Perform a find on the oplog to find an OplogEntry by its OpTime . <nl> + repl : : OplogEntry _lookUpOplogEntryByOpTime ( OperationContext * opCtx , <nl> + repl : : OpTime lookupTime ) const ; <nl> + <nl> + / / Helper for getNextTransactionOp ( ) . Checks the namespace of the given document to see if <nl> + / / it should be returned in the change stream . <nl> + bool _isDocumentRelevant ( const Document & d ) const ; <nl> + <nl> + / / Traverse backwards through the oplog by starting at the entry at ' firstOpTime ' and <nl> + / / following " prevOpTime " links until reaching the terminal " prevOpTime " value , and push the <nl> + / / OpTime value to ' _txnOplogEntries ' for each entry traversed , including the ' firstOpTime ' <nl> + / / entry . Note that we follow the oplog links _backwards_ through the oplog ( i . e . , in <nl> + / / reverse chronological order ) but because this is a stack , the iterator will process them <nl> + / / in the opposite order , allowing iteration to proceed fowards and return operations in <nl> + / / chronological order . <nl> + void _collectAllOpTimesFromTransaction ( OperationContext * opCtx , repl : : OpTime firstOpTime ) ; <nl> + <nl> + / / This stack contains the timestamps for all oplog entries in this transaction that have <nl> + / / yet to be processed by the iterator . Each time the TransactionOpIterator finishes <nl> + / / iterating the contents of the ' _currentApplyOps ' array , it pops an entry off the stack <nl> + / / and uses it to load the next applyOps entry in the ' _currentApplyOps ' array , meaning that <nl> + / / the top entry is always the next entry to be processed . From top - to - bottom , the stack is <nl> + / / ordered chronologically , in the same order as entries appear in the oplog . <nl> + std : : stack < repl : : OpTime > _txnOplogEntries ; <nl> + <nl> + / / The ' _currentapplyOps ' stores the applyOps array that the TransactionOpIterator is <nl> + / / currently iterating . <nl> + Value _currentApplyOps ; <nl> + <nl> + / / This iterator references the next operation within the ' _currentApplyOps ' array that the <nl> + / / the getNextTransactionOp ( ) method will return . When there are no more operations to <nl> + / / iterate , this iterator will point to the array ' s " end " sentinel , and ' _txnOplogEntries ' <nl> + / / will be empty . <nl> + typename std : : vector < Value > : : const_iterator _currentApplyOpsIt ; <nl> + <nl> + / / Our current place within the entire transaction , which may consist of multiple ' applyOps ' <nl> + / / arrays . <nl> + size_t _txnOpIndex ; <nl> + <nl> + / / The clusterTime of the _applyOps . <nl> + Timestamp _clusterTime ; <nl> + <nl> + / / Fields that were taken from the ' _applyOps ' oplog entry . <nl> + Document _lsid ; <nl> + TxnNumber _txnNumber ; <nl> + <nl> + / / Used for traversing the oplog with TransactionHistoryInterface . <nl> + std : : shared_ptr < MongoProcessInterface > _mongoProcessInterface ; <nl> + <nl> + / / An operation is relevant to a change stream iff its namespace matches this regex . <nl> + const pcrecpp : : RE & _nsRegex ; <nl> } ; <nl> <nl> / * * <nl> * Helper used for determining what resume token to return . <nl> * / <nl> ResumeTokenData getResumeToken ( Value ts , Value uuid , Value documentKey ) ; <nl> - void initializeTransactionContext ( const Document & input ) ; <nl> - <nl> - / * * <nl> - * Gets the next relevant applyOps entry that should be returned . If there is none , returns <nl> - * empty document . <nl> - * / <nl> - boost : : optional < Document > extractNextApplyOpsEntry ( ) ; <nl> - <nl> - / * * <nl> - * Helper for extractNextApplyOpsEntry ( ) . Checks the namespace of the given document to see <nl> - * if it should be returned in the change stream . <nl> - * / <nl> - bool isDocumentRelevant ( const Document & d ) ; <nl> <nl> BSONObj _changeStreamSpec ; <nl> <nl> class DocumentSourceChangeStreamTransform : public DocumentSource { <nl> / / boost : : none , and an exact string equality check is used instead . <nl> boost : : optional < pcrecpp : : RE > _nsRegex ; <nl> <nl> - / / Represents if the current ' applyOps ' we ' re unwinding , if any . <nl> - boost : : optional < TransactionContext > _txnContext ; <nl> + / / Represents the current transaction we ' re unwinding , if any . <nl> + boost : : optional < TransactionOpIterator > _txnIterator ; <nl> <nl> / / Set to true if this transformation stage can be run on the collectionless namespace . <nl> bool _isIndependentOfAnyCollection ; <nl> mmm a / src / mongo / db / pipeline / document_source_check_resume_token . cpp <nl> ppp b / src / mongo / db / pipeline / document_source_check_resume_token . cpp <nl> using ResumeStatus = DocumentSourceEnsureResumeTokenPresent : : ResumeStatus ; <nl> / / the client ' s resume token , ResumeStatus : : kCheckNextDoc if it is older than the client ' s token , <nl> / / and ResumeToken : : kCannotResume if it is more recent than the client ' s resume token ( indicating <nl> / / that we will never see the token ) . If the resume token ' s documentKey contains only the _id field <nl> - / / while the pipeline documentKey contains additional fields , then the collection has become <nl> - / / sharded since the resume token was generated . In that case , we relax the requirements such that <nl> - / / only the timestamp , version , applyOpsIndex , UUID and documentKey . _id need match . This remains <nl> - / / correct , since the only circumstances under which the resume token omits the shard key is if it <nl> - / / was generated either ( 1 ) before the collection was sharded , ( 2 ) after the collection was sharded <nl> - / / but before the primary shard became aware of that fact , implying that it was before the first <nl> - / / chunk moved off the shard , or ( 3 ) by a malicious client who has constructed their own resume <nl> - / / token . In the first two cases , we can be guaranteed that the _id is unique and the stream can <nl> - / / therefore be resumed seamlessly ; in the third case , the worst that can happen is that some <nl> - / / entries are missed or duplicated . Note that the simple collation is used to compare the resume <nl> - / / tokens , and that we purposefully avoid the user ' s requested collation if present . <nl> + / / while the pipeline documentKey contains additional fields , then the collection has become sharded <nl> + / / since the resume token was generated . In that case , we relax the requirements such that only the <nl> + / / timestamp , version , txnOpIndex , UUID and documentKey . _id need match . This remains correct , since <nl> + / / the only circumstances under which the resume token omits the shard key is if it was generated <nl> + / / either ( 1 ) before the collection was sharded , ( 2 ) after the collection was sharded but before the <nl> + / / primary shard became aware of that fact , implying that it was before the first chunk moved off <nl> + / / the shard , or ( 3 ) by a malicious client who has constructed their own resume token . In the first <nl> + / / two cases , we can be guaranteed that the _id is unique and the stream can therefore be resumed <nl> + / / seamlessly ; in the third case , the worst that can happen is that some entries are missed or <nl> + / / duplicated . Note that the simple collation is used to compare the resume tokens , and that we <nl> + / / purposefully avoid the user ' s requested collation if present . <nl> ResumeStatus compareAgainstClientResumeToken ( const intrusive_ptr < ExpressionContext > & expCtx , <nl> const Document & documentFromResumedStream , <nl> const ResumeTokenData & tokenDataFromClient ) { <nl> ResumeStatus compareAgainstClientResumeToken ( const intrusive_ptr < ExpressionConte <nl> : ResumeStatus : : kCheckNextDoc ; <nl> } <nl> <nl> - if ( tokenDataFromResumedStream . applyOpsIndex < tokenDataFromClient . applyOpsIndex ) { <nl> + if ( tokenDataFromResumedStream . txnOpIndex < tokenDataFromClient . txnOpIndex ) { <nl> return ResumeStatus : : kCheckNextDoc ; <nl> - } else if ( tokenDataFromResumedStream . applyOpsIndex > tokenDataFromClient . applyOpsIndex ) { <nl> - / / This could happen if the client provided an applyOpsIndex of 0 , yet the 0th document in <nl> - / / the applyOps was irrelevant ( meaning it was an operation on a collection or DB not being <nl> + } else if ( tokenDataFromResumedStream . txnOpIndex > tokenDataFromClient . txnOpIndex ) { <nl> + / / This could happen if the client provided a txnOpIndex of 0 , yet the 0th document in the <nl> + / / applyOps was irrelevant ( meaning it was an operation on a collection or DB not being <nl> / / watched ) . If we are looking for the resume token on a shard then this simply means that <nl> / / the resume token may be on a different shard ; otherwise , it indicates a corrupt token . <nl> - uassert ( 50792 , " Invalid resumeToken : applyOpsIndex was skipped " , expCtx - > needsMerge ) ; <nl> + uassert ( 50792 , " Invalid resumeToken : txnOpIndex was skipped " , expCtx - > needsMerge ) ; <nl> / / We are running on a merging shard . Signal that we have read beyond the resume token . <nl> return ResumeStatus : : kSurpassedToken ; <nl> } <nl> ResumeStatus compareAgainstClientResumeToken ( const intrusive_ptr < ExpressionConte <nl> / / resumable ; we are past the point in the stream where the token should have appeared . <nl> if ( tokenDataFromResumedStream . uuid ! = tokenDataFromClient . uuid ) { <nl> / / If we are running on a replica set deployment , we don ' t ever expect to see identical time <nl> - / / stamps and applyOpsIndex but differing UUIDs , and we reject the resume attempt at once . <nl> + / / stamps and txnOpIndex but differing UUIDs , and we reject the resume attempt at once . <nl> if ( ! expCtx - > inMongos & & ! expCtx - > needsMerge ) { <nl> return ResumeStatus : : kSurpassedToken ; <nl> } <nl> mmm a / src / mongo / db / pipeline / document_source_check_resume_token_test . cpp <nl> ppp b / src / mongo / db / pipeline / document_source_check_resume_token_test . cpp <nl> class CheckResumeTokenTest : public AggregationContextFixture { <nl> protected : <nl> / * * <nl> * Pushes a document with a resume token corresponding to the given timestamp , version , <nl> - * applyOpsIndex , docKey , and namespace into the mock queue . <nl> + * txnOpIndex , docKey , and namespace into the mock queue . <nl> * / <nl> void addDocument ( <nl> - Timestamp ts , int version , std : : size_t applyOpsIndex , Document docKey , UUID uuid ) { <nl> + Timestamp ts , int version , std : : size_t txnOpIndex , Document docKey , UUID uuid ) { <nl> _mock - > push_back ( <nl> Document { { " _id " , <nl> - ResumeToken ( ResumeTokenData ( ts , version , applyOpsIndex , uuid , Value ( docKey ) ) ) <nl> + ResumeToken ( ResumeTokenData ( ts , version , txnOpIndex , uuid , Value ( docKey ) ) ) <nl> . toDocument ( ) } } ) ; <nl> } <nl> <nl> / * * <nl> * Pushes a document with a resume token corresponding to the given timestamp , version , <nl> - * applyOpsIndex , docKey , and namespace into the mock queue . <nl> + * txnOpIndex , docKey , and namespace into the mock queue . <nl> * / <nl> void addDocument ( Timestamp ts , Document docKey , UUID uuid = testUuid ( ) ) { <nl> addDocument ( ts , 0 , 0 , docKey , uuid ) ; <nl> class CheckResumeTokenTest : public AggregationContextFixture { <nl> intrusive_ptr < DocumentSourceEnsureResumeTokenPresent > createCheckResumeToken ( <nl> Timestamp ts , <nl> int version , <nl> - std : : size_t applyOpsIndex , <nl> + std : : size_t txnOpIndex , <nl> boost : : optional < Document > docKey , <nl> UUID uuid ) { <nl> auto checkResumeToken = DocumentSourceEnsureResumeTokenPresent : : create ( <nl> - getExpCtx ( ) , { ts , version , applyOpsIndex , uuid , docKey ? Value ( * docKey ) : Value ( ) } ) ; <nl> + getExpCtx ( ) , { ts , version , txnOpIndex , uuid , docKey ? Value ( * docKey ) : Value ( ) } ) ; <nl> checkResumeToken - > setSource ( _mock . get ( ) ) ; <nl> return checkResumeToken ; <nl> } <nl> TEST_F ( CheckResumeTokenTest , <nl> ASSERT_THROWS_CODE ( checkResumeToken - > getNext ( ) , AssertionException , 40585 ) ; <nl> } <nl> <nl> - TEST_F ( CheckResumeTokenTest , ShouldSkipResumeTokensWithEarlierApplyOpsIndex ) { <nl> + TEST_F ( CheckResumeTokenTest , ShouldSkipResumeTokensWithEarlierTxnOpIndex ) { <nl> Timestamp resumeTimestamp ( 100 , 1 ) ; <nl> <nl> / / Create an ordered array of 3 UUIDs . <nl> mmm a / src / mongo / db / pipeline / mongo_process_interface . h <nl> ppp b / src / mongo / db / pipeline / mongo_process_interface . h <nl> namespace mongo { <nl> class ExpressionContext ; <nl> class Pipeline ; <nl> class PipelineDeleter ; <nl> + class TransactionHistoryIteratorBase ; <nl> <nl> / * * <nl> * Any functionality needed by an aggregation stage that is either context specific to a mongod or <nl> class MongoProcessInterface { <nl> virtual DBClientBase * directClient ( ) = 0 ; <nl> <nl> / * * <nl> - * Query the oplog for an entry with a matching OpTime . <nl> + * Creates a new TransactionHistoryIterator object . Only applicable in processes which support <nl> + * locally traversing the oplog . <nl> * / <nl> - virtual repl : : OplogEntry lookUpOplogEntryByOpTime ( OperationContext * opCtx , <nl> - repl : : OpTime lookupTime ) = 0 ; <nl> + virtual std : : unique_ptr < TransactionHistoryIteratorBase > createTransactionHistoryIterator ( <nl> + repl : : OpTime time ) const = 0 ; <nl> <nl> / * * <nl> * Note that in some rare cases this could return a false negative but will never return a false <nl> mmm a / src / mongo / db / pipeline / mongos_process_interface . h <nl> ppp b / src / mongo / db / pipeline / mongos_process_interface . h <nl> class MongoSInterface final : public MongoProcessCommon { <nl> std : : vector < GenericCursor > getIdleCursors ( const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> CurrentOpUserMode userMode ) const final ; <nl> <nl> - repl : : OplogEntry lookUpOplogEntryByOpTime ( OperationContext * opCtx , <nl> - repl : : OpTime lookupTime ) final { <nl> + std : : unique_ptr < TransactionHistoryIteratorBase > createTransactionHistoryIterator ( <nl> + repl : : OpTime time ) const override { <nl> MONGO_UNREACHABLE ; <nl> } <nl> <nl> mmm a / src / mongo / db / pipeline / process_interface_standalone . cpp <nl> ppp b / src / mongo / db / pipeline / process_interface_standalone . cpp <nl> DBClientBase * MongoInterfaceStandalone : : directClient ( ) { <nl> return & _client ; <nl> } <nl> <nl> - repl : : OplogEntry MongoInterfaceStandalone : : lookUpOplogEntryByOpTime ( OperationContext * opCtx , <nl> - repl : : OpTime lookupTime ) { <nl> - invariant ( ! lookupTime . isNull ( ) ) ; <nl> - <nl> + std : : unique_ptr < TransactionHistoryIteratorBase > <nl> + MongoInterfaceStandalone : : createTransactionHistoryIterator ( repl : : OpTime time ) const { <nl> bool permitYield = true ; <nl> - TransactionHistoryIterator iterator ( lookupTime , permitYield ) ; <nl> - try { <nl> - auto result = iterator . next ( opCtx ) ; <nl> - <nl> - / / This function is intended to link a " commit " command to its corresponding " applyOps " <nl> - / / command , which represents a prepared transaction . There should be no additional entries <nl> - / / in the transaction ' s chain of operations . Note that when the oplog changes gated by <nl> - / / ' useMultipleOplogEntryFormatForTransactions ' become permanent , these assumptions about <nl> - / / iterating transactions will no longer hold . <nl> - invariant ( ! iterator . hasNext ( ) ) ; <nl> - return result ; <nl> - } catch ( ExceptionFor < ErrorCodes : : IncompleteTransactionHistory > & ex ) { <nl> - ex . addContext ( <nl> - " Oplog no longer has history necessary for $ changeStream to observe operations from a " <nl> - " committed transaction . " ) ; <nl> - uasserted ( ErrorCodes : : ChangeStreamHistoryLost , ex . reason ( ) ) ; <nl> - } <nl> + return std : : unique_ptr < TransactionHistoryIteratorBase > ( <nl> + new TransactionHistoryIterator ( time , permitYield ) ) ; <nl> } <nl> <nl> bool MongoInterfaceStandalone : : isSharded ( OperationContext * opCtx , const NamespaceString & nss ) { <nl> mmm a / src / mongo / db / pipeline / process_interface_standalone . h <nl> ppp b / src / mongo / db / pipeline / process_interface_standalone . h <nl> class MongoInterfaceStandalone : public MongoProcessCommon { <nl> <nl> void setOperationContext ( OperationContext * opCtx ) final ; <nl> DBClientBase * directClient ( ) final ; <nl> - virtual repl : : OplogEntry lookUpOplogEntryByOpTime ( OperationContext * opCtx , <nl> - repl : : OpTime lookupTime ) final ; <nl> + std : : unique_ptr < TransactionHistoryIteratorBase > createTransactionHistoryIterator ( <nl> + repl : : OpTime time ) const final ; <nl> bool isSharded ( OperationContext * opCtx , const NamespaceString & nss ) final ; <nl> void insert ( const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> const NamespaceString & ns , <nl> mmm a / src / mongo / db / pipeline / resume_token . cpp <nl> ppp b / src / mongo / db / pipeline / resume_token . cpp <nl> ResumeTokenData makeHighWaterMarkResumeTokenData ( Timestamp clusterTime , <nl> <nl> bool ResumeTokenData : : operator = = ( const ResumeTokenData & other ) const { <nl> return clusterTime = = other . clusterTime & & version = = other . version & & <nl> - tokenType = = other . tokenType & & applyOpsIndex = = other . applyOpsIndex & & <nl> + tokenType = = other . tokenType & & txnOpIndex = = other . txnOpIndex & & <nl> fromInvalidate = = other . fromInvalidate & & uuid = = other . uuid & & <nl> ( Value : : compare ( this - > documentKey , other . documentKey , nullptr ) = = 0 ) ; <nl> } <nl> std : : ostream & operator < < ( std : : ostream & out , const ResumeTokenData & tokenData ) { <nl> if ( tokenData . version > 0 ) { <nl> out < < " , tokenType : " < < tokenData . tokenType ; <nl> } <nl> - out < < " , applyOpsIndex : " < < tokenData . applyOpsIndex ; <nl> + out < < " , txnOpIndex : " < < tokenData . txnOpIndex ; <nl> if ( tokenData . version > 0 ) { <nl> out < < " , fromInvalidate : " < < static_cast < bool > ( tokenData . fromInvalidate ) ; <nl> } <nl> ResumeToken : : ResumeToken ( const Document & resumeDoc ) { <nl> } <nl> <nl> / / We encode the resume token as a KeyString with the sequence : <nl> - / / clusterTime , version , applyOpsIndex , fromInvalidate , uuid , documentKey <nl> - / / Only the clusterTime , version , applyOpsIndex , and fromInvalidate are required . <nl> + / / clusterTime , version , txnOpIndex , fromInvalidate , uuid , documentKey Only the clusterTime , <nl> + / / version , txnOpIndex , and fromInvalidate are required . <nl> ResumeToken : : ResumeToken ( const ResumeTokenData & data ) { <nl> BSONObjBuilder builder ; <nl> builder . append ( " " , data . clusterTime ) ; <nl> ResumeToken : : ResumeToken ( const ResumeTokenData & data ) { <nl> if ( data . version > = 1 ) { <nl> builder . appendNumber ( " " , data . tokenType ) ; <nl> } <nl> - builder . appendNumber ( " " , data . applyOpsIndex ) ; <nl> + builder . appendNumber ( " " , data . txnOpIndex ) ; <nl> if ( data . version > = 1 ) { <nl> builder . appendBool ( " " , data . fromInvalidate ) ; <nl> } <nl> ResumeTokenData ResumeToken : : getData ( ) const { <nl> result . tokenType = static_cast < ResumeTokenData : : TokenType > ( typeInt ) ; <nl> } <nl> <nl> - / / Next comes the applyOps index . <nl> - uassert ( 50793 , " Resume Token does not contain applyOpsIndex " , i . more ( ) ) ; <nl> - auto applyOpsElt = i . next ( ) ; <nl> + / / Next comes the txnOpIndex value . <nl> + uassert ( 50793 , " Resume Token does not contain txnOpIndex " , i . more ( ) ) ; <nl> + auto txnOpIndexElt = i . next ( ) ; <nl> uassert ( 50855 , <nl> - " Resume Token applyOpsIndex is not an integer " , <nl> - applyOpsElt . type ( ) = = BSONType : : NumberInt ) ; <nl> - const int applyOpsInd = applyOpsElt . numberInt ( ) ; <nl> - uassert ( 50794 , " Invalid Resume Token : applyOpsIndex should be non - negative " , applyOpsInd > = 0 ) ; <nl> - result . applyOpsIndex = applyOpsInd ; <nl> + " Resume Token txnOpIndex is not an integer " , <nl> + txnOpIndexElt . type ( ) = = BSONType : : NumberInt ) ; <nl> + const int txnOpIndexInd = txnOpIndexElt . numberInt ( ) ; <nl> + uassert ( 50794 , " Invalid Resume Token : txnOpIndex should be non - negative " , txnOpIndexInd > = 0 ) ; <nl> + result . txnOpIndex = txnOpIndexInd ; <nl> <nl> if ( result . version > = 1 ) { <nl> / / The ' fromInvalidate ' bool was added in version 1 resume tokens . We don ' t expect to see it <nl> mmm a / src / mongo / db / pipeline / resume_token . h <nl> ppp b / src / mongo / db / pipeline / resume_token . h <nl> struct ResumeTokenData { <nl> ResumeTokenData ( ) { } ; <nl> ResumeTokenData ( Timestamp clusterTimeIn , <nl> int versionIn , <nl> - size_t applyOpsIndexIn , <nl> + size_t txnOpIndexIn , <nl> const boost : : optional < UUID > & uuidIn , <nl> Value documentKeyIn ) <nl> : clusterTime ( clusterTimeIn ) , <nl> version ( versionIn ) , <nl> - applyOpsIndex ( applyOpsIndexIn ) , <nl> + txnOpIndex ( txnOpIndexIn ) , <nl> uuid ( uuidIn ) , <nl> documentKey ( std : : move ( documentKeyIn ) ) { } ; <nl> <nl> struct ResumeTokenData { <nl> Timestamp clusterTime ; <nl> int version = 1 ; <nl> TokenType tokenType = TokenType : : kEventToken ; <nl> - size_t applyOpsIndex = 0 ; <nl> + / / When a resume token references an operation in a transaction , the ' clusterTime ' stores the <nl> + / / commit time of the transaction , and the ' txnOpIndex ' field stores the index of the operation <nl> + / / within its transaction . Operations that are not in a transaction always have a value of 0 for <nl> + / / this field . <nl> + size_t txnOpIndex = 0 ; <nl> / / Flag to indicate that this resume token is from an " invalidate " entry . This will not be set <nl> / / on a token from a command that * would * invalidate a change stream , but rather the invalidate <nl> / / notification itself . <nl> std : : ostream & operator < < ( std : : ostream & out , const ResumeTokenData & tokenData ) ; <nl> * This token has the following format : <nl> * { <nl> * _data : String , A hex encoding of the binary generated by keystring encoding the clusterTime , <nl> - * version , applyOpsIndex , UUID , then documentKey in that order . <nl> + * version , txnOpIndex , UUID , then documentKey in that order . <nl> * _typeBits : BinData - The keystring type bits used for deserialization . <nl> * } <nl> * The _data field data is encoded such that string comparisons provide the correct ordering of <nl> mmm a / src / mongo / db / pipeline / resume_token_test . cpp <nl> ppp b / src / mongo / db / pipeline / resume_token_test . cpp <nl> TEST ( ResumeToken , WrongVersionToken ) { <nl> ASSERT_THROWS ( rtToken . getData ( ) , AssertionException ) ; <nl> } <nl> <nl> - TEST ( ResumeToken , InvalidApplyOpsIndex ) { <nl> + TEST ( ResumeToken , InvalidTxnOpIndex ) { <nl> Timestamp ts ( 1001 , 3 ) ; <nl> <nl> ResumeTokenData resumeTokenDataIn ; <nl> resumeTokenDataIn . clusterTime = ts ; <nl> - resumeTokenDataIn . applyOpsIndex = 1234 ; <nl> + resumeTokenDataIn . txnOpIndex = 1234 ; <nl> <nl> - / / Should round trip with a non - negative applyOpsIndex . <nl> + / / Should round trip with a non - negative txnOpIndex . <nl> auto rtToken = ResumeToken : : parse ( ResumeToken ( resumeTokenDataIn ) . toDocument ( ) . toBson ( ) ) ; <nl> ResumeTokenData tokenData = rtToken . getData ( ) ; <nl> ASSERT_EQ ( resumeTokenDataIn , tokenData ) ; <nl> <nl> - / / Should fail with a negative applyOpsIndex . <nl> - resumeTokenDataIn . applyOpsIndex = std : : numeric_limits < size_t > : : max ( ) ; <nl> + / / Should fail with a negative txnOpIndex . <nl> + resumeTokenDataIn . txnOpIndex = std : : numeric_limits < size_t > : : max ( ) ; <nl> rtToken = ResumeToken : : parse ( ResumeToken ( resumeTokenDataIn ) . toDocument ( ) . toBson ( ) ) ; <nl> <nl> ASSERT_THROWS ( rtToken . getData ( ) , AssertionException ) ; <nl> TEST ( ResumeToken , InvalidApplyOpsIndex ) { <nl> <nl> TEST ( ResumeToken , StringEncodingSortsCorrectly ) { <nl> / / Make sure that the string encoding of the resume tokens will compare in the correct order , <nl> - / / namely timestamp , version , applyOpsIndex , uuid , then documentKey . <nl> + / / namely timestamp , version , txnOpIndex , uuid , then documentKey . <nl> Timestamp ts2_2 ( 2 , 2 ) ; <nl> Timestamp ts10_4 ( 10 , 4 ) ; <nl> Timestamp ts10_5 ( 10 , 5 ) ; <nl> TEST ( ResumeToken , StringEncodingSortsCorrectly ) { <nl> assertLt ( { ts2_2 , 0 , 0 , boost : : none , Value ( ) } , { ts2_2 , 1 , 0 , boost : : none , Value ( ) } ) ; <nl> assertLt ( { ts10_4 , 5 , 0 , boost : : none , Value ( ) } , { ts10_4 , 10 , 0 , boost : : none , Value ( ) } ) ; <nl> <nl> - / / Test that the Timestamp is more important than the version , applyOpsIndex , UUID and <nl> - / / documentKey . <nl> + / / Test that the Timestamp is more important than the version , txnOpIndex , UUID and documentKey . <nl> assertLt ( { ts10_4 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } , <nl> { ts10_5 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } ) ; <nl> assertLt ( { ts2_2 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } , <nl> TEST ( ResumeToken , StringEncodingSortsCorrectly ) { <nl> assertLt ( { ts10_4 , 1 , 0 , lower_uuid , Value ( Document { { " _id " , 1 } } ) } , <nl> { ts10_4 , 2 , 0 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } ) ; <nl> <nl> - / / Test that when the Timestamp and version are the same , the applyOpsIndex breaks the tie . <nl> + / / Test that when the Timestamp and version are the same , the txnOpIndex breaks the tie . <nl> assertLt ( { ts10_4 , 1 , 6 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } , <nl> { ts10_4 , 1 , 50 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } ) ; <nl> assertLt ( { ts2_2 , 0 , 0 , higher_uuid , Value ( Document { { " _id " , 0 } } ) } , <nl> { ts2_2 , 0 , 4 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } ) ; <nl> <nl> - / / Test that when the Timestamp , version , and applyOpsIndex are the same , the UUID breaks the <nl> - / / tie . <nl> + / / Test that when the Timestamp , version , and txnOpIndex are the same , the UUID breaks the tie . <nl> assertLt ( { ts2_2 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } , <nl> { ts2_2 , 0 , 0 , higher_uuid , Value ( Document { { " _id " , 0 } } ) } ) ; <nl> assertLt ( { ts10_4 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } , <nl> TEST ( ResumeToken , StringEncodingSortsCorrectly ) { <nl> assertLt ( { ts10_4 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 1 } } ) } , <nl> { ts10_4 , 0 , 0 , higher_uuid , Value ( Document { { " _id " , 2 } } ) } ) ; <nl> <nl> - / / Test that when the Timestamp , version , applyOpsIndex , and UUID are the same , the documentKey <nl> + / / Test that when the Timestamp , version , txnOpIndex , and UUID are the same , the documentKey <nl> / / breaks the tie . <nl> assertLt ( { ts2_2 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 0 } } ) } , <nl> { ts2_2 , 0 , 0 , lower_uuid , Value ( Document { { " _id " , 1 } } ) } ) ; <nl> mmm a / src / mongo / db / pipeline / stub_mongo_process_interface . h <nl> ppp b / src / mongo / db / pipeline / stub_mongo_process_interface . h <nl> class StubMongoProcessInterface : public MongoProcessInterface { <nl> MONGO_UNREACHABLE ; <nl> } <nl> <nl> - repl : : OplogEntry lookUpOplogEntryByOpTime ( OperationContext * opCtx , <nl> - repl : : OpTime lookupTime ) override { <nl> + std : : unique_ptr < TransactionHistoryIteratorBase > createTransactionHistoryIterator ( <nl> + repl : : OpTime time ) const override { <nl> MONGO_UNREACHABLE ; <nl> } <nl> <nl> mmm a / src / mongo / db / repl / oplog_interface_mock . cpp <nl> ppp b / src / mongo / db / repl / oplog_interface_mock . cpp <nl> class TransactionHistoryIteratorMock : public TransactionHistoryIteratorBase { <nl> MONGO_UNREACHABLE ; <nl> } <nl> <nl> + repl : : OpTime nextOpTime ( OperationContext * ) override { <nl> + MONGO_UNREACHABLE ; <nl> + } <nl> + <nl> virtual ~ TransactionHistoryIteratorMock ( ) { } <nl> <nl> bool hasNext ( ) const override { <nl> mmm a / src / mongo / db / transaction_history_iterator . cpp <nl> ppp b / src / mongo / db / transaction_history_iterator . cpp <nl> namespace { <nl> / * * <nl> * Query the oplog for an entry with the given timestamp . <nl> * / <nl> - BSONObj findOneOplogEntry ( OperationContext * opCtx , const repl : : OpTime & opTime , bool permitYield ) { <nl> + BSONObj findOneOplogEntry ( OperationContext * opCtx , <nl> + const repl : : OpTime & opTime , <nl> + bool permitYield , <nl> + bool prevOpOnly = false ) { <nl> BSONObj oplogBSON ; <nl> invariant ( ! opTime . isNull ( ) ) ; <nl> <nl> BSONObj findOneOplogEntry ( OperationContext * opCtx , const repl : : OpTime & opTime , b <nl> qr - > setFilter ( opTime . asQuery ( ) ) ; <nl> qr - > setOplogReplay ( true ) ; / / QueryOption_OplogReplay <nl> <nl> + if ( prevOpOnly ) { <nl> + qr - > setProj ( <nl> + BSON ( " _id " < < 0 < < repl : : OplogEntry : : kPrevWriteOpTimeInTransactionFieldName < < 1LL ) ) ; <nl> + } <nl> + <nl> const boost : : intrusive_ptr < ExpressionContext > expCtx ; <nl> <nl> auto statusWithCQ = CanonicalQuery : : canonicalize ( opCtx , <nl> repl : : OplogEntry TransactionHistoryIterator : : next ( OperationContext * opCtx ) { <nl> <nl> auto oplogEntry = uassertStatusOK ( repl : : OplogEntry : : parse ( oplogBSON ) ) ; <nl> const auto & oplogPrevTsOption = oplogEntry . getPrevWriteOpTimeInTransaction ( ) ; <nl> - uassert ( <nl> - ErrorCodes : : FailedToParse , <nl> - str : : stream ( ) < < " Missing prevTs field on oplog entry of previous write in transaction : " <nl> - < < redact ( oplogBSON ) , <nl> - oplogPrevTsOption ) ; <nl> + uassert ( ErrorCodes : : FailedToParse , <nl> + str : : stream ( ) <nl> + < < " Missing prevOpTime field on oplog entry of previous write in transaction : " <nl> + < < redact ( oplogBSON ) , <nl> + oplogPrevTsOption ) ; <nl> <nl> _nextOpTime = oplogPrevTsOption . value ( ) ; <nl> <nl> return oplogEntry ; <nl> } <nl> <nl> + repl : : OpTime TransactionHistoryIterator : : nextOpTime ( OperationContext * opCtx ) { <nl> + BSONObj oplogBSON = findOneOplogEntry ( opCtx , _nextOpTime , _permitYield , true / * prevOpOnly * / ) ; <nl> + <nl> + auto prevOpTime = oplogBSON [ repl : : OplogEntry : : kPrevWriteOpTimeInTransactionFieldName ] ; <nl> + uassert ( ErrorCodes : : FailedToParse , <nl> + str : : stream ( ) <nl> + < < " Missing prevOpTime field on oplog entry of previous write in transaction : " <nl> + < < redact ( oplogBSON ) , <nl> + ! prevOpTime . eoo ( ) & & prevOpTime . isABSONObj ( ) ) ; <nl> + <nl> + auto returnOpTime = _nextOpTime ; <nl> + _nextOpTime = repl : : OpTime : : parse ( prevOpTime . Obj ( ) ) ; <nl> + return returnOpTime ; <nl> + } <nl> + <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / transaction_history_iterator . h <nl> ppp b / src / mongo / db / transaction_history_iterator . h <nl> namespace mongo { <nl> class OperationContext ; <nl> <nl> / * * <nl> - * An iterator class that can traverse through the oplog entries that are linked via the prevTs <nl> - * field . <nl> + * An iterator class that traverses backwards through a transaction ' s oplog entries by following the <nl> + * " prevOpTime " link in each entry . <nl> * / <nl> class TransactionHistoryIteratorBase { <nl> public : <nl> class TransactionHistoryIteratorBase { <nl> virtual bool hasNext ( ) const = 0 ; <nl> <nl> / * * <nl> - * Returns the next oplog entry . <nl> + * Returns an oplog entry and advances the iterator one step back through the oplog . <nl> * Should not be called if hasNext is false . <nl> * Throws if next oplog entry is in a unrecognized format or if it can ' t find the next oplog <nl> * entry . <nl> * / <nl> virtual repl : : OplogEntry next ( OperationContext * opCtx ) = 0 ; <nl> + <nl> + / * * <nl> + * Same as next ( ) but returns only the OpTime , instead of the entire entry . <nl> + * / <nl> + virtual repl : : OpTime nextOpTime ( OperationContext * opCtx ) = 0 ; <nl> } ; <nl> <nl> class TransactionHistoryIterator : public TransactionHistoryIteratorBase { <nl> class TransactionHistoryIterator : public TransactionHistoryIteratorBase { <nl> virtual ~ TransactionHistoryIterator ( ) = default ; <nl> <nl> bool hasNext ( ) const override ; <nl> - repl : : OplogEntry next ( OperationContext * opCtx ) ; <nl> + repl : : OplogEntry next ( OperationContext * opCtx ) override ; <nl> + repl : : OpTime nextOpTime ( OperationContext * opCtx ) override ; <nl> <nl> private : <nl> / / Clients can set this to allow PlanExecutors created by this TransactionHistoryIterator to <nl>
SERVER - 41182 Change streams support for transactions larger than 16MB
mongodb/mongo
938fea1a5f5129f6acf404e6938ba0d56a54ac93
2019-05-29T23:35:34Z
mmm a / src / Storages / MergeTree / MergeTreeIndexBloomFilter . cpp <nl> ppp b / src / Storages / MergeTree / MergeTreeIndexBloomFilter . cpp <nl> std : : unique_ptr < IMergeTreeIndex > bloomFilterIndexCreatorNew ( <nl> if ( ! attach ) / / / This is for backward compatibility . <nl> throw Exception ( " BloomFilter index cannot have more than one parameter . " , ErrorCodes : : NUMBER_OF_ARGUMENTS_DOESNT_MATCH ) ; <nl> <nl> - arguments - > children . erase ( + + arguments - > children . begin ( ) , arguments - > children . end ( ) ) ; <nl> + arguments - > children = { arguments - > children [ 0 ] } ; <nl> } <nl> <nl> <nl>
Fix Arcadia
ClickHouse/ClickHouse
a5bdc375cae4f766027553d71075c03177bce8d5
2020-05-03T21:36:11Z
mmm a / Makefile <nl> ppp b / Makefile <nl> VALGRIND_VER : = $ ( join $ ( VALGRIND_VER ) , valgrind ) <nl> VALGRIND_OPTS = - - error - exitcode = $ ( VALGRIND_ERROR ) - - leak - check = full <nl> <nl> TESTS = \ <nl> + table_stats_collector_test \ <nl> arena_test \ <nl> auto_roll_logger_test \ <nl> block_test \ <nl> signal_test : util / signal_test . o $ ( LIBOBJECTS ) <nl> arena_test : util / arena_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CXX ) util / arena_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) $ ( EXEC_LDFLAGS ) - o $ @ $ ( LDFLAGS ) $ ( COVERAGEFLAGS ) <nl> <nl> + table_stats_collector_test : db / table_stats_collector_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> + $ ( CXX ) db / table_stats_collector_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) $ ( EXEC_LDFLAGS ) - o $ @ $ ( LDFLAGS ) $ ( COVERAGEFLAGS ) <nl> + <nl> bloom_test : util / bloom_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) <nl> $ ( CXX ) util / bloom_test . o $ ( LIBOBJECTS ) $ ( TESTHARNESS ) $ ( EXEC_LDFLAGS ) - o $ @ $ ( LDFLAGS ) $ ( COVERAGEFLAGS ) <nl> <nl> mmm a / db / db_impl . cc <nl> ppp b / db / db_impl . cc <nl> <nl> # include < climits > <nl> # include < cstdio > <nl> # include < set > <nl> - # include < string > <nl> - # include < stdint . h > <nl> # include < stdexcept > <nl> - # include < vector > <nl> + # include < stdint . h > <nl> + # include < string > <nl> # include < unordered_set > <nl> + # include < vector > <nl> <nl> # include " db / builder . h " <nl> - # include " db / db_iter . h " <nl> # include " db / dbformat . h " <nl> + # include " db / db_iter . h " <nl> # include " db / filename . h " <nl> # include " db / log_reader . h " <nl> # include " db / log_writer . h " <nl> <nl> # include " db / merge_helper . h " <nl> # include " db / prefix_filter_iterator . h " <nl> # include " db / table_cache . h " <nl> + # include " db / table_stats_collector . h " <nl> + # include " db / transaction_log_impl . h " <nl> # include " db / version_set . h " <nl> # include " db / write_batch_internal . h " <nl> - # include " db / transaction_log_impl . h " <nl> + # include " port / port . h " <nl> # include " rocksdb / compaction_filter . h " <nl> # include " rocksdb / db . h " <nl> # include " rocksdb / env . h " <nl> <nl> # include " rocksdb / statistics . h " <nl> # include " rocksdb / status . h " <nl> # include " rocksdb / table_builder . h " <nl> - # include " port / port . h " <nl> # include " table / block . h " <nl> # include " table / merger . h " <nl> # include " table / table . h " <nl> Options SanitizeOptions ( const std : : string & dbname , <nl> / / Use dbname as default <nl> result . wal_dir = dbname ; <nl> } <nl> + <nl> + / / - - Sanitize the table stats collector <nl> + / / All user defined stats collectors will be wrapped by <nl> + / / UserKeyTableStatsCollector since for them they only have the knowledge of <nl> + / / the user keys ; internal keys are invisible to them . <nl> + auto & collectors = result . table_stats_collectors ; <nl> + for ( size_t i = 0 ; i < result . table_stats_collectors . size ( ) ; + + i ) { <nl> + assert ( collectors [ i ] ) ; <nl> + collectors [ i ] = <nl> + std : : make_shared < UserKeyTableStatsCollector > ( collectors [ i ] ) ; <nl> + } <nl> + <nl> + / / Add collector to collect internal key statistics <nl> + collectors . push_back ( <nl> + std : : make_shared < InternalKeyStatsCollector > ( ) <nl> + ) ; <nl> + <nl> return result ; <nl> } <nl> <nl> new file mode 100644 <nl> index 0000000000 . . 91e89ce4c0 <nl> mmm / dev / null <nl> ppp b / db / table_stats_collector . cc <nl> <nl> + / / Copyright ( c ) 2013 , Facebook , Inc . All rights reserved . <nl> + / / This source code is licensed under the BSD - style license found in the <nl> + / / LICENSE file in the root directory of this source tree . An additional grant <nl> + / / of patent rights can be found in the PATENTS file in the same directory . <nl> + <nl> + # include " db / table_stats_collector . h " <nl> + <nl> + # include " db / dbformat . h " <nl> + # include " util / coding . h " <nl> + <nl> + namespace rocksdb { <nl> + <nl> + Status InternalKeyStatsCollector : : Add ( const Slice & key , const Slice & value ) { <nl> + ParsedInternalKey ikey ; <nl> + if ( ! ParseInternalKey ( key , & ikey ) ) { <nl> + return Status : : InvalidArgument ( " Invalid internal key " ) ; <nl> + } <nl> + <nl> + if ( ikey . type = = ValueType : : kTypeDeletion ) { <nl> + + + deleted_keys_ ; <nl> + } <nl> + <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status InternalKeyStatsCollector : : Finish ( <nl> + TableStats : : UserCollectedStats * stats ) { <nl> + assert ( stats ) ; <nl> + assert ( stats - > find ( InternalKeyTableStatsNames : : kDeletedKeys ) = = stats - > end ( ) ) ; <nl> + std : : string val ; <nl> + <nl> + PutVarint64 ( & val , deleted_keys_ ) ; <nl> + stats - > insert ( std : : make_pair ( InternalKeyTableStatsNames : : kDeletedKeys , val ) ) ; <nl> + <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status UserKeyTableStatsCollector : : Add ( const Slice & key , const Slice & value ) { <nl> + ParsedInternalKey ikey ; <nl> + if ( ! ParseInternalKey ( key , & ikey ) ) { <nl> + return Status : : InvalidArgument ( " Invalid internal key " ) ; <nl> + } <nl> + <nl> + return collector_ - > Add ( ikey . user_key , value ) ; <nl> + } <nl> + <nl> + Status UserKeyTableStatsCollector : : Finish ( <nl> + TableStats : : UserCollectedStats * stats ) { <nl> + return collector_ - > Finish ( stats ) ; <nl> + } <nl> + <nl> + const std : : string InternalKeyTableStatsNames : : kDeletedKeys <nl> + = " rocksdb . deleted . keys " ; <nl> + <nl> + } / / namespace rocksdb <nl> new file mode 100644 <nl> index 0000000000 . . e4e3685f74 <nl> mmm / dev / null <nl> ppp b / db / table_stats_collector . h <nl> <nl> + / / Copyright ( c ) 2013 , Facebook , Inc . All rights reserved . <nl> + / / This source code is licensed under the BSD - style license found in the <nl> + / / LICENSE file in the root directory of this source tree . An additional grant <nl> + / / of patent rights can be found in the PATENTS file in the same directory . <nl> + / / <nl> + / / This file defines a collection of statistics collectors . <nl> + # pragma once <nl> + <nl> + # include " rocksdb / table_stats . h " <nl> + <nl> + # include < memory > <nl> + # include < string > <nl> + # include < vector > <nl> + <nl> + namespace rocksdb { <nl> + <nl> + struct InternalKeyTableStatsNames { <nl> + static const std : : string kDeletedKeys ; <nl> + } ; <nl> + <nl> + / / Collecting the statistics for internal keys . Visible only by internal <nl> + / / rocksdb modules . <nl> + class InternalKeyStatsCollector : public TableStatsCollector { <nl> + public : <nl> + virtual Status Add ( const Slice & key , const Slice & value ) ; <nl> + virtual Status Finish ( TableStats : : UserCollectedStats * stats ) ; <nl> + virtual const char * Name ( ) const { return " InternalKeyStatsCollector " ; } <nl> + <nl> + private : <nl> + uint64_t deleted_keys_ = 0 ; <nl> + } ; <nl> + <nl> + / / When rocksdb creates a new table , it will encode all " user keys " into <nl> + / / " internal keys " , which contains meta information of a given entry . <nl> + / / <nl> + / / This class extracts user key from the encoded internal key when Add ( ) is <nl> + / / invoked . <nl> + class UserKeyTableStatsCollector : public TableStatsCollector { <nl> + public : <nl> + explicit UserKeyTableStatsCollector ( TableStatsCollector * collector ) : <nl> + UserKeyTableStatsCollector ( <nl> + std : : shared_ptr < TableStatsCollector > ( collector ) <nl> + ) { <nl> + } <nl> + <nl> + explicit UserKeyTableStatsCollector ( <nl> + std : : shared_ptr < TableStatsCollector > collector ) : collector_ ( collector ) { <nl> + } <nl> + virtual ~ UserKeyTableStatsCollector ( ) { } <nl> + virtual Status Add ( const Slice & key , const Slice & value ) ; <nl> + virtual Status Finish ( TableStats : : UserCollectedStats * stats ) ; <nl> + virtual const char * Name ( ) const { return collector_ - > Name ( ) ; } <nl> + <nl> + protected : <nl> + std : : shared_ptr < TableStatsCollector > collector_ ; <nl> + } ; <nl> + <nl> + } / / namespace rocksdb <nl> new file mode 100644 <nl> index 0000000000 . . 586b65d403 <nl> mmm / dev / null <nl> ppp b / db / table_stats_collector_test . cc <nl> <nl> + / / Copyright ( c ) 2013 , Facebook , Inc . All rights reserved . <nl> + / / This source code is licensed under the BSD - style license found in the <nl> + / / LICENSE file in the root directory of this source tree . An additional grant <nl> + / / of patent rights can be found in the PATENTS file in the same directory . <nl> + <nl> + # include < map > <nl> + # include < memory > <nl> + # include < string > <nl> + <nl> + # include " db / dbformat . h " <nl> + # include " db / db_impl . h " <nl> + # include " db / table_stats_collector . h " <nl> + # include " rocksdb / table_builder . h " <nl> + # include " rocksdb / table_stats . h " <nl> + # include " table / table . h " <nl> + # include " util / coding . h " <nl> + # include " util / testharness . h " <nl> + # include " util / testutil . h " <nl> + <nl> + namespace rocksdb { <nl> + <nl> + class TableStatsTest { <nl> + private : <nl> + unique_ptr < Table > table_ ; <nl> + } ; <nl> + <nl> + / / TODO ( kailiu ) the following classes should be moved to some more general <nl> + / / places , so that other tests can also make use of them . <nl> + / / ` FakeWritableFile ` and ` FakeRandomeAccessFile ` bypass the real file system <nl> + / / and therefore enable us to quickly setup the tests . <nl> + class FakeWritableFile : public WritableFile { <nl> + public : <nl> + ~ FakeWritableFile ( ) { } <nl> + <nl> + const std : : string & contents ( ) const { return contents_ ; } <nl> + <nl> + virtual Status Close ( ) { return Status : : OK ( ) ; } <nl> + virtual Status Flush ( ) { return Status : : OK ( ) ; } <nl> + virtual Status Sync ( ) { return Status : : OK ( ) ; } <nl> + <nl> + virtual Status Append ( const Slice & data ) { <nl> + contents_ . append ( data . data ( ) , data . size ( ) ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + private : <nl> + std : : string contents_ ; <nl> + } ; <nl> + <nl> + <nl> + class FakeRandomeAccessFile : public RandomAccessFile { <nl> + public : <nl> + explicit FakeRandomeAccessFile ( const Slice & contents ) <nl> + : contents_ ( contents . data ( ) , contents . size ( ) ) { <nl> + } <nl> + <nl> + virtual ~ FakeRandomeAccessFile ( ) { } <nl> + <nl> + uint64_t Size ( ) const { return contents_ . size ( ) ; } <nl> + <nl> + virtual Status Read ( uint64_t offset , size_t n , Slice * result , <nl> + char * scratch ) const { <nl> + if ( offset > contents_ . size ( ) ) { <nl> + return Status : : InvalidArgument ( " invalid Read offset " ) ; <nl> + } <nl> + if ( offset + n > contents_ . size ( ) ) { <nl> + n = contents_ . size ( ) - offset ; <nl> + } <nl> + memcpy ( scratch , & contents_ [ offset ] , n ) ; <nl> + * result = Slice ( scratch , n ) ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + private : <nl> + std : : string contents_ ; <nl> + } ; <nl> + <nl> + <nl> + class DumbLogger : public Logger { <nl> + public : <nl> + virtual void Logv ( const char * format , va_list ap ) { } <nl> + virtual size_t GetLogFileSize ( ) const { return 0 ; } <nl> + } ; <nl> + <nl> + / / Utilities test functions <nl> + void MakeBuilder ( <nl> + const Options & options , <nl> + std : : unique_ptr < FakeWritableFile > * writable , <nl> + std : : unique_ptr < TableBuilder > * builder ) { <nl> + writable - > reset ( new FakeWritableFile ) ; <nl> + builder - > reset ( <nl> + new TableBuilder ( options , writable - > get ( ) ) <nl> + ) ; <nl> + } <nl> + <nl> + void OpenTable ( <nl> + const Options & options , <nl> + const std : : string & contents , <nl> + std : : unique_ptr < Table > * table ) { <nl> + std : : unique_ptr < RandomAccessFile > file ( new FakeRandomeAccessFile ( contents ) ) ; <nl> + auto s = Table : : Open ( <nl> + options , <nl> + EnvOptions ( ) , <nl> + std : : move ( file ) , <nl> + contents . size ( ) , <nl> + table <nl> + ) ; <nl> + ASSERT_OK ( s ) ; <nl> + } <nl> + <nl> + / / Collects keys that starts with " A " in a table . <nl> + class RegularKeysStartWithA : public TableStatsCollector { <nl> + public : <nl> + const char * Name ( ) const { return " RegularKeysStartWithA " ; } <nl> + <nl> + Status Finish ( TableStats : : UserCollectedStats * stats ) { <nl> + std : : string encoded ; <nl> + PutVarint32 ( & encoded , count_ ) ; <nl> + * stats = TableStats : : UserCollectedStats { <nl> + { " TableStatsTest " , " Rocksdb " } , <nl> + { " Count " , encoded } <nl> + } ; <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + Status Add ( const Slice & user_key , const Slice & value ) { <nl> + / / simply asssume all user keys are not empty . <nl> + if ( user_key . data ( ) [ 0 ] = = ' A ' ) { <nl> + + + count_ ; <nl> + } <nl> + return Status : : OK ( ) ; <nl> + } <nl> + <nl> + private : <nl> + uint32_t count_ = 0 ; <nl> + } ; <nl> + <nl> + TEST ( TableStatsTest , CustomizedTableStatsCollector ) { <nl> + Options options ; <nl> + <nl> + / / make sure the entries will be inserted with order . <nl> + std : : map < std : : string , std : : string > kvs = { <nl> + { " About " , " val5 " } , / / starts with ' A ' <nl> + { " Abstract " , " val2 " } , / / starts with ' A ' <nl> + { " Around " , " val7 " } , / / starts with ' A ' <nl> + { " Beyond " , " val3 " } , <nl> + { " Builder " , " val1 " } , <nl> + { " Cancel " , " val4 " } , <nl> + { " Find " , " val6 " } , <nl> + } ; <nl> + <nl> + / / Test stats collectors with internal keys or regular keys <nl> + for ( bool encode_as_internal : { true , false } ) { <nl> + / / - - Step 1 : build table <nl> + auto collector = new RegularKeysStartWithA ( ) ; <nl> + if ( encode_as_internal ) { <nl> + options . table_stats_collectors = { <nl> + std : : make_shared < UserKeyTableStatsCollector > ( collector ) <nl> + } ; <nl> + } else { <nl> + options . table_stats_collectors . resize ( 1 ) ; <nl> + options . table_stats_collectors [ 0 ] . reset ( collector ) ; <nl> + } <nl> + std : : unique_ptr < TableBuilder > builder ; <nl> + std : : unique_ptr < FakeWritableFile > writable ; <nl> + MakeBuilder ( options , & writable , & builder ) ; <nl> + <nl> + for ( const auto & kv : kvs ) { <nl> + if ( encode_as_internal ) { <nl> + InternalKey ikey ( kv . first , 0 , ValueType : : kTypeValue ) ; <nl> + builder - > Add ( ikey . Encode ( ) , kv . second ) ; <nl> + } else { <nl> + builder - > Add ( kv . first , kv . second ) ; <nl> + } <nl> + } <nl> + ASSERT_OK ( builder - > Finish ( ) ) ; <nl> + <nl> + / / - - Step 2 : Open table <nl> + std : : unique_ptr < Table > table ; <nl> + OpenTable ( options , writable - > contents ( ) , & table ) ; <nl> + const auto & stats = table - > GetTableStats ( ) . user_collected_stats ; <nl> + <nl> + ASSERT_EQ ( " Rocksdb " , stats . at ( " TableStatsTest " ) ) ; <nl> + <nl> + uint32_t starts_with_A = 0 ; <nl> + Slice key ( stats . at ( " Count " ) ) ; <nl> + ASSERT_TRUE ( GetVarint32 ( & key , & starts_with_A ) ) ; <nl> + ASSERT_EQ ( 3u , starts_with_A ) ; <nl> + } <nl> + } <nl> + <nl> + TEST ( TableStatsTest , InternalKeyStatsCollector ) { <nl> + InternalKey keys [ ] = { <nl> + InternalKey ( " A " , 0 , ValueType : : kTypeValue ) , <nl> + InternalKey ( " B " , 0 , ValueType : : kTypeValue ) , <nl> + InternalKey ( " C " , 0 , ValueType : : kTypeValue ) , <nl> + InternalKey ( " W " , 0 , ValueType : : kTypeDeletion ) , <nl> + InternalKey ( " X " , 0 , ValueType : : kTypeDeletion ) , <nl> + InternalKey ( " Y " , 0 , ValueType : : kTypeDeletion ) , <nl> + InternalKey ( " Z " , 0 , ValueType : : kTypeDeletion ) , <nl> + } ; <nl> + <nl> + for ( bool sanitized : { false , true } ) { <nl> + std : : unique_ptr < TableBuilder > builder ; <nl> + std : : unique_ptr < FakeWritableFile > writable ; <nl> + Options options ; <nl> + if ( sanitized ) { <nl> + options . table_stats_collectors = { <nl> + std : : make_shared < RegularKeysStartWithA > ( ) <nl> + } ; <nl> + / / with sanitization , even regular stats collector will be able to <nl> + / / handle internal keys . <nl> + auto comparator = options . comparator ; <nl> + / / HACK : Set options . info_log to avoid writing log in <nl> + / / SanitizeOptions ( ) . <nl> + options . info_log = std : : make_shared < DumbLogger > ( ) ; <nl> + options = SanitizeOptions ( <nl> + " db " , / / just a place holder <nl> + nullptr , / / with skip internal key comparator <nl> + nullptr , / / don ' t care filter policy <nl> + options <nl> + ) ; <nl> + options . comparator = comparator ; <nl> + } else { <nl> + options . table_stats_collectors = { <nl> + std : : make_shared < InternalKeyStatsCollector > ( ) <nl> + } ; <nl> + } <nl> + <nl> + MakeBuilder ( options , & writable , & builder ) ; <nl> + for ( const auto & k : keys ) { <nl> + builder - > Add ( k . Encode ( ) , " val " ) ; <nl> + } <nl> + <nl> + ASSERT_OK ( builder - > Finish ( ) ) ; <nl> + <nl> + std : : unique_ptr < Table > table ; <nl> + OpenTable ( options , writable - > contents ( ) , & table ) ; <nl> + const auto & stats = table - > GetTableStats ( ) . user_collected_stats ; <nl> + <nl> + uint64_t deleted = 0 ; <nl> + Slice key ( stats . at ( InternalKeyTableStatsNames : : kDeletedKeys ) ) ; <nl> + ASSERT_TRUE ( GetVarint64 ( & key , & deleted ) ) ; <nl> + ASSERT_EQ ( 4u , deleted ) ; <nl> + <nl> + if ( sanitized ) { <nl> + uint32_t starts_with_A = 0 ; <nl> + Slice key ( stats . at ( " Count " ) ) ; <nl> + ASSERT_TRUE ( GetVarint32 ( & key , & starts_with_A ) ) ; <nl> + ASSERT_EQ ( 1u , starts_with_A ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + } / / namespace rocksdb <nl> + <nl> + int main ( int argc , char * * argv ) { <nl> + return rocksdb : : test : : RunAllTests ( ) ; <nl> + } <nl> mmm a / include / rocksdb / options . h <nl> ppp b / include / rocksdb / options . h <nl> <nl> # include < memory > <nl> # include < vector > <nl> # include < stdint . h > <nl> + <nl> + # include " rocksdb / memtablerep . h " <nl> # include " rocksdb / slice . h " <nl> + # include " rocksdb / slice_transform . h " <nl> # include " rocksdb / statistics . h " <nl> + # include " rocksdb / table_stats . h " <nl> # include " rocksdb / universal_compaction . h " <nl> - # include " rocksdb / memtablerep . h " <nl> - # include " rocksdb / slice_transform . h " <nl> <nl> namespace rocksdb { <nl> <nl> struct Options { <nl> / / to data file . <nl> / / Default : true <nl> bool purge_log_after_memtable_flush ; <nl> + <nl> + / / This option allows user to to collect their own interested statistics of <nl> + / / the tables . <nl> + / / Default : emtpy vector - - no user - defined statistics collection will be <nl> + / / performed . <nl> + std : : vector < std : : shared_ptr < TableStatsCollector > > table_stats_collectors ; <nl> } ; <nl> <nl> / / <nl> mmm a / include / rocksdb / table_stats . h <nl> ppp b / include / rocksdb / table_stats . h <nl> <nl> # include < string > <nl> # include < unordered_map > <nl> <nl> + # include " rocksdb / status . h " <nl> + <nl> namespace rocksdb { <nl> <nl> / / TableStats contains a bunch of read - only stats of its associated <nl> / / table . <nl> struct TableStats { <nl> public : <nl> - / / TODO ( kailiu ) we do not support user collected stats yet . <nl> - / / <nl> / / Other than basic table stats , each table may also have the user <nl> / / collected stats . <nl> / / The value of the user - collected stats are encoded as raw bytes - - <nl> struct TableStats { <nl> UserCollectedStats user_collected_stats ; <nl> } ; <nl> <nl> + / / ` TableStatsCollector ` provides the mechanism for users to collect their own <nl> + / / interested stats . This class is essentially a collection of callback <nl> + / / functions that will be invoked during table building . <nl> + class TableStatsCollector { <nl> + public : <nl> + virtual ~ TableStatsCollector ( ) { } <nl> + / / Add ( ) will be called when a new key / value pair is inserted into the table . <nl> + / / @ params key the original key that is inserted into the table . <nl> + / / @ params value the original value that is inserted into the table . <nl> + virtual Status Add ( const Slice & key , const Slice & value ) = 0 ; <nl> + <nl> + / / Finish ( ) will be called when a table has already been built and is ready <nl> + / / for writing the stats block . <nl> + / / @ params stats User will add their collected statistics to ` stats ` . <nl> + virtual Status Finish ( TableStats : : UserCollectedStats * stats ) = 0 ; <nl> + <nl> + / / The name of the stats collector can be used for debugging purpose . <nl> + virtual const char * Name ( ) const = 0 ; <nl> + } ; <nl> + <nl> } / / namespace rocksdb <nl> mmm a / table / table_builder . cc <nl> ppp b / table / table_builder . cc <nl> static bool GoodCompressionRatio ( size_t compressed_size , size_t raw_size ) { <nl> return compressed_size < raw_size - ( raw_size / 8u ) ; <nl> } <nl> <nl> + / / Were we encounter any error occurs during user - defined statistics collection , <nl> + / / we ' ll write the warning message to info log . <nl> + void LogStatsCollectionError ( <nl> + Logger * info_log , const std : : string & method , const std : : string & name ) { <nl> + assert ( method = = " Add " | | method = = " Finish " ) ; <nl> + <nl> + std : : string msg = <nl> + " [ Warning ] encountered error when calling TableStatsCollector : : " + <nl> + method + " ( ) with collector name : " + name ; <nl> + Log ( info_log , msg . c_str ( ) ) ; <nl> + } <nl> + <nl> } / / anonymous namespace <nl> <nl> struct TableBuilder : : Rep { <nl> void TableBuilder : : Add ( const Slice & key , const Slice & value ) { <nl> r - > num_entries + + ; <nl> r - > raw_key_size + = key . size ( ) ; <nl> r - > raw_value_size + = value . size ( ) ; <nl> + <nl> + for ( auto collector : r - > options . table_stats_collectors ) { <nl> + Status s = collector - > Add ( key , value ) ; <nl> + if ( ! s . ok ( ) ) { <nl> + LogStatsCollectionError ( <nl> + r - > options . info_log . get ( ) , <nl> + " Add " , / * method * / <nl> + collector - > Name ( ) <nl> + ) ; <nl> + } <nl> + } <nl> } <nl> <nl> void TableBuilder : : Flush ( ) { <nl> Status TableBuilder : : Finish ( ) { <nl> ) ) ; <nl> } <nl> <nl> + for ( auto collector : r - > options . table_stats_collectors ) { <nl> + TableStats : : UserCollectedStats user_collected_stats ; <nl> + Status s = <nl> + collector - > Finish ( & user_collected_stats ) ; <nl> + <nl> + if ( ! s . ok ( ) ) { <nl> + LogStatsCollectionError ( <nl> + r - > options . info_log . get ( ) , <nl> + " Finish " , / * method * / <nl> + collector - > Name ( ) <nl> + ) ; <nl> + } else { <nl> + stats . insert ( <nl> + user_collected_stats . begin ( ) , <nl> + user_collected_stats . end ( ) <nl> + ) ; <nl> + } <nl> + } <nl> + <nl> for ( const auto & stat : stats ) { <nl> stats_block . Add ( stat . first , stat . second ) ; <nl> } <nl> mmm a / util / options . cc <nl> ppp b / util / options . cc <nl> Options : : Dump ( Logger * log ) const <nl> compaction_options_universal . max_size_amplification_percent ) ; <nl> Log ( log , " Options . purge_log_after_memtable_flush : % d " , <nl> purge_log_after_memtable_flush ) ; <nl> + std : : string collector_names ; <nl> + for ( auto collector : table_stats_collectors ) { <nl> + collector_names . append ( collector - > Name ( ) ) ; <nl> + collector_names . append ( " ; " ) ; <nl> + } <nl> + Log ( log , " Options . table_stats_collectors : % s " , <nl> + collector_names . c_str ( ) ) ; <nl> } / / Options : : Dump <nl> <nl> / / <nl>
Support user - defined table stats collector
facebook/rocksdb
994575c134ef07a1093f21e2c8ccd9b486e92c59
2013-10-28T22:45:14Z
mmm a / tests / queries / 0_stateless / arcadia_skip_list . txt <nl> ppp b / tests / queries / 0_stateless / arcadia_skip_list . txt <nl> <nl> 01461_query_start_time_microseconds <nl> 01455_shard_leaf_max_rows_bytes_to_read <nl> 01505_distributed_local_type_conversion_enum <nl> + 00604_show_create_database <nl> + 00609_mv_index_in_in <nl> + 00510_materizlized_view_and_deduplication_zookeeper <nl> + 00738_lock_for_inner_table <nl> 01505_log_distributed_deadlock <nl> mmm a / tests / queries / skip_list . json <nl> ppp b / tests / queries / skip_list . json <nl> <nl> " release - build " : [ <nl> ] , <nl> " database - ordinary " : [ <nl> - " 00604_show_create_database " <nl> - ] , <nl> - " polymorphic - parts " : [ <nl> - " 00933_test_fix_extra_seek_on_compressed_cache " , <nl> - " 00446_clear_column_in_partition_zookeeper " <nl> + " 00604_show_create_database " , <nl> + " 00609_mv_index_in_in " , <nl> + " 00510_materizlized_view_and_deduplication_zookeeper " , <nl> + " 00738_lock_for_inner_table " <nl> ] <nl> } <nl>
fix skip lists
ClickHouse/ClickHouse
3f717ea1c471f9c15e617003c9a52ae6776552ba
2020-09-25T10:39:59Z
mmm a / lib / SILPasses / Devirtualizer . cpp <nl> ppp b / lib / SILPasses / Devirtualizer . cpp <nl> <nl> # define DEBUG_TYPE " sil - devirtualizer " <nl> # include " swift / Basic / DemangleWrappers . h " <nl> # include " swift / Basic / Fallthrough . h " <nl> - # include " swift / SIL / CallGraph . h " <nl> # include " swift / SIL / SILArgument . h " <nl> # include " swift / SIL / SILBuilder . h " <nl> # include " swift / SIL / SILFunction . h " <nl> mmm a / lib / SILPasses / Utils / Local . cpp <nl> ppp b / lib / SILPasses / Utils / Local . cpp <nl> <nl> # include " swift / SILPasses / Utils / Local . h " <nl> # include " swift / SILAnalysis / Analysis . h " <nl> # include " swift / SILAnalysis / DominanceAnalysis . h " <nl> - # include " swift / SIL / CallGraph . h " <nl> # include " swift / SIL / SILArgument . h " <nl> # include " swift / SIL / SILBuilder . h " <nl> # include " swift / SIL / SILModule . h " <nl>
Remove include of CallGraph . h since it is not needed .
apple/swift
feae9cc517245aed60e68548c1beec589a6d8a38
2014-08-22T00:00:03Z
mmm a / flow / Arena . cpp <nl> ppp b / flow / Arena . cpp <nl> ArenaBlock * ArenaBlock : : create ( int dataSize , Reference < ArenaBlock > & next ) { <nl> b - > bigSize = reqSize ; <nl> b - > bigUsed = sizeof ( ArenaBlock ) ; <nl> <nl> - if ( FLOW_KNOBS & & g_trace_depth = = 0 & & <nl> + if ( FLOW_KNOBS & & ! g_tracing_allocation & & <nl> nondeterministicRandom ( ) - > random01 ( ) < ( reqSize / FLOW_KNOBS - > HUGE_ARENA_LOGGING_BYTES ) ) { <nl> + g_tracing_allocation = true ; <nl> hugeArenaSample ( reqSize ) ; <nl> + g_tracing_allocation = false ; <nl> } <nl> g_hugeArenaMemory . fetch_add ( reqSize ) ; <nl> <nl> mmm a / flow / FastAlloc . cpp <nl> ppp b / flow / FastAlloc . cpp <nl> void FastAllocator < Size > : : getMagazine ( ) { <nl> / / FIXME : We should be able to allocate larger magazine sizes here if we <nl> / / detect that the underlying system supports hugepages . Using hugepages <nl> / / with smaller - than - 2MiB magazine sizes strands memory . See issue # 909 . <nl> - if ( FLOW_KNOBS & & g_trace_depth = = 0 & & nondeterministicRandom ( ) - > random01 ( ) < ( magazine_size * Size ) / FLOW_KNOBS - > FAST_ALLOC_LOGGING_BYTES ) { <nl> + if ( FLOW_KNOBS & & ! g_tracing_allocation & & nondeterministicRandom ( ) - > random01 ( ) < ( magazine_size * Size ) / FLOW_KNOBS - > FAST_ALLOC_LOGGING_BYTES ) { <nl> + g_tracing_allocation = true ; <nl> TraceEvent ( " GetMagazineSample " ) . detail ( " Size " , Size ) . backtrace ( ) ; <nl> + g_tracing_allocation = false ; <nl> } <nl> block = ( void * * ) : : allocate ( magazine_size * Size , false ) ; <nl> # endif <nl> mmm a / flow / Trace . cpp <nl> ppp b / flow / Trace . cpp <nl> <nl> # undef min <nl> # endif <nl> <nl> - thread_local int g_trace_depth = 0 ; <nl> + thread_local bool g_tracing_allocation = false ; <nl> <nl> class DummyThreadPool : public IThreadPool , ReferenceCounted < DummyThreadPool > { <nl> public : <nl> TraceEvent & TraceEvent : : operator = ( TraceEvent & & ev ) { <nl> } <nl> <nl> TraceEvent : : TraceEvent ( const char * type , UID id ) : id ( id ) , type ( type ) , severity ( SevInfo ) , initialized ( false ) , enabled ( true ) , logged ( false ) { <nl> - g_trace_depth + + ; <nl> setMaxFieldLength ( 0 ) ; <nl> setMaxEventLength ( 0 ) ; <nl> } <nl> TraceEvent : : TraceEvent ( Severity severity , const char * type , UID id ) <nl> : id ( id ) , type ( type ) , severity ( severity ) , initialized ( false ) , logged ( false ) , <nl> enabled ( g_network = = nullptr | | FLOW_KNOBS - > MIN_TRACE_SEVERITY < = severity ) { <nl> - g_trace_depth + + ; <nl> setMaxFieldLength ( 0 ) ; <nl> setMaxEventLength ( 0 ) ; <nl> } <nl> TraceEvent : : TraceEvent ( TraceInterval & interval , UID id ) <nl> initialized ( false ) , logged ( false ) , <nl> enabled ( g_network = = nullptr | | FLOW_KNOBS - > MIN_TRACE_SEVERITY < = interval . severity ) { <nl> <nl> - g_trace_depth + + ; <nl> setMaxFieldLength ( 0 ) ; <nl> setMaxEventLength ( 0 ) ; <nl> <nl> TraceEvent : : TraceEvent ( Severity severity , TraceInterval & interval , UID id ) <nl> initialized ( false ) , logged ( false ) , <nl> enabled ( g_network = = nullptr | | FLOW_KNOBS - > MIN_TRACE_SEVERITY < = severity ) { <nl> <nl> - g_trace_depth + + ; <nl> setMaxFieldLength ( 0 ) ; <nl> setMaxEventLength ( 0 ) ; <nl> <nl> void TraceEvent : : log ( ) { <nl> TraceEvent ( SevError , " TraceEventLoggingError " ) . error ( e , true ) ; <nl> } <nl> delete tmpEventMetric ; <nl> - g_trace_depth - - ; <nl> logged = true ; <nl> } <nl> } <nl> mmm a / flow / Trace . h <nl> ppp b / flow / Trace . h <nl> inline int fastrand ( ) { <nl> / / inline static bool TRACE_SAMPLE ( ) { return fastrand ( ) < 16 ; } <nl> inline static bool TRACE_SAMPLE ( ) { return false ; } <nl> <nl> - extern thread_local int g_trace_depth ; <nl> + extern thread_local bool g_tracing_allocation ; <nl> <nl> enum Severity { <nl> SevSample = 1 , <nl>
Don ' t disallow allocation tracking when a trace event is open because we now have state trace events . Instead , only block allocation tracking while we are in the middle of allocation tracking already to prevent recursion .
apple/foundationdb
2466749648176f074dd4337f3eb8d2c154c6f713
2020-03-12T18:17:49Z
mmm a / test / functional / wallet_hd . py <nl> ppp b / test / functional / wallet_hd . py <nl> <nl> from test_framework . util import ( <nl> assert_equal , <nl> connect_nodes , <nl> - assert_raises_rpc_error <nl> + assert_raises_rpc_error , <nl> ) <nl> <nl> <nl> def run_test ( self ) : <nl> <nl> # create an internal key <nl> change_addr = self . nodes [ 1 ] . getrawchangeaddress ( ) <nl> - change_addrV = self . nodes [ 1 ] . getaddressinfo ( change_addr ) <nl> + change_addrV = self . nodes [ 1 ] . getaddressinfo ( change_addr ) <nl> if self . options . descriptors : <nl> assert_equal ( change_addrV [ " hdkeypath " ] , " m / 84 ' / 1 ' / 0 ' / 1 / 0 " ) <nl> else : <nl> - assert_equal ( change_addrV [ " hdkeypath " ] , " m / 0 ' / 1 ' / 0 ' " ) # first internal child key <nl> + assert_equal ( change_addrV [ " hdkeypath " ] , " m / 0 ' / 1 ' / 0 ' " ) # first internal child key <nl> <nl> # Import a non - HD private key in the HD wallet <nl> non_hd_add = ' bcrt1qmevj8zfx0wdvp05cqwkmr6mxkfx60yezwjksmt ' <nl> def run_test ( self ) : <nl> if self . options . descriptors : <nl> assert_equal ( hd_info [ " hdkeypath " ] , " m / 84 ' / 1 ' / 0 ' / 0 / " + str ( i ) ) <nl> else : <nl> - assert_equal ( hd_info [ " hdkeypath " ] , " m / 0 ' / 0 ' / " + str ( i ) + " ' " ) <nl> + assert_equal ( hd_info [ " hdkeypath " ] , " m / 0 ' / 0 ' / " + str ( i ) + " ' " ) <nl> assert_equal ( hd_info [ " hdmasterfingerprint " ] , hd_fingerprint ) <nl> self . nodes [ 0 ] . sendtoaddress ( hd_add , 1 ) <nl> self . nodes [ 0 ] . generate ( 1 ) <nl> def run_test ( self ) : <nl> <nl> # create an internal key ( again ) <nl> change_addr = self . nodes [ 1 ] . getrawchangeaddress ( ) <nl> - change_addrV = self . nodes [ 1 ] . getaddressinfo ( change_addr ) <nl> + change_addrV = self . nodes [ 1 ] . getaddressinfo ( change_addr ) <nl> if self . options . descriptors : <nl> assert_equal ( change_addrV [ " hdkeypath " ] , " m / 84 ' / 1 ' / 0 ' / 1 / 1 " ) <nl> else : <nl> - assert_equal ( change_addrV [ " hdkeypath " ] , " m / 0 ' / 1 ' / 1 ' " ) # second internal child key <nl> + assert_equal ( change_addrV [ " hdkeypath " ] , " m / 0 ' / 1 ' / 1 ' " ) # second internal child key <nl> <nl> self . sync_all ( ) <nl> assert_equal ( self . nodes [ 1 ] . getbalance ( ) , NUM_HD_ADDS + 1 ) <nl> def run_test ( self ) : <nl> # otherwise node1 would auto - recover all funds in flag the keypool keys as used <nl> shutil . rmtree ( os . path . join ( self . nodes [ 1 ] . datadir , self . chain , " blocks " ) ) <nl> shutil . rmtree ( os . path . join ( self . nodes [ 1 ] . datadir , self . chain , " chainstate " ) ) <nl> - shutil . copyfile ( os . path . join ( self . nodes [ 1 ] . datadir , " hd . bak " ) , os . path . join ( self . nodes [ 1 ] . datadir , self . chain , ' wallets ' , " wallet . dat " ) ) <nl> + shutil . copyfile ( <nl> + os . path . join ( self . nodes [ 1 ] . datadir , " hd . bak " ) , <nl> + os . path . join ( self . nodes [ 1 ] . datadir , self . chain , ' wallets ' , " wallet . dat " ) , <nl> + ) <nl> self . start_node ( 1 ) <nl> <nl> # Assert that derivation is deterministic <nl> def run_test ( self ) : <nl> if self . options . descriptors : <nl> assert_equal ( hd_info_2 [ " hdkeypath " ] , " m / 84 ' / 1 ' / 0 ' / 0 / " + str ( i ) ) <nl> else : <nl> - assert_equal ( hd_info_2 [ " hdkeypath " ] , " m / 0 ' / 0 ' / " + str ( i ) + " ' " ) <nl> + assert_equal ( hd_info_2 [ " hdkeypath " ] , " m / 0 ' / 0 ' / " + str ( i ) + " ' " ) <nl> assert_equal ( hd_info_2 [ " hdmasterfingerprint " ] , hd_fingerprint ) <nl> assert_equal ( hd_add , hd_add_2 ) <nl> connect_nodes ( self . nodes [ 0 ] , 1 ) <nl> def run_test ( self ) : <nl> self . stop_node ( 1 ) <nl> shutil . rmtree ( os . path . join ( self . nodes [ 1 ] . datadir , self . chain , " blocks " ) ) <nl> shutil . rmtree ( os . path . join ( self . nodes [ 1 ] . datadir , self . chain , " chainstate " ) ) <nl> - shutil . copyfile ( os . path . join ( self . nodes [ 1 ] . datadir , " hd . bak " ) , os . path . join ( self . nodes [ 1 ] . datadir , self . chain , " wallets " , " wallet . dat " ) ) <nl> + shutil . copyfile ( <nl> + os . path . join ( self . nodes [ 1 ] . datadir , " hd . bak " ) , <nl> + os . path . join ( self . nodes [ 1 ] . datadir , self . chain , " wallets " , " wallet . dat " ) , <nl> + ) <nl> self . start_node ( 1 , extra_args = self . extra_args [ 1 ] ) <nl> connect_nodes ( self . nodes [ 0 ] , 1 ) <nl> self . sync_all ( ) <nl> def run_test ( self ) : <nl> new_masterkeyid = self . nodes [ 1 ] . getwalletinfo ( ) [ ' hdseedid ' ] <nl> assert orig_masterkeyid ! = new_masterkeyid <nl> addr = self . nodes [ 1 ] . getnewaddress ( ) <nl> - assert_equal ( self . nodes [ 1 ] . getaddressinfo ( addr ) [ ' hdkeypath ' ] , ' m / 0 \ ' / 0 \ ' / 0 \ ' ' ) # Make sure the new address is the first from the keypool <nl> - self . nodes [ 1 ] . keypoolrefill ( 1 ) # Fill keypool with 1 key <nl> + # Make sure the new address is the first from the keypool <nl> + assert_equal ( self . nodes [ 1 ] . getaddressinfo ( addr ) [ ' hdkeypath ' ] , ' m / 0 \ ' / 0 \ ' / 0 \ ' ' ) <nl> + self . nodes [ 1 ] . keypoolrefill ( 1 ) # Fill keypool with 1 key <nl> <nl> # Set a new HD seed on node 1 without flushing the keypool <nl> new_seed = self . nodes [ 0 ] . dumpprivkey ( self . nodes [ 0 ] . getnewaddress ( ) ) <nl> def run_test ( self ) : <nl> assert orig_masterkeyid ! = new_masterkeyid <nl> addr = self . nodes [ 1 ] . getnewaddress ( ) <nl> assert_equal ( orig_masterkeyid , self . nodes [ 1 ] . getaddressinfo ( addr ) [ ' hdseedid ' ] ) <nl> - assert_equal ( self . nodes [ 1 ] . getaddressinfo ( addr ) [ ' hdkeypath ' ] , ' m / 0 \ ' / 0 \ ' / 1 \ ' ' ) # Make sure the new address continues previous keypool <nl> + # Make sure the new address continues previous keypool <nl> + assert_equal ( self . nodes [ 1 ] . getaddressinfo ( addr ) [ ' hdkeypath ' ] , ' m / 0 \ ' / 0 \ ' / 1 \ ' ' ) <nl> <nl> # Check that the next address is from the new seed <nl> self . nodes [ 1 ] . keypoolrefill ( 1 ) <nl> next_addr = self . nodes [ 1 ] . getnewaddress ( ) <nl> assert_equal ( new_masterkeyid , self . nodes [ 1 ] . getaddressinfo ( next_addr ) [ ' hdseedid ' ] ) <nl> - assert_equal ( self . nodes [ 1 ] . getaddressinfo ( next_addr ) [ ' hdkeypath ' ] , ' m / 0 \ ' / 0 \ ' / 0 \ ' ' ) # Make sure the new address is not from previous keypool <nl> + # Make sure the new address is not from previous keypool <nl> + assert_equal ( self . nodes [ 1 ] . getaddressinfo ( next_addr ) [ ' hdkeypath ' ] , ' m / 0 \ ' / 0 \ ' / 0 \ ' ' ) <nl> assert next_addr ! = addr <nl> <nl> # Sethdseed parameter validity <nl> def run_test ( self ) : <nl> <nl> self . nodes [ 1 ] . createwallet ( wallet_name = ' restore ' , blank = True ) <nl> restore_rpc = self . nodes [ 1 ] . get_wallet_rpc ( ' restore ' ) <nl> - restore_rpc . sethdseed ( True , seed ) # Set to be the same seed as origin_rpc <nl> - restore_rpc . sethdseed ( True ) # Rotate to a new seed , making original ` seed ` inactive <nl> + restore_rpc . sethdseed ( True , seed ) # Set to be the same seed as origin_rpc <nl> + restore_rpc . sethdseed ( True ) # Rotate to a new seed , making original ` seed ` inactive <nl> <nl> self . nodes [ 1 ] . createwallet ( wallet_name = ' restore2 ' , blank = True ) <nl> restore2_rpc = self . nodes [ 1 ] . get_wallet_rpc ( ' restore2 ' ) <nl> - restore2_rpc . sethdseed ( True , seed ) # Set to be the same seed as origin_rpc <nl> - restore2_rpc . sethdseed ( True ) # Rotate to a new seed , making original ` seed ` inactive <nl> + restore2_rpc . sethdseed ( True , seed ) # Set to be the same seed as origin_rpc <nl> + restore2_rpc . sethdseed ( True ) # Rotate to a new seed , making original ` seed ` inactive <nl> <nl> # Check persistence of inactive seed by reloading restore . restore2 is still loaded to test the case where the wallet is not reloaded <nl> restore_rpc . unloadwallet ( ) <nl> def run_test ( self ) : <nl> # Empty origin keypool and get an address that is beyond the initial keypool <nl> origin_rpc . getnewaddress ( ) <nl> origin_rpc . getnewaddress ( ) <nl> - last_addr = origin_rpc . getnewaddress ( ) # Last address of initial keypool <nl> - addr = origin_rpc . getnewaddress ( ) # First address beyond initial keypool <nl> + last_addr = origin_rpc . getnewaddress ( ) # Last address of initial keypool <nl> + addr = origin_rpc . getnewaddress ( ) # First address beyond initial keypool <nl> <nl> # Check that the restored seed has last_addr but does not have addr <nl> info = restore_rpc . getaddressinfo ( last_addr ) <nl> def run_test ( self ) : <nl> txid = self . nodes [ 0 ] . sendtoaddress ( addr , 1 ) <nl> origin_rpc . sendrawtransaction ( self . nodes [ 0 ] . gettransaction ( txid ) [ ' hex ' ] ) <nl> self . nodes [ 0 ] . generate ( 1 ) <nl> + self . sync_blocks ( ) <nl> origin_rpc . gettransaction ( txid ) <nl> assert_raises_rpc_error ( - 5 , ' Invalid or non - wallet transaction id ' , restore_rpc . gettransaction , txid ) <nl> out_of_kp_txid = txid <nl> def run_test ( self ) : <nl> txid = self . nodes [ 0 ] . sendtoaddress ( last_addr , 1 ) <nl> origin_rpc . sendrawtransaction ( self . nodes [ 0 ] . gettransaction ( txid ) [ ' hex ' ] ) <nl> self . nodes [ 0 ] . generate ( 1 ) <nl> + self . sync_blocks ( ) <nl> origin_rpc . gettransaction ( txid ) <nl> restore_rpc . gettransaction ( txid ) <nl> assert_raises_rpc_error ( - 5 , ' Invalid or non - wallet transaction id ' , restore_rpc . gettransaction , out_of_kp_txid ) <nl> def run_test ( self ) : <nl> info = restore2_rpc . getaddressinfo ( addr ) <nl> assert_equal ( info [ ' ismine ' ] , False ) <nl> <nl> + <nl> if __name__ = = ' __main__ ' : <nl> - WalletHDTest ( ) . main ( ) <nl> + WalletHDTest ( ) . main ( ) <nl>
Merge : test : Add missing sync_blocks to wallet_hd
bitcoin/bitcoin
45a1489997a51c2188e841030f0d9eb3e8777032
2020-06-02T11:13:51Z
mmm a / jstests / noPassthrough / server_transaction_metrics . js <nl> ppp b / jstests / noPassthrough / server_transaction_metrics . js <nl> <nl> assert ( serverStatusResponse . hasOwnProperty ( " transactions " ) , <nl> " Expected the serverStatus response to have a ' transactions ' field \ n " + <nl> serverStatusResponse ) ; <nl> + assert ( serverStatusResponse . transactions . hasOwnProperty ( " currentOpen " ) , <nl> + " The ' transactions ' field in serverStatus did not have the ' currentOpen ' field \ n " + <nl> + serverStatusResponse . transactions ) ; <nl> assert ( serverStatusResponse . transactions . hasOwnProperty ( " totalAborted " ) , <nl> " The ' transactions ' field in serverStatus did not have the ' totalAborted ' field \ n " + <nl> serverStatusResponse . transactions ) ; <nl> <nl> " expected " + valueName + " to increase by " + expectedIncrement ) ; <nl> } <nl> <nl> + / / Set up the replica set . <nl> const rst = new ReplSetTest ( { nodes : 1 } ) ; <nl> rst . startSet ( ) ; <nl> rst . initiate ( ) ; <nl> <nl> <nl> / / This transaction will commit . <nl> jsTest . log ( " Start a transaction and then commit it . " ) ; <nl> + <nl> + / / Compare server status after starting a transaction with the server status before . <nl> session . startTransaction ( ) ; <nl> assert . commandWorked ( sessionColl . insert ( { _id : " insert - 1 " } ) ) ; <nl> - session . commitTransaction ( ) ; <nl> + let newStatus = assert . commandWorked ( testDB . adminCommand ( { serverStatus : 1 } ) ) ; <nl> + verifyServerStatusFields ( newStatus ) ; <nl> + / / Test that the open transaction counter is incremented while inside the transaction . <nl> + verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " currentOpen " , 1 ) ; <nl> <nl> / / Compare server status after the transaction commit with the server status before . <nl> - let newStatus = assert . commandWorked ( testDB . adminCommand ( { serverStatus : 1 } ) ) ; <nl> + session . commitTransaction ( ) ; <nl> + newStatus = assert . commandWorked ( testDB . adminCommand ( { serverStatus : 1 } ) ) ; <nl> verifyServerStatusFields ( newStatus ) ; <nl> verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " totalStarted " , 1 ) ; <nl> verifyServerStatusChange ( <nl> initialStatus . transactions , newStatus . transactions , " totalCommitted " , 1 ) ; <nl> + / / Test that current open counter is decremented on commit . <nl> + verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " currentOpen " , 0 ) ; <nl> <nl> / / This transaction will abort . <nl> jsTest . log ( " Start a transaction and then abort it . " ) ; <nl> + <nl> + / / Compare server status after starting a transaction with the server status before . <nl> session . startTransaction ( ) ; <nl> assert . commandWorked ( sessionColl . insert ( { _id : " insert - 2 " } ) ) ; <nl> - session . abortTransaction ( ) ; <nl> + newStatus = assert . commandWorked ( testDB . adminCommand ( { serverStatus : 1 } ) ) ; <nl> + verifyServerStatusFields ( newStatus ) ; <nl> + / / Test that the open transaction counter is incremented while inside the transaction . <nl> + verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " currentOpen " , 1 ) ; <nl> <nl> / / Compare server status after the transaction abort with the server status before . <nl> + session . abortTransaction ( ) ; <nl> newStatus = assert . commandWorked ( testDB . adminCommand ( { serverStatus : 1 } ) ) ; <nl> verifyServerStatusFields ( newStatus ) ; <nl> verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " totalStarted " , 2 ) ; <nl> verifyServerStatusChange ( <nl> initialStatus . transactions , newStatus . transactions , " totalCommitted " , 1 ) ; <nl> verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " totalAborted " , 1 ) ; <nl> + / / Test that current open counter is decremented on abort . <nl> + verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " currentOpen " , 0 ) ; <nl> <nl> / / This transaction will abort due to a duplicate key insert . <nl> jsTest . log ( " Start a transaction that will abort on a duplicated key error . " ) ; <nl> + <nl> + / / Compare server status after starting a transaction with the server status before . <nl> session . startTransaction ( ) ; <nl> / / Inserting a new document will work fine , and the transaction starts . <nl> assert . commandWorked ( sessionColl . insert ( { _id : " insert - 3 " } ) ) ; <nl> + newStatus = assert . commandWorked ( testDB . adminCommand ( { serverStatus : 1 } ) ) ; <nl> + verifyServerStatusFields ( newStatus ) ; <nl> + / / Test that the open transaction counter is incremented while inside the transaction . <nl> + verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " currentOpen " , 1 ) ; <nl> + <nl> + / / Compare server status after the transaction abort with the server status before . <nl> / / The duplicated insert will fail , causing the transaction to abort . <nl> assert . commandFailedWithCode ( sessionColl . insert ( { _id : " insert - 3 " } ) , ErrorCodes . DuplicateKey ) ; <nl> / / Ensure that the transaction was aborted on failure . <nl> assert . commandFailedWithCode ( session . commitTransaction_forTesting ( ) , <nl> ErrorCodes . NoSuchTransaction ) ; <nl> - <nl> - / / Compare server status after the transaction abort with the server status before . <nl> newStatus = assert . commandWorked ( testDB . adminCommand ( { serverStatus : 1 } ) ) ; <nl> verifyServerStatusFields ( newStatus ) ; <nl> verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " totalStarted " , 3 ) ; <nl> verifyServerStatusChange ( <nl> initialStatus . transactions , newStatus . transactions , " totalCommitted " , 1 ) ; <nl> verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " totalAborted " , 2 ) ; <nl> + / / Test that current open counter is decremented on abort caused by an error . <nl> + verifyServerStatusChange ( initialStatus . transactions , newStatus . transactions , " currentOpen " , 0 ) ; <nl> <nl> + / / End the session and stop the replica set . <nl> session . endSession ( ) ; <nl> rst . stopSet ( ) ; <nl> } ( ) ) ; <nl> mmm a / src / mongo / db / server_transactions_metrics . cpp <nl> ppp b / src / mongo / db / server_transactions_metrics . cpp <nl> void ServerTransactionsMetrics : : incrementTotalCommitted ( ) { <nl> } <nl> <nl> void ServerTransactionsMetrics : : updateStats ( TransactionsStats * stats ) { <nl> + stats - > setCurrentOpen ( _currentOpen . load ( ) ) ; <nl> stats - > setTotalAborted ( _totalAborted . load ( ) ) ; <nl> stats - > setTotalCommitted ( _totalCommitted . load ( ) ) ; <nl> stats - > setTotalStarted ( _totalStarted . load ( ) ) ; <nl>
SERVER - 35294 Add total number of open transactions to serverStatus
mongodb/mongo
591dc25f7d7d3d637a9320b19b02c7f548cdf367
2018-07-05T20:30:03Z
mmm a / lib / AST / Type . cpp <nl> ppp b / lib / AST / Type . cpp <nl> static Type getMemberForBaseType ( LookupConformanceFn lookupConformances , <nl> <nl> if ( ! conformance ) return failed ( ) ; <nl> if ( ! conformance - > isConcrete ( ) ) return failed ( ) ; <nl> - assert ( conformance - > getConditionalRequirements ( ) . empty ( ) & & <nl> - " unhandled conditional requirements " ) ; <nl> <nl> / / Retrieve the type witness . <nl> auto witness = <nl>
[ AST ] Remove another bogus assertion .
apple/swift
940ecda379ed8954065cfcab5952d7049b14a589
2017-11-17T18:59:48Z
mmm a / xbmc / FileItem . cpp <nl> ppp b / xbmc / FileItem . cpp <nl> void CFileItem : : FillInDefaultIcon ( ) <nl> } <nl> } <nl> / / Set the icon overlays ( if applicable ) <nl> - if ( ! HasOverlay ( ) ) <nl> + if ( ! HasOverlay ( ) & & ! HasProperty ( " icon_never_overlay " ) ) <nl> { <nl> if ( URIUtils : : IsInRAR ( m_strPath ) ) <nl> SetOverlayImage ( CGUIListItem : : ICON_OVERLAY_RAR ) ; <nl> mmm a / xbmc / FileItem . h <nl> ppp b / xbmc / FileItem . h <nl> class CFileItemList : public CFileItem <nl> <nl> SortOrder GetSortOrder ( ) const { return m_sortDescription . sortOrder ; } <nl> SortBy GetSortMethod ( ) const { return m_sortDescription . sortBy ; } <nl> + void SetSortOrder ( SortOrder sortOrder ) { m_sortDescription . sortOrder = sortOrder ; } <nl> + void SetSortMethod ( SortBy sortBy ) { m_sortDescription . sortBy = sortBy ; } <nl> + <nl> / * ! \ brief load a CFileItemList out of the cache <nl> <nl> The file list may be cached based on which window we ' re viewing in , as different <nl> mmm a / xbmc / dbwrappers / mysqldataset . cpp <nl> ppp b / xbmc / dbwrappers / mysqldataset . cpp <nl> int MysqlDatabase : : drop_analytics ( void ) { <nl> if ( ( ret = query_with_reconnect ( sql ) ) ! = MYSQL_OK ) <nl> { <nl> mysql_free_result ( res ) ; <nl> - throw DbErrors ( " Can ' t create trigger ' % s ' \ nError : % d " , row [ 0 ] , ret ) ; <nl> + throw DbErrors ( " Can ' t drop trigger ' % s ' \ nError : % d " , row [ 0 ] , ret ) ; <nl> + } <nl> + } <nl> + mysql_free_result ( res ) ; <nl> + } <nl> + <nl> + / / Native functions <nl> + sprintf ( sql , <nl> + " SELECT routine_name " <nl> + " FROM information_schema . routines " <nl> + " WHERE routine_type = ' FUNCTION ' and routine_schema = ' % s ' " , <nl> + db . c_str ( ) ) ; <nl> + if ( ( ret = query_with_reconnect ( sql ) ) ! = MYSQL_OK ) <nl> + throw DbErrors ( " Can ' t determine list of routines to drop . " ) ; <nl> + <nl> + res = mysql_store_result ( conn ) ; <nl> + <nl> + if ( res ) <nl> + { <nl> + while ( ( row = mysql_fetch_row ( res ) ) ! = NULL ) <nl> + { <nl> + sprintf ( sql , " DROP FUNCTION ` % s ` . % s " , db . c_str ( ) , row [ 0 ] ) ; <nl> + <nl> + if ( ( ret = query_with_reconnect ( sql ) ) ! = MYSQL_OK ) <nl> + { <nl> + mysql_free_result ( res ) ; <nl> + throw DbErrors ( " Can ' t drop function ' % s ' \ nError : % d " , row [ 0 ] , ret ) ; <nl> } <nl> } <nl> mysql_free_result ( res ) ; <nl> std : : string MysqlDatabase : : vprepare ( const char * format , va_list args ) <nl> while ( ( pos = strResult . find ( " COLLATE NOCASE " , pos ) ) ! = std : : string : : npos ) <nl> strResult . erase ( pos + + , 15 ) ; <nl> <nl> + / / Remove COLLATE ALPHANUM the SQLite custom collation . <nl> + pos = 0 ; <nl> + while ( ( pos = strResult . find ( " COLLATE ALPHANUM " , pos ) ) ! = std : : string : : npos ) <nl> + strResult . erase ( pos + + , 15 ) ; <nl> + <nl> return strResult ; <nl> } <nl> <nl> mmm a / xbmc / dbwrappers / sqlitedataset . cpp <nl> ppp b / xbmc / dbwrappers / sqlitedataset . cpp <nl> const char * SqliteDatabase : : getErrorMsg ( ) { <nl> return error . c_str ( ) ; <nl> } <nl> <nl> + static int AlphaNumericCollation ( <nl> + void * not_used , int nKey1 , const void * pKey1 , int nKey2 , const void * pKey2 ) <nl> + { <nl> + return StringUtils : : AlphaNumericCollation ( nKey1 , pKey1 , nKey2 , pKey2 ) ; <nl> + } <nl> + <nl> int SqliteDatabase : : connect ( bool create ) { <nl> if ( host . empty ( ) | | db . empty ( ) ) <nl> return DB_CONNECTION_NONE ; <nl> int SqliteDatabase : : connect ( bool create ) { <nl> CLog : : Log ( LOGFATAL , " SqliteDatabase : % s is read only " , db_fullpath . c_str ( ) ) ; <nl> throw std : : runtime_error ( " SqliteDatabase : " + db_fullpath + " is read only " ) ; <nl> } <nl> + errorCode = sqlite3_create_collation ( conn , " ALPHANUM " , SQLITE_UTF8 , 0 , AlphaNumericCollation ) ; <nl> + if ( errorCode ! = SQLITE_OK ) <nl> + { <nl> + CLog : : Log ( LOGFATAL , " SqliteDatabase : can not register collation " ) ; <nl> + throw std : : runtime_error ( " SqliteDatabase : can not register collation " + db_fullpath ) ; <nl> + } <nl> active = true ; <nl> return DB_CONNECTION_OK ; <nl> } <nl> mmm a / xbmc / interfaces / json - rpc / schema / version . txt <nl> ppp b / xbmc / interfaces / json - rpc / schema / version . txt <nl> @ @ - 1 + 1 @ @ <nl> - JSONRPC_VERSION 11 . 8 . 1 <nl> + JSONRPC_VERSION 11 . 8 . 2 <nl> mmm a / xbmc / music / MusicDatabase . cpp <nl> ppp b / xbmc / music / MusicDatabase . cpp <nl> void CMusicDatabase : : CreateTables ( ) <nl> " lastplayed varchar ( 20 ) default NULL , " <nl> " rating FLOAT NOT NULL DEFAULT 0 , votes INTEGER NOT NULL DEFAULT 0 , " <nl> " userrating INTEGER NOT NULL DEFAULT 0 , " <nl> - " comment text , mood text , iBPM integer , iBitRate INTEGER NOT NULL DEFAULT 0 , " <nl> + " comment text , mood text , iBPM INTEGER NOT NULL DEFAULT 0 , " <nl> + " iBitRate INTEGER NOT NULL DEFAULT 0 , " <nl> " iSampleRate INTEGER NOT NULL DEFAULT 0 , iChannels INTEGER NOT NULL DEFAULT 0 , " <nl> " strReplayGain text , dateAdded text ) " ) ; <nl> CLog : : Log ( LOGINFO , " create song_artist table " ) ; <nl> void CMusicDatabase : : CreateAnalytics ( ) <nl> " DELETE FROM source_path WHERE source_path . idSource = old . idSource ; " <nl> " DELETE FROM album_source WHERE album_source . idSource = old . idSource ; " <nl> " END " ) ; <nl> - <nl> + <nl> + / / Create native functions stored in DB ( MySQL / MariaDB only ) <nl> + CreateNativeDBFunctions ( ) ; <nl> + <nl> / / we create views last to ensure all indexes are rolled in <nl> CreateViews ( ) ; <nl> <nl> void CMusicDatabase : : CreateViews ( ) <nl> " song_artist . idRole = role . idRole " ) ; <nl> } <nl> <nl> + void CMusicDatabase : : CreateNativeDBFunctions ( ) <nl> + { <nl> + / / Create native functions in MySQL / MariaDB database only <nl> + if ( ! StringUtils : : EqualsNoCase ( <nl> + CServiceBroker : : GetSettingsComponent ( ) - > GetAdvancedSettings ( ) - > m_databaseMusic . type , <nl> + " mysql " ) ) <nl> + return ; <nl> + CLog : : Log ( LOGINFO , " Create native MySQL / MariaDB functions " ) ; <nl> + / * Functions to do the natural number sorting and all ascii symbol char at top adjustments to <nl> + default utf8_general_ci collation that SQLite does via a collation sequence callback <nl> + function to StringUtils : : AlphaNumericCompare <nl> + ! @ todo : the video needs these defined too for sorting in DB , then creation can be made common <nl> + * / <nl> + / / clang - format off <nl> + / / udfFirstNumberPos finds the position of the first digit in a string <nl> + m_pDS - > exec ( " DROP FUNCTION IF EXISTS udfFirstNumberPos " ) ; <nl> + m_pDS - > exec ( " CREATE FUNCTION udfFirstNumberPos ( instring VARCHAR ( 256 ) ) \ n " <nl> + " RETURNS int \ n " <nl> + " LANGUAGE SQL \ n " <nl> + " DETERMINISTIC \ n " <nl> + " NO SQL \ n " <nl> + " SQL SECURITY INVOKER \ n " <nl> + " BEGIN \ n " <nl> + " DECLARE position int ; \ n " <nl> + " DECLARE tmppos int ; \ n " <nl> + " SET position = 1000 ; \ n " <nl> + " SET tmppos = LOCATE ( ' 0 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 1 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 2 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 3 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 4 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 5 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 6 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 7 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 8 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " SET tmppos = LOCATE ( ' 9 ' , instring ) ; IF ( tmppos > 0 AND tmppos < position ) THEN SET position = tmppos ; END IF ; \ n " <nl> + " IF ( position = 1000 ) THEN RETURN 0 ; END IF ; \ n " <nl> + " RETURN position ; \ n " <nl> + " END \ n " ) ; <nl> + <nl> + / / udfSymbolShift adds " / " ( the last symbol before " 0 " ) , in front any of the chars input <nl> + m_pDS - > exec ( " DROP FUNCTION IF EXISTS udfSymbolShift " ) ; <nl> + m_pDS - > exec ( " CREATE FUNCTION udfSymbolShift ( instring varchar ( 256 ) , symbolChars char ( 25 ) ) \ n " <nl> + " RETURNS varchar ( 256 ) \ n " <nl> + " LANGUAGE SQL \ n " <nl> + " DETERMINISTIC \ n " <nl> + " NO SQL \ n " <nl> + " SQL SECURITY INVOKER \ n " <nl> + " BEGIN \ n " <nl> + " DECLARE sortString varchar ( 256 ) ; \ n " <nl> + " DECLARE i int ; \ n " <nl> + " DECLARE symbolCharsLen int ; \ n " <nl> + " DECLARE symbol char ( 1 ) ; \ n " <nl> + " SET sortString = instring ; \ n " <nl> + " SET i = 1 ; \ n " <nl> + " SET symbolCharsLen = CHAR_LENGTH ( symbolChars ) ; \ n " <nl> + " WHILE ( i < = symbolCharsLen ) DO \ n " <nl> + " SET symbol = SUBSTRING ( symbolChars , i , 1 ) ; \ n " <nl> + " SET sortString = REPLACE ( sortString , symbol , CONCAT ( ' / ' , symbol ) ) ; \ n " <nl> + " SET i = i + 1 ; \ n " <nl> + " END WHILE ; \ n " <nl> + " RETURN sortString ; \ n " <nl> + " END \ n " ) ; <nl> + <nl> + / / udfNaturalSortFormat - provide natural number sorting and ascii symbols above numbers <nl> + m_pDS - > exec ( " DROP FUNCTION IF EXISTS udfNaturalSortFormat " ) ; <nl> + m_pDS - > exec ( " CREATE FUNCTION udfNaturalSortFormat ( instring varchar ( 256 ) , numberLength int , " <nl> + " sameOrderChars char ( 25 ) ) \ n " <nl> + " RETURNS varchar ( 256 ) \ n " <nl> + " LANGUAGE SQL \ n " <nl> + " DETERMINISTIC \ n " <nl> + " NO SQL \ n " <nl> + " SQL SECURITY INVOKER \ n " <nl> + " BEGIN \ n " <nl> + " DECLARE sortString varchar ( 256 ) ; \ n " <nl> + " DECLARE numStartIndex int ; \ n " <nl> + " DECLARE numEndIndex int ; \ n " <nl> + " DECLARE padLength int ; \ n " <nl> + " DECLARE totalPadLength int ; \ n " <nl> + " DECLARE i int ; \ n " <nl> + " DECLARE sameOrderCharsLen int ; \ n " <nl> + " SET totalPadLength = 0 ; \ n " <nl> + " SET instring = TRIM ( instring ) ; \ n " <nl> + " SET sortString = instring ; \ n " <nl> + " SET numStartIndex = udfFirstNumberPos ( instring ) ; \ n " <nl> + " SET numEndIndex = 0 ; \ n " <nl> + " SET i = 1 ; \ n " <nl> + " SET sameOrderCharsLen = CHAR_LENGTH ( sameOrderChars ) ; \ n " <nl> + " WHILE ( i < = sameOrderCharsLen ) DO \ n " <nl> + " SET sortString = REPLACE ( sortString , SUBSTRING ( sameOrderChars , i , 1 ) , ' ' ) ; \ n " <nl> + " SET i = i + 1 ; \ n " <nl> + " END WHILE ; \ n " <nl> + " WHILE ( numStartIndex < > 0 ) DO \ n " <nl> + " SET numStartIndex = numStartIndex + numEndIndex ; \ n " <nl> + " SET numEndIndex = numStartIndex ; \ n " <nl> + " WHILE ( udfFirstNumberPos ( SUBSTRING ( instring , numEndIndex , 1 ) ) = 1 ) DO \ n " <nl> + " SET numEndIndex = numEndIndex + 1 ; \ n " <nl> + " END WHILE ; \ n " <nl> + " SET numEndIndex = numEndIndex - 1 ; \ n " <nl> + " SET padLength = numberLength - ( numEndIndex + 1 - numStartIndex ) ; \ n " <nl> + " IF padLength < 0 THEN \ n " <nl> + " SET padLength = 0 ; \ n " <nl> + " END IF ; \ n " <nl> + " SET sortString = INSERT ( sortString , numStartIndex + totalPadLength , 0 , REPEAT ( ' 0 ' , padLength ) ) ; \ n " <nl> + " SET totalPadLength = totalPadLength + padLength ; \ n " <nl> + " SET numStartIndex = udfFirstNumberPos ( RIGHT ( instring , CHAR_LENGTH ( instring ) - numEndIndex ) ) ; \ n " <nl> + " END WHILE ; \ n " <nl> + / / Shift ascii symbols : ; < = > ? @ [ \ ] ^ _ ` { | } ~ above 0 , note " \ " needs escaping <nl> + " SET sortString = udfSymbolShift ( sortString , ' : ; < = > ? @ [ \ \ ] ^ _ ` { | } ~ ' ) ; \ n " <nl> + " RETURN sortString ; \ n " <nl> + " END \ n " ) ; <nl> + / / clang - format on <nl> + } <nl> + <nl> void CMusicDatabase : : SplitPath ( const std : : string & strFileNameAndPath , std : : string & strPath , std : : string & strFileName ) <nl> { <nl> URIUtils : : Split ( strFileNameAndPath , strPath , strFileName ) ; <nl> bool CMusicDatabase : : GetArtistsByWhere ( const std : : string & strBaseDir , const Filt <nl> { <nl> extFilter . limit = <nl> DatabaseUtils : : BuildLimitClauseOnly ( sortDescription . limitEnd , sortDescription . limitStart ) ; <nl> - const std : : shared_ptr < CSettings > settings = <nl> - CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) ; <nl> - if ( settings - > GetBool ( CSettings : : SETTING_MUSICLIBRARY_USEARTISTSORTNAME ) ) <nl> - sorting . sortAttributes = <nl> - static_cast < SortAttribute > ( sorting . sortAttributes | SortAttributeUseArtistSortName ) ; <nl> - / / Set Orderby and add any extra fields needed for sort e . g . " artistname " scalar query <nl> - GetOrderFilter ( MediaTypeArtist , sorting , extFilter ) ; <nl> - strSQLExtra . clear ( ) ; <nl> - if ( ! BuildSQL ( strSQLExtra , extFilter , strSQLExtra ) ) <nl> - return false ; <nl> } <nl> <nl> + / / Apply sort in SQL <nl> + const std : : shared_ptr < CSettings > settings = <nl> + CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) ; <nl> + if ( settings - > GetBool ( CSettings : : SETTING_MUSICLIBRARY_USEARTISTSORTNAME ) ) <nl> + sorting . sortAttributes = <nl> + static_cast < SortAttribute > ( sorting . sortAttributes | SortAttributeUseArtistSortName ) ; <nl> + / / Set Orderby and add any extra fields needed for sort e . g . " artistname " scalar query <nl> + GetOrderFilter ( MediaTypeArtist , sorting , extFilter ) ; <nl> + <nl> + strSQLExtra . clear ( ) ; <nl> + if ( ! BuildSQL ( strSQLExtra , extFilter , strSQLExtra ) ) <nl> + return false ; <nl> + <nl> std : : string strSQL ; <nl> std : : string strFields = " artistview . * " ; <nl> if ( ! extFilter . fields . empty ( ) & & extFilter . fields . compare ( " * " ) ! = 0 ) <nl> bool CMusicDatabase : : GetArtistsByWhere ( const std : : string & strBaseDir , const Filt <nl> <nl> DatabaseResults results ; <nl> results . reserve ( iRowsFound ) ; <nl> - / / Avoid sorting when populating results when have limits so already sorted in SQL <nl> - sorting = sortDescription ; <nl> - if ( limitedInSQL ) <nl> - sorting . sortBy = SortByNone ; <nl> - if ( ! SortUtils : : SortFromDataset ( sorting , MediaTypeArtist , m_pDS , results ) ) <nl> + / / Populate results field vector from dataset <nl> + FieldList fields ; <nl> + if ( ! DatabaseUtils : : GetDatabaseResults ( MediaTypeArtist , fields , m_pDS , results ) ) <nl> return false ; <nl> + / / Store item list sort order <nl> + items . SetSortMethod ( sortDescription . sortBy ) ; <nl> + items . SetSortOrder ( sortDescription . sortOrder ) ; <nl> <nl> / / Get Artists from returned rows <nl> items . Reserve ( results . size ( ) ) ; <nl> bool CMusicDatabase : : GetArtistsByWhere ( const std : : string & strBaseDir , const Filt <nl> pItem - > SetPath ( itemUrl . ToString ( ) ) ; <nl> <nl> pItem - > GetMusicInfoTag ( ) - > SetDatabaseId ( artist . idArtist , MediaTypeArtist ) ; <nl> + / / Set icon now to avoid slow per item processing in FillInDefaultIcon later <nl> + pItem - > SetProperty ( " icon_never_overlay " , true ) ; <nl> pItem - > SetArt ( " icon " , " DefaultArtist . png " ) ; <nl> <nl> SetPropertiesFromArtist ( * pItem , artist ) ; <nl> bool CMusicDatabase : : GetArtistsByWhere ( const std : : string & strBaseDir , const Filt <nl> CLog : : Log ( LOGERROR , " % s - out of memory getting listing ( got % i ) " , __FUNCTION__ , items . Size ( ) ) ; <nl> } <nl> } <nl> - <nl> / / cleanup <nl> m_pDS - > close ( ) ; <nl> <nl> bool CMusicDatabase : : GetAlbumsByWhere ( const std : : string & baseDir , const Filter & <nl> return true ; <nl> } <nl> <nl> - / / Apply any limiting directly in SQL and so sort as well <nl> + / / Apply any limiting directly in SQL <nl> if ( limitedInSQL ) <nl> { <nl> extFilter . limit = <nl> DatabaseUtils : : BuildLimitClauseOnly ( sortDescription . limitEnd , sortDescription . limitStart ) ; <nl> - const std : : shared_ptr < CSettings > settings = <nl> - CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) ; <nl> - if ( settings - > GetBool ( CSettings : : SETTING_MUSICLIBRARY_USEARTISTSORTNAME ) ) <nl> - sorting . sortAttributes = <nl> - static_cast < SortAttribute > ( sorting . sortAttributes | SortAttributeUseArtistSortName ) ; <nl> - / / Set Orderby and add any extra fields needed for sort e . g . " artistname " scalar query <nl> - GetOrderFilter ( MediaTypeAlbum , sorting , extFilter ) ; <nl> - strSQLExtra . clear ( ) ; <nl> - if ( ! BuildSQL ( strSQLExtra , extFilter , strSQLExtra ) ) <nl> - return false ; <nl> } <nl> <nl> + / / Apply sort in SQL <nl> + const std : : shared_ptr < CSettings > settings = <nl> + CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) ; <nl> + if ( settings - > GetBool ( CSettings : : SETTING_MUSICLIBRARY_USEARTISTSORTNAME ) ) <nl> + sorting . sortAttributes = <nl> + static_cast < SortAttribute > ( sorting . sortAttributes | SortAttributeUseArtistSortName ) ; <nl> + / / Set Orderby and add any extra fields needed for sort e . g . " artistname " scalar query <nl> + GetOrderFilter ( MediaTypeAlbum , sorting , extFilter ) ; <nl> + / / Modify order to use correct calculated year field <nl> + if ( ! CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetBool ( <nl> + CSettings : : SETTING_MUSICLIBRARY_USEORIGINALDATE ) ) <nl> + StringUtils : : Replace ( extFilter . order , " iYear " , " CAST ( strReleaseDate AS INTEGER ) " ) ; <nl> + else <nl> + StringUtils : : Replace ( extFilter . order , " iYear " , " CAST ( strOrigReleaseDate AS INTEGER ) " ) ; <nl> + <nl> + strSQLExtra . clear ( ) ; <nl> + if ( ! BuildSQL ( strSQLExtra , extFilter , strSQLExtra ) ) <nl> + return false ; <nl> + <nl> std : : string strSQL ; <nl> std : : string strFields = " albumview . * " ; <nl> if ( ! extFilter . fields . empty ( ) & & extFilter . fields . compare ( " * " ) ! = 0 ) <nl> bool CMusicDatabase : : GetAlbumsByWhere ( const std : : string & baseDir , const Filter & <nl> <nl> DatabaseResults results ; <nl> results . reserve ( iRowsFound ) ; <nl> - / / Avoid sorting when populating results when have limits as already sorted in SQL <nl> - sorting = sortDescription ; <nl> - if ( limitedInSQL ) <nl> - sorting . sortBy = SortByNone ; <nl> - if ( ! SortUtils : : SortFromDataset ( sorting , MediaTypeAlbum , m_pDS , results ) ) <nl> + / / Populate results field vector from dataset <nl> + FieldList fields ; <nl> + if ( ! DatabaseUtils : : GetDatabaseResults ( MediaTypeAlbum , fields , m_pDS , results ) ) <nl> return false ; <nl> + / / Store item list sort order <nl> + items . SetSortMethod ( sortDescription . sortBy ) ; <nl> + items . SetSortOrder ( sortDescription . sortOrder ) ; <nl> <nl> / / Get albums from returned rows <nl> - items . Reserve ( total ) ; <nl> + items . Reserve ( results . size ( ) ) ; <nl> const dbiplus : : query_data & data = m_pDS - > get_result_set ( ) . records ; <nl> for ( const auto & i : results ) <nl> { <nl> bool CMusicDatabase : : GetAlbumsByWhere ( const std : : string & baseDir , const Filter & <nl> itemUrl . AppendPath ( path ) ; <nl> <nl> CFileItemPtr pItem ( new CFileItem ( itemUrl . ToString ( ) , GetAlbumFromDataset ( record ) ) ) ; <nl> + / / Set icon now to avoid slow per item processing in FillInDefaultIcon later <nl> + pItem - > SetProperty ( " icon_never_overlay " , true ) ; <nl> pItem - > SetArt ( " icon " , " DefaultAlbumCover . png " ) ; <nl> items . Add ( pItem ) ; <nl> } <nl> bool CMusicDatabase : : GetDiscsByWhere ( CMusicDbUrl & musicUrl , <nl> pItem - > GetMusicInfoTag ( ) - > SetDiscNumber ( discnum ) ; <nl> pItem - > GetMusicInfoTag ( ) - > SetTitle ( strDiscSubtitle ) ; <nl> pItem - > SetLabel ( strDiscSubtitle ) ; <nl> + / / Set icon now to avoid slow per item processing in FillInDefaultIcon later <nl> + pItem - > SetProperty ( " icon_never_overlay " , true ) ; <nl> pItem - > SetArt ( " icon " , " DefaultAlbumCover . png " ) ; <nl> items . Add ( pItem ) ; <nl> } <nl> bool CMusicDatabase : : GetSongsFullByWhere ( const std : : string & baseDir , const Filte <nl> <nl> try <nl> { <nl> + unsigned int querytime = 0 ; <nl> unsigned int time = XbmcThreads : : SystemClockMillis ( ) ; <nl> int total = - 1 ; <nl> - bool extended = false ; <nl> <nl> Filter extFilter = filter ; <nl> CMusicDbUrl musicUrl ; <nl> bool CMusicDatabase : : GetSongsFullByWhere ( const std : : string & baseDir , const Filte <nl> if ( ! musicUrl . FromString ( baseDir ) | | ! GetFilter ( musicUrl , extFilter , sorting ) ) <nl> return false ; <nl> <nl> + bool extended = false ; <nl> + bool limitedInSQL = <nl> + extFilter . limit . empty ( ) & & ( sortDescription . limitStart > 0 | | sortDescription . limitEnd > 0 ) ; <nl> + <nl> / / If there are extra WHERE conditions ( from media filter dialog ) we might <nl> / / need access to albumview for these conditions <nl> if ( extFilter . where . find ( " albumview " ) ! = std : : string : : npos ) <nl> bool CMusicDatabase : : GetSongsFullByWhere ( const std : : string & baseDir , const Filte <nl> extFilter . AppendJoin ( " JOIN albumview ON albumview . idAlbum = songview . idAlbum " ) ; <nl> } <nl> <nl> + / / Build songview < where > for count <nl> std : : string strSQLExtra ; <nl> if ( ! BuildSQL ( strSQLExtra , extFilter , strSQLExtra ) ) <nl> return false ; <nl> <nl> / / Count ( without group by ) number of songs that satisfy selection criteria <nl> + / / Much quicker to use song table , not songview , when filtering only on song fields <nl> std : : string strValue ; <nl> - strValue = GetSingleValue ( " SELECT COUNT ( 1 ) FROM songview " + strSQLExtra , m_pDS ) ; <nl> + if ( extended | | <nl> + ( ! extFilter . where . empty ( ) & & ( extFilter . where . find ( " strAlbum " ) ! = std : : string : : npos | | <nl> + extFilter . where . find ( " strPath " ) ! = std : : string : : npos | | <nl> + extFilter . where . find ( " bCompilation " ) ! = std : : string : : npos | | <nl> + extFilter . where . find ( " bBoxedset " ) ! = std : : string : : npos ) ) ) <nl> + strValue = GetSingleValue ( " SELECT COUNT ( 1 ) FROM songview " + strSQLExtra , m_pDS ) ; <nl> + else <nl> + { <nl> + std : : string strSQLsong = strSQLExtra ; <nl> + StringUtils : : Replace ( strSQLsong , " songview " , " song " ) ; <nl> + strValue = GetSingleValue ( " SELECT COUNT ( 1 ) FROM song " + strSQLsong , m_pDS ) ; <nl> + } <nl> total = static_cast < int > ( strtol ( strValue . c_str ( ) , NULL , 10 ) ) ; <nl> <nl> if ( extended ) <nl> extFilter . AppendGroup ( " songview . idSong " ) ; <nl> <nl> - / / Apply any limiting directly in SQL and so sort as well <nl> - bool limitedInSQL = <nl> - extFilter . limit . empty ( ) & & ( sortDescription . limitStart > 0 | | sortDescription . limitEnd > 0 ) ; <nl> + / / Apply any limiting directly in SQL <nl> if ( limitedInSQL ) <nl> { <nl> extFilter . limit = <nl> DatabaseUtils : : BuildLimitClauseOnly ( sortDescription . limitEnd , sortDescription . limitStart ) ; <nl> - const std : : shared_ptr < CSettings > settings = <nl> - CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) ; <nl> - if ( settings - > GetBool ( CSettings : : SETTING_MUSICLIBRARY_USEARTISTSORTNAME ) ) <nl> - sorting . sortAttributes = <nl> - static_cast < SortAttribute > ( sorting . sortAttributes | SortAttributeUseArtistSortName ) ; <nl> - / / Set Orderby and add any extra fields needed for sort e . g . " artistname " scalar query <nl> - GetOrderFilter ( MediaTypeSong , sorting , extFilter ) ; <nl> } <nl> - else if ( artistData ) <nl> + <nl> + / / Apply sort in SQL <nl> + const std : : shared_ptr < CSettings > settings = <nl> + CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) ; <nl> + if ( settings - > GetBool ( CSettings : : SETTING_MUSICLIBRARY_USEARTISTSORTNAME ) ) <nl> + sorting . sortAttributes = <nl> + static_cast < SortAttribute > ( sorting . sortAttributes | SortAttributeUseArtistSortName ) ; <nl> + / / Set Orderby and add any extra fields needed for sort e . g . " artistname " scalar query <nl> + GetOrderFilter ( MediaTypeSong , sorting , extFilter ) ; <nl> + / / Modify order to use correct calculated year field <nl> + if ( ! CServiceBroker : : GetSettingsComponent ( ) - > GetSettings ( ) - > GetBool ( <nl> + CSettings : : SETTING_MUSICLIBRARY_USEORIGINALDATE ) ) <nl> + StringUtils : : Replace ( extFilter . order , " iYear " , " CAST ( strReleaseDate AS INTEGER ) " ) ; <nl> + else <nl> + StringUtils : : Replace ( extFilter . order , " iYear " , " CAST ( strOrigReleaseDate AS INTEGER ) " ) ; <nl> + <nl> + std : : string strFields = " songview . * " ; <nl> + if ( ! artistData | | limitedInSQL ) <nl> { <nl> - extFilter . AppendOrder ( " songartistview . idSong " ) ; <nl> - extFilter . AppendOrder ( " songartistview . idRole " ) ; <nl> - extFilter . AppendOrder ( " songartistview . iOrder " ) ; <nl> + / / Build songview < where > + < order by > + < limits > <nl> + strSQLExtra . clear ( ) ; <nl> + if ( ! BuildSQL ( strSQLExtra , extFilter , strSQLExtra ) ) <nl> + return false ; <nl> } <nl> - strSQLExtra . clear ( ) ; <nl> - BuildSQL ( strSQLExtra , extFilter , strSQLExtra ) ; <nl> + else <nl> + strFields = " songview . * , songartistview . * " ; <nl> + if ( ! extFilter . fields . empty ( ) & & extFilter . fields . compare ( " * " ) ! = 0 ) <nl> + strFields = strFields + " , " + extFilter . fields ; <nl> <nl> std : : string strSQL ; <nl> if ( artistData ) <nl> { / / Get data from song and song_artist tables to fully populate songs with artists <nl> / / All songs now have at least one artist so inner join sufficient <nl> - / / Need guaranteed ordering for dataset processing to extract songs <nl> + / / Build songartistview JOIN part of query <nl> + Filter joinFilter ; <nl> + std : : string strSQLJoin ; <nl> + joinFilter . AppendJoin ( " JOIN songartistview ON songartistview . idSong = songview . idSong " ) ; <nl> + if ( sortDescription . sortBy = = SortByRandom ) <nl> + joinFilter . AppendOrder ( " songartistview . idSong " ) ; <nl> + else <nl> + joinFilter . order = extFilter . order ; <nl> if ( limitedInSQL ) <nl> { <nl> - / / Apply where clause , limits and order to songview , then join as multiple <nl> - / / records in result set per song in idSong order for dataset processing <nl> - / / so item list will be in idSong order until sorted elsewhere <nl> - std : : string strSVFields = " songview . * " ; <nl> - if ( ! extFilter . fields . empty ( ) & & extFilter . fields . compare ( " * " ) ! = 0 ) <nl> - strSVFields = " songview . * , " + extFilter . fields ; <nl> - strSQL = " SELECT sv . * , songartistview . * " <nl> - " FROM ( SELECT " + strSVFields + " FROM songview " + strSQLExtra + " ) AS sv " <nl> - " JOIN songartistview ON songartistview . idSong = sv . idSong " <nl> - " ORDER BY songartistview . idSong , songartistview . idRole , songartistview . iOrder " ; <nl> + StringUtils : : Replace ( joinFilter . join , " songview . idSong " , " sv . idSong " ) ; <nl> + StringUtils : : Replace ( joinFilter . order , " songview . " , " sv . " ) ; <nl> } <nl> else <nl> - strSQL = " SELECT songview . * , songartistview . * " <nl> - " FROM songview JOIN songartistview ON songartistview . idSong = songview . idSong " + <nl> - strSQLExtra ; <nl> + joinFilter . where = extFilter . where ; <nl> + joinFilter . AppendOrder ( " songartistview . idRole " ) ; <nl> + joinFilter . AppendOrder ( " songartistview . iOrder " ) ; <nl> + if ( ! BuildSQL ( strSQLJoin , joinFilter , strSQLJoin ) ) <nl> + return false ; <nl> + <nl> + if ( limitedInSQL ) <nl> + { <nl> + / / When have artist data ( all roles ) and LIMIT on songs use inline view <nl> + / / SELECT sv . * , songartistview . * FROM <nl> + / / ( SELECT songview . * FROM songview < where > + < order by > + < limits > ) AS sv <nl> + / / < order by sv fields > , songartistview . idRole , songartistview . iOrder <nl> + / / Apply where clause , limits and order to songview , then join to songartistview this gives <nl> + / / multiple records per song in result set <nl> + strSQL = " SELECT " + strFields + " FROM songview " + strSQLExtra ; <nl> + strSQL = " ( " + strSQL + " ) AS sv " ; <nl> + strSQL = " SELECT sv . * , songartistview . * FROM " + strSQL + strSQLJoin ; <nl> + } <nl> + else <nl> + strSQL = " SELECT " + strFields + " FROM songview " + strSQLJoin ; <nl> } <nl> else <nl> - strSQL = " SELECT songview . * FROM songview " + strSQLExtra ; <nl> + strSQL = " SELECT " + strFields + " FROM songview " + strSQLExtra ; <nl> <nl> CLog : : Log ( LOGDEBUG , " % s query = % s " , __FUNCTION__ , strSQL . c_str ( ) ) ; <nl> + querytime = XbmcThreads : : SystemClockMillis ( ) ; <nl> / / run query <nl> if ( ! m_pDS - > query ( strSQL ) ) <nl> return false ; <nl> bool CMusicDatabase : : GetSongsFullByWhere ( const std : : string & baseDir , const Filte <nl> m_pDS - > close ( ) ; <nl> return true ; <nl> } <nl> + querytime = XbmcThreads : : SystemClockMillis ( ) - querytime ; <nl> <nl> / / Store the total number of songs as a property <nl> items . SetProperty ( " total " , total ) ; <nl> <nl> DatabaseResults results ; <nl> results . reserve ( iRowsFound ) ; <nl> - / / Avoid sorting when populating results when a ) have join with songartistview <nl> - / / or b ) no join but have limits so already sorted in SQL <nl> - / / Apply sort later to fileitems list rather than dataset <nl> - sorting = sortDescription ; <nl> - if ( artistData | | limitedInSQL ) <nl> - sorting . sortBy = SortByNone ; <nl> - if ( ! SortUtils : : SortFromDataset ( sorting , MediaTypeSong , m_pDS , results ) ) <nl> + / / Populate results field vector from dataset <nl> + FieldList fields ; <nl> + if ( ! DatabaseUtils : : GetDatabaseResults ( MediaTypeSong , fields , m_pDS , results ) ) <nl> return false ; <nl> + / / Store item list sort order <nl> + items . SetSortMethod ( sortDescription . sortBy ) ; <nl> + items . SetSortOrder ( sortDescription . sortOrder ) ; <nl> <nl> / / Get songs from returned rows . If join songartistview then there is a row for every artist <nl> items . Reserve ( total ) ; <nl> bool CMusicDatabase : : GetSongsFullByWhere ( const std : : string & baseDir , const Filte <nl> GetFileItemFromDataset ( record , item . get ( ) , musicUrl ) ; <nl> / / HACK for sorting by database returned order <nl> item - > m_iprogramCount = + + count ; <nl> + / / Set icon now to avoid slow per item processing in FillInDefaultIcon later <nl> + item - > SetProperty ( " icon_never_overlay " , true ) ; <nl> + item - > SetArt ( " icon " , " DefaultAudio . png " ) ; <nl> items . Add ( item ) ; <nl> } <nl> / / Get song artist credits and contributors <nl> bool CMusicDatabase : : GetSongsFullByWhere ( const std : : string & baseDir , const Filte <nl> / / cleanup <nl> m_pDS - > close ( ) ; <nl> <nl> - / / Finally do any sorting in items list we have not been able to do before because have join <nl> - / / so have idSong order for processing . <nl> + / / Ensure random order of item list when results set sorted by idSong for artist processing <nl> / / Note while smartplaylists and xml nodes provide sort order , sort is not passed in from node <nl> / / navigation . Order is read later from view state and list sorting is then triggered by <nl> / / CGUIMediaWindow : : Update in both cases . <nl> - / / Sorting here is probably redundant , but leave in place until certain <nl> + / / So sorting here is currently redundant , but the consistent place to do it . <nl> / / ! @ todo : do sorting once , preferably in SQL <nl> - if ( artistData ) <nl> + if ( sortDescription . sortBy = = SortByRandom & & artistData ) <nl> items . Sort ( sortDescription ) ; <nl> <nl> - CLog : : Log ( LOGDEBUG , " % s ( % s ) - took % d ms " , __FUNCTION__ , filter . where . c_str ( ) , XbmcThreads : : SystemClockMillis ( ) - time ) ; <nl> + CLog : : Log ( LOGDEBUG , " { 0 } : Time to fill list with songs { 1 } ms query took { 2 } ms " , __FUNCTION__ , <nl> + XbmcThreads : : SystemClockMillis ( ) - time , querytime ) ; <nl> return true ; <nl> } <nl> catch ( . . . ) <nl> std : : string CMusicDatabase : : SortnameBuildSQL ( const std : : string & strAlias , <nl> std : : string CMusicDatabase : : AlphanumericSortSQL ( const std : : string & strField , const SortOrder & sortOrder ) <nl> { <nl> / * <nl> - Make sort of initial numbers natural , and case insensitive in SQLite . <nl> - Collation NOCASE ould be more efficient done in table create . <nl> - MySQL uses case insensitive utf8_general_ci collation defined for tables . <nl> - Use PrepareSQL to adjust syntax removing NOCASE and add AS UNSIGNED INTEGER <nl> + Use custom collation ALPHANUM in SQLite . This handles natural number order , case sensitivity <nl> + and locale UFT - 8 order for accents using the same functionality as fileitem list sorting . <nl> + Natural number order is not significant for where clause comparison and use of calculated fields <nl> + means there is no advantage in defining as column defualt in table create than per query ( which <nl> + also makes looking at the db with other tools difficult ) . <nl> + <nl> + MySQL does not have callback collation , but all tables are defined with utf8_general_ci an <nl> + " ascii folding " case insensitive collation . Natural sorting is provided via native functions <nl> + stored in the db . <nl> * / <nl> std : : string DESC ; <nl> if ( sortOrder = = SortOrderDescending ) <nl> DESC = " DESC " ; <nl> - return PrepareSQL ( " CASE WHEN CAST ( % s AS INTEGER ) = 0 " <nl> - " THEN 100000000 ELSE CAST ( % s AS INTEGER ) END % s , " <nl> - " % s COLLATE NOCASE % s " , <nl> - strField . c_str ( ) , strField . c_str ( ) , DESC . c_str ( ) , strField . c_str ( ) , DESC . c_str ( ) ) ; <nl> + std : : string strSort ; <nl> + <nl> + if ( StringUtils : : EqualsNoCase ( <nl> + CServiceBroker : : GetSettingsComponent ( ) - > GetAdvancedSettings ( ) - > m_databaseMusic . type , <nl> + " mysql " ) ) <nl> + strSort = PrepareSQL ( " udfNaturalSortFormat ( % s , 8 , ' . ' ) % s " , strField . c_str ( ) , DESC . c_str ( ) ) ; <nl> + else <nl> + strSort = PrepareSQL ( " % s COLLATE ALPHANUM % s " , strField . c_str ( ) , DESC . c_str ( ) ) ; <nl> + return strSort ; <nl> } <nl> <nl> void CMusicDatabase : : UpdateTables ( int version ) <nl> void CMusicDatabase : : UpdateTables ( int version ) <nl> <nl> int CMusicDatabase : : GetSchemaVersion ( ) const <nl> { <nl> - return 75 ; <nl> + return 76 ; / / Bumped for addition of functions to MySQL , SQLite v76 = v75 <nl> } <nl> <nl> int CMusicDatabase : : GetMusicNeedsTagScan ( ) <nl> mmm a / xbmc / music / MusicDatabase . h <nl> ppp b / xbmc / music / MusicDatabase . h <nl> void SetLibraryLastUpdated ( ) ; <nl> / * ! \ brief ( Re ) Create the generic database views for songs and albums <nl> * / <nl> virtual void CreateViews ( ) ; <nl> + void CreateNativeDBFunctions ( ) ; <nl> <nl> void SplitPath ( const std : : string & strFileNameAndPath , std : : string & strPath , std : : string & strFileName ) ; <nl> <nl> mmm a / xbmc / utils / StringUtils . cpp <nl> ppp b / xbmc / utils / StringUtils . cpp <nl> static const uint16_t * const planemap [ 256 ] = { <nl> <nl> static wchar_t GetCollationWeight ( const wchar_t & r ) <nl> { <nl> - / / Lookup the " weight " of a UFT8 char , equivalent lowercase ascii letter , in the plane map , <nl> + / / Lookup the " weight " of a UTF8 char , equivalent lowercase ascii letter , in the plane map , <nl> / / the character comparison value used by using " accent folding " collation utf8_general_ci <nl> / / in MySQL ( AKA utf8mb3_general_ci in MariaDB 10 ) <nl> auto index = r > > 8 ; <nl> static wchar_t GetCollationWeight ( const wchar_t & r ) <nl> return static_cast < wchar_t > ( plane [ r & 0xFF ] ) ; <nl> } <nl> <nl> - / / Compares separately the numeric and alphabetic parts of a string . <nl> + / / Compares separately the numeric and alphabetic parts of a wide string . <nl> / / returns negative if left < right , positive if left > right <nl> - / / and 0 if they are identical <nl> + / / and 0 if they are identical . <nl> + / / See also the equivalent StringUtils : : AlphaNumericCollation ( ) for UFT8 data <nl> int64_t StringUtils : : AlphaNumericCompare ( const wchar_t * left , const wchar_t * right ) <nl> { <nl> const wchar_t * l = left ; <nl> int64_t StringUtils : : AlphaNumericCompare ( const wchar_t * left , const wchar_t * rig <nl> if ( * l > = L ' 0 ' & & * l < = L ' 9 ' & & * r > = L ' 0 ' & & * r < = L ' 9 ' ) <nl> { <nl> ld = l ; <nl> - lnum = 0 ; <nl> + lnum = * ld + + - L ' 0 ' ; <nl> while ( * ld > = L ' 0 ' & & * ld < = L ' 9 ' & & ld < l + 15 ) <nl> { / / compare only up to 15 digits <nl> lnum * = 10 ; <nl> lnum + = * ld + + - L ' 0 ' ; <nl> } <nl> rd = r ; <nl> - rnum = 0 ; <nl> + rnum = * rd + + - L ' 0 ' ; <nl> while ( * rd > = L ' 0 ' & & * rd < = L ' 9 ' & & rd < r + 15 ) <nl> { / / compare only up to 15 digits <nl> rnum * = 10 ; <nl> int64_t StringUtils : : AlphaNumericCompare ( const wchar_t * left , const wchar_t * rig <nl> <nl> lc = * l ; <nl> rc = * r ; <nl> + / / Put ascii punctuation and symbols e . g . ! # $ & ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ above the other <nl> + / / alphanumeric ascii , rather than some being mixed between the numbers and letters , and <nl> + / / above all other unicode letters , symbols and punctuation . <nl> + / / ( Locale collation of these chars varies across platforms ) <nl> + lsym = ( lc > = 32 & & lc < L ' 0 ' ) | | ( lc > L ' 9 ' & & lc < L ' A ' ) | | <nl> + ( lc > L ' Z ' & & lc < L ' a ' ) | | ( lc > L ' z ' & & lc < 128 ) ; <nl> + rsym = ( rc > = 32 & & rc < L ' 0 ' ) | | ( rc > L ' 9 ' & & rc < L ' A ' ) | | <nl> + ( rc > L ' Z ' & & rc < L ' a ' ) | | ( rc > L ' z ' & & rc < 128 ) ; <nl> + if ( lsym & & ! rsym ) <nl> + return - 1 ; <nl> + if ( ! lsym & & rsym ) <nl> + return 1 ; <nl> + if ( lsym & & rsym ) <nl> + { <nl> + if ( lc ! = rc ) <nl> + return lc - rc ; <nl> + else <nl> + { / / Same symbol advance to next wchar <nl> + l + + ; <nl> + r + + ; <nl> + continue ; <nl> + } <nl> + } <nl> if ( ! g_langInfo . UseLocaleCollation ( ) ) <nl> { <nl> / / Apply case sensitive accent folding collation to non - ascii chars . <nl> int64_t StringUtils : : AlphaNumericCompare ( const wchar_t * left , const wchar_t * rig <nl> lc + = L ' a ' - L ' A ' ; <nl> if ( rc > = L ' A ' & & rc < = L ' Z ' ) <nl> rc + = L ' a ' - L ' A ' ; <nl> + <nl> if ( lc ! = rc ) <nl> { <nl> - / / Put ascii punctuation and symbols e . g . ! # $ & ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ above the other <nl> - / / alphanumeric ascii , rather than some being mixed between the numbers and letters , and <nl> - / / above all other unicode letters , symbols and punctuation . <nl> - / / ( Locale collation of these chars varies across platforms ) <nl> - lsym = lc < 128 & & ! ( lc > = L ' a ' & & lc < = L ' z ' ) & & ! ( lc > = L ' 0 ' & & lc < = L ' 9 ' ) ; <nl> - rsym = rc < 128 & & ! ( rc > = L ' a ' & & rc < = L ' z ' ) & & ! ( rc > = L ' 0 ' & & rc < = L ' 9 ' ) ; <nl> - if ( lsym & & ! rsym ) <nl> - return - 1 ; <nl> - if ( ! lsym & & rsym ) <nl> - return 1 ; <nl> - <nl> - / / Either both or neither are ascii symbols or punctuation marks <nl> if ( ! g_langInfo . UseLocaleCollation ( ) ) <nl> { <nl> / / Compare unicode ( having applied accent folding collation to non - ascii chars ) . <nl> int64_t StringUtils : : AlphaNumericCompare ( const wchar_t * left , const wchar_t * rig <nl> / / platforms this is not langauge specific but just compares unicode <nl> const std : : collate < wchar_t > & coll = <nl> std : : use_facet < std : : collate < wchar_t > > ( g_langInfo . GetSystemLocale ( ) ) ; <nl> - int cmp_res = 0 ; <nl> - cmp_res = coll . compare ( & lc , & lc + 1 , & rc , & rc + 1 ) ; <nl> + int cmp_res = coll . compare ( & lc , & lc + 1 , & rc , & rc + 1 ) ; <nl> if ( cmp_res ! = 0 ) <nl> return cmp_res ; <nl> } <nl> int64_t StringUtils : : AlphaNumericCompare ( const wchar_t * left , const wchar_t * rig <nl> return 0 ; / / files are the same <nl> } <nl> <nl> + / * <nl> + Convert the UTF8 character to which z points into a 31 - bit Unicode point . <nl> + Return how many bytes ( 0 to 3 ) of UTF8 data encode the character . <nl> + This only works right if z points to a well - formed UTF8 string . <nl> + Byte - 0 Byte - 1 Byte - 2 Byte - 3 Value <nl> + 0xxxxxxx 00000000 00000000 0xxxxxxx <nl> + 110yyyyy 10xxxxxx 00000000 00000yyy yyxxxxxx <nl> + 1110zzzz 10yyyyyy 10xxxxxx 00000000 zzzzyyyy yyxxxxxx <nl> + 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx 000uuuuu zzzzyyyy yyxxxxxx <nl> + * / <nl> + static uint32_t UTF8ToUnicode ( const unsigned char * z , int nKey , unsigned char & bytes ) <nl> + { <nl> + / / Lookup table used decode the first byte of a multi - byte UTF8 character <nl> + / / clang - format off <nl> + static const unsigned char utf8Trans1 [ ] = { <nl> + 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , <nl> + 0x08 , 0x09 , 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f , <nl> + 0x10 , 0x11 , 0x12 , 0x13 , 0x14 , 0x15 , 0x16 , 0x17 , <nl> + 0x18 , 0x19 , 0x1a , 0x1b , 0x1c , 0x1d , 0x1e , 0x1f , <nl> + 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , <nl> + 0x08 , 0x09 , 0x0a , 0x0b , 0x0c , 0x0d , 0x0e , 0x0f , <nl> + 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , <nl> + 0x00 , 0x01 , 0x02 , 0x03 , 0x00 , 0x01 , 0x00 , 0x00 , <nl> + } ; <nl> + / / clang - format on <nl> + <nl> + uint32_t c ; <nl> + bytes = 0 ; <nl> + c = z [ 0 ] ; <nl> + if ( c > = 0xc0 ) <nl> + { <nl> + c = utf8Trans1 [ c - 0xc0 ] ; <nl> + int index = 1 ; <nl> + while ( index < nKey & & ( z [ index ] & 0xc0 ) = = 0x80 ) <nl> + { <nl> + c = ( c < < 6 ) + ( 0x3f & z [ index ] ) ; <nl> + index + + ; <nl> + } <nl> + if ( c < 0x80 | | ( c & 0xFFFFF800 ) = = 0xD800 | | ( c & 0xFFFFFFFE ) = = 0xFFFE ) <nl> + c = 0xFFFD ; <nl> + bytes = static_cast < unsigned char > ( index - 1 ) ; <nl> + } <nl> + return c ; <nl> + } <nl> + <nl> + / * <nl> + SQLite collating function , see sqlite3_create_collation <nl> + The equivalent of AlphaNumericCompare ( ) but for comparing UTF8 encoded data <nl> + <nl> + This only processes enough data to find a difference , and avoids expensive data conversions . <nl> + When sorting in memory item data is converted once to wstring in advance prior to sorting , the <nl> + SQLite callback function can not do that kind of preparation . Instead , in order to use <nl> + AlphaNumericCompare ( ) , it would have to repeatedly convert the full input data to wstring for <nl> + every pair comparison made . That approach was found to be 10 times slower than using this <nl> + separate routine . <nl> + * / <nl> + int StringUtils : : AlphaNumericCollation ( int nKey1 , const void * pKey1 , int nKey2 , const void * pKey2 ) <nl> + { <nl> + / / Get exact matches of shorter text to start of larger test fast <nl> + int n = std : : min ( nKey1 , nKey2 ) ; <nl> + int r = memcmp ( pKey1 , pKey2 , n ) ; <nl> + if ( r = = 0 ) <nl> + return nKey1 - nKey2 ; <nl> + <nl> + / / Not a binary match , so process character at a time <nl> + const unsigned char * zA = static_cast < const unsigned char * > ( pKey1 ) ; <nl> + const unsigned char * zB = static_cast < const unsigned char * > ( pKey2 ) ; <nl> + wchar_t lc , rc ; <nl> + unsigned char bytes ; <nl> + int64_t lnum , rnum ; <nl> + bool lsym , rsym ; <nl> + int ld , rd ; <nl> + int i = 0 ; <nl> + int j = 0 ; <nl> + / / Looping Unicode point at a time through potentially 1 to 4 multi - byte encoded UTF8 data <nl> + while ( i < nKey1 & & j < nKey2 ) <nl> + { <nl> + / / Check if we have numerical values , compare only up to 15 digits <nl> + if ( isdigit ( zA [ i ] ) & & isdigit ( zB [ j ] ) ) <nl> + { <nl> + lnum = zA [ i ] - ' 0 ' ; <nl> + ld = i + 1 ; <nl> + while ( ld < nKey1 & & isdigit ( zA [ ld ] ) & & ld < i + 15 ) <nl> + { <nl> + lnum * = 10 ; <nl> + lnum + = zA [ ld ] - ' 0 ' ; <nl> + ld + + ; <nl> + } <nl> + rnum = zB [ j ] - ' 0 ' ; <nl> + rd = j + 1 ; <nl> + while ( rd < nKey2 & & isdigit ( zB [ rd ] ) & & rd < j + 15 ) <nl> + { <nl> + rnum * = 10 ; <nl> + rnum + = zB [ rd ] - ' 0 ' ; <nl> + rd + + ; <nl> + } <nl> + / / do we have numbers ? <nl> + if ( lnum ! = rnum ) <nl> + { / / yes - and they ' re different ! <nl> + return lnum - rnum ; <nl> + } <nl> + / / Advance to after digits <nl> + i = ld ; <nl> + j = rd ; <nl> + continue ; <nl> + } <nl> + / / Put ascii punctuation and symbols e . g . ! # $ & ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ before the other <nl> + / / alphanumeric ascii , rather than some being mixed between the numbers and letters , and <nl> + / / above all other unicode letters , symbols and punctuation . <nl> + / / ( Locale collation of these chars varies across platforms ) <nl> + lsym = ( zA [ i ] > = 32 & & zA [ i ] < ' 0 ' ) | | ( zA [ i ] > ' 9 ' & & zA [ i ] < ' A ' ) | | <nl> + ( zA [ i ] > ' Z ' & & zA [ i ] < ' a ' ) | | ( zA [ i ] > ' z ' & & zA [ i ] < 128 ) ; <nl> + rsym = ( zB [ j ] > = 32 & & zB [ j ] < ' 0 ' ) | | ( zB [ j ] > ' 9 ' & & zB [ j ] < ' A ' ) | | <nl> + ( zB [ j ] > ' Z ' & & zB [ j ] < ' a ' ) | | ( zB [ j ] > ' z ' & & zB [ j ] < 128 ) ; <nl> + if ( lsym & & ! rsym ) <nl> + return - 1 ; <nl> + if ( ! lsym & & rsym ) <nl> + return 1 ; <nl> + if ( lsym & & rsym ) <nl> + { <nl> + if ( zA [ i ] ! = zB [ j ] ) <nl> + return zA [ i ] - zB [ j ] ; <nl> + else <nl> + { / / Same symbol advance to next <nl> + i + + ; <nl> + j + + ; <nl> + continue ; <nl> + } <nl> + } <nl> + / / Decode single ( 1 to 4 bytes ) UTF8 character to Unicode <nl> + lc = UTF8ToUnicode ( & zA [ i ] , nKey1 - i , bytes ) ; <nl> + i + = bytes ; <nl> + rc = UTF8ToUnicode ( & zB [ j ] , nKey2 - j , bytes ) ; <nl> + j + = bytes ; <nl> + if ( ! g_langInfo . UseLocaleCollation ( ) ) <nl> + { <nl> + / / Apply case sensitive accent folding collation to non - ascii chars . <nl> + / / This mimics utf8_general_ci collation , and provides simple collation of LATIN - 1 chars <nl> + / / for any platform that doesn ' t have a language specific collate facet implemented <nl> + if ( lc > 128 ) <nl> + lc = GetCollationWeight ( lc ) ; <nl> + if ( rc > 128 ) <nl> + rc = GetCollationWeight ( rc ) ; <nl> + } <nl> + / / Caseless comparison so convert ascii upper case to lower case <nl> + if ( lc > = ' A ' & & lc < = ' Z ' ) <nl> + lc + = ' a ' - ' A ' ; <nl> + if ( rc > = ' A ' & & rc < = ' Z ' ) <nl> + rc + = ' a ' - ' A ' ; <nl> + <nl> + if ( lc ! = rc ) <nl> + { <nl> + if ( ! g_langInfo . UseLocaleCollation ( ) | | ( lc < = 128 & & rc < = 128 ) ) <nl> + / / Compare unicode ( having applied accent folding collation to non - ascii chars ) . <nl> + return lc - rc ; <nl> + else <nl> + { <nl> + / / Fetch collation facet from locale to do comparison of wide char although on some <nl> + / / platforms this is not langauge specific but just compares unicode <nl> + const std : : collate < wchar_t > & coll = <nl> + std : : use_facet < std : : collate < wchar_t > > ( g_langInfo . GetSystemLocale ( ) ) ; <nl> + int cmp_res = coll . compare ( & lc , & lc + 1 , & rc , & rc + 1 ) ; <nl> + if ( cmp_res ! = 0 ) <nl> + return cmp_res ; <nl> + } <nl> + } <nl> + i + + ; <nl> + j + + ; <nl> + } <nl> + / / Compared characters of shortest are the same as longest , length determines order <nl> + return ( nKey1 - nKey2 ) ; <nl> + } <nl> + <nl> int StringUtils : : DateStringToYYYYMMDD ( const std : : string & dateString ) <nl> { <nl> std : : vector < std : : string > days = StringUtils : : Split ( dateString , ' - ' ) ; <nl> mmm a / xbmc / utils / StringUtils . h <nl> ppp b / xbmc / utils / StringUtils . h <nl> class StringUtils <nl> static std : : vector < std : : string > SplitMulti ( const std : : vector < std : : string > & input , const std : : vector < std : : string > & delimiters , unsigned int iMaxStrings = 0 ) ; <nl> static int FindNumber ( const std : : string & strInput , const std : : string & strFind ) ; <nl> static int64_t AlphaNumericCompare ( const wchar_t * left , const wchar_t * right ) ; <nl> + static int AlphaNumericCollation ( int nKey1 , const void * pKey1 , int nKey2 , const void * pKey2 ) ; <nl> static long TimeStringToSeconds ( const std : : string & timeString ) ; <nl> static void RemoveCRLF ( std : : string & strLine ) ; <nl> <nl>
Merge pull request from DaveTBlake / CustomCollate
xbmc/xbmc
aec4dfadbe215f021a9511655917dfd59812fb2f
2020-05-29T09:07:05Z
new file mode 100644 <nl> index 0000000000 . . b69c91ab1b <nl> mmm / dev / null <nl> ppp b / html5 / test / render / vue / modules / modal . js <nl> <nl> + / * <nl> + * Licensed to the Apache Software Foundation ( ASF ) under one <nl> + * or more contributor license agreements . See the NOTICE file <nl> + * distributed with this work for additional information <nl> + * regarding copyright ownership . The ASF licenses this file <nl> + * to you under the Apache License , Version 2 . 0 ( the <nl> + * " License " ) ; you may not use this file except in compliance <nl> + * with the License . 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 , <nl> + * software distributed under the License is distributed on an <nl> + * " AS IS " BASIS , WITHOUT WARRANTIES OR CONDITIONS OF ANY <nl> + * KIND , either express or implied . See the License for the <nl> + * specific language governing permissions and limitations <nl> + * under the License . <nl> + * / <nl> + import Toast from ' . . / . . / . . / . . / render / vue / modules / modal / toast ' <nl> + import Alert from ' . . / . . / . . / . . / render / vue / modules / modal / alert ' <nl> + import Confirm from ' . . / . . / . . / . . / render / vue / modules / modal / confirm ' <nl> + import Prompt from ' . . / . . / . . / . . / render / vue / modules / modal / prompt ' <nl> + import Modal from ' . . / . . / . . / . . / render / vue / modules / modal / modal ' <nl> + import { <nl> + nodeListToArray <nl> + } from ' . . / helper / utils ' <nl> + / * * @ test { webSocket module } * / <nl> + describe ( ' modal module ' , function ( ) { <nl> + after ( function ( done ) { <nl> + done ( ) ; <nl> + } ) ; <nl> + describe ( ' modal API ' , function ( ) { <nl> + const modal = new Modal ( ) ; <nl> + it ( ' should have prototype ' , function ( ) { <nl> + expect ( modal ) . to . have . property ( ' show ' ) ; <nl> + expect ( modal ) . to . have . property ( ' destroy ' ) ; <nl> + expect ( modal ) . to . have . property ( ' createWrap ' ) ; <nl> + expect ( modal ) . to . have . property ( ' createNode ' ) ; <nl> + expect ( modal ) . to . have . property ( ' clearNode ' ) ; <nl> + expect ( modal ) . to . have . property ( ' createNodeContent ' ) ; <nl> + expect ( modal ) . to . have . property ( ' bindEvents ' ) ; <nl> + } ) <nl> + it ( ' wrap style should be weex - modal - wrap when show method is called ' , function ( ) { <nl> + / / Modal <nl> + / / assert . strictEqual ( $ modal [ 0 ] , $ el [ 0 ] , ' collection contains element ' ) <nl> + } ) <nl> + } ) ; <nl> + describe ( ' toast API ' , function ( ) { <nl> + const toast = Toast ; <nl> + let config = { <nl> + message : ' Test ' , <nl> + duration : 1 <nl> + } <nl> + it ( ' should have method ' , function ( ) { <nl> + expect ( toast . push ) . to . be . a ( ' function ' ) ; <nl> + expect ( toast . show ) . to . be . a ( ' function ' ) ; <nl> + } ) <nl> + it ( ' should toast mount on document when push method is called ' , function ( ) { <nl> + const TOAST_WIN_CLASS_NAME = ' . weex - toast ' ; <nl> + let $ Toast ; <nl> + let clock = sinon . useFakeTimers ( ) ; <nl> + toast . push ( config . message , config . duration ) ; <nl> + $ Toast = document . querySelector ( TOAST_WIN_CLASS_NAME ) <nl> + expect ( $ Toast . innerText , ' should contain Test message ' ) . to . be . equal ( config . message ) <nl> + expect ( nodeListToArray ( $ Toast . classList ) , ' should include hide class ' ) . to . include ( ' hide ' ) <nl> + clock . tick ( config . duration * 1000 ) <nl> + expect ( nodeListToArray ( $ Toast . classList ) , ' should remove hide class ' ) . to . not . include ( ' hide ' ) <nl> + } ) <nl> + it ( ' call show method while toast queue length < 1 ' , function ( ) { <nl> + const TOAST_WIN_CLASS_NAME = ' . weex - toast ' ; <nl> + let $ Toast ; <nl> + toast . show ( ) ; <nl> + $ Toast = document . querySelector ( TOAST_WIN_CLASS_NAME ) <nl> + expect ( $ Toast , ' element should be null when toast quene length < 1 ' ) . to . be . null ; <nl> + } ) <nl> + } ) ; <nl> + describe ( ' alert API ' , function ( ) { <nl> + let config = { <nl> + message : ' Test ' , <nl> + callback : function ( ) { } <nl> + } <nl> + const alert = new Alert ( config ) ; <nl> + it ( ' extends Standard modal API ' , function ( ) { <nl> + expect ( alert ) . to . have . property ( ' show ' ) ; <nl> + expect ( alert ) . to . have . property ( ' destroy ' ) ; <nl> + expect ( alert ) . to . have . property ( ' createWrap ' ) ; <nl> + expect ( alert ) . to . have . property ( ' createNode ' ) ; <nl> + expect ( alert ) . to . have . property ( ' clearNode ' ) ; <nl> + expect ( alert ) . to . have . property ( ' createNodeContent ' ) ; <nl> + expect ( alert ) . to . have . property ( ' bindEvents ' ) ; <nl> + } ) <nl> + it ( ' should have prototype ' , function ( ) { <nl> + expect ( alert ) . to . have . property ( ' createNodeContent ' ) ; <nl> + expect ( alert ) . to . have . property ( ' bindEvents ' ) ; <nl> + } ) <nl> + it ( ' would alert mount on document when instance is created ' , function ( ) { <nl> + const ALERT_WEEX_CLASS_NAME = ' . weex - alert ' ; <nl> + const ALERT_WEEX_MSG_CLASS_NAME = ' . content - msg ' ; <nl> + const BUTTON_CLASS = ' . alert - ok ' ; <nl> + let $ Alert ; <nl> + $ Alert = document . querySelector ( ALERT_WEEX_CLASS_NAME ) <nl> + let messageShouldBe = $ Alert . querySelector ( ALERT_WEEX_MSG_CLASS_NAME ) . innerText <nl> + let button = $ Alert . querySelector ( BUTTON_CLASS ) <nl> + expect ( messageShouldBe , ' should contain Test message ' ) . to . be . equal ( config . message ) <nl> + let event = document . createEvent ( ' HTMLEvents ' ) ; <nl> + event . initEvent ( " click " , false , true ) ; <nl> + button . dispatchEvent ( event ) ; <nl> + $ Alert = document . querySelector ( ALERT_WEEX_CLASS_NAME ) <nl> + expect ( $ Alert , ' element would unmount while ok button is clicked ' ) . to . be . null ; <nl> + } ) <nl> + } ) ; <nl> + describe ( ' confirm API ' , function ( ) { <nl> + let callbackResult = ' ' ; <nl> + let config = { <nl> + message : ' Test ' , <nl> + okTitle : ' ok ' , <nl> + cancelTitle : ' cancel ' , <nl> + callback : function ( ret ) { <nl> + callbackResult = ret <nl> + } <nl> + } <nl> + let confirm = new Confirm ( config ) ; <nl> + it ( ' extends Standard modal API ' , function ( ) { <nl> + expect ( confirm ) . to . have . property ( ' show ' ) ; <nl> + expect ( confirm ) . to . have . property ( ' destroy ' ) ; <nl> + expect ( confirm ) . to . have . property ( ' createWrap ' ) ; <nl> + expect ( confirm ) . to . have . property ( ' createNode ' ) ; <nl> + expect ( confirm ) . to . have . property ( ' clearNode ' ) ; <nl> + expect ( confirm ) . to . have . property ( ' createNodeContent ' ) ; <nl> + expect ( confirm ) . to . have . property ( ' bindEvents ' ) ; <nl> + } ) <nl> + it ( ' should have prototype ' , function ( ) { <nl> + expect ( confirm . createNodeContent ) . to . be . a ( ' function ' ) ; <nl> + expect ( confirm . bindEvents ) . to . be . a ( ' function ' ) ; <nl> + } ) <nl> + it ( ' would confirm mount on document when instance is created ' , function ( ) { <nl> + const CONFIRM_WEEX_CLASS_NAME = ' . weex - confirm ' ; <nl> + const CONFIRM_WEEX_MSG_CLASS_NAME = ' . content - msg ' ; <nl> + const OK_BUTTON_CLASS = ' . btn - ok ' ; <nl> + const CANCEL_BUTTON_CLASS = ' . btn - cancel ' ; <nl> + let $ CONFIRM ; <nl> + $ CONFIRM = document . querySelector ( CONFIRM_WEEX_CLASS_NAME ) <nl> + let messageShouldBe = $ CONFIRM . querySelector ( CONFIRM_WEEX_MSG_CLASS_NAME ) . innerText <nl> + let button = $ CONFIRM . querySelector ( OK_BUTTON_CLASS ) <nl> + expect ( messageShouldBe , ' should contain Test message ' ) . to . be . equal ( config . message ) <nl> + let event = document . createEvent ( ' HTMLEvents ' ) ; <nl> + event . initEvent ( " click " , false , true ) ; <nl> + button . dispatchEvent ( event ) ; <nl> + $ CONFIRM = document . querySelector ( CONFIRM_WEEX_CLASS_NAME ) <nl> + expect ( $ CONFIRM , ' element would unmount while ok button is clicked ' ) . to . be . null ; <nl> + expect ( callbackResult , ' callback would return okTitle ' ) . to . be . equal ( config . okTitle ) ; <nl> + / / reopen confirm for test cancel button <nl> + confirm = new Confirm ( config ) ; <nl> + $ CONFIRM = document . querySelector ( CONFIRM_WEEX_CLASS_NAME ) <nl> + button = $ CONFIRM . querySelector ( CANCEL_BUTTON_CLASS ) <nl> + event = document . createEvent ( ' HTMLEvents ' ) ; <nl> + event . initEvent ( " click " , false , true ) ; <nl> + button . dispatchEvent ( event ) ; <nl> + $ CONFIRM = document . querySelector ( CONFIRM_WEEX_CLASS_NAME ) <nl> + expect ( $ CONFIRM , ' element would unmount while ok button is clicked ' ) . to . be . null ; <nl> + expect ( callbackResult , ' callback would return okTitle ' ) . to . be . equal ( config . cancelTitle ) ; <nl> + } ) <nl> + } ) ; <nl> + describe ( ' prompt API ' , function ( ) { <nl> + let callbackResult = ' ' ; <nl> + let config = { <nl> + message : ' Test ' , <nl> + okTitle : ' ok ' , <nl> + cancelTitle : ' cancel ' , <nl> + callback : function ( ret ) { <nl> + callbackResult = ret <nl> + } <nl> + } <nl> + let inputMessage = ' prompt message ' <nl> + let prompt = new Prompt ( config ) <nl> + it ( ' extends Standard modal API ' , function ( ) { <nl> + expect ( prompt ) . to . have . property ( ' show ' ) ; <nl> + expect ( prompt ) . to . have . property ( ' destroy ' ) ; <nl> + expect ( prompt ) . to . have . property ( ' createWrap ' ) ; <nl> + expect ( prompt ) . to . have . property ( ' createNode ' ) ; <nl> + expect ( prompt ) . to . have . property ( ' clearNode ' ) ; <nl> + expect ( prompt ) . to . have . property ( ' createNodeContent ' ) ; <nl> + expect ( prompt ) . to . have . property ( ' bindEvents ' ) ; <nl> + } ) <nl> + it ( ' should have prototype ' , function ( ) { <nl> + expect ( prompt . createNodeContent ) . to . be . a ( ' function ' ) ; <nl> + expect ( prompt . bindEvents ) . to . be . a ( ' function ' ) ; <nl> + } ) <nl> + it ( ' would prompt mount on document when instance is created ' , function ( ) { <nl> + const PROMPT_WEEX_CLASS_NAME = ' . weex - prompt ' ; <nl> + const PROMPT_WEEX_MSG_CLASS_NAME = ' . content - msg ' ; <nl> + const OK_BUTTON_CLASS = ' . btn - ok ' ; <nl> + const CANCEL_BUTTON_CLASS = ' . btn - cancel ' ; <nl> + let $ Prompt ; <nl> + $ Prompt = document . querySelector ( PROMPT_WEEX_CLASS_NAME ) <nl> + let messageShouldBe = $ Prompt . querySelector ( PROMPT_WEEX_MSG_CLASS_NAME ) . innerText <nl> + let button = $ Prompt . querySelector ( OK_BUTTON_CLASS ) <nl> + expect ( messageShouldBe , ' should contain Test message ' ) . to . be . equal ( config . message ) <nl> + let event = document . createEvent ( ' HTMLEvents ' ) ; <nl> + $ Prompt . querySelector ( ' input ' ) . value = inputMessage ; <nl> + event . initEvent ( " click " , false , true ) ; <nl> + button . dispatchEvent ( event ) ; <nl> + $ Prompt = document . querySelector ( PROMPT_WEEX_CLASS_NAME ) <nl> + expect ( $ Prompt , ' element would unmount while ok button is clicked ' ) . to . be . null ; <nl> + expect ( callbackResult , ' callback would return { result : string , data : string } ' ) . to . deep . equal ( { <nl> + result : config . okTitle , <nl> + data : inputMessage <nl> + } ) ; <nl> + / / reopen prompt for test cancel button <nl> + prompt = new Prompt ( config ) <nl> + $ Prompt = document . querySelector ( PROMPT_WEEX_CLASS_NAME ) <nl> + button = $ Prompt . querySelector ( CANCEL_BUTTON_CLASS ) <nl> + event = document . createEvent ( ' HTMLEvents ' ) ; <nl> + $ Prompt . querySelector ( ' input ' ) . value = inputMessage ; <nl> + event . initEvent ( " click " , false , true ) ; <nl> + button . dispatchEvent ( event ) ; <nl> + $ Prompt = document . querySelector ( PROMPT_WEEX_CLASS_NAME ) <nl> + expect ( $ Prompt , ' element would unmount while ok button is clicked ' ) . to . be . null ; <nl> + expect ( callbackResult , ' callback would return { result : string , data : string } ' ) . to . deep . equal ( { <nl> + result : config . cancelTitle , <nl> + data : inputMessage <nl> + } ) ; <nl> + } ) <nl> + } ) ; <nl> + } ) ; <nl>
+ [ html5 ] add modal module unit test
apache/incubator-weex
8295abc94790661918945784de828ce1bf60cd3e
2017-06-28T09:04:52Z
mmm a / atom / app / atom_content_client . cc <nl> ppp b / atom / app / atom_content_client . cc <nl> <nl> # include " content / public / common / pepper_plugin_info . h " <nl> # include " content / public / common / user_agent . h " <nl> # include " ppapi / shared_impl / ppapi_permissions . h " <nl> + # include " url / url_constants . h " <nl> <nl> namespace atom { <nl> <nl> content : : PepperPluginInfo CreatePepperFlashInfo ( const base : : FilePath & path , <nl> return plugin ; <nl> } <nl> <nl> + void ConvertStringWithSeparatorToVector ( std : : vector < std : : string > * vec , <nl> + const char * separator , <nl> + const char * cmd_switch ) { <nl> + auto command_line = base : : CommandLine : : ForCurrentProcess ( ) ; <nl> + auto string_with_separator = command_line - > GetSwitchValueASCII ( cmd_switch ) ; <nl> + if ( ! string_with_separator . empty ( ) ) <nl> + * vec = base : : SplitString ( string_with_separator , separator , <nl> + base : : TRIM_WHITESPACE , <nl> + base : : SPLIT_WANT_NONEMPTY ) ; <nl> + } <nl> + <nl> } / / namespace <nl> <nl> AtomContentClient : : AtomContentClient ( ) { <nl> std : : string AtomContentClient : : GetUserAgent ( ) const { <nl> void AtomContentClient : : AddAdditionalSchemes ( <nl> std : : vector < url : : SchemeWithType > * standard_schemes , <nl> std : : vector < std : : string > * savable_schemes ) { <nl> - auto command_line = base : : CommandLine : : ForCurrentProcess ( ) ; <nl> - auto custom_schemes = command_line - > GetSwitchValueASCII ( <nl> - switches : : kRegisterStandardSchemes ) ; <nl> - if ( ! custom_schemes . empty ( ) ) { <nl> - std : : vector < std : : string > schemes = base : : SplitString ( <nl> - custom_schemes , " , " , base : : TRIM_WHITESPACE , base : : SPLIT_WANT_NONEMPTY ) ; <nl> + std : : vector < std : : string > schemes ; <nl> + ConvertStringWithSeparatorToVector ( & schemes , " , " , <nl> + switches : : kRegisterStandardSchemes ) ; <nl> + if ( ! schemes . empty ( ) ) { <nl> for ( const std : : string & scheme : schemes ) <nl> standard_schemes - > push_back ( { scheme . c_str ( ) , url : : SCHEME_WITHOUT_PORT } ) ; <nl> } <nl> void AtomContentClient : : AddPepperPlugins ( <nl> CreatePepperFlashInfo ( flash_path , flash_version ) ) ; <nl> } <nl> <nl> + void AtomContentClient : : AddServiceWorkerSchemes ( <nl> + std : : set < std : : string > * service_worker_schemes ) { <nl> + std : : vector < std : : string > schemes ; <nl> + ConvertStringWithSeparatorToVector ( & schemes , " , " , <nl> + switches : : kRegisterServiceWorkerSchemes ) ; <nl> + if ( ! schemes . empty ( ) ) { <nl> + for ( const std : : string & scheme : schemes ) <nl> + service_worker_schemes - > insert ( scheme ) ; <nl> + } <nl> + service_worker_schemes - > insert ( url : : kFileScheme ) ; <nl> + } <nl> + <nl> } / / namespace atom <nl> mmm a / atom / app / atom_content_client . h <nl> ppp b / atom / app / atom_content_client . h <nl> <nl> # ifndef ATOM_APP_ATOM_CONTENT_CLIENT_H_ <nl> # define ATOM_APP_ATOM_CONTENT_CLIENT_H_ <nl> <nl> + # include < set > <nl> # include < string > <nl> # include < vector > <nl> <nl> class AtomContentClient : public brightray : : ContentClient { <nl> std : : vector < std : : string > * savable_schemes ) override ; <nl> void AddPepperPlugins ( <nl> std : : vector < content : : PepperPluginInfo > * plugins ) override ; <nl> + void AddServiceWorkerSchemes ( <nl> + std : : set < std : : string > * service_worker_schemes ) override ; <nl> <nl> private : <nl> DISALLOW_COPY_AND_ASSIGN ( AtomContentClient ) ; <nl> mmm a / atom / browser / api / atom_api_protocol . cc <nl> ppp b / atom / browser / api / atom_api_protocol . cc <nl> mate : : ObjectTemplateBuilder Protocol : : GetObjectTemplateBuilder ( <nl> v8 : : Isolate * isolate ) { <nl> return mate : : ObjectTemplateBuilder ( isolate ) <nl> . SetMethod ( " registerStandardSchemes " , & Protocol : : RegisterStandardSchemes ) <nl> + . SetMethod ( " registerServiceWorkerSchemes " , <nl> + & Protocol : : RegisterServiceWorkerSchemes ) <nl> . SetMethod ( " registerStringProtocol " , <nl> & Protocol : : RegisterProtocol < URLRequestStringJob > ) <nl> . SetMethod ( " registerBufferProtocol " , <nl> void Protocol : : RegisterStandardSchemes ( <nl> atom : : AtomBrowserClient : : SetCustomSchemes ( schemes ) ; <nl> } <nl> <nl> + void Protocol : : RegisterServiceWorkerSchemes ( <nl> + const std : : vector < std : : string > & schemes ) { <nl> + atom : : AtomBrowserClient : : SetCustomServiceWorkerSchemes ( schemes ) ; <nl> + } <nl> + <nl> void Protocol : : UnregisterProtocol ( <nl> const std : : string & scheme , mate : : Arguments * args ) { <nl> CompletionCallback callback ; <nl> mmm a / atom / browser / api / atom_api_protocol . h <nl> ppp b / atom / browser / api / atom_api_protocol . h <nl> class Protocol : public mate : : Wrappable { <nl> / / Register schemes to standard scheme list . <nl> void RegisterStandardSchemes ( const std : : vector < std : : string > & schemes ) ; <nl> <nl> + / / Register schemes that can handle service worker . <nl> + void RegisterServiceWorkerSchemes ( const std : : vector < std : : string > & schemes ) ; <nl> + <nl> / / Register the protocol with certain request job . <nl> template < typename RequestJob > <nl> void RegisterProtocol ( const std : : string & scheme , <nl> mmm a / atom / browser / atom_browser_client . cc <nl> ppp b / atom / browser / atom_browser_client . cc <nl> bool g_suppress_renderer_process_restart = false ; <nl> <nl> / / Custom schemes to be registered to standard . <nl> std : : string g_custom_schemes = " " ; <nl> + / / Custom schemes to be registered to handle service worker . <nl> + std : : string g_custom_service_worker_schemes = " " ; <nl> <nl> scoped_refptr < net : : X509Certificate > ImportCertFromFile ( <nl> const base : : FilePath & path ) { <nl> void AtomBrowserClient : : SetCustomSchemes ( <nl> g_custom_schemes = base : : JoinString ( schemes , " , " ) ; <nl> } <nl> <nl> + void AtomBrowserClient : : SetCustomServiceWorkerSchemes ( <nl> + const std : : vector < std : : string > & schemes ) { <nl> + g_custom_service_worker_schemes = base : : JoinString ( schemes , " , " ) ; <nl> + } <nl> + <nl> AtomBrowserClient : : AtomBrowserClient ( ) : delegate_ ( nullptr ) { <nl> } <nl> <nl> void AtomBrowserClient : : AppendExtraCommandLineSwitches ( <nl> command_line - > AppendSwitchASCII ( switches : : kRegisterStandardSchemes , <nl> g_custom_schemes ) ; <nl> <nl> + / / The registered service worker schemes . <nl> + if ( ! g_custom_service_worker_schemes . empty ( ) ) <nl> + command_line - > AppendSwitchASCII ( switches : : kRegisterServiceWorkerSchemes , <nl> + g_custom_service_worker_schemes ) ; <nl> + <nl> # if defined ( OS_WIN ) <nl> / / Append - - app - user - model - id . <nl> PWSTR current_app_id ; <nl> mmm a / atom / browser / atom_browser_client . h <nl> ppp b / atom / browser / atom_browser_client . h <nl> class AtomBrowserClient : public brightray : : BrowserClient , <nl> static void SuppressRendererProcessRestartForOnce ( ) ; <nl> / / Custom schemes to be registered to standard . <nl> static void SetCustomSchemes ( const std : : vector < std : : string > & schemes ) ; <nl> + / / Custom schemes to be registered to handle service worker . <nl> + static void SetCustomServiceWorkerSchemes ( <nl> + const std : : vector < std : : string > & schemes ) ; <nl> <nl> protected : <nl> / / content : : ContentBrowserClient : <nl> mmm a / atom / browser / net / asar / url_request_asar_job . cc <nl> ppp b / atom / browser / net / asar / url_request_asar_job . cc <nl> <nl> # include < string > <nl> # include < vector > <nl> <nl> + # include " atom / common / asar / archive . h " <nl> + # include " atom / common / asar / asar_util . h " <nl> + # include " atom / common / atom_constants . h " <nl> # include " base / bind . h " <nl> # include " base / files / file_util . h " <nl> # include " base / strings / string_util . h " <nl> # include " base / synchronization / lock . h " <nl> # include " base / task_runner . h " <nl> - # include " atom / common / asar / archive . h " <nl> - # include " atom / common / asar / asar_util . h " <nl> # include " net / base / file_stream . h " <nl> # include " net / base / filename_util . h " <nl> # include " net / base / io_buffer . h " <nl> void URLRequestAsarJob : : SetExtraRequestHeaders ( <nl> } <nl> } <nl> <nl> + int URLRequestAsarJob : : GetResponseCode ( ) const { <nl> + / / Request Job gets created only if path exists . <nl> + return 200 ; <nl> + } <nl> + <nl> + void URLRequestAsarJob : : GetResponseInfo ( net : : HttpResponseInfo * info ) { <nl> + std : : string status ( " HTTP / 1 . 1 200 OK " ) ; <nl> + net : : HttpResponseHeaders * headers = new net : : HttpResponseHeaders ( status ) ; <nl> + <nl> + headers - > AddHeader ( atom : : kCORSHeader ) ; <nl> + info - > headers = headers ; <nl> + } <nl> + <nl> void URLRequestAsarJob : : FetchMetaInfo ( const base : : FilePath & file_path , <nl> FileMetaInfo * meta_info ) { <nl> base : : File : : Info file_info ; <nl> mmm a / atom / browser / net / asar / url_request_asar_job . h <nl> ppp b / atom / browser / net / asar / url_request_asar_job . h <nl> class URLRequestAsarJob : public net : : URLRequestJob { <nl> net : : Filter * SetupFilter ( ) const override ; <nl> bool GetMimeType ( std : : string * mime_type ) const override ; <nl> void SetExtraRequestHeaders ( const net : : HttpRequestHeaders & headers ) override ; <nl> + int GetResponseCode ( ) const override ; <nl> + void GetResponseInfo ( net : : HttpResponseInfo * info ) override ; <nl> <nl> private : <nl> / / Meta information about the file . It ' s used as a member in the <nl> mmm a / atom / common / options_switches . cc <nl> ppp b / atom / common / options_switches . cc <nl> const char kDisableHttpCache [ ] = " disable - http - cache " ; <nl> / / Register schemes to standard . <nl> const char kRegisterStandardSchemes [ ] = " register - standard - schemes " ; <nl> <nl> + / / Register schemes to handle service worker . <nl> + const char kRegisterServiceWorkerSchemes [ ] = " register - service - worker - schemes " ; <nl> + <nl> / / The minimum SSL / TLS version ( " tls1 " , " tls1 . 1 " , or " tls1 . 2 " ) that <nl> / / TLS fallback will accept . <nl> const char kSSLVersionFallbackMin [ ] = " ssl - version - fallback - min " ; <nl> mmm a / atom / common / options_switches . h <nl> ppp b / atom / common / options_switches . h <nl> extern const char kPpapiFlashVersion [ ] ; <nl> extern const char kClientCertificate [ ] ; <nl> extern const char kDisableHttpCache [ ] ; <nl> extern const char kRegisterStandardSchemes [ ] ; <nl> + extern const char kRegisterServiceWorkerSchemes [ ] ; <nl> extern const char kSSLVersionFallbackMin [ ] ; <nl> extern const char kCipherSuiteBlacklist [ ] ; <nl> extern const char kAppUserModelId [ ] ; <nl> mmm a / atom / renderer / atom_renderer_client . cc <nl> ppp b / atom / renderer / atom_renderer_client . cc <nl> <nl> # include " third_party / WebKit / public / web / WebLocalFrame . h " <nl> # include " third_party / WebKit / public / web / WebPluginParams . h " <nl> # include " third_party / WebKit / public / web / WebKit . h " <nl> + # include " third_party / WebKit / public / web / WebSecurityPolicy . h " <nl> # include " third_party / WebKit / public / web / WebRuntimeFeatures . h " <nl> # include " third_party / WebKit / public / web / WebView . h " <nl> <nl> void AtomRendererClient : : RenderFrameCreated ( <nl> content : : RenderFrame * render_frame ) { <nl> new PepperHelper ( render_frame ) ; <nl> new AtomRenderFrameObserver ( render_frame , this ) ; <nl> + <nl> + / / Allow file scheme to handle service worker by default . <nl> + blink : : WebSecurityPolicy : : registerURLSchemeAsAllowingServiceWorkers ( " file " ) ; <nl> } <nl> <nl> void AtomRendererClient : : RenderViewCreated ( content : : RenderView * render_view ) { <nl> mmm a / docs / api / protocol . md <nl> ppp b / docs / api / protocol . md <nl> A standard ` scheme ` adheres to what RFC 3986 calls <nl> [ generic URI syntax ] ( https : / / tools . ietf . org / html / rfc3986 # section - 3 ) . This <nl> includes ` file : ` and ` filesystem : ` . <nl> <nl> + # # # ` protocol . registerServiceWorkerSchemes ( schemes ) ` <nl> + <nl> + * ` schemes ` Array - Custom schemes to be registered to handle service workers . <nl> + <nl> # # # ` protocol . registerFileProtocol ( scheme , handler [ , completion ] ) ` <nl> <nl> * ` scheme ` String <nl>
Merge pull request from deepak1556 / service_worker_scheme_patch
electron/electron
991c8b1aa6017af185714ebed06976b08dcff22a
2015-12-10T11:29:51Z
mmm a / 3rdParty / iresearch / core / error / error . hpp <nl> ppp b / 3rdParty / iresearch / core / error / error . hpp <nl> struct IRESEARCH_API error_base : std : : exception { <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / detailed_error_base <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - class IRESEARCH_API detailed_error_base : public error_base { <nl> + class IRESEARCH_API detailed_error_base : public error_base { <nl> public : <nl> - explicit detailed_error_base ( const char * error ) : error_ ( error ) { } <nl> + explicit detailed_error_base ( const char * error ) <nl> + : error_ ( error ) { <nl> + } <nl> + <nl> explicit detailed_error_base ( std : : string & & error ) NOEXCEPT <nl> : error_ ( std : : move ( error ) ) { <nl> } <nl> - virtual const char * what ( ) const NOEXCEPT final { return error_ . c_str ( ) ; } <nl> + <nl> + virtual const char * what ( ) const NOEXCEPT override final { <nl> + return error_ . c_str ( ) ; <nl> + } <nl> <nl> private : <nl> IRESEARCH_API_PRIVATE_VARIABLES_BEGIN <nl> struct IRESEARCH_API illegal_state : error_base { <nl> <nl> NS_END <nl> <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl> mmm a / 3rdParty / iresearch / core / formats / formats_10 . cpp <nl> ppp b / 3rdParty / iresearch / core / formats / formats_10 . cpp <nl> using namespace iresearch ; <nl> class features { <nl> public : <nl> enum Mask : uint32_t { <nl> - POS = 3 , POS_OFFS = 7 , POS_PAY = 11 , POS_OFFS_PAY = 15 <nl> + DOCS = 0 , <nl> + FREQ = 1 , <nl> + POS = 2 , <nl> + OFFS = 4 , <nl> + PAY = 8 <nl> } ; <nl> <nl> features ( ) = default ; <nl> class features { <nl> bool payload ( ) const NOEXCEPT { return irs : : check_bit < 3 > ( mask_ ) ; } <nl> operator Mask ( ) const NOEXCEPT { return static_cast < Mask > ( mask_ ) ; } <nl> <nl> + bool any ( Mask mask ) const NOEXCEPT { <nl> + return Mask ( 0 ) ! = ( mask_ & mask ) ; <nl> + } <nl> + <nl> + bool all ( Mask mask ) const NOEXCEPT { <nl> + return mask ! = ( mask_ & mask ) ; <nl> + } <nl> + <nl> private : <nl> irs : : byte_type mask_ { } ; <nl> } ; / / features <nl> <nl> + ENABLE_BITMASK_ENUM ( features : : Mask ) ; <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> / / - - SECTION - - forward declarations <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> void postings_writer : : prepare ( index_output & out , const iresearch : : flush_state & s <nl> std : : memset ( doc . freqs . get ( ) , 0 , sizeof ( uint32_t ) * BLOCK_SIZE ) ; <nl> } <nl> <nl> - if ( features . check < position > ( ) ) { <nl> + if ( features . check < position > ( ) ) { <nl> / / prepare proximity stream <nl> if ( ! pos_ ) { <nl> pos_ = memory : : make_unique < pos_stream > ( ) ; <nl> void postings_writer : : prepare ( index_output & out , const iresearch : : flush_state & s <nl> pos_ - > reset ( ) ; <nl> prepare_output ( name , pos_ - > out , state , POS_EXT , POS_FORMAT_NAME , FORMAT_MAX ) ; <nl> <nl> - if ( features . check < payload > ( ) | | features . check < offset > ( ) ) { <nl> + if ( features . check < payload > ( ) | | features . check < offset > ( ) ) { <nl> / / prepare payload stream <nl> if ( ! pay_ ) { <nl> pay_ = memory : : make_unique < pay_stream > ( ) ; <nl> void postings_writer : : begin_term ( ) { <nl> doc . start = doc . out - > file_pointer ( ) ; <nl> std : : fill_n ( doc . skip_ptr , MAX_SKIP_LEVELS , doc . start ) ; <nl> if ( features_ . position ( ) ) { <nl> - assert ( pos_ ) ; <nl> + assert ( pos_ & & pos_ - > out ) ; <nl> pos_ - > start = pos_ - > out - > file_pointer ( ) ; <nl> std : : fill_n ( pos_ - > skip_ptr , MAX_SKIP_LEVELS , pos_ - > start ) ; <nl> - if ( features_ . payload ( ) | | features_ . offset ( ) ) { <nl> - assert ( pay_ ) ; <nl> + if ( features_ . any ( features : : OFFS | features : : PAY ) ) { <nl> + assert ( pay_ & & pay_ - > out ) ; <nl> pay_ - > start = pay_ - > out - > file_pointer ( ) ; <nl> std : : fill_n ( pay_ - > skip_ptr , MAX_SKIP_LEVELS , pay_ - > start ) ; <nl> } <nl> void postings_writer : : begin_doc ( doc_id_t id , const frequency * freq ) { <nl> <nl> void postings_writer : : add_position ( uint32_t pos , const offset * offs , const payload * pay ) { <nl> assert ( ! offs | | offs - > start < = offs - > end ) ; <nl> - assert ( pos_ ) ; / * at least positions stream should be created * / <nl> + assert ( features_ . position ( ) & & pos_ & & pos_ - > out ) ; / * at least positions stream should be created * / <nl> <nl> pos_ - > pos ( pos - pos_ - > last ) ; <nl> if ( pay ) pay_ - > payload ( pos_ - > size , pay - > value ) ; <nl> void postings_writer : : add_position ( uint32_t pos , const offset * offs , const paylo <nl> pos_ - > flush ( buf ) ; <nl> <nl> if ( pay ) { <nl> + assert ( features_ . payload ( ) & & pay_ & & pay_ - > out ) ; <nl> pay_ - > flush_payload ( buf ) ; <nl> } <nl> <nl> if ( offs ) { <nl> + assert ( features_ . payload ( ) & & pay_ & & pay_ - > out ) ; <nl> pay_ - > flush_offsets ( buf ) ; <nl> } <nl> } <nl> } <nl> <nl> void postings_writer : : end_doc ( ) { <nl> - if ( doc . full ( ) ) { <nl> + if ( doc . full ( ) ) { <nl> doc . block_last = doc . last ; <nl> doc . end = doc . out - > file_pointer ( ) ; <nl> - if ( pos_ ) { <nl> - assert ( pos_ ) ; <nl> + if ( features_ . position ( ) ) { <nl> + assert ( pos_ & & pos_ - > out ) ; <nl> pos_ - > end = pos_ - > out - > file_pointer ( ) ; <nl> / / documents stream is full , but positions stream is not <nl> / / save number of positions to skip before the next block <nl> pos_ - > block_last = pos_ - > size ; <nl> - if ( pay_ ) { <nl> + if ( features_ . any ( features : : OFFS | features : : PAY ) ) { <nl> + assert ( pay_ & & pay_ - > out ) ; <nl> pay_ - > end = pay_ - > out - > file_pointer ( ) ; <nl> pay_ - > block_last = pay_ - > pay_buf_ . size ( ) ; <nl> } <nl> void postings_writer : : end_term ( version10 : : term_meta & meta , const uint32_t * tfreq <nl> / * write remaining position using <nl> * variable length encoding * / <nl> if ( features_ . position ( ) ) { <nl> + assert ( pos_ & & pos_ - > out ) ; <nl> + <nl> if ( meta . freq > BLOCK_SIZE ) { <nl> meta . pos_end = pos_ - > out - > file_pointer ( ) - pos_ - > start ; <nl> } <nl> void postings_writer : : end_term ( version10 : : term_meta & meta , const uint32_t * tfreq <nl> for ( uint32_t i = 0 ; i < pos_ - > size ; + + i ) { <nl> const uint32_t pos_delta = pos_ - > buf [ i ] ; <nl> if ( features_ . payload ( ) ) { <nl> + assert ( pay_ & & pay_ - > out ) ; <nl> + <nl> const uint32_t size = pay_ - > pay_sizes [ i ] ; <nl> if ( last_pay_size ! = size ) { <nl> last_pay_size = size ; <nl> void postings_writer : : end_term ( version10 : : term_meta & meta , const uint32_t * tfreq <nl> } <nl> <nl> if ( features_ . offset ( ) ) { <nl> + assert ( pay_ & & pay_ - > out ) ; <nl> + <nl> const uint32_t pay_offs_delta = pay_ - > offs_start_buf [ i ] ; <nl> const uint32_t len = pay_ - > offs_len_buf [ i ] ; <nl> if ( len = = last_offs_len ) { <nl> void postings_writer : : end_term ( version10 : : term_meta & meta , const uint32_t * tfreq <nl> } <nl> <nl> if ( features_ . payload ( ) ) { <nl> + assert ( pay_ & & pay_ - > out ) ; <nl> pay_ - > pay_buf_ . clear ( ) ; <nl> } <nl> } <nl> void postings_writer : : write_skip ( size_t level , index_output & out ) { <nl> <nl> pos_ - > skip_ptr [ level ] = pos_ptr ; <nl> <nl> - if ( features_ . payload ( ) | | features_ . offset ( ) ) { <nl> - assert ( pay_ ) ; <nl> + if ( features_ . any ( features : : OFFS | features : : PAY ) ) { <nl> + assert ( pay_ & & pay_ - > out ) ; <nl> <nl> if ( features_ . payload ( ) ) { <nl> out . write_vint ( static_cast < uint32_t > ( pay_ - > block_last ) ) ; <nl> void postings_writer : : encode ( <nl> if ( type_limits < type_t : : address_t > : : valid ( meta . pos_end ) ) { <nl> out . write_vlong ( meta . pos_end ) ; <nl> } <nl> - if ( features_ . payload ( ) | | features_ . offset ( ) ) { <nl> + if ( features_ . any ( features : : OFFS | features : : PAY ) ) { <nl> out . write_vlong ( meta . pay_start - last_state . pay_start ) ; <nl> } <nl> } <nl> void postings_reader : : decode ( <nl> } <nl> } <nl> <nl> + # if defined ( _MSC_VER ) <nl> + # elif defined ( __GNUC__ ) <nl> + # pragma GCC diagnostic push <nl> + # pragma GCC diagnostic ignored " - Wswitch " <nl> + # endif <nl> + <nl> irs : : doc_iterator : : ptr postings_reader : : iterator ( <nl> const flags & field , <nl> const attribute_view & attrs , <nl> irs : : doc_iterator : : ptr postings_reader : : iterator ( <nl> const auto enabled = features & req ; <nl> doc_iterator : : ptr it ; <nl> <nl> - switch ( enabled ) { <nl> - case features : : POS_OFFS_PAY : <nl> + / / MSVC 2013 doesn ' t support constexpr , can ' t use <nl> + / / ' operator | ' in the following switch statement <nl> + CONSTEXPR const auto FREQ_POS_OFFS_PAY = features : : FREQ | features : : POS | features : : OFFS | features : : PAY ; <nl> + CONSTEXPR const auto FREQ_POS_OFFS = features : : FREQ | features : : POS | features : : OFFS ; <nl> + CONSTEXPR const auto FREQ_POS_PAY = features : : FREQ | features : : POS | features : : PAY ; <nl> + CONSTEXPR const auto FREQ_POS = features : : FREQ | features : : POS ; <nl> + <nl> + switch ( enabled ) { <nl> + case FREQ_POS_OFFS_PAY : <nl> it = doc_iterator : : make < pos_doc_iterator < offs_pay_iterator > > ( ) ; <nl> break ; <nl> - case features : : POS_OFFS : <nl> + case FREQ_POS_OFFS : <nl> it = doc_iterator : : make < pos_doc_iterator < offs_iterator > > ( ) ; <nl> break ; <nl> - case features : : POS_PAY : <nl> + case FREQ_POS_PAY : <nl> it = doc_iterator : : make < pos_doc_iterator < pay_iterator > > ( ) ; <nl> break ; <nl> - case features : : POS : <nl> + case FREQ_POS : <nl> it = doc_iterator : : make < pos_doc_iterator < pos_iterator > > ( ) ; <nl> break ; <nl> default : <nl> irs : : doc_iterator : : ptr postings_reader : : iterator ( <nl> return IMPLICIT_MOVE_WORKAROUND ( it ) ; <nl> } <nl> <nl> + # if defined ( _MSC_VER ) <nl> + # elif defined ( __GNUC__ ) <nl> + # pragma GCC diagnostic pop <nl> + # endif <nl> + <nl> / / actual implementation <nl> class format : public irs : : version10 : : format { <nl> public : <nl> NS_END / / root <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - END - OF - FILE <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> \ No newline at end of file <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / 3rdParty / iresearch / core / index / index_writer . cpp <nl> ppp b / 3rdParty / iresearch / core / index / index_writer . cpp <nl> NS_END <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - END - OF - FILE <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> \ No newline at end of file <nl> mmm a / 3rdParty / iresearch / core / utils / string_utils . hpp <nl> ppp b / 3rdParty / iresearch / core / utils / string_utils . hpp <nl> <nl> <nl> # include " shared . hpp " <nl> <nl> + # if defined ( _MSC_VER ) & & _MSC_VER < 1900 / / before MSVC2015 <nl> + # define snprintf _snprintf <nl> + # endif <nl> + <nl> NS_ROOT <nl> NS_BEGIN ( string_utils ) <nl> <nl> inline std : : basic_string < T > & oversize ( <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> template < typename . . . Args > <nl> inline int to_string ( std : : string & buf , const char * format , Args & & . . . args ) { <nl> - char ch ; <nl> - auto result = snprintf ( & ch , 0 , format , std : : forward < Args > ( args ) . . . ) ; <nl> + auto result = snprintf ( nullptr , 0 , format , std : : forward < Args > ( args ) . . . ) ; / / MSVC requires ' nullptr ' buffer and ' 0 ' size to get expected size <nl> <nl> if ( result < = 0 ) { <nl> return result ; <nl> inline int to_string ( std : : string & buf , const char * format , Args & & . . . args ) { <nl> <nl> try { <nl> result = snprintf ( & buf [ start ] , result , format , std : : forward < Args > ( args ) . . . ) ; <nl> - buf . resize ( start + std : : max ( 0 , result ) ) ; <nl> + buf . resize ( start + ( std : : max ) ( 0 , result ) ) ; <nl> } catch ( . . . ) { <nl> buf . resize ( start ) ; <nl> <nl> inline std : : string to_string ( const char * format , Args & & . . . args ) { <nl> <nl> assert ( result > = 0 ) ; <nl> assert ( size_t ( result ) = = buf . size ( ) ) ; <nl> - <nl> UNUSED ( result ) ; <nl> <nl> return buf ; <nl> inline std : : string to_string ( const char * format , Args & & . . . args ) { <nl> NS_END / / string_utils <nl> NS_END <nl> <nl> - # endif <nl> + # endif <nl> \ No newline at end of file <nl> mmm a / 3rdParty / iresearch / core / utils / timer_utils . cpp <nl> ppp b / 3rdParty / iresearch / core / utils / timer_utils . cpp <nl> <nl> / / / @ author Vasiliy Nabatchikov <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - # include < mutex > <nl> - # include < unordered_map > <nl> # include " singleton . hpp " <nl> # include " timer_utils . hpp " <nl> <nl> + # include < mutex > <nl> + # include < unordered_map > <nl> + # include < map > <nl> + <nl> NS_LOCAL <nl> <nl> class timer_states : public iresearch : : singleton < timer_states > { <nl> bool visit ( <nl> return timer_states : : instance ( ) . visit ( visitor ) ; <nl> } <nl> <nl> + void flush_stats ( std : : ostream & out ) { <nl> + std : : map < std : : string , std : : pair < size_t , size_t > > ordered_stats ; <nl> + <nl> + iresearch : : timer_utils : : visit ( [ & ordered_stats ] ( const std : : string & key , size_t count , size_t time ) - > bool { <nl> + std : : string key_str = key ; <nl> + <nl> + # if defined ( __GNUC__ ) <nl> + if ( key_str . compare ( 0 , strlen ( " virtual " ) , " virtual " ) = = 0 ) { <nl> + key_str = key_str . substr ( strlen ( " virtual " ) ) ; <nl> + } <nl> + <nl> + size_t i ; <nl> + <nl> + if ( std : : string : : npos ! = ( i = key_str . find ( ' ' ) ) & & key_str . find ( ' ( ' ) > i ) { <nl> + key_str = key_str . substr ( i + 1 ) ; <nl> + } <nl> + # elif defined ( _MSC_VER ) <nl> + size_t i ; <nl> + <nl> + if ( std : : string : : npos ! = ( i = key_str . find ( " __cdecl " ) ) ) { <nl> + key_str = key_str . substr ( i + strlen ( " __cdecl " ) ) ; <nl> + } <nl> + # endif <nl> + <nl> + ordered_stats . emplace ( key_str , std : : make_pair ( count , time ) ) ; <nl> + return true ; <nl> + } ) ; <nl> + <nl> + for ( auto & entry : ordered_stats ) { <nl> + auto & key = entry . first ; <nl> + auto & count = entry . second . first ; <nl> + auto & time = entry . second . second ; <nl> + out < < key < < " \ tcalls : " < < count < < " , \ ttime : " < < time / 1000 < < " us , \ tavg call : " < < time / 1000 / ( double ) count < < " us " < < std : : endl ; <nl> + } <nl> + } <nl> + <nl> NS_END / / timer_utils <nl> NS_END / / NS_ROOT <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - END - OF - FILE <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> \ No newline at end of file <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / 3rdParty / iresearch / core / utils / timer_utils . hpp <nl> ppp b / 3rdParty / iresearch / core / utils / timer_utils . hpp <nl> IRESEARCH_API bool visit ( <nl> const std : : function < bool ( const std : : string & key , size_t count , size_t time_us ) > & visitor <nl> ) ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief flush formatted timer stats to a specified stream <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + IRESEARCH_API void flush_stats ( std : : ostream & out ) ; <nl> + <nl> NS_END / / timer_utils <nl> NS_END / / NS_ROOT <nl> <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl> mmm a / 3rdParty / iresearch / tests / formats / formats_10_tests . cpp <nl> ppp b / 3rdParty / iresearch / tests / formats / formats_10_tests . cpp <nl> <nl> # include " store / memory_directory . hpp " <nl> # include " store / fs_directory . hpp " <nl> # include " utils / bit_packing . hpp " <nl> + # include " utils / type_limits . hpp " <nl> # include " formats / formats_10 . hpp " <nl> # include " formats / formats_10_attributes . hpp " <nl> # include " formats_test_case_base . hpp " <nl> class format_10_test_case : public tests : : format_test_case_base { <nl> } <nl> } <nl> <nl> + void postings_writer_reuse ( ) { <nl> + auto codec = std : : dynamic_pointer_cast < const irs : : version10 : : format > ( get_codec ( ) ) ; <nl> + ASSERT_NE ( nullptr , codec ) ; <nl> + auto writer = codec - > get_postings_writer ( false ) ; <nl> + ASSERT_NE ( nullptr , writer ) ; <nl> + <nl> + std : : vector < irs : : doc_id_t > docs0 ; <nl> + irs : : doc_id_t i = ( irs : : type_limits < irs : : type_t : : doc_id_t > : : min ) ( ) ; <nl> + for ( ; i < 1000 ; + + i ) { <nl> + docs0 . push_back ( i ) ; <nl> + } <nl> + <nl> + / / gap <nl> + <nl> + for ( i + = 1000 ; i < 10000 ; + + i ) { <nl> + docs0 . push_back ( i ) ; <nl> + } <nl> + <nl> + / / write docs ' segment0 ' with all possible streams <nl> + { <nl> + const irs : : field_meta field ( <nl> + " field " , irs : : flags { irs : : frequency : : type ( ) , irs : : position : : type ( ) , irs : : offset : : type ( ) , irs : : payload : : type ( ) } <nl> + ) ; <nl> + <nl> + irs : : flush_state state ; <nl> + state . dir = & dir ( ) ; <nl> + state . doc_count = 10000 ; <nl> + state . fields_count = 1 ; <nl> + state . name = " 0 " ; <nl> + state . features = & field . features ; / / all possible features in segment <nl> + state . ver = IRESEARCH_VERSION ; <nl> + <nl> + auto out = dir ( ) . create ( std : : string ( " postings " ) + state . name . c_str ( ) ) ; <nl> + ASSERT_FALSE ( ! out ) ; <nl> + <nl> + postings docs ( docs0 . begin ( ) , docs0 . end ( ) ) ; <nl> + <nl> + writer - > prepare ( * out , state ) ; <nl> + writer - > begin_field ( * state . features ) ; <nl> + writer - > write ( docs ) ; <nl> + writer - > end ( ) ; <nl> + } <nl> + <nl> + / / write docs ' segment1 ' with position & offset <nl> + { <nl> + const irs : : field_meta field ( <nl> + " field " , irs : : flags { irs : : frequency : : type ( ) , irs : : position : : type ( ) , irs : : offset : : type ( ) } <nl> + ) ; <nl> + <nl> + irs : : flush_state state ; <nl> + state . dir = & dir ( ) ; <nl> + state . doc_count = 10000 ; <nl> + state . fields_count = 1 ; <nl> + state . name = " 1 " ; <nl> + state . features = & field . features ; / / all possible features in segment <nl> + state . ver = IRESEARCH_VERSION ; <nl> + <nl> + auto out = dir ( ) . create ( std : : string ( " postings " ) + state . name . c_str ( ) ) ; <nl> + ASSERT_FALSE ( ! out ) ; <nl> + <nl> + postings docs ( docs0 . begin ( ) , docs0 . end ( ) ) ; <nl> + <nl> + writer - > prepare ( * out , state ) ; <nl> + writer - > begin_field ( * state . features ) ; <nl> + writer - > write ( docs ) ; <nl> + writer - > end ( ) ; <nl> + } <nl> + <nl> + / / write docs ' segment2 ' with position & payload <nl> + { <nl> + const irs : : field_meta field ( <nl> + " field " , irs : : flags { irs : : frequency : : type ( ) , irs : : position : : type ( ) , irs : : payload : : type ( ) } <nl> + ) ; <nl> + <nl> + irs : : flush_state state ; <nl> + state . dir = & dir ( ) ; <nl> + state . doc_count = 10000 ; <nl> + state . fields_count = 1 ; <nl> + state . name = " 2 " ; <nl> + state . features = & field . features ; / / all possible features in segment <nl> + state . ver = IRESEARCH_VERSION ; <nl> + <nl> + auto out = dir ( ) . create ( std : : string ( " postings " ) + state . name . c_str ( ) ) ; <nl> + ASSERT_FALSE ( ! out ) ; <nl> + <nl> + postings docs ( docs0 . begin ( ) , docs0 . end ( ) ) ; <nl> + <nl> + writer - > prepare ( * out , state ) ; <nl> + writer - > begin_field ( * state . features ) ; <nl> + writer - > write ( docs ) ; <nl> + writer - > end ( ) ; <nl> + } <nl> + <nl> + / / write docs ' segment3 ' with position <nl> + { <nl> + const irs : : field_meta field ( <nl> + " field " , irs : : flags { irs : : frequency : : type ( ) , irs : : position : : type ( ) } <nl> + ) ; <nl> + <nl> + irs : : flush_state state ; <nl> + state . dir = & dir ( ) ; <nl> + state . doc_count = 10000 ; <nl> + state . fields_count = 1 ; <nl> + state . name = " 3 " ; <nl> + state . features = & field . features ; / / all possible features in segment <nl> + state . ver = IRESEARCH_VERSION ; <nl> + <nl> + auto out = dir ( ) . create ( std : : string ( " postings " ) + state . name . c_str ( ) ) ; <nl> + ASSERT_FALSE ( ! out ) ; <nl> + <nl> + postings docs ( docs0 . begin ( ) , docs0 . end ( ) ) ; <nl> + <nl> + writer - > prepare ( * out , state ) ; <nl> + writer - > begin_field ( * state . features ) ; <nl> + writer - > write ( docs ) ; <nl> + writer - > end ( ) ; <nl> + } <nl> + <nl> + / / write docs ' segment3 ' with frequency <nl> + { <nl> + const irs : : field_meta field ( <nl> + " field " , irs : : flags { irs : : frequency : : type ( ) } <nl> + ) ; <nl> + <nl> + irs : : flush_state state ; <nl> + state . dir = & dir ( ) ; <nl> + state . doc_count = 10000 ; <nl> + state . fields_count = 1 ; <nl> + state . name = " 4 " ; <nl> + state . features = & field . features ; / / all possible features in segment <nl> + state . ver = IRESEARCH_VERSION ; <nl> + <nl> + auto out = dir ( ) . create ( std : : string ( " postings " ) + state . name . c_str ( ) ) ; <nl> + ASSERT_FALSE ( ! out ) ; <nl> + <nl> + postings docs ( docs0 . begin ( ) , docs0 . end ( ) ) ; <nl> + <nl> + writer - > prepare ( * out , state ) ; <nl> + writer - > begin_field ( * state . features ) ; <nl> + writer - > write ( docs ) ; <nl> + writer - > end ( ) ; <nl> + } <nl> + <nl> + <nl> + / / writer segment without any attributes <nl> + { <nl> + const irs : : field_meta field_no_features ( <nl> + " field " , irs : : flags { } <nl> + ) ; <nl> + <nl> + irs : : flush_state state ; <nl> + state . dir = & dir ( ) ; <nl> + state . doc_count = 10000 ; <nl> + state . fields_count = 1 ; <nl> + state . name = " 5 " ; <nl> + state . features = & field_no_features . features ; / / all possible features in segment <nl> + state . ver = IRESEARCH_VERSION ; <nl> + <nl> + auto out = dir ( ) . create ( std : : string ( " postings " ) + state . name . c_str ( ) ) ; <nl> + ASSERT_FALSE ( ! out ) ; <nl> + <nl> + postings docs ( docs0 . begin ( ) , docs0 . end ( ) ) ; <nl> + <nl> + writer - > prepare ( * out , state ) ; <nl> + writer - > begin_field ( * state . features ) ; <nl> + writer - > write ( docs ) ; <nl> + writer - > end ( ) ; <nl> + } <nl> + } <nl> + <nl> void assert_positions ( const irs : : doc_iterator & expected , const irs : : doc_iterator & actual ) { <nl> auto & expected_pos = expected . attributes ( ) . get < irs : : position > ( ) ; <nl> auto & actual_pos = actual . attributes ( ) . get < irs : : position > ( ) ; <nl> TEST_F ( memory_format_10_test_case , document_mask_rw ) { <nl> document_mask_read_write ( ) ; <nl> } <nl> <nl> + TEST_F ( memory_format_10_test_case , reuse_postings_writer ) { <nl> + postings_writer_reuse ( ) ; <nl> + } <nl> + <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> / / - - SECTION - - fs_directory + iresearch_format_10 <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> mmm a / 3rdParty / iresearch / tests / index / index_profile_tests . cpp <nl> ppp b / 3rdParty / iresearch / tests / index / index_profile_tests . cpp <nl> class index_test_case_base : public index_test_base { <nl> <nl> std : : ofstream out ( path . native ( ) ) ; <nl> <nl> - flush_timers ( out ) ; <nl> + irs : : timer_utils : : flush_stats ( out ) ; <nl> <nl> out . close ( ) ; <nl> std : : cout < < " Path to timing log : " < < path . utf8_absolute ( ) < < std : : endl ; <nl> TEST_F ( mmap_index_profile_test , profile_bulk_index_multithread_update_batched_mt <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - END - OF - FILE <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> \ No newline at end of file <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / 3rdParty / iresearch / tests / index / transaction_store_tests . cpp <nl> ppp b / 3rdParty / iresearch / tests / index / transaction_store_tests . cpp <nl> class transaction_store_tests : public test_base { <nl> <nl> std : : ofstream out ( path . native ( ) ) ; <nl> <nl> - flush_timers ( out ) ; <nl> + irs : : timer_utils : : flush_stats ( out ) ; <nl> out . close ( ) ; <nl> std : : cout < < " Path to timing log : " < < path . utf8_absolute ( ) < < std : : endl ; <nl> <nl> TEST_F ( transaction_store_tests , read_reopen ) { <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / - - SECTION - - END - OF - FILE <nl> - / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> \ No newline at end of file <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / 3rdParty / iresearch / tests / tests_main . cpp <nl> ppp b / 3rdParty / iresearch / tests / tests_main . cpp <nl> int test_base : : initialize ( int argc , char * argv [ ] ) { <nl> return RUN_ALL_TESTS ( ) ; <nl> } <nl> <nl> - void flush_timers ( std : : ostream & out ) { <nl> - std : : map < std : : string , std : : pair < size_t , size_t > > ordered_stats ; <nl> - <nl> - iresearch : : timer_utils : : visit ( [ & ordered_stats ] ( const std : : string & key , size_t count , size_t time ) - > bool { <nl> - std : : string key_str = key ; <nl> - <nl> - # if defined ( __GNUC__ ) <nl> - if ( key_str . compare ( 0 , strlen ( " virtual " ) , " virtual " ) = = 0 ) { <nl> - key_str = key_str . substr ( strlen ( " virtual " ) ) ; <nl> - } <nl> - <nl> - size_t i ; <nl> - <nl> - if ( std : : string : : npos ! = ( i = key_str . find ( ' ' ) ) & & key_str . find ( ' ( ' ) > i ) { <nl> - key_str = key_str . substr ( i + 1 ) ; <nl> - } <nl> - # elif defined ( _MSC_VER ) <nl> - size_t i ; <nl> - <nl> - if ( std : : string : : npos ! = ( i = key_str . find ( " __cdecl " ) ) ) { <nl> - key_str = key_str . substr ( i + strlen ( " __cdecl " ) ) ; <nl> - } <nl> - # endif <nl> - <nl> - ordered_stats . emplace ( key_str , std : : make_pair ( count , time ) ) ; <nl> - return true ; <nl> - } ) ; <nl> - <nl> - for ( auto & entry : ordered_stats ) { <nl> - auto & key = entry . first ; <nl> - auto & count = entry . second . first ; <nl> - auto & time = entry . second . second ; <nl> - out < < key < < " \ tcalls : " < < count < < " , \ ttime : " < < time / 1000 < < " us , \ tavg call : " < < time / 1000 / ( double ) count < < " us " < < std : : endl ; <nl> - } <nl> - } <nl> - <nl> void stack_trace_handler ( int sig ) { <nl> / / reset to default handler <nl> signal ( sig , SIG_DFL ) ; <nl> mmm a / 3rdParty / iresearch / tests / tests_shared . hpp <nl> ppp b / 3rdParty / iresearch / tests / tests_shared . hpp <nl> class test_base : public : : testing : : Test { <nl> bool artifacts_ ; <nl> } ; / / test_base <nl> <nl> - / / writes formatted report to the specified output stream <nl> - void flush_timers ( std : : ostream & out ) ; <nl> - <nl> - # endif <nl> \ No newline at end of file <nl> + # endif <nl> mmm a / 3rdParty / iresearch / tests / utils / memory_tests . cpp <nl> ppp b / 3rdParty / iresearch / tests / utils / memory_tests . cpp <nl> TEST_F ( memory_pool_allocator_test , profile_std_map ) { <nl> <nl> std : : ofstream out ( path . native ( ) ) ; <nl> <nl> - flush_timers ( out ) ; <nl> + irs : : timer_utils : : flush_stats ( out ) ; <nl> out . close ( ) ; <nl> std : : cout < < " Path to timing log : " < < path . utf8_absolute ( ) < < std : : endl ; <nl> } <nl> TEST_F ( memory_pool_allocator_test , profile_std_multimap ) { <nl> <nl> std : : ofstream out ( path . native ( ) ) ; <nl> <nl> - flush_timers ( out ) ; <nl> + irs : : timer_utils : : flush_stats ( out ) ; <nl> out . close ( ) ; <nl> std : : cout < < " Path to timing log : " < < path . utf8_absolute ( ) < < std : : endl ; <nl> } <nl> TEST_F ( memory_pool_allocator_test , profile_std_list ) { <nl> <nl> std : : ofstream out ( path . native ( ) ) ; <nl> <nl> - flush_timers ( out ) ; <nl> + irs : : timer_utils : : flush_stats ( out ) ; <nl> out . close ( ) ; <nl> std : : cout < < " Path to timing log : " < < path . utf8_absolute ( ) < < std : : endl ; <nl> } <nl> TEST_F ( memory_pool_allocator_test , profile_std_set ) { <nl> <nl> std : : ofstream out ( path . native ( ) ) ; <nl> <nl> - flush_timers ( out ) ; <nl> + irs : : timer_utils : : flush_stats ( out ) ; <nl> out . close ( ) ; <nl> std : : cout < < " Path to timing log : " < < path . utf8_absolute ( ) < < std : : endl ; <nl> } <nl>
update codebase ( )
arangodb/arangodb
d30cf315fdc3bc0f76ff8eee0ce82099c2d0a8c8
2018-10-29T13:59:39Z
mmm a / lib / libass / xbmc / libass_win32 / libass_win32_vs2010 . vcxproj <nl> ppp b / lib / libass / xbmc / libass_win32 / libass_win32_vs2010 . vcxproj <nl> <nl> < TargetMachine > MachineX86 < / TargetMachine > <nl> < AdditionalLibraryDirectories > <nl> < / AdditionalLibraryDirectories > <nl> + < ModuleDefinitionFile > libass . def < / ModuleDefinitionFile > <nl> < / Link > <nl> < CustomBuildStep > <nl> < Command > copy / B / Y " $ ( TargetPath ) " " $ ( SolutionDir ) . . \ . . \ system \ players \ dvdplayer \ $ ( TargetFileName ) " < / Command > <nl> <nl> < TargetMachine > MachineX86 < / TargetMachine > <nl> < AdditionalLibraryDirectories > <nl> < / AdditionalLibraryDirectories > <nl> + < ModuleDefinitionFile > libass . def < / ModuleDefinitionFile > <nl> < / Link > <nl> < CustomBuildStep > <nl> < Command > copy / B / Y " $ ( TargetPath ) " " $ ( SolutionDir ) . . \ . . \ system \ players \ dvdplayer \ $ ( TargetFileName ) " < / Command > <nl> <nl> < ReferenceOutputAssembly > false < / ReferenceOutputAssembly > <nl> < / ProjectReference > <nl> < / ItemGroup > <nl> + < ItemGroup > <nl> + < None Include = " libass . def " / > <nl> + < / ItemGroup > <nl> < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> < ImportGroup Label = " ExtensionTargets " > <nl> < / ImportGroup > <nl>
[ WIN32 ] fixed : libass build for VS2010
xbmc/xbmc
b422499392eac99b7bddf71c82dac57c514078d4
2010-08-29T04:57:57Z
mmm a / cmake / scripts / common / AddonHelpers . cmake <nl> ppp b / cmake / scripts / common / AddonHelpers . cmake <nl> macro ( build_addon target prefix libs ) <nl> # Pack files together to create an archive <nl> install ( DIRECTORY $ { target } DESTINATION . / <nl> COMPONENT $ { target } - $ { $ { prefix } _VERSION } <nl> - REGEX " . + \ . xml \ . in ( clude ) ? $ " EXCLUDE ) <nl> + REGEX " . + \ \ . xml \ \ . in ( clude ) ? $ " EXCLUDE ) <nl> if ( WIN32 ) <nl> if ( NOT CPACK_PACKAGE_DIRECTORY ) <nl> # determine the temporary path <nl> macro ( build_addon target prefix libs ) <nl> install ( FILES $ { LIBRARY_LOCATION } DESTINATION $ { CMAKE_INSTALL_LIBDIR } / addons / $ { target } RENAME $ { LIBRARY_FILENAME } ) <nl> endif ( ) <nl> install ( DIRECTORY $ { target } DESTINATION $ { CMAKE_INSTALL_DATADIR } / addons <nl> - REGEX " . + \ . xml \ . in ( clude ) ? $ " EXCLUDE ) <nl> + REGEX " . + \ \ . xml \ \ . in ( clude ) ? $ " EXCLUDE ) <nl> if ( $ { prefix } _CUSTOM_DATA ) <nl> install ( DIRECTORY $ { $ { prefix } _CUSTOM_DATA } DESTINATION $ { CMAKE_INSTALL_DATADIR } / addons / $ { target } / resources ) <nl> endif ( ) <nl>
[ cmake ] correctly escape install regex syntax introduced at e54cd63add
xbmc/xbmc
0f1440bc43e4dc286bcba874423df4780f5a8509
2017-09-15T21:17:12Z
mmm a / README . md <nl> ppp b / README . md <nl> and discussion . * * <nl> People who are a little more adventurous can also try our nightly binaries : <nl> <nl> * Linux CPU - only : [ Python 2 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = cpu - slave / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - cp27 - none - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = cpu - slave / ) ) / [ Python 3 . 4 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = cpu - slave / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - cp34 - cp34m - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = cpu - slave / ) ) / [ Python 3 . 5 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - python35 - linux - cpu / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - cp35 - cp35m - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - python35 - linux - cpu / ) ) <nl> - * Linux GPU : [ Python 2 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - linux / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - cp27 - none - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - linux / ) ) / [ Python 3 . 4 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - linux / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - cp34 - cp34m - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - linux / ) ) / [ Python 3 . 5 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 . 5 , label = gpu - linux / 140 / artifact / pip_test / whl / tensorflow - 0 . 8 . 0 - cp35 - cp35m - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 . 5 , label = gpu - linux / ) ) <nl> + * Linux GPU : [ Python 2 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - linux / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - cp27 - none - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - linux / ) ) / [ Python 3 . 4 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - linux / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - cp34 - cp34m - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - linux / ) ) / [ Python 3 . 5 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 . 5 , label = gpu - linux / 140 / artifact / pip_test / whl / tensorflow - 0 . 8 . 0 - cp35 - cp35m - linux_x86_64 . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - linux - gpu / TF_BUILD_CONTAINER_TYPE = GPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 . 5 , label = gpu - linux / ) ) <nl> * Mac CPU - only : [ Python 2 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = mac1 - slave / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - py2 - none - any . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = mac1 - slave / ) ) / [ Python 3 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = mac1 - slave / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - py3 - none - any . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - cpu / TF_BUILD_CONTAINER_TYPE = CPU , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = mac1 - slave / ) ) <nl> - * Mac GPU : [ Python 2 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - mac / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - py2 - none - any . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - mac / ) ) / [ Python 3 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - mac / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - py3 - none - any . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nigntly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - mac / ) ) <nl> + * Mac GPU : [ Python 2 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - mac / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - py2 - none - any . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = gpu - mac / ) ) / [ Python 3 ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - mac / lastSuccessfulBuild / artifact / pip_test / whl / tensorflow - 0 . 10 . 0rc0 - py3 - none - any . whl ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - mac - gpu / TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = PIP , TF_BUILD_PYTHON_VERSION = PYTHON3 , label = gpu - mac / ) ) <nl> * [ Android ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - android / TF_BUILD_CONTAINER_TYPE = ANDROID , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = NO_PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = android - slave / lastSuccessfulBuild / artifact / bazel - out / local_linux / bin / tensorflow / examples / android / tensorflow_demo . apk ) ( [ build history ] ( https : / / ci . tensorflow . org / view / Nightly / job / nightly - matrix - android / TF_BUILD_CONTAINER_TYPE = ANDROID , TF_BUILD_IS_OPT = OPT , TF_BUILD_IS_PIP = NO_PIP , TF_BUILD_PYTHON_VERSION = PYTHON2 , label = android - slave / ) ) <nl> <nl> # # # # * Try your first TensorFlow program * <nl>
Merge pull request from caisq / fix - typo
tensorflow/tensorflow
a04b3a0d3586270583375364fd59f6da86d1130a
2016-08-26T14:45:29Z
mmm a / tools / android / packaging / Makefile . in <nl> ppp b / tools / android / packaging / Makefile . in <nl> res : <nl> cp - fp media / drawable - mdpi / ic_launcher . png xbmc / res / drawable - mdpi / ic_launcher . png <nl> cp - fp media / drawable - xhdpi / ic_launcher . png xbmc / res / drawable - xhdpi / ic_launcher . png <nl> cp - fp media / drawable - xxhdpi / ic_launcher . png xbmc / res / drawable - xxhdpi / ic_launcher . png <nl> + cp - fp $ ( CORE_SOURCE_DIR ) / media / Splash . png xbmc / res / drawable - xxxhdpi / splash . png <nl> cp - fp media / drawable - xxxhdpi / ic_launcher . png xbmc / res / drawable - xxxhdpi / ic_launcher . png <nl> cp - fp media / drawable - xhdpi / banner . png xbmc / res / drawable - xhdpi / banner . png <nl> cp xbmc / strings . xml xbmc / res / values / <nl>
FIX : [ droid ] Copy splash to xxxhdpi drawable
xbmc/xbmc
2816efc77d71d50200ea3ae12fb66ad324d1f6e2
2017-01-21T17:32:50Z
mmm a / bench / stress - client / ops / sqlite_mirror . hpp <nl> ppp b / bench / stress - client / ops / sqlite_mirror . hpp <nl> <nl> # include " ops / watcher_and_tracker . hpp " <nl> # include " protocols / sqlite_protocol . hpp " <nl> # include " op . hpp " <nl> + # include < vector > <nl> <nl> / * sqlite_mirror_t keeps key - value pairs in a SQLite database on the side , <nl> and uses that mirror to allow verification operations to be run against the <nl> struct sqlite_mirror_verify_op_t : public op_t { <nl> <nl> payload_t key ; <nl> payload_t value ; <nl> + std : : vector < payload_t > keys ; <nl> + std : : vector < payload_t > values ; <nl> + <nl> m - > sqlite - > dump_start ( ) ; <nl> - ticks_t start_time = get_ticks ( ) ; <nl> + <nl> while ( m - > sqlite - > dump_next ( & key , & value ) ) { <nl> - proto - > read ( & key , 1 , & value ) ; <nl> + keys . push_back ( key ) ; <nl> + values . push_back ( value ) ; <nl> } <nl> + <nl> + ticks_t start_time = get_ticks ( ) ; <nl> + proto - > read ( & keys [ 0 ] , ( int ) keys . size ( ) , & values [ 0 ] ) ; <nl> ticks_t end_time = get_ticks ( ) ; <nl> + <nl> m - > sqlite - > dump_end ( ) ; <nl> <nl> push_stats ( end_time - start_time , 1 ) ; <nl> mmm a / bench / stress - client / protocols / rethinkdb_protocol . hpp <nl> ppp b / bench / stress - client / protocols / rethinkdb_protocol . hpp <nl> <nl> # define PRIMARY_KEY_NAME " id " <nl> <nl> struct rethinkdb_protocol_t : protocol_t { <nl> - rethinkdb_protocol_t ( const char * conn_str ) : sockfd ( - 1 ) { <nl> + rethinkdb_protocol_t ( const char * conn_str ) : token_index ( 0 ) , sockfd ( - 1 ) , queued_read ( - 1 ) { <nl> / / initialize the socket <nl> sockfd = socket ( AF_INET , SOCK_STREAM , 0 ) ; <nl> if ( sockfd < 0 ) { <nl> struct rethinkdb_protocol_t : protocol_t { <nl> / / get response <nl> Response * response = new Response ; <nl> get_response ( response , query - > token ( ) ) ; <nl> + <nl> if ( response - > token ( ) ! = query - > token ( ) ) { <nl> fprintf ( stderr , " Delete response token % ld did not match query token % ld . \ n " , response - > token ( ) , query - > token ( ) ) ; <nl> throw protocol_error_t ( " Delete response token mismatch . " ) ; <nl> } <nl> + <nl> if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> fprintf ( stderr , " Failed to remove key % s : % s \ n " , key , response - > error_message ( ) . c_str ( ) ) ; <nl> throw protocol_error_t ( " Failed to successfully delete . " ) ; <nl> struct rethinkdb_protocol_t : protocol_t { <nl> / / get response <nl> Response * response = new Response ; <nl> get_response ( response , query - > token ( ) ) ; <nl> + <nl> if ( response - > token ( ) ! = query - > token ( ) ) { <nl> fprintf ( stderr , " Insert response token % ld did not match query token % ld . \ n " , response - > token ( ) , query - > token ( ) ) ; <nl> throw protocol_error_t ( " Update response token mismatch . " ) ; <nl> } <nl> + <nl> if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> fprintf ( stderr , " Failed to insert key % s , value % s : % s \ n " , key , value , response - > error_message ( ) . c_str ( ) ) ; <nl> throw protocol_error_t ( " Failed to successfully update . " ) ; <nl> struct rethinkdb_protocol_t : protocol_t { <nl> / / get response <nl> Response * response = new Response ; <nl> get_response ( response , query - > token ( ) ) ; <nl> + <nl> if ( response - > token ( ) ! = query - > token ( ) ) { <nl> fprintf ( stderr , " Insert response token % ld did not match query token % ld . \ n " , response - > token ( ) , query - > token ( ) ) ; <nl> throw protocol_error_t ( " Insert response token mismatch . " ) ; <nl> } <nl> + <nl> if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> fprintf ( stderr , " Failed to insert key % s , value % s : % s \ n " , key , value , response - > error_message ( ) . c_str ( ) ) ; <nl> throw protocol_error_t ( " Failed to successfully insert . " ) ; <nl> struct rethinkdb_protocol_t : protocol_t { <nl> virtual void read ( payload_t * keys , int count , payload_t * values = NULL ) { <nl> assert ( ! exist_outstanding_pipeline_reads ( ) ) ; <nl> <nl> - for ( int i = 0 ; i < count ; i + + ) { <nl> - / / generate query <nl> - Query * query = new Query ; <nl> - generate_read_query ( query , keys [ i ] . first , keys [ i ] . second ) ; <nl> + Query * query = new Query ; <nl> + generate_batched_read_query ( query , keys , count ) ; <nl> <nl> - send_query ( query ) ; <nl> + send_query ( query ) ; <nl> <nl> - / / get response <nl> - Response * response = new Response ; <nl> - get_response ( response , query - > token ( ) ) ; <nl> - if ( response - > token ( ) ! = query - > token ( ) ) { <nl> - fprintf ( stderr , " Read response token % ld did not match query token % ld . \ n " , response - > token ( ) , query - > token ( ) ) ; <nl> - throw protocol_error_t ( " Read response token mismatch . " ) ; <nl> - } <nl> - if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> - fprintf ( stderr , " Failed to read key % s : % s \ n " , keys [ i ] . first , response - > error_message ( ) . c_str ( ) ) ; <nl> - throw protocol_error_t ( " Failed to successfully read . " ) ; <nl> - } <nl> - if ( values ) { <nl> - std : : string result = get_value ( response - > response ( 0 ) ) ; <nl> + Response * response = new Response ; <nl> + get_response ( response , query - > token ( ) ) ; <nl> + <nl> + if ( response - > token ( ) ! = query - > token ( ) ) { <nl> + fprintf ( stderr , " Read response token % ld did not match query token % ld . \ n " , response - > token ( ) , query - > token ( ) ) ; <nl> + throw protocol_error_t ( " Read response token mismatch . " ) ; <nl> + } <nl> + <nl> + if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> + fprintf ( stderr , " Failed to read a batch of % d keys : % s \ n " , count , response - > error_message ( ) . c_str ( ) ) ; <nl> + throw protocol_error_t ( " Failed to successfully read . " ) ; <nl> + } <nl> + <nl> + if ( values ) { <nl> + int last = response - > response ( 0 ) . find_last_of ( " } " ) ; <nl> + for ( int i = count - 1 ; i > = 0 ; i - - ) { <nl> + assert ( last > = 0 & & last < response - > response ( 0 ) . length ( ) ) ; <nl> + std : : string result = get_value ( response - > response ( 0 ) , last ) ; <nl> if ( std : : string ( values [ i ] . first , values [ i ] . second ) ! = result ) { <nl> fprintf ( stderr , " Read failed : wanted % s but got % s for key % s . \ n " , values [ i ] . first , result . c_str ( ) , keys [ i ] . first ) ; <nl> } <nl> + last = response - > response ( 0 ) . find_last_of ( " } " , last - 1 ) ; <nl> } <nl> } <nl> } <nl> <nl> virtual void enqueue_read ( payload_t * keys , int count , payload_t * values = NULL ) { <nl> - for ( int i = 0 ; i < count ; i + + ) { <nl> - / / generate query <nl> - Query * query = new Query ; <nl> - generate_read_query ( query , keys [ i ] . first , keys [ i ] . second ) ; <nl> + assert ( ! exist_outstanding_pipeline_reads ( ) ) ; <nl> <nl> - send_query ( query ) ; <nl> + Query * query = new Query ; <nl> + generate_batched_read_query ( query , keys , count ) ; <nl> <nl> - read_tokens . push ( query - > token ( ) ) ; <nl> - } <nl> + send_query ( query ) ; <nl> + <nl> + queued_read = query - > token ( ) ; <nl> } <nl> <nl> / / returns whether all the reads were completed <nl> virtual bool dequeue_read_maybe ( payload_t * keys , int count , payload_t * values = NULL ) { <nl> bool done = true ; <nl> - for ( int i = 0 ; i < count ; i + + ) { <nl> - if ( read_tokens . front ( ) = = - 1 ) { <nl> - read_tokens . push ( - 1 ) ; <nl> - read_tokens . pop ( ) ; <nl> - } <nl> <nl> - / / get response <nl> - Response * response = new Response ; <nl> - bool received = get_response_maybe ( response , read_tokens . front ( ) ) ; <nl> - if ( ! received ) { <nl> - done = false ; <nl> - read_tokens . push ( read_tokens . front ( ) ) ; <nl> - read_tokens . pop ( ) ; <nl> - continue ; <nl> + Response * response = new Response ; <nl> + bool received = get_response_maybe ( response , queued_read ) ; <nl> + if ( ! received ) { <nl> + done = false ; <nl> + } else { <nl> + if ( response - > token ( ) ! = queued_read ) { <nl> + fprintf ( stderr , " Read response token % ld did not match query token % ld . \ n " , response - > token ( ) , queued_read ) ; <nl> + throw protocol_error_t ( " Read response token mismatch . " ) ; <nl> } <nl> <nl> if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> - fprintf ( stderr , " Failed to read key % s : % s \ n " , keys [ i ] . first , response - > error_message ( ) . c_str ( ) ) ; <nl> + fprintf ( stderr , " Failed to read a batch of % d keys : % s \ n " , count , response - > error_message ( ) . c_str ( ) ) ; <nl> throw protocol_error_t ( " Failed to successfully read . " ) ; <nl> } <nl> + <nl> if ( values ) { <nl> - std : : string result = get_value ( response - > response ( 0 ) ) ; <nl> - if ( std : : string ( values [ i ] . first , values [ i ] . second ) ! = result ) { <nl> - fprintf ( stderr , " Read failed : wanted % s but got % s for key % s . \ n " , values [ i ] . first , result . c_str ( ) , keys [ i ] . first ) ; <nl> + int last = response - > response ( 0 ) . find_last_of ( " } " ) ; <nl> + for ( int i = count - 1 ; i > = 0 ; i - - ) { <nl> + assert ( last > = 0 & & last < response - > response ( 0 ) . length ( ) ) ; <nl> + std : : string result = get_value ( response - > response ( 0 ) , last ) ; <nl> + if ( std : : string ( values [ i ] . first , values [ i ] . second ) ! = result ) { <nl> + fprintf ( stderr , " Read failed : wanted % s but got % s for key % s . \ n " , values [ i ] . first , result . c_str ( ) , keys [ i ] . first ) ; <nl> + } <nl> + last = response - > response ( 0 ) . find_last_of ( " } " , last ) ; <nl> } <nl> } <nl> - <nl> - read_tokens . push ( - 1 ) ; / / signifies a completed read <nl> - read_tokens . pop ( ) ; <nl> - } <nl> - <nl> - / / empty the read queue if done <nl> - if ( done ) { <nl> - while ( read_tokens . size ( ) ) { <nl> - read_tokens . pop ( ) ; <nl> - } <nl> + queued_read = - 1 ; <nl> } <nl> <nl> return done ; <nl> } <nl> <nl> virtual void dequeue_read ( payload_t * keys , int count , payload_t * values = NULL ) { <nl> - for ( int i = 0 ; i < count ; i + + ) { <nl> - if ( read_tokens . front ( ) = = - 1 ) { <nl> - continue ; <nl> - } <nl> + Response * response = new Response ; <nl> + get_response ( response , queued_read ) ; <nl> <nl> - / / get response <nl> - Response * response = new Response ; <nl> - get_response ( response , read_tokens . front ( ) ) ; <nl> - if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> - fprintf ( stderr , " Failed to read key % s : % s \ n " , keys [ i ] . first , response - > error_message ( ) . c_str ( ) ) ; <nl> - throw protocol_error_t ( " Failed to successfully read . " ) ; <nl> - } <nl> - if ( values ) { <nl> - std : : string result = get_value ( response - > response ( 0 ) ) ; <nl> + if ( response - > token ( ) ! = queued_read ) { <nl> + fprintf ( stderr , " Read response token % ld did not match query token % ld . \ n " , response - > token ( ) , queued_read ) ; <nl> + throw protocol_error_t ( " Read response token mismatch . " ) ; <nl> + } <nl> + <nl> + if ( response - > status_code ( ) ! = Response : : SUCCESS_JSON ) { <nl> + fprintf ( stderr , " Failed to read a batch of % d keys : % s \ n " , count , response - > error_message ( ) . c_str ( ) ) ; <nl> + throw protocol_error_t ( " Failed to successfully read . " ) ; <nl> + } <nl> + <nl> + if ( values ) { <nl> + int last = response - > response ( 0 ) . find_last_of ( " } " ) ; <nl> + for ( int i = count - 1 ; i > = 0 ; i - - ) { <nl> + assert ( last > = 0 & & last < response - > response ( 0 ) . length ( ) ) ; <nl> + std : : string result = get_value ( response - > response ( 0 ) , last ) ; <nl> if ( std : : string ( values [ i ] . first , values [ i ] . second ) ! = result ) { <nl> fprintf ( stderr , " Read failed : wanted % s but got % s for key % s . \ n " , values [ i ] . first , result . c_str ( ) , keys [ i ] . first ) ; <nl> } <nl> + last = response - > response ( 0 ) . find_last_of ( " } " , last ) ; <nl> } <nl> - <nl> - read_tokens . pop ( ) ; <nl> } <nl> + <nl> + queued_read = - 1 ; <nl> } <nl> <nl> virtual void range_read ( char * lkey , size_t lkey_size , char * rkey , size_t rkey_size , int count_limit , payload_t * values = NULL ) { <nl> struct rethinkdb_protocol_t : protocol_t { <nl> fprintf ( stderr , " Range read response token % ld did not match query token % ld . \ n " , response - > token ( ) , query - > token ( ) ) ; <nl> throw protocol_error_t ( " Range read response token mismatch . " ) ; <nl> } <nl> + <nl> if ( response - > status_code ( ) = = Response : : SUCCESS_PARTIAL ) { <nl> Query * stop_query = new Query ; <nl> generate_stop_query ( stop_query ) ; <nl> struct rethinkdb_protocol_t : protocol_t { <nl> <nl> Response * stop_response = new Response ; <nl> get_response ( stop_response , stop_query - > token ( ) ) ; <nl> + <nl> if ( stop_response - > token ( ) ! = stop_query - > token ( ) ) { <nl> fprintf ( stderr , " Stop response token % ld did not match query token % ld . \ n " , stop_response - > token ( ) , stop_query - > token ( ) ) ; <nl> throw protocol_error_t ( " Stop response token mismatch . " ) ; <nl> } <nl> + <nl> if ( stop_response - > status_code ( ) ! = Response : : SUCCESS_EMPTY ) { <nl> fprintf ( stderr , " Failed to stop partial stream . " ) ; <nl> throw protocol_error_t ( " Failed to successfully stop . " ) ; <nl> struct rethinkdb_protocol_t : protocol_t { <nl> TableRef * table_ref = insert - > mutable_table_ref ( ) ; <nl> table_ref - > set_table_name ( RDB_TABLE_NAME ) ; <nl> Term * term = insert - > add_terms ( ) ; <nl> - term - > set_type ( Term : : JSON ) ; <nl> - std : : string json_insert = std : : string ( " { \ " " ) + std : : string ( PRIMARY_KEY_NAME ) + std : : string ( " \ " : \ " " ) + std : : string ( key , key_size ) + std : : string ( " \ " , \ " val \ " : \ " " ) + std : : string ( value , value_size ) + std : : string ( " \ " } " ) ; <nl> - term - > set_jsonstring ( json_insert ) ; <nl> + term - > set_type ( Term : : OBJECT ) ; <nl> + VarTermTuple * object_key = term - > add_object ( ) ; <nl> + object_key - > set_var ( " id " ) ; <nl> + Term * key_term = object_key - > mutable_term ( ) ; <nl> + key_term - > set_type ( Term : : STRING ) ; <nl> + key_term - > set_valuestring ( std : : string ( key , key_size ) ) ; <nl> + VarTermTuple * object_value = term - > add_object ( ) ; <nl> + object_value - > set_var ( " val " ) ; <nl> + Term * object_term = object_value - > mutable_term ( ) ; <nl> + object_term - > set_type ( Term : : STRING ) ; <nl> + object_term - > set_valuestring ( std : : string ( value , value_size ) ) ; <nl> + } <nl> + <nl> + void generate_batched_read_query ( Query * query , payload_t * keys , int count ) { <nl> + query - > set_type ( Query : : READ ) ; <nl> + ReadQuery * read_query = query - > mutable_read_query ( ) ; <nl> + Term * term = read_query - > mutable_term ( ) ; <nl> + term - > set_type ( Term : : ARRAY ) ; <nl> + for ( int i = 0 ; i < count ; i + + ) { <nl> + Term * array_term = term - > add_array ( ) ; <nl> + array_term - > set_type ( Term : : GETBYKEY ) ; <nl> + Term : : GetByKey * get_by_key = array_term - > mutable_get_by_key ( ) ; <nl> + TableRef * table_ref = get_by_key - > mutable_table_ref ( ) ; <nl> + table_ref - > set_table_name ( RDB_TABLE_NAME ) ; <nl> + get_by_key - > set_attrname ( PRIMARY_KEY_NAME ) ; <nl> + Term * term_key = get_by_key - > mutable_key ( ) ; <nl> + term_key - > set_type ( Term : : STRING ) ; <nl> + term_key - > set_valuestring ( std : : string ( keys [ i ] . first , keys [ i ] . second ) ) ; <nl> + } <nl> } <nl> <nl> void generate_read_query ( Query * query , const char * key , size_t key_size ) { <nl> struct rethinkdb_protocol_t : protocol_t { <nl> } <nl> <nl> bool exist_outstanding_pipeline_reads ( ) { <nl> - return read_tokens . size ( ) ! = 0 ; <nl> + return queued_read > = 0 ; <nl> } <nl> <nl> / / takes a JSON string and returns the string in the last set of quotes <nl> / / useful for retrieving the last value , and probably faster than using a JSON parser <nl> - std : : string get_value ( const std : : string & json_string ) { <nl> - if ( json_string = = " null " ) { <nl> + std : : string get_value ( const std : : string & json_string , int last = - 1 ) { <nl> + if ( json_string = = " null " | | json_string = = " [ null ] " ) { <nl> return json_string ; <nl> } <nl> - int last_quote = ( int ) json_string . find_last_of ( ' " ' ) ; <nl> + if ( last < 0 ) { <nl> + last = json_string . length ( ) - 1 ; <nl> + } <nl> + int last_quote = ( int ) json_string . find_last_of ( ' " ' , last ) ; <nl> int second_to_last_quote = ( int ) json_string . find_last_of ( ' " ' , last_quote - 1 ) ; <nl> assert ( last_quote > = 0 & & last_quote < json_string . length ( ) ) ; <nl> assert ( second_to_last_quote > = 0 & & second_to_last_quote < json_string . length ( ) ) ; <nl> struct rethinkdb_protocol_t : protocol_t { <nl> private : <nl> int64_t token_index ; <nl> int sockfd ; <nl> + int64_t queued_read ; / / used for enqueue / dequeue read ( stores a token number ) <nl> fd_set readfds ; <nl> char buffer [ MAX_PROTOBUF_SIZE ] ; <nl> - queue < int64_t > read_tokens ; / / used for keeping track of enqueued reads <nl> map < int64_t , Response > response_bucket ; / / maps the token number to the corresponding response <nl> } ; <nl> <nl>
Implemented batched reading , fixed get_value , and other stuff . Also modified the verifies so that they are sending batched reads . Insert now inserts an object instead of a jsonstring .
rethinkdb/rethinkdb
754c4a95bd36753a3e7a584685183c1bd46fa7f3
2012-08-08T02:16:20Z
mmm a / src / node / ext / credentials . h <nl> ppp b / src / node / ext / credentials . h <nl> class Credentials : public : : node : : ObjectWrap { <nl> static NAN_METHOD ( CreateFake ) ; <nl> static NAN_METHOD ( CreateIam ) ; <nl> static NAN_METHOD ( CreateInsecure ) ; <nl> + static NAN_METHOD ( CreateFromPlugin ) ; <nl> static NanCallback * constructor ; <nl> / / Used for typechecking instances of this javascript class <nl> static v8 : : Persistent < v8 : : FunctionTemplate > fun_tpl ; <nl> class Credentials : public : : node : : ObjectWrap { <nl> grpc_credentials * wrapped_credentials ; <nl> } ; <nl> <nl> + / * Auth metadata plugin functionality * / <nl> + <nl> + typedef struct plugin_state { <nl> + Nan : : Callback * callback ; <nl> + } plugin_state ; <nl> + <nl> + void plugin_get_metadata ( void * state , const char * service_url , <nl> + grpc_credentials_plugin_metadata_cb cb , void * user_data ) ; <nl> + <nl> + void plugin_destroy_state ( void * state ) ; <nl> + <nl> + static NAN_METHOD ( PluginCallback ) ; <nl> + <nl> } / / namespace node <nl> } / / namespace grpc <nl> <nl>
Added function signatures for plugin wrapping
grpc/grpc
ada3f61f4d4a90061cee746cae1cd8eadef3b013
2015-09-23T17:47:35Z
mmm a / db / c . cc <nl> ppp b / db / c . cc <nl> struct rocksdb_mergeoperator_t : public MergeOperator { <nl> <nl> virtual const char * Name ( ) const override { return ( * name_ ) ( state_ ) ; } <nl> <nl> - virtual bool FullMerge ( const Slice & key , const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , <nl> - Logger * logger ) const override { <nl> - size_t n = operand_list . size ( ) ; <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> + size_t n = merge_in . operand_list . size ( ) ; <nl> std : : vector < const char * > operand_pointers ( n ) ; <nl> std : : vector < size_t > operand_sizes ( n ) ; <nl> for ( size_t i = 0 ; i < n ; i + + ) { <nl> - Slice operand ( operand_list [ i ] ) ; <nl> + Slice operand ( merge_in . operand_list [ i ] ) ; <nl> operand_pointers [ i ] = operand . data ( ) ; <nl> operand_sizes [ i ] = operand . size ( ) ; <nl> } <nl> <nl> const char * existing_value_data = nullptr ; <nl> size_t existing_value_len = 0 ; <nl> - if ( existing_value ! = nullptr ) { <nl> - existing_value_data = existing_value - > data ( ) ; <nl> - existing_value_len = existing_value - > size ( ) ; <nl> + if ( merge_in . existing_value ! = nullptr ) { <nl> + existing_value_data = merge_in . existing_value - > data ( ) ; <nl> + existing_value_len = merge_in . existing_value - > size ( ) ; <nl> } <nl> <nl> unsigned char success ; <nl> size_t new_value_len ; <nl> char * tmp_new_value = ( * full_merge_ ) ( <nl> - state_ , key . data ( ) , key . size ( ) , existing_value_data , existing_value_len , <nl> - & operand_pointers [ 0 ] , & operand_sizes [ 0 ] , static_cast < int > ( n ) , & success , <nl> - & new_value_len ) ; <nl> - new_value - > assign ( tmp_new_value , new_value_len ) ; <nl> + state_ , merge_in . key . data ( ) , merge_in . key . size ( ) , existing_value_data , <nl> + existing_value_len , & operand_pointers [ 0 ] , & operand_sizes [ 0 ] , <nl> + static_cast < int > ( n ) , & success , & new_value_len ) ; <nl> + merge_out - > new_value . assign ( tmp_new_value , new_value_len ) ; <nl> <nl> if ( delete_value_ ! = nullptr ) { <nl> ( * delete_value_ ) ( state_ , tmp_new_value , new_value_len ) ; <nl> mmm a / db / compaction_iterator . cc <nl> ppp b / db / compaction_iterator . cc <nl> CompactionIterator : : CompactionIterator ( <nl> } else { <nl> ignore_snapshots_ = false ; <nl> } <nl> + input_ - > SetPinnedItersMgr ( & pinned_iters_mgr_ ) ; <nl> + } <nl> + <nl> + CompactionIterator : : ~ CompactionIterator ( ) { <nl> + / / input_ Iteartor lifetime is longer than pinned_iters_mgr_ lifetime <nl> + input_ - > SetPinnedItersMgr ( nullptr ) ; <nl> } <nl> <nl> void CompactionIterator : : ResetRecordCounts ( ) { <nl> void CompactionIterator : : Next ( ) { <nl> ikey_ . user_key = current_key_ . GetUserKey ( ) ; <nl> valid_ = true ; <nl> } else { <nl> + / / We consumed all pinned merge operands , release pinned iterators <nl> + pinned_iters_mgr_ . ReleasePinnedIterators ( ) ; <nl> / / MergeHelper moves the iterator to the first record after the merged <nl> / / records , so even though we reached the end of the merge output , we do <nl> / / not want to advance the iterator . <nl> void CompactionIterator : : NextFromInput ( ) { <nl> return ; <nl> } <nl> <nl> + pinned_iters_mgr_ . StartPinning ( ) ; <nl> / / We know the merge type entry is not hidden , otherwise we would <nl> / / have hit ( A ) <nl> / / We encapsulate the merge related state machine in a different <nl> void CompactionIterator : : NextFromInput ( ) { <nl> / / batch consumed by the merge operator should not shadow any keys <nl> / / coming after the merges <nl> has_current_user_key_ = false ; <nl> + pinned_iters_mgr_ . ReleasePinnedIterators ( ) ; <nl> } <nl> } else { <nl> valid_ = true ; <nl> mmm a / db / compaction_iterator . h <nl> ppp b / db / compaction_iterator . h <nl> <nl> <nl> # include " db / compaction . h " <nl> # include " db / merge_helper . h " <nl> + # include " db / pinned_iterators_manager . h " <nl> # include " rocksdb / compaction_filter . h " <nl> # include " util / log_buffer . h " <nl> <nl> class CompactionIterator { <nl> const CompactionFilter * compaction_filter = nullptr , <nl> LogBuffer * log_buffer = nullptr ) ; <nl> <nl> + ~ CompactionIterator ( ) ; <nl> + <nl> void ResetRecordCounts ( ) ; <nl> <nl> / / Seek to the beginning of the compaction iterator output . <nl> class CompactionIterator { <nl> bool clear_and_output_next_key_ = false ; <nl> <nl> MergeOutputIterator merge_out_iter_ ; <nl> + / / PinnedIteratorsManager used to pin input_ Iterator blocks while reading <nl> + / / merge operands and then releasing them after consuming them . <nl> + PinnedIteratorsManager pinned_iters_mgr_ ; <nl> std : : string compaction_filter_value_ ; <nl> / / " level_ptrs " holds indices that remember which file of an associated <nl> / / level we were last checking during the last call to compaction - > <nl> mmm a / db / db_iter . cc <nl> ppp b / db / db_iter . cc <nl> class DBIter : public Iterator { <nl> virtual Slice value ( ) const override { <nl> assert ( valid_ ) ; <nl> if ( current_entry_is_merged_ ) { <nl> - return saved_value_ ; <nl> + / / If pinned_value_ is set then the result of merge operator is one of <nl> + / / the merge operands and we should return it . <nl> + return pinned_value_ . data ( ) ? pinned_value_ : saved_value_ ; <nl> } else if ( direction_ = = kReverse ) { <nl> return pinned_value_ ; <nl> } else { <nl> inline bool DBIter : : ParseKey ( ParsedInternalKey * ikey ) { <nl> void DBIter : : Next ( ) { <nl> assert ( valid_ ) ; <nl> <nl> + / / Release temporarily pinned blocks from last operation <nl> + ReleaseTempPinnedData ( ) ; <nl> if ( direction_ = = kReverse ) { <nl> - / / We only pin blocks when doing kReverse <nl> - ReleaseTempPinnedData ( ) ; <nl> FindNextUserKey ( ) ; <nl> direction_ = kForward ; <nl> if ( ! iter_ - > Valid ( ) ) { <nl> void DBIter : : MergeValuesNewToOld ( ) { <nl> return ; <nl> } <nl> <nl> + / / Temporarily pin the blocks that hold merge operands <nl> + TempPinData ( ) ; <nl> merge_context_ . Clear ( ) ; <nl> / / Start the merge process by pushing the first operand <nl> - merge_context_ . PushOperand ( iter_ - > value ( ) ) ; <nl> + merge_context_ . PushOperand ( iter_ - > value ( ) , <nl> + iter_ - > IsValuePinned ( ) / * operand_pinned * / ) ; <nl> <nl> ParsedInternalKey ikey ; <nl> for ( iter_ - > Next ( ) ; iter_ - > Valid ( ) ; iter_ - > Next ( ) ) { <nl> void DBIter : : MergeValuesNewToOld ( ) { <nl> const Slice val = iter_ - > value ( ) ; <nl> MergeHelper : : TimedFullMerge ( merge_operator_ , ikey . user_key , & val , <nl> merge_context_ . GetOperands ( ) , & saved_value_ , <nl> - logger_ , statistics_ , env_ ) ; <nl> + logger_ , statistics_ , env_ , & pinned_value_ ) ; <nl> / / iter_ is positioned after put <nl> iter_ - > Next ( ) ; <nl> return ; <nl> } else if ( kTypeMerge = = ikey . type ) { <nl> / / hit a merge , add the value as an operand and run associative merge . <nl> / / when complete , add result to operands and continue . <nl> - const Slice & val = iter_ - > value ( ) ; <nl> - merge_context_ . PushOperand ( val ) ; <nl> + merge_context_ . PushOperand ( iter_ - > value ( ) , <nl> + iter_ - > IsValuePinned ( ) / * operand_pinned * / ) ; <nl> } else { <nl> assert ( false ) ; <nl> } <nl> void DBIter : : MergeValuesNewToOld ( ) { <nl> / / client can differentiate this scenario and do things accordingly . <nl> MergeHelper : : TimedFullMerge ( merge_operator_ , saved_key_ . GetKey ( ) , nullptr , <nl> merge_context_ . GetOperands ( ) , & saved_value_ , <nl> - logger_ , statistics_ , env_ ) ; <nl> + logger_ , statistics_ , env_ , & pinned_value_ ) ; <nl> } <nl> <nl> void DBIter : : Prev ( ) { <nl> assert ( valid_ ) ; <nl> + ReleaseTempPinnedData ( ) ; <nl> if ( direction_ = = kForward ) { <nl> ReverseToBackward ( ) ; <nl> } <nl> - ReleaseTempPinnedData ( ) ; <nl> PrevInternal ( ) ; <nl> if ( statistics_ ! = nullptr ) { <nl> local_stats_ . prev_count_ + + ; <nl> bool DBIter : : FindValueForCurrentKey ( ) { <nl> ParsedInternalKey ikey ; <nl> FindParseableKey ( & ikey , kReverse ) ; <nl> <nl> + / / Temporarily pin blocks that hold ( merge operands / the value ) <nl> + ReleaseTempPinnedData ( ) ; <nl> + TempPinData ( ) ; <nl> size_t num_skipped = 0 ; <nl> while ( iter_ - > Valid ( ) & & ikey . sequence < = sequence_ & & <nl> user_comparator_ - > Equal ( ikey . user_key , saved_key_ . GetKey ( ) ) ) { <nl> bool DBIter : : FindValueForCurrentKey ( ) { <nl> switch ( last_key_entry_type ) { <nl> case kTypeValue : <nl> merge_context_ . Clear ( ) ; <nl> - ReleaseTempPinnedData ( ) ; <nl> - TempPinData ( ) ; <nl> + assert ( iter_ - > IsValuePinned ( ) ) ; <nl> pinned_value_ = iter_ - > value ( ) ; <nl> last_not_merge_type = kTypeValue ; <nl> break ; <nl> bool DBIter : : FindValueForCurrentKey ( ) { <nl> break ; <nl> case kTypeMerge : <nl> assert ( merge_operator_ ! = nullptr ) ; <nl> - merge_context_ . PushOperandBack ( iter_ - > value ( ) ) ; <nl> + merge_context_ . PushOperandBack ( <nl> + iter_ - > value ( ) , iter_ - > IsValuePinned ( ) / * operand_pinned * / ) ; <nl> break ; <nl> default : <nl> assert ( false ) ; <nl> bool DBIter : : FindValueForCurrentKey ( ) { <nl> if ( last_not_merge_type = = kTypeDeletion ) { <nl> MergeHelper : : TimedFullMerge ( merge_operator_ , saved_key_ . GetKey ( ) , <nl> nullptr , merge_context_ . GetOperands ( ) , <nl> - & saved_value_ , logger_ , statistics_ , env_ ) ; <nl> + & saved_value_ , logger_ , statistics_ , env_ , <nl> + & pinned_value_ ) ; <nl> } else { <nl> assert ( last_not_merge_type = = kTypeValue ) ; <nl> MergeHelper : : TimedFullMerge ( merge_operator_ , saved_key_ . GetKey ( ) , <nl> & pinned_value_ , <nl> merge_context_ . GetOperands ( ) , & saved_value_ , <nl> - logger_ , statistics_ , env_ ) ; <nl> + logger_ , statistics_ , env_ , & pinned_value_ ) ; <nl> } <nl> break ; <nl> case kTypeValue : <nl> bool DBIter : : FindValueForCurrentKey ( ) { <nl> / / This function is used in FindValueForCurrentKey . <nl> / / We use Seek ( ) function instead of Prev ( ) to find necessary value <nl> bool DBIter : : FindValueForCurrentKeyUsingSeek ( ) { <nl> + / / FindValueForCurrentKey will enable pinning before calling <nl> + / / FindValueForCurrentKeyUsingSeek ( ) <nl> + assert ( pinned_iters_mgr_ . PinningEnabled ( ) ) ; <nl> std : : string last_key ; <nl> AppendInternalKey ( & last_key , ParsedInternalKey ( saved_key_ . GetKey ( ) , sequence_ , <nl> kValueTypeForSeek ) ) ; <nl> bool DBIter : : FindValueForCurrentKeyUsingSeek ( ) { <nl> if ( ikey . type = = kTypeValue | | ikey . type = = kTypeDeletion | | <nl> ikey . type = = kTypeSingleDeletion ) { <nl> if ( ikey . type = = kTypeValue ) { <nl> - ReleaseTempPinnedData ( ) ; <nl> - TempPinData ( ) ; <nl> + assert ( iter_ - > IsValuePinned ( ) ) ; <nl> pinned_value_ = iter_ - > value ( ) ; <nl> valid_ = true ; <nl> return true ; <nl> bool DBIter : : FindValueForCurrentKeyUsingSeek ( ) { <nl> while ( iter_ - > Valid ( ) & & <nl> user_comparator_ - > Equal ( ikey . user_key , saved_key_ . GetKey ( ) ) & & <nl> ikey . type = = kTypeMerge ) { <nl> - merge_context_ . PushOperand ( iter_ - > value ( ) ) ; <nl> + merge_context_ . PushOperand ( iter_ - > value ( ) , <nl> + iter_ - > IsValuePinned ( ) / * operand_pinned * / ) ; <nl> iter_ - > Next ( ) ; <nl> FindParseableKey ( & ikey , kForward ) ; <nl> } <nl> bool DBIter : : FindValueForCurrentKeyUsingSeek ( ) { <nl> ikey . type = = kTypeDeletion | | ikey . type = = kTypeSingleDeletion ) { <nl> MergeHelper : : TimedFullMerge ( merge_operator_ , saved_key_ . GetKey ( ) , nullptr , <nl> merge_context_ . GetOperands ( ) , & saved_value_ , <nl> - logger_ , statistics_ , env_ ) ; <nl> + logger_ , statistics_ , env_ , & pinned_value_ ) ; <nl> / / Make iter_ valid and point to saved_key_ <nl> if ( ! iter_ - > Valid ( ) | | <nl> ! user_comparator_ - > Equal ( ikey . user_key , saved_key_ . GetKey ( ) ) ) { <nl> bool DBIter : : FindValueForCurrentKeyUsingSeek ( ) { <nl> const Slice & val = iter_ - > value ( ) ; <nl> MergeHelper : : TimedFullMerge ( merge_operator_ , saved_key_ . GetKey ( ) , & val , <nl> merge_context_ . GetOperands ( ) , & saved_value_ , <nl> - logger_ , statistics_ , env_ ) ; <nl> + logger_ , statistics_ , env_ , & pinned_value_ ) ; <nl> valid_ = true ; <nl> return true ; <nl> } <nl> mmm a / db / db_iter_test . cc <nl> ppp b / db / db_iter_test . cc <nl> class TestIterator : public InternalIterator { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> + virtual bool IsKeyPinned ( ) const override { return true ; } <nl> + virtual bool IsValuePinned ( ) const override { return true ; } <nl> + <nl> private : <nl> bool initialized_ ; <nl> bool valid_ ; <nl> mmm a / db / db_test . cc <nl> ppp b / db / db_test . cc <nl> class DelayedMergeOperator : public MergeOperator { <nl> <nl> public : <nl> explicit DelayedMergeOperator ( DBTest * d ) : db_test_ ( d ) { } <nl> - virtual bool FullMerge ( const Slice & key , const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , <nl> - Logger * logger ) const override { <nl> + <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> db_test_ - > env_ - > addon_time_ . fetch_add ( 1000 ) ; <nl> - * new_value = " " ; <nl> + merge_out - > new_value = " " ; <nl> return true ; <nl> } <nl> <nl> mmm a / db / db_test2 . cc <nl> ppp b / db / db_test2 . cc <nl> TEST_F ( DBTest2 , SyncPointMarker ) { <nl> rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ; <nl> } <nl> # endif <nl> + <nl> + class MergeOperatorPinningTest : public DBTest2 , <nl> + public testing : : WithParamInterface < bool > { <nl> + public : <nl> + MergeOperatorPinningTest ( ) { disable_block_cache_ = GetParam ( ) ; } <nl> + <nl> + bool disable_block_cache_ ; <nl> + } ; <nl> + <nl> + INSTANTIATE_TEST_CASE_P ( MergeOperatorPinningTest , MergeOperatorPinningTest , <nl> + : : testing : : Bool ( ) ) ; <nl> + <nl> + # ifndef ROCKSDB_LITE <nl> + TEST_P ( MergeOperatorPinningTest , OperandsMultiBlocks ) { <nl> + Options options = CurrentOptions ( ) ; <nl> + BlockBasedTableOptions table_options ; <nl> + table_options . block_size = 1 ; / / every block will contain one entry <nl> + table_options . no_block_cache = disable_block_cache_ ; <nl> + options . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ; <nl> + options . merge_operator = MergeOperators : : CreateStringAppendTESTOperator ( ) ; <nl> + options . level0_slowdown_writes_trigger = ( 1 < < 30 ) ; <nl> + options . level0_stop_writes_trigger = ( 1 < < 30 ) ; <nl> + options . disable_auto_compactions = true ; <nl> + DestroyAndReopen ( options ) ; <nl> + <nl> + const int kKeysPerFile = 10 ; <nl> + const int kOperandsPerKeyPerFile = 7 ; <nl> + const int kOperandSize = 100 ; <nl> + / / Filse to write in L0 before compacting to lower level <nl> + const int kFilesPerLevel = 3 ; <nl> + <nl> + Random rnd ( 301 ) ; <nl> + std : : map < std : : string , std : : string > true_data ; <nl> + int batch_num = 1 ; <nl> + int lvl_to_fill = 4 ; <nl> + int key_id = 0 ; <nl> + while ( true ) { <nl> + for ( int j = 0 ; j < kKeysPerFile ; j + + ) { <nl> + std : : string key = Key ( key_id % 35 ) ; <nl> + key_id + + ; <nl> + for ( int k = 0 ; k < kOperandsPerKeyPerFile ; k + + ) { <nl> + std : : string val = RandomString ( & rnd , kOperandSize ) ; <nl> + ASSERT_OK ( db_ - > Merge ( WriteOptions ( ) , key , val ) ) ; <nl> + if ( true_data [ key ] . size ( ) = = 0 ) { <nl> + true_data [ key ] = val ; <nl> + } else { <nl> + true_data [ key ] + = " , " + val ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( lvl_to_fill = = - 1 ) { <nl> + / / Keep last batch in memtable and stop <nl> + break ; <nl> + } <nl> + <nl> + ASSERT_OK ( Flush ( ) ) ; <nl> + if ( batch_num % kFilesPerLevel = = 0 ) { <nl> + if ( lvl_to_fill ! = 0 ) { <nl> + MoveFilesToLevel ( lvl_to_fill ) ; <nl> + } <nl> + lvl_to_fill - - ; <nl> + } <nl> + batch_num + + ; <nl> + } <nl> + <nl> + / / 3 L0 files <nl> + / / 1 L1 file <nl> + / / 3 L2 files <nl> + / / 1 L3 file <nl> + / / 3 L4 Files <nl> + ASSERT_EQ ( FilesPerLevel ( ) , " 3 , 1 , 3 , 1 , 3 " ) ; <nl> + <nl> + / / Verify Get ( ) <nl> + for ( auto kv : true_data ) { <nl> + ASSERT_EQ ( Get ( kv . first ) , kv . second ) ; <nl> + } <nl> + <nl> + Iterator * iter = db_ - > NewIterator ( ReadOptions ( ) ) ; <nl> + <nl> + / / Verify Iterator : : Next ( ) <nl> + auto data_iter = true_data . begin ( ) ; <nl> + for ( iter - > SeekToFirst ( ) ; iter - > Valid ( ) ; iter - > Next ( ) , data_iter + + ) { <nl> + ASSERT_EQ ( iter - > key ( ) . ToString ( ) , data_iter - > first ) ; <nl> + ASSERT_EQ ( iter - > value ( ) . ToString ( ) , data_iter - > second ) ; <nl> + } <nl> + ASSERT_EQ ( data_iter , true_data . end ( ) ) ; <nl> + <nl> + / / Verify Iterator : : Prev ( ) <nl> + auto data_rev = true_data . rbegin ( ) ; <nl> + for ( iter - > SeekToLast ( ) ; iter - > Valid ( ) ; iter - > Prev ( ) , data_rev + + ) { <nl> + ASSERT_EQ ( iter - > key ( ) . ToString ( ) , data_rev - > first ) ; <nl> + ASSERT_EQ ( iter - > value ( ) . ToString ( ) , data_rev - > second ) ; <nl> + } <nl> + ASSERT_EQ ( data_rev , true_data . rend ( ) ) ; <nl> + <nl> + / / Verify Iterator : : Seek ( ) <nl> + for ( auto kv : true_data ) { <nl> + iter - > Seek ( kv . first ) ; <nl> + ASSERT_EQ ( kv . first , iter - > key ( ) . ToString ( ) ) ; <nl> + ASSERT_EQ ( kv . second , iter - > value ( ) . ToString ( ) ) ; <nl> + } <nl> + <nl> + delete iter ; <nl> + } <nl> + <nl> + TEST_P ( MergeOperatorPinningTest , Randomized ) { <nl> + do { <nl> + Options options = CurrentOptions ( ) ; <nl> + options . merge_operator = MergeOperators : : CreateMaxOperator ( ) ; <nl> + BlockBasedTableOptions table_options ; <nl> + table_options . no_block_cache = disable_block_cache_ ; <nl> + options . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ; <nl> + DestroyAndReopen ( options ) ; <nl> + <nl> + Random rnd ( 301 ) ; <nl> + std : : map < std : : string , std : : string > true_data ; <nl> + <nl> + const int kTotalMerges = 10000 ; <nl> + / / Every key gets ~ 10 operands <nl> + const int kKeyRange = kTotalMerges / 10 ; <nl> + const int kOperandSize = 20 ; <nl> + const int kNumPutBefore = kKeyRange / 10 ; / / 10 % value <nl> + const int kNumPutAfter = kKeyRange / 10 ; / / 10 % overwrite <nl> + const int kNumDelete = kKeyRange / 10 ; / / 10 % delete <nl> + <nl> + / / kNumPutBefore keys will have base values <nl> + for ( int i = 0 ; i < kNumPutBefore ; i + + ) { <nl> + std : : string key = Key ( rnd . Next ( ) % kKeyRange ) ; <nl> + std : : string value = RandomString ( & rnd , kOperandSize ) ; <nl> + ASSERT_OK ( db_ - > Put ( WriteOptions ( ) , key , value ) ) ; <nl> + <nl> + true_data [ key ] = value ; <nl> + } <nl> + <nl> + / / Do kTotalMerges merges <nl> + for ( int i = 0 ; i < kTotalMerges ; i + + ) { <nl> + std : : string key = Key ( rnd . Next ( ) % kKeyRange ) ; <nl> + std : : string value = RandomString ( & rnd , kOperandSize ) ; <nl> + ASSERT_OK ( db_ - > Merge ( WriteOptions ( ) , key , value ) ) ; <nl> + <nl> + if ( true_data [ key ] < value ) { <nl> + true_data [ key ] = value ; <nl> + } <nl> + } <nl> + <nl> + / / Overwrite random kNumPutAfter keys <nl> + for ( int i = 0 ; i < kNumPutAfter ; i + + ) { <nl> + std : : string key = Key ( rnd . Next ( ) % kKeyRange ) ; <nl> + std : : string value = RandomString ( & rnd , kOperandSize ) ; <nl> + ASSERT_OK ( db_ - > Put ( WriteOptions ( ) , key , value ) ) ; <nl> + <nl> + true_data [ key ] = value ; <nl> + } <nl> + <nl> + / / Delete random kNumDelete keys <nl> + for ( int i = 0 ; i < kNumDelete ; i + + ) { <nl> + std : : string key = Key ( rnd . Next ( ) % kKeyRange ) ; <nl> + ASSERT_OK ( db_ - > Delete ( WriteOptions ( ) , key ) ) ; <nl> + <nl> + true_data . erase ( key ) ; <nl> + } <nl> + <nl> + VerifyDBFromMap ( true_data ) ; <nl> + <nl> + / / Skip HashCuckoo since it does not support merge operators <nl> + } while ( ChangeOptions ( kSkipMergePut | kSkipHashCuckoo ) ) ; <nl> + } <nl> + <nl> + class MergeOperatorHook : public MergeOperator { <nl> + public : <nl> + explicit MergeOperatorHook ( std : : shared_ptr < MergeOperator > _merge_op ) <nl> + : merge_op_ ( _merge_op ) { } <nl> + <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> + before_merge_ ( ) ; <nl> + bool res = merge_op_ - > FullMergeV2 ( merge_in , merge_out ) ; <nl> + after_merge_ ( ) ; <nl> + return res ; <nl> + } <nl> + <nl> + virtual const char * Name ( ) const override { return merge_op_ - > Name ( ) ; } <nl> + <nl> + std : : shared_ptr < MergeOperator > merge_op_ ; <nl> + std : : function < void ( ) > before_merge_ = [ ] ( ) { } ; <nl> + std : : function < void ( ) > after_merge_ = [ ] ( ) { } ; <nl> + } ; <nl> + <nl> + TEST_P ( MergeOperatorPinningTest , EvictCacheBeforeMerge ) { <nl> + Options options = CurrentOptions ( ) ; <nl> + <nl> + auto merge_hook = <nl> + std : : make_shared < MergeOperatorHook > ( MergeOperators : : CreateMaxOperator ( ) ) ; <nl> + options . merge_operator = merge_hook ; <nl> + options . disable_auto_compactions = true ; <nl> + options . level0_slowdown_writes_trigger = ( 1 < < 30 ) ; <nl> + options . level0_stop_writes_trigger = ( 1 < < 30 ) ; <nl> + options . max_open_files = 20 ; <nl> + BlockBasedTableOptions bbto ; <nl> + bbto . no_block_cache = disable_block_cache_ ; <nl> + if ( bbto . no_block_cache = = false ) { <nl> + bbto . block_cache = NewLRUCache ( 64 * 1024 * 1024 ) ; <nl> + } else { <nl> + bbto . block_cache = nullptr ; <nl> + } <nl> + options . table_factory . reset ( NewBlockBasedTableFactory ( bbto ) ) ; <nl> + DestroyAndReopen ( options ) ; <nl> + <nl> + const int kNumOperands = 30 ; <nl> + const int kNumKeys = 1000 ; <nl> + const int kOperandSize = 100 ; <nl> + Random rnd ( 301 ) ; <nl> + <nl> + / / 1000 keys every key have 30 operands , every operand is in a different file <nl> + std : : map < std : : string , std : : string > true_data ; <nl> + for ( int i = 0 ; i < kNumOperands ; i + + ) { <nl> + for ( int j = 0 ; j < kNumKeys ; j + + ) { <nl> + std : : string k = Key ( j ) ; <nl> + std : : string v = RandomString ( & rnd , kOperandSize ) ; <nl> + ASSERT_OK ( db_ - > Merge ( WriteOptions ( ) , k , v ) ) ; <nl> + <nl> + true_data [ k ] = std : : max ( true_data [ k ] , v ) ; <nl> + } <nl> + ASSERT_OK ( Flush ( ) ) ; <nl> + } <nl> + <nl> + std : : vector < uint64_t > file_numbers = ListTableFiles ( env_ , dbname_ ) ; <nl> + ASSERT_EQ ( file_numbers . size ( ) , kNumOperands ) ; <nl> + int merge_cnt = 0 ; <nl> + <nl> + / / Code executed before merge operation <nl> + merge_hook - > before_merge_ = [ & ] ( ) { <nl> + / / Evict all tables from cache before every merge operation <nl> + for ( uint64_t num : file_numbers ) { <nl> + TableCache : : Evict ( dbfull ( ) - > TEST_table_cache ( ) , num ) ; <nl> + } <nl> + / / Decrease cache capacity to force all unrefed blocks to be evicted <nl> + if ( bbto . block_cache ) { <nl> + bbto . block_cache - > SetCapacity ( 1 ) ; <nl> + } <nl> + merge_cnt + + ; <nl> + } ; <nl> + <nl> + / / Code executed after merge operation <nl> + merge_hook - > after_merge_ = [ & ] ( ) { <nl> + / / Increase capacity again after doing the merge <nl> + if ( bbto . block_cache ) { <nl> + bbto . block_cache - > SetCapacity ( 64 * 1024 * 1024 ) ; <nl> + } <nl> + } ; <nl> + <nl> + VerifyDBFromMap ( true_data ) ; <nl> + ASSERT_EQ ( merge_cnt , kNumKeys * 4 / * get + next + prev + seek * / ) ; <nl> + <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> + <nl> + VerifyDBFromMap ( true_data ) ; <nl> + } <nl> + # endif / / ROCKSDB_LITE <nl> + <nl> } / / namespace rocksdb <nl> <nl> int main ( int argc , char * * argv ) { <nl> mmm a / db / db_test_util . cc <nl> ppp b / db / db_test_util . cc <nl> std : : vector < std : : uint64_t > DBTestBase : : ListTableFiles ( Env * env , <nl> return file_numbers ; <nl> } <nl> <nl> + void DBTestBase : : VerifyDBFromMap ( std : : map < std : : string , std : : string > true_data ) { <nl> + for ( auto & kv : true_data ) { <nl> + ASSERT_EQ ( Get ( kv . first ) , kv . second ) ; <nl> + } <nl> + <nl> + ReadOptions ro ; <nl> + ro . total_order_seek = true ; <nl> + Iterator * iter = db_ - > NewIterator ( ro ) ; <nl> + / / Verify Iterator : : Next ( ) <nl> + auto data_iter = true_data . begin ( ) ; <nl> + for ( iter - > SeekToFirst ( ) ; iter - > Valid ( ) ; iter - > Next ( ) , data_iter + + ) { <nl> + ASSERT_EQ ( iter - > key ( ) . ToString ( ) , data_iter - > first ) ; <nl> + ASSERT_EQ ( iter - > value ( ) . ToString ( ) , data_iter - > second ) ; <nl> + } <nl> + ASSERT_EQ ( data_iter , true_data . end ( ) ) ; <nl> + <nl> + / / Verify Iterator : : Prev ( ) <nl> + auto data_rev = true_data . rbegin ( ) ; <nl> + for ( iter - > SeekToLast ( ) ; iter - > Valid ( ) ; iter - > Prev ( ) , data_rev + + ) { <nl> + ASSERT_EQ ( iter - > key ( ) . ToString ( ) , data_rev - > first ) ; <nl> + ASSERT_EQ ( iter - > value ( ) . ToString ( ) , data_rev - > second ) ; <nl> + } <nl> + ASSERT_EQ ( data_rev , true_data . rend ( ) ) ; <nl> + <nl> + / / Verify Iterator : : Seek ( ) <nl> + for ( auto kv : true_data ) { <nl> + iter - > Seek ( kv . first ) ; <nl> + ASSERT_EQ ( kv . first , iter - > key ( ) . ToString ( ) ) ; <nl> + ASSERT_EQ ( kv . second , iter - > value ( ) . ToString ( ) ) ; <nl> + } <nl> + <nl> + delete iter ; <nl> + } <nl> + <nl> # ifndef ROCKSDB_LITE <nl> <nl> Status DBTestBase : : GenerateAndAddExternalFile ( const Options options , <nl> mmm a / db / db_test_util . h <nl> ppp b / db / db_test_util . h <nl> class DBTestBase : public testing : : Test { <nl> <nl> std : : vector < std : : uint64_t > ListTableFiles ( Env * env , const std : : string & path ) ; <nl> <nl> + void VerifyDBFromMap ( std : : map < std : : string , std : : string > true_data ) ; <nl> + <nl> # ifndef ROCKSDB_LITE <nl> Status GenerateAndAddExternalFile ( const Options options , <nl> std : : vector < int > keys , size_t file_id ) ; <nl> mmm a / db / memtable . cc <nl> ppp b / db / memtable . cc <nl> const char * EncodeKey ( std : : string * scratch , const Slice & target ) { <nl> <nl> class MemTableIterator : public InternalIterator { <nl> public : <nl> - MemTableIterator ( <nl> - const MemTable & mem , const ReadOptions & read_options , Arena * arena ) <nl> + MemTableIterator ( const MemTable & mem , const ReadOptions & read_options , <nl> + Arena * arena ) <nl> : bloom_ ( nullptr ) , <nl> prefix_extractor_ ( mem . prefix_extractor_ ) , <nl> valid_ ( false ) , <nl> - arena_mode_ ( arena ! = nullptr ) { <nl> + arena_mode_ ( arena ! = nullptr ) , <nl> + value_pinned_ ( ! mem . GetMemTableOptions ( ) - > inplace_update_support ) { <nl> if ( prefix_extractor_ ! = nullptr & & ! read_options . total_order_seek ) { <nl> bloom_ = mem . prefix_bloom_ . get ( ) ; <nl> iter_ = mem . table_ - > GetDynamicPrefixIterator ( arena ) ; <nl> class MemTableIterator : public InternalIterator { <nl> return true ; <nl> } <nl> <nl> + virtual bool IsValuePinned ( ) const override { <nl> + / / memtable value is always pinned , except if we allow inplace update . <nl> + return value_pinned_ ; <nl> + } <nl> + <nl> private : <nl> DynamicBloom * bloom_ ; <nl> const SliceTransform * const prefix_extractor_ ; <nl> MemTableRep : : Iterator * iter_ ; <nl> bool valid_ ; <nl> bool arena_mode_ ; <nl> + bool value_pinned_ ; <nl> <nl> / / No copying allowed <nl> MemTableIterator ( const MemTableIterator & ) ; <nl> static bool SaveValue ( void * arg , const char * entry ) { <nl> case kTypeDeletion : <nl> case kTypeSingleDeletion : { <nl> if ( * ( s - > merge_in_progress ) ) { <nl> - * ( s - > status ) = Status : : OK ( ) ; <nl> * ( s - > status ) = MergeHelper : : TimedFullMerge ( <nl> merge_operator , s - > key - > user_key ( ) , nullptr , <nl> merge_context - > GetOperands ( ) , s - > value , s - > logger , s - > statistics , <nl> static bool SaveValue ( void * arg , const char * entry ) { <nl> } <nl> Slice v = GetLengthPrefixedSlice ( key_ptr + key_length ) ; <nl> * ( s - > merge_in_progress ) = true ; <nl> - merge_context - > PushOperand ( v ) ; <nl> + merge_context - > PushOperand ( <nl> + v , s - > inplace_update_support = = false / * operand_pinned * / ) ; <nl> return true ; <nl> } <nl> default : <nl> mmm a / db / merge_context . h <nl> ppp b / db / merge_context . h <nl> <nl> / / of patent rights can be found in the PATENTS file in the same directory . <nl> / / <nl> # pragma once <nl> + # include < string > <nl> + # include < vector > <nl> # include " db / dbformat . h " <nl> # include " rocksdb / slice . h " <nl> - # include < string > <nl> - # include < deque > <nl> <nl> namespace rocksdb { <nl> <nl> - const std : : deque < std : : string > empty_operand_list ; <nl> + const std : : vector < Slice > empty_operand_list ; <nl> <nl> / / The merge context for merging a user key . <nl> / / When doing a Get ( ) , DB will create such a class and pass it when <nl> / / issuing Get ( ) operation to memtables and version_set . The operands <nl> / / will be fetched from the context when issuing partial of full merge . <nl> class MergeContext { <nl> - public : <nl> + public : <nl> / / Clear all the operands <nl> void Clear ( ) { <nl> - if ( operand_list ) { <nl> - operand_list - > clear ( ) ; <nl> + if ( operand_list_ ) { <nl> + operand_list_ - > clear ( ) ; <nl> + copied_operands_ - > clear ( ) ; <nl> } <nl> } <nl> - / / Replace all operands with merge_result , which are expected to be the <nl> - / / merge result of them . <nl> - void PushPartialMergeResult ( std : : string & merge_result ) { <nl> - assert ( operand_list ) ; <nl> - operand_list - > clear ( ) ; <nl> - operand_list - > push_front ( std : : move ( merge_result ) ) ; <nl> - } <nl> + <nl> / / Push a merge operand <nl> - void PushOperand ( const Slice & operand_slice ) { <nl> + void PushOperand ( const Slice & operand_slice , bool operand_pinned = false ) { <nl> Initialize ( ) ; <nl> - operand_list - > push_front ( operand_slice . ToString ( ) ) ; <nl> + SetDirectionBackward ( ) ; <nl> + <nl> + if ( operand_pinned ) { <nl> + operand_list_ - > push_back ( operand_slice ) ; <nl> + } else { <nl> + / / We need to have our own copy of the operand since it ' s not pinned <nl> + copied_operands_ - > emplace_back ( operand_slice . data ( ) , <nl> + operand_slice . size ( ) ) ; <nl> + operand_list_ - > push_back ( copied_operands_ - > back ( ) ) ; <nl> + } <nl> } <nl> + <nl> / / Push back a merge operand <nl> - void PushOperandBack ( const Slice & operand_slice ) { <nl> + void PushOperandBack ( const Slice & operand_slice , <nl> + bool operand_pinned = false ) { <nl> Initialize ( ) ; <nl> - operand_list - > push_back ( operand_slice . ToString ( ) ) ; <nl> + SetDirectionForward ( ) ; <nl> + <nl> + if ( operand_pinned ) { <nl> + operand_list_ - > push_back ( operand_slice ) ; <nl> + } else { <nl> + / / We need to have our own copy of the operand since it ' s not pinned <nl> + copied_operands_ - > emplace_back ( operand_slice . data ( ) , <nl> + operand_slice . size ( ) ) ; <nl> + operand_list_ - > push_back ( copied_operands_ - > back ( ) ) ; <nl> + } <nl> } <nl> + <nl> / / return total number of operands in the list <nl> size_t GetNumOperands ( ) const { <nl> - if ( ! operand_list ) { <nl> + if ( ! operand_list_ ) { <nl> return 0 ; <nl> } <nl> - return operand_list - > size ( ) ; <nl> + return operand_list_ - > size ( ) ; <nl> } <nl> + <nl> / / Get the operand at the index . <nl> - Slice GetOperand ( int index ) const { <nl> - assert ( operand_list ) ; <nl> - return ( * operand_list ) [ index ] ; <nl> + Slice GetOperand ( int index ) { <nl> + assert ( operand_list_ ) ; <nl> + <nl> + SetDirectionForward ( ) ; <nl> + return ( * operand_list_ ) [ index ] ; <nl> } <nl> + <nl> / / Return all the operands . <nl> - const std : : deque < std : : string > & GetOperands ( ) const { <nl> - if ( ! operand_list ) { <nl> + const std : : vector < Slice > & GetOperands ( ) { <nl> + if ( ! operand_list_ ) { <nl> return empty_operand_list ; <nl> } <nl> - return * operand_list ; <nl> + <nl> + SetDirectionForward ( ) ; <nl> + return * operand_list_ ; <nl> } <nl> - private : <nl> + <nl> + private : <nl> void Initialize ( ) { <nl> - if ( ! operand_list ) { <nl> - operand_list . reset ( new std : : deque < std : : string > ( ) ) ; <nl> + if ( ! operand_list_ ) { <nl> + operand_list_ . reset ( new std : : vector < Slice > ( ) ) ; <nl> + copied_operands_ . reset ( new std : : vector < std : : string > ( ) ) ; <nl> } <nl> } <nl> - std : : unique_ptr < std : : deque < std : : string > > operand_list ; <nl> + <nl> + void SetDirectionForward ( ) { <nl> + if ( operands_reversed_ = = true ) { <nl> + std : : reverse ( operand_list_ - > begin ( ) , operand_list_ - > end ( ) ) ; <nl> + operands_reversed_ = false ; <nl> + } <nl> + } <nl> + <nl> + void SetDirectionBackward ( ) { <nl> + if ( operands_reversed_ = = false ) { <nl> + std : : reverse ( operand_list_ - > begin ( ) , operand_list_ - > end ( ) ) ; <nl> + operands_reversed_ = true ; <nl> + } <nl> + } <nl> + <nl> + / / List of operands <nl> + std : : unique_ptr < std : : vector < Slice > > operand_list_ ; <nl> + / / Copy of operands that are not pinned . <nl> + std : : unique_ptr < std : : vector < std : : string > > copied_operands_ ; <nl> + bool operands_reversed_ = true ; <nl> } ; <nl> <nl> } / / namespace rocksdb <nl> mmm a / db / merge_helper . cc <nl> ppp b / db / merge_helper . cc <nl> namespace rocksdb { <nl> <nl> Status MergeHelper : : TimedFullMerge ( const MergeOperator * merge_operator , <nl> const Slice & key , const Slice * value , <nl> - const std : : deque < std : : string > & operands , <nl> + const std : : vector < Slice > & operands , <nl> std : : string * result , Logger * logger , <nl> - Statistics * statistics , Env * env ) { <nl> + Statistics * statistics , Env * env , <nl> + Slice * result_operand ) { <nl> assert ( merge_operator ! = nullptr ) ; <nl> <nl> if ( operands . size ( ) = = 0 ) { <nl> Status MergeHelper : : TimedFullMerge ( const MergeOperator * merge_operator , <nl> } <nl> <nl> bool success ; <nl> + Slice tmp_result_operand ( nullptr , 0 ) ; <nl> + const MergeOperator : : MergeOperationInput merge_in ( key , value , operands , <nl> + logger ) ; <nl> + MergeOperator : : MergeOperationOutput merge_out ( * result , tmp_result_operand ) ; <nl> { <nl> / / Setup to time the merge <nl> StopWatchNano timer ( env , statistics ! = nullptr ) ; <nl> PERF_TIMER_GUARD ( merge_operator_time_nanos ) ; <nl> <nl> / / Do the merge <nl> - success = merge_operator - > FullMerge ( key , value , operands , result , logger ) ; <nl> + success = merge_operator - > FullMergeV2 ( merge_in , & merge_out ) ; <nl> + <nl> + if ( tmp_result_operand . data ( ) ) { <nl> + / / FullMergeV2 result is an existing operand <nl> + if ( result_operand ! = nullptr ) { <nl> + * result_operand = tmp_result_operand ; <nl> + } else { <nl> + result - > assign ( tmp_result_operand . data ( ) , tmp_result_operand . size ( ) ) ; <nl> + } <nl> + } else if ( result_operand ) { <nl> + * result_operand = Slice ( nullptr , 0 ) ; <nl> + } <nl> <nl> RecordTick ( statistics , MERGE_OPERATION_TOTAL_TIME , <nl> statistics ? timer . ElapsedNanos ( ) : 0 ) ; <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> / / Also maintain the list of merge operands seen . <nl> assert ( HasOperator ( ) ) ; <nl> keys_ . clear ( ) ; <nl> - operands_ . clear ( ) ; <nl> + merge_context_ . Clear ( ) ; <nl> assert ( user_merge_operator_ ) ; <nl> bool first_key = true ; <nl> <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> bool hit_the_next_user_key = false ; <nl> for ( ; iter - > Valid ( ) ; iter - > Next ( ) , original_key_is_iter = false ) { <nl> ParsedInternalKey ikey ; <nl> - assert ( keys_ . size ( ) = = operands_ . size ( ) ) ; <nl> + assert ( keys_ . size ( ) = = merge_context_ . GetNumOperands ( ) ) ; <nl> <nl> if ( ! ParseInternalKey ( iter - > key ( ) , & ikey ) ) { <nl> / / stop at corrupted key <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> const Slice * val_ptr = ( kTypeValue = = ikey . type ) ? & val : nullptr ; <nl> std : : string merge_result ; <nl> s = TimedFullMerge ( user_merge_operator_ , ikey . user_key , val_ptr , <nl> - operands_ , & merge_result , logger_ , stats_ , env_ ) ; <nl> + merge_context_ . GetOperands ( ) , & merge_result , logger_ , <nl> + stats_ , env_ ) ; <nl> <nl> / / We store the result in keys_ . back ( ) and operands_ . back ( ) <nl> / / if nothing went wrong ( i . e . : no operand corruption on disk ) <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> orig_ikey . type = kTypeValue ; <nl> UpdateInternalKey ( & original_key , orig_ikey . sequence , orig_ikey . type ) ; <nl> keys_ . clear ( ) ; <nl> - operands_ . clear ( ) ; <nl> + merge_context_ . Clear ( ) ; <nl> keys_ . emplace_front ( std : : move ( original_key ) ) ; <nl> - operands_ . emplace_front ( std : : move ( merge_result ) ) ; <nl> + merge_context_ . PushOperand ( merge_result ) ; <nl> } <nl> <nl> / / move iter to the next entry <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> / / original_key before <nl> ParseInternalKey ( keys_ . back ( ) , & orig_ikey ) ; <nl> } <nl> - operands_ . push_front ( value_slice . ToString ( ) ) ; <nl> + merge_context_ . PushOperand ( value_slice , <nl> + iter - > IsValuePinned ( ) / * operand_pinned * / ) ; <nl> } <nl> } <nl> } <nl> <nl> - if ( operands_ . size ( ) = = 0 ) { <nl> + if ( merge_context_ . GetNumOperands ( ) = = 0 ) { <nl> / / we filtered out all the merge operands <nl> return Status : : OK ( ) ; <nl> } <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> / / do a final merge with nullptr as the existing value and say <nl> / / bye to the merge type ( it ' s now converted to a Put ) <nl> assert ( kTypeMerge = = orig_ikey . type ) ; <nl> - assert ( operands_ . size ( ) > = 1 ) ; <nl> - assert ( operands_ . size ( ) = = keys_ . size ( ) ) ; <nl> + assert ( merge_context_ . GetNumOperands ( ) > = 1 ) ; <nl> + assert ( merge_context_ . GetNumOperands ( ) = = keys_ . size ( ) ) ; <nl> std : : string merge_result ; <nl> s = TimedFullMerge ( user_merge_operator_ , orig_ikey . user_key , nullptr , <nl> - operands_ , & merge_result , logger_ , stats_ , env_ ) ; <nl> + merge_context_ . GetOperands ( ) , & merge_result , logger_ , <nl> + stats_ , env_ ) ; <nl> if ( s . ok ( ) ) { <nl> / / The original key encountered <nl> / / We are certain that keys_ is not empty here ( see assertions couple of <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> orig_ikey . type = kTypeValue ; <nl> UpdateInternalKey ( & original_key , orig_ikey . sequence , orig_ikey . type ) ; <nl> keys_ . clear ( ) ; <nl> - operands_ . clear ( ) ; <nl> + merge_context_ . Clear ( ) ; <nl> keys_ . emplace_front ( std : : move ( original_key ) ) ; <nl> - operands_ . emplace_front ( std : : move ( merge_result ) ) ; <nl> + merge_context_ . PushOperand ( merge_result ) ; <nl> } <nl> } else { <nl> / / We haven ' t seen the beginning of the key nor a Put / Delete . <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> / / partial merge returns Status : : OK ( ) . Should we change the status code <nl> / / after a successful partial merge ? <nl> s = Status : : MergeInProgress ( ) ; <nl> - if ( operands_ . size ( ) > = 2 & & <nl> - operands_ . size ( ) > = min_partial_merge_operands_ ) { <nl> + if ( merge_context_ . GetNumOperands ( ) > = 2 & & <nl> + merge_context_ . GetNumOperands ( ) > = min_partial_merge_operands_ ) { <nl> bool merge_success = false ; <nl> std : : string merge_result ; <nl> { <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> PERF_TIMER_GUARD ( merge_operator_time_nanos ) ; <nl> merge_success = user_merge_operator_ - > PartialMergeMulti ( <nl> orig_ikey . user_key , <nl> - std : : deque < Slice > ( operands_ . begin ( ) , operands_ . end ( ) ) , <nl> + std : : deque < Slice > ( merge_context_ . GetOperands ( ) . begin ( ) , <nl> + merge_context_ . GetOperands ( ) . end ( ) ) , <nl> & merge_result , logger_ ) ; <nl> RecordTick ( stats_ , MERGE_OPERATION_TOTAL_TIME , <nl> stats_ ? timer . ElapsedNanosSafe ( ) : 0 ) ; <nl> Status MergeHelper : : MergeUntil ( InternalIterator * iter , <nl> if ( merge_success ) { <nl> / / Merging of operands ( associative merge ) was successful . <nl> / / Replace operands with the merge result <nl> - operands_ . clear ( ) ; <nl> - operands_ . emplace_front ( std : : move ( merge_result ) ) ; <nl> + merge_context_ . Clear ( ) ; <nl> + merge_context_ . PushOperand ( merge_result ) ; <nl> keys_ . erase ( keys_ . begin ( ) , keys_ . end ( ) - 1 ) ; <nl> } <nl> } <nl> mmm a / db / merge_helper . h <nl> ppp b / db / merge_helper . h <nl> <nl> <nl> # include < deque > <nl> # include < string > <nl> + # include < vector > <nl> <nl> # include " db / dbformat . h " <nl> + # include " db / merge_context . h " <nl> # include " rocksdb / compaction_filter . h " <nl> # include " rocksdb / env . h " <nl> # include " rocksdb / slice . h " <nl> class MergeHelper { <nl> latest_snapshot_ ( latest_snapshot ) , <nl> level_ ( level ) , <nl> keys_ ( ) , <nl> - operands_ ( ) , <nl> filter_timer_ ( env_ ) , <nl> total_filter_time_ ( 0U ) , <nl> stats_ ( stats ) { <nl> assert ( user_comparator_ ! = nullptr ) ; <nl> } <nl> <nl> - / / Wrapper around MergeOperator : : FullMerge ( ) that records perf statistics . <nl> + / / Wrapper around MergeOperator : : FullMergeV2 ( ) that records perf statistics . <nl> / / Result of merge will be written to result if status returned is OK . <nl> / / If operands is empty , the value will simply be copied to result . <nl> / / Returns one of the following statuses : <nl> class MergeHelper { <nl> / / - Corruption : Merge operator reported unsuccessful merge . <nl> static Status TimedFullMerge ( const MergeOperator * merge_operator , <nl> const Slice & key , const Slice * value , <nl> - const std : : deque < std : : string > & operands , <nl> + const std : : vector < Slice > & operands , <nl> std : : string * result , Logger * logger , <nl> - Statistics * statistics , Env * env ) ; <nl> + Statistics * statistics , Env * env , <nl> + Slice * result_operand = nullptr ) ; <nl> <nl> / / Merge entries until we hit <nl> / / - a corrupted key <nl> class MergeHelper { <nl> / / So keys ( ) . back ( ) was the first key seen by iterator . <nl> / / TODO : Re - style this comment to be like the first one <nl> const std : : deque < std : : string > & keys ( ) const { return keys_ ; } <nl> - const std : : deque < std : : string > & values ( ) const { return operands_ ; } <nl> + const std : : vector < Slice > & values ( ) const { <nl> + return merge_context_ . GetOperands ( ) ; <nl> + } <nl> uint64_t TotalFilterTime ( ) const { return total_filter_time_ ; } <nl> bool HasOperator ( ) const { return user_merge_operator_ ! = nullptr ; } <nl> <nl> class MergeHelper { <nl> <nl> / / the scratch area that holds the result of MergeUntil <nl> / / valid up to the next MergeUntil call <nl> - std : : deque < std : : string > keys_ ; / / Keeps track of the sequence of keys seen <nl> - std : : deque < std : : string > operands_ ; / / Parallel with keys_ ; stores the values <nl> + <nl> + / / Keeps track of the sequence of keys seen <nl> + std : : deque < std : : string > keys_ ; <nl> + / / Parallel with keys_ ; stores the operands <nl> + mutable MergeContext merge_context_ ; <nl> <nl> StopWatchNano filter_timer_ ; <nl> uint64_t total_filter_time_ ; <nl> class MergeOutputIterator { <nl> private : <nl> const MergeHelper * merge_helper_ ; <nl> std : : deque < std : : string > : : const_reverse_iterator it_keys_ ; <nl> - std : : deque < std : : string > : : const_reverse_iterator it_values_ ; <nl> + std : : vector < Slice > : : const_reverse_iterator it_values_ ; <nl> } ; <nl> <nl> } / / namespace rocksdb <nl> mmm a / db / merge_operator . cc <nl> ppp b / db / merge_operator . cc <nl> <nl> <nl> namespace rocksdb { <nl> <nl> + bool MergeOperator : : FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const { <nl> + / / If FullMergeV2 is not implemented , we convert the operand_list to <nl> + / / std : : deque < std : : string > and pass it to FullMerge <nl> + std : : deque < std : : string > operand_list_str ; <nl> + for ( auto & op : merge_in . operand_list ) { <nl> + operand_list_str . emplace_back ( op . data ( ) , op . size ( ) ) ; <nl> + } <nl> + return FullMerge ( merge_in . key , merge_in . existing_value , operand_list_str , <nl> + & merge_out - > new_value , merge_in . logger ) ; <nl> + } <nl> + <nl> / / The default implementation of PartialMergeMulti , which invokes <nl> / / PartialMerge multiple times internally and merges two operands at <nl> / / a time . <nl> bool MergeOperator : : PartialMergeMulti ( const Slice & key , <nl> / / Given a " real " merge from the library , call the user ' s <nl> / / associative merge function one - by - one on each of the operands . <nl> / / NOTE : It is assumed that the client ' s merge - operator will handle any errors . <nl> - bool AssociativeMergeOperator : : FullMerge ( <nl> - const Slice & key , <nl> - const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , <nl> - Logger * logger ) const { <nl> - <nl> + bool AssociativeMergeOperator : : FullMergeV2 ( <nl> + const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const { <nl> / / Simply loop through the operands <nl> Slice temp_existing ; <nl> - for ( const auto & operand : operand_list ) { <nl> - Slice value ( operand ) ; <nl> + const Slice * existing_value = merge_in . existing_value ; <nl> + for ( const auto & operand : merge_in . operand_list ) { <nl> std : : string temp_value ; <nl> - if ( ! Merge ( key , existing_value , value , & temp_value , logger ) ) { <nl> + if ( ! Merge ( merge_in . key , existing_value , operand , & temp_value , <nl> + merge_in . logger ) ) { <nl> return false ; <nl> } <nl> - swap ( temp_value , * new_value ) ; <nl> - temp_existing = Slice ( * new_value ) ; <nl> + swap ( temp_value , merge_out - > new_value ) ; <nl> + temp_existing = Slice ( merge_out - > new_value ) ; <nl> existing_value = & temp_existing ; <nl> } <nl> <nl> mmm a / db / pinned_iterators_manager . h <nl> ppp b / db / pinned_iterators_manager . h <nl> namespace rocksdb { <nl> class PinnedIteratorsManager { <nl> public : <nl> PinnedIteratorsManager ( ) : pinning_enabled ( false ) , pinned_iters_ ( nullptr ) { } <nl> - ~ PinnedIteratorsManager ( ) { assert ( ! pinning_enabled ) ; } <nl> + ~ PinnedIteratorsManager ( ) { ReleasePinnedIterators ( ) ; } <nl> <nl> / / Enable Iterators pinning <nl> void StartPinning ( ) { <nl> class PinnedIteratorsManager { <nl> } <nl> <nl> / / Release pinned Iterators <nl> - void ReleasePinnedIterators ( ) { <nl> + inline void ReleasePinnedIterators ( ) { <nl> if ( pinning_enabled ) { <nl> pinning_enabled = false ; <nl> <nl> mmm a / db / version_set . cc <nl> ppp b / db / version_set . cc <nl> <nl> # include " db / memtable . h " <nl> # include " db / merge_context . h " <nl> # include " db / merge_helper . h " <nl> + # include " db / pinned_iterators_manager . h " <nl> # include " db / table_cache . h " <nl> # include " db / version_builder . h " <nl> # include " rocksdb / env . h " <nl> void Version : : Get ( const ReadOptions & read_options , const LookupKey & k , <nl> * key_exists = true ; <nl> } <nl> <nl> + PinnedIteratorsManager pinned_iters_mgr ; <nl> GetContext get_context ( <nl> user_comparator ( ) , merge_operator_ , info_log_ , db_statistics_ , <nl> status - > ok ( ) ? GetContext : : kNotFound : GetContext : : kMerge , user_key , <nl> - value , value_found , merge_context , this - > env_ , seq ) ; <nl> + value , value_found , merge_context , this - > env_ , seq , <nl> + merge_operator_ ? & pinned_iters_mgr : nullptr ) ; <nl> + <nl> + / / Pin blocks that we read to hold merge operands <nl> + if ( merge_operator_ ) { <nl> + pinned_iters_mgr . StartPinning ( ) ; <nl> + } <nl> <nl> FilePicker fp ( <nl> storage_info_ . files_ , user_key , ikey , & storage_info_ . level_files_brief_ , <nl> mmm a / db / write_batch . cc <nl> ppp b / db / write_batch . cc <nl> class MemTableInserter : public WriteBatch : : Handler { <nl> auto merge_operator = moptions - > merge_operator ; <nl> assert ( merge_operator ) ; <nl> <nl> - std : : deque < std : : string > operands ; <nl> - operands . push_front ( value . ToString ( ) ) ; <nl> std : : string new_value ; <nl> <nl> Status merge_status = MergeHelper : : TimedFullMerge ( <nl> - merge_operator , key , & get_value_slice , operands , & new_value , <nl> + merge_operator , key , & get_value_slice , { value } , & new_value , <nl> moptions - > info_log , moptions - > statistics , Env : : Default ( ) ) ; <nl> <nl> if ( ! merge_status . ok ( ) ) { <nl> mmm a / examples / compaction_filter_example . cc <nl> ppp b / examples / compaction_filter_example . cc <nl> <nl> <nl> class MyMerge : public rocksdb : : MergeOperator { <nl> public : <nl> - bool FullMerge ( const rocksdb : : Slice & key , <nl> - const rocksdb : : Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , <nl> - rocksdb : : Logger * logger ) const override { <nl> - new_value - > clear ( ) ; <nl> - if ( existing_value ! = nullptr ) { <nl> - new_value - > assign ( existing_value - > data ( ) , existing_value - > size ( ) ) ; <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> + merge_out - > new_value . clear ( ) ; <nl> + if ( merge_in . existing_value ! = nullptr ) { <nl> + merge_out - > new_value . assign ( merge_in . existing_value - > data ( ) , <nl> + merge_in . existing_value - > size ( ) ) ; <nl> } <nl> - for ( const std : : string & m : operand_list ) { <nl> - fprintf ( stderr , " Merge ( % s ) \ n " , m . c_str ( ) ) ; <nl> - assert ( m ! = " bad " ) ; / / the compaction filter filters out bad values <nl> - new_value - > assign ( m ) ; <nl> + for ( const rocksdb : : Slice & m : merge_in . operand_list ) { <nl> + fprintf ( stderr , " Merge ( % s ) \ n " , m . ToString ( ) . c_str ( ) ) ; <nl> + / / the compaction filter filters out bad values <nl> + assert ( m . ToString ( ) ! = " bad " ) ; <nl> + merge_out - > new_value . assign ( m . data ( ) , m . size ( ) ) ; <nl> } <nl> return true ; <nl> } <nl> mmm a / include / rocksdb / merge_operator . h <nl> ppp b / include / rocksdb / merge_operator . h <nl> <nl> # include < deque > <nl> # include < memory > <nl> # include < string > <nl> + # include < vector > <nl> <nl> # include " rocksdb / slice . h " <nl> <nl> class Logger ; <nl> / / into rocksdb ) ; numeric addition and string concatenation are examples ; <nl> / / <nl> / / b ) MergeOperator - the generic class for all the more abstract / complex <nl> - / / operations ; one method ( FullMerge ) to merge a Put / Delete value with a <nl> + / / operations ; one method ( FullMergeV2 ) to merge a Put / Delete value with a <nl> / / merge operand ; and another method ( PartialMerge ) that merges multiple <nl> / / operands together . this is especially useful if your key values have <nl> / / complex structures but you would still like to support client - specific <nl> class MergeOperator { <nl> const Slice * existing_value , <nl> const std : : deque < std : : string > & operand_list , <nl> std : : string * new_value , <nl> - Logger * logger ) const = 0 ; <nl> + Logger * logger ) const { <nl> + / / deprecated , please use FullMergeV2 ( ) <nl> + assert ( false ) ; <nl> + return false ; <nl> + } <nl> + <nl> + struct MergeOperationInput { <nl> + explicit MergeOperationInput ( const Slice & _key , <nl> + const Slice * _existing_value , <nl> + const std : : vector < Slice > & _operand_list , <nl> + Logger * _logger ) <nl> + : key ( _key ) , <nl> + existing_value ( _existing_value ) , <nl> + operand_list ( _operand_list ) , <nl> + logger ( _logger ) { } <nl> + <nl> + / / The key associated with the merge operation . <nl> + const Slice & key ; <nl> + / / The existing value of the current key , nullptr means that the <nl> + / / value dont exist . <nl> + const Slice * existing_value ; <nl> + / / A list of operands to apply . <nl> + const std : : vector < Slice > & operand_list ; <nl> + / / Logger could be used by client to log any errors that happen during <nl> + / / the merge operation . <nl> + Logger * logger ; <nl> + } ; <nl> + <nl> + struct MergeOperationOutput { <nl> + explicit MergeOperationOutput ( std : : string & _new_value , <nl> + Slice & _existing_operand ) <nl> + : new_value ( _new_value ) , existing_operand ( _existing_operand ) { } <nl> + <nl> + / / Client is responsible for filling the merge result here . <nl> + std : : string & new_value ; <nl> + / / If the merge result is one of the existing operands ( or existing_value ) , <nl> + / / client can set this field to the operand ( or existing_value ) instead of <nl> + / / using new_value . <nl> + Slice & existing_operand ; <nl> + } ; <nl> + <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const ; <nl> <nl> / / This function performs merge ( left_op , right_op ) <nl> / / when both the operands are themselves merge operation types <nl> class MergeOperator { <nl> / / TODO : Presently there is no way to differentiate between error / corruption <nl> / / and simply " return false " . For now , the client should simply return <nl> / / false in any case it cannot perform partial - merge , regardless of reason . <nl> - / / If there is corruption in the data , handle it in the FullMerge ( ) function , <nl> + / / If there is corruption in the data , handle it in the FullMergeV2 ( ) function <nl> / / and return false there . The default implementation of PartialMerge will <nl> / / always return false . <nl> virtual bool PartialMerge ( const Slice & key , const Slice & left_operand , <nl> class AssociativeMergeOperator : public MergeOperator { <nl> <nl> private : <nl> / / Default implementations of the MergeOperator functions <nl> - virtual bool FullMerge ( const Slice & key , <nl> - const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , <nl> - Logger * logger ) const override ; <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override ; <nl> <nl> virtual bool PartialMerge ( const Slice & key , <nl> const Slice & left_operand , <nl> mmm a / table / block . h <nl> ppp b / table / block . h <nl> class BlockIter : public InternalIterator { <nl> <nl> virtual bool IsKeyPinned ( ) const override { return key_pinned_ ; } <nl> <nl> + virtual bool IsValuePinned ( ) const override { return true ; } <nl> + <nl> private : <nl> const Comparator * comparator_ ; <nl> const char * data_ ; / / underlying block contents <nl> mmm a / table / block_based_table_reader . cc <nl> ppp b / table / block_based_table_reader . cc <nl> <nl> # include < utility > <nl> <nl> # include " db / dbformat . h " <nl> + # include " db / pinned_iterators_manager . h " <nl> <nl> # include " rocksdb / cache . h " <nl> # include " rocksdb / comparator . h " <nl> Status BlockBasedTable : : Get ( const ReadOptions & read_options , const Slice & key , <nl> BlockIter iiter ; <nl> NewIndexIterator ( read_options , & iiter ) ; <nl> <nl> + PinnedIteratorsManager * pinned_iters_mgr = get_context - > pinned_iters_mgr ( ) ; <nl> + bool pin_blocks = pinned_iters_mgr & & pinned_iters_mgr - > PinningEnabled ( ) ; <nl> + BlockIter * biter = nullptr ; <nl> + <nl> bool done = false ; <nl> for ( iiter . Seek ( key ) ; iiter . Valid ( ) & & ! done ; iiter . Next ( ) ) { <nl> Slice handle_value = iiter . value ( ) ; <nl> Status BlockBasedTable : : Get ( const ReadOptions & read_options , const Slice & key , <nl> RecordTick ( rep_ - > ioptions . statistics , BLOOM_FILTER_USEFUL ) ; <nl> break ; <nl> } else { <nl> - BlockIter biter ; <nl> - NewDataBlockIterator ( rep_ , read_options , iiter . value ( ) , & biter ) ; <nl> + BlockIter stack_biter ; <nl> + if ( pin_blocks ) { <nl> + / / We need to create the BlockIter on heap because we may need to <nl> + / / pin it if we encounterd merge operands <nl> + biter = static_cast < BlockIter * > ( <nl> + NewDataBlockIterator ( rep_ , read_options , iiter . value ( ) ) ) ; <nl> + } else { <nl> + biter = & stack_biter ; <nl> + NewDataBlockIterator ( rep_ , read_options , iiter . value ( ) , biter ) ; <nl> + } <nl> <nl> if ( read_options . read_tier = = kBlockCacheTier & & <nl> - biter . status ( ) . IsIncomplete ( ) ) { <nl> + biter - > status ( ) . IsIncomplete ( ) ) { <nl> / / couldn ' t get block from block_cache <nl> / / Update Saver . state to Found because we are only looking for whether <nl> / / we can guarantee the key is not there when " no_io " is set <nl> get_context - > MarkKeyMayExist ( ) ; <nl> break ; <nl> } <nl> - if ( ! biter . status ( ) . ok ( ) ) { <nl> - s = biter . status ( ) ; <nl> + if ( ! biter - > status ( ) . ok ( ) ) { <nl> + s = biter - > status ( ) ; <nl> break ; <nl> } <nl> <nl> / / Call the * saver function on each entry / block until it returns false <nl> - for ( biter . Seek ( key ) ; biter . Valid ( ) ; biter . Next ( ) ) { <nl> + for ( biter - > Seek ( key ) ; biter - > Valid ( ) ; biter - > Next ( ) ) { <nl> ParsedInternalKey parsed_key ; <nl> - if ( ! ParseInternalKey ( biter . key ( ) , & parsed_key ) ) { <nl> + if ( ! ParseInternalKey ( biter - > key ( ) , & parsed_key ) ) { <nl> s = Status : : Corruption ( Slice ( ) ) ; <nl> } <nl> <nl> - if ( ! get_context - > SaveValue ( parsed_key , biter . value ( ) ) ) { <nl> + if ( ! get_context - > SaveValue ( parsed_key , biter - > value ( ) , pin_blocks ) ) { <nl> done = true ; <nl> break ; <nl> } <nl> } <nl> - s = biter . status ( ) ; <nl> + s = biter - > status ( ) ; <nl> + <nl> + if ( pin_blocks ) { <nl> + if ( get_context - > State ( ) = = GetContext : : kMerge ) { <nl> + / / Pin blocks as long as we are merging <nl> + pinned_iters_mgr - > PinIteratorIfNeeded ( biter ) ; <nl> + } else { <nl> + delete biter ; <nl> + } <nl> + biter = nullptr ; <nl> + } else { <nl> + / / biter is on stack , Nothing to clean <nl> + } <nl> } <nl> } <nl> + if ( pin_blocks & & biter ! = nullptr ) { <nl> + delete biter ; <nl> + } <nl> if ( s . ok ( ) ) { <nl> s = iiter . status ( ) ; <nl> } <nl> mmm a / table / get_context . cc <nl> ppp b / table / get_context . cc <nl> <nl> <nl> # include " table / get_context . h " <nl> # include " db / merge_helper . h " <nl> + # include " db / pinned_iterators_manager . h " <nl> # include " rocksdb / env . h " <nl> # include " rocksdb / merge_operator . h " <nl> # include " rocksdb / statistics . h " <nl> GetContext : : GetContext ( const Comparator * ucmp , <nl> Statistics * statistics , GetState init_state , <nl> const Slice & user_key , std : : string * ret_value , <nl> bool * value_found , MergeContext * merge_context , Env * env , <nl> - SequenceNumber * seq ) <nl> + SequenceNumber * seq , <nl> + PinnedIteratorsManager * _pinned_iters_mgr ) <nl> : ucmp_ ( ucmp ) , <nl> merge_operator_ ( merge_operator ) , <nl> logger_ ( logger ) , <nl> GetContext : : GetContext ( const Comparator * ucmp , <nl> merge_context_ ( merge_context ) , <nl> env_ ( env ) , <nl> seq_ ( seq ) , <nl> - replay_log_ ( nullptr ) { <nl> + replay_log_ ( nullptr ) , <nl> + pinned_iters_mgr_ ( _pinned_iters_mgr ) { <nl> if ( seq_ ) { <nl> * seq_ = kMaxSequenceNumber ; <nl> } <nl> void GetContext : : SaveValue ( const Slice & value , SequenceNumber seq ) { <nl> } <nl> <nl> bool GetContext : : SaveValue ( const ParsedInternalKey & parsed_key , <nl> - const Slice & value ) { <nl> + const Slice & value , bool value_pinned ) { <nl> assert ( ( state_ ! = kMerge & & parsed_key . type ! = kTypeMerge ) | | <nl> merge_context_ ! = nullptr ) ; <nl> if ( ucmp_ - > Equal ( parsed_key . user_key , user_key_ ) ) { <nl> bool GetContext : : SaveValue ( const ParsedInternalKey & parsed_key , <nl> case kTypeMerge : <nl> assert ( state_ = = kNotFound | | state_ = = kMerge ) ; <nl> state_ = kMerge ; <nl> - merge_context_ - > PushOperand ( value ) ; <nl> + merge_context_ - > PushOperand ( value , value_pinned ) ; <nl> return true ; <nl> <nl> default : <nl> void replayGetContextLog ( const Slice & replay_log , const Slice & user_key , <nl> / / Since SequenceNumber is not stored and unknown , we will use <nl> / / kMaxSequenceNumber . <nl> get_context - > SaveValue ( <nl> - ParsedInternalKey ( user_key , kMaxSequenceNumber , type ) , value ) ; <nl> + ParsedInternalKey ( user_key , kMaxSequenceNumber , type ) , value , true ) ; <nl> } <nl> # else / / ROCKSDB_LITE <nl> assert ( false ) ; <nl> mmm a / table / get_context . h <nl> ppp b / table / get_context . h <nl> <nl> <nl> namespace rocksdb { <nl> class MergeContext ; <nl> + class PinnedIteratorsManager ; <nl> <nl> class GetContext { <nl> public : <nl> class GetContext { <nl> Logger * logger , Statistics * statistics , GetState init_state , <nl> const Slice & user_key , std : : string * ret_value , bool * value_found , <nl> MergeContext * merge_context , Env * env , <nl> - SequenceNumber * seq = nullptr ) ; <nl> + SequenceNumber * seq = nullptr , <nl> + PinnedIteratorsManager * _pinned_iters_mgr = nullptr ) ; <nl> <nl> void MarkKeyMayExist ( ) ; <nl> <nl> class GetContext { <nl> / / <nl> / / Returns True if more keys need to be read ( due to merges ) or <nl> / / False if the complete value has been found . <nl> - bool SaveValue ( const ParsedInternalKey & parsed_key , const Slice & value ) ; <nl> + bool SaveValue ( const ParsedInternalKey & parsed_key , const Slice & value , <nl> + bool value_pinned = false ) ; <nl> <nl> / / Simplified version of the previous function . Should only be used when we <nl> / / know that the operation is a Put . <nl> class GetContext { <nl> <nl> GetState State ( ) const { return state_ ; } <nl> <nl> + PinnedIteratorsManager * pinned_iters_mgr ( ) { return pinned_iters_mgr_ ; } <nl> + <nl> / / If a non - null string is passed , all the SaveValue calls will be <nl> / / logged into the string . The operations can then be replayed on <nl> / / another GetContext with replayGetContextLog . <nl> class GetContext { <nl> / / write to the key or kMaxSequenceNumber if unknown <nl> SequenceNumber * seq_ ; <nl> std : : string * replay_log_ ; <nl> + / / Used to temporarily pin blocks when state_ = = GetContext : : kMerge <nl> + PinnedIteratorsManager * pinned_iters_mgr_ ; <nl> } ; <nl> <nl> void replayGetContextLog ( const Slice & replay_log , const Slice & user_key , <nl> mmm a / table / internal_iterator . h <nl> ppp b / table / internal_iterator . h <nl> class InternalIterator : public Cleanable { <nl> / / set to false . <nl> virtual bool IsKeyPinned ( ) const { return false ; } <nl> <nl> + / / If true , this means that the Slice returned by value ( ) is valid as long as <nl> + / / PinnedIteratorsManager : : ReleasePinnedIterators is not called and the <nl> + / / Iterator is not deleted . <nl> + virtual bool IsValuePinned ( ) const { return false ; } <nl> + <nl> virtual Status GetProperty ( std : : string prop_name , std : : string * prop ) { <nl> return Status : : NotSupported ( " " ) ; <nl> } <nl> mmm a / table / iterator_wrapper . h <nl> ppp b / table / iterator_wrapper . h <nl> <nl> namespace rocksdb { <nl> <nl> / / A internal wrapper class with an interface similar to Iterator that caches <nl> - / / the valid ( ) , key ( ) and IsKeyPinned ( ) results for an underlying iterator . <nl> + / / the valid ( ) and key ( ) results for an underlying iterator . <nl> / / This can help avoid virtual function calls and also gives better <nl> / / cache locality . <nl> class IteratorWrapper { <nl> class IteratorWrapper { <nl> / / Iterator interface methods <nl> bool Valid ( ) const { return valid_ ; } <nl> Slice key ( ) const { assert ( Valid ( ) ) ; return key_ ; } <nl> - bool IsKeyPinned ( ) const { assert ( Valid ( ) ) ; return is_key_pinned_ ; } <nl> Slice value ( ) const { assert ( Valid ( ) ) ; return iter_ - > value ( ) ; } <nl> / / Methods below require iter ( ) ! = nullptr <nl> Status status ( ) const { assert ( iter_ ) ; return iter_ - > status ( ) ; } <nl> class IteratorWrapper { <nl> void Seek ( const Slice & k ) { assert ( iter_ ) ; iter_ - > Seek ( k ) ; Update ( ) ; } <nl> void SeekToFirst ( ) { assert ( iter_ ) ; iter_ - > SeekToFirst ( ) ; Update ( ) ; } <nl> void SeekToLast ( ) { assert ( iter_ ) ; iter_ - > SeekToLast ( ) ; Update ( ) ; } <nl> + <nl> void SetPinnedItersMgr ( PinnedIteratorsManager * pinned_iters_mgr ) { <nl> assert ( iter_ ) ; <nl> iter_ - > SetPinnedItersMgr ( pinned_iters_mgr ) ; <nl> - Update ( ) ; <nl> + } <nl> + bool IsKeyPinned ( ) const { <nl> + assert ( Valid ( ) ) ; <nl> + return iter_ - > IsKeyPinned ( ) ; <nl> + } <nl> + bool IsValuePinned ( ) const { <nl> + assert ( Valid ( ) ) ; <nl> + return iter_ - > IsValuePinned ( ) ; <nl> } <nl> <nl> private : <nl> class IteratorWrapper { <nl> valid_ = iter_ - > Valid ( ) ; <nl> if ( valid_ ) { <nl> key_ = iter_ - > key ( ) ; <nl> - is_key_pinned_ = iter_ - > IsKeyPinned ( ) ; <nl> } <nl> } <nl> <nl> InternalIterator * iter_ ; <nl> bool valid_ ; <nl> Slice key_ ; <nl> - bool is_key_pinned_ ; <nl> } ; <nl> <nl> class Arena ; <nl> mmm a / table / merger . cc <nl> ppp b / table / merger . cc <nl> class MergingIterator : public InternalIterator { <nl> current_ - > IsKeyPinned ( ) ; <nl> } <nl> <nl> + virtual bool IsValuePinned ( ) const override { <nl> + assert ( Valid ( ) ) ; <nl> + return pinned_iters_mgr_ & & pinned_iters_mgr_ - > PinningEnabled ( ) & & <nl> + current_ - > IsValuePinned ( ) ; <nl> + } <nl> + <nl> private : <nl> / / Clears heaps for both directions , used when changing direction or seeking <nl> void ClearHeaps ( ) ; <nl> mmm a / table / two_level_iterator . cc <nl> ppp b / table / two_level_iterator . cc <nl> class TwoLevelIterator : public InternalIterator { <nl> return pinned_iters_mgr_ & & pinned_iters_mgr_ - > PinningEnabled ( ) & & <nl> second_level_iter_ . iter ( ) & & second_level_iter_ . IsKeyPinned ( ) ; <nl> } <nl> + virtual bool IsValuePinned ( ) const override { <nl> + return pinned_iters_mgr_ & & pinned_iters_mgr_ - > PinningEnabled ( ) & & <nl> + second_level_iter_ . iter ( ) & & second_level_iter_ . IsValuePinned ( ) ; <nl> + } <nl> <nl> private : <nl> void SaveError ( const Status & s ) { <nl> mmm a / tools / db_crashtest . py <nl> ppp b / tools / db_crashtest . py <nl> <nl> " write_buffer_size " : 4 * 1024 * 1024 , <nl> " writepercent " : 35 , <nl> " subcompactions " : lambda : random . randint ( 1 , 4 ) , <nl> + " use_merge " : lambda : random . randint ( 0 , 1 ) , <nl> + " use_full_merge_v1 " : lambda : random . randint ( 0 , 1 ) , <nl> } <nl> <nl> <nl> mmm a / tools / db_stress . cc <nl> ppp b / tools / db_stress . cc <nl> static const bool FLAGS_prefix_size_dummy __attribute__ ( ( unused ) ) = <nl> DEFINE_bool ( use_merge , false , " On true , replaces all writes with a Merge " <nl> " that behaves like a Put " ) ; <nl> <nl> + DEFINE_bool ( use_full_merge_v1 , false , <nl> + " On true , use a merge operator that implement the deprecated " <nl> + " version of FullMerge " ) ; <nl> <nl> namespace rocksdb { <nl> <nl> class StressTest { <nl> } <nl> <nl> if ( FLAGS_use_merge ) { <nl> - options_ . merge_operator = MergeOperators : : CreatePutOperator ( ) ; <nl> + if ( FLAGS_use_full_merge_v1 ) { <nl> + options_ . merge_operator = MergeOperators : : CreateDeprecatedPutOperator ( ) ; <nl> + } else { <nl> + options_ . merge_operator = MergeOperators : : CreatePutOperator ( ) ; <nl> + } <nl> } <nl> <nl> / / set universal style compaction configurations , if applicable <nl> mmm a / util / testutil . h <nl> ppp b / util / testutil . h <nl> class ChanglingMergeOperator : public MergeOperator { <nl> <nl> void SetName ( const std : : string & name ) { name_ = name ; } <nl> <nl> - virtual bool FullMerge ( const Slice & key , const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , <nl> - Logger * logger ) const override { <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> return false ; <nl> } <nl> virtual bool PartialMergeMulti ( const Slice & key , <nl> mmm a / utilities / merge_operators . h <nl> ppp b / utilities / merge_operators . h <nl> namespace rocksdb { <nl> class MergeOperators { <nl> public : <nl> static std : : shared_ptr < MergeOperator > CreatePutOperator ( ) ; <nl> + static std : : shared_ptr < MergeOperator > CreateDeprecatedPutOperator ( ) ; <nl> static std : : shared_ptr < MergeOperator > CreateUInt64AddOperator ( ) ; <nl> static std : : shared_ptr < MergeOperator > CreateStringAppendOperator ( ) ; <nl> static std : : shared_ptr < MergeOperator > CreateStringAppendTESTOperator ( ) ; <nl> class MergeOperators { <nl> const std : : string & name ) { <nl> if ( name = = " put " ) { <nl> return CreatePutOperator ( ) ; <nl> + } else if ( name = = " put_v1 " ) { <nl> + return CreateDeprecatedPutOperator ( ) ; <nl> } else if ( name = = " uint64add " ) { <nl> return CreateUInt64AddOperator ( ) ; <nl> } else if ( name = = " stringappend " ) { <nl> mmm a / utilities / merge_operators / max . cc <nl> ppp b / utilities / merge_operators / max . cc <nl> namespace { / / anonymous namespace <nl> / / Slice : : compare <nl> class MaxOperator : public MergeOperator { <nl> public : <nl> - virtual bool FullMerge ( const Slice & key , const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , <nl> - Logger * logger ) const override { <nl> - Slice max ; <nl> - if ( existing_value ) { <nl> - max = Slice ( existing_value - > data ( ) , existing_value - > size ( ) ) ; <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> + Slice & max = merge_out - > existing_operand ; <nl> + if ( merge_in . existing_value ) { <nl> + max = Slice ( merge_in . existing_value - > data ( ) , <nl> + merge_in . existing_value - > size ( ) ) ; <nl> } <nl> <nl> - for ( const auto & op : operand_list ) { <nl> + for ( const auto & op : merge_in . operand_list ) { <nl> if ( max . compare ( op ) < 0 ) { <nl> - max = Slice ( op . data ( ) , op . size ( ) ) ; <nl> + max = op ; <nl> } <nl> } <nl> <nl> - new_value - > assign ( max . data ( ) , max . size ( ) ) ; <nl> return true ; <nl> } <nl> <nl> mmm a / utilities / merge_operators / put . cc <nl> ppp b / utilities / merge_operators / put . cc <nl> class PutOperator : public MergeOperator { <nl> } <nl> } ; <nl> <nl> + class PutOperatorV2 : public PutOperator { <nl> + virtual bool FullMerge ( const Slice & key , const Slice * existing_value , <nl> + const std : : deque < std : : string > & operand_sequence , <nl> + std : : string * new_value , <nl> + Logger * logger ) const override { <nl> + assert ( false ) ; <nl> + return false ; <nl> + } <nl> + <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> + / / Put basically only looks at the current / latest value <nl> + assert ( ! merge_in . operand_list . empty ( ) ) ; <nl> + merge_out - > existing_operand = merge_in . operand_list . back ( ) ; <nl> + return true ; <nl> + } <nl> + } ; <nl> + <nl> } / / end of anonymous namespace <nl> <nl> namespace rocksdb { <nl> <nl> - std : : shared_ptr < MergeOperator > MergeOperators : : CreatePutOperator ( ) { <nl> + std : : shared_ptr < MergeOperator > MergeOperators : : CreateDeprecatedPutOperator ( ) { <nl> return std : : make_shared < PutOperator > ( ) ; <nl> } <nl> <nl> + std : : shared_ptr < MergeOperator > MergeOperators : : CreatePutOperator ( ) { <nl> + return std : : make_shared < PutOperatorV2 > ( ) ; <nl> + } <nl> } <nl> mmm a / utilities / merge_operators / string_append / stringappend2 . cc <nl> ppp b / utilities / merge_operators / string_append / stringappend2 . cc <nl> StringAppendTESTOperator : : StringAppendTESTOperator ( char delim_char ) <nl> } <nl> <nl> / / Implementation for the merge operation ( concatenates two strings ) <nl> - bool StringAppendTESTOperator : : FullMerge ( <nl> - const Slice & key , <nl> - const Slice * existing_value , <nl> - const std : : deque < std : : string > & operands , <nl> - std : : string * new_value , <nl> - Logger * logger ) const { <nl> - <nl> + bool StringAppendTESTOperator : : FullMergeV2 ( <nl> + const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const { <nl> / / Clear the * new_value for writing . <nl> - assert ( new_value ) ; <nl> - new_value - > clear ( ) ; <nl> + merge_out - > new_value . clear ( ) ; <nl> + <nl> + if ( merge_in . existing_value = = nullptr & & merge_in . operand_list . size ( ) = = 1 ) { <nl> + / / Only one operand <nl> + merge_out - > existing_operand = merge_in . operand_list . back ( ) ; <nl> + return true ; <nl> + } <nl> <nl> / / Compute the space needed for the final result . <nl> size_t numBytes = 0 ; <nl> - for ( auto it = operands . begin ( ) ; it ! = operands . end ( ) ; + + it ) { <nl> + for ( auto it = merge_in . operand_list . begin ( ) ; <nl> + it ! = merge_in . operand_list . end ( ) ; + + it ) { <nl> numBytes + = it - > size ( ) + 1 ; / / Plus 1 for the delimiter <nl> } <nl> <nl> bool StringAppendTESTOperator : : FullMerge ( <nl> bool printDelim = false ; <nl> <nl> / / Prepend the * existing_value if one exists . <nl> - if ( existing_value ) { <nl> - new_value - > reserve ( numBytes + existing_value - > size ( ) ) ; <nl> - new_value - > append ( existing_value - > data ( ) , existing_value - > size ( ) ) ; <nl> + if ( merge_in . existing_value ) { <nl> + merge_out - > new_value . reserve ( numBytes + merge_in . existing_value - > size ( ) ) ; <nl> + merge_out - > new_value . append ( merge_in . existing_value - > data ( ) , <nl> + merge_in . existing_value - > size ( ) ) ; <nl> printDelim = true ; <nl> } else if ( numBytes ) { <nl> - new_value - > reserve ( numBytes - 1 ) ; / / Minus 1 since we have one less delimiter <nl> + merge_out - > new_value . reserve ( <nl> + numBytes - 1 ) ; / / Minus 1 since we have one less delimiter <nl> } <nl> <nl> / / Concatenate the sequence of strings ( and add a delimiter between each ) <nl> - for ( auto it = operands . begin ( ) ; it ! = operands . end ( ) ; + + it ) { <nl> + for ( auto it = merge_in . operand_list . begin ( ) ; <nl> + it ! = merge_in . operand_list . end ( ) ; + + it ) { <nl> if ( printDelim ) { <nl> - new_value - > append ( 1 , delim_ ) ; <nl> + merge_out - > new_value . append ( 1 , delim_ ) ; <nl> } <nl> - new_value - > append ( * it ) ; <nl> + merge_out - > new_value . append ( it - > data ( ) , it - > size ( ) ) ; <nl> printDelim = true ; <nl> } <nl> <nl> mmm a / utilities / merge_operators / string_append / stringappend2 . h <nl> ppp b / utilities / merge_operators / string_append / stringappend2 . h <nl> class StringAppendTESTOperator : public MergeOperator { <nl> / / Constructor with delimiter <nl> explicit StringAppendTESTOperator ( char delim_char ) ; <nl> <nl> - virtual bool FullMerge ( const Slice & key , <nl> - const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_sequence , <nl> - std : : string * new_value , <nl> - Logger * logger ) const override ; <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override ; <nl> <nl> virtual bool PartialMergeMulti ( const Slice & key , <nl> const std : : deque < Slice > & operand_list , <nl> mmm a / utilities / options / options_util_test . cc <nl> ppp b / utilities / options / options_util_test . cc <nl> class DummyMergeOperator : public MergeOperator { <nl> DummyMergeOperator ( ) { } <nl> virtual ~ DummyMergeOperator ( ) { } <nl> <nl> - virtual bool FullMerge ( const Slice & key , const Slice * existing_value , <nl> - const std : : deque < std : : string > & operand_list , <nl> - std : : string * new_value , Logger * logger ) const { <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> return false ; <nl> } <nl> <nl> virtual bool PartialMergeMulti ( const Slice & key , <nl> const std : : deque < Slice > & operand_list , <nl> - std : : string * new_value , Logger * logger ) const { <nl> + std : : string * new_value , <nl> + Logger * logger ) const override { <nl> return false ; <nl> } <nl> <nl> - virtual const char * Name ( ) const { return " DummyMergeOperator " ; } <nl> + virtual const char * Name ( ) const override { return " DummyMergeOperator " ; } <nl> } ; <nl> <nl> class DummySliceTransform : public SliceTransform { <nl> mmm a / utilities / ttl / db_ttl_impl . h <nl> ppp b / utilities / ttl / db_ttl_impl . h <nl> class TtlMergeOperator : public MergeOperator { <nl> assert ( env ) ; <nl> } <nl> <nl> - virtual bool FullMerge ( const Slice & key , const Slice * existing_value , <nl> - const std : : deque < std : : string > & operands , <nl> - std : : string * new_value , Logger * logger ) const <nl> - override { <nl> + virtual bool FullMergeV2 ( const MergeOperationInput & merge_in , <nl> + MergeOperationOutput * merge_out ) const override { <nl> const uint32_t ts_len = DBWithTTLImpl : : kTSLength ; <nl> - if ( existing_value & & existing_value - > size ( ) < ts_len ) { <nl> - Log ( InfoLogLevel : : ERROR_LEVEL , logger , <nl> + if ( merge_in . existing_value & & merge_in . existing_value - > size ( ) < ts_len ) { <nl> + Log ( InfoLogLevel : : ERROR_LEVEL , merge_in . logger , <nl> " Error : Could not remove timestamp from existing value . " ) ; <nl> return false ; <nl> } <nl> <nl> / / Extract time - stamp from each operand to be passed to user_merge_op_ <nl> - std : : deque < std : : string > operands_without_ts ; <nl> - for ( const auto & operand : operands ) { <nl> + std : : vector < Slice > operands_without_ts ; <nl> + for ( const auto & operand : merge_in . operand_list ) { <nl> if ( operand . size ( ) < ts_len ) { <nl> - Log ( InfoLogLevel : : ERROR_LEVEL , logger , <nl> + Log ( InfoLogLevel : : ERROR_LEVEL , merge_in . logger , <nl> " Error : Could not remove timestamp from operand value . " ) ; <nl> return false ; <nl> } <nl> - operands_without_ts . push_back ( operand . substr ( 0 , operand . size ( ) - ts_len ) ) ; <nl> + operands_without_ts . push_back ( operand ) ; <nl> + operands_without_ts . back ( ) . remove_suffix ( ts_len ) ; <nl> } <nl> <nl> / / Apply the user merge operator ( store result in * new_value ) <nl> bool good = true ; <nl> - if ( existing_value ) { <nl> - Slice existing_value_without_ts ( existing_value - > data ( ) , <nl> - existing_value - > size ( ) - ts_len ) ; <nl> - good = user_merge_op_ - > FullMerge ( key , & existing_value_without_ts , <nl> - operands_without_ts , new_value , logger ) ; <nl> + MergeOperationOutput user_merge_out ( merge_out - > new_value , <nl> + merge_out - > existing_operand ) ; <nl> + if ( merge_in . existing_value ) { <nl> + Slice existing_value_without_ts ( merge_in . existing_value - > data ( ) , <nl> + merge_in . existing_value - > size ( ) - ts_len ) ; <nl> + good = user_merge_op_ - > FullMergeV2 ( <nl> + MergeOperationInput ( merge_in . key , & existing_value_without_ts , <nl> + operands_without_ts , merge_in . logger ) , <nl> + & user_merge_out ) ; <nl> } else { <nl> - good = user_merge_op_ - > FullMerge ( key , nullptr , operands_without_ts , <nl> - new_value , logger ) ; <nl> + good = user_merge_op_ - > FullMergeV2 ( <nl> + MergeOperationInput ( merge_in . key , nullptr , operands_without_ts , <nl> + merge_in . logger ) , <nl> + & user_merge_out ) ; <nl> } <nl> <nl> / / Return false if the user merge operator returned false <nl> class TtlMergeOperator : public MergeOperator { <nl> return false ; <nl> } <nl> <nl> + if ( merge_out - > existing_operand . data ( ) ) { <nl> + merge_out - > new_value . assign ( merge_out - > existing_operand . data ( ) , <nl> + merge_out - > existing_operand . size ( ) ) ; <nl> + merge_out - > existing_operand = Slice ( nullptr , 0 ) ; <nl> + } <nl> + <nl> / / Augment the * new_value with the ttl time - stamp <nl> int64_t curtime ; <nl> if ( ! env_ - > GetCurrentTime ( & curtime ) . ok ( ) ) { <nl> - Log ( InfoLogLevel : : ERROR_LEVEL , logger , <nl> + Log ( InfoLogLevel : : ERROR_LEVEL , merge_in . logger , <nl> " Error : Could not get current time to be attached internally " <nl> " to the new value . " ) ; <nl> return false ; <nl> } else { <nl> char ts_string [ ts_len ] ; <nl> EncodeFixed32 ( ts_string , ( int32_t ) curtime ) ; <nl> - new_value - > append ( ts_string , ts_len ) ; <nl> + merge_out - > new_value . append ( ts_string , ts_len ) ; <nl> return true ; <nl> } <nl> } <nl> mmm a / utilities / util_merge_operators_test . cc <nl> ppp b / utilities / util_merge_operators_test . cc <nl> class UtilMergeOperatorTest : public testing : : Test { <nl> public : <nl> UtilMergeOperatorTest ( ) { } <nl> <nl> - std : : string FullMerge ( std : : string existing_value , <nl> - std : : deque < std : : string > operands , <nl> - std : : string key = " " ) { <nl> - Slice existing_value_slice ( existing_value ) ; <nl> + std : : string FullMergeV2 ( std : : string existing_value , <nl> + std : : vector < std : : string > operands , <nl> + std : : string key = " " ) { <nl> std : : string result ; <nl> + Slice result_operand ( nullptr , 0 ) ; <nl> + <nl> + Slice existing_value_slice ( existing_value ) ; <nl> + std : : vector < Slice > operands_slice ( operands . begin ( ) , operands . end ( ) ) ; <nl> <nl> - merge_operator_ - > FullMerge ( key , & existing_value_slice , operands , & result , <nl> - nullptr ) ; <nl> + const MergeOperator : : MergeOperationInput merge_in ( <nl> + key , & existing_value_slice , operands_slice , nullptr ) ; <nl> + MergeOperator : : MergeOperationOutput merge_out ( result , result_operand ) ; <nl> + merge_operator_ - > FullMergeV2 ( merge_in , & merge_out ) ; <nl> + <nl> + if ( result_operand . data ( ) ) { <nl> + result . assign ( result_operand . data ( ) , result_operand . size ( ) ) ; <nl> + } <nl> return result ; <nl> } <nl> <nl> - std : : string FullMerge ( std : : deque < std : : string > operands , <nl> - std : : string key = " " ) { <nl> + std : : string FullMergeV2 ( std : : vector < std : : string > operands , <nl> + std : : string key = " " ) { <nl> std : : string result ; <nl> + Slice result_operand ( nullptr , 0 ) ; <nl> + <nl> + std : : vector < Slice > operands_slice ( operands . begin ( ) , operands . end ( ) ) ; <nl> + <nl> + const MergeOperator : : MergeOperationInput merge_in ( key , nullptr , <nl> + operands_slice , nullptr ) ; <nl> + MergeOperator : : MergeOperationOutput merge_out ( result , result_operand ) ; <nl> + merge_operator_ - > FullMergeV2 ( merge_in , & merge_out ) ; <nl> <nl> - merge_operator_ - > FullMerge ( key , nullptr , operands , & result , nullptr ) ; <nl> + if ( result_operand . data ( ) ) { <nl> + result . assign ( result_operand . data ( ) , result_operand . size ( ) ) ; <nl> + } <nl> return result ; <nl> } <nl> <nl> class UtilMergeOperatorTest : public testing : : Test { <nl> TEST_F ( UtilMergeOperatorTest , MaxMergeOperator ) { <nl> merge_operator_ = MergeOperators : : CreateMaxOperator ( ) ; <nl> <nl> - EXPECT_EQ ( " B " , FullMerge ( " B " , { " A " } ) ) ; <nl> - EXPECT_EQ ( " B " , FullMerge ( " A " , { " B " } ) ) ; <nl> - EXPECT_EQ ( " " , FullMerge ( { " " , " " , " " } ) ) ; <nl> - EXPECT_EQ ( " A " , FullMerge ( { " A " } ) ) ; <nl> - EXPECT_EQ ( " ABC " , FullMerge ( { " ABC " } ) ) ; <nl> - EXPECT_EQ ( " Z " , FullMerge ( { " ABC " , " Z " , " C " , " AXX " } ) ) ; <nl> - EXPECT_EQ ( " ZZZ " , FullMerge ( { " ABC " , " CC " , " Z " , " ZZZ " } ) ) ; <nl> - EXPECT_EQ ( " a " , FullMerge ( " a " , { " ABC " , " CC " , " Z " , " ZZZ " } ) ) ; <nl> + EXPECT_EQ ( " B " , FullMergeV2 ( " B " , { " A " } ) ) ; <nl> + EXPECT_EQ ( " B " , FullMergeV2 ( " A " , { " B " } ) ) ; <nl> + EXPECT_EQ ( " " , FullMergeV2 ( { " " , " " , " " } ) ) ; <nl> + EXPECT_EQ ( " A " , FullMergeV2 ( { " A " } ) ) ; <nl> + EXPECT_EQ ( " ABC " , FullMergeV2 ( { " ABC " } ) ) ; <nl> + EXPECT_EQ ( " Z " , FullMergeV2 ( { " ABC " , " Z " , " C " , " AXX " } ) ) ; <nl> + EXPECT_EQ ( " ZZZ " , FullMergeV2 ( { " ABC " , " CC " , " Z " , " ZZZ " } ) ) ; <nl> + EXPECT_EQ ( " a " , FullMergeV2 ( " a " , { " ABC " , " CC " , " Z " , " ZZZ " } ) ) ; <nl> <nl> EXPECT_EQ ( " z " , PartialMergeMulti ( { " a " , " z " , " efqfqwgwew " , " aaz " , " hhhhh " } ) ) ; <nl> <nl>
Introduce FullMergeV2 ( eliminate memcpy from merge operators )
facebook/rocksdb
68a8e6b8fa67df745221e23ea5af12393f35ce77
2016-07-20T16:49:03Z
mmm a / test / test_jit . py <nl> ppp b / test / test_jit . py <nl> def beam ( x , h , c , embed , w_xi , w_xf , w_xo , w_xc , w_hi , w_hf , w_ho , w_hc , <nl> c = c_t . index_select ( 1 , pre_y ) <nl> iter = int ( iter_count [ 0 ] ) <nl> idx = torch . cat ( [ idx . narrow ( 2 , 0 , iter ) . index_select ( 1 , pre_y ) , <nl> - torch . fmod ( idx_t , vocab_size ) . unsqueeze ( - 1 ) , <nl> - idx . narrow ( 2 , iter , max_len - iter ) ] , 2 ) <nl> + torch . fmod ( idx_t , vocab_size ) . unsqueeze ( - 1 ) , <nl> + idx . narrow ( 2 , iter , max_len - iter ) ] , 2 ) <nl> idx = idx . narrow ( 2 , 0 , max_len ) <nl> return idx <nl> <nl> def stuff3 ( x ) : <nl> return torch . ones ( x ) , x <nl> self . checkScript ( stuff3 , ( [ 3 , 2 ] , ) ) <nl> <nl> + # to avoid defining sum_list in multiple tests <nl> + def get_sum_list_fn ( self ) : <nl> + def sum_list ( a ) : <nl> + # type : ( List [ int ] ) - > int <nl> + sum = 0 <nl> + for i in a : <nl> + sum + = i <nl> + <nl> + return sum <nl> + <nl> + return sum_list <nl> + <nl> + def test_sum_list_diff_elms ( self ) : <nl> + self . checkScript ( self . get_sum_list_fn ( ) , ( [ 1 , 2 , 3 , 4 , 5 ] , ) ) <nl> + <nl> + def test_sum_list_empty ( self ) : <nl> + self . checkScript ( self . get_sum_list_fn ( ) , ( [ ] , ) ) <nl> + <nl> + def test_sum_list_one ( self ) : <nl> + self . checkScript ( self . get_sum_list_fn ( ) , ( [ 1 ] , ) ) <nl> + <nl> + def test_sum_list_literal ( self ) : <nl> + <nl> + def sum_list ( ) : <nl> + # type : ( ) - > int <nl> + sum = 0 <nl> + for i in [ 1 , 2 , 3 , 4 , 5 ] : <nl> + sum + = i <nl> + <nl> + return sum <nl> + <nl> + self . checkScript ( sum_list , ( ) ) <nl> + <nl> + def test_sum_list_wrong_type ( self ) : <nl> + <nl> + with self . assertRaisesRegex ( RuntimeError , " cannot be used as a tuple " ) : <nl> + @ torch . jit . script <nl> + def sum_list ( a ) : <nl> + # type : ( int ) - > int <nl> + sum = 0 <nl> + for i in a : <nl> + sum + = i <nl> + <nl> + return sum <nl> + <nl> + sum_list ( 1 ) <nl> + <nl> def test_bool_list_io ( self ) : <nl> @ torch . jit . script <nl> def stuff4 ( x ) : <nl> mmm a / torch / csrc / jit / script / compiler . cpp <nl> ppp b / torch / csrc / jit / script / compiler . cpp <nl> struct to_ir { <nl> c10 : : optional < Expr > max_trip_count , <nl> c10 : : optional < Expr > cond , <nl> const List < Stmt > & body , <nl> - c10 : : optional < Ident > itr_ident ) { <nl> + c10 : : optional < Ident > itr_ident , <nl> + bool in_list = false ) { <nl> Node * n = graph - > insertNode ( create ( prim : : Loop , range , 0 ) ) ; <nl> Value * max_trip_count_val , * cond_val ; <nl> { <nl> WithInsertPoint guard ( n ) ; <nl> if ( max_trip_count ) { <nl> - max_trip_count_val = ensureInt ( <nl> - max_trip_count - > range ( ) , emitExpr ( max_trip_count . value ( ) ) ) ; <nl> + if ( in_list ) { <nl> + auto listArg = emitExpr ( max_trip_count . value ( ) ) ; <nl> + <nl> + max_trip_count_val = emitBuiltinCall ( <nl> + max_trip_count - > range ( ) , <nl> + * graph , <nl> + aten : : len , <nl> + c10 : : nullopt , <nl> + { listArg } , <nl> + { } , <nl> + / * required = * / true ) ; <nl> + } else { <nl> + max_trip_count_val = ensureInt ( <nl> + max_trip_count - > range ( ) , emitExpr ( max_trip_count . value ( ) ) ) ; <nl> + } <nl> } else { <nl> max_trip_count_val = materializeConstant ( <nl> std : : numeric_limits < int64_t > : : max ( ) , <nl> struct to_ir { <nl> <nl> { <nl> pushFrame ( body_block ) ; <nl> + WithInsertPoint guard ( body_block ) ; <nl> if ( itr_ident ) { <nl> + if ( in_list ) { <nl> + / / set user ' s iterator variable to the current element <nl> + auto listArg = emitExpr ( max_trip_count . value ( ) ) ; <nl> + trip_count = emitBuiltinCall ( <nl> + max_trip_count - > range ( ) , <nl> + * graph , <nl> + aten : : select , <nl> + c10 : : nullopt , <nl> + { listArg , trip_count } , <nl> + { } , <nl> + / * required = * / true ) ; <nl> + } <nl> environment_stack - > setVar ( <nl> itr_ident - > range ( ) , itr_ident - > name ( ) , trip_count ) ; <nl> } <nl> - WithInsertPoint guard ( body_block ) ; <nl> emitStatements ( body ) ; <nl> <nl> / / Also emit the conditional <nl> struct to_ir { <nl> / / it isn ' t a range ( < expr > ) loop , treat it as a sugared value that maybe can <nl> / / be unrolled <nl> auto sv = emitSugaredExpr ( itrs [ 0 ] , 1 ) ; <nl> + / / check if a value is simple and list - like <nl> + if ( auto siv = std : : dynamic_pointer_cast < SimpleValue > ( sv ) ) { <nl> + if ( siv - > getValue ( ) - > type ( ) - > kind ( ) = = TypeKind : : ListType ) { <nl> + return emitLoopCommon ( <nl> + stmt . range ( ) , { itrs [ 0 ] } , { } , body , { target } , true ) ; <nl> + } <nl> + } <nl> auto instances = sv - > asTuple ( stmt . range ( ) , method ) ; <nl> const std : : string & target_name = target . name ( ) ; <nl> pushFrame ( environment_stack - > block ( ) ) ; <nl> struct to_ir { <nl> auto value_trees = dl . value_inputs ( ) . tree ( ) - > trees ( ) ; <nl> AT_ASSERT ( key_trees . size ( ) = = value_trees . size ( ) ) ; <nl> std : : vector < Value * > keys , values ; <nl> - for ( size_t i = 0 ; i < key_trees . size ( ) ; + + i ) { <nl> + for ( size_t i = 0 ; i < key_trees . size ( ) ; + + i ) { <nl> keys . push_back ( emitExpr ( Expr ( key_trees [ i ] ) ) ) ; <nl> values . push_back ( emitExpr ( Expr ( value_trees [ i ] ) ) ) ; <nl> } <nl> struct to_ir { <nl> } <nl> AT_ASSERT ( key_type ! = nullptr & & value_type ! = nullptr ) ; <nl> <nl> - return graph - > insertNode ( graph - > createDict ( key_type , value_type , keys , values ) ) - > output ( ) ; <nl> + return graph <nl> + - > insertNode ( graph - > createDict ( key_type , value_type , keys , values ) ) <nl> + - > output ( ) ; <nl> } break ; <nl> default : <nl> throw ErrorReport ( tree ) < < " Cannot emit expr for : " < < tree ; <nl>
Add support for simpler for - in - list + tests ( )
pytorch/pytorch
82b269060c6937f3deee1a57e6db60dd41f27a61
2019-02-15T19:41:20Z
mmm a / include / grpc / impl / codegen / grpc_types . h <nl> ppp b / include / grpc / impl / codegen / grpc_types . h <nl> typedef enum grpc_call_error { <nl> <nl> / * * A single metadata element * / <nl> typedef struct grpc_metadata { <nl> + / * the key , value values are expected to line up with grpc_mdelem : if changing <nl> + them , update metadata . h at the same time . * / <nl> grpc_slice key ; <nl> grpc_slice value ; <nl> + <nl> uint32_t flags ; <nl> <nl> / * * The following fields are reserved for grpc internal use . <nl> mmm a / src / core / ext / lb_policy / grpclb / grpclb . c <nl> ppp b / src / core / ext / lb_policy / grpclb / grpclb . c <nl> static bool is_server_valid ( const grpc_grpclb_server * server , size_t idx , <nl> <nl> / * vtable for LB tokens in grpc_lb_addresses . * / <nl> static void * lb_token_copy ( void * token ) { <nl> - return token = = NULL ? NULL : GRPC_MDELEM_REF ( ( grpc_mdelem ) { token } ) . payload ; <nl> + return token = = NULL <nl> + ? NULL <nl> + : ( void * ) GRPC_MDELEM_REF ( ( grpc_mdelem ) { ( uintptr_t ) token } ) . payload ; <nl> } <nl> static void lb_token_destroy ( grpc_exec_ctx * exec_ctx , void * token ) { <nl> - if ( token ! = NULL ) GRPC_MDELEM_UNREF ( exec_ctx , ( grpc_mdelem ) { token } ) ; <nl> + if ( token ! = NULL ) { <nl> + GRPC_MDELEM_UNREF ( exec_ctx , ( grpc_mdelem ) { ( uintptr_t ) token } ) ; <nl> + } <nl> } <nl> static int lb_token_cmp ( void * token1 , void * token2 ) { <nl> if ( token1 > token2 ) return 1 ; <nl> static grpc_lb_addresses * process_serverlist_locked ( <nl> strnlen ( server - > load_balance_token , lb_token_max_length ) ; <nl> grpc_slice lb_token_mdstr = grpc_slice_from_copied_buffer ( <nl> server - > load_balance_token , lb_token_length ) ; <nl> - user_data = <nl> - grpc_mdelem_from_slices ( exec_ctx , GRPC_MDSTR_LB_TOKEN , lb_token_mdstr ) <nl> - . payload ; <nl> + user_data = ( void * ) grpc_mdelem_from_slices ( exec_ctx , GRPC_MDSTR_LB_TOKEN , <nl> + lb_token_mdstr ) <nl> + . payload ; <nl> } else { <nl> char * uri = grpc_sockaddr_to_uri ( & addr ) ; <nl> gpr_log ( GPR_INFO , <nl> static grpc_lb_addresses * process_serverlist_locked ( <nl> " be used instead " , <nl> uri ) ; <nl> gpr_free ( uri ) ; <nl> - user_data = GRPC_MDELEM_LB_TOKEN_EMPTY . payload ; <nl> + user_data = ( void * ) GRPC_MDELEM_LB_TOKEN_EMPTY . payload ; <nl> } <nl> <nl> grpc_lb_addresses_set_address ( lb_addresses , addr_idx , & addr . addr , addr . len , <nl> mmm a / src / core / lib / slice / slice_intern . c <nl> ppp b / src / core / lib / slice / slice_intern . c <nl> void grpc_slice_static_intern ( grpc_slice * slice ) { <nl> } <nl> } <nl> <nl> + bool grpc_slice_is_interned ( grpc_slice slice ) { <nl> + return ( slice . refcount & & slice . refcount - > vtable = = & interned_slice_vtable ) | | <nl> + grpc_is_static_metadata_string ( slice ) ; <nl> + } <nl> + <nl> grpc_slice grpc_slice_intern ( grpc_slice slice ) { <nl> if ( grpc_is_static_metadata_string ( slice ) ) { <nl> return slice ; <nl> mmm a / src / core / lib / slice / slice_internal . h <nl> ppp b / src / core / lib / slice / slice_internal . h <nl> void grpc_slice_buffer_reset_and_unref_internal ( grpc_exec_ctx * exec_ctx , <nl> void grpc_slice_buffer_destroy_internal ( grpc_exec_ctx * exec_ctx , <nl> grpc_slice_buffer * sb ) ; <nl> <nl> + / * Check if a slice is interned * / <nl> + bool grpc_slice_is_interned ( grpc_slice slice ) ; <nl> + <nl> void grpc_slice_intern_init ( void ) ; <nl> void grpc_slice_intern_shutdown ( void ) ; <nl> void grpc_test_only_set_slice_hash_seed ( uint32_t key ) ; <nl> mmm a / src / core / lib / transport / metadata . c <nl> ppp b / src / core / lib / transport / metadata . c <nl> <nl> <nl> typedef void ( * destroy_user_data_func ) ( void * user_data ) ; <nl> <nl> - / * Shadow structure for grpc_mdelem_data for non - static elements * / <nl> - typedef struct internal_metadata { <nl> - / * must be byte compatible with grpc_mdelem * / <nl> + / * Shadow structure for grpc_mdelem_data for interned elements * / <nl> + typedef struct interned_metadata { <nl> + / * must be byte compatible with grpc_mdelem_data * / <nl> grpc_slice key ; <nl> grpc_slice value ; <nl> <nl> typedef struct internal_metadata { <nl> gpr_atm destroy_user_data ; <nl> gpr_atm user_data ; <nl> <nl> - struct internal_metadata * bucket_next ; <nl> - } internal_metadata ; <nl> + struct interned_metadata * bucket_next ; <nl> + } interned_metadata ; <nl> + <nl> + / * Shadow structure for grpc_mdelem_data for allocated elements * / <nl> + typedef struct allocated_metadata { <nl> + / * must be byte compatible with grpc_mdelem_data * / <nl> + grpc_slice key ; <nl> + grpc_slice value ; <nl> + <nl> + / * private only data * / <nl> + gpr_atm refcnt ; <nl> + } allocated_metadata ; <nl> <nl> typedef struct mdtab_shard { <nl> gpr_mu mu ; <nl> - internal_metadata * * elems ; <nl> + interned_metadata * * elems ; <nl> size_t count ; <nl> size_t capacity ; <nl> / * * Estimate of the number of unreferenced mdelems in the hash table . <nl> void grpc_mdctx_global_shutdown ( grpc_exec_ctx * exec_ctx ) { <nl> } <nl> <nl> static int is_mdelem_static ( grpc_mdelem e ) { <nl> - return e . payload > = & grpc_static_mdelem_table [ 0 ] & & <nl> - e . payload < & grpc_static_mdelem_table [ GRPC_STATIC_MDELEM_COUNT ] ; <nl> + return GRPC_MDELEM_DATA ( e ) > = & grpc_static_mdelem_table [ 0 ] & & <nl> + GRPC_MDELEM_DATA ( e ) < <nl> + & grpc_static_mdelem_table [ GRPC_STATIC_MDELEM_COUNT ] ; <nl> } <nl> <nl> static void ref_md_locked ( mdtab_shard * shard , <nl> - internal_metadata * md DEBUG_ARGS ) { <nl> + interned_metadata * md DEBUG_ARGS ) { <nl> # ifdef GRPC_METADATA_REFCOUNT_DEBUG <nl> gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> " ELM REF : % p : % zu - > % zu : ' % s ' = ' % s ' " , ( void * ) md , <nl> static void ref_md_locked ( mdtab_shard * shard , <nl> <nl> static void gc_mdtab ( grpc_exec_ctx * exec_ctx , mdtab_shard * shard ) { <nl> size_t i ; <nl> - internal_metadata * * prev_next ; <nl> - internal_metadata * md , * next ; <nl> + interned_metadata * * prev_next ; <nl> + interned_metadata * md , * next ; <nl> gpr_atm num_freed = 0 ; <nl> <nl> GPR_TIMER_BEGIN ( " gc_mdtab " , 0 ) ; <nl> static void gc_mdtab ( grpc_exec_ctx * exec_ctx , mdtab_shard * shard ) { <nl> static void grow_mdtab ( mdtab_shard * shard ) { <nl> size_t capacity = shard - > capacity * 2 ; <nl> size_t i ; <nl> - internal_metadata * * mdtab ; <nl> - internal_metadata * md , * next ; <nl> + interned_metadata * * mdtab ; <nl> + interned_metadata * md , * next ; <nl> uint32_t hash ; <nl> <nl> GPR_TIMER_BEGIN ( " grow_mdtab " , 0 ) ; <nl> <nl> - mdtab = gpr_malloc ( sizeof ( internal_metadata * ) * capacity ) ; <nl> - memset ( mdtab , 0 , sizeof ( internal_metadata * ) * capacity ) ; <nl> + mdtab = gpr_malloc ( sizeof ( interned_metadata * ) * capacity ) ; <nl> + memset ( mdtab , 0 , sizeof ( interned_metadata * ) * capacity ) ; <nl> <nl> for ( i = 0 ; i < shard - > capacity ; i + + ) { <nl> for ( md = shard - > elems [ i ] ; md ; md = next ) { <nl> static void rehash_mdtab ( grpc_exec_ctx * exec_ctx , mdtab_shard * shard ) { <nl> } <nl> } <nl> <nl> - grpc_mdelem grpc_mdelem_from_slices ( grpc_exec_ctx * exec_ctx , grpc_slice key , <nl> - grpc_slice value ) { <nl> - grpc_slice_static_intern ( & key ) ; <nl> - grpc_slice_static_intern ( & value ) ; <nl> + grpc_mdelem grpc_mdelem_create ( <nl> + grpc_exec_ctx * exec_ctx , grpc_slice key , grpc_slice value , <nl> + grpc_mdelem_data * compatible_external_backing_store ) { <nl> + if ( ! grpc_slice_is_interned ( key ) | | ! grpc_slice_is_interned ( value ) ) { <nl> + if ( compatible_external_backing_store ! = NULL ) { <nl> + return GRPC_MAKE_MDELEM ( compatible_external_backing_store , <nl> + GRPC_MDELEM_STORAGE_EXTERNAL ) ; <nl> + } <nl> + <nl> + allocated_metadata * allocated = gpr_malloc ( sizeof ( * allocated ) ) ; <nl> + allocated - > key = grpc_slice_ref_internal ( key ) ; <nl> + allocated - > value = grpc_slice_ref_internal ( value ) ; <nl> + gpr_atm_rel_store ( & allocated - > refcnt , 1 ) ; <nl> + return GRPC_MAKE_MDELEM ( allocated , GRPC_MDELEM_STORAGE_ALLOCATED ) ; <nl> + } <nl> <nl> grpc_mdelem static_elem = grpc_static_mdelem_for_static_strings ( <nl> grpc_static_metadata_index ( key ) , grpc_static_metadata_index ( value ) ) ; <nl> grpc_mdelem grpc_mdelem_from_slices ( grpc_exec_ctx * exec_ctx , grpc_slice key , <nl> <nl> uint32_t hash = <nl> GRPC_MDSTR_KV_HASH ( grpc_slice_hash ( key ) , grpc_slice_hash ( value ) ) ; <nl> - internal_metadata * md ; <nl> + interned_metadata * md ; <nl> mdtab_shard * shard = & g_shards [ SHARD_IDX ( hash ) ] ; <nl> size_t idx ; <nl> <nl> grpc_mdelem grpc_mdelem_from_slices ( grpc_exec_ctx * exec_ctx , grpc_slice key , <nl> grpc_slice_cmp ( value , md - > value ) = = 0 ) { <nl> REF_MD_LOCKED ( shard , md ) ; <nl> gpr_mu_unlock ( & shard - > mu ) ; <nl> - grpc_slice_unref_internal ( exec_ctx , key ) ; <nl> - grpc_slice_unref_internal ( exec_ctx , value ) ; <nl> GPR_TIMER_END ( " grpc_mdelem_from_metadata_strings " , 0 ) ; <nl> - return ( grpc_mdelem ) { ( grpc_mdelem_data * ) md } ; <nl> + return GRPC_MAKE_MDELEM ( md , GRPC_MDELEM_STORAGE_INTERNED ) ; <nl> } <nl> } <nl> <nl> / * not found : create a new pair * / <nl> - md = gpr_malloc ( sizeof ( internal_metadata ) ) ; <nl> + md = gpr_malloc ( sizeof ( interned_metadata ) ) ; <nl> gpr_atm_rel_store ( & md - > refcnt , 1 ) ; <nl> - md - > key = key ; <nl> - md - > value = value ; <nl> + md - > key = grpc_slice_ref_internal ( key ) ; <nl> + md - > value = grpc_slice_ref_internal ( value ) ; <nl> md - > user_data = 0 ; <nl> md - > destroy_user_data = 0 ; <nl> md - > bucket_next = shard - > elems [ idx ] ; <nl> grpc_mdelem grpc_mdelem_from_slices ( grpc_exec_ctx * exec_ctx , grpc_slice key , <nl> <nl> GPR_TIMER_END ( " grpc_mdelem_from_metadata_strings " , 0 ) ; <nl> <nl> - return ( grpc_mdelem ) { ( grpc_mdelem_data * ) md } ; <nl> + return GRPC_MAKE_MDELEM ( md , GRPC_MDELEM_STORAGE_INTERNED ) ; <nl> + } <nl> + <nl> + grpc_mdelem grpc_mdelem_from_slices ( grpc_exec_ctx * exec_ctx , grpc_slice key , <nl> + grpc_slice value ) { <nl> + grpc_mdelem out = grpc_mdelem_create ( exec_ctx , key , value , NULL ) ; <nl> + grpc_slice_unref_internal ( exec_ctx , key ) ; <nl> + grpc_slice_unref_internal ( exec_ctx , value ) ; <nl> + return out ; <nl> + } <nl> + <nl> + grpc_mdelem grpc_mdelem_from_grpc_metadata ( grpc_exec_ctx * exec_ctx , <nl> + grpc_metadata * metadata ) { <nl> + return grpc_mdelem_create ( exec_ctx , metadata - > key , metadata - > value , <nl> + ( grpc_mdelem_data * ) metadata ) ; <nl> } <nl> <nl> static size_t get_base64_encoded_size ( size_t raw_length ) { <nl> size_t grpc_mdelem_get_size_in_hpack_table ( grpc_mdelem elem ) { <nl> } <nl> <nl> grpc_mdelem grpc_mdelem_ref ( grpc_mdelem gmd DEBUG_ARGS ) { <nl> - if ( gmd . payload = = NULL | | is_mdelem_static ( gmd ) ) return gmd ; <nl> - internal_metadata * md = ( internal_metadata * ) gmd . payload ; <nl> + switch ( GRPC_MDELEM_STORAGE ( gmd ) ) { <nl> + case GRPC_MDELEM_STORAGE_EXTERNAL : <nl> + case GRPC_MDELEM_STORAGE_STATIC : <nl> + break ; <nl> + case GRPC_MDELEM_STORAGE_INTERNED : { <nl> + interned_metadata * md = ( interned_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> # ifdef GRPC_METADATA_REFCOUNT_DEBUG <nl> - gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> - " ELM REF : % p : % zu - > % zu : ' % s ' = ' % s ' " , ( void * ) md , <nl> - gpr_atm_no_barrier_load ( & md - > refcnt ) , <nl> - gpr_atm_no_barrier_load ( & md - > refcnt ) + 1 , <nl> - grpc_mdstr_as_c_string ( ( grpc_slice ) md - > key ) , <nl> - grpc_mdstr_as_c_string ( ( grpc_slice ) md - > value ) ) ; <nl> + gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> + " ELM REF : % p : % zu - > % zu : ' % s ' = ' % s ' " , ( void * ) md , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) + 1 , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > key ) , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > value ) ) ; <nl> + # endif <nl> + / * we can assume the ref count is > = 1 as the application is calling <nl> + this function - meaning that no adjustment to mdtab_free is necessary , <nl> + simplifying the logic here to be just an atomic increment * / <nl> + / * use C assert to have this removed in opt builds * / <nl> + GPR_ASSERT ( gpr_atm_no_barrier_load ( & md - > refcnt ) > = 1 ) ; <nl> + gpr_atm_no_barrier_fetch_add ( & md - > refcnt , 1 ) ; <nl> + break ; <nl> + } <nl> + case GRPC_MDELEM_STORAGE_ALLOCATED : { <nl> + allocated_metadata * md = ( allocated_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> + # ifdef GRPC_METADATA_REFCOUNT_DEBUG <nl> + gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> + " ELM REF : % p : % zu - > % zu : ' % s ' = ' % s ' " , ( void * ) md , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) + 1 , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > key ) , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > value ) ) ; <nl> # endif <nl> - / * we can assume the ref count is > = 1 as the application is calling <nl> - this function - meaning that no adjustment to mdtab_free is necessary , <nl> - simplifying the logic here to be just an atomic increment * / <nl> - / * use C assert to have this removed in opt builds * / <nl> - GPR_ASSERT ( gpr_atm_no_barrier_load ( & md - > refcnt ) > = 1 ) ; <nl> - gpr_atm_no_barrier_fetch_add ( & md - > refcnt , 1 ) ; <nl> + / * we can assume the ref count is > = 1 as the application is calling <nl> + this function - meaning that no adjustment to mdtab_free is necessary , <nl> + simplifying the logic here to be just an atomic increment * / <nl> + / * use C assert to have this removed in opt builds * / <nl> + gpr_atm_no_barrier_fetch_add ( & md - > refcnt , 1 ) ; <nl> + break ; <nl> + } <nl> + } <nl> return gmd ; <nl> } <nl> <nl> void grpc_mdelem_unref ( grpc_exec_ctx * exec_ctx , grpc_mdelem gmd DEBUG_ARGS ) { <nl> - if ( gmd . payload = = NULL | | is_mdelem_static ( gmd ) ) return ; <nl> - internal_metadata * md = ( internal_metadata * ) gmd . payload ; <nl> + switch ( GRPC_MDELEM_STORAGE ( gmd ) ) { <nl> + case GRPC_MDELEM_STORAGE_EXTERNAL : <nl> + case GRPC_MDELEM_STORAGE_STATIC : <nl> + break ; <nl> + case GRPC_MDELEM_STORAGE_INTERNED : { <nl> + interned_metadata * md = ( interned_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> # ifdef GRPC_METADATA_REFCOUNT_DEBUG <nl> - gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> - " ELM UNREF : % p : % zu - > % zu : ' % s ' = ' % s ' " , ( void * ) md , <nl> - gpr_atm_no_barrier_load ( & md - > refcnt ) , <nl> - gpr_atm_no_barrier_load ( & md - > refcnt ) - 1 , <nl> - grpc_mdstr_as_c_string ( ( grpc_slice ) md - > key ) , <nl> - grpc_mdstr_as_c_string ( ( grpc_slice ) md - > value ) ) ; <nl> + gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> + " ELM UNREF : % p : % zu - > % zu : ' % s ' = ' % s ' " , ( void * ) md , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) - 1 , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > key ) , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > value ) ) ; <nl> # endif <nl> - uint32_t hash = <nl> - GRPC_MDSTR_KV_HASH ( grpc_slice_hash ( md - > key ) , grpc_slice_hash ( md - > value ) ) ; <nl> - const gpr_atm prev_refcount = gpr_atm_full_fetch_add ( & md - > refcnt , - 1 ) ; <nl> - GPR_ASSERT ( prev_refcount > = 1 ) ; <nl> - if ( 1 = = prev_refcount ) { <nl> - / * once the refcount hits zero , some other thread can come along and <nl> - free md at any time : it ' s unsafe from this point on to access it * / <nl> - mdtab_shard * shard = & g_shards [ SHARD_IDX ( hash ) ] ; <nl> - gpr_atm_no_barrier_fetch_add ( & shard - > free_estimate , 1 ) ; <nl> + uint32_t hash = GRPC_MDSTR_KV_HASH ( grpc_slice_hash ( md - > key ) , <nl> + grpc_slice_hash ( md - > value ) ) ; <nl> + const gpr_atm prev_refcount = gpr_atm_full_fetch_add ( & md - > refcnt , - 1 ) ; <nl> + GPR_ASSERT ( prev_refcount > = 1 ) ; <nl> + if ( 1 = = prev_refcount ) { <nl> + / * once the refcount hits zero , some other thread can come along and <nl> + free md at any time : it ' s unsafe from this point on to access it * / <nl> + mdtab_shard * shard = & g_shards [ SHARD_IDX ( hash ) ] ; <nl> + gpr_atm_no_barrier_fetch_add ( & shard - > free_estimate , 1 ) ; <nl> + } <nl> + break ; <nl> + } <nl> + case GRPC_MDELEM_STORAGE_ALLOCATED : { <nl> + allocated_metadata * md = ( allocated_metadata * ) GRPC_MDELEM_DATA ( gmd ) ; <nl> + # ifdef GRPC_METADATA_REFCOUNT_DEBUG <nl> + gpr_log ( file , line , GPR_LOG_SEVERITY_DEBUG , <nl> + " ELM UNREF : % p : % zu - > % zu : ' % s ' = ' % s ' " , ( void * ) md , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) , <nl> + gpr_atm_no_barrier_load ( & md - > refcnt ) - 1 , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > key ) , <nl> + grpc_mdstr_as_c_string ( ( grpc_slice ) md - > value ) ) ; <nl> + # endif <nl> + const gpr_atm prev_refcount = gpr_atm_full_fetch_add ( & md - > refcnt , - 1 ) ; <nl> + GPR_ASSERT ( prev_refcount > = 1 ) ; <nl> + if ( 1 = = prev_refcount ) { <nl> + grpc_slice_unref_internal ( exec_ctx , md - > key ) ; <nl> + grpc_slice_unref_internal ( exec_ctx , md - > value ) ; <nl> + gpr_free ( md ) ; <nl> + } <nl> + break ; <nl> + } <nl> } <nl> } <nl> <nl> void * grpc_mdelem_get_user_data ( grpc_mdelem md , void ( * destroy_func ) ( void * ) ) { <nl> - internal_metadata * im = ( internal_metadata * ) md . payload ; <nl> - void * result ; <nl> - if ( is_mdelem_static ( md ) ) { <nl> - return ( void * ) <nl> - grpc_static_mdelem_user_data [ md . payload - grpc_static_mdelem_table ] ; <nl> - } <nl> - if ( gpr_atm_acq_load ( & im - > destroy_user_data ) = = ( gpr_atm ) destroy_func ) { <nl> - return ( void * ) gpr_atm_no_barrier_load ( & im - > user_data ) ; <nl> - } else { <nl> - return NULL ; <nl> + switch ( GRPC_MDELEM_STORAGE ( md ) ) { <nl> + case GRPC_MDELEM_STORAGE_EXTERNAL : <nl> + case GRPC_MDELEM_STORAGE_ALLOCATED : <nl> + return NULL ; <nl> + case GRPC_MDELEM_STORAGE_STATIC : <nl> + return ( void * ) grpc_static_mdelem_user_data [ GRPC_MDELEM_DATA ( md ) - <nl> + grpc_static_mdelem_table ] ; <nl> + case GRPC_MDELEM_STORAGE_INTERNED : { <nl> + interned_metadata * im = ( interned_metadata * ) GRPC_MDELEM_DATA ( md ) ; <nl> + void * result ; <nl> + if ( gpr_atm_acq_load ( & im - > destroy_user_data ) = = ( gpr_atm ) destroy_func ) { <nl> + return ( void * ) gpr_atm_no_barrier_load ( & im - > user_data ) ; <nl> + } else { <nl> + return NULL ; <nl> + } <nl> + return result ; <nl> + } <nl> } <nl> - return result ; <nl> + GPR_UNREACHABLE_CODE ( return NULL ) ; <nl> } <nl> <nl> void * grpc_mdelem_set_user_data ( grpc_mdelem md , void ( * destroy_func ) ( void * ) , <nl> void * user_data ) { <nl> - internal_metadata * im = ( internal_metadata * ) md . payload ; <nl> - GPR_ASSERT ( ! is_mdelem_static ( md ) ) ; <nl> - GPR_ASSERT ( ( user_data = = NULL ) = = ( destroy_func = = NULL ) ) ; <nl> - gpr_mu_lock ( & im - > mu_user_data ) ; <nl> - if ( gpr_atm_no_barrier_load ( & im - > destroy_user_data ) ) { <nl> - / * user data can only be set once * / <nl> - gpr_mu_unlock ( & im - > mu_user_data ) ; <nl> - if ( destroy_func ! = NULL ) { <nl> + switch ( GRPC_MDELEM_STORAGE ( md ) ) { <nl> + case GRPC_MDELEM_STORAGE_EXTERNAL : <nl> + case GRPC_MDELEM_STORAGE_ALLOCATED : <nl> destroy_func ( user_data ) ; <nl> + return NULL ; <nl> + case GRPC_MDELEM_STORAGE_STATIC : <nl> + destroy_func ( user_data ) ; <nl> + return ( void * ) grpc_static_mdelem_user_data [ GRPC_MDELEM_DATA ( md ) - <nl> + grpc_static_mdelem_table ] ; <nl> + case GRPC_MDELEM_STORAGE_INTERNED : { <nl> + interned_metadata * im = ( interned_metadata * ) GRPC_MDELEM_DATA ( md ) ; <nl> + GPR_ASSERT ( ! is_mdelem_static ( md ) ) ; <nl> + GPR_ASSERT ( ( user_data = = NULL ) = = ( destroy_func = = NULL ) ) ; <nl> + gpr_mu_lock ( & im - > mu_user_data ) ; <nl> + if ( gpr_atm_no_barrier_load ( & im - > destroy_user_data ) ) { <nl> + / * user data can only be set once * / <nl> + gpr_mu_unlock ( & im - > mu_user_data ) ; <nl> + if ( destroy_func ! = NULL ) { <nl> + destroy_func ( user_data ) ; <nl> + } <nl> + return ( void * ) gpr_atm_no_barrier_load ( & im - > user_data ) ; <nl> + } <nl> + gpr_atm_no_barrier_store ( & im - > user_data , ( gpr_atm ) user_data ) ; <nl> + gpr_atm_rel_store ( & im - > destroy_user_data , ( gpr_atm ) destroy_func ) ; <nl> + gpr_mu_unlock ( & im - > mu_user_data ) ; <nl> + return user_data ; <nl> } <nl> - return ( void * ) gpr_atm_no_barrier_load ( & im - > user_data ) ; <nl> } <nl> - gpr_atm_no_barrier_store ( & im - > user_data , ( gpr_atm ) user_data ) ; <nl> - gpr_atm_rel_store ( & im - > destroy_user_data , ( gpr_atm ) destroy_func ) ; <nl> - gpr_mu_unlock ( & im - > mu_user_data ) ; <nl> - return user_data ; <nl> + GPR_UNREACHABLE_CODE ( return NULL ) ; <nl> } <nl> <nl> bool grpc_mdelem_eq ( grpc_mdelem a , grpc_mdelem b ) { <nl> mmm a / src / core / lib / transport / metadata . h <nl> ppp b / src / core / lib / transport / metadata . h <nl> <nl> # ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_H <nl> # define GRPC_CORE_LIB_TRANSPORT_METADATA_H <nl> <nl> + # include < grpc / grpc . h > <nl> # include < grpc / slice . h > <nl> # include < grpc / support / useful . h > <nl> <nl> extern " C " { <nl> / * Forward declarations * / <nl> typedef struct grpc_mdelem grpc_mdelem ; <nl> <nl> - / * if changing this , make identical changes in internal_metadata in <nl> - metadata . c * / <nl> + / * if changing this , make identical changes in : <nl> + - interned_metadata , allocated_metadata in metadata . c <nl> + - grpc_metadata in grpc_types . h * / <nl> typedef struct grpc_mdelem_data { <nl> const grpc_slice key ; <nl> const grpc_slice value ; <nl> / * there is a private part to this in metadata . c * / <nl> } grpc_mdelem_data ; <nl> <nl> + typedef enum { <nl> + / * memory pointed to by grpc_mdelem : : payload is owned by an external system * / <nl> + GRPC_MDELEM_STORAGE_EXTERNAL = 0 , <nl> + / * memory pointed to by grpc_mdelem : : payload is interned by the metadata <nl> + system * / <nl> + GRPC_MDELEM_STORAGE_INTERNED = 1 , <nl> + / * memory pointed to by grpc_mdelem : : payload is allocated by the metadata <nl> + system * / <nl> + GRPC_MDELEM_STORAGE_ALLOCATED = 2 , <nl> + / * memory is in the static metadata table * / <nl> + GRPC_MDELEM_STORAGE_STATIC = 3 , <nl> + } grpc_mdelem_data_storage ; <nl> + <nl> struct grpc_mdelem { <nl> - grpc_mdelem_data * payload ; <nl> + / * a grpc_mdelem_data * generally , with the two lower bits signalling memory <nl> + ownership as per grpc_mdelem_data_storage * / <nl> + uintptr_t payload ; <nl> } ; <nl> <nl> + # define GRPC_MDELEM_DATA ( md ) \ <nl> + ( ( grpc_mdelem_data * ) ( ( md ) . payload & ~ ( uintptr_t ) 3 ) ) <nl> + # define GRPC_MDELEM_STORAGE ( md ) \ <nl> + ( ( grpc_mdelem_data_storage ) ( ( md ) . payload & ( uintptr_t ) 3 ) ) <nl> + # define GRPC_MAKE_MDELEM ( data , storage ) \ <nl> + ( ( grpc_mdelem ) { ( ( uintptr_t ) ( data ) ) | ( ( uintptr_t ) storage ) } ) <nl> + <nl> / * Unrefs the slices . * / <nl> grpc_mdelem grpc_mdelem_from_slices ( grpc_exec_ctx * exec_ctx , grpc_slice key , <nl> grpc_slice value ) ; <nl> <nl> + / * Cheaply convert a grpc_metadata to a grpc_mdelem ; may use the grpc_metadata <nl> + object as backing storage ( so lifetimes should align ) * / <nl> + grpc_mdelem grpc_mdelem_from_grpc_metadata ( grpc_exec_ctx * exec_ctx , <nl> + grpc_metadata * metadata ) ; <nl> + <nl> + / * Does not unref the slices ; if a new non - interned mdelem is needed , allocates <nl> + one if compatible_external_backing_store is NULL , or uses <nl> + compatible_external_backing_store if it is non - NULL ( in which case it ' s the <nl> + users responsibility to ensure that it outlives usage ) * / <nl> + grpc_mdelem grpc_mdelem_create ( <nl> + grpc_exec_ctx * exec_ctx , grpc_slice key , grpc_slice value , <nl> + grpc_mdelem_data * compatible_external_backing_store ) ; <nl> + <nl> bool grpc_mdelem_eq ( grpc_mdelem a , grpc_mdelem b ) ; <nl> <nl> size_t grpc_mdelem_get_size_in_hpack_table ( grpc_mdelem elem ) ; <nl> grpc_mdelem grpc_mdelem_ref ( grpc_mdelem md ) ; <nl> void grpc_mdelem_unref ( grpc_exec_ctx * exec_ctx , grpc_mdelem md ) ; <nl> # endif <nl> <nl> - # define GRPC_MDKEY ( md ) ( ( md ) . payload - > key ) <nl> - # define GRPC_MDVALUE ( md ) ( ( md ) . payload - > value ) <nl> + # define GRPC_MDKEY ( md ) ( GRPC_MDELEM_DATA ( md ) - > key ) <nl> + # define GRPC_MDVALUE ( md ) ( GRPC_MDELEM_DATA ( md ) - > value ) <nl> <nl> - # define GRPC_MDNULL ( ( grpc_mdelem ) { NULL } ) <nl> - # define GRPC_MDISNULL ( md ) ( ( md ) . payload = = NULL ) <nl> + # define GRPC_MDNULL GRPC_MAKE_MDELEM ( NULL , GRPC_MDELEM_STORAGE_EXTERNAL ) <nl> + # define GRPC_MDISNULL ( md ) ( GRPC_MDELEM_DATA ( md ) = = NULL ) <nl> <nl> / * We add 32 bytes of padding as per RFC - 7540 section 6 . 5 . 2 . * / <nl> # define GRPC_MDELEM_LENGTH ( e ) \ <nl> mmm a / src / core / lib / transport / static_metadata . c <nl> ppp b / src / core / lib / transport / static_metadata . c <nl> grpc_mdelem grpc_static_mdelem_for_static_strings ( int a , int b ) { <nl> uint32_t k = ( uint32_t ) ( a * 98 + b ) ; <nl> uint32_t h = elems_phash ( k ) ; <nl> return elem_keys [ h ] = = k <nl> - ? ( grpc_mdelem ) { & grpc_static_mdelem_table [ elem_idxs [ h ] ] } <nl> + ? GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ elem_idxs [ h ] ] , <nl> + GRPC_MDELEM_STORAGE_STATIC ) <nl> : GRPC_MDNULL ; <nl> } <nl> <nl> mmm a / src / core / lib / transport / static_metadata . h <nl> ppp b / src / core / lib / transport / static_metadata . h <nl> extern grpc_mdelem_data grpc_static_mdelem_table [ GRPC_STATIC_MDELEM_COUNT ] ; <nl> extern uintptr_t grpc_static_mdelem_user_data [ GRPC_STATIC_MDELEM_COUNT ] ; <nl> / * " accept - charset " : " " * / <nl> # define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 0 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 0 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " accept " : " " * / <nl> - # define GRPC_MDELEM_ACCEPT_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 1 ] } ) <nl> + # define GRPC_MDELEM_ACCEPT_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 1 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " accept - encoding " : " " * / <nl> # define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 2 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 2 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " accept - encoding " : " gzip , deflate " * / <nl> # define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 3 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 3 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " accept - language " : " " * / <nl> # define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 4 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 4 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " accept - ranges " : " " * / <nl> # define GRPC_MDELEM_ACCEPT_RANGES_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 5 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 5 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " access - control - allow - origin " : " " * / <nl> # define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 6 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 6 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " age " : " " * / <nl> - # define GRPC_MDELEM_AGE_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 7 ] } ) <nl> + # define GRPC_MDELEM_AGE_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 7 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " allow " : " " * / <nl> - # define GRPC_MDELEM_ALLOW_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 8 ] } ) <nl> + # define GRPC_MDELEM_ALLOW_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 8 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : authority " : " " * / <nl> # define GRPC_MDELEM_AUTHORITY_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 9 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 9 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " authorization " : " " * / <nl> # define GRPC_MDELEM_AUTHORIZATION_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 10 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 10 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " cache - control " : " " * / <nl> # define GRPC_MDELEM_CACHE_CONTROL_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 11 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 11 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - disposition " : " " * / <nl> # define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 12 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 12 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - encoding " : " " * / <nl> # define GRPC_MDELEM_CONTENT_ENCODING_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 13 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 13 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - language " : " " * / <nl> # define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 14 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 14 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - length " : " " * / <nl> # define GRPC_MDELEM_CONTENT_LENGTH_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 15 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 15 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - location " : " " * / <nl> # define GRPC_MDELEM_CONTENT_LOCATION_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 16 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 16 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - range " : " " * / <nl> # define GRPC_MDELEM_CONTENT_RANGE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 17 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 17 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - type " : " application / grpc " * / <nl> # define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 18 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 18 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " content - type " : " " * / <nl> # define GRPC_MDELEM_CONTENT_TYPE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 19 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 19 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " cookie " : " " * / <nl> - # define GRPC_MDELEM_COOKIE_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 20 ] } ) <nl> + # define GRPC_MDELEM_COOKIE_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 20 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " date " : " " * / <nl> - # define GRPC_MDELEM_DATE_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 21 ] } ) <nl> + # define GRPC_MDELEM_DATE_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 21 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " etag " : " " * / <nl> - # define GRPC_MDELEM_ETAG_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 22 ] } ) <nl> + # define GRPC_MDELEM_ETAG_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 22 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " expect " : " " * / <nl> - # define GRPC_MDELEM_EXPECT_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 23 ] } ) <nl> + # define GRPC_MDELEM_EXPECT_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 23 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " expires " : " " * / <nl> - # define GRPC_MDELEM_EXPIRES_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 24 ] } ) <nl> + # define GRPC_MDELEM_EXPIRES_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 24 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " from " : " " * / <nl> - # define GRPC_MDELEM_FROM_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 25 ] } ) <nl> + # define GRPC_MDELEM_FROM_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 25 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - accept - encoding " : " deflate " * / <nl> # define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 26 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 26 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - accept - encoding " : " deflate , gzip " * / <nl> # define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 27 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 27 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - accept - encoding " : " gzip " * / <nl> # define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 28 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 28 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - accept - encoding " : " identity " * / <nl> # define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 29 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 29 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - accept - encoding " : " identity , deflate " * / <nl> # define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 30 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 30 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - accept - encoding " : " identity , deflate , gzip " * / <nl> # define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 31 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 31 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - accept - encoding " : " identity , gzip " * / <nl> # define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 32 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 32 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - encoding " : " deflate " * / <nl> # define GRPC_MDELEM_GRPC_ENCODING_DEFLATE \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 33 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 33 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - encoding " : " gzip " * / <nl> # define GRPC_MDELEM_GRPC_ENCODING_GZIP \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 34 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 34 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - encoding " : " identity " * / <nl> # define GRPC_MDELEM_GRPC_ENCODING_IDENTITY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 35 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 35 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - status " : " 0 " * / <nl> - # define GRPC_MDELEM_GRPC_STATUS_0 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 36 ] } ) <nl> + # define GRPC_MDELEM_GRPC_STATUS_0 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 36 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - status " : " 1 " * / <nl> - # define GRPC_MDELEM_GRPC_STATUS_1 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 37 ] } ) <nl> + # define GRPC_MDELEM_GRPC_STATUS_1 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 37 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " grpc - status " : " 2 " * / <nl> - # define GRPC_MDELEM_GRPC_STATUS_2 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 38 ] } ) <nl> + # define GRPC_MDELEM_GRPC_STATUS_2 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 38 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " host " : " " * / <nl> - # define GRPC_MDELEM_HOST_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 39 ] } ) <nl> + # define GRPC_MDELEM_HOST_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 39 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " if - match " : " " * / <nl> # define GRPC_MDELEM_IF_MATCH_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 40 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 40 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " if - modified - since " : " " * / <nl> # define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 41 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 41 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " if - none - match " : " " * / <nl> # define GRPC_MDELEM_IF_NONE_MATCH_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 42 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 42 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " if - range " : " " * / <nl> # define GRPC_MDELEM_IF_RANGE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 43 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 43 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " if - unmodified - since " : " " * / <nl> # define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 44 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 44 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " last - modified " : " " * / <nl> # define GRPC_MDELEM_LAST_MODIFIED_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 45 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 45 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " lb - cost - bin " : " " * / <nl> # define GRPC_MDELEM_LB_COST_BIN_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 46 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 46 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " lb - token " : " " * / <nl> # define GRPC_MDELEM_LB_TOKEN_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 47 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 47 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " link " : " " * / <nl> - # define GRPC_MDELEM_LINK_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 48 ] } ) <nl> + # define GRPC_MDELEM_LINK_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 48 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " location " : " " * / <nl> # define GRPC_MDELEM_LOCATION_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 49 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 49 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " max - forwards " : " " * / <nl> # define GRPC_MDELEM_MAX_FORWARDS_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 50 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 50 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : method " : " GET " * / <nl> - # define GRPC_MDELEM_METHOD_GET ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 51 ] } ) <nl> + # define GRPC_MDELEM_METHOD_GET \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 51 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : method " : " POST " * / <nl> - # define GRPC_MDELEM_METHOD_POST ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 52 ] } ) <nl> + # define GRPC_MDELEM_METHOD_POST \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 52 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : method " : " PUT " * / <nl> - # define GRPC_MDELEM_METHOD_PUT ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 53 ] } ) <nl> + # define GRPC_MDELEM_METHOD_PUT \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 53 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : path " : " / " * / <nl> - # define GRPC_MDELEM_PATH_SLASH ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 54 ] } ) <nl> + # define GRPC_MDELEM_PATH_SLASH \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 54 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : path " : " / index . html " * / <nl> # define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 55 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 55 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " proxy - authenticate " : " " * / <nl> # define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 56 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 56 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " proxy - authorization " : " " * / <nl> # define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 57 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 57 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " range " : " " * / <nl> - # define GRPC_MDELEM_RANGE_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 58 ] } ) <nl> + # define GRPC_MDELEM_RANGE_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 58 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " referer " : " " * / <nl> - # define GRPC_MDELEM_REFERER_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 59 ] } ) <nl> + # define GRPC_MDELEM_REFERER_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 59 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " refresh " : " " * / <nl> - # define GRPC_MDELEM_REFRESH_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 60 ] } ) <nl> + # define GRPC_MDELEM_REFRESH_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 60 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " retry - after " : " " * / <nl> # define GRPC_MDELEM_RETRY_AFTER_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 61 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 61 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : scheme " : " grpc " * / <nl> - # define GRPC_MDELEM_SCHEME_GRPC ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 62 ] } ) <nl> + # define GRPC_MDELEM_SCHEME_GRPC \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 62 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : scheme " : " http " * / <nl> - # define GRPC_MDELEM_SCHEME_HTTP ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 63 ] } ) <nl> + # define GRPC_MDELEM_SCHEME_HTTP \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 63 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : scheme " : " https " * / <nl> - # define GRPC_MDELEM_SCHEME_HTTPS ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 64 ] } ) <nl> + # define GRPC_MDELEM_SCHEME_HTTPS \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 64 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " server " : " " * / <nl> - # define GRPC_MDELEM_SERVER_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 65 ] } ) <nl> + # define GRPC_MDELEM_SERVER_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 65 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " set - cookie " : " " * / <nl> # define GRPC_MDELEM_SET_COOKIE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 66 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 66 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : status " : " 200 " * / <nl> - # define GRPC_MDELEM_STATUS_200 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 67 ] } ) <nl> + # define GRPC_MDELEM_STATUS_200 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 67 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : status " : " 204 " * / <nl> - # define GRPC_MDELEM_STATUS_204 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 68 ] } ) <nl> + # define GRPC_MDELEM_STATUS_204 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 68 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : status " : " 206 " * / <nl> - # define GRPC_MDELEM_STATUS_206 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 69 ] } ) <nl> + # define GRPC_MDELEM_STATUS_206 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 69 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : status " : " 304 " * / <nl> - # define GRPC_MDELEM_STATUS_304 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 70 ] } ) <nl> + # define GRPC_MDELEM_STATUS_304 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 70 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : status " : " 400 " * / <nl> - # define GRPC_MDELEM_STATUS_400 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 71 ] } ) <nl> + # define GRPC_MDELEM_STATUS_400 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 71 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : status " : " 404 " * / <nl> - # define GRPC_MDELEM_STATUS_404 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 72 ] } ) <nl> + # define GRPC_MDELEM_STATUS_404 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 72 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " : status " : " 500 " * / <nl> - # define GRPC_MDELEM_STATUS_500 ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 73 ] } ) <nl> + # define GRPC_MDELEM_STATUS_500 \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 73 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " strict - transport - security " : " " * / <nl> # define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 74 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 74 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " te " : " trailers " * / <nl> - # define GRPC_MDELEM_TE_TRAILERS ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 75 ] } ) <nl> + # define GRPC_MDELEM_TE_TRAILERS \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 75 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " transfer - encoding " : " " * / <nl> # define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 76 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 76 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " user - agent " : " " * / <nl> # define GRPC_MDELEM_USER_AGENT_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 77 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 77 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " vary " : " " * / <nl> - # define GRPC_MDELEM_VARY_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 78 ] } ) <nl> + # define GRPC_MDELEM_VARY_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 78 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " via " : " " * / <nl> - # define GRPC_MDELEM_VIA_EMPTY ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 79 ] } ) <nl> + # define GRPC_MDELEM_VIA_EMPTY \ <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 79 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> / * " www - authenticate " : " " * / <nl> # define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ 80 ] } ) <nl> + ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ 80 ] , GRPC_MDELEM_STORAGE_STATIC ) ) <nl> <nl> grpc_mdelem grpc_static_mdelem_for_static_strings ( int a , int b ) ; <nl> extern const uint8_t grpc_static_accept_encoding_metadata [ 8 ] ; <nl> - # define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS ( algs ) \ <nl> - ( ( grpc_mdelem ) { & grpc_static_mdelem_table \ <nl> - [ grpc_static_accept_encoding_metadata [ ( algs ) ] ] } ) <nl> + # define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS ( algs ) \ <nl> + ( GRPC_MAKE_MDELEM ( \ <nl> + & grpc_static_mdelem_table [ grpc_static_accept_encoding_metadata [ ( algs ) ] ] , \ <nl> + GRPC_MDELEM_STORAGE_STATIC ) ) <nl> # endif / * GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H * / <nl> mmm a / test / core / transport / metadata_test . c <nl> ppp b / test / core / transport / metadata_test . c <nl> static void test_spin_creating_the_same_thing ( bool intern_keys , <nl> & exec_ctx , <nl> maybe_intern ( grpc_slice_from_static_string ( " a " ) , intern_keys ) , <nl> maybe_intern ( grpc_slice_from_static_string ( " b " ) , intern_values ) ) ) ; <nl> + if ( intern_keys & & intern_values ) { <nl> + GPR_ASSERT ( a . payload = = b . payload ) ; <nl> + GPR_ASSERT ( a . payload = = c . payload ) ; <nl> + } <nl> + grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> + grpc_shutdown ( ) ; <nl> + } <nl> + <nl> + static void test_identity_laws ( bool intern_keys , bool intern_values ) { <nl> + gpr_log ( GPR_INFO , " test_identity_laws : intern_keys = % d intern_values = % d " , <nl> + intern_keys , intern_values ) ; <nl> + <nl> + grpc_init ( ) ; <nl> + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> + grpc_mdelem a , b , c ; <nl> + a = grpc_mdelem_from_slices ( <nl> + & exec_ctx , maybe_intern ( grpc_slice_from_static_string ( " a " ) , intern_keys ) , <nl> + maybe_intern ( grpc_slice_from_static_string ( " b " ) , intern_values ) ) ; <nl> + b = grpc_mdelem_from_slices ( <nl> + & exec_ctx , maybe_intern ( grpc_slice_from_static_string ( " a " ) , intern_keys ) , <nl> + maybe_intern ( grpc_slice_from_static_string ( " b " ) , intern_values ) ) ; <nl> + c = grpc_mdelem_from_slices ( <nl> + & exec_ctx , maybe_intern ( grpc_slice_from_static_string ( " a " ) , intern_keys ) , <nl> + maybe_intern ( grpc_slice_from_static_string ( " b " ) , intern_values ) ) ; <nl> + GPR_ASSERT ( grpc_mdelem_eq ( a , a ) ) ; <nl> + GPR_ASSERT ( grpc_mdelem_eq ( b , b ) ) ; <nl> + GPR_ASSERT ( grpc_mdelem_eq ( c , c ) ) ; <nl> GPR_ASSERT ( grpc_mdelem_eq ( a , b ) ) ; <nl> + GPR_ASSERT ( grpc_mdelem_eq ( b , c ) ) ; <nl> GPR_ASSERT ( grpc_mdelem_eq ( a , c ) ) ; <nl> + GPR_ASSERT ( grpc_mdelem_eq ( b , a ) ) ; <nl> + GPR_ASSERT ( grpc_mdelem_eq ( c , b ) ) ; <nl> + GPR_ASSERT ( grpc_mdelem_eq ( c , a ) ) ; <nl> if ( intern_keys & & intern_values ) { <nl> GPR_ASSERT ( a . payload = = b . payload ) ; <nl> GPR_ASSERT ( a . payload = = c . payload ) ; <nl> static void test_spin_creating_the_same_thing ( bool intern_keys , <nl> GPR_ASSERT ( a . payload ! = c . payload ) ; <nl> GPR_ASSERT ( b . payload ! = c . payload ) ; <nl> } <nl> + GRPC_MDELEM_UNREF ( & exec_ctx , a ) ; <nl> + GRPC_MDELEM_UNREF ( & exec_ctx , b ) ; <nl> + GRPC_MDELEM_UNREF ( & exec_ctx , c ) ; <nl> grpc_exec_ctx_finish ( & exec_ctx ) ; <nl> grpc_shutdown ( ) ; <nl> } <nl> static void test_copied_static_metadata ( bool dup_key , bool dup_value ) { <nl> grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT ; <nl> <nl> for ( size_t i = 0 ; i < GRPC_STATIC_MDELEM_COUNT ; i + + ) { <nl> - grpc_mdelem p = ( grpc_mdelem ) { & grpc_static_mdelem_table [ i ] } ; <nl> + grpc_mdelem p = GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ i ] , <nl> + GRPC_MDELEM_STORAGE_STATIC ) ; <nl> grpc_mdelem q = <nl> grpc_mdelem_from_slices ( & exec_ctx , maybe_dup ( GRPC_MDKEY ( p ) , dup_key ) , <nl> maybe_dup ( GRPC_MDVALUE ( p ) , dup_value ) ) ; <nl> int main ( int argc , char * * argv ) { <nl> for ( int v = 0 ; v < = 1 ; v + + ) { <nl> test_create_metadata ( k , v ) ; <nl> test_create_many_ephemeral_metadata ( k , v ) ; <nl> + test_identity_laws ( k , v ) ; <nl> test_spin_creating_the_same_thing ( k , v ) ; <nl> test_mdelem_sizes_in_hpack ( k , v ) ; <nl> test_copied_static_metadata ( k , v ) ; <nl> mmm a / tools / codegen / core / gen_static_metadata . py <nl> ppp b / tools / codegen / core / gen_static_metadata . py <nl> def slice_def ( i ) : <nl> print > > H , ' extern uintptr_t grpc_static_mdelem_user_data [ GRPC_STATIC_MDELEM_COUNT ] ; ' <nl> for i , elem in enumerate ( all_elems ) : <nl> print > > H , ' / * " % s " : " % s " * / ' % elem <nl> - print > > H , ' # define % s ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ % d ] } ) ' % ( mangle ( elem ) . upper ( ) , i ) <nl> + print > > H , ' # define % s ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ % d ] , GRPC_MDELEM_STORAGE_STATIC ) ) ' % ( mangle ( elem ) . upper ( ) , i ) <nl> print > > H <nl> print > > C , ' uintptr_t grpc_static_mdelem_user_data [ GRPC_STATIC_MDELEM_COUNT ] = { ' <nl> print > > C , ' % s ' % ' , ' . join ( ' % d ' % static_userdata . get ( elem , 0 ) for elem in all_elems ) <nl> def perfect_hash ( keys , name ) : <nl> print > > C , ' if ( a = = - 1 | | b = = - 1 ) return GRPC_MDNULL ; ' <nl> print > > C , ' uint32_t k = ( uint32_t ) ( a * % d + b ) ; ' % len ( all_strs ) <nl> print > > C , ' uint32_t h = elems_phash ( k ) ; ' <nl> - print > > C , ' return elem_keys [ h ] = = k ? ( grpc_mdelem ) { & grpc_static_mdelem_table [ elem_idxs [ h ] ] } : GRPC_MDNULL ; ' <nl> + print > > C , ' return elem_keys [ h ] = = k ? GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ elem_idxs [ h ] ] , GRPC_MDELEM_STORAGE_STATIC ) : GRPC_MDNULL ; ' <nl> print > > C , ' } ' <nl> print > > C <nl> <nl> def perfect_hash ( keys , name ) : <nl> print > > C , ' } ; ' <nl> print > > C <nl> <nl> - print > > H , ' # define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS ( algs ) ( ( grpc_mdelem ) { & grpc_static_mdelem_table [ grpc_static_accept_encoding_metadata [ ( algs ) ] ] } ) ' <nl> + print > > H , ' # define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS ( algs ) ( GRPC_MAKE_MDELEM ( & grpc_static_mdelem_table [ grpc_static_accept_encoding_metadata [ ( algs ) ] ] , GRPC_MDELEM_STORAGE_STATIC ) ) ' <nl> <nl> print > > H , ' # endif / * GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H * / ' <nl> <nl>
Get identity law testing right
grpc/grpc
9ecadce1e089901ca0c9317f7d8f6d41689f8f61
2016-11-18T22:52:25Z
mmm a / tensorflow / core / kernels / concat_lib . h <nl> ppp b / tensorflow / core / kernels / concat_lib . h <nl> void ConcatCPU ( DeviceBase * d , <nl> <nl> / / Assumes all inputs are nonempty <nl> template < typename T > <nl> - void ConcatGPU ( const Eigen : : GpuDevice & d , <nl> - const std : : vector < <nl> - std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & inputs , <nl> - typename TTypes < T , 2 > : : Matrix * output ) ; <nl> + void ConcatGPU32 ( <nl> + const Eigen : : GpuDevice & d , <nl> + const std : : vector < std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & <nl> + inputs , <nl> + typename TTypes < T , 2 > : : Matrix * output ) ; <nl> + <nl> + template < typename T > <nl> + void ConcatGPU64 ( <nl> + const Eigen : : GpuDevice & d , <nl> + const std : : vector < std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & <nl> + inputs , <nl> + typename TTypes < T , 2 > : : Matrix * output ) ; <nl> <nl> } / / namespace tensorflow <nl> <nl> mmm a / tensorflow / core / kernels / concat_lib_cpu . cc <nl> ppp b / tensorflow / core / kernels / concat_lib_cpu . cc <nl> void ConcatCPU ( DeviceBase * d , <nl> int num_inputs = inputs . size ( ) ; <nl> std : : vector < ptrdiff_t > sizes ; <nl> sizes . reserve ( num_inputs ) ; <nl> - int row_size = 0 ; <nl> + int64 row_size = 0 ; <nl> for ( int j = 0 ; j < num_inputs ; + + j ) { <nl> sizes . push_back ( inputs [ j ] - > dimension ( 1 ) ) ; <nl> row_size + = sizes . back ( ) ; <nl> mmm a / tensorflow / core / kernels / concat_lib_gpu . cu . cc <nl> ppp b / tensorflow / core / kernels / concat_lib_gpu . cu . cc <nl> namespace tensorflow { <nl> typedef Eigen : : GpuDevice GPUDevice ; <nl> <nl> template < typename T > <nl> - void ConcatGPU ( const GPUDevice & d , <nl> - const std : : vector < <nl> - std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & inputs , <nl> - typename TTypes < T , 2 > : : Matrix * output ) { <nl> + void ConcatGPU32 ( <nl> + const GPUDevice & d , <nl> + const std : : vector < std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & <nl> + inputs , <nl> + typename TTypes < T , 2 > : : Matrix * output ) { <nl> Eigen : : array < int32 , 2 > offset { 0 , 0 } ; <nl> for ( int i = 0 ; i < inputs . size ( ) ; + + i ) { <nl> - Eigen : : array < int32_t , 2 > size ; <nl> + Eigen : : array < int32 , 2 > size ; <nl> size [ 0 ] = inputs [ i ] - > dimension ( 0 ) ; <nl> size [ 1 ] = inputs [ i ] - > dimension ( 1 ) ; <nl> To32Bit ( * output ) . slice ( offset , size ) . device ( d ) = To32Bit ( * inputs [ i ] ) ; <nl> void ConcatGPU ( const GPUDevice & d , <nl> } <nl> } <nl> <nl> - # define REGISTER_GPU ( T ) \ <nl> - template void ConcatGPU < T > ( \ <nl> + template < typename T > <nl> + void ConcatGPU64 ( <nl> + const GPUDevice & d , <nl> + const std : : vector < std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & <nl> + inputs , <nl> + typename TTypes < T , 2 > : : Matrix * output ) { <nl> + Eigen : : array < int64 , 2 > offset { 0 , 0 } ; <nl> + for ( int i = 0 ; i < inputs . size ( ) ; + + i ) { <nl> + Eigen : : array < int64 , 2 > size ; <nl> + size [ 0 ] = inputs [ i ] - > dimension ( 0 ) ; <nl> + size [ 1 ] = inputs [ i ] - > dimension ( 1 ) ; <nl> + output - > slice ( offset , size ) . device ( d ) = * inputs [ i ] ; <nl> + offset [ 1 ] + = size [ 1 ] ; <nl> + } <nl> + } <nl> + <nl> + # define REGISTER_GPU32 ( T ) \ <nl> + template void ConcatGPU32 < T > ( \ <nl> const GPUDevice & d , \ <nl> const std : : vector < std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & \ <nl> inputs , \ <nl> typename TTypes < T , 2 > : : Matrix * output ) ; <nl> <nl> - TF_CALL_GPU_NUMBER_TYPES ( REGISTER_GPU ) ; <nl> - REGISTER_GPU ( bfloat16 ) ; <nl> - # undef REGISTER_GPU <nl> + # define REGISTER_GPU64 ( T ) \ <nl> + template void ConcatGPU64 < T > ( \ <nl> + const GPUDevice & d , \ <nl> + const std : : vector < std : : unique_ptr < typename TTypes < T , 2 > : : ConstMatrix > > & \ <nl> + inputs , \ <nl> + typename TTypes < T , 2 > : : Matrix * output ) ; <nl> + <nl> + TF_CALL_GPU_NUMBER_TYPES ( REGISTER_GPU32 ) ; <nl> + REGISTER_GPU32 ( bfloat16 ) ; <nl> + <nl> + TF_CALL_GPU_NUMBER_TYPES ( REGISTER_GPU64 ) ; <nl> + REGISTER_GPU64 ( bfloat16 ) ; <nl> + <nl> + # undef REGISTER_GPU32 <nl> + # undef REGISTER_GPU64 <nl> <nl> } / / end namespace tensorflow <nl> <nl> mmm a / tensorflow / core / kernels / concat_op . cc <nl> ppp b / tensorflow / core / kernels / concat_op . cc <nl> limitations under the License . <nl> <nl> / / See docs in . . / ops / array_ops . cc . <nl> <nl> + # include < limits > <nl> # include < vector > <nl> <nl> # include " third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor " <nl> class ConcatOp : public OpKernel { <nl> int64 output_dim1 = output - > NumElements ( ) / inputs_flat_dim0 ; <nl> auto output_flat = output - > shaped < T , 2 > ( { inputs_flat_dim0 , output_dim1 } ) ; <nl> if ( std : : is_same < Device , GPUDevice > : : value ) { <nl> - ConcatGPU < T > ( c - > eigen_gpu_device ( ) , inputs_flat , & output_flat ) ; <nl> + / / Switching indexing to int64 might cause performance issues . <nl> + / / Hence , we keep int32 indexing in the GPU kernel unless we need to <nl> + / / switch to int64 . <nl> + if ( output - > NumElements ( ) < std : : numeric_limits < int32 > : : max ( ) ) { <nl> + ConcatGPU64 < T > ( c - > eigen_gpu_device ( ) , inputs_flat , & output_flat ) ; <nl> + } else { <nl> + ConcatGPU32 < T > ( c - > eigen_gpu_device ( ) , inputs_flat , & output_flat ) ; <nl> + } <nl> } else { <nl> ConcatCPU < T > ( c - > device ( ) , inputs_flat , & output_flat ) ; <nl> } <nl> mmm a / tensorflow / core / kernels / pack_op . cc <nl> ppp b / tensorflow / core / kernels / pack_op . cc <nl> limitations under the License . <nl> <nl> / / See docs in . . / ops / array_ops . cc . <nl> <nl> + # include < limits > <nl> # include < vector > <nl> <nl> # include " third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor " <nl> class PackOp : public OpKernel { <nl> values [ 0 ] . shape ( ) . DebugString ( ) , " ! = values [ " , i , <nl> " ] . shape = " , values [ i ] . shape ( ) . DebugString ( ) ) ) ; <nl> } <nl> - <nl> TensorShape output_shape ( values [ 0 ] . shape ( ) ) ; <nl> output_shape . InsertDim ( 0 , num ) ; <nl> <nl> class PackOp : public OpKernel { <nl> Tensor * output ; <nl> OP_REQUIRES_OK ( c , c - > allocate_output ( 0 , output_shape , & output ) ) ; <nl> <nl> - const int output_size = output - > NumElements ( ) ; <nl> + const int64 output_size = output - > NumElements ( ) ; <nl> if ( output_size > 0 ) { <nl> auto output_flat = output - > shaped < T , 2 > ( { 1 , output_size } ) ; <nl> <nl> class PackOp : public OpKernel { <nl> values [ i ] . shaped < T , 2 > ( { 1 , values [ i ] . NumElements ( ) } ) ) ) ; <nl> } <nl> if ( std : : is_same < Device , GPUDevice > : : value ) { <nl> - ConcatGPU < T > ( c - > eigen_gpu_device ( ) , inputs_flat , & output_flat ) ; <nl> + / / Switching indexing to int64 might cause performance issues . <nl> + / / Hence , we keep int32 indexing in the GPU kernel unless we need to <nl> + / / switch to int64 . <nl> + if ( output_size < std : : numeric_limits < int32 > : : max ( ) ) { <nl> + ConcatGPU32 < T > ( c - > eigen_gpu_device ( ) , inputs_flat , & output_flat ) ; <nl> + } else { <nl> + ConcatGPU64 < T > ( c - > eigen_gpu_device ( ) , inputs_flat , & output_flat ) ; <nl> + } <nl> } else { <nl> ConcatCPU < T > ( c - > device ( ) , inputs_flat , & output_flat ) ; <nl> } <nl> mmm a / tensorflow / core / kernels / tensor_array_ops . cc <nl> ppp b / tensorflow / core / kernels / tensor_array_ops . cc <nl> limitations under the License . <nl> <nl> # define EIGEN_USE_THREADS <nl> <nl> - # include < limits . h > <nl> + # include < limits > <nl> # include < vector > <nl> <nl> # include " third_party / eigen3 / unsupported / Eigen / CXX11 / Tensor " <nl> class TensorArrayPackOp : public OpKernel { <nl> } <nl> <nl> if ( std : : is_same < Device , GPUDevice > : : value ) { <nl> - ConcatGPU < T > ( ctx - > eigen_gpu_device ( ) , input_tensors_flat , & output_flat ) ; <nl> + / / Switching indexing to int64 might cause performance issues . <nl> + / / Hence , we keep int32 indexing in the GPU kernel unless we need to <nl> + / / switch to int64 . <nl> + if ( output_shape . num_elements ( ) < std : : numeric_limits < int32 > : : max ( ) ) { <nl> + ConcatGPU32 < T > ( ctx - > eigen_gpu_device ( ) , input_tensors_flat , <nl> + & output_flat ) ; <nl> + } else { <nl> + ConcatGPU64 < T > ( ctx - > eigen_gpu_device ( ) , input_tensors_flat , <nl> + & output_flat ) ; <nl> + } <nl> } else { <nl> ConcatCPU < T > ( ctx - > device ( ) , input_tensors_flat , & output_flat ) ; <nl> } <nl> class TensorArrayConcatOp : public OpKernel { <nl> OP_REQUIRES_OK ( ctx , ctx - > allocate_output ( 0 , output_shape , & output_tensor ) ) ; <nl> ConstMatrixVector input_tensors_flat ; <nl> input_tensors_flat . reserve ( values . size ( ) ) ; <nl> - <nl> for ( size_t i = 0 ; i < values . size ( ) ; + + i ) { <nl> const Tensor * value_t = value_tensors [ i ] ; <nl> if ( value_t - > NumElements ( ) > 0 ) { <nl> class TensorArrayConcatOp : public OpKernel { <nl> auto output_flat = <nl> output_tensor - > shaped < T , 2 > ( { 1 , output_shape . num_elements ( ) } ) ; <nl> if ( std : : is_same < Device , GPUDevice > : : value ) { <nl> - ConcatGPU < T > ( ctx - > eigen_gpu_device ( ) , input_tensors_flat , & output_flat ) ; <nl> + / / Switching indexing to int64 might cause performance issues . <nl> + / / Hence , we keep int32 indexing in the GPU kernel unless we need to <nl> + / / switch to int64 . <nl> + if ( output_shape . num_elements ( ) < std : : numeric_limits < int32 > : : max ( ) ) { <nl> + ConcatGPU32 < T > ( ctx - > eigen_gpu_device ( ) , input_tensors_flat , <nl> + & output_flat ) ; <nl> + } else { <nl> + ConcatGPU64 < T > ( ctx - > eigen_gpu_device ( ) , input_tensors_flat , <nl> + & output_flat ) ; <nl> + } <nl> } else { <nl> ConcatCPU < T > ( ctx - > device ( ) , input_tensors_flat , & output_flat ) ; <nl> } <nl>
Fix int - overflow errors in concat cpu kernel .
tensorflow/tensorflow
867227c1317d05ab1b6e5c2341212ed5741da049
2016-04-07T22:14:49Z
mmm a / arangosh / Import / ImportHelper . cpp <nl> ppp b / arangosh / Import / ImportHelper . cpp <nl> ImportHelper : : ImportHelper ( ClientFeature const * client , <nl> _senderThreads . emplace_back ( new SenderThread ( std : : move ( http ) , & _stats ) ) ; <nl> _senderThreads . back ( ) - > start ( ) ; <nl> } <nl> + <nl> + / / wait until all sender threads are ready <nl> + while ( true ) { <nl> + uint32_t numReady = 0 ; <nl> + for ( auto const & t : _senderThreads ) { <nl> + if ( t - > isReady ( ) ) { <nl> + numReady + + ; <nl> + } <nl> + } <nl> + if ( numReady = = _senderThreads . size ( ) ) { <nl> + break ; <nl> + } <nl> + } <nl> } <nl> <nl> ImportHelper : : ~ ImportHelper ( ) { <nl> SenderThread * ImportHelper : : findSender ( ) { <nl> _hasError = true ; <nl> _errorMessage = t - > errorMessage ( ) ; <nl> return nullptr ; <nl> - } else if ( t - > idle ( ) ) { <nl> + } else if ( t - > isIdle ( ) ) { <nl> return t . get ( ) ; <nl> } <nl> } <nl> void ImportHelper : : waitForSenders ( ) { <nl> while ( ! _senderThreads . empty ( ) ) { <nl> uint32_t numIdle = 0 ; <nl> for ( auto const & t : _senderThreads ) { <nl> - if ( t - > idle ( ) | | t - > hasError ( ) ) { <nl> + if ( t - > isDone ( ) ) { <nl> numIdle + + ; <nl> } <nl> } <nl> mmm a / arangosh / Import / SenderThread . cpp <nl> ppp b / arangosh / Import / SenderThread . cpp <nl> SenderThread : : SenderThread ( <nl> _data ( TRI_UNKNOWN_MEM_ZONE , false ) , <nl> _hasError ( false ) , <nl> _idle ( true ) , <nl> + _ready ( false ) , <nl> _stats ( stats ) { } <nl> <nl> SenderThread : : ~ SenderThread ( ) { <nl> void SenderThread : : sendData ( std : : string const & url , <nl> guard . broadcast ( ) ; <nl> } <nl> <nl> + bool SenderThread : : hasError ( ) { <nl> + CONDITION_LOCKER ( guard , _condition ) ; <nl> + return _hasError ; <nl> + } <nl> + <nl> + bool SenderThread : : isReady ( ) { <nl> + CONDITION_LOCKER ( guard , _condition ) ; <nl> + return _ready ; <nl> + } <nl> + <nl> + bool SenderThread : : isIdle ( ) { <nl> + CONDITION_LOCKER ( guard , _condition ) ; <nl> + return _idle ; <nl> + } <nl> + <nl> + bool SenderThread : : isDone ( ) { <nl> + CONDITION_LOCKER ( guard , _condition ) ; <nl> + return _idle | | _hasError ; <nl> + } <nl> + <nl> void SenderThread : : run ( ) { <nl> while ( ! isStopping ( ) & & ! _hasError ) { <nl> { <nl> CONDITION_LOCKER ( guard , _condition ) ; <nl> - guard . wait ( ) ; <nl> + _ready = true ; <nl> + if ( _idle ) { <nl> + guard . wait ( ) ; <nl> + } <nl> } <nl> if ( isStopping ( ) ) { <nl> - CONDITION_LOCKER ( guard , _condition ) ; <nl> - _idle = true ; <nl> - return ; <nl> + break ; <nl> } <nl> try { <nl> if ( _data . length ( ) > 0 ) { <nl> TRI_ASSERT ( ! _idle & & ! _url . empty ( ) ) ; <nl> <nl> - std : : unordered_map < std : : string , std : : string > headerFields ; <nl> std : : unique_ptr < httpclient : : SimpleHttpResult > result ( <nl> _client - > request ( rest : : RequestType : : POST , _url , _data . c_str ( ) , <nl> - _data . length ( ) , headerFields ) ) ; <nl> + _data . length ( ) ) ) ; <nl> <nl> handleResult ( result . get ( ) ) ; <nl> <nl> _url . clear ( ) ; <nl> _data . reset ( ) ; <nl> } <nl> + <nl> CONDITION_LOCKER ( guard , _condition ) ; <nl> _idle = true ; <nl> } catch ( . . . ) { <nl> void SenderThread : : run ( ) { <nl> _idle = true ; <nl> } <nl> } <nl> + <nl> + CONDITION_LOCKER ( guard , _condition ) ; <nl> + TRI_ASSERT ( _idle ) ; <nl> } <nl> <nl> void SenderThread : : handleResult ( httpclient : : SimpleHttpResult * result ) { <nl> mmm a / arangosh / Import / SenderThread . h <nl> ppp b / arangosh / Import / SenderThread . h <nl> class SenderThread : public arangodb : : Thread { <nl> <nl> void sendData ( std : : string const & url , basics : : StringBuffer * sender ) ; <nl> <nl> - bool idle ( ) const { return _idle ; } <nl> - <nl> - bool hasError ( ) const { return _hasError ; } <nl> + bool hasError ( ) ; <nl> + bool isReady ( ) ; <nl> + bool isIdle ( ) ; <nl> + bool isDone ( ) ; <nl> <nl> std : : string const & errorMessage ( ) const { return _errorMessage ; } <nl> <nl> class SenderThread : public arangodb : : Thread { <nl> httpclient : : SimpleHttpClient * _client ; <nl> std : : string _url ; <nl> basics : : StringBuffer _data ; <nl> - bool _hasError = false ; <nl> - bool _idle = true ; <nl> + bool _hasError ; <nl> + bool _idle ; <nl> + bool _ready ; <nl> <nl> ImportStatistics * _stats ; <nl> std : : string _errorMessage ; <nl>
fix threading problems in arangoimp
arangodb/arangodb
a01716a2af9bc28251f6ee4812460123c8461b9e
2017-06-02T11:58:18Z
mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> class V8_EXPORT Extension { / / NOLINT <nl> const String : : ExternalOneByteStringResource * source ( ) const { <nl> return source_ ; <nl> } <nl> - int dependency_count ( ) { return dep_count_ ; } <nl> - const char * * dependencies ( ) { return deps_ ; } <nl> + int dependency_count ( ) const { return dep_count_ ; } <nl> + const char * * dependencies ( ) const { return deps_ ; } <nl> void set_auto_enable ( bool value ) { auto_enable_ = value ; } <nl> bool auto_enable ( ) { return auto_enable_ ; } <nl> <nl> class V8_EXPORT Extension { / / NOLINT <nl> bool auto_enable_ ; <nl> } ; <nl> <nl> + V8_DEPRECATE_SOON ( <nl> + " Use unique_ptr version or stop using extension ( http : / / crbug . com / 334679 ) . " , <nl> + void V8_EXPORT RegisterExtension ( Extension * extension ) ) ; <nl> <nl> - void V8_EXPORT RegisterExtension ( Extension * extension ) ; <nl> - <nl> + void V8_EXPORT RegisterExtension ( std : : unique_ptr < Extension > ) ; <nl> <nl> / / mmm Statics mmm <nl> <nl> mmm a / src / api . cc <nl> ppp b / src / api . cc <nl> void V8 : : SetFlagsFromCommandLine ( int * argc , char * * argv , bool remove_flags ) { <nl> RegisteredExtension * RegisteredExtension : : first_extension_ = nullptr ; <nl> <nl> RegisteredExtension : : RegisteredExtension ( Extension * extension ) <nl> - : extension_ ( extension ) { } <nl> + : legacy_unowned_extension_ ( extension ) { } <nl> <nl> + RegisteredExtension : : RegisteredExtension ( std : : unique_ptr < Extension > extension ) <nl> + : extension_ ( std : : move ( extension ) ) { } <nl> <nl> - void RegisteredExtension : : Register ( RegisteredExtension * that ) { <nl> - that - > next_ = first_extension_ ; <nl> - first_extension_ = that ; <nl> + / / static <nl> + void RegisteredExtension : : Register ( Extension * extension ) { <nl> + RegisteredExtension * new_extension = new RegisteredExtension ( extension ) ; <nl> + new_extension - > next_ = first_extension_ ; <nl> + first_extension_ = new_extension ; <nl> } <nl> <nl> + / / static <nl> + void RegisteredExtension : : Register ( std : : unique_ptr < Extension > extension ) { <nl> + RegisteredExtension * new_extension = <nl> + new RegisteredExtension ( std : : move ( extension ) ) ; <nl> + new_extension - > next_ = first_extension_ ; <nl> + first_extension_ = new_extension ; <nl> + } <nl> <nl> + / / static <nl> void RegisteredExtension : : UnregisterAll ( ) { <nl> - / / Keep a list of all leaked Extension objects , to suppress ASan leak reports . <nl> - / / We cannot suppress via lsan suppressions , since the objects are allocated <nl> - / / at different call sites . <nl> - / / TODO ( clemensh ) : Fix this ( https : / / crbug . com / v8 / 8725 ) . <nl> - static std : : vector < Extension * > * leaked_extensions = <nl> - new std : : vector < Extension * > ; <nl> - <nl> RegisteredExtension * re = first_extension_ ; <nl> while ( re ! = nullptr ) { <nl> RegisteredExtension * next = re - > next ( ) ; <nl> - leaked_extensions - > push_back ( re - > extension_ ) ; <nl> delete re ; <nl> re = next ; <nl> } <nl> class ExtensionResource : public String : : ExternalOneByteStringResource { <nl> } ; <nl> } / / anonymous namespace <nl> <nl> - void RegisterExtension ( Extension * that ) { <nl> - RegisteredExtension * extension = new RegisteredExtension ( that ) ; <nl> - RegisteredExtension : : Register ( extension ) ; <nl> - } <nl> + void RegisterExtension ( Extension * that ) { RegisteredExtension : : Register ( that ) ; } <nl> <nl> + void RegisterExtension ( std : : unique_ptr < Extension > extension ) { <nl> + RegisteredExtension : : Register ( std : : move ( extension ) ) ; <nl> + } <nl> <nl> Extension : : Extension ( const char * name , <nl> const char * source , <nl> mmm a / src / api . h <nl> ppp b / src / api . h <nl> class ApiFunction { <nl> <nl> class RegisteredExtension { <nl> public : <nl> - explicit RegisteredExtension ( Extension * extension ) ; <nl> - static void Register ( RegisteredExtension * that ) ; <nl> + static void Register ( Extension * ) ; <nl> + static void Register ( std : : unique_ptr < Extension > ) ; <nl> static void UnregisterAll ( ) ; <nl> - Extension * extension ( ) { return extension_ ; } <nl> - RegisteredExtension * next ( ) { return next_ ; } <nl> + Extension * extension ( ) const { <nl> + return legacy_unowned_extension_ ? legacy_unowned_extension_ <nl> + : extension_ . get ( ) ; <nl> + } <nl> + RegisteredExtension * next ( ) const { return next_ ; } <nl> static RegisteredExtension * first_extension ( ) { return first_extension_ ; } <nl> private : <nl> - Extension * extension_ ; <nl> - RegisteredExtension * next_ ; <nl> + explicit RegisteredExtension ( Extension * ) ; <nl> + explicit RegisteredExtension ( std : : unique_ptr < Extension > ) ; <nl> + / / TODO ( clemensh ) : Remove this after the 7 . 4 branch . <nl> + Extension * legacy_unowned_extension_ = nullptr ; <nl> + std : : unique_ptr < Extension > extension_ ; <nl> + RegisteredExtension * next_ = nullptr ; <nl> static RegisteredExtension * first_extension_ ; <nl> } ; <nl> <nl> mmm a / src / bootstrapper . cc <nl> ppp b / src / bootstrapper . cc <nl> static const char * GCFunctionName ( ) { <nl> return flag_given ? FLAG_expose_gc_as : " gc " ; <nl> } <nl> <nl> - v8 : : Extension * Bootstrapper : : free_buffer_extension_ = nullptr ; <nl> - v8 : : Extension * Bootstrapper : : gc_extension_ = nullptr ; <nl> - v8 : : Extension * Bootstrapper : : externalize_string_extension_ = nullptr ; <nl> - v8 : : Extension * Bootstrapper : : statistics_extension_ = nullptr ; <nl> - v8 : : Extension * Bootstrapper : : trigger_failure_extension_ = nullptr ; <nl> - v8 : : Extension * Bootstrapper : : ignition_statistics_extension_ = nullptr ; <nl> - <nl> void Bootstrapper : : InitializeOncePerProcess ( ) { <nl> - free_buffer_extension_ = new FreeBufferExtension ; <nl> - v8 : : RegisterExtension ( free_buffer_extension_ ) ; <nl> - gc_extension_ = new GCExtension ( GCFunctionName ( ) ) ; <nl> - v8 : : RegisterExtension ( gc_extension_ ) ; <nl> - externalize_string_extension_ = new ExternalizeStringExtension ; <nl> - v8 : : RegisterExtension ( externalize_string_extension_ ) ; <nl> - statistics_extension_ = new StatisticsExtension ; <nl> - v8 : : RegisterExtension ( statistics_extension_ ) ; <nl> - trigger_failure_extension_ = new TriggerFailureExtension ; <nl> - v8 : : RegisterExtension ( trigger_failure_extension_ ) ; <nl> - ignition_statistics_extension_ = new IgnitionStatisticsExtension ; <nl> - v8 : : RegisterExtension ( ignition_statistics_extension_ ) ; <nl> - } <nl> - <nl> - <nl> - void Bootstrapper : : TearDownExtensions ( ) { <nl> - delete free_buffer_extension_ ; <nl> - free_buffer_extension_ = nullptr ; <nl> - delete gc_extension_ ; <nl> - gc_extension_ = nullptr ; <nl> - delete externalize_string_extension_ ; <nl> - externalize_string_extension_ = nullptr ; <nl> - delete statistics_extension_ ; <nl> - statistics_extension_ = nullptr ; <nl> - delete trigger_failure_extension_ ; <nl> - trigger_failure_extension_ = nullptr ; <nl> - delete ignition_statistics_extension_ ; <nl> - ignition_statistics_extension_ = nullptr ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < FreeBufferExtension > ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < GCExtension > ( GCFunctionName ( ) ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < ExternalizeStringExtension > ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < StatisticsExtension > ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < TriggerFailureExtension > ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < IgnitionStatisticsExtension > ( ) ) ; <nl> } <nl> <nl> void Bootstrapper : : TearDown ( ) { <nl> mmm a / src / bootstrapper . h <nl> ppp b / src / bootstrapper . h <nl> class SourceCodeCache final { <nl> class Bootstrapper final { <nl> public : <nl> static void InitializeOncePerProcess ( ) ; <nl> - static void TearDownExtensions ( ) ; <nl> <nl> / / Requires : Heap : : SetUp has been called . <nl> void Initialize ( bool create_heap_objects ) ; <nl> class Bootstrapper final { <nl> <nl> explicit Bootstrapper ( Isolate * isolate ) ; <nl> <nl> - static v8 : : Extension * free_buffer_extension_ ; <nl> - static v8 : : Extension * gc_extension_ ; <nl> - static v8 : : Extension * externalize_string_extension_ ; <nl> - static v8 : : Extension * statistics_extension_ ; <nl> - static v8 : : Extension * trigger_failure_extension_ ; <nl> - static v8 : : Extension * ignition_statistics_extension_ ; <nl> - <nl> DISALLOW_COPY_AND_ASSIGN ( Bootstrapper ) ; <nl> } ; <nl> <nl> mmm a / src / v8 . cc <nl> ppp b / src / v8 . cc <nl> void V8 : : TearDown ( ) { <nl> Simulator : : GlobalTearDown ( ) ; <nl> # endif <nl> CallDescriptors : : TearDown ( ) ; <nl> - Bootstrapper : : TearDownExtensions ( ) ; <nl> ElementsAccessor : : TearDown ( ) ; <nl> RegisteredExtension : : UnregisterAll ( ) ; <nl> FlagList : : ResetAllFlags ( ) ; / / Frees memory held by string arguments . <nl> mmm a / test / cctest / cctest . cc <nl> ppp b / test / cctest / cctest . cc <nl> int main ( int argc , char * argv [ ] ) { <nl> CcTest : : set_array_buffer_allocator ( <nl> v8 : : ArrayBuffer : : Allocator : : NewDefaultAllocator ( ) ) ; <nl> <nl> - i : : PrintExtension print_extension ; <nl> - v8 : : RegisterExtension ( & print_extension ) ; <nl> - i : : ProfilerExtension profiler_extension ; <nl> - v8 : : RegisterExtension ( & profiler_extension ) ; <nl> - i : : TraceExtension trace_extension ; <nl> - v8 : : RegisterExtension ( & trace_extension ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < i : : PrintExtension > ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < i : : ProfilerExtension > ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < i : : TraceExtension > ( ) ) ; <nl> <nl> int tests_run = 0 ; <nl> bool print_run_count = true ; <nl> mmm a / test / cctest / test - api . cc <nl> ppp b / test / cctest / test - api . cc <nl> static const char * kSimpleExtensionSource = <nl> <nl> TEST ( SimpleExtensions ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " simpletest " , kSimpleExtensionSource ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " simpletest " , kSimpleExtensionSource ) ) ; <nl> const char * extension_names [ ] = { " simpletest " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> static const char * kStackTraceFromExtensionSource = <nl> <nl> TEST ( StackTraceInExtension ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( <nl> - new Extension ( " stacktracetest " , kStackTraceFromExtensionSource ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( <nl> + " stacktracetest " , kStackTraceFromExtensionSource ) ) ; <nl> const char * extension_names [ ] = { " stacktracetest " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> TEST ( StackTraceInExtension ) { <nl> <nl> TEST ( NullExtensions ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " nulltest " , nullptr ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( " nulltest " , nullptr ) ) ; <nl> const char * extension_names [ ] = { " nulltest " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> static const int kEmbeddedExtensionSourceValidLen = 34 ; <nl> <nl> TEST ( ExtensionMissingSourceLength ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( <nl> - new Extension ( " srclentest_fail " , kEmbeddedExtensionSource ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( <nl> + " srclentest_fail " , kEmbeddedExtensionSource ) ) ; <nl> const char * extension_names [ ] = { " srclentest_fail " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> TEST ( ExtensionWithSourceLength ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> i : : ScopedVector < char > extension_name ( 32 ) ; <nl> i : : SNPrintF ( extension_name , " ext # % d " , source_len ) ; <nl> - v8 : : RegisterExtension ( new Extension ( extension_name . start ( ) , <nl> - kEmbeddedExtensionSource , 0 , nullptr , <nl> - source_len ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( <nl> + extension_name . start ( ) , kEmbeddedExtensionSource , 0 , nullptr , <nl> + source_len ) ) ; <nl> const char * extension_names [ 1 ] = { extension_name . start ( ) } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> static const char * kEvalExtensionSource2 = <nl> <nl> TEST ( UseEvalFromExtension ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " evaltest1 " , kEvalExtensionSource1 ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " evaltest2 " , kEvalExtensionSource2 ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " evaltest1 " , kEvalExtensionSource1 ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " evaltest2 " , kEvalExtensionSource2 ) ) ; <nl> const char * extension_names [ ] = { " evaltest1 " , " evaltest2 " } ; <nl> v8 : : ExtensionConfiguration extensions ( 2 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> static const char * kWithExtensionSource2 = <nl> <nl> TEST ( UseWithFromExtension ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " withtest1 " , kWithExtensionSource1 ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " withtest2 " , kWithExtensionSource2 ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " withtest1 " , kWithExtensionSource1 ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " withtest2 " , kWithExtensionSource2 ) ) ; <nl> const char * extension_names [ ] = { " withtest1 " , " withtest2 " } ; <nl> v8 : : ExtensionConfiguration extensions ( 2 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> TEST ( UseWithFromExtension ) { <nl> <nl> TEST ( AutoExtensions ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - Extension * extension = new Extension ( " autotest " , kSimpleExtensionSource ) ; <nl> + auto extension = <nl> + v8 : : base : : make_unique < Extension > ( " autotest " , kSimpleExtensionSource ) ; <nl> extension - > set_auto_enable ( true ) ; <nl> - v8 : : RegisterExtension ( extension ) ; <nl> + v8 : : RegisterExtension ( std : : move ( extension ) ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) ) ; <nl> Context : : Scope lock ( context ) ; <nl> v8 : : Local < Value > result = CompileRun ( " Foo ( ) " ) ; <nl> static const char * kSyntaxErrorInExtensionSource = " [ " ; <nl> / / error but results in an empty context . <nl> TEST ( SyntaxErrorExtensions ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( <nl> - new Extension ( " syntaxerror " , kSyntaxErrorInExtensionSource ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( <nl> + " syntaxerror " , kSyntaxErrorInExtensionSource ) ) ; <nl> const char * extension_names [ ] = { " syntaxerror " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> static const char * kExceptionInExtensionSource = " throw 42 " ; <nl> / / a fatal error but results in an empty context . <nl> TEST ( ExceptionExtensions ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( <nl> - new Extension ( " exception " , kExceptionInExtensionSource ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( <nl> + " exception " , kExceptionInExtensionSource ) ) ; <nl> const char * extension_names [ ] = { " exception " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> static const char * kNativeCallTest = <nl> / / Test that a native runtime calls are supported in extensions . <nl> TEST ( NativeCallInExtensions ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> - v8 : : RegisterExtension ( <nl> - new Extension ( " nativecall " , kNativeCallInExtensionSource ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( <nl> + " nativecall " , kNativeCallInExtensionSource ) ) ; <nl> const char * extension_names [ ] = { " nativecall " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> class NativeFunctionExtension : public Extension { <nl> TEST ( NativeFunctionDeclaration ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> const char * name = " nativedecl " ; <nl> - v8 : : RegisterExtension ( <nl> - new NativeFunctionExtension ( name , " native function foo ( ) ; " ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < NativeFunctionExtension > ( <nl> + name , " native function foo ( ) ; " ) ) ; <nl> const char * extension_names [ ] = { name } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> TEST ( NativeFunctionDeclarationError ) { <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> const char * name = " nativedeclerr " ; <nl> / / Syntax error in extension code . <nl> - v8 : : RegisterExtension ( <nl> - new NativeFunctionExtension ( name , " native \ nfunction foo ( ) ; " ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < NativeFunctionExtension > ( <nl> + name , " native \ nfunction foo ( ) ; " ) ) ; <nl> const char * extension_names [ ] = { name } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> TEST ( NativeFunctionDeclarationErrorEscape ) { <nl> const char * name = " nativedeclerresc " ; <nl> / / Syntax error in extension code - escape code in " native " means that <nl> / / it ' s not treated as a keyword . <nl> - v8 : : RegisterExtension ( <nl> - new NativeFunctionExtension ( name , " nativ \ \ u0065 function foo ( ) ; " ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < NativeFunctionExtension > ( <nl> + name , " nativ \ \ u0065 function foo ( ) ; " ) ) ; <nl> const char * extension_names [ ] = { name } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & extensions ) ; <nl> static void CheckDependencies ( const char * name , const char * expected ) { <nl> * / <nl> THREADED_TEST ( ExtensionDependency ) { <nl> static const char * kEDeps [ ] = { " D " } ; <nl> - v8 : : RegisterExtension ( new Extension ( " E " , " this . loaded + = ' E ' ; " , 1 , kEDeps ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " E " , " this . loaded + = ' E ' ; " , 1 , kEDeps ) ) ; <nl> static const char * kDDeps [ ] = { " B " , " C " } ; <nl> - v8 : : RegisterExtension ( new Extension ( " D " , " this . loaded + = ' D ' ; " , 2 , kDDeps ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " D " , " this . loaded + = ' D ' ; " , 2 , kDDeps ) ) ; <nl> static const char * kBCDeps [ ] = { " A " } ; <nl> - v8 : : RegisterExtension ( new Extension ( " B " , " this . loaded + = ' B ' ; " , 1 , kBCDeps ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " C " , " this . loaded + = ' C ' ; " , 1 , kBCDeps ) ) ; <nl> - v8 : : RegisterExtension ( new Extension ( " A " , " this . loaded + = ' A ' ; " ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " B " , " this . loaded + = ' B ' ; " , 1 , kBCDeps ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " C " , " this . loaded + = ' C ' ; " , 1 , kBCDeps ) ) ; <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < Extension > ( " A " , " this . loaded + = ' A ' ; " ) ) ; <nl> CheckDependencies ( " A " , " undefinedA " ) ; <nl> CheckDependencies ( " B " , " undefinedAB " ) ; <nl> CheckDependencies ( " C " , " undefinedAC " ) ; <nl> v8 : : Local < v8 : : FunctionTemplate > FunctionExtension : : GetNativeFunctionTemplate ( <nl> <nl> <nl> THREADED_TEST ( FunctionLookup ) { <nl> - v8 : : RegisterExtension ( new FunctionExtension ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < FunctionExtension > ( ) ) ; <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> static const char * exts [ 1 ] = { " functiontest " } ; <nl> v8 : : ExtensionConfiguration config ( 1 , exts ) ; <nl> THREADED_TEST ( FunctionLookup ) { <nl> <nl> <nl> THREADED_TEST ( NativeFunctionConstructCall ) { <nl> - v8 : : RegisterExtension ( new FunctionExtension ( ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < FunctionExtension > ( ) ) ; <nl> v8 : : HandleScope handle_scope ( CcTest : : isolate ( ) ) ; <nl> static const char * exts [ 1 ] = { " functiontest " } ; <nl> v8 : : ExtensionConfiguration config ( 1 , exts ) ; <nl> void StoringErrorCallback ( const char * location , const char * message ) { <nl> TEST ( ErrorReporting ) { <nl> CcTest : : isolate ( ) - > SetFatalErrorHandler ( StoringErrorCallback ) ; <nl> static const char * aDeps [ ] = { " B " } ; <nl> - v8 : : RegisterExtension ( new Extension ( " A " , " " , 1 , aDeps ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( " A " , " " , 1 , aDeps ) ) ; <nl> static const char * bDeps [ ] = { " A " } ; <nl> - v8 : : RegisterExtension ( new Extension ( " B " , " " , 1 , bDeps ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < Extension > ( " B " , " " , 1 , bDeps ) ) ; <nl> last_location = nullptr ; <nl> v8 : : ExtensionConfiguration config ( 1 , bDeps ) ; <nl> v8 : : Local < Context > context = Context : : New ( CcTest : : isolate ( ) , & config ) ; <nl> mmm a / test / cctest / test - debug . cc <nl> ppp b / test / cctest / test - debug . cc <nl> TEST ( NoBreakWhenBootstrapping ) { <nl> { <nl> / / Create a context with an extension to make sure that some JavaScript <nl> / / code is executed during bootstrapping . <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " simpletest " , <nl> - kSimpleExtensionSource ) ) ; <nl> + v8 : : RegisterExtension ( v8 : : base : : make_unique < v8 : : Extension > ( <nl> + " simpletest " , kSimpleExtensionSource ) ) ; <nl> const char * extension_names [ ] = { " simpletest " } ; <nl> v8 : : ExtensionConfiguration extensions ( 1 , extension_names ) ; <nl> v8 : : HandleScope handle_scope ( isolate ) ; <nl> mmm a / test / cctest / test - lockers . cc <nl> ppp b / test / cctest / test - lockers . cc <nl> TEST ( ExtensionsRegistration ) { <nl> # else <nl> const int kNThreads = 40 ; <nl> # endif <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test0 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test1 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test2 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test3 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test4 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test5 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test6 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - v8 : : RegisterExtension ( new v8 : : Extension ( " test7 " , <nl> - kSimpleExtensionSource ) ) ; <nl> - const char * extension_names [ ] = { " test0 " , " test1 " , <nl> - " test2 " , " test3 " , " test4 " , <nl> - " test5 " , " test6 " , " test7 " } ; <nl> + const char * extension_names [ ] = { " test0 " , " test1 " , " test2 " , " test3 " , <nl> + " test4 " , " test5 " , " test6 " , " test7 " } ; <nl> + for ( const char * name : extension_names ) { <nl> + v8 : : RegisterExtension ( <nl> + v8 : : base : : make_unique < v8 : : Extension > ( name , kSimpleExtensionSource ) ) ; <nl> + } <nl> std : : vector < JoinableThread * > threads ; <nl> threads . reserve ( kNThreads ) ; <nl> for ( int i = 0 ; i < kNThreads ; i + + ) { <nl> mmm a / test / cctest / test - serialize . cc <nl> ppp b / test / cctest / test - serialize . cc <nl> UNINITIALIZED_TEST ( SnapshotCreatorIncludeGlobalProxy ) { <nl> v8 : : Isolate : : Scope isolate_scope ( isolate ) ; <nl> / / We can introduce new extensions , which could override functions already <nl> / / in the snapshot . <nl> - v8 : : Extension * extension = new v8 : : Extension ( " new extension " , <nl> - " function i ( ) { return 24 ; } " <nl> - " function j ( ) { return 25 ; } " <nl> - " try { " <nl> - " if ( o . p = = 7 ) o . p + + ; " <nl> - " } catch { } " ) ; <nl> + auto extension = <nl> + base : : make_unique < v8 : : Extension > ( " new extension " , <nl> + " function i ( ) { return 24 ; } " <nl> + " function j ( ) { return 25 ; } " <nl> + " try { " <nl> + " if ( o . p = = 7 ) o . p + + ; " <nl> + " } catch { } " ) ; <nl> extension - > set_auto_enable ( true ) ; <nl> - v8 : : RegisterExtension ( extension ) ; <nl> + v8 : : RegisterExtension ( std : : move ( extension ) ) ; <nl> { <nl> / / Create a new context from default context snapshot . This will <nl> / / create a new global object from a new global object template <nl>
[ api ] Accept Extensions via unique_ptr
v8/v8
7539549e28d79b83c43771dce0024c7d9fc58b3e
2019-02-01T07:15:18Z
mmm a / xbmc / addons / Repository . cpp <nl> ppp b / xbmc / addons / Repository . cpp <nl> <nl> # include " pvr / PVRManager . h " <nl> # include " filesystem / PluginDirectory . h " <nl> <nl> + using namespace std ; <nl> using namespace XFILE ; <nl> using namespace ADDON ; <nl> <nl> AddonPtr CRepository : : Clone ( ) const <nl> CRepository : : CRepository ( const AddonProps & props ) : <nl> CAddon ( props ) <nl> { <nl> - m_compressed = false ; <nl> - m_zipped = false ; <nl> } <nl> <nl> CRepository : : CRepository ( const cp_extension_t * ext ) <nl> : CAddon ( ext ) <nl> { <nl> - m_compressed = false ; <nl> - m_zipped = false ; <nl> / / read in the other props that we need <nl> if ( ext ) <nl> { <nl> - m_checksum = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " checksum " ) ; <nl> - m_compressed = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " info @ compressed " ) . Equals ( " true " ) ; <nl> - m_info = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " info " ) ; <nl> - m_datadir = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " datadir " ) ; <nl> - m_zipped = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " datadir @ zip " ) . Equals ( " true " ) ; <nl> - m_hashes = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " hashes " ) . Equals ( " true " ) ; <nl> + AddonVersion version ( " 0 . 0 . 0 " ) ; <nl> + AddonPtr addonver ; <nl> + if ( CAddonMgr : : Get ( ) . GetAddon ( " xbmc . addon " , addonver ) ) <nl> + version = addonver - > Version ( ) ; <nl> + for ( size_t i = 0 ; i < ext - > configuration - > num_children ; + + i ) <nl> + { <nl> + if ( ext - > configuration - > children [ i ] . name & & <nl> + strcmp ( ext - > configuration - > children [ i ] . name , " dir " ) = = 0 ) <nl> + { <nl> + AddonVersion min_version ( CAddonMgr : : Get ( ) . GetExtValue ( & ext - > configuration - > children [ i ] , " @ minversion " ) ) ; <nl> + if ( min_version < = version ) <nl> + { <nl> + DirInfo dir ; <nl> + dir . version = min_version ; <nl> + dir . checksum = CAddonMgr : : Get ( ) . GetExtValue ( & ext - > configuration - > children [ i ] , " checksum " ) ; <nl> + dir . compressed = CAddonMgr : : Get ( ) . GetExtValue ( & ext - > configuration - > children [ i ] , " info @ compressed " ) . Equals ( " true " ) ; <nl> + dir . info = CAddonMgr : : Get ( ) . GetExtValue ( & ext - > configuration - > children [ i ] , " info " ) ; <nl> + dir . datadir = CAddonMgr : : Get ( ) . GetExtValue ( & ext - > configuration - > children [ i ] , " datadir " ) ; <nl> + dir . zipped = CAddonMgr : : Get ( ) . GetExtValue ( & ext - > configuration - > children [ i ] , " datadir @ zip " ) . Equals ( " true " ) ; <nl> + dir . hashes = CAddonMgr : : Get ( ) . GetExtValue ( & ext - > configuration - > children [ i ] , " hashes " ) . Equals ( " true " ) ; <nl> + m_dirs . push_back ( dir ) ; <nl> + } <nl> + } <nl> + } <nl> + / / backward compatibility <nl> + if ( ! CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " info " ) . empty ( ) ) <nl> + { <nl> + DirInfo info ; <nl> + info . checksum = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " checksum " ) ; <nl> + info . compressed = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " info @ compressed " ) . Equals ( " true " ) ; <nl> + info . info = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " info " ) ; <nl> + info . datadir = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " datadir " ) ; <nl> + info . zipped = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " datadir @ zip " ) . Equals ( " true " ) ; <nl> + info . hashes = CAddonMgr : : Get ( ) . GetExtValue ( ext - > configuration , " hashes " ) . Equals ( " true " ) ; <nl> + m_dirs . push_back ( info ) ; <nl> + } <nl> } <nl> } <nl> <nl> CRepository : : CRepository ( const CRepository & rhs ) <nl> : CAddon ( rhs ) <nl> { <nl> - m_info = rhs . m_info ; <nl> - m_checksum = rhs . m_checksum ; <nl> - m_datadir = rhs . m_datadir ; <nl> - m_compressed = rhs . m_compressed ; <nl> - m_zipped = rhs . m_zipped ; <nl> - m_hashes = rhs . m_hashes ; <nl> + m_dirs = rhs . m_dirs ; <nl> } <nl> <nl> CRepository : : ~ CRepository ( ) <nl> CRepository : : ~ CRepository ( ) <nl> <nl> CStdString CRepository : : Checksum ( ) <nl> { <nl> - if ( ! m_checksum . IsEmpty ( ) ) <nl> - return FetchChecksum ( m_checksum ) ; <nl> - return " " ; <nl> + CStdString result ; <nl> + for ( DirList : : const_iterator it = m_dirs . begin ( ) ; it ! = m_dirs . end ( ) ; + + it ) <nl> + { <nl> + if ( ! it - > checksum . empty ( ) ) <nl> + result + = FetchChecksum ( it - > checksum ) ; <nl> + } <nl> + return result ; <nl> } <nl> <nl> CStdString CRepository : : FetchChecksum ( const CStdString & url ) <nl> CStdString CRepository : : FetchChecksum ( const CStdString & url ) <nl> CStdString CRepository : : GetAddonHash ( const AddonPtr & addon ) <nl> { <nl> CStdString checksum ; <nl> - if ( m_hashes ) <nl> + DirList : : const_iterator it ; <nl> + for ( it = m_dirs . begin ( ) ; it ! = m_dirs . end ( ) ; + + it ) <nl> + if ( it - > datadir = = addon - > Path ( ) ) <nl> + break ; <nl> + if ( it ! = m_dirs . end ( ) & & it - > hashes ) <nl> { <nl> checksum = FetchChecksum ( addon - > Path ( ) + " . md5 " ) ; <nl> size_t pos = checksum . find_first_of ( " \ n " ) ; <nl> CStdString CRepository : : GetAddonHash ( const AddonPtr & addon ) <nl> x = y ; \ <nl> } <nl> <nl> - VECADDONS CRepository : : Parse ( ) <nl> + VECADDONS CRepository : : Parse ( const DirInfo & dir ) <nl> { <nl> - CSingleLock lock ( m_critSection ) ; <nl> - <nl> VECADDONS result ; <nl> CXBMCTinyXML doc ; <nl> <nl> - CStdString file = m_info ; <nl> - if ( m_compressed ) <nl> + CStdString file = dir . info ; <nl> + if ( dir . compressed ) <nl> { <nl> - CURL url ( m_info ) ; <nl> + CURL url ( dir . info ) ; <nl> CStdString opts = url . GetProtocolOptions ( ) ; <nl> if ( ! opts . IsEmpty ( ) ) <nl> opts + = " & " ; <nl> VECADDONS CRepository : : Parse ( ) <nl> for ( IVECADDONS i = result . begin ( ) ; i ! = result . end ( ) ; + + i ) <nl> { <nl> AddonPtr addon = * i ; <nl> - if ( m_zipped ) <nl> + if ( dir . zipped ) <nl> { <nl> CStdString file ; <nl> file . Format ( " % s / % s - % s . zip " , addon - > ID ( ) . c_str ( ) , addon - > ID ( ) . c_str ( ) , addon - > Version ( ) . c_str ( ) ) ; <nl> - addon - > Props ( ) . path = URIUtils : : AddFileToFolder ( m_datadir , file ) ; <nl> - SET_IF_NOT_EMPTY ( addon - > Props ( ) . icon , URIUtils : : AddFileToFolder ( m_datadir , addon - > ID ( ) + " / icon . png " ) ) <nl> + addon - > Props ( ) . path = URIUtils : : AddFileToFolder ( dir . datadir , file ) ; <nl> + SET_IF_NOT_EMPTY ( addon - > Props ( ) . icon , URIUtils : : AddFileToFolder ( dir . datadir , addon - > ID ( ) + " / icon . png " ) ) <nl> file . Format ( " % s / changelog - % s . txt " , addon - > ID ( ) . c_str ( ) , addon - > Version ( ) . c_str ( ) ) ; <nl> - SET_IF_NOT_EMPTY ( addon - > Props ( ) . changelog , URIUtils : : AddFileToFolder ( m_datadir , file ) ) <nl> - SET_IF_NOT_EMPTY ( addon - > Props ( ) . fanart , URIUtils : : AddFileToFolder ( m_datadir , addon - > ID ( ) + " / fanart . jpg " ) ) <nl> + SET_IF_NOT_EMPTY ( addon - > Props ( ) . changelog , URIUtils : : AddFileToFolder ( dir . datadir , file ) ) <nl> + SET_IF_NOT_EMPTY ( addon - > Props ( ) . fanart , URIUtils : : AddFileToFolder ( dir . datadir , addon - > ID ( ) + " / fanart . jpg " ) ) <nl> } <nl> else <nl> { <nl> - addon - > Props ( ) . path = URIUtils : : AddFileToFolder ( m_datadir , addon - > ID ( ) + " / " ) ; <nl> - SET_IF_NOT_EMPTY ( addon - > Props ( ) . icon , URIUtils : : AddFileToFolder ( m_datadir , addon - > ID ( ) + " / icon . png " ) ) <nl> - SET_IF_NOT_EMPTY ( addon - > Props ( ) . changelog , URIUtils : : AddFileToFolder ( m_datadir , addon - > ID ( ) + " / changelog . txt " ) ) <nl> - SET_IF_NOT_EMPTY ( addon - > Props ( ) . fanart , URIUtils : : AddFileToFolder ( m_datadir , addon - > ID ( ) + " / fanart . jpg " ) ) <nl> + addon - > Props ( ) . path = URIUtils : : AddFileToFolder ( dir . datadir , addon - > ID ( ) + " / " ) ; <nl> + SET_IF_NOT_EMPTY ( addon - > Props ( ) . icon , URIUtils : : AddFileToFolder ( dir . datadir , addon - > ID ( ) + " / icon . png " ) ) <nl> + SET_IF_NOT_EMPTY ( addon - > Props ( ) . changelog , URIUtils : : AddFileToFolder ( dir . datadir , addon - > ID ( ) + " / changelog . txt " ) ) <nl> + SET_IF_NOT_EMPTY ( addon - > Props ( ) . fanart , URIUtils : : AddFileToFolder ( dir . datadir , addon - > ID ( ) + " / fanart . jpg " ) ) <nl> } <nl> } <nl> } <nl> VECADDONS CRepositoryUpdateJob : : GrabAddons ( RepositoryPtr & repo ) <nl> VECADDONS addons ; <nl> if ( ! checksum . Equals ( reposum ) | | checksum . empty ( ) ) <nl> { <nl> - addons = repo - > Parse ( ) ; <nl> - if ( addons . empty ( ) ) <nl> + map < string , AddonPtr > uniqueAddons ; <nl> + for ( CRepository : : DirList : : const_iterator it = repo - > m_dirs . begin ( ) ; it ! = repo - > m_dirs . end ( ) ; + + it ) <nl> + { <nl> + VECADDONS addons2 = CRepository : : Parse ( * it ) ; <nl> + for ( VECADDONS : : const_iterator it2 = addons2 . begin ( ) ; it2 ! = addons2 . end ( ) ; + + it2 ) <nl> + { <nl> + map < string , AddonPtr > : : iterator existing = uniqueAddons . find ( ( * it2 ) - > ID ( ) ) ; <nl> + if ( existing ! = uniqueAddons . end ( ) ) <nl> + { / / already got it - replace if we have a newer version <nl> + if ( existing - > second - > Version ( ) < ( * it2 ) - > Version ( ) ) <nl> + existing - > second = * it2 ; <nl> + } <nl> + else <nl> + uniqueAddons . insert ( make_pair ( ( * it2 ) - > ID ( ) , * it2 ) ) ; <nl> + } <nl> + } <nl> + <nl> + if ( uniqueAddons . empty ( ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " Repository % s returned no add - ons , listing may have failed " , repo - > Name ( ) . c_str ( ) ) ; <nl> reposum = checksum ; / / don ' t update the checksum <nl> VECADDONS CRepositoryUpdateJob : : GrabAddons ( RepositoryPtr & repo ) <nl> add = CDirectory : : GetDirectory ( s , dummy ) ; <nl> } <nl> if ( add ) <nl> + { <nl> + for ( map < string , AddonPtr > : : const_iterator i = uniqueAddons . begin ( ) ; i ! = uniqueAddons . end ( ) ; + + i ) <nl> + addons . push_back ( i - > second ) ; <nl> database . AddRepository ( repo - > ID ( ) , addons , reposum ) ; <nl> + } <nl> } <nl> } <nl> else <nl> mmm a / xbmc / addons / Repository . h <nl> ppp b / xbmc / addons / Repository . h <nl> namespace ADDON <nl> \ return the md5 hash for the given addon , empty if non exists . <nl> * / <nl> CStdString GetAddonHash ( const AddonPtr & addon ) ; <nl> - VECADDONS Parse ( ) ; <nl> + <nl> + struct DirInfo <nl> + { <nl> + DirInfo ( ) : version ( " 0 . 0 . 0 " ) , compressed ( false ) , zipped ( false ) , hashes ( false ) { } <nl> + AddonVersion version ; <nl> + std : : string info ; <nl> + std : : string checksum ; <nl> + std : : string datadir ; <nl> + bool compressed ; <nl> + bool zipped ; <nl> + bool hashes ; <nl> + } ; <nl> + <nl> + typedef std : : vector < DirInfo > DirList ; <nl> + DirList m_dirs ; <nl> + <nl> + static VECADDONS Parse ( const DirInfo & dir ) ; <nl> private : <nl> CStdString FetchChecksum ( const CStdString & url ) ; <nl> CRepository ( const CRepository & rhs ) ; <nl> - CStdString m_info ; <nl> - CStdString m_checksum ; <nl> - CStdString m_datadir ; <nl> - bool m_compressed ; / / gzipped info xml <nl> - bool m_zipped ; / / zipped addons <nl> - bool m_hashes ; / / repo supports hashes . e . g . plugin . i . rule - 1 . 0 . 5 . zip . md5 <nl> + <nl> CCriticalSection m_critSection ; <nl> } ; <nl> <nl>
allow repository add - ons to point to multiple add - on repos , versioned by xbmc . addon version .
xbmc/xbmc
53b62120ee24f06f429558df4c0ec87f8efb53b2
2013-10-28T08:53:23Z
mmm a / src / arch / linux / event_queue . cc <nl> ppp b / src / arch / linux / event_queue . cc <nl> struct linux_event_watcher_guts_t : <nl> signal_t * aborter ; <nl> <nl> void watch ( const boost : : function < void ( ) > & cb , signal_t * ab ) { <nl> - rassert ( ! callback & & ! aborter ) ; <nl> + rassert ( ! is_watching ( ) ) ; <nl> rassert ( cb & & ab ) ; <nl> if ( ! ab - > is_pulsed ( ) ) { <nl> callback = cb ; <nl> struct linux_event_watcher_guts_t : <nl> } <nl> } <nl> <nl> + bool is_watching ( ) { <nl> + / * We should have neither or both a callback and an aborter * / <nl> + rassert ( callback . empty ( ) = = ( aborter = = NULL ) ) ; <nl> + return ! callback . empty ( ) ; <nl> + } <nl> + <nl> void pulse ( ) { <nl> - rassert ( callback & & aborter , " % p got a pulse ( ) when event mask is % d " , parent , parent - > old_mask ) ; <nl> + rassert ( is_watching ( ) , " % p got a pulse ( ) when event mask is % d " , parent , parent - > old_mask ) ; <nl> aborter - > remove_waiter ( this ) ; <nl> boost : : function < void ( ) > temp = callback ; <nl> callback = 0 ; <nl> struct linux_event_watcher_guts_t : <nl> } <nl> <nl> void on_signal_pulsed ( ) { <nl> - rassert ( callback & & aborter ) ; <nl> + rassert ( is_watching ( ) ) ; <nl> callback = 0 ; <nl> aborter = NULL ; <nl> parent - > remask ( ) ; <nl> struct linux_event_watcher_guts_t : <nl> handler - > watch ( cb , ab ) ; <nl> } <nl> <nl> + bool is_watching ( int event ) { <nl> + assert_thread ( ) ; <nl> + switch ( event ) { <nl> + case poll_event_in : return read_handler . is_watching ( ) ; <nl> + case poll_event_out : return write_handler . is_watching ( ) ; <nl> + default : crash ( " expected poll_event_in or poll_event_out " ) ; <nl> + } <nl> + } <nl> + <nl> void remask ( ) { <nl> / * Change our registration with the event queue depending on what events <nl> we are actually waiting for . * / <nl> <nl> int new_mask = 0 ; <nl> - if ( read_handler . callback ) new_mask | = poll_event_in ; <nl> - if ( write_handler . callback ) new_mask | = poll_event_out ; <nl> + if ( read_handler . is_watching ( ) ) new_mask | = poll_event_in ; <nl> + if ( write_handler . is_watching ( ) ) new_mask | = poll_event_out ; <nl> <nl> if ( old_mask ! = new_mask ) { <nl> linux_thread_pool_t : : thread - > queue . adjust_resource ( fd , new_mask , this ) ; <nl> void linux_event_watcher_t : : watch ( int event , const boost : : function < void ( ) > & cb , <nl> guts - > watch ( event , cb , ab ) ; <nl> } <nl> <nl> + bool linux_event_watcher_t : : is_watching ( int event ) { <nl> + return guts - > is_watching ( event ) ; <nl> + } <nl> + <nl> mmm a / src / arch / linux / event_queue . hpp <nl> ppp b / src / arch / linux / event_queue . hpp <nl> struct linux_event_watcher_t { <nl> cancelled . * / <nl> void watch ( int event , const boost : : function < void ( ) > & callback , signal_t * aborter ) ; <nl> <nl> + / * Returns ` true ` if ` watch ( ) ` was called for events of type ` event ` but has <nl> + not completed or been aborted yet . ` event ` should be ` poll_event_in ` or <nl> + ` poll_event_out ` . * / <nl> + bool is_watching ( int event ) ; <nl> + <nl> private : <nl> / * The guts are a separate object so that if one of the callbacks we call destroys us , <nl> we don ' t have to destroy the guts immediately . * / <nl> mmm a / src / arch / linux / network . cc <nl> ppp b / src / arch / linux / network . cc <nl> void linux_tcp_conn_t : : on_event ( int events ) { <nl> / * This is called by linux_event_watcher_t when error events occur . Ordinary <nl> poll_event_in / poll_event_out events are not sent through this function . * / <nl> <nl> - if ( events = = ( poll_event_err | poll_event_hup ) & & write_in_progress ) { <nl> - / * We get this when the socket is closed but there is still data we are trying to send . <nl> - For example , it can sometimes be reproduced by sending " nonsense \ r \ n " and then sending <nl> - " set [ key ] 0 0 [ length ] noreply \ r \ n [ value ] \ r \ n " a hundred times then immediately closing the <nl> - socket . <nl> + bool reading = event_watcher - > is_watching ( poll_event_in ) ; <nl> + bool writing = event_watcher - > is_watching ( poll_event_out ) ; <nl> <nl> - I speculate that the " error " part comes from the fact that there is undelivered data <nl> - in the socket send buffer , and the " hup " part comes from the fact that the remote end <nl> - has hung up . <nl> + if ( events = = ( poll_event_err | poll_event_hup ) ) { <nl> <nl> - The same can happen for reads , see next case . * / <nl> + / * HEY : What ' s the significance of these ' if ' statements ? Do they actually make <nl> + any sense ? Why don ' t we just close both halves of the socket ? * / <nl> <nl> - on_shutdown_write ( ) ; <nl> + if ( writing ) { <nl> + / * We get this when the socket is closed but there is still data we are trying to send . <nl> + For example , it can sometimes be reproduced by sending " nonsense \ r \ n " and then sending <nl> + " set [ key ] 0 0 [ length ] noreply \ r \ n [ value ] \ r \ n " a hundred times then immediately closing <nl> + the socket . <nl> <nl> - } else if ( events = = ( poll_event_err | poll_event_hup ) & & read_in_progress ) { <nl> - / * See description for write case above * / <nl> - on_shutdown_read ( ) ; <nl> + I speculate that the " error " part comes from the fact that there is undelivered data <nl> + in the socket send buffer , and the " hup " part comes from the fact that the remote end <nl> + has hung up . <nl> <nl> - } else if ( events & poll_event_err ) { <nl> - / * We don ' t know why we got this , so shut the hell down . * / <nl> - logERR ( " Unexpected poll_event_err . events = % s , read = % s , write = % s \ n " , <nl> + The same can happen for reads , see next case . * / <nl> + <nl> + on_shutdown_write ( ) ; <nl> + } <nl> + <nl> + if ( reading ) { <nl> + / * See description for write case above * / <nl> + on_shutdown_read ( ) ; <nl> + } <nl> + <nl> + if ( ! reading & & ! writing ) { <nl> + / * We often get a combination of poll_event_err and poll_event_hup when a socket <nl> + suddenly disconnects . It seems safe to assume it just indicates a hang - up . * / <nl> + if ( ! read_closed . is_pulsed ( ) ) shutdown_read ( ) ; <nl> + if ( ! write_closed . is_pulsed ( ) ) shutdown_write ( ) ; <nl> + } <nl> + <nl> + } else { <nl> + / * We don ' t know why we got this , so log it and then shut down * / <nl> + logERR ( " Unexpected epoll err / hup / rdhup . events = % s , reading = % s , writing = % s \ n " , <nl> format_poll_event ( events ) . c_str ( ) , <nl> - read_in_progress ? " yes " : " no " , <nl> - write_in_progress ? " yes " : " no " ) ; <nl> + reading ? " yes " : " no " , <nl> + writing ? " yes " : " no " ) ; <nl> if ( ! read_closed . is_pulsed ( ) ) shutdown_read ( ) ; <nl> if ( ! write_closed . is_pulsed ( ) ) shutdown_write ( ) ; <nl> } <nl>
When the network connection wants to know if we ' re currently blocking on a read / write , it should check with the linux_event_watcher_t directly . Closes .
rethinkdb/rethinkdb
f8a37ef51df8088f9f5108edef6c38da157c538b
2011-05-14T02:34:47Z
mmm a / data / CMakeLists . txt <nl> ppp b / data / CMakeLists . txt <nl> file ( GLOB LBP_CASCADES lbpcascades / * . xml ) <nl> if ( ANDROID ) <nl> install ( FILES $ { HAAR_CASCADES } DESTINATION sdk / etc / haarcascades COMPONENT libs ) <nl> install ( FILES $ { LBP_CASCADES } DESTINATION sdk / etc / lbpcascades COMPONENT libs ) <nl> - elseif ( NOT WIN32 ) <nl> + else ( ) <nl> install ( FILES $ { HAAR_CASCADES } DESTINATION share / OpenCV / haarcascades COMPONENT libs ) <nl> install ( FILES $ { LBP_CASCADES } DESTINATION share / OpenCV / lbpcascades COMPONENT libs ) <nl> endif ( ) <nl>
Install data on Windows
opencv/opencv
592122bf4fcadb2f653c95b8d6e0d69fc0d44ba0
2015-03-10T09:55:17Z
mmm a / cpp / README <nl> ppp b / cpp / README <nl> Requirements : <nl> $ sudo apt - get install cmake - curses - gui <nl> <nl> - Protocol Buffers <nl> - http : / / code . google . com / p / protobuf / <nl> + http : / / github . com / google / protobuf / <nl> Version 2 . 4 or more recent is required ( this is available by default for <nl> recent Debian - based GNU / Linux distributions ) . <nl> <nl> Requirements : <nl> $ . / configure & & make & & sudo make install <nl> <nl> - Google Test <nl> - http : / / code . google . com / p / googletest / <nl> + http : / / github . com / google / googletest <nl> <nl> Installation : <nl> $ sudo apt - get install libgtest - dev <nl> <nl> - RE2 <nl> - http : / / code . google . com / p / re2 / <nl> + http : / / github . com / google / re2 <nl> <nl> Installation : <nl> $ sudo apt - get install libre2 - dev <nl>
Fixing code . google . com links to point to github instead ( )
google/libphonenumber
1a513f6477180330d34eabae55b9c1919e46d9be
2018-08-21T08:07:40Z
deleted file mode 100644 <nl> index 3b1ff2aab85 . . 00000000000 <nl> mmm a / modules / bridge / dag / bridge . dag <nl> ppp / dev / null <nl> <nl> - module_config { <nl> - module_library : " / apollo / bazel - bin / modules / bridge / libudp_bridge_component . so " <nl> - components { <nl> - class_name : " UDPBridgeSenderComponent < planning : : ADCTrajectory > " <nl> - config { <nl> - name : " bridge_ADCTrajectory " <nl> - config_file_path : " / apollo / modules / bridge / conf / udp_bridge_sender_adctrajectory . pb . txt " <nl> - readers { <nl> - channel : " / apollo / planning " <nl> - } <nl> - } <nl> - } <nl> - <nl> - components { <nl> - class_name : " UDPBridgeSenderComponent < localization : : LocalizationEstimate > " <nl> - config { <nl> - name : " bridge_LocalizationEstimate " <nl> - config_file_path : " / apollo / modules / bridge / conf / udp_bridge_sender_localization . pb . txt " <nl> - readers { <nl> - channel : " / apollo / localization / pose " <nl> - } <nl> - } <nl> - } <nl> - } <nl>
Bridge : removed unnecessary dag file
ApolloAuto/apollo
5917f645a6241b9a051b91e7eae2edef6094d2c8
2019-07-09T01:54:00Z
mmm a / lib / IRGen / GenMeta . cpp <nl> ppp b / lib / IRGen / GenMeta . cpp <nl> void IRGenModule : : addFieldTypes ( ArrayRef < CanType > fieldTypes ) { <nl> IRGen . addFieldTypes ( fieldTypes , this ) ; <nl> } <nl> <nl> + static void emitInitializeFieldOffsetVector ( IRGenFunction & IGF , <nl> + SILType T , <nl> + llvm : : Value * metadata , <nl> + bool isVWTMutable , <nl> + MetadataDependencyCollector * collector ) { <nl> + auto * target = T . getNominalOrBoundGenericNominal ( ) ; <nl> + llvm : : Value * fieldVector <nl> + = emitAddressOfFieldOffsetVector ( IGF , metadata , target ) <nl> + . getAddress ( ) ; <nl> + <nl> + / / Collect the stored properties of the type . <nl> + llvm : : SmallVector < VarDecl * , 4 > storedProperties ; <nl> + for ( auto prop : target - > getStoredProperties ( ) ) { <nl> + storedProperties . push_back ( prop ) ; <nl> + } <nl> + <nl> + / / Fill out an array with the field type metadata records . <nl> + Address fields = IGF . createAlloca ( <nl> + llvm : : ArrayType : : get ( IGF . IGM . Int8PtrPtrTy , <nl> + storedProperties . size ( ) ) , <nl> + IGF . IGM . getPointerAlignment ( ) , " classFields " ) ; <nl> + IGF . Builder . CreateLifetimeStart ( fields , <nl> + IGF . IGM . getPointerSize ( ) * storedProperties . size ( ) ) ; <nl> + fields = IGF . Builder . CreateStructGEP ( fields , 0 , Size ( 0 ) ) ; <nl> + <nl> + unsigned index = 0 ; <nl> + for ( auto prop : storedProperties ) { <nl> + auto propTy = T . getFieldType ( prop , IGF . getSILModule ( ) ) ; <nl> + llvm : : Value * metadata = emitTypeLayoutRef ( IGF , propTy , collector ) ; <nl> + Address field = IGF . Builder . CreateConstArrayGEP ( fields , index , <nl> + IGF . IGM . getPointerSize ( ) ) ; <nl> + IGF . Builder . CreateStore ( metadata , field ) ; <nl> + + + index ; <nl> + } <nl> + <nl> + / / Ask the runtime to lay out the struct or class . <nl> + auto numFields = IGF . IGM . getSize ( Size ( storedProperties . size ( ) ) ) ; <nl> + <nl> + if ( auto * classDecl = dyn_cast < ClassDecl > ( target ) ) { <nl> + / / Compute class layout flags . <nl> + ClassLayoutFlags flags = ClassLayoutFlags : : Swift5Algorithm ; <nl> + if ( ! doesClassMetadataRequireRelocation ( IGF . IGM , classDecl ) ) <nl> + flags | = ClassLayoutFlags : : HasStaticVTable ; <nl> + <nl> + / / Get the superclass metadata , if the class has one . <nl> + llvm : : Value * superclassMetadata ; <nl> + if ( auto superclassType = classDecl - > getSuperclass ( ) ) { <nl> + superclassType = classDecl - > mapTypeIntoContext ( superclassType ) ; <nl> + <nl> + auto request = DynamicMetadataRequest : : getNonBlocking ( <nl> + MetadataState : : NonTransitiveComplete , collector ) ; <nl> + <nl> + superclassMetadata = <nl> + emitClassHeapMetadataRef ( IGF , superclassType - > getCanonicalType ( ) , <nl> + MetadataValueType : : TypeMetadata , <nl> + request , <nl> + / * allowUninit * / false ) ; <nl> + } else { <nl> + superclassMetadata = <nl> + llvm : : ConstantPointerNull : : get ( IGF . IGM . TypeMetadataPtrTy ) ; <nl> + } <nl> + <nl> + / / Call swift_initClassMetadata ( ) . <nl> + IGF . Builder . CreateCall ( IGF . IGM . getInitClassMetadataFn ( ) , <nl> + { metadata , superclassMetadata , <nl> + IGF . IGM . getSize ( Size ( uintptr_t ( flags ) ) ) , <nl> + numFields , fields . getAddress ( ) , fieldVector } ) ; <nl> + } else { <nl> + assert ( isa < StructDecl > ( target ) ) ; <nl> + <nl> + / / Compute struct layout flags . <nl> + StructLayoutFlags flags = StructLayoutFlags : : Swift5Algorithm ; <nl> + if ( isVWTMutable ) <nl> + flags | = StructLayoutFlags : : IsVWTMutable ; <nl> + <nl> + / / Call swift_initStructMetadata ( ) . <nl> + IGF . Builder . CreateCall ( IGF . IGM . getInitStructMetadataFn ( ) , <nl> + { metadata , IGF . IGM . getSize ( Size ( uintptr_t ( flags ) ) ) , <nl> + numFields , fields . getAddress ( ) , fieldVector } ) ; <nl> + } <nl> + <nl> + IGF . Builder . CreateLifetimeEnd ( fields , <nl> + IGF . IGM . getPointerSize ( ) * storedProperties . size ( ) ) ; <nl> + } <nl> + <nl> + static void emitInitializeMetadata ( IRGenFunction & IGF , <nl> + NominalTypeDecl * nominalDecl , <nl> + llvm : : Value * metadata , <nl> + bool isVWTMutable , <nl> + MetadataDependencyCollector * collector ) { <nl> + auto loweredTy = <nl> + IGF . IGM . getLoweredType ( nominalDecl - > getDeclaredTypeInContext ( ) ) ; <nl> + <nl> + if ( isa < StructDecl > ( nominalDecl ) ) { <nl> + auto & fixedTI = IGF . IGM . getTypeInfo ( loweredTy ) ; <nl> + if ( isa < FixedTypeInfo > ( fixedTI ) ) return ; <nl> + <nl> + emitInitializeFieldOffsetVector ( IGF , loweredTy , metadata , isVWTMutable , <nl> + collector ) ; <nl> + } else { <nl> + assert ( isa < EnumDecl > ( nominalDecl ) ) ; <nl> + auto & strategy = getEnumImplStrategy ( IGF . IGM , loweredTy ) ; <nl> + strategy . initializeMetadata ( IGF , metadata , isVWTMutable , loweredTy , <nl> + collector ) ; <nl> + } <nl> + } <nl> + <nl> + static void emitInitializeClassMetadata ( IRGenFunction & IGF , <nl> + ClassDecl * classDecl , <nl> + const ClassLayout & fieldLayout , <nl> + llvm : : Value * metadata , <nl> + MetadataDependencyCollector * collector ) { <nl> + auto & IGM = IGF . IGM ; <nl> + <nl> + assert ( doesClassMetadataRequireInitialization ( IGM , classDecl ) ) ; <nl> + <nl> + auto loweredTy = <nl> + IGM . getLoweredType ( classDecl - > getDeclaredTypeInContext ( ) ) ; <nl> + <nl> + / / Set the superclass , fill out the field offset vector , and copy vtable <nl> + / / entries , generic requirements and field offsets from superclasses . <nl> + emitInitializeFieldOffsetVector ( IGF , loweredTy , <nl> + metadata , / * VWT is mutable * / false , <nl> + collector ) ; <nl> + <nl> + / / Realizing the class with the ObjC runtime will copy back to the <nl> + / / field offset globals for us ; but if ObjC interop is disabled , we <nl> + / / have to do that ourselves , assuming we didn ' t just emit them all <nl> + / / correctly in the first place . <nl> + if ( ! IGM . ObjCInterop ) { <nl> + for ( auto prop : classDecl - > getStoredProperties ( ) ) { <nl> + auto fieldInfo = fieldLayout . getFieldAccessAndElement ( prop ) ; <nl> + if ( fieldInfo . first = = FieldAccess : : NonConstantDirect ) { <nl> + Address offsetA = IGM . getAddrOfFieldOffset ( prop , ForDefinition ) ; <nl> + <nl> + / / We can ' t use emitClassFieldOffset ( ) here because that creates <nl> + / / an invariant load , which could be hoisted above the point <nl> + / / where the metadata becomes fully initialized <nl> + auto slot = <nl> + emitAddressOfClassFieldOffset ( IGF , metadata , classDecl , prop ) ; <nl> + auto offsetVal = IGF . emitInvariantLoad ( slot ) ; <nl> + IGF . Builder . CreateStore ( offsetVal , offsetA ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + if ( ! doesClassMetadataRequireRelocation ( IGM , classDecl ) ) <nl> + return ; <nl> + <nl> + / / Update vtable entries for method overrides . The runtime copies in <nl> + / / the vtable from the superclass for us ; we have to install method <nl> + / / overrides ourselves . <nl> + auto * vtable = IGM . getSILModule ( ) . lookUpVTable ( classDecl ) ; <nl> + for ( auto & entry : vtable - > getEntries ( ) ) { <nl> + if ( entry . TheKind ! = SILVTable : : Entry : : Kind : : Override ) <nl> + continue ; <nl> + <nl> + auto fn = entry . Method ; <nl> + <nl> + auto * classDecl = cast < ClassDecl > ( fn . getDecl ( ) - > getDeclContext ( ) ) ; <nl> + auto & layout = IGM . getClassMetadataLayout ( classDecl ) ; <nl> + <nl> + auto offset = layout . getMethodInfo ( IGF , fn ) . getOffset ( ) ; <nl> + <nl> + auto slot = IGF . emitAddressAtOffset ( metadata , offset , <nl> + IGM . Int8PtrTy , <nl> + IGM . getPointerAlignment ( ) ) ; <nl> + <nl> + auto * implFn = IGM . getAddrOfSILFunction ( entry . Implementation , <nl> + NotForDefinition ) ; <nl> + auto * value = IGF . Builder . CreateBitCast ( implFn , IGM . Int8PtrTy ) ; <nl> + IGF . Builder . CreateStore ( value , slot ) ; <nl> + } <nl> + } <nl> + <nl> + static MetadataKind getMetadataKind ( NominalTypeDecl * nominalDecl ) { <nl> + if ( isa < StructDecl > ( nominalDecl ) ) <nl> + return MetadataKind : : Struct ; <nl> + <nl> + assert ( isa < EnumDecl > ( nominalDecl ) ) ; <nl> + return ( nominalDecl - > isOptionalDecl ( ) <nl> + ? MetadataKind : : Optional <nl> + : MetadataKind : : Enum ) ; <nl> + } <nl> + <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * * Metadata Emission * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> namespace { <nl> GenericMetadataPatternFlags getPatternFlags ( ) { <nl> auto flags = super : : getPatternFlags ( ) ; <nl> <nl> - flags . value_setMetadataKind ( asImpl ( ) . getMetadataKind ( ) ) ; <nl> + flags . value_setMetadataKind ( getMetadataKind ( Target ) ) ; <nl> <nl> assert ( ! asImpl ( ) . hasImmediateMembersPattern ( ) ) ; <nl> <nl> namespace { <nl> auto table = asImpl ( ) . emitValueWitnessTable ( ) ; <nl> B . addRelativeAddress ( table ) ; <nl> } <nl> - } ; <nl> - } / / end anonymous namespace <nl> - <nl> - static void emitInitializeFieldOffsetVector ( IRGenFunction & IGF , <nl> - SILType T , <nl> - llvm : : Value * metadata , <nl> - bool isVWTMutable , <nl> - MetadataDependencyCollector * collector ) { <nl> - auto * target = T . getNominalOrBoundGenericNominal ( ) ; <nl> - llvm : : Value * fieldVector <nl> - = emitAddressOfFieldOffsetVector ( IGF , metadata , target ) <nl> - . getAddress ( ) ; <nl> <nl> - / / Collect the stored properties of the type . <nl> - llvm : : SmallVector < VarDecl * , 4 > storedProperties ; <nl> - for ( auto prop : target - > getStoredProperties ( ) ) { <nl> - storedProperties . push_back ( prop ) ; <nl> - } <nl> - <nl> - / / Fill out an array with the field type metadata records . <nl> - Address fields = IGF . createAlloca ( <nl> - llvm : : ArrayType : : get ( IGF . IGM . Int8PtrPtrTy , <nl> - storedProperties . size ( ) ) , <nl> - IGF . IGM . getPointerAlignment ( ) , " classFields " ) ; <nl> - IGF . Builder . CreateLifetimeStart ( fields , <nl> - IGF . IGM . getPointerSize ( ) * storedProperties . size ( ) ) ; <nl> - fields = IGF . Builder . CreateStructGEP ( fields , 0 , Size ( 0 ) ) ; <nl> - <nl> - unsigned index = 0 ; <nl> - for ( auto prop : storedProperties ) { <nl> - auto propTy = T . getFieldType ( prop , IGF . getSILModule ( ) ) ; <nl> - llvm : : Value * metadata = emitTypeLayoutRef ( IGF , propTy , collector ) ; <nl> - Address field = IGF . Builder . CreateConstArrayGEP ( fields , index , <nl> - IGF . IGM . getPointerSize ( ) ) ; <nl> - IGF . Builder . CreateStore ( metadata , field ) ; <nl> - + + index ; <nl> - } <nl> - <nl> - / / Ask the runtime to lay out the struct or class . <nl> - auto numFields = IGF . IGM . getSize ( Size ( storedProperties . size ( ) ) ) ; <nl> - <nl> - if ( auto * classDecl = dyn_cast < ClassDecl > ( target ) ) { <nl> - / / Compute class layout flags . <nl> - ClassLayoutFlags flags = ClassLayoutFlags : : Swift5Algorithm ; <nl> - if ( ! doesClassMetadataRequireRelocation ( IGF . IGM , classDecl ) ) <nl> - flags | = ClassLayoutFlags : : HasStaticVTable ; <nl> - <nl> - / / Get the superclass metadata , if the class has one . <nl> - llvm : : Value * superclassMetadata ; <nl> - if ( auto superclassType = classDecl - > getSuperclass ( ) ) { <nl> - superclassType = classDecl - > mapTypeIntoContext ( superclassType ) ; <nl> - <nl> - auto request = DynamicMetadataRequest : : getNonBlocking ( <nl> - MetadataState : : NonTransitiveComplete , collector ) ; <nl> - <nl> - superclassMetadata = <nl> - emitClassHeapMetadataRef ( IGF , superclassType - > getCanonicalType ( ) , <nl> - MetadataValueType : : TypeMetadata , <nl> - request , <nl> - / * allowUninit * / false ) ; <nl> - } else { <nl> - superclassMetadata = <nl> - llvm : : ConstantPointerNull : : get ( IGF . IGM . TypeMetadataPtrTy ) ; <nl> + void emitInitializeMetadata ( IRGenFunction & IGF , <nl> + llvm : : Value * metadata , <nl> + bool isVWTMutable , <nl> + MetadataDependencyCollector * collector ) { <nl> + : : emitInitializeMetadata ( IGF , Target , metadata , isVWTMutable , collector ) ; <nl> } <nl> - <nl> - / / Call swift_initClassMetadata ( ) . <nl> - IGF . Builder . CreateCall ( IGF . IGM . getInitClassMetadataFn ( ) , <nl> - { metadata , superclassMetadata , <nl> - IGF . IGM . getSize ( Size ( uintptr_t ( flags ) ) ) , <nl> - numFields , fields . getAddress ( ) , fieldVector } ) ; <nl> - } else { <nl> - assert ( isa < StructDecl > ( target ) ) ; <nl> - <nl> - / / Compute struct layout flags . <nl> - StructLayoutFlags flags = StructLayoutFlags : : Swift5Algorithm ; <nl> - if ( isVWTMutable ) <nl> - flags | = StructLayoutFlags : : IsVWTMutable ; <nl> - <nl> - / / Call swift_initStructMetadata ( ) . <nl> - IGF . Builder . CreateCall ( IGF . IGM . getInitStructMetadataFn ( ) , <nl> - { metadata , IGF . IGM . getSize ( Size ( uintptr_t ( flags ) ) ) , <nl> - numFields , fields . getAddress ( ) , fieldVector } ) ; <nl> - } <nl> - <nl> - IGF . Builder . CreateLifetimeEnd ( fields , <nl> - IGF . IGM . getPointerSize ( ) * storedProperties . size ( ) ) ; <nl> - } <nl> + } ; <nl> + } / / end anonymous namespace <nl> <nl> / / / Create an access function for the given type which triggers the <nl> / / / in - place initialization path . <nl> createInPlaceInitializationMetadataAccessFunction ( IRGenModule & IGM , <nl> <nl> / / Classes <nl> <nl> + / / / Emit the base - offset variable for the class . <nl> + static void emitClassMetadataBaseOffset ( IRGenModule & IGM , <nl> + ClassDecl * classDecl ) { <nl> + / / Otherwise , we know the offset at compile time , even if our <nl> + / / clients do not , so just emit a constant . <nl> + auto & layout = IGM . getClassMetadataLayout ( classDecl ) ; <nl> + <nl> + / / Only classes defined in resilient modules , or those that have <nl> + / / a resilient superclass need this . <nl> + if ( ! layout . hasResilientSuperclass ( ) & & <nl> + ! IGM . isResilient ( classDecl , ResilienceExpansion : : Minimal ) ) { <nl> + return ; <nl> + } <nl> + <nl> + auto * offsetAddr = <nl> + IGM . getAddrOfClassMetadataBounds ( classDecl , ForDefinition ) ; <nl> + auto * offsetVar = cast < llvm : : GlobalVariable > ( offsetAddr ) ; <nl> + <nl> + if ( layout . hasResilientSuperclass ( ) ) { <nl> + / / If the superclass is resilient to us , we have to compute and <nl> + / / initialize the global when we initialize the metadata . <nl> + auto init = llvm : : ConstantAggregateZero : : get ( offsetVar - > getValueType ( ) ) ; <nl> + <nl> + offsetVar - > setInitializer ( init ) ; <nl> + offsetVar - > setConstant ( false ) ; <nl> + return ; <nl> + } <nl> + <nl> + auto immediateMembersOffset = layout . getStartOfImmediateMembers ( ) ; <nl> + auto size = layout . getSize ( ) ; <nl> + auto negativeSizeInWords = size . AddressPoint / IGM . getPointerSize ( ) ; <nl> + auto positiveSizeInWords = size . getOffsetToEnd ( ) / IGM . getPointerSize ( ) ; <nl> + <nl> + auto initTy = cast < llvm : : StructType > ( offsetVar - > getValueType ( ) ) ; <nl> + auto * init = llvm : : ConstantStruct : : get ( initTy , { <nl> + llvm : : ConstantInt : : get ( IGM . SizeTy , immediateMembersOffset . getValue ( ) ) , <nl> + llvm : : ConstantInt : : get ( IGM . Int32Ty , negativeSizeInWords ) , <nl> + llvm : : ConstantInt : : get ( IGM . Int32Ty , positiveSizeInWords ) <nl> + } ) ; <nl> + <nl> + offsetVar - > setInitializer ( init ) ; <nl> + offsetVar - > setConstant ( true ) ; <nl> + } <nl> + <nl> + static Optional < llvm : : Constant * > <nl> + getAddrOfDestructorFunction ( IRGenModule & IGM , ClassDecl * classDecl ) { <nl> + auto dtorRef = SILDeclRef ( classDecl - > getDestructor ( ) , <nl> + SILDeclRef : : Kind : : Deallocator ) ; <nl> + SILFunction * dtorFunc = IGM . getSILModule ( ) . lookUpFunction ( dtorRef ) ; <nl> + if ( ! dtorFunc ) return llvm : : None ; <nl> + return IGM . getAddrOfSILFunction ( dtorFunc , NotForDefinition ) ; <nl> + } <nl> + <nl> static void emitFieldOffsetGlobals ( IRGenModule & IGM , <nl> ClassDecl * classDecl , <nl> const ClassLayout & classLayout ) { <nl> static void emitFieldOffsetGlobals ( IRGenModule & IGM , <nl> } <nl> } <nl> <nl> + static ClassFlags getClassFlags ( ClassDecl * classDecl ) { <nl> + auto flags = ClassFlags ( ) ; <nl> + <nl> + # if ! SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT <nl> + / / FIXME : Remove this after enabling stable ABI . <nl> + / / This bit is NOT conditioned on UseDarwinPreStableABIBit . <nl> + flags | = ClassFlags : : IsSwiftPreStableABI ; <nl> + # endif <nl> + <nl> + / / Set a flag if the class uses Swift refcounting . <nl> + auto type = classDecl - > getDeclaredType ( ) - > getCanonicalType ( ) ; <nl> + if ( type - > getReferenceCounting ( ) = = ReferenceCounting : : Native ) { <nl> + flags | = ClassFlags : : UsesSwiftRefcounting ; <nl> + } <nl> + <nl> + / / Set a flag if the class has a custom ObjC name . <nl> + DeclAttributes attrs = classDecl - > getAttrs ( ) ; <nl> + if ( auto objc = attrs . getAttribute < ObjCAttr > ( ) ) { <nl> + if ( objc - > getName ( ) ) <nl> + flags | = ClassFlags : : HasCustomObjCName ; <nl> + } <nl> + if ( attrs . hasAttribute < ObjCRuntimeNameAttr > ( ) ) <nl> + flags | = ClassFlags : : HasCustomObjCName ; <nl> + <nl> + return flags ; <nl> + } <nl> + <nl> namespace { <nl> / / / Utility class for building member metadata for classes where the <nl> / / / entire hierarchy is in the current resilience domain , and all stored <nl> namespace { <nl> B . addBitCast ( IGM . getDeletedMethodErrorFn ( ) , IGM . FunctionPtrTy ) ; <nl> } <nl> <nl> - void emitInitializeMethodOverrides ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata ) { <nl> - / / Emitted statically by the above . <nl> - } <nl> - <nl> void addGenericArgument ( ClassDecl * forClass ) { <nl> llvm_unreachable ( " Fixed class metadata cannot have generic parameters " ) ; <nl> } <nl> namespace { <nl> B . addBitCast ( IGM . getDeletedMethodErrorFn ( ) , IGM . FunctionPtrTy ) ; <nl> } <nl> <nl> - void emitInitializeMethodOverrides ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata ) { <nl> - / / Emitted statically by the above . <nl> - } <nl> - <nl> void addGenericArgument ( ClassDecl * forClass ) { <nl> / / Filled in at runtime . <nl> B . addNullPointer ( IGM . TypeMetadataPtrTy ) ; <nl> namespace { <nl> / / / ancestry . The total size of the class metadata is not known at compile <nl> / / / time , and requires relocation . <nl> class ResilientClassMemberBuilder { <nl> - IRGenModule & IGM ; <nl> - SILVTable * VTable ; <nl> - <nl> public : <nl> ResilientClassMemberBuilder ( IRGenModule & IGM , <nl> ConstantStructBuilder & builder , <nl> - SILVTable * vtable ) <nl> - : IGM ( IGM ) , VTable ( vtable ) { } <nl> + SILVTable * vtable ) { } <nl> <nl> void addFieldOffset ( VarDecl * var ) { } <nl> <nl> namespace { <nl> <nl> void addMethod ( SILDeclRef fn ) { } <nl> <nl> - / / Update vtable entries for method overrides . The runtime copies in <nl> - / / the vtable from the superclass for us ; we have to install method <nl> - / / overrides ourselves . <nl> - void emitInitializeMethodOverrides ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata ) { <nl> - for ( auto & entry : VTable - > getEntries ( ) ) { <nl> - if ( entry . TheKind ! = SILVTable : : Entry : : Kind : : Override ) <nl> - continue ; <nl> - <nl> - auto fn = entry . Method ; <nl> - <nl> - auto * classDecl = cast < ClassDecl > ( fn . getDecl ( ) - > getDeclContext ( ) ) ; <nl> - auto & layout = IGM . getClassMetadataLayout ( classDecl ) ; <nl> - <nl> - auto offset = layout . getMethodInfo ( IGF , fn ) . getOffset ( ) ; <nl> - <nl> - auto slot = IGF . emitAddressAtOffset ( metadata , offset , <nl> - IGM . Int8PtrTy , <nl> - IGM . getPointerAlignment ( ) ) ; <nl> - <nl> - auto * implFn = IGM . getAddrOfSILFunction ( entry . Implementation , <nl> - NotForDefinition ) ; <nl> - auto * value = IGF . Builder . CreateBitCast ( implFn , IGM . Int8PtrTy ) ; <nl> - IGF . Builder . CreateStore ( value , slot ) ; <nl> - } <nl> - } <nl> - <nl> void addGenericArgument ( ClassDecl * forClass ) { } <nl> <nl> void addGenericWitnessTable ( ClassDecl * forClass ) { } <nl> namespace { <nl> IGM . getSILModule ( ) . lookUpVTable ( theClass ) ) { } <nl> <nl> public : <nl> + void addClassFlags ( ) { <nl> + B . addInt32 ( ( uint32_t ) getClassFlags ( Target ) ) ; <nl> + } <nl> + <nl> void noteResilientSuperclass ( ) { } <nl> <nl> void noteStartOfImmediateMembers ( ClassDecl * theClass ) { <nl> if ( theClass = = Target ) { <nl> - emitClassMetadataBaseOffset ( ) ; <nl> - } <nl> - } <nl> - <nl> - / / / Emit the base - offset variable for the class . <nl> - void emitClassMetadataBaseOffset ( ) { <nl> - / / Only classes defined in resilient modules , or those that have <nl> - / / a resilient superclass need this . <nl> - if ( ! MetadataLayout . hasResilientSuperclass ( ) & & <nl> - ! IGM . isResilient ( Target , ResilienceExpansion : : Minimal ) ) { <nl> - return ; <nl> + emitClassMetadataBaseOffset ( IGM , theClass ) ; <nl> } <nl> - <nl> - auto * offsetAddr = <nl> - IGM . getAddrOfClassMetadataBounds ( Target , ForDefinition ) ; <nl> - auto * offsetVar = cast < llvm : : GlobalVariable > ( offsetAddr ) ; <nl> - <nl> - if ( MetadataLayout . hasResilientSuperclass ( ) ) { <nl> - / / If the superclass is resilient to us , we have to compute and <nl> - / / initialize the global when we initialize the metadata . <nl> - auto init = llvm : : ConstantAggregateZero : : get ( offsetVar - > getValueType ( ) ) ; <nl> - <nl> - offsetVar - > setInitializer ( init ) ; <nl> - offsetVar - > setConstant ( false ) ; <nl> - return ; <nl> - } <nl> - <nl> - / / Otherwise , we know the offset at compile time , even if our <nl> - / / clients do not , so just emit a constant . <nl> - auto & layout = IGM . getClassMetadataLayout ( Target ) ; <nl> - <nl> - auto immediateMembersOffset = layout . getStartOfImmediateMembers ( ) ; <nl> - auto size = layout . getSize ( ) ; <nl> - auto negativeSizeInWords = size . AddressPoint / IGM . getPointerSize ( ) ; <nl> - auto positiveSizeInWords = size . getOffsetToEnd ( ) / IGM . getPointerSize ( ) ; <nl> - <nl> - auto initTy = cast < llvm : : StructType > ( offsetVar - > getValueType ( ) ) ; <nl> - auto * init = llvm : : ConstantStruct : : get ( initTy , { <nl> - llvm : : ConstantInt : : get ( IGM . SizeTy , immediateMembersOffset . getValue ( ) ) , <nl> - llvm : : ConstantInt : : get ( IGM . Int32Ty , negativeSizeInWords ) , <nl> - llvm : : ConstantInt : : get ( IGM . Int32Ty , positiveSizeInWords ) <nl> - } ) ; <nl> - <nl> - offsetVar - > setInitializer ( init ) ; <nl> - offsetVar - > setConstant ( true ) ; <nl> } <nl> <nl> / / / The ' metadata flags ' field in a class is actually a pointer to <nl> namespace { <nl> } <nl> <nl> void addDestructorFunction ( ) { <nl> - if ( auto ptr = getAddrOfDestructorFunction ( ) ) { <nl> + if ( auto ptr = getAddrOfDestructorFunction ( IGM , Target ) ) { <nl> B . add ( * ptr ) ; <nl> } else { <nl> / / In case the optimizer removed the function . See comment in <nl> namespace { <nl> } <nl> } <nl> <nl> - Optional < llvm : : Constant * > getAddrOfDestructorFunction ( ) { <nl> - auto dtorRef = SILDeclRef ( Target - > getDestructor ( ) , <nl> - SILDeclRef : : Kind : : Deallocator ) ; <nl> - SILFunction * dtorFunc = IGM . getSILModule ( ) . lookUpFunction ( dtorRef ) ; <nl> - if ( ! dtorFunc ) return llvm : : None ; <nl> - return IGM . getAddrOfSILFunction ( dtorFunc , NotForDefinition ) ; <nl> - } <nl> - <nl> - void addNominalTypeDescriptor ( ) { <nl> - auto descriptor = asImpl ( ) . emitNominalTypeDescriptor ( ) ; <nl> - B . add ( descriptor ) ; <nl> - } <nl> - <nl> - llvm : : Constant * emitNominalTypeDescriptor ( ) { <nl> - return ClassContextDescriptorBuilder ( IGM , Target , RequireMetadata ) . emit ( ) ; <nl> - } <nl> - <nl> void addIVarDestroyer ( ) { <nl> - auto dtorFunc = getAddrOfIVarDestroyer ( ) ; <nl> + auto dtorFunc = IGM . getAddrOfIVarInitDestroy ( Target , <nl> + / * isDestroyer = * / true , <nl> + / * isForeign = * / false , <nl> + NotForDefinition ) ; <nl> if ( dtorFunc ) { <nl> B . add ( * dtorFunc ) ; <nl> } else { <nl> namespace { <nl> } <nl> } <nl> <nl> - Optional < llvm : : Function * > getAddrOfIVarDestroyer ( ) { <nl> - return IGM . getAddrOfIVarInitDestroy ( Target , <nl> - / * isDestroyer = * / true , <nl> - / * isForeign = * / false , <nl> - NotForDefinition ) ; <nl> + llvm : : Constant * emitNominalTypeDescriptor ( ) { <nl> + return ClassContextDescriptorBuilder ( IGM , Target , RequireMetadata ) . emit ( ) ; <nl> } <nl> <nl> - void addClassFlags ( ) { <nl> - auto flags = ClassFlags ( ) ; <nl> - <nl> - # if ! SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT <nl> - / / FIXME : Remove this after enabling stable ABI . <nl> - / / This bit is NOT conditioned on UseDarwinPreStableABIBit . <nl> - flags | = ClassFlags : : IsSwiftPreStableABI ; <nl> - # endif <nl> - <nl> - / / Set a flag if the class uses Swift refcounting . <nl> - auto type = Target - > getDeclaredType ( ) - > getCanonicalType ( ) ; <nl> - if ( type - > getReferenceCounting ( ) = = ReferenceCounting : : Native ) { <nl> - flags | = ClassFlags : : UsesSwiftRefcounting ; <nl> - } <nl> - <nl> - / / Set a flag if the class has a custom ObjC name . <nl> - DeclAttributes attrs = Target - > getAttrs ( ) ; <nl> - if ( auto objc = attrs . getAttribute < ObjCAttr > ( ) ) { <nl> - if ( objc - > getName ( ) ) <nl> - flags | = ClassFlags : : HasCustomObjCName ; <nl> - } <nl> - if ( attrs . hasAttribute < ObjCRuntimeNameAttr > ( ) ) <nl> - flags | = ClassFlags : : HasCustomObjCName ; <nl> + void addNominalTypeDescriptor ( ) { <nl> + B . add ( emitNominalTypeDescriptor ( ) ) ; <nl> + } <nl> <nl> - B . addInt32 ( ( uint32_t ) flags ) ; <nl> + bool canBeConstant ( ) { <nl> + / / TODO : the metadata global can actually be constant in a very <nl> + / / special case : it ' s not a pattern , ObjC interoperation isn ' t <nl> + / / required , there are no class fields , and there is nothing that <nl> + / / needs to be runtime - adjusted . <nl> + return false ; <nl> } <nl> <nl> void addInstanceAddressPoint ( ) { <nl> namespace { <nl> Members . addGenericWitnessTable ( forClass ) ; <nl> } <nl> <nl> - protected : <nl> - llvm : : Value * emitFinishInitializationOfClassMetadata ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata , <nl> - MetadataDependencyCollector * collector ) { <nl> - assert ( doesClassMetadataRequireInitialization ( IGF . IGM , Target ) ) ; <nl> - <nl> - / / Set the superclass , fill out the field offset vector , and copy vtable <nl> - / / entries , generic requirements and field offsets from superclasses . <nl> - auto classTy = Target - > getDeclaredTypeInContext ( ) - > getCanonicalType ( ) ; <nl> - auto loweredClassTy = IGF . IGM . getLoweredType ( classTy ) ; <nl> - emitInitializeFieldOffsetVector ( IGF , loweredClassTy , <nl> - metadata , / * VWT is mutable * / false , <nl> - collector ) ; <nl> - <nl> - / / Realizing the class with the ObjC runtime will copy back to the <nl> - / / field offset globals for us ; but if ObjC interop is disabled , we <nl> - / / have to do that ourselves , assuming we didn ' t just emit them all <nl> - / / correctly in the first place . <nl> - if ( ! IGF . IGM . ObjCInterop ) <nl> - emitInitializeFieldOffsets ( IGF , metadata ) ; <nl> - <nl> - emitInitializeMethodOverrides ( IGF , metadata ) ; <nl> - <nl> - return metadata ; <nl> - } <nl> - <nl> - / / Update vtable entries for method overrides . The runtime copies in <nl> - / / the vtable from the superclass for us ; we have to install method <nl> - / / overrides ourselves . <nl> - void emitInitializeMethodOverrides ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata ) { <nl> - Members . emitInitializeMethodOverrides ( IGF , metadata ) ; <nl> - } <nl> - <nl> - / / The Objective - C runtime will copy field offsets from the field offset <nl> - / / vector into field offset globals for us , if present . If there ' s no <nl> - / / Objective - C runtime , we have to do this ourselves . <nl> - void emitInitializeFieldOffsets ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata ) { <nl> - for ( auto prop : Target - > getStoredProperties ( ) ) { <nl> - auto fieldInfo = FieldLayout . getFieldAccessAndElement ( prop ) ; <nl> - if ( fieldInfo . first = = FieldAccess : : NonConstantDirect ) { <nl> - Address offsetA = IGF . IGM . getAddrOfFieldOffset ( prop , ForDefinition ) ; <nl> - <nl> - / / We can ' t use emitClassFieldOffset ( ) here because that creates <nl> - / / an invariant load , which could be hoisted above the point <nl> - / / where the metadata becomes fully initialized <nl> - auto slot = <nl> - emitAddressOfClassFieldOffset ( IGF , metadata , Target , prop ) ; <nl> - auto offsetVal = IGF . emitInvariantLoad ( slot ) ; <nl> - IGF . Builder . CreateStore ( offsetVal , offsetA ) ; <nl> - } <nl> - } <nl> - } <nl> } ; <nl> <nl> / / / Base class for layout of non - generic class metadata . <nl> namespace { <nl> <nl> using super : : IGM ; <nl> using super : : Target ; <nl> + using super : : FieldLayout ; <nl> using super : : B ; <nl> - using super : : emitFinishInitializationOfClassMetadata ; <nl> <nl> Size AddressPoint ; <nl> <nl> namespace { <nl> IGM , Target , <nl> [ & ] ( IRGenFunction & IGF , llvm : : Value * metadata , <nl> MetadataDependencyCollector * collector ) { <nl> - emitFinishInitializationOfClassMetadata ( IGF , metadata , collector ) ; <nl> + emitInitializeClassMetadata ( IGF , Target , FieldLayout , metadata , <nl> + collector ) ; <nl> } ) ; <nl> <nl> / / If the class has resilient ancestry we also need a relocation <nl> namespace { <nl> addIVarDestroyer ( ) ; <nl> <nl> / / ClassFlags Flags ; <nl> - addClassFlags ( ) ; <nl> + B . addInt32 ( ( uint32_t ) getClassFlags ( Target ) ) ; <nl> <nl> / / uint16_t ClassRODataOffset ; <nl> if ( IGM . ObjCInterop ) <nl> namespace { <nl> <nl> void emitInstantiationDefinitions ( ) { <nl> / / Emit the base - offset variable . <nl> - emitClassMetadataBaseOffset ( ) ; <nl> + emitClassMetadataBaseOffset ( IGM , Target ) ; <nl> <nl> super : : emitInstantiationDefinitions ( ) ; <nl> } <nl> <nl> void addDestructorFunction ( ) { <nl> - auto function = getAddrOfDestructorFunction ( ) ; <nl> + auto function = getAddrOfDestructorFunction ( IGM , Target ) ; <nl> B . addRelativeAddressOrNull ( function ? * function : nullptr ) ; <nl> } <nl> <nl> void addIVarDestroyer ( ) { <nl> - auto function = getAddrOfIVarDestroyer ( ) ; <nl> + auto function = IGM . getAddrOfIVarInitDestroy ( Target , <nl> + / * isDestroyer = * / true , <nl> + / * isForeign = * / false , <nl> + NotForDefinition ) ; <nl> B . addRelativeAddressOrNull ( function ? * function : nullptr ) ; <nl> } <nl> <nl> namespace { <nl> bool isVWTMutable , <nl> MetadataDependencyCollector * collector ) { <nl> assert ( ! HasDependentVWT & & " class should never have dependent VWT " ) ; <nl> - <nl> - / / We can assume that this never relocates the metadata because <nl> - / / it should have been allocated properly for the class . <nl> - ( void ) emitFinishInitializationOfClassMetadata ( IGF , metadata , collector ) ; <nl> + emitInitializeClassMetadata ( IGF , Target , FieldLayout , metadata , collector ) ; <nl> } <nl> } ; <nl> } / / end anonymous namespace <nl> namespace { <nl> emitMetadataCompletionFunction ( IGM , Target , <nl> [ & ] ( IRGenFunction & IGF , llvm : : Value * metadata , <nl> MetadataDependencyCollector * collector ) { <nl> - asImpl ( ) . emitInitializeMetadata ( IGF , metadata , / * vwt mutable * / true , <nl> - collector ) ; <nl> + emitInitializeMetadata ( IGF , Target , metadata , / * vwt mutable * / true , <nl> + collector ) ; <nl> } ) ; <nl> } <nl> } ; <nl> namespace { <nl> return IGM . getLoweredType ( Target - > getDeclaredTypeInContext ( ) ) ; <nl> } <nl> <nl> - MetadataKind getMetadataKind ( ) { <nl> - return MetadataKind : : Struct ; <nl> - } <nl> - <nl> void addMetadataFlags ( ) { <nl> - B . addInt ( IGM . MetadataKindTy , unsigned ( getMetadataKind ( ) ) ) ; <nl> + B . addInt ( IGM . MetadataKindTy , unsigned ( getMetadataKind ( Target ) ) ) ; <nl> } <nl> <nl> llvm : : Constant * emitNominalTypeDescriptor ( ) { <nl> namespace { <nl> void addGenericWitnessTable ( ) { <nl> llvm_unreachable ( " Concrete type metadata cannot have generic requirements " ) ; <nl> } <nl> - <nl> - void emitInitializeMetadata ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata , <nl> - bool isVWTMutable , <nl> - MetadataDependencyCollector * collector ) { <nl> - auto loweredTy = getLoweredType ( ) ; <nl> - auto & fixedTI = IGM . getTypeInfo ( loweredTy ) ; <nl> - if ( isa < FixedTypeInfo > ( fixedTI ) ) return ; <nl> - <nl> - emitInitializeFieldOffsetVector ( IGF , loweredTy , metadata , isVWTMutable , <nl> - collector ) ; <nl> - } <nl> } ; <nl> <nl> class StructMetadataBuilder : <nl> void IRGenerator : : noteUseOfAnyParentTypeMetadata ( NominalTypeDecl * type ) { <nl> <nl> / / Enums <nl> <nl> + static Optional < Size > getConstantPayloadSize ( IRGenModule & IGM , <nl> + EnumDecl * enumDecl ) { <nl> + auto enumTy = enumDecl - > getDeclaredTypeInContext ( ) - > getCanonicalType ( ) ; <nl> + auto & enumTI = IGM . getTypeInfoForUnlowered ( enumTy ) ; <nl> + if ( ! enumTI . isFixedSize ( ResilienceExpansion : : Maximal ) ) { <nl> + return None ; <nl> + } <nl> + <nl> + assert ( ! enumTI . isFixedSize ( ResilienceExpansion : : Minimal ) & & <nl> + " non - generic , non - resilient enums don ' t need payload size in metadata " ) ; <nl> + auto & strategy = getEnumImplStrategy ( IGM , enumTy ) ; <nl> + return Size ( strategy . getPayloadSizeForMetadata ( ) ) ; <nl> + } <nl> + <nl> namespace { <nl> <nl> template < class Impl > <nl> namespace { <nl> public : <nl> void noteStartOfTypeSpecificMembers ( ) { } <nl> <nl> - MetadataKind getMetadataKind ( ) { <nl> - return Target - > isOptionalDecl ( ) ? MetadataKind : : Optional <nl> - : MetadataKind : : Enum ; <nl> - } <nl> - <nl> void addMetadataFlags ( ) { <nl> - auto kind = getMetadataKind ( ) ; <nl> - B . addInt ( IGM . MetadataKindTy , unsigned ( kind ) ) ; <nl> + B . addInt ( IGM . MetadataKindTy , unsigned ( getMetadataKind ( Target ) ) ) ; <nl> } <nl> <nl> llvm : : Constant * emitValueWitnessTable ( ) { <nl> namespace { <nl> void addGenericWitnessTable ( ) { <nl> llvm_unreachable ( " Concrete type metadata cannot have generic requirements " ) ; <nl> } <nl> - <nl> - Optional < Size > getConstantPayloadSize ( ) { <nl> - auto enumTy = Target - > getDeclaredTypeInContext ( ) - > getCanonicalType ( ) ; <nl> - auto & enumTI = IGM . getTypeInfoForUnlowered ( enumTy ) ; <nl> - if ( ! enumTI . isFixedSize ( ResilienceExpansion : : Maximal ) ) { <nl> - return None ; <nl> - } <nl> - <nl> - assert ( ! enumTI . isFixedSize ( ResilienceExpansion : : Minimal ) & & <nl> - " non - generic , non - resilient enums don ' t need payload size in metadata " ) ; <nl> - auto & strategy = getEnumImplStrategy ( IGM , enumTy ) ; <nl> - return Size ( strategy . getPayloadSizeForMetadata ( ) ) ; <nl> - } <nl> - <nl> - void emitInitializeMetadata ( IRGenFunction & IGF , <nl> - llvm : : Value * metadata , <nl> - bool isVWTMutable , <nl> - MetadataDependencyCollector * collector ) { <nl> - / / Nominal types are always preserved through SIL lowering . <nl> - auto enumTy = getLoweredType ( ) ; <nl> - <nl> - auto & strategy = getEnumImplStrategy ( IGF . IGM , enumTy ) ; <nl> - strategy . initializeMetadata ( IGF , metadata , isVWTMutable , enumTy , <nl> - collector ) ; <nl> - } <nl> } ; <nl> <nl> class EnumMetadataBuilder <nl> namespace { <nl> : EnumMetadataBuilderBase ( IGM , theEnum , B ) { } <nl> <nl> void addPayloadSize ( ) { <nl> - auto payloadSize = getConstantPayloadSize ( ) ; <nl> + auto payloadSize = getConstantPayloadSize ( IGM , Target ) ; <nl> if ( ! payloadSize ) { <nl> B . addInt ( IGM . IntPtrTy , 0 ) ; <nl> HasUnfilledPayloadSize = true ; <nl> namespace { <nl> / / This is so small that we just do it inline instead of bothering <nl> / / with a pattern . <nl> if ( layout . hasPayloadSizeOffset ( ) ) { <nl> - if ( auto size = getConstantPayloadSize ( ) ) { <nl> + if ( auto size = getConstantPayloadSize ( IGM , Target ) ) { <nl> auto offset = layout . getPayloadSizeOffset ( ) ; <nl> auto slot = IGF . emitAddressAtOffset ( metadata , offset , IGM . SizeTy , <nl> IGM . getPointerAlignment ( ) ) ; <nl>
IRGen : Make some metadata builder methods into top level static functions
apple/swift
8972f3680706f8e0940744eaf7589683eeb726cf
2018-08-22T04:51:53Z
mmm a / jstests / sharding / writeback_bulk_insert . js <nl> ppp b / jstests / sharding / writeback_bulk_insert . js <nl> jsTest . log ( " Starting sharded cluster . . . " ) <nl> var st = new ShardingTest ( { shards : 1 , <nl> mongos : 3 , <nl> verbose : 2 , <nl> - separateConfig : 1 } ) <nl> + other : { separateConfig : true , <nl> + mongosOptions : { noAutoSplit : " " } } } ) <nl> <nl> st . stopBalancer ( ) <nl> <nl> var collB = mongosB . getCollection ( " " + collA ) <nl> collB . insert ( { hello : " world " } ) <nl> assert . eq ( null , collB . getDB ( ) . getLastError ( ) ) <nl> <nl> - var collC = mongosB . getCollection ( " " + collA ) <nl> + var collC = mongosC . getCollection ( " " + collA ) <nl> collC . insert ( { hello : " world " } ) <nl> assert . eq ( null , collC . getDB ( ) . getLastError ( ) ) <nl> <nl> printjson ( mongosA . getDB ( " admin " ) . runCommand ( { shardCollection : collA + " " , <nl> / / MongoD doesn ' t know about the config shard version * until * MongoS tells it <nl> collA . findOne ( ) <nl> <nl> - / / Preparing insert of exactly 16MB <nl> - <nl> jsTest . log ( " Preparing bulk insert . . . " ) <nl> <nl> var data1MB = " x " <nl> print ( " 7MB object size is : " + Object . bsonsize ( { _id : 0 , <nl> <nl> var dataCloseTo8MB = data7MB ; <nl> / / WARNING - MAGIC NUMBERS HERE <nl> - / / The idea is to exceed the 16MB limit by just enough so that the message gets passed in the <nl> + / / The idea is to exceed the 16MB limit by just enough so that the message gets <nl> + / / passed in the <nl> / / shell , but adding additional writeback information fails . <nl> for ( var i = 0 ; i < 1031 * 1024 + 862 ; i + + ) { <nl> dataCloseTo8MB + = " x " <nl> collC . insert ( [ { _id : 0 , <nl> { _id : 1 , <nl> d : data8MB } ] ) <nl> <nl> - / / Should succeed since our insert size is 16MB ( plus very small overhead ) <nl> + / / Should succeed since our insert size is 16MB ( plus very small overhead ) <nl> jsTest . log ( " Waiting for GLE . . . " ) <nl> <nl> assert . eq ( null , collC . getDB ( ) . getLastError ( ) ) <nl> print ( " GLE Successful . . . " ) <nl> <nl> assert . eq ( 5 , collA . find ( ) . itcount ( ) ) <nl> assert . eq ( 5 , collB . find ( ) . itcount ( ) ) <nl> + assert . eq ( 5 , collC . find ( ) . itcount ( ) ) <nl> <nl> st . stop ( ) <nl>
buildbot writeback_bulk_insert . js use correct collection for last writeback and disable autosplit
mongodb/mongo
3b9b88caaf9dddedd05d894e257d6b47b3985840
2012-10-01T17:39:30Z
mmm a / tensorflow / workspace . bzl <nl> ppp b / tensorflow / workspace . bzl <nl> def tf_workspace ( path_prefix = " " , tf_repo_name = " " ) : <nl> tf_http_archive ( <nl> name = " com_google_absl " , <nl> build_file = clean_dep ( " / / third_party : com_google_absl . BUILD " ) , <nl> - sha256 = " e379f50099490d6091cea5a6073f8db533b0a7c6250e0844a8ec54d55fd763e5 " , <nl> - strip_prefix = " abseil - cpp - e75672f6afc7e8f23ee7b532e86d1b3b9be3984e " , <nl> + sha256 = " 69aad555e62f50eedd0466c4831c44d66be4e5591e94cc4671262a0e5e53b0ed " , <nl> + strip_prefix = " abseil - cpp - eab2078b53c9e3d9d240135c09d27e3393acb50a " , <nl> urls = [ <nl> - " https : / / mirror . bazel . build / github . com / abseil / abseil - cpp / archive / e75672f6afc7e8f23ee7b532e86d1b3b9be3984e . tar . gz " , <nl> - " https : / / github . com / abseil / abseil - cpp / archive / e75672f6afc7e8f23ee7b532e86d1b3b9be3984e . tar . gz " , <nl> + " https : / / mirror . bazel . build / github . com / abseil / abseil - cpp / archive / eab2078b53c9e3d9d240135c09d27e3393acb50a . tar . gz " , <nl> + " https : / / github . com / abseil / abseil - cpp / archive / eab2078b53c9e3d9d240135c09d27e3393acb50a . tar . gz " , <nl> ] , <nl> ) <nl> <nl>
[ TF : XLA ] Bump open source abseil revision to eab2078b53c9e3d9d240135c09d27e3393acb50a
tensorflow/tensorflow
f07558116ac7c90858cf0572a1bca1e50e208a37
2019-03-23T00:16:16Z
mmm a / HISTORY . md <nl> ppp b / HISTORY . md <nl> <nl> * options . hard_rate_limit is deprecated . <nl> * When options . soft_rate_limit or options . level0_slowdown_writes_trigger is triggered , the way to slow down writes is changed to : write rate to DB is limited to to options . delayed_write_rate . <nl> * DB : : GetApproximateSizes ( ) adds a parameter to allow the estimation to include data in mem table , with default to be not to include . It is now only supported in skip list mem table . <nl> + * DB : : CompactRange ( ) now accept CompactRangeOptions instead of multiple paramters . CompactRangeOptions is defined in include / rocksdb / options . h . <nl> <nl> # # 3 . 11 . 0 ( 5 / 19 / 2015 ) <nl> # # # New Features <nl> mmm a / db / c . cc <nl> ppp b / db / c . cc <nl> using rocksdb : : BackupEngine ; <nl> using rocksdb : : BackupableDBOptions ; <nl> using rocksdb : : BackupInfo ; <nl> using rocksdb : : RestoreOptions ; <nl> + using rocksdb : : CompactRangeOptions ; <nl> <nl> using std : : shared_ptr ; <nl> <nl> void rocksdb_compact_range ( <nl> const char * limit_key , size_t limit_key_len ) { <nl> Slice a , b ; <nl> db - > rep - > CompactRange ( <nl> + CompactRangeOptions ( ) , <nl> / / Pass nullptr Slice if corresponding " const char * " is nullptr <nl> ( start_key ? ( a = Slice ( start_key , start_key_len ) , & a ) : nullptr ) , <nl> ( limit_key ? ( b = Slice ( limit_key , limit_key_len ) , & b ) : nullptr ) ) ; <nl> void rocksdb_compact_range_cf ( <nl> const char * limit_key , size_t limit_key_len ) { <nl> Slice a , b ; <nl> db - > rep - > CompactRange ( <nl> - column_family - > rep , <nl> + CompactRangeOptions ( ) , column_family - > rep , <nl> / / Pass nullptr Slice if corresponding " const char * " is nullptr <nl> ( start_key ? ( a = Slice ( start_key , start_key_len ) , & a ) : nullptr ) , <nl> ( limit_key ? ( b = Slice ( limit_key , limit_key_len ) , & b ) : nullptr ) ) ; <nl> mmm a / db / column_family_test . cc <nl> ppp b / db / column_family_test . cc <nl> class ColumnFamilyTest : public testing : : Test { <nl> } <nl> <nl> void CompactAll ( int cf ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( handles_ [ cf ] , nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , handles_ [ cf ] , nullptr , <nl> + nullptr ) ) ; <nl> } <nl> <nl> void Compact ( int cf , const Slice & start , const Slice & limit ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( handles_ [ cf ] , & start , & limit ) ) ; <nl> + ASSERT_OK ( <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , handles_ [ cf ] , & start , & limit ) ) ; <nl> } <nl> <nl> int NumTableFilesAtLevel ( int level , int cf ) { <nl> mmm a / db / compaction_job_stats_test . cc <nl> ppp b / db / compaction_job_stats_test . cc <nl> class CompactionJobStatsTest : public testing : : Test { <nl> <nl> void Compact ( int cf , const Slice & start , const Slice & limit , <nl> uint32_t target_path_id ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( handles_ [ cf ] , & start , & limit , false , - 1 , <nl> - target_path_id ) ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . target_path_id = target_path_id ; <nl> + ASSERT_OK ( db_ - > CompactRange ( compact_options , handles_ [ cf ] , & start , & limit ) ) ; <nl> } <nl> <nl> void Compact ( int cf , const Slice & start , const Slice & limit ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( handles_ [ cf ] , & start , & limit ) ) ; <nl> + ASSERT_OK ( <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , handles_ [ cf ] , & start , & limit ) ) ; <nl> } <nl> <nl> void Compact ( const Slice & start , const Slice & limit ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( & start , & limit ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , & start , & limit ) ) ; <nl> } <nl> <nl> void TEST_Compact ( int level , int cf , const Slice & start , const Slice & limit ) { <nl> mmm a / db / db_bench . cc <nl> ppp b / db / db_bench . cc <nl> class Benchmark { <nl> <nl> void Compact ( ThreadState * thread ) { <nl> DB * db = SelectDB ( thread ) ; <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> } <nl> <nl> void PrintStats ( const char * key ) { <nl> mmm a / db / db_impl . cc <nl> ppp b / db / db_impl . cc <nl> void DBImpl : : NotifyOnFlushCompleted ( <nl> # endif / / ROCKSDB_LITE <nl> } <nl> <nl> - Status DBImpl : : CompactRange ( ColumnFamilyHandle * column_family , <nl> - const Slice * begin , const Slice * end , <nl> - bool change_level , int target_level , <nl> - uint32_t target_path_id ) { <nl> - if ( target_path_id > = db_options_ . db_paths . size ( ) ) { <nl> + Status DBImpl : : CompactRange ( const CompactRangeOptions & options , <nl> + ColumnFamilyHandle * column_family , <nl> + const Slice * begin , const Slice * end ) { <nl> + if ( options . target_path_id > = db_options_ . db_paths . size ( ) ) { <nl> return Status : : InvalidArgument ( " Invalid target path ID " ) ; <nl> } <nl> <nl> Status DBImpl : : CompactRange ( ColumnFamilyHandle * column_family , <nl> cfd - > NumberLevels ( ) > 1 ) { <nl> / / Always compact all files together . <nl> s = RunManualCompaction ( cfd , ColumnFamilyData : : kCompactAllLevels , <nl> - cfd - > NumberLevels ( ) - 1 , target_path_id , begin , <nl> - end ) ; <nl> + cfd - > NumberLevels ( ) - 1 , options . target_path_id , <nl> + begin , end ) ; <nl> final_output_level = cfd - > NumberLevels ( ) - 1 ; <nl> } else { <nl> for ( int level = 0 ; level < = max_level_with_files ; level + + ) { <nl> Status DBImpl : : CompactRange ( ColumnFamilyHandle * column_family , <nl> output_level = ColumnFamilyData : : kCompactToBaseLevel ; <nl> } <nl> } <nl> - s = RunManualCompaction ( cfd , level , output_level , target_path_id , begin , <nl> - end ) ; <nl> + s = RunManualCompaction ( cfd , level , output_level , options . target_path_id , <nl> + begin , end ) ; <nl> if ( ! s . ok ( ) ) { <nl> break ; <nl> } <nl> Status DBImpl : : CompactRange ( ColumnFamilyHandle * column_family , <nl> return s ; <nl> } <nl> <nl> - if ( change_level ) { <nl> - s = ReFitLevel ( cfd , final_output_level , target_level ) ; <nl> + if ( options . change_level ) { <nl> + s = ReFitLevel ( cfd , final_output_level , options . target_level ) ; <nl> } <nl> LogFlush ( db_options_ . info_log ) ; <nl> <nl> mmm a / db / db_impl . h <nl> ppp b / db / db_impl . h <nl> class DBImpl : public DB { <nl> const Range * range , int n , uint64_t * sizes , <nl> bool include_memtable = false ) override ; <nl> using DB : : CompactRange ; <nl> - virtual Status CompactRange ( ColumnFamilyHandle * column_family , <nl> - const Slice * begin , const Slice * end , <nl> - bool change_level = false , int target_level = - 1 , <nl> - uint32_t target_path_id = 0 ) override ; <nl> + virtual Status CompactRange ( const CompactRangeOptions & options , <nl> + ColumnFamilyHandle * column_family , <nl> + const Slice * begin , const Slice * end ) override ; <nl> <nl> using DB : : CompactFiles ; <nl> virtual Status CompactFiles ( const CompactionOptions & compact_options , <nl> mmm a / db / db_impl_readonly . h <nl> ppp b / db / db_impl_readonly . h <nl> class DBImplReadOnly : public DBImpl { <nl> return Status : : NotSupported ( " Not supported operation in read only mode . " ) ; <nl> } <nl> using DBImpl : : CompactRange ; <nl> - virtual Status CompactRange ( ColumnFamilyHandle * column_family , <nl> - const Slice * begin , const Slice * end , <nl> - bool reduce_level = false , int target_level = - 1 , <nl> - uint32_t target_path_id = 0 ) override { <nl> + virtual Status CompactRange ( const CompactRangeOptions & options , <nl> + ColumnFamilyHandle * column_family , <nl> + const Slice * begin , const Slice * end ) override { <nl> return Status : : NotSupported ( " Not supported operation in read only mode . " ) ; <nl> } <nl> <nl> mmm a / db / db_test . cc <nl> ppp b / db / db_test . cc <nl> class DBTest : public testing : : Test { <nl> <nl> void Compact ( int cf , const Slice & start , const Slice & limit , <nl> uint32_t target_path_id ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( handles_ [ cf ] , & start , & limit , false , - 1 , <nl> - target_path_id ) ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . target_path_id = target_path_id ; <nl> + ASSERT_OK ( db_ - > CompactRange ( compact_options , handles_ [ cf ] , & start , & limit ) ) ; <nl> } <nl> <nl> void Compact ( int cf , const Slice & start , const Slice & limit ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( handles_ [ cf ] , & start , & limit ) ) ; <nl> + ASSERT_OK ( <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , handles_ [ cf ] , & start , & limit ) ) ; <nl> } <nl> <nl> void Compact ( const Slice & start , const Slice & limit ) { <nl> - ASSERT_OK ( db_ - > CompactRange ( & start , & limit ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , & start , & limit ) ) ; <nl> } <nl> <nl> / / Do n memtable compactions , each of which produces an sstable <nl> TEST_F ( DBTest , CompactedDB ) { <nl> ASSERT_OK ( Put ( " hhh " , DummyString ( kFileSize / 2 , ' h ' ) ) ) ; <nl> ASSERT_OK ( Put ( " iii " , DummyString ( kFileSize / 2 , ' i ' ) ) ) ; <nl> ASSERT_OK ( Put ( " jjj " , DummyString ( kFileSize / 2 , ' j ' ) ) ) ; <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( 3 , NumTableFilesAtLevel ( 1 ) ) ; <nl> Close ( ) ; <nl> <nl> TEST_F ( DBTest , WholeKeyFilterProp ) { <nl> / / ranges . <nl> ASSERT_OK ( dbfull ( ) - > Put ( wo , " aaa " , " " ) ) ; <nl> ASSERT_OK ( dbfull ( ) - > Put ( wo , " zzz " , " " ) ) ; <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> / / Reopen with both of whole key off and prefix extractor enabled . <nl> / / Still no bloom filter should be used . <nl> TEST_F ( DBTest , WholeKeyFilterProp ) { <nl> / / ranges . <nl> ASSERT_OK ( dbfull ( ) - > Put ( wo , " aaa " , " " ) ) ; <nl> ASSERT_OK ( dbfull ( ) - > Put ( wo , " zzz " , " " ) ) ; <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> options . prefix_extractor . reset ( ) ; <nl> bbto . whole_key_filtering = true ; <nl> TEST_F ( DBTest , TrivialMoveOneFile ) { <nl> LiveFileMetaData level0_file = metadata [ 0 ] ; / / L0 file meta <nl> <nl> / / Compaction will initiate a trivial move from L0 to L1 <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> / / File moved From L0 to L1 <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 0 , 0 ) , 0 ) ; / / 0 files in L0 <nl> TEST_F ( DBTest , TrivialMoveNonOverlappingFiles ) { <nl> <nl> / / Since data is non - overlapping we expect compaction to initiate <nl> / / a trivial move <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> / / We expect that all the files were trivially moved from L0 to L1 <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 0 , 0 ) , 0 ) ; <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 1 , 0 ) / * level1_files * / , level0_files ) ; <nl> TEST_F ( DBTest , TrivialMoveNonOverlappingFiles ) { <nl> ASSERT_OK ( Flush ( ) ) ; <nl> } <nl> <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> for ( uint32_t i = 0 ; i < ranges . size ( ) ; i + + ) { <nl> for ( int32_t j = ranges [ i ] . first ; j < = ranges [ i ] . second ; j + + ) { <nl> TEST_F ( DBTest , TrivialMoveTargetLevel ) { <nl> <nl> / / 2 files in L0 <nl> ASSERT_EQ ( " 2 " , FilesPerLevel ( 0 ) ) ; <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr , true , 6 ) ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . change_level = true ; <nl> + compact_options . target_level = 6 ; <nl> + ASSERT_OK ( db_ - > CompactRange ( compact_options , nullptr , nullptr ) ) ; <nl> / / 2 files in L6 <nl> ASSERT_EQ ( " 0 , 0 , 0 , 0 , 0 , 0 , 2 " , FilesPerLevel ( 0 ) ) ; <nl> <nl> TEST_F ( DBTest , ConvertCompactionStyle ) { <nl> options = CurrentOptions ( options ) ; <nl> ReopenWithColumnFamilies ( { " default " , " pikachu " } , options ) ; <nl> <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr , true / * reduce level * / , <nl> - 0 / * reduce to level 0 * / ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . change_level = true ; <nl> + compact_options . target_level = 0 ; <nl> + dbfull ( ) - > CompactRange ( compact_options , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> <nl> - for ( int i = 0 ; i < options . num_levels ; i + + ) { <nl> - int num = NumTableFilesAtLevel ( i , 1 ) ; <nl> - if ( i = = 0 ) { <nl> - ASSERT_EQ ( num , 1 ) ; <nl> - } else { <nl> - ASSERT_EQ ( num , 0 ) ; <nl> - } <nl> - } <nl> + / / Only 1 file in L0 <nl> + ASSERT_EQ ( " 1 " , FilesPerLevel ( 1 ) ) ; <nl> <nl> / / Stage 4 : re - open in universal compaction style and do some db operations <nl> options = CurrentOptions ( ) ; <nl> TEST_F ( DBTest , IncreaseUniversalCompactionNumLevels ) { <nl> options . target_file_size_base = INT_MAX ; <nl> ReopenWithColumnFamilies ( { " default " , " pikachu " } , options ) ; <nl> / / Compact all to level 0 <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr , true / * reduce level * / , <nl> - 0 / * reduce to level 0 * / ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . change_level = true ; <nl> + compact_options . target_level = 0 ; <nl> + dbfull ( ) - > CompactRange ( compact_options , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> / / Need to restart it once to remove higher level records in manifest . <nl> ReopenWithColumnFamilies ( { " default " , " pikachu " } , options ) ; <nl> / / Final reopen <nl> TEST_F ( DBTest , CompactionFilterDeletesAll ) { <nl> } <nl> <nl> / / this will produce empty file ( delete compaction filter ) <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ) ; <nl> ASSERT_EQ ( 0U , CountLiveFiles ( ) ) ; <nl> <nl> Reopen ( options ) ; <nl> TEST_F ( DBTest , CompactionFilterWithValueChange ) { <nl> dbfull ( ) - > TEST_CompactRange ( 0 , nullptr , nullptr , handles_ [ 1 ] ) ; <nl> dbfull ( ) - > TEST_CompactRange ( 1 , nullptr , nullptr , handles_ [ 1 ] ) ; <nl> } else { <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> } <nl> <nl> / / re - write all data again <nl> TEST_F ( DBTest , CompactionFilterWithValueChange ) { <nl> dbfull ( ) - > TEST_CompactRange ( 0 , nullptr , nullptr , handles_ [ 1 ] ) ; <nl> dbfull ( ) - > TEST_CompactRange ( 1 , nullptr , nullptr , handles_ [ 1 ] ) ; <nl> } else { <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> } <nl> <nl> / / verify that all keys now have the new value that <nl> TEST_F ( DBTest , CompactionFilterWithMergeOperator ) { <nl> ASSERT_OK ( Flush ( ) ) ; <nl> std : : string newvalue = Get ( " foo " ) ; <nl> ASSERT_EQ ( newvalue , three ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> newvalue = Get ( " foo " ) ; <nl> ASSERT_EQ ( newvalue , three ) ; <nl> <nl> TEST_F ( DBTest , CompactionFilterWithMergeOperator ) { <nl> / / merge keys . <nl> ASSERT_OK ( db_ - > Put ( WriteOptions ( ) , " bar " , two ) ) ; <nl> ASSERT_OK ( Flush ( ) ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> newvalue = Get ( " bar " ) ; <nl> ASSERT_EQ ( " NOT_FOUND " , newvalue ) ; <nl> ASSERT_OK ( db_ - > Merge ( WriteOptions ( ) , " bar " , two ) ) ; <nl> ASSERT_OK ( Flush ( ) ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> newvalue = Get ( " bar " ) ; <nl> ASSERT_EQ ( two , two ) ; <nl> <nl> TEST_F ( DBTest , CompactionFilterWithMergeOperator ) { <nl> ASSERT_OK ( Flush ( ) ) ; <nl> newvalue = Get ( " foobar " ) ; <nl> ASSERT_EQ ( newvalue , three ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> newvalue = Get ( " foobar " ) ; <nl> ASSERT_EQ ( newvalue , three ) ; <nl> <nl> TEST_F ( DBTest , CompactionFilterWithMergeOperator ) { <nl> ASSERT_OK ( Flush ( ) ) ; <nl> newvalue = Get ( " barfoo " ) ; <nl> ASSERT_EQ ( newvalue , four ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> newvalue = Get ( " barfoo " ) ; <nl> ASSERT_EQ ( newvalue , four ) ; <nl> } <nl> TEST_F ( DBTest , CompactionFilterContextManual ) { <nl> filter - > expect_manual_compaction_ . store ( true ) ; <nl> filter - > expect_full_compaction_ . store ( false ) ; / / Manual compaction always <nl> / / set this flag . <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( cfilter_count , 700 ) ; <nl> ASSERT_EQ ( NumSortedRuns ( 0 ) , 1 ) ; <nl> <nl> TEST_F ( DBTest , CompactBetweenSnapshots ) { <nl> / / After a compaction , " second " , " third " and " fifth " should <nl> / / be removed <nl> FillLevels ( " a " , " z " , 1 ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( " sixth " , Get ( 1 , " foo " ) ) ; <nl> ASSERT_EQ ( " fourth " , Get ( 1 , " foo " , snapshot2 ) ) ; <nl> ASSERT_EQ ( " first " , Get ( 1 , " foo " , snapshot1 ) ) ; <nl> TEST_F ( DBTest , CompactBetweenSnapshots ) { <nl> / / after we release the snapshot1 , only two values left <nl> db_ - > ReleaseSnapshot ( snapshot1 ) ; <nl> FillLevels ( " a " , " z " , 1 ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> <nl> / / We have only one valid snapshot snapshot2 . Since snapshot1 is <nl> / / not valid anymore , " first " should be removed by a compaction . <nl> TEST_F ( DBTest , CompactBetweenSnapshots ) { <nl> / / after we release the snapshot2 , only one value should be left <nl> db_ - > ReleaseSnapshot ( snapshot2 ) ; <nl> FillLevels ( " a " , " z " , 1 ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( " sixth " , Get ( 1 , " foo " ) ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ sixth ] " ) ; <nl> / / skip HashCuckooRep as it does not support snapshot <nl> TEST_F ( DBTest , ManualCompaction ) { <nl> / / Compact all <nl> MakeTables ( 1 , " a " , " z " , 1 ) ; <nl> ASSERT_EQ ( " 0 , 1 , 2 " , FilesPerLevel ( 1 ) ) ; <nl> - db_ - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> ASSERT_EQ ( " 0 , 0 , 1 " , FilesPerLevel ( 1 ) ) ; <nl> <nl> if ( iter = = 0 ) { <nl> TEST_P ( DBTestUniversalManualCompactionOutputPathId , <nl> ASSERT_EQ ( 0 , GetSstFileCount ( options . db_paths [ 1 ] . path ) ) ; <nl> <nl> / / Full compaction to DB path 0 <nl> - db_ - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr , false , - 1 , 1 ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . target_path_id = 1 ; <nl> + db_ - > CompactRange ( compact_options , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> ASSERT_EQ ( 1 , TotalLiveFiles ( 1 ) ) ; <nl> ASSERT_EQ ( 0 , GetSstFileCount ( options . db_paths [ 0 ] . path ) ) ; <nl> ASSERT_EQ ( 1 , GetSstFileCount ( options . db_paths [ 1 ] . path ) ) ; <nl> TEST_P ( DBTestUniversalManualCompactionOutputPathId , <nl> ASSERT_EQ ( 1 , GetSstFileCount ( options . db_paths [ 1 ] . path ) ) ; <nl> <nl> / / Full compaction to DB path 0 <nl> - db_ - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr , false , - 1 , 0 ) ; <nl> + compact_options . target_path_id = 0 ; <nl> + db_ - > CompactRange ( compact_options , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> ASSERT_EQ ( 1 , TotalLiveFiles ( 1 ) ) ; <nl> ASSERT_EQ ( 1 , GetSstFileCount ( options . db_paths [ 0 ] . path ) ) ; <nl> ASSERT_EQ ( 0 , GetSstFileCount ( options . db_paths [ 1 ] . path ) ) ; <nl> <nl> / / Fail when compacting to an invalid path ID <nl> - ASSERT_TRUE ( db_ - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr , false , - 1 , 2 ) <nl> + compact_options . target_path_id = 2 ; <nl> + ASSERT_TRUE ( db_ - > CompactRange ( compact_options , handles_ [ 1 ] , nullptr , nullptr ) <nl> . IsInvalidArgument ( ) ) ; <nl> } <nl> <nl> TEST_F ( DBTest , ManualLevelCompactionOutputPathId ) { <nl> ASSERT_EQ ( " 1 , 2 " , FilesPerLevel ( 1 ) ) ; <nl> ASSERT_EQ ( 2 , GetSstFileCount ( options . db_paths [ 1 ] . path ) ) ; <nl> ASSERT_EQ ( 1 , GetSstFileCount ( options . db_paths [ 0 ] . path ) ) ; <nl> - db_ - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr , false , 1 , 1 ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . target_path_id = 1 ; <nl> + db_ - > CompactRange ( compact_options , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> ASSERT_EQ ( " 0 , 1 " , FilesPerLevel ( 1 ) ) ; <nl> ASSERT_EQ ( 1 , GetSstFileCount ( options . db_paths [ 1 ] . path ) ) ; <nl> ASSERT_EQ ( 0 , GetSstFileCount ( options . db_paths [ 0 ] . path ) ) ; <nl> TEST_F ( DBTest , DBOpen_Change_NumLevels ) { <nl> <nl> ASSERT_OK ( Put ( 1 , " a " , " 123 " ) ) ; <nl> ASSERT_OK ( Put ( 1 , " b " , " 234 " ) ) ; <nl> - db_ - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> Close ( ) ; <nl> <nl> options . create_if_missing = false ; <nl> TEST_F ( DBTest , DropWrites ) { <nl> true / * disallow trivial move * / ) ; <nl> } <nl> } else { <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> } <nl> } <nl> <nl> TEST_F ( DBTest , CompactOnFlush ) { <nl> ASSERT_OK ( Flush ( 1 ) ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ v2 , v1 ] " ) ; <nl> <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ v2 ] " ) ; <nl> <nl> / / Case 2 : Delete followed by another delete <nl> TEST_F ( DBTest , CompactOnFlush ) { <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ DEL , DEL , v2 ] " ) ; <nl> ASSERT_OK ( Flush ( 1 ) ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ DEL , v2 ] " ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ ] " ) ; <nl> <nl> / / Case 3 : Put followed by a delete <nl> TEST_F ( DBTest , CompactOnFlush ) { <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ DEL , v3 ] " ) ; <nl> ASSERT_OK ( Flush ( 1 ) ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ DEL ] " ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ ] " ) ; <nl> <nl> / / Case 4 : Put followed by another Put <nl> TEST_F ( DBTest , CompactOnFlush ) { <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ v5 , v4 ] " ) ; <nl> ASSERT_OK ( Flush ( 1 ) ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ v5 ] " ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ v5 ] " ) ; <nl> <nl> / / clear database <nl> Delete ( 1 , " foo " ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ ] " ) ; <nl> <nl> / / Case 5 : Put followed by snapshot followed by another Put <nl> TEST_F ( DBTest , CompactOnFlush ) { <nl> <nl> / / clear database <nl> Delete ( 1 , " foo " ) ; <nl> - dbfull ( ) - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , <nl> + nullptr ) ; <nl> ASSERT_EQ ( AllEntriesFor ( " foo " , 1 ) , " [ ] " ) ; <nl> <nl> / / Case 5 : snapshot followed by a put followed by another Put <nl> class ModelDB : public DB { <nl> } <nl> } <nl> using DB : : CompactRange ; <nl> - virtual Status CompactRange ( ColumnFamilyHandle * column_family , <nl> - const Slice * start , const Slice * end , <nl> - bool reduce_level , int target_level , <nl> - uint32_t output_path_id ) override { <nl> + virtual Status CompactRange ( const CompactRangeOptions & options , <nl> + ColumnFamilyHandle * column_family , <nl> + const Slice * start , const Slice * end ) override { <nl> return Status : : NotSupported ( " Not supported operation . " ) ; <nl> } <nl> <nl> void PrefixScanInit ( DBTest * dbtest ) { <nl> keystr = std : : string ( buf ) ; <nl> ASSERT_OK ( dbtest - > Put ( keystr , keystr ) ) ; <nl> dbtest - > Flush ( ) ; <nl> - dbtest - > dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; / / move to level 1 <nl> + dbtest - > dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , <nl> + nullptr ) ; / / move to level 1 <nl> <nl> / / GROUP 1 <nl> for ( int i = 1 ; i < = small_range_sstfiles ; i + + ) { <nl> TEST_F ( DBTest , TailingIteratorIncomplete ) { <nl> / / we either see the entry or it ' s not in cache <nl> ASSERT_TRUE ( iter - > Valid ( ) | | iter - > status ( ) . IsIncomplete ( ) ) ; <nl> <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ) ; <nl> iter - > SeekToFirst ( ) ; <nl> / / should still be true after compaction <nl> ASSERT_TRUE ( iter - > Valid ( ) | | iter - > status ( ) . IsIncomplete ( ) ) ; <nl> TEST_F ( DBTest , ManagedTailingIteratorIncomplete ) { <nl> / / we either see the entry or it ' s not in cache <nl> ASSERT_TRUE ( iter - > Valid ( ) | | iter - > status ( ) . IsIncomplete ( ) ) ; <nl> <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ) ; <nl> iter - > SeekToFirst ( ) ; <nl> / / should still be true after compaction <nl> ASSERT_TRUE ( iter - > Valid ( ) | | iter - > status ( ) . IsIncomplete ( ) ) ; <nl> TEST_F ( DBTest , FIFOCompactionTest ) { <nl> if ( iter = = 0 ) { <nl> ASSERT_OK ( dbfull ( ) - > TEST_WaitForCompact ( ) ) ; <nl> } else { <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ) ; <nl> } <nl> / / only 5 files should survive <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 0 ) , 5 ) ; <nl> TEST_F ( DBTest , DynamicMemtableOptions ) { <nl> ASSERT_GT ( SizeAtLevel ( 0 ) , k64KB - k5KB ) ; <nl> <nl> / / Clean up L0 <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 0 ) , 0 ) ; <nl> <nl> / / Increase buffer size <nl> TEST_F ( DBTest , DynamicMemtableOptions ) { <nl> { " max_write_buffer_number " , " 8 " } , <nl> } ) ) ; <nl> / / Clean up memtable and L0 <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> SleepingBackgroundTask sleeping_task_low2 ; <nl> env_ - > Schedule ( & SleepingBackgroundTask : : DoSleepTask , & sleeping_task_low2 , <nl> TEST_F ( DBTest , DynamicMemtableOptions ) { <nl> { " max_write_buffer_number " , " 4 " } , <nl> } ) ) ; <nl> / / Clean up memtable and L0 <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> SleepingBackgroundTask sleeping_task_low3 ; <nl> env_ - > Schedule ( & SleepingBackgroundTask : : DoSleepTask , & sleeping_task_low3 , <nl> TEST_F ( DBTest , PreShutdownManualCompaction ) { <nl> MakeTables ( 1 , " a " , " z " , 1 ) ; <nl> ASSERT_EQ ( " 0 , 1 , 2 " , FilesPerLevel ( 1 ) ) ; <nl> CancelAllBackgroundWork ( db_ ) ; <nl> - db_ - > CompactRange ( handles_ [ 1 ] , nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , handles_ [ 1 ] , nullptr , nullptr ) ; <nl> ASSERT_EQ ( " 0 , 1 , 2 " , FilesPerLevel ( 1 ) ) ; <nl> <nl> if ( iter = = 0 ) { <nl> TEST_F ( DBTest , DynamicLevelMaxBytesBase ) { <nl> } <nl> <nl> / / Test compact range works <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> / / All data should be in the last level . <nl> ColumnFamilyMetaData cf_meta ; <nl> db_ - > GetColumnFamilyMetaData ( & cf_meta ) ; <nl> TEST_F ( DBTest , DynamicLevelMaxBytesCompactRange ) { <nl> DestroyAndReopen ( options ) ; <nl> <nl> / / Compact against empty DB <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> uint64_t int_prop ; <nl> std : : string str_prop ; <nl> TEST_F ( DBTest , DynamicLevelMaxBytesCompactRange ) { <nl> } ) ; <nl> rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ; <nl> <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( output_levels . size ( ) , 2 ) ; <nl> ASSERT_TRUE ( output_levels . find ( 3 ) ! = output_levels . end ( ) ) ; <nl> ASSERT_TRUE ( output_levels . find ( 4 ) ! = output_levels . end ( ) ) ; <nl> TEST_F ( DBTest , MigrateToDynamicLevelMaxBytesBase ) { <nl> / / Issue manual compaction in one thread and still verify DB state <nl> / / in main thread . <nl> std : : thread t ( [ & ] ( ) { <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr , true , options . num_levels - 1 ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . change_level = true ; <nl> + compact_options . target_level = options . num_levels - 1 ; <nl> + dbfull ( ) - > CompactRange ( compact_options , nullptr , nullptr ) ; <nl> compaction_finished . store ( true ) ; <nl> } ) ; <nl> do { <nl> TEST_F ( DBTest , DynamicCompactionOptions ) { <nl> / / Clean up memtable and L0 . Block compaction threads . If continue to write <nl> / / and flush memtables . We should see put timeout after 8 memtable flushes <nl> / / since level0_stop_writes_trigger = 8 <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> / / Block compaction <nl> SleepingBackgroundTask sleeping_task_low1 ; <nl> env_ - > Schedule ( & SleepingBackgroundTask : : DoSleepTask , & sleeping_task_low1 , <nl> TEST_F ( DBTest , DynamicCompactionOptions ) { <nl> ASSERT_OK ( dbfull ( ) - > SetOptions ( { <nl> { " level0_stop_writes_trigger " , " 6 " } <nl> } ) ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 0 ) , 0 ) ; <nl> <nl> / / Block compaction <nl> TEST_F ( DBTest , DynamicCompactionOptions ) { <nl> ASSERT_OK ( dbfull ( ) - > SetOptions ( { <nl> { " disable_auto_compactions " , " true " } <nl> } ) ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 0 ) , 0 ) ; <nl> <nl> for ( int i = 0 ; i < 4 ; + + i ) { <nl> TEST_F ( DBTest , DynamicCompactionOptions ) { <nl> ASSERT_OK ( dbfull ( ) - > SetOptions ( { <nl> { " disable_auto_compactions " , " false " } <nl> } ) ) ; <nl> - dbfull ( ) - > CompactRange ( nullptr , nullptr ) ; <nl> + dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( NumTableFilesAtLevel ( 0 ) , 0 ) ; <nl> <nl> for ( int i = 0 ; i < 4 ; + + i ) { <nl> TEST_F ( DBTest , FilterCompactionTimeTest ) { <nl> Flush ( ) ; <nl> } <nl> <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ) ; <nl> ASSERT_EQ ( 0U , CountLiveFiles ( ) ) ; <nl> <nl> Reopen ( options ) ; <nl> TEST_F ( DBTest , PromoteL0Failure ) { <nl> status = experimental : : PromoteL0 ( db_ , db_ - > DefaultColumnFamily ( ) ) ; <nl> ASSERT_TRUE ( status . IsInvalidArgument ( ) ) ; <nl> <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ) ; <nl> / / Now there is a file in L1 . <nl> ASSERT_GE ( NumTableFilesAtLevel ( 1 , 0 ) , 1 ) ; <nl> <nl> TEST_F ( DBTest , HugeNumberOfLevels ) { <nl> ASSERT_OK ( Put ( Key ( i ) , RandomString ( & rnd , 1024 ) ) ) ; <nl> } <nl> <nl> - ASSERT_OK ( db_ - > CompactRange ( nullptr , nullptr ) ) ; <nl> + ASSERT_OK ( db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ) ; <nl> } <nl> <nl> / / Github issue # 595 <nl> TEST_F ( DBTest , UniversalCompactionTargetLevel ) { <nl> <nl> ASSERT_EQ ( " 3 " , FilesPerLevel ( 0 ) ) ; <nl> / / Compact all files into 1 file and put it in L4 <nl> - db_ - > CompactRange ( nullptr , nullptr , true , 4 ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . change_level = true ; <nl> + compact_options . target_level = 4 ; <nl> + db_ - > CompactRange ( compact_options , nullptr , nullptr ) ; <nl> ASSERT_EQ ( " 0 , 0 , 0 , 0 , 1 " , FilesPerLevel ( 0 ) ) ; <nl> } <nl> <nl> TEST_F ( DBTest , SuggestCompactRangeNoTwoLevel0Compactions ) { <nl> for ( int num = 0 ; num < 10 ; num + + ) { <nl> GenerateNewRandomFile ( & rnd ) ; <nl> } <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> <nl> rocksdb : : SyncPoint : : GetInstance ( ) - > LoadDependency ( <nl> { { " CompactionJob : : Run ( ) : Start " , <nl> mmm a / db / deletefile_test . cc <nl> ppp b / db / deletefile_test . cc <nl> TEST_F ( DeleteFileTest , PurgeObsoleteFilesTest ) { <nl> / / 2 ssts , 1 manifest <nl> CheckFileTypeCounts ( dbname_ , 0 , 2 , 1 ) ; <nl> std : : string first ( " 0 " ) , last ( " 999999 " ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . change_level = true ; <nl> + compact_options . target_level = 2 ; <nl> Slice first_slice ( first ) , last_slice ( last ) ; <nl> - db_ - > CompactRange ( & first_slice , & last_slice , true , 2 ) ; <nl> + db_ - > CompactRange ( compact_options , & first_slice , & last_slice ) ; <nl> / / 1 sst after compaction <nl> CheckFileTypeCounts ( dbname_ , 0 , 1 , 1 ) ; <nl> <nl> TEST_F ( DeleteFileTest , PurgeObsoleteFilesTest ) { <nl> Iterator * itr = 0 ; <nl> CreateTwoLevels ( ) ; <nl> itr = db_ - > NewIterator ( ReadOptions ( ) ) ; <nl> - db_ - > CompactRange ( & first_slice , & last_slice , true , 2 ) ; <nl> + db_ - > CompactRange ( compact_options , & first_slice , & last_slice ) ; <nl> / / 3 sst after compaction with live iterator <nl> CheckFileTypeCounts ( dbname_ , 0 , 3 , 1 ) ; <nl> delete itr ; <nl> mmm a / db / fault_injection_test . cc <nl> ppp b / db / fault_injection_test . cc <nl> class FaultInjectionTest : public testing : : Test { <nl> <nl> Build ( write_options , 0 , num_pre_sync ) ; <nl> if ( sync_use_compact_ ) { <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> } <nl> write_options . sync = false ; <nl> Build ( write_options , num_pre_sync , num_post_sync ) ; <nl> mmm a / db / listener_test . cc <nl> ppp b / db / listener_test . cc <nl> TEST_F ( EventListenerTest , OnSingleDBCompactionTest ) { <nl> ASSERT_OK ( Flush ( static_cast < int > ( i ) ) ) ; <nl> const Slice kStart = " a " ; <nl> const Slice kEnd = " z " ; <nl> - ASSERT_OK ( dbfull ( ) - > CompactRange ( handles_ [ i ] , & kStart , & kEnd ) ) ; <nl> + ASSERT_OK ( dbfull ( ) - > CompactRange ( CompactRangeOptions ( ) , handles_ [ i ] , <nl> + & kStart , & kEnd ) ) ; <nl> dbfull ( ) - > TEST_WaitForFlushMemTable ( ) ; <nl> dbfull ( ) - > TEST_WaitForCompact ( ) ; <nl> } <nl> mmm a / db / merge_test . cc <nl> ppp b / db / merge_test . cc <nl> void testCounters ( Counters & counters , DB * db , bool test_compaction ) { <nl> db - > Flush ( o ) ; <nl> <nl> cout < < " Compaction started . . . \ n " ; <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> cout < < " Compaction ended \ n " ; <nl> <nl> dumpDb ( db ) ; <nl> void testPartialMerge ( Counters * counters , DB * db , size_t max_merge , <nl> tmp_sum + = i ; <nl> } <nl> db - > Flush ( o ) ; <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( tmp_sum , counters - > assert_get ( " b " ) ) ; <nl> if ( count > max_merge ) { <nl> / / in this case , FullMerge should be called instead . <nl> void testPartialMerge ( Counters * counters , DB * db , size_t max_merge , <nl> tmp_sum + = i ; <nl> } <nl> db - > Flush ( o ) ; <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( tmp_sum , counters - > assert_get ( " c " ) ) ; <nl> ASSERT_EQ ( num_partial_merge_calls , 0U ) ; <nl> } <nl> void runTest ( int argc , const string & dbname , const bool use_ttl = false ) { <nl> counters . add ( " test - key " , 1 ) ; <nl> counters . add ( " test - key " , 1 ) ; <nl> counters . add ( " test - key " , 1 ) ; <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> } <nl> <nl> DB * reopen_db ; <nl> mmm a / include / rocksdb / db . h <nl> ppp b / include / rocksdb / db . h <nl> struct ReadOptions ; <nl> struct WriteOptions ; <nl> struct FlushOptions ; <nl> struct CompactionOptions ; <nl> + struct CompactRangeOptions ; <nl> struct TableProperties ; <nl> class WriteBatch ; <nl> class Env ; <nl> class DB { <nl> / / begin = = nullptr is treated as a key before all keys in the database . <nl> / / end = = nullptr is treated as a key after all keys in the database . <nl> / / Therefore the following call will compact the entire database : <nl> - / / db - > CompactRange ( nullptr , nullptr ) ; <nl> + / / db - > CompactRange ( options , nullptr , nullptr ) ; <nl> / / Note that after the entire database is compacted , all data are pushed <nl> - / / down to the last level containing any data . If the total data size <nl> - / / after compaction is reduced , that level might not be appropriate for <nl> - / / hosting all the files . In this case , client could set change_level <nl> - / / to true , to move the files back to the minimum level capable of holding <nl> - / / the data set or a given level ( specified by non - negative target_level ) . <nl> - / / Compaction outputs should be placed in options . db_paths [ target_path_id ] . <nl> - / / Behavior is undefined if target_path_id is out of range . <nl> - virtual Status CompactRange ( ColumnFamilyHandle * column_family , <nl> - const Slice * begin , const Slice * end , <nl> - bool change_level = false , int target_level = - 1 , <nl> - uint32_t target_path_id = 0 ) = 0 ; <nl> - virtual Status CompactRange ( const Slice * begin , const Slice * end , <nl> - bool change_level = false , int target_level = - 1 , <nl> - uint32_t target_path_id = 0 ) { <nl> - return CompactRange ( DefaultColumnFamily ( ) , begin , end , change_level , <nl> - target_level , target_path_id ) ; <nl> + / / down to the last level containing any data . If the total data size after <nl> + / / compaction is reduced , that level might not be appropriate for hosting all <nl> + / / the files . In this case , client could set options . change_level to true , to <nl> + / / move the files back to the minimum level capable of holding the data set <nl> + / / or a given level ( specified by non - negative options . target_level ) . <nl> + virtual Status CompactRange ( const CompactRangeOptions & options , <nl> + ColumnFamilyHandle * column_family , <nl> + const Slice * begin , const Slice * end ) = 0 ; <nl> + virtual Status CompactRange ( const CompactRangeOptions & options , <nl> + const Slice * begin , const Slice * end ) { <nl> + return CompactRange ( options , DefaultColumnFamily ( ) , begin , end ) ; <nl> } <nl> + <nl> + __attribute__ ( ( deprecated ) ) virtual Status <nl> + CompactRange ( ColumnFamilyHandle * column_family , const Slice * begin , <nl> + const Slice * end , bool change_level = false , <nl> + int target_level = - 1 , uint32_t target_path_id = 0 ) { <nl> + CompactRangeOptions options ; <nl> + options . change_level = change_level ; <nl> + options . target_level = target_level ; <nl> + options . target_path_id = target_path_id ; <nl> + return CompactRange ( options , column_family , begin , end ) ; <nl> + } <nl> + __attribute__ ( ( deprecated ) ) virtual Status <nl> + CompactRange ( const Slice * begin , const Slice * end , <nl> + bool change_level = false , int target_level = - 1 , <nl> + uint32_t target_path_id = 0 ) { <nl> + CompactRangeOptions options ; <nl> + options . change_level = change_level ; <nl> + options . target_level = target_level ; <nl> + options . target_path_id = target_path_id ; <nl> + return CompactRange ( options , DefaultColumnFamily ( ) , begin , end ) ; <nl> + } <nl> + <nl> virtual Status SetOptions ( ColumnFamilyHandle * column_family , <nl> const std : : unordered_map < std : : string , std : : string > & new_options ) { <nl> return Status : : NotSupported ( " Not implemented " ) ; <nl> mmm a / include / rocksdb / options . h <nl> ppp b / include / rocksdb / options . h <nl> struct CompactionOptions { <nl> : compression ( kSnappyCompression ) , <nl> output_file_size_limit ( std : : numeric_limits < uint64_t > : : max ( ) ) { } <nl> } ; <nl> + <nl> + / / CompactRangeOptions is used by CompactRange ( ) call . <nl> + struct CompactRangeOptions { <nl> + / / If true , compacted files will be moved to the minimum level capable <nl> + / / of holding the data or given level ( specified non - negative target_level ) . <nl> + bool change_level = false ; <nl> + / / If change_level is true and target_level have non - negative value , compacted <nl> + / / files will be moved to target_level . <nl> + int target_level = - 1 ; <nl> + / / Compaction outputs will be placed in options . db_paths [ target_path_id ] . <nl> + / / Behavior is undefined if target_path_id is out of range . <nl> + uint32_t target_path_id = 0 ; <nl> + } ; <nl> } / / namespace rocksdb <nl> <nl> # endif / / STORAGE_ROCKSDB_INCLUDE_OPTIONS_H_ <nl> mmm a / include / rocksdb / utilities / stackable_db . h <nl> ppp b / include / rocksdb / utilities / stackable_db . h <nl> class StackableDB : public DB { <nl> } <nl> <nl> using DB : : CompactRange ; <nl> - virtual Status CompactRange ( ColumnFamilyHandle * column_family , <nl> - const Slice * begin , const Slice * end , <nl> - bool change_level = false , int target_level = - 1 , <nl> - uint32_t target_path_id = 0 ) override { <nl> - return db_ - > CompactRange ( column_family , begin , end , change_level , <nl> - target_level , target_path_id ) ; <nl> + virtual Status CompactRange ( const CompactRangeOptions & options , <nl> + ColumnFamilyHandle * column_family , <nl> + const Slice * begin , const Slice * end ) override { <nl> + return db_ - > CompactRange ( options , column_family , begin , end ) ; <nl> } <nl> <nl> using DB : : CompactFiles ; <nl> mmm a / java / rocksjni / rocksjni . cc <nl> ppp b / java / rocksjni / rocksjni . cc <nl> void rocksdb_compactrange_helper ( JNIEnv * env , rocksdb : : DB * db , <nl> jint jtarget_level , jint jtarget_path_id ) { <nl> <nl> rocksdb : : Status s ; <nl> + rocksdb : : CompactRangeOptions compact_options ; <nl> + compact_options . change_level = jreduce_level ; <nl> + compact_options . target_level = jtarget_level ; <nl> + compact_options . target_path_id = static_cast < uint32_t > ( jtarget_path_id ) ; <nl> if ( cf_handle ! = nullptr ) { <nl> - s = db - > CompactRange ( cf_handle , nullptr , nullptr , jreduce_level , <nl> - jtarget_level , static_cast < uint32_t > ( jtarget_path_id ) ) ; <nl> + s = db - > CompactRange ( compact_options , cf_handle , nullptr , nullptr ) ; <nl> } else { <nl> / / backwards compatibility <nl> - s = db - > CompactRange ( nullptr , nullptr , jreduce_level , <nl> - jtarget_level , static_cast < uint32_t > ( jtarget_path_id ) ) ; <nl> + s = db - > CompactRange ( compact_options , nullptr , nullptr ) ; <nl> } <nl> <nl> if ( s . ok ( ) ) { <nl> void rocksdb_compactrange_helper ( JNIEnv * env , rocksdb : : DB * db , <nl> const rocksdb : : Slice end_slice ( reinterpret_cast < char * > ( end ) , jend_len ) ; <nl> <nl> rocksdb : : Status s ; <nl> + rocksdb : : CompactRangeOptions compact_options ; <nl> + compact_options . change_level = jreduce_level ; <nl> + compact_options . target_level = jtarget_level ; <nl> + compact_options . target_path_id = static_cast < uint32_t > ( jtarget_path_id ) ; <nl> if ( cf_handle ! = nullptr ) { <nl> - s = db - > CompactRange ( cf_handle , & begin_slice , & end_slice , jreduce_level , <nl> - jtarget_level , static_cast < uint32_t > ( jtarget_path_id ) ) ; <nl> + s = db - > CompactRange ( compact_options , cf_handle , & begin_slice , & end_slice ) ; <nl> } else { <nl> / / backwards compatibility <nl> - s = db - > CompactRange ( & begin_slice , & end_slice , jreduce_level , <nl> - jtarget_level , static_cast < uint32_t > ( jtarget_path_id ) ) ; <nl> + s = db - > CompactRange ( compact_options , & begin_slice , & end_slice ) ; <nl> } <nl> <nl> env - > ReleaseByteArrayElements ( jbegin , begin , JNI_ABORT ) ; <nl> mmm a / util / ldb_cmd . cc <nl> ppp b / util / ldb_cmd . cc <nl> void CompactorCommand : : DoCommand ( ) { <nl> end = new Slice ( to_ ) ; <nl> } <nl> <nl> - db_ - > CompactRange ( begin , end ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , begin , end ) ; <nl> exec_state_ = LDBCommandExecuteResult : : Succeed ( " " ) ; <nl> <nl> delete begin ; <nl> void DBLoaderCommand : : DoCommand ( ) { <nl> cout < < " Warning : " < < bad_lines < < " bad lines ignored . " < < endl ; <nl> } <nl> if ( compact_ ) { <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> } <nl> } <nl> <nl> void ReduceDBLevelsCommand : : DoCommand ( ) { <nl> } <nl> / / Compact the whole DB to put all files to the highest level . <nl> fprintf ( stdout , " Compacting the db . . . \ n " ) ; <nl> - db_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> CloseDB ( ) ; <nl> <nl> EnvOptions soptions ; <nl> void ChangeCompactionStyleCommand : : DoCommand ( ) { <nl> files_per_level . c_str ( ) ) ; <nl> <nl> / / manual compact into a single file and move the file to level 0 <nl> - db_ - > CompactRange ( nullptr , nullptr , <nl> - true / * reduce level * / , <nl> - 0 / * reduce to level 0 * / ) ; <nl> + CompactRangeOptions compact_options ; <nl> + compact_options . change_level = true ; <nl> + compact_options . target_level = 0 ; <nl> + db_ - > CompactRange ( compact_options , nullptr , nullptr ) ; <nl> <nl> / / verify compaction result <nl> files_per_level = " " ; <nl> mmm a / util / manual_compaction_test . cc <nl> ppp b / util / manual_compaction_test . cc <nl> TEST_F ( ManualCompactionTest , CompactTouchesAllKeys ) { <nl> db - > Put ( WriteOptions ( ) , Slice ( " key4 " ) , Slice ( " destroy " ) ) ; <nl> <nl> Slice key4 ( " key4 " ) ; <nl> - db - > CompactRange ( nullptr , & key4 ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , & key4 ) ; <nl> Iterator * itr = db - > NewIterator ( ReadOptions ( ) ) ; <nl> itr - > SeekToFirst ( ) ; <nl> ASSERT_TRUE ( itr - > Valid ( ) ) ; <nl> TEST_F ( ManualCompactionTest , Test ) { <nl> rocksdb : : Slice greatest ( end_key . data ( ) , end_key . size ( ) ) ; <nl> <nl> / / commenting out the line below causes the example to work correctly <nl> - db - > CompactRange ( & least , & greatest ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , & least , & greatest ) ; <nl> <nl> / / count the keys <nl> rocksdb : : Iterator * iter = db - > NewIterator ( rocksdb : : ReadOptions ( ) ) ; <nl> mmm a / utilities / compacted_db / compacted_db_impl . h <nl> ppp b / utilities / compacted_db / compacted_db_impl . h <nl> class CompactedDBImpl : public DBImpl { <nl> return Status : : NotSupported ( " Not supported in compacted db mode . " ) ; <nl> } <nl> using DBImpl : : CompactRange ; <nl> - virtual Status CompactRange ( ColumnFamilyHandle * column_family , <nl> - const Slice * begin , const Slice * end , <nl> - bool change_level = false , int target_level = - 1 , <nl> - uint32_t target_path_id = 0 ) override { <nl> + virtual Status CompactRange ( const CompactRangeOptions & options , <nl> + ColumnFamilyHandle * column_family , <nl> + const Slice * begin , const Slice * end ) override { <nl> return Status : : NotSupported ( " Not supported in compacted db mode . " ) ; <nl> } <nl> <nl> mmm a / utilities / merge_operators / string_append / stringappend_test . cc <nl> ppp b / utilities / merge_operators / string_append / stringappend_test . cc <nl> TEST_F ( StringAppendOperatorTest , PersistentFlushAndCompaction ) { <nl> slists . Append ( " c " , " bbnagnagsx " ) ; <nl> slists . Append ( " a " , " sa " ) ; <nl> slists . Append ( " b " , " df " ) ; <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> slists . Get ( " a " , & a ) ; <nl> slists . Get ( " b " , & b ) ; <nl> slists . Get ( " c " , & c ) ; <nl> TEST_F ( StringAppendOperatorTest , PersistentFlushAndCompaction ) { <nl> ASSERT_EQ ( c , " asdasd \ nasdasd \ nbbnagnagsx \ nrogosh " ) ; <nl> <nl> / / Compact , Get <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> ASSERT_EQ ( a , " x \ nt \ nr \ nsa \ ngh \ njk " ) ; <nl> ASSERT_EQ ( b , " y \ n2 \ nmonkey \ ndf \ nl ; " ) ; <nl> ASSERT_EQ ( c , " asdasd \ nasdasd \ nbbnagnagsx \ nrogosh " ) ; <nl> TEST_F ( StringAppendOperatorTest , PersistentFlushAndCompaction ) { <nl> / / Append , Flush , Compact , Get <nl> slists . Append ( " b " , " afcg " ) ; <nl> db - > Flush ( rocksdb : : FlushOptions ( ) ) ; <nl> - db - > CompactRange ( nullptr , nullptr ) ; <nl> + db - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> slists . Get ( " b " , & b ) ; <nl> ASSERT_EQ ( b , " y \ n2 \ nmonkey \ ndf \ nl ; \ nafcg " ) ; <nl> } <nl> mmm a / utilities / spatialdb / spatial_db . cc <nl> ppp b / utilities / spatialdb / spatial_db . cc <nl> class SpatialDBImpl : public SpatialDB { <nl> <nl> Status t = Flush ( FlushOptions ( ) , cfh ) ; <nl> if ( t . ok ( ) ) { <nl> - t = CompactRange ( cfh , nullptr , nullptr ) ; <nl> + t = CompactRange ( CompactRangeOptions ( ) , cfh , nullptr , nullptr ) ; <nl> } <nl> <nl> { <nl> mmm a / utilities / ttl / ttl_test . cc <nl> ppp b / utilities / ttl / ttl_test . cc <nl> class TtlTest : public testing : : Test { <nl> / / Runs a manual compaction <nl> void ManualCompact ( ColumnFamilyHandle * cf = nullptr ) { <nl> if ( cf = = nullptr ) { <nl> - db_ttl_ - > CompactRange ( nullptr , nullptr ) ; <nl> + db_ttl_ - > CompactRange ( CompactRangeOptions ( ) , nullptr , nullptr ) ; <nl> } else { <nl> - db_ttl_ - > CompactRange ( cf , nullptr , nullptr ) ; <nl> + db_ttl_ - > CompactRange ( CompactRangeOptions ( ) , cf , nullptr , nullptr ) ; <nl> } <nl> } <nl> <nl>
Use CompactRangeOptions for CompactRange
facebook/rocksdb
12e030a99243b50581177d891eed74d6cd5a47ee
2015-06-17T21:36:14Z
mmm a / hphp / doc / ir . specification <nl> ppp b / hphp / doc / ir . specification <nl> To string conversions : <nl> Load the saved frame pointer from the activation record pointed to by S0 into <nl> D . <nl> <nl> + | BeginInlining < offset > , ND , S ( StkPtr ) , NF <nl> + <nl> + Marks the start of an inlined function whose stack resides offset cells below <nl> + the SP . It has no effect other than to hint to optimization passes that at the <nl> + start of the inlined function its stack is dead . <nl> + <nl> | DefInlineFP < func , retBCOff , retSPOff > , D ( FramePtr ) , <nl> | S ( StkPtr ) S ( FramePtr ) , <nl> | NF <nl> To string conversions : <nl> pushed . CallArray pops the array off the stack , pushes the elements of the <nl> array as arguments , and invokes the function in the ActRec . <nl> <nl> + | SyncReturnBC < spOffset , bcOffset > , ND , S ( StkPtr ) S ( FramePtr ) , NF <nl> + <nl> + Stores bcOffset into the frame at spOffset from S0 as the return bytecode <nl> + address and the frame S1 as the return frame . <nl> + <nl> | Call < offset , numParams , returnOff , funcd , destroyLocals > , ND , <nl> | S ( StkPtr ) S ( FramePtr ) , <nl> | Er <nl> mmm a / hphp / runtime / vm / jit / code - gen - x64 . cpp <nl> ppp b / hphp / runtime / vm / jit / code - gen - x64 . cpp <nl> NOOP_OPCODE ( HintLocInner ) <nl> NOOP_OPCODE ( HintStkInner ) <nl> NOOP_OPCODE ( AssertStk ) <nl> NOOP_OPCODE ( FinishMemberOp ) <nl> + NOOP_OPCODE ( BeginInlining ) <nl> <nl> CALL_OPCODE ( AddElemStrKey ) <nl> CALL_OPCODE ( AddElemIntKey ) <nl> void CodeGenerator : : cgSpillFrame ( IRInstruction * inst ) { <nl> v < < storeli { encoded , spReg [ spOffset + int ( AROFF ( m_numArgsAndFlags ) ) ] } ; <nl> } <nl> <nl> + void CodeGenerator : : cgSyncReturnBC ( IRInstruction * inst ) { <nl> + auto const extra = inst - > extra < SyncReturnBC > ( ) ; <nl> + auto const spOffset = cellsToBytes ( extra - > spOffset . offset ) ; <nl> + auto const bcOffset = extra - > bcOffset ; <nl> + auto const spReg = srcLoc ( inst , 0 ) . reg ( ) ; <nl> + auto const fpReg = srcLoc ( inst , 1 ) . reg ( ) ; <nl> + <nl> + auto & v = vmain ( ) ; <nl> + v < < storeli { safe_cast < int32_t > ( bcOffset ) , spReg [ spOffset + AROFF ( m_soff ) ] } ; <nl> + v < < store { fpReg , spReg [ spOffset + AROFF ( m_sfp ) ] } ; <nl> + } <nl> + <nl> void CodeGenerator : : cgStClosureArg ( IRInstruction * inst ) { <nl> auto const ptr = srcLoc ( inst , 0 ) . reg ( ) ; <nl> auto const off = inst - > extra < StClosureArg > ( ) - > offsetBytes ; <nl> mmm a / hphp / runtime / vm / jit / dce . cpp <nl> ppp b / hphp / runtime / vm / jit / dce . cpp <nl> bool canDCE ( IRInstruction * inst ) { <nl> case StMBase : <nl> case FinishMemberOp : <nl> case InlineReturnNoFrame : <nl> + case BeginInlining : <nl> + case SyncReturnBC : <nl> return false ; <nl> } <nl> not_reached ( ) ; <nl> mmm a / hphp / runtime / vm / jit / extra - data . h <nl> ppp b / hphp / runtime / vm / jit / extra - data . h <nl> struct InlineReturnNoFrameData : IRExtraData { <nl> FPRelOffset frameOffset ; <nl> } ; <nl> <nl> + struct SyncReturnBCData : IRExtraData { <nl> + SyncReturnBCData ( Offset bcOff , IRSPOffset spOff ) <nl> + : bcOffset ( bcOff ) <nl> + , spOffset ( spOff ) <nl> + { } <nl> + std : : string show ( ) const { <nl> + return folly : : to < std : : string > ( bcOffset , " , " , spOffset . offset ) ; <nl> + } <nl> + <nl> + Offset bcOffset ; <nl> + IRSPOffset spOffset ; <nl> + } ; <nl> + <nl> struct CallArrayData : IRExtraData { <nl> explicit CallArrayData ( IRSPOffset spOffset , <nl> int32_t numParams , <nl> X ( DefSP , FPInvOffsetData ) ; <nl> X ( LdStk , IRSPOffsetData ) ; <nl> X ( LdStkAddr , IRSPOffsetData ) ; <nl> X ( DefInlineFP , DefInlineFPData ) ; <nl> + X ( BeginInlining , IRSPOffsetData ) ; <nl> + X ( SyncReturnBC , SyncReturnBCData ) ; <nl> X ( InlineReturnNoFrame , InlineReturnNoFrameData ) ; <nl> X ( ReqRetranslate , ReqRetranslateData ) ; <nl> X ( ReqBindJmp , ReqBindJmpData ) ; <nl> mmm a / hphp / runtime / vm / jit / irgen - inlining . cpp <nl> ppp b / hphp / runtime / vm / jit / irgen - inlining . cpp <nl> bool isInlining ( const IRGS & env ) { <nl> * / / FPI region : <nl> * SpillFrame sp , . . . <nl> * / / . . . probably some StStks due to argument expressions <nl> + * BeginInlining < offset > sp <nl> * fp2 = DefInlineFP < func , retBC , retSP , off > sp <nl> * <nl> * / / . . . callee body . . . <nl> bool beginInlining ( IRGS & env , <nl> fpiFunc ? fpiFunc - > fullName ( ) - > data ( ) : " null " , <nl> target ? target - > fullName ( ) - > data ( ) : " null " ) ; <nl> <nl> + auto inlineStack = offsetFromIRSP ( env , BCSPOffset { 0 } ) ; <nl> + gen ( env , BeginInlining , IRSPOffsetData { inlineStack } , sp ( env ) ) ; <nl> + <nl> DefInlineFPData data ; <nl> data . target = target ; <nl> data . retBCOff = returnBcOffset ; <nl> mmm a / hphp / runtime / vm / jit / memory - effects . cpp <nl> ppp b / hphp / runtime / vm / jit / memory - effects . cpp <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> * effectively converted AStack locations into a frame until the <nl> * InlineReturn ) . <nl> * <nl> + * Note : We may push the publishing of the inline frame below the start of <nl> + * the inline function so that we can avoid spilling the inline frame in the <nl> + * common case . Because of this we cannot add the stack positions within the <nl> + * inline function to the kill set here as they may be live having been stored <nl> + * on the main trace . <nl> + * <nl> * TODO ( # 3634984 ) : Additionally , DefInlineFP is marking may - load on all the <nl> * locals of the outer frame . This is probably not necessary anymore , but we <nl> * added it originally because a store sinking prototype needed to know it <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> * removing that set . <nl> * / <nl> case DefInlineFP : <nl> + return may_load_store ( <nl> + / * <nl> + * We need to mark DefInlineFP as both loading and storing the entire <nl> + * stack below its frame because it may have been pushed . If DefInlineFP <nl> + * is not pushed these cells were marked as both stored and killed by <nl> + * BeginInlining so now actual stores should be aliased . <nl> + * <nl> + * Importantly , if we do sink DefInlineFP stack cells from above may <nl> + * alias locals within DefInlineFP , this confuses alias analysis , these <nl> + * stores must not be sunk past DefInlineFP where they could clobber a <nl> + * local . <nl> + * / <nl> + AFrameAny | inline_fp_frame ( & inst ) | stack_below ( inst . dst ( ) , 0 ) , <nl> + AFrameAny | stack_below ( inst . dst ( ) , 0 ) <nl> + ) ; <nl> + <nl> + / * <nl> + * BeginInlining is similar to DefInlineFP , however , it must always be the <nl> + * first instruction in the inlined call and has no effect serving only as <nl> + * a marker to memory effects that the stack cells within the inlined call <nl> + * are now dead . <nl> + * <nl> + * Unlike DefInlineFP it does not load the SpillFrame , which we hope to push <nl> + * off the main trace or elide entirely . <nl> + * / <nl> + case BeginInlining : { <nl> + / * <nl> + * SP relative offset of the first non - frame cell within the inlined call . <nl> + * / <nl> + auto inlineStackOff = inst . extra < BeginInlining > ( ) - > offset . offset ; <nl> return may_load_store_kill ( <nl> - AFrameAny | inline_fp_frame ( & inst ) , <nl> + AEmpty , <nl> / * <nl> * This prevents stack slots from the caller from being sunk into the <nl> * callee . Note that some of these stack slots overlap with the frame <nl> * locals of the callee - - those slots are inacessible in the inlined <nl> * call as frame and stack locations may not alias . <nl> * / <nl> - stack_below ( inst . dst ( ) , 0 ) , <nl> + stack_below ( inst . src ( 0 ) , inlineStackOff ) , <nl> / * <nl> * While not required for correctness adding these slots to the kill set <nl> * will hopefully avoid some extra stores . <nl> * / <nl> - stack_below ( inst . dst ( ) , 0 ) <nl> + stack_below ( inst . src ( 0 ) , inlineStackOff ) <nl> ) ; <nl> + } <nl> <nl> case InlineReturn : <nl> return ReturnEffects { stack_below ( inst . src ( 0 ) , 2 ) | AMIStateAny } ; <nl> MemEffects memory_effects_impl ( const IRInstruction & inst ) { <nl> } ) | AMIStateAny <nl> } ; <nl> <nl> + case SyncReturnBC : { <nl> + auto const spOffset = inst . extra < SyncReturnBC > ( ) - > spOffset ; <nl> + auto const arStack = AStack { <nl> + inst . src ( 0 ) , <nl> + / / Same as spillframe <nl> + spOffset . offset + int32_t { kNumActRecCells } - 1 , <nl> + int32_t { kNumActRecCells } <nl> + } ; <nl> + / / This instruction doesn ' t actually load but SpillFrame cannot be pushed <nl> + / / past it <nl> + return may_load_store ( arStack , arStack ) ; <nl> + } <nl> + <nl> case InterpOne : <nl> return interp_one_effects ( inst ) ; <nl> case InterpOneCF : <nl>
Add BeginInlining and SyncReturnBC
facebook/hhvm
872781b0448bae3c2c2ffc4f299504b1f956a2b2
2015-12-11T23:00:39Z
mmm a / dbms / CMakeLists . txt <nl> ppp b / dbms / CMakeLists . txt <nl> if ( USE_EMBEDDED_COMPILER ) <nl> llvm_map_components_to_libnames ( REQUIRED_LLVM_LIBRARIES all ) <nl> target_link_libraries ( dbms $ { REQUIRED_LLVM_LIBRARIES } ) <nl> target_include_directories ( dbms BEFORE PUBLIC $ { LLVM_INCLUDE_DIRS } ) <nl> - # LLVM 5 . 0 has a bunch of unused parameters in its header files . <nl> - # TODO : global - disable no - unused - parameter <nl> + # LLVM has a bunch of unused parameters in its header files . <nl> set_source_files_properties ( src / Functions / IFunction . cpp PROPERTIES COMPILE_FLAGS " - Wno - unused - parameter " ) <nl> set_source_files_properties ( src / Interpreters / ExpressionJIT . cpp PROPERTIES COMPILE_FLAGS " - Wno - unused - parameter - Wno - non - virtual - dtor " ) <nl> endif ( ) <nl> mmm a / dbms / src / Functions / IFunction . cpp <nl> ppp b / dbms / src / Functions / IFunction . cpp <nl> llvm : : Value * IFunction : : compile ( llvm : : IRBuilderBase & builder , const DataTypes <nl> auto * result = b . CreateInsertValue ( zero , compileImpl ( builder , * denulled , std : : move ( values ) ) , { 0 } ) ; <nl> auto * result_block = b . GetInsertBlock ( ) ; <nl> b . CreateBr ( join ) ; <nl> - b . SetInsertPoint ( fail ) ; / / / an empty joining block to avoid keeping track of where we could jump from <nl> + b . SetInsertPoint ( fail ) ; <nl> auto * null = b . CreateInsertValue ( zero , b . getTrue ( ) , { 1 } ) ; <nl> b . CreateBr ( join ) ; <nl> b . SetInsertPoint ( join ) ; <nl>
Remove outdated comments
ClickHouse/ClickHouse
4970b06b57f2f10d19ebdc4059b10003b0f5ed73
2018-04-29T23:21:45Z
mmm a / cocos2dx / include / CCTextureCache . h <nl> ppp b / cocos2dx / include / CCTextureCache . h <nl> THE SOFTWARE . <nl> # include " cocoa / NSObject . h " <nl> / / / @ todo # import < Foundation / Foundation . h > <nl> / / / @ todo # import < CoreGraphics / CGImage . h > <nl> - / / # include " platform / uphone / NSLock . h " <nl> # include " cocoa / NSMutableDictionary . h " <nl> <nl> class CCTexture2D ; <nl> new file mode 100644 <nl> index 000000000000 . . 790b8ed787c6 <nl> mmm / dev / null <nl> ppp b / cocos2dx / platform / NSLock . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2010 cocos2d - x . org <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + # ifndef __PLATFORM_NSLOCK_H__ <nl> + # define __PLATFORM_NSLOCK_H__ <nl> + <nl> + # ifdef _UPHONE <nl> + # include " uphone / NSLock . h " <nl> + # endif / / _UPHONE <nl> + <nl> + # endif / / __PLATFORM_NSLOCK_H__ <nl> \ No newline at end of file <nl> mmm a / cocos2dx / textures / CCTextureCache . cpp <nl> ppp b / cocos2dx / textures / CCTextureCache . cpp <nl> THE SOFTWARE . <nl> # include " CCTextureCache . h " <nl> # include " CCTexture2D . h " <nl> # include " ccMacros . h " <nl> - # include " platform / uphone / NSLock . h " <nl> + # include " platform / NSLock . h " <nl> / / # include " CCDirector . h " <nl> / / # include " Support / CCFileUtils . h " <nl> <nl>
issue 7 # , add NSLock . h in platform /
cocos2d/cocos2d-x
d2235ef1a3607fca185c349fca1a1bfe256c3a80
2010-07-23T07:39:24Z
mmm a / src / share / grabber_client . hpp <nl> ppp b / src / share / grabber_client . hpp <nl> class grabber_client final : public shared_instance_provider < grabber_client > { <nl> grabber_client ( void ) : started_ ( false ) { <nl> } <nl> <nl> + ~ grabber_client ( void ) { <nl> + stop ( ) ; <nl> + } <nl> + <nl> void start ( void ) { <nl> std : : lock_guard < std : : mutex > lock ( client_manager_mutex_ ) ; <nl> <nl>
add ~ grabber_client
pqrs-org/Karabiner-Elements
7a728a5ba7d667d07a9e695939eabbae8c355da3
2018-08-03T14:14:51Z
mmm a / include / fmt / core . h <nl> ppp b / include / fmt / core . h <nl> <nl> <nl> / / An enable_if helper to be used in template parameters . enable_if in template <nl> / / parameters results in much shorter symbols : https : / / godbolt . org / z / sWw4vP . <nl> - # define FMT_ENABLE_IF_T ( . . . ) typename std : : enable_if < __VA_ARGS__ , int > : : type <nl> + # define FMT_ENABLE_IF_T ( . . . ) typename std : : enable_if < ( __VA_ARGS__ ) , int > : : type <nl> # define FMT_ENABLE_IF ( . . . ) FMT_ENABLE_IF_T ( __VA_ARGS__ ) = 0 <nl> <nl> FMT_BEGIN_NAMESPACE <nl>
Fix compilation error under MSVC 19 . 21 ( )
fmtlib/fmt
118d8bccc282ce1bf59267c217001ed2f99452e5
2019-05-08T18:20:55Z
mmm a / Marlin / src / config / examples / AlephObjects / TAZ4 / Configuration . h <nl> ppp b / Marlin / src / config / examples / AlephObjects / TAZ4 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / AlephObjects / TAZ4 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / AlephObjects / TAZ4 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / AliExpress / CL - 260 / Configuration . h <nl> ppp b / Marlin / src / config / examples / AliExpress / CL - 260 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Anet / A2 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Anet / A2 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Anet / A2 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Anet / A2 / Configuration_adv . h <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Anet / A2plus / Configuration . h <nl> ppp b / Marlin / src / config / examples / Anet / A2plus / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Anet / A2plus / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Anet / A2plus / Configuration_adv . h <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Anet / A6 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Anet / A6 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Anet / A6 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Anet / A6 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Anet / A8 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Anet / A8 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Anet / A8 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Anet / A8 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Azteeg / X5GT / Configuration . h <nl> ppp b / Marlin / src / config / examples / Azteeg / X5GT / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Azteeg / X5GT / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Azteeg / X5GT / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / BIBO / TouchX / cyclops / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / BIBO / TouchX / cyclops / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / BIBO / TouchX / default / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / BIBO / TouchX / default / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / BQ / Hephestos / Configuration . h <nl> ppp b / Marlin / src / config / examples / BQ / Hephestos / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / BQ / Hephestos / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / BQ / Hephestos / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / BQ / Hephestos_2 / Configuration . h <nl> ppp b / Marlin / src / config / examples / BQ / Hephestos_2 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / BQ / Hephestos_2 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / BQ / Hephestos_2 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / BQ / WITBOX / Configuration . h <nl> ppp b / Marlin / src / config / examples / BQ / WITBOX / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / BQ / WITBOX / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / BQ / WITBOX / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Cartesio / Configuration . h <nl> ppp b / Marlin / src / config / examples / Cartesio / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Cartesio / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Cartesio / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 10 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 10 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 10 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 10 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 10S / Configuration . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 10S / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 10S / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 10S / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 10mini / Configuration . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 10mini / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 10mini / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 10mini / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 8 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 8 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Creality / CR - 8 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Creality / CR - 8 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Creality / Ender - 2 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Creality / Ender - 2 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Creality / Ender - 2 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Creality / Ender - 2 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Creality / Ender - 3 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Creality / Ender - 3 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Creality / Ender - 3 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Creality / Ender - 3 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Creality / Ender - 4 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Creality / Ender - 4 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Creality / Ender - 4 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Creality / Ender - 4 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Einstart - S / Configuration . h <nl> ppp b / Marlin / src / config / examples / Einstart - S / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Einstart - S / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Einstart - S / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Felix / Configuration . h <nl> ppp b / Marlin / src / config / examples / Felix / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Felix / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Felix / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Felix / DUAL / Configuration . h <nl> ppp b / Marlin / src / config / examples / Felix / DUAL / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / FolgerTech / i3 - 2020 / Configuration . h <nl> ppp b / Marlin / src / config / examples / FolgerTech / i3 - 2020 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / FolgerTech / i3 - 2020 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / FolgerTech / i3 - 2020 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Formbot / T - Rex_2 + / Configuration . h <nl> ppp b / Marlin / src / config / examples / Formbot / T - Rex_2 + / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Formbot / T - Rex_2 + / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Formbot / T - Rex_2 + / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Formbot / T_Rex_3 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Formbot / T_Rex_3 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Formbot / T_Rex_3 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Formbot / T_Rex_3 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Geeetech / GT2560 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Geeetech / GT2560 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Geeetech / I3_Pro_X - GT2560 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Geeetech / I3_Pro_X - GT2560 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> diff - - git a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / bltouch / Configuration . h b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / bltouch / Configuration . h <nl> mmm a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / bltouch / Configuration . h <nl> ppp b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / bltouch / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> diff - - git a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / noprobe / Configuration . h b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / noprobe / Configuration . h <nl> mmm a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / noprobe / Configuration . h <nl> ppp b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro B / noprobe / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> diff - - git a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration . h b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration . h <nl> mmm a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration . h <nl> ppp b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> diff - - git a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration_adv . h b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration_adv . h <nl> mmm a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro C / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> diff - - git a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration . h b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration . h <nl> mmm a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration . h <nl> ppp b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> diff - - git a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration_adv . h b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration_adv . h <nl> mmm a / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Geeetech / Prusa i3 Pro W / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Infitary / i3 - M508 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Infitary / i3 - M508 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Infitary / i3 - M508 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Infitary / i3 - M508 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / JGAurora / A5 / Configuration . h <nl> ppp b / Marlin / src / config / examples / JGAurora / A5 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / JGAurora / A5 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / JGAurora / A5 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / MakerParts / Configuration . h <nl> ppp b / Marlin / src / config / examples / MakerParts / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / MakerParts / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / MakerParts / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Malyan / M150 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Malyan / M150 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Malyan / M200 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Malyan / M200 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Malyan / M200 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Malyan / M200 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Micromake / C1 / basic / Configuration . h <nl> ppp b / Marlin / src / config / examples / Micromake / C1 / basic / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Micromake / C1 / enhanced / Configuration . h <nl> ppp b / Marlin / src / config / examples / Micromake / C1 / enhanced / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Micromake / C1 / enhanced / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Micromake / C1 / enhanced / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Mks / Sbase / Configuration . h <nl> ppp b / Marlin / src / config / examples / Mks / Sbase / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Mks / Sbase / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Mks / Sbase / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / RepRapPro / Huxley / Configuration . h <nl> ppp b / Marlin / src / config / examples / RepRapPro / Huxley / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / RepRapWorld / Megatronics / Configuration . h <nl> ppp b / Marlin / src / config / examples / RepRapWorld / Megatronics / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / RigidBot / Configuration . h <nl> ppp b / Marlin / src / config / examples / RigidBot / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / RigidBot / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / RigidBot / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / SCARA / Configuration . h <nl> ppp b / Marlin / src / config / examples / SCARA / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / SCARA / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / SCARA / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / STM32F10 / Configuration . h <nl> ppp b / Marlin / src / config / examples / STM32F10 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / STM32F4 / Configuration . h <nl> ppp b / Marlin / src / config / examples / STM32F4 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Sanguinololu / Configuration . h <nl> ppp b / Marlin / src / config / examples / Sanguinololu / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Sanguinololu / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Sanguinololu / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / TheBorg / Configuration . h <nl> ppp b / Marlin / src / config / examples / TheBorg / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / TheBorg / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / TheBorg / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / TinyBoy2 / Configuration . h <nl> ppp b / Marlin / src / config / examples / TinyBoy2 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / TinyBoy2 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / TinyBoy2 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Tronxy / X1 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Tronxy / X1 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Tronxy / X3A / Configuration . h <nl> ppp b / Marlin / src / config / examples / Tronxy / X3A / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Tronxy / X3A / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Tronxy / X3A / Configuration_adv . h <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Tronxy / X5S / Configuration . h <nl> ppp b / Marlin / src / config / examples / Tronxy / X5S / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Tronxy / XY100 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Tronxy / XY100 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / UltiMachine / Archim2 / Configuration . h <nl> ppp b / Marlin / src / config / examples / UltiMachine / Archim2 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> # define E0_DRIVER_TYPE TMC2130 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / UltiMachine / Archim2 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / UltiMachine / Archim2 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Velleman / K8200 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Velleman / K8200 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Velleman / K8200 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Velleman / K8200 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Velleman / K8400 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Velleman / K8400 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / Velleman / K8400 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Velleman / K8400 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / Velleman / K8400 / Dual - head / Configuration . h <nl> ppp b / Marlin / src / config / examples / Velleman / K8400 / Dual - head / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> diff - - git a / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration . h b / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration . h <nl> mmm a / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration . h <nl> ppp b / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> diff - - git a / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration_adv . h b / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration_adv . h <nl> mmm a / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / Wanhao / Duplicator 6 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / adafruit / ST7565 / Configuration . h <nl> ppp b / Marlin / src / config / examples / adafruit / ST7565 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / Anycubic / Kossel / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / Anycubic / Kossel / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / Anycubic / Kossel / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / Anycubic / Kossel / Configuration_adv . h <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / delta / FLSUN / auto_calibrate / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / FLSUN / auto_calibrate / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / FLSUN / auto_calibrate / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / FLSUN / auto_calibrate / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / delta / FLSUN / kossel / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / FLSUN / kossel / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / FLSUN / kossel / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / FLSUN / kossel / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / delta / FLSUN / kossel_mini / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / FLSUN / kossel_mini / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / FLSUN / kossel_mini / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / FLSUN / kossel_mini / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / delta / Hatchbox_Alpha / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / Hatchbox_Alpha / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / generic / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / generic / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / generic / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / generic / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / delta / kossel_mini / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / kossel_mini / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / kossel_mini / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / kossel_mini / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / delta / kossel_pro / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / kossel_pro / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / kossel_pro / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / kossel_pro / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / delta / kossel_xl / Configuration . h <nl> ppp b / Marlin / src / config / examples / delta / kossel_xl / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / delta / kossel_xl / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / delta / kossel_xl / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / gCreate / gMax1 . 5 + / Configuration . h <nl> ppp b / Marlin / src / config / examples / gCreate / gMax1 . 5 + / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / gCreate / gMax1 . 5 + / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / gCreate / gMax1 . 5 + / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / makibox / Configuration . h <nl> ppp b / Marlin / src / config / examples / makibox / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / makibox / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / makibox / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / stm32f103ret6 / Configuration . h <nl> ppp b / Marlin / src / config / examples / stm32f103ret6 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / tvrrug / Round2 / Configuration . h <nl> ppp b / Marlin / src / config / examples / tvrrug / Round2 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / tvrrug / Round2 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / tvrrug / Round2 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl> mmm a / Marlin / src / config / examples / wt150 / Configuration . h <nl> ppp b / Marlin / src / config / examples / wt150 / Configuration . h <nl> <nl> / / # define X2_DRIVER_TYPE A4988 <nl> / / # define Y2_DRIVER_TYPE A4988 <nl> / / # define Z2_DRIVER_TYPE A4988 <nl> + / / # define Z3_DRIVER_TYPE A4988 <nl> / / # define E0_DRIVER_TYPE A4988 <nl> / / # define E1_DRIVER_TYPE A4988 <nl> / / # define E2_DRIVER_TYPE A4988 <nl> mmm a / Marlin / src / config / examples / wt150 / Configuration_adv . h <nl> ppp b / Marlin / src / config / examples / wt150 / Configuration_adv . h <nl> <nl> # endif <nl> # endif <nl> <nl> + / / # define Z_TRIPLE_STEPPER_DRIVERS <nl> + # if ENABLED ( Z_TRIPLE_STEPPER_DRIVERS ) <nl> + / / # define Z_TRIPLE_ENDSTOPS <nl> + # if ENABLED ( Z_TRIPLE_ENDSTOPS ) <nl> + # define Z2_USE_ENDSTOP _XMAX_ <nl> + # define Z3_USE_ENDSTOP _YMAX_ <nl> + # define Z_TRIPLE2_ENDSTOPS_ADJUSTMENT 0 <nl> + # define Z_TRIPLE3_ENDSTOPS_ADJUSTMENT 0 <nl> + # endif <nl> + # endif <nl> + <nl> / * * <nl> * Dual X Carriage <nl> * <nl> <nl> # define Z2_SENSE_RESISTOR 91 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_MAX_CURRENT 1000 <nl> + # define Z3_SENSE_RESISTOR 91 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_MAX_CURRENT 1000 <nl> # define E0_SENSE_RESISTOR 91 <nl> # define E0_MICROSTEPS 16 <nl> <nl> # define Z2_CURRENT 800 <nl> # define Z2_MICROSTEPS 16 <nl> <nl> + # define Z3_CURRENT 800 <nl> + # define Z3_MICROSTEPS 16 <nl> + <nl> # define E0_CURRENT 800 <nl> # define E0_MICROSTEPS 16 <nl> <nl> <nl> # define Y2_HYBRID_THRESHOLD 100 <nl> # define Z_HYBRID_THRESHOLD 3 <nl> # define Z2_HYBRID_THRESHOLD 3 <nl> + # define Z3_HYBRID_THRESHOLD 3 <nl> # define E0_HYBRID_THRESHOLD 30 <nl> # define E1_HYBRID_THRESHOLD 30 <nl> # define E2_HYBRID_THRESHOLD 30 <nl> <nl> # define Z2_OVERCURRENT 2000 <nl> # define Z2_STALLCURRENT 1500 <nl> <nl> + # define Z3_MICROSTEPS 16 <nl> + # define Z3_OVERCURRENT 2000 <nl> + # define Z3_STALLCURRENT 1500 <nl> + <nl> # define E0_MICROSTEPS 16 <nl> # define E0_OVERCURRENT 2000 <nl> # define E0_STALLCURRENT 1500 <nl>
Add Triple - Z options to example configs
MarlinFirmware/Marlin
6286afd456c73e3b41cc2bf345da5c5955b4fb62
2018-09-16T05:35:58Z
mmm a / arangod / Cluster / ClusterComm . cpp <nl> ppp b / arangod / Cluster / ClusterComm . cpp <nl> std : : unique_ptr < ClusterCommResult > ClusterComm : : syncRequest ( <nl> cm - > leaseConnection ( res - > endpoint ) ; <nl> <nl> if ( nullptr = = connection ) { <nl> - res - > status = CL_COMM_ERROR ; <nl> + res - > status = CL_COMM_BACKEND_UNAVAILABLE ; <nl> res - > errorMessage = <nl> " cannot create connection to server ' " + res - > serverID + " ' " ; <nl> if ( logConnectionErrors ( ) ) { <nl> std : : unique_ptr < ClusterCommResult > ClusterComm : : syncRequest ( <nl> if ( res - > errorMessage = = " Request timeout reached " ) { <nl> res - > status = CL_COMM_TIMEOUT ; <nl> } else { <nl> - res - > status = CL_COMM_ERROR ; <nl> + res - > status = CL_COMM_BACKEND_UNAVAILABLE ; <nl> } <nl> cm - > brokenConnection ( connection ) ; <nl> client - > invalidateConnection ( ) ; <nl> void ClusterCommThread : : run ( ) { <nl> httpclient : : ConnectionManager : : SingleServerConnection * connection = <nl> cm - > leaseConnection ( op - > result . endpoint ) ; <nl> if ( nullptr = = connection ) { <nl> - op - > result . status = CL_COMM_ERROR ; <nl> + op - > result . status = CL_COMM_BACKEND_UNAVAILABLE ; <nl> op - > result . errorMessage = " cannot create connection to server : " ; <nl> op - > result . errorMessage + = op - > result . serverID ; <nl> if ( cc - > logConnectionErrors ( ) ) { <nl> void ClusterCommThread : : run ( ) { <nl> op - > result . status = CL_COMM_TIMEOUT ; <nl> op - > result . errorMessage = " timeout " ; <nl> } else { <nl> - op - > result . status = CL_COMM_ERROR ; <nl> + op - > result . status = CL_COMM_BACKEND_UNAVAILABLE ; <nl> op - > result . errorMessage = client - > getErrorMessage ( ) ; <nl> } <nl> cm - > brokenConnection ( connection ) ; <nl> mmm a / arangod / Cluster / ClusterComm . h <nl> ppp b / arangod / Cluster / ClusterComm . h <nl> enum ClusterCommOpStatus { <nl> CL_COMM_TIMEOUT = 4 , / / no answer received until timeout <nl> CL_COMM_RECEIVED = 5 , / / answer received <nl> CL_COMM_ERROR = 6 , / / original request could not be sent <nl> - CL_COMM_DROPPED = 7 / / operation was dropped , not known <nl> + CL_COMM_DROPPED = 7 , / / operation was dropped , not known <nl> / / this is only used to report an error <nl> / / in the wait or enquire methods <nl> + CL_COMM_BACKEND_UNAVAILABLE = 8 / / mop : communication problem with the backend <nl> } ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / arangod / Cluster / ClusterMethods . cpp <nl> ppp b / arangod / Cluster / ClusterMethods . cpp <nl> using namespace arangodb : : rest ; <nl> <nl> namespace arangodb { <nl> <nl> + static int handleGeneralCommErrors ( ClusterCommResult const * res ) { <nl> + if ( res - > status = = CL_COMM_TIMEOUT ) { <nl> + / / No reply , we give up : <nl> + return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> + } else if ( res - > status = = CL_COMM_ERROR ) { <nl> + / / This could be a broken connection or an Http error : <nl> + if ( res - > result = = nullptr | | ! res - > result - > isComplete ( ) ) { <nl> + / / there is not result <nl> + return TRI_ERROR_CLUSTER_CONNECTION_LOST ; <nl> + } <nl> + } else if ( res - > status = = CL_COMM_BACKEND_UNAVAILABLE ) { <nl> + return TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE ; <nl> + } <nl> + <nl> + return TRI_ERROR_NO_ERROR ; <nl> + } <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief extracts a numeric value from an hierarchical VelocyPack <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> int createDocumentOnCoordinator ( <nl> StringUtils : : urlEncode ( shardID ) + " & waitForSync = " + <nl> ( waitForSync ? " true " : " false " ) , <nl> body , headers , 60 . 0 ) ; <nl> - <nl> - if ( res - > status = = CL_COMM_TIMEOUT ) { <nl> - / / No reply , we give up : <nl> - return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> - } <nl> - if ( res - > status = = CL_COMM_ERROR ) { <nl> - / / This could be a broken connection or an Http error : <nl> - if ( res - > result = = nullptr | | ! res - > result - > isComplete ( ) ) { <nl> - / / there is not result <nl> - return TRI_ERROR_CLUSTER_CONNECTION_LOST ; <nl> - } <nl> - / / In this case a proper HTTP error was reported by the DBserver , <nl> - / / this can be 400 or 404 , we simply forward the result . <nl> - / / We intentionally fall through here . <nl> + <nl> + int commError = handleGeneralCommErrors ( res . get ( ) ) ; <nl> + if ( commError ! = TRI_ERROR_NO_ERROR ) { <nl> + return commError ; <nl> } <nl> responseCode = static_cast < arangodb : : rest : : HttpResponse : : HttpResponseCode > ( <nl> res - > result - > getHttpReturnCode ( ) ) ; <nl> int deleteDocumentOnCoordinator ( <nl> " / " + StringUtils : : urlEncode ( key ) + " ? waitForSync = " + <nl> ( waitForSync ? " true " : " false " ) + revstr + policystr , <nl> " " , * headers , 60 . 0 ) ; <nl> - <nl> - if ( res - > status = = CL_COMM_TIMEOUT ) { <nl> - / / No reply , we give up : <nl> - return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> - } <nl> - if ( res - > status = = CL_COMM_ERROR ) { <nl> - / / This could be a broken connection or an Http error : <nl> - if ( res - > result = = nullptr | | ! res - > result - > isComplete ( ) ) { <nl> - return TRI_ERROR_CLUSTER_CONNECTION_LOST ; <nl> - } <nl> - / / In this case a proper HTTP error was reported by the DBserver , <nl> - / / this can be 400 or 404 , we simply forward the result . <nl> - / / We intentionally fall through here . <nl> + <nl> + int error = handleGeneralCommErrors ( res . get ( ) ) ; <nl> + if ( error ! = TRI_ERROR_NO_ERROR ) { <nl> + return error ; <nl> } <nl> responseCode = static_cast < arangodb : : rest : : HttpResponse : : HttpResponseCode > ( <nl> res - > result - > getHttpReturnCode ( ) ) ; <nl> int getDocumentOnCoordinator ( <nl> " / " + StringUtils : : urlEncode ( key ) + revstr , <nl> " " , * headers , 60 . 0 ) ; <nl> <nl> - if ( res - > status = = CL_COMM_TIMEOUT ) { <nl> - / / No reply , we give up : <nl> - return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> - } <nl> - if ( res - > status = = CL_COMM_ERROR ) { <nl> - / / This could be a broken connection or an Http error : <nl> - if ( ! res - > result | | ! res - > result - > isComplete ( ) ) { <nl> - return TRI_ERROR_CLUSTER_CONNECTION_LOST ; <nl> - } <nl> - / / In this case a proper HTTP error was reported by the DBserver , <nl> - / / this can be 400 or 404 , we simply forward the result . <nl> - / / We intentionally fall through here . <nl> + int error = handleGeneralCommErrors ( res . get ( ) ) ; <nl> + if ( error ! = TRI_ERROR_NO_ERROR ) { <nl> + return error ; <nl> } <nl> responseCode = static_cast < arangodb : : rest : : HttpResponse : : HttpResponseCode > ( <nl> res - > result - > getHttpReturnCode ( ) ) ; <nl> int getAllDocumentsOnCoordinator ( <nl> <nl> for ( count = ( int ) shards - > size ( ) ; count > 0 ; count - - ) { <nl> auto res = cc - > wait ( " " , coordTransactionID , 0 , " " , 0 . 0 ) ; <nl> - if ( res . status = = CL_COMM_TIMEOUT ) { <nl> + <nl> + LOG ( TRACE ) < < " Response status " < < res . status ; <nl> + int error = handleGeneralCommErrors ( & res ) ; <nl> + if ( error ! = TRI_ERROR_NO_ERROR ) { <nl> cc - > drop ( " " , coordTransactionID , 0 , " " ) ; <nl> - return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> + return error ; <nl> } <nl> + <nl> if ( res . status = = CL_COMM_ERROR | | res . status = = CL_COMM_DROPPED | | <nl> res . answer_code = = arangodb : : rest : : HttpResponse : : NOT_FOUND ) { <nl> cc - > drop ( " " , coordTransactionID , 0 , " " ) ; <nl> int getFilteredEdgesOnCoordinator ( <nl> <nl> for ( count = ( int ) shards - > size ( ) ; count > 0 ; count - - ) { <nl> auto res = cc - > wait ( " " , coordTransactionID , 0 , " " , 0 . 0 ) ; <nl> - if ( res . status = = CL_COMM_TIMEOUT ) { <nl> + int error = handleGeneralCommErrors ( & res ) ; <nl> + if ( error ! = TRI_ERROR_NO_ERROR ) { <nl> cc - > drop ( " " , coordTransactionID , 0 , " " ) ; <nl> - return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> + return error ; <nl> } <nl> if ( res . status = = CL_COMM_ERROR | | res . status = = CL_COMM_DROPPED ) { <nl> cc - > drop ( " " , coordTransactionID , 0 , " " ) ; <nl> return TRI_ERROR_INTERNAL ; <nl> } <nl> - if ( res . status = = CL_COMM_RECEIVED ) { <nl> - } <nl> <nl> std : : unique_ptr < TRI_json_t > shardResult ( <nl> TRI_JsonString ( TRI_UNKNOWN_MEM_ZONE , res . answer - > body ( ) ) ) ; <nl> int modifyDocumentOnCoordinator ( <nl> StringUtils : : urlEncode ( key ) + " ? waitForSync = " + <nl> ( waitForSync ? " true " : " false " ) + revstr + policystr , <nl> * ( body . get ( ) ) , * headers , 60 . 0 ) ; <nl> - <nl> - if ( res - > status = = CL_COMM_TIMEOUT ) { <nl> - / / No reply , we give up : <nl> - return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> - } <nl> - if ( res - > status = = CL_COMM_ERROR ) { <nl> - / / This could be a broken connection or an Http error : <nl> - if ( res - > result = = nullptr | | ! res - > result - > isComplete ( ) ) { <nl> - return TRI_ERROR_CLUSTER_CONNECTION_LOST ; <nl> - } <nl> - / / In this case a proper HTTP error was reported by the DBserver , <nl> - / / this can be 400 or 404 , we simply forward the result . <nl> - / / We intentionally fall through here . <nl> + <nl> + int error = handleGeneralCommErrors ( res . get ( ) ) ; <nl> + if ( error ! = TRI_ERROR_NO_ERROR ) { <nl> + return error ; <nl> } <nl> + <nl> / / Now we have to distinguish whether we still have to go the slow way : <nl> responseCode = static_cast < arangodb : : rest : : HttpResponse : : HttpResponseCode > ( <nl> res - > result - > getHttpReturnCode ( ) ) ; <nl> int createEdgeOnCoordinator ( <nl> StringUtils : : urlEncode ( from ) + " & to = " + StringUtils : : urlEncode ( to ) , <nl> body , headers , 60 . 0 ) ; <nl> <nl> - if ( res - > status = = CL_COMM_TIMEOUT ) { <nl> - / / No reply , we give up : <nl> - return TRI_ERROR_CLUSTER_TIMEOUT ; <nl> - } <nl> - if ( res - > status = = CL_COMM_ERROR ) { <nl> - / / This could be a broken connection or an Http error : <nl> - if ( res - > result = = nullptr | | ! res - > result - > isComplete ( ) ) { <nl> - / / there is not result <nl> - return TRI_ERROR_CLUSTER_CONNECTION_LOST ; <nl> - } <nl> - / / In this case a proper HTTP error was reported by the DBserver , <nl> - / / this can be 400 or 404 , we simply forward the result . <nl> - / / We intentionally fall through here . <nl> + int commError = handleGeneralCommErrors ( res . get ( ) ) ; <nl> + if ( commError ! = TRI_ERROR_NO_ERROR ) { <nl> + return commError ; <nl> } <nl> responseCode = static_cast < arangodb : : rest : : HttpResponse : : HttpResponseCode > ( <nl> res - > result - > getHttpReturnCode ( ) ) ; <nl> mmm a / arangod / RestHandler / RestVocbaseBaseHandler . cpp <nl> ppp b / arangod / RestHandler / RestVocbaseBaseHandler . cpp <nl> void RestVocbaseBaseHandler : : generateTransactionError ( <nl> case TRI_ERROR_CLUSTER_TIMEOUT : <nl> generateError ( HttpResponse : : SERVER_ERROR , res ) ; <nl> return ; <nl> + <nl> + case TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE : <nl> + generateError ( HttpResponse : : SERVICE_UNAVAILABLE , res , " A required backend was not available " ) ; <nl> + return ; <nl> <nl> case TRI_ERROR_CLUSTER_MUST_NOT_CHANGE_SHARDING_ATTRIBUTES : <nl> case TRI_ERROR_CLUSTER_MUST_NOT_SPECIFY_KEY : { <nl> mmm a / lib / Basics / voc - errors . h <nl> ppp b / lib / Basics / voc - errors . h <nl> void TRI_InitializeErrorMessages ( ) ; <nl> <nl> # define TRI_ERROR_CLUSTER_ONLY_ON_DBSERVER ( 1477 ) <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief 1478 : ERROR_CLUSTER_BACKEND_UNAVAILABLE <nl> + / / / <nl> + / / / A cluster backend which was required for the operation could not be reached <nl> + / / / <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + # define TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE ( 1478 ) <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief 1500 : ERROR_QUERY_KILLED <nl> / / / <nl> mmm a / lib / Rest / HttpResponse . cpp <nl> ppp b / lib / Rest / HttpResponse . cpp <nl> HttpResponse : : HttpResponseCode HttpResponse : : responseCode ( int code ) { <nl> case TRI_ERROR_OUT_OF_MEMORY : <nl> case TRI_ERROR_INTERNAL : <nl> return SERVER_ERROR ; <nl> + <nl> + case TRI_ERROR_CLUSTER_BACKEND_UNAVAILABLE : <nl> + return SERVICE_UNAVAILABLE ; <nl> <nl> case TRI_ERROR_CLUSTER_UNSUPPORTED : <nl> return NOT_IMPLEMENTED ; <nl>
Throw Http error 503 when a required backend is unavailable
arangodb/arangodb
614beefc74c118fd9be9ceb43b233219799f323d
2016-03-16T18:04:05Z
mmm a / fdbserver / LogSystemPeekCursor . actor . cpp <nl> ppp b / fdbserver / LogSystemPeekCursor . actor . cpp <nl> ACTOR Future < Void > serverPeekParallelGetMore ( ILogSystem : : ServerPeekCursor * self <nl> } <nl> <nl> loop { <nl> + state Version expectedBegin = self - > messageVersion . version ; <nl> try { <nl> while ( self - > futureResults . size ( ) < SERVER_KNOBS - > PARALLEL_GET_MORE_REQUESTS & & self - > interf - > get ( ) . present ( ) ) { <nl> self - > futureResults . push_back ( brokenPromiseToNever ( self - > interf - > get ( ) . interf ( ) . peekMessages . getReply ( TLogPeekRequest ( self - > messageVersion . version , self - > tag , self - > returnIfBlocked , std : : make_pair ( self - > randomID , self - > sequence + + ) ) , taskID ) ) ) ; <nl> ACTOR Future < Void > serverPeekParallelGetMore ( ILogSystem : : ServerPeekCursor * self <nl> <nl> choose { <nl> when ( TLogPeekReply res = wait ( self - > interf - > get ( ) . present ( ) ? self - > futureResults . front ( ) : Never ( ) ) ) { <nl> + if ( res . begin . get ( ) ! = expectedBegin ) { <nl> + throw timed_out ( ) ; <nl> + } <nl> + expectedBegin = res . end ; <nl> self - > futureResults . pop_front ( ) ; <nl> self - > results = res ; <nl> if ( res . popped . present ( ) ) <nl> mmm a / fdbserver / OldTLogServer . actor . cpp <nl> ppp b / fdbserver / OldTLogServer . actor . cpp <nl> namespace oldTLog { <nl> } else { <nl> sequenceData . send ( reply . end ) ; <nl> } <nl> + reply . begin = req . begin ; <nl> } <nl> <nl> req . reply . send ( reply ) ; <nl> mmm a / fdbserver / TLogInterface . h <nl> ppp b / fdbserver / TLogInterface . h <nl> struct TLogPeekReply { <nl> Optional < Version > popped ; <nl> Version maxKnownVersion ; <nl> Version minKnownCommittedVersion ; <nl> + Optional < Version > begin ; <nl> <nl> template < class Ar > <nl> void serialize ( Ar & ar ) { <nl> - ar & arena & messages & end & popped & maxKnownVersion & minKnownCommittedVersion ; <nl> + ar & arena & messages & end & popped & maxKnownVersion & minKnownCommittedVersion & begin ; <nl> } <nl> } ; <nl> <nl> mmm a / fdbserver / TLogServer . actor . cpp <nl> ppp b / fdbserver / TLogServer . actor . cpp <nl> ACTOR Future < Void > tLogPeekMessages ( TLogData * self , TLogPeekRequest req , Refere <nl> } else { <nl> sequenceData . send ( rep . end ) ; <nl> } <nl> + rep . begin = req . begin ; <nl> } <nl> <nl> req . reply . send ( rep ) ; <nl> ACTOR Future < Void > tLogPeekMessages ( TLogData * self , TLogPeekRequest req , Refere <nl> } else { <nl> sequenceData . send ( reply . end ) ; <nl> } <nl> + reply . begin = req . begin ; <nl> } <nl> <nl> req . reply . send ( reply ) ; <nl>
Merge pull request from etschannen / feature - remote - logs
apple/foundationdb
5c9ef7763afaeb8dc467f4ae276532182a31d3c6
2018-06-25T18:20:25Z
mmm a / fdbserver / Knobs . cpp <nl> ppp b / fdbserver / Knobs . cpp <nl> void ServerKnobs : : initialize ( bool randomize , ClientKnobs * clientKnobs , bool isSi <nl> init ( BEHIND_CHECK_COUNT , 2 ) ; <nl> init ( BEHIND_CHECK_VERSIONS , 5 * VERSIONS_PER_SECOND ) ; <nl> init ( WAIT_METRICS_WRONG_SHARD_CHANCE , isSimulated ? 1 . 0 : 0 . 1 ) ; <nl> - init ( MAX_SHARED_LOAD_BALANCE_DELAY , 20 ) ; <nl> init ( MIN_TAG_PAGES_READ_RATE , 1 . 0e4 ) ; if ( randomize & & BUGGIFY ) MIN_TAG_PAGES_READ_RATE = 0 ; <nl> init ( READ_TAG_MEASUREMENT_INTERVAL , 30 . 0 ) ; if ( randomize & & BUGGIFY ) READ_TAG_MEASUREMENT_INTERVAL = 1 . 0 ; <nl> init ( OPERATION_COST_BYTE_FACTOR , 16384 ) ; if ( randomize & & BUGGIFY ) OPERATION_COST_BYTE_FACTOR = 4096 ; <nl> mmm a / fdbserver / Knobs . h <nl> ppp b / fdbserver / Knobs . h <nl> class ServerKnobs : public Knobs { <nl> int BEHIND_CHECK_COUNT ; <nl> int64_t BEHIND_CHECK_VERSIONS ; <nl> double WAIT_METRICS_WRONG_SHARD_CHANCE ; <nl> - int MAX_SHARED_LOAD_BALANCE_DELAY ; <nl> int64_t MIN_TAG_PAGES_READ_RATE ; <nl> double READ_TAG_MEASUREMENT_INTERVAL ; <nl> int64_t OPERATION_COST_BYTE_FACTOR ; <nl> mmm a / fdbserver / storageserver . actor . cpp <nl> ppp b / fdbserver / storageserver . actor . cpp <nl> struct StorageServer { <nl> Reference < AsyncVar < ServerDBInfo > > db ; <nl> Database cx ; <nl> ActorCollection actors ; <nl> - Future < Void > loadBalanceDelay ; <nl> - int sharedDelayCount ; <nl> <nl> StorageServerMetrics metrics ; <nl> CoalescedKeyRangeMap < bool , int64_t , KeyBytesMetric < int64_t > > byteSampleClears ; <nl> struct StorageServer { <nl> rebootAfterDurableVersion ( std : : numeric_limits < Version > : : max ( ) ) , <nl> durableInProgress ( Void ( ) ) , <nl> versionLag ( 0 ) , primaryLocality ( tagLocalityInvalid ) , <nl> - updateEagerReads ( 0 ) , sharedDelayCount ( 0 ) , loadBalanceDelay ( Void ( ) ) , <nl> + updateEagerReads ( 0 ) , <nl> shardChangeCounter ( 0 ) , <nl> fetchKeysParallelismLock ( SERVER_KNOBS - > FETCH_KEYS_PARALLELISM_BYTES ) , <nl> shuttingDown ( false ) , debug_inApplyUpdate ( false ) , debug_lastValidateTime ( 0 ) , watchBytes ( 0 ) , numWatches ( 0 ) , <nl> struct StorageServer { <nl> cx = openDBOnServer ( db , TaskPriority : : DefaultEndpoint , true , true ) ; <nl> } <nl> <nl> - Future < Void > getLoadBalanceDelay ( ) { <nl> - if ( loadBalanceDelay . isReady ( ) | | + + sharedDelayCount > SERVER_KNOBS - > MAX_SHARED_LOAD_BALANCE_DELAY ) { <nl> - sharedDelayCount = 0 ; <nl> - loadBalanceDelay = delay ( 0 , TaskPriority : : DefaultEndpoint ) ; <nl> - } <nl> - return loadBalanceDelay ; <nl> - } <nl> / / ~ StorageServer ( ) { fclose ( log ) ; } <nl> <nl> / / Puts the given shard into shards . The caller is responsible for adding shards <nl> ACTOR Future < Void > getValueQ ( StorageServer * data , GetValueRequest req ) { <nl> <nl> / / Active load balancing runs at a very high priority ( to obtain accurate queue lengths ) <nl> / / so we need to downgrade here <nl> - wait ( data - > getLoadBalanceDelay ( ) ) ; <nl> + wait ( delay ( 0 , TaskPriority : : DefaultEndpoint ) ) ; <nl> <nl> if ( req . debugID . present ( ) ) <nl> g_traceBatch . addEvent ( " GetValueDebug " , req . debugID . get ( ) . first ( ) , " getValueQ . DoRead " ) ; / / . detail ( " TaskID " , g_network - > getCurrentTask ( ) ) ; <nl> ACTOR Future < Void > getKeyValuesQ ( StorageServer * data , GetKeyValuesRequest req ) <nl> / / / / Placeholder for up - prioritizing fetches for important requests <nl> / / taskType = TaskPriority : : DefaultDelay ; <nl> } else { <nl> - wait ( data - > getLoadBalanceDelay ( ) ) ; <nl> + wait ( delay ( 0 , TaskPriority : : DefaultEndpoint ) ) ; <nl> } <nl> <nl> try { <nl> ACTOR Future < Void > getKeyQ ( StorageServer * data , GetKeyRequest req ) { <nl> <nl> / / Active load balancing runs at a very high priority ( to obtain accurate queue lengths ) <nl> / / so we need to downgrade here <nl> - wait ( data - > getLoadBalanceDelay ( ) ) ; <nl> + wait ( delay ( 0 , TaskPriority : : DefaultEndpoint ) ) ; <nl> <nl> try { <nl> state Version version = wait ( waitForVersion ( data , req . version ) ) ; <nl>
Merge pull request from etschannen / release - 6 . 3
apple/foundationdb
c1f53667da666d6d19eafde4976b452f1b24ee05
2020-05-12T02:06:37Z
mmm a / docs / release - notes . md <nl> ppp b / docs / release - notes . md <nl> <nl> # Release notes <nl> * * Contents * * < br > <nl> [ 3 . 0 . 1 ] ( # 301 ) < br > <nl> + [ 2 . 13 . 3 ] ( # 2133 ) < br > <nl> [ 2 . 13 . 2 ] ( # 2132 ) < br > <nl> [ 2 . 13 . 1 ] ( # 2131 ) < br > <nl> [ 2 . 13 . 0 ] ( # 2130 ) < br > <nl> new design . <nl> <nl> <nl> <nl> + # # 2 . 13 . 3 <nl> + <nl> + # # # Fixes <nl> + * Fixed possible infinite loop when combining generators with section filter ( ` - c ` option ) ( # 2025 ) <nl> + <nl> + # # # Miscellaneous <nl> + * Fixed ` ParseAndAddCatchTests ` not finding ` TEST_CASE ` s without tags ( # 2055 , # 2056 ) <nl> + * ` ParseAndAddCatchTests ` supports ` CMP0110 ` policy for changing behaviour of ` add_test ` ( # 2057 ) <nl> + * This was the shortlived change in CMake 3 . 18 . 0 that temporarily broke ` ParseAndAddCatchTests ` <nl> + <nl> + <nl> # # 2 . 13 . 2 <nl> <nl> # # # Improvements <nl>
Picked release notes for v2 . 13 . 3
catchorg/Catch2
33bcdc6bf5a74a03885f8d610bc48927b53d77e5
2020-11-02T13:42:24Z
mmm a / lua / cocos2dx_support / LuaCocos2d . cpp . REMOVED . git - id <nl> ppp b / lua / cocos2dx_support / LuaCocos2d . cpp . REMOVED . git - id <nl> @ @ - 1 + 1 @ @ <nl> - 951c67fac55daba4ee275b27a56bc63831d0ac44 <nl> \ No newline at end of file <nl> + 5469bec781157c15b84a9d83a6a89c2931858527 <nl> \ No newline at end of file <nl> mmm a / tools / tolua + + / CCSprite . pkg <nl> ppp b / tools / tolua + + / CCSprite . pkg <nl> class CCSprite : public CCNode , public CCTextureProtocol , public CCRGBAProtocol <nl> CCSpriteBatchNode * getSpriteBatchNode ( void ) ; <nl> void setSpriteBatchNode ( CCSpriteBatchNode * pobSpriteBatchNode ) ; <nl> <nl> - ccHonorParentTransform getHornorParentTransform ( void ) ; <nl> - void setHornorParentTransform ( ccHonorParentTransform eHonorParentTransform ) ; <nl> + ccHonorParentTransform getHonorParentTransform ( void ) ; <nl> + void setHonorParentTransform ( ccHonorParentTransform eHonorParentTransform ) ; <nl> <nl> CCPoint getOffsetPositionInPixels ( void ) ; <nl> <nl>
fix type error according the change of CCSprite
cocos2d/cocos2d-x
f693a5a10e5643bdb86699c3be3d390b2a557da6
2011-11-30T09:49:52Z
mmm a / scripts / buildsystems / vcpkg . cmake <nl> ppp b / scripts / buildsystems / vcpkg . cmake <nl> macro ( find_package name ) <nl> if ( EXISTS " $ { _VCPKG_INSTALLED_DIR } / $ { VCPKG_TARGET_TRIPLET } / share / $ { _vcpkg_lowercase_name } / vcpkg - cmake - wrapper . cmake " ) <nl> set ( ARGS " $ { ARGV } " ) <nl> include ( $ { _VCPKG_INSTALLED_DIR } / $ { VCPKG_TARGET_TRIPLET } / share / $ { _vcpkg_lowercase_name } / vcpkg - cmake - wrapper . cmake ) <nl> - elseif ( " $ { name } " STREQUAL " Boost " ) <nl> - set ( _Boost_USE_STATIC_LIBS $ { Boost_USE_STATIC_LIBS } ) <nl> - set ( _Boost_USE_MULTITHREADED $ { Boost_USE_MULTITHREADED } ) <nl> - set ( _Boost_USE_STATIC_RUNTIME $ { Boost_USE_STATIC_RUNTIME } ) <nl> - set ( _Boost_COMPILER $ { Boost_COMPILER } ) <nl> + elseif ( " $ { name } " STREQUAL " Boost " AND EXISTS " $ { _VCPKG_INSTALLED_DIR } / $ { VCPKG_TARGET_TRIPLET } / include / boost " ) <nl> + # Checking for the boost headers disables this wrapper unless the user has installed at least one boost library <nl> unset ( Boost_USE_STATIC_LIBS ) <nl> unset ( Boost_USE_MULTITHREADED ) <nl> unset ( Boost_USE_STATIC_RUNTIME ) <nl> set ( Boost_COMPILER " - vc140 " ) <nl> _find_package ( $ { ARGV } ) <nl> - if ( NOT Boost_FOUND ) <nl> - set ( Boost_USE_STATIC_LIBS $ { _Boost_USE_STATIC_LIBS } ) <nl> - set ( Boost_USE_MULTITHREADED $ { _Boost_USE_MULTITHREADED } ) <nl> - set ( Boost_USE_STATIC_RUNTIME $ { _Boost_USE_STATIC_RUNTIME } ) <nl> - set ( Boost_COMPILER $ { _Boost_COMPILER } ) <nl> - _find_package ( $ { ARGV } ) <nl> - endif ( ) <nl> elseif ( " $ { name } " STREQUAL " ICU " ) <nl> function ( _vcpkg_find_in_list ) <nl> list ( FIND ARGV " COMPONENTS " COMPONENTS_IDX ) <nl>
[ vcpkg - cmake - toolchain ] Only wrap find_package ( Boost ) if a boost library is installed .
microsoft/vcpkg
c5f93055a09629247236d1d7dca2c4aa9c1de7c9
2018-03-14T16:58:23Z
mmm a / src / harmony - typedarray . js <nl> ppp b / src / harmony - typedarray . js <nl> var InnerArraySome ; <nl> var InnerArraySort ; <nl> var InnerArrayToLocaleString ; <nl> var IsNaN ; <nl> + var MathMax ; <nl> + var MathMin ; <nl> <nl> utils . Import ( function ( from ) { <nl> ArrayFrom = from . ArrayFrom ; <nl> utils . Import ( function ( from ) { <nl> InnerArraySort = from . InnerArraySort ; <nl> InnerArrayToLocaleString = from . InnerArrayToLocaleString ; <nl> IsNaN = from . IsNaN ; <nl> + MathMax = from . MathMax ; <nl> + MathMin = from . MathMin ; <nl> } ) ; <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> <nl> - function ConstructTypedArray ( constructor , array ) { <nl> + function ConstructTypedArray ( constructor , arg ) { <nl> / / TODO ( littledan ) : This is an approximation of the spec , which requires <nl> / / that only real TypedArray classes should be accepted ( 22 . 2 . 2 . 1 . 1 ) <nl> if ( ! % IsConstructor ( constructor ) | | IS_UNDEFINED ( constructor . prototype ) | | <nl> function ConstructTypedArray ( constructor , array ) { <nl> / / underlying size and element size , and elements are put in one by one . <nl> / / By contrast , this would allow subclasses to make a radically different <nl> / / constructor with different semantics . <nl> - return new constructor ( array ) ; <nl> + return new constructor ( arg ) ; <nl> } <nl> <nl> - function ConstructTypedArrayLike ( typedArray , arrayContents ) { <nl> + function ConstructTypedArrayLike ( typedArray , arg ) { <nl> / / TODO ( littledan ) : The spec requires that we actuallly use <nl> / / typedArray . constructor [ Symbol . species ] ( bug v8 : 4093 ) <nl> - return ConstructTypedArray ( typedArray . constructor , arrayContents ) ; <nl> + / / Also , it should default to the default constructor from <nl> + / / table 49 if typedArray . constructor doesn ' t exist . <nl> + return ConstructTypedArray ( typedArray . constructor , arg ) ; <nl> } <nl> <nl> function TypedArrayCopyWithin ( target , start , end ) { <nl> function TypedArrayReduceRight ( callback , current ) { <nl> % FunctionSetLength ( TypedArrayReduceRight , 1 ) ; <nl> <nl> <nl> + function TypedArraySlice ( start , end ) { <nl> + if ( ! % IsTypedArray ( this ) ) throw MakeTypeError ( kNotTypedArray ) ; <nl> + var len = % _TypedArrayGetLength ( this ) ; <nl> + <nl> + var relativeStart = TO_INTEGER ( start ) ; <nl> + <nl> + var k ; <nl> + if ( relativeStart < 0 ) { <nl> + k = MathMax ( len + relativeStart , 0 ) ; <nl> + } else { <nl> + k = MathMin ( relativeStart , len ) ; <nl> + } <nl> + <nl> + var relativeEnd ; <nl> + if ( IS_UNDEFINED ( end ) ) { <nl> + relativeEnd = len ; <nl> + } else { <nl> + relativeEnd = TO_INTEGER ( end ) ; <nl> + } <nl> + <nl> + var final ; <nl> + if ( relativeEnd < 0 ) { <nl> + final = MathMax ( len + relativeEnd , 0 ) ; <nl> + } else { <nl> + final = MathMin ( relativeEnd , len ) ; <nl> + } <nl> + <nl> + var count = MathMax ( final - k , 0 ) ; <nl> + var array = ConstructTypedArrayLike ( this , count ) ; <nl> + / / The code below is the ' then ' branch ; the ' else ' branch species <nl> + / / a memcpy . Because V8 doesn ' t canonicalize NaN , the difference is <nl> + / / unobservable . <nl> + var n = 0 ; <nl> + while ( k < final ) { <nl> + var kValue = this [ k ] ; <nl> + / / TODO ( littledan ) : The spec says to throw on an error in setting ; <nl> + / / does this throw ? <nl> + array [ n ] = kValue ; <nl> + k + + ; <nl> + n + + ; <nl> + } <nl> + return array ; <nl> + } <nl> + <nl> + <nl> / / ES6 draft 08 - 24 - 14 , section 22 . 2 . 2 . 2 <nl> function TypedArrayOf ( ) { <nl> var length = % _ArgumentsLength ( ) ; <nl> macro EXTEND_TYPED_ARRAY ( NAME ) <nl> " reduce " , TypedArrayReduce , <nl> " reduceRight " , TypedArrayReduceRight , <nl> " reverse " , TypedArrayReverse , <nl> + " slice " , TypedArraySlice , <nl> " some " , TypedArraySome , <nl> " sort " , TypedArraySort , <nl> " toString " , TypedArrayToString , <nl> new file mode 100644 <nl> index 00000000000 . . 2af05430468 <nl> mmm / dev / null <nl> ppp b / test / mjsunit / harmony / typedarray - slice . js <nl> <nl> + / / Copyright 2015 the V8 project authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + / / Flags : - - harmony - arrays <nl> + <nl> + var typedArrayConstructors = [ <nl> + Uint8Array , <nl> + Int8Array , <nl> + Uint16Array , <nl> + Int16Array , <nl> + Uint32Array , <nl> + Int32Array , <nl> + Uint8ClampedArray , <nl> + Float32Array , <nl> + Float64Array <nl> + ] ; <nl> + <nl> + for ( var constructor of typedArrayConstructors ) { <nl> + / / Check various variants of empty array ' s slicing . <nl> + var array = new constructor ( 0 ) ; <nl> + for ( var i = 0 ; i < 7 ; i + + ) { <nl> + assertEquals ( 0 , array . slice ( 0 , 0 ) . length ) ; <nl> + assertEquals ( 0 , array . slice ( 1 , 0 ) . length ) ; <nl> + assertEquals ( 0 , array . slice ( 0 , 1 ) . length ) ; <nl> + assertEquals ( 0 , array . slice ( - 1 , 0 ) . length ) ; <nl> + } <nl> + <nl> + <nl> + / / Check various forms of arguments omission . <nl> + array = new constructor ( 7 ) ; <nl> + <nl> + for ( var i = 0 ; i < 7 ; i + + ) { <nl> + assertEquals ( array , array . slice ( ) ) ; <nl> + assertEquals ( array , array . slice ( 0 ) ) ; <nl> + assertEquals ( array , array . slice ( undefined ) ) ; <nl> + assertEquals ( array , array . slice ( " foobar " ) ) ; <nl> + assertEquals ( array , array . slice ( undefined , undefined ) ) ; <nl> + } <nl> + <nl> + <nl> + / / Check variants of negatives and positive indices . <nl> + array = new constructor ( 7 ) ; <nl> + <nl> + assertEquals ( 7 , array . slice ( - 100 ) . length ) ; <nl> + assertEquals ( 3 , array . slice ( - 3 ) . length ) ; <nl> + assertEquals ( 3 , array . slice ( 4 ) . length ) ; <nl> + assertEquals ( 1 , array . slice ( 6 ) . length ) ; <nl> + assertEquals ( 0 , array . slice ( 7 ) . length ) ; <nl> + assertEquals ( 0 , array . slice ( 8 ) . length ) ; <nl> + assertEquals ( 0 , array . slice ( 100 ) . length ) ; <nl> + <nl> + assertEquals ( 0 , array . slice ( 0 , - 100 ) . length ) ; <nl> + assertEquals ( 4 , array . slice ( 0 , - 3 ) . length ) ; <nl> + assertEquals ( 4 , array . slice ( 0 , 4 ) . length ) ; <nl> + assertEquals ( 6 , array . slice ( 0 , 6 ) . length ) ; <nl> + assertEquals ( 7 , array . slice ( 0 , 7 ) . length ) ; <nl> + assertEquals ( 7 , array . slice ( 0 , 8 ) . length ) ; <nl> + assertEquals ( 7 , array . slice ( 0 , 100 ) . length ) ; <nl> + <nl> + / / Does not permit being called on other types <nl> + assertThrows ( function ( ) { <nl> + constructor . prototype . slice . call ( [ ] , 0 , 0 ) ; <nl> + } , TypeError ) ; <nl> + <nl> + / / Check that elements are copied properly in slice <nl> + array = new constructor ( [ 1 , 2 , 3 , 4 ] ) ; <nl> + var slice = array . slice ( 1 , 3 ) ; <nl> + assertEquals ( 2 , slice . length ) ; <nl> + assertEquals ( 2 , slice [ 0 ] ) ; <nl> + assertEquals ( 3 , slice [ 1 ] ) ; <nl> + assertTrue ( slice instanceof constructor ) ; <nl> + } <nl>
Implement % TypedArray % . prototype . slice
v8/v8
51df8df9bef4913559d6a356e26ed2596ba1509f
2015-06-09T19:40:56Z
mmm a / common / node_bindings . cc <nl> ppp b / common / node_bindings . cc <nl> void NodeBindings : : WakeupEmbedThread ( ) { <nl> void NodeBindings : : EmbedThreadRunner ( void * arg ) { <nl> NodeBindings * self = static_cast < NodeBindings * > ( arg ) ; <nl> <nl> - while ( ! self - > embed_closed_ ) { <nl> + while ( true ) { <nl> / / Wait for the main loop to deal with events . <nl> uv_sem_wait ( & self - > embed_sem_ ) ; <nl> - <nl> + if ( self - > embed_closed_ ) <nl> + break ; <nl> + <nl> + / / Wait for something to happen in uv loop . <nl> + / / Note that the PollEvents ( ) is implemented by derived classes , so when <nl> + / / this class is being destructed the PollEvents ( ) would not be available <nl> + / / anymore . Because of it we must make sure we only invoke PollEvents ( ) <nl> + / / when this class is alive . <nl> self - > PollEvents ( ) ; <nl> + if ( self - > embed_closed_ ) <nl> + break ; <nl> <nl> / / Deal with event in main thread . <nl> self - > WakeupMainThread ( ) ; <nl>
Fix invoking non - exist method when quiting .
electron/electron
93d5a2e19503ebb3559d1ec2d5f5d3297c59e8b8
2014-01-08T02:51:32Z
mmm a / dbms / include / DB / Parsers / ASTSelectQuery . h <nl> ppp b / dbms / include / DB / Parsers / ASTSelectQuery . h <nl> class ASTSelectQuery : public ASTQueryWithOutput <nl> ASTPtr order_expression_list ; <nl> ASTPtr limit_offset ; <nl> ASTPtr limit_length ; <nl> + ASTPtr next_union_all ; / / / Следующий запрос SELECT в цепочке UNION ALL , если такой есть <nl> <nl> ASTSelectQuery ( ) { } <nl> ASTSelectQuery ( StringRange range_ ) : ASTQueryWithOutput ( range_ ) { } <nl> class ASTSelectQuery : public ASTQueryWithOutput <nl> CLONE ( limit_offset ) <nl> CLONE ( limit_length ) <nl> CLONE ( format ) <nl> + CLONE ( next_union_all ) <nl> <nl> # undef CLONE <nl> <nl> mmm a / dbms / src / Parsers / ParserSelectQuery . cpp <nl> ppp b / dbms / src / Parsers / ParserSelectQuery . cpp <nl> bool ParserSelectQuery : : parseImpl ( Pos & pos , Pos end , ASTPtr & node , Expected & <nl> ParserString s_order ( " ORDER " , true , true ) ; <nl> ParserString s_limit ( " LIMIT " , true , true ) ; <nl> ParserString s_format ( " FORMAT " , true , true ) ; <nl> + ParserString s_union_all ( " UNION ALL " , true , true ) ; <nl> <nl> ParserNotEmptyExpressionList exp_list ; <nl> ParserExpressionWithOptionalAlias exp_elem ; <nl> bool ParserSelectQuery : : parseImpl ( Pos & pos , Pos end , ASTPtr & node , Expected & <nl> <nl> ws . ignore ( pos , end ) ; <nl> } <nl> + <nl> + / / UNION ALL select query <nl> + if ( s_union_all . ignore ( pos , end , expected ) ) <nl> + { <nl> + ws . ignore ( pos , end ) ; <nl> + <nl> + ParserSelectQuery select_p ; <nl> + if ( ! select_p . parse ( pos , end , select_query - > next_union_all , expected ) ) <nl> + return false ; <nl> + <nl> + ws . ignore ( pos , end ) ; <nl> + } <nl> <nl> select_query - > children . push_back ( select_query - > select_expression_list ) ; <nl> if ( select_query - > database ) <nl> bool ParserSelectQuery : : parseImpl ( Pos & pos , Pos end , ASTPtr & node , Expected & <nl> select_query - > children . push_back ( select_query - > limit_length ) ; <nl> if ( select_query - > format ) <nl> select_query - > children . push_back ( select_query - > format ) ; <nl> + if ( select_query - > next_union_all ) <nl> + select_query - > children . push_back ( select_query - > next_union_all ) ; <nl> <nl> return true ; <nl> } <nl>
Add support for UNION ALL in the SQL query parser
ClickHouse/ClickHouse
6323cf5977506f3fdec784314cd58e8df6d19b97
2014-12-15T16:07:49Z
mmm a / test / stdlib / KeyPathImplementation . swift <nl> ppp b / test / stdlib / KeyPathImplementation . swift <nl> struct TestKeyPathBuilder { <nl> } <nl> } <nl> <nl> - / / FIXME : Should return Self , but the closure specializer doesn ' t like that . <nl> - / / rdar : / / problem / 31725007 <nl> extension AnyKeyPath { <nl> static func build ( capacityInBytes : Int , <nl> - withBuilder : ( inout TestKeyPathBuilder ) - > Void ) - > AnyKeyPath { <nl> + withBuilder : ( inout TestKeyPathBuilder ) - > Void ) - > Self { <nl> return _create ( capacityInBytes : capacityInBytes ) { <nl> var builder = TestKeyPathBuilder ( buffer : $ 0 ) <nl> withBuilder ( & builder ) <nl> keyPathImpl . test ( " struct components " ) { <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : S < String > . x_offset ) <nl> - } as ! WritableKeyPath < S < String > , Int > <nl> + } <nl> <nl> let s_y = WritableKeyPath < S < String > , LifetimeTracked ? > <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : S < String > . y_offset ) <nl> - } as ! WritableKeyPath < S < String > , LifetimeTracked ? > <nl> + } <nl> <nl> let s_z = WritableKeyPath < S < String > , String > <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : S < String > . z_offset ) <nl> - } as ! WritableKeyPath < S < String > , String > <nl> + } <nl> <nl> let s_p = WritableKeyPath < S < String > , Point > <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> - } as ! WritableKeyPath < S < String > , Point > <nl> + } <nl> <nl> let twoComponentSize = 12 + MemoryLayout < Int > . size <nl> let s_p_x = WritableKeyPath < S < String > , Double > <nl> keyPathImpl . test ( " struct components " ) { <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> $ 0 . addType ( Point . self ) <nl> $ 0 . addStructComponent ( offset : Point . x_offset ) <nl> - } as ! WritableKeyPath < S < String > , Double > <nl> + } <nl> <nl> let s_p_y = WritableKeyPath < S < String > , Double > <nl> . build ( capacityInBytes : twoComponentSize ) { <nl> keyPathImpl . test ( " struct components " ) { <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> $ 0 . addType ( Point . self ) <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! WritableKeyPath < S < String > , Double > <nl> + } <nl> <nl> <nl> / / \ ( " " ) forces the string to be computed at runtime ( and therefore allocated ) <nl> keyPathImpl . test ( " class components " ) { <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addClassComponent ( offset : C < String > . x_offset ) <nl> - } as ! ReferenceWritableKeyPath < C < String > , Int > <nl> + } <nl> <nl> let c_y = ReferenceWritableKeyPath < C < String > , LifetimeTracked ? > <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addClassComponent ( offset : C < String > . y_offset ) <nl> - } as ! ReferenceWritableKeyPath < C < String > , LifetimeTracked ? > <nl> + } <nl> <nl> let c_z = ReferenceWritableKeyPath < C < String > , String > <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addClassComponent ( offset : C < String > . z_offset ) <nl> - } as ! ReferenceWritableKeyPath < C < String > , String > <nl> + } <nl> <nl> let c = C ( x : 679 , y : nil , z : " buffalo \ ( " " ) " ) <nl> let value = c <nl> keyPathImpl . test ( " reference prefix " ) { <nl> endsReferencePrefix : true ) <nl> $ 0 . addType ( C < String > . self ) <nl> $ 0 . addClassComponent ( offset : C < String > . x_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < String > , Int > <nl> + } <nl> <nl> let s_c_y = ReferenceWritableKeyPath < S < String > , LifetimeTracked ? > <nl> . build ( capacityInBytes : 12 + MemoryLayout < Int > . size ) { <nl> keyPathImpl . test ( " reference prefix " ) { <nl> endsReferencePrefix : true ) <nl> $ 0 . addType ( C < String > . self ) <nl> $ 0 . addClassComponent ( offset : C < String > . y_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < String > , LifetimeTracked ? > <nl> + } <nl> <nl> let s_c_z = ReferenceWritableKeyPath < S < String > , String > <nl> . build ( capacityInBytes : 12 + MemoryLayout < Int > . size ) { <nl> keyPathImpl . test ( " reference prefix " ) { <nl> endsReferencePrefix : true ) <nl> $ 0 . addType ( C < String > . self ) <nl> $ 0 . addClassComponent ( offset : C < String > . z_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < String > , String > <nl> + } <nl> <nl> let c = C ( x : 679 , y : nil , z : " buffalo \ ( " " ) " ) <nl> let value = S ( x : 1738 , y : nil , z : " bottles of beer \ ( " " ) " , <nl> keyPathImpl . test ( " overflowed offsets " ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset , <nl> forceOverflow : true ) <nl> - } as ! WritableKeyPath < S < String > , Point > <nl> + } <nl> <nl> let c_z = ReferenceWritableKeyPath < C < String > , String > <nl> . build ( capacityInBytes : 12 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addClassComponent ( offset : C < String > . z_offset , <nl> forceOverflow : true ) <nl> - } as ! ReferenceWritableKeyPath < C < String > , String > <nl> + } <nl> <nl> let c = C ( x : 679 , y : LifetimeTracked ( 42 ) , z : " buffalo \ ( " " ) " ) <nl> var sValue = S ( x : 1738 , y : LifetimeTracked ( 43 ) , <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Point . self ) <nl> / / Point . x <nl> $ 0 . addStructComponent ( offset : Point . x_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < S < String > > , Double > <nl> + } <nl> <nl> expectEqual ( s_c_z_p_x , s_c_z_p_x ) <nl> expectEqual ( s_c_z_p_x . hashValue , s_c_z_p_x . hashValue ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Point . self ) <nl> / / Point . x <nl> $ 0 . addStructComponent ( offset : Point . x_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < S < String > > , Double > <nl> + } <nl> <nl> expectEqual ( s_c_z_p_x , s_c_z_p_x_2 ) <nl> expectEqual ( s_c_z_p_x . hashValue , s_c_z_p_x_2 . hashValue ) <nl> keyPathImpl . test ( " equality " ) { <nl> / / Point . x <nl> $ 0 . addStructComponent ( offset : Point . x_offset , <nl> forceOverflow : true ) <nl> - } as ! ReferenceWritableKeyPath < S < S < String > > , Double > <nl> + } <nl> <nl> expectEqual ( s_c_z_p_x , s_c_z_p_x_3 ) <nl> expectEqual ( s_c_z_p_x . hashValue , s_c_z_p_x_3 . hashValue ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Point . self ) <nl> / / Point . y <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < S < String > > , Double > <nl> + } <nl> <nl> expectNotEqual ( s_c_z_p_x , s_c_z_p_y ) <nl> expectNotEqual ( s_c_z_p_y , s_c_z_p_x ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( S < String > . self ) <nl> / / S < String > . p <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < S < String > > , Point > <nl> + } <nl> <nl> expectNotEqual ( s_c_z_p_x , s_c_z_p ) <nl> expectNotEqual ( s_c_z_p , s_c_z_p_x ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Point . self ) <nl> / / Point . x <nl> $ 0 . addStructComponent ( offset : Point . x_offset ) <nl> - } as ! KeyPath < S < S < String > > , Double > <nl> + } <nl> <nl> expectNotEqual ( s_c_z_p_x , s_c_z_p_x_readonly ) <nl> expectNotEqual ( s_c_z_p_x_readonly , s_c_z_p_x ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Point . self ) <nl> / / Point . y <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! KeyPath < S < S < String > > , Double > <nl> + } <nl> <nl> expectNotEqual ( s_p_y_readonly , s_c_z_p_x_readonly ) <nl> expectNotEqual ( s_c_z_p_x_readonly , s_p_y_readonly ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Oroborous . self ) <nl> / / O . o <nl> $ 0 . addClassComponent ( offset : classHeaderSize ) <nl> - } as ! ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> + } <nl> <nl> / / Different reference prefix length <nl> let o_o_o_o_rp1 = ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Oroborous . self ) <nl> / / O . o <nl> $ 0 . addClassComponent ( offset : classHeaderSize ) <nl> - } as ! ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> + } <nl> let o_o_o_o_rp2 = ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> . build ( capacityInBytes : 16 + 2 * MemoryLayout < Int > . size ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : true ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Oroborous . self ) <nl> / / O . o <nl> $ 0 . addClassComponent ( offset : classHeaderSize ) <nl> - } as ! ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> + } <nl> let o_o_o_o_rp2_2 = ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> . build ( capacityInBytes : 16 + 2 * MemoryLayout < Int > . size ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : true ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Oroborous . self ) <nl> / / O . o <nl> $ 0 . addClassComponent ( offset : classHeaderSize ) <nl> - } as ! ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> + } <nl> <nl> expectNotEqual ( o_o_o_o , o_o_o_o_rp1 ) <nl> expectNotEqual ( o_o_o_o_rp1 , o_o_o_o ) <nl> keyPathImpl . test ( " equality " ) { <nl> $ 0 . addType ( Oroborous . self ) <nl> / / O . o <nl> $ 0 . addClassComponent ( offset : classHeaderSize ) <nl> - } as ! ReferenceWritableKeyPath < Oroborous , Oroborous > <nl> + } <nl> <nl> expectNotEqual ( o_o_o , o_o_o_o ) <nl> expectNotEqual ( o_o_o_o , o_o_o ) <nl> keyPathImpl . test ( " appending " ) { <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> - } as ! WritableKeyPath < S < String > , Point > <nl> + } <nl> let p_y = WritableKeyPath < Point , Double > <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! WritableKeyPath < Point , Double > <nl> + } <nl> <nl> let s_p_y = s_p . appending ( path : p_y ) <nl> <nl> keyPathImpl . test ( " appending " ) { <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> $ 0 . addType ( Point . self ) <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! WritableKeyPath < S < String > , Double > <nl> + } <nl> expectEqual ( s_p_y , s_p_y_manual ) <nl> expectEqual ( s_p_y_manual , s_p_y ) <nl> expectEqual ( s_p_y . hashValue , s_p_y_manual . hashValue ) <nl> keyPathImpl . test ( " appending " ) { <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addClassComponent ( offset : C < S < String > > . z_offset ) <nl> - } as ! ReferenceWritableKeyPath < C < S < String > > , S < String > > <nl> + } <nl> <nl> let value2 = C ( x : 17 , y : LifetimeTracked ( 38 ) , z : value ) <nl> <nl> keyPathImpl . test ( " appending " ) { <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> $ 0 . addType ( Point . self ) <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! ReferenceWritableKeyPath < C < S < String > > , Double > <nl> + } <nl> <nl> expectEqual ( c_z_p_y , c_z_p_y_manual ) <nl> expectEqual ( c_z_p_y_manual , c_z_p_y ) <nl> keyPathImpl . test ( " appending " ) { <nl> . build ( capacityInBytes : 8 ) { <nl> $ 0 . addHeader ( trivial : true , hasReferencePrefix : false ) <nl> $ 0 . addStructComponent ( offset : S < S < String > > . c_offset ) <nl> - } as ! WritableKeyPath < S < S < String > > , C < S < String > > > <nl> + } <nl> <nl> let s_c_z_p_y = s_c . appending ( path : c_z_p_y ) <nl> <nl> keyPathImpl . test ( " appending " ) { <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> $ 0 . addType ( Point . self ) <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! ReferenceWritableKeyPath < S < S < String > > , Double > <nl> + } <nl> <nl> expectEqual ( s_c_z_p_y , s_c_z_p_y_manual ) <nl> expectEqual ( s_c_z_p_y_manual , s_c_z_p_y ) <nl> keyPathImpl . test ( " appending " ) { <nl> endsReferencePrefix : true ) <nl> $ 0 . addType ( Crate < S < S < String > > > . self ) <nl> $ 0 . addClassComponent ( offset : Crate < S < S < String > > > . value_offset ) <nl> - } as ! ReferenceWritableKeyPath < CP , S < S < String > > > <nl> + } <nl> <nl> let cratePair_left_value_c_z_p_y <nl> = cratePair_left_value . appending ( path : s_c_z_p_y ) <nl> keyPathImpl . test ( " appending " ) { <nl> $ 0 . addStructComponent ( offset : S < String > . p_offset ) <nl> $ 0 . addType ( Point . self ) <nl> $ 0 . addStructComponent ( offset : Point . y_offset ) <nl> - } as ! ReferenceWritableKeyPath < CP , Double > <nl> + } <nl> expectEqual ( cratePair_left_value_c_z_p_y , <nl> cratePair_left_value_c_z_p_y_manual ) <nl> expectEqual ( cratePair_left_value_c_z_p_y_manual , <nl>
Remove workarounds for 31725007 from KeyPathImplementation test .
apple/swift
63c8123a22bf1c3dfbf66648e00ecf6536e4f818
2017-05-09T17:52:57Z
mmm a / hphp / doc / bytecode . specification <nl> ppp b / hphp / doc / bytecode . specification <nl> dispatcher will set the PC of the new frame to point to the main entry point if <nl> either ( 1 ) the function does not have any optional parameters or ( 2 ) the caller <nl> provides values for all of the optional parameters . <nl> <nl> - DV entry points are used to handle initializing optional parameters that the <nl> - caller did not provide . Each DV entry point enters into a corresponding basic <nl> - block of instructions that operates directly on the appropriate local variable <nl> - to set it to its default value . These basic blocks fall through directly into <nl> - one another and the last basic block ends with a jump to the main entry point . <nl> - The dispatcher selects the appropriate DV entry point based on the number of <nl> - arguments passed into the function . <nl> + DV entry points are normally used to handle initializing optional parameters <nl> + that the caller did not provide . Generally the DV entries contain blocks that <nl> + initialize parameters , and then fall through directly into one another , with <nl> + the last block ending with a jump to the main entry point . This is not a <nl> + requirement , however . The dispatcher selects the appropriate DV entry point <nl> + based on the number of arguments passed into the function . <nl> <nl> The main entry point and DV entry points are used by the dispatcher when <nl> handling a function call . Each function ' s metadata provides an " entry point <nl> - table " . Each row in the entry point table consists of a number of arguments and <nl> - the bytecode offset of the entry point that should be used by the dispatcher <nl> - ( either the main entry point or a DV entry point ) . <nl> + table " . Each row in the entry point table consists of a number of arguments <nl> + and the bytecode offset of the entry point that should be used by the <nl> + dispatcher ( either the main entry point or a DV entry point ) . <nl> <nl> Catch entry points are used to implement " catch " blocks in source code . When an <nl> exception is thrown and the unwinder identifies a matching catch , after it <nl> mmm a / hphp / hhbbc / cfg . cpp <nl> ppp b / hphp / hhbbc / cfg . cpp <nl> std : : vector < borrowed_ptr < php : : Block > > rpoSortAddDVs ( const php : : Func & func ) { <nl> postorderWalk ( ret , visited , * func . mainEntry ) ; <nl> <nl> / * <nl> - * Note : depending what the caller is planning to do with this , it <nl> - * is easy to rely on the language in the bytecode spec which says <nl> - * that DV entry points must be basic blocks . <nl> - * <nl> - * E . g . if you use rpoSortAddDVs to see which blocks are reachable , <nl> - * you can leave out blocks within a given DV entry if we support <nl> - * multi - block DV entries . <nl> + * We ' ve already marked the blocks reachable from the main entry <nl> + * point . Do post order walks from each DV entry with the same <nl> + * visited set ( so we ' ll stop if they chain to the main entry , which <nl> + * is the normal case ) . <nl> * / <nl> for ( auto rit = func . params . rbegin ( ) ; rit ! = func . params . rend ( ) ; + + rit ) { <nl> - if ( rit - > dvEntryPoint ) ret . push_back ( rit - > dvEntryPoint ) ; <nl> + if ( ! rit - > dvEntryPoint ) continue ; <nl> + postorderWalk ( ret , visited , * rit - > dvEntryPoint ) ; <nl> } <nl> std : : reverse ( begin ( ret ) , end ( ret ) ) ; <nl> return ret ; <nl> mmm a / hphp / hhbbc / cfg . h <nl> ppp b / hphp / hhbbc / cfg . h <nl> void forEachNormalSuccessor ( const php : : Block & block , Fun f ) { <nl> std : : vector < borrowed_ptr < php : : Block > > rpoSortFromMain ( const php : : Func & ) ; <nl> <nl> / * <nl> - * Obtain the blocks for a function in a reverse post order , starting <nl> - * from the main entry point , and prepend each of the DV entry blocks <nl> - * in parameter order . <nl> + * Obtain the blocks for a function in a reverse post order , taking <nl> + * into account all entry points . <nl> + * <nl> + * This can be thought of as an RPO on the CFG of Func starting from a <nl> + * virtual empty " entry " block , with edges to each DV entry point and <nl> + * an edge to the main entry point . <nl> * / <nl> std : : vector < borrowed_ptr < php : : Block > > rpoSortAddDVs ( const php : : Func & ) ; <nl> <nl> mmm a / hphp / hhbbc / check . cpp <nl> ppp b / hphp / hhbbc / check . cpp <nl> bool checkParams ( const php : : Func & f ) { <nl> assert ( f . params [ i ] . dvEntryPoint = = f . dvEntries [ i ] ) ; <nl> } <nl> <nl> - / * <nl> - * Each dv init entry has a single successor , which is the next one , <nl> - * and the last one has a single successor which is the main entry . <nl> - * <nl> - * This also is effectively asserting that each dv initializer is a <nl> - * single basic block . The bytecode specification implies this <nl> - * right now , but it ' s probably more restrictive than we really need . <nl> - * / <nl> - using namespace folly : : gen ; <nl> - auto entries = <nl> - from ( f . dvEntries ) <nl> - | filter ( [ & ] ( borrowed_ptr < php : : Block > b ) { return b ! = nullptr ; } ) <nl> - | distinct <nl> - | as < std : : vector > ( ) ; <nl> - entries . push_back ( f . mainEntry ) ; <nl> - assert ( ! entries . empty ( ) ) ; <nl> - for ( auto it = begin ( entries ) ; boost : : next ( it ) ! = end ( entries ) ; + + it ) { <nl> - DEBUG_ONLY int count = 0 ; <nl> - forEachSuccessor ( * * it , [ & ] ( const php : : Block & b ) { <nl> - + + count ; <nl> - assert ( & b = = & * * boost : : next ( it ) & & " dvinit entry chain is wrong " ) ; <nl> - } ) ; <nl> - assert ( count = = 1 ) ; <nl> - } <nl> - <nl> return true ; <nl> } <nl> <nl> mmm a / hphp / hhbbc / emit . cpp <nl> ppp b / hphp / hhbbc / emit . cpp <nl> struct EmitUnitState { <nl> * - Each funclet must have all of its blocks contiguous , with the <nl> * entry block first . <nl> * <nl> - * - DV init entry points must fall through into each other , the <nl> - * final one makes a backward jump to the main entry point . <nl> - * TODO ( # 3116551 ) : relax this rule <nl> - * <nl> * - Main entry point must be the first block . <nl> + * <nl> + * It is not a requirement , but we attempt to locate all the DV entry <nl> + * points after the rest of the primary function body . The normal <nl> + * case for DV initializers is that each one falls through to the <nl> + * next , with the block jumping back to the main entry point . <nl> * / <nl> std : : vector < borrowed_ptr < php : : Block > > order_blocks ( const php : : Func & f ) { <nl> auto sorted = rpoSortFromMain ( f ) ; <nl> <nl> - / / Add the DV initializers after the rpo from the main entry point . <nl> - for ( auto & p : f . params ) { <nl> - if ( p . dvEntryPoint ) sorted . push_back ( p . dvEntryPoint ) ; <nl> - } <nl> + / / Get the DV blocks , without the rest of the primary function body , <nl> + / / and then add them to the end of sorted . <nl> + auto const dvBlocks = [ & ] { <nl> + auto withDVs = rpoSortAddDVs ( f ) ; <nl> + withDVs . erase ( <nl> + std : : find ( begin ( withDVs ) , end ( withDVs ) , sorted . front ( ) ) , <nl> + end ( withDVs ) <nl> + ) ; <nl> + return withDVs ; <nl> + } ( ) ; <nl> + sorted . insert ( end ( sorted ) , begin ( dvBlocks ) , end ( dvBlocks ) ) ; <nl> <nl> - / / The stable sort will keep the DV init entries after all other <nl> - / / main code , and move fault funclets after all that . <nl> + / / This stable sort will keep the blocks only reachable from DV <nl> + / / entry points after all other main code , and move fault funclets <nl> + / / after all that . <nl> std : : stable_sort ( <nl> begin ( sorted ) , end ( sorted ) , <nl> [ & ] ( borrowed_ptr < php : : Block > a , borrowed_ptr < php : : Block > b ) { <nl> void exn_path ( std : : vector < const php : : ExnNode * > & ret , const php : : ExnNode * n ) { <nl> ret . push_back ( n ) ; <nl> } <nl> <nl> + / / Return the count of shared elements in the front of two forward <nl> + / / ranges . <nl> template < class ForwardRange1 , class ForwardRange2 > <nl> size_t shared_prefix ( ForwardRange1 & r1 , ForwardRange2 & r2 ) { <nl> auto r1it = begin ( r1 ) ; <nl> auto r2it = begin ( r2 ) ; <nl> auto const r1end = end ( r1 ) ; <nl> auto const r2end = end ( r2 ) ; <nl> - size_t ret = 0 ; <nl> + auto ret = size_t { 0 } ; <nl> while ( r1it ! = r1end & & r2it ! = r2end & & * r1it = = * r2it ) { <nl> + + ret ; + + r1it ; + + r2it ; <nl> } <nl>
Relax bytecode invariants about DV initializers
facebook/hhvm
3304d86ba1ce8f82d2b398e2203b4235de25bd4a
2013-12-10T17:32:59Z
mmm a / build / cocos2d_tests . xcodeproj / project . pbxproj <nl> ppp b / build / cocos2d_tests . xcodeproj / project . pbxproj <nl> <nl> objects = { <nl> <nl> / * Begin PBXAggregateTarget section * / <nl> - 507B43541C31FB340067B53E / * build all tests tvOS * / = { <nl> - isa = PBXAggregateTarget ; <nl> - buildConfigurationList = 507B43581C31FB350067B53E / * Build configuration list for PBXAggregateTarget " build all tests tvOS " * / ; <nl> - buildPhases = ( <nl> - ) ; <nl> - dependencies = ( <nl> - 507B43F51C3201580067B53E / * PBXTargetDependency * / , <nl> - 507B43C21C31FC160067B53E / * PBXTargetDependency * / , <nl> - 507B435C1C31FB510067B53E / * PBXTargetDependency * / , <nl> - 507B435E1C31FB510067B53E / * PBXTargetDependency * / , <nl> - ) ; <nl> - name = " build all tests tvOS " ; <nl> - productName = " build all tvOS " ; <nl> - } ; <nl> A035ACBB1782469700987F6C / * build all tests Mac * / = { <nl> isa = PBXAggregateTarget ; <nl> buildConfigurationList = A035ACBC1782469800987F6C / * Build configuration list for PBXAggregateTarget " build all tests Mac " * / ; <nl> <nl> 5046AB4B1AF2A8D80060550B / * MaterialSystemTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 5046AB481AF2A8D80060550B / * MaterialSystemTest . cpp * / ; } ; <nl> 5046AB5B1AF2C4180060550B / * Materials in Resources * / = { isa = PBXBuildFile ; fileRef = 5046AB5A1AF2C4180060550B / * Materials * / ; } ; <nl> 5046AB5C1AF2C4180060550B / * Materials in Resources * / = { isa = PBXBuildFile ; fileRef = 5046AB5A1AF2C4180060550B / * Materials * / ; } ; <nl> - 507B41021C31BEA60067B53E / * components in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB318CED84500F37B72 / * components * / ; } ; <nl> - 507B41031C31BEA60067B53E / * Icon - 144 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7918CECF1400F37B72 / * Icon - 144 . png * / ; } ; <nl> - 507B41041C31BEA60067B53E / * Icon - 50 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7D18CECF1400F37B72 / * Icon - 50 . png * / ; } ; <nl> - 507B41051C31BEA60067B53E / * Particle3D in Resources * / = { isa = PBXBuildFile ; fileRef = B63993301A49359F00B07923 / * Particle3D * / ; } ; <nl> - 507B41061C31BEA60067B53E / * effect1 . wav in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB618CED84500F37B72 / * effect1 . wav * / ; } ; <nl> - 507B41071C31BEA60067B53E / * Icon - 76 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C8118CECF1400F37B72 / * Icon - 76 . png * / ; } ; <nl> - 507B41081C31BEA60067B53E / * Default @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7518CECF1400F37B72 / * Default @ 2x . png * / ; } ; <nl> - 507B41091C31BEA60067B53E / * effect1 . raw in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB518CED84500F37B72 / * effect1 . raw * / ; } ; <nl> - 507B410A1C31BEA60067B53E / * TerrainTest in Resources * / = { isa = PBXBuildFile ; fileRef = B603F1B31AC8FBFB00A9579C / * TerrainTest * / ; } ; <nl> - 507B410B1C31BEA60067B53E / * ccs - res in Resources * / = { isa = PBXBuildFile ; fileRef = 1A221C9B191771E300FD2BE4 / * ccs - res * / ; } ; <nl> - 507B410C1C31BEA60067B53E / * Icon - 29 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7B18CECF1400F37B72 / * Icon - 29 . png * / ; } ; <nl> - 507B410D1C31BEA60067B53E / * TileMaps in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC818CED84500F37B72 / * TileMaps * / ; } ; <nl> - 507B410E1C31BEA60067B53E / * Particles in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC318CED84500F37B72 / * Particles * / ; } ; <nl> - 507B410F1C31BEA60067B53E / * Default - 568h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7318CECF1400F37B72 / * Default - 568h @ 2x . png * / ; } ; <nl> - 507B41101C31BEA60067B53E / * Test . html in Resources * / = { isa = PBXBuildFile ; fileRef = 29AFEF6619ACCAA000F6B10A / * Test . html * / ; } ; <nl> - 507B41111C31BEA60067B53E / * ccb in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAE18CED84500F37B72 / * ccb * / ; } ; <nl> - 507B41121C31BEA60067B53E / * configs in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB418CED84500F37B72 / * configs * / ; } ; <nl> - 507B41131C31BEA60067B53E / * extensions in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB818CED84500F37B72 / * extensions * / ; } ; <nl> - 507B41141C31BEA60067B53E / * audio in Resources * / = { isa = PBXBuildFile ; fileRef = 3E2BDAD119BEA3E20055CDCD / * audio * / ; } ; <nl> - 507B41151C31BEA60067B53E / * Materials in Resources * / = { isa = PBXBuildFile ; fileRef = 5046AB5A1AF2C4180060550B / * Materials * / ; } ; <nl> - 507B41161C31BEA60067B53E / * background . caf in Resources * / = { isa = PBXBuildFile ; fileRef = C08689C018D370C90093E810 / * background . caf * / ; } ; <nl> - 507B41171C31BEA60067B53E / * Icon - 72 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C8018CECF1400F37B72 / * Icon - 72 . png * / ; } ; <nl> - 507B41181C31BEA60067B53E / * Manifests in Resources * / = { isa = PBXBuildFile ; fileRef = 15B3709219EE5D1000ABE682 / * Manifests * / ; } ; <nl> - 507B41191C31BEA60067B53E / * zwoptex in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC918CED84500F37B72 / * zwoptex * / ; } ; <nl> - 507B411A1C31BEA60067B53E / * Images in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBE18CED84500F37B72 / * Images * / ; } ; <nl> - 507B411B1C31BEA60067B53E / * Icon - 40 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7C18CECF1400F37B72 / * Icon - 40 . png * / ; } ; <nl> - 507B411C1C31BEA60067B53E / * Icon - 100 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7618CECF1400F37B72 / * Icon - 100 . png * / ; } ; <nl> - 507B411D1C31BEA60067B53E / * pew - pew - lei . wav in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC418CED84500F37B72 / * pew - pew - lei . wav * / ; } ; <nl> - 507B411E1C31BEA60067B53E / * Shaders in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC618CED84500F37B72 / * Shaders * / ; } ; <nl> - 507B411F1C31BEA60067B53E / * background . ogg in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAD18CED84500F37B72 / * background . ogg * / ; } ; <nl> - 507B41201C31BEA60067B53E / * background . wav in Resources * / = { isa = PBXBuildFile ; fileRef = 3E2BDB0019C5E5D40055CDCD / * background . wav * / ; } ; <nl> - 507B41211C31BEA60067B53E / * animations in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CA918CED84500F37B72 / * animations * / ; } ; <nl> - 507B41221C31BEA60067B53E / * cocosvideo . mp4 in Resources * / = { isa = PBXBuildFile ; fileRef = 3EA0FB5D191B92F100B170C8 / * cocosvideo . mp4 * / ; } ; <nl> - 507B41231C31BEA60067B53E / * Sprite3DTest in Resources * / = { isa = PBXBuildFile ; fileRef = 3E92EA841921A7720094CD21 / * Sprite3DTest * / ; } ; <nl> - 507B41241C31BEA60067B53E / * Icon - 114 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7718CECF1400F37B72 / * Icon - 114 . png * / ; } ; <nl> - 507B41251C31BEA60067B53E / * hd in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBC18CED84500F37B72 / * hd * / ; } ; <nl> - 507B41261C31BEA60067B53E / * Icon - 57 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7E18CECF1400F37B72 / * Icon - 57 . png * / ; } ; <nl> - 507B41271C31BEA60067B53E / * Misc in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC118CED84500F37B72 / * Misc * / ; } ; <nl> - 507B41281C31BEA60067B53E / * Hello . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBD18CED84500F37B72 / * Hello . png * / ; } ; <nl> - 507B41291C31BEA60067B53E / * Icon - 152 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7A18CECF1400F37B72 / * Icon - 152 . png * / ; } ; <nl> - 507B412A1C31BEA60067B53E / * effect2 . ogg in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB718CED84500F37B72 / * effect2 . ogg * / ; } ; <nl> - 507B412B1C31BEA60067B53E / * ActionTimeline in Resources * / = { isa = PBXBuildFile ; fileRef = 38FA2E75194AECF800FF2BE4 / * ActionTimeline * / ; } ; <nl> - 507B412C1C31BEA60067B53E / * NavMesh in Resources * / = { isa = PBXBuildFile ; fileRef = B61E90CA1B12B74B00BE69EA / * NavMesh * / ; } ; <nl> - 507B412D1C31BEA60067B53E / * Icon - 80 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C8218CECF1400F37B72 / * Icon - 80 . png * / ; } ; <nl> - 507B412E1C31BEA60067B53E / * fileLookup . plist in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB918CED84500F37B72 / * fileLookup . plist * / ; } ; <nl> - 507B412F1C31BEA60067B53E / * Default - 736h @ 3x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F3319EF9CF8000A1F82 / * Default - 736h @ 3x . png * / ; } ; <nl> - 507B41301C31BEA60067B53E / * Default - 667h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F3219EF9CF8000A1F82 / * Default - 667h @ 2x . png * / ; } ; <nl> - 507B41311C31BEA60067B53E / * music . mid in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC218CED84500F37B72 / * music . mid * / ; } ; <nl> - 507B41321C31BEA60067B53E / * spine in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC718CED84500F37B72 / * spine * / ; } ; <nl> - 507B41331C31BEA60067B53E / * Icon - 120 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7818CECF1400F37B72 / * Icon - 120 . png * / ; } ; <nl> - 507B41341C31BEA60067B53E / * Icon - 58 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7F18CECF1400F37B72 / * Icon - 58 . png * / ; } ; <nl> - 507B41351C31BEA60067B53E / * background . mp3 in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAC18CED84500F37B72 / * background . mp3 * / ; } ; <nl> - 507B41361C31BEA60067B53E / * CocosBuilderExample . ccbresourcelog in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB018CED84500F37B72 / * CocosBuilderExample . ccbresourcelog * / ; } ; <nl> - 507B41371C31BEA60067B53E / * Shaders3D in Resources * / = { isa = PBXBuildFile ; fileRef = B2507B6A192589AF00FA4972 / * Shaders3D * / ; } ; <nl> - 507B41381C31BEA60067B53E / * fonts in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBA18CED84500F37B72 / * fonts * / ; } ; <nl> - 507B41391C31BEA60067B53E / * CocosBuilderExample . ccbproj in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAF18CED84500F37B72 / * CocosBuilderExample . ccbproj * / ; } ; <nl> - 507B413A1C31BEA60067B53E / * Default . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7418CECF1400F37B72 / * Default . png * / ; } ; <nl> - 507B413C1C31BEA60067B53E / * GLES - Render . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3593E18CECF0A00F37B72 / * GLES - Render . cpp * / ; } ; <nl> - 507B413D1C31BEA60067B53E / * SpritePolygonTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 6886696F1AE8E8B500C2CFD9 / * SpritePolygonTest . cpp * / ; } ; <nl> - 507B413E1C31BEA60067B53E / * TextInputTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AFC18CECF0C00F37B72 / * TextInputTest . cpp * / ; } ; <nl> - 507B413F1C31BEA60067B53E / * Bug - 886 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598618CECF0B00F37B72 / * Bug - 886 . cpp * / ; } ; <nl> - 507B41401C31BEA60067B53E / * CCControlButtonTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A6318CECF0B00F37B72 / * CCControlButtonTest . cpp * / ; } ; <nl> - 507B41411C31BEA60067B53E / * CCControlSliderTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A7018CECF0B00F37B72 / * CCControlSliderTest . cpp * / ; } ; <nl> - 507B41421C31BEA60067B53E / * UILayoutTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D4E191B595E0066F8DF / * UILayoutTest_Editor . cpp * / ; } ; <nl> - 507B41431C31BEA60067B53E / * SpineTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AF218CECF0C00F37B72 / * SpineTest . cpp * / ; } ; <nl> - 507B41441C31BEA60067B53E / * Physics3DTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = B6CAB54C1AF9AA6C00B9B856 / * Physics3DTest . cpp * / ; } ; <nl> - 507B41451C31BEA60067B53E / * NewRendererTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AB618CECF0C00F37B72 / * NewRendererTest . cpp * / ; } ; <nl> - 507B41461C31BEA60067B53E / * DrawNode3D . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 5EBEECAE1995247000429821 / * DrawNode3D . cpp * / ; } ; <nl> - 507B41471C31BEA60067B53E / * UIRadioButtonTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = B5CE6DCD1B3C08F8002B0419 / * UIRadioButtonTest . cpp * / ; } ; <nl> - 507B41481C31BEA60067B53E / * AnimationsTestLayer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359B818CECF0B00F37B72 / * AnimationsTestLayer . cpp * / ; } ; <nl> - 507B41491C31BEA60067B53E / * CocosGUIScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D1F191B595E0066F8DF / * CocosGUIScene . cpp * / ; } ; <nl> - 507B414A1C31BEA60067B53E / * WebSocketTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A8218CECF0B00F37B72 / * WebSocketTest . cpp * / ; } ; <nl> - 507B414B1C31BEA60067B53E / * ActionTimelineTestScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 38FA2E71194AEBE100FF2BE4 / * ActionTimelineTestScene . cpp * / ; } ; <nl> - 507B414C1C31BEA60067B53E / * UIScale9SpriteTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 295824571987415900F9746D / * UIScale9SpriteTest . cpp * / ; } ; <nl> - 507B414D1C31BEA60067B53E / * Particle3DTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = B639932C1A490EC700B07923 / * Particle3DTest . cpp * / ; } ; <nl> - 507B414E1C31BEA60067B53E / * Bug - 1174 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3597918CECF0B00F37B72 / * Bug - 1174 . cpp * / ; } ; <nl> - 507B414F1C31BEA60067B53E / * CCControlColourPickerTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A6618CECF0B00F37B72 / * CCControlColourPickerTest . cpp * / ; } ; <nl> - 507B41501C31BEA60067B53E / * UITextAtlasTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D75191B595E0066F8DF / * UITextAtlasTest . cpp * / ; } ; <nl> - 507B41511C31BEA60067B53E / * ActionsEaseTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3592C18CECF0A00F37B72 / * ActionsEaseTest . cpp * / ; } ; <nl> - 507B41521C31BEA60067B53E / * MutiTouchTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AB018CECF0C00F37B72 / * MutiTouchTest . cpp * / ; } ; <nl> - 507B41531C31BEA60067B53E / * UIListViewTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D53191B595E0066F8DF / * UIListViewTest_Editor . cpp * / ; } ; <nl> - 507B41541C31BEA60067B53E / * UILoadingBarTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D58191B595E0066F8DF / * UILoadingBarTest_Editor . cpp * / ; } ; <nl> - 507B41551C31BEA60067B53E / * testsAppDelegate . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7218CECF1400F37B72 / * testsAppDelegate . mm * / ; } ; <nl> - 507B41561C31BEA60067B53E / * CustomImageView . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D2D191B595E0066F8DF / * CustomImageView . cpp * / ; } ; <nl> - 507B41571C31BEA60067B53E / * AppDelegate . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3593418CECF0A00F37B72 / * AppDelegate . cpp * / ; } ; <nl> - 507B41581C31BEA60067B53E / * Bug - 1159 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3597718CECF0B00F37B72 / * Bug - 1159 . cpp * / ; } ; <nl> - 507B41591C31BEA60067B53E / * UILoadingBarTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D56191B595E0066F8DF / * UILoadingBarTest . cpp * / ; } ; <nl> - 507B415A1C31BEA60067B53E / * CustomParticleWidget . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D31191B595E0066F8DF / * CustomParticleWidget . cpp * / ; } ; <nl> - 507B415B1C31BEA60067B53E / * SceneTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AE718CECF0C00F37B72 / * SceneTest . cpp * / ; } ; <nl> - 507B415C1C31BEA60067B53E / * CustomImageViewReader . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D2F191B595E0066F8DF / * CustomImageViewReader . cpp * / ; } ; <nl> - 507B415D1C31BEA60067B53E / * UITextAtlasTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D77191B595E0066F8DF / * UITextAtlasTest_Editor . cpp * / ; } ; <nl> - 507B415E1C31BEA60067B53E / * MenuTestLayer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359C818CECF0B00F37B72 / * MenuTestLayer . cpp * / ; } ; <nl> - 507B415F1C31BEA60067B53E / * ClippingNodeTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3599518CECF0B00F37B72 / * ClippingNodeTest . cpp * / ; } ; <nl> - 507B41601C31BEA60067B53E / * LayerTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AA718CECF0C00F37B72 / * LayerTest . cpp * / ; } ; <nl> - 507B41611C31BEA60067B53E / * UITextBMFontTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D7A191B595E0066F8DF / * UITextBMFontTest . cpp * / ; } ; <nl> - 507B41621C31BEA60067B53E / * NodeTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AB918CECF0C00F37B72 / * NodeTest . cpp * / ; } ; <nl> - 507B41631C31BEA60067B53E / * UIWidgetAddNodeTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D89191B595E0066F8DF / * UIWidgetAddNodeTest . cpp * / ; } ; <nl> - 507B41641C31BEA60067B53E / * RenderTextureTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AE118CECF0C00F37B72 / * RenderTextureTest . cpp * / ; } ; <nl> - 507B41651C31BEA60067B53E / * MenuTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AAA18CECF0C00F37B72 / * MenuTest . cpp * / ; } ; <nl> - 507B41661C31BEA60067B53E / * UserDefaultTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B1818CECF0C00F37B72 / * UserDefaultTest . cpp * / ; } ; <nl> - 507B41671C31BEA60067B53E / * UITest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D1A191B574B0066F8DF / * UITest . cpp * / ; } ; <nl> - 507B41681C31BEA60067B53E / * Camera3DTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3E9E75CE199324CB005B7047 / * Camera3DTest . cpp * / ; } ; <nl> - 507B41691C31BEA60067B53E / * CustomReader . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D35191B595E0066F8DF / * CustomReader . cpp * / ; } ; <nl> - 507B416A1C31BEA60067B53E / * ParallaxTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35ABC18CECF0C00F37B72 / * ParallaxTest . cpp * / ; } ; <nl> - 507B416B1C31BEA60067B53E / * ZwoptexTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B1D18CECF0C00F37B72 / * ZwoptexTest . cpp * / ; } ; <nl> - 507B416C1C31BEA60067B53E / * VibrateTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35C6D18CECF0C00F37B72 / * VibrateTest . cpp * / ; } ; <nl> - 507B416D1C31BEA60067B53E / * ComponentsTestScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359E018CECF0B00F37B72 / * ComponentsTestScene . cpp * / ; } ; <nl> - 507B416E1C31BEA60067B53E / * Bug - 914 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598A18CECF0B00F37B72 / * Bug - 914 . cpp * / ; } ; <nl> - 507B416F1C31BEA60067B53E / * EffectsAdvancedTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359AF18CECF0B00F37B72 / * EffectsAdvancedTest . cpp * / ; } ; <nl> - 507B41701C31BEA60067B53E / * Paddle . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B0D18CECF0C00F37B72 / * Paddle . cpp * / ; } ; <nl> - 507B41711C31BEA60067B53E / * UIPageViewTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D5B191B595E0066F8DF / * UIPageViewTest . cpp * / ; } ; <nl> - 507B41721C31BEA60067B53E / * SceneEditorTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A5918CECF0B00F37B72 / * SceneEditorTest . cpp * / ; } ; <nl> - 507B41731C31BEA60067B53E / * Scene3DTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = A0BD49FC1AFAFEE50046CCE3 / * Scene3DTest . cpp * / ; } ; <nl> - 507B41741C31BEA60067B53E / * OpenURLTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = A5030C3319D059DA000E78E7 / * OpenURLTest . cpp * / ; } ; <nl> - 507B41751C31BEA60067B53E / * BugsTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598C18CECF0B00F37B72 / * BugsTest . cpp * / ; } ; <nl> - 507B41761C31BEA60067B53E / * testBasic . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AF718CECF0C00F37B72 / * testBasic . cpp * / ; } ; <nl> - 507B41771C31BEA60067B53E / * EnemyController . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359E218CECF0B00F37B72 / * EnemyController . cpp * / ; } ; <nl> - 507B41781C31BEA60067B53E / * UIWidgetAddNodeTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D8B191B595E0066F8DF / * UIWidgetAddNodeTest_Editor . cpp * / ; } ; <nl> - 507B41791C31BEA60067B53E / * CocosBuilderTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359BE18CECF0B00F37B72 / * CocosBuilderTest . cpp * / ; } ; <nl> - 507B417A1C31BEA60067B53E / * UITextFieldTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D81191B595E0066F8DF / * UITextFieldTest_Editor . cpp * / ; } ; <nl> - 507B417B1C31BEA60067B53E / * QuestionContainerSprite . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598218CECF0B00F37B72 / * QuestionContainerSprite . cpp * / ; } ; <nl> - 507B417C1C31BEA60067B53E / * DrawPrimitivesTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359AC18CECF0B00F37B72 / * DrawPrimitivesTest . cpp * / ; } ; <nl> - 507B417D1C31BEA60067B53E / * UITextFieldTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D7F191B595E0066F8DF / * UITextFieldTest . cpp * / ; } ; <nl> - 507B417E1C31BEA60067B53E / * MotionStreakTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AAD18CECF0C00F37B72 / * MotionStreakTest . cpp * / ; } ; <nl> - 507B417F1C31BEA60067B53E / * AllocatorTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = D0FD03621A3B546400825BB5 / * AllocatorTest . cpp * / ; } ; <nl> - 507B41801C31BEA60067B53E / * FontTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A9318CECF0B00F37B72 / * FontTest . cpp * / ; } ; <nl> - 507B41811C31BEA60067B53E / * RefPtrTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1F33634D18E37E840074764D / * RefPtrTest . cpp * / ; } ; <nl> - 507B41821C31BEA60067B53E / * UIEditBoxTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 292CF01219A1965E00E8E6A0 / * UIEditBoxTest . cpp * / ; } ; <nl> - 507B41831C31BEA60067B53E / * ActionsTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3593218CECF0A00F37B72 / * ActionsTest . cpp * / ; } ; <nl> - 507B41841C31BEA60067B53E / * ShaderTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AED18CECF0C00F37B72 / * ShaderTest . cpp * / ; } ; <nl> - 507B41851C31BEA60067B53E / * BillBoardTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = B609E67119C18DAD003D0074 / * BillBoardTest . cpp * / ; } ; <nl> - 507B41861C31BEA60067B53E / * Bug - PageViewLayout . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 94D793D71B4B7A3600F60F10 / * Bug - PageViewLayout . cpp * / ; } ; <nl> - 507B41871C31BEA60067B53E / * TileMapTest2 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = C04F93581941B05400E9FEAB / * TileMapTest2 . cpp * / ; } ; <nl> - 507B41881C31BEA60067B53E / * Bug - 624 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598418CECF0B00F37B72 / * Bug - 624 . cpp * / ; } ; <nl> - 507B41891C31BEA60067B53E / * SocketIOTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A8018CECF0B00F37B72 / * SocketIOTest . cpp * / ; } ; <nl> - 507B418A1C31BEA60067B53E / * SpriteTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AF518CECF0C00F37B72 / * SpriteTest . cpp * / ; } ; <nl> - 507B418B1C31BEA60067B53E / * NewAudioEngineTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3E2BDACE19BEA3410055CDCD / * NewAudioEngineTest . cpp * / ; } ; <nl> - 507B418C1C31BEA60067B53E / * FileUtilsTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A9018CECF0B00F37B72 / * FileUtilsTest . cpp * / ; } ; <nl> - 507B418D1C31BEA60067B53E / * CustomRootNodeReader . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3825CC451A2C982A00C92EA8 / * CustomRootNodeReader . cpp * / ; } ; <nl> - 507B418E1C31BEA60067B53E / * CurlTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359A318CECF0B00F37B72 / * CurlTest . cpp * / ; } ; <nl> - 507B418F1C31BEA60067B53E / * CustomTableViewCell . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A8B18CECF0B00F37B72 / * CustomTableViewCell . cpp * / ; } ; <nl> - 507B41901C31BEA60067B53E / * CustomGUIScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D23191B595E0066F8DF / * CustomGUIScene . cpp * / ; } ; <nl> - 507B41911C31BEA60067B53E / * CCControlSwitchTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A7618CECF0B00F37B72 / * CCControlSwitchTest . cpp * / ; } ; <nl> - 507B41921C31BEA60067B53E / * BaseTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3593618CECF0A00F37B72 / * BaseTest . cpp * / ; } ; <nl> - 507B41931C31BEA60067B53E / * PlayerController . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359E618CECF0B00F37B72 / * PlayerController . cpp * / ; } ; <nl> - 507B41941C31BEA60067B53E / * main . m in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35C8418CECF1400F37B72 / * main . m * / ; } ; <nl> - 507B41951C31BEA60067B53E / * UIScrollViewTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D6B191B595E0066F8DF / * UIScrollViewTest . cpp * / ; } ; <nl> - 507B41961C31BEA60067B53E / * CCControlScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A6B18CECF0B00F37B72 / * CCControlScene . cpp * / ; } ; <nl> - 507B41971C31BEA60067B53E / * UICheckBoxTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D41191B595E0066F8DF / * UICheckBoxTest_Editor . cpp * / ; } ; <nl> - 507B41981C31BEA60067B53E / * DataVisitorTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359A918CECF0B00F37B72 / * DataVisitorTest . cpp * / ; } ; <nl> - 507B41991C31BEA60067B53E / * CurrentLanguageTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359A618CECF0B00F37B72 / * CurrentLanguageTest . cpp * / ; } ; <nl> - 507B419A1C31BEA60067B53E / * UITextTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D86191B595E0066F8DF / * UITextTest_Editor . cpp * / ; } ; <nl> - 507B419B1C31BEA60067B53E / * UICheckBoxTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D3F191B595E0066F8DF / * UICheckBoxTest . cpp * / ; } ; <nl> - 507B419C1C31BEA60067B53E / * Bug - 350 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3597B18CECF0B00F37B72 / * Bug - 350 . cpp * / ; } ; <nl> - 507B419D1C31BEA60067B53E / * UITextBMFontTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D7C191B595E0066F8DF / * UITextBMFontTest_Editor . cpp * / ; } ; <nl> - 507B419E1C31BEA60067B53E / * SchedulerTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AEA18CECF0C00F37B72 / * SchedulerTest . cpp * / ; } ; <nl> - 507B419F1C31BEA60067B53E / * Texture2dTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AFF18CECF0C00F37B72 / * Texture2dTest . cpp * / ; } ; <nl> - 507B41A01C31BEA60067B53E / * MouseTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A9618CECF0B00F37B72 / * MouseTest . cpp * / ; } ; <nl> - 507B41A11C31BEA60067B53E / * Ball . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B0B18CECF0C00F37B72 / * Ball . cpp * / ; } ; <nl> - 507B41A21C31BEA60067B53E / * GameOverScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359E418CECF0B00F37B72 / * GameOverScene . cpp * / ; } ; <nl> - 507B41A31C31BEA60067B53E / * ExtensionsTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A7B18CECF0B00F37B72 / * ExtensionsTest . cpp * / ; } ; <nl> - 507B41A41C31BEA60067B53E / * TestEntries . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3594218CECF0A00F37B72 / * TestEntries . cpp * / ; } ; <nl> - 507B41A51C31BEA60067B53E / * AssetsManagerExTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 15B3709619EE5DBA00ABE682 / * AssetsManagerExTest . cpp * / ; } ; <nl> - 507B41A61C31BEA60067B53E / * Box2dTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3593918CECF0A00F37B72 / * Box2dTest . cpp * / ; } ; <nl> - 507B41A71C31BEA60067B53E / * UISceneManager_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D68191B595E0066F8DF / * UISceneManager_Editor . cpp * / ; } ; <nl> - 507B41A81C31BEA60067B53E / * LabelTestNew . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AA418CECF0C00F37B72 / * LabelTestNew . cpp * / ; } ; <nl> - 507B41A91C31BEA60067B53E / * ChipmunkTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598F18CECF0B00F37B72 / * ChipmunkTest . cpp * / ; } ; <nl> - 507B41AA1C31BEA60067B53E / * cons . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A5E18CECF0B00F37B72 / * cons . cpp * / ; } ; <nl> - 507B41AB1C31BEA60067B53E / * ConsoleTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3599E18CECF0B00F37B72 / * ConsoleTest . cpp * / ; } ; <nl> - 507B41AC1C31BEA60067B53E / * IntervalTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A9918CECF0B00F37B72 / * IntervalTest . cpp * / ; } ; <nl> - 507B41AD1C31BEA60067B53E / * UISliderTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D70191B595E0066F8DF / * UISliderTest . cpp * / ; } ; <nl> - 507B41AE1C31BEA60067B53E / * CCControlStepperTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A7318CECF0B00F37B72 / * CCControlStepperTest . cpp * / ; } ; <nl> - 507B41AF1C31BEA60067B53E / * UIButtonTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D3A191B595E0066F8DF / * UIButtonTest . cpp * / ; } ; <nl> - 507B41B01C31BEA60067B53E / * TextureAtlasEncryptionTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B0518CECF0C00F37B72 / * TextureAtlasEncryptionTest . cpp * / ; } ; <nl> - 507B41B11C31BEA60067B53E / * ConfigurationTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3599B18CECF0B00F37B72 / * ConfigurationTest . cpp * / ; } ; <nl> - 507B41B21C31BEA60067B53E / * CCControlPotentiometerTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A6918CECF0B00F37B72 / * CCControlPotentiometerTest . cpp * / ; } ; <nl> - 507B41B31C31BEA60067B53E / * RootViewController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35C7018CECF1400F37B72 / * RootViewController . mm * / ; } ; <nl> - 507B41B41C31BEA60067B53E / * TileMapTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B0818CECF0C00F37B72 / * TileMapTest . cpp * / ; } ; <nl> - 507B41B51C31BEA60067B53E / * UIRichTextTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D60191B595E0066F8DF / * UIRichTextTest . cpp * / ; } ; <nl> - 507B41B71C31BEA60067B53E / * Bug - 899 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598818CECF0B00F37B72 / * Bug - 899 . cpp * / ; } ; <nl> - 507B41B81C31BEA60067B53E / * NewEventDispatcherTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AB318CECF0C00F37B72 / * NewEventDispatcherTest . cpp * / ; } ; <nl> - 507B41B91C31BEA60067B53E / * UIScrollViewTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D6D191B595E0066F8DF / * UIScrollViewTest_Editor . cpp * / ; } ; <nl> - 507B41BA1C31BEA60067B53E / * acts . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A5C18CECF0B00F37B72 / * acts . cpp * / ; } ; <nl> - 507B41BB1C31BEA60067B53E / * ArmatureScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359DD18CECF0B00F37B72 / * ArmatureScene . cpp * / ; } ; <nl> - 507B41BC1C31BEA60067B53E / * SceneController . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359EA18CECF0B00F37B72 / * SceneController . cpp * / ; } ; <nl> - 507B41BD1C31BEA60067B53E / * UISliderTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D72191B595E0066F8DF / * UISliderTest_Editor . cpp * / ; } ; <nl> - 507B41BE1C31BEA60067B53E / * Test . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3594018CECF0A00F37B72 / * Test . cpp * / ; } ; <nl> - 507B41BF1C31BEA60067B53E / * ParticleTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35ABF18CECF0C00F37B72 / * ParticleTest . cpp * / ; } ; <nl> - 507B41C01C31BEA60067B53E / * TouchesTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B0F18CECF0C00F37B72 / * TouchesTest . cpp * / ; } ; <nl> - 507B41C11C31BEA60067B53E / * UIImageViewTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D49191B595E0066F8DF / * UIImageViewTest_Editor . cpp * / ; } ; <nl> - 507B41C21C31BEA60067B53E / * TransitionsTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B1218CECF0C00F37B72 / * TransitionsTest . cpp * / ; } ; <nl> - 507B41C31C31BEA60067B53E / * RotateWorldTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AE418CECF0C00F37B72 / * RotateWorldTest . cpp * / ; } ; <nl> - 507B41C41C31BEA60067B53E / * ActionsProgressTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3592F18CECF0A00F37B72 / * ActionsProgressTest . cpp * / ; } ; <nl> - 507B41C51C31BEA60067B53E / * EffectsTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359B218CECF0B00F37B72 / * EffectsTest . cpp * / ; } ; <nl> - 507B41C61C31BEA60067B53E / * TestHeaderLayer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359D518CECF0B00F37B72 / * TestHeaderLayer . cpp * / ; } ; <nl> - 507B41C71C31BEA60067B53E / * ActionManagerTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3592918CECF0A00F37B72 / * ActionManagerTest . cpp * / ; } ; <nl> - 507B41C81C31BEA60067B53E / * CocoStudioGUITest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D21191B595E0066F8DF / * CocoStudioGUITest . cpp * / ; } ; <nl> - 507B41C91C31BEA60067B53E / * PhysicsTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35ADB18CECF0C00F37B72 / * PhysicsTest . cpp * / ; } ; <nl> - 507B41CA1C31BEA60067B53E / * CustomRootNode . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3825CC431A2C982A00C92EA8 / * CustomRootNode . cpp * / ; } ; <nl> - 507B41CB1C31BEA60067B53E / * UIScene_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D64191B595E0066F8DF / * UIScene_Editor . cpp * / ; } ; <nl> - 507B41CC1C31BEA60067B53E / * UILayoutTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D4C191B595E0066F8DF / * UILayoutTest . cpp * / ; } ; <nl> - 507B41CD1C31BEA60067B53E / * ButtonTestLayer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359BB18CECF0B00F37B72 / * ButtonTestLayer . cpp * / ; } ; <nl> - 507B41CE1C31BEA60067B53E / * UIListViewTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D51191B595E0066F8DF / * UIListViewTest . cpp * / ; } ; <nl> - 507B41CF1C31BEA60067B53E / * MaterialSystemTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 5046AB481AF2A8D80060550B / * MaterialSystemTest . cpp * / ; } ; <nl> - 507B41D01C31BEA60067B53E / * Box2dView . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3593C18CECF0A00F37B72 / * Box2dView . cpp * / ; } ; <nl> - 507B41D11C31BEA60067B53E / * UIImageViewTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D47191B595E0066F8DF / * UIImageViewTest . cpp * / ; } ; <nl> - 507B41D21C31BEA60067B53E / * LabelTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AA218CECF0C00F37B72 / * LabelTest . cpp * / ; } ; <nl> - 507B41D31C31BEA60067B53E / * Bug - 12847 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 850F8A221B5F3A4F00780603 / * Bug - 12847 . cpp * / ; } ; <nl> - 507B41D41C31BEA60067B53E / * Bug - Child . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 59620E8D1921E5CF002021B6 / * Bug - Child . cpp * / ; } ; <nl> - 507B41D51C31BEA60067B53E / * UISceneManager . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D66191B595E0066F8DF / * UISceneManager . cpp * / ; } ; <nl> - 507B41D61C31BEA60067B53E / * VisibleRect . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B1A18CECF0C00F37B72 / * VisibleRect . cpp * / ; } ; <nl> - 507B41D71C31BEA60067B53E / * ReleasePoolTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35ADE18CECF0C00F37B72 / * ReleasePoolTest . cpp * / ; } ; <nl> - 507B41D81C31BEA60067B53E / * DownloaderTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 50921EAD1B746D5F00C085CC / * DownloaderTest . cpp * / ; } ; <nl> - 507B41D91C31BEA60067B53E / * TextureCacheTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B0218CECF0C00F37B72 / * TextureCacheTest . cpp * / ; } ; <nl> - 507B41DA1C31BEA60067B53E / * HelloCocosBuilderLayer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359C118CECF0B00F37B72 / * HelloCocosBuilderLayer . cpp * / ; } ; <nl> - 507B41DB1C31BEA60067B53E / * CustomParticleWidgetTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D2A191B595E0066F8DF / * CustomParticleWidgetTest . cpp * / ; } ; <nl> - 507B41DC1C31BEA60067B53E / * UITextTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D84191B595E0066F8DF / * UITextTest . cpp * / ; } ; <nl> - 507B41DD1C31BEA60067B53E / * UIPageViewTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D5D191B595E0066F8DF / * UIPageViewTest_Editor . cpp * / ; } ; <nl> - 507B41DE1C31BEA60067B53E / * TableViewTestScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A8D18CECF0B00F37B72 / * TableViewTestScene . cpp * / ; } ; <nl> - 507B41DF1C31BEA60067B53E / * ShaderTest2 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35AEF18CECF0C00F37B72 / * ShaderTest2 . cpp * / ; } ; <nl> - 507B41E01C31BEA60067B53E / * UnitTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35B1518CECF0C00F37B72 / * UnitTest . cpp * / ; } ; <nl> - 507B41E11C31BEA60067B53E / * CocostudioParserTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 290E94B3196FC16900694919 / * CocostudioParserTest . cpp * / ; } ; <nl> - 507B41E21C31BEA60067B53E / * Bug - 458 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3598018CECF0B00F37B72 / * Bug - 458 . cpp * / ; } ; <nl> - 507B41E31C31BEA60067B53E / * UIScene . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D62191B595E0066F8DF / * UIScene . cpp * / ; } ; <nl> - 507B41E41C31BEA60067B53E / * CocosDenshionTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3599818CECF0B00F37B72 / * CocosDenshionTest . cpp * / ; } ; <nl> - 507B41E51C31BEA60067B53E / * ProjectileController . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359E818CECF0B00F37B72 / * ProjectileController . cpp * / ; } ; <nl> - 507B41E61C31BEA60067B53E / * CustomWidgetCallbackBindTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3825CC471A2C982A00C92EA8 / * CustomWidgetCallbackBindTest . cpp * / ; } ; <nl> - 507B41E71C31BEA60067B53E / * Sprite3DTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3E92EA801921A1400094CD21 / * Sprite3DTest . cpp * / ; } ; <nl> - 507B41E81C31BEA60067B53E / * controller . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359A018CECF0B00F37B72 / * controller . cpp * / ; } ; <nl> - 507B41E91C31BEA60067B53E / * CCControlSceneManager . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A6D18CECF0B00F37B72 / * CCControlSceneManager . cpp * / ; } ; <nl> - 507B41EA1C31BEA60067B53E / * CocosStudio3DTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 182C5CB81A95B2FD00C30D34 / * CocosStudio3DTest . cpp * / ; } ; <nl> - 507B41EB1C31BEA60067B53E / * TimelineCallbackTestLayer . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC359DA18CECF0B00F37B72 / * TimelineCallbackTestLayer . cpp * / ; } ; <nl> - 507B41EC1C31BEA60067B53E / * Bug - CCDrawNode . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 94D793D51B4B7A3600F60F10 / * Bug - CCDrawNode . cpp * / ; } ; <nl> - 507B41ED1C31BEA60067B53E / * CustomParticleWidgetReader . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D33191B595E0066F8DF / * CustomParticleWidgetReader . cpp * / ; } ; <nl> - 507B41EE1C31BEA60067B53E / * NotificationCenterTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A8518CECF0B00F37B72 / * NotificationCenterTest . cpp * / ; } ; <nl> - 507B41EF1C31BEA60067B53E / * CocostudioParserJsonTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29FBBBFC196A9ECD00E65826 / * CocostudioParserJsonTest . cpp * / ; } ; <nl> - 507B41F01C31BEA60067B53E / * NavMeshTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = B6DD2FFA1B04979C00E47F5F / * NavMeshTest . cpp * / ; } ; <nl> - 507B41F11C31BEA60067B53E / * LightTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = B6C039D719C95D83007207DC / * LightTest . cpp * / ; } ; <nl> - 507B41F21C31BEA60067B53E / * GUIEditorTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D37191B595E0066F8DF / * GUIEditorTest . cpp * / ; } ; <nl> - 507B41F31C31BEA60067B53E / * CustomImageTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D27191B595E0066F8DF / * CustomImageTest . cpp * / ; } ; <nl> - 507B41F41C31BEA60067B53E / * Bug - 422 . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3597D18CECF0B00F37B72 / * Bug - 422 . cpp * / ; } ; <nl> - 507B41F51C31BEA60067B53E / * UIFocusTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D44191B595E0066F8DF / * UIFocusTest . cpp * / ; } ; <nl> - 507B41F61C31BEA60067B53E / * HttpClientTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35A7E18CECF0B00F37B72 / * HttpClientTest . cpp * / ; } ; <nl> - 507B41F81C31BEA60067B53E / * UIButtonTest_Editor . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 29080D3C191B595E0066F8DF / * UIButtonTest_Editor . cpp * / ; } ; <nl> - 507B41F91C31BEA60067B53E / * ClickAndMoveTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC3599218CECF0B00F37B72 / * ClickAndMoveTest . cpp * / ; } ; <nl> - 507B41FA1C31BEA60067B53E / * TerrainTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = B603F1AD1AC8EA4E00A9579C / * TerrainTest . cpp * / ; } ; <nl> - 507B41FC1C31BEA60067B53E / * libiconv . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = ED545A721B68A1AC00C3958E / * libiconv . dylib * / ; } ; <nl> - 507B41FD1C31BEA60067B53E / * Security . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 52B47A331A534B2B004E4C60 / * Security . framework * / ; } ; <nl> - 507B41FE1C31BEA60067B53E / * MediaPlayer . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 3EA0FB65191B933000B170C8 / * MediaPlayer . framework * / ; } ; <nl> - 507B42001C31BEA60067B53E / * CoreMotion . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = D60AE43317F7FFE100757E4B / * CoreMotion . framework * / ; } ; <nl> - 507B42011C31BEA60067B53E / * libz . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C6482E165F399D007D4F18 / * libz . dylib * / ; } ; <nl> - 507B42021C31BEA60067B53E / * Foundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64832165F3AFD007D4F18 / * Foundation . framework * / ; } ; <nl> - 507B42031C31BEA60067B53E / * AudioToolbox . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C6482C165F3988007D4F18 / * AudioToolbox . framework * / ; } ; <nl> - 507B42041C31BEA60067B53E / * OpenAL . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64828165F396B007D4F18 / * OpenAL . framework * / ; } ; <nl> - 507B42051C31BEA60067B53E / * QuartzCore . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64826165F394E007D4F18 / * QuartzCore . framework * / ; } ; <nl> - 507B42061C31BEA60067B53E / * CoreGraphics . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52BB1783AEB80073F6A7 / * CoreGraphics . framework * / ; } ; <nl> - 507B42071C31BEA60067B53E / * OpenGLES . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52B91783AE900073F6A7 / * OpenGLES . framework * / ; } ; <nl> - 507B42081C31BEA60067B53E / * UIKit . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52B71783AE6D0073F6A7 / * UIKit . framework * / ; } ; <nl> - 507B42091C31BEA60067B53E / * AVFoundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52C11783B01F0073F6A7 / * AVFoundation . framework * / ; } ; <nl> - 507B42121C31C1710067B53E / * libcocos2d tvOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 507B42111C31BEA70067B53E / * libcocos2d tvOS . a * / ; } ; <nl> - 507B42851C31E6070067B53E / * AppController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 185664101B422FFF009EF2AE / * AppController . mm * / ; } ; <nl> - 507B42861C31E6070067B53E / * main . m in Sources * / = { isa = PBXBuildFile ; fileRef = 1856641C1B422FFF009EF2AE / * main . m * / ; } ; <nl> - 507B42871C31E6070067B53E / * NativeOcClass . m in Sources * / = { isa = PBXBuildFile ; fileRef = 1856641E1B422FFF009EF2AE / * NativeOcClass . m * / ; } ; <nl> - 507B42881C31E6070067B53E / * js_Effect3D_bindings . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 185664061B422F72009EF2AE / * js_Effect3D_bindings . cpp * / ; } ; <nl> - 507B42891C31E6070067B53E / * js_DrawNode3D_bindings . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 185664041B422F72009EF2AE / * js_DrawNode3D_bindings . cpp * / ; } ; <nl> - 507B428A1C31E6070067B53E / * RootViewController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 185664211B422FFF009EF2AE / * RootViewController . mm * / ; } ; <nl> - 507B428B1C31E6070067B53E / * AppDelegate . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 185664021B422F72009EF2AE / * AppDelegate . cpp * / ; } ; <nl> - 507B428D1C31E6070067B53E / * libsqlite3 . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 18FC4D5E1B4257CD00B76F95 / * libsqlite3 . dylib * / ; } ; <nl> - 507B428F1C31E6070067B53E / * Security . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 52B47A331A534B2B004E4C60 / * Security . framework * / ; } ; <nl> - 507B42911C31E6070067B53E / * MediaPlayer . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 3EA0FB65191B933000B170C8 / * MediaPlayer . framework * / ; } ; <nl> - 507B42921C31E6070067B53E / * libz . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3AF18CDA06D0087CE3A / * libz . dylib * / ; } ; <nl> - 507B42931C31E6070067B53E / * libiconv . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = ED545A721B68A1AC00C3958E / * libiconv . dylib * / ; } ; <nl> - 507B42941C31E6070067B53E / * CoreMotion . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = D60AE43317F7FFE100757E4B / * CoreMotion . framework * / ; } ; <nl> - 507B42951C31E6070067B53E / * AudioToolbox . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A818CD9F130087CE3A / * AudioToolbox . framework * / ; } ; <nl> - 507B42961C31E6070067B53E / * OpenAL . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A618CD9F0D0087CE3A / * OpenAL . framework * / ; } ; <nl> - 507B42971C31E6070067B53E / * QuartzCore . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A418CD9F060087CE3A / * QuartzCore . framework * / ; } ; <nl> - 507B42981C31E6070067B53E / * CoreGraphics . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A218CD9EFE0087CE3A / * CoreGraphics . framework * / ; } ; <nl> - 507B42991C31E6070067B53E / * OpenGLES . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A018CD9EF60087CE3A / * OpenGLES . framework * / ; } ; <nl> - 507B429A1C31E6070067B53E / * UIKit . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA39E18CD9EE50087CE3A / * UIKit . framework * / ; } ; <nl> - 507B429B1C31E6070067B53E / * AVFoundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA39C18CD9ED80087CE3A / * AVFoundation . framework * / ; } ; <nl> - 507B429C1C31E6070067B53E / * Foundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64832165F3AFD007D4F18 / * Foundation . framework * / ; } ; <nl> - 507B429E1C31E6070067B53E / * script in Resources * / = { isa = PBXBuildFile ; fileRef = 185664541B42364E009EF2AE / * script * / ; } ; <nl> - 507B429F1C31E6070067B53E / * Default - 568h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664111B422FFF009EF2AE / * Default - 568h @ 2x . png * / ; } ; <nl> - 507B42A01C31E6070067B53E / * Default . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664121B422FFF009EF2AE / * Default . png * / ; } ; <nl> - 507B42A11C31E6070067B53E / * Default @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664131B422FFF009EF2AE / * Default @ 2x . png * / ; } ; <nl> - 507B42A21C31E6070067B53E / * Icon - 114 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664141B422FFF009EF2AE / * Icon - 114 . png * / ; } ; <nl> - 507B42A31C31E6070067B53E / * Icon - 120 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664151B422FFF009EF2AE / * Icon - 120 . png * / ; } ; <nl> - 507B42A41C31E6070067B53E / * Icon - 144 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664161B422FFF009EF2AE / * Icon - 144 . png * / ; } ; <nl> - 507B42A51C31E6070067B53E / * Icon - 152 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664171B422FFF009EF2AE / * Icon - 152 . png * / ; } ; <nl> - 507B42A61C31E6070067B53E / * Icon - 57 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664181B422FFF009EF2AE / * Icon - 57 . png * / ; } ; <nl> - 507B42A71C31E6070067B53E / * Icon - 72 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 185664191B422FFF009EF2AE / * Icon - 72 . png * / ; } ; <nl> - 507B42A81C31E6070067B53E / * Icon - 76 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1856641A1B422FFF009EF2AE / * Icon - 76 . png * / ; } ; <nl> - 507B42A91C31E6070067B53E / * src in Resources * / = { isa = PBXBuildFile ; fileRef = 185663FD1B422EF0009EF2AE / * src * / ; } ; <nl> - 507B42AA1C31E6070067B53E / * project . json in Resources * / = { isa = PBXBuildFile ; fileRef = 185663FA1B422EE0009EF2AE / * project . json * / ; } ; <nl> - 507B42AB1C31E6070067B53E / * main . js in Resources * / = { isa = PBXBuildFile ; fileRef = 185663F71B422ED6009EF2AE / * main . js * / ; } ; <nl> - 507B42AC1C31E6070067B53E / * res in Resources * / = { isa = PBXBuildFile ; fileRef = 185663F41B422EA7009EF2AE / * res * / ; } ; <nl> - 507B42B91C31EC6A0067B53E / * libcocos2d tvOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 507B42111C31BEA70067B53E / * libcocos2d tvOS . a * / ; } ; <nl> - 507B42BA1C31EC6A0067B53E / * libjscocos2d tvOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 507B42B41C31E6080067B53E / * libjscocos2d tvOS . a * / ; } ; <nl> - 507B43681C31FB670067B53E / * lua_test_bindings . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 150F918619DA409E00B89F57 / * lua_test_bindings . cpp * / ; } ; <nl> - 507B43691C31FB670067B53E / * main . m in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35D9518CEE5D100F37B72 / * main . m * / ; } ; <nl> - 507B436A1C31FB670067B53E / * LuaObjectCBridgeTest . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35D9418CEE5D100F37B72 / * LuaObjectCBridgeTest . mm * / ; } ; <nl> - 507B436B1C31FB670067B53E / * AppController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8718CEE5D100F37B72 / * AppController . mm * / ; } ; <nl> - 507B436C1C31FB670067B53E / * AppDelegate . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35D7D18CEE5B100F37B72 / * AppDelegate . cpp * / ; } ; <nl> - 507B436D1C31FB670067B53E / * RootViewController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35D9718CEE5D100F37B72 / * RootViewController . mm * / ; } ; <nl> - 507B436E1C31FB670067B53E / * lua_assetsmanager_test_sample . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 1AC35D7F18CEE5B100F37B72 / * lua_assetsmanager_test_sample . cpp * / ; } ; <nl> - 507B43701C31FB670067B53E / * Security . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 52B47A331A534B2B004E4C60 / * Security . framework * / ; } ; <nl> - 507B43731C31FB670067B53E / * MediaPlayer . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 3EA0FB65191B933000B170C8 / * MediaPlayer . framework * / ; } ; <nl> - 507B43741C31FB670067B53E / * libz . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3AF18CDA06D0087CE3A / * libz . dylib * / ; } ; <nl> - 507B43751C31FB670067B53E / * CoreMotion . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = D60AE43317F7FFE100757E4B / * CoreMotion . framework * / ; } ; <nl> - 507B43761C31FB670067B53E / * AudioToolbox . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A818CD9F130087CE3A / * AudioToolbox . framework * / ; } ; <nl> - 507B43771C31FB670067B53E / * OpenAL . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A618CD9F0D0087CE3A / * OpenAL . framework * / ; } ; <nl> - 507B43781C31FB670067B53E / * QuartzCore . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A418CD9F060087CE3A / * QuartzCore . framework * / ; } ; <nl> - 507B43791C31FB670067B53E / * libiconv . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = ED545A721B68A1AC00C3958E / * libiconv . dylib * / ; } ; <nl> - 507B437A1C31FB670067B53E / * CoreGraphics . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A218CD9EFE0087CE3A / * CoreGraphics . framework * / ; } ; <nl> - 507B437B1C31FB670067B53E / * OpenGLES . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA3A018CD9EF60087CE3A / * OpenGLES . framework * / ; } ; <nl> - 507B437C1C31FB670067B53E / * UIKit . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA39E18CD9EE50087CE3A / * UIKit . framework * / ; } ; <nl> - 507B437D1C31FB670067B53E / * AVFoundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA39C18CD9ED80087CE3A / * AVFoundation . framework * / ; } ; <nl> - 507B437E1C31FB670067B53E / * Foundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64832165F3AFD007D4F18 / * Foundation . framework * / ; } ; <nl> - 507B43811C31FB670067B53E / * NavMesh in Resources * / = { isa = PBXBuildFile ; fileRef = B61E90CA1B12B74B00BE69EA / * NavMesh * / ; } ; <nl> - 507B43821C31FB670067B53E / * Materials in Resources * / = { isa = PBXBuildFile ; fileRef = 5046AB5A1AF2C4180060550B / * Materials * / ; } ; <nl> - 507B43831C31FB670067B53E / * Shaders3D in Resources * / = { isa = PBXBuildFile ; fileRef = B2507B6A192589AF00FA4972 / * Shaders3D * / ; } ; <nl> - 507B43841C31FB670067B53E / * Test . html in Resources * / = { isa = PBXBuildFile ; fileRef = 29AFEF6619ACCAA000F6B10A / * Test . html * / ; } ; <nl> - 507B43851C31FB670067B53E / * TerrainTest in Resources * / = { isa = PBXBuildFile ; fileRef = B603F1B31AC8FBFB00A9579C / * TerrainTest * / ; } ; <nl> - 507B43861C31FB670067B53E / * Particle3D in Resources * / = { isa = PBXBuildFile ; fileRef = B63993301A49359F00B07923 / * Particle3D * / ; } ; <nl> - 507B43871C31FB670067B53E / * Manifests in Resources * / = { isa = PBXBuildFile ; fileRef = 15B3709219EE5D1000ABE682 / * Manifests * / ; } ; <nl> - 507B43881C31FB670067B53E / * cocosvideo . mp4 in Resources * / = { isa = PBXBuildFile ; fileRef = 3EA0FB5D191B92F100B170C8 / * cocosvideo . mp4 * / ; } ; <nl> - 507B43891C31FB670067B53E / * ActionTimeline in Resources * / = { isa = PBXBuildFile ; fileRef = 38FA2E75194AECF800FF2BE4 / * ActionTimeline * / ; } ; <nl> - 507B438A1C31FB670067B53E / * Sprite3DTest in Resources * / = { isa = PBXBuildFile ; fileRef = 3E92EA841921A7720094CD21 / * Sprite3DTest * / ; } ; <nl> - 507B438B1C31FB670067B53E / * Misc in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC118CED84500F37B72 / * Misc * / ; } ; <nl> - 507B438C1C31FB670067B53E / * effect1 . wav in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB618CED84500F37B72 / * effect1 . wav * / ; } ; <nl> - 507B438D1C31FB670067B53E / * background . caf in Resources * / = { isa = PBXBuildFile ; fileRef = C08689C018D370C90093E810 / * background . caf * / ; } ; <nl> - 507B438E1C31FB670067B53E / * fonts in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBA18CED84500F37B72 / * fonts * / ; } ; <nl> - 507B438F1C31FB670067B53E / * ccb in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAE18CED84500F37B72 / * ccb * / ; } ; <nl> - 507B43901C31FB670067B53E / * hd in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBC18CED84500F37B72 / * hd * / ; } ; <nl> - 507B43911C31FB670067B53E / * Particles in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC318CED84500F37B72 / * Particles * / ; } ; <nl> - 507B43921C31FB670067B53E / * src in Resources * / = { isa = PBXBuildFile ; fileRef = 182C5CCC1A95D9BA00C30D34 / * src * / ; } ; <nl> - 507B43931C31FB670067B53E / * background . wav in Resources * / = { isa = PBXBuildFile ; fileRef = 3E2BDB0019C5E5D40055CDCD / * background . wav * / ; } ; <nl> - 507B43941C31FB670067B53E / * Icon - 120 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8C18CEE5D100F37B72 / * Icon - 120 . png * / ; } ; <nl> - 507B43951C31FB670067B53E / * Icon - 57 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8F18CEE5D100F37B72 / * Icon - 57 . png * / ; } ; <nl> - 507B43961C31FB670067B53E / * fileLookup . plist in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB918CED84500F37B72 / * fileLookup . plist * / ; } ; <nl> - 507B43971C31FB670067B53E / * background . ogg in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAD18CED84500F37B72 / * background . ogg * / ; } ; <nl> - 507B43981C31FB670067B53E / * Icon - 144 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8D18CEE5D100F37B72 / * Icon - 144 . png * / ; } ; <nl> - 507B43991C31FB670067B53E / * pew - pew - lei . wav in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC418CED84500F37B72 / * pew - pew - lei . wav * / ; } ; <nl> - 507B439A1C31FB670067B53E / * Default - 568h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8818CEE5D100F37B72 / * Default - 568h @ 2x . png * / ; } ; <nl> - 507B439B1C31FB670067B53E / * Default - 667h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F4219EFAE13000A1F82 / * Default - 667h @ 2x . png * / ; } ; <nl> - 507B439C1C31FB670067B53E / * Default @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8A18CEE5D100F37B72 / * Default @ 2x . png * / ; } ; <nl> - 507B439D1C31FB670067B53E / * components in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB318CED84500F37B72 / * components * / ; } ; <nl> - 507B439E1C31FB670067B53E / * zwoptex in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC918CED84500F37B72 / * zwoptex * / ; } ; <nl> - 507B439F1C31FB670067B53E / * CocosBuilderExample . ccbresourcelog in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB018CED84500F37B72 / * CocosBuilderExample . ccbresourcelog * / ; } ; <nl> - 507B43A01C31FB670067B53E / * music . mid in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC218CED84500F37B72 / * music . mid * / ; } ; <nl> - 507B43A11C31FB670067B53E / * Default - 736h @ 3x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F4319EFAE13000A1F82 / * Default - 736h @ 3x . png * / ; } ; <nl> - 507B43A21C31FB670067B53E / * extensions in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB818CED84500F37B72 / * extensions * / ; } ; <nl> - 507B43A31C31FB670067B53E / * Images in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBE18CED84500F37B72 / * Images * / ; } ; <nl> - 507B43A41C31FB670067B53E / * effect2 . ogg in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB718CED84500F37B72 / * effect2 . ogg * / ; } ; <nl> - 507B43A51C31FB670067B53E / * audio in Resources * / = { isa = PBXBuildFile ; fileRef = 3E2BDAD119BEA3E20055CDCD / * audio * / ; } ; <nl> - 507B43A61C31FB670067B53E / * CocosBuilderExample . ccbproj in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAF18CED84500F37B72 / * CocosBuilderExample . ccbproj * / ; } ; <nl> - 507B43A71C31FB670067B53E / * animations in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CA918CED84500F37B72 / * animations * / ; } ; <nl> - 507B43A81C31FB670067B53E / * ccs - res in Resources * / = { isa = PBXBuildFile ; fileRef = 1A221C9B191771E300FD2BE4 / * ccs - res * / ; } ; <nl> - 507B43A91C31FB670067B53E / * Icon - 72 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D9018CEE5D100F37B72 / * Icon - 72 . png * / ; } ; <nl> - 507B43AA1C31FB670067B53E / * Icon - 76 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D9118CEE5D100F37B72 / * Icon - 76 . png * / ; } ; <nl> - 507B43AB1C31FB670067B53E / * effect1 . raw in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB518CED84500F37B72 / * effect1 . raw * / ; } ; <nl> - 507B43AC1C31FB670067B53E / * Shaders in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC618CED84500F37B72 / * Shaders * / ; } ; <nl> - 507B43AD1C31FB670067B53E / * configs in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CB418CED84500F37B72 / * configs * / ; } ; <nl> - 507B43AE1C31FB670067B53E / * spine in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC718CED84500F37B72 / * spine * / ; } ; <nl> - 507B43AF1C31FB670067B53E / * TileMaps in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CC818CED84500F37B72 / * TileMaps * / ; } ; <nl> - 507B43B01C31FB670067B53E / * Hello . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CBD18CED84500F37B72 / * Hello . png * / ; } ; <nl> - 507B43B11C31FB670067B53E / * cocosbuilderRes in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D7818CEE59900F37B72 / * cocosbuilderRes * / ; } ; <nl> - 507B43B21C31FB670067B53E / * Icon - 114 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8B18CEE5D100F37B72 / * Icon - 114 . png * / ; } ; <nl> - 507B43B31C31FB670067B53E / * Icon - 152 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8E18CEE5D100F37B72 / * Icon - 152 . png * / ; } ; <nl> - 507B43B41C31FB670067B53E / * background . mp3 in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35CAC18CED84500F37B72 / * background . mp3 * / ; } ; <nl> - 507B43B51C31FB670067B53E / * Default . png in Resources * / = { isa = PBXBuildFile ; fileRef = 1AC35D8918CEE5D100F37B72 / * Default . png * / ; } ; <nl> - 507B43BF1C31FB920067B53E / * libcocos2d tvOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 507B42111C31BEA70067B53E / * libcocos2d tvOS . a * / ; } ; <nl> - 507B43C01C31FB920067B53E / * libluacocos2d tvOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 507B43571C31FB350067B53E / * libluacocos2d tvOS . a * / ; } ; <nl> - 507B43C71C3201360067B53E / * ipadhd in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6177F21960FEFE00DE83F5 / * ipadhd * / ; } ; <nl> - 507B43C81C3201360067B53E / * Icon - 152 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E61960FA6300DE83F5 / * Icon - 152 . png * / ; } ; <nl> - 507B43C91C3201360067B53E / * Icon - 80 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176EC1960FA6300DE83F5 / * Icon - 80 . png * / ; } ; <nl> - 507B43CA1C3201360067B53E / * Default . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E01960FA6300DE83F5 / * Default . png * / ; } ; <nl> - 507B43CB1C3201360067B53E / * iphone in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6177F31960FEFE00DE83F5 / * iphone * / ; } ; <nl> - 507B43CC1C3201360067B53E / * Icon - 57 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E81960FA6300DE83F5 / * Icon - 57 . png * / ; } ; <nl> - 507B43CD1C3201360067B53E / * ipad in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6177F11960FEFE00DE83F5 / * ipad * / ; } ; <nl> - 507B43CE1C3201360067B53E / * Default - 736h @ 3x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F3B19EFACBB000A1F82 / * Default - 736h @ 3x . png * / ; } ; <nl> - 507B43CF1C3201360067B53E / * Default - 667h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F3A19EFACBB000A1F82 / * Default - 667h @ 2x . png * / ; } ; <nl> - 507B43D01C3201360067B53E / * Default - 568h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176DF1960FA6300DE83F5 / * Default - 568h @ 2x . png * / ; } ; <nl> - 507B43D11C3201360067B53E / * Default @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E11960FA6300DE83F5 / * Default @ 2x . png * / ; } ; <nl> - 507B43D21C3201360067B53E / * Icon - 100 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E21960FA6300DE83F5 / * Icon - 100 . png * / ; } ; <nl> - 507B43D31C3201360067B53E / * Icon - 40 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E71960FA6300DE83F5 / * Icon - 40 . png * / ; } ; <nl> - 507B43D41C3201360067B53E / * Icon - 144 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E51960FA6300DE83F5 / * Icon - 144 . png * / ; } ; <nl> - 507B43D51C3201360067B53E / * Icon - 114 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E31960FA6300DE83F5 / * Icon - 114 . png * / ; } ; <nl> - 507B43D61C3201360067B53E / * Icon - 76 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176EB1960FA6300DE83F5 / * Icon - 76 . png * / ; } ; <nl> - 507B43D71C3201360067B53E / * Icon - 120 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E41960FA6300DE83F5 / * Icon - 120 . png * / ; } ; <nl> - 507B43D81C3201360067B53E / * Icon - 72 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176EA1960FA6300DE83F5 / * Icon - 72 . png * / ; } ; <nl> - 507B43D91C3201360067B53E / * fonts in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6177F01960FEFE00DE83F5 / * fonts * / ; } ; <nl> - 507B43DA1C3201360067B53E / * Icon - 58 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 3E6176E91960FA6300DE83F5 / * Icon - 58 . png * / ; } ; <nl> - 507B43DC1C3201360067B53E / * AppController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 3E6176DE1960FA6300DE83F5 / * AppController . mm * / ; } ; <nl> - 507B43DD1C3201360067B53E / * RootViewController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 3E6176F01960FA6300DE83F5 / * RootViewController . mm * / ; } ; <nl> - 507B43DE1C3201360067B53E / * AppDelegate . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3E6176B71960FA6300DE83F5 / * AppDelegate . cpp * / ; } ; <nl> - 507B43DF1C3201360067B53E / * main . m in Sources * / = { isa = PBXBuildFile ; fileRef = 3E6176EE1960FA6300DE83F5 / * main . m * / ; } ; <nl> - 507B43E01C3201360067B53E / * GameControllerTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 3E6176BA1960FA6300DE83F5 / * GameControllerTest . cpp * / ; } ; <nl> - 507B43E21C3201360067B53E / * GameController . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 3E61773C1960FBD100DE83F5 / * GameController . framework * / ; } ; <nl> - 507B43E41C3201360067B53E / * CoreMotion . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = D60AE43317F7FFE100757E4B / * CoreMotion . framework * / ; } ; <nl> - 507B43E51C3201360067B53E / * libiconv . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = ED545A721B68A1AC00C3958E / * libiconv . dylib * / ; } ; <nl> - 507B43E61C3201360067B53E / * libz . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C6482E165F399D007D4F18 / * libz . dylib * / ; } ; <nl> - 507B43E71C3201360067B53E / * Foundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64832165F3AFD007D4F18 / * Foundation . framework * / ; } ; <nl> - 507B43E81C3201360067B53E / * AudioToolbox . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C6482C165F3988007D4F18 / * AudioToolbox . framework * / ; } ; <nl> - 507B43E91C3201360067B53E / * OpenAL . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64828165F396B007D4F18 / * OpenAL . framework * / ; } ; <nl> - 507B43EA1C3201360067B53E / * QuartzCore . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 15C64826165F394E007D4F18 / * QuartzCore . framework * / ; } ; <nl> - 507B43EB1C3201360067B53E / * CoreGraphics . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52BB1783AEB80073F6A7 / * CoreGraphics . framework * / ; } ; <nl> - 507B43EC1C3201360067B53E / * OpenGLES . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52B91783AE900073F6A7 / * OpenGLES . framework * / ; } ; <nl> - 507B43ED1C3201360067B53E / * UIKit . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52B71783AE6D0073F6A7 / * UIKit . framework * / ; } ; <nl> - 507B43EE1C3201360067B53E / * AVFoundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = A07A52C11783B01F0073F6A7 / * AVFoundation . framework * / ; } ; <nl> - 507B43F61C3201780067B53E / * libcocos2d tvOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 507B42111C31BEA70067B53E / * libcocos2d tvOS . a * / ; } ; <nl> + 507E015C1C24E50300839198 / * main . js in Resources * / = { isa = PBXBuildFile ; fileRef = 507E00B71C24E50300839198 / * main . js * / ; } ; <nl> + 507E015D1C24E50300839198 / * AppDelegate . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 507E00BA1C24E50300839198 / * AppDelegate . cpp * / ; } ; <nl> + 507E01971C24E50300839198 / * InfoPlist . strings in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01161C24E50300839198 / * InfoPlist . strings * / ; } ; <nl> + 507E01981C24E50300839198 / * MainMenu . xib in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01181C24E50300839198 / * MainMenu . xib * / ; } ; <nl> + 507E01991C24E50300839198 / * Icon . icns in Resources * / = { isa = PBXBuildFile ; fileRef = 507E011A1C24E50300839198 / * Icon . icns * / ; } ; <nl> + 507E019A1C24E50300839198 / * main . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 507E011B1C24E50300839198 / * main . cpp * / ; } ; <nl> + 507E01B91C24E50300839198 / * project . json in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01471C24E50300839198 / * project . json * / ; } ; <nl> + 507E01CC1C24E51900839198 / * res in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01CA1C24E51900839198 / * res * / ; } ; <nl> + 507E01CD1C24E51900839198 / * src in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01CB1C24E51900839198 / * src * / ; } ; <nl> + 507E01CF1C24E52E00839198 / * script in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01CE1C24E52E00839198 / * script * / ; } ; <nl> + 507EE8581C24C94600839198 / * libsqlite3 . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = A035A71117822E9E00987F6C / * libsqlite3 . dylib * / ; } ; <nl> + 507EE8591C24C94600839198 / * AppKit . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA28918CD91510087CE3A / * AppKit . framework * / ; } ; <nl> + 507EE85A1C24C94600839198 / * Cocoa . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 185664921B424694009EF2AE / * Cocoa . framework * / ; } ; <nl> + 507EE85B1C24C94600839198 / * libcurl . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1A9F808C177E98A600D9A1CB / * libcurl . dylib * / ; } ; <nl> + 507EE85C1C24C94600839198 / * libjscocos2d Mac . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1856630E1B41511B009EF2AE / * libjscocos2d Mac . a * / ; } ; <nl> + 507EE85D1C24C94600839198 / * Security . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 826294421AAF071500CB7CF7 / * Security . framework * / ; } ; <nl> + 507EE85E1C24C94600839198 / * libiconv . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = ED545A6C1B68A18300C3958E / * libiconv . dylib * / ; } ; <nl> + 507EE85F1C24C94600839198 / * libcocos2d Mac . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 46A15FB01807A4F9005B8026 / * libcocos2d Mac . a * / ; } ; <nl> + 507EE8601C24C94600839198 / * libz . dylib in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA36018CD9AC00087CE3A / * libz . dylib * / ; } ; <nl> + 507EE8611C24C94600839198 / * IOKit . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = EDCC747E17C455FD007B692C / * IOKit . framework * / ; } ; <nl> + 507EE8621C24C94600839198 / * Foundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA28B18CD91510087CE3A / * Foundation . framework * / ; } ; <nl> + 507EE8631C24C94600839198 / * AudioToolbox . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA35C18CD9A9E0087CE3A / * AudioToolbox . framework * / ; } ; <nl> + 507EE8641C24C94600839198 / * ApplicationServices . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA35A18CD9A950087CE3A / * ApplicationServices . framework * / ; } ; <nl> + 507EE8651C24C94600839198 / * OpenAL . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA35818CD9A8F0087CE3A / * OpenAL . framework * / ; } ; <nl> + 507EE8661C24C94600839198 / * QuartzCore . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA35618CD9A890087CE3A / * QuartzCore . framework * / ; } ; <nl> + 507EE8671C24C94600839198 / * OpenGL . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 1ABCA35418CD9A820087CE3A / * OpenGL . framework * / ; } ; <nl> 50921EAF1B746D5F00C085CC / * DownloaderTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 50921EAD1B746D5F00C085CC / * DownloaderTest . cpp * / ; } ; <nl> 50921EB01B746D5F00C085CC / * DownloaderTest . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 50921EAD1B746D5F00C085CC / * DownloaderTest . cpp * / ; } ; <nl> + 50AC0E761C2A3CAA0065A4C7 / * AppDelegate . cpp in Sources * / = { isa = PBXBuildFile ; fileRef = 507E00BA1C24E50300839198 / * AppDelegate . cpp * / ; } ; <nl> + 50AC0E8A1C2A3CAA0065A4C7 / * script in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01CE1C24E52E00839198 / * script * / ; } ; <nl> + 50AC0E8B1C2A3CAA0065A4C7 / * project . json in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01471C24E50300839198 / * project . json * / ; } ; <nl> + 50AC0E8E1C2A3CAA0065A4C7 / * src in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01CB1C24E51900839198 / * src * / ; } ; <nl> + 50AC0E8F1C2A3CAA0065A4C7 / * res in Resources * / = { isa = PBXBuildFile ; fileRef = 507E01CA1C24E51900839198 / * res * / ; } ; <nl> + 50AC0E901C2A3CAA0065A4C7 / * main . js in Resources * / = { isa = PBXBuildFile ; fileRef = 507E00B71C24E50300839198 / * main . js * / ; } ; <nl> + 50AC0E961C2A3EE90065A4C7 / * libcocos2d iOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 46A15FBE1807A4F9005B8026 / * libcocos2d iOS . a * / ; } ; <nl> + 50AC0E971C2A3EE90065A4C7 / * libjscocos2d iOS . a in Frameworks * / = { isa = PBXBuildFile ; fileRef = 185663101B41511B009EF2AE / * libjscocos2d iOS . a * / ; } ; <nl> + 50AC0E9A1C2A3EE90065A4C7 / * AVFoundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0E981C2A3EE90065A4C7 / * AVFoundation . framework * / ; } ; <nl> + 50AC0E9B1C2A3EE90065A4C7 / * UIKit . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0E991C2A3EE90065A4C7 / * UIKit . framework * / ; } ; <nl> + 50AC0E9D1C2A3EFD0065A4C7 / * Foundation . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0E9C1C2A3EFD0065A4C7 / * Foundation . framework * / ; } ; <nl> + 50AC0E9F1C2A3F070065A4C7 / * OpenGLES . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0E9E1C2A3F070065A4C7 / * OpenGLES . framework * / ; } ; <nl> + 50AC0EA11C2A3F190065A4C7 / * AudioToolbox . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0EA01C2A3F190065A4C7 / * AudioToolbox . framework * / ; } ; <nl> + 50AC0EA31C2A3F2A0065A4C7 / * Security . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0EA21C2A3F2A0065A4C7 / * Security . framework * / ; } ; <nl> + 50AC0EA51C2A3F350065A4C7 / * MediaPlayer . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0EA41C2A3F350065A4C7 / * MediaPlayer . framework * / ; } ; <nl> + 50AC0EA71C2A3F450065A4C7 / * QuartzCore . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0EA61C2A3F450065A4C7 / * QuartzCore . framework * / ; } ; <nl> + 50AC0EBD1C2A3FCC0065A4C7 / * AppController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 50AC0EAB1C2A3FCC0065A4C7 / * AppController . mm * / ; } ; <nl> + 50AC0EBE1C2A3FCC0065A4C7 / * Default - 568h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EAC1C2A3FCC0065A4C7 / * Default - 568h @ 2x . png * / ; } ; <nl> + 50AC0EBF1C2A3FCC0065A4C7 / * Default . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EAD1C2A3FCC0065A4C7 / * Default . png * / ; } ; <nl> + 50AC0EC01C2A3FCC0065A4C7 / * Default @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EAE1C2A3FCC0065A4C7 / * Default @ 2x . png * / ; } ; <nl> + 50AC0EC11C2A3FCC0065A4C7 / * Icon - 114 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EAF1C2A3FCC0065A4C7 / * Icon - 114 . png * / ; } ; <nl> + 50AC0EC21C2A3FCC0065A4C7 / * Icon - 120 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB01C2A3FCC0065A4C7 / * Icon - 120 . png * / ; } ; <nl> + 50AC0EC31C2A3FCC0065A4C7 / * Icon - 144 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB11C2A3FCC0065A4C7 / * Icon - 144 . png * / ; } ; <nl> + 50AC0EC41C2A3FCC0065A4C7 / * Icon - 152 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB21C2A3FCC0065A4C7 / * Icon - 152 . png * / ; } ; <nl> + 50AC0EC51C2A3FCC0065A4C7 / * Icon - 57 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB31C2A3FCC0065A4C7 / * Icon - 57 . png * / ; } ; <nl> + 50AC0EC61C2A3FCC0065A4C7 / * Icon - 72 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB41C2A3FCC0065A4C7 / * Icon - 72 . png * / ; } ; <nl> + 50AC0EC71C2A3FCC0065A4C7 / * Icon - 76 . png in Resources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB51C2A3FCC0065A4C7 / * Icon - 76 . png * / ; } ; <nl> + 50AC0EC91C2A3FCC0065A4C7 / * main . m in Sources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB71C2A3FCC0065A4C7 / * main . m * / ; } ; <nl> + 50AC0ECA1C2A3FCC0065A4C7 / * NativeOcClass . m in Sources * / = { isa = PBXBuildFile ; fileRef = 50AC0EB91C2A3FCC0065A4C7 / * NativeOcClass . m * / ; } ; <nl> + 50AC0ECB1C2A3FCC0065A4C7 / * RootViewController . mm in Sources * / = { isa = PBXBuildFile ; fileRef = 50AC0EBC1C2A3FCC0065A4C7 / * RootViewController . mm * / ; } ; <nl> + 50AC0ECD1C2A435C0065A4C7 / * libsqlite3 . tbd in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0ECC1C2A435C0065A4C7 / * libsqlite3 . tbd * / ; } ; <nl> + 50AC0ECF1C2A436E0065A4C7 / * libz . tbd in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0ECE1C2A436E0065A4C7 / * libz . tbd * / ; } ; <nl> + 50AC0ED11C2A437B0065A4C7 / * libiconv . tbd in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0ED01C2A437B0065A4C7 / * libiconv . tbd * / ; } ; <nl> + 50AC0ED31C2A44280065A4C7 / * OpenAL . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0ED21C2A44280065A4C7 / * OpenAL . framework * / ; } ; <nl> + 50AC0ED51C2A44790065A4C7 / * CoreMotion . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0ED41C2A44790065A4C7 / * CoreMotion . framework * / ; } ; <nl> + 50AC0ED71C2A449F0065A4C7 / * CoreGraphics . framework in Frameworks * / = { isa = PBXBuildFile ; fileRef = 50AC0ED61C2A449F0065A4C7 / * CoreGraphics . framework * / ; } ; <nl> 527B1F3019EF9819000A1F82 / * Default - 667h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F2E19EF9819000A1F82 / * Default - 667h @ 2x . png * / ; } ; <nl> 527B1F3119EF9819000A1F82 / * Default - 736h @ 3x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F2F19EF9819000A1F82 / * Default - 736h @ 3x . png * / ; } ; <nl> 527B1F3419EF9CF8000A1F82 / * Default - 667h @ 2x . png in Resources * / = { isa = PBXBuildFile ; fileRef = 527B1F3219EF9CF8000A1F82 / * Default - 667h @ 2x . png * / ; } ; <nl> <nl> remoteGlobalIDString = A07A4D641783777C0073F6A7 ; <nl> remoteInfo = " cocos2dx iOS " ; <nl> } ; <nl> - 507B42101C31BEA70067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 46A15F9C1807A4F8005B8026 / * cocos2d_libs . xcodeproj * / ; <nl> - proxyType = 2 ; <nl> - remoteGlobalIDString = 507B40FD1C31BDD30067B53E ; <nl> - remoteInfo = " libcocos2d tvOS " ; <nl> - } ; <nl> - 507B42B31C31E6080067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 185663081B41511B009EF2AE / * cocos2d_js_bindings . xcodeproj * / ; <nl> - proxyType = 2 ; <nl> - remoteGlobalIDString = 507B427D1C31DCC60067B53E ; <nl> - remoteInfo = " libjscocos2d tvOS " ; <nl> - } ; <nl> - 507B42B51C31E6210067B53E / * PBXContainerItemProxy * / = { <nl> + 507EE84D1C24C94600839198 / * PBXContainerItemProxy * / = { <nl> isa = PBXContainerItemProxy ; <nl> containerPortal = 185663081B41511B009EF2AE / * cocos2d_js_bindings . xcodeproj * / ; <nl> proxyType = 1 ; <nl> - remoteGlobalIDString = 507B42131C31DCC60067B53E ; <nl> - remoteInfo = " libjscocos2d tvOS " ; <nl> - } ; <nl> - 507B42B71C31E6210067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 46A15F9C1807A4F8005B8026 / * cocos2d_libs . xcodeproj * / ; <nl> - proxyType = 1 ; <nl> - remoteGlobalIDString = 507B39BF1C31BDD30067B53E ; <nl> - remoteInfo = " libcocos2d tvOS " ; <nl> - } ; <nl> - 507B43561C31FB350067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 1ABCA27618CD90A40087CE3A / * cocos2d_lua_bindings . xcodeproj * / ; <nl> - proxyType = 2 ; <nl> - remoteGlobalIDString = 507B43531C31FA0C0067B53E ; <nl> - remoteInfo = " libluacocos2d tvOS " ; <nl> - } ; <nl> - 507B435B1C31FB510067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 29B97313FDCFA39411CA2CEA / * Project object * / ; <nl> - proxyType = 1 ; <nl> - remoteGlobalIDString = 507B40FE1C31BEA60067B53E ; <nl> - remoteInfo = " cpp - tests tvOS " ; <nl> - } ; <nl> - 507B435D1C31FB510067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 29B97313FDCFA39411CA2CEA / * Project object * / ; <nl> - proxyType = 1 ; <nl> - remoteGlobalIDString = 507B427E1C31E6070067B53E ; <nl> - remoteInfo = " js - tests tvOS " ; <nl> - } ; <nl> - 507B435F1C31FB5E0067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 46A15F9C1807A4F8005B8026 / * cocos2d_libs . xcodeproj * / ; <nl> - proxyType = 1 ; <nl> - remoteGlobalIDString = 507B39BF1C31BDD30067B53E ; <nl> - remoteInfo = " libcocos2d tvOS " ; <nl> + remoteGlobalIDString = A03F31E81781479B006731B9 ; <nl> + remoteInfo = " libjscocos2d Mac " ; <nl> } ; <nl> - 507B43BB1C31FB850067B53E / * PBXContainerItemProxy * / = { <nl> + 507EE84F1C24C94600839198 / * PBXContainerItemProxy * / = { <nl> isa = PBXContainerItemProxy ; <nl> containerPortal = 46A15F9C1807A4F8005B8026 / * cocos2d_libs . xcodeproj * / ; <nl> proxyType = 1 ; <nl> - remoteGlobalIDString = 507B39BF1C31BDD30067B53E ; <nl> - remoteInfo = " libcocos2d tvOS " ; <nl> - } ; <nl> - 507B43BD1C31FB850067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 1ABCA27618CD90A40087CE3A / * cocos2d_lua_bindings . xcodeproj * / ; <nl> - proxyType = 1 ; <nl> - remoteGlobalIDString = 507B42BB1C31FA0C0067B53E ; <nl> - remoteInfo = " libluacocos2d tvOS " ; <nl> - } ; <nl> - 507B43C11C31FC160067B53E / * PBXContainerItemProxy * / = { <nl> - isa = PBXContainerItemProxy ; <nl> - containerPortal = 29B97313FDCFA39411CA2CEA / * Project object * / ; <nl> - proxyType = 1 ; <nl> - remoteGlobalIDString = 507B43611C31FB670067B53E ; <nl> - remoteInfo = " lua - tests tvOS " ; <nl> + remoteGlobalIDString = 1551A33E158F2AB200E66CFE ; <nl> + remoteInfo = " cocos2dx Mac " ; <nl> } ; <nl> - 507B43F41C3201580067B53E / * PBXContainerItemProxy * / = { <nl> + 50AC0E701C2A3CAA0065A4C7 / * PBXContainerItemProxy * / = { <nl> isa = PBXContainerItemProxy ; <nl> - containerPortal = 29B97313FDCFA39411CA2CEA / * Project object * / ; <nl> + containerPortal = 185663081B41511B009EF2AE / * cocos2d_js_bindings . xcodeproj * / ; <nl> proxyType = 1 ; <nl> - remoteGlobalIDString = 507B43C31C3201360067B53E ; <nl> - remoteInfo = " game - controller - test tvOS " ; <nl> + remoteGlobalIDString = A03F31E81781479B006731B9 ; <nl> + remoteInfo = " libjscocos2d Mac " ; <nl> } ; <nl> - 507B43F71C3202300067B53E / * PBXContainerItemProxy * / = { <nl> + 50AC0E721C2A3CAA0065A4C7 / * PBXContainerItemProxy * / = { <nl> isa = PBXContainerItemProxy ; <nl> containerPortal = 46A15F9C1807A4F8005B8026 / * cocos2d_libs . xcodeproj * / ; <nl> proxyType = 1 ; <nl> - remoteGlobalIDString = 507B39BF1C31BDD30067B53E ; <nl> - remoteInfo = " libcocos2d tvOS " ; <nl> + remoteGlobalIDString = 1551A33E158F2AB200E66CFE ; <nl> + remoteInfo = " cocos2dx Mac " ; <nl> } ; <nl> A035ACBF178246BD00987F6C / * PBXContainerItemProxy * / = { <nl> isa = PBXContainerItemProxy ; <nl> <nl> 5046AB481AF2A8D80060550B / * MaterialSystemTest . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = MaterialSystemTest . cpp ; sourceTree = " < group > " ; } ; <nl> 5046AB491AF2A8D80060550B / * MaterialSystemTest . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = MaterialSystemTest . h ; sourceTree = " < group > " ; } ; <nl> 5046AB5A1AF2C4180060550B / * Materials * / = { isa = PBXFileReference ; lastKnownFileType = folder ; name = Materials ; path = " . . / tests / cpp - tests / Resources / Materials " ; sourceTree = " < group > " ; } ; <nl> - 507B420D1C31BEA60067B53E / * cpp - tests tvOS . app * / = { isa = PBXFileReference ; explicitFileType = wrapper . application ; includeInIndex = 0 ; path = " cpp - tests tvOS . app " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> - 507B42B01C31E6070067B53E / * js - tests tvOS . app * / = { isa = PBXFileReference ; explicitFileType = wrapper . application ; includeInIndex = 0 ; path = " js - tests tvOS . app " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> - 507B43B91C31FB670067B53E / * lua - tests tvOS . app * / = { isa = PBXFileReference ; explicitFileType = wrapper . application ; includeInIndex = 0 ; path = " lua - tests tvOS . app " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> - 507B43F21C3201360067B53E / * game - controller - test tvOS . app * / = { isa = PBXFileReference ; explicitFileType = wrapper . application ; includeInIndex = 0 ; path = " game - controller - test tvOS . app " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> + 507E00B71C24E50300839198 / * main . js * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . javascript ; path = main . js ; sourceTree = " < group > " ; } ; <nl> + 507E00BA1C24E50300839198 / * AppDelegate . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = AppDelegate . cpp ; sourceTree = " < group > " ; } ; <nl> + 507E00BB1C24E50300839198 / * AppDelegate . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = AppDelegate . h ; sourceTree = " < group > " ; } ; <nl> + 507E01171C24E50300839198 / * en * / = { isa = PBXFileReference ; lastKnownFileType = text . plist . strings ; name = en ; path = en . lproj / InfoPlist . strings ; sourceTree = " < group > " ; } ; <nl> + 507E01191C24E50300839198 / * en * / = { isa = PBXFileReference ; lastKnownFileType = file . xib ; name = en ; path = en . lproj / MainMenu . xib ; sourceTree = " < group > " ; } ; <nl> + 507E011A1C24E50300839198 / * Icon . icns * / = { isa = PBXFileReference ; lastKnownFileType = image . icns ; path = Icon . icns ; sourceTree = " < group > " ; } ; <nl> + 507E011B1C24E50300839198 / * main . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = main . cpp ; sourceTree = " < group > " ; } ; <nl> + 507E011C1C24E50300839198 / * Test_Info . plist * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = text . plist . xml ; path = Test_Info . plist ; sourceTree = " < group > " ; } ; <nl> + 507E011D1C24E50300839198 / * Test_Prefix . pch * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = Test_Prefix . pch ; sourceTree = " < group > " ; } ; <nl> + 507E01471C24E50300839198 / * project . json * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = text . json ; path = project . json ; sourceTree = " < group > " ; } ; <nl> + 507E01CA1C24E51900839198 / * res * / = { isa = PBXFileReference ; lastKnownFileType = folder ; path = res ; sourceTree = " < group > " ; } ; <nl> + 507E01CB1C24E51900839198 / * src * / = { isa = PBXFileReference ; lastKnownFileType = folder ; path = src ; sourceTree = " < group > " ; } ; <nl> + 507E01CE1C24E52E00839198 / * script * / = { isa = PBXFileReference ; lastKnownFileType = folder ; name = script ; path = " . . / . . / cocos / scripting / js - bindings / script " ; sourceTree = " < group > " ; } ; <nl> + 507EE8741C24C94600839198 / * js - tests - memory - gc Mac . app * / = { isa = PBXFileReference ; explicitFileType = wrapper . application ; includeInIndex = 0 ; path = " js - tests - memory - gc Mac . app " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> 50921EAD1B746D5F00C085CC / * DownloaderTest . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = DownloaderTest . cpp ; sourceTree = " < group > " ; } ; <nl> 50921EAE1B746D5F00C085CC / * DownloaderTest . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = DownloaderTest . h ; sourceTree = " < group > " ; } ; <nl> + 50AC0E941C2A3CAA0065A4C7 / * js - tests - memory - gc iOS . app * / = { isa = PBXFileReference ; explicitFileType = wrapper . application ; includeInIndex = 0 ; path = " js - tests - memory - gc iOS . app " ; sourceTree = BUILT_PRODUCTS_DIR ; } ; <nl> + 50AC0E981C2A3EE90065A4C7 / * AVFoundation . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = AVFoundation . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / AVFoundation . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0E991C2A3EE90065A4C7 / * UIKit . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = UIKit . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / UIKit . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0E9C1C2A3EFD0065A4C7 / * Foundation . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = Foundation . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / Foundation . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0E9E1C2A3F070065A4C7 / * OpenGLES . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = OpenGLES . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / OpenGLES . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0EA01C2A3F190065A4C7 / * AudioToolbox . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = AudioToolbox . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / AudioToolbox . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0EA21C2A3F2A0065A4C7 / * Security . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = Security . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / Security . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0EA41C2A3F350065A4C7 / * MediaPlayer . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = MediaPlayer . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / MediaPlayer . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0EA61C2A3F450065A4C7 / * QuartzCore . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = QuartzCore . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / QuartzCore . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0EAA1C2A3FCC0065A4C7 / * AppController . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = AppController . h ; sourceTree = " < group > " ; } ; <nl> + 50AC0EAB1C2A3FCC0065A4C7 / * AppController . mm * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . objcpp ; path = AppController . mm ; sourceTree = " < group > " ; } ; <nl> + 50AC0EAC1C2A3FCC0065A4C7 / * Default - 568h @ 2x . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Default - 568h @ 2x . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EAD1C2A3FCC0065A4C7 / * Default . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = Default . png ; sourceTree = " < group > " ; } ; <nl> + 50AC0EAE1C2A3FCC0065A4C7 / * Default @ 2x . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Default @ 2x . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EAF1C2A3FCC0065A4C7 / * Icon - 114 . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Icon - 114 . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB01C2A3FCC0065A4C7 / * Icon - 120 . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Icon - 120 . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB11C2A3FCC0065A4C7 / * Icon - 144 . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Icon - 144 . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB21C2A3FCC0065A4C7 / * Icon - 152 . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Icon - 152 . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB31C2A3FCC0065A4C7 / * Icon - 57 . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Icon - 57 . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB41C2A3FCC0065A4C7 / * Icon - 72 . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Icon - 72 . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB51C2A3FCC0065A4C7 / * Icon - 76 . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Icon - 76 . png " ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB61C2A3FCC0065A4C7 / * Info . plist * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = text . plist . xml ; path = Info . plist ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB71C2A3FCC0065A4C7 / * main . m * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . objc ; path = main . m ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB81C2A3FCC0065A4C7 / * NativeOcClass . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = NativeOcClass . h ; sourceTree = " < group > " ; } ; <nl> + 50AC0EB91C2A3FCC0065A4C7 / * NativeOcClass . m * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . objc ; path = NativeOcClass . m ; sourceTree = " < group > " ; } ; <nl> + 50AC0EBA1C2A3FCC0065A4C7 / * Prefix . pch * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = Prefix . pch ; sourceTree = " < group > " ; } ; <nl> + 50AC0EBB1C2A3FCC0065A4C7 / * RootViewController . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = RootViewController . h ; sourceTree = " < group > " ; } ; <nl> + 50AC0EBC1C2A3FCC0065A4C7 / * RootViewController . mm * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . objcpp ; path = RootViewController . mm ; sourceTree = " < group > " ; } ; <nl> + 50AC0ECC1C2A435C0065A4C7 / * libsqlite3 . tbd * / = { isa = PBXFileReference ; lastKnownFileType = " sourcecode . text - based - dylib - definition " ; name = libsqlite3 . tbd ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / usr / lib / libsqlite3 . tbd ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0ECE1C2A436E0065A4C7 / * libz . tbd * / = { isa = PBXFileReference ; lastKnownFileType = " sourcecode . text - based - dylib - definition " ; name = libz . tbd ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / usr / lib / libz . tbd ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0ED01C2A437B0065A4C7 / * libiconv . tbd * / = { isa = PBXFileReference ; lastKnownFileType = " sourcecode . text - based - dylib - definition " ; name = libiconv . tbd ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / usr / lib / libiconv . tbd ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0ED21C2A44280065A4C7 / * OpenAL . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = OpenAL . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / OpenAL . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0ED41C2A44790065A4C7 / * CoreMotion . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = CoreMotion . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / CoreMotion . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> + 50AC0ED61C2A449F0065A4C7 / * CoreGraphics . framework * / = { isa = PBXFileReference ; lastKnownFileType = wrapper . framework ; name = CoreGraphics . framework ; path = Platforms / iPhoneOS . platform / Developer / SDKs / iPhoneOS9 . 2 . sdk / System / Library / Frameworks / CoreGraphics . framework ; sourceTree = DEVELOPER_DIR ; } ; <nl> 527B1F2E19EF9819000A1F82 / * Default - 667h @ 2x . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Default - 667h @ 2x . png " ; sourceTree = " < group > " ; } ; <nl> 527B1F2F19EF9819000A1F82 / * Default - 736h @ 3x . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Default - 736h @ 3x . png " ; sourceTree = " < group > " ; } ; <nl> 527B1F3219EF9CF8000A1F82 / * Default - 667h @ 2x . png * / = { isa = PBXFileReference ; lastKnownFileType = image . png ; path = " Default - 667h @ 2x . png " ; sourceTree = " < group > " ; } ; <nl> <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> - 507B41FB1C31BEA60067B53E / * Frameworks * / = { <nl> - isa = PBXFrameworksBuildPhase ; <nl> - buildActionMask = 2147483647 ; <nl> - files = ( <nl> - 507B42121C31C1710067B53E / * libcocos2d tvOS . a in Frameworks * / , <nl> - 507B41FC1C31BEA60067B53E / * libiconv . dylib in Frameworks * / , <nl> - 507B41FD1C31BEA60067B53E / * Security . framework in Frameworks * / , <nl> - 507B41FE1C31BEA60067B53E / * MediaPlayer . framework in Frameworks * / , <nl> - 507B42001C31BEA60067B53E / * CoreMotion . framework in Frameworks * / , <nl> - 507B42011C31BEA60067B53E / * libz . dylib in Frameworks * / , <nl> - 507B42021C31BEA60067B53E / * Foundation . framework in Frameworks * / , <nl> - 507B42031C31BEA60067B53E / * AudioToolbox . framework in Frameworks * / , <nl> - 507B42041C31BEA60067B53E / * OpenAL . framework in Frameworks * / , <nl> - 507B42051C31BEA60067B53E / * QuartzCore . framework in Frameworks * / , <nl> - 507B42061C31BEA60067B53E / * CoreGraphics . framework in Frameworks * / , <nl> - 507B42071C31BEA60067B53E / * OpenGLES . framework in Frameworks * / , <nl> - 507B42081C31BEA60067B53E / * UIKit . framework in Frameworks * / , <nl> - 507B42091C31BEA60067B53E / * AVFoundation . framework in Frameworks * / , <nl> - ) ; <nl> - runOnlyForDeploymentPostprocessing = 0 ; <nl> - } ; <nl> - 507B428C1C31E6070067B53E / * Frameworks * / = { <nl> - isa = PBXFrameworksBuildPhase ; <nl> - buildActionMask = 2147483647 ; <nl> - files = ( <nl> - 507B42B91C31EC6A0067B53E / * libcocos2d tvOS . a in Frameworks * / , <nl> - 507B42BA1C31EC6A0067B53E / * libjscocos2d tvOS . a in Frameworks * / , <nl> - 507B428D1C31E6070067B53E / * libsqlite3 . dylib in Frameworks * / , <nl> - 507B428F1C31E6070067B53E / * Security . framework in Frameworks * / , <nl> - 507B42911C31E6070067B53E / * MediaPlayer . framework in Frameworks * / , <nl> - 507B42921C31E6070067B53E / * libz . dylib in Frameworks * / , <nl> - 507B42931C31E6070067B53E / * libiconv . dylib in Frameworks * / , <nl> - 507B42941C31E6070067B53E / * CoreMotion . framework in Frameworks * / , <nl> - 507B42951C31E6070067B53E / * AudioToolbox . framework in Frameworks * / , <nl> - 507B42961C31E6070067B53E / * OpenAL . framework in Frameworks * / , <nl> - 507B42971C31E6070067B53E / * QuartzCore . framework in Frameworks * / , <nl> - 507B42981C31E6070067B53E / * CoreGraphics . framework in Frameworks * / , <nl> - 507B42991C31E6070067B53E / * OpenGLES . framework in Frameworks * / , <nl> - 507B429A1C31E6070067B53E / * UIKit . framework in Frameworks * / , <nl> - 507B429B1C31E6070067B53E / * AVFoundation . framework in Frameworks * / , <nl> - 507B429C1C31E6070067B53E / * Foundation . framework in Frameworks * / , <nl> - ) ; <nl> - runOnlyForDeploymentPostprocessing = 0 ; <nl> - } ; <nl> - 507B436F1C31FB670067B53E / * Frameworks * / = { <nl> + 507EE8571C24C94600839198 / * Frameworks * / = { <nl> isa = PBXFrameworksBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> - 507B43BF1C31FB920067B53E / * libcocos2d tvOS . a in Frameworks * / , <nl> - 507B43C01C31FB920067B53E / * libluacocos2d tvOS . a in Frameworks * / , <nl> - 507B43701C31FB670067B53E / * Security . framework in Frameworks * / , <nl> - 507B43731C31FB670067B53E / * MediaPlayer . framework in Frameworks * / , <nl> - 507B43741C31FB670067B53E / * libz . dylib in Frameworks * / , <nl> - 507B43751C31FB670067B53E / * CoreMotion . framework in Frameworks * / , <nl> - 507B43761C31FB670067B53E / * AudioToolbox . framework in Frameworks * / , <nl> - 507B43771C31FB670067B53E / * OpenAL . framework in Frameworks * / , <nl> - 507B43781C31FB670067B53E / * QuartzCore . framework in Frameworks * / , <nl> - 507B43791C31FB670067B53E / * libiconv . dylib in Frameworks * / , <nl> - 507B437A1C31FB670067B53E / * CoreGraphics . framework in Frameworks * / , <nl> - 507B437B1C31FB670067B53E / * OpenGLES . framework in Frameworks * / , <nl> - 507B437C1C31FB670067B53E / * UIKit . framework in Frameworks * / , <nl> - 507B437D1C31FB670067B53E / * AVFoundation . framework in Frameworks * / , <nl> - 507B437E1C31FB670067B53E / * Foundation . framework in Frameworks * / , <nl> + 507EE8581C24C94600839198 / * libsqlite3 . dylib in Frameworks * / , <nl> + 507EE8591C24C94600839198 / * AppKit . framework in Frameworks * / , <nl> + 507EE85A1C24C94600839198 / * Cocoa . framework in Frameworks * / , <nl> + 507EE85B1C24C94600839198 / * libcurl . dylib in Frameworks * / , <nl> + 507EE85C1C24C94600839198 / * libjscocos2d Mac . a in Frameworks * / , <nl> + 507EE85D1C24C94600839198 / * Security . framework in Frameworks * / , <nl> + 507EE85E1C24C94600839198 / * libiconv . dylib in Frameworks * / , <nl> + 507EE85F1C24C94600839198 / * libcocos2d Mac . a in Frameworks * / , <nl> + 507EE8601C24C94600839198 / * libz . dylib in Frameworks * / , <nl> + 507EE8611C24C94600839198 / * IOKit . framework in Frameworks * / , <nl> + 507EE8621C24C94600839198 / * Foundation . framework in Frameworks * / , <nl> + 507EE8631C24C94600839198 / * AudioToolbox . framework in Frameworks * / , <nl> + 507EE8641C24C94600839198 / * ApplicationServices . framework in Frameworks * / , <nl> + 507EE8651C24C94600839198 / * OpenAL . framework in Frameworks * / , <nl> + 507EE8661C24C94600839198 / * QuartzCore . framework in Frameworks * / , <nl> + 507EE8671C24C94600839198 / * OpenGL . framework in Frameworks * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> - 507B43E11C3201360067B53E / * Frameworks * / = { <nl> + 50AC0E771C2A3CAA0065A4C7 / * Frameworks * / = { <nl> isa = PBXFrameworksBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> - 507B43F61C3201780067B53E / * libcocos2d tvOS . a in Frameworks * / , <nl> - 507B43E21C3201360067B53E / * GameController . framework in Frameworks * / , <nl> - 507B43E41C3201360067B53E / * CoreMotion . framework in Frameworks * / , <nl> - 507B43E51C3201360067B53E / * libiconv . dylib in Frameworks * / , <nl> - 507B43E61C3201360067B53E / * libz . dylib in Frameworks * / , <nl> - 507B43E71C3201360067B53E / * Foundation . framework in Frameworks * / , <nl> - 507B43E81C3201360067B53E / * AudioToolbox . framework in Frameworks * / , <nl> - 507B43E91C3201360067B53E / * OpenAL . framework in Frameworks * / , <nl> - 507B43EA1C3201360067B53E / * QuartzCore . framework in Frameworks * / , <nl> - 507B43EB1C3201360067B53E / * CoreGraphics . framework in Frameworks * / , <nl> - 507B43EC1C3201360067B53E / * OpenGLES . framework in Frameworks * / , <nl> - 507B43ED1C3201360067B53E / * UIKit . framework in Frameworks * / , <nl> - 507B43EE1C3201360067B53E / * AVFoundation . framework in Frameworks * / , <nl> + 50AC0ED71C2A449F0065A4C7 / * CoreGraphics . framework in Frameworks * / , <nl> + 50AC0ED51C2A44790065A4C7 / * CoreMotion . framework in Frameworks * / , <nl> + 50AC0ED31C2A44280065A4C7 / * OpenAL . framework in Frameworks * / , <nl> + 50AC0ED11C2A437B0065A4C7 / * libiconv . tbd in Frameworks * / , <nl> + 50AC0ECF1C2A436E0065A4C7 / * libz . tbd in Frameworks * / , <nl> + 50AC0ECD1C2A435C0065A4C7 / * libsqlite3 . tbd in Frameworks * / , <nl> + 50AC0E9B1C2A3EE90065A4C7 / * UIKit . framework in Frameworks * / , <nl> + 50AC0EA71C2A3F450065A4C7 / * QuartzCore . framework in Frameworks * / , <nl> + 50AC0EA51C2A3F350065A4C7 / * MediaPlayer . framework in Frameworks * / , <nl> + 50AC0EA31C2A3F2A0065A4C7 / * Security . framework in Frameworks * / , <nl> + 50AC0EA11C2A3F190065A4C7 / * AudioToolbox . framework in Frameworks * / , <nl> + 50AC0E9F1C2A3F070065A4C7 / * OpenGLES . framework in Frameworks * / , <nl> + 50AC0E9D1C2A3EFD0065A4C7 / * Foundation . framework in Frameworks * / , <nl> + 50AC0E9A1C2A3EE90065A4C7 / * AVFoundation . framework in Frameworks * / , <nl> + 50AC0E961C2A3EE90065A4C7 / * libcocos2d iOS . a in Frameworks * / , <nl> + 50AC0E971C2A3EE90065A4C7 / * libjscocos2d iOS . a in Frameworks * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> <nl> children = ( <nl> 1856630E1B41511B009EF2AE / * libjscocos2d Mac . a * / , <nl> 185663101B41511B009EF2AE / * libjscocos2d iOS . a * / , <nl> - 507B42B41C31E6080067B53E / * libjscocos2d tvOS . a * / , <nl> ) ; <nl> name = Products ; <nl> sourceTree = " < group > " ; <nl> <nl> 185663411B41553A009EF2AE / * js - tests * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> - 185664541B42364E009EF2AE / * script * / , <nl> 185664001B422F45009EF2AE / * project * / , <nl> + 185663F41B422EA7009EF2AE / * res * / , <nl> + 185664541B42364E009EF2AE / * script * / , <nl> 185663FD1B422EF0009EF2AE / * src * / , <nl> 185663FA1B422EE0009EF2AE / * project . json * / , <nl> 185663F71B422ED6009EF2AE / * main . js * / , <nl> - 185663F41B422EA7009EF2AE / * res * / , <nl> ) ; <nl> name = " js - tests " ; <nl> sourceTree = " < group > " ; <nl> <nl> 185663ED1B4155DD009EF2AE / * js - tests iOS . app * / , <nl> FA94B0B41B8EF69A0074B261 / * performance - tests iOS . app * / , <nl> FA94B1C71B8EF76D0074B261 / * performance - tests Mac . app * / , <nl> - 507B420D1C31BEA60067B53E / * cpp - tests tvOS . app * / , <nl> - 507B42B01C31E6070067B53E / * js - tests tvOS . app * / , <nl> - 507B43B91C31FB670067B53E / * lua - tests tvOS . app * / , <nl> - 507B43F21C3201360067B53E / * game - controller - test tvOS . app * / , <nl> + 507EE8741C24C94600839198 / * js - tests - memory - gc Mac . app * / , <nl> + 50AC0E941C2A3CAA0065A4C7 / * js - tests - memory - gc iOS . app * / , <nl> ) ; <nl> name = Products ; <nl> sourceTree = " < group > " ; <nl> <nl> children = ( <nl> 15EFA258198A4A24000C57D3 / * libluacocos2d Mac . a * / , <nl> 15EFA665198B33EE000C57D3 / * libluacocos2d iOS . a * / , <nl> - 507B43571C31FB350067B53E / * libluacocos2d tvOS . a * / , <nl> ) ; <nl> name = Products ; <nl> sourceTree = " < group > " ; <nl> <nl> 1AC35E0318CEE78300F37B72 / * tests * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 507E00B51C24E50200839198 / * js - memory - gc - tests * / , <nl> 185663411B41553A009EF2AE / * js - tests * / , <nl> 15CBA087196EE66D005877BB / * lua - game - controller - test * / , <nl> 3E6176B51960FA6300DE83F5 / * game - controller - test * / , <nl> <nl> 29B97323FDCFA39411CA2CEA / * Frameworks * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 50AC0ED61C2A449F0065A4C7 / * CoreGraphics . framework * / , <nl> + 50AC0ED41C2A44790065A4C7 / * CoreMotion . framework * / , <nl> + 50AC0ED21C2A44280065A4C7 / * OpenAL . framework * / , <nl> + 50AC0ED01C2A437B0065A4C7 / * libiconv . tbd * / , <nl> + 50AC0ECE1C2A436E0065A4C7 / * libz . tbd * / , <nl> + 50AC0ECC1C2A435C0065A4C7 / * libsqlite3 . tbd * / , <nl> + 50AC0EA61C2A3F450065A4C7 / * QuartzCore . framework * / , <nl> + 50AC0EA41C2A3F350065A4C7 / * MediaPlayer . framework * / , <nl> + 50AC0EA21C2A3F2A0065A4C7 / * Security . framework * / , <nl> + 50AC0EA01C2A3F190065A4C7 / * AudioToolbox . framework * / , <nl> + 50AC0E9E1C2A3F070065A4C7 / * OpenGLES . framework * / , <nl> + 50AC0E9C1C2A3EFD0065A4C7 / * Foundation . framework * / , <nl> + 50AC0E981C2A3EE90065A4C7 / * AVFoundation . framework * / , <nl> + 50AC0E991C2A3EE90065A4C7 / * UIKit . framework * / , <nl> ED545A721B68A1AC00C3958E / * libiconv . dylib * / , <nl> ED545A6C1B68A18300C3958E / * libiconv . dylib * / , <nl> 18FC4D5E1B4257CD00B76F95 / * libsqlite3 . dylib * / , <nl> <nl> children = ( <nl> 46A15FB01807A4F9005B8026 / * libcocos2d Mac . a * / , <nl> 46A15FBE1807A4F9005B8026 / * libcocos2d iOS . a * / , <nl> - 507B42111C31BEA70067B53E / * libcocos2d tvOS . a * / , <nl> ) ; <nl> name = Products ; <nl> sourceTree = " < group > " ; <nl> <nl> path = MaterialSystemTest ; <nl> sourceTree = " < group > " ; <nl> } ; <nl> + 507E00B51C24E50200839198 / * js - memory - gc - tests * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 507E01CE1C24E52E00839198 / * script * / , <nl> + 507E01CA1C24E51900839198 / * res * / , <nl> + 507E01CB1C24E51900839198 / * src * / , <nl> + 507E00B71C24E50300839198 / * main . js * / , <nl> + 507E00B81C24E50300839198 / * project * / , <nl> + 507E01471C24E50300839198 / * project . json * / , <nl> + ) ; <nl> + name = " js - memory - gc - tests " ; <nl> + path = " . . / tests / js - memory - gc - tests " ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> + 507E00B81C24E50300839198 / * project * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 50AC0EA91C2A3FCC0065A4C7 / * proj . ios * / , <nl> + 507E00B91C24E50300839198 / * Classes * / , <nl> + 507E01151C24E50300839198 / * proj . mac * / , <nl> + ) ; <nl> + path = project ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> + 507E00B91C24E50300839198 / * Classes * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 507E00BA1C24E50300839198 / * AppDelegate . cpp * / , <nl> + 507E00BB1C24E50300839198 / * AppDelegate . h * / , <nl> + ) ; <nl> + path = Classes ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> + 507E01151C24E50300839198 / * proj . mac * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 507E01161C24E50300839198 / * InfoPlist . strings * / , <nl> + 507E01181C24E50300839198 / * MainMenu . xib * / , <nl> + 507E011A1C24E50300839198 / * Icon . icns * / , <nl> + 507E011B1C24E50300839198 / * main . cpp * / , <nl> + 507E011C1C24E50300839198 / * Test_Info . plist * / , <nl> + 507E011D1C24E50300839198 / * Test_Prefix . pch * / , <nl> + ) ; <nl> + path = proj . mac ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> 50921EAC1B746D5F00C085CC / * DownloaderTest * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> <nl> path = DownloaderTest ; <nl> sourceTree = " < group > " ; <nl> } ; <nl> + 50AC0EA91C2A3FCC0065A4C7 / * proj . ios * / = { <nl> + isa = PBXGroup ; <nl> + children = ( <nl> + 50AC0EAA1C2A3FCC0065A4C7 / * AppController . h * / , <nl> + 50AC0EAB1C2A3FCC0065A4C7 / * AppController . mm * / , <nl> + 50AC0EAC1C2A3FCC0065A4C7 / * Default - 568h @ 2x . png * / , <nl> + 50AC0EAD1C2A3FCC0065A4C7 / * Default . png * / , <nl> + 50AC0EAE1C2A3FCC0065A4C7 / * Default @ 2x . png * / , <nl> + 50AC0EAF1C2A3FCC0065A4C7 / * Icon - 114 . png * / , <nl> + 50AC0EB01C2A3FCC0065A4C7 / * Icon - 120 . png * / , <nl> + 50AC0EB11C2A3FCC0065A4C7 / * Icon - 144 . png * / , <nl> + 50AC0EB21C2A3FCC0065A4C7 / * Icon - 152 . png * / , <nl> + 50AC0EB31C2A3FCC0065A4C7 / * Icon - 57 . png * / , <nl> + 50AC0EB41C2A3FCC0065A4C7 / * Icon - 72 . png * / , <nl> + 50AC0EB51C2A3FCC0065A4C7 / * Icon - 76 . png * / , <nl> + 50AC0EB61C2A3FCC0065A4C7 / * Info . plist * / , <nl> + 50AC0EB71C2A3FCC0065A4C7 / * main . m * / , <nl> + 50AC0EB81C2A3FCC0065A4C7 / * NativeOcClass . h * / , <nl> + 50AC0EB91C2A3FCC0065A4C7 / * NativeOcClass . m * / , <nl> + 50AC0EBA1C2A3FCC0065A4C7 / * Prefix . pch * / , <nl> + 50AC0EBB1C2A3FCC0065A4C7 / * RootViewController . h * / , <nl> + 50AC0EBC1C2A3FCC0065A4C7 / * RootViewController . mm * / , <nl> + ) ; <nl> + path = proj . ios ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> 6886696E1AE8E8A000C2CFD9 / * SpritePolygonTest * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> <nl> productReference = 3E6177311960FAED00DE83F5 / * game - controller - test IOS . app * / ; <nl> productType = " com . apple . product - type . application " ; <nl> } ; <nl> - 507B40FE1C31BEA60067B53E / * cpp - tests tvOS * / = { <nl> - isa = PBXNativeTarget ; <nl> - buildConfigurationList = 507B420A1C31BEA60067B53E / * Build configuration list for PBXNativeTarget " cpp - tests tvOS " * / ; <nl> - buildPhases = ( <nl> - 507B41011C31BEA60067B53E / * Resources * / , <nl> - 507B413B1C31BEA60067B53E / * Sources * / , <nl> - 507B41FB1C31BEA60067B53E / * Frameworks * / , <nl> - ) ; <nl> - buildRules = ( <nl> - ) ; <nl> - dependencies = ( <nl> - 507B43601C31FB5E0067B53E / * PBXTargetDependency * / , <nl> - ) ; <nl> - name = " cpp - tests tvOS " ; <nl> - productName = iphone ; <nl> - productReference = 507B420D1C31BEA60067B53E / * cpp - tests tvOS . app * / ; <nl> - productType = " com . apple . product - type . application " ; <nl> - } ; <nl> - 507B427E1C31E6070067B53E / * js - tests tvOS * / = { <nl> - isa = PBXNativeTarget ; <nl> - buildConfigurationList = 507B42AD1C31E6070067B53E / * Build configuration list for PBXNativeTarget " js - tests tvOS " * / ; <nl> - buildPhases = ( <nl> - 507B42831C31E6070067B53E / * ShellScript * / , <nl> - 507B42841C31E6070067B53E / * Sources * / , <nl> - 507B428C1C31E6070067B53E / * Frameworks * / , <nl> - 507B429D1C31E6070067B53E / * Resources * / , <nl> - ) ; <nl> - buildRules = ( <nl> - ) ; <nl> - dependencies = ( <nl> - 507B42B61C31E6210067B53E / * PBXTargetDependency * / , <nl> - 507B42B81C31E6210067B53E / * PBXTargetDependency * / , <nl> - ) ; <nl> - name = " js - tests tvOS " ; <nl> - productName = " Test lua iOS " ; <nl> - productReference = 507B42B01C31E6070067B53E / * js - tests tvOS . app * / ; <nl> - productType = " com . apple . product - type . application " ; <nl> - } ; <nl> - 507B43611C31FB670067B53E / * lua - tests tvOS * / = { <nl> + 507EE84B1C24C94600839198 / * js - tests - memory - gc Mac * / = { <nl> isa = PBXNativeTarget ; <nl> - buildConfigurationList = 507B43B61C31FB670067B53E / * Build configuration list for PBXNativeTarget " lua - tests tvOS " * / ; <nl> + buildConfigurationList = 507EE8711C24C94600839198 / * Build configuration list for PBXNativeTarget " js - tests - memory - gc Mac " * / ; <nl> buildPhases = ( <nl> - 507B43661C31FB670067B53E / * ShellScript * / , <nl> - 507B43671C31FB670067B53E / * Sources * / , <nl> - 507B436F1C31FB670067B53E / * Frameworks * / , <nl> - 507B437F1C31FB670067B53E / * ShellScript * / , <nl> - 507B43801C31FB670067B53E / * Resources * / , <nl> + 507EE8501C24C94600839198 / * ShellScript * / , <nl> + 507EE8511C24C94600839198 / * Sources * / , <nl> + 507EE8571C24C94600839198 / * Frameworks * / , <nl> + 507EE8681C24C94600839198 / * Resources * / , <nl> ) ; <nl> buildRules = ( <nl> ) ; <nl> dependencies = ( <nl> - 507B43BC1C31FB850067B53E / * PBXTargetDependency * / , <nl> - 507B43BE1C31FB850067B53E / * PBXTargetDependency * / , <nl> + 507EE84C1C24C94600839198 / * PBXTargetDependency * / , <nl> + 507EE84E1C24C94600839198 / * PBXTargetDependency * / , <nl> ) ; <nl> - name = " lua - tests tvOS " ; <nl> - productName = " Test lua iOS " ; <nl> - productReference = 507B43B91C31FB670067B53E / * lua - tests tvOS . app * / ; <nl> + name = " js - tests - memory - gc Mac " ; <nl> + productName = " Test lua Mac " ; <nl> + productReference = 507EE8741C24C94600839198 / * js - tests - memory - gc Mac . app * / ; <nl> productType = " com . apple . product - type . application " ; <nl> } ; <nl> - 507B43C31C3201360067B53E / * game - controller - test tvOS * / = { <nl> + 50AC0E6E1C2A3CAA0065A4C7 / * js - tests - memory - gc iOS * / = { <nl> isa = PBXNativeTarget ; <nl> - buildConfigurationList = 507B43EF1C3201360067B53E / * Build configuration list for PBXNativeTarget " game - controller - test tvOS " * / ; <nl> + buildConfigurationList = 50AC0E911C2A3CAA0065A4C7 / * Build configuration list for PBXNativeTarget " js - tests - memory - gc iOS " * / ; <nl> buildPhases = ( <nl> - 507B43C61C3201360067B53E / * Resources * / , <nl> - 507B43DB1C3201360067B53E / * Sources * / , <nl> - 507B43E11C3201360067B53E / * Frameworks * / , <nl> + 50AC0E731C2A3CAA0065A4C7 / * ShellScript * / , <nl> + 50AC0E741C2A3CAA0065A4C7 / * Sources * / , <nl> + 50AC0E771C2A3CAA0065A4C7 / * Frameworks * / , <nl> + 50AC0E881C2A3CAA0065A4C7 / * Resources * / , <nl> ) ; <nl> buildRules = ( <nl> ) ; <nl> dependencies = ( <nl> - 507B43F81C3202300067B53E / * PBXTargetDependency * / , <nl> + 50AC0E6F1C2A3CAA0065A4C7 / * PBXTargetDependency * / , <nl> + 50AC0E711C2A3CAA0065A4C7 / * PBXTargetDependency * / , <nl> ) ; <nl> - name = " game - controller - test tvOS " ; <nl> - productName = iphone ; <nl> - productReference = 507B43F21C3201360067B53E / * game - controller - test tvOS . app * / ; <nl> + name = " js - tests - memory - gc iOS " ; <nl> + productName = " Test lua Mac " ; <nl> + productReference = 50AC0E941C2A3CAA0065A4C7 / * js - tests - memory - gc iOS . app * / ; <nl> productType = " com . apple . product - type . application " ; <nl> } ; <nl> A07A517F1783A1D20073F6A7 / * cpp - tests iOS * / = { <nl> <nl> 1D6058900D05DD3D006BFB54 = { <nl> DevelopmentTeam = U7E7529TA5 ; <nl> } ; <nl> - 507B40FE1C31BEA60067B53E = { <nl> - DevelopmentTeam = MDDB52YB8L ; <nl> - } ; <nl> - 507B427E1C31E6070067B53E = { <nl> - DevelopmentTeam = MDDB52YB8L ; <nl> - } ; <nl> - 507B43541C31FB340067B53E = { <nl> - CreatedOnToolsVersion = 7 . 2 ; <nl> - } ; <nl> - 507B43611C31FB670067B53E = { <nl> - DevelopmentTeam = MDDB52YB8L ; <nl> - } ; <nl> - 507B43C31C3201360067B53E = { <nl> - DevelopmentTeam = MDDB52YB8L ; <nl> - } ; <nl> } ; <nl> } ; <nl> buildConfigurationList = C01FCF4E08A954540054247B / * Build configuration list for PBXProject " cocos2d_tests " * / ; <nl> <nl> 1ABCA28518CD91510087CE3A / * lua - tests Mac * / , <nl> 1A0EE2B818CDF733004CD58F / * lua - empty - test Mac * / , <nl> 1856634B1B4155D3009EF2AE / * js - tests Mac * / , <nl> + 507EE84B1C24C94600839198 / * js - tests - memory - gc Mac * / , <nl> FA94B0C01B8EF76D0074B261 / * performance - tests Mac * / , <nl> A07A517B1783A1CC0073F6A7 / * build all tests iOS * / , <nl> A07A517F1783A1D20073F6A7 / * cpp - tests iOS * / , <nl> <nl> 15CBA015196EE56C005877BB / * lua - game - controller - test iOS * / , <nl> 185663961B4155DD009EF2AE / * js - tests iOS * / , <nl> FA94AF961B8EF69A0074B261 / * performance - tests iOS * / , <nl> - 507B43541C31FB340067B53E / * build all tests tvOS * / , <nl> - 507B40FE1C31BEA60067B53E / * cpp - tests tvOS * / , <nl> - 507B427E1C31E6070067B53E / * js - tests tvOS * / , <nl> - 507B43611C31FB670067B53E / * lua - tests tvOS * / , <nl> - 507B43C31C3201360067B53E / * game - controller - test tvOS * / , <nl> + 50AC0E6E1C2A3CAA0065A4C7 / * js - tests - memory - gc iOS * / , <nl> ) ; <nl> } ; <nl> / * End PBXProject section * / <nl> <nl> remoteRef = 46A15FBD1807A4F9005B8026 / * PBXContainerItemProxy * / ; <nl> sourceTree = BUILT_PRODUCTS_DIR ; <nl> } ; <nl> - 507B42111C31BEA70067B53E / * libcocos2d tvOS . a * / = { <nl> - isa = PBXReferenceProxy ; <nl> - fileType = archive . ar ; <nl> - path = " libcocos2d tvOS . a " ; <nl> - remoteRef = 507B42101C31BEA70067B53E / * PBXContainerItemProxy * / ; <nl> - sourceTree = BUILT_PRODUCTS_DIR ; <nl> - } ; <nl> - 507B42B41C31E6080067B53E / * libjscocos2d tvOS . a * / = { <nl> - isa = PBXReferenceProxy ; <nl> - fileType = archive . ar ; <nl> - path = " libjscocos2d tvOS . a " ; <nl> - remoteRef = 507B42B31C31E6080067B53E / * PBXContainerItemProxy * / ; <nl> - sourceTree = BUILT_PRODUCTS_DIR ; <nl> - } ; <nl> - 507B43571C31FB350067B53E / * libluacocos2d tvOS . a * / = { <nl> - isa = PBXReferenceProxy ; <nl> - fileType = archive . ar ; <nl> - path = " libluacocos2d tvOS . a " ; <nl> - remoteRef = 507B43561C31FB350067B53E / * PBXContainerItemProxy * / ; <nl> - sourceTree = BUILT_PRODUCTS_DIR ; <nl> - } ; <nl> / * End PBXReferenceProxy section * / <nl> <nl> / * Begin PBXResourcesBuildPhase section * / <nl> <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> - 507B41011C31BEA60067B53E / * Resources * / = { <nl> - isa = PBXResourcesBuildPhase ; <nl> - buildActionMask = 2147483647 ; <nl> - files = ( <nl> - 507B41021C31BEA60067B53E / * components in Resources * / , <nl> - 507B41031C31BEA60067B53E / * Icon - 144 . png in Resources * / , <nl> - 507B41041C31BEA60067B53E / * Icon - 50 . png in Resources * / , <nl> - 507B41051C31BEA60067B53E / * Particle3D in Resources * / , <nl> - 507B41061C31BEA60067B53E / * effect1 . wav in Resources * / , <nl> - 507B41071C31BEA60067B53E / * Icon - 76 . png in Resources * / , <nl> - 507B41081C31BEA60067B53E / * Default @ 2x . png in Resources * / , <nl> - 507B41091C31BEA60067B53E / * effect1 . raw in Resources * / , <nl> - 507B410A1C31BEA60067B53E / * TerrainTest in Resources * / , <nl> - 507B410B1C31BEA60067B53E / * ccs - res in Resources * / , <nl> - 507B410C1C31BEA60067B53E / * Icon - 29 . png in Resources * / , <nl> - 507B410D1C31BEA60067B53E / * TileMaps in Resources * / , <nl> - 507B410E1C31BEA60067B53E / * Particles in Resources * / , <nl> - 507B410F1C31BEA60067B53E / * Default - 568h @ 2x . png in Resources * / , <nl> - 507B41101C31BEA60067B53E / * Test . html in Resources * / , <nl> - 507B41111C31BEA60067B53E / * ccb in Resources * / , <nl> - 507B41121C31BEA60067B53E / * configs in Resources * / , <nl> - 507B41131C31BEA60067B53E / * extensions in Resources * / , <nl> - 507B41141C31BEA60067B53E / * audio in Resources * / , <nl> - 507B41151C31BEA60067B53E / * Materials in Resources * / , <nl> - 507B41161C31BEA60067B53E / * background . caf in Resources * / , <nl> - 507B41171C31BEA60067B53E / * Icon - 72 . png in Resources * / , <nl> - 507B41181C31BEA60067B53E / * Manifests in Resources * / , <nl> - 507B41191C31BEA60067B53E / * zwoptex in Resources * / , <nl> - 507B411A1C31BEA60067B53E / * Images in Resources * / , <nl> - 507B411B1C31BEA60067B53E / * Icon - 40 . png in Resources * / , <nl> - 507B411C1C31BEA60067B53E / * Icon - 100 . png in Resources * / , <nl> - 507B411D1C31BEA60067B53E / * pew - pew - lei . wav in Resources * / , <nl> - 507B411E1C31BEA60067B53E / * Shaders in Resources * / , <nl> - 507B411F1C31BEA60067B53E / * background . ogg in Resources * / , <nl> - 507B41201C31BEA60067B53E / * background . wav in Resources * / , <nl> - 507B41211C31BEA60067B53E / * animations in Resources * / , <nl> - 507B41221C31BEA60067B53E / * cocosvideo . mp4 in Resources * / , <nl> - 507B41231C31BEA60067B53E / * Sprite3DTest in Resources * / , <nl> - 507B41241C31BEA60067B53E / * Icon - 114 . png in Resources * / , <nl> - 507B41251C31BEA60067B53E / * hd in Resources * / , <nl> - 507B41261C31BEA60067B53E / * Icon - 57 . png in Resources * / , <nl> - 507B41271C31BEA60067B53E / * Misc in Resources * / , <nl> - 507B41281C31BEA60067B53E / * Hello . png in Resources * / , <nl> - 507B41291C31BEA60067B53E / * Icon - 152 . png in Resources * / , <nl> - 507B412A1C31BEA60067B53E / * effect2 . ogg in Resources * / , <nl> - 507B412B1C31BEA60067B53E / * ActionTimeline in Resources * / , <nl> - 507B412C1C31BEA60067B53E / * NavMesh in Resources * / , <nl> - 507B412D1C31BEA60067B53E / * Icon - 80 . png in Resources * / , <nl> - 507B412E1C31BEA60067B53E / * fileLookup . plist in Resources * / , <nl> - 507B412F1C31BEA60067B53E / * Default - 736h @ 3x . png in Resources * / , <nl> - 507B41301C31BEA60067B53E / * Default - 667h @ 2x . png in Resources * / , <nl> - 507B41311C31BEA60067B53E / * music . mid in Resources * / , <nl> - 507B41321C31BEA60067B53E / * spine in Resources * / , <nl> - 507B41331C31BEA60067B53E / * Icon - 120 . png in Resources * / , <nl> - 507B41341C31BEA60067B53E / * Icon - 58 . png in Resources * / , <nl> - 507B41351C31BEA60067B53E / * background . mp3 in Resources * / , <nl> - 507B41361C31BEA60067B53E / * CocosBuilderExample . ccbresourcelog in Resources * / , <nl> - 507B41371C31BEA60067B53E / * Shaders3D in Resources * / , <nl> - 507B41381C31BEA60067B53E / * fonts in Resources * / , <nl> - 507B41391C31BEA60067B53E / * CocosBuilderExample . ccbproj in Resources * / , <nl> - 507B413A1C31BEA60067B53E / * Default . png in Resources * / , <nl> - ) ; <nl> - runOnlyForDeploymentPostprocessing = 0 ; <nl> - } ; <nl> - 507B429D1C31E6070067B53E / * Resources * / = { <nl> - isa = PBXResourcesBuildPhase ; <nl> - buildActionMask = 2147483647 ; <nl> - files = ( <nl> - 507B429E1C31E6070067B53E / * script in Resources * / , <nl> - 507B429F1C31E6070067B53E / * Default - 568h @ 2x . png in Resources * / , <nl> - 507B42A01C31E6070067B53E / * Default . png in Resources * / , <nl> - 507B42A11C31E6070067B53E / * Default @ 2x . png in Resources * / , <nl> - 507B42A21C31E6070067B53E / * Icon - 114 . png in Resources * / , <nl> - 507B42A31C31E6070067B53E / * Icon - 120 . png in Resources * / , <nl> - 507B42A41C31E6070067B53E / * Icon - 144 . png in Resources * / , <nl> - 507B42A51C31E6070067B53E / * Icon - 152 . png in Resources * / , <nl> - 507B42A61C31E6070067B53E / * Icon - 57 . png in Resources * / , <nl> - 507B42A71C31E6070067B53E / * Icon - 72 . png in Resources * / , <nl> - 507B42A81C31E6070067B53E / * Icon - 76 . png in Resources * / , <nl> - 507B42A91C31E6070067B53E / * src in Resources * / , <nl> - 507B42AA1C31E6070067B53E / * project . json in Resources * / , <nl> - 507B42AB1C31E6070067B53E / * main . js in Resources * / , <nl> - 507B42AC1C31E6070067B53E / * res in Resources * / , <nl> - ) ; <nl> - runOnlyForDeploymentPostprocessing = 0 ; <nl> - } ; <nl> - 507B43801C31FB670067B53E / * Resources * / = { <nl> + 507EE8681C24C94600839198 / * Resources * / = { <nl> isa = PBXResourcesBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> - 507B43811C31FB670067B53E / * NavMesh in Resources * / , <nl> - 507B43821C31FB670067B53E / * Materials in Resources * / , <nl> - 507B43831C31FB670067B53E / * Shaders3D in Resources * / , <nl> - 507B43841C31FB670067B53E / * Test . html in Resources * / , <nl> - 507B43851C31FB670067B53E / * TerrainTest in Resources * / , <nl> - 507B43861C31FB670067B53E / * Particle3D in Resources * / , <nl> - 507B43871C31FB670067B53E / * Manifests in Resources * / , <nl> - 507B43881C31FB670067B53E / * cocosvideo . mp4 in Resources * / , <nl> - 507B43891C31FB670067B53E / * ActionTimeline in Resources * / , <nl> - 507B438A1C31FB670067B53E / * Sprite3DTest in Resources * / , <nl> - 507B438B1C31FB670067B53E / * Misc in Resources * / , <nl> - 507B438C1C31FB670067B53E / * effect1 . wav in Resources * / , <nl> - 507B438D1C31FB670067B53E / * background . caf in Resources * / , <nl> - 507B438E1C31FB670067B53E / * fonts in Resources * / , <nl> - 507B438F1C31FB670067B53E / * ccb in Resources * / , <nl> - 507B43901C31FB670067B53E / * hd in Resources * / , <nl> - 507B43911C31FB670067B53E / * Particles in Resources * / , <nl> - 507B43921C31FB670067B53E / * src in Resources * / , <nl> - 507B43931C31FB670067B53E / * background . wav in Resources * / , <nl> - 507B43941C31FB670067B53E / * Icon - 120 . png in Resources * / , <nl> - 507B43951C31FB670067B53E / * Icon - 57 . png in Resources * / , <nl> - 507B43961C31FB670067B53E / * fileLookup . plist in Resources * / , <nl> - 507B43971C31FB670067B53E / * background . ogg in Resources * / , <nl> - 507B43981C31FB670067B53E / * Icon - 144 . png in Resources * / , <nl> - 507B43991C31FB670067B53E / * pew - pew - lei . wav in Resources * / , <nl> - 507B439A1C31FB670067B53E / * Default - 568h @ 2x . png in Resources * / , <nl> - 507B439B1C31FB670067B53E / * Default - 667h @ 2x . png in Resources * / , <nl> - 507B439C1C31FB670067B53E / * Default @ 2x . png in Resources * / , <nl> - 507B439D1C31FB670067B53E / * components in Resources * / , <nl> - 507B439E1C31FB670067B53E / * zwoptex in Resources * / , <nl> - 507B439F1C31FB670067B53E / * CocosBuilderExample . ccbresourcelog in Resources * / , <nl> - 507B43A01C31FB670067B53E / * music . mid in Resources * / , <nl> - 507B43A11C31FB670067B53E / * Default - 736h @ 3x . png in Resources * / , <nl> - 507B43A21C31FB670067B53E / * extensions in Resources * / , <nl> - 507B43A31C31FB670067B53E / * Images in Resources * / , <nl> - 507B43A41C31FB670067B53E / * effect2 . ogg in Resources * / , <nl> - 507B43A51C31FB670067B53E / * audio in Resources * / , <nl> - 507B43A61C31FB670067B53E / * CocosBuilderExample . ccbproj in Resources * / , <nl> - 507B43A71C31FB670067B53E / * animations in Resources * / , <nl> - 507B43A81C31FB670067B53E / * ccs - res in Resources * / , <nl> - 507B43A91C31FB670067B53E / * Icon - 72 . png in Resources * / , <nl> - 507B43AA1C31FB670067B53E / * Icon - 76 . png in Resources * / , <nl> - 507B43AB1C31FB670067B53E / * effect1 . raw in Resources * / , <nl> - 507B43AC1C31FB670067B53E / * Shaders in Resources * / , <nl> - 507B43AD1C31FB670067B53E / * configs in Resources * / , <nl> - 507B43AE1C31FB670067B53E / * spine in Resources * / , <nl> - 507B43AF1C31FB670067B53E / * TileMaps in Resources * / , <nl> - 507B43B01C31FB670067B53E / * Hello . png in Resources * / , <nl> - 507B43B11C31FB670067B53E / * cocosbuilderRes in Resources * / , <nl> - 507B43B21C31FB670067B53E / * Icon - 114 . png in Resources * / , <nl> - 507B43B31C31FB670067B53E / * Icon - 152 . png in Resources * / , <nl> - 507B43B41C31FB670067B53E / * background . mp3 in Resources * / , <nl> - 507B43B51C31FB670067B53E / * Default . png in Resources * / , <nl> + 507E01991C24E50300839198 / * Icon . icns in Resources * / , <nl> + 507E01CF1C24E52E00839198 / * script in Resources * / , <nl> + 507E01B91C24E50300839198 / * project . json in Resources * / , <nl> + 507E01971C24E50300839198 / * InfoPlist . strings in Resources * / , <nl> + 507E01981C24E50300839198 / * MainMenu . xib in Resources * / , <nl> + 507E01CD1C24E51900839198 / * src in Resources * / , <nl> + 507E01CC1C24E51900839198 / * res in Resources * / , <nl> + 507E015C1C24E50300839198 / * main . js in Resources * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> - 507B43C61C3201360067B53E / * Resources * / = { <nl> + 50AC0E881C2A3CAA0065A4C7 / * Resources * / = { <nl> isa = PBXResourcesBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> - 507B43C71C3201360067B53E / * ipadhd in Resources * / , <nl> - 507B43C81C3201360067B53E / * Icon - 152 . png in Resources * / , <nl> - 507B43C91C3201360067B53E / * Icon - 80 . png in Resources * / , <nl> - 507B43CA1C3201360067B53E / * Default . png in Resources * / , <nl> - 507B43CB1C3201360067B53E / * iphone in Resources * / , <nl> - 507B43CC1C3201360067B53E / * Icon - 57 . png in Resources * / , <nl> - 507B43CD1C3201360067B53E / * ipad in Resources * / , <nl> - 507B43CE1C3201360067B53E / * Default - 736h @ 3x . png in Resources * / , <nl> - 507B43CF1C3201360067B53E / * Default - 667h @ 2x . png in Resources * / , <nl> - 507B43D01C3201360067B53E / * Default - 568h @ 2x . png in Resources * / , <nl> - 507B43D11C3201360067B53E / * Default @ 2x . png in Resources * / , <nl> - 507B43D21C3201360067B53E / * Icon - 100 . png in Resources * / , <nl> - 507B43D31C3201360067B53E / * Icon - 40 . png in Resources * / , <nl> - 507B43D41C3201360067B53E / * Icon - 144 . png in Resources * / , <nl> - 507B43D51C3201360067B53E / * Icon - 114 . png in Resources * / , <nl> - 507B43D61C3201360067B53E / * Icon - 76 . png in Resources * / , <nl> - 507B43D71C3201360067B53E / * Icon - 120 . png in Resources * / , <nl> - 507B43D81C3201360067B53E / * Icon - 72 . png in Resources * / , <nl> - 507B43D91C3201360067B53E / * fonts in Resources * / , <nl> - 507B43DA1C3201360067B53E / * Icon - 58 . png in Resources * / , <nl> + 50AC0EC51C2A3FCC0065A4C7 / * Icon - 57 . png in Resources * / , <nl> + 50AC0EC01C2A3FCC0065A4C7 / * Default @ 2x . png in Resources * / , <nl> + 50AC0EC71C2A3FCC0065A4C7 / * Icon - 76 . png in Resources * / , <nl> + 50AC0EC41C2A3FCC0065A4C7 / * Icon - 152 . png in Resources * / , <nl> + 50AC0E8A1C2A3CAA0065A4C7 / * script in Resources * / , <nl> + 50AC0E8B1C2A3CAA0065A4C7 / * project . json in Resources * / , <nl> + 50AC0EC61C2A3FCC0065A4C7 / * Icon - 72 . png in Resources * / , <nl> + 50AC0E8E1C2A3CAA0065A4C7 / * src in Resources * / , <nl> + 50AC0E8F1C2A3CAA0065A4C7 / * res in Resources * / , <nl> + 50AC0EBF1C2A3FCC0065A4C7 / * Default . png in Resources * / , <nl> + 50AC0E901C2A3CAA0065A4C7 / * main . js in Resources * / , <nl> + 50AC0EC31C2A3FCC0065A4C7 / * Icon - 144 . png in Resources * / , <nl> + 50AC0EC11C2A3FCC0065A4C7 / * Icon - 114 . png in Resources * / , <nl> + 50AC0EC21C2A3FCC0065A4C7 / * Icon - 120 . png in Resources * / , <nl> + 50AC0EBE1C2A3FCC0065A4C7 / * Default - 568h @ 2x . png in Resources * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> <nl> shellPath = / bin / sh ; <nl> shellScript = " # ! / bin / bash \ ncocos_dir = $ { SRCROOT } / . . / tests / js - tests / res \ nif [ - d \ " $ { cocos_dir } \ " ] ; then \ nrm - rv \ " $ { cocos_dir } \ " \ nmkdir \ " $ { cocos_dir } \ " \ nelse \ nmkdir \ " $ { cocos_dir } \ " \ nfi \ n \ ncp - r \ " $ { SRCROOT } / . . / tests / cpp - tests / Resources / \ " \ " $ { cocos_dir } \ " \ ncp - r \ " $ { SRCROOT } / . . / tests / js - tests / resjs / \ " \ " $ { cocos_dir } / resjs \ " " ; <nl> } ; <nl> - 507B42831C31E6070067B53E / * ShellScript * / = { <nl> + 507EE8501C24C94600839198 / * ShellScript * / = { <nl> isa = PBXShellScriptBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> <nl> shellPath = / bin / sh ; <nl> shellScript = " # ! / bin / bash \ ncocos_dir = $ { SRCROOT } / . . / tests / js - tests / res \ nif [ - d \ " $ { cocos_dir } \ " ] ; then \ nrm - rv \ " $ { cocos_dir } \ " \ nmkdir \ " $ { cocos_dir } \ " \ nelse \ nmkdir \ " $ { cocos_dir } \ " \ nfi \ n \ ncp - r \ " $ { SRCROOT } / . . / tests / cpp - tests / Resources / \ " \ " $ { cocos_dir } \ " \ ncp - r \ " $ { SRCROOT } / . . / tests / js - tests / resjs / \ " \ " $ { cocos_dir } / resjs \ " " ; <nl> } ; <nl> - 507B43661C31FB670067B53E / * ShellScript * / = { <nl> - isa = PBXShellScriptBuildPhase ; <nl> - buildActionMask = 2147483647 ; <nl> - files = ( <nl> - ) ; <nl> - inputPaths = ( <nl> - ) ; <nl> - outputPaths = ( <nl> - ) ; <nl> - runOnlyForDeploymentPostprocessing = 0 ; <nl> - shellPath = / bin / sh ; <nl> - shellScript = " find $ { SRCROOT } / . . / tests / lua - tests / src / - name \ " * \ " - exec touch - cm { } \ \ ; " ; <nl> - } ; <nl> - 507B437F1C31FB670067B53E / * ShellScript * / = { <nl> + 50AC0E731C2A3CAA0065A4C7 / * ShellScript * / = { <nl> isa = PBXShellScriptBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> shellPath = / bin / sh ; <nl> - shellScript = " # ! / bin / bash \ ncocos_dir = $ { SRCROOT } / . . / tests / lua - tests / src / cocos \ nif [ - d \ " $ { cocos_dir } \ " ] ; then \ nrm - rv \ " $ { cocos_dir } \ " \ nmkdir \ " $ { cocos_dir } \ " \ nelse \ nmkdir \ " $ { cocos_dir } \ " \ nfi \ n \ ncp - r \ " $ { SRCROOT } / . . / cocos / scripting / lua - bindings / script / \ " \ " $ { cocos_dir } \ " " ; <nl> + shellScript = " # ! / bin / bash \ ncocos_dir = $ { SRCROOT } / . . / tests / js - tests / res \ nif [ - d \ " $ { cocos_dir } \ " ] ; then \ nrm - rv \ " $ { cocos_dir } \ " \ nmkdir \ " $ { cocos_dir } \ " \ nelse \ nmkdir \ " $ { cocos_dir } \ " \ nfi \ n \ ncp - r \ " $ { SRCROOT } / . . / tests / cpp - tests / Resources / \ " \ " $ { cocos_dir } \ " \ ncp - r \ " $ { SRCROOT } / . . / tests / js - tests / resjs / \ " \ " $ { cocos_dir } / resjs \ " " ; <nl> } ; <nl> / * End PBXShellScriptBuildPhase section * / <nl> <nl> <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> - 507B413B1C31BEA60067B53E / * Sources * / = { <nl> - isa = PBXSourcesBuildPhase ; <nl> - buildActionMask = 2147483647 ; <nl> - files = ( <nl> - 507B413C1C31BEA60067B53E / * GLES - Render . cpp in Sources * / , <nl> - 507B413D1C31BEA60067B53E / * SpritePolygonTest . cpp in Sources * / , <nl> - 507B413E1C31BEA60067B53E / * TextInputTest . cpp in Sources * / , <nl> - 507B413F1C31BEA60067B53E / * Bug - 886 . cpp in Sources * / , <nl> - 507B41401C31BEA60067B53E / * CCControlButtonTest . cpp in Sources * / , <nl> - 507B41411C31BEA60067B53E / * CCControlSliderTest . cpp in Sources * / , <nl> - 507B41421C31BEA60067B53E / * UILayoutTest_Editor . cpp in Sources * / , <nl> - 507B41431C31BEA60067B53E / * SpineTest . cpp in Sources * / , <nl> - 507B41441C31BEA60067B53E / * Physics3DTest . cpp in Sources * / , <nl> - 507B41451C31BEA60067B53E / * NewRendererTest . cpp in Sources * / , <nl> - 507B41461C31BEA60067B53E / * DrawNode3D . cpp in Sources * / , <nl> - 507B41471C31BEA60067B53E / * UIRadioButtonTest . cpp in Sources * / , <nl> - 507B41481C31BEA60067B53E / * AnimationsTestLayer . cpp in Sources * / , <nl> - 507B41491C31BEA60067B53E / * CocosGUIScene . cpp in Sources * / , <nl> - 507B414A1C31BEA60067B53E / * WebSocketTest . cpp in Sources * / , <nl> - 507B414B1C31BEA60067B53E / * ActionTimelineTestScene . cpp in Sources * / , <nl> - 507B414C1C31BEA60067B53E / * UIScale9SpriteTest . cpp in Sources * / , <nl> - 507B414D1C31BEA60067B53E / * Particle3DTest . cpp in Sources * / , <nl> - 507B414E1C31BEA60067B53E / * Bug - 1174 . cpp in Sources * / , <nl> - 507B414F1C31BEA60067B53E / * CCControlColourPickerTest . cpp in Sources * / , <nl> - 507B41501C31BEA60067B53E / * UITextAtlasTest . cpp in Sources * / , <nl> - 507B41511C31BEA60067B53E / * ActionsEaseTest . cpp in Sources * / , <nl> - 507B41521C31BEA60067B53E / * MutiTouchTest . cpp in Sources * / , <nl> - 507B41531C31BEA60067B53E / * UIListViewTest_Editor . cpp in Sources * / , <nl> - 507B41541C31BEA60067B53E / * UILoadingBarTest_Editor . cpp in Sources * / , <nl> - 507B41551C31BEA60067B53E / * testsAppDelegate . mm in Sources * / , <nl> - 507B41561C31BEA60067B53E / * CustomImageView . cpp in Sources * / , <nl> - 507B41571C31BEA60067B53E / * AppDelegate . cpp in Sources * / , <nl> - 507B41581C31BEA60067B53E / * Bug - 1159 . cpp in Sources * / , <nl> - 507B41591C31BEA60067B53E / * UILoadingBarTest . cpp in Sources * / , <nl> - 507B415A1C31BEA60067B53E / * CustomParticleWidget . cpp in Sources * / , <nl> - 507B415B1C31BEA60067B53E / * SceneTest . cpp in Sources * / , <nl> - 507B415C1C31BEA60067B53E / * CustomImageViewReader . cpp in Sources * / , <nl> - 507B415D1C31BEA60067B53E / * UITextAtlasTest_Editor . cpp in Sources * / , <nl> - 507B415E1C31BEA60067B53E / * MenuTestLayer . cpp in Sources * / , <nl> - 507B415F1C31BEA60067B53E / * ClippingNodeTest . cpp in Sources * / , <nl> - 507B41601C31BEA60067B53E / * LayerTest . cpp in Sources * / , <nl> - 507B41611C31BEA60067B53E / * UITextBMFontTest . cpp in Sources * / , <nl> - 507B41621C31BEA60067B53E / * NodeTest . cpp in Sources * / , <nl> - 507B41631C31BEA60067B53E / * UIWidgetAddNodeTest . cpp in Sources * / , <nl> - 507B41641C31BEA60067B53E / * RenderTextureTest . cpp in Sources * / , <nl> - 507B41651C31BEA60067B53E / * MenuTest . cpp in Sources * / , <nl> - 507B41661C31BEA60067B53E / * UserDefaultTest . cpp in Sources * / , <nl> - 507B41671C31BEA60067B53E / * UITest . cpp in Sources * / , <nl> - 507B41681C31BEA60067B53E / * Camera3DTest . cpp in Sources * / , <nl> - 507B41691C31BEA60067B53E / * CustomReader . cpp in Sources * / , <nl> - 507B416A1C31BEA60067B53E / * ParallaxTest . cpp in Sources * / , <nl> - 507B416B1C31BEA60067B53E / * ZwoptexTest . cpp in Sources * / , <nl> - 507B416C1C31BEA60067B53E / * VibrateTest . cpp in Sources * / , <nl> - 507B416D1C31BEA60067B53E / * ComponentsTestScene . cpp in Sources * / , <nl> - 507B416E1C31BEA60067B53E / * Bug - 914 . cpp in Sources * / , <nl> - 507B416F1C31BEA60067B53E / * EffectsAdvancedTest . cpp in Sources * / , <nl> - 507B41701C31BEA60067B53E / * Paddle . cpp in Sources * / , <nl> - 507B41711C31BEA60067B53E / * UIPageViewTest . cpp in Sources * / , <nl> - 507B41721C31BEA60067B53E / * SceneEditorTest . cpp in Sources * / , <nl> - 507B41731C31BEA60067B53E / * Scene3DTest . cpp in Sources * / , <nl> - 507B41741C31BEA60067B53E / * OpenURLTest . cpp in Sources * / , <nl> - 507B41751C31BEA60067B53E / * BugsTest . cpp in Sources * / , <nl> - 507B41761C31BEA60067B53E / * testBasic . cpp in Sources * / , <nl> - 507B41771C31BEA60067B53E / * EnemyController . cpp in Sources * / , <nl> - 507B41781C31BEA60067B53E / * UIWidgetAddNodeTest_Editor . cpp in Sources * / , <nl> - 507B41791C31BEA60067B53E / * CocosBuilderTest . cpp in Sources * / , <nl> - 507B417A1C31BEA60067B53E / * UITextFieldTest_Editor . cpp in Sources * / , <nl> - 507B417B1C31BEA60067B53E / * QuestionContainerSprite . cpp in Sources * / , <nl> - 507B417C1C31BEA60067B53E / * DrawPrimitivesTest . cpp in Sources * / , <nl> - 507B417D1C31BEA60067B53E / * UITextFieldTest . cpp in Sources * / , <nl> - 507B417E1C31BEA60067B53E / * MotionStreakTest . cpp in Sources * / , <nl> - 507B417F1C31BEA60067B53E / * AllocatorTest . cpp in Sources * / , <nl> - 507B41801C31BEA60067B53E / * FontTest . cpp in Sources * / , <nl> - 507B41811C31BEA60067B53E / * RefPtrTest . cpp in Sources * / , <nl> - 507B41821C31BEA60067B53E / * UIEditBoxTest . cpp in Sources * / , <nl> - 507B41831C31BEA60067B53E / * ActionsTest . cpp in Sources * / , <nl> - 507B41841C31BEA60067B53E / * ShaderTest . cpp in Sources * / , <nl> - 507B41851C31BEA60067B53E / * BillBoardTest . cpp in Sources * / , <nl> - 507B41861C31BEA60067B53E / * Bug - PageViewLayout . cpp in Sources * / , <nl> - 507B41871C31BEA60067B53E / * TileMapTest2 . cpp in Sources * / , <nl> - 507B41881C31BEA60067B53E / * Bug - 624 . cpp in Sources * / , <nl> - 507B41891C31BEA60067B53E / * SocketIOTest . cpp in Sources * / , <nl> - 507B418A1C31BEA60067B53E / * SpriteTest . cpp in Sources * / , <nl> - 507B418B1C31BEA60067B53E / * NewAudioEngineTest . cpp in Sources * / , <nl> - 507B418C1C31BEA60067B53E / * FileUtilsTest . cpp in Sources * / , <nl> - 507B418D1C31BEA60067B53E / * CustomRootNodeReader . cpp in Sources * / , <nl> - 507B418E1C31BEA60067B53E / * CurlTest . cpp in Sources * / , <nl> - 507B418F1C31BEA60067B53E / * CustomTableViewCell . cpp in Sources * / , <nl> - 507B41901C31BEA60067B53E / * CustomGUIScene . cpp in Sources * / , <nl> - 507B41911C31BEA60067B53E / * CCControlSwitchTest . cpp in Sources * / , <nl> - 507B41921C31BEA60067B53E / * BaseTest . cpp in Sources * / , <nl> - 507B41931C31BEA60067B53E / * PlayerController . cpp in Sources * / , <nl> - 507B41941C31BEA60067B53E / * main . m in Sources * / , <nl> - 507B41951C31BEA60067B53E / * UIScrollViewTest . cpp in Sources * / , <nl> - 507B41961C31BEA60067B53E / * CCControlScene . cpp in Sources * / , <nl> - 507B41971C31BEA60067B53E / * UICheckBoxTest_Editor . cpp in Sources * / , <nl> - 507B41981C31BEA60067B53E / * DataVisitorTest . cpp in Sources * / , <nl> - 507B41991C31BEA60067B53E / * CurrentLanguageTest . cpp in Sources * / , <nl> - 507B419A1C31BEA60067B53E / * UITextTest_Editor . cpp in Sources * / , <nl> - 507B419B1C31BEA60067B53E / * UICheckBoxTest . cpp in Sources * / , <nl> - 507B419C1C31BEA60067B53E / * Bug - 350 . cpp in Sources * / , <nl> - 507B419D1C31BEA60067B53E / * UITextBMFontTest_Editor . cpp in Sources * / , <nl> - 507B419E1C31BEA60067B53E / * SchedulerTest . cpp in Sources * / , <nl> - 507B419F1C31BEA60067B53E / * Texture2dTest . cpp in Sources * / , <nl> - 507B41A01C31BEA60067B53E / * MouseTest . cpp in Sources * / , <nl> - 507B41A11C31BEA60067B53E / * Ball . cpp in Sources * / , <nl> - 507B41A21C31BEA60067B53E / * GameOverScene . cpp in Sources * / , <nl> - 507B41A31C31BEA60067B53E / * ExtensionsTest . cpp in Sources * / , <nl> - 507B41A41C31BEA60067B53E / * TestEntries . cpp in Sources * / , <nl> - 507B41A51C31BEA60067B53E / * AssetsManagerExTest . cpp in Sources * / , <nl> - 507B41A61C31BEA60067B53E / * Box2dTest . cpp in Sources * / , <nl> - 507B41A71C31BEA60067B53E / * UISceneManager_Editor . cpp in Sources * / , <nl> - 507B41A81C31BEA60067B53E / * LabelTestNew . cpp in Sources * / , <nl> - 507B41A91C31BEA60067B53E / * ChipmunkTest . cpp in Sources * / , <nl> - 507B41AA1C31BEA60067B53E / * cons . cpp in Sources * / , <nl> - 507B41AB1C31BEA60067B53E / * ConsoleTest . cpp in Sources * / , <nl> - 507B41AC1C31BEA60067B53E / * IntervalTest . cpp in Sources * / , <nl> - 507B41AD1C31BEA60067B53E / * UISliderTest . cpp in Sources * / , <nl> - 507B41AE1C31BEA60067B53E / * CCControlStepperTest . cpp in Sources * / , <nl> - 507B41AF1C31BEA60067B53E / * UIButtonTest . cpp in Sources * / , <nl> - 507B41B01C31BEA60067B53E / * TextureAtlasEncryptionTest . cpp in Sources * / , <nl> - 507B41B11C31BEA60067B53E / * ConfigurationTest . cpp in Sources * / , <nl> - 507B41B21C31BEA60067B53E / * CCControlPotentiometerTest . cpp in Sources * / , <nl> - 507B41B31C31BEA60067B53E / * RootViewController . mm in Sources * / , <nl> - 507B41B41C31BEA60067B53E / * TileMapTest . cpp in Sources * / , <nl> - 507B41B51C31BEA60067B53E / * UIRichTextTest . cpp in Sources * / , <nl> - 507B41B71C31BEA60067B53E / * Bug - 899 . cpp in Sources * / , <nl> - 507B41B81C31BEA60067B53E / * NewEventDispatcherTest . cpp in Sources * / , <nl> - 507B41B91C31BEA60067B53E / * UIScrollViewTest_Editor . cpp in Sources * / , <nl> - 507B41BA1C31BEA60067B53E / * acts . cpp in Sources * / , <nl> - 507B41BB1C31BEA60067B53E / * ArmatureScene . cpp in Sources * / , <nl> - 507B41BC1C31BEA60067B53E / * SceneController . cpp in Sources * / , <nl> - 507B41BD1C31BEA60067B53E / * UISliderTest_Editor . cpp in Sources * / , <nl> - 507B41BE1C31BEA60067B53E / * Test . cpp in Sources * / , <nl> - 507B41BF1C31BEA60067B53E / * ParticleTest . cpp in Sources * / , <nl> - 507B41C01C31BEA60067B53E / * TouchesTest . cpp in Sources * / , <nl> - 507B41C11C31BEA60067B53E / * UIImageViewTest_Editor . cpp in Sources * / , <nl> - 507B41C21C31BEA60067B53E / * TransitionsTest . cpp in Sources * / , <nl> - 507B41C31C31BEA60067B53E / * RotateWorldTest . cpp in Sources * / , <nl> - 507B41C41C31BEA60067B53E / * ActionsProgressTest . cpp in Sources * / , <nl> - 507B41C51C31BEA60067B53E / * EffectsTest . cpp in Sources * / , <nl> - 507B41C61C31BEA60067B53E / * TestHeaderLayer . cpp in Sources * / , <nl> - 507B41C71C31BEA60067B53E / * ActionManagerTest . cpp in Sources * / , <nl> - 507B41C81C31BEA60067B53E / * CocoStudioGUITest . cpp in Sources * / , <nl> - 507B41C91C31BEA60067B53E / * PhysicsTest . cpp in Sources * / , <nl> - 507B41CA1C31BEA60067B53E / * CustomRootNode . cpp in Sources * / , <nl> - 507B41CB1C31BEA60067B53E / * UIScene_Editor . cpp in Sources * / , <nl> - 507B41CC1C31BEA60067B53E / * UILayoutTest . cpp in Sources * / , <nl> - 507B41CD1C31BEA60067B53E / * ButtonTestLayer . cpp in Sources * / , <nl> - 507B41CE1C31BEA60067B53E / * UIListViewTest . cpp in Sources * / , <nl> - 507B41CF1C31BEA60067B53E / * MaterialSystemTest . cpp in Sources * / , <nl> - 507B41D01C31BEA60067B53E / * Box2dView . cpp in Sources * / , <nl> - 507B41D11C31BEA60067B53E / * UIImageViewTest . cpp in Sources * / , <nl> - 507B41D21C31BEA60067B53E / * LabelTest . cpp in Sources * / , <nl> - 507B41D31C31BEA60067B53E / * Bug - 12847 . cpp in Sources * / , <nl> - 507B41D41C31BEA60067B53E / * Bug - Child . cpp in Sources * / , <nl> - 507B41D51C31BEA60067B53E / * UISceneManager . cpp in Sources * / , <nl> - 507B41D61C31BEA60067B53E / * VisibleRect . cpp in Sources * / , <nl> - 507B41D71C31BEA60067B53E / * ReleasePoolTest . cpp in Sources * / , <nl> - 507B41D81C31BEA60067B53E / * DownloaderTest . cpp in Sources * / , <nl> - 507B41D91C31BEA60067B53E / * TextureCacheTest . cpp in Sources * / , <nl> - 507B41DA1C31BEA60067B53E / * HelloCocosBuilderLayer . cpp in Sources * / , <nl> - 507B41DB1C31BEA60067B53E / * CustomParticleWidgetTest . cpp in Sources * / , <nl> - 507B41DC1C31BEA60067B53E / * UITextTest . cpp in Sources * / , <nl> - 507B41DD1C31BEA60067B53E / * UIPageViewTest_Editor . cpp in Sources * / , <nl> - 507B41DE1C31BEA60067B53E / * TableViewTestScene . cpp in Sources * / , <nl> - 507B41DF1C31BEA60067B53E / * ShaderTest2 . cpp in Sources * / , <nl> - 507B41E01C31BEA60067B53E / * UnitTest . cpp in Sources * / , <nl> - 507B41E11C31BEA60067B53E / * CocostudioParserTest . cpp in Sources * / , <nl> - 507B41E21C31BEA60067B53E / * Bug - 458 . cpp in Sources * / , <nl> - 507B41E31C31BEA60067B53E / * UIScene . cpp in Sources * / , <nl> - 507B41E41C31BEA60067B53E / * CocosDenshionTest . cpp in Sources * / , <nl> - 507B41E51C31BEA60067B53E / * ProjectileController . cpp in Sources * / , <nl> - 507B41E61C31BEA60067B53E / * CustomWidgetCallbackBindTest . cpp in Sources * / , <nl> - 507B41E71C31BEA60067B53E / * Sprite3DTest . cpp in Sources * / , <nl> - 507B41E81C31BEA60067B53E / * controller . cpp in Sources * / , <nl> - 507B41E91C31BEA60067B53E / * CCControlSceneManager . cpp in Sources * / , <nl> - 507B41EA1C31BEA60067B53E / * CocosStudio3DTest . cpp in Sources * / , <nl> - 507B41EB1C31BEA60067B53E / * TimelineCallbackTestLayer . cpp in Sources * / , <nl> - 507B41EC1C31BEA60067B53E / * Bug - CCDrawNode . cpp in Sources * / , <nl> - 507B41ED1C31BEA60067B53E / * CustomParticleWidgetReader . cpp in Sources * / , <nl> - 507B41EE1C31BEA60067B53E / * NotificationCenterTest . cpp in Sources * / , <nl> - 507B41EF1C31BEA60067B53E / * CocostudioParserJsonTest . cpp in Sources * / , <nl> - 507B41F01C31BEA60067B53E / * NavMeshTest . cpp in Sources * / , <nl> - 507B41F11C31BEA60067B53E / * LightTest . cpp in Sources * / , <nl> - 507B41F21C31BEA60067B53E / * GUIEditorTest . cpp in Sources * / , <nl> - 507B41F31C31BEA60067B53E / * CustomImageTest . cpp in Sources * / , <nl> - 507B41F41C31BEA60067B53E / * Bug - 422 . cpp in Sources * / , <nl> - 507B41F51C31BEA60067B53E / * UIFocusTest . cpp in Sources * / , <nl> - 507B41F61C31BEA60067B53E / * HttpClientTest . cpp in Sources * / , <nl> - 507B41F81C31BEA60067B53E / * UIButtonTest_Editor . cpp in Sources * / , <nl> - 507B41F91C31BEA60067B53E / * ClickAndMoveTest . cpp in Sources * / , <nl> - 507B41FA1C31BEA60067B53E / * TerrainTest . cpp in Sources * / , <nl> - ) ; <nl> - runOnlyForDeploymentPostprocessing = 0 ; <nl> - } ; <nl> - 507B42841C31E6070067B53E / * Sources * / = { <nl> - isa = PBXSourcesBuildPhase ; <nl> - buildActionMask = 2147483647 ; <nl> - files = ( <nl> - 507B42851C31E6070067B53E / * AppController . mm in Sources * / , <nl> - 507B42861C31E6070067B53E / * main . m in Sources * / , <nl> - 507B42871C31E6070067B53E / * NativeOcClass . m in Sources * / , <nl> - 507B42881C31E6070067B53E / * js_Effect3D_bindings . cpp in Sources * / , <nl> - 507B42891C31E6070067B53E / * js_DrawNode3D_bindings . cpp in Sources * / , <nl> - 507B428A1C31E6070067B53E / * RootViewController . mm in Sources * / , <nl> - 507B428B1C31E6070067B53E / * AppDelegate . cpp in Sources * / , <nl> - ) ; <nl> - runOnlyForDeploymentPostprocessing = 0 ; <nl> - } ; <nl> - 507B43671C31FB670067B53E / * Sources * / = { <nl> + 507EE8511C24C94600839198 / * Sources * / = { <nl> isa = PBXSourcesBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> - 507B43681C31FB670067B53E / * lua_test_bindings . cpp in Sources * / , <nl> - 507B43691C31FB670067B53E / * main . m in Sources * / , <nl> - 507B436A1C31FB670067B53E / * LuaObjectCBridgeTest . mm in Sources * / , <nl> - 507B436B1C31FB670067B53E / * AppController . mm in Sources * / , <nl> - 507B436C1C31FB670067B53E / * AppDelegate . cpp in Sources * / , <nl> - 507B436D1C31FB670067B53E / * RootViewController . mm in Sources * / , <nl> - 507B436E1C31FB670067B53E / * lua_assetsmanager_test_sample . cpp in Sources * / , <nl> + 507E019A1C24E50300839198 / * main . cpp in Sources * / , <nl> + 507E015D1C24E50300839198 / * AppDelegate . cpp in Sources * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> - 507B43DB1C3201360067B53E / * Sources * / = { <nl> + 50AC0E741C2A3CAA0065A4C7 / * Sources * / = { <nl> isa = PBXSourcesBuildPhase ; <nl> buildActionMask = 2147483647 ; <nl> files = ( <nl> - 507B43DC1C3201360067B53E / * AppController . mm in Sources * / , <nl> - 507B43DD1C3201360067B53E / * RootViewController . mm in Sources * / , <nl> - 507B43DE1C3201360067B53E / * AppDelegate . cpp in Sources * / , <nl> - 507B43DF1C3201360067B53E / * main . m in Sources * / , <nl> - 507B43E01C3201360067B53E / * GameControllerTest . cpp in Sources * / , <nl> + 50AC0E761C2A3CAA0065A4C7 / * AppDelegate . cpp in Sources * / , <nl> + 50AC0ECB1C2A3FCC0065A4C7 / * RootViewController . mm in Sources * / , <nl> + 50AC0ECA1C2A3FCC0065A4C7 / * NativeOcClass . m in Sources * / , <nl> + 50AC0EC91C2A3FCC0065A4C7 / * main . m in Sources * / , <nl> + 50AC0EBD1C2A3FCC0065A4C7 / * AppController . mm in Sources * / , <nl> ) ; <nl> runOnlyForDeploymentPostprocessing = 0 ; <nl> } ; <nl> <nl> name = " cocos2dx iOS " ; <nl> targetProxy = 3E6177011960FAED00DE83F5 / * PBXContainerItemProxy * / ; <nl> } ; <nl> - 507B42B61C31E6210067B53E / * PBXTargetDependency * / = { <nl> - isa = PBXTargetDependency ; <nl> - name = " libjscocos2d tvOS " ; <nl> - targetProxy = 507B42B51C31E6210067B53E / * PBXContainerItemProxy * / ; <nl> - } ; <nl> - 507B42B81C31E6210067B53E / * PBXTargetDependency * / = { <nl> - isa = PBXTargetDependency ; <nl> - name = " libcocos2d tvOS " ; <nl> - targetProxy = 507B42B71C31E6210067B53E / * PBXContainerItemProxy * / ; <nl> - } ; <nl> - 507B435C1C31FB510067B53E / * PBXTargetDependency * / = { <nl> - isa = PBXTargetDependency ; <nl> - target = 507B40FE1C31BEA60067B53E / * cpp - tests tvOS * / ; <nl> - targetProxy = 507B435B1C31FB510067B53E / * PBXContainerItemProxy * / ; <nl> - } ; <nl> - 507B435E1C31FB510067B53E / * PBXTargetDependency * / = { <nl> - isa = PBXTargetDependency ; <nl> - target = 507B427E1C31E6070067B53E / * js - tests tvOS * / ; <nl> - targetProxy = 507B435D1C31FB510067B53E / * PBXContainerItemProxy * / ; <nl> - } ; <nl> - 507B43601C31FB5E0067B53E / * PBXTargetDependency * / = { <nl> - isa = PBXTargetDependency ; <nl> - name = " libcocos2d tvOS " ; <nl> - targetProxy = 507B435F1C31FB5E0067B53E / * PBXContainerItemProxy * / ; <nl> - } ; <nl> - 507B43BC1C31FB850067B53E / * PBXTargetDependency * / = { <nl> + 507EE84C1C24C94600839198 / * PBXTargetDependency * / = { <nl> isa = PBXTargetDependency ; <nl> - name = " libcocos2d tvOS " ; <nl> - targetProxy = 507B43BB1C31FB850067B53E / * PBXContainerItemProxy * / ; <nl> - } ; <nl> - 507B43BE1C31FB850067B53E / * PBXTargetDependency * / = { <nl> - isa = PBXTargetDependency ; <nl> - name = " libluacocos2d tvOS " ; <nl> - targetProxy = 507B43BD1C31FB850067B53E / * PBXContainerItemProxy * / ; <nl> + name = " libjscocos2d Mac " ; <nl> + targetProxy = 507EE84D1C24C94600839198 / * PBXContainerItemProxy * / ; <nl> } ; <nl> - 507B43C21C31FC160067B53E / * PBXTargetDependency * / = { <nl> + 507EE84E1C24C94600839198 / * PBXTargetDependency * / = { <nl> isa = PBXTargetDependency ; <nl> - target = 507B43611C31FB670067B53E / * lua - tests tvOS * / ; <nl> - targetProxy = 507B43C11C31FC160067B53E / * PBXContainerItemProxy * / ; <nl> + name = " cocos2dx Mac " ; <nl> + targetProxy = 507EE84F1C24C94600839198 / * PBXContainerItemProxy * / ; <nl> } ; <nl> - 507B43F51C3201580067B53E / * PBXTargetDependency * / = { <nl> + 50AC0E6F1C2A3CAA0065A4C7 / * PBXTargetDependency * / = { <nl> isa = PBXTargetDependency ; <nl> - target = 507B43C31C3201360067B53E / * game - controller - test tvOS * / ; <nl> - targetProxy = 507B43F41C3201580067B53E / * PBXContainerItemProxy * / ; <nl> + name = " libjscocos2d Mac " ; <nl> + targetProxy = 50AC0E701C2A3CAA0065A4C7 / * PBXContainerItemProxy * / ; <nl> } ; <nl> - 507B43F81C3202300067B53E / * PBXTargetDependency * / = { <nl> + 50AC0E711C2A3CAA0065A4C7 / * PBXTargetDependency * / = { <nl> isa = PBXTargetDependency ; <nl> - name = " libcocos2d tvOS " ; <nl> - targetProxy = 507B43F71C3202300067B53E / * PBXContainerItemProxy * / ; <nl> + name = " cocos2dx Mac " ; <nl> + targetProxy = 50AC0E721C2A3CAA0065A4C7 / * PBXContainerItemProxy * / ; <nl> } ; <nl> A035ACC0178246BD00987F6C / * PBXTargetDependency * / = { <nl> isa = PBXTargetDependency ; <nl> <nl> name = MainMenu . xib ; <nl> sourceTree = " < group > " ; <nl> } ; <nl> + 507E01161C24E50300839198 / * InfoPlist . strings * / = { <nl> + isa = PBXVariantGroup ; <nl> + children = ( <nl> + 507E01171C24E50300839198 / * en * / , <nl> + ) ; <nl> + name = InfoPlist . strings ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> + 507E01181C24E50300839198 / * MainMenu . xib * / = { <nl> + isa = PBXVariantGroup ; <nl> + children = ( <nl> + 507E01191C24E50300839198 / * en * / , <nl> + ) ; <nl> + name = MainMenu . xib ; <nl> + sourceTree = " < group > " ; <nl> + } ; <nl> / * End PBXVariantGroup section * / <nl> <nl> / * Begin XCBuildConfiguration section * / <nl> <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> CODE_SIGN_IDENTITY = " iPhone Developer " ; <nl> - " CODE_SIGN_IDENTITY [ sdk = iphoneos * ] " = " iPhone Developer " ; <nl> ENABLE_BITCODE = NO ; <nl> GCC_INLINES_ARE_PRIVATE_EXTERN = NO ; <nl> GCC_PRECOMPILE_PREFIX_HEADER = YES ; <nl> <nl> " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> " / Users / cocos2d / MyWork / cocos2d - x - develop / external / curl / prebuilt / ios " , <nl> ) ; <nl> - MACOSX_DEPLOYMENT_TARGET = 10 . 10 ; <nl> + " OTHER_LDFLAGS [ sdk = iphonesimulator * ] [ arch = x86_64 ] " = ( <nl> + " - pagezero_size " , <nl> + 10000 , <nl> + " - image_base " , <nl> + 100000000 , <nl> + ) ; <nl> PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> PRODUCT_NAME = " js - tests iOS " ; <nl> - PROVISIONING_PROFILE = " " ; <nl> SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES ; <nl> SDKROOT = iphoneos ; <nl> TARGETED_DEVICE_FAMILY = " 1 , 2 " ; <nl> <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> CODE_SIGN_IDENTITY = " iPhone Developer " ; <nl> - " CODE_SIGN_IDENTITY [ sdk = iphoneos * ] " = " iPhone Developer " ; <nl> ENABLE_BITCODE = NO ; <nl> GCC_GENERATE_DEBUGGING_SYMBOLS = NO ; <nl> GCC_INLINES_ARE_PRIVATE_EXTERN = NO ; <nl> <nl> " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> " / Users / cocos2d / MyWork / cocos2d - x - develop / external / curl / prebuilt / ios " , <nl> ) ; <nl> - MACOSX_DEPLOYMENT_TARGET = 10 . 10 ; <nl> + " OTHER_LDFLAGS [ sdk = iphonesimulator * ] [ arch = x86_64 ] " = ( <nl> + " - pagezero_size " , <nl> + 10000 , <nl> + " - image_base " , <nl> + 100000000 , <nl> + ) ; <nl> PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> PRODUCT_NAME = " js - tests iOS " ; <nl> - PROVISIONING_PROFILE = " " ; <nl> SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES ; <nl> SDKROOT = iphoneos ; <nl> TARGETED_DEVICE_FAMILY = " 1 , 2 " ; <nl> <nl> } ; <nl> name = Release ; <nl> } ; <nl> - 507B420B1C31BEA60067B53E / * Debug * / = { <nl> + 507EE8721C24C94600839198 / * Debug * / = { <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> + GCC_GENERATE_DEBUGGING_SYMBOLS = YES ; <nl> + GCC_INLINES_ARE_PRIVATE_EXTERN = NO ; <nl> GCC_PRECOMPILE_PREFIX_HEADER = YES ; <nl> - GCC_PREFIX_HEADER = " . . / tests / cpp - tests / proj . ios / Prefix . pch " ; <nl> GCC_PREPROCESSOR_DEFINITIONS = ( <nl> " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> + CC_TARGET_OS_MAC , <nl> + CC_KEYBOARD_SUPPORT , <nl> + COCOS2D_JAVASCRIPT , <nl> ) ; <nl> - GCC_WARN_64_TO_32_BIT_CONVERSION = YES ; <nl> - INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / cpp - tests / proj . ios / Info . plist " ; <nl> - LIBRARY_SEARCH_PATHS = ( <nl> - " $ ( inherited ) " , <nl> - " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> + GCC_TREAT_WARNINGS_AS_ERRORS = NO ; <nl> + INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / js - memory - gc - tests / project / proj . mac / Test_Info . plist " ; <nl> + LD_RUNPATH_SEARCH_PATHS = " @ loader_path / . . / Frameworks " ; <nl> + MACOSX_DEPLOYMENT_TARGET = 10 . 7 ; <nl> + OTHER_LDFLAGS = ( <nl> + " - pagezero_size " , <nl> + 10000 , <nl> + " - image_base " , <nl> + 100000000 , <nl> ) ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> + PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . js - memory - gc - tests - Mac " ; <nl> PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - SDKROOT = appletvos ; <nl> - TVOS_DEPLOYMENT_TARGET = 9 . 1 ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / cocos / platform / ios / Simulation $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> + SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES ; <nl> + USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / mac $ ( SRCROOT ) / . . / external / glfw3 / include / mac $ ( SRCROOT ) / . . / external / spidermonkey / include / mac $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos $ ( SRCROOT ) / . . / cocos / base $ ( SRCROOT ) / . . / cocos / 2d $ ( SRCROOT ) / . . / cocos / gui $ ( SRCROOT ) / . . / cocos / network $ ( SRCROOT ) / . . / cocos / audio / include $ ( SRCROOT ) / . . / cocos / editor - support $ ( SRCROOT ) / . . / extensions $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / external / chipmunk / include / chipmunk $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / auto $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / manual " ; <nl> } ; <nl> name = Debug ; <nl> } ; <nl> - 507B420C1C31BEA60067B53E / * Release * / = { <nl> + 507EE8731C24C94600839198 / * Release * / = { <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> + GCC_GENERATE_DEBUGGING_SYMBOLS = NO ; <nl> + GCC_INLINES_ARE_PRIVATE_EXTERN = NO ; <nl> GCC_PRECOMPILE_PREFIX_HEADER = YES ; <nl> - GCC_PREFIX_HEADER = " . . / tests / cpp - tests / proj . ios / Prefix . pch " ; <nl> GCC_PREPROCESSOR_DEFINITIONS = ( <nl> " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> + CC_TARGET_OS_MAC , <nl> + CC_KEYBOARD_SUPPORT , <nl> + COCOS2D_JAVASCRIPT , <nl> ) ; <nl> - GCC_WARN_64_TO_32_BIT_CONVERSION = YES ; <nl> - INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / cpp - tests / proj . ios / Info . plist " ; <nl> - LIBRARY_SEARCH_PATHS = ( <nl> - " $ ( inherited ) " , <nl> - " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> + GCC_TREAT_WARNINGS_AS_ERRORS = NO ; <nl> + INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / js - memory - gc - tests / project / proj . mac / Test_Info . plist " ; <nl> + LD_RUNPATH_SEARCH_PATHS = " @ loader_path / . . / Frameworks " ; <nl> + MACOSX_DEPLOYMENT_TARGET = 10 . 7 ; <nl> + OTHER_LDFLAGS = ( <nl> + " - pagezero_size " , <nl> + 10000 , <nl> + " - image_base " , <nl> + 100000000 , <nl> ) ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> + PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . js - memory - gc - tests - Mac " ; <nl> PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - SDKROOT = appletvos ; <nl> - TVOS_DEPLOYMENT_TARGET = 9 . 1 ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / cocos / platform / ios / Simulation $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> + SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES ; <nl> + USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / mac $ ( SRCROOT ) / . . / external / glfw3 / include / mac $ ( SRCROOT ) / . . / external / spidermonkey / include / mac $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos $ ( SRCROOT ) / . . / cocos / base $ ( SRCROOT ) / . . / cocos / 2d $ ( SRCROOT ) / . . / cocos / gui $ ( SRCROOT ) / . . / cocos / network $ ( SRCROOT ) / . . / cocos / audio / include $ ( SRCROOT ) / . . / cocos / editor - support $ ( SRCROOT ) / . . / extensions $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / external / chipmunk / include / chipmunk $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / auto $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / manual " ; <nl> VALIDATE_PRODUCT = YES ; <nl> } ; <nl> name = Release ; <nl> } ; <nl> - 507B42AE1C31E6070067B53E / * Debug * / = { <nl> + 50AC0E921C2A3CAA0065A4C7 / * Debug * / = { <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> + CODE_SIGN_IDENTITY = " iPhone Developer " ; <nl> + ENABLE_BITCODE = NO ; <nl> GCC_INLINES_ARE_PRIVATE_EXTERN = NO ; <nl> GCC_PRECOMPILE_PREFIX_HEADER = YES ; <nl> GCC_PREPROCESSOR_DEFINITIONS = ( <nl> " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> + CC_TARGET_OS_IPHONE , <nl> + CC_KEYBOARD_SUPPORT , <nl> COCOS2D_JAVASCRIPT , <nl> ) ; <nl> GCC_TREAT_WARNINGS_AS_ERRORS = NO ; <nl> INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / js - tests / project / proj . ios / Info . plist " ; <nl> - LIBRARY_SEARCH_PATHS = ( <nl> - " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> - " / Users / cocos2d / MyWork / cocos2d - x - develop / external / curl / prebuilt / ios " , <nl> - ) ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> + IPHONEOS_DEPLOYMENT_TARGET = 6 . 0 ; <nl> + PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . js - memory - gc - tests - iOS " ; <nl> PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES ; <nl> - SDKROOT = appletvos ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos $ ( SRCROOT ) / . . / cocos / base $ ( SRCROOT ) / . . / cocos / 2d $ ( SRCROOT ) / . . / cocos / gui $ ( SRCROOT ) / . . / cocos / network $ ( SRCROOT ) / . . / cocos / audio / include $ ( SRCROOT ) / . . / cocos / editor - support $ ( SRCROOT ) / . . / extensions $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / external / chipmunk / include / chipmunk $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / auto $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / manual $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / external / spidermonkey / include / ios $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> + SDKROOT = iphoneos ; <nl> + TARGETED_DEVICE_FAMILY = " 1 , 2 " ; <nl> + USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / external / spidermonkey / include / ios $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos $ ( SRCROOT ) / . . / extensions $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / auto $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / manual $ ( SRCROOT ) / . . / cocos / audio / include " ; <nl> + VALID_ARCHS = " arm64 armv7 " ; <nl> } ; <nl> name = Debug ; <nl> } ; <nl> - 507B42AF1C31E6070067B53E / * Release * / = { <nl> + 50AC0E931C2A3CAA0065A4C7 / * Release * / = { <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> + CODE_SIGN_IDENTITY = " iPhone Developer " ; <nl> + ENABLE_BITCODE = NO ; <nl> GCC_GENERATE_DEBUGGING_SYMBOLS = NO ; <nl> GCC_INLINES_ARE_PRIVATE_EXTERN = NO ; <nl> GCC_PRECOMPILE_PREFIX_HEADER = YES ; <nl> GCC_PREPROCESSOR_DEFINITIONS = ( <nl> " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> + CC_TARGET_OS_IPHONE , <nl> + CC_KEYBOARD_SUPPORT , <nl> COCOS2D_JAVASCRIPT , <nl> ) ; <nl> GCC_TREAT_WARNINGS_AS_ERRORS = NO ; <nl> INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / js - tests / project / proj . ios / Info . plist " ; <nl> - LIBRARY_SEARCH_PATHS = ( <nl> - " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> - " / Users / cocos2d / MyWork / cocos2d - x - develop / external / curl / prebuilt / ios " , <nl> - ) ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> - PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES ; <nl> - SDKROOT = appletvos ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos $ ( SRCROOT ) / . . / cocos / base $ ( SRCROOT ) / . . / cocos / 2d $ ( SRCROOT ) / . . / cocos / gui $ ( SRCROOT ) / . . / cocos / network $ ( SRCROOT ) / . . / cocos / audio / include $ ( SRCROOT ) / . . / cocos / editor - support $ ( SRCROOT ) / . . / extensions $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / external / chipmunk / include / chipmunk $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / auto $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / manual $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / external / spidermonkey / include / ios $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> - VALIDATE_PRODUCT = YES ; <nl> - } ; <nl> - name = Release ; <nl> - } ; <nl> - 507B43591C31FB350067B53E / * Debug * / = { <nl> - isa = XCBuildConfiguration ; <nl> - buildSettings = { <nl> - PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - } ; <nl> - name = Debug ; <nl> - } ; <nl> - 507B435A1C31FB350067B53E / * Release * / = { <nl> - isa = XCBuildConfiguration ; <nl> - buildSettings = { <nl> - PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - } ; <nl> - name = Release ; <nl> - } ; <nl> - 507B43B71C31FB670067B53E / * Debug * / = { <nl> - isa = XCBuildConfiguration ; <nl> - buildSettings = { <nl> - GCC_PREPROCESSOR_DEFINITIONS = ( <nl> - " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> - ) ; <nl> - INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / lua - tests / project / proj . ios_mac / ios / Info . plist " ; <nl> - IPHONEOS_DEPLOYMENT_TARGET = 6 . 0 ; <nl> - LIBRARY_SEARCH_PATHS = ( <nl> - " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> - " / Users / cocos2d / MyWork / cocos2d - x - develop / external / curl / prebuilt / ios " , <nl> - ) ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2dx . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> - PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - SDKROOT = appletvos ; <nl> - TARGETED_DEVICE_FAMILY = " 1 , 2 " ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / external / lua / luajit / include $ ( SRCROOT ) / . . / external / lua / tolua $ ( SRCROOT ) / . . / cocos / scripting / lua - bindings / manual $ ( SRCROOT ) / . . / cocos / scripting / lua - bindings / auto $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> - } ; <nl> - name = Debug ; <nl> - } ; <nl> - 507B43B81C31FB670067B53E / * Release * / = { <nl> - isa = XCBuildConfiguration ; <nl> - buildSettings = { <nl> - GCC_PREPROCESSOR_DEFINITIONS = ( <nl> - " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> - ) ; <nl> - INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / lua - tests / project / proj . ios_mac / ios / Info . plist " ; <nl> IPHONEOS_DEPLOYMENT_TARGET = 6 . 0 ; <nl> - LIBRARY_SEARCH_PATHS = ( <nl> - " $ ( SRCROOT ) / . . / external / curl / prebuilt / ios " , <nl> - " / Users / cocos2d / MyWork / cocos2d - x - develop / external / curl / prebuilt / ios " , <nl> - ) ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2dx . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> + PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . js - memory - gc - tests - iOS " ; <nl> PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - SDKROOT = appletvos ; <nl> + SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES ; <nl> + SDKROOT = iphoneos ; <nl> TARGETED_DEVICE_FAMILY = " 1 , 2 " ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / external / lua / luajit / include $ ( SRCROOT ) / . . / external / lua / tolua $ ( SRCROOT ) / . . / cocos / scripting / lua - bindings / manual $ ( SRCROOT ) / . . / cocos / scripting / lua - bindings / auto $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> - VALIDATE_PRODUCT = YES ; <nl> - } ; <nl> - name = Release ; <nl> - } ; <nl> - 507B43F01C3201360067B53E / * Debug * / = { <nl> - isa = XCBuildConfiguration ; <nl> - buildSettings = { <nl> - GCC_PREPROCESSOR_DEFINITIONS = ( <nl> - " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> - ) ; <nl> - GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = " " ; <nl> - INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / game - controller - test / proj . ios / Info . plist " ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> - PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - SDKROOT = appletvos ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / cocos / platform / ios / Simulation $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> - } ; <nl> - name = Debug ; <nl> - } ; <nl> - 507B43F11C3201360067B53E / * Release * / = { <nl> - isa = XCBuildConfiguration ; <nl> - buildSettings = { <nl> - GCC_PREPROCESSOR_DEFINITIONS = ( <nl> - " $ ( inherited ) " , <nl> - CC_TARGET_OS_TVOS , <nl> - ) ; <nl> - GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = " " ; <nl> - INFOPLIST_FILE = " $ ( SRCROOT ) / . . / tests / game - controller - test / proj . ios / Info . plist " ; <nl> - PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> - PRODUCT_NAME = " $ ( TARGET_NAME ) " ; <nl> - SDKROOT = appletvos ; <nl> - USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / cocos / platform / ios / Simulation $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> + USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / external / spidermonkey / include / ios $ ( SRCROOT ) / . . $ ( SRCROOT ) / . . / cocos $ ( SRCROOT ) / . . / extensions $ ( SRCROOT ) / . . / external $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / auto $ ( SRCROOT ) / . . / cocos / scripting / js - bindings / manual $ ( SRCROOT ) / . . / cocos / audio / include " ; <nl> VALIDATE_PRODUCT = YES ; <nl> + VALID_ARCHS = " arm64 armv7 " ; <nl> } ; <nl> name = Release ; <nl> } ; <nl> <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> CODE_SIGN_IDENTITY = " iPhone Developer " ; <nl> + " CODE_SIGN_IDENTITY [ sdk = iphoneos * ] " = " iPhone Developer " ; <nl> ENABLE_BITCODE = NO ; <nl> GCC_PRECOMPILE_PREFIX_HEADER = YES ; <nl> GCC_PREFIX_HEADER = " . . / tests / cpp - tests / proj . ios / Prefix . pch " ; <nl> <nl> isa = XCBuildConfiguration ; <nl> buildSettings = { <nl> CODE_SIGN_IDENTITY = " iPhone Developer " ; <nl> + " CODE_SIGN_IDENTITY [ sdk = iphoneos * ] " = " iPhone Developer " ; <nl> ENABLE_BITCODE = NO ; <nl> GCC_PRECOMPILE_PREFIX_HEADER = YES ; <nl> GCC_PREFIX_HEADER = " . . / tests / cpp - tests / proj . ios / Prefix . pch " ; <nl> <nl> ) ; <nl> PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> PRODUCT_NAME = " performance - tests iOS " ; <nl> - PROVISIONING_PROFILE = " " ; <nl> SDKROOT = iphoneos ; <nl> TARGETED_DEVICE_FAMILY = " 1 , 2 " ; <nl> USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / cocos / platform / ios / Simulation $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> <nl> ) ; <nl> PRODUCT_BUNDLE_IDENTIFIER = " org . cocos2d - x . $ { PRODUCT_NAME : rfc1034identifier } " ; <nl> PRODUCT_NAME = " performance - tests iOS " ; <nl> - PROVISIONING_PROFILE = " " ; <nl> SDKROOT = iphoneos ; <nl> TARGETED_DEVICE_FAMILY = " 1 , 2 " ; <nl> USER_HEADER_SEARCH_PATHS = " $ ( inherited ) $ ( SRCROOT ) / . . / cocos / platform / ios $ ( SRCROOT ) / . . / cocos / platform / ios / Simulation $ ( SRCROOT ) / . . / external / curl / include / ios " ; <nl> <nl> defaultConfigurationIsVisible = 0 ; <nl> defaultConfigurationName = Debug ; <nl> } ; <nl> - 507B420A1C31BEA60067B53E / * Build configuration list for PBXNativeTarget " cpp - tests tvOS " * / = { <nl> - isa = XCConfigurationList ; <nl> - buildConfigurations = ( <nl> - 507B420B1C31BEA60067B53E / * Debug * / , <nl> - 507B420C1C31BEA60067B53E / * Release * / , <nl> - ) ; <nl> - defaultConfigurationIsVisible = 0 ; <nl> - defaultConfigurationName = Debug ; <nl> - } ; <nl> - 507B42AD1C31E6070067B53E / * Build configuration list for PBXNativeTarget " js - tests tvOS " * / = { <nl> - isa = XCConfigurationList ; <nl> - buildConfigurations = ( <nl> - 507B42AE1C31E6070067B53E / * Debug * / , <nl> - 507B42AF1C31E6070067B53E / * Release * / , <nl> - ) ; <nl> - defaultConfigurationIsVisible = 0 ; <nl> - defaultConfigurationName = Debug ; <nl> - } ; <nl> - 507B43581C31FB350067B53E / * Build configuration list for PBXAggregateTarget " build all tests tvOS " * / = { <nl> - isa = XCConfigurationList ; <nl> - buildConfigurations = ( <nl> - 507B43591C31FB350067B53E / * Debug * / , <nl> - 507B435A1C31FB350067B53E / * Release * / , <nl> - ) ; <nl> - defaultConfigurationIsVisible = 0 ; <nl> - defaultConfigurationName = Debug ; <nl> - } ; <nl> - 507B43B61C31FB670067B53E / * Build configuration list for PBXNativeTarget " lua - tests tvOS " * / = { <nl> + 507EE8711C24C94600839198 / * Build configuration list for PBXNativeTarget " js - tests - memory - gc Mac " * / = { <nl> isa = XCConfigurationList ; <nl> buildConfigurations = ( <nl> - 507B43B71C31FB670067B53E / * Debug * / , <nl> - 507B43B81C31FB670067B53E / * Release * / , <nl> + 507EE8721C24C94600839198 / * Debug * / , <nl> + 507EE8731C24C94600839198 / * Release * / , <nl> ) ; <nl> defaultConfigurationIsVisible = 0 ; <nl> defaultConfigurationName = Debug ; <nl> } ; <nl> - 507B43EF1C3201360067B53E / * Build configuration list for PBXNativeTarget " game - controller - test tvOS " * / = { <nl> + 50AC0E911C2A3CAA0065A4C7 / * Build configuration list for PBXNativeTarget " js - tests - memory - gc iOS " * / = { <nl> isa = XCConfigurationList ; <nl> buildConfigurations = ( <nl> - 507B43F01C3201360067B53E / * Debug * / , <nl> - 507B43F11C3201360067B53E / * Release * / , <nl> + 50AC0E921C2A3CAA0065A4C7 / * Debug * / , <nl> + 50AC0E931C2A3CAA0065A4C7 / * Release * / , <nl> ) ; <nl> defaultConfigurationIsVisible = 0 ; <nl> defaultConfigurationName = Debug ; <nl> diff - - git a / build / cocos2d_tests . xcodeproj / xcshareddata / xcschemes / js - tests - memory - gc Mac . xcscheme b / build / cocos2d_tests . xcodeproj / xcshareddata / xcschemes / js - tests - memory - gc Mac . xcscheme <nl> new file mode 100644 <nl> index 000000000000 . . 5733b208e805 <nl> mmm / dev / null <nl> ppp b / build / cocos2d_tests . xcodeproj / xcshareddata / xcschemes / js - tests - memory - gc Mac . xcscheme <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < Scheme <nl> + LastUpgradeVersion = " 0720 " <nl> + version = " 1 . 3 " > <nl> + < BuildAction <nl> + parallelizeBuildables = " YES " <nl> + buildImplicitDependencies = " YES " > <nl> + < BuildActionEntries > <nl> + < BuildActionEntry <nl> + buildForTesting = " YES " <nl> + buildForRunning = " YES " <nl> + buildForProfiling = " YES " <nl> + buildForArchiving = " YES " <nl> + buildForAnalyzing = " YES " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 507EE84B1C24C94600839198 " <nl> + BuildableName = " js - tests - memory - gc Mac . app " <nl> + BlueprintName = " js - tests - memory - gc Mac " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / BuildActionEntry > <nl> + < / BuildActionEntries > <nl> + < / BuildAction > <nl> + < TestAction <nl> + buildConfiguration = " Debug " <nl> + selectedDebuggerIdentifier = " Xcode . DebuggerFoundation . Debugger . LLDB " <nl> + selectedLauncherIdentifier = " Xcode . DebuggerFoundation . Launcher . LLDB " <nl> + shouldUseLaunchSchemeArgsEnv = " YES " > <nl> + < Testables > <nl> + < / Testables > <nl> + < MacroExpansion > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 507EE84B1C24C94600839198 " <nl> + BuildableName = " js - tests - memory - gc Mac . app " <nl> + BlueprintName = " js - tests - memory - gc Mac " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / MacroExpansion > <nl> + < AdditionalOptions > <nl> + < / AdditionalOptions > <nl> + < / TestAction > <nl> + < LaunchAction <nl> + buildConfiguration = " Debug " <nl> + selectedDebuggerIdentifier = " Xcode . DebuggerFoundation . Debugger . LLDB " <nl> + selectedLauncherIdentifier = " Xcode . DebuggerFoundation . Launcher . LLDB " <nl> + launchStyle = " 0 " <nl> + useCustomWorkingDirectory = " NO " <nl> + ignoresPersistentStateOnLaunch = " NO " <nl> + debugDocumentVersioning = " YES " <nl> + debugServiceExtension = " internal " <nl> + allowLocationSimulation = " YES " > <nl> + < BuildableProductRunnable <nl> + runnableDebuggingMode = " 0 " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 507EE84B1C24C94600839198 " <nl> + BuildableName = " js - tests - memory - gc Mac . app " <nl> + BlueprintName = " js - tests - memory - gc Mac " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / BuildableProductRunnable > <nl> + < AdditionalOptions > <nl> + < / AdditionalOptions > <nl> + < / LaunchAction > <nl> + < ProfileAction <nl> + buildConfiguration = " Release " <nl> + shouldUseLaunchSchemeArgsEnv = " YES " <nl> + savedToolIdentifier = " " <nl> + useCustomWorkingDirectory = " NO " <nl> + debugDocumentVersioning = " YES " > <nl> + < BuildableProductRunnable <nl> + runnableDebuggingMode = " 0 " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 507EE84B1C24C94600839198 " <nl> + BuildableName = " js - tests - memory - gc Mac . app " <nl> + BlueprintName = " js - tests - memory - gc Mac " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / BuildableProductRunnable > <nl> + < / ProfileAction > <nl> + < AnalyzeAction <nl> + buildConfiguration = " Debug " > <nl> + < / AnalyzeAction > <nl> + < ArchiveAction <nl> + buildConfiguration = " Release " <nl> + revealArchiveInOrganizer = " YES " > <nl> + < / ArchiveAction > <nl> + < / Scheme > <nl> diff - - git a / build / cocos2d_tests . xcodeproj / xcshareddata / xcschemes / js - tests - memory - gc iOS . xcscheme b / build / cocos2d_tests . xcodeproj / xcshareddata / xcschemes / js - tests - memory - gc iOS . xcscheme <nl> new file mode 100644 <nl> index 000000000000 . . ac1ed9615ff1 <nl> mmm / dev / null <nl> ppp b / build / cocos2d_tests . xcodeproj / xcshareddata / xcschemes / js - tests - memory - gc iOS . xcscheme <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < Scheme <nl> + LastUpgradeVersion = " 0720 " <nl> + version = " 1 . 3 " > <nl> + < BuildAction <nl> + parallelizeBuildables = " YES " <nl> + buildImplicitDependencies = " YES " > <nl> + < BuildActionEntries > <nl> + < BuildActionEntry <nl> + buildForTesting = " YES " <nl> + buildForRunning = " YES " <nl> + buildForProfiling = " YES " <nl> + buildForArchiving = " YES " <nl> + buildForAnalyzing = " YES " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 50AC0E6E1C2A3CAA0065A4C7 " <nl> + BuildableName = " js - tests - memory - gc iOS . app " <nl> + BlueprintName = " js - tests - memory - gc iOS " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / BuildActionEntry > <nl> + < / BuildActionEntries > <nl> + < / BuildAction > <nl> + < TestAction <nl> + buildConfiguration = " Debug " <nl> + selectedDebuggerIdentifier = " Xcode . DebuggerFoundation . Debugger . LLDB " <nl> + selectedLauncherIdentifier = " Xcode . DebuggerFoundation . Launcher . LLDB " <nl> + shouldUseLaunchSchemeArgsEnv = " YES " > <nl> + < Testables > <nl> + < / Testables > <nl> + < MacroExpansion > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 50AC0E6E1C2A3CAA0065A4C7 " <nl> + BuildableName = " js - tests - memory - gc iOS . app " <nl> + BlueprintName = " js - tests - memory - gc iOS " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / MacroExpansion > <nl> + < AdditionalOptions > <nl> + < / AdditionalOptions > <nl> + < / TestAction > <nl> + < LaunchAction <nl> + buildConfiguration = " Debug " <nl> + selectedDebuggerIdentifier = " Xcode . DebuggerFoundation . Debugger . LLDB " <nl> + selectedLauncherIdentifier = " Xcode . DebuggerFoundation . Launcher . LLDB " <nl> + launchStyle = " 0 " <nl> + useCustomWorkingDirectory = " NO " <nl> + ignoresPersistentStateOnLaunch = " NO " <nl> + debugDocumentVersioning = " YES " <nl> + debugServiceExtension = " internal " <nl> + allowLocationSimulation = " YES " > <nl> + < BuildableProductRunnable <nl> + runnableDebuggingMode = " 0 " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 50AC0E6E1C2A3CAA0065A4C7 " <nl> + BuildableName = " js - tests - memory - gc iOS . app " <nl> + BlueprintName = " js - tests - memory - gc iOS " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / BuildableProductRunnable > <nl> + < AdditionalOptions > <nl> + < / AdditionalOptions > <nl> + < / LaunchAction > <nl> + < ProfileAction <nl> + buildConfiguration = " Release " <nl> + shouldUseLaunchSchemeArgsEnv = " YES " <nl> + savedToolIdentifier = " " <nl> + useCustomWorkingDirectory = " NO " <nl> + debugDocumentVersioning = " YES " > <nl> + < BuildableProductRunnable <nl> + runnableDebuggingMode = " 0 " > <nl> + < BuildableReference <nl> + BuildableIdentifier = " primary " <nl> + BlueprintIdentifier = " 50AC0E6E1C2A3CAA0065A4C7 " <nl> + BuildableName = " js - tests - memory - gc iOS . app " <nl> + BlueprintName = " js - tests - memory - gc iOS " <nl> + ReferencedContainer = " container : cocos2d_tests . xcodeproj " > <nl> + < / BuildableReference > <nl> + < / BuildableProductRunnable > <nl> + < / ProfileAction > <nl> + < AnalyzeAction <nl> + buildConfiguration = " Debug " > <nl> + < / AnalyzeAction > <nl> + < ArchiveAction <nl> + buildConfiguration = " Release " <nl> + revealArchiveInOrganizer = " YES " > <nl> + < / ArchiveAction > <nl> + < / Scheme > <nl> mmm a / cocos / 2d / CCSprite . cpp <nl> ppp b / cocos / 2d / CCSprite . cpp <nl> Sprite : : Sprite ( void ) <nl> # endif / / CC_SPRITE_DEBUG_DRAW <nl> } <nl> <nl> - Sprite : : ~ Sprite ( void ) <nl> + Sprite : : ~ Sprite ( ) <nl> { <nl> CC_SAFE_RELEASE ( _spriteFrame ) ; <nl> CC_SAFE_RELEASE ( _texture ) ; <nl> mmm a / cocos / 2d / CCTransition . cpp <nl> ppp b / cocos / 2d / CCTransition . cpp <nl> TransitionScene * TransitionScene : : create ( float t , Scene * scene ) <nl> <nl> bool TransitionScene : : initWithDuration ( float t , Scene * scene ) <nl> { <nl> - CCASSERT ( scene ! = nullptr , " Argument scene must be non - nil " ) ; <nl> + CCASSERT ( scene ! = nullptr , " Argument scene must be non - nil " ) ; <nl> <nl> if ( Scene : : init ( ) ) <nl> { <nl> mmm a / cocos / base / CCDirector . cpp <nl> ppp b / cocos / base / CCDirector . cpp <nl> void Director : : setNextScene ( ) <nl> { <nl> _runningScene - > onEnter ( ) ; <nl> _runningScene - > onEnterTransitionDidFinish ( ) ; <nl> + <nl> + # if CC_ENABLE_SCRIPT_BINDING <nl> + ScriptEngineManager : : getInstance ( ) - > getScriptEngine ( ) - > garbageCollect ( ) ; <nl> + # endif / / CC_ENABLE_SCRIPT_BINDING <nl> } <nl> } <nl> <nl> mmm a / cocos / base / CCScriptSupport . h <nl> ppp b / cocos / base / CCScriptSupport . h <nl> class CC_DLL ScriptEngineProtocol <nl> It tells the Garbage Collector that the associated Scripting object can be collected <nl> * / <nl> virtual void unrootObject ( Ref * obj ) { } <nl> + <nl> + / * * Triggers the garbage collector * / <nl> + virtual void garbageCollect ( ) { } <nl> } ; <nl> <nl> class Node ; <nl> mmm a / cocos / scripting / js - bindings / manual / ScriptingCore . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / ScriptingCore . cpp <nl> static void serverEntryPoint ( unsigned int port ) ; <nl> std : : unordered_map < std : : string , js_type_class_t * > _js_global_type_map ; <nl> static std : : unordered_map < void * , js_proxy_t * > _native_js_global_map ; <nl> static std : : unordered_map < JSObject * , js_proxy_t * > _js_native_global_map ; <nl> - <nl> + static std : : unordered_map < JSObject * , JSObject * > _extended_objects_map ; <nl> <nl> static char * _js_log_buf = NULL ; <nl> <nl> static std : : vector < sc_register_sth > registrationList ; <nl> <nl> + <nl> / / name ~ > JSScript map <nl> static std : : unordered_map < std : : string , JSScript * > filename_script ; <nl> / / port ~ > socket map <nl> static std : : unordered_map < int , int > ports_sockets ; <nl> <nl> + / / forward declarations <nl> + static void js_register_nativefinalizeme ( JSContext * cx , JS : : HandleObject global ) ; <nl> + <nl> static void cc_closesocket ( int fd ) <nl> { <nl> # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_WIN32 | | CC_TARGET_PLATFORM = = CC_PLATFORM_WINRT ) <nl> void registerDefaultClasses ( JSContext * cx , JS : : HandleObject global ) { <nl> JS_DefineFunction ( cx , global , " __restartVM " , JSB_core_restartVM , 0 , JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE ) ; <nl> JS_DefineFunction ( cx , global , " __cleanScript " , JSB_cleanScript , 1 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> JS_DefineFunction ( cx , global , " __isObjectValid " , ScriptingCore : : isObjectValid , 1 , JSPROP_READONLY | JSPROP_PERMANENT ) ; <nl> + <nl> + js_register_nativefinalizeme ( cx , jsc ) ; <nl> } <nl> <nl> static void sc_finalize ( JSFreeOp * freeOp , JSObject * obj ) <nl> static const JSClass global_class = { <nl> JS_GlobalObjectTraceHook <nl> } ; <nl> <nl> + static JSClass * jsb_nativefinalizeme_class ; <nl> + static JSObject * jsb_nativefinalizeme_prototype ; <nl> + <nl> + static bool js_nativefinalizeme_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + <nl> + # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> + <nl> + if ( argc = = 1 ) <nl> + { <nl> + auto extendedjsobj = args . get ( 0 ) . toObjectOrNull ( ) ; <nl> + if ( extendedjsobj ) <nl> + { <nl> + JS : : RootedObject proto ( cx , jsb_nativefinalizeme_prototype ) ; <nl> + JS : : RootedObject obj ( cx , JS_NewObject ( cx , jsb_nativefinalizeme_class , proto , JS : : NullPtr ( ) ) ) ; <nl> + args . rval ( ) . set ( OBJECT_TO_JSVAL ( obj ) ) ; <nl> + <nl> + if ( _extended_objects_map . find ( obj . get ( ) ) = = _extended_objects_map . end ( ) ) <nl> + _extended_objects_map [ obj . get ( ) ] = extendedjsobj ; <nl> + else CCLOG ( " js_nativefinalizeme_constructor : obj = % p already added . ERROR ! IMPOSSIBLE ! " , obj . get ( ) ) ; <nl> + return true ; <nl> + } <nl> + } <nl> + CCLOG ( " js_nativefinalizeme_constructor : Invalid arguments " ) ; <nl> + return false ; <nl> + <nl> + # else / / ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> + / / Don ' t create object if not using GC <nl> + args . rval ( ) . set ( JS : : NullValue ( ) ) ; <nl> + return true ; <nl> + # endif <nl> + } <nl> + <nl> + static void js_nativefinalizeme_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> + { <nl> + auto it = _extended_objects_map . find ( obj ) ; <nl> + if ( it ! = _extended_objects_map . end ( ) ) <nl> + { <nl> + auto extendedObj = it - > second ; <nl> + <nl> + / / XXX : Only works for " ref " subclasses . <nl> + jsb_ref_finalize ( fop , extendedObj ) ; <nl> + <nl> + _extended_objects_map . erase ( it ) ; <nl> + } <nl> + else CCLOG ( " js_nativefinalizeme_finalize : obj = % p not found . ERROR ! " , obj ) ; <nl> + } <nl> + <nl> + static void js_register_nativefinalizeme ( JSContext * cx , JS : : HandleObject global ) <nl> + { <nl> + jsb_nativefinalizeme_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> + jsb_nativefinalizeme_class - > name = " NativeFinalizeMe " ; <nl> + jsb_nativefinalizeme_class - > addProperty = JS_PropertyStub ; <nl> + jsb_nativefinalizeme_class - > delProperty = JS_DeletePropertyStub ; <nl> + jsb_nativefinalizeme_class - > getProperty = JS_PropertyStub ; <nl> + jsb_nativefinalizeme_class - > setProperty = JS_StrictPropertyStub ; <nl> + jsb_nativefinalizeme_class - > enumerate = JS_EnumerateStub ; <nl> + jsb_nativefinalizeme_class - > resolve = JS_ResolveStub ; <nl> + jsb_nativefinalizeme_class - > convert = JS_ConvertStub ; <nl> + jsb_nativefinalizeme_class - > finalize = js_nativefinalizeme_finalize ; <nl> + jsb_nativefinalizeme_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> + <nl> + static JSPropertySpec properties [ ] = { <nl> + JS_PS_END <nl> + } ; <nl> + <nl> + static JSFunctionSpec funcs [ ] = { <nl> + JS_FS_END <nl> + } ; <nl> + <nl> + static JSFunctionSpec st_funcs [ ] = { <nl> + JS_FS_END <nl> + } ; <nl> + <nl> + jsb_nativefinalizeme_prototype = JS_InitClass ( <nl> + cx , global , <nl> + JS : : NullPtr ( ) , <nl> + jsb_nativefinalizeme_class , <nl> + js_nativefinalizeme_constructor , 0 , / / constructor <nl> + properties , <nl> + funcs , <nl> + NULL , / / no static properties <nl> + st_funcs ) ; <nl> + } <nl> + <nl> ScriptingCore * ScriptingCore : : getInstance ( ) <nl> { <nl> static ScriptingCore * instance = nullptr ; <nl> bool ScriptingCore : : handleTouchesEvent ( void * nativeObj , cocos2d : : EventTouch : : Eve <nl> <nl> for ( const auto & touch : touches ) <nl> { <nl> - JS : : RootedValue jsret ( _cx , OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , touch , typeClassTouch , " cocos2d : : Touch " ) ) ) ; <nl> + JS : : RootedValue jsret ( _cx , OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , touch , typeClassTouch , " cocos2d : : Touch " ) ) ) ; <nl> if ( ! JS_SetElement ( this - > _cx , jsretArr , count , jsret ) ) <nl> { <nl> break ; <nl> bool ScriptingCore : : handleTouchesEvent ( void * nativeObj , cocos2d : : EventTouch : : Eve <nl> { <nl> jsval dataVal [ 2 ] ; <nl> dataVal [ 0 ] = OBJECT_TO_JSVAL ( jsretArr ) ; <nl> - dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , event , typeClassEvent , " cocos2d : : Event " ) ) ; <nl> + dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClassEvent , " cocos2d : : Event " ) ) ; <nl> ret = executeFunctionWithOwner ( OBJECT_TO_JSVAL ( p - > obj ) , funcName . c_str ( ) , 2 , dataVal , jsvalRet ) ; <nl> } <nl> <nl> bool ScriptingCore : : handleTouchEvent ( void * nativeObj , cocos2d : : EventTouch : : Event <nl> js_type_class_t * typeClassEvent = js_get_type_from_native < cocos2d : : Event > ( event ) ; <nl> <nl> jsval dataVal [ 2 ] ; <nl> - dataVal [ 0 ] = OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , touch , typeClassTouch , " cocos2d : : Touch " ) ) ; <nl> - dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , event , typeClassEvent , " cocos2d : : Event " ) ) ; <nl> + dataVal [ 0 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , touch , typeClassTouch , " cocos2d : : Touch " ) ) ; <nl> + dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClassEvent , " cocos2d : : Event " ) ) ; <nl> <nl> ret = executeFunctionWithOwner ( OBJECT_TO_JSVAL ( p - > obj ) , funcName . c_str ( ) , 2 , dataVal , jsvalRet ) ; <nl> } <nl> bool ScriptingCore : : handleMouseEvent ( void * nativeObj , cocos2d : : EventMouse : : Mouse <nl> if ( p ) <nl> { <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Event > ( event ) ; <nl> - jsval dataVal = OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , event , typeClass , " cocos2d : : Event " ) ) ; <nl> + jsval dataVal = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClass , " cocos2d : : Event " ) ) ; <nl> ret = executeFunctionWithOwner ( OBJECT_TO_JSVAL ( p - > obj ) , funcName . c_str ( ) , 1 , & dataVal , jsvalRet ) ; <nl> <nl> removeJSObject ( _cx , event ) ; <nl> bool ScriptingCore : : handleKeybardEvent ( void * nativeObj , cocos2d : : EventKeyboard : : <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Event > ( event ) ; <nl> jsval args [ 2 ] = { <nl> int32_to_jsval ( _cx , ( int32_t ) keyCode ) , <nl> - OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , event , typeClass , " cocos2d : : Event " ) ) <nl> + OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClass , " cocos2d : : Event " ) ) <nl> } ; <nl> <nl> if ( isPressed ) <nl> bool ScriptingCore : : handleFocusEvent ( void * nativeObj , cocos2d : : ui : : Widget * widge <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : ui : : Widget > ( widgetLoseFocus ) ; <nl> <nl> jsval args [ 2 ] = { <nl> - OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , widgetLoseFocus , typeClass , " cocos2d : : ui : : Widget " ) ) , <nl> - OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( _cx , widgetGetFocus , typeClass , " cocos2d : : ui : : Widget " ) ) <nl> + OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , widgetLoseFocus , typeClass , " cocos2d : : ui : : Widget " ) ) , <nl> + OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , widgetGetFocus , typeClass , " cocos2d : : ui : : Widget " ) ) <nl> } ; <nl> <nl> bool ret = executeFunctionWithOwner ( OBJECT_TO_JSVAL ( p - > obj ) , " onFocusChanged " , 2 , args ) ; <nl> int ScriptingCore : : executeCustomTouchesEvent ( EventTouch : : EventCode eventType , <nl> { <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Touch > ( touch ) ; <nl> <nl> - jsval jsret = OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> + jsval jsret = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> JS : : RootedValue jsval ( _cx , jsret ) ; <nl> if ( ! JS_SetElement ( this - > _cx , jsretArr , count , jsval ) ) { <nl> break ; <nl> int ScriptingCore : : executeCustomTouchEvent ( EventTouch : : EventCode eventType , Touc <nl> std : : string funcName = getTouchFuncName ( eventType ) ; <nl> <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Touch > ( touch ) ; <nl> - jsval jsTouch = OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> + jsval jsTouch = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> <nl> executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , funcName . c_str ( ) , 1 , & jsTouch , & retval ) ; <nl> <nl> int ScriptingCore : : executeCustomTouchEvent ( EventTouch : : EventCode eventType , <nl> std : : string funcName = getTouchFuncName ( eventType ) ; <nl> <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Touch > ( touch ) ; <nl> - jsval jsTouch = OBJECT_TO_JSVAL ( jsb_ref_get_or_create_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> + jsval jsTouch = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> <nl> executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , funcName . c_str ( ) , 1 , & jsTouch , retval ) ; <nl> <nl> void ScriptingCore : : rootObject ( Ref * ref ) <nl> JS : : AddNamedObjectRoot ( cx , & proxy - > obj , typeid ( * ref ) . name ( ) ) ; <nl> ref - > _rooted = true ; <nl> } <nl> - else CCLOG ( " rootObject : BUG . native not found : % p " , ref ) ; <nl> + else CCLOG ( " rootObject : BUG . native not found : % p ( % s ) " , ref , typeid ( * ref ) . name ( ) ) ; <nl> } <nl> <nl> void ScriptingCore : : unrootObject ( Ref * ref ) <nl> void ScriptingCore : : unrootObject ( Ref * ref ) <nl> JS : : RemoveObjectRoot ( cx , & proxy - > obj ) ; <nl> ref - > _rooted = false ; <nl> } <nl> - else CCLOG ( " unrootObject : BUG . native not found : % p " , ref ) ; <nl> + else CCLOG ( " unrootObject : BUG . native not found : % p ( % s ) " , ref , typeid ( * ref ) . name ( ) ) ; <nl> + } <nl> + <nl> + void ScriptingCore : : garbageCollect ( ) <nl> + { <nl> + # if CC_TARGET_PLATFORM ! = CC_PLATFORM_WIN32 <nl> + auto runtime = JS_GetRuntime ( _cx ) ; <nl> + / / twice : yep , call it twice since this is a generational GC <nl> + / / and we want to collect as much as possible when this is being called <nl> + / / from replaceScene ( ) . <nl> + JS_GC ( runtime ) ; <nl> + JS_GC ( runtime ) ; <nl> + # endif <nl> } <nl> <nl> # pragma mark - Debug <nl> JSObject * jsb_ref_autoreleased_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , <nl> } <nl> <nl> / / get_or_create <nl> - JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) <nl> + JS : : HandleObject jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) <nl> { <nl> auto proxy = jsb_get_native_proxy ( ref ) ; <nl> - if ( proxy ) <nl> - return proxy - > obj ; <nl> + if ( proxy ) { <nl> + JS : : RootedObject obj ( cx , proxy - > obj ) ; <nl> + return obj ; <nl> + } <nl> <nl> / / don ' t auto - release , don ' t retain . <nl> JS : : RootedObject proto ( cx , typeClass - > proto . ref ( ) ) ; <nl> JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_ty <nl> return js_obj ; <nl> } <nl> <nl> + / / get_or_create : when native object isn ' t a ref object or when the native object life cycle don ' t need to be managed by js object <nl> + JS : : HandleObject jsb_get_or_create_weak_jsobject ( JSContext * cx , void * native , js_type_class_t * typeClass , const char * debug ) <nl> + { <nl> + auto proxy = jsb_get_native_proxy ( native ) ; <nl> + if ( proxy ) <nl> + { <nl> + JS : : RootedObject obj ( cx , proxy - > obj ) ; <nl> + return obj ; <nl> + } <nl> + <nl> + / / don ' t auto - release , don ' t retain . <nl> + JS : : RootedObject proto ( cx , typeClass - > proto . ref ( ) ) ; <nl> + JS : : RootedObject parent ( cx , typeClass - > parentProto . ref ( ) ) ; <nl> + JS : : RootedObject jsObj ( cx , JS_NewObject ( cx , typeClass - > jsclass , proto , parent ) ) ; <nl> + proxy = jsb_new_proxy ( native , jsObj ) ; <nl> + <nl> + # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> + / / do nothing <nl> + # else <nl> + JS : : AddNamedObjectRoot ( cx , & proxy - > obj , debug ) ; <nl> + # endif / / CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> + return jsObj ; <nl> + } <nl> + <nl> / / get_or_create : REf is already autoreleased ( or created ) <nl> JSObject * jsb_ref_autoreleased_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) <nl> { <nl> void jsb_ref_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> if ( proxy ) <nl> { <nl> auto ref = static_cast < cocos2d : : Ref * > ( proxy - > ptr ) ; <nl> + <nl> + CCLOG ( " jsb_ref_finalize : % s " , typeid ( * ref ) . name ( ) ) ; <nl> + <nl> jsb_remove_proxy ( proxy ) ; <nl> if ( ref ) <nl> ref - > release ( ) ; <nl> } <nl> - else <nl> - { <nl> - CCLOG ( " jsb_ref_finalize : BUG : proxy not found for % p ( % s ) " , obj , JS_GetClass ( obj ) - > name ) ; <nl> - } <nl> + / / else CCLOG ( " jsb_ref_finalize : BUG : proxy not found for % p ( % s ) " , obj , JS_GetClass ( obj ) - > name ) ; <nl> # else <nl> / / CCLOG ( " jsb_ref_finalize : JSObject address = % p " , obj ) ; <nl> # endif <nl> void jsb_ref_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> / / rebind <nl> void jsb_ref_rebind ( JSContext * cx , JS : : HandleObject jsobj , js_proxy_t * proxy , cocos2d : : Ref * oldRef , cocos2d : : Ref * newRef , const char * debug ) <nl> { <nl> + oldRef - > _scriptOwned = false ; <nl> + <nl> # if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> JS : : RemoveObjectRoot ( cx , & proxy - > obj ) ; <nl> # endif <nl> mmm a / cocos / scripting / js - bindings / manual / ScriptingCore . h <nl> ppp b / cocos / scripting / js - bindings / manual / ScriptingCore . h <nl> class CC_JS_DLL ScriptingCore : public cocos2d : : ScriptEngineProtocol <nl> * / <nl> virtual void unrootObject ( cocos2d : : Ref * ref ) override ; <nl> <nl> + / * * <nl> + * Calls the Garbage Collector <nl> + * / <nl> + virtual void garbageCollect ( ) override ; <nl> + <nl> private : <nl> void string_report ( JS : : HandleValue val ) ; <nl> void initRegister ( ) ; <nl> JSObject * jsb_ref_autoreleased_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , <nl> If it can ' t find it , it will create a new one associating it to Ref . <nl> Call this function for objects that were already created and initialized , when returning ` getChild ( ) ` <nl> * / <nl> - JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> + JS : : HandleObject jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> <nl> / * * <nl> It will try to get the associated JSObjct for ref . <nl> JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_ty <nl> * / <nl> JSObject * jsb_ref_autoreleased_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> <nl> + <nl> + JS : : HandleObject jsb_get_or_create_weak_jsobject ( JSContext * cx , void * native , js_type_class_t * typeClass , const char * debug ) ; <nl> + <nl> # endif / * __SCRIPTING_CORE_H__ * / <nl> mmm a / cocos / scripting / js - bindings / manual / cocos2d_specifics . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / cocos2d_specifics . cpp <nl> bool js_cocos2dx_ActionInterval_repeat ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> if ( timesInt < = 0 ) { <nl> JS_ReportError ( cx , " js_cocos2dx_ActionInterval_repeat : Repeat times must be greater than 0 " ) ; <nl> } <nl> - <nl> + <nl> + / / no longer owned since it will be re - bound <nl> + cobj - > _scriptOwned = false ; <nl> + <nl> cocos2d : : Repeat * action = new ( std : : nothrow ) cocos2d : : Repeat ; <nl> action - > initWithAction ( cobj , timesInt ) ; <nl> jsb_ref_rebind ( cx , obj , proxy , cobj , action , " cocos2d : : Repeat " ) ; <nl> bool js_cocos2dx_ActionInterval_repeatForever ( JSContext * cx , uint32_t argc , jsva <nl> JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ActionInterval_repeatForever : Invalid Native Object " ) ; <nl> <nl> if ( argc = = 0 ) { <nl> + <nl> + / / no longer owned . <nl> + cobj - > _scriptOwned = false ; <nl> + <nl> cocos2d : : RepeatForever * action = new ( std : : nothrow ) cocos2d : : RepeatForever ; <nl> action - > initWithAction ( cobj ) ; <nl> <nl> jsb_ref_rebind ( cx , jsobj , proxy , cobj , action , " cocos2d : : RepeatForever " ) ; <nl> + <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( jsobj ) ) ; <nl> return true ; <nl> } <nl> bool js_cocos2dx_ActionInterval_speed ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> JS_ReportError ( cx , " js_cocos2dx_ActionInterval_speed : Speed must not be negative " ) ; <nl> return false ; <nl> } <nl> - <nl> + <nl> + / / no longer owned since it is going to be re - bound <nl> + cobj - > _scriptOwned = false ; <nl> + <nl> cocos2d : : Speed * action = new ( std : : nothrow ) cocos2d : : Speed ; <nl> action - > initWithAction ( cobj , speed ) ; <nl> jsb_ref_rebind ( cx , obj , proxy , cobj , action , " cocos2d : : Speed " ) ; <nl> bool js_cocos2dx_ActionInterval_easing ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> double tag ; <nl> double parameter ; <nl> <nl> + / / no longer owned since it will be re - bound <nl> + oldAction - > _scriptOwned = false ; <nl> + <nl> for ( int i = 0 ; i < argc ; i + + ) <nl> { <nl> / / jsval vpi = argv [ i ] ; <nl> mmm a / cocos / scripting / js - bindings / script / jsb_prepare . js <nl> ppp b / cocos / scripting / js - bindings / script / jsb_prepare . js <nl> cc . Class . extend = function ( prop ) { <nl> cc . log ( " No ctor function found ! Please check whether ` classes_need_extend ` section in ` ini ` file like which in ` tools / tojs / cocos2dx . ini ` " ) ; <nl> } <nl> else { <nl> + / / " extended " object won ' t use the native finalize <nl> + / / will will guarantee that the clean - up of the native <nl> + / / object will called <nl> + this . __finalizeMe = new __jsc__ . NativeFinalizeMe ( this ) ; <nl> this . ctor . apply ( this , arguments ) ; <nl> } <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . b62bcef23eb4 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / . cocos - project . json <nl> <nl> + { <nl> + " project_type " : " js " , <nl> + " has_native " : true , <nl> + " win32_cfg " : { <nl> + " project_path " : " . . / . . / build " , <nl> + " sln_file " : " cocos2d - win32 . sln " , <nl> + " project_name " : " js - tests " , <nl> + " build_cfg_path " : " project / proj . win32 " , <nl> + " exe_out_dir " : " js - tests " <nl> + } , <nl> + " ios_cfg " : { <nl> + " project_path " : " . . / . . / build " , <nl> + " project_file " : " cocos2d_tests . xcodeproj " , <nl> + " target_name " : " js - tests iOS " <nl> + } , <nl> + " mac_cfg " : { <nl> + " project_path " : " . . / . . / build " , <nl> + " project_file " : " cocos2d_tests . xcodeproj " , <nl> + " target_name " : " js - tests Mac " <nl> + } , <nl> + " android_cfg " : { <nl> + " project_path " : " project / proj . android " , <nl> + " studio_proj_path " : " project / proj . android - studio " <nl> + } , <nl> + " web_cfg " : { <nl> + " project_path " : " " , <nl> + " run_root_dir " : " . . / . . / " , <nl> + " sub_url " : " / tests / js - tests / " , <nl> + " copy_resources " : [ <nl> + { <nl> + " from " : " . . / cpp - tests / Resources / " , <nl> + " to " : " res / " <nl> + } , <nl> + { <nl> + " from " : " resjs " , <nl> + " to " : " res / " <nl> + } <nl> + ] <nl> + } , <nl> + " linux_cfg " : { <nl> + " project_path " : " project / proj . linux " , <nl> + " project_name " : " js - tests " , <nl> + " cmake_path " : " . . / . . / " , <nl> + " build_dir " : " . . / . . / build / linux - build " , <nl> + " build_result_dir " : " js - tests " <nl> + } , <nl> + " wp8_1_cfg " : { <nl> + " project_path " : " . . / . . / build " , <nl> + " sln_file " : " cocos2d - win8 . 1 - universal . sln " , <nl> + " project_name " : " js - tests . WindowsPhone " <nl> + } , <nl> + " metro_cfg " : { <nl> + " project_path " : " . . / . . / build " , <nl> + " sln_file " : " cocos2d - win8 . 1 - universal . sln " , <nl> + " project_name " : " js - tests . Windows " <nl> + } , <nl> + " engine_dir " : " . . / . . / " <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 625d5f58ed40 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / main . js <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2010 - 2012 cocos2d - x . org <nl> + Copyright ( c ) 2008 - 2010 Ricardo Quesada <nl> + Copyright ( c ) 2011 Zynga Inc . <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * A brief explanation for " project . json " : <nl> + * Here is the content of project . json file , this is the global configuration for your game , you can modify it to customize some behavior . <nl> + * The detail of each field is under it . <nl> + { <nl> + " debugMode " : 1 , <nl> + / / " debugMode " possible values : <nl> + / / 0 - No message will be printed . <nl> + / / 1 - cc . error , cc . assert , cc . warn , cc . log will print in console . <nl> + / / 2 - cc . error , cc . assert , cc . warn will print in console . <nl> + / / 3 - cc . error , cc . assert will print in console . <nl> + / / 4 - cc . error , cc . assert , cc . warn , cc . log will print on canvas , available only on web . <nl> + / / 5 - cc . error , cc . assert , cc . warn will print on canvas , available only on web . <nl> + / / 6 - cc . error , cc . assert will print on canvas , available only on web . <nl> + <nl> + " showFPS " : true , <nl> + / / Left bottom corner fps information will show when " showFPS " equals true , otherwise it will be hide . <nl> + <nl> + " frameRate " : 60 , <nl> + / / " frameRate " set the wanted frame rate for your game , but the real fps depends on your game implementation and the running environment . <nl> + <nl> + " noCache " : false , <nl> + / / " noCache " set whether your resources will be loaded with a timestamp suffix in the url . <nl> + / / In this way , your resources will be force updated even if the browser holds a cache of it . <nl> + / / It ' s very useful for mobile browser debuging . <nl> + <nl> + " id " : " gameCanvas " , <nl> + / / " gameCanvas " sets the id of your canvas element on the web page , it ' s useful only on web . <nl> + <nl> + " renderMode " : 0 , <nl> + / / " renderMode " sets the renderer type , only useful on web : <nl> + / / 0 - Automatically chosen by engine <nl> + / / 1 - Forced to use canvas renderer <nl> + / / 2 - Forced to use WebGL renderer , but this will be ignored on mobile browsers <nl> + <nl> + " engineDir " : " . . / . . / frameworks / cocos2d - html5 / " , <nl> + / / In debug mode , if you use the whole engine to develop your game , you should specify its relative path with " engineDir " , <nl> + / / but if you are using a single engine file , you can ignore it . <nl> + <nl> + " modules " : [ " cocos2d " , " extensions " , " external " ] , <nl> + / / " modules " defines which modules you will need in your game , it ' s useful only on web , <nl> + / / using this can greatly reduce your game ' s resource size , and the cocos console tool can package your game with only the modules you set . <nl> + / / For details about modules definitions , you can refer to " . . / . . / frameworks / cocos2d - html5 / modulesConfig . json " . <nl> + <nl> + " plugin " : { <nl> + " facebook " : { <nl> + " appId " : " 1426774790893461 " , <nl> + " xfbml " : true , <nl> + " version " : " v2 . 0 " <nl> + } <nl> + } , <nl> + / / " plugin " is used by plugin - x for its settings , if you don ' t use it , you can ignore it . <nl> + <nl> + " jsList " : [ <nl> + ] <nl> + / / " jsList " sets the list of js files in your game . <nl> + } <nl> + * <nl> + * / <nl> + <nl> + if ( cc . sys ) { <nl> + var scene3SearchPaths = cc . sys . localStorage . getItem ( " Scene3SearchPaths " ) ; <nl> + if ( scene3SearchPaths ) <nl> + jsb . fileUtils . setSearchPaths ( JSON . parse ( scene3SearchPaths ) ) ; <nl> + } <nl> + <nl> + cc . game . onStart = function ( ) { <nl> + cc . view . enableRetina ( false ) ; <nl> + if ( cc . sys . isNative ) { <nl> + var resolutionPolicy = ( cc . sys . os = = cc . sys . OS_WP8 | | cc . sys . os = = cc . sys . OS_WINRT ) ? cc . ResolutionPolicy . SHOW_ALL : cc . ResolutionPolicy . FIXED_HEIGHT ; <nl> + cc . view . setDesignResolutionSize ( 800 , 450 , resolutionPolicy ) ; <nl> + cc . view . resizeWithBrowserSize ( true ) ; <nl> + var searchPaths = jsb . fileUtils . getSearchPaths ( ) ; <nl> + searchPaths . push ( ' script ' ) ; <nl> + searchPaths . push ( ' src ' ) ; <nl> + var paths = [ <nl> + ' res ' <nl> + ] ; <nl> + for ( var i = 0 ; i < paths . length ; i + + ) { <nl> + searchPaths . push ( paths [ i ] ) ; <nl> + } <nl> + jsb . fileUtils . setSearchPaths ( searchPaths ) ; <nl> + } <nl> + else <nl> + { <nl> + cc . view . setDesignResolutionSize ( 800 , 450 , cc . ResolutionPolicy . SHOW_ALL ) ; <nl> + cc . view . resizeWithBrowserSize ( true ) ; <nl> + / / js - test use cpptest resource in debug mode , and in the release mode , console will copy the resource into the res dir <nl> + / / so the respath will modify to res , <nl> + if ( cc . game . config [ cc . game . CONFIG_KEY . engineDir ] ! = = " frameworks / cocos2d - html5 " ) { <nl> + cc . loader . resPath = ' . . / cpp - tests / Resources ' ; <nl> + } <nl> + else { <nl> + cc . loader . resPath = ' res ' ; <nl> + document . getElementById ( " cocosbanner " ) . src = " res / Images / cocos2dbanner . png " ; <nl> + } <nl> + } <nl> + <nl> + cc . LoaderScene . preload ( [ ] , function ( ) { <nl> + runMain ( ) ; <nl> + } , this ) ; <nl> + } ; <nl> + cc . game . run ( ) ; <nl> new file mode 100644 <nl> index 000000000000 . . 8393725f4055 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project . json <nl> <nl> + { <nl> + " debugMode " : 1 , <nl> + " showFPS " : true , <nl> + " frameRate " : 60 , <nl> + " noCache " : false , <nl> + " id " : " gameCanvas " , <nl> + " renderMode " : 0 , <nl> + " engineDir " : " . . / . . / web / " , <nl> + <nl> + " modules " : [ " cocos2d " , " extensions " , " external " ] , <nl> + <nl> + " plugin " : { <nl> + " facebook " : { <nl> + " appId " : " 1426774790893461 " , <nl> + " xfbml " : true , <nl> + " version " : " v2 . 0 " <nl> + } <nl> + } , <nl> + <nl> + " jsList " : [ <nl> + " src / tests - main . js " <nl> + ] <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 04afe8b7e931 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / CMakeLists . txt <nl> <nl> + # / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + # Copyright ( c ) 2015 Chukong Technologies Inc . <nl> + # <nl> + # http : / / www . cocos2d - x . org <nl> + # <nl> + # Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + # of this software and associated documentation files ( the " Software " ) , to deal <nl> + # in the Software without restriction , including without limitation the rights <nl> + # to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + # copies of the Software , and to permit persons to whom the Software is <nl> + # furnished to do so , subject to the following conditions : <nl> + <nl> + # The above copyright notice and this permission notice shall be included in <nl> + # all copies or substantial portions of the Software . <nl> + <nl> + # THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + # IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + # LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + # THE SOFTWARE . <nl> + # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + set ( APP_NAME js - tests ) <nl> + <nl> + if ( WIN32 ) <nl> + <nl> + else ( ) <nl> + set ( PLATFORM_SRC <nl> + proj . linux / main . cpp <nl> + ) <nl> + endif ( ) <nl> + <nl> + set ( SAMPLE_SRC <nl> + Classes / AppDelegate . cpp <nl> + Classes / js_DrawNode3D_bindings . cpp <nl> + Classes / js_Effect3D_bindings . cpp <nl> + $ { PLATFORM_SRC } <nl> + ) <nl> + <nl> + include_directories ( <nl> + Classes <nl> + . . / . . / . . / cocos / scripting / js - bindings / auto <nl> + . . / . . / . . / cocos / scripting / js - bindings / manual <nl> + . . / . . / . . / cocos / base <nl> + . . / . . / . . / cocos / editor - support <nl> + . . / . . / . . / cocos / audio / include <nl> + . . / . . / . . / external / spidermonkey / include / $ { PLATFORM_FOLDER } <nl> + . . / . . / . . / external / chipmunk / include / chipmunk <nl> + ) <nl> + <nl> + # add the executable <nl> + add_executable ( $ { APP_NAME } <nl> + $ { SAMPLE_SRC } <nl> + ) <nl> + <nl> + target_link_libraries ( $ { APP_NAME } <nl> + jscocos2d <nl> + cocos2d <nl> + ) <nl> + <nl> + set ( APP_BIN_DIR " $ { CMAKE_BINARY_DIR } / bin / $ { APP_NAME } " ) <nl> + <nl> + set_target_properties ( $ { APP_NAME } PROPERTIES <nl> + RUNTIME_OUTPUT_DIRECTORY " $ { APP_BIN_DIR } " ) <nl> + <nl> + <nl> + if ( LINUX ) <nl> + set ( RES_PREFIX " / Resources " ) <nl> + else ( ) <nl> + set ( RES_PREFIX " " ) <nl> + endif ( ) <nl> + <nl> + pre_build ( $ { APP_NAME } <nl> + COMMAND $ { CMAKE_COMMAND } - E remove_directory $ { APP_BIN_DIR } $ { RES_PREFIX } / script <nl> + COMMAND $ { CMAKE_COMMAND } - E remove_directory $ { APP_BIN_DIR } $ { RES_PREFIX } / res <nl> + COMMAND $ { CMAKE_COMMAND } - E remove_directory $ { APP_BIN_DIR } $ { RES_PREFIX } / src <nl> + COMMAND $ { CMAKE_COMMAND } - E remove $ { APP_BIN_DIR } $ { RES_PREFIX } / * . js <nl> + COMMAND $ { CMAKE_COMMAND } - E remove $ { APP_BIN_DIR } $ { RES_PREFIX } / * . json <nl> + COMMAND $ { CMAKE_COMMAND } - E copy_directory $ { CMAKE_CURRENT_SOURCE_DIR } / . . / . . / cpp - tests / Resources $ { APP_BIN_DIR } $ { RES_PREFIX } / res <nl> + COMMAND $ { CMAKE_COMMAND } - E copy_directory $ { CMAKE_CURRENT_SOURCE_DIR } / . . / res $ { APP_BIN_DIR } $ { RES_PREFIX } / res <nl> + COMMAND $ { CMAKE_COMMAND } - E copy_directory $ { CMAKE_CURRENT_SOURCE_DIR } / . . / src $ { APP_BIN_DIR } $ { RES_PREFIX } / src <nl> + COMMAND $ { CMAKE_COMMAND } - E copy_directory $ { CMAKE_CURRENT_SOURCE_DIR } / . . / . . / . . / cocos / scripting / js - bindings / script $ { APP_BIN_DIR } $ { RES_PREFIX } / script <nl> + COMMAND $ { CMAKE_COMMAND } - E copy $ { CMAKE_CURRENT_SOURCE_DIR } / . . / main . js $ { APP_BIN_DIR } $ { RES_PREFIX } / main . js <nl> + COMMAND $ { CMAKE_COMMAND } - E copy $ { CMAKE_CURRENT_SOURCE_DIR } / . . / project . json $ { APP_BIN_DIR } $ { RES_PREFIX } / project . json <nl> + ) <nl> new file mode 100644 <nl> index 000000000000 . . e35b31fc0458 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / Classes / AppDelegate . cpp <nl> <nl> + # include " AppDelegate . h " <nl> + <nl> + # include " cocos2d . h " <nl> + # include " SimpleAudioEngine . h " <nl> + # include " ScriptingCore . h " <nl> + # include " jsb_cocos2dx_auto . hpp " <nl> + # include " jsb_cocos2dx_extension_auto . hpp " <nl> + # include " jsb_cocos2dx_builder_auto . hpp " <nl> + # include " jsb_cocos2dx_spine_auto . hpp " <nl> + # include " jsb_cocos2dx_3d_auto . hpp " <nl> + # include " jsb_cocos2dx_3d_extension_auto . hpp " <nl> + # include " jsb_cocos2dx_physics3d_auto . hpp " <nl> + # include " physics3d / jsb_cocos2dx_physics3d_manual . h " <nl> + # include " jsb_cocos2dx_navmesh_auto . hpp " <nl> + # include " navmesh / jsb_cocos2dx_navmesh_manual . h " <nl> + # include " 3d / jsb_cocos2dx_3d_manual . h " <nl> + # include " extension / jsb_cocos2dx_extension_manual . h " <nl> + # include " cocostudio / jsb_cocos2dx_studio_manual . h " <nl> + # include " jsb_cocos2dx_studio_auto . hpp " <nl> + # include " jsb_cocos2dx_ui_auto . hpp " <nl> + # include " ui / jsb_cocos2dx_ui_manual . h " <nl> + # include " spine / jsb_cocos2dx_spine_manual . h " <nl> + # include " cocos2d_specifics . hpp " <nl> + # include " cocosbuilder / cocosbuilder_specifics . hpp " <nl> + # include " chipmunk / js_bindings_chipmunk_registration . h " <nl> + # include " localstorage / js_bindings_system_registration . h " <nl> + # include " jsb_opengl_registration . h " <nl> + # include " network / XMLHTTPRequest . h " <nl> + # include " network / jsb_websocket . h " <nl> + # include " network / jsb_socketio . h " <nl> + # include " cocosbuilder / js_bindings_ccbreader . h " <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID ) <nl> + # include " platform / android / CCJavascriptJavaBridge . h " <nl> + # elif ( CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_MAC ) <nl> + # include " platform / ios / JavaScriptObjCBridge . h " <nl> + # endif <nl> + <nl> + # include " js_Effect3D_bindings . h " <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID ) <nl> + # include " jsb_cocos2dx_experimental_webView_auto . hpp " <nl> + # include " experimental / jsb_cocos2dx_experimental_webView_manual . h " <nl> + # endif <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID ) <nl> + # include " jsb_cocos2dx_experimental_video_auto . hpp " <nl> + # include " experimental / jsb_cocos2dx_experimental_video_manual . h " <nl> + # endif <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_WINRT | | CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID | | CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_MAC | | CC_TARGET_PLATFORM = = CC_PLATFORM_WIN32 ) <nl> + # include " jsb_cocos2dx_audioengine_auto . hpp " <nl> + # endif <nl> + <nl> + USING_NS_CC ; <nl> + USING_NS_CC_EXT ; <nl> + using namespace CocosDenshion ; <nl> + <nl> + AppDelegate : : AppDelegate ( ) <nl> + { <nl> + } <nl> + <nl> + AppDelegate : : ~ AppDelegate ( ) <nl> + { <nl> + ScriptEngineManager : : destroyInstance ( ) ; <nl> + } <nl> + <nl> + void AppDelegate : : initGLContextAttrs ( ) <nl> + { <nl> + GLContextAttrs glContextAttrs = { 8 , 8 , 8 , 8 , 24 , 8 } ; <nl> + <nl> + GLView : : setGLContextAttrs ( glContextAttrs ) ; <nl> + } <nl> + <nl> + bool AppDelegate : : applicationDidFinishLaunching ( ) <nl> + { <nl> + / / initialize director <nl> + auto director = Director : : getInstance ( ) ; <nl> + auto glview = director - > getOpenGLView ( ) ; <nl> + if ( ! glview ) { <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_WINRT ) <nl> + glview = cocos2d : : GLViewImpl : : create ( " js - tests " ) ; <nl> + # else <nl> + glview = cocos2d : : GLViewImpl : : createWithRect ( " js - tests " , Rect ( 0 , 0 , 900 , 640 ) ) ; <nl> + # endif <nl> + director - > setOpenGLView ( glview ) ; <nl> + } <nl> + <nl> + / / set FPS . the default value is 1 . 0 / 60 if you don ' t call this <nl> + director - > setAnimationInterval ( 1 . 0 / 60 ) ; <nl> + <nl> + ScriptingCore * sc = ScriptingCore : : getInstance ( ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx ) ; <nl> + sc - > addRegisterCallback ( register_cocos2dx_js_core ) ; <nl> + sc - > addRegisterCallback ( jsb_register_system ) ; <nl> + <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_extension ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_extension_manual ) ; <nl> + <nl> + sc - > addRegisterCallback ( jsb_register_chipmunk ) ; <nl> + sc - > addRegisterCallback ( JSB_register_opengl ) ; <nl> + <nl> + sc - > addRegisterCallback ( MinXmlHttpRequest : : _js_register ) ; <nl> + sc - > addRegisterCallback ( register_jsb_websocket ) ; <nl> + sc - > addRegisterCallback ( register_jsb_socketio ) ; <nl> + <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_builder ) ; <nl> + sc - > addRegisterCallback ( register_CCBuilderReader ) ; <nl> + <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_ui ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_ui_manual ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_studio ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_studio_manual ) ; <nl> + <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_spine ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_spine_manual ) ; <nl> + <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_3d ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_3d_manual ) ; <nl> + <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_3d_extension ) ; <nl> + <nl> + # if CC_USE_3D_PHYSICS & & CC_ENABLE_BULLET_INTEGRATION <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_physics3d ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_physics3d_manual ) ; <nl> + # endif <nl> + <nl> + # if CC_USE_NAVMESH <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_navmesh ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_navmesh_manual ) ; <nl> + # endif <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID ) <nl> + sc - > addRegisterCallback ( JavascriptJavaBridge : : _js_register ) ; <nl> + # elif ( CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_MAC ) <nl> + sc - > addRegisterCallback ( JavaScriptObjCBridge : : _js_register ) ; <nl> + # endif <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID ) <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_experimental_webView ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_experimental_webView_manual ) ; <nl> + # endif <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID ) <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_experimental_video ) ; <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_experimental_video_manual ) ; <nl> + # endif <nl> + <nl> + # if ( CC_TARGET_PLATFORM = = CC_PLATFORM_WINRT | | CC_TARGET_PLATFORM = = CC_PLATFORM_ANDROID | | CC_TARGET_PLATFORM = = CC_PLATFORM_IOS | | CC_TARGET_PLATFORM = = CC_PLATFORM_MAC | | CC_TARGET_PLATFORM = = CC_PLATFORM_WIN32 ) <nl> + sc - > addRegisterCallback ( register_all_cocos2dx_audioengine ) ; <nl> + # endif <nl> + <nl> + sc - > start ( ) ; <nl> + sc - > runScript ( " script / jsb_boot . js " ) ; <nl> + # if defined ( COCOS2D_DEBUG ) & & ( COCOS2D_DEBUG > 0 ) <nl> + sc - > enableDebugger ( ) ; <nl> + # endif <nl> + <nl> + auto pEngine = ScriptingCore : : getInstance ( ) ; <nl> + ScriptEngineManager : : getInstance ( ) - > setScriptEngine ( pEngine ) ; <nl> + <nl> + ScriptingCore : : getInstance ( ) - > runScript ( " main . js " ) ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + / / This function will be called when the app is inactive . When comes a phone call , it ' s be invoked too <nl> + void AppDelegate : : applicationDidEnterBackground ( ) <nl> + { <nl> + auto director = Director : : getInstance ( ) ; <nl> + director - > stopAnimation ( ) ; <nl> + director - > getEventDispatcher ( ) - > dispatchCustomEvent ( " game_on_hide " ) ; <nl> + SimpleAudioEngine : : getInstance ( ) - > pauseBackgroundMusic ( ) ; <nl> + SimpleAudioEngine : : getInstance ( ) - > pauseAllEffects ( ) ; <nl> + } <nl> + <nl> + / / this function will be called when the app is active again <nl> + void AppDelegate : : applicationWillEnterForeground ( ) <nl> + { <nl> + auto director = Director : : getInstance ( ) ; <nl> + director - > startAnimation ( ) ; <nl> + director - > getEventDispatcher ( ) - > dispatchCustomEvent ( " game_on_show " ) ; <nl> + SimpleAudioEngine : : getInstance ( ) - > resumeBackgroundMusic ( ) ; <nl> + SimpleAudioEngine : : getInstance ( ) - > resumeAllEffects ( ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . aabb7fa2f4ba <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / Classes / AppDelegate . h <nl> <nl> + # ifndef _APP_DELEGATE_H_ <nl> + # define _APP_DELEGATE_H_ <nl> + <nl> + # include " platform / CCApplication . h " <nl> + / * * <nl> + @ brief The cocos2d Application . <nl> + <nl> + The reason for implement as private inheritance is to hide some interface call by Director . <nl> + * / <nl> + class AppDelegate : private cocos2d : : Application <nl> + { <nl> + public : <nl> + AppDelegate ( ) ; <nl> + virtual ~ AppDelegate ( ) ; <nl> + <nl> + void initGLContextAttrs ( ) override ; <nl> + <nl> + / * * <nl> + @ brief Implement Director and Scene init code here . <nl> + @ return true Initialize success , app continue . <nl> + @ return false Initialize failed , app terminate . <nl> + * / <nl> + virtual bool applicationDidFinishLaunching ( ) override ; <nl> + <nl> + / * * <nl> + @ brief The function be called when the application enter background <nl> + @ param the pointer of the application <nl> + * / <nl> + virtual void applicationDidEnterBackground ( ) override ; <nl> + <nl> + / * * <nl> + @ brief The function be called when the application enter foreground <nl> + @ param the pointer of the application <nl> + * / <nl> + virtual void applicationWillEnterForeground ( ) override ; <nl> + } ; <nl> + <nl> + # endif / / _APP_DELEGATE_H_ <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 9c4de5825b19 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / . gitignore <nl> <nl> + . gradle <nl> + / local . properties <nl> + / . idea / workspace . xml <nl> + / . idea / libraries <nl> + . DS_Store <nl> + / build <nl> + / captures <nl> new file mode 100644 <nl> index 000000000000 . . 1de99493d640 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / . gitignore <nl> <nl> + / build <nl> + / jniLibs <nl> new file mode 100644 <nl> index 000000000000 . . e7922a2b1ea0 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / AndroidManifest . xml <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < manifest xmlns : android = " http : / / schemas . android . com / apk / res / android " <nl> + package = " org . cocos2dx . js_tests " <nl> + android : installLocation = " auto " > <nl> + <nl> + < uses - feature android : glEsVersion = " 0x00020000 " / > <nl> + <nl> + < uses - permission android : name = " android . permission . INTERNET " / > <nl> + < uses - permission android : name = " android . permission . ACCESS_NETWORK_STATE " / > <nl> + < uses - permission android : name = " android . permission . READ_EXTERNAL_STORAGE " / > <nl> + < uses - permission android : name = " android . permission . READ_LOGS " / > <nl> + < uses - permission android : name = " android . permission . MOUNT_UNMOUNT_FILESYSTEMS " / > <nl> + < uses - permission android : name = " android . permission . WRITE_EXTERNAL_STORAGE " / > <nl> + < uses - permission android : name = " android . permission . VIBRATE " / > <nl> + <nl> + < application <nl> + android : allowBackup = " true " <nl> + android : icon = " @ mipmap / ic_launcher " > <nl> + <nl> + < ! - - Tell Cocos2dxActivity the name of our . so - - > <nl> + < meta - data android : name = " android . app . lib_name " <nl> + android : value = " js_tests " / > <nl> + <nl> + < activity <nl> + android : name = " . AppActivity " <nl> + android : screenOrientation = " landscape " <nl> + android : configChanges = " orientation | keyboardHidden | screenSize " <nl> + android : label = " @ string / app_name " <nl> + android : theme = " @ android : style / Theme . NoTitleBar . Fullscreen " > <nl> + < intent - filter > <nl> + < action android : name = " android . intent . action . MAIN " / > <nl> + <nl> + < category android : name = " android . intent . category . LAUNCHER " / > <nl> + < / intent - filter > <nl> + < / activity > <nl> + < / application > <nl> + <nl> + < / manifest > <nl> new file mode 100644 <nl> index 000000000000 . . e840b5a973c0 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / build . gradle <nl> <nl> + apply plugin : ' com . android . application ' <nl> + <nl> + android { <nl> + compileSdkVersion 22 <nl> + buildToolsVersion " 22 . 0 . 1 " <nl> + <nl> + defaultConfig { <nl> + applicationId " org . cocos2dx . js_tests " <nl> + minSdkVersion 10 <nl> + targetSdkVersion 22 <nl> + versionCode 1 <nl> + versionName " 1 . 0 " <nl> + <nl> + } <nl> + <nl> + sourceSets . main { <nl> + java . srcDir " src " <nl> + res . srcDir " res " <nl> + jniLibs . srcDir " libs " <nl> + manifest . srcFile " AndroidManifest . xml " <nl> + assets . srcDir " assets " <nl> + } <nl> + <nl> + signingConfigs { <nl> + <nl> + release { <nl> + if ( project . hasProperty ( " RELEASE_STORE_FILE " ) ) { <nl> + storeFile file ( RELEASE_STORE_FILE ) <nl> + storePassword RELEASE_STORE_PASSWORD <nl> + keyAlias RELEASE_KEY_ALIAS <nl> + keyPassword RELEASE_KEY_PASSWORD <nl> + } <nl> + } <nl> + } <nl> + <nl> + buildTypes { <nl> + release { <nl> + minifyEnabled false <nl> + proguardFiles getDefaultProguardFile ( ' proguard - android . txt ' ) , ' proguard - rules . pro ' <nl> + if ( project . hasProperty ( " RELEASE_STORE_FILE " ) ) { <nl> + signingConfig signingConfigs . release <nl> + } <nl> + } <nl> + } <nl> + } <nl> + <nl> + dependencies { <nl> + compile fileTree ( dir : ' libs ' , include : [ ' * . jar ' ] ) <nl> + compile project ( ' : libcocos2dx ' ) <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . dab475af1c30 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / jni / Android . mk <nl> <nl> + LOCAL_PATH : = $ ( call my - dir ) <nl> + <nl> + include $ ( CLEAR_VARS ) <nl> + <nl> + LOCAL_MODULE : = js_tests_shared <nl> + <nl> + LOCAL_MODULE_FILENAME : = libjs_tests <nl> + <nl> + LOCAL_SRC_FILES : = main . cpp \ <nl> + . . / . . / . . / Classes / AppDelegate . cpp \ <nl> + . . / . . / . . / Classes / js_DrawNode3D_bindings . cpp \ <nl> + . . / . . / . . / Classes / js_Effect3D_bindings . cpp <nl> + <nl> + LOCAL_C_INCLUDES : = $ ( LOCAL_PATH ) / . . / . . / . . / Classes <nl> + <nl> + LOCAL_STATIC_LIBRARIES : = cocos2d_js_static <nl> + <nl> + <nl> + LOCAL_EXPORT_CFLAGS : = - DCOCOS2D_DEBUG = 1 <nl> + <nl> + include $ ( BUILD_SHARED_LIBRARY ) <nl> + <nl> + $ ( call import - module , scripting / js - bindings / proj . android ) <nl> new file mode 100644 <nl> index 000000000000 . . 81ca21b08f85 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / jni / Application . mk <nl> <nl> + APP_STL : = gnustl_static <nl> + <nl> + # Uncomment this line to compile to armeabi - v7a , your application will run faster but support less devices <nl> + # APP_ABI : = armeabi - v7a <nl> + <nl> + APP_CPPFLAGS : = - frtti - DCC_ENABLE_CHIPMUNK_INTEGRATION = 1 - std = c + + 11 - fsigned - char <nl> + APP_LDFLAGS : = - latomic <nl> + <nl> + USE_ARM_MODE : = 1 <nl> + <nl> + ifeq ( $ ( NDK_DEBUG ) , 1 ) <nl> + APP_CPPFLAGS + = - DCOCOS2D_DEBUG = 1 <nl> + APP_OPTIM : = debug <nl> + else <nl> + APP_CPPFLAGS + = - DNDEBUG <nl> + APP_OPTIM : = release <nl> + endif <nl> new file mode 100644 <nl> index 000000000000 . . 2d9745860dd9 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / jni / main . cpp <nl> <nl> + # include " AppDelegate . h " <nl> + # include " cocos2d . h " <nl> + # include " platform / android / jni / JniHelper . h " <nl> + # include < jni . h > <nl> + # include < android / log . h > <nl> + <nl> + # define LOG_TAG " main " <nl> + # define LOGD ( . . . ) __android_log_print ( ANDROID_LOG_DEBUG , LOG_TAG , __VA_ARGS__ ) <nl> + <nl> + using namespace cocos2d ; <nl> + <nl> + void cocos_android_app_init ( JNIEnv * env ) { <nl> + LOGD ( " cocos_android_app_init " ) ; <nl> + AppDelegate * pAppDelegate = new AppDelegate ( ) ; <nl> + JavaVM * vm ; <nl> + env - > GetJavaVM ( & vm ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 6618e280172b <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / proguard - rules . pro <nl> <nl> + # Add project specific ProGuard rules here . <nl> + # By default , the flags in this file are appended to flags specified <nl> + # in E : \ developSoftware \ Android \ SDK / tools / proguard / proguard - android . txt <nl> + # You can edit the include path and order by changing the proguardFiles <nl> + # directive in build . gradle . <nl> + # <nl> + # For more details , see <nl> + # http : / / developer . android . com / guide / developing / tools / proguard . html <nl> + <nl> + # Add any project specific keep options here : <nl> + <nl> + # If your project uses WebView with JS , uncomment the following <nl> + # and specify the fully qualified class name to the JavaScript interface <nl> + # class : <nl> + # - keepclassmembers class fqcn . of . javascript . interface . for . webview { <nl> + # public * ; <nl> + # } <nl> new file mode 100644 <nl> index 000000000000 . . 45ee51d15f96 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android - studio / app / res / mipmap - hdpi / ic_launcher . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 0dd2a608998e <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android - studio / app / res / mipmap - mdpi / ic_launcher . png differ <nl> new file mode 100644 <nl> index 000000000000 . . a32f16f930b3 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android - studio / app / res / mipmap - xhdpi / ic_launcher . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 332f268edc46 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android - studio / app / res / mipmap - xxhdpi / ic_launcher . png differ <nl> new file mode 100644 <nl> index 000000000000 . . e0eefac76384 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / res / values / strings . xml <nl> <nl> + < resources > <nl> + < string name = " app_name " > JSTests < / string > <nl> + < / resources > <nl> new file mode 100644 <nl> index 000000000000 . . 72a437b604ed <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / app / src / org / cocos2dx / js_tests / AppActivity . java <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2015 Chukong Technologies Inc . <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + package org . cocos2dx . js_tests ; <nl> + <nl> + import org . cocos2dx . js_tests . R ; <nl> + import org . cocos2dx . lib . Cocos2dxActivity ; <nl> + import org . cocos2dx . lib . Cocos2dxGLSurfaceView ; <nl> + import org . cocos2dx . lib . Cocos2dxJavascriptJavaBridge ; <nl> + <nl> + import android . app . AlertDialog ; <nl> + import android . content . DialogInterface ; <nl> + import android . content . Intent ; <nl> + import android . os . Bundle ; <nl> + <nl> + public class AppActivity extends Cocos2dxActivity { <nl> + <nl> + private static AppActivity app = null ; <nl> + <nl> + @ Override <nl> + public void onCreate ( Bundle savedInstanceState ) { <nl> + super . onCreate ( savedInstanceState ) ; <nl> + app = this ; <nl> + } <nl> + <nl> + @ Override <nl> + public Cocos2dxGLSurfaceView onCreateView ( ) { <nl> + Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView ( this ) ; <nl> + / / TestCpp should create stencil buffer <nl> + glSurfaceView . setEGLConfigChooser ( 5 , 6 , 5 , 0 , 16 , 8 ) ; <nl> + <nl> + return glSurfaceView ; <nl> + } <nl> + <nl> + public static void showAlertDialog ( final String title , final String message ) { <nl> + app . runOnUiThread ( new Runnable ( ) { <nl> + @ Override <nl> + public void run ( ) { <nl> + AlertDialog alertDialog = new AlertDialog . Builder ( app ) . create ( ) ; <nl> + alertDialog . setTitle ( title ) ; <nl> + alertDialog . setMessage ( message ) ; <nl> + alertDialog . setCancelable ( true ) ; <nl> + alertDialog . setIcon ( R . mipmap . ic_launcher ) ; <nl> + alertDialog . setButton ( " OK " , new DialogInterface . OnClickListener ( ) { <nl> + public void onClick ( DialogInterface dialog , int which ) { <nl> + app . runOnGLThread ( new Runnable ( ) { <nl> + @ Override <nl> + public void run ( ) { <nl> + <nl> + Cocos2dxJavascriptJavaBridge . evalString ( " cc . log ( \ " Javascript Java bridge ! \ " ) " ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + } ) ; <nl> + alertDialog . show ( ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 80c26228704a <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / build - cfg . json <nl> <nl> + { <nl> + " copy_resources " : [ <nl> + { <nl> + " from " : " . . / . . / src " , <nl> + " to " : " src " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / . . / cpp - tests / Resources / " , <nl> + " to " : " res / " , <nl> + " exclude " : [ <nl> + " * . gz " <nl> + ] <nl> + } , <nl> + { <nl> + " from " : " . . / . . / main . js " , <nl> + " to " : " " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / project . json " , <nl> + " to " : " " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / . . / . . / cocos / scripting / js - bindings / script " , <nl> + " to " : " script " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / resjs " , <nl> + " to " : " res / resjs / " <nl> + } <nl> + ] , <nl> + " ndk_module_path " : [ <nl> + " . . / . . / . . / . . " , <nl> + " . . / . . / . . / . . / cocos " , <nl> + " . . / . . / . . / . . / external " <nl> + ] <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 1b7886d148cb <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / build . gradle <nl> <nl> + / / Top - level build file where you can add configuration options common to all sub - projects / modules . <nl> + <nl> + buildscript { <nl> + repositories { <nl> + jcenter ( ) <nl> + } <nl> + dependencies { <nl> + classpath ' com . android . tools . build : gradle : 1 . 3 . 0 ' <nl> + <nl> + / / NOTE : Do not place your application dependencies here ; they belong <nl> + / / in the individual module build . gradle files <nl> + } <nl> + } <nl> + <nl> + allprojects { <nl> + repositories { <nl> + jcenter ( ) <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 1d3591c8a4c9 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / gradle . properties <nl> <nl> + # Project - wide Gradle settings . <nl> + <nl> + # IDE ( e . g . Android Studio ) users : <nl> + # Gradle settings configured through the IDE * will override * <nl> + # any settings specified in this file . <nl> + <nl> + # For more details on how to configure your build environment visit <nl> + # http : / / www . gradle . org / docs / current / userguide / build_environment . html <nl> + <nl> + # Specifies the JVM arguments used for the daemon process . <nl> + # The setting is particularly useful for tweaking memory settings . <nl> + # Default value : - Xmx10248m - XX : MaxPermSize = 256m <nl> + # org . gradle . jvmargs = - Xmx2048m - XX : MaxPermSize = 512m - XX : + HeapDumpOnOutOfMemoryError - Dfile . encoding = UTF - 8 <nl> + <nl> + # When configured , Gradle will run in incubating parallel mode . <nl> + # This option should only be used with decoupled projects . More details , visit <nl> + # http : / / www . gradle . org / docs / current / userguide / multi_project_builds . html # sec : decoupled_projects <nl> + # org . gradle . parallel = true <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . 8c0fb64a8698 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android - studio / gradle / wrapper / gradle - wrapper . jar differ <nl> new file mode 100644 <nl> index 000000000000 . . 1d87c27c5911 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / gradle / wrapper / gradle - wrapper . properties <nl> <nl> + # Fri Jul 31 20 : 40 : 49 CST 2015 <nl> + distributionBase = GRADLE_USER_HOME <nl> + distributionPath = wrapper / dists <nl> + zipStoreBase = GRADLE_USER_HOME <nl> + zipStorePath = wrapper / dists <nl> + distributionUrl = https \ : / / services . gradle . org / distributions / gradle - 2 . 4 - all . zip <nl> new file mode 100755 <nl> index 000000000000 . . 91a7e269e19d <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / gradlew <nl> <nl> + # ! / usr / bin / env bash <nl> + <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + # # <nl> + # # Gradle start up script for UN * X <nl> + # # <nl> + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + <nl> + # Add default JVM options here . You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script . <nl> + DEFAULT_JVM_OPTS = " " <nl> + <nl> + APP_NAME = " Gradle " <nl> + APP_BASE_NAME = ` basename " $ 0 " ` <nl> + <nl> + # Use the maximum available , or set MAX_FD ! = - 1 to use that value . <nl> + MAX_FD = " maximum " <nl> + <nl> + warn ( ) { <nl> + echo " $ * " <nl> + } <nl> + <nl> + die ( ) { <nl> + echo <nl> + echo " $ * " <nl> + echo <nl> + exit 1 <nl> + } <nl> + <nl> + # OS specific support ( must be ' true ' or ' false ' ) . <nl> + cygwin = false <nl> + msys = false <nl> + darwin = false <nl> + case " ` uname ` " in <nl> + CYGWIN * ) <nl> + cygwin = true <nl> + ; ; <nl> + Darwin * ) <nl> + darwin = true <nl> + ; ; <nl> + MINGW * ) <nl> + msys = true <nl> + ; ; <nl> + esac <nl> + <nl> + # For Cygwin , ensure paths are in UNIX format before anything is touched . <nl> + if $ cygwin ; then <nl> + [ - n " $ JAVA_HOME " ] & & JAVA_HOME = ` cygpath - - unix " $ JAVA_HOME " ` <nl> + fi <nl> + <nl> + # Attempt to set APP_HOME <nl> + # Resolve links : $ 0 may be a link <nl> + PRG = " $ 0 " <nl> + # Need this for relative symlinks . <nl> + while [ - h " $ PRG " ] ; do <nl> + ls = ` ls - ld " $ PRG " ` <nl> + link = ` expr " $ ls " : ' . * - > \ ( . * \ ) $ ' ` <nl> + if expr " $ link " : ' / . * ' > / dev / null ; then <nl> + PRG = " $ link " <nl> + else <nl> + PRG = ` dirname " $ PRG " ` " / $ link " <nl> + fi <nl> + done <nl> + SAVED = " ` pwd ` " <nl> + cd " ` dirname \ " $ PRG \ " ` / " > & - <nl> + APP_HOME = " ` pwd - P ` " <nl> + cd " $ SAVED " > & - <nl> + <nl> + CLASSPATH = $ APP_HOME / gradle / wrapper / gradle - wrapper . jar <nl> + <nl> + # Determine the Java command to use to start the JVM . <nl> + if [ - n " $ JAVA_HOME " ] ; then <nl> + if [ - x " $ JAVA_HOME / jre / sh / java " ] ; then <nl> + # IBM ' s JDK on AIX uses strange locations for the executables <nl> + JAVACMD = " $ JAVA_HOME / jre / sh / java " <nl> + else <nl> + JAVACMD = " $ JAVA_HOME / bin / java " <nl> + fi <nl> + if [ ! - x " $ JAVACMD " ] ; then <nl> + die " ERROR : JAVA_HOME is set to an invalid directory : $ JAVA_HOME <nl> + <nl> + Please set the JAVA_HOME variable in your environment to match the <nl> + location of your Java installation . " <nl> + fi <nl> + else <nl> + JAVACMD = " java " <nl> + which java > / dev / null 2 > & 1 | | die " ERROR : JAVA_HOME is not set and no ' java ' command could be found in your PATH . <nl> + <nl> + Please set the JAVA_HOME variable in your environment to match the <nl> + location of your Java installation . " <nl> + fi <nl> + <nl> + # Increase the maximum file descriptors if we can . <nl> + if [ " $ cygwin " = " false " - a " $ darwin " = " false " ] ; then <nl> + MAX_FD_LIMIT = ` ulimit - H - n ` <nl> + if [ $ ? - eq 0 ] ; then <nl> + if [ " $ MAX_FD " = " maximum " - o " $ MAX_FD " = " max " ] ; then <nl> + MAX_FD = " $ MAX_FD_LIMIT " <nl> + fi <nl> + ulimit - n $ MAX_FD <nl> + if [ $ ? - ne 0 ] ; then <nl> + warn " Could not set maximum file descriptor limit : $ MAX_FD " <nl> + fi <nl> + else <nl> + warn " Could not query maximum file descriptor limit : $ MAX_FD_LIMIT " <nl> + fi <nl> + fi <nl> + <nl> + # For Darwin , add options to specify how the application appears in the dock <nl> + if $ darwin ; then <nl> + GRADLE_OPTS = " $ GRADLE_OPTS \ " - Xdock : name = $ APP_NAME \ " \ " - Xdock : icon = $ APP_HOME / media / gradle . icns \ " " <nl> + fi <nl> + <nl> + # For Cygwin , switch paths to Windows format before running java <nl> + if $ cygwin ; then <nl> + APP_HOME = ` cygpath - - path - - mixed " $ APP_HOME " ` <nl> + CLASSPATH = ` cygpath - - path - - mixed " $ CLASSPATH " ` <nl> + <nl> + # We build the pattern for arguments to be converted via cygpath <nl> + ROOTDIRSRAW = ` find - L / - maxdepth 1 - mindepth 1 - type d 2 > / dev / null ` <nl> + SEP = " " <nl> + for dir in $ ROOTDIRSRAW ; do <nl> + ROOTDIRS = " $ ROOTDIRS $ SEP $ dir " <nl> + SEP = " | " <nl> + done <nl> + OURCYGPATTERN = " ( ^ ( $ ROOTDIRS ) ) " <nl> + # Add a user - defined pattern to the cygpath arguments <nl> + if [ " $ GRADLE_CYGPATTERN " ! = " " ] ; then <nl> + OURCYGPATTERN = " $ OURCYGPATTERN | ( $ GRADLE_CYGPATTERN ) " <nl> + fi <nl> + # Now convert the arguments - kludge to limit ourselves to / bin / sh <nl> + i = 0 <nl> + for arg in " $ @ " ; do <nl> + CHECK = ` echo " $ arg " | egrep - c " $ OURCYGPATTERN " - ` <nl> + CHECK2 = ` echo " $ arg " | egrep - c " ^ - " ` # # # Determine if an option <nl> + <nl> + if [ $ CHECK - ne 0 ] & & [ $ CHECK2 - eq 0 ] ; then # # # Added a condition <nl> + eval ` echo args $ i ` = ` cygpath - - path - - ignore - - mixed " $ arg " ` <nl> + else <nl> + eval ` echo args $ i ` = " \ " $ arg \ " " <nl> + fi <nl> + i = $ ( ( i + 1 ) ) <nl> + done <nl> + case $ i in <nl> + ( 0 ) set - - ; ; <nl> + ( 1 ) set - - " $ args0 " ; ; <nl> + ( 2 ) set - - " $ args0 " " $ args1 " ; ; <nl> + ( 3 ) set - - " $ args0 " " $ args1 " " $ args2 " ; ; <nl> + ( 4 ) set - - " $ args0 " " $ args1 " " $ args2 " " $ args3 " ; ; <nl> + ( 5 ) set - - " $ args0 " " $ args1 " " $ args2 " " $ args3 " " $ args4 " ; ; <nl> + ( 6 ) set - - " $ args0 " " $ args1 " " $ args2 " " $ args3 " " $ args4 " " $ args5 " ; ; <nl> + ( 7 ) set - - " $ args0 " " $ args1 " " $ args2 " " $ args3 " " $ args4 " " $ args5 " " $ args6 " ; ; <nl> + ( 8 ) set - - " $ args0 " " $ args1 " " $ args2 " " $ args3 " " $ args4 " " $ args5 " " $ args6 " " $ args7 " ; ; <nl> + ( 9 ) set - - " $ args0 " " $ args1 " " $ args2 " " $ args3 " " $ args4 " " $ args5 " " $ args6 " " $ args7 " " $ args8 " ; ; <nl> + esac <nl> + fi <nl> + <nl> + # Split up the JVM_OPTS And GRADLE_OPTS values into an array , following the shell quoting and substitution rules <nl> + function splitJvmOpts ( ) { <nl> + JVM_OPTS = ( " $ @ " ) <nl> + } <nl> + eval splitJvmOpts $ DEFAULT_JVM_OPTS $ JAVA_OPTS $ GRADLE_OPTS <nl> + JVM_OPTS [ $ { # JVM_OPTS [ * ] } ] = " - Dorg . gradle . appname = $ APP_BASE_NAME " <nl> + <nl> + exec " $ JAVACMD " " $ { JVM_OPTS [ @ ] } " - classpath " $ CLASSPATH " org . gradle . wrapper . GradleWrapperMain " $ @ " <nl> new file mode 100644 <nl> index 000000000000 . . 8a0b282aa688 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / gradlew . bat <nl> <nl> + @ if " % DEBUG % " = = " " @ echo off <nl> + @ rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + @ rem <nl> + @ rem Gradle startup script for Windows <nl> + @ rem <nl> + @ rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> + <nl> + @ rem Set local scope for the variables with windows NT shell <nl> + if " % OS % " = = " Windows_NT " setlocal <nl> + <nl> + @ rem Add default JVM options here . You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script . <nl> + set DEFAULT_JVM_OPTS = <nl> + <nl> + set DIRNAME = % ~ dp0 <nl> + if " % DIRNAME % " = = " " set DIRNAME = . <nl> + set APP_BASE_NAME = % ~ n0 <nl> + set APP_HOME = % DIRNAME % <nl> + <nl> + @ rem Find java . exe <nl> + if defined JAVA_HOME goto findJavaFromJavaHome <nl> + <nl> + set JAVA_EXE = java . exe <nl> + % JAVA_EXE % - version > NUL 2 > & 1 <nl> + if " % ERRORLEVEL % " = = " 0 " goto init <nl> + <nl> + echo . <nl> + echo ERROR : JAVA_HOME is not set and no ' java ' command could be found in your PATH . <nl> + echo . <nl> + echo Please set the JAVA_HOME variable in your environment to match the <nl> + echo location of your Java installation . <nl> + <nl> + goto fail <nl> + <nl> + : findJavaFromJavaHome <nl> + set JAVA_HOME = % JAVA_HOME : " = % <nl> + set JAVA_EXE = % JAVA_HOME % / bin / java . exe <nl> + <nl> + if exist " % JAVA_EXE % " goto init <nl> + <nl> + echo . <nl> + echo ERROR : JAVA_HOME is set to an invalid directory : % JAVA_HOME % <nl> + echo . <nl> + echo Please set the JAVA_HOME variable in your environment to match the <nl> + echo location of your Java installation . <nl> + <nl> + goto fail <nl> + <nl> + : init <nl> + @ rem Get command - line arguments , handling Windowz variants <nl> + <nl> + if not " % OS % " = = " Windows_NT " goto win9xME_args <nl> + if " % @ eval [ 2 + 2 ] " = = " 4 " goto 4NT_args <nl> + <nl> + : win9xME_args <nl> + @ rem Slurp the command line arguments . <nl> + set CMD_LINE_ARGS = <nl> + set _SKIP = 2 <nl> + <nl> + : win9xME_args_slurp <nl> + if " x % ~ 1 " = = " x " goto execute <nl> + <nl> + set CMD_LINE_ARGS = % * <nl> + goto execute <nl> + <nl> + : 4NT_args <nl> + @ rem Get arguments from the 4NT Shell from JP Software <nl> + set CMD_LINE_ARGS = % $ <nl> + <nl> + : execute <nl> + @ rem Setup the command line <nl> + <nl> + set CLASSPATH = % APP_HOME % \ gradle \ wrapper \ gradle - wrapper . jar <nl> + <nl> + @ rem Execute Gradle <nl> + " % JAVA_EXE % " % DEFAULT_JVM_OPTS % % JAVA_OPTS % % GRADLE_OPTS % " - Dorg . gradle . appname = % APP_BASE_NAME % " - classpath " % CLASSPATH % " org . gradle . wrapper . GradleWrapperMain % CMD_LINE_ARGS % <nl> + <nl> + : end <nl> + @ rem End local scope for the variables with windows NT shell <nl> + if " % ERRORLEVEL % " = = " 0 " goto mainEnd <nl> + <nl> + : fail <nl> + rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of <nl> + rem the _cmd . exe / c_ return code ! <nl> + if not " " = = " % GRADLE_EXIT_CONSOLE % " exit 1 <nl> + exit / b 1 <nl> + <nl> + : mainEnd <nl> + if " % OS % " = = " Windows_NT " endlocal <nl> + <nl> + : omega <nl> new file mode 100644 <nl> index 000000000000 . . 05e6a4191f3e <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android - studio / settings . gradle <nl> <nl> + include ' : libcocos2dx ' <nl> + project ( ' : libcocos2dx ' ) . projectDir = new File ( settingsDir , ' . . / . . / . . / . . / cocos / platform / android / libcocos2dx ' ) <nl> + include ' : JSTests ' <nl> + project ( ' : JSTests ' ) . projectDir = new File ( settingsDir , ' app ' ) <nl> new file mode 100644 <nl> index 000000000000 . . 3cd35c958ed0 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / . classpath <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < classpath > <nl> + < classpathentry kind = " con " path = " com . android . ide . eclipse . adt . ANDROID_FRAMEWORK " / > <nl> + < classpathentry exported = " true " kind = " con " path = " com . android . ide . eclipse . adt . LIBRARIES " / > <nl> + < classpathentry exported = " true " kind = " con " path = " com . android . ide . eclipse . adt . DEPENDENCIES " / > <nl> + < classpathentry kind = " src " path = " src " / > <nl> + < classpathentry kind = " src " path = " gen " / > <nl> + < classpathentry kind = " output " path = " bin / classes " / > <nl> + < / classpath > <nl> new file mode 100644 <nl> index 000000000000 . . 0649734c258e <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / . project <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < projectDescription > <nl> + < name > JSTests < / name > <nl> + < comment > < / comment > <nl> + < projects > <nl> + < / projects > <nl> + < buildSpec > <nl> + < buildCommand > <nl> + < name > org . eclipse . wst . jsdt . core . javascriptValidator < / name > <nl> + < arguments > <nl> + < / arguments > <nl> + < / buildCommand > <nl> + < buildCommand > <nl> + < name > com . android . ide . eclipse . adt . ResourceManagerBuilder < / name > <nl> + < arguments > <nl> + < / arguments > <nl> + < / buildCommand > <nl> + < buildCommand > <nl> + < name > com . android . ide . eclipse . adt . PreCompilerBuilder < / name > <nl> + < arguments > <nl> + < / arguments > <nl> + < / buildCommand > <nl> + < buildCommand > <nl> + < name > org . eclipse . jdt . core . javabuilder < / name > <nl> + < arguments > <nl> + < / arguments > <nl> + < / buildCommand > <nl> + < buildCommand > <nl> + < name > com . android . ide . eclipse . adt . ApkBuilder < / name > <nl> + < arguments > <nl> + < / arguments > <nl> + < / buildCommand > <nl> + < buildCommand > <nl> + < name > org . eclipse . cdt . managedbuilder . core . ScannerConfigBuilder < / name > <nl> + < triggers > full , incremental , < / triggers > <nl> + < arguments > <nl> + < / arguments > <nl> + < / buildCommand > <nl> + < / buildSpec > <nl> + < natures > <nl> + < nature > com . android . ide . eclipse . adt . AndroidNature < / nature > <nl> + < nature > org . eclipse . jdt . core . javanature < / nature > <nl> + < nature > org . eclipse . cdt . core . cnature < / nature > <nl> + < nature > org . eclipse . cdt . core . ccnature < / nature > <nl> + < nature > org . eclipse . cdt . managedbuilder . core . managedBuildNature < / nature > <nl> + < nature > org . eclipse . cdt . managedbuilder . core . ScannerConfigNature < / nature > <nl> + < nature > org . eclipse . wst . jsdt . core . jsNature < / nature > <nl> + < / natures > <nl> + < / projectDescription > <nl> new file mode 100644 <nl> index 000000000000 . . 5fce9d7109c3 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / AndroidManifest . xml <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < manifest xmlns : android = " http : / / schemas . android . com / apk / res / android " <nl> + package = " org . cocos2dx . js_tests " <nl> + android : installLocation = " preferExternal " <nl> + android : versionCode = " 1 " <nl> + android : versionName = " 1 . 0 " > <nl> + <nl> + < uses - sdk android : minSdkVersion = " 9 " / > <nl> + < uses - feature android : glEsVersion = " 0x00020000 " / > <nl> + <nl> + < application android : label = " @ string / app_name " <nl> + android : icon = " @ drawable / icon " > <nl> + < ! - - Tell NativeActivity the name of our . so - - > <nl> + < meta - data android : name = " android . app . lib_name " android : value = " js_tests " / > <nl> + <nl> + < activity android : name = " . AppActivity " <nl> + android : label = " @ string / app_name " <nl> + android : screenOrientation = " landscape " <nl> + android : theme = " @ android : style / Theme . NoTitleBar . Fullscreen " <nl> + android : configChanges = " orientation " > <nl> + <nl> + < intent - filter > <nl> + < action android : name = " android . intent . action . MAIN " / > <nl> + < category android : name = " android . intent . category . LAUNCHER " / > <nl> + < / intent - filter > <nl> + < / activity > <nl> + <nl> + < / application > <nl> + < supports - screens android : anyDensity = " true " <nl> + android : smallScreens = " true " <nl> + android : normalScreens = " true " <nl> + android : largeScreens = " true " <nl> + android : xlargeScreens = " true " / > <nl> + <nl> + < uses - permission android : name = " android . permission . INTERNET " / > <nl> + < uses - permission android : name = " android . permission . ACCESS_NETWORK_STATE " / > <nl> + < uses - permission android : name = " android . permission . READ_EXTERNAL_STORAGE " / > <nl> + < uses - permission android : name = " android . permission . READ_LOGS " / > <nl> + < uses - permission android : name = " android . permission . MOUNT_UNMOUNT_FILESYSTEMS " / > <nl> + < uses - permission android : name = " android . permission . WRITE_EXTERNAL_STORAGE " / > <nl> + < uses - permission android : name = " android . permission . VIBRATE " / > <nl> + <nl> + < / manifest > <nl> new file mode 100644 <nl> index 000000000000 . . f8af38bfb49a <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / ant . properties <nl> @ @ - 0 , 0 + 1 @ @ <nl> + aapt . ignore . assets = " ! * . pvr . gz : ! * . gz : ! . svn : ! . git : . * : < dir > _ * : ! CVS : ! thumbs . db : ! picasa . ini : ! * . scc : * ~ " <nl> new file mode 100644 <nl> index 000000000000 . . 80c26228704a <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / build - cfg . json <nl> <nl> + { <nl> + " copy_resources " : [ <nl> + { <nl> + " from " : " . . / . . / src " , <nl> + " to " : " src " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / . . / cpp - tests / Resources / " , <nl> + " to " : " res / " , <nl> + " exclude " : [ <nl> + " * . gz " <nl> + ] <nl> + } , <nl> + { <nl> + " from " : " . . / . . / main . js " , <nl> + " to " : " " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / project . json " , <nl> + " to " : " " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / . . / . . / cocos / scripting / js - bindings / script " , <nl> + " to " : " script " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / resjs " , <nl> + " to " : " res / resjs / " <nl> + } <nl> + ] , <nl> + " ndk_module_path " : [ <nl> + " . . / . . / . . / . . " , <nl> + " . . / . . / . . / . . / cocos " , <nl> + " . . / . . / . . / . . / external " <nl> + ] <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 2f46f6e914aa <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / build . xml <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < project name = " JSTests " default = " help " > <nl> + <nl> + < ! - - The local . properties file is created and updated by the ' android ' tool . <nl> + It contains the path to the SDK . It should * NOT * be checked into <nl> + Version Control Systems . - - > <nl> + < property file = " local . properties " / > <nl> + <nl> + < ! - - The ant . properties file can be created by you . It is only edited by the <nl> + ' android ' tool to add properties to it . <nl> + This is the place to change some Ant specific build properties . <nl> + Here are some properties you may want to change / update : <nl> + <nl> + source . dir <nl> + The name of the source directory . Default is ' src ' . <nl> + out . dir <nl> + The name of the output directory . Default is ' bin ' . <nl> + <nl> + For other overridable properties , look at the beginning of the rules <nl> + files in the SDK , at tools / ant / build . xml <nl> + <nl> + Properties related to the SDK location or the project target should <nl> + be updated using the ' android ' tool with the ' update ' action . <nl> + <nl> + This file is an integral part of the build system for your <nl> + application and should be checked into Version Control Systems . <nl> + <nl> + - - > <nl> + < property file = " ant . properties " / > <nl> + <nl> + < ! - - if sdk . dir was not set from one of the property file , then <nl> + get it from the ANDROID_HOME env var . <nl> + This must be done before we load project . properties since <nl> + the proguard config can use sdk . dir - - > <nl> + < property environment = " env " / > <nl> + < condition property = " sdk . dir " value = " $ { env . ANDROID_HOME } " > <nl> + < isset property = " env . ANDROID_HOME " / > <nl> + < / condition > <nl> + <nl> + < ! - - The project . properties file is created and updated by the ' android ' <nl> + tool , as well as ADT . <nl> + <nl> + This contains project specific properties such as project target , and library <nl> + dependencies . Lower level build properties are stored in ant . properties <nl> + ( or in . classpath for Eclipse projects ) . <nl> + <nl> + This file is an integral part of the build system for your <nl> + application and should be checked into Version Control Systems . - - > <nl> + < loadproperties srcFile = " project . properties " / > <nl> + <nl> + < ! - - quick check on sdk . dir - - > <nl> + < fail <nl> + message = " sdk . dir is missing . Make sure to generate local . properties using ' android update project ' or to inject it through the ANDROID_HOME environment variable . " <nl> + unless = " sdk . dir " <nl> + / > <nl> + <nl> + < ! - - <nl> + Import per project custom build rules if present at the root of the project . <nl> + This is the place to put custom intermediary targets such as : <nl> + - pre - build <nl> + - pre - compile <nl> + - post - compile ( This is typically used for code obfuscation . <nl> + Compiled code location : $ { out . classes . absolute . dir } <nl> + If this is not done in place , override $ { out . dex . input . absolute . dir } ) <nl> + - post - package <nl> + - post - build <nl> + - pre - clean <nl> + - - > <nl> + < import file = " custom_rules . xml " optional = " true " / > <nl> + <nl> + < ! - - Import the actual build file . <nl> + <nl> + To customize existing targets , there are two options : <nl> + - Customize only one target : <nl> + - copy / paste the target into this file , * before * the <nl> + < import > task . <nl> + - customize it to your needs . <nl> + - Customize the whole content of build . xml <nl> + - copy / paste the content of the rules files ( minus the top node ) <nl> + into this file , replacing the < import > task . <nl> + - customize to your needs . <nl> + <nl> + * * * * * * * * * * * * * * * * * * * * * * * <nl> + * * * * * * IMPORTANT * * * * * * <nl> + * * * * * * * * * * * * * * * * * * * * * * * <nl> + In all cases you must update the value of version - tag below to read ' custom ' instead of an integer , <nl> + in order to avoid having your file be overridden by tools such as " android update project " <nl> + - - > <nl> + < ! - - version - tag : 1 - - > <nl> + < import file = " $ { sdk . dir } / tools / ant / build . xml " / > <nl> + <nl> + < / project > <nl> new file mode 100644 <nl> index 000000000000 . . 4ea163a5bb45 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / jni / Android . mk <nl> <nl> + LOCAL_PATH : = $ ( call my - dir ) <nl> + <nl> + include $ ( CLEAR_VARS ) <nl> + <nl> + LOCAL_MODULE : = js_tests_shared <nl> + <nl> + LOCAL_MODULE_FILENAME : = libjs_tests <nl> + <nl> + LOCAL_SRC_FILES : = main . cpp \ <nl> + . . / . . / Classes / AppDelegate . cpp \ <nl> + . . / . . / Classes / js_DrawNode3D_bindings . cpp \ <nl> + . . / . . / Classes / js_Effect3D_bindings . cpp <nl> + <nl> + LOCAL_C_INCLUDES : = $ ( LOCAL_PATH ) / . . / . . / Classes <nl> + <nl> + LOCAL_STATIC_LIBRARIES : = cocos2d_js_static <nl> + <nl> + <nl> + LOCAL_EXPORT_CFLAGS : = - DCOCOS2D_DEBUG = 1 <nl> + <nl> + include $ ( BUILD_SHARED_LIBRARY ) <nl> + <nl> + $ ( call import - module , scripting / js - bindings / proj . android ) <nl> new file mode 100644 <nl> index 000000000000 . . 81ca21b08f85 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / jni / Application . mk <nl> <nl> + APP_STL : = gnustl_static <nl> + <nl> + # Uncomment this line to compile to armeabi - v7a , your application will run faster but support less devices <nl> + # APP_ABI : = armeabi - v7a <nl> + <nl> + APP_CPPFLAGS : = - frtti - DCC_ENABLE_CHIPMUNK_INTEGRATION = 1 - std = c + + 11 - fsigned - char <nl> + APP_LDFLAGS : = - latomic <nl> + <nl> + USE_ARM_MODE : = 1 <nl> + <nl> + ifeq ( $ ( NDK_DEBUG ) , 1 ) <nl> + APP_CPPFLAGS + = - DCOCOS2D_DEBUG = 1 <nl> + APP_OPTIM : = debug <nl> + else <nl> + APP_CPPFLAGS + = - DNDEBUG <nl> + APP_OPTIM : = release <nl> + endif <nl> new file mode 100644 <nl> index 000000000000 . . 2d9745860dd9 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / jni / main . cpp <nl> <nl> + # include " AppDelegate . h " <nl> + # include " cocos2d . h " <nl> + # include " platform / android / jni / JniHelper . h " <nl> + # include < jni . h > <nl> + # include < android / log . h > <nl> + <nl> + # define LOG_TAG " main " <nl> + # define LOGD ( . . . ) __android_log_print ( ANDROID_LOG_DEBUG , LOG_TAG , __VA_ARGS__ ) <nl> + <nl> + using namespace cocos2d ; <nl> + <nl> + void cocos_android_app_init ( JNIEnv * env ) { <nl> + LOGD ( " cocos_android_app_init " ) ; <nl> + AppDelegate * pAppDelegate = new AppDelegate ( ) ; <nl> + JavaVM * vm ; <nl> + env - > GetJavaVM ( & vm ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . b8b83e024fdf <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / ndkgdb . sh <nl> <nl> + APPNAME = " JSTests " <nl> + APP_ANDROID_NAME = " org . cocos2dx . js_tests " <nl> + <nl> + if [ - z " $ { SDK_ROOT + aaa } " ] ; then <nl> + # . . . if SDK_ROOT is not set , use " $ HOME / bin / android - sdk " <nl> + SDK_ROOT = " $ HOME / bin / android - sdk " <nl> + fi <nl> + <nl> + if [ - z " $ { NDK_ROOT + aaa } " ] ; then <nl> + # . . . if NDK_ROOT is not set , use " $ HOME / bin / android - ndk " <nl> + NDK_ROOT = " $ HOME / bin / android - ndk " <nl> + fi <nl> + <nl> + if [ - z " $ { COCOS2DX_ROOT + aaa } " ] ; then <nl> + # . . . if COCOS2DX_ROOT is not set <nl> + # . . . find current working directory <nl> + DIR = " $ ( cd " $ ( dirname " $ { BASH_SOURCE [ 0 ] } " ) " & & pwd ) " <nl> + # . . . use paths relative to current directory <nl> + COCOS2DX_ROOT = " $ DIR / . . / . . / . . " <nl> + APP_ROOT = " $ DIR / . . " <nl> + APP_ANDROID_ROOT = " $ DIR " <nl> + else <nl> + APP_ROOT = " $ COCOS2DX_ROOT / samples / $ APPNAME " <nl> + APP_ANDROID_ROOT = " $ COCOS2DX_ROOT / samples / $ APPNAME / proj . android " <nl> + fi <nl> + <nl> + echo " NDK_ROOT = $ NDK_ROOT " <nl> + echo " SDK_ROOT = $ SDK_ROOT " <nl> + echo " COCOS2DX_ROOT = $ COCOS2DX_ROOT " <nl> + echo " APP_ROOT = $ APP_ROOT " <nl> + echo " APP_ANDROID_ROOT = $ APP_ANDROID_ROOT " <nl> + echo " APP_ANDROID_NAME = $ APP_ANDROID_NAME " <nl> + <nl> + echo <nl> + echo " Killing and restarting $ { APP_ANDROID_NAME } " <nl> + echo <nl> + <nl> + set - x <nl> + <nl> + " $ { SDK_ROOT } " / platform - tools / adb shell am force - stop " $ { APP_ANDROID_NAME } " <nl> + <nl> + NDK_MODULE_PATH = " $ { COCOS2DX_ROOT } " : " $ { COCOS2DX_ROOT } " / cocos2dx / platform / third_party / android / prebuilt \ <nl> + " $ { NDK_ROOT } " / ndk - gdb \ <nl> + - - adb = " $ { SDK_ROOT } " / platform - tools / adb \ <nl> + - - verbose \ <nl> + - - start \ <nl> + - - force <nl> new file mode 100644 <nl> index 000000000000 . . f2fe1559a217 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / proguard - project . txt <nl> <nl> + # To enable ProGuard in your project , edit project . properties <nl> + # to define the proguard . config property as described in that file . <nl> + # <nl> + # Add project specific ProGuard rules here . <nl> + # By default , the flags in this file are appended to flags specified <nl> + # in $ { sdk . dir } / tools / proguard / proguard - android . txt <nl> + # You can edit the include path and order by changing the ProGuard <nl> + # include property in project . properties . <nl> + # <nl> + # For more details , see <nl> + # http : / / developer . android . com / guide / developing / tools / proguard . html <nl> + <nl> + # Add any project specific keep options here : <nl> + <nl> + # If your project uses WebView with JS , uncomment the following <nl> + # and specify the fully qualified class name to the JavaScript interface <nl> + # class : <nl> + # - keepclassmembers class fqcn . of . javascript . interface . for . webview { <nl> + # public * ; <nl> + # } <nl> new file mode 100644 <nl> index 000000000000 . . 8aa4767c2fbf <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android / res / drawable - hdpi / icon . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 17ce11a0856b <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android / res / drawable - ldpi / icon . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 3780aac46c76 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . android / res / drawable - mdpi / icon . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 47171319181a <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / res / values / strings . xml <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < resources > <nl> + < string name = " app_name " > JSTests < / string > <nl> + < string name = " app_id " > 1426774790893461 < / string > <nl> + < / resources > <nl> new file mode 100644 <nl> index 000000000000 . . 6d97e1c13d57 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . android / src / org / cocos2dx / js_tests / AppActivity . java <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2010 - 2012 cocos2d - x . org <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + package org . cocos2dx . js_tests ; <nl> + <nl> + import org . cocos2dx . js_tests . R ; <nl> + import org . cocos2dx . lib . Cocos2dxActivity ; <nl> + import org . cocos2dx . lib . Cocos2dxGLSurfaceView ; <nl> + import org . cocos2dx . lib . Cocos2dxJavascriptJavaBridge ; <nl> + <nl> + import android . app . AlertDialog ; <nl> + import android . content . DialogInterface ; <nl> + import android . content . Intent ; <nl> + import android . os . Bundle ; <nl> + <nl> + public class AppActivity extends Cocos2dxActivity { <nl> + <nl> + private static AppActivity app = null ; <nl> + <nl> + @ Override <nl> + public void onCreate ( Bundle savedInstanceState ) { <nl> + super . onCreate ( savedInstanceState ) ; <nl> + app = this ; <nl> + } <nl> + <nl> + @ Override <nl> + public Cocos2dxGLSurfaceView onCreateView ( ) { <nl> + Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView ( this ) ; <nl> + / / TestCpp should create stencil buffer <nl> + glSurfaceView . setEGLConfigChooser ( 5 , 6 , 5 , 0 , 16 , 8 ) ; <nl> + <nl> + return glSurfaceView ; <nl> + } <nl> + <nl> + public static void showAlertDialog ( final String title , final String message ) { <nl> + app . runOnUiThread ( new Runnable ( ) { <nl> + @ Override <nl> + public void run ( ) { <nl> + AlertDialog alertDialog = new AlertDialog . Builder ( app ) . create ( ) ; <nl> + alertDialog . setTitle ( title ) ; <nl> + alertDialog . setMessage ( message ) ; <nl> + alertDialog . setCancelable ( true ) ; <nl> + alertDialog . setIcon ( R . drawable . icon ) ; <nl> + alertDialog . setButton ( " OK " , new DialogInterface . OnClickListener ( ) { <nl> + public void onClick ( DialogInterface dialog , int which ) { <nl> + app . runOnGLThread ( new Runnable ( ) { <nl> + @ Override <nl> + public void run ( ) { <nl> + <nl> + Cocos2dxJavascriptJavaBridge . evalString ( " cc . log ( \ " Javascript Java bridge ! \ " ) " ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + } ) ; <nl> + alertDialog . show ( ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + public static void showAlertDialog ( final String title , final String message , final boolean logicSwitch ) { <nl> + app . runOnUiThread ( new Runnable ( ) { <nl> + @ Override <nl> + public void run ( ) { <nl> + AlertDialog alertDialog = new AlertDialog . Builder ( app ) . create ( ) ; <nl> + alertDialog . setTitle ( title ) ; <nl> + alertDialog . setMessage ( message ) ; <nl> + alertDialog . setCancelable ( true ) ; <nl> + alertDialog . setIcon ( R . drawable . icon ) ; <nl> + String buttonStr = " it ' s false " ; <nl> + if ( logicSwitch ) <nl> + { <nl> + buttonStr = " it ' s true " ; <nl> + } <nl> + alertDialog . setButton ( buttonStr , new DialogInterface . OnClickListener ( ) { <nl> + public void onClick ( DialogInterface dialog , int which ) { <nl> + app . runOnGLThread ( new Runnable ( ) { <nl> + @ Override <nl> + public void run ( ) { <nl> + <nl> + Cocos2dxJavascriptJavaBridge . evalString ( " cc . log ( \ " Javascript Java bridge ! \ " ) " ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + } ) ; <nl> + alertDialog . show ( ) ; <nl> + } <nl> + } ) ; <nl> + } <nl> + <nl> + public static String getUtfStr ( ) { <nl> + final String utf8Str = " you will see emotion : 💝 " ; <nl> + app . runOnGLThread ( new Runnable ( ) { <nl> + @ Override <nl> + public void run ( ) { <nl> + <nl> + Cocos2dxJavascriptJavaBridge . evalString ( " cc . log ( \ " " + utf8Str + " \ " ) " ) ; <nl> + } <nl> + } ) ; <nl> + return utf8Str ; <nl> + } <nl> + <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 34545808e49d <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / AppController . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2010 - 2013 cocos2d - x . org <nl> + Copyright ( c ) 2013 - 2014 Chukong Technologies Inc . <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + @ class RootViewController ; <nl> + <nl> + @ interface AppController : NSObject < UIApplicationDelegate > <nl> + { <nl> + UIWindow * window ; <nl> + RootViewController * viewController ; <nl> + } <nl> + <nl> + @ end <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . f14613189483 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / AppController . mm <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2010 - 2013 cocos2d - x . org <nl> + Copyright ( c ) 2013 - 2014 Chukong Technologies Inc . <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + # import < UIKit / UIKit . h > <nl> + # import " cocos2d . h " <nl> + # import " AppController . h " <nl> + # import " AppDelegate . h " <nl> + # import " RootViewController . h " <nl> + # import " platform / ios / CCEAGLView - ios . h " <nl> + / / # import < FacebookSDK / FacebookSDK . h > <nl> + @ implementation AppController <nl> + <nl> + # pragma mark - <nl> + # pragma mark Application lifecycle <nl> + <nl> + / / cocos2d application instance <nl> + static AppDelegate s_sharedApplication ; <nl> + <nl> + - ( BOOL ) application : ( UIApplication * ) application didFinishLaunchingWithOptions : ( NSDictionary * ) launchOptions <nl> + { <nl> + <nl> + / / Override point for customization after application launch . <nl> + <nl> + / / Add the view controller ' s view to the window and display . <nl> + window = [ [ UIWindow alloc ] initWithFrame : [ [ UIScreen mainScreen ] bounds ] ] ; <nl> + CCEAGLView * eaglView = [ CCEAGLView viewWithFrame : [ window bounds ] <nl> + pixelFormat : kEAGLColorFormatRGBA8 <nl> + depthFormat : GL_DEPTH24_STENCIL8_OES <nl> + preserveBackbuffer : NO <nl> + sharegroup : nil <nl> + multiSampling : NO <nl> + numberOfSamples : 0 ] ; <nl> + <nl> + [ eaglView setMultipleTouchEnabled : YES ] ; <nl> + <nl> + / / Use RootViewController manage CCEAGLView <nl> + viewController = [ [ RootViewController alloc ] initWithNibName : nil bundle : nil ] ; <nl> + viewController . wantsFullScreenLayout = YES ; <nl> + viewController . view = eaglView ; <nl> + <nl> + / / Set RootViewController to window <nl> + if ( [ [ UIDevice currentDevice ] . systemVersion floatValue ] < 6 . 0 ) <nl> + { <nl> + / / warning : addSubView doesn ' t work on iOS6 <nl> + [ window addSubview : viewController . view ] ; <nl> + } <nl> + else <nl> + { <nl> + / / use this method on ios6 <nl> + [ window setRootViewController : viewController ] ; <nl> + } <nl> + <nl> + [ window makeKeyAndVisible ] ; <nl> + <nl> + [ [ UIApplication sharedApplication ] setStatusBarHidden : YES ] ; <nl> + <nl> + / / IMPORTANT : Setting the GLView should be done after creating the RootViewController <nl> + cocos2d : : GLView * glview = cocos2d : : GLViewImpl : : createWithEAGLView ( eaglView ) ; <nl> + cocos2d : : Director : : getInstance ( ) - > setOpenGLView ( glview ) ; <nl> + <nl> + cocos2d : : Application : : getInstance ( ) - > run ( ) ; <nl> + return YES ; <nl> + } <nl> + - ( void ) applicationWillResignActive : ( UIApplication * ) application { <nl> + / * <nl> + Sent when the application is about to move from active to inactive state . This can occur for certain types of temporary interruptions ( such as an incoming phone call or SMS message ) or when the user quits the application and it begins the transition to the background state . <nl> + Use this method to pause ongoing tasks , disable timers , and throttle down OpenGL ES frame rates . Games should use this method to pause the game . <nl> + * / <nl> + cocos2d : : Director : : getInstance ( ) - > pause ( ) ; <nl> + } <nl> + / / - ( BOOL ) application : ( UIApplication * ) application openURL : ( NSURL * ) url sourceApplication : ( NSString * ) sourceApplication annotation : ( id ) annotation <nl> + / / { <nl> + / / return [ FBSession . activeSession handleOpenURL : url ] ; <nl> + / / } <nl> + - ( void ) applicationDidBecomeActive : ( UIApplication * ) application { <nl> + / * <nl> + Restart any tasks that were paused ( or not yet started ) while the application was inactive . If the application was previously in the background , optionally refresh the user interface . <nl> + * / <nl> + / / [ FBAppCall handleDidBecomeActive ] ; <nl> + cocos2d : : Director : : getInstance ( ) - > resume ( ) ; <nl> + } <nl> + <nl> + - ( void ) applicationDidEnterBackground : ( UIApplication * ) application { <nl> + / * <nl> + Use this method to release shared resources , save user data , invalidate timers , and store enough application state information to restore your application to its current state in case it is terminated later . <nl> + If your application supports background execution , called instead of applicationWillTerminate : when the user quits . <nl> + * / <nl> + cocos2d : : Application : : getInstance ( ) - > applicationDidEnterBackground ( ) ; <nl> + } <nl> + <nl> + - ( void ) applicationWillEnterForeground : ( UIApplication * ) application { <nl> + / * <nl> + Called as part of transition from the background to the inactive state : here you can undo many of the changes made on entering the background . <nl> + * / <nl> + cocos2d : : Application : : getInstance ( ) - > applicationWillEnterForeground ( ) ; <nl> + } <nl> + <nl> + - ( void ) applicationWillTerminate : ( UIApplication * ) application { <nl> + / * <nl> + Called when the application is about to terminate . <nl> + See also applicationDidEnterBackground : . <nl> + * / <nl> + } <nl> + <nl> + <nl> + # pragma mark - <nl> + # pragma mark Memory management <nl> + <nl> + - ( void ) applicationDidReceiveMemoryWarning : ( UIApplication * ) application { <nl> + / * <nl> + Free up as much memory as possible by purging cached data objects that can be recreated ( or reloaded from disk ) later . <nl> + * / <nl> + cocos2d : : Director : : getInstance ( ) - > purgeCachedData ( ) ; <nl> + } <nl> + <nl> + <nl> + - ( void ) dealloc { <nl> + [ super dealloc ] ; <nl> + } <nl> + <nl> + @ end <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 66c6d1cead37 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Default - 568h @ 2x . png differ <nl> new file mode 100644 <nl> index 000000000000 . . dcb80725de2a <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Default . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 84689888a14a <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Default @ 2x . png differ <nl> new file mode 100644 <nl> index 000000000000 . . c3807861ad29 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Icon - 114 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . a5b49ccbb199 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Icon - 120 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 1526615c02d1 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Icon - 144 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 8aa82506d0d1 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Icon - 152 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 4fcc6fddffe1 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Icon - 57 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 2c573c8df4c3 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Icon - 72 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 8a1fa1850c03 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . ios / Icon - 76 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 2a4c9dabd34a <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / Info . plist <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < ! DOCTYPE plist PUBLIC " - / / Apple / / DTD PLIST 1 . 0 / / EN " " http : / / www . apple . com / DTDs / PropertyList - 1 . 0 . dtd " > <nl> + < plist version = " 1 . 0 " > <nl> + < dict > <nl> + < key > NSAppTransportSecurity < / key > <nl> + < dict > <nl> + < key > NSAllowsArbitraryLoads < / key > <nl> + < false / > <nl> + < key > NSExceptionDomains < / key > <nl> + < dict > <nl> + < key > cocos2d - x . org < / key > <nl> + < dict > <nl> + < key > NSIncludesSubdomains < / key > <nl> + < true / > <nl> + < key > NSTemporaryExceptionAllowsInsecureHTTPLoads < / key > <nl> + < true / > <nl> + < key > NSTemporaryExceptionMinimumTLSVersion < / key > <nl> + < string > TLSv1 . 1 < / string > <nl> + < / dict > <nl> + < / dict > <nl> + < / dict > <nl> + < key > CFBundleDevelopmentRegion < / key > <nl> + < string > English < / string > <nl> + < key > CFBundleDisplayName < / key > <nl> + < string > $ { PRODUCT_NAME } < / string > <nl> + < key > CFBundleExecutable < / key > <nl> + < string > $ { EXECUTABLE_NAME } < / string > <nl> + < key > CFBundleIconFiles < / key > <nl> + < array > <nl> + < string > Icon - 72 . png < / string > <nl> + < string > Icon . png < / string > <nl> + < string > Icon @ 2x . png < / string > <nl> + < string > Icon - 57 . png < / string > <nl> + < string > Icon - 114 . png < / string > <nl> + < string > Icon - 144 . png < / string > <nl> + < / array > <nl> + < key > CFBundleIcons < / key > <nl> + < dict > <nl> + < key > CFBundlePrimaryIcon < / key > <nl> + < dict > <nl> + < key > CFBundleIconFiles < / key > <nl> + < array > <nl> + < string > Icon - 72 . png < / string > <nl> + < string > Icon . png < / string > <nl> + < string > Icon @ 2x . png < / string > <nl> + < string > Icon - 57 . png < / string > <nl> + < string > Icon - 114 . png < / string > <nl> + < string > Icon - 144 . png < / string > <nl> + < / array > <nl> + < key > UIPrerenderedIcon < / key > <nl> + < true / > <nl> + < / dict > <nl> + < / dict > <nl> + < key > CFBundleIdentifier < / key > <nl> + < string > $ ( PRODUCT_BUNDLE_IDENTIFIER ) < / string > <nl> + < key > CFBundleInfoDictionaryVersion < / key > <nl> + < string > 6 . 0 < / string > <nl> + < key > CFBundleName < / key > <nl> + < string > $ { PRODUCT_NAME } < / string > <nl> + < key > CFBundlePackageType < / key > <nl> + < string > APPL < / string > <nl> + < key > CFBundleSignature < / key > <nl> + < string > ? ? ? ? < / string > <nl> + < key > CFBundleURLTypes < / key > <nl> + < array > <nl> + < dict > <nl> + < key > CFBundleURLSchemes < / key > <nl> + < array > <nl> + < string > fb1426774790893461 < / string > <nl> + < / array > <nl> + < / dict > <nl> + < / array > <nl> + < key > CFBundleVersion < / key > <nl> + < string > 1 . 0 < / string > <nl> + < key > FacebookAppID < / key > <nl> + < string > 1426774790893461 < / string > <nl> + < key > FacebookDisplayName < / key > <nl> + < string > myFc < / string > <nl> + < key > LSRequiresIPhoneOS < / key > <nl> + < true / > <nl> + < key > UIAppFonts < / key > <nl> + < array > <nl> + < string > res / fonts / A Damn Mess . ttf < / string > <nl> + < string > res / fonts / Abberancy . ttf < / string > <nl> + < string > res / fonts / Abduction . ttf < / string > <nl> + < string > res / fonts / American Typewriter . ttf < / string > <nl> + < string > res / fonts / Courier New . ttf < / string > <nl> + < string > res / fonts / Marker Felt . ttf < / string > <nl> + < string > res / fonts / Paint Boy . ttf < / string > <nl> + < string > res / fonts / Schwarzwald Regular . ttf < / string > <nl> + < string > res / fonts / Scissor Cuts . ttf < / string > <nl> + < string > res / fonts / tahoma . ttf < / string > <nl> + < string > res / fonts / Thonburi . ttf < / string > <nl> + < string > res / fonts / ThonburiBold . ttf < / string > <nl> + < / array > <nl> + < key > UIPrerenderedIcon < / key > <nl> + < true / > <nl> + < key > UIRequiredDeviceCapabilities < / key > <nl> + < dict > <nl> + < key > accelerometer < / key > <nl> + < true / > <nl> + < key > opengles - 1 < / key > <nl> + < true / > <nl> + < / dict > <nl> + < key > UIStatusBarHidden < / key > <nl> + < true / > <nl> + < key > UISupportedInterfaceOrientations < / key > <nl> + < array > <nl> + < string > UIInterfaceOrientationLandscapeRight < / string > <nl> + < string > UIInterfaceOrientationLandscapeLeft < / string > <nl> + < / array > <nl> + < / dict > <nl> + < / plist > <nl> new file mode 100644 <nl> index 000000000000 . . 64e92cc0ab30 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / NativeOcClass . h <nl> <nl> + / * <nl> + * Copyright ( c ) 2013 - 2014 Chukong Technologies Inc . <nl> + * <nl> + * Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + * of this software and associated documentation files ( the " Software " ) , to deal <nl> + * in the Software without restriction , including without limitation the rights <nl> + * to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + * copies of the Software , and to permit persons to whom the Software is <nl> + * furnished to do so , subject to the following conditions : <nl> + * <nl> + * The above copyright notice and this permission notice shall be included in <nl> + * all copies or substantial portions of the Software . <nl> + * <nl> + * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + * IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + * LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + * THE SOFTWARE . <nl> + * / <nl> + <nl> + <nl> + # import < Foundation / Foundation . h > <nl> + <nl> + @ interface NativeOcClass : NSObject <nl> + <nl> + + ( float ) callNative : ( NSNumber * ) a andInt : ( NSString * ) str ; <nl> + + ( void ) callNativeWithParam : ( NSString * ) str ; <nl> + + ( NSString * ) callNativeWithReturnString ; <nl> + + ( BOOL ) callNativeUIWithTitle : ( NSString * ) title andContent : ( NSString * ) content ; <nl> + + ( BOOL ) callNativeUIWithTitle : ( NSString * ) title andContent : ( NSString * ) content addBool : ( BOOL ) logicSwitch ; <nl> + + ( int ) callNativeWithAdd : ( NSNumber * ) num1 and : ( NSNumber * ) num2 ; <nl> + @ end <nl> new file mode 100644 <nl> index 000000000000 . . 0bcfd9c355ab <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / NativeOcClass . m <nl> <nl> + / * <nl> + * Copyright ( c ) 2013 - 2014 Chukong Technologies Inc . <nl> + * <nl> + * Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + * of this software and associated documentation files ( the " Software " ) , to deal <nl> + * in the Software without restriction , including without limitation the rights <nl> + * to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + * copies of the Software , and to permit persons to whom the Software is <nl> + * furnished to do so , subject to the following conditions : <nl> + * <nl> + * The above copyright notice and this permission notice shall be included in <nl> + * all copies or substantial portions of the Software . <nl> + * <nl> + * THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + * IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + * LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + * THE SOFTWARE . <nl> + * / <nl> + <nl> + # import " NativeOcClass . h " <nl> + # if TARGET_OS_IPHONE <nl> + # import < UIKit / UIKit . h > <nl> + # elif TARGET_OS_MAC <nl> + # import < AppKit / AppKit . h > <nl> + # endif <nl> + @ implementation NativeOcClass <nl> + + ( float ) callNative : ( NSNumber * ) a andInt : ( NSString * ) str { <nl> + float b = [ a floatValue ] + 111 . 3333 ; <nl> + NSLog ( @ " callNative string is % @ and int value is % f " , str , b ) ; <nl> + return b ; <nl> + } <nl> + + ( void ) callNativeWithParam : ( NSString * ) str { <nl> + NSLog ( @ " callNativeWithParam : str is % @ " , str ) ; <nl> + } <nl> + + ( NSString * ) callNativeWithReturnString { <nl> + return @ " yes is a return string form objective - c " ; <nl> + } <nl> + + ( BOOL ) callNativeWithReturnBool { <nl> + return true ; <nl> + } <nl> + + ( int ) callNativeWithAdd : ( NSNumber * ) num1 and : ( NSNumber * ) num2 { <nl> + return [ num1 intValue ] + [ num2 intValue ] ; <nl> + } <nl> + # if TARGET_OS_IPHONE <nl> + + ( BOOL ) callNativeUIWithTitle : ( NSString * ) title andContent : ( NSString * ) content { <nl> + UIAlertView * alertView = [ [ UIAlertView alloc ] initWithTitle : title message : content delegate : self cancelButtonTitle : @ " Cancel " otherButtonTitles : @ " OK " , nil ] ; <nl> + [ alertView show ] ; <nl> + return true ; <nl> + } <nl> + + ( BOOL ) callNativeUIWithTitle : ( NSString * ) title andContent : ( NSString * ) content addBool : ( BOOL ) logicSwitch { <nl> + if ( logicSwitch ) <nl> + { <nl> + UIAlertView * alertView = [ [ UIAlertView alloc ] initWithTitle : title message : content delegate : self cancelButtonTitle : @ " Cancel " otherButtonTitles : @ " it ' s true " , nil ] ; <nl> + [ alertView show ] ; <nl> + } <nl> + else <nl> + { <nl> + UIAlertView * alertView = [ [ UIAlertView alloc ] initWithTitle : title message : content delegate : self cancelButtonTitle : @ " Cancel " otherButtonTitles : @ " it ' s false " , nil ] ; <nl> + [ alertView show ] ; <nl> + } <nl> + return true ; <nl> + } <nl> + # elif TARGET_OS_MAC <nl> + <nl> + + ( BOOL ) callNativeUIWithTitle : ( NSString * ) title andContent : ( NSString * ) content { <nl> + NSAlert * alert = [ [ NSAlert alloc ] init ] ; <nl> + [ alert addButtonWithTitle : @ " OK " ] ; <nl> + [ alert addButtonWithTitle : @ " Cancel " ] ; <nl> + [ alert setMessageText : title ] ; <nl> + [ alert setInformativeText : content ] ; <nl> + [ alert setAlertStyle : NSWarningAlertStyle ] ; <nl> + [ alert runModal ] ; <nl> + return true ; <nl> + } <nl> + <nl> + + ( BOOL ) callNativeUIWithTitle : ( NSString * ) title andContent : ( NSString * ) content addBool : ( BOOL ) logicSwitch { <nl> + NSAlert * alert = [ [ NSAlert alloc ] init ] ; <nl> + if ( logicSwitch ) <nl> + { <nl> + [ alert addButtonWithTitle : @ " it ' s true " ] ; <nl> + [ alert addButtonWithTitle : @ " Cancel " ] ; <nl> + } <nl> + else <nl> + { <nl> + [ alert addButtonWithTitle : @ " it ' s false " ] ; <nl> + [ alert addButtonWithTitle : @ " Cancel " ] ; <nl> + } <nl> + <nl> + [ alert setMessageText : title ] ; <nl> + [ alert setInformativeText : content ] ; <nl> + [ alert setAlertStyle : NSWarningAlertStyle ] ; <nl> + [ alert runModal ] ; <nl> + return true ; <nl> + } <nl> + # endif <nl> + @ end <nl> new file mode 100644 <nl> index 000000000000 . . b056d8694a20 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / Prefix . pch <nl> <nl> + / / <nl> + / / Prefix header for all source files of the ' testjs ' target in the ' testjs ' project <nl> + / / <nl> + <nl> + # ifdef __OBJC__ <nl> + # import < Foundation / Foundation . h > <nl> + # import < UIKit / UIKit . h > <nl> + # endif <nl> new file mode 100644 <nl> index 000000000000 . . 11dfc4bf88c5 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / RootViewController . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2010 - 2011 cocos2d - x . org <nl> + Copyright ( c ) 2010 Ricardo Quesada <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + # import < UIKit / UIKit . h > <nl> + <nl> + <nl> + @ interface RootViewController : UIViewController { <nl> + <nl> + } <nl> + - ( BOOL ) prefersStatusBarHidden ; <nl> + @ end <nl> new file mode 100644 <nl> index 000000000000 . . 8438d7a42037 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / RootViewController . mm <nl> <nl> + / / <nl> + / / testjsAppController . h <nl> + / / testjs <nl> + / / <nl> + / / Created by Rolando Abarca on 3 / 19 / 12 . <nl> + / / Copyright __MyCompanyName__ 2012 . All rights reserved . <nl> + / / <nl> + <nl> + # import " RootViewController . h " <nl> + <nl> + <nl> + @ implementation RootViewController <nl> + <nl> + / * <nl> + / / The designated initializer . Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad . <nl> + - ( id ) initWithNibName : ( NSString * ) nibNameOrNil bundle : ( NSBundle * ) nibBundleOrNil { <nl> + if ( ( self = [ super initWithNibName : nibNameOrNil bundle : nibBundleOrNil ] ) ) { <nl> + / / Custom initialization <nl> + } <nl> + return self ; <nl> + } <nl> + * / <nl> + <nl> + / * <nl> + / / Implement loadView to create a view hierarchy programmatically , without using a nib . <nl> + - ( void ) loadView { <nl> + } <nl> + * / <nl> + <nl> + / * <nl> + / / Implement viewDidLoad to do additional setup after loading the view , typically from a nib . <nl> + - ( void ) viewDidLoad { <nl> + [ super viewDidLoad ] ; <nl> + } <nl> + <nl> + * / <nl> + / / Override to allow orientations other than the default portrait orientation . <nl> + / / This method is deprecated on ios6 <nl> + - ( BOOL ) shouldAutorotateToInterfaceOrientation : ( UIInterfaceOrientation ) interfaceOrientation { <nl> + return UIInterfaceOrientationIsLandscape ( interfaceOrientation ) ; <nl> + } <nl> + <nl> + / / For ios6 , use supportedInterfaceOrientations & shouldAutorotate instead <nl> + - ( NSUInteger ) supportedInterfaceOrientations { <nl> + # ifdef __IPHONE_6_0 <nl> + return UIInterfaceOrientationMaskAllButUpsideDown ; <nl> + # endif <nl> + } <nl> + <nl> + - ( BOOL ) shouldAutorotate { <nl> + return YES ; <nl> + } <nl> + <nl> + / / fix not hide status on ios7 <nl> + - ( BOOL ) prefersStatusBarHidden <nl> + { <nl> + return YES ; <nl> + } <nl> + <nl> + - ( void ) didReceiveMemoryWarning { <nl> + / / Releases the view if it doesn ' t have a superview . <nl> + [ super didReceiveMemoryWarning ] ; <nl> + <nl> + / / Release any cached data , images , etc that aren ' t in use . <nl> + } <nl> + <nl> + - ( void ) viewDidUnload { <nl> + [ super viewDidUnload ] ; <nl> + / / Release any retained subviews of the main view . <nl> + / / e . g . self . myOutlet = nil ; <nl> + } <nl> + <nl> + <nl> + - ( void ) dealloc { <nl> + [ super dealloc ] ; <nl> + } <nl> + <nl> + <nl> + @ end <nl> new file mode 100644 <nl> index 000000000000 . . e3dedca28bc3 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . ios / main . m <nl> <nl> + / / <nl> + / / main . m <nl> + / / testjs <nl> + / / <nl> + / / Created by Rolando Abarca on 3 / 19 / 12 . <nl> + / / Copyright __MyCompanyName__ 2012 . All rights reserved . <nl> + / / <nl> + <nl> + # import < UIKit / UIKit . h > <nl> + <nl> + int main ( int argc , char * argv [ ] ) { <nl> + <nl> + NSAutoreleasePool * pool = [ [ NSAutoreleasePool alloc ] init ] ; <nl> + int retVal = UIApplicationMain ( argc , argv , nil , @ " AppController " ) ; <nl> + [ pool release ] ; <nl> + return retVal ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . e236a953b382 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . linux / main . cpp <nl> <nl> + # include " . . / Classes / AppDelegate . h " <nl> + <nl> + USING_NS_CC ; <nl> + <nl> + int main ( int argc , char * * argv ) <nl> + { <nl> + / / create the application instance <nl> + AppDelegate app ; <nl> + return Application : : getInstance ( ) - > run ( ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 3d09e8fb4f4c <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . mac / Icon . icns differ <nl> new file mode 100644 <nl> index 000000000000 . . 608a82cdac1e <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . mac / Test_Info . plist <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < ! DOCTYPE plist PUBLIC " - / / Apple / / DTD PLIST 1 . 0 / / EN " " http : / / www . apple . com / DTDs / PropertyList - 1 . 0 . dtd " > <nl> + < plist version = " 1 . 0 " > <nl> + < dict > <nl> + < key > CFBundleDevelopmentRegion < / key > <nl> + < string > en < / string > <nl> + < key > CFBundleExecutable < / key > <nl> + < string > $ { EXECUTABLE_NAME } < / string > <nl> + < key > CFBundleIconFile < / key > <nl> + < string > Icon < / string > <nl> + < key > CFBundleIdentifier < / key > <nl> + < string > $ ( PRODUCT_BUNDLE_IDENTIFIER ) < / string > <nl> + < key > CFBundleInfoDictionaryVersion < / key > <nl> + < string > 6 . 0 < / string > <nl> + < key > CFBundleName < / key > <nl> + < string > $ { PRODUCT_NAME } < / string > <nl> + < key > CFBundlePackageType < / key > <nl> + < string > APPL < / string > <nl> + < key > CFBundleShortVersionString < / key > <nl> + < string > 1 . 0 < / string > <nl> + < key > CFBundleSignature < / key > <nl> + < string > ? ? ? ? < / string > <nl> + < key > CFBundleVersion < / key > <nl> + < string > 1 < / string > <nl> + < key > LSMinimumSystemVersion < / key > <nl> + < string > $ { MACOSX_DEPLOYMENT_TARGET } < / string > <nl> + < key > NSHumanReadableCopyright < / key > <nl> + < string > Copyright © 2012 . All rights reserved . < / string > <nl> + < key > NSMainNibFile < / key > <nl> + < string > MainMenu < / string > <nl> + < key > NSPrincipalClass < / key > <nl> + < string > NSApplication < / string > <nl> + < / dict > <nl> + < / plist > <nl> new file mode 100644 <nl> index 000000000000 . . 46c36a7e99f1 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . mac / Test_Prefix . pch <nl> <nl> + / / <nl> + / / Prefix header for all source files of the ' Paralaxer ' target in the ' Paralaxer ' project <nl> + / / <nl> + <nl> + # ifdef __OBJC__ <nl> + # import < Cocoa / Cocoa . h > <nl> + # endif <nl> new file mode 100644 <nl> index 000000000000 . . 477b28ff8f86 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . mac / en . lproj / InfoPlist . strings <nl> <nl> + / * Localized versions of Info . plist keys * / <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . 3dacdedbd0ba <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . mac / en . lproj / MainMenu . xib <nl> <nl> + < ? xml version = " 1 . 0 " encoding = " UTF - 8 " ? > <nl> + < archive type = " com . apple . InterfaceBuilder3 . Cocoa . XIB " version = " 7 . 10 " > <nl> + < data > <nl> + < int key = " IBDocument . SystemTarget " > 1060 < / int > <nl> + < string key = " IBDocument . SystemVersion " > 10K549 < / string > <nl> + < string key = " IBDocument . InterfaceBuilderVersion " > 1938 < / string > <nl> + < string key = " IBDocument . AppKitVersion " > 1038 . 36 < / string > <nl> + < string key = " IBDocument . HIToolboxVersion " > 461 . 00 < / string > <nl> + < object class = " NSMutableDictionary " key = " IBDocument . PluginVersions " > <nl> + < string key = " NS . key . 0 " > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string key = " NS . object . 0 " > 1938 < / string > <nl> + < / object > <nl> + < object class = " NSArray " key = " IBDocument . IntegratedClassDependencies " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > NSMenuItem < / string > <nl> + < string > NSCustomObject < / string > <nl> + < string > NSMenu < / string > <nl> + < / object > <nl> + < object class = " NSArray " key = " IBDocument . PluginDependencies " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < / object > <nl> + < object class = " NSMutableDictionary " key = " IBDocument . Metadata " > <nl> + < string key = " NS . key . 0 " > PluginDependencyRecalculationVersion < / string > <nl> + < integer value = " 1 " key = " NS . object . 0 " / > <nl> + < / object > <nl> + < object class = " NSMutableArray " key = " IBDocument . RootObjects " id = " 1048 " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSCustomObject " id = " 1021 " > <nl> + < string key = " NSClassName " > NSApplication < / string > <nl> + < / object > <nl> + < object class = " NSCustomObject " id = " 1014 " > <nl> + < string key = " NSClassName " > FirstResponder < / string > <nl> + < / object > <nl> + < object class = " NSCustomObject " id = " 1050 " > <nl> + < string key = " NSClassName " > NSApplication < / string > <nl> + < / object > <nl> + < object class = " NSMenu " id = " 649796088 " > <nl> + < string key = " NSTitle " > AMainMenu < / string > <nl> + < object class = " NSMutableArray " key = " NSMenuItems " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSMenuItem " id = " 694149608 " > <nl> + < reference key = " NSMenu " ref = " 649796088 " / > <nl> + < string key = " NSTitle " > TestCpp < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < object class = " NSCustomResource " key = " NSOnImage " id = " 35465992 " > <nl> + < string key = " NSClassName " > NSImage < / string > <nl> + < string key = " NSResourceName " > NSMenuCheckmark < / string > <nl> + < / object > <nl> + < object class = " NSCustomResource " key = " NSMixedImage " id = " 502551668 " > <nl> + < string key = " NSClassName " > NSImage < / string > <nl> + < string key = " NSResourceName " > NSMenuMixedState < / string > <nl> + < / object > <nl> + < string key = " NSAction " > submenuAction : < / string > <nl> + < object class = " NSMenu " key = " NSSubmenu " id = " 110575045 " > <nl> + < string key = " NSTitle " > TestCpp < / string > <nl> + < object class = " NSMutableArray " key = " NSMenuItems " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSMenuItem " id = " 238522557 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < string key = " NSTitle " > About TestCpp < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 304266470 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < bool key = " NSIsDisabled " > YES < / bool > <nl> + < bool key = " NSIsSeparator " > YES < / bool > <nl> + < string key = " NSTitle " / > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 609285721 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < string key = " NSTitle " > Preferences … < / string > <nl> + < string key = " NSKeyEquiv " > , < / string > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 481834944 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < bool key = " NSIsDisabled " > YES < / bool > <nl> + < bool key = " NSIsSeparator " > YES < / bool > <nl> + < string key = " NSTitle " / > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 1046388886 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < string key = " NSTitle " > Services < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < string key = " NSAction " > submenuAction : < / string > <nl> + < object class = " NSMenu " key = " NSSubmenu " id = " 752062318 " > <nl> + < string key = " NSTitle " > Services < / string > <nl> + < object class = " NSMutableArray " key = " NSMenuItems " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < / object > <nl> + < string key = " NSName " > _NSServicesMenu < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 646227648 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < bool key = " NSIsDisabled " > YES < / bool > <nl> + < bool key = " NSIsSeparator " > YES < / bool > <nl> + < string key = " NSTitle " / > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 755159360 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < string key = " NSTitle " > Hide TestCpp < / string > <nl> + < string key = " NSKeyEquiv " > h < / string > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 342932134 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < string key = " NSTitle " > Hide Others < / string > <nl> + < string key = " NSKeyEquiv " > h < / string > <nl> + < int key = " NSKeyEquivModMask " > 1572864 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 908899353 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < string key = " NSTitle " > Show All < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 1056857174 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < bool key = " NSIsDisabled " > YES < / bool > <nl> + < bool key = " NSIsSeparator " > YES < / bool > <nl> + < string key = " NSTitle " / > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 632727374 " > <nl> + < reference key = " NSMenu " ref = " 110575045 " / > <nl> + < string key = " NSTitle " > Quit TestCpp < / string > <nl> + < string key = " NSKeyEquiv " > q < / string > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < / object > <nl> + < string key = " NSName " > _NSAppleMenu < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 586577488 " > <nl> + < reference key = " NSMenu " ref = " 649796088 " / > <nl> + < string key = " NSTitle " > View < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < string key = " NSAction " > submenuAction : < / string > <nl> + < object class = " NSMenu " key = " NSSubmenu " id = " 466310130 " > <nl> + < string key = " NSTitle " > View < / string > <nl> + < object class = " NSMutableArray " key = " NSMenuItems " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSMenuItem " id = " 204933491 " > <nl> + < reference key = " NSMenu " ref = " 466310130 " / > <nl> + < string key = " NSTitle " > Toggle Fullscreen < / string > <nl> + < string key = " NSKeyEquiv " > f < / string > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 713487014 " > <nl> + < reference key = " NSMenu " ref = " 649796088 " / > <nl> + < string key = " NSTitle " > Window < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < string key = " NSAction " > submenuAction : < / string > <nl> + < object class = " NSMenu " key = " NSSubmenu " id = " 835318025 " > <nl> + < string key = " NSTitle " > Window < / string > <nl> + < object class = " NSMutableArray " key = " NSMenuItems " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSMenuItem " id = " 1011231497 " > <nl> + < reference key = " NSMenu " ref = " 835318025 " / > <nl> + < string key = " NSTitle " > Minimize < / string > <nl> + < string key = " NSKeyEquiv " > m < / string > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 575023229 " > <nl> + < reference key = " NSMenu " ref = " 835318025 " / > <nl> + < string key = " NSTitle " > Zoom < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 299356726 " > <nl> + < reference key = " NSMenu " ref = " 835318025 " / > <nl> + < bool key = " NSIsDisabled " > YES < / bool > <nl> + < bool key = " NSIsSeparator " > YES < / bool > <nl> + < string key = " NSTitle " / > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 625202149 " > <nl> + < reference key = " NSMenu " ref = " 835318025 " / > <nl> + < string key = " NSTitle " > Bring All to Front < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < / object > <nl> + < string key = " NSName " > _NSWindowsMenu < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMenuItem " id = " 448692316 " > <nl> + < reference key = " NSMenu " ref = " 649796088 " / > <nl> + < string key = " NSTitle " > Help < / string > <nl> + < string key = " NSKeyEquiv " / > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < string key = " NSAction " > submenuAction : < / string > <nl> + < object class = " NSMenu " key = " NSSubmenu " id = " 992780483 " > <nl> + < string key = " NSTitle " > Help < / string > <nl> + < object class = " NSMutableArray " key = " NSMenuItems " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSMenuItem " id = " 105068016 " > <nl> + < reference key = " NSMenu " ref = " 992780483 " / > <nl> + < string key = " NSTitle " > TestCpp Help < / string > <nl> + < string key = " NSKeyEquiv " > ? < / string > <nl> + < int key = " NSKeyEquivModMask " > 1048576 < / int > <nl> + < int key = " NSMnemonicLoc " > 2147483647 < / int > <nl> + < reference key = " NSOnImage " ref = " 35465992 " / > <nl> + < reference key = " NSMixedImage " ref = " 502551668 " / > <nl> + < / object > <nl> + < / object > <nl> + < string key = " NSName " > _NSHelpMenu < / string > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < string key = " NSName " > _NSMainMenu < / string > <nl> + < / object > <nl> + < object class = " NSCustomObject " id = " 976324537 " > <nl> + < string key = " NSClassName " > AppController < / string > <nl> + < / object > <nl> + < object class = " NSCustomObject " id = " 755631768 " > <nl> + < string key = " NSClassName " > NSFontManager < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " IBObjectContainer " key = " IBDocument . Objects " > <nl> + < object class = " NSMutableArray " key = " connectionRecords " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > terminate : < / string > <nl> + < reference key = " source " ref = " 1050 " / > <nl> + < reference key = " destination " ref = " 632727374 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 449 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > orderFrontStandardAboutPanel : < / string > <nl> + < reference key = " source " ref = " 1021 " / > <nl> + < reference key = " destination " ref = " 238522557 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 142 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBOutletConnection " key = " connection " > <nl> + < string key = " label " > delegate < / string > <nl> + < reference key = " source " ref = " 1021 " / > <nl> + < reference key = " destination " ref = " 976324537 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 495 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > performMiniaturize : < / string > <nl> + < reference key = " source " ref = " 1014 " / > <nl> + < reference key = " destination " ref = " 1011231497 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 37 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > arrangeInFront : < / string > <nl> + < reference key = " source " ref = " 1014 " / > <nl> + < reference key = " destination " ref = " 625202149 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 39 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > performZoom : < / string > <nl> + < reference key = " source " ref = " 1014 " / > <nl> + < reference key = " destination " ref = " 575023229 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 240 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > hide : < / string > <nl> + < reference key = " source " ref = " 1014 " / > <nl> + < reference key = " destination " ref = " 755159360 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 367 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > hideOtherApplications : < / string > <nl> + < reference key = " source " ref = " 1014 " / > <nl> + < reference key = " destination " ref = " 342932134 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 368 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > unhideAllApplications : < / string > <nl> + < reference key = " source " ref = " 1014 " / > <nl> + < reference key = " destination " ref = " 908899353 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 370 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > showHelp : < / string > <nl> + < reference key = " source " ref = " 1014 " / > <nl> + < reference key = " destination " ref = " 105068016 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 493 < / int > <nl> + < / object > <nl> + < object class = " IBConnectionRecord " > <nl> + < object class = " IBActionConnection " key = " connection " > <nl> + < string key = " label " > toggleFullScreen : < / string > <nl> + < reference key = " source " ref = " 976324537 " / > <nl> + < reference key = " destination " ref = " 204933491 " / > <nl> + < / object > <nl> + < int key = " connectionID " > 537 < / int > <nl> + < / object > <nl> + < / object > <nl> + < object class = " IBMutableOrderedSet " key = " objectRecords " > <nl> + < object class = " NSArray " key = " orderedObjects " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 0 < / int > <nl> + < object class = " NSArray " key = " object " id = " 0 " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < / object > <nl> + < reference key = " children " ref = " 1048 " / > <nl> + < nil key = " parent " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > - 2 < / int > <nl> + < reference key = " object " ref = " 1021 " / > <nl> + < reference key = " parent " ref = " 0 " / > <nl> + < string key = " objectName " > File ' s Owner < / string > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > - 1 < / int > <nl> + < reference key = " object " ref = " 1014 " / > <nl> + < reference key = " parent " ref = " 0 " / > <nl> + < string key = " objectName " > First Responder < / string > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > - 3 < / int > <nl> + < reference key = " object " ref = " 1050 " / > <nl> + < reference key = " parent " ref = " 0 " / > <nl> + < string key = " objectName " > Application < / string > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 29 < / int > <nl> + < reference key = " object " ref = " 649796088 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 713487014 " / > <nl> + < reference ref = " 694149608 " / > <nl> + < reference ref = " 586577488 " / > <nl> + < reference ref = " 448692316 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 0 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 19 < / int > <nl> + < reference key = " object " ref = " 713487014 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 835318025 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 649796088 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 56 < / int > <nl> + < reference key = " object " ref = " 694149608 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 110575045 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 649796088 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 57 < / int > <nl> + < reference key = " object " ref = " 110575045 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 238522557 " / > <nl> + < reference ref = " 755159360 " / > <nl> + < reference ref = " 908899353 " / > <nl> + < reference ref = " 632727374 " / > <nl> + < reference ref = " 646227648 " / > <nl> + < reference ref = " 609285721 " / > <nl> + < reference ref = " 481834944 " / > <nl> + < reference ref = " 304266470 " / > <nl> + < reference ref = " 1046388886 " / > <nl> + < reference ref = " 1056857174 " / > <nl> + < reference ref = " 342932134 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 694149608 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 58 < / int > <nl> + < reference key = " object " ref = " 238522557 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 134 < / int > <nl> + < reference key = " object " ref = " 755159360 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 150 < / int > <nl> + < reference key = " object " ref = " 908899353 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 136 < / int > <nl> + < reference key = " object " ref = " 632727374 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 144 < / int > <nl> + < reference key = " object " ref = " 646227648 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 129 < / int > <nl> + < reference key = " object " ref = " 609285721 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 143 < / int > <nl> + < reference key = " object " ref = " 481834944 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 236 < / int > <nl> + < reference key = " object " ref = " 304266470 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 131 < / int > <nl> + < reference key = " object " ref = " 1046388886 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 752062318 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 149 < / int > <nl> + < reference key = " object " ref = " 1056857174 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 145 < / int > <nl> + < reference key = " object " ref = " 342932134 " / > <nl> + < reference key = " parent " ref = " 110575045 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 130 < / int > <nl> + < reference key = " object " ref = " 752062318 " / > <nl> + < reference key = " parent " ref = " 1046388886 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 24 < / int > <nl> + < reference key = " object " ref = " 835318025 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 299356726 " / > <nl> + < reference ref = " 625202149 " / > <nl> + < reference ref = " 575023229 " / > <nl> + < reference ref = " 1011231497 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 713487014 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 92 < / int > <nl> + < reference key = " object " ref = " 299356726 " / > <nl> + < reference key = " parent " ref = " 835318025 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 5 < / int > <nl> + < reference key = " object " ref = " 625202149 " / > <nl> + < reference key = " parent " ref = " 835318025 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 239 < / int > <nl> + < reference key = " object " ref = " 575023229 " / > <nl> + < reference key = " parent " ref = " 835318025 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 23 < / int > <nl> + < reference key = " object " ref = " 1011231497 " / > <nl> + < reference key = " parent " ref = " 835318025 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 295 < / int > <nl> + < reference key = " object " ref = " 586577488 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 466310130 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 649796088 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 296 < / int > <nl> + < reference key = " object " ref = " 466310130 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 204933491 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 586577488 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 420 < / int > <nl> + < reference key = " object " ref = " 755631768 " / > <nl> + < reference key = " parent " ref = " 0 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 490 < / int > <nl> + < reference key = " object " ref = " 448692316 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 992780483 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 649796088 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 491 < / int > <nl> + < reference key = " object " ref = " 992780483 " / > <nl> + < object class = " NSMutableArray " key = " children " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference ref = " 105068016 " / > <nl> + < / object > <nl> + < reference key = " parent " ref = " 448692316 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 492 < / int > <nl> + < reference key = " object " ref = " 105068016 " / > <nl> + < reference key = " parent " ref = " 992780483 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 494 < / int > <nl> + < reference key = " object " ref = " 976324537 " / > <nl> + < reference key = " parent " ref = " 0 " / > <nl> + < / object > <nl> + < object class = " IBObjectRecord " > <nl> + < int key = " objectID " > 536 < / int > <nl> + < reference key = " object " ref = " 204933491 " / > <nl> + < reference key = " parent " ref = " 466310130 " / > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMutableDictionary " key = " flattenedProperties " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSArray " key = " dict . sortedKeys " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > - 1 . IBPluginDependency < / string > <nl> + < string > - 2 . IBPluginDependency < / string > <nl> + < string > - 3 . IBPluginDependency < / string > <nl> + < string > 129 . IBPluginDependency < / string > <nl> + < string > 130 . IBPluginDependency < / string > <nl> + < string > 131 . IBPluginDependency < / string > <nl> + < string > 134 . IBPluginDependency < / string > <nl> + < string > 136 . IBPluginDependency < / string > <nl> + < string > 143 . IBPluginDependency < / string > <nl> + < string > 144 . IBPluginDependency < / string > <nl> + < string > 145 . IBPluginDependency < / string > <nl> + < string > 149 . IBPluginDependency < / string > <nl> + < string > 150 . IBPluginDependency < / string > <nl> + < string > 19 . IBPluginDependency < / string > <nl> + < string > 23 . IBPluginDependency < / string > <nl> + < string > 236 . IBPluginDependency < / string > <nl> + < string > 239 . IBPluginDependency < / string > <nl> + < string > 24 . IBPluginDependency < / string > <nl> + < string > 29 . IBPluginDependency < / string > <nl> + < string > 295 . IBPluginDependency < / string > <nl> + < string > 296 . IBPluginDependency < / string > <nl> + < string > 420 . IBPluginDependency < / string > <nl> + < string > 490 . IBPluginDependency < / string > <nl> + < string > 491 . IBPluginDependency < / string > <nl> + < string > 492 . IBPluginDependency < / string > <nl> + < string > 494 . IBPluginDependency < / string > <nl> + < string > 5 . IBPluginDependency < / string > <nl> + < string > 536 . IBPluginDependency < / string > <nl> + < string > 56 . IBPluginDependency < / string > <nl> + < string > 57 . IBPluginDependency < / string > <nl> + < string > 58 . IBPluginDependency < / string > <nl> + < string > 92 . IBPluginDependency < / string > <nl> + < / object > <nl> + < object class = " NSMutableArray " key = " dict . values " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < string > com . apple . InterfaceBuilder . CocoaPlugin < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMutableDictionary " key = " unlocalizedProperties " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference key = " dict . sortedKeys " ref = " 0 " / > <nl> + < reference key = " dict . values " ref = " 0 " / > <nl> + < / object > <nl> + < nil key = " activeLocalization " / > <nl> + < object class = " NSMutableDictionary " key = " localizations " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < reference key = " dict . sortedKeys " ref = " 0 " / > <nl> + < reference key = " dict . values " ref = " 0 " / > <nl> + < / object > <nl> + < nil key = " sourceID " / > <nl> + < int key = " maxID " > 541 < / int > <nl> + < / object > <nl> + < object class = " IBClassDescriber " key = " IBDocument . Classes " > <nl> + < object class = " NSMutableArray " key = " referencedPartialClassDescriptions " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " IBPartialClassDescription " > <nl> + < string key = " className " > AppController < / string > <nl> + < string key = " superclassName " > NSObject < / string > <nl> + < object class = " NSMutableDictionary " key = " actions " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSArray " key = " dict . sortedKeys " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > exitFullScreen : < / string > <nl> + < string > toggleFullScreen : < / string > <nl> + < / object > <nl> + < object class = " NSMutableArray " key = " dict . values " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > id < / string > <nl> + < string > id < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMutableDictionary " key = " actionInfosByName " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSArray " key = " dict . sortedKeys " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > exitFullScreen : < / string > <nl> + < string > toggleFullScreen : < / string > <nl> + < / object > <nl> + < object class = " NSMutableArray " key = " dict . values " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " IBActionInfo " > <nl> + < string key = " name " > exitFullScreen : < / string > <nl> + < string key = " candidateClassName " > id < / string > <nl> + < / object > <nl> + < object class = " IBActionInfo " > <nl> + < string key = " name " > toggleFullScreen : < / string > <nl> + < string key = " candidateClassName " > id < / string > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMutableDictionary " key = " outlets " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSArray " key = " dict . sortedKeys " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > glView < / string > <nl> + < string > window < / string > <nl> + < / object > <nl> + < object class = " NSMutableArray " key = " dict . values " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > EAGLView < / string > <nl> + < string > NSWindow < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " NSMutableDictionary " key = " toOneOutletInfosByName " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSArray " key = " dict . sortedKeys " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > glView < / string > <nl> + < string > window < / string > <nl> + < / object > <nl> + < object class = " NSMutableArray " key = " dict . values " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " IBToOneOutletInfo " > <nl> + < string key = " name " > glView < / string > <nl> + < string key = " candidateClassName " > EAGLView < / string > <nl> + < / object > <nl> + < object class = " IBToOneOutletInfo " > <nl> + < string key = " name " > window < / string > <nl> + < string key = " candidateClassName " > NSWindow < / string > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < object class = " IBClassDescriptionSource " key = " sourceIdentifier " > <nl> + < string key = " majorKey " > IBProjectSource < / string > <nl> + < string key = " minorKey " > . / Classes / AppController . h < / string > <nl> + < / object > <nl> + < / object > <nl> + < object class = " IBPartialClassDescription " > <nl> + < string key = " className " > EAGLView < / string > <nl> + < string key = " superclassName " > NSOpenGLView < / string > <nl> + < object class = " IBClassDescriptionSource " key = " sourceIdentifier " > <nl> + < string key = " majorKey " > IBProjectSource < / string > <nl> + < string key = " minorKey " > . / Classes / EAGLView . h < / string > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < / object > <nl> + < int key = " IBDocument . localizationMode " > 0 < / int > <nl> + < string key = " IBDocument . TargetRuntimeIdentifier " > IBCocoaFramework < / string > <nl> + < object class = " NSMutableDictionary " key = " IBDocument . PluginDeclaredDevelopmentDependencies " > <nl> + < string key = " NS . key . 0 " > com . apple . InterfaceBuilder . CocoaPlugin . InterfaceBuilder3 < / string > <nl> + < integer value = " 3000 " key = " NS . object . 0 " / > <nl> + < / object > <nl> + < bool key = " IBDocument . PluginDeclaredDependenciesTrackSystemTargetVersion " > YES < / bool > <nl> + < int key = " IBDocument . defaultPropertyAccessControl " > 3 < / int > <nl> + < object class = " NSMutableDictionary " key = " IBDocument . LastKnownImageSizes " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < object class = " NSArray " key = " dict . sortedKeys " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > NSMenuCheckmark < / string > <nl> + < string > NSMenuMixedState < / string > <nl> + < / object > <nl> + < object class = " NSMutableArray " key = " dict . values " > <nl> + < bool key = " EncodedWithXMLCoder " > YES < / bool > <nl> + < string > { 9 , 8 } < / string > <nl> + < string > { 7 , 2 } < / string > <nl> + < / object > <nl> + < / object > <nl> + < / data > <nl> + < / archive > <nl> new file mode 100644 <nl> index 000000000000 . . 4b6a1e902184 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . mac / main . cpp <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + Copyright ( c ) 2010 cocos2d - x . org <nl> + <nl> + http : / / www . cocos2d - x . org <nl> + <nl> + Permission is hereby granted , free of charge , to any person obtaining a copy <nl> + of this software and associated documentation files ( the " Software " ) , to deal <nl> + in the Software without restriction , including without limitation the rights <nl> + to use , copy , modify , merge , publish , distribute , sublicense , and / or sell <nl> + copies of the Software , and to permit persons to whom the Software is <nl> + furnished to do so , subject to the following conditions : <nl> + <nl> + The above copyright notice and this permission notice shall be included in <nl> + all copies or substantial portions of the Software . <nl> + <nl> + THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND , EXPRESS OR <nl> + IMPLIED , INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY , <nl> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT . IN NO EVENT SHALL THE <nl> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM , DAMAGES OR OTHER <nl> + LIABILITY , WHETHER IN AN ACTION OF CONTRACT , TORT OR OTHERWISE , ARISING FROM , <nl> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN <nl> + THE SOFTWARE . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + # include " AppDelegate . h " <nl> + # include " cocos2d . h " <nl> + <nl> + USING_NS_CC ; <nl> + <nl> + int main ( int argc , char * argv [ ] ) <nl> + { <nl> + AppDelegate app ; <nl> + return Application : : getInstance ( ) - > run ( ) ; <nl> + } <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . d1965344bc1d <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win32 / build - cfg . json <nl> <nl> + { <nl> + " copy_resources " : [ <nl> + { <nl> + " from " : " . . / . . / src " , <nl> + " to " : " src " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / . . / cpp - tests / Resources " , <nl> + " to " : " res " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / main . js " , <nl> + " to " : " " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / project . json " , <nl> + " to " : " " <nl> + } , <nl> + { <nl> + " from " : " . . / . . / . . / . . / cocos / scripting / js - bindings / script " , <nl> + " to " : " script " <nl> + } <nl> + ] <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 3d664e83707b <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win32 / js - tests . rc <nl> <nl> + / / Microsoft Visual C + + generated resource script . <nl> + / / <nl> + # include " resource . h " <nl> + <nl> + # define APSTUDIO_READONLY_SYMBOLS <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / <nl> + / / Generated from the TEXTINCLUDE 2 resource . <nl> + / / <nl> + # define APSTUDIO_HIDDEN_SYMBOLS <nl> + # include " windows . h " <nl> + # undef APSTUDIO_HIDDEN_SYMBOLS <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + # undef APSTUDIO_READONLY_SYMBOLS <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / English ( U . S . ) resources <nl> + <nl> + # if ! defined ( AFX_RESOURCE_DLL ) | | defined ( AFX_TARG_ENU ) <nl> + # ifdef _WIN32 <nl> + LANGUAGE LANG_ENGLISH , SUBLANG_ENGLISH_US <nl> + # pragma code_page ( 1252 ) <nl> + # endif / / _WIN32 <nl> + <nl> + # ifdef APSTUDIO_INVOKED <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / <nl> + / / TEXTINCLUDE <nl> + / / <nl> + <nl> + 1 TEXTINCLUDE <nl> + BEGIN <nl> + " resource . h \ 0 " <nl> + END <nl> + <nl> + # endif / / APSTUDIO_INVOKED <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / <nl> + / / Icon <nl> + / / <nl> + <nl> + / / Icon with lowest ID value placed first to ensure application icon <nl> + / / remains consistent on all systems . <nl> + IDR_MAINFRAME ICON " res \ \ js - tests . ico " <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / <nl> + / / Version <nl> + / / <nl> + <nl> + VS_VERSION_INFO VERSIONINFO <nl> + FILEVERSION 1 , 0 , 0 , 1 <nl> + PRODUCTVERSION 1 , 0 , 0 , 1 <nl> + FILEFLAGSMASK 0x3fL <nl> + # ifdef _DEBUG <nl> + FILEFLAGS 0x1L <nl> + # else <nl> + FILEFLAGS 0x0L <nl> + # endif <nl> + FILEOS 0x4L <nl> + FILETYPE 0x2L <nl> + FILESUBTYPE 0x0L <nl> + BEGIN <nl> + BLOCK " StringFileInfo " <nl> + BEGIN <nl> + BLOCK " 040904B0 " <nl> + BEGIN <nl> + VALUE " CompanyName " , " \ 0 " <nl> + VALUE " FileDescription " , " js - tests Module \ 0 " <nl> + VALUE " FileVersion " , " 1 , 0 , 0 , 1 \ 0 " <nl> + VALUE " InternalName " , " js - tests \ 0 " <nl> + VALUE " LegalCopyright " , " Copyright \ 0 " <nl> + VALUE " OriginalFilename " , " js - tests . exe \ 0 " <nl> + VALUE " ProductName " , " js - tests Module \ 0 " <nl> + VALUE " ProductVersion " , " 1 , 0 , 0 , 1 \ 0 " <nl> + END <nl> + END <nl> + BLOCK " VarFileInfo " <nl> + BEGIN <nl> + VALUE " Translation " , 0x0409 , 0x04B0 <nl> + END <nl> + END <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + # endif / / ! defined ( AFX_RESOURCE_DLL ) | | defined ( AFX_TARG_ENU ) <nl> new file mode 100644 <nl> index 000000000000 . . 7fb7e1ac10a5 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win32 / js - tests . vcxproj <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project DefaultTargets = " Build " ToolsVersion = " 4 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup Label = " ProjectConfigurations " > <nl> + < ProjectConfiguration Include = " Debug | Win32 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | Win32 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < / ItemGroup > <nl> + < PropertyGroup Label = " Globals " > <nl> + < ProjectGuid > { D0F06A44 - A245 - 4D13 - A498 - 0120C203B539 } < / ProjectGuid > <nl> + < RootNamespace > js - tests < / RootNamespace > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . Default . props " / > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 12 . 0 ' " > v120 < / PlatformToolset > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 12 . 0 ' and exists ( ' $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A ' ) " > v120_xp < / PlatformToolset > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 14 . 0 ' " > v140 < / PlatformToolset > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 14 . 0 ' and exists ( ' $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A ' ) " > v140_xp < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < CharacterSet > Unicode < / CharacterSet > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 12 . 0 ' " > v120 < / PlatformToolset > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 12 . 0 ' and exists ( ' $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A ' ) " > v120_xp < / PlatformToolset > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 14 . 0 ' " > v140 < / PlatformToolset > <nl> + < PlatformToolset Condition = " ' $ ( VisualStudioVersion ) ' = = ' 14 . 0 ' and exists ( ' $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A ' ) " > v140_xp < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . props " / > <nl> + < ImportGroup Label = " ExtensionSettings " > <nl> + < / ImportGroup > <nl> + < ImportGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " Label = " PropertySheets " > <nl> + < Import Project = " $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props " Condition = " exists ( ' $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props ' ) " Label = " LocalAppDataPlatform " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ cocos \ 2d \ cocos2dx . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ cocos \ 2d \ cocos2d_headers . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " Label = " PropertySheets " > <nl> + < Import Project = " $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props " Condition = " exists ( ' $ ( UserRootDir ) \ Microsoft . Cpp . $ ( Platform ) . user . props ' ) " Label = " LocalAppDataPlatform " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ cocos \ 2d \ cocos2dx . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ cocos \ 2d \ cocos2d_headers . props " / > <nl> + < / ImportGroup > <nl> + < PropertyGroup Label = " UserMacros " / > <nl> + < PropertyGroup > <nl> + < _ProjectFileVersion > 12 . 0 . 21005 . 1 < / _ProjectFileVersion > <nl> + < OutDir Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > $ ( SolutionDir ) $ ( Configuration ) . win32 \ js - tests \ < / OutDir > <nl> + < IntDir Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > $ ( Configuration ) . win32 \ < / IntDir > <nl> + < LinkIncremental Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > false < / LinkIncremental > <nl> + < OutDir Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > $ ( SolutionDir ) $ ( Configuration ) . win32 \ js - tests \ < / OutDir > <nl> + < IntDir Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > $ ( Configuration ) . win32 \ < / IntDir > <nl> + < LinkIncremental Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > false < / LinkIncremental > <nl> + < CodeAnalysisRuleSet Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > AllRules . ruleset < / CodeAnalysisRuleSet > <nl> + < CodeAnalysisRules Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " / > <nl> + < CodeAnalysisRuleAssemblies Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " / > <nl> + < CodeAnalysisRuleSet Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > AllRules . ruleset < / CodeAnalysisRuleSet > <nl> + < CodeAnalysisRules Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " / > <nl> + < CodeAnalysisRuleAssemblies Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " / > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < LibraryPath > $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A \ lib ; $ ( LibraryPath ) < / LibraryPath > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < LibraryPath > $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A \ lib ; $ ( LibraryPath ) < / LibraryPath > <nl> + < / PropertyGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < Midl > <nl> + < PreprocessorDefinitions > _DEBUG ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < MkTypLibCompatible > false < / MkTypLibCompatible > <nl> + < TargetEnvironment > Win32 < / TargetEnvironment > <nl> + < GenerateStublessProxies > true < / GenerateStublessProxies > <nl> + < TypeLibraryName > $ ( IntDir ) js - tests . tlb < / TypeLibraryName > <nl> + < HeaderFileName > js - tests . h < / HeaderFileName > <nl> + < DllDataFileName > <nl> + < / DllDataFileName > <nl> + < InterfaceIdentifierFileName > js - tests_i . c < / InterfaceIdentifierFileName > <nl> + < ProxyFileName > js - tests_p . c < / ProxyFileName > <nl> + < / Midl > <nl> + < ClCompile > <nl> + < Optimization > Disabled < / Optimization > <nl> + < AdditionalIncludeDirectories > $ ( EngineRoot ) ; $ ( EngineRoot ) cocos ; $ ( EngineRoot ) cocos \ base ; $ ( EngineRoot ) cocos \ storage ; $ ( EngineRoot ) cocos \ editor - support ; $ ( EngineRoot ) cocos \ audio \ include ; $ ( EngineRoot ) external \ chipmunk \ include \ chipmunk ; $ ( EngineRoot ) extensions ; $ ( ProjectDir ) . . \ Classes ; $ ( EngineRoot ) external \ spidermonkey \ include \ win32 ; $ ( EngineRoot ) cocos \ scripting \ js - bindings \ auto ; $ ( EngineRoot ) cocos \ scripting \ js - bindings \ manual ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < PreprocessorDefinitions > WIN32 ; _WINDOWS ; STRICT ; _DEBUG ; XP_WIN ; JS_HAVE___INTN ; JS_INTPTR_TYPE = int ; COCOS2D_DEBUG = 1 ; COCOS2D_JAVASCRIPT = 1 ; CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; _CRT_SECURE_NO_WARNINGS ; _SCL_SECURE_NO_WARNINGS ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < MinimalRebuild > false < / MinimalRebuild > <nl> + < BasicRuntimeChecks > EnableFastChecks < / BasicRuntimeChecks > <nl> + < RuntimeLibrary > MultiThreadedDebugDLL < / RuntimeLibrary > <nl> + < PrecompiledHeader > <nl> + < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < DebugInformationFormat > EditAndContinue < / DebugInformationFormat > <nl> + < DisableSpecificWarnings > 4267 ; 4251 ; 4244 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < MultiProcessorCompilation > true < / MultiProcessorCompilation > <nl> + < / ClCompile > <nl> + < ResourceCompile > <nl> + < PreprocessorDefinitions > _DEBUG ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < Culture > 0x0409 < / Culture > <nl> + < AdditionalIncludeDirectories > $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A \ include ; $ ( IntDir ) ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < / ResourceCompile > <nl> + < PreLinkEvent > <nl> + < Command > if not exist " $ ( OutDir ) " mkdir " $ ( OutDir ) " <nl> + xcopy / Y / Q " $ ( ProjectDir ) . . \ . . \ . . \ . . \ external \ spidermonkey \ prebuilt \ win32 \ * . * " " $ ( OutDir ) " <nl> + xcopy / Y / Q " $ ( ProjectDir ) . . \ . . \ . . \ . . \ external \ websockets \ prebuilt \ win32 \ * . * " " $ ( OutDir ) " < / Command > <nl> + < / PreLinkEvent > <nl> + < Link > <nl> + < AdditionalDependencies > libcurl_imp . lib ; mozjs - 33 . lib ; ws2_32 . lib ; sqlite3 . lib ; websockets . lib ; % ( AdditionalDependencies ) < / AdditionalDependencies > <nl> + < AdditionalLibraryDirectories > $ ( OutDir ) ; $ ( SolutionDir ) $ ( Configuration ) . win32 ; % ( AdditionalLibraryDirectories ) < / AdditionalLibraryDirectories > <nl> + < GenerateDebugInformation > true < / GenerateDebugInformation > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < TargetMachine > MachineX86 < / TargetMachine > <nl> + < / Link > <nl> + < PreBuildEvent > <nl> + < Command > if not exist " $ ( OutDir ) " mkdir " $ ( OutDir ) " <nl> + <nl> + mkdir " $ ( OutDir ) \ script " <nl> + mkdir " $ ( OutDir ) \ src " <nl> + mkdir " $ ( OutDir ) \ res " <nl> + xcopy " $ ( OutDir ) . . \ * . dll " " $ ( OutDir ) " / D / Y <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ . . \ . . \ cocos \ scripting \ js - bindings \ script \ * " " $ ( OutDir ) \ script " / e / Y <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ src " " $ ( OutDir ) \ src \ " / e / Y <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ . . \ cpp - tests \ Resources " " $ ( OutDir ) \ res \ " / e / Y <nl> + copy " $ ( ProjectDir ) . . \ . . \ main . js " " $ ( OutDir ) " <nl> + copy " $ ( ProjectDir ) . . \ . . \ project . json " " $ ( OutDir ) " <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ resjs " " $ ( OutDir ) \ res \ resjs \ " / e / Y < / Command > <nl> + < / PreBuildEvent > <nl> + < PreBuildEvent > <nl> + < Message > Copy js and resource files . < / Message > <nl> + < / PreBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < Midl > <nl> + < PreprocessorDefinitions > NDEBUG ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < MkTypLibCompatible > false < / MkTypLibCompatible > <nl> + < TargetEnvironment > Win32 < / TargetEnvironment > <nl> + < GenerateStublessProxies > true < / GenerateStublessProxies > <nl> + < TypeLibraryName > $ ( IntDir ) js - tests . tlb < / TypeLibraryName > <nl> + < HeaderFileName > js - tests . h < / HeaderFileName > <nl> + < DllDataFileName > <nl> + < / DllDataFileName > <nl> + < InterfaceIdentifierFileName > js - tests_i . c < / InterfaceIdentifierFileName > <nl> + < ProxyFileName > js - tests_p . c < / ProxyFileName > <nl> + < / Midl > <nl> + < ClCompile > <nl> + < AdditionalIncludeDirectories > $ ( EngineRoot ) ; $ ( EngineRoot ) cocos ; $ ( EngineRoot ) cocos \ base ; $ ( EngineRoot ) cocos \ storage ; $ ( EngineRoot ) cocos \ editor - support ; $ ( EngineRoot ) cocos \ audio \ include ; $ ( EngineRoot ) external \ chipmunk \ include \ chipmunk ; $ ( EngineRoot ) extensions ; $ ( ProjectDir ) . . \ Classes ; $ ( EngineRoot ) external \ spidermonkey \ include \ win32 ; $ ( EngineRoot ) cocos \ scripting \ js - bindings \ auto ; $ ( EngineRoot ) cocos \ scripting \ js - bindings \ manual ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < PreprocessorDefinitions > WIN32 ; _WINDOWS ; STRICT ; NDEBUG ; XP_WIN ; JS_HAVE___INTN ; JS_INTPTR_TYPE = int ; COCOS2D_JAVASCRIPT = 1 ; CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; _CRT_SECURE_NO_WARNINGS ; _SCL_SECURE_NO_WARNINGS ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < ExceptionHandling > <nl> + < / ExceptionHandling > <nl> + < RuntimeLibrary > MultiThreadedDLL < / RuntimeLibrary > <nl> + < PrecompiledHeader > <nl> + < / PrecompiledHeader > <nl> + < WarningLevel > Level3 < / WarningLevel > <nl> + < DebugInformationFormat > <nl> + < / DebugInformationFormat > <nl> + < DisableSpecificWarnings > 4267 ; 4251 ; 4244 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < MultiProcessorCompilation > true < / MultiProcessorCompilation > <nl> + < / ClCompile > <nl> + < ResourceCompile > <nl> + < PreprocessorDefinitions > NDEBUG ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < Culture > 0x0409 < / Culture > <nl> + < AdditionalIncludeDirectories > $ ( MSBuildProgramFiles32 ) \ Microsoft SDKs \ Windows \ v7 . 1A \ include ; $ ( IntDir ) ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < / ResourceCompile > <nl> + < PreLinkEvent > <nl> + < Command > if not exist " $ ( OutDir ) " mkdir " $ ( OutDir ) " <nl> + xcopy / Y / Q " $ ( ProjectDir ) . . \ . . \ . . \ . . \ external \ spidermonkey \ prebuilt \ win32 \ * . * " " $ ( OutDir ) " <nl> + xcopy / Y / Q " $ ( ProjectDir ) . . \ . . \ . . \ . . \ external \ websockets \ prebuilt \ win32 \ * . * " " $ ( OutDir ) " < / Command > <nl> + < / PreLinkEvent > <nl> + < Link > <nl> + < AdditionalDependencies > libcurl_imp . lib ; mozjs - 33 . lib ; ws2_32 . lib ; sqlite3 . lib ; websockets . lib ; % ( AdditionalDependencies ) < / AdditionalDependencies > <nl> + < AdditionalLibraryDirectories > $ ( OutDir ) ; $ ( SolutionDir ) $ ( Configuration ) . win32 ; % ( AdditionalLibraryDirectories ) < / AdditionalLibraryDirectories > <nl> + < SubSystem > Windows < / SubSystem > <nl> + < TargetMachine > MachineX86 < / TargetMachine > <nl> + < GenerateDebugInformation > true < / GenerateDebugInformation > <nl> + < / Link > <nl> + < PreBuildEvent > <nl> + < Command > if not exist " $ ( OutDir ) " mkdir " $ ( OutDir ) " <nl> + <nl> + mkdir " $ ( OutDir ) \ script " <nl> + mkdir " $ ( OutDir ) \ src " <nl> + mkdir " $ ( OutDir ) \ res " <nl> + xcopy " $ ( OutDir ) . . \ * . dll " " $ ( OutDir ) " / D / Y <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ . . \ . . \ cocos \ scripting \ js - bindings \ script \ * " " $ ( OutDir ) \ script " / e / Y <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ src " " $ ( OutDir ) \ src \ " / e / Y <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ . . \ cpp - tests \ Resources " " $ ( OutDir ) \ res \ " / e / Y <nl> + copy " $ ( ProjectDir ) . . \ . . \ main . js " " $ ( OutDir ) " <nl> + copy " $ ( ProjectDir ) . . \ . . \ project . json " " $ ( OutDir ) " <nl> + xcopy " $ ( ProjectDir ) . . \ . . \ resjs " " $ ( OutDir ) \ res \ " / e / Y < / Command > <nl> + < Message > Copy js and resource files . < / Message > <nl> + < / PreBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemGroup > <nl> + < ClCompile Include = " . . \ Classes \ js_DrawNode3D_bindings . cpp " / > <nl> + < ClCompile Include = " . . \ Classes \ js_Effect3D_bindings . cpp " / > <nl> + < ClCompile Include = " main . cpp " / > <nl> + < ClCompile Include = " . . \ Classes \ AppDelegate . cpp " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " . . \ Classes \ js_DrawNode3D_bindings . h " / > <nl> + < ClInclude Include = " . . \ Classes \ js_Effect3D_bindings . h " / > <nl> + < ClInclude Include = " main . h " / > <nl> + < ClInclude Include = " resource . h " / > <nl> + < ClInclude Include = " . . \ Classes \ AppDelegate . h " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < None Include = " res \ js - tests . ico " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ResourceCompile Include = " js - tests . rc " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ cocos \ scripting \ js - bindings \ proj . win32 \ libjscocos2d . vcxproj " > <nl> + < Project > { 39379840 - 825a - 45a0 - b363 - c09ffef864bd } < / Project > <nl> + < / ProjectReference > <nl> + < / ItemGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> + < ImportGroup Label = " ExtensionTargets " > <nl> + < / ImportGroup > <nl> + < / Project > <nl> new file mode 100644 <nl> index 000000000000 . . b66e775a2ec8 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win32 / js - tests . 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 = " . . \ Classes \ AppDelegate . cpp " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " main . cpp " > <nl> + < Filter > win32 < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " . . \ Classes \ js_DrawNode3D_bindings . cpp " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " . . \ Classes \ js_Effect3D_bindings . cpp " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClCompile > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " . . \ Classes \ AppDelegate . h " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " main . h " > <nl> + < Filter > win32 < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " resource . h " > <nl> + < Filter > win32 < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " . . \ Classes \ js_DrawNode3D_bindings . h " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " . . \ Classes \ js_Effect3D_bindings . h " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClInclude > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < Filter Include = " Classes " > <nl> + < UniqueIdentifier > { 73cd069e - e032 - 4051 - 8d30 - 65b08ab4f954 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " resource " > <nl> + < UniqueIdentifier > { abaf0468 - 14d3 - 43ce - 8d1a - 8a4a34dba59b } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < Filter Include = " win32 " > <nl> + < UniqueIdentifier > { bbe7342c - 1f30 - 4512 - b00a - 841aa2d4ca9f } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < None Include = " res \ js - tests . ico " > <nl> + < Filter > resource < / Filter > <nl> + < / None > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ResourceCompile Include = " js - tests . rc " > <nl> + < Filter > resource < / Filter > <nl> + < / ResourceCompile > <nl> + < / ItemGroup > <nl> + < / Project > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . f5ce0656edc7 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win32 / main . cpp <nl> <nl> + # include " main . h " <nl> + # include " AppDelegate . h " <nl> + <nl> + USING_NS_CC ; <nl> + <nl> + / / uncomment below line , open debug console <nl> + / / # define USE_WIN32_CONSOLE <nl> + <nl> + int APIENTRY _tWinMain ( HINSTANCE hInstance , <nl> + HINSTANCE hPrevInstance , <nl> + LPTSTR lpCmdLine , <nl> + int nCmdShow ) <nl> + { <nl> + UNREFERENCED_PARAMETER ( hPrevInstance ) ; <nl> + UNREFERENCED_PARAMETER ( lpCmdLine ) ; <nl> + <nl> + # ifdef USE_WIN32_CONSOLE <nl> + AllocConsole ( ) ; <nl> + freopen ( " CONIN $ " , " r " , stdin ) ; <nl> + freopen ( " CONOUT $ " , " w " , stdout ) ; <nl> + freopen ( " CONOUT $ " , " w " , stderr ) ; <nl> + # endif <nl> + <nl> + / / create the application instance <nl> + AppDelegate app ; <nl> + <nl> + int ret = Application : : getInstance ( ) - > run ( ) ; <nl> + <nl> + # ifdef USE_WIN32_CONSOLE <nl> + FreeConsole ( ) ; <nl> + # endif <nl> + <nl> + return ret ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . e29aeedb3a0b <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win32 / main . h <nl> <nl> + # ifndef __MAIN_H__ <nl> + # define __MAIN_H__ <nl> + <nl> + # define WIN32_LEAN_AND_MEAN / / Exclude rarely - used stuff from Windows headers <nl> + <nl> + / / Windows Header Files : <nl> + # include < tchar . h > <nl> + <nl> + / / C RunTime Header Files <nl> + # include " CCStdC . h " <nl> + <nl> + # endif / / __WINMAIN_H__ <nl> new file mode 100644 <nl> index 000000000000 . . feaf932a7465 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . win32 / res / js - tests . ico differ <nl> new file mode 100644 <nl> index 000000000000 . . 3436133bc74c <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win32 / resource . h <nl> <nl> + / / { { NO_DEPENDENCIES } } <nl> + / / Microsoft Visual C + + generated include file . <nl> + / / Used by js - tests . RC <nl> + / / <nl> + <nl> + # define IDS_PROJNAME 100 <nl> + # define IDR_TESTJS 100 <nl> + <nl> + # define ID_FILE_NEW_WINDOW 32771 <nl> + <nl> + / / Next default values for new objects <nl> + / / <nl> + # ifdef APSTUDIO_INVOKED <nl> + # ifndef APSTUDIO_READONLY_SYMBOLS <nl> + # define _APS_NEXT_RESOURCE_VALUE 201 <nl> + # define _APS_NEXT_CONTROL_VALUE 1000 <nl> + # define _APS_NEXT_SYMED_VALUE 101 <nl> + # define _APS_NEXT_COMMAND_VALUE 32775 <nl> + # endif <nl> + # endif <nl> new file mode 100644 <nl> index 000000000000 . . c0ea91604be2 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Shared / App . xaml <nl> <nl> +  < Application <nl> + x : Class = " CocosAppWinRT . App " <nl> + xmlns = " http : / / schemas . microsoft . com / winfx / 2006 / xaml / presentation " <nl> + xmlns : x = " http : / / schemas . microsoft . com / winfx / 2006 / xaml " <nl> + xmlns : local = " using : CocosAppWinRT " <nl> + xmlns : localData = " using : Shared " > <nl> + <nl> + < Application . Resources > <nl> + <nl> + < x : String x : Key = " AppName " > cpp_tests < / x : String > <nl> + <nl> + < / Application . Resources > <nl> + < / Application > <nl> new file mode 100644 <nl> index 000000000000 . . 988ffe74de7d <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Shared / App . xaml . cpp <nl> <nl> +  # include " App . xaml . h " <nl> + # include " OpenGLESPage . xaml . h " <nl> + <nl> + using namespace Platform ; <nl> + using namespace Windows : : ApplicationModel ; <nl> + using namespace Windows : : ApplicationModel : : Activation ; <nl> + using namespace Windows : : Foundation ; <nl> + using namespace Windows : : Foundation : : Collections ; <nl> + using namespace Windows : : UI : : Xaml : : Media : : Animation ; <nl> + using namespace Windows : : UI : : Xaml ; <nl> + using namespace Windows : : UI : : Xaml : : Controls ; <nl> + using namespace Windows : : UI : : Xaml : : Controls : : Primitives ; <nl> + using namespace Windows : : UI : : Xaml : : Data ; <nl> + using namespace Windows : : UI : : Xaml : : Input ; <nl> + using namespace Windows : : UI : : Xaml : : Interop ; <nl> + using namespace Windows : : UI : : Xaml : : Media ; <nl> + using namespace Windows : : UI : : Xaml : : Navigation ; <nl> + using namespace cocos2d ; <nl> + using namespace CocosAppWinRT ; <nl> + <nl> + App : : App ( ) <nl> + { <nl> + InitializeComponent ( ) ; <nl> + Suspending + = ref new SuspendingEventHandler ( this , & App : : OnSuspending ) ; <nl> + Resuming + = ref new EventHandler < Object ^ > ( this , & App : : OnResuming ) ; <nl> + } <nl> + <nl> + / / / < summary > <nl> + / / / Invoked when the application is launched normally by the end user . Other entry points <nl> + / / / will be used when the application is launched to open a specific file , to display <nl> + / / / search results , and so forth . <nl> + / / / < / summary > <nl> + / / / < param name = " e " > Details about the launch request and process . < / param > <nl> + void App : : OnLaunched ( LaunchActivatedEventArgs ^ e ) <nl> + { <nl> + auto rootFrame = dynamic_cast < Frame ^ > ( Window : : Current - > Content ) ; <nl> + <nl> + / / Do not repeat app initialization when the Window already has content , <nl> + / / just ensure that the window is active . <nl> + if ( rootFrame = = nullptr ) <nl> + { <nl> + / / Create a Frame to act as the navigation context and associate it with <nl> + / / a SuspensionManager key <nl> + rootFrame = ref new Frame ( ) ; <nl> + <nl> + / / TODO : Change this value to a cache size that is appropriate for your application . <nl> + rootFrame - > CacheSize = 1 ; <nl> + <nl> + if ( e - > PreviousExecutionState = = ApplicationExecutionState : : Terminated ) <nl> + { <nl> + / / TODO : Restore the saved session state only when appropriate , scheduling the <nl> + / / final launch steps after the restore is complete . <nl> + } <nl> + <nl> + / / Place the frame in the current Window <nl> + Window : : Current - > Content = rootFrame ; <nl> + } <nl> + <nl> + if ( rootFrame - > Content = = nullptr ) <nl> + { <nl> + # if WINAPI_FAMILY = = WINAPI_FAMILY_PHONE_APP <nl> + / / Removes the turnstile navigation for startup . <nl> + if ( rootFrame - > ContentTransitions ! = nullptr ) <nl> + { <nl> + _transitions = ref new TransitionCollection ( ) ; <nl> + for ( auto transition : rootFrame - > ContentTransitions ) <nl> + { <nl> + _transitions - > Append ( transition ) ; <nl> + } <nl> + } <nl> + <nl> + rootFrame - > ContentTransitions = nullptr ; <nl> + _firstNavigatedToken = rootFrame - > Navigated + = ref new NavigatedEventHandler ( this , & App : : RootFrame_FirstNavigated ) ; <nl> + # endif <nl> + <nl> + / / When the navigation stack isn ' t restored navigate to the first page , <nl> + / / configuring the new page by passing required information as a navigation <nl> + / / parameter . <nl> + <nl> + rootFrame - > Content = mPage = ref new OpenGLESPage ( & mOpenGLES ) ; <nl> + <nl> + # if 0 <nl> + if ( ! rootFrame - > Navigate ( OpenGLESPage : : typeid , e - > Arguments ) ) <nl> + { <nl> + throw ref new FailureException ( " Failed to create initial page " ) ; <nl> + } <nl> + # endif <nl> + } <nl> + <nl> + / / Ensure the current window is active <nl> + Window : : Current - > Activate ( ) ; <nl> + } <nl> + <nl> + # if WINAPI_FAMILY = = WINAPI_FAMILY_PHONE_APP <nl> + / / / < summary > <nl> + / / / Restores the content transitions after the app has launched . <nl> + / / / < / summary > <nl> + void App : : RootFrame_FirstNavigated ( Object ^ sender , NavigationEventArgs ^ e ) <nl> + { <nl> + auto rootFrame = safe_cast < Frame ^ > ( sender ) ; <nl> + <nl> + TransitionCollection ^ newTransitions ; <nl> + if ( _transitions = = nullptr ) <nl> + { <nl> + newTransitions = ref new TransitionCollection ( ) ; <nl> + newTransitions - > Append ( ref new NavigationThemeTransition ( ) ) ; <nl> + } <nl> + else <nl> + { <nl> + newTransitions = _transitions ; <nl> + } <nl> + <nl> + rootFrame - > ContentTransitions = newTransitions ; <nl> + <nl> + rootFrame - > Navigated - = _firstNavigatedToken ; <nl> + } <nl> + # endif <nl> + <nl> + / / / < summary > <nl> + / / / Invoked when application execution is being suspended . Application state is saved <nl> + / / / without knowing whether the application will be terminated or resumed with the contents <nl> + / / / of memory still intact . <nl> + / / / < / summary > <nl> + void App : : OnSuspending ( Object ^ sender , SuspendingEventArgs ^ e ) <nl> + { <nl> + ( void ) sender ; / / Unused parameter <nl> + ( void ) e ; / / Unused parameter <nl> + <nl> + mPage - > SetVisibility ( false ) ; <nl> + } <nl> + <nl> + / / / < summary > <nl> + / / / Invoked when application execution is being resumed . <nl> + / / / < / summary > <nl> + / / / < param name = " sender " > The source of the resume request . < / param > <nl> + / / / < param name = " args " > Details about the resume request . < / param > <nl> + void App : : OnResuming ( Object ^ sender , Object ^ args ) <nl> + { <nl> + ( void ) sender ; / / Unused parameter <nl> + ( void ) args ; / / Unused parameter <nl> + <nl> + mPage - > SetVisibility ( true ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . c177eab651e9 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Shared / App . xaml . h <nl> <nl> +  # pragma once <nl> + <nl> + # include " app . g . h " <nl> + # include " OpenGLES . h " <nl> + # include " openglespage . xaml . h " <nl> + <nl> + namespace CocosAppWinRT <nl> + { <nl> + ref class App sealed <nl> + { <nl> + public : <nl> + App ( ) ; <nl> + virtual void OnLaunched ( Windows : : ApplicationModel : : Activation : : LaunchActivatedEventArgs ^ e ) override ; <nl> + <nl> + private : <nl> + <nl> + # if WINAPI_FAMILY = = WINAPI_FAMILY_PHONE_APP <nl> + Windows : : UI : : Xaml : : Media : : Animation : : TransitionCollection ^ _transitions ; <nl> + Windows : : Foundation : : EventRegistrationToken _firstNavigatedToken ; <nl> + <nl> + void RootFrame_FirstNavigated ( Platform : : Object ^ sender , Windows : : UI : : Xaml : : Navigation : : NavigationEventArgs ^ e ) ; <nl> + # endif <nl> + <nl> + void OnSuspending ( Platform : : Object ^ sender , Windows : : ApplicationModel : : SuspendingEventArgs ^ e ) ; <nl> + void OnResuming ( Platform : : Object ^ sender , Platform : : Object ^ args ) ; <nl> + <nl> + OpenGLESPage ^ mPage ; <nl> + OpenGLES mOpenGLES ; <nl> + } ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . 4a353710a9aa <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Shared / js - tests . Shared . vcxitems <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < PropertyGroup Label = " Globals " > <nl> + < MSBuildAllProjects > $ ( MSBuildAllProjects ) ; $ ( MSBuildThisFileFullPath ) < / MSBuildAllProjects > <nl> + < HasSharedItems > true < / HasSharedItems > <nl> + < SharedGUID > e956c24b - f04e - 47bf - bf00 - 746681ae1301 < / SharedGUID > <nl> + < ItemsProjectGuid > { AE6763F6 - 1549 - 441E - AFB5 - 377BE1C776DC } < / ItemsProjectGuid > <nl> + < ItemsRootNamespace > js - tests < / ItemsRootNamespace > <nl> + < / PropertyGroup > <nl> + < ItemDefinitionGroup > <nl> + < ClCompile > <nl> + < AdditionalIncludeDirectories > % ( AdditionalIncludeDirectories ) ; $ ( MSBuildThisFileDirectory ) < / AdditionalIncludeDirectories > <nl> + < / ClCompile > <nl> + < / ItemDefinitionGroup > <nl> + < ItemGroup > <nl> + < ApplicationDefinition Include = " $ ( MSBuildThisFileDirectory ) App . xaml " > <nl> + < SubType > Designer < / SubType > <nl> + < / ApplicationDefinition > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " > <nl> + < DependentUpon > $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml < / DependentUpon > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ AppDelegate . cpp " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_DrawNode3D_bindings . cpp " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_Effect3D_bindings . cpp " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) App . xaml . cpp " > <nl> + < DependentUpon > $ ( MSBuildThisFileDirectory ) App . xaml < / DependentUpon > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " > <nl> + < DependentUpon > $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml < / DependentUpon > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ AppDelegate . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_DrawNode3D_bindings . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_Effect3D_bindings . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) App . xaml . h " > <nl> + < DependentUpon > $ ( MSBuildThisFileDirectory ) App . xaml < / DependentUpon > <nl> + < / ClInclude > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) pch . cpp " > <nl> + < PrecompiledHeader > Create < / PrecompiledHeader > <nl> + < / ClCompile > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) pch . h " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ProjectCapability Include = " SourceItemsFromImports " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < _CustomResource Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Resources \ * * \ * " > <nl> + < Link > Assets \ Resources \ % ( RecursiveDir ) % ( FileName ) % ( Extension ) < / Link > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < / _CustomResource > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < Page Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " / > <nl> + < / ItemGroup > <nl> + < Target Name = " _CollectCustomResources " BeforeTargets = " AssignTargetPaths " > <nl> + < Message Text = " Adding resource : % ( _CustomResource . Identity ) - & gt ; % ( _CustomResource . Link ) " / > <nl> + < ItemGroup > <nl> + < None Include = " @ ( _CustomResource ) " / > <nl> + < / ItemGroup > <nl> + < / Target > <nl> + < / Project > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . 841a3ae6eea5 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Shared / js - tests . Shared . vcxitems . filters <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project ToolsVersion = " 12 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup > <nl> + < CLCompile Include = " $ ( MSBuildThisFileDirectory ) App . xaml . cpp " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) App . xaml . h " / > <nl> + < CLCompile Include = " $ ( MSBuildThisFileDirectory ) pch . cpp " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) pch . h " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ AppDelegate . cpp " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_DrawNode3D_bindings . cpp " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_Effect3D_bindings . cpp " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClCompile > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " / > <nl> + < ClCompile Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ApplicationDefinition Include = " $ ( MSBuildThisFileDirectory ) App . xaml " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < Filter Include = " Classes " > <nl> + < UniqueIdentifier > { 38ad799c - 8c3c - 44a2 - 8e41 - 516c8f62f556 } < / UniqueIdentifier > <nl> + < / Filter > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ AppDelegate . h " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_DrawNode3D_bindings . h " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ Classes \ js_Effect3D_bindings . h " > <nl> + < Filter > Classes < / Filter > <nl> + < / ClInclude > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " / > <nl> + < ClInclude Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < Page Include = " $ ( MSBuildThisFileDirectory ) . . \ . . \ . . \ . . \ . . \ cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " / > <nl> + < / ItemGroup > <nl> + < / Project > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . bcb5590be1b3 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Shared / pch . cpp <nl> @ @ - 0 , 0 + 1 @ @ <nl> +  # include " pch . h " <nl> new file mode 100644 <nl> index 000000000000 . . 087ce3bf183d <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Shared / pch . h <nl> <nl> +  / / <nl> + / / pch . h <nl> + / / Header for standard system include files . <nl> + / / <nl> + <nl> + # pragma once <nl> + <nl> + # include " mozilla \ Char16 . h " <nl> + # include " cocos2d . h " <nl> + # include " cocos - ext . h " <nl> + <nl> + <nl> new file mode 100644 <nl> index 000000000000 . . e0dd7cb7a334 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Windows / Package . appxmanifest <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Package xmlns = " http : / / schemas . microsoft . com / appx / 2010 / manifest " xmlns : m2 = " http : / / schemas . microsoft . com / appx / 2013 / manifest " > <nl> + < Identity Name = " a39cf818 - af13 - 4d5f - 9d18 - 3dbac1159b33 " Publisher = " CN = stamm " Version = " 1 . 0 . 0 . 6 " / > <nl> + < Properties > <nl> + < DisplayName > js - tests . Windows < / DisplayName > <nl> + < PublisherDisplayName > msopentech < / PublisherDisplayName > <nl> + < Logo > Assets \ StoreLogo . png < / Logo > <nl> + < / Properties > <nl> + < Prerequisites > <nl> + < OSMinVersion > 6 . 3 . 0 < / OSMinVersion > <nl> + < OSMaxVersionTested > 6 . 3 . 0 < / OSMaxVersionTested > <nl> + < / Prerequisites > <nl> + < Resources > <nl> + < Resource Language = " x - generate " / > <nl> + < / Resources > <nl> + < Applications > <nl> + < Application Id = " App " Executable = " $ targetnametoken $ . exe " EntryPoint = " cocos2d_Windows . App " > <nl> + < m2 : VisualElements DisplayName = " js - tests . Windows " Square150x150Logo = " Assets \ Logo . png " Square30x30Logo = " Assets \ SmallLogo . png " Description = " js - tests . Windows " ForegroundText = " light " BackgroundColor = " # 464646 " > <nl> + < m2 : SplashScreen Image = " Assets \ SplashScreen . png " / > <nl> + < m2 : InitialRotationPreference > <nl> + < m2 : Rotation Preference = " landscape " / > <nl> + < m2 : Rotation Preference = " landscapeFlipped " / > <nl> + < / m2 : InitialRotationPreference > <nl> + < / m2 : VisualElements > <nl> + < / Application > <nl> + < / Applications > <nl> + < Capabilities > <nl> + < Capability Name = " internetClient " / > <nl> + < / Capabilities > <nl> + < / Package > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . 2cbd6c135d54 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Windows / js - tests . Windows . 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> + < ItemGroup Label = " ProjectConfigurations " > <nl> + < ProjectConfiguration Include = " Debug | ARM " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > ARM < / Platform > <nl> + < / ProjectConfiguration > <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 | ARM " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > ARM < / 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 > { 70914FC8 - 7709 - 4CD6 - B86B - C63FDE5478DB } < / ProjectGuid > <nl> + < RootNamespace > CocosAppWinRT < / RootNamespace > <nl> + < DefaultLanguage > en - US < / DefaultLanguage > <nl> + < MinimumVisualStudioVersion > 12 . 0 < / MinimumVisualStudioVersion > <nl> + < AppContainerApplication > true < / AppContainerApplication > <nl> + < ApplicationType > Windows Store < / ApplicationType > <nl> + < ApplicationTypeRevision > 8 . 1 < / ApplicationTypeRevision > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . Default . props " / > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | ARM ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | x64 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > false < / WholeProgramOptimization > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | ARM ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > false < / WholeProgramOptimization > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | x64 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > false < / WholeProgramOptimization > <nl> + < PlatformToolset > v120 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . props " / > <nl> + < Import Project = " . . \ App . Shared \ js - tests . Shared . vcxitems " Label = " Shared " / > <nl> + < ImportGroup Label = " ExtensionSettings " > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | ARM ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | x64 ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | ARM ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | x64 ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < PropertyGroup Label = " UserMacros " / > <nl> + < PropertyGroup > <nl> + < PackageCertificateKeyFile > js - tests . Windows_TemporaryKey . pfx < / PackageCertificateKeyFile > <nl> + < AppxAutoIncrementPackageRevision > True < / AppxAutoIncrementPackageRevision > <nl> + < AppxBundlePlatforms > x86 < / AppxBundlePlatforms > <nl> + < PackageCertificateThumbprint > 2D1A6993BB7DD73FD4EDC183F0FA7F9A1B7AD3C3 < / PackageCertificateThumbprint > <nl> + < / PropertyGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | ARM ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; COCOS2D_DEBUG = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < PreBuildEvent > <nl> + < Command > <nl> + < / Command > <nl> + < / PreBuildEvent > <nl> + < Link > <nl> + < IgnoreSpecificDefaultLibraries > MSVCRT ; % ( IgnoreSpecificDefaultLibraries ) < / IgnoreSpecificDefaultLibraries > <nl> + < / Link > <nl> + < PostBuildEvent > <nl> + < Command > echo " Copying Windows 8 . 1 Universal App JavaScript template files " <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ pch . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ cocos2d - js \ pch . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq < / Command > <nl> + < / PostBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | ARM ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < PreBuildEvent > <nl> + < Command > <nl> + < / Command > <nl> + < / PreBuildEvent > <nl> + < PostBuildEvent > <nl> + < Command > echo " Copying Windows 8 . 1 Universal App JavaScript template files " <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ pch . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ cocos2d - js \ pch . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq < / Command > <nl> + < / PostBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; COCOS2D_DEBUG = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < PreBuildEvent > <nl> + < Command > <nl> + < / Command > <nl> + < / PreBuildEvent > <nl> + < Link > <nl> + < IgnoreSpecificDefaultLibraries > MSVCRT ; % ( IgnoreSpecificDefaultLibraries ) < / IgnoreSpecificDefaultLibraries > <nl> + < / Link > <nl> + < PostBuildEvent > <nl> + < Command > echo " Copying Windows 8 . 1 Universal App JavaScript template files " <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ pch . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ cocos2d - js \ pch . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq < / Command > <nl> + < / PostBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < PreBuildEvent > <nl> + < Command > <nl> + < / Command > <nl> + < / PreBuildEvent > <nl> + < PostBuildEvent > <nl> + < Command > echo " Copying Windows 8 . 1 Universal App JavaScript template files " <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ pch . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ cocos2d - js \ pch . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq < / Command > <nl> + < / PostBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | x64 ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; COCOS2D_DEBUG = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < PreBuildEvent > <nl> + < / PreBuildEvent > <nl> + < Link > <nl> + < IgnoreSpecificDefaultLibraries > MSVCRT ; % ( IgnoreSpecificDefaultLibraries ) < / IgnoreSpecificDefaultLibraries > <nl> + < / Link > <nl> + < PostBuildEvent > <nl> + < Command > echo " Copying Windows 8 . 1 Universal App JavaScript template files " <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ pch . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ cocos2d - js \ pch . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq < / Command > <nl> + < / PostBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | x64 ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < PreBuildEvent > <nl> + < Command > echo " Copying Windows 8 . 1 Universal App CPP template files " <nl> + xcopy " $ ( EngineRoot ) external \ win8 . 1 - universal \ OpenGLESPage . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / eiycq <nl> + xcopy " $ ( EngineRoot ) external \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / eiycq <nl> + xcopy " $ ( EngineRoot ) external \ win8 . 1 - universal \ OpenGLESPage . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / eiycq <nl> + < / Command > <nl> + < / PreBuildEvent > <nl> + < PostBuildEvent > <nl> + < Command > echo " Copying Windows 8 . 1 Universal App JavaScript template files " <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) tests \ js - tests \ project \ proj . win8 . 1 - universal \ App . Shared \ App . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLESPage . xaml . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ OpenGLES . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ Cocos2dRenderer . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ pch . cpp " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq <nl> + xcopy " $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal \ cocos2d - js \ pch . h " " $ ( EngineRoot ) templates \ js - template - default \ frameworks \ runtime - src \ proj . win8 . 1 - universal \ App . Shared \ * " / iycq < / Command > <nl> + < / PostBuildEvent > <nl> + < / ItemDefinitionGroup > <nl> + < ItemGroup > <nl> + < AppxManifest Include = " Package . appxmanifest " > <nl> + < SubType > Designer < / SubType > <nl> + < / AppxManifest > <nl> + < None Include = " js - tests . Windows_TemporaryKey . pfx " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < Image Include = " Assets \ Logo . scale - 100 . png " / > <nl> + < Image Include = " Assets \ SmallLogo . scale - 100 . png " / > <nl> + < Image Include = " Assets \ StoreLogo . scale - 100 . png " / > <nl> + < Image Include = " Assets \ SplashScreen . scale - 100 . png " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ cocos \ scripting \ js - bindings \ proj . win8 . 1 - universal \ libjscocos2d \ libjscocos2d . Windows \ libjscocos2d . Windows . vcxproj " > <nl> + < Project > { bcf5546d - 66a0 - 4998 - afd6 - c5514f618930 } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ libcocos2d_8_1 \ libcocos2d_8_1 \ libcocos2d_8_1 . Windows \ libcocos2d_8_1 . Windows . vcxproj " > <nl> + < Project > { 9335005f - 678e - 4e8e - 9b84 - 50037216aec8 } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ cocos \ editor - support \ spine \ proj . win8 . 1 - universal \ libSpine . Windows \ libSpine . Windows . vcxproj " > <nl> + < Project > { f3550fe0 - c795 - 44f6 - 8feb - 093eb68143ae } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ external \ Box2D \ proj . win8 . 1 - universal \ libbox2d . Windows \ libbox2d . Windows . vcxproj " > <nl> + < Project > { 3b26a12d - 3a44 - 47ea - 82d2 - 282660fc844d } < / Project > <nl> + < / ProjectReference > <nl> + < / ItemGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> + < ImportGroup Label = " ExtensionTargets " > <nl> + < / ImportGroup > <nl> + < / Project > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . 0391f8dd5a08 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Windows / js - tests . Windows . vcxproj . filters <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project ToolsVersion = " 12 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup > <nl> + < Filter Include = " Assets " > <nl> + < UniqueIdentifier > { 1a9fa652 - 867e - 41d2 - 8588 - 962f108d2d8f } < / UniqueIdentifier > <nl> + < Extensions > bmp ; fbx ; gif ; jpg ; jpeg ; tga ; tiff ; tif ; png < / Extensions > <nl> + < / Filter > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < AppxManifest Include = " Package . appxmanifest " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < None Include = " js - tests . Windows_TemporaryKey . pfx " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < Image Include = " Assets \ Logo . scale - 100 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ SmallLogo . scale - 100 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ StoreLogo . scale - 100 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ SplashScreen . scale - 100 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < / ItemGroup > <nl> + < / Project > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . 4d25179d4230 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . Windows / js - tests . Windows_TemporaryKey . pfx differ <nl> new file mode 100644 <nl> index 000000000000 . . 0568af1b21a6 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . WindowsPhone / Package . appxmanifest <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Package xmlns = " http : / / schemas . microsoft . com / appx / 2010 / manifest " xmlns : m2 = " http : / / schemas . microsoft . com / appx / 2013 / manifest " xmlns : m3 = " http : / / schemas . microsoft . com / appx / 2014 / manifest " xmlns : mp = " http : / / schemas . microsoft . com / appx / 2014 / phone / manifest " > <nl> + < Identity Name = " 839e6be3 - 2571 - 47d8 - 910b - 1d7386788d3b " Publisher = " CN = dalestam " Version = " 1 . 0 . 0 . 5 " / > <nl> + < mp : PhoneIdentity PhoneProductId = " 839e6be3 - 2571 - 47d8 - 910b - 1d7386788d3b " PhonePublisherId = " 00000000 - 0000 - 0000 - 0000 - 000000000000 " / > <nl> + < Properties > <nl> + < DisplayName > js - tests . WindowsPhone < / DisplayName > <nl> + < PublisherDisplayName > dalestam < / PublisherDisplayName > <nl> + < Logo > Assets \ StoreLogo . png < / Logo > <nl> + < / Properties > <nl> + < Prerequisites > <nl> + < OSMinVersion > 6 . 3 . 1 < / OSMinVersion > <nl> + < OSMaxVersionTested > 6 . 3 . 1 < / OSMaxVersionTested > <nl> + < / Prerequisites > <nl> + < Resources > <nl> + < Resource Language = " x - generate " / > <nl> + < / Resources > <nl> + < Applications > <nl> + < Application Id = " App " Executable = " $ targetnametoken $ . exe " EntryPoint = " cocos2d_WindowsPhone . App " > <nl> + < m3 : VisualElements DisplayName = " js - tests . WindowsPhone " Square150x150Logo = " Assets \ Logo . png " Square44x44Logo = " Assets \ SmallLogo . png " Description = " js - tests . WindowsPhone " ForegroundText = " light " BackgroundColor = " transparent " > <nl> + < m3 : DefaultTile Wide310x150Logo = " Assets \ WideLogo . png " Square71x71Logo = " Assets \ Square71x71Logo . png " > <nl> + < / m3 : DefaultTile > <nl> + < m3 : SplashScreen Image = " Assets \ SplashScreen . png " / > <nl> + < m3 : InitialRotationPreference > <nl> + < m3 : Rotation Preference = " landscape " / > <nl> + < m3 : Rotation Preference = " landscapeFlipped " / > <nl> + < / m3 : InitialRotationPreference > <nl> + < / m3 : VisualElements > <nl> + < / Application > <nl> + < / Applications > <nl> + < Capabilities > <nl> + < Capability Name = " internetClientServer " / > <nl> + < / Capabilities > <nl> + < / Package > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . 07385eb5553a <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . WindowsPhone / js - tests . WindowsPhone . 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> + < ItemGroup Label = " ProjectConfigurations " > <nl> + < ProjectConfiguration Include = " Debug | ARM " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > ARM < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Debug | Win32 " > <nl> + < Configuration > Debug < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | ARM " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > ARM < / Platform > <nl> + < / ProjectConfiguration > <nl> + < ProjectConfiguration Include = " Release | Win32 " > <nl> + < Configuration > Release < / Configuration > <nl> + < Platform > Win32 < / Platform > <nl> + < / ProjectConfiguration > <nl> + < / ItemGroup > <nl> + < PropertyGroup Label = " Globals " > <nl> + < ProjectGuid > { 94874B5B - 398F - 448A - A366 - 35A35DC1DB9C } < / ProjectGuid > <nl> + < RootNamespace > CocosAppWinRT < / RootNamespace > <nl> + < DefaultLanguage > en - US < / DefaultLanguage > <nl> + < MinimumVisualStudioVersion > 12 . 0 < / MinimumVisualStudioVersion > <nl> + < AppContainerApplication > true < / AppContainerApplication > <nl> + < ApplicationType > Windows Phone < / ApplicationType > <nl> + < ApplicationTypeRevision > 8 . 1 < / ApplicationTypeRevision > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . Default . props " / > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < PlatformToolset > v120_wp81 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | ARM ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > true < / UseDebugLibraries > <nl> + < PlatformToolset > v120_wp81 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > false < / WholeProgramOptimization > <nl> + < PlatformToolset > v120_wp81 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < PropertyGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | ARM ' " Label = " Configuration " > <nl> + < ConfigurationType > Application < / ConfigurationType > <nl> + < UseDebugLibraries > false < / UseDebugLibraries > <nl> + < WholeProgramOptimization > false < / WholeProgramOptimization > <nl> + < PlatformToolset > v120_wp81 < / PlatformToolset > <nl> + < / PropertyGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . props " / > <nl> + < Import Project = " . . \ App . Shared \ js - tests . Shared . vcxitems " Label = " Shared " / > <nl> + < ImportGroup Label = " ExtensionSettings " > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ wp_8 . 1_props \ cocos2d_wp_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | ARM ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ wp_8 . 1_props \ cocos2d_wp_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ wp_8 . 1_props \ cocos2d_wp_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < ImportGroup Label = " PropertySheets " Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | ARM ' " > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ wp_8 . 1_props \ cocos2d_wp_8 . 1_platform . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1 . props " / > <nl> + < Import Project = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ winrt_8 . 1_props \ cocos2d_winrt_8 . 1_app . props " / > <nl> + < Import Project = " . . \ resources . props " / > <nl> + < / ImportGroup > <nl> + < PropertyGroup Label = " UserMacros " > <nl> + < AppxAutoIncrementPackageRevision > True < / AppxAutoIncrementPackageRevision > <nl> + < AppxBundlePlatforms > arm < / AppxBundlePlatforms > <nl> + < / PropertyGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | ARM ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; COCOS2D_DEBUG = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < Link > <nl> + < IgnoreSpecificDefaultLibraries > MSVCRT ; % ( IgnoreSpecificDefaultLibraries ) < / IgnoreSpecificDefaultLibraries > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | ARM ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Debug | Win32 ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; COCOS2D_DEBUG = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < Link > <nl> + < IgnoreSpecificDefaultLibraries > MSVCRT ; % ( IgnoreSpecificDefaultLibraries ) < / IgnoreSpecificDefaultLibraries > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + < ItemDefinitionGroup Condition = " ' $ ( Configuration ) | $ ( Platform ) ' = = ' Release | Win32 ' " > <nl> + < ClCompile > <nl> + < AdditionalOptions > / bigobj / Zm200 % ( AdditionalOptions ) < / AdditionalOptions > <nl> + < DisableSpecificWarnings > 4800 ; 4101 ; % ( DisableSpecificWarnings ) < / DisableSpecificWarnings > <nl> + < ForcedIncludeFiles > pch . h < / ForcedIncludeFiles > <nl> + < AdditionalIncludeDirectories > $ ( ProjectDir ) . . \ . . \ Classes ; $ ( EngineRoot ) cocos \ platform \ win8 . 1 - universal ; % ( AdditionalIncludeDirectories ) < / AdditionalIncludeDirectories > <nl> + < SDLCheck > false < / SDLCheck > <nl> + < PreprocessorDefinitions > CC_ENABLE_CHIPMUNK_INTEGRATION = 1 ; % ( PreprocessorDefinitions ) < / PreprocessorDefinitions > <nl> + < DebugInformationFormat > ProgramDatabase < / DebugInformationFormat > <nl> + < / ClCompile > <nl> + < / ItemDefinitionGroup > <nl> + < ItemGroup > <nl> + < AppxManifest Include = " Package . appxmanifest " > <nl> + < SubType > Designer < / SubType > <nl> + < / AppxManifest > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < Image Include = " Assets \ Logo . scale - 240 . png " / > <nl> + < Image Include = " Assets \ SmallLogo . scale - 240 . png " / > <nl> + < Image Include = " Assets \ Square71x71Logo . scale - 240 . png " / > <nl> + < Image Include = " Assets \ StoreLogo . scale - 240 . png " / > <nl> + < Image Include = " Assets \ SplashScreen . scale - 240 . png " / > <nl> + < Image Include = " Assets \ WideLogo . scale - 240 . png " / > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ cocos \ scripting \ js - bindings \ proj . win8 . 1 - universal \ libjscocos2d \ libjscocos2d . WindowsPhone \ libjscocos2d . WindowsPhone . vcxproj " > <nl> + < Project > { ca082ec4 - 17ce - 430b - 8207 - d1e947a5d1e9 } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ cocos \ 2d \ libcocos2d_8_1 \ libcocos2d_8_1 \ libcocos2d_8_1 . WindowsPhone \ libcocos2d_8_1 . WindowsPhone . vcxproj " > <nl> + < Project > { 22f3b9df - 1209 - 4574 - 8331 - 003966f562bf } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ cocos \ editor - support \ spine \ proj . win8 . 1 - universal \ libSpine . WindowsPhone \ libSpine . WindowsPhone . vcxproj " > <nl> + < Project > { cc1da216 - a80d - 4be4 - b309 - acb6af313aff } < / Project > <nl> + < / ProjectReference > <nl> + < ProjectReference Include = " . . \ . . \ . . \ . . \ . . \ external \ Box2D \ proj . win8 . 1 - universal \ libbox2d . WindowsPhone \ libbox2d . WindowsPhone . vcxproj " > <nl> + < Project > { 22f798d8 - bfff - 4754 - 996f - a5395343d5ec } < / Project > <nl> + < / ProjectReference > <nl> + < / ItemGroup > <nl> + < Import Project = " $ ( VCTargetsPath ) \ Microsoft . Cpp . targets " / > <nl> + < ImportGroup Label = " ExtensionTargets " > <nl> + < / ImportGroup > <nl> + < / Project > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . eb71f325ca1d <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / App . WindowsPhone / js - tests . WindowsPhone . vcxproj . filters <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project ToolsVersion = " 12 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ItemGroup > <nl> + < Filter Include = " Assets " > <nl> + < UniqueIdentifier > { c8beb60d - 689b - 4aaa - 9749 - 99bd3e2dcf75 } < / UniqueIdentifier > <nl> + < Extensions > bmp ; fbx ; gif ; jpg ; jpeg ; tga ; tiff ; tif ; png < / Extensions > <nl> + < / Filter > <nl> + < Image Include = " Assets \ Logo . scale - 240 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ SmallLogo . scale - 240 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ Square71x71Logo . scale - 240 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ StoreLogo . scale - 240 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ SplashScreen . scale - 240 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < Image Include = " Assets \ WideLogo . scale - 240 . png " > <nl> + < Filter > Assets < / Filter > <nl> + < / Image > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < AppxManifest Include = " Package . appxmanifest " / > <nl> + < / ItemGroup > <nl> + < / Project > <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . bee92bbc47f1 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / project / proj . win8 . 1 - universal / resources . props <nl> <nl> +  < ? xml version = " 1 . 0 " encoding = " utf - 8 " ? > <nl> + < Project ToolsVersion = " 4 . 0 " xmlns = " http : / / schemas . microsoft . com / developer / msbuild / 2003 " > <nl> + < ImportGroup Label = " PropertySheets " / > <nl> + <nl> + < ItemDefinitionGroup > <nl> + < ClCompile > <nl> + < AdditionalIncludeDirectories > $ ( EngineRoot ) cocos \ scripting \ js - bindings \ manual ; $ ( EngineRoot ) cocos \ scripting \ js - bindings \ auto ; $ ( EngineRoot ) external \ spidermonkey \ include \ $ ( COCOS2D_PLATFORM ) ; $ ( EngineRoot ) cocos \ base ; % ( AdditionalIncludeDirectories ) ; < / AdditionalIncludeDirectories > <nl> + < / ClCompile > <nl> + < Link > <nl> + < AdditionalDependencies > mozjs - 33 . lib ; % ( AdditionalDependencies ) < / AdditionalDependencies > <nl> + < AdditionalLibraryDirectories > $ ( EngineRoot ) external \ spidermonkey \ prebuilt \ $ ( COCOS2D_PLATFORM ) \ $ ( Platform ) ; % ( AdditionalLibraryDirectories ) ; < / AdditionalLibraryDirectories > <nl> + < / Link > <nl> + < / ItemDefinitionGroup > <nl> + <nl> + < PropertyGroup Label = " APP_DLLS " > <nl> + < SpiderMonkeyBinPath Condition = " ' $ ( SpiderMonkeyBinPath ) ' = = ' ' " > $ ( EngineRoot ) external \ spidermonkey \ prebuilt \ $ ( COCOS2D_PLATFORM ) \ $ ( Platform ) \ < / SpiderMonkeyBinPath > <nl> + < / PropertyGroup > <nl> + <nl> + < ItemGroup Label = " APP_DLLs " > <nl> + < None Include = " $ ( SpiderMonkeyBinPath ) mozjs - 33 . dll " > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < / None > <nl> + < / ItemGroup > <nl> + <nl> + < ItemGroup > <nl> + < _CustomResource Include = " . . \ . . \ . . \ . . \ cpp - tests \ Resources \ * * \ * " > <nl> + < Link > Assets \ Resources \ res \ % ( RecursiveDir ) % ( FileName ) % ( Extension ) < / Link > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < / _CustomResource > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < _CustomResource Include = " . . \ . . \ . . \ src \ * * \ * " > <nl> + < Link > Assets \ Resources \ src \ % ( RecursiveDir ) % ( FileName ) % ( Extension ) < / Link > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < / _CustomResource > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < _CustomResource Include = " . . \ . . \ . . \ . . \ . . \ cocos \ scripting \ js - bindings \ script \ * * \ * " > <nl> + < Link > Assets \ Resources \ script \ % ( RecursiveDir ) % ( FileName ) % ( Extension ) < / Link > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < / _CustomResource > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < _CustomResource Include = " . . \ . . \ . . \ main . js " > <nl> + < Link > Assets \ Resources \ % ( RecursiveDir ) % ( FileName ) % ( Extension ) < / Link > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < / _CustomResource > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < _CustomResource Include = " . . \ . . \ . . \ project . json " > <nl> + < Link > Assets \ Resources \ % ( RecursiveDir ) % ( FileName ) % ( Extension ) < / Link > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < / _CustomResource > <nl> + < / ItemGroup > <nl> + < ItemGroup > <nl> + < _CustomResource Include = " . . \ . . \ . . \ resjs \ * * \ * " > <nl> + < Link > Assets \ Resources \ res \ resjs \ % ( RecursiveDir ) % ( FileName ) % ( Extension ) < / Link > <nl> + < DeploymentContent > true < / DeploymentContent > <nl> + < CopyToOutputDirectory > Always < / CopyToOutputDirectory > <nl> + < / _CustomResource > <nl> + < / ItemGroup > <nl> + < Target Name = " _CollectCustomResources " BeforeTargets = " AssignTargetPaths " > <nl> + < Message Text = " Adding resource : % ( _CustomResource . Identity ) - & gt ; % ( _CustomResource . Link ) " / > <nl> + < ItemGroup > <nl> + < None Include = " @ ( _CustomResource ) " / > <nl> + < / ItemGroup > <nl> + < / Target > <nl> + < / Project > <nl> + <nl> new file mode 100755 <nl> index 000000000000 . . 1d65afe3660c <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / res / . gitignore <nl> <nl> + # Do now ignore Marmalade icf files <nl> + ! * . icf <nl> new file mode 100755 <nl> index 000000000000 . . 93aa6e983ac3 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_01 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . bf03d3312c36 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_02 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . e01c593b40e5 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_03 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . c9b0ae252940 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_04 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . e65e6b2febb3 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_05 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . 4c3be2334f25 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_06 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . 4c38de3a789d <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_07 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . fad80b8e9af8 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_08 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . b0fa9aded3a3 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_09 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . 0abb6eab9397 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_10 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . 7285fd6c76de <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_11 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . ce7d672004da <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_12 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . 92cbbd4da184 <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_13 . png differ <nl> new file mode 100755 <nl> index 000000000000 . . ee7d1bba0aea <nl> Binary files / dev / null and b / tests / js - memory - gc - tests / res / Images / grossini_dance_14 . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 52cddc0fb197 <nl> mmm / dev / null <nl> ppp b / tests / js - memory - gc - tests / src / tests - main . js <nl> <nl> + / / Custom Sprite <nl> + var MySprite = cc . Sprite . extend ( { <nl> + ctor : function ( path ) { <nl> + this . _super ( path ) ; <nl> + } , <nl> + something : function ( x , y ) { <nl> + this . setPosition ( x , y ) ; <nl> + } <nl> + } ) ; <nl> + <nl> + / / <nl> + / / Scene Test 1 <nl> + / / <nl> + function runScene1 ( sender ) { <nl> + <nl> + var scene = new cc . Scene ( ) ; <nl> + <nl> + for ( i = 0 ; i < 5 ; i + + ) { <nl> + var sprite = new MySprite ( " res / Images / grossini_dance_01 . png " ) ; <nl> + sprite . something ( 50 + 50 * i , 200 ) ; <nl> + scene . addChild ( sprite ) ; <nl> + } <nl> + <nl> + / / menu <nl> + var button = new cc . MenuItemFont ( " Go to Scene 2 " , runScene2 ) ; <nl> + button . fontSize = 20 ; <nl> + button . fontName = " Arial " ; <nl> + var menu = new cc . Menu ( ) ; <nl> + menu . addChild ( button ) ; <nl> + menu . setPosition ( 300 , 20 ) ; <nl> + scene . addChild ( menu ) ; <nl> + <nl> + cc . director . replaceScene ( scene ) ; <nl> + } <nl> + <nl> + / / <nl> + / / Scene Test 2 <nl> + / / <nl> + function runScene2 ( sender ) { <nl> + <nl> + var scene = new cc . Scene ( ) ; <nl> + <nl> + for ( i = 0 ; i < 5 ; i + + ) { <nl> + var sprite = new cc . Sprite ( " res / Images / grossini_dance_08 . png " ) ; <nl> + sprite . setPosition ( 50 + 50 * i , 200 ) ; <nl> + scene . addChild ( sprite ) ; <nl> + } <nl> + <nl> + / / menu <nl> + var button = new cc . MenuItemFont ( " Go to Scene 3 " , runScene3 ) ; <nl> + button . fontSize = 20 ; <nl> + button . fontName = " Arial " ; <nl> + var menu = new cc . Menu ( ) ; <nl> + menu . addChild ( button ) ; <nl> + menu . setPosition ( 300 , 20 ) ; <nl> + scene . addChild ( menu ) ; <nl> + <nl> + cc . director . replaceScene ( scene ) ; <nl> + } <nl> + <nl> + / / <nl> + / / Scene Test 3 <nl> + / / <nl> + function runScene3 ( sender ) { <nl> + <nl> + var scene = new cc . Scene ( ) ; <nl> + <nl> + var fontDef = new cc . FontDefinition ( ) ; <nl> + fontDef . fontName = " Arial " ; <nl> + fontDef . fontSize = 32 ; <nl> + this . label = new cc . LabelTTF ( " See console ! " , fontDef ) ; <nl> + this . label . setPosition ( 300 , 300 ) ; <nl> + scene . addChild ( this . label ) ; <nl> + <nl> + / / menu <nl> + var button = new cc . MenuItemFont ( " Go to Scene 4 " , runScene4 ) ; <nl> + button . fontSize = 20 ; <nl> + button . fontName = " Arial " ; <nl> + var menu = new cc . Menu ( ) ; <nl> + menu . addChild ( button ) ; <nl> + menu . setPosition ( 300 , 20 ) ; <nl> + scene . addChild ( menu ) ; <nl> + <nl> + / / ' browser ' can use touches or mouse . <nl> + / / The benefit of using ' touches ' in a browser , is that it works both with mouse events or touches events <nl> + if ( ' touches ' in cc . sys . capabilities ) { <nl> + cc . eventManager . addListener ( { <nl> + event : cc . EventListener . TOUCH_ALL_AT_ONCE , <nl> + onTouchesMoved : function ( touches , event ) { <nl> + var delta = touches [ 0 ] . getDelta ( ) ; <nl> + cc . log ( " onTouchesMoved : " + delta ) ; <nl> + return true ; <nl> + } <nl> + } , <nl> + 10 ) ; <nl> + } else if ( ' mouse ' in cc . sys . capabilities ) { <nl> + cc . eventManager . addListener ( { <nl> + event : cc . EventListener . MOUSE , <nl> + onMouseMove : function ( event ) { <nl> + if ( event . getButton ( ) = = cc . EventMouse . BUTTON_LEFT ) <nl> + cc . log ( " onMouseMove " + event . getDelta ( ) ) ; <nl> + } , <nl> + onMouseScroll : function ( event ) { <nl> + var delta = cc . sys . isNative ? event . getScrollY ( ) * 6 : - event . getScrollY ( ) ; <nl> + cc . log ( " onMouseScroll : " + delta ) ; <nl> + return true ; <nl> + } <nl> + } , <nl> + 10 ) ; <nl> + } <nl> + <nl> + cc . director . replaceScene ( scene ) ; <nl> + } <nl> + <nl> + <nl> + function runScene4 ( sender ) { <nl> + <nl> + var scene = new cc . Scene ( ) ; <nl> + <nl> + var actionTo = cc . jumpTo ( 2 , cc . p ( 300 , 300 ) , 50 , 4 ) ; <nl> + var actionBy = cc . jumpBy ( 2 , cc . p ( 300 , 0 ) , 50 , 4 ) ; <nl> + var actionUp = cc . jumpBy ( 2 , cc . p ( 0 , 0 ) , 80 , 4 ) ; <nl> + var actionByBack = actionBy . reverse ( ) ; <nl> + <nl> + var delay = cc . delayTime ( 0 . 25 ) ; <nl> + <nl> + var sprite1 = new cc . Sprite ( " res / Images / grossini_dance_08 . png " ) ; <nl> + sprite1 . setPosition ( 10 , 10 ) ; <nl> + var sprite2 = new cc . Sprite ( " res / Images / grossini_dance_01 . png " ) ; <nl> + sprite2 . setPosition ( 200 , 10 ) ; <nl> + var sprite3 = new cc . Sprite ( " res / Images / grossini_dance_04 . png " ) ; <nl> + sprite3 . setPosition ( 400 , 10 ) ; <nl> + <nl> + scene . addChild ( sprite1 ) ; <nl> + scene . addChild ( sprite2 ) ; <nl> + scene . addChild ( sprite3 ) ; <nl> + <nl> + sprite1 . runAction ( actionTo ) ; <nl> + sprite2 . runAction ( cc . sequence ( actionBy , delay , actionByBack ) ) ; <nl> + <nl> + var action = cc . sequence ( actionUp , delay . clone ( ) ) . repeatForever ( ) ; <nl> + sprite3 . runAction ( action ) ; <nl> + <nl> + <nl> + / / menu <nl> + var button = new cc . MenuItemFont ( " Go to Scene 1 " , runScene1 ) ; <nl> + button . fontSize = 20 ; <nl> + button . fontName = " Arial " ; <nl> + var menu = new cc . Menu ( ) ; <nl> + menu . addChild ( button ) ; <nl> + menu . setPosition ( 300 , 20 ) ; <nl> + scene . addChild ( menu ) ; <nl> + <nl> + cc . director . replaceScene ( scene ) ; <nl> + } <nl> + <nl> + / / <nl> + / / Main Entry point <nl> + / / <nl> + function runMain ( ) { <nl> + <nl> + var scene = new cc . Scene ( ) ; <nl> + <nl> + / / menu <nl> + var button = new cc . MenuItemFont ( " Start Test " , runScene1 ) ; <nl> + button . fontSize = 20 ; <nl> + button . fontName = " Arial " ; <nl> + var menu = new cc . Menu ( ) ; <nl> + menu . addChild ( button ) ; <nl> + menu . setPosition ( 300 , 300 ) ; <nl> + <nl> + scene . addChild ( menu ) ; <nl> + cc . director . runScene ( scene ) ; <nl> + } <nl> mmm a / tests / js - tests / main . js <nl> ppp b / tests / js - tests / main . js <nl> <nl> <nl> / * * <nl> * A brief explanation for " project . json " : <nl> - * Here is the content of project . json file , this is the global configuration for your game , you can modify it to customize some behavior . <nl> + * Here is the content ofproject . json file , this is the global configuration for your game , you can modify it to customize some behavior . <nl> * The detail of each field is under it . <nl> { <nl> " debugMode " : 1 , <nl>
Adds iOS tests , calls GC after replacing scene
cocos2d/cocos2d-x
8e02749993b80204c570493c623dd19a676eb4b3
2015-12-30T01:33:08Z
mmm a / cocos / platform / CCGLView . cpp <nl> ppp b / cocos / platform / CCGLView . cpp <nl> void GLView : : handleTouchesMove ( int num , intptr_t ids [ ] , float xs [ ] , float ys [ ] , <nl> continue ; <nl> } <nl> <nl> - CCLOGINFO ( " Moving touches with id : % d , x = % f , y = % f , force = % f , maxFource = % f " , id , x , y , force , maxForce ) ; <nl> + CCLOGINFO ( " Moving touches with id : % d , x = % f , y = % f , force = % f , maxFource = % f " , ( int ) id , x , y , force , maxForce ) ; <nl> Touch * touch = g_touches [ iter - > second ] ; <nl> if ( touch ) <nl> { <nl> void GLView : : handleTouchesOfEndOrCancel ( EventTouch : : EventCode eventCode , int num <nl> Touch * touch = g_touches [ iter - > second ] ; <nl> if ( touch ) <nl> { <nl> - CCLOGINFO ( " Ending touches with id : % d , x = % f , y = % f " , id , x , y ) ; <nl> + CCLOGINFO ( " Ending touches with id : % d , x = % f , y = % f " , ( int ) id , x , y ) ; <nl> touch - > setTouchInfo ( iter - > second , ( x - _viewPortRect . origin . x ) / _scaleX , <nl> ( y - _viewPortRect . origin . y ) / _scaleY ) ; <nl> <nl> mmm a / cocos / scripting / js - bindings / manual / ScriptingCore . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / ScriptingCore . cpp <nl> bool ScriptingCore : : handleTouchesEvent ( void * nativeObj , cocos2d : : EventTouch : : Eve <nl> <nl> for ( const auto & touch : touches ) <nl> { <nl> - JS : : RootedValue jsret ( _cx , OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , touch , typeClassTouch , " cocos2d : : Touch " ) ) ) ; <nl> + JS : : RootedValue jsret ( _cx , OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , touch , typeClassTouch ) ) ) ; <nl> if ( ! JS_SetElement ( _cx , jsretArr , count , jsret ) ) <nl> { <nl> break ; <nl> bool ScriptingCore : : handleTouchesEvent ( void * nativeObj , cocos2d : : EventTouch : : Eve <nl> { <nl> jsval dataVal [ 2 ] ; <nl> dataVal [ 0 ] = OBJECT_TO_JSVAL ( jsretArr ) ; <nl> - dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClassEvent , " cocos2d : : EventTouch " ) ) ; <nl> + dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClassEvent ) ) ; <nl> ret = executeFunctionWithOwner ( OBJECT_TO_JSVAL ( p - > obj ) , funcName . c_str ( ) , 2 , dataVal , jsvalRet ) ; <nl> } <nl> <nl> bool ScriptingCore : : handleTouchesEvent ( void * nativeObj , cocos2d : : EventTouch : : Eve <nl> { <nl> removeJSObject ( _cx , touch ) ; <nl> } <nl> - <nl> removeJSObject ( _cx , event ) ; <nl> <nl> return ret ; <nl> bool ScriptingCore : : handleTouchEvent ( void * nativeObj , cocos2d : : EventTouch : : Event <nl> js_type_class_t * typeClassEvent = js_get_type_from_native < cocos2d : : EventTouch > ( ( cocos2d : : EventTouch * ) event ) ; <nl> <nl> jsval dataVal [ 2 ] ; <nl> - dataVal [ 0 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , touch , typeClassTouch , " cocos2d : : Touch " ) ) ; <nl> - dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClassEvent , " cocos2d : : EventTouch " ) ) ; <nl> + dataVal [ 0 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , touch , typeClassTouch ) ) ; <nl> + dataVal [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClassEvent ) ) ; <nl> <nl> ret = executeFunctionWithOwner ( OBJECT_TO_JSVAL ( p - > obj ) , funcName . c_str ( ) , 2 , dataVal , jsvalRet ) ; <nl> } <nl> bool ScriptingCore : : handleMouseEvent ( void * nativeObj , cocos2d : : EventMouse : : Mouse <nl> if ( p ) <nl> { <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : EventMouse > ( ( cocos2d : : EventMouse * ) event ) ; <nl> - jsval dataVal = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClass , " cocos2d : : EventMouse " ) ) ; <nl> + jsval dataVal = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClass ) ) ; <nl> ret = executeFunctionWithOwner ( OBJECT_TO_JSVAL ( p - > obj ) , funcName . c_str ( ) , 1 , & dataVal , jsvalRet ) ; <nl> <nl> removeJSObject ( _cx , event ) ; <nl> bool ScriptingCore : : handleKeyboardEvent ( void * nativeObj , cocos2d : : EventKeyboard : <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : EventKeyboard > ( ( cocos2d : : EventKeyboard * ) event ) ; <nl> jsval args [ 2 ] = { <nl> int32_to_jsval ( _cx , ( int32_t ) keyCode ) , <nl> - OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClass , " cocos2d : : EventKeyboard " ) ) <nl> + OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( _cx , event , typeClass ) ) <nl> } ; <nl> <nl> if ( isPressed ) <nl> int ScriptingCore : : executeCustomTouchesEvent ( EventTouch : : EventCode eventType , <nl> { <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Touch > ( touch ) ; <nl> <nl> - jsval jsret = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> + jsval jsret = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass ) ) ; <nl> JS : : RootedValue jsval ( _cx , jsret ) ; <nl> if ( ! JS_SetElement ( this - > _cx , jsretArr , count , jsval ) ) { <nl> break ; <nl> int ScriptingCore : : executeCustomTouchEvent ( EventTouch : : EventCode eventType , Touc <nl> std : : string funcName = getTouchFuncName ( eventType ) ; <nl> <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Touch > ( touch ) ; <nl> - jsval jsTouch = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> + jsval jsTouch = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass ) ) ; <nl> <nl> executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , funcName . c_str ( ) , 1 , & jsTouch , & retval ) ; <nl> <nl> int ScriptingCore : : executeCustomTouchEvent ( EventTouch : : EventCode eventType , <nl> std : : string funcName = getTouchFuncName ( eventType ) ; <nl> <nl> js_type_class_t * typeClass = js_get_type_from_native < cocos2d : : Touch > ( touch ) ; <nl> - jsval jsTouch = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass , " cocos2d : : Touch " ) ) ; <nl> + jsval jsTouch = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( this - > _cx , touch , typeClass ) ) ; <nl> <nl> executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , funcName . c_str ( ) , 1 , & jsTouch , retval ) ; <nl> <nl> JSObject * jsb_create_weak_jsobject ( JSContext * cx , void * native , js_type_class_t <nl> JS : : RootedObject parent ( cx , typeClass - > parentProto . ref ( ) ) ; <nl> JS : : RootedObject jsObj ( cx , JS_NewObject ( cx , typeClass - > jsclass , proto , parent ) ) ; <nl> auto proxy = jsb_new_proxy ( native , jsObj ) ; <nl> + js_add_FinalizeHook ( cx , jsObj , false ) ; <nl> <nl> # if ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> JS : : AddNamedObjectRoot ( cx , & proxy - > obj , debug ) ; <nl> # else <nl> # if COCOS2D_DEBUG > 1 <nl> - CCLOG ( " ppppppWEAK_REFpppppp Cpp ( % s ) : % p - JS : % p " , debug , native , jsObj . get ( ) ) ; <nl> + if ( debug ! = nullptr ) <nl> + { <nl> + CCLOG ( " ppppppWEAK_REFpppppp Cpp ( % s ) : % p - JS : % p " , debug , native , jsObj . get ( ) ) ; <nl> + } <nl> # endif / / COCOS2D_DEBUG <nl> # endif / / CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> return jsObj ; <nl> JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_ty <nl> js_proxy_t * newproxy = jsb_new_proxy ( ref , jsObj ) ; <nl> # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> ref - > retain ( ) ; <nl> - js_add_FinalizeHook ( cx , jsObj ) ; <nl> + js_add_FinalizeHook ( cx , jsObj , true ) ; <nl> # if COCOS2D_DEBUG > 1 <nl> CCLOG ( " ppppppRETAINEDpppppp Cpp ( % s ) : % p - JS : % p " , debug , ref , jsObj . get ( ) ) ; <nl> # endif / / COCOS2D_DEBUG <nl> void jsb_ref_init ( JSContext * cx , JS : : Heap < JSObject * > * obj , Ref * ref , const char * <nl> # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> ( void ) ref ; <nl> JS : : RootedObject jsObj ( cx , * obj ) ; <nl> - js_add_FinalizeHook ( cx , jsObj ) ; <nl> + js_add_FinalizeHook ( cx , jsObj , true ) ; <nl> / / don ' t retain it , already retained <nl> # if COCOS2D_DEBUG > 1 <nl> CCLOG ( " ppppppRETAINEDpppppp Cpp ( % s ) : % p - JS : % p " , debug , ref , jsObj . get ( ) ) ; <nl> void jsb_ref_autoreleased_init ( JSContext * cx , JS : : Heap < JSObject * > * obj , Ref * ref <nl> ( void ) obj ; <nl> ref - > retain ( ) ; <nl> JS : : RootedObject jsObj ( cx , * obj ) ; <nl> - js_add_FinalizeHook ( cx , jsObj ) ; <nl> + js_add_FinalizeHook ( cx , jsObj , true ) ; <nl> # else <nl> / / don ' t autorelease it , since it is already autoreleased <nl> JS : : AddNamedObjectRoot ( cx , obj , debug ) ; <nl> void jsb_ref_rebind ( JSContext * cx , JS : : HandleObject jsobj , js_proxy_t * proxy , co <nl> / / Rebind js obj with new action <nl> js_proxy_t * newProxy = jsb_new_proxy ( newRef , jsobj ) ; <nl> <nl> - # if ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> + # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> + CC_UNUSED_PARAM ( newProxy ) ; <nl> + # else <nl> JS : : AddNamedObjectRoot ( cx , & newProxy - > obj , debug ) ; <nl> # endif <nl> } <nl> mmm a / cocos / scripting / js - bindings / manual / ScriptingCore . h <nl> ppp b / cocos / scripting / js - bindings / manual / ScriptingCore . h <nl> JSObject * jsb_ref_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_ty <nl> * If it can ' t find it , it will create a new one associating it to Ref <nl> * Call this function for objects that might return an already existing copy when you create them . For example , ` Animation3D : : create ( ) ` ; <nl> * / <nl> - JSObject * jsb_ref_autoreleased_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug ) ; <nl> + JSObject * jsb_ref_autoreleased_get_or_create_jsobject ( JSContext * cx , cocos2d : : Ref * ref , js_type_class_t * typeClass , const char * debug = nullptr ) ; <nl> <nl> / * * <nl> * It will try to get the associated JSObjct for the native object . <nl> JSObject * jsb_ref_autoreleased_get_or_create_jsobject ( JSContext * cx , cocos2d : : Re <nl> * The reference created from JSObject to native object is weak because it won ' t retain it . <nl> * The behavior is exactly the same with ' jsb_ref_get_or_create_jsobject ' when CC_ENABLE_GC_FOR_NATIVE_OBJECTS deactivated . <nl> * / <nl> - CC_JS_DLL JSObject * jsb_get_or_create_weak_jsobject ( JSContext * cx , void * native , js_type_class_t * typeClass , const char * debug ) ; <nl> + CC_JS_DLL JSObject * jsb_get_or_create_weak_jsobject ( JSContext * cx , void * native , js_type_class_t * typeClass , const char * debug = nullptr ) ; <nl> <nl> / * * <nl> * Register finalize hook and its owner as an entry in _js_hook_owner_map , <nl> mmm a / cocos / scripting / js - bindings / manual / cocos2d_specifics . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / cocos2d_specifics . cpp <nl> js_type_class_t * js_get_type_from_node ( cocos2d : : Node * native_obj ) <nl> return js_get_type_from_native < cocos2d : : Node > ( native_obj ) ; <nl> } <nl> <nl> - void js_add_FinalizeHook ( JSContext * cx , JS : : HandleObject target ) <nl> + void js_add_FinalizeHook ( JSContext * cx , JS : : HandleObject target , bool isRef ) <nl> { <nl> - JS : : RootedObject proto ( cx , jsb_FinalizeHook_prototype ) ; <nl> - JS : : RootedObject hook ( cx , JS_NewObject ( cx , jsb_FinalizeHook_class , proto , JS : : NullPtr ( ) ) ) ; <nl> + JS : : RootedObject hook ( cx ) ; <nl> + if ( isRef ) <nl> + { <nl> + JS : : RootedObject proto ( cx , jsb_RefFinalizeHook_prototype ) ; <nl> + hook = JS_NewObject ( cx , jsb_RefFinalizeHook_class , proto , JS : : NullPtr ( ) ) ; <nl> + } <nl> + else <nl> + { <nl> + JS : : RootedObject proto ( cx , jsb_ObjFinalizeHook_prototype ) ; <nl> + hook = JS_NewObject ( cx , jsb_ObjFinalizeHook_class , proto , JS : : NullPtr ( ) ) ; <nl> + } <nl> jsb_register_finalize_hook ( hook . get ( ) , target . get ( ) ) ; <nl> JS : : RootedValue hookVal ( cx , OBJECT_TO_JSVAL ( hook ) ) ; <nl> JS_SetProperty ( cx , target , " __hook " , hookVal ) ; <nl> bool js_cocos2dx_ComponentJS_getScriptObject ( JSContext * cx , uint32_t argc , jsval <nl> return false ; <nl> } <nl> <nl> - JSClass * jsb_FinalizeHook_class ; <nl> - JSObject * jsb_FinalizeHook_prototype ; <nl> + JSClass * jsb_RefFinalizeHook_class ; <nl> + JSObject * jsb_RefFinalizeHook_prototype ; <nl> + JSClass * jsb_ObjFinalizeHook_class ; <nl> + JSObject * jsb_ObjFinalizeHook_prototype ; <nl> <nl> - static bool jsb_FinalizeHook_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + static bool jsb_RefFinalizeHook_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> / / Create new object <nl> - JS : : RootedObject proto ( cx , jsb_FinalizeHook_prototype ) ; <nl> - JS : : RootedObject obj ( cx , JS_NewObject ( cx , jsb_FinalizeHook_class , proto , JS : : NullPtr ( ) ) ) ; <nl> + JS : : RootedObject proto ( cx , jsb_RefFinalizeHook_prototype ) ; <nl> + JS : : RootedObject obj ( cx , JS_NewObject ( cx , jsb_RefFinalizeHook_class , proto , JS : : NullPtr ( ) ) ) ; <nl> / / Register arguments [ 0 ] as owner <nl> if ( ! args . get ( 0 ) . isNullOrUndefined ( ) ) <nl> { <nl> static bool jsb_FinalizeHook_constructor ( JSContext * cx , uint32_t argc , jsval * vp <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( obj ) ) ; <nl> return true ; <nl> } <nl> - void jsb_FinalizeHook_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> + void jsb_RefFinalizeHook_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> { <nl> ScriptingCore * sc = ScriptingCore : : getInstance ( ) ; <nl> JSContext * cx = sc - > getGlobalContext ( ) ; <nl> void jsb_FinalizeHook_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> if ( ownerPtr ) <nl> { <nl> JS : : RootedObject owner ( cx , ownerPtr ) ; <nl> - CCLOGINFO ( " jsbindings : finalizing JS object via Finalizehook % p " , owner . get ( ) ) ; <nl> + CCLOGINFO ( " jsbindings : finalizing JS object via RefFinalizehook % p " , owner . get ( ) ) ; <nl> js_proxy_t * nproxy = nullptr ; <nl> js_proxy_t * jsproxy = nullptr ; <nl> jsproxy = jsb_get_js_proxy ( owner ) ; <nl> void jsb_FinalizeHook_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> CCLOG ( " mmmmmmRELEASEDmmmmmm Cpp : % p - JS : % p " , refObj , ownerPtr ) ; <nl> # endif / / COCOS2D_DEBUG <nl> } <nl> - # if COCOS2D_DEBUG > 1 <nl> - else { <nl> - CCLOG ( " A non ref object have registered finalize hook : % p " , nproxy - > ptr ) ; <nl> - } <nl> - # endif / / COCOS2D_DEBUG <nl> sc - > setFinalizing ( nullptr ) ; <nl> } <nl> # if COCOS2D_DEBUG > 1 <nl> void jsb_FinalizeHook_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> # endif / / COCOS2D_DEBUG <nl> } <nl> } <nl> + static bool jsb_ObjFinalizeHook_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + / / Create new object <nl> + JS : : RootedObject proto ( cx , jsb_ObjFinalizeHook_prototype ) ; <nl> + JS : : RootedObject obj ( cx , JS_NewObject ( cx , jsb_ObjFinalizeHook_class , proto , JS : : NullPtr ( ) ) ) ; <nl> + / / Register arguments [ 0 ] as owner <nl> + if ( ! args . get ( 0 ) . isNullOrUndefined ( ) ) <nl> + { <nl> + jsb_register_finalize_hook ( obj . get ( ) , args . get ( 0 ) . toObjectOrNull ( ) ) ; <nl> + } <nl> + args . rval ( ) . set ( OBJECT_TO_JSVAL ( obj ) ) ; <nl> + return true ; <nl> + } <nl> + void jsb_ObjFinalizeHook_finalize ( JSFreeOp * fop , JSObject * obj ) <nl> + { <nl> + ScriptingCore * sc = ScriptingCore : : getInstance ( ) ; <nl> + JSContext * cx = sc - > getGlobalContext ( ) ; <nl> + JS : : RootedObject jsobj ( cx , obj ) ; <nl> + JSObject * ownerPtr = jsb_get_and_remove_hook_owner ( obj ) ; <nl> + if ( ownerPtr ) <nl> + { <nl> + JS : : RootedObject owner ( cx , ownerPtr ) ; <nl> + CCLOGINFO ( " jsbindings : finalizing JS object via ObjFinalizehook % p " , owner . get ( ) ) ; <nl> + js_proxy_t * nproxy = nullptr ; <nl> + js_proxy_t * jsproxy = nullptr ; <nl> + jsproxy = jsb_get_js_proxy ( owner ) ; <nl> + if ( jsproxy ) <nl> + { <nl> + sc - > setFinalizing ( ownerPtr ) ; <nl> + <nl> + nproxy = jsb_get_native_proxy ( jsproxy - > ptr ) ; <nl> + jsb_remove_proxy ( nproxy , jsproxy ) ; <nl> + # if COCOS2D_DEBUG > 1 <nl> + CCLOG ( " mmmmmmWEAK_REFmmmmmm Cpp : % p - JS : % p " , nproxy - > ptr , ownerPtr ) ; <nl> + # endif / / COCOS2D_DEBUG <nl> + sc - > setFinalizing ( nullptr ) ; <nl> + } <nl> + } <nl> + } <nl> <nl> - void jsb_register_FinalizeHook ( JSContext * cx , JS : : HandleObject global ) { <nl> - jsb_FinalizeHook_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> - jsb_FinalizeHook_class - > name = " FinalizeHook " ; <nl> - jsb_FinalizeHook_class - > addProperty = JS_PropertyStub ; <nl> - jsb_FinalizeHook_class - > delProperty = JS_DeletePropertyStub ; <nl> - jsb_FinalizeHook_class - > getProperty = JS_PropertyStub ; <nl> - jsb_FinalizeHook_class - > setProperty = JS_StrictPropertyStub ; <nl> - jsb_FinalizeHook_class - > enumerate = JS_EnumerateStub ; <nl> - jsb_FinalizeHook_class - > resolve = JS_ResolveStub ; <nl> - jsb_FinalizeHook_class - > convert = JS_ConvertStub ; <nl> - jsb_FinalizeHook_class - > finalize = jsb_FinalizeHook_finalize ; <nl> - jsb_FinalizeHook_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> + void jsb_register_RefFinalizeHook ( JSContext * cx , JS : : HandleObject global ) { <nl> + jsb_RefFinalizeHook_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> + jsb_RefFinalizeHook_class - > name = " RefFinalizeHook " ; <nl> + jsb_RefFinalizeHook_class - > addProperty = JS_PropertyStub ; <nl> + jsb_RefFinalizeHook_class - > delProperty = JS_DeletePropertyStub ; <nl> + jsb_RefFinalizeHook_class - > getProperty = JS_PropertyStub ; <nl> + jsb_RefFinalizeHook_class - > setProperty = JS_StrictPropertyStub ; <nl> + jsb_RefFinalizeHook_class - > enumerate = JS_EnumerateStub ; <nl> + jsb_RefFinalizeHook_class - > resolve = JS_ResolveStub ; <nl> + jsb_RefFinalizeHook_class - > convert = JS_ConvertStub ; <nl> + jsb_RefFinalizeHook_class - > finalize = jsb_RefFinalizeHook_finalize ; <nl> + jsb_RefFinalizeHook_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> <nl> - jsb_FinalizeHook_prototype = JS_InitClass ( cx , global , <nl> + jsb_RefFinalizeHook_prototype = JS_InitClass ( cx , global , <nl> + JS : : NullPtr ( ) , / / parent proto <nl> + jsb_RefFinalizeHook_class , <nl> + jsb_RefFinalizeHook_constructor , 0 , / / constructor <nl> + NULL , NULL , NULL , NULL ) ; <nl> + } <nl> + void jsb_register_ObjFinalizeHook ( JSContext * cx , JS : : HandleObject global ) { <nl> + jsb_ObjFinalizeHook_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> + jsb_ObjFinalizeHook_class - > name = " ObjFinalizeHook " ; <nl> + jsb_ObjFinalizeHook_class - > addProperty = JS_PropertyStub ; <nl> + jsb_ObjFinalizeHook_class - > delProperty = JS_DeletePropertyStub ; <nl> + jsb_ObjFinalizeHook_class - > getProperty = JS_PropertyStub ; <nl> + jsb_ObjFinalizeHook_class - > setProperty = JS_StrictPropertyStub ; <nl> + jsb_ObjFinalizeHook_class - > enumerate = JS_EnumerateStub ; <nl> + jsb_ObjFinalizeHook_class - > resolve = JS_ResolveStub ; <nl> + jsb_ObjFinalizeHook_class - > convert = JS_ConvertStub ; <nl> + jsb_ObjFinalizeHook_class - > finalize = jsb_ObjFinalizeHook_finalize ; <nl> + jsb_ObjFinalizeHook_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> + <nl> + jsb_ObjFinalizeHook_prototype = JS_InitClass ( cx , global , <nl> JS : : NullPtr ( ) , / / parent proto <nl> - jsb_FinalizeHook_class , <nl> - jsb_FinalizeHook_constructor , 0 , / / constructor <nl> + jsb_ObjFinalizeHook_class , <nl> + jsb_ObjFinalizeHook_constructor , 0 , / / constructor <nl> NULL , NULL , NULL , NULL ) ; <nl> } <nl> <nl> void register_cocos2dx_js_core ( JSContext * cx , JS : : HandleObject global ) <nl> get_or_create_js_obj ( cx , global , " jsb " , & jsbObj ) ; <nl> <nl> / / Memory management related <nl> - jsb_register_FinalizeHook ( cx , jsbObj ) ; <nl> + jsb_register_RefFinalizeHook ( cx , jsbObj ) ; <nl> + jsb_register_ObjFinalizeHook ( cx , jsbObj ) ; <nl> <nl> js_register_cocos2dx_PolygonInfo ( cx , jsbObj ) ; <nl> js_register_cocos2dx_AutoPolygon ( cx , jsbObj ) ; <nl> mmm a / cocos / scripting / js - bindings / manual / cocos2d_specifics . hpp <nl> ppp b / cocos / scripting / js - bindings / manual / cocos2d_specifics . hpp <nl> extern schedFunc_proxy_t * _schedFunc_target_ht ; <nl> extern schedTarget_proxy_t * _schedObj_target_ht ; <nl> extern callfuncTarget_proxy_t * _callfuncTarget_native_ht ; <nl> <nl> - extern JSClass * jsb_FinalizeHook_class ; <nl> - extern JSObject * jsb_FinalizeHook_prototype ; <nl> + extern JSClass * jsb_RefFinalizeHook_class ; <nl> + extern JSObject * jsb_RefFinalizeHook_prototype ; <nl> + extern JSClass * jsb_ObjFinalizeHook_class ; <nl> + extern JSObject * jsb_ObjFinalizeHook_prototype ; <nl> <nl> / * * <nl> * You don ' t need to manage the returned pointer . They live for the whole life of <nl> JSObject * js_get_or_create_jsobject ( JSContext * cx , typename std : : enable_if < std : : <nl> * In the finalize function , it mainly remove native / js proxys , release / delete the native object . <nl> * IMPORTANT : For Ref objects , please remember to retain the native object to correctly manage its reference count . <nl> * / <nl> - void js_add_FinalizeHook ( JSContext * cx , JS : : HandleObject target ) ; <nl> + void js_add_FinalizeHook ( JSContext * cx , JS : : HandleObject target , bool isRef = true ) ; <nl> <nl> void js_add_object_reference ( JS : : HandleValue owner , JS : : HandleValue target ) ; <nl> void js_remove_object_reference ( JS : : HandleValue owner , JS : : HandleValue target ) ; <nl> class JSCallbackWrapper : public cocos2d : : Ref { <nl> JS : : Heap < JS : : Value > _jsCallback ; <nl> JS : : Heap < JS : : Value > _jsThisObj ; <nl> JS : : Heap < JS : : Value > _extraData ; <nl> + bool _rooted ; <nl> } ; <nl> <nl> <nl> mmm a / cocos / scripting / js - bindings / manual / jsb_event_dispatcher_manual . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / jsb_event_dispatcher_manual . cpp <nl> bool js_EventListenerAcceleration_create ( JSContext * cx , uint32_t argc , jsval * vp <nl> largv [ 0 ] = ccacceleration_to_jsval ( cx , * acc ) ; <nl> if ( event ) { <nl> js_type_class_t * typeClassEvent = js_get_type_from_native < Event > ( event ) ; <nl> - largv [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( cx , event , typeClassEvent , " cocos2d : : EventAcceleration " ) ) ; <nl> + largv [ 1 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( cx , event , typeClassEvent ) ) ; <nl> } else { <nl> largv [ 1 ] = JSVAL_NULL ; <nl> } ; <nl> bool js_EventListenerCustom_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> jsval largv [ 1 ] ; <nl> if ( event ) { <nl> js_type_class_t * typeClassEvent = js_get_type_from_native < EventCustom > ( event ) ; <nl> - largv [ 0 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( cx , event , typeClassEvent , " cocos2d : : EventCustom " ) ) ; <nl> + largv [ 0 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( cx , event , typeClassEvent ) ) ; <nl> } else { <nl> largv [ 0 ] = JSVAL_NULL ; <nl> } ; <nl> bool js_EventDispatcher_addCustomEventListener ( JSContext * cx , uint32_t argc , jsv <nl> jsval largv [ 1 ] ; <nl> if ( event ) { <nl> js_type_class_t * typeClassEvent = js_get_type_from_native < EventCustom > ( event ) ; <nl> - largv [ 0 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( cx , event , typeClassEvent , " cocos2d : : EventCustom " ) ) ; <nl> + largv [ 0 ] = OBJECT_TO_JSVAL ( jsb_get_or_create_weak_jsobject ( cx , event , typeClassEvent ) ) ; <nl> } else { <nl> largv [ 0 ] = JSVAL_NULL ; <nl> } ; <nl> mmm a / cocos / scripting / js - bindings / manual / network / XMLHTTPRequest . cpp <nl> ppp b / cocos / scripting / js - bindings / manual / network / XMLHTTPRequest . cpp <nl> JS_BINDED_CONSTRUCTOR_IMPL ( MinXmlHttpRequest ) <nl> js_proxy_t * p = jsb_new_proxy ( req , obj ) ; <nl> <nl> # if CC_ENABLE_GC_FOR_NATIVE_OBJECTS <nl> - js_add_FinalizeHook ( cx , obj ) ; <nl> + js_add_FinalizeHook ( cx , obj , true ) ; <nl> / / don ' t retain it , already retained <nl> # if COCOS2D_DEBUG > 1 <nl> CCLOG ( " ppppppRETAINEDpppppp Cpp ( XMLHttpRequest ) : % p - JS : % p " , req , obj . get ( ) ) ; <nl>
Separate FinalizeHook for ref objects and non ref objects
cocos2d/cocos2d-x
2b6e84e9a2d1e55dba1b0fbc2f46dd062becbd43
2016-12-19T03:50:32Z
mmm a / src / mongo / db / catalog / collection_catalog . cpp <nl> ppp b / src / mongo / db / catalog / collection_catalog . cpp <nl> boost : : optional < CollectionUUID > CollectionCatalog : : lookupUUIDByNSS ( <nl> } <nl> <nl> stdx : : lock_guard < Latch > lock ( _catalogLock ) ; <nl> - auto minUuid = UUID : : parse ( " 00000000 - 0000 - 0000 - 0000 - 000000000000 " ) . getValue ( ) ; <nl> - auto it = _orderedCollections . lower_bound ( std : : make_pair ( nss . db ( ) . toString ( ) , minUuid ) ) ; <nl> - <nl> - / / The entry _mapIter points to is valid if it ' s not at the end of _orderedCollections and <nl> - / / the entry ' s database is the same as dbName . <nl> - while ( it ! = _orderedCollections . end ( ) & & it - > first . first = = nss . db ( ) ) { <nl> - if ( it - > second - > ns ( ) = = nss ) { <nl> - return it - > first . second ; <nl> - } <nl> - + + it ; <nl> + auto it = _collections . find ( nss ) ; <nl> + if ( it ! = _collections . end ( ) ) { <nl> + return it - > second - > uuid ( ) ; <nl> } <nl> return boost : : none ; <nl> } <nl> mmm a / src / mongo / db / catalog / collection_catalog . h <nl> ppp b / src / mongo / db / catalog / collection_catalog . h <nl> class CollectionCatalog { <nl> CollectionUUID uuid ) const ; <nl> <nl> / * * <nl> - * Returns the UUID if ` nss ` exists in CollectionCatalog . The time complexity of <nl> - * this function is linear to the number of collections in ` nss . db ( ) ` . <nl> + * Returns the UUID if ` nss ` exists in CollectionCatalog . <nl> * / <nl> boost : : optional < CollectionUUID > lookupUUIDByNSS ( OperationContext * opCtx , <nl> const NamespaceString & nss ) const ; <nl>
SERVER - 42785 Make lookupUUIDByNSS constant time
mongodb/mongo
e756abbdb444c8f10ab40b3735cc02ba5ce90c3c
2019-12-09T22:14:44Z
mmm a / CHANGELOG <nl> ppp b / CHANGELOG <nl> <nl> v1 . 5 . x ( XXXX - XX - XX ) <nl> mmmmmmmmmmmmmmmmmm - <nl> <nl> + * added more detailed request statistics <nl> + <nl> + This adds the number of async - executed HTTP requests plus the number of HTTP <nl> + requests per individual HTTP method type . <nl> + <nl> * fixed issue # 650 : Randonmess of any ( ) should be improved <nl> <nl> * made AQL ` DOCUMENT ( ) ` function polymorphic and work with just one parameter . <nl> mmm a / js / actions / api - system . js <nl> ppp b / js / actions / api - system . js <nl> actions . defineHttp ( { <nl> / / / - ` group ` : The identifier of the group to which this figure belongs . <nl> / / / - ` identifier ` : The identifier of the figure . It is unique within the group . <nl> / / / - ` name ` : The name of the figure . <nl> - / / / - ` description ` : A description of the group . <nl> + / / / - ` description ` : A description of the figure . <nl> / / / - ` type ` : Either ` current ` , ` accumulated ` , or ` distribution ` . <nl> / / / - ` cuts ` : The distribution vector . <nl> / / / - ` units ` : Units in which the figure is measured . <nl> actions . defineHttp ( { <nl> <nl> { <nl> group : " client " , <nl> - name : " Client Statistics " , <nl> - description : " Statistics about the clients connecting to the server . " <nl> + name : " Client and Request Statistics " , <nl> + description : " Statistics about the HTTP requests and clients connecting . " <nl> } , <nl> - <nl> + <nl> { <nl> group : " server " , <nl> name : " Server Statistics " , <nl> actions . defineHttp ( { <nl> cuts : internal . requestTimeDistribution , <nl> units : " seconds " <nl> } , <nl> - <nl> + <nl> { <nl> group : " client " , <nl> identifier : " bytesSent " , <nl> actions . defineHttp ( { <nl> cuts : internal . connectionTimeDistribution , <nl> units : " seconds " <nl> } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsTotal " , <nl> + name : " Total requests " , <nl> + description : " Total number of HTTP requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsAsync " , <nl> + name : " Async requests " , <nl> + description : " Number of asynchronously executed HTTP requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsGet " , <nl> + name : " HTTP GET requests " , <nl> + description : " Number of HTTP GET requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsHead " , <nl> + name : " HTTP HEAD requests " , <nl> + description : " Number of HTTP HEAD requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsPost " , <nl> + name : " HTTP POST requests " , <nl> + description : " Number of HTTP POST requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsPut " , <nl> + name : " HTTP PUT requests " , <nl> + description : " Number of HTTP PUT requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsPatch " , <nl> + name : " HTTP PATCH requests " , <nl> + description : " Number of HTTP PATCH requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsDelete " , <nl> + name : " HTTP DELETE requests " , <nl> + description : " Number of HTTP DELETE requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> + <nl> + { <nl> + group : " client " , <nl> + identifier : " requestsOptions " , <nl> + name : " HTTP OPTIONS requests " , <nl> + description : " Number of HTTP OPTIONS requests . " , <nl> + type : " accumulated " , <nl> + units : " number " <nl> + } , <nl> <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> / / server statistics <nl> mmm a / lib / HttpServer / HttpCommTask . h <nl> ppp b / lib / HttpServer / HttpCommTask . h <nl> namespace triagens { <nl> / / ( original request object gets deleted before responding ) <nl> this - > _requestType = this - > _request - > requestType ( ) ; <nl> <nl> + # ifdef TRI_ENABLE_FIGURES <nl> + <nl> + RequestStatisticsAgentSetRequestType ( this , this - > _requestType ) ; <nl> + # endif <nl> <nl> / / handle different HTTP methods <nl> switch ( this - > _requestType ) { <nl> namespace triagens { <nl> this - > resetState ( ) ; <nl> } <nl> else { <nl> - this - > RequestStatisticsAgent : : transfer ( handler ) ; <nl> - <nl> bool found ; <nl> string const & acceptEncoding = this - > _request - > header ( " accept - encoding " , found ) ; <nl> if ( found ) { <nl> namespace triagens { <nl> <nl> / / check for an async request <nl> string const & asyncExecution = this - > _request - > header ( " x - arango - async " , found ) ; <nl> + <nl> if ( found & & ( asyncExecution = = " true " | | asyncExecution = = " store " ) ) { <nl> / / we have an async request <nl> + <nl> + # ifdef TRI_ENABLE_FIGURES <nl> + <nl> + RequestStatisticsAgentSetAsync ( this ) ; <nl> + # endif <nl> + <nl> + this - > RequestStatisticsAgent : : transfer ( handler ) ; <nl> + <nl> this - > _request = 0 ; <nl> <nl> uint64_t jobId = 0 ; <nl> namespace triagens { <nl> } <nl> else { <nl> / / synchronous request <nl> + this - > RequestStatisticsAgent : : transfer ( handler ) ; <nl> + <nl> this - > _request = 0 ; <nl> <nl> ok = this - > _server - > handleRequest ( this , handler ) ; <nl> mmm a / lib / Statistics / StatisticsAgent . h <nl> ppp b / lib / Statistics / StatisticsAgent . h <nl> namespace triagens { <nl> } <nl> } <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief sets the request type <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + # ifdef TRI_ENABLE_FIGURES <nl> + <nl> + # define RequestStatisticsAgentSetRequestType ( a , b ) \ <nl> + do { \ <nl> + if ( TRI_ENABLE_STATISTICS ) { \ <nl> + if ( ( a ) - > RequestStatisticsAgent : : _statistics ! = 0 ) { \ <nl> + ( a ) - > RequestStatisticsAgent : : _statistics - > _requestType = b ; \ <nl> + } \ <nl> + } \ <nl> + } \ <nl> + while ( 0 ) <nl> + <nl> + # else <nl> + <nl> + # define RequestStatisticsAgentSetRequestType ( a , b ) while ( 0 ) <nl> + <nl> + # endif <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief sets the async flag <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + # ifdef TRI_ENABLE_FIGURES <nl> + <nl> + # define RequestStatisticsAgentSetAsync ( a ) \ <nl> + do { \ <nl> + if ( TRI_ENABLE_STATISTICS ) { \ <nl> + if ( ( a ) - > RequestStatisticsAgent : : _statistics ! = 0 ) { \ <nl> + ( a ) - > RequestStatisticsAgent : : _statistics - > _async = true ; \ <nl> + } \ <nl> + } \ <nl> + } \ <nl> + while ( 0 ) <nl> + <nl> + # else <nl> + <nl> + # define RequestStatisticsAgentSetAsync ( a ) while ( 0 ) <nl> + <nl> + # endif <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief sets the read start <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / lib / Statistics / statistics . cpp <nl> ppp b / lib / Statistics / statistics . cpp <nl> TRI_request_statistics_t * TRI_AcquireRequestStatistics ( ) { <nl> void TRI_ReleaseRequestStatistics ( TRI_request_statistics_t * statistics ) { <nl> STATISTICS_LOCK ( & RequestListLock ) ; <nl> <nl> + TotalRequests . incCounter ( ) ; <nl> + if ( statistics - > _async ) { <nl> + AsyncRequests . incCounter ( ) ; <nl> + } <nl> + <nl> + MethodRequests [ ( int ) statistics - > _requestType ] . incCounter ( ) ; <nl> + <nl> / / check the request was completely received and transmitted <nl> if ( statistics - > _readStart ! = 0 . 0 & & statistics - > _writeEnd ! = 0 . 0 ) { <nl> double totalTime = statistics - > _writeEnd - statistics - > _readStart ; <nl> void TRI_ReleaseRequestStatistics ( TRI_request_statistics_t * statistics ) { <nl> <nl> / / clear statistics and put back an the free list <nl> memset ( statistics , 0 , sizeof ( TRI_request_statistics_t ) ) ; <nl> + statistics - > _requestType = triagens : : rest : : HttpRequest : : HTTP_REQUEST_ILLEGAL ; <nl> <nl> if ( RequestFreeList . _first = = NULL ) { <nl> RequestFreeList . _first = ( TRI_statistics_entry_t * ) statistics ; <nl> void TRI_ReleaseConnectionStatistics ( TRI_connection_statistics_t * statistics ) { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> void TRI_FillConnectionStatistics ( StatisticsCounter & httpConnections , <nl> + StatisticsCounter & totalRequests , <nl> + vector < StatisticsCounter > & methodRequests , <nl> + StatisticsCounter & asyncRequests , <nl> StatisticsDistribution & connectionTime ) { <nl> STATISTICS_LOCK ( & ConnectionListLock ) ; <nl> <nl> httpConnections = HttpConnections ; <nl> - connectionTime = * ConnectionTimeDistribution ; <nl> + totalRequests = TotalRequests ; <nl> + methodRequests = MethodRequests ; <nl> + asyncRequests = AsyncRequests ; <nl> + connectionTime = * ConnectionTimeDistribution ; <nl> <nl> STATISTICS_UNLOCK ( & ConnectionListLock ) ; <nl> } <nl> void TRI_DestroyStatisticsList ( TRI_statistics_list_t * list ) { <nl> bool TRI_ENABLE_STATISTICS = true ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief number of http conntections <nl> + / / / @ brief number of http connections <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> StatisticsCounter HttpConnections ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief total number of requests <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + StatisticsCounter TotalRequests ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief number of requests by HTTP method <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + std : : vector < StatisticsCounter > MethodRequests ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief number of async requests <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + StatisticsCounter AsyncRequests ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief connection time distribution vector <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> void TRI_InitialiseStatistics ( ) { <nl> BytesSentDistribution = new StatisticsDistribution ( BytesSentDistributionVector ) ; <nl> BytesReceivedDistribution = new StatisticsDistribution ( BytesReceivedDistributionVector ) ; <nl> <nl> + / / initialise counters for all HTTP request types <nl> + MethodRequests . clear ( ) ; <nl> + <nl> + for ( int i = 0 ; i < ( ( int ) triagens : : rest : : HttpRequest : : HTTP_REQUEST_ILLEGAL ) + 1 ; + + i ) { <nl> + StatisticsCounter c ; <nl> + MethodRequests . push_back ( c ) ; <nl> + } <nl> + <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> / / generate the request statistics queue <nl> / / . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <nl> mmm a / lib / Statistics / statistics . h <nl> ppp b / lib / Statistics / statistics . h <nl> <nl> # define TRIAGENS_STATISTICS_STATISTICS_H 1 <nl> <nl> # include " BasicsC / common . h " <nl> + # include " Basics / Common . h " <nl> + # include " Rest / HttpRequest . h " <nl> # include " Statistics / figures . h " <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> TRI_statistics_list_t ; <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> typedef struct TRI_request_statistics_s { <nl> - void * _next ; <nl> - <nl> - double _readStart ; <nl> - double _readEnd ; <nl> - double _queueStart ; <nl> - double _queueEnd ; <nl> - double _requestStart ; <nl> - double _requestEnd ; <nl> - double _writeStart ; <nl> - double _writeEnd ; <nl> - <nl> - double _receivedBytes ; <nl> - double _sentBytes ; <nl> - <nl> - bool _tooLarge ; <nl> - bool _executeError ; <nl> + void * _next ; <nl> + <nl> + double _readStart ; <nl> + double _readEnd ; <nl> + double _queueStart ; <nl> + double _queueEnd ; <nl> + double _requestStart ; <nl> + double _requestEnd ; <nl> + double _writeStart ; <nl> + double _writeEnd ; <nl> + <nl> + double _receivedBytes ; <nl> + double _sentBytes ; <nl> + <nl> + triagens : : rest : : HttpRequest : : HttpRequestType _requestType ; <nl> + <nl> + bool _async ; <nl> + bool _tooLarge ; <nl> + bool _executeError ; <nl> } <nl> TRI_request_statistics_t ; <nl> <nl> TRI_request_statistics_t ; <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> typedef struct TRI_connection_statistics_s { <nl> - void * _next ; <nl> - <nl> - bool _http ; <nl> + void * _next ; <nl> <nl> double _connStart ; <nl> double _connEnd ; <nl> <nl> - bool _error ; <nl> + bool _http ; <nl> + bool _error ; <nl> } <nl> TRI_connection_statistics_t ; <nl> <nl> void TRI_ReleaseConnectionStatistics ( TRI_connection_statistics_t * ) ; <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> void TRI_FillConnectionStatistics ( triagens : : basics : : StatisticsCounter & httpConnections , <nl> + triagens : : basics : : StatisticsCounter & totalRequests , <nl> + std : : vector < triagens : : basics : : StatisticsCounter > & methodRequests , <nl> + triagens : : basics : : StatisticsCounter & asyncRequests , <nl> triagens : : basics : : StatisticsDistribution & connectionTime ) ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> TRI_server_statistics_t TRI_GetServerStatistics ( ) ; <nl> extern bool TRI_ENABLE_STATISTICS ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief number of http conntections <nl> + / / / @ brief number of http connections <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> extern triagens : : basics : : StatisticsCounter HttpConnections ; <nl> <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief total number of requests <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + extern triagens : : basics : : StatisticsCounter TotalRequests ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief number of requests by HTTP method <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + extern std : : vector < triagens : : basics : : StatisticsCounter > MethodRequests ; <nl> + <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + / / / @ brief number of async requests <nl> + / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> + <nl> + extern triagens : : basics : : StatisticsCounter AsyncRequests ; <nl> + <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief connection time distribution vector <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> mmm a / lib / V8 / v8 - utils . cpp <nl> ppp b / lib / V8 / v8 - utils . cpp <nl> static v8 : : Handle < v8 : : Value > JS_RequestStatistics ( v8 : : Arguments const & argv ) { <nl> v8 : : Handle < v8 : : Object > result = v8 : : Object : : New ( ) ; <nl> <nl> StatisticsCounter httpConnections ; <nl> + StatisticsCounter totalRequests ; <nl> + vector < StatisticsCounter > methodRequests ; <nl> + StatisticsCounter asyncRequests ; <nl> StatisticsDistribution connectionTime ; <nl> <nl> - TRI_FillConnectionStatistics ( httpConnections , connectionTime ) ; <nl> + TRI_FillConnectionStatistics ( httpConnections , totalRequests , methodRequests , asyncRequests , connectionTime ) ; <nl> <nl> result - > Set ( v8 : : String : : New ( " httpConnections " ) , v8 : : Number : : New ( httpConnections . _count ) ) ; <nl> FillDistribution ( result , " connectionTime " , connectionTime ) ; <nl> static v8 : : Handle < v8 : : Value > JS_RequestStatistics ( v8 : : Arguments const & argv ) { <nl> FillDistribution ( result , " bytesSent " , bytesSent ) ; <nl> FillDistribution ( result , " bytesReceived " , bytesReceived ) ; <nl> <nl> + / / request counters <nl> + result - > Set ( v8 : : String : : New ( " requestsTotal " ) , v8 : : Number : : New ( totalRequests . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsAsync " ) , v8 : : Number : : New ( asyncRequests . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsGet " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_GET ] . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsHead " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_HEAD ] . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsPost " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_POST ] . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsPut " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_PUT ] . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsPatch " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_PATCH ] . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsDelete " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_DELETE ] . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsOptions " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_OPTIONS ] . _count ) ) ; <nl> + result - > Set ( v8 : : String : : New ( " requestsOther " ) , v8 : : Number : : New ( methodRequests [ ( int ) HttpRequest : : HTTP_REQUEST_ILLEGAL ] . _count ) ) ; <nl> + <nl> return scope . Close ( result ) ; <nl> } <nl> <nl>
added detailed HTTP request statistics
arangodb/arangodb
e1382dd255fc2228473612dfe9316863ec33d83d
2013-10-31T15:39:59Z
mmm a / src / core / arm / dyncom / arm_dyncom_interpreter . cpp <nl> ppp b / src / core / arm / dyncom / arm_dyncom_interpreter . cpp <nl> ARM_INST_PTR INTERPRETER_TRANSLATE ( blx_1_thumb ) ( unsigned int tinst , int index ) <nl> return inst_base ; <nl> } <nl> <nl> - ARM_INST_PTR INTERPRETER_TRANSLATE ( uqadd16 ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " UQADD16 " ) ; } <nl> - ARM_INST_PTR INTERPRETER_TRANSLATE ( uqadd8 ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " UQADD8 " ) ; } <nl> - ARM_INST_PTR INTERPRETER_TRANSLATE ( uqaddsubx ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " UQADDSUBX " ) ; } <nl> - ARM_INST_PTR INTERPRETER_TRANSLATE ( uqsub16 ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " UQSUB16 " ) ; } <nl> - ARM_INST_PTR INTERPRETER_TRANSLATE ( uqsub8 ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " UQSUB8 " ) ; } <nl> - ARM_INST_PTR INTERPRETER_TRANSLATE ( uqsubaddx ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " UQSUBADDX " ) ; } <nl> + ARM_INST_PTR INTERPRETER_TRANSLATE ( uqadd8 ) ( unsigned int inst , int index ) <nl> + { <nl> + arm_inst * const inst_base = ( arm_inst * ) AllocBuffer ( sizeof ( arm_inst ) + sizeof ( generic_arm_inst ) ) ; <nl> + generic_arm_inst * const inst_cream = ( generic_arm_inst * ) inst_base - > component ; <nl> + <nl> + inst_base - > cond = BITS ( inst , 28 , 31 ) ; <nl> + inst_base - > idx = index ; <nl> + inst_base - > br = NON_BRANCH ; <nl> + inst_base - > load_r15 = 0 ; <nl> + <nl> + inst_cream - > Rm = BITS ( inst , 0 , 3 ) ; <nl> + inst_cream - > Rn = BITS ( inst , 16 , 19 ) ; <nl> + inst_cream - > Rd = BITS ( inst , 12 , 15 ) ; <nl> + inst_cream - > op1 = BITS ( inst , 20 , 21 ) ; <nl> + inst_cream - > op2 = BITS ( inst , 5 , 7 ) ; <nl> + <nl> + return inst_base ; <nl> + } <nl> + ARM_INST_PTR INTERPRETER_TRANSLATE ( uqadd16 ) ( unsigned int inst , int index ) <nl> + { <nl> + return INTERPRETER_TRANSLATE ( uqadd8 ) ( inst , index ) ; <nl> + } <nl> + ARM_INST_PTR INTERPRETER_TRANSLATE ( uqaddsubx ) ( unsigned int inst , int index ) <nl> + { <nl> + return INTERPRETER_TRANSLATE ( uqadd8 ) ( inst , index ) ; <nl> + } <nl> + ARM_INST_PTR INTERPRETER_TRANSLATE ( uqsub8 ) ( unsigned int inst , int index ) <nl> + { <nl> + return INTERPRETER_TRANSLATE ( uqadd8 ) ( inst , index ) ; <nl> + } <nl> + ARM_INST_PTR INTERPRETER_TRANSLATE ( uqsub16 ) ( unsigned int inst , int index ) <nl> + { <nl> + return INTERPRETER_TRANSLATE ( uqadd8 ) ( inst , index ) ; <nl> + } <nl> + ARM_INST_PTR INTERPRETER_TRANSLATE ( uqsubaddx ) ( unsigned int inst , int index ) <nl> + { <nl> + return INTERPRETER_TRANSLATE ( uqadd8 ) ( inst , index ) ; <nl> + } <nl> ARM_INST_PTR INTERPRETER_TRANSLATE ( usad8 ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " USAD8 " ) ; } <nl> ARM_INST_PTR INTERPRETER_TRANSLATE ( usada8 ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " USADA8 " ) ; } <nl> ARM_INST_PTR INTERPRETER_TRANSLATE ( usat ) ( unsigned int inst , int index ) { UNIMPLEMENTED_INSTRUCTION ( " USAT " ) ; } <nl> unsigned InterpreterMainLoop ( ARMul_State * state ) <nl> goto DISPATCH ; <nl> } <nl> <nl> - UQADD16_INST : <nl> UQADD8_INST : <nl> + UQADD16_INST : <nl> UQADDSUBX_INST : <nl> - UQSUB16_INST : <nl> UQSUB8_INST : <nl> + UQSUB16_INST : <nl> UQSUBADDX_INST : <nl> + { <nl> + INC_ICOUNTER ; <nl> + <nl> + if ( inst_base - > cond = = 0xE | | CondPassed ( cpu , inst_base - > cond ) ) { <nl> + generic_arm_inst * const inst_cream = ( generic_arm_inst * ) inst_base - > component ; <nl> + <nl> + const u8 op2 = inst_cream - > op2 ; <nl> + const u32 rm_val = RM ; <nl> + const u32 rn_val = RN ; <nl> + <nl> + u16 lo_val = 0 ; <nl> + u16 hi_val = 0 ; <nl> + <nl> + / / UQADD16 <nl> + if ( op2 = = 0x00 ) { <nl> + lo_val = ARMul_UnsignedSaturatedAdd16 ( rn_val & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedAdd16 ( ( rn_val > > 16 ) & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + } <nl> + / / UQASX <nl> + else if ( op2 = = 0x01 ) { <nl> + lo_val = ARMul_UnsignedSaturatedSub16 ( rn_val & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedAdd16 ( ( rn_val > > 16 ) & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + } <nl> + / / UQSAX <nl> + else if ( op2 = = 0x02 ) { <nl> + lo_val = ARMul_UnsignedSaturatedAdd16 ( rn_val & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedSub16 ( ( rn_val > > 16 ) & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + } <nl> + / / UQSUB16 <nl> + else if ( op2 = = 0x03 ) { <nl> + lo_val = ARMul_UnsignedSaturatedSub16 ( rn_val & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedSub16 ( ( rn_val > > 16 ) & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + } <nl> + / / UQADD8 <nl> + else if ( op2 = = 0x04 ) { <nl> + lo_val = ARMul_UnsignedSaturatedAdd8 ( rn_val , rm_val ) | <nl> + ARMul_UnsignedSaturatedAdd8 ( rn_val > > 8 , rm_val > > 8 ) < < 8 ; <nl> + hi_val = ARMul_UnsignedSaturatedAdd8 ( rn_val > > 16 , rm_val > > 16 ) | <nl> + ARMul_UnsignedSaturatedAdd8 ( rn_val > > 24 , rm_val > > 24 ) < < 8 ; <nl> + } <nl> + / / UQSUB8 <nl> + else { <nl> + lo_val = ARMul_UnsignedSaturatedSub8 ( rn_val , rm_val ) | <nl> + ARMul_UnsignedSaturatedSub8 ( rn_val > > 8 , rm_val > > 8 ) < < 8 ; <nl> + hi_val = ARMul_UnsignedSaturatedSub8 ( rn_val > > 16 , rm_val > > 16 ) | <nl> + ARMul_UnsignedSaturatedSub8 ( rn_val > > 24 , rm_val > > 24 ) < < 8 ; <nl> + } <nl> + <nl> + RD = ( ( lo_val & 0xFFFF ) | hi_val < < 16 ) ; <nl> + } <nl> + <nl> + cpu - > Reg [ 15 ] + = GET_INST_SIZE ( cpu ) ; <nl> + INC_PC ( sizeof ( generic_arm_inst ) ) ; <nl> + FETCH_INST ; <nl> + GOTO_NEXT_INST ; <nl> + } <nl> + <nl> USAD8_INST : <nl> USADA8_INST : <nl> USAT_INST : <nl> mmm a / src / core / arm / interpreter / armemu . cpp <nl> ppp b / src / core / arm / interpreter / armemu . cpp <nl> ARMul_Emulate26 ( ARMul_State * state ) <nl> } <nl> printf ( " Unhandled v6 insn : uasx / usax \ n " ) ; <nl> break ; <nl> - case 0x66 : <nl> - if ( ( instr & 0x0FF00FF0 ) = = 0x06600FF0 ) { / / uqsub8 <nl> - u32 rd = ( instr > > 12 ) & 0xF ; <nl> - u32 rm = ( instr > > 16 ) & 0xF ; <nl> - u32 rn = ( instr > > 0 ) & 0xF ; <nl> - u32 subfrom = state - > Reg [ rm ] ; <nl> - u32 tosub = state - > Reg [ rn ] ; <nl> - <nl> - u8 b1 = ( u8 ) ( ( u8 ) ( subfrom ) - ( u8 ) ( tosub ) ) ; <nl> - if ( b1 > ( u8 ) ( subfrom ) ) b1 = 0 ; <nl> - u8 b2 = ( u8 ) ( ( u8 ) ( subfrom > > 8 ) - ( u8 ) ( tosub > > 8 ) ) ; <nl> - if ( b2 > ( u8 ) ( subfrom > > 8 ) ) b2 = 0 ; <nl> - u8 b3 = ( u8 ) ( ( u8 ) ( subfrom > > 16 ) - ( u8 ) ( tosub > > 16 ) ) ; <nl> - if ( b3 > ( u8 ) ( subfrom > > 16 ) ) b3 = 0 ; <nl> - u8 b4 = ( u8 ) ( ( u8 ) ( subfrom > > 24 ) - ( u8 ) ( tosub > > 24 ) ) ; <nl> - if ( b4 > ( u8 ) ( subfrom > > 24 ) ) b4 = 0 ; <nl> - state - > Reg [ rd ] = ( u32 ) ( b1 | b2 < < 8 | b3 < < 16 | b4 < < 24 ) ; <nl> + case 0x66 : / / UQADD16 , UQASX , UQSAX , UQSUB16 , UQADD8 , and UQSUB8 <nl> + { <nl> + const u8 rd_idx = BITS ( 12 , 15 ) ; <nl> + const u8 rm_idx = BITS ( 0 , 3 ) ; <nl> + const u8 rn_idx = BITS ( 16 , 19 ) ; <nl> + const u8 op2 = BITS ( 5 , 7 ) ; <nl> + const u32 rm_val = state - > Reg [ rm_idx ] ; <nl> + const u32 rn_val = state - > Reg [ rn_idx ] ; <nl> + <nl> + u16 lo_val = 0 ; <nl> + u16 hi_val = 0 ; <nl> + <nl> + / / UQADD16 <nl> + if ( op2 = = 0x00 ) { <nl> + lo_val = ARMul_UnsignedSaturatedAdd16 ( rn_val & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedAdd16 ( ( rn_val > > 16 ) & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + } <nl> + / / UQASX <nl> + else if ( op2 = = 0x01 ) { <nl> + lo_val = ARMul_UnsignedSaturatedSub16 ( rn_val & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedAdd16 ( ( rn_val > > 16 ) & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + } <nl> + / / UQSAX <nl> + else if ( op2 = = 0x02 ) { <nl> + lo_val = ARMul_UnsignedSaturatedAdd16 ( rn_val & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedSub16 ( ( rn_val > > 16 ) & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + } <nl> + / / UQSUB16 <nl> + else if ( op2 = = 0x03 ) { <nl> + lo_val = ARMul_UnsignedSaturatedSub16 ( rn_val & 0xFFFF , rm_val & 0xFFFF ) ; <nl> + hi_val = ARMul_UnsignedSaturatedSub16 ( ( rn_val > > 16 ) & 0xFFFF , ( rm_val > > 16 ) & 0xFFFF ) ; <nl> + } <nl> + / / UQADD8 <nl> + else if ( op2 = = 0x04 ) { <nl> + lo_val = ARMul_UnsignedSaturatedAdd8 ( rn_val , rm_val ) | <nl> + ARMul_UnsignedSaturatedAdd8 ( rn_val > > 8 , rm_val > > 8 ) < < 8 ; <nl> + hi_val = ARMul_UnsignedSaturatedAdd8 ( rn_val > > 16 , rm_val > > 16 ) | <nl> + ARMul_UnsignedSaturatedAdd8 ( rn_val > > 24 , rm_val > > 24 ) < < 8 ; <nl> + } <nl> + / / UQSUB8 <nl> + else { <nl> + lo_val = ARMul_UnsignedSaturatedSub8 ( rn_val , rm_val ) | <nl> + ARMul_UnsignedSaturatedSub8 ( rn_val > > 8 , rm_val > > 8 ) < < 8 ; <nl> + hi_val = ARMul_UnsignedSaturatedSub8 ( rn_val > > 16 , rm_val > > 16 ) | <nl> + ARMul_UnsignedSaturatedSub8 ( rn_val > > 24 , rm_val > > 24 ) < < 8 ; <nl> + } <nl> + <nl> + state - > Reg [ rd_idx ] = ( ( lo_val & 0xFFFF ) | hi_val < < 16 ) ; <nl> return 1 ; <nl> - } else { <nl> - printf ( " Unhandled v6 insn : uqsub16 \ n " ) ; <nl> } <nl> break ; <nl> case 0x67 : / / UHADD16 , UHASX , UHSAX , UHSUB16 , UHADD8 , and UHSUB8 . <nl> mmm a / src / core / arm / interpreter / armsupp . cpp <nl> ppp b / src / core / arm / interpreter / armsupp . cpp <nl> ARMul_SubOverflow ( ARMul_State * state , ARMword a , ARMword b , ARMword result ) <nl> ASSIGNV ( SubOverflow ( a , b , result ) ) ; <nl> } <nl> <nl> + / * 8 - bit unsigned saturated addition * / <nl> + u8 ARMul_UnsignedSaturatedAdd8 ( u8 left , u8 right ) <nl> + { <nl> + u8 result = left + right ; <nl> + <nl> + if ( result < left ) <nl> + result = 0xFF ; <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + / * 16 - bit unsigned saturated addition * / <nl> + u16 ARMul_UnsignedSaturatedAdd16 ( u16 left , u16 right ) <nl> + { <nl> + u16 result = left + right ; <nl> + <nl> + if ( result < left ) <nl> + result = 0xFFFF ; <nl> + <nl> + return result ; <nl> + } <nl> + <nl> + / * 8 - bit unsigned saturated subtraction * / <nl> + u8 ARMul_UnsignedSaturatedSub8 ( u8 left , u8 right ) <nl> + { <nl> + if ( left < = right ) <nl> + return 0 ; <nl> + <nl> + return left - right ; <nl> + } <nl> + <nl> + / * 16 - bit unsigned saturated subtraction * / <nl> + u16 ARMul_UnsignedSaturatedSub16 ( u16 left , u16 right ) <nl> + { <nl> + if ( left < = right ) <nl> + return 0 ; <nl> + <nl> + return left - right ; <nl> + } <nl> + <nl> + <nl> / * This function does the work of generating the addresses used in an <nl> LDC instruction . The code here is always post - indexed , it ' s up to the <nl> caller to get the input address correct and to handle base register <nl> mmm a / src / core / arm / skyeye_common / armdefs . h <nl> ppp b / src / core / arm / skyeye_common / armdefs . h <nl> extern void ARMul_FixSPSR ( ARMul_State * , ARMword , ARMword ) ; <nl> extern void ARMul_ConsolePrint ( ARMul_State * , const char * , . . . ) ; <nl> extern void ARMul_SelectProcessor ( ARMul_State * , unsigned ) ; <nl> <nl> + extern u8 ARMul_UnsignedSaturatedAdd8 ( u8 , u8 ) ; <nl> + extern u16 ARMul_UnsignedSaturatedAdd16 ( u16 , u16 ) ; <nl> + extern u8 ARMul_UnsignedSaturatedSub8 ( u8 , u8 ) ; <nl> + extern u16 ARMul_UnsignedSaturatedSub16 ( u16 , u16 ) ; <nl> + <nl> # define DIFF_LOG 0 <nl> # define SAVE_LOG 0 <nl> <nl>
Merge pull request from lioncash / qops
yuzu-emu/yuzu
3422d81f053578e2a6806dc9ffa33c50f2c0b66d
2014-12-28T02:15:13Z
mmm a / modules / planning / common / planning_gflags . cc <nl> ppp b / modules / planning / common / planning_gflags . cc <nl> DEFINE_bool ( enable_nonscenario_side_pass , false , <nl> DEFINE_bool ( enable_soft_speed_limit , false , <nl> " True to set soft speed limit guided by path optimization result " ) ; <nl> <nl> + DEFINE_bool ( enable_dp_reference_speed , false , <nl> + " True to penalize dp result towards default cruise speed " ) ; <nl> + <nl> DEFINE_double ( message_latency_threshold , 0 . 02 , " Threshold for message delay " ) ; <nl> DEFINE_bool ( enable_lane_change_urgency_checking , false , <nl> " True to check the urgency of lane changing " ) ; <nl> mmm a / modules / planning / common / planning_gflags . h <nl> ppp b / modules / planning / common / planning_gflags . h <nl> DECLARE_bool ( enable_cuda ) ; <nl> <nl> DECLARE_bool ( enable_nonscenario_side_pass ) ; <nl> DECLARE_bool ( enable_soft_speed_limit ) ; <nl> + DECLARE_bool ( enable_dp_reference_speed ) ; <nl> <nl> DECLARE_double ( message_latency_threshold ) ; <nl> DECLARE_bool ( enable_lane_change_urgency_checking ) ; <nl> mmm a / modules / planning / conf / planning_config . pb . txt <nl> ppp b / modules / planning / conf / planning_config . pb . txt <nl> default_task_config : { <nl> default_speed_cost : 1 . 0e3 <nl> exceed_speed_penalty : 10 . 0 <nl> low_speed_penalty : 10 . 0 <nl> + reference_speed_penalty : 5 . 0 <nl> keep_clear_low_speed_penalty : 10 . 0 <nl> accel_penalty : 1 . 0 <nl> decel_penalty : 1 . 0 <nl> mmm a / modules / planning / proto / dp_st_speed_config . proto <nl> ppp b / modules / planning / proto / dp_st_speed_config . proto <nl> message DpStSpeedConfig { <nl> optional double low_speed_penalty = 33 [ default = 2 . 5 ] ; <nl> optional double exceed_soft_speed_penalty = 34 [ default = 0 . 0 ] ; <nl> optional double low_soft_speed_penalty = 35 [ default = 0 . 0 ] ; <nl> - optional double keep_clear_low_speed_penalty = 36 [ default = 10 . 0 ] ; <nl> + optional double reference_speed_penalty = 36 [ default = 1 . 0 ] ; <nl> + optional double keep_clear_low_speed_penalty = 37 [ default = 10 . 0 ] ; <nl> <nl> / / accel cost config <nl> optional double accel_penalty = 40 [ default = 2 . 0 ] ; <nl> mmm a / modules / planning / tasks / optimizers / dp_st_speed / dp_st_cost . cc <nl> ppp b / modules / planning / tasks / optimizers / dp_st_speed / dp_st_cost . cc <nl> double DpStCost : : GetSpeedCost ( const STPoint & first , const STPoint & second , <nl> } <nl> } <nl> <nl> + if ( FLAGS_enable_dp_reference_speed ) { <nl> + double diff_speed = speed - FLAGS_default_cruise_speed ; <nl> + cost + = config_ . reference_speed_penalty ( ) * config_ . default_speed_cost ( ) * <nl> + fabs ( diff_speed * diff_speed ) * unit_t_ ; <nl> + } <nl> + <nl> return cost ; <nl> } <nl> <nl>
Planning : add reference speed to enhance dp st frame - wise stability
ApolloAuto/apollo
b4f1a09365dc6bf5f276fca97a56a2bc23d60a92
2019-05-01T04:41:25Z
mmm a / modules / dnn / src / layers / prior_box_layer . cpp <nl> ppp b / modules / dnn / src / layers / prior_box_layer . cpp <nl> class PriorBoxLayerImpl CV_FINAL : public PriorBoxLayer <nl> auto upper_bounds = std : : make_shared < ngraph : : op : : Constant > ( ngraph : : element : : i64 , ngraph : : Shape { 1 } , std : : vector < int64_t > { 4 } ) ; <nl> auto strides = std : : make_shared < ngraph : : op : : Constant > ( ngraph : : element : : i64 , ngraph : : Shape { 1 } , std : : vector < int64_t > { 1 } ) ; <nl> <nl> - auto slice_layer = std : : make_shared < ngraph : : op : : DynSlice > ( layer_shape , lower_bounds , upper_bounds , strides ) ; <nl> - auto slice_image = std : : make_shared < ngraph : : op : : DynSlice > ( image_shape , lower_bounds , upper_bounds , strides ) ; <nl> + auto slice_layer = std : : make_shared < ngraph : : op : : v1 : : StridedSlice > ( layer_shape , <nl> + lower_bounds , upper_bounds , strides , std : : vector < int64_t > { } , std : : vector < int64_t > { } ) ; <nl> + auto slice_image = std : : make_shared < ngraph : : op : : v1 : : StridedSlice > ( image_shape , <nl> + lower_bounds , upper_bounds , strides , std : : vector < int64_t > { } , std : : vector < int64_t > { } ) ; <nl> <nl> if ( _explicitSizes ) <nl> { <nl> mmm a / modules / dnn / src / layers / slice_layer . cpp <nl> ppp b / modules / dnn / src / layers / slice_layer . cpp <nl> class SliceLayerImpl : public SliceLayer <nl> auto strides = std : : make_shared < ngraph : : op : : Constant > ( ngraph : : element : : i64 , <nl> ngraph : : Shape { dims . size ( ) } , std : : vector < int64_t > ( ( int64_t ) dims . size ( ) , 1 ) ) ; <nl> <nl> - auto slice = std : : make_shared < ngraph : : op : : DynSlice > ( ieInpNode , lower_bounds , upper_bounds , <nl> - strides , ngraph : : AxisSet { } , ngraph : : AxisSet { } ) ; <nl> + auto slice = std : : make_shared < ngraph : : op : : v1 : : StridedSlice > ( ieInpNode , <nl> + lower_bounds , upper_bounds , strides , std : : vector < int64_t > { } , std : : vector < int64_t > { } ) ; <nl> + <nl> return Ptr < BackendNode > ( new InfEngineNgraphNode ( slice ) ) ; <nl> } <nl> # endif / / HAVE_DNN_NGRAPH <nl>
Slice v1 op
opencv/opencv
d99d18304a21282d09ebf5d327047024169b8c49
2019-12-06T06:56:21Z
mmm a / main / tests / test_string . cpp <nl> ppp b / main / tests / test_string . cpp <nl> bool test_22 ( ) { <nl> static const int num [ 4 ] = { 1237461283 , - 22 , 0 , - 1123412 } ; <nl> <nl> for ( int i = 0 ; i < 4 ; i + + ) { <nl> + # ifdef __MINGW32__ / / MinGW can ' t handle normal format specifiers for some reason . So we need special code just for MinGW . <nl> + OS : : get_singleton ( ) - > print ( " \ tString : \ " % s \ " as Int is % I64i \ n " , nums [ i ] , ( long long ) ( String ( nums [ i ] ) . to_int ( ) ) ) ; <nl> + # else <nl> OS : : get_singleton ( ) - > print ( " \ tString : \ " % s \ " as Int is % lli \ n " , nums [ i ] , ( long long ) ( String ( nums [ i ] ) . to_int ( ) ) ) ; <nl> - <nl> + # endif <nl> if ( String ( nums [ i ] ) . to_int ( ) ! = num [ i ] ) { <nl> return false ; <nl> } <nl>
Fix string test code for MinGW
godotengine/godot
5c21732da1a2c71af302a939d98d1583af28a410
2020-07-05T08:57:21Z
mmm a / test / lit . cfg <nl> ppp b / test / lit . cfg <nl> def darwin_sdk_build_version_split ( version ) : <nl> <nl> <nl> def darwin_sdk_build_version_cmp ( lhs , rhs ) : <nl> - return cmp ( <nl> + # The ` _cmp ` function is provided to port the Python 2 global ` cmp ` <nl> + # function forward to Python 3 . The function implementation is taken <nl> + # directly from the recommendation that announced its removal . <nl> + # See : https : / / docs . python . org / 3 . 0 / whatsnew / 3 . 0 . html # ordering - comparisons <nl> + def _cmp ( a , b ) : <nl> + return ( a > b ) - ( a < b ) <nl> + return _cmp ( <nl> darwin_sdk_build_version_split ( lhs ) , <nl> darwin_sdk_build_version_split ( rhs ) ) <nl> <nl>
[ lit ] The cmp ( ) function should be treated as gone in Python 3
apple/swift
d1f124eec6e44c00f5a043e025261ef9b841ea82
2016-01-08T01:14:06Z
mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> v8_toolset_for_shell = " host " <nl> # <nl> <nl> config ( " internal_config_base " ) { <nl> - visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> + # Only targets in this file and its subdirs can depend on this . <nl> + visibility = [ " . / * " ] <nl> <nl> configs = [ " : v8_tracing_config " ] <nl> <nl> config ( " internal_config_base " ) { <nl> <nl> config ( " internal_config " ) { <nl> defines = [ ] <nl> - visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> + # Only targets in this file and its subdirs can depend on this . <nl> + visibility = [ " . / * " ] <nl> <nl> configs = [ <nl> " / / build / config / compiler : wexit_time_destructors " , <nl> config ( " v8_header_features " ) { <nl> # Put defines here that are only used in our internal files and NEVER in <nl> # external headers that embedders ( such as chromium and node ) might include . <nl> config ( " features " ) { <nl> - visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> + # Only targets in this file and its subdirs can depend on this . <nl> + visibility = [ " . / * " ] <nl> <nl> defines = [ ] <nl> <nl> config ( " features " ) { <nl> } <nl> <nl> config ( " toolchain " ) { <nl> - visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> + # Only targets in this file and its subdirs can depend on this . <nl> + visibility = [ " . / * " ] <nl> <nl> defines = [ ] <nl> cflags = [ ] <nl> mmm a / third_party / inspector_protocol / BUILD . gn <nl> ppp b / third_party / inspector_protocol / BUILD . gn <nl> <nl> import ( " . . / . . / gni / v8 . gni " ) <nl> <nl> config ( " crdtp_config " ) { <nl> - visibility = [ " . . / . . / src / inspector : * " ] <nl> + visibility = [ " . . / . . / src / inspector : * " , " : * " ] <nl> configs = [ " . . / . . / : internal_config " ] <nl> include_dirs = [ " . . / . . / include " ] <nl> } <nl>
Fix visiblity rules for configs enforced by the latest GN version .
v8/v8
7c182bd65f424db19dc3e3d9aca601030af30d7e
2020-08-18T18:52:43Z
mmm a / tensorflow / contrib / lite / c / c_api_internal . h <nl> ppp b / tensorflow / contrib / lite / c / c_api_internal . h <nl> void TfLiteIntArrayFree ( TfLiteIntArray * v ) ; <nl> # define TF_LITE_ENSURE_OK ( context , status ) \ <nl> do { \ <nl> if ( ( status ) ! = kTfLiteOk ) { \ <nl> - return status ; \ <nl> + return kTfLiteError ; \ <nl> } \ <nl> } while ( 0 ) <nl> <nl>
Merge pull request from sby : tflite
tensorflow/tensorflow
cdc7f0fbce230b5eef30b6f0049495af3983aea0
2018-09-13T20:12:51Z
mmm a / lib / Sema / TypeCheckGeneric . cpp <nl> ppp b / lib / Sema / TypeCheckGeneric . cpp <nl> Type ProtocolRequirementTypeResolver : : resolveDependentMemberType ( <nl> Type ProtocolRequirementTypeResolver : : resolveSelfAssociatedType ( <nl> Type selfTy , AssociatedTypeDecl * assocType ) { <nl> assert ( selfTy - > isEqual ( Proto - > getSelfInterfaceType ( ) ) ) ; <nl> + ( void ) Proto ; <nl> return assocType - > getDeclaredInterfaceType ( ) ; <nl> } <nl> <nl>
Merge remote - tracking branch ' origin / master ' into master - next
apple/swift
a6ab0e622fe5fffd519e87ad839a26426de53597
2017-04-12T23:28:37Z
mmm a / system / scrapers / video / common / tmdb . xml <nl> ppp b / system / scrapers / video / common / tmdb . xml <nl> <nl> < / GetTMDBFanartById > <nl> < GetTMDBFanart dest = " 5 " > <nl> < RegExp input = " $ $ 2 " output = " & lt ; details & gt ; & lt ; fanart & gt ; \ 1 & lt ; / fanart & gt ; & lt ; / details & gt ; " dest = " 5 " > <nl> - < RegExp input = " $ $ 1 " output = " & lt ; thumb preview = & quot ; \ 2 & quot ; & gt ; \ 1 & lt ; / thumb & gt ; " dest = " 2 " > <nl> - < expression repeat = " yes " > & lt ; backdrop . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; original & quot ; . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; poster & quot ; . * ? & lt ; / backdrop & gt ; < / expression > <nl> + < RegExp input = " $ $ 1 " output = " & lt ; thumb preview = & quot ; \ 1 & quot ; & gt ; \ 2 & lt ; / thumb & gt ; " dest = " 2 " > <nl> + < expression repeat = " yes " > & lt ; backdrop . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; poster & quot ; . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; original & quot ; . * ? & lt ; / backdrop & gt ; < / expression > <nl> < / RegExp > <nl> < expression noclean = " 1 " > ( . + ) < / expression > <nl> < / RegExp > <nl> <nl> < / GetTMDBThumbsById > <nl> < GetTMDBThumbs dest = " 5 " > <nl> < RegExp input = " $ $ 2 " output = " & lt ; details & gt ; \ 1 & lt ; / details & gt ; " dest = " 5 " > <nl> - < RegExp input = " $ $ 1 " output = " & lt ; thumb preview = & quot ; \ 2 & quot ; & gt ; \ 1 & lt ; / thumb & gt ; " dest = " 2 " > <nl> - < expression repeat = " yes " > & lt ; poster . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; original & quot ; . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; mid & quot ; . * ? & lt ; / poster & gt ; < / expression > <nl> + < RegExp input = " $ $ 1 " output = " & lt ; thumb preview = & quot ; \ 1 & quot ; & gt ; \ 2 & lt ; / thumb & gt ; " dest = " 2 " > <nl> + < expression repeat = " yes " > & lt ; poster . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; mid & quot ; . * ? url = & quot ; ( [ ^ & quot ; ] * ) & quot ; size = & quot ; original & quot ; . * ? & lt ; / poster & gt ; < / expression > <nl> < / RegExp > <nl> < expression noclean = " 1 " / > <nl> < / RegExp > <nl>
fixed : missing themoviedb . org thumbs and fanarts
xbmc/xbmc
c10dd65f9a637c592ecfe1b5730b7af5f2e845d5
2009-11-24T18:00:09Z
similarity index 72 % <nl> rename from ReactWindows / ReactNative . Shared . Tests / Modules / Core / JSTimersExecutionTests . cs <nl> rename to ReactWindows / ReactNative . Shared . Tests / Modules / Core / JSTimersTests . cs <nl> mmm a / ReactWindows / ReactNative . Shared . Tests / Modules / Core / JSTimersExecutionTests . cs <nl> ppp b / ReactWindows / ReactNative . Shared . Tests / Modules / Core / JSTimersTests . cs <nl> <nl> namespace ReactNative . Tests . Modules . Core <nl> { <nl> [ TestFixture ] <nl> - public class JSTimersExecutionTests <nl> + public class JSTimersTests <nl> { <nl> - public void JSTimersExecution_Invoke ( ) <nl> + public void JSTimers_Invoke ( ) <nl> { <nl> - var module = new JSTimersExecution ( ) ; <nl> + var module = new JSTimers ( ) ; <nl> <nl> var name = default ( string ) ; <nl> var args = default ( object [ ] ) ; <nl> public void JSTimersExecution_Invoke ( ) <nl> <nl> var ids = new [ ] { 42 } ; <nl> module . callTimers ( ids ) ; <nl> - Assert . AreEqual ( nameof ( JSTimersExecution . callTimers ) , name ) ; <nl> + Assert . AreEqual ( nameof ( JSTimers . callTimers ) , name ) ; <nl> Assert . AreEqual ( 1 , args . Length ) ; <nl> Assert . AreSame ( ids , args [ 0 ] ) ; <nl> } <nl> mmm a / ReactWindows / ReactNative . Shared . Tests / ReactNative . Shared . Tests . projitems <nl> ppp b / ReactWindows / ReactNative . Shared . Tests / ReactNative . Shared . Tests . projitems <nl> <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Internal \ MockPromise . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Internal \ MockReactInstance . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ AppState \ AppStateModuleTests . cs " / > <nl> - < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ JSTimersExecutionTests . cs " / > <nl> + < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ JSTimersTests . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ RCTDeviceEventEmitterTests . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ RCTNativeAppEventEmitterTests . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Network \ NetworkingModuleTests . cs " / > <nl> mmm a / ReactWindows / ReactNative . Shared / CoreModulesPackage . cs <nl> ppp b / ReactWindows / ReactNative . Shared / CoreModulesPackage . cs <nl> public IReadOnlyList < Type > CreateJavaScriptModulesConfig ( ) <nl> return new List < Type > <nl> { <nl> typeof ( RCTDeviceEventEmitter ) , <nl> - typeof ( JSTimersExecution ) , <nl> + typeof ( JSTimers ) , <nl> typeof ( RCTEventEmitter ) , <nl> typeof ( RCTNativeAppEventEmitter ) , <nl> typeof ( AppRegistry ) , <nl> similarity index 88 % <nl> rename from ReactWindows / ReactNative . Shared / Modules / Core / JSTimersExecution . cs <nl> rename to ReactWindows / ReactNative . Shared / Modules / Core / JSTimers . cs <nl> mmm a / ReactWindows / ReactNative . Shared / Modules / Core / JSTimersExecution . cs <nl> ppp b / ReactWindows / ReactNative . Shared / Modules / Core / JSTimers . cs <nl> namespace ReactNative . Modules . Core <nl> / / / < summary > <nl> / / / JavaScript module for invoking timers by identifier . <nl> / / / < / summary > <nl> - public sealed class JSTimersExecution : JavaScriptModuleBase <nl> + public sealed class JSTimers : JavaScriptModuleBase <nl> { <nl> / / / < summary > <nl> / / / Calls a batch of timers with the given identifiers . <nl> mmm a / ReactWindows / ReactNative . Shared / Modules / Core / Timing . cs <nl> ppp b / ReactWindows / ReactNative . Shared / Modules / Core / Timing . cs <nl> public class Timing : ReactContextNativeModuleBase , ILifecycleEventListener <nl> <nl> private readonly HeapBasedPriorityQueue < TimerData > _timers ; <nl> <nl> - private JSTimersExecution _jsTimersModule ; <nl> + private JSTimers _jsTimersModule ; <nl> private bool _suspended ; <nl> private bool _renderingHandled ; <nl> <nl> public override string Name <nl> / / / < / summary > <nl> public override void Initialize ( ) <nl> { <nl> - _jsTimersModule = Context . GetJavaScriptModule < JSTimersExecution > ( ) ; <nl> + _jsTimersModule = Context . GetJavaScriptModule < JSTimers > ( ) ; <nl> Context . AddLifecycleEventListener ( this ) ; <nl> } <nl> <nl> mmm a / ReactWindows / ReactNative . Shared / ReactNative . Shared . projitems <nl> ppp b / ReactWindows / ReactNative . Shared / ReactNative . Shared . projitems <nl> <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ DeviceEventManagerModule . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ ExceptionsManagerModule . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ JavaScriptException . cs " / > <nl> - < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ JSTimersExecution . cs " / > <nl> + < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ JSTimers . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ RCTDeviceEventEmitter . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ RCTNativeAppEventEmitter . cs " / > <nl> < Compile Include = " $ ( MSBuildThisFileDirectory ) Modules \ Core \ Timing . cs " / > <nl> mmm a / ReactWindows / ReactNative . Tests / Modules / Core / TimingTests . cs <nl> ppp b / ReactWindows / ReactNative . Tests / Modules / Core / TimingTests . cs <nl> public async Task Timing_Create ( ) <nl> var waitHandle = new AutoResetEvent ( false ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> waitHandle . Set ( ) ; <nl> } ) ) ; <nl> public async Task Timing_ManyTimers ( ) <nl> var countdown = new CountdownEvent ( count ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> var currentIds = ( IList < int > ) args [ 0 ] ; <nl> ids . AddRange ( currentIds ) ; <nl> for ( var i = 0 ; i < currentIds . Count ; + + i ) <nl> public async Task Timing_Create_Delete ( ) <nl> var waitHandle = new AutoResetEvent ( false ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> waitHandle . Set ( ) ; <nl> } ) ) ; <nl> public async Task Timing_Suspend_Resume ( ) <nl> var waitHandle = new AutoResetEvent ( false ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> waitHandle . Set ( ) ; <nl> } ) ) ; <nl> public async Task Timing_Repeat ( ) <nl> var countdown = new CountdownEvent ( repeat ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> if ( countdown . CurrentCount > 0 ) <nl> { <nl> public async Task Timing_ManOrBoy ( ) <nl> var countdown = new CountdownEvent ( 1 ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> var firedTimers = ( IList < int > ) args [ 0 ] ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> countdown . Signal ( firedTimers . Count ) ; <nl> public async Task Timing_Zero_NoRepeat ( ) <nl> var waitHandle = new AutoResetEvent ( false ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> waitHandle . Set ( ) ; <nl> } ) ) ; <nl> public async Task Timing_Zero_Repeat ( ) <nl> var countdown = new CountdownEvent ( 60 ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> countdown . Signal ( ) ; <nl> } ) ) ; <nl> public async Task Timing_Correct_Order ( ) <nl> var countdown = new CountdownEvent ( 1 ) ; <nl> var context = CreateReactContext ( new MockInvocationHandler ( ( name , args ) = > <nl> { <nl> - Assert . AreEqual ( name , nameof ( JSTimersExecution . callTimers ) ) ; <nl> + Assert . AreEqual ( name , nameof ( JSTimers . callTimers ) ) ; <nl> ids . AddRange ( ( IList < int > ) args [ 0 ] ) ; <nl> countdown . Signal ( ) ; <nl> } ) ) ; <nl> public async Task Timing_Correct_Order ( ) <nl> private static ReactContext CreateReactContext ( IInvocationHandler handler ) <nl> { <nl> var context = new ReactContext ( ) ; <nl> - var jsTimers = new JSTimersExecution <nl> + var jsTimers = new JSTimers <nl> { <nl> InvocationHandler = handler , <nl> } ; <nl> class TestReactInstance : MockReactInstance <nl> { <nl> private readonly object _jsTimers ; <nl> <nl> - public TestReactInstance ( JSTimersExecution jsTimers ) <nl> + public TestReactInstance ( JSTimers jsTimers ) <nl> : base ( ) <nl> { <nl> _jsTimers = jsTimers ; <nl> public TestReactInstance ( JSTimersExecution jsTimers ) <nl> <nl> public override T GetJavaScriptModule < T > ( ) <nl> { <nl> - if ( typeof ( JSTimersExecution ) = = typeof ( T ) ) <nl> + if ( typeof ( JSTimers ) = = typeof ( T ) ) <nl> { <nl> return ( T ) _jsTimers ; <nl> } <nl>
fix ( CoreModules ) : Renamed JSTimersExecution to JSTimers .
microsoft/react-native-windows
55932994e20d4afe9a0b92d18d8cb356a2c4fd46
2017-07-31T13:12:57Z
mmm a / docs / docs / linear_algebra . xml <nl> ppp b / docs / docs / linear_algebra . xml <nl> <nl> < item > get_rect < / item > <nl> < item > centered_rect < / item > <nl> < item > set_aspect_ratio < / item > <nl> + < item > set_rect_area < / item > <nl> < item > center < / item > <nl> < item > dcenter < / item > <nl> < item > shrink_rect < / item > <nl> <nl> <nl> < / component > <nl> <nl> + < ! - - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - - > <nl> + <nl> + < component > <nl> + < name > set_rect_area < / name > <nl> + < file > dlib / geometry . h < / file > <nl> + < spec_file link = " true " > dlib / geometry / rectangle_abstract . h < / spec_file > <nl> + < description > <nl> + This function reshapes a < a href = " # rectangle " > rectangle < / a > so that <nl> + it has a user specified area . <nl> + < / description > <nl> + <nl> + < / component > <nl> + <nl> < ! - - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - - > <nl> <nl> < component > <nl> mmm a / docs / docs / term_index . xml <nl> ppp b / docs / docs / term_index . xml <nl> <nl> < term file = " linear_algebra . html " name = " resize_rect_height " include = " dlib / geometry . h " / > <nl> < term file = " linear_algebra . html " name = " centered_rect " include = " dlib / geometry . h " / > <nl> < term file = " linear_algebra . html " name = " set_aspect_ratio " include = " dlib / geometry . h " / > <nl> + < term file = " linear_algebra . html " name = " set_rect_area " include = " dlib / geometry . h " / > <nl> < term file = " linear_algebra . html " name = " center " include = " dlib / geometry . h " / > <nl> < term file = " linear_algebra . html " name = " nearest_point " include = " dlib / geometry . h " / > <nl> < term file = " linear_algebra . html " name = " nearest_rect " include = " dlib / geometry . h " / > <nl>
updated docs
davisking/dlib
f9eab488133becd1319a390cd5fab19ecbfcf006
2017-06-03T02:51:59Z
mmm a / torch / _torch_docs . py <nl> ppp b / torch / _torch_docs . py <nl> def parse_kwargs ( desc ) : <nl> <nl> Example : : <nl> <nl> - > > > a = torch . randn ( 4 ) <nl> + > > > a = torch . tensor ( [ 0 . 7 , - 1 . 2 , 0 . , 2 . 3 ] ) <nl> > > > a <nl> - tensor ( [ 1 . 0382 , - 1 . 4526 , - 0 . 9709 , 0 . 4542 ] ) <nl> + tensor ( [ 0 . 7000 , - 1 . 2000 , 0 . 0000 , 2 . 3000 ] ) <nl> > > > torch . sign ( a ) <nl> - tensor ( [ 1 . , - 1 . , - 1 . , 1 . ] ) <nl> + tensor ( [ 1 . , - 1 . , 0 . , 1 . ] ) <nl> " " " ) <nl> <nl> add_docstr ( torch . sin , <nl>
Example with edge case 0 for torch . sign ( )
pytorch/pytorch
35a24a9a948d5a41a6e9c8c42e9c88cb427146d3
2018-11-14T17:16:09Z
mmm a / fdbserver / BackupWorker . actor . cpp <nl> ppp b / fdbserver / BackupWorker . actor . cpp <nl> struct BackupData { <nl> container = IBackupContainer : : openContainer ( " file : / / simfdb / mutation_backups / " ) ; <nl> } else { <nl> / / TODO : use blobstore URL passed from somewhere . <nl> - ASSERT ( false ) ; <nl> - container = IBackupContainer : : openContainer ( " blobstore : / / " ) ; <nl> + / / ASSERT ( false ) ; <nl> + / / container = IBackupContainer : : openContainer ( " blobstore : / / " ) ; <nl> } <nl> } <nl> <nl>
fix : backupWorker would crash when run outside of simulation
apple/foundationdb
8f599e9d15b41ddc193a79f604a9258e871591bc
2020-01-24T03:06:39Z
mmm a / docs / specs / qp_spline_path_optimizer . md <nl> ppp b / docs / specs / qp_spline_path_optimizer . md <nl> <nl> <nl> Quadratic programming + Spline interpolation <nl> <nl> + _ * * Tip * * : to read the equations in the document , you are recommended to use Chrome with [ a plugin ] ( https : / / chrome . google . com / webstore / detail / tex - all - the - things / cbimabofgmfdkicghcadidpemeenbffn ) _ <nl> + <nl> # # 1 . Objective function <nl> <nl> # # # 1 . 1 Get path length <nl> Split the path into * * n * * segments . each segment trajectory is defined by a poly <nl> <nl> Each segment * * * i * * * has accumulated distance $ d_i $ along reference line . The trajectory for the segment is defined as a polynomial of degree five by default . <nl> <nl> + < p > <nl> $ $ <nl> l = f_i ( s ) <nl> = a_ { i0 } + a_ { i1 } * s + a_ { i2 } * s ^ 2 + a_ { i3 } * s ^ 3 + a_ { i4 } * s ^ 4 + a_ { i5 } * s ^ 5 ( 0 \ leq s \ leq d_ { i } ) <nl> $ $ <nl> + < / p > <nl> <nl> # # # 1 . 4 Define objective function of optimization for each segment <nl> <nl> + < p > <nl> $ $ <nl> cost = \ sum_ { i = 1 } ^ { n } \ Big ( w_1 \ cdot \ int \ limits_ { 0 } ^ { d_i } ( f_i ' ) ^ 2 ( s ) ds + w_2 \ cdot \ int \ limits_ { 0 } ^ { d_i } ( f_i ' ' ) ^ 2 ( s ) ds + w_3 \ cdot \ int \ limits_ { 0 } ^ { d_i } ( f_i ^ { \ prime \ prime \ prime } ) ^ 2 ( s ) ds \ Big ) <nl> $ $ <nl> + < / p > <nl> <nl> # # # 1 . 5 Convert the cost function to QP formulation <nl> <nl> QP formulation : <nl> + < p > <nl> $ $ <nl> - \ frac { 1 } { 2 } \ cdot x ^ T \ cdot H \ cdot x + f ^ T \ cdot x <nl> - \ \ <nl> - s . t . LB \ leq x \ leq UB <nl> - \ \ <nl> - A_ { eq } x = b_ { eq } <nl> - \ \ <nl> - Ax \ leq b <nl> + \ begin { aligned } <nl> + & \ frac { 1 } { 2 } \ cdot x ^ T \ cdot H \ cdot x + f ^ T \ cdot x \ \ <nl> + s . t . \ qquad & LB \ leq x \ leq UB \ \ <nl> + & A_ { eq } x = b_ { eq } \ \ <nl> + & Ax \ leq b <nl> + \ end { aligned } <nl> $ $ <nl> + < / p > <nl> Below is the example for converting the cost function into the QP formulaiton . <nl> + < p > <nl> $ $ <nl> f_i ( s ) = <nl> \ begin { vmatrix } a_ { i0 } & a_ { i1 } & a_ { i2 } & a_ { i3 } & a_ { i4 } & a_ { i5 } \ end { vmatrix } <nl> \ cdot <nl> \ begin { vmatrix } 1 \ \ s \ \ s ^ 2 \ \ s ^ 3 \ \ s ^ 4 \ \ s ^ 5 \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> <nl> And <nl> + < p > <nl> $ $ <nl> f_i ' ( s ) = <nl> \ begin { vmatrix } a_ { i0 } & a_ { i1 } & a_ { i2 } & a_ { i3 } & a_ { i4 } & a_ { i5 } \ end { vmatrix } <nl> \ cdot <nl> \ begin { vmatrix } 0 \ \ 1 \ \ s \ \ s ^ 2 \ \ s ^ 3 \ \ s ^ 4 \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> <nl> <nl> And <nl> + < p > <nl> $ $ <nl> f_i ' ( s ) ^ 2 = <nl> \ begin { vmatrix } a_ { i0 } & a_ { i1 } & a_ { i2 } & a_ { i3 } & a_ { i4 } & a_ { i5 } \ end { vmatrix } <nl> f_i ' ( s ) ^ 2 = <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> And <nl> + < p > <nl> $ $ <nl> \ int \ limits_ { 0 } ^ { d_i } f_i ' ( s ) ^ 2 ds = <nl> \ int \ limits_ { 0 } ^ { d_i } <nl> $ $ <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } ds <nl> $ $ <nl> + < / p > <nl> <nl> <nl> And <nl> + < p > <nl> $ $ <nl> \ int \ limits_ { 0 } ^ { d_i } f ' ( s ) ^ 2 ds = <nl> \ begin { vmatrix } a_ { i0 } & a_ { i1 } & a_ { i2 } & a_ { i3 } & a_ { i4 } & a_ { i5 } \ end { vmatrix } <nl> $ $ <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> <nl> <nl> And <nl> + < p > <nl> $ $ <nl> \ int \ limits_ { 0 } ^ { d_i } <nl> f ' ( s ) ^ 2 ds = \ begin { vmatrix } a_ { i0 } & a_ { i1 } & a_ { i2 } & a_ { i3 } & a_ { i4 } & a_ { i5 } \ end { vmatrix } <nl> \ cdot \ int \ limits_ { 0 } ^ { d_i } <nl> \ begin { vmatrix } <nl> 0 & 0 & 0 & 0 & 0 & 0 \ \ <nl> - 0 & 1 & s & s ^ 2 & s ^ 3 & s ^ 4 \ \ <nl> - 0 & s & s ^ 2 & s ^ 3 & s ^ 4 & s ^ 5 \ \ <nl> - 0 & s ^ 2 & s ^ 3 & s ^ 4 & s ^ 5 & s ^ 6 \ \ <nl> - 0 & s ^ 3 & s ^ 4 & s ^ 5 & s ^ 6 & s ^ 7 \ \ <nl> + 0 & 1 & s & s ^ 2 & s ^ 3 & s ^ 4 \ \ <nl> + 0 & s & s ^ 2 & s ^ 3 & s ^ 4 & s ^ 5 \ \ <nl> + 0 & s ^ 2 & s ^ 3 & s ^ 4 & s ^ 5 & s ^ 6 \ \ <nl> + 0 & s ^ 3 & s ^ 4 & s ^ 5 & s ^ 6 & s ^ 7 \ \ <nl> 0 & s ^ 4 & s ^ 5 & s ^ 6 & s ^ 7 & s ^ 8 <nl> \ end { vmatrix } ds <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> + <nl> And <nl> + < p > <nl> $ $ <nl> \ int \ limits_ { 0 } ^ { d_i } <nl> - f ' _i ( s ) ^ 2 ds = \ begin { vmatrix } a_ { i0 } & a_ { i1 } & a_ { i2 } & a_ { i3 } & a_ { i4 } & a_ { i5 } \ end { vmatrix } <nl> + f ' _i ( s ) ^ 2 ds = \ begin { vmatrix } a_ { i0 } & a_ { i1 } & a_ { i2 } & a_ { i3 } & a_ { i4 } & a_ { i5 } \ end { vmatrix } <nl> \ cdot \ begin { vmatrix } <nl> 0 & 0 & 0 & 0 & 0 & 0 \ \ <nl> - 0 & d_i & \ frac { d_i ^ 2 } { 2 } & \ frac { d_i ^ 3 } { 3 } & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } \ \ <nl> - 0 & \ frac { d_i ^ 2 } { 2 } & \ frac { d_i ^ 3 } { 3 } & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } \ \ <nl> - 0 & \ frac { d_i ^ 3 } { 3 } & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } & \ frac { d_i ^ 7 } { 7 } \ \ <nl> - 0 & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } & \ frac { d_i ^ 7 } { 7 } & \ frac { d_i ^ 8 } { 8 } \ \ <nl> - 0 & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } & \ frac { d_i ^ 7 } { 7 } & \ frac { d_i ^ 8 } { 8 } & \ frac { d_i ^ 9 } { 9 } \ \ <nl> + 0 & d_i & \ frac { d_i ^ 2 } { 2 } & \ frac { d_i ^ 3 } { 3 } & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } \ \ <nl> + 0 & \ frac { d_i ^ 2 } { 2 } & \ frac { d_i ^ 3 } { 3 } & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } \ \ <nl> + 0 & \ frac { d_i ^ 3 } { 3 } & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } & \ frac { d_i ^ 7 } { 7 } \ \ <nl> + 0 & \ frac { d_i ^ 4 } { 4 } & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } & \ frac { d_i ^ 7 } { 7 } & \ frac { d_i ^ 8 } { 8 } \ \ <nl> + 0 & \ frac { d_i ^ 5 } { 5 } & \ frac { d_i ^ 6 } { 6 } & \ frac { d_i ^ 7 } { 7 } & \ frac { d_i ^ 8 } { 8 } & \ frac { d_i ^ 9 } { 9 } <nl> \ end { vmatrix } <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> <nl> # # 2 Constraints <nl> <nl> # # # 2 . 1 The init point constraints <nl> <nl> - Assume that the first point is ( $ s0 $ , $ l0 $ ) , and that $ l0 $ is on the planned path $ f_i ( s ) $ , $ f ' i ( s ) $ , and $ f_i ( s ) ' ' $ . Convert those constraints into QP equality constraints , using : <nl> + Assume that the first point is ( $ s_0 $ , $ l_0 $ ) , and that $ l_0 $ is on the planned path $ f_i ( s ) $ , $ f ' i ( s ) $ , and $ f_i ( s ) ' ' $ . Convert those constraints into QP equality constraints , using : <nl> + < p > <nl> $ $ <nl> A_ { eq } x = b_ { eq } <nl> $ $ <nl> + < / p > <nl> Below are the steps of conversion . <nl> + < p > <nl> $ $ <nl> f_i ( s_0 ) = <nl> \ begin { vmatrix } 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 & s_0 ^ 4 & s_0 ^ 5 \ end { vmatrix } <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } = l_0 <nl> $ $ <nl> + < / p > <nl> And <nl> + < p > <nl> $ $ <nl> f ' _i ( s_0 ) = <nl> \ begin { vmatrix } 0 & 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 & s_0 ^ 4 \ end { vmatrix } <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } = l_0 <nl> $ $ <nl> + < / p > <nl> And <nl> + < p > <nl> $ $ <nl> f ' ' _i ( s_0 ) = <nl> \ begin { vmatrix } 0 & 0 & 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 \ end { vmatrix } <nl> \ cdot <nl> \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } = l_0 <nl> $ $ <nl> + < / p > <nl> The $ i $ is the index of segment that contains the $ s_0 $ . <nl> <nl> Therefore the equality constraint is : <nl> + < p > <nl> $ $ <nl> \ begin { vmatrix } <nl> 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 & s_0 ^ 4 & s_0 ^ 5 \ \ <nl> $ $ <nl> 0 & 0 & 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 <nl> \ end { vmatrix } <nl> \ cdot <nl> - \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } <nl> - = <nl> + \ begin { vmatrix } a_ { i0 } \ \ a_ { i1 } \ \ a_ { i2 } \ \ a_ { i3 } \ \ a_ { i4 } \ \ a_ { i5 } \ end { vmatrix } = <nl> \ begin { vmatrix } <nl> l_0 \ \ <nl> l_0 \ \ <nl> l_0 \ \ <nl> \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> <nl> # # # 2 . 2 The end point constraints <nl> <nl> Similar to the init point , the end point $ ( s_e , l_e ) $ is known and should produce the same constraint as described in the init point calculations . <nl> <nl> Combine the init point and end point , and show the equality constraint as : <nl> + < p > <nl> $ $ <nl> \ begin { vmatrix } <nl> 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 & s_0 ^ 4 & s_0 ^ 5 \ \ <nl> $ $ <nl> l_e \ \ <nl> \ end { vmatrix } <nl> $ $ <nl> - <nl> + < / p > <nl> <nl> # # # 2 . 3 Joint smoothness constraints <nl> <nl> This constraint is designed to smooth the spline joint . Assume two segments $ seg_k $ and $ seg_ { k + 1 } $ are connected , and the accumulated * * s * * of segment $ seg_k $ is $ s_k $ . Calculate the constraint equation as : <nl> + < p > <nl> $ $ <nl> f_k ( s_k ) = f_ { k + 1 } ( s_0 ) <nl> $ $ <nl> + < / p > <nl> Below are the steps of the calculation . <nl> + < p > <nl> $ $ <nl> \ begin { vmatrix } <nl> 1 & s_k & s_k ^ 2 & s_k ^ 3 & s_k ^ 4 & s_k ^ 5 \ \ <nl> $ $ <nl> a_ { k + 1 , 0 } \ \ a_ { k + 1 , 1 } \ \ a_ { k + 1 , 2 } \ \ a_ { k + 1 , 3 } \ \ a_ { k + 1 , 4 } \ \ a_ { k + 1 , 5 } <nl> \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> Then <nl> + < p > <nl> $ $ <nl> \ begin { vmatrix } <nl> 1 & s_k & s_k ^ 2 & s_k ^ 3 & s_k ^ 4 & s_k ^ 5 & - 1 & - s_ { 0 } & - s_ { 0 } ^ 2 & - s_ { 0 } ^ 3 & - s_ { 0 } ^ 4 & - s_ { 0 } ^ 5 \ \ <nl> $ $ <nl> \ end { vmatrix } <nl> = 0 <nl> $ $ <nl> + < / p > <nl> Use $ s_0 $ = 0 in the equation . <nl> <nl> Similarly calculate the equality constraints for : <nl> + < p > <nl> $ $ <nl> f ' _k ( s_k ) = f ' _ { k + 1 } ( s_0 ) <nl> \ \ <nl> f ' ' _k ( s_k ) = f ' ' _ { k + 1 } ( s_0 ) <nl> \ \ <nl> f ' ' ' _k ( s_k ) = f ' ' ' _ { k + 1 } ( s_0 ) <nl> $ $ <nl> + < / p > <nl> <nl> # # # 2 . 4 Sampled points for boundary constraint <nl> <nl> Evenly sample * * m * * points along the path , and check the obstacle boundary at those points . Convert the constraint into QP inequality constraints , using : <nl> + < p > <nl> $ $ <nl> Ax \ leq b <nl> $ $ <nl> - First find the lower boundary $ l_ { lb , j } $ at those points ( $ s_j $ , $ l_j $ ) and $ j \ in [ 0 , m ] $ based on the road width and surrounding obstacles . Calculate the inequality constraints as : <nl> + < / p > <nl> + First find the lower boundary $ l_ { lb , j } $ at those points $ ( s_j , l_j ) $ and $ j \ in [ 0 , m ] $ based on the road width and surrounding obstacles . Calculate the inequality constraints as : <nl> + < p > <nl> $ $ <nl> \ begin { vmatrix } <nl> 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 & s_0 ^ 4 & s_0 ^ 5 \ \ <nl> $ $ <nl> l_ { lb , m } \ \ <nl> \ end { vmatrix } <nl> $ $ <nl> + < / p > <nl> <nl> <nl> Similarly , for the upper boundary $ l_ { ub , j } $ , calculate the inequality constraints as : <nl> + < p > <nl> $ $ <nl> \ begin { vmatrix } <nl> 1 & s_0 & s_0 ^ 2 & s_0 ^ 3 & s_0 ^ 4 & s_0 ^ 5 \ \ <nl> $ $ <nl> l_ { ub , m } \ \ <nl> \ end { vmatrix } <nl> $ $ <nl> - <nl> - <nl> - <nl> + < / p > <nl> <nl>
planning : update markdown latex equations in qp_spline_path_optimizer . md
ApolloAuto/apollo
585fb8e137884df5b60ad18c9ae5e9ee5f580045
2017-09-20T04:23:40Z
mmm a / ports / openimageio / CONTROL <nl> ppp b / ports / openimageio / CONTROL <nl> <nl> Source : openimageio <nl> - Version : 2019 - 08 - 08 - 2 <nl> + Version : 2019 - 08 - 08 - 3 <nl> Homepage : https : / / github . com / OpenImageIO / oiio <nl> Description : A library for reading and writing images , and a bunch of related classes , utilities , and application <nl> Build - Depends : libjpeg - turbo , tiff , libpng , openexr , boost - thread , boost - smart - ptr , boost - foreach , boost - regex , boost - type - traits , boost - static - assert , boost - unordered , boost - config , boost - algorithm , boost - filesystem , boost - system , boost - thread , boost - asio , boost - random , robin - map , boost - stacktrace <nl> Build - Depends : libjpeg - turbo , tiff , libpng , openexr , boost - thread , boost - smart - p <nl> Feature : libraw <nl> Build - Depends : libraw <nl> Description : Enable RAW image files support <nl> + <nl> + Feature : opencolorio <nl> + Build - Depends : opencolorio <nl> + Description : Enable opencolorio support for openimageio <nl> \ No newline at end of file <nl> mmm a / ports / openimageio / portfile . cmake <nl> ppp b / ports / openimageio / portfile . cmake <nl> else ( ) <nl> set ( LINKSTATIC OFF ) <nl> endif ( ) <nl> <nl> - # Features <nl> - set ( USE_LIBRAW OFF ) <nl> - if ( " libraw " IN_LIST FEATURES ) <nl> - set ( USE_LIBRAW ON ) <nl> - endif ( ) <nl> + vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_OPTIONS <nl> + libraw USE_LIBRAW <nl> + opencolorio USE_OCIO <nl> + ) <nl> <nl> vcpkg_configure_cmake ( <nl> SOURCE_PATH $ { SOURCE_PATH } <nl> PREFER_NINJA <nl> - OPTIONS <nl> + OPTIONS $ { FEATURE_OPTIONS } <nl> - DOIIO_BUILD_TOOLS = OFF <nl> - DOIIO_BUILD_TESTS = OFF <nl> - DHIDE_SYMBOLS = ON <nl> vcpkg_configure_cmake ( <nl> - DUSE_FIELD3D = OFF <nl> - DUSE_FREETYPE = OFF <nl> - DUSE_GIF = OFF <nl> - - DUSE_LIBRAW = $ { USE_LIBRAW } <nl> - DUSE_NUKE = OFF <nl> - - DUSE_OCIO = OFF <nl> - DUSE_OPENCV = OFF <nl> - DUSE_OPENJPEG = OFF <nl> - DUSE_OPENSSL = OFF <nl>
[ openimageio ] Add opencolorio as feature ( )
microsoft/vcpkg
baed10c1a4f89435205ef613b12d397f036f393f
2019-09-17T16:31:20Z
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> if ( swift_build_android AND NOT " $ { SWIFT_ANDROID_NDK_PATH } " STREQUAL " " ) <nl> endif ( ) <nl> <nl> if ( " $ { SWIFT_SDK_ANDROID_ARCHITECTURES } " STREQUAL " " ) <nl> - set ( SWIFT_SDK_ANDROID_ARCHITECTURES armv7 ; aarch ) <nl> + set ( SWIFT_SDK_ANDROID_ARCHITECTURES armv7 ; aarch64 ) <nl> endif ( ) <nl> configure_sdk_unix ( ANDROID " Android " " android " " android " " $ { SWIFT_SDK_ANDROID_ARCHITECTURES } " " " " " ) <nl> endif ( ) <nl>
build : Fix Android 64 bit architecture name .
apple/swift
8faf237fd8850b084ae5606dfdcee1266021cfaf
2018-10-03T23:30:01Z
mmm a / . jenkins / caffe2 / test . sh <nl> ppp b / . jenkins / caffe2 / test . sh <nl> if [ [ " $ BUILD_ENVIRONMENT " = = * onnx * ] ] ; then <nl> # default pip version is too old ( 9 . 0 . 2 ) , unable to support tag ` manylinux2010 ` . <nl> # Fix the pip error : Couldn ' t find a version that satisfies the requirement <nl> sudo pip install - - upgrade pip <nl> - pip install - q - - user - i https : / / test . pypi . org / simple / ort - nightly = = 1 . 4 . 0 . dev202007311 <nl> + pip install - q - - user - i https : / / test . pypi . org / simple / ort - nightly = = 1 . 4 . 0 . dev202008122 <nl> fi <nl> " $ ROOT_DIR / scripts / onnx / test . sh " <nl> fi <nl>
Update ort - nightly version to dev202008122 ( )
pytorch/pytorch
fd5ed4b6d6049752fd10d20b23482764972dd45b
2020-08-13T18:40:16Z
new file mode 100644 <nl> index 00000000000 . . bbdca228ea1 <nl> mmm / dev / null <nl> ppp b / folly / MoveWrapper . h <nl> <nl> + / * <nl> + * Copyright 2013 Facebook , Inc . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * / <nl> + <nl> + # pragma once <nl> + <nl> + # include < memory > <nl> + <nl> + namespace folly { <nl> + <nl> + / * * C + + 11 closures don ' t support move - in capture . Nor does std : : bind . <nl> + facepalm . <nl> + <nl> + http : / / www . open - std . org / jtc1 / sc22 / wg21 / docs / papers / 2013 / n3610 . html <nl> + <nl> + " [ . . . ] a work - around that should make people ' s stomach crawl : <nl> + write a wrapper that performs move - on - copy , much like the deprecated <nl> + auto_ptr " <nl> + <nl> + Unlike auto_ptr , this doesn ' t require a heap allocation . <nl> + * / <nl> + template < class T > <nl> + class MoveWrapper { <nl> + public : <nl> + / * * If value can be default - constructed , why not ? <nl> + Then we don ' t have to move it in * / <nl> + MoveWrapper ( ) = default ; <nl> + <nl> + / / / Move a value in . <nl> + explicit <nl> + MoveWrapper ( T & & t ) : value ( std : : move ( t ) ) { } <nl> + <nl> + / / / copy is move <nl> + MoveWrapper ( MoveWrapper & other ) : value ( std : : move ( other . value ) ) { } <nl> + <nl> + / / / move is also move <nl> + MoveWrapper ( MoveWrapper & & other ) : value ( std : : move ( other . value ) ) { } <nl> + <nl> + const T & operator * ( ) const { return value ; } <nl> + T & operator * ( ) { return value ; } <nl> + <nl> + const T * operator - > ( ) const { return & value ; } <nl> + T * operator - > ( ) { return & value ; } <nl> + <nl> + / / If you want these you ' re probably doing it wrong , though they ' d be <nl> + / / easy enough to implement <nl> + MoveWrapper & operator = ( MoveWrapper const & ) = delete ; <nl> + MoveWrapper & operator = ( MoveWrapper & & ) = delete ; <nl> + <nl> + private : <nl> + T value ; <nl> + } ; <nl> + <nl> + template < class T > <nl> + MoveWrapper < T > makeMoveWrapper ( T & & t ) { <nl> + return MoveWrapper < T > ( std : : forward < T > ( t ) ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> new file mode 100644 <nl> index 00000000000 . . 4eb4bcbaa31 <nl> mmm / dev / null <nl> ppp b / folly / test / MoveWrapperTest . cpp <nl> <nl> + / * <nl> + * Copyright 2013 Facebook , Inc . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * / <nl> + <nl> + # include < gtest / gtest . h > <nl> + <nl> + # include " folly / MoveWrapper . h " <nl> + # include < memory > <nl> + <nl> + namespace folly { <nl> + <nl> + TEST ( makeMoveWrapper , Empty ) { <nl> + / / checks for crashes <nl> + auto p = makeMoveWrapper ( std : : unique_ptr < int > ( ) ) ; <nl> + } <nl> + <nl> + TEST ( makeMoveWrapper , NonEmpty ) { <nl> + auto u = std : : unique_ptr < int > ( new int ( 5 ) ) ; <nl> + EXPECT_EQ ( * u , 5 ) ; <nl> + auto p = makeMoveWrapper ( std : : move ( u ) ) ; <nl> + EXPECT_TRUE ( ! u ) ; <nl> + EXPECT_EQ ( * * p , 5 ) ; <nl> + } <nl> + <nl> + } / / namespace <nl>
move MoveWrapper to folly
facebook/folly
722ef0f35202ba2451bb9f2fa7ae6faba06f7d4a
2013-11-06T01:35:11Z
mmm a / cmake / OpenCVModule . cmake <nl> ppp b / cmake / OpenCVModule . cmake <nl> macro ( ocv_create_module ) <nl> set ( the_module_target $ { the_module } ) <nl> endif ( ) <nl> <nl> - if ( WINRT ) <nl> + if ( WINRT AND BUILD_TESTS ) <nl> # removing APPCONTAINER from modules to run from console <nl> # in case of usual starting of WinRT test apps output is missing <nl> # so starting of console version w / o APPCONTAINER is required to get test results <nl> mmm a / modules / core / src / utils / datafile . cpp <nl> ppp b / modules / core / src / utils / datafile . cpp <nl> static cv : : String getModuleLocation ( const void * addr ) <nl> CV_UNUSED ( addr ) ; <nl> # ifdef _WIN32 <nl> HMODULE m = 0 ; <nl> - # if _WIN32_WINNT > = 0x0501 <nl> + # if _WIN32_WINNT > = 0x0501 & & ( ! defined ( WINAPI_FAMILY ) | | ( WINAPI_FAMILY = = WINAPI_FAMILY_DESKTOP_APP ) ) <nl> : : GetModuleHandleEx ( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT , <nl> reinterpret_cast < LPCTSTR > ( addr ) , <nl> & m ) ; <nl> mmm a / modules / videoio / src / cap_ffmpeg . cpp <nl> ppp b / modules / videoio / src / cap_ffmpeg . cpp <nl> static cv : : Mutex _icvInitFFMPEG_mutex ; <nl> static const HMODULE cv_GetCurrentModule ( ) <nl> { <nl> HMODULE h = 0 ; <nl> - # if _WIN32_WINNT > = 0x0501 <nl> + # if _WIN32_WINNT > = 0x0501 & & ( ! defined ( WINAPI_FAMILY ) | | ( WINAPI_FAMILY = = WINAPI_FAMILY_DESKTOP_APP ) ) <nl> : : GetModuleHandleEx ( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT , <nl> reinterpret_cast < LPCTSTR > ( cv_GetCurrentModule ) , <nl> & h ) ; <nl> mmm a / modules / videoio / src / cap_winrt / CaptureFrameGrabber . cpp <nl> ppp b / modules / videoio / src / cap_winrt / CaptureFrameGrabber . cpp <nl> Media : : CaptureFrameGrabber : : ~ CaptureFrameGrabber ( ) <nl> <nl> void Media : : CaptureFrameGrabber : : ShowCameraSettings ( ) <nl> { <nl> - # if WINAPI_FAMILY ! = WINAPI_FAMILY_PHONE_APP <nl> + # if ( WINAPI_FAMILY ! = WINAPI_FAMILY_PHONE_APP ) & & ( WINAPI_FAMILY ! = WINAPI_FAMILY_PC_APP ) <nl> if ( _state = = State : : Started ) <nl> { <nl> CameraOptionsUI : : Show ( _capture . Get ( ) ) ; <nl>
Fix build for UWP
opencv/opencv
987bb2ca617eaab61a99da28273f513aef37665d
2019-08-05T14:19:36Z
mmm a / cyber / python / examples / listener . py <nl> ppp b / cyber / python / examples / listener . py <nl> def callback ( data ) : <nl> " " " <nl> Reader message callback . <nl> " " " <nl> - print " = " * 80 <nl> - print " py : reader callback msg - > : " <nl> - print data <nl> - print " = " * 80 <nl> + print ( " = " * 80 ) <nl> + print ( " py : reader callback msg - > : " ) <nl> + print ( data ) <nl> + print ( " = " * 80 ) <nl> <nl> <nl> def test_listener_class ( ) : <nl> " " " <nl> Reader message . <nl> " " " <nl> - print " = " * 120 <nl> + print ( " = " * 120 ) <nl> test_node = cyber . Node ( " listener " ) <nl> - test_node . create_reader ( " channel / chatter " , <nl> - ChatterBenchmark , callback ) <nl> + test_node . create_reader ( " channel / chatter " , ChatterBenchmark , callback ) <nl> test_node . spin ( ) <nl> <nl> if __name__ = = ' __main__ ' : <nl> new file mode 100755 <nl> index 00000000000 . . 3def6e1cc72 <nl> mmm / dev / null <nl> ppp b / cyber / python / examples / listener_py3 . py <nl> <nl> + # ! / usr / bin / env python3 <nl> + <nl> + # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + # Copyright 2019 The Apollo 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> + # - * - coding : utf - 8 - * - <nl> + " " " Module for example of listener . " " " <nl> + <nl> + import sys <nl> + <nl> + sys . path . append ( " . . / " ) <nl> + from cyber_py import cyber_py3 as cyber <nl> + from cyber . proto . unit_test_pb2 import ChatterBenchmark <nl> + <nl> + <nl> + def callback ( data ) : <nl> + " " " <nl> + Reader message callback . <nl> + " " " <nl> + print ( " = " * 80 ) <nl> + print ( " py : reader callback msg - > : " ) <nl> + print ( data ) <nl> + print ( " = " * 80 ) <nl> + <nl> + <nl> + def test_listener_class ( ) : <nl> + " " " <nl> + Reader message . <nl> + " " " <nl> + print ( " = " * 120 ) <nl> + test_node = cyber . Node ( " listener " ) <nl> + test_node . create_reader ( " channel / chatter " , ChatterBenchmark , callback ) <nl> + test_node . spin ( ) <nl> + <nl> + if __name__ = = ' __main__ ' : <nl> + cyber . init ( ) <nl> + test_listener_class ( ) <nl> + cyber . shutdown ( ) <nl>
Cyber : Add listener_py3 example .
ApolloAuto/apollo
e557278eaa339077008a55cd1abf1a4e859d3c7f
2019-11-12T03:19:18Z
mmm a / utils / build - presets . ini <nl> ppp b / utils / build - presets . ini <nl> assertions <nl> test <nl> validation - test <nl> <nl> - llvm - targets - to - build = X86 ; AArch64 ; PowerPC <nl> + llvm - targets - to - build = X86 ; ARM ; AArch64 ; PowerPC <nl> <nl> # Set the vendor to apple <nl> compiler - vendor = apple <nl> mmm a / utils / build - script - impl <nl> ppp b / utils / build - script - impl <nl> KNOWN_SETTINGS = ( <nl> swift - stdlib - enable - assertions " 1 " " enable assertions in Swift " <nl> swift - stdlib - use - nonatomic - rc " 0 " " build the Swift stdlib and overlays with nonatomic reference count operations enabled " <nl> lldb - build - type " Debug " " the CMake build variant for LLDB " <nl> - lldb - build - with - xcode " 1 " " Use xcodebuild to build LLDB , instead of CMake " <nl> + lldb - build - with - xcode " 0 " " Use xcodebuild to build LLDB , instead of CMake " <nl> llbuild - build - type " Debug " " the CMake build variant for llbuild " <nl> foundation - build - type " Debug " " the build variant for Foundation " <nl> libdispatch - build - type " Debug " " the build variant for libdispatch " <nl> mmm a / utils / build_swift / driver_arguments . py <nl> ppp b / utils / build_swift / driver_arguments . py <nl> def _apply_default_arguments ( args ) : <nl> args . lldb_build_variant = args . build_variant <nl> <nl> if args . lldb_build_with_xcode is None : <nl> - args . lldb_build_with_xcode = ' 1 ' <nl> + args . lldb_build_with_xcode = ' 0 ' <nl> <nl> if args . foundation_build_variant is None : <nl> args . foundation_build_variant = args . build_variant <nl> def create_argument_parser ( ) : <nl> help = ' build the Debug variant of LLDB ' ) <nl> <nl> option ( ' - - lldb - build - with - xcode ' , store ( ' lldb_build_with_xcode ' ) , <nl> - const = ' 1 ' , <nl> + const = ' 0 ' , <nl> help = ' build LLDB using xcodebuild , if possible ' ) <nl> <nl> option ( ' - - lldb - build - with - cmake ' , store ( ' lldb_build_with_xcode ' ) , <nl> - const = ' 0 ' , <nl> + const = ' 1 ' , <nl> help = ' build LLDB using CMake ' ) <nl> <nl> option ( ' - - debug - cmark ' , store ( ' cmark_build_variant ' ) , <nl>
[ lldb ] Switch PR testing and build to use CMake by default .
apple/swift
5dec5371733e4668cb16e79610050321cc778536
2019-04-10T22:01:07Z
mmm a / src / arm / builtins - arm . cc <nl> ppp b / src / arm / builtins - arm . cc <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> __ bind ( & enough ) ; <nl> EnterArgumentsAdaptorFrame ( masm ) ; <nl> <nl> - / / Calculate copy start address into r0 and copy end address into r2 . <nl> + / / Calculate copy start address into r0 and copy end address into r4 . <nl> / / r0 : actual number of arguments as a smi <nl> / / r1 : function <nl> / / r2 : expected number of arguments <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> __ add ( r0 , fp , Operand : : PointerOffsetFromSmiKey ( r0 ) ) ; <nl> / / adjust for return address and receiver <nl> __ add ( r0 , r0 , Operand ( 2 * kPointerSize ) ) ; <nl> - __ sub ( r2 , r0 , Operand ( r2 , LSL , kPointerSizeLog2 ) ) ; <nl> + __ sub ( r4 , r0 , Operand ( r2 , LSL , kPointerSizeLog2 ) ) ; <nl> <nl> / / Copy the arguments ( including the receiver ) to the new stack frame . <nl> / / r0 : copy start address <nl> / / r1 : function <nl> - / / r2 : copy end address <nl> + / / r2 : expected number of arguments <nl> / / r3 : code entry to call <nl> + / / r4 : copy end address <nl> <nl> Label copy ; <nl> __ bind ( & copy ) ; <nl> __ ldr ( ip , MemOperand ( r0 , 0 ) ) ; <nl> __ push ( ip ) ; <nl> - __ cmp ( r0 , r2 ) ; / / Compare before moving to next argument . <nl> + __ cmp ( r0 , r4 ) ; / / Compare before moving to next argument . <nl> __ sub ( r0 , r0 , Operand ( kPointerSize ) ) ; <nl> __ b ( ne , & copy ) ; <nl> <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> / / r2 : expected number of arguments <nl> / / r3 : code entry to call <nl> __ LoadRoot ( ip , Heap : : kUndefinedValueRootIndex ) ; <nl> - __ sub ( r2 , fp , Operand ( r2 , LSL , kPointerSizeLog2 ) ) ; <nl> + __ sub ( r4 , fp , Operand ( r2 , LSL , kPointerSizeLog2 ) ) ; <nl> / / Adjust for frame . <nl> - __ sub ( r2 , r2 , Operand ( StandardFrameConstants : : kFixedFrameSizeFromFp + <nl> + __ sub ( r4 , r4 , Operand ( StandardFrameConstants : : kFixedFrameSizeFromFp + <nl> 2 * kPointerSize ) ) ; <nl> <nl> Label fill ; <nl> __ bind ( & fill ) ; <nl> __ push ( ip ) ; <nl> - __ cmp ( sp , r2 ) ; <nl> + __ cmp ( sp , r4 ) ; <nl> __ b ( ne , & fill ) ; <nl> } <nl> <nl> / / Call the entry point . <nl> __ bind ( & invoke ) ; <nl> + __ mov ( r0 , r2 ) ; <nl> + / / r0 : expected number of arguments <nl> + / / r1 : function ( passed through to callee ) <nl> __ Call ( r3 ) ; <nl> <nl> / / Store offset of return address for deoptimizer . <nl> mmm a / src / arm64 / builtins - arm64 . cc <nl> ppp b / src / arm64 / builtins - arm64 . cc <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> Register copy_to = x12 ; <nl> Register scratch1 = x13 , scratch2 = x14 ; <nl> <nl> - __ Lsl ( argc_expected , argc_expected , kPointerSizeLog2 ) ; <nl> + __ Lsl ( scratch2 , argc_expected , kPointerSizeLog2 ) ; <nl> <nl> / / Adjust for fp , lr , and the receiver . <nl> __ Add ( copy_start , fp , 3 * kPointerSize ) ; <nl> __ Add ( copy_start , copy_start , Operand ( argc_actual , LSL , kPointerSizeLog2 ) ) ; <nl> - __ Sub ( copy_end , copy_start , argc_expected ) ; <nl> + __ Sub ( copy_end , copy_start , scratch2 ) ; <nl> __ Sub ( copy_end , copy_end , kPointerSize ) ; <nl> __ Mov ( copy_to , jssp ) ; <nl> <nl> / / Claim space for the arguments , the receiver , and one extra slot . <nl> / / The extra slot ensures we do not write under jssp . It will be popped <nl> / / later . <nl> - __ Add ( scratch1 , argc_expected , 2 * kPointerSize ) ; <nl> + __ Add ( scratch1 , scratch2 , 2 * kPointerSize ) ; <nl> __ Claim ( scratch1 , 1 ) ; <nl> <nl> / / Copy the arguments ( including the receiver ) to the new stack frame . <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> __ Bind ( & no_strong_error ) ; <nl> EnterArgumentsAdaptorFrame ( masm ) ; <nl> <nl> - __ Lsl ( argc_expected , argc_expected , kPointerSizeLog2 ) ; <nl> + __ Lsl ( scratch2 , argc_expected , kPointerSizeLog2 ) ; <nl> __ Lsl ( argc_actual , argc_actual , kPointerSizeLog2 ) ; <nl> <nl> / / Adjust for fp , lr , and the receiver . <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> / / Claim space for the arguments , the receiver , and one extra slot . <nl> / / The extra slot ensures we do not write under jssp . It will be popped <nl> / / later . <nl> - __ Add ( scratch1 , argc_expected , 2 * kPointerSize ) ; <nl> + __ Add ( scratch1 , scratch2 , 2 * kPointerSize ) ; <nl> __ Claim ( scratch1 , 1 ) ; <nl> <nl> / / Copy the arguments ( including the receiver ) to the new stack frame . <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> <nl> / / Arguments have been adapted . Now call the entry point . <nl> __ Bind ( & invoke ) ; <nl> + __ Mov ( argc_actual , argc_expected ) ; <nl> + / / x0 : expected number of arguments <nl> + / / x1 : function ( passed through to callee ) <nl> __ Call ( code_entry ) ; <nl> <nl> / / Store offset of return address for deoptimizer . <nl> mmm a / src / ia32 / builtins - ia32 . cc <nl> ppp b / src / ia32 / builtins - ia32 . cc <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> <nl> / / Copy receiver and all expected arguments . <nl> const int offset = StandardFrameConstants : : kCallerSPOffset ; <nl> - __ lea ( eax , Operand ( ebp , eax , times_4 , offset ) ) ; <nl> - __ mov ( edi , - 1 ) ; / / account for receiver <nl> + __ lea ( edi , Operand ( ebp , eax , times_4 , offset ) ) ; <nl> + __ mov ( eax , - 1 ) ; / / account for receiver <nl> <nl> Label copy ; <nl> __ bind ( & copy ) ; <nl> - __ inc ( edi ) ; <nl> - __ push ( Operand ( eax , 0 ) ) ; <nl> - __ sub ( eax , Immediate ( kPointerSize ) ) ; <nl> - __ cmp ( edi , ebx ) ; <nl> + __ inc ( eax ) ; <nl> + __ push ( Operand ( edi , 0 ) ) ; <nl> + __ sub ( edi , Immediate ( kPointerSize ) ) ; <nl> + __ cmp ( eax , ebx ) ; <nl> __ j ( less , & copy ) ; <nl> + / / eax now contains the expected number of arguments . <nl> __ jmp ( & invoke ) ; <nl> } <nl> <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> __ bind ( & no_strong_error ) ; <nl> EnterArgumentsAdaptorFrame ( masm ) ; <nl> <nl> + / / Remember expected arguments in ecx . <nl> + __ mov ( ecx , ebx ) ; <nl> + <nl> / / Copy receiver and all actual arguments . <nl> const int offset = StandardFrameConstants : : kCallerSPOffset ; <nl> __ lea ( edi , Operand ( ebp , eax , times_4 , offset ) ) ; <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> __ push ( Immediate ( masm - > isolate ( ) - > factory ( ) - > undefined_value ( ) ) ) ; <nl> __ cmp ( eax , ebx ) ; <nl> __ j ( less , & fill ) ; <nl> + <nl> + / / Restore expected arguments . <nl> + __ mov ( eax , ecx ) ; <nl> } <nl> <nl> / / Call the entry point . <nl> __ bind ( & invoke ) ; <nl> / / Restore function pointer . <nl> __ mov ( edi , Operand ( ebp , JavaScriptFrameConstants : : kFunctionOffset ) ) ; <nl> + / / eax : expected number of arguments <nl> + / / edi : function ( passed through to callee ) <nl> __ call ( edx ) ; <nl> <nl> / / Store offset of return address for deoptimizer . <nl> mmm a / src / x64 / builtins - x64 . cc <nl> ppp b / src / x64 / builtins - x64 . cc <nl> void Builtins : : Generate_ArgumentsAdaptorTrampoline ( MacroAssembler * masm ) { <nl> <nl> / / Call the entry point . <nl> __ bind ( & invoke ) ; <nl> + __ movp ( rax , rbx ) ; <nl> + / / rax : expected number of arguments <nl> + / / rdi : function ( passed through to callee ) <nl> __ call ( rdx ) ; <nl> <nl> / / Store offset of return address for deoptimizer . <nl>
[ builtins ] Pass correct number of arguments after adapting arguments .
v8/v8
fbad63669e309e8c5c3f2ecf503df2fefaac79bb
2015-08-31T11:28:59Z
mmm a / src / PeerConnection . cc <nl> ppp b / src / PeerConnection . cc <nl> bool PeerConnection : : receiveMessage ( unsigned char * data , size_t & dataLength ) <nl> else { <nl> assert ( resbufOffset_ = = resbufLength_ ) ; <nl> if ( resbufLength_ ! = 0 ) { <nl> - / / Shift buffer so that resbuf_ [ msgOffset_ ] moves to <nl> - / / rebuf_ [ 0 ] . <nl> - memmove ( resbuf_ . get ( ) , resbuf_ . get ( ) + msgOffset_ , <nl> - resbufLength_ - msgOffset_ ) ; <nl> - resbufLength_ - = msgOffset_ ; <nl> - resbufOffset_ = resbufLength_ ; <nl> - msgOffset_ = 0 ; <nl> + if ( msgOffset_ = = 0 & & resbufLength_ = = currentPayloadLength_ + 4 ) { <nl> + / / All bytes in buffer have been processed , so clear it <nl> + / / away . <nl> + resbufLength_ = 0 ; <nl> + resbufOffset_ = 0 ; <nl> + msgOffset_ = 0 ; <nl> + } <nl> + else { <nl> + / / Shift buffer so that resbuf_ [ msgOffset_ ] moves to <nl> + / / rebuf_ [ 0 ] . <nl> + memmove ( resbuf_ . get ( ) , resbuf_ . get ( ) + msgOffset_ , <nl> + resbufLength_ - msgOffset_ ) ; <nl> + resbufLength_ - = msgOffset_ ; <nl> + resbufOffset_ = resbufLength_ ; <nl> + msgOffset_ = 0 ; <nl> + } <nl> } <nl> size_t nread ; <nl> / / To reduce the amount of copy involved in buffer shift , large <nl>
Revert " Remove dead code "
aria2/aria2
2dd10c96456043da0e3a56f7d709f5ecf3ff7c8c
2016-06-12T00:52:58Z
mmm a / python - package / lightgbm / engine . py <nl> ppp b / python - package / lightgbm / engine . py <nl> def train ( params , train_set , num_boost_round = 100 , <nl> " " " <nl> # create predictor first <nl> params = copy . deepcopy ( params ) <nl> + if fobj is not None : <nl> + params [ ' objective ' ] = ' none ' <nl> for alias in [ " num_iterations " , " num_iteration " , " n_iter " , " num_tree " , " num_trees " , <nl> " num_round " , " num_rounds " , " num_boost_round " , " n_estimators " ] : <nl> if alias in params : <nl> def cv ( params , train_set , num_boost_round = 100 , <nl> raise TypeError ( " Traninig only accepts Dataset object " ) <nl> <nl> params = copy . deepcopy ( params ) <nl> + if fobj is not None : <nl> + params [ ' objective ' ] = ' none ' <nl> for alias in [ " num_iterations " , " num_iteration " , " n_iter " , " num_tree " , " num_trees " , <nl> " num_round " , " num_rounds " , " num_boost_round " , " n_estimators " ] : <nl> if alias in params : <nl> mmm a / tests / python_package_test / test_engine . py <nl> ppp b / tests / python_package_test / test_engine . py <nl> <nl> import copy <nl> import math <nl> import os <nl> + import random <nl> import unittest <nl> <nl> import lightgbm as lgb <nl> - import random <nl> import numpy as np <nl> + from scipy . sparse import csr_matrix <nl> from sklearn . datasets import ( load_boston , load_breast_cancer , load_digits , <nl> load_iris , load_svmlight_file ) <nl> from sklearn . metrics import log_loss , mean_absolute_error , mean_squared_error , roc_auc_score <nl> from sklearn . model_selection import train_test_split , TimeSeriesSplit , GroupKFold <nl> - from scipy . sparse import csr_matrix <nl> <nl> try : <nl> import cPickle as pickle <nl> def preprocess_data ( dtrain , dtest , params ) : <nl> results = lgb . cv ( params , dataset , num_boost_round = 10 , fpreproc = preprocess_data ) <nl> self . assertIn ( ' multi_logloss - mean ' , results ) <nl> self . assertEqual ( len ( results [ ' multi_logloss - mean ' ] ) , 10 ) <nl> + <nl> + def test_metrics ( self ) : <nl> + def custom_obj ( preds , train_data ) : <nl> + return np . zeros ( preds . shape ) , np . zeros ( preds . shape ) <nl> + <nl> + def custom_metric ( preds , train_data ) : <nl> + return ' error ' , 0 , False <nl> + <nl> + X , y = load_digits ( 2 , True ) <nl> + X_train , X_test , y_train , y_test = train_test_split ( X , y , test_size = 0 . 1 , random_state = 42 ) <nl> + lgb_train = lgb . Dataset ( X_train , y_train , silent = True ) <nl> + lgb_valid = lgb . Dataset ( X_test , y_test , reference = lgb_train , silent = True ) <nl> + <nl> + evals_result = { } <nl> + params_verbose = { ' verbose ' : - 1 } <nl> + params_obj_verbose = { ' objective ' : ' binary ' , ' verbose ' : - 1 } <nl> + params_obj_metric_log_verbose = { ' objective ' : ' binary ' , ' metric ' : ' binary_logloss ' , ' verbose ' : - 1 } <nl> + params_obj_metric_err_verbose = { ' objective ' : ' binary ' , ' metric ' : ' binary_error ' , ' verbose ' : - 1 } <nl> + params_obj_metric_inv_verbose = { ' objective ' : ' binary ' , ' metric ' : ' invalid_metric ' , ' verbose ' : - 1 } <nl> + params_obj_metric_multi_verbose = { ' objective ' : ' binary ' , <nl> + ' metric ' : [ ' binary_logloss ' , ' binary_error ' ] , <nl> + ' verbose ' : - 1 } <nl> + params_obj_metric_none_verbose = { ' objective ' : ' binary ' , ' metric ' : ' None ' , ' verbose ' : - 1 } <nl> + params_metric_log_verbose = { ' metric ' : ' binary_logloss ' , ' verbose ' : - 1 } <nl> + params_metric_err_verbose = { ' metric ' : ' binary_error ' , ' verbose ' : - 1 } <nl> + params_metric_inv_verbose = { ' metric_types ' : ' invalid_metric ' , ' verbose ' : - 1 } <nl> + params_metric_multi_verbose = { ' metric ' : [ ' binary_logloss ' , ' binary_error ' ] , ' verbose ' : - 1 } <nl> + params_metric_none_verbose = { ' metric ' : ' None ' , ' verbose ' : - 1 } <nl> + <nl> + def get_cv_result ( params = params_obj_verbose , * * kwargs ) : <nl> + return lgb . cv ( params , lgb_train , num_boost_round = 5 , verbose_eval = False , * * kwargs ) <nl> + <nl> + def train_booster ( params = params_obj_verbose , * * kwargs ) : <nl> + lgb . train ( params , lgb_train , <nl> + num_boost_round = 5 , <nl> + valid_sets = [ lgb_valid ] , <nl> + evals_result = evals_result , <nl> + verbose_eval = False , * * kwargs ) <nl> + <nl> + # no fobj , no feval <nl> + # default metric <nl> + res = get_cv_result ( ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + <nl> + # non - default metric in params <nl> + res = get_cv_result ( params = params_obj_metric_err_verbose ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # default metric in args <nl> + res = get_cv_result ( metrics = ' binary_logloss ' ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + <nl> + # non - default metric in args <nl> + res = get_cv_result ( metrics = ' binary_error ' ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # metric in args overwrites one in params <nl> + res = get_cv_result ( params = params_obj_metric_inv_verbose , metrics = ' binary_error ' ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # multiple metrics in params <nl> + res = get_cv_result ( params = params_obj_metric_multi_verbose ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # multiple metrics in args <nl> + res = get_cv_result ( metrics = [ ' binary_logloss ' , ' binary_error ' ] ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # remove default metric by ' None ' in list <nl> + res = get_cv_result ( metrics = [ ' None ' ] ) <nl> + self . assertEqual ( len ( res ) , 0 ) <nl> + <nl> + # remove default metric by ' None ' aliases <nl> + for na_alias in ( ' None ' , ' na ' , ' null ' , ' custom ' ) : <nl> + res = get_cv_result ( metrics = na_alias ) <nl> + self . assertEqual ( len ( res ) , 0 ) <nl> + <nl> + # fobj , no feval <nl> + # no default metric <nl> + res = get_cv_result ( params = params_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( res ) , 0 ) <nl> + <nl> + # metric in params <nl> + res = get_cv_result ( params = params_metric_err_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # metric in args <nl> + res = get_cv_result ( params = params_verbose , fobj = custom_obj , metrics = ' binary_error ' ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # metric in args overwrites its ' alias in params <nl> + res = get_cv_result ( params = params_metric_inv_verbose , fobj = custom_obj , metrics = ' binary_error ' ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # multiple metrics in params <nl> + res = get_cv_result ( params = params_metric_multi_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # multiple metrics in args <nl> + res = get_cv_result ( params = params_verbose , fobj = custom_obj , <nl> + metrics = [ ' binary_logloss ' , ' binary_error ' ] ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + <nl> + # no fobj , feval <nl> + # default metric with custom one <nl> + res = get_cv_result ( feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # non - default metric in params with custom one <nl> + res = get_cv_result ( params = params_obj_metric_err_verbose , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # default metric in args with custom one <nl> + res = get_cv_result ( metrics = ' binary_logloss ' , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # non - default metric in args with custom one <nl> + res = get_cv_result ( metrics = ' binary_error ' , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # metric in args overwrites one in params , custom one is evaluated too <nl> + res = get_cv_result ( params = params_obj_metric_inv_verbose , metrics = ' binary_error ' , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # multiple metrics in params with custom one <nl> + res = get_cv_result ( params = params_obj_metric_multi_verbose , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 6 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # multiple metrics in args with custom one <nl> + res = get_cv_result ( metrics = [ ' binary_logloss ' , ' binary_error ' ] , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 6 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # custom metric is evaluated despite ' None ' is passed <nl> + res = get_cv_result ( metrics = [ ' None ' ] , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # fobj , feval <nl> + # no default metric , only custom one <nl> + res = get_cv_result ( params = params_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # metric in params with custom one <nl> + res = get_cv_result ( params = params_metric_err_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # metric in args with custom one <nl> + res = get_cv_result ( params = params_verbose , fobj = custom_obj , <nl> + feval = custom_metric , metrics = ' binary_error ' ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # metric in args overwrites one in params , custom one is evaluated too <nl> + res = get_cv_result ( params = params_metric_inv_verbose , fobj = custom_obj , <nl> + feval = custom_metric , metrics = ' binary_error ' ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # multiple metrics in params with custom one <nl> + res = get_cv_result ( params = params_metric_multi_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 6 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # multiple metrics in args with custom one <nl> + res = get_cv_result ( params = params_verbose , fobj = custom_obj , feval = custom_metric , <nl> + metrics = [ ' binary_logloss ' , ' binary_error ' ] ) <nl> + self . assertEqual ( len ( res ) , 6 ) <nl> + self . assertIn ( ' binary_logloss - mean ' , res ) <nl> + self . assertIn ( ' binary_error - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # custom metric is evaluated despite ' None ' is passed <nl> + res = get_cv_result ( params = params_metric_none_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + <nl> + # no fobj , no feval <nl> + # default metric <nl> + train_booster ( ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 1 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # default metric in params <nl> + train_booster ( params = params_obj_metric_log_verbose ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 1 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # non - default metric in params <nl> + train_booster ( params = params_obj_metric_err_verbose ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 1 ) <nl> + self . assertIn ( ' binary_error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # multiple metrics in params <nl> + train_booster ( params = params_obj_metric_multi_verbose ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 2 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' binary_error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # remove default metric by ' None ' aliases <nl> + for na_alias in ( ' None ' , ' na ' , ' null ' , ' custom ' ) : <nl> + params = { ' objective ' : ' binary ' , ' metric ' : na_alias , ' verbose ' : - 1 } <nl> + train_booster ( params = params ) <nl> + self . assertEqual ( len ( evals_result ) , 0 ) <nl> + <nl> + # fobj , no feval <nl> + # no default metric <nl> + train_booster ( params = params_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( evals_result ) , 0 ) <nl> + <nl> + # metric in params <nl> + train_booster ( params = params_metric_log_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 1 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # multiple metrics in params <nl> + train_booster ( params = params_metric_multi_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 2 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' binary_error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # no fobj , feval <nl> + # default metric with custom one <nl> + train_booster ( feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 2 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # default metric in params with custom one <nl> + train_booster ( params = params_obj_metric_log_verbose , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 2 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # non - default metric in params with custom one <nl> + train_booster ( params = params_obj_metric_err_verbose , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 2 ) <nl> + self . assertIn ( ' binary_error ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # multiple metrics in params with custom one <nl> + train_booster ( params = params_obj_metric_multi_verbose , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 3 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' binary_error ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # custom metric is evaluated despite ' None ' is passed <nl> + train_booster ( params = params_obj_metric_none_verbose , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result ) , 1 ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # fobj , feval <nl> + # no default metric , only custom one <nl> + train_booster ( params = params_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 1 ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # metric in params with custom one <nl> + train_booster ( params = params_metric_log_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 2 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # multiple metrics in params with custom one <nl> + train_booster ( params = params_metric_multi_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result [ ' valid_0 ' ] ) , 3 ) <nl> + self . assertIn ( ' binary_logloss ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' binary_error ' , evals_result [ ' valid_0 ' ] ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + # custom metric is evaluated despite ' None ' is passed <nl> + train_booster ( params = params_metric_none_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( evals_result ) , 1 ) <nl> + self . assertIn ( ' error ' , evals_result [ ' valid_0 ' ] ) <nl> + <nl> + X , y = load_digits ( 3 , True ) <nl> + lgb_train = lgb . Dataset ( X , y , silent = True ) <nl> + <nl> + obj_multi_aliases = [ ' multiclass ' , ' softmax ' , ' multiclassova ' , ' multiclass_ova ' , ' ova ' , ' ovr ' ] <nl> + for obj_multi_alias in obj_multi_aliases : <nl> + params_obj_class_3_verbose = { ' objective ' : obj_multi_alias , ' num_class ' : 3 , ' verbose ' : - 1 } <nl> + params_obj_class_1_verbose = { ' objective ' : obj_multi_alias , ' num_class ' : 1 , ' verbose ' : - 1 } <nl> + params_obj_verbose = { ' objective ' : obj_multi_alias , ' verbose ' : - 1 } <nl> + # multiclass default metric <nl> + res = get_cv_result ( params_obj_class_3_verbose ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' multi_logloss - mean ' , res ) <nl> + # multiclass default metric with custom one <nl> + res = get_cv_result ( params_obj_class_3_verbose , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 4 ) <nl> + self . assertIn ( ' multi_logloss - mean ' , res ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + # multiclass metric alias with custom one for custom objective <nl> + res = get_cv_result ( params_obj_class_3_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + # no metric for invalid class_num <nl> + res = get_cv_result ( params_obj_class_1_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( res ) , 0 ) <nl> + # custom metric for invalid class_num <nl> + res = get_cv_result ( params_obj_class_1_verbose , fobj = custom_obj , feval = custom_metric ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' error - mean ' , res ) <nl> + # multiclass metric alias with custom one with invalid class_num <nl> + self . assertRaises ( lgb . basic . LightGBMError , get_cv_result , <nl> + params_obj_class_1_verbose , metrics = obj_multi_alias , <nl> + fobj = custom_obj , feval = custom_metric ) <nl> + # multiclass default metric without num_class <nl> + self . assertRaises ( lgb . basic . LightGBMError , get_cv_result , <nl> + params_obj_verbose ) <nl> + for metric_multi_alias in obj_multi_aliases + [ ' multi_logloss ' ] : <nl> + # multiclass metric alias <nl> + res = get_cv_result ( params_obj_class_3_verbose , metrics = metric_multi_alias ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' multi_logloss - mean ' , res ) <nl> + # multiclass metric <nl> + res = get_cv_result ( params_obj_class_3_verbose , metrics = ' multi_error ' ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' multi_error - mean ' , res ) <nl> + # non - valid metric for multiclass objective <nl> + self . assertRaises ( lgb . basic . LightGBMError , get_cv_result , <nl> + params_obj_class_3_verbose , metrics = ' binary_logloss ' ) <nl> + params_class_3_verbose = { ' num_class ' : 3 , ' verbose ' : - 1 } <nl> + # non - default num_class for default objective <nl> + self . assertRaises ( lgb . basic . LightGBMError , get_cv_result , <nl> + params_class_3_verbose ) <nl> + # no metric with non - default num_class for custom objective <nl> + res = get_cv_result ( params_class_3_verbose , fobj = custom_obj ) <nl> + self . assertEqual ( len ( res ) , 0 ) <nl> + for metric_multi_alias in obj_multi_aliases + [ ' multi_logloss ' ] : <nl> + # multiclass metric alias for custom objective <nl> + res = get_cv_result ( params_class_3_verbose , metrics = metric_multi_alias , fobj = custom_obj ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' multi_logloss - mean ' , res ) <nl> + # multiclass metric for custom objective <nl> + res = get_cv_result ( params_class_3_verbose , metrics = ' multi_error ' , fobj = custom_obj ) <nl> + self . assertEqual ( len ( res ) , 2 ) <nl> + self . assertIn ( ' multi_error - mean ' , res ) <nl> + # binary metric with non - default num_class for custom objective <nl> + self . assertRaises ( lgb . basic . LightGBMError , get_cv_result , <nl> + params_class_3_verbose , metrics = ' binary_error ' , fobj = custom_obj ) <nl> mmm a / tests / python_package_test / test_sklearn . py <nl> ppp b / tests / python_package_test / test_sklearn . py <nl> def test_evaluate_train_set ( self ) : <nl> X_train , X_test , y_train , y_test = train_test_split ( X , y , test_size = 0 . 1 , random_state = 42 ) <nl> gbm = lgb . LGBMRegressor ( n_estimators = 10 , silent = True ) <nl> gbm . fit ( X_train , y_train , eval_set = [ ( X_train , y_train ) , ( X_test , y_test ) ] , verbose = False ) <nl> + self . assertEqual ( len ( gbm . evals_result_ ) , 2 ) <nl> self . assertIn ( ' training ' , gbm . evals_result_ ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> self . assertIn ( ' valid_1 ' , gbm . evals_result_ ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' valid_1 ' ] ) , 1 ) <nl> self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' valid_1 ' ] ) <nl> + <nl> + def test_metrics ( self ) : <nl> + def custom_obj ( y_true , y_pred ) : <nl> + return np . zeros ( y_true . shape ) , np . zeros ( y_true . shape ) <nl> + <nl> + def custom_metric ( y_true , y_pred ) : <nl> + return ' error ' , 0 , False <nl> + <nl> + X , y = load_boston ( True ) <nl> + params = { ' n_estimators ' : 5 , ' verbose ' : - 1 } <nl> + params_fit = { ' X ' : X , ' y ' : y , ' eval_set ' : ( X , y ) , ' verbose ' : False } <nl> + <nl> + # no custom objective , no custom metric <nl> + # default metric <nl> + gbm = lgb . LGBMRegressor ( * * params ) . fit ( * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric <nl> + gbm = lgb . LGBMRegressor ( metric = ' mape ' , * * params ) . fit ( * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # no metric <nl> + gbm = lgb . LGBMRegressor ( metric = ' None ' , * * params ) . fit ( * * params_fit ) <nl> + self . assertIs ( gbm . evals_result_ , None ) <nl> + <nl> + # non - default metric in eval_metric <nl> + gbm = lgb . LGBMRegressor ( * * params ) . fit ( eval_metric = ' mape ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric with non - default metric in eval_metric <nl> + gbm = lgb . LGBMRegressor ( metric = ' gamma ' , * * params ) . fit ( eval_metric = ' mape ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric with multiple metrics in eval_metric <nl> + gbm = lgb . LGBMRegressor ( metric = ' gamma ' , <nl> + * * params ) . fit ( eval_metric = [ ' l2 ' , ' mape ' ] , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 3 ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # default metric for non - default objective <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , * * params ) . fit ( * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric for non - default objective <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , metric = ' mape ' , <nl> + * * params ) . fit ( * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # no metric <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , metric = ' None ' , <nl> + * * params ) . fit ( * * params_fit ) <nl> + self . assertIs ( gbm . evals_result_ , None ) <nl> + <nl> + # non - default metric in eval_metric for non - default objective <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , <nl> + * * params ) . fit ( eval_metric = ' mape ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric with non - default metric in eval_metric for non - default objective <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , metric = ' gamma ' , <nl> + * * params ) . fit ( eval_metric = ' mape ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric with multiple metrics in eval_metric for non - default objective <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , metric = ' gamma ' , <nl> + * * params ) . fit ( eval_metric = [ ' l2 ' , ' mape ' ] , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 3 ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # custom objective , no custom metric <nl> + # default regression metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , * * params ) . fit ( * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default regression metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = ' mape ' , * * params ) . fit ( * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # multiple regression metrics for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = [ ' l1 ' , ' gamma ' ] , <nl> + * * params ) . fit ( * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # no metric <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = ' None ' , <nl> + * * params ) . fit ( * * params_fit ) <nl> + self . assertIs ( gbm . evals_result_ , None ) <nl> + <nl> + # default regression metric with non - default metric in eval_metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , <nl> + * * params ) . fit ( eval_metric = ' mape ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default regression metric with metric in eval_metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = ' mape ' , <nl> + * * params ) . fit ( eval_metric = ' gamma ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # multiple regression metrics with metric in eval_metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = [ ' l1 ' , ' gamma ' ] , <nl> + * * params ) . fit ( eval_metric = ' l2 ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 3 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # multiple regression metrics with multiple metrics in eval_metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = [ ' l1 ' , ' gamma ' ] , <nl> + * * params ) . fit ( eval_metric = [ ' l2 ' , ' mape ' ] , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 4 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # no custom objective , custom metric <nl> + # default metric with custom metric <nl> + gbm = lgb . LGBMRegressor ( * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric with custom metric <nl> + gbm = lgb . LGBMRegressor ( metric = ' mape ' , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # multiple metrics with custom metric <nl> + gbm = lgb . LGBMRegressor ( metric = [ ' l1 ' , ' gamma ' ] , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 3 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # custom metric ( disable default metric ) <nl> + gbm = lgb . LGBMRegressor ( metric = ' None ' , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # default metric for non - default objective with custom metric <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default metric for non - default objective with custom metric <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , metric = ' mape ' , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # multiple metrics for non - default objective with custom metric <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , metric = [ ' l1 ' , ' gamma ' ] , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 3 ) <nl> + self . assertIn ( ' l1 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' gamma ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # custom metric ( disable default metric for non - default objective ) <nl> + gbm = lgb . LGBMRegressor ( objective = ' regression_l1 ' , metric = ' None ' , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # custom objective , custom metric <nl> + # custom metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # non - default regression metric with custom metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = ' mape ' , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # multiple regression metrics with custom metric for custom objective <nl> + gbm = lgb . LGBMRegressor ( objective = custom_obj , metric = [ ' l2 ' , ' mape ' ] , <nl> + * * params ) . fit ( eval_metric = custom_metric , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 3 ) <nl> + self . assertIn ( ' l2 ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' mape ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + X , y = load_digits ( 3 , True ) <nl> + params_fit = { ' X ' : X , ' y ' : y , ' eval_set ' : ( X , y ) , ' verbose ' : False } <nl> + <nl> + # default metric and invalid binary metric is replaced with multiclass alternative <nl> + gbm = lgb . LGBMClassifier ( * * params ) . fit ( eval_metric = ' binary_error ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' multi_logloss ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' multi_error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # invalid objective is replaced with default multiclass one <nl> + # and invalid binary metric is replaced with multiclass alternative <nl> + gbm = lgb . LGBMClassifier ( objective = ' invalid_obj ' , <nl> + * * params ) . fit ( eval_metric = ' binary_error ' , * * params_fit ) <nl> + self . assertEqual ( gbm . objective_ , ' multiclass ' ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' multi_logloss ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' multi_error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # default metric for non - default multiclass objective <nl> + # and invalid binary metric is replaced with multiclass alternative <nl> + gbm = lgb . LGBMClassifier ( objective = ' ovr ' , <nl> + * * params ) . fit ( eval_metric = ' binary_error ' , * * params_fit ) <nl> + self . assertEqual ( gbm . objective_ , ' ovr ' ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' multi_logloss ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' multi_error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + X , y = load_digits ( 2 , True ) <nl> + params_fit = { ' X ' : X , ' y ' : y , ' eval_set ' : ( X , y ) , ' verbose ' : False } <nl> + <nl> + # default metric and invalid multiclass metric is replaced with binary alternative <nl> + gbm = lgb . LGBMClassifier ( * * params ) . fit ( eval_metric = ' multi_error ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 2 ) <nl> + self . assertIn ( ' binary_logloss ' , gbm . evals_result_ [ ' training ' ] ) <nl> + self . assertIn ( ' binary_error ' , gbm . evals_result_ [ ' training ' ] ) <nl> + <nl> + # invalid multiclass metric is replaced with binary alternative for custom objective <nl> + gbm = lgb . LGBMClassifier ( objective = custom_obj , <nl> + * * params ) . fit ( eval_metric = ' multi_logloss ' , * * params_fit ) <nl> + self . assertEqual ( len ( gbm . evals_result_ [ ' training ' ] ) , 1 ) <nl> + self . assertIn ( ' binary_logloss ' , gbm . evals_result_ [ ' training ' ] ) <nl>
[ tests ] [ python ] added tests for metrics ' behavior and fixed case for multiclass task with custom objective ( )
microsoft/LightGBM
f9a1465dd44e492ea526be2ab4af77795457c122
2019-01-27T12:20:05Z
mmm a / lib / Sema / CSBindings . cpp <nl> ppp b / lib / Sema / CSBindings . cpp <nl> ConstraintSystem : : getPotentialBindings ( TypeVariableType * typeVar ) { <nl> case ConstraintKind : : ArgumentConversion : <nl> case ConstraintKind : : OperatorArgumentConversion : <nl> case ConstraintKind : : OptionalObject : { <nl> + / / If there is a ` bind param ` constraint associated with <nl> + / / current type variable , result should be aware of that <nl> + / / fact . Binding set might be incomplete until <nl> + / / this constraint is resolved , because we currently don ' t <nl> + / / look - through constraints expect to ` subtype ` to try and <nl> + / / find related bindings . <nl> + / / This only affects type variable that appears one the <nl> + / / right - hand side of the ` bind param ` constraint and <nl> + / / represents result type of the closure body , because <nl> + / / left - hand side gets types from overload choices . <nl> + if ( constraint - > getKind ( ) = = ConstraintKind : : BindParam & & <nl> + constraint - > getSecondType ( ) - > isEqual ( typeVar ) ) <nl> + result . PotentiallyIncomplete = true ; <nl> + <nl> auto binding = getPotentialBindingForRelationalConstraint ( <nl> result , constraint , hasDependentMemberRelationalConstraints , <nl> hasNonDependentMemberRelationalConstraints , <nl> mmm a / lib / Sema / ConstraintSystem . h <nl> ppp b / lib / Sema / ConstraintSystem . h <nl> class ConstraintSystem { <nl> / / / Whether the bindings of this type involve other type variables . <nl> bool InvolvesTypeVariables = false ; <nl> <nl> + / / / Whether the bindings represent ( potentially ) incomplete set , <nl> + / / / there is no way to say with absolute certainty if that ' s the <nl> + / / / case , but that could happen when certain constraints like <nl> + / / / ` bind param ` are present in the system . <nl> + bool PotentiallyIncomplete = false ; <nl> + <nl> / / / Whether this type variable has literal bindings . <nl> LiteralBindingKind LiteralBinding = LiteralBindingKind : : None ; <nl> <nl> class ConstraintSystem { <nl> if ( formBindingScore ( y ) < formBindingScore ( x ) ) <nl> return false ; <nl> <nl> - / / If the only difference is default types , <nl> + / / If there is a difference in number of default types , <nl> / / prioritize bindings with fewer of them . <nl> - return x . NumDefaultableBindings < y . NumDefaultableBindings ; <nl> + if ( x . NumDefaultableBindings ! = y . NumDefaultableBindings ) <nl> + return x . NumDefaultableBindings < y . NumDefaultableBindings ; <nl> + <nl> + / / As a last resort , let ' s check if the bindings are <nl> + / / potentially incomplete , and if so , let ' s de - prioritize them . <nl> + return x . PotentiallyIncomplete < y . PotentiallyIncomplete ; <nl> } <nl> <nl> void foundLiteralBinding ( ProtocolDecl * proto ) { <nl> class ConstraintSystem { <nl> void dump ( llvm : : raw_ostream & out , <nl> unsigned indent = 0 ) const LLVM_ATTRIBUTE_USED { <nl> out . indent ( indent ) ; <nl> + if ( PotentiallyIncomplete ) <nl> + out < < " potentially_incomplete " ; <nl> if ( FullyBound ) <nl> out < < " fully_bound " ; <nl> if ( SubtypeOfExistentialType ) <nl> mmm a / test / Constraints / closures . swift <nl> ppp b / test / Constraints / closures . swift <nl> func rdar_40537960 ( ) { <nl> _ = A ( arr , fn : { L ( $ 0 . v ) } ) / / expected - error { { cannot convert value of type ' L ' to closure result type ' R < T > ' } } <nl> } <nl> <nl> + / / rdar : / / problem / 45659733 <nl> + func rdar_45659733 ( ) { <nl> + func foo < T : BinaryInteger > ( _ : AnyHashable , _ : T ) { } <nl> + func bar ( _ a : Int , _ b : Int ) { <nl> + _ = ( a . . < b ) . map { i in foo ( i , i ) } / / Ok <nl> + } <nl> + <nl> + struct S < V > { <nl> + func map < T > ( <nl> + get : @ escaping ( V ) - > T , <nl> + set : @ escaping ( inout V , T ) - > Void <nl> + ) - > S < T > { <nl> + fatalError ( ) <nl> + } <nl> + <nl> + subscript < T > ( <nl> + keyPath : WritableKeyPath < V , T ? > , <nl> + default defaultValue : T <nl> + ) - > S < T > { <nl> + return map ( <nl> + get : { $ 0 [ keyPath : keyPath ] ? ? defaultValue } , <nl> + set : { $ 0 [ keyPath : keyPath ] = $ 1 } <nl> + ) / / Ok , make sure that we deduce result to be S < T > <nl> + } <nl> + } <nl> + } <nl>
[ CSBindings ] Detect situations when type variable bindings could be incomplete
apple/swift
fa1e2d33aa9ffa2996a6788c891c929020fa9743
2018-11-09T23:27:27Z
Binary files a / data / skins / default / sheet . png and b / data / skins / default / sheet . png differ <nl> mmm a / src / skin / skin_theme . cpp <nl> ppp b / src / skin / skin_theme . cpp <nl> void SkinTheme : : paintSlider ( PaintEvent & ev ) <nl> int min , max , value ; <nl> char buf [ 256 ] ; <nl> <nl> + / / Outside borders <nl> + ui : : Color bgcolor = widget - > getBgColor ( ) ; <nl> + if ( ! is_transparent ( bgcolor ) ) <nl> + jdraw_rectfill ( widget - > rc , bgcolor ) ; <nl> + <nl> widget - > getSliderThemeInfo ( & min , & max , & value ) ; <nl> <nl> Rect rc ( widget - > getClientBounds ( ) . shrink ( widget - > getBorder ( ) ) ) ; <nl> mmm a / src / ui / int_entry . cpp <nl> ppp b / src / ui / int_entry . cpp <nl> void IntEntry : : openPopup ( ) <nl> m_popupWindow = new PopupWindow ( NULL , false ) ; <nl> m_popupWindow - > setAutoRemap ( false ) ; <nl> m_popupWindow - > setBounds ( rc ) ; <nl> + m_popupWindow - > setBgColor ( rgba ( 0 , 0 , 0 , 0 ) ) ; <nl> <nl> Region rgn ( rc . createUnion ( getBounds ( ) ) ) ; <nl> rgn . createUnion ( rgn , Region ( getBounds ( ) ) ) ; <nl>
Add support for transparent background color for ui : : Slider to draw ui : : IntEntry popup window without background
aseprite/aseprite
fd6e4ccc212bb009e27dbd9fc7f17e1ba22581b8
2013-04-04T00:17:12Z
mmm a / . bazelrc <nl> ppp b / . bazelrc <nl> build : windows - - dynamic_mode = off <nl> <nl> try - import % workspace % / clang . bazelrc <nl> try - import % workspace % / user . bazelrc <nl> + try - import % workspace % / local_tsan . bazelrc <nl> mmm a / bazel / README . md <nl> ppp b / bazel / README . md <nl> If you have clang - 5 . 0 or newer , additional checks are provided with : <nl> bazel test - c dbg - - config = clang - asan / / test / . . . <nl> ` ` ` <nl> <nl> - Similarly , for [ thread sanitizer ( TSAN ) ] ( https : / / github . com / google / sanitizers / wiki / ThreadSanitizerCppManual ) testing : <nl> + [ Thread sanitizer ( TSAN ) ] ( https : / / github . com / google / sanitizers / wiki / ThreadSanitizerCppManual ) tests rely on <nl> + a TSAN - instrumented version of libc + + and can be run under the docker sandbox : <nl> <nl> ` ` ` <nl> - bazel test - c dbg - - config = clang - tsan / / test / . . . <nl> + bazel test - c dbg - - config = docker - tsan / / test / . . . <nl> + ` ` ` <nl> + <nl> + Alternatively , you can build a local copy of TSAN - instrumented libc + + . Follow the [ quick start ] ( # quick - start - bazel - build - for - developers ) instruction to setup Clang + LLVM environment . Download LLVM sources from the [ LLVM official site ] ( https : / / github . com / llvm / llvm - project ) <nl> + <nl> + ` ` ` <nl> + curl - sSfL " https : / / github . com / llvm / llvm - project / archive / llvmorg - 10 . 0 . 0 . tar . gz " | tar zx <nl> + <nl> + ` ` ` <nl> + <nl> + Configure and build a TSAN - instrumented libc + + . Please note that ` LLVM_USE_SANITIZER = Thread ` preprocessor definition is used to enable TSAN instrumentation , and ` CMAKE_INSTALL_PREFIX = " / opt / libcxx_tsan " ` defines the installation directory path . <nl> + <nl> + ` ` ` <nl> + mkdir tsan <nl> + pushd tsan <nl> + <nl> + cmake - GNinja - DLLVM_ENABLE_PROJECTS = " libcxxabi ; libcxx " - DLLVM_USE_LINKER = lld - DLLVM_USE_SANITIZER = Thread - DCMAKE_BUILD_TYPE = Release \ <nl> + - DCMAKE_C_COMPILER = clang - DCMAKE_CXX_COMPILER = clang + + - DCMAKE_INSTALL_PREFIX = " / opt / libcxx_tsan " " . . / llvm - project - llvmorg - 10 . 0 . 0 / llvm " <nl> + ninja install - cxx install - cxxabi <nl> + <nl> + rm - rf / opt / libcxx_tsan / include <nl> + ` ` ` <nl> + <nl> + Generate local_tsan . bazelrc containing bazel configuration for tsan tests : <nl> + <nl> + ` ` ` <nl> + bazel / setup_local_tsan . sh < / path / to / instrumented / libc + + / home > <nl> + <nl> + ` ` ` <nl> + <nl> + To execute TSAN tests using the local instrumented libc + + library pass ` - - config = local - tsan ` to bazel : <nl> + <nl> + ` ` ` <nl> + bazel test - - config = local - tsan / / test / . . . <nl> ` ` ` <nl> <nl> For [ memory sanitizer ( MSAN ) ] ( https : / / github . com / google / sanitizers / wiki / MemorySanitizer ) testing , <nl> new file mode 100755 <nl> index 00000000000 . . c805704af9e <nl> mmm / dev / null <nl> ppp b / bazel / setup_local_tsan . sh <nl> <nl> + # ! / bin / bash <nl> + <nl> + BAZELRC_FILE = " $ { BAZELRC_FILE : - $ ( bazel info workspace ) / local_tsan . bazelrc } " <nl> + <nl> + LIBCXX_PREFIX = $ 1 <nl> + <nl> + if [ [ ! - e " $ { LIBCXX_PREFIX } / lib " ] ] ; then <nl> + echo " Error : cannot find / lib in $ { LIBCXX_PREFIX } . " <nl> + exit 1 <nl> + fi <nl> + <nl> + <nl> + echo " # Generated file , do not edit . Delete this file if you no longer use local tsan - instrumented libc + + <nl> + build : local - tsan - - config = libc + + <nl> + build : local - tsan - - config = clang - tsan <nl> + build : local - tsan - - linkopt = - L $ { LIBCXX_PREFIX } / lib <nl> + build : local - tsan - - linkopt = - Wl , - rpath , $ { LIBCXX_PREFIX } / lib <nl> + " > $ { BAZELRC_FILE } <nl> + <nl>
Updated instructions on how to run tsan tests ( )
envoyproxy/envoy
2a0330c6e916e08b74cefefd09541ec644a29b82
2020-08-25T00:40:11Z
mmm a / src / yuzu / game_list_p . h <nl> ppp b / src / yuzu / game_list_p . h <nl> class GameListItemPath : public GameListItem { <nl> if ( ! picture . loadFromData ( picture_data . data ( ) , static_cast < u32 > ( picture_data . size ( ) ) ) ) { <nl> picture = GetDefaultIcon ( size ) ; <nl> } <nl> - picture = picture . scaled ( size , size ) ; <nl> + picture = picture . scaled ( size , size , Qt : : IgnoreAspectRatio , Qt : : SmoothTransformation ) ; <nl> <nl> setData ( picture , Qt : : DecorationRole ) ; <nl> } <nl>
Merge pull request from DarkLordZach / game - list - interpolation
yuzu-emu/yuzu
37bb2c45ee8fe7e54edd2bd5761cfd9803e7e5b4
2018-09-22T02:55:49Z
mmm a / src / core / ext / filters / client_channel / client_channel . c <nl> ppp b / src / core / ext / filters / client_channel / client_channel . c <nl> static void cc_destroy_channel_elem ( grpc_exec_ctx * exec_ctx , <nl> <nl> # define CANCELLED_CALL ( ( grpc_subchannel_call * ) 1 ) <nl> <nl> - typedef enum { <nl> - / * zero so that it can be default - initialized * / <nl> - GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING = 0 , <nl> - GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL <nl> - } subchannel_creation_phase ; <nl> - <nl> / * * Call data . Holds a pointer to grpc_subchannel_call and the <nl> associated machinery to create such a pointer . <nl> Handles queueing of stream ops until a call object is ready , waiting <nl> typedef struct client_channel_call_data { <nl> gpr_atm subchannel_call ; <nl> gpr_arena * arena ; <nl> <nl> - subchannel_creation_phase creation_phase ; <nl> + bool pick_pending ; <nl> grpc_connected_subchannel * connected_subchannel ; <nl> grpc_call_context_element subchannel_call_context [ GRPC_CONTEXT_COUNT ] ; <nl> grpc_polling_entity * pollent ; <nl> static void subchannel_ready_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_call_element * elem = arg ; <nl> call_data * calld = elem - > call_data ; <nl> channel_data * chand = elem - > channel_data ; <nl> - GPR_ASSERT ( calld - > creation_phase = = <nl> - GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL ) ; <nl> + GPR_ASSERT ( calld - > pick_pending ) ; <nl> + calld - > pick_pending = false ; <nl> grpc_polling_entity_del_from_pollset_set ( exec_ctx , calld - > pollent , <nl> chand - > interested_parties ) ; <nl> - calld - > creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING ; <nl> if ( calld - > connected_subchannel = = NULL ) { <nl> gpr_atm_no_barrier_store ( & calld - > subchannel_call , 1 ) ; <nl> fail_locked ( exec_ctx , calld , <nl> static bool pick_subchannel_locked ( <nl> grpc_exec_ctx * exec_ctx , grpc_call_element * elem , <nl> grpc_metadata_batch * initial_metadata , uint32_t initial_metadata_flags , <nl> grpc_connected_subchannel * * connected_subchannel , <nl> - grpc_call_context_element * subchannel_call_context , grpc_closure * on_ready , <nl> - grpc_error * error ) ; <nl> + grpc_call_context_element * subchannel_call_context , grpc_closure * on_ready ) ; <nl> <nl> static void continue_picking_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> grpc_error * error ) { <nl> static void continue_picking_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> if ( pick_subchannel_locked ( <nl> exec_ctx , cpa - > elem , cpa - > initial_metadata , <nl> cpa - > initial_metadata_flags , cpa - > connected_subchannel , <nl> - cpa - > subchannel_call_context , cpa - > on_ready , GRPC_ERROR_NONE ) ) { <nl> + cpa - > subchannel_call_context , cpa - > on_ready ) ) { <nl> grpc_closure_sched ( exec_ctx , cpa - > on_ready , GRPC_ERROR_NONE ) ; <nl> } <nl> } <nl> gpr_free ( cpa ) ; <nl> } <nl> <nl> + static void cancel_pick_locked ( grpc_exec_ctx * exec_ctx , grpc_call_element * elem , <nl> + grpc_error * error ) { <nl> + channel_data * chand = elem - > channel_data ; <nl> + call_data * calld = elem - > call_data ; <nl> + if ( chand - > lb_policy ! = NULL ) { <nl> + grpc_lb_policy_cancel_pick_locked ( exec_ctx , chand - > lb_policy , <nl> + & calld - > connected_subchannel , <nl> + GRPC_ERROR_REF ( error ) ) ; <nl> + } <nl> + for ( grpc_closure * closure = chand - > waiting_for_config_closures . head ; <nl> + closure ! = NULL ; closure = closure - > next_data . next ) { <nl> + continue_picking_args * cpa = closure - > cb_arg ; <nl> + if ( cpa - > connected_subchannel = = & calld - > connected_subchannel ) { <nl> + cpa - > connected_subchannel = NULL ; <nl> + grpc_closure_sched ( exec_ctx , cpa - > on_ready , <nl> + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( <nl> + " Pick cancelled " , & error , 1 ) ) ; <nl> + } <nl> + } <nl> + GRPC_ERROR_UNREF ( error ) ; <nl> + } <nl> + <nl> static bool pick_subchannel_locked ( <nl> grpc_exec_ctx * exec_ctx , grpc_call_element * elem , <nl> grpc_metadata_batch * initial_metadata , uint32_t initial_metadata_flags , <nl> grpc_connected_subchannel * * connected_subchannel , <nl> - grpc_call_context_element * subchannel_call_context , grpc_closure * on_ready , <nl> - grpc_error * error ) { <nl> + grpc_call_context_element * subchannel_call_context , <nl> + grpc_closure * on_ready ) { <nl> GPR_TIMER_BEGIN ( " pick_subchannel " , 0 ) ; <nl> <nl> channel_data * chand = elem - > channel_data ; <nl> call_data * calld = elem - > call_data ; <nl> - continue_picking_args * cpa ; <nl> - grpc_closure * closure ; <nl> <nl> GPR_ASSERT ( connected_subchannel ) ; <nl> <nl> - if ( initial_metadata = = NULL ) { <nl> - if ( chand - > lb_policy ! = NULL ) { <nl> - grpc_lb_policy_cancel_pick_locked ( exec_ctx , chand - > lb_policy , <nl> - connected_subchannel , <nl> - GRPC_ERROR_REF ( error ) ) ; <nl> - } <nl> - for ( closure = chand - > waiting_for_config_closures . head ; closure ! = NULL ; <nl> - closure = closure - > next_data . next ) { <nl> - cpa = closure - > cb_arg ; <nl> - if ( cpa - > connected_subchannel = = connected_subchannel ) { <nl> - cpa - > connected_subchannel = NULL ; <nl> - grpc_closure_sched ( exec_ctx , cpa - > on_ready , <nl> - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING ( <nl> - " Pick cancelled " , & error , 1 ) ) ; <nl> - } <nl> - } <nl> - GPR_TIMER_END ( " pick_subchannel " , 0 ) ; <nl> - GRPC_ERROR_UNREF ( error ) ; <nl> - return true ; <nl> - } <nl> - GPR_ASSERT ( error = = GRPC_ERROR_NONE ) ; <nl> if ( chand - > lb_policy ! = NULL ) { <nl> apply_final_configuration_locked ( exec_ctx , elem ) ; <nl> grpc_lb_policy * lb_policy = chand - > lb_policy ; <nl> static bool pick_subchannel_locked ( <nl> & chand - > on_resolver_result_changed ) ; <nl> } <nl> if ( chand - > resolver ! = NULL ) { <nl> - cpa = gpr_malloc ( sizeof ( * cpa ) ) ; <nl> + continue_picking_args * cpa = gpr_malloc ( sizeof ( * cpa ) ) ; <nl> cpa - > initial_metadata = initial_metadata ; <nl> cpa - > initial_metadata_flags = initial_metadata_flags ; <nl> cpa - > connected_subchannel = connected_subchannel ; <nl> static void start_transport_stream_op_batch_locked_inner ( <nl> error to the caller when the first op does get passed down . * / <nl> calld - > cancel_error = <nl> GRPC_ERROR_REF ( op - > payload - > cancel_stream . cancel_error ) ; <nl> - switch ( calld - > creation_phase ) { <nl> - case GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING : <nl> - fail_locked ( exec_ctx , calld , <nl> - GRPC_ERROR_REF ( op - > payload - > cancel_stream . cancel_error ) ) ; <nl> - break ; <nl> - case GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL : <nl> - pick_subchannel_locked ( <nl> - exec_ctx , elem , NULL , 0 , & calld - > connected_subchannel , NULL , NULL , <nl> - GRPC_ERROR_REF ( op - > payload - > cancel_stream . cancel_error ) ) ; <nl> - break ; <nl> + if ( calld - > pick_pending ) { <nl> + cancel_pick_locked ( <nl> + exec_ctx , elem , <nl> + GRPC_ERROR_REF ( op - > payload - > cancel_stream . cancel_error ) ) ; <nl> + } else { <nl> + fail_locked ( exec_ctx , calld , <nl> + GRPC_ERROR_REF ( op - > payload - > cancel_stream . cancel_error ) ) ; <nl> } <nl> grpc_transport_stream_op_batch_finish_with_failure ( <nl> exec_ctx , op , <nl> static void start_transport_stream_op_batch_locked_inner ( <nl> } <nl> } <nl> / * if we don ' t have a subchannel , try to get one * / <nl> - if ( calld - > creation_phase = = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING & & <nl> - calld - > connected_subchannel = = NULL & & op - > send_initial_metadata ) { <nl> - calld - > creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL ; <nl> + if ( ! calld - > pick_pending & & calld - > connected_subchannel = = NULL & & <nl> + op - > send_initial_metadata ) { <nl> + calld - > pick_pending = true ; <nl> grpc_closure_init ( & calld - > next_step , subchannel_ready_locked , elem , <nl> grpc_combiner_scheduler ( chand - > combiner , true ) ) ; <nl> GRPC_CALL_STACK_REF ( calld - > owning_call , " pick_subchannel " ) ; <nl> static void start_transport_stream_op_batch_locked_inner ( <nl> op - > payload - > send_initial_metadata . send_initial_metadata , <nl> op - > payload - > send_initial_metadata . send_initial_metadata_flags , <nl> & calld - > connected_subchannel , calld - > subchannel_call_context , <nl> - & calld - > next_step , GRPC_ERROR_NONE ) ) { <nl> - calld - > creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING ; <nl> + & calld - > next_step ) ) { <nl> + calld - > pick_pending = false ; <nl> GRPC_CALL_STACK_UNREF ( exec_ctx , calld - > owning_call , " pick_subchannel " ) ; <nl> } else { <nl> grpc_polling_entity_add_to_pollset_set ( exec_ctx , calld - > pollent , <nl> static void start_transport_stream_op_batch_locked_inner ( <nl> } <nl> } <nl> / * if we ' ve got a subchannel , then let ' s ask it to create a call * / <nl> - if ( calld - > creation_phase = = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING & & <nl> - calld - > connected_subchannel ! = NULL ) { <nl> + if ( ! calld - > pick_pending & & calld - > connected_subchannel ! = NULL ) { <nl> grpc_subchannel_call * subchannel_call = NULL ; <nl> const grpc_connected_subchannel_call_args call_args = { <nl> . pollent = calld - > pollent , <nl> static void cc_destroy_call_elem ( grpc_exec_ctx * exec_ctx , <nl> then_schedule_closure = NULL ; <nl> GRPC_SUBCHANNEL_CALL_UNREF ( exec_ctx , call , " client_channel_destroy_call " ) ; <nl> } <nl> - GPR_ASSERT ( calld - > creation_phase = = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING ) ; <nl> + GPR_ASSERT ( ! calld - > pick_pending ) ; <nl> GPR_ASSERT ( calld - > waiting_ops_count = = 0 ) ; <nl> if ( calld - > connected_subchannel ! = NULL ) { <nl> GRPC_CONNECTED_SUBCHANNEL_UNREF ( exec_ctx , calld - > connected_subchannel , <nl> static void watch_connectivity_state_locked ( grpc_exec_ctx * exec_ctx , void * arg , <nl> <nl> void grpc_client_channel_watch_connectivity_state ( <nl> grpc_exec_ctx * exec_ctx , grpc_channel_element * elem , grpc_pollset * pollset , <nl> - grpc_connectivity_state * state , grpc_closure * on_complete ) { <nl> + grpc_connectivity_state * state , grpc_closure * closure ) { <nl> channel_data * chand = elem - > channel_data ; <nl> external_connectivity_watcher * w = gpr_malloc ( sizeof ( * w ) ) ; <nl> w - > chand = chand ; <nl> w - > pollset = pollset ; <nl> - w - > on_complete = on_complete ; <nl> + w - > on_complete = closure ; <nl> w - > state = state ; <nl> grpc_pollset_set_add_pollset ( exec_ctx , chand - > interested_parties , pollset ) ; <nl> GRPC_CHANNEL_STACK_REF ( w - > chand - > owning_stack , <nl>
Merge pull request from markdroth / client_channel_cleanup
grpc/grpc
f0f147aca980f1e0f37a6bdf5dd0f6ef52c9b1d4
2017-05-04T14:56:00Z
mmm a / tensorflow / python / autograph / __init__ . py <nl> ppp b / tensorflow / python / autograph / __init__ . py <nl> <nl> from tensorflow . python . autograph import utils <nl> from tensorflow . python . autograph . core . converter import ConversionOptions <nl> from tensorflow . python . autograph . core . converter import Feature <nl> + from tensorflow . python . autograph . impl . api import AutoGraphError <nl> from tensorflow . python . autograph . impl . api import convert <nl> from tensorflow . python . autograph . impl . api import converted_call <nl> from tensorflow . python . autograph . impl . api import do_not_convert <nl> <nl> from tensorflow . python . autograph . lang . directives import set_element_type <nl> from tensorflow . python . autograph . lang . directives import set_loop_options <nl> from tensorflow . python . autograph . lang . special_functions import stack <nl> - from tensorflow . python . autograph . pyct . errors import AutoGraphError <nl> - from tensorflow . python . autograph . pyct . errors import StagingError <nl> from tensorflow . python . autograph . utils import ag_logging <nl> from tensorflow . python . util . all_util import remove_undocumented <nl> <nl> # TODO ( mdan ) : Revisit this list once we finalize the generated code mechanism . <nl> _allowed_symbols = [ <nl> # Main API <nl> + ' AutoGraphError ' , <nl> ' ConversionOptions ' , <nl> ' Feature ' , <nl> ' RunMode ' , <nl> <nl> ' set_loop_options ' , <nl> ' stack ' , <nl> ' tensor_list ' , <nl> - # Exceptions <nl> - ' AutoGraphError ' , <nl> - ' StagingError ' , <nl> # Utilities : to be removed <nl> ' utils ' , <nl> ] <nl> mmm a / tensorflow / python / autograph / core / unsupported_features_checker . py <nl> ppp b / tensorflow / python / autograph / core / unsupported_features_checker . py <nl> <nl> <nl> import gast <nl> <nl> - from tensorflow . python . autograph . pyct import errors <nl> - <nl> <nl> class UnsupportedFeaturesChecker ( gast . NodeTransformer ) : <nl> " " " Quick check for Python features we know we don ' t support . <nl> class UnsupportedFeaturesChecker ( gast . NodeTransformer ) : <nl> <nl> # TODO ( b / 124103128 ) : Implement support for ` global ` statements <nl> def visit_Global ( self , node ) : <nl> - raise errors . AutoGraphError ( <nl> - ' The global keyword is not yet supported . ' ) <nl> + raise NotImplementedError ( ' The global keyword is not yet supported . ' ) <nl> <nl> def visit_Nonlocal ( self , node ) : <nl> - raise errors . AutoGraphError ( <nl> - ' The nonlocal keyword is not yet supported . ' ) <nl> + raise NotImplementedError ( ' The nonlocal keyword is not yet supported . ' ) <nl> <nl> # These checks could potentially be replaced with inspect . isgeneratorfunction <nl> # to avoid a getsource / parse / ast - walk round trip . <nl> def visit_Yield ( self , node ) : <nl> - raise errors . AutoGraphError ( <nl> - ' Generators are not supported by AutoGraph ' ) <nl> + raise NotImplementedError ( ' Generators are not supported by AutoGraph ' ) <nl> <nl> def visit_YieldFrom ( self , node ) : <nl> - raise errors . AutoGraphError ( <nl> - ' Generators are not supported by AutoGraph ' ) <nl> + raise NotImplementedError ( ' Generators are not supported by AutoGraph ' ) <nl> <nl> <nl> def verify ( node ) : <nl> mmm a / tensorflow / python / autograph / impl / api . py <nl> ppp b / tensorflow / python / autograph / impl / api . py <nl> <nl> import re <nl> import sys <nl> import textwrap <nl> + import traceback <nl> <nl> from enum import Enum <nl> <nl> <nl> from tensorflow . python . autograph . pyct import inspect_utils <nl> from tensorflow . python . autograph . utils import ag_logging as logging <nl> from tensorflow . python . autograph . utils import py_func <nl> + from tensorflow . python . framework import errors_impl <nl> from tensorflow . python . util import tf_decorator <nl> from tensorflow . python . util import tf_inspect <nl> from tensorflow . python . util . tf_export import tf_export <nl> def is_autograph_strict_conversion_mode ( ) : <nl> return int ( os . environ . get ( ' AUTOGRAPH_STRICT_CONVERSION ' , ' 0 ' ) ) > 0 <nl> <nl> <nl> - # TODO ( mdan ) : Properly document the type hints . <nl> - # TODO ( mdan ) : Reduce the type hint information to ( module , type ) . <nl> - # ( currently we require ( module + class name , type ) ) <nl> + # TODO ( mdan ) : Export this symbol . <nl> + class AutoGraphError ( Exception ) : <nl> + " " " Base class for all AutoGraph exceptions . " " " <nl> + pass <nl> + <nl> + <nl> + class ConversionError ( AutoGraphError ) : <nl> + " " " Raised during the conversion process . " " " <nl> + pass <nl> + <nl> + <nl> + class StagingError ( AutoGraphError ) : <nl> + " " " Raised during the staging ( i . e . Python execution ) of converted code . " " " <nl> + pass <nl> + <nl> + <nl> + class _ErrorMetadata ( errors . ErrorMetadataBase ) : <nl> + " " " AutoGraph - specific error metadata . See base class . " " " <nl> + <nl> + def create_exception ( self , preferred_type ) : <nl> + if preferred_type = = errors_impl . OpError : <nl> + # Best - effort unpacking of OpError exceptions . <nl> + # TODO ( mdan ) : Use a mechanism that is more future - proof . <nl> + t = type ( self . cause ) <nl> + init_argspec = tf_inspect . getfullargspec ( t . __init__ ) <nl> + message = self . get_message ( ) <nl> + init_args = tuple ( init_argspec . argspec ) <nl> + # At the time of this writing , TF errors either take 3 or 4 arguments , <nl> + # with the fourth being error_code . <nl> + if init_args = = ( ' self ' , ' node_def ' , ' op ' , ' message ' , ' error_code ' ) : <nl> + return t ( <nl> + node_def = self . cause . node_def , <nl> + op = self . cause . op , <nl> + message = message , <nl> + error_code = self . error_code ) <nl> + elif init_args = = ( ' self ' , ' node_def ' , ' op ' , ' message ' ) : <nl> + if ' error_code ' in init_argspec . kwonlyargs : <nl> + return t ( <nl> + node_def = self . cause . node_def , <nl> + op = self . cause . op , <nl> + message = message , <nl> + errro_code = self . error_code ) <nl> + else : <nl> + return t ( <nl> + node_def = self . cause . node_def , op = self . cause . op , message = message ) <nl> + <nl> + elif preferred_type in ( AutoGraphError , ConversionError , StagingError ) : <nl> + return preferred_type ( self . get_message ( ) ) <nl> + <nl> + exc = super ( _ErrorMetadata , self ) . create_exception ( preferred_type ) <nl> + if exc is not None : <nl> + return exc <nl> + <nl> + # Note : While changing an error ' s message property to change the message it <nl> + # displays will probably work a lot of times , there is no standard way in <nl> + # Python to do that . The safest way is therefore to create a new exception . <nl> + # For user defined exceptions , we could define an interface that allowed <nl> + # them to work under this mechanism . <nl> + return StagingError ( self . get_message ( ) ) <nl> <nl> <nl> # TODO ( mdan ) : This should behave like to_graph ( e . g . convert statically ) . <nl> - # TODO ( znado ) : Make an alias so can write Verbosity directly without needing <nl> - # to write converter . <nl> - def convert ( <nl> - recursive = False , <nl> - optional_features = None ) : <nl> + def convert ( recursive = False , optional_features = None ) : <nl> " " " Decorator that compiles a function to use TensorFlow ops . <nl> <nl> The decorator is dynamic - it recompiles the target whenever the decorated <nl> def decorator ( f ) : <nl> <nl> @ functools . wraps ( f ) <nl> def wrapper ( * args , * * kwargs ) : <nl> - return converted_call ( <nl> - f , None , <nl> - converter . ConversionOptions ( <nl> - recursive = recursive , <nl> - force_conversion = True , <nl> - optional_features = optional_features , <nl> - ) , args , kwargs ) <nl> + " " " Wrapper that calls the converted version of f . " " " <nl> + try : <nl> + return converted_call ( <nl> + f , None , <nl> + converter . ConversionOptions ( <nl> + recursive = recursive , <nl> + force_conversion = True , <nl> + optional_features = optional_features , <nl> + ) , args , kwargs ) <nl> + except Exception as e : # pylint : disable = broad - except <nl> + if hasattr ( e , ' ag_error_metadata ' ) : <nl> + raise e . ag_error_metadata . to_exception ( type ( e ) ) <nl> + else : <nl> + raise <nl> <nl> wrapper = tf_decorator . make_decorator ( f , wrapper ) <nl> <nl> class RunMode ( Enum ) : <nl> <nl> Attributes : <nl> * GRAPH : Call this function directly , as - is . This is suitable for functions <nl> - that were already designed for TF graphs and contain ops . <nl> + that were already designed for TF graphs and contain ops . <nl> * PY_FUNC : Wrap this function into a py_func op . This is suitable for code <nl> - that will only run correctly in Python , for example code that renders <nl> - to the display , reads keyboard input , etc . <nl> + that will only run correctly in Python , for example code that renders to <nl> + the display , reads keyboard input , etc . <nl> " " " <nl> GRAPH = 1 <nl> PY_FUNC = 2 <nl> def py_func_wrapper ( * args , * * kwargs ) : <nl> return decorator <nl> <nl> <nl> + def _attach_metadata ( e , f , converted ) : <nl> + " " " Augments an error with the metadata necessary for rewrite . " " " <nl> + if hasattr ( e , ' ag_pass_through ' ) : <nl> + return <nl> + <nl> + metadata = getattr ( e , ' ag_error_metadata ' , None ) <nl> + source_map = f . ag_source_map if converted else { } <nl> + <nl> + if metadata is None : <nl> + logging . log ( <nl> + 1 , ' Caught error in % s ( converted = % s ) ' , f , converted , exc_info = True ) <nl> + message = ' { } : { } ' . format ( e . __class__ . __name__ , e ) <nl> + else : <nl> + message = None <nl> + <nl> + cause_tb = traceback . extract_tb ( sys . exc_info ( ) [ 2 ] ) [ 1 : ] <nl> + e . ag_error_metadata = _ErrorMetadata ( cause_tb , metadata , message , source_map ) <nl> + <nl> + <nl> def _call_unconverted ( f , args , kwargs ) : <nl> " " " Calls the original function without converting with AutoGraph . " " " <nl> if inspect_utils . istfmethodtarget ( f ) : <nl> return f . __self__ . call ( args , kwargs ) <nl> <nl> - if kwargs is not None : <nl> - return f ( * args , * * kwargs ) <nl> - else : <nl> - return f ( * args ) <nl> + try : <nl> + if kwargs is not None : <nl> + return f ( * args , * * kwargs ) <nl> + else : <nl> + return f ( * args ) <nl> + except Exception as e : # pylint : disable = broad - except <nl> + _attach_metadata ( e , f , False ) <nl> + raise <nl> <nl> <nl> def _is_known_loaded_type ( f , module_name , entity_name ) : <nl> def converted_call ( f , owner , options , args , kwargs ) : <nl> else : <nl> composite_desc = ' ' <nl> <nl> - logging . log ( 1 , <nl> - ' Converted call : % s % s \ n args : % s \ n kwargs : % s \ n ' , <nl> - f , composite_desc , args , kwargs ) <nl> + logging . log ( 1 , ' Converted call : % s % s \ n args : % s \ n kwargs : % s \ n ' , f , <nl> + composite_desc , args , kwargs ) <nl> <nl> if inspect_utils . isbuiltin ( f ) : <nl> if kwargs : <nl> def converted_call ( f , owner , options , args , kwargs ) : <nl> <nl> # Custom ops and kernels are also permanently whitelisted . <nl> # See tensorflow . framework . load_library . <nl> - if ( hasattr ( f , ' __module__ ' ) <nl> - and hasattr ( f . __module__ , ' _IS_TENSORFLOW_PLUGIN ' ) ) : <nl> + if ( hasattr ( f , ' __module__ ' ) and <nl> + hasattr ( f . __module__ , ' _IS_TENSORFLOW_PLUGIN ' ) ) : <nl> logging . log ( 2 , ' Permanently whitelisted : % s : TensorFlow plugin ' , f ) <nl> return _call_unconverted ( f , args , kwargs ) <nl> <nl> def converted_call ( f , owner , options , args , kwargs ) : <nl> <nl> if not tf_inspect . isclass ( target_entity ) : <nl> if not hasattr ( target_entity , ' __code__ ' ) : <nl> - logging . log ( <nl> - 2 , ' Permanently whitelisted : % s : native binding ' , target_entity ) <nl> + logging . log ( 2 , ' Permanently whitelisted : % s : native binding ' , <nl> + target_entity ) <nl> return _call_unconverted ( f , args , kwargs ) <nl> elif ( hasattr ( target_entity . __code__ , ' co_filename ' ) and <nl> target_entity . __code__ . co_filename = = ' < string > ' ) : <nl> # TODO ( mdan ) : __globals__ [ ' txt ' ] might work in Py3 . <nl> - logging . log ( <nl> - 2 , ' Permanently whitelisted : % s : dynamic code ( exec ? ) ' , <nl> - target_entity ) <nl> + logging . log ( 2 , ' Permanently whitelisted : % s : dynamic code ( exec ? ) ' , <nl> + target_entity ) <nl> return _call_unconverted ( f , args , kwargs ) <nl> <nl> converted_f = to_graph ( <nl> def converted_call ( f , owner , options , args , kwargs ) : <nl> logging . log ( 2 , ' Defaults of % s : % s ' , converted_f , <nl> converted_f . __defaults__ ) <nl> if kwargs is not None : <nl> - callargs = tf_inspect . getcallargs ( <nl> - converted_f , * effective_args , * * kwargs ) <nl> + callargs = tf_inspect . getcallargs ( converted_f , * effective_args , <nl> + * * kwargs ) <nl> else : <nl> callargs = tf_inspect . getcallargs ( converted_f , * effective_args ) <nl> formatted_callargs = ' \ n ' . join ( <nl> ' { } : { } ' . format ( k , v ) for k , v in callargs . items ( ) ) <nl> logging . log ( 2 , ' Calling % s with \ n % s \ n ' , converted_f , formatted_callargs ) <nl> <nl> - # TODO ( mdan ) : Reduce this list . <nl> - except ( errors . AutoGraphError , AssertionError , AttributeError , IndexError , <nl> - KeyError , NameError , NotImplementedError , SyntaxError , TypeError , <nl> - ValueError , IOError ) as e : <nl> - <nl> + except Exception as e : # pylint : disable = broad - except <nl> logging . log ( 1 , ' Error transforming entity % s ' , target_entity , exc_info = True ) <nl> - <nl> if is_autograph_strict_conversion_mode ( ) : <nl> raise <nl> - <nl> logging . warn ( <nl> ' Entity % s could not be transformed and will be executed as - is . ' <nl> - ' Some features ( e . g . tensor - dependent conditionals and loops ) may not ' <nl> - ' work as expected . ' <nl> - ' Error details can be found in the logs when running with the env ' <nl> - ' variable AUTOGRAPH_VERBOSITY > = 1 . Please report this to the ' <nl> - ' AutoGraph team . Cause : % s ' , target_entity , e ) <nl> - <nl> + ' Please report this to the AutgoGraph team . When filing the bug , set ' <nl> + ' the verbosity to 10 ( on Linux , ` export AUTOGRAPH_VERBOSITY = 10 ` ) and ' <nl> + ' attach the full output . Cause : % s ' , target_entity , e ) <nl> return _call_unconverted ( f , args , kwargs ) <nl> <nl> try : <nl> def converted_call ( f , owner , options , args , kwargs ) : <nl> result = converted_f ( * effective_args , * * kwargs ) <nl> else : <nl> result = converted_f ( * effective_args ) <nl> - except errors . StagingError as e : <nl> - target_origin = errors . extract_origin_info ( converted_f ) <nl> - raise errors . StagingError ( ( target_origin , ) + e . user_trace , e . original_error ) <nl> - except errors . AutoGraphError as e : <nl> - target_origin = errors . extract_origin_info ( converted_f ) <nl> - raise errors . StagingError ( ( target_origin , ) , e ) <nl> + except Exception as e : <nl> + _attach_metadata ( e , converted_f , True ) <nl> + raise <nl> <nl> return result <nl> <nl> <nl> @ tf_export ( ' autograph . to_graph ' , v1 = [ ] ) <nl> - def to_graph ( entity , <nl> - recursive = True , <nl> - experimental_optional_features = None ) : <nl> + def to_graph ( entity , recursive = True , experimental_optional_features = None ) : <nl> " " " Converts a Python entity into a TensorFlow graph . <nl> <nl> Also see : ` tf . autograph . to_code ` , ` tf . function ` . <nl> def foo ( x ) : <nl> <nl> Args : <nl> entity : Python callable or class to convert . <nl> - recursive : Whether to recursively convert any functions that the <nl> - converted function may call . <nl> + recursive : Whether to recursively convert any functions that the converted <nl> + function may call . <nl> experimental_optional_features : ` None ` , a tuple of , or a single <nl> - ` tf . autograph . experimental . Feature ` value . Controls the use of <nl> - optional features in the conversion process . <nl> + ` tf . autograph . experimental . Feature ` value . Controls the use of optional <nl> + features in the conversion process . <nl> <nl> Returns : <nl> Same as ` entity ` , the converted Python function or class . <nl> def foo ( x ) : <nl> autograph_module = tf_inspect . getmodule ( to_graph ) ) <nl> return conversion . convert ( entity , program_ctx ) <nl> except ( ValueError , AttributeError , KeyError , NameError , AssertionError ) as e : <nl> - errors . report_internal_error ( entity , e ) <nl> + logging . error ( 1 , ' Error converting % s ' , entity , exc_info = True ) <nl> + raise ConversionError ( ' converting { } : { } : { } ' . format ( <nl> + entity , e . __class__ . __name__ , str ( e ) ) ) <nl> <nl> <nl> @ tf_export ( v1 = [ ' autograph . to_graph ' ] ) <nl> def to_code_v1 ( entity , <nl> <nl> <nl> @ tf_export ( ' autograph . to_code ' , v1 = [ ] ) <nl> - def to_code ( entity , <nl> - recursive = True , <nl> - experimental_optional_features = None ) : <nl> + def to_code ( entity , recursive = True , experimental_optional_features = None ) : <nl> " " " Similar to ` to_graph ` , but returns Python source code as a string . <nl> <nl> Also see : ` tf . autograph . to_graph ` . <nl> def to_code ( entity , <nl> <nl> Args : <nl> entity : Python callable or class to convert . <nl> - recursive : Whether to recursively convert any functions that the <nl> - converted function may call . <nl> + recursive : Whether to recursively convert any functions that the converted <nl> + function may call . <nl> experimental_optional_features : ` None ` , a tuple of , or a single <nl> - ` tf . autograph . experimental . Feature ` value . Controls the use of <nl> - optional features in the conversion process . <nl> + ` tf . autograph . experimental . Feature ` value . Controls the use of optional <nl> + features in the conversion process . <nl> <nl> Returns : <nl> The converted code as string . <nl> mmm a / tensorflow / python / autograph / impl / api_test . py <nl> ppp b / tensorflow / python / autograph / impl / api_test . py <nl> <nl> from tensorflow . python . autograph import utils <nl> from tensorflow . python . autograph . core import converter <nl> from tensorflow . python . autograph . impl import api <nl> - from tensorflow . python . autograph . pyct import errors <nl> from tensorflow . python . autograph . pyct import inspect_utils <nl> from tensorflow . python . autograph . pyct import parser <nl> from tensorflow . python . autograph . utils import py_func <nl> def test_fn ( x ) : <nl> testing_global_numeric = x + testing_global_numeric <nl> return testing_global_numeric <nl> <nl> - # TODO ( b / 122368197 ) <nl> with self . assertRaisesRegex ( <nl> - errors . AutoGraphError , ' global keyword is not yet supported ' ) : <nl> + NotImplementedError , ' global keyword is not yet supported ' ) : <nl> api . to_graph ( test_fn ) <nl> <nl> def test_to_graph_with_kwargs_clashing_converted_call ( self ) : <nl> mmm a / tensorflow / python / autograph / impl / conversion . py <nl> ppp b / tensorflow / python / autograph / impl / conversion . py <nl> <nl> from tensorflow . python . autograph . lang import special_functions <nl> from tensorflow . python . autograph . pyct import ast_util <nl> from tensorflow . python . autograph . pyct import compiler <nl> - from tensorflow . python . autograph . pyct import errors <nl> from tensorflow . python . autograph . pyct import inspect_utils <nl> from tensorflow . python . autograph . pyct import origin_info <nl> from tensorflow . python . autograph . pyct import parser <nl> def convert_func_to_ast ( f , program_ctx , do_rename = True ) : <nl> future_features = future_features , <nl> namespace = namespace ) <nl> context = converter . EntityContext ( namer , entity_info , program_ctx ) <nl> - try : <nl> - node = node_to_graph ( node , context ) <nl> - except ( ValueError , AttributeError , KeyError , NotImplementedError ) as e : <nl> - logging . error ( 1 , ' Error converting % s ' , f , exc_info = True ) <nl> - raise errors . InternalError ( ' conversion ' , e ) <nl> - # TODO ( mdan ) : Catch and rethrow syntax errors . <nl> + node = node_to_graph ( node , context ) <nl> <nl> if isinstance ( node , gast . Lambda ) : <nl> new_name = namer . new_symbol ( ' tf__lambda ' , ( ) ) <nl> mmm a / tensorflow / python / autograph / operators / control_flow . py <nl> ppp b / tensorflow / python / autograph / operators / control_flow . py <nl> <nl> <nl> from tensorflow . python . autograph . operators import py_builtins <nl> from tensorflow . python . autograph . operators import special_values <nl> - from tensorflow . python . autograph . pyct import errors <nl> from tensorflow . python . autograph . utils import ag_logging <nl> from tensorflow . python . data . experimental . ops import scan_ops <nl> from tensorflow . python . data . experimental . ops import take_while_ops <nl> def _get_ops ( self ) : <nl> <nl> def _check_unroll_limits ( self ) : <nl> if LIMIT_PYTHON_ITERATIONS and self . iterations > PYTHON_MAX_ITERATIONS : <nl> - raise errors . ExecutionError ( ' Python ' , ' iteration limit exceeded ' ) <nl> + raise ValueError ( ' iteration limit exceeded ' ) <nl> <nl> def _stop_checking_inefficient_unroll ( self ) : <nl> self . check_inefficient_unroll = False <nl> mmm a / tensorflow / python / autograph / operators / control_flow_test . py <nl> ppp b / tensorflow / python / autograph / operators / control_flow_test . py <nl> <nl> import six <nl> <nl> from tensorflow . python . autograph . operators import control_flow <nl> - from tensorflow . python . autograph . pyct import errors <nl> from tensorflow . python . autograph . utils import ag_logging <nl> from tensorflow . python . data . ops import dataset_ops <nl> from tensorflow . python . eager import def_function <nl> def test_python ( self ) : <nl> def test_python_infinite_loop ( self ) : <nl> if __debug__ : <nl> with test . mock . patch . object ( control_flow , ' PYTHON_MAX_ITERATIONS ' , 100 ) : <nl> - with self . assertRaisesRegexp ( errors . ExecutionError , ' iteration limit ' ) : <nl> + with self . assertRaisesRegexp ( ValueError , ' iteration limit ' ) : <nl> control_flow . while_stmt ( <nl> test = lambda _ : True , <nl> body = lambda i : ( i + 1 , ) , <nl> mmm a / tensorflow / python / autograph / pyct / errors . py <nl> ppp b / tensorflow / python / autograph / pyct / errors . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - import sys <nl> - import traceback <nl> + import collections <nl> + import os <nl> <nl> from tensorflow . python . autograph . pyct import origin_info <nl> - from tensorflow . python . autograph . utils import ag_logging <nl> <nl> <nl> - class AutoGraphError ( Exception ) : <nl> + class FrameInfo ( <nl> + collections . namedtuple ( <nl> + ' FrameInfo ' , <nl> + ( ' filename ' , ' lineno ' , ' function_name ' , ' code ' , ' converted ' ) ) ) : <nl> pass <nl> <nl> <nl> - class ExecutionError ( AutoGraphError ) : <nl> - " " " Raised by AutoGraph during various execution stages . " " " <nl> - <nl> - def __init__ ( self , stage , message ) : <nl> - super ( ExecutionError , self ) . __init__ ( ) <nl> - self . stage = stage <nl> - self . message = message <nl> - <nl> - def __str__ ( self ) : <nl> - return ' Runtime error during { } stage : { } ' . format ( self . stage , self . message ) <nl> - <nl> - <nl> - class InternalError ( AutoGraphError ) : <nl> - " " " Raised when AutoGraph finds an unexpected error . " " " <nl> - <nl> - def __init__ ( self , message , original_exc ) : <nl> - super ( InternalError , self ) . __init__ ( ) <nl> - self . message = message <nl> - self . original_exc = original_exc <nl> - <nl> - def __str__ ( self ) : <nl> - return ' { } during { } : { } ' . format ( <nl> - type ( self . original_exc ) . __name__ , self . message , self . original_exc ) <nl> - <nl> - <nl> - # TODO ( znado ) : merge with ExecutionError . <nl> - class StagingError ( AutoGraphError ) : <nl> - " " " Raised when AutoGraph has an error while executing a converted function . " " " <nl> - <nl> - def __init__ ( self , user_trace , original_error ) : <nl> - " " " Constructs a StagingError . <nl> - <nl> - Args : <nl> - user_trace : Tuple [ OriginInfo ] , the converted call traceback frames . <nl> - original_error : Exception , the original error thrown . <nl> - " " " <nl> - super ( StagingError , self ) . __init__ ( ) <nl> - self . user_trace = user_trace <nl> - self . original_error = original_error <nl> - <nl> - def __str__ ( self ) : <nl> - indent_str = ' ' <nl> - new_stacktrace_lines = [ ] <nl> - for origin in self . user_trace : <nl> - if not origin : <nl> - continue <nl> - frame_str = indent_str + ' { } : { } ( { } ) \ n { } { } ' . format ( <nl> - origin . loc . filename , origin . loc . lineno , origin . function_name , <nl> - indent_str , origin . source_code_line . strip ( ) ) <nl> - new_stacktrace_lines . append ( frame_str ) <nl> - new_stacktrace_str = ' \ n ' . join ( new_stacktrace_lines ) <nl> - original_type = self . original_error . __class__ . __name__ <nl> - original_message = str ( self . original_error ) <nl> - new_message = original_type + ' : ' + original_message <nl> - return ( ' \ nAn error occurred while executing AutoGraph transformed code . ' <nl> - ' For details , set the verbosity to 10 ( on Linux , ' <nl> - ' ` export AUTOGRAPH_VERBOSITY = 10 ` ) . Corresponding code : \ n ' + <nl> - new_stacktrace_str + ' \ n \ n ' + indent_str + new_message + ' \ n \ n ' ) <nl> - <nl> - <nl> - def report_internal_error ( entity , exception ) : <nl> - ag_logging . log ( 1 , ' Error transforming % s ' , entity , exc_info = True ) <nl> - # TODO ( znado ) : Add external bug reporting instructions . <nl> - raise AutoGraphError ( <nl> - ' Unexpected error transforming % s . If you believe this is due to a bug , ' <nl> - ' please set the verbosity to 10 ( on Linux , ` export ' <nl> - ' AUTOGRAPH_VERBOSITY = 10 ` ) and attach the full output when filing the bug ' <nl> - ' report . Caused by : % s ' % ( entity , exception ) ) <nl> - <nl> - <nl> - def extract_origin_info ( converted_f ) : <nl> - " " " Attempts to use converted_f ' s source map to get error origin info . " " " <nl> - source_map = converted_f . ag_source_map <nl> - original_traceback = traceback . extract_tb ( sys . exc_info ( ) [ 2 ] ) <nl> - # Can go through all frames and check which ones have origin info in order to <nl> - # filter for only the locations relevant to converted_f . <nl> - # <nl> - # Return the first occurrence of the reversed traceback in the source map in <nl> - # order to return the innermost frame for this function . We want to do this <nl> - # because when have a tf . cond we will have multiple matches and we want to <nl> - # return the last one in this function , because any after that will be in <nl> - # the next function / frame in the stacktrace . <nl> - for frame in reversed ( original_traceback ) : <nl> - converted_loc = origin_info . LineLocation ( <nl> - filename = frame [ 0 ] , lineno = frame [ 1 ] ) <nl> - if converted_loc in source_map : <nl> - return source_map [ converted_loc ] <nl> - return None <nl> + def _stack_trace_inside_mapped_code ( tb , source_map ) : <nl> + " " " Summarizes inner traceback frames up to the call to a given function . <nl> + <nl> + This functions locates the innermost ( i . e . most recent ) frame that corresponds <nl> + to code that can be mapped by source_map originated from , and returns a <nl> + translated stack trace ending at that frame . If no such frame is found , the <nl> + entire stack trace is summarized . <nl> + <nl> + For example , the following code : <nl> + <nl> + def f ( ) : <nl> + for i in tf . range ( 1 ) : <nl> + z = y + i # z only defined here <nl> + <nl> + Would generate this traceback : <nl> + <nl> + < converted code > <nl> + ag__ . for_stmt ( . . . ) <nl> + < for_stmt > <nl> + return _known_len_tf_for_stmt ( iter_ , extra_test , body , init_state ) <nl> + < _known_len_tf_for_stmt > <nl> + _disallow_undefs_into_loop ( * init_state ) <nl> + < _disallow_undefs_into_loop > <nl> + raise . . . <nl> + <nl> + Which is then processed into : <nl> + <nl> + < f > <nl> + for i in tf . range ( 1 ) : <nl> + < for_stmt > <nl> + return _known_len_tf_for_stmt ( iter_ , extra_test , body , init_state ) <nl> + < _known_len_tf_for_stmt > <nl> + _disallow_undefs_into_loop ( * init_state ) <nl> + < _disallow_undefs_into_loop > <nl> + raise . . . <nl> + <nl> + Args : <nl> + tb : List [ Tuple ] , the traceback corresponding to an error ; typically , <nl> + the output of traceback . extract_tb . <nl> + source_map : Dict [ LineLocation , OriginInfo ] , a source map as created by <nl> + origin_info . create_source_map . <nl> + <nl> + Returns : <nl> + List [ FrameInfo ] <nl> + " " " <nl> + result_frames = [ ] <nl> + for filename , line_number , function_name , text in reversed ( tb ) : <nl> + <nl> + loc = origin_info . LineLocation ( filename = filename , lineno = line_number ) <nl> + if loc in source_map : <nl> + origin = source_map [ loc ] <nl> + origin_frame_info = FrameInfo ( <nl> + filename = origin . loc . filename , <nl> + lineno = origin . loc . lineno , <nl> + function_name = origin . function_name , <nl> + code = origin . source_code_line , <nl> + converted = True ) <nl> + result_frames . append ( origin_frame_info ) <nl> + break <nl> + <nl> + fi = FrameInfo ( <nl> + filename = filename , <nl> + lineno = line_number , <nl> + function_name = function_name , <nl> + code = text , <nl> + converted = False ) <nl> + result_frames . append ( fi ) <nl> + <nl> + return tuple ( result_frames ) <nl> + <nl> + <nl> + KNOWN_STRING_CONSTRUCTOR_ERRORS = ( <nl> + AssertionError , <nl> + AttributeError , <nl> + KeyError , <nl> + NotImplementedError , <nl> + RuntimeError , <nl> + StopIteration , <nl> + TypeError , <nl> + ValueError , <nl> + ) <nl> + <nl> + <nl> + class ErrorMetadataBase ( object ) : <nl> + " " " Container objects attached to exceptions in converted code . <nl> + <nl> + This metadata allows re - raising exceptions that occur in generated code , with <nl> + a custom error message that includes a stack trace relative to user - readable <nl> + code from which the generated code originated . <nl> + " " " <nl> + <nl> + def __init__ ( self , callsite_tb , cause_metadata , cause_message , source_map ) : <nl> + translated_stack = _stack_trace_inside_mapped_code ( callsite_tb , source_map ) <nl> + <nl> + if cause_metadata is None : <nl> + self . translated_stack = translated_stack <nl> + self . cause_message = cause_message <nl> + else : <nl> + # Daisy chain the translated stacks . <nl> + self . translated_stack = ( <nl> + cause_metadata . translated_stack + ( translated_stack [ - 1 ] , ) ) <nl> + self . cause_message = cause_metadata . cause_message <nl> + <nl> + def get_message ( self ) : <nl> + " " " Returns the message for the underlying exception . " " " <nl> + <nl> + all_paths = tuple ( fi . filename for fi in self . translated_stack ) <nl> + <nl> + if len ( all_paths ) > 1 : <nl> + common_path = os . path . dirname ( os . path . commonprefix ( all_paths ) ) <nl> + if common_path = = os . path . sep : <nl> + common_path = ' ' <nl> + if common_path : <nl> + path_idx = len ( common_path ) + 1 <nl> + else : <nl> + path_idx = 0 <nl> + else : <nl> + common_path = ' ' <nl> + path_idx = 0 <nl> + <nl> + lines = [ ] <nl> + <nl> + lines . append ( ' in converted code : ' ) <nl> + if common_path : <nl> + lines . append ( ' relative to { } : ' . format ( common_path ) ) <nl> + <nl> + lines . append ( ' ' ) <nl> + for frame_info in reversed ( self . translated_stack ) : <nl> + lines . append ( ' { } : { } { } { } ' . format ( <nl> + frame_info . filename [ path_idx : ] , <nl> + frame_info . lineno , <nl> + frame_info . function_name , <nl> + ' * ' if frame_info . converted else ' ' , <nl> + ) ) <nl> + lines . append ( ' { } ' . format ( frame_info . code . strip ( ) ) ) <nl> + lines . append ( ' ' ) <nl> + <nl> + message_lines = self . cause_message . split ( ' \ n ' ) <nl> + for i in range ( len ( message_lines ) ) : <nl> + message_lines [ i ] = ' ' + message_lines [ i ] <nl> + lines . extend ( message_lines ) <nl> + <nl> + lines . append ( ' ' ) <nl> + <nl> + return ' \ n ' . join ( lines ) <nl> + <nl> + def create_exception ( self , preferred_type ) : <nl> + if preferred_type in KNOWN_STRING_CONSTRUCTOR_ERRORS : <nl> + return preferred_type ( self . get_message ( ) ) <nl> + return None <nl> + <nl> + def to_exception ( self , preferred_type ) : <nl> + exc = self . create_exception ( preferred_type ) <nl> + exc . __suppress_context__ = True <nl> + exc . ag_error_metadata = self <nl> + return exc <nl> mmm a / tensorflow / python / eager / def_function . py <nl> ppp b / tensorflow / python / eager / def_function . py <nl> def _initialize_uninitialized_variables ( self , initializer_map ) : <nl> " " " Make and call a ` ConcreteFunction ` which initializes variables . " " " <nl> <nl> # Note : using defun here avoids an infinite recursion . <nl> - # Note : there is no reason not to autograph once the overhead is negligible . <nl> @ function_lib . defun <nl> def initialize_variables ( ) : <nl> for v , init in initializer_map . items ( ) : <nl> mmm a / tensorflow / python / eager / def_function_test . py <nl> ppp b / tensorflow / python / eager / def_function_test . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> - from six . moves import range <nl> - <nl> import functools <nl> + import re <nl> import weakref <nl> <nl> + from six . moves import range <nl> + <nl> from tensorflow . python . eager import backprop <nl> from tensorflow . python . eager import def_function <nl> from tensorflow . python . eager import lift_to_graph <nl> class _HasDecoratedMethod ( object ) : <nl> def f ( self , x ) : <nl> return x * 3 . <nl> <nl> - # pylint : disable = bad - continuation , anomalous - backslash - in - string <nl> - MIXING_GRAPH_EAGER_TENSORS_ERROR = ( <nl> - " " " An op outside of the function building code is being passed <nl> - a " Graph " tensor . It is possible to have Graph tensors <nl> - leak out of the function building context by including a <nl> - tf . init_scope in your function building code . <nl> - For example , the following function will fail : <nl> - @ tf . function <nl> - def has_init_scope \ ( \ ) : <nl> - my_constant = tf . constant \ ( 1 . \ ) <nl> - with tf . init_scope \ ( \ ) : <nl> - added = my_constant \ * 2 <nl> - The graph tensor has name : Const : 0 " " " ) <nl> - # pylint : enable = bad - continuation , anomalous - backslash - in - string <nl> - <nl> - <nl> class DefFunctionTest ( test . TestCase ) : <nl> <nl> def testNoVariables ( self ) : <nl> def failing_function ( ) : <nl> with ops . init_scope ( ) : <nl> _ = a + a <nl> <nl> - with self . assertRaisesRegexp ( TypeError , MIXING_GRAPH_EAGER_TENSORS_ERROR ) : <nl> + with self . assertRaisesRegexp ( <nl> + TypeError , <nl> + re . compile ( ' An op outside of the function . * passed . * Const ' , re . DOTALL ) ) : <nl> failing_function ( ) <nl> <nl> def testVariableCreatorScope ( self ) : <nl> mmm a / tensorflow / python / eager / lift_to_graph . py <nl> ppp b / tensorflow / python / eager / lift_to_graph . py <nl> def _as_operation ( op_or_tensor ) : <nl> <nl> class UnliftableError ( Exception ) : <nl> " " " Raised if a Tensor cannot be lifted from the graph . " " " <nl> - pass <nl> + <nl> + # Prevent autograph from rewriting this error . <nl> + ag_pass_through = True <nl> <nl> <nl> def _constant_inputs ( op_or_tensor ) : <nl> mmm a / tensorflow / python / framework / func_graph . py <nl> ppp b / tensorflow / python / framework / func_graph . py <nl> def convert ( x ) : <nl> _ , original_func = tf_decorator . unwrap ( python_func ) <nl> <nl> def wrapper ( * args , * * kwargs ) : <nl> - # Note : functions annotated with @ tf . function should always be <nl> - # converted even though they would meet autograph ' s whitelisting <nl> - # criteria . <nl> - # If this assumption is ever broken , converted_call will need to <nl> - # handle the possibility of original_func still being a shim , e . g . <nl> - # bound to WeakrefSelf . <nl> - return autograph . converted_call ( <nl> - original_func , None , <nl> - autograph . ConversionOptions ( <nl> - recursive = True , <nl> - optional_features = autograph_options , <nl> - force_conversion = True , <nl> - ) , args , kwargs ) <nl> + " " " Calls a converted version of original_func . " " " <nl> + # TODO ( mdan ) : Push this block higher in tf . function ' s call stack . <nl> + try : <nl> + return autograph . converted_call ( <nl> + original_func , None , <nl> + autograph . ConversionOptions ( <nl> + recursive = True , <nl> + optional_features = autograph_options , <nl> + force_conversion = True , <nl> + ) , args , kwargs ) <nl> + except Exception as e : # pylint : disable = broad - except <nl> + if hasattr ( e , " ag_error_metadata " ) : <nl> + raise e . ag_error_metadata . to_exception ( type ( e ) ) <nl> + else : <nl> + raise <nl> <nl> # Wrapping around a decorator allows checks like tf_inspect . getargspec <nl> # to be accurate . <nl> mmm a / tensorflow / python / keras / engine / base_layer_test . py <nl> ppp b / tensorflow / python / keras / engine / base_layer_test . py <nl> def easily_identifiable_name ( ) : <nl> <nl> try : <nl> _ = TypeErrorLayer ( ) ( inputs ) <nl> - except TypeError : <nl> - tb = traceback . extract_tb ( sys . exc_info ( ) [ 2 ] ) <nl> - last_entry = tb [ - 1 ] <nl> - function_name = last_entry [ 2 ] <nl> + except TypeError as e : <nl> + if hasattr ( e , ' ag_error_metadata ' ) : <nl> + self . assertIn ( ' easily_identifiable_name ' , str ( e ) ) <nl> + # See ErrorMetadataBase in autograph / pyct / errors . py <nl> + function_name = e . ag_error_metadata . translated_stack [ - 1 ] . function_name <nl> + else : <nl> + tb = traceback . extract_tb ( sys . exc_info ( ) [ 2 ] ) <nl> + last_entry = tb [ - 1 ] <nl> + function_name = last_entry [ 2 ] <nl> self . assertEqual ( function_name , ' easily_identifiable_name ' ) <nl> <nl> @ test_util . run_in_graph_and_eager_modes <nl>
Rewrite messages of errors raised at raised graph construction to include a stack trace relative to original code before conversion .
tensorflow/tensorflow
c07c274fd6ba50bd3944fa2b03a30bf155045277
2019-05-20T20:42:05Z
mmm a / Source / ComputationNetworkLib / ComputationNode . h <nl> ppp b / Source / ComputationNetworkLib / ComputationNode . h <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> MaskMissingGradientColumnsToZero ( fr ) ; <nl> return GradientFor ( fr ) ; <nl> } <nl> - / / special version that converts a sparse matrix as dense <nl> - / / TODO : Is this the right thing to do ? It changes the matrix type in - place . <nl> - Matrix < ElemType > ValueForToDense ( const FrameRange & fr / * select frame or entire batch * / , bool keepValuesOnSwitch ) <nl> - { <nl> - Value ( ) . SwitchToMatrixType ( MatrixType : : DENSE , MatrixFormat : : matrixFormatDense , keepValuesOnSwitch ) ; <nl> - return ValueFor ( fr ) ; <nl> - } <nl> / / tensor variants <nl> TensorView < ElemType > ValueTensorFor ( size_t rank , const FrameRange & fr ) <nl> { <nl> protected : \ <nl> using Base : : m_deviceId ; using Base : : SetDims ; using Base : : GetNumRows ; using Base : : GetNumCols ; using Base : : UpdateFunctionValuesSize ; using Base : : LoadValue ; \ <nl> using Base : : m_pMBLayout ; using Base : : GetNumTimeSteps ; using Base : : GetNumParallelSequences ; \ <nl> using Base : : MaskMissingColumnsToZero ; using Base : : MaskMissingValueColumnsToZero ; using Base : : MaskMissingGradientColumnsToZero ; using Base : : InvalidateMissingValueColumns ; using Base : : InvalidateMissingGradientColumns ; \ <nl> - using Base : : DataFor ; using Base : : ValueFor ; using Base : : ValueForToDense ; using Base : : Gradient ; using Base : : GradientFor ; \ <nl> + using Base : : DataFor ; using Base : : ValueFor ; using Base : : Gradient ; using Base : : GradientFor ; \ <nl> using Base : : MaskedValueFor ; using Base : : MaskedGradientFor ; using Base : : ValueTensorFor ; using Base : : GradientTensorFor ; \ <nl> using Base : : ForwardProp ; using Base : : BackpropTo ; \ <nl> using Base : : m_inputs ; using Base : : m_value ; using Base : : m_gradient ; \ <nl> public : \ <nl> return false ; <nl> } <nl> <nl> + virtual void / * IComputationNode : : * / BeginForwardProp ( ) override / / called before first iteration step of ForwardProp ( ) <nl> + { <nl> + Base : : BeginForwardProp ( ) ; <nl> + / / we switch result to dense as a work - around because ColumnSlice doesn ' t support all the sparse formats <nl> + / / TODO : This is a stopgap . Is this the right thing to do ? It changes the matrix type in - place . <nl> + Value ( ) . SwitchToMatrixType ( MatrixType : : DENSE , MatrixFormat : : matrixFormatDense , false ) ; <nl> + } <nl> + <nl> virtual void / * ComputationNodeBase : : * / Validate ( bool isFinalValidationPass ) override <nl> { <nl> ValidateBinaryZip ( isFinalValidationPass , true / * allowMultiples * / ) ; <nl> mmm a / Source / ComputationNetworkLib / LinearAlgebraNodes . h <nl> ppp b / Source / ComputationNetworkLib / LinearAlgebraNodes . h <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> virtual void / * ComputationNode : : * / BackpropTo ( const size_t inputIndex , const FrameRange & fr ) override <nl> { <nl> # ifdef ENABLE_TENSORVIEW <nl> - fprintf ( stderr , " ! " ) ; <nl> size_t rank = DetermineElementwiseTensorRank ( ) ; <nl> auto gradient = GradientTensorFor ( rank , fr ) ; <nl> auto inputGradient = Input ( inputIndex ) - > GradientTensorFor ( rank , fr . AllowBroadcast ( ) ) ; <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> virtual void / * ComputationNode : : * / ForwardProp ( const FrameRange & fr ) override <nl> { <nl> # ifdef ENABLE_TENSORVIEW <nl> - / / we switch result to dense as a work - around because ColumnSlice doesn ' t support all the sparse formats - - TODO : This is a stopgap <nl> - ValueForToDense ( fr , false ) ; <nl> - <nl> size_t rank = DetermineElementwiseTensorRank ( ) ; <nl> auto result = ValueTensorFor ( rank , fr ) ; <nl> auto input0 = Input ( 0 ) - > ValueTensorFor ( rank , fr . AllowBroadcast ( ) ) ; <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> <nl> virtual void / * ComputationNode : : * / BackpropTo ( const size_t inputIndex , const FrameRange & fr ) override <nl> { <nl> + ElemType sign = inputIndex = = 0 ? 1 . 0f : - 1 . 0f ; <nl> + # ifdef ENABLE_TENSORVIEW <nl> + size_t rank = DetermineElementwiseTensorRank ( ) ; <nl> + auto gradient = GradientTensorFor ( rank , fr ) ; <nl> + auto inputGradient = Input ( inputIndex ) - > GradientTensorFor ( rank , fr . AllowBroadcast ( ) ) ; <nl> + <nl> + / / if reduction then mask the respective input ( s ) ( zero out the gaps ) <nl> + if ( Input ( inputIndex ) - > GetNumCols ( ) < GetNumCols ( ) ) <nl> + MaskMissingGradientColumnsToZero ( fr ) ; <nl> + <nl> + if ( sign > 0 ) <nl> + inputGradient . DoSumOf ( 0 . 0f , inputGradient , gradient , 1 . 0f ) ; <nl> + else <nl> + inputGradient . DoDifferenceOf ( 0 . 0f , inputGradient , gradient , 1 . 0f ) ; <nl> + # else <nl> Matrix < ElemType > gradientValues = GradientFor ( fr ) ; <nl> <nl> Matrix < ElemType > childGradientValues = Input ( inputIndex ) - > GradientFor ( fr . AllowBroadcast ( ) ) ; <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> size_t rowsc = Input ( inputIndex ) - > GetNumRows ( ) , colsc = Input ( inputIndex ) - > GetNumColsFor ( fr . AllowBroadcast ( ) ) ; <nl> size_t rowsp = this - > GetNumRows ( ) , colsp = this - > GetNumColsFor ( fr ) ; <nl> <nl> - ElemType sign = inputIndex = = 0 ? 1 . 0f : - 1 . 0f ; <nl> if ( colsc = = colsp & & rowsc = = rowsp ) / / matching dimensions <nl> { <nl> / / BUGBUG : if we reduce from a frame of a MB into a one - column vector , then we must also mask gaps <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> } <nl> else <nl> LogicError ( " % ls % ls operation ' s Validate ( ) function let invalid dimensions slip by . " , NodeName ( ) . c_str ( ) , OperationName ( ) . c_str ( ) ) ; <nl> + # endif <nl> } <nl> <nl> virtual void / * ComputationNode : : * / ForwardProp ( const FrameRange & fr ) override <nl> { <nl> + # ifdef ENABLE_TENSORVIEW <nl> + fprintf ( stderr , " # MINUS # " ) ; <nl> + size_t rank = DetermineElementwiseTensorRank ( ) ; <nl> + auto result = ValueTensorFor ( rank , fr ) ; <nl> + auto input0 = Input ( 0 ) - > ValueTensorFor ( rank , fr . AllowBroadcast ( ) ) ; <nl> + auto input1 = Input ( 1 ) - > ValueTensorFor ( rank , fr . AllowBroadcast ( ) ) ; <nl> + result . DoDifferenceOf ( 0 . 0f , input0 , input1 , 1 . 0f ) ; <nl> + # else <nl> Matrix < ElemType > functionValues = ValueFor ( fr ) ; <nl> Matrix < ElemType > inputFunctionValues0 = Input ( 0 ) - > ValueFor ( fr . AllowBroadcast ( ) ) ; <nl> Matrix < ElemType > inputFunctionValues1 = Input ( 1 ) - > ValueFor ( fr . AllowBroadcast ( ) ) ; <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> } <nl> else <nl> LogicError ( " % ls % ls operation ' s Validate ( ) function let invalid dimensions slip by . " , NodeName ( ) . c_str ( ) , OperationName ( ) . c_str ( ) ) ; <nl> + # endif <nl> } <nl> } ; <nl> <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> <nl> virtual void / * ComputationNode : : * / ForwardProp ( const FrameRange & fr ) override <nl> { <nl> + # ifdef ENABLE_TENSORVIEW <nl> + fprintf ( stderr , " # ETIMESS # " ) ; <nl> + size_t rank = DetermineElementwiseTensorRank ( ) ; <nl> + auto result = ValueTensorFor ( rank , fr ) ; <nl> + auto input0 = Input ( 0 ) - > ValueTensorFor ( rank , fr . AllowBroadcast ( ) ) ; <nl> + auto input1 = Input ( 1 ) - > ValueTensorFor ( rank , fr . AllowBroadcast ( ) ) ; <nl> + result . DoElementwiseProductOf ( 0 . 0f , input0 , input1 , 1 . 0f ) ; <nl> + # else <nl> Matrix < ElemType > sliceInput0Value = Input ( 0 ) - > ValueFor ( fr ) ; <nl> Matrix < ElemType > sliceInput1Value = Input ( 1 ) - > ValueFor ( fr ) ; <nl> Matrix < ElemType > sliceOutputValue = ValueFor ( fr ) ; <nl> <nl> / / ForwardPropS ( sliceOutputValue , sliceInput0Value , sliceInput1Value ) ; <nl> sliceOutputValue . AssignElementProductOf ( sliceInput0Value , sliceInput1Value ) ; <nl> + # endif <nl> } <nl> } ; <nl> <nl> mmm a / Source / Math / CPUMatrix . cpp <nl> ppp b / Source / Math / CPUMatrix . cpp <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> array < ptrdiff_t , N - 1 > strides ; / / N - 1 because last one is the result pointer , which is unused in reduction <nl> for ( size_t i = 0 ; i < N - 1 ; i + + ) / / N = a small constant , this will be unrolled <nl> strides [ i ] = reducingStrides [ i ] [ ( size_t ) m ] ; <nl> - ElemType aggregate = 0 ; <nl> + double / * ElemType * / aggregate = 0 ; <nl> for ( size_t dim = reducingOpDims [ ( size_t ) m ] ; dim - - > 0 ; ) <nl> { <nl> / / need to descend into one loop deeper <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> for ( size_t i = 0 ; i < N - 1 ; i + + ) <nl> pointers [ i ] + = strides [ i ] ; / / note : last pointer ( result ) is unused and untouched here <nl> } <nl> - return aggregate ; <nl> + return ( ElemType ) aggregate ; <nl> } <nl> } ; <nl> <nl> mmm a / Source / Math / CommonMatrix . h <nl> ppp b / Source / Math / CommonMatrix . h <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> / / these are not implemented yet : <nl> opSaturateBetaAlpha , opSumAlpha , opSubDifferenceToAlpha , opSubDifferenceFromAlpha , <nl> / / binary <nl> - opSum , opDifference , opElementWiseProduct , opElementWiseQuotient , <nl> + opSum , opDifference , opElementwiseProduct , opElementwiseQuotient , <nl> opLogSum , opMax , opMin , <nl> opEQ , opNE , opGT , opLT , opGE , opLE , <nl> opMaskNegative , <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> Macro ( SaturateBetaAlpha ) ; Macro ( SumAlpha ) ; Macro ( SubDifferenceToAlpha ) ; Macro ( SubDifferenceFromAlpha ) ; <nl> <nl> # define ForAllBinaryOps ( Macro ) \ <nl> - Macro ( Sum ) ; Macro ( Difference ) ; Macro ( ElementWiseProduct ) ; Macro ( ElementWiseQuotient ) ; \ <nl> + Macro ( Sum ) ; Macro ( Difference ) ; Macro ( ElementwiseProduct ) ; Macro ( ElementwiseQuotient ) ; \ <nl> Macro ( LogSum ) ; Macro ( Max ) ; Macro ( Min ) ; \ <nl> Macro ( EQ ) ; Macro ( NE ) ; Macro ( GT ) ; Macro ( LT ) ; Macro ( GE ) ; Macro ( LE ) ; \ <nl> Macro ( MaskNegative ) ; <nl> mmm a / Source / Math / GPUMatrix . cu <nl> ppp b / Source / Math / GPUMatrix . cu <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> const FixedArray < unsigned int , M > & reducingOpDims , const FixedMatrix < int , N , M > & reducingStrides ) <nl> { <nl> / / start with index 0 <nl> - ElemType agg = TensorOpReduce < ElemType , N , M , m - 1 > : : Compute ( pointers , op , reducingOpDims , reducingStrides ) ; <nl> + / / Using ' double ' since we are memory - bound anyway . <nl> + double / * ElemType * / aggregate = TensorOpReduce < ElemType , N , M , m - 1 > : : Compute ( pointers , op , reducingOpDims , reducingStrides ) ; <nl> / / apply this index to the pointers <nl> size_t dim = reducingOpDims [ m ] ; <nl> for ( size_t k = 1 / * done with k = 0 already * / ; k < dim ; k + + ) <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> for ( size_t i = 0 ; i < N ; i + + ) <nl> pointers [ i ] + = reducingStrides ( i , ( size_t ) m ) ; <nl> ElemType val = TensorOpReduce < ElemType , N , M , m - 1 > : : Compute ( pointers , op , reducingOpDims , reducingStrides ) ; <nl> - agg + = val ; <nl> + aggregate + = val ; <nl> } <nl> - return agg ; <nl> + return ( ElemType ) aggregate ; <nl> } <nl> } ; <nl> <nl> mmm a / Source / Math / TensorOps . h <nl> ppp b / Source / Math / TensorOps . h <nl> namespace Microsoft { namespace MSR { namespace CNTK { <nl> # pragma push_macro ( " DefBinaryOp " ) <nl> # define DefBinaryOp ( op , expr ) template < class ElemType > DECL ElemType Op # # op ( ElemType a , ElemType b ) { return expr ; } <nl> <nl> - DefBinaryOp ( Sum , a + b ) ; DefBinaryOp ( Difference , a - b ) ; DefBinaryOp ( ElementWiseProduct , a * b ) ; DefBinaryOp ( ElementWiseQuotient , a / b ) ; <nl> + DefBinaryOp ( Sum , a + b ) ; DefBinaryOp ( Difference , a - b ) ; DefBinaryOp ( ElementwiseProduct , a * b ) ; DefBinaryOp ( ElementwiseQuotient , a / b ) ; <nl> DefBinaryOp ( LogSum , LogAdd ( a , b ) ) ; DefBinaryOp ( Max , a > b ? a : b ) ; DefBinaryOp ( Min , a < b ? a : b ) ; <nl> DefBinaryOp ( EQ , a = = b ) ; DefBinaryOp ( NE , a ! = b ) ; DefBinaryOp ( GT , a > b ) ; DefBinaryOp ( LT , a < b ) ; DefBinaryOp ( GE , a > = b ) ; DefBinaryOp ( LE , a < = b ) ; <nl> DefBinaryOp ( MaskNegative , b > = 0 ? a : 0 ) ; <nl>
imlemented MinusNode and ElementTimesNode with tensor lib ;
microsoft/CNTK
d17a011d85b876f1c31d2336be749cf22bb12e6d
2015-12-22T07:10:52Z
mmm a / tools / distrib / check_nanopb_output . sh <nl> ppp b / tools / distrib / check_nanopb_output . sh <nl> if [ $ ? ! = 0 ] ; then <nl> echo " Outputs differ : $ NANOPB_TMP_OUTPUT vs src / core / proto / grpc / lb / v0 " <nl> exit 1 <nl> fi <nl> - deactivate <nl>
Fix script
grpc/grpc
ddcc39267089a4886c420af8776e572f24714cbb
2016-02-12T17:19:05Z
mmm a / ruby / ext / google / protobuf_c / encode_decode . c <nl> ppp b / ruby / ext / google / protobuf_c / encode_decode . c <nl> static const upb_json_parsermethod * msgdef_jsonparsermethod ( Descriptor * desc ) { <nl> # define STACK_ENV_STACKBYTES 4096 <nl> typedef struct { <nl> upb_env env ; <nl> - upb_seededalloc alloc ; <nl> const char * ruby_error_template ; <nl> char allocbuf [ STACK_ENV_STACKBYTES ] ; <nl> } stackenv ; <nl> static bool env_error_func ( void * ud , const upb_status * status ) { <nl> <nl> static void stackenv_init ( stackenv * se , const char * errmsg ) { <nl> se - > ruby_error_template = errmsg ; <nl> - upb_env_init ( & se - > env ) ; <nl> - upb_seededalloc_init ( & se - > alloc , & se - > allocbuf , STACK_ENV_STACKBYTES ) ; <nl> - upb_env_setallocfunc ( <nl> - & se - > env , upb_seededalloc_getallocfunc ( & se - > alloc ) , & se - > alloc ) ; <nl> + upb_env_init2 ( & se - > env , se - > allocbuf , sizeof ( se - > allocbuf ) , NULL ) ; <nl> upb_env_seterrorfunc ( & se - > env , env_error_func , se ) ; <nl> } <nl> <nl> static void stackenv_uninit ( stackenv * se ) { <nl> upb_env_uninit ( & se - > env ) ; <nl> - upb_seededalloc_uninit ( & se - > alloc ) ; <nl> } <nl> <nl> / * <nl> mmm a / ruby / ext / google / protobuf_c / message . c <nl> ppp b / ruby / ext / google / protobuf_c / message . c <nl> VALUE Message_method_missing ( int argc , VALUE * argv , VALUE _self ) { <nl> name_len - - ; <nl> } <nl> <nl> - / / Check for a oneof name first . <nl> - o = upb_msgdef_ntoo ( self - > descriptor - > msgdef , <nl> - name , name_len ) ; <nl> + / / See if this name corresponds to either a oneof or field in this message . <nl> + if ( ! upb_msgdef_lookupname ( self - > descriptor - > msgdef , name , name_len , & f , <nl> + & o ) ) { <nl> + return rb_call_super ( argc , argv ) ; <nl> + } <nl> + <nl> if ( o ! = NULL ) { <nl> + / / This is a oneof - - return which field inside the oneof is set . <nl> if ( setter ) { <nl> rb_raise ( rb_eRuntimeError , " Oneof accessors are read - only . " ) ; <nl> } <nl> return which_oneof_field ( self , o ) ; <nl> - } <nl> - <nl> - / / Otherwise , check for a field with that name . <nl> - f = upb_msgdef_ntof ( self - > descriptor - > msgdef , <nl> - name , name_len ) ; <nl> - <nl> - if ( f = = NULL ) { <nl> - return rb_call_super ( argc , argv ) ; <nl> - } <nl> - <nl> - if ( setter ) { <nl> - if ( argc < 2 ) { <nl> - rb_raise ( rb_eArgError , " No value provided to setter . " ) ; <nl> - } <nl> - layout_set ( self - > descriptor - > layout , Message_data ( self ) , f , argv [ 1 ] ) ; <nl> - return Qnil ; <nl> } else { <nl> - return layout_get ( self - > descriptor - > layout , Message_data ( self ) , f ) ; <nl> + / / This is a field - - get or set the field ' s value . <nl> + assert ( f ) ; <nl> + if ( setter ) { <nl> + if ( argc < 2 ) { <nl> + rb_raise ( rb_eArgError , " No value provided to setter . " ) ; <nl> + } <nl> + layout_set ( self - > descriptor - > layout , Message_data ( self ) , f , argv [ 1 ] ) ; <nl> + return Qnil ; <nl> + } else { <nl> + return layout_get ( self - > descriptor - > layout , Message_data ( self ) , f ) ; <nl> + } <nl> } <nl> } <nl> <nl> mmm a / ruby / ext / google / protobuf_c / upb . c <nl> ppp b / ruby / ext / google / protobuf_c / upb . c <nl> typedef struct { <nl> } str_t ; <nl> <nl> static str_t * newstr ( const char * data , size_t len ) { <nl> - str_t * ret = malloc ( sizeof ( * ret ) + len ) ; <nl> + str_t * ret = upb_gmalloc ( sizeof ( * ret ) + len ) ; <nl> if ( ! ret ) return NULL ; <nl> ret - > len = len ; <nl> memcpy ( ret - > str , data , len ) ; <nl> static str_t * newstr ( const char * data , size_t len ) { <nl> return ret ; <nl> } <nl> <nl> - static void freestr ( str_t * s ) { free ( s ) ; } <nl> + static void freestr ( str_t * s ) { upb_gfree ( s ) ; } <nl> <nl> / * isalpha ( ) etc . from < ctype . h > are locale - dependent , which we don ' t want . * / <nl> static bool upb_isbetween ( char c , char low , char high ) { <nl> static bool upb_isident ( const char * str , size_t len , bool full , upb_status * s ) { <nl> return ! start ; <nl> } <nl> <nl> + static bool upb_isoneof ( const upb_refcounted * def ) { <nl> + return def - > vtbl = = & upb_oneofdef_vtbl ; <nl> + } <nl> + <nl> + static bool upb_isfield ( const upb_refcounted * def ) { <nl> + return def - > vtbl = = & upb_fielddef_vtbl ; <nl> + } <nl> + <nl> + static const upb_oneofdef * upb_trygetoneof ( const upb_refcounted * def ) { <nl> + return upb_isoneof ( def ) ? ( const upb_oneofdef * ) def : NULL ; <nl> + } <nl> + <nl> + static const upb_fielddef * upb_trygetfield ( const upb_refcounted * def ) { <nl> + return upb_isfield ( def ) ? ( const upb_fielddef * ) def : NULL ; <nl> + } <nl> + <nl> <nl> / * upb_def * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> const char * upb_def_name ( const upb_def * d ) { <nl> <nl> bool upb_def_setfullname ( upb_def * def , const char * fullname , upb_status * s ) { <nl> assert ( ! upb_def_isfrozen ( def ) ) ; <nl> - if ( ! upb_isident ( fullname , strlen ( fullname ) , true , s ) ) return false ; <nl> - free ( ( void * ) def - > fullname ) ; <nl> - def - > fullname = upb_strdup ( fullname ) ; <nl> + if ( ! upb_isident ( fullname , strlen ( fullname ) , true , s ) ) { <nl> + return false ; <nl> + } <nl> + <nl> + fullname = upb_gstrdup ( fullname ) ; <nl> + if ( ! fullname ) { <nl> + upb_upberr_setoom ( s ) ; <nl> + return false ; <nl> + } <nl> + <nl> + upb_gfree ( ( void * ) def - > fullname ) ; <nl> + def - > fullname = fullname ; <nl> return true ; <nl> } <nl> <nl> static bool upb_def_init ( upb_def * def , upb_deftype_t type , <nl> } <nl> <nl> static void upb_def_uninit ( upb_def * def ) { <nl> - free ( ( void * ) def - > fullname ) ; <nl> + upb_gfree ( ( void * ) def - > fullname ) ; <nl> } <nl> <nl> static const char * msgdef_name ( const upb_msgdef * m ) { <nl> static bool assign_msg_indices ( upb_msgdef * m , upb_status * s ) { <nl> int i ; <nl> uint32_t selector ; <nl> int n = upb_msgdef_numfields ( m ) ; <nl> - upb_fielddef * * fields = malloc ( n * sizeof ( * fields ) ) ; <nl> - if ( ! fields ) return false ; <nl> + upb_fielddef * * fields ; <nl> + <nl> + if ( n = = 0 ) { <nl> + m - > selector_count = UPB_STATIC_SELECTOR_COUNT ; <nl> + m - > submsg_field_count = 0 ; <nl> + return true ; <nl> + } <nl> + <nl> + fields = upb_gmalloc ( n * sizeof ( * fields ) ) ; <nl> + if ( ! fields ) { <nl> + upb_upberr_setoom ( s ) ; <nl> + return false ; <nl> + } <nl> <nl> m - > submsg_field_count = 0 ; <nl> for ( i = 0 , upb_msg_field_begin ( & j , m ) ; <nl> static bool assign_msg_indices ( upb_msgdef * m , upb_status * s ) { <nl> upb_fielddef * f = upb_msg_iter_field ( & j ) ; <nl> assert ( f - > msg . def = = m ) ; <nl> if ( ! upb_validate_field ( f , s ) ) { <nl> - free ( fields ) ; <nl> + upb_gfree ( fields ) ; <nl> return false ; <nl> } <nl> if ( upb_fielddef_issubmsg ( f ) ) { <nl> static bool assign_msg_indices ( upb_msgdef * m , upb_status * s ) { <nl> # undef TRY <nl> # endif <nl> <nl> - free ( fields ) ; <nl> + upb_gfree ( fields ) ; <nl> return true ; <nl> } <nl> <nl> static void upb_enumdef_free ( upb_refcounted * r ) { <nl> upb_inttable_iter i ; <nl> upb_inttable_begin ( & i , & e - > iton ) ; <nl> for ( ; ! upb_inttable_done ( & i ) ; upb_inttable_next ( & i ) ) { <nl> - / * To clean up the upb_strdup ( ) from upb_enumdef_addval ( ) . * / <nl> - free ( upb_value_getcstr ( upb_inttable_iter_value ( & i ) ) ) ; <nl> + / * To clean up the upb_gstrdup ( ) from upb_enumdef_addval ( ) . * / <nl> + upb_gfree ( upb_value_getcstr ( upb_inttable_iter_value ( & i ) ) ) ; <nl> } <nl> upb_strtable_uninit ( & e - > ntoi ) ; <nl> upb_inttable_uninit ( & e - > iton ) ; <nl> upb_def_uninit ( upb_enumdef_upcast_mutable ( e ) ) ; <nl> - free ( e ) ; <nl> + upb_gfree ( e ) ; <nl> } <nl> <nl> + const struct upb_refcounted_vtbl upb_enumdef_vtbl = { NULL , & upb_enumdef_free } ; <nl> + <nl> upb_enumdef * upb_enumdef_new ( const void * owner ) { <nl> - static const struct upb_refcounted_vtbl vtbl = { NULL , & upb_enumdef_free } ; <nl> - upb_enumdef * e = malloc ( sizeof ( * e ) ) ; <nl> + upb_enumdef * e = upb_gmalloc ( sizeof ( * e ) ) ; <nl> if ( ! e ) return NULL ; <nl> - if ( ! upb_def_init ( upb_enumdef_upcast_mutable ( e ) , UPB_DEF_ENUM , & vtbl , owner ) ) <nl> + <nl> + if ( ! upb_def_init ( upb_enumdef_upcast_mutable ( e ) , UPB_DEF_ENUM , <nl> + & upb_enumdef_vtbl , owner ) ) { <nl> goto err2 ; <nl> + } <nl> + <nl> if ( ! upb_strtable_init ( & e - > ntoi , UPB_CTYPE_INT32 ) ) goto err2 ; <nl> if ( ! upb_inttable_init ( & e - > iton , UPB_CTYPE_CSTR ) ) goto err1 ; <nl> return e ; <nl> upb_enumdef * upb_enumdef_new ( const void * owner ) { <nl> err1 : <nl> upb_strtable_uninit ( & e - > ntoi ) ; <nl> err2 : <nl> - free ( e ) ; <nl> + upb_gfree ( e ) ; <nl> return NULL ; <nl> } <nl> <nl> bool upb_enumdef_setfullname ( upb_enumdef * e , const char * fullname , <nl> <nl> bool upb_enumdef_addval ( upb_enumdef * e , const char * name , int32_t num , <nl> upb_status * status ) { <nl> + char * name2 ; <nl> + <nl> if ( ! upb_isident ( name , strlen ( name ) , false , status ) ) { <nl> return false ; <nl> } <nl> + <nl> if ( upb_enumdef_ntoiz ( e , name , NULL ) ) { <nl> upb_status_seterrf ( status , " name ' % s ' is already defined " , name ) ; <nl> return false ; <nl> } <nl> + <nl> if ( ! upb_strtable_insert ( & e - > ntoi , name , upb_value_int32 ( num ) ) ) { <nl> upb_status_seterrmsg ( status , " out of memory " ) ; <nl> return false ; <nl> } <nl> - if ( ! upb_inttable_lookup ( & e - > iton , num , NULL ) & & <nl> - ! upb_inttable_insert ( & e - > iton , num , upb_value_cstr ( upb_strdup ( name ) ) ) ) { <nl> - upb_status_seterrmsg ( status , " out of memory " ) ; <nl> - upb_strtable_remove ( & e - > ntoi , name , NULL ) ; <nl> - return false ; <nl> + <nl> + if ( ! upb_inttable_lookup ( & e - > iton , num , NULL ) ) { <nl> + name2 = upb_gstrdup ( name ) ; <nl> + if ( ! name2 | | ! upb_inttable_insert ( & e - > iton , num , upb_value_cstr ( name2 ) ) ) { <nl> + upb_status_seterrmsg ( status , " out of memory " ) ; <nl> + upb_strtable_remove ( & e - > ntoi , name , NULL ) ; <nl> + return false ; <nl> + } <nl> } <nl> + <nl> if ( upb_enumdef_numvals ( e ) = = 1 ) { <nl> bool ok = upb_enumdef_setdefault ( e , num , NULL ) ; <nl> UPB_ASSERT_VAR ( ok , ok ) ; <nl> } <nl> + <nl> return true ; <nl> } <nl> <nl> static void freefield ( upb_refcounted * r ) { <nl> upb_fielddef * f = ( upb_fielddef * ) r ; <nl> upb_fielddef_uninit_default ( f ) ; <nl> if ( f - > subdef_is_symbolic ) <nl> - free ( f - > sub . name ) ; <nl> + upb_gfree ( f - > sub . name ) ; <nl> upb_def_uninit ( upb_fielddef_upcast_mutable ( f ) ) ; <nl> - free ( f ) ; <nl> + upb_gfree ( f ) ; <nl> } <nl> <nl> static const char * enumdefaultstr ( const upb_fielddef * f ) { <nl> static bool enumdefaultint32 ( const upb_fielddef * f , int32_t * val ) { <nl> return false ; <nl> } <nl> <nl> + const struct upb_refcounted_vtbl upb_fielddef_vtbl = { visitfield , freefield } ; <nl> + <nl> upb_fielddef * upb_fielddef_new ( const void * o ) { <nl> - static const struct upb_refcounted_vtbl vtbl = { visitfield , freefield } ; <nl> - upb_fielddef * f = malloc ( sizeof ( * f ) ) ; <nl> + upb_fielddef * f = upb_gmalloc ( sizeof ( * f ) ) ; <nl> if ( ! f ) return NULL ; <nl> - if ( ! upb_def_init ( upb_fielddef_upcast_mutable ( f ) , UPB_DEF_FIELD , & vtbl , o ) ) { <nl> - free ( f ) ; <nl> + if ( ! upb_def_init ( upb_fielddef_upcast_mutable ( f ) , UPB_DEF_FIELD , <nl> + & upb_fielddef_vtbl , o ) ) { <nl> + upb_gfree ( f ) ; <nl> return NULL ; <nl> } <nl> f - > msg . def = NULL ; <nl> upb_fielddef * upb_fielddef_dup ( const upb_fielddef * f , const void * owner ) { <nl> srcname = f - > sub . def ? upb_def_fullname ( f - > sub . def ) : NULL ; <nl> } <nl> if ( srcname ) { <nl> - char * newname = malloc ( strlen ( f - > sub . def - > fullname ) + 2 ) ; <nl> + char * newname = upb_gmalloc ( strlen ( f - > sub . def - > fullname ) + 2 ) ; <nl> if ( ! newname ) { <nl> upb_fielddef_unref ( newf , owner ) ; <nl> return NULL ; <nl> upb_fielddef * upb_fielddef_dup ( const upb_fielddef * f , const void * owner ) { <nl> strcpy ( newname , " . " ) ; <nl> strcat ( newname , f - > sub . def - > fullname ) ; <nl> upb_fielddef_setsubdefname ( newf , newname , NULL ) ; <nl> - free ( newname ) ; <nl> + upb_gfree ( newname ) ; <nl> } <nl> <nl> return newf ; <nl> const char * upb_fielddef_containingtypename ( upb_fielddef * f ) { <nl> } <nl> <nl> static void release_containingtype ( upb_fielddef * f ) { <nl> - if ( f - > msg_is_symbolic ) free ( f - > msg . name ) ; <nl> + if ( f - > msg_is_symbolic ) upb_gfree ( f - > msg . name ) ; <nl> } <nl> <nl> bool upb_fielddef_setcontainingtypename ( upb_fielddef * f , const char * name , <nl> upb_status * s ) { <nl> + char * name_copy ; <nl> assert ( ! upb_fielddef_isfrozen ( f ) ) ; <nl> if ( upb_fielddef_containingtype ( f ) ) { <nl> upb_status_seterrmsg ( s , " field has already been added to a message . " ) ; <nl> bool upb_fielddef_setcontainingtypename ( upb_fielddef * f , const char * name , <nl> } <nl> / * TODO : validate name ( upb_isident ( ) doesn ' t quite work atm because this name <nl> * may have a leading " . " ) . * / <nl> + <nl> + name_copy = upb_gstrdup ( name ) ; <nl> + if ( ! name_copy ) { <nl> + upb_upberr_setoom ( s ) ; <nl> + return false ; <nl> + } <nl> + <nl> release_containingtype ( f ) ; <nl> - f - > msg . name = upb_strdup ( name ) ; <nl> + f - > msg . name = name_copy ; <nl> f - > msg_is_symbolic = true ; <nl> return true ; <nl> } <nl> static bool upb_subdef_typecheck ( upb_fielddef * f , const upb_def * subdef , <nl> <nl> static void release_subdef ( upb_fielddef * f ) { <nl> if ( f - > subdef_is_symbolic ) { <nl> - free ( f - > sub . name ) ; <nl> + upb_gfree ( f - > sub . name ) ; <nl> } else if ( f - > sub . def ) { <nl> upb_unref2 ( f - > sub . def , f ) ; <nl> } <nl> bool upb_fielddef_setenumsubdef ( upb_fielddef * f , const upb_enumdef * subdef , <nl> <nl> bool upb_fielddef_setsubdefname ( upb_fielddef * f , const char * name , <nl> upb_status * s ) { <nl> + char * name_copy ; <nl> assert ( ! upb_fielddef_isfrozen ( f ) ) ; <nl> if ( ! upb_fielddef_hassubdef ( f ) ) { <nl> upb_status_seterrmsg ( s , " field type does not accept a subdef " ) ; <nl> return false ; <nl> } <nl> + <nl> + name_copy = upb_gstrdup ( name ) ; <nl> + if ( ! name_copy ) { <nl> + upb_upberr_setoom ( s ) ; <nl> + return false ; <nl> + } <nl> + <nl> / * TODO : validate name ( upb_isident ( ) doesn ' t quite work atm because this name <nl> * may have a leading " . " ) . * / <nl> release_subdef ( f ) ; <nl> - f - > sub . name = upb_strdup ( name ) ; <nl> + f - > sub . name = name_copy ; <nl> f - > subdef_is_symbolic = true ; <nl> return true ; <nl> } <nl> static void visitmsg ( const upb_refcounted * r , upb_refcounted_visit * visit , <nl> <nl> static void freemsg ( upb_refcounted * r ) { <nl> upb_msgdef * m = ( upb_msgdef * ) r ; <nl> - upb_strtable_uninit ( & m - > ntoo ) ; <nl> upb_strtable_uninit ( & m - > ntof ) ; <nl> upb_inttable_uninit ( & m - > itof ) ; <nl> upb_def_uninit ( upb_msgdef_upcast_mutable ( m ) ) ; <nl> - free ( m ) ; <nl> + upb_gfree ( m ) ; <nl> } <nl> <nl> + const struct upb_refcounted_vtbl upb_msgdef_vtbl = { visitmsg , freemsg } ; <nl> + <nl> upb_msgdef * upb_msgdef_new ( const void * owner ) { <nl> - static const struct upb_refcounted_vtbl vtbl = { visitmsg , freemsg } ; <nl> - upb_msgdef * m = malloc ( sizeof ( * m ) ) ; <nl> + upb_msgdef * m = upb_gmalloc ( sizeof ( * m ) ) ; <nl> if ( ! m ) return NULL ; <nl> - if ( ! upb_def_init ( upb_msgdef_upcast_mutable ( m ) , UPB_DEF_MSG , & vtbl , owner ) ) <nl> + <nl> + if ( ! upb_def_init ( upb_msgdef_upcast_mutable ( m ) , UPB_DEF_MSG , & upb_msgdef_vtbl , <nl> + owner ) ) { <nl> goto err2 ; <nl> - if ( ! upb_inttable_init ( & m - > itof , UPB_CTYPE_PTR ) ) goto err3 ; <nl> - if ( ! upb_strtable_init ( & m - > ntof , UPB_CTYPE_PTR ) ) goto err2 ; <nl> - if ( ! upb_strtable_init ( & m - > ntoo , UPB_CTYPE_PTR ) ) goto err1 ; <nl> + } <nl> + <nl> + if ( ! upb_inttable_init ( & m - > itof , UPB_CTYPE_PTR ) ) goto err2 ; <nl> + if ( ! upb_strtable_init ( & m - > ntof , UPB_CTYPE_PTR ) ) goto err1 ; <nl> m - > map_entry = false ; <nl> m - > syntax = UPB_SYNTAX_PROTO2 ; <nl> return m ; <nl> <nl> err1 : <nl> - upb_strtable_uninit ( & m - > ntof ) ; <nl> - err2 : <nl> upb_inttable_uninit ( & m - > itof ) ; <nl> - err3 : <nl> - free ( m ) ; <nl> + err2 : <nl> + upb_gfree ( m ) ; <nl> return NULL ; <nl> } <nl> <nl> bool upb_msgdef_setfullname ( upb_msgdef * m , const char * fullname , <nl> return upb_def_setfullname ( upb_msgdef_upcast_mutable ( m ) , fullname , s ) ; <nl> } <nl> <nl> + bool upb_msgdef_setsyntax ( upb_msgdef * m , upb_syntax_t syntax ) { <nl> + if ( syntax ! = UPB_SYNTAX_PROTO2 & & syntax ! = UPB_SYNTAX_PROTO3 ) { <nl> + return false ; <nl> + } <nl> + <nl> + m - > syntax = syntax ; <nl> + return true ; <nl> + } <nl> + <nl> + upb_syntax_t upb_msgdef_syntax ( const upb_msgdef * m ) { <nl> + return m - > syntax ; <nl> + } <nl> + <nl> / * Helper : check that the field | f | is safe to add to msgdef | m | . Set an error <nl> * on status | s | and return false if not . * / <nl> static bool check_field_add ( const upb_msgdef * m , const upb_fielddef * f , <nl> static bool check_field_add ( const upb_msgdef * m , const upb_fielddef * f , <nl> } else if ( upb_fielddef_name ( f ) = = NULL | | upb_fielddef_number ( f ) = = 0 ) { <nl> upb_status_seterrmsg ( s , " field name or number were not set " ) ; <nl> return false ; <nl> - } else if ( upb_msgdef_ntofz ( m , upb_fielddef_name ( f ) ) | | <nl> - upb_msgdef_itof ( m , upb_fielddef_number ( f ) ) ) { <nl> - upb_status_seterrmsg ( s , " duplicate field name or number for field " ) ; <nl> + } else if ( upb_msgdef_itof ( m , upb_fielddef_number ( f ) ) ) { <nl> + upb_status_seterrmsg ( s , " duplicate field number " ) ; <nl> + return false ; <nl> + } else if ( upb_strtable_lookup ( & m - > ntof , upb_fielddef_name ( f ) , NULL ) ) { <nl> + upb_status_seterrmsg ( s , " name conflicts with existing field or oneof " ) ; <nl> return false ; <nl> } <nl> return true ; <nl> bool upb_msgdef_addoneof ( upb_msgdef * m , upb_oneofdef * o , const void * ref_donor , <nl> } else if ( upb_oneofdef_name ( o ) = = NULL ) { <nl> upb_status_seterrmsg ( s , " oneofdef name was not set " ) ; <nl> return false ; <nl> - } else if ( upb_msgdef_ntooz ( m , upb_oneofdef_name ( o ) ) ) { <nl> - upb_status_seterrmsg ( s , " duplicate oneof name " ) ; <nl> + } else if ( upb_strtable_lookup ( & m - > ntof , upb_oneofdef_name ( o ) , NULL ) ) { <nl> + upb_status_seterrmsg ( s , " name conflicts with existing field or oneof " ) ; <nl> return false ; <nl> } <nl> <nl> bool upb_msgdef_addoneof ( upb_msgdef * m , upb_oneofdef * o , const void * ref_donor , <nl> <nl> / * Add oneof itself first . * / <nl> o - > parent = m ; <nl> - upb_strtable_insert ( & m - > ntoo , upb_oneofdef_name ( o ) , upb_value_ptr ( o ) ) ; <nl> + upb_strtable_insert ( & m - > ntof , upb_oneofdef_name ( o ) , upb_value_ptr ( o ) ) ; <nl> upb_ref2 ( o , m ) ; <nl> upb_ref2 ( m , o ) ; <nl> <nl> const upb_fielddef * upb_msgdef_itof ( const upb_msgdef * m , uint32_t i ) { <nl> const upb_fielddef * upb_msgdef_ntof ( const upb_msgdef * m , const char * name , <nl> size_t len ) { <nl> upb_value val ; <nl> - return upb_strtable_lookup2 ( & m - > ntof , name , len , & val ) ? <nl> - upb_value_getptr ( val ) : NULL ; <nl> + <nl> + if ( ! upb_strtable_lookup2 ( & m - > ntof , name , len , & val ) ) { <nl> + return NULL ; <nl> + } <nl> + <nl> + return upb_trygetfield ( upb_value_getptr ( val ) ) ; <nl> } <nl> <nl> const upb_oneofdef * upb_msgdef_ntoo ( const upb_msgdef * m , const char * name , <nl> size_t len ) { <nl> upb_value val ; <nl> - return upb_strtable_lookup2 ( & m - > ntoo , name , len , & val ) ? <nl> - upb_value_getptr ( val ) : NULL ; <nl> + <nl> + if ( ! upb_strtable_lookup2 ( & m - > ntof , name , len , & val ) ) { <nl> + return NULL ; <nl> + } <nl> + <nl> + return upb_trygetoneof ( upb_value_getptr ( val ) ) ; <nl> + } <nl> + <nl> + bool upb_msgdef_lookupname ( const upb_msgdef * m , const char * name , size_t len , <nl> + const upb_fielddef * * f , const upb_oneofdef * * o ) { <nl> + upb_value val ; <nl> + <nl> + if ( ! upb_strtable_lookup2 ( & m - > ntof , name , len , & val ) ) { <nl> + return false ; <nl> + } <nl> + <nl> + * o = upb_trygetoneof ( upb_value_getptr ( val ) ) ; <nl> + * f = upb_trygetfield ( upb_value_getptr ( val ) ) ; <nl> + assert ( ( * o ! = NULL ) ^ ( * f ! = NULL ) ) ; / * Exactly one of the two should be set . * / <nl> + return true ; <nl> } <nl> <nl> int upb_msgdef_numfields ( const upb_msgdef * m ) { <nl> - return upb_strtable_count ( & m - > ntof ) ; <nl> + / * The number table contains only fields . * / <nl> + return upb_inttable_count ( & m - > itof ) ; <nl> } <nl> <nl> int upb_msgdef_numoneofs ( const upb_msgdef * m ) { <nl> - return upb_strtable_count ( & m - > ntoo ) ; <nl> + / * The name table includes oneofs , and the number table does not . * / <nl> + return upb_strtable_count ( & m - > ntof ) - upb_inttable_count ( & m - > itof ) ; <nl> } <nl> <nl> void upb_msgdef_setmapentry ( upb_msgdef * m , bool map_entry ) { <nl> void upb_msg_field_iter_setdone ( upb_msg_field_iter * iter ) { <nl> } <nl> <nl> void upb_msg_oneof_begin ( upb_msg_oneof_iter * iter , const upb_msgdef * m ) { <nl> - upb_strtable_begin ( iter , & m - > ntoo ) ; <nl> + upb_strtable_begin ( iter , & m - > ntof ) ; <nl> + / * We need to skip past any initial fields . * / <nl> + while ( ! upb_strtable_done ( iter ) & & <nl> + ! upb_isoneof ( upb_value_getptr ( upb_strtable_iter_value ( iter ) ) ) ) { <nl> + upb_strtable_next ( iter ) ; <nl> + } <nl> } <nl> <nl> - void upb_msg_oneof_next ( upb_msg_oneof_iter * iter ) { upb_strtable_next ( iter ) ; } <nl> + void upb_msg_oneof_next ( upb_msg_oneof_iter * iter ) { <nl> + / * We need to skip past fields to return only oneofs . * / <nl> + do { <nl> + upb_strtable_next ( iter ) ; <nl> + } while ( ! upb_strtable_done ( iter ) & & <nl> + ! upb_isoneof ( upb_value_getptr ( upb_strtable_iter_value ( iter ) ) ) ) ; <nl> + } <nl> <nl> bool upb_msg_oneof_done ( const upb_msg_oneof_iter * iter ) { <nl> return upb_strtable_done ( iter ) ; <nl> static void freeoneof ( upb_refcounted * r ) { <nl> upb_oneofdef * o = ( upb_oneofdef * ) r ; <nl> upb_strtable_uninit ( & o - > ntof ) ; <nl> upb_inttable_uninit ( & o - > itof ) ; <nl> - free ( ( void * ) o - > name ) ; <nl> - free ( o ) ; <nl> + upb_gfree ( ( void * ) o - > name ) ; <nl> + upb_gfree ( o ) ; <nl> } <nl> <nl> + const struct upb_refcounted_vtbl upb_oneofdef_vtbl = { visitoneof , freeoneof } ; <nl> + <nl> upb_oneofdef * upb_oneofdef_new ( const void * owner ) { <nl> - static const struct upb_refcounted_vtbl vtbl = { visitoneof , freeoneof } ; <nl> - upb_oneofdef * o = malloc ( sizeof ( * o ) ) ; <nl> + upb_oneofdef * o = upb_gmalloc ( sizeof ( * o ) ) ; <nl> + <nl> + if ( ! o ) { <nl> + return NULL ; <nl> + } <nl> + <nl> o - > parent = NULL ; <nl> - if ( ! o ) return NULL ; <nl> - if ( ! upb_refcounted_init ( upb_oneofdef_upcast_mutable ( o ) , & vtbl , owner ) ) <nl> - goto err2 ; <nl> o - > name = NULL ; <nl> + <nl> + if ( ! upb_refcounted_init ( upb_oneofdef_upcast_mutable ( o ) , & upb_oneofdef_vtbl , <nl> + owner ) ) { <nl> + goto err2 ; <nl> + } <nl> + <nl> if ( ! upb_inttable_init ( & o - > itof , UPB_CTYPE_PTR ) ) goto err2 ; <nl> if ( ! upb_strtable_init ( & o - > ntof , UPB_CTYPE_PTR ) ) goto err1 ; <nl> + <nl> return o ; <nl> <nl> err1 : <nl> upb_inttable_uninit ( & o - > itof ) ; <nl> err2 : <nl> - free ( o ) ; <nl> + upb_gfree ( o ) ; <nl> return NULL ; <nl> } <nl> <nl> bool upb_oneofdef_setname ( upb_oneofdef * o , const char * name , upb_status * s ) { <nl> upb_status_seterrmsg ( s , " oneof already added to a message " ) ; <nl> return false ; <nl> } <nl> - if ( ! upb_isident ( name , strlen ( name ) , true , s ) ) return false ; <nl> - free ( ( void * ) o - > name ) ; <nl> - o - > name = upb_strdup ( name ) ; <nl> + <nl> + if ( ! upb_isident ( name , strlen ( name ) , true , s ) ) { <nl> + return false ; <nl> + } <nl> + <nl> + name = upb_gstrdup ( name ) ; <nl> + if ( ! name ) { <nl> + upb_status_seterrmsg ( s , " One of memory " ) ; <nl> + return false ; <nl> + } <nl> + <nl> + upb_gfree ( ( void * ) o - > name ) ; <nl> + o - > name = name ; <nl> return true ; <nl> } <nl> <nl> static void freefiledef ( upb_refcounted * r ) { <nl> <nl> upb_inttable_uninit ( & f - > defs ) ; <nl> upb_inttable_uninit ( & f - > deps ) ; <nl> - free ( ( void * ) f - > name ) ; <nl> - free ( ( void * ) f - > package ) ; <nl> - free ( f ) ; <nl> + upb_gfree ( ( void * ) f - > name ) ; <nl> + upb_gfree ( ( void * ) f - > package ) ; <nl> + upb_gfree ( f ) ; <nl> } <nl> <nl> + const struct upb_refcounted_vtbl upb_filedef_vtbl = { visitfiledef , freefiledef } ; <nl> + <nl> upb_filedef * upb_filedef_new ( const void * owner ) { <nl> - static const struct upb_refcounted_vtbl vtbl = { visitfiledef , freefiledef } ; <nl> - upb_filedef * f = malloc ( sizeof ( * f ) ) ; <nl> + upb_filedef * f = upb_gmalloc ( sizeof ( * f ) ) ; <nl> <nl> if ( ! f ) { <nl> return NULL ; <nl> upb_filedef * upb_filedef_new ( const void * owner ) { <nl> f - > name = NULL ; <nl> f - > syntax = UPB_SYNTAX_PROTO2 ; <nl> <nl> - if ( ! upb_refcounted_init ( upb_filedef_upcast_mutable ( f ) , & vtbl , owner ) ) { <nl> + if ( ! upb_refcounted_init ( upb_filedef_upcast_mutable ( f ) , & upb_filedef_vtbl , <nl> + owner ) ) { <nl> goto err ; <nl> } <nl> <nl> upb_filedef * upb_filedef_new ( const void * owner ) { <nl> upb_inttable_uninit ( & f - > defs ) ; <nl> <nl> err : <nl> - free ( f ) ; <nl> + upb_gfree ( f ) ; <nl> return NULL ; <nl> } <nl> <nl> const upb_filedef * upb_filedef_dep ( const upb_filedef * f , size_t i ) { <nl> } <nl> <nl> bool upb_filedef_setname ( upb_filedef * f , const char * name , upb_status * s ) { <nl> - name = upb_strdup ( name ) ; <nl> + name = upb_gstrdup ( name ) ; <nl> if ( ! name ) { <nl> - upb_status_seterrmsg ( s , " Out of memory " ) ; <nl> + upb_upberr_setoom ( s ) ; <nl> return false ; <nl> } <nl> - free ( ( void * ) f - > name ) ; <nl> + upb_gfree ( ( void * ) f - > name ) ; <nl> f - > name = name ; <nl> return true ; <nl> } <nl> bool upb_filedef_setname ( upb_filedef * f , const char * name , upb_status * s ) { <nl> bool upb_filedef_setpackage ( upb_filedef * f , const char * package , <nl> upb_status * s ) { <nl> if ( ! upb_isident ( package , strlen ( package ) , true , s ) ) return false ; <nl> - package = upb_strdup ( package ) ; <nl> + package = upb_gstrdup ( package ) ; <nl> if ( ! package ) { <nl> - upb_status_seterrmsg ( s , " Out of memory " ) ; <nl> + upb_upberr_setoom ( s ) ; <nl> return false ; <nl> } <nl> - free ( ( void * ) f - > package ) ; <nl> + upb_gfree ( ( void * ) f - > package ) ; <nl> f - > package = package ; <nl> return true ; <nl> } <nl> bool upb_filedef_adddef ( upb_filedef * f , upb_def * def , const void * ref_donor , <nl> } <nl> return true ; <nl> } else { <nl> - upb_status_seterrmsg ( s , " Out of memory . " ) ; <nl> + upb_upberr_setoom ( s ) ; <nl> return false ; <nl> } <nl> } <nl> bool upb_filedef_adddep ( upb_filedef * f , const upb_filedef * dep ) { <nl> return false ; <nl> } <nl> } <nl> - <nl> - <nl> - # include < stdlib . h > <nl> - # include < stdio . h > <nl> - # include < string . h > <nl> - <nl> - typedef struct cleanup_ent { <nl> - upb_cleanup_func * cleanup ; <nl> - void * ud ; <nl> - struct cleanup_ent * next ; <nl> - } cleanup_ent ; <nl> - <nl> - static void * seeded_alloc ( void * ud , void * ptr , size_t oldsize , size_t size ) ; <nl> - <nl> - / * Default allocator * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Just use realloc , keeping all allocated blocks in a linked list to destroy at <nl> - * the end . * / <nl> - <nl> - typedef struct mem_block { <nl> - / * List is doubly - linked , because in cases where realloc ( ) moves an existing <nl> - * block , we need to be able to remove the old pointer from the list <nl> - * efficiently . * / <nl> - struct mem_block * prev , * next ; <nl> - # ifndef NDEBUG <nl> - size_t size ; / * Doesn ' t include mem_block structure . * / <nl> - # endif <nl> - } mem_block ; <nl> - <nl> - typedef struct { <nl> - mem_block * head ; <nl> - } default_alloc_ud ; <nl> - <nl> - static void * default_alloc ( void * _ud , void * ptr , size_t oldsize , size_t size ) { <nl> - default_alloc_ud * ud = _ud ; <nl> - mem_block * from , * block ; <nl> - void * ret ; <nl> - UPB_UNUSED ( oldsize ) ; <nl> - <nl> - from = ptr ? ( void * ) ( ( char * ) ptr - sizeof ( mem_block ) ) : NULL ; <nl> - <nl> - # ifndef NDEBUG <nl> - if ( from ) { <nl> - assert ( oldsize < = from - > size ) ; <nl> - } <nl> - # endif <nl> - <nl> - / * TODO ( haberman ) : we probably need to provide even better alignment here , <nl> - * like 16 - byte alignment of the returned data pointer . * / <nl> - block = realloc ( from , size + sizeof ( mem_block ) ) ; <nl> - if ( ! block ) return NULL ; <nl> - ret = ( char * ) block + sizeof ( * block ) ; <nl> - <nl> - # ifndef NDEBUG <nl> - block - > size = size ; <nl> - # endif <nl> - <nl> - if ( from ) { <nl> - if ( block ! = from ) { <nl> - / * The block was moved , so pointers in next and prev blocks must be <nl> - * updated to its new location . * / <nl> - if ( block - > next ) block - > next - > prev = block ; <nl> - if ( block - > prev ) block - > prev - > next = block ; <nl> - if ( ud - > head = = from ) ud - > head = block ; <nl> - } <nl> - } else { <nl> - / * Insert at head of linked list . * / <nl> - block - > prev = NULL ; <nl> - block - > next = ud - > head ; <nl> - if ( block - > next ) block - > next - > prev = block ; <nl> - ud - > head = block ; <nl> - } <nl> - <nl> - return ret ; <nl> - } <nl> - <nl> - static void default_alloc_cleanup ( void * _ud ) { <nl> - default_alloc_ud * ud = _ud ; <nl> - mem_block * block = ud - > head ; <nl> - <nl> - while ( block ) { <nl> - void * to_free = block ; <nl> - block = block - > next ; <nl> - free ( to_free ) ; <nl> - } <nl> - } <nl> - <nl> - <nl> - / * Standard error functions * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - static bool default_err ( void * ud , const upb_status * status ) { <nl> - UPB_UNUSED ( ud ) ; <nl> - UPB_UNUSED ( status ) ; <nl> - return false ; <nl> - } <nl> - <nl> - static bool write_err_to ( void * ud , const upb_status * status ) { <nl> - upb_status * copy_to = ud ; <nl> - upb_status_copy ( copy_to , status ) ; <nl> - return false ; <nl> - } <nl> - <nl> - <nl> - / * upb_env * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - void upb_env_init ( upb_env * e ) { <nl> - default_alloc_ud * ud = ( default_alloc_ud * ) & e - > default_alloc_ud ; <nl> - e - > ok_ = true ; <nl> - e - > bytes_allocated = 0 ; <nl> - e - > cleanup_head = NULL ; <nl> - <nl> - ud - > head = NULL ; <nl> - <nl> - / * Set default functions . * / <nl> - upb_env_setallocfunc ( e , default_alloc , ud ) ; <nl> - upb_env_seterrorfunc ( e , default_err , NULL ) ; <nl> - } <nl> - <nl> - void upb_env_uninit ( upb_env * e ) { <nl> - cleanup_ent * ent = e - > cleanup_head ; <nl> - <nl> - while ( ent ) { <nl> - ent - > cleanup ( ent - > ud ) ; <nl> - ent = ent - > next ; <nl> - } <nl> - <nl> - / * Must do this after running cleanup functions , because this will delete <nl> - the memory we store our cleanup entries in ! * / <nl> - if ( e - > alloc = = default_alloc ) { <nl> - default_alloc_cleanup ( e - > alloc_ud ) ; <nl> - } <nl> - } <nl> - <nl> - UPB_FORCEINLINE void upb_env_setallocfunc ( upb_env * e , upb_alloc_func * alloc , <nl> - void * ud ) { <nl> - e - > alloc = alloc ; <nl> - e - > alloc_ud = ud ; <nl> - } <nl> - <nl> - UPB_FORCEINLINE void upb_env_seterrorfunc ( upb_env * e , upb_error_func * func , <nl> - void * ud ) { <nl> - e - > err = func ; <nl> - e - > err_ud = ud ; <nl> - } <nl> - <nl> - void upb_env_reporterrorsto ( upb_env * e , upb_status * status ) { <nl> - e - > err = write_err_to ; <nl> - e - > err_ud = status ; <nl> - } <nl> - <nl> - bool upb_env_ok ( const upb_env * e ) { <nl> - return e - > ok_ ; <nl> - } <nl> - <nl> - bool upb_env_reporterror ( upb_env * e , const upb_status * status ) { <nl> - e - > ok_ = false ; <nl> - return e - > err ( e - > err_ud , status ) ; <nl> - } <nl> - <nl> - bool upb_env_addcleanup ( upb_env * e , upb_cleanup_func * func , void * ud ) { <nl> - cleanup_ent * ent = upb_env_malloc ( e , sizeof ( cleanup_ent ) ) ; <nl> - if ( ! ent ) return false ; <nl> - <nl> - ent - > cleanup = func ; <nl> - ent - > ud = ud ; <nl> - ent - > next = e - > cleanup_head ; <nl> - e - > cleanup_head = ent ; <nl> - <nl> - return true ; <nl> - } <nl> - <nl> - void * upb_env_malloc ( upb_env * e , size_t size ) { <nl> - e - > bytes_allocated + = size ; <nl> - if ( e - > alloc = = seeded_alloc ) { <nl> - / * This is equivalent to the next branch , but allows inlining for a <nl> - * measurable perf benefit . * / <nl> - return seeded_alloc ( e - > alloc_ud , NULL , 0 , size ) ; <nl> - } else { <nl> - return e - > alloc ( e - > alloc_ud , NULL , 0 , size ) ; <nl> - } <nl> - } <nl> - <nl> - void * upb_env_realloc ( upb_env * e , void * ptr , size_t oldsize , size_t size ) { <nl> - char * ret ; <nl> - assert ( oldsize < = size ) ; <nl> - ret = e - > alloc ( e - > alloc_ud , ptr , oldsize , size ) ; <nl> - <nl> - # ifndef NDEBUG <nl> - / * Overwrite non - preserved memory to ensure callers are passing the oldsize <nl> - * that they truly require . * / <nl> - memset ( ret + oldsize , 0xff , size - oldsize ) ; <nl> - # endif <nl> - <nl> - return ret ; <nl> - } <nl> - <nl> - size_t upb_env_bytesallocated ( const upb_env * e ) { <nl> - return e - > bytes_allocated ; <nl> - } <nl> - <nl> - <nl> - / * upb_seededalloc * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Be conservative and choose 16 in case anyone is using SSE . * / <nl> - static const size_t maxalign = 16 ; <nl> - <nl> - static size_t align_up ( size_t size ) { <nl> - return ( ( size + maxalign - 1 ) / maxalign ) * maxalign ; <nl> - } <nl> - <nl> - UPB_FORCEINLINE static void * seeded_alloc ( void * ud , void * ptr , size_t oldsize , <nl> - size_t size ) { <nl> - upb_seededalloc * a = ud ; <nl> - <nl> - size = align_up ( size ) ; <nl> - <nl> - assert ( a - > mem_limit > = a - > mem_ptr ) ; <nl> - <nl> - if ( oldsize = = 0 & & size < = ( size_t ) ( a - > mem_limit - a - > mem_ptr ) ) { <nl> - / * Fast path : we can satisfy from the initial allocation . * / <nl> - void * ret = a - > mem_ptr ; <nl> - a - > mem_ptr + = size ; <nl> - return ret ; <nl> - } else { <nl> - char * chptr = ptr ; <nl> - / * Slow path : fallback to other allocator . * / <nl> - a - > need_cleanup = true ; <nl> - / * Is ` ptr ` part of the user - provided initial block ? Don ' t pass it to the <nl> - * default allocator if so ; otherwise , it may try to realloc ( ) the block . * / <nl> - if ( chptr > = a - > mem_base & & chptr < a - > mem_limit ) { <nl> - void * ret ; <nl> - assert ( chptr + oldsize < = a - > mem_limit ) ; <nl> - ret = a - > alloc ( a - > alloc_ud , NULL , 0 , size ) ; <nl> - if ( ret ) memcpy ( ret , ptr , oldsize ) ; <nl> - return ret ; <nl> - } else { <nl> - return a - > alloc ( a - > alloc_ud , ptr , oldsize , size ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - void upb_seededalloc_init ( upb_seededalloc * a , void * mem , size_t len ) { <nl> - default_alloc_ud * ud = ( default_alloc_ud * ) & a - > default_alloc_ud ; <nl> - a - > mem_base = mem ; <nl> - a - > mem_ptr = mem ; <nl> - a - > mem_limit = ( char * ) mem + len ; <nl> - a - > need_cleanup = false ; <nl> - a - > returned_allocfunc = false ; <nl> - <nl> - ud - > head = NULL ; <nl> - <nl> - upb_seededalloc_setfallbackalloc ( a , default_alloc , ud ) ; <nl> - } <nl> - <nl> - void upb_seededalloc_uninit ( upb_seededalloc * a ) { <nl> - if ( a - > alloc = = default_alloc & & a - > need_cleanup ) { <nl> - default_alloc_cleanup ( a - > alloc_ud ) ; <nl> - } <nl> - } <nl> - <nl> - UPB_FORCEINLINE void upb_seededalloc_setfallbackalloc ( upb_seededalloc * a , <nl> - upb_alloc_func * alloc , <nl> - void * ud ) { <nl> - assert ( ! a - > returned_allocfunc ) ; <nl> - a - > alloc = alloc ; <nl> - a - > alloc_ud = ud ; <nl> - } <nl> - <nl> - upb_alloc_func * upb_seededalloc_getallocfunc ( upb_seededalloc * a ) { <nl> - a - > returned_allocfunc = true ; <nl> - return seeded_alloc ; <nl> - } <nl> / * <nl> * * TODO ( haberman ) : it ' s unclear whether a lot of the consistency checks should <nl> * * assert ( ) or return false . <nl> * / <nl> <nl> <nl> - # include < stdlib . h > <nl> # include < string . h > <nl> <nl> <nl> + static void * upb_calloc ( size_t size ) { <nl> + void * mem = upb_gmalloc ( size ) ; <nl> + if ( mem ) { <nl> + memset ( mem , 0 , size ) ; <nl> + } <nl> + return mem ; <nl> + } <nl> <nl> / * Defined for the sole purpose of having a unique pointer value for <nl> * UPB_NO_CLOSURE . * / <nl> static void freehandlers ( upb_refcounted * r ) { <nl> <nl> upb_inttable_uninit ( & h - > cleanup_ ) ; <nl> upb_msgdef_unref ( h - > msg , h ) ; <nl> - free ( h - > sub ) ; <nl> - free ( h ) ; <nl> + upb_gfree ( h - > sub ) ; <nl> + upb_gfree ( h ) ; <nl> } <nl> <nl> static void visithandlers ( const upb_refcounted * r , upb_refcounted_visit * visit , <nl> upb_handlers * upb_handlers_new ( const upb_msgdef * md , const void * owner ) { <nl> assert ( upb_msgdef_isfrozen ( md ) ) ; <nl> <nl> extra = sizeof ( upb_handlers_tabent ) * ( md - > selector_count - 1 ) ; <nl> - h = calloc ( sizeof ( * h ) + extra , 1 ) ; <nl> + h = upb_calloc ( sizeof ( * h ) + extra ) ; <nl> if ( ! h ) return NULL ; <nl> <nl> h - > msg = md ; <nl> upb_msgdef_ref ( h - > msg , h ) ; <nl> upb_status_clear ( & h - > status_ ) ; <nl> - h - > sub = calloc ( md - > submsg_field_count , sizeof ( * h - > sub ) ) ; <nl> - if ( ! h - > sub ) goto oom ; <nl> + <nl> + if ( md - > submsg_field_count > 0 ) { <nl> + h - > sub = upb_calloc ( md - > submsg_field_count * sizeof ( * h - > sub ) ) ; <nl> + if ( ! h - > sub ) goto oom ; <nl> + } else { <nl> + h - > sub = 0 ; <nl> + } <nl> + <nl> if ( ! upb_refcounted_init ( upb_handlers_upcast_mutable ( h ) , & vtbl , owner ) ) <nl> goto oom ; <nl> if ( ! upb_inttable_init ( & h - > cleanup_ , UPB_CTYPE_FPTR ) ) goto oom ; <nl> bool upb_byteshandler_setendstr ( upb_byteshandler * h , <nl> <nl> <nl> # include < setjmp . h > <nl> - # include < stdlib . h > <nl> <nl> static void freeobj ( upb_refcounted * o ) ; <nl> <nl> static void upb_unlock ( ) { } <nl> void upb_lock ( ) ; <nl> void upb_unlock ( ) ; <nl> <nl> - # endif <nl> + # endif <nl> + <nl> + / * UPB_DEBUG_REFS mode counts on being able to malloc ( ) memory in some <nl> + * code - paths that can normally never fail , like upb_refcounted_ref ( ) . Since <nl> + * we have no way to propagage out - of - memory errors back to the user , and since <nl> + * these errors can only occur in UPB_DEBUG_REFS mode , we use an allocator that <nl> + * immediately aborts on failure ( avoiding the global allocator , which might <nl> + * inject failures ) . * / <nl> + <nl> + # include < stdlib . h > <nl> + <nl> + static void * upb_debugrefs_allocfunc ( upb_alloc * alloc , void * ptr , <nl> + size_t oldsize , size_t size ) { <nl> + UPB_UNUSED ( alloc ) ; <nl> + UPB_UNUSED ( oldsize ) ; <nl> + if ( size = = 0 ) { <nl> + free ( ptr ) ; <nl> + return NULL ; <nl> + } else { <nl> + void * ret = realloc ( ptr , size ) ; <nl> + <nl> + if ( ! ret ) { <nl> + abort ( ) ; <nl> + } <nl> <nl> - / * UPB_DEBUG_REFS mode counts on being able to malloc ( ) memory in some <nl> - * code - paths that can normally never fail , like upb_refcounted_ref ( ) . Since <nl> - * we have no way to propagage out - of - memory errors back to the user , and since <nl> - * these errors can only occur in UPB_DEBUG_REFS mode , we immediately fail . * / <nl> - # define CHECK_OOM ( predicate ) if ( ! ( predicate ) ) { assert ( predicate ) ; exit ( 1 ) ; } <nl> + return ret ; <nl> + } <nl> + } <nl> + <nl> + upb_alloc upb_alloc_debugrefs = { & upb_debugrefs_allocfunc } ; <nl> <nl> typedef struct { <nl> int count ; / * How many refs there are ( duplicates only allowed for ref2 ) . * / <nl> typedef struct { <nl> } trackedref ; <nl> <nl> static trackedref * trackedref_new ( bool is_ref2 ) { <nl> - trackedref * ret = malloc ( sizeof ( * ret ) ) ; <nl> - CHECK_OOM ( ret ) ; <nl> + trackedref * ret = upb_malloc ( & upb_alloc_debugrefs , sizeof ( * ret ) ) ; <nl> ret - > count = 1 ; <nl> ret - > is_ref2 = is_ref2 ; <nl> return ret ; <nl> static void track ( const upb_refcounted * r , const void * owner , bool ref2 ) { <nl> ref - > count + + ; <nl> } else { <nl> trackedref * ref = trackedref_new ( ref2 ) ; <nl> - bool ok = upb_inttable_insertptr ( r - > refs , owner , upb_value_ptr ( ref ) ) ; <nl> - CHECK_OOM ( ok ) ; <nl> + upb_inttable_insertptr2 ( r - > refs , owner , upb_value_ptr ( ref ) , <nl> + & upb_alloc_debugrefs ) ; <nl> if ( ref2 ) { <nl> / * We know this cast is safe when it is a ref2 , because it ' s coming from <nl> * another refcounted object . * / <nl> const upb_refcounted * from = owner ; <nl> assert ( ! upb_inttable_lookupptr ( from - > ref2s , r , NULL ) ) ; <nl> - ok = upb_inttable_insertptr ( from - > ref2s , r , upb_value_ptr ( NULL ) ) ; <nl> - CHECK_OOM ( ok ) ; <nl> + upb_inttable_insertptr2 ( from - > ref2s , r , upb_value_ptr ( NULL ) , <nl> + & upb_alloc_debugrefs ) ; <nl> } <nl> } <nl> upb_unlock ( ) ; <nl> static void getref2s ( const upb_refcounted * owner , upb_inttable * tab ) { <nl> upb_value v ; <nl> upb_value count ; <nl> trackedref * ref ; <nl> - bool ok ; <nl> bool found ; <nl> <nl> upb_refcounted * to = ( upb_refcounted * ) upb_inttable_iter_key ( & i ) ; <nl> static void getref2s ( const upb_refcounted * owner , upb_inttable * tab ) { <nl> ref = upb_value_getptr ( v ) ; <nl> count = upb_value_int32 ( ref - > count ) ; <nl> <nl> - ok = upb_inttable_insertptr ( tab , to , count ) ; <nl> - CHECK_OOM ( ok ) ; <nl> + upb_inttable_insertptr2 ( tab , to , count , & upb_alloc_debugrefs ) ; <nl> } <nl> upb_unlock ( ) ; <nl> } <nl> static void visit_check ( const upb_refcounted * obj , const upb_refcounted * subobj , <nl> assert ( removed ) ; <nl> newcount = upb_value_getint32 ( v ) - 1 ; <nl> if ( newcount > 0 ) { <nl> - upb_inttable_insert ( ref2 , ( uintptr_t ) subobj , upb_value_int32 ( newcount ) ) ; <nl> + upb_inttable_insert2 ( ref2 , ( uintptr_t ) subobj , upb_value_int32 ( newcount ) , <nl> + & upb_alloc_debugrefs ) ; <nl> } <nl> } <nl> <nl> static void visit ( const upb_refcounted * r , upb_refcounted_visit * v , <nl> void * closure ) { <nl> - bool ok ; <nl> - <nl> / * In DEBUG_REFS mode we know what existing ref2 refs there are , so we know <nl> * exactly the set of nodes that visit ( ) should visit . So we verify visit ( ) ' s <nl> * correctness here . * / <nl> check_state state ; <nl> state . obj = r ; <nl> - ok = upb_inttable_init ( & state . ref2 , UPB_CTYPE_INT32 ) ; <nl> - CHECK_OOM ( ok ) ; <nl> + upb_inttable_init2 ( & state . ref2 , UPB_CTYPE_INT32 , & upb_alloc_debugrefs ) ; <nl> getref2s ( r , & state . ref2 ) ; <nl> <nl> / * This should visit any children in the ref2 table . * / <nl> static void visit ( const upb_refcounted * r , upb_refcounted_visit * v , <nl> <nl> / * This assertion will fail if the visit ( ) function missed any children . * / <nl> assert ( upb_inttable_count ( & state . ref2 ) = = 0 ) ; <nl> - upb_inttable_uninit ( & state . ref2 ) ; <nl> + upb_inttable_uninit2 ( & state . ref2 , & upb_alloc_debugrefs ) ; <nl> if ( r - > vtbl - > visit ) r - > vtbl - > visit ( r , v , closure ) ; <nl> } <nl> <nl> - static bool trackinit ( upb_refcounted * r ) { <nl> - r - > refs = malloc ( sizeof ( * r - > refs ) ) ; <nl> - r - > ref2s = malloc ( sizeof ( * r - > ref2s ) ) ; <nl> - if ( ! r - > refs | | ! r - > ref2s ) goto err1 ; <nl> - <nl> - if ( ! upb_inttable_init ( r - > refs , UPB_CTYPE_PTR ) ) goto err1 ; <nl> - if ( ! upb_inttable_init ( r - > ref2s , UPB_CTYPE_PTR ) ) goto err2 ; <nl> - return true ; <nl> - <nl> - err2 : <nl> - upb_inttable_uninit ( r - > refs ) ; <nl> - err1 : <nl> - free ( r - > refs ) ; <nl> - free ( r - > ref2s ) ; <nl> - return false ; <nl> + static void trackinit ( upb_refcounted * r ) { <nl> + r - > refs = upb_malloc ( & upb_alloc_debugrefs , sizeof ( * r - > refs ) ) ; <nl> + r - > ref2s = upb_malloc ( & upb_alloc_debugrefs , sizeof ( * r - > ref2s ) ) ; <nl> + upb_inttable_init2 ( r - > refs , UPB_CTYPE_PTR , & upb_alloc_debugrefs ) ; <nl> + upb_inttable_init2 ( r - > ref2s , UPB_CTYPE_PTR , & upb_alloc_debugrefs ) ; <nl> } <nl> <nl> static void trackfree ( const upb_refcounted * r ) { <nl> - upb_inttable_uninit ( r - > refs ) ; <nl> - upb_inttable_uninit ( r - > ref2s ) ; <nl> - free ( r - > refs ) ; <nl> - free ( r - > ref2s ) ; <nl> + upb_inttable_uninit2 ( r - > refs , & upb_alloc_debugrefs ) ; <nl> + upb_inttable_uninit2 ( r - > ref2s , & upb_alloc_debugrefs ) ; <nl> + upb_free ( & upb_alloc_debugrefs , r - > refs ) ; <nl> + upb_free ( & upb_alloc_debugrefs , r - > ref2s ) ; <nl> } <nl> <nl> # else <nl> static void checkref ( const upb_refcounted * r , const void * owner , bool ref2 ) { <nl> UPB_UNUSED ( ref2 ) ; <nl> } <nl> <nl> - static bool trackinit ( upb_refcounted * r ) { <nl> + static void trackinit ( upb_refcounted * r ) { <nl> UPB_UNUSED ( r ) ; <nl> - return true ; <nl> } <nl> <nl> static void trackfree ( const upb_refcounted * r ) { <nl> static upb_refcounted * pop ( tarjan * t ) { <nl> } <nl> <nl> static void tarjan_newgroup ( tarjan * t ) { <nl> - uint32_t * group = malloc ( sizeof ( * group ) ) ; <nl> + uint32_t * group = upb_gmalloc ( sizeof ( * group ) ) ; <nl> if ( ! group ) oom ( t ) ; <nl> / * Push group and empty group leader ( we ' ll fill in leader later ) . * / <nl> if ( ! upb_inttable_push ( & t - > groups , upb_value_ptr ( group ) ) | | <nl> ! upb_inttable_push ( & t - > groups , upb_value_ptr ( NULL ) ) ) { <nl> - free ( group ) ; <nl> + upb_gfree ( group ) ; <nl> oom ( t ) ; <nl> } <nl> * group = 0 ; <nl> static bool freeze ( upb_refcounted * const * roots , int n , upb_status * s , <nl> if ( obj = = move ) { <nl> / * Removing the last object from a group . * / <nl> assert ( * obj - > group = = obj - > individual_count ) ; <nl> - free ( obj - > group ) ; <nl> + upb_gfree ( obj - > group ) ; <nl> } else { <nl> obj - > next = move - > next ; <nl> / * This may decrease to zero ; we ' ll collect GRAY objects ( if any ) that <nl> static bool freeze ( upb_refcounted * const * roots , int n , upb_status * s , <nl> / * We eagerly free ( ) the group ' s count ( since we can ' t easily determine <nl> * the group ' s remaining size it ' s the easiest way to ensure it gets <nl> * done ) . * / <nl> - free ( obj - > group ) ; <nl> + upb_gfree ( obj - > group ) ; <nl> <nl> / * Visit to release ref2 ' s ( done in a separate pass since release_ref2 <nl> * depends on o - > group being unmodified so it can test merged ( ) ) . * / <nl> static bool freeze ( upb_refcounted * const * roots , int n , upb_status * s , <nl> if ( ! ret ) { <nl> upb_inttable_begin ( & iter , & t . groups ) ; <nl> for ( ; ! upb_inttable_done ( & iter ) ; upb_inttable_next ( & iter ) ) <nl> - free ( upb_value_getptr ( upb_inttable_iter_value ( & iter ) ) ) ; <nl> + upb_gfree ( upb_value_getptr ( upb_inttable_iter_value ( & iter ) ) ) ; <nl> } <nl> upb_inttable_uninit ( & t . groups ) ; <nl> err3 : <nl> static void merge ( upb_refcounted * r , upb_refcounted * from ) { <nl> <nl> if ( merged ( r , from ) ) return ; <nl> * r - > group + = * from - > group ; <nl> - free ( from - > group ) ; <nl> + upb_gfree ( from - > group ) ; <nl> base = from ; <nl> <nl> / * Set all refcount pointers in the " from " chain to the merged refcount . <nl> static void unref ( const upb_refcounted * r ) { <nl> if ( unrefgroup ( r - > group ) ) { <nl> const upb_refcounted * o ; <nl> <nl> - free ( r - > group ) ; <nl> + upb_gfree ( r - > group ) ; <nl> <nl> / * In two passes , since release_ref2 needs a guarantee that any subobjs <nl> * are alive . * / <nl> bool upb_refcounted_init ( upb_refcounted * r , <nl> r - > vtbl = vtbl ; <nl> r - > individual_count = 0 ; <nl> r - > is_frozen = false ; <nl> - r - > group = malloc ( sizeof ( * r - > group ) ) ; <nl> + r - > group = upb_gmalloc ( sizeof ( * r - > group ) ) ; <nl> if ( ! r - > group ) return false ; <nl> * r - > group = 0 ; <nl> - if ( ! trackinit ( r ) ) { <nl> - free ( r - > group ) ; <nl> - return false ; <nl> - } <nl> + trackinit ( r ) ; <nl> upb_refcounted_ref ( r , owner ) ; <nl> return true ; <nl> } <nl> bool upb_refcounted_freeze ( upb_refcounted * const * roots , int n , upb_status * s , <nl> } <nl> <nl> <nl> - # include < stdlib . h > <nl> - <nl> / * Fallback implementation if the shim is not specialized by the JIT . * / <nl> # define SHIM_WRITER ( type , ctype ) \ <nl> bool upb_shim_set # # type ( void * c , const void * hd , ctype val ) { \ <nl> bool upb_shim_set ( upb_handlers * h , const upb_fielddef * f , size_t offset , <nl> upb_handlerattr attr = UPB_HANDLERATTR_INITIALIZER ; <nl> bool ok ; <nl> <nl> - upb_shim_data * d = malloc ( sizeof ( * d ) ) ; <nl> + upb_shim_data * d = upb_gmalloc ( sizeof ( * d ) ) ; <nl> if ( ! d ) return false ; <nl> d - > offset = offset ; <nl> d - > hasbit = hasbit ; <nl> <nl> upb_handlerattr_sethandlerdata ( & attr , d ) ; <nl> upb_handlerattr_setalwaysok ( & attr , true ) ; <nl> - upb_handlers_addcleanup ( h , d , free ) ; <nl> + upb_handlers_addcleanup ( h , d , upb_gfree ) ; <nl> <nl> # define TYPE ( u , l ) \ <nl> case UPB_TYPE_ # # u : \ <nl> const upb_shim_data * upb_shim_getdata ( const upb_handlers * h , upb_selector_t s , <nl> } <nl> <nl> <nl> - # include < stdlib . h > <nl> # include < string . h > <nl> <nl> static void upb_symtab_free ( upb_refcounted * r ) { <nl> static void upb_symtab_free ( upb_refcounted * r ) { <nl> upb_def_unref ( def , s ) ; <nl> } <nl> upb_strtable_uninit ( & s - > symtab ) ; <nl> - free ( s ) ; <nl> + upb_gfree ( s ) ; <nl> } <nl> <nl> - <nl> upb_symtab * upb_symtab_new ( const void * owner ) { <nl> static const struct upb_refcounted_vtbl vtbl = { NULL , & upb_symtab_free } ; <nl> - upb_symtab * s = malloc ( sizeof ( * s ) ) ; <nl> + <nl> + upb_symtab * s = upb_gmalloc ( sizeof ( * s ) ) ; <nl> + if ( ! s ) { <nl> + return NULL ; <nl> + } <nl> + <nl> upb_refcounted_init ( upb_symtab_upcast_mutable ( s ) , & vtbl , owner ) ; <nl> upb_strtable_init ( & s - > symtab , UPB_CTYPE_PTR ) ; <nl> return s ; <nl> static bool symtab_add ( upb_symtab * s , upb_def * const * defs , size_t n , <nl> upb_strtable addtab ; <nl> upb_inttable seen ; <nl> <nl> + if ( n = = 0 & & ! freeze_also ) { <nl> + return true ; <nl> + } <nl> + <nl> assert ( ! upb_symtab_isfrozen ( s ) ) ; <nl> if ( ! upb_strtable_init ( & addtab , UPB_CTYPE_PTR ) ) { <nl> upb_status_seterrmsg ( status , " out of memory " ) ; <nl> static bool symtab_add ( upb_symtab * s , upb_def * const * defs , size_t n , <nl> add_objs_size + + ; <nl> } <nl> <nl> - add_defs = malloc ( sizeof ( void * ) * add_objs_size ) ; <nl> + add_defs = upb_gmalloc ( sizeof ( void * ) * add_objs_size ) ; <nl> if ( add_defs = = NULL ) goto oom_err ; <nl> upb_strtable_begin ( & iter , & addtab ) ; <nl> for ( add_n = 0 ; ! upb_strtable_done ( & iter ) ; upb_strtable_next ( & iter ) ) { <nl> static bool symtab_add ( upb_symtab * s , upb_def * const * defs , size_t n , <nl> success = upb_strtable_insert ( & s - > symtab , name , upb_value_ptr ( def ) ) ; <nl> UPB_ASSERT_VAR ( success , success = = true ) ; <nl> } <nl> - free ( add_objs ) ; <nl> + upb_gfree ( add_defs ) ; <nl> return true ; <nl> <nl> oom_err : <nl> err : { <nl> } <nl> } <nl> upb_strtable_uninit ( & addtab ) ; <nl> - free ( add_objs ) ; <nl> + upb_gfree ( add_defs ) ; <nl> assert ( ! upb_ok ( status ) ) ; <nl> return false ; <nl> } <nl> bool upb_symtab_addfile ( upb_symtab * s , upb_filedef * file , upb_status * status ) { <nl> bool ret ; <nl> <nl> n = upb_filedef_defcount ( file ) ; <nl> - defs = malloc ( sizeof ( * defs ) * n ) ; <nl> + defs = upb_gmalloc ( sizeof ( * defs ) * n ) ; <nl> <nl> if ( defs = = NULL ) { <nl> upb_status_seterrmsg ( status , " Out of memory " ) ; <nl> bool upb_symtab_addfile ( upb_symtab * s , upb_filedef * file , upb_status * status ) { <nl> <nl> ret = symtab_add ( s , defs , n , NULL , upb_filedef_upcast_mutable ( file ) , status ) ; <nl> <nl> - free ( defs ) ; <nl> + upb_gfree ( defs ) ; <nl> return ret ; <nl> } <nl> <nl> const upb_def * upb_symtab_iter_def ( const upb_symtab_iter * iter ) { <nl> * / <nl> <nl> <nl> - # include < stdlib . h > <nl> # include < string . h > <nl> <nl> # define UPB_MAXARRSIZE 16 / * 64k . * / <nl> const upb_def * upb_symtab_iter_def ( const upb_symtab_iter * iter ) { <nl> # define ARRAY_SIZE ( x ) \ <nl> ( ( sizeof ( x ) / sizeof ( 0 [ x ] ) ) / ( ( size_t ) ( ! ( sizeof ( x ) % sizeof ( 0 [ x ] ) ) ) ) ) <nl> <nl> + # ifdef NDEBUG <nl> + static void upb_check_alloc ( upb_table * t , upb_alloc * a ) { <nl> + UPB_UNUSED ( t ) ; <nl> + UPB_UNUSED ( a ) ; <nl> + } <nl> + # else <nl> + static void upb_check_alloc ( upb_table * t , upb_alloc * a ) { <nl> + assert ( t - > alloc = = a ) ; <nl> + } <nl> + # endif <nl> + <nl> static const double MAX_LOAD = 0 . 85 ; <nl> <nl> / * The minimum utilization of the array part of a mixed hash / array table . This <nl> int log2ceil ( uint64_t v ) { <nl> return UPB_MIN ( UPB_MAXARRSIZE , ret ) ; <nl> } <nl> <nl> - char * upb_strdup ( const char * s ) { <nl> - return upb_strdup2 ( s , strlen ( s ) ) ; <nl> + char * upb_strdup ( const char * s , upb_alloc * a ) { <nl> + return upb_strdup2 ( s , strlen ( s ) , a ) ; <nl> } <nl> <nl> - char * upb_strdup2 ( const char * s , size_t len ) { <nl> + char * upb_strdup2 ( const char * s , size_t len , upb_alloc * a ) { <nl> size_t n ; <nl> char * p ; <nl> <nl> char * upb_strdup2 ( const char * s , size_t len ) { <nl> / * Always null - terminate , even if binary data ; but don ' t rely on the input to <nl> * have a null - terminating byte since it may be a raw binary buffer . * / <nl> n = len + 1 ; <nl> - p = malloc ( n ) ; <nl> + p = upb_malloc ( a , n ) ; <nl> if ( p ) { <nl> memcpy ( p , s , len ) ; <nl> p [ len ] = 0 ; <nl> static bool isfull ( upb_table * t ) { <nl> } <nl> } <nl> <nl> - static bool init ( upb_table * t , upb_ctype_t ctype , uint8_t size_lg2 ) { <nl> + static bool init ( upb_table * t , upb_ctype_t ctype , uint8_t size_lg2 , <nl> + upb_alloc * a ) { <nl> size_t bytes ; <nl> <nl> t - > count = 0 ; <nl> t - > ctype = ctype ; <nl> t - > size_lg2 = size_lg2 ; <nl> t - > mask = upb_table_size ( t ) ? upb_table_size ( t ) - 1 : 0 ; <nl> + # ifndef NDEBUG <nl> + t - > alloc = a ; <nl> + # endif <nl> bytes = upb_table_size ( t ) * sizeof ( upb_tabent ) ; <nl> if ( bytes > 0 ) { <nl> - t - > entries = malloc ( bytes ) ; <nl> + t - > entries = upb_malloc ( a , bytes ) ; <nl> if ( ! t - > entries ) return false ; <nl> memset ( mutable_entries ( t ) , 0 , bytes ) ; <nl> } else { <nl> static bool init ( upb_table * t , upb_ctype_t ctype , uint8_t size_lg2 ) { <nl> return true ; <nl> } <nl> <nl> - static void uninit ( upb_table * t ) { free ( mutable_entries ( t ) ) ; } <nl> + static void uninit ( upb_table * t , upb_alloc * a ) { <nl> + upb_check_alloc ( t , a ) ; <nl> + upb_free ( a , mutable_entries ( t ) ) ; <nl> + } <nl> <nl> static upb_tabent * emptyent ( upb_table * t ) { <nl> upb_tabent * e = mutable_entries ( t ) + upb_table_size ( t ) ; <nl> static size_t begin ( const upb_table * t ) { <nl> <nl> / * A simple " subclass " of upb_table that only adds a hash function for strings . * / <nl> <nl> - static upb_tabkey strcopy ( lookupkey_t k2 ) { <nl> - char * str = malloc ( k2 . str . len + sizeof ( uint32_t ) + 1 ) ; <nl> + static upb_tabkey strcopy ( lookupkey_t k2 , upb_alloc * a ) { <nl> + char * str = upb_malloc ( a , k2 . str . len + sizeof ( uint32_t ) + 1 ) ; <nl> if ( str = = NULL ) return 0 ; <nl> memcpy ( str , & k2 . str . len , sizeof ( uint32_t ) ) ; <nl> memcpy ( str + sizeof ( uint32_t ) , k2 . str . str , k2 . str . len + 1 ) ; <nl> static bool streql ( upb_tabkey k1 , lookupkey_t k2 ) { <nl> return len = = k2 . str . len & & memcmp ( str , k2 . str . str , len ) = = 0 ; <nl> } <nl> <nl> - bool upb_strtable_init ( upb_strtable * t , upb_ctype_t ctype ) { <nl> - return init ( & t - > t , ctype , 2 ) ; <nl> + bool upb_strtable_init2 ( upb_strtable * t , upb_ctype_t ctype , upb_alloc * a ) { <nl> + return init ( & t - > t , ctype , 2 , a ) ; <nl> } <nl> <nl> - void upb_strtable_uninit ( upb_strtable * t ) { <nl> + void upb_strtable_uninit2 ( upb_strtable * t , upb_alloc * a ) { <nl> size_t i ; <nl> for ( i = 0 ; i < upb_table_size ( & t - > t ) ; i + + ) <nl> - free ( ( void * ) t - > t . entries [ i ] . key ) ; <nl> - uninit ( & t - > t ) ; <nl> + upb_free ( a , ( void * ) t - > t . entries [ i ] . key ) ; <nl> + uninit ( & t - > t , a ) ; <nl> } <nl> <nl> - bool upb_strtable_resize ( upb_strtable * t , size_t size_lg2 ) { <nl> + bool upb_strtable_resize ( upb_strtable * t , size_t size_lg2 , upb_alloc * a ) { <nl> upb_strtable new_table ; <nl> upb_strtable_iter i ; <nl> <nl> - if ( ! init ( & new_table . t , t - > t . ctype , size_lg2 ) ) <nl> + upb_check_alloc ( & t - > t , a ) ; <nl> + <nl> + if ( ! init ( & new_table . t , t - > t . ctype , size_lg2 , a ) ) <nl> return false ; <nl> upb_strtable_begin ( & i , t ) ; <nl> for ( ; ! upb_strtable_done ( & i ) ; upb_strtable_next ( & i ) ) { <nl> - upb_strtable_insert2 ( <nl> + upb_strtable_insert3 ( <nl> & new_table , <nl> upb_strtable_iter_key ( & i ) , <nl> upb_strtable_iter_keylength ( & i ) , <nl> - upb_strtable_iter_value ( & i ) ) ; <nl> + upb_strtable_iter_value ( & i ) , <nl> + a ) ; <nl> } <nl> - upb_strtable_uninit ( t ) ; <nl> + upb_strtable_uninit2 ( t , a ) ; <nl> * t = new_table ; <nl> return true ; <nl> } <nl> <nl> - bool upb_strtable_insert2 ( upb_strtable * t , const char * k , size_t len , <nl> - upb_value v ) { <nl> + bool upb_strtable_insert3 ( upb_strtable * t , const char * k , size_t len , <nl> + upb_value v , upb_alloc * a ) { <nl> lookupkey_t key ; <nl> upb_tabkey tabkey ; <nl> uint32_t hash ; <nl> <nl> + upb_check_alloc ( & t - > t , a ) ; <nl> + <nl> if ( isfull ( & t - > t ) ) { <nl> / * Need to resize . New table of double the size , add old elements to it . * / <nl> - if ( ! upb_strtable_resize ( t , t - > t . size_lg2 + 1 ) ) { <nl> + if ( ! upb_strtable_resize ( t , t - > t . size_lg2 + 1 , a ) ) { <nl> return false ; <nl> } <nl> } <nl> <nl> key = strkey2 ( k , len ) ; <nl> - tabkey = strcopy ( key ) ; <nl> + tabkey = strcopy ( key , a ) ; <nl> if ( tabkey = = 0 ) return false ; <nl> <nl> hash = MurmurHash2 ( key . str . str , key . str . len , 0 ) ; <nl> bool upb_strtable_lookup2 ( const upb_strtable * t , const char * key , size_t len , <nl> return lookup ( & t - > t , strkey2 ( key , len ) , v , hash , & streql ) ; <nl> } <nl> <nl> - bool upb_strtable_remove2 ( upb_strtable * t , const char * key , size_t len , <nl> - upb_value * val ) { <nl> + bool upb_strtable_remove3 ( upb_strtable * t , const char * key , size_t len , <nl> + upb_value * val , upb_alloc * alloc ) { <nl> uint32_t hash = MurmurHash2 ( key , strlen ( key ) , 0 ) ; <nl> upb_tabkey tabkey ; <nl> if ( rm ( & t - > t , strkey2 ( key , len ) , val , & tabkey , hash , & streql ) ) { <nl> - free ( ( void * ) tabkey ) ; <nl> + upb_free ( alloc , ( void * ) tabkey ) ; <nl> return true ; <nl> } else { <nl> return false ; <nl> bool upb_strtable_done ( const upb_strtable_iter * i ) { <nl> upb_tabent_isempty ( str_tabent ( i ) ) ; <nl> } <nl> <nl> - const char * upb_strtable_iter_key ( upb_strtable_iter * i ) { <nl> + const char * upb_strtable_iter_key ( const upb_strtable_iter * i ) { <nl> assert ( ! upb_strtable_done ( i ) ) ; <nl> return upb_tabstr ( str_tabent ( i ) - > key , NULL ) ; <nl> } <nl> <nl> - size_t upb_strtable_iter_keylength ( upb_strtable_iter * i ) { <nl> + size_t upb_strtable_iter_keylength ( const upb_strtable_iter * i ) { <nl> uint32_t len ; <nl> assert ( ! upb_strtable_done ( i ) ) ; <nl> upb_tabstr ( str_tabent ( i ) - > key , & len ) ; <nl> static void check ( upb_inttable * t ) { <nl> } <nl> <nl> bool upb_inttable_sizedinit ( upb_inttable * t , upb_ctype_t ctype , <nl> - size_t asize , int hsize_lg2 ) { <nl> + size_t asize , int hsize_lg2 , upb_alloc * a ) { <nl> size_t array_bytes ; <nl> <nl> - if ( ! init ( & t - > t , ctype , hsize_lg2 ) ) return false ; <nl> + if ( ! init ( & t - > t , ctype , hsize_lg2 , a ) ) return false ; <nl> / * Always make the array part at least 1 long , so that we know key 0 <nl> * won ' t be in the hash part , which simplifies things . * / <nl> t - > array_size = UPB_MAX ( 1 , asize ) ; <nl> t - > array_count = 0 ; <nl> array_bytes = t - > array_size * sizeof ( upb_value ) ; <nl> - t - > array = malloc ( array_bytes ) ; <nl> + t - > array = upb_malloc ( a , array_bytes ) ; <nl> if ( ! t - > array ) { <nl> - uninit ( & t - > t ) ; <nl> + uninit ( & t - > t , a ) ; <nl> return false ; <nl> } <nl> memset ( mutable_array ( t ) , 0xff , array_bytes ) ; <nl> bool upb_inttable_sizedinit ( upb_inttable * t , upb_ctype_t ctype , <nl> return true ; <nl> } <nl> <nl> - bool upb_inttable_init ( upb_inttable * t , upb_ctype_t ctype ) { <nl> - return upb_inttable_sizedinit ( t , ctype , 0 , 4 ) ; <nl> + bool upb_inttable_init2 ( upb_inttable * t , upb_ctype_t ctype , upb_alloc * a ) { <nl> + return upb_inttable_sizedinit ( t , ctype , 0 , 4 , a ) ; <nl> } <nl> <nl> - void upb_inttable_uninit ( upb_inttable * t ) { <nl> - uninit ( & t - > t ) ; <nl> - free ( mutable_array ( t ) ) ; <nl> + void upb_inttable_uninit2 ( upb_inttable * t , upb_alloc * a ) { <nl> + uninit ( & t - > t , a ) ; <nl> + upb_free ( a , mutable_array ( t ) ) ; <nl> } <nl> <nl> - bool upb_inttable_insert ( upb_inttable * t , uintptr_t key , upb_value val ) { <nl> - / * XXX : Table can ' t store value ( uint64_t ) - 1 . Need to somehow statically <nl> - * guarantee that this is not necessary , or fix the limitation . * / <nl> + bool upb_inttable_insert2 ( upb_inttable * t , uintptr_t key , upb_value val , <nl> + upb_alloc * a ) { <nl> upb_tabval tabval ; <nl> tabval . val = val . val ; <nl> UPB_UNUSED ( tabval ) ; <nl> - assert ( upb_arrhas ( tabval ) ) ; <nl> + assert ( upb_arrhas ( tabval ) ) ; / * This will reject ( uint64_t ) - 1 . Fix this . * / <nl> + <nl> + upb_check_alloc ( & t - > t , a ) ; <nl> <nl> if ( key < t - > array_size ) { <nl> assert ( ! upb_arrhas ( t - > array [ key ] ) ) ; <nl> bool upb_inttable_insert ( upb_inttable * t , uintptr_t key , upb_value val ) { <nl> / * Need to resize the hash part , but we re - use the array part . * / <nl> size_t i ; <nl> upb_table new_table ; <nl> - if ( ! init ( & new_table , t - > t . ctype , t - > t . size_lg2 + 1 ) ) <nl> + <nl> + if ( ! init ( & new_table , t - > t . ctype , t - > t . size_lg2 + 1 , a ) ) { <nl> return false ; <nl> + } <nl> + <nl> for ( i = begin ( & t - > t ) ; i < upb_table_size ( & t - > t ) ; i = next ( & t - > t , i ) ) { <nl> const upb_tabent * e = & t - > t . entries [ i ] ; <nl> uint32_t hash ; <nl> bool upb_inttable_insert ( upb_inttable * t , uintptr_t key , upb_value val ) { <nl> <nl> assert ( t - > t . count = = new_table . count ) ; <nl> <nl> - uninit ( & t - > t ) ; <nl> + uninit ( & t - > t , a ) ; <nl> t - > t = new_table ; <nl> } <nl> insert ( & t - > t , intkey ( key ) , key , val , upb_inthash ( key ) , & inthash , & inteql ) ; <nl> bool upb_inttable_remove ( upb_inttable * t , uintptr_t key , upb_value * val ) { <nl> return success ; <nl> } <nl> <nl> - bool upb_inttable_push ( upb_inttable * t , upb_value val ) { <nl> - return upb_inttable_insert ( t , upb_inttable_count ( t ) , val ) ; <nl> + bool upb_inttable_push2 ( upb_inttable * t , upb_value val , upb_alloc * a ) { <nl> + upb_check_alloc ( & t - > t , a ) ; <nl> + return upb_inttable_insert2 ( t , upb_inttable_count ( t ) , val , a ) ; <nl> } <nl> <nl> upb_value upb_inttable_pop ( upb_inttable * t ) { <nl> upb_value upb_inttable_pop ( upb_inttable * t ) { <nl> return val ; <nl> } <nl> <nl> - bool upb_inttable_insertptr ( upb_inttable * t , const void * key , upb_value val ) { <nl> - return upb_inttable_insert ( t , ( uintptr_t ) key , val ) ; <nl> + bool upb_inttable_insertptr2 ( upb_inttable * t , const void * key , upb_value val , <nl> + upb_alloc * a ) { <nl> + upb_check_alloc ( & t - > t , a ) ; <nl> + return upb_inttable_insert2 ( t , ( uintptr_t ) key , val , a ) ; <nl> } <nl> <nl> bool upb_inttable_lookupptr ( const upb_inttable * t , const void * key , <nl> bool upb_inttable_removeptr ( upb_inttable * t , const void * key , upb_value * val ) { <nl> return upb_inttable_remove ( t , ( uintptr_t ) key , val ) ; <nl> } <nl> <nl> - void upb_inttable_compact ( upb_inttable * t ) { <nl> + void upb_inttable_compact2 ( upb_inttable * t , upb_alloc * a ) { <nl> / * A power - of - two histogram of the table keys . * / <nl> size_t counts [ UPB_MAXARRSIZE + 1 ] = { 0 } ; <nl> <nl> void upb_inttable_compact ( upb_inttable * t ) { <nl> int size_lg2 ; <nl> upb_inttable new_t ; <nl> <nl> + upb_check_alloc ( & t - > t , a ) ; <nl> + <nl> upb_inttable_begin ( & i , t ) ; <nl> for ( ; ! upb_inttable_done ( & i ) ; upb_inttable_next ( & i ) ) { <nl> uintptr_t key = upb_inttable_iter_key ( & i ) ; <nl> void upb_inttable_compact ( upb_inttable * t ) { <nl> size_t hash_size = hash_count ? ( hash_count / MAX_LOAD ) + 1 : 0 ; <nl> size_t hashsize_lg2 = log2ceil ( hash_size ) ; <nl> <nl> - upb_inttable_sizedinit ( & new_t , t - > t . ctype , arr_size , hashsize_lg2 ) ; <nl> + upb_inttable_sizedinit ( & new_t , t - > t . ctype , arr_size , hashsize_lg2 , a ) ; <nl> upb_inttable_begin ( & i , t ) ; <nl> for ( ; ! upb_inttable_done ( & i ) ; upb_inttable_next ( & i ) ) { <nl> uintptr_t k = upb_inttable_iter_key ( & i ) ; <nl> - upb_inttable_insert ( & new_t , k , upb_inttable_iter_value ( & i ) ) ; <nl> + upb_inttable_insert2 ( & new_t , k , upb_inttable_iter_value ( & i ) , a ) ; <nl> } <nl> assert ( new_t . array_size = = arr_size ) ; <nl> assert ( new_t . t . size_lg2 = = hashsize_lg2 ) ; <nl> } <nl> - upb_inttable_uninit ( t ) ; <nl> + upb_inttable_uninit2 ( t , a ) ; <nl> * t = new_t ; <nl> } <nl> <nl> static void nullz ( upb_status * status ) { <nl> memcpy ( status - > msg + sizeof ( status - > msg ) - len , ellipsis , len ) ; <nl> } <nl> <nl> + <nl> + / * upb_upberr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + upb_errorspace upb_upberr = { " upb error " } ; <nl> + <nl> + void upb_upberr_setoom ( upb_status * status ) { <nl> + status - > error_space_ = & upb_upberr ; <nl> + upb_status_seterrmsg ( status , " Out of memory " ) ; <nl> + } <nl> + <nl> + <nl> + / * upb_status * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> void upb_status_clear ( upb_status * status ) { <nl> if ( ! status ) return ; <nl> status - > ok_ = true ; <nl> void upb_status_vseterrf ( upb_status * status , const char * fmt , va_list args ) { <nl> nullz ( status ) ; <nl> } <nl> <nl> - void upb_status_seterrcode ( upb_status * status , upb_errorspace * space , <nl> - int code ) { <nl> - if ( ! status ) return ; <nl> - status - > ok_ = false ; <nl> - status - > error_space_ = space ; <nl> - status - > code_ = code ; <nl> - space - > set_message ( status , code ) ; <nl> - } <nl> - <nl> void upb_status_copy ( upb_status * to , const upb_status * from ) { <nl> if ( ! to ) return ; <nl> * to = * from ; <nl> } <nl> - / * This file was generated by upbc ( the upb compiler ) . <nl> + <nl> + <nl> + / * upb_alloc * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + static void * upb_global_allocfunc ( upb_alloc * alloc , void * ptr , size_t oldsize , <nl> + size_t size ) { <nl> + UPB_UNUSED ( alloc ) ; <nl> + UPB_UNUSED ( oldsize ) ; <nl> + if ( size = = 0 ) { <nl> + free ( ptr ) ; <nl> + return NULL ; <nl> + } else { <nl> + return realloc ( ptr , size ) ; <nl> + } <nl> + } <nl> + <nl> + upb_alloc upb_alloc_global = { & upb_global_allocfunc } ; <nl> + <nl> + <nl> + / * upb_arena * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * Be conservative and choose 16 in case anyone is using SSE . * / <nl> + static const size_t maxalign = 16 ; <nl> + <nl> + static size_t align_up ( size_t size ) { <nl> + return ( ( size + maxalign - 1 ) / maxalign ) * maxalign ; <nl> + } <nl> + <nl> + typedef struct mem_block { <nl> + struct mem_block * next ; <nl> + size_t size ; <nl> + size_t used ; <nl> + bool owned ; <nl> + / * Data follows . * / <nl> + } mem_block ; <nl> + <nl> + typedef struct cleanup_ent { <nl> + struct cleanup_ent * next ; <nl> + upb_cleanup_func * cleanup ; <nl> + void * ud ; <nl> + } cleanup_ent ; <nl> + <nl> + static void upb_arena_addblock ( upb_arena * a , void * ptr , size_t size , <nl> + bool owned ) { <nl> + mem_block * block = ptr ; <nl> + <nl> + block - > next = a - > block_head ; <nl> + block - > size = size ; <nl> + block - > used = align_up ( sizeof ( mem_block ) ) ; <nl> + block - > owned = owned ; <nl> + <nl> + a - > block_head = block ; <nl> + <nl> + / * TODO ( haberman ) : ASAN poison . * / <nl> + } <nl> + <nl> + <nl> + static mem_block * upb_arena_allocblock ( upb_arena * a , size_t size ) { <nl> + size_t block_size = UPB_MAX ( size , a - > next_block_size ) + sizeof ( mem_block ) ; <nl> + mem_block * block = upb_malloc ( a - > block_alloc , block_size ) ; <nl> + <nl> + if ( ! block ) { <nl> + return NULL ; <nl> + } <nl> + <nl> + upb_arena_addblock ( a , block , block_size , true ) ; <nl> + a - > next_block_size = UPB_MIN ( block_size * 2 , a - > max_block_size ) ; <nl> + <nl> + return block ; <nl> + } <nl> + <nl> + static void * upb_arena_doalloc ( upb_alloc * alloc , void * ptr , size_t oldsize , <nl> + size_t size ) { <nl> + upb_arena * a = ( upb_arena * ) alloc ; / * upb_alloc is initial member . * / <nl> + mem_block * block = a - > block_head ; <nl> + void * ret ; <nl> + <nl> + if ( size = = 0 ) { <nl> + return NULL ; / * We are an arena , don ' t need individual frees . * / <nl> + } <nl> + <nl> + size = align_up ( size ) ; <nl> + <nl> + / * TODO ( haberman ) : special - case if this is a realloc of the last alloc ? * / <nl> + <nl> + if ( ! block | | block - > size - block - > used < size ) { <nl> + / * Slow path : have to allocate a new block . * / <nl> + block = upb_arena_allocblock ( a , size ) ; <nl> + <nl> + if ( ! block ) { <nl> + return NULL ; / * Out of memory . * / <nl> + } <nl> + } <nl> + <nl> + ret = ( char * ) block + block - > used ; <nl> + block - > used + = size ; <nl> + <nl> + if ( oldsize > 0 ) { <nl> + memcpy ( ret , ptr , oldsize ) ; / * Preserve existing data . * / <nl> + } <nl> + <nl> + / * TODO ( haberman ) : ASAN unpoison . * / <nl> + <nl> + a - > bytes_allocated + = size ; <nl> + return ret ; <nl> + } <nl> + <nl> + / * Public Arena API * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + void upb_arena_init ( upb_arena * a ) { <nl> + a - > alloc . func = & upb_arena_doalloc ; <nl> + a - > block_alloc = & upb_alloc_global ; <nl> + a - > bytes_allocated = 0 ; <nl> + a - > next_block_size = 256 ; <nl> + a - > max_block_size = 16384 ; <nl> + a - > cleanup_head = NULL ; <nl> + a - > block_head = NULL ; <nl> + } <nl> + <nl> + void upb_arena_init2 ( upb_arena * a , void * mem , size_t size , upb_alloc * alloc ) { <nl> + upb_arena_init ( a ) ; <nl> + <nl> + if ( size > sizeof ( mem_block ) ) { <nl> + upb_arena_addblock ( a , mem , size , false ) ; <nl> + } <nl> + <nl> + if ( alloc ) { <nl> + a - > block_alloc = alloc ; <nl> + } <nl> + } <nl> + <nl> + void upb_arena_uninit ( upb_arena * a ) { <nl> + cleanup_ent * ent = a - > cleanup_head ; <nl> + mem_block * block = a - > block_head ; <nl> + <nl> + while ( ent ) { <nl> + ent - > cleanup ( ent - > ud ) ; <nl> + ent = ent - > next ; <nl> + } <nl> + <nl> + / * Must do this after running cleanup functions , because this will delete <nl> + * the memory we store our cleanup entries in ! * / <nl> + while ( block ) { <nl> + mem_block * next = block - > next ; <nl> + <nl> + if ( block - > owned ) { <nl> + upb_free ( a - > block_alloc , block ) ; <nl> + } <nl> + <nl> + block = next ; <nl> + } <nl> + } <nl> + <nl> + bool upb_arena_addcleanup ( upb_arena * a , upb_cleanup_func * func , void * ud ) { <nl> + cleanup_ent * ent = upb_malloc ( & a - > alloc , sizeof ( cleanup_ent ) ) ; <nl> + if ( ! ent ) { <nl> + return false ; / * Out of memory . * / <nl> + } <nl> + <nl> + ent - > cleanup = func ; <nl> + ent - > ud = ud ; <nl> + ent - > next = a - > cleanup_head ; <nl> + a - > cleanup_head = ent ; <nl> + <nl> + return true ; <nl> + } <nl> + <nl> + size_t upb_arena_bytesallocated ( const upb_arena * a ) { <nl> + return a - > bytes_allocated ; <nl> + } <nl> + <nl> + <nl> + / * Standard error functions * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + static bool default_err ( void * ud , const upb_status * status ) { <nl> + UPB_UNUSED ( ud ) ; <nl> + UPB_UNUSED ( status ) ; <nl> + return false ; <nl> + } <nl> + <nl> + static bool write_err_to ( void * ud , const upb_status * status ) { <nl> + upb_status * copy_to = ud ; <nl> + upb_status_copy ( copy_to , status ) ; <nl> + return false ; <nl> + } <nl> + <nl> + <nl> + / * upb_env * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + void upb_env_initonly ( upb_env * e ) { <nl> + e - > ok_ = true ; <nl> + e - > error_func_ = & default_err ; <nl> + e - > error_ud_ = NULL ; <nl> + } <nl> + <nl> + void upb_env_init ( upb_env * e ) { <nl> + upb_arena_init ( & e - > arena_ ) ; <nl> + upb_env_initonly ( e ) ; <nl> + } <nl> + <nl> + void upb_env_init2 ( upb_env * e , void * mem , size_t n , upb_alloc * alloc ) { <nl> + upb_arena_init2 ( & e - > arena_ , mem , n , alloc ) ; <nl> + upb_env_initonly ( e ) ; <nl> + } <nl> + <nl> + void upb_env_uninit ( upb_env * e ) { <nl> + upb_arena_uninit ( & e - > arena_ ) ; <nl> + } <nl> + <nl> + void upb_env_seterrorfunc ( upb_env * e , upb_error_func * func , void * ud ) { <nl> + e - > error_func_ = func ; <nl> + e - > error_ud_ = ud ; <nl> + } <nl> + <nl> + void upb_env_reporterrorsto ( upb_env * e , upb_status * s ) { <nl> + e - > error_func_ = & write_err_to ; <nl> + e - > error_ud_ = s ; <nl> + } <nl> + <nl> + bool upb_env_reporterror ( upb_env * e , const upb_status * status ) { <nl> + e - > ok_ = false ; <nl> + return e - > error_func_ ( e - > error_ud_ , status ) ; <nl> + } <nl> + <nl> + void * upb_env_malloc ( upb_env * e , size_t size ) { <nl> + return upb_malloc ( & e - > arena_ . alloc , size ) ; <nl> + } <nl> + <nl> + void * upb_env_realloc ( upb_env * e , void * ptr , size_t oldsize , size_t size ) { <nl> + return upb_realloc ( & e - > arena_ . alloc , ptr , oldsize , size ) ; <nl> + } <nl> + <nl> + void upb_env_free ( upb_env * e , void * ptr ) { <nl> + upb_free ( & e - > arena_ . alloc , ptr ) ; <nl> + } <nl> + <nl> + bool upb_env_addcleanup ( upb_env * e , upb_cleanup_func * func , void * ud ) { <nl> + return upb_arena_addcleanup ( & e - > arena_ , func , ud ) ; <nl> + } <nl> + <nl> + size_t upb_env_bytesallocated ( const upb_env * e ) { <nl> + return upb_arena_bytesallocated ( & e - > arena_ ) ; <nl> + } <nl> + / * This file was generated by upbc ( the upb compiler ) from the input <nl> + * file : <nl> + * <nl> + * upb / descriptor / descriptor . proto <nl> + * <nl> * Do not edit - - your changes will be discarded when the file is <nl> * regenerated . * / <nl> <nl> static upb_inttable reftables [ 264 ] ; <nl> # endif <nl> <nl> static const upb_msgdef msgs [ 22 ] = { <nl> - UPB_MSGDEF_INIT ( " google . protobuf . DescriptorProto " , 40 , 8 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 0 ] , 11 , 10 ) , UPB_STRTABLE_INIT ( 10 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 0 ] ) , & reftables [ 0 ] , & reftables [ 1 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . DescriptorProto . ExtensionRange " , 4 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 11 ] , 3 , 2 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 16 ] ) , & reftables [ 2 ] , & reftables [ 3 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . DescriptorProto . ReservedRange " , 4 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 14 ] , 3 , 2 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 20 ] ) , & reftables [ 4 ] , & reftables [ 5 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . EnumDescriptorProto " , 11 , 2 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 17 ] , 4 , 3 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 24 ] ) , & reftables [ 6 ] , & reftables [ 7 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . EnumOptions " , 8 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 0 ] , & arrays [ 21 ] , 4 , 2 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 28 ] ) , & reftables [ 8 ] , & reftables [ 9 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . EnumValueDescriptorProto " , 8 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 25 ] , 4 , 3 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 32 ] ) , & reftables [ 10 ] , & reftables [ 11 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . EnumValueOptions " , 7 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 2 ] , & arrays [ 29 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 36 ] ) , & reftables [ 12 ] , & reftables [ 13 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . FieldDescriptorProto " , 23 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 31 ] , 11 , 10 ) , UPB_STRTABLE_INIT ( 10 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 40 ] ) , & reftables [ 14 ] , & reftables [ 15 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . FieldOptions " , 12 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 4 ] , & arrays [ 42 ] , 11 , 6 ) , UPB_STRTABLE_INIT ( 7 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 56 ] ) , & reftables [ 16 ] , & reftables [ 17 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . FileDescriptorProto " , 42 , 6 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 53 ] , 13 , 12 ) , UPB_STRTABLE_INIT ( 12 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 72 ] ) , & reftables [ 18 ] , & reftables [ 19 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . FileDescriptorSet " , 6 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 66 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 1 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 88 ] ) , & reftables [ 20 ] , & reftables [ 21 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . FileOptions " , 31 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 6 ] , & arrays [ 68 ] , 39 , 15 ) , UPB_STRTABLE_INIT ( 16 , 31 , UPB_CTYPE_PTR , 5 , & strentries [ 92 ] ) , & reftables [ 22 ] , & reftables [ 23 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . MessageOptions " , 10 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 8 ] , & arrays [ 107 ] , 8 , 4 ) , UPB_STRTABLE_INIT ( 5 , 7 , UPB_CTYPE_PTR , 3 , & strentries [ 124 ] ) , & reftables [ 24 ] , & reftables [ 25 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . MethodDescriptorProto " , 15 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 115 ] , 7 , 6 ) , UPB_STRTABLE_INIT ( 6 , 7 , UPB_CTYPE_PTR , 3 , & strentries [ 132 ] ) , & reftables [ 26 ] , & reftables [ 27 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . MethodOptions " , 7 , 1 , UPB_INTTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & intentries [ 10 ] , & arrays [ 122 ] , 1 , 0 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 140 ] ) , & reftables [ 28 ] , & reftables [ 29 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . OneofDescriptorProto " , 5 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 123 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 1 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 144 ] ) , & reftables [ 30 ] , & reftables [ 31 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . ServiceDescriptorProto " , 11 , 2 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 125 ] , 4 , 3 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 148 ] ) , & reftables [ 32 ] , & reftables [ 33 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . ServiceOptions " , 7 , 1 , UPB_INTTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & intentries [ 14 ] , & arrays [ 129 ] , 1 , 0 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 152 ] ) , & reftables [ 34 ] , & reftables [ 35 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . SourceCodeInfo " , 6 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 130 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 1 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 156 ] ) , & reftables [ 36 ] , & reftables [ 37 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . SourceCodeInfo . Location " , 19 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 132 ] , 7 , 5 ) , UPB_STRTABLE_INIT ( 5 , 7 , UPB_CTYPE_PTR , 3 , & strentries [ 160 ] ) , & reftables [ 38 ] , & reftables [ 39 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . UninterpretedOption " , 18 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 139 ] , 9 , 7 ) , UPB_STRTABLE_INIT ( 7 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 168 ] ) , & reftables [ 40 ] , & reftables [ 41 ] ) , <nl> - UPB_MSGDEF_INIT ( " google . protobuf . UninterpretedOption . NamePart " , 6 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 148 ] , 3 , 2 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 184 ] ) , & reftables [ 42 ] , & reftables [ 43 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . DescriptorProto " , 40 , 8 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 0 ] , 11 , 10 ) , UPB_STRTABLE_INIT ( 10 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 0 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 0 ] , & reftables [ 1 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . DescriptorProto . ExtensionRange " , 4 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 11 ] , 3 , 2 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 16 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 2 ] , & reftables [ 3 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . DescriptorProto . ReservedRange " , 4 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 14 ] , 3 , 2 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 20 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 4 ] , & reftables [ 5 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . EnumDescriptorProto " , 11 , 2 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 17 ] , 4 , 3 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 24 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 6 ] , & reftables [ 7 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . EnumOptions " , 8 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 0 ] , & arrays [ 21 ] , 4 , 2 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 28 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 8 ] , & reftables [ 9 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . EnumValueDescriptorProto " , 8 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 25 ] , 4 , 3 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 32 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 10 ] , & reftables [ 11 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . EnumValueOptions " , 7 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 2 ] , & arrays [ 29 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 36 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 12 ] , & reftables [ 13 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . FieldDescriptorProto " , 23 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 31 ] , 11 , 10 ) , UPB_STRTABLE_INIT ( 10 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 40 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 14 ] , & reftables [ 15 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . FieldOptions " , 12 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 4 ] , & arrays [ 42 ] , 11 , 6 ) , UPB_STRTABLE_INIT ( 7 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 56 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 16 ] , & reftables [ 17 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . FileDescriptorProto " , 42 , 6 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 53 ] , 13 , 12 ) , UPB_STRTABLE_INIT ( 12 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 72 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 18 ] , & reftables [ 19 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . FileDescriptorSet " , 6 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 66 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 1 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 88 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 20 ] , & reftables [ 21 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . FileOptions " , 31 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 6 ] , & arrays [ 68 ] , 39 , 15 ) , UPB_STRTABLE_INIT ( 16 , 31 , UPB_CTYPE_PTR , 5 , & strentries [ 92 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 22 ] , & reftables [ 23 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . MessageOptions " , 10 , 1 , UPB_INTTABLE_INIT ( 1 , 1 , UPB_CTYPE_PTR , 1 , & intentries [ 8 ] , & arrays [ 107 ] , 8 , 4 ) , UPB_STRTABLE_INIT ( 5 , 7 , UPB_CTYPE_PTR , 3 , & strentries [ 124 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 24 ] , & reftables [ 25 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . MethodDescriptorProto " , 15 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 115 ] , 7 , 6 ) , UPB_STRTABLE_INIT ( 6 , 7 , UPB_CTYPE_PTR , 3 , & strentries [ 132 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 26 ] , & reftables [ 27 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . MethodOptions " , 7 , 1 , UPB_INTTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & intentries [ 10 ] , & arrays [ 122 ] , 1 , 0 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 140 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 28 ] , & reftables [ 29 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . OneofDescriptorProto " , 5 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 123 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 1 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 144 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 30 ] , & reftables [ 31 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . ServiceDescriptorProto " , 11 , 2 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 125 ] , 4 , 3 ) , UPB_STRTABLE_INIT ( 3 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 148 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 32 ] , & reftables [ 33 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . ServiceOptions " , 7 , 1 , UPB_INTTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & intentries [ 14 ] , & arrays [ 129 ] , 1 , 0 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 152 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 34 ] , & reftables [ 35 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . SourceCodeInfo " , 6 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 130 ] , 2 , 1 ) , UPB_STRTABLE_INIT ( 1 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 156 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 36 ] , & reftables [ 37 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . SourceCodeInfo . Location " , 19 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 132 ] , 7 , 5 ) , UPB_STRTABLE_INIT ( 5 , 7 , UPB_CTYPE_PTR , 3 , & strentries [ 160 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 38 ] , & reftables [ 39 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . UninterpretedOption " , 18 , 1 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 139 ] , 9 , 7 ) , UPB_STRTABLE_INIT ( 7 , 15 , UPB_CTYPE_PTR , 4 , & strentries [ 168 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 40 ] , & reftables [ 41 ] ) , <nl> + UPB_MSGDEF_INIT ( " google . protobuf . UninterpretedOption . NamePart " , 6 , 0 , UPB_INTTABLE_INIT ( 0 , 0 , UPB_CTYPE_PTR , 0 , NULL , & arrays [ 148 ] , 3 , 2 ) , UPB_STRTABLE_INIT ( 2 , 3 , UPB_CTYPE_PTR , 2 , & strentries [ 184 ] ) , false , UPB_SYNTAX_PROTO2 , & reftables [ 42 ] , & reftables [ 43 ] ) , <nl> } ; <nl> <nl> static const upb_fielddef fields [ 105 ] = { <nl> struct upb_descreader { <nl> } ; <nl> <nl> static char * upb_strndup ( const char * buf , size_t n ) { <nl> - char * ret = malloc ( n + 1 ) ; <nl> + char * ret = upb_gmalloc ( n + 1 ) ; <nl> if ( ! ret ) return NULL ; <nl> memcpy ( ret , buf , n ) ; <nl> ret [ n ] = ' \ 0 ' ; <nl> static char * upb_strndup ( const char * buf , size_t n ) { <nl> * Caller owns a ref on the returned string . * / <nl> static char * upb_join ( const char * base , const char * name ) { <nl> if ( ! base | | strlen ( base ) = = 0 ) { <nl> - return upb_strdup ( name ) ; <nl> + return upb_gstrdup ( name ) ; <nl> } else { <nl> - char * ret = malloc ( strlen ( base ) + strlen ( name ) + 2 ) ; <nl> + char * ret = upb_gmalloc ( strlen ( base ) + strlen ( name ) + 2 ) ; <nl> + if ( ! ret ) { <nl> + return NULL ; <nl> + } <nl> ret [ 0 ] = ' \ 0 ' ; <nl> strcat ( ret , base ) ; <nl> strcat ( ret , " . " ) ; <nl> static char * upb_join ( const char * base , const char * name ) { <nl> } <nl> <nl> / * Qualify the defname for all defs starting with offset " start " with " str " . * / <nl> - static void upb_descreader_qualify ( upb_filedef * f , char * str , int32_t start ) { <nl> + static bool upb_descreader_qualify ( upb_filedef * f , char * str , int32_t start ) { <nl> size_t i ; <nl> for ( i = start ; i < upb_filedef_defcount ( f ) ; i + + ) { <nl> upb_def * def = upb_filedef_mutabledef ( f , i ) ; <nl> char * name = upb_join ( str , upb_def_fullname ( def ) ) ; <nl> + if ( ! name ) { <nl> + / * Need better logic here ; at this point we ' ve qualified some names but <nl> + * not others . * / <nl> + return false ; <nl> + } <nl> upb_def_setfullname ( def , name , NULL ) ; <nl> - free ( name ) ; <nl> + upb_gfree ( name ) ; <nl> } <nl> + return true ; <nl> } <nl> <nl> <nl> void upb_descreader_startcontainer ( upb_descreader * r ) { <nl> f - > name = NULL ; <nl> } <nl> <nl> - void upb_descreader_endcontainer ( upb_descreader * r ) { <nl> + bool upb_descreader_endcontainer ( upb_descreader * r ) { <nl> upb_descreader_frame * f = & r - > stack [ - - r - > stack_len ] ; <nl> - upb_descreader_qualify ( r - > file , f - > name , f - > start ) ; <nl> - free ( f - > name ) ; <nl> + if ( ! upb_descreader_qualify ( r - > file , f - > name , f - > start ) ) { <nl> + return false ; <nl> + } <nl> + upb_gfree ( f - > name ) ; <nl> f - > name = NULL ; <nl> + return true ; <nl> } <nl> <nl> void upb_descreader_setscopename ( upb_descreader * r , char * str ) { <nl> upb_descreader_frame * f = & r - > stack [ r - > stack_len - 1 ] ; <nl> - free ( f - > name ) ; <nl> + upb_gfree ( f - > name ) ; <nl> f - > name = str ; <nl> } <nl> <nl> static bool file_end ( void * closure , const void * hd , upb_status * status ) { <nl> upb_descreader * r = closure ; <nl> UPB_UNUSED ( hd ) ; <nl> UPB_UNUSED ( status ) ; <nl> - upb_descreader_endcontainer ( r ) ; <nl> - return true ; <nl> + return upb_descreader_endcontainer ( r ) ; <nl> } <nl> <nl> static size_t file_onname ( void * closure , const void * hd , const char * buf , <nl> static size_t file_onname ( void * closure , const void * hd , const char * buf , <nl> name = upb_strndup ( buf , n ) ; <nl> / * XXX : see comment at the top of the file . * / <nl> ok = upb_filedef_setname ( r - > file , name , NULL ) ; <nl> + upb_gfree ( name ) ; <nl> UPB_ASSERT_VAR ( ok , ok ) ; <nl> return n ; <nl> } <nl> static size_t enumval_onname ( void * closure , const void * hd , const char * buf , <nl> UPB_UNUSED ( hd ) ; <nl> UPB_UNUSED ( handle ) ; <nl> / * XXX : see comment at the top of the file . * / <nl> - free ( r - > name ) ; <nl> + upb_gfree ( r - > name ) ; <nl> r - > name = upb_strndup ( buf , n ) ; <nl> r - > saw_name = true ; <nl> return n ; <nl> static bool enumval_endmsg ( void * closure , const void * hd , upb_status * status ) { <nl> } <nl> e = upb_downcast_enumdef_mutable ( upb_descreader_last ( r ) ) ; <nl> upb_enumdef_addval ( e , r - > name , r - > number , status ) ; <nl> - free ( r - > name ) ; <nl> + upb_gfree ( r - > name ) ; <nl> r - > name = NULL ; <nl> return true ; <nl> } <nl> static size_t enum_onname ( void * closure , const void * hd , const char * buf , <nl> UPB_UNUSED ( handle ) ; <nl> / * XXX : see comment at the top of the file . * / <nl> upb_def_setfullname ( upb_descreader_last ( r ) , fullname , NULL ) ; <nl> - free ( fullname ) ; <nl> + upb_gfree ( fullname ) ; <nl> return n ; <nl> } <nl> <nl> static bool field_startmsg ( void * closure , const void * hd ) { <nl> upb_descreader * r = closure ; <nl> UPB_UNUSED ( hd ) ; <nl> assert ( r - > f ) ; <nl> - free ( r - > default_string ) ; <nl> + upb_gfree ( r - > default_string ) ; <nl> r - > default_string = NULL ; <nl> <nl> / * fielddefs default to packed , but descriptors default to non - packed . * / <nl> static size_t field_onname ( void * closure , const void * hd , const char * buf , <nl> <nl> / * XXX : see comment at the top of the file . * / <nl> upb_fielddef_setname ( r - > f , name , NULL ) ; <nl> - free ( name ) ; <nl> + upb_gfree ( name ) ; <nl> return n ; <nl> } <nl> <nl> static size_t field_ontypename ( void * closure , const void * hd , const char * buf , <nl> <nl> / * XXX : see comment at the top of the file . * / <nl> upb_fielddef_setsubdefname ( r - > f , name , NULL ) ; <nl> - free ( name ) ; <nl> + upb_gfree ( name ) ; <nl> return n ; <nl> } <nl> <nl> static size_t field_onextendee ( void * closure , const void * hd , const char * buf , <nl> <nl> / * XXX : see comment at the top of the file . * / <nl> upb_fielddef_setcontainingtypename ( r - > f , name , NULL ) ; <nl> - free ( name ) ; <nl> + upb_gfree ( name ) ; <nl> return n ; <nl> } <nl> <nl> static size_t field_ondefaultval ( void * closure , const void * hd , const char * buf , <nl> / * Have to convert from string to the correct type , but we might not know the <nl> * type yet , so we save it as a string until the end of the field . <nl> * XXX : see comment at the top of the file . * / <nl> - free ( r - > default_string ) ; <nl> + upb_gfree ( r - > default_string ) ; <nl> r - > default_string = upb_strndup ( buf , n ) ; <nl> return n ; <nl> } <nl> static bool msg_end ( void * closure , const void * hd , upb_status * status ) { <nl> upb_status_seterrmsg ( status , " Encountered message with no name . " ) ; <nl> return false ; <nl> } <nl> - upb_descreader_endcontainer ( r ) ; <nl> - return true ; <nl> + return upb_descreader_endcontainer ( r ) ; <nl> } <nl> <nl> static size_t msg_name ( void * closure , const void * hd , const char * buf , <nl> static bool msg_endfield ( void * closure , const void * hd ) { <nl> return true ; <nl> } <nl> <nl> + static bool msg_onmapentry ( void * closure , const void * hd , bool mapentry ) { <nl> + upb_descreader * r = closure ; <nl> + upb_msgdef * m = upb_descreader_top ( r ) ; <nl> + UPB_UNUSED ( hd ) ; <nl> + <nl> + upb_msgdef_setmapentry ( m , mapentry ) ; <nl> + r - > f = NULL ; <nl> + return true ; <nl> + } <nl> + <nl> + <nl> <nl> / * * Code to register handlers * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> static void reghandlers ( const void * closure , upb_handlers * h ) { <nl> } else if ( upbdefs_google_protobuf_FieldOptions_is ( m ) ) { <nl> upb_handlers_setbool ( h , F ( FieldOptions , lazy ) , & field_onlazy , NULL ) ; <nl> upb_handlers_setbool ( h , F ( FieldOptions , packed ) , & field_onpacked , NULL ) ; <nl> + } else if ( upbdefs_google_protobuf_MessageOptions_is ( m ) ) { <nl> + upb_handlers_setbool ( h , F ( MessageOptions , map_entry ) , & msg_onmapentry , NULL ) ; <nl> } <nl> <nl> assert ( upb_ok ( upb_handlers_status ( h ) ) ) ; <nl> void descreader_cleanup ( void * _r ) { <nl> upb_filedef_unref ( upb_descreader_file ( r , i ) , & r - > files ) ; <nl> } <nl> <nl> - free ( r - > name ) ; <nl> + upb_gfree ( r - > name ) ; <nl> upb_inttable_uninit ( & r - > files ) ; <nl> - free ( r - > default_string ) ; <nl> + upb_gfree ( r - > default_string ) ; <nl> while ( r - > stack_len > 0 ) { <nl> upb_descreader_frame * f = & r - > stack [ - - r - > stack_len ] ; <nl> - free ( f - > name ) ; <nl> + upb_gfree ( f - > name ) ; <nl> } <nl> } <nl> <nl> static void freegroup ( upb_refcounted * r ) { <nl> # ifdef UPB_USE_JIT_X64 <nl> upb_pbdecoder_freejit ( g ) ; <nl> # endif <nl> - free ( g - > bytecode ) ; <nl> - free ( g ) ; <nl> + upb_gfree ( g - > bytecode ) ; <nl> + upb_gfree ( g ) ; <nl> } <nl> <nl> static void visitgroup ( const upb_refcounted * r , upb_refcounted_visit * visit , <nl> static void visitgroup ( const upb_refcounted * r , upb_refcounted_visit * visit , <nl> } <nl> <nl> mgroup * newgroup ( const void * owner ) { <nl> - mgroup * g = malloc ( sizeof ( * g ) ) ; <nl> + mgroup * g = upb_gmalloc ( sizeof ( * g ) ) ; <nl> static const struct upb_refcounted_vtbl vtbl = { visitgroup , freegroup } ; <nl> upb_refcounted_init ( mgroup_upcast_mutable ( g ) , & vtbl , owner ) ; <nl> upb_inttable_init ( & g - > methods , UPB_CTYPE_PTR ) ; <nl> static void freemethod ( upb_refcounted * r ) { <nl> } <nl> <nl> upb_inttable_uninit ( & method - > dispatch ) ; <nl> - free ( method ) ; <nl> + upb_gfree ( method ) ; <nl> } <nl> <nl> static void visitmethod ( const upb_refcounted * r , upb_refcounted_visit * visit , <nl> static void visitmethod ( const upb_refcounted * r , upb_refcounted_visit * visit , <nl> static upb_pbdecodermethod * newmethod ( const upb_handlers * dest_handlers , <nl> mgroup * group ) { <nl> static const struct upb_refcounted_vtbl vtbl = { visitmethod , freemethod } ; <nl> - upb_pbdecodermethod * ret = malloc ( sizeof ( * ret ) ) ; <nl> + upb_pbdecodermethod * ret = upb_gmalloc ( sizeof ( * ret ) ) ; <nl> upb_refcounted_init ( upb_pbdecodermethod_upcast_mutable ( ret ) , & vtbl , & ret ) ; <nl> upb_byteshandler_init ( & ret - > input_handler_ ) ; <nl> <nl> typedef struct { <nl> } compiler ; <nl> <nl> static compiler * newcompiler ( mgroup * group , bool lazy ) { <nl> - compiler * ret = malloc ( sizeof ( * ret ) ) ; <nl> + compiler * ret = upb_gmalloc ( sizeof ( * ret ) ) ; <nl> int i ; <nl> <nl> ret - > group = group ; <nl> static compiler * newcompiler ( mgroup * group , bool lazy ) { <nl> } <nl> <nl> static void freecompiler ( compiler * c ) { <nl> - free ( c ) ; <nl> + upb_gfree ( c ) ; <nl> } <nl> <nl> const size_t ptr_words = sizeof ( void * ) / sizeof ( uint32_t ) ; <nl> static void put32 ( compiler * c , uint32_t v ) { <nl> size_t oldsize = g - > bytecode_end - g - > bytecode ; <nl> size_t newsize = UPB_MAX ( oldsize * 2 , 64 ) ; <nl> / * TODO ( haberman ) : handle OOM . * / <nl> - g - > bytecode = realloc ( g - > bytecode , newsize * sizeof ( uint32_t ) ) ; <nl> + g - > bytecode = upb_grealloc ( g - > bytecode , oldsize * sizeof ( uint32_t ) , <nl> + newsize * sizeof ( uint32_t ) ) ; <nl> g - > bytecode_end = g - > bytecode + newsize ; <nl> c - > pc = g - > bytecode + ofs ; <nl> } <nl> bool upb_pbdecoder_setmaxnesting ( upb_pbdecoder * d , size_t max ) { <nl> * / <nl> <nl> <nl> - # include < stdlib . h > <nl> <nl> / * The output buffer is divided into segments ; a segment is a string of data <nl> * that is " ready to go " - - it does not need any varint lengths inserted into <nl> static void new_tag ( upb_handlers * h , const upb_fielddef * f , upb_wiretype_t wt , <nl> upb_handlerattr * attr ) { <nl> uint32_t n = upb_fielddef_number ( f ) ; <nl> <nl> - tag_t * tag = malloc ( sizeof ( tag_t ) ) ; <nl> + tag_t * tag = upb_gmalloc ( sizeof ( tag_t ) ) ; <nl> tag - > bytes = upb_vencode64 ( ( n < < 3 ) | wt , tag - > tag ) ; <nl> <nl> upb_handlerattr_init ( attr ) ; <nl> upb_handlerattr_sethandlerdata ( attr , tag ) ; <nl> - upb_handlers_addcleanup ( h , tag , free ) ; <nl> + upb_handlers_addcleanup ( h , tag , upb_gfree ) ; <nl> } <nl> <nl> static bool encode_tag ( upb_pb_encoder * e , const tag_t * tag ) { <nl> upb_pb_encoder * upb_pb_encoder_create ( upb_env * env , const upb_handlers * h , <nl> upb_sink * upb_pb_encoder_input ( upb_pb_encoder * e ) { return & e - > input_ ; } <nl> <nl> <nl> - # include < stdio . h > <nl> - # include < stdlib . h > <nl> - # include < string . h > <nl> <nl> upb_filedef * * upb_loaddescriptor ( const char * buf , size_t n , const void * owner , <nl> upb_status * status ) { <nl> upb_filedef * * upb_loaddescriptor ( const char * buf , size_t n , const void * owner , <nl> goto cleanup ; <nl> } <nl> <nl> - ret = malloc ( sizeof ( * ret ) * ( upb_descreader_filecount ( reader ) + 1 ) ) ; <nl> + ret = upb_gmalloc ( sizeof ( * ret ) * ( upb_descreader_filecount ( reader ) + 1 ) ) ; <nl> <nl> if ( ! ret ) { <nl> goto cleanup ; <nl> upb_filedef * * upb_loaddescriptor ( const char * buf , size_t n , const void * owner , <nl> # include < inttypes . h > <nl> # include < stdarg . h > <nl> # include < stdio . h > <nl> - # include < stdlib . h > <nl> # include < string . h > <nl> <nl> <nl> bool putf ( upb_textprinter * p , const char * fmt , . . . ) { <nl> va_end ( args_copy ) ; <nl> <nl> / * + 1 for NULL terminator ( vsprintf ( ) requires it even if we don ' t ) . * / <nl> - str = malloc ( len + 1 ) ; <nl> + str = upb_gmalloc ( len + 1 ) ; <nl> if ( ! str ) return false ; <nl> written = vsprintf ( str , fmt , args ) ; <nl> va_end ( args ) ; <nl> UPB_ASSERT_VAR ( written , written = = len ) ; <nl> <nl> ok = upb_bytessink_putbuf ( p - > output_ , p - > subc , str , len , NULL ) ; <nl> - free ( str ) ; <nl> + upb_gfree ( str ) ; <nl> return ok ; <nl> } <nl> <nl> upb_decoderet upb_vdecode_max8_wright ( upb_decoderet r ) { <nl> * * - handling of keys / escape - sequences / etc that span input buffers . <nl> * / <nl> <nl> - # include < stdio . h > <nl> - # include < stdint . h > <nl> # include < assert . h > <nl> - # include < string . h > <nl> - # include < stdlib . h > <nl> # include < errno . h > <nl> + # include < stdint . h > <nl> + # include < stdlib . h > <nl> + # include < string . h > <nl> <nl> <nl> # define UPB_JSON_MAX_DEPTH 64 <nl> static void end_object ( upb_json_parser * p ) { <nl> * final state once , when the closing ' " ' is seen . * / <nl> <nl> <nl> - # line 1246 " upb / json / parser . rl " <nl> + # line 1245 " upb / json / parser . rl " <nl> <nl> <nl> <nl> - # line 1158 " upb / json / parser . c " <nl> + # line 1157 " upb / json / parser . c " <nl> static const char _json_actions [ ] = { <nl> 0 , 1 , 0 , 1 , 2 , 1 , 3 , 1 , <nl> 5 , 1 , 6 , 1 , 7 , 1 , 8 , 1 , <nl> static const int json_en_value_machine = 27 ; <nl> static const int json_en_main = 1 ; <nl> <nl> <nl> - # line 1249 " upb / json / parser . rl " <nl> + # line 1248 " upb / json / parser . rl " <nl> <nl> size_t parse ( void * closure , const void * hd , const char * buf , size_t size , <nl> const upb_bufhandle * handle ) { <nl> size_t parse ( void * closure , const void * hd , const char * buf , size_t size , <nl> capture_resume ( parser , buf ) ; <nl> <nl> <nl> - # line 1329 " upb / json / parser . c " <nl> + # line 1328 " upb / json / parser . c " <nl> { <nl> int _klen ; <nl> unsigned int _trans ; <nl> size_t parse ( void * closure , const void * hd , const char * buf , size_t size , <nl> switch ( * _acts + + ) <nl> { <nl> case 0 : <nl> - # line 1161 " upb / json / parser . rl " <nl> + # line 1160 " upb / json / parser . rl " <nl> { p - - ; { cs = stack [ - - top ] ; goto _again ; } } <nl> break ; <nl> case 1 : <nl> - # line 1162 " upb / json / parser . rl " <nl> + # line 1161 " upb / json / parser . rl " <nl> { p - - ; { stack [ top + + ] = cs ; cs = 10 ; goto _again ; } } <nl> break ; <nl> case 2 : <nl> - # line 1166 " upb / json / parser . rl " <nl> + # line 1165 " upb / json / parser . rl " <nl> { start_text ( parser , p ) ; } <nl> break ; <nl> case 3 : <nl> - # line 1167 " upb / json / parser . rl " <nl> + # line 1166 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( end_text ( parser , p ) ) ; } <nl> break ; <nl> case 4 : <nl> - # line 1173 " upb / json / parser . rl " <nl> + # line 1172 " upb / json / parser . rl " <nl> { start_hex ( parser ) ; } <nl> break ; <nl> case 5 : <nl> - # line 1174 " upb / json / parser . rl " <nl> + # line 1173 " upb / json / parser . rl " <nl> { hexdigit ( parser , p ) ; } <nl> break ; <nl> case 6 : <nl> - # line 1175 " upb / json / parser . rl " <nl> + # line 1174 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( end_hex ( parser ) ) ; } <nl> break ; <nl> case 7 : <nl> - # line 1181 " upb / json / parser . rl " <nl> + # line 1180 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( escape ( parser , p ) ) ; } <nl> break ; <nl> case 8 : <nl> - # line 1187 " upb / json / parser . rl " <nl> + # line 1186 " upb / json / parser . rl " <nl> { p - - ; { cs = stack [ - - top ] ; goto _again ; } } <nl> break ; <nl> case 9 : <nl> - # line 1190 " upb / json / parser . rl " <nl> + # line 1189 " upb / json / parser . rl " <nl> { { stack [ top + + ] = cs ; cs = 19 ; goto _again ; } } <nl> break ; <nl> case 10 : <nl> - # line 1192 " upb / json / parser . rl " <nl> + # line 1191 " upb / json / parser . rl " <nl> { p - - ; { stack [ top + + ] = cs ; cs = 27 ; goto _again ; } } <nl> break ; <nl> case 11 : <nl> - # line 1197 " upb / json / parser . rl " <nl> + # line 1196 " upb / json / parser . rl " <nl> { start_member ( parser ) ; } <nl> break ; <nl> case 12 : <nl> - # line 1198 " upb / json / parser . rl " <nl> + # line 1197 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( end_membername ( parser ) ) ; } <nl> break ; <nl> case 13 : <nl> - # line 1201 " upb / json / parser . rl " <nl> + # line 1200 " upb / json / parser . rl " <nl> { end_member ( parser ) ; } <nl> break ; <nl> case 14 : <nl> - # line 1207 " upb / json / parser . rl " <nl> + # line 1206 " upb / json / parser . rl " <nl> { start_object ( parser ) ; } <nl> break ; <nl> case 15 : <nl> - # line 1210 " upb / json / parser . rl " <nl> + # line 1209 " upb / json / parser . rl " <nl> { end_object ( parser ) ; } <nl> break ; <nl> case 16 : <nl> - # line 1216 " upb / json / parser . rl " <nl> + # line 1215 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( start_array ( parser ) ) ; } <nl> break ; <nl> case 17 : <nl> - # line 1220 " upb / json / parser . rl " <nl> + # line 1219 " upb / json / parser . rl " <nl> { end_array ( parser ) ; } <nl> break ; <nl> case 18 : <nl> - # line 1225 " upb / json / parser . rl " <nl> + # line 1224 " upb / json / parser . rl " <nl> { start_number ( parser , p ) ; } <nl> break ; <nl> case 19 : <nl> - # line 1226 " upb / json / parser . rl " <nl> + # line 1225 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( end_number ( parser , p ) ) ; } <nl> break ; <nl> case 20 : <nl> - # line 1228 " upb / json / parser . rl " <nl> + # line 1227 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( start_stringval ( parser ) ) ; } <nl> break ; <nl> case 21 : <nl> - # line 1229 " upb / json / parser . rl " <nl> + # line 1228 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( end_stringval ( parser ) ) ; } <nl> break ; <nl> case 22 : <nl> - # line 1231 " upb / json / parser . rl " <nl> + # line 1230 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( parser_putbool ( parser , true ) ) ; } <nl> break ; <nl> case 23 : <nl> - # line 1233 " upb / json / parser . rl " <nl> + # line 1232 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( parser_putbool ( parser , false ) ) ; } <nl> break ; <nl> case 24 : <nl> - # line 1235 " upb / json / parser . rl " <nl> + # line 1234 " upb / json / parser . rl " <nl> { / * null value * / } <nl> break ; <nl> case 25 : <nl> - # line 1237 " upb / json / parser . rl " <nl> + # line 1236 " upb / json / parser . rl " <nl> { CHECK_RETURN_TOP ( start_subobject ( parser ) ) ; } <nl> break ; <nl> case 26 : <nl> - # line 1238 " upb / json / parser . rl " <nl> + # line 1237 " upb / json / parser . rl " <nl> { end_subobject ( parser ) ; } <nl> break ; <nl> case 27 : <nl> - # line 1243 " upb / json / parser . rl " <nl> + # line 1242 " upb / json / parser . rl " <nl> { p - - ; { cs = stack [ - - top ] ; goto _again ; } } <nl> break ; <nl> - # line 1515 " upb / json / parser . c " <nl> + # line 1514 " upb / json / parser . c " <nl> } <nl> } <nl> <nl> size_t parse ( void * closure , const void * hd , const char * buf , size_t size , <nl> _out : { } <nl> } <nl> <nl> - # line 1270 " upb / json / parser . rl " <nl> + # line 1269 " upb / json / parser . rl " <nl> <nl> if ( p ! = pe ) { <nl> upb_status_seterrf ( & parser - > status , " Parse error at ' % . * s ' \ n " , pe - p , p ) ; <nl> static void json_parser_reset ( upb_json_parser * p ) { <nl> <nl> / * Emit Ragel initialization of the parser . * / <nl> <nl> - # line 1569 " upb / json / parser . c " <nl> + # line 1568 " upb / json / parser . c " <nl> { <nl> cs = json_start ; <nl> top = 0 ; <nl> } <nl> <nl> - # line 1310 " upb / json / parser . rl " <nl> + # line 1309 " upb / json / parser . rl " <nl> p - > current_state = cs ; <nl> p - > parser_top = top ; <nl> accumulate_clear ( p ) ; <nl> static void free_json_parsermethod ( upb_refcounted * r ) { <nl> upb_value val = upb_inttable_iter_value ( & i ) ; <nl> upb_strtable * t = upb_value_getptr ( val ) ; <nl> upb_strtable_uninit ( t ) ; <nl> - free ( t ) ; <nl> + upb_gfree ( t ) ; <nl> } <nl> <nl> upb_inttable_uninit ( & method - > name_tables ) ; <nl> <nl> - free ( r ) ; <nl> + upb_gfree ( r ) ; <nl> } <nl> <nl> static void add_jsonname_table ( upb_json_parsermethod * m , const upb_msgdef * md ) { <nl> static void add_jsonname_table ( upb_json_parsermethod * m , const upb_msgdef * md ) { <nl> } <nl> <nl> / * TODO ( haberman ) : handle malloc failure . * / <nl> - t = malloc ( sizeof ( * t ) ) ; <nl> + t = upb_gmalloc ( sizeof ( * t ) ) ; <nl> upb_strtable_init ( t , UPB_CTYPE_CONSTPTR ) ; <nl> upb_inttable_insertptr ( & m - > name_tables , md , upb_value_ptr ( t ) ) ; <nl> <nl> static void add_jsonname_table ( upb_json_parsermethod * m , const upb_msgdef * md ) { <nl> size_t field_len = upb_fielddef_getjsonname ( f , buf , len ) ; <nl> if ( field_len > len ) { <nl> size_t len2 ; <nl> - buf = realloc ( buf , field_len ) ; <nl> + buf = upb_grealloc ( buf , 0 , field_len ) ; <nl> len = field_len ; <nl> len2 = upb_fielddef_getjsonname ( f , buf , len ) ; <nl> UPB_ASSERT_VAR ( len2 , len = = len2 ) ; <nl> static void add_jsonname_table ( upb_json_parsermethod * m , const upb_msgdef * md ) { <nl> } <nl> } <nl> <nl> - free ( buf ) ; <nl> + upb_gfree ( buf ) ; <nl> } <nl> <nl> / * Public API * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> upb_json_parsermethod * upb_json_parsermethod_new ( const upb_msgdef * md , <nl> const void * owner ) { <nl> static const struct upb_refcounted_vtbl vtbl = { visit_json_parsermethod , <nl> free_json_parsermethod } ; <nl> - upb_json_parsermethod * ret = malloc ( sizeof ( * ret ) ) ; <nl> + upb_json_parsermethod * ret = upb_gmalloc ( sizeof ( * ret ) ) ; <nl> upb_refcounted_init ( upb_json_parsermethod_upcast_mutable ( ret ) , & vtbl , owner ) ; <nl> <nl> ret - > msg = md ; <nl> const upb_byteshandler * upb_json_parsermethod_inputhandler ( <nl> * / <nl> <nl> <nl> - # include < stdlib . h > <nl> - # include < stdio . h > <nl> # include < string . h > <nl> # include < stdint . h > <nl> <nl> typedef struct { <nl> <nl> void freestrpc ( void * ptr ) { <nl> strpc * pc = ptr ; <nl> - free ( pc - > ptr ) ; <nl> - free ( pc ) ; <nl> + upb_gfree ( pc - > ptr ) ; <nl> + upb_gfree ( pc ) ; <nl> } <nl> <nl> / * Convert fielddef name to JSON name and return as a string piece . * / <nl> strpc * newstrpc ( upb_handlers * h , const upb_fielddef * f , <nl> bool preserve_fieldnames ) { <nl> / * TODO ( haberman ) : handle malloc failure . * / <nl> - strpc * ret = malloc ( sizeof ( * ret ) ) ; <nl> + strpc * ret = upb_gmalloc ( sizeof ( * ret ) ) ; <nl> if ( preserve_fieldnames ) { <nl> - ret - > ptr = upb_strdup ( upb_fielddef_name ( f ) ) ; <nl> + ret - > ptr = upb_gstrdup ( upb_fielddef_name ( f ) ) ; <nl> ret - > len = strlen ( ret - > ptr ) ; <nl> } else { <nl> size_t len ; <nl> ret - > len = upb_fielddef_getjsonname ( f , NULL , 0 ) ; <nl> - ret - > ptr = malloc ( ret - > len ) ; <nl> + ret - > ptr = upb_gmalloc ( ret - > len ) ; <nl> len = upb_fielddef_getjsonname ( f , ret - > ptr , ret - > len ) ; <nl> UPB_ASSERT_VAR ( len , len = = ret - > len ) ; <nl> ret - > len - - ; / * NULL * / <nl> static void set_enum_hd ( upb_handlers * h , <nl> const upb_fielddef * f , <nl> bool preserve_fieldnames , <nl> upb_handlerattr * attr ) { <nl> - EnumHandlerData * hd = malloc ( sizeof ( EnumHandlerData ) ) ; <nl> + EnumHandlerData * hd = upb_gmalloc ( sizeof ( EnumHandlerData ) ) ; <nl> hd - > enumdef = ( const upb_enumdef * ) upb_fielddef_subdef ( f ) ; <nl> hd - > keyname = newstrpc ( h , f , preserve_fieldnames ) ; <nl> - upb_handlers_addcleanup ( h , hd , free ) ; <nl> + upb_handlers_addcleanup ( h , hd , upb_gfree ) ; <nl> upb_handlerattr_sethandlerdata ( attr , hd ) ; <nl> } <nl> <nl> mmm a / ruby / ext / google / protobuf_c / upb . h <nl> ppp b / ruby / ext / google / protobuf_c / upb . h <nl> <nl> # include < stdbool . h > <nl> # include < stddef . h > <nl> <nl> + # ifdef __cplusplus <nl> + namespace upb { <nl> + class Allocator ; <nl> + class Arena ; <nl> + class Environment ; <nl> + class ErrorSpace ; <nl> + class Status ; <nl> + template < int N > class InlinedArena ; <nl> + template < int N > class InlinedEnvironment ; <nl> + } <nl> + # endif <nl> + <nl> / * UPB_INLINE : inline if possible , emit standalone code if required . * / <nl> # ifdef __cplusplus <nl> # define UPB_INLINE inline <nl> <nl> # define UPB_ASSERT_STDLAYOUT ( type ) \ <nl> static_assert ( std : : is_standard_layout < type > : : value , \ <nl> # type " must be standard layout " ) ; <nl> + # define UPB_FINAL final <nl> # else / * ! defined ( UPB_CXX11 ) * / <nl> # define UPB_DISALLOW_COPY_AND_ASSIGN ( class_name ) \ <nl> class_name ( const class_name & ) ; \ <nl> <nl> ~ class_name ( ) ; \ <nl> UPB_DISALLOW_COPY_AND_ASSIGN ( class_name ) <nl> # define UPB_ASSERT_STDLAYOUT ( type ) <nl> + # define UPB_FINAL <nl> # endif <nl> <nl> / * UPB_DECLARE_TYPE ( ) <nl> <nl> / * Generic function type . * / <nl> typedef void upb_func ( ) ; <nl> <nl> + <nl> / * C + + Casts * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> # ifdef __cplusplus <nl> class PointerBase2 : public PointerBase < T , Base > { <nl> # endif <nl> <nl> <nl> - / * upb : : reffed_ptr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * upb : : ErrorSpace * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * A upb : : ErrorSpace represents some domain of possible error values . This lets <nl> + * upb : : Status attach specific error codes to operations , like POSIX / C errno , <nl> + * Win32 error codes , etc . Clients who want to know the very specific error <nl> + * code can check the error space and then know the type of the integer code . <nl> + * <nl> + * NOTE : upb : : ErrorSpace is currently not used and should be considered <nl> + * experimental . It is important primarily in cases where upb is performing <nl> + * I / O , but upb doesn ' t currently have any components that do this . * / <nl> + <nl> + UPB_DECLARE_TYPE ( upb : : ErrorSpace , upb_errorspace ) <nl> <nl> # ifdef __cplusplus <nl> + class upb : : ErrorSpace { <nl> + # else <nl> + struct upb_errorspace { <nl> + # endif <nl> + const char * name ; <nl> + } ; <nl> <nl> - # include < algorithm > / * For std : : swap ( ) . * / <nl> <nl> - namespace upb { <nl> + / * upb : : Status * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> - / * Provides RAII semantics for upb refcounted objects . Each reffed_ptr owns a <nl> - * ref on whatever object it points to ( if any ) . * / <nl> - template < class T > class reffed_ptr { <nl> + / * upb : : Status represents a success or failure status and error message . <nl> + * It owns no resources and allocates no memory , so it should work <nl> + * even in OOM situations . * / <nl> + UPB_DECLARE_TYPE ( upb : : Status , upb_status ) <nl> + <nl> + / * The maximum length of an error message before it will get truncated . * / <nl> + # define UPB_STATUS_MAX_MESSAGE 128 <nl> + <nl> + UPB_BEGIN_EXTERN_C <nl> + <nl> + const char * upb_status_errmsg ( const upb_status * status ) ; <nl> + bool upb_ok ( const upb_status * status ) ; <nl> + upb_errorspace * upb_status_errspace ( const upb_status * status ) ; <nl> + int upb_status_errcode ( const upb_status * status ) ; <nl> + <nl> + / * Any of the functions that write to a status object allow status to be NULL , <nl> + * to support use cases where the function ' s caller does not care about the <nl> + * status message . * / <nl> + void upb_status_clear ( upb_status * status ) ; <nl> + void upb_status_seterrmsg ( upb_status * status , const char * msg ) ; <nl> + void upb_status_seterrf ( upb_status * status , const char * fmt , . . . ) ; <nl> + void upb_status_vseterrf ( upb_status * status , const char * fmt , va_list args ) ; <nl> + void upb_status_copy ( upb_status * to , const upb_status * from ) ; <nl> + <nl> + UPB_END_EXTERN_C <nl> + <nl> + # ifdef __cplusplus <nl> + <nl> + class upb : : Status { <nl> public : <nl> - reffed_ptr ( ) : ptr_ ( NULL ) { } <nl> + Status ( ) { upb_status_clear ( this ) ; } <nl> <nl> - / * If ref_donor is NULL , takes a new ref , otherwise adopts from ref_donor . * / <nl> - template < class U > <nl> - reffed_ptr ( U * val , const void * ref_donor = NULL ) <nl> - : ptr_ ( upb : : upcast ( val ) ) { <nl> - if ( ref_donor ) { <nl> - assert ( ptr_ ) ; <nl> - ptr_ - > DonateRef ( ref_donor , this ) ; <nl> - } else if ( ptr_ ) { <nl> - ptr_ - > Ref ( this ) ; <nl> - } <nl> - } <nl> + / * Returns true if there is no error . * / <nl> + bool ok ( ) const { return upb_ok ( this ) ; } <nl> <nl> - template < class U > <nl> - reffed_ptr ( const reffed_ptr < U > & other ) <nl> - : ptr_ ( upb : : upcast ( other . get ( ) ) ) { <nl> - if ( ptr_ ) ptr_ - > Ref ( this ) ; <nl> - } <nl> + / * Optional error space and code , useful if the caller wants to <nl> + * programmatically check the specific kind of error . * / <nl> + ErrorSpace * error_space ( ) { return upb_status_errspace ( this ) ; } <nl> + int error_code ( ) const { return upb_status_errcode ( this ) ; } <nl> <nl> - reffed_ptr ( const reffed_ptr & other ) <nl> - : ptr_ ( upb : : upcast ( other . get ( ) ) ) { <nl> - if ( ptr_ ) ptr_ - > Ref ( this ) ; <nl> + / * The returned string is invalidated by any other call into the status . * / <nl> + const char * error_message ( ) const { return upb_status_errmsg ( this ) ; } <nl> + <nl> + / * The error message will be truncated if it is longer than <nl> + * UPB_STATUS_MAX_MESSAGE - 4 . * / <nl> + void SetErrorMessage ( const char * msg ) { upb_status_seterrmsg ( this , msg ) ; } <nl> + void SetFormattedErrorMessage ( const char * fmt , . . . ) { <nl> + va_list args ; <nl> + va_start ( args , fmt ) ; <nl> + upb_status_vseterrf ( this , fmt , args ) ; <nl> + va_end ( args ) ; <nl> } <nl> <nl> - ~ reffed_ptr ( ) { if ( ptr_ ) ptr_ - > Unref ( this ) ; } <nl> + / * Resets the status to a successful state with no message . * / <nl> + void Clear ( ) { upb_status_clear ( this ) ; } <nl> <nl> - template < class U > <nl> - reffed_ptr & operator = ( const reffed_ptr < U > & other ) { <nl> - reset ( other . get ( ) ) ; <nl> - return * this ; <nl> - } <nl> + void CopyFrom ( const Status & other ) { upb_status_copy ( this , & other ) ; } <nl> <nl> - reffed_ptr & operator = ( const reffed_ptr & other ) { <nl> - reset ( other . get ( ) ) ; <nl> - return * this ; <nl> - } <nl> + private : <nl> + UPB_DISALLOW_COPY_AND_ASSIGN ( Status ) <nl> + # else <nl> + struct upb_status { <nl> + # endif <nl> + bool ok_ ; <nl> <nl> - / * TODO ( haberman ) : add C + + 11 move construction / assignment for greater <nl> - * efficiency . * / <nl> + / * Specific status code defined by some error space ( optional ) . * / <nl> + int code_ ; <nl> + upb_errorspace * error_space_ ; <nl> <nl> - void swap ( reffed_ptr & other ) { <nl> - if ( ptr_ = = other . ptr_ ) { <nl> - return ; <nl> - } <nl> + / * TODO ( haberman ) : add file / line of error ? * / <nl> <nl> - if ( ptr_ ) ptr_ - > DonateRef ( this , & other ) ; <nl> - if ( other . ptr_ ) other . ptr_ - > DonateRef ( & other , this ) ; <nl> - std : : swap ( ptr_ , other . ptr_ ) ; <nl> - } <nl> + / * Error message ; NULL - terminated . * / <nl> + char msg [ UPB_STATUS_MAX_MESSAGE ] ; <nl> + } ; <nl> <nl> - T & operator * ( ) const { <nl> - assert ( ptr_ ) ; <nl> - return * ptr_ ; <nl> - } <nl> + # define UPB_STATUS_INIT { true , 0 , NULL , { 0 } } <nl> <nl> - T * operator - > ( ) const { <nl> - assert ( ptr_ ) ; <nl> - return ptr_ ; <nl> - } <nl> <nl> - T * get ( ) const { return ptr_ ; } <nl> + / * * Built - in error spaces . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> - / * If ref_donor is NULL , takes a new ref , otherwise adopts from ref_donor . * / <nl> - template < class U > <nl> - void reset ( U * ptr = NULL , const void * ref_donor = NULL ) { <nl> - reffed_ptr ( ptr , ref_donor ) . swap ( * this ) ; <nl> - } <nl> + / * Errors raised by upb that we want to be able to detect programmatically . * / <nl> + typedef enum { <nl> + UPB_NOMEM / * Can ' t reuse ENOMEM because it is POSIX , not ISO C . * / <nl> + } upb_errcode_t ; <nl> <nl> - template < class U > <nl> - reffed_ptr < U > down_cast ( ) { <nl> - return reffed_ptr < U > ( upb : : down_cast < U * > ( get ( ) ) ) ; <nl> - } <nl> + extern upb_errorspace upb_upberr ; <nl> <nl> - template < class U > <nl> - reffed_ptr < U > dyn_cast ( ) { <nl> - return reffed_ptr < U > ( upb : : dyn_cast < U * > ( get ( ) ) ) ; <nl> - } <nl> + void upb_upberr_setoom ( upb_status * s ) ; <nl> <nl> - / * Plain release ( ) is unsafe ; if we were the only owner , it would leak the <nl> - * object . Instead we provide this : * / <nl> - T * ReleaseTo ( const void * new_owner ) { <nl> - T * ret = NULL ; <nl> - ptr_ - > DonateRef ( this , new_owner ) ; <nl> - std : : swap ( ret , ptr_ ) ; <nl> - return ret ; <nl> - } <nl> + / * Since errno is defined by standard C , we define an error space for it in <nl> + * core upb . Other error spaces should be defined in other , platform - specific <nl> + * modules . * / <nl> + <nl> + extern upb_errorspace upb_errnoerr ; <nl> + <nl> + <nl> + / * * upb : : Allocator * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * A upb : : Allocator is a possibly - stateful allocator object . <nl> + * <nl> + * It could either be an arena allocator ( which doesn ' t require individual <nl> + * free ( ) calls ) or a regular malloc ( ) ( which does ) . The client must therefore <nl> + * free memory unless it knows that the allocator is an arena allocator . * / <nl> + UPB_DECLARE_TYPE ( upb : : Allocator , upb_alloc ) <nl> + <nl> + / * A malloc ( ) / free ( ) function . <nl> + * If " size " is 0 then the function acts like free ( ) , otherwise it acts like <nl> + * realloc ( ) . Only " oldsize " bytes from a previous allocation are preserved . * / <nl> + typedef void * upb_alloc_func ( upb_alloc * alloc , void * ptr , size_t oldsize , <nl> + size_t size ) ; <nl> + <nl> + # ifdef __cplusplus <nl> + <nl> + class upb : : Allocator UPB_FINAL { <nl> + public : <nl> + Allocator ( ) { } <nl> <nl> private : <nl> - T * ptr_ ; <nl> + UPB_DISALLOW_COPY_AND_ASSIGN ( Allocator ) <nl> + <nl> + public : <nl> + # else <nl> + struct upb_alloc { <nl> + # endif / * __cplusplus * / <nl> + upb_alloc_func * func ; <nl> } ; <nl> <nl> - } / * namespace upb * / <nl> + UPB_INLINE void * upb_malloc ( upb_alloc * alloc , size_t size ) { <nl> + assert ( size > 0 ) ; <nl> + return alloc - > func ( alloc , NULL , 0 , size ) ; <nl> + } <nl> <nl> - # endif / * __cplusplus * / <nl> + UPB_INLINE void * upb_realloc ( upb_alloc * alloc , void * ptr , size_t oldsize , <nl> + size_t size ) { <nl> + assert ( size > 0 ) ; <nl> + return alloc - > func ( alloc , ptr , oldsize , size ) ; <nl> + } <nl> <nl> + UPB_INLINE void upb_free ( upb_alloc * alloc , void * ptr ) { <nl> + alloc - > func ( alloc , ptr , 0 , 0 ) ; <nl> + } <nl> <nl> - / * upb : : Status * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * The global allocator used by upb . Uses the standard malloc ( ) / free ( ) . * / <nl> <nl> - # ifdef __cplusplus <nl> - namespace upb { <nl> - class ErrorSpace ; <nl> - class Status ; <nl> + extern upb_alloc upb_alloc_global ; <nl> + <nl> + / * Functions that hard - code the global malloc . <nl> + * <nl> + * We still get benefit because we can put custom logic into our global <nl> + * allocator , like injecting out - of - memory faults in debug / testing builds . * / <nl> + <nl> + UPB_INLINE void * upb_gmalloc ( size_t size ) { <nl> + return upb_malloc ( & upb_alloc_global , size ) ; <nl> } <nl> - # endif <nl> <nl> - UPB_DECLARE_TYPE ( upb : : ErrorSpace , upb_errorspace ) <nl> - UPB_DECLARE_TYPE ( upb : : Status , upb_status ) <nl> + UPB_INLINE void * upb_grealloc ( void * ptr , size_t oldsize , size_t size ) { <nl> + return upb_realloc ( & upb_alloc_global , ptr , oldsize , size ) ; <nl> + } <nl> <nl> - / * The maximum length of an error message before it will get truncated . * / <nl> - # define UPB_STATUS_MAX_MESSAGE 128 <nl> + UPB_INLINE void upb_gfree ( void * ptr ) { <nl> + upb_free ( & upb_alloc_global , ptr ) ; <nl> + } <nl> + <nl> + / * upb : : Arena * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * upb : : Arena is a specific allocator implementation that uses arena allocation . <nl> + * The user provides an allocator that will be used to allocate the underlying <nl> + * arena blocks . Arenas by nature do not require the individual allocations <nl> + * to be freed . However the Arena does allow users to register cleanup <nl> + * functions that will run when the arena is destroyed . <nl> + * <nl> + * A upb : : Arena is * not * thread - safe . <nl> + * <nl> + * You could write a thread - safe arena allocator that satisfies the <nl> + * upb : : Allocator interface , but it would not be as efficient for the <nl> + * single - threaded case . * / <nl> + UPB_DECLARE_TYPE ( upb : : Arena , upb_arena ) <nl> + <nl> + typedef void upb_cleanup_func ( void * ud ) ; <nl> <nl> - / * An error callback function is used to report errors from some component . <nl> - * The function can return " true " to indicate that the component should try <nl> - * to recover and proceed , but this is not always possible . * / <nl> - typedef bool upb_errcb_t ( void * closure , const upb_status * status ) ; <nl> + # define UPB_ARENA_BLOCK_OVERHEAD ( sizeof ( size_t ) * 4 ) <nl> + <nl> + UPB_BEGIN_EXTERN_C <nl> + <nl> + void upb_arena_init ( upb_arena * a ) ; <nl> + void upb_arena_init2 ( upb_arena * a , void * mem , size_t n , upb_alloc * alloc ) ; <nl> + void upb_arena_uninit ( upb_arena * a ) ; <nl> + upb_alloc * upb_arena_alloc ( upb_arena * a ) ; <nl> + bool upb_arena_addcleanup ( upb_arena * a , upb_cleanup_func * func , void * ud ) ; <nl> + size_t upb_arena_bytesallocated ( const upb_arena * a ) ; <nl> + void upb_arena_setnextblocksize ( upb_arena * a , size_t size ) ; <nl> + void upb_arena_setmaxblocksize ( upb_arena * a , size_t size ) ; <nl> + <nl> + UPB_END_EXTERN_C <nl> <nl> # ifdef __cplusplus <nl> - class upb : : ErrorSpace { <nl> + <nl> + class upb : : Arena { <nl> + public : <nl> + / * A simple arena with no initial memory block and the default allocator . * / <nl> + Arena ( ) { upb_arena_init ( this ) ; } <nl> + <nl> + / * Constructs an arena with the given initial block which allocates blocks <nl> + * with the given allocator . The given allocator must outlive the Arena . <nl> + * <nl> + * If you pass NULL for the allocator it will default to the global allocator <nl> + * upb_alloc_global , and NULL / 0 for the initial block will cause there to be <nl> + * no initial block . * / <nl> + Arena ( void * mem , size_t len , Allocator * a ) { <nl> + upb_arena_init2 ( this , mem , len , a ) ; <nl> + } <nl> + <nl> + ~ Arena ( ) { upb_arena_uninit ( this ) ; } <nl> + <nl> + / * Sets the size of the next block the Arena will request ( unless the <nl> + * requested allocation is larger ) . Each block will double in size until the <nl> + * max limit is reached . * / <nl> + void SetNextBlockSize ( size_t size ) { upb_arena_setnextblocksize ( this , size ) ; } <nl> + <nl> + / * Sets the maximum block size . No blocks larger than this will be requested <nl> + * from the underlying allocator unless individual arena allocations are <nl> + * larger . * / <nl> + void SetMaxBlockSize ( size_t size ) { upb_arena_setmaxblocksize ( this , size ) ; } <nl> + <nl> + / * Allows this arena to be used as a generic allocator . <nl> + * <nl> + * The arena does not need free ( ) calls so when using Arena as an allocator <nl> + * it is safe to skip them . However they are no - ops so there is no harm in <nl> + * calling free ( ) either . * / <nl> + Allocator * allocator ( ) { return upb_arena_alloc ( this ) ; } <nl> + <nl> + / * Add a cleanup function to run when the arena is destroyed . <nl> + * Returns false on out - of - memory . * / <nl> + bool AddCleanup ( upb_cleanup_func * func , void * ud ) { <nl> + return upb_arena_addcleanup ( this , func , ud ) ; <nl> + } <nl> + <nl> + / * Total number of bytes that have been allocated . It is undefined what <nl> + * Realloc ( ) does to this counter . * / <nl> + size_t BytesAllocated ( ) const { <nl> + return upb_arena_bytesallocated ( this ) ; <nl> + } <nl> + <nl> + private : <nl> + UPB_DISALLOW_COPY_AND_ASSIGN ( Arena ) <nl> + <nl> # else <nl> - struct upb_errorspace { <nl> - # endif <nl> - const char * name ; <nl> - / * Should the error message in the status object according to this code . * / <nl> - void ( * set_message ) ( upb_status * status , int code ) ; <nl> + struct upb_arena { <nl> + # endif / * __cplusplus * / <nl> + / * We implement the allocator interface . <nl> + * This must be the first member of upb_arena ! * / <nl> + upb_alloc alloc ; <nl> + <nl> + / * Allocator to allocate arena blocks . We are responsible for freeing these <nl> + * when we are destroyed . * / <nl> + upb_alloc * block_alloc ; <nl> + <nl> + size_t bytes_allocated ; <nl> + size_t next_block_size ; <nl> + size_t max_block_size ; <nl> + <nl> + / * Linked list of blocks . Points to an arena_block , defined in env . c * / <nl> + void * block_head ; <nl> + <nl> + / * Cleanup entries . Pointer to a cleanup_ent , defined in env . c * / <nl> + void * cleanup_head ; <nl> + <nl> + / * For future expansion , since the size of this struct is exposed to users . * / <nl> + void * future1 ; <nl> + void * future2 ; <nl> } ; <nl> <nl> - # ifdef __cplusplus <nl> <nl> - / * Object representing a success or failure status . <nl> - * It owns no resources and allocates no memory , so it should work <nl> - * even in OOM situations . * / <nl> + / * upb : : Environment * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> - class upb : : Status { <nl> - public : <nl> - Status ( ) ; <nl> + / * A upb : : Environment provides a means for injecting malloc and an <nl> + * error - reporting callback into encoders / decoders . This allows them to be <nl> + * independent of nearly all assumptions about their actual environment . <nl> + * <nl> + * It is also a container for allocating the encoders / decoders themselves that <nl> + * insulates clients from knowing their actual size . This provides ABI <nl> + * compatibility even if the size of the objects change . And this allows the <nl> + * structure definitions to be in the . c files instead of the . h files , making <nl> + * the . h files smaller and more readable . <nl> + * <nl> + * We might want to consider renaming this to " Pipeline " if / when the concept of <nl> + * a pipeline element becomes more formalized . * / <nl> + UPB_DECLARE_TYPE ( upb : : Environment , upb_env ) <nl> <nl> - / * Returns true if there is no error . * / <nl> - bool ok ( ) const ; <nl> + / * A function that receives an error report from an encoder or decoder . The <nl> + * callback can return true to request that the error should be recovered , but <nl> + * if the error is not recoverable this has no effect . * / <nl> + typedef bool upb_error_func ( void * ud , const upb_status * status ) ; <nl> <nl> - / * Optional error space and code , useful if the caller wants to <nl> - * programmatically check the specific kind of error . * / <nl> - ErrorSpace * error_space ( ) ; <nl> - int code ( ) const ; <nl> + UPB_BEGIN_EXTERN_C <nl> <nl> - const char * error_message ( ) const ; <nl> + void upb_env_init ( upb_env * e ) ; <nl> + void upb_env_init2 ( upb_env * e , void * mem , size_t n , upb_alloc * alloc ) ; <nl> + void upb_env_uninit ( upb_env * e ) ; <nl> <nl> - / * The error message will be truncated if it is longer than <nl> - * UPB_STATUS_MAX_MESSAGE - 4 . * / <nl> - void SetErrorMessage ( const char * msg ) ; <nl> - void SetFormattedErrorMessage ( const char * fmt , . . . ) ; <nl> + void upb_env_initonly ( upb_env * e ) ; <nl> <nl> - / * If there is no error message already , this will use the ErrorSpace to <nl> - * populate the error message for this code . The caller can still call <nl> - * SetErrorMessage ( ) to give a more specific message . * / <nl> - void SetErrorCode ( ErrorSpace * space , int code ) ; <nl> + upb_arena * upb_env_arena ( upb_env * e ) ; <nl> + bool upb_env_ok ( const upb_env * e ) ; <nl> + void upb_env_seterrorfunc ( upb_env * e , upb_error_func * func , void * ud ) ; <nl> <nl> - / * Resets the status to a successful state with no message . * / <nl> - void Clear ( ) ; <nl> + / * Convenience wrappers around the methods of the contained arena . * / <nl> + void upb_env_reporterrorsto ( upb_env * e , upb_status * s ) ; <nl> + bool upb_env_reporterror ( upb_env * e , const upb_status * s ) ; <nl> + void * upb_env_malloc ( upb_env * e , size_t size ) ; <nl> + void * upb_env_realloc ( upb_env * e , void * ptr , size_t oldsize , size_t size ) ; <nl> + void upb_env_free ( upb_env * e , void * ptr ) ; <nl> + bool upb_env_addcleanup ( upb_env * e , upb_cleanup_func * func , void * ud ) ; <nl> + size_t upb_env_bytesallocated ( const upb_env * e ) ; <nl> + <nl> + UPB_END_EXTERN_C <nl> + <nl> + # ifdef __cplusplus <nl> + <nl> + class upb : : Environment { <nl> + public : <nl> + / * The given Arena must outlive this environment . * / <nl> + Environment ( ) { upb_env_initonly ( this ) ; } <nl> + <nl> + Environment ( void * mem , size_t len , Allocator * a ) : arena_ ( mem , len , a ) { <nl> + upb_env_initonly ( this ) ; <nl> + } <nl> <nl> - void CopyFrom ( const Status & other ) ; <nl> + Arena * arena ( ) { return upb_env_arena ( this ) ; } <nl> + <nl> + / * Set a custom error reporting function . * / <nl> + void SetErrorFunction ( upb_error_func * func , void * ud ) { <nl> + upb_env_seterrorfunc ( this , func , ud ) ; <nl> + } <nl> + <nl> + / * Set the error reporting function to simply copy the status to the given <nl> + * status and abort . * / <nl> + void ReportErrorsTo ( Status * status ) { upb_env_reporterrorsto ( this , status ) ; } <nl> + <nl> + / * Returns true if all allocations and AddCleanup ( ) calls have succeeded , <nl> + * and no errors were reported with ReportError ( ) ( except ones that recovered <nl> + * successfully ) . * / <nl> + bool ok ( ) const { return upb_env_ok ( this ) ; } <nl> + <nl> + / * Reports an error to this environment ' s callback , returning true if <nl> + * the caller should try to recover . * / <nl> + bool ReportError ( const Status * status ) { <nl> + return upb_env_reporterror ( this , status ) ; <nl> + } <nl> <nl> private : <nl> - UPB_DISALLOW_COPY_AND_ASSIGN ( Status ) <nl> + UPB_DISALLOW_COPY_AND_ASSIGN ( Environment ) <nl> + <nl> # else <nl> - struct upb_status { <nl> - # endif <nl> + struct upb_env { <nl> + # endif / * __cplusplus * / <nl> + upb_arena arena_ ; <nl> + upb_error_func * error_func_ ; <nl> + void * error_ud_ ; <nl> bool ok_ ; <nl> + } ; <nl> <nl> - / * Specific status code defined by some error space ( optional ) . * / <nl> - int code_ ; <nl> - upb_errorspace * error_space_ ; <nl> <nl> - / * Error message ; NULL - terminated . * / <nl> - char msg [ UPB_STATUS_MAX_MESSAGE ] ; <nl> - } ; <nl> + / * upb : : InlinedArena * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + / * upb : : InlinedEnvironment * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> - # define UPB_STATUS_INIT { true , 0 , NULL , { 0 } } <nl> + / * upb : : InlinedArena and upb : : InlinedEnvironment seed their arenas with a <nl> + * predefined amount of memory . No heap memory will be allocated until the <nl> + * initial block is exceeded . <nl> + * <nl> + * These types only exist in C + + * / <nl> <nl> # ifdef __cplusplus <nl> - extern " C " { <nl> - # endif <nl> <nl> - / * The returned string is invalidated by any other call into the status . * / <nl> - const char * upb_status_errmsg ( const upb_status * status ) ; <nl> - bool upb_ok ( const upb_status * status ) ; <nl> - upb_errorspace * upb_status_errspace ( const upb_status * status ) ; <nl> - int upb_status_errcode ( const upb_status * status ) ; <nl> + template < int N > class upb : : InlinedArena : public upb : : Arena { <nl> + public : <nl> + InlinedArena ( ) : Arena ( initial_block_ , N , NULL ) { } <nl> + explicit InlinedArena ( Allocator * a ) : Arena ( initial_block_ , N , a ) { } <nl> <nl> - / * Any of the functions that write to a status object allow status to be NULL , <nl> - * to support use cases where the function ' s caller does not care about the <nl> - * status message . * / <nl> - void upb_status_clear ( upb_status * status ) ; <nl> - void upb_status_seterrmsg ( upb_status * status , const char * msg ) ; <nl> - void upb_status_seterrf ( upb_status * status , const char * fmt , . . . ) ; <nl> - void upb_status_vseterrf ( upb_status * status , const char * fmt , va_list args ) ; <nl> - void upb_status_seterrcode ( upb_status * status , upb_errorspace * space , int code ) ; <nl> - void upb_status_copy ( upb_status * to , const upb_status * from ) ; <nl> + private : <nl> + UPB_DISALLOW_COPY_AND_ASSIGN ( InlinedArena ) <nl> <nl> - # ifdef __cplusplus <nl> - } / * extern " C " * / <nl> + char initial_block_ [ N + UPB_ARENA_BLOCK_OVERHEAD ] ; <nl> + } ; <nl> <nl> - namespace upb { <nl> + template < int N > class upb : : InlinedEnvironment : public upb : : Environment { <nl> + public : <nl> + InlinedEnvironment ( ) : Environment ( initial_block_ , N , NULL ) { } <nl> + explicit InlinedEnvironment ( Allocator * a ) <nl> + : Environment ( initial_block_ , N , a ) { } <nl> <nl> - / * C + + Wrappers * / <nl> - inline Status : : Status ( ) { Clear ( ) ; } <nl> - inline bool Status : : ok ( ) const { return upb_ok ( this ) ; } <nl> - inline const char * Status : : error_message ( ) const { <nl> - return upb_status_errmsg ( this ) ; <nl> - } <nl> - inline void Status : : SetErrorMessage ( const char * msg ) { <nl> - upb_status_seterrmsg ( this , msg ) ; <nl> - } <nl> - inline void Status : : SetFormattedErrorMessage ( const char * fmt , . . . ) { <nl> - va_list args ; <nl> - va_start ( args , fmt ) ; <nl> - upb_status_vseterrf ( this , fmt , args ) ; <nl> - va_end ( args ) ; <nl> - } <nl> - inline void Status : : SetErrorCode ( ErrorSpace * space , int code ) { <nl> - upb_status_seterrcode ( this , space , code ) ; <nl> - } <nl> - inline void Status : : Clear ( ) { upb_status_clear ( this ) ; } <nl> - inline void Status : : CopyFrom ( const Status & other ) { <nl> - upb_status_copy ( this , & other ) ; <nl> - } <nl> + private : <nl> + UPB_DISALLOW_COPY_AND_ASSIGN ( InlinedEnvironment ) <nl> + <nl> + char initial_block_ [ N + UPB_ARENA_BLOCK_OVERHEAD ] ; <nl> + } ; <nl> + <nl> + # endif / * __cplusplus * / <nl> <nl> - } / * namespace upb * / <nl> <nl> - # endif <nl> <nl> # endif / * UPB_H_ * / <nl> <nl> typedef struct { <nl> # endif <nl> <nl> / * Like strdup ( ) , which isn ' t always available since it ' s not ANSI C . * / <nl> - char * upb_strdup ( const char * s ) ; <nl> + char * upb_strdup ( const char * s , upb_alloc * a ) ; <nl> / * Variant that works with a length - delimited rather than NULL - delimited string , <nl> * as supported by strtable . * / <nl> - char * upb_strdup2 ( const char * s , size_t len ) ; <nl> + char * upb_strdup2 ( const char * s , size_t len , upb_alloc * a ) ; <nl> + <nl> + UPB_INLINE char * upb_gstrdup ( const char * s ) { <nl> + return upb_strdup ( s , & upb_alloc_global ) ; <nl> + } <nl> <nl> UPB_INLINE void _upb_value_setval ( upb_value * v , uint64_t val , <nl> upb_ctype_t ctype ) { <nl> typedef struct { <nl> * initialize const hash tables . Then we cast away const when we have to . <nl> * / <nl> const upb_tabent * entries ; <nl> + <nl> + # ifndef NDEBUG <nl> + / * This table ' s allocator . We make the user pass it in to every relevant <nl> + * function and only use this to check it in debug mode . We do this solely <nl> + * to keep upb_table as small as possible . This might seem slightly paranoid <nl> + * but the plan is to use upb_table for all map fields and extension sets in <nl> + * a forthcoming message representation , so there could be a lot of these . <nl> + * If this turns out to be too annoying later , we can change it ( since this <nl> + * is an internal - only header file ) . * / <nl> + upb_alloc * alloc ; <nl> + # endif <nl> } upb_table ; <nl> <nl> + # ifdef NDEBUG <nl> + # define UPB_TABLE_INIT ( count , mask , ctype , size_lg2 , entries ) \ <nl> + { count , mask , ctype , size_lg2 , entries } <nl> + # else <nl> + # ifdef UPB_DEBUG_REFS <nl> + / * At the moment the only mutable tables we statically initialize are debug <nl> + * ref tables . * / <nl> + # define UPB_TABLE_INIT ( count , mask , ctype , size_lg2 , entries ) \ <nl> + { count , mask , ctype , size_lg2 , entries , & upb_alloc_debugrefs } <nl> + # else <nl> + # define UPB_TABLE_INIT ( count , mask , ctype , size_lg2 , entries ) \ <nl> + { count , mask , ctype , size_lg2 , entries , NULL } <nl> + # endif <nl> + # endif <nl> + <nl> typedef struct { <nl> upb_table t ; <nl> } upb_strtable ; <nl> <nl> # define UPB_STRTABLE_INIT ( count , mask , ctype , size_lg2 , entries ) \ <nl> - { { count , mask , ctype , size_lg2 , entries } } <nl> + { UPB_TABLE_INIT ( count , mask , ctype , size_lg2 , entries ) } <nl> <nl> # define UPB_EMPTY_STRTABLE_INIT ( ctype ) \ <nl> UPB_STRTABLE_INIT ( 0 , 0 , ctype , 0 , NULL ) <nl> typedef struct { <nl> } upb_inttable ; <nl> <nl> # define UPB_INTTABLE_INIT ( count , mask , ctype , size_lg2 , ent , a , asize , acount ) \ <nl> - { { count , mask , ctype , size_lg2 , ent } , a , asize , acount } <nl> + { UPB_TABLE_INIT ( count , mask , ctype , size_lg2 , ent ) , a , asize , acount } <nl> <nl> # define UPB_EMPTY_INTTABLE_INIT ( ctype ) \ <nl> UPB_INTTABLE_INIT ( 0 , 0 , ctype , 0 , NULL , NULL , 0 , 0 ) <nl> UPB_INLINE bool upb_arrhas ( upb_tabval key ) { <nl> <nl> / * Initialize and uninitialize a table , respectively . If memory allocation <nl> * failed , false is returned that the table is uninitialized . * / <nl> - bool upb_inttable_init ( upb_inttable * table , upb_ctype_t ctype ) ; <nl> - bool upb_strtable_init ( upb_strtable * table , upb_ctype_t ctype ) ; <nl> - void upb_inttable_uninit ( upb_inttable * table ) ; <nl> - void upb_strtable_uninit ( upb_strtable * table ) ; <nl> + bool upb_inttable_init2 ( upb_inttable * table , upb_ctype_t ctype , upb_alloc * a ) ; <nl> + bool upb_strtable_init2 ( upb_strtable * table , upb_ctype_t ctype , upb_alloc * a ) ; <nl> + void upb_inttable_uninit2 ( upb_inttable * table , upb_alloc * a ) ; <nl> + void upb_strtable_uninit2 ( upb_strtable * table , upb_alloc * a ) ; <nl> + <nl> + UPB_INLINE bool upb_inttable_init ( upb_inttable * table , upb_ctype_t ctype ) { <nl> + return upb_inttable_init2 ( table , ctype , & upb_alloc_global ) ; <nl> + } <nl> + <nl> + UPB_INLINE bool upb_strtable_init ( upb_strtable * table , upb_ctype_t ctype ) { <nl> + return upb_strtable_init2 ( table , ctype , & upb_alloc_global ) ; <nl> + } <nl> + <nl> + UPB_INLINE void upb_inttable_uninit ( upb_inttable * table ) { <nl> + upb_inttable_uninit2 ( table , & upb_alloc_global ) ; <nl> + } <nl> + <nl> + UPB_INLINE void upb_strtable_uninit ( upb_strtable * table ) { <nl> + upb_strtable_uninit2 ( table , & upb_alloc_global ) ; <nl> + } <nl> <nl> / * Returns the number of values in the table . * / <nl> size_t upb_inttable_count ( const upb_inttable * t ) ; <nl> UPB_INLINE size_t upb_strtable_count ( const upb_strtable * t ) { <nl> * <nl> * If a table resize was required but memory allocation failed , false is <nl> * returned and the table is unchanged . * / <nl> - bool upb_inttable_insert ( upb_inttable * t , uintptr_t key , upb_value val ) ; <nl> - bool upb_strtable_insert2 ( upb_strtable * t , const char * key , size_t len , <nl> - upb_value val ) ; <nl> + bool upb_inttable_insert2 ( upb_inttable * t , uintptr_t key , upb_value val , <nl> + upb_alloc * a ) ; <nl> + bool upb_strtable_insert3 ( upb_strtable * t , const char * key , size_t len , <nl> + upb_value val , upb_alloc * a ) ; <nl> + <nl> + UPB_INLINE bool upb_inttable_insert ( upb_inttable * t , uintptr_t key , <nl> + upb_value val ) { <nl> + return upb_inttable_insert2 ( t , key , val , & upb_alloc_global ) ; <nl> + } <nl> + <nl> + UPB_INLINE bool upb_strtable_insert2 ( upb_strtable * t , const char * key , <nl> + size_t len , upb_value val ) { <nl> + return upb_strtable_insert3 ( t , key , len , val , & upb_alloc_global ) ; <nl> + } <nl> <nl> / * For NULL - terminated strings . * / <nl> UPB_INLINE bool upb_strtable_insert ( upb_strtable * t , const char * key , <nl> UPB_INLINE bool upb_strtable_lookup ( const upb_strtable * t , const char * key , <nl> / * Removes an item from the table . Returns true if the remove was successful , <nl> * and stores the removed item in * val if non - NULL . * / <nl> bool upb_inttable_remove ( upb_inttable * t , uintptr_t key , upb_value * val ) ; <nl> - bool upb_strtable_remove2 ( upb_strtable * t , const char * key , size_t len , <nl> - upb_value * val ) ; <nl> + bool upb_strtable_remove3 ( upb_strtable * t , const char * key , size_t len , <nl> + upb_value * val , upb_alloc * alloc ) ; <nl> + <nl> + UPB_INLINE bool upb_strtable_remove2 ( upb_strtable * t , const char * key , <nl> + size_t len , upb_value * val ) { <nl> + return upb_strtable_remove3 ( t , key , len , val , & upb_alloc_global ) ; <nl> + } <nl> <nl> / * For NULL - terminated strings . * / <nl> UPB_INLINE bool upb_strtable_remove ( upb_strtable * t , const char * key , <nl> bool upb_inttable_replace ( upb_inttable * t , uintptr_t key , upb_value val ) ; <nl> <nl> / * Handy routines for treating an inttable like a stack . May not be mixed with <nl> * other insert / remove calls . * / <nl> - bool upb_inttable_push ( upb_inttable * t , upb_value val ) ; <nl> + bool upb_inttable_push2 ( upb_inttable * t , upb_value val , upb_alloc * a ) ; <nl> upb_value upb_inttable_pop ( upb_inttable * t ) ; <nl> <nl> + UPB_INLINE bool upb_inttable_push ( upb_inttable * t , upb_value val ) { <nl> + return upb_inttable_push2 ( t , val , & upb_alloc_global ) ; <nl> + } <nl> + <nl> / * Convenience routines for inttables with pointer keys . * / <nl> - bool upb_inttable_insertptr ( upb_inttable * t , const void * key , upb_value val ) ; <nl> + bool upb_inttable_insertptr2 ( upb_inttable * t , const void * key , upb_value val , <nl> + upb_alloc * a ) ; <nl> bool upb_inttable_removeptr ( upb_inttable * t , const void * key , upb_value * val ) ; <nl> bool upb_inttable_lookupptr ( <nl> const upb_inttable * t , const void * key , upb_value * val ) ; <nl> <nl> + UPB_INLINE bool upb_inttable_insertptr ( upb_inttable * t , const void * key , <nl> + upb_value val ) { <nl> + return upb_inttable_insertptr2 ( t , key , val , & upb_alloc_global ) ; <nl> + } <nl> + <nl> / * Optimizes the table for the current set of entries , for both memory use and <nl> * lookup time . Client should call this after all entries have been inserted ; <nl> * inserting more entries is legal , but will likely require a table resize . * / <nl> - void upb_inttable_compact ( upb_inttable * t ) ; <nl> + void upb_inttable_compact2 ( upb_inttable * t , upb_alloc * a ) ; <nl> + <nl> + UPB_INLINE void upb_inttable_compact ( upb_inttable * t ) { <nl> + upb_inttable_compact2 ( t , & upb_alloc_global ) ; <nl> + } <nl> <nl> / * A special - case inlinable version of the lookup routine for 32 - bit <nl> * integers . * / <nl> UPB_INLINE bool upb_inttable_lookup32 ( const upb_inttable * t , uint32_t key , <nl> } <nl> <nl> / * Exposed for testing only . * / <nl> - bool upb_strtable_resize ( upb_strtable * t , size_t size_lg2 ) ; <nl> + bool upb_strtable_resize ( upb_strtable * t , size_t size_lg2 , upb_alloc * a ) ; <nl> <nl> / * Iterators * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> typedef struct { <nl> void upb_strtable_begin ( upb_strtable_iter * i , const upb_strtable * t ) ; <nl> void upb_strtable_next ( upb_strtable_iter * i ) ; <nl> bool upb_strtable_done ( const upb_strtable_iter * i ) ; <nl> - const char * upb_strtable_iter_key ( upb_strtable_iter * i ) ; <nl> - size_t upb_strtable_iter_keylength ( upb_strtable_iter * i ) ; <nl> + const char * upb_strtable_iter_key ( const upb_strtable_iter * i ) ; <nl> + size_t upb_strtable_iter_keylength ( const upb_strtable_iter * i ) ; <nl> upb_value upb_strtable_iter_value ( const upb_strtable_iter * i ) ; <nl> void upb_strtable_iter_setdone ( upb_strtable_iter * i ) ; <nl> bool upb_strtable_iter_isequal ( const upb_strtable_iter * i1 , <nl> bool upb_inttable_iter_isequal ( const upb_inttable_iter * i1 , <nl> / * # define UPB_DEBUG_REFS * / <nl> <nl> # ifdef __cplusplus <nl> - namespace upb { class RefCounted ; } <nl> + namespace upb { <nl> + class RefCounted ; <nl> + template < class T > class reffed_ptr ; <nl> + } <nl> # endif <nl> <nl> UPB_DECLARE_TYPE ( upb : : RefCounted , upb_refcounted ) <nl> struct upb_refcounted { <nl> } ; <nl> <nl> # ifdef UPB_DEBUG_REFS <nl> - # define UPB_REFCOUNT_INIT ( refs , ref2s ) \ <nl> - { & static_refcount , NULL , NULL , 0 , true , refs , ref2s } <nl> + extern upb_alloc upb_alloc_debugrefs ; <nl> + # define UPB_REFCOUNT_INIT ( vtbl , refs , ref2s ) \ <nl> + { & static_refcount , NULL , vtbl , 0 , true , refs , ref2s } <nl> # else <nl> - # define UPB_REFCOUNT_INIT ( refs , ref2s ) { & static_refcount , NULL , NULL , 0 , true } <nl> + # define UPB_REFCOUNT_INIT ( vtbl , refs , ref2s ) \ <nl> + { & static_refcount , NULL , vtbl , 0 , true } <nl> # endif <nl> <nl> UPB_BEGIN_EXTERN_C <nl> bool upb_refcounted_init ( upb_refcounted * r , <nl> const struct upb_refcounted_vtbl * vtbl , <nl> const void * owner ) ; <nl> <nl> - / * Adds a ref from one refcounted object to another ( " from " must not already <nl> - * own a ref ) . These refs may be circular ; cycles will be collected correctly <nl> - * ( if conservatively ) . These refs do not need to be freed in from ' s free ( ) <nl> - * function . * / <nl> - void upb_refcounted_ref2 ( const upb_refcounted * r , upb_refcounted * from ) ; <nl> + / * Adds a ref from one refcounted object to another ( " from " must not already <nl> + * own a ref ) . These refs may be circular ; cycles will be collected correctly <nl> + * ( if conservatively ) . These refs do not need to be freed in from ' s free ( ) <nl> + * function . * / <nl> + void upb_refcounted_ref2 ( const upb_refcounted * r , upb_refcounted * from ) ; <nl> + <nl> + / * Removes a ref that was acquired from upb_refcounted_ref2 ( ) , and collects any <nl> + * object it can . This is only necessary when " from " no longer points to " r " , <nl> + * and not from from ' s " free " function . * / <nl> + void upb_refcounted_unref2 ( const upb_refcounted * r , upb_refcounted * from ) ; <nl> + <nl> + # define upb_ref2 ( r , from ) \ <nl> + upb_refcounted_ref2 ( ( const upb_refcounted * ) r , ( upb_refcounted * ) from ) <nl> + # define upb_unref2 ( r , from ) \ <nl> + upb_refcounted_unref2 ( ( const upb_refcounted * ) r , ( upb_refcounted * ) from ) <nl> + <nl> + / * Freezes all mutable object reachable by ref2 ( ) refs from the given roots . <nl> + * This will split refcounting groups into precise SCC groups , so that <nl> + * refcounting of frozen objects can be more aggressive . If memory allocation <nl> + * fails , or if more than 2 * * 31 mutable objects are reachable from " roots " , or <nl> + * if the maximum depth of the graph exceeds " maxdepth " , false is returned and <nl> + * the objects are unchanged . <nl> + * <nl> + * After this operation succeeds , the objects are frozen / const , and may not be <nl> + * used through non - const pointers . In particular , they may not be passed as <nl> + * the second parameter of upb_refcounted_ { ref , unref } 2 ( ) . On the upside , all <nl> + * operations on frozen refcounteds are threadsafe , and objects will be freed <nl> + * at the precise moment that they become unreachable . <nl> + * <nl> + * Caller must own refs on each object in the " roots " list . * / <nl> + bool upb_refcounted_freeze ( upb_refcounted * const * roots , int n , upb_status * s , <nl> + int maxdepth ) ; <nl> + <nl> + / * Shared by all compiled - in refcounted objects . * / <nl> + extern uint32_t static_refcount ; <nl> + <nl> + UPB_END_EXTERN_C <nl> + <nl> + # ifdef __cplusplus <nl> + / * C + + Wrappers . * / <nl> + namespace upb { <nl> + inline bool RefCounted : : IsFrozen ( ) const { <nl> + return upb_refcounted_isfrozen ( this ) ; <nl> + } <nl> + inline void RefCounted : : Ref ( const void * owner ) const { <nl> + upb_refcounted_ref ( this , owner ) ; <nl> + } <nl> + inline void RefCounted : : Unref ( const void * owner ) const { <nl> + upb_refcounted_unref ( this , owner ) ; <nl> + } <nl> + inline void RefCounted : : DonateRef ( const void * from , const void * to ) const { <nl> + upb_refcounted_donateref ( this , from , to ) ; <nl> + } <nl> + inline void RefCounted : : CheckRef ( const void * owner ) const { <nl> + upb_refcounted_checkref ( this , owner ) ; <nl> + } <nl> + } / * namespace upb * / <nl> + # endif <nl> + <nl> + <nl> + / * upb : : reffed_ptr * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + # ifdef __cplusplus <nl> + <nl> + # include < algorithm > / * For std : : swap ( ) . * / <nl> + <nl> + / * Provides RAII semantics for upb refcounted objects . Each reffed_ptr owns a <nl> + * ref on whatever object it points to ( if any ) . * / <nl> + template < class T > class upb : : reffed_ptr { <nl> + public : <nl> + reffed_ptr ( ) : ptr_ ( NULL ) { } <nl> + <nl> + / * If ref_donor is NULL , takes a new ref , otherwise adopts from ref_donor . * / <nl> + template < class U > <nl> + reffed_ptr ( U * val , const void * ref_donor = NULL ) <nl> + : ptr_ ( upb : : upcast ( val ) ) { <nl> + if ( ref_donor ) { <nl> + assert ( ptr_ ) ; <nl> + ptr_ - > DonateRef ( ref_donor , this ) ; <nl> + } else if ( ptr_ ) { <nl> + ptr_ - > Ref ( this ) ; <nl> + } <nl> + } <nl> + <nl> + template < class U > <nl> + reffed_ptr ( const reffed_ptr < U > & other ) <nl> + : ptr_ ( upb : : upcast ( other . get ( ) ) ) { <nl> + if ( ptr_ ) ptr_ - > Ref ( this ) ; <nl> + } <nl> + <nl> + reffed_ptr ( const reffed_ptr & other ) <nl> + : ptr_ ( upb : : upcast ( other . get ( ) ) ) { <nl> + if ( ptr_ ) ptr_ - > Ref ( this ) ; <nl> + } <nl> + <nl> + ~ reffed_ptr ( ) { if ( ptr_ ) ptr_ - > Unref ( this ) ; } <nl> + <nl> + template < class U > <nl> + reffed_ptr & operator = ( const reffed_ptr < U > & other ) { <nl> + reset ( other . get ( ) ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + reffed_ptr & operator = ( const reffed_ptr & other ) { <nl> + reset ( other . get ( ) ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + / * TODO ( haberman ) : add C + + 11 move construction / assignment for greater <nl> + * efficiency . * / <nl> + <nl> + void swap ( reffed_ptr & other ) { <nl> + if ( ptr_ = = other . ptr_ ) { <nl> + return ; <nl> + } <nl> + <nl> + if ( ptr_ ) ptr_ - > DonateRef ( this , & other ) ; <nl> + if ( other . ptr_ ) other . ptr_ - > DonateRef ( & other , this ) ; <nl> + std : : swap ( ptr_ , other . ptr_ ) ; <nl> + } <nl> + <nl> + T & operator * ( ) const { <nl> + assert ( ptr_ ) ; <nl> + return * ptr_ ; <nl> + } <nl> + <nl> + T * operator - > ( ) const { <nl> + assert ( ptr_ ) ; <nl> + return ptr_ ; <nl> + } <nl> + <nl> + T * get ( ) const { return ptr_ ; } <nl> <nl> - / * Removes a ref that was acquired from upb_refcounted_ref2 ( ) , and collects any <nl> - * object it can . This is only necessary when " from " no longer points to " r " , <nl> - * and not from from ' s " free " function . * / <nl> - void upb_refcounted_unref2 ( const upb_refcounted * r , upb_refcounted * from ) ; <nl> + / * If ref_donor is NULL , takes a new ref , otherwise adopts from ref_donor . * / <nl> + template < class U > <nl> + void reset ( U * ptr = NULL , const void * ref_donor = NULL ) { <nl> + reffed_ptr ( ptr , ref_donor ) . swap ( * this ) ; <nl> + } <nl> <nl> - # define upb_ref2 ( r , from ) \ <nl> - upb_refcounted_ref2 ( ( const upb_refcounted * ) r , ( upb_refcounted * ) from ) <nl> - # define upb_unref2 ( r , from ) \ <nl> - upb_refcounted_unref2 ( ( const upb_refcounted * ) r , ( upb_refcounted * ) from ) <nl> + template < class U > <nl> + reffed_ptr < U > down_cast ( ) { <nl> + return reffed_ptr < U > ( upb : : down_cast < U * > ( get ( ) ) ) ; <nl> + } <nl> <nl> - / * Freezes all mutable object reachable by ref2 ( ) refs from the given roots . <nl> - * This will split refcounting groups into precise SCC groups , so that <nl> - * refcounting of frozen objects can be more aggressive . If memory allocation <nl> - * fails , or if more than 2 * * 31 mutable objects are reachable from " roots " , or <nl> - * if the maximum depth of the graph exceeds " maxdepth " , false is returned and <nl> - * the objects are unchanged . <nl> - * <nl> - * After this operation succeeds , the objects are frozen / const , and may not be <nl> - * used through non - const pointers . In particular , they may not be passed as <nl> - * the second parameter of upb_refcounted_ { ref , unref } 2 ( ) . On the upside , all <nl> - * operations on frozen refcounteds are threadsafe , and objects will be freed <nl> - * at the precise moment that they become unreachable . <nl> - * <nl> - * Caller must own refs on each object in the " roots " list . * / <nl> - bool upb_refcounted_freeze ( upb_refcounted * const * roots , int n , upb_status * s , <nl> - int maxdepth ) ; <nl> + template < class U > <nl> + reffed_ptr < U > dyn_cast ( ) { <nl> + return reffed_ptr < U > ( upb : : dyn_cast < U * > ( get ( ) ) ) ; <nl> + } <nl> <nl> - / * Shared by all compiled - in refcounted objects . * / <nl> - extern uint32_t static_refcount ; <nl> + / * Plain release ( ) is unsafe ; if we were the only owner , it would leak the <nl> + * object . Instead we provide this : * / <nl> + T * ReleaseTo ( const void * new_owner ) { <nl> + T * ret = NULL ; <nl> + ptr_ - > DonateRef ( this , new_owner ) ; <nl> + std : : swap ( ret , ptr_ ) ; <nl> + return ret ; <nl> + } <nl> <nl> - UPB_END_EXTERN_C <nl> + private : <nl> + T * ptr_ ; <nl> + } ; <nl> <nl> - # ifdef __cplusplus <nl> - / * C + + Wrappers . * / <nl> - namespace upb { <nl> - inline bool RefCounted : : IsFrozen ( ) const { <nl> - return upb_refcounted_isfrozen ( this ) ; <nl> - } <nl> - inline void RefCounted : : Ref ( const void * owner ) const { <nl> - upb_refcounted_ref ( this , owner ) ; <nl> - } <nl> - inline void RefCounted : : Unref ( const void * owner ) const { <nl> - upb_refcounted_unref ( this , owner ) ; <nl> - } <nl> - inline void RefCounted : : DonateRef ( const void * from , const void * to ) const { <nl> - upb_refcounted_donateref ( this , from , to ) ; <nl> - } <nl> - inline void RefCounted : : CheckRef ( const void * owner ) const { <nl> - upb_refcounted_checkref ( this , owner ) ; <nl> - } <nl> - } / * namespace upb * / <nl> - # endif <nl> + # endif / * __cplusplus * / <nl> <nl> # endif / * UPB_REFCOUNT_H_ * / <nl> <nl> typedef enum { <nl> UPB_DESCRIPTOR_TYPE_SINT64 = 18 <nl> } upb_descriptortype_t ; <nl> <nl> + typedef enum { <nl> + UPB_SYNTAX_PROTO2 = 2 , <nl> + UPB_SYNTAX_PROTO3 = 3 <nl> + } upb_syntax_t ; <nl> + <nl> / * Maximum field number allowed for FieldDefs . This is an inherent limit of the <nl> * protobuf wire format . * / <nl> # define UPB_MAX_FIELDNUMBER ( ( 1 < < 29 ) - 1 ) <nl> UPB_END_EXTERN_C <nl> typedef upb_inttable_iter upb_msg_field_iter ; <nl> typedef upb_strtable_iter upb_msg_oneof_iter ; <nl> <nl> + / * Well - known field tag numbers for map - entry messages . * / <nl> + # define UPB_MAPENTRY_KEY 1 <nl> + # define UPB_MAPENTRY_VALUE 2 <nl> + <nl> # ifdef __cplusplus <nl> <nl> / * Structure that describes a single . proto message type . <nl> class upb : : MessageDef { <nl> bool AddOneof ( OneofDef * o , Status * s ) ; <nl> bool AddOneof ( const reffed_ptr < OneofDef > & o , Status * s ) ; <nl> <nl> + upb_syntax_t syntax ( ) const ; <nl> + <nl> + / * Returns false if we don ' t support this syntax value . * / <nl> + bool set_syntax ( upb_syntax_t syntax ) ; <nl> + <nl> / * Set this to false to indicate that primitive fields should not have <nl> * explicit presence information associated with them . This will affect all <nl> * fields added to this message . Defaults to true . * / <nl> UPB_REFCOUNTED_CMETHODS ( upb_msgdef , upb_msgdef_upcast2 ) <nl> <nl> bool upb_msgdef_freeze ( upb_msgdef * m , upb_status * status ) ; <nl> <nl> + upb_msgdef * upb_msgdef_dup ( const upb_msgdef * m , const void * owner ) ; <nl> const char * upb_msgdef_fullname ( const upb_msgdef * m ) ; <nl> const char * upb_msgdef_name ( const upb_msgdef * m ) ; <nl> - bool upb_msgdef_setfullname ( upb_msgdef * m , const char * fullname , upb_status * s ) ; <nl> + int upb_msgdef_numoneofs ( const upb_msgdef * m ) ; <nl> + upb_syntax_t upb_msgdef_syntax ( const upb_msgdef * m ) ; <nl> <nl> - upb_msgdef * upb_msgdef_dup ( const upb_msgdef * m , const void * owner ) ; <nl> bool upb_msgdef_addfield ( upb_msgdef * m , upb_fielddef * f , const void * ref_donor , <nl> upb_status * s ) ; <nl> bool upb_msgdef_addoneof ( upb_msgdef * m , upb_oneofdef * o , const void * ref_donor , <nl> upb_status * s ) ; <nl> + bool upb_msgdef_setfullname ( upb_msgdef * m , const char * fullname , upb_status * s ) ; <nl> + void upb_msgdef_setmapentry ( upb_msgdef * m , bool map_entry ) ; <nl> + bool upb_msgdef_mapentry ( const upb_msgdef * m ) ; <nl> + bool upb_msgdef_setsyntax ( upb_msgdef * m , upb_syntax_t syntax ) ; <nl> <nl> / * Field lookup in a couple of different variations : <nl> * - itof = int to field <nl> UPB_INLINE upb_oneofdef * upb_msgdef_ntoo_mutable ( upb_msgdef * m , <nl> return ( upb_oneofdef * ) upb_msgdef_ntoo ( m , name , len ) ; <nl> } <nl> <nl> - void upb_msgdef_setmapentry ( upb_msgdef * m , bool map_entry ) ; <nl> - bool upb_msgdef_mapentry ( const upb_msgdef * m ) ; <nl> - <nl> - / * Well - known field tag numbers for map - entry messages . * / <nl> - # define UPB_MAPENTRY_KEY 1 <nl> - # define UPB_MAPENTRY_VALUE 2 <nl> + / * Lookup of either field or oneof by name . Returns whether either was found . <nl> + * If the return is true , then the found def will be set , and the non - found <nl> + * one set to NULL . * / <nl> + bool upb_msgdef_lookupname ( const upb_msgdef * m , const char * name , size_t len , <nl> + const upb_fielddef * * f , const upb_oneofdef * * o ) ; <nl> <nl> - const upb_oneofdef * upb_msgdef_findoneof ( const upb_msgdef * m , <nl> - const char * name ) ; <nl> - int upb_msgdef_numoneofs ( const upb_msgdef * m ) ; <nl> + UPB_INLINE bool upb_msgdef_lookupnamez ( const upb_msgdef * m , const char * name , <nl> + const upb_fielddef * * f , <nl> + const upb_oneofdef * * o ) { <nl> + return upb_msgdef_lookupname ( m , name , strlen ( name ) , f , o ) ; <nl> + } <nl> <nl> - / * upb_msg_field_iter i ; <nl> + / * Iteration over fields and oneofs . For example : <nl> + * <nl> + * upb_msg_field_iter i ; <nl> * for ( upb_msg_field_begin ( & i , m ) ; <nl> * ! upb_msg_field_done ( & i ) ; <nl> * upb_msg_field_next ( & i ) ) { <nl> UPB_END_EXTERN_C <nl> <nl> / * upb : : FileDef * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> - typedef enum { <nl> - UPB_SYNTAX_PROTO2 = 2 , <nl> - UPB_SYNTAX_PROTO3 = 3 <nl> - } upb_syntax_t ; <nl> - <nl> # ifdef __cplusplus <nl> <nl> / * Class that represents a . proto file with some things defined in it . <nl> inline const char * MessageDef : : full_name ( ) const { <nl> inline const char * MessageDef : : name ( ) const { <nl> return upb_msgdef_name ( this ) ; <nl> } <nl> + inline upb_syntax_t MessageDef : : syntax ( ) const { <nl> + return upb_msgdef_syntax ( this ) ; <nl> + } <nl> inline bool MessageDef : : set_full_name ( const char * fullname , Status * s ) { <nl> return upb_msgdef_setfullname ( this , fullname , s ) ; <nl> } <nl> inline bool MessageDef : : set_full_name ( const std : : string & fullname , Status * s ) { <nl> return upb_msgdef_setfullname ( this , upb_safecstr ( fullname ) , s ) ; <nl> } <nl> + inline bool MessageDef : : set_syntax ( upb_syntax_t syntax ) { <nl> + return upb_msgdef_setsyntax ( this , syntax ) ; <nl> + } <nl> inline bool MessageDef : : Freeze ( Status * status ) { <nl> return upb_msgdef_freeze ( this , status ) ; <nl> } <nl> struct upb_def { <nl> bool came_from_user ; <nl> } ; <nl> <nl> - # define UPB_DEF_INIT ( name , type , refs , ref2s ) \ <nl> - { UPB_REFCOUNT_INIT ( refs , ref2s ) , name , NULL , type , false } <nl> + # define UPB_DEF_INIT ( name , type , vtbl , refs , ref2s ) \ <nl> + { UPB_REFCOUNT_INIT ( vtbl , refs , ref2s ) , name , NULL , type , false } <nl> <nl> <nl> / * upb_fielddef * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> struct upb_fielddef { <nl> uint32_t index_ ; <nl> } ; <nl> <nl> + extern const struct upb_refcounted_vtbl upb_fielddef_vtbl ; <nl> + <nl> # define UPB_FIELDDEF_INIT ( label , type , intfmt , tagdelim , is_extension , lazy , \ <nl> packed , name , num , msgdef , subdef , selector_base , \ <nl> index , defaultval , refs , ref2s ) \ <nl> { \ <nl> - UPB_DEF_INIT ( name , UPB_DEF_FIELD , refs , ref2s ) , defaultval , { msgdef } , \ <nl> - { subdef } , NULL , false , false , \ <nl> + UPB_DEF_INIT ( name , UPB_DEF_FIELD , & upb_fielddef_vtbl , refs , ref2s ) , \ <nl> + defaultval , { msgdef } , { subdef } , NULL , false , false , \ <nl> type = = UPB_TYPE_STRING | | type = = UPB_TYPE_BYTES , true , is_extension , \ <nl> lazy , packed , intfmt , tagdelim , type , label , num , selector_base , index \ <nl> } <nl> struct upb_msgdef { <nl> <nl> / * Tables for looking up fields by number and name . * / <nl> upb_inttable itof ; / * int to field * / <nl> - upb_strtable ntof ; / * name to field * / <nl> + upb_strtable ntof ; / * name to field / oneof * / <nl> <nl> - / * Tables for looking up oneofs by name . * / <nl> - upb_strtable ntoo ; / * name to oneof * / <nl> - <nl> - / * Is this a map - entry message ? <nl> - * TODO : set this flag properly for static descriptors ; regenerate <nl> - * descriptor . upb . c . * / <nl> + / * Is this a map - entry message ? * / <nl> bool map_entry ; <nl> <nl> - / * Whether this message has proto2 or proto3 semantics . <nl> - * TODO : set this flag properly for static descriptors ; regenerate <nl> - * descriptor . upb . c . * / <nl> + / * Whether this message has proto2 or proto3 semantics . * / <nl> upb_syntax_t syntax ; <nl> <nl> / * TODO ( haberman ) : proper extension ranges ( there can be multiple ) . * / <nl> } ; <nl> <nl> + extern const struct upb_refcounted_vtbl upb_msgdef_vtbl ; <nl> + <nl> / * TODO : also support static initialization of the oneofs table . This will be <nl> * needed if we compile in descriptors that contain oneofs . * / <nl> # define UPB_MSGDEF_INIT ( name , selector_count , submsg_field_count , itof , ntof , \ <nl> - refs , ref2s ) \ <nl> + map_entry , syntax , refs , ref2s ) \ <nl> { \ <nl> - UPB_DEF_INIT ( name , UPB_DEF_MSG , refs , ref2s ) , selector_count , \ <nl> - submsg_field_count , itof , ntof , \ <nl> - UPB_EMPTY_STRTABLE_INIT ( UPB_CTYPE_PTR ) , false , true \ <nl> + UPB_DEF_INIT ( name , UPB_DEF_MSG , & upb_fielddef_vtbl , refs , ref2s ) , \ <nl> + selector_count , submsg_field_count , itof , ntof , map_entry , syntax \ <nl> } <nl> <nl> <nl> struct upb_enumdef { <nl> int32_t defaultval ; <nl> } ; <nl> <nl> + extern const struct upb_refcounted_vtbl upb_enumdef_vtbl ; <nl> + <nl> # define UPB_ENUMDEF_INIT ( name , ntoi , iton , defaultval , refs , ref2s ) \ <nl> - { UPB_DEF_INIT ( name , UPB_DEF_ENUM , refs , ref2s ) , ntoi , iton , defaultval } <nl> + { UPB_DEF_INIT ( name , UPB_DEF_ENUM , & upb_enumdef_vtbl , refs , ref2s ) , ntoi , \ <nl> + iton , defaultval } <nl> <nl> <nl> / * upb_oneofdef * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> struct upb_oneofdef { <nl> const upb_msgdef * parent ; <nl> } ; <nl> <nl> + extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl ; <nl> + <nl> # define UPB_ONEOFDEF_INIT ( name , ntof , itof , refs , ref2s ) \ <nl> - { UPB_REFCOUNT_INIT ( refs , ref2s ) , name , ntof , itof } <nl> + { UPB_REFCOUNT_INIT ( & upb_oneofdef_vtbl , refs , ref2s ) , name , ntof , itof } <nl> <nl> <nl> / * upb_symtab * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> struct upb_symtab { <nl> upb_strtable symtab ; <nl> } ; <nl> <nl> - # define UPB_SYMTAB_INIT ( symtab , refs , ref2s ) \ <nl> - { UPB_REFCOUNT_INIT ( refs , ref2s ) , symtab } <nl> - <nl> struct upb_filedef { <nl> upb_refcounted base ; <nl> <nl> struct upb_filedef { <nl> upb_inttable deps ; <nl> } ; <nl> <nl> + extern const struct upb_refcounted_vtbl upb_filedef_vtbl ; <nl> + <nl> # endif / * UPB_STATICINIT_H_ * / <nl> / * <nl> * * upb : : Handlers ( upb_handlers ) <nl> inline BytesHandler : : ~ BytesHandler ( ) { } <nl> <nl> # endif / * UPB_HANDLERS_H * / <nl> / * <nl> - * * upb : : Environment ( upb_env ) <nl> - * * <nl> - * * A upb : : Environment provides a means for injecting malloc and an <nl> - * * error - reporting callback into encoders / decoders . This allows them to be <nl> - * * independent of nearly all assumptions about their actual environment . <nl> - * * <nl> - * * It is also a container for allocating the encoders / decoders themselves that <nl> - * * insulates clients from knowing their actual size . This provides ABI <nl> - * * compatibility even if the size of the objects change . And this allows the <nl> - * * structure definitions to be in the . c files instead of the . h files , making <nl> - * * the . h files smaller and more readable . <nl> - * / <nl> - <nl> - <nl> - # ifndef UPB_ENV_H_ <nl> - # define UPB_ENV_H_ <nl> - <nl> - # ifdef __cplusplus <nl> - namespace upb { <nl> - class Environment ; <nl> - class SeededAllocator ; <nl> - } <nl> - # endif <nl> - <nl> - UPB_DECLARE_TYPE ( upb : : Environment , upb_env ) <nl> - UPB_DECLARE_TYPE ( upb : : SeededAllocator , upb_seededalloc ) <nl> - <nl> - typedef void * upb_alloc_func ( void * ud , void * ptr , size_t oldsize , size_t size ) ; <nl> - typedef void upb_cleanup_func ( void * ud ) ; <nl> - typedef bool upb_error_func ( void * ud , const upb_status * status ) ; <nl> - <nl> - # ifdef __cplusplus <nl> - <nl> - / * An environment is * not * thread - safe . * / <nl> - class upb : : Environment { <nl> - public : <nl> - Environment ( ) ; <nl> - ~ Environment ( ) ; <nl> - <nl> - / * Set a custom memory allocation function for the environment . May ONLY <nl> - * be called before any calls to Malloc ( ) / Realloc ( ) / AddCleanup ( ) below . <nl> - * If this is not called , the system realloc ( ) function will be used . <nl> - * The given user pointer " ud " will be passed to the allocation function . <nl> - * <nl> - * The allocation function will not receive corresponding " free " calls . it <nl> - * must ensure that the memory is valid for the lifetime of the Environment , <nl> - * but it may be reclaimed any time thereafter . The likely usage is that <nl> - * " ud " points to a stateful allocator , and that the allocator frees all <nl> - * memory , arena - style , when it is destroyed . In this case the allocator must <nl> - * outlive the Environment . Another possibility is that the allocation <nl> - * function returns GC - able memory that is guaranteed to be GC - rooted for the <nl> - * life of the Environment . * / <nl> - void SetAllocationFunction ( upb_alloc_func * alloc , void * ud ) ; <nl> - <nl> - template < class T > <nl> - void SetAllocator ( T * allocator ) { <nl> - SetAllocationFunction ( allocator - > GetAllocationFunction ( ) , allocator ) ; <nl> - } <nl> - <nl> - / * Set a custom error reporting function . * / <nl> - void SetErrorFunction ( upb_error_func * func , void * ud ) ; <nl> - <nl> - / * Set the error reporting function to simply copy the status to the given <nl> - * status and abort . * / <nl> - void ReportErrorsTo ( Status * status ) ; <nl> - <nl> - / * Returns true if all allocations and AddCleanup ( ) calls have succeeded , <nl> - * and no errors were reported with ReportError ( ) ( except ones that recovered <nl> - * successfully ) . * / <nl> - bool ok ( ) const ; <nl> - <nl> - / * Functions for use by encoders / decoders . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> - <nl> - / * Reports an error to this environment ' s callback , returning true if <nl> - * the caller should try to recover . * / <nl> - bool ReportError ( const Status * status ) ; <nl> - <nl> - / * Allocate memory . Uses the environment ' s allocation function . <nl> - * <nl> - * There is no need to free ( ) . All memory will be freed automatically , but is <nl> - * guaranteed to outlive the Environment . * / <nl> - void * Malloc ( size_t size ) ; <nl> - <nl> - / * Reallocate memory . Preserves " oldsize " bytes from the existing buffer <nl> - * Requires : oldsize < = existing_size . <nl> - * <nl> - * TODO ( haberman ) : should we also enforce that oldsize < = size ? * / <nl> - void * Realloc ( void * ptr , size_t oldsize , size_t size ) ; <nl> - <nl> - / * Add a cleanup function to run when the environment is destroyed . <nl> - * Returns false on out - of - memory . <nl> - * <nl> - * The first call to AddCleanup ( ) after SetAllocationFunction ( ) is guaranteed <nl> - * to return true - - this makes it possible to robustly set a cleanup handler <nl> - * for a custom allocation function . * / <nl> - bool AddCleanup ( upb_cleanup_func * func , void * ud ) ; <nl> - <nl> - / * Total number of bytes that have been allocated . It is undefined what <nl> - * Realloc ( ) does to this counter . * / <nl> - size_t BytesAllocated ( ) const ; <nl> - <nl> - private : <nl> - UPB_DISALLOW_COPY_AND_ASSIGN ( Environment ) <nl> - <nl> - # else <nl> - struct upb_env { <nl> - # endif / * __cplusplus * / <nl> - <nl> - bool ok_ ; <nl> - size_t bytes_allocated ; <nl> - <nl> - / * Alloc function . * / <nl> - upb_alloc_func * alloc ; <nl> - void * alloc_ud ; <nl> - <nl> - / * Error - reporting function . * / <nl> - upb_error_func * err ; <nl> - void * err_ud ; <nl> - <nl> - / * Userdata for default alloc func . * / <nl> - void * default_alloc_ud ; <nl> - <nl> - / * Cleanup entries . Pointer to a cleanup_ent , defined in env . c * / <nl> - void * cleanup_head ; <nl> - <nl> - / * For future expansion , since the size of this struct is exposed to users . * / <nl> - void * future1 ; <nl> - void * future2 ; <nl> - } ; <nl> - <nl> - UPB_BEGIN_EXTERN_C <nl> - <nl> - void upb_env_init ( upb_env * e ) ; <nl> - void upb_env_uninit ( upb_env * e ) ; <nl> - void upb_env_setallocfunc ( upb_env * e , upb_alloc_func * func , void * ud ) ; <nl> - void upb_env_seterrorfunc ( upb_env * e , upb_error_func * func , void * ud ) ; <nl> - void upb_env_reporterrorsto ( upb_env * e , upb_status * status ) ; <nl> - bool upb_env_ok ( const upb_env * e ) ; <nl> - bool upb_env_reporterror ( upb_env * e , const upb_status * status ) ; <nl> - void * upb_env_malloc ( upb_env * e , size_t size ) ; <nl> - void * upb_env_realloc ( upb_env * e , void * ptr , size_t oldsize , size_t size ) ; <nl> - bool upb_env_addcleanup ( upb_env * e , upb_cleanup_func * func , void * ud ) ; <nl> - size_t upb_env_bytesallocated ( const upb_env * e ) ; <nl> - <nl> - UPB_END_EXTERN_C <nl> - <nl> - # ifdef __cplusplus <nl> - <nl> - / * An allocator that allocates from an initial memory region ( likely the stack ) <nl> - * before falling back to another allocator . * / <nl> - class upb : : SeededAllocator { <nl> - public : <nl> - SeededAllocator ( void * mem , size_t len ) ; <nl> - ~ SeededAllocator ( ) ; <nl> - <nl> - / * Set a custom fallback memory allocation function for the allocator , to use <nl> - * once the initial region runs out . <nl> - * <nl> - * May ONLY be called before GetAllocationFunction ( ) . If this is not <nl> - * called , the system realloc ( ) will be the fallback allocator . * / <nl> - void SetFallbackAllocator ( upb_alloc_func * alloc , void * ud ) ; <nl> - <nl> - / * Gets the allocation function for this allocator . * / <nl> - upb_alloc_func * GetAllocationFunction ( ) ; <nl> - <nl> - private : <nl> - UPB_DISALLOW_COPY_AND_ASSIGN ( SeededAllocator ) <nl> - <nl> - # else <nl> - struct upb_seededalloc { <nl> - # endif / * __cplusplus * / <nl> - <nl> - / * Fallback alloc function . * / <nl> - upb_alloc_func * alloc ; <nl> - upb_cleanup_func * alloc_cleanup ; <nl> - void * alloc_ud ; <nl> - bool need_cleanup ; <nl> - bool returned_allocfunc ; <nl> - <nl> - / * Userdata for default alloc func . * / <nl> - void * default_alloc_ud ; <nl> - <nl> - / * Pointers for the initial memory region . * / <nl> - char * mem_base ; <nl> - char * mem_ptr ; <nl> - char * mem_limit ; <nl> - <nl> - / * For future expansion , since the size of this struct is exposed to users . * / <nl> - void * future1 ; <nl> - void * future2 ; <nl> - } ; <nl> - <nl> - UPB_BEGIN_EXTERN_C <nl> - <nl> - void upb_seededalloc_init ( upb_seededalloc * a , void * mem , size_t len ) ; <nl> - void upb_seededalloc_uninit ( upb_seededalloc * a ) ; <nl> - void upb_seededalloc_setfallbackalloc ( upb_seededalloc * a , upb_alloc_func * func , <nl> - void * ud ) ; <nl> - upb_alloc_func * upb_seededalloc_getallocfunc ( upb_seededalloc * a ) ; <nl> - <nl> - UPB_END_EXTERN_C <nl> - <nl> - # ifdef __cplusplus <nl> - <nl> - namespace upb { <nl> - <nl> - inline Environment : : Environment ( ) { <nl> - upb_env_init ( this ) ; <nl> - } <nl> - inline Environment : : ~ Environment ( ) { <nl> - upb_env_uninit ( this ) ; <nl> - } <nl> - inline void Environment : : SetAllocationFunction ( upb_alloc_func * alloc , <nl> - void * ud ) { <nl> - upb_env_setallocfunc ( this , alloc , ud ) ; <nl> - } <nl> - inline void Environment : : SetErrorFunction ( upb_error_func * func , void * ud ) { <nl> - upb_env_seterrorfunc ( this , func , ud ) ; <nl> - } <nl> - inline void Environment : : ReportErrorsTo ( Status * status ) { <nl> - upb_env_reporterrorsto ( this , status ) ; <nl> - } <nl> - inline bool Environment : : ok ( ) const { <nl> - return upb_env_ok ( this ) ; <nl> - } <nl> - inline bool Environment : : ReportError ( const Status * status ) { <nl> - return upb_env_reporterror ( this , status ) ; <nl> - } <nl> - inline void * Environment : : Malloc ( size_t size ) { <nl> - return upb_env_malloc ( this , size ) ; <nl> - } <nl> - inline void * Environment : : Realloc ( void * ptr , size_t oldsize , size_t size ) { <nl> - return upb_env_realloc ( this , ptr , oldsize , size ) ; <nl> - } <nl> - inline bool Environment : : AddCleanup ( upb_cleanup_func * func , void * ud ) { <nl> - return upb_env_addcleanup ( this , func , ud ) ; <nl> - } <nl> - inline size_t Environment : : BytesAllocated ( ) const { <nl> - return upb_env_bytesallocated ( this ) ; <nl> - } <nl> - <nl> - inline SeededAllocator : : SeededAllocator ( void * mem , size_t len ) { <nl> - upb_seededalloc_init ( this , mem , len ) ; <nl> - } <nl> - inline SeededAllocator : : ~ SeededAllocator ( ) { <nl> - upb_seededalloc_uninit ( this ) ; <nl> - } <nl> - inline void SeededAllocator : : SetFallbackAllocator ( upb_alloc_func * alloc , <nl> - void * ud ) { <nl> - upb_seededalloc_setfallbackalloc ( this , alloc , ud ) ; <nl> - } <nl> - inline upb_alloc_func * SeededAllocator : : GetAllocationFunction ( ) { <nl> - return upb_seededalloc_getallocfunc ( this ) ; <nl> - } <nl> - <nl> - } / * namespace upb * / <nl> - <nl> - # endif / * __cplusplus * / <nl> - <nl> - # endif / * UPB_ENV_H_ * / <nl> - / * <nl> * * upb : : Sink ( upb_sink ) <nl> * * upb : : BytesSink ( upb_bytessink ) <nl> * * <nl> inline FileDef * Reader : : file ( size_t i ) const { <nl> * actually storing protobufs . It only contains * defs * which <nl> * let you reflect over a protobuf * schema * . <nl> * / <nl> - / * This file was generated by upbc ( the upb compiler ) . <nl> + / * This file was generated by upbc ( the upb compiler ) from the input <nl> + * file : <nl> + * <nl> + * upb / descriptor / descriptor . proto <nl> + * <nl> * Do not edit - - your changes will be discarded when the file is <nl> * regenerated . * / <nl> <nl> namespace upbdefs { <nl> namespace google { <nl> namespace protobuf { <nl> <nl> - class DescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class DescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - DescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + DescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_DescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static DescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_DescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_DescriptorProto_get ( & m ) ; <nl> return DescriptorProto ( m , & m ) ; <nl> } <nl> <nl> - class ExtensionRange : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class ExtensionRange : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - ExtensionRange ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + ExtensionRange ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_DescriptorProto_ExtensionRange_is ( m ) ) ; <nl> } <nl> <nl> static ExtensionRange get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_DescriptorProto_ExtensionRange_get ( & m ) ; <nl> return ExtensionRange ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class ReservedRange : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class ReservedRange : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - ReservedRange ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + ReservedRange ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_DescriptorProto_ReservedRange_is ( m ) ) ; <nl> } <nl> <nl> static ReservedRange get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_DescriptorProto_ReservedRange_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_DescriptorProto_ReservedRange_get ( & m ) ; <nl> return ReservedRange ( m , & m ) ; <nl> } <nl> } ; <nl> } ; <nl> <nl> - class EnumDescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class EnumDescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - EnumDescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + EnumDescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_EnumDescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static EnumDescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_EnumDescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_EnumDescriptorProto_get ( & m ) ; <nl> return EnumDescriptorProto ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class EnumOptions : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class EnumOptions : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - EnumOptions ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + EnumOptions ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_EnumOptions_is ( m ) ) ; <nl> } <nl> <nl> static EnumOptions get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_EnumOptions_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_EnumOptions_get ( & m ) ; <nl> return EnumOptions ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class EnumValueDescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class EnumValueDescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - EnumValueDescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + EnumValueDescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_EnumValueDescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static EnumValueDescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_EnumValueDescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_EnumValueDescriptorProto_get ( & m ) ; <nl> return EnumValueDescriptorProto ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class EnumValueOptions : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class EnumValueOptions : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - EnumValueOptions ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + EnumValueOptions ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_EnumValueOptions_is ( m ) ) ; <nl> } <nl> <nl> static EnumValueOptions get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_EnumValueOptions_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_EnumValueOptions_get ( & m ) ; <nl> return EnumValueOptions ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class FieldDescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class FieldDescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - FieldDescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + FieldDescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FieldDescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static FieldDescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_FieldDescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_FieldDescriptorProto_get ( & m ) ; <nl> return FieldDescriptorProto ( m , & m ) ; <nl> } <nl> <nl> - class Label : public upb : : reffed_ptr < const upb : : EnumDef > { <nl> + class Label : public : : upb : : reffed_ptr < const : : upb : : EnumDef > { <nl> public : <nl> - Label ( const upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> + Label ( const : : upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> : reffed_ptr ( e , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FieldDescriptorProto_Label_is ( e ) ) ; <nl> } <nl> static Label get ( ) { <nl> - const upb : : EnumDef * e = upbdefs_google_protobuf_FieldDescriptorProto_Label_get ( & e ) ; <nl> + const : : upb : : EnumDef * e = upbdefs_google_protobuf_FieldDescriptorProto_Label_get ( & e ) ; <nl> return Label ( e , & e ) ; <nl> } <nl> } ; <nl> <nl> - class Type : public upb : : reffed_ptr < const upb : : EnumDef > { <nl> + class Type : public : : upb : : reffed_ptr < const : : upb : : EnumDef > { <nl> public : <nl> - Type ( const upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> + Type ( const : : upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> : reffed_ptr ( e , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FieldDescriptorProto_Type_is ( e ) ) ; <nl> } <nl> static Type get ( ) { <nl> - const upb : : EnumDef * e = upbdefs_google_protobuf_FieldDescriptorProto_Type_get ( & e ) ; <nl> + const : : upb : : EnumDef * e = upbdefs_google_protobuf_FieldDescriptorProto_Type_get ( & e ) ; <nl> return Type ( e , & e ) ; <nl> } <nl> } ; <nl> } ; <nl> <nl> - class FieldOptions : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class FieldOptions : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - FieldOptions ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + FieldOptions ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FieldOptions_is ( m ) ) ; <nl> } <nl> <nl> static FieldOptions get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_FieldOptions_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_FieldOptions_get ( & m ) ; <nl> return FieldOptions ( m , & m ) ; <nl> } <nl> <nl> - class CType : public upb : : reffed_ptr < const upb : : EnumDef > { <nl> + class CType : public : : upb : : reffed_ptr < const : : upb : : EnumDef > { <nl> public : <nl> - CType ( const upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> + CType ( const : : upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> : reffed_ptr ( e , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FieldOptions_CType_is ( e ) ) ; <nl> } <nl> static CType get ( ) { <nl> - const upb : : EnumDef * e = upbdefs_google_protobuf_FieldOptions_CType_get ( & e ) ; <nl> + const : : upb : : EnumDef * e = upbdefs_google_protobuf_FieldOptions_CType_get ( & e ) ; <nl> return CType ( e , & e ) ; <nl> } <nl> } ; <nl> <nl> - class JSType : public upb : : reffed_ptr < const upb : : EnumDef > { <nl> + class JSType : public : : upb : : reffed_ptr < const : : upb : : EnumDef > { <nl> public : <nl> - JSType ( const upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> + JSType ( const : : upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> : reffed_ptr ( e , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FieldOptions_JSType_is ( e ) ) ; <nl> } <nl> static JSType get ( ) { <nl> - const upb : : EnumDef * e = upbdefs_google_protobuf_FieldOptions_JSType_get ( & e ) ; <nl> + const : : upb : : EnumDef * e = upbdefs_google_protobuf_FieldOptions_JSType_get ( & e ) ; <nl> return JSType ( e , & e ) ; <nl> } <nl> } ; <nl> } ; <nl> <nl> - class FileDescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class FileDescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - FileDescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + FileDescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FileDescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static FileDescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_FileDescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_FileDescriptorProto_get ( & m ) ; <nl> return FileDescriptorProto ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class FileDescriptorSet : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class FileDescriptorSet : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - FileDescriptorSet ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + FileDescriptorSet ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FileDescriptorSet_is ( m ) ) ; <nl> } <nl> <nl> static FileDescriptorSet get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_FileDescriptorSet_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_FileDescriptorSet_get ( & m ) ; <nl> return FileDescriptorSet ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class FileOptions : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class FileOptions : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - FileOptions ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + FileOptions ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FileOptions_is ( m ) ) ; <nl> } <nl> <nl> static FileOptions get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_FileOptions_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_FileOptions_get ( & m ) ; <nl> return FileOptions ( m , & m ) ; <nl> } <nl> <nl> - class OptimizeMode : public upb : : reffed_ptr < const upb : : EnumDef > { <nl> + class OptimizeMode : public : : upb : : reffed_ptr < const : : upb : : EnumDef > { <nl> public : <nl> - OptimizeMode ( const upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> + OptimizeMode ( const : : upb : : EnumDef * e , const void * ref_donor = NULL ) <nl> : reffed_ptr ( e , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_FileOptions_OptimizeMode_is ( e ) ) ; <nl> } <nl> static OptimizeMode get ( ) { <nl> - const upb : : EnumDef * e = upbdefs_google_protobuf_FileOptions_OptimizeMode_get ( & e ) ; <nl> + const : : upb : : EnumDef * e = upbdefs_google_protobuf_FileOptions_OptimizeMode_get ( & e ) ; <nl> return OptimizeMode ( e , & e ) ; <nl> } <nl> } ; <nl> } ; <nl> <nl> - class MessageOptions : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class MessageOptions : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - MessageOptions ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + MessageOptions ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_MessageOptions_is ( m ) ) ; <nl> } <nl> <nl> static MessageOptions get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_MessageOptions_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_MessageOptions_get ( & m ) ; <nl> return MessageOptions ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class MethodDescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class MethodDescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - MethodDescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + MethodDescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_MethodDescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static MethodDescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_MethodDescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_MethodDescriptorProto_get ( & m ) ; <nl> return MethodDescriptorProto ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class MethodOptions : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class MethodOptions : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - MethodOptions ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + MethodOptions ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_MethodOptions_is ( m ) ) ; <nl> } <nl> <nl> static MethodOptions get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_MethodOptions_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_MethodOptions_get ( & m ) ; <nl> return MethodOptions ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class OneofDescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class OneofDescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - OneofDescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + OneofDescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_OneofDescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static OneofDescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_OneofDescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_OneofDescriptorProto_get ( & m ) ; <nl> return OneofDescriptorProto ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class ServiceDescriptorProto : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class ServiceDescriptorProto : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - ServiceDescriptorProto ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + ServiceDescriptorProto ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_ServiceDescriptorProto_is ( m ) ) ; <nl> } <nl> <nl> static ServiceDescriptorProto get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_ServiceDescriptorProto_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_ServiceDescriptorProto_get ( & m ) ; <nl> return ServiceDescriptorProto ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class ServiceOptions : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class ServiceOptions : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - ServiceOptions ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + ServiceOptions ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_ServiceOptions_is ( m ) ) ; <nl> } <nl> <nl> static ServiceOptions get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_ServiceOptions_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_ServiceOptions_get ( & m ) ; <nl> return ServiceOptions ( m , & m ) ; <nl> } <nl> } ; <nl> <nl> - class SourceCodeInfo : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class SourceCodeInfo : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - SourceCodeInfo ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + SourceCodeInfo ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_SourceCodeInfo_is ( m ) ) ; <nl> } <nl> <nl> static SourceCodeInfo get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_SourceCodeInfo_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_SourceCodeInfo_get ( & m ) ; <nl> return SourceCodeInfo ( m , & m ) ; <nl> } <nl> <nl> - class Location : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class Location : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - Location ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + Location ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_SourceCodeInfo_Location_is ( m ) ) ; <nl> } <nl> <nl> static Location get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_SourceCodeInfo_Location_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_SourceCodeInfo_Location_get ( & m ) ; <nl> return Location ( m , & m ) ; <nl> } <nl> } ; <nl> } ; <nl> <nl> - class UninterpretedOption : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class UninterpretedOption : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - UninterpretedOption ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + UninterpretedOption ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_UninterpretedOption_is ( m ) ) ; <nl> } <nl> <nl> static UninterpretedOption get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_UninterpretedOption_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_UninterpretedOption_get ( & m ) ; <nl> return UninterpretedOption ( m , & m ) ; <nl> } <nl> <nl> - class NamePart : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> + class NamePart : public : : upb : : reffed_ptr < const : : upb : : MessageDef > { <nl> public : <nl> - NamePart ( const upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> + NamePart ( const : : upb : : MessageDef * m , const void * ref_donor = NULL ) <nl> : reffed_ptr ( m , ref_donor ) { <nl> assert ( upbdefs_google_protobuf_UninterpretedOption_NamePart_is ( m ) ) ; <nl> } <nl> <nl> static NamePart get ( ) { <nl> - const upb : : MessageDef * m = upbdefs_google_protobuf_UninterpretedOption_NamePart_get ( & m ) ; <nl> + const : : upb : : MessageDef * m = upbdefs_google_protobuf_UninterpretedOption_NamePart_get ( & m ) ; <nl> return NamePart ( m , & m ) ; <nl> } <nl> } ; <nl> class UninterpretedOption : public upb : : reffed_ptr < const upb : : MessageDef > { <nl> # ifndef UPB_DECODER_INT_H_ <nl> # define UPB_DECODER_INT_H_ <nl> <nl> - # include < stdlib . h > <nl> / * <nl> * * upb : : pb : : Decoder <nl> * * <nl> class upb : : pb : : DecoderMethod { <nl> * constructed . This hint may be an overestimate for some build configurations . <nl> * But if the decoder library is upgraded without recompiling the application , <nl> * it may be an underestimate . * / <nl> - # define UPB_PB_DECODER_SIZE 4408 <nl> + # define UPB_PB_DECODER_SIZE 4416 <nl> <nl> # ifdef __cplusplus <nl> <nl> extern " C " { <nl> # endif <nl> <nl> / * Loads a binary descriptor and returns a NULL - terminated array of unfrozen <nl> - * filedefs . The caller owns the returned array . * / <nl> + * filedefs . The caller owns the returned array , which must be freed with <nl> + * upb_gfree ( ) . * / <nl> upb_filedef * * upb_loaddescriptor ( const char * buf , size_t n , const void * owner , <nl> upb_status * status ) ; <nl> <nl> UPB_DECLARE_DERIVED_TYPE ( upb : : json : : ParserMethod , upb : : RefCounted , <nl> * constructed . This hint may be an overestimate for some build configurations . <nl> * But if the parser library is upgraded without recompiling the application , <nl> * it may be an underestimate . * / <nl> - # define UPB_JSON_PARSER_SIZE 4104 <nl> + # define UPB_JSON_PARSER_SIZE 4112 <nl> <nl> # ifdef __cplusplus <nl> <nl> UPB_DECLARE_TYPE ( upb : : json : : Printer , upb_json_printer ) <nl> <nl> / * upb : : json : : Printer * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> <nl> - # define UPB_JSON_PRINTER_SIZE 168 <nl> + # define UPB_JSON_PRINTER_SIZE 176 <nl> <nl> # ifdef __cplusplus <nl> <nl>
Merge pull request from haberman / updateupb
protocolbuffers/protobuf
f53f911793c3024976f80211e0c976f5cc51f88d
2016-04-27T17:37:33Z
mmm a / tensorflow / python / kernel_tests / init_ops_test . py <nl> ppp b / tensorflow / python / kernel_tests / init_ops_test . py <nl> def testDType ( self ) : <nl> <nl> def testMixedDType ( self ) : <nl> # Test case for GitHub issue 35710 <nl> - tf_ans = math_ops . range ( constant_op . constant ( 4 , dtype = dtypes . int32 ) , dtype = dtypes . int64 ) <nl> + tf_ans = math_ops . range ( <nl> + constant_op . constant ( 4 , dtype = dtypes . int32 ) , dtype = dtypes . int64 ) <nl> self . assertAllEqual ( self . evaluate ( tf_ans ) , np . array ( [ 0 , 1 , 2 , 3 ] ) ) <nl> <nl> <nl>
Pylint fix
tensorflow/tensorflow
92799f42c8c1c1ff8f89b8a701dda1f26f5663e9
2020-01-13T16:21:03Z
mmm a / modules / gpu / src / beliefpropagation_gpu . cpp <nl> ppp b / modules / gpu / src / beliefpropagation_gpu . cpp <nl> namespace cv { namespace gpu { namespace impl { <nl> } } } <nl> <nl> cv : : gpu : : StereoBeliefPropagation_GPU : : StereoBeliefPropagation_GPU ( int ndisp_ , int iters_ , int levels_ ) <nl> - : ndisp ( ndisp_ ) , iters ( iters_ ) , levels ( levels_ ) , disc_cost ( DEFAULT_DISC_COST ) , data_cost ( DEFAULT_DATA_COST ) , lambda ( DEFAULT_LAMBDA_COST ) , datas ( levels_ ) <nl> + : ndisp ( ndisp_ ) , iters ( iters_ ) , levels ( levels_ ) , disc_cost ( DEFAULT_DISC_COST ) , data_cost ( DEFAULT_DATA_COST ) , lambda ( DEFAULT_LAMBDA_COST ) , datas ( levels_ ) <nl> { <nl> CV_Assert ( 0 < ndisp ) ; <nl> CV_Assert ( ndisp % 8 = = 0 ) ; <nl> } <nl> <nl> cv : : gpu : : StereoBeliefPropagation_GPU : : StereoBeliefPropagation_GPU ( int ndisp_ , int iters_ , int levels_ , float disc_cost_ , float data_cost_ , float lambda_ ) <nl> - : ndisp ( ndisp_ ) , iters ( iters_ ) , levels ( levels_ ) , disc_cost ( disc_cost_ ) , data_cost ( data_cost_ ) , lambda ( lambda_ ) , datas ( levels_ ) <nl> + : ndisp ( ndisp_ ) , iters ( iters_ ) , levels ( levels_ ) , disc_cost ( disc_cost_ ) , data_cost ( data_cost_ ) , lambda ( lambda_ ) , datas ( levels_ ) <nl> { <nl> CV_Assert ( 0 < ndisp ) ; <nl> CV_Assert ( ndisp % 8 = = 0 ) ; <nl> } <nl> <nl> - static void stereo_bp_gpu_operator ( int ndisp , int iters , int levels , float disc_cost , float data_cost , float lambda , <nl> - GpuMat & u , GpuMat & d , GpuMat & l , GpuMat & r , <nl> + static void stereo_bp_gpu_operator ( int ndisp , int iters , int levels , float disc_cost , float data_cost , float lambda , <nl> + GpuMat & u , GpuMat & d , GpuMat & l , GpuMat & r , <nl> GpuMat & u2 , GpuMat & d2 , GpuMat & l2 , GpuMat & r2 , <nl> vector < GpuMat > & datas , GpuMat & out , <nl> - const GpuMat & left , const GpuMat & right , GpuMat & disp , <nl> + const GpuMat & left , const GpuMat & right , GpuMat & disp , <nl> const cudaStream_t & stream ) <nl> { <nl> CV_DbgAssert ( left . cols = = right . cols & & left . rows = = right . rows & & left . type ( ) = = right . type ( ) & & left . type ( ) = = CV_8U ) ; <nl> static void stereo_bp_gpu_operator ( int ndisp , int iters , int levels , float disc_ <nl> int divisor = ( int ) pow ( 2 . f , levels - 1 . 0f ) ; <nl> int lowest_cols = cols / divisor ; <nl> int lowest_rows = rows / divisor ; <nl> - const int min_image_dim_size = 20 ; <nl> - CV_Assert ( min ( lowest_cols , lowest_rows ) > min_image_dim_size ) ; <nl> + const int min_image_dim_size = 2 ; <nl> + CV_Assert ( min ( lowest_cols , lowest_rows ) > min_image_dim_size ) ; <nl> <nl> - u . create ( rows * ndisp , cols , CV_32F ) ; <nl> - d . create ( rows * ndisp , cols , CV_32F ) ; <nl> - l . create ( rows * ndisp , cols , CV_32F ) ; <nl> + u . create ( rows * ndisp , cols , CV_32F ) ; <nl> + d . create ( rows * ndisp , cols , CV_32F ) ; <nl> + l . create ( rows * ndisp , cols , CV_32F ) ; <nl> r . create ( rows * ndisp , cols , CV_32F ) ; <nl> <nl> if ( levels & 1 ) <nl> static void stereo_bp_gpu_operator ( int ndisp , int iters , int levels , float disc_ <nl> u2 = zero ; <nl> d2 = zero ; <nl> l2 = zero ; <nl> - r2 = zero ; <nl> + r2 = zero ; <nl> } <nl> - } <nl> + } <nl> <nl> impl : : load_constants ( ndisp , disc_cost , data_cost , lambda ) ; <nl> <nl> datas . resize ( levels ) ; <nl> - <nl> + <nl> AutoBuffer < int > cols_all_buf ( levels ) ; <nl> AutoBuffer < int > rows_all_buf ( levels ) ; <nl> AutoBuffer < int > iters_all_buf ( levels ) ; <nl> static void stereo_bp_gpu_operator ( int ndisp , int iters , int levels , float disc_ <nl> <nl> impl : : comp_data_caller ( left , right , datas . front ( ) , stream ) ; <nl> <nl> - for ( int i = 1 ; i < levels ; i + + ) <nl> + for ( int i = 1 ; i < levels ; i + + ) <nl> { <nl> cols_all [ i ] = ( cols_all [ i - 1 ] + 1 ) / 2 ; <nl> rows_all [ i ] = ( rows_all [ i - 1 ] + 1 ) / 2 ; <nl> static void stereo_bp_gpu_operator ( int ndisp , int iters , int levels , float disc_ <nl> / / we reduce iters num for each next level <nl> iters_all [ i ] = max ( 2 * iters_all [ i - 1 ] / 3 , 1 ) ; <nl> <nl> - datas [ i ] . create ( rows_all [ i ] * ndisp , cols_all [ i ] , CV_32F ) ; <nl> + datas [ i ] . create ( rows_all [ i ] * ndisp , cols_all [ i ] , CV_32F ) ; <nl> <nl> impl : : data_down_kernel_caller ( cols_all [ i ] , rows_all [ i ] , rows_all [ i - 1 ] , datas [ i - 1 ] , datas [ i ] , stream ) ; <nl> } <nl> - <nl> - DevMem2D_ < float > mus [ ] = { u , u2 } ; <nl> + <nl> + DevMem2D_ < float > mus [ ] = { u , u2 } ; <nl> DevMem2D_ < float > mds [ ] = { d , d2 } ; <nl> - DevMem2D_ < float > mrs [ ] = { r , r2 } ; <nl> + DevMem2D_ < float > mrs [ ] = { r , r2 } ; <nl> DevMem2D_ < float > mls [ ] = { l , l2 } ; <nl> <nl> int mem_idx = ( levels & 1 ) ? 0 : 1 ; <nl> <nl> for ( int i = levels - 1 ; i > = 0 ; i - - ) / / for lower level we have already computed messages by setting to zero <nl> - { <nl> - if ( i ! = levels - 1 ) <nl> + { <nl> + if ( i ! = levels - 1 ) <nl> impl : : level_up ( mem_idx , cols_all [ i ] , rows_all [ i ] , rows_all [ i + 1 ] , mus , mds , mls , mrs , stream ) ; <nl> <nl> impl : : call_all_iterations ( cols_all [ i ] , rows_all [ i ] , iters_all [ i ] , mus [ mem_idx ] , mds [ mem_idx ] , mls [ mem_idx ] , mrs [ mem_idx ] , datas [ i ] , stream ) ; <nl> <nl> mem_idx = ( mem_idx + 1 ) & 1 ; <nl> } <nl> - <nl> + <nl> if ( disp . empty ( ) ) <nl> disp . create ( rows , cols , CV_32S ) ; <nl> <nl> static void stereo_bp_gpu_operator ( int ndisp , int iters , int levels , float disc_ <nl> impl : : output_caller ( u , d , l , r , datas . front ( ) , disp , stream ) ; <nl> } <nl> else <nl> - { <nl> + { <nl> out . create ( rows , cols , CV_32S ) ; <nl> out = zero ; <nl> <nl> impl : : output_caller ( u , d , l , r , datas . front ( ) , out , stream ) ; <nl> - <nl> + <nl> out . convertTo ( disp , disp . type ( ) ) ; <nl> } <nl> } <nl> <nl> void cv : : gpu : : StereoBeliefPropagation_GPU : : operator ( ) ( const GpuMat & left , const GpuMat & right , GpuMat & disp ) <nl> - { <nl> + { <nl> : : stereo_bp_gpu_operator ( ndisp , iters , levels , disc_cost , data_cost , lambda , u , d , l , r , u2 , d2 , l2 , r2 , datas , out , left , right , disp , 0 ) ; <nl> } <nl> <nl>
minor fix
opencv/opencv
97254a7b45b4086f13425363e0356929b776a5d2
2010-07-29T10:28:10Z
mmm a / tests / cpp - tests / Resources / Materials / 2d_effects . material <nl> ppp b / tests / cpp - tests / Resources / Materials / 2d_effects . material <nl> material sample <nl> shader <nl> { <nl> defines = THIS_IS_AN_EXAMPLE 1 ; TOMORROW_IS_HOLIDAY 2 <nl> - vertexShader = Shaders / example_simple . vsh <nl> + vertexShader = Shaders / example_Simple . vsh <nl> fragmentShader = Shaders / example_Blur . fsh <nl> / / Uniforms <nl> blurRadius = 3 <nl> material sample <nl> { <nl> shader <nl> { <nl> - vertexShader = Shaders / example_simple . vsh <nl> - fragmentShader = Shaders / example_outline . fsh <nl> + vertexShader = Shaders / example_Simple . vsh <nl> + fragmentShader = Shaders / example_Outline . fsh <nl> u_outlineColor = 0 . 1 , 0 . 2 , 0 . 3 <nl> u_radius = 0 . 01 <nl> u_threshold = 1 . 75 <nl> material sample <nl> { <nl> shader <nl> { <nl> - vertexShader = Shaders / example_simple . vsh <nl> + vertexShader = Shaders / example_Simple . vsh <nl> fragmentShader = Shaders / example_Noisy . fsh <nl> resolution = 100 , 100 <nl> } <nl> material sample <nl> shader <nl> { <nl> defines = <nl> - vertexShader = Shaders / example_simple . vsh <nl> - fragmentShader = Shaders / example_edgeDetection . fsh <nl> + vertexShader = Shaders / example_Simple . vsh <nl> + fragmentShader = Shaders / example_EdgeDetection . fsh <nl> resolution = 100 , 100 <nl> } <nl> } <nl>
Synchronize the modification of filenames about shaders to fix the bug of MateriaSystemTest .
cocos2d/cocos2d-x
a89e000f807e3cac02214fbc7ab49f780e89511f
2015-05-28T02:46:44Z
mmm a / Code / Sandbox / Plugins / EditorCommon / LevelEditor / Tools / ObjectMode . cpp <nl> ppp b / Code / Sandbox / Plugins / EditorCommon / LevelEditor / Tools / ObjectMode . cpp <nl> bool CObjectMode : : OnLButtonDown ( CViewport * view , int nFlags , CPoint point ) <nl> <nl> if ( ! bToggle ) <nl> { <nl> - pObjectManager - > SelectObject ( hitObj ) ; <nl> + if ( bShiftClick ) <nl> + { <nl> + pObjectManager - > AddObjectToSelection ( hitObj ) ; <nl> + } <nl> + else <nl> + { <nl> + pObjectManager - > SelectObject ( hitObj ) ; <nl> + } <nl> } <nl> else <nl> { <nl>
! B ( Sandbox ) ( CE - 18693 ) Fixed issue where shift + click wasn ' t adding to selection
CRYTEK/CRYENGINE
74d6104cbb4fc0b2f63c9a88c4969bbc76e06c76
2018-10-19T07:34:11Z
mmm a / lib / SILOptimizer / SILCombiner / SILCombinerMiscVisitors . cpp <nl> ppp b / lib / SILOptimizer / SILCombiner / SILCombinerMiscVisitors . cpp <nl> SILInstruction * SILCombiner : : visitTupleExtractInst ( TupleExtractInst * TEI ) { <nl> return nullptr ; <nl> } <nl> <nl> - SILInstruction * SILCombiner : : visitFixLifetimeInst ( FixLifetimeInst * FLI ) { <nl> - if ( FLI - > getFunction ( ) - > hasOwnership ( ) ) <nl> - return nullptr ; <nl> - <nl> + SILInstruction * SILCombiner : : visitFixLifetimeInst ( FixLifetimeInst * fli ) { <nl> / / fix_lifetime ( alloc_stack ) - > fix_lifetime ( load ( alloc_stack ) ) <nl> - Builder . setCurrentDebugScope ( FLI - > getDebugScope ( ) ) ; <nl> - if ( auto * AI = dyn_cast < AllocStackInst > ( FLI - > getOperand ( ) ) ) { <nl> - if ( FLI - > getOperand ( ) - > getType ( ) . isLoadable ( * FLI - > getFunction ( ) ) ) { <nl> - auto Load = Builder . createLoad ( FLI - > getLoc ( ) , AI , <nl> - LoadOwnershipQualifier : : Unqualified ) ; <nl> - return Builder . createFixLifetime ( FLI - > getLoc ( ) , Load ) ; <nl> + Builder . setCurrentDebugScope ( fli - > getDebugScope ( ) ) ; <nl> + if ( auto * ai = dyn_cast < AllocStackInst > ( fli - > getOperand ( ) ) ) { <nl> + if ( fli - > getOperand ( ) - > getType ( ) . isLoadable ( * fli - > getFunction ( ) ) ) { <nl> + / / load when ossa is disabled <nl> + auto load = Builder . emitLoadBorrowOperation ( fli - > getLoc ( ) , ai ) ; <nl> + Builder . createFixLifetime ( fli - > getLoc ( ) , load ) ; <nl> + / / no - op when ossa is disabled <nl> + Builder . emitEndBorrowOperation ( fli - > getLoc ( ) , load ) ; <nl> + return eraseInstFromFunction ( * fli ) ; <nl> } <nl> } <nl> return nullptr ; <nl> new file mode 100644 <nl> index 000000000000 . . 4b6658a1a4b0 <nl> mmm / dev / null <nl> ppp b / test / SILOptimizer / sil_combine_misc_visitor_opts_ossa . sil <nl> <nl> + / / RUN : % target - sil - opt - enable - objc - interop - enforce - exclusivity = none - enable - sil - verify - all % s - sil - combine - sil - combine - disable - alloc - stack - opts | % FileCheck % s <nl> + <nl> + sil_stage canonical <nl> + <nl> + import Builtin <nl> + <nl> + class Klass { } <nl> + <nl> + / / We test both the ossa and non - ossa variants . <nl> + / / <nl> + / / CHECK - LABEL : sil [ ossa ] @ fix_lifetime_promotion_ossa : $ @ convention ( thin ) ( @ owned Klass ) - > ( ) { <nl> + / / CHECK : bb0 ( [ [ ARG : % . * ] ] : <nl> + / / CHECK : [ [ STACK : % . * ] ] = alloc_stack $ Klass <nl> + / / CHECK : store [ [ ARG ] ] to [ init ] [ [ STACK ] ] <nl> + / / CHECK : [ [ BORROW : % . * ] ] = load_borrow [ [ STACK ] ] <nl> + / / CHECK : fix_lifetime [ [ BORROW ] ] <nl> + / / CHECK : end_borrow [ [ BORROW ] ] <nl> + / / CHECK : destroy_addr [ [ STACK ] ] <nl> + / / CHECK : dealloc_stack [ [ STACK ] ] <nl> + / / CHECK : } / / end sil function ' fix_lifetime_promotion_ossa ' <nl> + sil [ ossa ] @ fix_lifetime_promotion_ossa : $ @ convention ( thin ) ( @ owned Klass ) - > ( ) { <nl> + bb0 ( % 0 : @ owned $ Klass ) : <nl> + % 1 = alloc_stack $ Klass <nl> + store % 0 to [ init ] % 1 : $ * Klass <nl> + fix_lifetime % 1 : $ * Klass <nl> + destroy_addr % 1 : $ * Klass <nl> + dealloc_stack % 1 : $ * Klass <nl> + % 9999 = tuple ( ) <nl> + return % 9999 : $ ( ) <nl> + } <nl> + <nl> + / / CHECK - LABEL : sil @ fix_lifetime_promotion : $ @ convention ( thin ) ( @ owned Klass ) - > ( ) { <nl> + / / CHECK : bb0 ( [ [ ARG : % . * ] ] : <nl> + / / CHECK : [ [ STACK : % . * ] ] = alloc_stack $ Klass <nl> + / / CHECK : store [ [ ARG ] ] to [ [ STACK ] ] <nl> + / / CHECK : [ [ BORROW : % . * ] ] = load [ [ STACK ] ] <nl> + / / CHECK : fix_lifetime [ [ BORROW ] ] <nl> + / / CHECK : destroy_addr [ [ STACK ] ] <nl> + / / CHECK : dealloc_stack [ [ STACK ] ] <nl> + / / CHECK : } / / end sil function ' fix_lifetime_promotion ' <nl> + sil @ fix_lifetime_promotion : $ @ convention ( thin ) ( @ owned Klass ) - > ( ) { <nl> + bb0 ( % 0 : $ Klass ) : <nl> + % 1 = alloc_stack $ Klass <nl> + store % 0 to % 1 : $ * Klass <nl> + fix_lifetime % 1 : $ * Klass <nl> + destroy_addr % 1 : $ * Klass <nl> + dealloc_stack % 1 : $ * Klass <nl> + % 9999 = tuple ( ) <nl> + return % 9999 : $ ( ) <nl> + } <nl>
[ sil - combine ] Update fix_lifetime opts for ownership
apple/swift
061632edef221c7ede3fa89b7e54edb05480a974
2020-12-21T05:22:19Z
mmm a / admin / static / coffee / namespaces / namespace . coffee <nl> ppp b / admin / static / coffee / namespaces / namespace . coffee <nl> module ' NamespaceView ' , - > <nl> ' click . reconnect_link ' : ' init_connection ' <nl> ' click . close_hide ' : ' hide_alert ' <nl> error_interval : 5 * 1000 # In case of an error , we try to retrieve the secondary index in 5 seconds <nl> - normal_interval : 10 * 1000 # Retrieve secondary indexes every minute <nl> + normal_interval : 10 * 1000 # Retrieve secondary indexes every 10 seconds <nl> short_interval : 1000 # Interval when an index is being created <nl> <nl> initialize : ( args ) = > <nl> module ' NamespaceView ' , - > <nl> timer : true <nl> <nl> error_on_connect : ( error ) = > <nl> - console . log ' * * * * * * * * * * * * * * * error * * * * * * * * * * * * * * * ' <nl> - console . log error <nl> @ render_error <nl> index_list_fail : true <nl> @ timeout = setTimeout @ get_indexes , @ error_interval <nl> <nl> + # Retrieve all the indexes of this table <nl> + # ` args ` can be an object with the field ` timer ` . <nl> + # If ` timer ` is ` true ` , we set a timeout after having retrieved the statuses <nl> get_indexes : ( args ) = > <nl> - # @ driver_handler . close_connection ( ) <nl> @ driver_handler . create_connection ( error , connection ) = > <nl> if ( error ) <nl> + # There was an error when we opened the connection <nl> @ error_on_connect error <nl> else <nl> - if args ? . timer is true <nl> - r . db ( @ db_name ) . table ( @ table ) . indexStatus ( ) . private_run connection , ( err , result ) = > <nl> + r . db ( @ db_name ) . table ( @ table ) . indexStatus ( ) . private_run connection , ( err , result ) = > <nl> + if args ? . timer is true <nl> @ on_index_list_repeat err , result <nl> - setTimeout - > <nl> - connection . close ( ) <nl> - , 0 <nl> - else <nl> - r . db ( @ db_name ) . table ( @ table ) . indexStatus ( ) . private_run connection , ( err , result ) = > <nl> + else <nl> @ on_index_list err , result <nl> - setTimeout - > <nl> - connection . close ( ) <nl> - , 0 <nl> - , 0 , @ error_on_connect <nl> + # We have a seTimeout here to give the driver some time to release the connection before we close it . <nl> + setTimeout - > <nl> + connection . close ( ) <nl> + , 0 <nl> + , 0 , @ error_on_connect # This callback is fore create_connection is bind to connection . on ( ' error ' , . . . ) <nl> <nl> on_index_list_repeat : ( err , result ) = > <nl> @ on_index_list err , result , true <nl>
Clean code + add comments
rethinkdb/rethinkdb
2c933a7da538eeb7c169dbcb4acffbbc7a7fa5d0
2014-02-19T06:08:43Z
mmm a / . gitmodules <nl> ppp b / . gitmodules <nl> <nl> [ submodule " third_party / gflags " ] <nl> path = third_party / gflags <nl> url = https : / / github . com / gflags / gflags . git <nl> + [ submodule " third_party / googletest " ] <nl> + path = third_party / googletest <nl> + url = git : / / github . com / google / googletest <nl> mmm a / Makefile <nl> ppp b / Makefile <nl> LIBS = m z pthread <nl> LDFLAGS + = - pthread <nl> endif <nl> <nl> - ifneq ( $ ( wildcard / usr / src / gtest / src / gtest - all . cc ) , ) <nl> - GTEST_LIB = / usr / src / gtest / src / gtest - all . cc - I / usr / src / gtest <nl> - else <nl> - GTEST_LIB = - lgtest <nl> - endif <nl> + GTEST_LIB = - Ithird_party / googletest / include - Ithird_party / googletest third_party / googletest / src / gtest - all . cc <nl> GTEST_LIB + = - lgflags <nl> ifeq ( $ ( V ) , 1 ) <nl> E = @ : <nl> PROTOBUF_PKG_CONFIG = false <nl> PC_REQUIRES_GRPCXX = <nl> PC_LIBS_GRPCXX = <nl> <nl> + CPPFLAGS : = - Ithird_party / googletest / include $ ( CPPFLAGS ) <nl> + <nl> ifeq ( $ ( HAS_SYSTEM_PROTOBUF ) , true ) <nl> ifeq ( $ ( HAS_PKG_CONFIG ) , true ) <nl> PROTOBUF_PKG_CONFIG = true <nl> mmm a / templates / Makefile . template <nl> ppp b / templates / Makefile . template <nl> LIBS = m z pthread <nl> LDFLAGS + = - pthread <nl> endif <nl> <nl> - ifneq ( $ ( wildcard / usr / src / gtest / src / gtest - all . cc ) , ) <nl> - GTEST_LIB = / usr / src / gtest / src / gtest - all . cc - I / usr / src / gtest <nl> - else <nl> - GTEST_LIB = - lgtest <nl> - endif <nl> + GTEST_LIB = - Ithird_party / googletest / include - Ithird_party / googletest third_party / googletest / src / gtest - all . cc <nl> GTEST_LIB + = - lgflags <nl> ifeq ( $ ( V ) , 1 ) <nl> E = @ : <nl> PROTOBUF_PKG_CONFIG = false <nl> PC_REQUIRES_GRPCXX = <nl> PC_LIBS_GRPCXX = <nl> <nl> + CPPFLAGS : = - Ithird_party / googletest / include $ ( CPPFLAGS ) <nl> + <nl> ifeq ( $ ( HAS_SYSTEM_PROTOBUF ) , true ) <nl> ifeq ( $ ( HAS_PKG_CONFIG ) , true ) <nl> PROTOBUF_PKG_CONFIG = true <nl> new file mode 160000 <nl> index 00000000000 . . c80449247c0 <nl> mmm / dev / null <nl> ppp b / third_party / googletest <nl> @ @ - 0 , 0 + 1 @ @ <nl> + Subproject commit c80449247c0e3032401297edf19a1be8078900cc <nl>
Make googletest a submodule
grpc/grpc
16f6dac8e81a818f399b180c673d966cd40603c1
2015-08-25T00:00:04Z
mmm a / tools / run_tests / run_tests . py <nl> ppp b / tools / run_tests / run_tests . py <nl> def __init__ ( self ) : <nl> <nl> def test_specs ( self , config , travis ) : <nl> modules = [ config . job_spec ( [ ' tools / run_tests / run_python . sh ' , ' - m ' , <nl> - test [ ' module ' ] ] , None ) <nl> + test [ ' module ' ] ] , <nl> + None , <nl> + shortname = test [ ' module ' ] ) <nl> for test in self . _tests if ' module ' in test ] <nl> files = [ config . job_spec ( [ ' tools / run_tests / run_python . sh ' , <nl> - test [ ' file ' ] ] , None ) <nl> + test [ ' file ' ] ] , <nl> + None , <nl> + shortname = test [ ' file ' ] ) <nl> for test in self . _tests if ' file ' in test ] <nl> return files + modules <nl> <nl>
Merge pull request from ctiller / shortname - for - the - snake
grpc/grpc
28d78aad91ccadf2d7e9977ae5265f9aff9b3f24
2015-05-13T22:16:25Z
mmm a / java / com / facebook / yoga / YogaNative . java <nl> ppp b / java / com / facebook / yoga / YogaNative . java <nl> <nl> static native boolean jni_YGNodeIsReferenceBaselineJNI ( long nativePointer ) ; <nl> static native void jni_YGNodeClearChildrenJNI ( long nativePointer ) ; <nl> static native void jni_YGNodeRemoveChildJNI ( long nativePointer , long childPointer ) ; <nl> + static native void jni_YGNodeCalculateLayoutJNI ( long nativePointer , float width , float height , long [ ] nativePointers , YogaNodeJNIBase [ ] nodes ) ; <nl> static native void jni_YGNodeMarkDirtyJNI ( long nativePointer ) ; <nl> static native void jni_YGNodeMarkDirtyAndPropogateToDescendantsJNI ( long nativePointer ) ; <nl> static native boolean jni_YGNodeIsDirtyJNI ( long nativePointer ) ; <nl> mmm a / java / com / facebook / yoga / YogaNodeJNIBase . java <nl> ppp b / java / com / facebook / yoga / YogaNodeJNIBase . java <nl> public void calculateLayout ( float width , float height ) { <nl> nativePointers [ i ] = nodes [ i ] . mNativePointer ; <nl> } <nl> <nl> - YogaNative . jni_YGNodeCalculateLayout ( mNativePointer , width , height , nativePointers , nodes ) ; <nl> + if ( useVanillaJNI ) <nl> + YogaNative . jni_YGNodeCalculateLayoutJNI ( mNativePointer , width , height , nativePointers , nodes ) ; <nl> + else <nl> + YogaNative . jni_YGNodeCalculateLayout ( mNativePointer , width , height , nativePointers , nodes ) ; <nl> } <nl> <nl> public void dirty ( ) { <nl> mmm a / java / jni / YGJNI . cpp <nl> ppp b / java / jni / YGJNI . cpp <nl> using namespace facebook : : jni ; <nl> using namespace std ; <nl> using facebook : : yoga : : detail : : Log ; <nl> <nl> - const short int LAYOUT_EDGE_SET_FLAG_INDEX = 0 ; <nl> - const short int LAYOUT_WIDTH_INDEX = 1 ; <nl> - const short int LAYOUT_HEIGHT_INDEX = 2 ; <nl> - const short int LAYOUT_LEFT_INDEX = 3 ; <nl> - const short int LAYOUT_TOP_INDEX = 4 ; <nl> - const short int LAYOUT_DIRECTION_INDEX = 5 ; <nl> - const short int LAYOUT_MARGIN_START_INDEX = 6 ; <nl> - const short int LAYOUT_PADDING_START_INDEX = 10 ; <nl> - const short int LAYOUT_BORDER_START_INDEX = 14 ; <nl> - <nl> - namespace { <nl> - <nl> - const int DOES_LEGACY_STRETCH_BEHAVIOUR = 8 ; <nl> - const int HAS_NEW_LAYOUT = 16 ; <nl> - <nl> - } / / namespace <nl> - <nl> static inline local_ref < JYogaNode > YGNodeJobject ( <nl> YGNodeRef node , <nl> void * layoutContext ) { <nl> mmm a / java / jni / YGJNI . h <nl> ppp b / java / jni / YGJNI . h <nl> enum YGStyleInput { <nl> IsReferenceBaseline , <nl> } ; <nl> <nl> + const short int LAYOUT_EDGE_SET_FLAG_INDEX = 0 ; <nl> + const short int LAYOUT_WIDTH_INDEX = 1 ; <nl> + const short int LAYOUT_HEIGHT_INDEX = 2 ; <nl> + const short int LAYOUT_LEFT_INDEX = 3 ; <nl> + const short int LAYOUT_TOP_INDEX = 4 ; <nl> + const short int LAYOUT_DIRECTION_INDEX = 5 ; <nl> + const short int LAYOUT_MARGIN_START_INDEX = 6 ; <nl> + const short int LAYOUT_PADDING_START_INDEX = 10 ; <nl> + const short int LAYOUT_BORDER_START_INDEX = 14 ; <nl> + <nl> namespace { <nl> <nl> + const int DOES_LEGACY_STRETCH_BEHAVIOUR = 8 ; <nl> + const int HAS_NEW_LAYOUT = 16 ; <nl> + <nl> union YGNodeContext { <nl> uintptr_t edgesSet = 0 ; <nl> void * asVoidPtr ; <nl> mmm a / java / jni / YGJNIVanilla . cpp <nl> ppp b / java / jni / YGJNIVanilla . cpp <nl> <nl> # include < yoga / YGNode . h > <nl> # include < cstring > <nl> # include " YGJNI . h " <nl> + # include " common . h " <nl> + # include " YGJTypesVanilla . h " <nl> + # include < yoga / log . h > <nl> + <nl> + using namespace facebook : : yoga : : vanillajni ; <nl> + using facebook : : yoga : : detail : : Log ; <nl> + <nl> + static inline ScopedLocalRef < jobject > YGNodeJobject ( <nl> + YGNodeRef node , <nl> + void * layoutContext ) { <nl> + return reinterpret_cast < PtrJNodeMap * > ( layoutContext ) <nl> + - > ref ( getCurrentEnv ( ) , node ) ; <nl> + } <nl> <nl> static inline YGNodeRef _jlong2YGNodeRef ( jlong addr ) { <nl> return reinterpret_cast < YGNodeRef > ( static_cast < intptr_t > ( addr ) ) ; <nl> static void jni_YGNodeRemoveChildJNI ( <nl> _jlong2YGNodeRef ( nativePointer ) , _jlong2YGNodeRef ( childPointer ) ) ; <nl> } <nl> <nl> + static void YGTransferLayoutOutputsRecursive ( <nl> + JNIEnv * env , <nl> + jobject thiz , <nl> + YGNodeRef root , <nl> + void * layoutContext ) { <nl> + if ( ! root - > getHasNewLayout ( ) ) { <nl> + return ; <nl> + } <nl> + auto obj = YGNodeJobject ( root , layoutContext ) ; <nl> + if ( ! obj ) { <nl> + Log : : log ( <nl> + root , <nl> + YGLogLevelError , <nl> + nullptr , <nl> + " Java YGNode was GCed during layout calculation \ n " ) ; <nl> + return ; <nl> + } <nl> + <nl> + auto edgesSet = YGNodeEdges { root } ; <nl> + <nl> + bool marginFieldSet = edgesSet . has ( YGNodeEdges : : MARGIN ) ; <nl> + bool paddingFieldSet = edgesSet . has ( YGNodeEdges : : PADDING ) ; <nl> + bool borderFieldSet = edgesSet . has ( YGNodeEdges : : BORDER ) ; <nl> + <nl> + int fieldFlags = edgesSet . get ( ) ; <nl> + fieldFlags | = HAS_NEW_LAYOUT ; <nl> + if ( YGNodeLayoutGetDidLegacyStretchFlagAffectLayout ( root ) ) { <nl> + fieldFlags | = DOES_LEGACY_STRETCH_BEHAVIOUR ; <nl> + } <nl> + <nl> + const int arrSize = 6 + ( marginFieldSet ? 4 : 0 ) + ( paddingFieldSet ? 4 : 0 ) + <nl> + ( borderFieldSet ? 4 : 0 ) ; <nl> + float arr [ 18 ] ; <nl> + arr [ LAYOUT_EDGE_SET_FLAG_INDEX ] = fieldFlags ; <nl> + arr [ LAYOUT_WIDTH_INDEX ] = YGNodeLayoutGetWidth ( root ) ; <nl> + arr [ LAYOUT_HEIGHT_INDEX ] = YGNodeLayoutGetHeight ( root ) ; <nl> + arr [ LAYOUT_LEFT_INDEX ] = YGNodeLayoutGetLeft ( root ) ; <nl> + arr [ LAYOUT_TOP_INDEX ] = YGNodeLayoutGetTop ( root ) ; <nl> + arr [ LAYOUT_DIRECTION_INDEX ] = <nl> + static_cast < jint > ( YGNodeLayoutGetDirection ( root ) ) ; <nl> + if ( marginFieldSet ) { <nl> + arr [ LAYOUT_MARGIN_START_INDEX ] = YGNodeLayoutGetMargin ( root , YGEdgeLeft ) ; <nl> + arr [ LAYOUT_MARGIN_START_INDEX + 1 ] = YGNodeLayoutGetMargin ( root , YGEdgeTop ) ; <nl> + arr [ LAYOUT_MARGIN_START_INDEX + 2 ] = <nl> + YGNodeLayoutGetMargin ( root , YGEdgeRight ) ; <nl> + arr [ LAYOUT_MARGIN_START_INDEX + 3 ] = <nl> + YGNodeLayoutGetMargin ( root , YGEdgeBottom ) ; <nl> + } <nl> + if ( paddingFieldSet ) { <nl> + int paddingStartIndex = <nl> + LAYOUT_PADDING_START_INDEX - ( marginFieldSet ? 0 : 4 ) ; <nl> + arr [ paddingStartIndex ] = YGNodeLayoutGetPadding ( root , YGEdgeLeft ) ; <nl> + arr [ paddingStartIndex + 1 ] = YGNodeLayoutGetPadding ( root , YGEdgeTop ) ; <nl> + arr [ paddingStartIndex + 2 ] = YGNodeLayoutGetPadding ( root , YGEdgeRight ) ; <nl> + arr [ paddingStartIndex + 3 ] = YGNodeLayoutGetPadding ( root , YGEdgeBottom ) ; <nl> + } <nl> + <nl> + if ( borderFieldSet ) { <nl> + int borderStartIndex = LAYOUT_BORDER_START_INDEX - <nl> + ( marginFieldSet ? 0 : 4 ) - ( paddingFieldSet ? 0 : 4 ) ; <nl> + arr [ borderStartIndex ] = YGNodeLayoutGetBorder ( root , YGEdgeLeft ) ; <nl> + arr [ borderStartIndex + 1 ] = YGNodeLayoutGetBorder ( root , YGEdgeTop ) ; <nl> + arr [ borderStartIndex + 2 ] = YGNodeLayoutGetBorder ( root , YGEdgeRight ) ; <nl> + arr [ borderStartIndex + 3 ] = YGNodeLayoutGetBorder ( root , YGEdgeBottom ) ; <nl> + } <nl> + <nl> + / / Don ' t change this field name without changing the name of the field in <nl> + / / Database . java <nl> + auto objectClass = facebook : : yoga : : vanillajni : : make_local_ref ( <nl> + env , env - > GetObjectClass ( obj . get ( ) ) ) ; <nl> + static const jfieldID arrField = facebook : : yoga : : vanillajni : : getFieldId ( <nl> + env , objectClass . get ( ) , " arr " , " [ F " ) ; <nl> + <nl> + ScopedLocalRef < jfloatArray > arrFinal = <nl> + make_local_ref ( env , env - > NewFloatArray ( arrSize ) ) ; <nl> + env - > SetFloatArrayRegion ( arrFinal . get ( ) , 0 , arrSize , arr ) ; <nl> + env - > SetObjectField ( obj . get ( ) , arrField , arrFinal . get ( ) ) ; <nl> + <nl> + root - > setHasNewLayout ( false ) ; <nl> + <nl> + for ( uint32_t i = 0 ; i < YGNodeGetChildCount ( root ) ; i + + ) { <nl> + YGTransferLayoutOutputsRecursive ( <nl> + env , thiz , YGNodeGetChild ( root , i ) , layoutContext ) ; <nl> + } <nl> + } <nl> + <nl> + static void jni_YGNodeCalculateLayoutJNI ( <nl> + JNIEnv * env , <nl> + jobject obj , <nl> + jlong nativePointer , <nl> + jfloat width , <nl> + jfloat height , <nl> + jlongArray nativePointers , <nl> + jobjectArray javaNodes ) { <nl> + <nl> + void * layoutContext = nullptr ; <nl> + auto map = PtrJNodeMap { } ; <nl> + if ( nativePointers ) { <nl> + size_t nativePointersSize = env - > GetArrayLength ( nativePointers ) ; <nl> + jlong result [ nativePointersSize ] ; <nl> + env - > GetLongArrayRegion ( nativePointers , 0 , nativePointersSize , result ) ; <nl> + <nl> + map = PtrJNodeMap { result , nativePointersSize , javaNodes } ; <nl> + layoutContext = & map ; <nl> + } <nl> + <nl> + const YGNodeRef root = _jlong2YGNodeRef ( nativePointer ) ; <nl> + YGNodeCalculateLayoutWithContext ( <nl> + root , <nl> + static_cast < float > ( width ) , <nl> + static_cast < float > ( height ) , <nl> + YGNodeStyleGetDirection ( _jlong2YGNodeRef ( nativePointer ) ) , <nl> + layoutContext ) ; <nl> + YGTransferLayoutOutputsRecursive ( env , obj , root , layoutContext ) ; <nl> + } <nl> + <nl> static void jni_YGNodeMarkDirtyJNI ( <nl> JNIEnv * env , <nl> jobject obj , <nl> static void jni_YGNodeSetStyleInputsJNI ( <nl> YGNodeSetStyleInputs ( _jlong2YGNodeRef ( nativePointer ) , result , size ) ; <nl> } <nl> <nl> - void assertNoPendingJniException ( JNIEnv * env ) { <nl> - / / This method cannot call any other method of the library , since other <nl> - / / methods of the library use it to check for exceptions too <nl> - if ( env - > ExceptionCheck ( ) ) { <nl> - env - > ExceptionDescribe ( ) ; <nl> - } <nl> - } <nl> - <nl> - void registerNativeMethods ( <nl> - JNIEnv * env , <nl> - const char * className , <nl> - JNINativeMethod methods [ ] , <nl> - size_t numMethods ) { <nl> - jclass clazz = env - > FindClass ( className ) ; <nl> - <nl> - assertNoPendingJniException ( env ) ; <nl> - <nl> - env - > RegisterNatives ( clazz , methods , numMethods ) ; <nl> - <nl> - assertNoPendingJniException ( env ) ; <nl> - } <nl> - <nl> static JNINativeMethod methods [ ] = { <nl> { " jni_YGConfigNewJNI " , " ( ) J " , ( void * ) jni_YGConfigNewJNI } , <nl> / / { " jni_YGConfigFreeJNI " , " ( J ) V " , ( void * ) jni_YGConfigFreeJNI } , <nl> static JNINativeMethod methods [ ] = { <nl> ( void * ) jni_YGNodeIsReferenceBaselineJNI } , <nl> { " jni_YGNodeClearChildrenJNI " , " ( J ) V " , ( void * ) jni_YGNodeClearChildrenJNI } , <nl> { " jni_YGNodeRemoveChildJNI " , " ( JJ ) V " , ( void * ) jni_YGNodeRemoveChildJNI } , <nl> + { " jni_YGNodeCalculateLayoutJNI " , <nl> + " ( JFF [ J [ Lcom / facebook / yoga / YogaNodeJNIBase ; ) V " , <nl> + ( void * ) jni_YGNodeCalculateLayoutJNI } , <nl> { " jni_YGNodeMarkDirtyJNI " , " ( J ) V " , ( void * ) jni_YGNodeMarkDirtyJNI } , <nl> { " jni_YGNodeMarkDirtyAndPropogateToDescendantsJNI " , <nl> " ( J ) V " , <nl> static JNINativeMethod methods [ ] = { <nl> } ; <nl> <nl> void YGJNIVanilla : : registerNatives ( JNIEnv * env ) { <nl> - registerNativeMethods ( <nl> + facebook : : yoga : : vanillajni : : registerNatives ( <nl> env , <nl> " com / facebook / yoga / YogaNative " , <nl> methods , <nl> new file mode 100644 <nl> index 000000000 . . d98487ae4 <nl> mmm / dev / null <nl> ppp b / java / jni / YGJTypesVanilla . h <nl> <nl> + / * <nl> + * Copyright ( c ) Facebook , Inc . and its affiliates . <nl> + * <nl> + * This source code is licensed under the MIT license found in the LICENSE <nl> + * file in the root directory of this source tree . <nl> + * / <nl> + # include " jni . h " <nl> + # include < yoga / YGValue . h > <nl> + # include < yoga / Yoga . h > <nl> + # include < map > <nl> + # include " common . h " <nl> + <nl> + using namespace facebook : : yoga : : vanillajni ; <nl> + using namespace std ; <nl> + <nl> + class PtrJNodeMap { <nl> + std : : map < YGNodeRef , size_t > ptrsToIdxs_ ; <nl> + jobjectArray javaNodes_ ; <nl> + <nl> + public : <nl> + PtrJNodeMap ( ) : ptrsToIdxs_ { } , javaNodes_ { } { } <nl> + PtrJNodeMap ( <nl> + jlong * nativePointers , <nl> + size_t nativePointersSize , <nl> + jobjectArray javaNodes ) <nl> + : javaNodes_ { javaNodes } { <nl> + for ( size_t i = 0 ; i < nativePointersSize ; + + i ) { <nl> + ptrsToIdxs_ [ ( YGNodeRef ) nativePointers [ i ] ] = i ; <nl> + } <nl> + } <nl> + <nl> + ScopedLocalRef < jobject > ref ( JNIEnv * env , YGNodeRef node ) { <nl> + auto idx = ptrsToIdxs_ . find ( node ) ; <nl> + if ( idx = = ptrsToIdxs_ . end ( ) ) { <nl> + return ScopedLocalRef < jobject > ( env ) ; <nl> + } else { <nl> + return make_local_ref ( <nl> + env , env - > GetObjectArrayElement ( javaNodes_ , idx - > second ) ) ; <nl> + } <nl> + } <nl> + } ; <nl>
Move calculate layout method to vanilla JNI
facebook/yoga
34739ec65203fb256641343d4ab174c91082c8f4
2019-10-09T00:51:34Z
mmm a / xbmc / cores / dvdplayer / DVDAudio . cpp <nl> ppp b / xbmc / cores / dvdplayer / DVDAudio . cpp <nl> <nl> <nl> using namespace std ; <nl> <nl> + <nl> + CPTSOutputQueue : : CPTSOutputQueue ( ) <nl> + { <nl> + Flush ( ) ; <nl> + } <nl> + <nl> + void CPTSOutputQueue : : Add ( double pts , double delay , double duration ) <nl> + { <nl> + CSingleLock lock ( m_sync ) ; <nl> + <nl> + TPTSItem item ; <nl> + item . pts = pts ; <nl> + item . timestamp = CDVDClock : : GetAbsoluteClock ( ) + delay ; <nl> + item . duration = duration ; <nl> + <nl> + / / first one is applied directly <nl> + if ( m_queue . empty ( ) & & m_current . pts = = DVD_NOPTS_VALUE ) <nl> + m_current = item ; <nl> + else <nl> + m_queue . push ( item ) ; <nl> + <nl> + / / call function to make sure the queue <nl> + / / doesn ' t grow should nobody call it <nl> + Current ( ) ; <nl> + } <nl> + void CPTSOutputQueue : : Flush ( ) <nl> + { <nl> + CSingleLock lock ( m_sync ) ; <nl> + <nl> + while ( ! m_queue . empty ( ) ) m_queue . pop ( ) ; <nl> + m_current . pts = DVD_NOPTS_VALUE ; <nl> + m_current . timestamp = 0 . 0 ; <nl> + m_current . duration = 0 . 0 ; <nl> + } <nl> + <nl> + double CPTSOutputQueue : : Current ( ) <nl> + { <nl> + CSingleLock lock ( m_sync ) ; <nl> + <nl> + if ( ! m_queue . empty ( ) & & m_current . pts = = DVD_NOPTS_VALUE ) <nl> + { <nl> + m_current = m_queue . front ( ) ; <nl> + m_queue . pop ( ) ; <nl> + } <nl> + <nl> + while ( ! m_queue . empty ( ) & & CDVDClock : : GetAbsoluteClock ( ) > = m_queue . front ( ) . timestamp ) <nl> + { <nl> + m_current = m_queue . front ( ) ; <nl> + m_queue . pop ( ) ; <nl> + } <nl> + <nl> + if ( m_current . timestamp = = 0 ) return m_current . pts ; <nl> + <nl> + return m_current . pts + min ( m_current . duration , ( CDVDClock : : GetAbsoluteClock ( ) - m_current . timestamp ) ) ; <nl> + } <nl> + <nl> + <nl> CDVDAudio : : CDVDAudio ( volatile bool & bStop ) <nl> : m_bStop ( bStop ) <nl> { <nl> mmm a / xbmc / cores / dvdplayer / DVDAudio . h <nl> ppp b / xbmc / cores / dvdplayer / DVDAudio . h <nl> <nl> # endif <nl> # include " threads / CriticalSection . h " <nl> # include " PlatformDefs . h " <nl> + # include < queue > <nl> <nl> # include " cores / AudioEngine / Utils / AEChannelInfo . h " <nl> class IAEStream ; <nl> extern " C " { <nl> # endif <nl> typedef struct stDVDAudioFrame DVDAudioFrame ; <nl> <nl> + <nl> + class CPTSOutputQueue <nl> + { <nl> + private : <nl> + typedef struct { double pts ; double timestamp ; double duration ; } TPTSItem ; <nl> + TPTSItem m_current ; <nl> + std : : queue < TPTSItem > m_queue ; <nl> + CCriticalSection m_sync ; <nl> + <nl> + public : <nl> + CPTSOutputQueue ( ) ; <nl> + void Add ( double pts , double delay , double duration ) ; <nl> + void Flush ( ) ; <nl> + double Current ( ) ; <nl> + } ; <nl> + <nl> class CSingleLock ; <nl> class IAudioCallback ; <nl> <nl> mmm a / xbmc / cores / dvdplayer / DVDPlayerAudio . cpp <nl> ppp b / xbmc / cores / dvdplayer / DVDPlayerAudio . cpp <nl> <nl> <nl> using namespace std ; <nl> <nl> - CPTSOutputQueue : : CPTSOutputQueue ( ) <nl> - { <nl> - Flush ( ) ; <nl> - } <nl> - <nl> - void CPTSOutputQueue : : Add ( double pts , double delay , double duration ) <nl> - { <nl> - CSingleLock lock ( m_sync ) ; <nl> - <nl> - TPTSItem item ; <nl> - item . pts = pts ; <nl> - item . timestamp = CDVDClock : : GetAbsoluteClock ( ) + delay ; <nl> - item . duration = duration ; <nl> - <nl> - / / first one is applied directly <nl> - if ( m_queue . empty ( ) & & m_current . pts = = DVD_NOPTS_VALUE ) <nl> - m_current = item ; <nl> - else <nl> - m_queue . push ( item ) ; <nl> - <nl> - / / call function to make sure the queue <nl> - / / doesn ' t grow should nobody call it <nl> - Current ( ) ; <nl> - } <nl> - void CPTSOutputQueue : : Flush ( ) <nl> - { <nl> - CSingleLock lock ( m_sync ) ; <nl> - <nl> - while ( ! m_queue . empty ( ) ) m_queue . pop ( ) ; <nl> - m_current . pts = DVD_NOPTS_VALUE ; <nl> - m_current . timestamp = 0 . 0 ; <nl> - m_current . duration = 0 . 0 ; <nl> - } <nl> - <nl> - double CPTSOutputQueue : : Current ( ) <nl> - { <nl> - CSingleLock lock ( m_sync ) ; <nl> - <nl> - if ( ! m_queue . empty ( ) & & m_current . pts = = DVD_NOPTS_VALUE ) <nl> - { <nl> - m_current = m_queue . front ( ) ; <nl> - m_queue . pop ( ) ; <nl> - } <nl> - <nl> - while ( ! m_queue . empty ( ) & & CDVDClock : : GetAbsoluteClock ( ) > = m_queue . front ( ) . timestamp ) <nl> - { <nl> - m_current = m_queue . front ( ) ; <nl> - m_queue . pop ( ) ; <nl> - } <nl> - <nl> - if ( m_current . timestamp = = 0 ) return m_current . pts ; <nl> - <nl> - return m_current . pts + min ( m_current . duration , ( CDVDClock : : GetAbsoluteClock ( ) - m_current . timestamp ) ) ; <nl> - } <nl> - <nl> void CPTSInputQueue : : Add ( int64_t bytes , double pts ) <nl> { <nl> CSingleLock lock ( m_sync ) ; <nl> mmm a / xbmc / cores / dvdplayer / DVDPlayerAudio . h <nl> ppp b / xbmc / cores / dvdplayer / DVDPlayerAudio . h <nl> typedef struct stDVDAudioFrame <nl> bool passthrough ; <nl> } DVDAudioFrame ; <nl> <nl> - class CPTSOutputQueue <nl> - { <nl> - private : <nl> - typedef struct { double pts ; double timestamp ; double duration ; } TPTSItem ; <nl> - TPTSItem m_current ; <nl> - std : : queue < TPTSItem > m_queue ; <nl> - CCriticalSection m_sync ; <nl> - <nl> - public : <nl> - CPTSOutputQueue ( ) ; <nl> - void Add ( double pts , double delay , double duration ) ; <nl> - void Flush ( ) ; <nl> - double Current ( ) ; <nl> - } ; <nl> - <nl> class CPTSInputQueue <nl> { <nl> private : <nl>
dvdplayer : move pts output queue into DVDAudio
xbmc/xbmc
df2b446c7853e18ef9cac4b6c18f1e3f9bc54f3d
2012-10-06T17:18:24Z